herdr-remote-relay 0.2.18 → 0.3.0

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,43 @@
1
+ var ey=Object.defineProperty;var ty=(o,i,r)=>i in o?ey(o,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[i]=r;var De=(o,i,r)=>ty(o,typeof i!="symbol"?i+"":i,r);import{r as ap,g as ip,a as sp}from"./vendor-react-CYSfZuHu.js";import{r as ny,a as ly,b as ay,c as iy}from"./vendor-xterm-Bldps5fz.js";(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))c(d);new MutationObserver(d=>{for(const h of d)if(h.type==="childList")for(const g of h.addedNodes)g.tagName==="LINK"&&g.rel==="modulepreload"&&c(g)}).observe(document,{childList:!0,subtree:!0});function r(d){const h={};return d.integrity&&(h.integrity=d.integrity),d.referrerPolicy&&(h.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?h.credentials="include":d.crossOrigin==="anonymous"?h.credentials="omit":h.credentials="same-origin",h}function c(d){if(d.ep)return;d.ep=!0;const h=r(d);fetch(d.href,h)}})();var iu={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 vm;function sy(){if(vm)return us;vm=1;var o=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function r(c,d,h){var g=null;if(h!==void 0&&(g=""+h),d.key!==void 0&&(g=""+d.key),"key"in d){h={};for(var m in d)m!=="key"&&(h[m]=d[m])}else h=d;return d=h.ref,{$$typeof:o,type:c,key:g,ref:d!==void 0?d:null,props:h}}return us.Fragment=i,us.jsx=r,us.jsxs=r,us}var xm;function ry(){return xm||(xm=1,iu.exports=sy()),iu.exports}var u=ry(),y=ap();const il=ip(y);var su={exports:{}},ds={},ru={exports:{}},ou={};/**
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 Sm;function oy(){return Sm||(Sm=1,(function(o){function i(j,q){var J=j.length;j.push(q);e:for(;0<J;){var we=J-1>>>1,H=j[we];if(0<d(H,q))j[we]=q,j[J]=H,J=we;else break e}}function r(j){return j.length===0?null:j[0]}function c(j){if(j.length===0)return null;var q=j[0],J=j.pop();if(J!==q){j[0]=J;e:for(var we=0,H=j.length,Ve=H>>>1;we<Ve;){var X=2*(we+1)-1,me=j[X],_e=X+1,ve=j[_e];if(0>d(me,J))_e<H&&0>d(ve,me)?(j[we]=ve,j[_e]=J,we=_e):(j[we]=me,j[X]=J,we=X);else if(_e<H&&0>d(ve,J))j[we]=ve,j[_e]=J,we=_e;else break e}}return q}function d(j,q){var J=j.sortIndex-q.sortIndex;return J!==0?J:j.id-q.id}if(o.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var h=performance;o.unstable_now=function(){return h.now()}}else{var g=Date,m=g.now();o.unstable_now=function(){return g.now()-m}}var b=[],S=[],v=1,C=null,B=3,z=!1,_=!1,V=!1,k=!1,Z=typeof setTimeout=="function"?setTimeout:null,$=typeof clearTimeout=="function"?clearTimeout:null,Q=typeof setImmediate<"u"?setImmediate:null;function ae(j){for(var q=r(S);q!==null;){if(q.callback===null)c(S);else if(q.startTime<=j)c(S),q.sortIndex=q.expirationTime,i(b,q);else break;q=r(S)}}function Se(j){if(V=!1,ae(j),!_)if(r(b)!==null)_=!0,D||(D=!0,Ne());else{var q=r(S);q!==null&&Be(Se,q.startTime-j)}}var D=!1,O=-1,A=5,ee=-1;function Ae(){return k?!0:!(o.unstable_now()-ee<A)}function Re(){if(k=!1,D){var j=o.unstable_now();ee=j;var q=!0;try{e:{_=!1,V&&(V=!1,$(O),O=-1),z=!0;var J=B;try{t:{for(ae(j),C=r(b);C!==null&&!(C.expirationTime>j&&Ae());){var we=C.callback;if(typeof we=="function"){C.callback=null,B=C.priorityLevel;var H=we(C.expirationTime<=j);if(j=o.unstable_now(),typeof H=="function"){C.callback=H,ae(j),q=!0;break t}C===r(b)&&c(b),ae(j)}else c(b);C=r(b)}if(C!==null)q=!0;else{var Ve=r(S);Ve!==null&&Be(Se,Ve.startTime-j),q=!1}}break e}finally{C=null,B=J,z=!1}q=void 0}}finally{q?Ne():D=!1}}}var Ne;if(typeof Q=="function")Ne=function(){Q(Re)};else if(typeof MessageChannel<"u"){var de=new MessageChannel,je=de.port2;de.port1.onmessage=Re,Ne=function(){je.postMessage(null)}}else Ne=function(){Z(Re,0)};function Be(j,q){O=Z(function(){j(o.unstable_now())},q)}o.unstable_IdlePriority=5,o.unstable_ImmediatePriority=1,o.unstable_LowPriority=4,o.unstable_NormalPriority=3,o.unstable_Profiling=null,o.unstable_UserBlockingPriority=2,o.unstable_cancelCallback=function(j){j.callback=null},o.unstable_forceFrameRate=function(j){0>j||125<j?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<j?Math.floor(1e3/j):5},o.unstable_getCurrentPriorityLevel=function(){return B},o.unstable_next=function(j){switch(B){case 1:case 2:case 3:var q=3;break;default:q=B}var J=B;B=q;try{return j()}finally{B=J}},o.unstable_requestPaint=function(){k=!0},o.unstable_runWithPriority=function(j,q){switch(j){case 1:case 2:case 3:case 4:case 5:break;default:j=3}var J=B;B=j;try{return q()}finally{B=J}},o.unstable_scheduleCallback=function(j,q,J){var we=o.unstable_now();switch(typeof J=="object"&&J!==null?(J=J.delay,J=typeof J=="number"&&0<J?we+J:we):J=we,j){case 1:var H=-1;break;case 2:H=250;break;case 5:H=1073741823;break;case 4:H=1e4;break;default:H=5e3}return H=J+H,j={id:v++,callback:q,priorityLevel:j,startTime:J,expirationTime:H,sortIndex:-1},J>we?(j.sortIndex=J,i(S,j),r(b)===null&&j===r(S)&&(V?($(O),O=-1):V=!0,Be(Se,J-we))):(j.sortIndex=H,i(b,j),_||z||(_=!0,D||(D=!0,Ne()))),j},o.unstable_shouldYield=Ae,o.unstable_wrapCallback=function(j){var q=B;return function(){var J=B;B=q;try{return j.apply(this,arguments)}finally{B=J}}}})(ou)),ou}var wm;function cy(){return wm||(wm=1,ru.exports=oy()),ru.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 Cm;function uy(){if(Cm)return ds;Cm=1;var o=cy(),i=ap(),r=sp();function c(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 d(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function h(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 g(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function m(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function b(e){if(h(e)!==e)throw Error(c(188))}function S(e){var t=e.alternate;if(!t){if(t=h(e),t===null)throw Error(c(188));return t!==e?null:e}for(var n=e,l=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(l=a.return,l!==null){n=l;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return b(a),e;if(s===l)return b(a),t;s=s.sibling}throw Error(c(188))}if(n.return!==l.return)n=a,l=s;else{for(var f=!1,p=a.child;p;){if(p===n){f=!0,n=a,l=s;break}if(p===l){f=!0,l=a,n=s;break}p=p.sibling}if(!f){for(p=s.child;p;){if(p===n){f=!0,n=s,l=a;break}if(p===l){f=!0,l=s,n=a;break}p=p.sibling}if(!f)throw Error(c(189))}}if(n.alternate!==l)throw Error(c(190))}if(n.tag!==3)throw Error(c(188));return n.stateNode.current===n?e:t}function v(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=v(e),t!==null)return t;e=e.sibling}return null}var C=Object.assign,B=Symbol.for("react.element"),z=Symbol.for("react.transitional.element"),_=Symbol.for("react.portal"),V=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),Z=Symbol.for("react.profiler"),$=Symbol.for("react.consumer"),Q=Symbol.for("react.context"),ae=Symbol.for("react.forward_ref"),Se=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),ee=Symbol.for("react.activity"),Ae=Symbol.for("react.memo_cache_sentinel"),Re=Symbol.iterator;function Ne(e){return e===null||typeof e!="object"?null:(e=Re&&e[Re]||e["@@iterator"],typeof e=="function"?e:null)}var de=Symbol.for("react.client.reference");function je(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===de?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case V:return"Fragment";case Z:return"Profiler";case k:return"StrictMode";case Se:return"Suspense";case D:return"SuspenseList";case ee:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case _:return"Portal";case Q:return e.displayName||"Context";case $: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 O:return t=e.displayName||null,t!==null?t:je(e.type)||"Memo";case A:t=e._payload,e=e._init;try{return je(e(t))}catch{}}return null}var Be=Array.isArray,j=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J={pending:!1,data:null,method:null,action:null},we=[],H=-1;function Ve(e){return{current:e}}function X(e){0>H||(e.current=we[H],we[H]=null,H--)}function me(e,t){H++,we[H]=e.current,e.current=t}var _e=Ve(null),ve=Ve(null),fe=Ve(null),vt=Ve(null);function Oe(e,t){switch(me(fe,t),me(ve,e),me(_e,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Gh(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Gh(t),e=qh(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}X(_e),me(_e,e)}function Me(){X(_e),X(ve),X(fe)}function Ie(e){e.memoizedState!==null&&me(vt,e);var t=_e.current,n=qh(t,e.type);t!==n&&(me(ve,e),me(_e,n))}function pt(e){ve.current===e&&(X(_e),X(ve)),vt.current===e&&(X(vt),ss._currentValue=J)}var xt,Dt;function St(e){if(xt===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);xt=t&&t[1]||"",Dt=-1<n.stack.indexOf(`
26
+ at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
27
+ `+xt+e+Dt}var Rn=!1;function wt(e,t){if(!e||Rn)return"";Rn=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(t){var G=function(){throw Error()};if(Object.defineProperty(G.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(G,[])}catch(M){var R=M}Reflect.construct(e,[],G)}else{try{G.call()}catch(M){R=M}e.call(G.prototype)}}else{try{throw Error()}catch(M){R=M}(G=e())&&typeof G.catch=="function"&&G.catch(function(){})}}catch(M){if(M&&R&&typeof M.stack=="string")return[M.stack,R.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var a=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");a&&a.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var s=l.DetermineComponentFrameRoot(),f=s[0],p=s[1];if(f&&p){var x=f.split(`
28
+ `),E=p.split(`
29
+ `);for(a=l=0;l<x.length&&!x[l].includes("DetermineComponentFrameRoot");)l++;for(;a<E.length&&!E[a].includes("DetermineComponentFrameRoot");)a++;if(l===x.length||a===E.length)for(l=x.length-1,a=E.length-1;1<=l&&0<=a&&x[l]!==E[a];)a--;for(;1<=l&&0<=a;l--,a--)if(x[l]!==E[a]){if(l!==1||a!==1)do if(l--,a--,0>a||x[l]!==E[a]){var U=`
30
+ `+x[l].replace(" at new "," at ");return e.displayName&&U.includes("<anonymous>")&&(U=U.replace("<anonymous>",e.displayName)),U}while(1<=l&&0<=a);break}}}finally{Rn=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?St(n):""}function ut(e,t){switch(e.tag){case 26:case 27:case 5:return St(e.type);case 16:return St("Lazy");case 13:return e.child!==t&&t!==null?St("Suspense Fallback"):St("Suspense");case 19:return St("SuspenseList");case 0:case 15:return wt(e.type,!1);case 11:return wt(e.type.render,!1);case 1:return wt(e.type,!0);case 31:return St("Activity");default:return""}}function At(e){try{var t="",n=null;do t+=ut(e,n),n=e,e=e.return;while(e);return t}catch(l){return`
31
+ Error generating stack: `+l.message+`
32
+ `+l.stack}}var Ot=Object.prototype.hasOwnProperty,Wt=o.unstable_scheduleCallback,Ft=o.unstable_cancelCallback,Ct=o.unstable_shouldYield,Gt=o.unstable_requestPaint,te=o.unstable_now,xe=o.unstable_getCurrentPriorityLevel,ye=o.unstable_ImmediatePriority,Pe=o.unstable_UserBlockingPriority,Lt=o.unstable_NormalPriority,rn=o.unstable_LowPriority,ft=o.unstable_IdlePriority,kl=o.log,Rt=o.unstable_setDisableYieldValue,Wn=null,Zt=null;function Qt(e){if(typeof kl=="function"&&Rt(e),Zt&&typeof Zt.setStrictMode=="function")try{Zt.setStrictMode(Wn,e)}catch{}}var gt=Math.clz32?Math.clz32:xi,Pn=Math.log,$n=Math.LN2;function xi(e){return e>>>=0,e===0?32:31-(Pn(e)/$n|0)|0}var sl=256,rl=262144,ol=4194304;function dn(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 qn(e,t,n){var l=e.pendingLanes;if(l===0)return 0;var a=0,s=e.suspendedLanes,f=e.pingedLanes;e=e.warmLanes;var p=l&134217727;return p!==0?(l=p&~s,l!==0?a=dn(l):(f&=p,f!==0?a=dn(f):n||(n=p&~e,n!==0&&(a=dn(n))))):(p=l&~s,p!==0?a=dn(p):f!==0?a=dn(f):n||(n=l&~e,n!==0&&(a=dn(n)))),a===0?0:t!==0&&t!==a&&(t&s)===0&&(s=a&-a,n=t&-t,s>=n||s===32&&(n&4194048)!==0)?t:a}function cl(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Si(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 _a(){var e=ol;return ol<<=1,(ol&62914560)===0&&(ol=4194304),e}function ul(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function dl(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function wi(e,t,n,l,a,s){var f=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 p=e.entanglements,x=e.expirationTimes,E=e.hiddenUpdates;for(n=f&~n;0<n;){var U=31-gt(n),G=1<<U;p[U]=0,x[U]=-1;var R=E[U];if(R!==null)for(E[U]=null,U=0;U<R.length;U++){var M=R[U];M!==null&&(M.lane&=-536870913)}n&=~G}l!==0&&sa(e,l,0),s!==0&&a===0&&e.tag!==0&&(e.suspendedLanes|=s&~(f&~t))}function sa(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-gt(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|n&261930}function L(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var l=31-gt(n),a=1<<l;a&t|e[l]&t&&(e[l]|=t),n&=~a}}function Y(e,t){var n=t&-t;return n=(n&42)!==0?1:ne(n),(n&(e.suspendedLanes|t))!==0?0:n}function ne(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 pe(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Ee(){var e=q.p;return e!==0?e:(e=window.event,e===void 0?32:fm(e.type))}function ze(e,t){var n=q.p;try{return q.p=e,t()}finally{q.p=n}}var Le=Math.random().toString(36).slice(2),tt="__reactFiber$"+Le,Je="__reactProps$"+Le,fn="__reactContainer$"+Le,F="__reactEvents$"+Le,I="__reactListeners$"+Le,he="__reactHandles$"+Le,oe="__reactResources$"+Le,Ke="__reactMarker$"+Le;function le(e){delete e[tt],delete e[Je],delete e[F],delete e[I],delete e[he]}function jt(e){var t=e[tt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[fn]||n[tt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Jh(e);e!==null;){if(n=e[tt])return n;e=Jh(e)}return t}e=n,n=e.parentNode}return null}function Mt(e){if(e=e[tt]||e[fn]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function _t(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(c(33))}function at(e){var t=e[oe];return t||(t=e[oe]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function nt(e){e[Ke]=!0}var vn=new Set,ra={};function Vn(e,t){zl(e,t),zl(e+"Capture",t)}function zl(e,t){for(ra[e]=t,e=0;e<t.length;e++)vn.add(t[e])}var $r=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]*$"),As={},Rs={};function eo(e){return Ot.call(Rs,e)?!0:Ot.call(As,e)?!1:$r.test(e)?Rs[e]=!0:(As[e]=!0,!1)}function Pt(e,t,n){if(eo(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 ka(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 Xn(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 jn(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function js(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 a=l.get,s=l.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(f){n=""+f,s.call(this,f)}}),Object.defineProperty(e,t,{enumerable:l.enumerable}),{getValue:function(){return n},setValue:function(f){n=""+f},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function za(e){if(!e._valueTracker){var t=jn(e)?"checked":"value";e._valueTracker=js(e,t,""+e[t])}}function oa(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),l="";return e&&(l=jn(e)?e.checked?"true":"false":e.value),e=l,e!==n?(t.setValue(e),!0):!1}function fl(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 Da=/[\n"\\]/g;function on(e){return e.replace(Da,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Oa(e,t,n,l,a,s,f,p){e.name="",f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"?e.type=f:e.removeAttribute("type"),t!=null?f==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+It(t)):e.value!==""+It(t)&&(e.value=""+It(t)):f!=="submit"&&f!=="reset"||e.removeAttribute("value"),t!=null?ce(e,f,It(t)):n!=null?ce(e,f,It(n)):l!=null&&e.removeAttribute("value"),a==null&&s!=null&&(e.defaultChecked=!!s),a!=null&&(e.checked=a&&typeof a!="function"&&typeof a!="symbol"),p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"?e.name=""+It(p):e.removeAttribute("name")}function P(e,t,n,l,a,s,f,p){if(s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"&&(e.type=s),t!=null||n!=null){if(!(s!=="submit"&&s!=="reset"||t!=null)){za(e);return}n=n!=null?""+It(n):"",t=t!=null?""+It(t):n,p||t===e.value||(e.value=t),e.defaultValue=t}l=l??a,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=p?e.checked:!!l,e.defaultChecked=!!l,f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(e.name=f),za(e)}function ce(e,t,n){t==="number"&&fl(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function ke(e,t,n,l){if(e=e.options,t){t={};for(var a=0;a<n.length;a++)t["$"+n[a]]=!0;for(n=0;n<e.length;n++)a=t.hasOwnProperty("$"+e[n].value),e[n].selected!==a&&(e[n].selected=a),a&&l&&(e[n].defaultSelected=!0)}else{for(n=""+It(n),t=null,a=0;a<e.length;a++){if(e[a].value===n){e[a].selected=!0,l&&(e[a].defaultSelected=!0);return}t!==null||e[a].disabled||(t=e[a])}t!==null&&(t.selected=!0)}}function Ut(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 cn(e,t,n,l){if(t==null){if(l!=null){if(n!=null)throw Error(c(92));if(Be(l)){if(1<l.length)throw Error(c(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),za(e)}function $t(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var ge=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 qt(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||ge.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function bt(e,t,n){if(t!=null&&typeof t!="object")throw Error(c(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 a in t)l=t[a],t.hasOwnProperty(a)&&n[a]!==l&&qt(e,a,l)}else for(var s in t)t.hasOwnProperty(s)&&qt(e,s,t[s])}function en(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 Mn=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"]]),hl=/^[\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 La(e){return hl.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function _n(){}var to=null;function no(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ua=null,Ba=null;function Yu(e){var t=Mt(e);if(t&&(e=t.stateNode)){var n=e[Je]||null;e:switch(e=t.stateNode,t.type){case"input":if(Oa(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+on(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var l=n[t];if(l!==e&&l.form===e.form){var a=l[Je]||null;if(!a)throw Error(c(90));Oa(l,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)l=n[t],l.form===e.form&&oa(l)}break e;case"textarea":Ut(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&ke(e,!!n.multiple,t,!1)}}}var lo=!1;function Ku(e,t,n){if(lo)return e(t,n);lo=!0;try{var l=e(t);return l}finally{if(lo=!1,(Ua!==null||Ba!==null)&&(gr(),Ua&&(t=Ua,e=Ba,Ba=Ua=null,Yu(t),e)))for(t=0;t<e.length;t++)Yu(e[t])}}function Ci(e,t){var n=e.stateNode;if(n===null)return null;var l=n[Je]||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(c(231,t,typeof n));return n}var ml=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ao=!1;if(ml)try{var Ti={};Object.defineProperty(Ti,"passive",{get:function(){ao=!0}}),window.addEventListener("test",Ti,Ti),window.removeEventListener("test",Ti,Ti)}catch{ao=!1}var Dl=null,io=null,Ms=null;function Gu(){if(Ms)return Ms;var e,t=io,n=t.length,l,a="value"in Dl?Dl.value:Dl.textContent,s=a.length;for(e=0;e<n&&t[e]===a[e];e++);var f=n-e;for(l=1;l<=f&&t[n-l]===a[s-l];l++);return Ms=a.slice(e,1<l?1-l:void 0)}function _s(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 ks(){return!0}function qu(){return!1}function hn(e){function t(n,l,a,s,f){this._reactName=n,this._targetInst=a,this.type=l,this.nativeEvent=s,this.target=f,this.currentTarget=null;for(var p in e)e.hasOwnProperty(p)&&(n=e[p],this[p]=n?n(s):s[p]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?ks:qu,this.isPropagationStopped=qu,this}return C(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=ks)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=ks)},persist:function(){},isPersistent:ks}),t}var ca={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},zs=hn(ca),Ni=C({},ca,{view:0,detail:0}),Pp=hn(Ni),so,ro,Ei,Ds=C({},Ni,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:co,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!==Ei&&(Ei&&e.type==="mousemove"?(so=e.screenX-Ei.screenX,ro=e.screenY-Ei.screenY):ro=so=0,Ei=e),so)},movementY:function(e){return"movementY"in e?e.movementY:ro}}),Vu=hn(Ds),$p=C({},Ds,{dataTransfer:0}),eg=hn($p),tg=C({},Ni,{relatedTarget:0}),oo=hn(tg),ng=C({},ca,{animationName:0,elapsedTime:0,pseudoElement:0}),lg=hn(ng),ag=C({},ca,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),ig=hn(ag),sg=C({},ca,{data:0}),Xu=hn(sg),rg={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},og={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"},cg={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ug(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=cg[e])?!!t[e]:!1}function co(){return ug}var dg=C({},Ni,{key:function(e){if(e.key){var t=rg[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=_s(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?og[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:co,charCode:function(e){return e.type==="keypress"?_s(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?_s(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),fg=hn(dg),hg=C({},Ds,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Fu=hn(hg),mg=C({},Ni,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:co}),pg=hn(mg),gg=C({},ca,{propertyName:0,elapsedTime:0,pseudoElement:0}),bg=hn(gg),yg=C({},Ds,{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}),vg=hn(yg),xg=C({},ca,{newState:0,oldState:0}),Sg=hn(xg),wg=[9,13,27,32],uo=ml&&"CompositionEvent"in window,Ai=null;ml&&"documentMode"in document&&(Ai=document.documentMode);var Cg=ml&&"TextEvent"in window&&!Ai,Zu=ml&&(!uo||Ai&&8<Ai&&11>=Ai),Qu=" ",Iu=!1;function Ju(e,t){switch(e){case"keyup":return wg.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Wu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ha=!1;function Tg(e,t){switch(e){case"compositionend":return Wu(t);case"keypress":return t.which!==32?null:(Iu=!0,Qu);case"textInput":return e=t.data,e===Qu&&Iu?null:e;default:return null}}function Ng(e,t){if(Ha)return e==="compositionend"||!uo&&Ju(e,t)?(e=Gu(),Ms=io=Dl=null,Ha=!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 Zu&&t.locale!=="ko"?null:t.data;default:return null}}var Eg={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 Pu(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Eg[e.type]:t==="textarea"}function $u(e,t,n,l){Ua?Ba?Ba.push(l):Ba=[l]:Ua=l,t=Cr(t,"onChange"),0<t.length&&(n=new zs("onChange","change",null,n,l),e.push({event:n,listeners:t}))}var Ri=null,ji=null;function Ag(e){Lh(e,0)}function Os(e){var t=_t(e);if(oa(t))return e}function ed(e,t){if(e==="change")return t}var td=!1;if(ml){var fo;if(ml){var ho="oninput"in document;if(!ho){var nd=document.createElement("div");nd.setAttribute("oninput","return;"),ho=typeof nd.oninput=="function"}fo=ho}else fo=!1;td=fo&&(!document.documentMode||9<document.documentMode)}function ld(){Ri&&(Ri.detachEvent("onpropertychange",ad),ji=Ri=null)}function ad(e){if(e.propertyName==="value"&&Os(ji)){var t=[];$u(t,ji,e,no(e)),Ku(Ag,t)}}function Rg(e,t,n){e==="focusin"?(ld(),Ri=t,ji=n,Ri.attachEvent("onpropertychange",ad)):e==="focusout"&&ld()}function jg(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Os(ji)}function Mg(e,t){if(e==="click")return Os(t)}function _g(e,t){if(e==="input"||e==="change")return Os(t)}function kg(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var xn=typeof Object.is=="function"?Object.is:kg;function Mi(e,t){if(xn(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 a=n[l];if(!Ot.call(t,a)||!xn(e[a],t[a]))return!1}return!0}function id(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function sd(e,t){var n=id(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=id(n)}}function rd(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?rd(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function od(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=fl(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=fl(e.document)}return t}function mo(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 zg=ml&&"documentMode"in document&&11>=document.documentMode,Ya=null,po=null,_i=null,go=!1;function cd(e,t,n){var l=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;go||Ya==null||Ya!==fl(l)||(l=Ya,"selectionStart"in l&&mo(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}),_i&&Mi(_i,l)||(_i=l,l=Cr(po,"onSelect"),0<l.length&&(t=new zs("onSelect","select",null,t,n),e.push({event:t,listeners:l}),t.target=Ya)))}function ua(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Ka={animationend:ua("Animation","AnimationEnd"),animationiteration:ua("Animation","AnimationIteration"),animationstart:ua("Animation","AnimationStart"),transitionrun:ua("Transition","TransitionRun"),transitionstart:ua("Transition","TransitionStart"),transitioncancel:ua("Transition","TransitionCancel"),transitionend:ua("Transition","TransitionEnd")},bo={},ud={};ml&&(ud=document.createElement("div").style,"AnimationEvent"in window||(delete Ka.animationend.animation,delete Ka.animationiteration.animation,delete Ka.animationstart.animation),"TransitionEvent"in window||delete Ka.transitionend.transition);function da(e){if(bo[e])return bo[e];if(!Ka[e])return e;var t=Ka[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in ud)return bo[e]=t[n];return e}var dd=da("animationend"),fd=da("animationiteration"),hd=da("animationstart"),Dg=da("transitionrun"),Og=da("transitionstart"),Lg=da("transitioncancel"),md=da("transitionend"),pd=new Map,yo="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(" ");yo.push("scrollEnd");function Fn(e,t){pd.set(e,t),Vn(t,[e])}var Ls=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)},kn=[],Ga=0,vo=0;function Us(){for(var e=Ga,t=vo=Ga=0;t<e;){var n=kn[t];kn[t++]=null;var l=kn[t];kn[t++]=null;var a=kn[t];kn[t++]=null;var s=kn[t];if(kn[t++]=null,l!==null&&a!==null){var f=l.pending;f===null?a.next=a:(a.next=f.next,f.next=a),l.pending=a}s!==0&&gd(n,a,s)}}function Bs(e,t,n,l){kn[Ga++]=e,kn[Ga++]=t,kn[Ga++]=n,kn[Ga++]=l,vo|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function xo(e,t,n,l){return Bs(e,t,n,l),Hs(e)}function fa(e,t){return Bs(e,null,null,t),Hs(e)}function gd(e,t,n){e.lanes|=n;var l=e.alternate;l!==null&&(l.lanes|=n);for(var a=!1,s=e.return;s!==null;)s.childLanes|=n,l=s.alternate,l!==null&&(l.childLanes|=n),s.tag===22&&(e=s.stateNode,e===null||e._visibility&1||(a=!0)),e=s,s=s.return;return e.tag===3?(s=e.stateNode,a&&t!==null&&(a=31-gt(n),e=s.hiddenUpdates,l=e[a],l===null?e[a]=[t]:l.push(t),t.lane=n|536870912),s):null}function Hs(e){if(50<$i)throw $i=0,jc=null,Error(c(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var qa={};function Ug(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 Sn(e,t,n,l){return new Ug(e,t,n,l)}function So(e){return e=e.prototype,!(!e||!e.isReactComponent)}function pl(e,t){var n=e.alternate;return n===null?(n=Sn(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 bd(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 Ys(e,t,n,l,a,s){var f=0;if(l=e,typeof e=="function")So(e)&&(f=1);else if(typeof e=="string")f=Gb(e,n,_e.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case ee:return e=Sn(31,n,t,a),e.elementType=ee,e.lanes=s,e;case V:return ha(n.children,a,s,t);case k:f=8,a|=24;break;case Z:return e=Sn(12,n,t,a|2),e.elementType=Z,e.lanes=s,e;case Se:return e=Sn(13,n,t,a),e.elementType=Se,e.lanes=s,e;case D:return e=Sn(19,n,t,a),e.elementType=D,e.lanes=s,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Q:f=10;break e;case $:f=9;break e;case ae:f=11;break e;case O:f=14;break e;case A:f=16,l=null;break e}f=29,n=Error(c(130,e===null?"null":typeof e,"")),l=null}return t=Sn(f,n,t,a),t.elementType=e,t.type=l,t.lanes=s,t}function ha(e,t,n,l){return e=Sn(7,e,l,t),e.lanes=n,e}function wo(e,t,n){return e=Sn(6,e,null,t),e.lanes=n,e}function yd(e){var t=Sn(18,null,null,0);return t.stateNode=e,t}function Co(e,t,n){return t=Sn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var vd=new WeakMap;function zn(e,t){if(typeof e=="object"&&e!==null){var n=vd.get(e);return n!==void 0?n:(t={value:e,source:t,stack:At(t)},vd.set(e,t),t)}return{value:e,source:t,stack:At(t)}}var Va=[],Xa=0,Ks=null,ki=0,Dn=[],On=0,Ol=null,el=1,tl="";function gl(e,t){Va[Xa++]=ki,Va[Xa++]=Ks,Ks=e,ki=t}function xd(e,t,n){Dn[On++]=el,Dn[On++]=tl,Dn[On++]=Ol,Ol=e;var l=el;e=tl;var a=32-gt(l)-1;l&=~(1<<a),n+=1;var s=32-gt(t)+a;if(30<s){var f=a-a%5;s=(l&(1<<f)-1).toString(32),l>>=f,a-=f,el=1<<32-gt(t)+a|n<<a|l,tl=s+e}else el=1<<s|n<<a|l,tl=e}function To(e){e.return!==null&&(gl(e,1),xd(e,1,0))}function No(e){for(;e===Ks;)Ks=Va[--Xa],Va[Xa]=null,ki=Va[--Xa],Va[Xa]=null;for(;e===Ol;)Ol=Dn[--On],Dn[On]=null,tl=Dn[--On],Dn[On]=null,el=Dn[--On],Dn[On]=null}function Sd(e,t){Dn[On++]=el,Dn[On++]=tl,Dn[On++]=Ol,el=t.id,tl=t.overflow,Ol=e}var tn=null,ht=null,We=!1,Ll=null,Ln=!1,Eo=Error(c(519));function Ul(e){var t=Error(c(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw zi(zn(t,e)),Eo}function wd(e){var t=e.stateNode,n=e.type,l=e.memoizedProps;switch(t[tt]=e,t[Je]=l,n){case"dialog":Fe("cancel",t),Fe("close",t);break;case"iframe":case"object":case"embed":Fe("load",t);break;case"video":case"audio":for(n=0;n<ts.length;n++)Fe(ts[n],t);break;case"source":Fe("error",t);break;case"img":case"image":case"link":Fe("error",t),Fe("load",t);break;case"details":Fe("toggle",t);break;case"input":Fe("invalid",t),P(t,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Fe("invalid",t);break;case"textarea":Fe("invalid",t),cn(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||Yh(t.textContent,n)?(l.popover!=null&&(Fe("beforetoggle",t),Fe("toggle",t)),l.onScroll!=null&&Fe("scroll",t),l.onScrollEnd!=null&&Fe("scrollend",t),l.onClick!=null&&(t.onclick=_n),t=!0):t=!1,t||Ul(e,!0)}function Cd(e){for(tn=e.return;tn;)switch(tn.tag){case 5:case 31:case 13:Ln=!1;return;case 27:case 3:Ln=!0;return;default:tn=tn.return}}function Fa(e){if(e!==tn)return!1;if(!We)return Cd(e),We=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||Vc(e.type,e.memoizedProps)),n=!n),n&&ht&&Ul(e),Cd(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(317));ht=Ih(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(317));ht=Ih(e)}else t===27?(t=ht,Wl(e.type)?(e=Ic,Ic=null,ht=e):ht=t):ht=tn?Bn(e.stateNode.nextSibling):null;return!0}function ma(){ht=tn=null,We=!1}function Ao(){var e=Ll;return e!==null&&(bn===null?bn=e:bn.push.apply(bn,e),Ll=null),e}function zi(e){Ll===null?Ll=[e]:Ll.push(e)}var Ro=Ve(null),pa=null,bl=null;function Bl(e,t,n){me(Ro,t._currentValue),t._currentValue=n}function yl(e){e._currentValue=Ro.current,X(Ro)}function jo(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 Mo(e,t,n,l){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var s=a.dependencies;if(s!==null){var f=a.child;s=s.firstContext;e:for(;s!==null;){var p=s;s=a;for(var x=0;x<t.length;x++)if(p.context===t[x]){s.lanes|=n,p=s.alternate,p!==null&&(p.lanes|=n),jo(s.return,n,e),l||(f=null);break e}s=p.next}}else if(a.tag===18){if(f=a.return,f===null)throw Error(c(341));f.lanes|=n,s=f.alternate,s!==null&&(s.lanes|=n),jo(f,n,e),f=null}else f=a.child;if(f!==null)f.return=a;else for(f=a;f!==null;){if(f===e){f=null;break}if(a=f.sibling,a!==null){a.return=f.return,f=a;break}f=f.return}a=f}}function Za(e,t,n,l){e=null;for(var a=t,s=!1;a!==null;){if(!s){if((a.flags&524288)!==0)s=!0;else if((a.flags&262144)!==0)break}if(a.tag===10){var f=a.alternate;if(f===null)throw Error(c(387));if(f=f.memoizedProps,f!==null){var p=a.type;xn(a.pendingProps.value,f.value)||(e!==null?e.push(p):e=[p])}}else if(a===vt.current){if(f=a.alternate,f===null)throw Error(c(387));f.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e!==null?e.push(ss):e=[ss])}a=a.return}e!==null&&Mo(t,e,n,l),t.flags|=262144}function Gs(e){for(e=e.firstContext;e!==null;){if(!xn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ga(e){pa=e,bl=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function nn(e){return Td(pa,e)}function qs(e,t){return pa===null&&ga(e),Td(e,t)}function Td(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},bl===null){if(e===null)throw Error(c(308));bl=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else bl=bl.next=t;return n}var Bg=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()})}},Hg=o.unstable_scheduleCallback,Yg=o.unstable_NormalPriority,Bt={$$typeof:Q,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function _o(){return{controller:new Bg,data:new Map,refCount:0}}function Di(e){e.refCount--,e.refCount===0&&Hg(Yg,function(){e.controller.abort()})}var Oi=null,ko=0,Qa=0,Ia=null;function Kg(e,t){if(Oi===null){var n=Oi=[];ko=0,Qa=Oc(),Ia={status:"pending",value:void 0,then:function(l){n.push(l)}}}return ko++,t.then(Nd,Nd),t}function Nd(){if(--ko===0&&Oi!==null){Ia!==null&&(Ia.status="fulfilled");var e=Oi;Oi=null,Qa=0,Ia=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Gg(e,t){var n=[],l={status:"pending",value:null,reason:null,then:function(a){n.push(a)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var a=0;a<n.length;a++)(0,n[a])(t)},function(a){for(l.status="rejected",l.reason=a,a=0;a<n.length;a++)(0,n[a])(void 0)}),l}var Ed=j.S;j.S=function(e,t){uh=te(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&Kg(e,t),Ed!==null&&Ed(e,t)};var ba=Ve(null);function zo(){var e=ba.current;return e!==null?e:dt.pooledCache}function Vs(e,t){t===null?me(ba,ba.current):me(ba,t.pool)}function Ad(){var e=zo();return e===null?null:{parent:Bt._currentValue,pool:e}}var Ja=Error(c(460)),Do=Error(c(474)),Xs=Error(c(542)),Fs={then:function(){}};function Rd(e){return e=e.status,e==="fulfilled"||e==="rejected"}function jd(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(_n,_n),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,_d(e),e;default:if(typeof t.status=="string")t.then(_n,_n);else{if(e=dt,e!==null&&100<e.shellSuspendCounter)throw Error(c(482));e=t,e.status="pending",e.then(function(l){if(t.status==="pending"){var a=t;a.status="fulfilled",a.value=l}},function(l){if(t.status==="pending"){var a=t;a.status="rejected",a.reason=l}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,_d(e),e}throw va=t,Ja}}function ya(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(va=n,Ja):n}}var va=null;function Md(){if(va===null)throw Error(c(459));var e=va;return va=null,e}function _d(e){if(e===Ja||e===Xs)throw Error(c(483))}var Wa=null,Li=0;function Zs(e){var t=Li;return Li+=1,Wa===null&&(Wa=[]),jd(Wa,e,t)}function Ui(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Qs(e,t){throw t.$$typeof===B?Error(c(525)):(e=Object.prototype.toString.call(t),Error(c(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function kd(e){function t(T,w){if(e){var N=T.deletions;N===null?(T.deletions=[w],T.flags|=16):N.push(w)}}function n(T,w){if(!e)return null;for(;w!==null;)t(T,w),w=w.sibling;return null}function l(T){for(var w=new Map;T!==null;)T.key!==null?w.set(T.key,T):w.set(T.index,T),T=T.sibling;return w}function a(T,w){return T=pl(T,w),T.index=0,T.sibling=null,T}function s(T,w,N){return T.index=N,e?(N=T.alternate,N!==null?(N=N.index,N<w?(T.flags|=67108866,w):N):(T.flags|=67108866,w)):(T.flags|=1048576,w)}function f(T){return e&&T.alternate===null&&(T.flags|=67108866),T}function p(T,w,N,K){return w===null||w.tag!==6?(w=wo(N,T.mode,K),w.return=T,w):(w=a(w,N),w.return=T,w)}function x(T,w,N,K){var be=N.type;return be===V?U(T,w,N.props.children,K,N.key):w!==null&&(w.elementType===be||typeof be=="object"&&be!==null&&be.$$typeof===A&&ya(be)===w.type)?(w=a(w,N.props),Ui(w,N),w.return=T,w):(w=Ys(N.type,N.key,N.props,null,T.mode,K),Ui(w,N),w.return=T,w)}function E(T,w,N,K){return w===null||w.tag!==4||w.stateNode.containerInfo!==N.containerInfo||w.stateNode.implementation!==N.implementation?(w=Co(N,T.mode,K),w.return=T,w):(w=a(w,N.children||[]),w.return=T,w)}function U(T,w,N,K,be){return w===null||w.tag!==7?(w=ha(N,T.mode,K,be),w.return=T,w):(w=a(w,N),w.return=T,w)}function G(T,w,N){if(typeof w=="string"&&w!==""||typeof w=="number"||typeof w=="bigint")return w=wo(""+w,T.mode,N),w.return=T,w;if(typeof w=="object"&&w!==null){switch(w.$$typeof){case z:return N=Ys(w.type,w.key,w.props,null,T.mode,N),Ui(N,w),N.return=T,N;case _:return w=Co(w,T.mode,N),w.return=T,w;case A:return w=ya(w),G(T,w,N)}if(Be(w)||Ne(w))return w=ha(w,T.mode,N,null),w.return=T,w;if(typeof w.then=="function")return G(T,Zs(w),N);if(w.$$typeof===Q)return G(T,qs(T,w),N);Qs(T,w)}return null}function R(T,w,N,K){var be=w!==null?w.key:null;if(typeof N=="string"&&N!==""||typeof N=="number"||typeof N=="bigint")return be!==null?null:p(T,w,""+N,K);if(typeof N=="object"&&N!==null){switch(N.$$typeof){case z:return N.key===be?x(T,w,N,K):null;case _:return N.key===be?E(T,w,N,K):null;case A:return N=ya(N),R(T,w,N,K)}if(Be(N)||Ne(N))return be!==null?null:U(T,w,N,K,null);if(typeof N.then=="function")return R(T,w,Zs(N),K);if(N.$$typeof===Q)return R(T,w,qs(T,N),K);Qs(T,N)}return null}function M(T,w,N,K,be){if(typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint")return T=T.get(N)||null,p(w,T,""+K,be);if(typeof K=="object"&&K!==null){switch(K.$$typeof){case z:return T=T.get(K.key===null?N:K.key)||null,x(w,T,K,be);case _:return T=T.get(K.key===null?N:K.key)||null,E(w,T,K,be);case A:return K=ya(K),M(T,w,N,K,be)}if(Be(K)||Ne(K))return T=T.get(N)||null,U(w,T,K,be,null);if(typeof K.then=="function")return M(T,w,N,Zs(K),be);if(K.$$typeof===Q)return M(T,w,N,qs(w,K),be);Qs(w,K)}return null}function re(T,w,N,K){for(var be=null,$e=null,ue=w,He=w=0,Qe=null;ue!==null&&He<N.length;He++){ue.index>He?(Qe=ue,ue=null):Qe=ue.sibling;var et=R(T,ue,N[He],K);if(et===null){ue===null&&(ue=Qe);break}e&&ue&&et.alternate===null&&t(T,ue),w=s(et,w,He),$e===null?be=et:$e.sibling=et,$e=et,ue=Qe}if(He===N.length)return n(T,ue),We&&gl(T,He),be;if(ue===null){for(;He<N.length;He++)ue=G(T,N[He],K),ue!==null&&(w=s(ue,w,He),$e===null?be=ue:$e.sibling=ue,$e=ue);return We&&gl(T,He),be}for(ue=l(ue);He<N.length;He++)Qe=M(ue,T,He,N[He],K),Qe!==null&&(e&&Qe.alternate!==null&&ue.delete(Qe.key===null?He:Qe.key),w=s(Qe,w,He),$e===null?be=Qe:$e.sibling=Qe,$e=Qe);return e&&ue.forEach(function(na){return t(T,na)}),We&&gl(T,He),be}function Ce(T,w,N,K){if(N==null)throw Error(c(151));for(var be=null,$e=null,ue=w,He=w=0,Qe=null,et=N.next();ue!==null&&!et.done;He++,et=N.next()){ue.index>He?(Qe=ue,ue=null):Qe=ue.sibling;var na=R(T,ue,et.value,K);if(na===null){ue===null&&(ue=Qe);break}e&&ue&&na.alternate===null&&t(T,ue),w=s(na,w,He),$e===null?be=na:$e.sibling=na,$e=na,ue=Qe}if(et.done)return n(T,ue),We&&gl(T,He),be;if(ue===null){for(;!et.done;He++,et=N.next())et=G(T,et.value,K),et!==null&&(w=s(et,w,He),$e===null?be=et:$e.sibling=et,$e=et);return We&&gl(T,He),be}for(ue=l(ue);!et.done;He++,et=N.next())et=M(ue,T,He,et.value,K),et!==null&&(e&&et.alternate!==null&&ue.delete(et.key===null?He:et.key),w=s(et,w,He),$e===null?be=et:$e.sibling=et,$e=et);return e&&ue.forEach(function($b){return t(T,$b)}),We&&gl(T,He),be}function ct(T,w,N,K){if(typeof N=="object"&&N!==null&&N.type===V&&N.key===null&&(N=N.props.children),typeof N=="object"&&N!==null){switch(N.$$typeof){case z:e:{for(var be=N.key;w!==null;){if(w.key===be){if(be=N.type,be===V){if(w.tag===7){n(T,w.sibling),K=a(w,N.props.children),K.return=T,T=K;break e}}else if(w.elementType===be||typeof be=="object"&&be!==null&&be.$$typeof===A&&ya(be)===w.type){n(T,w.sibling),K=a(w,N.props),Ui(K,N),K.return=T,T=K;break e}n(T,w);break}else t(T,w);w=w.sibling}N.type===V?(K=ha(N.props.children,T.mode,K,N.key),K.return=T,T=K):(K=Ys(N.type,N.key,N.props,null,T.mode,K),Ui(K,N),K.return=T,T=K)}return f(T);case _:e:{for(be=N.key;w!==null;){if(w.key===be)if(w.tag===4&&w.stateNode.containerInfo===N.containerInfo&&w.stateNode.implementation===N.implementation){n(T,w.sibling),K=a(w,N.children||[]),K.return=T,T=K;break e}else{n(T,w);break}else t(T,w);w=w.sibling}K=Co(N,T.mode,K),K.return=T,T=K}return f(T);case A:return N=ya(N),ct(T,w,N,K)}if(Be(N))return re(T,w,N,K);if(Ne(N)){if(be=Ne(N),typeof be!="function")throw Error(c(150));return N=be.call(N),Ce(T,w,N,K)}if(typeof N.then=="function")return ct(T,w,Zs(N),K);if(N.$$typeof===Q)return ct(T,w,qs(T,N),K);Qs(T,N)}return typeof N=="string"&&N!==""||typeof N=="number"||typeof N=="bigint"?(N=""+N,w!==null&&w.tag===6?(n(T,w.sibling),K=a(w,N),K.return=T,T=K):(n(T,w),K=wo(N,T.mode,K),K.return=T,T=K),f(T)):n(T,w)}return function(T,w,N,K){try{Li=0;var be=ct(T,w,N,K);return Wa=null,be}catch(ue){if(ue===Ja||ue===Xs)throw ue;var $e=Sn(29,ue,null,T.mode);return $e.lanes=K,$e.return=T,$e}finally{}}}var xa=kd(!0),zd=kd(!1),Hl=!1;function Oo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Lo(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 Yl(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Kl(e,t,n){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(lt&2)!==0){var a=l.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),l.pending=t,t=Hs(e),gd(e,null,n),t}return Bs(e,l,t,n),Hs(e)}function Bi(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,L(e,n)}}function Uo(e,t){var n=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,n===l)){var a=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var f={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};s===null?a=s=f:s=s.next=f,n=n.next}while(n!==null);s===null?a=s=t:s=s.next=t}else a=s=t;n={baseState:l.baseState,firstBaseUpdate:a,lastBaseUpdate:s,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 Bo=!1;function Hi(){if(Bo){var e=Ia;if(e!==null)throw e}}function Yi(e,t,n,l){Bo=!1;var a=e.updateQueue;Hl=!1;var s=a.firstBaseUpdate,f=a.lastBaseUpdate,p=a.shared.pending;if(p!==null){a.shared.pending=null;var x=p,E=x.next;x.next=null,f===null?s=E:f.next=E,f=x;var U=e.alternate;U!==null&&(U=U.updateQueue,p=U.lastBaseUpdate,p!==f&&(p===null?U.firstBaseUpdate=E:p.next=E,U.lastBaseUpdate=x))}if(s!==null){var G=a.baseState;f=0,U=E=x=null,p=s;do{var R=p.lane&-536870913,M=R!==p.lane;if(M?(Ze&R)===R:(l&R)===R){R!==0&&R===Qa&&(Bo=!0),U!==null&&(U=U.next={lane:0,tag:p.tag,payload:p.payload,callback:null,next:null});e:{var re=e,Ce=p;R=t;var ct=n;switch(Ce.tag){case 1:if(re=Ce.payload,typeof re=="function"){G=re.call(ct,G,R);break e}G=re;break e;case 3:re.flags=re.flags&-65537|128;case 0:if(re=Ce.payload,R=typeof re=="function"?re.call(ct,G,R):re,R==null)break e;G=C({},G,R);break e;case 2:Hl=!0}}R=p.callback,R!==null&&(e.flags|=64,M&&(e.flags|=8192),M=a.callbacks,M===null?a.callbacks=[R]:M.push(R))}else M={lane:R,tag:p.tag,payload:p.payload,callback:p.callback,next:null},U===null?(E=U=M,x=G):U=U.next=M,f|=R;if(p=p.next,p===null){if(p=a.shared.pending,p===null)break;M=p,p=M.next,M.next=null,a.lastBaseUpdate=M,a.shared.pending=null}}while(!0);U===null&&(x=G),a.baseState=x,a.firstBaseUpdate=E,a.lastBaseUpdate=U,s===null&&(a.shared.lanes=0),Fl|=f,e.lanes=f,e.memoizedState=G}}function Dd(e,t){if(typeof e!="function")throw Error(c(191,e));e.call(t)}function Od(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Dd(n[e],t)}var Pa=Ve(null),Is=Ve(0);function Ld(e,t){e=Al,me(Is,e),me(Pa,t),Al=e|t.baseLanes}function Ho(){me(Is,Al),me(Pa,Pa.current)}function Yo(){Al=Is.current,X(Pa),X(Is)}var wn=Ve(null),Un=null;function Gl(e){var t=e.alternate;me(kt,kt.current&1),me(wn,e),Un===null&&(t===null||Pa.current!==null||t.memoizedState!==null)&&(Un=e)}function Ko(e){me(kt,kt.current),me(wn,e),Un===null&&(Un=e)}function Ud(e){e.tag===22?(me(kt,kt.current),me(wn,e),Un===null&&(Un=e)):ql()}function ql(){me(kt,kt.current),me(wn,wn.current)}function Cn(e){X(wn),Un===e&&(Un=null),X(kt)}var kt=Ve(0);function Js(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||Zc(n)||Qc(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 vl=0,Ue=null,rt=null,Ht=null,Ws=!1,$a=!1,Sa=!1,Ps=0,Ki=0,ei=null,qg=0;function Nt(){throw Error(c(321))}function Go(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!xn(e[n],t[n]))return!1;return!0}function qo(e,t,n,l,a,s){return vl=s,Ue=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,j.H=e===null||e.memoizedState===null?Sf:ac,Sa=!1,s=n(l,a),Sa=!1,$a&&(s=Hd(t,n,l,a)),Bd(e),s}function Bd(e){j.H=Vi;var t=rt!==null&&rt.next!==null;if(vl=0,Ht=rt=Ue=null,Ws=!1,Ki=0,ei=null,t)throw Error(c(300));e===null||Yt||(e=e.dependencies,e!==null&&Gs(e)&&(Yt=!0))}function Hd(e,t,n,l){Ue=e;var a=0;do{if($a&&(ei=null),Ki=0,$a=!1,25<=a)throw Error(c(301));if(a+=1,Ht=rt=null,e.updateQueue!=null){var s=e.updateQueue;s.lastEffect=null,s.events=null,s.stores=null,s.memoCache!=null&&(s.memoCache.index=0)}j.H=wf,s=t(n,l)}while($a);return s}function Vg(){var e=j.H,t=e.useState()[0];return t=typeof t.then=="function"?Gi(t):t,e=e.useState()[0],(rt!==null?rt.memoizedState:null)!==e&&(Ue.flags|=1024),t}function Vo(){var e=Ps!==0;return Ps=0,e}function Xo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Fo(e){if(Ws){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Ws=!1}vl=0,Ht=rt=Ue=null,$a=!1,Ki=Ps=0,ei=null}function un(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ht===null?Ue.memoizedState=Ht=e:Ht=Ht.next=e,Ht}function zt(){if(rt===null){var e=Ue.alternate;e=e!==null?e.memoizedState:null}else e=rt.next;var t=Ht===null?Ue.memoizedState:Ht.next;if(t!==null)Ht=t,rt=e;else{if(e===null)throw Ue.alternate===null?Error(c(467)):Error(c(310));rt=e,e={memoizedState:rt.memoizedState,baseState:rt.baseState,baseQueue:rt.baseQueue,queue:rt.queue,next:null},Ht===null?Ue.memoizedState=Ht=e:Ht=Ht.next=e}return Ht}function $s(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Gi(e){var t=Ki;return Ki+=1,ei===null&&(ei=[]),e=jd(ei,e,t),t=Ue,(Ht===null?t.memoizedState:Ht.next)===null&&(t=t.alternate,j.H=t===null||t.memoizedState===null?Sf:ac),e}function er(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Gi(e);if(e.$$typeof===Q)return nn(e)}throw Error(c(438,String(e)))}function Zo(e){var t=null,n=Ue.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var l=Ue.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(t={data:l.data.map(function(a){return a.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=$s(),Ue.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]=Ae;return t.index++,n}function xl(e,t){return typeof t=="function"?t(e):t}function tr(e){var t=zt();return Qo(t,rt,e)}function Qo(e,t,n){var l=e.queue;if(l===null)throw Error(c(311));l.lastRenderedReducer=n;var a=e.baseQueue,s=l.pending;if(s!==null){if(a!==null){var f=a.next;a.next=s.next,s.next=f}t.baseQueue=a=s,l.pending=null}if(s=e.baseState,a===null)e.memoizedState=s;else{t=a.next;var p=f=null,x=null,E=t,U=!1;do{var G=E.lane&-536870913;if(G!==E.lane?(Ze&G)===G:(vl&G)===G){var R=E.revertLane;if(R===0)x!==null&&(x=x.next={lane:0,revertLane:0,gesture:null,action:E.action,hasEagerState:E.hasEagerState,eagerState:E.eagerState,next:null}),G===Qa&&(U=!0);else if((vl&R)===R){E=E.next,R===Qa&&(U=!0);continue}else G={lane:0,revertLane:E.revertLane,gesture:null,action:E.action,hasEagerState:E.hasEagerState,eagerState:E.eagerState,next:null},x===null?(p=x=G,f=s):x=x.next=G,Ue.lanes|=R,Fl|=R;G=E.action,Sa&&n(s,G),s=E.hasEagerState?E.eagerState:n(s,G)}else R={lane:G,revertLane:E.revertLane,gesture:E.gesture,action:E.action,hasEagerState:E.hasEagerState,eagerState:E.eagerState,next:null},x===null?(p=x=R,f=s):x=x.next=R,Ue.lanes|=G,Fl|=G;E=E.next}while(E!==null&&E!==t);if(x===null?f=s:x.next=p,!xn(s,e.memoizedState)&&(Yt=!0,U&&(n=Ia,n!==null)))throw n;e.memoizedState=s,e.baseState=f,e.baseQueue=x,l.lastRenderedState=s}return a===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Io(e){var t=zt(),n=t.queue;if(n===null)throw Error(c(311));n.lastRenderedReducer=e;var l=n.dispatch,a=n.pending,s=t.memoizedState;if(a!==null){n.pending=null;var f=a=a.next;do s=e(s,f.action),f=f.next;while(f!==a);xn(s,t.memoizedState)||(Yt=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),n.lastRenderedState=s}return[s,l]}function Yd(e,t,n){var l=Ue,a=zt(),s=We;if(s){if(n===void 0)throw Error(c(407));n=n()}else n=t();var f=!xn((rt||a).memoizedState,n);if(f&&(a.memoizedState=n,Yt=!0),a=a.queue,Po(qd.bind(null,l,a,e),[e]),a.getSnapshot!==t||f||Ht!==null&&Ht.memoizedState.tag&1){if(l.flags|=2048,ti(9,{destroy:void 0},Gd.bind(null,l,a,n,t),null),dt===null)throw Error(c(349));s||(vl&127)!==0||Kd(l,t,n)}return n}function Kd(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Ue.updateQueue,t===null?(t=$s(),Ue.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Gd(e,t,n,l){t.value=n,t.getSnapshot=l,Vd(t)&&Xd(e)}function qd(e,t,n){return n(function(){Vd(t)&&Xd(e)})}function Vd(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!xn(e,n)}catch{return!0}}function Xd(e){var t=fa(e,2);t!==null&&yn(t,e,2)}function Jo(e){var t=un();if(typeof e=="function"){var n=e;if(e=n(),Sa){Qt(!0);try{n()}finally{Qt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:xl,lastRenderedState:e},t}function Fd(e,t,n,l){return e.baseState=n,Qo(e,rt,typeof l=="function"?l:xl)}function Xg(e,t,n,l,a){if(ar(e))throw Error(c(485));if(e=t.action,e!==null){var s={payload:a,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(f){s.listeners.push(f)}};j.T!==null?n(!0):s.isTransition=!1,l(s),n=t.pending,n===null?(s.next=t.pending=s,Zd(t,s)):(s.next=n.next,t.pending=n.next=s)}}function Zd(e,t){var n=t.action,l=t.payload,a=e.state;if(t.isTransition){var s=j.T,f={};j.T=f;try{var p=n(a,l),x=j.S;x!==null&&x(f,p),Qd(e,t,p)}catch(E){Wo(e,t,E)}finally{s!==null&&f.types!==null&&(s.types=f.types),j.T=s}}else try{s=n(a,l),Qd(e,t,s)}catch(E){Wo(e,t,E)}}function Qd(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(l){Id(e,t,l)},function(l){return Wo(e,t,l)}):Id(e,t,n)}function Id(e,t,n){t.status="fulfilled",t.value=n,Jd(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Zd(e,n)))}function Wo(e,t,n){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=n,Jd(t),t=t.next;while(t!==l)}e.action=null}function Jd(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Wd(e,t){return t}function Pd(e,t){if(We){var n=dt.formState;if(n!==null){e:{var l=Ue;if(We){if(ht){t:{for(var a=ht,s=Ln;a.nodeType!==8;){if(!s){a=null;break t}if(a=Bn(a.nextSibling),a===null){a=null;break t}}s=a.data,a=s==="F!"||s==="F"?a:null}if(a){ht=Bn(a.nextSibling),l=a.data==="F!";break e}}Ul(l)}l=!1}l&&(t=n[0])}}return n=un(),n.memoizedState=n.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wd,lastRenderedState:t},n.queue=l,n=yf.bind(null,Ue,l),l.dispatch=n,l=Jo(!1),s=lc.bind(null,Ue,!1,l.queue),l=un(),a={state:t,dispatch:null,action:e,pending:null},l.queue=a,n=Xg.bind(null,Ue,a,s,n),a.dispatch=n,l.memoizedState=e,[t,n,!1]}function $d(e){var t=zt();return ef(t,rt,e)}function ef(e,t,n){if(t=Qo(e,t,Wd)[0],e=tr(xl)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=Gi(t)}catch(f){throw f===Ja?Xs:f}else l=t;t=zt();var a=t.queue,s=a.dispatch;return n!==t.memoizedState&&(Ue.flags|=2048,ti(9,{destroy:void 0},Fg.bind(null,a,n),null)),[l,s,e]}function Fg(e,t){e.action=t}function tf(e){var t=zt(),n=rt;if(n!==null)return ef(t,n,e);zt(),t=t.memoizedState,n=zt();var l=n.queue.dispatch;return n.memoizedState=e,[t,l,!1]}function ti(e,t,n,l){return e={tag:e,create:n,deps:l,inst:t,next:null},t=Ue.updateQueue,t===null&&(t=$s(),Ue.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 nf(){return zt().memoizedState}function nr(e,t,n,l){var a=un();Ue.flags|=e,a.memoizedState=ti(1|t,{destroy:void 0},n,l===void 0?null:l)}function lr(e,t,n,l){var a=zt();l=l===void 0?null:l;var s=a.memoizedState.inst;rt!==null&&l!==null&&Go(l,rt.memoizedState.deps)?a.memoizedState=ti(t,s,n,l):(Ue.flags|=e,a.memoizedState=ti(1|t,s,n,l))}function lf(e,t){nr(8390656,8,e,t)}function Po(e,t){lr(2048,8,e,t)}function Zg(e){Ue.flags|=4;var t=Ue.updateQueue;if(t===null)t=$s(),Ue.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function af(e){var t=zt().memoizedState;return Zg({ref:t,nextImpl:e}),function(){if((lt&2)!==0)throw Error(c(440));return t.impl.apply(void 0,arguments)}}function sf(e,t){return lr(4,2,e,t)}function rf(e,t){return lr(4,4,e,t)}function of(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 cf(e,t,n){n=n!=null?n.concat([e]):null,lr(4,4,of.bind(null,t,e),n)}function $o(){}function uf(e,t){var n=zt();t=t===void 0?null:t;var l=n.memoizedState;return t!==null&&Go(t,l[1])?l[0]:(n.memoizedState=[e,t],e)}function df(e,t){var n=zt();t=t===void 0?null:t;var l=n.memoizedState;if(t!==null&&Go(t,l[1]))return l[0];if(l=e(),Sa){Qt(!0);try{e()}finally{Qt(!1)}}return n.memoizedState=[l,t],l}function ec(e,t,n){return n===void 0||(vl&1073741824)!==0&&(Ze&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=fh(),Ue.lanes|=e,Fl|=e,n)}function ff(e,t,n,l){return xn(n,t)?n:Pa.current!==null?(e=ec(e,n,l),xn(e,t)||(Yt=!0),e):(vl&42)===0||(vl&1073741824)!==0&&(Ze&261930)===0?(Yt=!0,e.memoizedState=n):(e=fh(),Ue.lanes|=e,Fl|=e,t)}function hf(e,t,n,l,a){var s=q.p;q.p=s!==0&&8>s?s:8;var f=j.T,p={};j.T=p,lc(e,!1,t,n);try{var x=a(),E=j.S;if(E!==null&&E(p,x),x!==null&&typeof x=="object"&&typeof x.then=="function"){var U=Gg(x,l);qi(e,t,U,En(e))}else qi(e,t,l,En(e))}catch(G){qi(e,t,{then:function(){},status:"rejected",reason:G},En())}finally{q.p=s,f!==null&&p.types!==null&&(f.types=p.types),j.T=f}}function Qg(){}function tc(e,t,n,l){if(e.tag!==5)throw Error(c(476));var a=mf(e).queue;hf(e,a,t,J,n===null?Qg:function(){return pf(e),n(l)})}function mf(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:J,baseState:J,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:xl,lastRenderedState:J},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:xl,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function pf(e){var t=mf(e);t.next===null&&(t=e.alternate.memoizedState),qi(e,t.next.queue,{},En())}function nc(){return nn(ss)}function gf(){return zt().memoizedState}function bf(){return zt().memoizedState}function Ig(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=En();e=Yl(n);var l=Kl(t,e,n);l!==null&&(yn(l,t,n),Bi(l,t,n)),t={cache:_o()},e.payload=t;return}t=t.return}}function Jg(e,t,n){var l=En();n={lane:l,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},ar(e)?vf(t,n):(n=xo(e,t,n,l),n!==null&&(yn(n,e,l),xf(n,t,l)))}function yf(e,t,n){var l=En();qi(e,t,n,l)}function qi(e,t,n,l){var a={lane:l,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(ar(e))vf(t,a);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var f=t.lastRenderedState,p=s(f,n);if(a.hasEagerState=!0,a.eagerState=p,xn(p,f))return Bs(e,t,a,0),dt===null&&Us(),!1}catch{}finally{}if(n=xo(e,t,a,l),n!==null)return yn(n,e,l),xf(n,t,l),!0}return!1}function lc(e,t,n,l){if(l={lane:2,revertLane:Oc(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},ar(e)){if(t)throw Error(c(479))}else t=xo(e,n,l,2),t!==null&&yn(t,e,2)}function ar(e){var t=e.alternate;return e===Ue||t!==null&&t===Ue}function vf(e,t){$a=Ws=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function xf(e,t,n){if((n&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,n|=l,t.lanes=n,L(e,n)}}var Vi={readContext:nn,use:er,useCallback:Nt,useContext:Nt,useEffect:Nt,useImperativeHandle:Nt,useLayoutEffect:Nt,useInsertionEffect:Nt,useMemo:Nt,useReducer:Nt,useRef:Nt,useState:Nt,useDebugValue:Nt,useDeferredValue:Nt,useTransition:Nt,useSyncExternalStore:Nt,useId:Nt,useHostTransitionStatus:Nt,useFormState:Nt,useActionState:Nt,useOptimistic:Nt,useMemoCache:Nt,useCacheRefresh:Nt};Vi.useEffectEvent=Nt;var Sf={readContext:nn,use:er,useCallback:function(e,t){return un().memoizedState=[e,t===void 0?null:t],e},useContext:nn,useEffect:lf,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,nr(4194308,4,of.bind(null,t,e),n)},useLayoutEffect:function(e,t){return nr(4194308,4,e,t)},useInsertionEffect:function(e,t){nr(4,2,e,t)},useMemo:function(e,t){var n=un();t=t===void 0?null:t;var l=e();if(Sa){Qt(!0);try{e()}finally{Qt(!1)}}return n.memoizedState=[l,t],l},useReducer:function(e,t,n){var l=un();if(n!==void 0){var a=n(t);if(Sa){Qt(!0);try{n(t)}finally{Qt(!1)}}}else a=t;return l.memoizedState=l.baseState=a,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:a},l.queue=e,e=e.dispatch=Jg.bind(null,Ue,e),[l.memoizedState,e]},useRef:function(e){var t=un();return e={current:e},t.memoizedState=e},useState:function(e){e=Jo(e);var t=e.queue,n=yf.bind(null,Ue,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:$o,useDeferredValue:function(e,t){var n=un();return ec(n,e,t)},useTransition:function(){var e=Jo(!1);return e=hf.bind(null,Ue,e.queue,!0,!1),un().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var l=Ue,a=un();if(We){if(n===void 0)throw Error(c(407));n=n()}else{if(n=t(),dt===null)throw Error(c(349));(Ze&127)!==0||Kd(l,t,n)}a.memoizedState=n;var s={value:n,getSnapshot:t};return a.queue=s,lf(qd.bind(null,l,s,e),[e]),l.flags|=2048,ti(9,{destroy:void 0},Gd.bind(null,l,s,n,t),null),n},useId:function(){var e=un(),t=dt.identifierPrefix;if(We){var n=tl,l=el;n=(l&~(1<<32-gt(l)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Ps++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=qg++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:nc,useFormState:Pd,useActionState:Pd,useOptimistic:function(e){var t=un();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=lc.bind(null,Ue,!0,n),n.dispatch=t,[e,t]},useMemoCache:Zo,useCacheRefresh:function(){return un().memoizedState=Ig.bind(null,Ue)},useEffectEvent:function(e){var t=un(),n={impl:e};return t.memoizedState=n,function(){if((lt&2)!==0)throw Error(c(440));return n.impl.apply(void 0,arguments)}}},ac={readContext:nn,use:er,useCallback:uf,useContext:nn,useEffect:Po,useImperativeHandle:cf,useInsertionEffect:sf,useLayoutEffect:rf,useMemo:df,useReducer:tr,useRef:nf,useState:function(){return tr(xl)},useDebugValue:$o,useDeferredValue:function(e,t){var n=zt();return ff(n,rt.memoizedState,e,t)},useTransition:function(){var e=tr(xl)[0],t=zt().memoizedState;return[typeof e=="boolean"?e:Gi(e),t]},useSyncExternalStore:Yd,useId:gf,useHostTransitionStatus:nc,useFormState:$d,useActionState:$d,useOptimistic:function(e,t){var n=zt();return Fd(n,rt,e,t)},useMemoCache:Zo,useCacheRefresh:bf};ac.useEffectEvent=af;var wf={readContext:nn,use:er,useCallback:uf,useContext:nn,useEffect:Po,useImperativeHandle:cf,useInsertionEffect:sf,useLayoutEffect:rf,useMemo:df,useReducer:Io,useRef:nf,useState:function(){return Io(xl)},useDebugValue:$o,useDeferredValue:function(e,t){var n=zt();return rt===null?ec(n,e,t):ff(n,rt.memoizedState,e,t)},useTransition:function(){var e=Io(xl)[0],t=zt().memoizedState;return[typeof e=="boolean"?e:Gi(e),t]},useSyncExternalStore:Yd,useId:gf,useHostTransitionStatus:nc,useFormState:tf,useActionState:tf,useOptimistic:function(e,t){var n=zt();return rt!==null?Fd(n,rt,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:Zo,useCacheRefresh:bf};wf.useEffectEvent=af;function ic(e,t,n,l){t=e.memoizedState,n=n(l,t),n=n==null?t:C({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var sc={enqueueSetState:function(e,t,n){e=e._reactInternals;var l=En(),a=Yl(l);a.payload=t,n!=null&&(a.callback=n),t=Kl(e,a,l),t!==null&&(yn(t,e,l),Bi(t,e,l))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var l=En(),a=Yl(l);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=Kl(e,a,l),t!==null&&(yn(t,e,l),Bi(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=En(),l=Yl(n);l.tag=2,t!=null&&(l.callback=t),t=Kl(e,l,n),t!==null&&(yn(t,e,n),Bi(t,e,n))}};function Cf(e,t,n,l,a,s,f){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,s,f):t.prototype&&t.prototype.isPureReactComponent?!Mi(n,l)||!Mi(a,s):!0}function Tf(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&&sc.enqueueReplaceState(t,t.state,null)}function wa(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=C({},n));for(var a in e)n[a]===void 0&&(n[a]=e[a])}return n}function Nf(e){Ls(e)}function Ef(e){console.error(e)}function Af(e){Ls(e)}function ir(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function Rf(e,t,n){try{var l=e.onCaughtError;l(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(a){setTimeout(function(){throw a})}}function rc(e,t,n){return n=Yl(n),n.tag=3,n.payload={element:null},n.callback=function(){ir(e,t)},n}function jf(e){return e=Yl(e),e.tag=3,e}function Mf(e,t,n,l){var a=n.type.getDerivedStateFromError;if(typeof a=="function"){var s=l.value;e.payload=function(){return a(s)},e.callback=function(){Rf(t,n,l)}}var f=n.stateNode;f!==null&&typeof f.componentDidCatch=="function"&&(e.callback=function(){Rf(t,n,l),typeof a!="function"&&(Zl===null?Zl=new Set([this]):Zl.add(this));var p=l.stack;this.componentDidCatch(l.value,{componentStack:p!==null?p:""})})}function Wg(e,t,n,l,a){if(n.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=n.alternate,t!==null&&Za(t,n,a,!0),n=wn.current,n!==null){switch(n.tag){case 31:case 13:return Un===null?br():n.alternate===null&&Et===0&&(Et=3),n.flags&=-257,n.flags|=65536,n.lanes=a,l===Fs?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([l]):t.add(l),kc(e,l,a)),!1;case 22:return n.flags|=65536,l===Fs?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)),kc(e,l,a)),!1}throw Error(c(435,n.tag))}return kc(e,l,a),br(),!1}if(We)return t=wn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=a,l!==Eo&&(e=Error(c(422),{cause:l}),zi(zn(e,n)))):(l!==Eo&&(t=Error(c(423),{cause:l}),zi(zn(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,l=zn(l,n),a=rc(e.stateNode,l,a),Uo(e,a),Et!==4&&(Et=2)),!1;var s=Error(c(520),{cause:l});if(s=zn(s,n),Pi===null?Pi=[s]:Pi.push(s),Et!==4&&(Et=2),t===null)return!0;l=zn(l,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=rc(n.stateNode,l,e),Uo(n,e),!1;case 1:if(t=n.type,s=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||s!==null&&typeof s.componentDidCatch=="function"&&(Zl===null||!Zl.has(s))))return n.flags|=65536,a&=-a,n.lanes|=a,a=jf(a),Mf(a,e,n,l),Uo(n,a),!1}n=n.return}while(n!==null);return!1}var oc=Error(c(461)),Yt=!1;function ln(e,t,n,l){t.child=e===null?zd(t,null,n,l):xa(t,e.child,n,l)}function _f(e,t,n,l,a){n=n.render;var s=t.ref;if("ref"in l){var f={};for(var p in l)p!=="ref"&&(f[p]=l[p])}else f=l;return ga(t),l=qo(e,t,n,f,s,a),p=Vo(),e!==null&&!Yt?(Xo(e,t,a),Sl(e,t,a)):(We&&p&&To(t),t.flags|=1,ln(e,t,l,a),t.child)}function kf(e,t,n,l,a){if(e===null){var s=n.type;return typeof s=="function"&&!So(s)&&s.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=s,zf(e,t,s,l,a)):(e=Ys(n.type,null,l,t,t.mode,a),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!gc(e,a)){var f=s.memoizedProps;if(n=n.compare,n=n!==null?n:Mi,n(f,l)&&e.ref===t.ref)return Sl(e,t,a)}return t.flags|=1,e=pl(s,l),e.ref=t.ref,e.return=t,t.child=e}function zf(e,t,n,l,a){if(e!==null){var s=e.memoizedProps;if(Mi(s,l)&&e.ref===t.ref)if(Yt=!1,t.pendingProps=l=s,gc(e,a))(e.flags&131072)!==0&&(Yt=!0);else return t.lanes=e.lanes,Sl(e,t,a)}return cc(e,t,n,l,a)}function Df(e,t,n,l){var a=l.children,s=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(s=s!==null?s.baseLanes|n:n,e!==null){for(l=t.child=e.child,a=0;l!==null;)a=a|l.lanes|l.childLanes,l=l.sibling;l=a&~s}else l=0,t.child=null;return Of(e,t,s,n,l)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Vs(t,s!==null?s.cachePool:null),s!==null?Ld(t,s):Ho(),Ud(t);else return l=t.lanes=536870912,Of(e,t,s!==null?s.baseLanes|n:n,n,l)}else s!==null?(Vs(t,s.cachePool),Ld(t,s),ql(),t.memoizedState=null):(e!==null&&Vs(t,null),Ho(),ql());return ln(e,t,a,n),t.child}function Xi(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Of(e,t,n,l,a){var s=zo();return s=s===null?null:{parent:Bt._currentValue,pool:s},t.memoizedState={baseLanes:n,cachePool:s},e!==null&&Vs(t,null),Ho(),Ud(t),e!==null&&Za(e,t,l,!0),t.childLanes=a,null}function sr(e,t){return t=or({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Lf(e,t,n){return xa(t,e.child,null,n),e=sr(t,t.pendingProps),e.flags|=2,Cn(t),t.memoizedState=null,e}function Pg(e,t,n){var l=t.pendingProps,a=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(We){if(l.mode==="hidden")return e=sr(t,l),t.lanes=536870912,Xi(null,e);if(Ko(t),(e=ht)?(e=Qh(e,Ln),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ol!==null?{id:el,overflow:tl}:null,retryLane:536870912,hydrationErrors:null},n=yd(e),n.return=t,t.child=n,tn=t,ht=null)):e=null,e===null)throw Ul(t);return t.lanes=536870912,null}return sr(t,l)}var s=e.memoizedState;if(s!==null){var f=s.dehydrated;if(Ko(t),a)if(t.flags&256)t.flags&=-257,t=Lf(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(c(558));else if(Yt||Za(e,t,n,!1),a=(n&e.childLanes)!==0,Yt||a){if(l=dt,l!==null&&(f=Y(l,n),f!==0&&f!==s.retryLane))throw s.retryLane=f,fa(e,f),yn(l,e,f),oc;br(),t=Lf(e,t,n)}else e=s.treeContext,ht=Bn(f.nextSibling),tn=t,We=!0,Ll=null,Ln=!1,e!==null&&Sd(t,e),t=sr(t,l),t.flags|=4096;return t}return e=pl(e.child,{mode:l.mode,children:l.children}),e.ref=t.ref,t.child=e,e.return=t,e}function rr(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(c(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function cc(e,t,n,l,a){return ga(t),n=qo(e,t,n,l,void 0,a),l=Vo(),e!==null&&!Yt?(Xo(e,t,a),Sl(e,t,a)):(We&&l&&To(t),t.flags|=1,ln(e,t,n,a),t.child)}function Uf(e,t,n,l,a,s){return ga(t),t.updateQueue=null,n=Hd(t,l,n,a),Bd(e),l=Vo(),e!==null&&!Yt?(Xo(e,t,s),Sl(e,t,s)):(We&&l&&To(t),t.flags|=1,ln(e,t,n,s),t.child)}function Bf(e,t,n,l,a){if(ga(t),t.stateNode===null){var s=qa,f=n.contextType;typeof f=="object"&&f!==null&&(s=nn(f)),s=new n(l,s),t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=sc,t.stateNode=s,s._reactInternals=t,s=t.stateNode,s.props=l,s.state=t.memoizedState,s.refs={},Oo(t),f=n.contextType,s.context=typeof f=="object"&&f!==null?nn(f):qa,s.state=t.memoizedState,f=n.getDerivedStateFromProps,typeof f=="function"&&(ic(t,n,f,l),s.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(f=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),f!==s.state&&sc.enqueueReplaceState(s,s.state,null),Yi(t,l,s,a),Hi(),s.state=t.memoizedState),typeof s.componentDidMount=="function"&&(t.flags|=4194308),l=!0}else if(e===null){s=t.stateNode;var p=t.memoizedProps,x=wa(n,p);s.props=x;var E=s.context,U=n.contextType;f=qa,typeof U=="object"&&U!==null&&(f=nn(U));var G=n.getDerivedStateFromProps;U=typeof G=="function"||typeof s.getSnapshotBeforeUpdate=="function",p=t.pendingProps!==p,U||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(p||E!==f)&&Tf(t,s,l,f),Hl=!1;var R=t.memoizedState;s.state=R,Yi(t,l,s,a),Hi(),E=t.memoizedState,p||R!==E||Hl?(typeof G=="function"&&(ic(t,n,G,l),E=t.memoizedState),(x=Hl||Cf(t,n,x,l,R,E,f))?(U||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(t.flags|=4194308)):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=E),s.props=l,s.state=E,s.context=f,l=x):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{s=t.stateNode,Lo(e,t),f=t.memoizedProps,U=wa(n,f),s.props=U,G=t.pendingProps,R=s.context,E=n.contextType,x=qa,typeof E=="object"&&E!==null&&(x=nn(E)),p=n.getDerivedStateFromProps,(E=typeof p=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(f!==G||R!==x)&&Tf(t,s,l,x),Hl=!1,R=t.memoizedState,s.state=R,Yi(t,l,s,a),Hi();var M=t.memoizedState;f!==G||R!==M||Hl||e!==null&&e.dependencies!==null&&Gs(e.dependencies)?(typeof p=="function"&&(ic(t,n,p,l),M=t.memoizedState),(U=Hl||Cf(t,n,U,l,R,M,x)||e!==null&&e.dependencies!==null&&Gs(e.dependencies))?(E||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(l,M,x),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(l,M,x)),typeof s.componentDidUpdate=="function"&&(t.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof s.componentDidUpdate!="function"||f===e.memoizedProps&&R===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||f===e.memoizedProps&&R===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=M),s.props=l,s.state=M,s.context=x,l=U):(typeof s.componentDidUpdate!="function"||f===e.memoizedProps&&R===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||f===e.memoizedProps&&R===e.memoizedState||(t.flags|=1024),l=!1)}return s=l,rr(e,t),l=(t.flags&128)!==0,s||l?(s=t.stateNode,n=l&&typeof n.getDerivedStateFromError!="function"?null:s.render(),t.flags|=1,e!==null&&l?(t.child=xa(t,e.child,null,a),t.child=xa(t,null,n,a)):ln(e,t,n,a),t.memoizedState=s.state,e=t.child):e=Sl(e,t,a),e}function Hf(e,t,n,l){return ma(),t.flags|=256,ln(e,t,n,l),t.child}var uc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function dc(e){return{baseLanes:e,cachePool:Ad()}}function fc(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Nn),e}function Yf(e,t,n){var l=t.pendingProps,a=!1,s=(t.flags&128)!==0,f;if((f=s)||(f=e!==null&&e.memoizedState===null?!1:(kt.current&2)!==0),f&&(a=!0,t.flags&=-129),f=(t.flags&32)!==0,t.flags&=-33,e===null){if(We){if(a?Gl(t):ql(),(e=ht)?(e=Qh(e,Ln),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ol!==null?{id:el,overflow:tl}:null,retryLane:536870912,hydrationErrors:null},n=yd(e),n.return=t,t.child=n,tn=t,ht=null)):e=null,e===null)throw Ul(t);return Qc(e)?t.lanes=32:t.lanes=536870912,null}var p=l.children;return l=l.fallback,a?(ql(),a=t.mode,p=or({mode:"hidden",children:p},a),l=ha(l,a,n,null),p.return=t,l.return=t,p.sibling=l,t.child=p,l=t.child,l.memoizedState=dc(n),l.childLanes=fc(e,f,n),t.memoizedState=uc,Xi(null,l)):(Gl(t),hc(t,p))}var x=e.memoizedState;if(x!==null&&(p=x.dehydrated,p!==null)){if(s)t.flags&256?(Gl(t),t.flags&=-257,t=mc(e,t,n)):t.memoizedState!==null?(ql(),t.child=e.child,t.flags|=128,t=null):(ql(),p=l.fallback,a=t.mode,l=or({mode:"visible",children:l.children},a),p=ha(p,a,n,null),p.flags|=2,l.return=t,p.return=t,l.sibling=p,t.child=l,xa(t,e.child,null,n),l=t.child,l.memoizedState=dc(n),l.childLanes=fc(e,f,n),t.memoizedState=uc,t=Xi(null,l));else if(Gl(t),Qc(p)){if(f=p.nextSibling&&p.nextSibling.dataset,f)var E=f.dgst;f=E,l=Error(c(419)),l.stack="",l.digest=f,zi({value:l,source:null,stack:null}),t=mc(e,t,n)}else if(Yt||Za(e,t,n,!1),f=(n&e.childLanes)!==0,Yt||f){if(f=dt,f!==null&&(l=Y(f,n),l!==0&&l!==x.retryLane))throw x.retryLane=l,fa(e,l),yn(f,e,l),oc;Zc(p)||br(),t=mc(e,t,n)}else Zc(p)?(t.flags|=192,t.child=e.child,t=null):(e=x.treeContext,ht=Bn(p.nextSibling),tn=t,We=!0,Ll=null,Ln=!1,e!==null&&Sd(t,e),t=hc(t,l.children),t.flags|=4096);return t}return a?(ql(),p=l.fallback,a=t.mode,x=e.child,E=x.sibling,l=pl(x,{mode:"hidden",children:l.children}),l.subtreeFlags=x.subtreeFlags&65011712,E!==null?p=pl(E,p):(p=ha(p,a,n,null),p.flags|=2),p.return=t,l.return=t,l.sibling=p,t.child=l,Xi(null,l),l=t.child,p=e.child.memoizedState,p===null?p=dc(n):(a=p.cachePool,a!==null?(x=Bt._currentValue,a=a.parent!==x?{parent:x,pool:x}:a):a=Ad(),p={baseLanes:p.baseLanes|n,cachePool:a}),l.memoizedState=p,l.childLanes=fc(e,f,n),t.memoizedState=uc,Xi(e.child,l)):(Gl(t),n=e.child,e=n.sibling,n=pl(n,{mode:"visible",children:l.children}),n.return=t,n.sibling=null,e!==null&&(f=t.deletions,f===null?(t.deletions=[e],t.flags|=16):f.push(e)),t.child=n,t.memoizedState=null,n)}function hc(e,t){return t=or({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function or(e,t){return e=Sn(22,e,null,t),e.lanes=0,e}function mc(e,t,n){return xa(t,e.child,null,n),e=hc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Kf(e,t,n){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),jo(e.return,t,n)}function pc(e,t,n,l,a,s){var f=e.memoizedState;f===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:n,tailMode:a,treeForkCount:s}:(f.isBackwards=t,f.rendering=null,f.renderingStartTime=0,f.last=l,f.tail=n,f.tailMode=a,f.treeForkCount=s)}function Gf(e,t,n){var l=t.pendingProps,a=l.revealOrder,s=l.tail;l=l.children;var f=kt.current,p=(f&2)!==0;if(p?(f=f&1|2,t.flags|=128):f&=1,me(kt,f),ln(e,t,l,n),l=We?ki:0,!p&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Kf(e,n,t);else if(e.tag===19)Kf(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(a){case"forwards":for(n=t.child,a=null;n!==null;)e=n.alternate,e!==null&&Js(e)===null&&(a=n),n=n.sibling;n=a,n===null?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null),pc(t,!1,a,n,s,l);break;case"backwards":case"unstable_legacy-backwards":for(n=null,a=t.child,t.child=null;a!==null;){if(e=a.alternate,e!==null&&Js(e)===null){t.child=a;break}e=a.sibling,a.sibling=n,n=a,a=e}pc(t,!0,n,null,s,l);break;case"together":pc(t,!1,null,null,void 0,l);break;default:t.memoizedState=null}return t.child}function Sl(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Fl|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Za(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(c(153));if(t.child!==null){for(e=t.child,n=pl(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=pl(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function gc(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Gs(e)))}function $g(e,t,n){switch(t.tag){case 3:Oe(t,t.stateNode.containerInfo),Bl(t,Bt,e.memoizedState.cache),ma();break;case 27:case 5:Ie(t);break;case 4:Oe(t,t.stateNode.containerInfo);break;case 10:Bl(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Ko(t),null;break;case 13:var l=t.memoizedState;if(l!==null)return l.dehydrated!==null?(Gl(t),t.flags|=128,null):(n&t.child.childLanes)!==0?Yf(e,t,n):(Gl(t),e=Sl(e,t,n),e!==null?e.sibling:null);Gl(t);break;case 19:var a=(e.flags&128)!==0;if(l=(n&t.childLanes)!==0,l||(Za(e,t,n,!1),l=(n&t.childLanes)!==0),a){if(l)return Gf(e,t,n);t.flags|=128}if(a=t.memoizedState,a!==null&&(a.rendering=null,a.tail=null,a.lastEffect=null),me(kt,kt.current),l)break;return null;case 22:return t.lanes=0,Df(e,t,n,t.pendingProps);case 24:Bl(t,Bt,e.memoizedState.cache)}return Sl(e,t,n)}function qf(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Yt=!0;else{if(!gc(e,n)&&(t.flags&128)===0)return Yt=!1,$g(e,t,n);Yt=(e.flags&131072)!==0}else Yt=!1,We&&(t.flags&1048576)!==0&&xd(t,ki,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=ya(t.elementType),t.type=e,typeof e=="function")So(e)?(l=wa(e,l),t.tag=1,t=Bf(null,t,e,l,n)):(t.tag=0,t=cc(null,t,e,l,n));else{if(e!=null){var a=e.$$typeof;if(a===ae){t.tag=11,t=_f(null,t,e,l,n);break e}else if(a===O){t.tag=14,t=kf(null,t,e,l,n);break e}}throw t=je(e)||e,Error(c(306,t,""))}}return t;case 0:return cc(e,t,t.type,t.pendingProps,n);case 1:return l=t.type,a=wa(l,t.pendingProps),Bf(e,t,l,a,n);case 3:e:{if(Oe(t,t.stateNode.containerInfo),e===null)throw Error(c(387));l=t.pendingProps;var s=t.memoizedState;a=s.element,Lo(e,t),Yi(t,l,null,n);var f=t.memoizedState;if(l=f.cache,Bl(t,Bt,l),l!==s.cache&&Mo(t,[Bt],n,!0),Hi(),l=f.element,s.isDehydrated)if(s={element:l,isDehydrated:!1,cache:f.cache},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){t=Hf(e,t,l,n);break e}else if(l!==a){a=zn(Error(c(424)),t),zi(a),t=Hf(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(ht=Bn(e.firstChild),tn=t,We=!0,Ll=null,Ln=!0,n=zd(t,null,l,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(ma(),l===a){t=Sl(e,t,n);break e}ln(e,t,l,n)}t=t.child}return t;case 26:return rr(e,t),e===null?(n=em(t.type,null,t.pendingProps,null))?t.memoizedState=n:We||(n=t.type,e=t.pendingProps,l=Tr(fe.current).createElement(n),l[tt]=t,l[Je]=e,an(l,n,e),nt(l),t.stateNode=l):t.memoizedState=em(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Ie(t),e===null&&We&&(l=t.stateNode=Wh(t.type,t.pendingProps,fe.current),tn=t,Ln=!0,a=ht,Wl(t.type)?(Ic=a,ht=Bn(l.firstChild)):ht=a),ln(e,t,t.pendingProps.children,n),rr(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&We&&((a=l=ht)&&(l=jb(l,t.type,t.pendingProps,Ln),l!==null?(t.stateNode=l,tn=t,ht=Bn(l.firstChild),Ln=!1,a=!0):a=!1),a||Ul(t)),Ie(t),a=t.type,s=t.pendingProps,f=e!==null?e.memoizedProps:null,l=s.children,Vc(a,s)?l=null:f!==null&&Vc(a,f)&&(t.flags|=32),t.memoizedState!==null&&(a=qo(e,t,Vg,null,null,n),ss._currentValue=a),rr(e,t),ln(e,t,l,n),t.child;case 6:return e===null&&We&&((e=n=ht)&&(n=Mb(n,t.pendingProps,Ln),n!==null?(t.stateNode=n,tn=t,ht=null,e=!0):e=!1),e||Ul(t)),null;case 13:return Yf(e,t,n);case 4:return Oe(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=xa(t,null,l,n):ln(e,t,l,n),t.child;case 11:return _f(e,t,t.type,t.pendingProps,n);case 7:return ln(e,t,t.pendingProps,n),t.child;case 8:return ln(e,t,t.pendingProps.children,n),t.child;case 12:return ln(e,t,t.pendingProps.children,n),t.child;case 10:return l=t.pendingProps,Bl(t,t.type,l.value),ln(e,t,l.children,n),t.child;case 9:return a=t.type._context,l=t.pendingProps.children,ga(t),a=nn(a),l=l(a),t.flags|=1,ln(e,t,l,n),t.child;case 14:return kf(e,t,t.type,t.pendingProps,n);case 15:return zf(e,t,t.type,t.pendingProps,n);case 19:return Gf(e,t,n);case 31:return Pg(e,t,n);case 22:return Df(e,t,n,t.pendingProps);case 24:return ga(t),l=nn(Bt),e===null?(a=zo(),a===null&&(a=dt,s=_o(),a.pooledCache=s,s.refCount++,s!==null&&(a.pooledCacheLanes|=n),a=s),t.memoizedState={parent:l,cache:a},Oo(t),Bl(t,Bt,a)):((e.lanes&n)!==0&&(Lo(e,t),Yi(t,null,null,n),Hi()),a=e.memoizedState,s=t.memoizedState,a.parent!==l?(a={parent:l,cache:l},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Bl(t,Bt,l)):(l=s.cache,Bl(t,Bt,l),l!==a.cache&&Mo(t,[Bt],n,!0))),ln(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(c(156,t.tag))}function wl(e){e.flags|=4}function bc(e,t,n,l,a){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(a&335544128)===a)if(e.stateNode.complete)e.flags|=8192;else if(gh())e.flags|=8192;else throw va=Fs,Do}else e.flags&=-16777217}function Vf(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!im(t))if(gh())e.flags|=8192;else throw va=Fs,Do}function cr(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?_a():536870912,e.lanes|=t,ii|=t)}function Fi(e,t){if(!We)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 mt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,l=0;if(t)for(var a=e.child;a!==null;)n|=a.lanes|a.childLanes,l|=a.subtreeFlags&65011712,l|=a.flags&65011712,a.return=e,a=a.sibling;else for(a=e.child;a!==null;)n|=a.lanes|a.childLanes,l|=a.subtreeFlags,l|=a.flags,a.return=e,a=a.sibling;return e.subtreeFlags|=l,e.childLanes=n,t}function eb(e,t,n){var l=t.pendingProps;switch(No(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return mt(t),null;case 1:return mt(t),null;case 3:return n=t.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),yl(Bt),Me(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Fa(t)?wl(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Ao())),mt(t),null;case 26:var a=t.type,s=t.memoizedState;return e===null?(wl(t),s!==null?(mt(t),Vf(t,s)):(mt(t),bc(t,a,null,l,n))):s?s!==e.memoizedState?(wl(t),mt(t),Vf(t,s)):(mt(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&wl(t),mt(t),bc(t,a,e,l,n)),null;case 27:if(pt(t),n=fe.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&wl(t);else{if(!l){if(t.stateNode===null)throw Error(c(166));return mt(t),null}e=_e.current,Fa(t)?wd(t):(e=Wh(a,l,n),t.stateNode=e,wl(t))}return mt(t),null;case 5:if(pt(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&wl(t);else{if(!l){if(t.stateNode===null)throw Error(c(166));return mt(t),null}if(s=_e.current,Fa(t))wd(t);else{var f=Tr(fe.current);switch(s){case 1:s=f.createElementNS("http://www.w3.org/2000/svg",a);break;case 2:s=f.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;default:switch(a){case"svg":s=f.createElementNS("http://www.w3.org/2000/svg",a);break;case"math":s=f.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;case"script":s=f.createElement("div"),s.innerHTML="<script><\/script>",s=s.removeChild(s.firstChild);break;case"select":s=typeof l.is=="string"?f.createElement("select",{is:l.is}):f.createElement("select"),l.multiple?s.multiple=!0:l.size&&(s.size=l.size);break;default:s=typeof l.is=="string"?f.createElement(a,{is:l.is}):f.createElement(a)}}s[tt]=t,s[Je]=l;e:for(f=t.child;f!==null;){if(f.tag===5||f.tag===6)s.appendChild(f.stateNode);else if(f.tag!==4&&f.tag!==27&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===t)break e;for(;f.sibling===null;){if(f.return===null||f.return===t)break e;f=f.return}f.sibling.return=f.return,f=f.sibling}t.stateNode=s;e:switch(an(s,a,l),a){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&wl(t)}}return mt(t),bc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&wl(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(c(166));if(e=fe.current,Fa(t)){if(e=t.stateNode,n=t.memoizedProps,l=null,a=tn,a!==null)switch(a.tag){case 27:case 5:l=a.memoizedProps}e[tt]=t,e=!!(e.nodeValue===n||l!==null&&l.suppressHydrationWarning===!0||Yh(e.nodeValue,n)),e||Ul(t,!0)}else e=Tr(e).createTextNode(l),e[tt]=t,t.stateNode=e}return mt(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(l=Fa(t),n!==null){if(e===null){if(!l)throw Error(c(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(557));e[tt]=t}else ma(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;mt(t),e=!1}else n=Ao(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Cn(t),t):(Cn(t),null);if((t.flags&128)!==0)throw Error(c(558))}return mt(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Fa(t),l!==null&&l.dehydrated!==null){if(e===null){if(!a)throw Error(c(318));if(a=t.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(c(317));a[tt]=t}else ma(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;mt(t),a=!1}else a=Ao(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(Cn(t),t):(Cn(t),null)}return Cn(t),(t.flags&128)!==0?(t.lanes=n,t):(n=l!==null,e=e!==null&&e.memoizedState!==null,n&&(l=t.child,a=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(a=l.alternate.memoizedState.cachePool.pool),s=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(s=l.memoizedState.cachePool.pool),s!==a&&(l.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),cr(t,t.updateQueue),mt(t),null);case 4:return Me(),e===null&&Hc(t.stateNode.containerInfo),mt(t),null;case 10:return yl(t.type),mt(t),null;case 19:if(X(kt),l=t.memoizedState,l===null)return mt(t),null;if(a=(t.flags&128)!==0,s=l.rendering,s===null)if(a)Fi(l,!1);else{if(Et!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(s=Js(e),s!==null){for(t.flags|=128,Fi(l,!1),e=s.updateQueue,t.updateQueue=e,cr(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)bd(n,e),n=n.sibling;return me(kt,kt.current&1|2),We&&gl(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&te()>mr&&(t.flags|=128,a=!0,Fi(l,!1),t.lanes=4194304)}else{if(!a)if(e=Js(s),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,cr(t,e),Fi(l,!0),l.tail===null&&l.tailMode==="hidden"&&!s.alternate&&!We)return mt(t),null}else 2*te()-l.renderingStartTime>mr&&n!==536870912&&(t.flags|=128,a=!0,Fi(l,!1),t.lanes=4194304);l.isBackwards?(s.sibling=t.child,t.child=s):(e=l.last,e!==null?e.sibling=s:t.child=s,l.last=s)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=te(),e.sibling=null,n=kt.current,me(kt,a?n&1|2:n&1),We&&gl(t,l.treeForkCount),e):(mt(t),null);case 22:case 23:return Cn(t),Yo(),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&&(mt(t),t.subtreeFlags&6&&(t.flags|=8192)):mt(t),n=t.updateQueue,n!==null&&cr(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&&X(ba),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),yl(Bt),mt(t),null;case 25:return null;case 30:return null}throw Error(c(156,t.tag))}function tb(e,t){switch(No(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return yl(Bt),Me(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return pt(t),null;case 31:if(t.memoizedState!==null){if(Cn(t),t.alternate===null)throw Error(c(340));ma()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Cn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(c(340));ma()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return X(kt),null;case 4:return Me(),null;case 10:return yl(t.type),null;case 22:case 23:return Cn(t),Yo(),e!==null&&X(ba),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return yl(Bt),null;case 25:return null;default:return null}}function Xf(e,t){switch(No(t),t.tag){case 3:yl(Bt),Me();break;case 26:case 27:case 5:pt(t);break;case 4:Me();break;case 31:t.memoizedState!==null&&Cn(t);break;case 13:Cn(t);break;case 19:X(kt);break;case 10:yl(t.type);break;case 22:case 23:Cn(t),Yo(),e!==null&&X(ba);break;case 24:yl(Bt)}}function Zi(e,t){try{var n=t.updateQueue,l=n!==null?n.lastEffect:null;if(l!==null){var a=l.next;n=a;do{if((n.tag&e)===e){l=void 0;var s=n.create,f=n.inst;l=s(),f.destroy=l}n=n.next}while(n!==a)}}catch(p){st(t,t.return,p)}}function Vl(e,t,n){try{var l=t.updateQueue,a=l!==null?l.lastEffect:null;if(a!==null){var s=a.next;l=s;do{if((l.tag&e)===e){var f=l.inst,p=f.destroy;if(p!==void 0){f.destroy=void 0,a=t;var x=n,E=p;try{E()}catch(U){st(a,x,U)}}}l=l.next}while(l!==s)}}catch(U){st(t,t.return,U)}}function Ff(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Od(t,n)}catch(l){st(e,e.return,l)}}}function Zf(e,t,n){n.props=wa(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(l){st(e,t,l)}}function Qi(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(a){st(e,t,a)}}function nl(e,t){var n=e.ref,l=e.refCleanup;if(n!==null)if(typeof l=="function")try{l()}catch(a){st(e,t,a)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(a){st(e,t,a)}else n.current=null}function Qf(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(a){st(e,e.return,a)}}function yc(e,t,n){try{var l=e.stateNode;Cb(l,e.type,n,t),l[Je]=t}catch(a){st(e,e.return,a)}}function If(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Wl(e.type)||e.tag===4}function vc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||If(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 xc(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=_n));else if(l!==4&&(l===27&&Wl(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(xc(e,t,n),e=e.sibling;e!==null;)xc(e,t,n),e=e.sibling}function ur(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(ur(e,t,n),e=e.sibling;e!==null;)ur(e,t,n),e=e.sibling}function Jf(e){var t=e.stateNode,n=e.memoizedProps;try{for(var l=e.type,a=t.attributes;a.length;)t.removeAttributeNode(a[0]);an(t,l,n),t[tt]=e,t[Je]=n}catch(s){st(e,e.return,s)}}var Cl=!1,Kt=!1,Sc=!1,Wf=typeof WeakSet=="function"?WeakSet:Set,Jt=null;function nb(e,t){if(e=e.containerInfo,Gc=_r,e=od(e),mo(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 a=l.anchorOffset,s=l.focusNode;l=l.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var f=0,p=-1,x=-1,E=0,U=0,G=e,R=null;t:for(;;){for(var M;G!==n||a!==0&&G.nodeType!==3||(p=f+a),G!==s||l!==0&&G.nodeType!==3||(x=f+l),G.nodeType===3&&(f+=G.nodeValue.length),(M=G.firstChild)!==null;)R=G,G=M;for(;;){if(G===e)break t;if(R===n&&++E===a&&(p=f),R===s&&++U===l&&(x=f),(M=G.nextSibling)!==null)break;G=R,R=G.parentNode}G=M}n=p===-1||x===-1?null:{start:p,end:x}}else n=null}n=n||{start:0,end:0}}else n=null;for(qc={focusedElem:e,selectionRange:n},_r=!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,s=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++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&s!==null){e=void 0,n=t,a=s.memoizedProps,s=s.memoizedState,l=n.stateNode;try{var re=wa(n.type,a);e=l.getSnapshotBeforeUpdate(re,s),l.__reactInternalSnapshotBeforeUpdate=e}catch(Ce){st(n,n.return,Ce)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)Fc(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Fc(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(c(163))}if(e=t.sibling,e!==null){e.return=t.return,Jt=e;break}Jt=t.return}}function Pf(e,t,n){var l=n.flags;switch(n.tag){case 0:case 11:case 15:Nl(e,n),l&4&&Zi(5,n);break;case 1:if(Nl(e,n),l&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(f){st(n,n.return,f)}else{var a=wa(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(a,t,e.__reactInternalSnapshotBeforeUpdate)}catch(f){st(n,n.return,f)}}l&64&&Ff(n),l&512&&Qi(n,n.return);break;case 3:if(Nl(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{Od(e,t)}catch(f){st(n,n.return,f)}}break;case 27:t===null&&l&4&&Jf(n);case 26:case 5:Nl(e,n),t===null&&l&4&&Qf(n),l&512&&Qi(n,n.return);break;case 12:Nl(e,n);break;case 31:Nl(e,n),l&4&&th(e,n);break;case 13:Nl(e,n),l&4&&nh(e,n),l&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=db.bind(null,n),_b(e,n))));break;case 22:if(l=n.memoizedState!==null||Cl,!l){t=t!==null&&t.memoizedState!==null||Kt,a=Cl;var s=Kt;Cl=l,(Kt=t)&&!s?El(e,n,(n.subtreeFlags&8772)!==0):Nl(e,n),Cl=a,Kt=s}break;case 30:break;default:Nl(e,n)}}function $f(e){var t=e.alternate;t!==null&&(e.alternate=null,$f(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&le(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 yt=null,mn=!1;function Tl(e,t,n){for(n=n.child;n!==null;)eh(e,t,n),n=n.sibling}function eh(e,t,n){if(Zt&&typeof Zt.onCommitFiberUnmount=="function")try{Zt.onCommitFiberUnmount(Wn,n)}catch{}switch(n.tag){case 26:Kt||nl(n,t),Tl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Kt||nl(n,t);var l=yt,a=mn;Wl(n.type)&&(yt=n.stateNode,mn=!1),Tl(e,t,n),ls(n.stateNode),yt=l,mn=a;break;case 5:Kt||nl(n,t);case 6:if(l=yt,a=mn,yt=null,Tl(e,t,n),yt=l,mn=a,yt!==null)if(mn)try{(yt.nodeType===9?yt.body:yt.nodeName==="HTML"?yt.ownerDocument.body:yt).removeChild(n.stateNode)}catch(s){st(n,t,s)}else try{yt.removeChild(n.stateNode)}catch(s){st(n,t,s)}break;case 18:yt!==null&&(mn?(e=yt,Fh(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),hi(e)):Fh(yt,n.stateNode));break;case 4:l=yt,a=mn,yt=n.stateNode.containerInfo,mn=!0,Tl(e,t,n),yt=l,mn=a;break;case 0:case 11:case 14:case 15:Vl(2,n,t),Kt||Vl(4,n,t),Tl(e,t,n);break;case 1:Kt||(nl(n,t),l=n.stateNode,typeof l.componentWillUnmount=="function"&&Zf(n,t,l)),Tl(e,t,n);break;case 21:Tl(e,t,n);break;case 22:Kt=(l=Kt)||n.memoizedState!==null,Tl(e,t,n),Kt=l;break;default:Tl(e,t,n)}}function th(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{hi(e)}catch(n){st(t,t.return,n)}}}function nh(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{hi(e)}catch(n){st(t,t.return,n)}}function lb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Wf),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Wf),t;default:throw Error(c(435,e.tag))}}function dr(e,t){var n=lb(e);t.forEach(function(l){if(!n.has(l)){n.add(l);var a=fb.bind(null,e,l);l.then(a,a)}})}function pn(e,t){var n=t.deletions;if(n!==null)for(var l=0;l<n.length;l++){var a=n[l],s=e,f=t,p=f;e:for(;p!==null;){switch(p.tag){case 27:if(Wl(p.type)){yt=p.stateNode,mn=!1;break e}break;case 5:yt=p.stateNode,mn=!1;break e;case 3:case 4:yt=p.stateNode.containerInfo,mn=!0;break e}p=p.return}if(yt===null)throw Error(c(160));eh(s,f,a),yt=null,mn=!1,s=a.alternate,s!==null&&(s.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)lh(t,e),t=t.sibling}var Zn=null;function lh(e,t){var n=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:pn(t,e),gn(e),l&4&&(Vl(3,e,e.return),Zi(3,e),Vl(5,e,e.return));break;case 1:pn(t,e),gn(e),l&512&&(Kt||n===null||nl(n,n.return)),l&64&&Cl&&(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 a=Zn;if(pn(t,e),gn(e),l&512&&(Kt||n===null||nl(n,n.return)),l&4){var s=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,a=a.ownerDocument||a;t:switch(l){case"title":s=a.getElementsByTagName("title")[0],(!s||s[Ke]||s[tt]||s.namespaceURI==="http://www.w3.org/2000/svg"||s.hasAttribute("itemprop"))&&(s=a.createElement(l),a.head.insertBefore(s,a.querySelector("head > title"))),an(s,l,n),s[tt]=e,nt(s),l=s;break e;case"link":var f=lm("link","href",a).get(l+(n.href||""));if(f){for(var p=0;p<f.length;p++)if(s=f[p],s.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&s.getAttribute("rel")===(n.rel==null?null:n.rel)&&s.getAttribute("title")===(n.title==null?null:n.title)&&s.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){f.splice(p,1);break t}}s=a.createElement(l),an(s,l,n),a.head.appendChild(s);break;case"meta":if(f=lm("meta","content",a).get(l+(n.content||""))){for(p=0;p<f.length;p++)if(s=f[p],s.getAttribute("content")===(n.content==null?null:""+n.content)&&s.getAttribute("name")===(n.name==null?null:n.name)&&s.getAttribute("property")===(n.property==null?null:n.property)&&s.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&s.getAttribute("charset")===(n.charSet==null?null:n.charSet)){f.splice(p,1);break t}}s=a.createElement(l),an(s,l,n),a.head.appendChild(s);break;default:throw Error(c(468,l))}s[tt]=e,nt(s),l=s}e.stateNode=l}else am(a,e.type,e.stateNode);else e.stateNode=nm(a,l,e.memoizedProps);else s!==l?(s===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):s.count--,l===null?am(a,e.type,e.stateNode):nm(a,l,e.memoizedProps)):l===null&&e.stateNode!==null&&yc(e,e.memoizedProps,n.memoizedProps)}break;case 27:pn(t,e),gn(e),l&512&&(Kt||n===null||nl(n,n.return)),n!==null&&l&4&&yc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(pn(t,e),gn(e),l&512&&(Kt||n===null||nl(n,n.return)),e.flags&32){a=e.stateNode;try{$t(a,"")}catch(re){st(e,e.return,re)}}l&4&&e.stateNode!=null&&(a=e.memoizedProps,yc(e,a,n!==null?n.memoizedProps:a)),l&1024&&(Sc=!0);break;case 6:if(pn(t,e),gn(e),l&4){if(e.stateNode===null)throw Error(c(162));l=e.memoizedProps,n=e.stateNode;try{n.nodeValue=l}catch(re){st(e,e.return,re)}}break;case 3:if(Ar=null,a=Zn,Zn=Nr(t.containerInfo),pn(t,e),Zn=a,gn(e),l&4&&n!==null&&n.memoizedState.isDehydrated)try{hi(t.containerInfo)}catch(re){st(e,e.return,re)}Sc&&(Sc=!1,ah(e));break;case 4:l=Zn,Zn=Nr(e.stateNode.containerInfo),pn(t,e),gn(e),Zn=l;break;case 12:pn(t,e),gn(e);break;case 31:pn(t,e),gn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,dr(e,l)));break;case 13:pn(t,e),gn(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(hr=te()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,dr(e,l)));break;case 22:a=e.memoizedState!==null;var x=n!==null&&n.memoizedState!==null,E=Cl,U=Kt;if(Cl=E||a,Kt=U||x,pn(t,e),Kt=U,Cl=E,gn(e),l&8192)e:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||x||Cl||Kt||Ca(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){x=n=t;try{if(s=x.stateNode,a)f=s.style,typeof f.setProperty=="function"?f.setProperty("display","none","important"):f.display="none";else{p=x.stateNode;var G=x.memoizedProps.style,R=G!=null&&G.hasOwnProperty("display")?G.display:null;p.style.display=R==null||typeof R=="boolean"?"":(""+R).trim()}}catch(re){st(x,x.return,re)}}}else if(t.tag===6){if(n===null){x=t;try{x.stateNode.nodeValue=a?"":x.memoizedProps}catch(re){st(x,x.return,re)}}}else if(t.tag===18){if(n===null){x=t;try{var M=x.stateNode;a?Zh(M,!0):Zh(x.stateNode,!1)}catch(re){st(x,x.return,re)}}}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,dr(e,n))));break;case 19:pn(t,e),gn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,dr(e,l)));break;case 30:break;case 21:break;default:pn(t,e),gn(e)}}function gn(e){var t=e.flags;if(t&2){try{for(var n,l=e.return;l!==null;){if(If(l)){n=l;break}l=l.return}if(n==null)throw Error(c(160));switch(n.tag){case 27:var a=n.stateNode,s=vc(e);ur(e,s,a);break;case 5:var f=n.stateNode;n.flags&32&&($t(f,""),n.flags&=-33);var p=vc(e);ur(e,p,f);break;case 3:case 4:var x=n.stateNode.containerInfo,E=vc(e);xc(e,E,x);break;default:throw Error(c(161))}}catch(U){st(e,e.return,U)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function ah(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;ah(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Nl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Pf(e,t.alternate,t),t=t.sibling}function Ca(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Vl(4,t,t.return),Ca(t);break;case 1:nl(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&Zf(t,t.return,n),Ca(t);break;case 27:ls(t.stateNode);case 26:case 5:nl(t,t.return),Ca(t);break;case 22:t.memoizedState===null&&Ca(t);break;case 30:Ca(t);break;default:Ca(t)}e=e.sibling}}function El(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var l=t.alternate,a=e,s=t,f=s.flags;switch(s.tag){case 0:case 11:case 15:El(a,s,n),Zi(4,s);break;case 1:if(El(a,s,n),l=s,a=l.stateNode,typeof a.componentDidMount=="function")try{a.componentDidMount()}catch(E){st(l,l.return,E)}if(l=s,a=l.updateQueue,a!==null){var p=l.stateNode;try{var x=a.shared.hiddenCallbacks;if(x!==null)for(a.shared.hiddenCallbacks=null,a=0;a<x.length;a++)Dd(x[a],p)}catch(E){st(l,l.return,E)}}n&&f&64&&Ff(s),Qi(s,s.return);break;case 27:Jf(s);case 26:case 5:El(a,s,n),n&&l===null&&f&4&&Qf(s),Qi(s,s.return);break;case 12:El(a,s,n);break;case 31:El(a,s,n),n&&f&4&&th(a,s);break;case 13:El(a,s,n),n&&f&4&&nh(a,s);break;case 22:s.memoizedState===null&&El(a,s,n),Qi(s,s.return);break;case 30:break;default:El(a,s,n)}t=t.sibling}}function wc(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&&Di(n))}function Cc(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Di(e))}function Qn(e,t,n,l){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)ih(e,t,n,l),t=t.sibling}function ih(e,t,n,l){var a=t.flags;switch(t.tag){case 0:case 11:case 15:Qn(e,t,n,l),a&2048&&Zi(9,t);break;case 1:Qn(e,t,n,l);break;case 3:Qn(e,t,n,l),a&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Di(e)));break;case 12:if(a&2048){Qn(e,t,n,l),e=t.stateNode;try{var s=t.memoizedProps,f=s.id,p=s.onPostCommit;typeof p=="function"&&p(f,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(x){st(t,t.return,x)}}else Qn(e,t,n,l);break;case 31:Qn(e,t,n,l);break;case 13:Qn(e,t,n,l);break;case 23:break;case 22:s=t.stateNode,f=t.alternate,t.memoizedState!==null?s._visibility&2?Qn(e,t,n,l):Ii(e,t):s._visibility&2?Qn(e,t,n,l):(s._visibility|=2,ni(e,t,n,l,(t.subtreeFlags&10256)!==0||!1)),a&2048&&wc(f,t);break;case 24:Qn(e,t,n,l),a&2048&&Cc(t.alternate,t);break;default:Qn(e,t,n,l)}}function ni(e,t,n,l,a){for(a=a&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var s=e,f=t,p=n,x=l,E=f.flags;switch(f.tag){case 0:case 11:case 15:ni(s,f,p,x,a),Zi(8,f);break;case 23:break;case 22:var U=f.stateNode;f.memoizedState!==null?U._visibility&2?ni(s,f,p,x,a):Ii(s,f):(U._visibility|=2,ni(s,f,p,x,a)),a&&E&2048&&wc(f.alternate,f);break;case 24:ni(s,f,p,x,a),a&&E&2048&&Cc(f.alternate,f);break;default:ni(s,f,p,x,a)}t=t.sibling}}function Ii(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,l=t,a=l.flags;switch(l.tag){case 22:Ii(n,l),a&2048&&wc(l.alternate,l);break;case 24:Ii(n,l),a&2048&&Cc(l.alternate,l);break;default:Ii(n,l)}t=t.sibling}}var Ji=8192;function li(e,t,n){if(e.subtreeFlags&Ji)for(e=e.child;e!==null;)sh(e,t,n),e=e.sibling}function sh(e,t,n){switch(e.tag){case 26:li(e,t,n),e.flags&Ji&&e.memoizedState!==null&&qb(n,Zn,e.memoizedState,e.memoizedProps);break;case 5:li(e,t,n);break;case 3:case 4:var l=Zn;Zn=Nr(e.stateNode.containerInfo),li(e,t,n),Zn=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=Ji,Ji=16777216,li(e,t,n),Ji=l):li(e,t,n));break;default:li(e,t,n)}}function rh(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 Wi(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,ch(l,e)}rh(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)oh(e),e=e.sibling}function oh(e){switch(e.tag){case 0:case 11:case 15:Wi(e),e.flags&2048&&Vl(9,e,e.return);break;case 3:Wi(e);break;case 12:Wi(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,fr(e)):Wi(e);break;default:Wi(e)}}function fr(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,ch(l,e)}rh(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Vl(8,t,t.return),fr(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,fr(t));break;default:fr(t)}e=e.sibling}}function ch(e,t){for(;Jt!==null;){var n=Jt;switch(n.tag){case 0:case 11:case 15:Vl(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:Di(n.memoizedState.cache)}if(l=n.child,l!==null)l.return=n,Jt=l;else e:for(n=e;Jt!==null;){l=Jt;var a=l.sibling,s=l.return;if($f(l),l===n){Jt=null;break e}if(a!==null){a.return=s,Jt=a;break e}Jt=s}}}var ab={getCacheForType:function(e){var t=nn(Bt),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return nn(Bt).controller.signal}},ib=typeof WeakMap=="function"?WeakMap:Map,lt=0,dt=null,Xe=null,Ze=0,it=0,Tn=null,Xl=!1,ai=!1,Tc=!1,Al=0,Et=0,Fl=0,Ta=0,Nc=0,Nn=0,ii=0,Pi=null,bn=null,Ec=!1,hr=0,uh=0,mr=1/0,pr=null,Zl=null,Vt=0,Ql=null,si=null,Rl=0,Ac=0,Rc=null,dh=null,$i=0,jc=null;function En(){return(lt&2)!==0&&Ze!==0?Ze&-Ze:j.T!==null?Oc():Ee()}function fh(){if(Nn===0)if((Ze&536870912)===0||We){var e=rl;rl<<=1,(rl&3932160)===0&&(rl=262144),Nn=e}else Nn=536870912;return e=wn.current,e!==null&&(e.flags|=32),Nn}function yn(e,t,n){(e===dt&&(it===2||it===9)||e.cancelPendingCommit!==null)&&(ri(e,0),Il(e,Ze,Nn,!1)),dl(e,n),((lt&2)===0||e!==dt)&&(e===dt&&((lt&2)===0&&(Ta|=n),Et===4&&Il(e,Ze,Nn,!1)),ll(e))}function hh(e,t,n){if((lt&6)!==0)throw Error(c(327));var l=!n&&(t&127)===0&&(t&e.expiredLanes)===0||cl(e,t),a=l?ob(e,t):_c(e,t,!0),s=l;do{if(a===0){ai&&!l&&Il(e,t,0,!1);break}else{if(n=e.current.alternate,s&&!sb(n)){a=_c(e,t,!1),s=!1;continue}if(a===2){if(s=t,e.errorRecoveryDisabledLanes&s)var f=0;else f=e.pendingLanes&-536870913,f=f!==0?f:f&536870912?536870912:0;if(f!==0){t=f;e:{var p=e;a=Pi;var x=p.current.memoizedState.isDehydrated;if(x&&(ri(p,f).flags|=256),f=_c(p,f,!1),f!==2){if(Tc&&!x){p.errorRecoveryDisabledLanes|=s,Ta|=s,a=4;break e}s=bn,bn=a,s!==null&&(bn===null?bn=s:bn.push.apply(bn,s))}a=f}if(s=!1,a!==2)continue}}if(a===1){ri(e,0),Il(e,t,0,!0);break}e:{switch(l=e,s=a,s){case 0:case 1:throw Error(c(345));case 4:if((t&4194048)!==t)break;case 6:Il(l,t,Nn,!Xl);break e;case 2:bn=null;break;case 3:case 5:break;default:throw Error(c(329))}if((t&62914560)===t&&(a=hr+300-te(),10<a)){if(Il(l,t,Nn,!Xl),qn(l,0,!0)!==0)break e;Rl=t,l.timeoutHandle=Vh(mh.bind(null,l,n,bn,pr,Ec,t,Nn,Ta,ii,Xl,s,"Throttled",-0,0),a);break e}mh(l,n,bn,pr,Ec,t,Nn,Ta,ii,Xl,s,null,-0,0)}}break}while(!0);ll(e)}function mh(e,t,n,l,a,s,f,p,x,E,U,G,R,M){if(e.timeoutHandle=-1,G=t.subtreeFlags,G&8192||(G&16785408)===16785408){G={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:_n},sh(t,s,G);var re=(s&62914560)===s?hr-te():(s&4194048)===s?uh-te():0;if(re=Vb(G,re),re!==null){Rl=s,e.cancelPendingCommit=re(wh.bind(null,e,t,s,n,l,a,f,p,x,U,G,null,R,M)),Il(e,s,f,!E);return}}wh(e,t,s,n,l,a,f,p,x)}function sb(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 a=n[l],s=a.getSnapshot;a=a.value;try{if(!xn(s(),a))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 Il(e,t,n,l){t&=~Nc,t&=~Ta,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var a=t;0<a;){var s=31-gt(a),f=1<<s;l[s]=-1,a&=~f}n!==0&&sa(e,n,t)}function gr(){return(lt&6)===0?(es(0),!1):!0}function Mc(){if(Xe!==null){if(it===0)var e=Xe.return;else e=Xe,bl=pa=null,Fo(e),Wa=null,Li=0,e=Xe;for(;e!==null;)Xf(e.alternate,e),e=e.return;Xe=null}}function ri(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Eb(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Rl=0,Mc(),dt=e,Xe=n=pl(e.current,null),Ze=t,it=0,Tn=null,Xl=!1,ai=cl(e,t),Tc=!1,ii=Nn=Nc=Ta=Fl=Et=0,bn=Pi=null,Ec=!1,(t&8)!==0&&(t|=t&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=t;0<l;){var a=31-gt(l),s=1<<a;t|=e[a],l&=~s}return Al=t,Us(),n}function ph(e,t){Ue=null,j.H=Vi,t===Ja||t===Xs?(t=Md(),it=3):t===Do?(t=Md(),it=4):it=t===oc?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Tn=t,Xe===null&&(Et=1,ir(e,zn(t,e.current)))}function gh(){var e=wn.current;return e===null?!0:(Ze&4194048)===Ze?Un===null:(Ze&62914560)===Ze||(Ze&536870912)!==0?e===Un:!1}function bh(){var e=j.H;return j.H=Vi,e===null?Vi:e}function yh(){var e=j.A;return j.A=ab,e}function br(){Et=4,Xl||(Ze&4194048)!==Ze&&wn.current!==null||(ai=!0),(Fl&134217727)===0&&(Ta&134217727)===0||dt===null||Il(dt,Ze,Nn,!1)}function _c(e,t,n){var l=lt;lt|=2;var a=bh(),s=yh();(dt!==e||Ze!==t)&&(pr=null,ri(e,t)),t=!1;var f=Et;e:do try{if(it!==0&&Xe!==null){var p=Xe,x=Tn;switch(it){case 8:Mc(),f=6;break e;case 3:case 2:case 9:case 6:wn.current===null&&(t=!0);var E=it;if(it=0,Tn=null,oi(e,p,x,E),n&&ai){f=0;break e}break;default:E=it,it=0,Tn=null,oi(e,p,x,E)}}rb(),f=Et;break}catch(U){ph(e,U)}while(!0);return t&&e.shellSuspendCounter++,bl=pa=null,lt=l,j.H=a,j.A=s,Xe===null&&(dt=null,Ze=0,Us()),f}function rb(){for(;Xe!==null;)vh(Xe)}function ob(e,t){var n=lt;lt|=2;var l=bh(),a=yh();dt!==e||Ze!==t?(pr=null,mr=te()+500,ri(e,t)):ai=cl(e,t);e:do try{if(it!==0&&Xe!==null){t=Xe;var s=Tn;t:switch(it){case 1:it=0,Tn=null,oi(e,t,s,1);break;case 2:case 9:if(Rd(s)){it=0,Tn=null,xh(t);break}t=function(){it!==2&&it!==9||dt!==e||(it=7),ll(e)},s.then(t,t);break e;case 3:it=7;break e;case 4:it=5;break e;case 7:Rd(s)?(it=0,Tn=null,xh(t)):(it=0,Tn=null,oi(e,t,s,7));break;case 5:var f=null;switch(Xe.tag){case 26:f=Xe.memoizedState;case 5:case 27:var p=Xe;if(f?im(f):p.stateNode.complete){it=0,Tn=null;var x=p.sibling;if(x!==null)Xe=x;else{var E=p.return;E!==null?(Xe=E,yr(E)):Xe=null}break t}}it=0,Tn=null,oi(e,t,s,5);break;case 6:it=0,Tn=null,oi(e,t,s,6);break;case 8:Mc(),Et=6;break e;default:throw Error(c(462))}}cb();break}catch(U){ph(e,U)}while(!0);return bl=pa=null,j.H=l,j.A=a,lt=n,Xe!==null?0:(dt=null,Ze=0,Us(),Et)}function cb(){for(;Xe!==null&&!Ct();)vh(Xe)}function vh(e){var t=qf(e.alternate,e,Al);e.memoizedProps=e.pendingProps,t===null?yr(e):Xe=t}function xh(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Uf(n,t,t.pendingProps,t.type,void 0,Ze);break;case 11:t=Uf(n,t,t.pendingProps,t.type.render,t.ref,Ze);break;case 5:Fo(t);default:Xf(n,t),t=Xe=bd(t,Al),t=qf(n,t,Al)}e.memoizedProps=e.pendingProps,t===null?yr(e):Xe=t}function oi(e,t,n,l){bl=pa=null,Fo(t),Wa=null,Li=0;var a=t.return;try{if(Wg(e,a,t,n,Ze)){Et=1,ir(e,zn(n,e.current)),Xe=null;return}}catch(s){if(a!==null)throw Xe=a,s;Et=1,ir(e,zn(n,e.current)),Xe=null;return}t.flags&32768?(We||l===1?e=!0:ai||(Ze&536870912)!==0?e=!1:(Xl=e=!0,(l===2||l===9||l===3||l===6)&&(l=wn.current,l!==null&&l.tag===13&&(l.flags|=16384))),Sh(t,e)):yr(t)}function yr(e){var t=e;do{if((t.flags&32768)!==0){Sh(t,Xl);return}e=t.return;var n=eb(t.alternate,t,Al);if(n!==null){Xe=n;return}if(t=t.sibling,t!==null){Xe=t;return}Xe=t=e}while(t!==null);Et===0&&(Et=5)}function Sh(e,t){do{var n=tb(e.alternate,e);if(n!==null){n.flags&=32767,Xe=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Xe=e;return}Xe=e=n}while(e!==null);Et=6,Xe=null}function wh(e,t,n,l,a,s,f,p,x){e.cancelPendingCommit=null;do vr();while(Vt!==0);if((lt&6)!==0)throw Error(c(327));if(t!==null){if(t===e.current)throw Error(c(177));if(s=t.lanes|t.childLanes,s|=vo,wi(e,n,s,f,p,x),e===dt&&(Xe=dt=null,Ze=0),si=t,Ql=e,Rl=n,Ac=s,Rc=a,dh=l,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,hb(Lt,function(){return Ah(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||l){l=j.T,j.T=null,a=q.p,q.p=2,f=lt,lt|=4;try{nb(e,t,n)}finally{lt=f,q.p=a,j.T=l}}Vt=1,Ch(),Th(),Nh()}}function Ch(){if(Vt===1){Vt=0;var e=Ql,t=si,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=j.T,j.T=null;var l=q.p;q.p=2;var a=lt;lt|=4;try{lh(t,e);var s=qc,f=od(e.containerInfo),p=s.focusedElem,x=s.selectionRange;if(f!==p&&p&&p.ownerDocument&&rd(p.ownerDocument.documentElement,p)){if(x!==null&&mo(p)){var E=x.start,U=x.end;if(U===void 0&&(U=E),"selectionStart"in p)p.selectionStart=E,p.selectionEnd=Math.min(U,p.value.length);else{var G=p.ownerDocument||document,R=G&&G.defaultView||window;if(R.getSelection){var M=R.getSelection(),re=p.textContent.length,Ce=Math.min(x.start,re),ct=x.end===void 0?Ce:Math.min(x.end,re);!M.extend&&Ce>ct&&(f=ct,ct=Ce,Ce=f);var T=sd(p,Ce),w=sd(p,ct);if(T&&w&&(M.rangeCount!==1||M.anchorNode!==T.node||M.anchorOffset!==T.offset||M.focusNode!==w.node||M.focusOffset!==w.offset)){var N=G.createRange();N.setStart(T.node,T.offset),M.removeAllRanges(),Ce>ct?(M.addRange(N),M.extend(w.node,w.offset)):(N.setEnd(w.node,w.offset),M.addRange(N))}}}}for(G=[],M=p;M=M.parentNode;)M.nodeType===1&&G.push({element:M,left:M.scrollLeft,top:M.scrollTop});for(typeof p.focus=="function"&&p.focus(),p=0;p<G.length;p++){var K=G[p];K.element.scrollLeft=K.left,K.element.scrollTop=K.top}}_r=!!Gc,qc=Gc=null}finally{lt=a,q.p=l,j.T=n}}e.current=t,Vt=2}}function Th(){if(Vt===2){Vt=0;var e=Ql,t=si,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=j.T,j.T=null;var l=q.p;q.p=2;var a=lt;lt|=4;try{Pf(e,t.alternate,t)}finally{lt=a,q.p=l,j.T=n}}Vt=3}}function Nh(){if(Vt===4||Vt===3){Vt=0,Gt();var e=Ql,t=si,n=Rl,l=dh;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?Vt=5:(Vt=0,si=Ql=null,Eh(e,e.pendingLanes));var a=e.pendingLanes;if(a===0&&(Zl=null),pe(n),t=t.stateNode,Zt&&typeof Zt.onCommitFiberRoot=="function")try{Zt.onCommitFiberRoot(Wn,t,void 0,(t.current.flags&128)===128)}catch{}if(l!==null){t=j.T,a=q.p,q.p=2,j.T=null;try{for(var s=e.onRecoverableError,f=0;f<l.length;f++){var p=l[f];s(p.value,{componentStack:p.stack})}}finally{j.T=t,q.p=a}}(Rl&3)!==0&&vr(),ll(e),a=e.pendingLanes,(n&261930)!==0&&(a&42)!==0?e===jc?$i++:($i=0,jc=e):$i=0,es(0)}}function Eh(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Di(t)))}function vr(){return Ch(),Th(),Nh(),Ah()}function Ah(){if(Vt!==5)return!1;var e=Ql,t=Ac;Ac=0;var n=pe(Rl),l=j.T,a=q.p;try{q.p=32>n?32:n,j.T=null,n=Rc,Rc=null;var s=Ql,f=Rl;if(Vt=0,si=Ql=null,Rl=0,(lt&6)!==0)throw Error(c(331));var p=lt;if(lt|=4,oh(s.current),ih(s,s.current,f,n),lt=p,es(0,!1),Zt&&typeof Zt.onPostCommitFiberRoot=="function")try{Zt.onPostCommitFiberRoot(Wn,s)}catch{}return!0}finally{q.p=a,j.T=l,Eh(e,t)}}function Rh(e,t,n){t=zn(n,t),t=rc(e.stateNode,t,2),e=Kl(e,t,2),e!==null&&(dl(e,2),ll(e))}function st(e,t,n){if(e.tag===3)Rh(e,e,n);else for(;t!==null;){if(t.tag===3){Rh(t,e,n);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Zl===null||!Zl.has(l))){e=zn(n,e),n=jf(2),l=Kl(t,n,2),l!==null&&(Mf(n,l,t,e),dl(l,2),ll(l));break}}t=t.return}}function kc(e,t,n){var l=e.pingCache;if(l===null){l=e.pingCache=new ib;var a=new Set;l.set(t,a)}else a=l.get(t),a===void 0&&(a=new Set,l.set(t,a));a.has(n)||(Tc=!0,a.add(n),e=ub.bind(null,e,t,n),t.then(e,e))}function ub(e,t,n){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,dt===e&&(Ze&n)===n&&(Et===4||Et===3&&(Ze&62914560)===Ze&&300>te()-hr?(lt&2)===0&&ri(e,0):Nc|=n,ii===Ze&&(ii=0)),ll(e)}function jh(e,t){t===0&&(t=_a()),e=fa(e,t),e!==null&&(dl(e,t),ll(e))}function db(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),jh(e,n)}function fb(e,t){var n=0;switch(e.tag){case 31:case 13:var l=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(c(314))}l!==null&&l.delete(t),jh(e,n)}function hb(e,t){return Wt(e,t)}var xr=null,ci=null,zc=!1,Sr=!1,Dc=!1,Jl=0;function ll(e){e!==ci&&e.next===null&&(ci===null?xr=ci=e:ci=ci.next=e),Sr=!0,zc||(zc=!0,pb())}function es(e,t){if(!Dc&&Sr){Dc=!0;do for(var n=!1,l=xr;l!==null;){if(e!==0){var a=l.pendingLanes;if(a===0)var s=0;else{var f=l.suspendedLanes,p=l.pingedLanes;s=(1<<31-gt(42|e)+1)-1,s&=a&~(f&~p),s=s&201326741?s&201326741|1:s?s|2:0}s!==0&&(n=!0,zh(l,s))}else s=Ze,s=qn(l,l===dt?s:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(s&3)===0||cl(l,s)||(n=!0,zh(l,s));l=l.next}while(n);Dc=!1}}function mb(){Mh()}function Mh(){Sr=zc=!1;var e=0;Jl!==0&&Nb()&&(e=Jl);for(var t=te(),n=null,l=xr;l!==null;){var a=l.next,s=_h(l,t);s===0?(l.next=null,n===null?xr=a:n.next=a,a===null&&(ci=n)):(n=l,(e!==0||(s&3)!==0)&&(Sr=!0)),l=a}Vt!==0&&Vt!==5||es(e),Jl!==0&&(Jl=0)}function _h(e,t){for(var n=e.suspendedLanes,l=e.pingedLanes,a=e.expirationTimes,s=e.pendingLanes&-62914561;0<s;){var f=31-gt(s),p=1<<f,x=a[f];x===-1?((p&n)===0||(p&l)!==0)&&(a[f]=Si(p,t)):x<=t&&(e.expiredLanes|=p),s&=~p}if(t=dt,n=Ze,n=qn(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,n===0||e===t&&(it===2||it===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&Ft(l),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||cl(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(l!==null&&Ft(l),pe(n)){case 2:case 8:n=Pe;break;case 32:n=Lt;break;case 268435456:n=ft;break;default:n=Lt}return l=kh.bind(null,e),n=Wt(n,l),e.callbackPriority=t,e.callbackNode=n,t}return l!==null&&l!==null&&Ft(l),e.callbackPriority=2,e.callbackNode=null,2}function kh(e,t){if(Vt!==0&&Vt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(vr()&&e.callbackNode!==n)return null;var l=Ze;return l=qn(e,e===dt?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(hh(e,l,t),_h(e,te()),e.callbackNode!=null&&e.callbackNode===n?kh.bind(null,e):null)}function zh(e,t){if(vr())return null;hh(e,t,!0)}function pb(){Ab(function(){(lt&6)!==0?Wt(ye,mb):Mh()})}function Oc(){if(Jl===0){var e=Qa;e===0&&(e=sl,sl<<=1,(sl&261888)===0&&(sl=256)),Jl=e}return Jl}function Dh(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:La(""+e)}function Oh(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 gb(e,t,n,l,a){if(t==="submit"&&n&&n.stateNode===a){var s=Dh((a[Je]||null).action),f=l.submitter;f&&(t=(t=f[Je]||null)?Dh(t.formAction):f.getAttribute("formAction"),t!==null&&(s=t,f=null));var p=new zs("action","action",null,l,a);e.push({event:p,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Jl!==0){var x=f?Oh(a,f):new FormData(a);tc(n,{pending:!0,data:x,method:a.method,action:s},null,x)}}else typeof s=="function"&&(p.preventDefault(),x=f?Oh(a,f):new FormData(a),tc(n,{pending:!0,data:x,method:a.method,action:s},s,x))},currentTarget:a}]})}}for(var Lc=0;Lc<yo.length;Lc++){var Uc=yo[Lc],bb=Uc.toLowerCase(),yb=Uc[0].toUpperCase()+Uc.slice(1);Fn(bb,"on"+yb)}Fn(dd,"onAnimationEnd"),Fn(fd,"onAnimationIteration"),Fn(hd,"onAnimationStart"),Fn("dblclick","onDoubleClick"),Fn("focusin","onFocus"),Fn("focusout","onBlur"),Fn(Dg,"onTransitionRun"),Fn(Og,"onTransitionStart"),Fn(Lg,"onTransitionCancel"),Fn(md,"onTransitionEnd"),zl("onMouseEnter",["mouseout","mouseover"]),zl("onMouseLeave",["mouseout","mouseover"]),zl("onPointerEnter",["pointerout","pointerover"]),zl("onPointerLeave",["pointerout","pointerover"]),Vn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Vn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Vn("onBeforeInput",["compositionend","keypress","textInput","paste"]),Vn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Vn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Vn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ts="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(" "),vb=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ts));function Lh(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var l=e[n],a=l.event;l=l.listeners;e:{var s=void 0;if(t)for(var f=l.length-1;0<=f;f--){var p=l[f],x=p.instance,E=p.currentTarget;if(p=p.listener,x!==s&&a.isPropagationStopped())break e;s=p,a.currentTarget=E;try{s(a)}catch(U){Ls(U)}a.currentTarget=null,s=x}else for(f=0;f<l.length;f++){if(p=l[f],x=p.instance,E=p.currentTarget,p=p.listener,x!==s&&a.isPropagationStopped())break e;s=p,a.currentTarget=E;try{s(a)}catch(U){Ls(U)}a.currentTarget=null,s=x}}}}function Fe(e,t){var n=t[F];n===void 0&&(n=t[F]=new Set);var l=e+"__bubble";n.has(l)||(Uh(t,e,2,!1),n.add(l))}function Bc(e,t,n){var l=0;t&&(l|=4),Uh(n,e,l,t)}var wr="_reactListening"+Math.random().toString(36).slice(2);function Hc(e){if(!e[wr]){e[wr]=!0,vn.forEach(function(n){n!=="selectionchange"&&(vb.has(n)||Bc(n,!1,e),Bc(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[wr]||(t[wr]=!0,Bc("selectionchange",!1,t))}}function Uh(e,t,n,l){switch(fm(t)){case 2:var a=Zb;break;case 8:a=Qb;break;default:a=eu}n=a.bind(null,t,n,e),a=void 0,!ao||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(a=!0),l?a!==void 0?e.addEventListener(t,n,{capture:!0,passive:a}):e.addEventListener(t,n,!0):a!==void 0?e.addEventListener(t,n,{passive:a}):e.addEventListener(t,n,!1)}function Yc(e,t,n,l,a){var s=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var f=l.tag;if(f===3||f===4){var p=l.stateNode.containerInfo;if(p===a)break;if(f===4)for(f=l.return;f!==null;){var x=f.tag;if((x===3||x===4)&&f.stateNode.containerInfo===a)return;f=f.return}for(;p!==null;){if(f=jt(p),f===null)return;if(x=f.tag,x===5||x===6||x===26||x===27){l=s=f;continue e}p=p.parentNode}}l=l.return}Ku(function(){var E=s,U=no(n),G=[];e:{var R=pd.get(e);if(R!==void 0){var M=zs,re=e;switch(e){case"keypress":if(_s(n)===0)break e;case"keydown":case"keyup":M=fg;break;case"focusin":re="focus",M=oo;break;case"focusout":re="blur",M=oo;break;case"beforeblur":case"afterblur":M=oo;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":M=Vu;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":M=eg;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":M=pg;break;case dd:case fd:case hd:M=lg;break;case md:M=bg;break;case"scroll":case"scrollend":M=Pp;break;case"wheel":M=vg;break;case"copy":case"cut":case"paste":M=ig;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":M=Fu;break;case"toggle":case"beforetoggle":M=Sg}var Ce=(t&4)!==0,ct=!Ce&&(e==="scroll"||e==="scrollend"),T=Ce?R!==null?R+"Capture":null:R;Ce=[];for(var w=E,N;w!==null;){var K=w;if(N=K.stateNode,K=K.tag,K!==5&&K!==26&&K!==27||N===null||T===null||(K=Ci(w,T),K!=null&&Ce.push(ns(w,K,N))),ct)break;w=w.return}0<Ce.length&&(R=new M(R,re,null,n,U),G.push({event:R,listeners:Ce}))}}if((t&7)===0){e:{if(R=e==="mouseover"||e==="pointerover",M=e==="mouseout"||e==="pointerout",R&&n!==to&&(re=n.relatedTarget||n.fromElement)&&(jt(re)||re[fn]))break e;if((M||R)&&(R=U.window===U?U:(R=U.ownerDocument)?R.defaultView||R.parentWindow:window,M?(re=n.relatedTarget||n.toElement,M=E,re=re?jt(re):null,re!==null&&(ct=h(re),Ce=re.tag,re!==ct||Ce!==5&&Ce!==27&&Ce!==6)&&(re=null)):(M=null,re=E),M!==re)){if(Ce=Vu,K="onMouseLeave",T="onMouseEnter",w="mouse",(e==="pointerout"||e==="pointerover")&&(Ce=Fu,K="onPointerLeave",T="onPointerEnter",w="pointer"),ct=M==null?R:_t(M),N=re==null?R:_t(re),R=new Ce(K,w+"leave",M,n,U),R.target=ct,R.relatedTarget=N,K=null,jt(U)===E&&(Ce=new Ce(T,w+"enter",re,n,U),Ce.target=N,Ce.relatedTarget=ct,K=Ce),ct=K,M&&re)t:{for(Ce=xb,T=M,w=re,N=0,K=T;K;K=Ce(K))N++;K=0;for(var be=w;be;be=Ce(be))K++;for(;0<N-K;)T=Ce(T),N--;for(;0<K-N;)w=Ce(w),K--;for(;N--;){if(T===w||w!==null&&T===w.alternate){Ce=T;break t}T=Ce(T),w=Ce(w)}Ce=null}else Ce=null;M!==null&&Bh(G,R,M,Ce,!1),re!==null&&ct!==null&&Bh(G,ct,re,Ce,!0)}}e:{if(R=E?_t(E):window,M=R.nodeName&&R.nodeName.toLowerCase(),M==="select"||M==="input"&&R.type==="file")var $e=ed;else if(Pu(R))if(td)$e=_g;else{$e=jg;var ue=Rg}else M=R.nodeName,!M||M.toLowerCase()!=="input"||R.type!=="checkbox"&&R.type!=="radio"?E&&en(E.elementType)&&($e=ed):$e=Mg;if($e&&($e=$e(e,E))){$u(G,$e,n,U);break e}ue&&ue(e,R,E),e==="focusout"&&E&&R.type==="number"&&E.memoizedProps.value!=null&&ce(R,"number",R.value)}switch(ue=E?_t(E):window,e){case"focusin":(Pu(ue)||ue.contentEditable==="true")&&(Ya=ue,po=E,_i=null);break;case"focusout":_i=po=Ya=null;break;case"mousedown":go=!0;break;case"contextmenu":case"mouseup":case"dragend":go=!1,cd(G,n,U);break;case"selectionchange":if(zg)break;case"keydown":case"keyup":cd(G,n,U)}var He;if(uo)e:{switch(e){case"compositionstart":var Qe="onCompositionStart";break e;case"compositionend":Qe="onCompositionEnd";break e;case"compositionupdate":Qe="onCompositionUpdate";break e}Qe=void 0}else Ha?Ju(e,n)&&(Qe="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(Qe="onCompositionStart");Qe&&(Zu&&n.locale!=="ko"&&(Ha||Qe!=="onCompositionStart"?Qe==="onCompositionEnd"&&Ha&&(He=Gu()):(Dl=U,io="value"in Dl?Dl.value:Dl.textContent,Ha=!0)),ue=Cr(E,Qe),0<ue.length&&(Qe=new Xu(Qe,e,null,n,U),G.push({event:Qe,listeners:ue}),He?Qe.data=He:(He=Wu(n),He!==null&&(Qe.data=He)))),(He=Cg?Tg(e,n):Ng(e,n))&&(Qe=Cr(E,"onBeforeInput"),0<Qe.length&&(ue=new Xu("onBeforeInput","beforeinput",null,n,U),G.push({event:ue,listeners:Qe}),ue.data=He)),gb(G,e,E,n,U)}Lh(G,t)})}function ns(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Cr(e,t){for(var n=t+"Capture",l=[];e!==null;){var a=e,s=a.stateNode;if(a=a.tag,a!==5&&a!==26&&a!==27||s===null||(a=Ci(e,n),a!=null&&l.unshift(ns(e,a,s)),a=Ci(e,t),a!=null&&l.push(ns(e,a,s))),e.tag===3)return l;e=e.return}return[]}function xb(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Bh(e,t,n,l,a){for(var s=t._reactName,f=[];n!==null&&n!==l;){var p=n,x=p.alternate,E=p.stateNode;if(p=p.tag,x!==null&&x===l)break;p!==5&&p!==26&&p!==27||E===null||(x=E,a?(E=Ci(n,s),E!=null&&f.unshift(ns(n,E,x))):a||(E=Ci(n,s),E!=null&&f.push(ns(n,E,x)))),n=n.return}f.length!==0&&e.push({event:t,listeners:f})}var Sb=/\r\n?/g,wb=/\u0000|\uFFFD/g;function Hh(e){return(typeof e=="string"?e:""+e).replace(Sb,`
33
+ `).replace(wb,"")}function Yh(e,t){return t=Hh(t),Hh(e)===t}function ot(e,t,n,l,a,s){switch(n){case"children":typeof l=="string"?t==="body"||t==="textarea"&&l===""||$t(e,l):(typeof l=="number"||typeof l=="bigint")&&t!=="body"&&$t(e,""+l);break;case"className":ka(e,"class",l);break;case"tabIndex":ka(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":ka(e,n,l);break;case"style":bt(e,l,s);break;case"data":if(t!=="object"){ka(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=La(""+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 s=="function"&&(n==="formAction"?(t!=="input"&&ot(e,t,"name",a.name,a,null),ot(e,t,"formEncType",a.formEncType,a,null),ot(e,t,"formMethod",a.formMethod,a,null),ot(e,t,"formTarget",a.formTarget,a,null)):(ot(e,t,"encType",a.encType,a,null),ot(e,t,"method",a.method,a,null),ot(e,t,"target",a.target,a,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(n);break}l=La(""+l),e.setAttribute(n,l);break;case"onClick":l!=null&&(e.onclick=_n);break;case"onScroll":l!=null&&Fe("scroll",e);break;case"onScrollEnd":l!=null&&Fe("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(c(61));if(n=l.__html,n!=null){if(a.children!=null)throw Error(c(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=La(""+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":Fe("beforetoggle",e),Fe("toggle",e),Pt(e,"popover",l);break;case"xlinkActuate":Xn(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Xn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Xn(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Xn(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Xn(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Xn(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Xn(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Xn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Xn(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Pt(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=Mn.get(n)||n,Pt(e,n,l))}}function Kc(e,t,n,l,a,s){switch(n){case"style":bt(e,l,s);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(c(61));if(n=l.__html,n!=null){if(a.children!=null)throw Error(c(60));e.innerHTML=n}}break;case"children":typeof l=="string"?$t(e,l):(typeof l=="number"||typeof l=="bigint")&&$t(e,""+l);break;case"onScroll":l!=null&&Fe("scroll",e);break;case"onScrollEnd":l!=null&&Fe("scrollend",e);break;case"onClick":l!=null&&(e.onclick=_n);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ra.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(a=n.endsWith("Capture"),t=n.slice(2,a?n.length-7:void 0),s=e[Je]||null,s=s!=null?s[n]:null,typeof s=="function"&&e.removeEventListener(t,s,a),typeof l=="function")){typeof s!="function"&&s!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,l,a);break e}n in e?e[n]=l:l===!0?e.setAttribute(n,""):Pt(e,n,l)}}}function an(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Fe("error",e),Fe("load",e);var l=!1,a=!1,s;for(s in n)if(n.hasOwnProperty(s)){var f=n[s];if(f!=null)switch(s){case"src":l=!0;break;case"srcSet":a=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(c(137,t));default:ot(e,t,s,f,n,null)}}a&&ot(e,t,"srcSet",n.srcSet,n,null),l&&ot(e,t,"src",n.src,n,null);return;case"input":Fe("invalid",e);var p=s=f=a=null,x=null,E=null;for(l in n)if(n.hasOwnProperty(l)){var U=n[l];if(U!=null)switch(l){case"name":a=U;break;case"type":f=U;break;case"checked":x=U;break;case"defaultChecked":E=U;break;case"value":s=U;break;case"defaultValue":p=U;break;case"children":case"dangerouslySetInnerHTML":if(U!=null)throw Error(c(137,t));break;default:ot(e,t,l,U,n,null)}}P(e,s,p,x,E,f,a,!1);return;case"select":Fe("invalid",e),l=f=s=null;for(a in n)if(n.hasOwnProperty(a)&&(p=n[a],p!=null))switch(a){case"value":s=p;break;case"defaultValue":f=p;break;case"multiple":l=p;default:ot(e,t,a,p,n,null)}t=s,n=f,e.multiple=!!l,t!=null?ke(e,!!l,t,!1):n!=null&&ke(e,!!l,n,!0);return;case"textarea":Fe("invalid",e),s=a=l=null;for(f in n)if(n.hasOwnProperty(f)&&(p=n[f],p!=null))switch(f){case"value":l=p;break;case"defaultValue":a=p;break;case"children":s=p;break;case"dangerouslySetInnerHTML":if(p!=null)throw Error(c(91));break;default:ot(e,t,f,p,n,null)}cn(e,l,a,s);return;case"option":for(x in n)if(n.hasOwnProperty(x)&&(l=n[x],l!=null))switch(x){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:ot(e,t,x,l,n,null)}return;case"dialog":Fe("beforetoggle",e),Fe("toggle",e),Fe("cancel",e),Fe("close",e);break;case"iframe":case"object":Fe("load",e);break;case"video":case"audio":for(l=0;l<ts.length;l++)Fe(ts[l],e);break;case"image":Fe("error",e),Fe("load",e);break;case"details":Fe("toggle",e);break;case"embed":case"source":case"link":Fe("error",e),Fe("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(E in n)if(n.hasOwnProperty(E)&&(l=n[E],l!=null))switch(E){case"children":case"dangerouslySetInnerHTML":throw Error(c(137,t));default:ot(e,t,E,l,n,null)}return;default:if(en(t)){for(U in n)n.hasOwnProperty(U)&&(l=n[U],l!==void 0&&Kc(e,t,U,l,n,void 0));return}}for(p in n)n.hasOwnProperty(p)&&(l=n[p],l!=null&&ot(e,t,p,l,n,null))}function Cb(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 a=null,s=null,f=null,p=null,x=null,E=null,U=null;for(M in n){var G=n[M];if(n.hasOwnProperty(M)&&G!=null)switch(M){case"checked":break;case"value":break;case"defaultValue":x=G;default:l.hasOwnProperty(M)||ot(e,t,M,null,l,G)}}for(var R in l){var M=l[R];if(G=n[R],l.hasOwnProperty(R)&&(M!=null||G!=null))switch(R){case"type":s=M;break;case"name":a=M;break;case"checked":E=M;break;case"defaultChecked":U=M;break;case"value":f=M;break;case"defaultValue":p=M;break;case"children":case"dangerouslySetInnerHTML":if(M!=null)throw Error(c(137,t));break;default:M!==G&&ot(e,t,R,M,l,G)}}Oa(e,f,p,x,E,U,s,a);return;case"select":M=f=p=R=null;for(s in n)if(x=n[s],n.hasOwnProperty(s)&&x!=null)switch(s){case"value":break;case"multiple":M=x;default:l.hasOwnProperty(s)||ot(e,t,s,null,l,x)}for(a in l)if(s=l[a],x=n[a],l.hasOwnProperty(a)&&(s!=null||x!=null))switch(a){case"value":R=s;break;case"defaultValue":p=s;break;case"multiple":f=s;default:s!==x&&ot(e,t,a,s,l,x)}t=p,n=f,l=M,R!=null?ke(e,!!n,R,!1):!!l!=!!n&&(t!=null?ke(e,!!n,t,!0):ke(e,!!n,n?[]:"",!1));return;case"textarea":M=R=null;for(p in n)if(a=n[p],n.hasOwnProperty(p)&&a!=null&&!l.hasOwnProperty(p))switch(p){case"value":break;case"children":break;default:ot(e,t,p,null,l,a)}for(f in l)if(a=l[f],s=n[f],l.hasOwnProperty(f)&&(a!=null||s!=null))switch(f){case"value":R=a;break;case"defaultValue":M=a;break;case"children":break;case"dangerouslySetInnerHTML":if(a!=null)throw Error(c(91));break;default:a!==s&&ot(e,t,f,a,l,s)}Ut(e,R,M);return;case"option":for(var re in n)if(R=n[re],n.hasOwnProperty(re)&&R!=null&&!l.hasOwnProperty(re))switch(re){case"selected":e.selected=!1;break;default:ot(e,t,re,null,l,R)}for(x in l)if(R=l[x],M=n[x],l.hasOwnProperty(x)&&R!==M&&(R!=null||M!=null))switch(x){case"selected":e.selected=R&&typeof R!="function"&&typeof R!="symbol";break;default:ot(e,t,x,R,l,M)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ce in n)R=n[Ce],n.hasOwnProperty(Ce)&&R!=null&&!l.hasOwnProperty(Ce)&&ot(e,t,Ce,null,l,R);for(E in l)if(R=l[E],M=n[E],l.hasOwnProperty(E)&&R!==M&&(R!=null||M!=null))switch(E){case"children":case"dangerouslySetInnerHTML":if(R!=null)throw Error(c(137,t));break;default:ot(e,t,E,R,l,M)}return;default:if(en(t)){for(var ct in n)R=n[ct],n.hasOwnProperty(ct)&&R!==void 0&&!l.hasOwnProperty(ct)&&Kc(e,t,ct,void 0,l,R);for(U in l)R=l[U],M=n[U],!l.hasOwnProperty(U)||R===M||R===void 0&&M===void 0||Kc(e,t,U,R,l,M);return}}for(var T in n)R=n[T],n.hasOwnProperty(T)&&R!=null&&!l.hasOwnProperty(T)&&ot(e,t,T,null,l,R);for(G in l)R=l[G],M=n[G],!l.hasOwnProperty(G)||R===M||R==null&&M==null||ot(e,t,G,R,l,M)}function Kh(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Tb(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),l=0;l<n.length;l++){var a=n[l],s=a.transferSize,f=a.initiatorType,p=a.duration;if(s&&p&&Kh(f)){for(f=0,p=a.responseEnd,l+=1;l<n.length;l++){var x=n[l],E=x.startTime;if(E>p)break;var U=x.transferSize,G=x.initiatorType;U&&Kh(G)&&(x=x.responseEnd,f+=U*(x<p?1:(p-E)/(x-E)))}if(--l,t+=8*(s+f)/(a.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 Gc=null,qc=null;function Tr(e){return e.nodeType===9?e:e.ownerDocument}function Gh(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 qh(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 Vc(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 Xc=null;function Nb(){var e=window.event;return e&&e.type==="popstate"?e===Xc?!1:(Xc=e,!0):(Xc=null,!1)}var Vh=typeof setTimeout=="function"?setTimeout:void 0,Eb=typeof clearTimeout=="function"?clearTimeout:void 0,Xh=typeof Promise=="function"?Promise:void 0,Ab=typeof queueMicrotask=="function"?queueMicrotask:typeof Xh<"u"?function(e){return Xh.resolve(null).then(e).catch(Rb)}:Vh;function Rb(e){setTimeout(function(){throw e})}function Wl(e){return e==="head"}function Fh(e,t){var n=t,l=0;do{var a=n.nextSibling;if(e.removeChild(n),a&&a.nodeType===8)if(n=a.data,n==="/$"||n==="/&"){if(l===0){e.removeChild(a),hi(t);return}l--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")l++;else if(n==="html")ls(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,ls(n);for(var s=n.firstChild;s;){var f=s.nextSibling,p=s.nodeName;s[Ke]||p==="SCRIPT"||p==="STYLE"||p==="LINK"&&s.rel.toLowerCase()==="stylesheet"||n.removeChild(s),s=f}}else n==="body"&&ls(e.ownerDocument.body);n=a}while(n);hi(t)}function Zh(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 Fc(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":Fc(n),le(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function jb(e,t,n,l){for(;e.nodeType===1;){var a=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[Ke])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(s=e.getAttribute("rel"),s==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(s!==a.rel||e.getAttribute("href")!==(a.href==null||a.href===""?null:a.href)||e.getAttribute("crossorigin")!==(a.crossOrigin==null?null:a.crossOrigin)||e.getAttribute("title")!==(a.title==null?null:a.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(s=e.getAttribute("src"),(s!==(a.src==null?null:a.src)||e.getAttribute("type")!==(a.type==null?null:a.type)||e.getAttribute("crossorigin")!==(a.crossOrigin==null?null:a.crossOrigin))&&s&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var s=a.name==null?null:""+a.name;if(a.type==="hidden"&&e.getAttribute("name")===s)return e}else return e;if(e=Bn(e.nextSibling),e===null)break}return null}function Mb(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Bn(e.nextSibling),e===null))return null;return e}function Qh(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Bn(e.nextSibling),e===null))return null;return e}function Zc(e){return e.data==="$?"||e.data==="$~"}function Qc(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function _b(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 Bn(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 Ic=null;function Ih(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return Bn(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function Jh(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 Wh(e,t,n){switch(t=Tr(n),e){case"html":if(e=t.documentElement,!e)throw Error(c(452));return e;case"head":if(e=t.head,!e)throw Error(c(453));return e;case"body":if(e=t.body,!e)throw Error(c(454));return e;default:throw Error(c(451))}}function ls(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);le(e)}var Hn=new Map,Ph=new Set;function Nr(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var jl=q.d;q.d={f:kb,r:zb,D:Db,C:Ob,L:Lb,m:Ub,X:Hb,S:Bb,M:Yb};function kb(){var e=jl.f(),t=gr();return e||t}function zb(e){var t=Mt(e);t!==null&&t.tag===5&&t.type==="form"?pf(t):jl.r(e)}var ui=typeof document>"u"?null:document;function $h(e,t,n){var l=ui;if(l&&typeof t=="string"&&t){var a=on(t);a='link[rel="'+e+'"][href="'+a+'"]',typeof n=="string"&&(a+='[crossorigin="'+n+'"]'),Ph.has(a)||(Ph.add(a),e={rel:e,crossOrigin:n,href:t},l.querySelector(a)===null&&(t=l.createElement("link"),an(t,"link",e),nt(t),l.head.appendChild(t)))}}function Db(e){jl.D(e),$h("dns-prefetch",e,null)}function Ob(e,t){jl.C(e,t),$h("preconnect",e,t)}function Lb(e,t,n){jl.L(e,t,n);var l=ui;if(l&&e&&t){var a='link[rel="preload"][as="'+on(t)+'"]';t==="image"&&n&&n.imageSrcSet?(a+='[imagesrcset="'+on(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(a+='[imagesizes="'+on(n.imageSizes)+'"]')):a+='[href="'+on(e)+'"]';var s=a;switch(t){case"style":s=di(e);break;case"script":s=fi(e)}Hn.has(s)||(e=C({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Hn.set(s,e),l.querySelector(a)!==null||t==="style"&&l.querySelector(as(s))||t==="script"&&l.querySelector(is(s))||(t=l.createElement("link"),an(t,"link",e),nt(t),l.head.appendChild(t)))}}function Ub(e,t){jl.m(e,t);var n=ui;if(n&&e){var l=t&&typeof t.as=="string"?t.as:"script",a='link[rel="modulepreload"][as="'+on(l)+'"][href="'+on(e)+'"]',s=a;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":s=fi(e)}if(!Hn.has(s)&&(e=C({rel:"modulepreload",href:e},t),Hn.set(s,e),n.querySelector(a)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(is(s)))return}l=n.createElement("link"),an(l,"link",e),nt(l),n.head.appendChild(l)}}}function Bb(e,t,n){jl.S(e,t,n);var l=ui;if(l&&e){var a=at(l).hoistableStyles,s=di(e);t=t||"default";var f=a.get(s);if(!f){var p={loading:0,preload:null};if(f=l.querySelector(as(s)))p.loading=5;else{e=C({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Hn.get(s))&&Jc(e,n);var x=f=l.createElement("link");nt(x),an(x,"link",e),x._p=new Promise(function(E,U){x.onload=E,x.onerror=U}),x.addEventListener("load",function(){p.loading|=1}),x.addEventListener("error",function(){p.loading|=2}),p.loading|=4,Er(f,t,l)}f={type:"stylesheet",instance:f,count:1,state:p},a.set(s,f)}}}function Hb(e,t){jl.X(e,t);var n=ui;if(n&&e){var l=at(n).hoistableScripts,a=fi(e),s=l.get(a);s||(s=n.querySelector(is(a)),s||(e=C({src:e,async:!0},t),(t=Hn.get(a))&&Wc(e,t),s=n.createElement("script"),nt(s),an(s,"link",e),n.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},l.set(a,s))}}function Yb(e,t){jl.M(e,t);var n=ui;if(n&&e){var l=at(n).hoistableScripts,a=fi(e),s=l.get(a);s||(s=n.querySelector(is(a)),s||(e=C({src:e,async:!0,type:"module"},t),(t=Hn.get(a))&&Wc(e,t),s=n.createElement("script"),nt(s),an(s,"link",e),n.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},l.set(a,s))}}function em(e,t,n,l){var a=(a=fe.current)?Nr(a):null;if(!a)throw Error(c(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=di(n.href),n=at(a).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=di(n.href);var s=at(a).hoistableStyles,f=s.get(e);if(f||(a=a.ownerDocument||a,f={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},s.set(e,f),(s=a.querySelector(as(e)))&&!s._p&&(f.instance=s,f.state.loading=5),Hn.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},Hn.set(e,n),s||Kb(a,e,n,f.state))),t&&l===null)throw Error(c(528,""));return f}if(t&&l!==null)throw Error(c(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=fi(n),n=at(a).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(c(444,e))}}function di(e){return'href="'+on(e)+'"'}function as(e){return'link[rel="stylesheet"]['+e+"]"}function tm(e){return C({},e,{"data-precedence":e.precedence,precedence:null})}function Kb(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}),an(t,"link",n),nt(t),e.head.appendChild(t))}function fi(e){return'[src="'+on(e)+'"]'}function is(e){return"script[async]"+e}function nm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+on(n.href)+'"]');if(l)return t.instance=l,nt(l),l;var a=C({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),nt(l),an(l,"style",a),Er(l,n.precedence,e),t.instance=l;case"stylesheet":a=di(n.href);var s=e.querySelector(as(a));if(s)return t.state.loading|=4,t.instance=s,nt(s),s;l=tm(n),(a=Hn.get(a))&&Jc(l,a),s=(e.ownerDocument||e).createElement("link"),nt(s);var f=s;return f._p=new Promise(function(p,x){f.onload=p,f.onerror=x}),an(s,"link",l),t.state.loading|=4,Er(s,n.precedence,e),t.instance=s;case"script":return s=fi(n.src),(a=e.querySelector(is(s)))?(t.instance=a,nt(a),a):(l=n,(a=Hn.get(s))&&(l=C({},n),Wc(l,a)),e=e.ownerDocument||e,a=e.createElement("script"),nt(a),an(a,"link",l),e.head.appendChild(a),t.instance=a);case"void":return null;default:throw Error(c(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,Er(l,n.precedence,e));return t.instance}function Er(e,t,n){for(var l=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),a=l.length?l[l.length-1]:null,s=a,f=0;f<l.length;f++){var p=l[f];if(p.dataset.precedence===t)s=p;else if(s!==a)break}s?s.parentNode.insertBefore(e,s.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Jc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Wc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Ar=null;function lm(e,t,n){if(Ar===null){var l=new Map,a=Ar=new Map;a.set(n,l)}else a=Ar,l=a.get(n),l||(l=new Map,a.set(n,l));if(l.has(e))return l;for(l.set(e,null),n=n.getElementsByTagName(e),a=0;a<n.length;a++){var s=n[a];if(!(s[Ke]||s[tt]||e==="link"&&s.getAttribute("rel")==="stylesheet")&&s.namespaceURI!=="http://www.w3.org/2000/svg"){var f=s.getAttribute(t)||"";f=e+f;var p=l.get(f);p?p.push(s):l.set(f,[s])}}return l}function am(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function Gb(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 im(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function qb(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 a=di(l.href),s=t.querySelector(as(a));if(s){t=s._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Rr.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=s,nt(s);return}s=t.ownerDocument||t,l=tm(l),(a=Hn.get(a))&&Jc(l,a),s=s.createElement("link"),nt(s);var f=s;f._p=new Promise(function(p,x){f.onload=p,f.onerror=x}),an(s,"link",l),n.instance=s}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=Rr.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var Pc=0;function Vb(e,t){return e.stylesheets&&e.count===0&&Mr(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var l=setTimeout(function(){if(e.stylesheets&&Mr(e,e.stylesheets),e.unsuspend){var s=e.unsuspend;e.unsuspend=null,s()}},6e4+t);0<e.imgBytes&&Pc===0&&(Pc=62500*Tb());var a=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Mr(e,e.stylesheets),e.unsuspend)){var s=e.unsuspend;e.unsuspend=null,s()}},(e.imgBytes>Pc?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(a)}}:null}function Rr(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Mr(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var jr=null;function Mr(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,jr=new Map,t.forEach(Xb,e),jr=null,Rr.call(e))}function Xb(e,t){if(!(t.state.loading&4)){var n=jr.get(e);if(n)var l=n.get(null);else{n=new Map,jr.set(e,n);for(var a=e.querySelectorAll("link[data-precedence],style[data-precedence]"),s=0;s<a.length;s++){var f=a[s];(f.nodeName==="LINK"||f.getAttribute("media")!=="not all")&&(n.set(f.dataset.precedence,f),l=f)}l&&n.set(null,l)}a=t.instance,f=a.getAttribute("data-precedence"),s=n.get(f)||l,s===l&&n.set(null,a),n.set(f,a),this.count++,l=Rr.bind(this),a.addEventListener("load",l),a.addEventListener("error",l),s?s.parentNode.insertBefore(a,s.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(a,e.firstChild)),t.state.loading|=4}}var ss={$$typeof:Q,Provider:null,Consumer:null,_currentValue:J,_currentValue2:J,_threadCount:0};function Fb(e,t,n,l,a,s,f,p,x){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=ul(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ul(0),this.hiddenUpdates=ul(null),this.identifierPrefix=l,this.onUncaughtError=a,this.onCaughtError=s,this.onRecoverableError=f,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=x,this.incompleteTransitions=new Map}function sm(e,t,n,l,a,s,f,p,x,E,U,G){return e=new Fb(e,t,n,f,x,E,U,G,p),t=1,s===!0&&(t|=24),s=Sn(3,null,null,t),e.current=s,s.stateNode=e,t=_o(),t.refCount++,e.pooledCache=t,t.refCount++,s.memoizedState={element:l,isDehydrated:n,cache:t},Oo(s),e}function rm(e){return e?(e=qa,e):qa}function om(e,t,n,l,a,s){a=rm(a),l.context===null?l.context=a:l.pendingContext=a,l=Yl(t),l.payload={element:n},s=s===void 0?null:s,s!==null&&(l.callback=s),n=Kl(e,l,t),n!==null&&(yn(n,e,t),Bi(n,e,t))}function cm(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function $c(e,t){cm(e,t),(e=e.alternate)&&cm(e,t)}function um(e){if(e.tag===13||e.tag===31){var t=fa(e,67108864);t!==null&&yn(t,e,67108864),$c(e,67108864)}}function dm(e){if(e.tag===13||e.tag===31){var t=En();t=ne(t);var n=fa(e,t);n!==null&&yn(n,e,t),$c(e,t)}}var _r=!0;function Zb(e,t,n,l){var a=j.T;j.T=null;var s=q.p;try{q.p=2,eu(e,t,n,l)}finally{q.p=s,j.T=a}}function Qb(e,t,n,l){var a=j.T;j.T=null;var s=q.p;try{q.p=8,eu(e,t,n,l)}finally{q.p=s,j.T=a}}function eu(e,t,n,l){if(_r){var a=tu(l);if(a===null)Yc(e,t,l,kr,n),hm(e,l);else if(Jb(a,e,t,n,l))l.stopPropagation();else if(hm(e,l),t&4&&-1<Ib.indexOf(e)){for(;a!==null;){var s=Mt(a);if(s!==null)switch(s.tag){case 3:if(s=s.stateNode,s.current.memoizedState.isDehydrated){var f=dn(s.pendingLanes);if(f!==0){var p=s;for(p.pendingLanes|=2,p.entangledLanes|=2;f;){var x=1<<31-gt(f);p.entanglements[1]|=x,f&=~x}ll(s),(lt&6)===0&&(mr=te()+500,es(0))}}break;case 31:case 13:p=fa(s,2),p!==null&&yn(p,s,2),gr(),$c(s,2)}if(s=tu(l),s===null&&Yc(e,t,l,kr,n),s===a)break;a=s}a!==null&&l.stopPropagation()}else Yc(e,t,l,null,n)}}function tu(e){return e=no(e),nu(e)}var kr=null;function nu(e){if(kr=null,e=jt(e),e!==null){var t=h(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=g(t),e!==null)return e;e=null}else if(n===31){if(e=m(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return kr=e,null}function fm(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(xe()){case ye:return 2;case Pe:return 8;case Lt:case rn:return 32;case ft:return 268435456;default:return 32}default:return 32}}var lu=!1,Pl=null,$l=null,ea=null,rs=new Map,os=new Map,ta=[],Ib="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 hm(e,t){switch(e){case"focusin":case"focusout":Pl=null;break;case"dragenter":case"dragleave":$l=null;break;case"mouseover":case"mouseout":ea=null;break;case"pointerover":case"pointerout":rs.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":os.delete(t.pointerId)}}function cs(e,t,n,l,a,s){return e===null||e.nativeEvent!==s?(e={blockedOn:t,domEventName:n,eventSystemFlags:l,nativeEvent:s,targetContainers:[a]},t!==null&&(t=Mt(t),t!==null&&um(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,a!==null&&t.indexOf(a)===-1&&t.push(a),e)}function Jb(e,t,n,l,a){switch(t){case"focusin":return Pl=cs(Pl,e,t,n,l,a),!0;case"dragenter":return $l=cs($l,e,t,n,l,a),!0;case"mouseover":return ea=cs(ea,e,t,n,l,a),!0;case"pointerover":var s=a.pointerId;return rs.set(s,cs(rs.get(s)||null,e,t,n,l,a)),!0;case"gotpointercapture":return s=a.pointerId,os.set(s,cs(os.get(s)||null,e,t,n,l,a)),!0}return!1}function mm(e){var t=jt(e.target);if(t!==null){var n=h(t);if(n!==null){if(t=n.tag,t===13){if(t=g(n),t!==null){e.blockedOn=t,ze(e.priority,function(){dm(n)});return}}else if(t===31){if(t=m(n),t!==null){e.blockedOn=t,ze(e.priority,function(){dm(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 zr(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=tu(e.nativeEvent);if(n===null){n=e.nativeEvent;var l=new n.constructor(n.type,n);to=l,n.target.dispatchEvent(l),to=null}else return t=Mt(n),t!==null&&um(t),e.blockedOn=n,!1;t.shift()}return!0}function pm(e,t,n){zr(e)&&n.delete(t)}function Wb(){lu=!1,Pl!==null&&zr(Pl)&&(Pl=null),$l!==null&&zr($l)&&($l=null),ea!==null&&zr(ea)&&(ea=null),rs.forEach(pm),os.forEach(pm)}function Dr(e,t){e.blockedOn===t&&(e.blockedOn=null,lu||(lu=!0,o.unstable_scheduleCallback(o.unstable_NormalPriority,Wb)))}var Or=null;function gm(e){Or!==e&&(Or=e,o.unstable_scheduleCallback(o.unstable_NormalPriority,function(){Or===e&&(Or=null);for(var t=0;t<e.length;t+=3){var n=e[t],l=e[t+1],a=e[t+2];if(typeof l!="function"){if(nu(l||n)===null)continue;break}var s=Mt(n);s!==null&&(e.splice(t,3),t-=3,tc(s,{pending:!0,data:a,method:n.method,action:l},l,a))}}))}function hi(e){function t(x){return Dr(x,e)}Pl!==null&&Dr(Pl,e),$l!==null&&Dr($l,e),ea!==null&&Dr(ea,e),rs.forEach(t),os.forEach(t);for(var n=0;n<ta.length;n++){var l=ta[n];l.blockedOn===e&&(l.blockedOn=null)}for(;0<ta.length&&(n=ta[0],n.blockedOn===null);)mm(n),n.blockedOn===null&&ta.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(l=0;l<n.length;l+=3){var a=n[l],s=n[l+1],f=a[Je]||null;if(typeof s=="function")f||gm(n);else if(f){var p=null;if(s&&s.hasAttribute("formAction")){if(a=s,f=s[Je]||null)p=f.formAction;else if(nu(a)!==null)continue}else p=f.action;typeof p=="function"?n[l+1]=p:(n.splice(l,3),l-=3),gm(n)}}}function bm(){function e(s){s.canIntercept&&s.info==="react-transition"&&s.intercept({handler:function(){return new Promise(function(f){return a=f})},focusReset:"manual",scroll:"manual"})}function t(){a!==null&&(a(),a=null),l||setTimeout(n,20)}function n(){if(!l&&!navigation.transition){var s=navigation.currentEntry;s&&s.url!=null&&navigation.navigate(s.url,{state:s.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,a=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),a!==null&&(a(),a=null)}}}function au(e){this._internalRoot=e}Lr.prototype.render=au.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(c(409));var n=t.current,l=En();om(n,l,e,t,null,null)},Lr.prototype.unmount=au.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;om(e.current,2,null,e,null,null),gr(),t[fn]=null}};function Lr(e){this._internalRoot=e}Lr.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ee();e={blockedOn:null,target:e,priority:t};for(var n=0;n<ta.length&&t!==0&&t<ta[n].priority;n++);ta.splice(n,0,e),n===0&&mm(e)}};var ym=i.version;if(ym!=="19.2.8")throw Error(c(527,ym,"19.2.8"));q.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(c(188)):(e=Object.keys(e).join(","),Error(c(268,e)));return e=S(t),e=e!==null?v(e):null,e=e===null?null:e.stateNode,e};var Pb={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:j,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ur=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ur.isDisabled&&Ur.supportsFiber)try{Wn=Ur.inject(Pb),Zt=Ur}catch{}}return ds.createRoot=function(e,t){if(!d(e))throw Error(c(299));var n=!1,l="",a=Nf,s=Ef,f=Af;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(a=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(f=t.onRecoverableError)),t=sm(e,1,!1,null,null,n,l,null,a,s,f,bm),e[fn]=t.current,Hc(e),new au(t)},ds.hydrateRoot=function(e,t,n){if(!d(e))throw Error(c(299));var l=!1,a="",s=Nf,f=Ef,p=Af,x=null;return n!=null&&(n.unstable_strictMode===!0&&(l=!0),n.identifierPrefix!==void 0&&(a=n.identifierPrefix),n.onUncaughtError!==void 0&&(s=n.onUncaughtError),n.onCaughtError!==void 0&&(f=n.onCaughtError),n.onRecoverableError!==void 0&&(p=n.onRecoverableError),n.formState!==void 0&&(x=n.formState)),t=sm(e,1,!0,t,n??null,l,a,x,s,f,p,bm),t.context=rm(null),n=t.current,l=En(),l=ne(l),a=Yl(l),a.callback=null,Kl(n,a,l),n=l,t.current.lanes=n,dl(t,n),ll(t),e[fn]=t.current,Hc(e),new Lr(t)},ds.version="19.2.8",ds}var Tm;function dy(){if(Tm)return su.exports;Tm=1;function o(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(i){console.error(i)}}return o(),su.exports=uy(),su.exports}var fy=dy();const hy=ip(fy),Te={ESC:"\x1B",TAB:" ",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~"},my=new TextEncoder;function rp(o){return my.encode(o)}function py(o){if(!o||o.length===0)return"";const r=o.toUpperCase().charCodeAt(0);return r>=65&&r<=90?String.fromCharCode(r-64):o==="@"||o===" "?"\0":o==="["?"\x1B":o==="\\"?"":o==="]"?"":o==="^"?"":o==="_"?"":o==="?"?"":o}function gy(o){return`\x1B${o}`}function by(o,i){let r=o;return i.shift&&o.length===1&&!i.ctrl&&(r=o.toUpperCase()),i.ctrl&&(r=py(r)),i.alt&&(r=gy(r)),r}const op=27,cp=91,yy=60,Nm=59,up=77,dp=48,vy=57,xy=64,Sy=-30,cu=32,Em=255;function fp(o){return Number.isInteger(o)&&(o&Sy)===xy}function wy(o){return o>=dp&&o<=vy}function uu(o,i){let r=i,c=0;for(;r<o.length&&wy(o[r]);){if(c=c*10+(o[r]-dp),c>65535)return null;r+=1}return r===i?null:{value:c,next:r}}function Cy(o,i){if(o[i]!==op||o[i+1]!==cp||o[i+2]!==yy)return-1;const r=uu(o,i+3);if(!r||!fp(r.value)||o[r.next]!==Nm)return-1;const c=uu(o,r.next+1);if(!c||o[c.next]!==Nm)return-1;const d=uu(o,c.next+1);return!d||o[d.next]!==up?-1:d.next+1}function Ty(o,i){if(o[i]!==op||o[i+1]!==cp||o[i+2]!==up||i+6>o.length)return-1;const r=o[i+3]-cu,c=o[i+4],d=o[i+5];return!fp(r)||c<cu||c>Em||d<cu||d>Em?-1:i+6}function Xr(o){if(!o)return!1;const i=o instanceof Uint8Array?o:new Uint8Array(o);if(i.length===0)return!1;let r=0;for(;r<i.length;){const c=Cy(i,r);if(c>r){r=c;continue}const d=Ty(i,r);if(d>r){r=d;continue}return!1}return!0}class Ny{constructor(i){De(this,"ws",null);De(this,"config");De(this,"state","disconnected");De(this,"currentRole","viewer");De(this,"controllerId");De(this,"hostId");De(this,"assignedClientId");De(this,"reconnectAttempts",0);De(this,"reconnectTimer",null);De(this,"pingTimer",null);De(this,"pingTimestamp",null);De(this,"isManuallyClosed",!1);De(this,"authFailureDetail",null);De(this,"authFailureCode",null);De(this,"temporaryFailureCode",null);De(this,"pendingInputSegments",[]);De(this,"isFlushScheduled",!1);De(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});De(this,"terminalCols",80);De(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,r){return this.listeners[i].add(r),()=>{this.listeners[i].delete(r)}}emit(i,...r){this.listeners[i].forEach(d=>{try{d(...r)}catch(h){console.error(`Error in event listener for ${i}:`,h)}})}setState(i,r,c){this.state!==i&&(this.state=i,this.emit("stateChange",i,r,c))}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.clearTimers(),this.setState("connecting");try{const r=this.resolveWsUrl(this.config.wsUrl),c=new WebSocket(r);this.ws=c,c.binaryType="arraybuffer",c.onopen=()=>{this.isStaleSocket(c)||this.handleOpen()},c.onmessage=d=>{this.isStaleSocket(c)||this.handleMessage(d)},c.onerror=d=>{this.isStaleSocket(c)||this.handleError(d)},c.onclose=d=>{this.isStaleSocket(c)||this.handleClose(d)}}catch(r){this.setState("error",r instanceof Error?r.message:"Connection failed","connection_failed"),this.scheduleReconnect()}}}isStaleSocket(i){return this.ws!==i}teardownSocket(i=1e3,r="Client closed the connection"){this.pendingInputSegments=[],this.isFlushScheduled=!1;const c=this.ws;if(c){this.ws=null,c.onopen=null,c.onmessage=null,c.onerror=null,c.onclose=null;try{(c.readyState===WebSocket.OPEN||c.readyState===WebSocket.CONNECTING)&&c.close(i,r)}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()}handleOpen(){this.sendHello(),this.startHeartbeat()}async handleMessage(i){if(typeof i.data=="string")try{const r=JSON.parse(i.data);this.processJsonMessage(r)}catch(r){console.warn("Received unparseable text frame from server:",r)}else if(i.data instanceof ArrayBuffer)this.emit("binaryData",new Uint8Array(i.data));else if(typeof Blob<"u"&&i.data instanceof Blob)try{const r=await i.data.arrayBuffer();this.emit("binaryData",new Uint8Array(r))}catch(r){console.error("Failed to convert Blob to ArrayBuffer:",r)}}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 r=Math.max(0,performance.now()-this.pingTimestamp);this.pingTimestamp=null,this.emit("rttUpdate",Math.round(r))}break}case"paste_file_ready":{this.emit("pasteFileReady",i.path);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.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,c=Math.min(3e4,Math.floor(i*Math.pow(1.5,this.reconnectAttempts-1)+Math.random()*500));this.reconnectTimer=setTimeout(()=>{this.connect()},c)}startHeartbeat(){this.pingTimer&&clearInterval(this.pingTimer);const i=this.config.pingIntervalMs||1e4;this.pingTimer=setInterval(()=>{this.ws&&this.ws.readyState===WebSocket.OPEN&&this.sendPing()},i)}clearTimers(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.pingTimer&&(clearInterval(this.pingTimer),this.pingTimer=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 r={type:"claim_control",...i?{force:!0}:{}};this.sendJson(r)}releaseControl(){const i={type:"release_control"};this.sendJson(i)}sendResize(i,r){this.terminalCols=i,this.terminalRows=r;const c={type:"resize",cols:i,rows:r};this.sendJson(c)}sendPing(){this.pingTimestamp=performance.now();const i={type:"ping"};this.sendJson(i)}sendPasteFile(i,r){this.sendJson({type:"paste_file",mime:i,dataBase64:r})}sendJson(i){this.flushInput(),this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify(i))}sendInput(i){const r=i instanceof Uint8Array?i:new Uint8Array(i);r.length!==0&&(this.pendingInputSegments.push(r),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(c=>!Xr(c))),i.length===0)return;let r;if(i.length===1)r=i[0];else{let c=0;for(let h=0;h<i.length;h++)c+=i[h].byteLength;r=new Uint8Array(c);let d=0;for(let h=0;h<i.length;h++)r.set(i[h],d),d+=i[h].byteLength}this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(r)}sendBinary(i){this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(i)}sendText(i){const r=rp(i);this.sendInput(r)}resolveWsUrl(i){if(/^wss?:\/\//i.test(i))return i;if(/^https?:\/\//i.test(i)){const r=new URL(i);return r.protocol=r.protocol==="https:"?"wss:":"ws:",(!r.pathname||r.pathname==="/")&&(r.pathname="/ws/client"),r.toString()}if(typeof window<"u"&&window.location){const c=window.location.protocol==="https:"?"wss:":"ws:",d=window.location.host,h=i.startsWith("/")?i:`/${i}`;return`${c}//${d}${h}`}return"ws://127.0.0.1:8787/ws/client"}}const Ey=10,Ay=24,Jr=15,Au=13,Ru=640;function Ry(){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 gi()<Ru}function gi(){return typeof window>"u"?1024:window.visualViewport&&typeof window.visualViewport.width=="number"&&window.visualViewport.width>0?window.visualViewport.width:window.innerWidth||1024}function du(){return typeof window>"u"?768:window.visualViewport&&typeof window.visualViewport.height=="number"&&window.visualViewport.height>0?window.visualViewport.height:window.innerHeight||768}function Fr(o,i=Jr){const r=typeof o=="number"?o:Number(o);return!Number.isFinite(r)||r<=0?i:Math.min(Ay,Math.max(Ey,Math.round(r)))}function Am(o,i=gi()){if(i<Ru){const c=Fr(o,Au);return Math.min(15,Math.max(12,c))}return Fr(o,Jr)}const hp=[{id:"esc",label:"ESC",code:Te.ESC,type:"key",enabled:!0,title:"Escape"},{id:"tab",label:"TAB",code:Te.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:Te.LEFT,type:"key",enabled:!0,title:"Arrow Left"},{id:"up",label:"↑",code:Te.UP,type:"key",enabled:!0,title:"Arrow Up"},{id:"down",label:"↓",code:Te.DOWN,type:"key",enabled:!0,title:"Arrow Down"},{id:"right",label:"→",code:Te.RIGHT,type:"key",enabled:!0,title:"Arrow Right"},{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:"enter",label:"Enter",code:Te.ENTER,type:"key",enabled:!0,title:"Enter / Return"}],jy=[{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:Te.ESC,type:"key",enabled:!0,title:"Escape"},{id:"tab",label:"TAB",code:Te.TAB,type:"key",enabled:!0,title:"Tab"},{id:"enter",label:"Enter",code:Te.ENTER,type:"key",enabled:!0,title:"Enter / Return"},{id:"backspace",label:"⌫",code:Te.BACKSPACE,type:"key",enabled:!0,title:"Backspace"},{id:"delete",label:"Del",code:Te.DELETE,type:"key",enabled:!0,title:"Delete"},{id:"left",label:"←",code:Te.LEFT,type:"key",enabled:!0,title:"Arrow Left"},{id:"up",label:"↑",code:Te.UP,type:"key",enabled:!0,title:"Arrow Up"},{id:"down",label:"↓",code:Te.DOWN,type:"key",enabled:!0,title:"Arrow Down"},{id:"right",label:"→",code:Te.RIGHT,type:"key",enabled:!0,title:"Arrow Right"},{id:"home",label:"Home",code:Te.HOME,type:"key",enabled:!0,title:"Home"},{id:"end",label:"End",code:Te.END,type:"key",enabled:!0,title:"End"},{id:"page_up",label:"PgUp",code:Te.PAGE_UP,type:"key",enabled:!0,title:"Page Up"},{id:"page_down",label:"PgDn",code:Te.PAGE_DOWN,type:"key",enabled:!0,title:"Page Down"},{id:"insert",label:"Ins",code:Te.INSERT,type:"key",enabled:!0,title:"Insert"},{id:"ctrl_c",label:"^C",code:Te.CTRL_C,type:"chord",enabled:!0,title:"Ctrl+C (SIGINT)"},{id:"ctrl_d",label:"^D",code:Te.CTRL_D,type:"chord",enabled:!0,title:"Ctrl+D (EOF/Exit)"},{id:"ctrl_z",label:"^Z",code:Te.CTRL_Z,type:"chord",enabled:!0,title:"Ctrl+Z (SIGTSTP)"},{id:"ctrl_l",label:"^L",code:Te.CTRL_L,type:"chord",enabled:!0,title:"Ctrl+L (Clear Screen)"},{id:"ctrl_a",label:"^A",code:Te.CTRL_A,type:"chord",enabled:!0,title:"Ctrl+A (Beginning of Line)"},{id:"ctrl_e",label:"^E",code:Te.CTRL_E,type:"chord",enabled:!0,title:"Ctrl+E (End of Line)"},{id:"ctrl_k",label:"^K",code:Te.CTRL_K,type:"chord",enabled:!0,title:"Ctrl+K (Kill to End)"},{id:"ctrl_r",label:"^R",code:Te.CTRL_R,type:"chord",enabled:!0,title:"Ctrl+R (Reverse Search)"},{id:"f1",label:"F1",code:Te.F1,type:"fn",enabled:!0,title:"F1"},{id:"f2",label:"F2",code:Te.F2,type:"fn",enabled:!0,title:"F2"},{id:"f3",label:"F3",code:Te.F3,type:"fn",enabled:!0,title:"F3"},{id:"f4",label:"F4",code:Te.F4,type:"fn",enabled:!0,title:"F4"},{id:"f5",label:"F5",code:Te.F5,type:"fn",enabled:!0,title:"F5"},{id:"f6",label:"F6",code:Te.F6,type:"fn",enabled:!0,title:"F6"},{id:"f7",label:"F7",code:Te.F7,type:"fn",enabled:!0,title:"F7"},{id:"f8",label:"F8",code:Te.F8,type:"fn",enabled:!0,title:"F8"},{id:"f9",label:"F9",code:Te.F9,type:"fn",enabled:!0,title:"F9"},{id:"f10",label:"F10",code:Te.F10,type:"fn",enabled:!0,title:"F10"},{id:"f11",label:"F11",code:Te.F11,type:"fn",enabled:!0,title:"F11"},{id:"f12",label:"F12",code:Te.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 Ts(){return JSON.parse(JSON.stringify(hp))}const Rm=["esc","tab","ctrl","alt","left","up","down","right","enter","drawer_chords","drawer_symbols","drawer_fn"];function My(o){return o.length!==Rm.length?!1:o.every((i,r)=>i.id===Rm[r]&&i.enabled!==!1)}function _y(o){if(!Array.isArray(o)||o.length===0)return Ts();const i=o.filter(r=>typeof r=="object"&&r!==null&&typeof r.id=="string"&&typeof r.label=="string"&&typeof r.code=="string");return My(i)?Ts():i}function vu(o,i){if(i){const r=`keyTitles.${o.id}`,c=i(r);if(c&&c!==r)return c}return o.title||o.label}const xu='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", "Symbols Nerd Font Mono", monospace',ky='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',jm="JetBrains Mono, Menlo, Monaco, Consolas, monospace",bi="herdr_remote_settings_v1",ws="herdr_remote_session_view_v1",mp=64,Ns=4096,Su={local:{},session:{}};function Zr(o,i){if(typeof window>"u")return Su[o][i]||null;try{return(o==="local"?window.localStorage:window.sessionStorage).getItem(i)}catch{return Su[o][i]||null}}function Ea(o,i,r){if(Su[o][i]=r,!(typeof window>"u"))try{(o==="local"?window.localStorage:window.sessionStorage).setItem(i,r)}catch(c){console.warn(`Failed to write to ${o}Storage:`,c)}}function zy(){return`client-${Math.random().toString(36).substring(2,8)}`}function ju(){const o=Math.random().toString(36).substring(2,10);return`profile-${Date.now().toString(36)}-${o}`}function Dy(o,i){return(typeof o=="string"?o.trim().slice(0,mp):"")||i}function Qr(o,i){if(!o||typeof o!="object"||Array.isArray(o))return null;const r=o,c=typeof r.wsUrl=="string"?r.wsUrl.trim().slice(0,2048):"",d=typeof r.token=="string"?r.token.slice(0,Ns):"",h=typeof r.pairCode=="string"?r.pairCode.trim().toUpperCase().slice(0,32):"";if(!c||!c.startsWith("/")&&!/^(?:wss?|https?):\/\//i.test(c)||!d&&!h)return null;const g=Date.now(),m=typeof r.id=="string"&&r.id.length>0?r.id.slice(0,128):ju(),b=typeof r.hostname=="string"&&r.hostname.trim()?r.hostname.trim().slice(0,mp):`Herdr ${i+1}`;return{id:m,displayName:Dy(r.displayName,b),wsUrl:c,token:d,...h?{pairCode:h}:{},...typeof r.hostId=="string"&&r.hostId.trim()?{hostId:r.hostId.trim().slice(0,128)}:{},...typeof r.hostname=="string"&&r.hostname.trim()?{hostname:r.hostname.trim().slice(0,128)}:{},...typeof r.deviceId=="string"&&r.deviceId.trim()?{deviceId:r.deviceId.trim().slice(0,128)}:{},autoReconnect:r.autoReconnect!==!1,createdAt:Number.isFinite(r.createdAt)?Number(r.createdAt):g,lastUsedAt:Number.isFinite(r.lastUsedAt)?Number(r.lastUsedAt):g}}function Mm(o,i=0){const r=Qr({...o,id:o.id||ju()},i);if(!r)throw new Error("a connection profile requires a relay URL and token or pairing code");return r}function _m(o){let i=o.wsUrl.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"").toLowerCase();if(typeof window<"u")try{const r=new URL(o.wsUrl,window.location.origin);r.protocol=r.protocol==="wss:"?"https:":"http:",r.pathname=r.pathname.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"")||"/",r.search="",r.hash="",i=r.toString().replace(/\/$/,"").toLowerCase()}catch{}return`${i}::${o.hostId||""}`}function pp(){return typeof navigator<"u"&&navigator.language&&navigator.language.toLowerCase().startsWith("zh")?"zh":"en"}function gp(){const o=typeof window<"u"&&window.innerWidth<640;return{wsUrl:"/ws/client",token:"",pairCode:"",clientId:zy(),autoReconnect:!0,profiles:[],activeProfileId:"",fontSize:o?Au:Jr,fontFamily:xu,toolbarVisible:!0,toolbarPosition:"bottom",vibrateOnKeyPress:!0,predictiveEcho:"auto",language:pp(),virtualKeys:Ts(),adminToken:"",adminTokens:{}}}const Oy=["wsUrl","token","pairCode","clientId","autoReconnect","language"],Ly=["wsUrl","token","pairCode","autoReconnect"],Mu=["fontSize","fontFamily","toolbarVisible","toolbarPosition","vibrateOnKeyPress","predictiveEcho","virtualKeys","adminToken","adminTokens"],Uy=Mu.filter(o=>o!=="adminToken"&&o!=="adminTokens"),km=["theme","colorMode"];function wu(o){const i=o;if(!km.some(d=>i[d]!==void 0))return{data:o,changed:!1};const c={...i};for(const d of km)delete c[d];return{data:c,changed:!0}}function bp(o){if(!o||typeof o!="object"||Array.isArray(o))return{};const i={};for(const[r,c]of Object.entries(o).slice(0,32))typeof c!="string"||c.length===0||(i[r.slice(0,512)]=c.slice(0,Ns));return i}function yp(o){var h;const i=[];if((Array.isArray(o.profiles)?o.profiles.slice(0,64):[]).forEach((g,m)=>{const b=Qr(g,m);b&&!i.some(S=>S.id===b.id)&&i.push(b)}),i.length===0&&(typeof o.token=="string"&&o.token||typeof o.pairCode=="string"&&o.pairCode)){const g=Qr({id:"profile-migrated",displayName:"Herdr 1",wsUrl:typeof o.wsUrl=="string"&&o.wsUrl.trim()?o.wsUrl:"/ws/client",token:o.token||"",pairCode:o.pairCode||"",autoReconnect:o.autoReconnect!==!1},0);g&&i.push(g)}const c=typeof o.activeProfileId=="string"?o.activeProfileId:"",d=i.some(g=>g.id===c)?c:((h=i[0])==null?void 0:h.id)||"";return{profiles:i,activeProfileId:d}}function vp(){const o=gp();if(typeof window>"u")return o;let i={};const r=Zr("local",bi);if(r)try{i=JSON.parse(r)}catch(ee){console.warn("Failed to parse localStorage settings:",ee)}const c=wu(i);c.changed&&(i=c.data,Ea("local",bi,JSON.stringify(i)));let d=null;const h=Zr("session",ws);if(h)try{d=JSON.parse(h)}catch(ee){console.warn("Failed to parse sessionStorage settings:",ee)}if(!d){const ee={};for(const Ae of Mu)i[Ae]!==void 0&&(ee[Ae]=i[Ae]);d=ee,Ea("session",ws,JSON.stringify(d))}let g=d.fontFamily??i.fontFamily??o.fontFamily;(!g||g===jm||g===ky)&&(g=xu);const m=window.innerWidth<640?Au:Jr,b=d.fontSize??i.fontSize??o.fontSize,S=Fr(b,m),v=d.virtualKeys??i.virtualKeys??o.virtualKeys,C=_y(v),B=i.language??o.language,z=B==="zh"||B==="en"?B:pp(),_=yp(i),V=_.profiles.find(ee=>ee.id===_.activeProfileId),k=wu(d);k.changed&&(d=k.data,Ea("session",ws,JSON.stringify(d)));const Z=d.toolbarVisible??i.toolbarVisible??o.toolbarVisible,$=d.toolbarPosition??i.toolbarPosition??o.toolbarPosition,Q=d.vibrateOnKeyPress??i.vibrateOnKeyPress??o.vibrateOnKeyPress,ae=(d==null?void 0:d.predictiveEcho)??(i==null?void 0:i.predictiveEcho)??o.predictiveEcho,Se=ae==="always"||ae==="off"||ae==="auto"?ae:"auto",D=typeof d.adminToken=="string"?d.adminToken.slice(0,Ns):typeof i.adminToken=="string"?i.adminToken.slice(0,Ns):o.adminToken,O=bp(d.adminTokens),A={...o,...i,...d,wsUrl:(V==null?void 0:V.wsUrl)||(typeof i.wsUrl=="string"?i.wsUrl:o.wsUrl),token:(V==null?void 0:V.token)||"",pairCode:(V==null?void 0:V.pairCode)||"",autoReconnect:(V==null?void 0:V.autoReconnect)??o.autoReconnect,profiles:_.profiles,activeProfileId:_.activeProfileId,clientId:typeof i.clientId=="string"&&i.clientId.trim()?i.clientId.trim().slice(0,128):o.clientId,fontFamily:g,fontSize:S,toolbarVisible:Z,toolbarPosition:$,vibrateOnKeyPress:Q,predictiveEcho:Se,virtualKeys:C,language:z,adminToken:D,adminTokens:O};return i.fontFamily===jm&&(i.fontFamily=xu,Ea("local",bi,JSON.stringify(i))),A}function la(o){var B;const r={...vp(),...o};r.adminTokens=bp(r.adminTokens),typeof r.adminToken=="string"&&(r.adminToken=r.adminToken.slice(0,Ns)),o.fontSize!==void 0&&(r.fontSize=Fr(o.fontSize)),o.predictiveEcho!==void 0&&(o.predictiveEcho==="auto"||o.predictiveEcho==="always"||o.predictiveEcho==="off"?r.predictiveEcho=o.predictiveEcho:r.predictiveEcho="auto");const c=yp(r);let d=c.profiles,h=c.activeProfileId;if(Ly.some(z=>o[z]!==void 0)){const z=d.findIndex(k=>k.id===h),_=z>=0?{...d[z]}:{id:ju(),displayName:`Herdr ${d.length+1}`,wsUrl:r.wsUrl,token:"",autoReconnect:!0,createdAt:Date.now(),lastUsedAt:Date.now()};_.wsUrl=r.wsUrl,_.token=r.token,_.pairCode=r.pairCode||void 0,_.autoReconnect=r.autoReconnect,_.lastUsedAt=Date.now();const V=Qr(_,Math.max(z,0));V?z>=0?d[z]=V:(d.push(V),h=V.id):z>=0&&(d=d.filter(k=>k.id!==h),h=((B=d[0])==null?void 0:B.id)||"")}d.length>0&&!d.some(z=>z.id===h)&&(h=d[0].id);const m=d.find(z=>z.id===h);r.profiles=d,r.activeProfileId=h,r.wsUrl=(m==null?void 0:m.wsUrl)||r.wsUrl||"/ws/client",r.token=(m==null?void 0:m.token)||"",r.pairCode=(m==null?void 0:m.pairCode)||"",r.autoReconnect=(m==null?void 0:m.autoReconnect)??r.autoReconnect;const b=Zr("local",bi);let S={};if(b)try{S=JSON.parse(b)}catch{}S=wu(S).data;for(const z of Oy)r[z]!==void 0&&(S[z]=r[z]);S.profiles=d,S.activeProfileId=h,Ea("local",bi,JSON.stringify(S));const v=Zr("session",ws);let C={};if(v)try{C=JSON.parse(v)}catch{}for(const z of Mu)r[z]!==void 0&&(C[z]=r[z]);Ea("session",ws,JSON.stringify(C));for(const z of Uy)r[z]!==void 0&&(S[z]=r[z]);return Ea("local",bi,JSON.stringify(S)),r}const By={header:{appName:"Herdr",tagline:"remote terminal client",terminalTab:"Terminal",adminTab:"Admin",rttMs:"{rtt}ms",hostLabel:"Host",clientIdLabel:"ID:",copyClientIdTitle:"Click to copy Client ID",languageToggleTitle:"Switch language (EN / 中文)",pairingTitle:"Connection & pairing",settingsTitle:"Terminal settings",virtualKeyboardTitle:"Quick command helper",latencyTitle:"Round-trip latency (RTT)",mainNavigationAria:"Main Navigation",actionKeyboard:"cmd",actionPairing:"link",actionSettings:"cfg",languageShort:"en"},common:{connecting:"Connecting...",connected:"Connected",reconnecting:"Reconnecting...",disconnected:"Disconnected",error:"Error",save:"Save",cancel:"Cancel",close:"Close",done:"Done",retry:"Retry",connect:"Connect",disconnect:"Disconnect",copy:"Copy",copied:"Copied",loading:"Loading...",offline:"Offline",role:"Role",host:"Host",status:"Status",settings:"Settings",admin:"Admin",terminal:"Terminal",pairing:"Pairing",keyBar:"Key bar",quickInput:"Quick input",dismissNotification:"Dismiss notification",closeDialog:"Close dialog",clickToCopy:"Click to copy",controller:"Controller",viewer:"Viewer",live:"Live"},connection:{live:"Live",connecting:"Connecting",reconnecting:"Reconnecting",reconnectNow:"Reconnect now",error:"Error",offline:"Offline",connect:"Connect",retry:"Retry"},role:{controllerMode:"Controller mode active",viewerMode:"Viewer mode",controlActive:"Full Control",viewerReadOnly:"Viewer",viewerWithController:"Viewer (Active: {controllerId})",sharedControl:"Full control",sharedControlDesc:"Every paired window shares this terminal and may type into it.",sharedWindows:"{count} windows",thisWindow:"Window",claimControl:"Claim Control",claimControlTitle:"Claim terminal control",releaseControl:"Release",releaseControlTitle:"Switch to viewer mode",takeoverControl:"Takeover",takeoverControlTitle:"Take over control from {controllerId}",takeoverModalTitle:"Confirm Control Takeover",takeoverModalDesc:"Another client is controlling this terminal.",takeoverModalWarning:"Input focus will transfer to this window.",confirmTakeover:"Confirm Takeover"},statusBanner:{connecting:"Connecting to relay...",reconnectingDefault:"Connection lost. Reconnecting...",reconnectNow:"Reconnect Now",errorDefault:"Unable to connect to relay",disconnected:"Terminal disconnected"},onboarding:{title:"Pair with Herdr Remote",subtitle:"Connect your mobile or browser to your local terminal session",description:"Control Herdr sessions from any browser or phone.",firstTimeSetup:"First-time Setup",authRequired:"Authorization Required",authRequiredDesc:"Pair your device or provide a valid access token.",step1Title:"Generate Pairing Code on Host",step1Desc:"Run on the host running Herdr:",step1CopyPlugin:"Using Herdr Plugin:",step1CopyCli:"Copy CLI Command",step1TuiNote:"Interactive TUI config:",step2Title:"Enter 6-character Pairing Code",step2Placeholder:"e.g. 7X9K2A",step2Note:"Pairing code expires in 5 minutes; credentials are saved automatically.",connectAndPair:"Connect & Pair",connectingAndPairing:"Pairing with Relay...",advancedTitle:"Advanced Options",manualTokenLabel:"Authentication Token",manualTokenPlaceholder:"Optional token (skips pairing code)",wsEndpointLabel:"Relay WebSocket Endpoint",wsEndpointPlaceholder:"/ws/client or wss://your-relay-host/ws/client",clientIdLabel:"Device Client Identifier"},pairing:{title:"Relay Connection & Pairing",addTitle:"Add Herdr Instance",displayNameLabel:"Host Name",displayNamePlaceholder:"e.g. Workstation",displayNameHelp:"This name is stored only in this browser.",credentialsRequired:"Enter a pairing code or device token.",subtitle:"Manage WebSocket endpoints and credentials",pairCodeLabel:"Pairing Code",pairCodeNote:"(6-char code)",pairCodePlaceholder:"e.g. A1B2C3",pairCodeHelp:'Run "herdr-remote pair" on host.',tokenLabel:"Access Token",tokenNote:"(Device secret)",tokenPlaceholder:"Device token...",wsUrlLabel:"Relay WebSocket Endpoint URL",wsUrlPlaceholder:"/ws/client",wsUrlDefaultNote:"Defaults to same-origin /ws/client",clientIdLabel:"Client Identifier",newIdButton:"New ID",regenerateClientIdTitle:"Regenerate client ID",autoReconnectLabel:"Auto-reconnect",autoReconnectDesc:"Automatically reconnect when disconnected",copyDirectLink:"Copy direct pairing link",saveAndConnect:"Save & Connect"},settings:{title:"Terminal Preferences",subtitle:"Font, size, and touch settings",tabGeneral:"General",tabAppearance:"Appearance & Font",tabVirtualKeys:"Virtual Keys",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:"Speculatively render typed characters under high latency and reconcile with server echo.",touchKeyToolbar:"Touch Key Toolbar",touchKeyToolbarDesc:"Show modifier and navigation keys",touchHaptics:"Haptic Feedback",touchHapticsDesc:"Vibrate on key press",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."},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",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_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_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"},clipboard:{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"}},Hy={header:{appName:"Herdr",tagline:"远程终端客户端",terminalTab:"终端",adminTab:"管理面板",rttMs:"{rtt}ms",hostLabel:"主机",clientIdLabel:"客户端 ID:",copyClientIdTitle:"点击复制客户端 ID",languageToggleTitle:"切换语言 (EN / 中文)",pairingTitle:"连接与配对",settingsTitle:"终端设置",virtualKeyboardTitle:"快捷命令",latencyTitle:"网络延迟 (RTT)",mainNavigationAria:"主导航菜单",actionKeyboard:"命令",actionPairing:"配对",actionSettings:"设置",languageShort:"中"},common:{connecting:"连接中...",connected:"已连接",reconnecting:"重连中...",disconnected:"已断开",error:"错误",save:"保存",cancel:"取消",close:"关闭",done:"完成",retry:"重试",connect:"连接",disconnect:"断开连接",copy:"复制",copied:"已复制",loading:"加载中...",offline:"离线",role:"角色",host:"主机",status:"连接状态",settings:"设置",admin:"管理面板",terminal:"终端",pairing:"配对",keyBar:"按键条",quickInput:"快捷输入",dismissNotification:"关闭通知",closeDialog:"关闭对话框",clickToCopy:"点击复制",controller:"控制端",viewer:"观察者",live:"运行中"},connection:{live:"在线",connecting:"连接中",reconnecting:"正在重连",reconnectNow:"立即重连",error:"连接错误",offline:"离线",connect:"发起连接",retry:"重试"},role:{controllerMode:"控制模式",viewerMode:"观察者模式",controlActive:"控制端",viewerReadOnly:"观察者",viewerWithController:"观察者(控制者: {controllerId})",sharedControl:"完全控制",sharedControlDesc:"所有已配对窗口共享同一个终端,均可输入。",sharedWindows:"{count} 个窗口",thisWindow:"本窗口",claimControl:"获取控制权",claimControlTitle:"获取终端控制权",releaseControl:"释放控制权",releaseControlTitle:"切回观察者模式",takeoverControl:"强占控制权",takeoverControlTitle:"从 {controllerId} 接管控制权",takeoverModalTitle:"确认接管终端控制权?",takeoverModalDesc:"当前已有其他客户端控制该终端。",takeoverModalWarning:"接管后输入焦点切换至当前窗口。",confirmTakeover:"确认接管"},statusBanner:{connecting:"连接 Relay 服务中...",reconnectingDefault:"连接断开,正在重连...",reconnectNow:"立即重连",errorDefault:"无法连接 Relay 服务",disconnected:"会话已断开"},onboarding:{title:"配对 Herdr Remote",subtitle:"连接手机或浏览器至本地终端会话",description:"在浏览器或移动设备中控制 Herdr 会话。",firstTimeSetup:"首次配对",authRequired:"需要认证",authRequiredDesc:"使用配对码配对设备,或提供有效访问令牌。",step1Title:"在 Herdr 宿主机生成配对码",step1Desc:"在运行 Herdr 的主机终端执行:",step1CopyPlugin:"使用 Herdr 插件:",step1CopyCli:"复制 CLI 命令",step1TuiNote:"交互式 TUI 配置:",step2Title:"输入 6 位配对码",step2Placeholder:"例如:7X9K2A",step2Note:"配对码 5 分钟内有效,连接后自动保存凭据。",connectAndPair:"连接并完成配对",connectingAndPairing:"配对中...",advancedTitle:"高级选项",manualTokenLabel:"认证 Token",manualTokenPlaceholder:"可选 Token(跳过配对码)",wsEndpointLabel:"Relay WebSocket 端点",wsEndpointPlaceholder:"/ws/client 或 wss://relay-host/ws/client",clientIdLabel:"客户端标识 (Client ID)"},pairing:{title:"Relay 连接与配对",addTitle:"添加 Herdr 实例",displayNameLabel:"主机名称",displayNamePlaceholder:"例如:工作电脑",displayNameHelp:"名称仅保存在此浏览器中。",credentialsRequired:"请输入配对码或设备令牌。",subtitle:"管理 WebSocket 服务端点与凭证",pairCodeLabel:"配对码",pairCodeNote:"(6 位代码)",pairCodePlaceholder:"例如:A1B2C3",pairCodeHelp:'在主机运行 "herdr-remote pair" 获取。',tokenLabel:"访问 Token",tokenNote:"(设备凭据)",tokenPlaceholder:"设备 Token...",wsUrlLabel:"Relay WebSocket 端点",wsUrlPlaceholder:"/ws/client",wsUrlDefaultNote:'默认同源端点 "/ws/client"',clientIdLabel:"客户端标识",newIdButton:"生成新 ID",regenerateClientIdTitle:"重新生成客户端 ID",autoReconnectLabel:"掉线自动重连",autoReconnectDesc:"连接断开时自动尝试重连",copyDirectLink:"复制配对链接(含配对码)",saveAndConnect:"保存并连接"},settings:{title:"终端设置",subtitle:"字体、字号与触控管理",tabGeneral:"常规设置",tabAppearance:"终端与字体",tabVirtualKeys:"虚拟按键",fontFamilyLabel:"等宽字体",fontSizeLabel:"终端字号 ({size}px)",fontSizeCompact:"10px (紧凑)",fontSizeDefault:"15px (默认)",fontSizeLarge:"24px (大字号)",mobileFontNote:"小屏设备自动适配字号,保持 80 列完整显示。",colorPassthroughNote:"终端配色与光标样式透传自宿主环境。",predictiveEchoLabel:"预测回显",predictiveEchoAuto:"自动",predictiveEchoAlways:"始终开启",predictiveEchoOff:"关闭",predictiveEchoDesc:"高延迟时本地预先显示输入字符,服务端回显到达后自动校正。",touchKeyToolbar:"底部触控按键条",touchKeyToolbarDesc:"显示移动端修饰键与方向键工具栏",touchHaptics:"触控振动反馈",touchHapticsDesc:"移动端按键时轻微震动",languageLabel:"显示语言",languageDesc:"选择 English 或 简体中文",resetDefaults:"恢复默认设置",resetDefaultsToast:"设置已恢复默认",windowZoomSharedNote:"当前宿主未启用视图隔离,字号调整仅影响本地窗口。",fontSizeZoomHelp:"仅调节当前窗口字号,不影响其他窗口。"},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",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_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_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"},clipboard:{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:"移除图片"}},fu={en:By,zh:Hy};function _u(o,i,r){const c=fu[o]||fu.en,d=i.split(".");let h=c;for(const g of d)if(h&&typeof h=="object"&&g in h)h=h[g];else{let m=fu.en;for(const b of d)if(m&&typeof m=="object"&&b in m)m=m[b];else return i;h=m;break}if(typeof h!="string")return i;if(r){let g=h;for(const[m,b]of Object.entries(r))g=g.replaceAll(`{${m}}`,String(b));return g}return h}const zm="#11111b",Cu=[{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 Dm(o){if(!o||typeof o!="string")return Cu[0].font;const i=o.trim();if(i.includes("Symbols Nerd Font"))return i;if(/^['"]?monospace['"]?$/i.test(i))return'"Symbols Nerd Font Mono", monospace';const r=/,\s*['"]?monospace['"]?\s*$/i;return r.test(i)?i.replace(r,', "Symbols Nerd Font Mono", monospace'):`${i}, "Symbols Nerd Font Mono", monospace`}function Yy(o){if(!o)return null;const i={};return o.background&&(i.background=o.background,i.cursorAccent=o.background),o.foreground&&(i.foreground=o.foreground),o.cursor&&(i.cursor=o.cursor),o.ansi&&Object.assign(i,o.ansi),Object.keys(i).length===0?null:i}function xp(){if(typeof document>"u")return;const o=document.querySelector('meta[name="theme-color"]');document.documentElement.style.colorScheme="dark",o==null||o.setAttribute("content",zm),document.documentElement.classList.add("dark"),document.documentElement.classList.remove("light"),document.body.classList.add("dark"),document.body.classList.remove("light"),document.body.style.backgroundColor=zm}const Sp=1568,Ky=3*1024*1024,Gy=[.85,.7,.55,.4],In={active:!1,phase:"idle",ratio:0,percent:0,statusText:""};function qy(o,i,r=Sp){if(o<=0||i<=0)return{width:Math.max(1,o),height:Math.max(1,i)};const c=Math.max(o,i);if(c<=r)return{width:o,height:i};const d=r/c;return{width:Math.max(1,Math.round(o*d)),height:Math.max(1,Math.round(i*d))}}function Vy(o){if(typeof o!="string"||o.length===0)return 0;const i=o.length;let r=0;o.endsWith("==")?r=2:o.endsWith("=")&&(r=1);const c=Math.floor(i*3/4)-r;return Number.isFinite(c)&&c>0?c:0}function Xy(o){return o<1024?`${o} B`:o<1024*1024?`${(o/1024).toFixed(1)} KB`:`${(o/(1024*1024)).toFixed(1)} MB`}async function Fy(o){if(typeof createImageBitmap=="function")try{const i=await createImageBitmap(o,{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(o);return{source:i,width:i.width,height:i.height,cleanup:()=>{typeof i.close=="function"&&i.close()}}}catch{}}return new Promise((i,r)=>{if(typeof Image>"u")return r(new Error("Image decoding not supported in this environment"));const c=new Image,d=URL.createObjectURL(o);c.onload=()=>{i({source:c,width:c.naturalWidth||c.width,height:c.naturalHeight||c.height,cleanup:()=>{try{URL.revokeObjectURL(d)}catch{}}})},c.onerror=()=>{try{URL.revokeObjectURL(d)}catch{}r(new Error("Failed to decode image source"))},c.src=d})}async function wp(o,i=Sp,r=Ky){var d;if(!o||o.size===0||o.type&&!o.type.startsWith("image/"))return null;let c;try{c=await Fy(o)}catch(h){return console.warn("Failed to decode image for paste:",h),null}try{const{width:h,height:g}=qy(c.width,c.height,i),m=document.createElement("canvas");m.width=h,m.height=g;const b=m.getContext("2d");if(!b)return null;b.drawImage(c.source,0,0,h,g);let S="image/webp";try{m.toDataURL("image/webp",.85).startsWith("data:image/webp")||(S="image/jpeg")}catch{S="image/jpeg"}for(const v of Gy){let C;try{C=m.toDataURL(S,v)}catch{continue}if(!C||!C.startsWith("data:"))continue;const B=C.indexOf(","),z=B!==-1?C.slice(B+1):"",_=Vy(z);if(_<=r)return{mime:S,dataBase64:z,dataUrl:C,byteLength:_,width:h,height:g}}return null}finally{(d=c.cleanup)==null||d.call(c)}}const Zy=4e3,Qy=3,Iy=4096,Jy=8*1024*1024,Cp=y.createContext(null);function mi(o){return{wsUrl:o.wsUrl,token:o.token||void 0,pairCode:o.pairCode||void 0,clientId:o.clientId,autoReconnect:o.autoReconnect,reconnectIntervalMs:2e3,maxReconnectAttempts:0,pingIntervalMs:1e4}}const Wy=({children:o})=>{const[i,r]=y.useState(vp),[c,d]=y.useState("disconnected"),[h,g]=y.useState(),[m,b]=y.useState(),[S,v]=y.useState("viewer"),[C,B]=y.useState(),[z,_]=y.useState(),[V,k]=y.useState(),[Z,$]=y.useState(null),[Q,ae]=y.useState(),[Se,D]=y.useState(null),[O,A]=y.useState(1),[ee,Ae]=y.useState(0),[Re,Ne]=y.useState(null),[de,je]=y.useState(null),[Be,j]=y.useState({cols:80,rows:24}),[q,J]=y.useState([]);y.useEffect(()=>{xp()},[]);const we=y.useRef(i);we.current=i;const H=y.useRef(null),Ve=y.useRef(!1),X=y.useRef(Be);X.current=Be;const me=y.useRef(new Set),[_e,ve]=y.useState(In),fe=y.useRef(null),vt=y.useRef(0),Oe=y.useRef(null),Me=y.useCallback((L,Y)=>_u(i.language,L,Y),[i.language]),Ie=y.useRef(Me);Ie.current=Me;const pt=y.useRef(null),xt=y.useRef([]),Dt=y.useRef(0),St=y.useCallback(L=>{for(xt.current.push(L),Dt.current+=L.byteLength;xt.current.length>Iy||Dt.current>Jy;){const Y=xt.current.shift();if(!Y)break;Dt.current-=Y.byteLength}},[]),Rn=y.useCallback(L=>{const Y=pt.current;if(Y)try{Y(L);return}catch(ne){console.debug("Terminal output sink threw, buffering chunk instead:",ne)}St(L)},[St]),wt=y.useRef(Rn);wt.current=Rn;const ut=y.useCallback(L=>{pt.current=L;const Y=xt.current;xt.current=[],Dt.current=0;for(let ne=0;ne<Y.length;ne++)try{L(Y[ne])}catch(pe){console.debug("Terminal sink threw while flushing, re-buffering the tail:",pe);for(let Ee=ne;Ee<Y.length;Ee++)St(Y[Ee]);break}return()=>{pt.current===L&&(pt.current=null)}},[St]),At=y.useCallback(()=>xt.current.length,[]),Ot=y.useCallback(()=>{xt.current=[],Dt.current=0},[]),Wt=y.useCallback((L=!0)=>{v("viewer"),B(void 0),_(void 0),k(void 0),$(null),ae(void 0),D(null),A(1),Ne(null),Ot(),L&&Ae(Y=>Y+1)},[Ot]),Ft=y.useRef([]),Ct=y.useRef(new Map),Gt=y.useCallback(L=>{Ft.current=L,J(L)},[]),te=y.useCallback(L=>{const Y=Ct.current.get(L);Y&&(clearTimeout(Y),Ct.current.delete(L)),Gt(Ft.current.filter(ne=>ne.id!==L))},[Gt]),xe=y.useRef(te);xe.current=te;const ye=y.useCallback((L,Y)=>{const ne=Date.now(),pe=Ft.current,Ee=pe.find(Je=>Je.type===L&&Je.message===Y),ze=Ee?Ee.id:`${ne}-${Math.random().toString(36).substring(2,6)}`;let Le;if(Ee)Le=pe.map(Je=>Je.id===ze?{...Je,count:Je.count+1,timestamp:ne}:Je);else for(Le=[...pe,{id:ze,type:L,message:Y,timestamp:ne,count:1}];Le.length>Qy;){const[Je,...fn]=Le,F=Ct.current.get(Je.id);F&&(clearTimeout(F),Ct.current.delete(Je.id)),Le=fn}Gt(Le);const tt=Ct.current.get(ze);tt&&clearTimeout(tt),Ct.current.set(ze,setTimeout(()=>xe.current(ze),Zy))},[Gt]),Pe=y.useCallback(L=>{xe.current(L)},[]),Lt=y.useRef(!0);y.useEffect(()=>{S==="controller"&&(Lt.current=!0)},[S]);const rn=y.useCallback(()=>{Lt.current&&(Lt.current=!1,ye("warning",Ie.current("toasts.viewerModeWarning")))},[ye]);y.useEffect(()=>{const L=Ct.current;return()=>{for(const Y of L.values())clearTimeout(Y);L.clear()}},[]);const ft=y.useCallback(L=>{const Y=la(L);we.current=Y,r(Y)},[]),kl=y.useCallback(L=>{ft({language:L})},[ft]),Rt=y.useCallback(L=>{we.current=L,r(L)},[]),Wn=y.useCallback(L=>{var Ee;const Y=we.current,ne=Mm({...L,wsUrl:L.wsUrl||"/ws/client",token:L.token||"",displayName:L.displayName||`Herdr ${Y.profiles.length+1}`,autoReconnect:L.autoReconnect!==!1},Y.profiles.length),pe=la({profiles:[...Y.profiles,ne],activeProfileId:ne.id,wsUrl:ne.wsUrl,token:ne.token,pairCode:ne.pairCode||"",autoReconnect:ne.autoReconnect});Rt(pe),Wt(),(Ee=H.current)==null||Ee.reconnectWith(mi(pe))},[Rt,Wt]),Zt=y.useCallback(L=>{var Ee;const Y=we.current,ne=Y.profiles.find(ze=>ze.id===L);if(!ne||ne.id===Y.activeProfileId)return;const pe=la({activeProfileId:ne.id,wsUrl:ne.wsUrl,token:ne.token,pairCode:ne.pairCode||"",autoReconnect:ne.autoReconnect,profiles:Y.profiles.map(ze=>ze.id===ne.id?{...ze,lastUsedAt:Date.now()}:ze)});Rt(pe),Wt(),(Ee=H.current)==null||Ee.reconnectWith(mi(pe))},[Rt,Wt]),Qt=y.useCallback((L,Y)=>{const ne=we.current;if(!ne.profiles.find(Le=>Le.id===L))return;const Ee=Y.trim().slice(0,64);if(!Ee)return;const ze=la({profiles:ne.profiles.map(Le=>Le.id===L?{...Le,displayName:Ee}:Le)});Rt(ze)},[Rt]),gt=y.useCallback(L=>{var ze;const Y=we.current;if(!Y.profiles.some(Le=>Le.id===L))return;const ne=Y.profiles.filter(Le=>Le.id!==L),pe=ne.find(Le=>Le.id===Y.activeProfileId)||ne[0],Ee=la(pe?{profiles:ne,activeProfileId:pe.id,wsUrl:pe.wsUrl,token:pe.token,pairCode:pe.pairCode||"",autoReconnect:pe.autoReconnect}:{profiles:[],activeProfileId:"",wsUrl:"/ws/client",token:"",pairCode:""});Rt(Ee),L===Y.activeProfileId&&(Wt(),(ze=H.current)==null||ze.reconnectWith(mi(Ee)))},[Rt,Wt]),Pn=y.useCallback(L=>{const Y=we.current,ne=Y.profiles.find(I=>I.id===Y.activeProfileId),pe=L.hostId?_m({wsUrl:Y.wsUrl,hostId:L.hostId}):null,Ee=pe?Y.profiles.findIndex(I=>_m(I)===pe):-1,ze=Ee>=0?Ee:Math.max(0,Y.profiles.findIndex(I=>I.id===Y.activeProfileId)),tt={...Y.profiles[ze]||ne||Mm({wsUrl:Y.wsUrl||"/ws/client",token:"",pairCode:Y.pairCode||"PENDING",displayName:`Herdr ${Y.profiles.length+1}`},Y.profiles.length),token:L.token,pairCode:void 0,...L.hostId?{hostId:L.hostId}:{},...L.deviceId?{deviceId:L.deviceId}:{},lastUsedAt:Date.now()};let Je=[...Y.profiles];ze>=0&&ze<Je.length?Je[ze]=tt:Je.push(tt);const fn=ne==null?void 0:ne.id;Je=Je.filter((I,he)=>he===ze||I.id===tt.id?!0:!(Ee>=0&&fn&&I.id===fn));const F=la({profiles:Je,activeProfileId:tt.id,wsUrl:tt.wsUrl,token:tt.token,pairCode:"",autoReconnect:tt.autoReconnect});return Rt(F),F},[Rt]),$n=y.useCallback(L=>{const Y=we.current,ne=Y.profiles.find(Le=>Le.id===Y.activeProfileId);if(!ne||!L.hostId&&!L.hostname)return;const pe=/^Herdr \d+$/.test(ne.displayName),Ee={...ne,...L.hostId?{hostId:L.hostId}:{},...L.hostname?{hostname:L.hostname}:{},...L.hostname&&pe?{displayName:L.hostname}:{}},ze=la({profiles:Y.profiles.map(Le=>Le.id===ne.id?Ee:Le)});Rt(ze)},[Rt]);if(!H.current){const L=new Ny(mi(i));H.current=L,L.on("stateChange",(Y,ne,pe)=>{d(Y),b(pe);const Ee=pe?`serverErrors.${pe}`:null,ze=Ee?Ie.current(Ee):null,Le=ze&&ze!==Ee?ze:ne;g(Le),Y==="connected"?ye("success",Ie.current("toasts.connected")):Y==="error"&&ye("error",Le||Ie.current("toasts.connectionError"))}),L.on("ready",Y=>{Ve.current&&(Ot(),Ae(ne=>ne+1)),Ve.current=!0,v(Y.role),B(Y.controllerId),_(Y.hostId),k(Y.hostname),$n(Y),Y.clientId&&ae(Y.clientId),$(Y.terminalPalette||null)}),L.on("hostReconnecting",Y=>{b(Y||"host_reconnecting"),g(Ie.current(`serverErrors.${Y||"host_reconnecting"}`)),v("viewer"),B(void 0),k(void 0),$(null),D(null),A(1),Ne(null),Ot()}),L.on("sessionRestarted",(Y,ne,pe,Ee)=>{Ot(),k(Ee),$n({hostId:L.getHostId(),hostname:Ee}),$(pe||null),Ae(ze=>ze+1)}),L.on("roleChange",(Y,ne,pe,Ee)=>{v(Y),B(ne),pe&&_(pe),Ee&&ae(Ee)}),L.on("controlGranted",()=>{v("controller"),ye("success",Ie.current("toasts.controlGranted"))}),L.on("controlDenied",Y=>{ye("warning",Y||Ie.current("toasts.controlDenied"))}),L.on("controlRevoked",Y=>{v("viewer"),ye("warning",Y||Ie.current("toasts.controlRevoked"))}),L.on("paired",Y=>{const ne=Pn(Y);ye("success",Ie.current("toasts.pairedSuccess")),je(Date.now()),L.reconnectWith(mi(ne))}),L.on("exit",(Y,ne)=>{ye("info",`${Ie.current("toasts.sessionEnded")}${ne?`: ${ne}`:""}${Y!==void 0?` (${Y})`:""}`)}),L.on("status",Y=>{Ne(Y)}),L.on("error",Y=>{fe.current!==null&&(Oe.current&&(clearTimeout(Oe.current),Oe.current=null),fe.current=null,ve(In));const pe=`serverErrors.${String(Y.code)}`,Ee=Ie.current(pe),ze=Ee&&Ee!==pe?Ee:Y.message||`[${Y.code}]`;ye("error",ze)}),L.on("pasteFileReady",Y=>{const ne=fe.current;ne!==null&&(Oe.current&&(clearTimeout(Oe.current),Oe.current=null),ve({active:!0,phase:"completed",ratio:1,percent:100,statusText:Ie.current("virtualKeyboard.uploadProgressCompleted")}),setTimeout(()=>{fe.current===ne&&(fe.current=null,ve(In))},1200));for(const pe of me.current)try{pe(Y)}catch(Ee){console.error("Error in pasteFileReady listener:",Ee)}}),L.on("rttUpdate",Y=>{D(Y)}),L.on("peerCount",Y=>{A(Math.max(1,Y))}),L.on("sessionReady",()=>{d("connected")}),L.on("binaryData",Y=>{wt.current(Y)})}const xi=H.current,sl=i.profiles.find(L=>L.id===i.activeProfileId);y.useEffect(()=>{var L;(L=H.current)==null||L.updateConfig(mi(i))},[i]);const rl=y.useCallback(L=>{H.current&&(L&&H.current.updateConfig(L),H.current.connect(X.current))},[]),ol=y.useCallback(()=>{H.current&&H.current.disconnect()},[]),dn=y.useCallback((L=!1)=>{H.current&&H.current.claimControl(L)},[]),qn=y.useCallback(()=>{var L;(L=H.current)==null||L.releaseControl()},[]),cl=y.useCallback(L=>{if(S!=="controller"){rn();return}H.current&&H.current.sendText(L)},[S,rn]),Si=y.useCallback(L=>{S!=="controller"&&!Xr(L)||H.current&&H.current.sendInput(L)},[S]),_a=y.useCallback((L,Y)=>{X.current={cols:L,rows:Y},j({cols:L,rows:Y}),H.current&&H.current.sendResize(L,Y)},[]),ul=y.useCallback((L,Y)=>S!=="controller"?(rn(),!1):H.current?(H.current.sendPasteFile(L,Y),!0):!1,[S,rn]),dl=y.useCallback(L=>(me.current.add(L),()=>{me.current.delete(L)}),[]),wi=y.useCallback(()=>{Oe.current&&(clearTimeout(Oe.current),Oe.current=null),fe.current=null,ve(In)},[]);y.useEffect(()=>{c!=="connected"&&fe.current!==null&&(Oe.current&&(clearTimeout(Oe.current),Oe.current=null),fe.current=null,ve(In))},[c]),y.useEffect(()=>()=>{Oe.current&&clearTimeout(Oe.current)},[]);const sa=y.useCallback(async L=>{if(S!=="controller")return rn(),!1;if(!H.current||c!=="connected")return ye("error",Me("serverErrors.host_offline")),!1;if(fe.current!==null)return!1;const Y=++vt.current;fe.current=Y,Oe.current&&(clearTimeout(Oe.current),Oe.current=null);const ne="dataBase64"in L&&typeof L.dataBase64=="string";try{let pe;if(ne)pe=L;else{const ze=L;if(ve({active:!0,phase:"reading",ratio:.1,percent:10,statusText:Me("virtualKeyboard.uploadProgressReading")}),!ze||ze.size===0)return ye("error",Me("clipboard.fileEmpty")),fe.current=null,ve(In),!1;if(ze.type&&!ze.type.startsWith("image/"))return ye("error",Me("clipboard.unsupportedType")),fe.current=null,ve(In),!1;ve({active:!0,phase:"processing",ratio:.35,percent:35,statusText:Me("virtualKeyboard.uploadProgressProcessing")});const Le=await wp(ze);if(fe.current!==Y)return!1;if(!Le)return ye("error",Me("clipboard.imageTooLarge")),fe.current=null,ve(In),!1;pe=Le,ve({active:!0,phase:"processing",ratio:.6,percent:60,statusText:Me("virtualKeyboard.uploadProgressProcessing")})}ve({active:!0,phase:"sending",ratio:.75,percent:75,statusText:Me("virtualKeyboard.uploadProgressSending")});const Ee=ul(pe.mime,pe.dataBase64);return fe.current!==Y?!1:Ee?(ve({active:!0,phase:"waitingHost",ratio:.88,percent:88,statusText:Me("virtualKeyboard.uploadProgressWaitingHost")}),Oe.current=setTimeout(()=>{fe.current===Y&&(fe.current=null,ye("error",Me("serverErrors.paste_file_write_failed")),ve(In))},3e4),!0):(fe.current=null,ve(In),!1)}catch(pe){return console.error("Failed to process/upload image:",pe),fe.current===Y&&(fe.current=null,ye("error",Me("clipboard.imageTooLarge")),ve(In)),!1}},[S,c,rn,ye,Me,ul]);return u.jsx(Cp.Provider,{value:{connectionState:c,stateDetail:h,stateCode:m,role:S,controllerId:C,hostId:z,hostname:V,assignedClientId:Q,profiles:i.profiles,activeProfileId:i.activeProfileId,activeProfile:sl,isController:S==="controller",sharedWindowCount:O,terminalResetVersion:ee,rttMs:Se,statusPayload:Re,lastPairedAt:de,settings:i,hostPalette:Z,terminalDimensions:Be,toasts:q,adapter:xi,language:i.language,t:Me,setLanguage:kl,connect:rl,disconnect:ol,switchProfile:Zt,addProfileAndConnect:Wn,renameProfile:Qt,removeProfile:gt,claimControl:dn,releaseControl:qn,sendKey:cl,sendBinary:Si,sendResize:_a,updateSettings:ft,addToast:ye,removeToast:Pe,warnViewerMode:rn,subscribeToOutput:ut,getPendingOutputChunkCount:At,sendPasteFile:ul,subscribeToPasteFileReady:dl,uploadProgress:_e,uploadImage:sa,resetUploadProgress:wi},children:o})};function Tt(){const o=y.useContext(Cp);if(!o)throw new Error("useTerminal must be used within a TerminalProvider");return o}function Tp(o){var i,r,c="";if(typeof o=="string"||typeof o=="number")c+=o;else if(typeof o=="object")if(Array.isArray(o)){var d=o.length;for(i=0;i<d;i++)o[i]&&(r=Tp(o[i]))&&(c&&(c+=" "),c+=r)}else for(r in o)o[r]&&(c&&(c+=" "),c+=r);return c}function Py(){for(var o,i,r=0,c="",d=arguments.length;r<d;r++)(o=arguments[r])&&(i=Tp(o))&&(c&&(c+=" "),c+=i);return c}const $y=(o,i)=>{const r=new Array(o.length+i.length);for(let c=0;c<o.length;c++)r[c]=o[c];for(let c=0;c<i.length;c++)r[o.length+c]=i[c];return r},ev=(o,i)=>({classGroupId:o,validator:i}),Np=(o=new Map,i=null,r)=>({nextPart:o,validators:i,classGroupId:r}),Ir="-",Om=[],tv="arbitrary..",nv=o=>{const i=av(o),{conflictingClassGroups:r,conflictingClassGroupModifiers:c}=o;return{getClassGroupId:g=>{if(g.startsWith("[")&&g.endsWith("]"))return lv(g);const m=g.split(Ir),b=m[0]===""&&m.length>1?1:0;return Ep(m,b,i)},getConflictingClassGroupIds:(g,m)=>{if(m){const b=c[g],S=r[g];return b?S?$y(S,b):b:S||Om}return r[g]||Om}}},Ep=(o,i,r)=>{if(o.length-i===0)return r.classGroupId;const d=o[i],h=r.nextPart.get(d);if(h){const S=Ep(o,i+1,h);if(S)return S}const g=r.validators;if(g===null)return;const m=i===0?o.join(Ir):o.slice(i).join(Ir),b=g.length;for(let S=0;S<b;S++){const v=g[S];if(v.validator(m))return v.classGroupId}},lv=o=>o.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const i=o.slice(1,-1),r=i.indexOf(":"),c=i.slice(0,r);return c?tv+c:void 0})(),av=o=>{const{theme:i,classGroups:r}=o;return iv(r,i)},iv=(o,i)=>{const r=Np();for(const c in o){const d=o[c];ku(d,r,c,i)}return r},ku=(o,i,r,c)=>{const d=o.length;for(let h=0;h<d;h++){const g=o[h];sv(g,i,r,c)}},sv=(o,i,r,c)=>{if(typeof o=="string"){rv(o,i,r);return}if(typeof o=="function"){ov(o,i,r,c);return}cv(o,i,r,c)},rv=(o,i,r)=>{const c=o===""?i:Ap(i,o);c.classGroupId=r},ov=(o,i,r,c)=>{if(uv(o)){ku(o(c),i,r,c);return}i.validators===null&&(i.validators=[]),i.validators.push(ev(r,o))},cv=(o,i,r,c)=>{const d=Object.entries(o),h=d.length;for(let g=0;g<h;g++){const[m,b]=d[g];ku(b,Ap(i,m),r,c)}},Ap=(o,i)=>{let r=o;const c=i.split(Ir),d=c.length;for(let h=0;h<d;h++){const g=c[h];let m=r.nextPart.get(g);m||(m=Np(),r.nextPart.set(g,m)),r=m}return r},uv=o=>"isThemeGetter"in o&&o.isThemeGetter===!0,dv=o=>{if(o<1)return{get:()=>{},set:()=>{}};let i=0,r=Object.create(null),c=Object.create(null);const d=(h,g)=>{r[h]=g,i++,i>o&&(i=0,c=r,r=Object.create(null))};return{get(h){let g=r[h];if(g!==void 0)return g;if((g=c[h])!==void 0)return d(h,g),g},set(h,g){h in r?r[h]=g:d(h,g)}}},Tu="!",Lm=":",fv=[],Um=(o,i,r,c,d)=>({modifiers:o,hasImportantModifier:i,baseClassName:r,maybePostfixModifierPosition:c,isExternal:d}),hv=o=>{const{prefix:i,experimentalParseClassName:r}=o;let c=d=>{const h=[];let g=0,m=0,b=0,S;const v=d.length;for(let V=0;V<v;V++){const k=d[V];if(g===0&&m===0){if(k===Lm){h.push(d.slice(b,V)),b=V+1;continue}if(k==="/"){S=V;continue}}k==="["?g++:k==="]"?g--:k==="("?m++:k===")"&&m--}const C=h.length===0?d:d.slice(b);let B=C,z=!1;C.endsWith(Tu)?(B=C.slice(0,-1),z=!0):C.startsWith(Tu)&&(B=C.slice(1),z=!0);const _=S&&S>b?S-b:void 0;return Um(h,z,B,_)};if(i){const d=i+Lm,h=c;c=g=>g.startsWith(d)?h(g.slice(d.length)):Um(fv,!1,g,void 0,!0)}if(r){const d=c;c=h=>r({className:h,parseClassName:d})}return c},mv=o=>{const i=new Map;return o.orderSensitiveModifiers.forEach((r,c)=>{i.set(r,1e6+c)}),r=>{const c=[];let d=[];for(let h=0;h<r.length;h++){const g=r[h],m=g[0]==="[",b=i.has(g);m||b?(d.length>0&&(d.sort(),c.push(...d),d=[]),c.push(g)):d.push(g)}return d.length>0&&(d.sort(),c.push(...d)),c}},pv=o=>({cache:dv(o.cacheSize),parseClassName:hv(o),sortModifiers:mv(o),postfixLookupClassGroupIds:gv(o),...nv(o)}),gv=o=>{const i=Object.create(null),r=o.postfixLookupClassGroups;if(r)for(let c=0;c<r.length;c++)i[r[c]]=!0;return i},bv=/\s+/,yv=(o,i)=>{const{parseClassName:r,getClassGroupId:c,getConflictingClassGroupIds:d,sortModifiers:h,postfixLookupClassGroupIds:g}=i,m=[],b=o.trim().split(bv);let S="";for(let v=b.length-1;v>=0;v-=1){const C=b[v],{isExternal:B,modifiers:z,hasImportantModifier:_,baseClassName:V,maybePostfixModifierPosition:k}=r(C);if(B){S=C+(S.length>0?" "+S:S);continue}let Z=!!k,$;if(Z){const O=V.substring(0,k);$=c(O);const A=$&&g[$]?c(V):void 0;A&&A!==$&&($=A,Z=!1)}else $=c(V);if(!$){if(!Z){S=C+(S.length>0?" "+S:S);continue}if($=c(V),!$){S=C+(S.length>0?" "+S:S);continue}Z=!1}const Q=z.length===0?"":z.length===1?z[0]:h(z).join(":"),ae=_?Q+Tu:Q,Se=ae+$;if(m.indexOf(Se)>-1)continue;m.push(Se);const D=d($,Z);for(let O=0;O<D.length;++O){const A=D[O];m.push(ae+A)}S=C+(S.length>0?" "+S:S)}return S},vv=(...o)=>{let i=0,r,c,d="";for(;i<o.length;)(r=o[i++])&&(c=Rp(r))&&(d&&(d+=" "),d+=c);return d},Rp=o=>{if(typeof o=="string")return o;let i,r="";for(let c=0;c<o.length;c++)o[c]&&(i=Rp(o[c]))&&(r&&(r+=" "),r+=i);return r},xv=(o,...i)=>{let r,c,d,h;const g=b=>{const S=i.reduce((v,C)=>C(v),o());return r=pv(S),c=r.cache.get,d=r.cache.set,h=m,m(b)},m=b=>{const S=c(b);if(S)return S;const v=yv(b,r);return d(b,v),v};return h=g,(...b)=>h(vv(...b))},Sv=[],Xt=o=>{const i=r=>r[o]||Sv;return i.isThemeGetter=!0,i},jp=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Mp=/^\((?:(\w[\w-]*):)?(.+)\)$/i,wv=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Cv=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Tv=/\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$/,Nv=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Ev=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Av=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,aa=o=>wv.test(o),Ge=o=>!!o&&!Number.isNaN(Number(o)),al=o=>!!o&&Number.isInteger(Number(o)),hu=o=>o.endsWith("%")&&Ge(o.slice(0,-1)),Ml=o=>Cv.test(o),_p=()=>!0,Rv=o=>Tv.test(o)&&!Nv.test(o),zu=()=>!1,jv=o=>Ev.test(o),Mv=o=>Av.test(o),_v=o=>!ie(o)&&!se(o),kv=o=>o.startsWith("@container")&&(o[10]==="/"&&o[11]!==void 0||o[11]==="s"&&o[16]!==void 0&&o.startsWith("-size/",10)||o[11]==="n"&&o[18]!==void 0&&o.startsWith("-normal/",10)),zv=o=>ia(o,Dp,zu),ie=o=>jp.test(o),Na=o=>ia(o,Op,Rv),Bm=o=>ia(o,Kv,Ge),Dv=o=>ia(o,Up,_p),Ov=o=>ia(o,Lp,zu),Hm=o=>ia(o,kp,zu),Lv=o=>ia(o,zp,Mv),Br=o=>ia(o,Bp,jv),se=o=>Mp.test(o),fs=o=>Ma(o,Op),Uv=o=>Ma(o,Lp),Ym=o=>Ma(o,kp),Bv=o=>Ma(o,Dp),Hv=o=>Ma(o,zp),Hr=o=>Ma(o,Bp,!0),Yv=o=>Ma(o,Up,!0),ia=(o,i,r)=>{const c=jp.exec(o);return c?c[1]?i(c[1]):r(c[2]):!1},Ma=(o,i,r=!1)=>{const c=Mp.exec(o);return c?c[1]?i(c[1]):r:!1},kp=o=>o==="position"||o==="percentage",zp=o=>o==="image"||o==="url",Dp=o=>o==="length"||o==="size"||o==="bg-size",Op=o=>o==="length",Kv=o=>o==="number",Lp=o=>o==="family-name",Up=o=>o==="number"||o==="weight",Bp=o=>o==="shadow",Gv=()=>{const o=Xt("color"),i=Xt("font"),r=Xt("text"),c=Xt("font-weight"),d=Xt("tracking"),h=Xt("leading"),g=Xt("breakpoint"),m=Xt("container"),b=Xt("spacing"),S=Xt("radius"),v=Xt("shadow"),C=Xt("inset-shadow"),B=Xt("text-shadow"),z=Xt("drop-shadow"),_=Xt("blur"),V=Xt("perspective"),k=Xt("aspect"),Z=Xt("ease"),$=Xt("animate"),Q=()=>["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"],Se=()=>[...ae(),se,ie],D=()=>["auto","hidden","clip","visible","scroll"],O=()=>["auto","contain","none"],A=()=>[se,ie,b],ee=()=>[aa,"full","auto",...A()],Ae=()=>[al,"none","subgrid",se,ie],Re=()=>["auto",{span:["full",al,se,ie]},al,se,ie],Ne=()=>[al,"auto",se,ie],de=()=>["auto","min","max","fr",se,ie],je=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Be=()=>["start","end","center","stretch","center-safe","end-safe"],j=()=>["auto",...A()],q=()=>[aa,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...A()],J=()=>[aa,"screen","full","dvw","lvw","svw","min","max","fit",...A()],we=()=>[aa,"screen","full","lh","dvh","lvh","svh","min","max","fit",...A()],H=()=>[o,se,ie],Ve=()=>[...ae(),Ym,Hm,{position:[se,ie]}],X=()=>["no-repeat",{repeat:["","x","y","space","round"]}],me=()=>["auto","cover","contain",Bv,zv,{size:[se,ie]}],_e=()=>[hu,fs,Na],ve=()=>["","none","full",S,se,ie],fe=()=>["",Ge,fs,Na],vt=()=>["solid","dashed","dotted","double"],Oe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Me=()=>[Ge,hu,Ym,Hm],Ie=()=>["","none",_,se,ie],pt=()=>["none",Ge,se,ie],xt=()=>["none",Ge,se,ie],Dt=()=>[Ge,se,ie],St=()=>[aa,"full",...A()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ml],breakpoint:[Ml],color:[_p],container:[Ml],"drop-shadow":[Ml],ease:["in","out","in-out"],font:[_v],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ml],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ml],shadow:[Ml],spacing:["px",Ge],text:[Ml],"text-shadow":[Ml],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",aa,ie,se,k]}],container:["container"],"container-type":[{"@container":["","normal","size",se,ie]}],"container-named":[kv],columns:[{columns:[Ge,ie,se,m]}],"break-after":[{"break-after":Q()}],"break-before":[{"break-before":Q()}],"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:Se()}],overflow:[{overflow:D()}],"overflow-x":[{"overflow-x":D()}],"overflow-y":[{"overflow-y":D()}],overscroll:[{overscroll:O()}],"overscroll-x":[{"overscroll-x":O()}],"overscroll-y":[{"overscroll-y":O()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:ee()}],"inset-x":[{"inset-x":ee()}],"inset-y":[{"inset-y":ee()}],start:[{"inset-s":ee(),start:ee()}],end:[{"inset-e":ee(),end:ee()}],"inset-bs":[{"inset-bs":ee()}],"inset-be":[{"inset-be":ee()}],top:[{top:ee()}],right:[{right:ee()}],bottom:[{bottom:ee()}],left:[{left:ee()}],visibility:["visible","invisible","collapse"],z:[{z:[al,"auto",se,ie]}],basis:[{basis:[aa,"full","auto",m,...A()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ge,aa,"auto","initial","none",ie]}],grow:[{grow:["",Ge,se,ie]}],shrink:[{shrink:["",Ge,se,ie]}],order:[{order:[al,"first","last","none",se,ie]}],"grid-cols":[{"grid-cols":Ae()}],"col-start-end":[{col:Re()}],"col-start":[{"col-start":Ne()}],"col-end":[{"col-end":Ne()}],"grid-rows":[{"grid-rows":Ae()}],"row-start-end":[{row:Re()}],"row-start":[{"row-start":Ne()}],"row-end":[{"row-end":Ne()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":de()}],"auto-rows":[{"auto-rows":de()}],gap:[{gap:A()}],"gap-x":[{"gap-x":A()}],"gap-y":[{"gap-y":A()}],"justify-content":[{justify:[...je(),"normal"]}],"justify-items":[{"justify-items":[...Be(),"normal"]}],"justify-self":[{"justify-self":["auto",...Be()]}],"align-content":[{content:["normal",...je()]}],"align-items":[{items:[...Be(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Be(),{baseline:["","last"]}]}],"place-content":[{"place-content":je()}],"place-items":[{"place-items":[...Be(),"baseline"]}],"place-self":[{"place-self":["auto",...Be()]}],p:[{p:A()}],px:[{px:A()}],py:[{py:A()}],ps:[{ps:A()}],pe:[{pe:A()}],pbs:[{pbs:A()}],pbe:[{pbe:A()}],pt:[{pt:A()}],pr:[{pr:A()}],pb:[{pb:A()}],pl:[{pl:A()}],m:[{m:j()}],mx:[{mx:j()}],my:[{my:j()}],ms:[{ms:j()}],me:[{me:j()}],mbs:[{mbs:j()}],mbe:[{mbe:j()}],mt:[{mt:j()}],mr:[{mr:j()}],mb:[{mb:j()}],ml:[{ml:j()}],"space-x":[{"space-x":A()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":A()}],"space-y-reverse":["space-y-reverse"],size:[{size:q()}],"inline-size":[{inline:["auto",...J()]}],"min-inline-size":[{"min-inline":["auto",...J()]}],"max-inline-size":[{"max-inline":["none",...J()]}],"block-size":[{block:["auto",...we()]}],"min-block-size":[{"min-block":["auto",...we()]}],"max-block-size":[{"max-block":["none",...we()]}],w:[{w:[m,"screen",...q()]}],"min-w":[{"min-w":[m,"screen","none",...q()]}],"max-w":[{"max-w":[m,"screen","none","prose",{screen:[g]},...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",r,fs,Na]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[c,Yv,Dv]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",hu,ie]}],"font-family":[{font:[Uv,Ov,i]}],"font-features":[{"font-features":[ie]}],"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:[d,se,ie]}],"line-clamp":[{"line-clamp":[Ge,"none",se,Bm]}],leading:[{leading:[h,...A()]}],"list-image":[{"list-image":["none",se,ie]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",se,ie]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:H()}],"text-color":[{text:H()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...vt(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ge,"from-font","auto",se,Na]}],"text-decoration-color":[{decoration:H()}],"underline-offset":[{"underline-offset":[Ge,"auto",se,ie]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:A()}],"tab-size":[{tab:[al,se,ie]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",se,ie]}],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",se,ie]}],"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:X()}],"bg-size":[{bg:me()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},al,se,ie],radial:["",se,ie],conic:[al,se,ie]},Hv,Lv]}],"bg-color":[{bg:H()}],"gradient-from-pos":[{from:_e()}],"gradient-via-pos":[{via:_e()}],"gradient-to-pos":[{to:_e()}],"gradient-from":[{from:H()}],"gradient-via":[{via:H()}],"gradient-to":[{to:H()}],rounded:[{rounded:ve()}],"rounded-s":[{"rounded-s":ve()}],"rounded-e":[{"rounded-e":ve()}],"rounded-t":[{"rounded-t":ve()}],"rounded-r":[{"rounded-r":ve()}],"rounded-b":[{"rounded-b":ve()}],"rounded-l":[{"rounded-l":ve()}],"rounded-ss":[{"rounded-ss":ve()}],"rounded-se":[{"rounded-se":ve()}],"rounded-ee":[{"rounded-ee":ve()}],"rounded-es":[{"rounded-es":ve()}],"rounded-tl":[{"rounded-tl":ve()}],"rounded-tr":[{"rounded-tr":ve()}],"rounded-br":[{"rounded-br":ve()}],"rounded-bl":[{"rounded-bl":ve()}],"border-w":[{border:fe()}],"border-w-x":[{"border-x":fe()}],"border-w-y":[{"border-y":fe()}],"border-w-s":[{"border-s":fe()}],"border-w-e":[{"border-e":fe()}],"border-w-bs":[{"border-bs":fe()}],"border-w-be":[{"border-be":fe()}],"border-w-t":[{"border-t":fe()}],"border-w-r":[{"border-r":fe()}],"border-w-b":[{"border-b":fe()}],"border-w-l":[{"border-l":fe()}],"divide-x":[{"divide-x":fe()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":fe()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...vt(),"hidden","none"]}],"divide-style":[{divide:[...vt(),"hidden","none"]}],"border-color":[{border:H()}],"border-color-x":[{"border-x":H()}],"border-color-y":[{"border-y":H()}],"border-color-s":[{"border-s":H()}],"border-color-e":[{"border-e":H()}],"border-color-bs":[{"border-bs":H()}],"border-color-be":[{"border-be":H()}],"border-color-t":[{"border-t":H()}],"border-color-r":[{"border-r":H()}],"border-color-b":[{"border-b":H()}],"border-color-l":[{"border-l":H()}],"divide-color":[{divide:H()}],"outline-style":[{outline:[...vt(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ge,se,ie]}],"outline-w":[{outline:["",Ge,fs,Na]}],"outline-color":[{outline:H()}],shadow:[{shadow:["","none",v,Hr,Br]}],"shadow-color":[{shadow:H()}],"inset-shadow":[{"inset-shadow":["none",C,Hr,Br]}],"inset-shadow-color":[{"inset-shadow":H()}],"ring-w":[{ring:fe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:H()}],"ring-offset-w":[{"ring-offset":[Ge,Na]}],"ring-offset-color":[{"ring-offset":H()}],"inset-ring-w":[{"inset-ring":fe()}],"inset-ring-color":[{"inset-ring":H()}],"text-shadow":[{"text-shadow":["none",B,Hr,Br]}],"text-shadow-color":[{"text-shadow":H()}],opacity:[{opacity:[Ge,se,ie]}],"mix-blend":[{"mix-blend":[...Oe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Oe()}],"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":[Ge]}],"mask-image-linear-from-pos":[{"mask-linear-from":Me()}],"mask-image-linear-to-pos":[{"mask-linear-to":Me()}],"mask-image-linear-from-color":[{"mask-linear-from":H()}],"mask-image-linear-to-color":[{"mask-linear-to":H()}],"mask-image-t-from-pos":[{"mask-t-from":Me()}],"mask-image-t-to-pos":[{"mask-t-to":Me()}],"mask-image-t-from-color":[{"mask-t-from":H()}],"mask-image-t-to-color":[{"mask-t-to":H()}],"mask-image-r-from-pos":[{"mask-r-from":Me()}],"mask-image-r-to-pos":[{"mask-r-to":Me()}],"mask-image-r-from-color":[{"mask-r-from":H()}],"mask-image-r-to-color":[{"mask-r-to":H()}],"mask-image-b-from-pos":[{"mask-b-from":Me()}],"mask-image-b-to-pos":[{"mask-b-to":Me()}],"mask-image-b-from-color":[{"mask-b-from":H()}],"mask-image-b-to-color":[{"mask-b-to":H()}],"mask-image-l-from-pos":[{"mask-l-from":Me()}],"mask-image-l-to-pos":[{"mask-l-to":Me()}],"mask-image-l-from-color":[{"mask-l-from":H()}],"mask-image-l-to-color":[{"mask-l-to":H()}],"mask-image-x-from-pos":[{"mask-x-from":Me()}],"mask-image-x-to-pos":[{"mask-x-to":Me()}],"mask-image-x-from-color":[{"mask-x-from":H()}],"mask-image-x-to-color":[{"mask-x-to":H()}],"mask-image-y-from-pos":[{"mask-y-from":Me()}],"mask-image-y-to-pos":[{"mask-y-to":Me()}],"mask-image-y-from-color":[{"mask-y-from":H()}],"mask-image-y-to-color":[{"mask-y-to":H()}],"mask-image-radial":[{"mask-radial":[se,ie]}],"mask-image-radial-from-pos":[{"mask-radial-from":Me()}],"mask-image-radial-to-pos":[{"mask-radial-to":Me()}],"mask-image-radial-from-color":[{"mask-radial-from":H()}],"mask-image-radial-to-color":[{"mask-radial-to":H()}],"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":[Ge]}],"mask-image-conic-from-pos":[{"mask-conic-from":Me()}],"mask-image-conic-to-pos":[{"mask-conic-to":Me()}],"mask-image-conic-from-color":[{"mask-conic-from":H()}],"mask-image-conic-to-color":[{"mask-conic-to":H()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Ve()}],"mask-repeat":[{mask:X()}],"mask-size":[{mask:me()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",se,ie]}],filter:[{filter:["","none",se,ie]}],blur:[{blur:Ie()}],brightness:[{brightness:[Ge,se,ie]}],contrast:[{contrast:[Ge,se,ie]}],"drop-shadow":[{"drop-shadow":["","none",z,Hr,Br]}],"drop-shadow-color":[{"drop-shadow":H()}],grayscale:[{grayscale:["",Ge,se,ie]}],"hue-rotate":[{"hue-rotate":[Ge,se,ie]}],invert:[{invert:["",Ge,se,ie]}],saturate:[{saturate:[Ge,se,ie]}],sepia:[{sepia:["",Ge,se,ie]}],"backdrop-filter":[{"backdrop-filter":["","none",se,ie]}],"backdrop-blur":[{"backdrop-blur":Ie()}],"backdrop-brightness":[{"backdrop-brightness":[Ge,se,ie]}],"backdrop-contrast":[{"backdrop-contrast":[Ge,se,ie]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ge,se,ie]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ge,se,ie]}],"backdrop-invert":[{"backdrop-invert":["",Ge,se,ie]}],"backdrop-opacity":[{"backdrop-opacity":[Ge,se,ie]}],"backdrop-saturate":[{"backdrop-saturate":[Ge,se,ie]}],"backdrop-sepia":[{"backdrop-sepia":["",Ge,se,ie]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":A()}],"border-spacing-x":[{"border-spacing-x":A()}],"border-spacing-y":[{"border-spacing-y":A()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",se,ie]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ge,"initial",se,ie]}],ease:[{ease:["linear","initial",Z,se,ie]}],delay:[{delay:[Ge,se,ie]}],animate:[{animate:["none",$,se,ie]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[V,se,ie]}],"perspective-origin":[{"perspective-origin":Se()}],rotate:[{rotate:pt()}],"rotate-x":[{"rotate-x":pt()}],"rotate-y":[{"rotate-y":pt()}],"rotate-z":[{"rotate-z":pt()}],scale:[{scale:xt()}],"scale-x":[{"scale-x":xt()}],"scale-y":[{"scale-y":xt()}],"scale-z":[{"scale-z":xt()}],"scale-3d":["scale-3d"],skew:[{skew:Dt()}],"skew-x":[{"skew-x":Dt()}],"skew-y":[{"skew-y":Dt()}],transform:[{transform:[se,ie,"","none","gpu","cpu"]}],"transform-origin":[{origin:Se()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:St()}],"translate-x":[{"translate-x":St()}],"translate-y":[{"translate-y":St()}],"translate-z":[{"translate-z":St()}],"translate-none":["translate-none"],zoom:[{zoom:[al,se,ie]}],accent:[{accent:H()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:H()}],"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",se,ie]}],"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":H()}],"scrollbar-track-color":[{"scrollbar-track":H()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":A()}],"scroll-mx":[{"scroll-mx":A()}],"scroll-my":[{"scroll-my":A()}],"scroll-ms":[{"scroll-ms":A()}],"scroll-me":[{"scroll-me":A()}],"scroll-mbs":[{"scroll-mbs":A()}],"scroll-mbe":[{"scroll-mbe":A()}],"scroll-mt":[{"scroll-mt":A()}],"scroll-mr":[{"scroll-mr":A()}],"scroll-mb":[{"scroll-mb":A()}],"scroll-ml":[{"scroll-ml":A()}],"scroll-p":[{"scroll-p":A()}],"scroll-px":[{"scroll-px":A()}],"scroll-py":[{"scroll-py":A()}],"scroll-ps":[{"scroll-ps":A()}],"scroll-pe":[{"scroll-pe":A()}],"scroll-pbs":[{"scroll-pbs":A()}],"scroll-pbe":[{"scroll-pbe":A()}],"scroll-pt":[{"scroll-pt":A()}],"scroll-pr":[{"scroll-pr":A()}],"scroll-pb":[{"scroll-pb":A()}],"scroll-pl":[{"scroll-pl":A()}],"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",se,ie]}],fill:[{fill:["none",...H()]}],"stroke-w":[{stroke:[Ge,fs,Na,Bm]}],stroke:[{stroke:["none",...H()]}],"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"]}},qv=xv(Gv);function W(...o){return qv(Py(o))}var Vv=sp();const qe={cursor:"▸",on:"●",off:"○",dot:"·",check:"✓",cross:"✗",warn:"!",arrowRight:"→",arrowLeft:"←",chevronDown:"▾",chevronRight:"▸",ellipsis:"…",meterFull:"█",meterEmpty:"░",tabDivider:"│"},Yn={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"}},Es={ok:Yn.ok.text,warn:Yn.warn.text,bad:Yn.bad.text,idle:Yn.idle.text,accent:Yn.accent.text,alt:Yn.alt.text,info:Yn.info.text},Gn=({level:o,className:i})=>u.jsx("span",{"aria-hidden":"true",className:W("select-none leading-none",Es[o],i),children:o==="idle"?qe.off:qe.on}),Hp=({className:o})=>u.jsx("span",{"aria-hidden":"true",className:W("select-none text-tui-faint",o),children:qe.dot}),sn=({title:o,aside:i,tone:r="accent",className:c,bodyClassName:d,children:h,...g})=>u.jsxs("fieldset",{className:W("tui-panel tui-block relative min-w-0 border border-tui-border bg-tui-base",o?"px-3 pb-3 pt-1":"p-3",c),...g,children:[o?u.jsx("legend",{className:W("flex items-center gap-2 text-tui font-bold",Es[r]),children:u.jsx("span",{children:o})}):null,i?u.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,u.jsx("div",{className:W("min-w-0",d),children:h})]}),Jn=({label:o,labelWidth:i=16,className:r,children:c})=>u.jsxs("div",{className:W("flex items-baseline gap-2 text-tui",r),children:[u.jsx("span",{className:"shrink-0 truncate text-tui-muted",style:{width:`${i}ch`},title:typeof o=="string"?o:void 0,children:o}),u.jsx("span",{className:"min-w-0 flex-1 text-tui-text",children:c})]}),Aa=({className:o,label:i})=>i?u.jsxs("div",{className:W("flex items-center gap-2",o),children:[u.jsx("span",{className:"h-px w-3 bg-tui-border-dim","aria-hidden":"true"}),u.jsx("span",{className:"text-tui-sm text-tui-faint",children:i}),u.jsx("span",{className:"h-px flex-1 bg-tui-border-dim","aria-hidden":"true"})]}):u.jsx("div",{className:W("h-px w-full bg-tui-border-dim",o),"aria-hidden":"true"}),Xv={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"},Ye=({variant:o="default",brackets:i=!0,glyph:r,block:c=!1,className:d,children:h,type:g="button",...m})=>u.jsxs("button",{type:g,className:W("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",Xv[o],c&&"w-full",d),...m,children:[i?u.jsx("span",{"aria-hidden":"true",className:"opacity-60",children:"["}):null,r?u.jsx("span",{"aria-hidden":"true",className:"leading-none",children:r}):null,u.jsx("span",{className:"truncate",children:h}),i?u.jsx("span",{"aria-hidden":"true",className:"opacity-60",children:"]"}):null]}),Wr=({tone:o="accent",dot:i=!1,className:r,children:c})=>u.jsxs("span",{className:W("inline-flex select-none items-center gap-1 whitespace-nowrap text-tui font-bold uppercase",Es[o],r),children:[i?u.jsx(Gn,{level:o}):null,c]}),Du=({tabs:o,activeId:i,onSelect:r,ariaLabel:c,className:d,labelClassName:h})=>u.jsx("nav",{className:W("flex items-center gap-2",d),"aria-label":c,children:o.map((g,m)=>{const b=g.id===i;return u.jsxs(il.Fragment,{children:[m>0?u.jsx("span",{"aria-hidden":"true",className:"select-none text-tui-border",children:qe.tabDivider}):null,u.jsxs("button",{type:"button",onClick:()=>r(g.id),"aria-current":b?"page":void 0,"aria-label":g.ariaLabel??g.label,title:g.title,className:W("tui-focusable select-none whitespace-nowrap border-b px-0.5 pb-0.5 text-tui transition-colors",b?"border-tui-accent font-bold text-tui-accent":"border-transparent text-tui-muted hover:border-tui-border-bright hover:text-tui-text"),children:[g.index!==void 0?u.jsx("span",{"aria-hidden":"true",className:W("text-tui-faint",b&&"text-tui-accent"),children:g.index}):null,u.jsx("span",{"aria-hidden":"true",className:W("ml-1",h),children:g.label})]})]},g.id)})}),Yp=({hints:o,className:i})=>u.jsx("div",{className:W("flex flex-wrap items-center gap-x-3 gap-y-0.5 text-tui-sm text-tui-faint",i),children:o.map((r,c)=>u.jsxs("span",{className:"flex items-center gap-1",children:[u.jsx("kbd",{className:"border border-tui-border-dim px-1 not-italic text-tui-muted",children:r.keys}),u.jsx("span",{children:r.action})]},`${r.keys}-${c}`))}),An=({htmlFor:o,hint:i,className:r,children:c})=>u.jsxs("label",{htmlFor:o,className:W("block text-tui-sm font-bold text-tui-muted",r),children:[c,i?u.jsx("span",{className:"ml-2 font-normal text-tui-faint",children:i}):null]}),Kn=il.forwardRef(({className:o,...i},r)=>u.jsx("input",{ref:r,className:W("tui-input w-full px-2 py-1 text-tui",o),...i}));Kn.displayName="Input";const Ou=il.forwardRef(({className:o,children:i,...r},c)=>u.jsx("select",{ref:c,className:W("tui-input w-full px-2 py-1 text-tui",o),...r,children:i}));Ou.displayName="Select";const Nu=({checked:o,onChange:i,disabled:r=!1,label:c,description:d,className:h,id:g})=>u.jsxs("label",{className:W("group flex cursor-pointer select-none items-start gap-2 py-0.5 text-tui",r&&"cursor-not-allowed opacity-60",h),children:[u.jsx("input",{id:g,type:"checkbox",className:"sr-only",checked:o,disabled:r,onChange:m=>i(m.target.checked)}),u.jsx("span",{"aria-hidden":"true",className:W("mt-px shrink-0 font-bold leading-tight",o?"text-tui-ok":"text-tui-faint",!r&&"group-hover:text-tui-accent"),children:o?"[x]":"[ ]"}),u.jsxs("span",{className:"min-w-0 flex-1",children:[u.jsx("span",{className:W("block",o?"text-tui-text":"text-tui-muted"),children:c}),d?u.jsx("span",{className:"mt-0.5 block text-tui-sm leading-snug text-tui-faint",children:d}):null]})]}),hs=({checked:o,onChange:i,name:r,disabled:c=!1,label:d,description:h,className:g})=>u.jsxs("label",{className:W("group flex cursor-pointer select-none items-start gap-2 py-0.5 text-tui",c&&"cursor-not-allowed opacity-60",g),children:[u.jsx("input",{type:"radio",name:r,className:"sr-only",checked:o,disabled:c,onChange:i}),u.jsx("span",{"aria-hidden":"true",className:W("mt-px shrink-0 font-bold leading-tight",o?"text-tui-accent":"text-tui-faint",!c&&"group-hover:text-tui-accent"),children:o?"(•)":"( )"}),u.jsxs("span",{className:"min-w-0 flex-1",children:[u.jsx("span",{className:W("block",o?"text-tui-text":"text-tui-muted"),children:d}),h?u.jsx("span",{className:"mt-0.5 block text-tui-sm leading-snug text-tui-faint",children:h}):null]})]}),Fv=({value:o,width:i=20,tone:r="accent",className:c})=>{const d=Number.isFinite(o)?Math.min(1,Math.max(0,o)):0,h=Math.round(d*i);return u.jsxs("span",{className:W("inline-flex select-none whitespace-pre font-mono leading-none",c),role:"presentation",children:[u.jsx("span",{className:Es[r],children:qe.meterFull.repeat(h)}),u.jsx("span",{className:"text-tui-border",children:qe.meterEmpty.repeat(Math.max(0,i-h))})]})},Zv={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"},Qv=({ratio:o,label:i,tone:r="accent",className:c,...d})=>{const h=Number.isFinite(o)?Math.min(1,Math.max(0,o)):0;return u.jsxs("div",{className:W("relative h-[var(--tui-row)] w-full overflow-hidden border border-tui-border bg-tui-mantle",c),role:"progressbar","aria-valuenow":Math.round(h*100),"aria-valuemin":0,"aria-valuemax":100,...d,children:[u.jsx("div",{className:W("absolute inset-y-0 left-0",Zv[r]),style:{width:`${h*100}%`},"aria-hidden":"true"}),i!==void 0?u.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 Lu({columns:o,items:i,rowKey:r,empty:c,className:d}){return i.length===0?u.jsx("div",{className:W("px-1 py-4 text-center text-tui text-tui-faint",d),children:c}):u.jsx("div",{className:W("w-full overflow-x-auto",d),children:u.jsxs("table",{className:"w-full border-collapse text-tui",children:[u.jsx("thead",{children:u.jsx("tr",{className:"border-b border-tui-border",children:o.map(h=>u.jsx("th",{scope:"col",style:h.width?{width:`${h.width}ch`}:void 0,className:W("whitespace-nowrap px-2 py-1 text-tui-sm font-bold text-tui-muted",h.align==="right"?"text-right":"text-left",h.className),children:h.header},h.key))})}),u.jsx("tbody",{children:i.map((h,g)=>u.jsx("tr",{className:"border-b border-tui-border-dim last:border-b-0 hover:bg-tui-selection",children:o.map(m=>u.jsx("td",{className:W("px-2 py-1 align-top text-tui-text",m.align==="right"?"text-right":"text-left",m.className),children:m.render(h,g)},m.key))},r(h,g)))})]})})}const Uu=({isOpen:o,onClose:i,title:r,subtitle:c,closeLabel:d,footer:h,hints:g,size:m="md",className:b,children:S})=>{if(!o)return null;const v=m==="sm"?"max-w-md":m==="lg"?"max-w-3xl":"max-w-xl",C=`tui-modal-${r.replace(/\s+/g,"-").toLowerCase()}`,B=u.jsx("div",{className:"fixed inset-0 inset-x-0 z-50 grid place-items-center overflow-y-auto bg-tui-crust/85 p-3 sm:p-6",style:{height:"var(--app-height, 100dvh)",width:"100vw"},role:"dialog","aria-modal":"true","aria-labelledby":C,onMouseDown:z=>{z.target===z.currentTarget&&i()},children:u.jsxs("div",{className:W("flex w-full flex-col border border-tui-border bg-tui-base",v,b),style:{maxHeight:"calc(var(--app-height, 100dvh) - 1.5rem)"},children:[u.jsxs("header",{className:"flex shrink-0 items-center gap-2 border-b border-tui-border bg-tui-mantle px-3 py-1.5",children:[u.jsx("h2",{id:C,className:"truncate text-tui font-bold text-tui-accent",children:r}),c?u.jsx("span",{className:"min-w-0 flex-1 truncate text-tui-sm text-tui-faint",children:c}):u.jsx("span",{className:"flex-1"}),u.jsx(Ye,{variant:"ghost",onClick:i,"aria-label":d,title:d,children:"esc"})]}),u.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 py-3",children:S}),h||g?u.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:[g?u.jsx(Yp,{hints:g}):u.jsx("span",{}),h?u.jsx("div",{className:"flex items-center gap-2",children:h}):null]}):null]})});return typeof document>"u"?B:Vv.createPortal(B,document.body)},Vr=({tone:o="accent",className:i,children:r,action:c})=>{const d=o==="ok"?qe.check:o==="bad"?qe.cross:o==="warn"?qe.warn:"›",h=Yn[o].edgeL;return u.jsxs("div",{className:W("flex items-start gap-2 border border-tui-border-dim border-l-2 bg-tui-mantle px-2 py-1.5 text-tui",h,i),children:[u.jsx("span",{"aria-hidden":"true",className:W("shrink-0 font-bold",Es[o]),children:d}),u.jsx("div",{className:"min-w-0 flex-1 leading-snug text-tui-text",children:r}),c?u.jsx("div",{className:"shrink-0",children:c}):null]})},Iv=({active:o=!1,className:i,children:r})=>u.jsx("span",{className:W("inline-flex min-w-[2ch] select-none items-center justify-center border px-1 text-tui",o?"border-tui-accent bg-tui-accent text-tui-crust":"border-tui-border bg-tui-surface text-tui-muted",i),children:r}),Km=({items:o,className:i})=>{const r=o.filter(Boolean);return u.jsx("span",{className:W("flex min-w-0 items-center gap-1.5",i),children:r.map((c,d)=>u.jsxs(il.Fragment,{children:[d>0?u.jsx(Hp,{className:"shrink-0"}):null,c]},d))})},Kp=({left:o,right:i,className:r})=>u.jsxs("footer",{className:W("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",r),children:[u.jsx("div",{className:"flex min-w-0 items-center gap-1.5 text-tui-muted",children:o}),u.jsx("div",{className:"flex shrink-0 items-center gap-3",children:i})]}),Jv=({name:o,tagline:i,aside:r,tabs:c,activeTabId:d,onSelectTab:h,tabsAriaLabel:g,hints:m,footerAside:b,bodyClassName:S,className:v,children:C})=>u.jsxs("div",{className:W("flex h-full min-h-0 w-full flex-col bg-tui-crust",v),children:[u.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:[u.jsxs("span",{className:"flex min-w-0 items-baseline gap-2",children:[u.jsx("span",{className:"shrink-0 font-bold text-tui-accent",children:o}),i?u.jsx("span",{className:"hidden truncate text-tui-sm text-tui-faint sm:block",children:i}):null]}),r?u.jsx("span",{className:"flex shrink-0 items-center gap-2",children:r}):null]}),c&&c.length>0&&d!==void 0&&h?u.jsx("div",{className:"scrollbar-none shrink-0 overflow-x-auto border-b border-tui-border bg-tui-mantle px-2",children:u.jsx(Du,{tabs:c,activeId:d,onSelect:h,ariaLabel:g,className:"gap-3"})}):null,u.jsx("div",{className:W("min-h-0 flex-1 overflow-y-auto p-2",S),children:C}),m||b?u.jsx(Kp,{left:m?u.jsx(Yp,{hints:m}):null,right:b}):null]}),Gm=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],yi=({className:o,label:i})=>{const[r,c]=il.useState(0);return il.useEffect(()=>{const d=setInterval(()=>c(h=>(h+1)%Gm.length),90);return()=>clearInterval(d)},[]),u.jsxs("span",{className:W("inline-flex items-center gap-1.5",o),role:"status",children:[u.jsx("span",{"aria-hidden":"true",className:"text-tui-accent",children:Gm[r]}),i?u.jsx("span",{children:i}):null]})},Yr="tui-focusable select-none border border-transparent px-1.5 text-tui uppercase transition-colors",Kr="text-tui-muted hover:border-tui-border hover:text-tui-accent",Wv="border-tui-accent bg-tui-accent text-tui-crust",Pv=({currentView:o,onNavigate:i,showAdminEntry:r=!0,onOpenPairing:c,onOpenSettings:d,onToggleVirtualKeyboard:h,isVirtualKeyboardOpen:g})=>{const{addToast:m,language:b,setLanguage:S,t:v}=Tt(),C=()=>{const z=b==="zh"?"en":"zh";S(z),m("info",_u(z,"toasts.switchedLanguage",{lang:z==="zh"?"简体中文":"English"}))},B=[{id:"terminal",label:v("header.terminalTab"),index:1,ariaLabel:v("header.terminalTab")},...r||o==="admin"?[{id:"admin",label:v("header.adminTab"),index:2,ariaLabel:v("header.adminTab")}]:[]];return u.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:u.jsxs("div",{className:"scrollbar-none flex min-h-[var(--tui-row)] items-center gap-2 overflow-x-auto text-tui",children:[u.jsxs("span",{className:"flex shrink-0 items-baseline gap-2",children:[u.jsx("span",{className:"font-bold text-tui-accent",children:"herdr-remote"}),u.jsx("span",{className:"hidden text-tui-sm text-tui-faint sm:inline",children:v("header.tagline")})]}),u.jsx("span",{"aria-hidden":"true",className:"h-4 w-px shrink-0 bg-tui-border"}),u.jsx(Du,{tabs:B,activeId:o,onSelect:z=>i(z),ariaLabel:v("header.mainNavigationAria"),className:"shrink-0 gap-3"}),u.jsx("span",{"aria-hidden":"true",className:"h-4 w-px shrink-0 bg-tui-border"}),u.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[u.jsx("button",{type:"button",onClick:C,className:W(Yr,Kr),title:v("header.languageToggleTitle"),"aria-label":v("header.languageToggleTitle"),children:v("header.languageShort")}),o==="terminal"&&u.jsx("button",{type:"button",onClick:h,className:W(Yr,g?Wv:Kr),title:v("header.virtualKeyboardTitle"),"aria-label":v("header.virtualKeyboardTitle"),children:v("header.actionKeyboard")}),u.jsx("button",{type:"button",onClick:c,className:W(Yr,Kr),title:v("header.pairingTitle"),"aria-label":v("header.pairingTitle"),children:v("header.actionPairing")}),u.jsx("button",{type:"button",onClick:d,className:W(Yr,Kr),title:v("header.settingsTitle"),"aria-label":v("header.settingsTitle"),children:v("header.actionSettings")})]})]})})},Gr=({tone:o,glyph:i,message:r,assertive:c=!1,action:d})=>u.jsxs("aside",{className:W("flex w-full items-center justify-between gap-3 border-b bg-tui-mantle px-2 py-0.5 text-tui sm:px-3",Yn[o].edgeB),"aria-live":c?"assertive":"polite",children:[u.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[u.jsx("span",{"aria-hidden":"true",className:W("shrink-0",Yn[o].text),children:i}),u.jsx("span",{className:"truncate text-tui-text",children:r})]}),d]}),$v=()=>{const{connectionState:o,stateDetail:i,connect:r,settings:c,t:d}=Tt();return o==="connected"||!c.token&&!c.pairCode&&o==="disconnected"?null:o==="connecting"?u.jsx(Gr,{tone:"accent",glyph:u.jsx(yi,{}),message:d("statusBanner.connecting")}):o==="reconnecting"?u.jsx(Gr,{tone:"warn",glyph:u.jsx(yi,{}),assertive:!0,message:i||d("statusBanner.reconnectingDefault"),action:u.jsx(Ye,{variant:"warn",onClick:()=>r(),className:"shrink-0",children:d("statusBanner.reconnectNow")})}):o==="error"?u.jsx(Gr,{tone:"bad",glyph:qe.cross,assertive:!0,message:i||d("statusBanner.errorDefault"),action:u.jsx(Ye,{variant:"danger",onClick:()=>r(),className:"shrink-0",children:d("common.retry")})}):o==="disconnected"?u.jsx(Gr,{tone:"idle",glyph:qe.off,message:d("statusBanner.disconnected"),action:u.jsx(Ye,{variant:"primary",onClick:()=>r(),className:"shrink-0",children:d("common.connect")})}):null};var ex=ny(),tx=ly();const nx=20,lx=6,ax=500,ix=300,vi=13,Gp=.602,qp=1.3;function _l(o,i){return Number.isFinite(o)&&o>0?o:i}function qm(o,i,r){return Math.min(r,Math.max(i,o))}function Vm(o){const{width:i,height:r,cellWidth:c,cellHeight:d,minCols:h=nx,minRows:g=lx,maxCols:m=ax,maxRows:b=ix}=o,S=_l(c,vi*Gp),v=_l(d,vi*qp);return{cols:qm(Math.floor(_l(i,0)/S),h,m),rows:qm(Math.floor(_l(r,0)/v),g,b)}}function Ra(o,i=vi){var c,d,h;if(o)try{const g=o._core,m=(h=(d=(c=g==null?void 0:g._renderService)==null?void 0:c.dimensions)==null?void 0:d.css)==null?void 0:h.cell;if(m&&m.width&&m.width>0&&m.height&&m.height>0)return{cellWidth:m.width,cellHeight:m.height,measured:!0}}catch{}const r=_l(i,vi);return{cellWidth:Math.round(r*Gp*100)/100,cellHeight:Math.round(r*qp*100)/100,measured:!1}}function sx(o){var c;const i=(c=o==null?void 0:o.querySelector)==null?void 0:c.call(o,".xterm-viewport");if(!i)return 0;const r=(i.offsetWidth||0)-(i.clientWidth||0);return Number.isFinite(r)&&r>0?r:0}function mu(o,i,r){if(!o)return{width:i,height:r};let c=0,d=0;if(typeof o.getBoundingClientRect=="function"){const h=o.getBoundingClientRect();c=(h==null?void 0:h.width)||0,d=(h==null?void 0:h.height)||0}return{width:_l(c,_l(o.clientWidth,i)),height:_l(d,_l(o.clientHeight,r))}}function Vp(o,i,r,c){const d=Number.isFinite(c)&&c>.01?c:1;return{clientX:r.left+(o-r.left)/d,clientY:r.top+(i-r.top)/d}}function ms(o){var i,r;if(!o)return!1;try{const c=o.modes;if(c&&typeof c.mouseTrackingMode=="string"&&c.mouseTrackingMode!=="none")return!0;const d=o._core;if((i=d==null?void 0:d._coreMouseService)!=null&&i.areMouseEventsActive||(r=d==null?void 0:d.coreMouseService)!=null&&r.areMouseEventsActive||d!=null&&d.mouseMode&&d.mouseMode!=="none")return!0}catch{}return!1}function rx(o,i){const r=i.button??0,c=i.buttons??(o==="mouseup"?0:1);return new MouseEvent(o,{bubbles:!0,cancelable:!0,clientX:i.clientX,clientY:i.clientY,screenX:i.clientX,screenY:i.clientY,button:r,buttons:c})}function Xm(o,i,r){const c=rx(i,r);return o.dispatchEvent(c)}class ox{constructor(i){De(this,"options");De(this,"state","idle");De(this,"startX",0);De(this,"startY",0);De(this,"lastX",0);De(this,"lastY",0);De(this,"activeTarget",null);De(this,"longPressTimer",null);De(this,"capturedPointerId",null);De(this,"captureElement",null);De(this,"scrollRemainderY",0);this.options={longPressDelayMs:500,dragThresholdPx:8,scrollLineHeightPx:18,...i}}getState(){return this.state}setGestureState(i){var r,c;this.state!==i&&(this.state=i,(c=(r=this.options).onGestureStateChange)==null||c.call(r,i))}getActiveBuffer(i){var r;try{return((r=i.buffer)==null?void 0:r.active)||null}catch{return null}}getViewportY(i){var c;const r=(c=this.getActiveBuffer(i))==null?void 0:c.viewportY;return typeof r=="number"&&Number.isFinite(r)?r:null}blurTerminal(i){var r;try{(r=i.blur)==null||r.call(i)}catch{}}getLogicalCoordinates(i,r){const c=this.options.getScale?this.options.getScale():1,d=this.options.getSurfaceElement?this.options.getSurfaceElement():null;if(c!==1&&d&&typeof d.getBoundingClientRect=="function"){const h=d.getBoundingClientRect();return Vp(i,r,h,c)}return{clientX:i,clientY:r}}getViewportElement(i){var d;const r=this.options.getSurfaceElement?this.options.getSurfaceElement():null;return(r==null?void 0:r.querySelector(".xterm-viewport"))||((d=i.element)==null?void 0:d.querySelector(".xterm-viewport"))||null}isInputLineHit(i,r){var $;const c=($=r.buffer)==null?void 0:$.active,d=this.options.getSurfaceElement?this.options.getSurfaceElement():null,h=(d==null?void 0:d.querySelector(".xterm-screen"))||r.element||d,g=Ra(r);if(!h||typeof h.getBoundingClientRect!="function"||g.cellHeight<=0)return!1;const m=h.getBoundingClientRect(),b=this.getLogicalCoordinates(i.clientX,i.clientY),S=m.width>0&&m.height>0;if(![c==null?void 0:c.cursorY,c==null?void 0:c.viewportY,c==null?void 0:c.baseY].every(Q=>typeof Q=="number"&&Number.isFinite(Q)))return!1;const C=c==null?void 0:c.cursorY,B=c==null?void 0:c.viewportY,_=(c==null?void 0:c.baseY)+C-B,V=m.top+_*g.cellHeight,k=V+g.cellHeight,Z=Number(r.rows);return _>=0&&(!Number.isFinite(Z)||_<Z)&&b.clientY>=V-2&&b.clientY<=k+2&&(!S||b.clientX>=m.left&&b.clientX<=m.right)}resolveDispatchTarget(i,r){var m;const c=this.options.getSurfaceElement?this.options.getSurfaceElement():null,d=(c==null?void 0:c.querySelector(".xterm-screen"))||r.querySelector(".xterm-screen")||null,h=((m=d==null?void 0:d.closest)==null?void 0:m.call(d,".xterm"))||null;let g=null;return typeof document<"u"&&typeof document.elementFromPoint=="function"&&(g=document.elementFromPoint(i.clientX,i.clientY)),g&&h&&(g===h||h.contains(g))?g:d||c||r}getMouseReport(i,r){const c=this.options.getSurfaceElement?this.options.getSurfaceElement():null,d=(c==null?void 0:c.querySelector(".xterm-screen"))||r.element;if(!d||typeof d.getBoundingClientRect!="function")return null;const h=d.getBoundingClientRect(),g=this.getLogicalCoordinates(i.clientX,i.clientY),m=Ra(r);if(m.cellWidth<=0||m.cellHeight<=0)return null;const b=Math.max(1,h.width||r.cols*m.cellWidth),S=Math.max(1,h.height||r.rows*m.cellHeight),v=Math.max(0,Math.min(b-1,g.clientX-h.left)),C=Math.max(0,Math.min(S-1,g.clientY-h.top)),B=Math.max(0,Math.min(r.cols-1,Math.floor(v/m.cellWidth))),z=Math.max(0,Math.min(r.rows-1,Math.floor(C/m.cellHeight)));return{col:B,row:z,x:Math.floor(v),y:Math.floor(C),button:0,action:0}}getCoreMouseService(i){var c,d;const r=i;return r.coreMouseService||((c=r._core)==null?void 0:c.coreMouseService)||((d=r._core)==null?void 0:d._coreMouseService)||null}getCoreService(i){var c;const r=i;return r.coreService||((c=r._core)==null?void 0:c.coreService)||null}getWheelDispatchTarget(i){const r=this.options.getSurfaceElement?this.options.getSurfaceElement():null;return(r==null?void 0:r.querySelector(".xterm"))||i.element||null}dispatchWheel(i,r,c,d){const h=this.getWheelDispatchTarget(c);if(!h||typeof WheelEvent>"u"||r===0)return!1;const g=this.getLogicalCoordinates(i.clientX,i.clientY),m=r<0?-1:1;let b=0;for(let S=0;S<Math.abs(r);S+=1)try{const v=new WheelEvent("wheel",{bubbles:!0,cancelable:!0,clientX:g.clientX,clientY:g.clientY,deltaX:0,deltaY:m,deltaMode:1,ctrlKey:!!(d!=null&&d.ctrlKey),altKey:!!(d!=null&&d.altKey),shiftKey:!!(d!=null&&d.shiftKey)});h.dispatchEvent(v),b+=1}catch{return b>0}return b>0}emitWheel(i,r,c,d){if(r===0)return!1;if(this.dispatchWheel(i,r,c,d))return!0;const h=this.getCoreMouseService(c);if(!(h!=null&&h.triggerMouseEvent))return!1;let g=0;for(let m=0;m<Math.abs(r);m+=1){const b=this.getMouseReport(i,c);b&&(b.button=4,b.action=r<0?0:1,b.ctrl=!!(d!=null&&d.ctrlKey),b.alt=!!(d!=null&&d.altKey),b.shift=!!(d!=null&&d.shiftKey),h.triggerMouseEvent(b)&&(g+=1))}return g>0}scrollAlternateBuffer(i,r,c,d){var g;if(r===0)return"none";const h=ms(c);if(!h&&!this.options.getIsController())return"none";if(this.emitWheel(i,r,c,d))return h?"application-mouse":"application-keys";if(!h){const m=this.getCoreService(c);if(!(m!=null&&m.triggerDataEvent))return"none";const S=`\x1B${!!((g=m.decPrivateModes)!=null&&g.applicationCursorKeys)?"O":"["}${r<0?"A":"B"}`;return m.triggerDataEvent(S.repeat(Math.abs(r)),!0),"application-keys"}return"none"}emitMouse(i,r,c){const d=this.options.getTerminal();if(!d)return;const h=this.getCoreMouseService(d);if(h!=null&&h.triggerMouseEvent){const m=this.getMouseReport(r,d);m&&(m.action=i==="mousedown"?1:i==="mouseup"?0:32,m.ctrl=!!(c!=null&&c.ctrlKey),m.alt=!!(c!=null&&c.altKey),m.shift=!!(c!=null&&c.shiftKey),h.triggerMouseEvent(m));return}if(this.options.allowSyntheticMouseFallback===!1||!this.activeTarget)return;const g=this.getLogicalCoordinates(r.clientX,r.clientY);Xm(this.activeTarget,i,{clientX:g.clientX,clientY:g.clientY,button:0,buttons:i==="mouseup"?0:1})}beginGesture(i,r){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,r),this.clearLongPressTimer(),this.longPressTimer=setTimeout(()=>{var c,d;this.state==="pending"&&(this.setGestureState("longpress"),(d=(c=this.options).onLongPress)==null||d.call(c,{clientX:this.startX,clientY:this.startY}))},this.options.longPressDelayMs)}moveGesture(i,r){var S,v,C,B;if(this.state==="longpress"){(v=(S=this.options).onSelectionExtend)==null||v.call(S,{clientX:i.clientX,clientY:i.clientY}),r!=null&&r.cancelable&&((C=r.preventDefault)==null||C.call(r));return}if(this.state==="idle")return;const c=i.clientX-this.startX,d=i.clientY-this.startY,h=Math.hypot(c,d);if(this.state==="scrolling"){this.scrollGesture(i,r);return}const g=this.options.getTerminal(),m=this.options.getIsController(),b=ms(g);if(!(h<=(this.options.dragThresholdPx||8))){if(this.clearLongPressTimer(),Math.abs(d)>=Math.abs(c)||!b||!m){this.setGestureState("scrolling"),g&&this.blurTerminal(g),this.lastX=i.clientX,this.lastY=this.startY,this.scrollRemainderY=0,this.scrollGesture(i,r);return}if(b&&m){this.state==="pending"&&(this.setGestureState("dragging"),this.emitMouse("mousedown",{clientX:this.startX,clientY:this.startY},r)),this.state==="dragging"&&(this.lastX=i.clientX,this.lastY=i.clientY,this.emitMouse("mousemove",i,r),r!=null&&r.cancelable&&((B=r.preventDefault)==null||B.call(r)));return}this.lastX=i.clientX,this.lastY=i.clientY}}scrollGesture(i,r){var _,V,k;const c=this.options.getTerminal();if(!c)return;const d=i.clientY-this.lastY;this.lastX=i.clientX,this.lastY=i.clientY;const h=Ra(c),g=h.measured?h.cellHeight:this.options.scrollLineHeightPx||h.cellHeight||18;this.scrollRemainderY+=d;const m=Math.trunc(this.scrollRemainderY/g),b=-m;let S=!1,v="none";const C=this.getActiveBuffer(c),B=ms(c);if(b!==0){if((C==null?void 0:C.type)==="alternate")v=this.scrollAlternateBuffer(i,b,c,r),S=v!=="none";else{const Z=this.getViewportY(c);c.scrollLines(b);const $=this.getViewportY(c);v="buffer",S=Z===null||$===null||Z!==$}this.scrollRemainderY-=m*g}const z=this.getViewportElement(c);(V=(_=this.options).onGestureScroll)==null||V.call(_,{deltaY:d,lines:b,viewportY:this.getViewportY(c),scrollTop:(z==null?void 0:z.scrollTop)??null,scrollHeight:(z==null?void 0:z.scrollHeight)??null,clientHeight:(z==null?void 0:z.clientHeight)??null,moved:S,bufferType:(C==null?void 0:C.type)||null,baseY:typeof(C==null?void 0:C.baseY)=="number"?C.baseY:null,cursorY:typeof(C==null?void 0:C.cursorY)=="number"?C.cursorY:null,hasScrollback:typeof(C==null?void 0:C.hasScrollback)=="boolean"?C.hasScrollback:null,mouseTracking:B,scrollMode:v}),r!=null&&r.cancelable&&((k=r.preventDefault)==null||k.call(r))}endGesture(i,r){var g,m,b;this.clearLongPressTimer();const c=this.options.getTerminal(),d=this.options.getIsController(),h=ms(c);if(this.state==="pending"){if(h&&d){const v={clientX:this.startX,clientY:this.startY};this.emitMouse("mousedown",v,r),this.emitMouse("mouseup",v,r)}const S={clientX:this.startX,clientY:this.startY};d&&c&&this.isInputLineHit(S,c)&&((m=(g=this.options).onFocus)==null||m.call(g))}else if(this.state==="dragging"&&h&&d){const S=i??{clientX:this.lastX,clientY:this.lastY};this.emitMouse("mouseup",S,r),r!=null&&r.cancelable&&((b=r.preventDefault)==null||b.call(r))}this.reset()}handlePointerDown(i,r){if(i.pointerType==="mouse")return!1;if(!i.isPrimary)return this.releasePointerCapture(),this.reset(),!1;if(i.cancelable&&i.preventDefault(),this.beginGesture(i,r),i.pointerType!=="touch")try{typeof r.setPointerCapture=="function"&&(r.setPointerCapture(i.pointerId),this.capturedPointerId=i.pointerId,this.captureElement=r)}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,r){if(i.touches.length!==1){this.reset();return}i.cancelable&&i.preventDefault(),this.beginGesture(i.touches[0],r)}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(),r=this.options.getIsController(),c=ms(i);if(this.state==="dragging"&&c&&r&&this.activeTarget){const d=this.getLogicalCoordinates(this.lastX,this.lastY);Xm(this.activeTarget,"mouseup",{clientX:d.clientX,clientY:d.clientY,button:0,buttons:0})}this.reset()}releasePointerCapture(){const i=this.captureElement,r=this.capturedPointerId;if(this.captureElement=null,this.capturedPointerId=null,!(!i||r===null))try{typeof i.releasePointerCapture=="function"&&(typeof i.hasPointerCapture!="function"||i.hasPointerCapture(r))&&i.releasePointerCapture(r)}catch{}}clearLongPressTimer(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressTimer=null)}reset(){this.clearLongPressTimer(),this.releasePointerCapture(),this.setGestureState("idle"),this.activeTarget=null}}var pu=ay(),cx=iy();const Cs="herdr_remote_renderer_probe_v1",qr=1,ux=720*60*60*1e3,Eu={};function Xp(){let o=null;if(typeof window>"u")o=Eu[Cs]||null;else try{o=window.localStorage?window.localStorage.getItem(Cs):null}catch{o=Eu[Cs]||null}if(!o)return{v:qr,ua:{}};try{const i=JSON.parse(o);return typeof i=="object"&&i!==null&&i.v===qr&&typeof i.ua=="object"&&i.ua!==null?i:{v:qr,ua:{}}}catch{return{v:qr,ua:{}}}}function dx(o,i=Date.now()){var d;const r=Xp();r.ua[o]={failedAt:i};const c=JSON.stringify(r);if(Eu[Cs]=c,typeof window<"u")try{(d=window.localStorage)==null||d.setItem(Cs,c)}catch(h){console.warn("Failed to write renderer probe result to localStorage:",h)}}function fx(o,i=Date.now()){const r=typeof navigator<"u"?navigator.userAgent:"";if(!r)return!1;const d=Xp().ua[r];return!(!d||typeof d.failedAt!="number"||i-d.failedAt>ux)}function Fm(o,i=Date.now()){const r=typeof navigator<"u"?navigator.userAgent:"";r&&dx(r,i)}function hx(o){if(o.length<4)return!0;const i=o[0],r=o[1],c=o[2],d=o[3];for(let h=4;h<o.length;h+=4)if(o[h]!==i||o[h+1]!==r||o[h+2]!==c||o[h+3]!==d)return!1;return!0}function mx(o){if(!o||o.width<=0||o.height<=0)return console.debug("Canvas probe inconclusive: text layer canvas missing or zero dimensions"),"inconclusive";let i=null;try{i=o.getContext("2d",{willReadFrequently:!0})||o.getContext("2d")}catch(d){return console.debug("Canvas probe inconclusive: failed to acquire 2D context:",d),"inconclusive"}if(!i)return console.debug("Canvas probe inconclusive: 2D context is null"),"inconclusive";const r=Math.min(o.width,640),c=Math.min(o.height,240);if(r<=0||c<=0)return console.debug("Canvas probe inconclusive: calculated sample dimensions are zero"),"inconclusive";try{const d=i.getImageData(0,0,r,c);return hx(d.data)?"blank":"healthy"}catch(d){return console.debug("Canvas probe inconclusive: getImageData threw exception:",d),"inconclusive"}}function px(o=2){return new Promise(i=>{if(typeof requestAnimationFrame!="function"){setTimeout(i,32);return}let r=o;const c=()=>{r--,r<=0?i():requestAnimationFrame(c)};requestAnimationFrame(c)})}function gx(o,i){if(i.coarsePointer){if(fx())return{kind:"dom",dispose:()=>{},verify:async()=>{}};try{const r=new pu.CanvasAddon;o.loadAddon(r);let c="canvas",d=!1,h=null;const g=()=>{var b;if(c!=="dom"){Fm();try{r.dispose()}catch{}c="dom",(b=i.onRendererSwapped)==null||b.call(i,"dom")}};return{get kind(){return c},dispose:()=>{d=!0;try{r.dispose()}catch{}},verify:async()=>{if(!(d||c!=="canvas"))return h||(h=(async()=>{var b;try{if(await px(2),d||c!=="canvas")return;const S=(b=o.element)==null?void 0:b.querySelector("canvas.xterm-text-layer"),v=mx(S);v==="blank"?g():v==="inconclusive"&&console.debug("Canvas probe inconclusive; retaining canvas renderer without blacklisting")}catch(S){console.debug("Canvas probe inconclusive: unexpected error during verify():",S)}finally{h=null}})(),h)}}}catch(r){return console.debug("Canvas renderer constructor/addon load unavailable for coarse pointer, falling back to DOM:",r),Fm(),{kind:"dom",dispose:()=>{},verify:async()=>{}}}}try{const r=new cx.WebglAddon;let c=null,d="webgl",h=!1;return r.onContextLoss(()=>{var g,m;if(!h){try{r.dispose()}catch{}try{c=new pu.CanvasAddon,o.loadAddon(c),d="canvas",(g=i.onRendererSwapped)==null||g.call(i,"canvas")}catch(b){console.debug("Canvas fallback failed after WebGL context loss:",b),d="dom",(m=i.onRendererSwapped)==null||m.call(i,"dom")}}}),o.loadAddon(r),{get kind(){return d},dispose:()=>{h=!0;for(const g of[c,r])try{g==null||g.dispose()}catch{}},verify:async()=>{}}}catch(r){console.debug("WebGL renderer unavailable, falling back to canvas:",r)}try{const r=new pu.CanvasAddon;return o.loadAddon(r),{kind:"canvas",dispose:()=>{try{r.dispose()}catch{}},verify:async()=>{}}}catch(r){console.debug("Canvas renderer unavailable, using the DOM renderer:",r)}return{kind:"dom",dispose:()=>{},verify:async()=>{}}}function Zm(o,i){const r=typeof window<"u"?window:void 0,c=r&&typeof r.devicePixelRatio=="number"&&r.devicePixelRatio>0?r.devicePixelRatio:1,d=r&&r.visualViewport&&typeof r.visualViewport.scale=="number"&&r.visualViewport.scale>0?r.visualViewport.scale:1,h=Math.max(0,o.width),g=Math.max(0,o.height),m=Math.round(h*c*100)/100,b=Math.round(g*c*100)/100;return{dpr:c,scale:d,cssWidth:h,cssHeight:g,physicalWidth:m,physicalHeight:b}}function bx(o){const{lastSnapshot:i,currentSnapshot:r,physicalTolerancePx:c=6}=o;if(!i)return{shouldIgnore:!1,isVisualZoom:!1,reason:"initial"};const d=Math.abs(r.scale-i.scale)>.01,h=Math.abs(r.scale-1)>.01;if(d||h)return{shouldIgnore:!0,isVisualZoom:!0,reason:"visual_pinch_zoom"};if(Math.abs(r.dpr-i.dpr)>.01){const S=Math.abs(r.physicalWidth-i.physicalWidth),v=Math.abs(r.physicalHeight-i.physicalHeight);if(S<=c&&v<=c)return{shouldIgnore:!0,isVisualZoom:!0,reason:"dpr_zoom"}}const m=Math.abs(r.cssWidth-i.cssWidth),b=Math.abs(r.cssHeight-i.cssHeight);return m<1&&b<1?{shouldIgnore:!0,isVisualZoom:!1,reason:"no_box_change"}:{shouldIgnore:!1,isVisualZoom:!1,reason:"genuine_resize"}}const yx=" ()[]{}'\"\\`";function Qm(o,i,r,c=1){var k,Z;if(!i||!((k=i.buffer)!=null&&k.active)||i.cols<=0||i.rows<=0)return null;const d=r||((Z=i.element)==null?void 0:Z.querySelector(".xterm-screen"))||i.element;if(!d||typeof d.getBoundingClientRect!="function")return null;const h=d.getBoundingClientRect(),g=Vp(o.clientX,o.clientY,h,c),m=Ra(i);if(m.cellWidth<=0||m.cellHeight<=0)return null;const b=Math.max(1,h.width||i.cols*m.cellWidth),S=Math.max(1,h.height||i.rows*m.cellHeight),v=Math.max(0,Math.min(b-1,g.clientX-h.left)),C=Math.max(0,Math.min(S-1,g.clientY-h.top)),B=Math.max(0,Math.min(i.cols-1,Math.floor(v/m.cellWidth))),z=Math.max(0,Math.min(i.rows-1,Math.floor(C/m.cellHeight))),V=(i.buffer.active.viewportY??0)+z;return{col:B,bufferRow:V}}function vx(o,i){if(!o||o.length===0||o==="\0")return!0;for(const r of o)if(r==="\0"||/\s/.test(r)||i.includes(r))return!0;return!1}function xx(o,i,r){var B,z;if(!o||!((B=o.buffer)!=null&&B.active)||i<0||i>=o.cols)return null;const c=o.buffer.active.getLine(r);if(!c)return null;const d=((z=o.options)==null?void 0:z.wordSeparator)??yx,h=new Array(o.cols).fill(null),g=Math.min(o.cols,c.length);let m=0;for(;m<g;){const _=c.getCell(m);if(!_){h[m]={startCol:m,endCol:m+1,isSeparator:!0},m++;continue}const V=_.getWidth();if(V===0){h[m]||(h[m]={startCol:m,endCol:m+1,isSeparator:!0}),m++;continue}const k=_.getChars(),Z=vx(k,d),$=Math.min(o.cols,m+V),Q={startCol:m,endCol:$,isSeparator:Z};for(let ae=m;ae<$;ae++)h[ae]=Q;m+=Math.max(1,V)}for(let _=g;_<o.cols;_++)h[_]||(h[_]={startCol:_,endCol:_+1,isSeparator:!0});const b=h[i];if(!b||b.isSeparator)return null;let S=b.startCol;for(;S>0;){const _=h[S-1];if(_&&!_.isSeparator)S=_.startCol;else break}let v=b.endCol;for(;v<o.cols;){const _=h[v];if(_&&!_.isSeparator)v=_.endCol;else break}const C=v-S;return C<=0?null:{startCol:S,length:C}}function Sx(o){var h;if(!o||!((h=o.buffer)!=null&&h.active))return"";const i=o.buffer.active,r=i.viewportY??0,c=o.rows,d=[];for(let g=0;g<c;g++){const m=i.getLine(r+g);d.push(m?m.translateToString(!0):"")}for(;d.length>0&&d[d.length-1]==="";)d.pop();return d.join(`
34
+ `)}const Im=new Set(["│","┃","╎","╏","┆","┇","┊","┋","║","▏","▕","|"]),wx=.6,Cx=new Set(["─","━","═","┄","┅","┈","┉","-"]),Tx=.8;function gu(o,i){if(!o)return!1;let r=0;const c=Math.min(i,o.length);for(let d=0;d<c;d++){const h=o.getCell(d);if(h){const g=h.getChars();g&&Cx.has(g)&&r++}}return r>=Math.max(5,Math.min(i*.25,10))}function bu(o,i,r){var z;if(!o||!((z=o.buffer)!=null&&z.active)||o.cols<=0)return{startCol:0,endCol:0};const c=o.buffer.active,d=o.cols,h=Math.max(0,Math.min(d-1,i)),g=c.viewportY??0,m=o.rows>0?o.rows:1,b=new Int32Array(d);let S=0;for(let _=0;_<m;_++){const V=c.getLine(g+_);if(S++,!V)continue;const k=Math.min(d,V.length);for(let Z=0;Z<k;Z++){const $=V.getCell(Z);if($){const Q=$.getChars();Q&&Im.has(Q)&&b[Z]++}}}if(S===0)return{startCol:0,endCol:d-1};const v=S*wx,C=_=>b[_]>=v;let B=!1;for(let _=0;_<d;_++)if(C(_)){B=!0;break}if(B){if(C(h))return{startCol:h,endCol:h};let _=-1;for(let k=h-1;k>=0;k--)if(C(k)){_=k;break}let V=d;for(let k=h+1;k<d;k++)if(C(k)){V=k;break}return{startCol:_+1,endCol:V-1}}if(r!==void 0){const _=Math.max(g,Math.min(g+m-1,r)),V=c.getLine(_);if(!gu(V,d)){let k=g;for(let Q=_-1;Q>=g;Q--)if(gu(c.getLine(Q),d)){k=Q+1;break}let Z=g+m-1;for(let Q=_+1;Q<=g+m-1;Q++)if(gu(c.getLine(Q),d)){Z=Q-1;break}const $=Z-k+1;if($>=2){const Q=new Int32Array(d);for(let O=k;O<=Z;O++){const A=c.getLine(O);if(!A)continue;const ee=Math.min(d,A.length);for(let Ae=0;Ae<ee;Ae++){const Re=A.getCell(Ae);if(Re){const Ne=Re.getChars();Ne&&Im.has(Ne)&&Q[Ae]++}}}const ae=$*Tx,Se=O=>Q[O]>=ae;let D=!1;for(let O=0;O<d;O++)if(Se(O)){D=!0;break}if(D){if(Se(h))return{startCol:h,endCol:h};let O=-1;for(let ee=h-1;ee>=0;ee--)if(Se(ee)){O=ee;break}let A=d;for(let ee=h+1;ee<d;ee++)if(Se(ee)){A=ee;break}return{startCol:O+1,endCol:A-1}}}}}return{startCol:0,endCol:d-1}}function Jm(o,i){const r=Math.min(o.startCol,o.endCol),c=Math.max(o.startCol,o.endCol),d=Math.min(o.startRow,o.endRow),h=Math.max(o.startRow,o.endRow);return{startCol:Math.max(i.startCol,Math.min(i.endCol,r)),endCol:Math.max(i.startCol,Math.min(i.endCol,c)),startRow:d,endRow:h}}function yu(o,i){var S;if(!o||!((S=o.buffer)!=null&&S.active)||o.cols<=0)return"";const r=o.buffer.active,c=o.cols,d=Math.min(i.startRow,i.endRow),h=Math.max(i.startRow,i.endRow),g=Math.max(0,Math.min(i.startCol,i.endCol)),m=Math.min(c-1,Math.max(i.startCol,i.endCol));if(g>m||d>h)return"";const b=[];for(let v=d;v<=h;v++){const C=r.getLine(v);if(!C){b.push("");continue}const B=C.translateToString(!0,g,m+1);b.push(B.trimEnd())}return b.join(`
35
+ `)}async function ja(o){if(typeof navigator<"u"&&navigator.clipboard&&typeof navigator.clipboard.writeText=="function")try{return await navigator.clipboard.writeText(o),"clipboard"}catch{}if(typeof document<"u"&&typeof document.execCommand=="function"){let i=null,r=null,c=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=o,typeof window<"u"&&typeof window.getSelection=="function"&&(c=window.getSelection(),c&&c.rangeCount>0&&(r=c.getRangeAt(0))),document.body.appendChild(i),typeof navigator<"u"&&(/iPad|iPhone|iPod/.test(navigator.userAgent||"")||navigator.platform==="MacIntel"&&(navigator.maxTouchPoints||0)>1)){const g=document.createRange();g.selectNodeContents(i),c&&(c.removeAllRanges(),c.addRange(g)),i.setSelectionRange(0,o.length)}else i.focus({preventScroll:!0}),i.select();if(document.execCommand("copy"))return"exec"}catch{}finally{i&&i.parentNode&&i.parentNode.removeChild(i),c&&(c.removeAllRanges(),r&&c.addRange(r))}}return"failed"}async function Nx(){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 Ex(){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 r of i){const c=r.types.find(d=>d.startsWith("image/"));if(c){const d=await r.getType(c);if(d&&d.size>0)return{ok:!0,blob:d}}}return{ok:!1,reason:"empty"}}catch(i){if(typeof window<"u"&&window.isSecureContext===!1)return{ok:!1,reason:"insecure"};const r=i==null?void 0:i.name;return r==="SecurityError"?{ok:!1,reason:"insecure"}:r==="NotAllowedError"?{ok:!1,reason:"denied"}:{ok:!1,reason:"empty"}}}function Fp(o){const i=o.clipboardData;if(!i)return null;if(i.files&&i.files.length>0)for(let r=0;r<i.files.length;r++){const c=i.files[r];if(c&&c.type.startsWith("image/"))return c}if(i.items&&i.items.length>0)for(let r=0;r<i.items.length;r++){const c=i.items[r];if(c&&c.type.startsWith("image/")){const d=c.getAsFile();if(d)return d}}return null}function Ax(o){if(!o||o.length===0)return null;for(let i=0;i<o.length;i++){const r=o[i];if(r&&(r.type.startsWith("image/")||/\.(png|jpe?g|webp|gif)$/i.test(r.name)))return r}return null}const ps="tui-focusable group flex h-11 w-full select-none items-center gap-2 border px-2 text-left text-tui transition-colors",gs="border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",Rx=({anchorPoint:o,hasSelection:i,isController:r,vibrateOnKeyPress:c=!1,onCopySelection:d,onCopyLine:h,onCopyScreen:g,onPaste:m,onClose:b})=>{const{t:S}=Tt(),v=y.useRef(null),[C,B]=y.useState(null);y.useEffect(()=>{if(c&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(8)}catch{}},[c]),y.useLayoutEffect(()=>{const k=v.current;if(!k||!k.parentElement)return;const Z=k.parentElement.getBoundingClientRect(),$=k.getBoundingClientRect(),Q=$.width||208,ae=$.height||220,Se=Z.width,D=Z.height;let O=o.x-Q/2;O=Math.max(8,Math.min(Math.max(8,Se-Q-8),O));let A=o.y-ae-8;A<8&&(A=o.y+8),A=Math.max(8,Math.min(Math.max(8,D-ae-8),A)),B({x:O,y:A})},[o.x,o.y,i,r]);const z=Math.max(8,o.x-104),_=Math.max(8,o.y-200),V={position:"absolute",left:`${C?C.x:z}px`,top:`${C?C.y:_}px`,visibility:C?"visible":"hidden"};return u.jsx("div",{ref:v,role:"menu","aria-label":"终端选择操作",className:"z-50 w-52 select-none font-mono",style:V,onMouseDown:k=>k.stopPropagation(),onTouchStart:k=>k.stopPropagation(),onPointerDown:k=>k.stopPropagation(),children:u.jsxs(sn,{tone:"accent",className:"border border-tui-border bg-tui-base p-1.5 shadow-lg",bodyClassName:"flex flex-col gap-1",children:[i&&u.jsxs("button",{type:"button",role:"menuitem",className:W(ps,gs),onClick:()=>{d(),b()},children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:qe.cursor}),u.jsx("span",{className:"truncate",children:S("clipboard.copySelection")})]}),u.jsxs("button",{type:"button",role:"menuitem",className:W(ps,gs),onClick:()=>{h(),b()},children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:qe.cursor}),u.jsx("span",{className:"truncate",children:S("clipboard.copyLine")})]}),u.jsxs("button",{type:"button",role:"menuitem",className:W(ps,gs),onClick:()=>{g(),b()},children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:qe.cursor}),u.jsx("span",{className:"truncate",children:S("clipboard.copyScreen")})]}),r&&u.jsxs("button",{type:"button",role:"menuitem",className:W(ps,gs),onClick:()=>{m(),b()},children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:qe.cursor}),u.jsx("span",{className:"truncate",children:S("clipboard.paste")})]}),u.jsxs("button",{type:"button",role:"menuitem",className:W(ps,gs),onClick:b,children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:qe.cursor}),u.jsx("span",{className:"truncate",children:S("clipboard.cancel")})]})]})})},jx=({isOpen:o,onClose:i,onSend:r,onSendImage:c})=>{const{t:d,addToast:h}=Tt(),[g,m]=y.useState(""),[b,S]=y.useState(null),[v,C]=y.useState(!1),B=y.useRef(null),z=y.useRef(null),_=y.useRef(null);y.useEffect(()=>{o&&(m(""),S(null),C(!1),B.current&&(B.current.value=""),z.current&&(z.current.value=""))},[o]);const V=async D=>{if(D.size===0){h("error",d("clipboard.fileEmpty"));return}C(!0);try{const O=await wp(D);O?(S(O),m("")):h("error",d("clipboard.imageTooLarge"))}catch(O){console.error("Failed to process image:",O),h("error",d("clipboard.imageTooLarge"))}finally{C(!1)}},k=async D=>{const O=Fp(D);O&&(D.preventDefault(),await V(O))},Z=async D=>{const O=Ax(D.target.files);D.target.value="",O&&await V(O)},$=D=>{const O=D.target.value;m(O),O&&b&&S(null)},Q=()=>{S(null),B.current&&(B.current.value=""),z.current&&(z.current.value="")},ae=()=>{b?(c==null||c(b),i()):g.trim()&&(r(g),i())},Se=!!(g.trim()||b);return u.jsx(Uu,{isOpen:o,onClose:i,title:d("clipboard.pasteTitle"),closeLabel:d("clipboard.cancel"),size:"sm",footer:u.jsxs("div",{className:"flex items-center justify-end gap-2",children:[u.jsx(Ye,{variant:"ghost",onClick:i,children:d("clipboard.cancel")}),u.jsx(Ye,{variant:"primary",onClick:ae,disabled:!Se||v,children:d("clipboard.pasteSend")})]}),children:u.jsxs("div",{className:"flex flex-col gap-3 p-3 font-mono select-text",children:[u.jsxs("div",{className:"flex flex-col gap-1.5",children:[u.jsx("label",{htmlFor:"paste-fallback-input",className:"text-tui-sm text-tui-muted font-sans font-medium",children:d("clipboard.pasteHint")}),u.jsx("textarea",{ref:_,id:"paste-fallback-input","data-testid":"paste-fallback-input",rows:4,autoFocus:!0,placeholder:d("clipboard.pasteHint"),value:g,onChange:$,onPaste:k,disabled:!!b||v,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"})]}),u.jsxs("div",{className:"relative my-1",children:[u.jsx("div",{className:"absolute inset-0 flex items-center",children:u.jsx("div",{className:"w-full border-t border-tui-border"})}),u.jsx("div",{className:"relative flex justify-center text-tui-xs uppercase",children:u.jsx("span",{className:"bg-tui-bg px-2 text-tui-muted font-sans",children:d("clipboard.imageSectionTitle")})})]}),u.jsxs("div",{className:"flex flex-col gap-2",children:[u.jsx("input",{ref:B,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",className:"hidden","data-testid":"paste-fallback-file-input",onChange:Z}),u.jsx("input",{ref:z,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",capture:"environment",className:"hidden","data-testid":"paste-fallback-camera-input",onChange:Z}),b?u.jsxs("div",{className:"flex flex-col items-center gap-2 p-3 border border-tui-border bg-tui-bg rounded",children:[u.jsx("img",{src:b.dataUrl,alt:"Pasted preview","data-testid":"pasted-image-preview",className:"max-h-40 max-w-full object-contain rounded border border-tui-border"}),u.jsxs("div",{className:"flex items-center justify-between w-full text-tui-xs text-tui-muted pt-1",children:[u.jsx("span",{children:d("clipboard.imageCompressedSize",{size:Xy(b.byteLength)})}),u.jsx(Ye,{variant:"ghost",onClick:Q,"aria-label":d("clipboard.removeImage"),children:d("clipboard.cancel")})]})]}):u.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[u.jsx(Ye,{variant:"default",onClick:()=>{var D;return(D=B.current)==null?void 0:D.click()},disabled:v||!!g.trim(),className:"min-h-[44px] px-3 touch-manipulation text-tui-sm font-sans flex-1","aria-label":d("clipboard.chooseImage"),children:d("clipboard.chooseImage")}),u.jsx(Ye,{variant:"default",onClick:()=>{var D;return(D=z.current)==null?void 0:D.click()},disabled:v||!!g.trim(),className:"min-h-[44px] px-3 touch-manipulation text-tui-sm font-sans flex-1","aria-label":d("clipboard.takePhoto"),children:d("clipboard.takePhoto")})]}),v&&u.jsx("div",{className:"flex items-center gap-2 text-tui-xs text-tui-muted animate-pulse",children:u.jsx("span",{children:d("clipboard.imageCompressing")})})]})]})})};class Mx{constructor(i){De(this,"getTerminal");De(this,"now");De(this,"textDecoder",new TextDecoder("utf-8"));De(this,"state","tentative");De(this,"predictions",[]);De(this,"predictedCursor",null);De(this,"srtt",null);De(this,"isSuppressed",!1);De(this,"suppressCursor",null);De(this,"suppressSentAt",0);this.getTerminal=i.getTerminal,this.now=i.now??(typeof performance<"u"&&typeof performance.now=="function"?()=>performance.now():()=>Date.now())}handleUserInput(i){if(this.pruneExpired(),i.length===0)return;const r=this.textDecoder.decode(i,{stream:!1});if(!r)return;const c=this.getTerminal();if(!c){this.reset("terminal unavailable",!0);return}for(const d of r){const h=d.codePointAt(0);if(h!==void 0){if(h===27||h===9||h===10||h===13||h<32&&h!==8){this.reset("control or escape sequence",!0);return}if(h===8||h===127){this.handleBackspace();continue}if(h>=32&&h<=126){this.handlePrintable(d,c);continue}this.reset("non-ASCII character",!0);return}}}onServerOutput(){if(this.isSuppressed){const c=this.getTerminal(),d=Math.max(300,(this.srtt??300)*1.5),h=this.now()-this.suppressSentAt>=d;let g=!1;if(c&&this.suppressCursor){const m=c.buffer.active.baseY+c.buffer.active.cursorY,b=c.buffer.active.cursorX;g=m!==this.suppressCursor.row||b!==this.suppressCursor.col}(g||h)&&(this.isSuppressed=!1,this.suppressCursor=null)}if(this.pruneExpired(),this.predictions.length===0)return;const i=this.getTerminal();if(!i)return;const r=[];for(let c=0;c<this.predictions.length;c++){const d=this.predictions[c],h=i.buffer.active.getLine(d.row),g=h?h.getCell(d.col):void 0,m=g?g.getChars():"";if(m===d.charBefore)r.push(d);else if(m===d.char){const b=Math.max(0,this.now()-d.sentAt);this.updateSrtt(b),this.state="confident"}else{this.predictions=[],this.predictedCursor=null,this.state="tentative",this.isSuppressed=!1,this.suppressCursor=null;return}}this.predictions=r}reset(i,r){if(this.predictions=[],this.predictedCursor=null,typeof r=="boolean"?r:(r==null?void 0:r.suppress)??!0){this.isSuppressed=!0,this.suppressSentAt=this.now();const d=this.getTerminal();d?this.suppressCursor={row:d.buffer.active.baseY+d.buffer.active.cursorY,col:d.buffer.active.cursorX}:this.suppressCursor=null}else this.isSuppressed=!1,this.suppressCursor=null}getVisiblePredictions(){return this.pruneExpired(),this.state!=="confident"?[]:this.predictions.map(i=>({row:i.row,col:i.col,char:i.char}))}getState(){return this.state}getEchoSrttMs(){return this.srtt}handlePrintable(i,r){if(this.isSuppressed){const g=Math.max(300,(this.srtt??300)*1.5);if(this.now()-this.suppressSentAt>=g)this.isSuppressed=!1,this.suppressCursor=null;else return}if(this.predictedCursor||(this.predictedCursor={row:r.buffer.active.baseY+r.buffer.active.cursorY,col:r.buffer.active.cursorX}),this.predictedCursor.col+1>=r.cols){this.reset("cursor would reach or exceed column boundary",!0);return}const c=r.buffer.active.getLine(this.predictedCursor.row),d=c?c.getCell(this.predictedCursor.col):void 0,h=d?d.getChars():"";this.predictions.push({row:this.predictedCursor.row,col:this.predictedCursor.col,char:i,charBefore:h,sentAt:this.now()}),this.predictedCursor.col++}handleBackspace(){if(this.predictedCursor&&this.predictions.length>0){const i=this.predictions[this.predictions.length-1];if(i.row===this.predictedCursor.row&&i.col===this.predictedCursor.col-1){this.predictions.pop(),this.predictedCursor.col--;return}}this.reset("backspace into server content",!0)}pruneExpired(){if(this.predictions.length===0)return;const i=this.now(),r=[];for(const c of this.predictions)i-c.sentAt<=1500&&r.push(c);r.length!==this.predictions.length&&(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}}function Wm(o){return typeof o=="string"&&/^#[0-9a-fA-F]{6}$/.test(o)}class _x{constructor(i){De(this,"options");De(this,"activeDecorations",new Map);this.options=i}sync(i){var d,h;const r=this.options.getTerminal();if(!r){this.clear();return}if(i.length===0){this.clear();return}if(typeof r.registerMarker!="function"||typeof r.registerDecoration!="function"||!((d=r.buffer)!=null&&d.active)){this.clear();return}const c=new Set;for(const g of i){const m=`${g.row}:${g.col}`;c.add(m);const b=this.activeDecorations.get(m);if(b){if(b.char===g.char){b.decoration.element&&this.applyStyleToElement(b.decoration.element,b.char);continue}this.disposeEntry(b),this.activeDecorations.delete(m)}try{const S=r.buffer.active.baseY+r.buffer.active.cursorY,v=g.row-S,C=r.registerMarker(v);if(!C||C.isDisposed||C.line===-1)continue;const B=this.options.getStyle(),z={marker:C,anchor:"left",x:g.col,width:1,height:1,layer:"top"};Wm(B.background)&&(z.backgroundColor=B.background),Wm(B.color)&&(z.foregroundColor=B.color);const _=r.registerDecoration(z);if(!_||_.isDisposed){try{C.dispose()}catch{}continue}_.element&&this.applyStyleToElement(_.element,g.char),_.onRender(V=>{this.applyStyleToElement(V,g.char)}),(h=C.onDispose)==null||h.call(C,()=>{this.activeDecorations.delete(m)}),this.activeDecorations.set(m,{decoration:_,marker:C,char:g.char})}catch(S){console.debug("Failed to create prediction decoration:",S)}}for(const[g,m]of this.activeDecorations)c.has(g)||(this.disposeEntry(m),this.activeDecorations.delete(g))}clear(){for(const i of this.activeDecorations.values())this.disposeEntry(i);this.activeDecorations.clear()}dispose(){this.clear()}applyStyleToElement(i,r){const c=this.options.getStyle();i.textContent=r,i.style.pointerEvents="none",i.style.userSelect="none",c.color&&(i.style.color=c.color),c.background&&(i.style.backgroundColor=c.background),i.style.textDecoration=c.underline?"underline":"none",i.style.fontFamily="inherit",i.style.fontSize="inherit",i.style.overflow="hidden",i.style.whiteSpace="pre"}disposeEntry(i){try{i.decoration.dispose()}catch{}try{i.marker.dispose()}catch{}}}const Zp=40;function Pm(o,i){return o==="off"?!1:o==="always"?!0:i!==null&&i>Zp}const kx=250,zx=({onTerminalFocus:o,isActive:i=!0})=>{var Le,tt,Je,fn;const r=y.useRef(null),c=y.useRef(null),d=y.useRef(null),h=y.useRef(null),g=y.useRef(1),m=y.useRef({cols:0,rows:0}),b=y.useRef(null),S=y.useRef(null),v=y.useRef(null),C=y.useRef(null),B=y.useRef({width:0,height:0}),z=y.useRef(null),_=Ry(),V=_||typeof navigator<"u"&&navigator.maxTouchPoints>0||typeof window<"u"&&"ontouchstart"in window,k=typeof window<"u"&&new URLSearchParams(window.location.search).get("debug")==="1",[Z,$]=y.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}),[Q,ae]=y.useState({framesPerSec:0,bytesPerSec:0}),[Se,D]=y.useState(null),O=y.useRef(null),A=y.useRef(!1),ee=y.useRef(!1),Ae=y.useRef([]);y.useEffect(()=>{if(!k)return;const F=setInterval(()=>{const he=performance.now()-1e3,oe=Ae.current;for(;oe.length>0&&oe[0].time<he;)oe.shift();let Ke=0;for(let le=0;le<oe.length;le++)Ke+=oe[le].bytes;ae({framesPerSec:oe.length,bytesPerSec:Ke})},1e3);return()=>clearInterval(F)},[k]);const{isController:Re,connectionState:Ne,settings:de,hostPalette:je,terminalResetVersion:Be,sendResize:j,sendBinary:q,addToast:J,warnViewerMode:we,connect:H,subscribeToOutput:Ve,subscribeToPasteFileReady:X,uploadImage:me,t:_e,rttMs:ve}=Tt(),fe=il.useMemo(()=>Yy(je),[je]),vt=y.useRef(fe);vt.current=fe;const Oe=y.useRef(Re);Oe.current=Re;const Me=y.useRef(q);Me.current=q;const Ie=y.useRef(J);Ie.current=J;const pt=y.useRef(we);pt.current=we;const xt=y.useRef(j);xt.current=j;const Dt=y.useRef(me);Dt.current=me;const St=y.useRef(i);St.current=i;const Rn=y.useRef(de);Rn.current=de;const wt=y.useRef(_e);wt.current=_e;const ut=y.useRef(null),At=y.useRef(null),Ot=y.useRef(null),[Wt,Ft]=y.useState(null),Ct=y.useRef(null);Ct.current=Wt;const[Gt,te]=y.useState(null),xe=y.useRef(null);xe.current=Gt;const[ye,Pe]=y.useState(""),Lt=y.useRef("");Lt.current=ye;const[rn,ft]=y.useState(!1),kl=y.useRef(!1);kl.current=rn;const Rt=y.useRef(!1),[Wn,Zt]=y.useState(0),Qt=y.useRef(null),gt=y.useRef(null),Pn=y.useRef(null),$n=y.useRef(null),[xi,sl]=y.useState(!1),rl=y.useCallback(F=>{var Ke;const I=h.current;if(!I)return;const he=((Ke=d.current)==null?void 0:Ke.querySelector(".xterm-screen"))||d.current,oe=Qm(F,I,he,g.current);if(oe){Pn.current=oe;const le=bu(I,oe.col,oe.bufferRow);$n.current=le;const jt=xx(I,oe.col,oe.bufferRow);if(jt){const Mt={startCol:jt.startCol,endCol:jt.startCol+jt.length-1,startRow:oe.bufferRow,endRow:oe.bufferRow},_t=Jm(Mt,le),at=yu(I,_t);te(_t),Pe(at),ft(!0)}else te(null),Pe(""),ft(!1),Pn.current=null,$n.current=null}else te(null),Pe(""),ft(!1),Pn.current=null,$n.current=null;Qt.current=F,gt.current=null},[]),ol=y.useCallback(F=>{var at;const I=h.current,he=Pn.current;if(!I||!he)return;gt.current=F;const oe=((at=d.current)==null?void 0:at.querySelector(".xterm-screen"))||d.current,Ke=Qm(F,I,oe,g.current);if(!Ke)return;const le=$n.current??bu(I,he.col,he.bufferRow),jt={startCol:Math.min(he.col,Ke.col),endCol:Math.max(he.col,Ke.col),startRow:Math.min(he.bufferRow,Ke.bufferRow),endRow:Math.max(he.bufferRow,Ke.bufferRow)},Mt=Jm(jt,le),_t=yu(I,Mt);te(Mt),Pe(_t),ft(!0)},[]),dn=y.useRef(rl);dn.current=rl;const qn=y.useRef(ol);qn.current=ol;const cl=y.useCallback(async()=>{const F=Lt.current;if(!F)return;await ja(F)==="failed"?Ie.current("error",wt.current("clipboard.copyFailed")):Ie.current("success",wt.current("clipboard.copied"))},[]),Si=y.useCallback(async()=>{var Mt,_t,at,nt;const F=h.current;if(!F)return;const I=(Mt=F.buffer)==null?void 0:Mt.active;if(!I)return;const he=((_t=xe.current)==null?void 0:_t.startRow)??((at=Pn.current)==null?void 0:at.bufferRow)??I.viewportY,oe=$n.current??bu(F,((nt=Pn.current)==null?void 0:nt.col)??0,he),Ke={startCol:oe.startCol,endCol:oe.endCol,startRow:he,endRow:he},le=yu(F,Ke);await ja(le)==="failed"?Ie.current("error",wt.current("clipboard.copyFailed")):Ie.current("success",wt.current("clipboard.copied"))},[]),_a=y.useCallback(async()=>{const F=h.current;if(!F)return;const I=Sx(F);await ja(I)==="failed"?Ie.current("error",wt.current("clipboard.copyFailed")):Ie.current("success",wt.current("clipboard.copied"))},[]),ul=y.useCallback(async()=>{var I,he;const F=h.current;if(F){if(!Oe.current){pt.current();return}try{const oe=await Ex();if(oe.ok){await Dt.current(oe.blob);return}}catch{}try{const oe=await Nx();if(oe.ok){(I=ut.current)==null||I.reset("paste"),(he=At.current)==null||he.clear(),F.paste(oe.text),Ie.current("success",wt.current("clipboard.pasted"));return}else if(oe.reason==="empty"){Ie.current("info",wt.current("clipboard.pasteUnavailable"));return}}catch{}sl(!0)}},[]),dl=y.useCallback(F=>{var he,oe;const I=h.current;if(I){if(!Oe.current){pt.current();return}(he=ut.current)==null||he.reset("paste"),(oe=At.current)==null||oe.clear(),I.paste(F),Ie.current("success",wt.current("clipboard.pasted"))}},[]),wi=y.useCallback(F=>{if(h.current){if(!Oe.current){pt.current();return}Dt.current(F)}},[]);y.useEffect(()=>X(I=>{var oe,Ke;const he=h.current;he&&((oe=ut.current)==null||oe.reset("paste"),(Ke=At.current)==null||Ke.clear(),he.paste(I),Ie.current("success",wt.current("clipboard.pasted")))}),[X]);const sa=y.useCallback((F,I)=>{!Number.isFinite(F)||!Number.isFinite(I)||F<=0||I<=0||F===m.current.cols&&I===m.current.rows||(b.current={cols:F,rows:I},!S.current&&(S.current=setTimeout(()=>{var oe,Ke;S.current=null;const he=b.current;b.current=null,he&&(he.cols===m.current.cols&&he.rows===m.current.rows||(m.current=he,xt.current(he.cols,he.rows),(oe=ut.current)==null||oe.reset("resize"),(Ke=At.current)==null||Ke.clear()))},kx)))},[]),L=y.useCallback((F=!1)=>{var ra;const I=h.current,he=r.current,oe=d.current,Ke=c.current;if(!I||!he||!oe||!Ke)return;const le=mu(he,gi(),du());if(le.width<=0||le.height<=0)return;Ke.style.width="100%",Ke.style.height="100%",oe.style.width="100%",oe.style.height="100%",oe.style.transform="none",oe.style.transformOrigin="top left",g.current=1;const jt=Zm(le),Mt=bx({lastSnapshot:z.current,currentSnapshot:jt});if(Mt.isVisualZoom&&!F){z.current=jt;try{I.refresh(0,Math.max(0,I.rows-1))}catch{}return}if(Mt.shouldIgnore&&!F)return;z.current=jt;const _t=Ra(I,vi),at=Vm({width:le.width-sx(oe),height:le.height,cellWidth:_t.cellWidth,cellHeight:_t.cellHeight}),nt=Math.abs(le.width-B.current.width)>1||Math.abs(le.height-B.current.height)>1;if(I.cols!==at.cols||I.rows!==at.rows)try{I.resize(at.cols,at.rows)}catch(Vn){console.debug("Error resizing terminal grid:",Vn)}A.current&&!ee.current&&(nt||I.cols!==at.cols||I.rows!==at.rows)&&(ee.current=!0,(ra=O.current)==null||ra.verify());const vn=at.cols!==m.current.cols||at.rows!==m.current.rows;St.current&&(nt||F||vn)&&(B.current={width:le.width,height:le.height},sa(at.cols,at.rows));try{I.refresh(0,Math.max(0,I.rows-1))}catch{}},[sa]),Y=y.useRef(L);Y.current=L;const ne=y.useCallback(()=>{if(v.current===null){if(typeof requestAnimationFrame!="function"){Y.current();return}v.current=requestAnimationFrame(()=>{v.current=null,Y.current()})}},[]),pe=y.useCallback((F=30)=>{C.current!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(C.current),C.current=null);let I=0;const he=()=>{C.current=null,I++;const oe=I>=F;Y.current(!0),!oe&&I<2&&typeof requestAnimationFrame=="function"&&(C.current=requestAnimationFrame(he))};typeof requestAnimationFrame=="function"?C.current=requestAnimationFrame(he):he()},[]);y.useEffect(()=>{var on,Oa;if(!r.current||!d.current)return;const F=r.current,I=mu(F,gi(),du()),he=Ra(null,vi),oe=Vm({width:I.width,height:I.height,cellWidth:he.cellWidth,cellHeight:he.cellHeight});xt.current(oe.cols,oe.rows),B.current={width:I.width,height:I.height},z.current=Zm(I);const Ke=Am(de.fontSize,I.width),le=new ex.Terminal({fontSize:Ke,fontFamily:Dm(de.fontFamily),lineHeight:1.15,...vt.current?{theme:{...vt.current}}:{},allowProposedApi:!0,convertEol:!0,scrollback:5e3,cols:oe.cols,rows:oe.rows,screenReaderMode:!1});try{const P=new tx.Unicode11Addon;le.loadAddon(P),le.unicode.activeVersion="11"}catch(P){console.debug("Unicode11 addon unavailable, using default width table:",P)}le.open(d.current),h.current=le;const jt=new Mx({getTerminal:()=>h.current});ut.current=jt;const Mt=new _x({getTerminal:()=>h.current,getStyle:()=>{var cn,$t,ge,qt,bt,en,Mn;const P=((cn=vt.current)==null?void 0:cn.foreground)??((ge=($t=h.current)==null?void 0:$t.options.theme)==null?void 0:ge.foreground),ce=((qt=vt.current)==null?void 0:qt.background)??((en=(bt=h.current)==null?void 0:bt.options.theme)==null?void 0:en.background),ke=((Mn=ut.current)==null?void 0:Mn.getEchoSrttMs())??null,Ut=ke!==null&&ke>Zp;return{color:P,background:ce,underline:Ut}}});At.current=Mt;const _t=()=>{const P=ut.current,ce=At.current;if(!P||!ce)return;const ke=Rn.current.predictiveEcho,Ut=P.getEchoSrttMs();if(!Pm(ke,Ut)){ce.clear();return}ce.sync(P.getVisiblePredictions())};_&&le.textarea&&(le.textarea.readOnly=!1,le.textarea.tabIndex=0,le.textarea.inputMode="text");let at=()=>{};if(k&&le.textarea){const P=()=>{$(ce=>({...ce,focused:document.activeElement===le.textarea}))};le.textarea.addEventListener("focus",P),le.textarea.addEventListener("blur",P),at=()=>{var ce,ke;(ce=le.textarea)==null||ce.removeEventListener("focus",P),(ke=le.textarea)==null||ke.removeEventListener("blur",P)},P()}const nt=async P=>{var ke,Ut;(ke=ut.current)==null||ke.reset("paste"),(Ut=At.current)==null||Ut.clear();const ce=Fp(P);if(ce){if(P.preventDefault(),P.stopPropagation(),!Oe.current){pt.current();return}await Dt.current(ce)}};(on=le.textarea)==null||on.addEventListener("paste",nt),F.addEventListener("paste",nt);const vn=gx(le,{coarsePointer:_,onRendererSwapped:P=>{F&&(F.dataset.renderer=P),D(P);try{le.refresh(0,Math.max(0,le.rows-1))}catch{}}});O.current=vn,F&&(F.dataset.renderer=vn.kind),D(vn.kind);const ra=wt.current("terminal.bannerTitle"),Vn=wt.current("terminal.bannerSubtitle");if(le.writeln(" ___ ___ .___ "),le.writeln(` / | \\ ____ _______| _/______ \x1B[1m${ra}\x1B[0m`),le.writeln(`/ ~ \\/ __ \\\\_ __ \\ __/ ___/ \x1B[2m${Vn}\x1B[0m`),le.writeln("\\ Y / ___/ | | \\/|_ \\___ \\ "),le.writeln(" \\___|_ / \\___ >|__| /___/____ >"),le.writeln(" \\/ \\/ \\/ "),le.writeln(""),A.current=!0,vn.verify(),!_)try{le.focus()}catch{}typeof document<"u"&&"fonts"in document&&typeof((Oa=document.fonts)==null?void 0:Oa.load)=="function"&&document.fonts.load('13px "Symbols Nerd Font Mono"').then(()=>{if(h.current){try{h.current.refresh(0,Math.max(0,h.current.rows-1))}catch{}pe(5)}}).catch(()=>{});const zl=le.onData(P=>{var ke;const ce=rp(P);if(!Oe.current&&!Xr(ce)){pt.current();return}(ke=ut.current)==null||ke.handleUserInput(ce),_t(),Me.current(ce)}),$r=le.onBinary(P=>{const ce=new Uint8Array(P.length);for(let ke=0;ke<P.length;ke++)ce[ke]=P.charCodeAt(ke)&255;!Oe.current&&!Xr(ce)||Me.current(ce)}),As=typeof le.onWriteParsed=="function"?le.onWriteParsed(()=>{var P;Rt.current=!0,(P=ut.current)==null||P.onServerOutput(),_t()}):{dispose:()=>{}},Rs=typeof le.onRender=="function"?le.onRender(P=>{const ce=le.buffer.active.viewportY??0;Zt(ce);const ke=xe.current;if(ke&&kl.current){const Ut=ke.startRow-ce,cn=ke.endRow-ce;Rt.current&&P.start<=cn&&P.end>=Ut&&(ft(!1),Rt.current=!1)}else Rt.current=!1}):{dispose:()=>{}},eo=typeof le.onScroll=="function"?le.onScroll(()=>{var ce,ke;const P=le.buffer.active.viewportY??0;Zt(P),(ce=ut.current)==null||ce.reset("scroll"),(ke=At.current)==null||ke.clear()}):{dispose:()=>{}},Pt=new ox({getTerminal:()=>h.current,getIsController:()=>Oe.current,getScale:()=>g.current,getSurfaceElement:()=>d.current,allowSyntheticMouseFallback:!1,onFocus:()=>{try{le.focus()}catch{}k&&$(P=>({...P,focused:document.activeElement===le.textarea})),o==null||o()},onGestureStateChange:P=>{k&&$(ce=>({...ce,state:P}))},onGestureScroll:({deltaY:P,lines:ce,viewportY:ke,scrollTop:Ut,scrollHeight:cn,clientHeight:$t,moved:ge,bufferType:qt,baseY:bt,cursorY:en,hasScrollback:Mn,mouseTracking:hl,scrollMode:La})=>{k&&$(_n=>({..._n,deltaY:P,lines:ce,viewportY:ke,scrollTop:Ut,scrollHeight:cn,clientHeight:$t,moved:ge,focused:document.activeElement===le.textarea,bufferType:qt,baseY:bt,cursorY:en,hasScrollback:Mn,mouseTracking:hl,scrollMode:La,scrollCalls:_n.scrollCalls+(ce!==0?1:0),lastScrollLines:ce}))},longPressDelayMs:500,dragThresholdPx:8,scrollLineHeightPx:18,onLongPress:_?(P=>{var ce;return(ce=dn.current)==null?void 0:ce.call(dn,P)}):void 0,onSelectionExtend:_?(P=>{var ce;return(ce=qn.current)==null?void 0:ce.call(qn,P)}):void 0}),ka=typeof window<"u"&&"PointerEvent"in window,Xn=typeof TouchEvent<"u",It=[],jn=(P,ce=!1)=>{const ke=P.target;return ke instanceof Node&&F.contains(ke)||ce&&Pt.getState()!=="idle"};if(ka){const P={passive:!1,capture:!0},ce=ge=>{k&&$(qt=>({...qt,pointerEvents:qt.pointerEvents+1,lastInputEvent:ge}))},ke=ge=>{if(!jn(ge))return;if(ce("pointerdown"),Ct.current){Ft(null),Ct.current=null,te(null),xe.current=null,Pe(""),Lt.current="",ft(!1),Qt.current=null,gt.current=null,ge.cancelable&&ge.preventDefault(),ge.stopPropagation();return}Pt.handlePointerDown(ge,F)&&ge.stopPropagation()},Ut=ge=>{jn(ge,!0)&&(ce("pointermove"),Pt.handlePointerMove(ge),ge.pointerType!=="mouse"&&ge.stopPropagation())},cn=ge=>{if(!jn(ge,!0))return;if(ce("pointerup"),Pt.getState()==="longpress"&&Ot.current){const bt=gt.current??Qt.current;if(bt){const en=Ot.current.getBoundingClientRect(),Mn=bt.clientX-en.left,hl=bt.clientY-en.top;Ft({x:Mn,y:hl}),Ct.current={x:Mn,y:hl}}}Pt.handlePointerUp(ge),ge.pointerType!=="mouse"&&ge.stopPropagation()},$t=ge=>{jn(ge,!0)&&(ce("pointercancel"),Ft(null),Ct.current=null,te(null),xe.current=null,Pe(""),Lt.current="",ft(!1),Qt.current=null,gt.current=null,Pt.handlePointerCancel(ge),ge.pointerType!=="mouse"&&ge.stopPropagation())};if(document.addEventListener("pointerdown",ke,P),document.addEventListener("pointermove",Ut,P),document.addEventListener("pointerup",cn,P),document.addEventListener("pointercancel",$t,P),It.push(()=>{document.removeEventListener("pointerdown",ke,P),document.removeEventListener("pointermove",Ut,P),document.removeEventListener("pointerup",cn,P),document.removeEventListener("pointercancel",$t,P)}),Xn){const ge=bt=>{jn(bt,!0)&&(k&&$(en=>({...en,touchEvents:en.touchEvents+1})),bt.cancelable&&bt.preventDefault(),bt.stopPropagation())},qt=["touchstart","touchmove","touchend","touchcancel"];for(const bt of qt)document.addEventListener(bt,ge,P);It.push(()=>{for(const bt of qt)document.removeEventListener(bt,ge,P)})}}else{const P={passive:!1,capture:!0},ce=ge=>{k&&$(qt=>({...qt,touchEvents:qt.touchEvents+1,lastInputEvent:ge}))},ke=ge=>{if(jn(ge)){if(ce("touchstart"),Ct.current){Ft(null),Ct.current=null,te(null),xe.current=null,Pe(""),Lt.current="",ft(!1),Qt.current=null,gt.current=null,ge.cancelable&&ge.preventDefault(),ge.stopPropagation();return}ge.touches.length===1&&ge.stopPropagation(),Pt.handleTouchStart(ge,F)}},Ut=ge=>{jn(ge,!0)&&(ce("touchmove"),ge.touches.length===1&&ge.stopPropagation(),Pt.handleTouchMove(ge))},cn=ge=>{if(!jn(ge,!0))return;if(ce("touchend"),Pt.getState()==="longpress"&&Ot.current){const bt=gt.current??Qt.current;if(bt){const en=Ot.current.getBoundingClientRect(),Mn=bt.clientX-en.left,hl=bt.clientY-en.top;Ft({x:Mn,y:hl}),Ct.current={x:Mn,y:hl}}}ge.stopPropagation(),Pt.handleTouchEnd(ge)},$t=ge=>{jn(ge,!0)&&(ce("touchcancel"),Ft(null),Ct.current=null,te(null),xe.current=null,Pe(""),Lt.current="",ft(!1),Qt.current=null,gt.current=null,ge.stopPropagation(),Pt.handleTouchCancel())};document.addEventListener("touchstart",ke,P),document.addEventListener("touchmove",Ut,P),document.addEventListener("touchend",cn,P),document.addEventListener("touchcancel",$t,P),It.push(()=>{document.removeEventListener("touchstart",ke,P),document.removeEventListener("touchmove",Ut,P),document.removeEventListener("touchend",cn,P),document.removeEventListener("touchcancel",$t,P)})}const js=P=>{P.preventDefault()};F.addEventListener("contextmenu",js),It.push(()=>{F.removeEventListener("contextmenu",js)});const za=new ResizeObserver(()=>{ne()});za.observe(F);const oa=()=>{ne()},fl=()=>{var P,ce;if(document.visibilityState==="visible"){pe(10);try{(ce=h.current)==null||ce.refresh(0,Math.max(0,(((P=h.current)==null?void 0:P.rows)||1)-1))}catch{}}};window.addEventListener("resize",oa),window.addEventListener("orientationchange",oa),document.addEventListener("visibilitychange",fl),window.addEventListener("pageshow",fl);const Da=()=>{ne()};return typeof window<"u"&&window.visualViewport&&(window.visualViewport.addEventListener("resize",Da),window.visualViewport.addEventListener("scroll",Da)),()=>{var P,ce;zl.dispose(),$r.dispose(),Rs.dispose(),eo.dispose(),As.dispose(),(P=At.current)==null||P.dispose(),At.current=null,ut.current=null,Pt.handlePointerCancel();for(const ke of It)ke();za.disconnect(),window.removeEventListener("resize",oa),window.removeEventListener("orientationchange",oa),document.removeEventListener("visibilitychange",fl),window.removeEventListener("pageshow",fl),typeof window<"u"&&window.visualViewport&&(window.visualViewport.removeEventListener("resize",Da),window.visualViewport.removeEventListener("scroll",Da)),S.current&&(clearTimeout(S.current),S.current=null),v.current!==null&&(cancelAnimationFrame(v.current),v.current=null),C.current!==null&&(cancelAnimationFrame(C.current),C.current=null),at(),(ce=le.textarea)==null||ce.removeEventListener("paste",nt),F.removeEventListener("paste",nt),vn.dispose(),O.current=null,le.dispose(),h.current=null}},[]),y.useEffect(()=>{const F=h.current;if(!F)return;const I=mu(r.current,gi(),du());F.options.fontSize=Am(de.fontSize,I.width),F.options.fontFamily=Dm(de.fontFamily);try{F.refresh(0,Math.max(0,F.rows-1))}catch{}pe(10)},[de.fontSize,de.fontFamily]),y.useEffect(()=>{const F=ut.current,I=At.current;if(!F||!I)return;const he=F.getEchoSrttMs();Pm(de.predictiveEcho,he)?I.sync(F.getVisiblePredictions()):I.clear()},[de.predictiveEcho]);const Ee=y.useRef(Be);y.useEffect(()=>{var I,he,oe;if(Ee.current===Be)return;Ee.current=Be,(I=ut.current)==null||I.reset("resetVersion"),(he=At.current)==null||he.clear();const F=h.current;if(F)try{(oe=F.reset)==null||oe.call(F),F.clear(),F.refresh(0,Math.max(0,F.rows-1))}catch{}},[Be]),y.useEffect(()=>{var F,I;(F=ut.current)==null||F.reset("connectionState"),(I=At.current)==null||I.clear()},[Ne]),y.useEffect(()=>{const F=h.current;if(!(!F||!fe)){F.options.theme={...fe};try{F.refresh(0,Math.max(0,F.rows-1))}catch{}}},[fe]),y.useEffect(()=>Ve(I=>{const he=h.current;if(!he)throw new Error("terminal not ready");if(he.write(I),k){const oe=performance.now(),Ke=Ae.current;Ke.push({time:oe,bytes:I.byteLength});const le=oe-1e3;for(;Ke.length>0&&Ke[0].time<le;)Ke.shift()}}),[Ve,k]),y.useEffect(()=>{if(!i)return;pe(10);const F=h.current;if(F){try{F.refresh(0,Math.max(0,F.rows-1))}catch{}if(!_)try{F.focus()}catch{}}},[i,_,pe]),y.useEffect(()=>{Ne==="disconnected"&&H()},[]);const ze=F=>{F.preventDefault()};return u.jsxs("main",{ref:Ot,className:"flex-1 w-full min-w-0 min-h-0 overflow-hidden relative flex flex-col",onContextMenu:ze,"aria-label":_e("terminal.windowAriaLabel"),children:[u.jsx("div",{id:"terminal-container",ref:r,className:"absolute inset-0 overflow-hidden cursor-text",style:{touchAction:V?"none":"auto"},tabIndex:0,onContextMenu:ze,"aria-label":_e("terminal.bufferAriaLabel"),role:"region",children:u.jsx("div",{id:"terminal-frame",ref:c,className:"relative overflow-hidden",style:{width:"100%",height:"100%"},children:u.jsx("div",{id:"terminal-surface",ref:d,className:"absolute top-0 left-0",style:{transformOrigin:"top left",width:"100%",height:"100%"}})})}),k&&u.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}
36
+ `,`deltaY: ${Z.deltaY} lines: ${Z.lines}
37
+ `,`viewportY: ${Z.viewportY??"-"} focus: ${Z.focused}
38
+ `,`buffer: ${Z.bufferType??"-"} base: ${Z.baseY??"-"} cursor: ${Z.cursorY??"-"} scrollback: ${Z.hasScrollback??"-"}
39
+ `,`scroll: ${Z.scrollTop??"-"} / ${Z.scrollHeight??"-"} (h ${Z.clientHeight??"-"}) moved: ${Z.moved}
40
+ `,`mode: ${Z.scrollMode} calls: ${Z.scrollCalls} lines: ${Z.lastScrollLines??"-"} mouse: ${Z.mouseTracking}
41
+ `,`event: ${Z.lastInputEvent||"-"} pointer: ${Z.pointerEvents} touch: ${Z.touchEvents}
42
+ `,`rtt: ${ve!==null?`${ve}ms`:"-"} frames/s: ${Q.framesPerSec} bytes/s: ${Q.bytesPerSec} renderer: ${Se??"-"}
43
+ `,`prediction: ${((Le=ut.current)==null?void 0:Le.getState())??"-"} mode: ${de.predictiveEcho} pending: ${((tt=ut.current)==null?void 0:tt.getVisiblePredictions().length)??0} srtt: ${((Je=ut.current)==null?void 0:Je.getEchoSrttMs())!==null&&((fn=ut.current)==null?void 0:fn.getEchoSrttMs())!==void 0?`${Math.round(ut.current.getEchoSrttMs())}ms`:"-"}`]}),_&&Gt&&rn&&(()=>{var vn;const F=h.current;if(!F||!Ot.current)return null;const I=Ra(F);if(I.cellWidth<=0||I.cellHeight<=0)return null;const he=((vn=d.current)==null?void 0:vn.querySelector(".xterm-screen"))||d.current;if(!he)return null;const oe=he.getBoundingClientRect(),Ke=Ot.current.getBoundingClientRect(),le=Gt.startRow-Wn;if(Gt.endRow-Wn<0||le>=F.rows)return null;const Mt=oe.top-Ke.top+le*I.cellHeight,_t=oe.left-Ke.left+Gt.startCol*I.cellWidth,at=(Gt.endCol-Gt.startCol+1)*I.cellWidth,nt=(Gt.endRow-Gt.startRow+1)*I.cellHeight;return u.jsx("div",{"data-testid":"terminal-selection-overlay",className:"pointer-events-none absolute z-20 bg-tui-accent/35",style:{top:`${Mt}px`,left:`${_t}px`,width:`${at}px`,height:`${nt}px`}})})(),_&&Wt&&u.jsx(Rx,{anchorPoint:Wt,hasSelection:!!ye,isController:Re,vibrateOnKeyPress:de.vibrateOnKeyPress,onCopySelection:cl,onCopyLine:Si,onCopyScreen:_a,onPaste:ul,onClose:()=>{Ft(null),Ct.current=null,te(null),xe.current=null,Pe(""),Lt.current="",ft(!1)}}),_&&u.jsx(jx,{isOpen:xi,onClose:()=>sl(!1),onSend:dl,onSendImage:wi})]})},Dx=({onPairedSuccess:o})=>{const{settings:i,updateSettings:r,connect:c,connectionState:d,stateDetail:h,addToast:g,t:m}=Tt(),[b,S]=y.useState(""),[v,C]=y.useState(null),[B,z]=y.useState(!1),[_,V]=y.useState(i.wsUrl||"/ws/client"),[k,Z]=y.useState(i.token||""),[$,Q]=y.useState(i.clientId||""),ae="node bin/service.js pair",Se="node bin/config-tui.js",D="herdr plugin pane open --plugin herdr.remote.web --entrypoint config --placement zoomed --focus",O=Re=>{ja(Re).then(Ne=>{if(Ne==="failed"){g("error",m("clipboard.copyFailed"));return}C(Re),g("success",m("toasts.commandCopied")),setTimeout(()=>C(null),2e3)})},A=Re=>{Re.preventDefault();const Ne=b.trim().toUpperCase();if(!Ne&&!k.trim()){g("warning",m("toasts.connectionError"));return}const de={pairCode:Ne,wsUrl:_.trim()||"/ws/client",clientId:$.trim()||i.clientId};k.trim()&&(de.token=k.trim()),r(de),c({pairCode:Ne||void 0,token:k.trim()||void 0,wsUrl:_.trim()||"/ws/client",clientId:$.trim()||i.clientId}),o&&o()},ee=d==="connecting"||d==="reconnecting",Ae=({n:Re})=>u.jsxs("span",{"aria-hidden":"true",className:"shrink-0 font-bold text-tui-accent",children:["[",Re,"]"]});return u.jsx("div",{className:"flex h-full w-full flex-1 justify-center overflow-y-auto bg-tui-crust p-2 sm:p-4",children:u.jsxs("div",{className:"my-auto w-full max-w-3xl space-y-3",children:[u.jsxs("div",{className:"border border-tui-border bg-tui-base px-3 py-2",children:[u.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[u.jsx("span",{"aria-hidden":"true",className:"font-bold text-tui-accent",children:"herdr-remote"}),u.jsx("h1",{className:"text-tui font-bold text-tui-text",children:m("onboarding.title")}),u.jsx("span",{className:"text-tui uppercase text-tui-warn",children:m("onboarding.firstTimeSetup")})]}),u.jsx("p",{className:"mt-0.5 text-tui leading-snug text-tui-muted",children:m("onboarding.description")})]}),d==="error"&&u.jsxs(Vr,{tone:"warn",action:u.jsx(Ye,{variant:"warn",onClick:()=>c(),children:m("common.retry")}),children:[u.jsx("span",{className:"block font-bold",children:m("onboarding.authRequired")}),u.jsx("span",{className:"block text-tui-muted",children:h||m("onboarding.authRequiredDesc")})]}),u.jsxs("form",{onSubmit:A,className:"grid gap-3",children:[u.jsx(sn,{title:m("onboarding.step1Title"),className:"min-w-0",children:u.jsxs("div",{className:"space-y-2",children:[u.jsxs("p",{className:"flex items-start gap-2 text-tui text-tui-muted",children:[u.jsx(Ae,{n:1}),u.jsx("span",{className:"leading-snug",children:m("onboarding.step1Desc")})]}),u.jsxs("div",{className:"flex items-center gap-2 border border-tui-border bg-tui-mantle px-2 py-1",children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 select-none text-tui-ok",children:"$"}),u.jsx("code",{className:"min-w-0 flex-1 truncate text-tui text-tui-text",children:ae}),u.jsx(Ye,{onClick:()=>O(ae),glyph:v===ae?qe.check:"⧉",className:W("shrink-0",v===ae&&"border-tui-ok text-tui-ok"),children:m(v===ae?"common.copied":"common.copy")})]}),u.jsxs("div",{className:"space-y-0.5 text-tui-sm",children:[u.jsxs("div",{className:"flex items-center justify-between gap-2",children:[u.jsx("span",{className:"truncate text-tui-faint",children:m("onboarding.step1CopyPlugin")}),u.jsx("button",{type:"button",onClick:()=>O(D),className:"tui-focusable shrink-0 text-tui-accent underline-offset-2 hover:underline",children:m(v===D?"common.copied":"onboarding.step1CopyCli")})]}),u.jsxs("div",{className:"flex items-center justify-between gap-2",children:[u.jsx("span",{className:"truncate text-tui-faint",children:m("onboarding.step1TuiNote")}),u.jsx("code",{onClick:()=>O(Se),className:"shrink-0 cursor-pointer border border-tui-border-dim px-1 text-tui-muted hover:border-tui-accent hover:text-tui-accent",title:m("common.clickToCopy"),children:Se})]})]})]})}),u.jsx(sn,{title:m("onboarding.step2Title"),className:"min-w-0",children:u.jsxs("div",{className:"space-y-2",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(Ae,{n:2}),u.jsx(Kn,{type:"text",value:b,onChange:Re=>S(Re.target.value.toUpperCase()),placeholder:m("onboarding.step2Placeholder"),maxLength:12,autoFocus:!0,"aria-label":m("onboarding.step2Title"),className:"font-bold uppercase"})]}),u.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:m("onboarding.step2Note")})]})}),u.jsx(Ye,{variant:"primary",type:"submit",block:!0,disabled:ee,className:"py-1.5",children:ee?u.jsx(yi,{label:m("onboarding.connectingAndPairing")}):m("onboarding.connectAndPair")}),u.jsxs("div",{className:"border border-tui-border bg-tui-base",children:[u.jsxs("button",{type:"button",onClick:()=>z(!B),"aria-expanded":B,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:[u.jsx("span",{"aria-hidden":"true",className:"text-tui-accent",children:B?qe.chevronDown:qe.chevronRight}),u.jsx("span",{className:"uppercase",children:m("onboarding.advancedTitle")})]}),B&&u.jsxs("div",{className:"space-y-2.5 border-t border-tui-border-dim px-2 py-2",children:[u.jsxs("div",{className:"space-y-1",children:[u.jsx(An,{htmlFor:"onboarding-token",children:m("onboarding.manualTokenLabel")}),u.jsx(Kn,{id:"onboarding-token",type:"password",value:k,onChange:Re=>Z(Re.target.value),placeholder:m("onboarding.manualTokenPlaceholder")})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(An,{htmlFor:"onboarding-ws",children:m("onboarding.wsEndpointLabel")}),u.jsx(Kn,{id:"onboarding-ws",type:"text",value:_,onChange:Re=>V(Re.target.value),placeholder:m("onboarding.wsEndpointPlaceholder")})]}),u.jsx(Aa,{}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(An,{htmlFor:"onboarding-client-id",children:m("onboarding.clientIdLabel")}),u.jsx(Kn,{id:"onboarding-client-id",type:"text",value:$,onChange:Re=>Q(Re.target.value)})]})]})]})]})]})})},pi="tui-focusable inline-flex shrink-0 select-none items-center justify-center border text-tui font-medium transition-colors",bs="border-tui-border bg-tui-surface text-tui-text hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",Ox="border-tui-accent bg-tui-accent text-tui-crust font-bold",Lx="border-tui-ok bg-transparent text-tui-ok hover:bg-tui-ok hover:text-tui-crust font-bold",Ux=({compact:o=!1})=>{const{sendKey:i,settings:r,updateSettings:c,isController:d,warnViewerMode:h,t:g,uploadProgress:m,uploadImage:b}=Tt(),S="h-9 min-w-[2.25rem] px-2",v="h-9 w-9",C="h-9 px-2",B=y.useRef(null),z=y.useRef(null),_=y.useCallback(()=>{if(r.vibrateOnKeyPress&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(8)}catch{}},[r.vibrateOnKeyPress]),V=y.useCallback(()=>{var X;if(_(),!d){h();return}m.active||(X=B.current)==null||X.click()},[_,d,h,m.active]),k=y.useCallback(X=>{const me=X.target.files,_e=me&&me[0];X.target.value="",_e&&b(_e)},[b]),Z=()=>u.jsxs(u.Fragment,{children:[u.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:k}),u.jsx("input",{ref:z,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",capture:"environment",className:"hidden","data-testid":"key-toolbar-camera-input",onChange:k})]}),$=(X=!1)=>m.active?u.jsx("div",{"data-testid":X?"key-toolbar-progress-collapsed":"key-toolbar-progress",className:"w-full border-b border-tui-border-dim bg-tui-crust px-2 py-1",children:u.jsx(Qv,{ratio:m.ratio,label:m.statusText,tone:m.phase==="completed"?"ok":m.phase==="error"?"bad":"accent","aria-label":m.statusText})}):null,Q=()=>{const X=m.active;return u.jsx("button",{type:"button","data-testid":"image-upload-btn",onClick:V,disabled:X,className:W(pi,S,X?"border-tui-border-dim bg-tui-surface opacity-60 cursor-not-allowed":bs),title:X?m.statusText:g("virtualKeyboard.uploadImageTitle"),"aria-label":g("virtualKeyboard.uploadImage"),children:u.jsx("span",{className:"font-medium",children:X?`${m.percent}%`:g("virtualKeyboard.image")})})},[ae,Se]=y.useState(!1),[D,O]=y.useState(!1),[A,ee]=y.useState(!1),[Ae,Re]=y.useState(!1),[Ne,de]=y.useState(!1),[je,Be]=y.useState(!1),j=y.useCallback((X,me=!1)=>{if(_(),!d){h();return}let _e=X;me&&(ae||D||A)&&(_e=by(X,{ctrl:ae,alt:D,shift:A})),i(_e),ae&&Se(!1),D&&O(!1),A&&ee(!1)},[d,ae,D,A,i,h,_,g]);if(!r.toolbarVisible)return u.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:[Z(),$(!0),u.jsx("div",{className:"flex items-center justify-center px-2 py-0.5",children:u.jsxs("button",{type:"button",onClick:()=>c({toolbarVisible:!0}),className:"tui-focusable flex h-6 w-28 items-center justify-center gap-1 text-tui uppercase text-tui-faint transition-colors hover:text-tui-accent",title:g("virtualKeyboard.expandToolbar"),"aria-label":g("virtualKeyboard.expandToolbar"),"aria-expanded":!1,children:[u.jsx("span",{"aria-hidden":"true",children:"▴"}),u.jsx("span",{"aria-hidden":"true",children:g("common.keyBar")})]})})]});const q=r.virtualKeys&&r.virtualKeys.length>0?r.virtualKeys.filter(X=>X.enabled):hp,J=X=>X.id==="left"?u.jsx("span",{"aria-hidden":"true",children:"←"}):X.id==="up"?u.jsx("span",{"aria-hidden":"true",children:"↑"}):X.id==="down"?u.jsx("span",{"aria-hidden":"true",children:"↓"}):X.id==="right"?u.jsx("span",{"aria-hidden":"true",children:"→"}):X.id==="enter"?u.jsxs("span",{className:"flex items-center gap-1",children:[u.jsx("span",{"aria-hidden":"true",children:"⏎"}),u.jsx("span",{className:"hidden sm:inline",children:g("virtualKeyboard.keyEnter")})]}):X.id==="drawer_chords"?u.jsx("span",{children:"^C"}):X.id==="drawer_fn"?u.jsxs("span",{className:"flex items-center gap-0.5",children:[u.jsx("span",{children:"Fn"}),u.jsx("span",{"aria-hidden":"true",children:Ae?"▾":"▴"})]}):u.jsx("span",{children:X.label}),we=X=>{if(_(),X.type==="modifier"){X.modifierType==="ctrl"?Se(!ae):X.modifierType==="alt"?O(!D):X.modifierType==="shift"?ee(!A):X.modifierType==="meta"&&j(Te.ESC);return}if(X.type==="drawer"){X.drawerType==="fn"?(Re(!Ae),de(!1),Be(!1)):X.drawerType==="chords"?(Be(!je),Re(!1),de(!1)):X.drawerType==="symbols"&&(de(!Ne),Re(!1),Be(!1));return}j(X.code,X.isPlainChar||X.type==="symbol")},H=X=>{if(X.type==="modifier"){if(X.modifierType==="ctrl")return ae;if(X.modifierType==="alt")return D;if(X.modifierType==="shift")return A}if(X.type==="drawer"){if(X.drawerType==="fn")return Ae;if(X.drawerType==="chords")return je;if(X.drawerType==="symbols")return Ne}return!1},Ve=(X,me,_e,ve,fe="default")=>u.jsxs("button",{type:"button",onClick:()=>j(X),className:W(pi,"h-8 gap-1.5 px-2",fe==="bad"?"border-tui-bad text-tui-bad hover:bg-tui-bad hover:text-tui-crust":fe==="warn"?"border-tui-warn text-tui-warn hover:bg-tui-warn hover:text-tui-crust":bs),title:_e,children:[u.jsx("span",{className:"font-bold",children:me}),u.jsx("span",{className:"text-tui-sm opacity-70",children:ve})]});return u.jsxs("div",{"data-testid":"key-toolbar",className:W("z-20 flex shrink-0 select-none flex-col border-t border-tui-border bg-tui-mantle",o?"pb-[max(env(safe-area-inset-bottom,0px),0.125rem)]":"pb-[max(env(safe-area-inset-bottom,0px),0.25rem)]"),role:"toolbar","aria-label":g("virtualKeyboard.touchKeyboardShortcuts"),children:[Z(),$(!1),Ae&&u.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(X=>{const me=`F${X}`;return u.jsxs("button",{type:"button",onClick:()=>j(Te[me]),className:W(pi,bs,"h-8"),children:["F",X]},me)})}),je&&u.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:[Ve(Te.CTRL_C,"^C",g("virtualKeyboard.ctrlCTitle"),g("virtualKeyboard.badgeSigint"),"bad"),Ve(Te.CTRL_D,"^D",g("virtualKeyboard.ctrlDTitle"),g("virtualKeyboard.badgeEof")),Ve(Te.CTRL_Z,"^Z",g("virtualKeyboard.ctrlZTitle"),g("virtualKeyboard.badgeTstp"),"warn"),Ve(Te.CTRL_L,"^L",g("virtualKeyboard.ctrlLTitle"),g("virtualKeyboard.badgeClear")),Ve(Te.CTRL_R,"^R",g("virtualKeyboard.ctrlRTitle"),g("virtualKeyboard.badgeSearch")),Ve(Te.CTRL_A,"^A",g("virtualKeyboard.ctrlATitle"),g("virtualKeyboard.badgeStart")),Ve(Te.CTRL_E,"^E",g("virtualKeyboard.ctrlETitle"),g("virtualKeyboard.badgeEnd")),Ve(Te.CTRL_K,"^K",g("virtualKeyboard.ctrlKTitle"),g("virtualKeyboard.badgeKill"))]}),Ne&&u.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(X=>u.jsx("button",{type:"button",onClick:()=>j(X,!0),className:W(pi,bs,"h-8 w-8 font-bold"),children:X},X))}),u.jsxs("div",{"data-testid":"key-toolbar-row",className:W("flex flex-wrap items-center justify-center gap-1",o?"px-1.5 py-1":"px-2 py-1.5"),children:[u.jsx("button",{type:"button",onClick:()=>c({toolbarVisible:!1}),className:W(pi,v,"mr-1 border-tui-border-dim bg-transparent text-tui-faint hover:border-tui-border hover:text-tui-text"),title:g("virtualKeyboard.collapseToolbar"),"aria-label":g("virtualKeyboard.collapseToolbar"),"aria-expanded":!0,children:u.jsx("span",{"aria-hidden":"true",children:"▾"})}),q.map(X=>{const me=H(X),_e=X.id==="enter",ve=["left","up","down","right"].includes(X.id),fe=X.type==="drawer",vt=vu(X,g),Oe=u.jsx("button",{type:"button",onClick:()=>we(X),className:W(pi,ve?v:fe?C:S,_e?Lx:me?Ox:bs),title:vt,"aria-label":vt,"aria-pressed":me,children:J(X)},X.id);return _e?u.jsxs(il.Fragment,{children:[Q(),Oe]},"enter-with-image"):Oe}),!q.some(X=>X.id==="enter")&&Q()]})]})},Bx=["ls -la","clear","git status","pwd","top","exit","cat"],Hx=({isOpen:o,onClose:i})=>{const{sendKey:r,isController:c,warnViewerMode:d,t:h}=Tt(),[g,m]=y.useState("");if(!o)return null;const b=v=>{if(v&&v.preventDefault(),!c){d();return}g.length>0?(r(g+"\r"),m("")):r("\r")},S=v=>{if(!c){d();return}r(v+"\r")};return u.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":h("virtualKeyboard.helperTitle"),children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx("span",{className:"text-tui font-bold uppercase text-tui-accent",children:h("virtualKeyboard.helperTitle")}),u.jsx(Ye,{variant:"ghost",onClick:i,"aria-label":h("virtualKeyboard.closeHelper"),children:"esc"})]}),u.jsx("div",{className:"scrollbar-none flex items-center gap-1 overflow-x-auto py-0.5",children:Bx.map(v=>u.jsx("button",{type:"button",onClick:()=>S(v),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:v},v))}),u.jsxs("form",{onSubmit:b,className:"flex items-center gap-1.5",children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 select-none font-bold text-tui-ok",children:"$"}),u.jsxs("div",{className:"relative flex-1",children:[u.jsx("label",{htmlFor:"virtual-keyboard-input",className:"sr-only",children:h("virtualKeyboard.placeholder")}),u.jsx(Kn,{id:"virtual-keyboard-input",name:"terminal-input",type:"text",value:g,onChange:v=>m(v.target.value),placeholder:h("virtualKeyboard.placeholder"),inputMode:"text",enterKeyHint:"send",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,className:"select-text pr-7"}),g.length>0&&u.jsx("button",{type:"button",onClick:()=>m(""),className:"tui-focusable absolute right-1 top-1/2 -translate-y-1/2 px-1 text-tui-faint hover:text-tui-bad","aria-label":h("virtualKeyboard.clearInput"),children:u.jsx("span",{"aria-hidden":"true",children:qe.cross})})]}),u.jsx(Ye,{variant:"primary",type:"submit",title:h("virtualKeyboard.sendButton"),glyph:"⏎",className:"h-9 shrink-0",children:u.jsx("span",{className:"hidden sm:inline",children:h("virtualKeyboard.sendButton")})})]})]})};function Pr(o,i){const r=(c,d)=>i?i(c):d;switch(o){case"connected":return{label:r("connection.live","Live"),level:"ok",needsAttention:!1};case"connecting":return{label:r("connection.connecting","Connecting"),level:"warn",needsAttention:!0};case"reconnecting":return{label:r("connection.reconnecting","Reconnecting"),level:"warn",needsAttention:!0,actionLabel:r("connection.reconnectNow","Reconnect now")};case"error":return{label:r("connection.error","Error"),level:"bad",needsAttention:!0,actionLabel:r("connection.retry","Retry")};default:return{label:r("connection.offline","Offline"),level:"idle",needsAttention:!0,actionLabel:r("connection.connect","Connect")}}}const Yx={connected:"ok",connecting:"warn",reconnecting:"warn",error:"bad",disconnected:"idle"},Kx=({isOpen:o,onClose:i,isAddMode:r=!1})=>{const{settings:c,updateSettings:d,connect:h,disconnect:g,connectionState:m,hostId:b,addToast:S,t:v,activeProfile:C,activeProfileId:B,addProfileAndConnect:z,renameProfile:_}=Tt(),[V,k]=y.useState(c.wsUrl),[Z,$]=y.useState(c.token),[Q,ae]=y.useState(c.pairCode),[Se,D]=y.useState(c.clientId),[O,A]=y.useState((C==null?void 0:C.displayName)||""),[ee,Ae]=y.useState(c.autoReconnect),[Re,Ne]=y.useState(!1);if(y.useEffect(()=>{o&&(k(c.wsUrl),$(r?"":c.token),ae(r?"":c.pairCode),D(c.clientId),A(r?"":(C==null?void 0:C.displayName)||""),Ae(c.autoReconnect))},[o,r,c,C]),!o)return null;const de=q=>{q.preventDefault();const J={wsUrl:V.trim()||"/ws/client",token:Z.trim(),pairCode:Q.trim().toUpperCase(),clientId:Se.trim()||c.clientId,autoReconnect:ee};if(!J.token&&!J.pairCode){S("warning",v("pairing.credentialsRequired"));return}r?z({...J,displayName:O.trim()||void 0}):(d(J),B&&O.trim()&&_(B,O),g(),h({wsUrl:J.wsUrl,token:J.token||void 0,pairCode:J.pairCode||void 0,clientId:J.clientId,autoReconnect:ee})),i()},je=()=>{const q=`client-${Math.random().toString(36).substring(2,8)}`;D(q)},Be=()=>{const q=new URL(window.location.href);q.search="",Q.trim()&&q.searchParams.set("pairCode",Q.trim().toUpperCase()),ja(q.toString()).then(J=>{if(J==="failed"){S("error",v("clipboard.copyFailed"));return}Ne(!0),S("success",v("toasts.pairingLinkCopied")),setTimeout(()=>Ne(!1),2e3)})},j=Yx[m]??"idle";return u.jsxs(Uu,{isOpen:o,onClose:i,title:v(r?"pairing.addTitle":"pairing.title"),subtitle:v("pairing.subtitle"),closeLabel:v("common.closeDialog"),hints:[{keys:"esc",action:v("common.close")},{keys:"⏎",action:v("pairing.saveAndConnect")}],footer:u.jsxs(u.Fragment,{children:[m==="connected"&&u.jsx(Ye,{variant:"danger",onClick:()=>{g(),i()},children:v("common.disconnect")}),u.jsx(Ye,{variant:"primary",type:"submit",form:"pairing-form",children:v("pairing.saveAndConnect")})]}),children:[u.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:[u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(Gn,{level:j}),u.jsx("span",{className:"text-tui-muted",children:v("common.status")}),u.jsx("span",{className:W(j==="ok"?"text-tui-ok":j==="bad"?"text-tui-bad":j==="warn"?"text-tui-warn":"text-tui-faint"),children:Pr(m,v).label})]}),b&&u.jsxs("span",{className:"flex items-center gap-1.5 text-tui-muted",children:[v("common.host")," ",u.jsx("span",{className:"text-tui-text",children:b})]})]}),u.jsxs("form",{id:"pairing-form",onSubmit:de,className:"space-y-3",children:[u.jsxs("div",{className:"space-y-1",children:[u.jsx(An,{htmlFor:"pairing-name",children:v("pairing.displayNameLabel")}),u.jsx(Kn,{id:"pairing-name",type:"text",value:O,onChange:q=>A(q.target.value),placeholder:v("pairing.displayNamePlaceholder"),maxLength:64,autoComplete:"off"}),u.jsx("p",{className:"text-tui-sm text-tui-faint",children:v("pairing.displayNameHelp")})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(An,{htmlFor:"pairing-code",hint:v("pairing.pairCodeNote"),children:v("pairing.pairCodeLabel")}),u.jsx(Kn,{id:"pairing-code",type:"text",value:Q,onChange:q=>ae(q.target.value.toUpperCase()),placeholder:v("pairing.pairCodePlaceholder"),maxLength:12,className:"uppercase"}),u.jsx("p",{className:"text-tui-sm text-tui-faint",children:v("pairing.pairCodeHelp")})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(An,{htmlFor:"pairing-token",hint:v("pairing.tokenNote"),children:v("pairing.tokenLabel")}),u.jsx(Kn,{id:"pairing-token",type:"password",value:Z,onChange:q=>$(q.target.value),placeholder:v("pairing.tokenPlaceholder")})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(An,{htmlFor:"pairing-ws",children:v("pairing.wsUrlLabel")}),u.jsx(Kn,{id:"pairing-ws",type:"text",value:V,onChange:q=>k(q.target.value),placeholder:v("pairing.wsUrlPlaceholder")}),u.jsx("p",{className:"text-tui-sm text-tui-faint",children:v("pairing.wsUrlDefaultNote")})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(An,{htmlFor:"pairing-client-id",children:v("pairing.clientIdLabel")}),u.jsxs("div",{className:"flex gap-2",children:[u.jsx(Kn,{id:"pairing-client-id",type:"text",value:Se,onChange:q=>D(q.target.value),className:"flex-1"}),u.jsx(Ye,{onClick:je,title:v("pairing.regenerateClientIdTitle"),className:"shrink-0",children:v("pairing.newIdButton")})]})]}),u.jsx("div",{className:"border-t border-tui-border-dim pt-2",children:u.jsx(Nu,{checked:ee,onChange:Ae,label:v("pairing.autoReconnectLabel"),description:v("pairing.autoReconnectDesc")})}),u.jsx("div",{className:"border-t border-tui-border-dim pt-2",children:u.jsx(Ye,{onClick:Be,block:!0,glyph:Re?qe.check:"⧉",className:W(Re&&"border-tui-ok text-tui-ok"),children:v("pairing.copyDirectLink")})})]})]})},Gx=({isOpen:o,onClose:i})=>{const{settings:r,updateSettings:c,addToast:d,language:h,setLanguage:g,t:m}=Tt(),[b,S]=y.useState("appearance"),[v,C]=y.useState(!1);if(!o)return null;const B=Cu.find(D=>D.font===r.fontFamily),z=r.virtualKeys&&r.virtualKeys.length>0?r.virtualKeys:Ts(),_=()=>{const D=gp();c({fontSize:D.fontSize,fontFamily:D.fontFamily,toolbarVisible:D.toolbarVisible,vibrateOnKeyPress:D.vibrateOnKeyPress,predictiveEcho:D.predictiveEcho,language:D.language,virtualKeys:D.virtualKeys}),d("info",m("settings.resetDefaultsToast"))},V=D=>{const O=z.map(A=>A.id===D?{...A,enabled:!A.enabled}:A);c({virtualKeys:O})},k=(D,O)=>{const A=O==="up"?D-1:D+1;if(A<0||A>=z.length)return;const ee=[...z],Ae=ee[D];ee[D]=ee[A],ee[A]=Ae,c({virtualKeys:ee})},Z=D=>{if(z.some(A=>A.id===D.id)){const A=z.map(ee=>ee.id===D.id?{...ee,enabled:!0}:ee);c({virtualKeys:A})}else{const A=[...z,{...D,enabled:!0}];c({virtualKeys:A})}C(!1)},$=D=>{const O=z.filter(A=>A.id!==D);c({virtualKeys:O})},Q=()=>{c({virtualKeys:Ts()}),d("info",m("toasts.keyLayoutReset"))},ae=10,Se=24;return u.jsxs(Uu,{isOpen:o,onClose:i,title:m("settings.title"),subtitle:m("settings.subtitle"),closeLabel:m("common.closeDialog"),size:"lg",hints:[{keys:"esc",action:m("common.close")}],footer:u.jsxs(u.Fragment,{children:[u.jsx(Ye,{variant:"ghost",onClick:_,children:m("settings.resetDefaults")}),u.jsx(Ye,{variant:"primary",onClick:i,children:m("common.done")})]}),children:[u.jsx(Du,{tabs:[{id:"appearance",label:m("settings.tabAppearance"),index:1},{id:"virtualKeys",label:m("settings.tabVirtualKeys"),index:2}],activeId:b,onSelect:D=>S(D),className:"mb-3 border-b border-tui-border-dim pb-1"}),b==="appearance"&&u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{className:"space-y-1",children:[u.jsx(An,{children:m("settings.languageLabel")}),u.jsxs("div",{className:"grid gap-0.5 sm:grid-cols-2",children:[u.jsx(hs,{name:"ui-language",checked:h==="zh",onChange:()=>g("zh"),label:"简体中文"}),u.jsx(hs,{name:"ui-language",checked:h==="en",onChange:()=>g("en"),label:"English"})]})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(An,{htmlFor:"terminal-font-select",children:m("settings.fontFamilyLabel")}),u.jsxs(Ou,{id:"terminal-font-select",value:r.fontFamily,onChange:D=>c({fontFamily:D.target.value}),"aria-label":m("settings.fontFamilyLabel"),children:[!B&&u.jsx("option",{value:r.fontFamily,children:r.fontFamily}),Cu.map(D=>u.jsx("option",{value:D.font,children:m(`fontPresets.${D.id}`)||D.name},D.id))]}),u.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:[u.jsx("span",{className:"text-tui-ok",children:"$"}),' echo "Herdr 0O 1lI ',' [] () -> => !="']})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(An,{htmlFor:"terminal-font-size",children:m("settings.fontSizeLabel",{size:r.fontSize})}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(Fv,{value:(r.fontSize-ae)/(Se-ae),width:24,className:"hidden shrink-0 sm:inline-flex"}),u.jsx("input",{id:"terminal-font-size",type:"range",min:ae,max:Se,step:1,value:r.fontSize,onChange:D=>c({fontSize:Number(D.target.value)}),className:"h-1 w-full cursor-pointer appearance-none bg-tui-border accent-tui-accent"})]}),u.jsxs("div",{className:"flex justify-between text-tui-sm text-tui-faint",children:[u.jsx("span",{children:m("settings.fontSizeCompact")}),u.jsx("span",{children:m("settings.fontSizeDefault")}),u.jsx("span",{children:m("settings.fontSizeLarge")})]}),u.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:m("settings.mobileFontNote")}),u.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:m("settings.windowZoomSharedNote")})]}),u.jsx(Aa,{}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(An,{children:m("settings.predictiveEchoLabel")}),u.jsxs("div",{className:"grid gap-0.5 sm:grid-cols-3",children:[u.jsx(hs,{name:"predictive-echo",checked:r.predictiveEcho==="auto",onChange:()=>c({predictiveEcho:"auto"}),label:m("settings.predictiveEchoAuto")}),u.jsx(hs,{name:"predictive-echo",checked:r.predictiveEcho==="always",onChange:()=>c({predictiveEcho:"always"}),label:m("settings.predictiveEchoAlways")}),u.jsx(hs,{name:"predictive-echo",checked:r.predictiveEcho==="off",onChange:()=>c({predictiveEcho:"off"}),label:m("settings.predictiveEchoOff")})]}),u.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:m("settings.predictiveEchoDesc")})]}),u.jsx(Aa,{}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(Nu,{checked:r.toolbarVisible,onChange:D=>c({toolbarVisible:D}),label:m("settings.touchKeyToolbar"),description:m("settings.touchKeyToolbarDesc")}),u.jsx(Nu,{checked:r.vibrateOnKeyPress,onChange:D=>c({vibrateOnKeyPress:D}),label:m("settings.touchHaptics"),description:m("settings.touchHapticsDesc")})]}),u.jsx(Aa,{}),u.jsxs("p",{className:"text-tui-sm leading-snug text-tui-faint",children:[u.jsx("span",{"aria-hidden":"true",className:"mr-1",children:qe.arrowRight}),m("settings.colorPassthroughNote")]})]}),b==="virtualKeys"&&u.jsxs("div",{className:"space-y-3",children:[u.jsxs("div",{className:"flex items-start justify-between gap-2",children:[u.jsxs("div",{className:"min-w-0",children:[u.jsx("h3",{className:"text-tui font-bold uppercase text-tui-accent",children:m("virtualKeyboard.customizeTitle")}),u.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:m("virtualKeyboard.customizeDesc")})]}),u.jsx(Ye,{variant:"ghost",onClick:Q,className:"shrink-0",children:m("virtualKeyboard.resetLayout")})]}),u.jsx("div",{className:"max-h-72 overflow-y-auto border border-tui-border bg-tui-mantle",children:z.map((D,O)=>u.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:[u.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[u.jsx("input",{type:"checkbox",checked:D.enabled,onChange:()=>V(D.id),className:"sr-only",id:`toggle-${D.id}`}),u.jsx("label",{htmlFor:`toggle-${D.id}`,className:W("shrink-0 cursor-pointer select-none font-bold",D.enabled?"text-tui-ok":"text-tui-faint"),"aria-hidden":"true",children:D.enabled?"[x]":"[ ]"}),u.jsx(Iv,{className:W(!D.enabled&&"opacity-50"),children:D.label}),u.jsx("span",{className:"truncate text-tui-sm text-tui-muted",children:vu(D,m)})]}),u.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[u.jsx(Ye,{variant:"ghost",brackets:!1,disabled:O===0,onClick:()=>k(O,"up"),title:m("virtualKeyboard.moveUp"),"aria-label":m("virtualKeyboard.moveUp"),className:"px-1",children:"↑"}),u.jsx(Ye,{variant:"ghost",brackets:!1,disabled:O===z.length-1,onClick:()=>k(O,"down"),title:m("virtualKeyboard.moveDown"),"aria-label":m("virtualKeyboard.moveDown"),className:"px-1",children:"↓"}),u.jsx(Ye,{variant:"ghost",brackets:!1,onClick:()=>$(D.id),title:m("virtualKeyboard.deleteKeyTitle"),"aria-label":m("virtualKeyboard.deleteKeyTitle"),className:"px-1 text-tui-bad hover:text-tui-bad",children:qe.cross})]})]},D.id))}),u.jsx(Ye,{block:!0,glyph:"+",onClick:()=>C(!v),className:"border-dashed",children:m("virtualKeyboard.addKey")}),v&&u.jsxs("div",{className:"space-y-2 border border-tui-border bg-tui-mantle p-2",children:[u.jsx(Aa,{label:m("virtualKeyboard.availableKeys")}),u.jsx("div",{className:"flex max-h-48 flex-wrap gap-1 overflow-y-auto",children:jy.map(D=>{const O=z.some(A=>A.id===D.id);return u.jsxs("button",{type:"button",onClick:()=>Z(D),title:vu(D,m),className:W("tui-focusable flex select-none items-center gap-1 border px-1.5 py-0.5 text-tui-sm transition-colors",O?"border-tui-border-dim text-tui-faint":"border-tui-border text-tui-text hover:border-tui-accent hover:text-tui-accent"),children:[u.jsx("span",{children:D.label}),u.jsx("span",{"aria-hidden":"true",className:O?"text-tui-ok":"text-tui-accent",children:O?qe.check:"+"})]},D.id)})})]})]})]})},qx={success:"ok",warning:"warn",error:"bad",info:"accent"},Vx={success:qe.check,warning:qe.warn,error:qe.cross,info:"›"},Xx=()=>{const{toasts:o,removeToast:i,t:r}=Tt();return o.length===0?null:u.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:o.map(c=>{const d=qx[c.type];return u.jsxs("div",{className:W("pointer-events-auto flex items-start gap-2 border border-tui-border border-l-2 bg-tui-base px-2 py-1 text-tui",Yn[d].edgeL),role:"alert",children:[u.jsx("span",{"aria-hidden":"true",className:W("shrink-0 font-bold",Yn[d].text),children:Vx[c.type]}),u.jsx("div",{className:"min-w-0 flex-1 break-words leading-snug text-tui-text",children:c.message}),c.count>1&&u.jsxs("span",{className:"shrink-0 border border-tui-border-dim px-1 text-tui-sm text-tui-muted","aria-label":`×${c.count}`,children:["×",c.count]}),u.jsx("button",{type:"button",onClick:()=>i(c.id),className:"tui-focusable shrink-0 select-none px-0.5 text-tui-faint transition-colors hover:text-tui-bad","aria-label":r("common.dismissNotification"),children:u.jsx("span",{"aria-hidden":"true",children:qe.cross})})]},c.id)})})},Bu=({onAddProfile:o,mobile:i=!1,statusBar:r=!1})=>{const{profiles:c,activeProfileId:d,activeProfile:h,connectionState:g,switchProfile:m,renameProfile:b,removeProfile:S,t:v}=Tt(),[C,B]=y.useState(!1),[z,_]=y.useState(null),[V,k]=y.useState(""),Z=y.useRef(null);y.useEffect(()=>{if(!C)return;const O=A=>{Z.current&&!Z.current.contains(A.target)&&B(!1)};return document.addEventListener("pointerdown",O),()=>document.removeEventListener("pointerdown",O)},[C]);const $=(O,A)=>{_(O),k(A)},Q=O=>{const A=V.trim();A&&b(O,A),_(null)},ae=O=>{typeof window<"u"&&!window.confirm(v("profiles.removeConfirm"))||(S(O),_(null))},Se=(h==null?void 0:h.displayName)||v("profiles.addHost"),D=g==="connected"?"ok":g==="connecting"||g==="reconnecting"?"warn":g==="error"?"bad":"idle";return u.jsxs("div",{ref:Z,className:W("relative min-w-0",i&&"w-full",r&&"flex-1"),children:[u.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":C,"aria-label":v("profiles.switcherLabel"),onClick:()=>B(O=>!O),className:W("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",r?"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:[u.jsx(Gn,{level:D}),u.jsx("span",{className:W("truncate text-tui-text",r&&"min-w-0 flex-1"),children:Se}),u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint",children:C?qe.chevronDown:qe.chevronRight})]}),C&&u.jsxs("div",{role:"menu","aria-label":v("profiles.switcherLabel"),className:W("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",r?"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:[u.jsx("div",{className:"border-b border-tui-border-dim px-2 py-1 text-tui-sm uppercase text-tui-faint",children:v("profiles.title")}),c.length===0?u.jsx("p",{className:"px-2 py-2 text-tui-sm text-tui-muted",children:v("profiles.empty")}):c.map(O=>{const A=O.id===d,ee=O.id===z;return u.jsxs("div",{role:"none",className:"border-b border-tui-border-dim last:border-b-0",children:[u.jsxs("div",{className:"flex items-center gap-1",children:[u.jsxs("button",{type:"button",role:"menuitem","aria-current":A?"true":void 0,onClick:()=>{m(O.id),B(!1)},className:W("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",A?"text-tui-accent":"text-tui-text"),children:[u.jsx("span",{"aria-hidden":"true",className:"w-3 shrink-0",children:A?qe.cursor:""}),u.jsxs("span",{className:"min-w-0 flex-1",children:[u.jsx("span",{className:"block truncate font-bold",children:O.displayName}),u.jsx("span",{className:"block truncate text-tui-sm text-tui-faint",title:O.hostname||O.hostId,children:O.hostname||O.hostId||O.wsUrl})]}),A&&u.jsx("span",{className:"shrink-0 text-tui-sm text-tui-ok",children:v("profiles.current")})]}),u.jsx("button",{type:"button",role:"menuitem","aria-label":v("profiles.rename"),title:v("profiles.rename"),onClick:()=>$(O.id,O.displayName),className:"tui-focusable min-h-11 min-w-11 px-2 text-tui-muted hover:text-tui-accent",children:qe.ellipsis})]}),ee&&u.jsxs("div",{className:"flex items-center gap-1 px-2 pb-2",children:[u.jsx("input",{autoFocus:!0,value:V,maxLength:64,onChange:Ae=>k(Ae.target.value),onKeyDown:Ae=>{Ae.key==="Enter"&&Q(O.id),Ae.key==="Escape"&&_(null)},"aria-label":v("profiles.rename"),className:"tui-input min-w-0 flex-1 px-2 py-1 text-tui"}),u.jsx(Ye,{onClick:()=>Q(O.id),variant:"primary",className:"min-h-11",children:v("common.save")}),u.jsx(Ye,{onClick:()=>ae(O.id),variant:"danger",className:"min-h-11",children:v("profiles.remove")})]})]},O.id)}),u.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{B(!1),o()},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:[u.jsx("span",{"aria-hidden":"true",children:"+"}),u.jsx("span",{children:v("profiles.addHost")})]})]})]})},Fx=({onAddProfile:o=()=>{}})=>{const{connectionState:i,role:r,hostId:c,assignedClientId:d,sharedWindowCount:h,settings:g,rttMs:m,t:b}=Tt(),S=Pr(i,b),v=i==="connected";return u.jsx(Kp,{left:u.jsxs(u.Fragment,{children:[u.jsx(Bu,{onAddProfile:o}),u.jsx(Km,{items:[u.jsxs("span",{className:"flex items-center gap-1",children:[u.jsx(Gn,{level:S.level}),u.jsx("span",{className:"text-tui-text",children:S.label})]},"status"),v?u.jsx(Wr,{tone:r==="controller"?"ok":"warn",children:b(r==="controller"?"role.sharedControl":"common.viewer")},"role"):null,v&&h>1?u.jsx("span",{className:"text-tui-muted",children:b("role.sharedWindows",{count:h})},"windows"):null,c?u.jsxs("span",{children:[u.jsxs("span",{className:"text-tui-faint",children:[b("common.host"),":"]})," ",u.jsx("span",{className:"text-tui-text",children:c})]},"host"):null,u.jsxs("span",{children:[u.jsx("span",{className:"text-tui-faint",children:b("header.clientIdLabel")})," ",u.jsx("span",{className:"text-tui-text",children:d||g.clientId})]},"client")]})]}),right:u.jsx(Km,{items:[m!==null?u.jsxs("span",{className:"text-tui-muted",children:[b("header.latencyTitle"),": ",u.jsxs("span",{className:"text-tui-text",children:[m,"ms"]})]},"rtt"):null,u.jsx("span",{className:"hidden text-tui-faint sm:inline",children:b("header.tagline")},"mode")]})})},Zx=[[/\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"]],Qx=[[/\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 $m(o,i){for(const[r,c]of o)if(r.test(i))return c;return null}function Hu(o){const i=typeof o=="string"?o.trim():"";if(!i)return{label:"",raw:""};const r=$m(Zx,i),c=$m(Qx,i);return r&&c?{label:`${r} · ${c}`,raw:i}:r?{label:r,raw:i}:c?{label:c,raw:i}:{label:i.length>32?`${i.slice(0,32)}…`:i,raw:i}}function ep(o){if(o===0)return"0 B";const i=1024,r=["B","KB","MB","GB"],c=Math.floor(Math.log(o)/Math.log(i));return`${(o/Math.pow(i,c)).toFixed(1)} ${r[c]}`}const Ix=({clients:o})=>{const{t:i}=Tt(),r=[{key:"id",header:i("admin.colClientId"),render:c=>u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(Gn,{level:"ok"}),u.jsx("span",{className:"font-bold text-tui-text",children:c.id})]})},{key:"role",header:i("admin.colRole"),width:12,render:c=>{const d=c.role==="controller";return u.jsx(Wr,{tone:d?"ok":"warn",children:i(d?"common.controller":"common.viewer")})}},{key:"device",header:i("admin.colDevice"),render:c=>{const d=Hu(c.userAgent);return d.label?u.jsx("span",{className:"text-tui-muted",title:d.raw,children:d.label}):u.jsx("span",{className:"text-tui-faint",children:i("admin.unknownDevice")})}},{key:"ip",header:i("admin.colIp"),render:c=>u.jsx("span",{className:"text-tui-muted",children:c.ip||"127.0.0.1"})},{key:"connectedAt",header:i("admin.colConnectedAt"),render:c=>u.jsx("span",{className:"text-tui-muted",children:c.connectedAt?new Date(c.connectedAt).toLocaleTimeString():i("admin.startedRecently")})},{key:"traffic",header:i("admin.colTraffic"),align:"right",render:c=>u.jsxs("span",{className:"whitespace-nowrap",children:[u.jsx("span",{className:"text-tui-accent",children:ep(c.bytesReceived||0)}),u.jsx("span",{"aria-hidden":"true",className:"mx-1 text-tui-faint",children:"/"}),u.jsx("span",{className:"text-tui-ok",children:ep(c.bytesSent||0)})]})}];return u.jsx(sn,{title:i("admin.connectedClientsTitle",{count:o.length}),bodyClassName:"-mx-1",children:u.jsx(Lu,{columns:r,items:o,rowKey:c=>c.id,empty:i("admin.noClients")})})},tp={online:"ok",busy:"ok",reconnecting:"warn",offline:"idle"};function Jx(o=[],i=[]){const r=new Map;for(const h of i){if(!(h!=null&&h.hostId))continue;const g=r.get(h.hostId);g?g.push(h):r.set(h.hostId,[h])}const c=o.map(h=>{const g=r.get(h.id)||[];return{id:h.id,hostname:h.hostname||h.id,status:h.status||"online",connectedDeviceCount:h.connectedDeviceCount??0,pairedDeviceCount:h.pairedDeviceCount??g.length,devices:g,fromRosterOnly:!1}}),d=new Set(c.map(h=>h.id));for(const[h,g]of r)d.has(h)||c.push({id:h,hostname:h,status:"offline",connectedDeviceCount:0,pairedDeviceCount:g.length,devices:g,fromRosterOnly:!0});return c.sort((h,g)=>h.fromRosterOnly!==g.fromRosterOnly?h.fromRosterOnly?1:-1:h.hostname.localeCompare(g.hostname))}const Wx=({hosts:o,devices:i})=>{const{t:r}=Tt(),c=Jx(o,i),d={online:r("admin.hostStatusOnline"),busy:r("admin.hostStatusBusy"),reconnecting:r("admin.hostStatusReconnecting"),offline:r("admin.hostStatusOffline")};return u.jsx(sn,{title:r("admin.hostsTitle",{count:c.length}),bodyClassName:"space-y-2",children:c.length===0?u.jsx("p",{className:"px-1 py-2 text-tui text-tui-faint",children:r("admin.noHosts")}):c.map(h=>u.jsxs("div",{className:"border border-tui-border-dim bg-tui-mantle",children:[u.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:[u.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-tui",children:[u.jsx(Gn,{level:tp[h.status]}),u.jsx("span",{className:"truncate font-bold text-tui-text",children:h.hostname}),h.hostname!==h.id?u.jsx("code",{className:"truncate text-tui-sm text-tui-faint",children:h.id}):null]}),u.jsxs("span",{className:"flex shrink-0 items-center gap-3 text-tui-sm",children:[u.jsx(Wr,{tone:tp[h.status],children:d[h.status]}),u.jsx("span",{className:"text-tui-accent",children:r("admin.hostConnectedDevices",{count:h.connectedDeviceCount})}),u.jsx("span",{className:"text-tui-muted",children:r("admin.hostPairedDevices",{count:h.pairedDeviceCount})})]})]}),h.devices.length>0?u.jsx("ul",{className:"divide-y divide-tui-border-dim",children:h.devices.map(g=>{const m=Hu(g.userAgent);return u.jsxs("li",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-0.5 px-2 py-0.5 text-tui",children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint",children:"·"}),u.jsx("span",{className:"truncate text-tui-text",title:m.raw,children:m.label||r("admin.unknownDevice")}),u.jsx("code",{className:"truncate text-tui-sm text-tui-muted",children:g.deviceId}),u.jsx("span",{className:"ml-auto shrink-0 text-tui-sm text-tui-faint",children:g.lastIp||"—"})]},g.deviceId)})}):u.jsx("p",{className:"px-2 py-1 text-tui-sm text-tui-faint",children:h.pairedDeviceCount>0?r("admin.hostRosterOperatorOnly"):r("admin.noDevices")})]},h.id))})},Px=({ptys:o})=>{const{t:i}=Tt(),r=[{key:"id",header:i("admin.colPtyId"),render:c=>u.jsx("span",{className:"font-bold text-tui-accent",children:c.id})},{key:"pid",header:i("admin.colPid"),width:9,render:c=>u.jsx("span",{className:"text-tui-muted",children:c.pid})},{key:"command",header:i("admin.colCommand"),render:c=>u.jsx("code",{className:"border border-tui-border-dim bg-tui-mantle px-1 text-tui-text",children:c.command})},{key:"grid",header:i("admin.colGrid"),width:11,render:c=>u.jsxs("span",{className:"whitespace-nowrap text-tui-muted",children:[c.cols,u.jsx("span",{"aria-hidden":"true",className:"mx-0.5 text-tui-faint",children:"×"}),c.rows]})},{key:"cwd",header:i("admin.colCwd"),className:"max-w-xs truncate",render:c=>u.jsx("span",{className:"text-tui-muted",children:c.cwd||"~"})},{key:"viewers",header:i("admin.colViewers"),align:"right",width:9,render:c=>u.jsx("span",{className:"font-bold text-tui-ok",children:c.activeClients})}];return u.jsx(sn,{title:i("admin.activePtysTitle",{count:o.length}),bodyClassName:"-mx-1",children:u.jsx(Lu,{columns:r,items:o,rowKey:c=>c.id,empty:i("admin.noPtys")})})};function $x(o){if(!o)return"—";const i=new Date(o);return Number.isNaN(i.getTime())?"—":i.toLocaleString()}const e0=({devices:o,onRevoke:i})=>{const{t:r}=Tt(),[c,d]=y.useState(null),[h,g]=y.useState(null),m=async S=>{if(c!==S){d(S);return}g(S);try{await i(S)}finally{g(null),d(null)}},b=[{key:"device",header:r("admin.colDevice"),render:S=>{const v=Hu(S.userAgent);return u.jsx("span",{className:"text-tui-text",title:v.raw,children:v.label||r("admin.unknownDevice")})}},{key:"deviceId",header:r("admin.colDeviceId"),render:S=>u.jsx("span",{className:"text-tui-muted",children:S.deviceId})},{key:"ip",header:r("admin.colIp"),render:S=>u.jsx("span",{className:"text-tui-muted",children:S.lastIp||"—"})},{key:"lastSeen",header:r("admin.colLastSeen"),render:S=>u.jsx("span",{className:"whitespace-nowrap text-tui-muted",children:$x(S.lastSeenAt)})},{key:"actions",header:r("admin.colActions"),align:"right",render:S=>{const v=c===S.deviceId,C=h===S.deviceId;return u.jsx(Ye,{variant:"danger",disabled:C,onClick:()=>void m(S.deviceId),onBlur:()=>d(B=>B===S.deviceId?null:B),"aria-label":r("admin.revokeDevice"),className:v?"bg-tui-bad text-tui-crust":void 0,children:C?u.jsx(yi,{}):r(v?"admin.revokeConfirm":"admin.revokeDevice")})}}];return u.jsx(sn,{title:r("admin.pairedDevicesTitle",{count:o.length}),bodyClassName:"-mx-1",children:u.jsx(Lu,{columns:b,items:o,rowKey:S=>S.deviceId,empty:r("admin.noDevices")})})};function Qp(o){if(typeof window>"u"||!o||o.startsWith("/"))return"";try{const i=new URL(o.replace(/^ws/,"http")),r=i.pathname.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"");return i.origin===window.location.origin&&!r?"":`${i.origin}${r}`}catch{return""}}function ys(o,i){const r=Qp(o);return r?`${r}${i.startsWith("/")?i:`/${i}`}`:i}const t0=({onBackToTerminal:o,onOpenPairing:i})=>{var Ie,pt,xt,Dt,St,Rn,wt,ut,At,Ot,Wt,Ft,Ct,Gt;const{settings:r,updateSettings:c,addToast:d,t:h}=Tt(),g=Qp(r.wsUrl)||(typeof window<"u"?window.location.origin:"local"),m=((Ie=r.adminTokens)==null?void 0:Ie[g])||(g===(typeof window<"u"?window.location.origin:"local")?r.adminToken:"")||"",[b,S]=y.useState(null),[v,C]=y.useState(null),[B,z]=y.useState(!1),[_,V]=y.useState(!0),[k,Z]=y.useState(null),[$,Q]=y.useState(!1),[ae,Se]=y.useState(3e3),[D,O]=y.useState(null),[A,ee]=y.useState("overview"),[Ae,Re]=y.useState(!1),[Ne,de]=y.useState(m),[je,Be]=y.useState(!!m),j="node bin/service.js pair";y.useEffect(()=>{de(m),Be(!!m),S(null),C(null),z(!1)},[g]);const q=()=>{ja(j).then(te=>{if(te==="failed"){d("error",h("clipboard.copyFailed"));return}Re(!0),d("success",h("toasts.commandCopied")),setTimeout(()=>Re(!1),2e3)})};y.useEffect(()=>{let te=!0;V(!0);async function xe(){try{const ye=await fetch(ys(r.wsUrl,"/api/info"),{headers:{Accept:"application/json"}});if(ye.ok){const Pe=await ye.json();te&&(C(Pe),z(!0));return}}catch{}if(te){const ye=!!(r.wsUrl&&!r.wsUrl.startsWith("/")&&!r.wsUrl.includes("localhost")&&!r.wsUrl.includes("127.0.0.1")&&typeof window<"u"&&!r.wsUrl.startsWith(window.location.origin.replace("http","ws")));C({ok:!0,version:"0.1.0",protocol:1,relayMode:ye?"remote":"local",adminConfigured:!1,adminPath:"/admin",adminStatusPath:"/api/admin/status"}),z(!0)}}return xe(),()=>{te=!1}},[r.wsUrl,g]);const J=(v==null?void 0:v.relayMode)==="remote",we=()=>{if(v!=null&&v.adminPath)return v.publicUrl?`${v.publicUrl.replace(/\/$/,"")}${v.adminPath}`:ys(r.wsUrl,v.adminPath);if(b!=null&&b.remoteAdminUrl)return b.remoteAdminUrl;if(r.wsUrl)try{return ys(r.wsUrl,"/admin")}catch{}return"/admin"},H=y.useCallback(async()=>{if(B){if(J){if(!je&&!Ne){S(null),V(!1),Z(null),Q(!1);return}try{V(!0);const te=ys(r.wsUrl,(v==null?void 0:v.adminStatusPath)||"/api/admin/status"),ye=await fetch(te,{headers:{Accept:"application/json","X-Relay-Admin-Token":Ne}});if(ye.status===401||ye.status===403){Q(!0),Z(h("admin.relayAdminAuthError")),S(null);return}if(!ye.ok)throw new Error(`HTTP ${ye.status}: ${ye.statusText}`);const Pe=await ye.json();S(Pe),Z(null),Q(!1),O(new Date)}catch(te){console.warn("GET /api/admin/status request failed:",te),Q(!1),Z(te instanceof Error?te.message:"Failed to fetch remote admin status"),S(null)}finally{V(!1)}return}try{V(!0);const te={Accept:"application/json"};r.token&&(te.Authorization=`Bearer ${r.token}`);const xe=await fetch("/api/status",{headers:te});if(xe.status===401||xe.status===403){Q(!0),Z(`Authentication failed (HTTP ${xe.status}): Access denied. Please configure an authorized token or pair with the host.`),S(null);return}if(!xe.ok)throw new Error(`HTTP ${xe.status}: ${xe.statusText}`);const ye=await xe.json();S(ye),Z(null),Q(!1),O(new Date)}catch(te){console.warn("GET /api/status request failed:",te),Q(!1),Z(te instanceof Error?te.message:"Failed to fetch status"),S(null)}finally{V(!1)}}},[B,J,je,Ne,v,r.token,r.wsUrl,g,h]),Ve=y.useCallback(async te=>{try{if(!(await fetch(ys(r.wsUrl,`/api/admin/devices/${encodeURIComponent(te)}`),{method:"DELETE",headers:{Accept:"application/json","X-Relay-Admin-Token":Ne}})).ok){Z(h("admin.revokeFailed"));return}await H()}catch{Z(h("admin.revokeFailed"))}},[Ne,H,r.wsUrl,h]);y.useEffect(()=>{if(!B)return;H();let te=null;const xe=()=>{ae>0&&!te&&(te=setInterval(()=>{document.visibilityState==="visible"&&H()},ae))},ye=()=>{te&&(clearInterval(te),te=null)},Pe=()=>{document.visibilityState==="visible"?(H(),xe()):ye()};return xe(),document.addEventListener("visibilitychange",Pe),()=>{ye(),document.removeEventListener("visibilitychange",Pe)}},[B,H,ae]);const X=te=>{te.preventDefault();const xe=Ne.trim();c({adminToken:xe,adminTokens:{...r.adminTokens||{},[g]:xe}}),Be(!!xe)},me=te=>{const xe=Math.max(0,Math.floor(te)),ye=Math.floor(xe/86400),Pe=Math.floor(xe%86400/3600),Lt=Math.floor(xe%3600/60),rn=xe%60,ft=(kl,Rt)=>`${kl}${h(`admin.unit${Rt}`)}`;return ye>0?[ft(ye,"Day"),ft(Pe,"Hour"),ft(Lt,"Minute")].join(" "):Pe>0?[ft(Pe,"Hour"),ft(Lt,"Minute"),ft(rn,"Second")].join(" "):[ft(Lt,"Minute"),ft(rn,"Second")].join(" ")},_e=te=>{if(!te||te===0)return"0 B";const xe=1024,ye=["B","KB","MB","GB"],Pe=Math.floor(Math.log(te)/Math.log(xe));return`${(te/Math.pow(xe,Pe)).toFixed(1)} ${ye[Pe]}`},ve=()=>{const te=we();window.open(te,"_blank","noopener,noreferrer")},fe=b?b.activeUserCount??((pt=b.clients)==null?void 0:pt.length)??0:0,vt=b?[{id:"overview",label:h("admin.tabOverview"),index:1},{id:"clients",label:h("admin.tabClients",{count:((xt=b.clients)==null?void 0:xt.length)||0}),index:2},{id:"ptys",label:h("admin.tabPtys",{count:((Dt=b.ptys)==null?void 0:Dt.length)||0}),index:3},...b.devices?[{id:"devices",label:h("admin.tabDevices",{count:b.devices.length}),index:4}]:[]]:[],Oe=vt.map(te=>te.id);y.useEffect(()=>{const te=xe=>{if(xe.ctrlKey||xe.altKey||xe.metaKey)return;const ye=xe.target;if(ye instanceof HTMLInputElement||ye instanceof HTMLTextAreaElement||ye instanceof HTMLSelectElement||ye!=null&&ye.isContentEditable||document.querySelector('[role="dialog"]'))return;if(xe.key==="Escape"&&o){xe.preventDefault(),o();return}if(xe.key.toLowerCase()==="r"){xe.preventDefault(),H();return}const Pe=Number.parseInt(xe.key,10)-1;Number.isInteger(Pe)&&Pe>=0&&Pe<Oe.length&&(xe.preventDefault(),ee(Oe[Pe]))};return window.addEventListener("keydown",te),()=>window.removeEventListener("keydown",te)},[H,Oe.join("|")]);const Me=u.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[o&&u.jsx(Ye,{variant:"ghost",onClick:o,title:h("admin.returnToTerminal"),"aria-label":h("admin.returnToTerminal"),glyph:qe.arrowLeft,brackets:!1,className:"shrink-0",children:u.jsx("span",{className:"sr-only",children:h("admin.returnToTerminal")})}),u.jsxs("span",{className:"hidden text-tui-sm text-tui-accent sm:inline",children:["v",(v==null?void 0:v.version)||(b==null?void 0:b.version)||"0.1.0"]}),u.jsx(Wr,{tone:J?"alt":"ok",children:h(J?"admin.modeRemote":"admin.localWorkstationBadge")}),u.jsxs("label",{className:"hidden items-center gap-1.5 text-tui-sm text-tui-muted md:flex",children:[u.jsx("span",{children:h("admin.autoRefresh")}),u.jsxs(Ou,{value:ae,onChange:te=>Se(Number(te.target.value)),"aria-label":h("admin.autoRefresh"),className:"w-auto",children:[u.jsx("option",{value:0,children:h("admin.paused")}),u.jsx("option",{value:1e3,children:"1s"}),u.jsx("option",{value:3e3,children:"3s"}),u.jsx("option",{value:5e3,children:"5s"}),u.jsx("option",{value:1e4,children:"10s"})]})]}),u.jsx(Ye,{variant:"primary",onClick:H,disabled:_,title:h("admin.refreshNow"),children:_?u.jsx(yi,{}):h("admin.refreshNow")})]});return u.jsxs(Jv,{name:h("admin.title"),tagline:h("admin.subtitle"),aside:Me,tabs:vt,activeTabId:A,onSelectTab:te=>ee(te),tabsAriaLabel:h("header.mainNavigationAria"),hints:[{keys:"1–4",action:h("admin.hintTabs")},{keys:"r",action:h("admin.hintRefresh")},...o?[{keys:"esc",action:h("admin.hintBack")}]:[]],footerAside:D?u.jsx("span",{className:"text-tui-faint",children:h("admin.updatedAt",{time:D.toLocaleTimeString()})}):null,bodyClassName:"space-y-3 pb-2",children:[!B&&u.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:u.jsx(yi,{label:h("admin.loadingStatus")})}),B&&J&&!je&&u.jsxs(sn,{title:h("admin.remoteRelayTitle"),aside:h("admin.remoteRelayBadge"),bodyClassName:"space-y-2",children:[u.jsx("p",{className:"text-tui leading-snug text-tui-muted",children:h("admin.remoteRelayNotice")}),u.jsxs("div",{className:"space-y-0.5 border border-tui-border-dim bg-tui-mantle px-2 py-1.5",children:[u.jsx(Jn,{label:h("admin.remoteRelayEndpoint"),labelWidth:18,children:u.jsx("code",{className:"break-all text-tui-accent",children:r.wsUrl})}),u.jsx(Jn,{label:h("admin.remoteRelayAdminUrl"),labelWidth:18,children:u.jsx("code",{className:"break-all text-tui-ok",children:we()})})]}),u.jsx(Aa,{}),u.jsxs("div",{className:"flex flex-col items-start justify-between gap-2 sm:flex-row sm:items-center",children:[u.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:h("admin.remoteRelayHelp")}),u.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[u.jsx(Ye,{onClick:()=>Be(!0),children:h("admin.relayAdminLoginBtn")}),u.jsx(Ye,{variant:"primary",onClick:ve,glyph:qe.arrowRight,children:h("admin.openRemoteAdminBtn")})]})]})]}),B&&J&&je&&!b&&u.jsxs(sn,{title:h("admin.relayAdminTitle"),bodyClassName:"space-y-2",children:[u.jsx(Vr,{tone:(v==null?void 0:v.adminConfigured)===!1?"warn":"bad",children:(v==null?void 0:v.adminConfigured)===!1?h("admin.relayAdminNotConfigured"):h("admin.relayAdminAuthError")}),u.jsxs("form",{onSubmit:X,className:"space-y-2",children:[u.jsxs("div",{className:"space-y-1",children:[u.jsx(An,{htmlFor:"relay-admin-token",children:h("admin.relayAdminTokenLabel")}),u.jsx(Kn,{id:"relay-admin-token",type:"password",value:Ne,onChange:te=>de(te.target.value),placeholder:h("admin.relayAdminTokenPlaceholder")})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(Ye,{variant:"primary",type:"submit",children:h("admin.relayAdminLoginBtn")}),u.jsx(Ye,{variant:"ghost",onClick:()=>Be(!1),children:h("common.cancel")})]})]})]}),B&&!J&&$&&u.jsxs(sn,{title:h("admin.unauthorizedTitle"),tone:"bad",bodyClassName:"space-y-2",children:[u.jsx(Vr,{tone:"bad",children:h("admin.unauthorizedDesc")}),u.jsxs("div",{className:"space-y-1.5 border border-tui-border-dim bg-tui-mantle px-2 py-1.5",children:[u.jsx("span",{className:"block text-tui-sm uppercase text-tui-muted",children:h("admin.pairingStepsTitle")}),u.jsxs("div",{className:"flex items-center gap-2 border border-tui-border bg-tui-crust px-2 py-1",children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 select-none text-tui-ok",children:"$"}),u.jsx("code",{className:"min-w-0 flex-1 truncate text-tui-text",children:j}),u.jsx(Ye,{onClick:q,glyph:Ae?qe.check:"⧉",className:W("shrink-0",Ae&&"border-tui-ok text-tui-ok"),children:h(Ae?"admin.copiedJson":"common.copy")})]}),u.jsx("p",{className:"text-tui-sm text-tui-faint",children:h("admin.pairingStepsHelp")})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[i&&u.jsx(Ye,{variant:"primary",onClick:i,children:h("admin.enterPairCodeBtn")}),u.jsx(Ye,{onClick:H,children:h("admin.retryFetchBtn")})]})]}),B&&k&&!$&&!(!J&&$)&&u.jsx(Vr,{tone:"warn",action:u.jsx(Ye,{variant:"warn",onClick:H,children:h("common.retry")}),children:h("admin.errorConnecting",{error:k})}),b&&u.jsxs(u.Fragment,{children:[A==="overview"&&u.jsxs("div",{className:"space-y-2",children:[u.jsxs("div",{className:"grid grid-cols-1 gap-2 md:grid-cols-2",children:[u.jsxs(sn,{title:h("admin.accessPanel"),aside:me(b.uptimeSeconds||0),bodyClassName:"space-y-0.5",children:[u.jsx(Jn,{label:h("admin.connectedHosts"),labelWidth:14,children:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(Gn,{level:(St=b.hosts)!=null&&St.length?"ok":"idle"}),u.jsx("span",{className:"font-bold",children:((Rn=b.hosts)==null?void 0:Rn.length)||0})]})}),u.jsx(Jn,{label:h("admin.activeUsers"),labelWidth:14,children:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(Gn,{level:fe?"ok":"idle"}),u.jsx("span",{className:"font-bold",children:fe}),u.jsx("span",{className:"text-tui-faint",children:h("admin.acrossWindows",{count:((wt=b.clients)==null?void 0:wt.length)||0})})]})}),u.jsxs(Jn,{label:h("admin.activePtys"),labelWidth:14,children:[u.jsx("span",{className:"font-bold",children:((ut=b.ptys)==null?void 0:ut.length)||0}),u.jsx("span",{className:"ml-1.5 text-tui-faint",children:h("admin.terminalShells")})]}),u.jsx(Jn,{label:h("admin.uptime"),labelWidth:14,children:u.jsx("span",{className:"text-tui-muted",children:b.startTime?h("admin.startedAt",{time:new Date(b.startTime).toLocaleTimeString()}):h("admin.startedRecently")})})]}),u.jsxs(sn,{title:h("admin.throughput"),aside:h("admin.perSecond",{value:_e(((At=b.throughput)==null?void 0:At.bytesOutPerSec)||0)}),bodyClassName:"space-y-0.5",children:[u.jsxs(Jn,{label:h("admin.bytesInTotal"),labelWidth:13,children:[u.jsx("span",{className:"font-bold text-tui-accent",children:_e(((Ot=b.throughput)==null?void 0:Ot.bytesIn)||0)}),u.jsx("span",{className:"ml-1.5 text-tui-faint",children:h("admin.perSecond",{value:_e(((Wt=b.throughput)==null?void 0:Wt.bytesInPerSec)||0)})})]}),u.jsxs(Jn,{label:h("admin.bytesOutTotal"),labelWidth:13,children:[u.jsx("span",{className:"font-bold text-tui-ok",children:_e(((Ft=b.throughput)==null?void 0:Ft.bytesOut)||0)}),u.jsx("span",{className:"ml-1.5 text-tui-faint",children:h("admin.perSecond",{value:_e(((Ct=b.throughput)==null?void 0:Ct.bytesOutPerSec)||0)})})]}),u.jsx(Aa,{}),u.jsx(Jn,{label:h("admin.frameRate"),labelWidth:13,children:u.jsx("span",{className:"font-bold",children:h("admin.framesPerSecond",{count:(((Gt=b.throughput)==null?void 0:Gt.framesOutPerSec)||0).toFixed(0)})})})]})]}),u.jsx(Wx,{hosts:b.hosts||[],devices:b.devices})]}),A==="clients"&&u.jsx(Ix,{clients:b.clients||[]}),A==="ptys"&&u.jsx(Px,{ptys:b.ptys||[]}),A==="devices"&&u.jsx(e0,{devices:b.devices||[],onRevoke:Ve})]})]})},n0=({compact:o=!1})=>{const{role:i,connectionState:r,sharedWindowCount:c,assignedClientId:d,t:h}=Tt();if(!(r==="connected"))return u.jsxs("div",{className:"inline-flex select-none items-center gap-1.5 text-tui uppercase text-tui-faint",role:"status","aria-label":h("terminal.offlineStatusAria"),children:[u.jsx(Gn,{level:"idle"}),u.jsx("span",{children:h("common.offline")})]});const m=i==="controller",b=c>1,S=u.jsxs("div",{className:W("inline-flex min-w-0 select-none items-center gap-1.5 text-tui uppercase",m?"text-tui-ok":"text-tui-warn"),role:"status","aria-label":h(m?"role.controllerMode":"role.viewerMode"),children:[u.jsx(Gn,{level:m?"ok":"warn"}),u.jsx("span",{className:"truncate",children:h(m?"role.sharedControl":"role.viewerReadOnly")}),b?u.jsx("span",{className:"shrink-0 normal-case text-tui-muted",children:h("role.sharedWindows",{count:c})}):null]});return o?S:u.jsxs("div",{className:"flex w-full flex-col gap-1",children:[S,u.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:h("role.sharedControlDesc")}),d?u.jsx(Jn,{label:h("role.thisWindow"),labelWidth:9,className:"text-tui-sm",children:u.jsx("span",{className:"truncate text-tui-muted",children:d})}):null]})},vs="tui-focusable group flex h-11 w-full select-none items-center gap-2 border px-2 text-left text-tui transition-colors",xs="border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",l0="border-tui-accent bg-tui-selection text-tui-accent",Ss=({active:o=!1})=>u.jsx("span",{"aria-hidden":"true",className:W("shrink-0",o?"text-tui-accent":"text-tui-faint group-hover:text-tui-accent"),children:qe.cursor}),a0=({onClose:o,onNavigateAdmin:i,showAdminEntry:r=!0,onOpenPairing:c,onOpenSettings:d,onAddProfile:h=()=>{}})=>{const{connectionState:g,stateDetail:m,rttMs:b,hostId:S,settings:v,updateSettings:C,connect:B,addToast:z,language:_,setLanguage:V,t:k}=Tt(),[Z,$]=il.useState(!1),Q=Pr(g,k),ae=O=>()=>{var ee;const A=document.activeElement;(ee=A==null?void 0:A.blur)==null||ee.call(A),O()},Se=()=>{ja(v.clientId).then(O=>{if(O==="failed"){z("error",k("clipboard.copyFailed"));return}$(!0),z("info",k("toasts.clientIdCopied",{id:v.clientId})),setTimeout(()=>$(!1),2e3)})},D=()=>{const O=_==="zh"?"en":"zh";V(O),z("info",_u(O,"toasts.switchedLanguage",{lang:O==="zh"?"简体中文":"English"}))};return u.jsxs("div",{className:"flex flex-col gap-3 px-3 pb-2 pt-2",children:[u.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-tui-border pb-1.5",children:[u.jsx("h2",{className:"text-tui font-bold uppercase text-tui-accent",children:k("mobile.sessionControls")}),u.jsx(Ye,{variant:"ghost",onClick:o,"aria-label":k("mobile.closeSessionControls"),children:"esc"})]}),u.jsx(sn,{title:k("profiles.title"),tone:"accent",bodyClassName:"space-y-1",children:u.jsx(Bu,{mobile:!0,onAddProfile:h})}),u.jsxs(sn,{title:k("common.status"),tone:Q.level==="ok"?"ok":Q.level==="bad"?"bad":"warn",bodyClassName:"space-y-1.5",children:[u.jsxs("div",{className:"flex items-center justify-between gap-2","aria-label":k("mobile.connectionStatusAria"),children:[u.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[u.jsx(Gn,{level:Q.level}),u.jsx("span",{className:"truncate text-tui uppercase text-tui-text",children:Q.label}),g==="connected"&&b!==null&&u.jsxs("span",{className:"text-tui-sm text-tui-muted",children:[b,"ms"]})]}),Q.actionLabel&&u.jsx(Ye,{variant:"primary",onClick:()=>B(),className:"shrink-0",children:Q.actionLabel})]}),Q.needsAttention&&m&&u.jsx("p",{className:"text-tui-sm leading-snug text-tui-muted",children:m}),S&&u.jsx(Jn,{label:k("common.host"),labelWidth:9,children:S}),u.jsxs("button",{type:"button",onClick:Se,className:"tui-focusable flex w-full items-baseline gap-2 text-left text-tui",title:k("header.copyClientIdTitle"),children:[u.jsx("span",{className:"shrink-0 text-tui-muted",style:{width:"9ch"},children:k("header.clientIdLabel")}),u.jsx("span",{className:"min-w-0 flex-1 truncate text-tui-text",children:v.clientId}),u.jsx("span",{"aria-hidden":"true",className:W("shrink-0",Z?"text-tui-ok":"text-tui-faint"),children:Z?qe.check:"⧉"})]})]}),u.jsx(sn,{title:k("mobile.inputControl"),tone:"accent","aria-label":k("mobile.terminalControlAria"),children:u.jsx(n0,{})}),u.jsxs(sn,{title:k("mobile.menu"),tone:"accent",bodyClassName:"flex flex-col gap-1",children:[u.jsxs("button",{type:"button",onClick:D,className:W(vs,xs),"aria-label":k("header.languageToggleTitle"),children:[u.jsx(Ss,{}),u.jsx("span",{className:"truncate",children:_==="zh"?"English":"中文"})]}),u.jsxs("button",{type:"button",onClick:ae(d),className:W(vs,xs),"aria-label":k("mobile.settingsAria"),children:[u.jsx(Ss,{}),u.jsx("span",{className:"truncate",children:k("common.settings")})]}),u.jsxs("button",{type:"button",onClick:ae(c),className:W(vs,xs),"aria-label":k("mobile.pairingAria"),children:[u.jsx(Ss,{}),u.jsx("span",{className:"truncate",children:k("common.pairing")})]}),r&&u.jsxs("button",{type:"button",onClick:ae(i),className:W(vs,xs),"aria-label":k("mobile.adminAria"),children:[u.jsx(Ss,{}),u.jsx("span",{className:"truncate",children:k("common.admin")})]}),u.jsxs("button",{type:"button",onClick:()=>C({toolbarVisible:!v.toolbarVisible}),className:W(vs,v.toolbarVisible?l0:xs),"aria-label":k("mobile.keybarAria"),"aria-pressed":v.toolbarVisible,children:[u.jsx(Ss,{active:v.toolbarVisible}),u.jsx("span",{className:"truncate",children:k("common.keyBar")}),u.jsx("span",{"aria-hidden":"true",className:"ml-auto shrink-0 text-tui-sm",children:v.toolbarVisible?"[x]":"[ ]"})]})]})]})},i0=({onAddProfile:o})=>{const{rttMs:i,t:r}=Tt();return u.jsxs("footer",{"data-testid":"mobile-status-bar",role:"status","aria-label":r("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:[u.jsx(Bu,{statusBar:!0,onAddProfile:o}),u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-border",children:"│"}),u.jsxs("span",{className:"flex shrink-0 items-center gap-1 px-1 text-tui-muted",title:r("header.latencyTitle"),children:[u.jsx("span",{className:"text-tui-faint",children:"RTT"}),u.jsx("span",{className:W(i===null?"text-tui-faint":"text-tui-text"),children:i===null?"—":`${i}ms`})]})]})},s0=({onNavigateAdmin:o,showAdminEntry:i=!0,onOpenPairing:r,onOpenSettings:c,onAddProfile:d=()=>{}})=>{const{connectionState:h,isController:g,t:m}=Tt(),[b,S]=y.useState(!1),v=y.useRef(null),C=y.useCallback(()=>S(!1),[]);y.useEffect(()=>{if(!b)return;const z=_=>{if(!(_.ctrlKey||_.altKey||_.metaKey)&&_.key==="Escape"){const V=_.target;V&&typeof V.closest=="function"&&!!V.closest("#terminal-container")||(_.stopPropagation(),_.preventDefault(),C())}};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[b,C]),y.useEffect(()=>{var z;b&&((z=v.current)==null||z.focus({preventScroll:!0}))},[b]);const B=Pr(h,m);return u.jsxs(u.Fragment,{children:[u.jsxs("div",{"data-testid":"mobile-topbar",role:"toolbar","aria-label":m("mobile.sessionControls"),className:"pointer-events-none absolute inset-x-0 top-0 z-40 flex h-12 items-center justify-between gap-2 border-b border-tui-border bg-tui-mantle px-2 text-tui",children:[u.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 text-tui-sm text-tui-muted",children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 font-bold text-tui-accent",children:"herdr"}),u.jsx(Hp,{className:"shrink-0"}),u.jsx(Gn,{level:B.level}),u.jsx("span",{className:"truncate uppercase",children:B.label})]}),u.jsxs("button",{type:"button","data-testid":"mobile-chrome-trigger",onClick:()=>S(!0),"aria-label":m("mobile.sessionControls"),"aria-expanded":b,"aria-haspopup":"dialog",className:W("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",B.needsAttention?"border-tui-warn text-tui-warn":g?"border-tui-border text-tui-muted":"border-tui-accent text-tui-accent"),children:[!g&&!B.needsAttention&&u.jsx("span",{className:"max-w-[8rem] truncate",children:m("common.viewer")}),u.jsx("span",{"aria-hidden":"true",className:"text-tui",children:qe.chevronDown}),u.jsx("span",{"aria-hidden":"true",children:m("mobile.menu")})]})]}),b&&u.jsxs(u.Fragment,{children:[u.jsx("div",{"data-testid":"mobile-sheet-scrim",className:"absolute inset-0 z-40 bg-tui-crust/70",onClick:C,"aria-hidden":"true"}),u.jsx("div",{ref:v,"data-testid":"mobile-control-sheet",role:"dialog","aria-modal":"true","aria-label":m("mobile.sessionControls"),tabIndex:-1,className:"herdr-sheet absolute inset-x-0 bottom-0 z-50 max-h-[85%] overflow-y-auto border-t border-tui-border bg-tui-base pb-3 focus:outline-none",children:u.jsx(a0,{onClose:C,showAdminEntry:i,onNavigateAdmin:()=>{C(),o()},onOpenPairing:()=>{C(),r()},onOpenSettings:()=>{C(),c()},onAddProfile:()=>{C(),d()}})})]}),u.jsx(i0,{onAddProfile:d})]})},Ip="--app-height",Jp="--keyboard-inset",r0=80;function o0(){if(typeof window>"u")return{height:768,keyboardInset:0};const o=window.innerHeight||768,i=window.visualViewport;if(i&&typeof i.height=="number"&&i.height>0){const r=o-i.height-(i.offsetTop||0),c=r>=r0?Math.round(r):0;return{height:Math.round(i.height),keyboardInset:c}}return{height:o,keyboardInset:0}}function np(o,i=o0()){return o.style.setProperty(Ip,`${i.height}px`),o.style.setProperty(Jp,`${i.keyboardInset}px`),i}function c0(o=typeof document<"u"?document.documentElement:null){if(!o||typeof window>"u")return()=>{};let i=null;const r=()=>{i=null,np(o)},c=()=>{if(i===null){if(typeof requestAnimationFrame!="function"){r();return}i=requestAnimationFrame(r)}};np(o);const d=window.visualViewport;return d==null||d.addEventListener("resize",c),d==null||d.addEventListener("scroll",c),window.addEventListener("resize",c),window.addEventListener("orientationchange",c),()=>{i!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(i),i=null),d==null||d.removeEventListener("resize",c),d==null||d.removeEventListener("scroll",c),window.removeEventListener("resize",c),window.removeEventListener("orientationchange",c),o.style.removeProperty(Ip),o.style.removeProperty(Jp)}}const u0=900;function lp(){if(typeof window>"u")return!1;const o=gi();return o<Ru?!0:o<=u0}function d0(){const[o,i]=y.useState(lp);return y.useEffect(()=>{var d,h;const r=()=>{const g=lp();i(m=>m===g?m:g)};r();let c=null;try{c=typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null}catch{c=null}return(d=c==null?void 0:c.addEventListener)==null||d.call(c,"change",r),window.addEventListener("resize",r),window.addEventListener("orientationchange",r),(h=window.visualViewport)==null||h.addEventListener("resize",r),()=>{var g,m;(g=c==null?void 0:c.removeEventListener)==null||g.call(c,"change",r),window.removeEventListener("resize",r),window.removeEventListener("orientationchange",r),(m=window.visualViewport)==null||m.removeEventListener("resize",r)}},[]),o}function f0(o){const i=o.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 r=document.activeElement;if(r.id==="terminal-container"||r.classList.contains("xterm-helper-textarea")||r.closest("#terminal-container")||r.closest(".xterm"))return!0}return!1}function h0(o,i={}){if(typeof window>"u")return()=>{};const r=c=>{var d;c.ctrlKey||c.altKey||c.metaKey||c.key==="Escape"&&(i.isModalOpen||i.isSheetOpen)&&(f0(c)||(c.preventDefault(),c.stopPropagation(),(d=o.onCloseModals)==null||d.call(o)))};return window.addEventListener("keydown",r),()=>{window.removeEventListener("keydown",r)}}function m0(){const[o,i]=y.useState("terminal"),[r,c]=y.useState(!1),[d,h]=y.useState(!1),[g,m]=y.useState(!1),[b,S]=y.useState(!1),{updateSettings:v,settings:C,connectionState:B,stateDetail:z,stateCode:_,lastPairedAt:V}=Tt(),k=d0();y.useEffect(()=>c0(),[]);const[Z,$]=y.useState(!0);y.useEffect(()=>{let de=!1;return fetch("/api/info",{headers:{Accept:"application/json"}}).then(je=>je.ok?je.json():null).then(je=>{de||!je||$(!je.isRemoteRelay)}).catch(()=>{}),()=>{de=!0}},[]),y.useEffect(()=>{xp()},[]),y.useEffect(()=>{const de=r||g||b;if(de)return h0({onCloseModals:()=>{c(!1),m(!1),S(!1)}},{isModalOpen:de})},[r,g,b]),y.useEffect(()=>{const de=()=>{const je=window.location.pathname,Be=window.location.hash;i(je==="/admin"||Be==="#admin"?"admin":"terminal")};de(),window.addEventListener("popstate",de),window.addEventListener("hashchange",de);try{const je=new URL(window.location.href),Be=je.searchParams.get("token"),j=je.searchParams.get("pairCode"),q=je.searchParams.get("ws")||je.searchParams.get("wsUrl"),J={};Be&&(J.token=Be),j&&(J.pairCode=j.toUpperCase()),q&&(J.wsUrl=q),Object.keys(J).length>0&&v(J);let we=!1;if(je.searchParams.has("token")&&(je.searchParams.delete("token"),we=!0),je.searchParams.has("pairCode")&&(je.searchParams.delete("pairCode"),we=!0),we){const H=je.searchParams.toString(),Ve=je.pathname+(H?`?${H}`:"")+je.hash;window.history.replaceState({},"",Ve)}}catch(je){console.warn("Failed to parse URL query params:",je)}return()=>{window.removeEventListener("popstate",de),window.removeEventListener("hashchange",de)}},[]);const Q=(de=!1)=>{h(de),c(!0)},ae=()=>{c(!1),h(!1)},Se=de=>{i(de),de==="admin"?window.history.pushState({},"","/admin"):window.history.pushState({},"","/")},D=!C.token&&!C.pairCode&&B!=="connected",O=B==="error"&&(["auth_required","unauthorized","device_revoked"].includes(_||"")||/auth|unauthor|forbidden|permission|token|pair/i.test(z||"")),A=D||O,[ee,Ae]=y.useState(!A);y.useEffect(()=>{A||Ae(!0)},[A]),y.useEffect(()=>{V&&(c(!1),Ae(!0),i("terminal"))},[V]);const Re=o==="terminal"&&!A,Ne=de=>({visibility:de?"visible":"hidden",opacity:de?1:0,pointerEvents:de?"auto":"none",zIndex:de?1:0});return u.jsxs("div",{"data-testid":"app-shell",style:k?{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:de=>{de.preventDefault(),de.stopPropagation()},children:[!k&&u.jsx(Pv,{currentView:o,onNavigate:Se,showAdminEntry:Z,onOpenPairing:()=>Q(!1),onOpenSettings:()=>m(!0),onToggleVirtualKeyboard:()=>S(!b),isVirtualKeyboardOpen:b}),!k&&!A&&u.jsx($v,{}),u.jsxs("div",{className:"flex-1 min-h-0 w-full overflow-hidden relative",children:[ee&&u.jsxs("div",{"data-testid":"terminal-layer",className:`absolute ${k?"inset-x-0 top-12 bottom-11":"inset-0"} flex flex-col min-h-0 w-full overflow-hidden`,style:Ne(Re),"aria-hidden":!Re,children:[u.jsx(zx,{isActive:Re}),!k&&u.jsx(Hx,{isOpen:b,onClose:()=>S(!1)}),u.jsx(Ux,{compact:k})]}),o==="terminal"&&A&&u.jsx("div",{"data-testid":"onboarding-layer",className:"absolute inset-0 flex flex-col min-h-0 w-full overflow-hidden z-10",children:u.jsx(Dx,{onPairedSuccess:()=>{}})}),o==="admin"&&u.jsx("div",{"data-testid":"admin-layer",className:"absolute inset-0 flex flex-col min-h-0 w-full overflow-hidden z-20",children:u.jsx(t0,{onBackToTerminal:()=>Se("terminal"),onOpenPairing:()=>Q(!1)})}),k&&Re&&u.jsx(s0,{onNavigateAdmin:()=>Se("admin"),showAdminEntry:Z,onOpenPairing:()=>Q(!1),onOpenSettings:()=>m(!0),onAddProfile:()=>Q(!0)})]}),!k&&o!=="admin"&&u.jsx(Fx,{onAddProfile:()=>Q(!0)}),u.jsx(Kx,{isOpen:r,isAddMode:d,onClose:ae}),u.jsx(Gx,{isOpen:g,onClose:()=>m(!1)}),u.jsx(Xx,{})]})}function p0(){return u.jsx(Wy,{children:u.jsx(m0,{})})}const Wp=document.getElementById("root");if(!Wp)throw new Error("Root element not found");hy.createRoot(Wp).render(u.jsx(il.StrictMode,{children:u.jsx(p0,{})}));