herdr-remote-relay 0.3.8 → 0.3.9
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 H0=Object.defineProperty;var K0=(a,i,s)=>i in a?H0(a,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[i]=s;var Z=(a,i,s)=>K0(a,typeof i!="symbol"?i+"":i,s);import{r as pg,g as gg,a as bg}from"./vendor-react-CYSfZuHu.js";import{r as Y0,a as I0}from"./vendor-xterm-Bbu8R_5E.js";(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))r(u);new MutationObserver(u=>{for(const f of u)if(f.type==="childList")for(const m of f.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&r(m)}).observe(document,{childList:!0,subtree:!0});function s(u){const f={};return u.integrity&&(f.integrity=u.integrity),u.referrerPolicy&&(f.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?f.credentials="include":u.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function r(u){if(u.ep)return;u.ep=!0;const f=s(u);fetch(u.href,f)}})();var Uu={exports:{}},Us={};/**
|
|
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 rp;function G0(){if(rp)return Us;rp=1;var a=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function s(r,u,f){var m=null;if(f!==void 0&&(m=""+f),u.key!==void 0&&(m=""+u.key),"key"in u){f={};for(var h in u)h!=="key"&&(f[h]=u[h])}else f=u;return u=f.ref,{$$typeof:a,type:r,key:m,ref:u!==void 0?u:null,props:f}}return Us.Fragment=i,Us.jsx=s,Us.jsxs=s,Us}var op;function $0(){return op||(op=1,Uu.exports=G0()),Uu.exports}var d=$0(),w=pg();const Ti=gg(w);var Bu={exports:{}},Bs={},Hu={exports:{}},Ku={};/**
|
|
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 cp;function F0(){return cp||(cp=1,(function(a){function i(N,q){var ce=N.length;N.push(q);e:for(;0<ce;){var Le=ce-1>>>1,J=N[Le];if(0<u(J,q))N[Le]=q,N[ce]=J,ce=Le;else break e}}function s(N){return N.length===0?null:N[0]}function r(N){if(N.length===0)return null;var q=N[0],ce=N.pop();if(ce!==q){N[0]=ce;e:for(var Le=0,J=N.length,Ve=J>>>1;Le<Ve;){var Ue=2*(Le+1)-1,Re=N[Ue],Oe=Ue+1,je=N[Oe];if(0>u(Re,ce))Oe<J&&0>u(je,Re)?(N[Le]=je,N[Oe]=ce,Le=Oe):(N[Le]=Re,N[Ue]=ce,Le=Ue);else if(Oe<J&&0>u(je,ce))N[Le]=je,N[Oe]=ce,Le=Oe;else break e}}return q}function u(N,q){var ce=N.sortIndex-q.sortIndex;return ce!==0?ce:N.id-q.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;a.unstable_now=function(){return f.now()}}else{var m=Date,h=m.now();a.unstable_now=function(){return m.now()-h}}var p=[],y=[],b=1,v=null,S=3,T=!1,E=!1,G=!1,A=!1,z=typeof setTimeout=="function"?setTimeout:null,B=typeof clearTimeout=="function"?clearTimeout:null,Y=typeof setImmediate<"u"?setImmediate:null;function ae(N){for(var q=s(y);q!==null;){if(q.callback===null)r(y);else if(q.startTime<=N)r(y),q.sortIndex=q.expirationTime,i(p,q);else break;q=s(y)}}function he(N){if(G=!1,ae(N),!E)if(s(p)!==null)E=!0,ee||(ee=!0,Me());else{var q=s(y);q!==null&&Ge(he,q.startTime-N)}}var ee=!1,F=-1,H=5,re=-1;function le(){return A?!0:!(a.unstable_now()-re<H)}function ye(){if(A=!1,ee){var N=a.unstable_now();re=N;var q=!0;try{e:{E=!1,G&&(G=!1,B(F),F=-1),T=!0;var ce=S;try{t:{for(ae(N),v=s(p);v!==null&&!(v.expirationTime>N&&le());){var Le=v.callback;if(typeof Le=="function"){v.callback=null,S=v.priorityLevel;var J=Le(v.expirationTime<=N);if(N=a.unstable_now(),typeof J=="function"){v.callback=J,ae(N),q=!0;break t}v===s(p)&&r(p),ae(N)}else r(p);v=s(p)}if(v!==null)q=!0;else{var Ve=s(y);Ve!==null&&Ge(he,Ve.startTime-N),q=!1}}break e}finally{v=null,S=ce,T=!1}q=void 0}}finally{q?Me():ee=!1}}}var Me;if(typeof Y=="function")Me=function(){Y(ye)};else if(typeof MessageChannel<"u"){var Ke=new MessageChannel,nt=Ke.port2;Ke.port1.onmessage=ye,Me=function(){nt.postMessage(null)}}else Me=function(){z(ye,0)};function Ge(N,q){F=z(function(){N(a.unstable_now())},q)}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(N){N.callback=null},a.unstable_forceFrameRate=function(N){0>N||125<N?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):H=0<N?Math.floor(1e3/N):5},a.unstable_getCurrentPriorityLevel=function(){return S},a.unstable_next=function(N){switch(S){case 1:case 2:case 3:var q=3;break;default:q=S}var ce=S;S=q;try{return N()}finally{S=ce}},a.unstable_requestPaint=function(){A=!0},a.unstable_runWithPriority=function(N,q){switch(N){case 1:case 2:case 3:case 4:case 5:break;default:N=3}var ce=S;S=N;try{return q()}finally{S=ce}},a.unstable_scheduleCallback=function(N,q,ce){var Le=a.unstable_now();switch(typeof ce=="object"&&ce!==null?(ce=ce.delay,ce=typeof ce=="number"&&0<ce?Le+ce:Le):ce=Le,N){case 1:var J=-1;break;case 2:J=250;break;case 5:J=1073741823;break;case 4:J=1e4;break;default:J=5e3}return J=ce+J,N={id:b++,callback:q,priorityLevel:N,startTime:ce,expirationTime:J,sortIndex:-1},ce>Le?(N.sortIndex=ce,i(y,N),s(p)===null&&N===s(y)&&(G?(B(F),F=-1):G=!0,Ge(he,ce-Le))):(N.sortIndex=J,i(p,N),E||T||(E=!0,ee||(ee=!0,Me()))),N},a.unstable_shouldYield=le,a.unstable_wrapCallback=function(N){var q=S;return function(){var ce=S;S=q;try{return N.apply(this,arguments)}finally{S=ce}}}})(Ku)),Ku}var up;function q0(){return up||(up=1,Hu.exports=F0()),Hu.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 dp;function V0(){if(dp)return Bs;dp=1;var a=q0(),i=pg(),s=bg();function r(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function u(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function f(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function m(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function h(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function p(e){if(f(e)!==e)throw Error(r(188))}function y(e){var t=e.alternate;if(!t){if(t=f(e),t===null)throw Error(r(188));return t!==e?null:e}for(var n=e,l=t;;){var o=n.return;if(o===null)break;var c=o.alternate;if(c===null){if(l=o.return,l!==null){n=l;continue}break}if(o.child===c.child){for(c=o.child;c;){if(c===n)return p(o),e;if(c===l)return p(o),t;c=c.sibling}throw Error(r(188))}if(n.return!==l.return)n=o,l=c;else{for(var g=!1,x=o.child;x;){if(x===n){g=!0,n=o,l=c;break}if(x===l){g=!0,l=o,n=c;break}x=x.sibling}if(!g){for(x=c.child;x;){if(x===n){g=!0,n=c,l=o;break}if(x===l){g=!0,l=c,n=o;break}x=x.sibling}if(!g)throw Error(r(189))}}if(n.alternate!==l)throw Error(r(190))}if(n.tag!==3)throw Error(r(188));return n.stateNode.current===n?e:t}function b(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=b(e),t!==null)return t;e=e.sibling}return null}var v=Object.assign,S=Symbol.for("react.element"),T=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),G=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),z=Symbol.for("react.profiler"),B=Symbol.for("react.consumer"),Y=Symbol.for("react.context"),ae=Symbol.for("react.forward_ref"),he=Symbol.for("react.suspense"),ee=Symbol.for("react.suspense_list"),F=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),re=Symbol.for("react.activity"),le=Symbol.for("react.memo_cache_sentinel"),ye=Symbol.iterator;function Me(e){return e===null||typeof e!="object"?null:(e=ye&&e[ye]||e["@@iterator"],typeof e=="function"?e:null)}var Ke=Symbol.for("react.client.reference");function nt(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Ke?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case G:return"Fragment";case z:return"Profiler";case A:return"StrictMode";case he:return"Suspense";case ee:return"SuspenseList";case re:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case E:return"Portal";case Y:return e.displayName||"Context";case B:return(e._context.displayName||"Context")+".Consumer";case ae:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case F:return t=e.displayName||null,t!==null?t:nt(e.type)||"Memo";case H:t=e._payload,e=e._init;try{return nt(e(t))}catch{}}return null}var Ge=Array.isArray,N=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ce={pending:!1,data:null,method:null,action:null},Le=[],J=-1;function Ve(e){return{current:e}}function Ue(e){0>J||(e.current=Le[J],Le[J]=null,J--)}function Re(e,t){J++,Le[J]=e.current,e.current=t}var Oe=Ve(null),je=Ve(null),Xe=Ve(null),Bt=Ve(null);function jt(e,t){switch(Re(Xe,t),Re(je,e),Re(Oe,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Rm(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Rm(t),e=Lm(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Ue(Oe),Re(Oe,e)}function Fe(){Ue(Oe),Ue(je),Ue(Xe)}function qt(e){e.memoizedState!==null&&Re(Bt,e);var t=Oe.current,n=Lm(t,e.type);t!==n&&(Re(je,e),Re(Oe,n))}function St(e){je.current===e&&(Ue(Oe),Ue(je)),Bt.current===e&&(Ue(Bt),js._currentValue=ce)}var mt,V;function me(e){if(mt===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);mt=t&&t[1]||"",V=-1<n.stack.indexOf(`
|
|
26
|
+
at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
27
|
+
`+mt+e+V}var Ye=!1;function pt(e,t){if(!e||Ye)return"";Ye=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(t){var Q=function(){throw Error()};if(Object.defineProperty(Q.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Q,[])}catch(I){var O=I}Reflect.construct(e,[],Q)}else{try{Q.call()}catch(I){O=I}e.call(Q.prototype)}}else{try{throw Error()}catch(I){O=I}(Q=e())&&typeof Q.catch=="function"&&Q.catch(function(){})}}catch(I){if(I&&O&&typeof I.stack=="string")return[I.stack,O.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var o=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");o&&o.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var c=l.DetermineComponentFrameRoot(),g=c[0],x=c[1];if(g&&x){var C=g.split(`
|
|
28
|
+
`),D=x.split(`
|
|
29
|
+
`);for(o=l=0;l<C.length&&!C[l].includes("DetermineComponentFrameRoot");)l++;for(;o<D.length&&!D[o].includes("DetermineComponentFrameRoot");)o++;if(l===C.length||o===D.length)for(l=C.length-1,o=D.length-1;1<=l&&0<=o&&C[l]!==D[o];)o--;for(;1<=l&&0<=o;l--,o--)if(C[l]!==D[o]){if(l!==1||o!==1)do if(l--,o--,0>o||C[l]!==D[o]){var X=`
|
|
30
|
+
`+C[l].replace(" at new "," at ");return e.displayName&&X.includes("<anonymous>")&&(X=X.replace("<anonymous>",e.displayName)),X}while(1<=l&&0<=o);break}}}finally{Ye=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?me(n):""}function L(e,t){switch(e.tag){case 26:case 27:case 5:return me(e.type);case 16:return me("Lazy");case 13:return e.child!==t&&t!==null?me("Suspense Fallback"):me("Suspense");case 19:return me("SuspenseList");case 0:case 15:return pt(e.type,!1);case 11:return pt(e.type.render,!1);case 1:return pt(e.type,!0);case 31:return me("Activity");default:return""}}function xe(e){try{var t="",n=null;do t+=L(e,n),n=e,e=e.return;while(e);return t}catch(l){return`
|
|
31
|
+
Error generating stack: `+l.message+`
|
|
32
|
+
`+l.stack}}var we=Object.prototype.hasOwnProperty,Ee=a.unstable_scheduleCallback,_e=a.unstable_cancelCallback,ot=a.unstable_shouldYield,$e=a.unstable_requestPaint,oe=a.unstable_now,ve=a.unstable_getCurrentPriorityLevel,ze=a.unstable_ImmediatePriority,Qe=a.unstable_UserBlockingPriority,kt=a.unstable_NormalPriority,Kn=a.unstable_LowPriority,Dt=a.unstable_IdlePriority,ii=a.log,Rn=a.unstable_setDisableYieldValue,Zt=null,ut=null;function Tt(e){if(typeof ii=="function"&&Rn(e),ut&&typeof ut.setStrictMode=="function")try{ut.setStrictMode(Zt,e)}catch{}}var Ct=Math.clz32?Math.clz32:In,Yn=Math.log,cn=Math.LN2;function In(e){return e>>>=0,e===0?32:31-(Yn(e)/cn|0)|0}var li=256,et=262144,Mi=4194304;function un(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 mn(e,t,n){var l=e.pendingLanes;if(l===0)return 0;var o=0,c=e.suspendedLanes,g=e.pingedLanes;e=e.warmLanes;var x=l&134217727;return x!==0?(l=x&~c,l!==0?o=un(l):(g&=x,g!==0?o=un(g):n||(n=x&~e,n!==0&&(o=un(n))))):(x=l&~c,x!==0?o=un(x):g!==0?o=un(g):n||(n=l&~e,n!==0&&(o=un(n)))),o===0?0:t!==0&&t!==o&&(t&c)===0&&(c=o&-o,n=t&-t,c>=n||c===32&&(n&4194048)!==0)?t:o}function Gn(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function jl(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 Lt(){var e=Mi;return Mi<<=1,(Mi&62914560)===0&&(Mi=4194304),e}function wn(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Sn(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ai(e,t,n,l,o,c){var g=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var x=e.entanglements,C=e.expirationTimes,D=e.hiddenUpdates;for(n=g&~n;0<n;){var X=31-Ct(n),Q=1<<X;x[X]=0,C[X]=-1;var O=D[X];if(O!==null)for(D[X]=null,X=0;X<O.length;X++){var I=O[X];I!==null&&(I.lane&=-536870913)}n&=~Q}l!==0&&sa(e,l,0),c!==0&&o===0&&e.tag!==0&&(e.suspendedLanes|=c&~(g&~t))}function sa(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-Ct(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|n&261930}function Dl(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var l=31-Ct(n),o=1<<l;o&t|e[l]&t&&(e[l]|=t),n&=~o}}function Pi(e,t){var n=t&-t;return n=(n&42)!==0?1:Zi(n),(n&(e.suspendedLanes|t))!==0?0:n}function Zi(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 Qi(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Ei(){var e=q.p;return e!==0?e:(e=window.event,e===void 0?32:ep(e.type))}function Ni(e,t){var n=q.p;try{return q.p=e,t()}finally{q.p=n}}var $n=Math.random().toString(36).slice(2),Ht="__reactFiber$"+$n,Qt="__reactProps$"+$n,mi="__reactContainer$"+$n,Ol="__reactEvents$"+$n,Za="__reactListeners$"+$n,ra="__reactHandles$"+$n,Wi="__reactResources$"+$n,dn="__reactMarker$"+$n;function ki(e){delete e[Ht],delete e[Qt],delete e[Ol],delete e[Za],delete e[ra]}function Cn(e){var t=e[Ht];if(t)return t;for(var n=e.parentNode;n;){if(t=n[mi]||n[Ht]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Bm(e);e!==null;){if(n=e[Ht])return n;e=Bm(e)}return t}e=n,n=e.parentNode}return null}function ai(e){if(e=e[Ht]||e[mi]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function pi(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(r(33))}function Ln(e){var t=e[Wi];return t||(t=e[Wi]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function _t(e){e[dn]=!0}var zl=new Set,Ul={};function _(e,t){K(e,t),K(e+"Capture",t)}function K(e,t){for(Ul[e]=t,e=0;e<t.length;e++)zl.add(t[e])}var de=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]*$"),U={},$={};function ie(e){return we.call($,e)?!0:we.call(U,e)?!1:de.test(e)?$[e]=!0:(U[e]=!0,!1)}function te(e,t,n){if(ie(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var l=t.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+n)}}function Ae(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+n)}}function ne(e,t,n,l){if(l===null)e.removeAttribute(n);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+l)}}function it(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function dt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function vt(e,t,n){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var o=l.get,c=l.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(g){n=""+g,c.call(this,g)}}),Object.defineProperty(e,t,{enumerable:l.enumerable}),{getValue:function(){return n},setValue:function(g){n=""+g},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function st(e){if(!e._valueTracker){var t=dt(e)?"checked":"value";e._valueTracker=vt(e,t,""+e[t])}}function Fn(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),l="";return e&&(l=dt(e)?e.checked?"true":"false":e.value),e=l,e!==n?(t.setValue(e),!0):!1}function qn(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Ji=/[\n"\\]/g;function nn(e){return e.replace(Ji,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function el(e,t,n,l,o,c,g,x){e.name="",g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"?e.type=g:e.removeAttribute("type"),t!=null?g==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+it(t)):e.value!==""+it(t)&&(e.value=""+it(t)):g!=="submit"&&g!=="reset"||e.removeAttribute("value"),t!=null?Qa(e,g,it(t)):n!=null?Qa(e,g,it(n)):l!=null&&e.removeAttribute("value"),o==null&&c!=null&&(e.defaultChecked=!!c),o!=null&&(e.checked=o&&typeof o!="function"&&typeof o!="symbol"),x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?e.name=""+it(x):e.removeAttribute("name")}function Ri(e,t,n,l,o,c,g,x){if(c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"&&(e.type=c),t!=null||n!=null){if(!(c!=="submit"&&c!=="reset"||t!=null)){st(e);return}n=n!=null?""+it(n):"",t=t!=null?""+it(t):n,x||t===e.value||(e.value=t),e.defaultValue=t}l=l??o,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=x?e.checked:!!l,e.defaultChecked=!!l,g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(e.name=g),st(e)}function Qa(e,t,n){t==="number"&&qn(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function tl(e,t,n,l){if(e=e.options,t){t={};for(var o=0;o<n.length;o++)t["$"+n[o]]=!0;for(n=0;n<e.length;n++)o=t.hasOwnProperty("$"+e[n].value),e[n].selected!==o&&(e[n].selected=o),o&&l&&(e[n].defaultSelected=!0)}else{for(n=""+it(n),t=null,o=0;o<e.length;o++){if(e[o].value===n){e[o].selected=!0,l&&(e[o].defaultSelected=!0);return}t!==null||e[o].disabled||(t=e[o])}t!==null&&(t.selected=!0)}}function lr(e,t,n){if(t!=null&&(t=""+it(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+it(n):""}function ar(e,t,n,l){if(t==null){if(l!=null){if(n!=null)throw Error(r(92));if(Ge(l)){if(1<l.length)throw Error(r(93));l=l[0]}n=l}n==null&&(n=""),t=n}n=it(t),e.defaultValue=n,l=e.textContent,l===n&&l!==""&&l!==null&&(e.value=l),st(e)}function nl(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var zo=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function sr(e,t,n){var l=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?l?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":l?e.setProperty(t,n):typeof n!="number"||n===0||zo.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function rr(e,t,n){if(t!=null&&typeof t!="object")throw Error(r(62));if(e=e.style,n!=null){for(var l in n)!n.hasOwnProperty(l)||t!=null&&t.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var o in t)l=t[o],t.hasOwnProperty(o)&&n[o]!==l&&sr(e,o,l)}else for(var c in t)t.hasOwnProperty(c)&&sr(e,c,t[c])}function fn(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 Uo=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Bo=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function gi(e){return Bo.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Vt(){}var oa=null;function ca(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var si=null,ri=null;function Bl(e){var t=ai(e);if(t&&(e=t.stateNode)){var n=e[Qt]||null;e:switch(e=t.stateNode,t.type){case"input":if(el(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+nn(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var l=n[t];if(l!==e&&l.form===e.form){var o=l[Qt]||null;if(!o)throw Error(r(90));el(l,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name)}}for(t=0;t<n.length;t++)l=n[t],l.form===e.form&&Fn(l)}break e;case"textarea":lr(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&tl(e,!!n.multiple,t,!1)}}}var ua=!1;function Wa(e,t,n){if(ua)return e(t,n);ua=!0;try{var l=e(t);return l}finally{if(ua=!1,(si!==null||ri!==null)&&($r(),si&&(t=si,e=ri,ri=si=null,Bl(t),e)))for(t=0;t<e.length;t++)Bl(e[t])}}function il(e,t){var n=e.stateNode;if(n===null)return null;var l=n[Qt]||null;if(l===null)return null;n=l[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(r(231,t,typeof n));return n}var W=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ue=!1;if(W)try{var De={};Object.defineProperty(De,"passive",{get:function(){ue=!0}}),window.addEventListener("test",De,De),window.removeEventListener("test",De,De)}catch{ue=!1}var xt=null,hn=null,pn=null;function Ce(){if(pn)return pn;var e,t=hn,n=t.length,l,o="value"in xt?xt.value:xt.textContent,c=o.length;for(e=0;e<n&&t[e]===o[e];e++);var g=n-e;for(l=1;l<=g&&t[n-l]===o[c-l];l++);return pn=o.slice(e,1<l?1-l:void 0)}function Wt(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 Mt(){return!0}function _n(){return!1}function Ot(e){function t(n,l,o,c,g){this._reactName=n,this._targetInst=o,this.type=l,this.nativeEvent=c,this.target=g,this.currentTarget=null;for(var x in e)e.hasOwnProperty(x)&&(n=e[x],this[x]=n?n(c):c[x]);return this.isDefaultPrevented=(c.defaultPrevented!=null?c.defaultPrevented:c.returnValue===!1)?Mt:_n,this.isPropagationStopped=_n,this}return v(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Mt)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Mt)},persist:function(){},isPersistent:Mt}),t}var gn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Vn=Ot(gn),ll=v({},gn,{view:0,detail:0}),Ub=Ot(ll),Ho,Ko,Ja,or=v({},ll,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Io,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!==Ja&&(Ja&&e.type==="mousemove"?(Ho=e.screenX-Ja.screenX,Ko=e.screenY-Ja.screenY):Ko=Ho=0,Ja=e),Ho)},movementY:function(e){return"movementY"in e?e.movementY:Ko}}),_d=Ot(or),Bb=v({},or,{dataTransfer:0}),Hb=Ot(Bb),Kb=v({},ll,{relatedTarget:0}),Yo=Ot(Kb),Yb=v({},gn,{animationName:0,elapsedTime:0,pseudoElement:0}),Ib=Ot(Yb),Gb=v({},gn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),$b=Ot(Gb),Fb=v({},gn,{data:0}),jd=Ot(Fb),qb={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Vb={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"},Xb={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Pb(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Xb[e])?!!t[e]:!1}function Io(){return Pb}var Zb=v({},ll,{key:function(e){if(e.key){var t=qb[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Wt(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Vb[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Io,charCode:function(e){return e.type==="keypress"?Wt(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Wt(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Qb=Ot(Zb),Wb=v({},or,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Dd=Ot(Wb),Jb=v({},ll,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Io}),ey=Ot(Jb),ty=v({},gn,{propertyName:0,elapsedTime:0,pseudoElement:0}),ny=Ot(ty),iy=v({},or,{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}),ly=Ot(iy),ay=v({},gn,{newState:0,oldState:0}),sy=Ot(ay),ry=[9,13,27,32],Go=W&&"CompositionEvent"in window,es=null;W&&"documentMode"in document&&(es=document.documentMode);var oy=W&&"TextEvent"in window&&!es,Od=W&&(!Go||es&&8<es&&11>=es),zd=" ",Ud=!1;function Bd(e,t){switch(e){case"keyup":return ry.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Hd(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var da=!1;function cy(e,t){switch(e){case"compositionend":return Hd(t);case"keypress":return t.which!==32?null:(Ud=!0,zd);case"textInput":return e=t.data,e===zd&&Ud?null:e;default:return null}}function uy(e,t){if(da)return e==="compositionend"||!Go&&Bd(e,t)?(e=Ce(),pn=hn=xt=null,da=!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 Od&&t.locale!=="ko"?null:t.data;default:return null}}var dy={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 Kd(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!dy[e.type]:t==="textarea"}function Yd(e,t,n,l){si?ri?ri.push(l):ri=[l]:si=l,t=Qr(t,"onChange"),0<t.length&&(n=new Vn("onChange","change",null,n,l),e.push({event:n,listeners:t}))}var ts=null,ns=null;function fy(e){Tm(e,0)}function cr(e){var t=pi(e);if(Fn(t))return e}function Id(e,t){if(e==="change")return t}var Gd=!1;if(W){var $o;if(W){var Fo="oninput"in document;if(!Fo){var $d=document.createElement("div");$d.setAttribute("oninput","return;"),Fo=typeof $d.oninput=="function"}$o=Fo}else $o=!1;Gd=$o&&(!document.documentMode||9<document.documentMode)}function Fd(){ts&&(ts.detachEvent("onpropertychange",qd),ns=ts=null)}function qd(e){if(e.propertyName==="value"&&cr(ns)){var t=[];Yd(t,ns,e,ca(e)),Wa(fy,t)}}function hy(e,t,n){e==="focusin"?(Fd(),ts=t,ns=n,ts.attachEvent("onpropertychange",qd)):e==="focusout"&&Fd()}function my(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return cr(ns)}function py(e,t){if(e==="click")return cr(t)}function gy(e,t){if(e==="input"||e==="change")return cr(t)}function by(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var jn=typeof Object.is=="function"?Object.is:by;function is(e,t){if(jn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),l=Object.keys(t);if(n.length!==l.length)return!1;for(l=0;l<n.length;l++){var o=n[l];if(!we.call(t,o)||!jn(e[o],t[o]))return!1}return!0}function Vd(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Xd(e,t){var n=Vd(e);e=0;for(var l;n;){if(n.nodeType===3){if(l=e+n.textContent.length,e<=t&&l>=t)return{node:n,offset:t-e};e=l}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Vd(n)}}function Pd(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Pd(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Zd(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=qn(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=qn(e.document)}return t}function qo(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var yy=W&&"documentMode"in document&&11>=document.documentMode,fa=null,Vo=null,ls=null,Xo=!1;function Qd(e,t,n){var l=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Xo||fa==null||fa!==qn(l)||(l=fa,"selectionStart"in l&&qo(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),ls&&is(ls,l)||(ls=l,l=Qr(Vo,"onSelect"),0<l.length&&(t=new Vn("onSelect","select",null,t,n),e.push({event:t,listeners:l}),t.target=fa)))}function Hl(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var ha={animationend:Hl("Animation","AnimationEnd"),animationiteration:Hl("Animation","AnimationIteration"),animationstart:Hl("Animation","AnimationStart"),transitionrun:Hl("Transition","TransitionRun"),transitionstart:Hl("Transition","TransitionStart"),transitioncancel:Hl("Transition","TransitionCancel"),transitionend:Hl("Transition","TransitionEnd")},Po={},Wd={};W&&(Wd=document.createElement("div").style,"AnimationEvent"in window||(delete ha.animationend.animation,delete ha.animationiteration.animation,delete ha.animationstart.animation),"TransitionEvent"in window||delete ha.transitionend.transition);function Kl(e){if(Po[e])return Po[e];if(!ha[e])return e;var t=ha[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Wd)return Po[e]=t[n];return e}var Jd=Kl("animationend"),ef=Kl("animationiteration"),tf=Kl("animationstart"),vy=Kl("transitionrun"),xy=Kl("transitionstart"),wy=Kl("transitioncancel"),nf=Kl("transitionend"),lf=new Map,Zo="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(" ");Zo.push("scrollEnd");function oi(e,t){lf.set(e,t),_(t,[e])}var ur=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)},Xn=[],ma=0,Qo=0;function dr(){for(var e=ma,t=Qo=ma=0;t<e;){var n=Xn[t];Xn[t++]=null;var l=Xn[t];Xn[t++]=null;var o=Xn[t];Xn[t++]=null;var c=Xn[t];if(Xn[t++]=null,l!==null&&o!==null){var g=l.pending;g===null?o.next=o:(o.next=g.next,g.next=o),l.pending=o}c!==0&&af(n,o,c)}}function fr(e,t,n,l){Xn[ma++]=e,Xn[ma++]=t,Xn[ma++]=n,Xn[ma++]=l,Qo|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function Wo(e,t,n,l){return fr(e,t,n,l),hr(e)}function Yl(e,t){return fr(e,null,null,t),hr(e)}function af(e,t,n){e.lanes|=n;var l=e.alternate;l!==null&&(l.lanes|=n);for(var o=!1,c=e.return;c!==null;)c.childLanes|=n,l=c.alternate,l!==null&&(l.childLanes|=n),c.tag===22&&(e=c.stateNode,e===null||e._visibility&1||(o=!0)),e=c,c=c.return;return e.tag===3?(c=e.stateNode,o&&t!==null&&(o=31-Ct(n),e=c.hiddenUpdates,l=e[o],l===null?e[o]=[t]:l.push(t),t.lane=n|536870912),c):null}function hr(e){if(50<As)throw As=0,ru=null,Error(r(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var pa={};function Sy(e,t,n,l){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Dn(e,t,n,l){return new Sy(e,t,n,l)}function Jo(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Li(e,t){var n=e.alternate;return n===null?(n=Dn(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function sf(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function mr(e,t,n,l,o,c){var g=0;if(l=e,typeof e=="function")Jo(e)&&(g=1);else if(typeof e=="string")g=E0(e,n,Oe.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case re:return e=Dn(31,n,t,o),e.elementType=re,e.lanes=c,e;case G:return Il(n.children,o,c,t);case A:g=8,o|=24;break;case z:return e=Dn(12,n,t,o|2),e.elementType=z,e.lanes=c,e;case he:return e=Dn(13,n,t,o),e.elementType=he,e.lanes=c,e;case ee:return e=Dn(19,n,t,o),e.elementType=ee,e.lanes=c,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Y:g=10;break e;case B:g=9;break e;case ae:g=11;break e;case F:g=14;break e;case H:g=16,l=null;break e}g=29,n=Error(r(130,e===null?"null":typeof e,"")),l=null}return t=Dn(g,n,t,o),t.elementType=e,t.type=l,t.lanes=c,t}function Il(e,t,n,l){return e=Dn(7,e,l,t),e.lanes=n,e}function ec(e,t,n){return e=Dn(6,e,null,t),e.lanes=n,e}function rf(e){var t=Dn(18,null,null,0);return t.stateNode=e,t}function tc(e,t,n){return t=Dn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var of=new WeakMap;function Pn(e,t){if(typeof e=="object"&&e!==null){var n=of.get(e);return n!==void 0?n:(t={value:e,source:t,stack:xe(t)},of.set(e,t),t)}return{value:e,source:t,stack:xe(t)}}var ga=[],ba=0,pr=null,as=0,Zn=[],Qn=0,al=null,bi=1,yi="";function _i(e,t){ga[ba++]=as,ga[ba++]=pr,pr=e,as=t}function cf(e,t,n){Zn[Qn++]=bi,Zn[Qn++]=yi,Zn[Qn++]=al,al=e;var l=bi;e=yi;var o=32-Ct(l)-1;l&=~(1<<o),n+=1;var c=32-Ct(t)+o;if(30<c){var g=o-o%5;c=(l&(1<<g)-1).toString(32),l>>=g,o-=g,bi=1<<32-Ct(t)+o|n<<o|l,yi=c+e}else bi=1<<c|n<<o|l,yi=e}function nc(e){e.return!==null&&(_i(e,1),cf(e,1,0))}function ic(e){for(;e===pr;)pr=ga[--ba],ga[ba]=null,as=ga[--ba],ga[ba]=null;for(;e===al;)al=Zn[--Qn],Zn[Qn]=null,yi=Zn[--Qn],Zn[Qn]=null,bi=Zn[--Qn],Zn[Qn]=null}function uf(e,t){Zn[Qn++]=bi,Zn[Qn++]=yi,Zn[Qn++]=al,bi=t.id,yi=t.overflow,al=e}var ln=null,At=null,tt=!1,sl=null,Wn=!1,lc=Error(r(519));function rl(e){var t=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ss(Pn(t,e)),lc}function df(e){var t=e.stateNode,n=e.type,l=e.memoizedProps;switch(t[Ht]=e,t[Qt]=l,n){case"dialog":Ze("cancel",t),Ze("close",t);break;case"iframe":case"object":case"embed":Ze("load",t);break;case"video":case"audio":for(n=0;n<Ns.length;n++)Ze(Ns[n],t);break;case"source":Ze("error",t);break;case"img":case"image":case"link":Ze("error",t),Ze("load",t);break;case"details":Ze("toggle",t);break;case"input":Ze("invalid",t),Ri(t,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Ze("invalid",t);break;case"textarea":Ze("invalid",t),ar(t,l.value,l.defaultValue,l.children)}n=l.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||l.suppressHydrationWarning===!0||Nm(t.textContent,n)?(l.popover!=null&&(Ze("beforetoggle",t),Ze("toggle",t)),l.onScroll!=null&&Ze("scroll",t),l.onScrollEnd!=null&&Ze("scrollend",t),l.onClick!=null&&(t.onclick=Vt),t=!0):t=!1,t||rl(e,!0)}function ff(e){for(ln=e.return;ln;)switch(ln.tag){case 5:case 31:case 13:Wn=!1;return;case 27:case 3:Wn=!0;return;default:ln=ln.return}}function ya(e){if(e!==ln)return!1;if(!tt)return ff(e),tt=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||Su(e.type,e.memoizedProps)),n=!n),n&&At&&rl(e),ff(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));At=Um(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));At=Um(e)}else t===27?(t=At,wl(e.type)?(e=Eu,Eu=null,At=e):At=t):At=ln?ei(e.stateNode.nextSibling):null;return!0}function Gl(){At=ln=null,tt=!1}function ac(){var e=sl;return e!==null&&(En===null?En=e:En.push.apply(En,e),sl=null),e}function ss(e){sl===null?sl=[e]:sl.push(e)}var sc=Ve(null),$l=null,ji=null;function ol(e,t,n){Re(sc,t._currentValue),t._currentValue=n}function Di(e){e._currentValue=sc.current,Ue(sc)}function rc(e,t,n){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===n)break;e=e.return}}function oc(e,t,n,l){var o=e.child;for(o!==null&&(o.return=e);o!==null;){var c=o.dependencies;if(c!==null){var g=o.child;c=c.firstContext;e:for(;c!==null;){var x=c;c=o;for(var C=0;C<t.length;C++)if(x.context===t[C]){c.lanes|=n,x=c.alternate,x!==null&&(x.lanes|=n),rc(c.return,n,e),l||(g=null);break e}c=x.next}}else if(o.tag===18){if(g=o.return,g===null)throw Error(r(341));g.lanes|=n,c=g.alternate,c!==null&&(c.lanes|=n),rc(g,n,e),g=null}else g=o.child;if(g!==null)g.return=o;else for(g=o;g!==null;){if(g===e){g=null;break}if(o=g.sibling,o!==null){o.return=g.return,g=o;break}g=g.return}o=g}}function va(e,t,n,l){e=null;for(var o=t,c=!1;o!==null;){if(!c){if((o.flags&524288)!==0)c=!0;else if((o.flags&262144)!==0)break}if(o.tag===10){var g=o.alternate;if(g===null)throw Error(r(387));if(g=g.memoizedProps,g!==null){var x=o.type;jn(o.pendingProps.value,g.value)||(e!==null?e.push(x):e=[x])}}else if(o===Bt.current){if(g=o.alternate,g===null)throw Error(r(387));g.memoizedState.memoizedState!==o.memoizedState.memoizedState&&(e!==null?e.push(js):e=[js])}o=o.return}e!==null&&oc(t,e,n,l),t.flags|=262144}function gr(e){for(e=e.firstContext;e!==null;){if(!jn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Fl(e){$l=e,ji=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function an(e){return hf($l,e)}function br(e,t){return $l===null&&Fl(e),hf(e,t)}function hf(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},ji===null){if(e===null)throw Error(r(308));ji=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ji=ji.next=t;return n}var Cy=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,l){e.push(l)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},Ty=a.unstable_scheduleCallback,My=a.unstable_NormalPriority,It={$$typeof:Y,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function cc(){return{controller:new Cy,data:new Map,refCount:0}}function rs(e){e.refCount--,e.refCount===0&&Ty(My,function(){e.controller.abort()})}var os=null,uc=0,xa=0,wa=null;function Ay(e,t){if(os===null){var n=os=[];uc=0,xa=hu(),wa={status:"pending",value:void 0,then:function(l){n.push(l)}}}return uc++,t.then(mf,mf),t}function mf(){if(--uc===0&&os!==null){wa!==null&&(wa.status="fulfilled");var e=os;os=null,xa=0,wa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Ey(e,t){var n=[],l={status:"pending",value:null,reason:null,then:function(o){n.push(o)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var o=0;o<n.length;o++)(0,n[o])(t)},function(o){for(l.status="rejected",l.reason=o,o=0;o<n.length;o++)(0,n[o])(void 0)}),l}var pf=N.S;N.S=function(e,t){Wh=oe(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&Ay(e,t),pf!==null&&pf(e,t)};var ql=Ve(null);function dc(){var e=ql.current;return e!==null?e:wt.pooledCache}function yr(e,t){t===null?Re(ql,ql.current):Re(ql,t.pool)}function gf(){var e=dc();return e===null?null:{parent:It._currentValue,pool:e}}var Sa=Error(r(460)),fc=Error(r(474)),vr=Error(r(542)),xr={then:function(){}};function bf(e){return e=e.status,e==="fulfilled"||e==="rejected"}function yf(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Vt,Vt),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,xf(e),e;default:if(typeof t.status=="string")t.then(Vt,Vt);else{if(e=wt,e!==null&&100<e.shellSuspendCounter)throw Error(r(482));e=t,e.status="pending",e.then(function(l){if(t.status==="pending"){var o=t;o.status="fulfilled",o.value=l}},function(l){if(t.status==="pending"){var o=t;o.status="rejected",o.reason=l}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,xf(e),e}throw Xl=t,Sa}}function Vl(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Xl=n,Sa):n}}var Xl=null;function vf(){if(Xl===null)throw Error(r(459));var e=Xl;return Xl=null,e}function xf(e){if(e===Sa||e===vr)throw Error(r(483))}var Ca=null,cs=0;function wr(e){var t=cs;return cs+=1,Ca===null&&(Ca=[]),yf(Ca,e,t)}function us(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Sr(e,t){throw t.$$typeof===S?Error(r(525)):(e=Object.prototype.toString.call(t),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function wf(e){function t(R,M){if(e){var j=R.deletions;j===null?(R.deletions=[M],R.flags|=16):j.push(M)}}function n(R,M){if(!e)return null;for(;M!==null;)t(R,M),M=M.sibling;return null}function l(R){for(var M=new Map;R!==null;)R.key!==null?M.set(R.key,R):M.set(R.index,R),R=R.sibling;return M}function o(R,M){return R=Li(R,M),R.index=0,R.sibling=null,R}function c(R,M,j){return R.index=j,e?(j=R.alternate,j!==null?(j=j.index,j<M?(R.flags|=67108866,M):j):(R.flags|=67108866,M)):(R.flags|=1048576,M)}function g(R){return e&&R.alternate===null&&(R.flags|=67108866),R}function x(R,M,j,P){return M===null||M.tag!==6?(M=ec(j,R.mode,P),M.return=R,M):(M=o(M,j),M.return=R,M)}function C(R,M,j,P){var Te=j.type;return Te===G?X(R,M,j.props.children,P,j.key):M!==null&&(M.elementType===Te||typeof Te=="object"&&Te!==null&&Te.$$typeof===H&&Vl(Te)===M.type)?(M=o(M,j.props),us(M,j),M.return=R,M):(M=mr(j.type,j.key,j.props,null,R.mode,P),us(M,j),M.return=R,M)}function D(R,M,j,P){return M===null||M.tag!==4||M.stateNode.containerInfo!==j.containerInfo||M.stateNode.implementation!==j.implementation?(M=tc(j,R.mode,P),M.return=R,M):(M=o(M,j.children||[]),M.return=R,M)}function X(R,M,j,P,Te){return M===null||M.tag!==7?(M=Il(j,R.mode,P,Te),M.return=R,M):(M=o(M,j),M.return=R,M)}function Q(R,M,j){if(typeof M=="string"&&M!==""||typeof M=="number"||typeof M=="bigint")return M=ec(""+M,R.mode,j),M.return=R,M;if(typeof M=="object"&&M!==null){switch(M.$$typeof){case T:return j=mr(M.type,M.key,M.props,null,R.mode,j),us(j,M),j.return=R,j;case E:return M=tc(M,R.mode,j),M.return=R,M;case H:return M=Vl(M),Q(R,M,j)}if(Ge(M)||Me(M))return M=Il(M,R.mode,j,null),M.return=R,M;if(typeof M.then=="function")return Q(R,wr(M),j);if(M.$$typeof===Y)return Q(R,br(R,M),j);Sr(R,M)}return null}function O(R,M,j,P){var Te=M!==null?M.key:null;if(typeof j=="string"&&j!==""||typeof j=="number"||typeof j=="bigint")return Te!==null?null:x(R,M,""+j,P);if(typeof j=="object"&&j!==null){switch(j.$$typeof){case T:return j.key===Te?C(R,M,j,P):null;case E:return j.key===Te?D(R,M,j,P):null;case H:return j=Vl(j),O(R,M,j,P)}if(Ge(j)||Me(j))return Te!==null?null:X(R,M,j,P,null);if(typeof j.then=="function")return O(R,M,wr(j),P);if(j.$$typeof===Y)return O(R,M,br(R,j),P);Sr(R,j)}return null}function I(R,M,j,P,Te){if(typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint")return R=R.get(j)||null,x(M,R,""+P,Te);if(typeof P=="object"&&P!==null){switch(P.$$typeof){case T:return R=R.get(P.key===null?j:P.key)||null,C(M,R,P,Te);case E:return R=R.get(P.key===null?j:P.key)||null,D(M,R,P,Te);case H:return P=Vl(P),I(R,M,j,P,Te)}if(Ge(P)||Me(P))return R=R.get(j)||null,X(M,R,P,Te,null);if(typeof P.then=="function")return I(R,M,j,wr(P),Te);if(P.$$typeof===Y)return I(R,M,j,br(M,P),Te);Sr(M,P)}return null}function be(R,M,j,P){for(var Te=null,lt=null,Se=M,Ie=M=0,Je=null;Se!==null&&Ie<j.length;Ie++){Se.index>Ie?(Je=Se,Se=null):Je=Se.sibling;var at=O(R,Se,j[Ie],P);if(at===null){Se===null&&(Se=Je);break}e&&Se&&at.alternate===null&&t(R,Se),M=c(at,M,Ie),lt===null?Te=at:lt.sibling=at,lt=at,Se=Je}if(Ie===j.length)return n(R,Se),tt&&_i(R,Ie),Te;if(Se===null){for(;Ie<j.length;Ie++)Se=Q(R,j[Ie],P),Se!==null&&(M=c(Se,M,Ie),lt===null?Te=Se:lt.sibling=Se,lt=Se);return tt&&_i(R,Ie),Te}for(Se=l(Se);Ie<j.length;Ie++)Je=I(Se,R,Ie,j[Ie],P),Je!==null&&(e&&Je.alternate!==null&&Se.delete(Je.key===null?Ie:Je.key),M=c(Je,M,Ie),lt===null?Te=Je:lt.sibling=Je,lt=Je);return e&&Se.forEach(function(Al){return t(R,Al)}),tt&&_i(R,Ie),Te}function Ne(R,M,j,P){if(j==null)throw Error(r(151));for(var Te=null,lt=null,Se=M,Ie=M=0,Je=null,at=j.next();Se!==null&&!at.done;Ie++,at=j.next()){Se.index>Ie?(Je=Se,Se=null):Je=Se.sibling;var Al=O(R,Se,at.value,P);if(Al===null){Se===null&&(Se=Je);break}e&&Se&&Al.alternate===null&&t(R,Se),M=c(Al,M,Ie),lt===null?Te=Al:lt.sibling=Al,lt=Al,Se=Je}if(at.done)return n(R,Se),tt&&_i(R,Ie),Te;if(Se===null){for(;!at.done;Ie++,at=j.next())at=Q(R,at.value,P),at!==null&&(M=c(at,M,Ie),lt===null?Te=at:lt.sibling=at,lt=at);return tt&&_i(R,Ie),Te}for(Se=l(Se);!at.done;Ie++,at=j.next())at=I(Se,R,Ie,at.value,P),at!==null&&(e&&at.alternate!==null&&Se.delete(at.key===null?Ie:at.key),M=c(at,M,Ie),lt===null?Te=at:lt.sibling=at,lt=at);return e&&Se.forEach(function(B0){return t(R,B0)}),tt&&_i(R,Ie),Te}function yt(R,M,j,P){if(typeof j=="object"&&j!==null&&j.type===G&&j.key===null&&(j=j.props.children),typeof j=="object"&&j!==null){switch(j.$$typeof){case T:e:{for(var Te=j.key;M!==null;){if(M.key===Te){if(Te=j.type,Te===G){if(M.tag===7){n(R,M.sibling),P=o(M,j.props.children),P.return=R,R=P;break e}}else if(M.elementType===Te||typeof Te=="object"&&Te!==null&&Te.$$typeof===H&&Vl(Te)===M.type){n(R,M.sibling),P=o(M,j.props),us(P,j),P.return=R,R=P;break e}n(R,M);break}else t(R,M);M=M.sibling}j.type===G?(P=Il(j.props.children,R.mode,P,j.key),P.return=R,R=P):(P=mr(j.type,j.key,j.props,null,R.mode,P),us(P,j),P.return=R,R=P)}return g(R);case E:e:{for(Te=j.key;M!==null;){if(M.key===Te)if(M.tag===4&&M.stateNode.containerInfo===j.containerInfo&&M.stateNode.implementation===j.implementation){n(R,M.sibling),P=o(M,j.children||[]),P.return=R,R=P;break e}else{n(R,M);break}else t(R,M);M=M.sibling}P=tc(j,R.mode,P),P.return=R,R=P}return g(R);case H:return j=Vl(j),yt(R,M,j,P)}if(Ge(j))return be(R,M,j,P);if(Me(j)){if(Te=Me(j),typeof Te!="function")throw Error(r(150));return j=Te.call(j),Ne(R,M,j,P)}if(typeof j.then=="function")return yt(R,M,wr(j),P);if(j.$$typeof===Y)return yt(R,M,br(R,j),P);Sr(R,j)}return typeof j=="string"&&j!==""||typeof j=="number"||typeof j=="bigint"?(j=""+j,M!==null&&M.tag===6?(n(R,M.sibling),P=o(M,j),P.return=R,R=P):(n(R,M),P=ec(j,R.mode,P),P.return=R,R=P),g(R)):n(R,M)}return function(R,M,j,P){try{cs=0;var Te=yt(R,M,j,P);return Ca=null,Te}catch(Se){if(Se===Sa||Se===vr)throw Se;var lt=Dn(29,Se,null,R.mode);return lt.lanes=P,lt.return=R,lt}finally{}}}var Pl=wf(!0),Sf=wf(!1),cl=!1;function hc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function mc(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 ul(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function dl(e,t,n){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(rt&2)!==0){var o=l.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),l.pending=t,t=hr(e),af(e,null,n),t}return fr(e,l,t,n),hr(e)}function ds(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var l=t.lanes;l&=e.pendingLanes,n|=l,t.lanes=n,Dl(e,n)}}function pc(e,t){var n=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,n===l)){var o=null,c=null;if(n=n.firstBaseUpdate,n!==null){do{var g={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};c===null?o=c=g:c=c.next=g,n=n.next}while(n!==null);c===null?o=c=t:c=c.next=t}else o=c=t;n={baseState:l.baseState,firstBaseUpdate:o,lastBaseUpdate:c,shared:l.shared,callbacks:l.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var gc=!1;function fs(){if(gc){var e=wa;if(e!==null)throw e}}function hs(e,t,n,l){gc=!1;var o=e.updateQueue;cl=!1;var c=o.firstBaseUpdate,g=o.lastBaseUpdate,x=o.shared.pending;if(x!==null){o.shared.pending=null;var C=x,D=C.next;C.next=null,g===null?c=D:g.next=D,g=C;var X=e.alternate;X!==null&&(X=X.updateQueue,x=X.lastBaseUpdate,x!==g&&(x===null?X.firstBaseUpdate=D:x.next=D,X.lastBaseUpdate=C))}if(c!==null){var Q=o.baseState;g=0,X=D=C=null,x=c;do{var O=x.lane&-536870913,I=O!==x.lane;if(I?(We&O)===O:(l&O)===O){O!==0&&O===xa&&(gc=!0),X!==null&&(X=X.next={lane:0,tag:x.tag,payload:x.payload,callback:null,next:null});e:{var be=e,Ne=x;O=t;var yt=n;switch(Ne.tag){case 1:if(be=Ne.payload,typeof be=="function"){Q=be.call(yt,Q,O);break e}Q=be;break e;case 3:be.flags=be.flags&-65537|128;case 0:if(be=Ne.payload,O=typeof be=="function"?be.call(yt,Q,O):be,O==null)break e;Q=v({},Q,O);break e;case 2:cl=!0}}O=x.callback,O!==null&&(e.flags|=64,I&&(e.flags|=8192),I=o.callbacks,I===null?o.callbacks=[O]:I.push(O))}else I={lane:O,tag:x.tag,payload:x.payload,callback:x.callback,next:null},X===null?(D=X=I,C=Q):X=X.next=I,g|=O;if(x=x.next,x===null){if(x=o.shared.pending,x===null)break;I=x,x=I.next,I.next=null,o.lastBaseUpdate=I,o.shared.pending=null}}while(!0);X===null&&(C=Q),o.baseState=C,o.firstBaseUpdate=D,o.lastBaseUpdate=X,c===null&&(o.shared.lanes=0),gl|=g,e.lanes=g,e.memoizedState=Q}}function Cf(e,t){if(typeof e!="function")throw Error(r(191,e));e.call(t)}function Tf(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Cf(n[e],t)}var Ta=Ve(null),Cr=Ve(0);function Mf(e,t){e=Gi,Re(Cr,e),Re(Ta,t),Gi=e|t.baseLanes}function bc(){Re(Cr,Gi),Re(Ta,Ta.current)}function yc(){Gi=Cr.current,Ue(Ta),Ue(Cr)}var On=Ve(null),Jn=null;function fl(e){var t=e.alternate;Re(Kt,Kt.current&1),Re(On,e),Jn===null&&(t===null||Ta.current!==null||t.memoizedState!==null)&&(Jn=e)}function vc(e){Re(Kt,Kt.current),Re(On,e),Jn===null&&(Jn=e)}function Af(e){e.tag===22?(Re(Kt,Kt.current),Re(On,e),Jn===null&&(Jn=e)):hl()}function hl(){Re(Kt,Kt.current),Re(On,On.current)}function zn(e){Ue(On),Jn===e&&(Jn=null),Ue(Kt)}var Kt=Ve(0);function Tr(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||Mu(n)||Au(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Oi=0,Be=null,gt=null,Gt=null,Mr=!1,Ma=!1,Zl=!1,Ar=0,ms=0,Aa=null,Ny=0;function zt(){throw Error(r(321))}function xc(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!jn(e[n],t[n]))return!1;return!0}function wc(e,t,n,l,o,c){return Oi=c,Be=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,N.H=e===null||e.memoizedState===null?ch:zc,Zl=!1,c=n(l,o),Zl=!1,Ma&&(c=Nf(t,n,l,o)),Ef(e),c}function Ef(e){N.H=bs;var t=gt!==null&>.next!==null;if(Oi=0,Gt=gt=Be=null,Mr=!1,ms=0,Aa=null,t)throw Error(r(300));e===null||$t||(e=e.dependencies,e!==null&&gr(e)&&($t=!0))}function Nf(e,t,n,l){Be=e;var o=0;do{if(Ma&&(Aa=null),ms=0,Ma=!1,25<=o)throw Error(r(301));if(o+=1,Gt=gt=null,e.updateQueue!=null){var c=e.updateQueue;c.lastEffect=null,c.events=null,c.stores=null,c.memoCache!=null&&(c.memoCache.index=0)}N.H=uh,c=t(n,l)}while(Ma);return c}function ky(){var e=N.H,t=e.useState()[0];return t=typeof t.then=="function"?ps(t):t,e=e.useState()[0],(gt!==null?gt.memoizedState:null)!==e&&(Be.flags|=1024),t}function Sc(){var e=Ar!==0;return Ar=0,e}function Cc(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Tc(e){if(Mr){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Mr=!1}Oi=0,Gt=gt=Be=null,Ma=!1,ms=Ar=0,Aa=null}function bn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Gt===null?Be.memoizedState=Gt=e:Gt=Gt.next=e,Gt}function Yt(){if(gt===null){var e=Be.alternate;e=e!==null?e.memoizedState:null}else e=gt.next;var t=Gt===null?Be.memoizedState:Gt.next;if(t!==null)Gt=t,gt=e;else{if(e===null)throw Be.alternate===null?Error(r(467)):Error(r(310));gt=e,e={memoizedState:gt.memoizedState,baseState:gt.baseState,baseQueue:gt.baseQueue,queue:gt.queue,next:null},Gt===null?Be.memoizedState=Gt=e:Gt=Gt.next=e}return Gt}function Er(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ps(e){var t=ms;return ms+=1,Aa===null&&(Aa=[]),e=yf(Aa,e,t),t=Be,(Gt===null?t.memoizedState:Gt.next)===null&&(t=t.alternate,N.H=t===null||t.memoizedState===null?ch:zc),e}function Nr(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ps(e);if(e.$$typeof===Y)return an(e)}throw Error(r(438,String(e)))}function Mc(e){var t=null,n=Be.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var l=Be.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(t={data:l.data.map(function(o){return o.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=Er(),Be.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),l=0;l<e;l++)n[l]=le;return t.index++,n}function zi(e,t){return typeof t=="function"?t(e):t}function kr(e){var t=Yt();return Ac(t,gt,e)}function Ac(e,t,n){var l=e.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=n;var o=e.baseQueue,c=l.pending;if(c!==null){if(o!==null){var g=o.next;o.next=c.next,c.next=g}t.baseQueue=o=c,l.pending=null}if(c=e.baseState,o===null)e.memoizedState=c;else{t=o.next;var x=g=null,C=null,D=t,X=!1;do{var Q=D.lane&-536870913;if(Q!==D.lane?(We&Q)===Q:(Oi&Q)===Q){var O=D.revertLane;if(O===0)C!==null&&(C=C.next={lane:0,revertLane:0,gesture:null,action:D.action,hasEagerState:D.hasEagerState,eagerState:D.eagerState,next:null}),Q===xa&&(X=!0);else if((Oi&O)===O){D=D.next,O===xa&&(X=!0);continue}else Q={lane:0,revertLane:D.revertLane,gesture:null,action:D.action,hasEagerState:D.hasEagerState,eagerState:D.eagerState,next:null},C===null?(x=C=Q,g=c):C=C.next=Q,Be.lanes|=O,gl|=O;Q=D.action,Zl&&n(c,Q),c=D.hasEagerState?D.eagerState:n(c,Q)}else O={lane:Q,revertLane:D.revertLane,gesture:D.gesture,action:D.action,hasEagerState:D.hasEagerState,eagerState:D.eagerState,next:null},C===null?(x=C=O,g=c):C=C.next=O,Be.lanes|=Q,gl|=Q;D=D.next}while(D!==null&&D!==t);if(C===null?g=c:C.next=x,!jn(c,e.memoizedState)&&($t=!0,X&&(n=wa,n!==null)))throw n;e.memoizedState=c,e.baseState=g,e.baseQueue=C,l.lastRenderedState=c}return o===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Ec(e){var t=Yt(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var l=n.dispatch,o=n.pending,c=t.memoizedState;if(o!==null){n.pending=null;var g=o=o.next;do c=e(c,g.action),g=g.next;while(g!==o);jn(c,t.memoizedState)||($t=!0),t.memoizedState=c,t.baseQueue===null&&(t.baseState=c),n.lastRenderedState=c}return[c,l]}function kf(e,t,n){var l=Be,o=Yt(),c=tt;if(c){if(n===void 0)throw Error(r(407));n=n()}else n=t();var g=!jn((gt||o).memoizedState,n);if(g&&(o.memoizedState=n,$t=!0),o=o.queue,Rc(_f.bind(null,l,o,e),[e]),o.getSnapshot!==t||g||Gt!==null&&Gt.memoizedState.tag&1){if(l.flags|=2048,Ea(9,{destroy:void 0},Lf.bind(null,l,o,n,t),null),wt===null)throw Error(r(349));c||(Oi&127)!==0||Rf(l,t,n)}return n}function Rf(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Be.updateQueue,t===null?(t=Er(),Be.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Lf(e,t,n,l){t.value=n,t.getSnapshot=l,jf(t)&&Df(e)}function _f(e,t,n){return n(function(){jf(t)&&Df(e)})}function jf(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!jn(e,n)}catch{return!0}}function Df(e){var t=Yl(e,2);t!==null&&Nn(t,e,2)}function Nc(e){var t=bn();if(typeof e=="function"){var n=e;if(e=n(),Zl){Tt(!0);try{n()}finally{Tt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:zi,lastRenderedState:e},t}function Of(e,t,n,l){return e.baseState=n,Ac(e,gt,typeof l=="function"?l:zi)}function Ry(e,t,n,l,o){if(_r(e))throw Error(r(485));if(e=t.action,e!==null){var c={payload:o,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(g){c.listeners.push(g)}};N.T!==null?n(!0):c.isTransition=!1,l(c),n=t.pending,n===null?(c.next=t.pending=c,zf(t,c)):(c.next=n.next,t.pending=n.next=c)}}function zf(e,t){var n=t.action,l=t.payload,o=e.state;if(t.isTransition){var c=N.T,g={};N.T=g;try{var x=n(o,l),C=N.S;C!==null&&C(g,x),Uf(e,t,x)}catch(D){kc(e,t,D)}finally{c!==null&&g.types!==null&&(c.types=g.types),N.T=c}}else try{c=n(o,l),Uf(e,t,c)}catch(D){kc(e,t,D)}}function Uf(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(l){Bf(e,t,l)},function(l){return kc(e,t,l)}):Bf(e,t,n)}function Bf(e,t,n){t.status="fulfilled",t.value=n,Hf(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,zf(e,n)))}function kc(e,t,n){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=n,Hf(t),t=t.next;while(t!==l)}e.action=null}function Hf(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Kf(e,t){return t}function Yf(e,t){if(tt){var n=wt.formState;if(n!==null){e:{var l=Be;if(tt){if(At){t:{for(var o=At,c=Wn;o.nodeType!==8;){if(!c){o=null;break t}if(o=ei(o.nextSibling),o===null){o=null;break t}}c=o.data,o=c==="F!"||c==="F"?o:null}if(o){At=ei(o.nextSibling),l=o.data==="F!";break e}}rl(l)}l=!1}l&&(t=n[0])}}return n=bn(),n.memoizedState=n.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kf,lastRenderedState:t},n.queue=l,n=sh.bind(null,Be,l),l.dispatch=n,l=Nc(!1),c=Oc.bind(null,Be,!1,l.queue),l=bn(),o={state:t,dispatch:null,action:e,pending:null},l.queue=o,n=Ry.bind(null,Be,o,c,n),o.dispatch=n,l.memoizedState=e,[t,n,!1]}function If(e){var t=Yt();return Gf(t,gt,e)}function Gf(e,t,n){if(t=Ac(e,t,Kf)[0],e=kr(zi)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=ps(t)}catch(g){throw g===Sa?vr:g}else l=t;t=Yt();var o=t.queue,c=o.dispatch;return n!==t.memoizedState&&(Be.flags|=2048,Ea(9,{destroy:void 0},Ly.bind(null,o,n),null)),[l,c,e]}function Ly(e,t){e.action=t}function $f(e){var t=Yt(),n=gt;if(n!==null)return Gf(t,n,e);Yt(),t=t.memoizedState,n=Yt();var l=n.queue.dispatch;return n.memoizedState=e,[t,l,!1]}function Ea(e,t,n,l){return e={tag:e,create:n,deps:l,inst:t,next:null},t=Be.updateQueue,t===null&&(t=Er(),Be.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(l=n.next,n.next=e,e.next=l,t.lastEffect=e),e}function Ff(){return Yt().memoizedState}function Rr(e,t,n,l){var o=bn();Be.flags|=e,o.memoizedState=Ea(1|t,{destroy:void 0},n,l===void 0?null:l)}function Lr(e,t,n,l){var o=Yt();l=l===void 0?null:l;var c=o.memoizedState.inst;gt!==null&&l!==null&&xc(l,gt.memoizedState.deps)?o.memoizedState=Ea(t,c,n,l):(Be.flags|=e,o.memoizedState=Ea(1|t,c,n,l))}function qf(e,t){Rr(8390656,8,e,t)}function Rc(e,t){Lr(2048,8,e,t)}function _y(e){Be.flags|=4;var t=Be.updateQueue;if(t===null)t=Er(),Be.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Vf(e){var t=Yt().memoizedState;return _y({ref:t,nextImpl:e}),function(){if((rt&2)!==0)throw Error(r(440));return t.impl.apply(void 0,arguments)}}function Xf(e,t){return Lr(4,2,e,t)}function Pf(e,t){return Lr(4,4,e,t)}function Zf(e,t){if(typeof t=="function"){e=e();var n=t(e);return function(){typeof n=="function"?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Qf(e,t,n){n=n!=null?n.concat([e]):null,Lr(4,4,Zf.bind(null,t,e),n)}function Lc(){}function Wf(e,t){var n=Yt();t=t===void 0?null:t;var l=n.memoizedState;return t!==null&&xc(t,l[1])?l[0]:(n.memoizedState=[e,t],e)}function Jf(e,t){var n=Yt();t=t===void 0?null:t;var l=n.memoizedState;if(t!==null&&xc(t,l[1]))return l[0];if(l=e(),Zl){Tt(!0);try{e()}finally{Tt(!1)}}return n.memoizedState=[l,t],l}function _c(e,t,n){return n===void 0||(Oi&1073741824)!==0&&(We&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=em(),Be.lanes|=e,gl|=e,n)}function eh(e,t,n,l){return jn(n,t)?n:Ta.current!==null?(e=_c(e,n,l),jn(e,t)||($t=!0),e):(Oi&42)===0||(Oi&1073741824)!==0&&(We&261930)===0?($t=!0,e.memoizedState=n):(e=em(),Be.lanes|=e,gl|=e,t)}function th(e,t,n,l,o){var c=q.p;q.p=c!==0&&8>c?c:8;var g=N.T,x={};N.T=x,Oc(e,!1,t,n);try{var C=o(),D=N.S;if(D!==null&&D(x,C),C!==null&&typeof C=="object"&&typeof C.then=="function"){var X=Ey(C,l);gs(e,t,X,Hn(e))}else gs(e,t,l,Hn(e))}catch(Q){gs(e,t,{then:function(){},status:"rejected",reason:Q},Hn())}finally{q.p=c,g!==null&&x.types!==null&&(g.types=x.types),N.T=g}}function jy(){}function jc(e,t,n,l){if(e.tag!==5)throw Error(r(476));var o=nh(e).queue;th(e,o,t,ce,n===null?jy:function(){return ih(e),n(l)})}function nh(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ce,baseState:ce,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:zi,lastRenderedState:ce},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:zi,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ih(e){var t=nh(e);t.next===null&&(t=e.alternate.memoizedState),gs(e,t.next.queue,{},Hn())}function Dc(){return an(js)}function lh(){return Yt().memoizedState}function ah(){return Yt().memoizedState}function Dy(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Hn();e=ul(n);var l=dl(t,e,n);l!==null&&(Nn(l,t,n),ds(l,t,n)),t={cache:cc()},e.payload=t;return}t=t.return}}function Oy(e,t,n){var l=Hn();n={lane:l,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},_r(e)?rh(t,n):(n=Wo(e,t,n,l),n!==null&&(Nn(n,e,l),oh(n,t,l)))}function sh(e,t,n){var l=Hn();gs(e,t,n,l)}function gs(e,t,n,l){var o={lane:l,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(_r(e))rh(t,o);else{var c=e.alternate;if(e.lanes===0&&(c===null||c.lanes===0)&&(c=t.lastRenderedReducer,c!==null))try{var g=t.lastRenderedState,x=c(g,n);if(o.hasEagerState=!0,o.eagerState=x,jn(x,g))return fr(e,t,o,0),wt===null&&dr(),!1}catch{}finally{}if(n=Wo(e,t,o,l),n!==null)return Nn(n,e,l),oh(n,t,l),!0}return!1}function Oc(e,t,n,l){if(l={lane:2,revertLane:hu(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},_r(e)){if(t)throw Error(r(479))}else t=Wo(e,n,l,2),t!==null&&Nn(t,e,2)}function _r(e){var t=e.alternate;return e===Be||t!==null&&t===Be}function rh(e,t){Ma=Mr=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function oh(e,t,n){if((n&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,n|=l,t.lanes=n,Dl(e,n)}}var bs={readContext:an,use:Nr,useCallback:zt,useContext:zt,useEffect:zt,useImperativeHandle:zt,useLayoutEffect:zt,useInsertionEffect:zt,useMemo:zt,useReducer:zt,useRef:zt,useState:zt,useDebugValue:zt,useDeferredValue:zt,useTransition:zt,useSyncExternalStore:zt,useId:zt,useHostTransitionStatus:zt,useFormState:zt,useActionState:zt,useOptimistic:zt,useMemoCache:zt,useCacheRefresh:zt};bs.useEffectEvent=zt;var ch={readContext:an,use:Nr,useCallback:function(e,t){return bn().memoizedState=[e,t===void 0?null:t],e},useContext:an,useEffect:qf,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,Rr(4194308,4,Zf.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Rr(4194308,4,e,t)},useInsertionEffect:function(e,t){Rr(4,2,e,t)},useMemo:function(e,t){var n=bn();t=t===void 0?null:t;var l=e();if(Zl){Tt(!0);try{e()}finally{Tt(!1)}}return n.memoizedState=[l,t],l},useReducer:function(e,t,n){var l=bn();if(n!==void 0){var o=n(t);if(Zl){Tt(!0);try{n(t)}finally{Tt(!1)}}}else o=t;return l.memoizedState=l.baseState=o,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:o},l.queue=e,e=e.dispatch=Oy.bind(null,Be,e),[l.memoizedState,e]},useRef:function(e){var t=bn();return e={current:e},t.memoizedState=e},useState:function(e){e=Nc(e);var t=e.queue,n=sh.bind(null,Be,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Lc,useDeferredValue:function(e,t){var n=bn();return _c(n,e,t)},useTransition:function(){var e=Nc(!1);return e=th.bind(null,Be,e.queue,!0,!1),bn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var l=Be,o=bn();if(tt){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),wt===null)throw Error(r(349));(We&127)!==0||Rf(l,t,n)}o.memoizedState=n;var c={value:n,getSnapshot:t};return o.queue=c,qf(_f.bind(null,l,c,e),[e]),l.flags|=2048,Ea(9,{destroy:void 0},Lf.bind(null,l,c,n,t),null),n},useId:function(){var e=bn(),t=wt.identifierPrefix;if(tt){var n=yi,l=bi;n=(l&~(1<<32-Ct(l)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Ar++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=Ny++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Dc,useFormState:Yf,useActionState:Yf,useOptimistic:function(e){var t=bn();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Oc.bind(null,Be,!0,n),n.dispatch=t,[e,t]},useMemoCache:Mc,useCacheRefresh:function(){return bn().memoizedState=Dy.bind(null,Be)},useEffectEvent:function(e){var t=bn(),n={impl:e};return t.memoizedState=n,function(){if((rt&2)!==0)throw Error(r(440));return n.impl.apply(void 0,arguments)}}},zc={readContext:an,use:Nr,useCallback:Wf,useContext:an,useEffect:Rc,useImperativeHandle:Qf,useInsertionEffect:Xf,useLayoutEffect:Pf,useMemo:Jf,useReducer:kr,useRef:Ff,useState:function(){return kr(zi)},useDebugValue:Lc,useDeferredValue:function(e,t){var n=Yt();return eh(n,gt.memoizedState,e,t)},useTransition:function(){var e=kr(zi)[0],t=Yt().memoizedState;return[typeof e=="boolean"?e:ps(e),t]},useSyncExternalStore:kf,useId:lh,useHostTransitionStatus:Dc,useFormState:If,useActionState:If,useOptimistic:function(e,t){var n=Yt();return Of(n,gt,e,t)},useMemoCache:Mc,useCacheRefresh:ah};zc.useEffectEvent=Vf;var uh={readContext:an,use:Nr,useCallback:Wf,useContext:an,useEffect:Rc,useImperativeHandle:Qf,useInsertionEffect:Xf,useLayoutEffect:Pf,useMemo:Jf,useReducer:Ec,useRef:Ff,useState:function(){return Ec(zi)},useDebugValue:Lc,useDeferredValue:function(e,t){var n=Yt();return gt===null?_c(n,e,t):eh(n,gt.memoizedState,e,t)},useTransition:function(){var e=Ec(zi)[0],t=Yt().memoizedState;return[typeof e=="boolean"?e:ps(e),t]},useSyncExternalStore:kf,useId:lh,useHostTransitionStatus:Dc,useFormState:$f,useActionState:$f,useOptimistic:function(e,t){var n=Yt();return gt!==null?Of(n,gt,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:Mc,useCacheRefresh:ah};uh.useEffectEvent=Vf;function Uc(e,t,n,l){t=e.memoizedState,n=n(l,t),n=n==null?t:v({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Bc={enqueueSetState:function(e,t,n){e=e._reactInternals;var l=Hn(),o=ul(l);o.payload=t,n!=null&&(o.callback=n),t=dl(e,o,l),t!==null&&(Nn(t,e,l),ds(t,e,l))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var l=Hn(),o=ul(l);o.tag=1,o.payload=t,n!=null&&(o.callback=n),t=dl(e,o,l),t!==null&&(Nn(t,e,l),ds(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Hn(),l=ul(n);l.tag=2,t!=null&&(l.callback=t),t=dl(e,l,n),t!==null&&(Nn(t,e,n),ds(t,e,n))}};function dh(e,t,n,l,o,c,g){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,c,g):t.prototype&&t.prototype.isPureReactComponent?!is(n,l)||!is(o,c):!0}function fh(e,t,n,l){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,l),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,l),t.state!==e&&Bc.enqueueReplaceState(t,t.state,null)}function Ql(e,t){var n=t;if("ref"in t){n={};for(var l in t)l!=="ref"&&(n[l]=t[l])}if(e=e.defaultProps){n===t&&(n=v({},n));for(var o in e)n[o]===void 0&&(n[o]=e[o])}return n}function hh(e){ur(e)}function mh(e){console.error(e)}function ph(e){ur(e)}function jr(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function gh(e,t,n){try{var l=e.onCaughtError;l(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(o){setTimeout(function(){throw o})}}function Hc(e,t,n){return n=ul(n),n.tag=3,n.payload={element:null},n.callback=function(){jr(e,t)},n}function bh(e){return e=ul(e),e.tag=3,e}function yh(e,t,n,l){var o=n.type.getDerivedStateFromError;if(typeof o=="function"){var c=l.value;e.payload=function(){return o(c)},e.callback=function(){gh(t,n,l)}}var g=n.stateNode;g!==null&&typeof g.componentDidCatch=="function"&&(e.callback=function(){gh(t,n,l),typeof o!="function"&&(bl===null?bl=new Set([this]):bl.add(this));var x=l.stack;this.componentDidCatch(l.value,{componentStack:x!==null?x:""})})}function zy(e,t,n,l,o){if(n.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=n.alternate,t!==null&&va(t,n,o,!0),n=On.current,n!==null){switch(n.tag){case 31:case 13:return Jn===null?Fr():n.alternate===null&&Ut===0&&(Ut=3),n.flags&=-257,n.flags|=65536,n.lanes=o,l===xr?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([l]):t.add(l),uu(e,l,o)),!1;case 22:return n.flags|=65536,l===xr?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([l])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([l]):n.add(l)),uu(e,l,o)),!1}throw Error(r(435,n.tag))}return uu(e,l,o),Fr(),!1}if(tt)return t=On.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=o,l!==lc&&(e=Error(r(422),{cause:l}),ss(Pn(e,n)))):(l!==lc&&(t=Error(r(423),{cause:l}),ss(Pn(t,n))),e=e.current.alternate,e.flags|=65536,o&=-o,e.lanes|=o,l=Pn(l,n),o=Hc(e.stateNode,l,o),pc(e,o),Ut!==4&&(Ut=2)),!1;var c=Error(r(520),{cause:l});if(c=Pn(c,n),Ms===null?Ms=[c]:Ms.push(c),Ut!==4&&(Ut=2),t===null)return!0;l=Pn(l,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=o&-o,n.lanes|=e,e=Hc(n.stateNode,l,e),pc(n,e),!1;case 1:if(t=n.type,c=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||c!==null&&typeof c.componentDidCatch=="function"&&(bl===null||!bl.has(c))))return n.flags|=65536,o&=-o,n.lanes|=o,o=bh(o),yh(o,e,n,l),pc(n,o),!1}n=n.return}while(n!==null);return!1}var Kc=Error(r(461)),$t=!1;function sn(e,t,n,l){t.child=e===null?Sf(t,null,n,l):Pl(t,e.child,n,l)}function vh(e,t,n,l,o){n=n.render;var c=t.ref;if("ref"in l){var g={};for(var x in l)x!=="ref"&&(g[x]=l[x])}else g=l;return Fl(t),l=wc(e,t,n,g,c,o),x=Sc(),e!==null&&!$t?(Cc(e,t,o),Ui(e,t,o)):(tt&&x&&nc(t),t.flags|=1,sn(e,t,l,o),t.child)}function xh(e,t,n,l,o){if(e===null){var c=n.type;return typeof c=="function"&&!Jo(c)&&c.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=c,wh(e,t,c,l,o)):(e=mr(n.type,null,l,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(c=e.child,!Xc(e,o)){var g=c.memoizedProps;if(n=n.compare,n=n!==null?n:is,n(g,l)&&e.ref===t.ref)return Ui(e,t,o)}return t.flags|=1,e=Li(c,l),e.ref=t.ref,e.return=t,t.child=e}function wh(e,t,n,l,o){if(e!==null){var c=e.memoizedProps;if(is(c,l)&&e.ref===t.ref)if($t=!1,t.pendingProps=l=c,Xc(e,o))(e.flags&131072)!==0&&($t=!0);else return t.lanes=e.lanes,Ui(e,t,o)}return Yc(e,t,n,l,o)}function Sh(e,t,n,l){var o=l.children,c=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((t.flags&128)!==0){if(c=c!==null?c.baseLanes|n:n,e!==null){for(l=t.child=e.child,o=0;l!==null;)o=o|l.lanes|l.childLanes,l=l.sibling;l=o&~c}else l=0,t.child=null;return Ch(e,t,c,n,l)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&yr(t,c!==null?c.cachePool:null),c!==null?Mf(t,c):bc(),Af(t);else return l=t.lanes=536870912,Ch(e,t,c!==null?c.baseLanes|n:n,n,l)}else c!==null?(yr(t,c.cachePool),Mf(t,c),hl(),t.memoizedState=null):(e!==null&&yr(t,null),bc(),hl());return sn(e,t,o,n),t.child}function ys(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Ch(e,t,n,l,o){var c=dc();return c=c===null?null:{parent:It._currentValue,pool:c},t.memoizedState={baseLanes:n,cachePool:c},e!==null&&yr(t,null),bc(),Af(t),e!==null&&va(e,t,l,!0),t.childLanes=o,null}function Dr(e,t){return t=zr({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Th(e,t,n){return Pl(t,e.child,null,n),e=Dr(t,t.pendingProps),e.flags|=2,zn(t),t.memoizedState=null,e}function Uy(e,t,n){var l=t.pendingProps,o=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(tt){if(l.mode==="hidden")return e=Dr(t,l),t.lanes=536870912,ys(null,e);if(vc(t),(e=At)?(e=zm(e,Wn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:al!==null?{id:bi,overflow:yi}:null,retryLane:536870912,hydrationErrors:null},n=rf(e),n.return=t,t.child=n,ln=t,At=null)):e=null,e===null)throw rl(t);return t.lanes=536870912,null}return Dr(t,l)}var c=e.memoizedState;if(c!==null){var g=c.dehydrated;if(vc(t),o)if(t.flags&256)t.flags&=-257,t=Th(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(r(558));else if($t||va(e,t,n,!1),o=(n&e.childLanes)!==0,$t||o){if(l=wt,l!==null&&(g=Pi(l,n),g!==0&&g!==c.retryLane))throw c.retryLane=g,Yl(e,g),Nn(l,e,g),Kc;Fr(),t=Th(e,t,n)}else e=c.treeContext,At=ei(g.nextSibling),ln=t,tt=!0,sl=null,Wn=!1,e!==null&&uf(t,e),t=Dr(t,l),t.flags|=4096;return t}return e=Li(e.child,{mode:l.mode,children:l.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Or(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!="function"&&typeof n!="object")throw Error(r(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function Yc(e,t,n,l,o){return Fl(t),n=wc(e,t,n,l,void 0,o),l=Sc(),e!==null&&!$t?(Cc(e,t,o),Ui(e,t,o)):(tt&&l&&nc(t),t.flags|=1,sn(e,t,n,o),t.child)}function Mh(e,t,n,l,o,c){return Fl(t),t.updateQueue=null,n=Nf(t,l,n,o),Ef(e),l=Sc(),e!==null&&!$t?(Cc(e,t,c),Ui(e,t,c)):(tt&&l&&nc(t),t.flags|=1,sn(e,t,n,c),t.child)}function Ah(e,t,n,l,o){if(Fl(t),t.stateNode===null){var c=pa,g=n.contextType;typeof g=="object"&&g!==null&&(c=an(g)),c=new n(l,c),t.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,c.updater=Bc,t.stateNode=c,c._reactInternals=t,c=t.stateNode,c.props=l,c.state=t.memoizedState,c.refs={},hc(t),g=n.contextType,c.context=typeof g=="object"&&g!==null?an(g):pa,c.state=t.memoizedState,g=n.getDerivedStateFromProps,typeof g=="function"&&(Uc(t,n,g,l),c.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof c.getSnapshotBeforeUpdate=="function"||typeof c.UNSAFE_componentWillMount!="function"&&typeof c.componentWillMount!="function"||(g=c.state,typeof c.componentWillMount=="function"&&c.componentWillMount(),typeof c.UNSAFE_componentWillMount=="function"&&c.UNSAFE_componentWillMount(),g!==c.state&&Bc.enqueueReplaceState(c,c.state,null),hs(t,l,c,o),fs(),c.state=t.memoizedState),typeof c.componentDidMount=="function"&&(t.flags|=4194308),l=!0}else if(e===null){c=t.stateNode;var x=t.memoizedProps,C=Ql(n,x);c.props=C;var D=c.context,X=n.contextType;g=pa,typeof X=="object"&&X!==null&&(g=an(X));var Q=n.getDerivedStateFromProps;X=typeof Q=="function"||typeof c.getSnapshotBeforeUpdate=="function",x=t.pendingProps!==x,X||typeof c.UNSAFE_componentWillReceiveProps!="function"&&typeof c.componentWillReceiveProps!="function"||(x||D!==g)&&fh(t,c,l,g),cl=!1;var O=t.memoizedState;c.state=O,hs(t,l,c,o),fs(),D=t.memoizedState,x||O!==D||cl?(typeof Q=="function"&&(Uc(t,n,Q,l),D=t.memoizedState),(C=cl||dh(t,n,C,l,O,D,g))?(X||typeof c.UNSAFE_componentWillMount!="function"&&typeof c.componentWillMount!="function"||(typeof c.componentWillMount=="function"&&c.componentWillMount(),typeof c.UNSAFE_componentWillMount=="function"&&c.UNSAFE_componentWillMount()),typeof c.componentDidMount=="function"&&(t.flags|=4194308)):(typeof c.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=D),c.props=l,c.state=D,c.context=g,l=C):(typeof c.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{c=t.stateNode,mc(e,t),g=t.memoizedProps,X=Ql(n,g),c.props=X,Q=t.pendingProps,O=c.context,D=n.contextType,C=pa,typeof D=="object"&&D!==null&&(C=an(D)),x=n.getDerivedStateFromProps,(D=typeof x=="function"||typeof c.getSnapshotBeforeUpdate=="function")||typeof c.UNSAFE_componentWillReceiveProps!="function"&&typeof c.componentWillReceiveProps!="function"||(g!==Q||O!==C)&&fh(t,c,l,C),cl=!1,O=t.memoizedState,c.state=O,hs(t,l,c,o),fs();var I=t.memoizedState;g!==Q||O!==I||cl||e!==null&&e.dependencies!==null&&gr(e.dependencies)?(typeof x=="function"&&(Uc(t,n,x,l),I=t.memoizedState),(X=cl||dh(t,n,X,l,O,I,C)||e!==null&&e.dependencies!==null&&gr(e.dependencies))?(D||typeof c.UNSAFE_componentWillUpdate!="function"&&typeof c.componentWillUpdate!="function"||(typeof c.componentWillUpdate=="function"&&c.componentWillUpdate(l,I,C),typeof c.UNSAFE_componentWillUpdate=="function"&&c.UNSAFE_componentWillUpdate(l,I,C)),typeof c.componentDidUpdate=="function"&&(t.flags|=4),typeof c.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof c.componentDidUpdate!="function"||g===e.memoizedProps&&O===e.memoizedState||(t.flags|=4),typeof c.getSnapshotBeforeUpdate!="function"||g===e.memoizedProps&&O===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=I),c.props=l,c.state=I,c.context=C,l=X):(typeof c.componentDidUpdate!="function"||g===e.memoizedProps&&O===e.memoizedState||(t.flags|=4),typeof c.getSnapshotBeforeUpdate!="function"||g===e.memoizedProps&&O===e.memoizedState||(t.flags|=1024),l=!1)}return c=l,Or(e,t),l=(t.flags&128)!==0,c||l?(c=t.stateNode,n=l&&typeof n.getDerivedStateFromError!="function"?null:c.render(),t.flags|=1,e!==null&&l?(t.child=Pl(t,e.child,null,o),t.child=Pl(t,null,n,o)):sn(e,t,n,o),t.memoizedState=c.state,e=t.child):e=Ui(e,t,o),e}function Eh(e,t,n,l){return Gl(),t.flags|=256,sn(e,t,n,l),t.child}var Ic={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Gc(e){return{baseLanes:e,cachePool:gf()}}function $c(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Bn),e}function Nh(e,t,n){var l=t.pendingProps,o=!1,c=(t.flags&128)!==0,g;if((g=c)||(g=e!==null&&e.memoizedState===null?!1:(Kt.current&2)!==0),g&&(o=!0,t.flags&=-129),g=(t.flags&32)!==0,t.flags&=-33,e===null){if(tt){if(o?fl(t):hl(),(e=At)?(e=zm(e,Wn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:al!==null?{id:bi,overflow:yi}:null,retryLane:536870912,hydrationErrors:null},n=rf(e),n.return=t,t.child=n,ln=t,At=null)):e=null,e===null)throw rl(t);return Au(e)?t.lanes=32:t.lanes=536870912,null}var x=l.children;return l=l.fallback,o?(hl(),o=t.mode,x=zr({mode:"hidden",children:x},o),l=Il(l,o,n,null),x.return=t,l.return=t,x.sibling=l,t.child=x,l=t.child,l.memoizedState=Gc(n),l.childLanes=$c(e,g,n),t.memoizedState=Ic,ys(null,l)):(fl(t),Fc(t,x))}var C=e.memoizedState;if(C!==null&&(x=C.dehydrated,x!==null)){if(c)t.flags&256?(fl(t),t.flags&=-257,t=qc(e,t,n)):t.memoizedState!==null?(hl(),t.child=e.child,t.flags|=128,t=null):(hl(),x=l.fallback,o=t.mode,l=zr({mode:"visible",children:l.children},o),x=Il(x,o,n,null),x.flags|=2,l.return=t,x.return=t,l.sibling=x,t.child=l,Pl(t,e.child,null,n),l=t.child,l.memoizedState=Gc(n),l.childLanes=$c(e,g,n),t.memoizedState=Ic,t=ys(null,l));else if(fl(t),Au(x)){if(g=x.nextSibling&&x.nextSibling.dataset,g)var D=g.dgst;g=D,l=Error(r(419)),l.stack="",l.digest=g,ss({value:l,source:null,stack:null}),t=qc(e,t,n)}else if($t||va(e,t,n,!1),g=(n&e.childLanes)!==0,$t||g){if(g=wt,g!==null&&(l=Pi(g,n),l!==0&&l!==C.retryLane))throw C.retryLane=l,Yl(e,l),Nn(g,e,l),Kc;Mu(x)||Fr(),t=qc(e,t,n)}else Mu(x)?(t.flags|=192,t.child=e.child,t=null):(e=C.treeContext,At=ei(x.nextSibling),ln=t,tt=!0,sl=null,Wn=!1,e!==null&&uf(t,e),t=Fc(t,l.children),t.flags|=4096);return t}return o?(hl(),x=l.fallback,o=t.mode,C=e.child,D=C.sibling,l=Li(C,{mode:"hidden",children:l.children}),l.subtreeFlags=C.subtreeFlags&65011712,D!==null?x=Li(D,x):(x=Il(x,o,n,null),x.flags|=2),x.return=t,l.return=t,l.sibling=x,t.child=l,ys(null,l),l=t.child,x=e.child.memoizedState,x===null?x=Gc(n):(o=x.cachePool,o!==null?(C=It._currentValue,o=o.parent!==C?{parent:C,pool:C}:o):o=gf(),x={baseLanes:x.baseLanes|n,cachePool:o}),l.memoizedState=x,l.childLanes=$c(e,g,n),t.memoizedState=Ic,ys(e.child,l)):(fl(t),n=e.child,e=n.sibling,n=Li(n,{mode:"visible",children:l.children}),n.return=t,n.sibling=null,e!==null&&(g=t.deletions,g===null?(t.deletions=[e],t.flags|=16):g.push(e)),t.child=n,t.memoizedState=null,n)}function Fc(e,t){return t=zr({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function zr(e,t){return e=Dn(22,e,null,t),e.lanes=0,e}function qc(e,t,n){return Pl(t,e.child,null,n),e=Fc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function kh(e,t,n){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),rc(e.return,t,n)}function Vc(e,t,n,l,o,c){var g=e.memoizedState;g===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:n,tailMode:o,treeForkCount:c}:(g.isBackwards=t,g.rendering=null,g.renderingStartTime=0,g.last=l,g.tail=n,g.tailMode=o,g.treeForkCount=c)}function Rh(e,t,n){var l=t.pendingProps,o=l.revealOrder,c=l.tail;l=l.children;var g=Kt.current,x=(g&2)!==0;if(x?(g=g&1|2,t.flags|=128):g&=1,Re(Kt,g),sn(e,t,l,n),l=tt?as:0,!x&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&kh(e,n,t);else if(e.tag===19)kh(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(o){case"forwards":for(n=t.child,o=null;n!==null;)e=n.alternate,e!==null&&Tr(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),Vc(t,!1,o,n,c,l);break;case"backwards":case"unstable_legacy-backwards":for(n=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&Tr(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}Vc(t,!0,n,null,c,l);break;case"together":Vc(t,!1,null,null,void 0,l);break;default:t.memoizedState=null}return t.child}function Ui(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),gl|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(va(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(r(153));if(t.child!==null){for(e=t.child,n=Li(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Li(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Xc(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&gr(e)))}function By(e,t,n){switch(t.tag){case 3:jt(t,t.stateNode.containerInfo),ol(t,It,e.memoizedState.cache),Gl();break;case 27:case 5:qt(t);break;case 4:jt(t,t.stateNode.containerInfo);break;case 10:ol(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,vc(t),null;break;case 13:var l=t.memoizedState;if(l!==null)return l.dehydrated!==null?(fl(t),t.flags|=128,null):(n&t.child.childLanes)!==0?Nh(e,t,n):(fl(t),e=Ui(e,t,n),e!==null?e.sibling:null);fl(t);break;case 19:var o=(e.flags&128)!==0;if(l=(n&t.childLanes)!==0,l||(va(e,t,n,!1),l=(n&t.childLanes)!==0),o){if(l)return Rh(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),Re(Kt,Kt.current),l)break;return null;case 22:return t.lanes=0,Sh(e,t,n,t.pendingProps);case 24:ol(t,It,e.memoizedState.cache)}return Ui(e,t,n)}function Lh(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)$t=!0;else{if(!Xc(e,n)&&(t.flags&128)===0)return $t=!1,By(e,t,n);$t=(e.flags&131072)!==0}else $t=!1,tt&&(t.flags&1048576)!==0&&cf(t,as,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=Vl(t.elementType),t.type=e,typeof e=="function")Jo(e)?(l=Ql(e,l),t.tag=1,t=Ah(null,t,e,l,n)):(t.tag=0,t=Yc(null,t,e,l,n));else{if(e!=null){var o=e.$$typeof;if(o===ae){t.tag=11,t=vh(null,t,e,l,n);break e}else if(o===F){t.tag=14,t=xh(null,t,e,l,n);break e}}throw t=nt(e)||e,Error(r(306,t,""))}}return t;case 0:return Yc(e,t,t.type,t.pendingProps,n);case 1:return l=t.type,o=Ql(l,t.pendingProps),Ah(e,t,l,o,n);case 3:e:{if(jt(t,t.stateNode.containerInfo),e===null)throw Error(r(387));l=t.pendingProps;var c=t.memoizedState;o=c.element,mc(e,t),hs(t,l,null,n);var g=t.memoizedState;if(l=g.cache,ol(t,It,l),l!==c.cache&&oc(t,[It],n,!0),fs(),l=g.element,c.isDehydrated)if(c={element:l,isDehydrated:!1,cache:g.cache},t.updateQueue.baseState=c,t.memoizedState=c,t.flags&256){t=Eh(e,t,l,n);break e}else if(l!==o){o=Pn(Error(r(424)),t),ss(o),t=Eh(e,t,l,n);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(At=ei(e.firstChild),ln=t,tt=!0,sl=null,Wn=!0,n=Sf(t,null,l,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Gl(),l===o){t=Ui(e,t,n);break e}sn(e,t,l,n)}t=t.child}return t;case 26:return Or(e,t),e===null?(n=Im(t.type,null,t.pendingProps,null))?t.memoizedState=n:tt||(n=t.type,e=t.pendingProps,l=Wr(Xe.current).createElement(n),l[Ht]=t,l[Qt]=e,rn(l,n,e),_t(l),t.stateNode=l):t.memoizedState=Im(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return qt(t),e===null&&tt&&(l=t.stateNode=Hm(t.type,t.pendingProps,Xe.current),ln=t,Wn=!0,o=At,wl(t.type)?(Eu=o,At=ei(l.firstChild)):At=o),sn(e,t,t.pendingProps.children,n),Or(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&tt&&((o=l=At)&&(l=m0(l,t.type,t.pendingProps,Wn),l!==null?(t.stateNode=l,ln=t,At=ei(l.firstChild),Wn=!1,o=!0):o=!1),o||rl(t)),qt(t),o=t.type,c=t.pendingProps,g=e!==null?e.memoizedProps:null,l=c.children,Su(o,c)?l=null:g!==null&&Su(o,g)&&(t.flags|=32),t.memoizedState!==null&&(o=wc(e,t,ky,null,null,n),js._currentValue=o),Or(e,t),sn(e,t,l,n),t.child;case 6:return e===null&&tt&&((e=n=At)&&(n=p0(n,t.pendingProps,Wn),n!==null?(t.stateNode=n,ln=t,At=null,e=!0):e=!1),e||rl(t)),null;case 13:return Nh(e,t,n);case 4:return jt(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=Pl(t,null,l,n):sn(e,t,l,n),t.child;case 11:return vh(e,t,t.type,t.pendingProps,n);case 7:return sn(e,t,t.pendingProps,n),t.child;case 8:return sn(e,t,t.pendingProps.children,n),t.child;case 12:return sn(e,t,t.pendingProps.children,n),t.child;case 10:return l=t.pendingProps,ol(t,t.type,l.value),sn(e,t,l.children,n),t.child;case 9:return o=t.type._context,l=t.pendingProps.children,Fl(t),o=an(o),l=l(o),t.flags|=1,sn(e,t,l,n),t.child;case 14:return xh(e,t,t.type,t.pendingProps,n);case 15:return wh(e,t,t.type,t.pendingProps,n);case 19:return Rh(e,t,n);case 31:return Uy(e,t,n);case 22:return Sh(e,t,n,t.pendingProps);case 24:return Fl(t),l=an(It),e===null?(o=dc(),o===null&&(o=wt,c=cc(),o.pooledCache=c,c.refCount++,c!==null&&(o.pooledCacheLanes|=n),o=c),t.memoizedState={parent:l,cache:o},hc(t),ol(t,It,o)):((e.lanes&n)!==0&&(mc(e,t),hs(t,null,null,n),fs()),o=e.memoizedState,c=t.memoizedState,o.parent!==l?(o={parent:l,cache:l},t.memoizedState=o,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=o),ol(t,It,l)):(l=c.cache,ol(t,It,l),l!==o.cache&&oc(t,[It],n,!0))),sn(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(r(156,t.tag))}function Bi(e){e.flags|=4}function Pc(e,t,n,l,o){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(o&335544128)===o)if(e.stateNode.complete)e.flags|=8192;else if(lm())e.flags|=8192;else throw Xl=xr,fc}else e.flags&=-16777217}function _h(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Vm(t))if(lm())e.flags|=8192;else throw Xl=xr,fc}function Ur(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Lt():536870912,e.lanes|=t,La|=t)}function vs(e,t){if(!tt)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var l=null;n!==null;)n.alternate!==null&&(l=n),n=n.sibling;l===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function Et(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,l=0;if(t)for(var o=e.child;o!==null;)n|=o.lanes|o.childLanes,l|=o.subtreeFlags&65011712,l|=o.flags&65011712,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)n|=o.lanes|o.childLanes,l|=o.subtreeFlags,l|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=l,e.childLanes=n,t}function Hy(e,t,n){var l=t.pendingProps;switch(ic(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Et(t),null;case 1:return Et(t),null;case 3:return n=t.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),Di(It),Fe(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(ya(t)?Bi(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,ac())),Et(t),null;case 26:var o=t.type,c=t.memoizedState;return e===null?(Bi(t),c!==null?(Et(t),_h(t,c)):(Et(t),Pc(t,o,null,l,n))):c?c!==e.memoizedState?(Bi(t),Et(t),_h(t,c)):(Et(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&Bi(t),Et(t),Pc(t,o,e,l,n)),null;case 27:if(St(t),n=Xe.current,o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&Bi(t);else{if(!l){if(t.stateNode===null)throw Error(r(166));return Et(t),null}e=Oe.current,ya(t)?df(t):(e=Hm(o,l,n),t.stateNode=e,Bi(t))}return Et(t),null;case 5:if(St(t),o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&Bi(t);else{if(!l){if(t.stateNode===null)throw Error(r(166));return Et(t),null}if(c=Oe.current,ya(t))df(t);else{var g=Wr(Xe.current);switch(c){case 1:c=g.createElementNS("http://www.w3.org/2000/svg",o);break;case 2:c=g.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;default:switch(o){case"svg":c=g.createElementNS("http://www.w3.org/2000/svg",o);break;case"math":c=g.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;case"script":c=g.createElement("div"),c.innerHTML="<script><\/script>",c=c.removeChild(c.firstChild);break;case"select":c=typeof l.is=="string"?g.createElement("select",{is:l.is}):g.createElement("select"),l.multiple?c.multiple=!0:l.size&&(c.size=l.size);break;default:c=typeof l.is=="string"?g.createElement(o,{is:l.is}):g.createElement(o)}}c[Ht]=t,c[Qt]=l;e:for(g=t.child;g!==null;){if(g.tag===5||g.tag===6)c.appendChild(g.stateNode);else if(g.tag!==4&&g.tag!==27&&g.child!==null){g.child.return=g,g=g.child;continue}if(g===t)break e;for(;g.sibling===null;){if(g.return===null||g.return===t)break e;g=g.return}g.sibling.return=g.return,g=g.sibling}t.stateNode=c;e:switch(rn(c,o,l),o){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&Bi(t)}}return Et(t),Pc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&Bi(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(r(166));if(e=Xe.current,ya(t)){if(e=t.stateNode,n=t.memoizedProps,l=null,o=ln,o!==null)switch(o.tag){case 27:case 5:l=o.memoizedProps}e[Ht]=t,e=!!(e.nodeValue===n||l!==null&&l.suppressHydrationWarning===!0||Nm(e.nodeValue,n)),e||rl(t,!0)}else e=Wr(e).createTextNode(l),e[Ht]=t,t.stateNode=e}return Et(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(l=ya(t),n!==null){if(e===null){if(!l)throw Error(r(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(557));e[Ht]=t}else Gl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Et(t),e=!1}else n=ac(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(zn(t),t):(zn(t),null);if((t.flags&128)!==0)throw Error(r(558))}return Et(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(o=ya(t),l!==null&&l.dehydrated!==null){if(e===null){if(!o)throw Error(r(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));o[Ht]=t}else Gl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Et(t),o=!1}else o=ac(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=o),o=!0;if(!o)return t.flags&256?(zn(t),t):(zn(t),null)}return zn(t),(t.flags&128)!==0?(t.lanes=n,t):(n=l!==null,e=e!==null&&e.memoizedState!==null,n&&(l=t.child,o=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(o=l.alternate.memoizedState.cachePool.pool),c=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(c=l.memoizedState.cachePool.pool),c!==o&&(l.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Ur(t,t.updateQueue),Et(t),null);case 4:return Fe(),e===null&&bu(t.stateNode.containerInfo),Et(t),null;case 10:return Di(t.type),Et(t),null;case 19:if(Ue(Kt),l=t.memoizedState,l===null)return Et(t),null;if(o=(t.flags&128)!==0,c=l.rendering,c===null)if(o)vs(l,!1);else{if(Ut!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(c=Tr(e),c!==null){for(t.flags|=128,vs(l,!1),e=c.updateQueue,t.updateQueue=e,Ur(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)sf(n,e),n=n.sibling;return Re(Kt,Kt.current&1|2),tt&&_i(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&oe()>Ir&&(t.flags|=128,o=!0,vs(l,!1),t.lanes=4194304)}else{if(!o)if(e=Tr(c),e!==null){if(t.flags|=128,o=!0,e=e.updateQueue,t.updateQueue=e,Ur(t,e),vs(l,!0),l.tail===null&&l.tailMode==="hidden"&&!c.alternate&&!tt)return Et(t),null}else 2*oe()-l.renderingStartTime>Ir&&n!==536870912&&(t.flags|=128,o=!0,vs(l,!1),t.lanes=4194304);l.isBackwards?(c.sibling=t.child,t.child=c):(e=l.last,e!==null?e.sibling=c:t.child=c,l.last=c)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=oe(),e.sibling=null,n=Kt.current,Re(Kt,o?n&1|2:n&1),tt&&_i(t,l.treeForkCount),e):(Et(t),null);case 22:case 23:return zn(t),yc(),l=t.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?(n&536870912)!==0&&(t.flags&128)===0&&(Et(t),t.subtreeFlags&6&&(t.flags|=8192)):Et(t),n=t.updateQueue,n!==null&&Ur(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==n&&(t.flags|=2048),e!==null&&Ue(ql),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Di(It),Et(t),null;case 25:return null;case 30:return null}throw Error(r(156,t.tag))}function Ky(e,t){switch(ic(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Di(It),Fe(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return St(t),null;case 31:if(t.memoizedState!==null){if(zn(t),t.alternate===null)throw Error(r(340));Gl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(zn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Gl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ue(Kt),null;case 4:return Fe(),null;case 10:return Di(t.type),null;case 22:case 23:return zn(t),yc(),e!==null&&Ue(ql),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Di(It),null;case 25:return null;default:return null}}function jh(e,t){switch(ic(t),t.tag){case 3:Di(It),Fe();break;case 26:case 27:case 5:St(t);break;case 4:Fe();break;case 31:t.memoizedState!==null&&zn(t);break;case 13:zn(t);break;case 19:Ue(Kt);break;case 10:Di(t.type);break;case 22:case 23:zn(t),yc(),e!==null&&Ue(ql);break;case 24:Di(It)}}function xs(e,t){try{var n=t.updateQueue,l=n!==null?n.lastEffect:null;if(l!==null){var o=l.next;n=o;do{if((n.tag&e)===e){l=void 0;var c=n.create,g=n.inst;l=c(),g.destroy=l}n=n.next}while(n!==o)}}catch(x){ht(t,t.return,x)}}function ml(e,t,n){try{var l=t.updateQueue,o=l!==null?l.lastEffect:null;if(o!==null){var c=o.next;l=c;do{if((l.tag&e)===e){var g=l.inst,x=g.destroy;if(x!==void 0){g.destroy=void 0,o=t;var C=n,D=x;try{D()}catch(X){ht(o,C,X)}}}l=l.next}while(l!==c)}}catch(X){ht(t,t.return,X)}}function Dh(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Tf(t,n)}catch(l){ht(e,e.return,l)}}}function Oh(e,t,n){n.props=Ql(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(l){ht(e,t,l)}}function ws(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof n=="function"?e.refCleanup=n(l):n.current=l}}catch(o){ht(e,t,o)}}function vi(e,t){var n=e.ref,l=e.refCleanup;if(n!==null)if(typeof l=="function")try{l()}catch(o){ht(e,t,o)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(o){ht(e,t,o)}else n.current=null}function zh(e){var t=e.type,n=e.memoizedProps,l=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&l.focus();break e;case"img":n.src?l.src=n.src:n.srcSet&&(l.srcset=n.srcSet)}}catch(o){ht(e,e.return,o)}}function Zc(e,t,n){try{var l=e.stateNode;o0(l,e.type,n,t),l[Qt]=t}catch(o){ht(e,e.return,o)}}function Uh(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&wl(e.type)||e.tag===4}function Qc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Uh(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&&wl(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 Wc(e,t,n){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Vt));else if(l!==4&&(l===27&&wl(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Wc(e,t,n),e=e.sibling;e!==null;)Wc(e,t,n),e=e.sibling}function Br(e,t,n){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(l!==4&&(l===27&&wl(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Br(e,t,n),e=e.sibling;e!==null;)Br(e,t,n),e=e.sibling}function Bh(e){var t=e.stateNode,n=e.memoizedProps;try{for(var l=e.type,o=t.attributes;o.length;)t.removeAttributeNode(o[0]);rn(t,l,n),t[Ht]=e,t[Qt]=n}catch(c){ht(e,e.return,c)}}var Hi=!1,Ft=!1,Jc=!1,Hh=typeof WeakSet=="function"?WeakSet:Set,Jt=null;function Yy(e,t){if(e=e.containerInfo,xu=ao,e=Zd(e),qo(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var l=n.getSelection&&n.getSelection();if(l&&l.rangeCount!==0){n=l.anchorNode;var o=l.anchorOffset,c=l.focusNode;l=l.focusOffset;try{n.nodeType,c.nodeType}catch{n=null;break e}var g=0,x=-1,C=-1,D=0,X=0,Q=e,O=null;t:for(;;){for(var I;Q!==n||o!==0&&Q.nodeType!==3||(x=g+o),Q!==c||l!==0&&Q.nodeType!==3||(C=g+l),Q.nodeType===3&&(g+=Q.nodeValue.length),(I=Q.firstChild)!==null;)O=Q,Q=I;for(;;){if(Q===e)break t;if(O===n&&++D===o&&(x=g),O===c&&++X===l&&(C=g),(I=Q.nextSibling)!==null)break;Q=O,O=Q.parentNode}Q=I}n=x===-1||C===-1?null:{start:x,end:C}}else n=null}n=n||{start:0,end:0}}else n=null;for(wu={focusedElem:e,selectionRange:n},ao=!1,Jt=t;Jt!==null;)if(t=Jt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Jt=e;else for(;Jt!==null;){switch(t=Jt,c=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n<e.length;n++)o=e[n],o.ref.impl=o.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&c!==null){e=void 0,n=t,o=c.memoizedProps,c=c.memoizedState,l=n.stateNode;try{var be=Ql(n.type,o);e=l.getSnapshotBeforeUpdate(be,c),l.__reactInternalSnapshotBeforeUpdate=e}catch(Ne){ht(n,n.return,Ne)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)Tu(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Tu(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(r(163))}if(e=t.sibling,e!==null){e.return=t.return,Jt=e;break}Jt=t.return}}function Kh(e,t,n){var l=n.flags;switch(n.tag){case 0:case 11:case 15:Yi(e,n),l&4&&xs(5,n);break;case 1:if(Yi(e,n),l&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(g){ht(n,n.return,g)}else{var o=Ql(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(o,t,e.__reactInternalSnapshotBeforeUpdate)}catch(g){ht(n,n.return,g)}}l&64&&Dh(n),l&512&&ws(n,n.return);break;case 3:if(Yi(e,n),l&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Tf(e,t)}catch(g){ht(n,n.return,g)}}break;case 27:t===null&&l&4&&Bh(n);case 26:case 5:Yi(e,n),t===null&&l&4&&zh(n),l&512&&ws(n,n.return);break;case 12:Yi(e,n);break;case 31:Yi(e,n),l&4&&Gh(e,n);break;case 13:Yi(e,n),l&4&&$h(e,n),l&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Zy.bind(null,n),g0(e,n))));break;case 22:if(l=n.memoizedState!==null||Hi,!l){t=t!==null&&t.memoizedState!==null||Ft,o=Hi;var c=Ft;Hi=l,(Ft=t)&&!c?Ii(e,n,(n.subtreeFlags&8772)!==0):Yi(e,n),Hi=o,Ft=c}break;case 30:break;default:Yi(e,n)}}function Yh(e){var t=e.alternate;t!==null&&(e.alternate=null,Yh(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&ki(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Rt=null,Tn=!1;function Ki(e,t,n){for(n=n.child;n!==null;)Ih(e,t,n),n=n.sibling}function Ih(e,t,n){if(ut&&typeof ut.onCommitFiberUnmount=="function")try{ut.onCommitFiberUnmount(Zt,n)}catch{}switch(n.tag){case 26:Ft||vi(n,t),Ki(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Ft||vi(n,t);var l=Rt,o=Tn;wl(n.type)&&(Rt=n.stateNode,Tn=!1),Ki(e,t,n),Rs(n.stateNode),Rt=l,Tn=o;break;case 5:Ft||vi(n,t);case 6:if(l=Rt,o=Tn,Rt=null,Ki(e,t,n),Rt=l,Tn=o,Rt!==null)if(Tn)try{(Rt.nodeType===9?Rt.body:Rt.nodeName==="HTML"?Rt.ownerDocument.body:Rt).removeChild(n.stateNode)}catch(c){ht(n,t,c)}else try{Rt.removeChild(n.stateNode)}catch(c){ht(n,t,c)}break;case 18:Rt!==null&&(Tn?(e=Rt,Dm(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Ha(e)):Dm(Rt,n.stateNode));break;case 4:l=Rt,o=Tn,Rt=n.stateNode.containerInfo,Tn=!0,Ki(e,t,n),Rt=l,Tn=o;break;case 0:case 11:case 14:case 15:ml(2,n,t),Ft||ml(4,n,t),Ki(e,t,n);break;case 1:Ft||(vi(n,t),l=n.stateNode,typeof l.componentWillUnmount=="function"&&Oh(n,t,l)),Ki(e,t,n);break;case 21:Ki(e,t,n);break;case 22:Ft=(l=Ft)||n.memoizedState!==null,Ki(e,t,n),Ft=l;break;default:Ki(e,t,n)}}function Gh(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Ha(e)}catch(n){ht(t,t.return,n)}}}function $h(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Ha(e)}catch(n){ht(t,t.return,n)}}function Iy(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Hh),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Hh),t;default:throw Error(r(435,e.tag))}}function Hr(e,t){var n=Iy(e);t.forEach(function(l){if(!n.has(l)){n.add(l);var o=Qy.bind(null,e,l);l.then(o,o)}})}function Mn(e,t){var n=t.deletions;if(n!==null)for(var l=0;l<n.length;l++){var o=n[l],c=e,g=t,x=g;e:for(;x!==null;){switch(x.tag){case 27:if(wl(x.type)){Rt=x.stateNode,Tn=!1;break e}break;case 5:Rt=x.stateNode,Tn=!1;break e;case 3:case 4:Rt=x.stateNode.containerInfo,Tn=!0;break e}x=x.return}if(Rt===null)throw Error(r(160));Ih(c,g,o),Rt=null,Tn=!1,c=o.alternate,c!==null&&(c.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Fh(t,e),t=t.sibling}var ci=null;function Fh(e,t){var n=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Mn(t,e),An(e),l&4&&(ml(3,e,e.return),xs(3,e),ml(5,e,e.return));break;case 1:Mn(t,e),An(e),l&512&&(Ft||n===null||vi(n,n.return)),l&64&&Hi&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?l:n.concat(l))));break;case 26:var o=ci;if(Mn(t,e),An(e),l&512&&(Ft||n===null||vi(n,n.return)),l&4){var c=n!==null?n.memoizedState:null;if(l=e.memoizedState,n===null)if(l===null)if(e.stateNode===null){e:{l=e.type,n=e.memoizedProps,o=o.ownerDocument||o;t:switch(l){case"title":c=o.getElementsByTagName("title")[0],(!c||c[dn]||c[Ht]||c.namespaceURI==="http://www.w3.org/2000/svg"||c.hasAttribute("itemprop"))&&(c=o.createElement(l),o.head.insertBefore(c,o.querySelector("head > title"))),rn(c,l,n),c[Ht]=e,_t(c),l=c;break e;case"link":var g=Fm("link","href",o).get(l+(n.href||""));if(g){for(var x=0;x<g.length;x++)if(c=g[x],c.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&c.getAttribute("rel")===(n.rel==null?null:n.rel)&&c.getAttribute("title")===(n.title==null?null:n.title)&&c.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){g.splice(x,1);break t}}c=o.createElement(l),rn(c,l,n),o.head.appendChild(c);break;case"meta":if(g=Fm("meta","content",o).get(l+(n.content||""))){for(x=0;x<g.length;x++)if(c=g[x],c.getAttribute("content")===(n.content==null?null:""+n.content)&&c.getAttribute("name")===(n.name==null?null:n.name)&&c.getAttribute("property")===(n.property==null?null:n.property)&&c.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&c.getAttribute("charset")===(n.charSet==null?null:n.charSet)){g.splice(x,1);break t}}c=o.createElement(l),rn(c,l,n),o.head.appendChild(c);break;default:throw Error(r(468,l))}c[Ht]=e,_t(c),l=c}e.stateNode=l}else qm(o,e.type,e.stateNode);else e.stateNode=$m(o,l,e.memoizedProps);else c!==l?(c===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):c.count--,l===null?qm(o,e.type,e.stateNode):$m(o,l,e.memoizedProps)):l===null&&e.stateNode!==null&&Zc(e,e.memoizedProps,n.memoizedProps)}break;case 27:Mn(t,e),An(e),l&512&&(Ft||n===null||vi(n,n.return)),n!==null&&l&4&&Zc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Mn(t,e),An(e),l&512&&(Ft||n===null||vi(n,n.return)),e.flags&32){o=e.stateNode;try{nl(o,"")}catch(be){ht(e,e.return,be)}}l&4&&e.stateNode!=null&&(o=e.memoizedProps,Zc(e,o,n!==null?n.memoizedProps:o)),l&1024&&(Jc=!0);break;case 6:if(Mn(t,e),An(e),l&4){if(e.stateNode===null)throw Error(r(162));l=e.memoizedProps,n=e.stateNode;try{n.nodeValue=l}catch(be){ht(e,e.return,be)}}break;case 3:if(to=null,o=ci,ci=Jr(t.containerInfo),Mn(t,e),ci=o,An(e),l&4&&n!==null&&n.memoizedState.isDehydrated)try{Ha(t.containerInfo)}catch(be){ht(e,e.return,be)}Jc&&(Jc=!1,qh(e));break;case 4:l=ci,ci=Jr(e.stateNode.containerInfo),Mn(t,e),An(e),ci=l;break;case 12:Mn(t,e),An(e);break;case 31:Mn(t,e),An(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Hr(e,l)));break;case 13:Mn(t,e),An(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Yr=oe()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Hr(e,l)));break;case 22:o=e.memoizedState!==null;var C=n!==null&&n.memoizedState!==null,D=Hi,X=Ft;if(Hi=D||o,Ft=X||C,Mn(t,e),Ft=X,Hi=D,An(e),l&8192)e:for(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,o&&(n===null||C||Hi||Ft||Wl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){C=n=t;try{if(c=C.stateNode,o)g=c.style,typeof g.setProperty=="function"?g.setProperty("display","none","important"):g.display="none";else{x=C.stateNode;var Q=C.memoizedProps.style,O=Q!=null&&Q.hasOwnProperty("display")?Q.display:null;x.style.display=O==null||typeof O=="boolean"?"":(""+O).trim()}}catch(be){ht(C,C.return,be)}}}else if(t.tag===6){if(n===null){C=t;try{C.stateNode.nodeValue=o?"":C.memoizedProps}catch(be){ht(C,C.return,be)}}}else if(t.tag===18){if(n===null){C=t;try{var I=C.stateNode;o?Om(I,!0):Om(C.stateNode,!1)}catch(be){ht(C,C.return,be)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}l&4&&(l=e.updateQueue,l!==null&&(n=l.retryQueue,n!==null&&(l.retryQueue=null,Hr(e,n))));break;case 19:Mn(t,e),An(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Hr(e,l)));break;case 30:break;case 21:break;default:Mn(t,e),An(e)}}function An(e){var t=e.flags;if(t&2){try{for(var n,l=e.return;l!==null;){if(Uh(l)){n=l;break}l=l.return}if(n==null)throw Error(r(160));switch(n.tag){case 27:var o=n.stateNode,c=Qc(e);Br(e,c,o);break;case 5:var g=n.stateNode;n.flags&32&&(nl(g,""),n.flags&=-33);var x=Qc(e);Br(e,x,g);break;case 3:case 4:var C=n.stateNode.containerInfo,D=Qc(e);Wc(e,D,C);break;default:throw Error(r(161))}}catch(X){ht(e,e.return,X)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function qh(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;qh(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Yi(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Kh(e,t.alternate,t),t=t.sibling}function Wl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:ml(4,t,t.return),Wl(t);break;case 1:vi(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&Oh(t,t.return,n),Wl(t);break;case 27:Rs(t.stateNode);case 26:case 5:vi(t,t.return),Wl(t);break;case 22:t.memoizedState===null&&Wl(t);break;case 30:Wl(t);break;default:Wl(t)}e=e.sibling}}function Ii(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var l=t.alternate,o=e,c=t,g=c.flags;switch(c.tag){case 0:case 11:case 15:Ii(o,c,n),xs(4,c);break;case 1:if(Ii(o,c,n),l=c,o=l.stateNode,typeof o.componentDidMount=="function")try{o.componentDidMount()}catch(D){ht(l,l.return,D)}if(l=c,o=l.updateQueue,o!==null){var x=l.stateNode;try{var C=o.shared.hiddenCallbacks;if(C!==null)for(o.shared.hiddenCallbacks=null,o=0;o<C.length;o++)Cf(C[o],x)}catch(D){ht(l,l.return,D)}}n&&g&64&&Dh(c),ws(c,c.return);break;case 27:Bh(c);case 26:case 5:Ii(o,c,n),n&&l===null&&g&4&&zh(c),ws(c,c.return);break;case 12:Ii(o,c,n);break;case 31:Ii(o,c,n),n&&g&4&&Gh(o,c);break;case 13:Ii(o,c,n),n&&g&4&&$h(o,c);break;case 22:c.memoizedState===null&&Ii(o,c,n),ws(c,c.return);break;case 30:break;default:Ii(o,c,n)}t=t.sibling}}function eu(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&rs(n))}function tu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&rs(e))}function ui(e,t,n,l){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Vh(e,t,n,l),t=t.sibling}function Vh(e,t,n,l){var o=t.flags;switch(t.tag){case 0:case 11:case 15:ui(e,t,n,l),o&2048&&xs(9,t);break;case 1:ui(e,t,n,l);break;case 3:ui(e,t,n,l),o&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&rs(e)));break;case 12:if(o&2048){ui(e,t,n,l),e=t.stateNode;try{var c=t.memoizedProps,g=c.id,x=c.onPostCommit;typeof x=="function"&&x(g,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(C){ht(t,t.return,C)}}else ui(e,t,n,l);break;case 31:ui(e,t,n,l);break;case 13:ui(e,t,n,l);break;case 23:break;case 22:c=t.stateNode,g=t.alternate,t.memoizedState!==null?c._visibility&2?ui(e,t,n,l):Ss(e,t):c._visibility&2?ui(e,t,n,l):(c._visibility|=2,Na(e,t,n,l,(t.subtreeFlags&10256)!==0||!1)),o&2048&&eu(g,t);break;case 24:ui(e,t,n,l),o&2048&&tu(t.alternate,t);break;default:ui(e,t,n,l)}}function Na(e,t,n,l,o){for(o=o&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var c=e,g=t,x=n,C=l,D=g.flags;switch(g.tag){case 0:case 11:case 15:Na(c,g,x,C,o),xs(8,g);break;case 23:break;case 22:var X=g.stateNode;g.memoizedState!==null?X._visibility&2?Na(c,g,x,C,o):Ss(c,g):(X._visibility|=2,Na(c,g,x,C,o)),o&&D&2048&&eu(g.alternate,g);break;case 24:Na(c,g,x,C,o),o&&D&2048&&tu(g.alternate,g);break;default:Na(c,g,x,C,o)}t=t.sibling}}function Ss(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,l=t,o=l.flags;switch(l.tag){case 22:Ss(n,l),o&2048&&eu(l.alternate,l);break;case 24:Ss(n,l),o&2048&&tu(l.alternate,l);break;default:Ss(n,l)}t=t.sibling}}var Cs=8192;function ka(e,t,n){if(e.subtreeFlags&Cs)for(e=e.child;e!==null;)Xh(e,t,n),e=e.sibling}function Xh(e,t,n){switch(e.tag){case 26:ka(e,t,n),e.flags&Cs&&e.memoizedState!==null&&N0(n,ci,e.memoizedState,e.memoizedProps);break;case 5:ka(e,t,n);break;case 3:case 4:var l=ci;ci=Jr(e.stateNode.containerInfo),ka(e,t,n),ci=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=Cs,Cs=16777216,ka(e,t,n),Cs=l):ka(e,t,n));break;default:ka(e,t,n)}}function Ph(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 Ts(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var l=t[n];Jt=l,Qh(l,e)}Ph(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Zh(e),e=e.sibling}function Zh(e){switch(e.tag){case 0:case 11:case 15:Ts(e),e.flags&2048&&ml(9,e,e.return);break;case 3:Ts(e);break;case 12:Ts(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Kr(e)):Ts(e);break;default:Ts(e)}}function Kr(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var l=t[n];Jt=l,Qh(l,e)}Ph(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:ml(8,t,t.return),Kr(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Kr(t));break;default:Kr(t)}e=e.sibling}}function Qh(e,t){for(;Jt!==null;){var n=Jt;switch(n.tag){case 0:case 11:case 15:ml(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var l=n.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:rs(n.memoizedState.cache)}if(l=n.child,l!==null)l.return=n,Jt=l;else e:for(n=e;Jt!==null;){l=Jt;var o=l.sibling,c=l.return;if(Yh(l),l===n){Jt=null;break e}if(o!==null){o.return=c,Jt=o;break e}Jt=c}}}var Gy={getCacheForType:function(e){var t=an(It),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return an(It).controller.signal}},$y=typeof WeakMap=="function"?WeakMap:Map,rt=0,wt=null,Pe=null,We=0,ft=0,Un=null,pl=!1,Ra=!1,nu=!1,Gi=0,Ut=0,gl=0,Jl=0,iu=0,Bn=0,La=0,Ms=null,En=null,lu=!1,Yr=0,Wh=0,Ir=1/0,Gr=null,bl=null,Xt=0,yl=null,_a=null,$i=0,au=0,su=null,Jh=null,As=0,ru=null;function Hn(){return(rt&2)!==0&&We!==0?We&-We:N.T!==null?hu():Ei()}function em(){if(Bn===0)if((We&536870912)===0||tt){var e=et;et<<=1,(et&3932160)===0&&(et=262144),Bn=e}else Bn=536870912;return e=On.current,e!==null&&(e.flags|=32),Bn}function Nn(e,t,n){(e===wt&&(ft===2||ft===9)||e.cancelPendingCommit!==null)&&(ja(e,0),vl(e,We,Bn,!1)),Sn(e,n),((rt&2)===0||e!==wt)&&(e===wt&&((rt&2)===0&&(Jl|=n),Ut===4&&vl(e,We,Bn,!1)),xi(e))}function tm(e,t,n){if((rt&6)!==0)throw Error(r(327));var l=!n&&(t&127)===0&&(t&e.expiredLanes)===0||Gn(e,t),o=l?Vy(e,t):cu(e,t,!0),c=l;do{if(o===0){Ra&&!l&&vl(e,t,0,!1);break}else{if(n=e.current.alternate,c&&!Fy(n)){o=cu(e,t,!1),c=!1;continue}if(o===2){if(c=t,e.errorRecoveryDisabledLanes&c)var g=0;else g=e.pendingLanes&-536870913,g=g!==0?g:g&536870912?536870912:0;if(g!==0){t=g;e:{var x=e;o=Ms;var C=x.current.memoizedState.isDehydrated;if(C&&(ja(x,g).flags|=256),g=cu(x,g,!1),g!==2){if(nu&&!C){x.errorRecoveryDisabledLanes|=c,Jl|=c,o=4;break e}c=En,En=o,c!==null&&(En===null?En=c:En.push.apply(En,c))}o=g}if(c=!1,o!==2)continue}}if(o===1){ja(e,0),vl(e,t,0,!0);break}e:{switch(l=e,c=o,c){case 0:case 1:throw Error(r(345));case 4:if((t&4194048)!==t)break;case 6:vl(l,t,Bn,!pl);break e;case 2:En=null;break;case 3:case 5:break;default:throw Error(r(329))}if((t&62914560)===t&&(o=Yr+300-oe(),10<o)){if(vl(l,t,Bn,!pl),mn(l,0,!0)!==0)break e;$i=t,l.timeoutHandle=_m(nm.bind(null,l,n,En,Gr,lu,t,Bn,Jl,La,pl,c,"Throttled",-0,0),o);break e}nm(l,n,En,Gr,lu,t,Bn,Jl,La,pl,c,null,-0,0)}}break}while(!0);xi(e)}function nm(e,t,n,l,o,c,g,x,C,D,X,Q,O,I){if(e.timeoutHandle=-1,Q=t.subtreeFlags,Q&8192||(Q&16785408)===16785408){Q={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Vt},Xh(t,c,Q);var be=(c&62914560)===c?Yr-oe():(c&4194048)===c?Wh-oe():0;if(be=k0(Q,be),be!==null){$i=c,e.cancelPendingCommit=be(um.bind(null,e,t,c,n,l,o,g,x,C,X,Q,null,O,I)),vl(e,c,g,!D);return}}um(e,t,c,n,l,o,g,x,C)}function Fy(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var l=0;l<n.length;l++){var o=n[l],c=o.getSnapshot;o=o.value;try{if(!jn(c(),o))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function vl(e,t,n,l){t&=~iu,t&=~Jl,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var o=t;0<o;){var c=31-Ct(o),g=1<<c;l[c]=-1,o&=~g}n!==0&&sa(e,n,t)}function $r(){return(rt&6)===0?(Es(0),!1):!0}function ou(){if(Pe!==null){if(ft===0)var e=Pe.return;else e=Pe,ji=$l=null,Tc(e),Ca=null,cs=0,e=Pe;for(;e!==null;)jh(e.alternate,e),e=e.return;Pe=null}}function ja(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,d0(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),$i=0,ou(),wt=e,Pe=n=Li(e.current,null),We=t,ft=0,Un=null,pl=!1,Ra=Gn(e,t),nu=!1,La=Bn=iu=Jl=gl=Ut=0,En=Ms=null,lu=!1,(t&8)!==0&&(t|=t&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=t;0<l;){var o=31-Ct(l),c=1<<o;t|=e[o],l&=~c}return Gi=t,dr(),n}function im(e,t){Be=null,N.H=bs,t===Sa||t===vr?(t=vf(),ft=3):t===fc?(t=vf(),ft=4):ft=t===Kc?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Un=t,Pe===null&&(Ut=1,jr(e,Pn(t,e.current)))}function lm(){var e=On.current;return e===null?!0:(We&4194048)===We?Jn===null:(We&62914560)===We||(We&536870912)!==0?e===Jn:!1}function am(){var e=N.H;return N.H=bs,e===null?bs:e}function sm(){var e=N.A;return N.A=Gy,e}function Fr(){Ut=4,pl||(We&4194048)!==We&&On.current!==null||(Ra=!0),(gl&134217727)===0&&(Jl&134217727)===0||wt===null||vl(wt,We,Bn,!1)}function cu(e,t,n){var l=rt;rt|=2;var o=am(),c=sm();(wt!==e||We!==t)&&(Gr=null,ja(e,t)),t=!1;var g=Ut;e:do try{if(ft!==0&&Pe!==null){var x=Pe,C=Un;switch(ft){case 8:ou(),g=6;break e;case 3:case 2:case 9:case 6:On.current===null&&(t=!0);var D=ft;if(ft=0,Un=null,Da(e,x,C,D),n&&Ra){g=0;break e}break;default:D=ft,ft=0,Un=null,Da(e,x,C,D)}}qy(),g=Ut;break}catch(X){im(e,X)}while(!0);return t&&e.shellSuspendCounter++,ji=$l=null,rt=l,N.H=o,N.A=c,Pe===null&&(wt=null,We=0,dr()),g}function qy(){for(;Pe!==null;)rm(Pe)}function Vy(e,t){var n=rt;rt|=2;var l=am(),o=sm();wt!==e||We!==t?(Gr=null,Ir=oe()+500,ja(e,t)):Ra=Gn(e,t);e:do try{if(ft!==0&&Pe!==null){t=Pe;var c=Un;t:switch(ft){case 1:ft=0,Un=null,Da(e,t,c,1);break;case 2:case 9:if(bf(c)){ft=0,Un=null,om(t);break}t=function(){ft!==2&&ft!==9||wt!==e||(ft=7),xi(e)},c.then(t,t);break e;case 3:ft=7;break e;case 4:ft=5;break e;case 7:bf(c)?(ft=0,Un=null,om(t)):(ft=0,Un=null,Da(e,t,c,7));break;case 5:var g=null;switch(Pe.tag){case 26:g=Pe.memoizedState;case 5:case 27:var x=Pe;if(g?Vm(g):x.stateNode.complete){ft=0,Un=null;var C=x.sibling;if(C!==null)Pe=C;else{var D=x.return;D!==null?(Pe=D,qr(D)):Pe=null}break t}}ft=0,Un=null,Da(e,t,c,5);break;case 6:ft=0,Un=null,Da(e,t,c,6);break;case 8:ou(),Ut=6;break e;default:throw Error(r(462))}}Xy();break}catch(X){im(e,X)}while(!0);return ji=$l=null,N.H=l,N.A=o,rt=n,Pe!==null?0:(wt=null,We=0,dr(),Ut)}function Xy(){for(;Pe!==null&&!ot();)rm(Pe)}function rm(e){var t=Lh(e.alternate,e,Gi);e.memoizedProps=e.pendingProps,t===null?qr(e):Pe=t}function om(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Mh(n,t,t.pendingProps,t.type,void 0,We);break;case 11:t=Mh(n,t,t.pendingProps,t.type.render,t.ref,We);break;case 5:Tc(t);default:jh(n,t),t=Pe=sf(t,Gi),t=Lh(n,t,Gi)}e.memoizedProps=e.pendingProps,t===null?qr(e):Pe=t}function Da(e,t,n,l){ji=$l=null,Tc(t),Ca=null,cs=0;var o=t.return;try{if(zy(e,o,t,n,We)){Ut=1,jr(e,Pn(n,e.current)),Pe=null;return}}catch(c){if(o!==null)throw Pe=o,c;Ut=1,jr(e,Pn(n,e.current)),Pe=null;return}t.flags&32768?(tt||l===1?e=!0:Ra||(We&536870912)!==0?e=!1:(pl=e=!0,(l===2||l===9||l===3||l===6)&&(l=On.current,l!==null&&l.tag===13&&(l.flags|=16384))),cm(t,e)):qr(t)}function qr(e){var t=e;do{if((t.flags&32768)!==0){cm(t,pl);return}e=t.return;var n=Hy(t.alternate,t,Gi);if(n!==null){Pe=n;return}if(t=t.sibling,t!==null){Pe=t;return}Pe=t=e}while(t!==null);Ut===0&&(Ut=5)}function cm(e,t){do{var n=Ky(e.alternate,e);if(n!==null){n.flags&=32767,Pe=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Pe=e;return}Pe=e=n}while(e!==null);Ut=6,Pe=null}function um(e,t,n,l,o,c,g,x,C){e.cancelPendingCommit=null;do Vr();while(Xt!==0);if((rt&6)!==0)throw Error(r(327));if(t!==null){if(t===e.current)throw Error(r(177));if(c=t.lanes|t.childLanes,c|=Qo,Ai(e,n,c,g,x,C),e===wt&&(Pe=wt=null,We=0),_a=t,yl=e,$i=n,au=c,su=o,Jh=l,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Wy(kt,function(){return pm(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||l){l=N.T,N.T=null,o=q.p,q.p=2,g=rt,rt|=4;try{Yy(e,t,n)}finally{rt=g,q.p=o,N.T=l}}Xt=1,dm(),fm(),hm()}}function dm(){if(Xt===1){Xt=0;var e=yl,t=_a,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=N.T,N.T=null;var l=q.p;q.p=2;var o=rt;rt|=4;try{Fh(t,e);var c=wu,g=Zd(e.containerInfo),x=c.focusedElem,C=c.selectionRange;if(g!==x&&x&&x.ownerDocument&&Pd(x.ownerDocument.documentElement,x)){if(C!==null&&qo(x)){var D=C.start,X=C.end;if(X===void 0&&(X=D),"selectionStart"in x)x.selectionStart=D,x.selectionEnd=Math.min(X,x.value.length);else{var Q=x.ownerDocument||document,O=Q&&Q.defaultView||window;if(O.getSelection){var I=O.getSelection(),be=x.textContent.length,Ne=Math.min(C.start,be),yt=C.end===void 0?Ne:Math.min(C.end,be);!I.extend&&Ne>yt&&(g=yt,yt=Ne,Ne=g);var R=Xd(x,Ne),M=Xd(x,yt);if(R&&M&&(I.rangeCount!==1||I.anchorNode!==R.node||I.anchorOffset!==R.offset||I.focusNode!==M.node||I.focusOffset!==M.offset)){var j=Q.createRange();j.setStart(R.node,R.offset),I.removeAllRanges(),Ne>yt?(I.addRange(j),I.extend(M.node,M.offset)):(j.setEnd(M.node,M.offset),I.addRange(j))}}}}for(Q=[],I=x;I=I.parentNode;)I.nodeType===1&&Q.push({element:I,left:I.scrollLeft,top:I.scrollTop});for(typeof x.focus=="function"&&x.focus(),x=0;x<Q.length;x++){var P=Q[x];P.element.scrollLeft=P.left,P.element.scrollTop=P.top}}ao=!!xu,wu=xu=null}finally{rt=o,q.p=l,N.T=n}}e.current=t,Xt=2}}function fm(){if(Xt===2){Xt=0;var e=yl,t=_a,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=N.T,N.T=null;var l=q.p;q.p=2;var o=rt;rt|=4;try{Kh(e,t.alternate,t)}finally{rt=o,q.p=l,N.T=n}}Xt=3}}function hm(){if(Xt===4||Xt===3){Xt=0,$e();var e=yl,t=_a,n=$i,l=Jh;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?Xt=5:(Xt=0,_a=yl=null,mm(e,e.pendingLanes));var o=e.pendingLanes;if(o===0&&(bl=null),Qi(n),t=t.stateNode,ut&&typeof ut.onCommitFiberRoot=="function")try{ut.onCommitFiberRoot(Zt,t,void 0,(t.current.flags&128)===128)}catch{}if(l!==null){t=N.T,o=q.p,q.p=2,N.T=null;try{for(var c=e.onRecoverableError,g=0;g<l.length;g++){var x=l[g];c(x.value,{componentStack:x.stack})}}finally{N.T=t,q.p=o}}($i&3)!==0&&Vr(),xi(e),o=e.pendingLanes,(n&261930)!==0&&(o&42)!==0?e===ru?As++:(As=0,ru=e):As=0,Es(0)}}function mm(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,rs(t)))}function Vr(){return dm(),fm(),hm(),pm()}function pm(){if(Xt!==5)return!1;var e=yl,t=au;au=0;var n=Qi($i),l=N.T,o=q.p;try{q.p=32>n?32:n,N.T=null,n=su,su=null;var c=yl,g=$i;if(Xt=0,_a=yl=null,$i=0,(rt&6)!==0)throw Error(r(331));var x=rt;if(rt|=4,Zh(c.current),Vh(c,c.current,g,n),rt=x,Es(0,!1),ut&&typeof ut.onPostCommitFiberRoot=="function")try{ut.onPostCommitFiberRoot(Zt,c)}catch{}return!0}finally{q.p=o,N.T=l,mm(e,t)}}function gm(e,t,n){t=Pn(n,t),t=Hc(e.stateNode,t,2),e=dl(e,t,2),e!==null&&(Sn(e,2),xi(e))}function ht(e,t,n){if(e.tag===3)gm(e,e,n);else for(;t!==null;){if(t.tag===3){gm(t,e,n);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(bl===null||!bl.has(l))){e=Pn(n,e),n=bh(2),l=dl(t,n,2),l!==null&&(yh(n,l,t,e),Sn(l,2),xi(l));break}}t=t.return}}function uu(e,t,n){var l=e.pingCache;if(l===null){l=e.pingCache=new $y;var o=new Set;l.set(t,o)}else o=l.get(t),o===void 0&&(o=new Set,l.set(t,o));o.has(n)||(nu=!0,o.add(n),e=Py.bind(null,e,t,n),t.then(e,e))}function Py(e,t,n){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,wt===e&&(We&n)===n&&(Ut===4||Ut===3&&(We&62914560)===We&&300>oe()-Yr?(rt&2)===0&&ja(e,0):iu|=n,La===We&&(La=0)),xi(e)}function bm(e,t){t===0&&(t=Lt()),e=Yl(e,t),e!==null&&(Sn(e,t),xi(e))}function Zy(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),bm(e,n)}function Qy(e,t){var n=0;switch(e.tag){case 31:case 13:var l=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(r(314))}l!==null&&l.delete(t),bm(e,n)}function Wy(e,t){return Ee(e,t)}var Xr=null,Oa=null,du=!1,Pr=!1,fu=!1,xl=0;function xi(e){e!==Oa&&e.next===null&&(Oa===null?Xr=Oa=e:Oa=Oa.next=e),Pr=!0,du||(du=!0,e0())}function Es(e,t){if(!fu&&Pr){fu=!0;do for(var n=!1,l=Xr;l!==null;){if(e!==0){var o=l.pendingLanes;if(o===0)var c=0;else{var g=l.suspendedLanes,x=l.pingedLanes;c=(1<<31-Ct(42|e)+1)-1,c&=o&~(g&~x),c=c&201326741?c&201326741|1:c?c|2:0}c!==0&&(n=!0,wm(l,c))}else c=We,c=mn(l,l===wt?c:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(c&3)===0||Gn(l,c)||(n=!0,wm(l,c));l=l.next}while(n);fu=!1}}function Jy(){ym()}function ym(){Pr=du=!1;var e=0;xl!==0&&u0()&&(e=xl);for(var t=oe(),n=null,l=Xr;l!==null;){var o=l.next,c=vm(l,t);c===0?(l.next=null,n===null?Xr=o:n.next=o,o===null&&(Oa=n)):(n=l,(e!==0||(c&3)!==0)&&(Pr=!0)),l=o}Xt!==0&&Xt!==5||Es(e),xl!==0&&(xl=0)}function vm(e,t){for(var n=e.suspendedLanes,l=e.pingedLanes,o=e.expirationTimes,c=e.pendingLanes&-62914561;0<c;){var g=31-Ct(c),x=1<<g,C=o[g];C===-1?((x&n)===0||(x&l)!==0)&&(o[g]=jl(x,t)):C<=t&&(e.expiredLanes|=x),c&=~x}if(t=wt,n=We,n=mn(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,n===0||e===t&&(ft===2||ft===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&_e(l),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||Gn(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(l!==null&&_e(l),Qi(n)){case 2:case 8:n=Qe;break;case 32:n=kt;break;case 268435456:n=Dt;break;default:n=kt}return l=xm.bind(null,e),n=Ee(n,l),e.callbackPriority=t,e.callbackNode=n,t}return l!==null&&l!==null&&_e(l),e.callbackPriority=2,e.callbackNode=null,2}function xm(e,t){if(Xt!==0&&Xt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Vr()&&e.callbackNode!==n)return null;var l=We;return l=mn(e,e===wt?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(tm(e,l,t),vm(e,oe()),e.callbackNode!=null&&e.callbackNode===n?xm.bind(null,e):null)}function wm(e,t){if(Vr())return null;tm(e,t,!0)}function e0(){f0(function(){(rt&6)!==0?Ee(ze,Jy):ym()})}function hu(){if(xl===0){var e=xa;e===0&&(e=li,li<<=1,(li&261888)===0&&(li=256)),xl=e}return xl}function Sm(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:gi(""+e)}function Cm(e,t){var n=t.ownerDocument.createElement("input");return n.name=t.name,n.value=t.value,e.id&&n.setAttribute("form",e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function t0(e,t,n,l,o){if(t==="submit"&&n&&n.stateNode===o){var c=Sm((o[Qt]||null).action),g=l.submitter;g&&(t=(t=g[Qt]||null)?Sm(t.formAction):g.getAttribute("formAction"),t!==null&&(c=t,g=null));var x=new Vn("action","action",null,l,o);e.push({event:x,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(xl!==0){var C=g?Cm(o,g):new FormData(o);jc(n,{pending:!0,data:C,method:o.method,action:c},null,C)}}else typeof c=="function"&&(x.preventDefault(),C=g?Cm(o,g):new FormData(o),jc(n,{pending:!0,data:C,method:o.method,action:c},c,C))},currentTarget:o}]})}}for(var mu=0;mu<Zo.length;mu++){var pu=Zo[mu],n0=pu.toLowerCase(),i0=pu[0].toUpperCase()+pu.slice(1);oi(n0,"on"+i0)}oi(Jd,"onAnimationEnd"),oi(ef,"onAnimationIteration"),oi(tf,"onAnimationStart"),oi("dblclick","onDoubleClick"),oi("focusin","onFocus"),oi("focusout","onBlur"),oi(vy,"onTransitionRun"),oi(xy,"onTransitionStart"),oi(wy,"onTransitionCancel"),oi(nf,"onTransitionEnd"),K("onMouseEnter",["mouseout","mouseover"]),K("onMouseLeave",["mouseout","mouseover"]),K("onPointerEnter",["pointerout","pointerover"]),K("onPointerLeave",["pointerout","pointerover"]),_("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),_("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),_("onBeforeInput",["compositionend","keypress","textInput","paste"]),_("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),_("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),_("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ns="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(" "),l0=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ns));function Tm(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var l=e[n],o=l.event;l=l.listeners;e:{var c=void 0;if(t)for(var g=l.length-1;0<=g;g--){var x=l[g],C=x.instance,D=x.currentTarget;if(x=x.listener,C!==c&&o.isPropagationStopped())break e;c=x,o.currentTarget=D;try{c(o)}catch(X){ur(X)}o.currentTarget=null,c=C}else for(g=0;g<l.length;g++){if(x=l[g],C=x.instance,D=x.currentTarget,x=x.listener,C!==c&&o.isPropagationStopped())break e;c=x,o.currentTarget=D;try{c(o)}catch(X){ur(X)}o.currentTarget=null,c=C}}}}function Ze(e,t){var n=t[Ol];n===void 0&&(n=t[Ol]=new Set);var l=e+"__bubble";n.has(l)||(Mm(t,e,2,!1),n.add(l))}function gu(e,t,n){var l=0;t&&(l|=4),Mm(n,e,l,t)}var Zr="_reactListening"+Math.random().toString(36).slice(2);function bu(e){if(!e[Zr]){e[Zr]=!0,zl.forEach(function(n){n!=="selectionchange"&&(l0.has(n)||gu(n,!1,e),gu(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Zr]||(t[Zr]=!0,gu("selectionchange",!1,t))}}function Mm(e,t,n,l){switch(ep(t)){case 2:var o=_0;break;case 8:o=j0;break;default:o=_u}n=o.bind(null,t,n,e),o=void 0,!ue||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(o=!0),l?o!==void 0?e.addEventListener(t,n,{capture:!0,passive:o}):e.addEventListener(t,n,!0):o!==void 0?e.addEventListener(t,n,{passive:o}):e.addEventListener(t,n,!1)}function yu(e,t,n,l,o){var c=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var g=l.tag;if(g===3||g===4){var x=l.stateNode.containerInfo;if(x===o)break;if(g===4)for(g=l.return;g!==null;){var C=g.tag;if((C===3||C===4)&&g.stateNode.containerInfo===o)return;g=g.return}for(;x!==null;){if(g=Cn(x),g===null)return;if(C=g.tag,C===5||C===6||C===26||C===27){l=c=g;continue e}x=x.parentNode}}l=l.return}Wa(function(){var D=c,X=ca(n),Q=[];e:{var O=lf.get(e);if(O!==void 0){var I=Vn,be=e;switch(e){case"keypress":if(Wt(n)===0)break e;case"keydown":case"keyup":I=Qb;break;case"focusin":be="focus",I=Yo;break;case"focusout":be="blur",I=Yo;break;case"beforeblur":case"afterblur":I=Yo;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":I=_d;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":I=Hb;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":I=ey;break;case Jd:case ef:case tf:I=Ib;break;case nf:I=ny;break;case"scroll":case"scrollend":I=Ub;break;case"wheel":I=ly;break;case"copy":case"cut":case"paste":I=$b;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":I=Dd;break;case"toggle":case"beforetoggle":I=sy}var Ne=(t&4)!==0,yt=!Ne&&(e==="scroll"||e==="scrollend"),R=Ne?O!==null?O+"Capture":null:O;Ne=[];for(var M=D,j;M!==null;){var P=M;if(j=P.stateNode,P=P.tag,P!==5&&P!==26&&P!==27||j===null||R===null||(P=il(M,R),P!=null&&Ne.push(ks(M,P,j))),yt)break;M=M.return}0<Ne.length&&(O=new I(O,be,null,n,X),Q.push({event:O,listeners:Ne}))}}if((t&7)===0){e:{if(O=e==="mouseover"||e==="pointerover",I=e==="mouseout"||e==="pointerout",O&&n!==oa&&(be=n.relatedTarget||n.fromElement)&&(Cn(be)||be[mi]))break e;if((I||O)&&(O=X.window===X?X:(O=X.ownerDocument)?O.defaultView||O.parentWindow:window,I?(be=n.relatedTarget||n.toElement,I=D,be=be?Cn(be):null,be!==null&&(yt=f(be),Ne=be.tag,be!==yt||Ne!==5&&Ne!==27&&Ne!==6)&&(be=null)):(I=null,be=D),I!==be)){if(Ne=_d,P="onMouseLeave",R="onMouseEnter",M="mouse",(e==="pointerout"||e==="pointerover")&&(Ne=Dd,P="onPointerLeave",R="onPointerEnter",M="pointer"),yt=I==null?O:pi(I),j=be==null?O:pi(be),O=new Ne(P,M+"leave",I,n,X),O.target=yt,O.relatedTarget=j,P=null,Cn(X)===D&&(Ne=new Ne(R,M+"enter",be,n,X),Ne.target=j,Ne.relatedTarget=yt,P=Ne),yt=P,I&&be)t:{for(Ne=a0,R=I,M=be,j=0,P=R;P;P=Ne(P))j++;P=0;for(var Te=M;Te;Te=Ne(Te))P++;for(;0<j-P;)R=Ne(R),j--;for(;0<P-j;)M=Ne(M),P--;for(;j--;){if(R===M||M!==null&&R===M.alternate){Ne=R;break t}R=Ne(R),M=Ne(M)}Ne=null}else Ne=null;I!==null&&Am(Q,O,I,Ne,!1),be!==null&&yt!==null&&Am(Q,yt,be,Ne,!0)}}e:{if(O=D?pi(D):window,I=O.nodeName&&O.nodeName.toLowerCase(),I==="select"||I==="input"&&O.type==="file")var lt=Id;else if(Kd(O))if(Gd)lt=gy;else{lt=my;var Se=hy}else I=O.nodeName,!I||I.toLowerCase()!=="input"||O.type!=="checkbox"&&O.type!=="radio"?D&&fn(D.elementType)&&(lt=Id):lt=py;if(lt&&(lt=lt(e,D))){Yd(Q,lt,n,X);break e}Se&&Se(e,O,D),e==="focusout"&&D&&O.type==="number"&&D.memoizedProps.value!=null&&Qa(O,"number",O.value)}switch(Se=D?pi(D):window,e){case"focusin":(Kd(Se)||Se.contentEditable==="true")&&(fa=Se,Vo=D,ls=null);break;case"focusout":ls=Vo=fa=null;break;case"mousedown":Xo=!0;break;case"contextmenu":case"mouseup":case"dragend":Xo=!1,Qd(Q,n,X);break;case"selectionchange":if(yy)break;case"keydown":case"keyup":Qd(Q,n,X)}var Ie;if(Go)e:{switch(e){case"compositionstart":var Je="onCompositionStart";break e;case"compositionend":Je="onCompositionEnd";break e;case"compositionupdate":Je="onCompositionUpdate";break e}Je=void 0}else da?Bd(e,n)&&(Je="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(Je="onCompositionStart");Je&&(Od&&n.locale!=="ko"&&(da||Je!=="onCompositionStart"?Je==="onCompositionEnd"&&da&&(Ie=Ce()):(xt=X,hn="value"in xt?xt.value:xt.textContent,da=!0)),Se=Qr(D,Je),0<Se.length&&(Je=new jd(Je,e,null,n,X),Q.push({event:Je,listeners:Se}),Ie?Je.data=Ie:(Ie=Hd(n),Ie!==null&&(Je.data=Ie)))),(Ie=oy?cy(e,n):uy(e,n))&&(Je=Qr(D,"onBeforeInput"),0<Je.length&&(Se=new jd("onBeforeInput","beforeinput",null,n,X),Q.push({event:Se,listeners:Je}),Se.data=Ie)),t0(Q,e,D,n,X)}Tm(Q,t)})}function ks(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Qr(e,t){for(var n=t+"Capture",l=[];e!==null;){var o=e,c=o.stateNode;if(o=o.tag,o!==5&&o!==26&&o!==27||c===null||(o=il(e,n),o!=null&&l.unshift(ks(e,o,c)),o=il(e,t),o!=null&&l.push(ks(e,o,c))),e.tag===3)return l;e=e.return}return[]}function a0(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Am(e,t,n,l,o){for(var c=t._reactName,g=[];n!==null&&n!==l;){var x=n,C=x.alternate,D=x.stateNode;if(x=x.tag,C!==null&&C===l)break;x!==5&&x!==26&&x!==27||D===null||(C=D,o?(D=il(n,c),D!=null&&g.unshift(ks(n,D,C))):o||(D=il(n,c),D!=null&&g.push(ks(n,D,C)))),n=n.return}g.length!==0&&e.push({event:t,listeners:g})}var s0=/\r\n?/g,r0=/\u0000|\uFFFD/g;function Em(e){return(typeof e=="string"?e:""+e).replace(s0,`
|
|
33
|
+
`).replace(r0,"")}function Nm(e,t){return t=Em(t),Em(e)===t}function bt(e,t,n,l,o,c){switch(n){case"children":typeof l=="string"?t==="body"||t==="textarea"&&l===""||nl(e,l):(typeof l=="number"||typeof l=="bigint")&&t!=="body"&&nl(e,""+l);break;case"className":Ae(e,"class",l);break;case"tabIndex":Ae(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":Ae(e,n,l);break;case"style":rr(e,l,c);break;case"data":if(t!=="object"){Ae(e,"data",l);break}case"src":case"href":if(l===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(n);break}l=gi(""+l),e.setAttribute(n,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(n,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof c=="function"&&(n==="formAction"?(t!=="input"&&bt(e,t,"name",o.name,o,null),bt(e,t,"formEncType",o.formEncType,o,null),bt(e,t,"formMethod",o.formMethod,o,null),bt(e,t,"formTarget",o.formTarget,o,null)):(bt(e,t,"encType",o.encType,o,null),bt(e,t,"method",o.method,o,null),bt(e,t,"target",o.target,o,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(n);break}l=gi(""+l),e.setAttribute(n,l);break;case"onClick":l!=null&&(e.onclick=Vt);break;case"onScroll":l!=null&&Ze("scroll",e);break;case"onScrollEnd":l!=null&&Ze("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(n=l.__html,n!=null){if(o.children!=null)throw Error(r(60));e.innerHTML=n}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}n=gi(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(n,""+l):e.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":l===!0?e.setAttribute(n,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(n,l):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(n,l):e.removeAttribute(n);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(n):e.setAttribute(n,l);break;case"popover":Ze("beforetoggle",e),Ze("toggle",e),te(e,"popover",l);break;case"xlinkActuate":ne(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":ne(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":ne(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":ne(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":ne(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":ne(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":ne(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":ne(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":ne(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":te(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=Uo.get(n)||n,te(e,n,l))}}function vu(e,t,n,l,o,c){switch(n){case"style":rr(e,l,c);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(n=l.__html,n!=null){if(o.children!=null)throw Error(r(60));e.innerHTML=n}}break;case"children":typeof l=="string"?nl(e,l):(typeof l=="number"||typeof l=="bigint")&&nl(e,""+l);break;case"onScroll":l!=null&&Ze("scroll",e);break;case"onScrollEnd":l!=null&&Ze("scrollend",e);break;case"onClick":l!=null&&(e.onclick=Vt);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ul.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(o=n.endsWith("Capture"),t=n.slice(2,o?n.length-7:void 0),c=e[Qt]||null,c=c!=null?c[n]:null,typeof c=="function"&&e.removeEventListener(t,c,o),typeof l=="function")){typeof c!="function"&&c!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,l,o);break e}n in e?e[n]=l:l===!0?e.setAttribute(n,""):te(e,n,l)}}}function rn(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ze("error",e),Ze("load",e);var l=!1,o=!1,c;for(c in n)if(n.hasOwnProperty(c)){var g=n[c];if(g!=null)switch(c){case"src":l=!0;break;case"srcSet":o=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:bt(e,t,c,g,n,null)}}o&&bt(e,t,"srcSet",n.srcSet,n,null),l&&bt(e,t,"src",n.src,n,null);return;case"input":Ze("invalid",e);var x=c=g=o=null,C=null,D=null;for(l in n)if(n.hasOwnProperty(l)){var X=n[l];if(X!=null)switch(l){case"name":o=X;break;case"type":g=X;break;case"checked":C=X;break;case"defaultChecked":D=X;break;case"value":c=X;break;case"defaultValue":x=X;break;case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(r(137,t));break;default:bt(e,t,l,X,n,null)}}Ri(e,c,x,C,D,g,o,!1);return;case"select":Ze("invalid",e),l=g=c=null;for(o in n)if(n.hasOwnProperty(o)&&(x=n[o],x!=null))switch(o){case"value":c=x;break;case"defaultValue":g=x;break;case"multiple":l=x;default:bt(e,t,o,x,n,null)}t=c,n=g,e.multiple=!!l,t!=null?tl(e,!!l,t,!1):n!=null&&tl(e,!!l,n,!0);return;case"textarea":Ze("invalid",e),c=o=l=null;for(g in n)if(n.hasOwnProperty(g)&&(x=n[g],x!=null))switch(g){case"value":l=x;break;case"defaultValue":o=x;break;case"children":c=x;break;case"dangerouslySetInnerHTML":if(x!=null)throw Error(r(91));break;default:bt(e,t,g,x,n,null)}ar(e,l,o,c);return;case"option":for(C in n)if(n.hasOwnProperty(C)&&(l=n[C],l!=null))switch(C){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:bt(e,t,C,l,n,null)}return;case"dialog":Ze("beforetoggle",e),Ze("toggle",e),Ze("cancel",e),Ze("close",e);break;case"iframe":case"object":Ze("load",e);break;case"video":case"audio":for(l=0;l<Ns.length;l++)Ze(Ns[l],e);break;case"image":Ze("error",e),Ze("load",e);break;case"details":Ze("toggle",e);break;case"embed":case"source":case"link":Ze("error",e),Ze("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(D in n)if(n.hasOwnProperty(D)&&(l=n[D],l!=null))switch(D){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:bt(e,t,D,l,n,null)}return;default:if(fn(t)){for(X in n)n.hasOwnProperty(X)&&(l=n[X],l!==void 0&&vu(e,t,X,l,n,void 0));return}}for(x in n)n.hasOwnProperty(x)&&(l=n[x],l!=null&&bt(e,t,x,l,n,null))}function o0(e,t,n,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var o=null,c=null,g=null,x=null,C=null,D=null,X=null;for(I in n){var Q=n[I];if(n.hasOwnProperty(I)&&Q!=null)switch(I){case"checked":break;case"value":break;case"defaultValue":C=Q;default:l.hasOwnProperty(I)||bt(e,t,I,null,l,Q)}}for(var O in l){var I=l[O];if(Q=n[O],l.hasOwnProperty(O)&&(I!=null||Q!=null))switch(O){case"type":c=I;break;case"name":o=I;break;case"checked":D=I;break;case"defaultChecked":X=I;break;case"value":g=I;break;case"defaultValue":x=I;break;case"children":case"dangerouslySetInnerHTML":if(I!=null)throw Error(r(137,t));break;default:I!==Q&&bt(e,t,O,I,l,Q)}}el(e,g,x,C,D,X,c,o);return;case"select":I=g=x=O=null;for(c in n)if(C=n[c],n.hasOwnProperty(c)&&C!=null)switch(c){case"value":break;case"multiple":I=C;default:l.hasOwnProperty(c)||bt(e,t,c,null,l,C)}for(o in l)if(c=l[o],C=n[o],l.hasOwnProperty(o)&&(c!=null||C!=null))switch(o){case"value":O=c;break;case"defaultValue":x=c;break;case"multiple":g=c;default:c!==C&&bt(e,t,o,c,l,C)}t=x,n=g,l=I,O!=null?tl(e,!!n,O,!1):!!l!=!!n&&(t!=null?tl(e,!!n,t,!0):tl(e,!!n,n?[]:"",!1));return;case"textarea":I=O=null;for(x in n)if(o=n[x],n.hasOwnProperty(x)&&o!=null&&!l.hasOwnProperty(x))switch(x){case"value":break;case"children":break;default:bt(e,t,x,null,l,o)}for(g in l)if(o=l[g],c=n[g],l.hasOwnProperty(g)&&(o!=null||c!=null))switch(g){case"value":O=o;break;case"defaultValue":I=o;break;case"children":break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(r(91));break;default:o!==c&&bt(e,t,g,o,l,c)}lr(e,O,I);return;case"option":for(var be in n)if(O=n[be],n.hasOwnProperty(be)&&O!=null&&!l.hasOwnProperty(be))switch(be){case"selected":e.selected=!1;break;default:bt(e,t,be,null,l,O)}for(C in l)if(O=l[C],I=n[C],l.hasOwnProperty(C)&&O!==I&&(O!=null||I!=null))switch(C){case"selected":e.selected=O&&typeof O!="function"&&typeof O!="symbol";break;default:bt(e,t,C,O,l,I)}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 Ne in n)O=n[Ne],n.hasOwnProperty(Ne)&&O!=null&&!l.hasOwnProperty(Ne)&&bt(e,t,Ne,null,l,O);for(D in l)if(O=l[D],I=n[D],l.hasOwnProperty(D)&&O!==I&&(O!=null||I!=null))switch(D){case"children":case"dangerouslySetInnerHTML":if(O!=null)throw Error(r(137,t));break;default:bt(e,t,D,O,l,I)}return;default:if(fn(t)){for(var yt in n)O=n[yt],n.hasOwnProperty(yt)&&O!==void 0&&!l.hasOwnProperty(yt)&&vu(e,t,yt,void 0,l,O);for(X in l)O=l[X],I=n[X],!l.hasOwnProperty(X)||O===I||O===void 0&&I===void 0||vu(e,t,X,O,l,I);return}}for(var R in n)O=n[R],n.hasOwnProperty(R)&&O!=null&&!l.hasOwnProperty(R)&&bt(e,t,R,null,l,O);for(Q in l)O=l[Q],I=n[Q],!l.hasOwnProperty(Q)||O===I||O==null&&I==null||bt(e,t,Q,O,l,I)}function km(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function c0(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),l=0;l<n.length;l++){var o=n[l],c=o.transferSize,g=o.initiatorType,x=o.duration;if(c&&x&&km(g)){for(g=0,x=o.responseEnd,l+=1;l<n.length;l++){var C=n[l],D=C.startTime;if(D>x)break;var X=C.transferSize,Q=C.initiatorType;X&&km(Q)&&(C=C.responseEnd,g+=X*(C<x?1:(x-D)/(C-D)))}if(--l,t+=8*(c+g)/(o.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var xu=null,wu=null;function Wr(e){return e.nodeType===9?e:e.ownerDocument}function Rm(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Lm(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Su(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 Cu=null;function u0(){var e=window.event;return e&&e.type==="popstate"?e===Cu?!1:(Cu=e,!0):(Cu=null,!1)}var _m=typeof setTimeout=="function"?setTimeout:void 0,d0=typeof clearTimeout=="function"?clearTimeout:void 0,jm=typeof Promise=="function"?Promise:void 0,f0=typeof queueMicrotask=="function"?queueMicrotask:typeof jm<"u"?function(e){return jm.resolve(null).then(e).catch(h0)}:_m;function h0(e){setTimeout(function(){throw e})}function wl(e){return e==="head"}function Dm(e,t){var n=t,l=0;do{var o=n.nextSibling;if(e.removeChild(n),o&&o.nodeType===8)if(n=o.data,n==="/$"||n==="/&"){if(l===0){e.removeChild(o),Ha(t);return}l--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")l++;else if(n==="html")Rs(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,Rs(n);for(var c=n.firstChild;c;){var g=c.nextSibling,x=c.nodeName;c[dn]||x==="SCRIPT"||x==="STYLE"||x==="LINK"&&c.rel.toLowerCase()==="stylesheet"||n.removeChild(c),c=g}}else n==="body"&&Rs(e.ownerDocument.body);n=o}while(n);Ha(t)}function Om(e,t){var n=e;e=0;do{var l=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),l&&l.nodeType===8)if(n=l.data,n==="/$"){if(e===0)break;e--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=l}while(n)}function Tu(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":Tu(n),ki(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function m0(e,t,n,l){for(;e.nodeType===1;){var o=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[dn])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(c=e.getAttribute("rel"),c==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(c!==o.rel||e.getAttribute("href")!==(o.href==null||o.href===""?null:o.href)||e.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin)||e.getAttribute("title")!==(o.title==null?null:o.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(c=e.getAttribute("src"),(c!==(o.src==null?null:o.src)||e.getAttribute("type")!==(o.type==null?null:o.type)||e.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin))&&c&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var c=o.name==null?null:""+o.name;if(o.type==="hidden"&&e.getAttribute("name")===c)return e}else return e;if(e=ei(e.nextSibling),e===null)break}return null}function p0(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=ei(e.nextSibling),e===null))return null;return e}function zm(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=ei(e.nextSibling),e===null))return null;return e}function Mu(e){return e.data==="$?"||e.data==="$~"}function Au(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function g0(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var l=function(){t(),n.removeEventListener("DOMContentLoaded",l)};n.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function ei(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 Eu=null;function Um(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return ei(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function Bm(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(t===0)return e;t--}else n!=="/$"&&n!=="/&"||t++}e=e.previousSibling}return null}function Hm(e,t,n){switch(t=Wr(n),e){case"html":if(e=t.documentElement,!e)throw Error(r(452));return e;case"head":if(e=t.head,!e)throw Error(r(453));return e;case"body":if(e=t.body,!e)throw Error(r(454));return e;default:throw Error(r(451))}}function Rs(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);ki(e)}var ti=new Map,Km=new Set;function Jr(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Fi=q.d;q.d={f:b0,r:y0,D:v0,C:x0,L:w0,m:S0,X:T0,S:C0,M:M0};function b0(){var e=Fi.f(),t=$r();return e||t}function y0(e){var t=ai(e);t!==null&&t.tag===5&&t.type==="form"?ih(t):Fi.r(e)}var za=typeof document>"u"?null:document;function Ym(e,t,n){var l=za;if(l&&typeof t=="string"&&t){var o=nn(t);o='link[rel="'+e+'"][href="'+o+'"]',typeof n=="string"&&(o+='[crossorigin="'+n+'"]'),Km.has(o)||(Km.add(o),e={rel:e,crossOrigin:n,href:t},l.querySelector(o)===null&&(t=l.createElement("link"),rn(t,"link",e),_t(t),l.head.appendChild(t)))}}function v0(e){Fi.D(e),Ym("dns-prefetch",e,null)}function x0(e,t){Fi.C(e,t),Ym("preconnect",e,t)}function w0(e,t,n){Fi.L(e,t,n);var l=za;if(l&&e&&t){var o='link[rel="preload"][as="'+nn(t)+'"]';t==="image"&&n&&n.imageSrcSet?(o+='[imagesrcset="'+nn(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(o+='[imagesizes="'+nn(n.imageSizes)+'"]')):o+='[href="'+nn(e)+'"]';var c=o;switch(t){case"style":c=Ua(e);break;case"script":c=Ba(e)}ti.has(c)||(e=v({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),ti.set(c,e),l.querySelector(o)!==null||t==="style"&&l.querySelector(Ls(c))||t==="script"&&l.querySelector(_s(c))||(t=l.createElement("link"),rn(t,"link",e),_t(t),l.head.appendChild(t)))}}function S0(e,t){Fi.m(e,t);var n=za;if(n&&e){var l=t&&typeof t.as=="string"?t.as:"script",o='link[rel="modulepreload"][as="'+nn(l)+'"][href="'+nn(e)+'"]',c=o;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":c=Ba(e)}if(!ti.has(c)&&(e=v({rel:"modulepreload",href:e},t),ti.set(c,e),n.querySelector(o)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(_s(c)))return}l=n.createElement("link"),rn(l,"link",e),_t(l),n.head.appendChild(l)}}}function C0(e,t,n){Fi.S(e,t,n);var l=za;if(l&&e){var o=Ln(l).hoistableStyles,c=Ua(e);t=t||"default";var g=o.get(c);if(!g){var x={loading:0,preload:null};if(g=l.querySelector(Ls(c)))x.loading=5;else{e=v({rel:"stylesheet",href:e,"data-precedence":t},n),(n=ti.get(c))&&Nu(e,n);var C=g=l.createElement("link");_t(C),rn(C,"link",e),C._p=new Promise(function(D,X){C.onload=D,C.onerror=X}),C.addEventListener("load",function(){x.loading|=1}),C.addEventListener("error",function(){x.loading|=2}),x.loading|=4,eo(g,t,l)}g={type:"stylesheet",instance:g,count:1,state:x},o.set(c,g)}}}function T0(e,t){Fi.X(e,t);var n=za;if(n&&e){var l=Ln(n).hoistableScripts,o=Ba(e),c=l.get(o);c||(c=n.querySelector(_s(o)),c||(e=v({src:e,async:!0},t),(t=ti.get(o))&&ku(e,t),c=n.createElement("script"),_t(c),rn(c,"link",e),n.head.appendChild(c)),c={type:"script",instance:c,count:1,state:null},l.set(o,c))}}function M0(e,t){Fi.M(e,t);var n=za;if(n&&e){var l=Ln(n).hoistableScripts,o=Ba(e),c=l.get(o);c||(c=n.querySelector(_s(o)),c||(e=v({src:e,async:!0,type:"module"},t),(t=ti.get(o))&&ku(e,t),c=n.createElement("script"),_t(c),rn(c,"link",e),n.head.appendChild(c)),c={type:"script",instance:c,count:1,state:null},l.set(o,c))}}function Im(e,t,n,l){var o=(o=Xe.current)?Jr(o):null;if(!o)throw Error(r(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=Ua(n.href),n=Ln(o).hoistableStyles,l=n.get(t),l||(l={type:"style",instance:null,count:0,state:null},n.set(t,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=Ua(n.href);var c=Ln(o).hoistableStyles,g=c.get(e);if(g||(o=o.ownerDocument||o,g={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},c.set(e,g),(c=o.querySelector(Ls(e)))&&!c._p&&(g.instance=c,g.state.loading=5),ti.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},ti.set(e,n),c||A0(o,e,n,g.state))),t&&l===null)throw Error(r(528,""));return g}if(t&&l!==null)throw Error(r(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Ba(n),n=Ln(o).hoistableScripts,l=n.get(t),l||(l={type:"script",instance:null,count:0,state:null},n.set(t,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,e))}}function Ua(e){return'href="'+nn(e)+'"'}function Ls(e){return'link[rel="stylesheet"]['+e+"]"}function Gm(e){return v({},e,{"data-precedence":e.precedence,precedence:null})}function A0(e,t,n,l){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?l.loading=1:(t=e.createElement("link"),l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2}),rn(t,"link",n),_t(t),e.head.appendChild(t))}function Ba(e){return'[src="'+nn(e)+'"]'}function _s(e){return"script[async]"+e}function $m(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+nn(n.href)+'"]');if(l)return t.instance=l,_t(l),l;var o=v({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),_t(l),rn(l,"style",o),eo(l,n.precedence,e),t.instance=l;case"stylesheet":o=Ua(n.href);var c=e.querySelector(Ls(o));if(c)return t.state.loading|=4,t.instance=c,_t(c),c;l=Gm(n),(o=ti.get(o))&&Nu(l,o),c=(e.ownerDocument||e).createElement("link"),_t(c);var g=c;return g._p=new Promise(function(x,C){g.onload=x,g.onerror=C}),rn(c,"link",l),t.state.loading|=4,eo(c,n.precedence,e),t.instance=c;case"script":return c=Ba(n.src),(o=e.querySelector(_s(c)))?(t.instance=o,_t(o),o):(l=n,(o=ti.get(c))&&(l=v({},n),ku(l,o)),e=e.ownerDocument||e,o=e.createElement("script"),_t(o),rn(o,"link",l),e.head.appendChild(o),t.instance=o);case"void":return null;default:throw Error(r(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,eo(l,n.precedence,e));return t.instance}function eo(e,t,n){for(var l=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),o=l.length?l[l.length-1]:null,c=o,g=0;g<l.length;g++){var x=l[g];if(x.dataset.precedence===t)c=x;else if(c!==o)break}c?c.parentNode.insertBefore(e,c.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Nu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function ku(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var to=null;function Fm(e,t,n){if(to===null){var l=new Map,o=to=new Map;o.set(n,l)}else o=to,l=o.get(n),l||(l=new Map,o.set(n,l));if(l.has(e))return l;for(l.set(e,null),n=n.getElementsByTagName(e),o=0;o<n.length;o++){var c=n[o];if(!(c[dn]||c[Ht]||e==="link"&&c.getAttribute("rel")==="stylesheet")&&c.namespaceURI!=="http://www.w3.org/2000/svg"){var g=c.getAttribute(t)||"";g=e+g;var x=l.get(g);x?x.push(c):l.set(g,[c])}}return l}function qm(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function E0(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Vm(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function N0(e,t,n,l){if(n.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var o=Ua(l.href),c=t.querySelector(Ls(o));if(c){t=c._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=no.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=c,_t(c);return}c=t.ownerDocument||t,l=Gm(l),(o=ti.get(o))&&Nu(l,o),c=c.createElement("link"),_t(c);var g=c;g._p=new Promise(function(x,C){g.onload=x,g.onerror=C}),rn(c,"link",l),n.instance=c}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=no.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var Ru=0;function k0(e,t){return e.stylesheets&&e.count===0&&lo(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var l=setTimeout(function(){if(e.stylesheets&&lo(e,e.stylesheets),e.unsuspend){var c=e.unsuspend;e.unsuspend=null,c()}},6e4+t);0<e.imgBytes&&Ru===0&&(Ru=62500*c0());var o=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&lo(e,e.stylesheets),e.unsuspend)){var c=e.unsuspend;e.unsuspend=null,c()}},(e.imgBytes>Ru?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(o)}}:null}function no(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)lo(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var io=null;function lo(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,io=new Map,t.forEach(R0,e),io=null,no.call(e))}function R0(e,t){if(!(t.state.loading&4)){var n=io.get(e);if(n)var l=n.get(null);else{n=new Map,io.set(e,n);for(var o=e.querySelectorAll("link[data-precedence],style[data-precedence]"),c=0;c<o.length;c++){var g=o[c];(g.nodeName==="LINK"||g.getAttribute("media")!=="not all")&&(n.set(g.dataset.precedence,g),l=g)}l&&n.set(null,l)}o=t.instance,g=o.getAttribute("data-precedence"),c=n.get(g)||l,c===l&&n.set(null,o),n.set(g,o),this.count++,l=no.bind(this),o.addEventListener("load",l),o.addEventListener("error",l),c?c.parentNode.insertBefore(o,c.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(o,e.firstChild)),t.state.loading|=4}}var js={$$typeof:Y,Provider:null,Consumer:null,_currentValue:ce,_currentValue2:ce,_threadCount:0};function L0(e,t,n,l,o,c,g,x,C){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=wn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=wn(0),this.hiddenUpdates=wn(null),this.identifierPrefix=l,this.onUncaughtError=o,this.onCaughtError=c,this.onRecoverableError=g,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=C,this.incompleteTransitions=new Map}function Xm(e,t,n,l,o,c,g,x,C,D,X,Q){return e=new L0(e,t,n,g,C,D,X,Q,x),t=1,c===!0&&(t|=24),c=Dn(3,null,null,t),e.current=c,c.stateNode=e,t=cc(),t.refCount++,e.pooledCache=t,t.refCount++,c.memoizedState={element:l,isDehydrated:n,cache:t},hc(c),e}function Pm(e){return e?(e=pa,e):pa}function Zm(e,t,n,l,o,c){o=Pm(o),l.context===null?l.context=o:l.pendingContext=o,l=ul(t),l.payload={element:n},c=c===void 0?null:c,c!==null&&(l.callback=c),n=dl(e,l,t),n!==null&&(Nn(n,e,t),ds(n,e,t))}function Qm(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Lu(e,t){Qm(e,t),(e=e.alternate)&&Qm(e,t)}function Wm(e){if(e.tag===13||e.tag===31){var t=Yl(e,67108864);t!==null&&Nn(t,e,67108864),Lu(e,67108864)}}function Jm(e){if(e.tag===13||e.tag===31){var t=Hn();t=Zi(t);var n=Yl(e,t);n!==null&&Nn(n,e,t),Lu(e,t)}}var ao=!0;function _0(e,t,n,l){var o=N.T;N.T=null;var c=q.p;try{q.p=2,_u(e,t,n,l)}finally{q.p=c,N.T=o}}function j0(e,t,n,l){var o=N.T;N.T=null;var c=q.p;try{q.p=8,_u(e,t,n,l)}finally{q.p=c,N.T=o}}function _u(e,t,n,l){if(ao){var o=ju(l);if(o===null)yu(e,t,l,so,n),tp(e,l);else if(O0(o,e,t,n,l))l.stopPropagation();else if(tp(e,l),t&4&&-1<D0.indexOf(e)){for(;o!==null;){var c=ai(o);if(c!==null)switch(c.tag){case 3:if(c=c.stateNode,c.current.memoizedState.isDehydrated){var g=un(c.pendingLanes);if(g!==0){var x=c;for(x.pendingLanes|=2,x.entangledLanes|=2;g;){var C=1<<31-Ct(g);x.entanglements[1]|=C,g&=~C}xi(c),(rt&6)===0&&(Ir=oe()+500,Es(0))}}break;case 31:case 13:x=Yl(c,2),x!==null&&Nn(x,c,2),$r(),Lu(c,2)}if(c=ju(l),c===null&&yu(e,t,l,so,n),c===o)break;o=c}o!==null&&l.stopPropagation()}else yu(e,t,l,null,n)}}function ju(e){return e=ca(e),Du(e)}var so=null;function Du(e){if(so=null,e=Cn(e),e!==null){var t=f(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=m(t),e!==null)return e;e=null}else if(n===31){if(e=h(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return so=e,null}function ep(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(ve()){case ze:return 2;case Qe:return 8;case kt:case Kn:return 32;case Dt:return 268435456;default:return 32}default:return 32}}var Ou=!1,Sl=null,Cl=null,Tl=null,Ds=new Map,Os=new Map,Ml=[],D0="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 tp(e,t){switch(e){case"focusin":case"focusout":Sl=null;break;case"dragenter":case"dragleave":Cl=null;break;case"mouseover":case"mouseout":Tl=null;break;case"pointerover":case"pointerout":Ds.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Os.delete(t.pointerId)}}function zs(e,t,n,l,o,c){return e===null||e.nativeEvent!==c?(e={blockedOn:t,domEventName:n,eventSystemFlags:l,nativeEvent:c,targetContainers:[o]},t!==null&&(t=ai(t),t!==null&&Wm(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function O0(e,t,n,l,o){switch(t){case"focusin":return Sl=zs(Sl,e,t,n,l,o),!0;case"dragenter":return Cl=zs(Cl,e,t,n,l,o),!0;case"mouseover":return Tl=zs(Tl,e,t,n,l,o),!0;case"pointerover":var c=o.pointerId;return Ds.set(c,zs(Ds.get(c)||null,e,t,n,l,o)),!0;case"gotpointercapture":return c=o.pointerId,Os.set(c,zs(Os.get(c)||null,e,t,n,l,o)),!0}return!1}function np(e){var t=Cn(e.target);if(t!==null){var n=f(t);if(n!==null){if(t=n.tag,t===13){if(t=m(n),t!==null){e.blockedOn=t,Ni(e.priority,function(){Jm(n)});return}}else if(t===31){if(t=h(n),t!==null){e.blockedOn=t,Ni(e.priority,function(){Jm(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function ro(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=ju(e.nativeEvent);if(n===null){n=e.nativeEvent;var l=new n.constructor(n.type,n);oa=l,n.target.dispatchEvent(l),oa=null}else return t=ai(n),t!==null&&Wm(t),e.blockedOn=n,!1;t.shift()}return!0}function ip(e,t,n){ro(e)&&n.delete(t)}function z0(){Ou=!1,Sl!==null&&ro(Sl)&&(Sl=null),Cl!==null&&ro(Cl)&&(Cl=null),Tl!==null&&ro(Tl)&&(Tl=null),Ds.forEach(ip),Os.forEach(ip)}function oo(e,t){e.blockedOn===t&&(e.blockedOn=null,Ou||(Ou=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,z0)))}var co=null;function lp(e){co!==e&&(co=e,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){co===e&&(co=null);for(var t=0;t<e.length;t+=3){var n=e[t],l=e[t+1],o=e[t+2];if(typeof l!="function"){if(Du(l||n)===null)continue;break}var c=ai(n);c!==null&&(e.splice(t,3),t-=3,jc(c,{pending:!0,data:o,method:n.method,action:l},l,o))}}))}function Ha(e){function t(C){return oo(C,e)}Sl!==null&&oo(Sl,e),Cl!==null&&oo(Cl,e),Tl!==null&&oo(Tl,e),Ds.forEach(t),Os.forEach(t);for(var n=0;n<Ml.length;n++){var l=Ml[n];l.blockedOn===e&&(l.blockedOn=null)}for(;0<Ml.length&&(n=Ml[0],n.blockedOn===null);)np(n),n.blockedOn===null&&Ml.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(l=0;l<n.length;l+=3){var o=n[l],c=n[l+1],g=o[Qt]||null;if(typeof c=="function")g||lp(n);else if(g){var x=null;if(c&&c.hasAttribute("formAction")){if(o=c,g=c[Qt]||null)x=g.formAction;else if(Du(o)!==null)continue}else x=g.action;typeof x=="function"?n[l+1]=x:(n.splice(l,3),l-=3),lp(n)}}}function ap(){function e(c){c.canIntercept&&c.info==="react-transition"&&c.intercept({handler:function(){return new Promise(function(g){return o=g})},focusReset:"manual",scroll:"manual"})}function t(){o!==null&&(o(),o=null),l||setTimeout(n,20)}function n(){if(!l&&!navigation.transition){var c=navigation.currentEntry;c&&c.url!=null&&navigation.navigate(c.url,{state:c.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,o=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),o!==null&&(o(),o=null)}}}function zu(e){this._internalRoot=e}uo.prototype.render=zu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));var n=t.current,l=Hn();Zm(n,l,e,t,null,null)},uo.prototype.unmount=zu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Zm(e.current,2,null,e,null,null),$r(),t[mi]=null}};function uo(e){this._internalRoot=e}uo.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ei();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ml.length&&t!==0&&t<Ml[n].priority;n++);Ml.splice(n,0,e),n===0&&np(e)}};var sp=i.version;if(sp!=="19.2.8")throw Error(r(527,sp,"19.2.8"));q.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(r(188)):(e=Object.keys(e).join(","),Error(r(268,e)));return e=y(t),e=e!==null?b(e):null,e=e===null?null:e.stateNode,e};var U0={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:N,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var fo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!fo.isDisabled&&fo.supportsFiber)try{Zt=fo.inject(U0),ut=fo}catch{}}return Bs.createRoot=function(e,t){if(!u(e))throw Error(r(299));var n=!1,l="",o=hh,c=mh,g=ph;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(c=t.onCaughtError),t.onRecoverableError!==void 0&&(g=t.onRecoverableError)),t=Xm(e,1,!1,null,null,n,l,null,o,c,g,ap),e[mi]=t.current,bu(e),new zu(t)},Bs.hydrateRoot=function(e,t,n){if(!u(e))throw Error(r(299));var l=!1,o="",c=hh,g=mh,x=ph,C=null;return n!=null&&(n.unstable_strictMode===!0&&(l=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onUncaughtError!==void 0&&(c=n.onUncaughtError),n.onCaughtError!==void 0&&(g=n.onCaughtError),n.onRecoverableError!==void 0&&(x=n.onRecoverableError),n.formState!==void 0&&(C=n.formState)),t=Xm(e,1,!0,t,n??null,l,o,C,c,g,x,ap),t.context=Pm(null),n=t.current,l=Hn(),l=Zi(l),o=ul(l),o.callback=null,dl(n,o,l),n=l,t.current.lanes=n,Sn(t,n),xi(t),e[mi]=t.current,bu(e),new uo(t)},Bs.version="19.2.8",Bs}var fp;function X0(){if(fp)return Bu.exports;fp=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(i){console.error(i)}}return a(),Bu.exports=V0(),Bu.exports}var P0=X0();const Z0=gg(P0),fe={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~"},Q0=new TextEncoder;function yd(a){return Q0.encode(a)}function yg(a){if(!a||a.length===0)return"";const s=a.toUpperCase().charCodeAt(0);return s>=65&&s<=90?String.fromCharCode(s-64):a==="@"||a===" "?"\0":a==="["?"\x1B":a==="\\"?"":a==="]"?"":a==="^"?"":a==="_"?"":a==="?"?"":a}function W0(a){return`\x1B${a}`}function hp({ctrl:a,alt:i,shift:s}){return 1+(s?1:0)+(i?2:0)+(a?4:0)}const vg=/^\x1b[[O]([ABCDHF])$/,xg=/^\x1bO([PQRS])$/,wg=/^\x1b\[(\d+)~$/;function Mo(a,i){const{ctrl:s=!1,alt:r=!1,shift:u=!1}=i;if(!s&&!r&&!u)return a;const f=hp(i),m=r&&!s&&!u,h=vg.exec(a);if(h)return`\x1B[1;${f}${h[1]}`;const p=xg.exec(a);if(p)return`\x1B[1;${f}${p[1]}`;const y=wg.exec(a);if(y)return`\x1B[${y[1]};${f}~`;switch(a){case fe.TAB:return u&&!s&&!r?fe.SHIFT_TAB:m?`\x1B${a}`:`\x1B[9;${f}u`;case fe.SHIFT_TAB:return!s&&!r?a:`\x1B[9;${hp({...i,shift:!0})}u`;case fe.ENTER:return m?`\x1B${a}`:`\x1B[13;${f}u`;case fe.BACKSPACE:return s&&!r&&!u?"\b":m?`\x1B${a}`:`\x1B[127;${f}u`;case fe.ESC:return m?`\x1B${a}`:`\x1B[27;${f}u`}let b=a;return u&&a.length===1&&!s&&(b=a.toUpperCase()),s&&(b=yg(b)),r&&(b=W0(b)),b}function J0(a){return[...a].length===1?!0:vg.test(a)||xg.test(a)||wg.test(a)||a===fe.SHIFT_TAB}const Sg=27,Cg=91,ev=60,mp=59,Tg=77,Mg=48,tv=57,nv=64,iv=-30,Yu=32,pp=255;function Ag(a){return Number.isInteger(a)&&(a&iv)===nv}function lv(a){return a>=Mg&&a<=tv}function Iu(a,i){let s=i,r=0;for(;s<a.length&&lv(a[s]);){if(r=r*10+(a[s]-Mg),r>65535)return null;s+=1}return s===i?null:{value:r,next:s}}function av(a,i){if(a[i]!==Sg||a[i+1]!==Cg||a[i+2]!==ev)return-1;const s=Iu(a,i+3);if(!s||!Ag(s.value)||a[s.next]!==mp)return-1;const r=Iu(a,s.next+1);if(!r||a[r.next]!==mp)return-1;const u=Iu(a,r.next+1);return!u||a[u.next]!==Tg?-1:u.next+1}function sv(a,i){if(a[i]!==Sg||a[i+1]!==Cg||a[i+2]!==Tg||i+6>a.length)return-1;const s=a[i+3]-Yu,r=a[i+4],u=a[i+5];return!Ag(s)||r<Yu||r>pp||u<Yu||u>pp?-1:i+6}function Ao(a){if(!a)return!1;const i=a instanceof Uint8Array?a:new Uint8Array(a);if(i.length===0)return!1;let s=0;for(;s<i.length;){const r=av(i,s);if(r>s){s=r;continue}const u=sv(i,s);if(u>s){s=u;continue}return!1}return!0}const rv=3e3,ov=1e4,cv=1500;class uv{constructor(i){Z(this,"ws",null);Z(this,"config");Z(this,"state","disconnected");Z(this,"currentRole","viewer");Z(this,"controllerId");Z(this,"hostId");Z(this,"assignedClientId");Z(this,"reconnectAttempts",0);Z(this,"reconnectTimer",null);Z(this,"pingTimer",null);Z(this,"pingTimestamp",null);Z(this,"lastInboundAt",0);Z(this,"pingSentAt",null);Z(this,"connectStartedAt",0);Z(this,"lastWakeConnectAt",0);Z(this,"probeTimer",null);Z(this,"rejectedByRelay",!1);Z(this,"isManuallyClosed",!1);Z(this,"authFailureDetail",null);Z(this,"authFailureCode",null);Z(this,"temporaryFailureCode",null);Z(this,"pendingInputSegments",[]);Z(this,"isFlushScheduled",!1);Z(this,"listeners",{stateChange:new Set,roleChange:new Set,ready:new Set,paired:new Set,controlState:new Set,controlRevoked:new Set,sessionReady:new Set,exit:new Set,controlGranted:new Set,controlDenied:new Set,status:new Set,peerCount:new Set,hostReconnecting:new Set,sessionRestarted:new Set,error:new Set,binaryData:new Set,rttUpdate:new Set,pasteFileReady:new Set,agentStatus:new Set,updateStatus:new Set});Z(this,"terminalCols",80);Z(this,"terminalRows",24);this.config={...i}}updateConfig(i){this.config={...this.config,...i}}getConfig(){return{...this.config}}getState(){return this.state}getRole(){return this.currentRole}getControllerId(){return this.controllerId}getHostId(){return this.hostId}getAssignedClientId(){return this.assignedClientId}on(i,s){return this.listeners[i].add(s),()=>{this.listeners[i].delete(s)}}emit(i,...s){this.listeners[i].forEach(u=>{try{u(...s)}catch(f){console.error(`Error in event listener for ${i}:`,f)}})}setState(i,s,r){this.state!==i&&(this.state=i,this.emit("stateChange",i,s,r))}connect(i){if(i&&(this.terminalCols=i.cols,this.terminalRows=i.rows),!(this.ws&&(this.ws.readyState===WebSocket.OPEN||this.ws.readyState===WebSocket.CONNECTING))){this.teardownSocket(1e3,"Replaced by a new connection"),this.isManuallyClosed=!1,this.authFailureDetail=null,this.authFailureCode=null,this.temporaryFailureCode=null,this.rejectedByRelay=!1,this.clearTimers(),this.setState("connecting");try{const s=this.resolveWsUrl(this.config.wsUrl),r=new WebSocket(s);this.ws=r,this.connectStartedAt=Date.now(),r.binaryType="arraybuffer",r.onopen=()=>{this.isStaleSocket(r)||this.handleOpen()},r.onmessage=u=>{this.isStaleSocket(r)||this.handleMessage(u)},r.onerror=u=>{this.isStaleSocket(r)||this.handleError(u)},r.onclose=u=>{this.isStaleSocket(r)||this.handleClose(u)}}catch(s){this.setState("error",s instanceof Error?s.message:"Connection failed","connection_failed"),this.scheduleReconnect()}}}isStaleSocket(i){return this.ws!==i}teardownSocket(i=1e3,s="Client closed the connection"){this.pendingInputSegments=[],this.isFlushScheduled=!1;const r=this.ws;if(r){this.ws=null,r.onopen=null,r.onmessage=null,r.onerror=null,r.onclose=null;try{(r.readyState===WebSocket.OPEN||r.readyState===WebSocket.CONNECTING)&&r.close(i,s)}catch{}}}disconnect(){this.isManuallyClosed=!0,this.clearTimers(),this.pendingInputSegments=[],this.isFlushScheduled=!1,this.teardownSocket(1e3,"User initiated disconnect"),this.setState("disconnected")}reconnectWith(i){this.updateConfig(i),this.clearTimers(),this.teardownSocket(1e3,"Reconnecting with new credentials"),this.isManuallyClosed=!1,this.reconnectAttempts=0,this.authFailureDetail=null,this.authFailureCode=null,this.temporaryFailureCode=null,this.connect()}wake(i){if(this.isManuallyClosed||!this.config.autoReconnect||this.authFailureDetail||this.rejectedByRelay)return;const s=Date.now(),r=this.ws;if(!r){if(s-this.lastWakeConnectAt<cv)return;this.lastWakeConnectAt=s,this.reconnectAttempts=0,this.connect();return}if(r.readyState===WebSocket.CONNECTING){s-this.connectStartedAt>ov&&this.dropStaleSocket("connection_stalled");return}r.readyState===WebSocket.OPEN&&s-this.lastInboundAt>this.pingIntervalMs()+2e3&&this.probeLiveness()}pingIntervalMs(){return this.config.pingIntervalMs||1e4}probeLiveness(){const i=this.ws;if(!i||i.readyState!==WebSocket.OPEN||this.probeTimer)return;const s=Date.now();this.sendPing(),this.probeTimer=setTimeout(()=>{this.probeTimer=null,this.ws===i&&this.lastInboundAt<s&&this.dropStaleSocket("connection_stale")},rv)}dropStaleSocket(i){this.clearTimers(),this.teardownSocket(4e3,"Connection went silent"),this.setState("reconnecting","The connection went silent. Reconnecting...",i),this.reconnectAttempts=0,this.lastWakeConnectAt=Date.now(),this.connect()}handleOpen(){this.lastInboundAt=Date.now(),this.sendHello(),this.startHeartbeat()}async handleMessage(i){if(this.lastInboundAt=Date.now(),typeof i.data=="string")try{const s=JSON.parse(i.data);this.processJsonMessage(s)}catch(s){console.warn("Received unparseable text frame from server:",s)}else if(i.data instanceof ArrayBuffer)this.emit("binaryData",new Uint8Array(i.data));else if(typeof Blob<"u"&&i.data instanceof Blob)try{const s=await i.data.arrayBuffer();this.emit("binaryData",new Uint8Array(s))}catch(s){console.error("Failed to convert Blob to ArrayBuffer:",s)}}processJsonMessage(i){switch(i.type){case"ready":{this.reconnectAttempts=0,this.setState("connected"),this.currentRole=i.role,this.controllerId=i.controllerId,this.hostId=i.hostId,this.assignedClientId=i.clientId,this.emit("ready",i),this.emit("roleChange",i.role,i.controllerId,i.hostId,i.clientId),typeof i.clientCount=="number"&&this.emit("peerCount",i.clientCount);break}case"paired":{this.emit("paired",{token:i.token,deviceId:i.deviceId,hostId:i.hostId,expiresAt:i.expiresAt});break}case"control_state":{this.currentRole=i.role,this.controllerId=i.controllerId,this.emit("controlState",i.role,i.controllerId),this.emit("roleChange",i.role,i.controllerId,this.hostId,this.assignedClientId),typeof i.clientCount=="number"&&this.emit("peerCount",i.clientCount);break}case"host_reconnecting":{this.temporaryFailureCode="host_reconnecting",this.setState("reconnecting","Herdr host is reconnecting",i.code||"host_reconnecting"),this.emit("hostReconnecting",i.code);break}case"session_restarted":{this.setState("reconnecting","Herdr session is restarting","session_restarted"),this.emit("sessionRestarted",i.cols,i.rows,i.terminalPalette,i.hostname);break}case"control_revoked":{this.currentRole="viewer",this.emit("controlRevoked",i.reason),this.emit("roleChange","viewer",this.controllerId,this.hostId,this.assignedClientId);break}case"session_ready":{this.setState("connected"),this.emit("sessionReady",i);break}case"exit":{this.emit("exit",i.code,i.reason);break}case"control_granted":{this.currentRole="controller",this.controllerId=this.assignedClientId||this.config.clientId,this.emit("controlGranted"),this.emit("roleChange","controller",this.controllerId,this.hostId,this.assignedClientId);break}case"control_denied":{this.emit("controlDenied",i.message);break}case"status":{this.emit("status",i);break}case"error":{i.code==="host_offline"||i.code==="host_reconnecting"||i.code==="host_reconnect_timeout"||i.code==="rate_limited"?(this.temporaryFailureCode=String(i.code),this.setState("reconnecting",i.message,String(i.code))):(i.code==="auth_required"||i.code==="unauthorized"||i.code==="device_revoked"||i.code==="invalid_handshake"||i.code==="too_many_hosts"||i.code===401||i.code===403)&&(this.authFailureDetail=i.message,this.authFailureCode=String(i.code),this.setState("error",i.message,this.authFailureCode)),this.emit("error",{code:i.code,message:i.message});break}case"pong":{if(this.pingTimestamp){const s=Math.max(0,performance.now()-this.pingTimestamp);this.pingTimestamp=null,this.emit("rttUpdate",Math.round(s))}break}case"paste_file_ready":{this.emit("pasteFileReady",i.path);break}case"agent_status":{this.emit("agentStatus",i);break}case"update_status":{this.emit("updateStatus",i);break}}}handleError(i){console.error("WebSocket error:",i),this.emit("error",{code:"WS_ERROR",message:"WebSocket connection error"})}handleClose(i){if(this.clearTimers(),this.ws=null,this.authFailureDetail){this.setState("error",this.authFailureDetail,this.authFailureCode??void 0);return}if(i.code===1008&&this.temporaryFailureCode){this.setState("reconnecting",i.reason||"The relay is temporarily unavailable",this.temporaryFailureCode),this.scheduleReconnect();return}if(i.code===1008){this.rejectedByRelay=!0,this.setState("error",i.reason||"The relay rejected the connection",String(i.code));return}!this.isManuallyClosed&&this.config.autoReconnect?(this.setState("reconnecting",`Connection closed (${i.code}). Retrying...`,"connection_closed"),this.scheduleReconnect()):this.setState("disconnected",`Closed: ${i.reason||i.code}`,"connection_closed")}scheduleReconnect(){if(this.isManuallyClosed||!this.config.autoReconnect)return;if(this.config.maxReconnectAttempts>0&&this.reconnectAttempts>=this.config.maxReconnectAttempts){this.setState("error","Max reconnect attempts reached");return}this.reconnectAttempts++;const i=this.config.reconnectIntervalMs||2e3,r=Math.min(3e4,Math.floor(i*Math.pow(1.5,this.reconnectAttempts-1)+Math.random()*500));this.reconnectTimer=setTimeout(()=>{this.connect()},r)}startHeartbeat(){this.pingTimer&&clearInterval(this.pingTimer);const i=this.pingIntervalMs();this.pingSentAt=null,this.pingTimer=setInterval(()=>{if(!(!this.ws||this.ws.readyState!==WebSocket.OPEN)){if(this.pingSentAt!==null&&this.lastInboundAt<this.pingSentAt&&Date.now()-this.pingSentAt>=i){this.probeLiveness();return}this.sendPing()}},i)}clearTimers(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.pingTimer&&(clearInterval(this.pingTimer),this.pingTimer=null),this.probeTimer&&(clearTimeout(this.probeTimer),this.probeTimer=null)}sendHello(){const i={type:"hello",protocol:1,clientId:this.config.clientId,cols:this.terminalCols,rows:this.terminalRows,capabilities:["host_handoff"]};this.config.token&&(i.token=this.config.token),this.config.pairCode&&(i.pairCode=this.config.pairCode),this.sendJson(i)}claimControl(i=!1){const s={type:"claim_control",...i?{force:!0}:{}};this.sendJson(s)}releaseControl(){const i={type:"release_control"};this.sendJson(i)}sendResize(i,s){this.terminalCols=i,this.terminalRows=s;const r={type:"resize",cols:i,rows:s};this.sendJson(r)}sendPing(){this.pingTimestamp=performance.now(),this.pingSentAt=Date.now();const i={type:"ping"};this.sendJson(i)}sendPasteFile(i,s){this.sendJson({type:"paste_file",mime:i,dataBase64:s})}sendHerdrStart(){this.sendJson({type:"herdr_start"})}sendJson(i){this.flushInput(),this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify(i))}sendInput(i){const s=i instanceof Uint8Array?i:new Uint8Array(i);s.length!==0&&(this.pendingInputSegments.push(s),this.isFlushScheduled||(this.isFlushScheduled=!0,queueMicrotask(()=>this.flushInput())))}flushInput(){if(this.isFlushScheduled=!1,this.pendingInputSegments.length===0)return;let i=this.pendingInputSegments;if(this.pendingInputSegments=[],this.ws&&(this.ws.bufferedAmount??0)>256*1024&&(i=i.filter(r=>!Ao(r))),i.length===0)return;let s;if(i.length===1)s=i[0];else{let r=0;for(let f=0;f<i.length;f++)r+=i[f].byteLength;s=new Uint8Array(r);let u=0;for(let f=0;f<i.length;f++)s.set(i[f],u),u+=i[f].byteLength}this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(s)}sendBinary(i){this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(i)}sendText(i){const s=yd(i);this.sendInput(s)}resolveWsUrl(i){if(/^wss?:\/\//i.test(i))return i;if(/^https?:\/\//i.test(i)){const s=new URL(i);return s.protocol=s.protocol==="https:"?"wss:":"ws:",(!s.pathname||s.pathname==="/")&&(s.pathname="/ws/client"),s.toString()}if(typeof window<"u"&&window.location){const r=window.location.protocol==="https:"?"wss:":"ws:",u=window.location.host,f=i.startsWith("/")?i:`/${i}`;return`${r}//${u}${f}`}return"ws://127.0.0.1:8787/ws/client"}}function dv(a,i=window,s=document){const r=y=>{var b;((b=i.navigator)==null?void 0:b.onLine)!==!1&&a.wake(y)},u=()=>{s.visibilityState==="visible"&&r("visible")},f=()=>r("pageshow"),m=()=>r("online"),h=()=>r("focus"),p=()=>r("resume");return s.addEventListener("visibilitychange",u),s.addEventListener("resume",p),i.addEventListener("pageshow",f),i.addEventListener("online",m),i.addEventListener("focus",h),()=>{s.removeEventListener("visibilitychange",u),s.removeEventListener("resume",p),i.removeEventListener("pageshow",f),i.removeEventListener("online",m),i.removeEventListener("focus",h)}}const fv=10,hv=24,_o=15,vd=13,xd=640;function mv(){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 Fa()<xd}function Fa(){return typeof window>"u"?1024:window.visualViewport&&typeof window.visualViewport.width=="number"&&window.visualViewport.width>0?window.visualViewport.width:window.innerWidth||1024}function Gu(){return typeof window>"u"?768:window.visualViewport&&typeof window.visualViewport.height=="number"&&window.visualViewport.height>0?window.visualViewport.height:window.innerHeight||768}function Eo(a,i=_o){const s=typeof a=="number"?a:Number(a);return!Number.isFinite(s)||s<=0?i:Math.min(hv,Math.max(fv,Math.round(s)))}function gp(a,i=Fa()){if(i<xd){const r=Eo(a,vd);return Math.min(15,Math.max(12,r))}return Eo(a,_o)}const Eg=[{id:"esc",label:"ESC",code:fe.ESC,type:"key",enabled:!0,title:"Escape"},{id:"tab",label:"TAB",code:fe.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:fe.LEFT,type:"key",enabled:!0,title:"Arrow Left"},{id:"up",label:"↑",code:fe.UP,type:"key",enabled:!0,title:"Arrow Up"},{id:"down",label:"↓",code:fe.DOWN,type:"key",enabled:!0,title:"Arrow Down"},{id:"right",label:"→",code:fe.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:fe.ENTER,type:"key",enabled:!0,title:"Enter / Return"}],pv=[{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:fe.ESC,type:"key",enabled:!0,title:"Escape"},{id:"tab",label:"TAB",code:fe.TAB,type:"key",enabled:!0,title:"Tab"},{id:"shift_tab",label:"⇧TAB",code:fe.SHIFT_TAB,type:"key",enabled:!0,title:"Shift+Tab"},{id:"enter",label:"Enter",code:fe.ENTER,type:"key",enabled:!0,title:"Enter / Return"},{id:"backspace",label:"⌫",code:fe.BACKSPACE,type:"key",enabled:!0,title:"Backspace"},{id:"delete",label:"Del",code:fe.DELETE,type:"key",enabled:!0,title:"Delete"},{id:"left",label:"←",code:fe.LEFT,type:"key",enabled:!0,title:"Arrow Left"},{id:"up",label:"↑",code:fe.UP,type:"key",enabled:!0,title:"Arrow Up"},{id:"down",label:"↓",code:fe.DOWN,type:"key",enabled:!0,title:"Arrow Down"},{id:"right",label:"→",code:fe.RIGHT,type:"key",enabled:!0,title:"Arrow Right"},{id:"home",label:"Home",code:fe.HOME,type:"key",enabled:!0,title:"Home"},{id:"end",label:"End",code:fe.END,type:"key",enabled:!0,title:"End"},{id:"page_up",label:"PgUp",code:fe.PAGE_UP,type:"key",enabled:!0,title:"Page Up"},{id:"page_down",label:"PgDn",code:fe.PAGE_DOWN,type:"key",enabled:!0,title:"Page Down"},{id:"insert",label:"Ins",code:fe.INSERT,type:"key",enabled:!0,title:"Insert"},{id:"ctrl_c",label:"^C",code:fe.CTRL_C,type:"chord",enabled:!0,title:"Ctrl+C (SIGINT)"},{id:"ctrl_d",label:"^D",code:fe.CTRL_D,type:"chord",enabled:!0,title:"Ctrl+D (EOF/Exit)"},{id:"ctrl_z",label:"^Z",code:fe.CTRL_Z,type:"chord",enabled:!0,title:"Ctrl+Z (SIGTSTP)"},{id:"ctrl_l",label:"^L",code:fe.CTRL_L,type:"chord",enabled:!0,title:"Ctrl+L (Clear Screen)"},{id:"ctrl_a",label:"^A",code:fe.CTRL_A,type:"chord",enabled:!0,title:"Ctrl+A (Beginning of Line)"},{id:"ctrl_e",label:"^E",code:fe.CTRL_E,type:"chord",enabled:!0,title:"Ctrl+E (End of Line)"},{id:"ctrl_k",label:"^K",code:fe.CTRL_K,type:"chord",enabled:!0,title:"Ctrl+K (Kill to End)"},{id:"ctrl_r",label:"^R",code:fe.CTRL_R,type:"chord",enabled:!0,title:"Ctrl+R (Reverse Search)"},{id:"f1",label:"F1",code:fe.F1,type:"fn",enabled:!0,title:"F1"},{id:"f2",label:"F2",code:fe.F2,type:"fn",enabled:!0,title:"F2"},{id:"f3",label:"F3",code:fe.F3,type:"fn",enabled:!0,title:"F3"},{id:"f4",label:"F4",code:fe.F4,type:"fn",enabled:!0,title:"F4"},{id:"f5",label:"F5",code:fe.F5,type:"fn",enabled:!0,title:"F5"},{id:"f6",label:"F6",code:fe.F6,type:"fn",enabled:!0,title:"F6"},{id:"f7",label:"F7",code:fe.F7,type:"fn",enabled:!0,title:"F7"},{id:"f8",label:"F8",code:fe.F8,type:"fn",enabled:!0,title:"F8"},{id:"f9",label:"F9",code:fe.F9,type:"fn",enabled:!0,title:"F9"},{id:"f10",label:"F10",code:fe.F10,type:"fn",enabled:!0,title:"F10"},{id:"f11",label:"F11",code:fe.F11,type:"fn",enabled:!0,title:"F11"},{id:"f12",label:"F12",code:fe.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 Ws(){return JSON.parse(JSON.stringify(Eg))}const gv=[["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 bv(a){return gv.some(i=>a.length===i.length&&a.every((s,r)=>s.id===i[r]&&s.enabled!==!1))}function yv(a){if(!Array.isArray(a)||a.length===0)return Ws();const i=a.filter(s=>typeof s=="object"&&s!==null&&typeof s.id=="string"&&typeof s.label=="string"&&typeof s.code=="string");return bv(i)?Ws():i.filter(s=>s.id!=="drawer_agent")}function rd(a,i){if(i){const s=`keyTitles.${a.id}`,r=i(s);if(r&&r!==s)return r}return a.title||a.label}class Si extends Error{constructor(s,r={}){super(s);Z(this,"code");Z(this,"params");this.name="KeyComboError",this.code=s,this.params=r}}const vv={escape:"esc",return:"enter",pgup:"pageup",pgdn:"pagedown",backslash:"\\",plus:"+"},bp={esc:fe.ESC,tab:fe.TAB,enter:fe.ENTER,backspace:fe.BACKSPACE,delete:fe.DELETE,left:fe.LEFT,right:fe.RIGHT,up:fe.UP,down:fe.DOWN,home:fe.HOME,end:fe.END,pageup:fe.PAGE_UP,pagedown:fe.PAGE_DOWN,insert:fe.INSERT,space:" ","+":"+"},xv={esc:"ESC",tab:"TAB",enter:"⏎",backspace:"⌫",delete:"DEL",left:"←",right:"→",up:"↑",down:"↓",home:"HOME",end:"END",pageup:"PGUP",pagedown:"PGDN",insert:"INS",space:"SPACE","+":"+"},wv={2:"²",3:"³",4:"⁴",5:"⁵",6:"⁶",7:"⁷",8:"⁸",9:"⁹"};function Ng(a,i){const s=a.toLowerCase().split("+");if(s.some(p=>!p))throw new Si("invalidStepSyntax",{step:i+1});const r={};let u;for(const p of s)if(p==="ctrl"||p==="control"){if(r.ctrl)throw new Si("duplicateModifier",{step:i+1,modifier:"Ctrl"});r.ctrl=!0}else if(p==="alt"||p==="option"){if(r.alt)throw new Si("duplicateModifier",{step:i+1,modifier:"Alt"});r.alt=!0}else if(p==="shift"){if(r.shift)throw new Si("duplicateModifier",{step:i+1,modifier:"Shift"});r.shift=!0}else if(u===void 0)u=p;else throw new Si("multipleKeys",{step:i+1});if(!u)throw new Si("missingKey",{step:i+1});const f=vv[u]||u,m=/^f(?:[1-9]|1[0-2])$/.exec(f);let h;if(m)h=fe[f.toUpperCase()];else if(Object.hasOwn(bp,f))h=bp[f];else if([...f].length===1&&/^[\x21-\x7e]$/.test(f))h=f;else throw new Si("unsupportedKey",{step:i+1,key:f});return{key:h,keyName:f,modifiers:r,sequence:Cv(h,f,r)}}function Sv(a){return 1+(a.shift?1:0)+(a.alt?2:0)+(a.ctrl?4:0)}function yp(a,i){const s=[...a][0].codePointAt(0);return s===void 0?"":`\x1B[${s};${Sv(i)}u`}function Cv(a,i,s){if(!s.ctrl)return Mo(a,s);if(i.length===1&&/^[\x20-\x7e]$/.test(i)){const r=i.toLowerCase();if(s.alt||s.shift||r==="m"||r==="i")return yp(r,s);if(r==="-"||r==="/"||r==="_")return"";const u=yg(r);return u!==r?u:yp(r,s)}return Mo(a,s)}function Ci(a){if(typeof a!="string"||!a.trim())throw new Si("empty");const i=a.trim().split(/\s+/);if(i.length>8)throw new Si("tooManySteps",{count:8});return i.map((s,r)=>Ng(s,r).sequence)}function qs(a){const i=a.trim().split(/\s+/);return i.length>1&&i.every(s=>["esc","escape"].includes(s.toLowerCase()))?`ESC${wv[i.length]||` ×${i.length}`}`:i.map((s,r)=>{const{keyName:u,modifiers:f}=Ng(s,r),m=xv[u]||(/^f\d+$/.test(u),u.toUpperCase());return f.ctrl&&f.alt&&f.shift?`Ctrl+Alt+⇧${m}`:f.ctrl&&f.alt?`Ctrl+Alt+${m}`:f.ctrl&&f.shift?`^⇧${m}`:f.ctrl?`^${m}`:f.alt&&f.shift?`Alt+⇧${m}`:f.alt?`Alt+${m}`:f.shift?`⇧${m}`:m}).join(" ")}const od='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", "Symbols Nerd Font Mono", monospace',Tv='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',vp="JetBrains Mono, Menlo, Monaco, Consolas, monospace",qa="herdr_remote_settings_v1",Xs="herdr_remote_session_view_v1",kg=64,Js=4096,cd={local:{},session:{}};function er(a,i){if(typeof window>"u")return cd[a][i]||null;try{return(a==="local"?window.localStorage:window.sessionStorage).getItem(i)}catch{return cd[a][i]||null}}function Rl(a,i,s){if(cd[a][i]=s,!(typeof window>"u"))try{(a==="local"?window.localStorage:window.sessionStorage).setItem(i,s)}catch(r){console.warn(`Failed to write to ${a}Storage:`,r)}}const Rg="herdr-remote.ignoredUpdate";function Mv(){return er("local",Rg)}function Av(a){Rl("local",Rg,a)}function Ev(){return`client-${Math.random().toString(36).substring(2,8)}`}function wd(){const a=Math.random().toString(36).substring(2,10);return`profile-${Date.now().toString(36)}-${a}`}function Nv(a,i){return(typeof a=="string"?a.trim().slice(0,kg):"")||i}function No(a,i){if(!a||typeof a!="object"||Array.isArray(a))return null;const s=a,r=typeof s.wsUrl=="string"?s.wsUrl.trim().slice(0,2048):"",u=typeof s.token=="string"?s.token.slice(0,Js):"",f=typeof s.pairCode=="string"?s.pairCode.trim().toUpperCase().slice(0,32):"";if(!r||!r.startsWith("/")&&!/^(?:wss?|https?):\/\//i.test(r)||!u&&!f)return null;const m=Date.now(),h=typeof s.id=="string"&&s.id.length>0?s.id.slice(0,128):wd(),p=typeof s.hostname=="string"&&s.hostname.trim()?s.hostname.trim().slice(0,kg):`Herdr ${i+1}`;return{id:h,displayName:Nv(s.displayName,p),wsUrl:r,token:u,...f?{pairCode:f}:{},...typeof s.hostId=="string"&&s.hostId.trim()?{hostId:s.hostId.trim().slice(0,128)}:{},...typeof s.hostname=="string"&&s.hostname.trim()?{hostname:s.hostname.trim().slice(0,128)}:{},...typeof s.deviceId=="string"&&s.deviceId.trim()?{deviceId:s.deviceId.trim().slice(0,128)}:{},autoReconnect:s.autoReconnect!==!1,createdAt:Number.isFinite(s.createdAt)?Number(s.createdAt):m,lastUsedAt:Number.isFinite(s.lastUsedAt)?Number(s.lastUsedAt):m}}function xp(a,i=0){const s=No({...a,id:a.id||wd()},i);if(!s)throw new Error("a connection profile requires a relay URL and token or pairing code");return s}function wp(a){let i=a.wsUrl.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"").toLowerCase();if(typeof window<"u")try{const s=new URL(a.wsUrl,window.location.origin);s.protocol=s.protocol==="wss:"?"https:":"http:",s.pathname=s.pathname.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"")||"/",s.search="",s.hash="",i=s.toString().replace(/\/$/,"").toLowerCase()}catch{}return`${i}::${a.hostId||""}`}function Lg(){return typeof navigator<"u"&&navigator.language&&navigator.language.toLowerCase().startsWith("zh")?"zh":"en"}function _g(){const a=typeof window<"u"&&window.innerWidth<640;return{wsUrl:"/ws/client",token:"",pairCode:"",clientId:Ev(),autoReconnect:!0,profiles:[],activeProfileId:"",fontSize:a?vd:_o,fontFamily:od,toolbarVisible:!0,toolbarPosition:"bottom",vibrateOnKeyPress:!0,predictiveEcho:"auto",agentAlertBadge:!0,agentAlertSound:!1,agentAlertVibrate:!1,agentAlertNotify:!1,language:Lg(),virtualKeys:Ws(),agentKeymaps:{},adminToken:"",adminTokens:{}}}const kv=["wsUrl","token","pairCode","clientId","autoReconnect","language","agentKeymaps"],Rv=["wsUrl","token","pairCode","autoReconnect"],Sd=["fontSize","fontFamily","toolbarVisible","toolbarPosition","vibrateOnKeyPress","predictiveEcho","virtualKeys","agentAlertBadge","agentAlertSound","agentAlertVibrate","agentAlertNotify","adminToken","adminTokens"],Lv=Sd.filter(a=>a!=="adminToken"&&a!=="adminTokens"),Sp=["theme","colorMode"];function ud(a){const i=a;if(!Sp.some(u=>i[u]!==void 0))return{data:a,changed:!1};const r={...i};for(const u of Sp)delete r[u];return{data:r,changed:!0}}function jg(a){if(!a||typeof a!="object"||Array.isArray(a))return{};const i={};for(const[s,r]of Object.entries(a).slice(0,32))typeof r!="string"||r.length===0||(i[s.slice(0,512)]=r.slice(0,Js));return i}function Dg(a){if(!a||typeof a!="object"||Array.isArray(a))return{};const i=Object.create(null);for(const[s,r]of Object.entries(a).slice(0,32)){if(!/^[a-z][a-z0-9_-]{0,31}$/i.test(s)||["__proto__","constructor","prototype"].includes(s)||!r||typeof r!="object"||Array.isArray(r))continue;const u=r,f={};if(Array.isArray(u.order)&&(f.order=[...new Set(u.order.filter(m=>typeof m=="string"&&/^[a-zA-Z0-9_-]{1,64}$/.test(m)))].slice(0,256)),u.actions&&typeof u.actions=="object"&&!Array.isArray(u.actions)){const m=Object.create(null);for(const[h,p]of Object.entries(u.actions).slice(0,256)){if(!/^[a-zA-Z0-9_-]{1,64}$/.test(h)||!p||typeof p!="object"||Array.isArray(p))continue;const y=p,b={};if(typeof y.keys=="string"&&y.keys.trim()){const v=y.keys.trim().slice(0,80);try{Ci(v),b.keys=v}catch{}}typeof y.hidden=="boolean"&&(b.hidden=y.hidden),Object.keys(b).length>0&&(m[h]=b)}f.actions=m}if(Array.isArray(u.custom)){const m=new Set;f.custom=u.custom.slice(0,64).flatMap(h=>{if(!h||typeof h!="object"||Array.isArray(h))return[];const p=h;if(typeof p.id!="string"||!/^[a-zA-Z0-9_-]{1,64}$/.test(p.id)||["__proto__","constructor","prototype"].includes(p.id)||m.has(p.id))return[];if(typeof p.label!="string"||!p.label.trim()||typeof p.keys!="string"||!p.keys.trim())return[];const y=p.keys.trim().slice(0,80);try{Ci(y)}catch{return[]}return m.add(p.id),[{id:p.id,label:p.label.trim().slice(0,64),keys:y}]})}i[s]=f}return i}function Og(a){var f;const i=[];if((Array.isArray(a.profiles)?a.profiles.slice(0,64):[]).forEach((m,h)=>{const p=No(m,h);p&&!i.some(y=>y.id===p.id)&&i.push(p)}),i.length===0&&(typeof a.token=="string"&&a.token||typeof a.pairCode=="string"&&a.pairCode)){const m=No({id:"profile-migrated",displayName:"Herdr 1",wsUrl:typeof a.wsUrl=="string"&&a.wsUrl.trim()?a.wsUrl:"/ws/client",token:a.token||"",pairCode:a.pairCode||"",autoReconnect:a.autoReconnect!==!1},0);m&&i.push(m)}const r=typeof a.activeProfileId=="string"?a.activeProfileId:"",u=i.some(m=>m.id===r)?r:((f=i[0])==null?void 0:f.id)||"";return{profiles:i,activeProfileId:u}}function zg(){const a=_g();if(typeof window>"u")return a;let i={};const s=er("local",qa);if(s)try{i=JSON.parse(s)}catch(le){console.warn("Failed to parse localStorage settings:",le)}const r=ud(i);r.changed&&(i=r.data,Rl("local",qa,JSON.stringify(i)));let u=null;const f=er("session",Xs);if(f)try{u=JSON.parse(f)}catch(le){console.warn("Failed to parse sessionStorage settings:",le)}if(!u){const le={};for(const ye of Sd)i[ye]!==void 0&&(le[ye]=i[ye]);u=le,Rl("session",Xs,JSON.stringify(u))}let m=u.fontFamily??i.fontFamily??a.fontFamily;(!m||m===vp||m===Tv)&&(m=od);const h=window.innerWidth<640?vd:_o,p=u.fontSize??i.fontSize??a.fontSize,y=Eo(p,h),b=u.virtualKeys??i.virtualKeys??a.virtualKeys,v=yv(b),S=i.language??a.language,T=S==="zh"||S==="en"?S:Lg(),E=Og(i),G=E.profiles.find(le=>le.id===E.activeProfileId),A=ud(u);A.changed&&(u=A.data,Rl("session",Xs,JSON.stringify(u)));const z=u.toolbarVisible??i.toolbarVisible??a.toolbarVisible,B=u.toolbarPosition??i.toolbarPosition??a.toolbarPosition,Y=u.vibrateOnKeyPress??i.vibrateOnKeyPress??a.vibrateOnKeyPress,ae=le=>{const ye=u[le]??i[le];return typeof ye=="boolean"?ye:a[le]},he=(u==null?void 0:u.predictiveEcho)??(i==null?void 0:i.predictiveEcho)??a.predictiveEcho,ee=he==="always"||he==="off"||he==="auto"?he:"auto",F=typeof u.adminToken=="string"?u.adminToken.slice(0,Js):typeof i.adminToken=="string"?i.adminToken.slice(0,Js):a.adminToken,H=jg(u.adminTokens),re={...a,...i,...u,wsUrl:(G==null?void 0:G.wsUrl)||(typeof i.wsUrl=="string"?i.wsUrl:a.wsUrl),token:(G==null?void 0:G.token)||"",pairCode:(G==null?void 0:G.pairCode)||"",autoReconnect:(G==null?void 0:G.autoReconnect)??a.autoReconnect,profiles:E.profiles,activeProfileId:E.activeProfileId,clientId:typeof i.clientId=="string"&&i.clientId.trim()?i.clientId.trim().slice(0,128):a.clientId,fontFamily:m,fontSize:y,toolbarVisible:z,toolbarPosition:B,vibrateOnKeyPress:Y,predictiveEcho:ee,virtualKeys:v,agentKeymaps:Dg(i.agentKeymaps),agentAlertBadge:ae("agentAlertBadge"),agentAlertSound:ae("agentAlertSound"),agentAlertVibrate:ae("agentAlertVibrate"),agentAlertNotify:ae("agentAlertNotify"),language:T,adminToken:F,adminTokens:H};return i.fontFamily===vp&&(i.fontFamily=od,Rl("local",qa,JSON.stringify(i))),re}function El(a){var S;const s={...zg(),...a};s.agentKeymaps=Dg(s.agentKeymaps),s.adminTokens=jg(s.adminTokens),typeof s.adminToken=="string"&&(s.adminToken=s.adminToken.slice(0,Js)),a.fontSize!==void 0&&(s.fontSize=Eo(a.fontSize)),a.predictiveEcho!==void 0&&(a.predictiveEcho==="auto"||a.predictiveEcho==="always"||a.predictiveEcho==="off"?s.predictiveEcho=a.predictiveEcho:s.predictiveEcho="auto");const r=Og(s);let u=r.profiles,f=r.activeProfileId;if(Rv.some(T=>a[T]!==void 0)){const T=u.findIndex(A=>A.id===f),E=T>=0?{...u[T]}:{id:wd(),displayName:`Herdr ${u.length+1}`,wsUrl:s.wsUrl,token:"",autoReconnect:!0,createdAt:Date.now(),lastUsedAt:Date.now()};E.wsUrl=s.wsUrl,E.token=s.token,E.pairCode=s.pairCode||void 0,E.autoReconnect=s.autoReconnect,E.lastUsedAt=Date.now();const G=No(E,Math.max(T,0));G?T>=0?u[T]=G:(u.push(G),f=G.id):T>=0&&(u=u.filter(A=>A.id!==f),f=((S=u[0])==null?void 0:S.id)||"")}u.length>0&&!u.some(T=>T.id===f)&&(f=u[0].id);const h=u.find(T=>T.id===f);s.profiles=u,s.activeProfileId=f,s.wsUrl=(h==null?void 0:h.wsUrl)||s.wsUrl||"/ws/client",s.token=(h==null?void 0:h.token)||"",s.pairCode=(h==null?void 0:h.pairCode)||"",s.autoReconnect=(h==null?void 0:h.autoReconnect)??s.autoReconnect;const p=er("local",qa);let y={};if(p)try{y=JSON.parse(p)}catch{}y=ud(y).data;for(const T of kv)s[T]!==void 0&&(y[T]=s[T]);y.profiles=u,y.activeProfileId=f,Rl("local",qa,JSON.stringify(y));const b=er("session",Xs);let v={};if(b)try{v=JSON.parse(b)}catch{}for(const T of Sd)s[T]!==void 0&&(v[T]=s[T]);Rl("session",Xs,JSON.stringify(v));for(const T of Lv)s[T]!==void 0&&(y[T]=s[T]);return Rl("local",qa,JSON.stringify(y)),s}const _v={header:{appName:"Herdr",tagline:"remote terminal client",terminalTab:"Terminal",adminTab:"Admin",rttMs:"{rtt}ms",hostLabel:"Host",clientIdLabel:"ID:",copyClientIdTitle:"Click to copy Client ID",languageToggleTitle:"Switch language (EN / 中文)",pairingTitle:"Connection & pairing",settingsTitle:"Terminal settings",virtualKeyboardTitle:"Quick command helper",latencyTitle:"Round-trip latency (RTT)",mainNavigationAria:"Main Navigation",actionKeyboard:"cmd",actionPairing:"link",actionSettings:"cfg",languageShort:"en"},common:{connecting:"Connecting...",connected:"Connected",reconnecting:"Reconnecting...",disconnected:"Disconnected",error:"Error",save:"Save",cancel:"Cancel",close:"Close",done:"Done",retry:"Retry",connect:"Connect",disconnect:"Disconnect",copy:"Copy",copied:"Copied",loading:"Loading...",offline:"Offline",role:"Role",host:"Host",status:"Status",settings:"Settings",admin:"Admin",terminal:"Terminal",pairing:"Pairing",keyBar:"Key bar",quickInput:"Quick input",dismissNotification:"Dismiss notification",closeDialog:"Close dialog",clickToCopy:"Click to copy",controller:"Controller",viewer:"Viewer",live:"Live"},connection:{live:"Live",connecting:"Connecting",reconnecting:"Reconnecting",reconnectNow:"Reconnect now",error:"Error",offline:"Offline",connect:"Connect",retry:"Retry"},role:{controllerMode:"Controller mode active",viewerMode:"Viewer mode",controlActive:"Full Control",viewerReadOnly:"Viewer",viewerWithController:"Viewer (Active: {controllerId})",sharedControl:"Full control",sharedControlDesc:"Every paired window shares this terminal and may type into it.",sharedWindows:"{count} windows",thisWindow:"Window",claimControl:"Claim Control",claimControlTitle:"Claim terminal control",releaseControl:"Release",releaseControlTitle:"Switch to viewer mode",takeoverControl:"Takeover",takeoverControlTitle:"Take over control from {controllerId}",takeoverModalTitle:"Confirm Control Takeover",takeoverModalDesc:"Another client is controlling this terminal.",takeoverModalWarning:"Input focus will transfer to this window.",confirmTakeover:"Confirm Takeover"},statusBanner:{connecting:"Connecting to relay...",reconnectingDefault:"Connection lost. Reconnecting...",reconnectNow:"Reconnect Now",errorDefault:"Unable to connect to relay",disconnected:"Terminal disconnected"},update:{chip:"↑ herdr-remote {version}",chipCompact:"↑ {version}",chipRestart:"↻ restart for {version}",toast:"herdr-remote {version} is out for this workstation",toastRestart:"herdr-remote {version} is installed; restart it to apply",title:"herdr-remote update",running:"Running",installed:"Installed",latest:"Latest",restartPending:"{version} is installed but not running yet. Restart herdr-remote on the workstation:",stepTui:'On the workstation, open herdr-remote (the TUI), go to "Language & about" and press Enter on the update row.',stepCli:"Or run on the workstation:",restartNote:"Restarting reconnects this window after a few seconds.",ignore:"Skip this version"},herdrLaunch:{title:"Herdr is not running",body:"Herdr is not running on {host}. Start it on that workstation?",scope:"Only this paired workstation's own Herdr starts, as that workstation's user. No other machine is touched.",start:"Start Herdr",starting:"Starting Herdr on {host}…",failedTitle:"Herdr did not start",timeout:"The workstation did not answer within 30 seconds. Its herdr-remote may be too old to start Herdr from a browser.",thisHost:"this workstation"},onboarding:{title:"Pair with Herdr Remote",subtitle:"Connect your mobile or browser to your local terminal session",description:"Control Herdr sessions from any browser or phone.",firstTimeSetup:"First-time Setup",authRequired:"Authorization Required",authRequiredDesc:"Pair your device or provide a valid access token.",step1Title:"Generate Pairing Code on Host",step1Desc:"Run on the host running Herdr:",step1TuiNote:"Interactive TUI config:",step2Title:"Enter 6-character Pairing Code",step2Placeholder:"e.g. 7X9K2A",step2Note:"Pairing code expires in 5 minutes; credentials are saved automatically.",connectAndPair:"Connect & Pair",connectingAndPairing:"Pairing with Relay...",advancedTitle:"Advanced Options",manualTokenLabel:"Authentication Token",manualTokenPlaceholder:"Optional token (skips pairing code)",wsEndpointLabel:"Relay WebSocket Endpoint",wsEndpointPlaceholder:"/ws/client or wss://your-relay-host/ws/client",clientIdLabel:"Device Client Identifier"},pairing:{title:"Relay Connection & Pairing",addTitle:"Add Herdr Instance",displayNameLabel:"Host Name",displayNamePlaceholder:"e.g. Workstation",displayNameHelp:"This name is stored only in this browser.",credentialsRequired:"Enter a pairing code or device token.",subtitle:"Manage WebSocket endpoints and credentials",pairCodeLabel:"Pairing Code",pairCodeNote:"(6-char code)",pairCodePlaceholder:"e.g. A1B2C3",pairCodeHelp:'Run "herdr-remote pair" on host.',tokenLabel:"Access Token",tokenNote:"(Device secret)",tokenPlaceholder:"Device token...",wsUrlLabel:"Relay WebSocket Endpoint URL",wsUrlPlaceholder:"/ws/client",wsUrlDefaultNote:"Defaults to same-origin /ws/client",clientIdLabel:"Client Identifier",newIdButton:"New ID",regenerateClientIdTitle:"Regenerate client ID",autoReconnectLabel:"Auto-reconnect",autoReconnectDesc:"Automatically reconnect when disconnected",copyDirectLink:"Copy direct pairing link",saveAndConnect:"Save & Connect"},settings:{title:"Terminal Preferences",subtitle:"Font, size, and touch settings",tabGeneral:"General",tabAppearance:"Appearance & Font",tabVirtualKeys:"Virtual Keys",tabAgentKeymaps:"Agent Keys",fontFamilyLabel:"Monospace Font",fontSizeLabel:"Terminal Text Size ({size}px)",fontSizeCompact:"10px (Compact)",fontSizeDefault:"15px (Default)",fontSizeLarge:"24px (Large)",mobileFontNote:"Terminal font scales automatically on small screens for 80-column layout.",colorPassthroughNote:"Terminal colors and cursor style pass through from the host.",predictiveEchoLabel:"Predictive Echo",predictiveEchoAuto:"Auto",predictiveEchoAlways:"Always On",predictiveEchoOff:"Off",predictiveEchoDesc:"Under high latency, show what you type in a shell prompt or an agent’s input box before the echo comes back. Menus and other screens are never predicted.",touchKeyToolbar:"Touch Key Toolbar",touchKeyToolbarDesc:"Show modifier and navigation keys",touchHaptics:"Haptic Feedback",touchHapticsDesc:"Vibrate on key press",agentAlertsLabel:"Agent alerts",agentAlertBadge:"Title and icon badge",agentAlertBadgeDesc:"Count blocked and finished agents in the tab title, and mark the tab icon",agentAlertVibrate:"Vibrate",agentAlertVibrateDesc:"When an agent stops to ask or finishes, while this page is on screen",agentAlertSound:"Chime",agentAlertSoundDesc:"A short sound while this page is in the background; starts working after your next tap",agentAlertNotify:"System notification",agentAlertNotifyDesc:"While this page is in the background (HTTPS only)",languageLabel:"Language",languageDesc:"Choose English or 简体中文",resetDefaults:"Reset to Defaults",resetDefaultsToast:"Settings reset to defaults",windowZoomSharedNote:"Host view isolation is not active; zoom applies locally.",fontSizeZoomHelp:"Adjusts font size in this window only."},agentKeymaps:{keymapLabel:"Keymap",auto:"Auto",shell:"Shell",agentGroup:"Agent",genericGroup:"General",settingsProfileLabel:"Agent profile",autoProfile:"Auto · {profile}",pinnedProfile:"Pinned · {profile}",barGroup:"Key bar",barHint:"Tap to choose which {profile} shortcuts appear on the key bar ({count} shown). Saved in this browser, per agent. ESC, arrows and other base keys are on the Virtual Keys tab.",restoreBar:"Restore default keys",customizeBar:"Choose which shortcuts the key bar shows",customizeBarShort:"Edit",shortcutLabel:"Shortcut",comboPlaceholder:"e.g. ctrl+e or esc esc",invalidCombo:"Invalid shortcut: {error}",defaultCombo:"Default: {combo}",resetAction:"Reset",moveUp:"Move up",moveDown:"Move down",unverified:"Unverified",addCustom:"Custom key",customLabel:"Function name",customCombo:"Key combo",addAction:"Add custom key",restoreProfile:"Restore this agent defaults",removeCustom:"Remove custom key",configHint:"Agent config: {path}",noAgentActions:"No agent-specific shortcuts.",errors:{empty:"Enter at least one key.",tooManySteps:"A shortcut can have at most {count} steps.",invalidStepSyntax:"Step {step} has invalid syntax. Use ctrl+o or esc esc.",duplicateModifier:"Step {step} repeats {modifier}.",missingKey:"Step {step} needs a key after the modifiers.",multipleKeys:"Step {step} can have only one key.",unsupportedKey:"Step {step} does not support “{key}”."}},agentActions:{mode:"Mode",rewind:"Rewind",details:"Details",model:"Model",thinking:"Thinking",todos:"Tasks",background:"Background",editor:"Editor",history:"History",stash:"Stash",pasteImage:"Paste image",newline:"New line",interrupt:"Interrupt",editPrevious:"Edit previous",queue:"Queue prompt",copy:"Copy",clear:"Clear",yolo:"YOLO mode",expand:"Expand",undo:"Undo",agent:"Next agent",agentBack:"Previous agent",palette:"Command palette",recentModel:"Recent model",variant:"Model variant",newSession:"New session",sessions:"Sessions",thinkingMode:"Thinking mode",nextModel:"Next model",modelPicker:"Model picker",tools:"Tools",thinkingBlocks:"Thinking blocks",followup:"Follow-up",dequeue:"Remove from queue",plan:"Plan mode",temporaryModel:"Temporary model",expandAll:"Expand all",reasoning:"Reasoning effort",review:"Review",specMode:"Spec mode",autonomy:"Autonomy",undoPicker:"Undo picker",steer:"Steer",sidebar:"Sidebar",agents:"Agents",permissionMode:"Permission mode",bypass:"Bypass permissions",tasks:"Tasks",interject:"Interject",multiline:"Multiline input",shortcuts:"Shortcuts",approve:"Approve",eof:"End of input",suspend:"Suspend",startOfLine:"Line start",endOfLine:"Line end",killToEnd:"Delete to line end",agentSwap:"Switch agent",activity:"Activity",planAct:"Plan / Act",autoApprove:"Auto-approve",search:"Search"},virtualKeyboard:{collapseToolbar:"Collapse Toolbar",expandToolbar:"Expand Toolbar",helperTitle:"Quick Commands",closeHelper:"Close Helper",placeholder:"Type command and press Enter...",sendButton:"Send",clearInput:"Clear Input",customizeTitle:"Custom Key Toolbar",customizeDesc:"Reorder, enable, or disable keys for your toolbar.",enabledKeysCount:"{count} keys enabled",resetLayout:"Reset to Default",addKey:"Add Key",availableKeys:"Available Keys",moveUp:"Move Up",moveDown:"Move Down",enableKey:"Enable Key",disableKey:"Disable Key",deleteKeyTitle:"Remove Key",keyTypeModifier:"Modifier",keyTypeNav:"Navigation",keyTypeAction:"Action",keyTypeChord:"Chord",keyTypeFn:"Function",keyTypeSymbol:"Symbol",fnDrawerTitle:"Function Keys (F1-F12)",chordsDrawerTitle:"Control Chords (^C, ^D, ^Z)",symbolsDrawerTitle:"Symbols (~, |, /, \\)",touchKeyboardShortcuts:"Shortcuts Toolbar",ctrlCTitle:"Ctrl+C (SIGINT)",ctrlDTitle:"Ctrl+D (EOF)",ctrlZTitle:"Ctrl+Z (SIGTSTP)",ctrlLTitle:"Ctrl+L (Clear)",ctrlRTitle:"Ctrl+R (Search)",ctrlATitle:"Ctrl+A (Start of line)",ctrlETitle:"Ctrl+E (End of line)",ctrlKTitle:"Ctrl+K (Kill to end)",badgeSigint:"SIGINT",badgeEof:"EOF",badgeTstp:"SIGTSTP",badgeClear:"CLEAR",badgeSearch:"SEARCH",badgeStart:"START",badgeEnd:"END",badgeKill:"KILL",keyEnter:"Enter",uploadImage:"Upload Image",uploadImageTitle:"Select and upload image to terminal",image:"Image",uploadProgressReading:"Reading...",uploadProgressProcessing:"Compressing...",uploadProgressSending:"Uploading...",uploadProgressWaitingHost:"Waiting for host...",uploadProgressCompleted:"Completed",uploadProgressFailed:"Upload failed"},profiles:{title:"Herdr instances",switcherLabel:"Switch Herdr instance",current:"current",empty:"No paired Herdr instances yet.",addHost:"Add Herdr instance",rename:"Rename instance",remove:"Remove locally",removeConfirm:"Remove this saved connection from this browser?"},mobile:{sessionControls:"Session controls",closeSessionControls:"Close session controls",connectionStatusAria:"Connection status",terminalControlAria:"Terminal control",inputControl:"Input control",settingsAria:"Terminal settings",adminAria:"Admin dashboard",pairingAria:"Connection & pairing",keybarAria:"Toggle key toolbar",quickInputAria:"Toggle quick commands",menu:"Menu",statusBarAria:"Session status bar"},terminal:{bannerTitle:"Herdr Remote WebUI",bannerSubtitle:"Connected to Herdr session.",windowAriaLabel:"Terminal Window",bufferAriaLabel:"Terminal Buffer",offlineStatusAria:"Offline Status",releaseControlAria:"Release Control",takeoverControlAria:"Takeover Control",claimControlAria:"Claim Control"},keyTitles:{esc:"Escape (ESC)",tab:"Tab",shift_tab:"Shift+Tab (Claude Code: cycle modes)",ctrl:"Toggle Ctrl Lock",alt:"Toggle Alt Lock",shift:"Toggle Shift Lock",meta:"Meta / Cmd",enter:"Enter",backspace:"Backspace",delete:"Delete",left:"Left (←)",up:"Up (↑)",down:"Down (↓)",right:"Right (→)",home:"Home",end:"End",page_up:"Page Up",page_down:"Page Down",insert:"Insert",drawer_chords:"Ctrl Chords",drawer_agent:"Agent shortcuts",drawer_symbols:"Symbols",drawer_fn:"Function Keys (F1-F12)",ctrl_c:"Ctrl+C (SIGINT)",ctrl_d:"Ctrl+D (EOF)",ctrl_z:"Ctrl+Z (SIGTSTP)",ctrl_l:"Ctrl+L (Clear)",ctrl_a:"Ctrl+A (Start of line)",ctrl_e:"Ctrl+E (End of line)",ctrl_k:"Ctrl+K (Kill to end)",ctrl_r:"Ctrl+R (Search history)",f1:"F1",f2:"F2",f3:"F3",f4:"F4",f5:"F5",f6:"F6",f7:"F7",f8:"F8",f9:"F9",f10:"F10",f11:"F11",f12:"F12",sym_pipe:"Pipe (|)",sym_tilde:"Tilde (~)",sym_slash:"Slash (/)",sym_backslash:"Backslash (\\)",sym_dash:"Dash (-)",sym_underscore:"Underscore (_)",sym_dollar:"Dollar ($)",sym_ampersand:"Ampersand (&)",sym_quote:'Quote (")',sym_backtick:"Backtick (`)"},admin:{title:"Admin Dashboard",subtitle:"Connected hosts, paired devices, and relay traffic",returnToTerminal:"Return to Terminal",terminalShells:"Terminal Shells",startedAt:"Started at {time}",accessPanel:"Access",acrossWindows:"across {count} windows",perSecond:"{value}/s",framesPerSecond:"{count} fps",unitDay:"d",unitHour:"h",unitMinute:"m",unitSecond:"s",startedRecently:"Started recently",updatedAt:"Updated at {time}",autoRefresh:"Auto Refresh:",paused:"Paused",refreshNow:"Refresh",connectedHosts:"Connected Hosts",activeUsers:"Active Users",activePtys:"Active PTYs",activeController:"Active Controller",uptime:"Uptime",none:"None",noHost:"No host connected",tabOverview:"Overview",tabClients:"Clients ({count})",tabPtys:"PTY Sessions ({count})",tabDevices:"Paired Devices ({count})",throughput:"Throughput",bytesInTotal:"Total Inbound:",bytesOutTotal:"Total Outbound:",frameRate:"Frame Rate:",hostsTitle:"Hosts ({count})",noHosts:"No hosts connected or paired",hostConnectedDevices:"{count} connected",hostPairedDevices:"{count} paired",hostStatusOnline:"Online",hostStatusBusy:"In use",hostStatusReconnecting:"Reconnecting",hostStatusOffline:"Offline",hostRosterOperatorOnly:"Device list is visible to the relay operator only.",connectedClientsTitle:"Connected Clients ({count})",noClients:"No clients connected",colClientId:"Client ID",colDevice:"Device",colDeviceId:"Device ID",colLastSeen:"Last Seen",colActions:"Actions",unknownDevice:"Unknown Device",pairedDevicesTitle:"Paired Devices ({count})",noDevices:"No paired devices",revokeDevice:"Revoke",revokeConfirm:"Confirm Revocation",revokeFailed:"Revocation failed",colRole:"Role",colIp:"IP Address",colConnectedAt:"Connected At",colTraffic:"Traffic (In/Out)",activePtysTitle:"Active PTY Sessions ({count})",noPtys:"No active PTY sessions",colPtyId:"PTY ID",colPid:"PID",colCommand:"Command",colGrid:"Grid",colCwd:"Working Directory",colViewers:"Windows",copiedJson:"Copied",unauthorizedTitle:"Unauthorized (401/403)",unauthorizedDesc:"GET /api/status requires an authorized device token.",pairingStepsTitle:"Device Pairing:",pairingStepsHelp:"Run pairing command on host to get a code, then enter it here.",enterPairCodeBtn:"Enter Pairing Code",retryFetchBtn:"Retry Status",errorConnecting:"Failed to fetch GET /api/status: {error}",loadingStatus:"Loading status from /api/status...",remoteRelayTitle:"Remote Relay Administration",remoteRelayBadge:"Connected to Remote Relay",remoteRelayNotice:"Connected to remote relay. For server metrics, access the operator dashboard.",remoteRelayEndpoint:"Remote WebSocket Endpoint:",remoteRelayAdminUrl:"Remote Admin URL:",openRemoteAdminBtn:"Open Remote Admin",remoteRelayHelp:"Open remote relay admin dashboard.",relayAdminTitle:"Relay Operator Dashboard",relayAdminTokenLabel:"Relay Admin Token (X-Relay-Admin-Token)",relayAdminTokenPlaceholder:"Enter RELAY_ADMIN_TOKEN...",relayAdminNotConfigured:"RELAY_ADMIN_TOKEN is not configured on this relay.",relayAdminLoginBtn:"Verify & View Metrics",relayAdminAuthError:"Invalid or unauthorized admin token.",remoteRelayClientNotice:"Terminal client connection. For server metrics, use the operator dashboard.",openOperatorPortal:"Open Operator Dashboard",localWorkstationBadge:"Local Relay",modeLocal:"Local Mode",modeRemote:"Remote Mode",hintTabs:"switch tabs",hintRefresh:"refresh status",hintBack:"return to terminal"},toasts:{connected:"Connected to relay",connectionError:"Connection error",controlGranted:"Control granted",controlDenied:"Request denied: another controller is active",controlRevoked:"Control transferred to another device",pairedSuccess:"Paired successfully",sessionEnded:"Session ended",controlReleased:"Control released",viewerModeWarning:'In viewer mode. Click "Claim Control" first.',clientIdCopied:"Client ID copied: {id}",pairingLinkCopied:"Pairing link copied",switchedLanguage:"Language switched to {lang}",settingsReset:"Settings reset to default",fontReset:"Font reset to default",commandCopied:"Command copied",keyLayoutReset:"Key layout reset"},shortcuts:{title:"Shortcuts",help:"Active outside terminal input area:",terminalInputNote:"Terminal shortcuts pass directly to host PTY."},serverErrors:{auth_required:"Pairing required: enter a pairing code, or a device token that is still valid.",unauthorized:"This device is not authorised for that workstation.",host_offline:"The paired workstation is not connected to this relay.",host_disconnected:"The workstation disconnected.",stale_host:"The workstation stopped answering and was dropped.",too_many_clients:"That workstation has reached its window limit.",rate_limited:"Too many pairing attempts. Wait a minute and try again.",invalid_handshake:"The relay rejected the handshake. Reload the page.",device_revoked:"This device was revoked by the relay operator.",connection_closed:"Connection closed. Reconnecting…",connection_stale:"The connection went quiet while the page was away. Reconnecting…",connection_stalled:"Connecting took too long. Trying again…",connection_failed:"Could not open a connection to the relay.",host_reconnecting:"The Herdr host is reconnecting.",host_reconnect_timeout:"The Herdr host did not reconnect in time.",host_replaced:"The Herdr host connection was replaced.",slow_client:"This browser was disconnected because it could not keep up.",client_send_failed:"The relay could not send data to this browser.",too_many_hosts:"This relay has reached its host limit.",paste_file_unsupported:"Unsupported image format for paste.",paste_file_too_large:"Pasted image exceeds 3 MB limit.",paste_file_write_failed:"Failed to save pasted image on host.",paste_file_empty:"Pasted image payload is empty.",paste_file_corrupt:"Pasted image data is corrupt or does not match declared MIME.",viewer_mode:"Viewer mode cannot paste to terminal.",no_session:"Terminal session is not ready."},fontPresets:{system:"System Default",apple:"SF Mono / Menlo",windows:"Consolas",linux:"Liberation Mono",courier:"Courier New",firacode:"Fira Code"},agents:{title:"Agents on this workstation",blocked:"blocked",done:"done",working:"working",allIdle:"agents idle",notifyBlocked:"{count} agent(s) waiting for you",notifyDone:"{count} agent(s) finished"},clipboard:{openLink:"Open Link",openLinkFailed:"This link cannot be opened from the browser",copySelection:"Copy Selection",copyLine:"Copy Line",copyScreen:"Copy Screen",paste:"Paste",cancel:"Cancel",copied:"Copied to clipboard",copyFailed:"Failed to copy",pasteHint:"Long-press here to paste, then tap Send",pasteSend:"Send",pasteUnavailable:"Clipboard is empty or unavailable",pasteTitle:"Paste Content",pasted:"Pasted",chooseImage:"Choose Image",takePhoto:"Take Photo",imageTooLarge:"Image exceeds 3 MB limit and cannot be compressed further.",imageCompressedSize:"Compressed: {size}",fileEmpty:"File is empty.",decodeFailed:"Failed to decode image file.",unsupportedType:"Unsupported format. Only PNG, JPEG, WebP, and GIF are supported.",imageSectionTitle:"Image",textSectionTitle:"Text",imageCompressing:"Processing image...",removeImage:"Remove image"}},jv={header:{appName:"Herdr",tagline:"远程终端客户端",terminalTab:"终端",adminTab:"管理面板",rttMs:"{rtt}ms",hostLabel:"主机",clientIdLabel:"客户端 ID:",copyClientIdTitle:"点击复制客户端 ID",languageToggleTitle:"切换语言 (EN / 中文)",pairingTitle:"连接与配对",settingsTitle:"终端设置",virtualKeyboardTitle:"快捷命令",latencyTitle:"网络延迟 (RTT)",mainNavigationAria:"主导航菜单",actionKeyboard:"命令",actionPairing:"配对",actionSettings:"设置",languageShort:"中"},common:{connecting:"连接中...",connected:"已连接",reconnecting:"重连中...",disconnected:"已断开",error:"错误",save:"保存",cancel:"取消",close:"关闭",done:"完成",retry:"重试",connect:"连接",disconnect:"断开连接",copy:"复制",copied:"已复制",loading:"加载中...",offline:"离线",role:"角色",host:"主机",status:"连接状态",settings:"设置",admin:"管理面板",terminal:"终端",pairing:"配对",keyBar:"按键条",quickInput:"快捷输入",dismissNotification:"关闭通知",closeDialog:"关闭对话框",clickToCopy:"点击复制",controller:"控制端",viewer:"观察者",live:"运行中"},connection:{live:"在线",connecting:"连接中",reconnecting:"正在重连",reconnectNow:"立即重连",error:"连接错误",offline:"离线",connect:"发起连接",retry:"重试"},role:{controllerMode:"控制模式",viewerMode:"观察者模式",controlActive:"控制端",viewerReadOnly:"观察者",viewerWithController:"观察者(控制者: {controllerId})",sharedControl:"完全控制",sharedControlDesc:"所有已配对窗口共享同一个终端,均可输入。",sharedWindows:"{count} 个窗口",thisWindow:"本窗口",claimControl:"获取控制权",claimControlTitle:"获取终端控制权",releaseControl:"释放控制权",releaseControlTitle:"切回观察者模式",takeoverControl:"强占控制权",takeoverControlTitle:"从 {controllerId} 接管控制权",takeoverModalTitle:"确认接管终端控制权?",takeoverModalDesc:"当前已有其他客户端控制该终端。",takeoverModalWarning:"接管后输入焦点切换至当前窗口。",confirmTakeover:"确认接管"},statusBanner:{connecting:"连接 Relay 服务中...",reconnectingDefault:"连接断开,正在重连...",reconnectNow:"立即重连",errorDefault:"无法连接 Relay 服务",disconnected:"会话已断开"},update:{chip:"↑ herdr-remote {version}",chipCompact:"↑ {version}",chipRestart:"↻ 重启以应用 {version}",toast:"宿主机的 herdr-remote 有新版本 {version}",toastRestart:"herdr-remote {version} 已安装,重启后生效",title:"herdr-remote 更新",running:"正在运行",installed:"已安装",latest:"最新版本",restartPending:"{version} 已安装但尚未运行。在宿主机上重启 herdr-remote:",stepTui:"在宿主机打开 herdr-remote(TUI),进入「语言与关于」,在更新一行按 Enter。",stepCli:"或在宿主机上执行:",restartNote:"重启后这个窗口会在几秒内自动重连。",ignore:"忽略此版本"},herdrLaunch:{title:"Herdr 未运行",body:"{host} 上没有正在运行的 Herdr。要在这台宿主机上启动吗?",scope:"只会以这台已配对宿主机自己的用户身份,启动它自己的 Herdr,不会碰其他任何机器。",start:"启动 Herdr",starting:"正在 {host} 上启动 Herdr…",failedTitle:"Herdr 没有启动",timeout:"宿主机 30 秒内没有回应。它的 herdr-remote 可能版本过旧,不支持从浏览器启动 Herdr。",thisHost:"这台宿主机"},onboarding:{title:"配对 Herdr Remote",subtitle:"连接手机或浏览器至本地终端会话",description:"在浏览器或移动设备中控制 Herdr 会话。",firstTimeSetup:"首次配对",authRequired:"需要认证",authRequiredDesc:"使用配对码配对设备,或提供有效访问令牌。",step1Title:"在 Herdr 宿主机生成配对码",step1Desc:"在运行 Herdr 的主机终端执行:",step1TuiNote:"交互式 TUI 配置:",step2Title:"输入 6 位配对码",step2Placeholder:"例如:7X9K2A",step2Note:"配对码 5 分钟内有效,连接后自动保存凭据。",connectAndPair:"连接并完成配对",connectingAndPairing:"配对中...",advancedTitle:"高级选项",manualTokenLabel:"认证 Token",manualTokenPlaceholder:"可选 Token(跳过配对码)",wsEndpointLabel:"Relay WebSocket 端点",wsEndpointPlaceholder:"/ws/client 或 wss://relay-host/ws/client",clientIdLabel:"客户端标识 (Client ID)"},pairing:{title:"Relay 连接与配对",addTitle:"添加 Herdr 实例",displayNameLabel:"主机名称",displayNamePlaceholder:"例如:工作电脑",displayNameHelp:"名称仅保存在此浏览器中。",credentialsRequired:"请输入配对码或设备令牌。",subtitle:"管理 WebSocket 服务端点与凭证",pairCodeLabel:"配对码",pairCodeNote:"(6 位代码)",pairCodePlaceholder:"例如:A1B2C3",pairCodeHelp:'在主机运行 "herdr-remote pair" 获取。',tokenLabel:"访问 Token",tokenNote:"(设备凭据)",tokenPlaceholder:"设备 Token...",wsUrlLabel:"Relay WebSocket 端点",wsUrlPlaceholder:"/ws/client",wsUrlDefaultNote:'默认同源端点 "/ws/client"',clientIdLabel:"客户端标识",newIdButton:"生成新 ID",regenerateClientIdTitle:"重新生成客户端 ID",autoReconnectLabel:"掉线自动重连",autoReconnectDesc:"连接断开时自动尝试重连",copyDirectLink:"复制配对链接(含配对码)",saveAndConnect:"保存并连接"},settings:{title:"终端设置",subtitle:"字体、字号与触控管理",tabGeneral:"常规设置",tabAppearance:"终端与字体",tabVirtualKeys:"虚拟按键",tabAgentKeymaps:"智能体按键",fontFamilyLabel:"等宽字体",fontSizeLabel:"终端字号 ({size}px)",fontSizeCompact:"10px (紧凑)",fontSizeDefault:"15px (默认)",fontSizeLarge:"24px (大字号)",mobileFontNote:"小屏设备自动适配字号,保持 80 列完整显示。",colorPassthroughNote:"终端配色与光标样式透传自宿主环境。",predictiveEchoLabel:"预测回显",predictiveEchoAuto:"自动",predictiveEchoAlways:"始终开启",predictiveEchoOff:"关闭",predictiveEchoDesc:"高延迟时,在 shell 提示符或智能体输入框里先行显示输入的字符,回显到达后自动校正。菜单等其他界面不做预测。",touchKeyToolbar:"底部触控按键条",touchKeyToolbarDesc:"显示移动端修饰键与方向键工具栏",touchHaptics:"触控振动反馈",touchHapticsDesc:"移动端按键时轻微震动",agentAlertsLabel:"智能体提醒",agentAlertBadge:"标题与图标角标",agentAlertBadgeDesc:"在标签页标题里显示等待确认和已完成的智能体数量,并在图标上加角标",agentAlertVibrate:"震动",agentAlertVibrateDesc:"智能体停下来等你确认或完成时震动(页面在前台时)",agentAlertSound:"提示音",agentAlertSoundDesc:"页面在后台时播放短提示音;下次点击页面后生效",agentAlertNotify:"系统通知",agentAlertNotifyDesc:"页面在后台时发系统通知(仅 HTTPS)",languageLabel:"显示语言",languageDesc:"选择 English 或 简体中文",resetDefaults:"恢复默认设置",resetDefaultsToast:"设置已恢复默认",windowZoomSharedNote:"当前宿主未启用视图隔离,字号调整仅影响本地窗口。",fontSizeZoomHelp:"仅调节当前窗口字号,不影响其他窗口。"},agentKeymaps:{keymapLabel:"按键方案",auto:"自动",shell:"Shell",agentGroup:"智能体",genericGroup:"通用",settingsProfileLabel:"智能体方案",autoProfile:"自动 · {profile}",pinnedProfile:"固定 · {profile}",barGroup:"按键栏显示",barHint:"点选要在底部按键栏显示的 {profile} 快捷键(已显示 {count} 个)。按智能体分别保存在当前浏览器;ESC、方向键等基础按键在「虚拟按键」页设置。",restoreBar:"恢复默认显示",customizeBar:"自定义按键栏显示哪些快捷键",customizeBarShort:"自定义",shortcutLabel:"快捷键",comboPlaceholder:"例如 ctrl+e 或 esc esc",invalidCombo:"快捷键无效:{error}",defaultCombo:"默认:{combo}",resetAction:"重置",moveUp:"上移",moveDown:"下移",unverified:"未验证",addCustom:"自定义按键",customLabel:"功能名称",customCombo:"按键组合",addAction:"添加自定义按键",restoreProfile:"恢复此智能体默认设置",removeCustom:"删除自定义按键",configHint:"智能体配置:{path}",noAgentActions:"此智能体没有专用快捷键。",errors:{empty:"至少输入一个按键。",tooManySteps:"快捷键最多包含 {count} 个步骤。",invalidStepSyntax:"第 {step} 步格式无效。可输入 ctrl+o 或 esc esc。",duplicateModifier:"第 {step} 步重复使用了 {modifier}。",missingKey:"第 {step} 步需要在修饰键后输入一个按键。",multipleKeys:"第 {step} 步只能包含一个按键。",unsupportedKey:"第 {step} 步不支持按键“{key}”。"}},agentActions:{mode:"模式",rewind:"回退",details:"详情",model:"模型",thinking:"思考",todos:"任务",background:"后台运行",editor:"编辑器",history:"历史",stash:"暂存",pasteImage:"粘贴图片",newline:"换行",interrupt:"中断",editPrevious:"编辑上一条",queue:"排队发送",copy:"复制",clear:"清屏",yolo:"YOLO 模式",expand:"展开",undo:"撤销",agent:"下一个智能体",agentBack:"上一个智能体",palette:"命令面板",recentModel:"最近模型",variant:"模型变体",newSession:"新会话",sessions:"会话列表",thinkingMode:"思考模式",nextModel:"下一个模型",modelPicker:"模型选择器",tools:"工具",thinkingBlocks:"思考内容",followup:"后续提问",dequeue:"移出队列",plan:"计划模式",temporaryModel:"临时模型",expandAll:"全部展开",reasoning:"推理强度",review:"代码审查",specMode:"规格模式",autonomy:"自主模式",undoPicker:"撤销菜单",steer:"引导",sidebar:"侧栏",agents:"智能体列表",permissionMode:"权限模式",bypass:"绕过权限",tasks:"任务",interject:"插话",multiline:"多行输入",shortcuts:"快捷键",approve:"批准",eof:"结束输入",suspend:"挂起",startOfLine:"行首",endOfLine:"行尾",killToEnd:"删除至行尾",agentSwap:"切换智能体",activity:"活动面板",planAct:"计划 / 执行",autoApprove:"自动批准",search:"搜索"},virtualKeyboard:{collapseToolbar:"收起按键栏",expandToolbar:"展开按键栏",helperTitle:"快捷命令",closeHelper:"关闭命令助手",placeholder:"输入终端命令并回车...",sendButton:"发送",clearInput:"清除输入内容",customizeTitle:"自定义虚拟按键",customizeDesc:"调整按键顺序与启禁用状态。",enabledKeysCount:"已启用 {count} 个按键",resetLayout:"恢复默认布局",addKey:"添加按键",availableKeys:"可选按键库",moveUp:"前移",moveDown:"后移",enableKey:"启用按键",disableKey:"禁用按键",deleteKeyTitle:"删除按键",keyTypeModifier:"修饰键",keyTypeNav:"导航键",keyTypeAction:"动作键",keyTypeChord:"组合键",keyTypeFn:"功能键",keyTypeSymbol:"符号",fnDrawerTitle:"功能键 (F1-F12)",chordsDrawerTitle:"控制组合键 (^C, ^D, ^Z)",symbolsDrawerTitle:"终端常用符号 (~, |, /, \\)",touchKeyboardShortcuts:"快捷键工具栏",ctrlCTitle:"Ctrl+C (中断)",ctrlDTitle:"Ctrl+D (退出)",ctrlZTitle:"Ctrl+Z (挂起)",ctrlLTitle:"Ctrl+L (清屏)",ctrlRTitle:"Ctrl+R (搜索)",ctrlATitle:"Ctrl+A (行首)",ctrlETitle:"Ctrl+E (行尾)",ctrlKTitle:"Ctrl+K (剪切)",badgeSigint:"中断",badgeEof:"退出",badgeTstp:"挂起",badgeClear:"清屏",badgeSearch:"搜索",badgeStart:"行首",badgeEnd:"行尾",badgeKill:"剪切",keyEnter:"回车",uploadImage:"上传图片",uploadImageTitle:"选择图片并上传至终端",image:"图片",uploadProgressReading:"读取中...",uploadProgressProcessing:"处理压缩中...",uploadProgressSending:"上传中...",uploadProgressWaitingHost:"等待工作站保存...",uploadProgressCompleted:"完成",uploadProgressFailed:"上传失败"},profiles:{title:"Herdr 实例",switcherLabel:"切换 Herdr 实例",current:"当前",empty:"还没有已配对的 Herdr 实例。",addHost:"添加 Herdr 实例",rename:"重命名实例",remove:"仅本地移除",removeConfirm:"确认从此浏览器移除已保存的连接?"},mobile:{sessionControls:"会话控制",closeSessionControls:"关闭会话控制面板",connectionStatusAria:"连接状态",terminalControlAria:"终端控制权",inputControl:"输入控制权",settingsAria:"终端设置",adminAria:"打开管理面板",pairingAria:"连接与配对设置",keybarAria:"切换触控按键条",quickInputAria:"切换快捷命令",menu:"菜单",statusBarAria:"会话状态栏"},terminal:{bannerTitle:"Herdr Remote WebUI",bannerSubtitle:"已连接至 Herdr 会话。",windowAriaLabel:"远程终端窗口",bufferAriaLabel:"xterm 终端缓冲区",offlineStatusAria:"离线状态",releaseControlAria:"释放终端控制权",takeoverControlAria:"强占终端控制权",claimControlAria:"获取终端控制权"},keyTitles:{esc:"Escape (ESC)",tab:"Tab",shift_tab:"Shift+Tab(Claude Code 切换模式)",ctrl:"切换 Ctrl 锁定",alt:"切换 Alt 锁定",shift:"切换 Shift 锁定",meta:"Meta / 命令键",enter:"回车 (Enter)",backspace:"退格 (Backspace)",delete:"删除 (Delete)",left:"左箭头 (←)",up:"上箭头 (↑)",down:"下箭头 (↓)",right:"右箭头 (→)",home:"行首 (Home)",end:"行尾 (End)",page_up:"向上翻页 (Page Up)",page_down:"向下翻页 (Page Down)",insert:"插入 (Insert)",drawer_chords:"常用 Ctrl 组合键",drawer_agent:"智能体快捷键",drawer_symbols:"常用特殊符号",drawer_fn:"功能键 (F1-F12)",ctrl_c:"Ctrl+C (中断)",ctrl_d:"Ctrl+D (退出)",ctrl_z:"Ctrl+Z (挂起)",ctrl_l:"Ctrl+L (清屏)",ctrl_a:"Ctrl+A (行首)",ctrl_e:"Ctrl+E (行尾)",ctrl_k:"Ctrl+K (剪切)",ctrl_r:"Ctrl+R (历史搜索)",f1:"F1",f2:"F2",f3:"F3",f4:"F4",f5:"F5",f6:"F6",f7:"F7",f8:"F8",f9:"F9",f10:"F10",f11:"F11",f12:"F12",sym_pipe:"管道符 (|)",sym_tilde:"波浪号 (~)",sym_slash:"正斜杠 (/)",sym_backslash:"反斜杠 (\\)",sym_dash:"连字符 (-)",sym_underscore:"下划线 (_)",sym_dollar:"美元符 ($)",sym_ampersand:"与符号 (&)",sym_quote:'双引号 (")',sym_backtick:"反引号 (`)"},admin:{title:"系统管理面板",subtitle:"接入主机、配对设备与中转流量",returnToTerminal:"返回终端",terminalShells:"个终端 Shell",startedAt:"启动于 {time}",accessPanel:"接入概览",acrossWindows:"共 {count} 个窗口",perSecond:"{value}/秒",framesPerSecond:"{count} 帧/秒",unitDay:" 天",unitHour:" 小时",unitMinute:" 分",unitSecond:" 秒",startedRecently:"最近启动",updatedAt:"更新于 {time}",autoRefresh:"自动刷新:",paused:"暂停刷新",refreshNow:"立即刷新",connectedHosts:"接入主机",activeUsers:"活跃用户",activePtys:"活动 PTY",activeController:"活跃控制者",uptime:"运行时间",none:"无",noHost:"未连接主机",tabOverview:"系统概览",tabClients:"客户端列表 ({count})",tabPtys:"PTY 会话 ({count})",tabDevices:"已配对设备 ({count})",throughput:"网络吞吐流量",bytesInTotal:"入站流量:",bytesOutTotal:"出站流量:",frameRate:"帧率统计:",hostsTitle:"主机 ({count})",noHosts:"暂无接入或配对的主机",hostConnectedDevices:"{count} 台在线",hostPairedDevices:"{count} 台已配对",hostStatusOnline:"在线",hostStatusBusy:"使用中",hostStatusReconnecting:"重连中",hostStatusOffline:"离线",hostRosterOperatorOnly:"设备清单仅 Relay 操作员可见。",connectedClientsTitle:"已连接客户端 ({count})",noClients:"当前暂无客户端连接",colClientId:"客户端 ID",colDevice:"设备",colDeviceId:"设备 ID",colLastSeen:"最近活动",colActions:"操作",unknownDevice:"未知设备",pairedDevicesTitle:"已配对设备 ({count})",noDevices:"尚未配对任何设备",revokeDevice:"撤销",revokeConfirm:"确认撤销",revokeFailed:"撤销失败",colRole:"角色",colIp:"IP 地址",colConnectedAt:"连接时间",colTraffic:"网络流量 (入/出)",activePtysTitle:"活动 PTY 终端会话 ({count})",noPtys:"当前无活跃的 PTY 会话",colPtyId:"PTY 标识",colPid:"进程 PID",colCommand:"运行命令",colGrid:"网格规格",colCwd:"工作目录",colViewers:"窗口数",copiedJson:"已复制",unauthorizedTitle:"管理接口未授权 (401/403)",unauthorizedDesc:"访问 GET /api/status 需要已授权的设备 Token。",pairingStepsTitle:"设备配对指引:",pairingStepsHelp:"在主机运行配对命令获取配对码后输入。",enterPairCodeBtn:"输入配对码",retryFetchBtn:"重新获取状态",errorConnecting:"连接 GET /api/status 失败:{error}",loadingStatus:"正在加载系统状态...",remoteRelayTitle:"远程 Relay 服务管理",remoteRelayBadge:"已连接远程 Relay 服务",remoteRelayNotice:"当前连接至远程独立 Relay 服务。如需查看服务端指标,请使用操作员后台。",remoteRelayEndpoint:"远程端点:",remoteRelayAdminUrl:"远程后台地址:",openRemoteAdminBtn:"前往远程管理后台",remoteRelayHelp:"直接访问远程 Relay 管理后台。",relayAdminTitle:"Relay 操作员管理后台",relayAdminTokenLabel:"Relay 管理员令牌 (X-Relay-Admin-Token)",relayAdminTokenPlaceholder:"请输入 RELAY_ADMIN_TOKEN...",relayAdminNotConfigured:"该 Relay 服务未配置 RELAY_ADMIN_TOKEN。",relayAdminLoginBtn:"验证并查看服务端指标",relayAdminAuthError:"管理员令牌无效或未授权。",remoteRelayClientNotice:"当前为终端客户端连接。如需查看服务端指标,请访问操作员后台。",openOperatorPortal:"打开服务端管理后台",localWorkstationBadge:"本地宿主 Relay",modeLocal:"本地模式",modeRemote:"远程模式",hintTabs:"切换标签页",hintRefresh:"刷新状态",hintBack:"返回终端"},toasts:{connected:"已连接至 Relay 服务",connectionError:"连接发生错误",controlGranted:"已获得控制权",controlDenied:"控制请求被拒绝:已有活跃控制者",controlRevoked:"控制权已转移",pairedSuccess:"设备配对成功,已保存凭证",sessionEnded:"终端会话已结束",controlReleased:"已释放控制权,切回观察者模式",viewerModeWarning:"处于观察者模式,请先获取控制权",clientIdCopied:"客户端 ID 已复制: {id}",pairingLinkCopied:"配对链接已复制",switchedLanguage:"语言已切换为 {lang}",settingsReset:"设置已恢复默认",fontReset:"字体已恢复默认",commandCopied:"命令已复制",keyLayoutReset:"虚拟按键布局已恢复默认"},shortcuts:{title:"WebUI 快捷键",help:"以下快捷键仅在非终端输入区域生效:",terminalInputNote:"终端操作快捷键直接透传至宿主 PTY。"},serverErrors:{auth_required:"需要配对:请输入配对码,或填写仍然有效的设备令牌。",unauthorized:"该设备无权访问此工作站。",host_offline:"已配对的工作站未连接到该 relay。",host_disconnected:"工作站已断开连接。",stale_host:"工作站长时间无响应,已被断开。",too_many_clients:"该工作站的窗口数量已达上限。",rate_limited:"配对尝试过于频繁,请稍后再试。",invalid_handshake:"relay 拒绝了握手,请刷新页面。",device_revoked:"该设备已被 relay 管理员撤销。",connection_closed:"连接已断开,正在重连…",connection_stale:"页面回到前台时连接已无响应,正在重连…",connection_stalled:"连接超时,正在重试…",connection_failed:"无法建立到 relay 的连接。",host_reconnecting:"Herdr 主机正在重连。",host_reconnect_timeout:"Herdr 主机未能及时恢复连接。",host_replaced:"Herdr 主机连接已被替换。",slow_client:"由于浏览器处理速度过慢,连接已关闭。",client_send_failed:"Relay 无法向此浏览器发送数据。",too_many_hosts:"此 relay 已达到主机数量上限。",paste_file_unsupported:"不支持的粘贴图片格式。",paste_file_too_large:"粘贴图片超过 3 MB 上限。",paste_file_write_failed:"工作站保存图片失败。",paste_file_empty:"粘贴图片内容为空。",paste_file_corrupt:"粘贴图片数据损坏或与声明格式不符。",viewer_mode:"观察者模式无法粘贴到终端。",no_session:"终端会话未准备就绪。"},fontPresets:{system:"系统默认",apple:"Apple SF Mono / Menlo",windows:"Windows Consolas",linux:"Linux Liberation Mono",courier:"Courier New",firacode:"Fira Code"},agents:{title:"本工作站的智能体",blocked:"待确认",done:"已完成",working:"运行中",allIdle:"智能体空闲",notifyBlocked:"{count} 个智能体在等你确认",notifyDone:"{count} 个智能体已完成"},clipboard:{openLink:"打开链接",openLinkFailed:"该链接无法在浏览器中打开",copySelection:"复制选中",copyLine:"复制本行",copyScreen:"复制整屏",paste:"粘贴",cancel:"取消",copied:"已复制到剪贴板",copyFailed:"复制失败",pasteHint:"长按此处粘贴,然后按发送",pasteSend:"发送",pasteUnavailable:"剪贴板为空或不可用",pasteTitle:"粘贴内容",pasted:"已粘贴",chooseImage:"选择图片",takePhoto:"拍照",imageTooLarge:"图片超过 3 MB 限制且无法进一步压缩。",imageCompressedSize:"压缩后大小:{size}",fileEmpty:"文件内容为空。",decodeFailed:"无法解析图片文件。",unsupportedType:"不支持的图片格式,仅支持 PNG、JPEG、WebP 和 GIF。",imageSectionTitle:"图片",textSectionTitle:"文本",imageCompressing:"正在处理图片...",removeImage:"移除图片"}},$u={en:_v,zh:jv};function Cd(a,i,s){const r=$u[a]||$u.en,u=i.split(".");let f=r;for(const m of u)if(f&&typeof f=="object"&&m in f)f=f[m];else{let h=$u.en;for(const p of u)if(h&&typeof h=="object"&&p in h)h=h[p];else return i;f=h;break}if(typeof f!="string")return i;if(s){let m=f;for(const[h,p]of Object.entries(s))m=m.replaceAll(`{${h}}`,String(p));return m}return f}const Cp="#11111b",dd=[{id:"system",name:"System Default (Recommended)",font:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", "Symbols Nerd Font Mono", monospace'},{id:"apple",name:"Apple SF Mono / Menlo",font:'SFMono-Regular, Menlo, Monaco, "Symbols Nerd Font Mono", monospace'},{id:"windows",name:"Windows Consolas",font:'Consolas, "Lucida Console", "Symbols Nerd Font Mono", monospace'},{id:"linux",name:"Linux Liberation Mono",font:'"Liberation Mono", "DejaVu Sans Mono", "Symbols Nerd Font Mono", monospace'},{id:"courier",name:"Courier New",font:'"Courier New", Courier, "Symbols Nerd Font Mono", monospace'},{id:"firacode",name:"Fira Code (Ligatures)",font:'"Fira Code", "Symbols Nerd Font Mono", monospace'}];function Tp(a){if(!a||typeof a!="string")return dd[0].font;const i=a.trim();if(i.includes("Symbols Nerd Font"))return i;if(/^['"]?monospace['"]?$/i.test(i))return'"Symbols Nerd Font Mono", monospace';const s=/,\s*['"]?monospace['"]?\s*$/i;return s.test(i)?i.replace(s,', "Symbols Nerd Font Mono", monospace'):`${i}, "Symbols Nerd Font Mono", monospace`}function Dv(a){if(!a)return null;const i={};return a.background&&(i.background=a.background,i.cursorAccent=a.background),a.foreground&&(i.foreground=a.foreground),a.cursor&&(i.cursor=a.cursor),a.ansi&&Object.assign(i,a.ansi),Object.keys(i).length===0?null:i}function Ug(){if(typeof document>"u")return;const a=document.querySelector('meta[name="theme-color"]');document.documentElement.style.colorScheme="dark",a==null||a.setAttribute("content",Cp),document.documentElement.classList.add("dark"),document.documentElement.classList.remove("light"),document.body.classList.add("dark"),document.body.classList.remove("light"),document.body.style.backgroundColor=Cp}const k=(a,i,s,r=!0)=>({id:a,labelKey:i,combo:s,verified:r}),Bg={claude:{id:"claude",name:"Claude Code",shortName:"Claude",configHint:"~/.claude/keybindings.json",bar:["mode","rewind","details","model"],actions:[k("mode","mode","shift+tab"),k("rewind","rewind","esc esc"),k("details","details","ctrl+o"),k("model","model","alt+p"),k("thinking","thinking","alt+t"),k("todos","todos","ctrl+t"),k("background","background","ctrl+b"),k("editor","editor","ctrl+g"),k("history","history","ctrl+r"),k("stash","stash","ctrl+s"),k("pasteImage","pasteImage","ctrl+v"),k("newline","newline","ctrl+j"),k("interrupt","interrupt","esc")]},codex:{id:"codex",name:"Codex",shortName:"Codex",configHint:"~/.codex/config.toml [tui.keymap]",bar:["mode","editPrevious","details"],actions:[k("mode","mode","shift+tab"),k("editPrevious","editPrevious","esc esc"),k("details","details","ctrl+t"),k("queue","queue","tab"),k("history","history","ctrl+r"),k("copy","copy","ctrl+o"),k("editor","editor","ctrl+g"),k("newline","newline","ctrl+j"),k("clear","clear","ctrl+l"),k("interrupt","interrupt","esc")]},gemini:{id:"gemini",name:"Gemini CLI",shortName:"Gemini",configHint:"~/.gemini/keybindings.json",bar:["mode","yolo","rewind"],actions:[k("mode","mode","shift+tab"),k("yolo","yolo","ctrl+y"),k("rewind","rewind","esc esc"),k("todos","todos","ctrl+t"),k("expand","expand","ctrl+o"),k("background","background","ctrl+b"),k("editor","editor","ctrl+g"),k("history","history","ctrl+r"),k("undo","undo","ctrl+z"),k("newline","newline","ctrl+j"),k("interrupt","interrupt","esc")]},qwen:{id:"qwen",name:"Qwen Code",shortName:"Qwen",bar:["mode","history"],actions:[k("mode","mode","shift+tab"),k("interrupt","interrupt","esc"),k("history","history","ctrl+r"),k("newline","newline","ctrl+j"),k("todos","todos","ctrl+t",!1),k("rewind","rewind","esc esc",!1)]},opencode:{id:"opencode",name:"OpenCode",shortName:"OpenCode",configHint:"tui.json keybinds",bar:["palette","model","sessions"],actions:[k("agent","agent","tab"),k("agentBack","agentBack","shift+tab"),k("interrupt","interrupt","esc"),k("palette","palette","ctrl+p"),k("model","model","ctrl+x m"),k("recentModel","recentModel","f2"),k("variant","variant","ctrl+t"),k("newSession","newSession","ctrl+x n"),k("sessions","sessions","ctrl+x l"),k("undo","undo","ctrl+x u"),k("editor","editor","ctrl+x e"),k("newline","newline","ctrl+j")]},kilo:{id:"kilo",name:"Kilo Code",shortName:"Kilo",configHint:"~/.config/kilo/tui.jsonc",bar:["palette","model","sessions"],actions:[k("agent","agent","tab",!1),k("agentBack","agentBack","shift+tab",!1),k("interrupt","interrupt","esc"),k("palette","palette","ctrl+p"),k("model","model","ctrl+x m"),k("recentModel","recentModel","f2"),k("variant","variant","ctrl+t"),k("newSession","newSession","ctrl+x n"),k("sessions","sessions","ctrl+x l"),k("undo","undo","ctrl+x u"),k("editor","editor","ctrl+x e"),k("newline","newline","ctrl+j")]},pi:{id:"pi",name:"Pi",shortName:"Pi",configHint:"~/.pi/agent/keybindings.json",bar:["thinkingMode","modelPicker","tools"],actions:[k("thinkingMode","thinkingMode","shift+tab"),k("interrupt","interrupt","esc"),k("nextModel","nextModel","ctrl+p"),k("modelPicker","modelPicker","ctrl+l"),k("tools","tools","ctrl+o"),k("thinkingBlocks","thinkingBlocks","ctrl+t"),k("editor","editor","ctrl+g"),k("followup","followup","alt+enter"),k("dequeue","dequeue","alt+up"),k("newline","newline","shift+enter")]},omp:{id:"omp",name:"Oh My Pi",shortName:"OMP",configHint:"~/.omp/agent/keybindings.yml",bar:["thinkingMode","plan","model"],actions:[k("thinkingMode","thinkingMode","shift+tab"),k("plan","plan","alt+shift+p"),k("model","model","alt+m"),k("temporaryModel","temporaryModel","alt+p"),k("nextModel","nextModel","ctrl+p"),k("tools","tools","ctrl+o"),k("thinking","thinking","ctrl+t"),k("history","history","ctrl+r"),k("editor","editor","ctrl+g"),k("followup","followup","ctrl+enter"),k("interrupt","interrupt","esc")]},copilot:{id:"copilot",name:"GitHub Copilot",shortName:"Copilot",bar:["mode","expand","reasoning"],actions:[k("mode","mode","shift+tab"),k("interrupt","interrupt","esc"),k("expand","expand","ctrl+o"),k("expandAll","expandAll","ctrl+e"),k("reasoning","reasoning","ctrl+t"),k("editor","editor","ctrl+g"),k("clear","clear","ctrl+l")]},cursor:{id:"cursor",name:"Cursor",shortName:"Cursor",bar:["mode","review"],actions:[k("mode","mode","shift+tab"),k("review","review","ctrl+r"),k("newline","newline","ctrl+j"),k("interrupt","interrupt","esc",!1)]},droid:{id:"droid",name:"Factory Droid",shortName:"Droid",configHint:"In-app settings",bar:["specMode","autonomy"],actions:[k("specMode","specMode","shift+tab"),k("autonomy","autonomy","ctrl+l"),k("details","details","ctrl+o",!1),k("queue","queue","ctrl+enter"),k("interrupt","interrupt","esc",!1)]},kimi:{id:"kimi",name:"Kimi Code",shortName:"Kimi",bar:["plan","undoPicker","expand"],actions:[k("plan","plan","shift+tab"),k("interrupt","interrupt","esc"),k("undoPicker","undoPicker","esc esc"),k("expand","expand","ctrl+o"),k("editor","editor","ctrl+g"),k("steer","steer","ctrl+s"),k("undo","undo","ctrl+-"),k("newline","newline","ctrl+j"),k("pasteImage","pasteImage","ctrl+v")]},amp:{id:"amp",name:"Amp",shortName:"Amp",bar:["palette","reasoning","mode"],actions:[k("palette","palette","ctrl+o"),k("reasoning","reasoning","alt+d"),k("mode","mode","ctrl+s",!1),k("editor","editor","ctrl+g"),k("history","history","ctrl+r"),k("sidebar","sidebar","ctrl+backslash"),k("pasteImage","pasteImage","ctrl+v"),k("interrupt","interrupt","esc",!1)]},hermes:{id:"hermes",name:"Hermes",shortName:"Hermes",bar:["interrupt","agents","sessions"],actions:[k("interrupt","interrupt","ctrl+c"),k("newline","newline","ctrl+j"),k("editor","editor","ctrl+g"),k("agents","agents","ctrl+t"),k("sessions","sessions","ctrl+x")]},qodercli:{id:"qodercli",name:"Qoder CLI",shortName:"Qoder",configHint:"/shortcuts in-app",bar:["permissionMode","bypass","tasks","interrupt"],actions:[k("permissionMode","permissionMode","shift+tab"),k("bypass","bypass","ctrl+y"),k("tasks","tasks","ctrl+t"),k("editor","editor","ctrl+x"),k("history","history","ctrl+r"),k("queue","queue","ctrl+enter"),k("newline","newline","ctrl+j"),k("pasteImage","pasteImage","alt+v"),k("interrupt","interrupt","ctrl+c")]},devin:{id:"devin",name:"Devin",shortName:"Devin",configHint:"~/.config/devin/config.json keymap",bar:["mode","thinking","interrupt"],actions:[k("mode","mode","shift+tab"),k("interrupt","interrupt","ctrl+c"),k("thinking","thinking","alt+t"),k("newline","newline","ctrl+j"),k("pasteImage","pasteImage","ctrl+v")]},grok:{id:"grok",name:"Grok CLI",shortName:"Grok",bar:["mode","rewind","interrupt"],actions:[k("mode","mode","shift+tab"),k("interrupt","interrupt","ctrl+c"),k("rewind","rewind","esc esc"),k("interject","interject","ctrl+enter"),k("multiline","multiline","ctrl+m"),k("newline","newline","alt+enter"),k("shortcuts","shortcuts","ctrl+.")]},agy:{id:"agy",name:"Antigravity",shortName:"Antigravity",configHint:"~/.gemini/antigravity-cli/keybindings.json",bar:["mode","approve","interrupt"],actions:[k("mode","mode","shift+tab"),k("interrupt","interrupt","ctrl+c"),k("background","background","ctrl+b"),k("approve","approve","ctrl+k"),k("clear","clear","esc esc")]},mastracode:{id:"mastracode",name:"MastraCode",shortName:"MastraCode",bar:["interrupt","thinking","expand"],actions:[k("interrupt","interrupt","ctrl+c"),k("thinking","thinking","ctrl+t"),k("expand","expand","ctrl+e"),k("followup","followup","ctrl+f")]},letta:{id:"letta",name:"Letta Code",shortName:"Letta",bar:["permissionMode"],actions:[k("permissionMode","permissionMode","shift+tab"),k("interrupt","interrupt","esc",!1)]},kiro:{id:"kiro",name:"Kiro CLI",shortName:"Kiro",configHint:"kiro-cli settings chat.keybindings.*",bar:["agentSwap","details","steer"],actions:[k("agentSwap","agentSwap","shift+tab"),k("interrupt","interrupt","esc"),k("details","details","ctrl+t"),k("steer","steer","ctrl+s"),k("expand","expand","ctrl+o"),k("activity","activity","ctrl+x"),k("newline","newline","ctrl+j")]},cline:{id:"cline",name:"Cline",shortName:"Cline",bar:["autoApprove"],actions:[k("planAct","planAct","tab"),k("autoApprove","autoApprove","shift+tab"),k("interrupt","interrupt","esc",!1)]},maki:{id:"maki",name:"Maki",shortName:"Maki",bar:["rewind","search"],actions:[k("rewind","rewind","esc esc"),k("search","search","ctrl+f"),k("interrupt","interrupt","esc",!1)]},muse:{id:"muse",name:"Muse",shortName:"Muse",configHint:"/keymap in-app",bar:["queue","interruptCtrl"],actions:[k("interrupt","interrupt","esc"),k("queue","queue","alt+enter"),k("interruptCtrl","interrupt","ctrl+c")]},shell:{id:"shell",name:"Shell",shortName:"Shell",actions:[]}},$a=Bg,Ov=Object.keys(Bg),Mp={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"},zv=[k("genericCtrlC","interrupt","ctrl+c"),k("genericCtrlD","eof","ctrl+d"),k("genericCtrlZ","suspend","ctrl+z"),k("genericCtrlL","clear","ctrl+l"),k("genericCtrlR","history","ctrl+r"),k("genericCtrlA","startOfLine","ctrl+a"),k("genericCtrlE","endOfLine","ctrl+e"),k("genericCtrlK","killToEnd","ctrl+k")],Uv=["genericCtrlC","genericCtrlD","genericCtrlL","genericCtrlR"],Bv=["genericCtrlC"];function Hv(a){return a&&a.trim().toLowerCase().replace(/\\/g,"/").split("/").at(-1)||""}function Ap(a){const i=Hv(a);return Mp[i]?Mp[i]:/^muse-bin-\d/.test(i)?"muse":null}function Kv(a,i="auto"){return i&&i!=="auto"?Ap(i)||"shell":Ap(a)||"shell"}function Yv(a,i){var u,f;const s=a.map(m=>{var y;const h=(y=i==null?void 0:i.actions)==null?void 0:y[m.id];let p=typeof(h==null?void 0:h.keys)=="string"?h.keys:m.combo;try{Ci(p)}catch{p=m.combo}return{...m,defaultCombo:m.combo,combo:p,hidden:typeof(h==null?void 0:h.hidden)=="boolean"?h.hidden:m.defaultHidden===!0,custom:!1}}),r=new Set(s.map(m=>m.id));for(const m of(i==null?void 0:i.custom)||[]){if(!m||typeof m.id!="string"||r.has(m.id))continue;let h=m.keys;try{Ci(h)}catch{continue}s.push({id:m.id,labelKey:"custom",defaultCombo:h,combo:h,verified:!0,hidden:((f=(u=i==null?void 0:i.actions)==null?void 0:u[m.id])==null?void 0:f.hidden)===!0,custom:!0,customLabel:m.label}),r.add(m.id)}if(Array.isArray(i==null?void 0:i.order)){const m=new Map(i.order.map((h,p)=>[h,p]));s.sort((h,p)=>(m.get(h.id)??Number.MAX_SAFE_INTEGER)-(m.get(p.id)??Number.MAX_SAFE_INTEGER))}return s}function Iv(a,i){const s=new Set(a.map(r=>r.combo.trim().toLowerCase()));return i.filter(r=>!s.has(r.combo.trim().toLowerCase()))}const Ps=a=>a.id.startsWith("generic");function Hg(a,i){const s=$a[a],r=new Set([...s.bar||[],...a==="shell"?Uv:Bv]),u=[...s.actions,...zv].map(f=>({...f,defaultHidden:!r.has(f.id)}));return Yv(u,i)}function Kg(a,i){const s=Hg(a,i),r=s.filter(f=>!Ps(f)),u=new Set(Iv(r,s.filter(Ps)));return s.filter(f=>!Ps(f)||u.has(f))}function Gv(a,i){const s=Kg(a,i).filter(r=>!r.hidden);return{agentActions:s.filter(r=>!Ps(r)),genericActions:s.filter(Ps)}}function $v(a){const i={};for(const[s,r]of Object.entries(a.actions||{})){const u={...r};delete u.hidden,Object.keys(u).length>0&&(i[s]=u)}return{...a,actions:i}}const Yg=1568,Fv=3*1024*1024,qv=[.85,.7,.55,.4],di={active:!1,phase:"idle",ratio:0,percent:0,statusText:""};function Vv(a,i,s=Yg){if(a<=0||i<=0)return{width:Math.max(1,a),height:Math.max(1,i)};const r=Math.max(a,i);if(r<=s)return{width:a,height:i};const u=s/r;return{width:Math.max(1,Math.round(a*u)),height:Math.max(1,Math.round(i*u))}}function Xv(a){if(typeof a!="string"||a.length===0)return 0;const i=a.length;let s=0;a.endsWith("==")?s=2:a.endsWith("=")&&(s=1);const r=Math.floor(i*3/4)-s;return Number.isFinite(r)&&r>0?r:0}function Pv(a){return a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(1)} KB`:`${(a/(1024*1024)).toFixed(1)} MB`}async function Zv(a){if(typeof createImageBitmap=="function")try{const i=await createImageBitmap(a,{imageOrientation:"from-image"});return{source:i,width:i.width,height:i.height,cleanup:()=>{typeof i.close=="function"&&i.close()}}}catch{try{const i=await createImageBitmap(a);return{source:i,width:i.width,height:i.height,cleanup:()=>{typeof i.close=="function"&&i.close()}}}catch{}}return new Promise((i,s)=>{if(typeof Image>"u")return s(new Error("Image decoding not supported in this environment"));const r=new Image,u=URL.createObjectURL(a);r.onload=()=>{i({source:r,width:r.naturalWidth||r.width,height:r.naturalHeight||r.height,cleanup:()=>{try{URL.revokeObjectURL(u)}catch{}}})},r.onerror=()=>{try{URL.revokeObjectURL(u)}catch{}s(new Error("Failed to decode image source"))},r.src=u})}async function Ig(a,i=Yg,s=Fv){var u;if(!a||a.size===0||a.type&&!a.type.startsWith("image/"))return null;let r;try{r=await Zv(a)}catch(f){return console.warn("Failed to decode image for paste:",f),null}try{const{width:f,height:m}=Vv(r.width,r.height,i),h=document.createElement("canvas");h.width=f,h.height=m;const p=h.getContext("2d");if(!p)return null;p.drawImage(r.source,0,0,f,m);let y="image/webp";try{h.toDataURL("image/webp",.85).startsWith("data:image/webp")||(y="image/jpeg")}catch{y="image/jpeg"}for(const b of qv){let v;try{v=h.toDataURL(y,b)}catch{continue}if(!v||!v.startsWith("data:"))continue;const S=v.indexOf(","),T=S!==-1?v.slice(S+1):"",E=Xv(T);if(E<=s)return{mime:y,dataBase64:T,dataUrl:v,byteLength:E,width:f,height:m}}return null}finally{(u=r.cleanup)==null||u.call(r)}}const Qv=4e3,Wv=3,Jv=4096,ex=8*1024*1024,ho={ctrl:!1,alt:!1,shift:!1},tx=3e4,Gg=w.createContext(null);function Ka(a){return{wsUrl:a.wsUrl,token:a.token||void 0,pairCode:a.pairCode||void 0,clientId:a.clientId,autoReconnect:a.autoReconnect,reconnectIntervalMs:2e3,maxReconnectAttempts:0,pingIntervalMs:1e4}}const nx=({children:a})=>{const[i,s]=w.useState(zg),[r,u]=w.useState("disconnected"),[f,m]=w.useState(),[h,p]=w.useState(),[y,b]=w.useState("viewer"),[v,S]=w.useState(),[T,E]=w.useState(),[G,A]=w.useState(),[z,B]=w.useState(null),[Y,ae]=w.useState(null),[he,ee]=w.useState(Mv),F=w.useRef(he),H=w.useRef(new Set),re=w.useRef(null),le=w.useRef(null),ye=w.useCallback(_=>{(_==null?void 0:_.phase)!=="starting"&&le.current&&(clearTimeout(le.current),le.current=null),re.current=_,B(_)},[]),[Me,Ke]=w.useState(null),[nt,Ge]=w.useState(),[N,q]=w.useState(null),[ce,Le]=w.useState(1),[J,Ve]=w.useState(0),[Ue,Re]=w.useState(null),[Oe,je]=w.useState(null),[Xe,Bt]=w.useState(null),[jt,Fe]=w.useState({cols:80,rows:24}),[qt,St]=w.useState([]),mt=Kv(Oe==null?void 0:Oe.focusedAgent,"auto");w.useEffect(()=>{Ug()},[]);const V=w.useRef(i);V.current=i;const me=w.useRef(null),Ye=w.useRef(!1),pt=w.useRef(jt);pt.current=jt;const L=w.useRef(new Set),xe=w.useRef(new Set),[we,Ee]=w.useState(di),_e=w.useRef(null),ot=w.useRef(0),$e=w.useRef(null),oe=w.useCallback((_,K)=>Cd(i.language,_,K),[i.language]),ve=w.useRef(oe);ve.current=oe;const ze=w.useRef(null),Qe=w.useRef([]),kt=w.useRef(0),Kn=w.useCallback(_=>{for(Qe.current.push(_),kt.current+=_.byteLength;Qe.current.length>Jv||kt.current>ex;){const K=Qe.current.shift();if(!K)break;kt.current-=K.byteLength}},[]),Dt=w.useCallback(_=>{const K=ze.current;if(K)try{K(_);return}catch(de){console.debug("Terminal output sink threw, buffering chunk instead:",de)}Kn(_)},[Kn]),ii=w.useRef(Dt);ii.current=Dt;const Rn=w.useCallback(_=>{ze.current=_;const K=Qe.current;Qe.current=[],kt.current=0;for(let de=0;de<K.length;de++)try{_(K[de])}catch(U){console.debug("Terminal sink threw while flushing, re-buffering the tail:",U);for(let $=de;$<K.length;$++)Kn(K[$]);break}return()=>{ze.current===_&&(ze.current=null)}},[Kn]),Zt=w.useCallback(()=>Qe.current.length,[]),ut=w.useCallback(()=>{Qe.current=[],kt.current=0},[]),Tt=w.useCallback((_=!0)=>{b("viewer"),S(void 0),E(void 0),A(void 0),Ke(null),Ge(void 0),q(null),Le(1),Re(null),ut(),_&&Ve(K=>K+1)},[ut]),Ct=w.useRef([]),Yn=w.useRef(new Map),cn=w.useCallback(_=>{Ct.current=_,St(_)},[]),In=w.useCallback(_=>{const K=Yn.current.get(_);K&&(clearTimeout(K),Yn.current.delete(_)),cn(Ct.current.filter(de=>de.id!==_))},[cn]),li=w.useRef(In);li.current=In;const et=w.useCallback((_,K)=>{const de=Date.now(),U=Ct.current,$=U.find(ne=>ne.type===_&&ne.message===K),ie=$?$.id:`${de}-${Math.random().toString(36).substring(2,6)}`;let te;if($)te=U.map(ne=>ne.id===ie?{...ne,count:ne.count+1,timestamp:de}:ne);else for(te=[...U,{id:ie,type:_,message:K,timestamp:de,count:1}];te.length>Wv;){const[ne,...it]=te,dt=Yn.current.get(ne.id);dt&&(clearTimeout(dt),Yn.current.delete(ne.id)),te=it}cn(te);const Ae=Yn.current.get(ie);Ae&&clearTimeout(Ae),Yn.current.set(ie,setTimeout(()=>li.current(ie),Qv))},[cn]),Mi=w.useCallback(_=>{li.current(_)},[]),un=w.useRef(!0);w.useEffect(()=>{y==="controller"&&(un.current=!0)},[y]);const mn=w.useCallback(()=>{un.current&&(un.current=!1,et("warning",ve.current("toasts.viewerModeWarning")))},[et]);w.useEffect(()=>{const _=Yn.current;return()=>{for(const K of _.values())clearTimeout(K);_.clear()}},[]);const Gn=w.useCallback(_=>{const K=El(_);V.current=K,s(K)},[]),jl=w.useCallback(_=>{Gn({language:_})},[Gn]),Lt=w.useCallback(_=>{V.current=_,s(_)},[]),wn=w.useCallback(_=>{var $;const K=V.current,de=xp({..._,wsUrl:_.wsUrl||"/ws/client",token:_.token||"",displayName:_.displayName||`Herdr ${K.profiles.length+1}`,autoReconnect:_.autoReconnect!==!1},K.profiles.length),U=El({profiles:[...K.profiles,de],activeProfileId:de.id,wsUrl:de.wsUrl,token:de.token,pairCode:de.pairCode||"",autoReconnect:de.autoReconnect});Lt(U),Tt(),($=me.current)==null||$.reconnectWith(Ka(U))},[Lt,Tt]),Sn=w.useCallback(_=>{var $;const K=V.current,de=K.profiles.find(ie=>ie.id===_);if(!de||de.id===K.activeProfileId)return;const U=El({activeProfileId:de.id,wsUrl:de.wsUrl,token:de.token,pairCode:de.pairCode||"",autoReconnect:de.autoReconnect,profiles:K.profiles.map(ie=>ie.id===de.id?{...ie,lastUsedAt:Date.now()}:ie)});Lt(U),Tt(),($=me.current)==null||$.reconnectWith(Ka(U))},[Lt,Tt]),Ai=w.useCallback((_,K)=>{const de=V.current;if(!de.profiles.find(te=>te.id===_))return;const $=K.trim().slice(0,64);if(!$)return;const ie=El({profiles:de.profiles.map(te=>te.id===_?{...te,displayName:$}:te)});Lt(ie)},[Lt]),sa=w.useCallback(_=>{var ie;const K=V.current;if(!K.profiles.some(te=>te.id===_))return;const de=K.profiles.filter(te=>te.id!==_),U=de.find(te=>te.id===K.activeProfileId)||de[0],$=El(U?{profiles:de,activeProfileId:U.id,wsUrl:U.wsUrl,token:U.token,pairCode:U.pairCode||"",autoReconnect:U.autoReconnect}:{profiles:[],activeProfileId:"",wsUrl:"/ws/client",token:"",pairCode:""});Lt($),_===K.activeProfileId&&(Tt(),(ie=me.current)==null||ie.reconnectWith(Ka($)))},[Lt,Tt]),Dl=w.useCallback(_=>{const K=V.current,de=K.profiles.find(vt=>vt.id===K.activeProfileId),U=_.hostId?wp({wsUrl:K.wsUrl,hostId:_.hostId}):null,$=U?K.profiles.findIndex(vt=>wp(vt)===U):-1,ie=$>=0?$:Math.max(0,K.profiles.findIndex(vt=>vt.id===K.activeProfileId)),Ae={...K.profiles[ie]||de||xp({wsUrl:K.wsUrl||"/ws/client",token:"",pairCode:K.pairCode||"PENDING",displayName:`Herdr ${K.profiles.length+1}`},K.profiles.length),token:_.token,pairCode:void 0,..._.hostId?{hostId:_.hostId}:{},..._.deviceId?{deviceId:_.deviceId}:{},lastUsedAt:Date.now()};let ne=[...K.profiles];ie>=0&&ie<ne.length?ne[ie]=Ae:ne.push(Ae);const it=de==null?void 0:de.id;ne=ne.filter((vt,st)=>st===ie||vt.id===Ae.id?!0:!($>=0&&it&&vt.id===it));const dt=El({profiles:ne,activeProfileId:Ae.id,wsUrl:Ae.wsUrl,token:Ae.token,pairCode:"",autoReconnect:Ae.autoReconnect});return Lt(dt),dt},[Lt]),Pi=w.useCallback(_=>{const K=V.current,de=K.profiles.find(te=>te.id===K.activeProfileId);if(!de||!_.hostId&&!_.hostname)return;const U=/^Herdr \d+$/.test(de.displayName),$={...de,..._.hostId?{hostId:_.hostId}:{},..._.hostname?{hostname:_.hostname}:{},..._.hostname&&U?{displayName:_.hostname}:{}},ie=El({profiles:K.profiles.map(te=>te.id===de.id?$:te)});Lt(ie)},[Lt]);if(!me.current){const _=new uv(Ka(i));me.current=_,_.on("stateChange",(K,de,U)=>{u(K),p(U);const $=U?`serverErrors.${U}`:null,ie=$?ve.current($):null,te=ie&&ie!==$?ie:de;m(te),K==="connected"?et("success",ve.current("toasts.connected")):K==="error"&&et("error",te||ve.current("toasts.connectionError")),K!=="connected"&&je(null),K!=="connected"&&ye(null)}),_.on("ready",K=>{Ye.current&&(ut(),Ve(de=>de+1)),Ye.current=!0,ye(null),ae(null),b(K.role),S(K.controllerId),E(K.hostId),A(K.hostname),Pi(K),K.clientId&&Ge(K.clientId),Ke(K.terminalPalette||null)}),_.on("hostReconnecting",K=>{p(K||"host_reconnecting"),m(ve.current(`serverErrors.${K||"host_reconnecting"}`)),b("viewer"),S(void 0),A(void 0),Ke(null),q(null),Le(1),Re(null),ut()}),_.on("sessionRestarted",(K,de,U,$)=>{ut(),A($),Pi({hostId:_.getHostId(),hostname:$}),Ke(U||null),Ve(ie=>ie+1)}),_.on("roleChange",(K,de,U,$)=>{b(K),S(de),U&&E(U),$&&Ge($)}),_.on("controlGranted",()=>{b("controller"),et("success",ve.current("toasts.controlGranted"))}),_.on("controlDenied",K=>{et("warning",K||ve.current("toasts.controlDenied"))}),_.on("controlRevoked",K=>{b("viewer"),et("warning",K||ve.current("toasts.controlRevoked"))}),_.on("paired",K=>{const de=Dl(K);et("success",ve.current("toasts.pairedSuccess")),Bt(Date.now()),_.reconnectWith(Ka(de))}),_.on("exit",(K,de)=>{et("info",`${ve.current("toasts.sessionEnded")}${de?`: ${de}`:""}${K!==void 0?` (${K})`:""}`)}),_.on("status",K=>{Re(K)}),_.on("error",K=>{var te;if(K.code==="herdr_not_running"){((te=re.current)==null?void 0:te.phase)!=="starting"&&ye({phase:"stopped"});return}if(K.code==="herdr_start_failed"&&re.current){ye({phase:"failed",message:K.message||""});return}_e.current!==null&&($e.current&&(clearTimeout($e.current),$e.current=null),_e.current=null,Ee(di));const U=`serverErrors.${String(K.code)}`,$=ve.current(U),ie=$&&$!==U?$:K.message||`[${K.code}]`;et("error",ie)}),_.on("pasteFileReady",K=>{const de=_e.current;de!==null&&($e.current&&(clearTimeout($e.current),$e.current=null),Ee({active:!0,phase:"completed",ratio:1,percent:100,statusText:ve.current("virtualKeyboard.uploadProgressCompleted")}),setTimeout(()=>{_e.current===de&&(_e.current=null,Ee(di))},1200));for(const U of L.current)try{U(K)}catch($){console.error("Error in pasteFileReady listener:",$)}}),_.on("rttUpdate",K=>{q(K)}),_.on("peerCount",K=>{Le(Math.max(1,K))}),_.on("sessionReady",()=>{u("connected"),ye(null)}),_.on("agentStatus",K=>{je(K)}),_.on("updateStatus",K=>{if(ae(K),!K.updateAvailable||F.current===K.latest)return;const de=`${K.latest}:${K.restartPending?"restart":"update"}`;H.current.has(de)||(H.current.add(de),et("info",K.restartPending?ve.current("update.toastRestart",{version:K.latest}):ve.current("update.toast",{version:K.latest})))}),_.on("binaryData",K=>{ii.current(K)})}const Zi=me.current,Qi=i.profiles.find(_=>_.id===i.activeProfileId);w.useEffect(()=>{var _;(_=me.current)==null||_.updateConfig(Ka(i))},[i]);const Ei=w.useCallback(_=>{me.current&&(_&&me.current.updateConfig(_),me.current.connect(pt.current))},[]),Ni=w.useCallback(()=>{me.current&&me.current.disconnect()},[]),$n=w.useCallback(_=>{F.current=_,ee(_),Av(_)},[]),Ht=w.useCallback(()=>{const _=me.current;_&&(ye({phase:"starting"}),_.sendHerdrStart(),le.current=setTimeout(()=>{var K;le.current=null,((K=re.current)==null?void 0:K.phase)==="starting"&&ye({phase:"failed",message:ve.current("herdrLaunch.timeout")})},tx))},[ye]);w.useEffect(()=>()=>{le.current&&clearTimeout(le.current)},[]);const Qt=w.useCallback((_=!1)=>{me.current&&me.current.claimControl(_)},[]),mi=w.useCallback(()=>{var _;(_=me.current)==null||_.releaseControl()},[]),Ol=w.useCallback(_=>{if(y!=="controller"){mn();return}const K=me.current;if(!K)return;const de=yd(_);for(const U of xe.current)try{U(de)}catch($){console.debug("Key input observer threw:",$)}K.sendInput(de)},[y,mn]),Za=w.useCallback(_=>(xe.current.add(_),()=>{xe.current.delete(_)}),[]),[ra,Wi]=w.useState(ho),dn=w.useRef(ho),ki=w.useCallback(_=>{const K={...dn.current,[_]:!dn.current[_]};dn.current=K,Wi(K)},[]),Cn=w.useCallback(()=>{const _=dn.current;return!_.ctrl&&!_.alt&&!_.shift?null:(dn.current=ho,Wi(ho),_)},[]);w.useEffect(()=>{const _=me.current;return _?dv(_):void 0},[]);const ai=w.useCallback(_=>{y!=="controller"&&!Ao(_)||me.current&&me.current.sendInput(_)},[y]),pi=w.useCallback((_,K)=>{pt.current={cols:_,rows:K},Fe({cols:_,rows:K}),me.current&&me.current.sendResize(_,K)},[]),Ln=w.useCallback((_,K)=>y!=="controller"?(mn(),!1):me.current?(me.current.sendPasteFile(_,K),!0):!1,[y,mn]),_t=w.useCallback(_=>(L.current.add(_),()=>{L.current.delete(_)}),[]),zl=w.useCallback(()=>{$e.current&&(clearTimeout($e.current),$e.current=null),_e.current=null,Ee(di)},[]);w.useEffect(()=>{r!=="connected"&&_e.current!==null&&($e.current&&(clearTimeout($e.current),$e.current=null),_e.current=null,Ee(di))},[r]),w.useEffect(()=>()=>{$e.current&&clearTimeout($e.current)},[]);const Ul=w.useCallback(async _=>{if(y!=="controller")return mn(),!1;if(!me.current||r!=="connected")return et("error",oe("serverErrors.host_offline")),!1;if(_e.current!==null)return!1;const K=++ot.current;_e.current=K,$e.current&&(clearTimeout($e.current),$e.current=null);const de="dataBase64"in _&&typeof _.dataBase64=="string";try{let U;if(de)U=_;else{const ie=_;if(Ee({active:!0,phase:"reading",ratio:.1,percent:10,statusText:oe("virtualKeyboard.uploadProgressReading")}),!ie||ie.size===0)return et("error",oe("clipboard.fileEmpty")),_e.current=null,Ee(di),!1;if(ie.type&&!ie.type.startsWith("image/"))return et("error",oe("clipboard.unsupportedType")),_e.current=null,Ee(di),!1;Ee({active:!0,phase:"processing",ratio:.35,percent:35,statusText:oe("virtualKeyboard.uploadProgressProcessing")});const te=await Ig(ie);if(_e.current!==K)return!1;if(!te)return et("error",oe("clipboard.imageTooLarge")),_e.current=null,Ee(di),!1;U=te,Ee({active:!0,phase:"processing",ratio:.6,percent:60,statusText:oe("virtualKeyboard.uploadProgressProcessing")})}Ee({active:!0,phase:"sending",ratio:.75,percent:75,statusText:oe("virtualKeyboard.uploadProgressSending")});const $=Ln(U.mime,U.dataBase64);return _e.current!==K?!1:$?(Ee({active:!0,phase:"waitingHost",ratio:.88,percent:88,statusText:oe("virtualKeyboard.uploadProgressWaitingHost")}),$e.current=setTimeout(()=>{_e.current===K&&(_e.current=null,et("error",oe("serverErrors.paste_file_write_failed")),Ee(di))},3e4),!0):(_e.current=null,Ee(di),!1)}catch(U){return console.error("Failed to process/upload image:",U),_e.current===K&&(_e.current=null,et("error",oe("clipboard.imageTooLarge")),Ee(di)),!1}},[y,r,mn,et,oe,Ln]);return d.jsx(Gg.Provider,{value:{connectionState:r,stateDetail:f,stateCode:h,role:y,controllerId:v,hostId:T,hostname:G,assignedClientId:nt,profiles:i.profiles,activeProfileId:i.activeProfileId,activeProfile:Qi,isController:y==="controller",sharedWindowCount:ce,terminalResetVersion:J,rttMs:N,statusPayload:Ue,agentStatus:Oe,agentProfile:mt,lastPairedAt:Xe,settings:i,hostPalette:Me,terminalDimensions:jt,toasts:qt,adapter:Zi,language:i.language,t:oe,setLanguage:jl,connect:Ei,disconnect:Ni,switchProfile:Sn,addProfileAndConnect:wn,renameProfile:Ai,removeProfile:sa,claimControl:Qt,releaseControl:mi,sendKey:Ol,observeKeyInput:Za,modifierLatch:ra,toggleModifierLatch:ki,consumeModifierLatch:Cn,sendBinary:ai,sendResize:pi,updateSettings:Gn,addToast:et,removeToast:Mi,warnViewerMode:mn,subscribeToOutput:Rn,getPendingOutputChunkCount:Zt,sendPasteFile:Ln,subscribeToPasteFileReady:_t,uploadProgress:we,uploadImage:Ul,resetUploadProgress:zl,herdrLaunch:z,startHerdr:Ht,updateStatus:Y,ignoredUpdate:he,ignoreUpdate:$n},children:a})};function ct(){const a=w.useContext(Gg);if(!a)throw new Error("useTerminal must be used within a TerminalProvider");return a}function tr(a){var i,s;return a?{blocked:((i=a.counts)==null?void 0:i.blocked)??0,done:((s=a.counts)==null?void 0:s.done)??0}:null}function ix(a){return a?a.blocked>0?"blocked":a.done>0?"done":null:null}function lx(a){if(!a)return"";const i=[];return a.blocked>0&&i.push(`${a.blocked}⚠`),a.done>0&&i.push(`${a.done}✓`),i.length>0?`(${i.join(" ")})`:""}function ax(a,i){if(!a||!i)return null;const s=new Map(a.agents.map(m=>[m.paneId,m.status]));let r=null;for(const m of i.agents)if(!(m.status!=="blocked"&&m.status!=="done")&&s.get(m.paneId)!==m.status){if(m.status==="blocked")return"blocked";r="done"}const u=tr(a),f=tr(i);return f.blocked>u.blocked?"blocked":(!r&&f.done>u.done&&(r="done"),r)}const sx={blocked:"%23f9e2af",done:"%23a6e3a1"};function rx(a){return`<circle cx='19' cy='5' r='4.5' fill='${sx[a]}' stroke='%2311111b' stroke-width='1.5'/>`}function ox(a,i){return!i||!a.includes("</svg>")?a:a.replace("</svg>",`${rx(i)}</svg>`)}function Ep(a,i=document){const s=i.querySelector('link[rel~="icon"]');if(!s)return;s.dataset.baseHref===void 0&&(s.dataset.baseHref=s.getAttribute("href")??"");const r=ox(s.dataset.baseHref,a);s.getAttribute("href")!==r&&s.setAttribute("href",r)}let hi=null;function cx(){if(typeof window>"u")return null;const a=window;return a.AudioContext??a.webkitAudioContext??null}function $g(){const a=cx();if(a)try{hi=hi??new a,hi.state==="suspended"&&hi.resume()}catch{hi=null}}function ux(a=window){const i=()=>{$g(),s()},s=()=>{a.removeEventListener("pointerdown",i),a.removeEventListener("keydown",i)};return a.addEventListener("pointerdown",i),a.addEventListener("keydown",i),s}const dx={blocked:[880,660],done:[660,880]};function Fg(a){if(!(!hi||hi.state!=="running"))try{const i=hi.currentTime;dx[a].forEach((s,r)=>{const u=hi.createOscillator(),f=hi.createGain(),m=i+r*.11;u.type="sine",u.frequency.value=s,f.gain.setValueAtTime(1e-4,m),f.gain.exponentialRampToValueAtTime(.06,m+.01),f.gain.exponentialRampToValueAtTime(1e-4,m+.09),u.connect(f),f.connect(hi.destination),u.start(m),u.stop(m+.1)})}catch{}}const fx=15e3,hx={blocked:[70,50,70],done:[40]};function mx(){const{agentStatus:a,settings:i,t:s}=ct(),r=w.useRef(i);r.current=i;const u=w.useRef(s);u.current=s;const f=w.useRef(null),m=w.useRef(Number.NEGATIVE_INFINITY);w.useEffect(()=>{Ep(i.agentAlertBadge?ix(tr(a)):null)},[a,i.agentAlertBadge]),w.useEffect(()=>()=>Ep(null),[]),w.useEffect(()=>{if(!(!i.agentAlertSound||typeof window>"u"))return ux(window)},[i.agentAlertSound]),w.useEffect(()=>{const h=f.current;f.current=a;const p=ax(h,a);if(!p)return;const y=Date.now();if(y-m.current<fx)return;m.current=y;const b=r.current,v=typeof document<"u"&&document.visibilityState==="hidden",S=v||typeof document<"u"&&!document.hasFocus();if(b.agentAlertVibrate&&!v&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(hx[p])}catch{}if(b.agentAlertSound&&S&&Fg(p),b.agentAlertNotify&&v&&typeof window<"u"&&window.isSecureContext&&"Notification"in window&&Notification.permission==="granted"){const T=tr(a),E=p==="blocked"?u.current("agents.notifyBlocked",{count:T.blocked}):u.current("agents.notifyDone",{count:T.done});try{new Notification("Herdr Remote",{body:E,tag:"herdr-agents"})}catch{}}},[a])}function qg(a){var i,s,r="";if(typeof a=="string"||typeof a=="number")r+=a;else if(typeof a=="object")if(Array.isArray(a)){var u=a.length;for(i=0;i<u;i++)a[i]&&(s=qg(a[i]))&&(r&&(r+=" "),r+=s)}else for(s in a)a[s]&&(r&&(r+=" "),r+=s);return r}function px(){for(var a,i,s=0,r="",u=arguments.length;s<u;s++)(a=arguments[s])&&(i=qg(a))&&(r&&(r+=" "),r+=i);return r}const gx=(a,i)=>{const s=new Array(a.length+i.length);for(let r=0;r<a.length;r++)s[r]=a[r];for(let r=0;r<i.length;r++)s[a.length+r]=i[r];return s},bx=(a,i)=>({classGroupId:a,validator:i}),Vg=(a=new Map,i=null,s)=>({nextPart:a,validators:i,classGroupId:s}),ko="-",Np=[],yx="arbitrary..",vx=a=>{const i=wx(a),{conflictingClassGroups:s,conflictingClassGroupModifiers:r}=a;return{getClassGroupId:m=>{if(m.startsWith("[")&&m.endsWith("]"))return xx(m);const h=m.split(ko),p=h[0]===""&&h.length>1?1:0;return Xg(h,p,i)},getConflictingClassGroupIds:(m,h)=>{if(h){const p=r[m],y=s[m];return p?y?gx(y,p):p:y||Np}return s[m]||Np}}},Xg=(a,i,s)=>{if(a.length-i===0)return s.classGroupId;const u=a[i],f=s.nextPart.get(u);if(f){const y=Xg(a,i+1,f);if(y)return y}const m=s.validators;if(m===null)return;const h=i===0?a.join(ko):a.slice(i).join(ko),p=m.length;for(let y=0;y<p;y++){const b=m[y];if(b.validator(h))return b.classGroupId}},xx=a=>a.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const i=a.slice(1,-1),s=i.indexOf(":"),r=i.slice(0,s);return r?yx+r:void 0})(),wx=a=>{const{theme:i,classGroups:s}=a;return Sx(s,i)},Sx=(a,i)=>{const s=Vg();for(const r in a){const u=a[r];Td(u,s,r,i)}return s},Td=(a,i,s,r)=>{const u=a.length;for(let f=0;f<u;f++){const m=a[f];Cx(m,i,s,r)}},Cx=(a,i,s,r)=>{if(typeof a=="string"){Tx(a,i,s);return}if(typeof a=="function"){Mx(a,i,s,r);return}Ax(a,i,s,r)},Tx=(a,i,s)=>{const r=a===""?i:Pg(i,a);r.classGroupId=s},Mx=(a,i,s,r)=>{if(Ex(a)){Td(a(r),i,s,r);return}i.validators===null&&(i.validators=[]),i.validators.push(bx(s,a))},Ax=(a,i,s,r)=>{const u=Object.entries(a),f=u.length;for(let m=0;m<f;m++){const[h,p]=u[m];Td(p,Pg(i,h),s,r)}},Pg=(a,i)=>{let s=a;const r=i.split(ko),u=r.length;for(let f=0;f<u;f++){const m=r[f];let h=s.nextPart.get(m);h||(h=Vg(),s.nextPart.set(m,h)),s=h}return s},Ex=a=>"isThemeGetter"in a&&a.isThemeGetter===!0,Nx=a=>{if(a<1)return{get:()=>{},set:()=>{}};let i=0,s=Object.create(null),r=Object.create(null);const u=(f,m)=>{s[f]=m,i++,i>a&&(i=0,r=s,s=Object.create(null))};return{get(f){let m=s[f];if(m!==void 0)return m;if((m=r[f])!==void 0)return u(f,m),m},set(f,m){f in s?s[f]=m:u(f,m)}}},fd="!",kp=":",kx=[],Rp=(a,i,s,r,u)=>({modifiers:a,hasImportantModifier:i,baseClassName:s,maybePostfixModifierPosition:r,isExternal:u}),Rx=a=>{const{prefix:i,experimentalParseClassName:s}=a;let r=u=>{const f=[];let m=0,h=0,p=0,y;const b=u.length;for(let G=0;G<b;G++){const A=u[G];if(m===0&&h===0){if(A===kp){f.push(u.slice(p,G)),p=G+1;continue}if(A==="/"){y=G;continue}}A==="["?m++:A==="]"?m--:A==="("?h++:A===")"&&h--}const v=f.length===0?u:u.slice(p);let S=v,T=!1;v.endsWith(fd)?(S=v.slice(0,-1),T=!0):v.startsWith(fd)&&(S=v.slice(1),T=!0);const E=y&&y>p?y-p:void 0;return Rp(f,T,S,E)};if(i){const u=i+kp,f=r;r=m=>m.startsWith(u)?f(m.slice(u.length)):Rp(kx,!1,m,void 0,!0)}if(s){const u=r;r=f=>s({className:f,parseClassName:u})}return r},Lx=a=>{const i=new Map;return a.orderSensitiveModifiers.forEach((s,r)=>{i.set(s,1e6+r)}),s=>{const r=[];let u=[];for(let f=0;f<s.length;f++){const m=s[f],h=m[0]==="[",p=i.has(m);h||p?(u.length>0&&(u.sort(),r.push(...u),u=[]),r.push(m)):u.push(m)}return u.length>0&&(u.sort(),r.push(...u)),r}},_x=a=>({cache:Nx(a.cacheSize),parseClassName:Rx(a),sortModifiers:Lx(a),postfixLookupClassGroupIds:jx(a),...vx(a)}),jx=a=>{const i=Object.create(null),s=a.postfixLookupClassGroups;if(s)for(let r=0;r<s.length;r++)i[s[r]]=!0;return i},Dx=/\s+/,Ox=(a,i)=>{const{parseClassName:s,getClassGroupId:r,getConflictingClassGroupIds:u,sortModifiers:f,postfixLookupClassGroupIds:m}=i,h=[],p=a.trim().split(Dx);let y="";for(let b=p.length-1;b>=0;b-=1){const v=p[b],{isExternal:S,modifiers:T,hasImportantModifier:E,baseClassName:G,maybePostfixModifierPosition:A}=s(v);if(S){y=v+(y.length>0?" "+y:y);continue}let z=!!A,B;if(z){const F=G.substring(0,A);B=r(F);const H=B&&m[B]?r(G):void 0;H&&H!==B&&(B=H,z=!1)}else B=r(G);if(!B){if(!z){y=v+(y.length>0?" "+y:y);continue}if(B=r(G),!B){y=v+(y.length>0?" "+y:y);continue}z=!1}const Y=T.length===0?"":T.length===1?T[0]:f(T).join(":"),ae=E?Y+fd:Y,he=ae+B;if(h.indexOf(he)>-1)continue;h.push(he);const ee=u(B,z);for(let F=0;F<ee.length;++F){const H=ee[F];h.push(ae+H)}y=v+(y.length>0?" "+y:y)}return y},zx=(...a)=>{let i=0,s,r,u="";for(;i<a.length;)(s=a[i++])&&(r=Zg(s))&&(u&&(u+=" "),u+=r);return u},Zg=a=>{if(typeof a=="string")return a;let i,s="";for(let r=0;r<a.length;r++)a[r]&&(i=Zg(a[r]))&&(s&&(s+=" "),s+=i);return s},Ux=(a,...i)=>{let s,r,u,f;const m=p=>{const y=i.reduce((b,v)=>v(b),a());return s=_x(y),r=s.cache.get,u=s.cache.set,f=h,h(p)},h=p=>{const y=r(p);if(y)return y;const b=Ox(p,s);return u(p,b),b};return f=m,(...p)=>f(zx(...p))},Bx=[],Pt=a=>{const i=s=>s[a]||Bx;return i.isThemeGetter=!0,i},Qg=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Wg=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Hx=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Kx=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Yx=/\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$/,Ix=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Gx=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,$x=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Nl=a=>Hx.test(a),qe=a=>!!a&&!Number.isNaN(Number(a)),wi=a=>!!a&&Number.isInteger(Number(a)),Fu=a=>a.endsWith("%")&&qe(a.slice(0,-1)),qi=a=>Kx.test(a),Jg=()=>!0,Fx=a=>Yx.test(a)&&!Ix.test(a),Md=()=>!1,qx=a=>Gx.test(a),Vx=a=>$x.test(a),Xx=a=>!pe(a)&&!ge(a),Px=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)),Zx=a=>_l(a,nb,Md),pe=a=>Qg.test(a),ea=a=>_l(a,ib,Fx),Lp=a=>_l(a,l1,qe),Qx=a=>_l(a,ab,Jg),Wx=a=>_l(a,lb,Md),_p=a=>_l(a,eb,Md),Jx=a=>_l(a,tb,Vx),mo=a=>_l(a,sb,qx),ge=a=>Wg.test(a),Hs=a=>aa(a,ib),e1=a=>aa(a,lb),jp=a=>aa(a,eb),t1=a=>aa(a,nb),n1=a=>aa(a,tb),po=a=>aa(a,sb,!0),i1=a=>aa(a,ab,!0),_l=(a,i,s)=>{const r=Qg.exec(a);return r?r[1]?i(r[1]):s(r[2]):!1},aa=(a,i,s=!1)=>{const r=Wg.exec(a);return r?r[1]?i(r[1]):s:!1},eb=a=>a==="position"||a==="percentage",tb=a=>a==="image"||a==="url",nb=a=>a==="length"||a==="size"||a==="bg-size",ib=a=>a==="length",l1=a=>a==="number",lb=a=>a==="family-name",ab=a=>a==="number"||a==="weight",sb=a=>a==="shadow",a1=()=>{const a=Pt("color"),i=Pt("font"),s=Pt("text"),r=Pt("font-weight"),u=Pt("tracking"),f=Pt("leading"),m=Pt("breakpoint"),h=Pt("container"),p=Pt("spacing"),y=Pt("radius"),b=Pt("shadow"),v=Pt("inset-shadow"),S=Pt("text-shadow"),T=Pt("drop-shadow"),E=Pt("blur"),G=Pt("perspective"),A=Pt("aspect"),z=Pt("ease"),B=Pt("animate"),Y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],ae=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],he=()=>[...ae(),ge,pe],ee=()=>["auto","hidden","clip","visible","scroll"],F=()=>["auto","contain","none"],H=()=>[ge,pe,p],re=()=>[Nl,"full","auto",...H()],le=()=>[wi,"none","subgrid",ge,pe],ye=()=>["auto",{span:["full",wi,ge,pe]},wi,ge,pe],Me=()=>[wi,"auto",ge,pe],Ke=()=>["auto","min","max","fr",ge,pe],nt=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Ge=()=>["start","end","center","stretch","center-safe","end-safe"],N=()=>["auto",...H()],q=()=>[Nl,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...H()],ce=()=>[Nl,"screen","full","dvw","lvw","svw","min","max","fit",...H()],Le=()=>[Nl,"screen","full","lh","dvh","lvh","svh","min","max","fit",...H()],J=()=>[a,ge,pe],Ve=()=>[...ae(),jp,_p,{position:[ge,pe]}],Ue=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Re=()=>["auto","cover","contain",t1,Zx,{size:[ge,pe]}],Oe=()=>[Fu,Hs,ea],je=()=>["","none","full",y,ge,pe],Xe=()=>["",qe,Hs,ea],Bt=()=>["solid","dashed","dotted","double"],jt=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Fe=()=>[qe,Fu,jp,_p],qt=()=>["","none",E,ge,pe],St=()=>["none",qe,ge,pe],mt=()=>["none",qe,ge,pe],V=()=>[qe,ge,pe],me=()=>[Nl,"full",...H()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[qi],breakpoint:[qi],color:[Jg],container:[qi],"drop-shadow":[qi],ease:["in","out","in-out"],font:[Xx],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[qi],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[qi],shadow:[qi],spacing:["px",qe],text:[qi],"text-shadow":[qi],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Nl,pe,ge,A]}],container:["container"],"container-type":[{"@container":["","normal","size",ge,pe]}],"container-named":[Px],columns:[{columns:[qe,pe,ge,h]}],"break-after":[{"break-after":Y()}],"break-before":[{"break-before":Y()}],"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:he()}],overflow:[{overflow:ee()}],"overflow-x":[{"overflow-x":ee()}],"overflow-y":[{"overflow-y":ee()}],overscroll:[{overscroll:F()}],"overscroll-x":[{"overscroll-x":F()}],"overscroll-y":[{"overscroll-y":F()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:re()}],"inset-x":[{"inset-x":re()}],"inset-y":[{"inset-y":re()}],start:[{"inset-s":re(),start:re()}],end:[{"inset-e":re(),end:re()}],"inset-bs":[{"inset-bs":re()}],"inset-be":[{"inset-be":re()}],top:[{top:re()}],right:[{right:re()}],bottom:[{bottom:re()}],left:[{left:re()}],visibility:["visible","invisible","collapse"],z:[{z:[wi,"auto",ge,pe]}],basis:[{basis:[Nl,"full","auto",h,...H()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[qe,Nl,"auto","initial","none",pe]}],grow:[{grow:["",qe,ge,pe]}],shrink:[{shrink:["",qe,ge,pe]}],order:[{order:[wi,"first","last","none",ge,pe]}],"grid-cols":[{"grid-cols":le()}],"col-start-end":[{col:ye()}],"col-start":[{"col-start":Me()}],"col-end":[{"col-end":Me()}],"grid-rows":[{"grid-rows":le()}],"row-start-end":[{row:ye()}],"row-start":[{"row-start":Me()}],"row-end":[{"row-end":Me()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Ke()}],"auto-rows":[{"auto-rows":Ke()}],gap:[{gap:H()}],"gap-x":[{"gap-x":H()}],"gap-y":[{"gap-y":H()}],"justify-content":[{justify:[...nt(),"normal"]}],"justify-items":[{"justify-items":[...Ge(),"normal"]}],"justify-self":[{"justify-self":["auto",...Ge()]}],"align-content":[{content:["normal",...nt()]}],"align-items":[{items:[...Ge(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Ge(),{baseline:["","last"]}]}],"place-content":[{"place-content":nt()}],"place-items":[{"place-items":[...Ge(),"baseline"]}],"place-self":[{"place-self":["auto",...Ge()]}],p:[{p:H()}],px:[{px:H()}],py:[{py:H()}],ps:[{ps:H()}],pe:[{pe:H()}],pbs:[{pbs:H()}],pbe:[{pbe:H()}],pt:[{pt:H()}],pr:[{pr:H()}],pb:[{pb:H()}],pl:[{pl:H()}],m:[{m:N()}],mx:[{mx:N()}],my:[{my:N()}],ms:[{ms:N()}],me:[{me:N()}],mbs:[{mbs:N()}],mbe:[{mbe:N()}],mt:[{mt:N()}],mr:[{mr:N()}],mb:[{mb:N()}],ml:[{ml:N()}],"space-x":[{"space-x":H()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":H()}],"space-y-reverse":["space-y-reverse"],size:[{size:q()}],"inline-size":[{inline:["auto",...ce()]}],"min-inline-size":[{"min-inline":["auto",...ce()]}],"max-inline-size":[{"max-inline":["none",...ce()]}],"block-size":[{block:["auto",...Le()]}],"min-block-size":[{"min-block":["auto",...Le()]}],"max-block-size":[{"max-block":["none",...Le()]}],w:[{w:[h,"screen",...q()]}],"min-w":[{"min-w":[h,"screen","none",...q()]}],"max-w":[{"max-w":[h,"screen","none","prose",{screen:[m]},...q()]}],h:[{h:["screen","lh",...q()]}],"min-h":[{"min-h":["screen","lh","none",...q()]}],"max-h":[{"max-h":["screen","lh",...q()]}],"font-size":[{text:["base",s,Hs,ea]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,i1,Qx]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Fu,pe]}],"font-family":[{font:[e1,Wx,i]}],"font-features":[{"font-features":[pe]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[u,ge,pe]}],"line-clamp":[{"line-clamp":[qe,"none",ge,Lp]}],leading:[{leading:[f,...H()]}],"list-image":[{"list-image":["none",ge,pe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ge,pe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:J()}],"text-color":[{text:J()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Bt(),"wavy"]}],"text-decoration-thickness":[{decoration:[qe,"from-font","auto",ge,ea]}],"text-decoration-color":[{decoration:J()}],"underline-offset":[{"underline-offset":[qe,"auto",ge,pe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:H()}],"tab-size":[{tab:[wi,ge,pe]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ge,pe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ge,pe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Ve()}],"bg-repeat":[{bg:Ue()}],"bg-size":[{bg:Re()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},wi,ge,pe],radial:["",ge,pe],conic:[wi,ge,pe]},n1,Jx]}],"bg-color":[{bg:J()}],"gradient-from-pos":[{from:Oe()}],"gradient-via-pos":[{via:Oe()}],"gradient-to-pos":[{to:Oe()}],"gradient-from":[{from:J()}],"gradient-via":[{via:J()}],"gradient-to":[{to:J()}],rounded:[{rounded:je()}],"rounded-s":[{"rounded-s":je()}],"rounded-e":[{"rounded-e":je()}],"rounded-t":[{"rounded-t":je()}],"rounded-r":[{"rounded-r":je()}],"rounded-b":[{"rounded-b":je()}],"rounded-l":[{"rounded-l":je()}],"rounded-ss":[{"rounded-ss":je()}],"rounded-se":[{"rounded-se":je()}],"rounded-ee":[{"rounded-ee":je()}],"rounded-es":[{"rounded-es":je()}],"rounded-tl":[{"rounded-tl":je()}],"rounded-tr":[{"rounded-tr":je()}],"rounded-br":[{"rounded-br":je()}],"rounded-bl":[{"rounded-bl":je()}],"border-w":[{border:Xe()}],"border-w-x":[{"border-x":Xe()}],"border-w-y":[{"border-y":Xe()}],"border-w-s":[{"border-s":Xe()}],"border-w-e":[{"border-e":Xe()}],"border-w-bs":[{"border-bs":Xe()}],"border-w-be":[{"border-be":Xe()}],"border-w-t":[{"border-t":Xe()}],"border-w-r":[{"border-r":Xe()}],"border-w-b":[{"border-b":Xe()}],"border-w-l":[{"border-l":Xe()}],"divide-x":[{"divide-x":Xe()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Xe()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Bt(),"hidden","none"]}],"divide-style":[{divide:[...Bt(),"hidden","none"]}],"border-color":[{border:J()}],"border-color-x":[{"border-x":J()}],"border-color-y":[{"border-y":J()}],"border-color-s":[{"border-s":J()}],"border-color-e":[{"border-e":J()}],"border-color-bs":[{"border-bs":J()}],"border-color-be":[{"border-be":J()}],"border-color-t":[{"border-t":J()}],"border-color-r":[{"border-r":J()}],"border-color-b":[{"border-b":J()}],"border-color-l":[{"border-l":J()}],"divide-color":[{divide:J()}],"outline-style":[{outline:[...Bt(),"none","hidden"]}],"outline-offset":[{"outline-offset":[qe,ge,pe]}],"outline-w":[{outline:["",qe,Hs,ea]}],"outline-color":[{outline:J()}],shadow:[{shadow:["","none",b,po,mo]}],"shadow-color":[{shadow:J()}],"inset-shadow":[{"inset-shadow":["none",v,po,mo]}],"inset-shadow-color":[{"inset-shadow":J()}],"ring-w":[{ring:Xe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:J()}],"ring-offset-w":[{"ring-offset":[qe,ea]}],"ring-offset-color":[{"ring-offset":J()}],"inset-ring-w":[{"inset-ring":Xe()}],"inset-ring-color":[{"inset-ring":J()}],"text-shadow":[{"text-shadow":["none",S,po,mo]}],"text-shadow-color":[{"text-shadow":J()}],opacity:[{opacity:[qe,ge,pe]}],"mix-blend":[{"mix-blend":[...jt(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":jt()}],"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":[qe]}],"mask-image-linear-from-pos":[{"mask-linear-from":Fe()}],"mask-image-linear-to-pos":[{"mask-linear-to":Fe()}],"mask-image-linear-from-color":[{"mask-linear-from":J()}],"mask-image-linear-to-color":[{"mask-linear-to":J()}],"mask-image-t-from-pos":[{"mask-t-from":Fe()}],"mask-image-t-to-pos":[{"mask-t-to":Fe()}],"mask-image-t-from-color":[{"mask-t-from":J()}],"mask-image-t-to-color":[{"mask-t-to":J()}],"mask-image-r-from-pos":[{"mask-r-from":Fe()}],"mask-image-r-to-pos":[{"mask-r-to":Fe()}],"mask-image-r-from-color":[{"mask-r-from":J()}],"mask-image-r-to-color":[{"mask-r-to":J()}],"mask-image-b-from-pos":[{"mask-b-from":Fe()}],"mask-image-b-to-pos":[{"mask-b-to":Fe()}],"mask-image-b-from-color":[{"mask-b-from":J()}],"mask-image-b-to-color":[{"mask-b-to":J()}],"mask-image-l-from-pos":[{"mask-l-from":Fe()}],"mask-image-l-to-pos":[{"mask-l-to":Fe()}],"mask-image-l-from-color":[{"mask-l-from":J()}],"mask-image-l-to-color":[{"mask-l-to":J()}],"mask-image-x-from-pos":[{"mask-x-from":Fe()}],"mask-image-x-to-pos":[{"mask-x-to":Fe()}],"mask-image-x-from-color":[{"mask-x-from":J()}],"mask-image-x-to-color":[{"mask-x-to":J()}],"mask-image-y-from-pos":[{"mask-y-from":Fe()}],"mask-image-y-to-pos":[{"mask-y-to":Fe()}],"mask-image-y-from-color":[{"mask-y-from":J()}],"mask-image-y-to-color":[{"mask-y-to":J()}],"mask-image-radial":[{"mask-radial":[ge,pe]}],"mask-image-radial-from-pos":[{"mask-radial-from":Fe()}],"mask-image-radial-to-pos":[{"mask-radial-to":Fe()}],"mask-image-radial-from-color":[{"mask-radial-from":J()}],"mask-image-radial-to-color":[{"mask-radial-to":J()}],"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":ae()}],"mask-image-conic-pos":[{"mask-conic":[qe]}],"mask-image-conic-from-pos":[{"mask-conic-from":Fe()}],"mask-image-conic-to-pos":[{"mask-conic-to":Fe()}],"mask-image-conic-from-color":[{"mask-conic-from":J()}],"mask-image-conic-to-color":[{"mask-conic-to":J()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Ve()}],"mask-repeat":[{mask:Ue()}],"mask-size":[{mask:Re()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ge,pe]}],filter:[{filter:["","none",ge,pe]}],blur:[{blur:qt()}],brightness:[{brightness:[qe,ge,pe]}],contrast:[{contrast:[qe,ge,pe]}],"drop-shadow":[{"drop-shadow":["","none",T,po,mo]}],"drop-shadow-color":[{"drop-shadow":J()}],grayscale:[{grayscale:["",qe,ge,pe]}],"hue-rotate":[{"hue-rotate":[qe,ge,pe]}],invert:[{invert:["",qe,ge,pe]}],saturate:[{saturate:[qe,ge,pe]}],sepia:[{sepia:["",qe,ge,pe]}],"backdrop-filter":[{"backdrop-filter":["","none",ge,pe]}],"backdrop-blur":[{"backdrop-blur":qt()}],"backdrop-brightness":[{"backdrop-brightness":[qe,ge,pe]}],"backdrop-contrast":[{"backdrop-contrast":[qe,ge,pe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",qe,ge,pe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[qe,ge,pe]}],"backdrop-invert":[{"backdrop-invert":["",qe,ge,pe]}],"backdrop-opacity":[{"backdrop-opacity":[qe,ge,pe]}],"backdrop-saturate":[{"backdrop-saturate":[qe,ge,pe]}],"backdrop-sepia":[{"backdrop-sepia":["",qe,ge,pe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":H()}],"border-spacing-x":[{"border-spacing-x":H()}],"border-spacing-y":[{"border-spacing-y":H()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ge,pe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[qe,"initial",ge,pe]}],ease:[{ease:["linear","initial",z,ge,pe]}],delay:[{delay:[qe,ge,pe]}],animate:[{animate:["none",B,ge,pe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[G,ge,pe]}],"perspective-origin":[{"perspective-origin":he()}],rotate:[{rotate:St()}],"rotate-x":[{"rotate-x":St()}],"rotate-y":[{"rotate-y":St()}],"rotate-z":[{"rotate-z":St()}],scale:[{scale:mt()}],"scale-x":[{"scale-x":mt()}],"scale-y":[{"scale-y":mt()}],"scale-z":[{"scale-z":mt()}],"scale-3d":["scale-3d"],skew:[{skew:V()}],"skew-x":[{"skew-x":V()}],"skew-y":[{"skew-y":V()}],transform:[{transform:[ge,pe,"","none","gpu","cpu"]}],"transform-origin":[{origin:he()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:me()}],"translate-x":[{"translate-x":me()}],"translate-y":[{"translate-y":me()}],"translate-z":[{"translate-z":me()}],"translate-none":["translate-none"],zoom:[{zoom:[wi,ge,pe]}],accent:[{accent:J()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:J()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ge,pe]}],"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":J()}],"scrollbar-track-color":[{"scrollbar-track":J()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":H()}],"scroll-mx":[{"scroll-mx":H()}],"scroll-my":[{"scroll-my":H()}],"scroll-ms":[{"scroll-ms":H()}],"scroll-me":[{"scroll-me":H()}],"scroll-mbs":[{"scroll-mbs":H()}],"scroll-mbe":[{"scroll-mbe":H()}],"scroll-mt":[{"scroll-mt":H()}],"scroll-mr":[{"scroll-mr":H()}],"scroll-mb":[{"scroll-mb":H()}],"scroll-ml":[{"scroll-ml":H()}],"scroll-p":[{"scroll-p":H()}],"scroll-px":[{"scroll-px":H()}],"scroll-py":[{"scroll-py":H()}],"scroll-ps":[{"scroll-ps":H()}],"scroll-pe":[{"scroll-pe":H()}],"scroll-pbs":[{"scroll-pbs":H()}],"scroll-pbe":[{"scroll-pbe":H()}],"scroll-pt":[{"scroll-pt":H()}],"scroll-pr":[{"scroll-pr":H()}],"scroll-pb":[{"scroll-pb":H()}],"scroll-pl":[{"scroll-pl":H()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ge,pe]}],fill:[{fill:["none",...J()]}],"stroke-w":[{stroke:[qe,Hs,ea,Lp]}],stroke:[{stroke:["none",...J()]}],"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"]}},s1=Ux(a1);function se(...a){return s1(px(a))}var r1=bg();const He={cursor:"▸",on:"●",off:"○",dot:"·",check:"✓",cross:"✗",warn:"!",arrowRight:"→",arrowLeft:"←",chevronDown:"▾",chevronRight:"▸",ellipsis:"…",meterFull:"█",meterEmpty:"░",tabDivider:"│"},ni={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"}},ir={ok:ni.ok.text,warn:ni.warn.text,bad:ni.bad.text,idle:ni.idle.text,accent:ni.accent.text,alt:ni.alt.text,info:ni.info.text},kn=({level:a,className:i})=>d.jsx("span",{"aria-hidden":"true",className:se("select-none leading-none",ir[a],i),children:a==="idle"?He.off:He.on}),rb=({className:a})=>d.jsx("span",{"aria-hidden":"true",className:se("select-none text-tui-faint",a),children:He.dot}),on=({title:a,aside:i,tone:s="accent",className:r,bodyClassName:u,children:f,...m})=>d.jsxs("fieldset",{className:se("tui-panel tui-block relative min-w-0 border border-tui-border bg-tui-base",a?"px-3 pb-3 pt-1":"p-3",r),...m,children:[a?d.jsx("legend",{className:se("flex items-center gap-2 text-tui font-bold",ir[s]),children:d.jsx("span",{children:a})}):null,i?d.jsx("span",{className:"pointer-events-none absolute -top-[10px] right-2 max-w-[60%] truncate bg-tui-base px-1 text-tui-sm text-tui-faint",children:i}):null,d.jsx("div",{className:se("min-w-0",u),children:f})]}),yn=({label:a,labelWidth:i=16,className:s,children:r})=>d.jsxs("div",{className:se("flex items-baseline gap-2 text-tui",s),children:[d.jsx("span",{className:"shrink-0 truncate text-tui-muted",style:{width:`${i}ch`},title:typeof a=="string"?a:void 0,children:a}),d.jsx("span",{className:"min-w-0 flex-1 text-tui-text",children:r})]}),fi=({className:a,label:i})=>i?d.jsxs("div",{className:se("flex items-center gap-2",a),children:[d.jsx("span",{className:"h-px w-3 bg-tui-border-dim","aria-hidden":"true"}),d.jsx("span",{className:"text-tui-sm text-tui-faint",children:i}),d.jsx("span",{className:"h-px flex-1 bg-tui-border-dim","aria-hidden":"true"})]}):d.jsx("div",{className:se("h-px w-full bg-tui-border-dim",a),"aria-hidden":"true"}),o1={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"},ke=({variant:a="default",brackets:i=!0,glyph:s,block:r=!1,className:u,children:f,type:m="button",...h})=>d.jsxs("button",{type:m,className:se("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",o1[a],r&&"w-full",u),...h,children:[i?d.jsx("span",{"aria-hidden":"true",className:"opacity-60",children:"["}):null,s?d.jsx("span",{"aria-hidden":"true",className:"leading-none",children:s}):null,d.jsx("span",{className:"truncate",children:f}),i?d.jsx("span",{"aria-hidden":"true",className:"opacity-60",children:"]"}):null]}),jo=({tone:a="accent",dot:i=!1,className:s,children:r})=>d.jsxs("span",{className:se("inline-flex select-none items-center gap-1 whitespace-nowrap text-tui font-bold uppercase",ir[a],s),children:[i?d.jsx(kn,{level:a}):null,r]}),Ad=({tabs:a,activeId:i,onSelect:s,ariaLabel:r,className:u,labelClassName:f})=>d.jsx("nav",{className:se("flex items-center gap-2",u),"aria-label":r,children:a.map((m,h)=>{const p=m.id===i;return d.jsxs(Ti.Fragment,{children:[h>0?d.jsx("span",{"aria-hidden":"true",className:"select-none text-tui-border",children:He.tabDivider}):null,d.jsxs("button",{type:"button",onClick:()=>s(m.id),"aria-current":p?"page":void 0,"aria-label":m.ariaLabel??m.label,title:m.title,className:se("tui-focusable select-none whitespace-nowrap border-b px-0.5 pb-0.5 text-tui transition-colors",p?"border-tui-accent font-bold text-tui-accent":"border-transparent text-tui-muted hover:border-tui-border-bright hover:text-tui-text"),children:[m.index!==void 0?d.jsx("span",{"aria-hidden":"true",className:se("text-tui-faint",p&&"text-tui-accent"),children:m.index}):null,d.jsx("span",{"aria-hidden":"true",className:se("ml-1",f),children:m.label})]})]},m.id)})}),ob=({hints:a,className:i})=>d.jsx("div",{className:se("flex flex-wrap items-center gap-x-3 gap-y-0.5 text-tui-sm text-tui-faint",i),children:a.map((s,r)=>d.jsxs("span",{className:"flex items-center gap-1",children:[d.jsx("kbd",{className:"border border-tui-border-dim px-1 not-italic text-tui-muted",children:s.keys}),d.jsx("span",{children:s.action})]},`${s.keys}-${r}`))}),vn=({htmlFor:a,hint:i,className:s,children:r})=>d.jsxs("label",{htmlFor:a,className:se("block text-tui-sm font-bold text-tui-muted",s),children:[r,i?d.jsx("span",{className:"ml-2 font-normal text-tui-faint",children:i}):null]}),xn=Ti.forwardRef(({className:a,...i},s)=>d.jsx("input",{ref:s,className:se("tui-input w-full px-2 py-1 text-tui",a),...i}));xn.displayName="Input";const Ro=Ti.forwardRef(({className:a,children:i,...s},r)=>d.jsx("select",{ref:r,className:se("tui-input w-full px-2 py-1 text-tui",a),...s,children:i}));Ro.displayName="Select";const ta=({checked:a,onChange:i,disabled:s=!1,label:r,description:u,className:f,id:m})=>d.jsxs("label",{className:se("group flex cursor-pointer select-none items-start gap-2 py-0.5 text-tui",s&&"cursor-not-allowed opacity-60",f),children:[d.jsx("input",{id:m,type:"checkbox",className:"sr-only",checked:a,disabled:s,onChange:h=>i(h.target.checked)}),d.jsx("span",{"aria-hidden":"true",className:se("mt-px shrink-0 font-bold leading-tight",a?"text-tui-ok":"text-tui-faint",!s&&"group-hover:text-tui-accent"),children:a?"[x]":"[ ]"}),d.jsxs("span",{className:"min-w-0 flex-1",children:[d.jsx("span",{className:se("block",a?"text-tui-text":"text-tui-muted"),children:r}),u?d.jsx("span",{className:"mt-0.5 block text-tui-sm leading-snug text-tui-faint",children:u}):null]})]}),Ks=({checked:a,onChange:i,name:s,disabled:r=!1,label:u,description:f,className:m})=>d.jsxs("label",{className:se("group flex cursor-pointer select-none items-start gap-2 py-0.5 text-tui",r&&"cursor-not-allowed opacity-60",m),children:[d.jsx("input",{type:"radio",name:s,className:"sr-only",checked:a,disabled:r,onChange:i}),d.jsx("span",{"aria-hidden":"true",className:se("mt-px shrink-0 font-bold leading-tight",a?"text-tui-accent":"text-tui-faint",!r&&"group-hover:text-tui-accent"),children:a?"(•)":"( )"}),d.jsxs("span",{className:"min-w-0 flex-1",children:[d.jsx("span",{className:se("block",a?"text-tui-text":"text-tui-muted"),children:u}),f?d.jsx("span",{className:"mt-0.5 block text-tui-sm leading-snug text-tui-faint",children:f}):null]})]}),c1=({value:a,width:i=20,tone:s="accent",className:r})=>{const u=Number.isFinite(a)?Math.min(1,Math.max(0,a)):0,f=Math.round(u*i);return d.jsxs("span",{className:se("inline-flex select-none whitespace-pre font-mono leading-none",r),role:"presentation",children:[d.jsx("span",{className:ir[s],children:He.meterFull.repeat(f)}),d.jsx("span",{className:"text-tui-border",children:He.meterEmpty.repeat(Math.max(0,i-f))})]})},u1={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"},d1=({ratio:a,label:i,tone:s="accent",className:r,...u})=>{const f=Number.isFinite(a)?Math.min(1,Math.max(0,a)):0;return d.jsxs("div",{className:se("relative h-[var(--tui-row)] w-full overflow-hidden border border-tui-border bg-tui-mantle",r),role:"progressbar","aria-valuenow":Math.round(f*100),"aria-valuemin":0,"aria-valuemax":100,...u,children:[d.jsx("div",{className:se("absolute inset-y-0 left-0",u1[s]),style:{width:`${f*100}%`},"aria-hidden":"true"}),i!==void 0?d.jsx("span",{className:"absolute inset-0 flex items-center justify-center whitespace-nowrap px-1 text-tui font-bold text-tui-text mix-blend-difference",children:i}):null]})};function Ed({columns:a,items:i,rowKey:s,empty:r,className:u}){return i.length===0?d.jsx("div",{className:se("px-1 py-4 text-center text-tui text-tui-faint",u),children:r}):d.jsx("div",{className:se("w-full overflow-x-auto",u),children:d.jsxs("table",{className:"w-full border-collapse text-tui",children:[d.jsx("thead",{children:d.jsx("tr",{className:"border-b border-tui-border",children:a.map(f=>d.jsx("th",{scope:"col",style:f.width?{width:`${f.width}ch`}:void 0,className:se("whitespace-nowrap px-2 py-1 text-tui-sm font-bold text-tui-muted",f.align==="right"?"text-right":"text-left",f.className),children:f.header},f.key))})}),d.jsx("tbody",{children:i.map((f,m)=>d.jsx("tr",{className:"border-b border-tui-border-dim last:border-b-0 hover:bg-tui-selection",children:a.map(h=>d.jsx("td",{className:se("px-2 py-1 align-top text-tui-text",h.align==="right"?"text-right":"text-left",h.className),children:h.render(f,m)},h.key))},s(f,m)))})]})})}const Do=({isOpen:a,onClose:i,title:s,subtitle:r,closeLabel:u,footer:f,hints:m,size:h="md",className:p,children:y})=>{if(!a)return null;const b=h==="sm"?"max-w-md":h==="lg"?"max-w-3xl":"max-w-xl",v=`tui-modal-${s.replace(/\s+/g,"-").toLowerCase()}`,S=d.jsx("div",{className:"fixed inset-0 inset-x-0 z-50 flex items-center justify-center overflow-hidden bg-tui-crust/85 p-3 sm:p-6",style:{height:"var(--app-height, 100dvh)",width:"100vw"},role:"dialog","aria-modal":"true","aria-labelledby":v,onMouseDown:T=>{T.target===T.currentTarget&&i()},children:d.jsxs("div",{className:se("relative flex max-h-full w-full flex-col border border-tui-border bg-tui-base",b,p),children:[d.jsxs("header",{className:"flex shrink-0 items-center gap-2 border-b border-tui-border bg-tui-mantle px-3 py-1.5",children:[d.jsx("h2",{id:v,className:"truncate text-tui font-bold text-tui-accent",children:s}),r?d.jsx("span",{className:"min-w-0 flex-1 truncate text-tui-sm text-tui-faint",children:r}):d.jsx("span",{className:"flex-1"}),d.jsx(ke,{variant:"ghost",onClick:i,"aria-label":u,title:u,children:"esc"})]}),d.jsx("div",{className:"relative min-h-0 flex-1 overflow-y-auto overscroll-contain px-3 py-3",children:y}),f||m?d.jsxs("footer",{className:"flex shrink-0 flex-wrap items-center justify-between gap-2 border-t border-tui-border bg-tui-mantle px-3 py-1.5",children:[m?d.jsx(ob,{hints:m}):d.jsx("span",{}),f?d.jsx("div",{className:"flex items-center gap-2",children:f}):null]}):null]})});return typeof document>"u"?S:r1.createPortal(S,document.body)},Zs=({tone:a="accent",className:i,children:s,action:r})=>{const u=a==="ok"?He.check:a==="bad"?He.cross:a==="warn"?He.warn:"›",f=ni[a].edgeL;return d.jsxs("div",{className:se("flex items-start gap-2 border border-tui-border-dim border-l-2 bg-tui-mantle px-2 py-1.5 text-tui",f,i),children:[d.jsx("span",{"aria-hidden":"true",className:se("shrink-0 font-bold",ir[a]),children:u}),d.jsx("div",{className:"min-w-0 flex-1 leading-snug text-tui-text",children:s}),r?d.jsx("div",{className:"shrink-0",children:r}):null]})},Dp=({active:a=!1,className:i,children:s})=>d.jsx("span",{className:se("inline-flex min-w-[2ch] select-none items-center justify-center border px-1 text-tui",a?"border-tui-accent bg-tui-accent text-tui-crust":"border-tui-border bg-tui-surface text-tui-muted",i),children:s}),Op=({items:a,className:i})=>{const s=a.filter(Boolean);return d.jsx("span",{className:se("flex min-w-0 items-center gap-1.5",i),children:s.map((r,u)=>d.jsxs(Ti.Fragment,{children:[u>0?d.jsx(rb,{className:"shrink-0"}):null,r]},u))})},cb=({left:a,right:i,className:s})=>d.jsxs("footer",{className:se("relative flex h-[var(--tui-row)] w-full shrink-0 items-center justify-between gap-3 overflow-visible border-t border-tui-border bg-tui-mantle px-2 text-tui-sm",s),children:[d.jsx("div",{className:"flex min-w-0 items-center gap-1.5 text-tui-muted",children:a}),d.jsx("div",{className:"flex shrink-0 items-center gap-3",children:i})]}),f1=({name:a,tagline:i,aside:s,tabs:r,activeTabId:u,onSelectTab:f,tabsAriaLabel:m,hints:h,footerAside:p,bodyClassName:y,className:b,children:v})=>d.jsxs("div",{className:se("flex h-full min-h-0 w-full flex-col bg-tui-crust",b),children:[d.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:[d.jsxs("span",{className:"flex min-w-0 items-baseline gap-2",children:[d.jsx("span",{className:"shrink-0 font-bold text-tui-accent",children:a}),i?d.jsx("span",{className:"hidden truncate text-tui-sm text-tui-faint sm:block",children:i}):null]}),s?d.jsx("span",{className:"flex shrink-0 items-center gap-2",children:s}):null]}),r&&r.length>0&&u!==void 0&&f?d.jsx("div",{className:"scrollbar-none shrink-0 overflow-x-auto border-b border-tui-border bg-tui-mantle px-2",children:d.jsx(Ad,{tabs:r,activeId:u,onSelect:f,ariaLabel:m,className:"gap-3"})}):null,d.jsx("div",{className:se("min-h-0 flex-1 overflow-y-auto p-2",y),children:v}),h||p?d.jsx(cb,{left:h?d.jsx(ob,{hints:h}):null,right:p}):null]}),zp=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],la=({className:a,label:i})=>{const[s,r]=Ti.useState(0);return Ti.useEffect(()=>{const u=setInterval(()=>r(f=>(f+1)%zp.length),90);return()=>clearInterval(u)},[]),d.jsxs("span",{className:se("inline-flex items-center gap-1.5",a),role:"status",children:[d.jsx("span",{"aria-hidden":"true",className:"text-tui-accent",children:zp[s]}),i?d.jsx("span",{children:i}):null]})},go="tui-focusable select-none border border-transparent px-1.5 text-tui uppercase transition-colors",bo="text-tui-muted hover:border-tui-border hover:text-tui-accent",h1="border-tui-accent bg-tui-accent text-tui-crust",m1=({currentView:a,onNavigate:i,showAdminEntry:s=!0,onOpenPairing:r,onOpenSettings:u,onToggleVirtualKeyboard:f,isVirtualKeyboardOpen:m})=>{const{addToast:h,language:p,setLanguage:y,t:b}=ct(),v=()=>{const T=p==="zh"?"en":"zh";y(T),h("info",Cd(T,"toasts.switchedLanguage",{lang:T==="zh"?"简体中文":"English"}))},S=[{id:"terminal",label:b("header.terminalTab"),index:1,ariaLabel:b("header.terminalTab")},...s||a==="admin"?[{id:"admin",label:b("header.adminTab"),index:2,ariaLabel:b("header.adminTab")}]:[]];return d.jsx("header",{role:"banner",className:"z-30 w-full shrink-0 select-none overflow-hidden border-b border-tui-border bg-tui-mantle px-2 pt-[max(env(safe-area-inset-top,0px),0.125rem)]",children:d.jsxs("div",{className:"scrollbar-none flex min-h-[var(--tui-row)] items-center gap-2 overflow-x-auto text-tui",children:[d.jsxs("span",{className:"flex shrink-0 items-baseline gap-2",children:[d.jsx("span",{className:"font-bold text-tui-accent",children:"herdr-remote"}),d.jsx("span",{className:"hidden text-tui-sm text-tui-faint sm:inline",children:b("header.tagline")})]}),d.jsx("span",{"aria-hidden":"true",className:"h-4 w-px shrink-0 bg-tui-border"}),d.jsx(Ad,{tabs:S,activeId:a,onSelect:T=>i(T),ariaLabel:b("header.mainNavigationAria"),className:"shrink-0 gap-3"}),d.jsx("span",{"aria-hidden":"true",className:"h-4 w-px shrink-0 bg-tui-border"}),d.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[d.jsx("button",{type:"button",onClick:v,className:se(go,bo),title:b("header.languageToggleTitle"),"aria-label":b("header.languageToggleTitle"),children:b("header.languageShort")}),a==="terminal"&&d.jsx("button",{type:"button",onClick:f,className:se(go,m?h1:bo),title:b("header.virtualKeyboardTitle"),"aria-label":b("header.virtualKeyboardTitle"),children:b("header.actionKeyboard")}),d.jsx("button",{type:"button",onClick:r,className:se(go,bo),title:b("header.pairingTitle"),"aria-label":b("header.pairingTitle"),children:b("header.actionPairing")}),d.jsx("button",{type:"button",onClick:u,className:se(go,bo),title:b("header.settingsTitle"),"aria-label":b("header.settingsTitle"),children:b("header.actionSettings")})]})]})})},yo=({tone:a,glyph:i,message:s,assertive:r=!1,action:u})=>d.jsxs("aside",{className:se("flex w-full items-center justify-between gap-3 border-b bg-tui-mantle px-2 py-0.5 text-tui sm:px-3",ni[a].edgeB),"aria-live":r?"assertive":"polite",children:[d.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[d.jsx("span",{"aria-hidden":"true",className:se("shrink-0",ni[a].text),children:i}),d.jsx("span",{className:"truncate text-tui-text",children:s})]}),u]}),p1=()=>{const{connectionState:a,stateDetail:i,connect:s,settings:r,t:u}=ct();return a==="connected"||!r.token&&!r.pairCode&&a==="disconnected"?null:a==="connecting"?d.jsx(yo,{tone:"accent",glyph:d.jsx(la,{}),message:u("statusBanner.connecting")}):a==="reconnecting"?d.jsx(yo,{tone:"warn",glyph:d.jsx(la,{}),assertive:!0,message:i||u("statusBanner.reconnectingDefault"),action:d.jsx(ke,{variant:"warn",onClick:()=>s(),className:"shrink-0",children:u("statusBanner.reconnectNow")})}):a==="error"?d.jsx(yo,{tone:"bad",glyph:He.cross,assertive:!0,message:i||u("statusBanner.errorDefault"),action:d.jsx(ke,{variant:"danger",onClick:()=>s(),className:"shrink-0",children:u("common.retry")})}):a==="disconnected"?d.jsx(yo,{tone:"idle",glyph:He.off,message:u("statusBanner.disconnected"),action:d.jsx(ke,{variant:"primary",onClick:()=>s(),className:"shrink-0",children:u("common.connect")})}):null};var g1=Y0(),b1=I0(),qu={exports:{}},Up;function y1(){return Up||(Up=1,(function(a,i){(function(s,r){a.exports=r()})(self,(()=>(()=>{var s={6:(m,h)=>{function p(b){try{const v=new URL(b),S=v.password&&v.username?`${v.protocol}//${v.username}:${v.password}@${v.host}`:v.username?`${v.protocol}//${v.username}@${v.host}`:`${v.protocol}//${v.host}`;return b.toLocaleLowerCase().startsWith(S.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(h,"__esModule",{value:!0}),h.LinkComputer=h.WebLinkProvider=void 0,h.WebLinkProvider=class{constructor(b,v,S,T={}){this._terminal=b,this._regex=v,this._handler=S,this._options=T}provideLinks(b,v){const S=y.computeLink(b,this._regex,this._terminal,this._handler);v(this._addCallbacks(S))}_addCallbacks(b){return b.map((v=>(v.leave=this._options.leave,v.hover=(S,T)=>{if(this._options.hover){const{range:E}=v;this._options.hover(S,T,E)}},v)))}};class y{static computeLink(v,S,T,E){const G=new RegExp(S.source,(S.flags||"")+"g"),[A,z]=y._getWindowedLineStrings(v-1,T),B=A.join("");let Y;const ae=[];for(;Y=G.exec(B);){const he=Y[0];if(!p(he))continue;const[ee,F]=y._mapStrIdx(T,z,0,Y.index),[H,re]=y._mapStrIdx(T,ee,F,he.length);if(ee===-1||F===-1||H===-1||re===-1)continue;const le={start:{x:F+1,y:ee+1},end:{x:re,y:H+1}};ae.push({range:le,text:he,activate:E})}return ae}static _getWindowedLineStrings(v,S){let T,E=v,G=v,A=0,z="";const B=[];if(T=S.buffer.active.getLine(v)){const Y=T.translateToString(!0);if(T.isWrapped&&Y[0]!==" "){for(A=0;(T=S.buffer.active.getLine(--E))&&A<2048&&(z=T.translateToString(!0),A+=z.length,B.push(z),T.isWrapped&&z.indexOf(" ")===-1););B.reverse()}for(B.push(Y),A=0;(T=S.buffer.active.getLine(++G))&&T.isWrapped&&A<2048&&(z=T.translateToString(!0),A+=z.length,B.push(z),z.indexOf(" ")===-1););}return[B,E]}static _mapStrIdx(v,S,T,E){const G=v.buffer.active,A=G.getNullCell();let z=T;for(;E;){const B=G.getLine(S);if(!B)return[-1,-1];for(let Y=z;Y<B.length;++Y){B.getCell(Y,A);const ae=A.getChars();if(A.getWidth()&&(E-=ae.length||1,Y===B.length-1&&ae==="")){const he=G.getLine(S+1);he&&he.isWrapped&&(he.getCell(0,A),A.getWidth()===2&&(E+=1))}if(E<0)return[S,Y]}S++,z=0}return[S,z]}}h.LinkComputer=y}},r={};function u(m){var h=r[m];if(h!==void 0)return h.exports;var p=r[m]={exports:{}};return s[m](p,p.exports,u),p.exports}var f={};return(()=>{var m=f;Object.defineProperty(m,"__esModule",{value:!0}),m.WebLinksAddon=void 0;const h=u(6),p=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function y(b,v){const S=window.open();if(S){try{S.opener=null}catch{}S.location.href=v}else console.warn("Opening link blocked as opener could not be cleared")}m.WebLinksAddon=class{constructor(b=y,v={}){this._handler=b,this._options=v}activate(b){this._terminal=b;const v=this._options,S=v.urlRegex||p;this._linkProvider=this._terminal.registerLinkProvider(new h.WebLinkProvider(this._terminal,S,this._handler,v))}dispose(){var b;(b=this._linkProvider)==null||b.dispose()}}})(),f})()))})(qu)),qu.exports}var v1=y1();const ub="\x1B",x1=/^\x1b\[[IO]/,db=/^\x1b\[<(\d+);\d+;\d+[Mm]/,w1=/^\x1b\[M[\s\S]{3}/,S1=[/^\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\\/],C1=/^\x1b\[1;[2-8]R/;function Bp(a){if(C1.test(a))return 0;const i=x1.exec(a);if(i)return i[0].length;const s=db.exec(a);if(s){const r=Number(s[1]);return(r&32)!==0&&(r&3)===3&&(r&64)===0?s[0].length:0}for(const r of S1){const u=r.exec(a);if(u)return u[0].length}return 0}function fb(a){if(!a.startsWith(ub))return"keys";if(db.test(a)||w1.test(a)){let s=a;for(;s.length>0;){const r=Bp(s);if(r===0)return"pointer";s=s.slice(r)}return"passive"}let i=a;for(;i.length>0;){const s=Bp(i);if(s===0)return"keys";i=i.slice(s)}return"passive"}function T1(a){return a===ub}const M1=20,A1=6,E1=500,N1=300,Xa=13,hb=.602,mb=1.3;function Xi(a,i){return Number.isFinite(a)&&a>0?a:i}function Hp(a,i,s){return Math.min(s,Math.max(i,a))}function Kp(a){const{width:i,height:s,cellWidth:r,cellHeight:u,minCols:f=M1,minRows:m=A1,maxCols:h=E1,maxRows:p=N1}=a,y=Xi(r,Xa*hb),b=Xi(u,Xa*mb);return{cols:Hp(Math.floor(Xi(i,0)/y),f,h),rows:Hp(Math.floor(Xi(s,0)/b),m,p)}}function na(a,i=Xa){var r,u,f;if(a)try{const m=a._core,h=(f=(u=(r=m==null?void 0:m._renderService)==null?void 0:r.dimensions)==null?void 0:u.css)==null?void 0:f.cell;if(h&&h.width&&h.width>0&&h.height&&h.height>0)return{cellWidth:h.width,cellHeight:h.height,measured:!0}}catch{}const s=Xi(i,Xa);return{cellWidth:Math.round(s*hb*100)/100,cellHeight:Math.round(s*mb*100)/100,measured:!1}}function k1(a){var r;const i=(r=a==null?void 0:a.querySelector)==null?void 0:r.call(a,".xterm-viewport");if(!i)return 0;const s=(i.offsetWidth||0)-(i.clientWidth||0);return Number.isFinite(s)&&s>0?s:0}function Vu(a,i,s){if(!a)return{width:i,height:s};let r=0,u=0;if(typeof a.getBoundingClientRect=="function"){const f=a.getBoundingClientRect();r=(f==null?void 0:f.width)||0,u=(f==null?void 0:f.height)||0}return{width:Xi(r,Xi(a.clientWidth,i)),height:Xi(u,Xi(a.clientHeight,s))}}function pb(a,i,s,r){const u=Number.isFinite(r)&&r>.01?r:1;return{clientX:s.left+(a-s.left)/u,clientY:s.top+(i-s.top)/u}}function Ys(a){var i,s;if(!a)return!1;try{const r=a.modes;if(r&&typeof r.mouseTrackingMode=="string"&&r.mouseTrackingMode!=="none")return!0;const u=a._core;if((i=u==null?void 0:u._coreMouseService)!=null&&i.areMouseEventsActive||(s=u==null?void 0:u.coreMouseService)!=null&&s.areMouseEventsActive||u!=null&&u.mouseMode&&u.mouseMode!=="none")return!0}catch{}return!1}function R1(a,i){const s=i.button??0,r=i.buttons??(a==="mouseup"?0:1);return new MouseEvent(a,{bubbles:!0,cancelable:!0,clientX:i.clientX,clientY:i.clientY,screenX:i.clientX,screenY:i.clientY,button:s,buttons:r})}function Yp(a,i,s){const r=R1(i,s);return a.dispatchEvent(r)}class L1{constructor(i){Z(this,"options");Z(this,"state","idle");Z(this,"startX",0);Z(this,"startY",0);Z(this,"lastX",0);Z(this,"lastY",0);Z(this,"activeTarget",null);Z(this,"longPressTimer",null);Z(this,"capturedPointerId",null);Z(this,"captureElement",null);Z(this,"scrollRemainderY",0);this.options={longPressDelayMs:500,dragThresholdPx:8,scrollLineHeightPx:18,...i}}getState(){return this.state}setGestureState(i){var s,r;this.state!==i&&(this.state=i,(r=(s=this.options).onGestureStateChange)==null||r.call(s,i))}getActiveBuffer(i){var s;try{return((s=i.buffer)==null?void 0:s.active)||null}catch{return null}}getViewportY(i){var r;const s=(r=this.getActiveBuffer(i))==null?void 0:r.viewportY;return typeof s=="number"&&Number.isFinite(s)?s:null}blurTerminal(i){var s;try{(s=i.blur)==null||s.call(i)}catch{}}getLogicalCoordinates(i,s){const r=this.options.getScale?this.options.getScale():1,u=this.options.getSurfaceElement?this.options.getSurfaceElement():null;if(r!==1&&u&&typeof u.getBoundingClientRect=="function"){const f=u.getBoundingClientRect();return pb(i,s,f,r)}return{clientX:i,clientY:s}}getViewportElement(i){var u;const s=this.options.getSurfaceElement?this.options.getSurfaceElement():null;return(s==null?void 0:s.querySelector(".xterm-viewport"))||((u=i.element)==null?void 0:u.querySelector(".xterm-viewport"))||null}isInputLineHit(i,s){var B;const r=(B=s.buffer)==null?void 0:B.active,u=this.options.getSurfaceElement?this.options.getSurfaceElement():null,f=(u==null?void 0:u.querySelector(".xterm-screen"))||s.element||u,m=na(s);if(!f||typeof f.getBoundingClientRect!="function"||m.cellHeight<=0)return!1;const h=f.getBoundingClientRect(),p=this.getLogicalCoordinates(i.clientX,i.clientY),y=h.width>0&&h.height>0;if(![r==null?void 0:r.cursorY,r==null?void 0:r.viewportY,r==null?void 0:r.baseY].every(Y=>typeof Y=="number"&&Number.isFinite(Y)))return!1;const v=r==null?void 0:r.cursorY,S=r==null?void 0:r.viewportY,E=(r==null?void 0:r.baseY)+v-S,G=h.top+E*m.cellHeight,A=G+m.cellHeight,z=Number(s.rows);return E>=0&&(!Number.isFinite(z)||E<z)&&p.clientY>=G-2&&p.clientY<=A+2&&(!y||p.clientX>=h.left&&p.clientX<=h.right)}resolveDispatchTarget(i,s){var h;const r=this.options.getSurfaceElement?this.options.getSurfaceElement():null,u=(r==null?void 0:r.querySelector(".xterm-screen"))||s.querySelector(".xterm-screen")||null,f=((h=u==null?void 0:u.closest)==null?void 0:h.call(u,".xterm"))||null;let m=null;return typeof document<"u"&&typeof document.elementFromPoint=="function"&&(m=document.elementFromPoint(i.clientX,i.clientY)),m&&f&&(m===f||f.contains(m))?m:u||r||s}getMouseReport(i,s){const r=this.options.getSurfaceElement?this.options.getSurfaceElement():null,u=(r==null?void 0:r.querySelector(".xterm-screen"))||s.element;if(!u||typeof u.getBoundingClientRect!="function")return null;const f=u.getBoundingClientRect(),m=this.getLogicalCoordinates(i.clientX,i.clientY),h=na(s);if(h.cellWidth<=0||h.cellHeight<=0)return null;const p=Math.max(1,f.width||s.cols*h.cellWidth),y=Math.max(1,f.height||s.rows*h.cellHeight),b=Math.max(0,Math.min(p-1,m.clientX-f.left)),v=Math.max(0,Math.min(y-1,m.clientY-f.top)),S=Math.max(0,Math.min(s.cols-1,Math.floor(b/h.cellWidth))),T=Math.max(0,Math.min(s.rows-1,Math.floor(v/h.cellHeight)));return{col:S,row:T,x:Math.floor(b),y:Math.floor(v),button:0,action:0}}getCoreMouseService(i){var r,u;const s=i;return s.coreMouseService||((r=s._core)==null?void 0:r.coreMouseService)||((u=s._core)==null?void 0:u._coreMouseService)||null}getCoreService(i){var r;const s=i;return s.coreService||((r=s._core)==null?void 0:r.coreService)||null}getWheelDispatchTarget(i){const s=this.options.getSurfaceElement?this.options.getSurfaceElement():null;return(s==null?void 0:s.querySelector(".xterm"))||i.element||null}dispatchWheel(i,s,r,u){const f=this.getWheelDispatchTarget(r);if(!f||typeof WheelEvent>"u"||s===0)return!1;const m=this.getLogicalCoordinates(i.clientX,i.clientY),h=s<0?-1:1;let p=0;for(let y=0;y<Math.abs(s);y+=1)try{const b=new WheelEvent("wheel",{bubbles:!0,cancelable:!0,clientX:m.clientX,clientY:m.clientY,deltaX:0,deltaY:h,deltaMode:1,ctrlKey:!!(u!=null&&u.ctrlKey),altKey:!!(u!=null&&u.altKey),shiftKey:!!(u!=null&&u.shiftKey)});f.dispatchEvent(b),p+=1}catch{return p>0}return p>0}emitWheel(i,s,r,u){if(s===0)return!1;if(this.dispatchWheel(i,s,r,u))return!0;const f=this.getCoreMouseService(r);if(!(f!=null&&f.triggerMouseEvent))return!1;let m=0;for(let h=0;h<Math.abs(s);h+=1){const p=this.getMouseReport(i,r);p&&(p.button=4,p.action=s<0?0:1,p.ctrl=!!(u!=null&&u.ctrlKey),p.alt=!!(u!=null&&u.altKey),p.shift=!!(u!=null&&u.shiftKey),f.triggerMouseEvent(p)&&(m+=1))}return m>0}scrollAlternateBuffer(i,s,r,u){var m;if(s===0)return"none";const f=Ys(r);if(!f&&!this.options.getIsController())return"none";if(this.emitWheel(i,s,r,u))return f?"application-mouse":"application-keys";if(!f){const h=this.getCoreService(r);if(!(h!=null&&h.triggerDataEvent))return"none";const y=`\x1B${!!((m=h.decPrivateModes)!=null&&m.applicationCursorKeys)?"O":"["}${s<0?"A":"B"}`;return h.triggerDataEvent(y.repeat(Math.abs(s)),!0),"application-keys"}return"none"}emitMouse(i,s,r){const u=this.options.getTerminal();if(!u)return;const f=this.getCoreMouseService(u);if(f!=null&&f.triggerMouseEvent){const h=this.getMouseReport(s,u);h&&(h.action=i==="mousedown"?1:i==="mouseup"?0:32,h.ctrl=!!(r!=null&&r.ctrlKey),h.alt=!!(r!=null&&r.altKey),h.shift=!!(r!=null&&r.shiftKey),f.triggerMouseEvent(h));return}if(this.options.allowSyntheticMouseFallback===!1||!this.activeTarget)return;const m=this.getLogicalCoordinates(s.clientX,s.clientY);Yp(this.activeTarget,i,{clientX:m.clientX,clientY:m.clientY,button:0,buttons:i==="mouseup"?0:1})}beginGesture(i,s){this.startX=i.clientX,this.startY=i.clientY,this.lastX=i.clientX,this.lastY=i.clientY,this.setGestureState("pending"),this.scrollRemainderY=0,this.activeTarget=this.resolveDispatchTarget(i,s),this.clearLongPressTimer(),this.longPressTimer=setTimeout(()=>{var r,u;this.state==="pending"&&(this.setGestureState("longpress"),(u=(r=this.options).onLongPress)==null||u.call(r,{clientX:this.startX,clientY:this.startY}))},this.options.longPressDelayMs)}moveGesture(i,s){var y,b,v,S;if(this.state==="longpress"){(b=(y=this.options).onSelectionExtend)==null||b.call(y,{clientX:i.clientX,clientY:i.clientY}),s!=null&&s.cancelable&&((v=s.preventDefault)==null||v.call(s));return}if(this.state==="idle")return;const r=i.clientX-this.startX,u=i.clientY-this.startY,f=Math.hypot(r,u);if(this.state==="scrolling"){this.scrollGesture(i,s);return}const m=this.options.getTerminal(),h=this.options.getIsController(),p=Ys(m);if(!(f<=(this.options.dragThresholdPx||8))){if(this.clearLongPressTimer(),Math.abs(u)>=Math.abs(r)||!p||!h){this.setGestureState("scrolling"),m&&this.blurTerminal(m),this.lastX=i.clientX,this.lastY=this.startY,this.scrollRemainderY=0,this.scrollGesture(i,s);return}if(p&&h){this.state==="pending"&&(this.setGestureState("dragging"),this.emitMouse("mousedown",{clientX:this.startX,clientY:this.startY},s)),this.state==="dragging"&&(this.lastX=i.clientX,this.lastY=i.clientY,this.emitMouse("mousemove",i,s),s!=null&&s.cancelable&&((S=s.preventDefault)==null||S.call(s)));return}this.lastX=i.clientX,this.lastY=i.clientY}}scrollGesture(i,s){var E,G,A;const r=this.options.getTerminal();if(!r)return;const u=i.clientY-this.lastY;this.lastX=i.clientX,this.lastY=i.clientY;const f=na(r),m=f.measured?f.cellHeight:this.options.scrollLineHeightPx||f.cellHeight||18;this.scrollRemainderY+=u;const h=Math.trunc(this.scrollRemainderY/m),p=-h;let y=!1,b="none";const v=this.getActiveBuffer(r),S=Ys(r);if(p!==0){if((v==null?void 0:v.type)==="alternate")b=this.scrollAlternateBuffer(i,p,r,s),y=b!=="none";else{const z=this.getViewportY(r);r.scrollLines(p);const B=this.getViewportY(r);b="buffer",y=z===null||B===null||z!==B}this.scrollRemainderY-=h*m}const T=this.getViewportElement(r);(G=(E=this.options).onGestureScroll)==null||G.call(E,{deltaY:u,lines:p,viewportY:this.getViewportY(r),scrollTop:(T==null?void 0:T.scrollTop)??null,scrollHeight:(T==null?void 0:T.scrollHeight)??null,clientHeight:(T==null?void 0:T.clientHeight)??null,moved:y,bufferType:(v==null?void 0:v.type)||null,baseY:typeof(v==null?void 0:v.baseY)=="number"?v.baseY:null,cursorY:typeof(v==null?void 0:v.cursorY)=="number"?v.cursorY:null,hasScrollback:typeof(v==null?void 0:v.hasScrollback)=="boolean"?v.hasScrollback:null,mouseTracking:S,scrollMode:b}),s!=null&&s.cancelable&&((A=s.preventDefault)==null||A.call(s))}endGesture(i,s){var m,h,p;this.clearLongPressTimer();const r=this.options.getTerminal(),u=this.options.getIsController(),f=Ys(r);if(this.state==="pending"){if(f&&u){const b={clientX:this.startX,clientY:this.startY};this.emitMouse("mousedown",b,s),this.emitMouse("mouseup",b,s)}const y={clientX:this.startX,clientY:this.startY};u&&r&&this.isInputLineHit(y,r)&&((h=(m=this.options).onFocus)==null||h.call(m))}else if(this.state==="dragging"&&f&&u){const y=i??{clientX:this.lastX,clientY:this.lastY};this.emitMouse("mouseup",y,s),s!=null&&s.cancelable&&((p=s.preventDefault)==null||p.call(s))}this.reset()}handlePointerDown(i,s){if(i.pointerType==="mouse")return!1;if(!i.isPrimary)return this.releasePointerCapture(),this.reset(),!1;if(i.cancelable&&i.preventDefault(),this.beginGesture(i,s),i.pointerType!=="touch")try{typeof s.setPointerCapture=="function"&&(s.setPointerCapture(i.pointerId),this.capturedPointerId=i.pointerId,this.captureElement=s)}catch{}return!0}handlePointerMove(i){i.pointerType==="mouse"||this.state==="idle"||this.moveGesture(i,i)}handlePointerUp(i){i.pointerType==="mouse"||this.state==="idle"||(this.releasePointerCapture(),this.endGesture(i,i))}handlePointerCancel(i){i&&i.pointerType==="mouse"||(this.releasePointerCapture(),this.cancelGesture())}handleTouchStart(i,s){if(i.touches.length!==1){this.reset();return}i.cancelable&&i.preventDefault(),this.beginGesture(i.touches[0],s)}handleTouchMove(i){i.touches.length===1&&this.moveGesture(i.touches[0],i)}handleTouchEnd(i){i.cancelable&&i.preventDefault(),this.endGesture(null,i)}handleTouchCancel(){this.cancelGesture()}cancelGesture(){this.clearLongPressTimer();const i=this.options.getTerminal(),s=this.options.getIsController(),r=Ys(i);if(this.state==="dragging"&&r&&s&&this.activeTarget){const u=this.getLogicalCoordinates(this.lastX,this.lastY);Yp(this.activeTarget,"mouseup",{clientX:u.clientX,clientY:u.clientY,button:0,buttons:0})}this.reset()}releasePointerCapture(){const i=this.captureElement,s=this.capturedPointerId;if(this.captureElement=null,this.capturedPointerId=null,!(!i||s===null))try{typeof i.releasePointerCapture=="function"&&(typeof i.hasPointerCapture!="function"||i.hasPointerCapture(s))&&i.releasePointerCapture(s)}catch{}}clearLongPressTimer(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressTimer=null)}reset(){this.clearLongPressTimer(),this.releasePointerCapture(),this.setGestureState("idle"),this.activeTarget=null}}var en=(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))(en||{}),Nt=(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))(Nt||{}),tn=(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))(tn||{}),ia=(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))(ia||{}),Ga=(a=>(a[a.NONE=0]="NONE",a[a.SINGLE=1]="SINGLE",a[a.DOUBLE=2]="DOUBLE",a[a.CURLY=3]="CURLY",a[a.DOTTED=4]="DOTTED",a[a.DASHED=5]="DASHED",a))(Ga||{});function _1(){return{content:0,fg:0,bg:0,combinedData:"",extended:void 0}}const gb={fg:0,bg:0,ext:0};function bb(a){return a.bg&268435456&&a.extended?a.extended.ext>>>0:0}function j1(a){return a>>>26&7}function D1(a){return a&67108863}function O1(a,i){const s=a.codePointAt(0)??0;return a.length>0&&String.fromCodePoint(s).length===a.length?{content:s|i<<22,combinedData:""}:{content:2097152|i<<22,combinedData:a}}function yb(a){const i=a;return!i||typeof i.fg!="number"||typeof i.bg!="number"?null:{fg:i.fg>>>0,bg:i.bg>>>0,ext:bb(i)}}const vo=new Map;function vb(a){let i=vo.get(a);return i===void 0&&(i=`#${(a&Nt.RGB_MASK).toString(16).padStart(6,"0")}`,vo.size>4096&&vo.clear(),vo.set(a,i)),i}function xb(a,i,s){var r;switch(a&Nt.CM_MASK){case Nt.CM_P16:case Nt.CM_P256:return((r=i.ansi[a&Nt.PCOLOR_MASK])==null?void 0:r.css)??s;case Nt.CM_RGB:return vb(a&Nt.RGB_MASK);default:return s}}function Ip(a,i,s,r){var v;const u=(a&tn.INVERSE)!==0,f=u?i:a,m=u?a:i;let h;const p=f&Nt.CM_MASK;if(p===Nt.CM_P16||p===Nt.CM_P256){let S=f&Nt.PCOLOR_MASK;r&&a&tn.BOLD&&S<8&&(S+=8),h=((v=s.ansi[S])==null?void 0:v.css)??s.foreground.css}else p===Nt.CM_RGB?h=vb(f&Nt.RGB_MASK):h=u?s.background.css:s.foreground.css;const y=m&Nt.CM_MASK,b=y===Nt.CM_DEFAULT?u?s.foreground.css:s.background.css:xb(m,s,s.background.css);return{fg:h,bg:b,bgIsDefault:!u&&y===Nt.CM_DEFAULT}}function xo(a){return(a&tn.BOLD)!==0}function Xu(a){return(a&ia.ITALIC)!==0}function Pu(a){return(a&ia.DIM)!==0}function Zu(a){return(a&tn.INVISIBLE)!==0}/**
|
|
34
|
+
* Box drawing, block element and Powerline glyphs, drawn as shapes rather than
|
|
35
|
+
* taken from the font.
|
|
36
|
+
*
|
|
37
|
+
* Vendored verbatim from @xterm/xterm 5.5.0,
|
|
38
|
+
* src/browser/renderer/shared/CustomGlyphs.ts. The only edits are the one
|
|
39
|
+
* helper it imported, inlined below, and underscores on parameters the strict
|
|
40
|
+
* compiler flags as unused.
|
|
41
|
+
*
|
|
42
|
+
* Copyright (c) 2021 The xterm.js authors. All rights reserved.
|
|
43
|
+
* @license MIT
|
|
44
|
+
*/function Gp(a){if(!a)throw new Error("value must not be falsy");return a}const z1={"▀":[{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}]},U1={"░":[[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]]},B1={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(a,i)=>`M0,${.5-i} L1,${.5-i} M0,${.5+i} L1,${.5+i}`},"║":{1:(a,i)=>`M${.5-a},0 L${.5-a},1 M${.5+a},0 L${.5+a},1`},"╒":{1:(a,i)=>`M.5,1 L.5,${.5-i} L1,${.5-i} M.5,${.5+i} L1,${.5+i}`},"╓":{1:(a,i)=>`M${.5-a},1 L${.5-a},.5 L1,.5 M${.5+a},.5 L${.5+a},1`},"╔":{1:(a,i)=>`M1,${.5-i} L${.5-a},${.5-i} L${.5-a},1 M1,${.5+i} L${.5+a},${.5+i} L${.5+a},1`},"╕":{1:(a,i)=>`M0,${.5-i} L.5,${.5-i} L.5,1 M0,${.5+i} L.5,${.5+i}`},"╖":{1:(a,i)=>`M${.5+a},1 L${.5+a},.5 L0,.5 M${.5-a},.5 L${.5-a},1`},"╗":{1:(a,i)=>`M0,${.5+i} L${.5-a},${.5+i} L${.5-a},1 M0,${.5-i} L${.5+a},${.5-i} L${.5+a},1`},"╘":{1:(a,i)=>`M.5,0 L.5,${.5+i} L1,${.5+i} M.5,${.5-i} L1,${.5-i}`},"╙":{1:(a,i)=>`M1,.5 L${.5-a},.5 L${.5-a},0 M${.5+a},.5 L${.5+a},0`},"╚":{1:(a,i)=>`M1,${.5-i} L${.5+a},${.5-i} L${.5+a},0 M1,${.5+i} L${.5-a},${.5+i} L${.5-a},0`},"╛":{1:(a,i)=>`M0,${.5+i} L.5,${.5+i} L.5,0 M0,${.5-i} L.5,${.5-i}`},"╜":{1:(a,i)=>`M0,.5 L${.5+a},.5 L${.5+a},0 M${.5-a},.5 L${.5-a},0`},"╝":{1:(a,i)=>`M0,${.5-i} L${.5-a},${.5-i} L${.5-a},0 M0,${.5+i} L${.5+a},${.5+i} L${.5+a},0`},"╞":{1:(a,i)=>`M.5,0 L.5,1 M.5,${.5-i} L1,${.5-i} M.5,${.5+i} L1,${.5+i}`},"╟":{1:(a,i)=>`M${.5-a},0 L${.5-a},1 M${.5+a},0 L${.5+a},1 M${.5+a},.5 L1,.5`},"╠":{1:(a,i)=>`M${.5-a},0 L${.5-a},1 M1,${.5+i} L${.5+a},${.5+i} L${.5+a},1 M1,${.5-i} L${.5+a},${.5-i} L${.5+a},0`},"╡":{1:(a,i)=>`M.5,0 L.5,1 M0,${.5-i} L.5,${.5-i} M0,${.5+i} L.5,${.5+i}`},"╢":{1:(a,i)=>`M0,.5 L${.5-a},.5 M${.5-a},0 L${.5-a},1 M${.5+a},0 L${.5+a},1`},"╣":{1:(a,i)=>`M${.5+a},0 L${.5+a},1 M0,${.5+i} L${.5-a},${.5+i} L${.5-a},1 M0,${.5-i} L${.5-a},${.5-i} L${.5-a},0`},"╤":{1:(a,i)=>`M0,${.5-i} L1,${.5-i} M0,${.5+i} L1,${.5+i} M.5,${.5+i} L.5,1`},"╥":{1:(a,i)=>`M0,.5 L1,.5 M${.5-a},.5 L${.5-a},1 M${.5+a},.5 L${.5+a},1`},"╦":{1:(a,i)=>`M0,${.5-i} L1,${.5-i} M0,${.5+i} L${.5-a},${.5+i} L${.5-a},1 M1,${.5+i} L${.5+a},${.5+i} L${.5+a},1`},"╧":{1:(a,i)=>`M.5,0 L.5,${.5-i} M0,${.5-i} L1,${.5-i} M0,${.5+i} L1,${.5+i}`},"╨":{1:(a,i)=>`M0,.5 L1,.5 M${.5-a},.5 L${.5-a},0 M${.5+a},.5 L${.5+a},0`},"╩":{1:(a,i)=>`M0,${.5+i} L1,${.5+i} M0,${.5-i} L${.5-a},${.5-i} L${.5-a},0 M1,${.5-i} L${.5+a},${.5-i} L${.5+a},0`},"╪":{1:(a,i)=>`M.5,0 L.5,1 M0,${.5-i} L1,${.5-i} M0,${.5+i} L1,${.5+i}`},"╫":{1:(a,i)=>`M0,.5 L1,.5 M${.5-a},0 L${.5-a},1 M${.5+a},0 L${.5+a},1`},"╬":{1:(a,i)=>`M0,${.5+i} L${.5-a},${.5+i} L${.5-a},1 M1,${.5+i} L${.5+a},${.5+i} L${.5+a},1 M0,${.5-i} L${.5-a},${.5-i} L${.5-a},0 M1,${.5-i} L${.5+a},${.5-i} L${.5+a},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(a,i)=>`M.5,1 L.5,${.5+i/.15*.5} C.5,${.5+i/.15*.5},.5,.5,1,.5`},"╮":{1:(a,i)=>`M.5,1 L.5,${.5+i/.15*.5} C.5,${.5+i/.15*.5},.5,.5,0,.5`},"╯":{1:(a,i)=>`M.5,0 L.5,${.5-i/.15*.5} C.5,${.5-i/.15*.5},.5,.5,0,.5`},"╰":{1:(a,i)=>`M.5,0 L.5,${.5-i/.15*.5} C.5,${.5-i/.15*.5},.5,.5,1,.5`}},nr={"":{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}};nr[""]=nr[""];nr[""]=nr[""];function H1(a,i,s,r,u,f,m,h){const p=z1[i];if(p)return K1(a,p,s,r,u,f),!0;const y=U1[i];if(y)return Y1(a,y,s,r,u,f),!0;const b=B1[i];if(b)return I1(a,b,s,r,u,f,h),!0;const v=nr[i];return v?(G1(a,v,s,r,u,f,m,h),!0):!1}function K1(a,i,s,r,u,f){for(let m=0;m<i.length;m++){const h=i[m],p=u/8,y=f/8;a.fillRect(s+h.x*p,r+h.y*y,h.w*p,h.h*y)}}const $p=new Map;function Y1(a,i,s,r,u,f){let m=$p.get(i);m||(m=new Map,$p.set(i,m));const h=a.fillStyle;if(typeof h!="string")throw new Error(`Unexpected fillStyle type "${h}"`);let p=m.get(h);if(!p){const y=i[0].length,b=i.length,v=a.canvas.ownerDocument.createElement("canvas");v.width=y,v.height=b;const S=Gp(v.getContext("2d")),T=new ImageData(y,b);let E,G,A,z;if(h.startsWith("#"))E=parseInt(h.slice(1,3),16),G=parseInt(h.slice(3,5),16),A=parseInt(h.slice(5,7),16),z=h.length>7&&parseInt(h.slice(7,9),16)||1;else if(h.startsWith("rgba"))[E,G,A,z]=h.substring(5,h.length-1).split(",").map(B=>parseFloat(B));else throw new Error(`Unexpected fillStyle color format "${h}" when drawing pattern glyph`);for(let B=0;B<b;B++)for(let Y=0;Y<y;Y++)T.data[(B*y+Y)*4]=E,T.data[(B*y+Y)*4+1]=G,T.data[(B*y+Y)*4+2]=A,T.data[(B*y+Y)*4+3]=i[B][Y]*(z*255);S.putImageData(T,0,0),p=Gp(a.createPattern(v,null)),m.set(h,p)}a.fillStyle=p,a.fillRect(s,r,u,f)}function I1(a,i,s,r,u,f,m){a.strokeStyle=a.fillStyle;for(const[h,p]of Object.entries(i)){a.beginPath(),a.lineWidth=m*Number.parseInt(h);let y;if(typeof p=="function"){const v=.15/f*u;y=p(.15,v)}else y=p;for(const b of y.split(" ")){const v=b[0],S=wb[v];if(!S){console.error(`Could not find drawing instructions for "${v}"`);continue}const T=b.substring(1).split(",");!T[0]||!T[1]||S(a,Sb(T,u,f,s,r,!0,m))}a.stroke(),a.closePath()}}function G1(a,i,s,r,u,f,m,h){const p=new Path2D;p.rect(s,r,u,f),a.clip(p),a.beginPath();const y=m/12;a.lineWidth=h*y;for(const b of i.d.split(" ")){const v=b[0],S=wb[v];if(!S){console.error(`Could not find drawing instructions for "${v}"`);continue}const T=b.substring(1).split(",");!T[0]||!T[1]||S(a,Sb(T,u,f,s,r,!1,h,(i.leftPadding??0)*(y/2),(i.rightPadding??0)*(y/2)))}i.type===1?(a.strokeStyle=a.fillStyle,a.stroke()):a.fill(),a.closePath()}function Fp(a,i,s=0){return Math.max(Math.min(a,i),s)}const wb={C:(a,i)=>a.bezierCurveTo(i[0],i[1],i[2],i[3],i[4],i[5]),L:(a,i)=>a.lineTo(i[0],i[1]),M:(a,i)=>a.moveTo(i[0],i[1])};function Sb(a,i,s,r,u,f,m,h=0,p=0){const y=a.map(b=>parseFloat(b)||parseInt(b));if(y.length<2)throw new Error("Too few arguments for instruction");for(let b=0;b<y.length;b+=2)y[b]*=i-h*m-p*m,f&&y[b]!==0&&(y[b]=Fp(Math.round(y[b]+.5)-.5,i,0)),y[b]+=r+h*m;for(let b=1;b<y.length;b+=2)y[b]*=s,f&&y[b]!==0&&(y[b]=Fp(Math.round(y[b]+.5)-.5,s,0)),y[b]+=u;return y}const hd=.5,$1=1024,F1=6;function q1(a){return/Firefox\//.test(a)||/Edge\/\d/.test(a)?"bottom":"ideographic"}class V1{constructor(i,s=typeof navigator<"u"?navigator.userAgent:""){Z(this,"pages",[]);Z(this,"slots",new Map);Z(this,"inkCache",new Map);Z(this,"metrics",null);Z(this,"font",null);Z(this,"baseline");Z(this,"generation",0);Z(this,"scratch");this.document=i,this.baseline=q1(s)}configure(i,s){const r=this.metrics&&this.font&&this.metrics.cellWidth===i.cellWidth&&this.metrics.cellHeight===i.cellHeight&&this.metrics.charWidth===i.charWidth&&this.metrics.charHeight===i.charHeight&&this.metrics.charLeft===i.charLeft&&this.metrics.charTop===i.charTop&&this.metrics.dpr===i.dpr&&this.font.fontFamily===s.fontFamily&&this.font.fontSize===s.fontSize&&this.font.fontWeight===s.fontWeight&&this.font.fontWeightBold===s.fontWeightBold&&this.font.customGlyphs===s.customGlyphs;this.metrics={...i},this.font={...s},r||this.clear()}clear(){this.slots.clear(),this.inkCache.clear();for(const i of this.pages)i.shelfX=0,i.shelfY=0;this.generation++}dispose(){this.slots.clear(),this.inkCache.clear();for(const i of this.pages)i.canvas.width=0,i.canvas.height=0;this.pages=[]}get pageCount(){return this.pages.length}fontString(i,s){const r=this.font,u=i?r.fontWeightBold:r.fontWeight;return`${s?"italic ":""}${u} ${r.fontSize*this.metrics.dpr}px ${r.fontFamily}`}overflow(i,s,r){if(!this.metrics||!this.font||i.length===1&&i.charCodeAt(0)<128)return 0;const u=`${s?1:0}${r?1:0}${i}`,f=this.inkCache.get(u);if(f!==void 0)return f;let m=0;const h=this.scratchContext();if(h&&!(this.font.customGlyphs&&Cb(i))){h.font=this.fontString(s,r),h.textBaseline=this.baseline;const p=h.measureText(i),y=typeof p.actualBoundingBoxRight=="number"?p.actualBoundingBoxRight:p.width;m=Math.max(0,Math.ceil(this.metrics.charLeft+y-this.metrics.cellWidth))}return this.inkCache.set(u,m),m}get(i){const s=this.metrics,r=this.font;if(!s||!r||s.cellWidth<=0||s.cellHeight<=0)return null;const u=`${i.cells}${i.bold?1:0}${i.italic?1:0}${i.dim?1:0}${i.fg}\0${i.bg}\0${i.chars}`,f=this.slots.get(u);if(f)return f;const m=s.cellWidth*i.cells,h=s.cellHeight,p=this.allocate(m,h);if(!p)return null;const{page:y,x:b,y:v}=p,S=y.ctx;S.save(),S.beginPath(),S.rect(b,v,m,h),S.clip(),S.globalAlpha=1,S.fillStyle=i.bg,S.fillRect(b,v,m,h),S.fillStyle=i.fg,i.dim&&(S.globalAlpha=hd);let T=!1;r.customGlyphs&&(T=H1(S,i.chars,b,v,s.cellWidth,s.cellHeight,r.fontSize,s.dpr)),T||(S.font=this.fontString(i.bold,i.italic),S.textBaseline=this.baseline,S.fillText(i.chars,b+s.charLeft,v+s.charTop+s.charHeight)),S.restore();const E={source:y.canvas,x:b,y:v,width:m,height:h};return this.slots.set(u,E),E}allocate(i,s){for(const r of this.pages){const u=this.fit(r,i,s);if(u)return u}if(this.pages.length<F1){const r=this.createPage(Math.max($1,i,s));return r?(this.pages.push(r),this.fit(r,i,s)):null}return this.clear(),this.pages[0]?this.fit(this.pages[0],i,s):null}fit(i,s,r){if(i.shelfX+s>i.canvas.width&&(i.shelfX=0,i.shelfY+=r),i.shelfY+r>i.canvas.height||s>i.canvas.width)return null;const u={page:i,x:i.shelfX,y:i.shelfY};return i.shelfX+=s,u}createPage(i){const s=this.document.createElement("canvas");s.width=i,s.height=i;const r=s.getContext("2d",{alpha:!1});return r?{canvas:s,ctx:r,shelfX:0,shelfY:0}:null}scratchContext(){if(this.scratch===void 0){const i=this.document.createElement("canvas");i.width=1,i.height=1,this.scratch=i.getContext("2d")}return this.scratch}}function Cb(a){if(a.length!==1)return!1;const i=a.charCodeAt(0);return i>=9472&&i<=9631||i>=57504&&i<=57558}function X1(a){var s,r,u,f;const i=a._core;return!i||!i.screenElement||!i.coreService||!((s=i.optionsService)!=null&&s.rawOptions)||!((r=i._bufferService)!=null&&r.buffer)||!i._charSizeService||!i._coreBrowserService||!((u=i._themeService)!=null&&u.colors)||typeof((f=i._renderService)==null?void 0:f.setRenderer)!="function"?null:i}const P1=150,Z1=600,wo=4294967295;function Q1(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}}class W1{constructor(){Z(this,"listeners",new Set);Z(this,"event",i=>(this.listeners.add(i),{dispose:()=>this.listeners.delete(i)}))}fire(i){for(const s of[...this.listeners])s(i)}dispose(){this.listeners.clear()}}class Nd{constructor(i,s){Z(this,"dimensions",Q1());Z(this,"redraw",new W1);Z(this,"onRequestRedraw",this.redraw.event);Z(this,"stats",{frames:0,heldFrames:0,lastPaintMs:0,lastCells:0,lastInputToPaintMs:null});Z(this,"canvas");Z(this,"ctx");Z(this,"decorCanvas");Z(this,"decorCtx");Z(this,"atlas");Z(this,"disposables",[]);Z(this,"now");Z(this,"maxSyncHoldMs");Z(this,"cols",0);Z(this,"rows",0);Z(this,"painted",{content:new Uint32Array(0),fg:new Uint32Array(0),bg:new Uint32Array(0),ext:new Uint32Array(0),meta:new Uint32Array(0),combined:[]});Z(this,"row",{content:new Uint32Array(0),fg:new Uint32Array(0),bg:new Uint32Array(0),ext:new Uint32Array(0),combined:[]});Z(this,"work",_1());Z(this,"overlayProvider",null);Z(this,"paintedOverlayRows",new Set);Z(this,"paintedCursorRow",-1);Z(this,"lastYdisp",0);Z(this,"holdStartedAt",null);Z(this,"held",null);Z(this,"holdTimer",null);Z(this,"selection",null);Z(this,"link",null);Z(this,"inputAt",null);Z(this,"blinkVisible",!0);Z(this,"blinkTimer",null);Z(this,"disposed",!1);Z(this,"isSynchronizing");Z(this,"dprUsed",0);this.core=i,this.now=s.now??(()=>performance.now()),this.maxSyncHoldMs=s.maxSyncHoldMs??P1,this.isSynchronizing=s.isSynchronizing??(()=>!1);const r=i._coreBrowserService.mainDocument,u=i.screenElement;this.canvas=r.createElement("canvas"),this.canvas.classList.add("xterm-text-layer"),this.canvas.style.zIndex="0";const f=this.canvas.getContext("2d",{alpha:!1});if(!f)throw new Error("2D canvas unavailable");this.ctx=f,this.decorCanvas=r.createElement("canvas"),this.decorCanvas.classList.add("xterm-decor-layer"),this.decorCanvas.style.zIndex="2";const m=this.decorCanvas.getContext("2d");if(!m)throw new Error("2D canvas unavailable");this.decorCtx=m,u.appendChild(this.canvas),u.appendChild(this.decorCanvas),this.atlas=new V1(r),this.disposables.push(i._themeService.onChangeColors(()=>{this.atlas.clear(),this.invalidateAll(),this.redrawDecor()}),i.optionsService.onOptionChange(h=>{(h==="cursorBlink"||h==="cursorStyle")&&this.restartBlink()})),i.linkifier&&this.disposables.push(i.linkifier.onShowLinkUnderline(h=>{this.link=h,this.redrawDecor()}),i.linkifier.onHideLinkUnderline(()=>{this.link=null,this.redrawDecor()})),this.observeDevicePixels(),this.observeFonts(r),this.restartBlink()}static install(i,s={}){const r=X1(i);if(!r)return null;const u=new Nd(r,s);return r._renderService.setRenderer(u),r._renderService.handleResize(r._bufferService.cols,r._bufferService.rows),u}setOverlayProvider(i){this.overlayProvider=i,this.invalidateOverlay()}invalidateOverlay(){var r;const i=((r=this.overlayProvider)==null?void 0:r.call(this))??null,s=new Set(this.paintedOverlayRows);for(const u of J1(i))s.add(u);this.paintedCursorRow>=0&&s.add(this.paintedCursorRow+this.buffer().ydisp),this.requestAbsoluteRows(s)}markInput(){this.inputAt=this.now()}flushHeld(){if(!this.held)return;const{start:i,end:s}=this.held;this.redraw.fire({start:i,end:s})}handleDevicePixelRatioChange(){this.dimensions.device.cell.width&&this.dprUsed!==this.core._coreBrowserService.dpr&&this.handleResize(this.core._bufferService.cols,this.core._bufferService.rows)}handleResize(i,s){this.updateDimensions(i,s);const r=this.dimensions;for(const f of[this.canvas,this.decorCanvas])f.width=r.device.canvas.width,f.height=r.device.canvas.height,f.style.width=`${r.css.canvas.width}px`,f.style.height=`${r.css.canvas.height}px`;const u=this.core.screenElement;u&&(u.style.width=`${r.css.canvas.width}px`,u.style.height=`${r.css.canvas.height}px`),this.resizeGrid(i,s),this.configureAtlas(),this.fillBackground(),this.redrawDecor()}handleCharSizeChanged(){this.handleResize(this.core._bufferService.cols,this.core._bufferService.rows)}handleBlur(){this.stopBlink(),this.requestCursorRow(),this.redrawDecor()}handleFocus(){this.restartBlink(),this.requestCursorRow(),this.redrawDecor()}handleSelectionChanged(i,s,r){this.selection=i&&s&&!(i[0]===s[0]&&i[1]===s[1])?{start:[i[0],i[1]],end:[s[0],s[1]],columnSelectMode:r}:null,this.redrawDecor()}handleCursorMove(){this.blinkTimer&&this.restartBlink()}clear(){this.invalidateAll(),this.fillBackground()}clearTextureAtlas(){this.atlas.clear(),this.invalidateAll(),this.redraw.fire({start:0,end:Math.max(0,this.rows-1)})}renderRows(i,s){if(!(this.disposed||!this.cols||!this.rows||!this.dimensions.device.cell.width)){if(this.isSynchronizing()){const r=this.now();if(this.holdStartedAt===null&&(this.holdStartedAt=r),r-this.holdStartedAt<this.maxSyncHoldMs){this.held=this.held?{start:Math.min(this.held.start,i),end:Math.max(this.held.end,s)}:{start:i,end:s},this.stats.heldFrames++,this.holdTimer||(this.holdTimer=setTimeout(()=>{this.holdTimer=null,this.flushHeld()},this.maxSyncHoldMs));return}}this.held&&(i=Math.min(i,this.held.start),s=Math.max(s,this.held.end)),this.held=null,this.holdStartedAt=null,this.holdTimer&&(clearTimeout(this.holdTimer),this.holdTimer=null),this.paint(Math.max(0,i),Math.min(this.rows-1,s))}}dispose(){if(!this.disposed){this.disposed=!0,this.stopBlink(),this.holdTimer&&clearTimeout(this.holdTimer);for(const i of this.disposables)i.dispose();this.disposables.length=0,this.redraw.dispose(),this.atlas.dispose(),this.canvas.remove(),this.decorCanvas.remove()}}uninstall(){const i=this.core._createRenderer;typeof i=="function"&&(this.core._renderService.setRenderer(i.call(this.core)),this.core._renderService.handleResize(this.core._bufferService.cols,this.core._bufferService.rows)),this.dispose()}get textCanvas(){return this.canvas}paint(i,s){var v;const r=this.now(),f=this.buffer().ydisp;f!==this.lastYdisp&&(this.lastYdisp=f,this.redrawDecor());const m=((v=this.overlayProvider)==null?void 0:v.call(this))??null,h=new Map;for(const S of(m==null?void 0:m.cells)??[]){const T=h.get(S.row);T?T.push(S):h.set(S.row,[S])}const p=this.cursorState(m),y=new Set;for(let S=i;S<=s;S++)y.add(S);for(const S of this.paintedOverlayRows)So(y,S-f,this.rows);for(const S of h.keys())So(y,S-f,this.rows);this.paintedCursorRow>=0&&So(y,this.paintedCursorRow,this.rows),p&&So(y,p.y,this.rows);let b=0;for(const S of y)this.loadRow(S,f,h.get(S+f)),b+=this.paintRow(S,p);this.paintedOverlayRows=new Set(h.keys()),this.paintedCursorRow=p?p.y:-1,this.stats.frames++,this.stats.lastCells=b,this.stats.lastPaintMs=this.now()-r,this.inputAt!==null&&b>0&&(this.stats.lastInputToPaintMs=this.now()-this.inputAt,this.inputAt=null)}loadRow(i,s,r){const{content:u,fg:f,bg:m,ext:h,combined:p}=this.row,y=this.buffer().lines.get(s+i),b=this.work;for(let v=0;v<this.cols;v++)y&&v<y.length?(y.loadCell(v,b),u[v]=b.content,f[v]=b.fg,m[v]=b.bg,h[v]=bb(b),p[v]=b.content&en.IS_COMBINED_MASK?b.combinedData:""):(u[v]=1<<en.WIDTH_SHIFT,f[v]=0,m[v]=0,h[v]=0,p[v]="");if(r)for(const v of r){const S=v.col;if(S<0||S+v.width>this.cols)continue;S>0&&!(u[S]>>>en.WIDTH_SHIFT)&&this.blankAt(S-1);const T=S+v.width;T<this.cols&&!(u[T]>>>en.WIDTH_SHIFT)&&u[T-1]>>>en.WIDTH_SHIFT===2&&this.blankAt(T);const E=O1(v.chars,v.width);u[S]=E.content,p[S]=E.combinedData,f[S]=v.style.fg,m[S]=v.style.bg,h[S]=v.style.ext,v.width===2&&(u[S+1]=0,p[S+1]="",f[S+1]=v.style.fg,m[S+1]=v.style.bg,h[S+1]=v.style.ext)}}blankAt(i){this.row.content[i]=32|1<<en.WIDTH_SHIFT,this.row.combined[i]=""}paintRow(i,s){const r=this.cols,{content:u,fg:f,bg:m,ext:h,combined:p}=this.row,y=this.painted,b=i*r;let v=0,S=-1,T=-1,E="";const G=()=>{S<0||(this.fillCells(S,i,T-S,E),S=-1)};let A=0;for(;A<r;){let B=u[A]>>>en.WIDTH_SHIFT;B===0&&(B=1),A+B>r&&(B=r-A),B===1&&A+1<r&&this.overflowsInto(A)&&(B=2);const Y=s&&s.y===i&&s.x>=A&&s.x<A+B?s.shape:0,ae=B|Y<<3;let he=this.differs(b+A,A,ae);for(let ee=1;ee<B;ee++)this.differs(b+A+ee,A+ee,4)&&(he=!0);if(he){for(let F=0;F<B;F++){const H=b+A+F;y.content[H]=u[A+F],y.fg[H]=f[A+F],y.bg[H]=m[A+F],y.ext[H]=h[A+F],y.meta[H]=F===0?ae:4,y.combined[H]=p[A+F]}v+=B;const ee=this.plainFill(A,Y);ee!==null?S>=0&&T===A&&E===ee?T=A+B:(G(),S=A,T=A+B,E=ee):(G(),this.paintCell(A,i,B,Y))}A+=B}return G(),v}differs(i,s,r){const u=this.painted,f=this.row;return u.meta[i]!==r||u.content[i]!==f.content[s]||u.fg[i]!==f.fg[s]||u.bg[i]!==f.bg[s]||u.ext[i]!==f.ext[s]||u.combined[i]!==f.combined[s]}overflowsInto(i){const{content:s,fg:r,bg:u,ext:f}=this.row,m=s[i];if((m&en.CODEPOINT_MASK)<128&&!(m&en.IS_COMBINED_MASK)||m>>>en.WIDTH_SHIFT!==1||Zu(r[i]))return!1;const p=s[i+1],y=p&en.CODEPOINT_MASK;if(p>>>en.WIDTH_SHIFT!==1||p&en.IS_COMBINED_MASK||y!==0&&y!==32||u[i]!==u[i+1]||f[i+1]!==0||(r[i]&tn.INVERSE)!==(r[i+1]&tn.INVERSE)||r[i]&tn.INVERSE&&r[i]!==r[i+1]||r[i+1]&(tn.UNDERLINE|tn.STRIKETHROUGH)||u[i+1]&ia.OVERLINE)return!1;const b=this.charsAt(i);return this.core.optionsService.rawOptions.customGlyphs!==!1&&Cb(b)?!1:this.atlas.overflow(b,xo(r[i]),Xu(u[i]))>0}charsAt(i){const s=this.row.content[i];if(s&en.IS_COMBINED_MASK)return this.row.combined[i];const r=s&en.CODEPOINT_MASK;return r?String.fromCodePoint(r):""}plainFill(i,s){if(s!==0)return null;const{content:r,fg:u,bg:f}=this.row,m=r[i],h=m&en.CODEPOINT_MASK,p=!(m&en.IS_COMBINED_MASK)&&(h===0||h===32),y=Zu(u[i]);return!p&&!y||(u[i]&(tn.UNDERLINE|tn.STRIKETHROUGH)||f[i]&ia.OVERLINE)&&!y?null:Ip(u[i],f[i],this.colors(),this.boldBright()).bg}paintCell(i,s,r,u){const f=this.ctx,m=this.dimensions.device,h=this.colors(),p=this.row.fg[i],y=this.row.bg[i],b=this.row.ext[i],v=Ip(p,y,h,this.boldBright());let S=v.fg,T=v.bg;u===1&&(T=h.cursor.css,S=h.cursorAccent.css);const E=Zu(p),G=this.charsAt(i),A=i*m.cell.width,z=s*m.cell.height,B=r*m.cell.width,Y=m.cell.height,ae=E||G===""||G===" ",he=ae?null:this.atlas.get({chars:G,bold:xo(p),italic:Xu(y),dim:Pu(y),fg:S,bg:T,cells:r});he?f.drawImage(he.source,he.x,he.y,he.width,he.height,A,z,B,Y):(f.fillStyle=T,f.fillRect(A,z,B,Y),ae||(f.save(),f.beginPath(),f.rect(A,z,B,Y),f.clip(),f.fillStyle=S,Pu(y)&&(f.globalAlpha=hd),f.font=this.atlas.fontString(xo(p),Xu(y)),f.fillText(G,A+m.char.left,z+m.char.top+m.char.height),f.restore())),E||this.paintDecorations(A,z,r,p,y,b,S),u!==0&&u!==1&&this.paintCursorShape(A,z,B,u)}paintDecorations(i,s,r,u,f,m,h){const p=(u&tn.UNDERLINE)!==0,y=(u&tn.STRIKETHROUGH)!==0,b=(f&ia.OVERLINE)!==0;if(!p&&!y&&!b)return;const v=this.ctx,S=this.dimensions.device,T=this.core.optionsService.rawOptions,E=this.core._coreBrowserService.dpr,G=r*S.cell.width;v.save(),v.beginPath(),v.rect(i,s,G,S.cell.height),v.clip(),Pu(f)&&(v.globalAlpha=hd);const A=Math.max(1,Math.floor(T.fontSize*E/15)),z=A%2===1?.5:0;if(p){const B=D1(m);let Y=h;if(B){let ee=B;this.boldBright()&&xo(u)&&(ee&50331648)!==50331648&&(ee&255)<8&&(ee+=8),Y=xb(ee,this.colors(),h)}v.strokeStyle=Y,v.lineWidth=A;const ae=s+S.char.top+Math.ceil(S.char.height)-z-A*2,he=m?j1(m):Ga.SINGLE;switch(v.beginPath(),he){case Ga.DOUBLE:v.moveTo(i,ae),v.lineTo(i+G,ae),v.moveTo(i,ae+A*2),v.lineTo(i+G,ae+A*2);break;case Ga.CURLY:{const ee=ae+A,F=Math.max(1,A);for(let H=0;H<r;H++){const re=i+H*S.cell.width,le=re+S.cell.width/2,ye=re+S.cell.width;v.moveTo(re,ee),v.bezierCurveTo(re,ee-F,le,ee-F,le,ee),v.bezierCurveTo(le,ee+F,ye,ee+F,ye,ee)}break}case Ga.DOTTED:v.setLineDash([A,A]),v.moveTo(i,ae),v.lineTo(i+G,ae);break;case Ga.DASHED:{const ee=Math.floor(.6*S.cell.width),F=Math.floor(.3*S.cell.width);v.setLineDash([ee,F,S.cell.width-ee-F]),v.moveTo(i,ae),v.lineTo(i+G,ae);break}default:v.moveTo(i,ae),v.lineTo(i+G,ae)}v.stroke(),v.setLineDash([])}if(b&&(v.strokeStyle=h,v.lineWidth=A,v.beginPath(),v.moveTo(i,s+S.char.top+z),v.lineTo(i+G,s+S.char.top+z),v.stroke()),y){const B=Math.max(1,Math.floor(T.fontSize*E/10)),Y=s+S.char.top+Math.floor(S.char.height/2)-(B%2===1?.5:0);v.strokeStyle=h,v.lineWidth=B,v.beginPath(),v.moveTo(i,Y),v.lineTo(i+G,Y),v.stroke()}v.restore()}paintCursorShape(i,s,r,u){const f=this.ctx,m=this.dimensions.device,h=this.core._coreBrowserService.dpr,p=this.colors();switch(f.save(),f.fillStyle=p.cursor.css,f.strokeStyle=p.cursor.css,u){case 2:f.fillRect(i,s,Math.max(1,Math.round(this.core.optionsService.rawOptions.cursorWidth*h)),m.cell.height);break;case 3:f.fillRect(i,s+m.cell.height-Math.max(1,Math.round(h))-1,r,Math.max(1,Math.round(h)));break;case 4:{const y=Math.max(1,Math.round(h));f.lineWidth=y,f.strokeRect(i+y/2,s+y/2,r-y,m.cell.height-y);break}}f.restore()}fillCells(i,s,r,u){const f=this.dimensions.device;this.ctx.fillStyle=u,this.ctx.fillRect(i*f.cell.width,s*f.cell.height,r*f.cell.width,f.cell.height)}fillBackground(){this.ctx.fillStyle=this.colors().background.css,this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height)}cursorState(i){const s=this.core,r=this.buffer();let u,f;if(i&&i.cursor!==void 0){if(i.cursor===null)return null;u=i.cursor.row,f=i.cursor.col}else{if(!s.coreService.isCursorInitialized||s.coreService.isCursorHidden)return null;u=r.ybase+r.y,f=r.x}const m=u-r.ydisp;if(m<0||m>=this.rows)return null;const h=Math.min(Math.max(0,f),this.cols-1),p=s.optionsService.rawOptions;let y;if(s._coreBrowserService.isFocused)this.blinkTimer&&!this.blinkVisible?y=0:y=qp(p.cursorStyle||"block");else{const b=p.cursorInactiveStyle??"outline";y=b==="none"?0:qp(b)}return y===0?null:{x:h,y:m,shape:y}}restartBlink(){if(this.stopBlink(),this.blinkVisible=!0,this.disposed||!this.core.optionsService.rawOptions.cursorBlink||!this.core._coreBrowserService.isFocused){this.requestCursorRow();return}this.blinkTimer=setInterval(()=>{this.blinkVisible=!this.blinkVisible,this.requestCursorRow()},Z1),this.requestCursorRow()}stopBlink(){this.blinkTimer&&clearInterval(this.blinkTimer),this.blinkTimer=null,this.blinkVisible=!0}requestCursorRow(){if(!this.rows)return;const i=this.buffer(),s=new Set;s.add(i.ybase+i.y),this.paintedCursorRow>=0&&s.add(this.paintedCursorRow+i.ydisp),this.requestAbsoluteRows(s)}redrawDecor(){var p;const i=this.decorCtx;i.clearRect(0,0,this.decorCanvas.width,this.decorCanvas.height);const s=this.dimensions.device;if(!s.cell.width||!this.rows)return;const r=this.colors(),u=this.buffer().ydisp,f=(y,b,v,S)=>i.fillRect(y*s.cell.width,b*s.cell.height,v*s.cell.width,S*s.cell.height),m=this.selection;if(m){const y=m.start[1]-u,b=m.end[1]-u,v=Math.max(y,0),S=Math.min(b,this.rows-1);if(v<this.rows&&S>=0)if(i.fillStyle=(this.core._coreBrowserService.isFocused?r.selectionBackgroundTransparent:r.selectionInactiveBackgroundTransparent).css,m.columnSelectMode)f(m.start[0],v,m.end[0]-m.start[0],S-v+1);else{const T=y===v?m.start[0]:0,E=v===b?m.end[0]:this.cols;f(T,v,E-T,1),f(0,v+1,this.cols,Math.max(S-v-1,0)),v!==S&&f(0,S,b===S?m.end[0]:this.cols,1)}}const h=this.link;if(h){const y=this.core._coreBrowserService.dpr;i.fillStyle=h.fg===257?r.background.css:h.fg!==void 0&&h.fg<256?((p=r.ansi[h.fg])==null?void 0:p.css)??r.foreground.css:r.foreground.css;const b=(v,S,T)=>i.fillRect(v*s.cell.width,(S+1)*s.cell.height-y-1,T*s.cell.width,y);if(h.y1===h.y2)b(h.x1,h.y1,h.x2-h.x1);else{b(h.x1,h.y1,h.cols-h.x1);for(let v=h.y1+1;v<h.y2;v++)b(0,v,h.cols);b(0,h.y2,h.x2)}}}updateDimensions(i,s){const r=this.core._charSizeService;if(!r.hasValidSize)return;const u=this.core._coreBrowserService.dpr,f=this.core.optionsService.rawOptions,m=this.dimensions;m.device.char.width=Math.floor(r.width*u),m.device.char.height=Math.ceil(r.height*u),m.device.cell.height=Math.floor(m.device.char.height*f.lineHeight),m.device.char.top=f.lineHeight===1?0:Math.round((m.device.cell.height-m.device.char.height)/2),m.device.cell.width=m.device.char.width+Math.round(f.letterSpacing),m.device.char.left=Math.floor(f.letterSpacing/2),m.device.canvas.height=s*m.device.cell.height,m.device.canvas.width=i*m.device.cell.width,m.css.canvas.height=Math.round(m.device.canvas.height/u),m.css.canvas.width=Math.round(m.device.canvas.width/u),m.css.cell.height=m.css.canvas.height/s,m.css.cell.width=m.css.canvas.width/i,this.dprUsed=u}resizeGrid(i,s){this.cols=i,this.rows=s;const r=i*s;this.painted={content:new Uint32Array(r).fill(wo),fg:new Uint32Array(r),bg:new Uint32Array(r),ext:new Uint32Array(r),meta:new Uint32Array(r).fill(wo),combined:new Array(r).fill("")},this.row={content:new Uint32Array(i),fg:new Uint32Array(i),bg:new Uint32Array(i),ext:new Uint32Array(i),combined:new Array(i).fill("")},this.paintedOverlayRows.clear(),this.paintedCursorRow=-1}configureAtlas(){const i=this.dimensions.device,s=this.core.optionsService.rawOptions;this.atlas.configure({cellWidth:i.cell.width,cellHeight:i.cell.height,charWidth:i.char.width,charHeight:i.char.height,charLeft:i.char.left,charTop:i.char.top,dpr:this.core._coreBrowserService.dpr},{fontFamily:s.fontFamily,fontSize:s.fontSize,fontWeight:s.fontWeight,fontWeightBold:s.fontWeightBold,customGlyphs:s.customGlyphs!==!1})}invalidateAll(){this.painted.content.fill(wo),this.painted.meta.fill(wo),this.paintedCursorRow=-1}observeDevicePixels(){const i=this.core._coreBrowserService.window;if(!i||typeof i.ResizeObserver!="function")return;let s=new i.ResizeObserver(r=>{var y;const u=r.find(b=>b.target===this.canvas);if(!u)return;if(!("devicePixelContentBoxSize"in u)||!((y=u.devicePixelContentBoxSize)!=null&&y[0])){s==null||s.disconnect(),s=null;return}const f=u.devicePixelContentBoxSize[0].inlineSize,m=u.devicePixelContentBoxSize[0].blockSize;if(f<=0||m<=0||f===this.canvas.width&&m===this.canvas.height)return;const h=this.core._coreBrowserService.dpr,p=this.dimensions.css.canvas;if(!(Math.abs(f-p.width*h)>2||Math.abs(m-p.height*h)>2)){this.dimensions.device.canvas.width=f,this.dimensions.device.canvas.height=m;for(const b of[this.canvas,this.decorCanvas])b.width=f,b.height=m;this.invalidateAll(),this.fillBackground(),this.redrawDecor(),this.redraw.fire({start:0,end:Math.max(0,this.rows-1)})}});try{s.observe(this.canvas,{box:"device-pixel-content-box"})}catch{s.disconnect(),s=null}this.disposables.push({dispose:()=>s==null?void 0:s.disconnect()})}observeFonts(i){const s=i.fonts;if(!s||typeof s.addEventListener!="function")return;const r=()=>this.clearTextureAtlas();s.addEventListener("loadingdone",r),this.disposables.push({dispose:()=>s.removeEventListener("loadingdone",r)})}buffer(){return this.core._bufferService.buffer}colors(){return this.core._themeService.colors}boldBright(){return this.core.optionsService.rawOptions.drawBoldTextInBrightColors!==!1}requestAbsoluteRows(i){if(!this.rows)return;const s=this.buffer().ydisp;let r=1/0,u=-1/0;for(const f of i){const m=f-s;m<0||m>=this.rows||(r=Math.min(r,m),u=Math.max(u,m))}r<=u&&this.redraw.fire({start:r,end:u})}}function qp(a){switch(a){case"bar":return 2;case"underline":return 3;case"outline":return 4;default:return 1}}function J1(a){if(!a)return[];const i=a.cells.map(s=>s.row);return a.cursor&&i.push(a.cursor.row),i}function So(a,i,s){i>=0&&i<s&&a.add(i)}const Qs="herdr_remote_renderer_probe_v2",ew=30,Co=1,tw=720*60*60*1e3,md={};function Tb(){let a=null;if(typeof window>"u")a=md[Qs]||null;else try{a=window.localStorage?window.localStorage.getItem(Qs):null}catch{a=md[Qs]||null}if(!a)return{v:Co,ua:{}};try{const i=JSON.parse(a);return typeof i=="object"&&i!==null&&i.v===Co&&typeof i.ua=="object"&&i.ua!==null?i:{v:Co,ua:{}}}catch{return{v:Co,ua:{}}}}function nw(a,i=Date.now()){var u;const s=Tb();s.ua[a]={failedAt:i};const r=JSON.stringify(s);if(md[Qs]=r,typeof window<"u")try{(u=window.localStorage)==null||u.setItem(Qs,r)}catch(f){console.warn("Failed to write renderer probe result to localStorage:",f)}}function iw(a,i=Date.now()){const s=typeof navigator<"u"?navigator.userAgent:"";if(!s)return!1;const u=Tb().ua[s];return!(!u||typeof u.failedAt!="number"||i-u.failedAt>tw)}function Vp(a,i=Date.now()){const s=typeof navigator<"u"?navigator.userAgent:"";s&&nw(s,i)}function lw(a){if(a.length<4)return!0;const i=a[0],s=a[1],r=a[2],u=a[3];for(let f=4;f<a.length;f+=4)if(a[f]!==i||a[f+1]!==s||a[f+2]!==r||a[f+3]!==u)return!1;return!0}function aw(a){if(!a||a.width<=0||a.height<=0)return console.debug("Canvas probe inconclusive: text layer canvas missing or zero dimensions"),"inconclusive";let i=null;try{i=a.getContext("2d",{willReadFrequently:!0})||a.getContext("2d")}catch(u){return console.debug("Canvas probe inconclusive: failed to acquire 2D context:",u),"inconclusive"}if(!i)return console.debug("Canvas probe inconclusive: 2D context is null"),"inconclusive";const s=Math.min(a.width,640),r=Math.min(a.height,240);if(s<=0||r<=0)return console.debug("Canvas probe inconclusive: calculated sample dimensions are zero"),"inconclusive";try{const u=i.getImageData(0,0,s,r);return lw(u.data)?"blank":"healthy"}catch(u){return console.debug("Canvas probe inconclusive: getImageData threw exception:",u),"inconclusive"}}function Xp(a=2){return new Promise(i=>{if(typeof requestAnimationFrame!="function"){setTimeout(i,32);return}let s=a;const r=()=>{s--,s<=0?i():requestAnimationFrame(r)};requestAnimationFrame(r)})}const Qu={kind:"dom",canvas:null,dispose:()=>{},verify:async()=>{}};function sw(a,i={}){if(iw())return Qu;let s;try{s=Nd.install(a,{isSynchronizing:i.isSynchronizing})}catch(h){return console.debug("Canvas renderer unavailable, using the DOM renderer:",h),Vp(),Qu}if(!s)return Qu;let r=s,u=null;const f=()=>{var p;if(!r)return;Vp();const h=r;r=null;try{h.uninstall()}catch{}(p=i.onRendererSwapped)==null||p.call(i,"dom")};return{get kind(){return r?"canvas":"dom"},get canvas(){return r},dispose:()=>{const h=r;r=null;try{h==null||h.dispose()}catch{}},verify:async()=>{if(r)return u||(u=(async()=>{try{const h=r.stats.frames;await Xp(2);for(let y=0;y<ew&&r&&r.stats.frames===h;y++)await Xp(1);if(!r)return;const p=aw(r.textCanvas);p==="blank"?f():p==="inconclusive"&&console.debug("Canvas probe inconclusive; retaining canvas renderer without blacklisting")}catch(h){console.debug("Canvas probe inconclusive: unexpected error during verify():",h)}finally{u=null}})(),u)}}}function Pp(a,i){const s=typeof window<"u"?window:void 0,r=s&&typeof s.devicePixelRatio=="number"&&s.devicePixelRatio>0?s.devicePixelRatio:1,u=s&&s.visualViewport&&typeof s.visualViewport.scale=="number"&&s.visualViewport.scale>0?s.visualViewport.scale:1,f=Math.max(0,a.width),m=Math.max(0,a.height),h=Math.round(f*r*100)/100,p=Math.round(m*r*100)/100;return{dpr:r,scale:u,cssWidth:f,cssHeight:m,physicalWidth:h,physicalHeight:p}}function rw(a){const{lastSnapshot:i,currentSnapshot:s,physicalTolerancePx:r=6}=a;if(!i)return{shouldIgnore:!1,isVisualZoom:!1,reason:"initial"};const u=Math.abs(s.scale-i.scale)>.01,f=Math.abs(s.scale-1)>.01;if(u||f)return{shouldIgnore:!0,isVisualZoom:!0,reason:"visual_pinch_zoom"};if(Math.abs(s.dpr-i.dpr)>.01){const y=Math.abs(s.physicalWidth-i.physicalWidth),b=Math.abs(s.physicalHeight-i.physicalHeight);if(y<=r&&b<=r)return{shouldIgnore:!0,isVisualZoom:!0,reason:"dpr_zoom"}}const h=Math.abs(s.cssWidth-i.cssWidth),p=Math.abs(s.cssHeight-i.cssHeight);return h<1&&p<1?{shouldIgnore:!0,isVisualZoom:!1,reason:"no_box_change"}:{shouldIgnore:!1,isVisualZoom:!1,reason:"genuine_resize"}}const ow=" ()[]{}'\"\\`";function Wu(a,i,s,r=1){var A,z;if(!i||!((A=i.buffer)!=null&&A.active)||i.cols<=0||i.rows<=0)return null;const u=s||((z=i.element)==null?void 0:z.querySelector(".xterm-screen"))||i.element;if(!u||typeof u.getBoundingClientRect!="function")return null;const f=u.getBoundingClientRect(),m=pb(a.clientX,a.clientY,f,r),h=na(i);if(h.cellWidth<=0||h.cellHeight<=0)return null;const p=Math.max(1,f.width||i.cols*h.cellWidth),y=Math.max(1,f.height||i.rows*h.cellHeight),b=Math.max(0,Math.min(p-1,m.clientX-f.left)),v=Math.max(0,Math.min(y-1,m.clientY-f.top)),S=Math.max(0,Math.min(i.cols-1,Math.floor(b/h.cellWidth))),T=Math.max(0,Math.min(i.rows-1,Math.floor(v/h.cellHeight))),G=(i.buffer.active.viewportY??0)+T;return{col:S,bufferRow:G}}function cw(a,i){if(!a||a.length===0||a==="\0")return!0;for(const s of a)if(s==="\0"||/\s/.test(s)||i.includes(s))return!0;return!1}function uw(a,i,s){var S,T;if(!a||!((S=a.buffer)!=null&&S.active)||i<0||i>=a.cols)return null;const r=a.buffer.active.getLine(s);if(!r)return null;const u=((T=a.options)==null?void 0:T.wordSeparator)??ow,f=new Array(a.cols).fill(null),m=Math.min(a.cols,r.length);let h=0;for(;h<m;){const E=r.getCell(h);if(!E){f[h]={startCol:h,endCol:h+1,isSeparator:!0},h++;continue}const G=E.getWidth();if(G===0){f[h]||(f[h]={startCol:h,endCol:h+1,isSeparator:!0}),h++;continue}const A=E.getChars(),z=cw(A,u),B=Math.min(a.cols,h+G),Y={startCol:h,endCol:B,isSeparator:z};for(let ae=h;ae<B;ae++)f[ae]=Y;h+=Math.max(1,G)}for(let E=m;E<a.cols;E++)f[E]||(f[E]={startCol:E,endCol:E+1,isSeparator:!0});const p=f[i];if(!p||p.isSeparator)return null;let y=p.startCol;for(;y>0;){const E=f[y-1];if(E&&!E.isSeparator)y=E.startCol;else break}let b=p.endCol;for(;b<a.cols;){const E=f[b];if(E&&!E.isSeparator)b=E.endCol;else break}const v=b-y;return v<=0?null:{startCol:y,length:v}}function dw(a){var f;if(!a||!((f=a.buffer)!=null&&f.active))return"";const i=a.buffer.active,s=i.viewportY??0,r=a.rows,u=[];for(let m=0;m<r;m++){const h=i.getLine(s+m);u.push(h?h.translateToString(!0):"")}for(;u.length>0&&u[u.length-1]==="";)u.pop();return u.join(`
|
|
45
|
+
`)}const Zp=new Set(["│","┃","╎","╏","┆","┇","┊","┋","║","▏","▕","|"]),fw=.6,hw=new Set(["─","━","═","┄","┅","┈","┉","-"]),mw=.8;function Ju(a,i){if(!a)return!1;let s=0;const r=Math.min(i,a.length);for(let u=0;u<r;u++){const f=a.getCell(u);if(f){const m=f.getChars();m&&hw.has(m)&&s++}}return s>=Math.max(5,Math.min(i*.25,10))}function ed(a,i,s){var T;if(!a||!((T=a.buffer)!=null&&T.active)||a.cols<=0)return{startCol:0,endCol:0};const r=a.buffer.active,u=a.cols,f=Math.max(0,Math.min(u-1,i)),m=r.viewportY??0,h=a.rows>0?a.rows:1,p=new Int32Array(u);let y=0;for(let E=0;E<h;E++){const G=r.getLine(m+E);if(y++,!G)continue;const A=Math.min(u,G.length);for(let z=0;z<A;z++){const B=G.getCell(z);if(B){const Y=B.getChars();Y&&Zp.has(Y)&&p[z]++}}}if(y===0)return{startCol:0,endCol:u-1};const b=y*fw,v=E=>p[E]>=b;let S=!1;for(let E=0;E<u;E++)if(v(E)){S=!0;break}if(S){if(v(f))return{startCol:f,endCol:f};let E=-1;for(let A=f-1;A>=0;A--)if(v(A)){E=A;break}let G=u;for(let A=f+1;A<u;A++)if(v(A)){G=A;break}return{startCol:E+1,endCol:G-1}}if(s!==void 0){const E=Math.max(m,Math.min(m+h-1,s)),G=r.getLine(E);if(!Ju(G,u)){let A=m;for(let Y=E-1;Y>=m;Y--)if(Ju(r.getLine(Y),u)){A=Y+1;break}let z=m+h-1;for(let Y=E+1;Y<=m+h-1;Y++)if(Ju(r.getLine(Y),u)){z=Y-1;break}const B=z-A+1;if(B>=2){const Y=new Int32Array(u);for(let F=A;F<=z;F++){const H=r.getLine(F);if(!H)continue;const re=Math.min(u,H.length);for(let le=0;le<re;le++){const ye=H.getCell(le);if(ye){const Me=ye.getChars();Me&&Zp.has(Me)&&Y[le]++}}}const ae=B*mw,he=F=>Y[F]>=ae;let ee=!1;for(let F=0;F<u;F++)if(he(F)){ee=!0;break}if(ee){if(he(f))return{startCol:f,endCol:f};let F=-1;for(let re=f-1;re>=0;re--)if(he(re)){F=re;break}let H=u;for(let re=f+1;re<u;re++)if(he(re)){H=re;break}return{startCol:F+1,endCol:H-1}}}}}return{startCol:0,endCol:u-1}}function Qp(a,i){const s=Math.min(a.startCol,a.endCol),r=Math.max(a.startCol,a.endCol),u=Math.min(a.startRow,a.endRow),f=Math.max(a.startRow,a.endRow);return{startCol:Math.max(i.startCol,Math.min(i.endCol,s)),endCol:Math.max(i.startCol,Math.min(i.endCol,r)),startRow:u,endRow:f}}function td(a,i){var y;if(!a||!((y=a.buffer)!=null&&y.active)||a.cols<=0)return"";const s=a.buffer.active,r=a.cols,u=Math.min(i.startRow,i.endRow),f=Math.max(i.startRow,i.endRow),m=Math.max(0,Math.min(i.startCol,i.endCol)),h=Math.min(r-1,Math.max(i.startCol,i.endCol));if(m>h||u>f)return"";const p=[];for(let b=u;b<=f;b++){const v=s.getLine(b);if(!v){p.push("");continue}const S=v.translateToString(!0,m,h+1);p.push(S.trimEnd())}return p.join(`
|
|
46
|
+
`)}async function Ll(a){if(typeof navigator<"u"&&navigator.clipboard&&typeof navigator.clipboard.writeText=="function")try{return await navigator.clipboard.writeText(a),"clipboard"}catch{}if(typeof document<"u"&&typeof document.execCommand=="function"){let i=null,s=null,r=null;try{if(i=document.createElement("textarea"),i.style.userSelect="text",i.style.webkitUserSelect="text",i.style.position="fixed",i.style.top="0",i.style.left="0",i.style.width="1px",i.style.height="1px",i.style.padding="0",i.style.border="none",i.style.outline="none",i.style.boxShadow="none",i.style.background="transparent",i.style.opacity="0",i.style.fontSize="16px",i.setAttribute("readonly",""),i.setAttribute("aria-hidden","true"),i.value=a,typeof window<"u"&&typeof window.getSelection=="function"&&(r=window.getSelection(),r&&r.rangeCount>0&&(s=r.getRangeAt(0))),document.body.appendChild(i),typeof navigator<"u"&&(/iPad|iPhone|iPod/.test(navigator.userAgent||"")||navigator.platform==="MacIntel"&&(navigator.maxTouchPoints||0)>1)){const m=document.createRange();m.selectNodeContents(i),r&&(r.removeAllRanges(),r.addRange(m)),i.setSelectionRange(0,a.length)}else i.focus({preventScroll:!0}),i.select();if(document.execCommand("copy"))return"exec"}catch{}finally{i&&i.parentNode&&i.parentNode.removeChild(i),r&&(r.removeAllRanges(),s&&r.addRange(s))}}return"failed"}async function pw(){if(!(typeof window>"u"||window.isSecureContext!==!1)||typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.readText!="function")return{ok:!1,reason:"insecure"};try{const i=await navigator.clipboard.readText();return!i||i.length===0?{ok:!1,reason:"empty"}:{ok:!0,text:i}}catch(i){return typeof window<"u"&&window.isSecureContext===!1?{ok:!1,reason:"insecure"}:(i==null?void 0:i.name)==="SecurityError"?{ok:!1,reason:"insecure"}:{ok:!1,reason:"denied"}}}async function gw(){if(!(typeof window>"u"||window.isSecureContext!==!1)||typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.read!="function")return{ok:!1,reason:"insecure"};try{const i=await navigator.clipboard.read();if(!i||i.length===0)return{ok:!1,reason:"empty"};for(const s of i){const r=s.types.find(u=>u.startsWith("image/"));if(r){const u=await s.getType(r);if(u&&u.size>0)return{ok:!0,blob:u}}}return{ok:!1,reason:"empty"}}catch(i){if(typeof window<"u"&&window.isSecureContext===!1)return{ok:!1,reason:"insecure"};const s=i==null?void 0:i.name;return s==="SecurityError"?{ok:!1,reason:"insecure"}:s==="NotAllowedError"?{ok:!1,reason:"denied"}:{ok:!1,reason:"empty"}}}function Mb(a){const i=a.clipboardData;if(!i)return null;if(i.files&&i.files.length>0)for(let s=0;s<i.files.length;s++){const r=i.files[s];if(r&&r.type.startsWith("image/"))return r}if(i.items&&i.items.length>0)for(let s=0;s<i.items.length;s++){const r=i.items[s];if(r&&r.type.startsWith("image/")){const u=r.getAsFile();if(u)return u}}return null}function bw(a){if(!a||a.length===0)return null;for(let i=0;i<a.length;i++){const s=a[i];if(s&&(s.type.startsWith("image/")||/\.(png|jpe?g|webp|gif)$/i.test(s.name)))return s}return null}const nd="Herdr Remote",Wp=80,yw=/[\u0000-\u001F\u007F-\u009F]/g;function pd(a){if(typeof a!="string")return"";const i=a.replace(yw," ").replace(/\s+/g," ").trim();return i.length<=Wp?i:`${i.slice(0,Wp-1).trimEnd()}…`}function vw(a,i,s){const r=lx(s??null),u=r?`${r} `:"",f=pd(a);if(f)return`${u}${f} · ${nd}`;const m=pd(i);return m?`${u}${m} · ${nd}`:`${u}${nd}`}function xw(a,i,s){const r=vw(a,i,s);return typeof document<"u"&&(document.title=r),r}const ww=new Set(["http:","https:","mailto:"]),id=/(?:https?:\/\/|mailto:|www\.)[^\s"'<>`]+/gi,Sw=/[.,;:!?'"]+$/,Jp=8;function kd(a){return/^www\./i.test(a)?`https://${a}`:a}function Cw(a){const i=(u,f)=>u.split(f).length-1;let s=a.replace(Sw,"");const r=[["(",")"],["[","]"],["{","}"]];for(const[u,f]of r)for(;s.endsWith(f)&&i(s,f)>i(s,u);)s=s.slice(0,-1);return s}function Ab(a){if(typeof a!="string"||a.length===0)return!1;try{return ww.has(new URL(kd(a)).protocol)}catch{return!1}}function Tw(a,i){if(typeof a!="string"||i<0)return null;id.lastIndex=0;for(let s=id.exec(a);s;s=id.exec(a)){const r=Cw(s[0]);if(!r)continue;const u=s.index,f=u+r.length;if(i>=u&&i<f&&Ab(r))return r}return null}function Mw(a,i,s){var h;const r=(h=a==null?void 0:a.buffer)==null?void 0:h.active;if(!r||typeof r.getLine!="function"||!r.getLine(s))return null;let u=s;for(let p=0;p<Jp;p+=1){const y=r.getLine(u);if(!(y!=null&&y.isWrapped)||u===0)break;u-=1}let f="",m=-1;for(let p=u;p<u+Jp;p+=1){const y=r.getLine(p);if(!y||p>u&&!y.isWrapped)break;p===s&&(m=f.length+i),f+=y.translateToString(!1)}return m<0?null:{text:f,index:m}}function Aw(a,i,s){const r=Mw(a,i,s);return r?Tw(r.text,r.index):null}function Ew(a){try{const i=new URL(kd(a));return i.host||i.pathname}catch{return""}}function ld(a){return!Ab(a)||typeof window>"u"||typeof window.open!="function"?!1:(window.open(kd(a),"_blank","noopener,noreferrer"),!0)}const Ya="tui-focusable group flex h-11 w-full select-none items-center gap-2 border px-2 text-left text-tui transition-colors",Ia="border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",Nw=({anchorPoint:a,hasSelection:i,isController:s,vibrateOnKeyPress:r=!1,linkUrl:u=null,onOpenLink:f,onCopySelection:m,onCopyLine:h,onCopyScreen:p,onPaste:y,onClose:b})=>{const{t:v}=ct(),S=w.useRef(null),[T,E]=w.useState(null);w.useEffect(()=>{if(r&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(8)}catch{}},[r]),w.useLayoutEffect(()=>{const B=S.current;if(!B||!B.parentElement)return;const Y=B.parentElement.getBoundingClientRect(),ae=B.getBoundingClientRect(),he=ae.width||208,ee=ae.height||220,F=Y.width,H=Y.height;let re=a.x-he/2;re=Math.max(8,Math.min(Math.max(8,F-he-8),re));let le=a.y-ee-8;le<8&&(le=a.y+8),le=Math.max(8,Math.min(Math.max(8,H-ee-8),le)),E({x:re,y:le})},[a.x,a.y,i,s,u]);const G=Math.max(8,a.x-104),A=Math.max(8,a.y-200),z={position:"absolute",left:`${T?T.x:G}px`,top:`${T?T.y:A}px`,visibility:T?"visible":"hidden"};return d.jsx("div",{ref:S,role:"menu","aria-label":"终端选择操作",className:"z-50 w-52 select-none font-mono",style:z,onMouseDown:B=>B.stopPropagation(),onTouchStart:B=>B.stopPropagation(),onPointerDown:B=>B.stopPropagation(),children:d.jsxs(on,{tone:"accent",className:"border border-tui-border bg-tui-base p-1.5 shadow-lg",bodyClassName:"flex flex-col gap-1",children:[u&&f&&d.jsxs("button",{type:"button",role:"menuitem",className:se(Ya,Ia),onClick:()=>{f(u),b()},children:[d.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:He.cursor}),d.jsx("span",{className:"truncate",children:v("clipboard.openLink")}),d.jsx("span",{className:"ml-auto max-w-[45%] truncate text-tui-faint",children:Ew(u)})]}),i&&d.jsxs("button",{type:"button",role:"menuitem",className:se(Ya,Ia),onClick:()=>{m(),b()},children:[d.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:He.cursor}),d.jsx("span",{className:"truncate",children:v("clipboard.copySelection")})]}),d.jsxs("button",{type:"button",role:"menuitem",className:se(Ya,Ia),onClick:()=>{h(),b()},children:[d.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:He.cursor}),d.jsx("span",{className:"truncate",children:v("clipboard.copyLine")})]}),d.jsxs("button",{type:"button",role:"menuitem",className:se(Ya,Ia),onClick:()=>{p(),b()},children:[d.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:He.cursor}),d.jsx("span",{className:"truncate",children:v("clipboard.copyScreen")})]}),s&&d.jsxs("button",{type:"button",role:"menuitem",className:se(Ya,Ia),onClick:()=>{y(),b()},children:[d.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:He.cursor}),d.jsx("span",{className:"truncate",children:v("clipboard.paste")})]}),d.jsxs("button",{type:"button",role:"menuitem",className:se(Ya,Ia),onClick:b,children:[d.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:He.cursor}),d.jsx("span",{className:"truncate",children:v("clipboard.cancel")})]})]})})},kw=({isOpen:a,onClose:i,onSend:s,onSendImage:r})=>{const{t:u,addToast:f}=ct(),[m,h]=w.useState(""),[p,y]=w.useState(null),[b,v]=w.useState(!1),S=w.useRef(null),T=w.useRef(null),E=w.useRef(null);w.useEffect(()=>{a&&(h(""),y(null),v(!1),S.current&&(S.current.value=""),T.current&&(T.current.value=""))},[a]);const G=async ee=>{if(ee.size===0){f("error",u("clipboard.fileEmpty"));return}v(!0);try{const F=await Ig(ee);F?(y(F),h("")):f("error",u("clipboard.imageTooLarge"))}catch(F){console.error("Failed to process image:",F),f("error",u("clipboard.imageTooLarge"))}finally{v(!1)}},A=async ee=>{const F=Mb(ee);F&&(ee.preventDefault(),await G(F))},z=async ee=>{const F=bw(ee.target.files);ee.target.value="",F&&await G(F)},B=ee=>{const F=ee.target.value;h(F),F&&p&&y(null)},Y=()=>{y(null),S.current&&(S.current.value=""),T.current&&(T.current.value="")},ae=()=>{p?(r==null||r(p),i()):m.trim()&&(s(m),i())},he=!!(m.trim()||p);return d.jsx(Do,{isOpen:a,onClose:i,title:u("clipboard.pasteTitle"),closeLabel:u("clipboard.cancel"),size:"sm",footer:d.jsxs("div",{className:"flex items-center justify-end gap-2",children:[d.jsx(ke,{variant:"ghost",onClick:i,children:u("clipboard.cancel")}),d.jsx(ke,{variant:"primary",onClick:ae,disabled:!he||b,children:u("clipboard.pasteSend")})]}),children:d.jsxs("div",{className:"flex flex-col gap-3 p-3 font-mono select-text",children:[d.jsxs("div",{className:"flex flex-col gap-1.5",children:[d.jsx("label",{htmlFor:"paste-fallback-input",className:"text-tui-sm text-tui-muted font-sans font-medium",children:u("clipboard.pasteHint")}),d.jsx("textarea",{ref:E,id:"paste-fallback-input","data-testid":"paste-fallback-input",rows:4,autoFocus:!0,placeholder:u("clipboard.pasteHint"),value:m,onChange:B,onPaste:A,disabled:!!p||b,className:"tui-input min-h-[90px] w-full resize-none p-2 text-tui font-mono rounded border border-tui-border bg-tui-bg focus:outline-none focus:ring-1 focus:ring-tui-accent disabled:opacity-50"})]}),d.jsxs("div",{className:"relative my-1",children:[d.jsx("div",{className:"absolute inset-0 flex items-center",children:d.jsx("div",{className:"w-full border-t border-tui-border"})}),d.jsx("div",{className:"relative flex justify-center text-tui-xs uppercase",children:d.jsx("span",{className:"bg-tui-bg px-2 text-tui-muted font-sans",children:u("clipboard.imageSectionTitle")})})]}),d.jsxs("div",{className:"flex flex-col gap-2",children:[d.jsx("input",{ref:S,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",className:"hidden","data-testid":"paste-fallback-file-input",onChange:z}),d.jsx("input",{ref:T,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",capture:"environment",className:"hidden","data-testid":"paste-fallback-camera-input",onChange:z}),p?d.jsxs("div",{className:"flex flex-col items-center gap-2 p-3 border border-tui-border bg-tui-bg rounded",children:[d.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"}),d.jsxs("div",{className:"flex items-center justify-between w-full text-tui-xs text-tui-muted pt-1",children:[d.jsx("span",{children:u("clipboard.imageCompressedSize",{size:Pv(p.byteLength)})}),d.jsx(ke,{variant:"ghost",onClick:Y,"aria-label":u("clipboard.removeImage"),children:u("clipboard.cancel")})]})]}):d.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d.jsx(ke,{variant:"default",onClick:()=>{var ee;return(ee=S.current)==null?void 0:ee.click()},disabled:b||!!m.trim(),className:"min-h-[44px] px-3 touch-manipulation text-tui-sm font-sans flex-1","aria-label":u("clipboard.chooseImage"),children:u("clipboard.chooseImage")}),d.jsx(ke,{variant:"default",onClick:()=>{var ee;return(ee=T.current)==null?void 0:ee.click()},disabled:b||!!m.trim(),className:"min-h-[44px] px-3 touch-manipulation text-tui-sm font-sans flex-1","aria-label":u("clipboard.takePhoto"),children:u("clipboard.takePhoto")})]}),b&&d.jsx("div",{className:"flex items-center gap-2 text-tui-xs text-tui-muted animate-pulse",children:d.jsx("span",{children:u("clipboard.imageCompressing")})})]})]})})},Rw=[[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 eg(a){if(a>=32&&a<=126)return 1;if(a<12288)return 0;for(const[i,s]of Rw){if(a<i)return 0;if(a<=s)return 2}return 0}const Lw=2,_w="?!#",tg=8,jw=1500,Dw=4e3,Ow=20;function Vi(a){return a===""||a===" "?" ":a}function zw(a,i,s,r=64){var m;const u=a.buffer.active.getLine(i),f=[];for(let h=s-1;h>=0&&f.length<r;h--){const p=u==null?void 0:u.getCell(h);if(!p)break;((m=p.getWidth)==null?void 0:m.call(p))!==0&&f.unshift(Vi(p.getChars()))}return f}function Uw(a,i){for(let s=Math.min(a.length,i.length);s>0;s--){let r=!0;for(let u=0;u<s&&r;u++)r=i[i.length-s+u]===Vi(a[u]);if(r)return s}return 0}function Bw(a){const i=a.buffer.active;return{key:"legacy",row:i.baseY+i.cursorY,caretCol:i.cursorX,startCol:i.cursorX,endCol:a.cols,empty:!1,agentLike:!1}}class Hw{constructor(i){Z(this,"getTerminal");Z(this,"getFieldOption");Z(this,"charWidth");Z(this,"now");Z(this,"textDecoder",new TextDecoder("utf-8"));Z(this,"confidentKeys",new Set);Z(this,"fieldStyles",new Map);Z(this,"field",null);Z(this,"runStartedEmpty",!1);Z(this,"predictions",[]);Z(this,"predictedCursor",null);Z(this,"srtt",null);Z(this,"isSuppressed",!1);Z(this,"suppressCursor",null);Z(this,"suppressSentAt",0);Z(this,"inFlight",[]);Z(this,"inFlightUnknown",!1);Z(this,"runInFlight",[]);Z(this,"probationRun",!1);Z(this,"runSent",[]);Z(this,"lastSentUndrawn",!1);Z(this,"awaitingPrefixCommand",!1);Z(this,"mismatches",0);Z(this,"trace",[]);this.getTerminal=i.getTerminal,this.getFieldOption=i.getField,this.charWidth=i.charWidth,this.now=i.now??(typeof performance<"u"&&typeof performance.now=="function"?()=>performance.now():()=>Date.now())}handleUserInput(i){var m;if(this.pruneExpired(),i.length===0)return;const s=this.textDecoder.decode(i,{stream:!1});if(!s)return;const r=fb(s);if(r==="passive")return;if(r==="pointer"){this.freeze("pointer");return}if(this.awaitingPrefixCommand){this.awaitingPrefixCommand=!1,this.freeze("Herdr prefix command",{demote:!0});return}if(T1(s)){const h=this.field??((m=this.getFieldOption)==null?void 0:m.call(this))??null;this.freeze("escape",{demote:!h||h.modal!==!1});return}const u=this.getTerminal();if(!u){this.reset("terminal unavailable",!0);return}const f=Array.from(s);for(let h=0;h<f.length;h++){const p=f[h],y=p.codePointAt(0);if(y===void 0)continue;if(y===Lw){this.awaitingPrefixCommand=!0,this.freeze("Herdr prefix",{demote:!0});return}if(y===27||y===9||y===10||y===13||y<32&&y!==8){this.freeze("control or escape sequence");return}if(y===8||y===127){if(!this.handleBackspace(u))return;continue}if(this.stillSuppressed()){this.inFlight.push(p),this.note("refused: waiting for the caret to move");continue}const b=eg(y);if(b===0){if(!this.skipUnpredictable(p,y,u)){h<f.length-1&&(this.inFlightUnknown=!0);return}continue}if(!this.handlePrintable(p,b,u)){h<f.length-1&&(this.inFlightUnknown=!0);return}}}onServerOutput(){const i=this.getTerminal(),s=i?{row:i.buffer.active.baseY+i.buffer.active.cursorY,col:i.buffer.active.cursorX}:null;this.pruneExpired(),i&&s&&this.predictions.length>0&&this.settle(i,s),this.updateSuppression(s)}updateSuppression(i){if(!this.isSuppressed)return;if(this.predictions.some(r=>r.frozenFrom)){this.suppressSentAt=this.now();return}!!i&&!!this.suppressCursor&&(i.row!==this.suppressCursor.row||i.col!==this.suppressCursor.col)?this.liftSuppression():this.stillSuppressed()}settle(i,s){var f,m;const r=this.field;if(this.getFieldOption){const h=this.getFieldOption();if(!h||h.key!==(r==null?void 0:r.key)){if(this.predictions.every(p=>p.frozenFrom||p.echoed)){this.predictions=[],this.predictedCursor=null;return}this.mismatch("field changed");return}if(h.layout!==r.layout){this.predictions=[],this.predictedCursor=null,this.field=h,this.note("layout changed");return}}const u=[];for(const h of this.predictions){const p=(f=i.buffer.active.getLine(h.row))==null?void 0:f.getCell(h.col),y=Vi(p?p.getChars():""),b=h.kind==="char"?y===h.char&&(h.width===1||(((m=p==null?void 0:p.getWidth)==null?void 0:m.call(p))??2)===2):y===" ",v=h.kind==="char"?s.row>h.row||s.row===h.row&&s.col>=h.col+h.width:s.row<h.row||s.row===h.row&&s.col<=h.col,S=h.before.includes(y),T=h.kind==="char"&&y===h.char&&!b;if(!(h.echoed&&!b))if(b&&(v||!S)){if(h.echoed||this.confirm(h,r),v){h.kind==="char"&&r&&!h.frozenFrom&&this.learnStyle(r.key,p);continue}h.echoed=!0,u.push(h)}else if(h.frozenFrom){const E=h.frozenFrom;!v&&s.row===E.row&&s.col>=E.col?u.push(h):v&&h.probation&&(this.inFlightUnknown=!0)}else if(!v&&!T)u.push(h);else if(h.probation){this.note("probation guess dropped"),this.predictions.some(E=>!E.frozenFrom&&E.kind==="erase")&&(this.inFlightUnknown=!0),this.inFlight=[...this.runInFlight,...this.runSent,...this.inFlight],this.runInFlight=[],this.runSent=[],this.probationRun=!1,this.predictions=this.predictions.filter(E=>E.frozenFrom),this.predictedCursor=null;return}else{this.mismatch(`cell shows ${JSON.stringify(y)} for ${JSON.stringify(h.char)}`);return}}this.predictions=u,u.length===0&&(this.predictedCursor=null)}reset(i,s){var f;this.predictions=[],this.predictedCursor=null;const r=typeof s=="boolean"?s:(s==null?void 0:s.suppress)??!0,u=typeof s=="object"&&(s==null?void 0:s.demote)===!0;if(this.note(`reset: ${i??"unspecified"}`),u){const m=this.field??((f=this.getFieldOption)==null?void 0:f.call(this))??null;m&&this.confidentKeys.delete(m.key)}if(this.forgetInFlight(),r){this.isSuppressed=!0,this.suppressSentAt=this.now();const m=this.getTerminal();m?this.suppressCursor={row:m.buffer.active.baseY+m.buffer.active.cursorY,col:m.buffer.active.cursorX}:this.suppressCursor=null}else this.isSuppressed=!1,this.suppressCursor=null}forgetConfidence(){this.confidentKeys.clear(),this.fieldStyles.clear(),this.field=null}getVisiblePredictions(){return this.pruneExpired(),this.visiblePredictions().filter(i=>!i.echoed).map(i=>({row:i.row,col:i.col,char:i.char}))}getOverlayItems(){var S,T,E,G,A;this.pruneExpired();const i=this.visiblePredictions();if(i.length===0)return[];const s=this.field?this.fieldStyles.get(this.field.key):void 0,r=i.map(z=>{const B={row:z.row,col:z.col,char:z.char,width:z.width,kind:z.kind};return s&&(B.style=s),B}),u=i[i.length-1],f=this.predictedCursor??{row:u.row,col:u.kind==="erase"?u.col:u.col+u.width},m=(z,B)=>r.some(Y=>Y.row===z&&Y.col<=B&&B<Y.col+Y.width),h=this.getTerminal(),p=h==null?void 0:h.buffer.active,y=this.field;if(p&&y&&this.runStartedEmpty&&y.agentLike&&f.row===y.row){const z=p.getLine(f.row);for(let B=f.col;B<y.endCol;B++){if(m(f.row,B)||Vi(((S=z==null?void 0:z.getCell(B))==null?void 0:S.getChars())??"")===" ")continue;const Y={row:f.row,col:B,char:" ",width:1,kind:"erase"};s&&(Y.style=s),r.push(Y)}}if(p){const z={row:p.baseY+p.cursorY,col:p.cursorX};if(!m(z.row,z.col)&&(z.row!==f.row||z.col!==f.col)){const B=((E=(T=p.getLine(z.row))==null?void 0:T.getCell(z.col))==null?void 0:E.getChars())??"",Y={row:z.row,col:z.col,char:Vi(B),width:1,kind:"mask"};s&&(Y.style=s),r.push(Y)}}const b=r.find(z=>z.row===f.row&&z.col===f.col&&z.kind!=="mask"),v=b?b.char:Vi(((A=(G=p==null?void 0:p.getLine(f.row))==null?void 0:G.getCell(f.col))==null?void 0:A.getChars())??"");return r.push({row:f.row,col:f.col,char:v,width:1,kind:"caret"}),r}getState(){return this.field&&this.confidentKeys.has(this.field.key)?"confident":"tentative"}getField(){return this.field}getMismatchCount(){return this.mismatches}getEchoSrttMs(){return this.srtt}getTrace(){return this.trace}visiblePredictions(){const i=this.getState()==="confident";return this.predictions.filter(s=>s.frozenFrom?s.shownWhenFrozen:i&&!s.probation)}freeze(i,s={}){var p;const r=this.getTerminal(),u=r?{row:r.buffer.active.baseY+r.buffer.active.cursorY,col:r.buffer.active.cursorX}:null,f=this.getState()==="confident";for(const y of this.predictions)y.frozenFrom||(y.frozenFrom=u??{row:y.row,col:y.col},y.shownWhenFrozen=f&&!y.probation);const m=this.predictedCursor?{...this.predictedCursor}:u,h=this.inFlight.length>0||this.inFlightUnknown||this.lastSentUndrawn;if(this.predictedCursor=null,this.note(`freeze: ${i}${s.demote?" (demote)":""}`),s.demote){const y=this.field??((p=this.getFieldOption)==null?void 0:p.call(this))??null;y&&this.confidentKeys.delete(y.key)}this.isSuppressed=!0,this.suppressSentAt=this.now(),this.suppressCursor=m,this.forgetInFlight(),this.inFlightUnknown=h}forgetInFlight(){this.inFlight=[],this.inFlightUnknown=!1,this.runInFlight=[],this.runSent=[],this.probationRun=!1,this.lastSentUndrawn=!1}suppressTimeout(){return Math.max(300,(this.srtt??300)*1.5)}predictionTimeout(){return Math.min(Dw,Math.max(jw,(this.srtt??0)*4))}stillSuppressed(){return this.isSuppressed?this.now()-this.suppressSentAt>=this.suppressTimeout()?(this.liftSuppression(),!1):!0:!1}liftSuppression(){this.isSuppressed=!1,this.suppressCursor=null}handlePrintable(i,s,r){var v;const u=this.ensureField(r);if(!u||!this.predictedCursor)return this.note("refused: caret is not in an input field"),!1;const f=this.predictedCursor,m=this.predictions.every(S=>S.frozenFrom)&&f.col===u.caretCol;if(u.agentLike&&u.empty&&m&&_w.includes(i))return this.freeze("agent mode switch"),!1;if(f.col+s>u.endCol-1)return this.freeze("cursor would reach the edge of the field"),!1;const h=(v=r.buffer.active.getLine(f.row))==null?void 0:v.getCell(f.col),p=[Vi(h?h.getChars():"")],y=this.predictions[this.predictions.length-1];let b;return y&&y.kind==="erase"&&!y.frozenFrom&&y.row===f.row&&y.col===f.col&&(b=this.predictions.pop(),p.push(...y.before," ")),this.predictions.push({row:f.row,col:f.col,char:i,width:s,kind:"char",before:p,sentAt:this.now(),replaces:b,probation:this.probationRun||void 0}),this.probationRun&&this.runSent.push(i),this.lastSentUndrawn=!1,f.col+=s,!0}skipUnpredictable(i,s,r){const u=this.ensureField(r),f=this.predictedCursor;if(!u||!f)return this.note("refused: caret is not in an input field"),!1;const m=this.assumedWidth(s);return f.col+m>u.endCol-1?(this.freeze("cursor would reach the edge of the field"),!1):(this.probationRun||(this.probationRun=!0,this.runSent=[]),this.runSent.push(i),this.lastSentUndrawn=!0,f.col+=m,this.note("width unknown: guessing"),!0)}assumedWidth(i){var r;const s=(r=this.charWidth)==null?void 0:r.call(this,i);return s===0||s===1||s===2?s:1}handleBackspace(i){var r,u,f;const s=this.predictions[this.predictions.length-1];if(this.predictedCursor&&s&&!s.frozenFrom&&!s.echoed&&s.kind==="char"&&s.row===this.predictedCursor.row&&s.col+s.width===this.predictedCursor.col)return this.predictions.pop(),s.probation&&this.runSent.pop(),this.predictedCursor.col=s.col,s.replaces&&this.predictions.push(s.replaces),!0;if(this.stillSuppressed())this.inFlightUnknown=!0;else{const m=this.ensureField(i),h=this.predictedCursor;if(m&&h){const p=i.buffer.active.getLine(h.row),y=p==null?void 0:p.getCell(h.col-1),b=y&&((r=y.getWidth)==null?void 0:r.call(y))===0?2:1,v=h.col-b;let S=!0;for(let E=h.col;E<m.endCol&&S;E++)S=this.coveredByPrediction(h.row,E)||Vi(((u=p==null?void 0:p.getCell(E))==null?void 0:u.getChars())??"")===" ";const T=Vi(((f=p==null?void 0:p.getCell(v))==null?void 0:f.getChars())??"");if(v>m.startCol&&S&&T!==" ")return this.predictions=this.predictions.filter(E=>!(E.echoed&&E.row===h.row&&E.col+E.width>v)),this.predictions.push({row:h.row,col:v,char:" ",width:b,kind:"erase",before:[T],sentAt:this.now(),probation:this.probationRun||void 0}),this.lastSentUndrawn=!1,h.col=v,!0}}return this.freeze("backspace into server content"),!1}coveredByPrediction(i,s){return this.predictions.some(r=>r.echoed&&r.row===i&&r.col<=s&&s<r.col+r.width)}ensureField(i){if(this.predictedCursor&&this.field)return this.field;const s=this.getFieldOption?this.getFieldOption():Bw(i);if(!s)return null;let r=s.caretCol,u=[],f=this.inFlightUnknown;if(this.inFlight.length>0&&!this.inFlightUnknown){u=this.inFlight.slice(Uw(this.inFlight,zw(i,s.row,r)));for(const m of u){const h=m.codePointAt(0)??0;r+=eg(h)||this.assumedWidth(h)}f=u.length>0}return this.inFlight=[],this.inFlightUnknown=!1,this.field=s,this.runStartedEmpty=s.empty&&u.length===0,this.predictions=this.predictions.filter(m=>m.frozenFrom),this.predictedCursor={row:s.row,col:r},this.runInFlight=u,this.probationRun=f,this.runSent=[],s}confirm(i,s){if(this.updateSrtt(Math.max(0,this.now()-i.sentAt)),s&&!i.frozenFrom&&this.markConfident(s.key),i.probation){for(const r of this.predictions)r.probation=void 0;this.probationRun=!1,this.runInFlight=[],this.runSent=[]}}learnStyle(i,s){const r=yb(s);if(r)for(this.fieldStyles.delete(i),this.fieldStyles.set(i,r);this.fieldStyles.size>tg;){const u=this.fieldStyles.keys().next().value;if(u===void 0)break;this.fieldStyles.delete(u)}}markConfident(i){for(this.confidentKeys.delete(i),this.confidentKeys.add(i);this.confidentKeys.size>tg;){const s=this.confidentKeys.values().next().value;if(s===void 0)break;this.confidentKeys.delete(s)}}mismatch(i){this.mismatches++,this.note(`mismatch: ${i}`),this.predictions=[],this.predictedCursor=null,this.field&&this.confidentKeys.delete(this.field.key),this.isSuppressed=!1,this.suppressCursor=null}note(i){const s=this.trace[this.trace.length-1];if(s&&s.event===i){s.count++,s.at=this.now();return}this.trace.push({at:this.now(),event:i,count:1}),this.trace.length>Ow&&this.trace.shift()}pruneExpired(){if(this.predictions.length===0)return;const i=this.now(),s=this.predictionTimeout(),r=this.predictions.filter(u=>i-u.sentAt<=s);r.length!==this.predictions.length&&(this.note("expired without an echo"),this.predictions=r,this.predictions.length===0&&(this.predictedCursor=null))}updateSrtt(i){this.srtt===null?this.srtt=i:this.srtt=this.srtt*.8+i*.2}}class Kw{constructor(i){Z(this,"items",[]);Z(this,"target",null);Z(this,"provider",()=>this.paint());this.options=i}attach(i){var s;this.target!==i&&((s=this.target)==null||s.setOverlayProvider(null),this.target=i,i==null||i.setOverlayProvider(this.provider))}sync(i){var s;i.length===0&&this.items.length===0||(this.items=i,(s=this.target)==null||s.invalidateOverlay())}clear(){var i;this.items.length!==0&&(this.items=[],(i=this.target)==null||i.invalidateOverlay())}hasItems(){return this.items.length>0}dispose(){this.attach(null),this.items=[]}paint(){if(this.items.length===0)return null;const i=this.options.getTerminal(),s=i==null?void 0:i.buffer.active;if(!i||!s)return null;const r=[],u=this.options.isCursorHidden(),f=s.baseY+s.cursorY,m=s.cursorX,h=gd(i,f,m),p=u&&!!h&&Eb(h);let y;for(const b of this.items)switch(b.kind){case"char":r.push({row:b.row,col:b.col,chars:b.char,width:b.width,style:b.style??Gw(i,b.row,b.col)});break;case"erase":r.push({row:b.row,col:b.col,chars:" ",width:b.width,style:Iw(b.style??gd(i,b.row,b.col)??gb)});break;case"mask":p&&b.row===f&&b.col===m&&r.push({row:b.row,col:b.col,chars:b.char,width:1,style:b.style??Yw(h)});break;case"caret":u?p&&r.push({row:b.row,col:b.col,chars:b.char,width:1,style:h}):y={row:b.row,col:b.col};break}return y===void 0?{cells:r}:{cells:r,cursor:y}}}function gd(a,i,s){var r;return s<0||s>=a.cols?null:yb((r=a.buffer.active.getLine(i))==null?void 0:r.getCell(s))}function Eb(a){return(a.fg&tn.INVERSE)!==0||(a.bg&Nt.CM_MASK)!==Nt.CM_DEFAULT}function Yw(a){return{fg:a.fg&~tn.INVERSE,bg:a.bg&~(Nt.CM_MASK|Nt.RGB_MASK),ext:a.ext}}function Iw(a){return{fg:a.fg&tn.INVERSE?a.fg&(tn.INVERSE|Nt.CM_MASK|Nt.RGB_MASK):0,bg:a.bg&(Nt.CM_MASK|Nt.RGB_MASK),ext:0}}function Gw(a,i,s){const r=gd(a,i,s-1);return r&&!Eb(r)&&!(r.bg&ia.DIM)?r:gb}const To=new Set(["│","┃","║","▐","▕","▏","▌"]),Lo=new Set(["┌","┐","└","┘","╭","╮","╰","╯","├","┤","┬","┴","┼","┏","┓","┗","┛","╔","╗","╚","╝","╠","╣","╟","╢","╞","╡"]),$w=new Set(["╭","┌","┏","╔"]),Fw=new Set(["╭","┌","┏","╔","├","┣","┠","┝","╟","╠","┞","┟","┡","┢"]),qw=new Set(["╮","┐","┓","╗"]),Vw=new Set(["╰","└","┗","╚"]),Xw=new Set(["╯","┘","┛","╝"]),ad=new Set(["─","━","═","╌","┄"]),Pw=new Set(["❯","›",">","!"]),ng=new Set(["$","#","%",">","❯","›","➜","λ","»"]),bd=8,Zw=12,ig=2,lg=1,Qw=4,Ww=3,ag=/-- INSERT --/,Jw=/-- (?:NORMAL|VISUAL(?: LINE| BLOCK)?|REPLACE) --/,eS=/Esc to cancel|Enter to (?:confirm|select)|to navigate|Space to (?:change|toggle|select)/i,tS=/^\s*\d+[.)]\s/;function Va(a){return a===""||a===" "||a===" "}class nS{constructor(i){Z(this,"cell");Z(this,"top");Z(this,"bottom");var s;this.screen=i,this.cell=(s=i.getNullCell)==null?void 0:s.call(i),this.top=i.baseY,this.bottom=i.baseY+i.rows-1}get cols(){return this.screen.cols}at(i,s){var r;if(!(i<this.top||i>this.bottom||s<0||s>=this.screen.cols))return(r=this.screen.getLine(i))==null?void 0:r.getCell(s,this.cell)}char(i,s){var r;return((r=this.at(i,s))==null?void 0:r.getChars())??""}dim(i,s){var r,u;return!!((u=(r=this.at(i,s))==null?void 0:r.isDim)!=null&&u.call(r))}text(i,s,r){var u;return i<this.top||i>this.bottom?"":((u=this.screen.getLine(i))==null?void 0:u.translateToString(!0,s,r))??""}isEdge(i,s){if(!To.has(this.char(i,s)))return!1;const r=this.char(i-1,s),u=this.char(i+1,s);return To.has(r)||Lo.has(r)||To.has(u)||Lo.has(u)}blankOrDim(i,s,r){var u;for(let f=s;f<r;f++){const m=this.at(i,f);if(m&&!Va(m.getChars())&&!((u=m.isDim)!=null&&u.call(m)))return!1}return!0}}function iS(a,i,s){if(a.isEdge(i,s))return null;let r=0;for(let f=s-1;f>=0;f--)if(a.isEdge(i,f)){r=f+1;break}let u=a.cols;for(let f=s+1;f<a.cols;f++)if(a.isEdge(i,f)){u=f;break}return r<u?{start:r,end:u}:null}function sg(a,i,s){if(!ad.has(a.char(i,s.start))||!ad.has(a.char(i,s.end-1))||Lo.has(a.char(i,s.start-1)))return!1;const r=s.end-s.start;let u=0;for(let f=s.start;f<s.end;f++)if(ad.has(a.char(i,f)))u++;else if(f-s.start-u>r*.1)return!1;return u>=r*.9}function Pa(a){return`${a.start}-${a.end}`}function Nb(a,i,s){if(s.start===0)return a.top;for(let r=i-1;r>=a.top;r--)if(Fw.has(a.char(r,s.start-1)))return r;return a.top}function lS(a,i,s){const r=s.start-1,u=s.end,{row:f}=i;if(r<0||u>=a.cols)return null;const m=a.char(f,r);if(!To.has(m)||a.char(f,u)!==m)return null;let h=f-1;for(;h>=a.top&&a.char(h,r)===m;)h--;let p=f+1;for(;p<=a.bottom&&a.char(p,r)===m;)p++;if(p-h-1>bd||!$w.has(a.char(h,r))||!qw.has(a.char(h,u))||!Vw.has(a.char(p,r))||!Xw.has(a.char(p,u))||a.dim(f,r))return null;const y=s.start+lg,b=s.end-lg;return i.col<y||i.col>=b?null:{kind:"frame",key:`frame:${Pa(s)}`,region:Pa(s),layout:`${h}`,row:f,caretCol:i.col,startCol:y,endCol:b,empty:h+2===p&&i.col===y&&a.blankOrDim(f,y,b),agentLike:!0,vimInsert:null,modal:!1}}function aS(a,i,s){const{row:r}=i;let u=-1;for(let b=r-1;b>=Math.max(a.top,r-bd);b--)if(sg(a,b,s)){u=b;break}if(u<0)return null;let f=-1;for(let b=r+1;b<=Math.min(a.bottom,r+bd);b++)if(sg(a,b,s)){f=b;break}if(f<0)return null;const m=u+1;let h=-1;for(let b=s.start;b<Math.min(s.end,s.start+3);b++){const v=a.char(m,b);if(!Va(v)){Pw.has(v)&&Va(a.char(m,b+1))&&(h=b);break}}if(h<0||a.dim(m,h)||tS.test(a.text(m,h+1,s.end)))return null;for(let b=m+1;b<f;b++)for(let v=s.start;v<s.start+ig;v++)if(!Va(a.char(b,v)))return null;let p="";for(let b=f+1;b<=Math.min(a.bottom,f+Zw)&&!Lo.has(a.char(b,s.start-1));b++)p+=`${a.text(b,s.start,s.end)}
|
|
47
|
+
`;if(eS.test(p)||Jw.test(p))return null;const y=r===m?h+2:s.start+ig;return i.col<y||i.col>=s.end?null:{kind:"rule",key:`rule:${Pa(s)}:${Nb(a,u,s)}`,region:Pa(s),layout:`${u}`,row:r,caretCol:i.col,startCol:y,endCol:s.end,empty:f-u===2&&i.col===y&&a.blankOrDim(r,y,s.end),agentLike:!0,vimInsert:ag.test(p),modal:ag.test(p)}}function sS(a,i,s){if(i.hidden)return null;const{row:r,col:u}=i;for(let f=u-2;f>=s.start;f--)if(!(!ng.has(a.char(r,f))||!Va(a.char(r,f+1))))return a.dim(r,f)?null:rg(a,i,s,r,f+2,f===s.start);for(let f=r-1;f>=Math.max(a.top,r-Ww);f--){let m=s.end-1;for(;m>=s.start&&Va(a.char(f,m));)m--;if(m>=s.end-1-Qw&&ng.has(a.char(f,m)))return a.dim(f,m)?null:rg(a,i,s,f,s.start,!1);if(m<s.end-1)return null}return null}function rg(a,i,s,r,u,f){const m=i.row===r?u:s.start;return i.col<m||i.col>=s.end?null:{kind:"prompt",key:`prompt:${Pa(s)}:${Nb(a,r,s)}`,region:Pa(s),layout:`${r}`,row:i.row,caretCol:i.col,startCol:m,endCol:s.end,empty:i.row===r&&i.col===m&&a.blankOrDim(i.row,m,s.end),agentLike:f,vimInsert:null,modal:!1}}function rS(a,i){const s=new nS(a);if(i.row<s.top||i.row>s.bottom||i.col<0||i.col>=a.cols)return null;const r=iS(s,i.row,i.col);return r?lS(s,i,r)??aS(s,i,r)??sS(s,i,r):null}class oS{constructor(){Z(this,"insertSeen",new Set)}detect(i,s){const r=rS(i,s);return!r||r.vimInsert===null?r:r.vimInsert?(this.insertSeen.add(r.region),r):this.insertSeen.has(r.region)?null:r}reset(){this.insertSeen.clear()}}class cS{constructor(i){Z(this,"tracker",new oS);Z(this,"cached");Z(this,"lastComplete",null);Z(this,"detect",()=>{var i,s;if((s=(i=this.options).isSynchronizing)!=null&&s.call(i))return this.lastComplete;if(this.cached===void 0){const r=this.options.getScreen(),u=this.options.getCursor();this.cached=r&&u?this.tracker.detect(r,u):null,this.lastComplete=this.cached}return this.cached});this.options=i}invalidate(){this.cached=void 0}reset(){this.tracker.reset(),this.cached=void 0,this.lastComplete=null}}const uS=25,dS=2026,fS=1e3;function hS(a,i=()=>performance.now()){let s=!1,r=null;const u=new Set,f=b=>(u.add(b),{dispose:()=>void u.delete(b)}),m=()=>{s=!1,r=null},h=a.parser;if(!h||typeof h.registerCsiHandler!="function")return{isCursorHidden:()=>!1,isSynchronizing:()=>!1,onSyncEnd:f,reset:m,dispose:()=>{}};const p=b=>v=>{for(const S of v.flat())if(S===uS&&(s=!b),S===dS){const T=!b&&r!==null;if(r=b?i():null,T)for(const E of[...u])E()}return!1},y=[h.registerCsiHandler({prefix:"?",final:"h"},p(!0)),h.registerCsiHandler({prefix:"?",final:"l"},p(!1)),h.registerCsiHandler({intermediates:"!",final:"p"},()=>(m(),!1))];return typeof h.registerEscHandler=="function"&&y.push(h.registerEscHandler({final:"c"},()=>(m(),!1))),{isCursorHidden:()=>s,isSynchronizing:()=>r!==null&&i()-r<fS,onSyncEnd:f,reset:m,dispose:()=>{for(const b of y)b.dispose();u.clear()}}}const mS=40;function pS(a){return a?`${a.kind} row ${a.row} cols ${a.startCol}-${a.endCol} caret ${a.caretCol}`:"none"}function gS(a){var r;const i=(r=a==null?void 0:a.canvas)==null?void 0:r.stats;if(!i)return`paint: ${(a==null?void 0:a.kind)??"-"} renderer
|
|
48
|
+
`;const s=i.lastInputToPaintMs!==null?`${i.lastInputToPaintMs.toFixed(1)}ms`:"-";return`paint: ${i.lastPaintMs.toFixed(2)}ms cells: ${i.lastCells} frames: ${i.frames} held: ${i.heldFrames} key→paint: ${s}
|
|
49
|
+
`}function bS(a){const i=(a==null?void 0:a.getTrace())??[];return i.length===0?"trace: -":`trace:
|
|
50
|
+
${i.slice(-6).map(s=>` ${s.event}${s.count>1?` ×${s.count}`:""}`).join(`
|
|
51
|
+
`)}`}function og(a,i){return a==="off"?!1:a==="always"?!0:i!==null&&i>mS}const yS=250,vS=({onTerminalFocus:a,isActive:i=!0})=>{var _t,zl,Ul,_,K,de;const s=w.useRef(null),r=w.useRef(null),u=w.useRef(null),f=w.useRef(null),m=w.useRef(1),h=w.useRef({cols:0,rows:0}),p=w.useRef(null),y=w.useRef(null),b=w.useRef(null),v=w.useRef(null),S=w.useRef({width:0,height:0}),T=w.useRef(null),E=mv(),G=E||typeof navigator<"u"&&navigator.maxTouchPoints>0||typeof window<"u"&&"ontouchstart"in window,A=typeof window<"u"&&new URLSearchParams(window.location.search).get("debug")==="1",[z,B]=w.useState({state:"idle",deltaY:0,lines:0,viewportY:null,scrollTop:null,scrollHeight:null,clientHeight:null,moved:!1,focused:!1,bufferType:null,baseY:null,cursorY:null,hasScrollback:null,mouseTracking:!1,scrollMode:"none",scrollCalls:0,lastScrollLines:null,lastInputEvent:"",pointerEvents:0,touchEvents:0}),[Y,ae]=w.useState({framesPerSec:0,bytesPerSec:0}),[he,ee]=w.useState(null),F=w.useRef(null),H=w.useRef(!1),re=w.useRef(!1),le=w.useRef([]);w.useEffect(()=>{if(!A)return;const U=setInterval(()=>{const ie=performance.now()-1e3,te=le.current;for(;te.length>0&&te[0].time<ie;)te.shift();let Ae=0;for(let ne=0;ne<te.length;ne++)Ae+=te[ne].bytes;ae({framesPerSec:te.length,bytesPerSec:Ae})},1e3);return()=>clearInterval(U)},[A]);const{isController:ye,connectionState:Me,settings:Ke,hostPalette:nt,terminalResetVersion:Ge,sendResize:N,sendBinary:q,observeKeyInput:ce,consumeModifierLatch:Le,agentStatus:J,addToast:Ve,warnViewerMode:Ue,connect:Re,subscribeToOutput:Oe,subscribeToPasteFileReady:je,uploadImage:Xe,profiles:Bt,activeProfileId:jt,t:Fe,rttMs:qt}=ct(),St=Ti.useMemo(()=>Dv(nt),[nt]),mt=w.useRef(St);mt.current=St;const V=w.useRef(ye);V.current=ye;const me=w.useRef(q);me.current=q;const Ye=w.useRef(Ve);Ye.current=Ve;const pt=w.useRef(Ue);pt.current=Ue;const L=w.useRef(N);L.current=N;const xe=w.useRef(Xe);xe.current=Xe;const we=w.useRef(i);we.current=i;const Ee=w.useRef(Ke);Ee.current=Ke;const _e=w.useRef(Fe);_e.current=Fe;const ot=w.useRef(null),$e=w.useRef(null),oe=w.useRef(null),ve=w.useRef(Le);ve.current=Le;const ze=w.useRef(()=>{}),Qe=w.useRef(U=>{var $,ie,te,Ae;($=ot.current)==null||$.reset(U),(ie=ot.current)==null||ie.forgetConfidence(),(te=oe.current)==null||te.reset(),(Ae=$e.current)==null||Ae.clear()}),[kt,Kn]=w.useState(null),Dt=w.useRef(null),[ii,Rn]=w.useState(null),Zt=w.useRef(null);Zt.current=ii;const[ut,Tt]=w.useState(null),Ct=w.useRef(null);Ct.current=ut;const[Yn,cn]=w.useState(""),In=w.useRef("");In.current=Yn;const[li,et]=w.useState(!1),Mi=w.useRef(!1);Mi.current=li;const un=w.useRef(!1),[mn,Gn]=w.useState(0),jl=w.useRef(0),Lt=w.useRef(null),wn=w.useRef(null),Sn=w.useRef(null),Ai=w.useRef(null),[sa,Dl]=w.useState(!1),Pi=w.useCallback(U=>{var Ae;const $=f.current;if(!$)return null;const ie=((Ae=u.current)==null?void 0:Ae.querySelector(".xterm-screen"))||u.current,te=Wu(U,$,ie,m.current);return te?Aw($,te.col,te.bufferRow):null},[]),Zi=w.useCallback(U=>{var Ae;const $=f.current;if(!$)return;const ie=((Ae=u.current)==null?void 0:Ae.querySelector(".xterm-screen"))||u.current,te=Wu(U,$,ie,m.current);if(te){Sn.current=te;const ne=ed($,te.col,te.bufferRow);Ai.current=ne;const it=uw($,te.col,te.bufferRow);if(it){const dt={startCol:it.startCol,endCol:it.startCol+it.length-1,startRow:te.bufferRow,endRow:te.bufferRow},vt=Qp(dt,ne),st=td($,vt);Tt(vt),cn(st),et(!0)}else Tt(null),cn(""),et(!1),Sn.current=null,Ai.current=null}else Tt(null),cn(""),et(!1),Sn.current=null,Ai.current=null;Lt.current=U,wn.current=null},[]),Qi=w.useCallback(U=>{var st;const $=f.current,ie=Sn.current;if(!$||!ie)return;wn.current=U;const te=((st=u.current)==null?void 0:st.querySelector(".xterm-screen"))||u.current,Ae=Wu(U,$,te,m.current);if(!Ae)return;const ne=Ai.current??ed($,ie.col,ie.bufferRow),it={startCol:Math.min(ie.col,Ae.col),endCol:Math.max(ie.col,Ae.col),startRow:Math.min(ie.bufferRow,Ae.bufferRow),endRow:Math.max(ie.bufferRow,Ae.bufferRow)},dt=Qp(it,ne),vt=td($,dt);Tt(dt),cn(vt),et(!0)},[]),Ei=w.useRef(Zi);Ei.current=Zi;const Ni=w.useRef(Qi);Ni.current=Qi;const $n=w.useCallback(async()=>{const U=In.current;if(!U)return;await Ll(U)==="failed"?Ye.current("error",_e.current("clipboard.copyFailed")):Ye.current("success",_e.current("clipboard.copied"))},[]),Ht=w.useCallback(async()=>{var dt,vt,st,Fn;const U=f.current;if(!U)return;const $=(dt=U.buffer)==null?void 0:dt.active;if(!$)return;const ie=((vt=Ct.current)==null?void 0:vt.startRow)??((st=Sn.current)==null?void 0:st.bufferRow)??$.viewportY,te=Ai.current??ed(U,((Fn=Sn.current)==null?void 0:Fn.col)??0,ie),Ae={startCol:te.startCol,endCol:te.endCol,startRow:ie,endRow:ie},ne=td(U,Ae);await Ll(ne)==="failed"?Ye.current("error",_e.current("clipboard.copyFailed")):Ye.current("success",_e.current("clipboard.copied"))},[]),Qt=w.useCallback(async()=>{const U=f.current;if(!U)return;const $=dw(U);await Ll($)==="failed"?Ye.current("error",_e.current("clipboard.copyFailed")):Ye.current("success",_e.current("clipboard.copied"))},[]),mi=w.useCallback(async()=>{var $,ie;const U=f.current;if(U){if(!V.current){pt.current();return}try{const te=await gw();if(te.ok){await xe.current(te.blob);return}}catch{}try{const te=await pw();if(te.ok){($=ot.current)==null||$.reset("paste"),(ie=$e.current)==null||ie.clear(),U.paste(te.text),Ye.current("success",_e.current("clipboard.pasted"));return}else if(te.reason==="empty"){Ye.current("info",_e.current("clipboard.pasteUnavailable"));return}}catch{}Dl(!0)}},[]),Ol=w.useCallback(U=>{var ie,te;const $=f.current;if($){if(!V.current){pt.current();return}(ie=ot.current)==null||ie.reset("paste"),(te=$e.current)==null||te.clear(),$.paste(U),Ye.current("success",_e.current("clipboard.pasted"))}},[]),Za=w.useCallback(U=>{if(f.current){if(!V.current){pt.current();return}xe.current(U)}},[]);w.useEffect(()=>je($=>{var te,Ae;const ie=f.current;ie&&((te=ot.current)==null||te.reset("paste"),(Ae=$e.current)==null||Ae.clear(),ie.paste($),Ye.current("success",_e.current("clipboard.pasted")))}),[je]);const ra=w.useCallback((U,$)=>{!Number.isFinite(U)||!Number.isFinite($)||U<=0||$<=0||U===h.current.cols&&$===h.current.rows||(p.current={cols:U,rows:$},!y.current&&(y.current=setTimeout(()=>{y.current=null;const ie=p.current;p.current=null,ie&&(ie.cols===h.current.cols&&ie.rows===h.current.rows||(h.current=ie,L.current(ie.cols,ie.rows),Qe.current("resize")))},yS)))},[]),Wi=w.useCallback((U=!1)=>{var Ji;const $=f.current,ie=s.current,te=u.current,Ae=r.current;if(!$||!ie||!te||!Ae)return;const ne=Vu(ie,Fa(),Gu());if(ne.width<=0||ne.height<=0)return;Ae.style.width="100%",Ae.style.height="100%",te.style.width="100%",te.style.height="100%",te.style.transform="none",te.style.transformOrigin="top left",m.current=1;const it=Pp(ne),dt=rw({lastSnapshot:T.current,currentSnapshot:it});if(dt.isVisualZoom&&!U){T.current=it;try{$.refresh(0,Math.max(0,$.rows-1))}catch{}return}if(dt.shouldIgnore&&!U)return;T.current=it;const vt=na($,Xa),st=Kp({width:ne.width-k1(te),height:ne.height,cellWidth:vt.cellWidth,cellHeight:vt.cellHeight}),Fn=Math.abs(ne.width-S.current.width)>1||Math.abs(ne.height-S.current.height)>1;if($.cols!==st.cols||$.rows!==st.rows)try{$.resize(st.cols,st.rows)}catch(nn){console.debug("Error resizing terminal grid:",nn)}H.current&&!re.current&&(Fn||$.cols!==st.cols||$.rows!==st.rows)&&(re.current=!0,(Ji=F.current)==null||Ji.verify());const qn=st.cols!==h.current.cols||st.rows!==h.current.rows;we.current&&(Fn||U||qn)&&(S.current={width:ne.width,height:ne.height},ra(st.cols,st.rows));try{$.refresh(0,Math.max(0,$.rows-1))}catch{}},[ra]),dn=w.useRef(Wi);dn.current=Wi;const ki=w.useCallback(()=>{if(b.current===null){if(typeof requestAnimationFrame!="function"){dn.current();return}b.current=requestAnimationFrame(()=>{b.current=null,dn.current()})}},[]),Cn=w.useCallback((U=30)=>{v.current!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(v.current),v.current=null);let $=0;const ie=()=>{v.current=null,$++;const te=$>=U;dn.current(!0),!te&&$<2&&typeof requestAnimationFrame=="function"&&(v.current=requestAnimationFrame(ie))};typeof requestAnimationFrame=="function"?v.current=requestAnimationFrame(ie):ie()},[]);w.useEffect(()=>{var ua,Wa,il;if(!s.current||!u.current)return;const U=s.current,$=Vu(U,Fa(),Gu()),ie=na(null,Xa),te=Kp({width:$.width,height:$.height,cellWidth:ie.cellWidth,cellHeight:ie.cellHeight});L.current(te.cols,te.rows),S.current={width:$.width,height:$.height},T.current=Pp($);const Ae=gp(Ke.fontSize,$.width),ne=new g1.Terminal({fontSize:Ae,fontFamily:Tp(Ke.fontFamily),lineHeight:1.15,...mt.current?{theme:{...mt.current}}:{},allowProposedApi:!0,convertEol:!0,scrollback:5e3,cols:te.cols,rows:te.rows,screenReaderMode:!1,linkHandler:{activate:(W,ue)=>{ld(ue)}}});try{const W=new b1.Unicode11Addon;ne.loadAddon(W),ne.unicode.activeVersion="11"}catch(W){console.debug("Unicode11 addon unavailable, using default width table:",W)}try{ne.loadAddon(new v1.WebLinksAddon((W,ue)=>{ld(ue)}))}catch(W){console.debug("WebLinks addon unavailable, URLs stay plain text:",W)}ne.open(u.current),f.current=ne;const it=ne.onTitleChange(W=>{Kn(pd(W)||null)}),dt=hS(ne),vt=new cS({getScreen:()=>{const W=f.current;if(!W)return null;const ue=W.buffer.active;return{cols:W.cols,rows:W.rows,baseY:ue.baseY,getLine:De=>ue.getLine(De),getNullCell:typeof ue.getNullCell=="function"?()=>ue.getNullCell():void 0}},getCursor:()=>{var ue;const W=(ue=f.current)==null?void 0:ue.buffer.active;return W?{row:W.baseY+W.cursorY,col:W.cursorX,hidden:dt.isCursorHidden()}:null},isSynchronizing:dt.isSynchronizing});oe.current=vt;const st=(ua=ne._core)==null?void 0:ua.unicodeService,Fn=new Hw({getTerminal:()=>f.current,getField:vt.detect,charWidth:typeof(st==null?void 0:st.wcwidth)=="function"?W=>st.wcwidth(W):void 0});ot.current=Fn;const qn=new Kw({getTerminal:()=>f.current,isCursorHidden:()=>dt.isCursorHidden()});$e.current=qn;const Ji=()=>{const W=ot.current,ue=$e.current;if(!W||!ue)return;const De=Ee.current.predictiveEcho,xt=W.getEchoSrttMs();if(!og(De,xt)){ue.clear();return}ue.sync(W.getOverlayItems())};ze.current=Ji,E&&ne.textarea&&(ne.textarea.readOnly=!1,ne.textarea.tabIndex=0,ne.textarea.inputMode="text");let nn=()=>{};if(A&&ne.textarea){const W=()=>{B(ue=>({...ue,focused:document.activeElement===ne.textarea}))};ne.textarea.addEventListener("focus",W),ne.textarea.addEventListener("blur",W),nn=()=>{var ue,De;(ue=ne.textarea)==null||ue.removeEventListener("focus",W),(De=ne.textarea)==null||De.removeEventListener("blur",W)},W()}const el=async W=>{var De,xt;(De=ot.current)==null||De.reset("paste"),(xt=$e.current)==null||xt.clear();const ue=Mb(W);if(ue){if(W.preventDefault(),W.stopPropagation(),!V.current){pt.current();return}await xe.current(ue)}};(Wa=ne.textarea)==null||Wa.addEventListener("paste",el),U.addEventListener("paste",el);const Ri=sw(ne,{isSynchronizing:dt.isSynchronizing,onRendererSwapped:W=>{var ue;U&&(U.dataset.renderer=W),ee(W),(ue=$e.current)==null||ue.attach(null);try{ne.refresh(0,Math.max(0,ne.rows-1))}catch{}}});qn.attach(Ri.canvas);const Qa=dt.onSyncEnd(()=>{var W,ue;return(ue=(W=F.current)==null?void 0:W.canvas)==null?void 0:ue.flushHeld()});F.current=Ri,U&&(U.dataset.renderer=Ri.kind),ee(Ri.kind);const tl=_e.current("terminal.bannerTitle"),lr=_e.current("terminal.bannerSubtitle");if(ne.writeln(" ___ ___ .___ "),ne.writeln(` / | \\ ____ _______| _/______ \x1B[1m${tl}\x1B[0m`),ne.writeln(`/ ~ \\/ __ \\\\_ __ \\ __/ ___/ \x1B[2m${lr}\x1B[0m`),ne.writeln("\\ Y / ___/ | | \\/|_ \\___ \\ "),ne.writeln(" \\___|_ / \\___ >|__| /___/____ >"),ne.writeln(" \\/ \\/ \\/ "),ne.writeln(""),H.current=!0,ne.write("",()=>void Ri.verify()),!E)try{ne.focus()}catch{}typeof document<"u"&&"fonts"in document&&typeof((il=document.fonts)==null?void 0:il.load)=="function"&&document.fonts.load('13px "Symbols Nerd Font Mono"').then(()=>{if(f.current){try{f.current.refresh(0,Math.max(0,f.current.rows-1))}catch{}Cn(5)}}).catch(()=>{});const ar=ne.onData(W=>{var xt,hn,pn;let ue=W;if(V.current&&fb(W)==="keys"&&J0(W)){const Ce=ve.current();Ce&&(ue=Mo(W,Ce))}const De=yd(ue);if(!V.current&&!Ao(De)){pt.current();return}(xt=ot.current)==null||xt.handleUserInput(De),Ji(),(pn=(hn=F.current)==null?void 0:hn.canvas)==null||pn.markInput(),me.current(De)}),nl=ne.onBinary(W=>{const ue=new Uint8Array(W.length);for(let De=0;De<W.length;De++)ue[De]=W.charCodeAt(De)&255;!V.current&&!Ao(ue)||me.current(ue)}),zo=typeof ne.onWriteParsed=="function"?ne.onWriteParsed(()=>{var W;un.current=!0,vt.invalidate(),!dt.isSynchronizing()&&((W=ot.current)==null||W.onServerOutput(),Ji())}):{dispose:()=>{}},sr=typeof ne.onRender=="function"?ne.onRender(W=>{const ue=ne.buffer.active.viewportY??0;ue!==jl.current&&(jl.current=ue,Gn(ue));const De=Ct.current;if(De&&Mi.current){const xt=De.startRow-ue,hn=De.endRow-ue;un.current&&W.start<=hn&&W.end>=xt&&(et(!1),un.current=!1)}else un.current=!1}):{dispose:()=>{}},rr=typeof ne.onScroll=="function"?ne.onScroll(()=>{var ue,De;const W=ne.buffer.active.viewportY??0;jl.current=W,Gn(W),(ue=ot.current)==null||ue.reset("scroll"),(De=$e.current)==null||De.clear()}):{dispose:()=>{}},fn=new L1({getTerminal:()=>f.current,getIsController:()=>V.current,getScale:()=>m.current,getSurfaceElement:()=>u.current,allowSyntheticMouseFallback:!1,onFocus:()=>{try{ne.focus()}catch{}A&&B(W=>({...W,focused:document.activeElement===ne.textarea})),a==null||a()},onGestureStateChange:W=>{A&&B(ue=>({...ue,state:W}))},onGestureScroll:({deltaY:W,lines:ue,viewportY:De,scrollTop:xt,scrollHeight:hn,clientHeight:pn,moved:Ce,bufferType:Wt,baseY:Mt,cursorY:_n,hasScrollback:Ot,mouseTracking:gn,scrollMode:Vn})=>{A&&B(ll=>({...ll,deltaY:W,lines:ue,viewportY:De,scrollTop:xt,scrollHeight:hn,clientHeight:pn,moved:Ce,focused:document.activeElement===ne.textarea,bufferType:Wt,baseY:Mt,cursorY:_n,hasScrollback:Ot,mouseTracking:gn,scrollMode:Vn,scrollCalls:ll.scrollCalls+(ue!==0?1:0),lastScrollLines:ue}))},longPressDelayMs:500,dragThresholdPx:8,scrollLineHeightPx:18,onLongPress:E?(W=>{var ue;return(ue=Ei.current)==null?void 0:ue.call(Ei,W)}):void 0,onSelectionExtend:E?(W=>{var ue;return(ue=Ni.current)==null?void 0:ue.call(Ni,W)}):void 0}),Uo=typeof window<"u"&&"PointerEvent"in window,Bo=typeof TouchEvent<"u",gi=[],Vt=(W,ue=!1)=>{const De=W.target;return De instanceof Node&&U.contains(De)||ue&&fn.getState()!=="idle"};if(Uo){const W={passive:!1,capture:!0},ue=Ce=>{A&&B(Wt=>({...Wt,pointerEvents:Wt.pointerEvents+1,lastInputEvent:Ce}))},De=Ce=>{if(!Vt(Ce))return;if(ue("pointerdown"),Zt.current){Rn(null),Zt.current=null,Tt(null),Ct.current=null,cn(""),In.current="",et(!1),Lt.current=null,wn.current=null,Ce.cancelable&&Ce.preventDefault(),Ce.stopPropagation();return}fn.handlePointerDown(Ce,U)&&Ce.stopPropagation()},xt=Ce=>{Vt(Ce,!0)&&(ue("pointermove"),fn.handlePointerMove(Ce),Ce.pointerType!=="mouse"&&Ce.stopPropagation())},hn=Ce=>{if(!Vt(Ce,!0))return;if(ue("pointerup"),fn.getState()==="longpress"&&Dt.current){const Mt=wn.current??Lt.current;if(Mt){const _n=Dt.current.getBoundingClientRect(),Ot=Mt.clientX-_n.left,gn=Mt.clientY-_n.top,Vn=Pi(Mt);Rn({x:Ot,y:gn,link:Vn}),Zt.current={x:Ot,y:gn,link:Vn}}}fn.handlePointerUp(Ce),Ce.pointerType!=="mouse"&&Ce.stopPropagation()},pn=Ce=>{Vt(Ce,!0)&&(ue("pointercancel"),Rn(null),Zt.current=null,Tt(null),Ct.current=null,cn(""),In.current="",et(!1),Lt.current=null,wn.current=null,fn.handlePointerCancel(Ce),Ce.pointerType!=="mouse"&&Ce.stopPropagation())};if(document.addEventListener("pointerdown",De,W),document.addEventListener("pointermove",xt,W),document.addEventListener("pointerup",hn,W),document.addEventListener("pointercancel",pn,W),gi.push(()=>{document.removeEventListener("pointerdown",De,W),document.removeEventListener("pointermove",xt,W),document.removeEventListener("pointerup",hn,W),document.removeEventListener("pointercancel",pn,W)}),Bo){const Ce=Mt=>{Vt(Mt,!0)&&(A&&B(_n=>({..._n,touchEvents:_n.touchEvents+1})),Mt.cancelable&&Mt.preventDefault(),Mt.stopPropagation())},Wt=["touchstart","touchmove","touchend","touchcancel"];for(const Mt of Wt)document.addEventListener(Mt,Ce,W);gi.push(()=>{for(const Mt of Wt)document.removeEventListener(Mt,Ce,W)})}}else{const W={passive:!1,capture:!0},ue=Ce=>{A&&B(Wt=>({...Wt,touchEvents:Wt.touchEvents+1,lastInputEvent:Ce}))},De=Ce=>{if(Vt(Ce)){if(ue("touchstart"),Zt.current){Rn(null),Zt.current=null,Tt(null),Ct.current=null,cn(""),In.current="",et(!1),Lt.current=null,wn.current=null,Ce.cancelable&&Ce.preventDefault(),Ce.stopPropagation();return}Ce.touches.length===1&&Ce.stopPropagation(),fn.handleTouchStart(Ce,U)}},xt=Ce=>{Vt(Ce,!0)&&(ue("touchmove"),Ce.touches.length===1&&Ce.stopPropagation(),fn.handleTouchMove(Ce))},hn=Ce=>{if(!Vt(Ce,!0))return;if(ue("touchend"),fn.getState()==="longpress"&&Dt.current){const Mt=wn.current??Lt.current;if(Mt){const _n=Dt.current.getBoundingClientRect(),Ot=Mt.clientX-_n.left,gn=Mt.clientY-_n.top,Vn=Pi(Mt);Rn({x:Ot,y:gn,link:Vn}),Zt.current={x:Ot,y:gn,link:Vn}}}Ce.stopPropagation(),fn.handleTouchEnd(Ce)},pn=Ce=>{Vt(Ce,!0)&&(ue("touchcancel"),Rn(null),Zt.current=null,Tt(null),Ct.current=null,cn(""),In.current="",et(!1),Lt.current=null,wn.current=null,Ce.stopPropagation(),fn.handleTouchCancel())};document.addEventListener("touchstart",De,W),document.addEventListener("touchmove",xt,W),document.addEventListener("touchend",hn,W),document.addEventListener("touchcancel",pn,W),gi.push(()=>{document.removeEventListener("touchstart",De,W),document.removeEventListener("touchmove",xt,W),document.removeEventListener("touchend",hn,W),document.removeEventListener("touchcancel",pn,W)})}const oa=W=>{W.preventDefault()};U.addEventListener("contextmenu",oa),gi.push(()=>{U.removeEventListener("contextmenu",oa)});const ca=new ResizeObserver(()=>{ki()});ca.observe(U);const si=()=>{ki()},ri=()=>{var W,ue;if(document.visibilityState==="visible"){Cn(10);try{(ue=f.current)==null||ue.refresh(0,Math.max(0,(((W=f.current)==null?void 0:W.rows)||1)-1))}catch{}}};window.addEventListener("resize",si),window.addEventListener("orientationchange",si),document.addEventListener("visibilitychange",ri),window.addEventListener("pageshow",ri);const Bl=()=>{ki()};return typeof window<"u"&&window.visualViewport&&(window.visualViewport.addEventListener("resize",Bl),window.visualViewport.addEventListener("scroll",Bl)),()=>{var W,ue;ar.dispose(),nl.dispose(),sr.dispose(),rr.dispose(),zo.dispose(),it.dispose(),Qa.dispose(),(W=$e.current)==null||W.dispose(),$e.current=null,ot.current=null,oe.current=null,ze.current=()=>{},dt.dispose(),fn.handlePointerCancel();for(const De of gi)De();ca.disconnect(),window.removeEventListener("resize",si),window.removeEventListener("orientationchange",si),document.removeEventListener("visibilitychange",ri),window.removeEventListener("pageshow",ri),typeof window<"u"&&window.visualViewport&&(window.visualViewport.removeEventListener("resize",Bl),window.visualViewport.removeEventListener("scroll",Bl)),y.current&&(clearTimeout(y.current),y.current=null),b.current!==null&&(cancelAnimationFrame(b.current),b.current=null),v.current!==null&&(cancelAnimationFrame(v.current),v.current=null),nn(),(ue=ne.textarea)==null||ue.removeEventListener("paste",el),U.removeEventListener("paste",el),Ri.dispose(),F.current=null,ne.dispose(),f.current=null}},[]);const ai=Ti.useMemo(()=>{var U;return((U=Bt.find($=>$.id===jt))==null?void 0:U.displayName)??null},[Bt,jt]);w.useEffect(()=>{Me!=="connected"&&Kn(null)},[Me]),w.useEffect(()=>{const U=i&&Me==="connected",$=Ke.agentAlertBadge?tr(J):null;xw(U?kt:null,ai,$)},[i,Me,kt,ai,J,Ke.agentAlertBadge]),w.useEffect(()=>{const U=f.current;if(!U)return;const $=Vu(s.current,Fa(),Gu());U.options.fontSize=gp(Ke.fontSize,$.width),U.options.fontFamily=Tp(Ke.fontFamily);try{U.refresh(0,Math.max(0,U.rows-1))}catch{}Cn(10)},[Ke.fontSize,Ke.fontFamily]),w.useEffect(()=>ce(U=>{var $,ie,te;($=ot.current)==null||$.handleUserInput(U),ze.current(),(te=(ie=F.current)==null?void 0:ie.canvas)==null||te.markInput()}),[ce]),w.useEffect(()=>{const U=ot.current,$=$e.current;if(!U||!$)return;const ie=U.getEchoSrttMs();og(Ke.predictiveEcho,ie)?$.sync(U.getOverlayItems()):$.clear()},[Ke.predictiveEcho]);const pi=w.useRef(Ge);w.useEffect(()=>{var $;if(pi.current===Ge)return;pi.current=Ge,Qe.current("resetVersion");const U=f.current;if(U)try{($=U.reset)==null||$.call(U),U.clear(),U.refresh(0,Math.max(0,U.rows-1))}catch{}},[Ge]),w.useEffect(()=>{Qe.current("connectionState")},[Me]),w.useEffect(()=>{const U=f.current;if(!(!U||!St)){U.options.theme={...St};try{U.refresh(0,Math.max(0,U.rows-1))}catch{}}},[St]),w.useEffect(()=>Oe($=>{const ie=f.current;if(!ie)throw new Error("terminal not ready");if(ie.write($),A){const te=performance.now(),Ae=le.current;Ae.push({time:te,bytes:$.byteLength});const ne=te-1e3;for(;Ae.length>0&&Ae[0].time<ne;)Ae.shift()}}),[Oe,A]),w.useEffect(()=>{if(!i)return;Cn(10);const U=f.current;if(U){try{U.refresh(0,Math.max(0,U.rows-1))}catch{}if(!E)try{U.focus()}catch{}}},[i,E,Cn]),w.useEffect(()=>{Me==="disconnected"&&Re()},[]);const Ln=U=>{U.preventDefault()};return d.jsxs("main",{ref:Dt,className:"flex-1 w-full min-w-0 min-h-0 overflow-hidden relative flex flex-col",onContextMenu:Ln,"aria-label":Fe("terminal.windowAriaLabel"),children:[d.jsx("div",{id:"terminal-container",ref:s,className:"absolute inset-0 overflow-hidden cursor-text",style:{touchAction:G?"none":"auto"},tabIndex:0,onContextMenu:Ln,"aria-label":Fe("terminal.bufferAriaLabel"),role:"region",children:d.jsx("div",{id:"terminal-frame",ref:r,className:"relative overflow-hidden",style:{width:"100%",height:"100%"},children:d.jsx("div",{id:"terminal-surface",ref:u,className:"absolute top-0 left-0",style:{transformOrigin:"top left",width:"100%",height:"100%"}})})}),A&&d.jsxs("pre",{"data-testid":"terminal-touch-debug",className:"pointer-events-none absolute left-1 top-1 z-50 border border-tui-border bg-tui-crust/90 px-2 py-1 font-mono text-tui-sm leading-relaxed text-tui-muted","aria-hidden":"true",children:[`gesture: ${z.state}
|
|
52
|
+
`,`deltaY: ${z.deltaY} lines: ${z.lines}
|
|
53
|
+
`,`viewportY: ${z.viewportY??"-"} focus: ${z.focused}
|
|
54
|
+
`,`buffer: ${z.bufferType??"-"} base: ${z.baseY??"-"} cursor: ${z.cursorY??"-"} scrollback: ${z.hasScrollback??"-"}
|
|
55
|
+
`,`scroll: ${z.scrollTop??"-"} / ${z.scrollHeight??"-"} (h ${z.clientHeight??"-"}) moved: ${z.moved}
|
|
56
|
+
`,`mode: ${z.scrollMode} calls: ${z.scrollCalls} lines: ${z.lastScrollLines??"-"} mouse: ${z.mouseTracking}
|
|
57
|
+
`,`event: ${z.lastInputEvent||"-"} pointer: ${z.pointerEvents} touch: ${z.touchEvents}
|
|
58
|
+
`,`rtt: ${qt!==null?`${qt}ms`:"-"} frames/s: ${Y.framesPerSec} bytes/s: ${Y.bytesPerSec} renderer: ${he??"-"}
|
|
59
|
+
`,`prediction: ${((_t=ot.current)==null?void 0:_t.getState())??"-"} mode: ${Ke.predictiveEcho} pending: ${((zl=ot.current)==null?void 0:zl.getVisiblePredictions().length)??0} srtt: ${((Ul=ot.current)==null?void 0:Ul.getEchoSrttMs())!==null&&((_=ot.current)==null?void 0:_.getEchoSrttMs())!==void 0?`${Math.round(ot.current.getEchoSrttMs())}ms`:"-"}
|
|
60
|
+
`,`field: ${pS(((K=oe.current)==null?void 0:K.detect())??null)} mismatches: ${((de=ot.current)==null?void 0:de.getMismatchCount())??0}
|
|
61
|
+
`,gS(F.current),bS(ot.current)]}),E&&ut&&li&&(()=>{var qn;const U=f.current;if(!U||!Dt.current)return null;const $=na(U);if($.cellWidth<=0||$.cellHeight<=0)return null;const ie=((qn=u.current)==null?void 0:qn.querySelector(".xterm-screen"))||u.current;if(!ie)return null;const te=ie.getBoundingClientRect(),Ae=Dt.current.getBoundingClientRect(),ne=ut.startRow-mn;if(ut.endRow-mn<0||ne>=U.rows)return null;const dt=te.top-Ae.top+ne*$.cellHeight,vt=te.left-Ae.left+ut.startCol*$.cellWidth,st=(ut.endCol-ut.startCol+1)*$.cellWidth,Fn=(ut.endRow-ut.startRow+1)*$.cellHeight;return d.jsx("div",{"data-testid":"terminal-selection-overlay",className:"pointer-events-none absolute z-20 bg-tui-accent/35",style:{top:`${dt}px`,left:`${vt}px`,width:`${st}px`,height:`${Fn}px`}})})(),E&&ii&&d.jsx(Nw,{anchorPoint:ii,hasSelection:!!Yn,isController:ye,vibrateOnKeyPress:Ke.vibrateOnKeyPress,linkUrl:ii.link??null,onOpenLink:U=>{ld(U)||Ve("warning",Fe("clipboard.openLinkFailed"))},onCopySelection:$n,onCopyLine:Ht,onCopyScreen:Qt,onPaste:mi,onClose:()=>{Rn(null),Zt.current=null,Tt(null),Ct.current=null,cn(""),In.current="",et(!1)}}),E&&d.jsx(kw,{isOpen:sa,onClose:()=>Dl(!1),onSend:Ol,onSendImage:Za})]})},xS=({onPairedSuccess:a})=>{const{settings:i,updateSettings:s,connect:r,connectionState:u,stateDetail:f,addToast:m,t:h}=ct(),[p,y]=w.useState(""),[b,v]=w.useState(null),[S,T]=w.useState(!1),[E,G]=w.useState(i.wsUrl||"/ws/client"),[A,z]=w.useState(i.token||""),[B,Y]=w.useState(i.clientId||""),ae="node bin/service.js pair",he="node bin/config-tui.js",ee=le=>{Ll(le).then(ye=>{if(ye==="failed"){m("error",h("clipboard.copyFailed"));return}v(le),m("success",h("toasts.commandCopied")),setTimeout(()=>v(null),2e3)})},F=le=>{le.preventDefault();const ye=p.trim().toUpperCase();if(!ye&&!A.trim()){m("warning",h("toasts.connectionError"));return}const Me={pairCode:ye,wsUrl:E.trim()||"/ws/client",clientId:B.trim()||i.clientId};A.trim()&&(Me.token=A.trim()),s(Me),r({pairCode:ye||void 0,token:A.trim()||void 0,wsUrl:E.trim()||"/ws/client",clientId:B.trim()||i.clientId}),a&&a()},H=u==="connecting"||u==="reconnecting",re=({n:le})=>d.jsxs("span",{"aria-hidden":"true",className:"shrink-0 font-bold text-tui-accent",children:["[",le,"]"]});return d.jsx("div",{className:"flex h-full w-full flex-1 justify-center overflow-y-auto bg-tui-crust p-2 sm:p-4",children:d.jsxs("div",{className:"my-auto w-full max-w-3xl space-y-3",children:[d.jsxs("div",{className:"border border-tui-border bg-tui-base px-3 py-2",children:[d.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[d.jsx("span",{"aria-hidden":"true",className:"font-bold text-tui-accent",children:"herdr-remote"}),d.jsx("h1",{className:"text-tui font-bold text-tui-text",children:h("onboarding.title")}),d.jsx("span",{className:"text-tui uppercase text-tui-warn",children:h("onboarding.firstTimeSetup")})]}),d.jsx("p",{className:"mt-0.5 text-tui leading-snug text-tui-muted",children:h("onboarding.description")})]}),u==="error"&&d.jsxs(Zs,{tone:"warn",action:d.jsx(ke,{variant:"warn",onClick:()=>r(),children:h("common.retry")}),children:[d.jsx("span",{className:"block font-bold",children:h("onboarding.authRequired")}),d.jsx("span",{className:"block text-tui-muted",children:f||h("onboarding.authRequiredDesc")})]}),d.jsxs("form",{onSubmit:F,className:"grid gap-3",children:[d.jsx(on,{title:h("onboarding.step1Title"),className:"min-w-0",children:d.jsxs("div",{className:"space-y-2",children:[d.jsxs("p",{className:"flex items-start gap-2 text-tui text-tui-muted",children:[d.jsx(re,{n:1}),d.jsx("span",{className:"leading-snug",children:h("onboarding.step1Desc")})]}),d.jsxs("div",{className:"flex items-center gap-2 border border-tui-border bg-tui-mantle px-2 py-1",children:[d.jsx("span",{"aria-hidden":"true",className:"shrink-0 select-none text-tui-ok",children:"$"}),d.jsx("code",{className:"min-w-0 flex-1 truncate text-tui text-tui-text",children:ae}),d.jsx(ke,{onClick:()=>ee(ae),glyph:b===ae?He.check:"⧉",className:se("shrink-0",b===ae&&"border-tui-ok text-tui-ok"),children:h(b===ae?"common.copied":"common.copy")})]}),d.jsx("div",{className:"space-y-0.5 text-tui-sm",children:d.jsxs("div",{className:"flex items-center justify-between gap-2",children:[d.jsx("span",{className:"truncate text-tui-faint",children:h("onboarding.step1TuiNote")}),d.jsx("code",{onClick:()=>ee(he),className:"shrink-0 cursor-pointer border border-tui-border-dim px-1 text-tui-muted hover:border-tui-accent hover:text-tui-accent",title:h("common.clickToCopy"),children:he})]})})]})}),d.jsx(on,{title:h("onboarding.step2Title"),className:"min-w-0",children:d.jsxs("div",{className:"space-y-2",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(re,{n:2}),d.jsx(xn,{type:"text",value:p,onChange:le=>y(le.target.value.toUpperCase()),placeholder:h("onboarding.step2Placeholder"),maxLength:12,autoFocus:!0,"aria-label":h("onboarding.step2Title"),className:"font-bold uppercase"})]}),d.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:h("onboarding.step2Note")})]})}),d.jsx(ke,{variant:"primary",type:"submit",block:!0,disabled:H,className:"py-1.5",children:H?d.jsx(la,{label:h("onboarding.connectingAndPairing")}):h("onboarding.connectAndPair")}),d.jsxs("div",{className:"border border-tui-border bg-tui-base",children:[d.jsxs("button",{type:"button",onClick:()=>T(!S),"aria-expanded":S,className:"tui-focusable flex w-full items-center gap-2 px-2 py-1 text-left text-tui text-tui-muted transition-colors hover:text-tui-accent",children:[d.jsx("span",{"aria-hidden":"true",className:"text-tui-accent",children:S?He.chevronDown:He.chevronRight}),d.jsx("span",{className:"uppercase",children:h("onboarding.advancedTitle")})]}),S&&d.jsxs("div",{className:"space-y-2.5 border-t border-tui-border-dim px-2 py-2",children:[d.jsxs("div",{className:"space-y-1",children:[d.jsx(vn,{htmlFor:"onboarding-token",children:h("onboarding.manualTokenLabel")}),d.jsx(xn,{id:"onboarding-token",type:"password",value:A,onChange:le=>z(le.target.value),placeholder:h("onboarding.manualTokenPlaceholder")})]}),d.jsxs("div",{className:"space-y-1",children:[d.jsx(vn,{htmlFor:"onboarding-ws",children:h("onboarding.wsEndpointLabel")}),d.jsx(xn,{id:"onboarding-ws",type:"text",value:E,onChange:le=>G(le.target.value),placeholder:h("onboarding.wsEndpointPlaceholder")})]}),d.jsx(fi,{}),d.jsxs("div",{className:"space-y-1",children:[d.jsx(vn,{htmlFor:"onboarding-client-id",children:h("onboarding.clientIdLabel")}),d.jsx(xn,{id:"onboarding-client-id",type:"text",value:B,onChange:le=>Y(le.target.value)})]})]})]})]})]})})},kl="tui-focusable inline-flex shrink-0 select-none items-center justify-center border text-tui font-medium transition-colors",Vs="border-tui-border bg-tui-surface text-tui-text hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",wS="border-tui-accent bg-tui-accent text-tui-crust font-bold",SS="border-tui-ok bg-transparent text-tui-ok hover:bg-tui-ok hover:text-tui-crust font-bold",cg={default:Vs,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"},CS=({compact:a=!1,onCustomize:i})=>{const{sendKey:s,settings:r,updateSettings:u,isController:f,warnViewerMode:m,t:h,uploadProgress:p,uploadImage:y,modifierLatch:b,toggleModifierLatch:v,consumeModifierLatch:S,agentProfile:T}=ct(),E=a?"h-8":"h-7",G=a?"h-8 min-w-[2rem] px-1.5":"h-7 min-w-[1.75rem] px-1.5",A=a?"h-8 w-8":"h-7 w-7",z=a?"h-8 px-1.5":"h-7 px-1.5",B=w.useRef(null),Y=w.useRef(null),ae=w.useCallback(()=>{if(r.vibrateOnKeyPress&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(8)}catch{}},[r.vibrateOnKeyPress]),he=w.useCallback(()=>{var V;if(ae(),!f){m();return}p.active||(V=B.current)==null||V.click()},[ae,f,m,p.active]),ee=w.useCallback(V=>{const me=V.target.files,Ye=me&&me[0];V.target.value="",Ye&&y(Ye)},[y]),F=()=>d.jsxs(d.Fragment,{children:[d.jsx("input",{ref:B,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",className:"hidden","data-testid":"key-toolbar-file-input",onChange:ee}),d.jsx("input",{ref:Y,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",capture:"environment",className:"hidden","data-testid":"key-toolbar-camera-input",onChange:ee})]}),H=(V=!1)=>p.active?d.jsx("div",{"data-testid":V?"key-toolbar-progress-collapsed":"key-toolbar-progress",className:"w-full border-b border-tui-border-dim bg-tui-crust px-2 py-1",children:d.jsx(d1,{ratio:p.ratio,label:p.statusText,tone:p.phase==="completed"?"ok":p.phase==="error"?"bad":"accent","aria-label":p.statusText})}):null,re=()=>{const V=p.active;return d.jsx("button",{type:"button","data-testid":"image-upload-btn",onClick:he,disabled:V,className:se(kl,G,V?"border-tui-border-dim bg-tui-surface opacity-60 cursor-not-allowed":Vs),title:V?p.statusText:h("virtualKeyboard.uploadImageTitle"),"aria-label":h("virtualKeyboard.uploadImage"),children:d.jsx("span",{className:"font-medium",children:V?`${p.percent}%`:h("virtualKeyboard.image")})})},[le,ye]=w.useState(!1),[Me,Ke]=w.useState(!1),[nt,Ge]=w.useState(!1),N=w.useRef([]);w.useEffect(()=>()=>{N.current.forEach(V=>clearTimeout(V)),N.current=[]},[]);const q=w.useRef(null),[ce,Le]=w.useState(!1),J=w.useCallback(()=>{const V=q.current;Le(!!V&&V.scrollLeft+V.clientWidth<V.scrollWidth-1)},[]);w.useEffect(J),w.useEffect(()=>{const V=q.current;if(!V||typeof ResizeObserver!="function")return;const me=new ResizeObserver(J);return me.observe(V),()=>me.disconnect()},[J,r.toolbarVisible]);const Ve=w.useCallback(V=>{if(ae(),!f){m();return}let me;try{me=Ci(V)}catch{return}if(S(),me.length===1){s(me[0]);return}me.forEach((Ye,pt)=>{const L=setTimeout(()=>{N.current=N.current.filter(xe=>xe!==L),s(Ye)},pt*120);N.current.push(L)})},[S,f,s,ae,m]),Ue=Gv(T,r.agentKeymaps[T]),Re=V=>{let me="";try{me=qs(V.combo)}catch{}const Ye=V.custom?V.customLabel||"":h(`agentActions.${V.labelKey}`),pt=V.labelKey==="interrupt"&&V.combo.trim().toLowerCase()==="ctrl+c"?"bad":V.combo.trim().toLowerCase()==="ctrl+z"?"warn":"default";return d.jsxs("button",{type:"button","data-testid":`agent-key-${V.id}`,onClick:()=>Ve(V.combo),className:se(kl,E,"max-w-[10rem] gap-1 px-1.5",cg[pt]),title:`${me} ${Ye}`.trim(),"aria-label":`${me} ${Ye}`.trim(),children:[d.jsx("span",{className:"font-bold",children:me}),d.jsx("span",{className:"max-w-[5rem] truncate text-tui-sm opacity-70",children:Ye})]},V.id)},Oe=()=>{const V=[...Ue.agentActions,...Ue.genericActions];return V.length===0&&!i?null:d.jsxs("div",{"data-testid":"agent-key-actions",role:"group","aria-label":`${$a[T].name} ${h("agentKeymaps.agentGroup")}`,className:"flex shrink-0 items-center gap-1",children:[d.jsx("span",{"aria-hidden":"true",className:"mx-1 h-5 w-px shrink-0 bg-tui-border-dim"}),V.map(Re),i&&d.jsx("button",{type:"button","data-testid":"agent-key-customize",onClick:i,className:se(kl,E,"px-1.5 text-tui-sm border-tui-border-dim bg-transparent text-tui-faint hover:border-tui-accent hover:text-tui-accent"),title:h("agentKeymaps.customizeBar"),"aria-label":h("agentKeymaps.customizeBar"),children:h("agentKeymaps.customizeBarShort")})]})},je=w.useCallback((V,me=!0)=>{if(ae(),!f){m();return}const Ye=S();s(me&&Ye?Mo(V,Ye):V)},[f,s,m,ae,S]);if(!r.toolbarVisible)return d.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(),H(!0),d.jsx("div",{className:"flex items-center justify-center px-2 py-0.5",children:d.jsxs("button",{type:"button",onClick:()=>u({toolbarVisible:!0}),className:"tui-focusable flex h-6 w-28 items-center justify-center gap-1 text-tui uppercase text-tui-faint transition-colors hover:text-tui-accent",title:h("virtualKeyboard.expandToolbar"),"aria-label":h("virtualKeyboard.expandToolbar"),"aria-expanded":!1,children:[d.jsx("span",{"aria-hidden":"true",children:"▴"}),d.jsx("span",{"aria-hidden":"true",children:h("common.keyBar")})]})})]});const Xe=r.virtualKeys&&r.virtualKeys.length>0?r.virtualKeys.filter(V=>V.enabled):Eg,Bt=V=>V.id==="left"?d.jsx("span",{"aria-hidden":"true",children:"←"}):V.id==="up"?d.jsx("span",{"aria-hidden":"true",children:"↑"}):V.id==="down"?d.jsx("span",{"aria-hidden":"true",children:"↓"}):V.id==="right"?d.jsx("span",{"aria-hidden":"true",children:"→"}):V.id==="enter"?d.jsxs("span",{className:"flex items-center gap-1",children:[d.jsx("span",{"aria-hidden":"true",children:"⏎"}),d.jsx("span",{className:"hidden sm:inline",children:h("virtualKeyboard.keyEnter")})]}):V.id==="drawer_chords"?d.jsx("span",{children:"^C"}):V.id==="drawer_fn"?d.jsxs("span",{className:"flex items-center gap-0.5",children:[d.jsx("span",{children:"Fn"}),d.jsx("span",{"aria-hidden":"true",children:le?"▾":"▴"})]}):d.jsx("span",{children:V.label}),jt=V=>{if(ae(),V.type==="modifier"){V.modifierType==="ctrl"||V.modifierType==="alt"||V.modifierType==="shift"?v(V.modifierType):V.modifierType==="meta"&&je(fe.ESC);return}if(V.type==="drawer"){V.drawerType==="fn"?(ye(!le),Ke(!1),Ge(!1)):V.drawerType==="chords"?(Ge(!nt),ye(!1),Ke(!1)):V.drawerType==="symbols"&&(Ke(!Me),ye(!1),Ge(!1));return}je(V.code,V.type!=="chord")},Fe=V=>{if(V.type==="modifier"){if(V.modifierType==="ctrl")return b.ctrl;if(V.modifierType==="alt")return b.alt;if(V.modifierType==="shift")return b.shift}if(V.type==="drawer"){if(V.drawerType==="fn")return le;if(V.drawerType==="chords")return nt;if(V.drawerType==="symbols")return Me}return!1},qt=V=>{const me=Fe(V),Ye=["left","up","down","right"].includes(V.id),pt=V.type==="drawer",L=rd(V,h);return d.jsx("button",{type:"button",onClick:()=>jt(V),className:se(kl,Ye?A:pt?z:G,V.id==="enter"?SS:me?wS:Vs),title:L,"aria-label":L,"aria-pressed":me,children:Bt(V)},V.id)},St=Xe.find(V=>V.id==="enter"),mt=(V,me,Ye,pt,L="default")=>d.jsxs("button",{type:"button",onClick:()=>je(V,!1),className:se(kl,E,"gap-1.5 px-2",cg[L]),title:Ye,children:[d.jsx("span",{className:"font-bold",children:me}),d.jsx("span",{className:"text-tui-sm opacity-70",children:pt})]});return d.jsxs("div",{"data-testid":"key-toolbar",className:se("z-20 flex shrink-0 select-none flex-col border-t border-tui-border bg-tui-mantle",a?"pb-[max(env(safe-area-inset-bottom,0px),0.125rem)]":"pb-[max(env(safe-area-inset-bottom,0px),0.25rem)]"),role:"toolbar","aria-label":h("virtualKeyboard.touchKeyboardShortcuts"),children:[F(),H(!1),le&&d.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(V=>{const me=`F${V}`;return d.jsxs("button",{type:"button",onClick:()=>je(fe[me]),className:se(kl,Vs,E),children:["F",V]},me)})}),nt&&d.jsxs("div",{className:"scrollbar-none flex items-center gap-1 overflow-x-auto border-b border-tui-border-dim bg-tui-crust p-1.5",children:[mt(fe.CTRL_C,"^C",h("virtualKeyboard.ctrlCTitle"),h("virtualKeyboard.badgeSigint"),"bad"),mt(fe.CTRL_D,"^D",h("virtualKeyboard.ctrlDTitle"),h("virtualKeyboard.badgeEof")),mt(fe.CTRL_Z,"^Z",h("virtualKeyboard.ctrlZTitle"),h("virtualKeyboard.badgeTstp"),"warn"),mt(fe.CTRL_L,"^L",h("virtualKeyboard.ctrlLTitle"),h("virtualKeyboard.badgeClear")),mt(fe.CTRL_R,"^R",h("virtualKeyboard.ctrlRTitle"),h("virtualKeyboard.badgeSearch")),mt(fe.CTRL_A,"^A",h("virtualKeyboard.ctrlATitle"),h("virtualKeyboard.badgeStart")),mt(fe.CTRL_E,"^E",h("virtualKeyboard.ctrlETitle"),h("virtualKeyboard.badgeEnd")),mt(fe.CTRL_K,"^K",h("virtualKeyboard.ctrlKTitle"),h("virtualKeyboard.badgeKill"))]}),Me&&d.jsx("div",{className:"scrollbar-none flex items-center gap-1 overflow-x-auto border-b border-tui-border-dim bg-tui-crust p-1.5",children:["|","~","/","\\","-","_","$","&",";",":","`",'"',"'",">","<","=","#","@","{","}","[","]"].map(V=>d.jsx("button",{type:"button",onClick:()=>je(V,!0),className:se(kl,Vs,A,"font-bold"),children:V},V))}),d.jsxs("div",{"data-testid":"key-toolbar-row",className:se("flex flex-nowrap items-center justify-start gap-1",a?"px-1.5 py-1":"px-2 py-1.5"),children:[d.jsxs("div",{className:"relative min-w-0",children:[d.jsxs("div",{ref:q,"data-testid":"key-toolbar-scroll",onScroll:J,className:"scrollbar-none flex flex-nowrap touch-pan-x items-center gap-1 overflow-x-auto overscroll-x-contain",children:[d.jsx("button",{type:"button",onClick:()=>u({toolbarVisible:!1}),className:se(kl,A,"mr-1 border-tui-border-dim bg-transparent text-tui-faint hover:border-tui-border hover:text-tui-text"),title:h("virtualKeyboard.collapseToolbar"),"aria-label":h("virtualKeyboard.collapseToolbar"),"aria-expanded":!0,children:d.jsx("span",{"aria-hidden":"true",children:"▾"})}),Xe.filter(V=>V.id!=="enter").map(qt),Oe(),re()]}),ce&&d.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"})]}),St&&qt(St)]})]})},TS=["ls -la","clear","git status","pwd","top","exit","cat"],MS=({isOpen:a,onClose:i})=>{const{sendKey:s,isController:r,warnViewerMode:u,t:f}=ct(),[m,h]=w.useState("");if(!a)return null;const p=b=>{if(b&&b.preventDefault(),!r){u();return}m.length>0?(s(m+"\r"),h("")):s("\r")},y=b=>{if(!r){u();return}s(b+"\r")};return d.jsxs("div",{className:"z-20 flex flex-col gap-1.5 border-t border-tui-border bg-tui-mantle p-2",role:"region","aria-label":f("virtualKeyboard.helperTitle"),children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-tui font-bold uppercase text-tui-accent",children:f("virtualKeyboard.helperTitle")}),d.jsx(ke,{variant:"ghost",onClick:i,"aria-label":f("virtualKeyboard.closeHelper"),children:"esc"})]}),d.jsx("div",{className:"scrollbar-none flex items-center gap-1 overflow-x-auto py-0.5",children:TS.map(b=>d.jsx("button",{type:"button",onClick:()=>y(b),className:"tui-focusable shrink-0 select-none border border-tui-border bg-tui-surface px-2 py-0.5 text-tui-sm text-tui-muted transition-colors hover:border-tui-accent hover:text-tui-accent",children:b},b))}),d.jsxs("form",{onSubmit:p,className:"flex items-center gap-1.5",children:[d.jsx("span",{"aria-hidden":"true",className:"shrink-0 select-none font-bold text-tui-ok",children:"$"}),d.jsxs("div",{className:"relative flex-1",children:[d.jsx("label",{htmlFor:"virtual-keyboard-input",className:"sr-only",children:f("virtualKeyboard.placeholder")}),d.jsx(xn,{id:"virtual-keyboard-input",name:"terminal-input",type:"text",value:m,onChange:b=>h(b.target.value),placeholder:f("virtualKeyboard.placeholder"),inputMode:"text",enterKeyHint:"send",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,className:"select-text pr-7"}),m.length>0&&d.jsx("button",{type:"button",onClick:()=>h(""),className:"tui-focusable absolute right-1 top-1/2 -translate-y-1/2 px-1 text-tui-faint hover:text-tui-bad","aria-label":f("virtualKeyboard.clearInput"),children:d.jsx("span",{"aria-hidden":"true",children:He.cross})})]}),d.jsx(ke,{variant:"primary",type:"submit",title:f("virtualKeyboard.sendButton"),glyph:"⏎",className:"h-9 shrink-0",children:d.jsx("span",{className:"hidden sm:inline",children:f("virtualKeyboard.sendButton")})})]})]})};function Oo(a,i){const s=(r,u)=>i?i(r):u;switch(a){case"connected":return{label:s("connection.live","Live"),level:"ok",needsAttention:!1};case"connecting":return{label:s("connection.connecting","Connecting"),level:"warn",needsAttention:!0};case"reconnecting":return{label:s("connection.reconnecting","Reconnecting"),level:"warn",needsAttention:!0,actionLabel:s("connection.reconnectNow","Reconnect now")};case"error":return{label:s("connection.error","Error"),level:"bad",needsAttention:!0,actionLabel:s("connection.retry","Retry")};default:return{label:s("connection.offline","Offline"),level:"idle",needsAttention:!0,actionLabel:s("connection.connect","Connect")}}}const AS={connected:"ok",connecting:"warn",reconnecting:"warn",error:"bad",disconnected:"idle"},ES=({isOpen:a,onClose:i,isAddMode:s=!1})=>{const{settings:r,updateSettings:u,connect:f,disconnect:m,connectionState:h,hostId:p,addToast:y,t:b,activeProfile:v,activeProfileId:S,addProfileAndConnect:T,renameProfile:E}=ct(),[G,A]=w.useState(r.wsUrl),[z,B]=w.useState(r.token),[Y,ae]=w.useState(r.pairCode),[he,ee]=w.useState(r.clientId),[F,H]=w.useState((v==null?void 0:v.displayName)||""),[re,le]=w.useState(r.autoReconnect),[ye,Me]=w.useState(!1);if(w.useEffect(()=>{a&&(A(r.wsUrl),B(s?"":r.token),ae(s?"":r.pairCode),ee(r.clientId),H(s?"":(v==null?void 0:v.displayName)||""),le(r.autoReconnect))},[a,s,r,v]),!a)return null;const Ke=q=>{q.preventDefault();const ce={wsUrl:G.trim()||"/ws/client",token:z.trim(),pairCode:Y.trim().toUpperCase(),clientId:he.trim()||r.clientId,autoReconnect:re};if(!ce.token&&!ce.pairCode){y("warning",b("pairing.credentialsRequired"));return}s?T({...ce,displayName:F.trim()||void 0}):(u(ce),S&&F.trim()&&E(S,F),m(),f({wsUrl:ce.wsUrl,token:ce.token||void 0,pairCode:ce.pairCode||void 0,clientId:ce.clientId,autoReconnect:re})),i()},nt=()=>{const q=`client-${Math.random().toString(36).substring(2,8)}`;ee(q)},Ge=()=>{const q=new URL(window.location.href);q.search="",Y.trim()&&q.searchParams.set("pairCode",Y.trim().toUpperCase()),Ll(q.toString()).then(ce=>{if(ce==="failed"){y("error",b("clipboard.copyFailed"));return}Me(!0),y("success",b("toasts.pairingLinkCopied")),setTimeout(()=>Me(!1),2e3)})},N=AS[h]??"idle";return d.jsxs(Do,{isOpen:a,onClose:i,title:b(s?"pairing.addTitle":"pairing.title"),subtitle:b("pairing.subtitle"),closeLabel:b("common.closeDialog"),hints:[{keys:"esc",action:b("common.close")},{keys:"⏎",action:b("pairing.saveAndConnect")}],footer:d.jsxs(d.Fragment,{children:[h==="connected"&&d.jsx(ke,{variant:"danger",onClick:()=>{m(),i()},children:b("common.disconnect")}),d.jsx(ke,{variant:"primary",type:"submit",form:"pairing-form",children:b("pairing.saveAndConnect")})]}),children:[d.jsxs("div",{className:"mb-3 flex flex-wrap items-center justify-between gap-2 border-b border-tui-border-dim pb-2 text-tui",children:[d.jsxs("span",{className:"flex items-center gap-1.5",children:[d.jsx(kn,{level:N}),d.jsx("span",{className:"text-tui-muted",children:b("common.status")}),d.jsx("span",{className:se(N==="ok"?"text-tui-ok":N==="bad"?"text-tui-bad":N==="warn"?"text-tui-warn":"text-tui-faint"),children:Oo(h,b).label})]}),p&&d.jsxs("span",{className:"flex items-center gap-1.5 text-tui-muted",children:[b("common.host")," ",d.jsx("span",{className:"text-tui-text",children:p})]})]}),d.jsxs("form",{id:"pairing-form",onSubmit:Ke,className:"space-y-3",children:[d.jsxs("div",{className:"space-y-1",children:[d.jsx(vn,{htmlFor:"pairing-name",children:b("pairing.displayNameLabel")}),d.jsx(xn,{id:"pairing-name",type:"text",value:F,onChange:q=>H(q.target.value),placeholder:b("pairing.displayNamePlaceholder"),maxLength:64,autoComplete:"off"}),d.jsx("p",{className:"text-tui-sm text-tui-faint",children:b("pairing.displayNameHelp")})]}),d.jsxs("div",{className:"space-y-1",children:[d.jsx(vn,{htmlFor:"pairing-code",hint:b("pairing.pairCodeNote"),children:b("pairing.pairCodeLabel")}),d.jsx(xn,{id:"pairing-code",type:"text",value:Y,onChange:q=>ae(q.target.value.toUpperCase()),placeholder:b("pairing.pairCodePlaceholder"),maxLength:12,className:"uppercase"}),d.jsx("p",{className:"text-tui-sm text-tui-faint",children:b("pairing.pairCodeHelp")})]}),d.jsxs("div",{className:"space-y-1",children:[d.jsx(vn,{htmlFor:"pairing-token",hint:b("pairing.tokenNote"),children:b("pairing.tokenLabel")}),d.jsx(xn,{id:"pairing-token",type:"password",value:z,onChange:q=>B(q.target.value),placeholder:b("pairing.tokenPlaceholder")})]}),d.jsxs("div",{className:"space-y-1",children:[d.jsx(vn,{htmlFor:"pairing-ws",children:b("pairing.wsUrlLabel")}),d.jsx(xn,{id:"pairing-ws",type:"text",value:G,onChange:q=>A(q.target.value),placeholder:b("pairing.wsUrlPlaceholder")}),d.jsx("p",{className:"text-tui-sm text-tui-faint",children:b("pairing.wsUrlDefaultNote")})]}),d.jsxs("div",{className:"space-y-1",children:[d.jsx(vn,{htmlFor:"pairing-client-id",children:b("pairing.clientIdLabel")}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx(xn,{id:"pairing-client-id",type:"text",value:he,onChange:q=>ee(q.target.value),className:"flex-1"}),d.jsx(ke,{onClick:nt,title:b("pairing.regenerateClientIdTitle"),className:"shrink-0",children:b("pairing.newIdButton")})]})]}),d.jsx("div",{className:"border-t border-tui-border-dim pt-2",children:d.jsx(ta,{checked:re,onChange:le,label:b("pairing.autoReconnectLabel"),description:b("pairing.autoReconnectDesc")})}),d.jsx("div",{className:"border-t border-tui-border-dim pt-2",children:d.jsx(ke,{onClick:Ge,block:!0,glyph:ye?He.check:"⧉",className:se(ye&&"border-tui-ok text-tui-ok"),children:b("pairing.copyDirectLink")})})]})]})},NS=["grid items-center gap-x-2 gap-y-1 border-b border-tui-border-dim px-2 py-1.5 last:border-b-0","grid-cols-[5rem_minmax(0,1fr)_6.5rem] [grid-template-areas:'cap_label_actions'_'combo_combo_default']","sm:grid-cols-[5rem_minmax(0,1fr)_9rem_7rem_6.5rem] sm:[grid-template-areas:'cap_label_combo_default_actions']"].join(" "),kS=({isOpen:a,onClose:i,initialTab:s})=>{const{settings:r,updateSettings:u,addToast:f,language:m,setLanguage:h,t:p,agentProfile:y}=ct(),[b,v]=w.useState("appearance"),[S,T]=w.useState(null),[E,G]=w.useState({}),A=w.useRef({}),[z,B]=w.useState(""),[Y,ae]=w.useState(""),[he,ee]=w.useState(!1);if(w.useEffect(()=>{!a||!s||(v(s),T(null))},[a,s]),!a)return null;const F=dd.find(L=>L.font===r.fontFamily),H=r.virtualKeys&&r.virtualKeys.length>0?r.virtualKeys:Ws(),re=S||y,le=r.agentKeymaps[re]||{},ye=Hg(re,le),Me=Kg(re,le),Ke=Me.filter(L=>!L.hidden).length,nt=L=>L.custom?L.customLabel||"":p(`agentActions.${L.labelKey}`),Ge=L=>{try{return qs(L.combo)}catch{return L.combo}},N=L=>{u({agentKeymaps:{...r.agentKeymaps,[re]:L}})},q=(L,xe)=>{var we;N({...le,actions:{...le.actions,[L]:{...(we=le.actions)==null?void 0:we[L],...xe}}})},ce=L=>{q(L.id,{keys:L.defaultCombo})},Le=(L,xe)=>{const we=L+(xe==="up"?-1:1);if(we<0||we>=ye.length)return;const Ee=ye.map(_e=>_e.id);[Ee[L],Ee[we]]=[Ee[we],Ee[L]],N({...le,order:Ee})},J=L=>{var xe;N({...le,custom:(le.custom||[]).filter(we=>we.id!==L),order:(xe=le.order)==null?void 0:xe.filter(we=>we!==L)})},Ve=()=>N($v(le)),Ue=()=>{const L={...r.agentKeymaps};delete L[re],u({agentKeymaps:L})},Re=()=>{const L=z.trim();if(!L)return;try{Ci(Y)}catch{return}const xe=`custom-${Date.now().toString(36)}`;N({...le,custom:[...le.custom||[],{id:xe,label:L,keys:Y.trim()}],order:[...ye.map(we=>we.id),xe]}),B(""),ae("")},Oe=L=>L instanceof Si?p(`agentKeymaps.errors.${L.code}`,L.params):String(L),je=(L,xe)=>`${L}:${xe}`,Xe=(L,xe)=>{const we=je(re,L);A.current={...A.current,[we]:xe},G(A.current);try{Ci(xe),q(L,{keys:xe})}catch{}},Bt=L=>{const xe=je(re,L),we=A.current[xe];if(we!==void 0){delete A.current[xe],G({...A.current});try{Ci(we),q(L,{keys:we})}catch{}}},jt=typeof window<"u"&&window.isSecureContext&&"Notification"in window,Fe=()=>{const L=_g();u({fontSize:L.fontSize,fontFamily:L.fontFamily,toolbarVisible:L.toolbarVisible,vibrateOnKeyPress:L.vibrateOnKeyPress,predictiveEcho:L.predictiveEcho,agentAlertBadge:L.agentAlertBadge,agentAlertSound:L.agentAlertSound,agentAlertVibrate:L.agentAlertVibrate,agentAlertNotify:L.agentAlertNotify,language:L.language,virtualKeys:L.virtualKeys}),f("info",p("settings.resetDefaultsToast"))},qt=L=>{const xe=H.map(we=>we.id===L?{...we,enabled:!we.enabled}:we);u({virtualKeys:xe})},St=(L,xe)=>{const we=xe==="up"?L-1:L+1;if(we<0||we>=H.length)return;const Ee=[...H],_e=Ee[L];Ee[L]=Ee[we],Ee[we]=_e,u({virtualKeys:Ee})},mt=L=>{if(H.some(we=>we.id===L.id)){const we=H.map(Ee=>Ee.id===L.id?{...Ee,enabled:!0}:Ee);u({virtualKeys:we})}else{const we=[...H,{...L,enabled:!0}];u({virtualKeys:we})}ee(!1)},V=L=>{const xe=H.filter(we=>we.id!==L);u({virtualKeys:xe})},me=()=>{u({virtualKeys:Ws()}),f("info",p("toasts.keyLayoutReset"))},Ye=10,pt=24;return d.jsxs(Do,{isOpen:a,onClose:i,title:p("settings.title"),subtitle:p("settings.subtitle"),closeLabel:p("common.closeDialog"),size:"lg",hints:[{keys:"esc",action:p("common.close")}],footer:d.jsxs(d.Fragment,{children:[d.jsx(ke,{variant:"ghost",onClick:Fe,children:p("settings.resetDefaults")}),d.jsx(ke,{variant:"primary",onClick:i,children:p("common.done")})]}),children:[d.jsx(Ad,{tabs:[{id:"appearance",label:p("settings.tabAppearance"),index:1},{id:"virtualKeys",label:p("settings.tabVirtualKeys"),index:2},{id:"agentKeymaps",label:p("settings.tabAgentKeymaps"),index:3}],activeId:b,onSelect:L=>v(L),className:"mb-3 border-b border-tui-border-dim pb-1"}),b==="appearance"&&d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"space-y-1",children:[d.jsx(vn,{children:p("settings.languageLabel")}),d.jsxs("div",{className:"grid gap-0.5 sm:grid-cols-2",children:[d.jsx(Ks,{name:"ui-language",checked:m==="zh",onChange:()=>h("zh"),label:"简体中文"}),d.jsx(Ks,{name:"ui-language",checked:m==="en",onChange:()=>h("en"),label:"English"})]})]}),d.jsxs("div",{className:"space-y-1",children:[d.jsx(vn,{htmlFor:"terminal-font-select",children:p("settings.fontFamilyLabel")}),d.jsxs(Ro,{id:"terminal-font-select",value:r.fontFamily,onChange:L=>u({fontFamily:L.target.value}),"aria-label":p("settings.fontFamilyLabel"),children:[!F&&d.jsx("option",{value:r.fontFamily,children:r.fontFamily}),dd.map(L=>d.jsx("option",{value:L.font,children:p(`fontPresets.${L.id}`)||L.name},L.id))]}),d.jsxs("div",{className:"overflow-x-auto whitespace-nowrap border border-tui-border bg-tui-mantle px-2 py-1.5 leading-snug text-tui-text",style:{fontFamily:r.fontFamily,fontSize:`${r.fontSize}px`},children:[d.jsx("span",{className:"text-tui-ok",children:"$"}),' echo "Herdr 0O 1lI ',' [] () -> => !="']})]}),d.jsxs("div",{className:"space-y-1",children:[d.jsx(vn,{htmlFor:"terminal-font-size",children:p("settings.fontSizeLabel",{size:r.fontSize})}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(c1,{value:(r.fontSize-Ye)/(pt-Ye),width:24,className:"hidden shrink-0 sm:inline-flex"}),d.jsx("input",{id:"terminal-font-size",type:"range",min:Ye,max:pt,step:1,value:r.fontSize,onChange:L=>u({fontSize:Number(L.target.value)}),className:"h-1 w-full cursor-pointer appearance-none bg-tui-border accent-tui-accent"})]}),d.jsxs("div",{className:"flex justify-between text-tui-sm text-tui-faint",children:[d.jsx("span",{children:p("settings.fontSizeCompact")}),d.jsx("span",{children:p("settings.fontSizeDefault")}),d.jsx("span",{children:p("settings.fontSizeLarge")})]}),d.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:p("settings.mobileFontNote")}),d.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:p("settings.windowZoomSharedNote")})]}),d.jsx(fi,{}),d.jsxs("div",{className:"space-y-1",children:[d.jsx(vn,{children:p("settings.predictiveEchoLabel")}),d.jsxs("div",{className:"grid gap-0.5 sm:grid-cols-3",children:[d.jsx(Ks,{name:"predictive-echo",checked:r.predictiveEcho==="auto",onChange:()=>u({predictiveEcho:"auto"}),label:p("settings.predictiveEchoAuto")}),d.jsx(Ks,{name:"predictive-echo",checked:r.predictiveEcho==="always",onChange:()=>u({predictiveEcho:"always"}),label:p("settings.predictiveEchoAlways")}),d.jsx(Ks,{name:"predictive-echo",checked:r.predictiveEcho==="off",onChange:()=>u({predictiveEcho:"off"}),label:p("settings.predictiveEchoOff")})]}),d.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:p("settings.predictiveEchoDesc")})]}),d.jsx(fi,{}),d.jsxs("div",{className:"space-y-1",children:[d.jsx(ta,{checked:r.toolbarVisible,onChange:L=>u({toolbarVisible:L}),label:p("settings.touchKeyToolbar"),description:p("settings.touchKeyToolbarDesc")}),d.jsx(ta,{checked:r.vibrateOnKeyPress,onChange:L=>u({vibrateOnKeyPress:L}),label:p("settings.touchHaptics"),description:p("settings.touchHapticsDesc")})]}),d.jsx(fi,{}),d.jsxs("div",{className:"space-y-1",children:[d.jsx(vn,{children:p("settings.agentAlertsLabel")}),d.jsx(ta,{checked:r.agentAlertBadge,onChange:L=>u({agentAlertBadge:L}),label:p("settings.agentAlertBadge"),description:p("settings.agentAlertBadgeDesc")}),d.jsx(ta,{checked:r.agentAlertVibrate,onChange:L=>u({agentAlertVibrate:L}),label:p("settings.agentAlertVibrate"),description:p("settings.agentAlertVibrateDesc")}),d.jsx(ta,{checked:r.agentAlertSound,onChange:L=>{u({agentAlertSound:L}),L&&($g(),Fg("done"))},label:p("settings.agentAlertSound"),description:p("settings.agentAlertSoundDesc")}),jt&&d.jsx(ta,{checked:r.agentAlertNotify,onChange:L=>{if(L&&Notification.permission!=="granted"){Notification.requestPermission().then(xe=>u({agentAlertNotify:xe==="granted"}));return}u({agentAlertNotify:L})},label:p("settings.agentAlertNotify"),description:p("settings.agentAlertNotifyDesc")})]}),d.jsx(fi,{}),d.jsxs("p",{className:"text-tui-sm leading-snug text-tui-faint",children:[d.jsx("span",{"aria-hidden":"true",className:"mr-1",children:He.arrowRight}),p("settings.colorPassthroughNote")]})]}),b==="virtualKeys"&&d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{className:"flex items-start justify-between gap-2",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsx("h3",{className:"text-tui font-bold uppercase text-tui-accent",children:p("virtualKeyboard.customizeTitle")}),d.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:p("virtualKeyboard.customizeDesc")})]}),d.jsx(ke,{variant:"ghost",onClick:me,className:"shrink-0",children:p("virtualKeyboard.resetLayout")})]}),d.jsx("div",{className:"relative max-h-72 overflow-y-auto overscroll-contain border border-tui-border bg-tui-mantle",children:H.map((L,xe)=>d.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-tui-border-dim px-2 py-1 last:border-b-0 hover:bg-tui-selection",children:[d.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[d.jsx("input",{type:"checkbox",checked:L.enabled,onChange:()=>qt(L.id),className:"sr-only",id:`toggle-${L.id}`}),d.jsx("label",{htmlFor:`toggle-${L.id}`,className:se("shrink-0 cursor-pointer select-none font-bold",L.enabled?"text-tui-ok":"text-tui-faint"),"aria-hidden":"true",children:L.enabled?"[x]":"[ ]"}),d.jsx(Dp,{className:se(!L.enabled&&"opacity-50"),children:L.label}),d.jsx("span",{className:"truncate text-tui-sm text-tui-muted",children:rd(L,p)})]}),d.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[d.jsx(ke,{variant:"ghost",brackets:!1,disabled:xe===0,onClick:()=>St(xe,"up"),title:p("virtualKeyboard.moveUp"),"aria-label":p("virtualKeyboard.moveUp"),className:"px-1",children:"↑"}),d.jsx(ke,{variant:"ghost",brackets:!1,disabled:xe===H.length-1,onClick:()=>St(xe,"down"),title:p("virtualKeyboard.moveDown"),"aria-label":p("virtualKeyboard.moveDown"),className:"px-1",children:"↓"}),d.jsx(ke,{variant:"ghost",brackets:!1,onClick:()=>V(L.id),title:p("virtualKeyboard.deleteKeyTitle"),"aria-label":p("virtualKeyboard.deleteKeyTitle"),className:"px-1 text-tui-bad hover:text-tui-bad",children:He.cross})]})]},L.id))}),d.jsx(ke,{block:!0,glyph:"+",onClick:()=>ee(!he),className:"border-dashed",children:p("virtualKeyboard.addKey")}),he&&d.jsxs("div",{className:"space-y-2 border border-tui-border bg-tui-mantle p-2",children:[d.jsx(fi,{label:p("virtualKeyboard.availableKeys")}),d.jsx("div",{className:"relative flex max-h-48 flex-wrap gap-1 overflow-y-auto overscroll-contain",children:pv.map(L=>{const xe=H.some(we=>we.id===L.id);return d.jsxs("button",{type:"button",onClick:()=>mt(L),title:rd(L,p),className:se("tui-focusable flex select-none items-center gap-1 border px-1.5 py-0.5 text-tui-sm transition-colors",xe?"border-tui-border-dim text-tui-faint":"border-tui-border text-tui-text hover:border-tui-accent hover:text-tui-accent"),children:[d.jsx("span",{children:L.label}),d.jsx("span",{"aria-hidden":"true",className:xe?"text-tui-ok":"text-tui-accent",children:xe?He.check:"+"})]},L.id)})})]})]}),b==="agentKeymaps"&&d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{className:"space-y-1",children:[d.jsx(vn,{htmlFor:"agent-keymap-profile",children:p("agentKeymaps.settingsProfileLabel")}),d.jsx(Ro,{id:"agent-keymap-profile","aria-label":p("agentKeymaps.settingsProfileLabel"),value:re,onChange:L=>T(L.target.value),children:Ov.map(L=>d.jsx("option",{value:L,children:$a[L].name},L))}),$a[re].configHint&&d.jsx("p",{className:"text-tui-sm text-tui-faint",children:p("agentKeymaps.configHint",{path:$a[re].configHint})})]}),d.jsx(fi,{label:p("agentKeymaps.barGroup")}),d.jsxs("div",{className:"space-y-2",children:[d.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:p("agentKeymaps.barHint",{profile:$a[re].name,count:Ke})}),d.jsx("div",{role:"group","aria-label":p("agentKeymaps.barGroup"),"data-testid":"agent-bar-choices",className:"flex flex-wrap gap-1",children:Me.map(L=>{const xe=nt(L),we=Ge(L),Ee=!L.hidden;return d.jsxs("button",{type:"button","data-testid":`agent-bar-toggle-${L.id}`,"aria-pressed":Ee,onClick:()=>q(L.id,{hidden:Ee}),title:`${we} ${xe}`.trim(),className:se("tui-focusable inline-flex h-8 select-none items-center gap-1 border px-1.5 text-tui-sm transition-colors",Ee?"border-tui-accent bg-tui-accent text-tui-crust":"border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent"),children:[d.jsx("span",{"aria-hidden":"true",className:"font-bold",children:Ee?He.check:"+"}),d.jsx("span",{className:"font-bold",children:we}),d.jsx("span",{className:Ee?void 0:"opacity-80",children:xe})]},L.id)})}),d.jsx(ke,{variant:"ghost",onClick:Ve,children:p("agentKeymaps.restoreBar")})]}),d.jsx(fi,{label:p("agentKeymaps.agentGroup")}),d.jsx("div",{className:"relative max-h-72 overflow-y-auto overscroll-contain border border-tui-border bg-tui-mantle",children:ye.map((L,xe)=>{var ze,Qe;const we=nt(L),Ee=p("agentKeymaps.defaultCombo",{combo:qs(L.defaultCombo)}),_e=((Qe=(ze=le.actions)==null?void 0:ze[L.id])==null?void 0:Qe.keys)??L.combo,ot=je(re,L.id),$e=E[ot]??_e;let oe="",ve=null;try{Ci($e),oe=qs($e)}catch(kt){ve=Oe(kt)}return d.jsxs("div",{"data-testid":`agent-setting-row-${L.id}`,className:NS,children:[d.jsx(Dp,{className:"max-w-full justify-self-start overflow-hidden whitespace-nowrap font-bold [grid-area:cap]",children:oe||"—"}),d.jsxs("span",{className:"min-w-0 truncate text-tui-sm text-tui-text [grid-area:label]",title:we,children:[we,!L.verified&&d.jsx("span",{className:"ml-1 text-tui-sm text-tui-faint",children:p("agentKeymaps.unverified")})]}),d.jsxs("label",{className:"sr-only",htmlFor:`agent-combo-${L.id}`,children:[p("agentKeymaps.shortcutLabel")," ",we]}),d.jsx(xn,{id:`agent-combo-${L.id}`,"aria-label":`${p("agentKeymaps.shortcutLabel")} ${we}`,value:$e,onChange:kt=>Xe(L.id,kt.target.value),onBlur:()=>Bt(L.id),onKeyDown:kt=>{kt.key==="Enter"&&kt.currentTarget.blur()},placeholder:p("agentKeymaps.comboPlaceholder"),"aria-invalid":!!ve,className:"w-full min-w-0 [grid-area:combo]"}),d.jsx("span",{className:"min-w-0 truncate text-tui-sm text-tui-faint [grid-area:default]",title:Ee,children:Ee}),d.jsxs("div",{className:"flex items-center gap-1 [grid-area:actions]",children:[d.jsx(ke,{variant:"ghost",brackets:!1,className:"px-1",onClick:()=>ce(L),title:p("agentKeymaps.resetAction"),"aria-label":`${p("agentKeymaps.resetAction")} ${we}`,children:"↺"}),d.jsx(ke,{variant:"ghost",brackets:!1,className:"px-1",disabled:xe===0,onClick:()=>Le(xe,"up"),title:p("agentKeymaps.moveUp"),"aria-label":`${p("agentKeymaps.moveUp")} ${we}`,children:"↑"}),d.jsx(ke,{variant:"ghost",brackets:!1,className:"px-1",disabled:xe===ye.length-1,onClick:()=>Le(xe,"down"),title:p("agentKeymaps.moveDown"),"aria-label":`${p("agentKeymaps.moveDown")} ${we}`,children:"↓"}),L.custom&&d.jsx(ke,{variant:"ghost",brackets:!1,className:"px-1 text-tui-bad",onClick:()=>J(L.id),title:p("agentKeymaps.removeCustom"),"aria-label":`${p("agentKeymaps.removeCustom")} ${we}`,children:He.cross})]}),ve&&d.jsx("p",{className:"col-span-full text-tui-sm text-tui-bad",role:"alert",children:p("agentKeymaps.invalidCombo",{error:ve})})]},L.id)})}),d.jsx(fi,{label:p("agentKeymaps.addCustom")}),d.jsxs("div",{className:"flex flex-wrap items-end gap-2",children:[d.jsxs("label",{className:"min-w-[9rem] flex-1 space-y-1 text-tui-sm text-tui-faint",children:[d.jsx("span",{children:p("agentKeymaps.customLabel")}),d.jsx(xn,{value:z,onChange:L=>B(L.target.value)})]}),d.jsxs("label",{className:"min-w-[9rem] flex-1 space-y-1 text-tui-sm text-tui-faint",children:[d.jsx("span",{children:p("agentKeymaps.customCombo")}),d.jsx(xn,{value:Y,onChange:L=>ae(L.target.value)})]}),d.jsx(ke,{onClick:Re,disabled:!z.trim()||!Y.trim(),children:p("agentKeymaps.addAction")})]}),Y.trim()&&(()=>{try{return Ci(Y),d.jsx("p",{className:"text-tui-sm text-tui-faint",children:qs(Y)})}catch(L){const xe=Oe(L);return d.jsx("p",{className:"text-tui-sm text-tui-bad",role:"alert",children:xe})}})(),d.jsx(ke,{variant:"ghost",onClick:Ue,children:p("agentKeymaps.restoreProfile")})]})]})},RS={success:"ok",warning:"warn",error:"bad",info:"accent"},LS={success:He.check,warning:He.warn,error:He.cross,info:"›"},_S=()=>{const{toasts:a,removeToast:i,t:s}=ct();return a.length===0?null:d.jsx("div",{className:"pointer-events-none fixed right-2 top-12 z-50 flex w-[calc(100vw-16px)] max-w-sm flex-col gap-1","aria-live":"polite","aria-atomic":"true",children:a.map(r=>{const u=RS[r.type];return d.jsxs("div",{className:se("pointer-events-auto flex items-start gap-2 border border-tui-border border-l-2 bg-tui-base px-2 py-1 text-tui",ni[u].edgeL),role:"alert",children:[d.jsx("span",{"aria-hidden":"true",className:se("shrink-0 font-bold",ni[u].text),children:LS[r.type]}),d.jsx("div",{className:"min-w-0 flex-1 break-words leading-snug text-tui-text",children:r.message}),r.count>1&&d.jsxs("span",{className:"shrink-0 border border-tui-border-dim px-1 text-tui-sm text-tui-muted","aria-label":`×${r.count}`,children:["×",r.count]}),d.jsx("button",{type:"button",onClick:()=>i(r.id),className:"tui-focusable shrink-0 select-none px-0.5 text-tui-faint transition-colors hover:text-tui-bad","aria-label":s("common.dismissNotification"),children:d.jsx("span",{"aria-hidden":"true",children:He.cross})})]},r.id)})})},kb=[{status:"blocked",level:"warn"},{status:"done",level:"ok"},{status:"working",level:"accent"}];function jS(a){return a?a.total>0||kb.some(({status:i})=>{var s;return(((s=a.counts)==null?void 0:s[i])??0)>0}):!1}const Rb=({className:a,compact:i=!1})=>{const{agentStatus:s,t:r}=ct();if(!s)return null;const u=kb.map(({status:m,level:h})=>{var p;return{status:m,level:h,count:((p=s.counts)==null?void 0:p[m])??0}}).filter(m=>m.count>0),f=i?u.slice(0,1):u;return f.length===0?s.total===0?null:d.jsxs("span",{"data-testid":"agent-status-chip",className:se("flex shrink-0 items-center gap-1 px-1 text-tui-muted",a),title:r("agents.title"),children:[d.jsx(kn,{level:"idle"}),d.jsx("span",{className:"text-tui-faint",children:r("agents.allIdle")})]}):d.jsx("span",{"data-testid":"agent-status-chip",className:se("flex shrink-0 items-center gap-2 px-1",a),title:r("agents.title"),children:f.map(({status:m,level:h,count:p})=>d.jsxs("span",{className:"flex items-center gap-1 text-tui-muted",children:[d.jsx(kn,{level:h}),d.jsx("span",{className:"text-tui-text",children:p}),d.jsx("span",{className:"text-tui-faint",children:r(`agents.${m}`)})]},m))})},Rd=({onAddProfile:a,mobile:i=!1,statusBar:s=!1})=>{const{profiles:r,activeProfileId:u,activeProfile:f,connectionState:m,switchProfile:h,renameProfile:p,removeProfile:y,t:b}=ct(),[v,S]=w.useState(!1),[T,E]=w.useState(null),[G,A]=w.useState(""),z=w.useRef(null);w.useEffect(()=>{if(!v)return;const F=H=>{z.current&&!z.current.contains(H.target)&&S(!1)};return document.addEventListener("pointerdown",F),()=>document.removeEventListener("pointerdown",F)},[v]);const B=(F,H)=>{E(F),A(H)},Y=F=>{const H=G.trim();H&&p(F,H),E(null)},ae=F=>{typeof window<"u"&&!window.confirm(b("profiles.removeConfirm"))||(y(F),E(null))},he=(f==null?void 0:f.displayName)||b("profiles.addHost"),ee=m==="connected"?"ok":m==="connecting"||m==="reconnecting"?"warn":m==="error"?"bad":"idle";return d.jsxs("div",{ref:z,className:se("relative min-w-0",i&&"w-full",s&&"flex-1"),children:[d.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":v,"aria-label":b("profiles.switcherLabel"),onClick:()=>S(F=>!F),className:se("tui-focusable flex min-w-0 items-center gap-1.5 border border-transparent text-left text-tui-muted transition-colors hover:border-tui-border hover:text-tui-accent",s?"min-h-11 w-full max-w-none px-2":i?"min-h-11 w-full px-2":"min-h-[24px] max-w-[18rem] px-1"),children:[d.jsx(kn,{level:ee}),d.jsx("span",{className:se("truncate text-tui-text",s&&"min-w-0 flex-1"),children:he}),d.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint",children:v?He.chevronDown:He.chevronRight})]}),v&&d.jsxs("div",{role:"menu","aria-label":b("profiles.switcherLabel"),className:se("absolute bottom-full left-0 z-[100] mb-1 max-h-[min(70vh,24rem)] overflow-y-auto border border-tui-border bg-tui-base p-1 shadow-lg",s?"w-80 max-w-[calc(100vw-1rem)]":i?"inset-x-0 bottom-auto top-full mt-1 mb-0 w-full":"w-80 max-w-[calc(100vw-1rem)]"),children:[d.jsx("div",{className:"border-b border-tui-border-dim px-2 py-1 text-tui-sm uppercase text-tui-faint",children:b("profiles.title")}),r.length===0?d.jsx("p",{className:"px-2 py-2 text-tui-sm text-tui-muted",children:b("profiles.empty")}):r.map(F=>{const H=F.id===u,re=F.id===T;return d.jsxs("div",{role:"none",className:"border-b border-tui-border-dim last:border-b-0",children:[d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsxs("button",{type:"button",role:"menuitem","aria-current":H?"true":void 0,onClick:()=>{h(F.id),S(!1)},className:se("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",H?"text-tui-accent":"text-tui-text"),children:[d.jsx("span",{"aria-hidden":"true",className:"w-3 shrink-0",children:H?He.cursor:""}),d.jsxs("span",{className:"min-w-0 flex-1",children:[d.jsx("span",{className:"block truncate font-bold",children:F.displayName}),d.jsx("span",{className:"block truncate text-tui-sm text-tui-faint",title:F.hostname||F.hostId,children:F.hostname||F.hostId||F.wsUrl})]}),H&&d.jsx("span",{className:"shrink-0 text-tui-sm text-tui-ok",children:b("profiles.current")})]}),d.jsx("button",{type:"button",role:"menuitem","aria-label":b("profiles.rename"),title:b("profiles.rename"),onClick:()=>B(F.id,F.displayName),className:"tui-focusable min-h-11 min-w-11 px-2 text-tui-muted hover:text-tui-accent",children:He.ellipsis})]}),re&&d.jsxs("div",{className:"flex items-center gap-1 px-2 pb-2",children:[d.jsx("input",{autoFocus:!0,value:G,maxLength:64,onChange:le=>A(le.target.value),onKeyDown:le=>{le.key==="Enter"&&Y(F.id),le.key==="Escape"&&E(null)},"aria-label":b("profiles.rename"),className:"tui-input min-w-0 flex-1 px-2 py-1 text-tui"}),d.jsx(ke,{onClick:()=>Y(F.id),variant:"primary",className:"min-h-11",children:b("common.save")}),d.jsx(ke,{onClick:()=>ae(F.id),variant:"danger",className:"min-h-11",children:b("profiles.remove")})]})]},F.id)}),d.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{S(!1),a()},className:"tui-focusable flex min-h-11 w-full items-center gap-2 px-2 text-left text-tui-accent hover:bg-tui-selection",children:[d.jsx("span",{"aria-hidden":"true",children:"+"}),d.jsx("span",{children:b("profiles.addHost")})]})]})]})};function Lb(){const{updateStatus:a,ignoredUpdate:i}=ct();return!!(a!=null&&a.updateAvailable)&&i!==(a==null?void 0:a.latest)}const _b=({compact:a=!1,className:i})=>{const{updateStatus:s,t:r}=ct(),u=Lb(),[f,m]=w.useState(!1);if(!u||!s)return null;const{latest:h,restartPending:p}=s,y=p?r("update.chipRestart",{version:h}):a?r("update.chipCompact",{version:h}):r("update.chip",{version:h});return d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button","data-testid":"update-chip",onClick:()=>m(!0),title:r("update.title"),className:se("tui-focusable shrink-0 whitespace-nowrap px-1 text-tui-warn hover:underline",i),children:y}),d.jsx(DS,{isOpen:f,onClose:()=>m(!1)})]})},sd=({command:a})=>{const{addToast:i,t:s}=ct();return d.jsxs("div",{className:"flex items-center gap-2 border border-tui-border bg-tui-mantle px-2 py-1",children:[d.jsx("span",{"aria-hidden":"true",className:"shrink-0 select-none text-tui-ok",children:"$"}),d.jsx("code",{className:"min-w-0 flex-1 break-all text-tui-text",children:a}),d.jsx(ke,{glyph:"⧉",className:"shrink-0",onClick:()=>{Ll(a).then(r=>{i(r==="failed"?"error":"success",s(r==="failed"?"clipboard.copyFailed":"toasts.commandCopied"))})},children:s("common.copy")})]})},DS=({isOpen:a,onClose:i})=>{const{updateStatus:s,ignoreUpdate:r,hostname:u,hostId:f,t:m}=ct();if(!s)return null;const{current:h,installed:p,latest:y,restartPending:b}=s;return d.jsx(Do,{isOpen:a,onClose:i,title:m("update.title"),closeLabel:m("common.closeDialog"),size:"md",footer:d.jsxs(d.Fragment,{children:[d.jsx(ke,{variant:"ghost",onClick:()=>{r(y),i()},children:m("update.ignore")}),d.jsx(ke,{variant:"primary",onClick:i,children:m("common.done")})]}),children:d.jsxs("div",{className:"space-y-3","data-testid":"update-modal",children:[d.jsxs("div",{className:"space-y-0.5",children:[d.jsx(yn,{label:m("common.host"),labelWidth:10,children:u||f||"—"}),d.jsx(yn,{label:m("update.running"),labelWidth:10,children:h}),p!==h?d.jsx(yn,{label:m("update.installed"),labelWidth:10,children:p}):null,d.jsx(yn,{label:m("update.latest"),labelWidth:10,children:d.jsx("span",{className:"text-tui-ok",children:y})})]}),b?d.jsxs(d.Fragment,{children:[d.jsx("p",{className:"leading-snug text-tui-text",children:m("update.restartPending",{version:p})}),d.jsx(sd,{command:"herdr-remote restart"})]}):d.jsxs(d.Fragment,{children:[d.jsxs("p",{className:"leading-snug text-tui-text",children:[d.jsx("span",{"aria-hidden":"true",className:"mr-1 text-tui-accent",children:He.arrowRight}),m("update.stepTui")]}),d.jsx("p",{className:"leading-snug text-tui-muted",children:m("update.stepCli")}),d.jsx(sd,{command:`npm install -g herdr-remote@${y} --prefer-online`}),d.jsx(sd,{command:"herdr-remote restart"}),d.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:m("update.restartNote")})]})]})})},OS=({onAddProfile:a=()=>{}})=>{const{connectionState:i,role:s,hostId:r,assignedClientId:u,sharedWindowCount:f,settings:m,rttMs:h,agentStatus:p,t:y}=ct(),b=Oo(i,y),v=i==="connected",S=Lb();return d.jsx(cb,{left:d.jsxs(d.Fragment,{children:[d.jsx(Rd,{onAddProfile:a}),d.jsx(Op,{items:[d.jsxs("span",{className:"flex items-center gap-1",children:[d.jsx(kn,{level:b.level}),d.jsx("span",{className:"text-tui-text",children:b.label})]},"status"),v?d.jsx(jo,{tone:s==="controller"?"ok":"warn",children:y(s==="controller"?"role.sharedControl":"common.viewer")},"role"):null,v&&f>1?d.jsx("span",{className:"text-tui-muted",children:y("role.sharedWindows",{count:f})},"windows"):null,r?d.jsxs("span",{children:[d.jsxs("span",{className:"text-tui-faint",children:[y("common.host"),":"]})," ",d.jsx("span",{className:"text-tui-text",children:r})]},"host"):null,d.jsxs("span",{children:[d.jsx("span",{className:"text-tui-faint",children:y("header.clientIdLabel")})," ",d.jsx("span",{className:"text-tui-text",children:u||m.clientId})]},"client")]})]}),right:d.jsx(Op,{items:[S?d.jsx(_b,{},"update"):null,v&&jS(p)?d.jsx(Rb,{},"agents"):null,h!==null?d.jsxs("span",{className:"text-tui-muted",children:[y("header.latencyTitle"),": ",d.jsxs("span",{className:"text-tui-text",children:[h,"ms"]})]},"rtt"):null,d.jsx("span",{className:"hidden text-tui-faint sm:inline",children:y("header.tagline")},"mode")]})})},zS=[[/\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"]],US=[[/\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 ug(a,i){for(const[s,r]of a)if(s.test(i))return r;return null}function Ld(a){const i=typeof a=="string"?a.trim():"";if(!i)return{label:"",raw:""};const s=ug(zS,i),r=ug(US,i);return s&&r?{label:`${s} · ${r}`,raw:i}:s?{label:s,raw:i}:r?{label:r,raw:i}:{label:i.length>32?`${i.slice(0,32)}…`:i,raw:i}}function dg(a){if(a===0)return"0 B";const i=1024,s=["B","KB","MB","GB"],r=Math.floor(Math.log(a)/Math.log(i));return`${(a/Math.pow(i,r)).toFixed(1)} ${s[r]}`}const BS=({clients:a})=>{const{t:i}=ct(),s=[{key:"id",header:i("admin.colClientId"),render:r=>d.jsxs("span",{className:"flex items-center gap-1.5",children:[d.jsx(kn,{level:"ok"}),d.jsx("span",{className:"font-bold text-tui-text",children:r.id})]})},{key:"role",header:i("admin.colRole"),width:12,render:r=>{const u=r.role==="controller";return d.jsx(jo,{tone:u?"ok":"warn",children:i(u?"common.controller":"common.viewer")})}},{key:"device",header:i("admin.colDevice"),render:r=>{const u=Ld(r.userAgent);return u.label?d.jsx("span",{className:"text-tui-muted",title:u.raw,children:u.label}):d.jsx("span",{className:"text-tui-faint",children:i("admin.unknownDevice")})}},{key:"ip",header:i("admin.colIp"),render:r=>d.jsx("span",{className:"text-tui-muted",children:r.ip||"127.0.0.1"})},{key:"connectedAt",header:i("admin.colConnectedAt"),render:r=>d.jsx("span",{className:"text-tui-muted",children:r.connectedAt?new Date(r.connectedAt).toLocaleTimeString():i("admin.startedRecently")})},{key:"traffic",header:i("admin.colTraffic"),align:"right",render:r=>d.jsxs("span",{className:"whitespace-nowrap",children:[d.jsx("span",{className:"text-tui-accent",children:dg(r.bytesReceived||0)}),d.jsx("span",{"aria-hidden":"true",className:"mx-1 text-tui-faint",children:"/"}),d.jsx("span",{className:"text-tui-ok",children:dg(r.bytesSent||0)})]})}];return d.jsx(on,{title:i("admin.connectedClientsTitle",{count:a.length}),bodyClassName:"-mx-1",children:d.jsx(Ed,{columns:s,items:a,rowKey:r=>r.id,empty:i("admin.noClients")})})},fg={online:"ok",busy:"ok",reconnecting:"warn",offline:"idle"};function HS(a=[],i=[]){const s=new Map;for(const f of i){if(!(f!=null&&f.hostId))continue;const m=s.get(f.hostId);m?m.push(f):s.set(f.hostId,[f])}const r=a.map(f=>{const m=s.get(f.id)||[];return{id:f.id,hostname:f.hostname||f.id,status:f.status||"online",connectedDeviceCount:f.connectedDeviceCount??0,pairedDeviceCount:f.pairedDeviceCount??m.length,devices:m,fromRosterOnly:!1}}),u=new Set(r.map(f=>f.id));for(const[f,m]of s)u.has(f)||r.push({id:f,hostname:f,status:"offline",connectedDeviceCount:0,pairedDeviceCount:m.length,devices:m,fromRosterOnly:!0});return r.sort((f,m)=>f.fromRosterOnly!==m.fromRosterOnly?f.fromRosterOnly?1:-1:f.hostname.localeCompare(m.hostname))}const KS=({hosts:a,devices:i})=>{const{t:s}=ct(),r=HS(a,i),u={online:s("admin.hostStatusOnline"),busy:s("admin.hostStatusBusy"),reconnecting:s("admin.hostStatusReconnecting"),offline:s("admin.hostStatusOffline")};return d.jsx(on,{title:s("admin.hostsTitle",{count:r.length}),bodyClassName:"space-y-2",children:r.length===0?d.jsx("p",{className:"px-1 py-2 text-tui text-tui-faint",children:s("admin.noHosts")}):r.map(f=>d.jsxs("div",{className:"border border-tui-border-dim bg-tui-mantle",children:[d.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1 border-b border-tui-border-dim px-2 py-1",children:[d.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-tui",children:[d.jsx(kn,{level:fg[f.status]}),d.jsx("span",{className:"truncate font-bold text-tui-text",children:f.hostname}),f.hostname!==f.id?d.jsx("code",{className:"truncate text-tui-sm text-tui-faint",children:f.id}):null]}),d.jsxs("span",{className:"flex shrink-0 items-center gap-3 text-tui-sm",children:[d.jsx(jo,{tone:fg[f.status],children:u[f.status]}),d.jsx("span",{className:"text-tui-accent",children:s("admin.hostConnectedDevices",{count:f.connectedDeviceCount})}),d.jsx("span",{className:"text-tui-muted",children:s("admin.hostPairedDevices",{count:f.pairedDeviceCount})})]})]}),f.devices.length>0?d.jsx("ul",{className:"divide-y divide-tui-border-dim",children:f.devices.map(m=>{const h=Ld(m.userAgent);return d.jsxs("li",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-0.5 px-2 py-0.5 text-tui",children:[d.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint",children:"·"}),d.jsx("span",{className:"truncate text-tui-text",title:h.raw,children:h.label||s("admin.unknownDevice")}),d.jsx("code",{className:"truncate text-tui-sm text-tui-muted",children:m.deviceId}),d.jsx("span",{className:"ml-auto shrink-0 text-tui-sm text-tui-faint",children:m.lastIp||"—"})]},m.deviceId)})}):d.jsx("p",{className:"px-2 py-1 text-tui-sm text-tui-faint",children:f.pairedDeviceCount>0?s("admin.hostRosterOperatorOnly"):s("admin.noDevices")})]},f.id))})},YS=({ptys:a})=>{const{t:i}=ct(),s=[{key:"id",header:i("admin.colPtyId"),render:r=>d.jsx("span",{className:"font-bold text-tui-accent",children:r.id})},{key:"pid",header:i("admin.colPid"),width:9,render:r=>d.jsx("span",{className:"text-tui-muted",children:r.pid})},{key:"command",header:i("admin.colCommand"),render:r=>d.jsx("code",{className:"border border-tui-border-dim bg-tui-mantle px-1 text-tui-text",children:r.command})},{key:"grid",header:i("admin.colGrid"),width:11,render:r=>d.jsxs("span",{className:"whitespace-nowrap text-tui-muted",children:[r.cols,d.jsx("span",{"aria-hidden":"true",className:"mx-0.5 text-tui-faint",children:"×"}),r.rows]})},{key:"cwd",header:i("admin.colCwd"),className:"max-w-xs truncate",render:r=>d.jsx("span",{className:"text-tui-muted",children:r.cwd||"~"})},{key:"viewers",header:i("admin.colViewers"),align:"right",width:9,render:r=>d.jsx("span",{className:"font-bold text-tui-ok",children:r.activeClients})}];return d.jsx(on,{title:i("admin.activePtysTitle",{count:a.length}),bodyClassName:"-mx-1",children:d.jsx(Ed,{columns:s,items:a,rowKey:r=>r.id,empty:i("admin.noPtys")})})};function IS(a){if(!a)return"—";const i=new Date(a);return Number.isNaN(i.getTime())?"—":i.toLocaleString()}const GS=({devices:a,onRevoke:i})=>{const{t:s}=ct(),[r,u]=w.useState(null),[f,m]=w.useState(null),h=async y=>{if(r!==y){u(y);return}m(y);try{await i(y)}finally{m(null),u(null)}},p=[{key:"device",header:s("admin.colDevice"),render:y=>{const b=Ld(y.userAgent);return d.jsx("span",{className:"text-tui-text",title:b.raw,children:b.label||s("admin.unknownDevice")})}},{key:"deviceId",header:s("admin.colDeviceId"),render:y=>d.jsx("span",{className:"text-tui-muted",children:y.deviceId})},{key:"ip",header:s("admin.colIp"),render:y=>d.jsx("span",{className:"text-tui-muted",children:y.lastIp||"—"})},{key:"lastSeen",header:s("admin.colLastSeen"),render:y=>d.jsx("span",{className:"whitespace-nowrap text-tui-muted",children:IS(y.lastSeenAt)})},{key:"actions",header:s("admin.colActions"),align:"right",render:y=>{const b=r===y.deviceId,v=f===y.deviceId;return d.jsx(ke,{variant:"danger",disabled:v,onClick:()=>void h(y.deviceId),onBlur:()=>u(S=>S===y.deviceId?null:S),"aria-label":s("admin.revokeDevice"),className:b?"bg-tui-bad text-tui-crust":void 0,children:v?d.jsx(la,{}):s(b?"admin.revokeConfirm":"admin.revokeDevice")})}}];return d.jsx(on,{title:s("admin.pairedDevicesTitle",{count:a.length}),bodyClassName:"-mx-1",children:d.jsx(Ed,{columns:p,items:a,rowKey:y=>y.deviceId,empty:s("admin.noDevices")})})};function jb(a){if(typeof window>"u"||!a||a.startsWith("/"))return"";try{const i=new URL(a.replace(/^ws/,"http")),s=i.pathname.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"");return i.origin===window.location.origin&&!s?"":`${i.origin}${s}`}catch{return""}}function Is(a,i){const s=jb(a);return s?`${s}${i.startsWith("/")?i:`/${i}`}`:i}const $S=({onBackToTerminal:a,onOpenPairing:i})=>{var qt,St,mt,V,me,Ye,pt,L,xe,we,Ee,_e,ot,$e;const{settings:s,updateSettings:r,addToast:u,t:f}=ct(),m=jb(s.wsUrl)||(typeof window<"u"?window.location.origin:"local"),h=((qt=s.adminTokens)==null?void 0:qt[m])||(m===(typeof window<"u"?window.location.origin:"local")?s.adminToken:"")||"",[p,y]=w.useState(null),[b,v]=w.useState(null),[S,T]=w.useState(!1),[E,G]=w.useState(!0),[A,z]=w.useState(null),[B,Y]=w.useState(!1),[ae,he]=w.useState(3e3),[ee,F]=w.useState(null),[H,re]=w.useState("overview"),[le,ye]=w.useState(!1),[Me,Ke]=w.useState(h),[nt,Ge]=w.useState(!!h),N="node bin/service.js pair";w.useEffect(()=>{Ke(h),Ge(!!h),y(null),v(null),T(!1)},[m]);const q=()=>{Ll(N).then(oe=>{if(oe==="failed"){u("error",f("clipboard.copyFailed"));return}ye(!0),u("success",f("toasts.commandCopied")),setTimeout(()=>ye(!1),2e3)})};w.useEffect(()=>{let oe=!0;G(!0);async function ve(){try{const ze=await fetch(Is(s.wsUrl,"/api/info"),{headers:{Accept:"application/json"}});if(ze.ok){const Qe=await ze.json();oe&&(v(Qe),T(!0));return}}catch{}if(oe){const ze=!!(s.wsUrl&&!s.wsUrl.startsWith("/")&&!s.wsUrl.includes("localhost")&&!s.wsUrl.includes("127.0.0.1")&&typeof window<"u"&&!s.wsUrl.startsWith(window.location.origin.replace("http","ws")));v({ok:!0,version:"0.1.0",protocol:1,relayMode:ze?"remote":"local",adminConfigured:!1,adminPath:"/admin",adminStatusPath:"/api/admin/status"}),T(!0)}}return ve(),()=>{oe=!1}},[s.wsUrl,m]);const ce=(b==null?void 0:b.relayMode)==="remote",Le=()=>{if(b!=null&&b.adminPath)return b.publicUrl?`${b.publicUrl.replace(/\/$/,"")}${b.adminPath}`:Is(s.wsUrl,b.adminPath);if(p!=null&&p.remoteAdminUrl)return p.remoteAdminUrl;if(s.wsUrl)try{return Is(s.wsUrl,"/admin")}catch{}return"/admin"},J=w.useCallback(async()=>{if(S){if(ce){if(!nt&&!Me){y(null),G(!1),z(null),Y(!1);return}try{G(!0);const oe=Is(s.wsUrl,(b==null?void 0:b.adminStatusPath)||"/api/admin/status"),ze=await fetch(oe,{headers:{Accept:"application/json","X-Relay-Admin-Token":Me}});if(ze.status===401||ze.status===403){Y(!0),z(f("admin.relayAdminAuthError")),y(null);return}if(!ze.ok)throw new Error(`HTTP ${ze.status}: ${ze.statusText}`);const Qe=await ze.json();y(Qe),z(null),Y(!1),F(new Date)}catch(oe){console.warn("GET /api/admin/status request failed:",oe),Y(!1),z(oe instanceof Error?oe.message:"Failed to fetch remote admin status"),y(null)}finally{G(!1)}return}try{G(!0);const oe={Accept:"application/json"};s.token&&(oe.Authorization=`Bearer ${s.token}`);const ve=await fetch("/api/status",{headers:oe});if(ve.status===401||ve.status===403){Y(!0),z(`Authentication failed (HTTP ${ve.status}): Access denied. Please configure an authorized token or pair with the host.`),y(null);return}if(!ve.ok)throw new Error(`HTTP ${ve.status}: ${ve.statusText}`);const ze=await ve.json();y(ze),z(null),Y(!1),F(new Date)}catch(oe){console.warn("GET /api/status request failed:",oe),Y(!1),z(oe instanceof Error?oe.message:"Failed to fetch status"),y(null)}finally{G(!1)}}},[S,ce,nt,Me,b,s.token,s.wsUrl,m,f]),Ve=w.useCallback(async oe=>{try{if(!(await fetch(Is(s.wsUrl,`/api/admin/devices/${encodeURIComponent(oe)}`),{method:"DELETE",headers:{Accept:"application/json","X-Relay-Admin-Token":Me}})).ok){z(f("admin.revokeFailed"));return}await J()}catch{z(f("admin.revokeFailed"))}},[Me,J,s.wsUrl,f]);w.useEffect(()=>{if(!S)return;J();let oe=null;const ve=()=>{ae>0&&!oe&&(oe=setInterval(()=>{document.visibilityState==="visible"&&J()},ae))},ze=()=>{oe&&(clearInterval(oe),oe=null)},Qe=()=>{document.visibilityState==="visible"?(J(),ve()):ze()};return ve(),document.addEventListener("visibilitychange",Qe),()=>{ze(),document.removeEventListener("visibilitychange",Qe)}},[S,J,ae]);const Ue=oe=>{oe.preventDefault();const ve=Me.trim();r({adminToken:ve,adminTokens:{...s.adminTokens||{},[m]:ve}}),Ge(!!ve)},Re=oe=>{const ve=Math.max(0,Math.floor(oe)),ze=Math.floor(ve/86400),Qe=Math.floor(ve%86400/3600),kt=Math.floor(ve%3600/60),Kn=ve%60,Dt=(ii,Rn)=>`${ii}${f(`admin.unit${Rn}`)}`;return ze>0?[Dt(ze,"Day"),Dt(Qe,"Hour"),Dt(kt,"Minute")].join(" "):Qe>0?[Dt(Qe,"Hour"),Dt(kt,"Minute"),Dt(Kn,"Second")].join(" "):[Dt(kt,"Minute"),Dt(Kn,"Second")].join(" ")},Oe=oe=>{if(!oe||oe===0)return"0 B";const ve=1024,ze=["B","KB","MB","GB"],Qe=Math.floor(Math.log(oe)/Math.log(ve));return`${(oe/Math.pow(ve,Qe)).toFixed(1)} ${ze[Qe]}`},je=()=>{const oe=Le();window.open(oe,"_blank","noopener,noreferrer")},Xe=p?p.activeUserCount??((St=p.clients)==null?void 0:St.length)??0:0,Bt=p?[{id:"overview",label:f("admin.tabOverview"),index:1},{id:"clients",label:f("admin.tabClients",{count:((mt=p.clients)==null?void 0:mt.length)||0}),index:2},{id:"ptys",label:f("admin.tabPtys",{count:((V=p.ptys)==null?void 0:V.length)||0}),index:3},...p.devices?[{id:"devices",label:f("admin.tabDevices",{count:p.devices.length}),index:4}]:[]]:[],jt=Bt.map(oe=>oe.id);w.useEffect(()=>{const oe=ve=>{if(ve.ctrlKey||ve.altKey||ve.metaKey)return;const ze=ve.target;if(ze instanceof HTMLInputElement||ze instanceof HTMLTextAreaElement||ze instanceof HTMLSelectElement||ze!=null&&ze.isContentEditable||document.querySelector('[role="dialog"]'))return;if(ve.key==="Escape"&&a){ve.preventDefault(),a();return}if(ve.key.toLowerCase()==="r"){ve.preventDefault(),J();return}const Qe=Number.parseInt(ve.key,10)-1;Number.isInteger(Qe)&&Qe>=0&&Qe<jt.length&&(ve.preventDefault(),re(jt[Qe]))};return window.addEventListener("keydown",oe),()=>window.removeEventListener("keydown",oe)},[J,jt.join("|")]);const Fe=d.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[a&&d.jsx(ke,{variant:"ghost",onClick:a,title:f("admin.returnToTerminal"),"aria-label":f("admin.returnToTerminal"),glyph:He.arrowLeft,brackets:!1,className:"shrink-0",children:d.jsx("span",{className:"sr-only",children:f("admin.returnToTerminal")})}),d.jsxs("span",{className:"hidden text-tui-sm text-tui-accent sm:inline",children:["v",(b==null?void 0:b.version)||(p==null?void 0:p.version)||"0.1.0"]}),d.jsx(jo,{tone:ce?"alt":"ok",children:f(ce?"admin.modeRemote":"admin.localWorkstationBadge")}),d.jsxs("label",{className:"hidden items-center gap-1.5 text-tui-sm text-tui-muted md:flex",children:[d.jsx("span",{children:f("admin.autoRefresh")}),d.jsxs(Ro,{value:ae,onChange:oe=>he(Number(oe.target.value)),"aria-label":f("admin.autoRefresh"),className:"w-auto",children:[d.jsx("option",{value:0,children:f("admin.paused")}),d.jsx("option",{value:1e3,children:"1s"}),d.jsx("option",{value:3e3,children:"3s"}),d.jsx("option",{value:5e3,children:"5s"}),d.jsx("option",{value:1e4,children:"10s"})]})]}),d.jsx(ke,{variant:"primary",onClick:J,disabled:E,title:f("admin.refreshNow"),children:E?d.jsx(la,{}):f("admin.refreshNow")})]});return d.jsxs(f1,{name:f("admin.title"),tagline:f("admin.subtitle"),aside:Fe,tabs:Bt,activeTabId:H,onSelectTab:oe=>re(oe),tabsAriaLabel:f("header.mainNavigationAria"),hints:[{keys:"1–4",action:f("admin.hintTabs")},{keys:"r",action:f("admin.hintRefresh")},...a?[{keys:"esc",action:f("admin.hintBack")}]:[]],footerAside:ee?d.jsx("span",{className:"text-tui-faint",children:f("admin.updatedAt",{time:ee.toLocaleTimeString()})}):null,bodyClassName:"space-y-3 pb-2",children:[!S&&d.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:d.jsx(la,{label:f("admin.loadingStatus")})}),S&&ce&&!nt&&d.jsxs(on,{title:f("admin.remoteRelayTitle"),aside:f("admin.remoteRelayBadge"),bodyClassName:"space-y-2",children:[d.jsx("p",{className:"text-tui leading-snug text-tui-muted",children:f("admin.remoteRelayNotice")}),d.jsxs("div",{className:"space-y-0.5 border border-tui-border-dim bg-tui-mantle px-2 py-1.5",children:[d.jsx(yn,{label:f("admin.remoteRelayEndpoint"),labelWidth:18,children:d.jsx("code",{className:"break-all text-tui-accent",children:s.wsUrl})}),d.jsx(yn,{label:f("admin.remoteRelayAdminUrl"),labelWidth:18,children:d.jsx("code",{className:"break-all text-tui-ok",children:Le()})})]}),d.jsx(fi,{}),d.jsxs("div",{className:"flex flex-col items-start justify-between gap-2 sm:flex-row sm:items-center",children:[d.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:f("admin.remoteRelayHelp")}),d.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[d.jsx(ke,{onClick:()=>Ge(!0),children:f("admin.relayAdminLoginBtn")}),d.jsx(ke,{variant:"primary",onClick:je,glyph:He.arrowRight,children:f("admin.openRemoteAdminBtn")})]})]})]}),S&&ce&&nt&&!p&&d.jsxs(on,{title:f("admin.relayAdminTitle"),bodyClassName:"space-y-2",children:[d.jsx(Zs,{tone:(b==null?void 0:b.adminConfigured)===!1?"warn":"bad",children:(b==null?void 0:b.adminConfigured)===!1?f("admin.relayAdminNotConfigured"):f("admin.relayAdminAuthError")}),d.jsxs("form",{onSubmit:Ue,className:"space-y-2",children:[d.jsxs("div",{className:"space-y-1",children:[d.jsx(vn,{htmlFor:"relay-admin-token",children:f("admin.relayAdminTokenLabel")}),d.jsx(xn,{id:"relay-admin-token",type:"password",value:Me,onChange:oe=>Ke(oe.target.value),placeholder:f("admin.relayAdminTokenPlaceholder")})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(ke,{variant:"primary",type:"submit",children:f("admin.relayAdminLoginBtn")}),d.jsx(ke,{variant:"ghost",onClick:()=>Ge(!1),children:f("common.cancel")})]})]})]}),S&&!ce&&B&&d.jsxs(on,{title:f("admin.unauthorizedTitle"),tone:"bad",bodyClassName:"space-y-2",children:[d.jsx(Zs,{tone:"bad",children:f("admin.unauthorizedDesc")}),d.jsxs("div",{className:"space-y-1.5 border border-tui-border-dim bg-tui-mantle px-2 py-1.5",children:[d.jsx("span",{className:"block text-tui-sm uppercase text-tui-muted",children:f("admin.pairingStepsTitle")}),d.jsxs("div",{className:"flex items-center gap-2 border border-tui-border bg-tui-crust px-2 py-1",children:[d.jsx("span",{"aria-hidden":"true",className:"shrink-0 select-none text-tui-ok",children:"$"}),d.jsx("code",{className:"min-w-0 flex-1 truncate text-tui-text",children:N}),d.jsx(ke,{onClick:q,glyph:le?He.check:"⧉",className:se("shrink-0",le&&"border-tui-ok text-tui-ok"),children:f(le?"admin.copiedJson":"common.copy")})]}),d.jsx("p",{className:"text-tui-sm text-tui-faint",children:f("admin.pairingStepsHelp")})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[i&&d.jsx(ke,{variant:"primary",onClick:i,children:f("admin.enterPairCodeBtn")}),d.jsx(ke,{onClick:J,children:f("admin.retryFetchBtn")})]})]}),S&&A&&!B&&!(!ce&&B)&&d.jsx(Zs,{tone:"warn",action:d.jsx(ke,{variant:"warn",onClick:J,children:f("common.retry")}),children:f("admin.errorConnecting",{error:A})}),p&&d.jsxs(d.Fragment,{children:[H==="overview"&&d.jsxs("div",{className:"space-y-2",children:[d.jsxs("div",{className:"grid grid-cols-1 gap-2 md:grid-cols-2",children:[d.jsxs(on,{title:f("admin.accessPanel"),aside:Re(p.uptimeSeconds||0),bodyClassName:"space-y-0.5",children:[d.jsx(yn,{label:f("admin.connectedHosts"),labelWidth:14,children:d.jsxs("span",{className:"flex items-center gap-1.5",children:[d.jsx(kn,{level:(me=p.hosts)!=null&&me.length?"ok":"idle"}),d.jsx("span",{className:"font-bold",children:((Ye=p.hosts)==null?void 0:Ye.length)||0})]})}),d.jsx(yn,{label:f("admin.activeUsers"),labelWidth:14,children:d.jsxs("span",{className:"flex items-center gap-1.5",children:[d.jsx(kn,{level:Xe?"ok":"idle"}),d.jsx("span",{className:"font-bold",children:Xe}),d.jsx("span",{className:"text-tui-faint",children:f("admin.acrossWindows",{count:((pt=p.clients)==null?void 0:pt.length)||0})})]})}),d.jsxs(yn,{label:f("admin.activePtys"),labelWidth:14,children:[d.jsx("span",{className:"font-bold",children:((L=p.ptys)==null?void 0:L.length)||0}),d.jsx("span",{className:"ml-1.5 text-tui-faint",children:f("admin.terminalShells")})]}),d.jsx(yn,{label:f("admin.uptime"),labelWidth:14,children:d.jsx("span",{className:"text-tui-muted",children:p.startTime?f("admin.startedAt",{time:new Date(p.startTime).toLocaleTimeString()}):f("admin.startedRecently")})})]}),d.jsxs(on,{title:f("admin.throughput"),aside:f("admin.perSecond",{value:Oe(((xe=p.throughput)==null?void 0:xe.bytesOutPerSec)||0)}),bodyClassName:"space-y-0.5",children:[d.jsxs(yn,{label:f("admin.bytesInTotal"),labelWidth:13,children:[d.jsx("span",{className:"font-bold text-tui-accent",children:Oe(((we=p.throughput)==null?void 0:we.bytesIn)||0)}),d.jsx("span",{className:"ml-1.5 text-tui-faint",children:f("admin.perSecond",{value:Oe(((Ee=p.throughput)==null?void 0:Ee.bytesInPerSec)||0)})})]}),d.jsxs(yn,{label:f("admin.bytesOutTotal"),labelWidth:13,children:[d.jsx("span",{className:"font-bold text-tui-ok",children:Oe(((_e=p.throughput)==null?void 0:_e.bytesOut)||0)}),d.jsx("span",{className:"ml-1.5 text-tui-faint",children:f("admin.perSecond",{value:Oe(((ot=p.throughput)==null?void 0:ot.bytesOutPerSec)||0)})})]}),d.jsx(fi,{}),d.jsx(yn,{label:f("admin.frameRate"),labelWidth:13,children:d.jsx("span",{className:"font-bold",children:f("admin.framesPerSecond",{count:((($e=p.throughput)==null?void 0:$e.framesOutPerSec)||0).toFixed(0)})})})]})]}),d.jsx(KS,{hosts:p.hosts||[],devices:p.devices})]}),H==="clients"&&d.jsx(BS,{clients:p.clients||[]}),H==="ptys"&&d.jsx(YS,{ptys:p.ptys||[]}),H==="devices"&&d.jsx(GS,{devices:p.devices||[],onRevoke:Ve})]})]})},FS=({compact:a=!1})=>{const{role:i,connectionState:s,sharedWindowCount:r,assignedClientId:u,t:f}=ct();if(!(s==="connected"))return d.jsxs("div",{className:"inline-flex select-none items-center gap-1.5 text-tui uppercase text-tui-faint",role:"status","aria-label":f("terminal.offlineStatusAria"),children:[d.jsx(kn,{level:"idle"}),d.jsx("span",{children:f("common.offline")})]});const h=i==="controller",p=r>1,y=d.jsxs("div",{className:se("inline-flex min-w-0 select-none items-center gap-1.5 text-tui uppercase",h?"text-tui-ok":"text-tui-warn"),role:"status","aria-label":f(h?"role.controllerMode":"role.viewerMode"),children:[d.jsx(kn,{level:h?"ok":"warn"}),d.jsx("span",{className:"truncate",children:f(h?"role.sharedControl":"role.viewerReadOnly")}),p?d.jsx("span",{className:"shrink-0 normal-case text-tui-muted",children:f("role.sharedWindows",{count:r})}):null]});return a?y:d.jsxs("div",{className:"flex w-full flex-col gap-1",children:[y,d.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:f("role.sharedControlDesc")}),u?d.jsx(yn,{label:f("role.thisWindow"),labelWidth:9,className:"text-tui-sm",children:d.jsx("span",{className:"truncate text-tui-muted",children:u})}):null]})},Gs="tui-focusable group flex h-11 w-full select-none items-center gap-2 border px-2 text-left text-tui transition-colors",$s="border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",qS="border-tui-accent bg-tui-selection text-tui-accent",Fs=({active:a=!1})=>d.jsx("span",{"aria-hidden":"true",className:se("shrink-0",a?"text-tui-accent":"text-tui-faint group-hover:text-tui-accent"),children:He.cursor}),VS=({onClose:a,onNavigateAdmin:i,showAdminEntry:s=!0,onOpenPairing:r,onOpenSettings:u,onAddProfile:f=()=>{}})=>{const{connectionState:m,stateDetail:h,rttMs:p,hostId:y,settings:b,updateSettings:v,connect:S,addToast:T,language:E,setLanguage:G,t:A}=ct(),[z,B]=Ti.useState(!1),Y=Oo(m,A),ae=F=>()=>{var re;const H=document.activeElement;(re=H==null?void 0:H.blur)==null||re.call(H),F()},he=()=>{Ll(b.clientId).then(F=>{if(F==="failed"){T("error",A("clipboard.copyFailed"));return}B(!0),T("info",A("toasts.clientIdCopied",{id:b.clientId})),setTimeout(()=>B(!1),2e3)})},ee=()=>{const F=E==="zh"?"en":"zh";G(F),T("info",Cd(F,"toasts.switchedLanguage",{lang:F==="zh"?"简体中文":"English"}))};return d.jsxs("div",{className:"flex flex-col gap-3 px-3 pb-2 pt-2",children:[d.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-tui-border pb-1.5",children:[d.jsx("h2",{className:"text-tui font-bold uppercase text-tui-accent",children:A("mobile.sessionControls")}),d.jsx(ke,{variant:"ghost",onClick:a,"aria-label":A("mobile.closeSessionControls"),children:"esc"})]}),d.jsx(on,{title:A("profiles.title"),tone:"accent",bodyClassName:"space-y-1",children:d.jsx(Rd,{mobile:!0,onAddProfile:f})}),d.jsxs(on,{title:A("common.status"),tone:Y.level==="ok"?"ok":Y.level==="bad"?"bad":"warn",bodyClassName:"space-y-1.5",children:[d.jsxs("div",{className:"flex items-center justify-between gap-2","aria-label":A("mobile.connectionStatusAria"),children:[d.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[d.jsx(kn,{level:Y.level}),d.jsx("span",{className:"truncate text-tui uppercase text-tui-text",children:Y.label}),m==="connected"&&p!==null&&d.jsxs("span",{className:"text-tui-sm text-tui-muted",children:[p,"ms"]})]}),Y.actionLabel&&d.jsx(ke,{variant:"primary",onClick:()=>S(),className:"shrink-0",children:Y.actionLabel})]}),Y.needsAttention&&h&&d.jsx("p",{className:"text-tui-sm leading-snug text-tui-muted",children:h}),y&&d.jsx(yn,{label:A("common.host"),labelWidth:9,children:y}),d.jsxs("button",{type:"button",onClick:he,className:"tui-focusable flex w-full items-baseline gap-2 text-left text-tui",title:A("header.copyClientIdTitle"),children:[d.jsx("span",{className:"shrink-0 text-tui-muted",style:{width:"9ch"},children:A("header.clientIdLabel")}),d.jsx("span",{className:"min-w-0 flex-1 truncate text-tui-text",children:b.clientId}),d.jsx("span",{"aria-hidden":"true",className:se("shrink-0",z?"text-tui-ok":"text-tui-faint"),children:z?He.check:"⧉"})]})]}),d.jsx(on,{title:A("mobile.inputControl"),tone:"accent","aria-label":A("mobile.terminalControlAria"),children:d.jsx(FS,{})}),d.jsxs(on,{title:A("mobile.menu"),tone:"accent",bodyClassName:"flex flex-col gap-1",children:[d.jsxs("button",{type:"button",onClick:ee,className:se(Gs,$s),"aria-label":A("header.languageToggleTitle"),children:[d.jsx(Fs,{}),d.jsx("span",{className:"truncate",children:E==="zh"?"English":"中文"})]}),d.jsxs("button",{type:"button",onClick:ae(u),className:se(Gs,$s),"aria-label":A("mobile.settingsAria"),children:[d.jsx(Fs,{}),d.jsx("span",{className:"truncate",children:A("common.settings")})]}),d.jsxs("button",{type:"button",onClick:ae(r),className:se(Gs,$s),"aria-label":A("mobile.pairingAria"),children:[d.jsx(Fs,{}),d.jsx("span",{className:"truncate",children:A("common.pairing")})]}),s&&d.jsxs("button",{type:"button",onClick:ae(i),className:se(Gs,$s),"aria-label":A("mobile.adminAria"),children:[d.jsx(Fs,{}),d.jsx("span",{className:"truncate",children:A("common.admin")})]}),d.jsxs("button",{type:"button",onClick:()=>v({toolbarVisible:!b.toolbarVisible}),className:se(Gs,b.toolbarVisible?qS:$s),"aria-label":A("mobile.keybarAria"),"aria-pressed":b.toolbarVisible,children:[d.jsx(Fs,{active:b.toolbarVisible}),d.jsx("span",{className:"truncate",children:A("common.keyBar")}),d.jsx("span",{"aria-hidden":"true",className:"ml-auto shrink-0 text-tui-sm",children:b.toolbarVisible?"[x]":"[ ]"})]})]})]})},XS=({onAddProfile:a})=>{const{rttMs:i,t:s}=ct();return d.jsxs("footer",{"data-testid":"mobile-status-bar",role:"status","aria-label":s("mobile.statusBarAria"),className:"absolute inset-x-0 bottom-0 z-40 flex h-11 shrink-0 items-center gap-2 border-t border-tui-border bg-tui-mantle px-1 text-tui-sm",children:[d.jsx(Rd,{statusBar:!0,onAddProfile:a}),d.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-border",children:"│"}),d.jsx(Rb,{compact:!0}),d.jsx(_b,{compact:!0}),d.jsxs("span",{className:"flex shrink-0 items-center gap-1 px-1 text-tui-muted",title:s("header.latencyTitle"),children:[d.jsx("span",{className:"text-tui-faint",children:"RTT"}),d.jsx("span",{className:se(i===null?"text-tui-faint":"text-tui-text"),children:i===null?"—":`${i}ms`})]})]})},PS=({onNavigateAdmin:a,showAdminEntry:i=!0,onOpenPairing:s,onOpenSettings:r,onAddProfile:u=()=>{}})=>{const{connectionState:f,isController:m,t:h}=ct(),[p,y]=w.useState(!1),b=w.useRef(null),v=w.useCallback(()=>y(!1),[]);w.useEffect(()=>{if(!p)return;const T=E=>{if(!(E.ctrlKey||E.altKey||E.metaKey)&&E.key==="Escape"){const G=E.target;G&&typeof G.closest=="function"&&!!G.closest("#terminal-container")||(E.stopPropagation(),E.preventDefault(),v())}};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[p,v]),w.useEffect(()=>{var T;p&&((T=b.current)==null||T.focus({preventScroll:!0}))},[p]);const S=Oo(f,h);return d.jsxs(d.Fragment,{children:[d.jsxs("div",{"data-testid":"mobile-topbar",role:"toolbar","aria-label":h("mobile.sessionControls"),className:"pointer-events-none absolute inset-x-0 top-0 z-40 flex h-12 items-center justify-between gap-2 border-b border-tui-border bg-tui-mantle px-2 text-tui",children:[d.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 text-tui-sm text-tui-muted",children:[d.jsx("span",{"aria-hidden":"true",className:"shrink-0 font-bold text-tui-accent",children:"herdr"}),d.jsx(rb,{className:"shrink-0"}),d.jsx(kn,{level:S.level}),d.jsx("span",{className:"truncate uppercase",children:S.label})]}),d.jsxs("button",{type:"button","data-testid":"mobile-chrome-trigger",onClick:()=>y(!0),"aria-label":h("mobile.sessionControls"),"aria-expanded":p,"aria-haspopup":"dialog",className:se("tui-focusable pointer-events-auto flex h-9 shrink-0 select-none items-center gap-1.5 border px-2 text-tui uppercase transition-colors",S.needsAttention?"border-tui-warn text-tui-warn":m?"border-tui-border text-tui-muted":"border-tui-accent text-tui-accent"),children:[!m&&!S.needsAttention&&d.jsx("span",{className:"max-w-[8rem] truncate",children:h("common.viewer")}),d.jsx("span",{"aria-hidden":"true",className:"text-tui",children:He.chevronDown}),d.jsx("span",{"aria-hidden":"true",children:h("mobile.menu")})]})]}),p&&d.jsxs(d.Fragment,{children:[d.jsx("div",{"data-testid":"mobile-sheet-scrim",className:"absolute inset-0 z-40 bg-tui-crust/70",onClick:v,"aria-hidden":"true"}),d.jsx("div",{ref:b,"data-testid":"mobile-control-sheet",role:"dialog","aria-modal":"true","aria-label":h("mobile.sessionControls"),tabIndex:-1,className:"herdr-sheet absolute inset-x-0 bottom-0 z-50 max-h-[85%] overflow-y-auto border-t border-tui-border bg-tui-base pb-3 focus:outline-none",children:d.jsx(VS,{onClose:v,showAdminEntry:i,onNavigateAdmin:()=>{v(),a()},onOpenPairing:()=>{v(),s()},onOpenSettings:()=>{v(),r()},onAddProfile:()=>{v(),u()}})})]}),d.jsx(XS,{onAddProfile:u})]})},ZS=()=>{const{herdrLaunch:a,startHerdr:i,hostname:s,activeProfile:r,t:u}=ct();if(!a)return null;const f=s||(r==null?void 0:r.displayName)||u("herdrLaunch.thisHost"),m=a.phase==="failed";return d.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:d.jsx(on,{title:u(m?"herdrLaunch.failedTitle":"herdrLaunch.title"),tone:m?"bad":"warn",className:"w-full max-w-md",bodyClassName:"space-y-3","aria-label":u("herdrLaunch.title"),children:a.phase==="starting"?d.jsxs("p",{className:"flex items-center gap-2 text-tui-text",role:"status",children:[d.jsx(la,{}),d.jsx("span",{children:u("herdrLaunch.starting",{host:f})})]}):d.jsxs(d.Fragment,{children:[d.jsx("p",{className:"leading-snug text-tui-text",children:u("herdrLaunch.body",{host:f})}),m&&a.message?d.jsx(Zs,{tone:"bad",children:d.jsx("pre",{className:"max-h-40 overflow-y-auto whitespace-pre-wrap break-words font-mono text-tui-sm",children:a.message})}):null,d.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:u("herdrLaunch.scope")}),d.jsx("div",{className:"flex justify-end",children:d.jsx(ke,{variant:"primary",onClick:i,autoFocus:!0,children:u(m?"common.retry":"herdrLaunch.start")})})]})})})},Db="--app-height",Ob="--keyboard-inset",QS=80;function WS(){if(typeof window>"u")return{height:768,keyboardInset:0};const a=window.innerHeight||768,i=window.visualViewport;if(i&&typeof i.height=="number"&&i.height>0){const s=a-i.height-(i.offsetTop||0),r=s>=QS?Math.round(s):0;return{height:Math.round(i.height),keyboardInset:r}}return{height:a,keyboardInset:0}}function hg(a,i=WS()){return a.style.setProperty(Db,`${i.height}px`),a.style.setProperty(Ob,`${i.keyboardInset}px`),i}function JS(a=typeof document<"u"?document.documentElement:null){if(!a||typeof window>"u")return()=>{};let i=null;const s=()=>{i=null,hg(a)},r=()=>{if(i===null){if(typeof requestAnimationFrame!="function"){s();return}i=requestAnimationFrame(s)}};hg(a);const u=window.visualViewport;return u==null||u.addEventListener("resize",r),u==null||u.addEventListener("scroll",r),window.addEventListener("resize",r),window.addEventListener("orientationchange",r),()=>{i!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(i),i=null),u==null||u.removeEventListener("resize",r),u==null||u.removeEventListener("scroll",r),window.removeEventListener("resize",r),window.removeEventListener("orientationchange",r),a.style.removeProperty(Db),a.style.removeProperty(Ob)}}const eC=900;function mg(){if(typeof window>"u")return!1;const a=Fa();return a<xd?!0:a<=eC}function tC(){const[a,i]=w.useState(mg);return w.useEffect(()=>{var u,f;const s=()=>{const m=mg();i(h=>h===m?h:m)};s();let r=null;try{r=typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null}catch{r=null}return(u=r==null?void 0:r.addEventListener)==null||u.call(r,"change",s),window.addEventListener("resize",s),window.addEventListener("orientationchange",s),(f=window.visualViewport)==null||f.addEventListener("resize",s),()=>{var m,h;(m=r==null?void 0:r.removeEventListener)==null||m.call(r,"change",s),window.removeEventListener("resize",s),window.removeEventListener("orientationchange",s),(h=window.visualViewport)==null||h.removeEventListener("resize",s)}},[]),a}function nC(a){const i=a.target;if(!i)return!1;if(i.id==="terminal-container"||i.id==="terminal-frame"||i.id==="terminal-surface"||i.classList.contains("xterm-helper-textarea")||i.classList.contains("xterm")||i.closest("#terminal-container")||i.closest(".xterm"))return!0;if(typeof document<"u"&&document.activeElement){const s=document.activeElement;if(s.id==="terminal-container"||s.classList.contains("xterm-helper-textarea")||s.closest("#terminal-container")||s.closest(".xterm"))return!0}return!1}function iC(a,i={}){if(typeof window>"u")return()=>{};const s=r=>{var u;r.ctrlKey||r.altKey||r.metaKey||r.key==="Escape"&&(i.isModalOpen||i.isSheetOpen)&&(nC(r)||(r.preventDefault(),r.stopPropagation(),(u=a.onCloseModals)==null||u.call(a)))};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s)}}function lC(){const[a,i]=w.useState("terminal"),[s,r]=w.useState(!1),[u,f]=w.useState(!1),[m,h]=w.useState(!1),[p,y]=w.useState(void 0),b=N=>{y(N),h(!0)},[v,S]=w.useState(!1),{updateSettings:T,settings:E,connectionState:G,stateDetail:A,stateCode:z,lastPairedAt:B}=ct();mx();const Y=tC();w.useEffect(()=>JS(),[]);const[ae,he]=w.useState(!0);w.useEffect(()=>{let N=!1;return fetch("/api/info",{headers:{Accept:"application/json"}}).then(q=>q.ok?q.json():null).then(q=>{N||!q||he(!q.isRemoteRelay)}).catch(()=>{}),()=>{N=!0}},[]),w.useEffect(()=>{Ug()},[]),w.useEffect(()=>{const N=s||m||v;if(N)return iC({onCloseModals:()=>{r(!1),h(!1),S(!1)}},{isModalOpen:N})},[s,m,v]),w.useEffect(()=>{const N=()=>{const q=window.location.pathname,ce=window.location.hash;i(q==="/admin"||ce==="#admin"?"admin":"terminal")};N(),window.addEventListener("popstate",N),window.addEventListener("hashchange",N);try{const q=new URL(window.location.href),ce=q.searchParams.get("token"),Le=q.searchParams.get("pairCode"),J=q.searchParams.get("ws")||q.searchParams.get("wsUrl"),Ve={};ce&&(Ve.token=ce),Le&&(Ve.pairCode=Le.toUpperCase()),J&&(Ve.wsUrl=J),Object.keys(Ve).length>0&&T(Ve);let Ue=!1;if(q.searchParams.has("token")&&(q.searchParams.delete("token"),Ue=!0),q.searchParams.has("pairCode")&&(q.searchParams.delete("pairCode"),Ue=!0),Ue){const Re=q.searchParams.toString(),Oe=q.pathname+(Re?`?${Re}`:"")+q.hash;window.history.replaceState({},"",Oe)}}catch(q){console.warn("Failed to parse URL query params:",q)}return()=>{window.removeEventListener("popstate",N),window.removeEventListener("hashchange",N)}},[]);const ee=(N=!1)=>{f(N),r(!0)},F=()=>{r(!1),f(!1)},H=N=>{i(N),N==="admin"?window.history.pushState({},"","/admin"):window.history.pushState({},"","/")},re=!E.token&&!E.pairCode&&G!=="connected",le=G==="error"&&(["auth_required","unauthorized","device_revoked"].includes(z||"")||/auth|unauthor|forbidden|permission|token|pair/i.test(A||"")),ye=re||le,[Me,Ke]=w.useState(!ye);w.useEffect(()=>{ye||Ke(!0)},[ye]),w.useEffect(()=>{B&&(r(!1),Ke(!0),i("terminal"))},[B]);const nt=a==="terminal"&&!ye,Ge=N=>({visibility:N?"visible":"hidden",opacity:N?1:0,pointerEvents:N?"auto":"none",zIndex:N?1:0});return d.jsxs("div",{"data-testid":"app-shell",style:Y?{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:N=>{N.preventDefault(),N.stopPropagation()},children:[!Y&&d.jsx(m1,{currentView:a,onNavigate:H,showAdminEntry:ae,onOpenPairing:()=>ee(!1),onOpenSettings:()=>b(),onToggleVirtualKeyboard:()=>S(!v),isVirtualKeyboardOpen:v}),!Y&&!ye&&d.jsx(p1,{}),d.jsxs("div",{className:"flex-1 min-h-0 w-full overflow-hidden relative",children:[Me&&d.jsxs("div",{"data-testid":"terminal-layer",className:`absolute ${Y?"inset-x-0 top-12 bottom-11":"inset-0"} flex flex-col min-h-0 w-full overflow-hidden`,style:Ge(nt),"aria-hidden":!nt,children:[d.jsx(vS,{isActive:nt}),!Y&&d.jsx(MS,{isOpen:v,onClose:()=>S(!1)}),d.jsx(CS,{compact:Y,onCustomize:()=>b("agentKeymaps")}),d.jsx(ZS,{})]}),a==="terminal"&&ye&&d.jsx("div",{"data-testid":"onboarding-layer",className:"absolute inset-0 flex flex-col min-h-0 w-full overflow-hidden z-10",children:d.jsx(xS,{onPairedSuccess:()=>{}})}),a==="admin"&&d.jsx("div",{"data-testid":"admin-layer",className:"absolute inset-0 flex flex-col min-h-0 w-full overflow-hidden z-20",children:d.jsx($S,{onBackToTerminal:()=>H("terminal"),onOpenPairing:()=>ee(!1)})}),Y&&nt&&d.jsx(PS,{onNavigateAdmin:()=>H("admin"),showAdminEntry:ae,onOpenPairing:()=>ee(!1),onOpenSettings:()=>b(),onAddProfile:()=>ee(!0)})]}),!Y&&a!=="admin"&&d.jsx(OS,{onAddProfile:()=>ee(!0)}),d.jsx(ES,{isOpen:s,isAddMode:u,onClose:F}),d.jsx(kS,{isOpen:m,initialTab:p,onClose:()=>h(!1)}),d.jsx(_S,{})]})}function aC(){return d.jsx(nx,{children:d.jsx(lC,{})})}const zb=document.getElementById("root");if(!zb)throw new Error("Root element not found");Z0.createRoot(zb).render(d.jsx(Ti.StrictMode,{children:d.jsx(aC,{})}));
|