herdr-remote-relay 0.3.23 → 0.3.25

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 Mx=Object.defineProperty;var Ax=(a,n,l)=>n in a?Mx(a,n,{enumerable:!0,configurable:!0,writable:!0,value:l}):a[n]=l;var $=(a,n,l)=>Ax(a,typeof n!="symbol"?n+"":n,l);import{r as gb,g as bb,a as yb}from"./vendor-react-CYSfZuHu.js";import{r as Ex,a as Nx}from"./vendor-xterm-BhCxil_4.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))o(r);new MutationObserver(r=>{for(const c of r)if(c.type==="childList")for(const h of c.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&o(h)}).observe(document,{childList:!0,subtree:!0});function l(r){const c={};return r.integrity&&(c.integrity=r.integrity),r.referrerPolicy&&(c.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?c.credentials="include":r.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function o(r){if(r.ep)return;r.ep=!0;const c=l(r);fetch(r.href,c)}})();var Ku={exports:{}},ls={};/**
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 $p;function kx(){if($p)return ls;$p=1;var a=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function l(o,r,c){var h=null;if(c!==void 0&&(h=""+c),r.key!==void 0&&(h=""+r.key),"key"in r){c={};for(var m in r)m!=="key"&&(c[m]=r[m])}else c=r;return r=c.ref,{$$typeof:a,type:o,key:h,ref:r!==void 0?r:null,props:c}}return ls.Fragment=n,ls.jsx=l,ls.jsxs=l,ls}var qp;function Lx(){return qp||(qp=1,Ku.exports=kx()),Ku.exports}var f=Lx(),T=gb();const Jn=bb(T);var Iu={exports:{}},ss={},Fu={exports:{}},Gu={};/**
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 Xp;function _x(){return Xp||(Xp=1,(function(a){function n(A,G){var W=A.length;A.push(G);e:for(;0<W;){var se=W-1>>>1,Q=A[se];if(0<r(Q,G))A[se]=G,A[W]=Q,W=se;else break e}}function l(A){return A.length===0?null:A[0]}function o(A){if(A.length===0)return null;var G=A[0],W=A.pop();if(W!==G){A[0]=W;e:for(var se=0,Q=A.length,ge=Q>>>1;se<ge;){var ye=2*(se+1)-1,ue=A[ye],Te=ye+1,ce=A[Te];if(0>r(ue,W))Te<Q&&0>r(ce,ue)?(A[se]=ce,A[Te]=W,se=Te):(A[se]=ue,A[ye]=W,se=ye);else if(Te<Q&&0>r(ce,W))A[se]=ce,A[Te]=W,se=Te;else break e}}return G}function r(A,G){var W=A.sortIndex-G.sortIndex;return W!==0?W:A.id-G.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;a.unstable_now=function(){return c.now()}}else{var h=Date,m=h.now();a.unstable_now=function(){return h.now()-m}}var p=[],g=[],y=1,v=null,x=3,w=!1,S=!1,M=!1,N=!1,k=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,R=typeof setImmediate<"u"?setImmediate:null;function H(A){for(var G=l(g);G!==null;){if(G.callback===null)o(g);else if(G.startTime<=A)o(g),G.sortIndex=G.expirationTime,n(p,G);else break;G=l(g)}}function j(A){if(M=!1,H(A),!S)if(l(p)!==null)S=!0,D||(D=!0,Z());else{var G=l(g);G!==null&&P(j,G.startTime-A)}}var D=!1,_=-1,z=5,K=-1;function q(){return N?!0:!(a.unstable_now()-K<z)}function te(){if(N=!1,D){var A=a.unstable_now();K=A;var G=!0;try{e:{S=!1,M&&(M=!1,E(_),_=-1),w=!0;var W=x;try{t:{for(H(A),v=l(p);v!==null&&!(v.expirationTime>A&&q());){var se=v.callback;if(typeof se=="function"){v.callback=null,x=v.priorityLevel;var Q=se(v.expirationTime<=A);if(A=a.unstable_now(),typeof Q=="function"){v.callback=Q,H(A),G=!0;break t}v===l(p)&&o(p),H(A)}else o(p);v=l(p)}if(v!==null)G=!0;else{var ge=l(g);ge!==null&&P(j,ge.startTime-A),G=!1}}break e}finally{v=null,x=W,w=!1}G=void 0}}finally{G?Z():D=!1}}}var Z;if(typeof R=="function")Z=function(){R(te)};else if(typeof MessageChannel<"u"){var ie=new MessageChannel,re=ie.port2;ie.port1.onmessage=te,Z=function(){re.postMessage(null)}}else Z=function(){k(te,0)};function P(A,G){_=k(function(){A(a.unstable_now())},G)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(A){A.callback=null},a.unstable_forceFrameRate=function(A){0>A||125<A?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<A?Math.floor(1e3/A):5},a.unstable_getCurrentPriorityLevel=function(){return x},a.unstable_next=function(A){switch(x){case 1:case 2:case 3:var G=3;break;default:G=x}var W=x;x=G;try{return A()}finally{x=W}},a.unstable_requestPaint=function(){N=!0},a.unstable_runWithPriority=function(A,G){switch(A){case 1:case 2:case 3:case 4:case 5:break;default:A=3}var W=x;x=A;try{return G()}finally{x=W}},a.unstable_scheduleCallback=function(A,G,W){var se=a.unstable_now();switch(typeof W=="object"&&W!==null?(W=W.delay,W=typeof W=="number"&&0<W?se+W:se):W=se,A){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=W+Q,A={id:y++,callback:G,priorityLevel:A,startTime:W,expirationTime:Q,sortIndex:-1},W>se?(A.sortIndex=W,n(g,A),l(p)===null&&A===l(g)&&(M?(E(_),_=-1):M=!0,P(j,W-se))):(A.sortIndex=Q,n(p,A),S||w||(S=!0,D||(D=!0,Z()))),A},a.unstable_shouldYield=q,a.unstable_wrapCallback=function(A){var G=x;return function(){var W=x;x=G;try{return A.apply(this,arguments)}finally{x=W}}}})(Gu)),Gu}var Zp;function Rx(){return Zp||(Zp=1,Fu.exports=_x()),Fu.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 Wp;function jx(){if(Wp)return ss;Wp=1;var a=Rx(),n=gb(),l=yb();function o(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)t+="&args[]="+encodeURIComponent(arguments[i])}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 r(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function c(e){var t=e,i=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(i=t.return),e=t.return;while(e)}return t.tag===3?i:null}function h(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function m(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function p(e){if(c(e)!==e)throw Error(o(188))}function g(e){var t=e.alternate;if(!t){if(t=c(e),t===null)throw Error(o(188));return t!==e?null:e}for(var i=e,s=t;;){var u=i.return;if(u===null)break;var d=u.alternate;if(d===null){if(s=u.return,s!==null){i=s;continue}break}if(u.child===d.child){for(d=u.child;d;){if(d===i)return p(u),e;if(d===s)return p(u),t;d=d.sibling}throw Error(o(188))}if(i.return!==s.return)i=u,s=d;else{for(var b=!1,C=u.child;C;){if(C===i){b=!0,i=u,s=d;break}if(C===s){b=!0,s=u,i=d;break}C=C.sibling}if(!b){for(C=d.child;C;){if(C===i){b=!0,i=d,s=u;break}if(C===s){b=!0,s=d,i=u;break}C=C.sibling}if(!b)throw Error(o(189))}}if(i.alternate!==s)throw Error(o(190))}if(i.tag!==3)throw Error(o(188));return i.stateNode.current===i?e:t}function y(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=y(e),t!==null)return t;e=e.sibling}return null}var v=Object.assign,x=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),R=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),j=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),_=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),K=Symbol.for("react.activity"),q=Symbol.for("react.memo_cache_sentinel"),te=Symbol.iterator;function Z(e){return e===null||typeof e!="object"?null:(e=te&&e[te]||e["@@iterator"],typeof e=="function"?e:null)}var ie=Symbol.for("react.client.reference");function re(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ie?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case M:return"Fragment";case k:return"Profiler";case N:return"StrictMode";case j:return"Suspense";case D:return"SuspenseList";case K:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case S:return"Portal";case R:return e.displayName||"Context";case E:return(e._context.displayName||"Context")+".Consumer";case H:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case _:return t=e.displayName||null,t!==null?t:re(e.type)||"Memo";case z:t=e._payload,e=e._init;try{return re(e(t))}catch{}}return null}var P=Array.isArray,A=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G=l.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W={pending:!1,data:null,method:null,action:null},se=[],Q=-1;function ge(e){return{current:e}}function ye(e){0>Q||(e.current=se[Q],se[Q]=null,Q--)}function ue(e,t){Q++,se[Q]=e.current,e.current=t}var Te=ge(null),ce=ge(null),be=ge(null),ae=ge(null);function we(e,t){switch(ue(be,t),ue(ce,e),ue(Te,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?gp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=gp(t),e=bp(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}ye(Te),ue(Te,e)}function le(){ye(Te),ye(ce),ye(be)}function ve(e){e.memoizedState!==null&&ue(ae,e);var t=Te.current,i=bp(t,e.type);t!==i&&(ue(ce,e),ue(Te,i))}function Ne(e){ce.current===e&&(ye(Te),ye(ce)),ae.current===e&&(ye(ae),ts._currentValue=W)}var Ie,Xe;function tt(e){if(Ie===void 0)try{throw Error()}catch(i){var t=i.stack.trim().match(/\n( *(at )?)/);Ie=t&&t[1]||"",Xe=-1<i.stack.indexOf(`
26
+ at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
27
+ `+Ie+e+Xe}var xe=!1;function Ae(e,t){if(!e||xe)return"";xe=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(t){var ee=function(){throw Error()};if(Object.defineProperty(ee.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ee,[])}catch(V){var Y=V}Reflect.construct(e,[],ee)}else{try{ee.call()}catch(V){Y=V}e.call(ee.prototype)}}else{try{throw Error()}catch(V){Y=V}(ee=e())&&typeof ee.catch=="function"&&ee.catch(function(){})}}catch(V){if(V&&Y&&typeof V.stack=="string")return[V.stack,Y.stack]}return[null,null]}};s.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(s.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(s.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var d=s.DetermineComponentFrameRoot(),b=d[0],C=d[1];if(b&&C){var L=b.split(`
28
+ `),F=C.split(`
29
+ `);for(u=s=0;s<L.length&&!L[s].includes("DetermineComponentFrameRoot");)s++;for(;u<F.length&&!F[u].includes("DetermineComponentFrameRoot");)u++;if(s===L.length||u===F.length)for(s=L.length-1,u=F.length-1;1<=s&&0<=u&&L[s]!==F[u];)u--;for(;1<=s&&0<=u;s--,u--)if(L[s]!==F[u]){if(s!==1||u!==1)do if(s--,u--,0>u||L[s]!==F[u]){var X=`
30
+ `+L[s].replace(" at new "," at ");return e.displayName&&X.includes("<anonymous>")&&(X=X.replace("<anonymous>",e.displayName)),X}while(1<=s&&0<=u);break}}}finally{xe=!1,Error.prepareStackTrace=i}return(i=e?e.displayName||e.name:"")?tt(i):""}function st(e,t){switch(e.tag){case 26:case 27:case 5:return tt(e.type);case 16:return tt("Lazy");case 13:return e.child!==t&&t!==null?tt("Suspense Fallback"):tt("Suspense");case 19:return tt("SuspenseList");case 0:case 15:return Ae(e.type,!1);case 11:return Ae(e.type.render,!1);case 1:return Ae(e.type,!0);case 31:return tt("Activity");default:return""}}function it(e){try{var t="",i=null;do t+=st(e,i),i=e,e=e.return;while(e);return t}catch(s){return`
31
+ Error generating stack: `+s.message+`
32
+ `+s.stack}}var bt=Object.prototype.hasOwnProperty,yn=a.unstable_scheduleCallback,vn=a.unstable_cancelCallback,kn=a.unstable_shouldYield,Zt=a.unstable_requestPaint,ut=a.unstable_now,Es=a.unstable_getCurrentPriorityLevel,dl=a.unstable_ImmediatePriority,fl=a.unstable_UserBlockingPriority,Di=a.unstable_NormalPriority,Ns=a.unstable_LowPriority,hl=a.unstable_IdlePriority,ks=a.log,Ls=a.unstable_setDisableYieldValue,ti=null,At=null;function xn(e){if(typeof ks=="function"&&Ls(e),At&&typeof At.setStrictMode=="function")try{At.setStrictMode(ti,e)}catch{}}var kt=Math.clz32?Math.clz32:qe,_s=Math.log,de=Math.LN2;function qe(e){return e>>>=0,e===0?32:31-(_s(e)/de|0)|0}var Lt=256,It=262144,ca=4194304;function Ln(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 ua(e,t,i){var s=e.pendingLanes;if(s===0)return 0;var u=0,d=e.suspendedLanes,b=e.pingedLanes;e=e.warmLanes;var C=s&134217727;return C!==0?(s=C&~d,s!==0?u=Ln(s):(b&=C,b!==0?u=Ln(b):i||(i=C&~e,i!==0&&(u=Ln(i))))):(C=s&~d,C!==0?u=Ln(C):b!==0?u=Ln(b):i||(i=s&~e,i!==0&&(u=Ln(i)))),u===0?0:t!==0&&t!==u&&(t&d)===0&&(d=u&-u,i=t&-t,d>=i||d===32&&(i&4194048)!==0)?t:u}function ni(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Er(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 ml(){var e=ca;return ca<<=1,(ca&62914560)===0&&(ca=4194304),e}function Nr(e){for(var t=[],i=0;31>i;i++)t.push(e);return t}function pl(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function h0(e,t,i,s,u,d){var b=e.pendingLanes;e.pendingLanes=i,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=i,e.entangledLanes&=i,e.errorRecoveryDisabledLanes&=i,e.shellSuspendCounter=0;var C=e.entanglements,L=e.expirationTimes,F=e.hiddenUpdates;for(i=b&~i;0<i;){var X=31-kt(i),ee=1<<X;C[X]=0,L[X]=-1;var Y=F[X];if(Y!==null)for(F[X]=null,X=0;X<Y.length;X++){var V=Y[X];V!==null&&(V.lane&=-536870913)}i&=~ee}s!==0&&Wd(e,s,0),d!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=d&~(b&~t))}function Wd(e,t,i){e.pendingLanes|=t,e.suspendedLanes&=~t;var s=31-kt(t);e.entangledLanes|=t,e.entanglements[s]=e.entanglements[s]|1073741824|i&261930}function Qd(e,t){var i=e.entangledLanes|=t;for(e=e.entanglements;i;){var s=31-kt(i),u=1<<s;u&t|e[s]&t&&(e[s]|=t),i&=~u}}function Jd(e,t){var i=t&-t;return i=(i&42)!==0?1:kr(i),(i&(e.suspendedLanes|t))!==0?0:i}function kr(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 Lr(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function ef(){var e=G.p;return e!==0?e:(e=window.event,e===void 0?32:Kp(e.type))}function tf(e,t){var i=G.p;try{return G.p=e,t()}finally{G.p=i}}var ii=Math.random().toString(36).slice(2),wt="__reactFiber$"+ii,jt="__reactProps$"+ii,da="__reactContainer$"+ii,_r="__reactEvents$"+ii,m0="__reactListeners$"+ii,p0="__reactHandles$"+ii,nf="__reactResources$"+ii,gl="__reactMarker$"+ii;function Rr(e){delete e[wt],delete e[jt],delete e[_r],delete e[m0],delete e[p0]}function fa(e){var t=e[wt];if(t)return t;for(var i=e.parentNode;i;){if(t=i[da]||i[wt]){if(i=t.alternate,t.child!==null||i!==null&&i.child!==null)for(e=Tp(e);e!==null;){if(i=e[wt])return i;e=Tp(e)}return t}e=i,i=e.parentNode}return null}function ha(e){if(e=e[wt]||e[da]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function bl(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function ma(e){var t=e[nf];return t||(t=e[nf]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function yt(e){e[gl]=!0}var af=new Set,lf={};function zi(e,t){pa(e,t),pa(e+"Capture",t)}function pa(e,t){for(lf[e]=t,e=0;e<t.length;e++)af.add(t[e])}var g0=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]*$"),sf={},of={};function b0(e){return bt.call(of,e)?!0:bt.call(sf,e)?!1:g0.test(e)?of[e]=!0:(sf[e]=!0,!1)}function Rs(e,t,i){if(b0(t))if(i===null)e.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var s=t.toLowerCase().slice(0,5);if(s!=="data-"&&s!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+i)}}function js(e,t,i){if(i===null)e.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+i)}}function _n(e,t,i,s){if(s===null)e.removeAttribute(i);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(i);return}e.setAttributeNS(t,i,""+s)}}function Wt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function rf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function y0(e,t,i){var s=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var u=s.get,d=s.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return u.call(this)},set:function(b){i=""+b,d.call(this,b)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return i},setValue:function(b){i=""+b},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function jr(e){if(!e._valueTracker){var t=rf(e)?"checked":"value";e._valueTracker=y0(e,t,""+e[t])}}function cf(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),s="";return e&&(s=rf(e)?e.checked?"true":"false":e.value),e=s,e!==i?(t.setValue(e),!0):!1}function Os(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 v0=/[\n"\\]/g;function Qt(e){return e.replace(v0,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Or(e,t,i,s,u,d,b,C){e.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.type=b:e.removeAttribute("type"),t!=null?b==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Wt(t)):e.value!==""+Wt(t)&&(e.value=""+Wt(t)):b!=="submit"&&b!=="reset"||e.removeAttribute("value"),t!=null?Dr(e,b,Wt(t)):i!=null?Dr(e,b,Wt(i)):s!=null&&e.removeAttribute("value"),u==null&&d!=null&&(e.defaultChecked=!!d),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?e.name=""+Wt(C):e.removeAttribute("name")}function uf(e,t,i,s,u,d,b,C){if(d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(e.type=d),t!=null||i!=null){if(!(d!=="submit"&&d!=="reset"||t!=null)){jr(e);return}i=i!=null?""+Wt(i):"",t=t!=null?""+Wt(t):i,C||t===e.value||(e.value=t),e.defaultValue=t}s=s??u,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=C?e.checked:!!s,e.defaultChecked=!!s,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(e.name=b),jr(e)}function Dr(e,t,i){t==="number"&&Os(e.ownerDocument)===e||e.defaultValue===""+i||(e.defaultValue=""+i)}function ga(e,t,i,s){if(e=e.options,t){t={};for(var u=0;u<i.length;u++)t["$"+i[u]]=!0;for(i=0;i<e.length;i++)u=t.hasOwnProperty("$"+e[i].value),e[i].selected!==u&&(e[i].selected=u),u&&s&&(e[i].defaultSelected=!0)}else{for(i=""+Wt(i),t=null,u=0;u<e.length;u++){if(e[u].value===i){e[u].selected=!0,s&&(e[u].defaultSelected=!0);return}t!==null||e[u].disabled||(t=e[u])}t!==null&&(t.selected=!0)}}function df(e,t,i){if(t!=null&&(t=""+Wt(t),t!==e.value&&(e.value=t),i==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=i!=null?""+Wt(i):""}function ff(e,t,i,s){if(t==null){if(s!=null){if(i!=null)throw Error(o(92));if(P(s)){if(1<s.length)throw Error(o(93));s=s[0]}i=s}i==null&&(i=""),t=i}i=Wt(t),e.defaultValue=i,s=e.textContent,s===i&&s!==""&&s!==null&&(e.value=s),jr(e)}function ba(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=t;return}}e.textContent=t}var x0=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 hf(e,t,i){var s=t.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?s?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":s?e.setProperty(t,i):typeof i!="number"||i===0||x0.has(t)?t==="float"?e.cssFloat=i:e[t]=(""+i).trim():e[t]=i+"px"}function mf(e,t,i){if(t!=null&&typeof t!="object")throw Error(o(62));if(e=e.style,i!=null){for(var s in i)!i.hasOwnProperty(s)||t!=null&&t.hasOwnProperty(s)||(s.indexOf("--")===0?e.setProperty(s,""):s==="float"?e.cssFloat="":e[s]="");for(var u in t)s=t[u],t.hasOwnProperty(u)&&i[u]!==s&&hf(e,u,s)}else for(var d in t)t.hasOwnProperty(d)&&hf(e,d,t[d])}function zr(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 w0=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"]]),S0=/^[\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 Ds(e){return S0.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Rn(){}var Hr=null;function Br(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ya=null,va=null;function pf(e){var t=ha(e);if(t&&(e=t.stateNode)){var i=e[jt]||null;e:switch(e=t.stateNode,t.type){case"input":if(Or(e,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),t=i.name,i.type==="radio"&&t!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+Qt(""+t)+'"][type="radio"]'),t=0;t<i.length;t++){var s=i[t];if(s!==e&&s.form===e.form){var u=s[jt]||null;if(!u)throw Error(o(90));Or(s,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(t=0;t<i.length;t++)s=i[t],s.form===e.form&&cf(s)}break e;case"textarea":df(e,i.value,i.defaultValue);break e;case"select":t=i.value,t!=null&&ga(e,!!i.multiple,t,!1)}}}var Ur=!1;function gf(e,t,i){if(Ur)return e(t,i);Ur=!0;try{var s=e(t);return s}finally{if(Ur=!1,(ya!==null||va!==null)&&(Co(),ya&&(t=ya,e=va,va=ya=null,pf(t),e)))for(t=0;t<e.length;t++)pf(e[t])}}function yl(e,t){var i=e.stateNode;if(i===null)return null;var s=i[jt]||null;if(s===null)return null;i=s[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":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(o(231,t,typeof i));return i}var jn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Kr=!1;if(jn)try{var vl={};Object.defineProperty(vl,"passive",{get:function(){Kr=!0}}),window.addEventListener("test",vl,vl),window.removeEventListener("test",vl,vl)}catch{Kr=!1}var ai=null,Ir=null,zs=null;function bf(){if(zs)return zs;var e,t=Ir,i=t.length,s,u="value"in ai?ai.value:ai.textContent,d=u.length;for(e=0;e<i&&t[e]===u[e];e++);var b=i-e;for(s=1;s<=b&&t[i-s]===u[d-s];s++);return zs=u.slice(e,1<s?1-s:void 0)}function Hs(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 Bs(){return!0}function yf(){return!1}function Ot(e){function t(i,s,u,d,b){this._reactName=i,this._targetInst=u,this.type=s,this.nativeEvent=d,this.target=b,this.currentTarget=null;for(var C in e)e.hasOwnProperty(C)&&(i=e[C],this[C]=i?i(d):d[C]);return this.isDefaultPrevented=(d.defaultPrevented!=null?d.defaultPrevented:d.returnValue===!1)?Bs:yf,this.isPropagationStopped=yf,this}return v(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=Bs)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=Bs)},persist:function(){},isPersistent:Bs}),t}var Hi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Us=Ot(Hi),xl=v({},Hi,{view:0,detail:0}),C0=Ot(xl),Fr,Gr,wl,Ks=v({},xl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Pr,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!==wl&&(wl&&e.type==="mousemove"?(Fr=e.screenX-wl.screenX,Gr=e.screenY-wl.screenY):Gr=Fr=0,wl=e),Fr)},movementY:function(e){return"movementY"in e?e.movementY:Gr}}),vf=Ot(Ks),T0=v({},Ks,{dataTransfer:0}),M0=Ot(T0),A0=v({},xl,{relatedTarget:0}),Yr=Ot(A0),E0=v({},Hi,{animationName:0,elapsedTime:0,pseudoElement:0}),N0=Ot(E0),k0=v({},Hi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),L0=Ot(k0),_0=v({},Hi,{data:0}),xf=Ot(_0),R0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},j0={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"},O0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function D0(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=O0[e])?!!t[e]:!1}function Pr(){return D0}var z0=v({},xl,{key:function(e){if(e.key){var t=R0[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Hs(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?j0[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Pr,charCode:function(e){return e.type==="keypress"?Hs(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Hs(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),H0=Ot(z0),B0=v({},Ks,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),wf=Ot(B0),U0=v({},xl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Pr}),K0=Ot(U0),I0=v({},Hi,{propertyName:0,elapsedTime:0,pseudoElement:0}),F0=Ot(I0),G0=v({},Ks,{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}),Y0=Ot(G0),P0=v({},Hi,{newState:0,oldState:0}),V0=Ot(P0),$0=[9,13,27,32],Vr=jn&&"CompositionEvent"in window,Sl=null;jn&&"documentMode"in document&&(Sl=document.documentMode);var q0=jn&&"TextEvent"in window&&!Sl,Sf=jn&&(!Vr||Sl&&8<Sl&&11>=Sl),Cf=" ",Tf=!1;function Mf(e,t){switch(e){case"keyup":return $0.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Af(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var xa=!1;function X0(e,t){switch(e){case"compositionend":return Af(t);case"keypress":return t.which!==32?null:(Tf=!0,Cf);case"textInput":return e=t.data,e===Cf&&Tf?null:e;default:return null}}function Z0(e,t){if(xa)return e==="compositionend"||!Vr&&Mf(e,t)?(e=bf(),zs=Ir=ai=null,xa=!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 Sf&&t.locale!=="ko"?null:t.data;default:return null}}var W0={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 Ef(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!W0[e.type]:t==="textarea"}function Nf(e,t,i,s){ya?va?va.push(s):va=[s]:ya=s,t=Lo(t,"onChange"),0<t.length&&(i=new Us("onChange","change",null,i,s),e.push({event:i,listeners:t}))}var Cl=null,Tl=null;function Q0(e){up(e,0)}function Is(e){var t=bl(e);if(cf(t))return e}function kf(e,t){if(e==="change")return t}var Lf=!1;if(jn){var $r;if(jn){var qr="oninput"in document;if(!qr){var _f=document.createElement("div");_f.setAttribute("oninput","return;"),qr=typeof _f.oninput=="function"}$r=qr}else $r=!1;Lf=$r&&(!document.documentMode||9<document.documentMode)}function Rf(){Cl&&(Cl.detachEvent("onpropertychange",jf),Tl=Cl=null)}function jf(e){if(e.propertyName==="value"&&Is(Tl)){var t=[];Nf(t,Tl,e,Br(e)),gf(Q0,t)}}function J0(e,t,i){e==="focusin"?(Rf(),Cl=t,Tl=i,Cl.attachEvent("onpropertychange",jf)):e==="focusout"&&Rf()}function ev(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Is(Tl)}function tv(e,t){if(e==="click")return Is(t)}function nv(e,t){if(e==="input"||e==="change")return Is(t)}function iv(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ft=typeof Object.is=="function"?Object.is:iv;function Ml(e,t){if(Ft(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var i=Object.keys(e),s=Object.keys(t);if(i.length!==s.length)return!1;for(s=0;s<i.length;s++){var u=i[s];if(!bt.call(t,u)||!Ft(e[u],t[u]))return!1}return!0}function Of(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Df(e,t){var i=Of(e);e=0;for(var s;i;){if(i.nodeType===3){if(s=e+i.textContent.length,e<=t&&s>=t)return{node:i,offset:t-e};e=s}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=Of(i)}}function zf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?zf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Hf(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Os(e.document);t instanceof e.HTMLIFrameElement;){try{var i=typeof t.contentWindow.location.href=="string"}catch{i=!1}if(i)e=t.contentWindow;else break;t=Os(e.document)}return t}function Xr(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 av=jn&&"documentMode"in document&&11>=document.documentMode,wa=null,Zr=null,Al=null,Wr=!1;function Bf(e,t,i){var s=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;Wr||wa==null||wa!==Os(s)||(s=wa,"selectionStart"in s&&Xr(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),Al&&Ml(Al,s)||(Al=s,s=Lo(Zr,"onSelect"),0<s.length&&(t=new Us("onSelect","select",null,t,i),e.push({event:t,listeners:s}),t.target=wa)))}function Bi(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var Sa={animationend:Bi("Animation","AnimationEnd"),animationiteration:Bi("Animation","AnimationIteration"),animationstart:Bi("Animation","AnimationStart"),transitionrun:Bi("Transition","TransitionRun"),transitionstart:Bi("Transition","TransitionStart"),transitioncancel:Bi("Transition","TransitionCancel"),transitionend:Bi("Transition","TransitionEnd")},Qr={},Uf={};jn&&(Uf=document.createElement("div").style,"AnimationEvent"in window||(delete Sa.animationend.animation,delete Sa.animationiteration.animation,delete Sa.animationstart.animation),"TransitionEvent"in window||delete Sa.transitionend.transition);function Ui(e){if(Qr[e])return Qr[e];if(!Sa[e])return e;var t=Sa[e],i;for(i in t)if(t.hasOwnProperty(i)&&i in Uf)return Qr[e]=t[i];return e}var Kf=Ui("animationend"),If=Ui("animationiteration"),Ff=Ui("animationstart"),lv=Ui("transitionrun"),sv=Ui("transitionstart"),ov=Ui("transitioncancel"),Gf=Ui("transitionend"),Yf=new Map,Jr="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(" ");Jr.push("scrollEnd");function fn(e,t){Yf.set(e,t),zi(t,[e])}var Fs=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)},Jt=[],Ca=0,ec=0;function Gs(){for(var e=Ca,t=ec=Ca=0;t<e;){var i=Jt[t];Jt[t++]=null;var s=Jt[t];Jt[t++]=null;var u=Jt[t];Jt[t++]=null;var d=Jt[t];if(Jt[t++]=null,s!==null&&u!==null){var b=s.pending;b===null?u.next=u:(u.next=b.next,b.next=u),s.pending=u}d!==0&&Pf(i,u,d)}}function Ys(e,t,i,s){Jt[Ca++]=e,Jt[Ca++]=t,Jt[Ca++]=i,Jt[Ca++]=s,ec|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function tc(e,t,i,s){return Ys(e,t,i,s),Ps(e)}function Ki(e,t){return Ys(e,null,null,t),Ps(e)}function Pf(e,t,i){e.lanes|=i;var s=e.alternate;s!==null&&(s.lanes|=i);for(var u=!1,d=e.return;d!==null;)d.childLanes|=i,s=d.alternate,s!==null&&(s.childLanes|=i),d.tag===22&&(e=d.stateNode,e===null||e._visibility&1||(u=!0)),e=d,d=d.return;return e.tag===3?(d=e.stateNode,u&&t!==null&&(u=31-kt(i),e=d.hiddenUpdates,s=e[u],s===null?e[u]=[t]:s.push(t),t.lane=i|536870912),d):null}function Ps(e){if(50<ql)throw ql=0,uu=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ta={};function rv(e,t,i,s){this.tag=e,this.key=i,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=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Gt(e,t,i,s){return new rv(e,t,i,s)}function nc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function On(e,t){var i=e.alternate;return i===null?(i=Gt(e.tag,t,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=t,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&65011712,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,t=e.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i.refCleanup=e.refCleanup,i}function Vf(e,t){e.flags&=65011714;var i=e.alternate;return i===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=i.childLanes,e.lanes=i.lanes,e.child=i.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=i.memoizedProps,e.memoizedState=i.memoizedState,e.updateQueue=i.updateQueue,e.type=i.type,t=i.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Vs(e,t,i,s,u,d){var b=0;if(s=e,typeof e=="function")nc(e)&&(b=1);else if(typeof e=="string")b=hx(e,i,Te.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case K:return e=Gt(31,i,t,u),e.elementType=K,e.lanes=d,e;case M:return Ii(i.children,u,d,t);case N:b=8,u|=24;break;case k:return e=Gt(12,i,t,u|2),e.elementType=k,e.lanes=d,e;case j:return e=Gt(13,i,t,u),e.elementType=j,e.lanes=d,e;case D:return e=Gt(19,i,t,u),e.elementType=D,e.lanes=d,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case R:b=10;break e;case E:b=9;break e;case H:b=11;break e;case _:b=14;break e;case z:b=16,s=null;break e}b=29,i=Error(o(130,e===null?"null":typeof e,"")),s=null}return t=Gt(b,i,t,u),t.elementType=e,t.type=s,t.lanes=d,t}function Ii(e,t,i,s){return e=Gt(7,e,s,t),e.lanes=i,e}function ic(e,t,i){return e=Gt(6,e,null,t),e.lanes=i,e}function $f(e){var t=Gt(18,null,null,0);return t.stateNode=e,t}function ac(e,t,i){return t=Gt(4,e.children!==null?e.children:[],e.key,t),t.lanes=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var qf=new WeakMap;function en(e,t){if(typeof e=="object"&&e!==null){var i=qf.get(e);return i!==void 0?i:(t={value:e,source:t,stack:it(t)},qf.set(e,t),t)}return{value:e,source:t,stack:it(t)}}var Ma=[],Aa=0,$s=null,El=0,tn=[],nn=0,li=null,wn=1,Sn="";function Dn(e,t){Ma[Aa++]=El,Ma[Aa++]=$s,$s=e,El=t}function Xf(e,t,i){tn[nn++]=wn,tn[nn++]=Sn,tn[nn++]=li,li=e;var s=wn;e=Sn;var u=32-kt(s)-1;s&=~(1<<u),i+=1;var d=32-kt(t)+u;if(30<d){var b=u-u%5;d=(s&(1<<b)-1).toString(32),s>>=b,u-=b,wn=1<<32-kt(t)+u|i<<u|s,Sn=d+e}else wn=1<<d|i<<u|s,Sn=e}function lc(e){e.return!==null&&(Dn(e,1),Xf(e,1,0))}function sc(e){for(;e===$s;)$s=Ma[--Aa],Ma[Aa]=null,El=Ma[--Aa],Ma[Aa]=null;for(;e===li;)li=tn[--nn],tn[nn]=null,Sn=tn[--nn],tn[nn]=null,wn=tn[--nn],tn[nn]=null}function Zf(e,t){tn[nn++]=wn,tn[nn++]=Sn,tn[nn++]=li,wn=t.id,Sn=t.overflow,li=e}var St=null,Ze=null,He=!1,si=null,an=!1,oc=Error(o(519));function oi(e){var t=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Nl(en(t,e)),oc}function Wf(e){var t=e.stateNode,i=e.type,s=e.memoizedProps;switch(t[wt]=e,t[jt]=s,i){case"dialog":Oe("cancel",t),Oe("close",t);break;case"iframe":case"object":case"embed":Oe("load",t);break;case"video":case"audio":for(i=0;i<Zl.length;i++)Oe(Zl[i],t);break;case"source":Oe("error",t);break;case"img":case"image":case"link":Oe("error",t),Oe("load",t);break;case"details":Oe("toggle",t);break;case"input":Oe("invalid",t),uf(t,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":Oe("invalid",t);break;case"textarea":Oe("invalid",t),ff(t,s.value,s.defaultValue,s.children)}i=s.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||t.textContent===""+i||s.suppressHydrationWarning===!0||mp(t.textContent,i)?(s.popover!=null&&(Oe("beforetoggle",t),Oe("toggle",t)),s.onScroll!=null&&Oe("scroll",t),s.onScrollEnd!=null&&Oe("scrollend",t),s.onClick!=null&&(t.onclick=Rn),t=!0):t=!1,t||oi(e,!0)}function Qf(e){for(St=e.return;St;)switch(St.tag){case 5:case 31:case 13:an=!1;return;case 27:case 3:an=!0;return;default:St=St.return}}function Ea(e){if(e!==St)return!1;if(!He)return Qf(e),He=!0,!1;var t=e.tag,i;if((i=t!==3&&t!==27)&&((i=t===5)&&(i=e.type,i=!(i!=="form"&&i!=="button")||Mu(e.type,e.memoizedProps)),i=!i),i&&Ze&&oi(e),Qf(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));Ze=Cp(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));Ze=Cp(e)}else t===27?(t=Ze,wi(e.type)?(e=Lu,Lu=null,Ze=e):Ze=t):Ze=St?sn(e.stateNode.nextSibling):null;return!0}function Fi(){Ze=St=null,He=!1}function rc(){var e=si;return e!==null&&(Bt===null?Bt=e:Bt.push.apply(Bt,e),si=null),e}function Nl(e){si===null?si=[e]:si.push(e)}var cc=ge(null),Gi=null,zn=null;function ri(e,t,i){ue(cc,t._currentValue),t._currentValue=i}function Hn(e){e._currentValue=cc.current,ye(cc)}function uc(e,t,i){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===i)break;e=e.return}}function dc(e,t,i,s){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var d=u.dependencies;if(d!==null){var b=u.child;d=d.firstContext;e:for(;d!==null;){var C=d;d=u;for(var L=0;L<t.length;L++)if(C.context===t[L]){d.lanes|=i,C=d.alternate,C!==null&&(C.lanes|=i),uc(d.return,i,e),s||(b=null);break e}d=C.next}}else if(u.tag===18){if(b=u.return,b===null)throw Error(o(341));b.lanes|=i,d=b.alternate,d!==null&&(d.lanes|=i),uc(b,i,e),b=null}else b=u.child;if(b!==null)b.return=u;else for(b=u;b!==null;){if(b===e){b=null;break}if(u=b.sibling,u!==null){u.return=b.return,b=u;break}b=b.return}u=b}}function Na(e,t,i,s){e=null;for(var u=t,d=!1;u!==null;){if(!d){if((u.flags&524288)!==0)d=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var b=u.alternate;if(b===null)throw Error(o(387));if(b=b.memoizedProps,b!==null){var C=u.type;Ft(u.pendingProps.value,b.value)||(e!==null?e.push(C):e=[C])}}else if(u===ae.current){if(b=u.alternate,b===null)throw Error(o(387));b.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(ts):e=[ts])}u=u.return}e!==null&&dc(t,e,i,s),t.flags|=262144}function qs(e){for(e=e.firstContext;e!==null;){if(!Ft(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Yi(e){Gi=e,zn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Ct(e){return Jf(Gi,e)}function Xs(e,t){return Gi===null&&Yi(e),Jf(e,t)}function Jf(e,t){var i=t._currentValue;if(t={context:t,memoizedValue:i,next:null},zn===null){if(e===null)throw Error(o(308));zn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else zn=zn.next=t;return i}var cv=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(i,s){e.push(s)}};this.abort=function(){t.aborted=!0,e.forEach(function(i){return i()})}},uv=a.unstable_scheduleCallback,dv=a.unstable_NormalPriority,dt={$$typeof:R,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function fc(){return{controller:new cv,data:new Map,refCount:0}}function kl(e){e.refCount--,e.refCount===0&&uv(dv,function(){e.controller.abort()})}var Ll=null,hc=0,ka=0,La=null;function fv(e,t){if(Ll===null){var i=Ll=[];hc=0,ka=gu(),La={status:"pending",value:void 0,then:function(s){i.push(s)}}}return hc++,t.then(eh,eh),t}function eh(){if(--hc===0&&Ll!==null){La!==null&&(La.status="fulfilled");var e=Ll;Ll=null,ka=0,La=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function hv(e,t){var i=[],s={status:"pending",value:null,reason:null,then:function(u){i.push(u)}};return e.then(function(){s.status="fulfilled",s.value=t;for(var u=0;u<i.length;u++)(0,i[u])(t)},function(u){for(s.status="rejected",s.reason=u,u=0;u<i.length;u++)(0,i[u])(void 0)}),s}var th=A.S;A.S=function(e,t){Bm=ut(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&fv(e,t),th!==null&&th(e,t)};var Pi=ge(null);function mc(){var e=Pi.current;return e!==null?e:$e.pooledCache}function Zs(e,t){t===null?ue(Pi,Pi.current):ue(Pi,t.pool)}function nh(){var e=mc();return e===null?null:{parent:dt._currentValue,pool:e}}var _a=Error(o(460)),pc=Error(o(474)),Ws=Error(o(542)),Qs={then:function(){}};function ih(e){return e=e.status,e==="fulfilled"||e==="rejected"}function ah(e,t,i){switch(i=e[i],i===void 0?e.push(t):i!==t&&(t.then(Rn,Rn),t=i),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,sh(e),e;default:if(typeof t.status=="string")t.then(Rn,Rn);else{if(e=$e,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status="pending",e.then(function(s){if(t.status==="pending"){var u=t;u.status="fulfilled",u.value=s}},function(s){if(t.status==="pending"){var u=t;u.status="rejected",u.reason=s}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,sh(e),e}throw $i=t,_a}}function Vi(e){try{var t=e._init;return t(e._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?($i=i,_a):i}}var $i=null;function lh(){if($i===null)throw Error(o(459));var e=$i;return $i=null,e}function sh(e){if(e===_a||e===Ws)throw Error(o(483))}var Ra=null,_l=0;function Js(e){var t=_l;return _l+=1,Ra===null&&(Ra=[]),ah(Ra,e,t)}function Rl(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function eo(e,t){throw t.$$typeof===x?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function oh(e){function t(U,O){if(e){var I=U.deletions;I===null?(U.deletions=[O],U.flags|=16):I.push(O)}}function i(U,O){if(!e)return null;for(;O!==null;)t(U,O),O=O.sibling;return null}function s(U){for(var O=new Map;U!==null;)U.key!==null?O.set(U.key,U):O.set(U.index,U),U=U.sibling;return O}function u(U,O){return U=On(U,O),U.index=0,U.sibling=null,U}function d(U,O,I){return U.index=I,e?(I=U.alternate,I!==null?(I=I.index,I<O?(U.flags|=67108866,O):I):(U.flags|=67108866,O)):(U.flags|=1048576,O)}function b(U){return e&&U.alternate===null&&(U.flags|=67108866),U}function C(U,O,I,J){return O===null||O.tag!==6?(O=ic(I,U.mode,J),O.return=U,O):(O=u(O,I),O.return=U,O)}function L(U,O,I,J){var Se=I.type;return Se===M?X(U,O,I.props.children,J,I.key):O!==null&&(O.elementType===Se||typeof Se=="object"&&Se!==null&&Se.$$typeof===z&&Vi(Se)===O.type)?(O=u(O,I.props),Rl(O,I),O.return=U,O):(O=Vs(I.type,I.key,I.props,null,U.mode,J),Rl(O,I),O.return=U,O)}function F(U,O,I,J){return O===null||O.tag!==4||O.stateNode.containerInfo!==I.containerInfo||O.stateNode.implementation!==I.implementation?(O=ac(I,U.mode,J),O.return=U,O):(O=u(O,I.children||[]),O.return=U,O)}function X(U,O,I,J,Se){return O===null||O.tag!==7?(O=Ii(I,U.mode,J,Se),O.return=U,O):(O=u(O,I),O.return=U,O)}function ee(U,O,I){if(typeof O=="string"&&O!==""||typeof O=="number"||typeof O=="bigint")return O=ic(""+O,U.mode,I),O.return=U,O;if(typeof O=="object"&&O!==null){switch(O.$$typeof){case w:return I=Vs(O.type,O.key,O.props,null,U.mode,I),Rl(I,O),I.return=U,I;case S:return O=ac(O,U.mode,I),O.return=U,O;case z:return O=Vi(O),ee(U,O,I)}if(P(O)||Z(O))return O=Ii(O,U.mode,I,null),O.return=U,O;if(typeof O.then=="function")return ee(U,Js(O),I);if(O.$$typeof===R)return ee(U,Xs(U,O),I);eo(U,O)}return null}function Y(U,O,I,J){var Se=O!==null?O.key:null;if(typeof I=="string"&&I!==""||typeof I=="number"||typeof I=="bigint")return Se!==null?null:C(U,O,""+I,J);if(typeof I=="object"&&I!==null){switch(I.$$typeof){case w:return I.key===Se?L(U,O,I,J):null;case S:return I.key===Se?F(U,O,I,J):null;case z:return I=Vi(I),Y(U,O,I,J)}if(P(I)||Z(I))return Se!==null?null:X(U,O,I,J,null);if(typeof I.then=="function")return Y(U,O,Js(I),J);if(I.$$typeof===R)return Y(U,O,Xs(U,I),J);eo(U,I)}return null}function V(U,O,I,J,Se){if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return U=U.get(I)||null,C(O,U,""+J,Se);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case w:return U=U.get(J.key===null?I:J.key)||null,L(O,U,J,Se);case S:return U=U.get(J.key===null?I:J.key)||null,F(O,U,J,Se);case z:return J=Vi(J),V(U,O,I,J,Se)}if(P(J)||Z(J))return U=U.get(I)||null,X(O,U,J,Se,null);if(typeof J.then=="function")return V(U,O,I,Js(J),Se);if(J.$$typeof===R)return V(U,O,I,Xs(O,J),Se);eo(O,J)}return null}function me(U,O,I,J){for(var Se=null,Be=null,pe=O,_e=O=0,ze=null;pe!==null&&_e<I.length;_e++){pe.index>_e?(ze=pe,pe=null):ze=pe.sibling;var Ue=Y(U,pe,I[_e],J);if(Ue===null){pe===null&&(pe=ze);break}e&&pe&&Ue.alternate===null&&t(U,pe),O=d(Ue,O,_e),Be===null?Se=Ue:Be.sibling=Ue,Be=Ue,pe=ze}if(_e===I.length)return i(U,pe),He&&Dn(U,_e),Se;if(pe===null){for(;_e<I.length;_e++)pe=ee(U,I[_e],J),pe!==null&&(O=d(pe,O,_e),Be===null?Se=pe:Be.sibling=pe,Be=pe);return He&&Dn(U,_e),Se}for(pe=s(pe);_e<I.length;_e++)ze=V(pe,U,_e,I[_e],J),ze!==null&&(e&&ze.alternate!==null&&pe.delete(ze.key===null?_e:ze.key),O=d(ze,O,_e),Be===null?Se=ze:Be.sibling=ze,Be=ze);return e&&pe.forEach(function(Ai){return t(U,Ai)}),He&&Dn(U,_e),Se}function Ce(U,O,I,J){if(I==null)throw Error(o(151));for(var Se=null,Be=null,pe=O,_e=O=0,ze=null,Ue=I.next();pe!==null&&!Ue.done;_e++,Ue=I.next()){pe.index>_e?(ze=pe,pe=null):ze=pe.sibling;var Ai=Y(U,pe,Ue.value,J);if(Ai===null){pe===null&&(pe=ze);break}e&&pe&&Ai.alternate===null&&t(U,pe),O=d(Ai,O,_e),Be===null?Se=Ai:Be.sibling=Ai,Be=Ai,pe=ze}if(Ue.done)return i(U,pe),He&&Dn(U,_e),Se;if(pe===null){for(;!Ue.done;_e++,Ue=I.next())Ue=ee(U,Ue.value,J),Ue!==null&&(O=d(Ue,O,_e),Be===null?Se=Ue:Be.sibling=Ue,Be=Ue);return He&&Dn(U,_e),Se}for(pe=s(pe);!Ue.done;_e++,Ue=I.next())Ue=V(pe,U,_e,Ue.value,J),Ue!==null&&(e&&Ue.alternate!==null&&pe.delete(Ue.key===null?_e:Ue.key),O=d(Ue,O,_e),Be===null?Se=Ue:Be.sibling=Ue,Be=Ue);return e&&pe.forEach(function(Tx){return t(U,Tx)}),He&&Dn(U,_e),Se}function Ve(U,O,I,J){if(typeof I=="object"&&I!==null&&I.type===M&&I.key===null&&(I=I.props.children),typeof I=="object"&&I!==null){switch(I.$$typeof){case w:e:{for(var Se=I.key;O!==null;){if(O.key===Se){if(Se=I.type,Se===M){if(O.tag===7){i(U,O.sibling),J=u(O,I.props.children),J.return=U,U=J;break e}}else if(O.elementType===Se||typeof Se=="object"&&Se!==null&&Se.$$typeof===z&&Vi(Se)===O.type){i(U,O.sibling),J=u(O,I.props),Rl(J,I),J.return=U,U=J;break e}i(U,O);break}else t(U,O);O=O.sibling}I.type===M?(J=Ii(I.props.children,U.mode,J,I.key),J.return=U,U=J):(J=Vs(I.type,I.key,I.props,null,U.mode,J),Rl(J,I),J.return=U,U=J)}return b(U);case S:e:{for(Se=I.key;O!==null;){if(O.key===Se)if(O.tag===4&&O.stateNode.containerInfo===I.containerInfo&&O.stateNode.implementation===I.implementation){i(U,O.sibling),J=u(O,I.children||[]),J.return=U,U=J;break e}else{i(U,O);break}else t(U,O);O=O.sibling}J=ac(I,U.mode,J),J.return=U,U=J}return b(U);case z:return I=Vi(I),Ve(U,O,I,J)}if(P(I))return me(U,O,I,J);if(Z(I)){if(Se=Z(I),typeof Se!="function")throw Error(o(150));return I=Se.call(I),Ce(U,O,I,J)}if(typeof I.then=="function")return Ve(U,O,Js(I),J);if(I.$$typeof===R)return Ve(U,O,Xs(U,I),J);eo(U,I)}return typeof I=="string"&&I!==""||typeof I=="number"||typeof I=="bigint"?(I=""+I,O!==null&&O.tag===6?(i(U,O.sibling),J=u(O,I),J.return=U,U=J):(i(U,O),J=ic(I,U.mode,J),J.return=U,U=J),b(U)):i(U,O)}return function(U,O,I,J){try{_l=0;var Se=Ve(U,O,I,J);return Ra=null,Se}catch(pe){if(pe===_a||pe===Ws)throw pe;var Be=Gt(29,pe,null,U.mode);return Be.lanes=J,Be.return=U,Be}finally{}}}var qi=oh(!0),rh=oh(!1),ci=!1;function gc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function bc(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 ui(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function di(e,t,i){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(Ke&2)!==0){var u=s.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),s.pending=t,t=Ps(e),Pf(e,null,i),t}return Ys(e,s,t,i),Ps(e)}function jl(e,t,i){if(t=t.updateQueue,t!==null&&(t=t.shared,(i&4194048)!==0)){var s=t.lanes;s&=e.pendingLanes,i|=s,t.lanes=i,Qd(e,i)}}function yc(e,t){var i=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,i===s)){var u=null,d=null;if(i=i.firstBaseUpdate,i!==null){do{var b={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};d===null?u=d=b:d=d.next=b,i=i.next}while(i!==null);d===null?u=d=t:d=d.next=t}else u=d=t;i={baseState:s.baseState,firstBaseUpdate:u,lastBaseUpdate:d,shared:s.shared,callbacks:s.callbacks},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=t:e.next=t,i.lastBaseUpdate=t}var vc=!1;function Ol(){if(vc){var e=La;if(e!==null)throw e}}function Dl(e,t,i,s){vc=!1;var u=e.updateQueue;ci=!1;var d=u.firstBaseUpdate,b=u.lastBaseUpdate,C=u.shared.pending;if(C!==null){u.shared.pending=null;var L=C,F=L.next;L.next=null,b===null?d=F:b.next=F,b=L;var X=e.alternate;X!==null&&(X=X.updateQueue,C=X.lastBaseUpdate,C!==b&&(C===null?X.firstBaseUpdate=F:C.next=F,X.lastBaseUpdate=L))}if(d!==null){var ee=u.baseState;b=0,X=F=L=null,C=d;do{var Y=C.lane&-536870913,V=Y!==C.lane;if(V?(De&Y)===Y:(s&Y)===Y){Y!==0&&Y===ka&&(vc=!0),X!==null&&(X=X.next={lane:0,tag:C.tag,payload:C.payload,callback:null,next:null});e:{var me=e,Ce=C;Y=t;var Ve=i;switch(Ce.tag){case 1:if(me=Ce.payload,typeof me=="function"){ee=me.call(Ve,ee,Y);break e}ee=me;break e;case 3:me.flags=me.flags&-65537|128;case 0:if(me=Ce.payload,Y=typeof me=="function"?me.call(Ve,ee,Y):me,Y==null)break e;ee=v({},ee,Y);break e;case 2:ci=!0}}Y=C.callback,Y!==null&&(e.flags|=64,V&&(e.flags|=8192),V=u.callbacks,V===null?u.callbacks=[Y]:V.push(Y))}else V={lane:Y,tag:C.tag,payload:C.payload,callback:C.callback,next:null},X===null?(F=X=V,L=ee):X=X.next=V,b|=Y;if(C=C.next,C===null){if(C=u.shared.pending,C===null)break;V=C,C=V.next,V.next=null,u.lastBaseUpdate=V,u.shared.pending=null}}while(!0);X===null&&(L=ee),u.baseState=L,u.firstBaseUpdate=F,u.lastBaseUpdate=X,d===null&&(u.shared.lanes=0),gi|=b,e.lanes=b,e.memoizedState=ee}}function ch(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function uh(e,t){var i=e.callbacks;if(i!==null)for(e.callbacks=null,e=0;e<i.length;e++)ch(i[e],t)}var ja=ge(null),to=ge(0);function dh(e,t){e=Vn,ue(to,e),ue(ja,t),Vn=e|t.baseLanes}function xc(){ue(to,Vn),ue(ja,ja.current)}function wc(){Vn=to.current,ye(ja),ye(to)}var Yt=ge(null),ln=null;function fi(e){var t=e.alternate;ue(ot,ot.current&1),ue(Yt,e),ln===null&&(t===null||ja.current!==null||t.memoizedState!==null)&&(ln=e)}function Sc(e){ue(ot,ot.current),ue(Yt,e),ln===null&&(ln=e)}function fh(e){e.tag===22?(ue(ot,ot.current),ue(Yt,e),ln===null&&(ln=e)):hi()}function hi(){ue(ot,ot.current),ue(Yt,Yt.current)}function Pt(e){ye(Yt),ln===e&&(ln=null),ye(ot)}var ot=ge(0);function no(e){for(var t=e;t!==null;){if(t.tag===13){var i=t.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||Nu(i)||ku(i)))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 Bn=0,Le=null,Ye=null,ft=null,io=!1,Oa=!1,Xi=!1,ao=0,zl=0,Da=null,mv=0;function at(){throw Error(o(321))}function Cc(e,t){if(t===null)return!1;for(var i=0;i<t.length&&i<e.length;i++)if(!Ft(e[i],t[i]))return!1;return!0}function Tc(e,t,i,s,u,d){return Bn=d,Le=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,A.H=e===null||e.memoizedState===null?Xh:Uc,Xi=!1,d=i(s,u),Xi=!1,Oa&&(d=mh(t,i,s,u)),hh(e),d}function hh(e){A.H=Ul;var t=Ye!==null&&Ye.next!==null;if(Bn=0,ft=Ye=Le=null,io=!1,zl=0,Da=null,t)throw Error(o(300));e===null||ht||(e=e.dependencies,e!==null&&qs(e)&&(ht=!0))}function mh(e,t,i,s){Le=e;var u=0;do{if(Oa&&(Da=null),zl=0,Oa=!1,25<=u)throw Error(o(301));if(u+=1,ft=Ye=null,e.updateQueue!=null){var d=e.updateQueue;d.lastEffect=null,d.events=null,d.stores=null,d.memoCache!=null&&(d.memoCache.index=0)}A.H=Zh,d=t(i,s)}while(Oa);return d}function pv(){var e=A.H,t=e.useState()[0];return t=typeof t.then=="function"?Hl(t):t,e=e.useState()[0],(Ye!==null?Ye.memoizedState:null)!==e&&(Le.flags|=1024),t}function Mc(){var e=ao!==0;return ao=0,e}function Ac(e,t,i){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i}function Ec(e){if(io){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}io=!1}Bn=0,ft=Ye=Le=null,Oa=!1,zl=ao=0,Da=null}function _t(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ft===null?Le.memoizedState=ft=e:ft=ft.next=e,ft}function rt(){if(Ye===null){var e=Le.alternate;e=e!==null?e.memoizedState:null}else e=Ye.next;var t=ft===null?Le.memoizedState:ft.next;if(t!==null)ft=t,Ye=e;else{if(e===null)throw Le.alternate===null?Error(o(467)):Error(o(310));Ye=e,e={memoizedState:Ye.memoizedState,baseState:Ye.baseState,baseQueue:Ye.baseQueue,queue:Ye.queue,next:null},ft===null?Le.memoizedState=ft=e:ft=ft.next=e}return ft}function lo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Hl(e){var t=zl;return zl+=1,Da===null&&(Da=[]),e=ah(Da,e,t),t=Le,(ft===null?t.memoizedState:ft.next)===null&&(t=t.alternate,A.H=t===null||t.memoizedState===null?Xh:Uc),e}function so(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Hl(e);if(e.$$typeof===R)return Ct(e)}throw Error(o(438,String(e)))}function Nc(e){var t=null,i=Le.updateQueue;if(i!==null&&(t=i.memoCache),t==null){var s=Le.alternate;s!==null&&(s=s.updateQueue,s!==null&&(s=s.memoCache,s!=null&&(t={data:s.data.map(function(u){return u.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),i===null&&(i=lo(),Le.updateQueue=i),i.memoCache=t,i=t.data[t.index],i===void 0)for(i=t.data[t.index]=Array(e),s=0;s<e;s++)i[s]=q;return t.index++,i}function Un(e,t){return typeof t=="function"?t(e):t}function oo(e){var t=rt();return kc(t,Ye,e)}function kc(e,t,i){var s=e.queue;if(s===null)throw Error(o(311));s.lastRenderedReducer=i;var u=e.baseQueue,d=s.pending;if(d!==null){if(u!==null){var b=u.next;u.next=d.next,d.next=b}t.baseQueue=u=d,s.pending=null}if(d=e.baseState,u===null)e.memoizedState=d;else{t=u.next;var C=b=null,L=null,F=t,X=!1;do{var ee=F.lane&-536870913;if(ee!==F.lane?(De&ee)===ee:(Bn&ee)===ee){var Y=F.revertLane;if(Y===0)L!==null&&(L=L.next={lane:0,revertLane:0,gesture:null,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null}),ee===ka&&(X=!0);else if((Bn&Y)===Y){F=F.next,Y===ka&&(X=!0);continue}else ee={lane:0,revertLane:F.revertLane,gesture:null,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null},L===null?(C=L=ee,b=d):L=L.next=ee,Le.lanes|=Y,gi|=Y;ee=F.action,Xi&&i(d,ee),d=F.hasEagerState?F.eagerState:i(d,ee)}else Y={lane:ee,revertLane:F.revertLane,gesture:F.gesture,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null},L===null?(C=L=Y,b=d):L=L.next=Y,Le.lanes|=ee,gi|=ee;F=F.next}while(F!==null&&F!==t);if(L===null?b=d:L.next=C,!Ft(d,e.memoizedState)&&(ht=!0,X&&(i=La,i!==null)))throw i;e.memoizedState=d,e.baseState=b,e.baseQueue=L,s.lastRenderedState=d}return u===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function Lc(e){var t=rt(),i=t.queue;if(i===null)throw Error(o(311));i.lastRenderedReducer=e;var s=i.dispatch,u=i.pending,d=t.memoizedState;if(u!==null){i.pending=null;var b=u=u.next;do d=e(d,b.action),b=b.next;while(b!==u);Ft(d,t.memoizedState)||(ht=!0),t.memoizedState=d,t.baseQueue===null&&(t.baseState=d),i.lastRenderedState=d}return[d,s]}function ph(e,t,i){var s=Le,u=rt(),d=He;if(d){if(i===void 0)throw Error(o(407));i=i()}else i=t();var b=!Ft((Ye||u).memoizedState,i);if(b&&(u.memoizedState=i,ht=!0),u=u.queue,jc(yh.bind(null,s,u,e),[e]),u.getSnapshot!==t||b||ft!==null&&ft.memoizedState.tag&1){if(s.flags|=2048,za(9,{destroy:void 0},bh.bind(null,s,u,i,t),null),$e===null)throw Error(o(349));d||(Bn&127)!==0||gh(s,t,i)}return i}function gh(e,t,i){e.flags|=16384,e={getSnapshot:t,value:i},t=Le.updateQueue,t===null?(t=lo(),Le.updateQueue=t,t.stores=[e]):(i=t.stores,i===null?t.stores=[e]:i.push(e))}function bh(e,t,i,s){t.value=i,t.getSnapshot=s,vh(t)&&xh(e)}function yh(e,t,i){return i(function(){vh(t)&&xh(e)})}function vh(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!Ft(e,i)}catch{return!0}}function xh(e){var t=Ki(e,2);t!==null&&Ut(t,e,2)}function _c(e){var t=_t();if(typeof e=="function"){var i=e;if(e=i(),Xi){xn(!0);try{i()}finally{xn(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Un,lastRenderedState:e},t}function wh(e,t,i,s){return e.baseState=i,kc(e,Ye,typeof s=="function"?s:Un)}function gv(e,t,i,s,u){if(uo(e))throw Error(o(485));if(e=t.action,e!==null){var d={payload:u,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(b){d.listeners.push(b)}};A.T!==null?i(!0):d.isTransition=!1,s(d),i=t.pending,i===null?(d.next=t.pending=d,Sh(t,d)):(d.next=i.next,t.pending=i.next=d)}}function Sh(e,t){var i=t.action,s=t.payload,u=e.state;if(t.isTransition){var d=A.T,b={};A.T=b;try{var C=i(u,s),L=A.S;L!==null&&L(b,C),Ch(e,t,C)}catch(F){Rc(e,t,F)}finally{d!==null&&b.types!==null&&(d.types=b.types),A.T=d}}else try{d=i(u,s),Ch(e,t,d)}catch(F){Rc(e,t,F)}}function Ch(e,t,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(s){Th(e,t,s)},function(s){return Rc(e,t,s)}):Th(e,t,i)}function Th(e,t,i){t.status="fulfilled",t.value=i,Mh(t),e.state=i,t=e.pending,t!==null&&(i=t.next,i===t?e.pending=null:(i=i.next,t.next=i,Sh(e,i)))}function Rc(e,t,i){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do t.status="rejected",t.reason=i,Mh(t),t=t.next;while(t!==s)}e.action=null}function Mh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Ah(e,t){return t}function Eh(e,t){if(He){var i=$e.formState;if(i!==null){e:{var s=Le;if(He){if(Ze){t:{for(var u=Ze,d=an;u.nodeType!==8;){if(!d){u=null;break t}if(u=sn(u.nextSibling),u===null){u=null;break t}}d=u.data,u=d==="F!"||d==="F"?u:null}if(u){Ze=sn(u.nextSibling),s=u.data==="F!";break e}}oi(s)}s=!1}s&&(t=i[0])}}return i=_t(),i.memoizedState=i.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ah,lastRenderedState:t},i.queue=s,i=Vh.bind(null,Le,s),s.dispatch=i,s=_c(!1),d=Bc.bind(null,Le,!1,s.queue),s=_t(),u={state:t,dispatch:null,action:e,pending:null},s.queue=u,i=gv.bind(null,Le,u,d,i),u.dispatch=i,s.memoizedState=e,[t,i,!1]}function Nh(e){var t=rt();return kh(t,Ye,e)}function kh(e,t,i){if(t=kc(e,t,Ah)[0],e=oo(Un)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=Hl(t)}catch(b){throw b===_a?Ws:b}else s=t;t=rt();var u=t.queue,d=u.dispatch;return i!==t.memoizedState&&(Le.flags|=2048,za(9,{destroy:void 0},bv.bind(null,u,i),null)),[s,d,e]}function bv(e,t){e.action=t}function Lh(e){var t=rt(),i=Ye;if(i!==null)return kh(t,i,e);rt(),t=t.memoizedState,i=rt();var s=i.queue.dispatch;return i.memoizedState=e,[t,s,!1]}function za(e,t,i,s){return e={tag:e,create:i,deps:s,inst:t,next:null},t=Le.updateQueue,t===null&&(t=lo(),Le.updateQueue=t),i=t.lastEffect,i===null?t.lastEffect=e.next=e:(s=i.next,i.next=e,e.next=s,t.lastEffect=e),e}function _h(){return rt().memoizedState}function ro(e,t,i,s){var u=_t();Le.flags|=e,u.memoizedState=za(1|t,{destroy:void 0},i,s===void 0?null:s)}function co(e,t,i,s){var u=rt();s=s===void 0?null:s;var d=u.memoizedState.inst;Ye!==null&&s!==null&&Cc(s,Ye.memoizedState.deps)?u.memoizedState=za(t,d,i,s):(Le.flags|=e,u.memoizedState=za(1|t,d,i,s))}function Rh(e,t){ro(8390656,8,e,t)}function jc(e,t){co(2048,8,e,t)}function yv(e){Le.flags|=4;var t=Le.updateQueue;if(t===null)t=lo(),Le.updateQueue=t,t.events=[e];else{var i=t.events;i===null?t.events=[e]:i.push(e)}}function jh(e){var t=rt().memoizedState;return yv({ref:t,nextImpl:e}),function(){if((Ke&2)!==0)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function Oh(e,t){return co(4,2,e,t)}function Dh(e,t){return co(4,4,e,t)}function zh(e,t){if(typeof t=="function"){e=e();var i=t(e);return function(){typeof i=="function"?i():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Hh(e,t,i){i=i!=null?i.concat([e]):null,co(4,4,zh.bind(null,t,e),i)}function Oc(){}function Bh(e,t){var i=rt();t=t===void 0?null:t;var s=i.memoizedState;return t!==null&&Cc(t,s[1])?s[0]:(i.memoizedState=[e,t],e)}function Uh(e,t){var i=rt();t=t===void 0?null:t;var s=i.memoizedState;if(t!==null&&Cc(t,s[1]))return s[0];if(s=e(),Xi){xn(!0);try{e()}finally{xn(!1)}}return i.memoizedState=[s,t],s}function Dc(e,t,i){return i===void 0||(Bn&1073741824)!==0&&(De&261930)===0?e.memoizedState=t:(e.memoizedState=i,e=Km(),Le.lanes|=e,gi|=e,i)}function Kh(e,t,i,s){return Ft(i,t)?i:ja.current!==null?(e=Dc(e,i,s),Ft(e,t)||(ht=!0),e):(Bn&42)===0||(Bn&1073741824)!==0&&(De&261930)===0?(ht=!0,e.memoizedState=i):(e=Km(),Le.lanes|=e,gi|=e,t)}function Ih(e,t,i,s,u){var d=G.p;G.p=d!==0&&8>d?d:8;var b=A.T,C={};A.T=C,Bc(e,!1,t,i);try{var L=u(),F=A.S;if(F!==null&&F(C,L),L!==null&&typeof L=="object"&&typeof L.then=="function"){var X=hv(L,s);Bl(e,t,X,qt(e))}else Bl(e,t,s,qt(e))}catch(ee){Bl(e,t,{then:function(){},status:"rejected",reason:ee},qt())}finally{G.p=d,b!==null&&C.types!==null&&(b.types=C.types),A.T=b}}function vv(){}function zc(e,t,i,s){if(e.tag!==5)throw Error(o(476));var u=Fh(e).queue;Ih(e,u,t,W,i===null?vv:function(){return Gh(e),i(s)})}function Fh(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:W,baseState:W,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Un,lastRenderedState:W},next:null};var i={};return t.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Un,lastRenderedState:i},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Gh(e){var t=Fh(e);t.next===null&&(t=e.alternate.memoizedState),Bl(e,t.next.queue,{},qt())}function Hc(){return Ct(ts)}function Yh(){return rt().memoizedState}function Ph(){return rt().memoizedState}function xv(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var i=qt();e=ui(i);var s=di(t,e,i);s!==null&&(Ut(s,t,i),jl(s,t,i)),t={cache:fc()},e.payload=t;return}t=t.return}}function wv(e,t,i){var s=qt();i={lane:s,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},uo(e)?$h(t,i):(i=tc(e,t,i,s),i!==null&&(Ut(i,e,s),qh(i,t,s)))}function Vh(e,t,i){var s=qt();Bl(e,t,i,s)}function Bl(e,t,i,s){var u={lane:s,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(uo(e))$h(t,u);else{var d=e.alternate;if(e.lanes===0&&(d===null||d.lanes===0)&&(d=t.lastRenderedReducer,d!==null))try{var b=t.lastRenderedState,C=d(b,i);if(u.hasEagerState=!0,u.eagerState=C,Ft(C,b))return Ys(e,t,u,0),$e===null&&Gs(),!1}catch{}finally{}if(i=tc(e,t,u,s),i!==null)return Ut(i,e,s),qh(i,t,s),!0}return!1}function Bc(e,t,i,s){if(s={lane:2,revertLane:gu(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},uo(e)){if(t)throw Error(o(479))}else t=tc(e,i,s,2),t!==null&&Ut(t,e,2)}function uo(e){var t=e.alternate;return e===Le||t!==null&&t===Le}function $h(e,t){Oa=io=!0;var i=e.pending;i===null?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function qh(e,t,i){if((i&4194048)!==0){var s=t.lanes;s&=e.pendingLanes,i|=s,t.lanes=i,Qd(e,i)}}var Ul={readContext:Ct,use:so,useCallback:at,useContext:at,useEffect:at,useImperativeHandle:at,useLayoutEffect:at,useInsertionEffect:at,useMemo:at,useReducer:at,useRef:at,useState:at,useDebugValue:at,useDeferredValue:at,useTransition:at,useSyncExternalStore:at,useId:at,useHostTransitionStatus:at,useFormState:at,useActionState:at,useOptimistic:at,useMemoCache:at,useCacheRefresh:at};Ul.useEffectEvent=at;var Xh={readContext:Ct,use:so,useCallback:function(e,t){return _t().memoizedState=[e,t===void 0?null:t],e},useContext:Ct,useEffect:Rh,useImperativeHandle:function(e,t,i){i=i!=null?i.concat([e]):null,ro(4194308,4,zh.bind(null,t,e),i)},useLayoutEffect:function(e,t){return ro(4194308,4,e,t)},useInsertionEffect:function(e,t){ro(4,2,e,t)},useMemo:function(e,t){var i=_t();t=t===void 0?null:t;var s=e();if(Xi){xn(!0);try{e()}finally{xn(!1)}}return i.memoizedState=[s,t],s},useReducer:function(e,t,i){var s=_t();if(i!==void 0){var u=i(t);if(Xi){xn(!0);try{i(t)}finally{xn(!1)}}}else u=t;return s.memoizedState=s.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},s.queue=e,e=e.dispatch=wv.bind(null,Le,e),[s.memoizedState,e]},useRef:function(e){var t=_t();return e={current:e},t.memoizedState=e},useState:function(e){e=_c(e);var t=e.queue,i=Vh.bind(null,Le,t);return t.dispatch=i,[e.memoizedState,i]},useDebugValue:Oc,useDeferredValue:function(e,t){var i=_t();return Dc(i,e,t)},useTransition:function(){var e=_c(!1);return e=Ih.bind(null,Le,e.queue,!0,!1),_t().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,i){var s=Le,u=_t();if(He){if(i===void 0)throw Error(o(407));i=i()}else{if(i=t(),$e===null)throw Error(o(349));(De&127)!==0||gh(s,t,i)}u.memoizedState=i;var d={value:i,getSnapshot:t};return u.queue=d,Rh(yh.bind(null,s,d,e),[e]),s.flags|=2048,za(9,{destroy:void 0},bh.bind(null,s,d,i,t),null),i},useId:function(){var e=_t(),t=$e.identifierPrefix;if(He){var i=Sn,s=wn;i=(s&~(1<<32-kt(s)-1)).toString(32)+i,t="_"+t+"R_"+i,i=ao++,0<i&&(t+="H"+i.toString(32)),t+="_"}else i=mv++,t="_"+t+"r_"+i.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Hc,useFormState:Eh,useActionState:Eh,useOptimistic:function(e){var t=_t();t.memoizedState=t.baseState=e;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=i,t=Bc.bind(null,Le,!0,i),i.dispatch=t,[e,t]},useMemoCache:Nc,useCacheRefresh:function(){return _t().memoizedState=xv.bind(null,Le)},useEffectEvent:function(e){var t=_t(),i={impl:e};return t.memoizedState=i,function(){if((Ke&2)!==0)throw Error(o(440));return i.impl.apply(void 0,arguments)}}},Uc={readContext:Ct,use:so,useCallback:Bh,useContext:Ct,useEffect:jc,useImperativeHandle:Hh,useInsertionEffect:Oh,useLayoutEffect:Dh,useMemo:Uh,useReducer:oo,useRef:_h,useState:function(){return oo(Un)},useDebugValue:Oc,useDeferredValue:function(e,t){var i=rt();return Kh(i,Ye.memoizedState,e,t)},useTransition:function(){var e=oo(Un)[0],t=rt().memoizedState;return[typeof e=="boolean"?e:Hl(e),t]},useSyncExternalStore:ph,useId:Yh,useHostTransitionStatus:Hc,useFormState:Nh,useActionState:Nh,useOptimistic:function(e,t){var i=rt();return wh(i,Ye,e,t)},useMemoCache:Nc,useCacheRefresh:Ph};Uc.useEffectEvent=jh;var Zh={readContext:Ct,use:so,useCallback:Bh,useContext:Ct,useEffect:jc,useImperativeHandle:Hh,useInsertionEffect:Oh,useLayoutEffect:Dh,useMemo:Uh,useReducer:Lc,useRef:_h,useState:function(){return Lc(Un)},useDebugValue:Oc,useDeferredValue:function(e,t){var i=rt();return Ye===null?Dc(i,e,t):Kh(i,Ye.memoizedState,e,t)},useTransition:function(){var e=Lc(Un)[0],t=rt().memoizedState;return[typeof e=="boolean"?e:Hl(e),t]},useSyncExternalStore:ph,useId:Yh,useHostTransitionStatus:Hc,useFormState:Lh,useActionState:Lh,useOptimistic:function(e,t){var i=rt();return Ye!==null?wh(i,Ye,e,t):(i.baseState=e,[e,i.queue.dispatch])},useMemoCache:Nc,useCacheRefresh:Ph};Zh.useEffectEvent=jh;function Kc(e,t,i,s){t=e.memoizedState,i=i(s,t),i=i==null?t:v({},t,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var Ic={enqueueSetState:function(e,t,i){e=e._reactInternals;var s=qt(),u=ui(s);u.payload=t,i!=null&&(u.callback=i),t=di(e,u,s),t!==null&&(Ut(t,e,s),jl(t,e,s))},enqueueReplaceState:function(e,t,i){e=e._reactInternals;var s=qt(),u=ui(s);u.tag=1,u.payload=t,i!=null&&(u.callback=i),t=di(e,u,s),t!==null&&(Ut(t,e,s),jl(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var i=qt(),s=ui(i);s.tag=2,t!=null&&(s.callback=t),t=di(e,s,i),t!==null&&(Ut(t,e,i),jl(t,e,i))}};function Wh(e,t,i,s,u,d,b){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,d,b):t.prototype&&t.prototype.isPureReactComponent?!Ml(i,s)||!Ml(u,d):!0}function Qh(e,t,i,s){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(i,s),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(i,s),t.state!==e&&Ic.enqueueReplaceState(t,t.state,null)}function Zi(e,t){var i=t;if("ref"in t){i={};for(var s in t)s!=="ref"&&(i[s]=t[s])}if(e=e.defaultProps){i===t&&(i=v({},i));for(var u in e)i[u]===void 0&&(i[u]=e[u])}return i}function Jh(e){Fs(e)}function em(e){console.error(e)}function tm(e){Fs(e)}function fo(e,t){try{var i=e.onUncaughtError;i(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function nm(e,t,i){try{var s=e.onCaughtError;s(i.value,{componentStack:i.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function Fc(e,t,i){return i=ui(i),i.tag=3,i.payload={element:null},i.callback=function(){fo(e,t)},i}function im(e){return e=ui(e),e.tag=3,e}function am(e,t,i,s){var u=i.type.getDerivedStateFromError;if(typeof u=="function"){var d=s.value;e.payload=function(){return u(d)},e.callback=function(){nm(t,i,s)}}var b=i.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(e.callback=function(){nm(t,i,s),typeof u!="function"&&(bi===null?bi=new Set([this]):bi.add(this));var C=s.stack;this.componentDidCatch(s.value,{componentStack:C!==null?C:""})})}function Sv(e,t,i,s,u){if(i.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=i.alternate,t!==null&&Na(t,i,u,!0),i=Yt.current,i!==null){switch(i.tag){case 31:case 13:return ln===null?To():i.alternate===null&&lt===0&&(lt=3),i.flags&=-257,i.flags|=65536,i.lanes=u,s===Qs?i.flags|=16384:(t=i.updateQueue,t===null?i.updateQueue=new Set([s]):t.add(s),hu(e,s,u)),!1;case 22:return i.flags|=65536,s===Qs?i.flags|=16384:(t=i.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([s])},i.updateQueue=t):(i=t.retryQueue,i===null?t.retryQueue=new Set([s]):i.add(s)),hu(e,s,u)),!1}throw Error(o(435,i.tag))}return hu(e,s,u),To(),!1}if(He)return t=Yt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=u,s!==oc&&(e=Error(o(422),{cause:s}),Nl(en(e,i)))):(s!==oc&&(t=Error(o(423),{cause:s}),Nl(en(t,i))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,s=en(s,i),u=Fc(e.stateNode,s,u),yc(e,u),lt!==4&&(lt=2)),!1;var d=Error(o(520),{cause:s});if(d=en(d,i),$l===null?$l=[d]:$l.push(d),lt!==4&&(lt=2),t===null)return!0;s=en(s,i),i=t;do{switch(i.tag){case 3:return i.flags|=65536,e=u&-u,i.lanes|=e,e=Fc(i.stateNode,s,e),yc(i,e),!1;case 1:if(t=i.type,d=i.stateNode,(i.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||d!==null&&typeof d.componentDidCatch=="function"&&(bi===null||!bi.has(d))))return i.flags|=65536,u&=-u,i.lanes|=u,u=im(u),am(u,e,i,s),yc(i,u),!1}i=i.return}while(i!==null);return!1}var Gc=Error(o(461)),ht=!1;function Tt(e,t,i,s){t.child=e===null?rh(t,null,i,s):qi(t,e.child,i,s)}function lm(e,t,i,s,u){i=i.render;var d=t.ref;if("ref"in s){var b={};for(var C in s)C!=="ref"&&(b[C]=s[C])}else b=s;return Yi(t),s=Tc(e,t,i,b,d,u),C=Mc(),e!==null&&!ht?(Ac(e,t,u),Kn(e,t,u)):(He&&C&&lc(t),t.flags|=1,Tt(e,t,s,u),t.child)}function sm(e,t,i,s,u){if(e===null){var d=i.type;return typeof d=="function"&&!nc(d)&&d.defaultProps===void 0&&i.compare===null?(t.tag=15,t.type=d,om(e,t,d,s,u)):(e=Vs(i.type,null,s,t,t.mode,u),e.ref=t.ref,e.return=t,t.child=e)}if(d=e.child,!Wc(e,u)){var b=d.memoizedProps;if(i=i.compare,i=i!==null?i:Ml,i(b,s)&&e.ref===t.ref)return Kn(e,t,u)}return t.flags|=1,e=On(d,s),e.ref=t.ref,e.return=t,t.child=e}function om(e,t,i,s,u){if(e!==null){var d=e.memoizedProps;if(Ml(d,s)&&e.ref===t.ref)if(ht=!1,t.pendingProps=s=d,Wc(e,u))(e.flags&131072)!==0&&(ht=!0);else return t.lanes=e.lanes,Kn(e,t,u)}return Yc(e,t,i,s,u)}function rm(e,t,i,s){var u=s.children,d=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.mode==="hidden"){if((t.flags&128)!==0){if(d=d!==null?d.baseLanes|i:i,e!==null){for(s=t.child=e.child,u=0;s!==null;)u=u|s.lanes|s.childLanes,s=s.sibling;s=u&~d}else s=0,t.child=null;return cm(e,t,d,i,s)}if((i&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Zs(t,d!==null?d.cachePool:null),d!==null?dh(t,d):xc(),fh(t);else return s=t.lanes=536870912,cm(e,t,d!==null?d.baseLanes|i:i,i,s)}else d!==null?(Zs(t,d.cachePool),dh(t,d),hi(),t.memoizedState=null):(e!==null&&Zs(t,null),xc(),hi());return Tt(e,t,u,i),t.child}function Kl(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function cm(e,t,i,s,u){var d=mc();return d=d===null?null:{parent:dt._currentValue,pool:d},t.memoizedState={baseLanes:i,cachePool:d},e!==null&&Zs(t,null),xc(),fh(t),e!==null&&Na(e,t,s,!0),t.childLanes=u,null}function ho(e,t){return t=po({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function um(e,t,i){return qi(t,e.child,null,i),e=ho(t,t.pendingProps),e.flags|=2,Pt(t),t.memoizedState=null,e}function Cv(e,t,i){var s=t.pendingProps,u=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(He){if(s.mode==="hidden")return e=ho(t,s),t.lanes=536870912,Kl(null,e);if(Sc(t),(e=Ze)?(e=Sp(e,an),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:li!==null?{id:wn,overflow:Sn}:null,retryLane:536870912,hydrationErrors:null},i=$f(e),i.return=t,t.child=i,St=t,Ze=null)):e=null,e===null)throw oi(t);return t.lanes=536870912,null}return ho(t,s)}var d=e.memoizedState;if(d!==null){var b=d.dehydrated;if(Sc(t),u)if(t.flags&256)t.flags&=-257,t=um(e,t,i);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558));else if(ht||Na(e,t,i,!1),u=(i&e.childLanes)!==0,ht||u){if(s=$e,s!==null&&(b=Jd(s,i),b!==0&&b!==d.retryLane))throw d.retryLane=b,Ki(e,b),Ut(s,e,b),Gc;To(),t=um(e,t,i)}else e=d.treeContext,Ze=sn(b.nextSibling),St=t,He=!0,si=null,an=!1,e!==null&&Zf(t,e),t=ho(t,s),t.flags|=4096;return t}return e=On(e.child,{mode:s.mode,children:s.children}),e.ref=t.ref,t.child=e,e.return=t,e}function mo(e,t){var i=t.ref;if(i===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(o(284));(e===null||e.ref!==i)&&(t.flags|=4194816)}}function Yc(e,t,i,s,u){return Yi(t),i=Tc(e,t,i,s,void 0,u),s=Mc(),e!==null&&!ht?(Ac(e,t,u),Kn(e,t,u)):(He&&s&&lc(t),t.flags|=1,Tt(e,t,i,u),t.child)}function dm(e,t,i,s,u,d){return Yi(t),t.updateQueue=null,i=mh(t,s,i,u),hh(e),s=Mc(),e!==null&&!ht?(Ac(e,t,d),Kn(e,t,d)):(He&&s&&lc(t),t.flags|=1,Tt(e,t,i,d),t.child)}function fm(e,t,i,s,u){if(Yi(t),t.stateNode===null){var d=Ta,b=i.contextType;typeof b=="object"&&b!==null&&(d=Ct(b)),d=new i(s,d),t.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,d.updater=Ic,t.stateNode=d,d._reactInternals=t,d=t.stateNode,d.props=s,d.state=t.memoizedState,d.refs={},gc(t),b=i.contextType,d.context=typeof b=="object"&&b!==null?Ct(b):Ta,d.state=t.memoizedState,b=i.getDerivedStateFromProps,typeof b=="function"&&(Kc(t,i,b,s),d.state=t.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof d.getSnapshotBeforeUpdate=="function"||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(b=d.state,typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount(),b!==d.state&&Ic.enqueueReplaceState(d,d.state,null),Dl(t,s,d,u),Ol(),d.state=t.memoizedState),typeof d.componentDidMount=="function"&&(t.flags|=4194308),s=!0}else if(e===null){d=t.stateNode;var C=t.memoizedProps,L=Zi(i,C);d.props=L;var F=d.context,X=i.contextType;b=Ta,typeof X=="object"&&X!==null&&(b=Ct(X));var ee=i.getDerivedStateFromProps;X=typeof ee=="function"||typeof d.getSnapshotBeforeUpdate=="function",C=t.pendingProps!==C,X||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(C||F!==b)&&Qh(t,d,s,b),ci=!1;var Y=t.memoizedState;d.state=Y,Dl(t,s,d,u),Ol(),F=t.memoizedState,C||Y!==F||ci?(typeof ee=="function"&&(Kc(t,i,ee,s),F=t.memoizedState),(L=ci||Wh(t,i,L,s,Y,F,b))?(X||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount()),typeof d.componentDidMount=="function"&&(t.flags|=4194308)):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=F),d.props=s,d.state=F,d.context=b,s=L):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{d=t.stateNode,bc(e,t),b=t.memoizedProps,X=Zi(i,b),d.props=X,ee=t.pendingProps,Y=d.context,F=i.contextType,L=Ta,typeof F=="object"&&F!==null&&(L=Ct(F)),C=i.getDerivedStateFromProps,(F=typeof C=="function"||typeof d.getSnapshotBeforeUpdate=="function")||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(b!==ee||Y!==L)&&Qh(t,d,s,L),ci=!1,Y=t.memoizedState,d.state=Y,Dl(t,s,d,u),Ol();var V=t.memoizedState;b!==ee||Y!==V||ci||e!==null&&e.dependencies!==null&&qs(e.dependencies)?(typeof C=="function"&&(Kc(t,i,C,s),V=t.memoizedState),(X=ci||Wh(t,i,X,s,Y,V,L)||e!==null&&e.dependencies!==null&&qs(e.dependencies))?(F||typeof d.UNSAFE_componentWillUpdate!="function"&&typeof d.componentWillUpdate!="function"||(typeof d.componentWillUpdate=="function"&&d.componentWillUpdate(s,V,L),typeof d.UNSAFE_componentWillUpdate=="function"&&d.UNSAFE_componentWillUpdate(s,V,L)),typeof d.componentDidUpdate=="function"&&(t.flags|=4),typeof d.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof d.componentDidUpdate!="function"||b===e.memoizedProps&&Y===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&Y===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=V),d.props=s,d.state=V,d.context=L,s=X):(typeof d.componentDidUpdate!="function"||b===e.memoizedProps&&Y===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&Y===e.memoizedState||(t.flags|=1024),s=!1)}return d=s,mo(e,t),s=(t.flags&128)!==0,d||s?(d=t.stateNode,i=s&&typeof i.getDerivedStateFromError!="function"?null:d.render(),t.flags|=1,e!==null&&s?(t.child=qi(t,e.child,null,u),t.child=qi(t,null,i,u)):Tt(e,t,i,u),t.memoizedState=d.state,e=t.child):e=Kn(e,t,u),e}function hm(e,t,i,s){return Fi(),t.flags|=256,Tt(e,t,i,s),t.child}var Pc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Vc(e){return{baseLanes:e,cachePool:nh()}}function $c(e,t,i){return e=e!==null?e.childLanes&~i:0,t&&(e|=$t),e}function mm(e,t,i){var s=t.pendingProps,u=!1,d=(t.flags&128)!==0,b;if((b=d)||(b=e!==null&&e.memoizedState===null?!1:(ot.current&2)!==0),b&&(u=!0,t.flags&=-129),b=(t.flags&32)!==0,t.flags&=-33,e===null){if(He){if(u?fi(t):hi(),(e=Ze)?(e=Sp(e,an),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:li!==null?{id:wn,overflow:Sn}:null,retryLane:536870912,hydrationErrors:null},i=$f(e),i.return=t,t.child=i,St=t,Ze=null)):e=null,e===null)throw oi(t);return ku(e)?t.lanes=32:t.lanes=536870912,null}var C=s.children;return s=s.fallback,u?(hi(),u=t.mode,C=po({mode:"hidden",children:C},u),s=Ii(s,u,i,null),C.return=t,s.return=t,C.sibling=s,t.child=C,s=t.child,s.memoizedState=Vc(i),s.childLanes=$c(e,b,i),t.memoizedState=Pc,Kl(null,s)):(fi(t),qc(t,C))}var L=e.memoizedState;if(L!==null&&(C=L.dehydrated,C!==null)){if(d)t.flags&256?(fi(t),t.flags&=-257,t=Xc(e,t,i)):t.memoizedState!==null?(hi(),t.child=e.child,t.flags|=128,t=null):(hi(),C=s.fallback,u=t.mode,s=po({mode:"visible",children:s.children},u),C=Ii(C,u,i,null),C.flags|=2,s.return=t,C.return=t,s.sibling=C,t.child=s,qi(t,e.child,null,i),s=t.child,s.memoizedState=Vc(i),s.childLanes=$c(e,b,i),t.memoizedState=Pc,t=Kl(null,s));else if(fi(t),ku(C)){if(b=C.nextSibling&&C.nextSibling.dataset,b)var F=b.dgst;b=F,s=Error(o(419)),s.stack="",s.digest=b,Nl({value:s,source:null,stack:null}),t=Xc(e,t,i)}else if(ht||Na(e,t,i,!1),b=(i&e.childLanes)!==0,ht||b){if(b=$e,b!==null&&(s=Jd(b,i),s!==0&&s!==L.retryLane))throw L.retryLane=s,Ki(e,s),Ut(b,e,s),Gc;Nu(C)||To(),t=Xc(e,t,i)}else Nu(C)?(t.flags|=192,t.child=e.child,t=null):(e=L.treeContext,Ze=sn(C.nextSibling),St=t,He=!0,si=null,an=!1,e!==null&&Zf(t,e),t=qc(t,s.children),t.flags|=4096);return t}return u?(hi(),C=s.fallback,u=t.mode,L=e.child,F=L.sibling,s=On(L,{mode:"hidden",children:s.children}),s.subtreeFlags=L.subtreeFlags&65011712,F!==null?C=On(F,C):(C=Ii(C,u,i,null),C.flags|=2),C.return=t,s.return=t,s.sibling=C,t.child=s,Kl(null,s),s=t.child,C=e.child.memoizedState,C===null?C=Vc(i):(u=C.cachePool,u!==null?(L=dt._currentValue,u=u.parent!==L?{parent:L,pool:L}:u):u=nh(),C={baseLanes:C.baseLanes|i,cachePool:u}),s.memoizedState=C,s.childLanes=$c(e,b,i),t.memoizedState=Pc,Kl(e.child,s)):(fi(t),i=e.child,e=i.sibling,i=On(i,{mode:"visible",children:s.children}),i.return=t,i.sibling=null,e!==null&&(b=t.deletions,b===null?(t.deletions=[e],t.flags|=16):b.push(e)),t.child=i,t.memoizedState=null,i)}function qc(e,t){return t=po({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function po(e,t){return e=Gt(22,e,null,t),e.lanes=0,e}function Xc(e,t,i){return qi(t,e.child,null,i),e=qc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function pm(e,t,i){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),uc(e.return,t,i)}function Zc(e,t,i,s,u,d){var b=e.memoizedState;b===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:i,tailMode:u,treeForkCount:d}:(b.isBackwards=t,b.rendering=null,b.renderingStartTime=0,b.last=s,b.tail=i,b.tailMode=u,b.treeForkCount=d)}function gm(e,t,i){var s=t.pendingProps,u=s.revealOrder,d=s.tail;s=s.children;var b=ot.current,C=(b&2)!==0;if(C?(b=b&1|2,t.flags|=128):b&=1,ue(ot,b),Tt(e,t,s,i),s=He?El:0,!C&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&pm(e,i,t);else if(e.tag===19)pm(e,i,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(u){case"forwards":for(i=t.child,u=null;i!==null;)e=i.alternate,e!==null&&no(e)===null&&(u=i),i=i.sibling;i=u,i===null?(u=t.child,t.child=null):(u=i.sibling,i.sibling=null),Zc(t,!1,u,i,d,s);break;case"backwards":case"unstable_legacy-backwards":for(i=null,u=t.child,t.child=null;u!==null;){if(e=u.alternate,e!==null&&no(e)===null){t.child=u;break}e=u.sibling,u.sibling=i,i=u,u=e}Zc(t,!0,i,null,d,s);break;case"together":Zc(t,!1,null,null,void 0,s);break;default:t.memoizedState=null}return t.child}function Kn(e,t,i){if(e!==null&&(t.dependencies=e.dependencies),gi|=t.lanes,(i&t.childLanes)===0)if(e!==null){if(Na(e,t,i,!1),(i&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,i=On(e,e.pendingProps),t.child=i,i.return=t;e.sibling!==null;)e=e.sibling,i=i.sibling=On(e,e.pendingProps),i.return=t;i.sibling=null}return t.child}function Wc(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&qs(e)))}function Tv(e,t,i){switch(t.tag){case 3:we(t,t.stateNode.containerInfo),ri(t,dt,e.memoizedState.cache),Fi();break;case 27:case 5:ve(t);break;case 4:we(t,t.stateNode.containerInfo);break;case 10:ri(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Sc(t),null;break;case 13:var s=t.memoizedState;if(s!==null)return s.dehydrated!==null?(fi(t),t.flags|=128,null):(i&t.child.childLanes)!==0?mm(e,t,i):(fi(t),e=Kn(e,t,i),e!==null?e.sibling:null);fi(t);break;case 19:var u=(e.flags&128)!==0;if(s=(i&t.childLanes)!==0,s||(Na(e,t,i,!1),s=(i&t.childLanes)!==0),u){if(s)return gm(e,t,i);t.flags|=128}if(u=t.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),ue(ot,ot.current),s)break;return null;case 22:return t.lanes=0,rm(e,t,i,t.pendingProps);case 24:ri(t,dt,e.memoizedState.cache)}return Kn(e,t,i)}function bm(e,t,i){if(e!==null)if(e.memoizedProps!==t.pendingProps)ht=!0;else{if(!Wc(e,i)&&(t.flags&128)===0)return ht=!1,Tv(e,t,i);ht=(e.flags&131072)!==0}else ht=!1,He&&(t.flags&1048576)!==0&&Xf(t,El,t.index);switch(t.lanes=0,t.tag){case 16:e:{var s=t.pendingProps;if(e=Vi(t.elementType),t.type=e,typeof e=="function")nc(e)?(s=Zi(e,s),t.tag=1,t=fm(null,t,e,s,i)):(t.tag=0,t=Yc(null,t,e,s,i));else{if(e!=null){var u=e.$$typeof;if(u===H){t.tag=11,t=lm(null,t,e,s,i);break e}else if(u===_){t.tag=14,t=sm(null,t,e,s,i);break e}}throw t=re(e)||e,Error(o(306,t,""))}}return t;case 0:return Yc(e,t,t.type,t.pendingProps,i);case 1:return s=t.type,u=Zi(s,t.pendingProps),fm(e,t,s,u,i);case 3:e:{if(we(t,t.stateNode.containerInfo),e===null)throw Error(o(387));s=t.pendingProps;var d=t.memoizedState;u=d.element,bc(e,t),Dl(t,s,null,i);var b=t.memoizedState;if(s=b.cache,ri(t,dt,s),s!==d.cache&&dc(t,[dt],i,!0),Ol(),s=b.element,d.isDehydrated)if(d={element:s,isDehydrated:!1,cache:b.cache},t.updateQueue.baseState=d,t.memoizedState=d,t.flags&256){t=hm(e,t,s,i);break e}else if(s!==u){u=en(Error(o(424)),t),Nl(u),t=hm(e,t,s,i);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(Ze=sn(e.firstChild),St=t,He=!0,si=null,an=!0,i=rh(t,null,s,i),t.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(Fi(),s===u){t=Kn(e,t,i);break e}Tt(e,t,s,i)}t=t.child}return t;case 26:return mo(e,t),e===null?(i=Np(t.type,null,t.pendingProps,null))?t.memoizedState=i:He||(i=t.type,e=t.pendingProps,s=_o(be.current).createElement(i),s[wt]=t,s[jt]=e,Mt(s,i,e),yt(s),t.stateNode=s):t.memoizedState=Np(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ve(t),e===null&&He&&(s=t.stateNode=Mp(t.type,t.pendingProps,be.current),St=t,an=!0,u=Ze,wi(t.type)?(Lu=u,Ze=sn(s.firstChild)):Ze=u),Tt(e,t,t.pendingProps.children,i),mo(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&He&&((u=s=Ze)&&(s=ex(s,t.type,t.pendingProps,an),s!==null?(t.stateNode=s,St=t,Ze=sn(s.firstChild),an=!1,u=!0):u=!1),u||oi(t)),ve(t),u=t.type,d=t.pendingProps,b=e!==null?e.memoizedProps:null,s=d.children,Mu(u,d)?s=null:b!==null&&Mu(u,b)&&(t.flags|=32),t.memoizedState!==null&&(u=Tc(e,t,pv,null,null,i),ts._currentValue=u),mo(e,t),Tt(e,t,s,i),t.child;case 6:return e===null&&He&&((e=i=Ze)&&(i=tx(i,t.pendingProps,an),i!==null?(t.stateNode=i,St=t,Ze=null,e=!0):e=!1),e||oi(t)),null;case 13:return mm(e,t,i);case 4:return we(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=qi(t,null,s,i):Tt(e,t,s,i),t.child;case 11:return lm(e,t,t.type,t.pendingProps,i);case 7:return Tt(e,t,t.pendingProps,i),t.child;case 8:return Tt(e,t,t.pendingProps.children,i),t.child;case 12:return Tt(e,t,t.pendingProps.children,i),t.child;case 10:return s=t.pendingProps,ri(t,t.type,s.value),Tt(e,t,s.children,i),t.child;case 9:return u=t.type._context,s=t.pendingProps.children,Yi(t),u=Ct(u),s=s(u),t.flags|=1,Tt(e,t,s,i),t.child;case 14:return sm(e,t,t.type,t.pendingProps,i);case 15:return om(e,t,t.type,t.pendingProps,i);case 19:return gm(e,t,i);case 31:return Cv(e,t,i);case 22:return rm(e,t,i,t.pendingProps);case 24:return Yi(t),s=Ct(dt),e===null?(u=mc(),u===null&&(u=$e,d=fc(),u.pooledCache=d,d.refCount++,d!==null&&(u.pooledCacheLanes|=i),u=d),t.memoizedState={parent:s,cache:u},gc(t),ri(t,dt,u)):((e.lanes&i)!==0&&(bc(e,t),Dl(t,null,null,i),Ol()),u=e.memoizedState,d=t.memoizedState,u.parent!==s?(u={parent:s,cache:s},t.memoizedState=u,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=u),ri(t,dt,s)):(s=d.cache,ri(t,dt,s),s!==u.cache&&dc(t,[dt],i,!0))),Tt(e,t,t.pendingProps.children,i),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function In(e){e.flags|=4}function Qc(e,t,i,s,u){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(u&335544128)===u)if(e.stateNode.complete)e.flags|=8192;else if(Ym())e.flags|=8192;else throw $i=Qs,pc}else e.flags&=-16777217}function ym(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!jp(t))if(Ym())e.flags|=8192;else throw $i=Qs,pc}function go(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?ml():536870912,e.lanes|=t,Ka|=t)}function Il(e,t){if(!He)switch(e.tailMode){case"hidden":t=e.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var s=null;i!==null;)i.alternate!==null&&(s=i),i=i.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function We(e){var t=e.alternate!==null&&e.alternate.child===e.child,i=0,s=0;if(t)for(var u=e.child;u!==null;)i|=u.lanes|u.childLanes,s|=u.subtreeFlags&65011712,s|=u.flags&65011712,u.return=e,u=u.sibling;else for(u=e.child;u!==null;)i|=u.lanes|u.childLanes,s|=u.subtreeFlags,s|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=s,e.childLanes=i,t}function Mv(e,t,i){var s=t.pendingProps;switch(sc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return We(t),null;case 1:return We(t),null;case 3:return i=t.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),Hn(dt),le(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(Ea(t)?In(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,rc())),We(t),null;case 26:var u=t.type,d=t.memoizedState;return e===null?(In(t),d!==null?(We(t),ym(t,d)):(We(t),Qc(t,u,null,s,i))):d?d!==e.memoizedState?(In(t),We(t),ym(t,d)):(We(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&In(t),We(t),Qc(t,u,e,s,i)),null;case 27:if(Ne(t),i=be.current,u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&In(t);else{if(!s){if(t.stateNode===null)throw Error(o(166));return We(t),null}e=Te.current,Ea(t)?Wf(t):(e=Mp(u,s,i),t.stateNode=e,In(t))}return We(t),null;case 5:if(Ne(t),u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&In(t);else{if(!s){if(t.stateNode===null)throw Error(o(166));return We(t),null}if(d=Te.current,Ea(t))Wf(t);else{var b=_o(be.current);switch(d){case 1:d=b.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:d=b.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":d=b.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":d=b.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":d=b.createElement("div"),d.innerHTML="<script><\/script>",d=d.removeChild(d.firstChild);break;case"select":d=typeof s.is=="string"?b.createElement("select",{is:s.is}):b.createElement("select"),s.multiple?d.multiple=!0:s.size&&(d.size=s.size);break;default:d=typeof s.is=="string"?b.createElement(u,{is:s.is}):b.createElement(u)}}d[wt]=t,d[jt]=s;e:for(b=t.child;b!==null;){if(b.tag===5||b.tag===6)d.appendChild(b.stateNode);else if(b.tag!==4&&b.tag!==27&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===t)break e;for(;b.sibling===null;){if(b.return===null||b.return===t)break e;b=b.return}b.sibling.return=b.return,b=b.sibling}t.stateNode=d;e:switch(Mt(d,u,s),u){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&In(t)}}return We(t),Qc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,i),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&In(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(o(166));if(e=be.current,Ea(t)){if(e=t.stateNode,i=t.memoizedProps,s=null,u=St,u!==null)switch(u.tag){case 27:case 5:s=u.memoizedProps}e[wt]=t,e=!!(e.nodeValue===i||s!==null&&s.suppressHydrationWarning===!0||mp(e.nodeValue,i)),e||oi(t,!0)}else e=_o(e).createTextNode(s),e[wt]=t,t.stateNode=e}return We(t),null;case 31:if(i=t.memoizedState,e===null||e.memoizedState!==null){if(s=Ea(t),i!==null){if(e===null){if(!s)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[wt]=t}else Fi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;We(t),e=!1}else i=rc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),e=!0;if(!e)return t.flags&256?(Pt(t),t):(Pt(t),null);if((t.flags&128)!==0)throw Error(o(558))}return We(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=Ea(t),s!==null&&s.dehydrated!==null){if(e===null){if(!u)throw Error(o(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(o(317));u[wt]=t}else Fi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;We(t),u=!1}else u=rc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(Pt(t),t):(Pt(t),null)}return Pt(t),(t.flags&128)!==0?(t.lanes=i,t):(i=s!==null,e=e!==null&&e.memoizedState!==null,i&&(s=t.child,u=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(u=s.alternate.memoizedState.cachePool.pool),d=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(d=s.memoizedState.cachePool.pool),d!==u&&(s.flags|=2048)),i!==e&&i&&(t.child.flags|=8192),go(t,t.updateQueue),We(t),null);case 4:return le(),e===null&&xu(t.stateNode.containerInfo),We(t),null;case 10:return Hn(t.type),We(t),null;case 19:if(ye(ot),s=t.memoizedState,s===null)return We(t),null;if(u=(t.flags&128)!==0,d=s.rendering,d===null)if(u)Il(s,!1);else{if(lt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(d=no(e),d!==null){for(t.flags|=128,Il(s,!1),e=d.updateQueue,t.updateQueue=e,go(t,e),t.subtreeFlags=0,e=i,i=t.child;i!==null;)Vf(i,e),i=i.sibling;return ue(ot,ot.current&1|2),He&&Dn(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&ut()>wo&&(t.flags|=128,u=!0,Il(s,!1),t.lanes=4194304)}else{if(!u)if(e=no(d),e!==null){if(t.flags|=128,u=!0,e=e.updateQueue,t.updateQueue=e,go(t,e),Il(s,!0),s.tail===null&&s.tailMode==="hidden"&&!d.alternate&&!He)return We(t),null}else 2*ut()-s.renderingStartTime>wo&&i!==536870912&&(t.flags|=128,u=!0,Il(s,!1),t.lanes=4194304);s.isBackwards?(d.sibling=t.child,t.child=d):(e=s.last,e!==null?e.sibling=d:t.child=d,s.last=d)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=ut(),e.sibling=null,i=ot.current,ue(ot,u?i&1|2:i&1),He&&Dn(t,s.treeForkCount),e):(We(t),null);case 22:case 23:return Pt(t),wc(),s=t.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(t.flags|=8192):s&&(t.flags|=8192),s?(i&536870912)!==0&&(t.flags&128)===0&&(We(t),t.subtreeFlags&6&&(t.flags|=8192)):We(t),i=t.updateQueue,i!==null&&go(t,i.retryQueue),i=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),s=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),s!==i&&(t.flags|=2048),e!==null&&ye(Pi),null;case 24:return i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),Hn(dt),We(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function Av(e,t){switch(sc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Hn(dt),le(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Ne(t),null;case 31:if(t.memoizedState!==null){if(Pt(t),t.alternate===null)throw Error(o(340));Fi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Pt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));Fi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ye(ot),null;case 4:return le(),null;case 10:return Hn(t.type),null;case 22:case 23:return Pt(t),wc(),e!==null&&ye(Pi),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Hn(dt),null;case 25:return null;default:return null}}function vm(e,t){switch(sc(t),t.tag){case 3:Hn(dt),le();break;case 26:case 27:case 5:Ne(t);break;case 4:le();break;case 31:t.memoizedState!==null&&Pt(t);break;case 13:Pt(t);break;case 19:ye(ot);break;case 10:Hn(t.type);break;case 22:case 23:Pt(t),wc(),e!==null&&ye(Pi);break;case 24:Hn(dt)}}function Fl(e,t){try{var i=t.updateQueue,s=i!==null?i.lastEffect:null;if(s!==null){var u=s.next;i=u;do{if((i.tag&e)===e){s=void 0;var d=i.create,b=i.inst;s=d(),b.destroy=s}i=i.next}while(i!==u)}}catch(C){Ge(t,t.return,C)}}function mi(e,t,i){try{var s=t.updateQueue,u=s!==null?s.lastEffect:null;if(u!==null){var d=u.next;s=d;do{if((s.tag&e)===e){var b=s.inst,C=b.destroy;if(C!==void 0){b.destroy=void 0,u=t;var L=i,F=C;try{F()}catch(X){Ge(u,L,X)}}}s=s.next}while(s!==d)}}catch(X){Ge(t,t.return,X)}}function xm(e){var t=e.updateQueue;if(t!==null){var i=e.stateNode;try{uh(t,i)}catch(s){Ge(e,e.return,s)}}}function wm(e,t,i){i.props=Zi(e.type,e.memoizedProps),i.state=e.memoizedState;try{i.componentWillUnmount()}catch(s){Ge(e,t,s)}}function Gl(e,t){try{var i=e.ref;if(i!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof i=="function"?e.refCleanup=i(s):i.current=s}}catch(u){Ge(e,t,u)}}function Cn(e,t){var i=e.ref,s=e.refCleanup;if(i!==null)if(typeof s=="function")try{s()}catch(u){Ge(e,t,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(u){Ge(e,t,u)}else i.current=null}function Sm(e){var t=e.type,i=e.memoizedProps,s=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":i.autoFocus&&s.focus();break e;case"img":i.src?s.src=i.src:i.srcSet&&(s.srcset=i.srcSet)}}catch(u){Ge(e,e.return,u)}}function Jc(e,t,i){try{var s=e.stateNode;qv(s,e.type,i,t),s[jt]=t}catch(u){Ge(e,e.return,u)}}function Cm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&wi(e.type)||e.tag===4}function eu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Cm(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&&wi(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 tu(e,t,i){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(e,t):(t=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,t.appendChild(e),i=i._reactRootContainer,i!=null||t.onclick!==null||(t.onclick=Rn));else if(s!==4&&(s===27&&wi(e.type)&&(i=e.stateNode,t=null),e=e.child,e!==null))for(tu(e,t,i),e=e.sibling;e!==null;)tu(e,t,i),e=e.sibling}function bo(e,t,i){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?i.insertBefore(e,t):i.appendChild(e);else if(s!==4&&(s===27&&wi(e.type)&&(i=e.stateNode),e=e.child,e!==null))for(bo(e,t,i),e=e.sibling;e!==null;)bo(e,t,i),e=e.sibling}function Tm(e){var t=e.stateNode,i=e.memoizedProps;try{for(var s=e.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);Mt(t,s,i),t[wt]=e,t[jt]=i}catch(d){Ge(e,e.return,d)}}var Fn=!1,mt=!1,nu=!1,Mm=typeof WeakSet=="function"?WeakSet:Set,vt=null;function Ev(e,t){if(e=e.containerInfo,Cu=Bo,e=Hf(e),Xr(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var s=i.getSelection&&i.getSelection();if(s&&s.rangeCount!==0){i=s.anchorNode;var u=s.anchorOffset,d=s.focusNode;s=s.focusOffset;try{i.nodeType,d.nodeType}catch{i=null;break e}var b=0,C=-1,L=-1,F=0,X=0,ee=e,Y=null;t:for(;;){for(var V;ee!==i||u!==0&&ee.nodeType!==3||(C=b+u),ee!==d||s!==0&&ee.nodeType!==3||(L=b+s),ee.nodeType===3&&(b+=ee.nodeValue.length),(V=ee.firstChild)!==null;)Y=ee,ee=V;for(;;){if(ee===e)break t;if(Y===i&&++F===u&&(C=b),Y===d&&++X===s&&(L=b),(V=ee.nextSibling)!==null)break;ee=Y,Y=ee.parentNode}ee=V}i=C===-1||L===-1?null:{start:C,end:L}}else i=null}i=i||{start:0,end:0}}else i=null;for(Tu={focusedElem:e,selectionRange:i},Bo=!1,vt=t;vt!==null;)if(t=vt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,vt=e;else for(;vt!==null;){switch(t=vt,d=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(i=0;i<e.length;i++)u=e[i],u.ref.impl=u.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&d!==null){e=void 0,i=t,u=d.memoizedProps,d=d.memoizedState,s=i.stateNode;try{var me=Zi(i.type,u);e=s.getSnapshotBeforeUpdate(me,d),s.__reactInternalSnapshotBeforeUpdate=e}catch(Ce){Ge(i,i.return,Ce)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,i=e.nodeType,i===9)Eu(e);else if(i===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Eu(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(o(163))}if(e=t.sibling,e!==null){e.return=t.return,vt=e;break}vt=t.return}}function Am(e,t,i){var s=i.flags;switch(i.tag){case 0:case 11:case 15:Yn(e,i),s&4&&Fl(5,i);break;case 1:if(Yn(e,i),s&4)if(e=i.stateNode,t===null)try{e.componentDidMount()}catch(b){Ge(i,i.return,b)}else{var u=Zi(i.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(u,t,e.__reactInternalSnapshotBeforeUpdate)}catch(b){Ge(i,i.return,b)}}s&64&&xm(i),s&512&&Gl(i,i.return);break;case 3:if(Yn(e,i),s&64&&(e=i.updateQueue,e!==null)){if(t=null,i.child!==null)switch(i.child.tag){case 27:case 5:t=i.child.stateNode;break;case 1:t=i.child.stateNode}try{uh(e,t)}catch(b){Ge(i,i.return,b)}}break;case 27:t===null&&s&4&&Tm(i);case 26:case 5:Yn(e,i),t===null&&s&4&&Sm(i),s&512&&Gl(i,i.return);break;case 12:Yn(e,i);break;case 31:Yn(e,i),s&4&&km(e,i);break;case 13:Yn(e,i),s&4&&Lm(e,i),s&64&&(e=i.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(i=zv.bind(null,i),nx(e,i))));break;case 22:if(s=i.memoizedState!==null||Fn,!s){t=t!==null&&t.memoizedState!==null||mt,u=Fn;var d=mt;Fn=s,(mt=t)&&!d?Pn(e,i,(i.subtreeFlags&8772)!==0):Yn(e,i),Fn=u,mt=d}break;case 30:break;default:Yn(e,i)}}function Em(e){var t=e.alternate;t!==null&&(e.alternate=null,Em(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Rr(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 nt=null,Dt=!1;function Gn(e,t,i){for(i=i.child;i!==null;)Nm(e,t,i),i=i.sibling}function Nm(e,t,i){if(At&&typeof At.onCommitFiberUnmount=="function")try{At.onCommitFiberUnmount(ti,i)}catch{}switch(i.tag){case 26:mt||Cn(i,t),Gn(e,t,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:mt||Cn(i,t);var s=nt,u=Dt;wi(i.type)&&(nt=i.stateNode,Dt=!1),Gn(e,t,i),Ql(i.stateNode),nt=s,Dt=u;break;case 5:mt||Cn(i,t);case 6:if(s=nt,u=Dt,nt=null,Gn(e,t,i),nt=s,Dt=u,nt!==null)if(Dt)try{(nt.nodeType===9?nt.body:nt.nodeName==="HTML"?nt.ownerDocument.body:nt).removeChild(i.stateNode)}catch(d){Ge(i,t,d)}else try{nt.removeChild(i.stateNode)}catch(d){Ge(i,t,d)}break;case 18:nt!==null&&(Dt?(e=nt,xp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,i.stateNode),qa(e)):xp(nt,i.stateNode));break;case 4:s=nt,u=Dt,nt=i.stateNode.containerInfo,Dt=!0,Gn(e,t,i),nt=s,Dt=u;break;case 0:case 11:case 14:case 15:mi(2,i,t),mt||mi(4,i,t),Gn(e,t,i);break;case 1:mt||(Cn(i,t),s=i.stateNode,typeof s.componentWillUnmount=="function"&&wm(i,t,s)),Gn(e,t,i);break;case 21:Gn(e,t,i);break;case 22:mt=(s=mt)||i.memoizedState!==null,Gn(e,t,i),mt=s;break;default:Gn(e,t,i)}}function km(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{qa(e)}catch(i){Ge(t,t.return,i)}}}function Lm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{qa(e)}catch(i){Ge(t,t.return,i)}}function Nv(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Mm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Mm),t;default:throw Error(o(435,e.tag))}}function yo(e,t){var i=Nv(e);t.forEach(function(s){if(!i.has(s)){i.add(s);var u=Hv.bind(null,e,s);s.then(u,u)}})}function zt(e,t){var i=t.deletions;if(i!==null)for(var s=0;s<i.length;s++){var u=i[s],d=e,b=t,C=b;e:for(;C!==null;){switch(C.tag){case 27:if(wi(C.type)){nt=C.stateNode,Dt=!1;break e}break;case 5:nt=C.stateNode,Dt=!1;break e;case 3:case 4:nt=C.stateNode.containerInfo,Dt=!0;break e}C=C.return}if(nt===null)throw Error(o(160));Nm(d,b,u),nt=null,Dt=!1,d=u.alternate,d!==null&&(d.return=null),u.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)_m(t,e),t=t.sibling}var hn=null;function _m(e,t){var i=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:zt(t,e),Ht(e),s&4&&(mi(3,e,e.return),Fl(3,e),mi(5,e,e.return));break;case 1:zt(t,e),Ht(e),s&512&&(mt||i===null||Cn(i,i.return)),s&64&&Fn&&(e=e.updateQueue,e!==null&&(s=e.callbacks,s!==null&&(i=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=i===null?s:i.concat(s))));break;case 26:var u=hn;if(zt(t,e),Ht(e),s&512&&(mt||i===null||Cn(i,i.return)),s&4){var d=i!==null?i.memoizedState:null;if(s=e.memoizedState,i===null)if(s===null)if(e.stateNode===null){e:{s=e.type,i=e.memoizedProps,u=u.ownerDocument||u;t:switch(s){case"title":d=u.getElementsByTagName("title")[0],(!d||d[gl]||d[wt]||d.namespaceURI==="http://www.w3.org/2000/svg"||d.hasAttribute("itemprop"))&&(d=u.createElement(s),u.head.insertBefore(d,u.querySelector("head > title"))),Mt(d,s,i),d[wt]=e,yt(d),s=d;break e;case"link":var b=_p("link","href",u).get(s+(i.href||""));if(b){for(var C=0;C<b.length;C++)if(d=b[C],d.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&d.getAttribute("rel")===(i.rel==null?null:i.rel)&&d.getAttribute("title")===(i.title==null?null:i.title)&&d.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){b.splice(C,1);break t}}d=u.createElement(s),Mt(d,s,i),u.head.appendChild(d);break;case"meta":if(b=_p("meta","content",u).get(s+(i.content||""))){for(C=0;C<b.length;C++)if(d=b[C],d.getAttribute("content")===(i.content==null?null:""+i.content)&&d.getAttribute("name")===(i.name==null?null:i.name)&&d.getAttribute("property")===(i.property==null?null:i.property)&&d.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&d.getAttribute("charset")===(i.charSet==null?null:i.charSet)){b.splice(C,1);break t}}d=u.createElement(s),Mt(d,s,i),u.head.appendChild(d);break;default:throw Error(o(468,s))}d[wt]=e,yt(d),s=d}e.stateNode=s}else Rp(u,e.type,e.stateNode);else e.stateNode=Lp(u,s,e.memoizedProps);else d!==s?(d===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):d.count--,s===null?Rp(u,e.type,e.stateNode):Lp(u,s,e.memoizedProps)):s===null&&e.stateNode!==null&&Jc(e,e.memoizedProps,i.memoizedProps)}break;case 27:zt(t,e),Ht(e),s&512&&(mt||i===null||Cn(i,i.return)),i!==null&&s&4&&Jc(e,e.memoizedProps,i.memoizedProps);break;case 5:if(zt(t,e),Ht(e),s&512&&(mt||i===null||Cn(i,i.return)),e.flags&32){u=e.stateNode;try{ba(u,"")}catch(me){Ge(e,e.return,me)}}s&4&&e.stateNode!=null&&(u=e.memoizedProps,Jc(e,u,i!==null?i.memoizedProps:u)),s&1024&&(nu=!0);break;case 6:if(zt(t,e),Ht(e),s&4){if(e.stateNode===null)throw Error(o(162));s=e.memoizedProps,i=e.stateNode;try{i.nodeValue=s}catch(me){Ge(e,e.return,me)}}break;case 3:if(Oo=null,u=hn,hn=Ro(t.containerInfo),zt(t,e),hn=u,Ht(e),s&4&&i!==null&&i.memoizedState.isDehydrated)try{qa(t.containerInfo)}catch(me){Ge(e,e.return,me)}nu&&(nu=!1,Rm(e));break;case 4:s=hn,hn=Ro(e.stateNode.containerInfo),zt(t,e),Ht(e),hn=s;break;case 12:zt(t,e),Ht(e);break;case 31:zt(t,e),Ht(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,yo(e,s)));break;case 13:zt(t,e),Ht(e),e.child.flags&8192&&e.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(xo=ut()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,yo(e,s)));break;case 22:u=e.memoizedState!==null;var L=i!==null&&i.memoizedState!==null,F=Fn,X=mt;if(Fn=F||u,mt=X||L,zt(t,e),mt=X,Fn=F,Ht(e),s&8192)e:for(t=e.stateNode,t._visibility=u?t._visibility&-2:t._visibility|1,u&&(i===null||L||Fn||mt||Wi(e)),i=null,t=e;;){if(t.tag===5||t.tag===26){if(i===null){L=i=t;try{if(d=L.stateNode,u)b=d.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none";else{C=L.stateNode;var ee=L.memoizedProps.style,Y=ee!=null&&ee.hasOwnProperty("display")?ee.display:null;C.style.display=Y==null||typeof Y=="boolean"?"":(""+Y).trim()}}catch(me){Ge(L,L.return,me)}}}else if(t.tag===6){if(i===null){L=t;try{L.stateNode.nodeValue=u?"":L.memoizedProps}catch(me){Ge(L,L.return,me)}}}else if(t.tag===18){if(i===null){L=t;try{var V=L.stateNode;u?wp(V,!0):wp(L.stateNode,!1)}catch(me){Ge(L,L.return,me)}}}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;i===t&&(i=null),t=t.return}i===t&&(i=null),t.sibling.return=t.return,t=t.sibling}s&4&&(s=e.updateQueue,s!==null&&(i=s.retryQueue,i!==null&&(s.retryQueue=null,yo(e,i))));break;case 19:zt(t,e),Ht(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,yo(e,s)));break;case 30:break;case 21:break;default:zt(t,e),Ht(e)}}function Ht(e){var t=e.flags;if(t&2){try{for(var i,s=e.return;s!==null;){if(Cm(s)){i=s;break}s=s.return}if(i==null)throw Error(o(160));switch(i.tag){case 27:var u=i.stateNode,d=eu(e);bo(e,d,u);break;case 5:var b=i.stateNode;i.flags&32&&(ba(b,""),i.flags&=-33);var C=eu(e);bo(e,C,b);break;case 3:case 4:var L=i.stateNode.containerInfo,F=eu(e);tu(e,F,L);break;default:throw Error(o(161))}}catch(X){Ge(e,e.return,X)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Rm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Rm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Yn(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Am(e,t.alternate,t),t=t.sibling}function Wi(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:mi(4,t,t.return),Wi(t);break;case 1:Cn(t,t.return);var i=t.stateNode;typeof i.componentWillUnmount=="function"&&wm(t,t.return,i),Wi(t);break;case 27:Ql(t.stateNode);case 26:case 5:Cn(t,t.return),Wi(t);break;case 22:t.memoizedState===null&&Wi(t);break;case 30:Wi(t);break;default:Wi(t)}e=e.sibling}}function Pn(e,t,i){for(i=i&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var s=t.alternate,u=e,d=t,b=d.flags;switch(d.tag){case 0:case 11:case 15:Pn(u,d,i),Fl(4,d);break;case 1:if(Pn(u,d,i),s=d,u=s.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(F){Ge(s,s.return,F)}if(s=d,u=s.updateQueue,u!==null){var C=s.stateNode;try{var L=u.shared.hiddenCallbacks;if(L!==null)for(u.shared.hiddenCallbacks=null,u=0;u<L.length;u++)ch(L[u],C)}catch(F){Ge(s,s.return,F)}}i&&b&64&&xm(d),Gl(d,d.return);break;case 27:Tm(d);case 26:case 5:Pn(u,d,i),i&&s===null&&b&4&&Sm(d),Gl(d,d.return);break;case 12:Pn(u,d,i);break;case 31:Pn(u,d,i),i&&b&4&&km(u,d);break;case 13:Pn(u,d,i),i&&b&4&&Lm(u,d);break;case 22:d.memoizedState===null&&Pn(u,d,i),Gl(d,d.return);break;case 30:break;default:Pn(u,d,i)}t=t.sibling}}function iu(e,t){var i=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==i&&(e!=null&&e.refCount++,i!=null&&kl(i))}function au(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&kl(e))}function mn(e,t,i,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)jm(e,t,i,s),t=t.sibling}function jm(e,t,i,s){var u=t.flags;switch(t.tag){case 0:case 11:case 15:mn(e,t,i,s),u&2048&&Fl(9,t);break;case 1:mn(e,t,i,s);break;case 3:mn(e,t,i,s),u&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&kl(e)));break;case 12:if(u&2048){mn(e,t,i,s),e=t.stateNode;try{var d=t.memoizedProps,b=d.id,C=d.onPostCommit;typeof C=="function"&&C(b,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(L){Ge(t,t.return,L)}}else mn(e,t,i,s);break;case 31:mn(e,t,i,s);break;case 13:mn(e,t,i,s);break;case 23:break;case 22:d=t.stateNode,b=t.alternate,t.memoizedState!==null?d._visibility&2?mn(e,t,i,s):Yl(e,t):d._visibility&2?mn(e,t,i,s):(d._visibility|=2,Ha(e,t,i,s,(t.subtreeFlags&10256)!==0||!1)),u&2048&&iu(b,t);break;case 24:mn(e,t,i,s),u&2048&&au(t.alternate,t);break;default:mn(e,t,i,s)}}function Ha(e,t,i,s,u){for(u=u&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var d=e,b=t,C=i,L=s,F=b.flags;switch(b.tag){case 0:case 11:case 15:Ha(d,b,C,L,u),Fl(8,b);break;case 23:break;case 22:var X=b.stateNode;b.memoizedState!==null?X._visibility&2?Ha(d,b,C,L,u):Yl(d,b):(X._visibility|=2,Ha(d,b,C,L,u)),u&&F&2048&&iu(b.alternate,b);break;case 24:Ha(d,b,C,L,u),u&&F&2048&&au(b.alternate,b);break;default:Ha(d,b,C,L,u)}t=t.sibling}}function Yl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var i=e,s=t,u=s.flags;switch(s.tag){case 22:Yl(i,s),u&2048&&iu(s.alternate,s);break;case 24:Yl(i,s),u&2048&&au(s.alternate,s);break;default:Yl(i,s)}t=t.sibling}}var Pl=8192;function Ba(e,t,i){if(e.subtreeFlags&Pl)for(e=e.child;e!==null;)Om(e,t,i),e=e.sibling}function Om(e,t,i){switch(e.tag){case 26:Ba(e,t,i),e.flags&Pl&&e.memoizedState!==null&&mx(i,hn,e.memoizedState,e.memoizedProps);break;case 5:Ba(e,t,i);break;case 3:case 4:var s=hn;hn=Ro(e.stateNode.containerInfo),Ba(e,t,i),hn=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=Pl,Pl=16777216,Ba(e,t,i),Pl=s):Ba(e,t,i));break;default:Ba(e,t,i)}}function Dm(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 Vl(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var i=0;i<t.length;i++){var s=t[i];vt=s,Hm(s,e)}Dm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)zm(e),e=e.sibling}function zm(e){switch(e.tag){case 0:case 11:case 15:Vl(e),e.flags&2048&&mi(9,e,e.return);break;case 3:Vl(e);break;case 12:Vl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,vo(e)):Vl(e);break;default:Vl(e)}}function vo(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var i=0;i<t.length;i++){var s=t[i];vt=s,Hm(s,e)}Dm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:mi(8,t,t.return),vo(t);break;case 22:i=t.stateNode,i._visibility&2&&(i._visibility&=-3,vo(t));break;default:vo(t)}e=e.sibling}}function Hm(e,t){for(;vt!==null;){var i=vt;switch(i.tag){case 0:case 11:case 15:mi(8,i,t);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var s=i.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:kl(i.memoizedState.cache)}if(s=i.child,s!==null)s.return=i,vt=s;else e:for(i=e;vt!==null;){s=vt;var u=s.sibling,d=s.return;if(Em(s),s===i){vt=null;break e}if(u!==null){u.return=d,vt=u;break e}vt=d}}}var kv={getCacheForType:function(e){var t=Ct(dt),i=t.data.get(e);return i===void 0&&(i=e(),t.data.set(e,i)),i},cacheSignal:function(){return Ct(dt).controller.signal}},Lv=typeof WeakMap=="function"?WeakMap:Map,Ke=0,$e=null,je=null,De=0,Fe=0,Vt=null,pi=!1,Ua=!1,lu=!1,Vn=0,lt=0,gi=0,Qi=0,su=0,$t=0,Ka=0,$l=null,Bt=null,ou=!1,xo=0,Bm=0,wo=1/0,So=null,bi=null,pt=0,yi=null,Ia=null,$n=0,ru=0,cu=null,Um=null,ql=0,uu=null;function qt(){return(Ke&2)!==0&&De!==0?De&-De:A.T!==null?gu():ef()}function Km(){if($t===0)if((De&536870912)===0||He){var e=It;It<<=1,(It&3932160)===0&&(It=262144),$t=e}else $t=536870912;return e=Yt.current,e!==null&&(e.flags|=32),$t}function Ut(e,t,i){(e===$e&&(Fe===2||Fe===9)||e.cancelPendingCommit!==null)&&(Fa(e,0),vi(e,De,$t,!1)),pl(e,i),((Ke&2)===0||e!==$e)&&(e===$e&&((Ke&2)===0&&(Qi|=i),lt===4&&vi(e,De,$t,!1)),Tn(e))}function Im(e,t,i){if((Ke&6)!==0)throw Error(o(327));var s=!i&&(t&127)===0&&(t&e.expiredLanes)===0||ni(e,t),u=s?jv(e,t):fu(e,t,!0),d=s;do{if(u===0){Ua&&!s&&vi(e,t,0,!1);break}else{if(i=e.current.alternate,d&&!_v(i)){u=fu(e,t,!1),d=!1;continue}if(u===2){if(d=t,e.errorRecoveryDisabledLanes&d)var b=0;else b=e.pendingLanes&-536870913,b=b!==0?b:b&536870912?536870912:0;if(b!==0){t=b;e:{var C=e;u=$l;var L=C.current.memoizedState.isDehydrated;if(L&&(Fa(C,b).flags|=256),b=fu(C,b,!1),b!==2){if(lu&&!L){C.errorRecoveryDisabledLanes|=d,Qi|=d,u=4;break e}d=Bt,Bt=u,d!==null&&(Bt===null?Bt=d:Bt.push.apply(Bt,d))}u=b}if(d=!1,u!==2)continue}}if(u===1){Fa(e,0),vi(e,t,0,!0);break}e:{switch(s=e,d=u,d){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t)break;case 6:vi(s,t,$t,!pi);break e;case 2:Bt=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(u=xo+300-ut(),10<u)){if(vi(s,t,$t,!pi),ua(s,0,!0)!==0)break e;$n=t,s.timeoutHandle=yp(Fm.bind(null,s,i,Bt,So,ou,t,$t,Qi,Ka,pi,d,"Throttled",-0,0),u);break e}Fm(s,i,Bt,So,ou,t,$t,Qi,Ka,pi,d,null,-0,0)}}break}while(!0);Tn(e)}function Fm(e,t,i,s,u,d,b,C,L,F,X,ee,Y,V){if(e.timeoutHandle=-1,ee=t.subtreeFlags,ee&8192||(ee&16785408)===16785408){ee={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Rn},Om(t,d,ee);var me=(d&62914560)===d?xo-ut():(d&4194048)===d?Bm-ut():0;if(me=px(ee,me),me!==null){$n=d,e.cancelPendingCommit=me(Zm.bind(null,e,t,d,i,s,u,b,C,L,X,ee,null,Y,V)),vi(e,d,b,!F);return}}Zm(e,t,d,i,s,u,b,C,L)}function _v(e){for(var t=e;;){var i=t.tag;if((i===0||i===11||i===15)&&t.flags&16384&&(i=t.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var s=0;s<i.length;s++){var u=i[s],d=u.getSnapshot;u=u.value;try{if(!Ft(d(),u))return!1}catch{return!1}}if(i=t.child,t.subtreeFlags&16384&&i!==null)i.return=t,t=i;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 vi(e,t,i,s){t&=~su,t&=~Qi,e.suspendedLanes|=t,e.pingedLanes&=~t,s&&(e.warmLanes|=t),s=e.expirationTimes;for(var u=t;0<u;){var d=31-kt(u),b=1<<d;s[d]=-1,u&=~b}i!==0&&Wd(e,i,t)}function Co(){return(Ke&6)===0?(Xl(0),!1):!0}function du(){if(je!==null){if(Fe===0)var e=je.return;else e=je,zn=Gi=null,Ec(e),Ra=null,_l=0,e=je;for(;e!==null;)vm(e.alternate,e),e=e.return;je=null}}function Fa(e,t){var i=e.timeoutHandle;i!==-1&&(e.timeoutHandle=-1,Wv(i)),i=e.cancelPendingCommit,i!==null&&(e.cancelPendingCommit=null,i()),$n=0,du(),$e=e,je=i=On(e.current,null),De=t,Fe=0,Vt=null,pi=!1,Ua=ni(e,t),lu=!1,Ka=$t=su=Qi=gi=lt=0,Bt=$l=null,ou=!1,(t&8)!==0&&(t|=t&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=t;0<s;){var u=31-kt(s),d=1<<u;t|=e[u],s&=~d}return Vn=t,Gs(),i}function Gm(e,t){Le=null,A.H=Ul,t===_a||t===Ws?(t=lh(),Fe=3):t===pc?(t=lh(),Fe=4):Fe=t===Gc?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Vt=t,je===null&&(lt=1,fo(e,en(t,e.current)))}function Ym(){var e=Yt.current;return e===null?!0:(De&4194048)===De?ln===null:(De&62914560)===De||(De&536870912)!==0?e===ln:!1}function Pm(){var e=A.H;return A.H=Ul,e===null?Ul:e}function Vm(){var e=A.A;return A.A=kv,e}function To(){lt=4,pi||(De&4194048)!==De&&Yt.current!==null||(Ua=!0),(gi&134217727)===0&&(Qi&134217727)===0||$e===null||vi($e,De,$t,!1)}function fu(e,t,i){var s=Ke;Ke|=2;var u=Pm(),d=Vm();($e!==e||De!==t)&&(So=null,Fa(e,t)),t=!1;var b=lt;e:do try{if(Fe!==0&&je!==null){var C=je,L=Vt;switch(Fe){case 8:du(),b=6;break e;case 3:case 2:case 9:case 6:Yt.current===null&&(t=!0);var F=Fe;if(Fe=0,Vt=null,Ga(e,C,L,F),i&&Ua){b=0;break e}break;default:F=Fe,Fe=0,Vt=null,Ga(e,C,L,F)}}Rv(),b=lt;break}catch(X){Gm(e,X)}while(!0);return t&&e.shellSuspendCounter++,zn=Gi=null,Ke=s,A.H=u,A.A=d,je===null&&($e=null,De=0,Gs()),b}function Rv(){for(;je!==null;)$m(je)}function jv(e,t){var i=Ke;Ke|=2;var s=Pm(),u=Vm();$e!==e||De!==t?(So=null,wo=ut()+500,Fa(e,t)):Ua=ni(e,t);e:do try{if(Fe!==0&&je!==null){t=je;var d=Vt;t:switch(Fe){case 1:Fe=0,Vt=null,Ga(e,t,d,1);break;case 2:case 9:if(ih(d)){Fe=0,Vt=null,qm(t);break}t=function(){Fe!==2&&Fe!==9||$e!==e||(Fe=7),Tn(e)},d.then(t,t);break e;case 3:Fe=7;break e;case 4:Fe=5;break e;case 7:ih(d)?(Fe=0,Vt=null,qm(t)):(Fe=0,Vt=null,Ga(e,t,d,7));break;case 5:var b=null;switch(je.tag){case 26:b=je.memoizedState;case 5:case 27:var C=je;if(b?jp(b):C.stateNode.complete){Fe=0,Vt=null;var L=C.sibling;if(L!==null)je=L;else{var F=C.return;F!==null?(je=F,Mo(F)):je=null}break t}}Fe=0,Vt=null,Ga(e,t,d,5);break;case 6:Fe=0,Vt=null,Ga(e,t,d,6);break;case 8:du(),lt=6;break e;default:throw Error(o(462))}}Ov();break}catch(X){Gm(e,X)}while(!0);return zn=Gi=null,A.H=s,A.A=u,Ke=i,je!==null?0:($e=null,De=0,Gs(),lt)}function Ov(){for(;je!==null&&!kn();)$m(je)}function $m(e){var t=bm(e.alternate,e,Vn);e.memoizedProps=e.pendingProps,t===null?Mo(e):je=t}function qm(e){var t=e,i=t.alternate;switch(t.tag){case 15:case 0:t=dm(i,t,t.pendingProps,t.type,void 0,De);break;case 11:t=dm(i,t,t.pendingProps,t.type.render,t.ref,De);break;case 5:Ec(t);default:vm(i,t),t=je=Vf(t,Vn),t=bm(i,t,Vn)}e.memoizedProps=e.pendingProps,t===null?Mo(e):je=t}function Ga(e,t,i,s){zn=Gi=null,Ec(t),Ra=null,_l=0;var u=t.return;try{if(Sv(e,u,t,i,De)){lt=1,fo(e,en(i,e.current)),je=null;return}}catch(d){if(u!==null)throw je=u,d;lt=1,fo(e,en(i,e.current)),je=null;return}t.flags&32768?(He||s===1?e=!0:Ua||(De&536870912)!==0?e=!1:(pi=e=!0,(s===2||s===9||s===3||s===6)&&(s=Yt.current,s!==null&&s.tag===13&&(s.flags|=16384))),Xm(t,e)):Mo(t)}function Mo(e){var t=e;do{if((t.flags&32768)!==0){Xm(t,pi);return}e=t.return;var i=Mv(t.alternate,t,Vn);if(i!==null){je=i;return}if(t=t.sibling,t!==null){je=t;return}je=t=e}while(t!==null);lt===0&&(lt=5)}function Xm(e,t){do{var i=Av(e.alternate,e);if(i!==null){i.flags&=32767,je=i;return}if(i=e.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!t&&(e=e.sibling,e!==null)){je=e;return}je=e=i}while(e!==null);lt=6,je=null}function Zm(e,t,i,s,u,d,b,C,L){e.cancelPendingCommit=null;do Ao();while(pt!==0);if((Ke&6)!==0)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));if(d=t.lanes|t.childLanes,d|=ec,h0(e,i,d,b,C,L),e===$e&&(je=$e=null,De=0),Ia=t,yi=e,$n=i,ru=d,cu=u,Um=s,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Bv(Di,function(){return tp(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||s){s=A.T,A.T=null,u=G.p,G.p=2,b=Ke,Ke|=4;try{Ev(e,t,i)}finally{Ke=b,G.p=u,A.T=s}}pt=1,Wm(),Qm(),Jm()}}function Wm(){if(pt===1){pt=0;var e=yi,t=Ia,i=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||i){i=A.T,A.T=null;var s=G.p;G.p=2;var u=Ke;Ke|=4;try{_m(t,e);var d=Tu,b=Hf(e.containerInfo),C=d.focusedElem,L=d.selectionRange;if(b!==C&&C&&C.ownerDocument&&zf(C.ownerDocument.documentElement,C)){if(L!==null&&Xr(C)){var F=L.start,X=L.end;if(X===void 0&&(X=F),"selectionStart"in C)C.selectionStart=F,C.selectionEnd=Math.min(X,C.value.length);else{var ee=C.ownerDocument||document,Y=ee&&ee.defaultView||window;if(Y.getSelection){var V=Y.getSelection(),me=C.textContent.length,Ce=Math.min(L.start,me),Ve=L.end===void 0?Ce:Math.min(L.end,me);!V.extend&&Ce>Ve&&(b=Ve,Ve=Ce,Ce=b);var U=Df(C,Ce),O=Df(C,Ve);if(U&&O&&(V.rangeCount!==1||V.anchorNode!==U.node||V.anchorOffset!==U.offset||V.focusNode!==O.node||V.focusOffset!==O.offset)){var I=ee.createRange();I.setStart(U.node,U.offset),V.removeAllRanges(),Ce>Ve?(V.addRange(I),V.extend(O.node,O.offset)):(I.setEnd(O.node,O.offset),V.addRange(I))}}}}for(ee=[],V=C;V=V.parentNode;)V.nodeType===1&&ee.push({element:V,left:V.scrollLeft,top:V.scrollTop});for(typeof C.focus=="function"&&C.focus(),C=0;C<ee.length;C++){var J=ee[C];J.element.scrollLeft=J.left,J.element.scrollTop=J.top}}Bo=!!Cu,Tu=Cu=null}finally{Ke=u,G.p=s,A.T=i}}e.current=t,pt=2}}function Qm(){if(pt===2){pt=0;var e=yi,t=Ia,i=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||i){i=A.T,A.T=null;var s=G.p;G.p=2;var u=Ke;Ke|=4;try{Am(e,t.alternate,t)}finally{Ke=u,G.p=s,A.T=i}}pt=3}}function Jm(){if(pt===4||pt===3){pt=0,Zt();var e=yi,t=Ia,i=$n,s=Um;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?pt=5:(pt=0,Ia=yi=null,ep(e,e.pendingLanes));var u=e.pendingLanes;if(u===0&&(bi=null),Lr(i),t=t.stateNode,At&&typeof At.onCommitFiberRoot=="function")try{At.onCommitFiberRoot(ti,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=A.T,u=G.p,G.p=2,A.T=null;try{for(var d=e.onRecoverableError,b=0;b<s.length;b++){var C=s[b];d(C.value,{componentStack:C.stack})}}finally{A.T=t,G.p=u}}($n&3)!==0&&Ao(),Tn(e),u=e.pendingLanes,(i&261930)!==0&&(u&42)!==0?e===uu?ql++:(ql=0,uu=e):ql=0,Xl(0)}}function ep(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,kl(t)))}function Ao(){return Wm(),Qm(),Jm(),tp()}function tp(){if(pt!==5)return!1;var e=yi,t=ru;ru=0;var i=Lr($n),s=A.T,u=G.p;try{G.p=32>i?32:i,A.T=null,i=cu,cu=null;var d=yi,b=$n;if(pt=0,Ia=yi=null,$n=0,(Ke&6)!==0)throw Error(o(331));var C=Ke;if(Ke|=4,zm(d.current),jm(d,d.current,b,i),Ke=C,Xl(0,!1),At&&typeof At.onPostCommitFiberRoot=="function")try{At.onPostCommitFiberRoot(ti,d)}catch{}return!0}finally{G.p=u,A.T=s,ep(e,t)}}function np(e,t,i){t=en(i,t),t=Fc(e.stateNode,t,2),e=di(e,t,2),e!==null&&(pl(e,2),Tn(e))}function Ge(e,t,i){if(e.tag===3)np(e,e,i);else for(;t!==null;){if(t.tag===3){np(t,e,i);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(bi===null||!bi.has(s))){e=en(i,e),i=im(2),s=di(t,i,2),s!==null&&(am(i,s,t,e),pl(s,2),Tn(s));break}}t=t.return}}function hu(e,t,i){var s=e.pingCache;if(s===null){s=e.pingCache=new Lv;var u=new Set;s.set(t,u)}else u=s.get(t),u===void 0&&(u=new Set,s.set(t,u));u.has(i)||(lu=!0,u.add(i),e=Dv.bind(null,e,t,i),t.then(e,e))}function Dv(e,t,i){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&i,e.warmLanes&=~i,$e===e&&(De&i)===i&&(lt===4||lt===3&&(De&62914560)===De&&300>ut()-xo?(Ke&2)===0&&Fa(e,0):su|=i,Ka===De&&(Ka=0)),Tn(e)}function ip(e,t){t===0&&(t=ml()),e=Ki(e,t),e!==null&&(pl(e,t),Tn(e))}function zv(e){var t=e.memoizedState,i=0;t!==null&&(i=t.retryLane),ip(e,i)}function Hv(e,t){var i=0;switch(e.tag){case 31:case 13:var s=e.stateNode,u=e.memoizedState;u!==null&&(i=u.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(o(314))}s!==null&&s.delete(t),ip(e,i)}function Bv(e,t){return yn(e,t)}var Eo=null,Ya=null,mu=!1,No=!1,pu=!1,xi=0;function Tn(e){e!==Ya&&e.next===null&&(Ya===null?Eo=Ya=e:Ya=Ya.next=e),No=!0,mu||(mu=!0,Kv())}function Xl(e,t){if(!pu&&No){pu=!0;do for(var i=!1,s=Eo;s!==null;){if(e!==0){var u=s.pendingLanes;if(u===0)var d=0;else{var b=s.suspendedLanes,C=s.pingedLanes;d=(1<<31-kt(42|e)+1)-1,d&=u&~(b&~C),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(i=!0,op(s,d))}else d=De,d=ua(s,s===$e?d:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(d&3)===0||ni(s,d)||(i=!0,op(s,d));s=s.next}while(i);pu=!1}}function Uv(){ap()}function ap(){No=mu=!1;var e=0;xi!==0&&Zv()&&(e=xi);for(var t=ut(),i=null,s=Eo;s!==null;){var u=s.next,d=lp(s,t);d===0?(s.next=null,i===null?Eo=u:i.next=u,u===null&&(Ya=i)):(i=s,(e!==0||(d&3)!==0)&&(No=!0)),s=u}pt!==0&&pt!==5||Xl(e),xi!==0&&(xi=0)}function lp(e,t){for(var i=e.suspendedLanes,s=e.pingedLanes,u=e.expirationTimes,d=e.pendingLanes&-62914561;0<d;){var b=31-kt(d),C=1<<b,L=u[b];L===-1?((C&i)===0||(C&s)!==0)&&(u[b]=Er(C,t)):L<=t&&(e.expiredLanes|=C),d&=~C}if(t=$e,i=De,i=ua(e,e===t?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,i===0||e===t&&(Fe===2||Fe===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&vn(s),e.callbackNode=null,e.callbackPriority=0;if((i&3)===0||ni(e,i)){if(t=i&-i,t===e.callbackPriority)return t;switch(s!==null&&vn(s),Lr(i)){case 2:case 8:i=fl;break;case 32:i=Di;break;case 268435456:i=hl;break;default:i=Di}return s=sp.bind(null,e),i=yn(i,s),e.callbackPriority=t,e.callbackNode=i,t}return s!==null&&s!==null&&vn(s),e.callbackPriority=2,e.callbackNode=null,2}function sp(e,t){if(pt!==0&&pt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var i=e.callbackNode;if(Ao()&&e.callbackNode!==i)return null;var s=De;return s=ua(e,e===$e?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(Im(e,s,t),lp(e,ut()),e.callbackNode!=null&&e.callbackNode===i?sp.bind(null,e):null)}function op(e,t){if(Ao())return null;Im(e,t,!0)}function Kv(){Qv(function(){(Ke&6)!==0?yn(dl,Uv):ap()})}function gu(){if(xi===0){var e=ka;e===0&&(e=Lt,Lt<<=1,(Lt&261888)===0&&(Lt=256)),xi=e}return xi}function rp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Ds(""+e)}function cp(e,t){var i=t.ownerDocument.createElement("input");return i.name=t.name,i.value=t.value,e.id&&i.setAttribute("form",e.id),t.parentNode.insertBefore(i,t),e=new FormData(e),i.parentNode.removeChild(i),e}function Iv(e,t,i,s,u){if(t==="submit"&&i&&i.stateNode===u){var d=rp((u[jt]||null).action),b=s.submitter;b&&(t=(t=b[jt]||null)?rp(t.formAction):b.getAttribute("formAction"),t!==null&&(d=t,b=null));var C=new Us("action","action",null,s,u);e.push({event:C,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(xi!==0){var L=b?cp(u,b):new FormData(u);zc(i,{pending:!0,data:L,method:u.method,action:d},null,L)}}else typeof d=="function"&&(C.preventDefault(),L=b?cp(u,b):new FormData(u),zc(i,{pending:!0,data:L,method:u.method,action:d},d,L))},currentTarget:u}]})}}for(var bu=0;bu<Jr.length;bu++){var yu=Jr[bu],Fv=yu.toLowerCase(),Gv=yu[0].toUpperCase()+yu.slice(1);fn(Fv,"on"+Gv)}fn(Kf,"onAnimationEnd"),fn(If,"onAnimationIteration"),fn(Ff,"onAnimationStart"),fn("dblclick","onDoubleClick"),fn("focusin","onFocus"),fn("focusout","onBlur"),fn(lv,"onTransitionRun"),fn(sv,"onTransitionStart"),fn(ov,"onTransitionCancel"),fn(Gf,"onTransitionEnd"),pa("onMouseEnter",["mouseout","mouseover"]),pa("onMouseLeave",["mouseout","mouseover"]),pa("onPointerEnter",["pointerout","pointerover"]),pa("onPointerLeave",["pointerout","pointerover"]),zi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),zi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),zi("onBeforeInput",["compositionend","keypress","textInput","paste"]),zi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),zi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),zi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Zl="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(" "),Yv=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Zl));function up(e,t){t=(t&4)!==0;for(var i=0;i<e.length;i++){var s=e[i],u=s.event;s=s.listeners;e:{var d=void 0;if(t)for(var b=s.length-1;0<=b;b--){var C=s[b],L=C.instance,F=C.currentTarget;if(C=C.listener,L!==d&&u.isPropagationStopped())break e;d=C,u.currentTarget=F;try{d(u)}catch(X){Fs(X)}u.currentTarget=null,d=L}else for(b=0;b<s.length;b++){if(C=s[b],L=C.instance,F=C.currentTarget,C=C.listener,L!==d&&u.isPropagationStopped())break e;d=C,u.currentTarget=F;try{d(u)}catch(X){Fs(X)}u.currentTarget=null,d=L}}}}function Oe(e,t){var i=t[_r];i===void 0&&(i=t[_r]=new Set);var s=e+"__bubble";i.has(s)||(dp(t,e,2,!1),i.add(s))}function vu(e,t,i){var s=0;t&&(s|=4),dp(i,e,s,t)}var ko="_reactListening"+Math.random().toString(36).slice(2);function xu(e){if(!e[ko]){e[ko]=!0,af.forEach(function(i){i!=="selectionchange"&&(Yv.has(i)||vu(i,!1,e),vu(i,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ko]||(t[ko]=!0,vu("selectionchange",!1,t))}}function dp(e,t,i,s){switch(Kp(t)){case 2:var u=yx;break;case 8:u=vx;break;default:u=Du}i=u.bind(null,t,i,e),u=void 0,!Kr||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(u=!0),s?u!==void 0?e.addEventListener(t,i,{capture:!0,passive:u}):e.addEventListener(t,i,!0):u!==void 0?e.addEventListener(t,i,{passive:u}):e.addEventListener(t,i,!1)}function wu(e,t,i,s,u){var d=s;if((t&1)===0&&(t&2)===0&&s!==null)e:for(;;){if(s===null)return;var b=s.tag;if(b===3||b===4){var C=s.stateNode.containerInfo;if(C===u)break;if(b===4)for(b=s.return;b!==null;){var L=b.tag;if((L===3||L===4)&&b.stateNode.containerInfo===u)return;b=b.return}for(;C!==null;){if(b=fa(C),b===null)return;if(L=b.tag,L===5||L===6||L===26||L===27){s=d=b;continue e}C=C.parentNode}}s=s.return}gf(function(){var F=d,X=Br(i),ee=[];e:{var Y=Yf.get(e);if(Y!==void 0){var V=Us,me=e;switch(e){case"keypress":if(Hs(i)===0)break e;case"keydown":case"keyup":V=H0;break;case"focusin":me="focus",V=Yr;break;case"focusout":me="blur",V=Yr;break;case"beforeblur":case"afterblur":V=Yr;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":V=vf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":V=M0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":V=K0;break;case Kf:case If:case Ff:V=N0;break;case Gf:V=F0;break;case"scroll":case"scrollend":V=C0;break;case"wheel":V=Y0;break;case"copy":case"cut":case"paste":V=L0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":V=wf;break;case"toggle":case"beforetoggle":V=V0}var Ce=(t&4)!==0,Ve=!Ce&&(e==="scroll"||e==="scrollend"),U=Ce?Y!==null?Y+"Capture":null:Y;Ce=[];for(var O=F,I;O!==null;){var J=O;if(I=J.stateNode,J=J.tag,J!==5&&J!==26&&J!==27||I===null||U===null||(J=yl(O,U),J!=null&&Ce.push(Wl(O,J,I))),Ve)break;O=O.return}0<Ce.length&&(Y=new V(Y,me,null,i,X),ee.push({event:Y,listeners:Ce}))}}if((t&7)===0){e:{if(Y=e==="mouseover"||e==="pointerover",V=e==="mouseout"||e==="pointerout",Y&&i!==Hr&&(me=i.relatedTarget||i.fromElement)&&(fa(me)||me[da]))break e;if((V||Y)&&(Y=X.window===X?X:(Y=X.ownerDocument)?Y.defaultView||Y.parentWindow:window,V?(me=i.relatedTarget||i.toElement,V=F,me=me?fa(me):null,me!==null&&(Ve=c(me),Ce=me.tag,me!==Ve||Ce!==5&&Ce!==27&&Ce!==6)&&(me=null)):(V=null,me=F),V!==me)){if(Ce=vf,J="onMouseLeave",U="onMouseEnter",O="mouse",(e==="pointerout"||e==="pointerover")&&(Ce=wf,J="onPointerLeave",U="onPointerEnter",O="pointer"),Ve=V==null?Y:bl(V),I=me==null?Y:bl(me),Y=new Ce(J,O+"leave",V,i,X),Y.target=Ve,Y.relatedTarget=I,J=null,fa(X)===F&&(Ce=new Ce(U,O+"enter",me,i,X),Ce.target=I,Ce.relatedTarget=Ve,J=Ce),Ve=J,V&&me)t:{for(Ce=Pv,U=V,O=me,I=0,J=U;J;J=Ce(J))I++;J=0;for(var Se=O;Se;Se=Ce(Se))J++;for(;0<I-J;)U=Ce(U),I--;for(;0<J-I;)O=Ce(O),J--;for(;I--;){if(U===O||O!==null&&U===O.alternate){Ce=U;break t}U=Ce(U),O=Ce(O)}Ce=null}else Ce=null;V!==null&&fp(ee,Y,V,Ce,!1),me!==null&&Ve!==null&&fp(ee,Ve,me,Ce,!0)}}e:{if(Y=F?bl(F):window,V=Y.nodeName&&Y.nodeName.toLowerCase(),V==="select"||V==="input"&&Y.type==="file")var Be=kf;else if(Ef(Y))if(Lf)Be=nv;else{Be=ev;var pe=J0}else V=Y.nodeName,!V||V.toLowerCase()!=="input"||Y.type!=="checkbox"&&Y.type!=="radio"?F&&zr(F.elementType)&&(Be=kf):Be=tv;if(Be&&(Be=Be(e,F))){Nf(ee,Be,i,X);break e}pe&&pe(e,Y,F),e==="focusout"&&F&&Y.type==="number"&&F.memoizedProps.value!=null&&Dr(Y,"number",Y.value)}switch(pe=F?bl(F):window,e){case"focusin":(Ef(pe)||pe.contentEditable==="true")&&(wa=pe,Zr=F,Al=null);break;case"focusout":Al=Zr=wa=null;break;case"mousedown":Wr=!0;break;case"contextmenu":case"mouseup":case"dragend":Wr=!1,Bf(ee,i,X);break;case"selectionchange":if(av)break;case"keydown":case"keyup":Bf(ee,i,X)}var _e;if(Vr)e:{switch(e){case"compositionstart":var ze="onCompositionStart";break e;case"compositionend":ze="onCompositionEnd";break e;case"compositionupdate":ze="onCompositionUpdate";break e}ze=void 0}else xa?Mf(e,i)&&(ze="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(ze="onCompositionStart");ze&&(Sf&&i.locale!=="ko"&&(xa||ze!=="onCompositionStart"?ze==="onCompositionEnd"&&xa&&(_e=bf()):(ai=X,Ir="value"in ai?ai.value:ai.textContent,xa=!0)),pe=Lo(F,ze),0<pe.length&&(ze=new xf(ze,e,null,i,X),ee.push({event:ze,listeners:pe}),_e?ze.data=_e:(_e=Af(i),_e!==null&&(ze.data=_e)))),(_e=q0?X0(e,i):Z0(e,i))&&(ze=Lo(F,"onBeforeInput"),0<ze.length&&(pe=new xf("onBeforeInput","beforeinput",null,i,X),ee.push({event:pe,listeners:ze}),pe.data=_e)),Iv(ee,e,F,i,X)}up(ee,t)})}function Wl(e,t,i){return{instance:e,listener:t,currentTarget:i}}function Lo(e,t){for(var i=t+"Capture",s=[];e!==null;){var u=e,d=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||d===null||(u=yl(e,i),u!=null&&s.unshift(Wl(e,u,d)),u=yl(e,t),u!=null&&s.push(Wl(e,u,d))),e.tag===3)return s;e=e.return}return[]}function Pv(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function fp(e,t,i,s,u){for(var d=t._reactName,b=[];i!==null&&i!==s;){var C=i,L=C.alternate,F=C.stateNode;if(C=C.tag,L!==null&&L===s)break;C!==5&&C!==26&&C!==27||F===null||(L=F,u?(F=yl(i,d),F!=null&&b.unshift(Wl(i,F,L))):u||(F=yl(i,d),F!=null&&b.push(Wl(i,F,L)))),i=i.return}b.length!==0&&e.push({event:t,listeners:b})}var Vv=/\r\n?/g,$v=/\u0000|\uFFFD/g;function hp(e){return(typeof e=="string"?e:""+e).replace(Vv,`
33
+ `).replace($v,"")}function mp(e,t){return t=hp(t),hp(e)===t}function Pe(e,t,i,s,u,d){switch(i){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||ba(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&ba(e,""+s);break;case"className":js(e,"class",s);break;case"tabIndex":js(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":js(e,i,s);break;case"style":mf(e,s,d);break;case"data":if(t!=="object"){js(e,"data",s);break}case"src":case"href":if(s===""&&(t!=="a"||i!=="href")){e.removeAttribute(i);break}if(s==null||typeof s=="function"||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(i);break}s=Ds(""+s),e.setAttribute(i,s);break;case"action":case"formAction":if(typeof s=="function"){e.setAttribute(i,"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 d=="function"&&(i==="formAction"?(t!=="input"&&Pe(e,t,"name",u.name,u,null),Pe(e,t,"formEncType",u.formEncType,u,null),Pe(e,t,"formMethod",u.formMethod,u,null),Pe(e,t,"formTarget",u.formTarget,u,null)):(Pe(e,t,"encType",u.encType,u,null),Pe(e,t,"method",u.method,u,null),Pe(e,t,"target",u.target,u,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(i);break}s=Ds(""+s),e.setAttribute(i,s);break;case"onClick":s!=null&&(e.onclick=Rn);break;case"onScroll":s!=null&&Oe("scroll",e);break;case"onScrollEnd":s!=null&&Oe("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(o(61));if(i=s.__html,i!=null){if(u.children!=null)throw Error(o(60));e.innerHTML=i}}break;case"multiple":e.multiple=s&&typeof s!="function"&&typeof s!="symbol";break;case"muted":e.muted=s&&typeof s!="function"&&typeof s!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(s==null||typeof s=="function"||typeof s=="boolean"||typeof s=="symbol"){e.removeAttribute("xlink:href");break}i=Ds(""+s),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(i,""+s):e.removeAttribute(i);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":s&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(i,""):e.removeAttribute(i);break;case"capture":case"download":s===!0?e.setAttribute(i,""):s!==!1&&s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(i,s):e.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":s!=null&&typeof s!="function"&&typeof s!="symbol"&&!isNaN(s)&&1<=s?e.setAttribute(i,s):e.removeAttribute(i);break;case"rowSpan":case"start":s==null||typeof s=="function"||typeof s=="symbol"||isNaN(s)?e.removeAttribute(i):e.setAttribute(i,s);break;case"popover":Oe("beforetoggle",e),Oe("toggle",e),Rs(e,"popover",s);break;case"xlinkActuate":_n(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":_n(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":_n(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":_n(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":_n(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":_n(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":_n(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":_n(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":_n(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":Rs(e,"is",s);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=w0.get(i)||i,Rs(e,i,s))}}function Su(e,t,i,s,u,d){switch(i){case"style":mf(e,s,d);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(o(61));if(i=s.__html,i!=null){if(u.children!=null)throw Error(o(60));e.innerHTML=i}}break;case"children":typeof s=="string"?ba(e,s):(typeof s=="number"||typeof s=="bigint")&&ba(e,""+s);break;case"onScroll":s!=null&&Oe("scroll",e);break;case"onScrollEnd":s!=null&&Oe("scrollend",e);break;case"onClick":s!=null&&(e.onclick=Rn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!lf.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(u=i.endsWith("Capture"),t=i.slice(2,u?i.length-7:void 0),d=e[jt]||null,d=d!=null?d[i]:null,typeof d=="function"&&e.removeEventListener(t,d,u),typeof s=="function")){typeof d!="function"&&d!==null&&(i in e?e[i]=null:e.hasAttribute(i)&&e.removeAttribute(i)),e.addEventListener(t,s,u);break e}i in e?e[i]=s:s===!0?e.setAttribute(i,""):Rs(e,i,s)}}}function Mt(e,t,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Oe("error",e),Oe("load",e);var s=!1,u=!1,d;for(d in i)if(i.hasOwnProperty(d)){var b=i[d];if(b!=null)switch(d){case"src":s=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:Pe(e,t,d,b,i,null)}}u&&Pe(e,t,"srcSet",i.srcSet,i,null),s&&Pe(e,t,"src",i.src,i,null);return;case"input":Oe("invalid",e);var C=d=b=u=null,L=null,F=null;for(s in i)if(i.hasOwnProperty(s)){var X=i[s];if(X!=null)switch(s){case"name":u=X;break;case"type":b=X;break;case"checked":L=X;break;case"defaultChecked":F=X;break;case"value":d=X;break;case"defaultValue":C=X;break;case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(o(137,t));break;default:Pe(e,t,s,X,i,null)}}uf(e,d,C,L,F,b,u,!1);return;case"select":Oe("invalid",e),s=b=d=null;for(u in i)if(i.hasOwnProperty(u)&&(C=i[u],C!=null))switch(u){case"value":d=C;break;case"defaultValue":b=C;break;case"multiple":s=C;default:Pe(e,t,u,C,i,null)}t=d,i=b,e.multiple=!!s,t!=null?ga(e,!!s,t,!1):i!=null&&ga(e,!!s,i,!0);return;case"textarea":Oe("invalid",e),d=u=s=null;for(b in i)if(i.hasOwnProperty(b)&&(C=i[b],C!=null))switch(b){case"value":s=C;break;case"defaultValue":u=C;break;case"children":d=C;break;case"dangerouslySetInnerHTML":if(C!=null)throw Error(o(91));break;default:Pe(e,t,b,C,i,null)}ff(e,s,u,d);return;case"option":for(L in i)if(i.hasOwnProperty(L)&&(s=i[L],s!=null))switch(L){case"selected":e.selected=s&&typeof s!="function"&&typeof s!="symbol";break;default:Pe(e,t,L,s,i,null)}return;case"dialog":Oe("beforetoggle",e),Oe("toggle",e),Oe("cancel",e),Oe("close",e);break;case"iframe":case"object":Oe("load",e);break;case"video":case"audio":for(s=0;s<Zl.length;s++)Oe(Zl[s],e);break;case"image":Oe("error",e),Oe("load",e);break;case"details":Oe("toggle",e);break;case"embed":case"source":case"link":Oe("error",e),Oe("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(F in i)if(i.hasOwnProperty(F)&&(s=i[F],s!=null))switch(F){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:Pe(e,t,F,s,i,null)}return;default:if(zr(t)){for(X in i)i.hasOwnProperty(X)&&(s=i[X],s!==void 0&&Su(e,t,X,s,i,void 0));return}}for(C in i)i.hasOwnProperty(C)&&(s=i[C],s!=null&&Pe(e,t,C,s,i,null))}function qv(e,t,i,s){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,d=null,b=null,C=null,L=null,F=null,X=null;for(V in i){var ee=i[V];if(i.hasOwnProperty(V)&&ee!=null)switch(V){case"checked":break;case"value":break;case"defaultValue":L=ee;default:s.hasOwnProperty(V)||Pe(e,t,V,null,s,ee)}}for(var Y in s){var V=s[Y];if(ee=i[Y],s.hasOwnProperty(Y)&&(V!=null||ee!=null))switch(Y){case"type":d=V;break;case"name":u=V;break;case"checked":F=V;break;case"defaultChecked":X=V;break;case"value":b=V;break;case"defaultValue":C=V;break;case"children":case"dangerouslySetInnerHTML":if(V!=null)throw Error(o(137,t));break;default:V!==ee&&Pe(e,t,Y,V,s,ee)}}Or(e,b,C,L,F,X,d,u);return;case"select":V=b=C=Y=null;for(d in i)if(L=i[d],i.hasOwnProperty(d)&&L!=null)switch(d){case"value":break;case"multiple":V=L;default:s.hasOwnProperty(d)||Pe(e,t,d,null,s,L)}for(u in s)if(d=s[u],L=i[u],s.hasOwnProperty(u)&&(d!=null||L!=null))switch(u){case"value":Y=d;break;case"defaultValue":C=d;break;case"multiple":b=d;default:d!==L&&Pe(e,t,u,d,s,L)}t=C,i=b,s=V,Y!=null?ga(e,!!i,Y,!1):!!s!=!!i&&(t!=null?ga(e,!!i,t,!0):ga(e,!!i,i?[]:"",!1));return;case"textarea":V=Y=null;for(C in i)if(u=i[C],i.hasOwnProperty(C)&&u!=null&&!s.hasOwnProperty(C))switch(C){case"value":break;case"children":break;default:Pe(e,t,C,null,s,u)}for(b in s)if(u=s[b],d=i[b],s.hasOwnProperty(b)&&(u!=null||d!=null))switch(b){case"value":Y=u;break;case"defaultValue":V=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(o(91));break;default:u!==d&&Pe(e,t,b,u,s,d)}df(e,Y,V);return;case"option":for(var me in i)if(Y=i[me],i.hasOwnProperty(me)&&Y!=null&&!s.hasOwnProperty(me))switch(me){case"selected":e.selected=!1;break;default:Pe(e,t,me,null,s,Y)}for(L in s)if(Y=s[L],V=i[L],s.hasOwnProperty(L)&&Y!==V&&(Y!=null||V!=null))switch(L){case"selected":e.selected=Y&&typeof Y!="function"&&typeof Y!="symbol";break;default:Pe(e,t,L,Y,s,V)}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 Ce in i)Y=i[Ce],i.hasOwnProperty(Ce)&&Y!=null&&!s.hasOwnProperty(Ce)&&Pe(e,t,Ce,null,s,Y);for(F in s)if(Y=s[F],V=i[F],s.hasOwnProperty(F)&&Y!==V&&(Y!=null||V!=null))switch(F){case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(o(137,t));break;default:Pe(e,t,F,Y,s,V)}return;default:if(zr(t)){for(var Ve in i)Y=i[Ve],i.hasOwnProperty(Ve)&&Y!==void 0&&!s.hasOwnProperty(Ve)&&Su(e,t,Ve,void 0,s,Y);for(X in s)Y=s[X],V=i[X],!s.hasOwnProperty(X)||Y===V||Y===void 0&&V===void 0||Su(e,t,X,Y,s,V);return}}for(var U in i)Y=i[U],i.hasOwnProperty(U)&&Y!=null&&!s.hasOwnProperty(U)&&Pe(e,t,U,null,s,Y);for(ee in s)Y=s[ee],V=i[ee],!s.hasOwnProperty(ee)||Y===V||Y==null&&V==null||Pe(e,t,ee,Y,s,V)}function pp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Xv(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,i=performance.getEntriesByType("resource"),s=0;s<i.length;s++){var u=i[s],d=u.transferSize,b=u.initiatorType,C=u.duration;if(d&&C&&pp(b)){for(b=0,C=u.responseEnd,s+=1;s<i.length;s++){var L=i[s],F=L.startTime;if(F>C)break;var X=L.transferSize,ee=L.initiatorType;X&&pp(ee)&&(L=L.responseEnd,b+=X*(L<C?1:(C-F)/(L-F)))}if(--s,t+=8*(d+b)/(u.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 Cu=null,Tu=null;function _o(e){return e.nodeType===9?e:e.ownerDocument}function gp(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 bp(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 Mu(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 Au=null;function Zv(){var e=window.event;return e&&e.type==="popstate"?e===Au?!1:(Au=e,!0):(Au=null,!1)}var yp=typeof setTimeout=="function"?setTimeout:void 0,Wv=typeof clearTimeout=="function"?clearTimeout:void 0,vp=typeof Promise=="function"?Promise:void 0,Qv=typeof queueMicrotask=="function"?queueMicrotask:typeof vp<"u"?function(e){return vp.resolve(null).then(e).catch(Jv)}:yp;function Jv(e){setTimeout(function(){throw e})}function wi(e){return e==="head"}function xp(e,t){var i=t,s=0;do{var u=i.nextSibling;if(e.removeChild(i),u&&u.nodeType===8)if(i=u.data,i==="/$"||i==="/&"){if(s===0){e.removeChild(u),qa(t);return}s--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")s++;else if(i==="html")Ql(e.ownerDocument.documentElement);else if(i==="head"){i=e.ownerDocument.head,Ql(i);for(var d=i.firstChild;d;){var b=d.nextSibling,C=d.nodeName;d[gl]||C==="SCRIPT"||C==="STYLE"||C==="LINK"&&d.rel.toLowerCase()==="stylesheet"||i.removeChild(d),d=b}}else i==="body"&&Ql(e.ownerDocument.body);i=u}while(i);qa(t)}function wp(e,t){var i=e;e=0;do{var s=i.nextSibling;if(i.nodeType===1?t?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(t?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),s&&s.nodeType===8)if(i=s.data,i==="/$"){if(e===0)break;e--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||e++;i=s}while(i)}function Eu(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var i=t;switch(t=t.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":Eu(i),Rr(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}e.removeChild(i)}}function ex(e,t,i,s){for(;e.nodeType===1;){var u=i;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!s&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(s){if(!e[gl])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(d=e.getAttribute("rel"),d==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(d!==u.rel||e.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||e.getAttribute("title")!==(u.title==null?null:u.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(d=e.getAttribute("src"),(d!==(u.src==null?null:u.src)||e.getAttribute("type")!==(u.type==null?null:u.type)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&d&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var d=u.name==null?null:""+u.name;if(u.type==="hidden"&&e.getAttribute("name")===d)return e}else return e;if(e=sn(e.nextSibling),e===null)break}return null}function tx(e,t,i){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!i||(e=sn(e.nextSibling),e===null))return null;return e}function Sp(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=sn(e.nextSibling),e===null))return null;return e}function Nu(e){return e.data==="$?"||e.data==="$~"}function ku(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function nx(e,t){var i=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||i.readyState!=="loading")t();else{var s=function(){t(),i.removeEventListener("DOMContentLoaded",s)};i.addEventListener("DOMContentLoaded",s),e._reactRetry=s}}function sn(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 Lu=null;function Cp(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"||i==="/&"){if(t===0)return sn(e.nextSibling);t--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||t++}e=e.nextSibling}return null}function Tp(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(t===0)return e;t--}else i!=="/$"&&i!=="/&"||t++}e=e.previousSibling}return null}function Mp(e,t,i){switch(t=_o(i),e){case"html":if(e=t.documentElement,!e)throw Error(o(452));return e;case"head":if(e=t.head,!e)throw Error(o(453));return e;case"body":if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function Ql(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Rr(e)}var on=new Map,Ap=new Set;function Ro(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var qn=G.d;G.d={f:ix,r:ax,D:lx,C:sx,L:ox,m:rx,X:ux,S:cx,M:dx};function ix(){var e=qn.f(),t=Co();return e||t}function ax(e){var t=ha(e);t!==null&&t.tag===5&&t.type==="form"?Gh(t):qn.r(e)}var Pa=typeof document>"u"?null:document;function Ep(e,t,i){var s=Pa;if(s&&typeof t=="string"&&t){var u=Qt(t);u='link[rel="'+e+'"][href="'+u+'"]',typeof i=="string"&&(u+='[crossorigin="'+i+'"]'),Ap.has(u)||(Ap.add(u),e={rel:e,crossOrigin:i,href:t},s.querySelector(u)===null&&(t=s.createElement("link"),Mt(t,"link",e),yt(t),s.head.appendChild(t)))}}function lx(e){qn.D(e),Ep("dns-prefetch",e,null)}function sx(e,t){qn.C(e,t),Ep("preconnect",e,t)}function ox(e,t,i){qn.L(e,t,i);var s=Pa;if(s&&e&&t){var u='link[rel="preload"][as="'+Qt(t)+'"]';t==="image"&&i&&i.imageSrcSet?(u+='[imagesrcset="'+Qt(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(u+='[imagesizes="'+Qt(i.imageSizes)+'"]')):u+='[href="'+Qt(e)+'"]';var d=u;switch(t){case"style":d=Va(e);break;case"script":d=$a(e)}on.has(d)||(e=v({rel:"preload",href:t==="image"&&i&&i.imageSrcSet?void 0:e,as:t},i),on.set(d,e),s.querySelector(u)!==null||t==="style"&&s.querySelector(Jl(d))||t==="script"&&s.querySelector(es(d))||(t=s.createElement("link"),Mt(t,"link",e),yt(t),s.head.appendChild(t)))}}function rx(e,t){qn.m(e,t);var i=Pa;if(i&&e){var s=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+Qt(s)+'"][href="'+Qt(e)+'"]',d=u;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":d=$a(e)}if(!on.has(d)&&(e=v({rel:"modulepreload",href:e},t),on.set(d,e),i.querySelector(u)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(es(d)))return}s=i.createElement("link"),Mt(s,"link",e),yt(s),i.head.appendChild(s)}}}function cx(e,t,i){qn.S(e,t,i);var s=Pa;if(s&&e){var u=ma(s).hoistableStyles,d=Va(e);t=t||"default";var b=u.get(d);if(!b){var C={loading:0,preload:null};if(b=s.querySelector(Jl(d)))C.loading=5;else{e=v({rel:"stylesheet",href:e,"data-precedence":t},i),(i=on.get(d))&&_u(e,i);var L=b=s.createElement("link");yt(L),Mt(L,"link",e),L._p=new Promise(function(F,X){L.onload=F,L.onerror=X}),L.addEventListener("load",function(){C.loading|=1}),L.addEventListener("error",function(){C.loading|=2}),C.loading|=4,jo(b,t,s)}b={type:"stylesheet",instance:b,count:1,state:C},u.set(d,b)}}}function ux(e,t){qn.X(e,t);var i=Pa;if(i&&e){var s=ma(i).hoistableScripts,u=$a(e),d=s.get(u);d||(d=i.querySelector(es(u)),d||(e=v({src:e,async:!0},t),(t=on.get(u))&&Ru(e,t),d=i.createElement("script"),yt(d),Mt(d,"link",e),i.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},s.set(u,d))}}function dx(e,t){qn.M(e,t);var i=Pa;if(i&&e){var s=ma(i).hoistableScripts,u=$a(e),d=s.get(u);d||(d=i.querySelector(es(u)),d||(e=v({src:e,async:!0,type:"module"},t),(t=on.get(u))&&Ru(e,t),d=i.createElement("script"),yt(d),Mt(d,"link",e),i.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},s.set(u,d))}}function Np(e,t,i,s){var u=(u=be.current)?Ro(u):null;if(!u)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(t=Va(i.href),i=ma(u).hoistableStyles,s=i.get(t),s||(s={type:"style",instance:null,count:0,state:null},i.set(t,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){e=Va(i.href);var d=ma(u).hoistableStyles,b=d.get(e);if(b||(u=u.ownerDocument||u,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},d.set(e,b),(d=u.querySelector(Jl(e)))&&!d._p&&(b.instance=d,b.state.loading=5),on.has(e)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},on.set(e,i),d||fx(u,e,i,b.state))),t&&s===null)throw Error(o(528,""));return b}if(t&&s!==null)throw Error(o(529,""));return null;case"script":return t=i.async,i=i.src,typeof i=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=$a(i),i=ma(u).hoistableScripts,s=i.get(t),s||(s={type:"script",instance:null,count:0,state:null},i.set(t,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function Va(e){return'href="'+Qt(e)+'"'}function Jl(e){return'link[rel="stylesheet"]['+e+"]"}function kp(e){return v({},e,{"data-precedence":e.precedence,precedence:null})}function fx(e,t,i,s){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?s.loading=1:(t=e.createElement("link"),s.preload=t,t.addEventListener("load",function(){return s.loading|=1}),t.addEventListener("error",function(){return s.loading|=2}),Mt(t,"link",i),yt(t),e.head.appendChild(t))}function $a(e){return'[src="'+Qt(e)+'"]'}function es(e){return"script[async]"+e}function Lp(e,t,i){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+Qt(i.href)+'"]');if(s)return t.instance=s,yt(s),s;var u=v({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),yt(s),Mt(s,"style",u),jo(s,i.precedence,e),t.instance=s;case"stylesheet":u=Va(i.href);var d=e.querySelector(Jl(u));if(d)return t.state.loading|=4,t.instance=d,yt(d),d;s=kp(i),(u=on.get(u))&&_u(s,u),d=(e.ownerDocument||e).createElement("link"),yt(d);var b=d;return b._p=new Promise(function(C,L){b.onload=C,b.onerror=L}),Mt(d,"link",s),t.state.loading|=4,jo(d,i.precedence,e),t.instance=d;case"script":return d=$a(i.src),(u=e.querySelector(es(d)))?(t.instance=u,yt(u),u):(s=i,(u=on.get(d))&&(s=v({},i),Ru(s,u)),e=e.ownerDocument||e,u=e.createElement("script"),yt(u),Mt(u,"link",s),e.head.appendChild(u),t.instance=u);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(s=t.instance,t.state.loading|=4,jo(s,i.precedence,e));return t.instance}function jo(e,t,i){for(var s=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=s.length?s[s.length-1]:null,d=u,b=0;b<s.length;b++){var C=s[b];if(C.dataset.precedence===t)d=C;else if(d!==u)break}d?d.parentNode.insertBefore(e,d.nextSibling):(t=i.nodeType===9?i.head:i,t.insertBefore(e,t.firstChild))}function _u(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Ru(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Oo=null;function _p(e,t,i){if(Oo===null){var s=new Map,u=Oo=new Map;u.set(i,s)}else u=Oo,s=u.get(i),s||(s=new Map,u.set(i,s));if(s.has(e))return s;for(s.set(e,null),i=i.getElementsByTagName(e),u=0;u<i.length;u++){var d=i[u];if(!(d[gl]||d[wt]||e==="link"&&d.getAttribute("rel")==="stylesheet")&&d.namespaceURI!=="http://www.w3.org/2000/svg"){var b=d.getAttribute(t)||"";b=e+b;var C=s.get(b);C?C.push(d):s.set(b,[d])}}return s}function Rp(e,t,i){e=e.ownerDocument||e,e.head.insertBefore(i,t==="title"?e.querySelector("head > title"):null)}function hx(e,t,i){if(i===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 jp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function mx(e,t,i,s){if(i.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var u=Va(s.href),d=t.querySelector(Jl(u));if(d){t=d._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Do.bind(e),t.then(e,e)),i.state.loading|=4,i.instance=d,yt(d);return}d=t.ownerDocument||t,s=kp(s),(u=on.get(u))&&_u(s,u),d=d.createElement("link"),yt(d);var b=d;b._p=new Promise(function(C,L){b.onload=C,b.onerror=L}),Mt(d,"link",s),i.instance=d}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(i,t),(t=i.state.preload)&&(i.state.loading&3)===0&&(e.count++,i=Do.bind(e),t.addEventListener("load",i),t.addEventListener("error",i))}}var ju=0;function px(e,t){return e.stylesheets&&e.count===0&&Ho(e,e.stylesheets),0<e.count||0<e.imgCount?function(i){var s=setTimeout(function(){if(e.stylesheets&&Ho(e,e.stylesheets),e.unsuspend){var d=e.unsuspend;e.unsuspend=null,d()}},6e4+t);0<e.imgBytes&&ju===0&&(ju=62500*Xv());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Ho(e,e.stylesheets),e.unsuspend)){var d=e.unsuspend;e.unsuspend=null,d()}},(e.imgBytes>ju?50:800)+t);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(u)}}:null}function Do(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ho(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var zo=null;function Ho(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,zo=new Map,t.forEach(gx,e),zo=null,Do.call(e))}function gx(e,t){if(!(t.state.loading&4)){var i=zo.get(e);if(i)var s=i.get(null);else{i=new Map,zo.set(e,i);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;d<u.length;d++){var b=u[d];(b.nodeName==="LINK"||b.getAttribute("media")!=="not all")&&(i.set(b.dataset.precedence,b),s=b)}s&&i.set(null,s)}u=t.instance,b=u.getAttribute("data-precedence"),d=i.get(b)||s,d===s&&i.set(null,u),i.set(b,u),this.count++,s=Do.bind(this),u.addEventListener("load",s),u.addEventListener("error",s),d?d.parentNode.insertBefore(u,d.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(u,e.firstChild)),t.state.loading|=4}}var ts={$$typeof:R,Provider:null,Consumer:null,_currentValue:W,_currentValue2:W,_threadCount:0};function bx(e,t,i,s,u,d,b,C,L){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=Nr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Nr(0),this.hiddenUpdates=Nr(null),this.identifierPrefix=s,this.onUncaughtError=u,this.onCaughtError=d,this.onRecoverableError=b,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=L,this.incompleteTransitions=new Map}function Op(e,t,i,s,u,d,b,C,L,F,X,ee){return e=new bx(e,t,i,b,L,F,X,ee,C),t=1,d===!0&&(t|=24),d=Gt(3,null,null,t),e.current=d,d.stateNode=e,t=fc(),t.refCount++,e.pooledCache=t,t.refCount++,d.memoizedState={element:s,isDehydrated:i,cache:t},gc(d),e}function Dp(e){return e?(e=Ta,e):Ta}function zp(e,t,i,s,u,d){u=Dp(u),s.context===null?s.context=u:s.pendingContext=u,s=ui(t),s.payload={element:i},d=d===void 0?null:d,d!==null&&(s.callback=d),i=di(e,s,t),i!==null&&(Ut(i,e,t),jl(i,e,t))}function Hp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<t?i:t}}function Ou(e,t){Hp(e,t),(e=e.alternate)&&Hp(e,t)}function Bp(e){if(e.tag===13||e.tag===31){var t=Ki(e,67108864);t!==null&&Ut(t,e,67108864),Ou(e,67108864)}}function Up(e){if(e.tag===13||e.tag===31){var t=qt();t=kr(t);var i=Ki(e,t);i!==null&&Ut(i,e,t),Ou(e,t)}}var Bo=!0;function yx(e,t,i,s){var u=A.T;A.T=null;var d=G.p;try{G.p=2,Du(e,t,i,s)}finally{G.p=d,A.T=u}}function vx(e,t,i,s){var u=A.T;A.T=null;var d=G.p;try{G.p=8,Du(e,t,i,s)}finally{G.p=d,A.T=u}}function Du(e,t,i,s){if(Bo){var u=zu(s);if(u===null)wu(e,t,s,Uo,i),Ip(e,s);else if(wx(u,e,t,i,s))s.stopPropagation();else if(Ip(e,s),t&4&&-1<xx.indexOf(e)){for(;u!==null;){var d=ha(u);if(d!==null)switch(d.tag){case 3:if(d=d.stateNode,d.current.memoizedState.isDehydrated){var b=Ln(d.pendingLanes);if(b!==0){var C=d;for(C.pendingLanes|=2,C.entangledLanes|=2;b;){var L=1<<31-kt(b);C.entanglements[1]|=L,b&=~L}Tn(d),(Ke&6)===0&&(wo=ut()+500,Xl(0))}}break;case 31:case 13:C=Ki(d,2),C!==null&&Ut(C,d,2),Co(),Ou(d,2)}if(d=zu(s),d===null&&wu(e,t,s,Uo,i),d===u)break;u=d}u!==null&&s.stopPropagation()}else wu(e,t,s,null,i)}}function zu(e){return e=Br(e),Hu(e)}var Uo=null;function Hu(e){if(Uo=null,e=fa(e),e!==null){var t=c(e);if(t===null)e=null;else{var i=t.tag;if(i===13){if(e=h(t),e!==null)return e;e=null}else if(i===31){if(e=m(t),e!==null)return e;e=null}else if(i===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Uo=e,null}function Kp(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(Es()){case dl:return 2;case fl:return 8;case Di:case Ns:return 32;case hl:return 268435456;default:return 32}default:return 32}}var Bu=!1,Si=null,Ci=null,Ti=null,ns=new Map,is=new Map,Mi=[],xx="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 Ip(e,t){switch(e){case"focusin":case"focusout":Si=null;break;case"dragenter":case"dragleave":Ci=null;break;case"mouseover":case"mouseout":Ti=null;break;case"pointerover":case"pointerout":ns.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":is.delete(t.pointerId)}}function as(e,t,i,s,u,d){return e===null||e.nativeEvent!==d?(e={blockedOn:t,domEventName:i,eventSystemFlags:s,nativeEvent:d,targetContainers:[u]},t!==null&&(t=ha(t),t!==null&&Bp(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,u!==null&&t.indexOf(u)===-1&&t.push(u),e)}function wx(e,t,i,s,u){switch(t){case"focusin":return Si=as(Si,e,t,i,s,u),!0;case"dragenter":return Ci=as(Ci,e,t,i,s,u),!0;case"mouseover":return Ti=as(Ti,e,t,i,s,u),!0;case"pointerover":var d=u.pointerId;return ns.set(d,as(ns.get(d)||null,e,t,i,s,u)),!0;case"gotpointercapture":return d=u.pointerId,is.set(d,as(is.get(d)||null,e,t,i,s,u)),!0}return!1}function Fp(e){var t=fa(e.target);if(t!==null){var i=c(t);if(i!==null){if(t=i.tag,t===13){if(t=h(i),t!==null){e.blockedOn=t,tf(e.priority,function(){Up(i)});return}}else if(t===31){if(t=m(i),t!==null){e.blockedOn=t,tf(e.priority,function(){Up(i)});return}}else if(t===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ko(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var i=zu(e.nativeEvent);if(i===null){i=e.nativeEvent;var s=new i.constructor(i.type,i);Hr=s,i.target.dispatchEvent(s),Hr=null}else return t=ha(i),t!==null&&Bp(t),e.blockedOn=i,!1;t.shift()}return!0}function Gp(e,t,i){Ko(e)&&i.delete(t)}function Sx(){Bu=!1,Si!==null&&Ko(Si)&&(Si=null),Ci!==null&&Ko(Ci)&&(Ci=null),Ti!==null&&Ko(Ti)&&(Ti=null),ns.forEach(Gp),is.forEach(Gp)}function Io(e,t){e.blockedOn===t&&(e.blockedOn=null,Bu||(Bu=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,Sx)))}var Fo=null;function Yp(e){Fo!==e&&(Fo=e,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){Fo===e&&(Fo=null);for(var t=0;t<e.length;t+=3){var i=e[t],s=e[t+1],u=e[t+2];if(typeof s!="function"){if(Hu(s||i)===null)continue;break}var d=ha(i);d!==null&&(e.splice(t,3),t-=3,zc(d,{pending:!0,data:u,method:i.method,action:s},s,u))}}))}function qa(e){function t(L){return Io(L,e)}Si!==null&&Io(Si,e),Ci!==null&&Io(Ci,e),Ti!==null&&Io(Ti,e),ns.forEach(t),is.forEach(t);for(var i=0;i<Mi.length;i++){var s=Mi[i];s.blockedOn===e&&(s.blockedOn=null)}for(;0<Mi.length&&(i=Mi[0],i.blockedOn===null);)Fp(i),i.blockedOn===null&&Mi.shift();if(i=(e.ownerDocument||e).$$reactFormReplay,i!=null)for(s=0;s<i.length;s+=3){var u=i[s],d=i[s+1],b=u[jt]||null;if(typeof d=="function")b||Yp(i);else if(b){var C=null;if(d&&d.hasAttribute("formAction")){if(u=d,b=d[jt]||null)C=b.formAction;else if(Hu(u)!==null)continue}else C=b.action;typeof C=="function"?i[s+1]=C:(i.splice(s,3),s-=3),Yp(i)}}}function Pp(){function e(d){d.canIntercept&&d.info==="react-transition"&&d.intercept({handler:function(){return new Promise(function(b){return u=b})},focusReset:"manual",scroll:"manual"})}function t(){u!==null&&(u(),u=null),s||setTimeout(i,20)}function i(){if(!s&&!navigation.transition){var d=navigation.currentEntry;d&&d.url!=null&&navigation.navigate(d.url,{state:d.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var s=!1,u=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(i,100),function(){s=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),u!==null&&(u(),u=null)}}}function Uu(e){this._internalRoot=e}Go.prototype.render=Uu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var i=t.current,s=qt();zp(i,s,e,t,null,null)},Go.prototype.unmount=Uu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;zp(e.current,2,null,e,null,null),Co(),t[da]=null}};function Go(e){this._internalRoot=e}Go.prototype.unstable_scheduleHydration=function(e){if(e){var t=ef();e={blockedOn:null,target:e,priority:t};for(var i=0;i<Mi.length&&t!==0&&t<Mi[i].priority;i++);Mi.splice(i,0,e),i===0&&Fp(e)}};var Vp=n.version;if(Vp!=="19.2.8")throw Error(o(527,Vp,"19.2.8"));G.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=g(t),e=e!==null?y(e):null,e=e===null?null:e.stateNode,e};var Cx={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:A,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Yo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Yo.isDisabled&&Yo.supportsFiber)try{ti=Yo.inject(Cx),At=Yo}catch{}}return ss.createRoot=function(e,t){if(!r(e))throw Error(o(299));var i=!1,s="",u=Jh,d=em,b=tm;return t!=null&&(t.unstable_strictMode===!0&&(i=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onUncaughtError!==void 0&&(u=t.onUncaughtError),t.onCaughtError!==void 0&&(d=t.onCaughtError),t.onRecoverableError!==void 0&&(b=t.onRecoverableError)),t=Op(e,1,!1,null,null,i,s,null,u,d,b,Pp),e[da]=t.current,xu(e),new Uu(t)},ss.hydrateRoot=function(e,t,i){if(!r(e))throw Error(o(299));var s=!1,u="",d=Jh,b=em,C=tm,L=null;return i!=null&&(i.unstable_strictMode===!0&&(s=!0),i.identifierPrefix!==void 0&&(u=i.identifierPrefix),i.onUncaughtError!==void 0&&(d=i.onUncaughtError),i.onCaughtError!==void 0&&(b=i.onCaughtError),i.onRecoverableError!==void 0&&(C=i.onRecoverableError),i.formState!==void 0&&(L=i.formState)),t=Op(e,1,!0,t,i??null,s,u,L,d,b,C,Pp),t.context=Dp(null),i=t.current,s=qt(),s=kr(s),u=ui(s),u.callback=null,di(i,u,s),i=s,t.current.lanes=i,pl(t,i),Tn(t),e[da]=t.current,xu(e),new Go(t)},ss.version="19.2.8",ss}var Qp;function Ox(){if(Qp)return Iu.exports;Qp=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(n){console.error(n)}}return a(),Iu.exports=jx(),Iu.exports}var Dx=Ox();const zx=bb(Dx),Rt="/ws/client",vb={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",controlActive:"Full Control",viewerWithController:"Viewer (Active: {controllerId})",sharedControl:"Full control",sharedWindows:"{count} windows",modeLabel:"Input mode",controlHint:"Keys, paste and clicks go to the terminal",observerHint:"Watch only: input is held back, scrolling still works",thisWindow:"Window",claimControl:"Claim Control",claimControlTitle:"Claim terminal control",releaseControl:"Release",releaseControlTitle:"Switch to viewer mode",takeoverControl:"Takeover",takeoverControlTitle:"Take over control from {controllerId}",takeoverModalTitle:"Confirm Control Takeover",takeoverModalDesc:"Another client is controlling this terminal.",takeoverModalWarning:"Input focus will transfer to this window.",confirmTakeover:"Confirm Takeover"},statusBanner:{connecting:"Connecting to relay...",reconnectingDefault:"Connection lost. Reconnecting...",reconnectNow:"Reconnect Now",errorDefault:"Unable to connect to relay",disconnected:"Terminal disconnected"},update:{chip:"↑ herdr-remote {version}",chipCompact:"↑ {version}",chipRestart:"↻ restart for {version}",toast:"herdr-remote {version} is out for this workstation",toastRestart:"herdr-remote {version} is installed; restart it to apply",title:"herdr-remote update",running:"Running",installed:"Installed",latest:"Latest",restartPending:"{version} is installed but not running yet. Restart herdr-remote on the workstation:",stepTui:'On the workstation, open herdr-remote (the TUI), go to "Language & about" and press Enter on the update row.',stepCli:"Or run on the workstation:",restartNote:"Restarting reconnects this window after a few seconds.",ignore:"Skip this version",chipOutdated:"↑ update herdr-remote",toastOutdated:"{host} runs an old herdr-remote; please update it",thisHost:"this workstation",outdatedVersion:"too old to tell",outdated:"This workstation runs a herdr-remote too old to report its version or check for updates, and it lacks recent features and fixes. On the workstation, run:",windowsStop:"On Windows, first stop the running herdr-remote in PowerShell:"},herdrLaunch:{title:"Herdr is not running",body:"Herdr is not running on {host}. Start it on that workstation?",scope:"Only this paired workstation's own Herdr starts, as that workstation's user. No other machine is touched.",start:"Start Herdr",starting:"Starting Herdr on {host}…",failedTitle:"Herdr did not start",timeout:"The workstation did not answer within 30 seconds. Its herdr-remote may be too old to start Herdr from a browser.",thisHost:"this workstation"},onboarding:{title:"Pair with Herdr Remote",subtitle:"Connect your mobile or browser to your local terminal session",description:"Control Herdr sessions from any browser or phone.",firstTimeSetup:"First-time Setup",authRequired:"Authorization Required",authRequiredDesc:"Pair your device or provide a valid access token.",step1Title:"Generate Pairing Code on Host",step1Desc:"Run on the host running Herdr:",step1TuiNote:"Interactive TUI config:",step2Title:"Enter 6-character Pairing Code",step2Placeholder:"e.g. 7X9K2A",step2Note:"Pairing code expires in 10 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",addSubtitle:"A pairing code is all it takes",advancedTitle:"Advanced",advancedHint:"another relay, or a device token",pairAndConnect:"Pair & Connect",displayNameLabel:"Host Name",displayNamePlaceholder:"e.g. Workstation",credentialsRequired:"Enter a pairing code or device token.",pairCodeLabel:"Pairing Code",pairCodeNote:"(6-char code)",pairCodePlaceholder:"e.g. A2B3C4",pairCodeHelp:'Run "herdr-remote pair" on host.',repairNote:"(only to pair again)",editAdvancedHint:"relay, token, client ID",tokenLabel:"Access Token",tokenNote:"(Device secret)",tokenPlaceholder:"Device token...",wsUrlLabel:"Relay WebSocket Endpoint URL",wsUrlPlaceholder:"/ws/client",clientIdLabel:"Client Identifier",newIdButton:"New ID",autoReconnectLabel:"Auto-reconnect",saveAndConnect:"Save & Connect"},settings:{title:"Terminal Preferences",subtitle:"Interface, font, input and alerts",subtitleInstance:"Only for {name}",tabGeneral:"General",sectionInterface:"Interface",sectionFont:"Font",sectionInput:"Input",sectionAdmin:"Administration",toggleOn:"On",toggleOff:"Off",hostFontLabel:"Workstation font",adminEntry:"Relay dashboard",adminEntryHint:"Hosts, devices and traffic; needs the admin token",adminEntryOpen:"Open",tabVirtualKeys:"Virtual Keys",tabAgentKeymaps:"Agent Keys",fontFamilyLabel:"Monospace Font",fontSizeHint:"This window only",fontSizeLabel:"Terminal Text Size ({size}px)",predictiveEchoLabel:"Predictive Echo",predictiveEchoAuto:"Auto",predictiveEchoAlways:"Always On",predictiveEchoOff:"Off",predictiveEchoDesc:"Show typing before the echo returns on slow links",touchKeyToolbar:"Touch Key Toolbar",touchKeyToolbarDesc:"Modifier and arrow keys",touchHaptics:"Haptic Feedback",touchHapticsDesc:"Vibrate on key press",agentAlertsLabel:"Agent alerts",agentAlertBadge:"Title and icon badge",agentAlertBadgeDesc:"Count waiting and finished agents in the tab title",agentAlertVibrate:"Vibrate",agentAlertVibrateDesc:"When an agent waits or finishes (page on screen)",agentAlertSound:"Chime",agentAlertSoundDesc:"In the background; works after your next tap",agentAlertNotify:"System notification",agentAlertNotifyDesc:"In the background (HTTPS only)",languageLabel:"Language",languageHint:"Shared by every instance",resetDefaults:"Reset to Defaults",resetDefaultsToast:"Settings reset to defaults",fontSizeFollowHost:"Same size as the workstation terminal ({size}px)",fontSizeFollowHostUnknown:"Same size as the workstation terminal (not reported)",hostFontSync:"Sync host font",hostGlyphLine:"CJK: {family} · {status}",hostGlyphStatus:{none:"",checking:"Checking…",installed:"Installed on this device",available:"Not loaded",declined:"Not loaded — using this device’s fonts",loading:"Loading common characters",ready:"{count} characters on this device; others load as they appear",failed:"Could not be loaded"},hostFontStatus:{none:"The workstation did not report its terminal font",checking:"Checking…",installed:"Installed on this device",loaded:"Loaded from the workstation",available:"Not loaded",declined:"Not loaded — using this device’s fonts",loading:"Loading {percent}%",failed:"Could not be loaded",unavailable:"No font file to load; drawn by name where installed"}},agentKeymaps:{keymapLabel:"Keymap",auto:"Auto",shell:"Shell",agentGroup:"Agent",listGroup:"{profile} shortcuts",genericGroup:"General",profileRowLabel:"Agent to edit",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); 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",terminalControlAria:"Terminal control",inputControl:"Input control",settingsAria:"Terminal settings",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",newAdminTerminal:"Open an administrator PowerShell tab in Herdr",adminShort:"Admin",adminTerminalSetup:"On the Windows host, open the herdr-remote TUI, go to Keep-alive, and choose Set up admin terminal access. Approve the one-time Windows prompt under the same account as Herdr Remote.",adminTerminalUpdate:"Update the relay and Windows host connector before opening an administrator terminal."},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:{returnToTerminal:"Return to Terminal",terminalShells:"terminal sessions",startedAt:"Started at {time}",acrossWindows:"across {count} windows",perSecond:"{value}/s",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})",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",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",remoteRelayNotice:"Connected to remote relay. For server metrics, access the operator dashboard.",remoteRelayEndpoint:"Remote WebSocket Endpoint:",remoteRelayAdminUrl:"Remote Admin URL:",openRemoteAdminBtn:"Open Remote Admin",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",relJustNow:"just now",relMinutes:"{count}m ago",relHours:"{count}h ago",relDays:"{count}d ago",statInbound:"Inbound",statOutbound:"Outbound",statTotal:"{value} total",hostsOfflineSub:"{count} more offline",colHost:"Host",colStatus:"Status",deviceWindows:"{count} windows open",hostPtys:"{count} PTY",hostVersion:"herdr-remote {version}",hostVersionBehind:"herdr-remote {version} → {latest}",hostVersionUnknown:"herdr-remote too old",relayAdminPrompt:"Enter RELAY_ADMIN_TOKEN to see this relay's hosts, devices and traffic."},toasts:{connected:"Connected to relay",connectionError:"Connection error",controlGranted:"Control granted",pairedSuccess:"Paired successfully",sessionEnded:"Session ended",controlReleased:"Control released",viewerModeWarning:"This window is in viewer mode. Switch to Full control to type.",clientIdCopied:"Client ID copied: {id}",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.",admin_broker_unavailable:"The administrator terminal broker is not running. On the Windows host, open the herdr-remote TUI, go to Keep-alive, and choose Set up admin terminal access, then tap Admin again.",admin_terminal_unsupported:"This relay or Windows host connector cannot open administrator terminals. Upgrade both, then try again.",admin_tab_failed:"Could not open the administrator tab in Herdr. The host connector log has the details."},fontPresets:{host:"Workstation font (default)",system:"System monospace"},hostFont:{title:"Workstation terminal font",body:"The terminal on {host} uses {family}{detail}. This device does not have it.",bodyGlyphsOnly:"The terminal on {host} draws Chinese with {family}. This device does not have it.",glyphs:"Chinese in {family}: about 2 MB of common characters first; any other character loads the first time it appears.",glyphsAll:"{family} is too large to send whole: about 2 MB of common characters first; any other character loads the first time it appears.",detail:" ({detail})",detailSeparator:", ",download:"Load {count} font file(s), {size} in total. Downloaded once, then kept in this browser.",load:"Load font",decline:"Use this device’s fonts",loading:"Loading {received} of {total}",failed:"The font could not be loaded: {reason}",loaded:"Workstation font loaded",reasons:{host_font_unavailable:"the font changed on the workstation. Sync it again from Settings",host_font_timeout:"the workstation stopped answering",disconnected:"the connection dropped",font_api_unavailable:"this browser cannot load fonts",other:"the browser could not read the font file"}},agents:{title:"Agents on this workstation",blocked:"blocked",done:"done",working:"working",allIdle:"agents idle",notifyBlocked:"{count} agent(s) waiting for you",notifyDone:"{count} agent(s) finished"},clipboard:{openLink:"Open Link",openLinkFailed:"This link cannot be opened from the browser",copySelection:"Copy Selection",copyLine:"Copy Line",copyScreen:"Copy Screen",paste:"Paste",cancel:"Cancel",copied:"Copied to clipboard",copyFailed:"Failed to copy",pasteHint:"Long-press here to paste, then tap Send",pasteSend:"Send",pasteUnavailable:"Clipboard is empty or unavailable",pasteTitle:"Paste Content",pasted:"Pasted",chooseImage:"Choose Image",takePhoto:"Take Photo",imageTooLarge:"Image exceeds 3 MB limit and cannot be compressed further.",imageCompressedSize:"Compressed: {size}",fileEmpty:"File is empty.",decodeFailed:"Failed to decode image file.",unsupportedType:"Unsupported format. Only PNG, JPEG, WebP, and GIF are supported.",imageSectionTitle:"Image",textSectionTitle:"Text",imageCompressing:"Processing image...",removeImage:"Remove image"}},Hx={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:"控制模式",controlActive:"控制端",viewerWithController:"观察者(控制者: {controllerId})",sharedControl:"完全控制",sharedWindows:"{count} 个窗口",modeLabel:"输入模式",controlHint:"按键、粘贴和点击都会发送到终端",observerHint:"只看不动:输入被拦下,仍可滚动",thisWindow:"本窗口",claimControl:"获取控制权",claimControlTitle:"获取终端控制权",releaseControl:"释放控制权",releaseControlTitle:"切回观察者模式",takeoverControl:"强占控制权",takeoverControlTitle:"从 {controllerId} 接管控制权",takeoverModalTitle:"确认接管终端控制权?",takeoverModalDesc:"当前已有其他客户端控制该终端。",takeoverModalWarning:"接管后输入焦点切换至当前窗口。",confirmTakeover:"确认接管"},statusBanner:{connecting:"连接 Relay 服务中...",reconnectingDefault:"连接断开,正在重连...",reconnectNow:"立即重连",errorDefault:"无法连接 Relay 服务",disconnected:"会话已断开"},update:{chip:"↑ herdr-remote {version}",chipCompact:"↑ {version}",chipRestart:"↻ 重启以应用 {version}",toast:"宿主机的 herdr-remote 有新版本 {version}",toastRestart:"herdr-remote {version} 已安装,重启后生效",title:"herdr-remote 更新",running:"正在运行",installed:"已安装",latest:"最新版本",restartPending:"{version} 已安装但尚未运行。在宿主机上重启 herdr-remote:",stepTui:"在宿主机打开 herdr-remote(TUI),进入「语言与关于」,在更新一行按 Enter。",stepCli:"或在宿主机上执行:",restartNote:"重启后这个窗口会在几秒内自动重连。",ignore:"忽略此版本",chipOutdated:"↑ 升级 herdr-remote",toastOutdated:"{host} 的 herdr-remote 版本过旧,请升级",thisHost:"这台宿主机",outdatedVersion:"过旧,无法获知版本",outdated:"这台宿主机的 herdr-remote 太旧,不会报告版本,也不会检查更新,还缺少近期的功能和修复。在宿主机上执行:",windowsStop:"Windows 上先在 PowerShell 里结束正在运行的 herdr-remote:"},herdrLaunch:{title:"Herdr 未运行",body:"{host} 上没有正在运行的 Herdr。要在这台宿主机上启动吗?",scope:"只会以这台已配对宿主机自己的用户身份,启动它自己的 Herdr,不会碰其他任何机器。",start:"启动 Herdr",starting:"正在 {host} 上启动 Herdr…",failedTitle:"Herdr 没有启动",timeout:"宿主机 30 秒内没有回应。它的 herdr-remote 可能版本过旧,不支持从浏览器启动 Herdr。",thisHost:"这台宿主机"},onboarding:{title:"配对 Herdr Remote",subtitle:"连接手机或浏览器至本地终端会话",description:"在浏览器或移动设备中控制 Herdr 会话。",firstTimeSetup:"首次配对",authRequired:"需要认证",authRequiredDesc:"使用配对码配对设备,或提供有效访问令牌。",step1Title:"在 Herdr 宿主机生成配对码",step1Desc:"在运行 Herdr 的主机终端执行:",step1TuiNote:"交互式 TUI 配置:",step2Title:"输入 6 位配对码",step2Placeholder:"例如:7X9K2A",step2Note:"配对码 10 分钟内有效,连接后自动保存凭据。",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 实例",addSubtitle:"只需输入配对码",advancedTitle:"高级选项",advancedHint:"其他 Relay 或已有设备 Token",pairAndConnect:"配对并连接",displayNameLabel:"主机名称",displayNamePlaceholder:"例如:工作电脑",credentialsRequired:"请输入配对码或设备令牌。",pairCodeLabel:"配对码",pairCodeNote:"(6 位代码)",pairCodePlaceholder:"例如:A2B3C4",pairCodeHelp:'在主机运行 "herdr-remote pair" 获取。',repairNote:"(重新配对时填写)",editAdvancedHint:"Relay 端点、Token、客户端 ID",tokenLabel:"访问 Token",tokenNote:"(设备凭据)",tokenPlaceholder:"设备 Token...",wsUrlLabel:"Relay WebSocket 端点",wsUrlPlaceholder:"/ws/client",clientIdLabel:"客户端标识",newIdButton:"生成新 ID",autoReconnectLabel:"掉线自动重连",saveAndConnect:"保存并连接"},settings:{title:"终端设置",subtitle:"界面、字体、输入与提醒",subtitleInstance:"仅对 {name} 生效",tabGeneral:"通用",sectionInterface:"界面",sectionFont:"字体",sectionInput:"输入",sectionAdmin:"管理",toggleOn:"开",toggleOff:"关",hostFontLabel:"宿主机字体",adminEntry:"Relay 管理面板",adminEntryHint:"主机、设备与流量;需要管理员令牌",adminEntryOpen:"打开",tabVirtualKeys:"虚拟按键",tabAgentKeymaps:"智能体按键",fontFamilyLabel:"等宽字体",fontSizeHint:"只影响当前窗口",fontSizeLabel:"终端字号 ({size}px)",predictiveEchoLabel:"预测回显",predictiveEchoAuto:"自动",predictiveEchoAlways:"始终开启",predictiveEchoOff:"关闭",predictiveEchoDesc:"高延迟时先显示输入,回显到达后校正",touchKeyToolbar:"底部触控按键条",touchKeyToolbarDesc:"修饰键与方向键",touchHaptics:"触控振动反馈",touchHapticsDesc:"按键时轻微震动",agentAlertsLabel:"智能体提醒",agentAlertBadge:"标题与图标角标",agentAlertBadgeDesc:"标签页标题显示等待与完成数",agentAlertVibrate:"震动",agentAlertVibrateDesc:"等待确认或完成时(页面在前台)",agentAlertSound:"提示音",agentAlertSoundDesc:"页面在后台时播放,下次点击后生效",agentAlertNotify:"系统通知",agentAlertNotifyDesc:"页面在后台时通知(仅 HTTPS)",languageLabel:"显示语言",languageHint:"所有实例共用",resetDefaults:"恢复默认设置",resetDefaultsToast:"设置已恢复默认",fontSizeFollowHost:"与宿主机终端同字号({size}px)",fontSizeFollowHostUnknown:"与宿主机终端同字号(宿主机未报告)",hostFontSync:"同步宿主机字体",hostGlyphLine:"中文:{family} · {status}",hostGlyphStatus:{none:"",checking:"检查中…",installed:"本机已安装",available:"未加载",declined:"未加载,正在使用本机字体",loading:"正在加载常用字",ready:"本机已有 {count} 字,其余出现时自动补齐",failed:"加载失败"},hostFontStatus:{none:"宿主机未报告终端字体",checking:"检查中…",installed:"本机已安装",loaded:"已从宿主机加载",available:"未加载",declined:"未加载,正在使用本机字体",loading:"加载中 {percent}%",failed:"加载失败",unavailable:"没有可传输的字体文件,已安装该字体的设备按名称显示"}},agentKeymaps:{keymapLabel:"按键方案",auto:"自动",shell:"Shell",agentGroup:"智能体",listGroup:"{profile} 快捷键",genericGroup:"通用",profileRowLabel:"编辑的智能体",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:"关闭会话控制面板",terminalControlAria:"终端控制权",inputControl:"输入控制权",settingsAria:"终端设置",pairingAria:"连接与配对设置",keybarAria:"切换触控按键条",quickInputAria:"切换快捷命令",menu:"菜单",statusBarAria:"会话状态栏"},terminal:{bannerTitle:"Herdr Remote WebUI",bannerSubtitle:"已连接至 Herdr 会话。",windowAriaLabel:"远程终端窗口",bufferAriaLabel:"xterm 终端缓冲区",offlineStatusAria:"离线状态",releaseControlAria:"释放终端控制权",takeoverControlAria:"强占终端控制权",claimControlAria:"获取终端控制权",newAdminTerminal:"在 Herdr 中新建管理员 PowerShell 标签页",adminShort:"管理员",adminTerminalSetup:"请在 Windows 主机打开 herdr-remote TUI,进入「保活」并选择「设置管理员终端」,再使用运行 Herdr Remote 的同一账户批准一次 Windows 提权提示。",adminTerminalUpdate:"请先升级 relay 和 Windows 主机连接器,再新建管理员终端。"},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:{returnToTerminal:"返回终端",terminalShells:"终端会话",startedAt:"启动于 {time}",acrossWindows:"共 {count} 个窗口",perSecond:"{value}/秒",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})",hostsTitle:"主机 ({count})",noHosts:"暂无接入或配对的主机",hostConnectedDevices:"{count} 台在线",hostPairedDevices:"{count} 台已配对",hostStatusOnline:"在线",hostStatusBusy:"使用中",hostStatusReconnecting:"重连中",hostStatusOffline:"离线",hostRosterOperatorOnly:"设备清单仅 Relay 操作员可见。",connectedClientsTitle:"已连接客户端 ({count})",noClients:"当前暂无客户端连接",colClientId:"客户端 ID",colDevice:"设备",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 服务管理",remoteRelayNotice:"当前连接至远程独立 Relay 服务。如需查看服务端指标,请使用操作员后台。",remoteRelayEndpoint:"远程端点:",remoteRelayAdminUrl:"远程后台地址:",openRemoteAdminBtn:"前往远程管理后台",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:"返回终端",relJustNow:"刚刚",relMinutes:"{count} 分钟前",relHours:"{count} 小时前",relDays:"{count} 天前",statInbound:"入站流量",statOutbound:"出站流量",statTotal:"累计 {value}",hostsOfflineSub:"另有 {count} 台离线",colHost:"主机",colStatus:"状态",deviceWindows:"{count} 个窗口在线",hostPtys:"PTY {count}",hostVersion:"herdr-remote {version}",hostVersionBehind:"herdr-remote {version} → {latest}",hostVersionUnknown:"herdr-remote 过旧",relayAdminPrompt:"输入 RELAY_ADMIN_TOKEN,查看本 Relay 的主机、设备与流量。"},toasts:{connected:"已连接至 Relay 服务",connectionError:"连接发生错误",controlGranted:"已获得控制权",pairedSuccess:"设备配对成功,已保存凭证",sessionEnded:"终端会话已结束",controlReleased:"已释放控制权,切回观察者模式",viewerModeWarning:"本窗口处于观察者模式,切到「完全控制」才能输入",clientIdCopied:"客户端 ID 已复制: {id}",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:"终端会话未准备就绪。",admin_broker_unavailable:"管理员终端 broker 尚未运行。请在 Windows 主机打开 herdr-remote TUI,进入「保活」并选择「设置管理员终端」,然后再点一次「管理员」。",admin_terminal_unsupported:"当前 relay 或 Windows 主机连接器不支持管理员终端。请升级两端后再试。",admin_tab_failed:"无法在 Herdr 中打开管理员标签页,详情见主机连接器日志。"},fontPresets:{host:"宿主机终端字体(默认)",system:"系统等宽字体"},hostFont:{title:"宿主机终端字体",body:"{host} 的终端使用 {family}{detail}。这台设备没有安装该字体。",bodyGlyphsOnly:"{host} 的终端显示中文用 {family},这台设备没有安装该字体。",glyphs:"中文使用 {family}:先下载常用字约 2 MB,其余的字第一次出现时再补。",glyphsAll:"{family} 太大,不整包传输:先下载常用字符约 2 MB,其余字符第一次出现时再补。",detail:"({detail})",detailSeparator:",",download:"加载 {count} 个字体文件,共 {size}。只下载一次,之后保存在本浏览器。",load:"加载字体",decline:"使用本机字体",loading:"正在加载 {received} / {total}",failed:"字体加载失败:{reason}",loaded:"宿主机字体已加载",reasons:{host_font_unavailable:"宿主机上的字体已变化,请在设置里重新同步",host_font_timeout:"宿主机没有响应",disconnected:"连接已断开",font_api_unavailable:"此浏览器不支持加载字体",other:"浏览器无法解析该字体文件"}},agents:{title:"本工作站的智能体",blocked:"待确认",done:"已完成",working:"运行中",allIdle:"智能体空闲",notifyBlocked:"{count} 个智能体在等你确认",notifyDone:"{count} 个智能体已完成"},clipboard:{openLink:"打开链接",openLinkFailed:"该链接无法在浏览器中打开",copySelection:"复制选中",copyLine:"复制本行",copyScreen:"复制整屏",paste:"粘贴",cancel:"取消",copied:"已复制到剪贴板",copyFailed:"复制失败",pasteHint:"长按此处粘贴,然后按发送",pasteSend:"发送",pasteUnavailable:"剪贴板为空或不可用",pasteTitle:"粘贴内容",pasted:"已粘贴",chooseImage:"选择图片",takePhoto:"拍照",imageTooLarge:"图片超过 3 MB 限制且无法进一步压缩。",imageCompressedSize:"压缩后大小:{size}",fileEmpty:"文件内容为空。",decodeFailed:"无法解析图片文件。",unsupportedType:"不支持的图片格式,仅支持 PNG、JPEG、WebP 和 GIF。",imageSectionTitle:"图片",textSectionTitle:"文本",imageCompressing:"正在处理图片...",removeImage:"移除图片"}},Yu={en:vb,zh:Hx};function Rd(a,n,l){const o=Yu[a]||Yu.en,r=n.split(".");let c=o;for(const h of r)if(c&&typeof c=="object"&&h in c)c=c[h];else{let m=Yu.en;for(const p of r)if(m&&typeof m=="object"&&p in m)m=m[p];else return n;c=m;break}if(typeof c!="string")return n;if(l){let h=c;for(const[m,p]of Object.entries(l))h=h.replaceAll(`{${m}}`,String(p));return h}return c}function Pu(a){return typeof a=="string"&&Object.hasOwn(vb.serverErrors,a)}const oe={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~"},Bx=new TextEncoder;function jd(a){return Bx.encode(a)}function Od(a){if(!a||a.length===0)return"";const l=a.toUpperCase().charCodeAt(0);return l>=65&&l<=90?String.fromCharCode(l-64):a==="@"||a===" "?"\0":a==="["?"\x1B":a==="\\"?"":a==="]"?"":a==="^"?"":a==="_"?"":a==="?"?"":a}function Ux(a){return`\x1B${a}`}function Jp({ctrl:a,alt:n,shift:l}){return 1+(l?1:0)+(n?2:0)+(a?4:0)}const xb=/^\x1b[[O]([ABCDHF])$/,wb=/^\x1bO([PQRS])$/,Sb=/^\x1b\[(\d+)~$/;function ur(a,n){const{ctrl:l=!1,alt:o=!1,shift:r=!1}=n;if(!l&&!o&&!r)return a;const c=Jp(n),h=o&&!l&&!r,m=xb.exec(a);if(m)return`\x1B[1;${c}${m[1]}`;const p=wb.exec(a);if(p)return`\x1B[1;${c}${p[1]}`;const g=Sb.exec(a);if(g)return`\x1B[${g[1]};${c}~`;switch(a){case oe.TAB:return r&&!l&&!o?oe.SHIFT_TAB:h?`\x1B${a}`:`\x1B[9;${c}u`;case oe.SHIFT_TAB:return!l&&!o?a:`\x1B[9;${Jp({...n,shift:!0})}u`;case oe.ENTER:return h?`\x1B${a}`:`\x1B[13;${c}u`;case oe.BACKSPACE:return l&&!o&&!r?"\b":h?`\x1B${a}`:`\x1B[127;${c}u`;case oe.ESC:return h?`\x1B${a}`:`\x1B[27;${c}u`}let y=a;return r&&a.length===1&&!l&&(y=a.toUpperCase()),l&&(y=Od(y)),o&&(y=Ux(y)),y}function Kx(a){return[...a].length===1?!0:xb.test(a)||wb.test(a)||Sb.test(a)||a===oe.SHIFT_TAB}class pn extends Error{constructor(l,o={}){super(l);$(this,"code");$(this,"params");this.name="KeyComboError",this.code=l,this.params=o}}const Ix={escape:"esc",return:"enter",pgup:"pageup",pgdn:"pagedown",backslash:"\\",plus:"+"},eg={esc:oe.ESC,tab:oe.TAB,enter:oe.ENTER,backspace:oe.BACKSPACE,delete:oe.DELETE,left:oe.LEFT,right:oe.RIGHT,up:oe.UP,down:oe.DOWN,home:oe.HOME,end:oe.END,pageup:oe.PAGE_UP,pagedown:oe.PAGE_DOWN,insert:oe.INSERT,space:" ","+":"+"},Fx={esc:"ESC",tab:"TAB",enter:"⏎",backspace:"⌫",delete:"DEL",left:"←",right:"→",up:"↑",down:"↓",home:"HOME",end:"END",pageup:"PGUP",pagedown:"PGDN",insert:"INS",space:"SPACE","+":"+"},Gx={2:"²",3:"³",4:"⁴",5:"⁵",6:"⁶",7:"⁷",8:"⁸",9:"⁹"};function Cb(a,n){const l=a.toLowerCase().split("+");if(l.some(p=>!p))throw new pn("invalidStepSyntax",{step:n+1});const o={};let r;for(const p of l)if(p==="ctrl"||p==="control"){if(o.ctrl)throw new pn("duplicateModifier",{step:n+1,modifier:"Ctrl"});o.ctrl=!0}else if(p==="alt"||p==="option"){if(o.alt)throw new pn("duplicateModifier",{step:n+1,modifier:"Alt"});o.alt=!0}else if(p==="shift"){if(o.shift)throw new pn("duplicateModifier",{step:n+1,modifier:"Shift"});o.shift=!0}else if(r===void 0)r=p;else throw new pn("multipleKeys",{step:n+1});if(!r)throw new pn("missingKey",{step:n+1});const c=Ix[r]||r,h=/^f(?:[1-9]|1[0-2])$/.exec(c);let m;if(h)m=oe[c.toUpperCase()];else if(Object.hasOwn(eg,c))m=eg[c];else if([...c].length===1&&/^[\x21-\x7e]$/.test(c))m=c;else throw new pn("unsupportedKey",{step:n+1,key:c});return{key:m,keyName:c,modifiers:o,sequence:Px(m,c,o)}}function Yx(a){return 1+(a.shift?1:0)+(a.alt?2:0)+(a.ctrl?4:0)}function tg(a,n){const l=[...a][0].codePointAt(0);return l===void 0?"":`\x1B[${l};${Yx(n)}u`}function Px(a,n,l){if(!l.ctrl)return ur(a,l);if(n.length===1&&/^[\x20-\x7e]$/.test(n)){const o=n.toLowerCase();if(l.alt||l.shift||o==="m"||o==="i")return tg(o,l);if(o==="-"||o==="/"||o==="_")return"";const r=Od(o);return r!==o?r:tg(o,l)}return ur(a,l)}function gn(a){if(typeof a!="string"||!a.trim())throw new pn("empty");const n=a.trim().split(/\s+/);if(n.length>8)throw new pn("tooManySteps",{count:8});return n.map((l,o)=>Cb(l,o).sequence)}function ds(a){const n=a.trim().split(/\s+/);return n.length>1&&n.every(l=>["esc","escape"].includes(l.toLowerCase()))?`ESC${Gx[n.length]||` ×${n.length}`}`:n.map((l,o)=>{const{keyName:r,modifiers:c}=Cb(l,o),h=Fx[r]||(/^f\d+$/.test(r),r.toUpperCase());return c.ctrl&&c.alt&&c.shift?`Ctrl+Alt+⇧${h}`:c.ctrl&&c.alt?`Ctrl+Alt+${h}`:c.ctrl&&c.shift?`^⇧${h}`:c.ctrl?`^${h}`:c.alt&&c.shift?`Alt+⇧${h}`:c.alt?`Alt+${h}`:c.shift?`⇧${h}`:h}).join(" ")}const B=(a,n,l,o=!0)=>({id:a,labelKey:n,combo:l,verified:o}),Tb={claude:{id:"claude",name:"Claude Code",shortName:"Claude",configHint:"~/.claude/keybindings.json",bar:["mode","rewind","details","model"],actions:[B("mode","mode","shift+tab"),B("rewind","rewind","esc esc"),B("details","details","ctrl+o"),B("model","model","alt+p"),B("thinking","thinking","alt+t"),B("todos","todos","ctrl+t"),B("background","background","ctrl+b"),B("editor","editor","ctrl+g"),B("history","history","ctrl+r"),B("stash","stash","ctrl+s"),B("pasteImage","pasteImage","ctrl+v"),B("newline","newline","ctrl+j"),B("interrupt","interrupt","esc")]},codex:{id:"codex",name:"Codex",shortName:"Codex",configHint:"~/.codex/config.toml [tui.keymap]",bar:["mode","editPrevious","details"],actions:[B("mode","mode","shift+tab"),B("editPrevious","editPrevious","esc esc"),B("details","details","ctrl+t"),B("queue","queue","tab"),B("history","history","ctrl+r"),B("copy","copy","ctrl+o"),B("editor","editor","ctrl+g"),B("newline","newline","ctrl+j"),B("clear","clear","ctrl+l"),B("interrupt","interrupt","esc")]},gemini:{id:"gemini",name:"Gemini CLI",shortName:"Gemini",configHint:"~/.gemini/keybindings.json",bar:["mode","yolo","rewind"],actions:[B("mode","mode","shift+tab"),B("yolo","yolo","ctrl+y"),B("rewind","rewind","esc esc"),B("todos","todos","ctrl+t"),B("expand","expand","ctrl+o"),B("background","background","ctrl+b"),B("editor","editor","ctrl+g"),B("history","history","ctrl+r"),B("undo","undo","ctrl+z"),B("newline","newline","ctrl+j"),B("interrupt","interrupt","esc")]},qwen:{id:"qwen",name:"Qwen Code",shortName:"Qwen",bar:["mode","history"],actions:[B("mode","mode","shift+tab"),B("interrupt","interrupt","esc"),B("history","history","ctrl+r"),B("newline","newline","ctrl+j"),B("todos","todos","ctrl+t",!1),B("rewind","rewind","esc esc",!1)]},opencode:{id:"opencode",name:"OpenCode",shortName:"OpenCode",configHint:"tui.json keybinds",bar:["palette","model","sessions"],actions:[B("agent","agent","tab"),B("agentBack","agentBack","shift+tab"),B("interrupt","interrupt","esc"),B("palette","palette","ctrl+p"),B("model","model","ctrl+x m"),B("recentModel","recentModel","f2"),B("variant","variant","ctrl+t"),B("newSession","newSession","ctrl+x n"),B("sessions","sessions","ctrl+x l"),B("undo","undo","ctrl+x u"),B("editor","editor","ctrl+x e"),B("newline","newline","ctrl+j")]},kilo:{id:"kilo",name:"Kilo Code",shortName:"Kilo",configHint:"~/.config/kilo/tui.jsonc",bar:["palette","model","sessions"],actions:[B("agent","agent","tab",!1),B("agentBack","agentBack","shift+tab",!1),B("interrupt","interrupt","esc"),B("palette","palette","ctrl+p"),B("model","model","ctrl+x m"),B("recentModel","recentModel","f2"),B("variant","variant","ctrl+t"),B("newSession","newSession","ctrl+x n"),B("sessions","sessions","ctrl+x l"),B("undo","undo","ctrl+x u"),B("editor","editor","ctrl+x e"),B("newline","newline","ctrl+j")]},pi:{id:"pi",name:"Pi",shortName:"Pi",configHint:"~/.pi/agent/keybindings.json",bar:["thinkingMode","modelPicker","tools"],actions:[B("thinkingMode","thinkingMode","shift+tab"),B("interrupt","interrupt","esc"),B("nextModel","nextModel","ctrl+p"),B("modelPicker","modelPicker","ctrl+l"),B("tools","tools","ctrl+o"),B("thinkingBlocks","thinkingBlocks","ctrl+t"),B("editor","editor","ctrl+g"),B("followup","followup","alt+enter"),B("dequeue","dequeue","alt+up"),B("newline","newline","shift+enter")]},omp:{id:"omp",name:"Oh My Pi",shortName:"OMP",configHint:"~/.omp/agent/keybindings.yml",bar:["thinkingMode","plan","model"],actions:[B("thinkingMode","thinkingMode","shift+tab"),B("plan","plan","alt+shift+p"),B("model","model","alt+m"),B("temporaryModel","temporaryModel","alt+p"),B("nextModel","nextModel","ctrl+p"),B("tools","tools","ctrl+o"),B("thinking","thinking","ctrl+t"),B("history","history","ctrl+r"),B("editor","editor","ctrl+g"),B("followup","followup","ctrl+enter"),B("interrupt","interrupt","esc")]},copilot:{id:"copilot",name:"GitHub Copilot",shortName:"Copilot",bar:["mode","expand","reasoning"],actions:[B("mode","mode","shift+tab"),B("interrupt","interrupt","esc"),B("expand","expand","ctrl+o"),B("expandAll","expandAll","ctrl+e"),B("reasoning","reasoning","ctrl+t"),B("editor","editor","ctrl+g"),B("clear","clear","ctrl+l")]},cursor:{id:"cursor",name:"Cursor",shortName:"Cursor",bar:["mode","review"],actions:[B("mode","mode","shift+tab"),B("review","review","ctrl+r"),B("newline","newline","ctrl+j"),B("interrupt","interrupt","esc",!1)]},droid:{id:"droid",name:"Factory Droid",shortName:"Droid",configHint:"In-app settings",bar:["specMode","autonomy"],actions:[B("specMode","specMode","shift+tab"),B("autonomy","autonomy","ctrl+l"),B("details","details","ctrl+o",!1),B("queue","queue","ctrl+enter"),B("interrupt","interrupt","esc",!1)]},kimi:{id:"kimi",name:"Kimi Code",shortName:"Kimi",bar:["plan","undoPicker","expand"],actions:[B("plan","plan","shift+tab"),B("interrupt","interrupt","esc"),B("undoPicker","undoPicker","esc esc"),B("expand","expand","ctrl+o"),B("editor","editor","ctrl+g"),B("steer","steer","ctrl+s"),B("undo","undo","ctrl+-"),B("newline","newline","ctrl+j"),B("pasteImage","pasteImage","ctrl+v")]},amp:{id:"amp",name:"Amp",shortName:"Amp",bar:["palette","reasoning","mode"],actions:[B("palette","palette","ctrl+o"),B("reasoning","reasoning","alt+d"),B("mode","mode","ctrl+s",!1),B("editor","editor","ctrl+g"),B("history","history","ctrl+r"),B("sidebar","sidebar","ctrl+backslash"),B("pasteImage","pasteImage","ctrl+v"),B("interrupt","interrupt","esc",!1)]},hermes:{id:"hermes",name:"Hermes",shortName:"Hermes",bar:["interrupt","agents","sessions"],actions:[B("interrupt","interrupt","ctrl+c"),B("newline","newline","ctrl+j"),B("editor","editor","ctrl+g"),B("agents","agents","ctrl+t"),B("sessions","sessions","ctrl+x")]},qodercli:{id:"qodercli",name:"Qoder CLI",shortName:"Qoder",configHint:"/shortcuts in-app",bar:["permissionMode","bypass","tasks","interrupt"],actions:[B("permissionMode","permissionMode","shift+tab"),B("bypass","bypass","ctrl+y"),B("tasks","tasks","ctrl+t"),B("editor","editor","ctrl+x"),B("history","history","ctrl+r"),B("queue","queue","ctrl+enter"),B("newline","newline","ctrl+j"),B("pasteImage","pasteImage","alt+v"),B("interrupt","interrupt","ctrl+c")]},devin:{id:"devin",name:"Devin",shortName:"Devin",configHint:"~/.config/devin/config.json keymap",bar:["mode","thinking","interrupt"],actions:[B("mode","mode","shift+tab"),B("interrupt","interrupt","ctrl+c"),B("thinking","thinking","alt+t"),B("newline","newline","ctrl+j"),B("pasteImage","pasteImage","ctrl+v")]},grok:{id:"grok",name:"Grok CLI",shortName:"Grok",bar:["mode","rewind","interrupt"],actions:[B("mode","mode","shift+tab"),B("interrupt","interrupt","ctrl+c"),B("rewind","rewind","esc esc"),B("interject","interject","ctrl+enter"),B("multiline","multiline","ctrl+m"),B("newline","newline","alt+enter"),B("shortcuts","shortcuts","ctrl+.")]},agy:{id:"agy",name:"Antigravity",shortName:"Antigravity",configHint:"~/.gemini/antigravity-cli/keybindings.json",bar:["mode","approve","interrupt"],actions:[B("mode","mode","shift+tab"),B("interrupt","interrupt","ctrl+c"),B("background","background","ctrl+b"),B("approve","approve","ctrl+k"),B("clear","clear","esc esc")]},mastracode:{id:"mastracode",name:"MastraCode",shortName:"MastraCode",bar:["interrupt","thinking","expand"],actions:[B("interrupt","interrupt","ctrl+c"),B("thinking","thinking","ctrl+t"),B("expand","expand","ctrl+e"),B("followup","followup","ctrl+f")]},letta:{id:"letta",name:"Letta Code",shortName:"Letta",bar:["permissionMode"],actions:[B("permissionMode","permissionMode","shift+tab"),B("interrupt","interrupt","esc",!1)]},kiro:{id:"kiro",name:"Kiro CLI",shortName:"Kiro",configHint:"kiro-cli settings chat.keybindings.*",bar:["agentSwap","details","steer"],actions:[B("agentSwap","agentSwap","shift+tab"),B("interrupt","interrupt","esc"),B("details","details","ctrl+t"),B("steer","steer","ctrl+s"),B("expand","expand","ctrl+o"),B("activity","activity","ctrl+x"),B("newline","newline","ctrl+j")]},cline:{id:"cline",name:"Cline",shortName:"Cline",bar:["autoApprove"],actions:[B("planAct","planAct","tab"),B("autoApprove","autoApprove","shift+tab"),B("interrupt","interrupt","esc",!1)]},maki:{id:"maki",name:"Maki",shortName:"Maki",bar:["rewind","search"],actions:[B("rewind","rewind","esc esc"),B("search","search","ctrl+f"),B("interrupt","interrupt","esc",!1)]},muse:{id:"muse",name:"Muse",shortName:"Muse",configHint:"/keymap in-app",bar:["queue","interruptCtrl"],actions:[B("interrupt","interrupt","esc"),B("queue","queue","alt+enter"),B("interruptCtrl","interrupt","ctrl+c")]},shell:{id:"shell",name:"Shell",shortName:"Shell",actions:[]}},na=Tb,Vx=Object.keys(Tb),ng={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"};function $x(a){return a&&a.trim().toLowerCase().replace(/\\/g,"/").split("/").at(-1)||""}function ig(a){const n=$x(a);return ng[n]?ng[n]:/^muse-bin-\d/.test(n)?"muse":null}function qx(a,n="auto"){return n&&n!=="auto"?ig(n)||"shell":ig(a)||"shell"}const gs=[B("genericCtrlC","interrupt","ctrl+c"),B("genericCtrlD","eof","ctrl+d"),B("genericCtrlZ","suspend","ctrl+z"),B("genericCtrlL","clear","ctrl+l"),B("genericCtrlR","history","ctrl+r"),B("genericCtrlA","startOfLine","ctrl+a"),B("genericCtrlE","endOfLine","ctrl+e"),B("genericCtrlK","killToEnd","ctrl+k")],ag=["genericCtrlC","genericCtrlD","genericCtrlL","genericCtrlR"],Xx=["genericCtrlC"],Zx=gs.filter(({id:a})=>a!=="genericCtrlD"&&a!=="genericCtrlZ"),Wx=gs.filter(({id:a})=>a==="genericCtrlC"||a==="genericCtrlZ").map(a=>a.id==="genericCtrlZ"?{...a,labelKey:"eof"}:a),Qx={posix:gs,"git-bash":gs,cmd:Wx,powershell:Zx},Jx={posix:ag,"git-bash":ag,cmd:["genericCtrlC","genericCtrlZ"],powershell:["genericCtrlC","genericCtrlL","genericCtrlR"]};function ew(a,n){var r,c;const l=a.map(h=>{var g;const m=(g=n==null?void 0:n.actions)==null?void 0:g[h.id];let p=typeof(m==null?void 0:m.keys)=="string"?m.keys:h.combo;try{gn(p)}catch{p=h.combo}return{...h,defaultCombo:h.combo,combo:p,hidden:typeof(m==null?void 0:m.hidden)=="boolean"?m.hidden:h.defaultHidden===!0,custom:!1}}),o=new Set(l.map(h=>h.id));for(const h of(n==null?void 0:n.custom)||[]){if(!h||typeof h.id!="string"||o.has(h.id))continue;const m=h.keys;try{gn(m)}catch{continue}l.push({id:h.id,labelKey:"custom",defaultCombo:m,combo:m,verified:!0,hidden:((c=(r=n==null?void 0:n.actions)==null?void 0:r[h.id])==null?void 0:c.hidden)===!0,custom:!0,customLabel:h.label}),o.add(h.id)}if(Array.isArray(n==null?void 0:n.order)){const h=new Map(n.order.map((m,p)=>[m,p]));l.sort((m,p)=>(h.get(m.id)??Number.MAX_SAFE_INTEGER)-(h.get(p.id)??Number.MAX_SAFE_INTEGER))}return l}function tw(a,n){const l=new Set(a.map(o=>o.combo.trim().toLowerCase()));return n.filter(o=>!l.has(o.combo.trim().toLowerCase()))}const ms=a=>a.id.startsWith("generic");function Mb(a,n,l="posix"){const o=na[a],r=a==="shell"?Qx[l]:gs,c=new Set([...o.bar||[],...a==="shell"?Jx[l]:Xx]),h=[...o.actions,...r].map(m=>({...m,defaultHidden:!c.has(m.id)}));return ew(h,n)}function Ab(a,n,l="posix"){const o=Mb(a,n,l),r=o.filter(h=>!ms(h)),c=new Set(tw(r,o.filter(ms)));return o.filter(h=>!ms(h)||c.has(h))}function nw(a,n,l="posix"){const o=Ab(a,n,l).filter(r=>!r.hidden);return{agentActions:o.filter(r=>!ms(r)),genericActions:o.filter(ms)}}function iw(a){const n={};for(const[l,o]of Object.entries(a.actions||{})){const r={...o};delete r.hidden,Object.keys(r).length>0&&(n[l]=r)}return{...a,actions:n}}function Eb(a){if(!a||typeof a!="object"||Array.isArray(a))return{};const n=Object.create(null);for(const[l,o]of Object.entries(a).slice(0,32)){if(!/^[a-z][a-z0-9_-]{0,31}$/i.test(l)||["__proto__","constructor","prototype"].includes(l)||!o||typeof o!="object"||Array.isArray(o))continue;const r=o,c={};if(Array.isArray(r.order)&&(c.order=[...new Set(r.order.filter(h=>typeof h=="string"&&/^[a-zA-Z0-9_-]{1,64}$/.test(h)))].slice(0,256)),r.actions&&typeof r.actions=="object"&&!Array.isArray(r.actions)){const h=Object.create(null);for(const[m,p]of Object.entries(r.actions).slice(0,256)){if(!/^[a-zA-Z0-9_-]{1,64}$/.test(m)||!p||typeof p!="object"||Array.isArray(p))continue;const g=p,y={};if(typeof g.keys=="string"&&g.keys.trim()){const v=g.keys.trim().slice(0,80);try{gn(v),y.keys=v}catch{}}typeof g.hidden=="boolean"&&(y.hidden=g.hidden),Object.keys(y).length>0&&(h[m]=y)}c.actions=h}if(Array.isArray(r.custom)){const h=new Set;c.custom=r.custom.slice(0,64).flatMap(m=>{if(!m||typeof m!="object"||Array.isArray(m))return[];const p=m;if(typeof p.id!="string"||!/^[a-zA-Z0-9_-]{1,64}$/.test(p.id)||["__proto__","constructor","prototype"].includes(p.id)||h.has(p.id))return[];if(typeof p.label!="string"||!p.label.trim()||typeof p.keys!="string"||!p.keys.trim())return[];const g=p.keys.trim().slice(0,80);try{gn(g)}catch{return[]}return h.add(p.id),[{id:p.id,label:p.label.trim().slice(0,64),keys:g}]})}n[l]=c}return n}const aw=10,lw=24,bs=15,dr=13,Dd=640;function sw(){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 il()<Dd}function il(){return typeof window>"u"?1024:window.visualViewport&&typeof window.visualViewport.width=="number"&&window.visualViewport.width>0?window.visualViewport.width:window.innerWidth||1024}function ud(){return typeof window>"u"?768:window.visualViewport&&typeof window.visualViewport.height=="number"&&window.visualViewport.height>0?window.visualViewport.height:window.innerHeight||768}function al(a,n=bs){const l=typeof a=="number"?a:Number(a);return!Number.isFinite(l)||l<=0?n:Math.min(lw,Math.max(aw,Math.round(l)))}function lg(a,n=il()){if(n<Dd){const o=al(a,dr);return Math.min(15,Math.max(12,o))}return al(a,bs)}const sg="#11111b",ow=['"Symbols Nerd Font Mono"','"Sarasa Mono SC"','"Noto Sans Mono CJK SC"','"Noto Sans Mono CJK TC"','"Microsoft YaHei Mono"','"PingFang SC"',"monospace"],fr=["ui-monospace","SFMono-Regular","Menlo","Monaco","Consolas",'"Liberation Mono"','"Courier New"'],dd=[{id:"host",name:"Host terminal font",faces:[]},{id:"system",name:"System monospace",faces:fr},{id:"jetbrains-mono",name:"JetBrains Mono",faces:['"JetBrains Mono"','"Herdr JetBrains Mono"']},{id:"fira-code",name:"Fira Code",faces:['"Fira Code"','"Herdr Fira Code"']},{id:"cascadia-code",name:"Cascadia Code",faces:['"Cascadia Code"','"Herdr Cascadia Code"']},{id:"source-code-pro",name:"Source Code Pro",faces:['"Source Code Pro"','"Herdr Source Code Pro"']},{id:"ibm-plex-mono",name:"IBM Plex Mono",faces:['"IBM Plex Mono"','"Herdr IBM Plex Mono"']}],Nb="host",rw='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", "Symbols Nerd Font Mono", monospace',cw='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',uw="JetBrains Mono, Menlo, Monaco, Consolas, monospace",dw={[rw]:"host",[cw]:"host",[uw]:"host",'SFMono-Regular, Menlo, Monaco, "Symbols Nerd Font Mono", monospace':"system",'Consolas, "Lucida Console", "Symbols Nerd Font Mono", monospace':"system",'"Liberation Mono", "DejaVu Sans Mono", "Symbols Nerd Font Mono", monospace':"system",'"Courier New", Courier, "Symbols Nerd Font Mono", monospace':"system",'"Fira Code", "Symbols Nerd Font Mono", monospace':"fira-code"};function Vu(a){return typeof a!="string"||!a.trim()?Nb:dw[a]??a}const fw=[[/^jetbrains\s*mono/i,'"Herdr JetBrains Mono"'],[/^fira\s*code/i,'"Herdr Fira Code"'],[/^(cascadia\s*(code|mono)|caskaydia\s*(cove|mono))/i,'"Herdr Cascadia Code"'],[/^(source\s*code\s*pro|sauce\s*code\s*pro)/i,'"Herdr Source Code Pro"'],[/^(ibm\s*plex\s*mono|blex\s*mono)/i,'"Herdr IBM Plex Mono"']];function hw(a){const n=fw.find(([l])=>l.test(a.trim()));return n?n[1]:null}function os(a){return`"${a.replace(/["\\]/g,"")}"`}function fd(a){return[...new Set([...a,...ow])].join(", ")}const mw=fd(fr);function pw(a,n){const l=typeof a=="string"?a.trim():"";if(!l||l==="host"){if(!(n!=null&&n.family))return mw;const c=[],h=n.glyphs;(h==null?void 0:h.scope)==="all"&&h.alias&&c.push(os(h.alias)),n.alias&&c.push(os(n.alias)),c.push(os(n.family));const m=hw(n.family);return m&&c.push(m),(h==null?void 0:h.scope)==="cjk"&&(h.alias&&c.push(os(h.alias)),c.push(os(h.family))),fd([...c,...fr])}const o=dd.find(c=>c.id===l);if(o)return fd([...o.faces,...fr]);if(l.includes("Symbols Nerd Font"))return l;if(/^['"]?monospace['"]?$/i.test(l))return'"Symbols Nerd Font Mono", monospace';const r=/,\s*['"]?monospace['"]?\s*$/i;return r.test(l)?l.replace(r,', "Symbols Nerd Font Mono", monospace'):`${l}, "Symbols Nerd Font Mono", monospace`}function gw(a){if(!a)return null;const n={};return a.background&&(n.background=a.background,n.cursorAccent=a.background),a.foreground&&(n.foreground=a.foreground),a.cursor&&(n.cursor=a.cursor),a.ansi&&Object.assign(n,a.ansi),Object.keys(n).length===0?null:n}function kb(){if(typeof document>"u")return;const a=document.querySelector('meta[name="theme-color"]');document.documentElement.style.colorScheme="dark",a==null||a.setAttribute("content",sg),document.documentElement.classList.add("dark"),document.documentElement.classList.remove("light"),document.body.classList.add("dark"),document.body.classList.remove("light"),document.body.style.backgroundColor=sg}const Et={settings:"herdr_remote_settings_v1",sessionView:"herdr_remote_session_view_v1",ignoredUpdate:"herdr_remote_ignored_update_v1",hostFontConsent:"herdr_remote_host_font_consent_v1",rendererProbe:"herdr_remote_renderer_probe_v3"},hd={local:{},session:{}};function ys(a,n){if(typeof window>"u")return hd[a][n]||null;try{return(a==="local"?window.localStorage:window.sessionStorage).getItem(n)}catch{return hd[a][n]||null}}function _i(a,n,l){if(hd[a][n]=l,!(typeof window>"u"))try{(a==="local"?window.localStorage:window.sessionStorage).setItem(n,l)}catch(o){console.warn(`Failed to write to ${a}Storage:`,o)}}const og=["啊阿埃挨哎唉哀皑癌蔼矮艾碍爱隘鞍氨安俺按暗岸胺案肮昂盎凹敖熬翱袄傲奥懊澳芭捌扒叭吧笆八疤巴拔跋靶把耙坝霸罢爸白柏百摆佰败拜稗斑班搬扳般颁板版扮拌伴瓣半办绊邦帮梆","榜膀绑棒磅蚌镑傍谤苞胞包褒剥薄雹保堡饱宝抱报暴豹鲍爆杯碑悲卑北辈背贝钡倍狈备惫焙被奔苯本笨崩绷甭泵蹦迸逼鼻比鄙笔彼碧蓖蔽毕毙毖币庇痹闭敝弊必辟壁臂避陛鞭边编贬扁","便变卞辨辩辫遍标彪膘表鳖憋别瘪彬斌濒滨宾摈兵冰柄丙秉饼炳病并玻菠播拨钵波博勃搏铂箔伯帛舶脖膊渤泊驳捕卜哺补埠不布步簿部怖擦猜裁材才财睬踩采彩菜蔡餐参蚕残惭惨灿苍","舱仓沧藏操糙槽曹草厕策侧册测层蹭插叉茬茶查碴搽察岔差诧拆柴豺搀掺蝉馋谗缠铲产阐颤昌猖场尝常长偿肠厂敞畅唱倡超抄钞朝嘲潮巢吵炒车扯撤掣彻澈郴臣辰尘晨忱沉陈趁衬撑称","城橙成呈乘程惩澄诚承逞骋秤吃痴持匙池迟弛驰耻齿侈尺赤翅斥炽充冲虫崇宠抽酬畴踌稠愁筹仇绸瞅丑臭初出橱厨躇锄雏滁除楚础储矗搐触处揣川穿椽传船喘串疮窗幢床闯创吹炊捶锤","垂春椿醇唇淳纯蠢戳绰疵茨磁雌辞慈瓷词此刺赐次聪葱囱匆从丛凑粗醋簇促蹿篡窜摧崔催脆瘁粹淬翠村存寸磋撮搓措挫错搭达答瘩打大呆歹傣戴带殆代贷袋待逮怠耽担丹单郸掸胆旦氮","但惮淡诞弹蛋当挡党荡档刀捣蹈倒岛祷导到稻悼道盗德得的蹬灯登等瞪凳邓堤低滴迪敌笛狄涤翟嫡抵底地蒂第帝弟递缔颠掂滇碘点典靛垫电佃甸店惦奠淀殿碉叼雕凋刁掉吊钓调跌爹碟","蝶迭谍叠丁盯叮钉顶鼎锭定订丢东冬董懂动栋侗恫冻洞兜抖斗陡豆逗痘都督毒犊独读堵睹赌杜镀肚度渡妒端短锻段断缎堆兑队对墩吨蹲敦顿囤钝盾遁掇哆多夺垛躲朵跺舵剁惰堕蛾峨鹅","俄额讹娥恶厄扼遏鄂饿恩而儿耳尔饵洱二贰发罚筏伐乏阀法珐藩帆番翻樊矾钒繁凡烦反返范贩犯饭泛坊芳方肪房防妨仿访纺放菲非啡飞肥匪诽吠肺废沸费芬酚吩氛分纷坟焚汾粉奋份忿","愤粪丰封枫蜂峰锋风疯烽逢冯缝讽奉凤佛否夫敷肤孵扶拂辐幅氟符伏俘服浮涪福袱弗甫抚辅俯釜斧脯腑府腐赴副覆赋复傅付阜父腹负富讣附妇缚咐噶嘎该改概钙盖溉干甘杆柑竿肝赶感","秆敢赣冈刚钢缸肛纲岗港杠篙皋高膏羔糕搞镐稿告哥歌搁戈鸽胳疙割革葛格蛤阁隔铬个各给根跟耕更庚羹埂耿梗工攻功恭龚供躬公宫弓巩汞拱贡共钩勾沟苟狗垢构购够辜菇咕箍估沽孤","姑鼓古蛊骨谷股故顾固雇刮瓜剐寡挂褂乖拐怪棺关官冠观管馆罐惯灌贯光广逛瑰规圭硅归龟闺轨鬼诡癸桂柜跪贵刽辊滚棍锅郭国果裹过哈骸孩海氦亥害骇酣憨邯韩含涵寒函喊罕翰撼捍","旱憾悍焊汗汉夯杭航壕嚎豪毫郝好耗号浩呵喝荷菏核禾和何合盒貉阂河涸赫褐鹤贺嘿黑痕很狠恨哼亨横衡恒轰哄烘虹鸿洪宏弘红喉侯猴吼厚候后呼乎忽瑚壶葫胡蝴狐糊湖弧虎唬护互沪","户花哗华猾滑画划化话槐徊怀淮坏欢环桓还缓换患唤痪豢焕涣宦幻荒慌黄磺蝗簧皇凰惶煌晃幌恍谎灰挥辉徽恢蛔回毁悔慧卉惠晦贿秽会烩汇讳诲绘荤昏婚魂浑混豁活伙火获或惑霍货祸","击圾基机畸稽积箕肌饥迹激讥鸡姬绩缉吉极棘辑籍集及急疾汲即嫉级挤几脊己蓟技冀季伎祭剂悸济寄寂计记既忌际妓继纪嘉枷夹佳家加荚颊贾甲钾假稼价架驾嫁歼监坚尖笺间煎兼肩艰","奸缄茧检柬碱硷拣捡简俭剪减荐槛鉴践贱见键箭件健舰剑饯渐溅涧建僵姜将浆江疆蒋桨奖讲匠酱降蕉椒礁焦胶交郊浇骄娇嚼搅铰矫侥脚狡角饺缴绞剿教酵轿较叫窖揭接皆秸街阶截劫节","桔杰捷睫竭洁结解姐戒藉芥界借介疥诫届巾筋斤金今津襟紧锦仅谨进靳晋禁近烬浸尽劲荆兢茎睛晶鲸京惊精粳经井警景颈静境敬镜径痉靖竟竞净炯窘揪究纠玖韭久灸九酒厩救旧臼舅咎","就疚鞠拘狙疽居驹菊局咀矩举沮聚拒据巨具距踞锯俱句惧炬剧捐鹃娟倦眷卷绢撅攫抉掘倔爵觉决诀绝均菌钧军君峻俊竣浚郡骏喀咖卡咯开揩楷凯慨刊堪勘坎砍看康慷糠扛抗亢炕考拷烤","靠坷苛柯棵磕颗科壳咳可渴克刻客课肯啃垦恳坑吭空恐孔控抠口扣寇枯哭窟苦酷库裤夸垮挎跨胯块筷侩快宽款匡筐狂框矿眶旷况亏盔岿窥葵奎魁傀馈愧溃坤昆捆困括扩廓阔垃拉喇蜡腊","辣啦莱来赖蓝婪栏拦篮阑兰澜谰揽览懒缆烂滥琅榔狼廊郎朗浪捞劳牢老佬姥酪烙涝勒乐雷镭蕾磊累儡垒擂肋类泪棱楞冷厘梨犁黎篱狸离漓理李里鲤礼莉荔吏栗丽厉励砾历利傈例俐痢立","粒沥隶力璃哩俩联莲连镰廉怜涟帘敛脸链恋炼练粮凉梁粱良两辆量晾亮谅撩聊僚疗燎寥辽潦了撂镣廖料列裂烈劣猎琳林磷霖临邻鳞淋凛赁吝拎玲菱零龄铃伶羚凌灵陵岭领另令溜琉榴硫","馏留刘瘤流柳六龙聋咙笼窿隆垄拢陇楼娄搂篓漏陋芦卢颅庐炉掳卤虏鲁麓碌露路赂鹿潞禄录陆戮驴吕铝侣旅履屡缕虑氯律率滤绿峦挛孪滦卵乱掠略抡轮伦仑沦纶论萝螺罗逻锣箩骡裸落","洛骆络妈麻玛码蚂马骂嘛吗埋买麦卖迈脉瞒馒蛮满蔓曼慢漫谩芒茫盲氓忙莽猫茅锚毛矛铆卯茂冒帽貌贸么玫枚梅酶霉煤没眉媒镁每美昧寐妹媚门闷们萌蒙檬盟锰猛梦孟眯醚靡糜迷谜弥","米秘觅泌蜜密幂棉眠绵冕免勉娩缅面苗描瞄藐秒渺庙妙蔑灭民抿皿敏悯闽明螟鸣铭名命谬摸摹蘑模膜磨摩魔抹末莫墨默沫漠寞陌谋牟某拇牡亩姆母墓暮幕募慕木目睦牧穆拿哪呐钠那娜","纳氖乃奶耐奈南男难囊挠脑恼闹淖呢馁内嫩能妮霓倪泥尼拟你匿腻逆溺蔫拈年碾撵捻念娘酿鸟尿捏聂孽啮镊镍涅您柠狞凝宁拧泞牛扭钮纽脓浓农弄奴努怒女暖虐疟挪懦糯诺哦欧鸥殴藕","呕偶沤啪趴爬帕怕琶拍排牌徘湃派攀潘盘磐盼畔判叛乓庞旁耪胖抛咆刨炮袍跑泡呸胚培裴赔陪配佩沛喷盆砰抨烹澎彭蓬棚硼篷膨朋鹏捧碰坯砒霹批披劈琵毗啤脾疲皮匹痞僻屁譬篇偏片","骗飘漂瓢票撇瞥拼频贫品聘乒坪苹萍平凭瓶评屏坡泼颇婆破魄迫粕剖扑铺仆莆葡菩蒲埔朴圃普浦谱曝瀑期欺栖戚妻七凄漆柒沏其棋奇歧畦崎脐齐旗祈祁骑起岂乞企启契砌器气迄弃汽泣","讫掐恰洽牵扦钎铅千迁签仟谦乾黔钱钳前潜遣浅谴堑嵌欠歉枪呛腔羌墙蔷强抢橇锹敲悄桥瞧乔侨巧鞘撬翘峭俏窍切茄且怯窃钦侵亲秦琴勤芹擒禽寝沁青轻氢倾卿清擎晴氰情顷请庆琼穷","秋丘邱球求囚酋泅趋区蛆曲躯屈驱渠取娶龋趣去圈颧权醛泉全痊拳犬券劝缺炔瘸却鹊榷确雀裙群然燃冉染瓤壤攘嚷让饶扰绕惹热壬仁人忍韧任认刃妊纫扔仍日戎茸蓉荣融熔溶容绒冗揉","柔肉茹蠕儒孺如辱乳汝入褥软阮蕊瑞锐闰润若弱撒洒萨腮鳃塞赛三叁伞散桑嗓丧搔骚扫嫂瑟色涩森僧莎砂杀刹沙纱傻啥煞筛晒珊苫杉山删煽衫闪陕擅赡膳善汕扇缮墒伤商赏晌上尚裳梢","捎稍烧芍勺韶少哨邵绍奢赊蛇舌舍赦摄射慑涉社设砷申呻伸身深娠绅神沈审婶甚肾慎渗声生甥牲升绳省盛剩胜圣师失狮施湿诗尸虱十石拾时什食蚀实识史矢使屎驶始式示士世柿事拭誓","逝势是嗜噬适仕侍释饰氏市恃室视试收手首守寿授售受瘦兽蔬枢梳殊抒输叔舒淑疏书赎孰熟薯暑曙署蜀黍鼠属术述树束戍竖墅庶数漱恕刷耍摔衰甩帅栓拴霜双爽谁水睡税吮瞬顺舜说硕","朔烁斯撕嘶思私司丝死肆寺嗣四伺似饲巳松耸怂颂送宋讼诵搜艘擞嗽苏酥俗素速粟僳塑溯宿诉肃酸蒜算虽隋随绥髓碎岁穗遂隧祟孙损笋蓑梭唆缩琐索锁所塌他它她塔獭挞蹋踏胎苔抬台","泰酞太态汰坍摊贪瘫滩坛檀痰潭谭谈坦毯袒碳探叹炭汤塘搪堂棠膛唐糖倘躺淌趟烫掏涛滔绦萄桃逃淘陶讨套特藤腾疼誊梯剔踢锑提题蹄啼体替嚏惕涕剃屉天添填田甜恬舔腆挑条迢眺跳","贴铁帖厅听烃汀廷停亭庭挺艇通桐酮瞳同铜彤童桶捅筒统痛偷投头透凸秃突图徒途涂屠土吐兔湍团推颓腿蜕褪退吞屯臀拖托脱鸵陀驮驼椭妥拓唾挖哇蛙洼娃瓦袜歪外豌弯湾玩顽丸烷完","碗挽晚皖惋宛婉万腕汪王亡枉网往旺望忘妄威巍微危韦违桅围唯惟为潍维苇萎委伟伪尾纬未蔚味畏胃喂魏位渭谓尉慰卫瘟温蚊文闻纹吻稳紊问嗡翁瓮挝蜗涡窝我斡卧握沃巫呜钨乌污诬","屋无芜梧吾吴毋武五捂午舞伍侮坞戊雾晤物勿务悟误昔熙析西硒矽晰嘻吸锡牺稀息希悉膝夕惜熄烯溪汐犀檄袭席习媳喜铣洗系隙戏细瞎虾匣霞辖暇峡侠狭下厦夏吓掀锨先仙鲜纤咸贤衔","舷闲涎弦嫌显险现献县腺馅羡宪陷限线相厢镶香箱襄湘乡翔祥详想响享项巷橡像向象萧硝霄削哮嚣销消宵淆晓小孝校肖啸笑效楔些歇蝎鞋协挟携邪斜胁谐写械卸蟹懈泄泻谢屑薪芯锌欣","辛新忻心信衅星腥猩惺兴刑型形邢行醒幸杏性姓兄凶胸匈汹雄熊休修羞朽嗅锈秀袖绣墟戌需虚嘘须徐许蓄酗叙旭序畜恤絮婿绪续轩喧宣悬旋玄选癣眩绚靴薛学穴雪血勋熏循旬询寻驯巡","殉汛训讯逊迅压押鸦鸭呀丫芽牙蚜崖衙涯雅哑亚讶焉咽阉烟淹盐严研蜒岩延言颜阎炎沿奄掩眼衍演艳堰燕厌砚雁唁彦焰宴谚验殃央鸯秧杨扬佯疡羊洋阳氧仰痒养样漾邀腰妖瑶摇尧遥窑","谣姚咬舀药要耀椰噎耶爷野冶也页掖业叶曳腋夜液一壹医揖铱依伊衣颐夷遗移仪胰疑沂宜姨彝椅蚁倚已乙矣以艺抑易邑屹亿役臆逸肄疫亦裔意毅忆义益溢诣议谊译异翼翌绎茵荫因殷音","阴姻吟银淫寅饮尹引隐印英樱婴鹰应缨莹萤营荧蝇迎赢盈影颖硬映哟拥佣臃痈庸雍踊蛹咏泳涌永恿勇用幽优悠忧尤由邮铀犹油游酉有友右佑釉诱又幼迂淤于盂榆虞愚舆余俞逾鱼愉渝渔","隅予娱雨与屿禹宇语羽玉域芋郁吁遇喻峪御愈欲狱育誉浴寓裕预豫驭鸳渊冤元垣袁原援辕园员圆猿源缘远苑愿怨院曰约越跃钥岳粤月悦阅耘云郧匀陨允运蕴酝晕韵孕匝砸杂栽哉灾宰载","再在咱攒暂赞赃脏葬遭糟凿藻枣早澡蚤躁噪造皂灶燥责择则泽贼怎增憎曾赠扎喳渣札轧铡闸眨栅榨咋乍炸诈摘斋宅窄债寨瞻毡詹粘沾盏斩辗崭展蘸栈占战站湛绽樟章彰漳张掌涨杖丈帐","账仗胀瘴障招昭找沼赵照罩兆肇召遮折哲蛰辙者锗蔗这浙珍斟真甄砧臻贞针侦枕疹诊震振镇阵蒸挣睁征狰争怔整拯正政帧症郑证芝枝支吱蜘知肢脂汁之织职直植殖执值侄址指止趾只旨","纸志挚掷至致置帜峙制智秩稚质炙痔滞治窒中盅忠钟衷终种肿重仲众舟周州洲诌粥轴肘帚咒皱宙昼骤珠株蛛朱猪诸诛逐竹烛煮拄瞩嘱主著柱助蛀贮铸筑住注祝驻抓爪拽专砖转撰赚篆桩","庄装妆撞壮状椎锥追赘坠缀谆准捉拙卓桌琢茁酌啄着灼浊兹咨资姿滋淄孜紫仔籽滓子自渍字鬃棕踪宗综总纵邹走奏揍租足卒族祖诅阻组钻纂嘴醉最罪尊遵昨左佐柞做作坐座"," 、。〃〄々〆〇〈〉《》「」『』【】〒〓〔〕〖〗〘〙〚〛〜〝〞〟〠〡〢〣〤〥〦〧〨〩〪〭〮〯〫〬〰〱〲〳〴〵〶〷〸〹〺〻〼〽〾〿!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~¢£¬ ̄¦¥₩"].join(""),$u=256*1024,bw=2,yw={regular:{weight:"400",style:"normal"},bold:{weight:"700",style:"normal"},italic:{weight:"400",style:"italic"},boldItalic:{weight:"700",style:"italic"}};function Ji(a){return a?[a.family,...a.faces.map(n=>n.sha256),...(a.subsets||[]).map(n=>n.sha256)].join("|"):null}function rg(a){const n=a==null?void 0:a.faces.find(l=>l.style==="regular");return n?`Herdr Host ${n.sha256.slice(0,12)}`:null}function cg(a){return a?a.faces.reduce((n,l)=>n+l.bytes,0):0}function qu(a){return a>=1024*1024?`${(a/(1024*1024)).toFixed(1)} MB`:`${Math.max(1,Math.round(a/1024))} KB`}function vw(a){if(typeof document>"u")return!1;let n=null;try{n=document.createElement("canvas").getContext("2d")}catch{return!1}if(!n)return!1;const l="mmmmmmmmmmlli10OQ@#WWww";for(const o of["serif","sans-serif"]){n.font=`72px ${o}`;const r=n.measureText(l).width;if(n.font=`72px "${a}", ${o}`,n.measureText(l).width!==r)return!0}return!1}const xw="herdr-remote-fonts",ll="faces",sl="subsets",Lb=new Map,md=new Map;function Sr(){return new Promise(a=>{if(typeof indexedDB>"u"){a(null);return}try{const n=indexedDB.open(xw,2);n.onupgradeneeded=()=>{n.result.objectStoreNames.contains(ll)||n.result.createObjectStore(ll),n.result.objectStoreNames.contains(sl)||n.result.createObjectStore(sl)},n.onsuccess=()=>a(n.result),n.onerror=()=>a(null),n.onblocked=()=>a(null)}catch{a(null)}})}async function ww(a){const n=Lb.get(a);if(n)return n;const l=await Sr();return l?new Promise(o=>{try{const r=l.transaction(ll,"readonly").objectStore(ll).get(a);r.onsuccess=()=>{const c=r.result;o(c instanceof ArrayBuffer?c:null)},r.onerror=()=>o(null)}catch{o(null)}finally{l.close()}}):null}async function Sw(a,n){Lb.set(a,n);const l=await Sr();l&&await new Promise(o=>{try{const r=l.transaction(ll,"readwrite");r.objectStore(ll).put(n,a),r.oncomplete=()=>o(),r.onerror=()=>o(),r.onabort=()=>o()}catch{o()}finally{l.close()}})}async function Cw(a){const n=await Sr();return n?new Promise(l=>{try{const o=IDBKeyRange.bound(`${a}:`,`${a}:￿`),r=n.transaction(sl,"readonly").objectStore(sl).getAll(o);r.onsuccess=()=>{const c=Array.isArray(r.result)?r.result:[];l(c.filter(h=>h&&h.data instanceof ArrayBuffer&&Array.isArray(h.codepoints)))},r.onerror=()=>l([])}catch{l([])}finally{n.close()}}):md.get(a)??[]}async function Tw(a,n){md.set(a,[...md.get(a)??[],n]);const l=await Sr();l&&await new Promise(o=>{try{const r=l.transaction(sl,"readwrite");r.objectStore(sl).put(n,`${a}:${n.subsetSha}`),r.oncomplete=()=>o(),r.onerror=()=>o(),r.onabort=()=>o()}catch{o()}finally{l.close()}})}function Xu(a){return a?`Herdr Glyphs ${a.sha256.slice(0,12)}`:null}function Mw(a){return a>=11904&&a<=12255||a>=12288&&a<=13311||a>=13312&&a<=19903||a>=19968&&a<=40959||a>=44032&&a<=55215||a>=63744&&a<=64255||a>=65072&&a<=65103||a>=65280&&a<=65519||a>=131072&&a<=201551}function _b(a,n){return n<32||n>=127&&n<160||n>=9472&&n<=9631?!1:a==="all"||Mw(n)}function Aw(a){const n=[...new Set(a)].sort((o,r)=>o-r),l=[];for(let o=0;o<n.length;o+=1){const r=n[o];let c=r;for(;o+1<n.length&&n[o+1]===c+1;)c=n[o+1],o+=1;const h=m=>m.toString(16).toUpperCase();l.push(r===c?`U+${h(r)}`:`U+${h(r)}-${h(c)}`)}return l.join(", ")}async function Ew(a,n){if(typeof FontFace>"u"||typeof document>"u"||!document.fonts)throw new Error("font_api_unavailable");const l=new FontFace(a,n.data,{weight:"400",style:"normal",unicodeRange:Aw(n.codepoints)});document.fonts.add(await l.load())}const pd=new Set;function Nw(a){return!!(a&&pd.has(a))}async function kw(a,n){if(pd.has(a))return;if(typeof FontFace>"u"||typeof document>"u"||!document.fonts)throw new Error("font_api_unavailable");const l=await Promise.all(n.map(({face:o,data:r})=>new FontFace(a,r,yw[o.style]).load()));for(const o of l)document.fonts.add(o);pd.add(a)}function ug(a){const n=atob(a),l=new Uint8Array(n.length);for(let o=0;o<n.length;o+=1)l[o]=n.charCodeAt(o);return l}async function Rb(a,n,l){const o=Math.ceil(a.bytes/$u),r=new Uint8Array(a.bytes);let c=0;const h=async()=>{for(;c<o;){const m=c;c+=1;const p=await n(a.sha256,m),g=m*$u,y=Math.min($u,a.bytes-g);if(p.length!==y)throw new Error("host_font_corrupt");r.set(p,g),l(p.length)}};return await Promise.all(Array.from({length:Math.min(bw,o)},h)),r.buffer}function jb(){try{const a=JSON.parse(ys("local",Et.hostFontConsent)||"{}");return a&&typeof a=="object"&&!Array.isArray(a)?a:{}}catch{return{}}}function dg(a,n){const l=jb()[a];return l&&l.fingerprint===n?l.decision:null}function fg(a,n,l){const o=jb();o[a]={fingerprint:n,decision:l},_i("local",Et.hostFontConsent,JSON.stringify(o))}const Ob={source:null,status:"none",alias:null,covered:0},Zu={font:null,status:"none",alias:null,receivedBytes:0,totalBytes:0,error:null,glyphs:Ob,interactive:!1,glyphRevision:0},Lw=String.fromCodePoint(...Array.from({length:95},(a,n)=>32+n),...Array.from({length:96},(a,n)=>160+n),...Array.from({length:112},(a,n)=>8192+n));function hg(a){const n=(a==null?void 0:a.subsets)??[];return n.find(l=>l.scope==="all")??n.find(l=>l.scope==="cjk")??null}function _w(a,n){const l=new Set;for(const o of a){const r=o.codePointAt(0);_b(n,r)&&l.add(r)}return[...l]}const mg=3e4;function Rw(a){const n=T.useRef(new Map),l=T.useRef(new Map),o=T.useRef(new Map),r=T.useCallback(m=>{for(const p of[n.current,l.current]){for(const g of p.values())clearTimeout(g.timer),g.reject(new Error(m));p.clear()}},[]),c=T.useCallback((m,p)=>new Promise((g,y)=>{if(!a){y(new Error("disconnected"));return}const v=`${m}:${p}`,x=setTimeout(()=>{n.current.delete(v),y(new Error("host_font_timeout"))},mg);n.current.set(v,{resolve:g,reject:y,timer:x}),a.sendHostFontChunkRequest(m,p)}),[a]),h=T.useCallback((m,p,g)=>new Promise((y,v)=>{if(!a){v(new Error("disconnected"));return}const x=Math.random().toString(36).slice(2,12),w=setTimeout(()=>{l.current.delete(x),v(new Error("host_font_timeout"))},mg);l.current.set(x,{resolve:S=>y({...S,codepoints:p}),reject:v,timer:w}),o.current.set(x,g),a.sendHostFontSubsetRequest(m.sha256,String.fromCodePoint(...p),x)}),[a]);return T.useEffect(()=>{if(!a)return;const m=n.current,p=l.current,g=a.on("hostFontChunk",w=>{const S=`${w.sha256}:${w.index}`,M=m.get(S);if(M){m.delete(S),clearTimeout(M.timer);try{M.resolve(ug(w.dataBase64))}catch{M.reject(new Error("host_font_corrupt"))}}}),y=a.on("hostFontSubset",w=>{const S=p.get(w.requestId);if(!S)return;p.delete(w.requestId),clearTimeout(S.timer);const M=o.current.get(w.requestId)??(()=>{});if(o.current.delete(w.requestId),w.dataBase64!==void 0){try{const k=ug(w.dataBase64);M(k.length,k.length),S.resolve({subsetSha:w.subsetSha,data:k.buffer,codepoints:[]})}catch{S.reject(new Error("host_font_corrupt"))}return}M(0,w.bytes);const N={bytes:w.bytes,sha256:w.subsetSha};Rb(N,c,k=>M(k,w.bytes)).then(k=>S.resolve({subsetSha:w.subsetSha,data:k,codepoints:[]})).catch(k=>S.reject(k instanceof Error?k:new Error("host_font_failed")))}),v=a.on("error",w=>{(w.code==="host_font_unavailable"||w.code==="host_font_subset_failed")&&r(String(w.code))}),x=a.on("stateChange",w=>{w!=="connected"&&r("disconnected")});return()=>{g(),y(),v(),x(),r("disconnected")}},[a,r,c]),{requestChunk:c,requestSubset:h,rejectPending:r}}const jw=15e3,Ow=80,Dw=2e3;function zw(a,n={}){const[l,o]=T.useState(Zu),r=T.useRef(l);r.current=l;const c=T.useRef(n);c.current=n;const h=T.useRef(0),m=T.useRef(0),p=T.useRef(new Set),g=T.useRef(new Set),y=T.useRef(new Set),v=T.useRef(null),{requestChunk:x,requestSubset:w,rejectPending:S}=Rw(a),M=T.useCallback(()=>({isInstalled:c.current.isInstalled??vw,readCached:c.current.readCached??ww,writeCached:c.current.writeCached??Sw,register:c.current.register??kw,isRegistered:c.current.isRegistered??Nw,readSubsets:c.current.readSubsets??Cw,writeSubset:c.current.writeSubset??Tw,registerGlyphs:c.current.registerGlyphs??Ew}),[]),N=T.useCallback(()=>(a==null?void 0:a.getHostId())||"default",[a]),k=T.useCallback((K,q)=>{K===h.current&&o(te=>({...te,glyphs:{...te.glyphs,...q}}))},[]),E=T.useCallback(async(K,q,te)=>{const{registerGlyphs:Z}=M();for(const ie of te){if(await Z(q,ie),K!==h.current)return;for(const re of ie.codepoints)p.current.add(re)}K!==h.current||!te.length||o(ie=>({...ie,glyphs:{...ie.glyphs,alias:q,covered:p.current.size},glyphRevision:ie.glyphRevision+1}))},[M]),R=T.useCallback(async(K,q,te)=>{const Z=Xu(q),ie=q.scope==="all"?Lw+og:og,re=_w(ie,q.scope).filter(A=>!p.current.has(A));if(!re.length)return;for(const A of re)g.current.add(A);const P=await w(q,re,te);K===h.current&&(await M().writeSubset(q.sha256,P),await E(K,Z,[P]))},[w,M,E]),H=T.useCallback(async(K,{interactive:q=!0}={})=>{const te=K??r.current.font,Z=Ji(te);if(!te||!Z)return;const ie=r.current,re=Ji(ie.font)===Z;if(re&&(ie.status==="loading"||ie.glyphs.status==="loading"))return;const P=h.current,{isInstalled:A,isRegistered:G,readCached:W,writeCached:se,register:Q}=M();fg(N(),Z,"accepted");const ge=rg(te),ye=hg(te),ue=!!(ge&&!G(ge)&&!A(te.family)),Te=re?ie.glyphs:{...Ob,source:ye},ce=!!(ye&&!["installed","ready","none"].includes(Te.status));let be=ue?cg(te):0,ae=0;const we=()=>{P===h.current&&o(le=>({...le,receivedBytes:ae,totalBytes:be}))};if(o(le=>({...le,font:te,interactive:q,receivedBytes:0,totalBytes:be,error:null,status:ue?"loading":le.status,glyphs:ce?{...Te,status:"loading"}:Te})),ue&&ge)try{const le=[];for(const ve of te.faces){let Ne=await W(ve.sha256);if(Ne?(ae+=ve.bytes,we()):(Ne=await Rb(ve,x,Ie=>{ae+=Ie,we()}),await se(ve.sha256,Ne)),P!==h.current)return;le.push({face:ve,data:Ne})}if(await Q(ge,le),P!==h.current)return;o(ve=>({...ve,status:"loaded",alias:ge}))}catch(le){if(P!==h.current)return;const ve=le instanceof Error&&le.message?le.message:"host_font_failed";o(Ne=>({...Ne,status:"failed",alias:null,error:ve}))}if(ce&&ye){let le=0;try{await R(P,ye,(ve,Ne)=>{Ne&&!le&&(le=Ne,be+=Ne),ae+=ve,we()}),k(P,{status:"ready"})}catch(ve){if(P!==h.current)return;const Ne=ve instanceof Error&&ve.message?ve.message:"host_font_failed";o(Ie=>({...Ie,error:Ie.error??Ne,glyphs:{...Ie.glyphs,status:"failed"}}))}}},[x,R,M,N,k]),j=T.useCallback(async K=>{const q=Ji(K)!==Ji(r.current.font);q&&(S("superseded"),p.current=new Set,g.current=new Set,y.current=new Set);const te=++h.current;if(!K){o(Zu);return}const{isInstalled:Z,readCached:ie,register:re,isRegistered:P,readSubsets:A}=M(),G=rg(K),W=Ji(K),se=hg(K);let Q="checking";G&&P(G)?Q="loaded":Z(K.family)?Q="installed":G||(Q="unavailable");let ge="checking";if(se?(se.scope==="cjk"?Z(se.family):Q==="installed")&&(ge="installed"):ge="none",o(ce=>({...Zu,font:K,status:Q==="checking"?"checking":Q,alias:Q==="loaded"?G:null,totalBytes:cg(K),glyphs:{source:se,status:ge,alias:q?null:ce.glyphs.alias,covered:p.current.size},glyphRevision:ce.glyphRevision})),Q==="checking"&&G){const ce=await Promise.all(K.faces.map(be=>ie(be.sha256)));if(te!==h.current)return;if(Q="needs",ce.every(Boolean))try{if(await re(G,K.faces.map((be,ae)=>({face:be,data:ce[ae]}))),te!==h.current)return;Q="loaded",o(be=>({...be,status:"loaded",alias:G}))}catch{}}if(ge==="checking"&&se){const ce=await A(se.sha256);if(te!==h.current)return;if(ce.length)try{await E(te,Xu(se),ce),ge="cached"}catch{ge="needs"}else ge="needs";if(te!==h.current)return}const ye=dg(N(),W),ue=ye==="accepted"||ge==="cached"||Date.now()<m.current;if(ge==="cached"&&(ge="ready",k(te,{status:"ready"}),R(te,se,()=>{}).catch(()=>{})),Q!=="needs"&&ge!=="needs")return;if(ue){H(K,{interactive:!1});return}const Te=ye==="declined"?"declined":"available";o(ce=>({...ce,status:Q==="needs"?Te:ce.status,glyphs:ge==="needs"?{...ce.glyphs,status:Te}:ce.glyphs}))},[H,S,N,k,R,M,E]),D=T.useCallback(()=>{const K=Ji(r.current.font);K&&fg(N(),K,"declined"),o(q=>({...q,interactive:!1,status:["available","failed"].includes(q.status)?"declined":q.status,glyphs:["available","failed"].includes(q.glyphs.status)?{...q.glyphs,status:"declined"}:q.glyphs}))},[N]),_=T.useCallback(()=>{m.current=Date.now()+jw,a==null||a.sendHostFontRefresh();const K=r.current,q=["available","declined","failed"];K.font&&(q.includes(K.status)||q.includes(K.glyphs.status))&&H(K.font,{interactive:!1})},[a,H]),z=T.useCallback(K=>{const{glyphs:q}=r.current;if(q.status!=="ready"||!q.source)return;const te=q.source;for(const Z of K){const ie=Z.codePointAt(0);ie<128&&te.scope!=="all"||_b(te.scope,ie)&&(p.current.has(ie)||g.current.has(ie)||y.current.add(ie))}!y.current.size||v.current||(v.current=setTimeout(()=>{v.current=null;const Z=h.current,ie=[...y.current].slice(0,Dw);for(const re of ie)y.current.delete(re),g.current.add(re);(async()=>{const re=await w(te,ie,()=>{});Z===h.current&&(await M().writeSubset(te.sha256,re),await E(Z,Xu(te),[re]))})().catch(()=>{})},Ow))},[w,M,E]);return T.useEffect(()=>{if(!a)return;const K=a.on("terminalFont",q=>{j(q)});return()=>{K(),v.current&&clearTimeout(v.current),v.current=null}},[a,j]),T.useEffect(()=>{const K=q=>{if(q.key!==Et.hostFontConsent)return;const te=r.current,Z=Ji(te.font),ie=te.status==="available"||te.glyphs.status==="available";if(!Z||!ie)return;const re=dg(N(),Z);re==="accepted"?H(te.font,{interactive:!1}):re==="declined"&&D()};return window.addEventListener("storage",K),()=>window.removeEventListener("storage",K)},[H,D,N]),{hostFont:l,loadHostFont:H,declineHostFont:D,syncHostFont:_,ensureHostGlyphs:z}}function Hw(a,n=window,l=document){const o=g=>{var y;((y=n.navigator)==null?void 0:y.onLine)!==!1&&a.wake(g)},r=()=>{l.visibilityState==="visible"&&o("visible")},c=()=>o("pageshow"),h=()=>o("online"),m=()=>o("focus"),p=()=>o("resume");return l.addEventListener("visibilitychange",r),l.addEventListener("resume",p),n.addEventListener("pageshow",c),n.addEventListener("online",h),n.addEventListener("focus",m),()=>{l.removeEventListener("visibilitychange",r),l.removeEventListener("resume",p),n.removeEventListener("pageshow",c),n.removeEventListener("online",h),n.removeEventListener("focus",m)}}function Po(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}}function pg(a,n){return n||(a==="win32"?"powershell":"posix")}function Bw(a,n){if(n!=="win32")return n?"posix":null;for(const l of a.slice(-8).reverse()){if(/\b(?:MINGW32|MINGW64|MSYS)\b/i.test(l))return"git-bash";if(/^\s*PS\s+[a-z]:\\[^>]*>/i.test(l))return"powershell";if(/^\s*(?:[a-z]:\\[^>]*|\\\\[^\\]+\\[^>]+)>/i.test(l))return"cmd"}return null}function Uw(a){return a==="cmd"?["dir","cls","git status","cd","tasklist","exit","type"]:a==="powershell"?["Get-ChildItem","Clear-Host","git status","Get-Location","Get-Process","exit","Get-Content"]:["ls -la","clear","git status","pwd","top","exit","cat"]}const Kw={connectionState:"disconnected",role:"viewer",shellProfile:"posix",hostPalette:null,rttMs:null,sharedWindowCount:1,terminalResetVersion:0,agentStatus:null,lastPairedAt:null},gg={role:"viewer",controllerId:void 0,hostname:void 0,platform:void 0,adminTerminalSupported:void 0,hostVersion:void 0,herdrPrefixKeys:void 0,shellProfile:"posix",hostPalette:null,rttMs:null,sharedWindowCount:1};function Iw(a,n){switch(n.type){case"stateChange":return{...a,connectionState:n.state,stateCode:n.code,stateDetail:n.detail,agentStatus:n.state==="connected"?a.agentStatus:null};case"ready":{const{message:l}=n;return{...a,terminalResetVersion:a.terminalResetVersion+(n.resetTerminal?1:0),role:l.role,controllerId:l.controllerId,hostId:l.hostId,hostname:l.hostname,platform:l.platform,adminTerminalSupported:l.adminTerminalSupported,hostVersion:l.hostVersion,herdrPrefixKeys:l.herdrPrefixKeys,shellProfile:pg(l.platform,l.shellProfile),assignedClientId:l.clientId||a.assignedClientId,hostPalette:l.terminalPalette||null}}case"hostReconnecting":return{...a,...gg,stateCode:n.code,stateDetail:n.detail};case"sessionRestarted":return{...a,hostname:n.hostname,platform:n.platform,adminTerminalSupported:n.adminTerminalSupported,hostVersion:n.hostVersion,herdrPrefixKeys:n.herdrPrefixKeys,shellProfile:pg(n.platform,n.shellProfile),hostPalette:n.palette||null,terminalResetVersion:a.terminalResetVersion+1};case"roleChange":return{...a,role:n.role,controllerId:n.controllerId,hostId:n.hostId||a.hostId,assignedClientId:n.assignedClientId||a.assignedClientId};case"controlGranted":return{...a,role:"controller"};case"paired":return{...a,lastPairedAt:n.at};case"rtt":return{...a,rttMs:n.rttMs};case"peerCount":return{...a,sharedWindowCount:Math.max(1,n.count)};case"sessionReady":return{...a,connectionState:"connected"};case"agentStatus":return{...a,agentStatus:n.status};case"shellProfile":return a.shellProfile===n.profile?a:{...a,shellProfile:n.profile};case"reset":return{...a,...gg,hostId:void 0,platform:void 0,assignedClientId:void 0,terminalResetVersion:a.terminalResetVersion+(n.resetTerminal?1:0)}}}const Fw=3e4;function Gw(a,n){const[l,o]=T.useState(null),r=T.useRef(null),c=T.useRef(null),h=T.useCallback(y=>{(y==null?void 0:y.phase)!=="starting"&&c.current&&(clearTimeout(c.current),c.current=null),r.current=y,o(y)},[]),m=T.useCallback(()=>{const y=a.current;y&&(h({phase:"starting"}),y.sendHerdrStart(),c.current=setTimeout(()=>{var v;c.current=null,((v=r.current)==null?void 0:v.phase)==="starting"&&h({phase:"failed",message:n.current("herdrLaunch.timeout")})},Fw))},[a,n,h]),p=T.useCallback(y=>{var v;return y.code==="herdr_not_running"?(((v=r.current)==null?void 0:v.phase)!=="starting"&&h({phase:"stopped"}),!0):y.code==="herdr_start_failed"&&r.current?(h({phase:"failed",message:y.message||""}),!0):!1},[h]),g=T.useCallback(()=>h(null),[h]);return T.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]),{herdrLaunch:l,startHerdr:m,handleLaunchError:p,forgetHerdrLaunch:g}}class Yw{constructor(){$(this,"listeners",{stateChange:new Set,roleChange:new Set,ready:new Set,paired:new Set,controlState:new Set,sessionReady:new Set,exit:new Set,controlGranted:new Set,peerCount:new Set,hostReconnecting:new Set,sessionRestarted:new Set,error:new Set,binaryData:new Set,rttUpdate:new Set,pasteFileReady:new Set,agentStatus:new Set,updateStatus:new Set,terminalFont:new Set,hostFontChunk:new Set,hostFontSubset:new Set})}on(n,l){return this.listeners[n].add(l),()=>{this.listeners[n].delete(l)}}emit(n,...l){this.listeners[n].forEach(r=>{try{r(...l)}catch(c){console.error(`Error in event listener for ${n}:`,c)}})}}const Db=27,zb=91,Pw=60,bg=59,Hb=77,Bb=48,Vw=57,$w=64,qw=-30,Wu=32,yg=255;function Ub(a){return Number.isInteger(a)&&(a&qw)===$w}function Xw(a){return a>=Bb&&a<=Vw}function Qu(a,n){let l=n,o=0;for(;l<a.length&&Xw(a[l]);){if(o=o*10+(a[l]-Bb),o>65535)return null;l+=1}return l===n?null:{value:o,next:l}}function Zw(a,n){if(a[n]!==Db||a[n+1]!==zb||a[n+2]!==Pw)return-1;const l=Qu(a,n+3);if(!l||!Ub(l.value)||a[l.next]!==bg)return-1;const o=Qu(a,l.next+1);if(!o||a[o.next]!==bg)return-1;const r=Qu(a,o.next+1);return!r||a[r.next]!==Hb?-1:r.next+1}function Ww(a,n){if(a[n]!==Db||a[n+1]!==zb||a[n+2]!==Hb||n+6>a.length)return-1;const l=a[n+3]-Wu,o=a[n+4],r=a[n+5];return!Ub(l)||o<Wu||o>yg||r<Wu||r>yg?-1:n+6}function hr(a){if(!a)return!1;const n=a instanceof Uint8Array?a:new Uint8Array(a);if(n.length===0)return!1;let l=0;for(;l<n.length;){const o=Zw(n,l);if(o>l){l=o;continue}const r=Ww(n,l);if(r>l){l=r;continue}return!1}return!0}class Qw{constructor(n){$(this,"segments",[]);$(this,"flushScheduled",!1);this.getSocket=n}push(n){const l=n instanceof Uint8Array?n:new Uint8Array(n);l.length!==0&&(this.segments.push(l),this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flush())))}flush(){if(this.flushScheduled=!1,this.segments.length===0)return;let n=this.segments;this.segments=[];const l=this.getSocket();if(l&&(l.bufferedAmount??0)>256*1024&&(n=n.filter(r=>!hr(r))),n.length===0)return;let o;if(n.length===1)o=n[0];else{let r=0;for(let h=0;h<n.length;h++)r+=n[h].byteLength;o=new Uint8Array(r);let c=0;for(let h=0;h<n.length;h++)o.set(n[h],c),c+=n[h].byteLength}l&&l.readyState===WebSocket.OPEN&&l.send(o)}clear(){this.segments=[],this.flushScheduled=!1}}const Jw=3e3,e1=1e4,t1=1500;class n1 extends Yw{constructor(l){super();$(this,"ws",null);$(this,"config");$(this,"state","disconnected");$(this,"reconnectAttempts",0);$(this,"reconnectTimer",null);$(this,"pingTimer",null);$(this,"pingTimestamp",null);$(this,"lastInboundAt",0);$(this,"pingSentAt",null);$(this,"connectStartedAt",0);$(this,"lastWakeConnectAt",0);$(this,"probeTimer",null);$(this,"rejectedByRelay",!1);$(this,"isManuallyClosed",!1);$(this,"authFailureDetail",null);$(this,"authFailureCode",null);$(this,"temporaryFailureCode",null);$(this,"input",new Qw(()=>this.ws));$(this,"terminalCols",80);$(this,"terminalRows",24);this.config={...l}}updateConfig(l){this.config={...this.config,...l}}getConfig(){return{...this.config}}getState(){return this.state}setState(l,o,r){this.state!==l&&(this.state=l,this.emit("stateChange",l,o,r))}connect(l){if(l&&(this.terminalCols=l.cols,this.terminalRows=l.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 o=i1(this.config.wsUrl),r=new WebSocket(o);this.ws=r,this.connectStartedAt=Date.now(),r.binaryType="arraybuffer",r.onopen=()=>{this.isStaleSocket(r)||this.handleOpen()},r.onmessage=c=>{this.isStaleSocket(r)||this.handleMessage(c)},r.onerror=c=>{this.isStaleSocket(r)||this.handleError(c)},r.onclose=c=>{this.isStaleSocket(r)||this.handleClose(c)}}catch(o){this.setState("error",o instanceof Error?o.message:"Connection failed","connection_failed"),this.scheduleReconnect()}}}isStaleSocket(l){return this.ws!==l}teardownSocket(l=1e3,o="Client closed the connection"){this.input.clear();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(l,o)}catch{}}}disconnect(){this.isManuallyClosed=!0,this.clearTimers(),this.input.clear(),this.teardownSocket(1e3,"User initiated disconnect"),this.setState("disconnected")}reconnectWith(l){this.updateConfig(l),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(l){if(this.isManuallyClosed||!this.config.autoReconnect||this.authFailureDetail||this.rejectedByRelay)return;const o=Date.now(),r=this.ws;if(!r){if(o-this.lastWakeConnectAt<t1)return;this.lastWakeConnectAt=o,this.reconnectAttempts=0,this.connect();return}if(r.readyState===WebSocket.CONNECTING){o-this.connectStartedAt>e1&&this.dropStaleSocket("connection_stalled");return}r.readyState===WebSocket.OPEN&&o-this.lastInboundAt>this.pingIntervalMs()+2e3&&this.probeLiveness()}pingIntervalMs(){return this.config.pingIntervalMs||1e4}probeLiveness(){const l=this.ws;if(!l||l.readyState!==WebSocket.OPEN||this.probeTimer)return;const o=Date.now();this.sendPing(),this.probeTimer=setTimeout(()=>{this.probeTimer=null,this.ws===l&&this.lastInboundAt<o&&this.dropStaleSocket("connection_stale")},Jw)}dropStaleSocket(l){this.clearTimers(),this.teardownSocket(4e3,"Connection went silent"),this.setState("reconnecting","The connection went silent. Reconnecting...",l),this.reconnectAttempts=0,this.lastWakeConnectAt=Date.now(),this.connect()}handleOpen(){this.lastInboundAt=Date.now(),this.sendHello(),this.startHeartbeat()}async handleMessage(l){if(this.lastInboundAt=Date.now(),typeof l.data=="string")try{const o=JSON.parse(l.data);o.type==="pong"?this.handlePong():this.handleServerMessage(o)}catch(o){console.warn("Received unparseable text frame from server:",o)}else if(l.data instanceof ArrayBuffer)this.emit("binaryData",new Uint8Array(l.data));else if(typeof Blob<"u"&&l.data instanceof Blob)try{const o=await l.data.arrayBuffer();this.emit("binaryData",new Uint8Array(o))}catch(o){console.error("Failed to convert Blob to ArrayBuffer:",o)}}handlePong(){if(this.pingTimestamp){const l=Math.max(0,performance.now()-this.pingTimestamp);this.pingTimestamp=null,this.emit("rttUpdate",Math.round(l))}}handleError(l){console.error("WebSocket error:",l),this.emit("error",{code:"WS_ERROR",message:"WebSocket connection error"})}handleClose(l){if(this.clearTimers(),this.ws=null,this.authFailureDetail){this.setState("error",this.authFailureDetail,this.authFailureCode??void 0);return}if(l.code===1008&&this.temporaryFailureCode){this.setState("reconnecting",l.reason||"The relay is temporarily unavailable",this.temporaryFailureCode),this.scheduleReconnect();return}if(l.code===1008){this.rejectedByRelay=!0,this.setState("error",l.reason||"The relay rejected the connection",String(l.code));return}!this.isManuallyClosed&&this.config.autoReconnect?(this.setState("reconnecting",`Connection closed (${l.code}). Retrying...`,"connection_closed"),this.scheduleReconnect()):this.setState("disconnected",`Closed: ${l.reason||l.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 l=this.config.reconnectIntervalMs||2e3,r=Math.min(3e4,Math.floor(l*1.5**(this.reconnectAttempts-1)+Math.random()*500));this.reconnectTimer=setTimeout(()=>{this.connect()},r)}startHeartbeat(){this.pingTimer&&clearInterval(this.pingTimer);const l=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>=l){this.probeLiveness();return}this.sendPing()}},l)}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)}sendPing(){this.pingTimestamp=performance.now(),this.pingSentAt=Date.now();const l={type:"ping"};this.sendJson(l)}sendJson(l){this.flushInput(),this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify(l))}sendInput(l){this.input.push(l)}flushInput(){this.input.flush()}sendBinary(l){this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(l)}sendText(l){const o=jd(l);this.sendInput(o)}}function i1(a){if(/^wss?:\/\//i.test(a))return a;if(/^https?:\/\//i.test(a)){const n=new URL(a);return n.protocol=n.protocol==="https:"?"wss:":"ws:",(!n.pathname||n.pathname==="/")&&(n.pathname=Rt),n.toString()}if(typeof window<"u"&&window.location){const l=window.location.protocol==="https:"?"wss:":"ws:",o=window.location.host,r=a.startsWith("/")?a:`/${a}`;return`${l}//${o}${r}`}return"ws://127.0.0.1:8787/ws/client"}class a1 extends n1{constructor(){super(...arguments);$(this,"currentRole","viewer");$(this,"controllerId");$(this,"hostId");$(this,"assignedClientId")}getRole(){return this.currentRole}getControllerId(){return this.controllerId}getHostId(){return this.hostId}getAssignedClientId(){return this.assignedClientId}handleServerMessage(l){switch(l.type){case"ready":{this.reconnectAttempts=0,this.setState("connected"),this.currentRole=l.role,this.controllerId=l.controllerId,this.hostId=l.hostId,this.assignedClientId=l.clientId,this.emit("ready",l),this.emit("roleChange",l.role,l.controllerId,l.hostId,l.clientId),typeof l.clientCount=="number"&&this.emit("peerCount",l.clientCount),this.emit("terminalFont",l.terminalFont??null);break}case"paired":{this.emit("paired",{token:l.token,deviceId:l.deviceId,hostId:l.hostId,expiresAt:l.expiresAt});break}case"control_state":{this.currentRole=l.role,this.controllerId=l.controllerId,this.emit("controlState",l.role,l.controllerId),this.emit("roleChange",l.role,l.controllerId,this.hostId,this.assignedClientId),typeof l.clientCount=="number"&&this.emit("peerCount",l.clientCount);break}case"host_reconnecting":{this.temporaryFailureCode="host_reconnecting",this.setState("reconnecting","Herdr host is reconnecting",l.code||"host_reconnecting"),this.emit("hostReconnecting",l.code);break}case"session_restarted":{this.setState("reconnecting","Herdr session is restarting","session_restarted"),this.emit("sessionRestarted",l.cols,l.rows,l.terminalPalette,l.hostname,l.platform,l.shellProfile,l.adminTerminalSupported,l.hostVersion,l.herdrPrefixKeys),this.emit("terminalFont",l.terminalFont??null);break}case"session_ready":{this.setState("connected"),this.emit("sessionReady",l);break}case"exit":{this.emit("exit",l.code,l.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"error":{l.code==="host_offline"||l.code==="host_reconnecting"||l.code==="host_reconnect_timeout"||l.code==="rate_limited"?(this.temporaryFailureCode=String(l.code),this.setState("reconnecting",l.message,String(l.code))):(l.code==="auth_required"||l.code==="unauthorized"||l.code==="device_revoked"||l.code==="invalid_handshake"||l.code==="too_many_hosts"||l.code===401||l.code===403)&&(this.authFailureDetail=l.message,this.authFailureCode=String(l.code),this.setState("error",l.message,this.authFailureCode)),this.emit("error",{code:l.code,message:l.message});break}case"paste_file_ready":{this.emit("pasteFileReady",l.path);break}case"agent_status":{this.emit("agentStatus",l);break}case"update_status":{this.emit("updateStatus",l);break}case"terminal_font":{this.emit("terminalFont",l.terminalFont??null);break}case"host_font_chunk":{this.emit("hostFontChunk",l);break}case"host_font_subset_ready":{this.emit("hostFontSubset",l);break}}}sendHello(){const l={type:"hello",protocol:1,clientId:this.config.clientId,cols:this.terminalCols,rows:this.terminalRows,capabilities:["host_handoff"]};this.config.token&&(l.token=this.config.token),this.config.pairCode&&(l.pairCode=this.config.pairCode),this.sendJson(l)}claimControl(l=!1){const o={type:"claim_control",...l?{force:!0}:{}};this.sendJson(o)}releaseControl(){const l={type:"release_control"};this.sendJson(l)}sendResize(l,o){this.terminalCols=l,this.terminalRows=o;const r={type:"resize",cols:l,rows:o};this.sendJson(r)}sendPasteFile(l,o){this.sendJson({type:"paste_file",mime:l,dataBase64:o})}sendHostFontChunkRequest(l,o){this.sendJson({type:"host_font_chunk_request",sha256:l,index:o})}sendHostFontSubsetRequest(l,o,r){this.sendJson({type:"host_font_subset_request",sha256:l,text:o,requestId:r})}sendHostFontRefresh(){this.sendJson({type:"host_font_refresh"})}sendHerdrStart(){this.sendJson({type:"herdr_start"})}sendAdminTabOpen(){this.sendJson({type:"admin_tab_open"})}}function l1(a,n,l){const o=T.useRef(l);if(o.current=l,!a.current){const r=new a1(n());for(const c of Object.keys(l)){const h=(...m)=>{var p,g;return(g=(p=o.current)[c])==null?void 0:g.call(p,...m)};r.on(c,h)}a.current=r}return a.current}const s1=3*1024*1024,Kb=1568,o1=[.85,.7,.55,.4],Vo={active:!1,phase:"idle",ratio:0,percent:0,statusText:""};function r1(a,n,l=Kb){if(a<=0||n<=0)return{width:Math.max(1,a),height:Math.max(1,n)};const o=Math.max(a,n);if(o<=l)return{width:a,height:n};const r=l/o;return{width:Math.max(1,Math.round(a*r)),height:Math.max(1,Math.round(n*r))}}function c1(a){if(typeof a!="string"||a.length===0)return 0;const n=a.length;let l=0;a.endsWith("==")?l=2:a.endsWith("=")&&(l=1);const o=Math.floor(n*3/4)-l;return Number.isFinite(o)&&o>0?o:0}function u1(a){return a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(1)} KB`:`${(a/(1024*1024)).toFixed(1)} MB`}async function d1(a){if(typeof createImageBitmap=="function")try{const n=await createImageBitmap(a,{imageOrientation:"from-image"});return{source:n,width:n.width,height:n.height,cleanup:()=>{typeof n.close=="function"&&n.close()}}}catch{try{const n=await createImageBitmap(a);return{source:n,width:n.width,height:n.height,cleanup:()=>{typeof n.close=="function"&&n.close()}}}catch{}}return new Promise((n,l)=>{if(typeof Image>"u")return l(new Error("Image decoding not supported in this environment"));const o=new Image,r=URL.createObjectURL(a);o.onload=()=>{n({source:o,width:o.naturalWidth||o.width,height:o.naturalHeight||o.height,cleanup:()=>{try{URL.revokeObjectURL(r)}catch{}}})},o.onerror=()=>{try{URL.revokeObjectURL(r)}catch{}l(new Error("Failed to decode image source"))},o.src=r})}async function Ib(a,n=Kb,l=s1){var r;if(!a||a.size===0||a.type&&!a.type.startsWith("image/"))return null;let o;try{o=await d1(a)}catch(c){return console.warn("Failed to decode image for paste:",c),null}try{const{width:c,height:h}=r1(o.width,o.height,n),m=document.createElement("canvas");m.width=c,m.height=h;const p=m.getContext("2d");if(!p)return null;p.drawImage(o.source,0,0,c,h);let g="image/webp";try{m.toDataURL("image/webp",.85).startsWith("data:image/webp")||(g="image/jpeg")}catch{g="image/jpeg"}for(const y of o1){let v;try{v=m.toDataURL(g,y)}catch{continue}if(!(v!=null&&v.startsWith("data:")))continue;const x=v.indexOf(","),w=x!==-1?v.slice(x+1):"",S=c1(w);if(S<=l)return{mime:g,dataBase64:w,dataUrl:v,byteLength:S,width:c,height:h}}return null}finally{(r=o.cleanup)==null||r.call(o)}}const f1=3e4,h1=1200;function m1({adapterRef:a,role:n,connectionState:l,warnViewerMode:o,addToast:r,t:c,sendPasteFile:h}){const[m,p]=T.useState(Vo),g=T.useRef(null),y=T.useRef(0),v=T.useRef(null),x=T.useCallback(()=>{v.current&&(clearTimeout(v.current),v.current=null)},[]),w=T.useCallback(()=>{x(),g.current=null,p(Vo)},[x]),S=T.useCallback(()=>{g.current!==null&&w()},[w]),M=T.useCallback(()=>{const k=g.current;k!==null&&(x(),p({active:!0,phase:"completed",ratio:1,percent:100,statusText:c("virtualKeyboard.uploadProgressCompleted")}),setTimeout(()=>{g.current===k&&(g.current=null,p(Vo))},h1))},[x,c]);T.useEffect(()=>{l!=="connected"&&S()},[l,S]),T.useEffect(()=>x,[x]);const N=T.useCallback(async k=>{if(n!=="controller")return o(),!1;if(!a.current||l!=="connected")return r("error",c("serverErrors.host_offline")),!1;if(g.current!==null)return!1;const E=++y.current;g.current=E,x();const R=j=>(j&&r("error",j),g.current=null,p(Vo),!1),H="dataBase64"in k&&typeof k.dataBase64=="string";try{let j;if(H)j=k;else{const _=k;if(p({active:!0,phase:"reading",ratio:.1,percent:10,statusText:c("virtualKeyboard.uploadProgressReading")}),!_||_.size===0)return R(c("clipboard.fileEmpty"));if(_.type&&!_.type.startsWith("image/"))return R(c("clipboard.unsupportedType"));p({active:!0,phase:"processing",ratio:.35,percent:35,statusText:c("virtualKeyboard.uploadProgressProcessing")});const z=await Ib(_);if(g.current!==E)return!1;if(!z)return R(c("clipboard.imageTooLarge"));j=z,p({active:!0,phase:"processing",ratio:.6,percent:60,statusText:c("virtualKeyboard.uploadProgressProcessing")})}p({active:!0,phase:"sending",ratio:.75,percent:75,statusText:c("virtualKeyboard.uploadProgressSending")});const D=h(j.mime,j.dataBase64);return g.current!==E?!1:D?(p({active:!0,phase:"waitingHost",ratio:.88,percent:88,statusText:c("virtualKeyboard.uploadProgressWaitingHost")}),v.current=setTimeout(()=>{g.current===E&&R(c("serverErrors.paste_file_write_failed"))},f1),!0):R()}catch(j){return console.error("Failed to process/upload image:",j),g.current===E&&R(c("clipboard.imageTooLarge")),!1}},[a,n,l,o,r,c,h,x]);return{uploadProgress:m,uploadImage:N,resetUploadProgress:w,abortUpload:S,completeUpload:M}}const p1=4096,g1=8*1024*1024;function b1(){const a=T.useRef(null),n=T.useRef([]),l=T.useRef(0),o=T.useCallback(p=>{for(n.current.push(p),l.current+=p.byteLength;n.current.length>p1||l.current>g1;){const g=n.current.shift();if(!g)break;l.current-=g.byteLength}},[]),r=T.useCallback(p=>{const g=a.current;if(g)try{g(p);return}catch(y){console.debug("Terminal output sink threw, buffering chunk instead:",y)}o(p)},[o]),c=T.useCallback(p=>{a.current=p;const g=n.current;n.current=[],l.current=0;for(let y=0;y<g.length;y++)try{p(g[y])}catch(v){console.debug("Terminal sink threw while flushing, re-buffering the tail:",v);for(let x=y;x<g.length;x++)o(g[x]);break}return()=>{a.current===p&&(a.current=null)}},[o]),h=T.useCallback(()=>n.current.length,[]),m=T.useCallback(()=>{n.current=[],l.current=0},[]);return{receiveOutput:r,subscribeToOutput:c,getPendingOutputChunkCount:h,clearPendingOutput:m}}const vg=["fontSize","fontSizeFollowsHost","fontFamily","toolbarVisible","toolbarPosition","vibrateOnKeyPress","predictiveEcho","virtualKeys","agentAlertBadge","agentAlertSound","agentAlertVibrate","agentAlertNotify"],y1=["agentKeymaps"],v1=64;function x1(a,n){const l=a,o={};for(const r of n)l[r]!==void 0&&(o[r]=l[r]);return o}function nl(a,n){return x1(a,n==="local"?[...vg,...y1]:vg)}function mr(a,n,l){const o=Object.create(null);if(!a||typeof a!="object"||Array.isArray(a))return o;for(const[r,c]of Object.entries(a).slice(0,v1))(r===""?n.length>0:!n.includes(r))||!c||typeof c!="object"||Array.isArray(c)||(o[r]=nl(c,l));return o}const Fb=64,vs=4096;function zd(){const a=Math.random().toString(36).substring(2,10);return`profile-${Date.now().toString(36)}-${a}`}function w1(a,n){return(typeof a=="string"?a.trim().slice(0,Fb):"")||n}function pr(a,n){if(!a||typeof a!="object"||Array.isArray(a))return null;const l=a,o=typeof l.wsUrl=="string"?l.wsUrl.trim().slice(0,2048):"",r=typeof l.token=="string"?l.token.slice(0,vs):"",c=typeof l.pairCode=="string"?l.pairCode.trim().toUpperCase().slice(0,32):"";if(!o||!o.startsWith("/")&&!/^(?:wss?|https?):\/\//i.test(o)||!r&&!c)return null;const h=Date.now(),m=typeof l.id=="string"&&l.id.length>0?l.id.slice(0,128):zd(),p=typeof l.hostname=="string"&&l.hostname.trim()?l.hostname.trim().slice(0,Fb):`Herdr ${n+1}`;return{id:m,displayName:w1(l.displayName,p),wsUrl:o,token:r,...c?{pairCode:c}:{},...typeof l.hostId=="string"&&l.hostId.trim()?{hostId:l.hostId.trim().slice(0,128)}:{},...typeof l.hostname=="string"&&l.hostname.trim()?{hostname:l.hostname.trim().slice(0,128)}:{},...typeof l.deviceId=="string"&&l.deviceId.trim()?{deviceId:l.deviceId.trim().slice(0,128)}:{},autoReconnect:l.autoReconnect!==!1,createdAt:Number.isFinite(l.createdAt)?Number(l.createdAt):h,lastUsedAt:Number.isFinite(l.lastUsedAt)?Number(l.lastUsedAt):h}}function xg(a,n=0){const l=pr({...a,id:a.id||zd()},n);if(!l)throw new Error("a connection profile requires a relay URL and token or pairing code");return l}function wg(a){let n=a.wsUrl.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"").toLowerCase();if(typeof window<"u")try{const l=new URL(a.wsUrl,window.location.origin);l.protocol=l.protocol==="wss:"?"https:":"http:",l.pathname=l.pathname.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"")||"/",l.search="",l.hash="",n=l.toString().replace(/\/$/,"").toLowerCase()}catch{}return`${n}::${a.hostId||""}`}function Gb(a){var c;const n=[];if((Array.isArray(a.profiles)?a.profiles.slice(0,64):[]).forEach((h,m)=>{const p=pr(h,m);p&&!n.some(g=>g.id===p.id)&&n.push(p)}),n.length===0&&(typeof a.token=="string"&&a.token||typeof a.pairCode=="string"&&a.pairCode)){const h=pr({id:"profile-migrated",displayName:"Herdr 1",wsUrl:typeof a.wsUrl=="string"&&a.wsUrl.trim()?a.wsUrl:Rt,token:a.token||"",pairCode:a.pairCode||"",autoReconnect:a.autoReconnect!==!1},0);h&&n.push(h)}const o=typeof a.activeProfileId=="string"?a.activeProfileId:"",r=n.some(h=>h.id===o)?o:((c=n[0])==null?void 0:c.id)||"";return{profiles:n,activeProfileId:r}}const Yb=[{id:"esc",label:"ESC",code:oe.ESC,type:"key",enabled:!0,title:"Escape"},{id:"tab",label:"TAB",code:oe.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:oe.LEFT,type:"key",enabled:!0,title:"Arrow Left"},{id:"up",label:"↑",code:oe.UP,type:"key",enabled:!0,title:"Arrow Up"},{id:"down",label:"↓",code:oe.DOWN,type:"key",enabled:!0,title:"Arrow Down"},{id:"right",label:"→",code:oe.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:oe.ENTER,type:"key",enabled:!0,title:"Enter / Return"}],S1=[{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:oe.ESC,type:"key",enabled:!0,title:"Escape"},{id:"tab",label:"TAB",code:oe.TAB,type:"key",enabled:!0,title:"Tab"},{id:"shift_tab",label:"⇧TAB",code:oe.SHIFT_TAB,type:"key",enabled:!0,title:"Shift+Tab"},{id:"enter",label:"Enter",code:oe.ENTER,type:"key",enabled:!0,title:"Enter / Return"},{id:"backspace",label:"⌫",code:oe.BACKSPACE,type:"key",enabled:!0,title:"Backspace"},{id:"delete",label:"Del",code:oe.DELETE,type:"key",enabled:!0,title:"Delete"},{id:"left",label:"←",code:oe.LEFT,type:"key",enabled:!0,title:"Arrow Left"},{id:"up",label:"↑",code:oe.UP,type:"key",enabled:!0,title:"Arrow Up"},{id:"down",label:"↓",code:oe.DOWN,type:"key",enabled:!0,title:"Arrow Down"},{id:"right",label:"→",code:oe.RIGHT,type:"key",enabled:!0,title:"Arrow Right"},{id:"home",label:"Home",code:oe.HOME,type:"key",enabled:!0,title:"Home"},{id:"end",label:"End",code:oe.END,type:"key",enabled:!0,title:"End"},{id:"page_up",label:"PgUp",code:oe.PAGE_UP,type:"key",enabled:!0,title:"Page Up"},{id:"page_down",label:"PgDn",code:oe.PAGE_DOWN,type:"key",enabled:!0,title:"Page Down"},{id:"insert",label:"Ins",code:oe.INSERT,type:"key",enabled:!0,title:"Insert"},{id:"ctrl_c",label:"^C",code:oe.CTRL_C,type:"chord",enabled:!0,title:"Ctrl+C (SIGINT)"},{id:"ctrl_d",label:"^D",code:oe.CTRL_D,type:"chord",enabled:!0,title:"Ctrl+D (EOF/Exit)"},{id:"ctrl_z",label:"^Z",code:oe.CTRL_Z,type:"chord",enabled:!0,title:"Ctrl+Z (SIGTSTP)"},{id:"ctrl_l",label:"^L",code:oe.CTRL_L,type:"chord",enabled:!0,title:"Ctrl+L (Clear Screen)"},{id:"ctrl_a",label:"^A",code:oe.CTRL_A,type:"chord",enabled:!0,title:"Ctrl+A (Beginning of Line)"},{id:"ctrl_e",label:"^E",code:oe.CTRL_E,type:"chord",enabled:!0,title:"Ctrl+E (End of Line)"},{id:"ctrl_k",label:"^K",code:oe.CTRL_K,type:"chord",enabled:!0,title:"Ctrl+K (Kill to End)"},{id:"ctrl_r",label:"^R",code:oe.CTRL_R,type:"chord",enabled:!0,title:"Ctrl+R (Reverse Search)"},{id:"f1",label:"F1",code:oe.F1,type:"fn",enabled:!0,title:"F1"},{id:"f2",label:"F2",code:oe.F2,type:"fn",enabled:!0,title:"F2"},{id:"f3",label:"F3",code:oe.F3,type:"fn",enabled:!0,title:"F3"},{id:"f4",label:"F4",code:oe.F4,type:"fn",enabled:!0,title:"F4"},{id:"f5",label:"F5",code:oe.F5,type:"fn",enabled:!0,title:"F5"},{id:"f6",label:"F6",code:oe.F6,type:"fn",enabled:!0,title:"F6"},{id:"f7",label:"F7",code:oe.F7,type:"fn",enabled:!0,title:"F7"},{id:"f8",label:"F8",code:oe.F8,type:"fn",enabled:!0,title:"F8"},{id:"f9",label:"F9",code:oe.F9,type:"fn",enabled:!0,title:"F9"},{id:"f10",label:"F10",code:oe.F10,type:"fn",enabled:!0,title:"F10"},{id:"f11",label:"F11",code:oe.F11,type:"fn",enabled:!0,title:"F11"},{id:"f12",label:"F12",code:oe.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 xs(){return JSON.parse(JSON.stringify(Yb))}const C1=[["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 T1(a){return C1.some(n=>a.length===n.length&&a.every((l,o)=>l.id===n[o]&&l.enabled!==!1))}function M1(a){if(!Array.isArray(a)||a.length===0)return xs();const n=a.filter(l=>typeof l=="object"&&l!==null&&typeof l.id=="string"&&typeof l.label=="string"&&typeof l.code=="string");return T1(n)?xs():n.filter(l=>l.id!=="drawer_agent")}function gd(a,n){if(n){const l=`keyTitles.${a.id}`,o=n(l);if(o&&o!==l)return o}return a.title||a.label}const Sg="herdr-remote.ignoredUpdate";function A1(){const a=ys("local",Et.ignoredUpdate);if(a!==null)return a;const n=ys("local",Sg);if(n===null)return null;Pb(n);try{window.localStorage.removeItem(Sg)}catch{}return n}function Pb(a){_i("local",Et.ignoredUpdate,a)}function E1(){return`client-${Math.random().toString(36).substring(2,8)}`}function Vb(){return typeof navigator<"u"&&navigator.language&&navigator.language.toLowerCase().startsWith("zh")?"zh":"en"}function $b(){const a=typeof window<"u"&&window.innerWidth<640;return{wsUrl:Rt,token:"",pairCode:"",clientId:E1(),autoReconnect:!0,profiles:[],activeProfileId:"",fontSize:a?dr:bs,fontSizeFollowsHost:!0,fontFamily:Nb,toolbarVisible:!0,toolbarPosition:"bottom",vibrateOnKeyPress:!0,predictiveEcho:"auto",agentAlertBadge:!0,agentAlertSound:!1,agentAlertVibrate:!1,agentAlertNotify:!1,language:Vb(),virtualKeys:xs(),agentKeymaps:{},observerMode:!1,adminToken:"",adminTokens:{}}}const N1=["wsUrl","token","pairCode","clientId","autoReconnect","language"],k1=["wsUrl","token","pairCode","autoReconnect"],Cg=["theme","colorMode"];function qb(a){const n=a;if(!Cg.some(r=>n[r]!==void 0))return{data:a,changed:!1};const o={...n};for(const r of Cg)delete o[r];return{data:o,changed:!0}}function Xb(a){if(!a||typeof a!="object"||Array.isArray(a))return{};const n={};for(const[l,o]of Object.entries(a).slice(0,32))typeof o!="string"||o.length===0||(n[l.slice(0,512)]=o.slice(0,vs));return n}function gr(a,n){const l=ys(a,n);if(!l)return{};try{const o=JSON.parse(l);return o&&typeof o=="object"&&!Array.isArray(o)?o:{}}catch(o){return console.warn(`Failed to parse ${a}Storage settings:`,o),{}}}function br(){const a=$b();if(typeof window>"u")return a;let n=gr("local",Et.settings);const l=qb(n);l.changed&&(n=l.data,_i("local",Et.settings,JSON.stringify(n)));const o=gr("session",Et.sessionView),r=Gb(n),c=r.profiles.map(te=>te.id),h=typeof o.activeProfileId=="string"&&c.includes(o.activeProfileId)?o.activeProfileId:r.activeProfileId,m=r.profiles.find(te=>te.id===h),p={...nl(n,"local"),...mr(n.instances,c,"local")[h]},g=mr(o.instances,c,"session");let y=g[h];y||(y=nl({...p,...nl(o,"session")},"session"),g[h]=y,_i("session",Et.sessionView,JSON.stringify({activeProfileId:h,instances:g,observerMode:o.observerMode,adminToken:o.adminToken,adminTokens:o.adminTokens})));const v={...p,...y},x=Vu(v.fontFamily??a.fontFamily),w=window.innerWidth<640?dr:bs,S=v.fontSize??a.fontSize,M=al(S,w),N=v.fontSizeFollowsHost,k=typeof N=="boolean"?N:M===bs||M===dr,E=M1(v.virtualKeys??a.virtualKeys),R=n.language??a.language,H=R==="zh"||R==="en"?R:Vb(),j=te=>{const Z=v[te];return typeof Z=="boolean"?Z:a[te]},D=v.predictiveEcho??a.predictiveEcho,_=D==="always"||D==="off"||D==="auto"?D:"auto",z=typeof o.adminToken=="string"?o.adminToken.slice(0,vs):typeof n.adminToken=="string"?n.adminToken.slice(0,vs):a.adminToken,K=Xb(o.adminTokens),q={...a,wsUrl:(m==null?void 0:m.wsUrl)||(typeof n.wsUrl=="string"?n.wsUrl:a.wsUrl),token:(m==null?void 0:m.token)||"",pairCode:(m==null?void 0:m.pairCode)||"",autoReconnect:(m==null?void 0:m.autoReconnect)??a.autoReconnect,profiles:r.profiles,activeProfileId:h,clientId:typeof n.clientId=="string"&&n.clientId.trim()?n.clientId.trim().slice(0,128):a.clientId,fontFamily:x,fontSize:M,fontSizeFollowsHost:k,toolbarVisible:v.toolbarVisible??a.toolbarVisible,toolbarPosition:v.toolbarPosition??a.toolbarPosition,vibrateOnKeyPress:v.vibrateOnKeyPress??a.vibrateOnKeyPress,predictiveEcho:_,virtualKeys:E,agentKeymaps:Eb(v.agentKeymaps),agentAlertBadge:j("agentAlertBadge"),agentAlertSound:j("agentAlertSound"),agentAlertVibrate:j("agentAlertVibrate"),agentAlertNotify:j("agentAlertNotify"),language:H,observerMode:o.observerMode===!0,adminToken:z,adminTokens:K};return typeof n.fontFamily=="string"&&Vu(n.fontFamily)!==n.fontFamily&&(n.fontFamily=Vu(n.fontFamily),_i("local",Et.settings,JSON.stringify(n))),q}function Ei(a){var M;const n=br(),l={...n,...a};l.agentKeymaps=Eb(l.agentKeymaps),l.adminTokens=Xb(l.adminTokens),typeof l.adminToken=="string"&&(l.adminToken=l.adminToken.slice(0,vs)),a.fontSize!==void 0&&(l.fontSize=al(a.fontSize)),a.predictiveEcho!==void 0&&(a.predictiveEcho==="auto"||a.predictiveEcho==="always"||a.predictiveEcho==="off"?l.predictiveEcho=a.predictiveEcho:l.predictiveEcho="auto");const o=Gb(l);let r=o.profiles,c=o.activeProfileId;if(k1.some(N=>a[N]!==void 0)){const N=r.findIndex(R=>R.id===c),k=N>=0?{...r[N]}:{id:zd(),displayName:`Herdr ${r.length+1}`,wsUrl:l.wsUrl,token:"",autoReconnect:!0,createdAt:Date.now(),lastUsedAt:Date.now()};k.wsUrl=l.wsUrl,k.token=l.token,k.pairCode=l.pairCode||void 0,k.autoReconnect=l.autoReconnect,k.lastUsedAt=Date.now();const E=pr(k,Math.max(N,0));E?N>=0?r[N]=E:(r.push(E),c=E.id):N>=0&&(r=r.filter(R=>R.id!==c),c=((M=r[0])==null?void 0:M.id)||"")}r.length>0&&!r.some(N=>N.id===c)&&(c=r[0].id);const m=r.find(N=>N.id===c);l.wsUrl=(m==null?void 0:m.wsUrl)||l.wsUrl||Rt,l.token=(m==null?void 0:m.token)||"",l.pairCode=(m==null?void 0:m.pairCode)||"",l.autoReconnect=(m==null?void 0:m.autoReconnect)??l.autoReconnect;const p=r.map(N=>N.id),g=qb(gr("local",Et.settings)).data,y=gr("session",Et.sessionView),v=mr(g.instances,p,"local"),x=mr(y.instances,p,"session"),S=c===n.activeProfileId||!n.activeProfileId?l:a;v[c]={...v[c],...nl(S,"local")},x[c]={...x[c],...nl(S,"session")};for(const N of N1)l[N]!==void 0&&(g[N]=l[N]);return g.profiles=r,g.instances=v,(c!==n.activeProfileId||!p.includes(g.activeProfileId??""))&&(g.activeProfileId=c),_i("local",Et.settings,JSON.stringify(g)),_i("session",Et.sessionView,JSON.stringify({activeProfileId:c,instances:x,observerMode:l.observerMode===!0,adminToken:l.adminToken,adminTokens:l.adminTokens})),br()}function L1(a){const[n,l]=T.useState(br),o=T.useRef(n);o.current=n;const r=T.useRef(a);r.current=a;const c=T.useCallback(w=>{const S=Ei(w);o.current=S,l(S)},[]),h=T.useCallback(w=>{o.current=w,l(w)},[]),m=T.useCallback(w=>{const S=o.current,M=xg({...w,wsUrl:w.wsUrl||Rt,token:w.token||"",displayName:w.displayName||`Herdr ${S.profiles.length+1}`,autoReconnect:w.autoReconnect!==!1},S.profiles.length),N=Ei({profiles:[...S.profiles,M],activeProfileId:M.id,wsUrl:M.wsUrl,token:M.token,pairCode:M.pairCode||"",autoReconnect:M.autoReconnect});h(N),r.current(N)},[h]),p=T.useCallback(w=>{const S=o.current,M=S.profiles.find(k=>k.id===w);if(!M||M.id===S.activeProfileId)return;const N=Ei({activeProfileId:M.id,wsUrl:M.wsUrl,token:M.token,pairCode:M.pairCode||"",autoReconnect:M.autoReconnect,profiles:S.profiles.map(k=>k.id===M.id?{...k,lastUsedAt:Date.now()}:k)});h(N),r.current(N)},[h]),g=T.useCallback((w,S)=>{const M=o.current;if(!M.profiles.find(R=>R.id===w))return;const k=S.trim().slice(0,64);if(!k)return;const E=Ei({profiles:M.profiles.map(R=>R.id===w?{...R,displayName:k}:R)});h(E)},[h]),y=T.useCallback(w=>{const S=o.current;if(!S.profiles.some(E=>E.id===w))return;const M=S.profiles.filter(E=>E.id!==w),N=M.find(E=>E.id===S.activeProfileId)||M[0],k=Ei(N?{profiles:M,activeProfileId:N.id,wsUrl:N.wsUrl,token:N.token,pairCode:N.pairCode||"",autoReconnect:N.autoReconnect}:{profiles:[],activeProfileId:"",wsUrl:Rt,token:"",pairCode:""});h(k),w===S.activeProfileId&&r.current(k)},[h]),v=T.useCallback(w=>{const S=o.current,M=S.profiles.find(z=>z.id===S.activeProfileId),N=w.hostId?wg({wsUrl:S.wsUrl,hostId:w.hostId}):null,k=N?S.profiles.findIndex(z=>wg(z)===N):-1,E=k>=0?k:Math.max(0,S.profiles.findIndex(z=>z.id===S.activeProfileId)),H={...S.profiles[E]||M||xg({wsUrl:S.wsUrl||Rt,token:"",pairCode:S.pairCode||"PENDING",displayName:`Herdr ${S.profiles.length+1}`},S.profiles.length),token:w.token,pairCode:void 0,...w.hostId?{hostId:w.hostId}:{},...w.deviceId?{deviceId:w.deviceId}:{},lastUsedAt:Date.now()};let j=[...S.profiles];E>=0&&E<j.length?j[E]=H:j.push(H);const D=M==null?void 0:M.id;j=j.filter((z,K)=>K===E||z.id===H.id?!0:!(k>=0&&D&&z.id===D));const _=Ei({profiles:j,activeProfileId:H.id,wsUrl:H.wsUrl,token:H.token,pairCode:"",autoReconnect:H.autoReconnect});return h(_),_},[h]),x=T.useCallback(w=>{const S=o.current,M=S.profiles.find(R=>R.id===S.activeProfileId);if(!M||!w.hostId&&!w.hostname)return;const N=/^Herdr \d+$/.test(M.displayName),k={...M,...w.hostId?{hostId:w.hostId}:{},...w.hostname?{hostname:w.hostname}:{},...w.hostname&&N?{displayName:w.hostname}:{}},E=Ei({profiles:S.profiles.map(R=>R.id===M.id?k:R)});h(E)},[h]);return{settings:n,updateSettings:c,addProfileAndConnect:m,switchProfile:p,renameProfile:g,removeProfile:y,savePairedProfile:v,noteReadyProfile:x}}const $o={ctrl:!1,alt:!1,shift:!1};function _1({adapterRef:a,role:n,addToast:l,tRef:o}){const[r,c]=T.useState({cols:80,rows:24}),h=T.useRef(r);h.current=r;const m=T.useRef(new Set),p=T.useRef(new Set),g=T.useRef(!0);T.useEffect(()=>{n==="controller"&&(g.current=!0)},[n]);const y=T.useCallback(()=>{g.current&&(g.current=!1,l("warning",o.current("toasts.viewerModeWarning")))},[l,o]),v=T.useCallback(_=>{if(n!=="controller"){y();return}const z=a.current;if(!z)return;const K=jd(_);for(const q of p.current)try{q(K)}catch(te){console.debug("Key input observer threw:",te)}z.sendInput(K)},[a,n,y]),x=T.useCallback(_=>(p.current.add(_),()=>{p.current.delete(_)}),[]),[w,S]=T.useState($o),M=T.useRef($o),N=T.useCallback(_=>{const z={...M.current,[_]:!M.current[_]};M.current=z,S(z)},[]),k=T.useCallback(()=>{const _=M.current;return!_.ctrl&&!_.alt&&!_.shift?null:(M.current=$o,S($o),_)},[]),E=T.useCallback(_=>{var z;n!=="controller"&&!hr(_)||(z=a.current)==null||z.sendInput(_)},[a,n]),R=T.useCallback((_,z)=>{var K;h.current={cols:_,rows:z},c({cols:_,rows:z}),(K=a.current)==null||K.sendResize(_,z)},[a]),H=T.useCallback((_,z)=>n!=="controller"?(y(),!1):a.current?(a.current.sendPasteFile(_,z),!0):!1,[a,n,y]),j=T.useCallback(_=>(m.current.add(_),()=>{m.current.delete(_)}),[]),D=T.useCallback(_=>{for(const z of m.current)try{z(_)}catch(K){console.error("Error in pasteFileReady listener:",K)}},[]);return{terminalDimensions:r,dimensionsRef:h,warnViewerMode:y,sendKey:v,observeKeyInput:x,modifierLatch:w,toggleModifierLatch:N,consumeModifierLatch:k,sendBinary:E,sendResize:R,sendPasteFile:H,subscribeToPasteFileReady:j,notifyPasteFileReady:D}}const R1=4e3,j1=3;function O1(){const[a,n]=T.useState([]),l=T.useRef([]),o=T.useRef(new Map),r=T.useCallback(m=>{l.current=m,n(m)},[]),c=T.useCallback(m=>{const p=o.current.get(m);p&&(clearTimeout(p),o.current.delete(m)),r(l.current.filter(g=>g.id!==m))},[r]),h=T.useCallback((m,p)=>{const g=Date.now(),y=l.current,v=y.find(M=>M.type===m&&M.message===p),x=v?v.id:`${g}-${Math.random().toString(36).substring(2,6)}`;let w;if(v)w=y.map(M=>M.id===x?{...M,count:M.count+1,timestamp:g}:M);else for(w=[...y,{id:x,type:m,message:p,timestamp:g,count:1}];w.length>j1;){const[M,...N]=w,k=o.current.get(M.id);k&&(clearTimeout(k),o.current.delete(M.id)),w=N}r(w);const S=o.current.get(x);S&&clearTimeout(S),o.current.set(x,setTimeout(()=>c(x),R1))},[r,c]);return T.useEffect(()=>{const m=o.current;return()=>{for(const p of m.values())clearTimeout(p);m.clear()}},[]),{toasts:a,addToast:h,removeToast:c}}function D1(a,n){const[l,o]=T.useState(null),[r,c]=T.useState(A1),h=T.useRef(r),m=T.useRef(new Set),p=T.useCallback(x=>{h.current=x,c(x),Pb(x)},[]),g=T.useCallback(x=>{if(o(x),!x.updateAvailable||h.current===x.latest)return;const w=`${x.latest}:${x.restartPending?"restart":"update"}`;m.current.has(w)||(m.current.add(w),a("info",x.restartPending?n.current("update.toastRestart",{version:x.latest}):n.current("update.toast",{version:x.latest})))},[a,n]),y=T.useCallback(()=>o(null),[]),v=T.useCallback((x,w)=>{if(x!==null)return;const S=`outdated:${w||""}`;m.current.has(S)||(m.current.add(S),a("warning",n.current("update.toastOutdated",{host:w||n.current("update.thisHost")})))},[a,n]);return{updateStatus:l,ignoredUpdate:r,ignoreUpdate:p,receiveUpdateStatus:g,forgetUpdateStatus:y,noteHostVersion:v}}const Zb=T.createContext(null),Wb=T.createContext(null),Qb=T.createContext(null),Jb=T.createContext(null),ey=T.createContext(null),z1=({children:a})=>{var _s;const[n,l]=T.useReducer(Iw,Kw),o=T.useRef(null),r=T.useRef(!1);T.useEffect(()=>{kb()},[]);const{receiveOutput:c,subscribeToOutput:h,getPendingOutputChunkCount:m,clearPendingOutput:p}=b1(),{toasts:g,addToast:y,removeToast:v}=O1(),x=T.useCallback(()=>{p(),l({type:"reset",resetTerminal:!0})},[p]),{settings:w,updateSettings:S,addProfileAndConnect:M,switchProfile:N,renameProfile:k,removeProfile:E,savePairedProfile:R,noteReadyProfile:H}=L1(de=>{var qe;x(),(qe=o.current)==null||qe.reconnectWith(Po(de))}),j=T.useCallback((de,qe)=>Rd(w.language,de,qe),[w.language]),D=T.useRef(j);D.current=j;const{herdrLaunch:_,startHerdr:z,handleLaunchError:K,forgetHerdrLaunch:q}=Gw(o,D),{updateStatus:te,ignoredUpdate:Z,ignoreUpdate:ie,receiveUpdateStatus:re,forgetUpdateStatus:P,noteHostVersion:A}=D1(y,D),G=w.observerMode?"viewer":n.role,W=_1({adapterRef:o,role:G,addToast:y,tRef:D}),{uploadProgress:se,uploadImage:Q,resetUploadProgress:ge,abortUpload:ye,completeUpload:ue}=m1({adapterRef:o,role:G,connectionState:n.connectionState,warnViewerMode:W.warnViewerMode,addToast:y,t:j,sendPasteFile:W.sendPasteFile}),Te=l1(o,()=>Po(w),{stateChange:(de,qe,Lt)=>{const It=Pu(Lt)?j(`serverErrors.${Lt}`):qe;l({type:"stateChange",state:de,detail:It,code:Lt}),de==="connected"?y("success",j("toasts.connected")):de==="error"&&y("error",It||j("toasts.connectionError")),de!=="connected"&&q()},ready:de=>{const qe=r.current;qe&&p(),r.current=!0,q(),P(),l({type:"ready",message:de,resetTerminal:qe}),H(de),A(de.hostVersion,de.hostname||de.hostId)},hostReconnecting:de=>{l({type:"hostReconnecting",code:de||"host_reconnecting",detail:j(`serverErrors.${Pu(de)?de:"host_reconnecting"}`)}),p()},sessionRestarted:(de,qe,Lt,It,ca,Ln,ua,ni,Er)=>{var ml;p(),l({type:"sessionRestarted",hostname:It,palette:Lt,platform:ca,shellProfile:Ln,adminTerminalSupported:ua,hostVersion:ni,herdrPrefixKeys:Er}),A(ni,It),H({hostId:(ml=o.current)==null?void 0:ml.getHostId(),hostname:It})},roleChange:(de,qe,Lt,It)=>{l({type:"roleChange",role:de,controllerId:qe,hostId:Lt,assignedClientId:It})},controlGranted:()=>{l({type:"controlGranted"}),y("success",j("toasts.controlGranted"))},paired:de=>{var Lt;const qe=R(de);y("success",j("toasts.pairedSuccess")),l({type:"paired",at:Date.now()}),(Lt=o.current)==null||Lt.reconnectWith(Po(qe))},exit:(de,qe)=>{y("info",`${j("toasts.sessionEnded")}${qe?`: ${qe}`:""}${de!=null?` (${de})`:""}`)},error:de=>{if(K(de)||de.code==="host_font_unavailable")return;ye();const qe=Pu(de.code)?j(`serverErrors.${de.code}`):de.message||`[${de.code}]`;y("error",qe)},pasteFileReady:de=>{ue(),W.notifyPasteFileReady(de)},rttUpdate:de=>l({type:"rtt",rttMs:de}),peerCount:de=>l({type:"peerCount",count:de}),sessionReady:()=>{l({type:"sessionReady"}),q()},agentStatus:de=>l({type:"agentStatus",status:de}),updateStatus:re,binaryData:c}),{activeProfileId:ce}=w,be=w.profiles.find(de=>de.id===ce),{hostFont:ae,loadHostFont:we,declineHostFont:le,syncHostFont:ve,ensureHostGlyphs:Ne}=zw(Te),Ie=T.useCallback(()=>{we()},[we]),Xe=pw(w.fontFamily,ae.font?{family:ae.font.family,alias:ae.status==="loaded"?ae.alias:null,glyphs:ae.glyphs.source?{family:ae.glyphs.source.family,scope:ae.glyphs.source.scope,alias:ae.glyphs.alias}:null}:null),tt=w.fontSizeFollowsHost&&((_s=ae.font)!=null&&_s.sizePx)?al(ae.font.sizePx,w.fontSize):w.fontSize;T.useEffect(()=>{document.documentElement.style.setProperty("--tui-font",Xe)},[Xe]),T.useEffect(()=>{var de;(de=o.current)==null||de.updateConfig(Po(w))},[w]),T.useEffect(()=>{const de=o.current;return de?Hw(de):void 0},[]);const{dimensionsRef:xe}=W,Ae=T.useCallback(de=>{o.current&&(de&&o.current.updateConfig(de),o.current.connect(xe.current))},[xe]),st=T.useCallback(()=>{var de;(de=o.current)==null||de.disconnect()},[]),it=T.useCallback((de=!1)=>{var qe;(qe=o.current)==null||qe.claimControl(de)},[]),bt=T.useCallback(()=>{var de;(de=o.current)==null||de.releaseControl()},[]),yn=T.useCallback(de=>S({language:de}),[S]),vn=T.useMemo(()=>({settings:w,updateSettings:S,language:w.language,setLanguage:yn,t:j,profiles:w.profiles,activeProfileId:ce,activeProfile:be,switchProfile:N,addProfileAndConnect:M,renameProfile:k,removeProfile:E,hostFont:ae,loadHostFont:Ie,declineHostFont:le,syncHostFont:ve,ensureHostGlyphs:Ne,terminalFontFamily:Xe,terminalFontSize:tt}),[w,S,yn,j,ce,be,N,M,k,E,ae,Ie,le,ve,Ne,Xe,tt]),kn=T.useMemo(()=>{var de;return{...n,role:G,isController:G==="controller",agentProfile:qx((de=n.agentStatus)==null?void 0:de.focusedAgent,"auto"),reportShellProfile:qe=>l({type:"shellProfile",profile:qe}),adapter:Te,connect:Ae,disconnect:st,claimControl:it,releaseControl:bt,herdrLaunch:_,startHerdr:z,updateStatus:te,ignoredUpdate:Z,ignoreUpdate:ie}},[n,G,Te,Ae,st,it,bt,_,z,te,Z,ie]),Zt=T.useMemo(()=>({toasts:g,addToast:y,removeToast:v}),[g,y,v]),{terminalDimensions:ut,sendKey:Es,observeKeyInput:dl,modifierLatch:fl,toggleModifierLatch:Di,consumeModifierLatch:Ns,sendBinary:hl,sendResize:ks,warnViewerMode:Ls,sendPasteFile:ti,subscribeToPasteFileReady:At}=W,xn=T.useMemo(()=>({terminalDimensions:ut,sendKey:Es,observeKeyInput:dl,modifierLatch:fl,toggleModifierLatch:Di,consumeModifierLatch:Ns,sendBinary:hl,sendResize:ks,warnViewerMode:Ls,sendPasteFile:ti,subscribeToPasteFileReady:At,subscribeToOutput:h,getPendingOutputChunkCount:m}),[ut,Es,dl,fl,Di,Ns,hl,ks,Ls,ti,At,h,m]),kt=T.useMemo(()=>({uploadProgress:se,uploadImage:Q,resetUploadProgress:ge}),[se,Q,ge]);return f.jsx(Zb.Provider,{value:vn,children:f.jsx(Wb.Provider,{value:kn,children:f.jsx(Qb.Provider,{value:Zt,children:f.jsx(Jb.Provider,{value:xn,children:f.jsx(ey.Provider,{value:kt,children:a})})})})})};function Ts(a,n){const l=T.useContext(a);if(!l)throw new Error(`${n} must be used within a TerminalProvider`);return l}const Ee=()=>Ts(Zb,"useSettings"),et=()=>Ts(Wb,"useConnection"),Xt=()=>Ts(Qb,"useToasts"),Ms=()=>Ts(Jb,"useTerminalIO"),Cr=()=>Ts(ey,"useUpload");function ws(a){var n,l;return a?{blocked:((n=a.counts)==null?void 0:n.blocked)??0,done:((l=a.counts)==null?void 0:l.done)??0}:null}function H1(a){return a?a.blocked>0?"blocked":a.done>0?"done":null:null}function B1(a){if(!a)return"";const n=[];return a.blocked>0&&n.push(`${a.blocked}⚠`),a.done>0&&n.push(`${a.done}✓`),n.length>0?`(${n.join(" ")})`:""}function U1(a,n){if(!a||!n)return null;const l=new Map(a.agents.map(h=>[h.paneId,h.status]));let o=null;for(const h of n.agents)if(!(h.status!=="blocked"&&h.status!=="done")&&l.get(h.paneId)!==h.status){if(h.status==="blocked")return"blocked";o="done"}const r=ws(a),c=ws(n);return c.blocked>r.blocked?"blocked":(!o&&c.done>r.done&&(o="done"),o)}const K1={blocked:"%23f9e2af",done:"%23a6e3a1"};function I1(a){return`<circle cx='19' cy='5' r='4.5' fill='${K1[a]}' stroke='%2311111b' stroke-width='1.5'/>`}function F1(a,n){return!n||!a.includes("</svg>")?a:a.replace("</svg>",`${I1(n)}</svg>`)}function Tg(a,n=document){const l=n.querySelector('link[rel~="icon"]');if(!l)return;l.dataset.baseHref===void 0&&(l.dataset.baseHref=l.getAttribute("href")??"");const o=F1(l.dataset.baseHref,a);l.getAttribute("href")!==o&&l.setAttribute("href",o)}let rn=null;function G1(){if(typeof window>"u")return null;const a=window;return a.AudioContext??a.webkitAudioContext??null}function ty(){const a=G1();if(a)try{rn=rn??new a,rn.state==="suspended"&&rn.resume()}catch{rn=null}}function Y1(a=window){const n=()=>{ty(),l()},l=()=>{a.removeEventListener("pointerdown",n),a.removeEventListener("keydown",n)};return a.addEventListener("pointerdown",n),a.addEventListener("keydown",n),l}const P1={blocked:[880,660],done:[660,880]};function ny(a){if((rn==null?void 0:rn.state)==="running")try{const n=rn.currentTime;P1[a].forEach((l,o)=>{const r=rn.createOscillator(),c=rn.createGain(),h=n+o*.11;r.type="sine",r.frequency.value=l,c.gain.setValueAtTime(1e-4,h),c.gain.exponentialRampToValueAtTime(.06,h+.01),c.gain.exponentialRampToValueAtTime(1e-4,h+.09),r.connect(c),c.connect(rn.destination),r.start(h),r.stop(h+.1)})}catch{}}const V1=15e3,$1={blocked:[70,50,70],done:[40]};function q1(){const{settings:a,t:n}=Ee(),{agentStatus:l}=et(),o=T.useRef(a);o.current=a;const r=T.useRef(n);r.current=n;const c=T.useRef(null),h=T.useRef(Number.NEGATIVE_INFINITY);T.useEffect(()=>{Tg(a.agentAlertBadge?H1(ws(l)):null)},[l,a.agentAlertBadge]),T.useEffect(()=>()=>Tg(null),[]),T.useEffect(()=>{if(!(!a.agentAlertSound||typeof window>"u"))return Y1(window)},[a.agentAlertSound]),T.useEffect(()=>{const m=c.current;c.current=l;const p=U1(m,l);if(!p)return;const g=Date.now();if(g-h.current<V1)return;h.current=g;const y=o.current,v=typeof document<"u"&&document.visibilityState==="hidden",x=v||typeof document<"u"&&!document.hasFocus();if(y.agentAlertVibrate&&!v&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate($1[p])}catch{}if(y.agentAlertSound&&x&&ny(p),y.agentAlertNotify&&v&&typeof window<"u"&&window.isSecureContext&&"Notification"in window&&Notification.permission==="granted"){const w=ws(l),S=p==="blocked"?r.current("agents.notifyBlocked",{count:w.blocked}):r.current("agents.notifyDone",{count:w.done});try{new Notification("Herdr Remote",{body:S,tag:"herdr-agents"})}catch{}}},[l])}function iy(a){var n,l,o="";if(typeof a=="string"||typeof a=="number")o+=a;else if(typeof a=="object")if(Array.isArray(a)){var r=a.length;for(n=0;n<r;n++)a[n]&&(l=iy(a[n]))&&(o&&(o+=" "),o+=l)}else for(l in a)a[l]&&(o&&(o+=" "),o+=l);return o}function X1(){for(var a,n,l=0,o="",r=arguments.length;l<r;l++)(a=arguments[l])&&(n=iy(a))&&(o&&(o+=" "),o+=n);return o}const Z1=(a,n)=>{const l=new Array(a.length+n.length);for(let o=0;o<a.length;o++)l[o]=a[o];for(let o=0;o<n.length;o++)l[a.length+o]=n[o];return l},W1=(a,n)=>({classGroupId:a,validator:n}),ay=(a=new Map,n=null,l)=>({nextPart:a,validators:n,classGroupId:l}),yr="-",Mg=[],Q1="arbitrary..",J1=a=>{const n=tS(a),{conflictingClassGroups:l,conflictingClassGroupModifiers:o}=a;return{getClassGroupId:h=>{if(h.startsWith("[")&&h.endsWith("]"))return eS(h);const m=h.split(yr),p=m[0]===""&&m.length>1?1:0;return ly(m,p,n)},getConflictingClassGroupIds:(h,m)=>{if(m){const p=o[h],g=l[h];return p?g?Z1(g,p):p:g||Mg}return l[h]||Mg}}},ly=(a,n,l)=>{if(a.length-n===0)return l.classGroupId;const r=a[n],c=l.nextPart.get(r);if(c){const g=ly(a,n+1,c);if(g)return g}const h=l.validators;if(h===null)return;const m=n===0?a.join(yr):a.slice(n).join(yr),p=h.length;for(let g=0;g<p;g++){const y=h[g];if(y.validator(m))return y.classGroupId}},eS=a=>a.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const n=a.slice(1,-1),l=n.indexOf(":"),o=n.slice(0,l);return o?Q1+o:void 0})(),tS=a=>{const{theme:n,classGroups:l}=a;return nS(l,n)},nS=(a,n)=>{const l=ay();for(const o in a){const r=a[o];Hd(r,l,o,n)}return l},Hd=(a,n,l,o)=>{const r=a.length;for(let c=0;c<r;c++){const h=a[c];iS(h,n,l,o)}},iS=(a,n,l,o)=>{if(typeof a=="string"){aS(a,n,l);return}if(typeof a=="function"){lS(a,n,l,o);return}sS(a,n,l,o)},aS=(a,n,l)=>{const o=a===""?n:sy(n,a);o.classGroupId=l},lS=(a,n,l,o)=>{if(oS(a)){Hd(a(o),n,l,o);return}n.validators===null&&(n.validators=[]),n.validators.push(W1(l,a))},sS=(a,n,l,o)=>{const r=Object.entries(a),c=r.length;for(let h=0;h<c;h++){const[m,p]=r[h];Hd(p,sy(n,m),l,o)}},sy=(a,n)=>{let l=a;const o=n.split(yr),r=o.length;for(let c=0;c<r;c++){const h=o[c];let m=l.nextPart.get(h);m||(m=ay(),l.nextPart.set(h,m)),l=m}return l},oS=a=>"isThemeGetter"in a&&a.isThemeGetter===!0,rS=a=>{if(a<1)return{get:()=>{},set:()=>{}};let n=0,l=Object.create(null),o=Object.create(null);const r=(c,h)=>{l[c]=h,n++,n>a&&(n=0,o=l,l=Object.create(null))};return{get(c){let h=l[c];if(h!==void 0)return h;if((h=o[c])!==void 0)return r(c,h),h},set(c,h){c in l?l[c]=h:r(c,h)}}},bd="!",Ag=":",cS=[],Eg=(a,n,l,o,r)=>({modifiers:a,hasImportantModifier:n,baseClassName:l,maybePostfixModifierPosition:o,isExternal:r}),uS=a=>{const{prefix:n,experimentalParseClassName:l}=a;let o=r=>{const c=[];let h=0,m=0,p=0,g;const y=r.length;for(let M=0;M<y;M++){const N=r[M];if(h===0&&m===0){if(N===Ag){c.push(r.slice(p,M)),p=M+1;continue}if(N==="/"){g=M;continue}}N==="["?h++:N==="]"?h--:N==="("?m++:N===")"&&m--}const v=c.length===0?r:r.slice(p);let x=v,w=!1;v.endsWith(bd)?(x=v.slice(0,-1),w=!0):v.startsWith(bd)&&(x=v.slice(1),w=!0);const S=g&&g>p?g-p:void 0;return Eg(c,w,x,S)};if(n){const r=n+Ag,c=o;o=h=>h.startsWith(r)?c(h.slice(r.length)):Eg(cS,!1,h,void 0,!0)}if(l){const r=o;o=c=>l({className:c,parseClassName:r})}return o},dS=a=>{const n=new Map;return a.orderSensitiveModifiers.forEach((l,o)=>{n.set(l,1e6+o)}),l=>{const o=[];let r=[];for(let c=0;c<l.length;c++){const h=l[c],m=h[0]==="[",p=n.has(h);m||p?(r.length>0&&(r.sort(),o.push(...r),r=[]),o.push(h)):r.push(h)}return r.length>0&&(r.sort(),o.push(...r)),o}},fS=a=>({cache:rS(a.cacheSize),parseClassName:uS(a),sortModifiers:dS(a),postfixLookupClassGroupIds:hS(a),...J1(a)}),hS=a=>{const n=Object.create(null),l=a.postfixLookupClassGroups;if(l)for(let o=0;o<l.length;o++)n[l[o]]=!0;return n},mS=/\s+/,pS=(a,n)=>{const{parseClassName:l,getClassGroupId:o,getConflictingClassGroupIds:r,sortModifiers:c,postfixLookupClassGroupIds:h}=n,m=[],p=a.trim().split(mS);let g="";for(let y=p.length-1;y>=0;y-=1){const v=p[y],{isExternal:x,modifiers:w,hasImportantModifier:S,baseClassName:M,maybePostfixModifierPosition:N}=l(v);if(x){g=v+(g.length>0?" "+g:g);continue}let k=!!N,E;if(k){const _=M.substring(0,N);E=o(_);const z=E&&h[E]?o(M):void 0;z&&z!==E&&(E=z,k=!1)}else E=o(M);if(!E){if(!k){g=v+(g.length>0?" "+g:g);continue}if(E=o(M),!E){g=v+(g.length>0?" "+g:g);continue}k=!1}const R=w.length===0?"":w.length===1?w[0]:c(w).join(":"),H=S?R+bd:R,j=H+E;if(m.indexOf(j)>-1)continue;m.push(j);const D=r(E,k);for(let _=0;_<D.length;++_){const z=D[_];m.push(H+z)}g=v+(g.length>0?" "+g:g)}return g},gS=(...a)=>{let n=0,l,o,r="";for(;n<a.length;)(l=a[n++])&&(o=oy(l))&&(r&&(r+=" "),r+=o);return r},oy=a=>{if(typeof a=="string")return a;let n,l="";for(let o=0;o<a.length;o++)a[o]&&(n=oy(a[o]))&&(l&&(l+=" "),l+=n);return l},Ng=(a,...n)=>{let l,o,r,c;const h=p=>{const g=n.reduce((y,v)=>v(y),a());return l=fS(g),o=l.cache.get,r=l.cache.set,c=m,m(p)},m=p=>{const g=o(p);if(g)return g;const y=pS(p,l);return r(p,y),y};return c=h,(...p)=>c(gS(...p))},bS=[],gt=a=>{const n=l=>l[a]||bS;return n.isThemeGetter=!0,n},ry=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,cy=/^\((?:(\w[\w-]*):)?(.+)\)$/i,yS=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,vS=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,xS=/\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$/,wS=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,SS=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,CS=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ni=a=>yS.test(a),Re=a=>!!a&&!Number.isNaN(Number(a)),Mn=a=>!!a&&Number.isInteger(Number(a)),Ju=a=>a.endsWith("%")&&Re(a.slice(0,-1)),Xn=a=>vS.test(a),uy=()=>!0,TS=a=>xS.test(a)&&!wS.test(a),Bd=()=>!1,MS=a=>SS.test(a),AS=a=>CS.test(a),ES=a=>!fe(a)&&!he(a),NS=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)),kS=a=>Oi(a,hy,Bd),fe=a=>ry.test(a),ea=a=>Oi(a,my,TS),kg=a=>Oi(a,HS,Re),LS=a=>Oi(a,gy,uy),_S=a=>Oi(a,py,Bd),Lg=a=>Oi(a,dy,Bd),RS=a=>Oi(a,fy,AS),qo=a=>Oi(a,by,MS),he=a=>cy.test(a),rs=a=>ra(a,my),jS=a=>ra(a,py),_g=a=>ra(a,dy),OS=a=>ra(a,hy),DS=a=>ra(a,fy),Xo=a=>ra(a,by,!0),zS=a=>ra(a,gy,!0),Oi=(a,n,l)=>{const o=ry.exec(a);return o?o[1]?n(o[1]):l(o[2]):!1},ra=(a,n,l=!1)=>{const o=cy.exec(a);return o?o[1]?n(o[1]):l:!1},dy=a=>a==="position"||a==="percentage",fy=a=>a==="image"||a==="url",hy=a=>a==="length"||a==="size"||a==="bg-size",my=a=>a==="length",HS=a=>a==="number",py=a=>a==="family-name",gy=a=>a==="number"||a==="weight",by=a=>a==="shadow",Rg=()=>{const a=gt("color"),n=gt("font"),l=gt("text"),o=gt("font-weight"),r=gt("tracking"),c=gt("leading"),h=gt("breakpoint"),m=gt("container"),p=gt("spacing"),g=gt("radius"),y=gt("shadow"),v=gt("inset-shadow"),x=gt("text-shadow"),w=gt("drop-shadow"),S=gt("blur"),M=gt("perspective"),N=gt("aspect"),k=gt("ease"),E=gt("animate"),R=()=>["auto","avoid","all","avoid-page","page","left","right","column"],H=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],j=()=>[...H(),he,fe],D=()=>["auto","hidden","clip","visible","scroll"],_=()=>["auto","contain","none"],z=()=>[he,fe,p],K=()=>[Ni,"full","auto",...z()],q=()=>[Mn,"none","subgrid",he,fe],te=()=>["auto",{span:["full",Mn,he,fe]},Mn,he,fe],Z=()=>[Mn,"auto",he,fe],ie=()=>["auto","min","max","fr",he,fe],re=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],P=()=>["start","end","center","stretch","center-safe","end-safe"],A=()=>["auto",...z()],G=()=>[Ni,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...z()],W=()=>[Ni,"screen","full","dvw","lvw","svw","min","max","fit",...z()],se=()=>[Ni,"screen","full","lh","dvh","lvh","svh","min","max","fit",...z()],Q=()=>[a,he,fe],ge=()=>[...H(),_g,Lg,{position:[he,fe]}],ye=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ue=()=>["auto","cover","contain",OS,kS,{size:[he,fe]}],Te=()=>[Ju,rs,ea],ce=()=>["","none","full",g,he,fe],be=()=>["",Re,rs,ea],ae=()=>["solid","dashed","dotted","double"],we=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],le=()=>[Re,Ju,_g,Lg],ve=()=>["","none",S,he,fe],Ne=()=>["none",Re,he,fe],Ie=()=>["none",Re,he,fe],Xe=()=>[Re,he,fe],tt=()=>[Ni,"full",...z()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Xn],breakpoint:[Xn],color:[uy],container:[Xn],"drop-shadow":[Xn],ease:["in","out","in-out"],font:[ES],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Xn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Xn],shadow:[Xn],spacing:["px",Re],text:[Xn],"text-shadow":[Xn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ni,fe,he,N]}],container:["container"],"container-type":[{"@container":["","normal","size",he,fe]}],"container-named":[NS],columns:[{columns:[Re,fe,he,m]}],"break-after":[{"break-after":R()}],"break-before":[{"break-before":R()}],"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:j()}],overflow:[{overflow:D()}],"overflow-x":[{"overflow-x":D()}],"overflow-y":[{"overflow-y":D()}],overscroll:[{overscroll:_()}],"overscroll-x":[{"overscroll-x":_()}],"overscroll-y":[{"overscroll-y":_()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:K()}],"inset-x":[{"inset-x":K()}],"inset-y":[{"inset-y":K()}],start:[{"inset-s":K(),start:K()}],end:[{"inset-e":K(),end:K()}],"inset-bs":[{"inset-bs":K()}],"inset-be":[{"inset-be":K()}],top:[{top:K()}],right:[{right:K()}],bottom:[{bottom:K()}],left:[{left:K()}],visibility:["visible","invisible","collapse"],z:[{z:[Mn,"auto",he,fe]}],basis:[{basis:[Ni,"full","auto",m,...z()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Re,Ni,"auto","initial","none",fe]}],grow:[{grow:["",Re,he,fe]}],shrink:[{shrink:["",Re,he,fe]}],order:[{order:[Mn,"first","last","none",he,fe]}],"grid-cols":[{"grid-cols":q()}],"col-start-end":[{col:te()}],"col-start":[{"col-start":Z()}],"col-end":[{"col-end":Z()}],"grid-rows":[{"grid-rows":q()}],"row-start-end":[{row:te()}],"row-start":[{"row-start":Z()}],"row-end":[{"row-end":Z()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ie()}],"auto-rows":[{"auto-rows":ie()}],gap:[{gap:z()}],"gap-x":[{"gap-x":z()}],"gap-y":[{"gap-y":z()}],"justify-content":[{justify:[...re(),"normal"]}],"justify-items":[{"justify-items":[...P(),"normal"]}],"justify-self":[{"justify-self":["auto",...P()]}],"align-content":[{content:["normal",...re()]}],"align-items":[{items:[...P(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...P(),{baseline:["","last"]}]}],"place-content":[{"place-content":re()}],"place-items":[{"place-items":[...P(),"baseline"]}],"place-self":[{"place-self":["auto",...P()]}],p:[{p:z()}],px:[{px:z()}],py:[{py:z()}],ps:[{ps:z()}],pe:[{pe:z()}],pbs:[{pbs:z()}],pbe:[{pbe:z()}],pt:[{pt:z()}],pr:[{pr:z()}],pb:[{pb:z()}],pl:[{pl:z()}],m:[{m:A()}],mx:[{mx:A()}],my:[{my:A()}],ms:[{ms:A()}],me:[{me:A()}],mbs:[{mbs:A()}],mbe:[{mbe:A()}],mt:[{mt:A()}],mr:[{mr:A()}],mb:[{mb:A()}],ml:[{ml:A()}],"space-x":[{"space-x":z()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":z()}],"space-y-reverse":["space-y-reverse"],size:[{size:G()}],"inline-size":[{inline:["auto",...W()]}],"min-inline-size":[{"min-inline":["auto",...W()]}],"max-inline-size":[{"max-inline":["none",...W()]}],"block-size":[{block:["auto",...se()]}],"min-block-size":[{"min-block":["auto",...se()]}],"max-block-size":[{"max-block":["none",...se()]}],w:[{w:[m,"screen",...G()]}],"min-w":[{"min-w":[m,"screen","none",...G()]}],"max-w":[{"max-w":[m,"screen","none","prose",{screen:[h]},...G()]}],h:[{h:["screen","lh",...G()]}],"min-h":[{"min-h":["screen","lh","none",...G()]}],"max-h":[{"max-h":["screen","lh",...G()]}],"font-size":[{text:["base",l,rs,ea]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,zS,LS]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Ju,fe]}],"font-family":[{font:[jS,_S,n]}],"font-features":[{"font-features":[fe]}],"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:[r,he,fe]}],"line-clamp":[{"line-clamp":[Re,"none",he,kg]}],leading:[{leading:[c,...z()]}],"list-image":[{"list-image":["none",he,fe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",he,fe]}],"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:[...ae(),"wavy"]}],"text-decoration-thickness":[{decoration:[Re,"from-font","auto",he,ea]}],"text-decoration-color":[{decoration:Q()}],"underline-offset":[{"underline-offset":[Re,"auto",he,fe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:z()}],"tab-size":[{tab:[Mn,he,fe]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",he,fe]}],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",he,fe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ge()}],"bg-repeat":[{bg:ye()}],"bg-size":[{bg:ue()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Mn,he,fe],radial:["",he,fe],conic:[Mn,he,fe]},DS,RS]}],"bg-color":[{bg:Q()}],"gradient-from-pos":[{from:Te()}],"gradient-via-pos":[{via:Te()}],"gradient-to-pos":[{to:Te()}],"gradient-from":[{from:Q()}],"gradient-via":[{via:Q()}],"gradient-to":[{to:Q()}],rounded:[{rounded:ce()}],"rounded-s":[{"rounded-s":ce()}],"rounded-e":[{"rounded-e":ce()}],"rounded-t":[{"rounded-t":ce()}],"rounded-r":[{"rounded-r":ce()}],"rounded-b":[{"rounded-b":ce()}],"rounded-l":[{"rounded-l":ce()}],"rounded-ss":[{"rounded-ss":ce()}],"rounded-se":[{"rounded-se":ce()}],"rounded-ee":[{"rounded-ee":ce()}],"rounded-es":[{"rounded-es":ce()}],"rounded-tl":[{"rounded-tl":ce()}],"rounded-tr":[{"rounded-tr":ce()}],"rounded-br":[{"rounded-br":ce()}],"rounded-bl":[{"rounded-bl":ce()}],"border-w":[{border:be()}],"border-w-x":[{"border-x":be()}],"border-w-y":[{"border-y":be()}],"border-w-s":[{"border-s":be()}],"border-w-e":[{"border-e":be()}],"border-w-bs":[{"border-bs":be()}],"border-w-be":[{"border-be":be()}],"border-w-t":[{"border-t":be()}],"border-w-r":[{"border-r":be()}],"border-w-b":[{"border-b":be()}],"border-w-l":[{"border-l":be()}],"divide-x":[{"divide-x":be()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":be()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ae(),"hidden","none"]}],"divide-style":[{divide:[...ae(),"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:[...ae(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Re,he,fe]}],"outline-w":[{outline:["",Re,rs,ea]}],"outline-color":[{outline:Q()}],shadow:[{shadow:["","none",y,Xo,qo]}],"shadow-color":[{shadow:Q()}],"inset-shadow":[{"inset-shadow":["none",v,Xo,qo]}],"inset-shadow-color":[{"inset-shadow":Q()}],"ring-w":[{ring:be()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:Q()}],"ring-offset-w":[{"ring-offset":[Re,ea]}],"ring-offset-color":[{"ring-offset":Q()}],"inset-ring-w":[{"inset-ring":be()}],"inset-ring-color":[{"inset-ring":Q()}],"text-shadow":[{"text-shadow":["none",x,Xo,qo]}],"text-shadow-color":[{"text-shadow":Q()}],opacity:[{opacity:[Re,he,fe]}],"mix-blend":[{"mix-blend":[...we(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":we()}],"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":[Re]}],"mask-image-linear-from-pos":[{"mask-linear-from":le()}],"mask-image-linear-to-pos":[{"mask-linear-to":le()}],"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":le()}],"mask-image-t-to-pos":[{"mask-t-to":le()}],"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":le()}],"mask-image-r-to-pos":[{"mask-r-to":le()}],"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":le()}],"mask-image-b-to-pos":[{"mask-b-to":le()}],"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":le()}],"mask-image-l-to-pos":[{"mask-l-to":le()}],"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":le()}],"mask-image-x-to-pos":[{"mask-x-to":le()}],"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":le()}],"mask-image-y-to-pos":[{"mask-y-to":le()}],"mask-image-y-from-color":[{"mask-y-from":Q()}],"mask-image-y-to-color":[{"mask-y-to":Q()}],"mask-image-radial":[{"mask-radial":[he,fe]}],"mask-image-radial-from-pos":[{"mask-radial-from":le()}],"mask-image-radial-to-pos":[{"mask-radial-to":le()}],"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":H()}],"mask-image-conic-pos":[{"mask-conic":[Re]}],"mask-image-conic-from-pos":[{"mask-conic-from":le()}],"mask-image-conic-to-pos":[{"mask-conic-to":le()}],"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:ge()}],"mask-repeat":[{mask:ye()}],"mask-size":[{mask:ue()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",he,fe]}],filter:[{filter:["","none",he,fe]}],blur:[{blur:ve()}],brightness:[{brightness:[Re,he,fe]}],contrast:[{contrast:[Re,he,fe]}],"drop-shadow":[{"drop-shadow":["","none",w,Xo,qo]}],"drop-shadow-color":[{"drop-shadow":Q()}],grayscale:[{grayscale:["",Re,he,fe]}],"hue-rotate":[{"hue-rotate":[Re,he,fe]}],invert:[{invert:["",Re,he,fe]}],saturate:[{saturate:[Re,he,fe]}],sepia:[{sepia:["",Re,he,fe]}],"backdrop-filter":[{"backdrop-filter":["","none",he,fe]}],"backdrop-blur":[{"backdrop-blur":ve()}],"backdrop-brightness":[{"backdrop-brightness":[Re,he,fe]}],"backdrop-contrast":[{"backdrop-contrast":[Re,he,fe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Re,he,fe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Re,he,fe]}],"backdrop-invert":[{"backdrop-invert":["",Re,he,fe]}],"backdrop-opacity":[{"backdrop-opacity":[Re,he,fe]}],"backdrop-saturate":[{"backdrop-saturate":[Re,he,fe]}],"backdrop-sepia":[{"backdrop-sepia":["",Re,he,fe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":z()}],"border-spacing-x":[{"border-spacing-x":z()}],"border-spacing-y":[{"border-spacing-y":z()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",he,fe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Re,"initial",he,fe]}],ease:[{ease:["linear","initial",k,he,fe]}],delay:[{delay:[Re,he,fe]}],animate:[{animate:["none",E,he,fe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[M,he,fe]}],"perspective-origin":[{"perspective-origin":j()}],rotate:[{rotate:Ne()}],"rotate-x":[{"rotate-x":Ne()}],"rotate-y":[{"rotate-y":Ne()}],"rotate-z":[{"rotate-z":Ne()}],scale:[{scale:Ie()}],"scale-x":[{"scale-x":Ie()}],"scale-y":[{"scale-y":Ie()}],"scale-z":[{"scale-z":Ie()}],"scale-3d":["scale-3d"],skew:[{skew:Xe()}],"skew-x":[{"skew-x":Xe()}],"skew-y":[{"skew-y":Xe()}],transform:[{transform:[he,fe,"","none","gpu","cpu"]}],"transform-origin":[{origin:j()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:tt()}],"translate-x":[{"translate-x":tt()}],"translate-y":[{"translate-y":tt()}],"translate-z":[{"translate-z":tt()}],"translate-none":["translate-none"],zoom:[{zoom:[Mn,he,fe]}],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",he,fe]}],"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":z()}],"scroll-mx":[{"scroll-mx":z()}],"scroll-my":[{"scroll-my":z()}],"scroll-ms":[{"scroll-ms":z()}],"scroll-me":[{"scroll-me":z()}],"scroll-mbs":[{"scroll-mbs":z()}],"scroll-mbe":[{"scroll-mbe":z()}],"scroll-mt":[{"scroll-mt":z()}],"scroll-mr":[{"scroll-mr":z()}],"scroll-mb":[{"scroll-mb":z()}],"scroll-ml":[{"scroll-ml":z()}],"scroll-p":[{"scroll-p":z()}],"scroll-px":[{"scroll-px":z()}],"scroll-py":[{"scroll-py":z()}],"scroll-ps":[{"scroll-ps":z()}],"scroll-pe":[{"scroll-pe":z()}],"scroll-pbs":[{"scroll-pbs":z()}],"scroll-pbe":[{"scroll-pbe":z()}],"scroll-pt":[{"scroll-pt":z()}],"scroll-pr":[{"scroll-pr":z()}],"scroll-pb":[{"scroll-pb":z()}],"scroll-pl":[{"scroll-pl":z()}],"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",he,fe]}],fill:[{fill:["none",...Q()]}],"stroke-w":[{stroke:[Re,rs,ea,kg]}],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"]}},BS=(a,{cacheSize:n,prefix:l,experimentalParseClassName:o,extend:r={},override:c={}})=>(Qa(a,"cacheSize",n),Qa(a,"prefix",l),Qa(a,"experimentalParseClassName",o),Zo(a.theme,c.theme),Zo(a.classGroups,c.classGroups),Zo(a.conflictingClassGroups,c.conflictingClassGroups),Zo(a.conflictingClassGroupModifiers,c.conflictingClassGroupModifiers),Qa(a,"postfixLookupClassGroups",c.postfixLookupClassGroups),Qa(a,"orderSensitiveModifiers",c.orderSensitiveModifiers),Wo(a.theme,r.theme),Wo(a.classGroups,r.classGroups),Wo(a.conflictingClassGroups,r.conflictingClassGroups),Wo(a.conflictingClassGroupModifiers,r.conflictingClassGroupModifiers),yd(a,r,"postfixLookupClassGroups"),yd(a,r,"orderSensitiveModifiers"),a),Qa=(a,n,l)=>{l!==void 0&&(a[n]=l)},Zo=(a,n)=>{if(n)for(const l in n)Qa(a,l,n[l])},Wo=(a,n)=>{if(n)for(const l in n)yd(a,n,l)},yd=(a,n,l)=>{const o=n[l];o!==void 0&&(a[l]=a[l]?a[l].concat(o):o)},US=(a,...n)=>typeof a=="function"?Ng(Rg,a,...n):Ng(()=>BS(Rg(),a),...n),KS=US({extend:{classGroups:{"font-size":[{text:["tui","tui-sm","tui-lg"]}]}}});function ne(...a){return KS(X1(a))}const ke={cursor:"▸",on:"●",off:"○",dot:"·",check:"✓",cross:"✗",warn:"!",arrowRight:"→",arrowLeft:"←",chevronDown:"▾",chevronRight:"▸",ellipsis:"…",meterFull:"█",meterEmpty:"░",tabDivider:"│"},cn={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"}},cl={ok:cn.ok.text,warn:cn.warn.text,bad:cn.bad.text,idle:cn.idle.text,accent:cn.accent.text,alt:cn.alt.text,info:cn.info.text},dn=({level:a,className:n})=>f.jsx("span",{"aria-hidden":"true",className:ne("select-none leading-none",cl[a],n),children:a==="idle"?ke.off:ke.on}),Ud=({className:a})=>f.jsx("span",{"aria-hidden":"true",className:ne("select-none text-tui-faint",a),children:ke.dot}),yy={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"},Nt=({title:a,aside:n,tone:l="accent",className:o,bodyClassName:r,children:c,...h})=>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",o),...h,children:[a?f.jsx("legend",{className:ne("flex items-center gap-2 text-tui font-bold",cl[l]),children:f.jsx("span",{children:a})}):null,n?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:n}):null,f.jsx("div",{className:ne("min-w-0",r),children:c})]}),An=({label:a,labelWidth:n=16,className:l,children:o})=>f.jsxs("div",{className:ne("flex items-baseline gap-2 text-tui",l),children:[f.jsx("span",{className:"shrink-0 truncate text-tui-muted",style:{width:`${n}ch`},title:typeof a=="string"?a:void 0,children:a}),f.jsx("span",{className:"min-w-0 flex-1 text-tui-text",children:o})]}),IS=({className:a,label:n})=>n?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:n}),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"}),Ri=({tone:a="accent",className:n,children:l,action:o})=>{const r=a==="ok"?ke.check:a==="bad"?ke.cross:a==="warn"?ke.warn:"›",c=cn[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",c,n),children:[f.jsx("span",{"aria-hidden":"true",className:ne("shrink-0 font-bold",cl[a]),children:r}),f.jsx("div",{className:"min-w-0 flex-1 leading-snug text-tui-text",children:l}),o?f.jsx("div",{className:"shrink-0",children:o}):null]})},FS={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"},Me=({variant:a="default",brackets:n=!0,glyph:l,block:o=!1,className:r,children:c,type:h="button",...m})=>f.jsxs("button",{type:h,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",FS[a],o&&"w-full",r),...m,children:[n?f.jsx("span",{"aria-hidden":"true",className:"opacity-60",children:"["}):null,l?f.jsx("span",{"aria-hidden":"true",className:"leading-none",children:l}):null,f.jsx("span",{className:"truncate",children:c}),n?f.jsx("span",{"aria-hidden":"true",className:"opacity-60",children:"]"}):null]}),vy=({tone:a="accent",dot:n=!1,className:l,children:o})=>f.jsxs("span",{className:ne("inline-flex select-none items-center gap-1 whitespace-nowrap text-tui font-bold uppercase",cl[a],l),children:[n?f.jsx(dn,{level:a}):null,o]}),Kd=({tabs:a,activeId:n,onSelect:l,ariaLabel:o,className:r,labelClassName:c})=>f.jsx("nav",{className:ne("flex items-center gap-2",r),"aria-label":o,children:a.map((h,m)=>{const p=h.id===n;return f.jsxs(Jn.Fragment,{children:[m>0?f.jsx("span",{"aria-hidden":"true",className:"select-none text-tui-border",children:ke.tabDivider}):null,f.jsxs("button",{type:"button",onClick:()=>l(h.id),"aria-current":p?"page":void 0,"aria-label":h.ariaLabel??h.label,title:h.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:[h.index!==void 0?f.jsx("span",{"aria-hidden":"true",className:ne("text-tui-faint",p&&"text-tui-accent"),children:h.index}):null,f.jsx("span",{"aria-hidden":"true",className:ne("ml-1",c),children:h.label})]})]},h.id)})}),xy=({hints:a,className:n})=>f.jsx("div",{className:ne("flex flex-wrap items-center gap-x-3 gap-y-0.5 text-tui-sm text-tui-faint",n),children:a.map(l=>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:l.keys}),f.jsx("span",{children:l.action})]},`${l.keys} ${l.action}`))}),wy=({active:a=!1,className:n,children:l})=>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",n),children:l}),un=({htmlFor:a,hint:n,className:l,children:o})=>f.jsxs("label",{htmlFor:a,className:ne("block text-tui-sm font-bold text-tui-muted",l),children:[o,n?f.jsx("span",{className:"ml-2 font-normal text-tui-faint",children:n}):null]}),xt=Jn.forwardRef(({className:a,...n},l)=>f.jsx("input",{ref:l,className:ne("tui-input w-full px-2 py-1 text-tui",a),...n}));xt.displayName="Input";const Tr=Jn.forwardRef(({className:a,children:n,...l},o)=>f.jsx("select",{ref:o,className:ne("tui-input w-full px-2 py-1 text-tui",a),...l,children:n}));Tr.displayName="Select";const GS=({checked:a,onChange:n,disabled:l=!1,label:o,description:r,className:c,id:h})=>f.jsxs("label",{className:ne("group flex cursor-pointer select-none items-start gap-2 py-0.5 text-tui",l&&"cursor-not-allowed opacity-60",c),children:[f.jsx("input",{id:h,type:"checkbox",className:"sr-only",checked:a,disabled:l,onChange:m=>n(m.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",!l&&"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:o}),r?f.jsx("span",{className:"mt-0.5 block text-tui-sm leading-snug text-tui-faint",children:r}):null]})]}),Mr="h-8",bn=({title:a,aside:n,className:l,children:o})=>f.jsxs("section",{className:ne("min-w-0",l),children:[f.jsxs("div",{className:"flex min-h-[var(--tui-row)] items-center gap-2 border-b border-tui-border pb-1",children:[f.jsx("h3",{className:"text-tui font-bold text-tui-accent",children:a}),n?f.jsx("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:n}):null]}),f.jsx("div",{className:"divide-y divide-tui-border-dim",children:o})]}),Kt=({label:a,hint:n,htmlFor:l,control:o,className:r})=>f.jsxs("div",{className:ne("flex flex-col gap-1 py-1.5 sm:flex-row sm:items-center sm:gap-4",r),children:[f.jsxs("div",{className:"min-w-0 flex-1",children:[l?f.jsx("label",{htmlFor:l,className:"block text-tui text-tui-text",children:a}):f.jsx("span",{className:"block text-tui text-tui-text",children:a}),n?f.jsx("span",{className:"block text-tui-sm leading-snug text-tui-faint",children:n}):null]}),f.jsx("div",{className:"w-full shrink-0 sm:w-[20rem]",children:o})]}),vd="flex min-w-0 cursor-pointer select-none items-center justify-center px-1 text-tui transition-colors has-[:focus-visible]:outline has-[:focus-visible]:outline-1 has-[:focus-visible]:-outline-offset-2 has-[:focus-visible]:outline-tui-text",xd="text-tui-muted hover:bg-tui-selection hover:text-tui-text";function wd({name:a,value:n,options:l,onChange:o,tone:r="accent",size:c="md",className:h,"aria-label":m}){return f.jsx("div",{role:"radiogroup","aria-label":m,className:ne("grid w-full border border-tui-border bg-tui-mantle",Mr,h),style:{gridTemplateColumns:`repeat(${l.length}, minmax(max-content, 1fr))`},children:l.map((p,g)=>{const y=p.value===n;return f.jsxs("label",{className:ne(vd,c==="sm"&&"px-1.5 text-tui-sm",g>0&&"border-l border-tui-border",y?ne(yy[r],"font-bold text-tui-crust"):xd),children:[f.jsx("input",{type:"radio",name:a,value:p.value,className:"sr-only",checked:y,onChange:()=>o(p.value)}),f.jsx("span",{className:"whitespace-nowrap",children:p.label})]},p.value)})})}const ki=({checked:a,onChange:n,label:l,offLabel:o,onLabel:r,disabled:c=!1,className:h})=>{const m=p=>g=>{g.preventDefault(),!(c||p===a)&&n(p)};return f.jsxs("label",{className:ne("grid w-full grid-cols-2 border border-tui-border bg-tui-mantle has-[:focus-visible]:outline has-[:focus-visible]:outline-1 has-[:focus-visible]:outline-tui-accent",Mr,c&&"cursor-not-allowed opacity-60",h),children:[f.jsx("input",{type:"checkbox",className:"sr-only","aria-label":l,checked:a,disabled:c,onChange:p=>n(p.target.checked)}),f.jsx("span",{"aria-hidden":"true",onClick:m(!1),className:ne(vd,a?xd:"bg-tui-selection font-bold text-tui-text"),children:o}),f.jsx("span",{"aria-hidden":"true",onClick:m(!0),className:ne(vd,"border-l border-tui-border",a?"bg-tui-ok font-bold text-tui-crust":xd),children:r})]})},aa=({variant:a="neutral",className:n,type:l="button",children:o,...r})=>f.jsx("button",{type:l,className:ne("tui-focusable inline-flex h-7 w-7 shrink-0 select-none items-center justify-center border border-transparent text-tui transition-colors","disabled:cursor-not-allowed disabled:text-tui-border disabled:hover:border-transparent disabled:hover:bg-transparent",a==="danger"?"text-tui-bad hover:border-tui-bad":"text-tui-muted hover:border-tui-border hover:text-tui-accent",n),...r,children:o}),YS=({value:a,width:n=20,tone:l="accent",className:o})=>{const r=Number.isFinite(a)?Math.min(1,Math.max(0,a)):0,c=Math.round(r*n);return f.jsxs("span",{className:ne("inline-flex select-none whitespace-pre font-mono leading-none",o),role:"presentation",children:[f.jsx("span",{className:cl[l],children:ke.meterFull.repeat(c)}),f.jsx("span",{className:"text-tui-border",children:ke.meterEmpty.repeat(Math.max(0,n-c))})]})},PS=({ratio:a,label:n,tone:l="accent",className:o,...r})=>{const c=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",o),role:"progressbar","aria-valuenow":Math.round(c*100),"aria-valuemin":0,"aria-valuemax":100,...r,children:[f.jsx("div",{className:ne("absolute inset-y-0 left-0",yy[l]),style:{width:`${c*100}%`},"aria-hidden":"true"}),n!==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:n}):null]})},Xa=({label:a,value:n,sub:l,tone:o,title:r,className:c})=>f.jsxs("div",{className:ne("min-w-0 border border-tui-border bg-tui-base px-2.5 py-1.5",c),title:r,children:[f.jsx("div",{className:"truncate text-tui-sm text-tui-muted",children:a}),f.jsx("div",{className:ne("truncate text-tui-lg font-bold",o?cl[o]:"text-tui-text"),children:n}),f.jsx("div",{className:"truncate text-tui-sm text-tui-faint",children:l||" "})]}),jg=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],sa=({className:a,label:n})=>{const[l,o]=Jn.useState(0);return Jn.useEffect(()=>{const r=setInterval(()=>o(c=>(c+1)%jg.length),90);return()=>clearInterval(r)},[]),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:jg[l]}),n?f.jsx("span",{children:n}):null]})};function Id({columns:a,items:n,rowKey:l,empty:o,className:r}){return n.length===0?f.jsx("div",{className:ne("px-1 py-4 text-center text-tui text-tui-faint",r),children:o}):f.jsx("div",{className:ne("w-full overflow-x-auto",r),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(c=>f.jsx("th",{scope:"col",style:c.width?{width:`${c.width}ch`}:void 0,className:ne("whitespace-nowrap px-2 py-1 text-tui-sm font-bold text-tui-muted",c.align==="right"?"text-right":"text-left",c.className),children:c.header},c.key))})}),f.jsx("tbody",{children:n.map((c,h)=>f.jsx("tr",{className:"border-b border-tui-border-dim last:border-b-0 hover:bg-tui-selection",children:a.map(m=>f.jsx("td",{className:ne("px-2 py-1 align-top text-tui-text",m.align==="right"?"text-right":"text-left",m.className),children:m.render(c,h)},m.key))},l(c,h)))})]})})}var VS=yb();const ul=({isOpen:a,onClose:n,title:l,subtitle:o,closeLabel:r,footer:c,hints:h,size:m="md",fixedHeight:p=!1,className:g,children:y})=>{if(!a)return null;const v=m==="sm"?"max-w-md":m==="lg"?"max-w-3xl":"max-w-xl",x=`tui-modal-${l.replace(/\s+/g,"-").toLowerCase()}`,w=f.jsx("div",{className:"fixed inset-0 inset-x-0 z-50 flex items-center justify-center overflow-hidden bg-tui-crust/85 p-3 sm:p-6",style:{height:"var(--app-height, 100dvh)",width:"100vw"},role:"dialog","aria-modal":"true","aria-labelledby":x,onMouseDown:S=>{S.target===S.currentTarget&&n()},children:f.jsxs("div",{className:ne("relative flex max-h-full w-full flex-col border border-tui-border bg-tui-base",v,p&&"h-[46rem]",g),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.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-baseline gap-x-2",children:[f.jsx("h2",{id:x,className:"break-words text-tui font-bold text-tui-accent",children:l}),o?f.jsx("span",{className:"min-w-0 break-words text-tui-sm text-tui-faint",children:o}):null]}),f.jsx(Me,{variant:"ghost",onClick:n,"aria-label":r,title:r,children:"esc"})]}),f.jsx("div",{className:"relative min-h-0 flex-1 overflow-y-auto overscroll-contain px-3 py-3",children:y}),c||h?f.jsxs("footer",{className:"flex shrink-0 flex-wrap items-center justify-between gap-2 border-t border-tui-border bg-tui-mantle px-3 py-1.5",children:[h?f.jsx(xy,{hints:h}):f.jsx("span",{}),c?f.jsx("div",{className:"flex items-center gap-2",children:c}):null]}):null]})});return typeof document>"u"?w:VS.createPortal(w,document.body)},Sd=({items:a,className:n})=>{const l=a.filter(Boolean);return f.jsx("span",{className:ne("flex min-w-0 items-center gap-1.5",n),children:l.map((o,r)=>f.jsxs(Jn.Fragment,{children:[r>0?f.jsx(Ud,{className:"shrink-0"}):null,o]},r))})},Sy=({left:a,right:n,className:l})=>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",l),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:n})]}),$S=({name:a,tagline:n,aside:l,tabs:o,activeTabId:r,onSelectTab:c,tabsAriaLabel:h,toolbarStart:m,toolbarAside:p,hints:g,footerAside:y,bodyClassName:v,className:x,children:w})=>{const S=!!(o&&o.length>0&&r!==void 0&&c);return f.jsxs("div",{className:ne("flex h-full min-h-0 w-full flex-col bg-tui-crust",x),children:[a?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}),n?f.jsx("span",{className:"hidden truncate text-tui-sm text-tui-faint sm:block",children:n}):null]}),l?f.jsx("span",{className:"flex shrink-0 items-center gap-2",children:l}):null]}):null,S||m||p?f.jsxs("div",{className:"flex min-h-[var(--tui-row)] shrink-0 flex-wrap items-center gap-x-3 gap-y-1 border-b border-tui-border bg-tui-mantle px-2 py-1",children:[m?f.jsx("div",{className:"flex shrink-0 items-center",children:m}):null,S?f.jsx("div",{className:"scrollbar-none order-last min-w-0 basis-full overflow-x-auto sm:order-none sm:basis-auto",children:f.jsx(Kd,{tabs:o,activeId:r,onSelect:c,ariaLabel:h,className:"gap-3"})}):null,p?f.jsx("div",{className:"ml-auto flex shrink-0 items-center gap-2",children:p}):null]}):null,f.jsx("div",{className:ne("min-h-0 flex-1 overflow-y-auto p-2",v),children:w}),g||y?f.jsx(Sy,{left:g?f.jsx(xy,{hints:g}):null,right:y}):null]})},Qo="tui-focusable select-none border border-transparent px-1.5 text-tui uppercase transition-colors",Jo="text-tui-muted hover:border-tui-border hover:text-tui-accent",qS="border-tui-accent bg-tui-accent text-tui-crust",XS=({currentView:a,onNavigate:n,onOpenPairing:l,onOpenSettings:o,onToggleVirtualKeyboard:r,isVirtualKeyboardOpen:c})=>{const{language:h,setLanguage:m,t:p}=Ee(),{addToast:g}=Xt(),y=()=>{const x=h==="zh"?"en":"zh";m(x),g("info",Rd(x,"toasts.switchedLanguage",{lang:x==="zh"?"简体中文":"English"}))},v=[{id:"terminal",label:p("header.terminalTab"),index:1,ariaLabel:p("header.terminalTab")},...a==="admin"?[{id:"admin",label:p("header.adminTab"),index:2,ariaLabel:p("header.adminTab")}]:[]];return f.jsx("header",{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:p("header.tagline")})]}),f.jsx("span",{"aria-hidden":"true",className:"h-4 w-px shrink-0 bg-tui-border"}),f.jsx(Kd,{tabs:v,activeId:a,onSelect:x=>n(x),ariaLabel:p("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:y,className:ne(Qo,Jo),title:p("header.languageToggleTitle"),"aria-label":p("header.languageToggleTitle"),children:p("header.languageShort")}),a==="terminal"&&f.jsx("button",{type:"button",onClick:r,className:ne(Qo,c?qS:Jo),title:p("header.virtualKeyboardTitle"),"aria-label":p("header.virtualKeyboardTitle"),children:p("header.actionKeyboard")}),f.jsx("button",{type:"button",onClick:l,className:ne(Qo,Jo),title:p("header.pairingTitle"),"aria-label":p("header.pairingTitle"),children:p("header.actionPairing")}),f.jsx("button",{type:"button",onClick:o,className:ne(Qo,Jo),title:p("header.settingsTitle"),"aria-label":p("header.settingsTitle"),children:p("header.actionSettings")})]})]})})},er=({tone:a,glyph:n,message:l,assertive:o=!1,action:r})=>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",cn[a].edgeB),"aria-live":o?"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",cn[a].text),children:n}),f.jsx("span",{className:"truncate text-tui-text",children:l})]}),r]}),ZS=()=>{const{settings:a,t:n}=Ee(),{connectionState:l,stateDetail:o,connect:r}=et();return l==="connected"||!a.token&&!a.pairCode&&l==="disconnected"?null:l==="connecting"?f.jsx(er,{tone:"accent",glyph:f.jsx(sa,{}),message:n("statusBanner.connecting")}):l==="reconnecting"?f.jsx(er,{tone:"warn",glyph:f.jsx(sa,{}),assertive:!0,message:o||n("statusBanner.reconnectingDefault"),action:f.jsx(Me,{variant:"warn",onClick:()=>r(),className:"shrink-0",children:n("statusBanner.reconnectNow")})}):l==="error"?f.jsx(er,{tone:"bad",glyph:ke.cross,assertive:!0,message:o||n("statusBanner.errorDefault"),action:f.jsx(Me,{variant:"danger",onClick:()=>r(),className:"shrink-0",children:n("common.retry")})}):l==="disconnected"?f.jsx(er,{tone:"idle",glyph:ke.off,message:n("statusBanner.disconnected"),action:f.jsx(Me,{variant:"primary",onClick:()=>r(),className:"shrink-0",children:n("common.connect")})}):null},ed="Herdr Remote",Og=80,WS=/[\u0000-\u001F\u007F-\u009F]/g;function Cd(a){if(typeof a!="string")return"";const n=a.replace(WS," ").replace(/\s+/g," ").trim();return n.length<=Og?n:`${n.slice(0,Og-1).trimEnd()}…`}function QS(a,n,l){const o=B1(l??null),r=o?`${o} `:"",c=Cd(a);if(c)return`${r}${c} · ${ed}`;const h=Cd(n);return h?`${r}${h} · ${ed}`:`${r}${ed}`}function JS(a,n,l){const o=QS(a,n,l);return typeof document<"u"&&(document.title=o),o}const eC=new Set(["http:","https:","mailto:"]),td=/(?:https?:\/\/|mailto:|www\.)[^\s"'<>`]+/gi,tC=/[.,;:!?'"]+$/,Dg=8;function Fd(a){return/^www\./i.test(a)?`https://${a}`:a}function nC(a){const n=(r,c)=>r.split(c).length-1;let l=a.replace(tC,"");const o=[["(",")"],["[","]"],["{","}"]];for(const[r,c]of o)for(;l.endsWith(c)&&n(l,c)>n(l,r);)l=l.slice(0,-1);return l}function Cy(a){if(typeof a!="string"||a.length===0)return!1;try{return eC.has(new URL(Fd(a)).protocol)}catch{return!1}}function iC(a,n){if(typeof a!="string"||n<0)return null;td.lastIndex=0;for(let l=td.exec(a);l;l=td.exec(a)){const o=nC(l[0]);if(!o)continue;const r=l.index,c=r+o.length;if(n>=r&&n<c&&Cy(o))return o}return null}function aC(a,n,l){var m;const o=(m=a==null?void 0:a.buffer)==null?void 0:m.active;if(!o||typeof o.getLine!="function"||!o.getLine(l))return null;let r=l;for(let p=0;p<Dg;p+=1){const g=o.getLine(r);if(!(g!=null&&g.isWrapped)||r===0)break;r-=1}let c="",h=-1;for(let p=r;p<r+Dg;p+=1){const g=o.getLine(p);if(!g||p>r&&!g.isWrapped)break;p===l&&(h=c.length+n),c+=g.translateToString(!1)}return h<0?null:{text:c,index:h}}function lC(a,n,l){const o=aC(a,n,l);return o?iC(o.text,o.index):null}function sC(a){try{const n=new URL(Fd(a));return n.host||n.pathname}catch{return""}}function Td(a){return!Cy(a)||typeof window>"u"||typeof window.open!="function"?!1:(window.open(Fd(a),"_blank","noopener,noreferrer"),!0)}async function Gd(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 n=null,l=null,o=null;try{if(n=document.createElement("textarea"),n.style.userSelect="text",n.style.webkitUserSelect="text",n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.width="1px",n.style.height="1px",n.style.padding="0",n.style.border="none",n.style.outline="none",n.style.boxShadow="none",n.style.background="transparent",n.style.opacity="0",n.style.fontSize="16px",n.setAttribute("readonly",""),n.setAttribute("aria-hidden","true"),n.value=a,typeof window<"u"&&typeof window.getSelection=="function"&&(o=window.getSelection(),o&&o.rangeCount>0&&(l=o.getRangeAt(0))),document.body.appendChild(n),typeof navigator<"u"&&(/iPad|iPhone|iPod/.test(navigator.userAgent||"")||navigator.platform==="MacIntel"&&(navigator.maxTouchPoints||0)>1)){const h=document.createRange();h.selectNodeContents(n),o&&(o.removeAllRanges(),o.addRange(h)),n.setSelectionRange(0,a.length)}else n.focus({preventScroll:!0}),n.select();if(document.execCommand("copy"))return"exec"}catch{}finally{n!=null&&n.parentNode&&n.parentNode.removeChild(n),o&&(o.removeAllRanges(),l&&o.addRange(l))}}return"failed"}async function oC(){if(!(typeof window>"u"||window.isSecureContext!==!1)||typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.readText!="function")return{ok:!1,reason:"insecure"};try{const n=await navigator.clipboard.readText();return!n||n.length===0?{ok:!1,reason:"empty"}:{ok:!0,text:n}}catch(n){return typeof window<"u"&&window.isSecureContext===!1?{ok:!1,reason:"insecure"}:(n==null?void 0:n.name)==="SecurityError"?{ok:!1,reason:"insecure"}:{ok:!1,reason:"denied"}}}async function rC(){if(!(typeof window>"u"||window.isSecureContext!==!1)||typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.read!="function")return{ok:!1,reason:"insecure"};try{const n=await navigator.clipboard.read();if(!n||n.length===0)return{ok:!1,reason:"empty"};for(const l of n){const o=l.types.find(r=>r.startsWith("image/"));if(o){const r=await l.getType(o);if(r&&r.size>0)return{ok:!0,blob:r}}}return{ok:!1,reason:"empty"}}catch(n){if(typeof window<"u"&&window.isSecureContext===!1)return{ok:!1,reason:"insecure"};const l=n==null?void 0:n.name;return l==="SecurityError"?{ok:!1,reason:"insecure"}:l==="NotAllowedError"?{ok:!1,reason:"denied"}:{ok:!1,reason:"empty"}}}function Ty(a){const n=a.clipboardData;if(!n)return null;if(n.files&&n.files.length>0)for(let l=0;l<n.files.length;l++){const o=n.files[l];if(o!=null&&o.type.startsWith("image/"))return o}if(n.items&&n.items.length>0)for(let l=0;l<n.items.length;l++){const o=n.items[l];if(o!=null&&o.type.startsWith("image/")){const r=o.getAsFile();if(r)return r}}return null}function cC(a){if(!a||a.length===0)return null;for(let n=0;n<a.length;n++){const l=a[n];if(l&&(l.type.startsWith("image/")||/\.(png|jpe?g|webp|gif)$/i.test(l.name)))return l}return null}const uC=({isOpen:a,onClose:n,onSend:l,onSendImage:o})=>{const{t:r}=Ee(),{addToast:c}=Xt(),[h,m]=T.useState(""),[p,g]=T.useState(null),[y,v]=T.useState(!1),x=T.useRef(null),w=T.useRef(null),S=T.useRef(null),M=async D=>{if(D.size===0){c("error",r("clipboard.fileEmpty"));return}v(!0);try{const _=await Ib(D);_?(g(_),m("")):c("error",r("clipboard.imageTooLarge"))}catch(_){console.error("Failed to process image:",_),c("error",r("clipboard.imageTooLarge"))}finally{v(!1)}},N=async D=>{const _=Ty(D);_&&(D.preventDefault(),await M(_))},k=async D=>{const _=cC(D.target.files);D.target.value="",_&&await M(_)},E=D=>{const _=D.target.value;m(_),_&&p&&g(null)},R=()=>{g(null),x.current&&(x.current.value=""),w.current&&(w.current.value="")},H=()=>{p?(o==null||o(p),n()):h.trim()&&(l(h),n())},j=!!(h.trim()||p);return f.jsx(ul,{isOpen:a,onClose:n,title:r("clipboard.pasteTitle"),closeLabel:r("clipboard.cancel"),size:"sm",footer:f.jsxs("div",{className:"flex items-center justify-end gap-2",children:[f.jsx(Me,{variant:"ghost",onClick:n,children:r("clipboard.cancel")}),f.jsx(Me,{variant:"primary",onClick:H,disabled:!j||y,children:r("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:r("clipboard.pasteHint")}),f.jsx("textarea",{ref:S,id:"paste-fallback-input","data-testid":"paste-fallback-input",rows:4,autoFocus:!0,placeholder:r("clipboard.pasteHint"),value:h,onChange:E,onPaste:N,disabled:!!p||y,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:r("clipboard.imageSectionTitle")})})]}),f.jsxs("div",{className:"flex flex-col gap-2",children:[f.jsx("input",{ref:x,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",className:"hidden","data-testid":"paste-fallback-file-input",onChange:k}),f.jsx("input",{ref:w,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",capture:"environment",className:"hidden","data-testid":"paste-fallback-camera-input",onChange:k}),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:r("clipboard.imageCompressedSize",{size:u1(p.byteLength)})}),f.jsx(Me,{variant:"ghost",onClick:R,"aria-label":r("clipboard.removeImage"),children:r("clipboard.cancel")})]})]}):f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx(Me,{variant:"default",onClick:()=>{var D;return(D=x.current)==null?void 0:D.click()},disabled:y||!!h.trim(),className:"min-h-[44px] px-3 touch-manipulation text-tui-sm font-sans flex-1","aria-label":r("clipboard.chooseImage"),children:r("clipboard.chooseImage")}),f.jsx(Me,{variant:"default",onClick:()=>{var D;return(D=w.current)==null?void 0:D.click()},disabled:y||!!h.trim(),className:"min-h-[44px] px-3 touch-manipulation text-tui-sm font-sans flex-1","aria-label":r("clipboard.takePhoto"),children:r("clipboard.takePhoto")})]}),y&&f.jsx("div",{className:"flex items-center gap-2 text-tui-xs text-tui-muted animate-pulse",children:f.jsx("span",{children:r("clipboard.imageCompressing")})})]})]})})},Za="tui-focusable group flex h-11 w-full select-none items-center gap-2 border px-2 text-left text-tui transition-colors",Wa="border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",dC=({anchorPoint:a,hasSelection:n,isController:l,vibrateOnKeyPress:o=!1,linkUrl:r=null,onOpenLink:c,onCopySelection:h,onCopyLine:m,onCopyScreen:p,onPaste:g,onClose:y})=>{const{t:v}=Ee(),x=T.useRef(null),[w,S]=T.useState(null);T.useEffect(()=>{if(o&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(8)}catch{}},[o]),T.useLayoutEffect(()=>{const E=x.current;if(!(E!=null&&E.parentElement))return;const R=E.parentElement.getBoundingClientRect(),H=E.getBoundingClientRect(),j=H.width||208,D=H.height||220,_=R.width,z=R.height;let K=a.x-j/2;K=Math.max(8,Math.min(Math.max(8,_-j-8),K));let q=a.y-D-8;q<8&&(q=a.y+8),q=Math.max(8,Math.min(Math.max(8,z-D-8),q)),S({x:K,y:q})},[a.x,a.y,n,l,r]);const M=Math.max(8,a.x-104),N=Math.max(8,a.y-200),k={position:"absolute",left:`${w?w.x:M}px`,top:`${w?w.y:N}px`,visibility:w?"visible":"hidden"};return f.jsx("div",{ref:x,role:"menu","aria-label":"终端选择操作",className:"z-50 w-52 select-none font-mono",style:k,onMouseDown:E=>E.stopPropagation(),onTouchStart:E=>E.stopPropagation(),onPointerDown:E=>E.stopPropagation(),children:f.jsxs(Nt,{tone:"accent",className:"border border-tui-border bg-tui-base p-1.5 shadow-lg",bodyClassName:"flex flex-col gap-1",children:[r&&c&&f.jsxs("button",{type:"button",role:"menuitem",className:ne(Za,Wa),onClick:()=>{c(r),y()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:ke.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.openLink")}),f.jsx("span",{className:"ml-auto max-w-[45%] truncate text-tui-faint",children:sC(r)})]}),n&&f.jsxs("button",{type:"button",role:"menuitem",className:ne(Za,Wa),onClick:()=>{h(),y()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:ke.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.copySelection")})]}),f.jsxs("button",{type:"button",role:"menuitem",className:ne(Za,Wa),onClick:()=>{m(),y()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:ke.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.copyLine")})]}),f.jsxs("button",{type:"button",role:"menuitem",className:ne(Za,Wa),onClick:()=>{p(),y()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:ke.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.copyScreen")})]}),l&&f.jsxs("button",{type:"button",role:"menuitem",className:ne(Za,Wa),onClick:()=>{g(),y()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:ke.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.paste")})]}),f.jsxs("button",{type:"button",role:"menuitem",className:ne(Za,Wa),onClick:y,children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:ke.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.cancel")})]})]})})},fC={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};function hC(){return typeof window<"u"&&new URLSearchParams(window.location.search).get("debug")==="1"}function mC(a){const n=T.useRef([]),[l,o]=T.useState({framesPerSec:0,bytesPerSec:0}),r=T.useCallback(h=>{const m=h-1e3,p=n.current;for(;p.length>0&&p[0].time<m;)p.shift()},[]);T.useEffect(()=>{if(!a)return;const h=setInterval(()=>{r(performance.now());let m=0;for(const p of n.current)m+=p.bytes;o({framesPerSec:n.current.length,bytesPerSec:m})},1e3);return()=>clearInterval(h)},[a,r]);const c=T.useCallback(h=>{const m=performance.now();n.current.push({time:m,bytes:h}),r(m)},[r]);return{metrics:l,record:c}}function pC(a){return a?`${a.kind} row ${a.row} cols ${a.startCol}-${a.endCol} caret ${a.caretCol}`:"none"}function gC(a){var o;const n=(o=a==null?void 0:a.canvas)==null?void 0:o.stats;if(!n)return`paint: ${(a==null?void 0:a.kind)??"-"} renderer
34
+ `;const l=n.lastInputToPaintMs!==null?`${n.lastInputToPaintMs.toFixed(1)}ms`:"-";return`paint: ${n.lastPaintMs.toFixed(2)}ms cells: ${n.lastCells} frames: ${n.frames} held: ${n.heldFrames} key→paint: ${l}
35
+ `}function bC(a){const n=(a==null?void 0:a.getTrace())??[];return n.length===0?"trace: -":`trace:
36
+ ${n.slice(-6).map(l=>` ${l.event}${l.count>1?` ×${l.count}`:""}`).join(`
37
+ `)}`}const yC=({debug:a,rttMs:n,metrics:l,rendererKind:o,predictiveEcho:r,predictor:c,field:h,renderer:m})=>{const p=c==null?void 0:c.getEchoSrttMs();return 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: ${a.state}
38
+ `,`deltaY: ${a.deltaY} lines: ${a.lines}
39
+ `,`viewportY: ${a.viewportY??"-"} focus: ${a.focused}
40
+ `,`buffer: ${a.bufferType??"-"} base: ${a.baseY??"-"} cursor: ${a.cursorY??"-"} scrollback: ${a.hasScrollback??"-"}
41
+ `,`scroll: ${a.scrollTop??"-"} / ${a.scrollHeight??"-"} (h ${a.clientHeight??"-"}) moved: ${a.moved}
42
+ `,`mode: ${a.scrollMode} calls: ${a.scrollCalls} lines: ${a.lastScrollLines??"-"} mouse: ${a.mouseTracking}
43
+ `,`event: ${a.lastInputEvent||"-"} pointer: ${a.pointerEvents} touch: ${a.touchEvents}
44
+ `,`rtt: ${n!==null?`${n}ms`:"-"} frames/s: ${l.framesPerSec} bytes/s: ${l.bytesPerSec} renderer: ${o??"-"}
45
+ `,`prediction: ${(c==null?void 0:c.getState())??"-"} mode: ${r} pending: ${(c==null?void 0:c.getVisiblePredictions().length)??0} srtt: ${p!=null?`${Math.round(p)}ms`:"-"}
46
+ `,`field: ${pC(h)} mismatches: ${(c==null?void 0:c.getMismatchCount())??0}
47
+ `,gC(m),bC(c)]})};function En(a){const n=T.useRef(a);return n.current=a,n}function vC(a){const n=En(a),{termRef:l,subscribeToPasteFileReady:o}=a,[r,c]=T.useState(!1),h=T.useCallback((v,x)=>{n.current.onPaste(),v.paste(x),n.current.addToast("success",n.current.t("clipboard.pasted"))},[n]),m=T.useCallback(()=>{const v=l.current;return v?n.current.isController?v:(n.current.warnViewerMode(),null):null},[l,n]),p=T.useCallback(async()=>{const v=m();if(v){try{const x=await rC();if(x.ok){await n.current.uploadImage(x.blob);return}}catch{}try{const x=await oC();if(x.ok){h(v,x.text);return}else if(x.reason==="empty"){n.current.addToast("info",n.current.t("clipboard.pasteUnavailable"));return}}catch{}c(!0)}},[m,h,n]),g=T.useCallback(v=>{const x=m();x&&h(x,v)},[m,h]),y=T.useCallback(v=>{m()&&n.current.uploadImage(v)},[m,n]);return T.useEffect(()=>o(v=>{const x=l.current;x&&h(x,v)}),[o,l,h]),{isPasteFallbackOpen:r,closePasteFallback:()=>c(!1),handlePaste:p,handleFallbackPasteSend:g,handleFallbackImageSend:y}}const sr=new Set(["│","┃","║","▐","▕","▏","▌"]),vr=new Set(["┌","┐","└","┘","╭","╮","╰","╯","├","┤","┬","┴","┼","┏","┓","┗","┛","╔","╗","╚","╝","╠","╣","╟","╢","╞","╡"]),xC=new Set(["╭","┌","┏","╔"]),wC=new Set(["╭","┌","┏","╔","├","┣","┠","┝","╟","╠","┞","┟","┡","┢"]),SC=new Set(["╮","┐","┓","╗"]),CC=new Set(["╰","└","┗","╚"]),TC=new Set(["╯","┘","┛","╝"]),nd=new Set(["─","━","═","╌","┄"]),My=new Set(["❯","›",">","!"]),zg=new Set(["$","#","%",">","❯","›","➜","λ","»"]);function Nn(a){return a===""||a===" "||a===" "}class MC{constructor(n){$(this,"cell");$(this,"top");$(this,"bottom");var l;this.screen=n,this.cell=(l=n.getNullCell)==null?void 0:l.call(n),this.top=n.baseY,this.bottom=n.baseY+n.rows-1}get cols(){return this.screen.cols}at(n,l){var o;if(!(n<this.top||n>this.bottom||l<0||l>=this.screen.cols))return(o=this.screen.getLine(n))==null?void 0:o.getCell(l,this.cell)}char(n,l){var o;return((o=this.at(n,l))==null?void 0:o.getChars())??""}dim(n,l){var o,r;return!!((r=(o=this.at(n,l))==null?void 0:o.isDim)!=null&&r.call(o))}text(n,l,o){var r;return n<this.top||n>this.bottom?"":((r=this.screen.getLine(n))==null?void 0:r.translateToString(!0,l,o))??""}isEdge(n,l){if(!sr.has(this.char(n,l)))return!1;const o=this.char(n-1,l),r=this.char(n+1,l);return sr.has(o)||vr.has(o)||sr.has(r)||vr.has(r)}blankOrDim(n,l,o){var r;for(let c=l;c<o;c++){const h=this.at(n,c);if(h&&!Nn(h.getChars())&&!((r=h.isDim)!=null&&r.call(h)))return!1}return!0}}function AC(a,n,l){if(a.isEdge(n,l))return null;let o=0;for(let c=l-1;c>=0;c--)if(a.isEdge(n,c)){o=c+1;break}let r=a.cols;for(let c=l+1;c<a.cols;c++)if(a.isEdge(n,c)){r=c;break}return o<r?{start:o,end:r}:null}const Md=8,EC=12,Ad=2,Hg=1,NC=4,kC=3,LC=20,Bg=/-- INSERT --/,_C=/-- (?:NORMAL|VISUAL(?: LINE| BLOCK)?|REPLACE) --/,RC=/Esc to cancel|Enter to (?:confirm|select)|to navigate|Space to (?:change|toggle|select)/i,jC=/^\s*\d+[.)]\s/;function Ug(a,n,l){if(!nd.has(a.char(n,l.start))||!nd.has(a.char(n,l.end-1))||vr.has(a.char(n,l.start-1)))return!1;const o=l.end-l.start;let r=0;for(let c=l.start;c<l.end;c++)if(nd.has(a.char(n,c)))r++;else if(c-l.start-r>o*.1)return!1;return r>=o*.9}function ol(a){return`${a.start}-${a.end}`}function Ay(a,n,l){if(l.start===0)return a.top;for(let o=n-1;o>=a.top;o--)if(wC.has(a.char(o,l.start-1)))return o;return a.top}function OC(a,n,l){const o=l.start-1,r=l.end,{row:c}=n;if(o<0||r>=a.cols)return null;const h=a.char(c,o);if(!sr.has(h)||a.char(c,r)!==h)return null;let m=c-1;for(;m>=a.top&&a.char(m,o)===h;)m--;let p=c+1;for(;p<=a.bottom&&a.char(p,o)===h;)p++;if(p-m-1>Md||!xC.has(a.char(m,o))||!SC.has(a.char(m,r))||!CC.has(a.char(p,o))||!TC.has(a.char(p,r))||a.dim(c,o))return null;const g=l.start+Hg,y=l.end-Hg;return n.col<g||n.col>=y?null:{kind:"frame",key:`frame:${ol(l)}`,region:ol(l),layout:`${m}`,row:c,caretCol:n.col,startCol:g,endCol:y,empty:m+2===p&&n.col===g&&a.blankOrDim(c,g,y),agentLike:!0,vimInsert:null,modal:!1,midWord:!1}}function DC(a,n,l){const{row:o}=n;let r=-1;for(let y=o-1;y>=Math.max(a.top,o-Md);y--)if(Ug(a,y,l)){r=y;break}if(r<0)return null;let c=-1;for(let y=o+1;y<=Math.min(a.bottom,o+Md);y++)if(Ug(a,y,l)){c=y;break}if(c<0)return null;const h=r+1;let m=-1;for(let y=l.start;y<Math.min(l.end,l.start+3);y++){const v=a.char(h,y);if(!Nn(v)){My.has(v)&&Nn(a.char(h,y+1))&&(m=y);break}}if(m<0||a.dim(h,m)||jC.test(a.text(h,m+1,l.end)))return null;for(let y=h+1;y<c;y++)for(let v=l.start;v<l.start+Ad;v++)if(!Nn(a.char(y,v)))return null;let p="";for(let y=c+1;y<=Math.min(a.bottom,c+EC)&&!vr.has(a.char(y,l.start-1));y++)p+=`${a.text(y,l.start,l.end)}
48
+ `;if(RC.test(p)||_C.test(p))return null;const g=o===h?m+2:l.start+Ad;return n.col<g||n.col>=l.end?null:{kind:"rule",key:`rule:${ol(l)}:${Ay(a,r,l)}`,region:ol(l),layout:`${r}`,row:o,caretCol:n.col,startCol:g,endCol:l.end,empty:c-r===2&&n.col===g&&a.blankOrDim(o,g,l.end),agentLike:!0,vimInsert:Bg.test(p),modal:Bg.test(p),midWord:!1}}function zC(a,n,l){if(n.hidden)return null;const{row:o,col:r}=n,c=HC(a,n,l);if(c!==void 0)return c;for(let h=r-1;h>=l.start;h--){if(a.char(o,h)!==">")continue;const m=a.text(o,l.start,h+1).trimStart();if(/^(?:[a-z]:\\.*|\\\\[^\\]+\\[^\\]+.*|PS\s+[a-z]:\\.*)>$/i.test(m))return or(a,n,l,o,h+1,!1)}for(let h=r-2;h>=l.start;h--)if(!(!zg.has(a.char(o,h))||!Nn(a.char(o,h+1))))return a.dim(o,h)?null:or(a,n,l,o,h+2,h===l.start);for(let h=o-1;h>=Math.max(a.top,o-kC);h--){let m=l.end-1;for(;m>=l.start&&Nn(a.char(h,m));)m--;if(m>=l.end-1-NC&&zg.has(a.char(h,m)))return a.dim(h,m)?null:or(a,n,l,h,l.start,!1);if(m<l.end-1)return null}return null}function HC(a,n,l){const{row:o}=n,r=l.start+Ad,c=h=>Nn(a.char(h,l.start))&&Nn(a.char(h,l.start+1));if(c(o))for(let h=o-1;h>=Math.max(a.top,o-LC);h--){if(My.has(a.char(h,l.start))&&Nn(a.char(h,l.start+1)))return a.dim(h,l.start)?null:or(a,n,l,h,r,!0,r);if(!c(h)||a.blankOrDim(h,r,l.end))return}}function or(a,n,l,o,r,c,h=l.start){const m=n.row===o?r:h;if(n.col<m||n.col>=l.end)return null;const p=l.end-2,g=n.row>o&&h>l.start&&n.col===m&&!Nn(a.char(n.row-1,p));return{kind:"prompt",key:`prompt:${ol(l)}:${Ay(a,o,l)}`,region:ol(l),layout:`${o}`,row:n.row,caretCol:n.col,startCol:m,endCol:l.end,empty:n.row===o&&n.col===m&&a.blankOrDim(n.row,m,l.end),agentLike:c,vimInsert:null,modal:!1,midWord:g}}function BC(a,n){const l=new MC(a);if(n.row<l.top||n.row>l.bottom||n.col<0||n.col>=a.cols)return null;const o=AC(l,n.row,n.col);return o?OC(l,n,o)??DC(l,n,o)??zC(l,n,o):null}class UC{constructor(){$(this,"insertSeen",new Set)}detect(n,l){const o=BC(n,l);return!o||o.vimInsert===null?o:o.vimInsert?(this.insertSeen.add(o.region),o):this.insertSeen.has(o.region)?null:o}reset(){this.insertSeen.clear()}}class KC{constructor(n){$(this,"tracker",new UC);$(this,"cached");$(this,"lastComplete",null);$(this,"detect",()=>{var n,l;if((l=(n=this.options).isSynchronizing)!=null&&l.call(n))return this.lastComplete;if(this.cached===void 0){const o=this.options.getScreen(),r=this.options.getCursor();this.cached=o&&r?this.tracker.detect(o,r):null,this.lastComplete=this.cached}return this.cached});this.options=n}invalidate(){this.cached=void 0}reset(){this.tracker.reset(),this.cached=void 0,this.lastComplete=null}}const Ja=4294967295;var Qe=(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))(Qe||{}),Je=(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))(Je||{}),ct=(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))(ct||{}),ji=(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))(ji||{}),el=(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))(el||{});function IC(){return{content:0,fg:0,bg:0,combinedData:"",extended:void 0}}const Ey={fg:0,bg:0,ext:0};function Ny(a){return a.bg&268435456&&a.extended?a.extended.ext>>>0:0}function FC(a){return a>>>26&7}function GC(a){return a&67108863}function YC(a,n){const l=a.codePointAt(0)??0;return a.length>0&&String.fromCodePoint(l).length===a.length?{content:l|n<<22,combinedData:""}:{content:2097152|n<<22,combinedData:a}}function ky(a){const n=a;return!n||typeof n.fg!="number"||typeof n.bg!="number"?null:{fg:n.fg>>>0,bg:n.bg>>>0,ext:Ny(n)}}class PC{constructor(n){$(this,"items",[]);$(this,"target",null);$(this,"provider",()=>this.paint());this.options=n}attach(n){var l;this.target!==n&&((l=this.target)==null||l.setOverlayProvider(null),this.target=n,n==null||n.setOverlayProvider(this.provider))}sync(n){var l;n.length===0&&this.items.length===0||(this.items=n,(l=this.target)==null||l.invalidateOverlay())}clear(){var n;this.items.length!==0&&(this.items=[],(n=this.target)==null||n.invalidateOverlay())}hasItems(){return this.items.length>0}dispose(){this.attach(null),this.items=[]}paint(){var x,w;const n=this.options.getTerminal(),l=n==null?void 0:n.buffer.active;if(!n||!l)return null;const o=this.options.isCursorHidden(),r=l.baseY+l.cursorY,c=l.cursorX,h=Ed(n,r,c),m=o&&!!h&&Ly(h);if(this.items.length===0){if(!m)return null;const S=((w=(x=l.getLine(r))==null?void 0:x.getCell(c))==null?void 0:w.getChars())??"";return{cells:[],paintedCaret:Kg(r,c,S,h)}}const p=[];let g,y;for(const S of this.items)switch(S.kind){case"char":p.push({row:S.row,col:S.col,chars:S.char,width:S.width,style:S.style??$C(n,S.row,S.col)});break;case"erase":p.push({row:S.row,col:S.col,chars:" ",width:S.width,style:VC(S.style??Ed(n,S.row,S.col)??Ey)});break;case"mask":m&&S.row===r&&S.col===c&&p.push({row:S.row,col:S.col,chars:S.char,width:1,style:S.style??_y(h)});break;case"caret":o?m&&(p.push({row:S.row,col:S.col,chars:S.char,width:1,style:h}),y=Kg(S.row,S.col,S.char,h)):g={row:S.row,col:S.col};break}const v={cells:p};return g!==void 0&&(v.cursor=g),y&&(v.paintedCaret=y),v}}function Kg(a,n,l,o){return{row:a,col:n,style:o,plain:{row:a,col:n,chars:l||" ",width:1,style:_y(o)}}}function Ed(a,n,l){var o;return l<0||l>=a.cols?null:ky((o=a.buffer.active.getLine(n))==null?void 0:o.getCell(l))}function Ly(a){return(a.fg&ct.INVERSE)!==0||(a.bg&Je.CM_MASK)!==Je.CM_DEFAULT}function _y(a){return{fg:a.fg&~ct.INVERSE,bg:a.bg&~(Je.CM_MASK|Je.RGB_MASK),ext:a.ext}}function VC(a){return{fg:a.fg&ct.INVERSE?a.fg&(ct.INVERSE|Je.CM_MASK|Je.RGB_MASK):0,bg:a.bg&(Je.CM_MASK|Je.RGB_MASK),ext:0}}function $C(a,n,l){const o=Ed(a,n,l-1);return o&&!Ly(o)&&!(o.bg&ji.DIM)?o:Ey}const Ry="\x1B",qC=/^\x1b\[[IO]/,jy=/^\x1b\[<(\d+);\d+;\d+[Mm]/,XC=/^\x1b\[M[\s\S]{3}/,ZC=[/^\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\\/],WC=/^\x1b\[1;[2-8]R/;function Ig(a){if(WC.test(a))return 0;const n=qC.exec(a);if(n)return n[0].length;const l=jy.exec(a);if(l){const o=Number(l[1]);return(o&32)!==0&&(o&3)===3&&(o&64)===0?l[0].length:0}for(const o of ZC){const r=o.exec(a);if(r)return r[0].length}return 0}function Oy(a){if(!a.startsWith(Ry))return"keys";if(jy.test(a)||XC.test(a)){let l=a;for(;l.length>0;){const o=Ig(l);if(o===0)return"pointer";l=l.slice(o)}return"passive"}let n=a;for(;n.length>0;){const l=Ig(n);if(l===0)return"keys";n=n.slice(l)}return"passive"}function QC(a){return a===Ry}function Qn(a){return a===""||a===" "?" ":a}function JC(a,n,l,o=64){var h;const r=a.buffer.active.getLine(n),c=[];for(let m=l-1;m>=0&&c.length<o;m--){const p=r==null?void 0:r.getCell(m);if(!p)break;((h=p.getWidth)==null?void 0:h.call(p))!==0&&c.unshift(Qn(p.getChars()))}return c}function eT(a,n){for(let l=Math.min(a.length,n.length);l>0;l--){let o=!0;for(let r=0;r<l&&o;r++)o=n[n.length-l+r]===Qn(a[r]);if(o)return l}return 0}function tT(a){const n=a.buffer.active;return{key:"legacy",row:n.baseY+n.cursorY,caretCol:n.cursorX,startCol:n.cursorX,endCol:a.cols,empty:!1,agentLike:!1}}function nT(a,{style:n,predictedCursor:l,field:o,runStartedEmpty:r,active:c}){var w,S,M,N,k;const h=a.map(E=>{const R={row:E.row,col:E.col,char:E.cancelled?" ":E.char,width:E.width,kind:E.cancelled?"erase":E.kind};return n&&(R.style=n),R}),m=a[a.length-1],p=l??{row:m.row,col:m.kind==="erase"||m.cancelled?m.col:m.col+m.width},g=(E,R)=>h.some(H=>H.row===E&&H.col<=R&&R<H.col+H.width),y=a.some(E=>E.kind==="char"&&!E.cancelled);if(c&&o&&r&&y&&o.agentLike&&p.row===o.row){const E=c.getLine(p.row);for(let R=p.col;R<o.endCol;R++){if(g(p.row,R)||Qn(((w=E==null?void 0:E.getCell(R))==null?void 0:w.getChars())??"")===" ")continue;const H={row:p.row,col:R,char:" ",width:1,kind:"erase"};n&&(H.style=n),h.push(H)}}if(c){const E={row:c.baseY+c.cursorY,col:c.cursorX};if(!g(E.row,E.col)&&(E.row!==p.row||E.col!==p.col)){const R=((M=(S=c.getLine(E.row))==null?void 0:S.getCell(E.col))==null?void 0:M.getChars())??"",H={row:E.row,col:E.col,char:Qn(R),width:1,kind:"mask"};n&&(H.style=n),h.push(H)}}const v=h.find(E=>E.row===p.row&&E.col===p.col&&E.kind!=="mask"),x=v?v.char:Qn(((k=(N=c==null?void 0:c.getLine(p.row))==null?void 0:N.getCell(p.col))==null?void 0:k.getChars())??"");return h.push({row:p.row,col:p.col,char:x,width:1,kind:"caret"}),h}const iT=[[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 Dy(a){if(a>=32&&a<=126)return 1;if(a<12288)return 0;for(const[n,l]of iT){if(a<n)return 0;if(a<=l)return 2}return 0}const Nd=["ctrl+b"],aT=new Map([["meta","alt"],["bs","backspace"],["minus","-"],["comma",","],["period","."],["slash","/"],["quote","'"],["double_quote",'"'],["double-quote",'"'],["semicolon",";"],["colon",":"],["percent","%"],["ampersand","&"],["backtick","`"]]),zy=["ctrl","control"],Hy=["alt","option","meta"],lT=[...zy,...Hy,"shift"];function Fg(a){const n=a.split("+"),l=[];try{l.push(...gn(n.map(c=>aT.get(c)??c).join("+")))}catch(c){if(c instanceof pn)return[];throw c}if(l.length!==1)return[];const o=n.find(c=>!lT.includes(c)),r=o==="space"?" ":o;if((r==null?void 0:r.length)===1&&n.some(c=>zy.includes(c))){const c=Od(r);c!==r&&l.push(n.some(h=>Hy.includes(h))?`\x1B${c}`:c)}return l}class Gg{constructor(n){$(this,"sequences");const l=new Set(n.flatMap(Fg));this.sequences=l.size>0?[...l]:[...new Set(Nd.flatMap(Fg))]}startsAt(n,l){return this.sequences.some(o=>n.startsWith(o,l))}}function sT(a){let n,l=new Gg(Nd);return()=>{const o=a==null?void 0:a();return o!==n&&(n=o,l=new Gg(o??Nd)),l}}const Yg=8,oT=1500,rT=4e3,cT=20;class uT{constructor(n){$(this,"getTerminal");$(this,"getFieldOption");$(this,"charWidth");$(this,"herdrPrefix");$(this,"now");$(this,"textDecoder",new TextDecoder("utf-8"));$(this,"confidentKeys",new Set);$(this,"fieldStyles",new Map);$(this,"field",null);$(this,"runStartedEmpty",!1);$(this,"predictions",[]);$(this,"predictedCursor",null);$(this,"srtt",null);$(this,"isSuppressed",!1);$(this,"suppressCursor",null);$(this,"suppressSentAt",0);$(this,"inFlight",[]);$(this,"inFlightUnknown",!1);$(this,"runInFlight",[]);$(this,"probationRun",!1);$(this,"runSent",[]);$(this,"lastSentUndrawn",!1);$(this,"awaitingPrefixCommand",!1);$(this,"mismatches",0);$(this,"trace",[]);this.getTerminal=n.getTerminal,this.getFieldOption=n.getField,this.charWidth=n.charWidth,this.herdrPrefix=sT(n.getHerdrPrefixKeys),this.now=n.now??(typeof performance<"u"&&typeof performance.now=="function"?()=>performance.now():()=>Date.now())}updateSuppression(n){if(!this.isSuppressed)return;if(this.predictions.some(o=>o.frozenFrom)){this.suppressSentAt=this.now();return}!!n&&!!this.suppressCursor&&(n.row!==this.suppressCursor.row||n.col!==this.suppressCursor.col)?this.liftSuppression():this.stillSuppressed()}reset(n,l){var c;this.predictions=[],this.predictedCursor=null;const o=typeof l=="boolean"?l:(l==null?void 0:l.suppress)??!0,r=typeof l=="object"&&(l==null?void 0:l.demote)===!0;if(this.note(`reset: ${n??"unspecified"}`),r){const h=this.field??((c=this.getFieldOption)==null?void 0:c.call(this))??null;h&&this.confidentKeys.delete(h.key)}if(this.forgetInFlight(),o){this.isSuppressed=!0,this.suppressSentAt=this.now();const h=this.getTerminal();h?this.suppressCursor={row:h.buffer.active.baseY+h.buffer.active.cursorY,col:h.buffer.active.cursorX}:this.suppressCursor=null}else this.isSuppressed=!1,this.suppressCursor=null}forgetConfidence(){this.confidentKeys.clear(),this.fieldStyles.clear(),this.field=null}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 n=this.getState()==="confident";return this.predictions.filter(l=>l.frozenFrom?l.shownWhenFrozen:n&&!l.probation)}freeze(n,l={}){var p;const o=this.getTerminal(),r=o?{row:o.buffer.active.baseY+o.buffer.active.cursorY,col:o.buffer.active.cursorX}:null,c=this.getState()==="confident";this.predictions=this.predictions.filter(g=>!g.cancelled);for(const g of this.predictions)g.frozenFrom||(g.frozenFrom=r??{row:g.row,col:g.col},g.shownWhenFrozen=c&&!g.probation);const h=this.predictedCursor?{...this.predictedCursor}:r,m=this.inFlight.length>0||this.inFlightUnknown||this.lastSentUndrawn||this.probationRun&&this.runSent.length===0;if(this.predictedCursor=null,this.note(`freeze: ${n}${l.demote?" (demote)":""}`),l.demote){const g=this.field??((p=this.getFieldOption)==null?void 0:p.call(this))??null;g&&this.confidentKeys.delete(g.key)}this.isSuppressed=!0,this.suppressSentAt=this.now(),this.suppressCursor=h,this.forgetInFlight(),this.inFlightUnknown=m}forgetInFlight(){this.inFlight=[],this.inFlightUnknown=!1,this.runInFlight=[],this.runSent=[],this.probationRun=!1,this.lastSentUndrawn=!1}suppressTimeout(){return Math.max(300,(this.srtt??300)*1.5)}predictionTimeout(){return Math.min(rT,Math.max(oT,(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}assumedWidth(n){var o;const l=(o=this.charWidth)==null?void 0:o.call(this,n);return l===0||l===1||l===2?l:1}coveredByPrediction(n,l){return this.predictions.some(o=>(o.echoed||o.cancelled||o.kind==="erase"&&!o.frozenFrom)&&o.row===n&&o.col<=l&&l<o.col+o.width)}ensureField(n){if(this.predictedCursor&&this.field)return this.field;const l=this.getFieldOption?this.getFieldOption():tT(n);if(!l)return null;let o=l.caretCol,r=[],c=this.inFlightUnknown;if(this.inFlight.length>0&&!this.inFlightUnknown){r=this.inFlight.slice(eT(this.inFlight,JC(n,l.row,o)));for(const h of r){const m=h.codePointAt(0)??0;o+=Dy(m)||this.assumedWidth(m)}c=r.length>0}return this.inFlight=[],this.inFlightUnknown=!1,this.field=l,this.runStartedEmpty=l.empty&&r.length===0,this.predictions=this.predictions.filter(h=>h.frozenFrom),this.predictedCursor={row:l.row,col:o},this.runInFlight=r,this.probationRun=c,this.runSent=[],l}confirm(n,l){if(this.updateSrtt(Math.max(0,this.now()-n.sentAt)),l&&!n.frozenFrom&&this.markConfident(l.key),n.probation&&n.kind==="char"){for(const o of this.predictions)o.probation=void 0;this.probationRun=!1,this.runInFlight=[],this.runSent=[]}}learnStyle(n,l){const o=ky(l);if(o)for(this.fieldStyles.delete(n),this.fieldStyles.set(n,o);this.fieldStyles.size>Yg;){const r=this.fieldStyles.keys().next().value;if(r===void 0)break;this.fieldStyles.delete(r)}}markConfident(n){for(this.confidentKeys.delete(n),this.confidentKeys.add(n);this.confidentKeys.size>Yg;){const l=this.confidentKeys.values().next().value;if(l===void 0)break;this.confidentKeys.delete(l)}}mismatch(n){this.mismatches++,this.note(`mismatch: ${n}`),this.predictions=[],this.predictedCursor=null,this.field&&this.confidentKeys.delete(this.field.key),this.isSuppressed=!1,this.suppressCursor=null}note(n){const l=this.trace[this.trace.length-1];if(l&&l.event===n){l.count++,l.at=this.now();return}this.trace.push({at:this.now(),event:n,count:1}),this.trace.length>cT&&this.trace.shift()}pruneExpired(){if(this.predictions.length===0)return;const n=this.now(),l=this.predictionTimeout(),o=this.predictions.filter(r=>n-r.sentAt<=l);o.length!==this.predictions.length&&(this.note("expired without an echo"),this.predictions=o,this.predictions.length===0&&(this.predictedCursor=null))}updateSrtt(n){this.srtt===null?this.srtt=n:this.srtt=this.srtt*.8+n*.2}}const dT="?!#";class fT extends uT{handlePrintable(n,l,o){var S;const r=this.ensureField(o);if(!r||!this.predictedCursor)return this.note("refused: caret is not in an input field"),!1;const c=this.predictedCursor,h=this.predictions.every(M=>M.frozenFrom||M.cancelled)&&c.col===r.caretCol;if(r.agentLike&&r.empty&&h&&dT.includes(n))return this.freeze("agent mode switch"),!1;if(r.midWord&&h)return this.freeze("the word above may move down"),!1;if(c.col+l>r.endCol-1)return this.freeze("cursor would reach the edge of the field"),!1;const m=(S=o.buffer.active.getLine(c.row))==null?void 0:S.getCell(c.col),p=[Qn(m?m.getChars():"")],g=this.predictions.findIndex(M=>M.kind==="erase"&&!M.frozenFrom&&M.row===c.row&&M.col===c.col);let y;g>=0&&([y]=this.predictions.splice(g,1),p.push(...y.before," "));for(const M of this.predictions)M.cancelled&&M.row===c.row&&M.col===c.col&&p.push(M.char);const v=o.buffer.active,x=v.baseY+v.cursorY,w=x>c.row||x===c.row&&v.cursorX>c.col;return this.predictions.push({row:c.row,col:c.col,char:n,width:l,kind:"char",before:p,sentAt:this.now(),replaces:y,probation:this.probationRun||void 0,behindCaret:w||void 0}),this.probationRun&&this.runSent.push(n),this.lastSentUndrawn=!1,c.col+=l,!0}skipUnpredictable(n,l,o){const r=this.ensureField(o),c=this.predictedCursor;if(!r||!c)return this.note("refused: caret is not in an input field"),!1;const h=this.assumedWidth(l);return c.col+h>r.endCol-1?(this.freeze("cursor would reach the edge of the field"),!1):(this.probationRun||(this.probationRun=!0,this.runSent=[]),this.runSent.push(n),this.lastSentUndrawn=!0,c.col+=h,this.note("width unknown: guessing"),!0)}handleBackspace(n){var o,r,c;let l;for(let h=this.predictions.length-1;h>=0&&!l;h--)this.predictions[h].cancelled||(l=this.predictions[h]);if(this.predictedCursor&&l&&!l.frozenFrom&&!l.echoed&&l.kind==="char"&&l.row===this.predictedCursor.row&&l.col+l.width===this.predictedCursor.col)return l.cancelled=!0,l.probation&&this.runSent.pop(),this.predictedCursor.col=l.col,l.replaces&&(this.predictions.splice(this.predictions.indexOf(l),0,l.replaces),l.replaces=void 0),!0;if(this.stillSuppressed())this.inFlightUnknown=!0;else{const h=this.ensureField(n),m=this.predictedCursor;if(h&&m){const p=n.buffer.active.getLine(m.row),g=p==null?void 0:p.getCell(m.col-1),y=g&&((o=g.getWidth)==null?void 0:o.call(g))===0?2:1,v=m.col-y;let x=!0;for(let S=m.col;S<h.endCol&&x;S++)x=this.coveredByPrediction(m.row,S)||Qn(((r=p==null?void 0:p.getCell(S))==null?void 0:r.getChars())??"")===" ";const w=Qn(((c=p==null?void 0:p.getCell(v))==null?void 0:c.getChars())??"");if(v>h.startCol&&x&&w!==" ")return this.predictions=this.predictions.filter(S=>!(S.echoed&&S.row===m.row&&S.col+S.width>v)),this.predictions.push({row:m.row,col:v,char:" ",width:y,kind:"erase",before:[w],sentAt:this.now(),probation:this.probationRun||void 0}),this.lastSentUndrawn=!1,m.col=v,!0}}return this.freeze("backspace into server content"),!1}}class hT extends fT{handleUserInput(n){var p;if(this.pruneExpired(),n.length===0)return;const l=this.textDecoder.decode(n,{stream:!1});if(!l)return;const o=Oy(l);if(o==="passive")return;if(o==="pointer"){this.freeze("pointer");return}if(this.awaitingPrefixCommand){this.awaitingPrefixCommand=!1,this.freeze("Herdr prefix command",{demote:!0});return}const r=this.herdrPrefix();if(QC(l)&&!r.startsAt(l,0)){const g=this.field??((p=this.getFieldOption)==null?void 0:p.call(this))??null;this.freeze("escape",{demote:(g==null?void 0:g.modal)!==!1});return}const c=this.getTerminal();if(!c){this.reset("terminal unavailable",!0);return}const h=Array.from(l);let m=0;for(let g=0;g<h.length;g++){const y=h[g],v=y.codePointAt(0);if(v===void 0)continue;const x=m;if(m+=y.length,r.startsAt(l,x)){this.awaitingPrefixCommand=!0,this.freeze("Herdr prefix",{demote:!0});return}if(v===27||v===9||v===10||v===13||v<32&&v!==8){this.freeze("control or escape sequence");return}if(v===8||v===127){if(!this.handleBackspace(c)){g<h.length-1&&(this.inFlightUnknown=!0);return}continue}if(this.stillSuppressed()){this.inFlight.push(y),this.note("refused: waiting for the caret to move");continue}const w=Dy(v);if(w===0){if(!this.skipUnpredictable(y,v,c)){g<h.length-1&&(this.inFlightUnknown=!0);return}continue}if(!this.handlePrintable(y,w,c)){g<h.length-1&&(this.inFlightUnknown=!0);return}}}onServerOutput(){const n=this.getTerminal(),l=n?{row:n.buffer.active.baseY+n.buffer.active.cursorY,col:n.buffer.active.cursorX}:null;this.pruneExpired(),n&&l&&this.predictions.length>0&&this.settle(n,l),this.updateSuppression(l)}settle(n,l){var h,m;const o=this.field;if(this.getFieldOption){const p=this.getFieldOption();if(!p||p.key!==(o==null?void 0:o.key)){if(this.predictions.every(g=>g.frozenFrom||g.echoed||g.cancelled)){this.predictions=[],this.predictedCursor=null;return}this.mismatch("field changed");return}if(p.layout!==o.layout){this.predictions=[],this.predictedCursor=null,this.field=p,this.note("layout changed");return}}let r=[],c=!1;for(const p of this.predictions){if(p.cancelled){if(!c){const M=l.row>p.row||l.row===p.row&&l.col>=p.col+p.width;if(M||(p.behindCaret=void 0),p.passed&&!M)continue;M&&!p.behindCaret&&(p.passed=!0)}r.push(p),c=!0;continue}const g=(h=n.buffer.active.getLine(p.row))==null?void 0:h.getCell(p.col),y=Qn(g?g.getChars():""),v=p.kind==="char"?y===p.char&&(p.width===1||(((m=g==null?void 0:g.getWidth)==null?void 0:m.call(g))??2)===2):y===" ",x=p.before.includes(y);p.behindCaret&&(l.row<p.row||l.row===p.row&&l.col<=p.col)&&(p.behindCaret=void 0);const w=p.kind==="char"?(l.row>p.row||l.row===p.row&&l.col>=p.col+p.width)&&!(p.behindCaret&&x):l.row<p.row||l.row===p.row&&l.col<=p.col,S=p.kind==="char"&&y===p.char&&!v;if(c&&!p.frozenFrom){if(!v||x){r.push(p);continue}r=r.filter(M=>!M.cancelled),c=!1}if(!(p.echoed&&!v))if(v&&(w||!x)){if(p.echoed||this.confirm(p,o),w){p.kind==="char"&&o&&!p.frozenFrom&&this.learnStyle(o.key,g);continue}p.echoed=!0,r.push(p)}else if(p.frozenFrom){const M=p.frozenFrom,N=p.kind==="erase"||l.col>=M.col;!w&&l.row===M.row&&N?r.push(p):w&&p.probation&&(this.inFlightUnknown=!0)}else if(!w&&!S)r.push(p);else if(p.probation){this.note("probation guess dropped"),this.predictions.some(M=>!M.frozenFrom&&M.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(M=>M.frozenFrom),this.predictedCursor=null;return}else{this.mismatch(`cell shows ${JSON.stringify(y)} for ${JSON.stringify(p.char)}`);return}}this.predictions=r,r.length===0&&(this.predictedCursor=null,this.probationRun&&(this.inFlightUnknown=!0))}getVisiblePredictions(){return this.pruneExpired(),this.visiblePredictions().filter(n=>!n.echoed&&!n.cancelled).map(n=>({row:n.row,col:n.col,char:n.char}))}getOverlayItems(){var l;this.pruneExpired();const n=this.visiblePredictions();return n.length===0?[]:nT(n,{style:this.field?this.fieldStyles.get(this.field.key):void 0,predictedCursor:this.predictedCursor,field:this.field,runStartedEmpty:this.runStartedEmpty,active:(l=this.getTerminal())==null?void 0:l.buffer.active})}}const mT=25,pT=2026,gT=1e3;function bT(a,n=()=>performance.now()){let l=!1,o=null;const r=new Set,c=y=>(r.add(y),{dispose:()=>void r.delete(y)}),h=()=>{l=!1,o=null},m=a.parser;if(!m||typeof m.registerCsiHandler!="function")return{isCursorHidden:()=>!1,isSynchronizing:()=>!1,onSyncEnd:c,reset:h,dispose:()=>{}};const p=y=>v=>{for(const x of v.flat())if(x===mT&&(l=!y),x===pT){const w=!y&&o!==null;if(o=y?n():null,w)for(const S of[...r])S()}return!1},g=[m.registerCsiHandler({prefix:"?",final:"h"},p(!0)),m.registerCsiHandler({prefix:"?",final:"l"},p(!1)),m.registerCsiHandler({intermediates:"!",final:"p"},()=>(h(),!1))];return typeof m.registerEscHandler=="function"&&g.push(m.registerEscHandler({final:"c"},()=>(h(),!1))),{isCursorHidden:()=>l,isSynchronizing:()=>o!==null&&n()-o<gT,onSyncEnd:c,reset:h,dispose:()=>{for(const y of g)y.dispose();r.clear()}}}const yT=40;function vT(a,n){return a==="off"?!1:a==="always"?!0:n!==null&&n>yT}function xT(a,n,l){var p;const o=bT(a),r=new KC({getScreen:()=>{const g=n();if(!g)return null;const y=g.buffer.active;return{cols:g.cols,rows:g.rows,baseY:y.baseY,getLine:v=>y.getLine(v),getNullCell:typeof y.getNullCell=="function"?()=>y.getNullCell():void 0}},getCursor:()=>{var y;const g=(y=n())==null?void 0:y.buffer.active;return g?{row:g.baseY+g.cursorY,col:g.cursorX,hidden:o.isCursorHidden()}:null},isSynchronizing:o.isSynchronizing}),c=(p=a._core)==null?void 0:p.unicodeService,h=new hT({getTerminal:n,getField:r.detect,getHerdrPrefixKeys:l,charWidth:typeof(c==null?void 0:c.wcwidth)=="function"?g=>c.wcwidth(g):void 0}),m=new PC({getTerminal:n,isCursorHidden:()=>o.isCursorHidden()});return{screenState:o,fieldProbe:r,predictor:h,overlay:m}}function wT({termRef:a,rendererRef:n,mode:l,connectionState:o,observeKeyInput:r,herdrPrefixKeys:c}){const h=T.useRef(null),m=T.useRef(null),p=T.useRef(null),g=En(l),y=En(c),v=T.useCallback(()=>{const k=h.current,E=m.current;if(!(!k||!E)){if(!vT(g.current,k.getEchoSrttMs())){E.clear();return}E.sync(k.getOverlayItems())}},[g]),x=T.useCallback(k=>{var E,R,H,j;(E=h.current)==null||E.reset(k),(R=h.current)==null||R.forgetConfidence(),(H=p.current)==null||H.reset(),(j=m.current)==null||j.clear()},[]),w=T.useCallback(k=>{var E,R;(E=h.current)==null||E.reset(k),(R=m.current)==null||R.clear()},[]),S=T.useCallback(k=>{var E,R,H;(E=h.current)==null||E.handleUserInput(k),v(),(H=(R=n.current)==null?void 0:R.canvas)==null||H.markInput()},[v,n]),M=T.useCallback(k=>{const E=xT(k,()=>a.current,()=>y.current);return p.current=E.fieldProbe,h.current=E.predictor,m.current=E.overlay,E},[a,y]),N=T.useCallback(()=>{var k;(k=m.current)==null||k.dispose(),m.current=null,h.current=null,p.current=null},[]);return T.useEffect(()=>r(S),[r,S]),T.useEffect(()=>{v()},[l,v]),T.useEffect(()=>{x("connectionState")},[o,x]),{predictorRef:h,overlayRef:m,fieldProbeRef:p,attach:M,detach:N,sync:v,forget:x,discard:w,onUserInput:S}}const ST=20,CT=6,TT=500,MT=300,rl=13,By=.602,Uy=1.3;function Wn(a,n){return Number.isFinite(a)&&a>0?a:n}function Pg(a,n,l){return Math.min(l,Math.max(n,a))}function Ky(a){const{width:n,height:l,cellWidth:o,cellHeight:r,minCols:c=ST,minRows:h=CT,maxCols:m=TT,maxRows:p=MT}=a,g=Wn(o,rl*By),y=Wn(r,rl*Uy);return{cols:Pg(Math.floor(Wn(n,0)/g),c,m),rows:Pg(Math.floor(Wn(l,0)/y),h,p)}}function oa(a,n=rl){var o,r,c;if(a)try{const h=a._core,m=(c=(r=(o=h==null?void 0:h._renderService)==null?void 0:o.dimensions)==null?void 0:r.css)==null?void 0:c.cell;if(m!=null&&m.width&&m.width>0&&m.height&&m.height>0)return{cellWidth:m.width,cellHeight:m.height,measured:!0}}catch{}const l=Wn(n,rl);return{cellWidth:Math.round(l*By*100)/100,cellHeight:Math.round(l*Uy*100)/100,measured:!1}}function AT(a){var o;const n=(o=a==null?void 0:a.querySelector)==null?void 0:o.call(a,".xterm-viewport");if(!n)return 0;const l=(n.offsetWidth||0)-(n.clientWidth||0);return Number.isFinite(l)&&l>0?l:0}function kd(a,n,l){if(!a)return{width:n,height:l};let o=0,r=0;if(typeof a.getBoundingClientRect=="function"){const c=a.getBoundingClientRect();o=(c==null?void 0:c.width)||0,r=(c==null?void 0:c.height)||0}return{width:Wn(o,Wn(a.clientWidth,n)),height:Wn(r,Wn(a.clientHeight,l))}}function Iy(a,n,l,o){const r=Number.isFinite(o)&&o>.01?o:1;return{clientX:l.left+(a-l.left)/r,clientY:l.top+(n-l.top)/r}}function Vg(a,n){const l=typeof window<"u"?window:void 0,o=l&&typeof l.devicePixelRatio=="number"&&l.devicePixelRatio>0?l.devicePixelRatio:1,r=l!=null&&l.visualViewport&&typeof l.visualViewport.scale=="number"&&l.visualViewport.scale>0?l.visualViewport.scale:1,c=Math.max(0,a.width),h=Math.max(0,a.height),m=Math.round(c*o*100)/100,p=Math.round(h*o*100)/100;return{dpr:o,scale:r,cssWidth:c,cssHeight:h,physicalWidth:m,physicalHeight:p}}function ET(a){const{lastSnapshot:n,currentSnapshot:l,physicalTolerancePx:o=6}=a;if(!n)return{shouldIgnore:!1,isVisualZoom:!1,reason:"initial"};const r=Math.abs(l.scale-n.scale)>.01,c=Math.abs(l.scale-1)>.01;if(r||c)return{shouldIgnore:!0,isVisualZoom:!0,reason:"visual_pinch_zoom"};if(Math.abs(l.dpr-n.dpr)>.01){const g=Math.abs(l.physicalWidth-n.physicalWidth),y=Math.abs(l.physicalHeight-n.physicalHeight);if(g<=o&&y<=o)return{shouldIgnore:!0,isVisualZoom:!0,reason:"dpr_zoom"}}const m=Math.abs(l.cssWidth-n.cssWidth),p=Math.abs(l.cssHeight-n.cssHeight);return m<1&&p<1?{shouldIgnore:!0,isVisualZoom:!1,reason:"no_box_change"}:{shouldIgnore:!1,isVisualZoom:!1,reason:"genuine_resize"}}const NT=250;function kT({termRef:a,containerRef:n,frameRef:l,surfaceRef:o,currentScaleRef:r,rendererRef:c,initialBannerWrittenRef:h,isActiveRef:m,sendResize:p,onResized:g}){const y=En(p),v=En(g),x=T.useRef({cols:0,rows:0}),w=T.useRef(null),S=T.useRef(null),M=T.useRef(null),N=T.useRef(null),k=T.useRef({width:0,height:0}),E=T.useRef(null),R=T.useRef(!1),H=T.useCallback(()=>{const ie=w.current;w.current=null,ie&&(ie.cols===x.current.cols&&ie.rows===x.current.rows||(x.current=ie,y.current(ie.cols,ie.rows),v.current()))},[y,v]),j=T.useCallback((ie,re,P=!1)=>{if(!(!Number.isFinite(ie)||!Number.isFinite(re)||ie<=0||re<=0)&&!(ie===x.current.cols&&re===x.current.rows)){if(w.current={cols:ie,rows:re},P){S.current&&clearTimeout(S.current),S.current=null,H();return}S.current||(S.current=setTimeout(()=>{S.current=null,H()},NT))}},[H]),D=T.useCallback((ie=!1,re=!1)=>{var be;const P=a.current,A=n.current,G=o.current,W=l.current;if(!P||!A||!G||!W)return;const se=kd(A,il(),ud());if(se.width<=0||se.height<=0)return;W.style.width="100%",W.style.height="100%",G.style.width="100%",G.style.height="100%",G.style.transform="none",G.style.transformOrigin="top left",r.current=1;const Q=Vg(se),ge=ET({lastSnapshot:E.current,currentSnapshot:Q});if(ge.isVisualZoom&&!ie){E.current=Q;try{P.refresh(0,Math.max(0,P.rows-1))}catch{}return}if(ge.shouldIgnore&&!ie)return;E.current=Q;const ye=oa(P,rl),ue=Ky({width:se.width-AT(G),height:se.height,cellWidth:ye.cellWidth,cellHeight:ye.cellHeight}),Te=Math.abs(se.width-k.current.width)>1||Math.abs(se.height-k.current.height)>1;if(P.cols!==ue.cols||P.rows!==ue.rows)try{P.resize(ue.cols,ue.rows)}catch(ae){console.debug("Error resizing terminal grid:",ae)}h.current&&!R.current&&(Te||P.cols!==ue.cols||P.rows!==ue.rows)&&(R.current=!0,(be=c.current)==null||be.verify());const ce=ue.cols!==x.current.cols||ue.rows!==x.current.rows;m.current&&(Te||ie||ce)&&(k.current={width:se.width,height:se.height},j(ue.cols,ue.rows,re));try{P.refresh(0,Math.max(0,P.rows-1))}catch{}},[a,n,o,l,r,c,h,m,j]),_=T.useRef(D);_.current=D;const z=T.useCallback(()=>{if(M.current===null){if(typeof requestAnimationFrame!="function"){_.current();return}M.current=requestAnimationFrame(()=>{M.current=null,_.current()})}},[]),K=T.useCallback((ie=30)=>{N.current!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(N.current),N.current=null);let re=0;const P=()=>{N.current=null,re++;const A=re>=ie;_.current(!0),!A&&re<2&&typeof requestAnimationFrame=="function"&&(N.current=requestAnimationFrame(P))};typeof requestAnimationFrame=="function"?N.current=requestAnimationFrame(P):P()},[]),q=T.useCallback(()=>_.current(!0,!0),[]),te=T.useCallback(ie=>{k.current={width:ie.width,height:ie.height},E.current=Vg(ie)},[]),Z=T.useCallback(()=>{S.current&&(clearTimeout(S.current),S.current=null),M.current!==null&&(cancelAnimationFrame(M.current),M.current=null),N.current!==null&&(cancelAnimationFrame(N.current),N.current=null)},[]);return{requestFit:z,scheduleBoundedFit:K,fitNow:q,seedFit:te,cancelPendingFits:Z}}const LT=" ()[]{}'\"\\`";function _T(a,n,l,o=1){var N,k;if(!((N=n==null?void 0:n.buffer)!=null&&N.active)||n.cols<=0||n.rows<=0)return null;const r=l||((k=n.element)==null?void 0:k.querySelector(".xterm-screen"))||n.element;if(!r||typeof r.getBoundingClientRect!="function")return null;const c=r.getBoundingClientRect(),h=Iy(a.clientX,a.clientY,c,o),m=oa(n);if(m.cellWidth<=0||m.cellHeight<=0)return null;const p=Math.max(1,c.width||n.cols*m.cellWidth),g=Math.max(1,c.height||n.rows*m.cellHeight),y=Math.max(0,Math.min(p-1,h.clientX-c.left)),v=Math.max(0,Math.min(g-1,h.clientY-c.top)),x=Math.max(0,Math.min(n.cols-1,Math.floor(y/m.cellWidth))),w=Math.max(0,Math.min(n.rows-1,Math.floor(v/m.cellHeight))),M=(n.buffer.active.viewportY??0)+w;return{col:x,bufferRow:M}}function RT(a,n){if(!a||a.length===0||a==="\0")return!0;for(const l of a)if(l==="\0"||/\s/.test(l)||n.includes(l))return!0;return!1}function jT(a,n,l){var x,w;if(!((x=a==null?void 0:a.buffer)!=null&&x.active)||n<0||n>=a.cols)return null;const o=a.buffer.active.getLine(l);if(!o)return null;const r=((w=a.options)==null?void 0:w.wordSeparator)??LT,c=new Array(a.cols).fill(null),h=Math.min(a.cols,o.length);let m=0;for(;m<h;){const S=o.getCell(m);if(!S){c[m]={startCol:m,endCol:m+1,isSeparator:!0},m++;continue}const M=S.getWidth();if(M===0){c[m]||(c[m]={startCol:m,endCol:m+1,isSeparator:!0}),m++;continue}const N=S.getChars(),k=RT(N,r),E=Math.min(a.cols,m+M),R={startCol:m,endCol:E,isSeparator:k};for(let H=m;H<E;H++)c[H]=R;m+=Math.max(1,M)}for(let S=h;S<a.cols;S++)c[S]||(c[S]={startCol:S,endCol:S+1,isSeparator:!0});const p=c[n];if(!p||p.isSeparator)return null;let g=p.startCol;for(;g>0;){const S=c[g-1];if(S&&!S.isSeparator)g=S.startCol;else break}let y=p.endCol;for(;y<a.cols;){const S=c[y];if(S&&!S.isSeparator)y=S.endCol;else break}const v=y-g;return v<=0?null:{startCol:g,length:v}}function OT(a){var c;if(!((c=a==null?void 0:a.buffer)!=null&&c.active))return"";const n=a.buffer.active,l=n.viewportY??0,o=a.rows,r=[];for(let h=0;h<o;h++){const m=n.getLine(l+h);r.push(m?m.translateToString(!0):"")}for(;r.length>0&&r[r.length-1]==="";)r.pop();return r.join(`
49
+ `)}const $g=new Set(["│","┃","╎","╏","┆","┇","┊","┋","║","▏","▕","|"]),DT=.6,zT=new Set(["─","━","═","┄","┅","┈","┉","-"]),HT=.8;function id(a,n){if(!a)return!1;let l=0;const o=Math.min(n,a.length);for(let r=0;r<o;r++){const c=a.getCell(r);if(c){const h=c.getChars();h&&zT.has(h)&&l++}}return l>=Math.max(5,Math.min(n*.25,10))}function ad(a,n,l){var w;if(!((w=a==null?void 0:a.buffer)!=null&&w.active)||a.cols<=0)return{startCol:0,endCol:0};const o=a.buffer.active,r=a.cols,c=Math.max(0,Math.min(r-1,n)),h=o.viewportY??0,m=a.rows>0?a.rows:1,p=new Int32Array(r);let g=0;for(let S=0;S<m;S++){const M=o.getLine(h+S);if(g++,!M)continue;const N=Math.min(r,M.length);for(let k=0;k<N;k++){const E=M.getCell(k);if(E){const R=E.getChars();R&&$g.has(R)&&p[k]++}}}if(g===0)return{startCol:0,endCol:r-1};const y=g*DT,v=S=>p[S]>=y;let x=!1;for(let S=0;S<r;S++)if(v(S)){x=!0;break}if(x){if(v(c))return{startCol:c,endCol:c};let S=-1;for(let N=c-1;N>=0;N--)if(v(N)){S=N;break}let M=r;for(let N=c+1;N<r;N++)if(v(N)){M=N;break}return{startCol:S+1,endCol:M-1}}if(l!==void 0){const S=Math.max(h,Math.min(h+m-1,l)),M=o.getLine(S);if(!id(M,r)){let N=h;for(let R=S-1;R>=h;R--)if(id(o.getLine(R),r)){N=R+1;break}let k=h+m-1;for(let R=S+1;R<=h+m-1;R++)if(id(o.getLine(R),r)){k=R-1;break}const E=k-N+1;if(E>=2){const R=new Int32Array(r);for(let _=N;_<=k;_++){const z=o.getLine(_);if(!z)continue;const K=Math.min(r,z.length);for(let q=0;q<K;q++){const te=z.getCell(q);if(te){const Z=te.getChars();Z&&$g.has(Z)&&R[q]++}}}const H=E*HT,j=_=>R[_]>=H;let D=!1;for(let _=0;_<r;_++)if(j(_)){D=!0;break}if(D){if(j(c))return{startCol:c,endCol:c};let _=-1;for(let K=c-1;K>=0;K--)if(j(K)){_=K;break}let z=r;for(let K=c+1;K<r;K++)if(j(K)){z=K;break}return{startCol:_+1,endCol:z-1}}}}}return{startCol:0,endCol:r-1}}function qg(a,n){const l=Math.min(a.startCol,a.endCol),o=Math.max(a.startCol,a.endCol),r=Math.min(a.startRow,a.endRow),c=Math.max(a.startRow,a.endRow);return{startCol:Math.max(n.startCol,Math.min(n.endCol,l)),endCol:Math.max(n.startCol,Math.min(n.endCol,o)),startRow:r,endRow:c}}function Xg(a,n){var g;if(!((g=a==null?void 0:a.buffer)!=null&&g.active)||a.cols<=0)return"";const l=a.buffer.active,o=a.cols,r=Math.min(n.startRow,n.endRow),c=Math.max(n.startRow,n.endRow),h=Math.max(0,Math.min(n.startCol,n.endCol)),m=Math.min(o-1,Math.max(n.startCol,n.endCol));if(h>m||r>c)return"";const p=[];for(let y=r;y<=c;y++){const v=l.getLine(y);if(!v){p.push("");continue}const x=v.translateToString(!0,h,m+1);p.push(x.trimEnd())}return p.join(`
50
+ `)}function BT({termRef:a,surfaceRef:n,mainRef:l,currentScaleRef:o,addToast:r,t:c}){const h=En(r),m=En(c),[p,g]=T.useState(null),y=T.useRef(null);y.current=p;const[v,x]=T.useState(null),w=T.useRef(null);w.current=v;const[S,M]=T.useState(""),N=T.useRef("");N.current=S;const[k,E]=T.useState(!1),R=T.useRef(!1);R.current=k;const H=T.useRef(!1),[j,D]=T.useState(0),_=T.useRef(0),z=T.useRef(null),K=T.useRef(null),q=T.useRef(null),te=T.useRef(null),Z=T.useCallback(ae=>{var ve;const we=a.current;if(!we)return null;const le=((ve=n.current)==null?void 0:ve.querySelector(".xterm-screen"))||n.current;return _T(ae,we,le,o.current)},[a,n,o]),ie=T.useCallback(ae=>{const we=a.current,le=Z(ae);return!we||!le?null:lC(we,le.col,le.bufferRow)},[a,Z]),re=T.useCallback((ae,we)=>{x(we),M(Xg(ae,we)),E(!0)},[]),P=T.useCallback(()=>{x(null),M(""),E(!1),q.current=null,te.current=null},[]),A=T.useCallback(()=>{g(null),y.current=null,x(null),w.current=null,M(""),N.current="",E(!1),z.current=null,K.current=null},[]),G=T.useCallback(ae=>{const we=a.current;if(!we)return;const le=Z(ae),ve=le?jT(we,le.col,le.bufferRow):null;if(le&&ve){q.current=le;const Ne=ad(we,le.col,le.bufferRow);te.current=Ne;const Ie={startCol:ve.startCol,endCol:ve.startCol+ve.length-1,startRow:le.bufferRow,endRow:le.bufferRow};re(we,qg(Ie,Ne))}else P();z.current=ae,K.current=null},[a,Z,re,P]),W=T.useCallback(ae=>{const we=a.current,le=q.current;if(!we||!le)return;K.current=ae;const ve=Z(ae);if(!ve)return;const Ne=te.current??ad(we,le.col,le.bufferRow),Ie={startCol:Math.min(le.col,ve.col),endCol:Math.max(le.col,ve.col),startRow:Math.min(le.bufferRow,ve.bufferRow),endRow:Math.max(le.bufferRow,ve.bufferRow)};re(we,qg(Ie,Ne))},[a,Z,re]),se=T.useCallback(()=>{const ae=K.current??z.current;if(!ae||!l.current)return;const we=l.current.getBoundingClientRect(),le=ae.clientX-we.left,ve=ae.clientY-we.top,Ne=ie(ae);g({x:le,y:ve,link:Ne}),y.current={x:le,y:ve,link:Ne}},[l,ie]),Q=T.useCallback(async ae=>{await Gd(ae)==="failed"?h.current("error",m.current("clipboard.copyFailed")):h.current("success",m.current("clipboard.copied"))},[h,m]),ge=T.useCallback(async()=>{const ae=N.current;ae&&await Q(ae)},[Q]),ye=T.useCallback(async()=>{var Ne,Ie,Xe,tt;const ae=a.current,we=(Ne=ae==null?void 0:ae.buffer)==null?void 0:Ne.active;if(!ae||!we)return;const le=((Ie=w.current)==null?void 0:Ie.startRow)??((Xe=q.current)==null?void 0:Xe.bufferRow)??we.viewportY,ve=te.current??ad(ae,((tt=q.current)==null?void 0:tt.col)??0,le);await Q(Xg(ae,{startCol:ve.startCol,endCol:ve.endCol,startRow:le,endRow:le}))},[a,Q]),ue=T.useCallback(async()=>{const ae=a.current;ae&&await Q(OT(ae))},[a,Q]),Te=T.useCallback((ae,we,le)=>{const ve=ae.buffer.active.viewportY??0;ve!==_.current&&(_.current=ve,D(ve));const Ne=w.current;if(Ne&&R.current){const Ie=Ne.startRow-ve,Xe=Ne.endRow-ve;H.current&&we<=Xe&&le>=Ie&&(E(!1),H.current=!1)}else H.current=!1},[]),ce=T.useCallback(ae=>{const we=ae.buffer.active.viewportY??0;_.current=we,D(we)},[]),be=T.useCallback(()=>{H.current=!0},[]);return{selectionMenu:p,selectionRect:v,selectionSnapshot:S,isHighlightVisible:k,viewportY:j,hasOpenMenu:()=>y.current!==null,clearSelection:A,handleLongPress:G,handleSelectionExtend:W,openMenuAtGesture:se,handleCopySelection:ge,handleCopyLine:ye,handleCopyScreen:ue,onTerminalRender:Te,onTerminalScroll:ce,onTerminalContentChanged:be}}const UT=({term:a,surface:n,main:l,rect:o,viewportY:r})=>{if(!a||!l)return null;const c=oa(a);if(c.cellWidth<=0||c.cellHeight<=0)return null;const h=(n==null?void 0:n.querySelector(".xterm-screen"))||n;if(!h)return null;const m=h.getBoundingClientRect(),p=l.getBoundingClientRect(),g=o.startRow-r;if(o.endRow-r<0||g>=a.rows)return null;const v=m.top-p.top+g*c.cellHeight,x=m.left-p.left+o.startCol*c.cellWidth,w=(o.endCol-o.startCol+1)*c.cellWidth,S=(o.endRow-o.startRow+1)*c.cellHeight;return f.jsx("div",{"data-testid":"terminal-selection-overlay",className:"pointer-events-none absolute z-20 bg-tui-accent/35",style:{top:`${v}px`,left:`${x}px`,width:`${w}px`,height:`${S}px`}})},tr=new Map;function Fy(a){let n=tr.get(a);return n===void 0&&(n=`#${(a&Je.RGB_MASK).toString(16).padStart(6,"0")}`,tr.size>4096&&tr.clear(),tr.set(a,n)),n}function Gy(a,n,l){var o;switch(a&Je.CM_MASK){case Je.CM_P16:case Je.CM_P256:return((o=n.ansi[a&Je.PCOLOR_MASK])==null?void 0:o.css)??l;case Je.CM_RGB:return Fy(a&Je.RGB_MASK);default:return l}}function rr(a,n,l,o){var v;const r=(a&ct.INVERSE)!==0,c=r?n:a,h=r?a:n;let m;const p=c&Je.CM_MASK;if(p===Je.CM_P16||p===Je.CM_P256){let x=c&Je.PCOLOR_MASK;o&&a&ct.BOLD&&x<8&&(x+=8),m=((v=l.ansi[x])==null?void 0:v.css)??l.foreground.css}else p===Je.CM_RGB?m=Fy(c&Je.RGB_MASK):m=r?l.background.css:l.foreground.css;const g=h&Je.CM_MASK,y=g===Je.CM_DEFAULT?r?l.foreground.css:l.background.css:Gy(h,l,l.background.css);return{fg:m,bg:y,bgIsDefault:!r&&g===Je.CM_DEFAULT}}function ps(a){return(a&ct.BOLD)!==0}function cr(a){return(a&ji.ITALIC)!==0}function xr(a){return(a&ji.DIM)!==0}function fs(a){return(a&ct.INVISIBLE)!==0}const KT=600;var Zn=(a=>(a[a.NONE=0]="NONE",a[a.BLOCK=1]="BLOCK",a[a.BAR=2]="BAR",a[a.UNDERLINE=3]="UNDERLINE",a[a.OUTLINE=4]="OUTLINE",a))(Zn||{});function Zg(a){switch(a){case"bar":return 2;case"underline":return 3;case"outline":return 4;default:return 1}}function Yy(a,n,l,o,r,c,{css:h,dpr:m,cursorWidth:p}){switch(a.save(),a.fillStyle=h,a.strokeStyle=h,c){case 2:a.fillRect(l,o,Math.max(1,Math.round(p*m)),n.cell.height);break;case 3:a.fillRect(l,o+n.cell.height-Math.max(1,Math.round(m))-1,r,Math.max(1,Math.round(m)));break;case 4:{const g=Math.max(1,Math.round(m));a.lineWidth=g,a.strokeRect(l+g/2,o+g/2,r-g,n.cell.height-g);break}}a.restore()}function IT(a,n,l,o,r){let c,h;if(l&&l.cursor!==void 0){if(l.cursor===null)return null;c=l.cursor.row,h=l.cursor.col}else{if(!a.coreService.isCursorInitialized||a.coreService.isCursorHidden)return null;c=n.ybase+n.y,h=n.x}const m=c-n.ydisp;if(m<0||m>=o.rows)return null;const p=Math.min(Math.max(0,h),o.cols-1),g=a.optionsService.rawOptions;let y;if(a._coreBrowserService.isFocused)r?y=0:y=Zg(g.cursorStyle||"block");else{const v=g.cursorInactiveStyle??"outline";y=v==="none"?0:Zg(v)}return y===0?null:{x:p,y:m,shape:y}}class FT{constructor(n){$(this,"timer",null);$(this,"visible",!0);this.onToggle=n}get running(){return this.timer!==null}get hidden(){return this.timer!==null&&!this.visible}start(){this.stop(),this.timer=setInterval(()=>{this.visible=!this.visible,this.onToggle()},KT)}stop(){this.timer&&clearInterval(this.timer),this.timer=null,this.visible=!0}}const Wg=80,GT=16;class YT{constructor(){$(this,"last",null);$(this,"fromX",0);$(this,"toX",0);$(this,"start",0);$(this,"sliding",!1)}update(n,l,o){const r=this.last;if(this.last=n&&{x:n.x,y:n.y},!n)return this.sliding=!1,null;if(!r||r.x!==n.x||r.y!==n.y){const c=r!==null&&r.y===n.y&&n.y===l&&Math.abs(n.x-r.x)<=GT;this.fromX=!c||!r?n.x:this.sliding?this.x(o):r.x,this.toX=n.x,this.start=o,this.sliding=c}return this.sliding?o-this.start>=Wg?(this.sliding=!1,null):{x:this.x(o),y:n.y,shape:n.shape,css:n.css}:null}x(n){const l=Math.min(1,Math.max(0,(n-this.start)/Wg));return this.fromX+(this.toX-this.fromX)*(1-(1-l)**3)}}function PT(a,n,l,o){if(a)return{x:a.x,y:a.y,shape:a.shape,css:o.cursor.css};const r=n==null?void 0:n.paintedCaret;if(!r)return null;const{bg:c}=rr(r.style.fg,r.style.bg,o,!0);return{x:r.col,y:r.row-l,shape:Zn.BLOCK,css:c,plain:r.plain}}const VT=120,$T=16,qT=96,XT=32,ZT=64;function cs(a,n){const l=a.content[n];if(!(l>>>Qe.WIDTH_SHIFT)||fs(a.fg[n]))return!1;if(l&Qe.IS_COMBINED_MASK)return a.combined[n]!=="";const o=l&Qe.CODEPOINT_MASK;return o!==0&&o!==32}function Qg(a,n){return{content:a.content[n],fg:a.fg[n],bg:a.bg[n],combined:a.combined[n]}}class WT{constructor(){$(this,"fades",new Map)}get size(){return this.fades.size}clear(){this.fades.clear()}rows(n){const l=new Set;for(const o of this.fades.keys())l.add(Math.floor(o/n));return l}begin(n,l,o,r,c,h){const m=n*l,p=Math.max(0,o.start),g=Math.min(l,o.end);let y=0;for(let x=p;x<g;x++){const w=m+x;if(r.content[w]===Ja)return;const S=cs(r,w),M=cs(c,x);if(S&&M){if(r.content[w]!==c.content[x]||r.combined[w]!==c.combined[x])return}else(S||M)&&y++}if(y===0||y>XT)return;let v=0;for(let x=p;x<g;x++){const w=m+x,S=cs(r,w),M=cs(c,x);if(M&&!S){const N=Math.min(v++*$T,qT);this.fades.set(w,{...Qg(c,x),start:h+N,out:!1})}else S&&!M&&this.fades.set(w,{...Qg(r,w),start:h,out:!0})}}at(n,l,o,r){const c=this.fades.get(n);if(!c)return null;const h=c.out?!cs(o,l):o.content[l]===c.content&&o.combined[l]===c.combined,m=(r-c.start)/VT;if(!h||m>=1)return this.fades.delete(n),null;const p=Math.max(0,m);return c.out?{alpha:(1-p)**2,gone:c}:{alpha:1-(1-p)**3}}}function QT(a,n,{gone:l,alpha:o},r,c){if(!l)return;const h=l.content&Qe.IS_COMBINED_MASK?l.combined:String.fromCodePoint(l.content&Qe.CODEPOINT_MASK),m=n.get({chars:h,bold:ps(l.fg),italic:cr(l.bg),dim:xr(l.bg),fg:r.fg,bg:r.bg,cells:c.cells});m&&(a.globalAlpha=o,a.drawImage(m.source,m.x,m.y,m.width,m.height,c.px,c.py,c.width,c.height),a.globalAlpha=1)}/**
51
+ * Box drawing, block element and Powerline glyphs, drawn as shapes rather than
52
+ * taken from the font.
53
+ *
54
+ * Vendored verbatim from @xterm/xterm 5.5.0,
55
+ * src/browser/renderer/shared/CustomGlyphs.ts. The only edits are the one
56
+ * helper it imported, inlined below, and underscores on parameters the strict
57
+ * compiler flags as unused.
58
+ *
59
+ * Copyright (c) 2021 The xterm.js authors. All rights reserved.
60
+ * @license MIT
61
+ */function Jg(a){if(!a)throw new Error("value must not be falsy");return a}const JT={"▀":[{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}]},e5={"░":[[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]]},t5={"─":{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,n)=>`M0,${.5-n} L1,${.5-n} M0,${.5+n} L1,${.5+n}`},"║":{1:(a,n)=>`M${.5-a},0 L${.5-a},1 M${.5+a},0 L${.5+a},1`},"╒":{1:(a,n)=>`M.5,1 L.5,${.5-n} L1,${.5-n} M.5,${.5+n} L1,${.5+n}`},"╓":{1:(a,n)=>`M${.5-a},1 L${.5-a},.5 L1,.5 M${.5+a},.5 L${.5+a},1`},"╔":{1:(a,n)=>`M1,${.5-n} L${.5-a},${.5-n} L${.5-a},1 M1,${.5+n} L${.5+a},${.5+n} L${.5+a},1`},"╕":{1:(a,n)=>`M0,${.5-n} L.5,${.5-n} L.5,1 M0,${.5+n} L.5,${.5+n}`},"╖":{1:(a,n)=>`M${.5+a},1 L${.5+a},.5 L0,.5 M${.5-a},.5 L${.5-a},1`},"╗":{1:(a,n)=>`M0,${.5+n} L${.5-a},${.5+n} L${.5-a},1 M0,${.5-n} L${.5+a},${.5-n} L${.5+a},1`},"╘":{1:(a,n)=>`M.5,0 L.5,${.5+n} L1,${.5+n} M.5,${.5-n} L1,${.5-n}`},"╙":{1:(a,n)=>`M1,.5 L${.5-a},.5 L${.5-a},0 M${.5+a},.5 L${.5+a},0`},"╚":{1:(a,n)=>`M1,${.5-n} L${.5+a},${.5-n} L${.5+a},0 M1,${.5+n} L${.5-a},${.5+n} L${.5-a},0`},"╛":{1:(a,n)=>`M0,${.5+n} L.5,${.5+n} L.5,0 M0,${.5-n} L.5,${.5-n}`},"╜":{1:(a,n)=>`M0,.5 L${.5+a},.5 L${.5+a},0 M${.5-a},.5 L${.5-a},0`},"╝":{1:(a,n)=>`M0,${.5-n} L${.5-a},${.5-n} L${.5-a},0 M0,${.5+n} L${.5+a},${.5+n} L${.5+a},0`},"╞":{1:(a,n)=>`M.5,0 L.5,1 M.5,${.5-n} L1,${.5-n} M.5,${.5+n} L1,${.5+n}`},"╟":{1:(a,n)=>`M${.5-a},0 L${.5-a},1 M${.5+a},0 L${.5+a},1 M${.5+a},.5 L1,.5`},"╠":{1:(a,n)=>`M${.5-a},0 L${.5-a},1 M1,${.5+n} L${.5+a},${.5+n} L${.5+a},1 M1,${.5-n} L${.5+a},${.5-n} L${.5+a},0`},"╡":{1:(a,n)=>`M.5,0 L.5,1 M0,${.5-n} L.5,${.5-n} M0,${.5+n} L.5,${.5+n}`},"╢":{1:(a,n)=>`M0,.5 L${.5-a},.5 M${.5-a},0 L${.5-a},1 M${.5+a},0 L${.5+a},1`},"╣":{1:(a,n)=>`M${.5+a},0 L${.5+a},1 M0,${.5+n} L${.5-a},${.5+n} L${.5-a},1 M0,${.5-n} L${.5-a},${.5-n} L${.5-a},0`},"╤":{1:(a,n)=>`M0,${.5-n} L1,${.5-n} M0,${.5+n} L1,${.5+n} M.5,${.5+n} L.5,1`},"╥":{1:(a,n)=>`M0,.5 L1,.5 M${.5-a},.5 L${.5-a},1 M${.5+a},.5 L${.5+a},1`},"╦":{1:(a,n)=>`M0,${.5-n} L1,${.5-n} M0,${.5+n} L${.5-a},${.5+n} L${.5-a},1 M1,${.5+n} L${.5+a},${.5+n} L${.5+a},1`},"╧":{1:(a,n)=>`M.5,0 L.5,${.5-n} M0,${.5-n} L1,${.5-n} M0,${.5+n} L1,${.5+n}`},"╨":{1:(a,n)=>`M0,.5 L1,.5 M${.5-a},.5 L${.5-a},0 M${.5+a},.5 L${.5+a},0`},"╩":{1:(a,n)=>`M0,${.5+n} L1,${.5+n} M0,${.5-n} L${.5-a},${.5-n} L${.5-a},0 M1,${.5-n} L${.5+a},${.5-n} L${.5+a},0`},"╪":{1:(a,n)=>`M.5,0 L.5,1 M0,${.5-n} L1,${.5-n} M0,${.5+n} L1,${.5+n}`},"╫":{1:(a,n)=>`M0,.5 L1,.5 M${.5-a},0 L${.5-a},1 M${.5+a},0 L${.5+a},1`},"╬":{1:(a,n)=>`M0,${.5+n} L${.5-a},${.5+n} L${.5-a},1 M1,${.5+n} L${.5+a},${.5+n} L${.5+a},1 M0,${.5-n} L${.5-a},${.5-n} L${.5-a},0 M1,${.5-n} L${.5+a},${.5-n} 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,n)=>`M.5,1 L.5,${.5+n/.15*.5} C.5,${.5+n/.15*.5},.5,.5,1,.5`},"╮":{1:(a,n)=>`M.5,1 L.5,${.5+n/.15*.5} C.5,${.5+n/.15*.5},.5,.5,0,.5`},"╯":{1:(a,n)=>`M.5,0 L.5,${.5-n/.15*.5} C.5,${.5-n/.15*.5},.5,.5,0,.5`},"╰":{1:(a,n)=>`M.5,0 L.5,${.5-n/.15*.5} C.5,${.5-n/.15*.5},.5,.5,1,.5`}},Ss={"":{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}};Ss[""]=Ss[""];Ss[""]=Ss[""];function n5(a,n,l,o,r,c,h,m){const p=JT[n];if(p)return i5(a,p,l,o,r,c),!0;const g=e5[n];if(g)return a5(a,g,l,o,r,c),!0;const y=t5[n];if(y)return l5(a,y,l,o,r,c,m),!0;const v=Ss[n];return v?(s5(a,v,l,o,r,c,h,m),!0):!1}function i5(a,n,l,o,r,c){for(let h=0;h<n.length;h++){const m=n[h],p=r/8,g=c/8;a.fillRect(l+m.x*p,o+m.y*g,m.w*p,m.h*g)}}const eb=new Map;function a5(a,n,l,o,r,c){let h=eb.get(n);h||(h=new Map,eb.set(n,h));const m=a.fillStyle;if(typeof m!="string")throw new Error(`Unexpected fillStyle type "${m}"`);let p=h.get(m);if(!p){const g=n[0].length,y=n.length,v=a.canvas.ownerDocument.createElement("canvas");v.width=g,v.height=y;const x=Jg(v.getContext("2d")),w=new ImageData(g,y);let S,M,N,k;if(m.startsWith("#"))S=parseInt(m.slice(1,3),16),M=parseInt(m.slice(3,5),16),N=parseInt(m.slice(5,7),16),k=m.length>7&&parseInt(m.slice(7,9),16)||1;else if(m.startsWith("rgba"))[S,M,N,k]=m.substring(5,m.length-1).split(",").map(E=>parseFloat(E));else throw new Error(`Unexpected fillStyle color format "${m}" when drawing pattern glyph`);for(let E=0;E<y;E++)for(let R=0;R<g;R++)w.data[(E*g+R)*4]=S,w.data[(E*g+R)*4+1]=M,w.data[(E*g+R)*4+2]=N,w.data[(E*g+R)*4+3]=n[E][R]*(k*255);x.putImageData(w,0,0),p=Jg(a.createPattern(v,null)),h.set(m,p)}a.fillStyle=p,a.fillRect(l,o,r,c)}function l5(a,n,l,o,r,c,h){a.strokeStyle=a.fillStyle;for(const[m,p]of Object.entries(n)){a.beginPath(),a.lineWidth=h*Number.parseInt(m,10);let g;if(typeof p=="function"){const v=.15/c*r;g=p(.15,v)}else g=p;for(const y of g.split(" ")){const v=y[0],x=Py[v];if(!x){console.error(`Could not find drawing instructions for "${v}"`);continue}const w=y.substring(1).split(",");!w[0]||!w[1]||x(a,Vy(w,r,c,l,o,!0,h))}a.stroke(),a.closePath()}}function s5(a,n,l,o,r,c,h,m){const p=new Path2D;p.rect(l,o,r,c),a.clip(p),a.beginPath();const g=h/12;a.lineWidth=m*g;for(const y of n.d.split(" ")){const v=y[0],x=Py[v];if(!x){console.error(`Could not find drawing instructions for "${v}"`);continue}const w=y.substring(1).split(",");!w[0]||!w[1]||x(a,Vy(w,r,c,l,o,!1,m,(n.leftPadding??0)*(g/2),(n.rightPadding??0)*(g/2)))}n.type===1?(a.strokeStyle=a.fillStyle,a.stroke()):a.fill(),a.closePath()}function tb(a,n,l=0){return Math.max(Math.min(a,n),l)}const Py={C:(a,n)=>a.bezierCurveTo(n[0],n[1],n[2],n[3],n[4],n[5]),L:(a,n)=>a.lineTo(n[0],n[1]),M:(a,n)=>a.moveTo(n[0],n[1])};function Vy(a,n,l,o,r,c,h,m=0,p=0){const g=a.map(y=>parseFloat(y)||parseInt(y,10));if(g.length<2)throw new Error("Too few arguments for instruction");for(let y=0;y<g.length;y+=2)g[y]*=n-m*h-p*h,c&&g[y]!==0&&(g[y]=tb(Math.round(g[y]+.5)-.5,n,0)),g[y]+=o+m*h;for(let y=1;y<g.length;y+=2)g[y]*=l,c&&g[y]!==0&&(g[y]=tb(Math.round(g[y]+.5)-.5,l,0)),g[y]+=r;return g}const Yd=.5,o5=1024,r5=6;function c5(a){return/Firefox\//.test(a)||/Edge\/\d/.test(a)?"bottom":"ideographic"}class u5{constructor(n,l=typeof navigator<"u"?navigator.userAgent:""){$(this,"pages",[]);$(this,"slots",new Map);$(this,"inkCache",new Map);$(this,"metrics",null);$(this,"font",null);$(this,"baseline");$(this,"generation",0);$(this,"scratch");this.document=n,this.baseline=c5(l)}configure(n,l){const o=this.metrics&&this.font&&this.metrics.cellWidth===n.cellWidth&&this.metrics.cellHeight===n.cellHeight&&this.metrics.charWidth===n.charWidth&&this.metrics.charHeight===n.charHeight&&this.metrics.charLeft===n.charLeft&&this.metrics.charTop===n.charTop&&this.metrics.dpr===n.dpr&&this.font.fontFamily===l.fontFamily&&this.font.fontSize===l.fontSize&&this.font.fontWeight===l.fontWeight&&this.font.fontWeightBold===l.fontWeightBold&&this.font.customGlyphs===l.customGlyphs;this.metrics={...n},this.font={...l},o||this.clear()}clear(){this.slots.clear(),this.inkCache.clear();for(const n of this.pages)n.shelfX=0,n.shelfY=0;this.generation++}dispose(){this.slots.clear(),this.inkCache.clear();for(const n of this.pages)n.canvas.width=0,n.canvas.height=0;this.pages=[]}get pageCount(){return this.pages.length}fontString(n,l){const o=this.font,r=n?o.fontWeightBold:o.fontWeight;return`${l?"italic ":""}${r} ${o.fontSize*this.metrics.dpr}px ${o.fontFamily}`}overflow(n,l,o){if(!this.metrics||!this.font||n.length===1&&n.charCodeAt(0)<128)return 0;const r=`${l?1:0}${o?1:0}${n}`,c=this.inkCache.get(r);if(c!==void 0)return c;let h=0;const m=this.scratchContext();if(m&&!(this.font.customGlyphs&&$y(n))){m.font=this.fontString(l,o),m.textBaseline=this.baseline;const p=m.measureText(n),g=typeof p.actualBoundingBoxRight=="number"?p.actualBoundingBoxRight:p.width;h=Math.max(0,Math.ceil(this.metrics.charLeft+g-this.metrics.cellWidth))}return this.inkCache.set(r,h),h}get(n){const l=this.metrics,o=this.font;if(!l||!o||l.cellWidth<=0||l.cellHeight<=0)return null;const r=`${n.cells}${n.bold?1:0}${n.italic?1:0}${n.dim?1:0}${n.fg}\0${n.bg}\0${n.chars}`,c=this.slots.get(r);if(c)return c;const h=l.cellWidth*n.cells,m=l.cellHeight,p=this.allocate(h,m);if(!p)return null;const{page:g,x:y,y:v}=p,x=g.ctx;x.save(),x.beginPath(),x.rect(y,v,h,m),x.clip(),x.globalAlpha=1,x.fillStyle=n.bg,x.fillRect(y,v,h,m),x.fillStyle=n.fg,n.dim&&(x.globalAlpha=Yd);let w=!1;o.customGlyphs&&(w=n5(x,n.chars,y,v,l.cellWidth,l.cellHeight,o.fontSize,l.dpr)),w||(x.font=this.fontString(n.bold,n.italic),x.textBaseline=this.baseline,x.fillText(n.chars,y+l.charLeft,v+l.charTop+l.charHeight)),x.restore();const S={source:g.canvas,x:y,y:v,width:h,height:m};return this.slots.set(r,S),S}allocate(n,l){for(const o of this.pages){const r=this.fit(o,n,l);if(r)return r}if(this.pages.length<r5){const o=this.createPage(Math.max(o5,n,l));return o?(this.pages.push(o),this.fit(o,n,l)):null}return this.clear(),this.pages[0]?this.fit(this.pages[0],n,l):null}fit(n,l,o){if(n.shelfX+l>n.canvas.width&&(n.shelfX=0,n.shelfY+=o),n.shelfY+o>n.canvas.height||l>n.canvas.width)return null;const r={page:n,x:n.shelfX,y:n.shelfY};return n.shelfX+=l,r}createPage(n){const l=this.document.createElement("canvas");l.width=n,l.height=n;const o=l.getContext("2d",{alpha:!1});return o?{canvas:l,ctx:o,shelfX:0,shelfY:0}:null}scratchContext(){if(this.scratch===void 0){const n=this.document.createElement("canvas");n.width=1,n.height=1,this.scratch=n.getContext("2d")}return this.scratch}}function $y(a){if(a.length!==1)return!1;const n=a.charCodeAt(0);return n>=9472&&n<=9631||n>=57504&&n<=57558}function d5(a,n){return(a&(ct.UNDERLINE|ct.STRIKETHROUGH))!==0||(n&ji.OVERLINE)!==0}function f5(a,n,{px:l,py:o,cells:r,fgWord:c,bgWord:h,ext:m,fgCss:p},{fontSize:g,dpr:y,colors:v,boldBright:x}){const w=(c&ct.UNDERLINE)!==0,S=(c&ct.STRIKETHROUGH)!==0,M=(h&ji.OVERLINE)!==0,N=r*n.cell.width;a.save(),a.beginPath(),a.rect(l,o,N,n.cell.height),a.clip(),xr(h)&&(a.globalAlpha=Yd);const k=Math.max(1,Math.floor(g*y/15)),E=k%2===1?.5:0;if(w){const R=GC(m);let H=p;if(R){let _=R;x&&ps(c)&&(_&50331648)!==50331648&&(_&255)<8&&(_+=8),H=Gy(_,v,p)}a.strokeStyle=H,a.lineWidth=k;const j=o+n.char.top+Math.ceil(n.char.height)-E-k*2,D=m?FC(m):el.SINGLE;switch(a.beginPath(),D){case el.DOUBLE:a.moveTo(l,j),a.lineTo(l+N,j),a.moveTo(l,j+k*2),a.lineTo(l+N,j+k*2);break;case el.CURLY:{const _=j+k,z=Math.max(1,k);for(let K=0;K<r;K++){const q=l+K*n.cell.width,te=q+n.cell.width/2,Z=q+n.cell.width;a.moveTo(q,_),a.bezierCurveTo(q,_-z,te,_-z,te,_),a.bezierCurveTo(te,_+z,Z,_+z,Z,_)}break}case el.DOTTED:a.setLineDash([k,k]),a.moveTo(l,j),a.lineTo(l+N,j);break;case el.DASHED:{const _=Math.floor(.6*n.cell.width),z=Math.floor(.3*n.cell.width);a.setLineDash([_,z,n.cell.width-_-z]),a.moveTo(l,j),a.lineTo(l+N,j);break}default:a.moveTo(l,j),a.lineTo(l+N,j)}a.stroke(),a.setLineDash([])}if(M&&(a.strokeStyle=p,a.lineWidth=k,a.beginPath(),a.moveTo(l,o+n.char.top+E),a.lineTo(l+N,o+n.char.top+E),a.stroke()),S){const R=Math.max(1,Math.floor(g*y/10)),H=o+n.char.top+Math.floor(n.char.height/2)-(R%2===1?.5:0);a.strokeStyle=p,a.lineWidth=R,a.beginPath(),a.moveTo(l,H),a.lineTo(l+N,H),a.stroke()}a.restore()}const ld=4,h5=3;class m5{constructor(n,l,o,r){$(this,"atlas");$(this,"fades",new WT);$(this,"cols",0);$(this,"rows",0);$(this,"painted",{content:new Uint32Array(0),fg:new Uint32Array(0),bg:new Uint32Array(0),ext:new Uint32Array(0),meta:new Uint32Array(0),combined:[]});$(this,"row",{content:new Uint32Array(0),fg:new Uint32Array(0),bg:new Uint32Array(0),ext:new Uint32Array(0),combined:[]});$(this,"work",IC());this.ctx=n,this.core=o,this.dimensions=r,this.atlas=new u5(l)}resize(n,l){this.cols=n,this.rows=l,this.fades.clear();const o=n*l;this.painted={content:new Uint32Array(o).fill(Ja),fg:new Uint32Array(o),bg:new Uint32Array(o),ext:new Uint32Array(o),meta:new Uint32Array(o).fill(Ja),combined:new Array(o).fill("")},this.row={content:new Uint32Array(n),fg:new Uint32Array(n),bg:new Uint32Array(n),ext:new Uint32Array(n),combined:new Array(n).fill("")}}invalidate(){this.painted.content.fill(Ja),this.painted.meta.fill(Ja),this.fades.clear()}hasPaintedInk(n,l){const o=this.dimensions.device;if(!o.cell.width||!o.cell.height)return!1;const r=Math.min(this.cols,Math.floor(n/o.cell.width)),c=Math.min(this.rows,Math.floor(l/o.cell.height)),h=this.painted;for(let m=0;m<c;m++)for(let p=0;p<r;p++){const g=m*this.cols+p,y=h.content[g];if(y===Ja||h.meta[g]===ld||fs(h.fg[g]))continue;const v=y&Qe.CODEPOINT_MASK;if(y&Qe.IS_COMBINED_MASK?h.combined[g]!=="":v!==0&&v!==32)return!0}return!1}loadRow(n,l){const{content:o,fg:r,bg:c,ext:h,combined:m}=this.row,p=this.work;for(let g=0;g<this.cols;g++)n&&g<n.length?(n.loadCell(g,p),o[g]=p.content,r[g]=p.fg,c[g]=p.bg,h[g]=Ny(p),m[g]=p.content&Qe.IS_COMBINED_MASK?p.combinedData:""):(o[g]=1<<Qe.WIDTH_SHIFT,r[g]=0,c[g]=0,h[g]=0,m[g]="");if(l)for(const g of l){const y=g.col;if(y<0||y+g.width>this.cols)continue;y>0&&!(o[y]>>>Qe.WIDTH_SHIFT)&&this.blankAt(y-1);const v=y+g.width;v<this.cols&&!(o[v]>>>Qe.WIDTH_SHIFT)&&o[v-1]>>>Qe.WIDTH_SHIFT===2&&this.blankAt(v);const x=YC(g.chars,g.width);o[y]=x.content,m[y]=x.combinedData,r[y]=g.style.fg,c[y]=g.style.bg,h[y]=g.style.ext,g.width===2&&(o[y+1]=0,m[y+1]="",r[y+1]=g.style.fg,c[y+1]=g.style.bg,h[y+1]=g.style.ext)}}blankAt(n){this.row.content[n]=32|1<<Qe.WIDTH_SHIFT,this.row.combined[n]=""}paintRow(n,l,o=null,r=0){const c=this.cols,{content:h,fg:m,bg:p,ext:g,combined:y}=this.row,v=this.painted,x=n*c;o&&this.fades.begin(n,c,o,v,this.row,r);let w=0,S=-1,M=-1,N="";const k=()=>{S<0||(this.fillCells(S,n,M-S,N),S=-1)};let E=0;for(;E<c;){let H=h[E]>>>Qe.WIDTH_SHIFT;H===0&&(H=1),E+H>c&&(H=c-E),H===1&&E+1<c&&this.overflowsInto(E)&&(H=2);const j=l&&l.y===n&&l.x>=E&&l.x<E+H?l.shape:Zn.NONE,D=H|j<<h5,_=this.fades.size>0?this.fades.at(x+E,E,this.row,r):null;let z=_!==null||this.differs(x+E,E,D);for(let K=1;K<H;K++)this.differs(x+E+K,E+K,ld)&&(z=!0);if(z){for(let q=0;q<H;q++){const te=x+E+q;v.content[te]=h[E+q],v.fg[te]=m[E+q],v.bg[te]=p[E+q],v.ext[te]=g[E+q],v.meta[te]=q===0?_?D|ZT:D:ld,v.combined[te]=y[E+q]}w+=H;const K=_?null:this.plainFill(E,j);K!==null?S>=0&&M===E&&N===K?M=E+H:(k(),S=E,M=E+H,N=K):(k(),this.paintCell(E,n,H,j,_))}E+=H}return k(),w}differs(n,l,o){const r=this.painted,c=this.row;return r.meta[n]!==o||r.content[n]!==c.content[l]||r.fg[n]!==c.fg[l]||r.bg[n]!==c.bg[l]||r.ext[n]!==c.ext[l]||r.combined[n]!==c.combined[l]}overflowsInto(n){const{content:l,fg:o,bg:r,ext:c}=this.row,h=l[n];if((h&Qe.CODEPOINT_MASK)<128&&!(h&Qe.IS_COMBINED_MASK)||h>>>Qe.WIDTH_SHIFT!==1||fs(o[n]))return!1;const p=l[n+1],g=p&Qe.CODEPOINT_MASK;if(p>>>Qe.WIDTH_SHIFT!==1||p&Qe.IS_COMBINED_MASK||g!==0&&g!==32||r[n]!==r[n+1]||c[n+1]!==0||(o[n]&ct.INVERSE)!==(o[n+1]&ct.INVERSE)||o[n]&ct.INVERSE&&o[n]!==o[n+1]||o[n+1]&(ct.UNDERLINE|ct.STRIKETHROUGH)||r[n+1]&ji.OVERLINE)return!1;const y=this.charsAt(n);return this.core.optionsService.rawOptions.customGlyphs!==!1&&$y(y)?!1:this.atlas.overflow(y,ps(o[n]),cr(r[n]))>0}charsAt(n){const l=this.row.content[n];if(l&Qe.IS_COMBINED_MASK)return this.row.combined[n];const o=l&Qe.CODEPOINT_MASK;return o?String.fromCodePoint(o):""}plainFill(n,l){if(l!==Zn.NONE)return null;const{content:o,fg:r,bg:c}=this.row,h=o[n],m=h&Qe.CODEPOINT_MASK,p=!(h&Qe.IS_COMBINED_MASK)&&(m===0||m===32),g=fs(r[n]);return!p&&!g||(r[n]&(ct.UNDERLINE|ct.STRIKETHROUGH)||c[n]&ji.OVERLINE)&&!g?null:rr(r[n],c[n],this.colors(),this.boldBright()).bg}paintCell(n,l,o,r,c=null){const h=this.ctx,m=this.dimensions.device,p=this.colors(),g=this.row.fg[n],y=this.row.bg[n],v=this.row.ext[n],x=rr(g,y,p,this.boldBright());let w=x.fg,S=x.bg;r===Zn.BLOCK&&(S=p.cursor.css,w=p.cursorAccent.css);const M=fs(g),N=this.charsAt(n),k=n*m.cell.width,E=l*m.cell.height,R=o*m.cell.width,H=m.cell.height,j=M||N===""||N===" ",D=j?null:this.atlas.get({chars:N,bold:ps(g),italic:cr(y),dim:xr(y),fg:w,bg:S,cells:o}),_=c&&!c.gone?c.alpha:1;if(D&&_===1?h.drawImage(D.source,D.x,D.y,D.width,D.height,k,E,R,H):(h.fillStyle=S,h.fillRect(k,E,R,H),D?(h.globalAlpha=_,h.drawImage(D.source,D.x,D.y,D.width,D.height,k,E,R,H),h.globalAlpha=1):j||(h.save(),h.beginPath(),h.rect(k,E,R,H),h.clip(),h.fillStyle=w,h.globalAlpha=(xr(y)?Yd:1)*_,h.font=this.atlas.fontString(ps(g),cr(y)),h.fillText(N,k+m.char.left,E+m.char.top+m.char.height),h.restore())),c!=null&&c.gone){const K=r===Zn.BLOCK||(g&ct.INVERSE)!==0?w:rr(c.gone.fg,c.gone.bg,p,this.boldBright()).fg;QT(h,this.atlas,c,{fg:K,bg:S},{px:k,py:E,width:R,height:H,cells:o})}!M&&d5(g,y)&&f5(h,m,{px:k,py:E,cells:o,fgWord:g,bgWord:y,ext:v,fgCss:w},{fontSize:this.core.optionsService.rawOptions.fontSize,dpr:this.core._coreBrowserService.dpr,colors:p,boldBright:this.boldBright()}),r!==Zn.NONE&&r!==Zn.BLOCK&&Yy(h,m,k,E,R,r,{css:p.cursor.css,dpr:this.core._coreBrowserService.dpr,cursorWidth:this.core.optionsService.rawOptions.cursorWidth})}fillCells(n,l,o,r){const c=this.dimensions.device;this.ctx.fillStyle=r,this.ctx.fillRect(n*c.cell.width,l*c.cell.height,o*c.cell.width,c.cell.height)}fillBackground(){this.ctx.fillStyle=this.colors().background.css,this.ctx.fillRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height)}configureAtlas(){const n=this.dimensions.device,l=this.core.optionsService.rawOptions;this.atlas.configure({cellWidth:n.cell.width,cellHeight:n.cell.height,charWidth:n.char.width,charHeight:n.char.height,charLeft:n.char.left,charTop:n.char.top,dpr:this.core._coreBrowserService.dpr},{fontFamily:l.fontFamily,fontSize:l.fontSize,fontWeight:l.fontWeight,fontWeightBold:l.fontWeightBold,customGlyphs:l.customGlyphs!==!1})}colors(){return this.core._themeService.colors}boldBright(){return this.core.optionsService.rawOptions.drawBoldTextInBrightColors!==!1}}function p5(){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}}}}function g5(a,n,l,o){const r=n._charSizeService;if(!r.hasValidSize)return!1;const c=n._coreBrowserService.dpr,h=n.optionsService.rawOptions;return a.device.char.width=Math.floor(r.width*c),a.device.char.height=Math.ceil(r.height*c),a.device.cell.height=Math.floor(a.device.char.height*h.lineHeight),a.device.char.top=h.lineHeight===1?0:Math.round((a.device.cell.height-a.device.char.height)/2),a.device.cell.width=a.device.char.width+Math.round(h.letterSpacing),a.device.char.left=Math.floor(h.letterSpacing/2),a.device.canvas.height=o*a.device.cell.height,a.device.canvas.width=l*a.device.cell.width,a.css.canvas.height=Math.round(a.device.canvas.height/c),a.css.canvas.width=Math.round(a.device.canvas.width/c),a.css.cell.height=a.css.canvas.height/o,a.css.cell.width=a.css.canvas.width/l,!0}function b5(a,n,l){if(!a||typeof a.ResizeObserver!="function")return null;let o=new a.ResizeObserver(r=>{var p;const c=r.find(g=>g.target===n);if(!c)return;if(!("devicePixelContentBoxSize"in c)||!((p=c.devicePixelContentBoxSize)!=null&&p[0])){o==null||o.disconnect(),o=null;return}const h=c.devicePixelContentBoxSize[0].inlineSize,m=c.devicePixelContentBoxSize[0].blockSize;h<=0||m<=0||h===n.width&&m===n.height||l(h,m)});try{o.observe(n,{box:"device-pixel-content-box"})}catch{o.disconnect(),o=null}return{dispose:()=>o==null?void 0:o.disconnect()}}function y5(a){if(!a)return[];const n=a.cells.map(l=>l.row);return a.cursor&&n.push(a.cursor.row),n}function v5(a){const n=new Map;for(const l of(a==null?void 0:a.cells)??[]){const o=n.get(l.row);o?o.push(l):n.set(l.row,[l])}return n}class x5{constructor(n){$(this,"canvas");$(this,"ctx");$(this,"selection",null);$(this,"link",null);this.canvas=n.createElement("canvas"),this.canvas.classList.add("xterm-decor-layer"),this.canvas.style.zIndex="2";const l=this.canvas.getContext("2d");if(!l)throw new Error("2D canvas unavailable");this.ctx=l}setSelection(n,l,o){this.selection=n&&l&&!(n[0]===l[0]&&n[1]===l[1])?{start:[n[0],n[1]],end:[l[0],l[1]],columnSelectMode:o}:null}paint({dims:n,rows:l,cols:o,ydisp:r,colors:c,focused:h,dpr:m,cursorWidth:p,caret:g}){var S;const y=this.ctx;if(y.clearRect(0,0,this.canvas.width,this.canvas.height),!n.cell.width||!l)return;const{selection:v,link:x}=this,w=(M,N,k,E)=>y.fillRect(M*n.cell.width,N*n.cell.height,k*n.cell.width,E*n.cell.height);if(v){const M=v.start[1]-r,N=v.end[1]-r,k=Math.max(M,0),E=Math.min(N,l-1);if(k<l&&E>=0)if(y.fillStyle=(h?c.selectionBackgroundTransparent:c.selectionInactiveBackgroundTransparent).css,v.columnSelectMode)w(v.start[0],k,v.end[0]-v.start[0],E-k+1);else{const R=M===k?v.start[0]:0,H=k===N?v.end[0]:o;w(R,k,H-R,1),w(0,k+1,o,Math.max(E-k-1,0)),k!==E&&w(0,E,N===E?v.end[0]:o,1)}}if(x){y.fillStyle=x.fg===257?c.background.css:x.fg!==void 0&&x.fg<256?((S=c.ansi[x.fg])==null?void 0:S.css)??c.foreground.css:c.foreground.css;const M=(N,k,E)=>y.fillRect(N*n.cell.width,(k+1)*n.cell.height-m-1,E*n.cell.width,m);if(x.y1===x.y2)M(x.x1,x.y1,x.x2-x.x1);else{M(x.x1,x.y1,x.cols-x.x1);for(let N=x.y1+1;N<x.y2;N++)M(0,N,x.cols);M(0,x.y2,x.x2)}}if(g){const M=Math.round(g.x*n.cell.width),N=g.y*n.cell.height;g.shape===Zn.BLOCK?(y.fillStyle=g.css,y.fillRect(M,N,n.cell.width,n.cell.height)):Yy(y,n,M,N,n.cell.width,g.shape,{css:g.css,dpr:m,cursorWidth:p})}}}class w5{constructor(n,l){$(this,"text");$(this,"textContext");$(this,"decor");this.screen=l,this.text=n.createElement("canvas"),this.text.classList.add("xterm-text-layer"),this.text.style.zIndex="0";const o=this.text.getContext("2d",{alpha:!1});if(!o)throw new Error("2D canvas unavailable");this.textContext=o,this.decor=new x5(n),l.appendChild(this.text),l.appendChild(this.decor.canvas)}size(n){for(const l of[this.text,this.decor.canvas])l.width=n.device.canvas.width,l.height=n.device.canvas.height,l.style.width=`${n.css.canvas.width}px`,l.style.height=`${n.css.canvas.height}px`;this.screen.style.width=`${n.css.canvas.width}px`,this.screen.style.height=`${n.css.canvas.height}px`}watchDevicePixels(n,l,o,r){return b5(n,this.text,(c,h)=>{const m=l.css.canvas;if(!(Math.abs(c-m.width*o())>2||Math.abs(h-m.height*o())>2)){l.device.canvas.width=c,l.device.canvas.height=h;for(const p of[this.text,this.decor.canvas])p.width=c,p.height=h;r()}})}remove(){this.text.remove(),this.decor.canvas.remove()}}function S5(a,n){const l=a.fonts;return!l||typeof l.addEventListener!="function"?null:(l.addEventListener("loadingdone",n),{dispose:()=>l.removeEventListener("loadingdone",n)})}class C5{constructor(n,l,o){$(this,"startedAt",null);$(this,"held",null);$(this,"timer",null);this.now=n,this.maxHoldMs=l,this.onExpire=o}get pending(){return this.held}hold(n,l){const o=this.now();return this.startedAt===null&&(this.startedAt=o),o-this.startedAt>=this.maxHoldMs?!1:(this.held=this.held?{start:Math.min(this.held.start,n),end:Math.max(this.held.end,l)}:{start:n,end:l},this.timer||(this.timer=setTimeout(()=>{this.timer=null,this.onExpire()},this.maxHoldMs)),!0)}release(n,l){return this.held&&(n=Math.min(n,this.held.start),l=Math.max(l,this.held.end)),this.held=null,this.startedAt=null,this.timer&&(clearTimeout(this.timer),this.timer=null),{start:n,end:l}}dispose(){this.timer&&clearTimeout(this.timer)}}function T5(a){var l,o,r,c;const n=a._core;return!(n!=null&&n.screenElement)||!n.coreService||!((l=n.optionsService)!=null&&l.rawOptions)||!((o=n._bufferService)!=null&&o.buffer)||!n._charSizeService||!n._coreBrowserService||!((r=n._themeService)!=null&&r.colors)||typeof((c=n._renderService)==null?void 0:c.setRenderer)!="function"?null:n}class M5{constructor(){$(this,"listeners",new Set);$(this,"event",n=>(this.listeners.add(n),{dispose:()=>this.listeners.delete(n)}))}fire(n){for(const l of[...this.listeners])l(n)}dispose(){this.listeners.clear()}}const A5=150;class Pd{constructor(n,l){$(this,"dimensions",p5());$(this,"redraw",new M5);$(this,"onRequestRedraw",this.redraw.event);$(this,"stats",{frames:0,heldFrames:0,lastPaintMs:0,lastCells:0,lastInputToPaintMs:null});$(this,"surface");$(this,"cells");$(this,"disposables",[]);$(this,"now");$(this,"syncHold");$(this,"cols",0);$(this,"rows",0);$(this,"overlayProvider",null);$(this,"typingZoneProvider",null);$(this,"reducedMotion");$(this,"paintedOverlayRows",new Set);$(this,"paintedCursorRow",-1);$(this,"lastYdisp",0);$(this,"inputAt",null);$(this,"blink",new FT(()=>this.requestCursorRow()));$(this,"glide",new YT);$(this,"slidingCaret",null);$(this,"disposed",!1);$(this,"isSynchronizing");$(this,"dprUsed",0);var h,m;this.core=n,this.now=l.now??(()=>performance.now()),this.syncHold=new C5(this.now,l.maxSyncHoldMs??A5,()=>this.flushHeld()),this.isSynchronizing=l.isSynchronizing??(()=>!1),this.reducedMotion=(m=(h=n._coreBrowserService.window).matchMedia)==null?void 0:m.call(h,"(prefers-reduced-motion: reduce)");const o=n._coreBrowserService.mainDocument;this.surface=new w5(o,n.screenElement),this.cells=new m5(this.surface.textContext,o,n,this.dimensions),this.disposables.push(n._themeService.onChangeColors(()=>{this.cells.atlas.clear(),this.invalidateAll(),this.redrawDecor()}),n.optionsService.onOptionChange(p=>{(p==="cursorBlink"||p==="cursorStyle")&&this.restartBlink()})),n.linkifier&&this.disposables.push(n.linkifier.onShowLinkUnderline(p=>{this.surface.decor.link=p,this.redrawDecor()}),n.linkifier.onHideLinkUnderline(()=>{this.surface.decor.link=null,this.redrawDecor()}));const r=this.surface.watchDevicePixels(n._coreBrowserService.window,this.dimensions,()=>n._coreBrowserService.dpr,()=>{this.invalidateAll(),this.cells.fillBackground(),this.redrawDecor(),this.redraw.fire({start:0,end:Math.max(0,this.rows-1)})});r&&this.disposables.push(r);const c=S5(o,()=>this.clearTextureAtlas());c&&this.disposables.push(c),this.restartBlink()}static install(n,l={}){const o=T5(n);if(!o)return null;const r=new Pd(o,l);return o._renderService.setRenderer(r),o._renderService.handleResize(o._bufferService.cols,o._bufferService.rows),r}setOverlayProvider(n){this.overlayProvider=n,this.invalidateOverlay()}setTypingZoneProvider(n){this.typingZoneProvider=n}invalidateOverlay(){var o;const n=((o=this.overlayProvider)==null?void 0:o.call(this))??null,l=new Set(this.paintedOverlayRows);for(const r of y5(n))l.add(r);this.paintedCursorRow>=0&&l.add(this.paintedCursorRow+this.buffer().ydisp),this.requestAbsoluteRows(l)}markInput(){this.inputAt=this.now()}flushHeld(){const n=this.syncHold.pending;n&&this.redraw.fire({start:n.start,end:n.end})}handleDevicePixelRatioChange(){this.dimensions.device.cell.width&&this.dprUsed!==this.core._coreBrowserService.dpr&&this.handleResize(this.core._bufferService.cols,this.core._bufferService.rows)}handleResize(n,l){g5(this.dimensions,this.core,n,l)&&(this.dprUsed=this.core._coreBrowserService.dpr),this.surface.size(this.dimensions),this.cols=n,this.rows=l,this.cells.resize(n,l),this.paintedOverlayRows.clear(),this.paintedCursorRow=-1,this.cells.configureAtlas(),this.cells.fillBackground(),this.redrawDecor()}handleCharSizeChanged(){this.handleResize(this.core._bufferService.cols,this.core._bufferService.rows)}handleBlur(){this.blink.stop(),this.requestCursorRow(),this.redrawDecor()}handleFocus(){this.restartBlink(),this.requestCursorRow(),this.redrawDecor()}handleSelectionChanged(n,l,o){this.surface.decor.setSelection(n,l,o),this.redrawDecor()}handleCursorMove(){this.blink.running&&this.restartBlink()}clear(){this.invalidateAll(),this.cells.fillBackground()}clearTextureAtlas(){this.cells.atlas.clear(),this.invalidateAll(),this.redraw.fire({start:0,end:Math.max(0,this.rows-1)})}renderRows(n,l){if(this.disposed||!this.cols||!this.rows||!this.dimensions.device.cell.width)return;if(this.isSynchronizing()&&this.syncHold.hold(n,l)){this.stats.heldFrames++;return}const o=this.syncHold.release(n,l);this.paint(Math.max(0,o.start),Math.min(this.rows-1,o.end))}dispose(){if(!this.disposed){this.disposed=!0,this.blink.stop(),this.syncHold.dispose();for(const n of this.disposables)n.dispose();this.disposables.length=0,this.redraw.dispose(),this.cells.atlas.dispose(),this.surface.remove()}}uninstall(){const n=this.core._createRenderer;typeof n=="function"&&(this.core._renderService.setRenderer(n.call(this.core)),this.core._renderService.handleResize(this.core._bufferService.cols,this.core._bufferService.rows)),this.dispose()}get textCanvas(){return this.surface.text}hasPaintedInk(n,l){return this.cells.hasPaintedInk(n,l)}paint(n,l){var k,E,R;const o=this.now(),r=this.buffer(),c=r.ydisp;c!==this.lastYdisp&&(this.lastYdisp=c,this.cells.fades.clear(),this.redrawDecor());const h=(k=this.reducedMotion)!=null&&k.matches?null:((E=this.typingZoneProvider)==null?void 0:E.call(this))??null,m=h?h.row-c:-1,p=((R=this.overlayProvider)==null?void 0:R.call(this))??null,g=v5(p),y=this.cursorState(p),v=PT(y,p,c,this.colors()),x=this.glide.update(v,m,o),w=x?null:y,S=x&&(v==null?void 0:v.plain);S&&g.set(S.row,[...g.get(S.row)??[],S]);const M=new Set;for(let H=n;H<=l;H++)M.add(H);for(const H of this.paintedOverlayRows)us(M,H-c,this.rows);for(const H of g.keys())us(M,H-c,this.rows);this.paintedCursorRow>=0&&us(M,this.paintedCursorRow,this.rows),w&&us(M,w.y,this.rows);for(const H of this.cells.fades.rows(this.cols))us(M,H,this.rows);let N=0;for(const H of M){this.cells.loadRow(r.lines.get(c+H),g.get(H+c));const j=H===m?{start:h.startCol,end:h.endCol}:null;N+=this.cells.paintRow(H,w,j,o)}this.cells.fades.size>0&&this.requestAbsoluteRows([...this.cells.fades.rows(this.cols)].map(H=>H+c)),(x||this.slidingCaret)&&(this.slidingCaret=x,this.redrawDecor(),x&&this.requestAbsoluteRows([x.y+c])),this.paintedOverlayRows=new Set(g.keys()),this.paintedCursorRow=w?w.y:-1,this.stats.frames++,this.stats.lastCells=N,this.stats.lastPaintMs=this.now()-o,this.inputAt!==null&&N>0&&(this.stats.lastInputToPaintMs=this.now()-this.inputAt,this.inputAt=null)}cursorState(n){return IT(this.core,this.buffer(),n,{rows:this.rows,cols:this.cols},this.blink.hidden)}restartBlink(){if(this.blink.stop(),this.disposed||!this.core.optionsService.rawOptions.cursorBlink||!this.core._coreBrowserService.isFocused){this.requestCursorRow();return}this.blink.start(),this.requestCursorRow()}requestCursorRow(){if(!this.rows)return;const n=this.buffer(),l=new Set;l.add(n.ybase+n.y),this.paintedCursorRow>=0&&l.add(this.paintedCursorRow+n.ydisp),this.requestAbsoluteRows(l)}redrawDecor(){this.surface.decor.paint({dims:this.dimensions.device,rows:this.rows,cols:this.cols,ydisp:this.buffer().ydisp,colors:this.colors(),focused:this.core._coreBrowserService.isFocused,dpr:this.core._coreBrowserService.dpr,cursorWidth:this.core.optionsService.rawOptions.cursorWidth,caret:this.slidingCaret})}invalidateAll(){this.cells.invalidate(),this.paintedCursorRow=-1}buffer(){return this.core._bufferService.buffer}colors(){return this.core._themeService.colors}requestAbsoluteRows(n){if(!this.rows)return;const l=this.buffer().ydisp;let o=1/0,r=-1/0;for(const c of n){const h=c-l;h<0||h>=this.rows||(o=Math.min(o,h),r=Math.max(r,h))}o<=r&&this.redraw.fire({start:o,end:r})}}function us(a,n,l){n>=0&&n<l&&a.add(n)}const E5=30,qy=640,Xy=240,nr=1,N5=720*60*60*1e3;function Zy(){const a=ys("local",Et.rendererProbe);if(!a)return{v:nr,ua:{}};try{const n=JSON.parse(a);return typeof n=="object"&&n!==null&&n.v===nr&&typeof n.ua=="object"&&n.ua!==null?n:{v:nr,ua:{}}}catch{return{v:nr,ua:{}}}}function k5(a,n=Date.now()){const l=Zy();l.ua[a]={failedAt:n},_i("local",Et.rendererProbe,JSON.stringify(l))}function L5(a,n=Date.now()){const l=typeof navigator<"u"?navigator.userAgent:"";if(!l)return!1;const r=Zy().ua[l];return!(!r||typeof r.failedAt!="number"||n-r.failedAt>N5)}function nb(a,n=Date.now()){const l=typeof navigator<"u"?navigator.userAgent:"";l&&k5(l,n)}function _5(a){if(a.length<4)return!0;const n=a[0],l=a[1],o=a[2],r=a[3];for(let c=4;c<a.length;c+=4)if(a[c]!==n||a[c+1]!==l||a[c+2]!==o||a[c+3]!==r)return!1;return!0}function R5(a){if(!a||a.width<=0||a.height<=0)return console.debug("Canvas probe inconclusive: text layer canvas missing or zero dimensions"),"inconclusive";let n=null;try{n=a.getContext("2d",{willReadFrequently:!0})||a.getContext("2d")}catch(r){return console.debug("Canvas probe inconclusive: failed to acquire 2D context:",r),"inconclusive"}if(!n)return console.debug("Canvas probe inconclusive: 2D context is null"),"inconclusive";const l=Math.min(a.width,qy),o=Math.min(a.height,Xy);if(l<=0||o<=0)return console.debug("Canvas probe inconclusive: calculated sample dimensions are zero"),"inconclusive";try{const r=n.getImageData(0,0,l,o);return _5(r.data)?"blank":"healthy"}catch(r){return console.debug("Canvas probe inconclusive: getImageData threw exception:",r),"inconclusive"}}function ib(a=2){return new Promise(n=>{if(typeof requestAnimationFrame!="function"){setTimeout(n,32);return}let l=a;const o=()=>{l--,l<=0?n():requestAnimationFrame(o)};requestAnimationFrame(o)})}const sd={kind:"dom",canvas:null,dispose:()=>{},verify:async()=>{}};function j5(a,n={}){if(L5())return sd;let l;try{l=Pd.install(a,{isSynchronizing:n.isSynchronizing})}catch(m){return console.debug("Canvas renderer unavailable, using the DOM renderer:",m),nb(),sd}if(!l)return sd;let o=l,r=null;const c=()=>{var p;if(!o)return;nb();const m=o;o=null;try{m.uninstall()}catch{}(p=n.onRendererSwapped)==null||p.call(n,"dom")};return{get kind(){return o?"canvas":"dom"},get canvas(){return o},dispose:()=>{const m=o;o=null;try{m==null||m.dispose()}catch{}},verify:async()=>{if(o)return r||(r=(async()=>{try{const m=o.stats.frames;await ib(2);for(let g=0;g<E5&&o&&o.stats.frames===m;g++)await ib(1);if(!o)return;const p=R5(o.textCanvas);p==="blank"&&o.hasPaintedInk(qy,Xy)?c():p==="blank"?console.debug("Canvas probe inconclusive: uniform, but no character was painted there"):p==="inconclusive"&&console.debug("Canvas probe inconclusive; retaining canvas renderer without blacklisting")}catch(m){console.debug("Canvas probe inconclusive: unexpected error during verify():",m)}finally{r=null}})(),r)}}}function O5(a,n,l){a.writeln(" ___ ___ .___ "),a.writeln(` / | \\ ____ _______| _/______ \x1B[1m${n}\x1B[0m`),a.writeln(`/ ~ \\/ __ \\\\_ __ \\ __/ ___/ \x1B[2m${l}\x1B[0m`),a.writeln("\\ Y / ___/ | | \\/|_ \\___ \\ "),a.writeln(" \\___|_ / \\___ >|__| /___/____ >"),a.writeln(" \\/ \\/ \\/ "),a.writeln("")}var D5=Ex(),od={exports:{}},ab;function z5(){return ab||(ab=1,(function(a,n){(function(l,o){a.exports=o()})(self,(()=>(()=>{var l={6:(h,m)=>{function p(y){try{const v=new URL(y),x=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 y.toLocaleLowerCase().startsWith(x.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(m,"__esModule",{value:!0}),m.LinkComputer=m.WebLinkProvider=void 0,m.WebLinkProvider=class{constructor(y,v,x,w={}){this._terminal=y,this._regex=v,this._handler=x,this._options=w}provideLinks(y,v){const x=g.computeLink(y,this._regex,this._terminal,this._handler);v(this._addCallbacks(x))}_addCallbacks(y){return y.map((v=>(v.leave=this._options.leave,v.hover=(x,w)=>{if(this._options.hover){const{range:S}=v;this._options.hover(x,w,S)}},v)))}};class g{static computeLink(v,x,w,S){const M=new RegExp(x.source,(x.flags||"")+"g"),[N,k]=g._getWindowedLineStrings(v-1,w),E=N.join("");let R;const H=[];for(;R=M.exec(E);){const j=R[0];if(!p(j))continue;const[D,_]=g._mapStrIdx(w,k,0,R.index),[z,K]=g._mapStrIdx(w,D,_,j.length);if(D===-1||_===-1||z===-1||K===-1)continue;const q={start:{x:_+1,y:D+1},end:{x:K,y:z+1}};H.push({range:q,text:j,activate:S})}return H}static _getWindowedLineStrings(v,x){let w,S=v,M=v,N=0,k="";const E=[];if(w=x.buffer.active.getLine(v)){const R=w.translateToString(!0);if(w.isWrapped&&R[0]!==" "){for(N=0;(w=x.buffer.active.getLine(--S))&&N<2048&&(k=w.translateToString(!0),N+=k.length,E.push(k),w.isWrapped&&k.indexOf(" ")===-1););E.reverse()}for(E.push(R),N=0;(w=x.buffer.active.getLine(++M))&&w.isWrapped&&N<2048&&(k=w.translateToString(!0),N+=k.length,E.push(k),k.indexOf(" ")===-1););}return[E,S]}static _mapStrIdx(v,x,w,S){const M=v.buffer.active,N=M.getNullCell();let k=w;for(;S;){const E=M.getLine(x);if(!E)return[-1,-1];for(let R=k;R<E.length;++R){E.getCell(R,N);const H=N.getChars();if(N.getWidth()&&(S-=H.length||1,R===E.length-1&&H==="")){const j=M.getLine(x+1);j&&j.isWrapped&&(j.getCell(0,N),N.getWidth()===2&&(S+=1))}if(S<0)return[x,R]}x++,k=0}return[x,k]}}m.LinkComputer=g}},o={};function r(h){var m=o[h];if(m!==void 0)return m.exports;var p=o[h]={exports:{}};return l[h](p,p.exports,r),p.exports}var c={};return(()=>{var h=c;Object.defineProperty(h,"__esModule",{value:!0}),h.WebLinksAddon=void 0;const m=r(6),p=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function g(y,v){const x=window.open();if(x){try{x.opener=null}catch{}x.location.href=v}else console.warn("Opening link blocked as opener could not be cleared")}h.WebLinksAddon=class{constructor(y=g,v={}){this._handler=y,this._options=v}activate(y){this._terminal=y;const v=this._options,x=v.urlRegex||p;this._linkProvider=this._terminal.registerLinkProvider(new m.WebLinkProvider(this._terminal,x,this._handler,v))}dispose(){var y;(y=this._linkProvider)==null||y.dispose()}}})(),c})()))})(od)),od.exports}var H5=z5(),B5=Nx();function U5({fontSize:a,fontFamily:n,theme:l,cols:o,rows:r}){const c=new B5.Terminal({fontSize:a,fontFamily:n,lineHeight:1.15,...l?{theme:{...l}}:{},allowProposedApi:!0,convertEol:!0,scrollback:5e3,cols:o,rows:r,screenReaderMode:!1,linkHandler:{activate:(h,m)=>{Td(m)}}});try{const h=new D5.Unicode11Addon;c.loadAddon(h),c.unicode.activeVersion="11"}catch(h){console.debug("Unicode11 addon unavailable, using default width table:",h)}try{c.loadAddon(new H5.WebLinksAddon((h,m)=>{Td(m)}))}catch(h){console.debug("WebLinks addon unavailable, URLs stay plain text:",h)}return c}function hs(a){var n,l;if(!a)return!1;try{const o=a.modes;if(o&&typeof o.mouseTrackingMode=="string"&&o.mouseTrackingMode!=="none")return!0;const r=a._core;if((n=r==null?void 0:r._coreMouseService)!=null&&n.areMouseEventsActive||(l=r==null?void 0:r.coreMouseService)!=null&&l.areMouseEventsActive||r!=null&&r.mouseMode&&r.mouseMode!=="none")return!0}catch{}return!1}function K5(a,n){const l=n.button??0,o=n.buttons??(a==="mouseup"?0:1);return new MouseEvent(a,{bubbles:!0,cancelable:!0,clientX:n.clientX,clientY:n.clientY,screenX:n.clientX,screenY:n.clientY,button:l,buttons:o})}function Wy(a,n,l){const o=K5(n,l);return a.dispatchEvent(o)}function Qy(a){var n;try{return((n=a.buffer)==null?void 0:n.active)||null}catch{return null}}function rd(a){var l;const n=(l=Qy(a))==null?void 0:l.viewportY;return typeof n=="number"&&Number.isFinite(n)?n:null}function I5(a){var n;try{(n=a.blur)==null||n.call(a)}catch{}}function lb(a){var l,o;const n=a;return n.coreMouseService||((l=n._core)==null?void 0:l.coreMouseService)||((o=n._core)==null?void 0:o._coreMouseService)||null}function F5(a){var l;const n=a;return n.coreService||((l=n._core)==null?void 0:l.coreService)||null}class G5{constructor(n){this.options=n}getLogicalCoordinates(n,l){const o=this.options.getScale?this.options.getScale():1,r=this.options.getSurfaceElement?this.options.getSurfaceElement():null;if(o!==1&&r&&typeof r.getBoundingClientRect=="function"){const c=r.getBoundingClientRect();return Iy(n,l,c,o)}return{clientX:n,clientY:l}}getViewportElement(n){var r;const l=this.options.getSurfaceElement?this.options.getSurfaceElement():null;return(l==null?void 0:l.querySelector(".xterm-viewport"))||((r=n.element)==null?void 0:r.querySelector(".xterm-viewport"))||null}isInputLineHit(n,l){var E;const o=(E=l.buffer)==null?void 0:E.active,r=this.options.getSurfaceElement?this.options.getSurfaceElement():null,c=(r==null?void 0:r.querySelector(".xterm-screen"))||l.element||r,h=oa(l);if(!c||typeof c.getBoundingClientRect!="function"||h.cellHeight<=0)return!1;const m=c.getBoundingClientRect(),p=this.getLogicalCoordinates(n.clientX,n.clientY),g=m.width>0&&m.height>0;if(![o==null?void 0:o.cursorY,o==null?void 0:o.viewportY,o==null?void 0:o.baseY].every(R=>typeof R=="number"&&Number.isFinite(R)))return!1;const v=o==null?void 0:o.cursorY,x=o==null?void 0:o.viewportY,S=(o==null?void 0:o.baseY)+v-x,M=m.top+S*h.cellHeight,N=M+h.cellHeight,k=Number(l.rows);return S>=0&&(!Number.isFinite(k)||S<k)&&p.clientY>=M-2&&p.clientY<=N+2&&(!g||p.clientX>=m.left&&p.clientX<=m.right)}resolveDispatchTarget(n,l){var m;const o=this.options.getSurfaceElement?this.options.getSurfaceElement():null,r=(o==null?void 0:o.querySelector(".xterm-screen"))||l.querySelector(".xterm-screen")||null,c=((m=r==null?void 0:r.closest)==null?void 0:m.call(r,".xterm"))||null;let h=null;return typeof document<"u"&&typeof document.elementFromPoint=="function"&&(h=document.elementFromPoint(n.clientX,n.clientY)),h&&c&&(h===c||c.contains(h))?h:r||o||l}getMouseReport(n,l){const o=this.options.getSurfaceElement?this.options.getSurfaceElement():null,r=(o==null?void 0:o.querySelector(".xterm-screen"))||l.element;if(!r||typeof r.getBoundingClientRect!="function")return null;const c=r.getBoundingClientRect(),h=this.getLogicalCoordinates(n.clientX,n.clientY),m=oa(l);if(m.cellWidth<=0||m.cellHeight<=0)return null;const p=Math.max(1,c.width||l.cols*m.cellWidth),g=Math.max(1,c.height||l.rows*m.cellHeight),y=Math.max(0,Math.min(p-1,h.clientX-c.left)),v=Math.max(0,Math.min(g-1,h.clientY-c.top)),x=Math.max(0,Math.min(l.cols-1,Math.floor(y/m.cellWidth))),w=Math.max(0,Math.min(l.rows-1,Math.floor(v/m.cellHeight)));return{col:x,row:w,x:Math.floor(y),y:Math.floor(v),button:0,action:0}}getWheelDispatchTarget(n){const l=this.options.getSurfaceElement?this.options.getSurfaceElement():null;return(l==null?void 0:l.querySelector(".xterm"))||n.element||null}dispatchWheel(n,l,o,r){const c=this.getWheelDispatchTarget(o);if(!c||typeof WheelEvent>"u"||l===0)return!1;const h=this.getLogicalCoordinates(n.clientX,n.clientY),m=l<0?-1:1;let p=0;for(let g=0;g<Math.abs(l);g+=1)try{const y=new WheelEvent("wheel",{bubbles:!0,cancelable:!0,clientX:h.clientX,clientY:h.clientY,deltaX:0,deltaY:m,deltaMode:1,ctrlKey:!!(r!=null&&r.ctrlKey),altKey:!!(r!=null&&r.altKey),shiftKey:!!(r!=null&&r.shiftKey)});c.dispatchEvent(y),p+=1}catch{return p>0}return p>0}emitWheel(n,l,o,r){if(l===0)return!1;if(this.dispatchWheel(n,l,o,r))return!0;const c=lb(o);if(!(c!=null&&c.triggerMouseEvent))return!1;let h=0;for(let m=0;m<Math.abs(l);m+=1){const p=this.getMouseReport(n,o);p&&(p.button=4,p.action=l<0?0:1,p.ctrl=!!(r!=null&&r.ctrlKey),p.alt=!!(r!=null&&r.altKey),p.shift=!!(r!=null&&r.shiftKey),c.triggerMouseEvent(p)&&(h+=1))}return h>0}scrollAlternateBuffer(n,l,o,r){var h;if(l===0)return"none";const c=hs(o);if(!c&&!this.options.getIsController())return"none";if(this.emitWheel(n,l,o,r))return c?"application-mouse":"application-keys";if(!c){const m=F5(o);if(!(m!=null&&m.triggerDataEvent))return"none";const g=`\x1B${!!((h=m.decPrivateModes)!=null&&h.applicationCursorKeys)?"O":"["}${l<0?"A":"B"}`;return m.triggerDataEvent(g.repeat(Math.abs(l)),!0),"application-keys"}return"none"}emitMouse(n,l,o,r){const c=this.options.getTerminal();if(!c)return;const h=lb(c);if(h!=null&&h.triggerMouseEvent){const p=this.getMouseReport(l,c);p&&(p.action=n==="mousedown"?1:n==="mouseup"?0:32,p.ctrl=!!(o!=null&&o.ctrlKey),p.alt=!!(o!=null&&o.altKey),p.shift=!!(o!=null&&o.shiftKey),h.triggerMouseEvent(p));return}if(this.options.allowSyntheticMouseFallback===!1||!r)return;const m=this.getLogicalCoordinates(l.clientX,l.clientY);Wy(r,n,{clientX:m.clientX,clientY:m.clientY,button:0,buttons:n==="mouseup"?0:1})}}class Y5{constructor(n){$(this,"options");$(this,"state","idle");$(this,"startX",0);$(this,"startY",0);$(this,"lastX",0);$(this,"lastY",0);$(this,"activeTarget",null);$(this,"longPressTimer",null);$(this,"capturedPointerId",null);$(this,"captureElement",null);$(this,"scrollRemainderY",0);$(this,"delivery");this.options={longPressDelayMs:500,dragThresholdPx:8,scrollLineHeightPx:18,...n},this.delivery=new G5(this.options)}getState(){return this.state}setGestureState(n){var l,o;this.state!==n&&(this.state=n,(o=(l=this.options).onGestureStateChange)==null||o.call(l,n))}beginGesture(n,l){this.startX=n.clientX,this.startY=n.clientY,this.lastX=n.clientX,this.lastY=n.clientY,this.setGestureState("pending"),this.scrollRemainderY=0,this.activeTarget=this.delivery.resolveDispatchTarget(n,l),this.clearLongPressTimer(),this.longPressTimer=setTimeout(()=>{var o,r;this.state==="pending"&&(this.setGestureState("longpress"),(r=(o=this.options).onLongPress)==null||r.call(o,{clientX:this.startX,clientY:this.startY}))},this.options.longPressDelayMs)}moveGesture(n,l){var g,y,v,x;if(this.state==="longpress"){(y=(g=this.options).onSelectionExtend)==null||y.call(g,{clientX:n.clientX,clientY:n.clientY}),l!=null&&l.cancelable&&((v=l.preventDefault)==null||v.call(l));return}if(this.state==="idle")return;const o=n.clientX-this.startX,r=n.clientY-this.startY,c=Math.hypot(o,r);if(this.state==="scrolling"){this.scrollGesture(n,l);return}const h=this.options.getTerminal(),m=this.options.getIsController(),p=hs(h);if(!(c<=(this.options.dragThresholdPx||8))){if(this.clearLongPressTimer(),Math.abs(r)>=Math.abs(o)||!p||!m){this.setGestureState("scrolling"),h&&I5(h),this.lastX=n.clientX,this.lastY=this.startY,this.scrollRemainderY=0,this.scrollGesture(n,l);return}if(p&&m){this.state==="pending"&&(this.setGestureState("dragging"),this.delivery.emitMouse("mousedown",{clientX:this.startX,clientY:this.startY},l,this.activeTarget)),this.state==="dragging"&&(this.lastX=n.clientX,this.lastY=n.clientY,this.delivery.emitMouse("mousemove",n,l,this.activeTarget),l!=null&&l.cancelable&&((x=l.preventDefault)==null||x.call(l)));return}this.lastX=n.clientX,this.lastY=n.clientY}}scrollGesture(n,l){var S,M,N;const o=this.options.getTerminal();if(!o)return;const r=n.clientY-this.lastY;this.lastX=n.clientX,this.lastY=n.clientY;const c=oa(o),h=c.measured?c.cellHeight:this.options.scrollLineHeightPx||c.cellHeight||18;this.scrollRemainderY+=r;const m=Math.trunc(this.scrollRemainderY/h),p=-m;let g=!1,y="none";const v=Qy(o),x=hs(o);if(p!==0){if((v==null?void 0:v.type)==="alternate")y=this.delivery.scrollAlternateBuffer(n,p,o,l),g=y!=="none";else{const k=rd(o);o.scrollLines(p);const E=rd(o);y="buffer",g=k===null||E===null||k!==E}this.scrollRemainderY-=m*h}const w=this.delivery.getViewportElement(o);(M=(S=this.options).onGestureScroll)==null||M.call(S,{deltaY:r,lines:p,viewportY:rd(o),scrollTop:(w==null?void 0:w.scrollTop)??null,scrollHeight:(w==null?void 0:w.scrollHeight)??null,clientHeight:(w==null?void 0:w.clientHeight)??null,moved:g,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:x,scrollMode:y}),l!=null&&l.cancelable&&((N=l.preventDefault)==null||N.call(l))}endGesture(n,l){var h,m,p;this.clearLongPressTimer();const o=this.options.getTerminal(),r=this.options.getIsController(),c=hs(o);if(this.state==="pending"){if(c&&r){const y={clientX:this.startX,clientY:this.startY};this.delivery.emitMouse("mousedown",y,l,this.activeTarget),this.delivery.emitMouse("mouseup",y,l,this.activeTarget)}const g={clientX:this.startX,clientY:this.startY};r&&o&&this.delivery.isInputLineHit(g,o)&&((m=(h=this.options).onFocus)==null||m.call(h))}else if(this.state==="dragging"&&c&&r){const g=n??{clientX:this.lastX,clientY:this.lastY};this.delivery.emitMouse("mouseup",g,l,this.activeTarget),l!=null&&l.cancelable&&((p=l.preventDefault)==null||p.call(l))}this.reset()}handlePointerDown(n,l){if(n.pointerType==="mouse")return!1;if(!n.isPrimary)return this.releasePointerCapture(),this.reset(),!1;if(n.cancelable&&n.preventDefault(),this.beginGesture(n,l),n.pointerType!=="touch")try{typeof l.setPointerCapture=="function"&&(l.setPointerCapture(n.pointerId),this.capturedPointerId=n.pointerId,this.captureElement=l)}catch{}return!0}handlePointerMove(n){n.pointerType==="mouse"||this.state==="idle"||this.moveGesture(n,n)}handlePointerUp(n){n.pointerType==="mouse"||this.state==="idle"||(this.releasePointerCapture(),this.endGesture(n,n))}handlePointerCancel(n){n&&n.pointerType==="mouse"||(this.releasePointerCapture(),this.cancelGesture())}handleTouchStart(n,l){if(n.touches.length!==1){this.reset();return}n.cancelable&&n.preventDefault(),this.beginGesture(n.touches[0],l)}handleTouchMove(n){n.touches.length===1&&this.moveGesture(n.touches[0],n)}handleTouchEnd(n){n.cancelable&&n.preventDefault(),this.endGesture(null,n)}handleTouchCancel(){this.cancelGesture()}cancelGesture(){this.clearLongPressTimer();const n=this.options.getTerminal(),l=this.options.getIsController(),o=hs(n);if(this.state==="dragging"&&o&&l&&this.activeTarget){const r=this.delivery.getLogicalCoordinates(this.lastX,this.lastY);Wy(this.activeTarget,"mouseup",{clientX:r.clientX,clientY:r.clientY,button:0,buttons:0})}this.reset()}releasePointerCapture(){const n=this.captureElement,l=this.capturedPointerId;if(this.captureElement=null,this.capturedPointerId=null,!(!n||l===null))try{typeof n.releasePointerCapture=="function"&&(typeof n.hasPointerCapture!="function"||n.hasPointerCapture(l))&&n.releasePointerCapture(l)}catch{}}clearLongPressTimer(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressTimer=null)}reset(){this.clearLongPressTimer(),this.releasePointerCapture(),this.setGestureState("idle"),this.activeTarget=null}}function P5({container:a,term:n,isTouchDevice:l,debug:o,getTerminal:r,getIsController:c,getScale:h,getSurfaceElement:m,getSelection:p,onFocus:g}){const y=new Y5({getTerminal:r,getIsController:c,getScale:h,getSurfaceElement:m,allowSyntheticMouseFallback:!1,onFocus:()=>{try{n.focus()}catch{}o==null||o(j=>({...j,focused:document.activeElement===n.textarea})),g()},onGestureStateChange:j=>{o==null||o(D=>({...D,state:j}))},onGestureScroll:({deltaY:j,lines:D,viewportY:_,scrollTop:z,scrollHeight:K,clientHeight:q,moved:te,bufferType:Z,baseY:ie,cursorY:re,hasScrollback:P,mouseTracking:A,scrollMode:G})=>{o==null||o(W=>({...W,deltaY:j,lines:D,viewportY:_,scrollTop:z,scrollHeight:K,clientHeight:q,moved:te,focused:document.activeElement===n.textarea,bufferType:Z,baseY:ie,cursorY:re,hasScrollback:P,mouseTracking:A,scrollMode:G,scrollCalls:W.scrollCalls+(D!==0?1:0),lastScrollLines:D}))},longPressDelayMs:500,dragThresholdPx:8,scrollLineHeightPx:18,onLongPress:l?j=>p().handleLongPress(j):void 0,onSelectionExtend:l?j=>p().handleSelectionExtend(j):void 0}),v=typeof window<"u"&&"PointerEvent"in window,x=typeof TouchEvent<"u",w=[],S={passive:!1,capture:!0},M=(j,D)=>{document.addEventListener(j,D,S),w.push(()=>document.removeEventListener(j,D,S))},N=(j,D=!1)=>{const _=j.target;return _ instanceof Node&&a.contains(_)||D&&y.getState()!=="idle"},k=(j,D)=>{o==null||o(_=>({..._,[j]:_[j]+1,lastInputEvent:D}))},E=j=>{const D=p();return D.hasOpenMenu()?(D.clearSelection(),j.cancelable&&j.preventDefault(),j.stopPropagation(),!0):!1},R=()=>{y.getState()==="longpress"&&p().openMenuAtGesture()};if(v){if(M("pointerdown",j=>{if(!N(j)||(k("pointerEvents","pointerdown"),E(j)))return;y.handlePointerDown(j,a)&&j.stopPropagation()}),M("pointermove",j=>{N(j,!0)&&(k("pointerEvents","pointermove"),y.handlePointerMove(j),j.pointerType!=="mouse"&&j.stopPropagation())}),M("pointerup",j=>{N(j,!0)&&(k("pointerEvents","pointerup"),R(),y.handlePointerUp(j),j.pointerType!=="mouse"&&j.stopPropagation())}),M("pointercancel",j=>{N(j,!0)&&(k("pointerEvents","pointercancel"),p().clearSelection(),y.handlePointerCancel(j),j.pointerType!=="mouse"&&j.stopPropagation())}),x){const j=D=>{N(D,!0)&&(o==null||o(_=>({..._,touchEvents:_.touchEvents+1})),D.cancelable&&D.preventDefault(),D.stopPropagation())};for(const D of["touchstart","touchmove","touchend","touchcancel"])M(D,j)}}else M("touchstart",j=>{N(j)&&(k("touchEvents","touchstart"),!E(j)&&(j.touches.length===1&&j.stopPropagation(),y.handleTouchStart(j,a)))}),M("touchmove",j=>{N(j,!0)&&(k("touchEvents","touchmove"),j.touches.length===1&&j.stopPropagation(),y.handleTouchMove(j))}),M("touchend",j=>{N(j,!0)&&(k("touchEvents","touchend"),R(),j.stopPropagation(),y.handleTouchEnd(j))}),M("touchcancel",j=>{N(j,!0)&&(k("touchEvents","touchcancel"),p().clearSelection(),j.stopPropagation(),y.handleTouchCancel())});const H=j=>{j.preventDefault()};return a.addEventListener("contextmenu",H),w.push(()=>a.removeEventListener("contextmenu",H)),()=>{y.handlePointerCancel();for(const j of w)j()}}function V5(a,{requestFit:n,onPageVisible:l}){const o=new ResizeObserver(()=>{n()});o.observe(a);const r=()=>{n()},c=()=>{document.visibilityState==="visible"&&l()};window.addEventListener("resize",r),window.addEventListener("orientationchange",r),document.addEventListener("visibilitychange",c),window.addEventListener("pageshow",c);const h=()=>{n()};return typeof window<"u"&&window.visualViewport&&(window.visualViewport.addEventListener("resize",h),window.visualViewport.addEventListener("scroll",h)),()=>{o.disconnect(),window.removeEventListener("resize",r),window.removeEventListener("orientationchange",r),document.removeEventListener("visibilitychange",c),window.removeEventListener("pageshow",c),typeof window<"u"&&window.visualViewport&&(window.visualViewport.removeEventListener("resize",h),window.visualViewport.removeEventListener("scroll",h))}}function ta(a){if(a)try{a.refresh(0,Math.max(0,a.rows-1))}catch{}}function $5({containerRef:a,surfaceRef:n,termRef:l,rendererRef:o,currentScaleRef:r,initialBannerWrittenRef:c,live:h,selection:m,prediction:p,fit:g,isTouchDevice:y,debug:v,terminalFontSize:x,terminalFontFamily:w,hostTheme:S,glyphRevision:M,terminalResetVersion:N,isActive:k,subscribeToOutput:E,onOutput:R,onTitle:H,onRendererKind:j}){const{requestFit:D,scheduleBoundedFit:_,fitNow:z,seedFit:K,cancelPendingFits:q}=g;T.useEffect(()=>{var Xe,tt;if(!a.current||!n.current)return;const Z=a.current,ie=kd(Z,il(),ud()),re=oa(null,rl),P=Ky({width:ie.width,height:ie.height,cellWidth:re.cellWidth,cellHeight:re.cellHeight});h.current.sendResize(P.cols,P.rows),K(ie);const A=U5({fontSize:lg(x,ie.width),fontFamily:w,theme:h.current.hostTheme,cols:P.cols,rows:P.rows});A.open(n.current),l.current=A;const G=A.onTitleChange(xe=>{H(Cd(xe)||null)}),{screenState:W,fieldProbe:se,overlay:Q}=p.attach(A);y&&A.textarea&&(A.textarea.readOnly=!1,A.textarea.tabIndex=0,A.textarea.inputMode="text");let ge=()=>{};if(v&&A.textarea){const xe=()=>{v(Ae=>({...Ae,focused:document.activeElement===A.textarea}))};A.textarea.addEventListener("focus",xe),A.textarea.addEventListener("blur",xe),ge=()=>{var Ae,st;(Ae=A.textarea)==null||Ae.removeEventListener("focus",xe),(st=A.textarea)==null||st.removeEventListener("blur",xe)},xe()}const ye=async xe=>{p.discard("paste");const Ae=Ty(xe);if(Ae){if(xe.preventDefault(),xe.stopPropagation(),!h.current.isController){h.current.warnViewerMode();return}await h.current.uploadImage(Ae)}};(Xe=A.textarea)==null||Xe.addEventListener("paste",ye),Z.addEventListener("paste",ye);const ue=j5(A,{isSynchronizing:W.isSynchronizing,onRendererSwapped:xe=>{var Ae;Z.dataset.renderer=xe,j(xe),(Ae=p.overlayRef.current)==null||Ae.attach(null),ta(A)}});Q.attach(ue.canvas),(tt=ue.canvas)==null||tt.setTypingZoneProvider(()=>{const xe=se.detect();return xe&&{row:xe.row,startCol:xe.startCol,endCol:xe.endCol}});const Te=W.onSyncEnd(()=>{var xe,Ae;return(Ae=(xe=o.current)==null?void 0:xe.canvas)==null?void 0:Ae.flushHeld()});if(o.current=ue,Z.dataset.renderer=ue.kind,j(ue.kind),O5(A,h.current.t("terminal.bannerTitle"),h.current.t("terminal.bannerSubtitle")),c.current=!0,A.write("",()=>void ue.verify()),!y)try{A.focus()}catch{}const ce=typeof document<"u"?document.fonts:void 0;typeof(ce==null?void 0:ce.load)=="function"&&ce.load('13px "Symbols Nerd Font Mono"').then(()=>{l.current&&(ta(l.current),_(5))}).catch(()=>{});const be=A.onData(xe=>{const{isController:Ae}=h.current;let st=xe;if(Ae&&Oy(xe)==="keys"&&Kx(xe)){const bt=h.current.consumeModifierLatch();bt&&(st=ur(xe,bt))}const it=jd(st);if(!Ae&&!hr(it)){h.current.warnViewerMode();return}p.onUserInput(it),h.current.sendBinary(it)}),ae=A.onBinary(xe=>{const Ae=new Uint8Array(xe.length);for(let st=0;st<xe.length;st++)Ae[st]=xe.charCodeAt(st)&255;!h.current.isController&&!hr(Ae)||h.current.sendBinary(Ae)}),we=typeof A.onWriteParsed=="function"?A.onWriteParsed(()=>{var bt;if(m.current.onTerminalContentChanged(),se.invalidate(),W.isSynchronizing())return;const xe=A.buffer.active,Ae=xe.baseY+xe.cursorY,st=Array.from({length:8},(yn,vn)=>{var kn;return((kn=xe.getLine(Ae-7+vn))==null?void 0:kn.translateToString(!0))??""}),it=Bw(st,h.current.platform);it&&h.current.reportShellProfile(it),(bt=p.predictorRef.current)==null||bt.onServerOutput(),p.sync()}):{dispose:()=>{}},le=typeof A.onRender=="function"?A.onRender(xe=>{var Ae;if(h.current.glyphScan){const st=A.buffer.active.viewportY??0;let it="";for(let bt=xe.start;bt<=xe.end;bt+=1)it+=((Ae=A.buffer.active.getLine(st+bt))==null?void 0:Ae.translateToString(!0))??"";/[^\x00-\x7f]/.test(it)&&h.current.ensureHostGlyphs(it)}m.current.onTerminalRender(A,xe.start,xe.end)}):{dispose:()=>{}},ve=typeof A.onScroll=="function"?A.onScroll(()=>{m.current.onTerminalScroll(A),p.discard("scroll")}):{dispose:()=>{}},Ne=P5({container:Z,term:A,isTouchDevice:y,debug:v,getTerminal:()=>l.current,getIsController:()=>h.current.isController,getScale:()=>r.current,getSurfaceElement:()=>n.current,getSelection:()=>m.current,onFocus:()=>{var xe,Ae;return(Ae=(xe=h.current).onTerminalFocus)==null?void 0:Ae.call(xe)}}),Ie=V5(Z,{requestFit:D,onPageVisible:()=>{_(10),ta(l.current)}});return()=>{var xe;be.dispose(),ae.dispose(),le.dispose(),ve.dispose(),we.dispose(),G.dispose(),Te.dispose(),p.detach(),W.dispose(),Ne(),Ie(),q(),ge(),(xe=A.textarea)==null||xe.removeEventListener("paste",ye),Z.removeEventListener("paste",ye),ue.dispose(),o.current=null,A.dispose(),l.current=null}},[]),T.useEffect(()=>{const Z=l.current;if(!Z)return;const ie=kd(a.current,il(),ud()),re=lg(x,ie.width),P=Z.options.fontSize!==re||Z.options.fontFamily!==w;Z.options.fontSize=re,Z.options.fontFamily=w,ta(Z),P&&z(),_(10)},[x,w]),T.useEffect(()=>{var ie,re;const Z=l.current;!Z||!M||((re=(ie=o.current)==null?void 0:ie.canvas)==null||re.clearTextureAtlas(),ta(Z))},[M]);const te=T.useRef(N);T.useEffect(()=>{var ie;if(te.current===N)return;te.current=N,p.forget("resetVersion");const Z=l.current;if(Z)try{(ie=Z.reset)==null||ie.call(Z),Z.clear(),Z.refresh(0,Math.max(0,Z.rows-1))}catch{}},[N]),T.useEffect(()=>{const Z=l.current;!Z||!S||(Z.options.theme={...S},ta(Z))},[S]),T.useEffect(()=>E(ie=>{const re=l.current;if(!re)throw new Error("terminal not ready");re.write(ie),R==null||R(ie.byteLength)}),[E,l,R]),T.useEffect(()=>{if(!k)return;_(10);const Z=l.current;if(Z&&(ta(Z),!y))try{Z.focus()}catch{}},[k,y,_,l])}const q5=({onTerminalFocus:a,isActive:n=!0})=>{var kn;const l=T.useRef(null),o=T.useRef(null),r=T.useRef(null),c=T.useRef(null),h=T.useRef(null),m=T.useRef(1),p=T.useRef(null),g=T.useRef(!1),y=sw(),v=y||typeof navigator<"u"&&navigator.maxTouchPoints>0||typeof window<"u"&&"ontouchstart"in window,x=hC(),[w,S]=T.useState(fC),{metrics:M,record:N}=mC(x),[k,E]=T.useState(null),{settings:R,terminalFontFamily:H,terminalFontSize:j,hostFont:D,ensureHostGlyphs:_,profiles:z,activeProfileId:K,t:q}=Ee(),{isController:te,connectionState:Z,hostPalette:ie,herdrPrefixKeys:re,terminalResetVersion:P,agentStatus:A,platform:G,reportShellProfile:W,connect:se,rttMs:Q}=et(),{addToast:ge}=Xt(),{sendResize:ye,sendBinary:ue,observeKeyInput:Te,consumeModifierLatch:ce,warnViewerMode:be,subscribeToOutput:ae,subscribeToPasteFileReady:we}=Ms(),{uploadImage:le}=Cr(),ve=Jn.useMemo(()=>gw(ie),[ie]),Ne=En({isController:te,sendBinary:ue,sendResize:ye,warnViewerMode:be,uploadImage:le,t:q,consumeModifierLatch:ce,hostTheme:ve,onTerminalFocus:a,ensureHostGlyphs:_,glyphScan:D.glyphs.status==="ready",platform:G,reportShellProfile:W}),Ie=En(n),Xe=wT({termRef:h,rendererRef:p,mode:R.predictiveEcho,connectionState:Z,observeKeyInput:Te,herdrPrefixKeys:re}),[tt,xe]=T.useState(null),Ae=BT({termRef:h,surfaceRef:r,mainRef:c,currentScaleRef:m,addToast:ge,t:q}),st=En(Ae),it=vC({termRef:h,isController:te,warnViewerMode:be,uploadImage:le,addToast:ge,t:q,onPaste:()=>Xe.discard("paste"),subscribeToPasteFileReady:we}),bt=kT({termRef:h,containerRef:l,frameRef:o,surfaceRef:r,currentScaleRef:m,rendererRef:p,initialBannerWrittenRef:g,isActiveRef:Ie,sendResize:ye,onResized:()=>Xe.forget("resize")});$5({containerRef:l,surfaceRef:r,termRef:h,rendererRef:p,currentScaleRef:m,initialBannerWrittenRef:g,live:Ne,selection:st,prediction:Xe,fit:bt,isTouchDevice:y,debug:x?S:null,terminalFontSize:j,terminalFontFamily:H,hostTheme:ve,glyphRevision:D.glyphRevision,terminalResetVersion:P,isActive:n,subscribeToOutput:ae,onOutput:x?N:null,onTitle:xe,onRendererKind:E});const yn=Jn.useMemo(()=>{var Zt;return((Zt=z.find(ut=>ut.id===K))==null?void 0:Zt.displayName)??null},[z,K]);T.useEffect(()=>{Z!=="connected"&&xe(null)},[Z]),T.useEffect(()=>{const Zt=n&&Z==="connected",ut=R.agentAlertBadge?ws(A):null;JS(Zt?tt:null,yn,ut)},[n,Z,tt,yn,A,R.agentAlertBadge]),T.useEffect(()=>{Z==="disconnected"&&se()},[]);const vn=Zt=>{Zt.preventDefault()};return f.jsxs("main",{ref:c,className:"flex-1 w-full min-w-0 min-h-0 overflow-hidden relative flex flex-col",onContextMenu:vn,"aria-label":q("terminal.windowAriaLabel"),children:[f.jsx("div",{id:"terminal-container",ref:l,className:"absolute inset-0 overflow-hidden cursor-text",style:{touchAction:v?"none":"auto"},tabIndex:0,onContextMenu:vn,"aria-label":q("terminal.bufferAriaLabel"),role:"region",children:f.jsx("div",{id:"terminal-frame",ref:o,className:"relative overflow-hidden",style:{width:"100%",height:"100%"},children:f.jsx("div",{id:"terminal-surface",ref:r,className:"absolute top-0 left-0",style:{transformOrigin:"top left",width:"100%",height:"100%"}})})}),x&&f.jsx(yC,{debug:w,rttMs:Q,metrics:M,rendererKind:k,predictiveEcho:R.predictiveEcho,predictor:Xe.predictorRef.current,field:((kn=Xe.fieldProbeRef.current)==null?void 0:kn.detect())??null,renderer:p.current}),y&&Ae.selectionRect&&Ae.isHighlightVisible&&f.jsx(UT,{term:h.current,surface:r.current,main:c.current,rect:Ae.selectionRect,viewportY:Ae.viewportY}),y&&Ae.selectionMenu&&f.jsx(dC,{anchorPoint:Ae.selectionMenu,hasSelection:!!Ae.selectionSnapshot,isController:te,vibrateOnKeyPress:R.vibrateOnKeyPress,linkUrl:Ae.selectionMenu.link??null,onOpenLink:Zt=>{Td(Zt)||ge("warning",q("clipboard.openLinkFailed"))},onCopySelection:Ae.handleCopySelection,onCopyLine:Ae.handleCopyLine,onCopyScreen:Ae.handleCopyScreen,onPaste:it.handlePaste,onClose:Ae.clearSelection}),y&&it.isPasteFallbackOpen&&f.jsx(uC,{isOpen:it.isPasteFallbackOpen,onClose:it.closePasteFallback,onSend:it.handleFallbackPasteSend,onSendImage:it.handleFallbackImageSend})]})},X5=2e3;function Vd(){const{t:a}=Ee(),{addToast:n}=Xt(),[l,o]=T.useState(null),r=T.useRef(null);T.useEffect(()=>()=>{r.current&&clearTimeout(r.current)},[]);const c=T.useCallback((h,m,p="success")=>{Gd(h).then(g=>{if(g==="failed"){n("error",a("clipboard.copyFailed"));return}o(h),n(p,m),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>o(null),X5)})},[n,a]);return{copied:l,copy:c}}const ia="herdr-remote pair",sb="herdr-remote",Z5=({onPairedSuccess:a})=>{const{settings:n,updateSettings:l,t:o}=Ee(),{connect:r,connectionState:c,stateDetail:h}=et(),{addToast:m}=Xt(),[p,g]=T.useState(""),{copied:y,copy:v}=Vd(),[x,w]=T.useState(!1),[S,M]=T.useState(n.wsUrl||Rt),[N,k]=T.useState(n.token||""),[E,R]=T.useState(n.clientId||""),H=z=>v(z,o("toasts.commandCopied")),j=z=>{z.preventDefault();const K=p.trim().toUpperCase();if(!K&&!N.trim()){m("warning",o("toasts.connectionError"));return}const q={pairCode:K,wsUrl:S.trim()||Rt,clientId:E.trim()||n.clientId};N.trim()&&(q.token=N.trim()),l(q),r({pairCode:K||void 0,token:N.trim()||void 0,wsUrl:S.trim()||Rt,clientId:E.trim()||n.clientId}),a&&a()},D=c==="connecting"||c==="reconnecting",_=({n:z})=>f.jsxs("span",{"aria-hidden":"true",className:"shrink-0 font-bold text-tui-accent",children:["[",z,"]"]});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:o("onboarding.title")}),f.jsx("span",{className:"text-tui uppercase text-tui-warn",children:o("onboarding.firstTimeSetup")})]}),f.jsx("p",{className:"mt-0.5 text-tui leading-snug text-tui-muted",children:o("onboarding.description")})]}),c==="error"&&f.jsxs(Ri,{tone:"warn",action:f.jsx(Me,{variant:"warn",onClick:()=>r(),children:o("common.retry")}),children:[f.jsx("span",{className:"block font-bold",children:o("onboarding.authRequired")}),f.jsx("span",{className:"block text-tui-muted",children:h||o("onboarding.authRequiredDesc")})]}),f.jsxs("form",{onSubmit:j,className:"grid gap-3",children:[f.jsx(Nt,{title:o("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(_,{n:1}),f.jsx("span",{className:"leading-snug",children:o("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:ia}),f.jsx(Me,{onClick:()=>H(ia),glyph:y===ia?ke.check:"⧉",className:ne("shrink-0",y===ia&&"border-tui-ok text-tui-ok"),children:o(y===ia?"common.copied":"common.copy")})]}),f.jsx("div",{className:"space-y-0.5 text-tui-sm",children:f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsx("span",{className:"truncate text-tui-faint",children:o("onboarding.step1TuiNote")}),f.jsx("button",{type:"button",onClick:()=>H(sb),className:"shrink-0 cursor-pointer border border-tui-border-dim px-1 text-tui-muted hover:border-tui-accent hover:text-tui-accent",title:o("common.clickToCopy"),children:f.jsx("code",{children:sb})})]})})]})}),f.jsx(Nt,{title:o("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(_,{n:2}),f.jsx(xt,{type:"text",value:p,onChange:z=>g(z.target.value.toUpperCase()),placeholder:o("onboarding.step2Placeholder"),maxLength:12,autoFocus:!0,"aria-label":o("onboarding.step2Title"),className:"font-bold uppercase"})]}),f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:o("onboarding.step2Note")})]})}),f.jsx(Me,{variant:"primary",type:"submit",block:!0,disabled:D,className:"py-1.5",children:D?f.jsx(sa,{label:o("onboarding.connectingAndPairing")}):o("onboarding.connectAndPair")}),f.jsxs("div",{className:"border border-tui-border bg-tui-base",children:[f.jsxs("button",{type:"button",onClick:()=>w(!x),"aria-expanded":x,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:x?ke.chevronDown:ke.chevronRight}),f.jsx("span",{className:"uppercase",children:o("onboarding.advancedTitle")})]}),x&&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(un,{htmlFor:"onboarding-token",children:o("onboarding.manualTokenLabel")}),f.jsx(xt,{id:"onboarding-token",type:"password",value:N,onChange:z=>k(z.target.value),placeholder:o("onboarding.manualTokenPlaceholder")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(un,{htmlFor:"onboarding-ws",children:o("onboarding.wsEndpointLabel")}),f.jsx(xt,{id:"onboarding-ws",type:"text",value:S,onChange:z=>M(z.target.value),placeholder:o("onboarding.wsEndpointPlaceholder")})]}),f.jsx(IS,{}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(un,{htmlFor:"onboarding-client-id",children:o("onboarding.clientIdLabel")}),f.jsx(xt,{id:"onboarding-client-id",type:"text",value:E,onChange:z=>R(z.target.value)})]})]})]})]})]})})},ei="tui-focusable inline-flex shrink-0 select-none items-center justify-center border text-tui font-medium transition-colors",As="border-tui-border bg-tui-surface text-tui-text hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",W5="border-tui-accent bg-tui-accent text-tui-crust font-bold",Q5="border-tui-ok bg-transparent text-tui-ok hover:bg-tui-ok hover:text-tui-crust font-bold",Jy={default:As,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"};function J5(a){return{capHeight:a?"h-8":"h-7",keyClass:a?"h-8 min-w-[2rem] px-1.5":"h-7 min-w-[1.75rem] px-1.5",squareKeyClass:a?"h-8 w-8":"h-7 w-7",drawerToggleClass:a?"h-8 px-1.5":"h-7 px-1.5"}}function eM({capHeight:a,onCustomize:n,sendCombo:l}){const{settings:o,t:r}=Ee(),{agentProfile:c,shellProfile:h}=et(),m=nw(c,o.agentKeymaps[c],h),p=y=>{let v="";try{v=ds(y.combo)}catch{}const x=y.custom?y.customLabel||"":r(`agentActions.${y.labelKey}`),w=y.labelKey==="interrupt"&&y.combo.trim().toLowerCase()==="ctrl+c"?"bad":y.combo.trim().toLowerCase()==="ctrl+z"?"warn":"default";return f.jsxs("button",{type:"button","data-testid":`agent-key-${y.id}`,onClick:()=>l(y.combo),className:ne(ei,a,"max-w-[10rem] gap-1 px-1.5",Jy[w]),title:`${v} ${x}`.trim(),"aria-label":`${v} ${x}`.trim(),children:[f.jsx("span",{className:"font-bold",children:v}),f.jsx("span",{className:"max-w-[5rem] truncate text-tui-sm opacity-70",children:x})]},y.id)},g=[...m.agentActions,...m.genericActions];return g.length===0&&!n?null:f.jsxs("div",{"data-testid":"agent-key-actions",role:"group","aria-label":`${na[c].name} ${r("agentKeymaps.agentGroup")}`,className:"flex shrink-0 items-center gap-1",children:[f.jsx("span",{"aria-hidden":"true",className:"mx-1 h-5 w-px shrink-0 bg-tui-border-dim"}),g.map(p),n&&f.jsx("button",{type:"button","data-testid":"agent-key-customize",onClick:n,className:ne(ei,a,"px-1.5 text-tui-sm border-tui-border-dim bg-transparent text-tui-faint hover:border-tui-accent hover:text-tui-accent"),title:r("agentKeymaps.customizeBar"),"aria-label":r("agentKeymaps.customizeBar"),children:r("agentKeymaps.customizeBarShort")})]})}const e0="scrollbar-none flex items-center gap-1 overflow-x-auto border-b border-tui-border-dim bg-tui-crust p-1.5";function tM({capHeight:a,onKey:n}){return 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(l=>{const o=`F${l}`;return f.jsxs("button",{type:"button",onClick:()=>n(oe[o]),className:ne(ei,As,a),children:["F",l]},o)})})}const nM=[{code:oe.CTRL_C,caption:"^C",title:"virtualKeyboard.ctrlCTitle",badge:"virtualKeyboard.badgeSigint",tone:"bad"},{code:oe.CTRL_D,caption:"^D",title:"virtualKeyboard.ctrlDTitle",badge:"virtualKeyboard.badgeEof"},{code:oe.CTRL_Z,caption:"^Z",title:"virtualKeyboard.ctrlZTitle",badge:"virtualKeyboard.badgeTstp",tone:"warn"},{code:oe.CTRL_L,caption:"^L",title:"virtualKeyboard.ctrlLTitle",badge:"virtualKeyboard.badgeClear"},{code:oe.CTRL_R,caption:"^R",title:"virtualKeyboard.ctrlRTitle",badge:"virtualKeyboard.badgeSearch"},{code:oe.CTRL_A,caption:"^A",title:"virtualKeyboard.ctrlATitle",badge:"virtualKeyboard.badgeStart"},{code:oe.CTRL_E,caption:"^E",title:"virtualKeyboard.ctrlETitle",badge:"virtualKeyboard.badgeEnd"},{code:oe.CTRL_K,caption:"^K",title:"virtualKeyboard.ctrlKTitle",badge:"virtualKeyboard.badgeKill"}];function iM({capHeight:a,onKey:n}){const{t:l}=Ee();return f.jsx("div",{className:e0,children:nM.map(o=>f.jsxs("button",{type:"button",onClick:()=>n(o.code,!1),className:ne(ei,a,"gap-1.5 px-2",Jy[o.tone??"default"]),title:l(o.title),children:[f.jsx("span",{className:"font-bold",children:o.caption}),f.jsx("span",{className:"text-tui-sm opacity-70",children:l(o.badge)})]},o.caption))})}const aM=["|","~","/","\\","-","_","$","&",";",":","`",'"',"'",">","<","=","#","@","{","}","[","]"];function lM({squareKeyClass:a,onKey:n}){return f.jsx("div",{className:e0,children:aM.map(l=>f.jsx("button",{type:"button",onClick:()=>n(l,!0),className:ne(ei,As,a,"font-bold"),children:l},l))})}const ob="image/png,image/jpeg,image/webp,image/gif,image/*";function rb({fileInputRef:a}){const{uploadImage:n}=Cr(),l=o=>{var c;const r=(c=o.target.files)==null?void 0:c[0];o.target.value="",r&&n(r)};return f.jsxs(f.Fragment,{children:[f.jsx("input",{ref:a,type:"file",accept:ob,className:"hidden","data-testid":"key-toolbar-file-input",onChange:l}),f.jsx("input",{type:"file",accept:ob,capture:"environment",className:"hidden","data-testid":"key-toolbar-camera-input",onChange:l})]})}function cb({collapsed:a}){const{uploadProgress:n}=Cr();return n.active?f.jsx("div",{"data-testid":a?"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(PS,{ratio:n.ratio,label:n.statusText,tone:n.phase==="completed"?"ok":n.phase==="error"?"bad":"accent","aria-label":n.statusText})}):null}function sM({fileInputRef:a,keyClass:n,vibrate:l}){const{t:o}=Ee(),{isController:r}=et(),{warnViewerMode:c}=Ms(),{uploadProgress:h}=Cr(),m=h.active,p=()=>{var g;if(l(),!r){c();return}m||(g=a.current)==null||g.click()};return f.jsx("button",{type:"button","data-testid":"image-upload-btn",onClick:p,disabled:m,className:ne(ei,n,m?"border-tui-border-dim bg-tui-surface opacity-60 cursor-not-allowed":As),title:m?h.statusText:o("virtualKeyboard.uploadImageTitle"),"aria-label":o("virtualKeyboard.uploadImage"),children:f.jsx("span",{className:"font-medium",children:m?`${h.percent}%`:o("virtualKeyboard.image")})})}function oM(){const{settings:a}=Ee(),{isController:n}=et(),{sendKey:l,warnViewerMode:o,consumeModifierLatch:r}=Ms(),c=T.useRef([]);T.useEffect(()=>()=>{for(const g of c.current)clearTimeout(g);c.current=[]},[]);const h=T.useCallback(()=>{if(a.vibrateOnKeyPress&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(8)}catch{}},[a.vibrateOnKeyPress]),m=T.useCallback((g,y=!0)=>{if(h(),!n){o();return}const v=r();l(y&&v?ur(g,v):g)},[n,l,o,h,r]),p=T.useCallback(g=>{if(h(),!n){o();return}let y;try{y=gn(g)}catch{return}if(r(),y.length===1){l(y[0]);return}y.forEach((v,x)=>{const w=setTimeout(()=>{c.current=c.current.filter(S=>S!==w),l(v)},x*120);c.current.push(w)})},[r,n,l,h,o]);return{vibrate:h,pressKey:m,sendCombo:p}}function rM({capHeight:a}){const{platform:n,adminTerminalSupported:l,adapter:o}=et(),{t:r}=Ee();if(n!=="win32")return null;const c=l!==!1;return f.jsxs("button",{type:"button","data-testid":"new-admin-terminal",onClick:()=>o==null?void 0:o.sendAdminTabOpen(),disabled:!c,className:ne(ei,a,"shrink-0 gap-1 border-amber-500/50 bg-amber-500/10 px-2 text-amber-200 hover:border-amber-400 hover:bg-amber-500/20 disabled:cursor-not-allowed disabled:opacity-50"),title:r(c?"terminal.adminTerminalSetup":"terminal.adminTerminalUpdate"),"aria-label":r("terminal.newAdminTerminal"),children:[f.jsx("span",{"aria-hidden":"true",children:"⬆"}),f.jsx("span",{children:r("terminal.adminShort")})]})}const cM=({compact:a=!1,onCustomize:n})=>{const{settings:l,updateSettings:o,t:r}=Ee(),{modifierLatch:c,toggleModifierLatch:h}=Ms(),{vibrate:m,pressKey:p,sendCombo:g}=oM(),{capHeight:y,keyClass:v,squareKeyClass:x,drawerToggleClass:w}=J5(a),S=T.useRef(null),[M,N]=T.useState(!1),[k,E]=T.useState(!1),[R,H]=T.useState(!1),j=T.useRef(null),[D,_]=T.useState(!1),z=T.useCallback(()=>{const P=j.current;_(!!P&&P.scrollLeft+P.clientWidth<P.scrollWidth-1)},[]);if(T.useEffect(z),T.useEffect(()=>{const P=j.current;if(!P||typeof ResizeObserver!="function")return;const A=new ResizeObserver(z);return A.observe(P),()=>A.disconnect()},[z,l.toolbarVisible]),!l.toolbarVisible)return f.jsxs("div",{"data-testid":"key-toolbar-collapsed",className:"z-20 flex shrink-0 flex-col border-t border-tui-border bg-tui-mantle pb-[max(env(safe-area-inset-bottom,0px),0.125rem)]",children:[f.jsx(rb,{fileInputRef:S}),f.jsx(cb,{collapsed:!0}),f.jsx("div",{className:"flex items-center justify-center px-2 py-0.5",children:f.jsxs("button",{type:"button",onClick:()=>o({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:r("virtualKeyboard.expandToolbar"),"aria-label":r("virtualKeyboard.expandToolbar"),"aria-expanded":!1,children:[f.jsx("span",{"aria-hidden":"true",children:"▴"}),f.jsx("span",{"aria-hidden":"true",children:r("common.keyBar")})]})})]});const K=l.virtualKeys&&l.virtualKeys.length>0?l.virtualKeys.filter(P=>P.enabled):Yb,q=P=>P.id==="left"?f.jsx("span",{"aria-hidden":"true",children:"←"}):P.id==="up"?f.jsx("span",{"aria-hidden":"true",children:"↑"}):P.id==="down"?f.jsx("span",{"aria-hidden":"true",children:"↓"}):P.id==="right"?f.jsx("span",{"aria-hidden":"true",children:"→"}):P.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:r("virtualKeyboard.keyEnter")})]}):P.id==="drawer_chords"?f.jsx("span",{children:"^C"}):P.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:M?"▾":"▴"})]}):f.jsx("span",{children:P.label}),te=P=>{if(m(),P.type==="modifier"){P.modifierType==="ctrl"||P.modifierType==="alt"||P.modifierType==="shift"?h(P.modifierType):P.modifierType==="meta"&&p(oe.ESC);return}if(P.type==="drawer"){P.drawerType==="fn"?(N(!M),E(!1),H(!1)):P.drawerType==="chords"?(H(!R),N(!1),E(!1)):P.drawerType==="symbols"&&(E(!k),N(!1),H(!1));return}p(P.code,P.type!=="chord")},Z=P=>{if(P.type==="modifier"){if(P.modifierType==="ctrl")return c.ctrl;if(P.modifierType==="alt")return c.alt;if(P.modifierType==="shift")return c.shift}if(P.type==="drawer"){if(P.drawerType==="fn")return M;if(P.drawerType==="chords")return R;if(P.drawerType==="symbols")return k}return!1},ie=P=>{const A=Z(P),G=["left","up","down","right"].includes(P.id),W=P.type==="drawer",se=gd(P,r);return f.jsx("button",{type:"button",onClick:()=>te(P),className:ne(ei,G?x:W?w:v,P.id==="enter"?Q5:A?W5:As),title:se,"aria-label":se,"aria-pressed":A,children:q(P)},P.id)},re=K.find(P=>P.id==="enter");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":r("virtualKeyboard.touchKeyboardShortcuts"),children:[f.jsx(rb,{fileInputRef:S}),f.jsx(cb,{collapsed:!1}),M&&f.jsx(tM,{capHeight:y,onKey:p}),R&&f.jsx(iM,{capHeight:y,onKey:p}),k&&f.jsx(lM,{squareKeyClass:x,onKey:p}),f.jsxs("div",{"data-testid":"key-toolbar-row",className:ne("flex flex-nowrap items-center justify-start gap-1",a?"px-1.5 py-1":"px-2 py-1.5"),children:[f.jsxs("div",{className:"relative min-w-0",children:[f.jsxs("div",{ref:j,"data-testid":"key-toolbar-scroll",onScroll:z,className:"scrollbar-none flex flex-nowrap touch-pan-x items-center gap-1 overflow-x-auto overscroll-x-contain",children:[f.jsx("button",{type:"button",onClick:()=>o({toolbarVisible:!1}),className:ne(ei,x,"mr-1 border-tui-border-dim bg-transparent text-tui-faint hover:border-tui-border hover:text-tui-text"),title:r("virtualKeyboard.collapseToolbar"),"aria-label":r("virtualKeyboard.collapseToolbar"),"aria-expanded":!0,children:f.jsx("span",{"aria-hidden":"true",children:"▾"})}),K.filter(P=>P.id!=="enter").map(ie),f.jsx(rM,{capHeight:y}),f.jsx(eM,{capHeight:y,onCustomize:n,sendCombo:g}),f.jsx(sM,{fileInputRef:S,keyClass:v,vibrate:m})]}),D&&f.jsx("span",{"aria-hidden":"true","data-testid":"key-toolbar-more",className:"pointer-events-none absolute inset-y-0 right-0 w-4 bg-gradient-to-l from-tui-mantle"})]}),re&&ie(re)]})]})},uM=({isOpen:a,onClose:n})=>{const{t:l}=Ee(),{isController:o,shellProfile:r}=et(),{sendKey:c,warnViewerMode:h}=Ms(),[m,p]=T.useState("");if(!a)return null;const g=Uw(r),y=x=>{if(x&&x.preventDefault(),!o){h();return}m.length>0?(c(`${m}\r`),p("")):c("\r")},v=x=>{if(!o){h();return}c(`${x}\r`)};return f.jsxs("section",{className:"z-20 flex flex-col gap-1.5 border-t border-tui-border bg-tui-mantle p-2","aria-label":l("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:l("virtualKeyboard.helperTitle")}),f.jsx(Me,{variant:"ghost",onClick:n,"aria-label":l("virtualKeyboard.closeHelper"),children:"esc"})]}),f.jsx("div",{className:"scrollbar-none flex items-center gap-1 overflow-x-auto py-0.5",children:g.map(x=>f.jsx("button",{type:"button",onClick:()=>v(x),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:x},x))}),f.jsxs("form",{onSubmit:y,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:l("virtualKeyboard.placeholder")}),f.jsx(xt,{id:"virtual-keyboard-input",name:"terminal-input",type:"text",value:m,onChange:x=>p(x.target.value),placeholder:l("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:()=>p(""),className:"tui-focusable absolute right-1 top-1/2 -translate-y-1/2 px-1 text-tui-faint hover:text-tui-bad","aria-label":l("virtualKeyboard.clearInput"),children:f.jsx("span",{"aria-hidden":"true",children:ke.cross})})]}),f.jsx(Me,{variant:"primary",type:"submit",title:l("virtualKeyboard.sendButton"),glyph:"⏎",className:"h-9 shrink-0",children:f.jsx("span",{className:"hidden sm:inline",children:l("virtualKeyboard.sendButton")})})]})]})};function Ar(a,n){const l=(o,r)=>n?n(o):r;switch(a){case"connected":return{label:l("connection.live","Live"),level:"ok",needsAttention:!1};case"connecting":return{label:l("connection.connecting","Connecting"),level:"warn",needsAttention:!0};case"reconnecting":return{label:l("connection.reconnecting","Reconnecting"),level:"warn",needsAttention:!0,actionLabel:l("connection.reconnectNow","Reconnect now")};case"error":return{label:l("connection.error","Error"),level:"bad",needsAttention:!0,actionLabel:l("connection.retry","Retry")};default:return{label:l("connection.offline","Offline"),level:"idle",needsAttention:!0,actionLabel:l("connection.connect","Connect")}}}const t0=({hint:a,children:n})=>{const{t:l}=Ee(),[o,r]=T.useState(!1);return f.jsxs("div",{className:"border border-tui-border-dim",children:[f.jsxs("button",{type:"button",onClick:()=>r(!o),"aria-expanded":o,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:o?ke.chevronDown:ke.chevronRight}),f.jsx("span",{children:l("pairing.advancedTitle")}),f.jsx("span",{className:"min-w-0 truncate text-tui-sm text-tui-faint",children:a})]}),o&&f.jsx("div",{className:"space-y-2.5 border-t border-tui-border-dim px-2 py-2",children:n})]})},dM=({isOpen:a,onClose:n})=>{const{settings:l,updateSettings:o,t:r,activeProfile:c,activeProfileId:h,renameProfile:m}=Ee(),{connect:p,disconnect:g,connectionState:y,hostId:v}=et(),{addToast:x}=Xt(),[w,S]=T.useState(l.wsUrl),[M,N]=T.useState(l.token),[k,E]=T.useState(l.pairCode),[R,H]=T.useState(l.clientId),[j,D]=T.useState((c==null?void 0:c.displayName)||""),[_,z]=T.useState(l.autoReconnect);if(T.useEffect(()=>{a&&(S(l.wsUrl),N(l.token),E(l.pairCode),H(l.clientId),D((c==null?void 0:c.displayName)||""),z(l.autoReconnect))},[a,l,c]),!a)return null;const K=te=>{te.preventDefault();const Z={wsUrl:w.trim()||Rt,token:M.trim(),pairCode:k.trim().toUpperCase(),clientId:R.trim()||l.clientId,autoReconnect:_};if(!Z.token&&!Z.pairCode){x("warning",r("pairing.credentialsRequired"));return}o(Z),h&&j.trim()&&m(h,j),g(),p({wsUrl:Z.wsUrl,token:Z.token||void 0,pairCode:Z.pairCode||void 0,clientId:Z.clientId,autoReconnect:_}),n()},q=Ar(y,r);return f.jsxs(ul,{isOpen:a,onClose:n,title:r("pairing.title"),closeLabel:r("common.closeDialog"),hints:[{keys:"esc",action:r("common.close")},{keys:"⏎",action:r("pairing.saveAndConnect")}],footer:f.jsxs(f.Fragment,{children:[y==="connected"&&f.jsx(Me,{variant:"danger",onClick:()=>{g(),n()},children:r("common.disconnect")}),f.jsx(Me,{variant:"primary",type:"submit",form:"pairing-form",children:r("pairing.saveAndConnect")})]}),children:[f.jsxs("div",{className:"mb-3 flex min-w-0 items-center gap-1.5 border-b border-tui-border-dim pb-2 text-tui",children:[f.jsx(dn,{level:q.level}),f.jsx("span",{className:"shrink-0 text-tui-text",children:q.label}),v&&f.jsxs("span",{className:"truncate text-tui-muted",children:["· ",v]})]}),f.jsxs("form",{id:"pairing-form",onSubmit:K,className:"space-y-3",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(un,{htmlFor:"pairing-name",children:r("pairing.displayNameLabel")}),f.jsx(xt,{id:"pairing-name",type:"text",value:j,onChange:te=>D(te.target.value),placeholder:r("pairing.displayNamePlaceholder"),maxLength:64,autoComplete:"off"})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(un,{htmlFor:"pairing-code",hint:r("pairing.repairNote"),children:r("pairing.pairCodeLabel")}),f.jsx(xt,{id:"pairing-code",type:"text",value:k,onChange:te=>E(te.target.value.toUpperCase()),placeholder:r("pairing.pairCodePlaceholder"),maxLength:12,autoComplete:"off",className:"uppercase"})]}),f.jsxs(t0,{hint:r("pairing.editAdvancedHint"),children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(un,{htmlFor:"pairing-ws",children:r("pairing.wsUrlLabel")}),f.jsx(xt,{id:"pairing-ws",type:"text",value:w,onChange:te=>S(te.target.value),placeholder:r("pairing.wsUrlPlaceholder")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(un,{htmlFor:"pairing-token",hint:r("pairing.tokenNote"),children:r("pairing.tokenLabel")}),f.jsx(xt,{id:"pairing-token",type:"password",value:M,onChange:te=>N(te.target.value),placeholder:r("pairing.tokenPlaceholder")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(un,{htmlFor:"pairing-client-id",children:r("pairing.clientIdLabel")}),f.jsxs("div",{className:"flex gap-2",children:[f.jsx(xt,{id:"pairing-client-id",type:"text",value:R,onChange:te=>H(te.target.value),className:"flex-1"}),f.jsx(Me,{onClick:()=>H(`client-${Math.random().toString(36).substring(2,8)}`),className:"shrink-0",children:r("pairing.newIdButton")})]})]}),f.jsx(GS,{checked:_,onChange:z,label:r("pairing.autoReconnectLabel")})]})]})]})},fM=({isOpen:a,onClose:n})=>{const{t:l,addProfileAndConnect:o}=Ee(),{addToast:r}=Xt(),[c,h]=T.useState(""),[m,p]=T.useState(Rt),[g,y]=T.useState("");T.useEffect(()=>{a&&(h(""),p(Rt),y(""))},[a]);const v=x=>{x.preventDefault();const w=c.trim().toUpperCase();if(!w&&!g.trim()){r("warning",l("pairing.credentialsRequired"));return}o({wsUrl:m.trim()||Rt,pairCode:w,token:g.trim()}),n()};return f.jsx(ul,{isOpen:a,onClose:n,title:l("pairing.addTitle"),subtitle:l("pairing.addSubtitle"),closeLabel:l("common.closeDialog"),size:"sm",hints:[{keys:"esc",action:l("common.close")},{keys:"⏎",action:l("pairing.pairAndConnect")}],footer:f.jsx(Me,{variant:"primary",type:"submit",form:"add-host-form",children:l("pairing.pairAndConnect")}),children:f.jsxs("form",{id:"add-host-form",onSubmit:v,className:"space-y-3",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(un,{htmlFor:"add-host-code",hint:l("pairing.pairCodeNote"),children:l("pairing.pairCodeLabel")}),f.jsx(xt,{id:"add-host-code",type:"text",value:c,onChange:x=>h(x.target.value.toUpperCase()),placeholder:l("pairing.pairCodePlaceholder"),maxLength:12,autoComplete:"off",autoFocus:!0,className:"font-bold uppercase"}),f.jsx("p",{className:"text-tui-sm text-tui-faint",children:l("pairing.pairCodeHelp")})]}),f.jsxs(t0,{hint:l("pairing.advancedHint"),children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(un,{htmlFor:"add-host-ws",children:l("pairing.wsUrlLabel")}),f.jsx(xt,{id:"add-host-ws",type:"text",value:m,onChange:x=>p(x.target.value),placeholder:l("onboarding.wsEndpointPlaceholder")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(un,{htmlFor:"add-host-token",hint:l("pairing.tokenNote"),children:l("pairing.tokenLabel")}),f.jsx(xt,{id:"add-host-token",type:"password",value:g,onChange:x=>y(x.target.value),placeholder:l("onboarding.manualTokenPlaceholder")})]})]})]})})},Li=ne(Mr,"py-0"),hM="h-7 py-0",Ld="h-7 py-0 px-1.5",wr="text-tui-bad hover:border-tui-bad hover:text-tui-bad",mM=["grid items-center gap-x-2 gap-y-1 py-1","grid-cols-[4rem_minmax(0,1fr)_9rem] [grid-template-areas:'cap_label_actions'_'combo_combo_default']","sm:grid-cols-[4rem_minmax(0,1fr)_9rem_9rem_7rem] sm:[grid-template-areas:'cap_label_combo_default_actions']"].join(" ");function n0(a){return{offLabel:a("settings.toggleOff"),onLabel:a("settings.toggleOn")}}const pM=({profile:a,onProfileChange:n})=>{const{settings:l,updateSettings:o,t:r}=Ee(),{agentProfile:c}=et(),[h,m]=T.useState({}),p=T.useRef({}),[g,y]=T.useState(""),[v,x]=T.useState(""),w=a||c,S=l.agentKeymaps[w]||{},M=Mb(w,S),N=Ab(w,S),k=N.filter(A=>!A.hidden).length,E=A=>A.custom?A.customLabel||"":r(`agentActions.${A.labelKey}`),R=A=>{try{return ds(A.combo)}catch{return A.combo}},H=A=>{o({agentKeymaps:{...l.agentKeymaps,[w]:A}})},j=(A,G)=>{var W;H({...S,actions:{...S.actions,[A]:{...(W=S.actions)==null?void 0:W[A],...G}}})},D=A=>{j(A.id,{keys:A.defaultCombo})},_=(A,G)=>{const W=A+(G==="up"?-1:1);if(W<0||W>=M.length)return;const se=M.map(Q=>Q.id);[se[A],se[W]]=[se[W],se[A]],H({...S,order:se})},z=A=>{var G;H({...S,custom:(S.custom||[]).filter(W=>W.id!==A),order:(G=S.order)==null?void 0:G.filter(W=>W!==A)})},K=()=>H(iw(S)),q=()=>{const A={...l.agentKeymaps};delete A[w],o({agentKeymaps:A})},te=()=>{const A=g.trim();if(!A)return;try{gn(v)}catch{return}const G=`custom-${Date.now().toString(36)}`;H({...S,custom:[...S.custom||[],{id:G,label:A,keys:v.trim()}],order:[...M.map(W=>W.id),G]}),y(""),x("")},Z=A=>A instanceof pn?r(`agentKeymaps.errors.${A.code}`,A.params):String(A),ie=(A,G)=>`${A}:${G}`,re=(A,G)=>{const W=ie(w,A);p.current={...p.current,[W]:G},m(p.current);try{gn(G),j(A,{keys:G})}catch{}},P=A=>{const G=ie(w,A),W=p.current[G];if(W!==void 0){delete p.current[G],m({...p.current});try{gn(W),j(A,{keys:W})}catch{}}};return f.jsxs("div",{className:"space-y-4",children:[f.jsx(bn,{title:r("agentKeymaps.settingsProfileLabel"),aside:f.jsx(Me,{variant:"ghost",onClick:q,className:ne(wr,Ld),children:r("agentKeymaps.restoreProfile")}),children:f.jsx(Kt,{label:r("agentKeymaps.profileRowLabel"),htmlFor:"agent-keymap-profile",hint:na[w].configHint?r("agentKeymaps.configHint",{path:na[w].configHint}):void 0,control:f.jsx(Tr,{id:"agent-keymap-profile","aria-label":r("agentKeymaps.settingsProfileLabel"),value:w,onChange:A=>n(A.target.value),className:Li,children:Vx.map(A=>f.jsx("option",{value:A,children:na[A].name},A))})})}),f.jsx(bn,{title:r("agentKeymaps.barGroup"),aside:f.jsx(Me,{variant:"ghost",onClick:K,className:ne(wr,Ld),children:r("agentKeymaps.restoreBar")}),children:f.jsxs("div",{className:"space-y-2 py-1.5",children:[f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:r("agentKeymaps.barHint",{profile:na[w].name,count:k})}),f.jsx("div",{role:"group","aria-label":r("agentKeymaps.barGroup"),"data-testid":"agent-bar-choices",className:"flex flex-wrap gap-1",children:N.map(A=>{const G=E(A),W=R(A),se=!A.hidden;return f.jsxs("button",{type:"button","data-testid":`agent-bar-toggle-${A.id}`,"aria-pressed":se,onClick:()=>j(A.id,{hidden:se}),title:`${W} ${G}`.trim(),className:ne("tui-focusable inline-flex h-7 select-none items-center gap-1 border px-1.5 text-tui-sm transition-colors",se?"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:se?ke.check:"+"}),f.jsx("span",{className:"font-bold",children:W}),f.jsx("span",{className:se?void 0:"opacity-80",children:G})]},A.id)})})]})}),f.jsx(bn,{title:r("agentKeymaps.listGroup",{profile:na[w].name}),children:M.map((A,G)=>{var ce,be;const W=E(A),se=r("agentKeymaps.defaultCombo",{combo:ds(A.defaultCombo)}),Q=((be=(ce=S.actions)==null?void 0:ce[A.id])==null?void 0:be.keys)??A.combo,ge=ie(w,A.id),ye=h[ge]??Q;let ue="",Te=null;try{gn(ye),ue=ds(ye)}catch(ae){Te=Z(ae)}return f.jsxs("div",{"data-testid":`agent-setting-row-${A.id}`,className:mM,children:[f.jsx(wy,{className:"w-full overflow-hidden whitespace-nowrap font-bold [grid-area:cap]",children:ue||"—"}),f.jsxs("span",{className:"min-w-0 break-words text-tui text-tui-text [grid-area:label]",title:W,children:[W,!A.verified&&f.jsx("span",{className:"ml-1 text-tui-sm text-tui-faint",children:r("agentKeymaps.unverified")})]}),f.jsxs("label",{className:"sr-only",htmlFor:`agent-combo-${A.id}`,children:[r("agentKeymaps.shortcutLabel")," ",W]}),f.jsx(xt,{id:`agent-combo-${A.id}`,"aria-label":`${r("agentKeymaps.shortcutLabel")} ${W}`,value:ye,onChange:ae=>re(A.id,ae.target.value),onBlur:()=>P(A.id),onKeyDown:ae=>{ae.key==="Enter"&&ae.currentTarget.blur()},placeholder:r("agentKeymaps.comboPlaceholder"),"aria-invalid":!!Te,className:ne("w-full min-w-0 [grid-area:combo]",hM)}),f.jsx("span",{className:"min-w-0 break-words text-tui-sm text-tui-faint [grid-area:default]",title:se,children:se}),f.jsxs("div",{className:"flex items-center justify-end [grid-area:actions]",children:[f.jsx(aa,{onClick:()=>D(A),title:r("agentKeymaps.resetAction"),"aria-label":`${r("agentKeymaps.resetAction")} ${W}`,children:"↺"}),f.jsx(aa,{disabled:G===0,onClick:()=>_(G,"up"),title:r("agentKeymaps.moveUp"),"aria-label":`${r("agentKeymaps.moveUp")} ${W}`,children:"↑"}),f.jsx(aa,{disabled:G===M.length-1,onClick:()=>_(G,"down"),title:r("agentKeymaps.moveDown"),"aria-label":`${r("agentKeymaps.moveDown")} ${W}`,children:"↓"}),A.custom?f.jsx(aa,{variant:"danger",onClick:()=>z(A.id),title:r("agentKeymaps.removeCustom"),"aria-label":`${r("agentKeymaps.removeCustom")} ${W}`,children:ke.cross}):f.jsx("span",{"aria-hidden":"true",className:"h-7 w-7 shrink-0"})]}),Te&&f.jsx("p",{className:"col-span-full text-tui-sm text-tui-bad",role:"alert",children:r("agentKeymaps.invalidCombo",{error:Te})})]},A.id)})}),f.jsx(bn,{title:r("agentKeymaps.addCustom"),children:f.jsxs("div",{className:"space-y-1 py-1.5",children:[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-muted",children:[f.jsx("span",{children:r("agentKeymaps.customLabel")}),f.jsx(xt,{value:g,onChange:A=>y(A.target.value),className:Li})]}),f.jsxs("label",{className:"min-w-[9rem] flex-1 space-y-1 text-tui-sm text-tui-muted",children:[f.jsx("span",{children:r("agentKeymaps.customCombo")}),f.jsx(xt,{value:v,onChange:A=>x(A.target.value),placeholder:r("agentKeymaps.comboPlaceholder"),className:Li})]}),f.jsx(Me,{variant:"primary",glyph:"+",onClick:te,disabled:!g.trim()||!v.trim(),className:Li,children:r("agentKeymaps.addAction")})]}),v.trim()&&(()=>{try{return gn(v),f.jsx("p",{className:"text-tui-sm text-tui-info",children:ds(v)})}catch(A){const G=Z(A);return f.jsx("p",{className:"text-tui-sm text-tui-bad",role:"alert",children:G})}})()]})})]})},i0={"gnome-terminal":"GNOME Terminal",ptyxis:"Ptyxis",tilix:"Tilix",konsole:"Konsole","xfce4-terminal":"Xfce Terminal",kitty:"kitty",alacritty:"Alacritty",ghostty:"Ghostty",wezterm:"WezTerm",foot:"foot",vscode:"VS Code",iterm2:"iTerm2","apple-terminal":"Terminal",xterm:"xterm",urxvt:"urxvt"},gM=["host_font_unavailable","host_font_timeout","disconnected","font_api_unavailable"],bM=()=>{const{hostFont:a,loadHostFont:n,declineHostFont:l,settings:o,activeProfile:r,t:c}=Ee(),{herdrLaunch:h,hostname:m}=et(),{addToast:p}=Xt(),{font:g,status:y,glyphs:v}=a,x=y==="loading"||v.status==="loading",w=y==="failed"||v.status==="failed",S=T.useRef(!1);T.useEffect(()=>{S.current&&!x&&!w&&a.interactive&&p("success",c("hostFont.loaded")),S.current=x&&a.interactive},[x,w,a.interactive,p,c]);const M=y==="available"||v.status==="available",N=a.interactive&&(x||w);if(!(g&&o.fontFamily==="host"&&!h&&(M||N)))return null;const E=y==="available"||a.interactive&&(y==="loading"||y==="failed"),R=v.source&&(v.status==="available"||a.interactive&&(v.status==="loading"||v.status==="failed")),H=m||(r==null?void 0:r.displayName)||c("herdrLaunch.thisHost"),j=[g.sizePx?`${Math.round(g.sizePx)}px`:null,g.source?i0[g.source]||g.source:null].filter(Boolean).join(c("hostFont.detailSeparator")),D=a.error&&gM.includes(a.error)?a.error:"other",_=a.totalBytes?a.receivedBytes/a.totalBytes:0;return f.jsx("div",{"data-testid":"host-font-prompt",className:"absolute inset-0 z-30 flex items-center justify-center bg-tui-crust/85 p-3",children:f.jsxs(Nt,{title:c("hostFont.title"),tone:y==="failed"?"bad":"accent",className:"w-full max-w-md",bodyClassName:"space-y-3","aria-label":c("hostFont.title"),children:[f.jsx("p",{className:"leading-snug text-tui-text",children:E||!v.source?c("hostFont.body",{host:H,family:g.family,detail:j?c("hostFont.detail",{detail:j}):""}):c("hostFont.bodyGlyphsOnly",{host:H,family:v.source.family})}),x?f.jsxs("div",{className:"space-y-1",role:"status",children:[f.jsx(YS,{value:_,width:32,className:"max-w-full overflow-hidden"}),f.jsx("p",{className:"text-tui-sm text-tui-muted",children:c("hostFont.loading",{received:qu(a.receivedBytes),total:qu(a.totalBytes)})})]}):f.jsxs(f.Fragment,{children:[w?f.jsx(Ri,{tone:"bad",children:c("hostFont.failed",{reason:c(`hostFont.reasons.${D}`)})}):f.jsxs("div",{className:"space-y-1 text-tui-sm leading-snug text-tui-faint",children:[E&&g.faces.length?f.jsx("p",{children:c("hostFont.download",{count:g.faces.length,size:qu(a.totalBytes)})}):null,R&&v.source?f.jsx("p",{children:c(v.source.scope==="all"?"hostFont.glyphsAll":"hostFont.glyphs",{family:v.source.family})}):null]}),f.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[f.jsx(Me,{onClick:l,children:c("hostFont.decline")}),f.jsx(Me,{variant:"primary",onClick:n,autoFocus:!0,children:c(w?"common.retry":"hostFont.load")})]})]})]})})},yM=({onOpenAdmin:a})=>{var j;const{settings:n,updateSettings:l,language:o,setLanguage:r,t:c,hostFont:h,syncHostFont:m,terminalFontFamily:p,terminalFontSize:g}=Ee(),{connectionState:y}=et(),v=dd.find(D=>D.id===n.fontFamily),x=(D,_)=>D==="host"||D==="system"?c(`fontPresets.${D}`):_,w=(()=>{const{font:D,status:_}=h,z=h.totalBytes?Math.round(h.receivedBytes/h.totalBytes*100):0,K=c(`settings.hostFontStatus.${_}`,{percent:z});return D?[D.family,D.sizePx?`${Math.round(D.sizePx)}px`:null,D.source?i0[D.source]||D.source:null,K].filter(Boolean).join(" · "):K})(),S=(j=h.font)!=null&&j.sizePx?al(h.font.sizePx):null,M=h.glyphs.source&&h.glyphs.status!=="none"?c("settings.hostGlyphLine",{family:h.glyphs.source.family,status:c(`settings.hostGlyphStatus.${h.glyphs.status}`,{count:h.glyphs.covered.toLocaleString()})}):null,N=typeof window<"u"&&window.isSecureContext&&"Notification"in window,k=10,E=24,R=n0(c),H=S?c("settings.fontSizeFollowHost",{size:S}):c("settings.fontSizeFollowHostUnknown");return f.jsxs("div",{className:"space-y-4",children:[f.jsx(bn,{title:c("settings.sectionInterface"),children:f.jsx(Kt,{label:c("settings.languageLabel"),hint:c("settings.languageHint"),control:f.jsx(wd,{name:"ui-language","aria-label":c("settings.languageLabel"),value:o,onChange:r,options:[{value:"zh",label:"简体中文"},{value:"en",label:"English"}]})})}),f.jsxs(bn,{title:c("settings.sectionFont"),children:[f.jsx(Kt,{label:c("settings.fontFamilyLabel"),htmlFor:"terminal-font-select",control:f.jsxs(Tr,{id:"terminal-font-select",value:n.fontFamily,onChange:D=>l({fontFamily:D.target.value}),"aria-label":c("settings.fontFamilyLabel"),className:Li,children:[!v&&f.jsx("option",{value:n.fontFamily,children:n.fontFamily}),dd.map(D=>f.jsx("option",{value:D.id,children:x(D.id,D.name)},D.id))]})}),n.fontFamily==="host"&&f.jsx(Kt,{label:c("settings.hostFontLabel"),hint:f.jsxs(f.Fragment,{children:[f.jsx("span",{"data-testid":"host-font-status",className:"block break-words text-tui-info",children:w}),M?f.jsx("span",{"data-testid":"host-glyph-status",className:"block break-words",children:M}):null]}),control:f.jsx(Me,{block:!0,onClick:m,disabled:y!=="connected"||h.status==="loading"||h.glyphs.status==="loading",className:Li,children:c("settings.hostFontSync")})}),f.jsx(Kt,{label:c("settings.fontSizeLabel",{size:g}),hint:c("settings.fontSizeHint"),htmlFor:"terminal-font-size",control:f.jsx("div",{className:ne("flex items-center",Mr),children:f.jsx("input",{id:"terminal-font-size",type:"range",min:k,max:E,step:1,value:g,onChange:D=>l({fontSize:Number(D.target.value),fontSizeFollowsHost:!1}),className:"h-1 w-full cursor-pointer appearance-none bg-tui-border accent-tui-accent"})})}),f.jsx(Kt,{label:H,control:f.jsx(ki,{label:H,...R,checked:n.fontSizeFollowsHost,onChange:D=>l(D?{fontSizeFollowsHost:!0}:{fontSizeFollowsHost:!1,fontSize:g})})}),f.jsx("div",{className:"py-1.5",children: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:p,fontSize:`${g}px`},children:[f.jsx("span",{className:"text-tui-ok",children:"$"}),' echo "Herdr 0O 1lI ',' [] () -> => !="']})})]}),f.jsxs(bn,{title:c("settings.sectionInput"),children:[f.jsx(Kt,{label:c("settings.predictiveEchoLabel"),hint:c("settings.predictiveEchoDesc"),control:f.jsx(wd,{name:"predictive-echo","aria-label":c("settings.predictiveEchoLabel"),value:n.predictiveEcho,onChange:D=>l({predictiveEcho:D}),options:[{value:"auto",label:c("settings.predictiveEchoAuto")},{value:"always",label:c("settings.predictiveEchoAlways")},{value:"off",label:c("settings.predictiveEchoOff")}]})}),f.jsx(Kt,{label:c("settings.touchKeyToolbar"),hint:c("settings.touchKeyToolbarDesc"),control:f.jsx(ki,{label:c("settings.touchKeyToolbar"),...R,checked:n.toolbarVisible,onChange:D=>l({toolbarVisible:D})})}),f.jsx(Kt,{label:c("settings.touchHaptics"),hint:c("settings.touchHapticsDesc"),control:f.jsx(ki,{label:c("settings.touchHaptics"),...R,checked:n.vibrateOnKeyPress,onChange:D=>l({vibrateOnKeyPress:D})})})]}),f.jsxs(bn,{title:c("settings.agentAlertsLabel"),children:[f.jsx(Kt,{label:c("settings.agentAlertBadge"),hint:c("settings.agentAlertBadgeDesc"),control:f.jsx(ki,{label:c("settings.agentAlertBadge"),...R,checked:n.agentAlertBadge,onChange:D=>l({agentAlertBadge:D})})}),f.jsx(Kt,{label:c("settings.agentAlertVibrate"),hint:c("settings.agentAlertVibrateDesc"),control:f.jsx(ki,{label:c("settings.agentAlertVibrate"),...R,checked:n.agentAlertVibrate,onChange:D=>l({agentAlertVibrate:D})})}),f.jsx(Kt,{label:c("settings.agentAlertSound"),hint:c("settings.agentAlertSoundDesc"),control:f.jsx(ki,{label:c("settings.agentAlertSound"),...R,checked:n.agentAlertSound,onChange:D=>{l({agentAlertSound:D}),D&&(ty(),ny("done"))}})}),N&&f.jsx(Kt,{label:c("settings.agentAlertNotify"),hint:c("settings.agentAlertNotifyDesc"),control:f.jsx(ki,{label:c("settings.agentAlertNotify"),...R,checked:n.agentAlertNotify,onChange:D=>{if(D&&Notification.permission!=="granted"){Notification.requestPermission().then(_=>l({agentAlertNotify:_==="granted"}));return}l({agentAlertNotify:D})}})})]}),a&&f.jsx(bn,{title:c("settings.sectionAdmin"),children:f.jsx(Kt,{label:c("settings.adminEntry"),hint:c("settings.adminEntryHint"),control:f.jsx(Me,{block:!0,variant:"primary",glyph:ke.arrowRight,onClick:a,className:Li,children:c("settings.adminEntryOpen")})})})]})},vM=()=>{const{settings:a,updateSettings:n,t:l}=Ee(),{addToast:o}=Xt(),[r,c]=T.useState(!1),h=n0(l),m=a.virtualKeys&&a.virtualKeys.length>0?a.virtualKeys:xs(),p=w=>{const S=m.map(M=>M.id===w?{...M,enabled:!M.enabled}:M);n({virtualKeys:S})},g=(w,S)=>{const M=S==="up"?w-1:w+1;if(M<0||M>=m.length)return;const N=[...m],k=N[w];N[w]=N[M],N[M]=k,n({virtualKeys:N})},y=w=>{if(m.some(M=>M.id===w.id)){const M=m.map(N=>N.id===w.id?{...N,enabled:!0}:N);n({virtualKeys:M})}else{const M=[...m,{...w,enabled:!0}];n({virtualKeys:M})}c(!1)},v=w=>{const S=m.filter(M=>M.id!==w);n({virtualKeys:S})},x=()=>{n({virtualKeys:xs()}),o("info",l("toasts.keyLayoutReset"))};return f.jsxs("div",{className:"space-y-3",children:[f.jsx(bn,{title:l("virtualKeyboard.customizeTitle"),aside:f.jsx(Me,{variant:"ghost",onClick:x,className:ne(wr,Ld),children:l("virtualKeyboard.resetLayout")}),children:m.map((w,S)=>{const M=gd(w,l);return f.jsxs("div",{className:"flex items-center gap-2 py-1",children:[f.jsx(wy,{className:ne("w-16 shrink-0 truncate",!w.enabled&&"opacity-50"),children:w.label}),f.jsx("span",{className:ne("min-w-0 flex-1 break-words text-tui",w.enabled?"text-tui-text":"text-tui-faint"),children:M}),f.jsx(ki,{label:`${l("virtualKeyboard.enableKey")} ${w.label}`,...h,checked:w.enabled,onChange:()=>p(w.id),className:"h-7 w-24 shrink-0"}),f.jsx(aa,{disabled:S===0,onClick:()=>g(S,"up"),title:l("virtualKeyboard.moveUp"),"aria-label":l("virtualKeyboard.moveUp"),children:"↑"}),f.jsx(aa,{disabled:S===m.length-1,onClick:()=>g(S,"down"),title:l("virtualKeyboard.moveDown"),"aria-label":l("virtualKeyboard.moveDown"),children:"↓"}),f.jsx(aa,{variant:"danger",onClick:()=>v(w.id),title:l("virtualKeyboard.deleteKeyTitle"),"aria-label":l("virtualKeyboard.deleteKeyTitle"),children:ke.cross})]},w.id)})}),f.jsx(Me,{block:!0,glyph:"+",onClick:()=>c(!r),className:ne("border-dashed",Li),children:l("virtualKeyboard.addKey")}),r&&f.jsx(bn,{title:l("virtualKeyboard.availableKeys"),children:f.jsx("div",{className:"flex flex-wrap gap-1 py-1.5",children:S1.map(w=>{const S=m.some(M=>M.id===w.id);return f.jsxs("button",{type:"button",onClick:()=>y(w),title:gd(w,l),className:ne("tui-focusable flex h-7 select-none items-center gap-1 border px-1.5 text-tui-sm transition-colors",S?"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:w.label}),f.jsx("span",{"aria-hidden":"true",className:S?"text-tui-ok":"text-tui-accent",children:S?ke.check:"+"})]},w.id)})})})]})},xM=({isOpen:a,onClose:n,initialTab:l,onOpenAdmin:o})=>{const{updateSettings:r,t:c,activeProfile:h}=Ee(),{addToast:m}=Xt(),[p,g]=T.useState("general"),[y,v]=T.useState(null);if(T.useEffect(()=>{!a||!l||(g(l),v(null))},[a,l]),!a)return null;const x=()=>{const w=$b();r({fontSize:w.fontSize,fontSizeFollowsHost:w.fontSizeFollowsHost,fontFamily:w.fontFamily,toolbarVisible:w.toolbarVisible,vibrateOnKeyPress:w.vibrateOnKeyPress,predictiveEcho:w.predictiveEcho,agentAlertBadge:w.agentAlertBadge,agentAlertSound:w.agentAlertSound,agentAlertVibrate:w.agentAlertVibrate,agentAlertNotify:w.agentAlertNotify,virtualKeys:w.virtualKeys}),m("info",c("settings.resetDefaultsToast"))};return f.jsxs(ul,{isOpen:a,onClose:n,title:c("settings.title"),subtitle:h?c("settings.subtitleInstance",{name:h.displayName}):c("settings.subtitle"),closeLabel:c("common.closeDialog"),size:"lg",fixedHeight:!0,hints:[{keys:"esc",action:c("common.close")}],footer:f.jsxs(f.Fragment,{children:[f.jsx(Me,{variant:"ghost",onClick:x,className:wr,children:c("settings.resetDefaults")}),f.jsx(Me,{variant:"primary",onClick:n,children:c("common.done")})]}),children:[f.jsx(Kd,{tabs:[{id:"general",label:c("settings.tabGeneral"),index:1},{id:"virtualKeys",label:c("settings.tabVirtualKeys"),index:2},{id:"agentKeymaps",label:c("settings.tabAgentKeymaps"),index:3}],activeId:p,onSelect:w=>g(w),className:"mb-3 border-b border-tui-border-dim pb-1"}),p==="general"&&f.jsx(yM,{onOpenAdmin:o}),p==="virtualKeys"&&f.jsx(vM,{}),p==="agentKeymaps"&&f.jsx(pM,{profile:y,onProfileChange:v})]})},wM={success:"ok",warning:"warn",error:"bad",info:"accent"},SM={success:ke.check,warning:ke.warn,error:ke.cross,info:"›"},CM=()=>{const{t:a}=Ee(),{toasts:n,removeToast:l}=Xt();return n.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:n.map(o=>{const r=wM[o.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",cn[r].edgeL),role:"alert",children:[f.jsx("span",{"aria-hidden":"true",className:ne("shrink-0 font-bold",cn[r].text),children:SM[o.type]}),f.jsx("div",{className:"min-w-0 flex-1 break-words leading-snug text-tui-text",children:o.message}),o.count>1&&f.jsxs("span",{className:"shrink-0 border border-tui-border-dim px-1 text-tui-sm text-tui-muted",children:["×",o.count]}),f.jsx("button",{type:"button",onClick:()=>l(o.id),className:"tui-focusable shrink-0 select-none px-0.5 text-tui-faint transition-colors hover:text-tui-bad","aria-label":a("common.dismissNotification"),children:f.jsx("span",{"aria-hidden":"true",children:ke.cross})})]},o.id)})})},a0=[{status:"blocked",level:"warn"},{status:"done",level:"ok"},{status:"working",level:"accent"}];function TM(a){return a?a.total>0||a0.some(({status:n})=>{var l;return(((l=a.counts)==null?void 0:l[n])??0)>0}):!1}const l0=({className:a,compact:n=!1})=>{const{t:l}=Ee(),{agentStatus:o}=et();if(!o)return null;const r=a0.map(({status:h,level:m})=>{var p;return{status:h,level:m,count:((p=o.counts)==null?void 0:p[h])??0}}).filter(h=>h.count>0),c=n?r.slice(0,1):r;return c.length===0?o.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:l("agents.title"),children:[f.jsx(dn,{level:"idle"}),f.jsx("span",{className:"text-tui-faint",children:l("agents.allIdle")})]}):f.jsx("span",{"data-testid":"agent-status-chip",className:ne("flex shrink-0 items-center gap-2 px-1",a),title:l("agents.title"),children:c.map(({status:h,level:m,count:p})=>f.jsxs("span",{className:"flex items-center gap-1 text-tui-muted",children:[f.jsx(dn,{level:m}),f.jsx("span",{className:"text-tui-text",children:p}),f.jsx("span",{className:"text-tui-faint",children:l(`agents.${h}`)})]},h))})},$d=({onAddProfile:a,mobile:n=!1,statusBar:l=!1})=>{const{profiles:o,activeProfileId:r,activeProfile:c,switchProfile:h,renameProfile:m,removeProfile:p,t:g}=Ee(),{connectionState:y}=et(),[v,x]=T.useState(!1),[w,S]=T.useState(null),[M,N]=T.useState(""),k=T.useRef(null);T.useEffect(()=>{if(!v)return;const _=z=>{k.current&&!k.current.contains(z.target)&&x(!1)};return document.addEventListener("pointerdown",_),()=>document.removeEventListener("pointerdown",_)},[v]);const E=(_,z)=>{S(_),N(z)},R=_=>{const z=M.trim();z&&m(_,z),S(null)},H=_=>{typeof window<"u"&&!window.confirm(g("profiles.removeConfirm"))||(p(_),S(null))},j=(c==null?void 0:c.displayName)||g("profiles.addHost"),D=y==="connected"?"ok":y==="connecting"||y==="reconnecting"?"warn":y==="error"?"bad":"idle";return f.jsxs("div",{ref:k,className:ne("relative min-w-0",n&&"w-full",l&&"flex-1",!n&&!l&&"h-full"),children:[f.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":v,"aria-label":g("profiles.switcherLabel"),onClick:()=>x(_=>!_),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",l?"min-h-11 w-full max-w-none px-2":n?"min-h-11 w-full px-2":"h-full max-w-[18rem] px-1"),children:[f.jsx(dn,{level:D}),f.jsx("span",{className:ne("truncate text-tui-text",l&&"min-w-0 flex-1"),children:j}),f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint",children:v?ke.chevronDown:ke.chevronRight})]}),v&&f.jsxs("div",{role:"menu","aria-label":g("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",l?"w-80 max-w-[calc(100vw-1rem)]":n?"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:g("profiles.title")}),o.length===0?f.jsx("p",{className:"px-2 py-2 text-tui-sm text-tui-muted",children:g("profiles.empty")}):o.map(_=>{const z=_.id===r,K=_.id===w;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":z?"true":void 0,onClick:()=>{h(_.id),x(!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",z?"text-tui-accent":"text-tui-text"),children:[f.jsx("span",{"aria-hidden":"true",className:"w-3 shrink-0",children:z?ke.cursor:""}),f.jsxs("span",{className:"min-w-0 flex-1",children:[f.jsx("span",{className:"block truncate font-bold",children:_.displayName}),f.jsx("span",{className:"block truncate text-tui-sm text-tui-faint",title:_.hostname||_.hostId,children:_.hostname||_.hostId||_.wsUrl})]}),z&&f.jsx("span",{className:"shrink-0 text-tui-sm text-tui-ok",children:g("profiles.current")})]}),f.jsx("button",{type:"button",role:"menuitem","aria-label":g("profiles.rename"),title:g("profiles.rename"),onClick:()=>E(_.id,_.displayName),className:"tui-focusable min-h-11 min-w-11 px-2 text-tui-muted hover:text-tui-accent",children:ke.ellipsis})]}),K&&f.jsxs("div",{className:"grid grid-cols-2 gap-1 px-2 pb-2",children:[f.jsx("input",{autoFocus:!0,value:M,maxLength:64,onChange:q=>N(q.target.value),onKeyDown:q=>{q.key==="Enter"&&R(_.id),q.key==="Escape"&&S(null)},"aria-label":g("profiles.rename"),className:"tui-input col-span-2 h-11 min-w-0 px-2 py-1 text-tui"}),f.jsx(Me,{onClick:()=>R(_.id),variant:"primary",className:"h-11 w-full min-w-0 whitespace-nowrap",children:g("common.save")}),f.jsx(Me,{onClick:()=>H(_.id),variant:"danger",className:"h-11 w-full min-w-0 whitespace-nowrap",children:g("profiles.remove")})]})]},_.id)}),f.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{x(!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:g("profiles.addHost")})]})]})]})},s0=({compact:a=!1,className:n})=>{const{settings:l,updateSettings:o,t:r}=Ee(),{connectionState:c,sharedWindowCount:h,assignedClientId:m}=et(),p=l.observerMode,g=f.jsx(wd,{name:"control-mode","aria-label":r("role.modeLabel"),value:p?"observe":"control",onChange:y=>o({observerMode:y==="observe"}),tone:p?"warn":"ok",size:a?"sm":"md",options:[{value:"control",label:r("role.sharedControl")},{value:"observe",label:r("common.viewer")}],className:n});return a?g:f.jsxs("div",{className:"flex w-full flex-col gap-1",children:[g,f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:r(p?"role.observerHint":"role.controlHint")}),c==="connected"&&h>1?f.jsx("p",{className:"text-tui-sm text-tui-muted",children:r("role.sharedWindows",{count:h})}):null,m?f.jsx(An,{label:r("role.thisWindow"),labelWidth:9,className:"text-tui-sm",children:f.jsx("span",{className:"truncate text-tui-muted",children:m})}):null]})};function o0(){const{updateStatus:a,ignoredUpdate:n,hostVersion:l}=et();return l===null||!!(a!=null&&a.updateAvailable)&&n!==(a==null?void 0:a.latest)}const MM="Get-CimInstance Win32_Process | Where-Object { $_.CommandLine -like '*node_modules\\herdr-remote*' } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force }",r0=({compact:a=!1,className:n})=>{const{t:l}=Ee(),{updateStatus:o}=et(),r=o0(),[c,h]=T.useState(!1);if(!r)return null;const m=o!=null&&o.updateAvailable?o:null,p=m?m.restartPending?l("update.chipRestart",{version:m.latest}):a?l("update.chipCompact",{version:m.latest}):l("update.chip",{version:m.latest}):l("update.chipOutdated");return f.jsxs(f.Fragment,{children:[f.jsx("button",{type:"button","data-testid":"update-chip",onClick:()=>h(!0),title:l("update.title"),className:ne("tui-focusable shrink-0 whitespace-nowrap px-1 text-tui-warn hover:underline",n),children:p}),f.jsx(AM,{isOpen:c,onClose:()=>h(!1)})]})},la=({command:a})=>{const{t:n}=Ee(),{addToast:l}=Xt();return f.jsxs("div",{className:"flex items-center gap-2 border border-tui-border bg-tui-mantle px-2 py-1",children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 select-none text-tui-ok",children:"$"}),f.jsx("code",{className:"min-w-0 flex-1 break-all text-tui-text",children:a}),f.jsx(Me,{glyph:"⧉",className:"shrink-0",onClick:()=>{Gd(a).then(o=>{l(o==="failed"?"error":"success",n(o==="failed"?"clipboard.copyFailed":"toasts.commandCopied"))})},children:n("common.copy")})]})},AM=({isOpen:a,onClose:n})=>{const{t:l}=Ee(),{updateStatus:o,ignoreUpdate:r,hostname:c,hostId:h,platform:m}=et();if(!(o!=null&&o.updateAvailable))return f.jsx(EM,{isOpen:a,onClose:n,host:c||h,win:m==="win32"});const{current:p,installed:g,latest:y,restartPending:v,updateCommand:x}=o;return f.jsx(ul,{isOpen:a,onClose:n,title:l("update.title"),closeLabel:l("common.closeDialog"),size:"md",footer:f.jsxs(f.Fragment,{children:[f.jsx(Me,{variant:"ghost",onClick:()=>{r(y),n()},children:l("update.ignore")}),f.jsx(Me,{variant:"primary",onClick:n,children:l("common.done")})]}),children:f.jsxs("div",{className:"space-y-3","data-testid":"update-modal",children:[f.jsxs("div",{className:"space-y-0.5",children:[f.jsx(An,{label:l("common.host"),labelWidth:10,children:c||h||"—"}),f.jsx(An,{label:l("update.running"),labelWidth:10,children:p}),g!==p?f.jsx(An,{label:l("update.installed"),labelWidth:10,children:g}):null,f.jsx(An,{label:l("update.latest"),labelWidth:10,children:f.jsx("span",{className:"text-tui-ok",children:y})})]}),v?f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"leading-snug text-tui-text",children:l("update.restartPending",{version:g})}),f.jsx(la,{command:"herdr-remote restart"})]}):f.jsxs(f.Fragment,{children:[f.jsxs("p",{className:"leading-snug text-tui-text",children:[f.jsx("span",{"aria-hidden":"true",className:"mr-1 text-tui-accent",children:ke.arrowRight}),l("update.stepTui")]}),f.jsx("p",{className:"leading-snug text-tui-muted",children:l("update.stepCli")}),x?f.jsx(la,{command:"herdr-remote update"}):f.jsxs(f.Fragment,{children:[f.jsx(la,{command:`npm install -g herdr-remote@${y} --prefer-online`}),f.jsx(la,{command:"herdr-remote restart"})]}),f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:l("update.restartNote")})]})]})})},EM=({isOpen:a,onClose:n,host:l,win:o})=>{const{t:r}=Ee();return f.jsx(ul,{isOpen:a,onClose:n,title:r("update.title"),closeLabel:r("common.closeDialog"),size:"md",footer:f.jsx(Me,{variant:"primary",onClick:n,children:r("common.done")}),children:f.jsxs("div",{className:"space-y-3","data-testid":"update-modal",children:[f.jsxs("div",{className:"space-y-0.5",children:[f.jsx(An,{label:r("common.host"),labelWidth:10,children:l||"—"}),f.jsx(An,{label:r("update.running"),labelWidth:10,children:f.jsx("span",{className:"text-tui-warn",children:r("update.outdatedVersion")})})]}),f.jsx("p",{className:"leading-snug text-tui-text",children:r("update.outdated")}),o?f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"leading-snug text-tui-muted",children:r("update.windowsStop")}),f.jsx(la,{command:MM})]}):null,f.jsx(la,{command:"npm install -g herdr-remote@latest --prefer-online"}),f.jsx(la,{command:"herdr-remote restart"}),f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:r("update.restartNote")})]})})},NM=({onAddProfile:a=()=>{}})=>{const{settings:n,t:l}=Ee(),{connectionState:o,hostId:r,assignedClientId:c,sharedWindowCount:h,rttMs:m,agentStatus:p}=et(),g=Ar(o,l),y=o==="connected",v=o0();return f.jsx(Sy,{left:f.jsxs(f.Fragment,{children:[f.jsx($d,{onAddProfile:a}),f.jsx(Sd,{items:[f.jsxs("span",{className:"flex items-center gap-1",children:[f.jsx(dn,{level:g.level}),f.jsx("span",{className:"text-tui-text",children:g.label})]},"status"),y?f.jsx(s0,{compact:!0,className:"h-full w-auto"},"role"):null,y&&h>1?f.jsx("span",{className:"text-tui-muted",children:l("role.sharedWindows",{count:h})},"windows"):null,r?f.jsxs("span",{children:[f.jsxs("span",{className:"text-tui-faint",children:[l("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:l("header.clientIdLabel")})," ",f.jsx("span",{className:"text-tui-text",children:c||n.clientId})]},"client")]})]}),right:f.jsx(Sd,{items:[v?f.jsx(r0,{},"update"):null,y&&TM(p)?f.jsx(l0,{},"agents"):null,m!==null?f.jsxs("span",{className:"text-tui-muted",children:[l("header.latencyTitle"),": ",f.jsxs("span",{className:"text-tui-text",children:[m,"ms"]})]},"rtt"):null,f.jsx("span",{className:"hidden text-tui-faint sm:inline",children:l("header.tagline")},"mode")]})})},kM=({wsUrl:a,adminUrl:n,onOpenRemoteAdmin:l,onSignIn:o})=>{const{t:r}=Ee();return f.jsxs(Nt,{title:r("admin.remoteRelayTitle"),bodyClassName:"space-y-2",children:[f.jsx("p",{className:"text-tui leading-snug text-tui-muted",children:r("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(An,{label:r("admin.remoteRelayEndpoint"),labelWidth:18,children:f.jsx("code",{className:"break-all text-tui-accent",children:a})}),f.jsx(An,{label:r("admin.remoteRelayAdminUrl"),labelWidth:18,children:f.jsx("code",{className:"break-all text-tui-ok",children:n})})]}),f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx(Me,{variant:"primary",onClick:l,glyph:ke.arrowRight,children:r("admin.openRemoteAdminBtn")}),f.jsx(Me,{onClick:o,children:r("admin.relayAdminLoginBtn")})]})]})},LM=({adminConfigured:a,isAuthError:n,tokenInput:l,onTokenInput:o,onSubmit:r,isSameOriginRelay:c,onBackToTerminal:h,showBack:m,onCancel:p})=>{const{t:g}=Ee();return f.jsxs(Nt,{title:g("admin.relayAdminTitle"),bodyClassName:"space-y-2",children:[a===!1?f.jsx(Ri,{tone:"warn",children:g("admin.relayAdminNotConfigured")}):n?f.jsx(Ri,{tone:"bad",children:g("admin.relayAdminAuthError")}):f.jsx(Ri,{tone:"accent",children:g("admin.relayAdminPrompt")}),f.jsxs("form",{onSubmit:r,className:"space-y-2",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(un,{htmlFor:"relay-admin-token",children:g("admin.relayAdminTokenLabel")}),f.jsx(xt,{id:"relay-admin-token",type:"password",autoComplete:"current-password",value:l,onChange:y=>o(y.target.value),placeholder:g("admin.relayAdminTokenPlaceholder")})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(Me,{variant:"primary",type:"submit",disabled:!l.trim(),children:g("admin.relayAdminLoginBtn")}),c?h&&!m?f.jsx(Me,{variant:"ghost",onClick:h,children:g("admin.returnToTerminal")}):null:f.jsx(Me,{variant:"ghost",onClick:p,children:g("common.cancel")})]})]})]})},_M=({onOpenPairing:a,onRetry:n})=>{const{t:l}=Ee(),{copied:o,copy:r}=Vd(),c=o!==null,h=()=>r(ia,l("toasts.commandCopied"));return f.jsxs(Nt,{title:l("admin.unauthorizedTitle"),tone:"bad",bodyClassName:"space-y-2",children:[f.jsx(Ri,{tone:"bad",children:l("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:l("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:ia}),f.jsx(Me,{onClick:h,glyph:c?ke.check:"⧉",className:ne("shrink-0",c&&"border-tui-ok text-tui-ok"),children:l(c?"admin.copiedJson":"common.copy")})]}),f.jsx("p",{className:"text-tui-sm text-tui-faint",children:l("admin.pairingStepsHelp")})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[a&&f.jsx(Me,{variant:"primary",onClick:a,children:l("admin.enterPairCodeBtn")}),f.jsx(Me,{onClick:n,children:l("admin.retryFetchBtn")})]})]})},RM=[[/\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"]],jM=[[/\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 ub(a,n){for(const[l,o]of a)if(l.test(n))return o;return null}function qd(a){const n=typeof a=="string"?a.trim():"";if(!n)return{label:"",raw:""};const l=ub(RM,n),o=ub(jM,n);return l&&o?{label:`${l} · ${o}`,raw:n}:l?{label:l,raw:n}:o?{label:o,raw:n}:{label:n.length>32?`${n.slice(0,32)}…`:n,raw:n}}function tl(a){if(!a||a<=0)return"0 B";const n=1024,l=["B","KB","MB","GB","TB"],o=Math.min(l.length-1,Math.floor(Math.log(a)/Math.log(n)));return`${(a/n**o).toFixed(1)} ${l[o]}`}function db(a,n,l=!1){const o=Math.max(0,Math.floor(a)),r=Math.floor(o/86400),c=Math.floor(o%86400/3600),h=Math.floor(o%3600/60),m=o%60,p=(y,v)=>`${y}${n(`admin.unit${v}`)}`,g=r>0?[p(r,"Day"),p(c,"Hour"),p(h,"Minute")]:c>0?[p(c,"Hour"),p(h,"Minute"),p(m,"Second")]:[p(h,"Minute"),p(m,"Second")];return(l?g.slice(0,2):g).join(" ")}function Xd(a,n,l=Date.now()){if(!a)return"—";const o=new Date(a).getTime();if(Number.isNaN(o))return"—";const r=Math.max(0,Math.floor((l-o)/1e3));return r<60?n("admin.relJustNow"):r<3600?n("admin.relMinutes",{count:Math.floor(r/60)}):r<86400?n("admin.relHours",{count:Math.floor(r/3600)}):n("admin.relDays",{count:Math.floor(r/86400)})}function Zd(a){if(!a)return"";const n=new Date(a);return Number.isNaN(n.getTime())?"":n.toLocaleString()}function c0(a=[]){const n=new Map;for(const l of a)l.deviceId&&n.set(l.deviceId,(n.get(l.deviceId)||0)+1);return n}const OM=({clients:a})=>{const{t:n}=Ee(),l=a.some(r=>r.hostId),o=[{key:"id",header:n("admin.colClientId"),render:r=>f.jsxs("span",{className:"flex items-center gap-1.5",children:[f.jsx(dn,{level:"ok"}),f.jsx("span",{className:"font-bold text-tui-text",children:r.id})]})},...l?[{key:"host",header:n("admin.colHost"),render:r=>f.jsx("span",{className:"text-tui-text",children:r.hostId||"—"})}]:[],{key:"role",header:n("admin.colRole"),width:10,render:r=>{const c=r.role==="controller";return f.jsx(vy,{tone:c?"ok":"warn",className:"text-tui-sm",children:n(c?"common.controller":"common.viewer")})}},{key:"device",header:n("admin.colDevice"),render:r=>{const c=qd(r.userAgent);return f.jsxs("span",{className:"flex min-w-0 items-baseline gap-1.5",children:[f.jsx("span",{className:c.label?"text-tui-text":"text-tui-faint",title:c.raw,children:c.label||n("admin.unknownDevice")}),r.deviceId?f.jsx("code",{className:"text-tui-sm text-tui-faint",children:r.deviceId}):null]})}},{key:"ip",header:n("admin.colIp"),render:r=>f.jsx("span",{className:"text-tui-muted",children:r.ip||"127.0.0.1"})},{key:"connectedAt",header:n("admin.colConnectedAt"),render:r=>f.jsx("span",{className:"whitespace-nowrap text-tui-muted",title:Zd(r.connectedAt),children:r.connectedAt?Xd(r.connectedAt,n):n("admin.startedRecently")})},{key:"traffic",header:n("admin.colTraffic"),align:"right",render:r=>f.jsxs("span",{className:"whitespace-nowrap",children:[f.jsxs("span",{className:"text-tui-accent",children:["↓",tl(r.bytesReceived||0)]}),f.jsx("span",{"aria-hidden":"true",className:"mx-1 text-tui-faint",children:"/"}),f.jsxs("span",{className:"text-tui-ok",children:["↑",tl(r.bytesSent||0)]})]})}];return f.jsx(Nt,{title:n("admin.connectedClientsTitle",{count:a.length}),bodyClassName:"-mx-1",children:f.jsx(Id,{columns:o,items:a,rowKey:r=>r.id,empty:n("admin.noClients")})})},DM=({devices:a,clients:n,onRevoke:l})=>{const{t:o}=Ee(),[r,c]=T.useState(null),[h,m]=T.useState(null),p=c0(n),g=[...a].sort((x,w)=>{const S=+!!p.get(w.deviceId)-+!!p.get(x.deviceId);return S||(Date.parse(w.lastSeenAt)||0)-(Date.parse(x.lastSeenAt)||0)}),y=async x=>{if(r!==x){c(x);return}m(x);try{await l(x)}finally{m(null),c(null)}},v=[{key:"status",header:o("admin.colStatus"),width:12,render:x=>{const w=p.get(x.deviceId)||0;return f.jsxs("span",{className:ne("flex items-center gap-1.5 whitespace-nowrap",w?"text-tui-ok":"text-tui-faint"),children:[f.jsx(dn,{level:w?"ok":"idle"}),o(w?"admin.hostStatusOnline":"admin.hostStatusOffline")]})}},{key:"device",header:o("admin.colDevice"),render:x=>{const w=qd(x.userAgent);return f.jsxs("span",{className:"flex min-w-0 items-baseline gap-1.5",children:[f.jsx("span",{className:"text-tui-text",title:w.raw,children:w.label||o("admin.unknownDevice")}),f.jsx("code",{className:"text-tui-sm text-tui-faint",children:x.deviceId})]})}},{key:"host",header:o("admin.colHost"),render:x=>f.jsx("span",{className:"text-tui-text",children:x.hostId||"—"})},{key:"ip",header:o("admin.colIp"),render:x=>f.jsx("span",{className:"text-tui-muted",children:x.lastIp||"—"})},{key:"lastSeen",header:o("admin.colLastSeen"),render:x=>{const w=p.get(x.deviceId)||0;return f.jsx("span",{className:ne("whitespace-nowrap",w?"text-tui-ok":"text-tui-muted"),title:Zd(x.lastSeenAt),children:w?o("admin.deviceWindows",{count:w}):Xd(x.lastSeenAt,o)})}},{key:"actions",header:o("admin.colActions"),align:"right",render:x=>{const w=r===x.deviceId,S=h===x.deviceId;return f.jsx(Me,{variant:"danger",disabled:S,onClick:()=>void y(x.deviceId),onBlur:()=>c(M=>M===x.deviceId?null:M),"aria-label":o("admin.revokeDevice"),className:ne("h-6 py-0 text-tui-sm",w&&"bg-tui-bad text-tui-crust"),children:S?f.jsx(sa,{}):o(w?"admin.revokeConfirm":"admin.revokeDevice")})}}];return f.jsx(Nt,{title:o("admin.pairedDevicesTitle",{count:a.length}),bodyClassName:"-mx-1",children:f.jsx(Id,{columns:v,items:g,rowKey:x=>x.deviceId,empty:o("admin.noDevices")})})},fb={online:"ok",busy:"ok",reconnecting:"warn",offline:"idle"};function zM(a=[],n=[]){const l=new Map;for(const c of n){if(!(c!=null&&c.hostId))continue;const h=l.get(c.hostId);h?h.push(c):l.set(c.hostId,[c])}const o=a.map(c=>{const h=l.get(c.id)||[];return{id:c.id,hostname:c.hostname||c.id,status:c.status||"online",connectedDeviceCount:c.connectedDeviceCount??0,pairedDeviceCount:c.pairedDeviceCount??h.length,activePtyCount:c.activePtyCount??0,version:c.version,latestVersion:c.latestVersion,devices:h,fromRosterOnly:!1}}),r=new Set(o.map(c=>c.id));for(const[c,h]of l)r.has(c)||o.push({id:c,hostname:c,status:"offline",connectedDeviceCount:0,pairedDeviceCount:h.length,activePtyCount:0,devices:h,fromRosterOnly:!0});return o.sort((c,h)=>c.fromRosterOnly!==h.fromRosterOnly?c.fromRosterOnly?1:-1:c.hostname.localeCompare(h.hostname))}const HM=({hosts:a,devices:n,clients:l})=>{const{t:o}=Ee(),r=zM(a,n),c=c0(l),h={online:o("admin.hostStatusOnline"),busy:o("admin.hostStatusBusy"),reconnecting:o("admin.hostStatusReconnecting"),offline:o("admin.hostStatusOffline")};return f.jsx(Nt,{title:o("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:o("admin.noHosts")}):r.map(m=>f.jsxs("div",{className:"border border-tui-border-dim bg-tui-mantle",children:[f.jsxs("div",{className:"flex flex-wrap items-center 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 flex-auto items-center gap-1.5 text-tui",children:[f.jsx(dn,{level:fb[m.status]}),f.jsx("span",{className:"truncate font-bold text-tui-text",children:m.hostname}),m.hostname!==m.id?f.jsx("code",{className:"truncate text-tui-sm text-tui-faint",children:m.id}):null,f.jsx(vy,{tone:fb[m.status],className:"ml-1 text-tui-sm",children:h[m.status]})]}),f.jsx(Sd,{className:"shrink-0 text-tui-sm",items:[f.jsx("span",{className:m.connectedDeviceCount?"text-tui-ok":"text-tui-faint",children:o("admin.hostConnectedDevices",{count:m.connectedDeviceCount})},"connected"),f.jsx("span",{className:"text-tui-muted",children:o("admin.hostPairedDevices",{count:m.pairedDeviceCount})},"paired"),m.version===void 0?null:f.jsx("span",{className:m.version&&!m.latestVersion?"text-tui-muted":"text-tui-warn",children:m.version?m.latestVersion?o("admin.hostVersionBehind",{version:m.version,latest:m.latestVersion}):o("admin.hostVersion",{version:m.version}):o("admin.hostVersionUnknown")},"version"),m.fromRosterOnly?null:f.jsx("span",{className:m.activePtyCount?"text-tui-info":"text-tui-faint",children:o("admin.hostPtys",{count:m.activePtyCount})},"ptys")]})]}),m.devices.length>0?f.jsx("ul",{className:"divide-y divide-tui-border-dim",children:m.devices.map(p=>{const g=qd(p.userAgent),y=c.get(p.deviceId)||0;return f.jsxs("li",{className:"grid grid-cols-[1ch_minmax(0,1fr)_auto] items-baseline gap-x-2 px-2 py-0.5 text-tui sm:grid-cols-[1ch_minmax(0,18ch)_minmax(0,1fr)_16ch_16ch]",children:[f.jsx(dn,{level:y?"ok":"idle"}),f.jsx("span",{className:"truncate text-tui-text",title:g.raw,children:g.label||o("admin.unknownDevice")}),f.jsx("code",{className:"hidden truncate text-tui-sm text-tui-faint sm:block",children:p.deviceId}),f.jsx("span",{className:"hidden truncate text-tui-sm text-tui-muted sm:block",children:p.lastIp||"—"}),f.jsx("span",{className:ne("whitespace-nowrap text-right text-tui-sm",y?"text-tui-ok":"text-tui-faint"),title:Zd(p.lastSeenAt),children:y?o("admin.deviceWindows",{count:y}):Xd(p.lastSeenAt,o)})]},p.deviceId)})}):f.jsx("p",{className:"px-2 py-1 text-tui-sm text-tui-faint",children:m.pairedDeviceCount>0?o("admin.hostRosterOperatorOnly"):o("admin.noDevices")})]},m.id))})},BM=({data:a})=>{var r,c,h,m,p,g,y,v,x,w;const{t:n}=Ee(),l=a.activeUserCount??((r=a.clients)==null?void 0:r.length)??0,o=new Set((a.devices||[]).map(S=>S.hostId).filter(S=>S&&!(a.hosts||[]).some(M=>M.id===S))).size;return f.jsxs("div",{className:"space-y-3",children:[f.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3 xl:grid-cols-6",children:[f.jsx(Xa,{label:n("admin.connectedHosts"),value:((c=a.hosts)==null?void 0:c.length)||0,sub:o?n("admin.hostsOfflineSub",{count:o}):void 0,tone:(h=a.hosts)!=null&&h.length?"ok":"idle"}),f.jsx(Xa,{label:n("admin.activeUsers"),value:l,sub:n("admin.acrossWindows",{count:((m=a.clients)==null?void 0:m.length)||0}),tone:l?"accent":"idle"}),f.jsx(Xa,{label:n("admin.activePtys"),value:((p=a.ptys)==null?void 0:p.length)||0,sub:n("admin.terminalShells"),tone:(g=a.ptys)!=null&&g.length?"info":"idle"}),f.jsx(Xa,{label:n("admin.statInbound"),value:n("admin.perSecond",{value:tl(((y=a.throughput)==null?void 0:y.bytesInPerSec)||0)}),sub:n("admin.statTotal",{value:tl(((v=a.throughput)==null?void 0:v.bytesIn)||0)}),tone:"accent"}),f.jsx(Xa,{label:n("admin.statOutbound"),value:n("admin.perSecond",{value:tl(((x=a.throughput)==null?void 0:x.bytesOutPerSec)||0)}),sub:n("admin.statTotal",{value:tl(((w=a.throughput)==null?void 0:w.bytesOut)||0)}),tone:"ok"}),f.jsx(Xa,{label:n("admin.uptime"),value:db(a.uptimeSeconds||0,n,!0),title:db(a.uptimeSeconds||0,n),sub:a.startTime?n("admin.startedAt",{time:new Date(a.startTime).toLocaleTimeString()}):n("admin.startedRecently")})]}),f.jsx(HM,{hosts:a.hosts||[],devices:a.devices,clients:a.clients||[]})]})},UM=({ptys:a})=>{const{t:n}=Ee(),l=a.some(r=>r.hostId),o=[{key:"id",header:n("admin.colPtyId"),render:r=>f.jsx("span",{className:"font-bold text-tui-accent",children:r.id})},...l?[{key:"host",header:n("admin.colHost"),render:r=>f.jsx("span",{className:"text-tui-text",children:r.hostId})}]:[],{key:"pid",header:n("admin.colPid"),width:9,render:r=>f.jsx("span",{className:"text-tui-muted",children:r.pid})},{key:"command",header:n("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:n("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:n("admin.colCwd"),className:"max-w-xs truncate",render:r=>f.jsx("span",{className:"text-tui-muted",children:r.cwd||"~"})},{key:"viewers",header:n("admin.colViewers"),align:"right",width:9,render:r=>f.jsx("span",{className:"font-bold text-tui-ok",children:r.activeClients})}];return f.jsx(Nt,{title:n("admin.activePtysTitle",{count:a.length}),bodyClassName:"-mx-1",children:f.jsx(Id,{columns:o,items:a,rowKey:r=>r.id,empty:n("admin.noPtys")})})};function _d(a){if(typeof window>"u"||!a||a.startsWith("/"))return"";try{const n=new URL(a.replace(/^ws/,"http")),l=n.pathname.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"");return n.origin===window.location.origin&&!l?"":`${n.origin}${l}`}catch{return""}}function Cs(a,n){const l=_d(a);return l?`${l}${n.startsWith("/")?n:`/${n}`}`:n}async function KM(a){try{const l=await fetch(Cs(a,"/api/info"),{headers:{Accept:"application/json"}});if(l.ok)return await l.json()}catch{}return{ok:!0,version:"0.1.0",protocol:1,relayMode:!!(a&&!a.startsWith("/")&&!a.includes("localhost")&&!a.includes("127.0.0.1")&&typeof window<"u"&&!a.startsWith(window.location.origin.replace("http","ws")))?"remote":"local",adminConfigured:!1,adminPath:"/admin",adminStatusPath:"/api/admin/status"}}async function hb(a,n){const l=await fetch(a,{headers:{Accept:"application/json",...n}});if(l.status===401||l.status===403)return{kind:"denied",status:l.status};if(!l.ok)throw new Error(`HTTP ${l.status}: ${l.statusText}`);return{kind:"ok",data:await l.json()}}async function IM(a,n,l){return(await fetch(Cs(a,`/api/admin/devices/${encodeURIComponent(l)}`),{method:"DELETE",headers:{Accept:"application/json","X-Relay-Admin-Token":n}})).ok}function FM(a,n,l){return a!=null&&a.adminPath?a.publicUrl?`${a.publicUrl.replace(/\/$/,"")}${a.adminPath}`:Cs(l,a.adminPath):n!=null&&n.remoteAdminUrl?n.remoteAdminUrl:l?Cs(l,"/admin"):"/admin"}function GM({wsUrl:a,deviceToken:n,adminToken:l,relayOrigin:o,refreshInterval:r,t:c}){const[h,m]=T.useState(null),[p,g]=T.useState(null),[y,v]=T.useState(!1),[x,w]=T.useState(!0),[S,M]=T.useState(null),[N,k]=T.useState(!1),[E,R]=T.useState(null);T.useEffect(()=>{m(null),g(null),v(!1)},[o]),T.useEffect(()=>{let K=!0;return w(!0),KM(a).then(q=>{K&&(g(q),v(!0))}),()=>{K=!1}},[a,o]);const H=(p==null?void 0:p.relayMode)==="remote",j=T.useCallback((K,q)=>{if(K.kind==="denied"){k(!0),M(q),m(null);return}m(K.data),M(null),k(!1),R(new Date)},[]),D=T.useCallback((K,q)=>{k(!1),M(K instanceof Error?K.message:q),m(null)},[]),_=T.useCallback(async()=>{if(y){if(H){if(!l){m(null),w(!1),M(null),k(!1);return}try{w(!0);const K=await hb(Cs(a,(p==null?void 0:p.adminStatusPath)||"/api/admin/status"),{"X-Relay-Admin-Token":l});j(K,c("admin.relayAdminAuthError"))}catch(K){console.warn("GET /api/admin/status request failed:",K),D(K,"Failed to fetch remote admin status")}finally{w(!1)}return}try{w(!0);const K=await hb("/api/status",n?{Authorization:`Bearer ${n}`}:{});j(K,K.kind==="denied"?`Authentication failed (HTTP ${K.status}): Access denied. Please configure an authorized token or pair with the host.`:"")}catch(K){console.warn("GET /api/status request failed:",K),D(K,"Failed to fetch status")}finally{w(!1)}}},[y,H,l,p,n,a,o,c]),z=T.useCallback(async K=>{try{if(!await IM(a,l,K)){M(c("admin.revokeFailed"));return}await _()}catch{M(c("admin.revokeFailed"))}},[l,_,a,c]);return T.useEffect(()=>{if(!y)return;_();let K=null;const q=()=>{r>0&&!K&&(K=setInterval(()=>{document.visibilityState==="visible"&&_()},r))},te=()=>{K&&(clearInterval(K),K=null)},Z=()=>{document.visibilityState==="visible"?(_(),q()):te()};return q(),document.addEventListener("visibilitychange",Z),()=>{te(),document.removeEventListener("visibilitychange",Z)}},[y,_,r]),{data:h,relayInfo:p,infoLoaded:y,isRemoteRelay:H,loading:x,error:S,isAuthError:N,lastUpdated:E,fetchStatus:_,revokeDevice:z}}const cd="h-7 py-0",YM=({onBackToTerminal:a,onOpenPairing:n,showBack:l=!1})=>{var ye,ue,Te;const{settings:o,updateSettings:r,t:c}=Ee(),h=_d(o.wsUrl)||(typeof window<"u"?window.location.origin:"local"),m=((ye=o.adminTokens)==null?void 0:ye[h])||(h===(typeof window<"u"?window.location.origin:"local")?o.adminToken:"")||"",[p,g]=T.useState(3e3),[y,v]=T.useState("overview"),[x,w]=T.useState(m),[S,M]=T.useState(m),[N,k]=T.useState(!!m),E=!_d(o.wsUrl);T.useEffect(()=>{w(m),M(m),k(!!m)},[h]);const{data:R,relayInfo:H,infoLoaded:j,isRemoteRelay:D,loading:_,error:z,isAuthError:K,lastUpdated:q,fetchStatus:te,revokeDevice:Z}=GM({wsUrl:o.wsUrl,deviceToken:o.token,adminToken:S,relayOrigin:h,refreshInterval:p,t:c}),ie=ce=>{ce.preventDefault();const be=x.trim();r({adminToken:be,adminTokens:{...o.adminTokens||{},[h]:be}}),M(be),k(!!be)},re=FM(H,R,o.wsUrl),P=R?[{id:"overview",label:c("admin.tabOverview"),index:1},{id:"clients",label:c("admin.tabClients",{count:((ue=R.clients)==null?void 0:ue.length)||0}),index:2},{id:"ptys",label:c("admin.tabPtys",{count:((Te=R.ptys)==null?void 0:Te.length)||0}),index:3},...R.devices?[{id:"devices",label:c("admin.tabDevices",{count:R.devices.length}),index:4}]:[]]:[],A=P.map(ce=>ce.id).join("|");T.useEffect(()=>{const ce=A?A.split("|"):[],be=ae=>{if(ae.ctrlKey||ae.altKey||ae.metaKey)return;const we=ae.target;if(we instanceof HTMLInputElement||we instanceof HTMLTextAreaElement||we instanceof HTMLSelectElement||we!=null&&we.isContentEditable||document.querySelector('[role="dialog"]'))return;if(ae.key==="Escape"&&a){ae.preventDefault(),a();return}if(ae.key.toLowerCase()==="r"){ae.preventDefault(),te();return}const le=Number.parseInt(ae.key,10)-1;Number.isInteger(le)&&le>=0&&le<ce.length&&(ae.preventDefault(),v(ce[le]))};return window.addEventListener("keydown",be),()=>window.removeEventListener("keydown",be)},[te,a,A]);const G=(H==null?void 0:H.version)||(R==null?void 0:R.version)||"0.1.0",W=l&&a?f.jsx(Me,{variant:"ghost",onClick:a,title:c("admin.returnToTerminal"),"aria-label":c("admin.returnToTerminal"),glyph:ke.arrowLeft,brackets:!1,className:cd,children:f.jsx("span",{className:"sr-only",children:c("admin.returnToTerminal")})}):null,se=f.jsxs(f.Fragment,{children:[f.jsxs("span",{className:"hidden items-center gap-1.5 whitespace-nowrap text-tui-sm sm:flex",children:[f.jsxs("span",{className:"text-tui-faint",children:["v",G]}),f.jsx(Ud,{}),f.jsx("span",{className:D?"text-tui-alt":"text-tui-ok",children:c(D?"admin.modeRemote":"admin.localWorkstationBadge")})]}),R?f.jsxs(f.Fragment,{children:[f.jsxs("label",{className:"hidden items-center gap-1.5 text-tui-sm text-tui-muted md:flex",children:[f.jsx("span",{children:c("admin.autoRefresh")}),f.jsxs(Tr,{value:p,onChange:ce=>g(Number(ce.target.value)),"aria-label":c("admin.autoRefresh"),className:ne("w-auto",cd),children:[f.jsx("option",{value:0,children:c("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(Me,{variant:"primary",onClick:te,disabled:_,title:c("admin.refreshNow"),className:cd,children:_?f.jsx(sa,{}):c("admin.refreshNow")})]}):null]}),Q=j&&D&&!N&&!E,ge=j&&D&&(N||E)&&!R;return f.jsxs($S,{tabs:P,activeTabId:y,onSelectTab:ce=>v(ce),tabsAriaLabel:c("header.mainNavigationAria"),toolbarStart:W,toolbarAside:se,hints:[...R?[{keys:"1–4",action:c("admin.hintTabs")},{keys:"r",action:c("admin.hintRefresh")}]:[],...a?[{keys:"esc",action:c("admin.hintBack")}]:[]],footerAside:q?f.jsx("span",{className:"text-tui-faint",children:c("admin.updatedAt",{time:q.toLocaleTimeString()})}):null,bodyClassName:"space-y-3 pb-2",children:[!j&&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(sa,{label:c("admin.loadingStatus")})}),Q&&f.jsx(kM,{wsUrl:o.wsUrl,adminUrl:re,onOpenRemoteAdmin:()=>window.open(re,"_blank","noopener,noreferrer"),onSignIn:()=>k(!0)}),ge&&f.jsx(LM,{adminConfigured:H==null?void 0:H.adminConfigured,isAuthError:K,tokenInput:x,onTokenInput:w,onSubmit:ie,isSameOriginRelay:E,onBackToTerminal:a,showBack:l,onCancel:()=>k(!1)}),j&&!D&&K&&f.jsx(_M,{onOpenPairing:n,onRetry:te}),j&&z&&!K&&f.jsx(Ri,{tone:"warn",action:f.jsx(Me,{variant:"warn",onClick:te,children:c("common.retry")}),children:c("admin.errorConnecting",{error:z})}),R&&f.jsxs(f.Fragment,{children:[y==="overview"&&f.jsx(BM,{data:R}),y==="clients"&&f.jsx(OM,{clients:R.clients||[]}),y==="ptys"&&f.jsx(UM,{ptys:R.ptys||[]}),y==="devices"&&f.jsx(DM,{devices:R.devices||[],clients:R.clients||[],onRevoke:Z})]})]})},ir="tui-focusable group flex h-11 w-full select-none items-center gap-2 border px-2 text-left text-tui transition-colors",ar="border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",PM="border-tui-accent bg-tui-selection text-tui-accent",lr=({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:ke.cursor}),VM=({onClose:a,onOpenPairing:n,onOpenSettings:l,onAddProfile:o=()=>{}})=>{const{settings:r,updateSettings:c,language:h,setLanguage:m,t:p}=Ee(),{connectionState:g,stateDetail:y,rttMs:v,hostId:x,connect:w}=et(),{addToast:S}=Xt(),{copied:M,copy:N}=Vd(),k=M!==null,E=Ar(g,p),R=D=>()=>{var z;const _=document.activeElement;(z=_==null?void 0:_.blur)==null||z.call(_),D()},H=()=>N(r.clientId,p("toasts.clientIdCopied",{id:r.clientId}),"info"),j=()=>{const D=h==="zh"?"en":"zh";m(D),S("info",Rd(D,"toasts.switchedLanguage",{lang:D==="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:p("mobile.sessionControls")}),f.jsx(Me,{variant:"ghost",onClick:a,"aria-label":p("mobile.closeSessionControls"),children:"esc"})]}),f.jsx(Nt,{title:p("profiles.title"),tone:"accent",bodyClassName:"space-y-1",children:f.jsx($d,{mobile:!0,onAddProfile:o})}),f.jsxs(Nt,{title:p("common.status"),tone:E.level==="ok"?"ok":E.level==="bad"?"bad":"warn",bodyClassName:"space-y-1.5",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[f.jsx(dn,{level:E.level}),f.jsx("span",{className:"truncate text-tui uppercase text-tui-text",children:E.label}),g==="connected"&&v!==null&&f.jsxs("span",{className:"text-tui-sm text-tui-muted",children:[v,"ms"]})]}),E.actionLabel&&f.jsx(Me,{variant:"primary",onClick:()=>w(),className:"shrink-0",children:E.actionLabel})]}),E.needsAttention&&y&&f.jsx("p",{className:"text-tui-sm leading-snug text-tui-muted",children:y}),x&&f.jsx(An,{label:p("common.host"),labelWidth:9,children:x}),f.jsxs("button",{type:"button",onClick:H,className:"tui-focusable flex w-full items-baseline gap-2 text-left text-tui",title:p("header.copyClientIdTitle"),children:[f.jsx("span",{className:"shrink-0 text-tui-muted",style:{width:"9ch"},children:p("header.clientIdLabel")}),f.jsx("span",{className:"min-w-0 flex-1 truncate text-tui-text",children:r.clientId}),f.jsx("span",{"aria-hidden":"true",className:ne("shrink-0",k?"text-tui-ok":"text-tui-faint"),children:k?ke.check:"⧉"})]})]}),f.jsx(Nt,{title:p("mobile.inputControl"),tone:"accent","aria-label":p("mobile.terminalControlAria"),children:f.jsx(s0,{className:"h-11"})}),f.jsxs(Nt,{title:p("mobile.menu"),tone:"accent",bodyClassName:"flex flex-col gap-1",children:[f.jsxs("button",{type:"button",onClick:j,className:ne(ir,ar),"aria-label":p("header.languageToggleTitle"),children:[f.jsx(lr,{}),f.jsx("span",{className:"truncate",children:h==="zh"?"English":"中文"})]}),f.jsxs("button",{type:"button",onClick:R(l),className:ne(ir,ar),"aria-label":p("mobile.settingsAria"),children:[f.jsx(lr,{}),f.jsx("span",{className:"truncate",children:p("common.settings")})]}),f.jsxs("button",{type:"button",onClick:R(n),className:ne(ir,ar),"aria-label":p("mobile.pairingAria"),children:[f.jsx(lr,{}),f.jsx("span",{className:"truncate",children:p("common.pairing")})]}),f.jsxs("button",{type:"button",onClick:()=>c({toolbarVisible:!r.toolbarVisible}),className:ne(ir,r.toolbarVisible?PM:ar),"aria-label":p("mobile.keybarAria"),"aria-pressed":r.toolbarVisible,children:[f.jsx(lr,{active:r.toolbarVisible}),f.jsx("span",{className:"truncate",children:p("common.keyBar")}),f.jsx("span",{"aria-hidden":"true",className:"ml-auto shrink-0 text-tui-sm",children:r.toolbarVisible?"[x]":"[ ]"})]})]})]})},$M=({onAddProfile:a})=>{const{t:n}=Ee(),{rttMs:l}=et();return f.jsxs("footer",{"data-testid":"mobile-status-bar",role:"status","aria-label":n("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($d,{statusBar:!0,onAddProfile:a}),f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-border",children:"│"}),f.jsx(l0,{compact:!0}),f.jsx(r0,{compact:!0}),f.jsxs("span",{className:"flex shrink-0 items-center gap-1 px-1 text-tui-muted",title:n("header.latencyTitle"),children:[f.jsx("span",{className:"text-tui-faint",children:"RTT"}),f.jsx("span",{className:ne(l===null?"text-tui-faint":"text-tui-text"),children:l===null?"—":`${l}ms`})]})]})},qM=({onOpenPairing:a,onOpenSettings:n,onAddProfile:l=()=>{}})=>{const{t:o}=Ee(),{connectionState:r,isController:c}=et(),[h,m]=T.useState(!1),p=T.useRef(null),g=T.useCallback(()=>m(!1),[]);T.useEffect(()=>{if(!h)return;const v=x=>{if(!(x.ctrlKey||x.altKey||x.metaKey)&&x.key==="Escape"){const w=x.target;w&&typeof w.closest=="function"&&!!w.closest("#terminal-container")||(x.stopPropagation(),x.preventDefault(),g())}};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[h,g]),T.useEffect(()=>{var v;h&&((v=p.current)==null||v.focus({preventScroll:!0}))},[h]);const y=Ar(r,o);return f.jsxs(f.Fragment,{children:[f.jsxs("div",{"data-testid":"mobile-topbar",role:"toolbar","aria-label":o("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(Ud,{className:"shrink-0"}),f.jsx(dn,{level:y.level}),f.jsx("span",{className:"truncate uppercase",children:y.label})]}),f.jsxs("button",{type:"button","data-testid":"mobile-chrome-trigger",onClick:()=>m(!0),"aria-label":o("mobile.sessionControls"),"aria-expanded":h,"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",y.needsAttention?"border-tui-warn text-tui-warn":c?"border-tui-border text-tui-muted":"border-tui-accent text-tui-accent"),children:[!c&&!y.needsAttention&&f.jsx("span",{className:"max-w-[8rem] truncate",children:o("common.viewer")}),f.jsx("span",{"aria-hidden":"true",className:"text-tui",children:ke.chevronDown}),f.jsx("span",{"aria-hidden":"true",children:o("mobile.menu")})]})]}),h&&f.jsxs(f.Fragment,{children:[f.jsx("div",{"data-testid":"mobile-sheet-scrim",className:"absolute inset-0 z-40 bg-tui-crust/70",onClick:g,"aria-hidden":"true"}),f.jsx("div",{ref:p,"data-testid":"mobile-control-sheet",role:"dialog","aria-modal":"true","aria-label":o("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(VM,{onClose:g,onOpenPairing:()=>{g(),a()},onOpenSettings:()=>{g(),n()},onAddProfile:()=>{g(),l()}})})]}),f.jsx($M,{onAddProfile:l})]})},XM=()=>{const{activeProfile:a,t:n}=Ee(),{herdrLaunch:l,startHerdr:o,hostname:r}=et();if(!l)return null;const c=r||(a==null?void 0:a.displayName)||n("herdrLaunch.thisHost"),h=l.phase==="failed";return f.jsx("div",{"data-testid":"herdr-start-prompt",className:"absolute inset-0 z-30 flex items-center justify-center bg-tui-crust/85 p-3",children:f.jsx(Nt,{title:n(h?"herdrLaunch.failedTitle":"herdrLaunch.title"),tone:h?"bad":"warn",className:"w-full max-w-md",bodyClassName:"space-y-3","aria-label":n("herdrLaunch.title"),children:l.phase==="starting"?f.jsxs("p",{className:"flex items-center gap-2 text-tui-text",role:"status",children:[f.jsx(sa,{}),f.jsx("span",{children:n("herdrLaunch.starting",{host:c})})]}):f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"leading-snug text-tui-text",children:n("herdrLaunch.body",{host:c})}),h&&l.message?f.jsx(Ri,{tone:"bad",children:f.jsx("pre",{className:"max-h-40 overflow-y-auto whitespace-pre-wrap break-words font-mono text-tui-sm",children:l.message})}):null,f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:n("herdrLaunch.scope")}),f.jsx("div",{className:"flex justify-end",children:f.jsx(Me,{variant:"primary",onClick:o,autoFocus:!0,children:n(h?"common.retry":"herdrLaunch.start")})})]})})})},u0="--app-height",d0="--keyboard-inset",ZM=80;function WM(){if(typeof window>"u")return{height:768,keyboardInset:0};const a=window.innerHeight||768,n=window.visualViewport;if(n&&typeof n.height=="number"&&n.height>0){const l=a-n.height-(n.offsetTop||0),o=l>=ZM?Math.round(l):0;return{height:Math.round(n.height),keyboardInset:o}}return{height:a,keyboardInset:0}}function mb(a,n=WM()){return a.style.setProperty(u0,`${n.height}px`),a.style.setProperty(d0,`${n.keyboardInset}px`),n}function QM(a=typeof document<"u"?document.documentElement:null){if(!a||typeof window>"u")return()=>{};let n=null;const l=()=>{n=null,mb(a)},o=()=>{if(n===null){if(typeof requestAnimationFrame!="function"){l();return}n=requestAnimationFrame(l)}};mb(a);const r=window.visualViewport;return r==null||r.addEventListener("resize",o),r==null||r.addEventListener("scroll",o),window.addEventListener("resize",o),window.addEventListener("orientationchange",o),()=>{n!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(n),n=null),r==null||r.removeEventListener("resize",o),r==null||r.removeEventListener("scroll",o),window.removeEventListener("resize",o),window.removeEventListener("orientationchange",o),a.style.removeProperty(u0),a.style.removeProperty(d0)}}const JM=900;function pb(){if(typeof window>"u")return!1;const a=il();return a<Dd?!0:a<=JM}function eA(){const[a,n]=T.useState(pb);return T.useEffect(()=>{var r,c;const l=()=>{const h=pb();n(m=>m===h?m:h)};l();let o=null;try{o=typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null}catch{o=null}return(r=o==null?void 0:o.addEventListener)==null||r.call(o,"change",l),window.addEventListener("resize",l),window.addEventListener("orientationchange",l),(c=window.visualViewport)==null||c.addEventListener("resize",l),()=>{var h,m;(h=o==null?void 0:o.removeEventListener)==null||h.call(o,"change",l),window.removeEventListener("resize",l),window.removeEventListener("orientationchange",l),(m=window.visualViewport)==null||m.removeEventListener("resize",l)}},[]),a}function tA(a){const n=a.target;if(!n)return!1;if(n.id==="terminal-container"||n.id==="terminal-frame"||n.id==="terminal-surface"||n.classList.contains("xterm-helper-textarea")||n.classList.contains("xterm")||n.closest("#terminal-container")||n.closest(".xterm"))return!0;if(typeof document<"u"&&document.activeElement){const l=document.activeElement;if(l.id==="terminal-container"||l.classList.contains("xterm-helper-textarea")||l.closest("#terminal-container")||l.closest(".xterm"))return!0}return!1}function nA(a,n={}){if(typeof window>"u")return()=>{};const l=o=>{var r;o.ctrlKey||o.altKey||o.metaKey||o.key==="Escape"&&(n.isModalOpen||n.isSheetOpen)&&(tA(o)||(o.preventDefault(),o.stopPropagation(),(r=a.onCloseModals)==null||r.call(a)))};return window.addEventListener("keydown",l),()=>{window.removeEventListener("keydown",l)}}function iA(){const[a,n]=T.useState("terminal"),[l,o]=T.useState(!1),[r,c]=T.useState(!1),[h,m]=T.useState(!1),[p,g]=T.useState(void 0),y=P=>{g(P),m(!0)},[v,x]=T.useState(!1),{updateSettings:w,addProfileAndConnect:S,settings:M}=Ee(),{connectionState:N,stateDetail:k,stateCode:E,lastPairedAt:R}=et();q1();const H=eA();T.useEffect(()=>QM(),[]),T.useEffect(()=>{kb()},[]),T.useEffect(()=>{const P=l||r||h||v;if(P)return nA({onCloseModals:()=>{o(!1),c(!1),m(!1),x(!1)}},{isModalOpen:P})},[l,r,h,v]),T.useEffect(()=>{var A;const P=()=>{const G=window.location.pathname,W=window.location.hash;n(G==="/admin"||W==="#admin"?"admin":"terminal")};P(),window.addEventListener("popstate",P),window.addEventListener("hashchange",P);try{const G=new URL(window.location.href),W=(A=G.searchParams.get("pairCode"))==null?void 0:A.toUpperCase();W&&br().token?S({wsUrl:Rt,pairCode:W}):W&&w({pairCode:W});let se=!1;if(G.searchParams.has("token")&&(G.searchParams.delete("token"),se=!0),G.searchParams.has("pairCode")&&(G.searchParams.delete("pairCode"),se=!0),se){const Q=G.searchParams.toString(),ge=G.pathname+(Q?`?${Q}`:"")+G.hash;window.history.replaceState({},"",ge)}}catch(G){console.warn("Failed to parse URL query params:",G)}return()=>{window.removeEventListener("popstate",P),window.removeEventListener("hashchange",P)}},[w,S]);const j=()=>o(!0),D=()=>c(!0),_=P=>{n(P),P==="admin"?window.history.pushState({},"","/admin"):window.history.pushState({},"","/")},z=!M.token&&!M.pairCode&&N!=="connected",K=N==="error"&&(["auth_required","unauthorized","device_revoked"].includes(E||"")||/auth|unauthor|forbidden|permission|token|pair/i.test(k||"")),q=z||K,[te,Z]=T.useState(!q);T.useEffect(()=>{q||Z(!0)},[q]),T.useEffect(()=>{R&&(o(!1),c(!1),Z(!0),n("terminal"))},[R]);const ie=a==="terminal"&&!q,re=P=>({visibility:P?"visible":"hidden",opacity:P?1:0,pointerEvents:P?"auto":"none",zIndex:P?1:0});return f.jsxs("div",{"data-testid":"app-shell",style:H?{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:P=>{P.preventDefault(),P.stopPropagation()},children:[!H&&f.jsx(XS,{currentView:a,onNavigate:_,onOpenPairing:j,onOpenSettings:()=>y(),onToggleVirtualKeyboard:()=>x(!v),isVirtualKeyboardOpen:v}),!H&&!q&&f.jsx(ZS,{}),f.jsxs("div",{className:"flex-1 min-h-0 w-full overflow-hidden relative",children:[te&&f.jsxs("div",{"data-testid":"terminal-layer",className:`absolute ${H?"inset-x-0 top-12 bottom-11":"inset-0"} flex flex-col min-h-0 w-full overflow-hidden`,style:re(ie),"aria-hidden":!ie,children:[f.jsx(q5,{isActive:ie}),!H&&f.jsx(uM,{isOpen:v,onClose:()=>x(!1)}),f.jsx(cM,{compact:H,onCustomize:()=>y("agentKeymaps")}),f.jsx(XM,{}),f.jsx(bM,{})]}),a==="terminal"&&q&&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(Z5,{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(YM,{onBackToTerminal:()=>_("terminal"),onOpenPairing:j,showBack:H})}),H&&ie&&f.jsx(qM,{onOpenPairing:j,onOpenSettings:()=>y(),onAddProfile:D})]}),!H&&a!=="admin"&&f.jsx(NM,{onAddProfile:D}),f.jsx(dM,{isOpen:l,onClose:()=>o(!1)}),f.jsx(fM,{isOpen:r,onClose:()=>c(!1)}),f.jsx(xM,{isOpen:h,initialTab:p,onClose:()=>m(!1),onOpenAdmin:()=>{m(!1),_("admin")}}),f.jsx(CM,{})]})}function aA(){return f.jsx(z1,{children:f.jsx(iA,{})})}const f0=document.getElementById("root");if(!f0)throw new Error("Root element not found");zx.createRoot(f0).render(f.jsx(Jn.StrictMode,{children:f.jsx(aA,{})}));