herdr-remote-relay 0.2.16 → 0.2.18
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,44 @@
|
|
|
1
|
+
var ly=Object.defineProperty;var ay=(o,a,r)=>a in o?ly(o,a,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[a]=r;var Se=(o,a,r)=>ay(o,typeof a!="symbol"?a+"":a,r);import{r as cp,g as up,a as dp}from"./vendor-react-CYSfZuHu.js";import{r as iy,a as ry,b as sy,c as oy}from"./vendor-xterm-Bldps5fz.js";(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))c(d);new MutationObserver(d=>{for(const f of d)if(f.type==="childList")for(const p of f.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&c(p)}).observe(document,{childList:!0,subtree:!0});function r(d){const f={};return d.integrity&&(f.integrity=d.integrity),d.referrerPolicy&&(f.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?f.credentials="include":d.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function c(d){if(d.ep)return;d.ep=!0;const f=r(d);fetch(d.href,f)}})();var ou={exports:{}},xr={};/**
|
|
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 xm;function cy(){if(xm)return xr;xm=1;var o=Symbol.for("react.transitional.element"),a=Symbol.for("react.fragment");function r(c,d,f){var p=null;if(f!==void 0&&(p=""+f),d.key!==void 0&&(p=""+d.key),"key"in d){f={};for(var m in d)m!=="key"&&(f[m]=d[m])}else f=d;return d=f.ref,{$$typeof:o,type:c,key:p,ref:d!==void 0?d:null,props:f}}return xr.Fragment=a,xr.jsx=r,xr.jsxs=r,xr}var Sm;function uy(){return Sm||(Sm=1,ou.exports=cy()),ou.exports}var u=uy(),y=cp();const dl=up(y);var cu={exports:{}},Sr={},uu={exports:{}},du={};/**
|
|
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 wm;function dy(){return wm||(wm=1,(function(o){function a(j,q){var W=j.length;j.push(q);e:for(;0<W;){var Ce=W-1>>>1,H=j[Ce];if(0<d(H,q))j[Ce]=q,j[W]=H,W=Ce;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],W=j.pop();if(W!==q){j[0]=W;e:for(var Ce=0,H=j.length,qe=H>>>1;Ce<qe;){var Z=2*(Ce+1)-1,pe=j[Z],ze=Z+1,ve=j[ze];if(0>d(pe,W))ze<H&&0>d(ve,pe)?(j[Ce]=ve,j[ze]=W,Ce=ze):(j[Ce]=pe,j[Z]=W,Ce=Z);else if(ze<H&&0>d(ve,W))j[Ce]=ve,j[ze]=W,Ce=ze;else break e}}return q}function d(j,q){var W=j.sortIndex-q.sortIndex;return W!==0?W:j.id-q.id}if(o.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;o.unstable_now=function(){return f.now()}}else{var p=Date,m=p.now();o.unstable_now=function(){return p.now()-m}}var b=[],S=[],v=1,C=null,D=3,z=!1,_=!1,F=!1,k=!1,I=typeof setTimeout=="function"?setTimeout:null,ee=typeof clearTimeout=="function"?clearTimeout:null,J=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,a(b,q);else break;q=r(S)}}function ye(j){if(F=!1,ae(j),!_)if(r(b)!==null)_=!0,O||(O=!0,Ee());else{var q=r(S);q!==null&&Oe(ye,q.startTime-j)}}var O=!1,U=-1,R=5,ne=-1;function je(){return k?!0:!(o.unstable_now()-ne<R)}function Me(){if(k=!1,O){var j=o.unstable_now();ne=j;var q=!0;try{e:{_=!1,F&&(F=!1,ee(U),U=-1),z=!0;var W=D;try{t:{for(ae(j),C=r(b);C!==null&&!(C.expirationTime>j&&je());){var Ce=C.callback;if(typeof Ce=="function"){C.callback=null,D=C.priorityLevel;var H=Ce(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 qe=r(S);qe!==null&&Oe(ye,qe.startTime-j),q=!1}}break e}finally{C=null,D=W,z=!1}q=void 0}}finally{q?Ee():O=!1}}}var Ee;if(typeof J=="function")Ee=function(){J(Me)};else if(typeof MessageChannel<"u"){var fe=new MessageChannel,ke=fe.port2;fe.port1.onmessage=Me,Ee=function(){ke.postMessage(null)}}else Ee=function(){I(Me,0)};function Oe(j,q){U=I(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"):R=0<j?Math.floor(1e3/j):5},o.unstable_getCurrentPriorityLevel=function(){return D},o.unstable_next=function(j){switch(D){case 1:case 2:case 3:var q=3;break;default:q=D}var W=D;D=q;try{return j()}finally{D=W}},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 W=D;D=j;try{return q()}finally{D=W}},o.unstable_scheduleCallback=function(j,q,W){var Ce=o.unstable_now();switch(typeof W=="object"&&W!==null?(W=W.delay,W=typeof W=="number"&&0<W?Ce+W:Ce):W=Ce,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=W+H,j={id:v++,callback:q,priorityLevel:j,startTime:W,expirationTime:H,sortIndex:-1},W>Ce?(j.sortIndex=W,a(S,j),r(b)===null&&j===r(S)&&(F?(ee(U),U=-1):F=!0,Oe(ye,W-Ce))):(j.sortIndex=H,a(b,j),_||z||(_=!0,O||(O=!0,Ee()))),j},o.unstable_shouldYield=je,o.unstable_wrapCallback=function(j){var q=D;return function(){var W=D;D=q;try{return j.apply(this,arguments)}finally{D=W}}}})(du)),du}var Cm;function fy(){return Cm||(Cm=1,uu.exports=dy()),uu.exports}/**
|
|
18
|
+
* @license React
|
|
19
|
+
* react-dom-client.production.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/var Tm;function hy(){if(Tm)return Sr;Tm=1;var o=fy(),a=cp(),r=dp();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 f(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function p(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(f(e)!==e)throw Error(c(188))}function S(e){var t=e.alternate;if(!t){if(t=f(e),t===null)throw Error(c(188));return t!==e?null:e}for(var n=e,l=t;;){var i=n.return;if(i===null)break;var s=i.alternate;if(s===null){if(l=i.return,l!==null){n=l;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===n)return b(i),e;if(s===l)return b(i),t;s=s.sibling}throw Error(c(188))}if(n.return!==l.return)n=i,l=s;else{for(var h=!1,g=i.child;g;){if(g===n){h=!0,n=i,l=s;break}if(g===l){h=!0,l=i,n=s;break}g=g.sibling}if(!h){for(g=s.child;g;){if(g===n){h=!0,n=s,l=i;break}if(g===l){h=!0,l=s,n=i;break}g=g.sibling}if(!h)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,D=Symbol.for("react.element"),z=Symbol.for("react.transitional.element"),_=Symbol.for("react.portal"),F=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),I=Symbol.for("react.profiler"),ee=Symbol.for("react.consumer"),J=Symbol.for("react.context"),ae=Symbol.for("react.forward_ref"),ye=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),U=Symbol.for("react.memo"),R=Symbol.for("react.lazy"),ne=Symbol.for("react.activity"),je=Symbol.for("react.memo_cache_sentinel"),Me=Symbol.iterator;function Ee(e){return e===null||typeof e!="object"?null:(e=Me&&e[Me]||e["@@iterator"],typeof e=="function"?e:null)}var fe=Symbol.for("react.client.reference");function ke(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===fe?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case F:return"Fragment";case I:return"Profiler";case k:return"StrictMode";case ye:return"Suspense";case O:return"SuspenseList";case ne:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case _:return"Portal";case J:return e.displayName||"Context";case ee: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 U:return t=e.displayName||null,t!==null?t:ke(e.type)||"Memo";case R:t=e._payload,e=e._init;try{return ke(e(t))}catch{}}return null}var Oe=Array.isArray,j=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W={pending:!1,data:null,method:null,action:null},Ce=[],H=-1;function qe(e){return{current:e}}function Z(e){0>H||(e.current=Ce[H],Ce[H]=null,H--)}function pe(e,t){H++,Ce[H]=e.current,e.current=t}var ze=qe(null),ve=qe(null),me=qe(null),St=qe(null);function Le(e,t){switch(pe(me,t),pe(ve,e),pe(ze,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?qh(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=qh(t),e=Vh(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Z(ze),pe(ze,e)}function we(){Z(ze),Z(ve),Z(me)}function ut(e){e.memoizedState!==null&&pe(St,e);var t=ze.current,n=Vh(t,e.type);t!==n&&(pe(ve,e),pe(ze,n))}function nt(e){ve.current===e&&(Z(ze),Z(ve)),St.current===e&&(Z(St),gr._currentValue=W)}var ht,Ht;function gt(e){if(ht===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);ht=t&&t[1]||"",Ht=-1<n.stack.indexOf(`
|
|
26
|
+
at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
27
|
+
`+ht+e+Ht}var zn=!1;function Dn(e,t){if(!e||zn)return"";zn=!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 A=M}Reflect.construct(e,[],G)}else{try{G.call()}catch(M){A=M}e.call(G.prototype)}}else{try{throw Error()}catch(M){A=M}(G=e())&&typeof G.catch=="function"&&G.catch(function(){})}}catch(M){if(M&&A&&typeof M.stack=="string")return[M.stack,A.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var i=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");i&&i.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var s=l.DetermineComponentFrameRoot(),h=s[0],g=s[1];if(h&&g){var x=h.split(`
|
|
28
|
+
`),E=g.split(`
|
|
29
|
+
`);for(i=l=0;l<x.length&&!x[l].includes("DetermineComponentFrameRoot");)l++;for(;i<E.length&&!E[i].includes("DetermineComponentFrameRoot");)i++;if(l===x.length||i===E.length)for(l=x.length-1,i=E.length-1;1<=l&&0<=i&&x[l]!==E[i];)i--;for(;1<=l&&0<=i;l--,i--)if(x[l]!==E[i]){if(l!==1||i!==1)do if(l--,i--,0>i||x[l]!==E[i]){var B=`
|
|
30
|
+
`+x[l].replace(" at new "," at ");return e.displayName&&B.includes("<anonymous>")&&(B=B.replace("<anonymous>",e.displayName)),B}while(1<=l&&0<=i);break}}}finally{zn=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?gt(n):""}function _t(e,t){switch(e.tag){case 26:case 27:case 5:return gt(e.type);case 16:return gt("Lazy");case 13:return e.child!==t&&t!==null?gt("Suspense Fallback"):gt("Suspense");case 19:return gt("SuspenseList");case 0:case 15:return Dn(e.type,!1);case 11:return Dn(e.type.render,!1);case 1:return Dn(e.type,!0);case 31:return gt("Activity");default:return""}}function sn(e){try{var t="",n=null;do t+=_t(e,n),n=e,e=e.return;while(e);return t}catch(l){return`
|
|
31
|
+
Error generating stack: `+l.message+`
|
|
32
|
+
`+l.stack}}var On=Object.prototype.hasOwnProperty,kt=o.unstable_scheduleCallback,Fe=o.unstable_cancelCallback,Vt=o.unstable_shouldYield,Yt=o.unstable_requestPaint,$=o.unstable_now,Re=o.unstable_getCurrentPriorityLevel,Ke=o.unstable_ImmediatePriority,We=o.unstable_UserBlockingPriority,et=o.unstable_NormalPriority,hn=o.unstable_LowPriority,mt=o.unstable_IdlePriority,At=o.log,Qt=o.unstable_setDisableYieldValue,tn=null,lt=null;function zt(e){if(typeof At=="function"&&Qt(e),lt&&typeof lt.setStrictMode=="function")try{lt.setStrictMode(tn,e)}catch{}}var wt=Math.clz32?Math.clz32:Ya,Ha=Math.log,mn=Math.LN2;function Ya(e){return e>>>=0,e===0?32:31-(Ha(e)/mn|0)|0}var Ln=256,fl=262144,hl=4194304;function It(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 on(e,t,n){var l=e.pendingLanes;if(l===0)return 0;var i=0,s=e.suspendedLanes,h=e.pingedLanes;e=e.warmLanes;var g=l&134217727;return g!==0?(l=g&~s,l!==0?i=It(l):(h&=g,h!==0?i=It(h):n||(n=g&~e,n!==0&&(i=It(n))))):(g=l&~s,g!==0?i=It(g):h!==0?i=It(h):n||(n=l&~e,n!==0&&(i=It(n)))),i===0?0:t!==0&&t!==i&&(t&s)===0&&(s=i&-i,n=t&-t,s>=n||s===32&&(n&4194048)!==0)?t:i}function pn(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function ml(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 Ka(){var e=hl;return hl<<=1,(hl&62914560)===0&&(hl=4194304),e}function Bl(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function ll(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Hl(e,t,n,l,i,s){var h=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 g=e.entanglements,x=e.expirationTimes,E=e.hiddenUpdates;for(n=h&~n;0<n;){var B=31-wt(n),G=1<<B;g[B]=0,x[B]=-1;var A=E[B];if(A!==null)for(E[B]=null,B=0;B<A.length;B++){var M=A[B];M!==null&&(M.lane&=-536870913)}n&=~G}l!==0&&pl(e,l,0),s!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=s&~(h&~t))}function pl(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-wt(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|n&261930}function gl(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var l=31-wt(n),i=1<<l;i&t|e[l]&t&&(e[l]|=t),n&=~i}}function Ga(e,t){var n=t&-t;return n=(n&42)!==0?1:L(n),(n&(e.suspendedLanes|t))!==0?0:n}function L(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 Y(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function ie(){var e=q.p;return e!==0?e:(e=window.event,e===void 0?32:hm(e.type))}function Ae(e,t){var n=q.p;try{return q.p=e,t()}finally{q.p=n}}var xe=Math.random().toString(36).slice(2),he="__reactFiber$"+xe,_e="__reactProps$"+xe,Tt="__reactContainer$"+xe,bt="__reactEvents$"+xe,Un="__reactListeners$"+xe,al="__reactHandles$"+xe,gn="__reactResources$"+xe,il="__reactMarker$"+xe;function qa(e){delete e[he],delete e[_e],delete e[bt],delete e[Un],delete e[al]}function bl(e){var t=e[he];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Tt]||n[he]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Wh(e);e!==null;){if(n=e[he])return n;e=Wh(e)}return t}e=n,n=e.parentNode}return null}function yl(e){if(e=e[he]||e[Tt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Yl(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(c(33))}function X(e){var t=e[gn];return t||(t=e[gn]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Q(e){e[il]=!0}var de=new Set,ge={};function Ie(e,t){le(e,t),le(e+"Capture",t)}function le(e,t){for(ge[e]=t,e=0;e<t.length;e++)de.add(t[e])}var nn=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]*$"),Jt={},Dt={};function at(e){return On.call(Dt,e)?!0:On.call(Jt,e)?!1:nn.test(e)?Dt[e]=!0:(Jt[e]=!0,!1)}function ln(e,t,n){if(at(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 Wn(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 cn(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 Kt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Kl(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function so(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 i=l.get,s=l.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(h){n=""+h,s.call(this,h)}}),Object.defineProperty(e,t,{enumerable:l.enumerable}),{getValue:function(){return n},setValue:function(h){n=""+h},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function _i(e){if(!e._valueTracker){var t=Kl(e)?"checked":"value";e._valueTracker=so(e,t,""+e[t])}}function Br(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),l="";return e&&(l=Kl(e)?e.checked?"true":"false":e.value),e=l,e!==n?(t.setValue(e),!0):!1}function Va(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 oo=/[\n"\\]/g;function bn(e){return e.replace(oo,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function ki(e,t,n,l,i,s,h,g){e.name="",h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"?e.type=h:e.removeAttribute("type"),t!=null?h==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Kt(t)):e.value!==""+Kt(t)&&(e.value=""+Kt(t)):h!=="submit"&&h!=="reset"||e.removeAttribute("value"),t!=null?zi(e,h,Kt(t)):n!=null?zi(e,h,Kt(n)):l!=null&&e.removeAttribute("value"),i==null&&s!=null&&(e.defaultChecked=!!s),i!=null&&(e.checked=i&&typeof i!="function"&&typeof i!="symbol"),g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"?e.name=""+Kt(g):e.removeAttribute("name")}function Hr(e,t,n,l,i,s,h,g){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)){_i(e);return}n=n!=null?""+Kt(n):"",t=t!=null?""+Kt(t):n,g||t===e.value||(e.value=t),e.defaultValue=t}l=l??i,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=g?e.checked:!!l,e.defaultChecked=!!l,h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(e.name=h),_i(e)}function zi(e,t,n){t==="number"&&Va(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function vl(e,t,n,l){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t["$"+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty("$"+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&l&&(e[n].defaultSelected=!0)}else{for(n=""+Kt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,l&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function un(e,t,n){if(t!=null&&(t=""+Kt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Kt(n):""}function Yr(e,t,n,l){if(t==null){if(l!=null){if(n!=null)throw Error(c(92));if(Oe(l)){if(1<l.length)throw Error(c(93));l=l[0]}n=l}n==null&&(n=""),t=n}n=Kt(t),e.defaultValue=n,l=e.textContent,l===n&&l!==""&&l!==null&&(e.value=l),_i(e)}function Gl(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var pa=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 Bn(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||pa.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function Di(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 i in t)l=t[i],t.hasOwnProperty(i)&&n[i]!==l&&Bn(e,i,l)}else for(var s in t)t.hasOwnProperty(s)&&Bn(e,s,t[s])}function Xa(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 Fa=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"]]),Za=/^[\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 xl(e){return Za.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Hn(){}var Qa=null;function Ia(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var V=null,te=null;function Be(e){var t=yl(e);if(t&&(e=t.stateNode)){var n=e[_e]||null;e:switch(e=t.stateNode,t.type){case"input":if(ki(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="'+bn(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var l=n[t];if(l!==e&&l.form===e.form){var i=l[_e]||null;if(!i)throw Error(c(90));ki(l,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name)}}for(t=0;t<n.length;t++)l=n[t],l.form===e.form&&Br(l)}break e;case"textarea":un(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&vl(e,!!n.multiple,t,!1)}}}var Xt=!1;function Ft(e,t,n){if(Xt)return e(t,n);Xt=!0;try{var l=e(t);return l}finally{if(Xt=!1,(V!==null||te!==null)&&(Ns(),V&&(t=V,e=te,te=V=null,Be(t),e)))for(t=0;t<e.length;t++)Be(e[t])}}function an(e,t){var n=e.stateNode;if(n===null)return null;var l=n[_e]||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 ce=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),pt=!1;if(ce)try{var dt={};Object.defineProperty(dt,"passive",{get:function(){pt=!0}}),window.addEventListener("test",dt,dt),window.removeEventListener("test",dt,dt)}catch{pt=!1}var Nt=null,yn=null,dn=null;function ga(){if(dn)return dn;var e,t=yn,n=t.length,l,i="value"in Nt?Nt.value:Nt.textContent,s=i.length;for(e=0;e<n&&t[e]===i[e];e++);var h=n-e;for(l=1;l<=h&&t[n-l]===i[s-l];l++);return dn=i.slice(e,1<l?1-l:void 0)}function ba(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 Kr(){return!0}function Vu(){return!1}function vn(e){function t(n,l,i,s,h){this._reactName=n,this._targetInst=i,this.type=l,this.nativeEvent=s,this.target=h,this.currentTarget=null;for(var g in e)e.hasOwnProperty(g)&&(n=e[g],this[g]=n?n(s):s[g]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?Kr:Vu,this.isPropagationStopped=Vu,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=Kr)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Kr)},persist:function(){},isPersistent:Kr}),t}var ya={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Gr=vn(ya),Oi=C({},ya,{view:0,detail:0}),tg=vn(Oi),co,uo,Li,qr=C({},Oi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ho,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!==Li&&(Li&&e.type==="mousemove"?(co=e.screenX-Li.screenX,uo=e.screenY-Li.screenY):uo=co=0,Li=e),co)},movementY:function(e){return"movementY"in e?e.movementY:uo}}),Xu=vn(qr),ng=C({},qr,{dataTransfer:0}),lg=vn(ng),ag=C({},Oi,{relatedTarget:0}),fo=vn(ag),ig=C({},ya,{animationName:0,elapsedTime:0,pseudoElement:0}),rg=vn(ig),sg=C({},ya,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),og=vn(sg),cg=C({},ya,{data:0}),Fu=vn(cg),ug={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},dg={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"},fg={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function hg(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=fg[e])?!!t[e]:!1}function ho(){return hg}var mg=C({},Oi,{key:function(e){if(e.key){var t=ug[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=ba(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?dg[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ho,charCode:function(e){return e.type==="keypress"?ba(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ba(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),pg=vn(mg),gg=C({},qr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Zu=vn(gg),bg=C({},Oi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ho}),yg=vn(bg),vg=C({},ya,{propertyName:0,elapsedTime:0,pseudoElement:0}),xg=vn(vg),Sg=C({},qr,{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}),wg=vn(Sg),Cg=C({},ya,{newState:0,oldState:0}),Tg=vn(Cg),Ng=[9,13,27,32],mo=ce&&"CompositionEvent"in window,Ui=null;ce&&"documentMode"in document&&(Ui=document.documentMode);var Eg=ce&&"TextEvent"in window&&!Ui,Qu=ce&&(!mo||Ui&&8<Ui&&11>=Ui),Iu=" ",Ju=!1;function Wu(e,t){switch(e){case"keyup":return Ng.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Pu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ja=!1;function Rg(e,t){switch(e){case"compositionend":return Pu(t);case"keypress":return t.which!==32?null:(Ju=!0,Iu);case"textInput":return e=t.data,e===Iu&&Ju?null:e;default:return null}}function Ag(e,t){if(Ja)return e==="compositionend"||!mo&&Wu(e,t)?(e=ga(),dn=yn=Nt=null,Ja=!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 Qu&&t.locale!=="ko"?null:t.data;default:return null}}var jg={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 $u(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!jg[e.type]:t==="textarea"}function ed(e,t,n,l){V?te?te.push(l):te=[l]:V=l,t=ks(t,"onChange"),0<t.length&&(n=new Gr("onChange","change",null,n,l),e.push({event:n,listeners:t}))}var Bi=null,Hi=null;function Mg(e){Uh(e,0)}function Vr(e){var t=Yl(e);if(Br(t))return e}function td(e,t){if(e==="change")return t}var nd=!1;if(ce){var po;if(ce){var go="oninput"in document;if(!go){var ld=document.createElement("div");ld.setAttribute("oninput","return;"),go=typeof ld.oninput=="function"}po=go}else po=!1;nd=po&&(!document.documentMode||9<document.documentMode)}function ad(){Bi&&(Bi.detachEvent("onpropertychange",id),Hi=Bi=null)}function id(e){if(e.propertyName==="value"&&Vr(Hi)){var t=[];ed(t,Hi,e,Ia(e)),Ft(Mg,t)}}function _g(e,t,n){e==="focusin"?(ad(),Bi=t,Hi=n,Bi.attachEvent("onpropertychange",id)):e==="focusout"&&ad()}function kg(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Vr(Hi)}function zg(e,t){if(e==="click")return Vr(t)}function Dg(e,t){if(e==="input"||e==="change")return Vr(t)}function Og(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Nn=typeof Object.is=="function"?Object.is:Og;function Yi(e,t){if(Nn(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 i=n[l];if(!On.call(t,i)||!Nn(e[i],t[i]))return!1}return!0}function rd(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function sd(e,t){var n=rd(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=rd(n)}}function od(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?od(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function cd(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Va(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=Va(e.document)}return t}function bo(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 Lg=ce&&"documentMode"in document&&11>=document.documentMode,Wa=null,yo=null,Ki=null,vo=!1;function ud(e,t,n){var l=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;vo||Wa==null||Wa!==Va(l)||(l=Wa,"selectionStart"in l&&bo(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}),Ki&&Yi(Ki,l)||(Ki=l,l=ks(yo,"onSelect"),0<l.length&&(t=new Gr("onSelect","select",null,t,n),e.push({event:t,listeners:l}),t.target=Wa)))}function va(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Pa={animationend:va("Animation","AnimationEnd"),animationiteration:va("Animation","AnimationIteration"),animationstart:va("Animation","AnimationStart"),transitionrun:va("Transition","TransitionRun"),transitionstart:va("Transition","TransitionStart"),transitioncancel:va("Transition","TransitionCancel"),transitionend:va("Transition","TransitionEnd")},xo={},dd={};ce&&(dd=document.createElement("div").style,"AnimationEvent"in window||(delete Pa.animationend.animation,delete Pa.animationiteration.animation,delete Pa.animationstart.animation),"TransitionEvent"in window||delete Pa.transitionend.transition);function xa(e){if(xo[e])return xo[e];if(!Pa[e])return e;var t=Pa[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in dd)return xo[e]=t[n];return e}var fd=xa("animationend"),hd=xa("animationiteration"),md=xa("animationstart"),Ug=xa("transitionrun"),Bg=xa("transitionstart"),Hg=xa("transitioncancel"),pd=xa("transitionend"),gd=new Map,So="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(" ");So.push("scrollEnd");function Pn(e,t){gd.set(e,t),Ie(t,[e])}var Xr=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)},Yn=[],$a=0,wo=0;function Fr(){for(var e=$a,t=wo=$a=0;t<e;){var n=Yn[t];Yn[t++]=null;var l=Yn[t];Yn[t++]=null;var i=Yn[t];Yn[t++]=null;var s=Yn[t];if(Yn[t++]=null,l!==null&&i!==null){var h=l.pending;h===null?i.next=i:(i.next=h.next,h.next=i),l.pending=i}s!==0&&bd(n,i,s)}}function Zr(e,t,n,l){Yn[$a++]=e,Yn[$a++]=t,Yn[$a++]=n,Yn[$a++]=l,wo|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function Co(e,t,n,l){return Zr(e,t,n,l),Qr(e)}function Sa(e,t){return Zr(e,null,null,t),Qr(e)}function bd(e,t,n){e.lanes|=n;var l=e.alternate;l!==null&&(l.lanes|=n);for(var i=!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||(i=!0)),e=s,s=s.return;return e.tag===3?(s=e.stateNode,i&&t!==null&&(i=31-wt(n),e=s.hiddenUpdates,l=e[i],l===null?e[i]=[t]:l.push(t),t.lane=n|536870912),s):null}function Qr(e){if(50<cr)throw cr=0,kc=null,Error(c(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ei={};function Yg(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 En(e,t,n,l){return new Yg(e,t,n,l)}function To(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Sl(e,t){var n=e.alternate;return n===null?(n=En(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 yd(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 Ir(e,t,n,l,i,s){var h=0;if(l=e,typeof e=="function")To(e)&&(h=1);else if(typeof e=="string")h=Xb(e,n,ze.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case ne:return e=En(31,n,t,i),e.elementType=ne,e.lanes=s,e;case F:return wa(n.children,i,s,t);case k:h=8,i|=24;break;case I:return e=En(12,n,t,i|2),e.elementType=I,e.lanes=s,e;case ye:return e=En(13,n,t,i),e.elementType=ye,e.lanes=s,e;case O:return e=En(19,n,t,i),e.elementType=O,e.lanes=s,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case J:h=10;break e;case ee:h=9;break e;case ae:h=11;break e;case U:h=14;break e;case R:h=16,l=null;break e}h=29,n=Error(c(130,e===null?"null":typeof e,"")),l=null}return t=En(h,n,t,i),t.elementType=e,t.type=l,t.lanes=s,t}function wa(e,t,n,l){return e=En(7,e,l,t),e.lanes=n,e}function No(e,t,n){return e=En(6,e,null,t),e.lanes=n,e}function vd(e){var t=En(18,null,null,0);return t.stateNode=e,t}function Eo(e,t,n){return t=En(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var xd=new WeakMap;function Kn(e,t){if(typeof e=="object"&&e!==null){var n=xd.get(e);return n!==void 0?n:(t={value:e,source:t,stack:sn(t)},xd.set(e,t),t)}return{value:e,source:t,stack:sn(t)}}var ti=[],ni=0,Jr=null,Gi=0,Gn=[],qn=0,ql=null,rl=1,sl="";function wl(e,t){ti[ni++]=Gi,ti[ni++]=Jr,Jr=e,Gi=t}function Sd(e,t,n){Gn[qn++]=rl,Gn[qn++]=sl,Gn[qn++]=ql,ql=e;var l=rl;e=sl;var i=32-wt(l)-1;l&=~(1<<i),n+=1;var s=32-wt(t)+i;if(30<s){var h=i-i%5;s=(l&(1<<h)-1).toString(32),l>>=h,i-=h,rl=1<<32-wt(t)+i|n<<i|l,sl=s+e}else rl=1<<s|n<<i|l,sl=e}function Ro(e){e.return!==null&&(wl(e,1),Sd(e,1,0))}function Ao(e){for(;e===Jr;)Jr=ti[--ni],ti[ni]=null,Gi=ti[--ni],ti[ni]=null;for(;e===ql;)ql=Gn[--qn],Gn[qn]=null,sl=Gn[--qn],Gn[qn]=null,rl=Gn[--qn],Gn[qn]=null}function wd(e,t){Gn[qn++]=rl,Gn[qn++]=sl,Gn[qn++]=ql,rl=t.id,sl=t.overflow,ql=e}var Wt=null,yt=null,Je=!1,Vl=null,Vn=!1,jo=Error(c(519));function Xl(e){var t=Error(c(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw qi(Kn(t,e)),jo}function Cd(e){var t=e.stateNode,n=e.type,l=e.memoizedProps;switch(t[he]=e,t[_e]=l,n){case"dialog":Xe("cancel",t),Xe("close",t);break;case"iframe":case"object":case"embed":Xe("load",t);break;case"video":case"audio":for(n=0;n<dr.length;n++)Xe(dr[n],t);break;case"source":Xe("error",t);break;case"img":case"image":case"link":Xe("error",t),Xe("load",t);break;case"details":Xe("toggle",t);break;case"input":Xe("invalid",t),Hr(t,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Xe("invalid",t);break;case"textarea":Xe("invalid",t),Yr(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||Kh(t.textContent,n)?(l.popover!=null&&(Xe("beforetoggle",t),Xe("toggle",t)),l.onScroll!=null&&Xe("scroll",t),l.onScrollEnd!=null&&Xe("scrollend",t),l.onClick!=null&&(t.onclick=Hn),t=!0):t=!1,t||Xl(e,!0)}function Td(e){for(Wt=e.return;Wt;)switch(Wt.tag){case 5:case 31:case 13:Vn=!1;return;case 27:case 3:Vn=!0;return;default:Wt=Wt.return}}function li(e){if(e!==Wt)return!1;if(!Je)return Td(e),Je=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||Zc(e.type,e.memoizedProps)),n=!n),n&&yt&&Xl(e),Td(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(317));yt=Jh(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(317));yt=Jh(e)}else t===27?(t=yt,ia(e.type)?(e=Pc,Pc=null,yt=e):yt=t):yt=Wt?Fn(e.stateNode.nextSibling):null;return!0}function Ca(){yt=Wt=null,Je=!1}function Mo(){var e=Vl;return e!==null&&(Cn===null?Cn=e:Cn.push.apply(Cn,e),Vl=null),e}function qi(e){Vl===null?Vl=[e]:Vl.push(e)}var _o=qe(null),Ta=null,Cl=null;function Fl(e,t,n){pe(_o,t._currentValue),t._currentValue=n}function Tl(e){e._currentValue=_o.current,Z(_o)}function ko(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 zo(e,t,n,l){var i=e.child;for(i!==null&&(i.return=e);i!==null;){var s=i.dependencies;if(s!==null){var h=i.child;s=s.firstContext;e:for(;s!==null;){var g=s;s=i;for(var x=0;x<t.length;x++)if(g.context===t[x]){s.lanes|=n,g=s.alternate,g!==null&&(g.lanes|=n),ko(s.return,n,e),l||(h=null);break e}s=g.next}}else if(i.tag===18){if(h=i.return,h===null)throw Error(c(341));h.lanes|=n,s=h.alternate,s!==null&&(s.lanes|=n),ko(h,n,e),h=null}else h=i.child;if(h!==null)h.return=i;else for(h=i;h!==null;){if(h===e){h=null;break}if(i=h.sibling,i!==null){i.return=h.return,h=i;break}h=h.return}i=h}}function ai(e,t,n,l){e=null;for(var i=t,s=!1;i!==null;){if(!s){if((i.flags&524288)!==0)s=!0;else if((i.flags&262144)!==0)break}if(i.tag===10){var h=i.alternate;if(h===null)throw Error(c(387));if(h=h.memoizedProps,h!==null){var g=i.type;Nn(i.pendingProps.value,h.value)||(e!==null?e.push(g):e=[g])}}else if(i===St.current){if(h=i.alternate,h===null)throw Error(c(387));h.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(e!==null?e.push(gr):e=[gr])}i=i.return}e!==null&&zo(t,e,n,l),t.flags|=262144}function Wr(e){for(e=e.firstContext;e!==null;){if(!Nn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Na(e){Ta=e,Cl=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Pt(e){return Nd(Ta,e)}function Pr(e,t){return Ta===null&&Na(e),Nd(e,t)}function Nd(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Cl===null){if(e===null)throw Error(c(308));Cl=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Cl=Cl.next=t;return n}var Kg=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()})}},Gg=o.unstable_scheduleCallback,qg=o.unstable_NormalPriority,Ot={$$typeof:J,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Do(){return{controller:new Kg,data:new Map,refCount:0}}function Vi(e){e.refCount--,e.refCount===0&&Gg(qg,function(){e.controller.abort()})}var Xi=null,Oo=0,ii=0,ri=null;function Vg(e,t){if(Xi===null){var n=Xi=[];Oo=0,ii=Bc(),ri={status:"pending",value:void 0,then:function(l){n.push(l)}}}return Oo++,t.then(Ed,Ed),t}function Ed(){if(--Oo===0&&Xi!==null){ri!==null&&(ri.status="fulfilled");var e=Xi;Xi=null,ii=0,ri=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Xg(e,t){var n=[],l={status:"pending",value:null,reason:null,then:function(i){n.push(i)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var i=0;i<n.length;i++)(0,n[i])(t)},function(i){for(l.status="rejected",l.reason=i,i=0;i<n.length;i++)(0,n[i])(void 0)}),l}var Rd=j.S;j.S=function(e,t){dh=$(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&Vg(e,t),Rd!==null&&Rd(e,t)};var Ea=qe(null);function Lo(){var e=Ea.current;return e!==null?e:ft.pooledCache}function $r(e,t){t===null?pe(Ea,Ea.current):pe(Ea,t.pool)}function Ad(){var e=Lo();return e===null?null:{parent:Ot._currentValue,pool:e}}var si=Error(c(460)),Uo=Error(c(474)),es=Error(c(542)),ts={then:function(){}};function jd(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Md(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Hn,Hn),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,kd(e),e;default:if(typeof t.status=="string")t.then(Hn,Hn);else{if(e=ft,e!==null&&100<e.shellSuspendCounter)throw Error(c(482));e=t,e.status="pending",e.then(function(l){if(t.status==="pending"){var i=t;i.status="fulfilled",i.value=l}},function(l){if(t.status==="pending"){var i=t;i.status="rejected",i.reason=l}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,kd(e),e}throw Aa=t,si}}function Ra(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Aa=n,si):n}}var Aa=null;function _d(){if(Aa===null)throw Error(c(459));var e=Aa;return Aa=null,e}function kd(e){if(e===si||e===es)throw Error(c(483))}var oi=null,Fi=0;function ns(e){var t=Fi;return Fi+=1,oi===null&&(oi=[]),Md(oi,e,t)}function Zi(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function ls(e,t){throw t.$$typeof===D?Error(c(525)):(e=Object.prototype.toString.call(t),Error(c(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function zd(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 i(T,w){return T=Sl(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 h(T){return e&&T.alternate===null&&(T.flags|=67108866),T}function g(T,w,N,K){return w===null||w.tag!==6?(w=No(N,T.mode,K),w.return=T,w):(w=i(w,N),w.return=T,w)}function x(T,w,N,K){var be=N.type;return be===F?B(T,w,N.props.children,K,N.key):w!==null&&(w.elementType===be||typeof be=="object"&&be!==null&&be.$$typeof===R&&Ra(be)===w.type)?(w=i(w,N.props),Zi(w,N),w.return=T,w):(w=Ir(N.type,N.key,N.props,null,T.mode,K),Zi(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=Eo(N,T.mode,K),w.return=T,w):(w=i(w,N.children||[]),w.return=T,w)}function B(T,w,N,K,be){return w===null||w.tag!==7?(w=wa(N,T.mode,K,be),w.return=T,w):(w=i(w,N),w.return=T,w)}function G(T,w,N){if(typeof w=="string"&&w!==""||typeof w=="number"||typeof w=="bigint")return w=No(""+w,T.mode,N),w.return=T,w;if(typeof w=="object"&&w!==null){switch(w.$$typeof){case z:return N=Ir(w.type,w.key,w.props,null,T.mode,N),Zi(N,w),N.return=T,N;case _:return w=Eo(w,T.mode,N),w.return=T,w;case R:return w=Ra(w),G(T,w,N)}if(Oe(w)||Ee(w))return w=wa(w,T.mode,N,null),w.return=T,w;if(typeof w.then=="function")return G(T,ns(w),N);if(w.$$typeof===J)return G(T,Pr(T,w),N);ls(T,w)}return null}function A(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:g(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 R:return N=Ra(N),A(T,w,N,K)}if(Oe(N)||Ee(N))return be!==null?null:B(T,w,N,K,null);if(typeof N.then=="function")return A(T,w,ns(N),K);if(N.$$typeof===J)return A(T,w,Pr(T,N),K);ls(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,g(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 R:return K=Ra(K),M(T,w,N,K,be)}if(Oe(K)||Ee(K))return T=T.get(N)||null,B(w,T,K,be,null);if(typeof K.then=="function")return M(T,w,N,ns(K),be);if(K.$$typeof===J)return M(T,w,N,Pr(w,K),be);ls(w,K)}return null}function oe(T,w,N,K){for(var be=null,Pe=null,ue=w,Ue=w=0,Qe=null;ue!==null&&Ue<N.length;Ue++){ue.index>Ue?(Qe=ue,ue=null):Qe=ue.sibling;var $e=A(T,ue,N[Ue],K);if($e===null){ue===null&&(ue=Qe);break}e&&ue&&$e.alternate===null&&t(T,ue),w=s($e,w,Ue),Pe===null?be=$e:Pe.sibling=$e,Pe=$e,ue=Qe}if(Ue===N.length)return n(T,ue),Je&&wl(T,Ue),be;if(ue===null){for(;Ue<N.length;Ue++)ue=G(T,N[Ue],K),ue!==null&&(w=s(ue,w,Ue),Pe===null?be=ue:Pe.sibling=ue,Pe=ue);return Je&&wl(T,Ue),be}for(ue=l(ue);Ue<N.length;Ue++)Qe=M(ue,T,Ue,N[Ue],K),Qe!==null&&(e&&Qe.alternate!==null&&ue.delete(Qe.key===null?Ue:Qe.key),w=s(Qe,w,Ue),Pe===null?be=Qe:Pe.sibling=Qe,Pe=Qe);return e&&ue.forEach(function(ua){return t(T,ua)}),Je&&wl(T,Ue),be}function Te(T,w,N,K){if(N==null)throw Error(c(151));for(var be=null,Pe=null,ue=w,Ue=w=0,Qe=null,$e=N.next();ue!==null&&!$e.done;Ue++,$e=N.next()){ue.index>Ue?(Qe=ue,ue=null):Qe=ue.sibling;var ua=A(T,ue,$e.value,K);if(ua===null){ue===null&&(ue=Qe);break}e&&ue&&ua.alternate===null&&t(T,ue),w=s(ua,w,Ue),Pe===null?be=ua:Pe.sibling=ua,Pe=ua,ue=Qe}if($e.done)return n(T,ue),Je&&wl(T,Ue),be;if(ue===null){for(;!$e.done;Ue++,$e=N.next())$e=G(T,$e.value,K),$e!==null&&(w=s($e,w,Ue),Pe===null?be=$e:Pe.sibling=$e,Pe=$e);return Je&&wl(T,Ue),be}for(ue=l(ue);!$e.done;Ue++,$e=N.next())$e=M(ue,T,Ue,$e.value,K),$e!==null&&(e&&$e.alternate!==null&&ue.delete($e.key===null?Ue:$e.key),w=s($e,w,Ue),Pe===null?be=$e:Pe.sibling=$e,Pe=$e);return e&&ue.forEach(function(ny){return t(T,ny)}),Je&&wl(T,Ue),be}function ct(T,w,N,K){if(typeof N=="object"&&N!==null&&N.type===F&&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===F){if(w.tag===7){n(T,w.sibling),K=i(w,N.props.children),K.return=T,T=K;break e}}else if(w.elementType===be||typeof be=="object"&&be!==null&&be.$$typeof===R&&Ra(be)===w.type){n(T,w.sibling),K=i(w,N.props),Zi(K,N),K.return=T,T=K;break e}n(T,w);break}else t(T,w);w=w.sibling}N.type===F?(K=wa(N.props.children,T.mode,K,N.key),K.return=T,T=K):(K=Ir(N.type,N.key,N.props,null,T.mode,K),Zi(K,N),K.return=T,T=K)}return h(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=i(w,N.children||[]),K.return=T,T=K;break e}else{n(T,w);break}else t(T,w);w=w.sibling}K=Eo(N,T.mode,K),K.return=T,T=K}return h(T);case R:return N=Ra(N),ct(T,w,N,K)}if(Oe(N))return oe(T,w,N,K);if(Ee(N)){if(be=Ee(N),typeof be!="function")throw Error(c(150));return N=be.call(N),Te(T,w,N,K)}if(typeof N.then=="function")return ct(T,w,ns(N),K);if(N.$$typeof===J)return ct(T,w,Pr(T,N),K);ls(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=i(w,N),K.return=T,T=K):(n(T,w),K=No(N,T.mode,K),K.return=T,T=K),h(T)):n(T,w)}return function(T,w,N,K){try{Fi=0;var be=ct(T,w,N,K);return oi=null,be}catch(ue){if(ue===si||ue===es)throw ue;var Pe=En(29,ue,null,T.mode);return Pe.lanes=K,Pe.return=T,Pe}finally{}}}var ja=zd(!0),Dd=zd(!1),Zl=!1;function Bo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ho(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 Ql(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Il(e,t,n){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(tt&2)!==0){var i=l.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),l.pending=t,t=Qr(e),bd(e,null,n),t}return Zr(e,l,t,n),Qr(e)}function Qi(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,gl(e,n)}}function Yo(e,t){var n=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,n===l)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var h={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};s===null?i=s=h:s=s.next=h,n=n.next}while(n!==null);s===null?i=s=t:s=s.next=t}else i=s=t;n={baseState:l.baseState,firstBaseUpdate:i,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 Ko=!1;function Ii(){if(Ko){var e=ri;if(e!==null)throw e}}function Ji(e,t,n,l){Ko=!1;var i=e.updateQueue;Zl=!1;var s=i.firstBaseUpdate,h=i.lastBaseUpdate,g=i.shared.pending;if(g!==null){i.shared.pending=null;var x=g,E=x.next;x.next=null,h===null?s=E:h.next=E,h=x;var B=e.alternate;B!==null&&(B=B.updateQueue,g=B.lastBaseUpdate,g!==h&&(g===null?B.firstBaseUpdate=E:g.next=E,B.lastBaseUpdate=x))}if(s!==null){var G=i.baseState;h=0,B=E=x=null,g=s;do{var A=g.lane&-536870913,M=A!==g.lane;if(M?(Ze&A)===A:(l&A)===A){A!==0&&A===ii&&(Ko=!0),B!==null&&(B=B.next={lane:0,tag:g.tag,payload:g.payload,callback:null,next:null});e:{var oe=e,Te=g;A=t;var ct=n;switch(Te.tag){case 1:if(oe=Te.payload,typeof oe=="function"){G=oe.call(ct,G,A);break e}G=oe;break e;case 3:oe.flags=oe.flags&-65537|128;case 0:if(oe=Te.payload,A=typeof oe=="function"?oe.call(ct,G,A):oe,A==null)break e;G=C({},G,A);break e;case 2:Zl=!0}}A=g.callback,A!==null&&(e.flags|=64,M&&(e.flags|=8192),M=i.callbacks,M===null?i.callbacks=[A]:M.push(A))}else M={lane:A,tag:g.tag,payload:g.payload,callback:g.callback,next:null},B===null?(E=B=M,x=G):B=B.next=M,h|=A;if(g=g.next,g===null){if(g=i.shared.pending,g===null)break;M=g,g=M.next,M.next=null,i.lastBaseUpdate=M,i.shared.pending=null}}while(!0);B===null&&(x=G),i.baseState=x,i.firstBaseUpdate=E,i.lastBaseUpdate=B,s===null&&(i.shared.lanes=0),ea|=h,e.lanes=h,e.memoizedState=G}}function Od(e,t){if(typeof e!="function")throw Error(c(191,e));e.call(t)}function Ld(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Od(n[e],t)}var ci=qe(null),as=qe(0);function Ud(e,t){e=zl,pe(as,e),pe(ci,t),zl=e|t.baseLanes}function Go(){pe(as,zl),pe(ci,ci.current)}function qo(){zl=as.current,Z(ci),Z(as)}var Rn=qe(null),Xn=null;function Jl(e){var t=e.alternate;pe(jt,jt.current&1),pe(Rn,e),Xn===null&&(t===null||ci.current!==null||t.memoizedState!==null)&&(Xn=e)}function Vo(e){pe(jt,jt.current),pe(Rn,e),Xn===null&&(Xn=e)}function Bd(e){e.tag===22?(pe(jt,jt.current),pe(Rn,e),Xn===null&&(Xn=e)):Wl()}function Wl(){pe(jt,jt.current),pe(Rn,Rn.current)}function An(e){Z(Rn),Xn===e&&(Xn=null),Z(jt)}var jt=qe(0);function is(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||Jc(n)||Wc(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 Nl=0,De=null,st=null,Lt=null,rs=!1,ui=!1,Ma=!1,ss=0,Wi=0,di=null,Fg=0;function Et(){throw Error(c(321))}function Xo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Nn(e[n],t[n]))return!1;return!0}function Fo(e,t,n,l,i,s){return Nl=s,De=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,j.H=e===null||e.memoizedState===null?wf:sc,Ma=!1,s=n(l,i),Ma=!1,ui&&(s=Yd(t,n,l,i)),Hd(e),s}function Hd(e){j.H=er;var t=st!==null&&st.next!==null;if(Nl=0,Lt=st=De=null,rs=!1,Wi=0,di=null,t)throw Error(c(300));e===null||Ut||(e=e.dependencies,e!==null&&Wr(e)&&(Ut=!0))}function Yd(e,t,n,l){De=e;var i=0;do{if(ui&&(di=null),Wi=0,ui=!1,25<=i)throw Error(c(301));if(i+=1,Lt=st=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=Cf,s=t(n,l)}while(ui);return s}function Zg(){var e=j.H,t=e.useState()[0];return t=typeof t.then=="function"?Pi(t):t,e=e.useState()[0],(st!==null?st.memoizedState:null)!==e&&(De.flags|=1024),t}function Zo(){var e=ss!==0;return ss=0,e}function Qo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Io(e){if(rs){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}rs=!1}Nl=0,Lt=st=De=null,ui=!1,Wi=ss=0,di=null}function fn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Lt===null?De.memoizedState=Lt=e:Lt=Lt.next=e,Lt}function Mt(){if(st===null){var e=De.alternate;e=e!==null?e.memoizedState:null}else e=st.next;var t=Lt===null?De.memoizedState:Lt.next;if(t!==null)Lt=t,st=e;else{if(e===null)throw De.alternate===null?Error(c(467)):Error(c(310));st=e,e={memoizedState:st.memoizedState,baseState:st.baseState,baseQueue:st.baseQueue,queue:st.queue,next:null},Lt===null?De.memoizedState=Lt=e:Lt=Lt.next=e}return Lt}function os(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Pi(e){var t=Wi;return Wi+=1,di===null&&(di=[]),e=Md(di,e,t),t=De,(Lt===null?t.memoizedState:Lt.next)===null&&(t=t.alternate,j.H=t===null||t.memoizedState===null?wf:sc),e}function cs(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Pi(e);if(e.$$typeof===J)return Pt(e)}throw Error(c(438,String(e)))}function Jo(e){var t=null,n=De.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var l=De.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(t={data:l.data.map(function(i){return i.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=os(),De.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]=je;return t.index++,n}function El(e,t){return typeof t=="function"?t(e):t}function us(e){var t=Mt();return Wo(t,st,e)}function Wo(e,t,n){var l=e.queue;if(l===null)throw Error(c(311));l.lastRenderedReducer=n;var i=e.baseQueue,s=l.pending;if(s!==null){if(i!==null){var h=i.next;i.next=s.next,s.next=h}t.baseQueue=i=s,l.pending=null}if(s=e.baseState,i===null)e.memoizedState=s;else{t=i.next;var g=h=null,x=null,E=t,B=!1;do{var G=E.lane&-536870913;if(G!==E.lane?(Ze&G)===G:(Nl&G)===G){var A=E.revertLane;if(A===0)x!==null&&(x=x.next={lane:0,revertLane:0,gesture:null,action:E.action,hasEagerState:E.hasEagerState,eagerState:E.eagerState,next:null}),G===ii&&(B=!0);else if((Nl&A)===A){E=E.next,A===ii&&(B=!0);continue}else G={lane:0,revertLane:E.revertLane,gesture:null,action:E.action,hasEagerState:E.hasEagerState,eagerState:E.eagerState,next:null},x===null?(g=x=G,h=s):x=x.next=G,De.lanes|=A,ea|=A;G=E.action,Ma&&n(s,G),s=E.hasEagerState?E.eagerState:n(s,G)}else A={lane:G,revertLane:E.revertLane,gesture:E.gesture,action:E.action,hasEagerState:E.hasEagerState,eagerState:E.eagerState,next:null},x===null?(g=x=A,h=s):x=x.next=A,De.lanes|=G,ea|=G;E=E.next}while(E!==null&&E!==t);if(x===null?h=s:x.next=g,!Nn(s,e.memoizedState)&&(Ut=!0,B&&(n=ri,n!==null)))throw n;e.memoizedState=s,e.baseState=h,e.baseQueue=x,l.lastRenderedState=s}return i===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Po(e){var t=Mt(),n=t.queue;if(n===null)throw Error(c(311));n.lastRenderedReducer=e;var l=n.dispatch,i=n.pending,s=t.memoizedState;if(i!==null){n.pending=null;var h=i=i.next;do s=e(s,h.action),h=h.next;while(h!==i);Nn(s,t.memoizedState)||(Ut=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),n.lastRenderedState=s}return[s,l]}function Kd(e,t,n){var l=De,i=Mt(),s=Je;if(s){if(n===void 0)throw Error(c(407));n=n()}else n=t();var h=!Nn((st||i).memoizedState,n);if(h&&(i.memoizedState=n,Ut=!0),i=i.queue,tc(Vd.bind(null,l,i,e),[e]),i.getSnapshot!==t||h||Lt!==null&&Lt.memoizedState.tag&1){if(l.flags|=2048,fi(9,{destroy:void 0},qd.bind(null,l,i,n,t),null),ft===null)throw Error(c(349));s||(Nl&127)!==0||Gd(l,t,n)}return n}function Gd(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=De.updateQueue,t===null?(t=os(),De.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function qd(e,t,n,l){t.value=n,t.getSnapshot=l,Xd(t)&&Fd(e)}function Vd(e,t,n){return n(function(){Xd(t)&&Fd(e)})}function Xd(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Nn(e,n)}catch{return!0}}function Fd(e){var t=Sa(e,2);t!==null&&Tn(t,e,2)}function $o(e){var t=fn();if(typeof e=="function"){var n=e;if(e=n(),Ma){zt(!0);try{n()}finally{zt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:El,lastRenderedState:e},t}function Zd(e,t,n,l){return e.baseState=n,Wo(e,st,typeof l=="function"?l:El)}function Qg(e,t,n,l,i){if(hs(e))throw Error(c(485));if(e=t.action,e!==null){var s={payload:i,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(h){s.listeners.push(h)}};j.T!==null?n(!0):s.isTransition=!1,l(s),n=t.pending,n===null?(s.next=t.pending=s,Qd(t,s)):(s.next=n.next,t.pending=n.next=s)}}function Qd(e,t){var n=t.action,l=t.payload,i=e.state;if(t.isTransition){var s=j.T,h={};j.T=h;try{var g=n(i,l),x=j.S;x!==null&&x(h,g),Id(e,t,g)}catch(E){ec(e,t,E)}finally{s!==null&&h.types!==null&&(s.types=h.types),j.T=s}}else try{s=n(i,l),Id(e,t,s)}catch(E){ec(e,t,E)}}function Id(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(l){Jd(e,t,l)},function(l){return ec(e,t,l)}):Jd(e,t,n)}function Jd(e,t,n){t.status="fulfilled",t.value=n,Wd(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Qd(e,n)))}function ec(e,t,n){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=n,Wd(t),t=t.next;while(t!==l)}e.action=null}function Wd(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Pd(e,t){return t}function $d(e,t){if(Je){var n=ft.formState;if(n!==null){e:{var l=De;if(Je){if(yt){t:{for(var i=yt,s=Vn;i.nodeType!==8;){if(!s){i=null;break t}if(i=Fn(i.nextSibling),i===null){i=null;break t}}s=i.data,i=s==="F!"||s==="F"?i:null}if(i){yt=Fn(i.nextSibling),l=i.data==="F!";break e}}Xl(l)}l=!1}l&&(t=n[0])}}return n=fn(),n.memoizedState=n.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Pd,lastRenderedState:t},n.queue=l,n=vf.bind(null,De,l),l.dispatch=n,l=$o(!1),s=rc.bind(null,De,!1,l.queue),l=fn(),i={state:t,dispatch:null,action:e,pending:null},l.queue=i,n=Qg.bind(null,De,i,s,n),i.dispatch=n,l.memoizedState=e,[t,n,!1]}function ef(e){var t=Mt();return tf(t,st,e)}function tf(e,t,n){if(t=Wo(e,t,Pd)[0],e=us(El)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=Pi(t)}catch(h){throw h===si?es:h}else l=t;t=Mt();var i=t.queue,s=i.dispatch;return n!==t.memoizedState&&(De.flags|=2048,fi(9,{destroy:void 0},Ig.bind(null,i,n),null)),[l,s,e]}function Ig(e,t){e.action=t}function nf(e){var t=Mt(),n=st;if(n!==null)return tf(t,n,e);Mt(),t=t.memoizedState,n=Mt();var l=n.queue.dispatch;return n.memoizedState=e,[t,l,!1]}function fi(e,t,n,l){return e={tag:e,create:n,deps:l,inst:t,next:null},t=De.updateQueue,t===null&&(t=os(),De.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 lf(){return Mt().memoizedState}function ds(e,t,n,l){var i=fn();De.flags|=e,i.memoizedState=fi(1|t,{destroy:void 0},n,l===void 0?null:l)}function fs(e,t,n,l){var i=Mt();l=l===void 0?null:l;var s=i.memoizedState.inst;st!==null&&l!==null&&Xo(l,st.memoizedState.deps)?i.memoizedState=fi(t,s,n,l):(De.flags|=e,i.memoizedState=fi(1|t,s,n,l))}function af(e,t){ds(8390656,8,e,t)}function tc(e,t){fs(2048,8,e,t)}function Jg(e){De.flags|=4;var t=De.updateQueue;if(t===null)t=os(),De.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function rf(e){var t=Mt().memoizedState;return Jg({ref:t,nextImpl:e}),function(){if((tt&2)!==0)throw Error(c(440));return t.impl.apply(void 0,arguments)}}function sf(e,t){return fs(4,2,e,t)}function of(e,t){return fs(4,4,e,t)}function cf(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 uf(e,t,n){n=n!=null?n.concat([e]):null,fs(4,4,cf.bind(null,t,e),n)}function nc(){}function df(e,t){var n=Mt();t=t===void 0?null:t;var l=n.memoizedState;return t!==null&&Xo(t,l[1])?l[0]:(n.memoizedState=[e,t],e)}function ff(e,t){var n=Mt();t=t===void 0?null:t;var l=n.memoizedState;if(t!==null&&Xo(t,l[1]))return l[0];if(l=e(),Ma){zt(!0);try{e()}finally{zt(!1)}}return n.memoizedState=[l,t],l}function lc(e,t,n){return n===void 0||(Nl&1073741824)!==0&&(Ze&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=hh(),De.lanes|=e,ea|=e,n)}function hf(e,t,n,l){return Nn(n,t)?n:ci.current!==null?(e=lc(e,n,l),Nn(e,t)||(Ut=!0),e):(Nl&42)===0||(Nl&1073741824)!==0&&(Ze&261930)===0?(Ut=!0,e.memoizedState=n):(e=hh(),De.lanes|=e,ea|=e,t)}function mf(e,t,n,l,i){var s=q.p;q.p=s!==0&&8>s?s:8;var h=j.T,g={};j.T=g,rc(e,!1,t,n);try{var x=i(),E=j.S;if(E!==null&&E(g,x),x!==null&&typeof x=="object"&&typeof x.then=="function"){var B=Xg(x,l);$i(e,t,B,_n(e))}else $i(e,t,l,_n(e))}catch(G){$i(e,t,{then:function(){},status:"rejected",reason:G},_n())}finally{q.p=s,h!==null&&g.types!==null&&(h.types=g.types),j.T=h}}function Wg(){}function ac(e,t,n,l){if(e.tag!==5)throw Error(c(476));var i=pf(e).queue;mf(e,i,t,W,n===null?Wg:function(){return gf(e),n(l)})}function pf(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:W,baseState:W,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:El,lastRenderedState:W},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:El,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function gf(e){var t=pf(e);t.next===null&&(t=e.alternate.memoizedState),$i(e,t.next.queue,{},_n())}function ic(){return Pt(gr)}function bf(){return Mt().memoizedState}function yf(){return Mt().memoizedState}function Pg(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=_n();e=Ql(n);var l=Il(t,e,n);l!==null&&(Tn(l,t,n),Qi(l,t,n)),t={cache:Do()},e.payload=t;return}t=t.return}}function $g(e,t,n){var l=_n();n={lane:l,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},hs(e)?xf(t,n):(n=Co(e,t,n,l),n!==null&&(Tn(n,e,l),Sf(n,t,l)))}function vf(e,t,n){var l=_n();$i(e,t,n,l)}function $i(e,t,n,l){var i={lane:l,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(hs(e))xf(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var h=t.lastRenderedState,g=s(h,n);if(i.hasEagerState=!0,i.eagerState=g,Nn(g,h))return Zr(e,t,i,0),ft===null&&Fr(),!1}catch{}finally{}if(n=Co(e,t,i,l),n!==null)return Tn(n,e,l),Sf(n,t,l),!0}return!1}function rc(e,t,n,l){if(l={lane:2,revertLane:Bc(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},hs(e)){if(t)throw Error(c(479))}else t=Co(e,n,l,2),t!==null&&Tn(t,e,2)}function hs(e){var t=e.alternate;return e===De||t!==null&&t===De}function xf(e,t){ui=rs=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Sf(e,t,n){if((n&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,n|=l,t.lanes=n,gl(e,n)}}var er={readContext:Pt,use:cs,useCallback:Et,useContext:Et,useEffect:Et,useImperativeHandle:Et,useLayoutEffect:Et,useInsertionEffect:Et,useMemo:Et,useReducer:Et,useRef:Et,useState:Et,useDebugValue:Et,useDeferredValue:Et,useTransition:Et,useSyncExternalStore:Et,useId:Et,useHostTransitionStatus:Et,useFormState:Et,useActionState:Et,useOptimistic:Et,useMemoCache:Et,useCacheRefresh:Et};er.useEffectEvent=Et;var wf={readContext:Pt,use:cs,useCallback:function(e,t){return fn().memoizedState=[e,t===void 0?null:t],e},useContext:Pt,useEffect:af,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,ds(4194308,4,cf.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ds(4194308,4,e,t)},useInsertionEffect:function(e,t){ds(4,2,e,t)},useMemo:function(e,t){var n=fn();t=t===void 0?null:t;var l=e();if(Ma){zt(!0);try{e()}finally{zt(!1)}}return n.memoizedState=[l,t],l},useReducer:function(e,t,n){var l=fn();if(n!==void 0){var i=n(t);if(Ma){zt(!0);try{n(t)}finally{zt(!1)}}}else i=t;return l.memoizedState=l.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},l.queue=e,e=e.dispatch=$g.bind(null,De,e),[l.memoizedState,e]},useRef:function(e){var t=fn();return e={current:e},t.memoizedState=e},useState:function(e){e=$o(e);var t=e.queue,n=vf.bind(null,De,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:nc,useDeferredValue:function(e,t){var n=fn();return lc(n,e,t)},useTransition:function(){var e=$o(!1);return e=mf.bind(null,De,e.queue,!0,!1),fn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var l=De,i=fn();if(Je){if(n===void 0)throw Error(c(407));n=n()}else{if(n=t(),ft===null)throw Error(c(349));(Ze&127)!==0||Gd(l,t,n)}i.memoizedState=n;var s={value:n,getSnapshot:t};return i.queue=s,af(Vd.bind(null,l,s,e),[e]),l.flags|=2048,fi(9,{destroy:void 0},qd.bind(null,l,s,n,t),null),n},useId:function(){var e=fn(),t=ft.identifierPrefix;if(Je){var n=sl,l=rl;n=(l&~(1<<32-wt(l)-1)).toString(32)+n,t="_"+t+"R_"+n,n=ss++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=Fg++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:ic,useFormState:$d,useActionState:$d,useOptimistic:function(e){var t=fn();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=rc.bind(null,De,!0,n),n.dispatch=t,[e,t]},useMemoCache:Jo,useCacheRefresh:function(){return fn().memoizedState=Pg.bind(null,De)},useEffectEvent:function(e){var t=fn(),n={impl:e};return t.memoizedState=n,function(){if((tt&2)!==0)throw Error(c(440));return n.impl.apply(void 0,arguments)}}},sc={readContext:Pt,use:cs,useCallback:df,useContext:Pt,useEffect:tc,useImperativeHandle:uf,useInsertionEffect:sf,useLayoutEffect:of,useMemo:ff,useReducer:us,useRef:lf,useState:function(){return us(El)},useDebugValue:nc,useDeferredValue:function(e,t){var n=Mt();return hf(n,st.memoizedState,e,t)},useTransition:function(){var e=us(El)[0],t=Mt().memoizedState;return[typeof e=="boolean"?e:Pi(e),t]},useSyncExternalStore:Kd,useId:bf,useHostTransitionStatus:ic,useFormState:ef,useActionState:ef,useOptimistic:function(e,t){var n=Mt();return Zd(n,st,e,t)},useMemoCache:Jo,useCacheRefresh:yf};sc.useEffectEvent=rf;var Cf={readContext:Pt,use:cs,useCallback:df,useContext:Pt,useEffect:tc,useImperativeHandle:uf,useInsertionEffect:sf,useLayoutEffect:of,useMemo:ff,useReducer:Po,useRef:lf,useState:function(){return Po(El)},useDebugValue:nc,useDeferredValue:function(e,t){var n=Mt();return st===null?lc(n,e,t):hf(n,st.memoizedState,e,t)},useTransition:function(){var e=Po(El)[0],t=Mt().memoizedState;return[typeof e=="boolean"?e:Pi(e),t]},useSyncExternalStore:Kd,useId:bf,useHostTransitionStatus:ic,useFormState:nf,useActionState:nf,useOptimistic:function(e,t){var n=Mt();return st!==null?Zd(n,st,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:Jo,useCacheRefresh:yf};Cf.useEffectEvent=rf;function oc(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 cc={enqueueSetState:function(e,t,n){e=e._reactInternals;var l=_n(),i=Ql(l);i.payload=t,n!=null&&(i.callback=n),t=Il(e,i,l),t!==null&&(Tn(t,e,l),Qi(t,e,l))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var l=_n(),i=Ql(l);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Il(e,i,l),t!==null&&(Tn(t,e,l),Qi(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=_n(),l=Ql(n);l.tag=2,t!=null&&(l.callback=t),t=Il(e,l,n),t!==null&&(Tn(t,e,n),Qi(t,e,n))}};function Tf(e,t,n,l,i,s,h){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,s,h):t.prototype&&t.prototype.isPureReactComponent?!Yi(n,l)||!Yi(i,s):!0}function Nf(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&&cc.enqueueReplaceState(t,t.state,null)}function _a(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 i in e)n[i]===void 0&&(n[i]=e[i])}return n}function Ef(e){Xr(e)}function Rf(e){console.error(e)}function Af(e){Xr(e)}function ms(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function jf(e,t,n){try{var l=e.onCaughtError;l(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(i){setTimeout(function(){throw i})}}function uc(e,t,n){return n=Ql(n),n.tag=3,n.payload={element:null},n.callback=function(){ms(e,t)},n}function Mf(e){return e=Ql(e),e.tag=3,e}function _f(e,t,n,l){var i=n.type.getDerivedStateFromError;if(typeof i=="function"){var s=l.value;e.payload=function(){return i(s)},e.callback=function(){jf(t,n,l)}}var h=n.stateNode;h!==null&&typeof h.componentDidCatch=="function"&&(e.callback=function(){jf(t,n,l),typeof i!="function"&&(ta===null?ta=new Set([this]):ta.add(this));var g=l.stack;this.componentDidCatch(l.value,{componentStack:g!==null?g:""})})}function eb(e,t,n,l,i){if(n.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=n.alternate,t!==null&&ai(t,n,i,!0),n=Rn.current,n!==null){switch(n.tag){case 31:case 13:return Xn===null?Es():n.alternate===null&&Rt===0&&(Rt=3),n.flags&=-257,n.flags|=65536,n.lanes=i,l===ts?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([l]):t.add(l),Oc(e,l,i)),!1;case 22:return n.flags|=65536,l===ts?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)),Oc(e,l,i)),!1}throw Error(c(435,n.tag))}return Oc(e,l,i),Es(),!1}if(Je)return t=Rn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=i,l!==jo&&(e=Error(c(422),{cause:l}),qi(Kn(e,n)))):(l!==jo&&(t=Error(c(423),{cause:l}),qi(Kn(t,n))),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,l=Kn(l,n),i=uc(e.stateNode,l,i),Yo(e,i),Rt!==4&&(Rt=2)),!1;var s=Error(c(520),{cause:l});if(s=Kn(s,n),or===null?or=[s]:or.push(s),Rt!==4&&(Rt=2),t===null)return!0;l=Kn(l,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=i&-i,n.lanes|=e,e=uc(n.stateNode,l,e),Yo(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"&&(ta===null||!ta.has(s))))return n.flags|=65536,i&=-i,n.lanes|=i,i=Mf(i),_f(i,e,n,l),Yo(n,i),!1}n=n.return}while(n!==null);return!1}var dc=Error(c(461)),Ut=!1;function $t(e,t,n,l){t.child=e===null?Dd(t,null,n,l):ja(t,e.child,n,l)}function kf(e,t,n,l,i){n=n.render;var s=t.ref;if("ref"in l){var h={};for(var g in l)g!=="ref"&&(h[g]=l[g])}else h=l;return Na(t),l=Fo(e,t,n,h,s,i),g=Zo(),e!==null&&!Ut?(Qo(e,t,i),Rl(e,t,i)):(Je&&g&&Ro(t),t.flags|=1,$t(e,t,l,i),t.child)}function zf(e,t,n,l,i){if(e===null){var s=n.type;return typeof s=="function"&&!To(s)&&s.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=s,Df(e,t,s,l,i)):(e=Ir(n.type,null,l,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!vc(e,i)){var h=s.memoizedProps;if(n=n.compare,n=n!==null?n:Yi,n(h,l)&&e.ref===t.ref)return Rl(e,t,i)}return t.flags|=1,e=Sl(s,l),e.ref=t.ref,e.return=t,t.child=e}function Df(e,t,n,l,i){if(e!==null){var s=e.memoizedProps;if(Yi(s,l)&&e.ref===t.ref)if(Ut=!1,t.pendingProps=l=s,vc(e,i))(e.flags&131072)!==0&&(Ut=!0);else return t.lanes=e.lanes,Rl(e,t,i)}return fc(e,t,n,l,i)}function Of(e,t,n,l){var i=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,i=0;l!==null;)i=i|l.lanes|l.childLanes,l=l.sibling;l=i&~s}else l=0,t.child=null;return Lf(e,t,s,n,l)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&$r(t,s!==null?s.cachePool:null),s!==null?Ud(t,s):Go(),Bd(t);else return l=t.lanes=536870912,Lf(e,t,s!==null?s.baseLanes|n:n,n,l)}else s!==null?($r(t,s.cachePool),Ud(t,s),Wl(),t.memoizedState=null):(e!==null&&$r(t,null),Go(),Wl());return $t(e,t,i,n),t.child}function tr(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Lf(e,t,n,l,i){var s=Lo();return s=s===null?null:{parent:Ot._currentValue,pool:s},t.memoizedState={baseLanes:n,cachePool:s},e!==null&&$r(t,null),Go(),Bd(t),e!==null&&ai(e,t,l,!0),t.childLanes=i,null}function ps(e,t){return t=bs({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Uf(e,t,n){return ja(t,e.child,null,n),e=ps(t,t.pendingProps),e.flags|=2,An(t),t.memoizedState=null,e}function tb(e,t,n){var l=t.pendingProps,i=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Je){if(l.mode==="hidden")return e=ps(t,l),t.lanes=536870912,tr(null,e);if(Vo(t),(e=yt)?(e=Ih(e,Vn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ql!==null?{id:rl,overflow:sl}:null,retryLane:536870912,hydrationErrors:null},n=vd(e),n.return=t,t.child=n,Wt=t,yt=null)):e=null,e===null)throw Xl(t);return t.lanes=536870912,null}return ps(t,l)}var s=e.memoizedState;if(s!==null){var h=s.dehydrated;if(Vo(t),i)if(t.flags&256)t.flags&=-257,t=Uf(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(c(558));else if(Ut||ai(e,t,n,!1),i=(n&e.childLanes)!==0,Ut||i){if(l=ft,l!==null&&(h=Ga(l,n),h!==0&&h!==s.retryLane))throw s.retryLane=h,Sa(e,h),Tn(l,e,h),dc;Es(),t=Uf(e,t,n)}else e=s.treeContext,yt=Fn(h.nextSibling),Wt=t,Je=!0,Vl=null,Vn=!1,e!==null&&wd(t,e),t=ps(t,l),t.flags|=4096;return t}return e=Sl(e.child,{mode:l.mode,children:l.children}),e.ref=t.ref,t.child=e,e.return=t,e}function gs(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 fc(e,t,n,l,i){return Na(t),n=Fo(e,t,n,l,void 0,i),l=Zo(),e!==null&&!Ut?(Qo(e,t,i),Rl(e,t,i)):(Je&&l&&Ro(t),t.flags|=1,$t(e,t,n,i),t.child)}function Bf(e,t,n,l,i,s){return Na(t),t.updateQueue=null,n=Yd(t,l,n,i),Hd(e),l=Zo(),e!==null&&!Ut?(Qo(e,t,s),Rl(e,t,s)):(Je&&l&&Ro(t),t.flags|=1,$t(e,t,n,s),t.child)}function Hf(e,t,n,l,i){if(Na(t),t.stateNode===null){var s=ei,h=n.contextType;typeof h=="object"&&h!==null&&(s=Pt(h)),s=new n(l,s),t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=cc,t.stateNode=s,s._reactInternals=t,s=t.stateNode,s.props=l,s.state=t.memoizedState,s.refs={},Bo(t),h=n.contextType,s.context=typeof h=="object"&&h!==null?Pt(h):ei,s.state=t.memoizedState,h=n.getDerivedStateFromProps,typeof h=="function"&&(oc(t,n,h,l),s.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(h=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),h!==s.state&&cc.enqueueReplaceState(s,s.state,null),Ji(t,l,s,i),Ii(),s.state=t.memoizedState),typeof s.componentDidMount=="function"&&(t.flags|=4194308),l=!0}else if(e===null){s=t.stateNode;var g=t.memoizedProps,x=_a(n,g);s.props=x;var E=s.context,B=n.contextType;h=ei,typeof B=="object"&&B!==null&&(h=Pt(B));var G=n.getDerivedStateFromProps;B=typeof G=="function"||typeof s.getSnapshotBeforeUpdate=="function",g=t.pendingProps!==g,B||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(g||E!==h)&&Nf(t,s,l,h),Zl=!1;var A=t.memoizedState;s.state=A,Ji(t,l,s,i),Ii(),E=t.memoizedState,g||A!==E||Zl?(typeof G=="function"&&(oc(t,n,G,l),E=t.memoizedState),(x=Zl||Tf(t,n,x,l,A,E,h))?(B||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=h,l=x):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{s=t.stateNode,Ho(e,t),h=t.memoizedProps,B=_a(n,h),s.props=B,G=t.pendingProps,A=s.context,E=n.contextType,x=ei,typeof E=="object"&&E!==null&&(x=Pt(E)),g=n.getDerivedStateFromProps,(E=typeof g=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(h!==G||A!==x)&&Nf(t,s,l,x),Zl=!1,A=t.memoizedState,s.state=A,Ji(t,l,s,i),Ii();var M=t.memoizedState;h!==G||A!==M||Zl||e!==null&&e.dependencies!==null&&Wr(e.dependencies)?(typeof g=="function"&&(oc(t,n,g,l),M=t.memoizedState),(B=Zl||Tf(t,n,B,l,A,M,x)||e!==null&&e.dependencies!==null&&Wr(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"||h===e.memoizedProps&&A===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||h===e.memoizedProps&&A===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=M),s.props=l,s.state=M,s.context=x,l=B):(typeof s.componentDidUpdate!="function"||h===e.memoizedProps&&A===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||h===e.memoizedProps&&A===e.memoizedState||(t.flags|=1024),l=!1)}return s=l,gs(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=ja(t,e.child,null,i),t.child=ja(t,null,n,i)):$t(e,t,n,i),t.memoizedState=s.state,e=t.child):e=Rl(e,t,i),e}function Yf(e,t,n,l){return Ca(),t.flags|=256,$t(e,t,n,l),t.child}var hc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function mc(e){return{baseLanes:e,cachePool:Ad()}}function pc(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Mn),e}function Kf(e,t,n){var l=t.pendingProps,i=!1,s=(t.flags&128)!==0,h;if((h=s)||(h=e!==null&&e.memoizedState===null?!1:(jt.current&2)!==0),h&&(i=!0,t.flags&=-129),h=(t.flags&32)!==0,t.flags&=-33,e===null){if(Je){if(i?Jl(t):Wl(),(e=yt)?(e=Ih(e,Vn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ql!==null?{id:rl,overflow:sl}:null,retryLane:536870912,hydrationErrors:null},n=vd(e),n.return=t,t.child=n,Wt=t,yt=null)):e=null,e===null)throw Xl(t);return Wc(e)?t.lanes=32:t.lanes=536870912,null}var g=l.children;return l=l.fallback,i?(Wl(),i=t.mode,g=bs({mode:"hidden",children:g},i),l=wa(l,i,n,null),g.return=t,l.return=t,g.sibling=l,t.child=g,l=t.child,l.memoizedState=mc(n),l.childLanes=pc(e,h,n),t.memoizedState=hc,tr(null,l)):(Jl(t),gc(t,g))}var x=e.memoizedState;if(x!==null&&(g=x.dehydrated,g!==null)){if(s)t.flags&256?(Jl(t),t.flags&=-257,t=bc(e,t,n)):t.memoizedState!==null?(Wl(),t.child=e.child,t.flags|=128,t=null):(Wl(),g=l.fallback,i=t.mode,l=bs({mode:"visible",children:l.children},i),g=wa(g,i,n,null),g.flags|=2,l.return=t,g.return=t,l.sibling=g,t.child=l,ja(t,e.child,null,n),l=t.child,l.memoizedState=mc(n),l.childLanes=pc(e,h,n),t.memoizedState=hc,t=tr(null,l));else if(Jl(t),Wc(g)){if(h=g.nextSibling&&g.nextSibling.dataset,h)var E=h.dgst;h=E,l=Error(c(419)),l.stack="",l.digest=h,qi({value:l,source:null,stack:null}),t=bc(e,t,n)}else if(Ut||ai(e,t,n,!1),h=(n&e.childLanes)!==0,Ut||h){if(h=ft,h!==null&&(l=Ga(h,n),l!==0&&l!==x.retryLane))throw x.retryLane=l,Sa(e,l),Tn(h,e,l),dc;Jc(g)||Es(),t=bc(e,t,n)}else Jc(g)?(t.flags|=192,t.child=e.child,t=null):(e=x.treeContext,yt=Fn(g.nextSibling),Wt=t,Je=!0,Vl=null,Vn=!1,e!==null&&wd(t,e),t=gc(t,l.children),t.flags|=4096);return t}return i?(Wl(),g=l.fallback,i=t.mode,x=e.child,E=x.sibling,l=Sl(x,{mode:"hidden",children:l.children}),l.subtreeFlags=x.subtreeFlags&65011712,E!==null?g=Sl(E,g):(g=wa(g,i,n,null),g.flags|=2),g.return=t,l.return=t,l.sibling=g,t.child=l,tr(null,l),l=t.child,g=e.child.memoizedState,g===null?g=mc(n):(i=g.cachePool,i!==null?(x=Ot._currentValue,i=i.parent!==x?{parent:x,pool:x}:i):i=Ad(),g={baseLanes:g.baseLanes|n,cachePool:i}),l.memoizedState=g,l.childLanes=pc(e,h,n),t.memoizedState=hc,tr(e.child,l)):(Jl(t),n=e.child,e=n.sibling,n=Sl(n,{mode:"visible",children:l.children}),n.return=t,n.sibling=null,e!==null&&(h=t.deletions,h===null?(t.deletions=[e],t.flags|=16):h.push(e)),t.child=n,t.memoizedState=null,n)}function gc(e,t){return t=bs({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function bs(e,t){return e=En(22,e,null,t),e.lanes=0,e}function bc(e,t,n){return ja(t,e.child,null,n),e=gc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Gf(e,t,n){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),ko(e.return,t,n)}function yc(e,t,n,l,i,s){var h=e.memoizedState;h===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:n,tailMode:i,treeForkCount:s}:(h.isBackwards=t,h.rendering=null,h.renderingStartTime=0,h.last=l,h.tail=n,h.tailMode=i,h.treeForkCount=s)}function qf(e,t,n){var l=t.pendingProps,i=l.revealOrder,s=l.tail;l=l.children;var h=jt.current,g=(h&2)!==0;if(g?(h=h&1|2,t.flags|=128):h&=1,pe(jt,h),$t(e,t,l,n),l=Je?Gi:0,!g&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Gf(e,n,t);else if(e.tag===19)Gf(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(i){case"forwards":for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&is(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),yc(t,!1,i,n,s,l);break;case"backwards":case"unstable_legacy-backwards":for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&is(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}yc(t,!0,n,null,s,l);break;case"together":yc(t,!1,null,null,void 0,l);break;default:t.memoizedState=null}return t.child}function Rl(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),ea|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(ai(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=Sl(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Sl(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function vc(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Wr(e)))}function nb(e,t,n){switch(t.tag){case 3:Le(t,t.stateNode.containerInfo),Fl(t,Ot,e.memoizedState.cache),Ca();break;case 27:case 5:ut(t);break;case 4:Le(t,t.stateNode.containerInfo);break;case 10:Fl(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Vo(t),null;break;case 13:var l=t.memoizedState;if(l!==null)return l.dehydrated!==null?(Jl(t),t.flags|=128,null):(n&t.child.childLanes)!==0?Kf(e,t,n):(Jl(t),e=Rl(e,t,n),e!==null?e.sibling:null);Jl(t);break;case 19:var i=(e.flags&128)!==0;if(l=(n&t.childLanes)!==0,l||(ai(e,t,n,!1),l=(n&t.childLanes)!==0),i){if(l)return qf(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),pe(jt,jt.current),l)break;return null;case 22:return t.lanes=0,Of(e,t,n,t.pendingProps);case 24:Fl(t,Ot,e.memoizedState.cache)}return Rl(e,t,n)}function Vf(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Ut=!0;else{if(!vc(e,n)&&(t.flags&128)===0)return Ut=!1,nb(e,t,n);Ut=(e.flags&131072)!==0}else Ut=!1,Je&&(t.flags&1048576)!==0&&Sd(t,Gi,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=Ra(t.elementType),t.type=e,typeof e=="function")To(e)?(l=_a(e,l),t.tag=1,t=Hf(null,t,e,l,n)):(t.tag=0,t=fc(null,t,e,l,n));else{if(e!=null){var i=e.$$typeof;if(i===ae){t.tag=11,t=kf(null,t,e,l,n);break e}else if(i===U){t.tag=14,t=zf(null,t,e,l,n);break e}}throw t=ke(e)||e,Error(c(306,t,""))}}return t;case 0:return fc(e,t,t.type,t.pendingProps,n);case 1:return l=t.type,i=_a(l,t.pendingProps),Hf(e,t,l,i,n);case 3:e:{if(Le(t,t.stateNode.containerInfo),e===null)throw Error(c(387));l=t.pendingProps;var s=t.memoizedState;i=s.element,Ho(e,t),Ji(t,l,null,n);var h=t.memoizedState;if(l=h.cache,Fl(t,Ot,l),l!==s.cache&&zo(t,[Ot],n,!0),Ii(),l=h.element,s.isDehydrated)if(s={element:l,isDehydrated:!1,cache:h.cache},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){t=Yf(e,t,l,n);break e}else if(l!==i){i=Kn(Error(c(424)),t),qi(i),t=Yf(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(yt=Fn(e.firstChild),Wt=t,Je=!0,Vl=null,Vn=!0,n=Dd(t,null,l,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ca(),l===i){t=Rl(e,t,n);break e}$t(e,t,l,n)}t=t.child}return t;case 26:return gs(e,t),e===null?(n=tm(t.type,null,t.pendingProps,null))?t.memoizedState=n:Je||(n=t.type,e=t.pendingProps,l=zs(me.current).createElement(n),l[he]=t,l[_e]=e,en(l,n,e),Q(l),t.stateNode=l):t.memoizedState=tm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ut(t),e===null&&Je&&(l=t.stateNode=Ph(t.type,t.pendingProps,me.current),Wt=t,Vn=!0,i=yt,ia(t.type)?(Pc=i,yt=Fn(l.firstChild)):yt=i),$t(e,t,t.pendingProps.children,n),gs(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Je&&((i=l=yt)&&(l=kb(l,t.type,t.pendingProps,Vn),l!==null?(t.stateNode=l,Wt=t,yt=Fn(l.firstChild),Vn=!1,i=!0):i=!1),i||Xl(t)),ut(t),i=t.type,s=t.pendingProps,h=e!==null?e.memoizedProps:null,l=s.children,Zc(i,s)?l=null:h!==null&&Zc(i,h)&&(t.flags|=32),t.memoizedState!==null&&(i=Fo(e,t,Zg,null,null,n),gr._currentValue=i),gs(e,t),$t(e,t,l,n),t.child;case 6:return e===null&&Je&&((e=n=yt)&&(n=zb(n,t.pendingProps,Vn),n!==null?(t.stateNode=n,Wt=t,yt=null,e=!0):e=!1),e||Xl(t)),null;case 13:return Kf(e,t,n);case 4:return Le(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=ja(t,null,l,n):$t(e,t,l,n),t.child;case 11:return kf(e,t,t.type,t.pendingProps,n);case 7:return $t(e,t,t.pendingProps,n),t.child;case 8:return $t(e,t,t.pendingProps.children,n),t.child;case 12:return $t(e,t,t.pendingProps.children,n),t.child;case 10:return l=t.pendingProps,Fl(t,t.type,l.value),$t(e,t,l.children,n),t.child;case 9:return i=t.type._context,l=t.pendingProps.children,Na(t),i=Pt(i),l=l(i),t.flags|=1,$t(e,t,l,n),t.child;case 14:return zf(e,t,t.type,t.pendingProps,n);case 15:return Df(e,t,t.type,t.pendingProps,n);case 19:return qf(e,t,n);case 31:return tb(e,t,n);case 22:return Of(e,t,n,t.pendingProps);case 24:return Na(t),l=Pt(Ot),e===null?(i=Lo(),i===null&&(i=ft,s=Do(),i.pooledCache=s,s.refCount++,s!==null&&(i.pooledCacheLanes|=n),i=s),t.memoizedState={parent:l,cache:i},Bo(t),Fl(t,Ot,i)):((e.lanes&n)!==0&&(Ho(e,t),Ji(t,null,null,n),Ii()),i=e.memoizedState,s=t.memoizedState,i.parent!==l?(i={parent:l,cache:l},t.memoizedState=i,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=i),Fl(t,Ot,l)):(l=s.cache,Fl(t,Ot,l),l!==i.cache&&zo(t,[Ot],n,!0))),$t(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(c(156,t.tag))}function Al(e){e.flags|=4}function xc(e,t,n,l,i){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(bh())e.flags|=8192;else throw Aa=ts,Uo}else e.flags&=-16777217}function Xf(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!rm(t))if(bh())e.flags|=8192;else throw Aa=ts,Uo}function ys(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Ka():536870912,e.lanes|=t,gi|=t)}function nr(e,t){if(!Je)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 vt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,l=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,l|=i.subtreeFlags&65011712,l|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,l|=i.subtreeFlags,l|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=l,e.childLanes=n,t}function lb(e,t,n){var l=t.pendingProps;switch(Ao(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return vt(t),null;case 1:return vt(t),null;case 3:return n=t.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),Tl(Ot),we(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(li(t)?Al(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Mo())),vt(t),null;case 26:var i=t.type,s=t.memoizedState;return e===null?(Al(t),s!==null?(vt(t),Xf(t,s)):(vt(t),xc(t,i,null,l,n))):s?s!==e.memoizedState?(Al(t),vt(t),Xf(t,s)):(vt(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&Al(t),vt(t),xc(t,i,e,l,n)),null;case 27:if(nt(t),n=me.current,i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&Al(t);else{if(!l){if(t.stateNode===null)throw Error(c(166));return vt(t),null}e=ze.current,li(t)?Cd(t):(e=Ph(i,l,n),t.stateNode=e,Al(t))}return vt(t),null;case 5:if(nt(t),i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&Al(t);else{if(!l){if(t.stateNode===null)throw Error(c(166));return vt(t),null}if(s=ze.current,li(t))Cd(t);else{var h=zs(me.current);switch(s){case 1:s=h.createElementNS("http://www.w3.org/2000/svg",i);break;case 2:s=h.createElementNS("http://www.w3.org/1998/Math/MathML",i);break;default:switch(i){case"svg":s=h.createElementNS("http://www.w3.org/2000/svg",i);break;case"math":s=h.createElementNS("http://www.w3.org/1998/Math/MathML",i);break;case"script":s=h.createElement("div"),s.innerHTML="<script><\/script>",s=s.removeChild(s.firstChild);break;case"select":s=typeof l.is=="string"?h.createElement("select",{is:l.is}):h.createElement("select"),l.multiple?s.multiple=!0:l.size&&(s.size=l.size);break;default:s=typeof l.is=="string"?h.createElement(i,{is:l.is}):h.createElement(i)}}s[he]=t,s[_e]=l;e:for(h=t.child;h!==null;){if(h.tag===5||h.tag===6)s.appendChild(h.stateNode);else if(h.tag!==4&&h.tag!==27&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===t)break e;for(;h.sibling===null;){if(h.return===null||h.return===t)break e;h=h.return}h.sibling.return=h.return,h=h.sibling}t.stateNode=s;e:switch(en(s,i,l),i){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&Al(t)}}return vt(t),xc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&Al(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(c(166));if(e=me.current,li(t)){if(e=t.stateNode,n=t.memoizedProps,l=null,i=Wt,i!==null)switch(i.tag){case 27:case 5:l=i.memoizedProps}e[he]=t,e=!!(e.nodeValue===n||l!==null&&l.suppressHydrationWarning===!0||Kh(e.nodeValue,n)),e||Xl(t,!0)}else e=zs(e).createTextNode(l),e[he]=t,t.stateNode=e}return vt(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(l=li(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[he]=t}else Ca(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;vt(t),e=!1}else n=Mo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(An(t),t):(An(t),null);if((t.flags&128)!==0)throw Error(c(558))}return vt(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=li(t),l!==null&&l.dehydrated!==null){if(e===null){if(!i)throw Error(c(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(c(317));i[he]=t}else Ca(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;vt(t),i=!1}else i=Mo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(An(t),t):(An(t),null)}return An(t),(t.flags&128)!==0?(t.lanes=n,t):(n=l!==null,e=e!==null&&e.memoizedState!==null,n&&(l=t.child,i=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(i=l.alternate.memoizedState.cachePool.pool),s=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(s=l.memoizedState.cachePool.pool),s!==i&&(l.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),ys(t,t.updateQueue),vt(t),null);case 4:return we(),e===null&&Gc(t.stateNode.containerInfo),vt(t),null;case 10:return Tl(t.type),vt(t),null;case 19:if(Z(jt),l=t.memoizedState,l===null)return vt(t),null;if(i=(t.flags&128)!==0,s=l.rendering,s===null)if(i)nr(l,!1);else{if(Rt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(s=is(e),s!==null){for(t.flags|=128,nr(l,!1),e=s.updateQueue,t.updateQueue=e,ys(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)yd(n,e),n=n.sibling;return pe(jt,jt.current&1|2),Je&&wl(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&$()>Cs&&(t.flags|=128,i=!0,nr(l,!1),t.lanes=4194304)}else{if(!i)if(e=is(s),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,ys(t,e),nr(l,!0),l.tail===null&&l.tailMode==="hidden"&&!s.alternate&&!Je)return vt(t),null}else 2*$()-l.renderingStartTime>Cs&&n!==536870912&&(t.flags|=128,i=!0,nr(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=$(),e.sibling=null,n=jt.current,pe(jt,i?n&1|2:n&1),Je&&wl(t,l.treeForkCount),e):(vt(t),null);case 22:case 23:return An(t),qo(),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&&(vt(t),t.subtreeFlags&6&&(t.flags|=8192)):vt(t),n=t.updateQueue,n!==null&&ys(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&&Z(Ea),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Tl(Ot),vt(t),null;case 25:return null;case 30:return null}throw Error(c(156,t.tag))}function ab(e,t){switch(Ao(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Tl(Ot),we(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return nt(t),null;case 31:if(t.memoizedState!==null){if(An(t),t.alternate===null)throw Error(c(340));Ca()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(An(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(c(340));Ca()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Z(jt),null;case 4:return we(),null;case 10:return Tl(t.type),null;case 22:case 23:return An(t),qo(),e!==null&&Z(Ea),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Tl(Ot),null;case 25:return null;default:return null}}function Ff(e,t){switch(Ao(t),t.tag){case 3:Tl(Ot),we();break;case 26:case 27:case 5:nt(t);break;case 4:we();break;case 31:t.memoizedState!==null&&An(t);break;case 13:An(t);break;case 19:Z(jt);break;case 10:Tl(t.type);break;case 22:case 23:An(t),qo(),e!==null&&Z(Ea);break;case 24:Tl(Ot)}}function lr(e,t){try{var n=t.updateQueue,l=n!==null?n.lastEffect:null;if(l!==null){var i=l.next;n=i;do{if((n.tag&e)===e){l=void 0;var s=n.create,h=n.inst;l=s(),h.destroy=l}n=n.next}while(n!==i)}}catch(g){rt(t,t.return,g)}}function Pl(e,t,n){try{var l=t.updateQueue,i=l!==null?l.lastEffect:null;if(i!==null){var s=i.next;l=s;do{if((l.tag&e)===e){var h=l.inst,g=h.destroy;if(g!==void 0){h.destroy=void 0,i=t;var x=n,E=g;try{E()}catch(B){rt(i,x,B)}}}l=l.next}while(l!==s)}}catch(B){rt(t,t.return,B)}}function Zf(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ld(t,n)}catch(l){rt(e,e.return,l)}}}function Qf(e,t,n){n.props=_a(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(l){rt(e,t,l)}}function ar(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(i){rt(e,t,i)}}function ol(e,t){var n=e.ref,l=e.refCleanup;if(n!==null)if(typeof l=="function")try{l()}catch(i){rt(e,t,i)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(i){rt(e,t,i)}else n.current=null}function If(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(i){rt(e,e.return,i)}}function Sc(e,t,n){try{var l=e.stateNode;Eb(l,e.type,n,t),l[_e]=t}catch(i){rt(e,e.return,i)}}function Jf(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&ia(e.type)||e.tag===4}function wc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Jf(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&&ia(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 Cc(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=Hn));else if(l!==4&&(l===27&&ia(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Cc(e,t,n),e=e.sibling;e!==null;)Cc(e,t,n),e=e.sibling}function vs(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&&ia(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(vs(e,t,n),e=e.sibling;e!==null;)vs(e,t,n),e=e.sibling}function Wf(e){var t=e.stateNode,n=e.memoizedProps;try{for(var l=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);en(t,l,n),t[he]=e,t[_e]=n}catch(s){rt(e,e.return,s)}}var jl=!1,Bt=!1,Tc=!1,Pf=typeof WeakSet=="function"?WeakSet:Set,Zt=null;function ib(e,t){if(e=e.containerInfo,Xc=Ys,e=cd(e),bo(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 i=l.anchorOffset,s=l.focusNode;l=l.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var h=0,g=-1,x=-1,E=0,B=0,G=e,A=null;t:for(;;){for(var M;G!==n||i!==0&&G.nodeType!==3||(g=h+i),G!==s||l!==0&&G.nodeType!==3||(x=h+l),G.nodeType===3&&(h+=G.nodeValue.length),(M=G.firstChild)!==null;)A=G,G=M;for(;;){if(G===e)break t;if(A===n&&++E===i&&(g=h),A===s&&++B===l&&(x=h),(M=G.nextSibling)!==null)break;G=A,A=G.parentNode}G=M}n=g===-1||x===-1?null:{start:g,end:x}}else n=null}n=n||{start:0,end:0}}else n=null;for(Fc={focusedElem:e,selectionRange:n},Ys=!1,Zt=t;Zt!==null;)if(t=Zt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Zt=e;else for(;Zt!==null;){switch(t=Zt,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++)i=e[n],i.ref.impl=i.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&s!==null){e=void 0,n=t,i=s.memoizedProps,s=s.memoizedState,l=n.stateNode;try{var oe=_a(n.type,i);e=l.getSnapshotBeforeUpdate(oe,s),l.__reactInternalSnapshotBeforeUpdate=e}catch(Te){rt(n,n.return,Te)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)Ic(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Ic(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,Zt=e;break}Zt=t.return}}function $f(e,t,n){var l=n.flags;switch(n.tag){case 0:case 11:case 15:_l(e,n),l&4&&lr(5,n);break;case 1:if(_l(e,n),l&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(h){rt(n,n.return,h)}else{var i=_a(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(h){rt(n,n.return,h)}}l&64&&Zf(n),l&512&&ar(n,n.return);break;case 3:if(_l(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{Ld(e,t)}catch(h){rt(n,n.return,h)}}break;case 27:t===null&&l&4&&Wf(n);case 26:case 5:_l(e,n),t===null&&l&4&&If(n),l&512&&ar(n,n.return);break;case 12:_l(e,n);break;case 31:_l(e,n),l&4&&nh(e,n);break;case 13:_l(e,n),l&4&&lh(e,n),l&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=mb.bind(null,n),Db(e,n))));break;case 22:if(l=n.memoizedState!==null||jl,!l){t=t!==null&&t.memoizedState!==null||Bt,i=jl;var s=Bt;jl=l,(Bt=t)&&!s?kl(e,n,(n.subtreeFlags&8772)!==0):_l(e,n),jl=i,Bt=s}break;case 30:break;default:_l(e,n)}}function eh(e){var t=e.alternate;t!==null&&(e.alternate=null,eh(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&qa(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 xt=null,xn=!1;function Ml(e,t,n){for(n=n.child;n!==null;)th(e,t,n),n=n.sibling}function th(e,t,n){if(lt&&typeof lt.onCommitFiberUnmount=="function")try{lt.onCommitFiberUnmount(tn,n)}catch{}switch(n.tag){case 26:Bt||ol(n,t),Ml(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Bt||ol(n,t);var l=xt,i=xn;ia(n.type)&&(xt=n.stateNode,xn=!1),Ml(e,t,n),hr(n.stateNode),xt=l,xn=i;break;case 5:Bt||ol(n,t);case 6:if(l=xt,i=xn,xt=null,Ml(e,t,n),xt=l,xn=i,xt!==null)if(xn)try{(xt.nodeType===9?xt.body:xt.nodeName==="HTML"?xt.ownerDocument.body:xt).removeChild(n.stateNode)}catch(s){rt(n,t,s)}else try{xt.removeChild(n.stateNode)}catch(s){rt(n,t,s)}break;case 18:xt!==null&&(xn?(e=xt,Zh(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Ti(e)):Zh(xt,n.stateNode));break;case 4:l=xt,i=xn,xt=n.stateNode.containerInfo,xn=!0,Ml(e,t,n),xt=l,xn=i;break;case 0:case 11:case 14:case 15:Pl(2,n,t),Bt||Pl(4,n,t),Ml(e,t,n);break;case 1:Bt||(ol(n,t),l=n.stateNode,typeof l.componentWillUnmount=="function"&&Qf(n,t,l)),Ml(e,t,n);break;case 21:Ml(e,t,n);break;case 22:Bt=(l=Bt)||n.memoizedState!==null,Ml(e,t,n),Bt=l;break;default:Ml(e,t,n)}}function nh(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Ti(e)}catch(n){rt(t,t.return,n)}}}function lh(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Ti(e)}catch(n){rt(t,t.return,n)}}function rb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Pf),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Pf),t;default:throw Error(c(435,e.tag))}}function xs(e,t){var n=rb(e);t.forEach(function(l){if(!n.has(l)){n.add(l);var i=pb.bind(null,e,l);l.then(i,i)}})}function Sn(e,t){var n=t.deletions;if(n!==null)for(var l=0;l<n.length;l++){var i=n[l],s=e,h=t,g=h;e:for(;g!==null;){switch(g.tag){case 27:if(ia(g.type)){xt=g.stateNode,xn=!1;break e}break;case 5:xt=g.stateNode,xn=!1;break e;case 3:case 4:xt=g.stateNode.containerInfo,xn=!0;break e}g=g.return}if(xt===null)throw Error(c(160));th(s,h,i),xt=null,xn=!1,s=i.alternate,s!==null&&(s.return=null),i.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)ah(t,e),t=t.sibling}var $n=null;function ah(e,t){var n=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Sn(t,e),wn(e),l&4&&(Pl(3,e,e.return),lr(3,e),Pl(5,e,e.return));break;case 1:Sn(t,e),wn(e),l&512&&(Bt||n===null||ol(n,n.return)),l&64&&jl&&(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 i=$n;if(Sn(t,e),wn(e),l&512&&(Bt||n===null||ol(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,i=i.ownerDocument||i;t:switch(l){case"title":s=i.getElementsByTagName("title")[0],(!s||s[il]||s[he]||s.namespaceURI==="http://www.w3.org/2000/svg"||s.hasAttribute("itemprop"))&&(s=i.createElement(l),i.head.insertBefore(s,i.querySelector("head > title"))),en(s,l,n),s[he]=e,Q(s),l=s;break e;case"link":var h=am("link","href",i).get(l+(n.href||""));if(h){for(var g=0;g<h.length;g++)if(s=h[g],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)){h.splice(g,1);break t}}s=i.createElement(l),en(s,l,n),i.head.appendChild(s);break;case"meta":if(h=am("meta","content",i).get(l+(n.content||""))){for(g=0;g<h.length;g++)if(s=h[g],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)){h.splice(g,1);break t}}s=i.createElement(l),en(s,l,n),i.head.appendChild(s);break;default:throw Error(c(468,l))}s[he]=e,Q(s),l=s}e.stateNode=l}else im(i,e.type,e.stateNode);else e.stateNode=lm(i,l,e.memoizedProps);else s!==l?(s===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):s.count--,l===null?im(i,e.type,e.stateNode):lm(i,l,e.memoizedProps)):l===null&&e.stateNode!==null&&Sc(e,e.memoizedProps,n.memoizedProps)}break;case 27:Sn(t,e),wn(e),l&512&&(Bt||n===null||ol(n,n.return)),n!==null&&l&4&&Sc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Sn(t,e),wn(e),l&512&&(Bt||n===null||ol(n,n.return)),e.flags&32){i=e.stateNode;try{Gl(i,"")}catch(oe){rt(e,e.return,oe)}}l&4&&e.stateNode!=null&&(i=e.memoizedProps,Sc(e,i,n!==null?n.memoizedProps:i)),l&1024&&(Tc=!0);break;case 6:if(Sn(t,e),wn(e),l&4){if(e.stateNode===null)throw Error(c(162));l=e.memoizedProps,n=e.stateNode;try{n.nodeValue=l}catch(oe){rt(e,e.return,oe)}}break;case 3:if(Ls=null,i=$n,$n=Ds(t.containerInfo),Sn(t,e),$n=i,wn(e),l&4&&n!==null&&n.memoizedState.isDehydrated)try{Ti(t.containerInfo)}catch(oe){rt(e,e.return,oe)}Tc&&(Tc=!1,ih(e));break;case 4:l=$n,$n=Ds(e.stateNode.containerInfo),Sn(t,e),wn(e),$n=l;break;case 12:Sn(t,e),wn(e);break;case 31:Sn(t,e),wn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,xs(e,l)));break;case 13:Sn(t,e),wn(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(ws=$()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,xs(e,l)));break;case 22:i=e.memoizedState!==null;var x=n!==null&&n.memoizedState!==null,E=jl,B=Bt;if(jl=E||i,Bt=B||x,Sn(t,e),Bt=B,jl=E,wn(e),l&8192)e:for(t=e.stateNode,t._visibility=i?t._visibility&-2:t._visibility|1,i&&(n===null||x||jl||Bt||ka(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){x=n=t;try{if(s=x.stateNode,i)h=s.style,typeof h.setProperty=="function"?h.setProperty("display","none","important"):h.display="none";else{g=x.stateNode;var G=x.memoizedProps.style,A=G!=null&&G.hasOwnProperty("display")?G.display:null;g.style.display=A==null||typeof A=="boolean"?"":(""+A).trim()}}catch(oe){rt(x,x.return,oe)}}}else if(t.tag===6){if(n===null){x=t;try{x.stateNode.nodeValue=i?"":x.memoizedProps}catch(oe){rt(x,x.return,oe)}}}else if(t.tag===18){if(n===null){x=t;try{var M=x.stateNode;i?Qh(M,!0):Qh(x.stateNode,!1)}catch(oe){rt(x,x.return,oe)}}}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,xs(e,n))));break;case 19:Sn(t,e),wn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,xs(e,l)));break;case 30:break;case 21:break;default:Sn(t,e),wn(e)}}function wn(e){var t=e.flags;if(t&2){try{for(var n,l=e.return;l!==null;){if(Jf(l)){n=l;break}l=l.return}if(n==null)throw Error(c(160));switch(n.tag){case 27:var i=n.stateNode,s=wc(e);vs(e,s,i);break;case 5:var h=n.stateNode;n.flags&32&&(Gl(h,""),n.flags&=-33);var g=wc(e);vs(e,g,h);break;case 3:case 4:var x=n.stateNode.containerInfo,E=wc(e);Cc(e,E,x);break;default:throw Error(c(161))}}catch(B){rt(e,e.return,B)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function ih(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;ih(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function _l(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)$f(e,t.alternate,t),t=t.sibling}function ka(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Pl(4,t,t.return),ka(t);break;case 1:ol(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&Qf(t,t.return,n),ka(t);break;case 27:hr(t.stateNode);case 26:case 5:ol(t,t.return),ka(t);break;case 22:t.memoizedState===null&&ka(t);break;case 30:ka(t);break;default:ka(t)}e=e.sibling}}function kl(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var l=t.alternate,i=e,s=t,h=s.flags;switch(s.tag){case 0:case 11:case 15:kl(i,s,n),lr(4,s);break;case 1:if(kl(i,s,n),l=s,i=l.stateNode,typeof i.componentDidMount=="function")try{i.componentDidMount()}catch(E){rt(l,l.return,E)}if(l=s,i=l.updateQueue,i!==null){var g=l.stateNode;try{var x=i.shared.hiddenCallbacks;if(x!==null)for(i.shared.hiddenCallbacks=null,i=0;i<x.length;i++)Od(x[i],g)}catch(E){rt(l,l.return,E)}}n&&h&64&&Zf(s),ar(s,s.return);break;case 27:Wf(s);case 26:case 5:kl(i,s,n),n&&l===null&&h&4&&If(s),ar(s,s.return);break;case 12:kl(i,s,n);break;case 31:kl(i,s,n),n&&h&4&&nh(i,s);break;case 13:kl(i,s,n),n&&h&4&&lh(i,s);break;case 22:s.memoizedState===null&&kl(i,s,n),ar(s,s.return);break;case 30:break;default:kl(i,s,n)}t=t.sibling}}function Nc(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&&Vi(n))}function Ec(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Vi(e))}function el(e,t,n,l){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)rh(e,t,n,l),t=t.sibling}function rh(e,t,n,l){var i=t.flags;switch(t.tag){case 0:case 11:case 15:el(e,t,n,l),i&2048&&lr(9,t);break;case 1:el(e,t,n,l);break;case 3:el(e,t,n,l),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Vi(e)));break;case 12:if(i&2048){el(e,t,n,l),e=t.stateNode;try{var s=t.memoizedProps,h=s.id,g=s.onPostCommit;typeof g=="function"&&g(h,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(x){rt(t,t.return,x)}}else el(e,t,n,l);break;case 31:el(e,t,n,l);break;case 13:el(e,t,n,l);break;case 23:break;case 22:s=t.stateNode,h=t.alternate,t.memoizedState!==null?s._visibility&2?el(e,t,n,l):ir(e,t):s._visibility&2?el(e,t,n,l):(s._visibility|=2,hi(e,t,n,l,(t.subtreeFlags&10256)!==0||!1)),i&2048&&Nc(h,t);break;case 24:el(e,t,n,l),i&2048&&Ec(t.alternate,t);break;default:el(e,t,n,l)}}function hi(e,t,n,l,i){for(i=i&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var s=e,h=t,g=n,x=l,E=h.flags;switch(h.tag){case 0:case 11:case 15:hi(s,h,g,x,i),lr(8,h);break;case 23:break;case 22:var B=h.stateNode;h.memoizedState!==null?B._visibility&2?hi(s,h,g,x,i):ir(s,h):(B._visibility|=2,hi(s,h,g,x,i)),i&&E&2048&&Nc(h.alternate,h);break;case 24:hi(s,h,g,x,i),i&&E&2048&&Ec(h.alternate,h);break;default:hi(s,h,g,x,i)}t=t.sibling}}function ir(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,l=t,i=l.flags;switch(l.tag){case 22:ir(n,l),i&2048&&Nc(l.alternate,l);break;case 24:ir(n,l),i&2048&&Ec(l.alternate,l);break;default:ir(n,l)}t=t.sibling}}var rr=8192;function mi(e,t,n){if(e.subtreeFlags&rr)for(e=e.child;e!==null;)sh(e,t,n),e=e.sibling}function sh(e,t,n){switch(e.tag){case 26:mi(e,t,n),e.flags&rr&&e.memoizedState!==null&&Fb(n,$n,e.memoizedState,e.memoizedProps);break;case 5:mi(e,t,n);break;case 3:case 4:var l=$n;$n=Ds(e.stateNode.containerInfo),mi(e,t,n),$n=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=rr,rr=16777216,mi(e,t,n),rr=l):mi(e,t,n));break;default:mi(e,t,n)}}function oh(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 sr(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];Zt=l,uh(l,e)}oh(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)ch(e),e=e.sibling}function ch(e){switch(e.tag){case 0:case 11:case 15:sr(e),e.flags&2048&&Pl(9,e,e.return);break;case 3:sr(e);break;case 12:sr(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ss(e)):sr(e);break;default:sr(e)}}function Ss(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];Zt=l,uh(l,e)}oh(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Pl(8,t,t.return),Ss(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Ss(t));break;default:Ss(t)}e=e.sibling}}function uh(e,t){for(;Zt!==null;){var n=Zt;switch(n.tag){case 0:case 11:case 15:Pl(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:Vi(n.memoizedState.cache)}if(l=n.child,l!==null)l.return=n,Zt=l;else e:for(n=e;Zt!==null;){l=Zt;var i=l.sibling,s=l.return;if(eh(l),l===n){Zt=null;break e}if(i!==null){i.return=s,Zt=i;break e}Zt=s}}}var sb={getCacheForType:function(e){var t=Pt(Ot),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Pt(Ot).controller.signal}},ob=typeof WeakMap=="function"?WeakMap:Map,tt=0,ft=null,Ve=null,Ze=0,it=0,jn=null,$l=!1,pi=!1,Rc=!1,zl=0,Rt=0,ea=0,za=0,Ac=0,Mn=0,gi=0,or=null,Cn=null,jc=!1,ws=0,dh=0,Cs=1/0,Ts=null,ta=null,Gt=0,na=null,bi=null,Dl=0,Mc=0,_c=null,fh=null,cr=0,kc=null;function _n(){return(tt&2)!==0&&Ze!==0?Ze&-Ze:j.T!==null?Bc():ie()}function hh(){if(Mn===0)if((Ze&536870912)===0||Je){var e=fl;fl<<=1,(fl&3932160)===0&&(fl=262144),Mn=e}else Mn=536870912;return e=Rn.current,e!==null&&(e.flags|=32),Mn}function Tn(e,t,n){(e===ft&&(it===2||it===9)||e.cancelPendingCommit!==null)&&(yi(e,0),la(e,Ze,Mn,!1)),ll(e,n),((tt&2)===0||e!==ft)&&(e===ft&&((tt&2)===0&&(za|=n),Rt===4&&la(e,Ze,Mn,!1)),cl(e))}function mh(e,t,n){if((tt&6)!==0)throw Error(c(327));var l=!n&&(t&127)===0&&(t&e.expiredLanes)===0||pn(e,t),i=l?db(e,t):Dc(e,t,!0),s=l;do{if(i===0){pi&&!l&&la(e,t,0,!1);break}else{if(n=e.current.alternate,s&&!cb(n)){i=Dc(e,t,!1),s=!1;continue}if(i===2){if(s=t,e.errorRecoveryDisabledLanes&s)var h=0;else h=e.pendingLanes&-536870913,h=h!==0?h:h&536870912?536870912:0;if(h!==0){t=h;e:{var g=e;i=or;var x=g.current.memoizedState.isDehydrated;if(x&&(yi(g,h).flags|=256),h=Dc(g,h,!1),h!==2){if(Rc&&!x){g.errorRecoveryDisabledLanes|=s,za|=s,i=4;break e}s=Cn,Cn=i,s!==null&&(Cn===null?Cn=s:Cn.push.apply(Cn,s))}i=h}if(s=!1,i!==2)continue}}if(i===1){yi(e,0),la(e,t,0,!0);break}e:{switch(l=e,s=i,s){case 0:case 1:throw Error(c(345));case 4:if((t&4194048)!==t)break;case 6:la(l,t,Mn,!$l);break e;case 2:Cn=null;break;case 3:case 5:break;default:throw Error(c(329))}if((t&62914560)===t&&(i=ws+300-$(),10<i)){if(la(l,t,Mn,!$l),on(l,0,!0)!==0)break e;Dl=t,l.timeoutHandle=Xh(ph.bind(null,l,n,Cn,Ts,jc,t,Mn,za,gi,$l,s,"Throttled",-0,0),i);break e}ph(l,n,Cn,Ts,jc,t,Mn,za,gi,$l,s,null,-0,0)}}break}while(!0);cl(e)}function ph(e,t,n,l,i,s,h,g,x,E,B,G,A,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:Hn},sh(t,s,G);var oe=(s&62914560)===s?ws-$():(s&4194048)===s?dh-$():0;if(oe=Zb(G,oe),oe!==null){Dl=s,e.cancelPendingCommit=oe(Ch.bind(null,e,t,s,n,l,i,h,g,x,B,G,null,A,M)),la(e,s,h,!E);return}}Ch(e,t,s,n,l,i,h,g,x)}function cb(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 i=n[l],s=i.getSnapshot;i=i.value;try{if(!Nn(s(),i))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 la(e,t,n,l){t&=~Ac,t&=~za,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var i=t;0<i;){var s=31-wt(i),h=1<<s;l[s]=-1,i&=~h}n!==0&&pl(e,n,t)}function Ns(){return(tt&6)===0?(ur(0),!1):!0}function zc(){if(Ve!==null){if(it===0)var e=Ve.return;else e=Ve,Cl=Ta=null,Io(e),oi=null,Fi=0,e=Ve;for(;e!==null;)Ff(e.alternate,e),e=e.return;Ve=null}}function yi(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,jb(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Dl=0,zc(),ft=e,Ve=n=Sl(e.current,null),Ze=t,it=0,jn=null,$l=!1,pi=pn(e,t),Rc=!1,gi=Mn=Ac=za=ea=Rt=0,Cn=or=null,jc=!1,(t&8)!==0&&(t|=t&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=t;0<l;){var i=31-wt(l),s=1<<i;t|=e[i],l&=~s}return zl=t,Fr(),n}function gh(e,t){De=null,j.H=er,t===si||t===es?(t=_d(),it=3):t===Uo?(t=_d(),it=4):it=t===dc?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,jn=t,Ve===null&&(Rt=1,ms(e,Kn(t,e.current)))}function bh(){var e=Rn.current;return e===null?!0:(Ze&4194048)===Ze?Xn===null:(Ze&62914560)===Ze||(Ze&536870912)!==0?e===Xn:!1}function yh(){var e=j.H;return j.H=er,e===null?er:e}function vh(){var e=j.A;return j.A=sb,e}function Es(){Rt=4,$l||(Ze&4194048)!==Ze&&Rn.current!==null||(pi=!0),(ea&134217727)===0&&(za&134217727)===0||ft===null||la(ft,Ze,Mn,!1)}function Dc(e,t,n){var l=tt;tt|=2;var i=yh(),s=vh();(ft!==e||Ze!==t)&&(Ts=null,yi(e,t)),t=!1;var h=Rt;e:do try{if(it!==0&&Ve!==null){var g=Ve,x=jn;switch(it){case 8:zc(),h=6;break e;case 3:case 2:case 9:case 6:Rn.current===null&&(t=!0);var E=it;if(it=0,jn=null,vi(e,g,x,E),n&&pi){h=0;break e}break;default:E=it,it=0,jn=null,vi(e,g,x,E)}}ub(),h=Rt;break}catch(B){gh(e,B)}while(!0);return t&&e.shellSuspendCounter++,Cl=Ta=null,tt=l,j.H=i,j.A=s,Ve===null&&(ft=null,Ze=0,Fr()),h}function ub(){for(;Ve!==null;)xh(Ve)}function db(e,t){var n=tt;tt|=2;var l=yh(),i=vh();ft!==e||Ze!==t?(Ts=null,Cs=$()+500,yi(e,t)):pi=pn(e,t);e:do try{if(it!==0&&Ve!==null){t=Ve;var s=jn;t:switch(it){case 1:it=0,jn=null,vi(e,t,s,1);break;case 2:case 9:if(jd(s)){it=0,jn=null,Sh(t);break}t=function(){it!==2&&it!==9||ft!==e||(it=7),cl(e)},s.then(t,t);break e;case 3:it=7;break e;case 4:it=5;break e;case 7:jd(s)?(it=0,jn=null,Sh(t)):(it=0,jn=null,vi(e,t,s,7));break;case 5:var h=null;switch(Ve.tag){case 26:h=Ve.memoizedState;case 5:case 27:var g=Ve;if(h?rm(h):g.stateNode.complete){it=0,jn=null;var x=g.sibling;if(x!==null)Ve=x;else{var E=g.return;E!==null?(Ve=E,Rs(E)):Ve=null}break t}}it=0,jn=null,vi(e,t,s,5);break;case 6:it=0,jn=null,vi(e,t,s,6);break;case 8:zc(),Rt=6;break e;default:throw Error(c(462))}}fb();break}catch(B){gh(e,B)}while(!0);return Cl=Ta=null,j.H=l,j.A=i,tt=n,Ve!==null?0:(ft=null,Ze=0,Fr(),Rt)}function fb(){for(;Ve!==null&&!Vt();)xh(Ve)}function xh(e){var t=Vf(e.alternate,e,zl);e.memoizedProps=e.pendingProps,t===null?Rs(e):Ve=t}function Sh(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Bf(n,t,t.pendingProps,t.type,void 0,Ze);break;case 11:t=Bf(n,t,t.pendingProps,t.type.render,t.ref,Ze);break;case 5:Io(t);default:Ff(n,t),t=Ve=yd(t,zl),t=Vf(n,t,zl)}e.memoizedProps=e.pendingProps,t===null?Rs(e):Ve=t}function vi(e,t,n,l){Cl=Ta=null,Io(t),oi=null,Fi=0;var i=t.return;try{if(eb(e,i,t,n,Ze)){Rt=1,ms(e,Kn(n,e.current)),Ve=null;return}}catch(s){if(i!==null)throw Ve=i,s;Rt=1,ms(e,Kn(n,e.current)),Ve=null;return}t.flags&32768?(Je||l===1?e=!0:pi||(Ze&536870912)!==0?e=!1:($l=e=!0,(l===2||l===9||l===3||l===6)&&(l=Rn.current,l!==null&&l.tag===13&&(l.flags|=16384))),wh(t,e)):Rs(t)}function Rs(e){var t=e;do{if((t.flags&32768)!==0){wh(t,$l);return}e=t.return;var n=lb(t.alternate,t,zl);if(n!==null){Ve=n;return}if(t=t.sibling,t!==null){Ve=t;return}Ve=t=e}while(t!==null);Rt===0&&(Rt=5)}function wh(e,t){do{var n=ab(e.alternate,e);if(n!==null){n.flags&=32767,Ve=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Ve=e;return}Ve=e=n}while(e!==null);Rt=6,Ve=null}function Ch(e,t,n,l,i,s,h,g,x){e.cancelPendingCommit=null;do As();while(Gt!==0);if((tt&6)!==0)throw Error(c(327));if(t!==null){if(t===e.current)throw Error(c(177));if(s=t.lanes|t.childLanes,s|=wo,Hl(e,n,s,h,g,x),e===ft&&(Ve=ft=null,Ze=0),bi=t,na=e,Dl=n,Mc=s,_c=i,fh=l,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,gb(et,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,i=q.p,q.p=2,h=tt,tt|=4;try{ib(e,t,n)}finally{tt=h,q.p=i,j.T=l}}Gt=1,Th(),Nh(),Eh()}}function Th(){if(Gt===1){Gt=0;var e=na,t=bi,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 i=tt;tt|=4;try{ah(t,e);var s=Fc,h=cd(e.containerInfo),g=s.focusedElem,x=s.selectionRange;if(h!==g&&g&&g.ownerDocument&&od(g.ownerDocument.documentElement,g)){if(x!==null&&bo(g)){var E=x.start,B=x.end;if(B===void 0&&(B=E),"selectionStart"in g)g.selectionStart=E,g.selectionEnd=Math.min(B,g.value.length);else{var G=g.ownerDocument||document,A=G&&G.defaultView||window;if(A.getSelection){var M=A.getSelection(),oe=g.textContent.length,Te=Math.min(x.start,oe),ct=x.end===void 0?Te:Math.min(x.end,oe);!M.extend&&Te>ct&&(h=ct,ct=Te,Te=h);var T=sd(g,Te),w=sd(g,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(),Te>ct?(M.addRange(N),M.extend(w.node,w.offset)):(N.setEnd(w.node,w.offset),M.addRange(N))}}}}for(G=[],M=g;M=M.parentNode;)M.nodeType===1&&G.push({element:M,left:M.scrollLeft,top:M.scrollTop});for(typeof g.focus=="function"&&g.focus(),g=0;g<G.length;g++){var K=G[g];K.element.scrollLeft=K.left,K.element.scrollTop=K.top}}Ys=!!Xc,Fc=Xc=null}finally{tt=i,q.p=l,j.T=n}}e.current=t,Gt=2}}function Nh(){if(Gt===2){Gt=0;var e=na,t=bi,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 i=tt;tt|=4;try{$f(e,t.alternate,t)}finally{tt=i,q.p=l,j.T=n}}Gt=3}}function Eh(){if(Gt===4||Gt===3){Gt=0,Yt();var e=na,t=bi,n=Dl,l=fh;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?Gt=5:(Gt=0,bi=na=null,Rh(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(ta=null),Y(n),t=t.stateNode,lt&&typeof lt.onCommitFiberRoot=="function")try{lt.onCommitFiberRoot(tn,t,void 0,(t.current.flags&128)===128)}catch{}if(l!==null){t=j.T,i=q.p,q.p=2,j.T=null;try{for(var s=e.onRecoverableError,h=0;h<l.length;h++){var g=l[h];s(g.value,{componentStack:g.stack})}}finally{j.T=t,q.p=i}}(Dl&3)!==0&&As(),cl(e),i=e.pendingLanes,(n&261930)!==0&&(i&42)!==0?e===kc?cr++:(cr=0,kc=e):cr=0,ur(0)}}function Rh(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Vi(t)))}function As(){return Th(),Nh(),Eh(),Ah()}function Ah(){if(Gt!==5)return!1;var e=na,t=Mc;Mc=0;var n=Y(Dl),l=j.T,i=q.p;try{q.p=32>n?32:n,j.T=null,n=_c,_c=null;var s=na,h=Dl;if(Gt=0,bi=na=null,Dl=0,(tt&6)!==0)throw Error(c(331));var g=tt;if(tt|=4,ch(s.current),rh(s,s.current,h,n),tt=g,ur(0,!1),lt&&typeof lt.onPostCommitFiberRoot=="function")try{lt.onPostCommitFiberRoot(tn,s)}catch{}return!0}finally{q.p=i,j.T=l,Rh(e,t)}}function jh(e,t,n){t=Kn(n,t),t=uc(e.stateNode,t,2),e=Il(e,t,2),e!==null&&(ll(e,2),cl(e))}function rt(e,t,n){if(e.tag===3)jh(e,e,n);else for(;t!==null;){if(t.tag===3){jh(t,e,n);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(ta===null||!ta.has(l))){e=Kn(n,e),n=Mf(2),l=Il(t,n,2),l!==null&&(_f(n,l,t,e),ll(l,2),cl(l));break}}t=t.return}}function Oc(e,t,n){var l=e.pingCache;if(l===null){l=e.pingCache=new ob;var i=new Set;l.set(t,i)}else i=l.get(t),i===void 0&&(i=new Set,l.set(t,i));i.has(n)||(Rc=!0,i.add(n),e=hb.bind(null,e,t,n),t.then(e,e))}function hb(e,t,n){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,ft===e&&(Ze&n)===n&&(Rt===4||Rt===3&&(Ze&62914560)===Ze&&300>$()-ws?(tt&2)===0&&yi(e,0):Ac|=n,gi===Ze&&(gi=0)),cl(e)}function Mh(e,t){t===0&&(t=Ka()),e=Sa(e,t),e!==null&&(ll(e,t),cl(e))}function mb(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Mh(e,n)}function pb(e,t){var n=0;switch(e.tag){case 31:case 13:var l=e.stateNode,i=e.memoizedState;i!==null&&(n=i.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),Mh(e,n)}function gb(e,t){return kt(e,t)}var js=null,xi=null,Lc=!1,Ms=!1,Uc=!1,aa=0;function cl(e){e!==xi&&e.next===null&&(xi===null?js=xi=e:xi=xi.next=e),Ms=!0,Lc||(Lc=!0,yb())}function ur(e,t){if(!Uc&&Ms){Uc=!0;do for(var n=!1,l=js;l!==null;){if(e!==0){var i=l.pendingLanes;if(i===0)var s=0;else{var h=l.suspendedLanes,g=l.pingedLanes;s=(1<<31-wt(42|e)+1)-1,s&=i&~(h&~g),s=s&201326741?s&201326741|1:s?s|2:0}s!==0&&(n=!0,Dh(l,s))}else s=Ze,s=on(l,l===ft?s:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(s&3)===0||pn(l,s)||(n=!0,Dh(l,s));l=l.next}while(n);Uc=!1}}function bb(){_h()}function _h(){Ms=Lc=!1;var e=0;aa!==0&&Ab()&&(e=aa);for(var t=$(),n=null,l=js;l!==null;){var i=l.next,s=kh(l,t);s===0?(l.next=null,n===null?js=i:n.next=i,i===null&&(xi=n)):(n=l,(e!==0||(s&3)!==0)&&(Ms=!0)),l=i}Gt!==0&&Gt!==5||ur(e),aa!==0&&(aa=0)}function kh(e,t){for(var n=e.suspendedLanes,l=e.pingedLanes,i=e.expirationTimes,s=e.pendingLanes&-62914561;0<s;){var h=31-wt(s),g=1<<h,x=i[h];x===-1?((g&n)===0||(g&l)!==0)&&(i[h]=ml(g,t)):x<=t&&(e.expiredLanes|=g),s&=~g}if(t=ft,n=Ze,n=on(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&&Fe(l),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||pn(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(l!==null&&Fe(l),Y(n)){case 2:case 8:n=We;break;case 32:n=et;break;case 268435456:n=mt;break;default:n=et}return l=zh.bind(null,e),n=kt(n,l),e.callbackPriority=t,e.callbackNode=n,t}return l!==null&&l!==null&&Fe(l),e.callbackPriority=2,e.callbackNode=null,2}function zh(e,t){if(Gt!==0&&Gt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(As()&&e.callbackNode!==n)return null;var l=Ze;return l=on(e,e===ft?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(mh(e,l,t),kh(e,$()),e.callbackNode!=null&&e.callbackNode===n?zh.bind(null,e):null)}function Dh(e,t){if(As())return null;mh(e,t,!0)}function yb(){Mb(function(){(tt&6)!==0?kt(Ke,bb):_h()})}function Bc(){if(aa===0){var e=ii;e===0&&(e=Ln,Ln<<=1,(Ln&261888)===0&&(Ln=256)),aa=e}return aa}function Oh(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:xl(""+e)}function Lh(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 vb(e,t,n,l,i){if(t==="submit"&&n&&n.stateNode===i){var s=Oh((i[_e]||null).action),h=l.submitter;h&&(t=(t=h[_e]||null)?Oh(t.formAction):h.getAttribute("formAction"),t!==null&&(s=t,h=null));var g=new Gr("action","action",null,l,i);e.push({event:g,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(aa!==0){var x=h?Lh(i,h):new FormData(i);ac(n,{pending:!0,data:x,method:i.method,action:s},null,x)}}else typeof s=="function"&&(g.preventDefault(),x=h?Lh(i,h):new FormData(i),ac(n,{pending:!0,data:x,method:i.method,action:s},s,x))},currentTarget:i}]})}}for(var Hc=0;Hc<So.length;Hc++){var Yc=So[Hc],xb=Yc.toLowerCase(),Sb=Yc[0].toUpperCase()+Yc.slice(1);Pn(xb,"on"+Sb)}Pn(fd,"onAnimationEnd"),Pn(hd,"onAnimationIteration"),Pn(md,"onAnimationStart"),Pn("dblclick","onDoubleClick"),Pn("focusin","onFocus"),Pn("focusout","onBlur"),Pn(Ug,"onTransitionRun"),Pn(Bg,"onTransitionStart"),Pn(Hg,"onTransitionCancel"),Pn(pd,"onTransitionEnd"),le("onMouseEnter",["mouseout","mouseover"]),le("onMouseLeave",["mouseout","mouseover"]),le("onPointerEnter",["pointerout","pointerover"]),le("onPointerLeave",["pointerout","pointerover"]),Ie("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ie("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ie("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ie("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ie("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ie("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var dr="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(" "),wb=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(dr));function Uh(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var l=e[n],i=l.event;l=l.listeners;e:{var s=void 0;if(t)for(var h=l.length-1;0<=h;h--){var g=l[h],x=g.instance,E=g.currentTarget;if(g=g.listener,x!==s&&i.isPropagationStopped())break e;s=g,i.currentTarget=E;try{s(i)}catch(B){Xr(B)}i.currentTarget=null,s=x}else for(h=0;h<l.length;h++){if(g=l[h],x=g.instance,E=g.currentTarget,g=g.listener,x!==s&&i.isPropagationStopped())break e;s=g,i.currentTarget=E;try{s(i)}catch(B){Xr(B)}i.currentTarget=null,s=x}}}}function Xe(e,t){var n=t[bt];n===void 0&&(n=t[bt]=new Set);var l=e+"__bubble";n.has(l)||(Bh(t,e,2,!1),n.add(l))}function Kc(e,t,n){var l=0;t&&(l|=4),Bh(n,e,l,t)}var _s="_reactListening"+Math.random().toString(36).slice(2);function Gc(e){if(!e[_s]){e[_s]=!0,de.forEach(function(n){n!=="selectionchange"&&(wb.has(n)||Kc(n,!1,e),Kc(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[_s]||(t[_s]=!0,Kc("selectionchange",!1,t))}}function Bh(e,t,n,l){switch(hm(t)){case 2:var i=Jb;break;case 8:i=Wb;break;default:i=lu}n=i.bind(null,t,n,e),i=void 0,!pt||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),l?i!==void 0?e.addEventListener(t,n,{capture:!0,passive:i}):e.addEventListener(t,n,!0):i!==void 0?e.addEventListener(t,n,{passive:i}):e.addEventListener(t,n,!1)}function qc(e,t,n,l,i){var s=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var h=l.tag;if(h===3||h===4){var g=l.stateNode.containerInfo;if(g===i)break;if(h===4)for(h=l.return;h!==null;){var x=h.tag;if((x===3||x===4)&&h.stateNode.containerInfo===i)return;h=h.return}for(;g!==null;){if(h=bl(g),h===null)return;if(x=h.tag,x===5||x===6||x===26||x===27){l=s=h;continue e}g=g.parentNode}}l=l.return}Ft(function(){var E=s,B=Ia(n),G=[];e:{var A=gd.get(e);if(A!==void 0){var M=Gr,oe=e;switch(e){case"keypress":if(ba(n)===0)break e;case"keydown":case"keyup":M=pg;break;case"focusin":oe="focus",M=fo;break;case"focusout":oe="blur",M=fo;break;case"beforeblur":case"afterblur":M=fo;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=Xu;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":M=lg;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":M=yg;break;case fd:case hd:case md:M=rg;break;case pd:M=xg;break;case"scroll":case"scrollend":M=tg;break;case"wheel":M=wg;break;case"copy":case"cut":case"paste":M=og;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":M=Zu;break;case"toggle":case"beforetoggle":M=Tg}var Te=(t&4)!==0,ct=!Te&&(e==="scroll"||e==="scrollend"),T=Te?A!==null?A+"Capture":null:A;Te=[];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=an(w,T),K!=null&&Te.push(fr(w,K,N))),ct)break;w=w.return}0<Te.length&&(A=new M(A,oe,null,n,B),G.push({event:A,listeners:Te}))}}if((t&7)===0){e:{if(A=e==="mouseover"||e==="pointerover",M=e==="mouseout"||e==="pointerout",A&&n!==Qa&&(oe=n.relatedTarget||n.fromElement)&&(bl(oe)||oe[Tt]))break e;if((M||A)&&(A=B.window===B?B:(A=B.ownerDocument)?A.defaultView||A.parentWindow:window,M?(oe=n.relatedTarget||n.toElement,M=E,oe=oe?bl(oe):null,oe!==null&&(ct=f(oe),Te=oe.tag,oe!==ct||Te!==5&&Te!==27&&Te!==6)&&(oe=null)):(M=null,oe=E),M!==oe)){if(Te=Xu,K="onMouseLeave",T="onMouseEnter",w="mouse",(e==="pointerout"||e==="pointerover")&&(Te=Zu,K="onPointerLeave",T="onPointerEnter",w="pointer"),ct=M==null?A:Yl(M),N=oe==null?A:Yl(oe),A=new Te(K,w+"leave",M,n,B),A.target=ct,A.relatedTarget=N,K=null,bl(B)===E&&(Te=new Te(T,w+"enter",oe,n,B),Te.target=N,Te.relatedTarget=ct,K=Te),ct=K,M&&oe)t:{for(Te=Cb,T=M,w=oe,N=0,K=T;K;K=Te(K))N++;K=0;for(var be=w;be;be=Te(be))K++;for(;0<N-K;)T=Te(T),N--;for(;0<K-N;)w=Te(w),K--;for(;N--;){if(T===w||w!==null&&T===w.alternate){Te=T;break t}T=Te(T),w=Te(w)}Te=null}else Te=null;M!==null&&Hh(G,A,M,Te,!1),oe!==null&&ct!==null&&Hh(G,ct,oe,Te,!0)}}e:{if(A=E?Yl(E):window,M=A.nodeName&&A.nodeName.toLowerCase(),M==="select"||M==="input"&&A.type==="file")var Pe=td;else if($u(A))if(nd)Pe=Dg;else{Pe=kg;var ue=_g}else M=A.nodeName,!M||M.toLowerCase()!=="input"||A.type!=="checkbox"&&A.type!=="radio"?E&&Xa(E.elementType)&&(Pe=td):Pe=zg;if(Pe&&(Pe=Pe(e,E))){ed(G,Pe,n,B);break e}ue&&ue(e,A,E),e==="focusout"&&E&&A.type==="number"&&E.memoizedProps.value!=null&&zi(A,"number",A.value)}switch(ue=E?Yl(E):window,e){case"focusin":($u(ue)||ue.contentEditable==="true")&&(Wa=ue,yo=E,Ki=null);break;case"focusout":Ki=yo=Wa=null;break;case"mousedown":vo=!0;break;case"contextmenu":case"mouseup":case"dragend":vo=!1,ud(G,n,B);break;case"selectionchange":if(Lg)break;case"keydown":case"keyup":ud(G,n,B)}var Ue;if(mo)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 Ja?Wu(e,n)&&(Qe="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(Qe="onCompositionStart");Qe&&(Qu&&n.locale!=="ko"&&(Ja||Qe!=="onCompositionStart"?Qe==="onCompositionEnd"&&Ja&&(Ue=ga()):(Nt=B,yn="value"in Nt?Nt.value:Nt.textContent,Ja=!0)),ue=ks(E,Qe),0<ue.length&&(Qe=new Fu(Qe,e,null,n,B),G.push({event:Qe,listeners:ue}),Ue?Qe.data=Ue:(Ue=Pu(n),Ue!==null&&(Qe.data=Ue)))),(Ue=Eg?Rg(e,n):Ag(e,n))&&(Qe=ks(E,"onBeforeInput"),0<Qe.length&&(ue=new Fu("onBeforeInput","beforeinput",null,n,B),G.push({event:ue,listeners:Qe}),ue.data=Ue)),vb(G,e,E,n,B)}Uh(G,t)})}function fr(e,t,n){return{instance:e,listener:t,currentTarget:n}}function ks(e,t){for(var n=t+"Capture",l=[];e!==null;){var i=e,s=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||s===null||(i=an(e,n),i!=null&&l.unshift(fr(e,i,s)),i=an(e,t),i!=null&&l.push(fr(e,i,s))),e.tag===3)return l;e=e.return}return[]}function Cb(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Hh(e,t,n,l,i){for(var s=t._reactName,h=[];n!==null&&n!==l;){var g=n,x=g.alternate,E=g.stateNode;if(g=g.tag,x!==null&&x===l)break;g!==5&&g!==26&&g!==27||E===null||(x=E,i?(E=an(n,s),E!=null&&h.unshift(fr(n,E,x))):i||(E=an(n,s),E!=null&&h.push(fr(n,E,x)))),n=n.return}h.length!==0&&e.push({event:t,listeners:h})}var Tb=/\r\n?/g,Nb=/\u0000|\uFFFD/g;function Yh(e){return(typeof e=="string"?e:""+e).replace(Tb,`
|
|
33
|
+
`).replace(Nb,"")}function Kh(e,t){return t=Yh(t),Yh(e)===t}function ot(e,t,n,l,i,s){switch(n){case"children":typeof l=="string"?t==="body"||t==="textarea"&&l===""||Gl(e,l):(typeof l=="number"||typeof l=="bigint")&&t!=="body"&&Gl(e,""+l);break;case"className":Wn(e,"class",l);break;case"tabIndex":Wn(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":Wn(e,n,l);break;case"style":Di(e,l,s);break;case"data":if(t!=="object"){Wn(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=xl(""+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",i.name,i,null),ot(e,t,"formEncType",i.formEncType,i,null),ot(e,t,"formMethod",i.formMethod,i,null),ot(e,t,"formTarget",i.formTarget,i,null)):(ot(e,t,"encType",i.encType,i,null),ot(e,t,"method",i.method,i,null),ot(e,t,"target",i.target,i,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(n);break}l=xl(""+l),e.setAttribute(n,l);break;case"onClick":l!=null&&(e.onclick=Hn);break;case"onScroll":l!=null&&Xe("scroll",e);break;case"onScrollEnd":l!=null&&Xe("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(i.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=xl(""+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":Xe("beforetoggle",e),Xe("toggle",e),ln(e,"popover",l);break;case"xlinkActuate":cn(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":cn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":cn(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":cn(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":cn(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":cn(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":cn(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":cn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":cn(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":ln(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=Fa.get(n)||n,ln(e,n,l))}}function Vc(e,t,n,l,i,s){switch(n){case"style":Di(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(i.children!=null)throw Error(c(60));e.innerHTML=n}}break;case"children":typeof l=="string"?Gl(e,l):(typeof l=="number"||typeof l=="bigint")&&Gl(e,""+l);break;case"onScroll":l!=null&&Xe("scroll",e);break;case"onScrollEnd":l!=null&&Xe("scrollend",e);break;case"onClick":l!=null&&(e.onclick=Hn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ge.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(i=n.endsWith("Capture"),t=n.slice(2,i?n.length-7:void 0),s=e[_e]||null,s=s!=null?s[n]:null,typeof s=="function"&&e.removeEventListener(t,s,i),typeof l=="function")){typeof s!="function"&&s!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,l,i);break e}n in e?e[n]=l:l===!0?e.setAttribute(n,""):ln(e,n,l)}}}function en(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Xe("error",e),Xe("load",e);var l=!1,i=!1,s;for(s in n)if(n.hasOwnProperty(s)){var h=n[s];if(h!=null)switch(s){case"src":l=!0;break;case"srcSet":i=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(c(137,t));default:ot(e,t,s,h,n,null)}}i&&ot(e,t,"srcSet",n.srcSet,n,null),l&&ot(e,t,"src",n.src,n,null);return;case"input":Xe("invalid",e);var g=s=h=i=null,x=null,E=null;for(l in n)if(n.hasOwnProperty(l)){var B=n[l];if(B!=null)switch(l){case"name":i=B;break;case"type":h=B;break;case"checked":x=B;break;case"defaultChecked":E=B;break;case"value":s=B;break;case"defaultValue":g=B;break;case"children":case"dangerouslySetInnerHTML":if(B!=null)throw Error(c(137,t));break;default:ot(e,t,l,B,n,null)}}Hr(e,s,g,x,E,h,i,!1);return;case"select":Xe("invalid",e),l=h=s=null;for(i in n)if(n.hasOwnProperty(i)&&(g=n[i],g!=null))switch(i){case"value":s=g;break;case"defaultValue":h=g;break;case"multiple":l=g;default:ot(e,t,i,g,n,null)}t=s,n=h,e.multiple=!!l,t!=null?vl(e,!!l,t,!1):n!=null&&vl(e,!!l,n,!0);return;case"textarea":Xe("invalid",e),s=i=l=null;for(h in n)if(n.hasOwnProperty(h)&&(g=n[h],g!=null))switch(h){case"value":l=g;break;case"defaultValue":i=g;break;case"children":s=g;break;case"dangerouslySetInnerHTML":if(g!=null)throw Error(c(91));break;default:ot(e,t,h,g,n,null)}Yr(e,l,i,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":Xe("beforetoggle",e),Xe("toggle",e),Xe("cancel",e),Xe("close",e);break;case"iframe":case"object":Xe("load",e);break;case"video":case"audio":for(l=0;l<dr.length;l++)Xe(dr[l],e);break;case"image":Xe("error",e),Xe("load",e);break;case"details":Xe("toggle",e);break;case"embed":case"source":case"link":Xe("error",e),Xe("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(Xa(t)){for(B in n)n.hasOwnProperty(B)&&(l=n[B],l!==void 0&&Vc(e,t,B,l,n,void 0));return}}for(g in n)n.hasOwnProperty(g)&&(l=n[g],l!=null&&ot(e,t,g,l,n,null))}function Eb(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 i=null,s=null,h=null,g=null,x=null,E=null,B=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 A in l){var M=l[A];if(G=n[A],l.hasOwnProperty(A)&&(M!=null||G!=null))switch(A){case"type":s=M;break;case"name":i=M;break;case"checked":E=M;break;case"defaultChecked":B=M;break;case"value":h=M;break;case"defaultValue":g=M;break;case"children":case"dangerouslySetInnerHTML":if(M!=null)throw Error(c(137,t));break;default:M!==G&&ot(e,t,A,M,l,G)}}ki(e,h,g,x,E,B,s,i);return;case"select":M=h=g=A=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(i in l)if(s=l[i],x=n[i],l.hasOwnProperty(i)&&(s!=null||x!=null))switch(i){case"value":A=s;break;case"defaultValue":g=s;break;case"multiple":h=s;default:s!==x&&ot(e,t,i,s,l,x)}t=g,n=h,l=M,A!=null?vl(e,!!n,A,!1):!!l!=!!n&&(t!=null?vl(e,!!n,t,!0):vl(e,!!n,n?[]:"",!1));return;case"textarea":M=A=null;for(g in n)if(i=n[g],n.hasOwnProperty(g)&&i!=null&&!l.hasOwnProperty(g))switch(g){case"value":break;case"children":break;default:ot(e,t,g,null,l,i)}for(h in l)if(i=l[h],s=n[h],l.hasOwnProperty(h)&&(i!=null||s!=null))switch(h){case"value":A=i;break;case"defaultValue":M=i;break;case"children":break;case"dangerouslySetInnerHTML":if(i!=null)throw Error(c(91));break;default:i!==s&&ot(e,t,h,i,l,s)}un(e,A,M);return;case"option":for(var oe in n)if(A=n[oe],n.hasOwnProperty(oe)&&A!=null&&!l.hasOwnProperty(oe))switch(oe){case"selected":e.selected=!1;break;default:ot(e,t,oe,null,l,A)}for(x in l)if(A=l[x],M=n[x],l.hasOwnProperty(x)&&A!==M&&(A!=null||M!=null))switch(x){case"selected":e.selected=A&&typeof A!="function"&&typeof A!="symbol";break;default:ot(e,t,x,A,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 Te in n)A=n[Te],n.hasOwnProperty(Te)&&A!=null&&!l.hasOwnProperty(Te)&&ot(e,t,Te,null,l,A);for(E in l)if(A=l[E],M=n[E],l.hasOwnProperty(E)&&A!==M&&(A!=null||M!=null))switch(E){case"children":case"dangerouslySetInnerHTML":if(A!=null)throw Error(c(137,t));break;default:ot(e,t,E,A,l,M)}return;default:if(Xa(t)){for(var ct in n)A=n[ct],n.hasOwnProperty(ct)&&A!==void 0&&!l.hasOwnProperty(ct)&&Vc(e,t,ct,void 0,l,A);for(B in l)A=l[B],M=n[B],!l.hasOwnProperty(B)||A===M||A===void 0&&M===void 0||Vc(e,t,B,A,l,M);return}}for(var T in n)A=n[T],n.hasOwnProperty(T)&&A!=null&&!l.hasOwnProperty(T)&&ot(e,t,T,null,l,A);for(G in l)A=l[G],M=n[G],!l.hasOwnProperty(G)||A===M||A==null&&M==null||ot(e,t,G,A,l,M)}function Gh(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Rb(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),l=0;l<n.length;l++){var i=n[l],s=i.transferSize,h=i.initiatorType,g=i.duration;if(s&&g&&Gh(h)){for(h=0,g=i.responseEnd,l+=1;l<n.length;l++){var x=n[l],E=x.startTime;if(E>g)break;var B=x.transferSize,G=x.initiatorType;B&&Gh(G)&&(x=x.responseEnd,h+=B*(x<g?1:(g-E)/(x-E)))}if(--l,t+=8*(s+h)/(i.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 Xc=null,Fc=null;function zs(e){return e.nodeType===9?e:e.ownerDocument}function qh(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 Vh(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 Zc(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 Qc=null;function Ab(){var e=window.event;return e&&e.type==="popstate"?e===Qc?!1:(Qc=e,!0):(Qc=null,!1)}var Xh=typeof setTimeout=="function"?setTimeout:void 0,jb=typeof clearTimeout=="function"?clearTimeout:void 0,Fh=typeof Promise=="function"?Promise:void 0,Mb=typeof queueMicrotask=="function"?queueMicrotask:typeof Fh<"u"?function(e){return Fh.resolve(null).then(e).catch(_b)}:Xh;function _b(e){setTimeout(function(){throw e})}function ia(e){return e==="head"}function Zh(e,t){var n=t,l=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"||n==="/&"){if(l===0){e.removeChild(i),Ti(t);return}l--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")l++;else if(n==="html")hr(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,hr(n);for(var s=n.firstChild;s;){var h=s.nextSibling,g=s.nodeName;s[il]||g==="SCRIPT"||g==="STYLE"||g==="LINK"&&s.rel.toLowerCase()==="stylesheet"||n.removeChild(s),s=h}}else n==="body"&&hr(e.ownerDocument.body);n=i}while(n);Ti(t)}function Qh(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 Ic(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":Ic(n),qa(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function kb(e,t,n,l){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[il])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!==i.rel||e.getAttribute("href")!==(i.href==null||i.href===""?null:i.href)||e.getAttribute("crossorigin")!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute("title")!==(i.title==null?null:i.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(s=e.getAttribute("src"),(s!==(i.src==null?null:i.src)||e.getAttribute("type")!==(i.type==null?null:i.type)||e.getAttribute("crossorigin")!==(i.crossOrigin==null?null:i.crossOrigin))&&s&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var s=i.name==null?null:""+i.name;if(i.type==="hidden"&&e.getAttribute("name")===s)return e}else return e;if(e=Fn(e.nextSibling),e===null)break}return null}function zb(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Fn(e.nextSibling),e===null))return null;return e}function Ih(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Fn(e.nextSibling),e===null))return null;return e}function Jc(e){return e.data==="$?"||e.data==="$~"}function Wc(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Db(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 Fn(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 Pc=null;function Jh(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return Fn(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function Wh(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 Ph(e,t,n){switch(t=zs(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 hr(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);qa(e)}var Zn=new Map,$h=new Set;function Ds(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ol=q.d;q.d={f:Ob,r:Lb,D:Ub,C:Bb,L:Hb,m:Yb,X:Gb,S:Kb,M:qb};function Ob(){var e=Ol.f(),t=Ns();return e||t}function Lb(e){var t=yl(e);t!==null&&t.tag===5&&t.type==="form"?gf(t):Ol.r(e)}var Si=typeof document>"u"?null:document;function em(e,t,n){var l=Si;if(l&&typeof t=="string"&&t){var i=bn(t);i='link[rel="'+e+'"][href="'+i+'"]',typeof n=="string"&&(i+='[crossorigin="'+n+'"]'),$h.has(i)||($h.add(i),e={rel:e,crossOrigin:n,href:t},l.querySelector(i)===null&&(t=l.createElement("link"),en(t,"link",e),Q(t),l.head.appendChild(t)))}}function Ub(e){Ol.D(e),em("dns-prefetch",e,null)}function Bb(e,t){Ol.C(e,t),em("preconnect",e,t)}function Hb(e,t,n){Ol.L(e,t,n);var l=Si;if(l&&e&&t){var i='link[rel="preload"][as="'+bn(t)+'"]';t==="image"&&n&&n.imageSrcSet?(i+='[imagesrcset="'+bn(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(i+='[imagesizes="'+bn(n.imageSizes)+'"]')):i+='[href="'+bn(e)+'"]';var s=i;switch(t){case"style":s=wi(e);break;case"script":s=Ci(e)}Zn.has(s)||(e=C({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Zn.set(s,e),l.querySelector(i)!==null||t==="style"&&l.querySelector(mr(s))||t==="script"&&l.querySelector(pr(s))||(t=l.createElement("link"),en(t,"link",e),Q(t),l.head.appendChild(t)))}}function Yb(e,t){Ol.m(e,t);var n=Si;if(n&&e){var l=t&&typeof t.as=="string"?t.as:"script",i='link[rel="modulepreload"][as="'+bn(l)+'"][href="'+bn(e)+'"]',s=i;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":s=Ci(e)}if(!Zn.has(s)&&(e=C({rel:"modulepreload",href:e},t),Zn.set(s,e),n.querySelector(i)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(pr(s)))return}l=n.createElement("link"),en(l,"link",e),Q(l),n.head.appendChild(l)}}}function Kb(e,t,n){Ol.S(e,t,n);var l=Si;if(l&&e){var i=X(l).hoistableStyles,s=wi(e);t=t||"default";var h=i.get(s);if(!h){var g={loading:0,preload:null};if(h=l.querySelector(mr(s)))g.loading=5;else{e=C({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Zn.get(s))&&$c(e,n);var x=h=l.createElement("link");Q(x),en(x,"link",e),x._p=new Promise(function(E,B){x.onload=E,x.onerror=B}),x.addEventListener("load",function(){g.loading|=1}),x.addEventListener("error",function(){g.loading|=2}),g.loading|=4,Os(h,t,l)}h={type:"stylesheet",instance:h,count:1,state:g},i.set(s,h)}}}function Gb(e,t){Ol.X(e,t);var n=Si;if(n&&e){var l=X(n).hoistableScripts,i=Ci(e),s=l.get(i);s||(s=n.querySelector(pr(i)),s||(e=C({src:e,async:!0},t),(t=Zn.get(i))&&eu(e,t),s=n.createElement("script"),Q(s),en(s,"link",e),n.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},l.set(i,s))}}function qb(e,t){Ol.M(e,t);var n=Si;if(n&&e){var l=X(n).hoistableScripts,i=Ci(e),s=l.get(i);s||(s=n.querySelector(pr(i)),s||(e=C({src:e,async:!0,type:"module"},t),(t=Zn.get(i))&&eu(e,t),s=n.createElement("script"),Q(s),en(s,"link",e),n.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},l.set(i,s))}}function tm(e,t,n,l){var i=(i=me.current)?Ds(i):null;if(!i)throw Error(c(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=wi(n.href),n=X(i).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=wi(n.href);var s=X(i).hoistableStyles,h=s.get(e);if(h||(i=i.ownerDocument||i,h={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},s.set(e,h),(s=i.querySelector(mr(e)))&&!s._p&&(h.instance=s,h.state.loading=5),Zn.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},Zn.set(e,n),s||Vb(i,e,n,h.state))),t&&l===null)throw Error(c(528,""));return h}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=Ci(n),n=X(i).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 wi(e){return'href="'+bn(e)+'"'}function mr(e){return'link[rel="stylesheet"]['+e+"]"}function nm(e){return C({},e,{"data-precedence":e.precedence,precedence:null})}function Vb(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}),en(t,"link",n),Q(t),e.head.appendChild(t))}function Ci(e){return'[src="'+bn(e)+'"]'}function pr(e){return"script[async]"+e}function lm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+bn(n.href)+'"]');if(l)return t.instance=l,Q(l),l;var i=C({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),Q(l),en(l,"style",i),Os(l,n.precedence,e),t.instance=l;case"stylesheet":i=wi(n.href);var s=e.querySelector(mr(i));if(s)return t.state.loading|=4,t.instance=s,Q(s),s;l=nm(n),(i=Zn.get(i))&&$c(l,i),s=(e.ownerDocument||e).createElement("link"),Q(s);var h=s;return h._p=new Promise(function(g,x){h.onload=g,h.onerror=x}),en(s,"link",l),t.state.loading|=4,Os(s,n.precedence,e),t.instance=s;case"script":return s=Ci(n.src),(i=e.querySelector(pr(s)))?(t.instance=i,Q(i),i):(l=n,(i=Zn.get(s))&&(l=C({},n),eu(l,i)),e=e.ownerDocument||e,i=e.createElement("script"),Q(i),en(i,"link",l),e.head.appendChild(i),t.instance=i);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,Os(l,n.precedence,e));return t.instance}function Os(e,t,n){for(var l=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),i=l.length?l[l.length-1]:null,s=i,h=0;h<l.length;h++){var g=l[h];if(g.dataset.precedence===t)s=g;else if(s!==i)break}s?s.parentNode.insertBefore(e,s.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function $c(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function eu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Ls=null;function am(e,t,n){if(Ls===null){var l=new Map,i=Ls=new Map;i.set(n,l)}else i=Ls,l=i.get(n),l||(l=new Map,i.set(n,l));if(l.has(e))return l;for(l.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var s=n[i];if(!(s[il]||s[he]||e==="link"&&s.getAttribute("rel")==="stylesheet")&&s.namespaceURI!=="http://www.w3.org/2000/svg"){var h=s.getAttribute(t)||"";h=e+h;var g=l.get(h);g?g.push(s):l.set(h,[s])}}return l}function im(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function Xb(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 rm(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Fb(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 i=wi(l.href),s=t.querySelector(mr(i));if(s){t=s._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Us.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=s,Q(s);return}s=t.ownerDocument||t,l=nm(l),(i=Zn.get(i))&&$c(l,i),s=s.createElement("link"),Q(s);var h=s;h._p=new Promise(function(g,x){h.onload=g,h.onerror=x}),en(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=Us.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var tu=0;function Zb(e,t){return e.stylesheets&&e.count===0&&Hs(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var l=setTimeout(function(){if(e.stylesheets&&Hs(e,e.stylesheets),e.unsuspend){var s=e.unsuspend;e.unsuspend=null,s()}},6e4+t);0<e.imgBytes&&tu===0&&(tu=62500*Rb());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Hs(e,e.stylesheets),e.unsuspend)){var s=e.unsuspend;e.unsuspend=null,s()}},(e.imgBytes>tu?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(i)}}:null}function Us(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Hs(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Bs=null;function Hs(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Bs=new Map,t.forEach(Qb,e),Bs=null,Us.call(e))}function Qb(e,t){if(!(t.state.loading&4)){var n=Bs.get(e);if(n)var l=n.get(null);else{n=new Map,Bs.set(e,n);for(var i=e.querySelectorAll("link[data-precedence],style[data-precedence]"),s=0;s<i.length;s++){var h=i[s];(h.nodeName==="LINK"||h.getAttribute("media")!=="not all")&&(n.set(h.dataset.precedence,h),l=h)}l&&n.set(null,l)}i=t.instance,h=i.getAttribute("data-precedence"),s=n.get(h)||l,s===l&&n.set(null,i),n.set(h,i),this.count++,l=Us.bind(this),i.addEventListener("load",l),i.addEventListener("error",l),s?s.parentNode.insertBefore(i,s.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var gr={$$typeof:J,Provider:null,Consumer:null,_currentValue:W,_currentValue2:W,_threadCount:0};function Ib(e,t,n,l,i,s,h,g,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=Bl(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Bl(0),this.hiddenUpdates=Bl(null),this.identifierPrefix=l,this.onUncaughtError=i,this.onCaughtError=s,this.onRecoverableError=h,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=x,this.incompleteTransitions=new Map}function sm(e,t,n,l,i,s,h,g,x,E,B,G){return e=new Ib(e,t,n,h,x,E,B,G,g),t=1,s===!0&&(t|=24),s=En(3,null,null,t),e.current=s,s.stateNode=e,t=Do(),t.refCount++,e.pooledCache=t,t.refCount++,s.memoizedState={element:l,isDehydrated:n,cache:t},Bo(s),e}function om(e){return e?(e=ei,e):ei}function cm(e,t,n,l,i,s){i=om(i),l.context===null?l.context=i:l.pendingContext=i,l=Ql(t),l.payload={element:n},s=s===void 0?null:s,s!==null&&(l.callback=s),n=Il(e,l,t),n!==null&&(Tn(n,e,t),Qi(n,e,t))}function um(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function nu(e,t){um(e,t),(e=e.alternate)&&um(e,t)}function dm(e){if(e.tag===13||e.tag===31){var t=Sa(e,67108864);t!==null&&Tn(t,e,67108864),nu(e,67108864)}}function fm(e){if(e.tag===13||e.tag===31){var t=_n();t=L(t);var n=Sa(e,t);n!==null&&Tn(n,e,t),nu(e,t)}}var Ys=!0;function Jb(e,t,n,l){var i=j.T;j.T=null;var s=q.p;try{q.p=2,lu(e,t,n,l)}finally{q.p=s,j.T=i}}function Wb(e,t,n,l){var i=j.T;j.T=null;var s=q.p;try{q.p=8,lu(e,t,n,l)}finally{q.p=s,j.T=i}}function lu(e,t,n,l){if(Ys){var i=au(l);if(i===null)qc(e,t,l,Ks,n),mm(e,l);else if($b(i,e,t,n,l))l.stopPropagation();else if(mm(e,l),t&4&&-1<Pb.indexOf(e)){for(;i!==null;){var s=yl(i);if(s!==null)switch(s.tag){case 3:if(s=s.stateNode,s.current.memoizedState.isDehydrated){var h=It(s.pendingLanes);if(h!==0){var g=s;for(g.pendingLanes|=2,g.entangledLanes|=2;h;){var x=1<<31-wt(h);g.entanglements[1]|=x,h&=~x}cl(s),(tt&6)===0&&(Cs=$()+500,ur(0))}}break;case 31:case 13:g=Sa(s,2),g!==null&&Tn(g,s,2),Ns(),nu(s,2)}if(s=au(l),s===null&&qc(e,t,l,Ks,n),s===i)break;i=s}i!==null&&l.stopPropagation()}else qc(e,t,l,null,n)}}function au(e){return e=Ia(e),iu(e)}var Ks=null;function iu(e){if(Ks=null,e=bl(e),e!==null){var t=f(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=p(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 Ks=e,null}function hm(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(Re()){case Ke:return 2;case We:return 8;case et:case hn:return 32;case mt:return 268435456;default:return 32}default:return 32}}var ru=!1,ra=null,sa=null,oa=null,br=new Map,yr=new Map,ca=[],Pb="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 mm(e,t){switch(e){case"focusin":case"focusout":ra=null;break;case"dragenter":case"dragleave":sa=null;break;case"mouseover":case"mouseout":oa=null;break;case"pointerover":case"pointerout":br.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":yr.delete(t.pointerId)}}function vr(e,t,n,l,i,s){return e===null||e.nativeEvent!==s?(e={blockedOn:t,domEventName:n,eventSystemFlags:l,nativeEvent:s,targetContainers:[i]},t!==null&&(t=yl(t),t!==null&&dm(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function $b(e,t,n,l,i){switch(t){case"focusin":return ra=vr(ra,e,t,n,l,i),!0;case"dragenter":return sa=vr(sa,e,t,n,l,i),!0;case"mouseover":return oa=vr(oa,e,t,n,l,i),!0;case"pointerover":var s=i.pointerId;return br.set(s,vr(br.get(s)||null,e,t,n,l,i)),!0;case"gotpointercapture":return s=i.pointerId,yr.set(s,vr(yr.get(s)||null,e,t,n,l,i)),!0}return!1}function pm(e){var t=bl(e.target);if(t!==null){var n=f(t);if(n!==null){if(t=n.tag,t===13){if(t=p(n),t!==null){e.blockedOn=t,Ae(e.priority,function(){fm(n)});return}}else if(t===31){if(t=m(n),t!==null){e.blockedOn=t,Ae(e.priority,function(){fm(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 Gs(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=au(e.nativeEvent);if(n===null){n=e.nativeEvent;var l=new n.constructor(n.type,n);Qa=l,n.target.dispatchEvent(l),Qa=null}else return t=yl(n),t!==null&&dm(t),e.blockedOn=n,!1;t.shift()}return!0}function gm(e,t,n){Gs(e)&&n.delete(t)}function ey(){ru=!1,ra!==null&&Gs(ra)&&(ra=null),sa!==null&&Gs(sa)&&(sa=null),oa!==null&&Gs(oa)&&(oa=null),br.forEach(gm),yr.forEach(gm)}function qs(e,t){e.blockedOn===t&&(e.blockedOn=null,ru||(ru=!0,o.unstable_scheduleCallback(o.unstable_NormalPriority,ey)))}var Vs=null;function bm(e){Vs!==e&&(Vs=e,o.unstable_scheduleCallback(o.unstable_NormalPriority,function(){Vs===e&&(Vs=null);for(var t=0;t<e.length;t+=3){var n=e[t],l=e[t+1],i=e[t+2];if(typeof l!="function"){if(iu(l||n)===null)continue;break}var s=yl(n);s!==null&&(e.splice(t,3),t-=3,ac(s,{pending:!0,data:i,method:n.method,action:l},l,i))}}))}function Ti(e){function t(x){return qs(x,e)}ra!==null&&qs(ra,e),sa!==null&&qs(sa,e),oa!==null&&qs(oa,e),br.forEach(t),yr.forEach(t);for(var n=0;n<ca.length;n++){var l=ca[n];l.blockedOn===e&&(l.blockedOn=null)}for(;0<ca.length&&(n=ca[0],n.blockedOn===null);)pm(n),n.blockedOn===null&&ca.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(l=0;l<n.length;l+=3){var i=n[l],s=n[l+1],h=i[_e]||null;if(typeof s=="function")h||bm(n);else if(h){var g=null;if(s&&s.hasAttribute("formAction")){if(i=s,h=s[_e]||null)g=h.formAction;else if(iu(i)!==null)continue}else g=h.action;typeof g=="function"?n[l+1]=g:(n.splice(l,3),l-=3),bm(n)}}}function ym(){function e(s){s.canIntercept&&s.info==="react-transition"&&s.intercept({handler:function(){return new Promise(function(h){return i=h})},focusReset:"manual",scroll:"manual"})}function t(){i!==null&&(i(),i=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,i=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),i!==null&&(i(),i=null)}}}function su(e){this._internalRoot=e}Xs.prototype.render=su.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(c(409));var n=t.current,l=_n();cm(n,l,e,t,null,null)},Xs.prototype.unmount=su.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;cm(e.current,2,null,e,null,null),Ns(),t[Tt]=null}};function Xs(e){this._internalRoot=e}Xs.prototype.unstable_scheduleHydration=function(e){if(e){var t=ie();e={blockedOn:null,target:e,priority:t};for(var n=0;n<ca.length&&t!==0&&t<ca[n].priority;n++);ca.splice(n,0,e),n===0&&pm(e)}};var vm=a.version;if(vm!=="19.2.8")throw Error(c(527,vm,"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 ty={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:j,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Fs=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Fs.isDisabled&&Fs.supportsFiber)try{tn=Fs.inject(ty),lt=Fs}catch{}}return Sr.createRoot=function(e,t){if(!d(e))throw Error(c(299));var n=!1,l="",i=Ef,s=Rf,h=Af;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(i=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(h=t.onRecoverableError)),t=sm(e,1,!1,null,null,n,l,null,i,s,h,ym),e[Tt]=t.current,Gc(e),new su(t)},Sr.hydrateRoot=function(e,t,n){if(!d(e))throw Error(c(299));var l=!1,i="",s=Ef,h=Rf,g=Af,x=null;return n!=null&&(n.unstable_strictMode===!0&&(l=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onUncaughtError!==void 0&&(s=n.onUncaughtError),n.onCaughtError!==void 0&&(h=n.onCaughtError),n.onRecoverableError!==void 0&&(g=n.onRecoverableError),n.formState!==void 0&&(x=n.formState)),t=sm(e,1,!0,t,n??null,l,i,x,s,h,g,ym),t.context=om(null),n=t.current,l=_n(),l=L(l),i=Ql(l),i.callback=null,Il(n,i,l),n=l,t.current.lanes=n,ll(t,n),cl(t),e[Tt]=t.current,Gc(e),new Xs(t)},Sr.version="19.2.8",Sr}var Nm;function my(){if(Nm)return cu.exports;Nm=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(a){console.error(a)}}return o(),cu.exports=hy(),cu.exports}var py=my();const gy=up(py),Ne={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~"},by=new TextEncoder;function Mu(o){return by.encode(o)}function yy(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 vy(o){return`\x1B${o}`}function xy(o,a){let r=o;return a.shift&&o.length===1&&!a.ctrl&&(r=o.toUpperCase()),a.ctrl&&(r=yy(r)),a.alt&&(r=vy(r)),r}const fp=27,hp=91,Sy=60,Em=59,mp=77,pp=48,wy=57,Cy=64,Ty=-30,fu=32,Rm=255;function gp(o){return Number.isInteger(o)&&(o&Ty)===Cy}function Ny(o){return o>=pp&&o<=wy}function hu(o,a){let r=a,c=0;for(;r<o.length&&Ny(o[r]);){if(c=c*10+(o[r]-pp),c>65535)return null;r+=1}return r===a?null:{value:c,next:r}}function Ey(o,a){if(o[a]!==fp||o[a+1]!==hp||o[a+2]!==Sy)return-1;const r=hu(o,a+3);if(!r||!gp(r.value)||o[r.next]!==Em)return-1;const c=hu(o,r.next+1);if(!c||o[c.next]!==Em)return-1;const d=hu(o,c.next+1);return!d||o[d.next]!==mp?-1:d.next+1}function Ry(o,a){if(o[a]!==fp||o[a+1]!==hp||o[a+2]!==mp||a+6>o.length)return-1;const r=o[a+3]-fu,c=o[a+4],d=o[a+5];return!gp(r)||c<fu||c>Rm||d<fu||d>Rm?-1:a+6}function Dr(o){if(!o)return!1;const a=o instanceof Uint8Array?o:new Uint8Array(o);if(a.length===0)return!1;let r=0;for(;r<a.length;){const c=Ey(a,r);if(c>r){r=c;continue}const d=Ry(a,r);if(d>r){r=d;continue}return!1}return!0}class Ay{constructor(a){Se(this,"ws",null);Se(this,"config");Se(this,"state","disconnected");Se(this,"currentRole","viewer");Se(this,"controllerId");Se(this,"hostId");Se(this,"assignedClientId");Se(this,"reconnectAttempts",0);Se(this,"reconnectTimer",null);Se(this,"pingTimer",null);Se(this,"pingTimestamp",null);Se(this,"isManuallyClosed",!1);Se(this,"authFailureDetail",null);Se(this,"authFailureCode",null);Se(this,"temporaryFailureCode",null);Se(this,"pendingInputSegments",[]);Se(this,"isFlushScheduled",!1);Se(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});Se(this,"terminalCols",80);Se(this,"terminalRows",24);this.config={...a}}updateConfig(a){this.config={...this.config,...a}}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(a,r){return this.listeners[a].add(r),()=>{this.listeners[a].delete(r)}}emit(a,...r){this.listeners[a].forEach(d=>{try{d(...r)}catch(f){console.error(`Error in event listener for ${a}:`,f)}})}setState(a,r,c){this.state!==a&&(this.state=a,this.emit("stateChange",a,r,c))}connect(a){if(a&&(this.terminalCols=a.cols,this.terminalRows=a.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(a){return this.ws!==a}teardownSocket(a=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(a,r)}catch{}}}disconnect(){this.isManuallyClosed=!0,this.clearTimers(),this.pendingInputSegments=[],this.isFlushScheduled=!1,this.teardownSocket(1e3,"User initiated disconnect"),this.setState("disconnected")}reconnectWith(a){this.updateConfig(a),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(a){if(typeof a.data=="string")try{const r=JSON.parse(a.data);this.processJsonMessage(r)}catch(r){console.warn("Received unparseable text frame from server:",r)}else if(a.data instanceof ArrayBuffer)this.emit("binaryData",new Uint8Array(a.data));else if(typeof Blob<"u"&&a.data instanceof Blob)try{const r=await a.data.arrayBuffer();this.emit("binaryData",new Uint8Array(r))}catch(r){console.error("Failed to convert Blob to ArrayBuffer:",r)}}processJsonMessage(a){switch(a.type){case"ready":{this.reconnectAttempts=0,this.setState("connected"),this.currentRole=a.role,this.controllerId=a.controllerId,this.hostId=a.hostId,this.assignedClientId=a.clientId,this.emit("ready",a),this.emit("roleChange",a.role,a.controllerId,a.hostId,a.clientId),typeof a.clientCount=="number"&&this.emit("peerCount",a.clientCount);break}case"paired":{this.emit("paired",{token:a.token,deviceId:a.deviceId,hostId:a.hostId,expiresAt:a.expiresAt});break}case"control_state":{this.currentRole=a.role,this.controllerId=a.controllerId,this.emit("controlState",a.role,a.controllerId),this.emit("roleChange",a.role,a.controllerId,this.hostId,this.assignedClientId),typeof a.clientCount=="number"&&this.emit("peerCount",a.clientCount);break}case"host_reconnecting":{this.temporaryFailureCode="host_reconnecting",this.setState("reconnecting","Herdr host is reconnecting",a.code||"host_reconnecting"),this.emit("hostReconnecting",a.code);break}case"session_restarted":{this.setState("reconnecting","Herdr session is restarting","session_restarted"),this.emit("sessionRestarted",a.cols,a.rows,a.terminalPalette,a.hostname);break}case"control_revoked":{this.currentRole="viewer",this.emit("controlRevoked",a.reason),this.emit("roleChange","viewer",this.controllerId,this.hostId,this.assignedClientId);break}case"session_ready":{this.setState("connected"),this.emit("sessionReady",a);break}case"exit":{this.emit("exit",a.code,a.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",a.message);break}case"status":{this.emit("status",a);break}case"error":{a.code==="host_offline"||a.code==="host_reconnecting"||a.code==="host_reconnect_timeout"||a.code==="rate_limited"?(this.temporaryFailureCode=String(a.code),this.setState("reconnecting",a.message,String(a.code))):(a.code==="auth_required"||a.code==="unauthorized"||a.code==="device_revoked"||a.code==="invalid_handshake"||a.code==="too_many_hosts"||a.code===401||a.code===403)&&(this.authFailureDetail=a.message,this.authFailureCode=String(a.code),this.setState("error",a.message,this.authFailureCode)),this.emit("error",{code:a.code,message:a.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",a.path);break}}}handleError(a){console.error("WebSocket error:",a),this.emit("error",{code:"WS_ERROR",message:"WebSocket connection error"})}handleClose(a){if(this.clearTimers(),this.ws=null,this.authFailureDetail){this.setState("error",this.authFailureDetail,this.authFailureCode??void 0);return}if(a.code===1008&&this.temporaryFailureCode){this.setState("reconnecting",a.reason||"The relay is temporarily unavailable",this.temporaryFailureCode),this.scheduleReconnect();return}if(a.code===1008){this.setState("error",a.reason||"The relay rejected the connection",String(a.code));return}!this.isManuallyClosed&&this.config.autoReconnect?(this.setState("reconnecting",`Connection closed (${a.code}). Retrying...`,"connection_closed"),this.scheduleReconnect()):this.setState("disconnected",`Closed: ${a.reason||a.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 a=this.config.reconnectIntervalMs||2e3,c=Math.min(3e4,Math.floor(a*Math.pow(1.5,this.reconnectAttempts-1)+Math.random()*500));this.reconnectTimer=setTimeout(()=>{this.connect()},c)}startHeartbeat(){this.pingTimer&&clearInterval(this.pingTimer);const a=this.config.pingIntervalMs||1e4;this.pingTimer=setInterval(()=>{this.ws&&this.ws.readyState===WebSocket.OPEN&&this.sendPing()},a)}clearTimers(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.pingTimer&&(clearInterval(this.pingTimer),this.pingTimer=null)}sendHello(){const a={type:"hello",protocol:1,clientId:this.config.clientId,cols:this.terminalCols,rows:this.terminalRows,capabilities:["host_handoff"]};this.config.token&&(a.token=this.config.token),this.config.pairCode&&(a.pairCode=this.config.pairCode),this.sendJson(a)}claimControl(a=!1){const r={type:"claim_control",...a?{force:!0}:{}};this.sendJson(r)}releaseControl(){const a={type:"release_control"};this.sendJson(a)}sendResize(a,r){this.terminalCols=a,this.terminalRows=r;const c={type:"resize",cols:a,rows:r};this.sendJson(c)}sendPing(){this.pingTimestamp=performance.now();const a={type:"ping"};this.sendJson(a)}sendPasteFile(a,r){this.sendJson({type:"paste_file",mime:a,dataBase64:r})}sendJson(a){this.flushInput(),this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify(a))}sendInput(a){const r=a instanceof Uint8Array?a:new Uint8Array(a);if(r.length!==0){if(this.pendingInputSegments.push(r),!Dr(r)){this.flushInput();return}this.isFlushScheduled||(this.isFlushScheduled=!0,queueMicrotask(()=>this.flushInput()))}}flushInput(){if(this.isFlushScheduled=!1,this.pendingInputSegments.length===0)return;let a=this.pendingInputSegments;if(this.pendingInputSegments=[],this.ws&&(this.ws.bufferedAmount??0)>256*1024&&(a=a.filter(c=>!Dr(c))),a.length===0)return;let r;if(a.length===1)r=a[0];else{let c=0;for(let f=0;f<a.length;f++)c+=a[f].byteLength;r=new Uint8Array(c);let d=0;for(let f=0;f<a.length;f++)r.set(a[f],d),d+=a[f].byteLength}this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(r)}sendBinary(a){this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(a)}sendText(a){const r=Mu(a);this.sendInput(r)}resolveWsUrl(a){if(/^wss?:\/\//i.test(a))return a;if(/^https?:\/\//i.test(a)){const r=new URL(a);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,f=a.startsWith("/")?a:`/${a}`;return`${c}//${d}${f}`}return"ws://127.0.0.1:8787/ws/client"}}const jy=10,My=24,ao=15,_u=13,ku=640;function _y(){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 Ri()<ku}function Ri(){return typeof window>"u"?1024:window.visualViewport&&typeof window.visualViewport.width=="number"&&window.visualViewport.width>0?window.visualViewport.width:window.innerWidth||1024}function mu(){return typeof window>"u"?768:window.visualViewport&&typeof window.visualViewport.height=="number"&&window.visualViewport.height>0?window.visualViewport.height:window.innerHeight||768}function eo(o,a=ao){const r=typeof o=="number"?o:Number(o);return!Number.isFinite(r)||r<=0?a:Math.min(My,Math.max(jy,Math.round(r)))}function Am(o,a=Ri()){if(a<ku){const c=eo(o,_u);return Math.min(15,Math.max(12,c))}return eo(o,ao)}const bp=[{id:"esc",label:"ESC",code:Ne.ESC,type:"key",enabled:!0,title:"Escape"},{id:"tab",label:"TAB",code:Ne.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:Ne.LEFT,type:"key",enabled:!0,title:"Arrow Left"},{id:"up",label:"↑",code:Ne.UP,type:"key",enabled:!0,title:"Arrow Up"},{id:"down",label:"↓",code:Ne.DOWN,type:"key",enabled:!0,title:"Arrow Down"},{id:"right",label:"→",code:Ne.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:Ne.ENTER,type:"key",enabled:!0,title:"Enter / Return"}],ky=[{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:Ne.ESC,type:"key",enabled:!0,title:"Escape"},{id:"tab",label:"TAB",code:Ne.TAB,type:"key",enabled:!0,title:"Tab"},{id:"enter",label:"Enter",code:Ne.ENTER,type:"key",enabled:!0,title:"Enter / Return"},{id:"backspace",label:"⌫",code:Ne.BACKSPACE,type:"key",enabled:!0,title:"Backspace"},{id:"delete",label:"Del",code:Ne.DELETE,type:"key",enabled:!0,title:"Delete"},{id:"left",label:"←",code:Ne.LEFT,type:"key",enabled:!0,title:"Arrow Left"},{id:"up",label:"↑",code:Ne.UP,type:"key",enabled:!0,title:"Arrow Up"},{id:"down",label:"↓",code:Ne.DOWN,type:"key",enabled:!0,title:"Arrow Down"},{id:"right",label:"→",code:Ne.RIGHT,type:"key",enabled:!0,title:"Arrow Right"},{id:"home",label:"Home",code:Ne.HOME,type:"key",enabled:!0,title:"Home"},{id:"end",label:"End",code:Ne.END,type:"key",enabled:!0,title:"End"},{id:"page_up",label:"PgUp",code:Ne.PAGE_UP,type:"key",enabled:!0,title:"Page Up"},{id:"page_down",label:"PgDn",code:Ne.PAGE_DOWN,type:"key",enabled:!0,title:"Page Down"},{id:"insert",label:"Ins",code:Ne.INSERT,type:"key",enabled:!0,title:"Insert"},{id:"ctrl_c",label:"^C",code:Ne.CTRL_C,type:"chord",enabled:!0,title:"Ctrl+C (SIGINT)"},{id:"ctrl_d",label:"^D",code:Ne.CTRL_D,type:"chord",enabled:!0,title:"Ctrl+D (EOF/Exit)"},{id:"ctrl_z",label:"^Z",code:Ne.CTRL_Z,type:"chord",enabled:!0,title:"Ctrl+Z (SIGTSTP)"},{id:"ctrl_l",label:"^L",code:Ne.CTRL_L,type:"chord",enabled:!0,title:"Ctrl+L (Clear Screen)"},{id:"ctrl_a",label:"^A",code:Ne.CTRL_A,type:"chord",enabled:!0,title:"Ctrl+A (Beginning of Line)"},{id:"ctrl_e",label:"^E",code:Ne.CTRL_E,type:"chord",enabled:!0,title:"Ctrl+E (End of Line)"},{id:"ctrl_k",label:"^K",code:Ne.CTRL_K,type:"chord",enabled:!0,title:"Ctrl+K (Kill to End)"},{id:"ctrl_r",label:"^R",code:Ne.CTRL_R,type:"chord",enabled:!0,title:"Ctrl+R (Reverse Search)"},{id:"f1",label:"F1",code:Ne.F1,type:"fn",enabled:!0,title:"F1"},{id:"f2",label:"F2",code:Ne.F2,type:"fn",enabled:!0,title:"F2"},{id:"f3",label:"F3",code:Ne.F3,type:"fn",enabled:!0,title:"F3"},{id:"f4",label:"F4",code:Ne.F4,type:"fn",enabled:!0,title:"F4"},{id:"f5",label:"F5",code:Ne.F5,type:"fn",enabled:!0,title:"F5"},{id:"f6",label:"F6",code:Ne.F6,type:"fn",enabled:!0,title:"F6"},{id:"f7",label:"F7",code:Ne.F7,type:"fn",enabled:!0,title:"F7"},{id:"f8",label:"F8",code:Ne.F8,type:"fn",enabled:!0,title:"F8"},{id:"f9",label:"F9",code:Ne.F9,type:"fn",enabled:!0,title:"F9"},{id:"f10",label:"F10",code:Ne.F10,type:"fn",enabled:!0,title:"F10"},{id:"f11",label:"F11",code:Ne.F11,type:"fn",enabled:!0,title:"F11"},{id:"f12",label:"F12",code:Ne.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 Or(){return JSON.parse(JSON.stringify(bp))}const jm=["esc","tab","ctrl","alt","left","up","down","right","enter","drawer_chords","drawer_symbols","drawer_fn"];function zy(o){return o.length!==jm.length?!1:o.every((a,r)=>a.id===jm[r]&&a.enabled!==!1)}function Dy(o){if(!Array.isArray(o)||o.length===0)return Or();const a=o.filter(r=>typeof r=="object"&&r!==null&&typeof r.id=="string"&&typeof r.label=="string"&&typeof r.code=="string");return zy(a)?Or():a}function wu(o,a){if(a){const r=`keyTitles.${o.id}`,c=a(r);if(c&&c!==r)return c}return o.title||o.label}const Cu='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", "Symbols Nerd Font Mono", monospace',Oy='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',Mm="JetBrains Mono, Menlo, Monaco, Consolas, monospace",Ai="herdr_remote_settings_v1",kr="herdr_remote_session_view_v1",yp=64,Lr=4096,Tu={local:{},session:{}};function to(o,a){if(typeof window>"u")return Tu[o][a]||null;try{return(o==="local"?window.localStorage:window.sessionStorage).getItem(a)}catch{return Tu[o][a]||null}}function Oa(o,a,r){if(Tu[o][a]=r,!(typeof window>"u"))try{(o==="local"?window.localStorage:window.sessionStorage).setItem(a,r)}catch(c){console.warn(`Failed to write to ${o}Storage:`,c)}}function Ly(){return`client-${Math.random().toString(36).substring(2,8)}`}function zu(){const o=Math.random().toString(36).substring(2,10);return`profile-${Date.now().toString(36)}-${o}`}function Uy(o,a){return(typeof o=="string"?o.trim().slice(0,yp):"")||a}function no(o,a){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,Lr):"",f=typeof r.pairCode=="string"?r.pairCode.trim().toUpperCase().slice(0,32):"";if(!c||!c.startsWith("/")&&!/^(?:wss?|https?):\/\//i.test(c)||!d&&!f)return null;const p=Date.now(),m=typeof r.id=="string"&&r.id.length>0?r.id.slice(0,128):zu(),b=typeof r.hostname=="string"&&r.hostname.trim()?r.hostname.trim().slice(0,yp):`Herdr ${a+1}`;return{id:m,displayName:Uy(r.displayName,b),wsUrl:c,token:d,...f?{pairCode:f}:{},...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):p,lastUsedAt:Number.isFinite(r.lastUsedAt)?Number(r.lastUsedAt):p}}function _m(o,a=0){const r=no({...o,id:o.id||zu()},a);if(!r)throw new Error("a connection profile requires a relay URL and token or pairing code");return r}function km(o){let a=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="",a=r.toString().replace(/\/$/,"").toLowerCase()}catch{}return`${a}::${o.hostId||""}`}function vp(){return typeof navigator<"u"&&navigator.language&&navigator.language.toLowerCase().startsWith("zh")?"zh":"en"}function xp(){const o=typeof window<"u"&&window.innerWidth<640;return{wsUrl:"/ws/client",token:"",pairCode:"",clientId:Ly(),autoReconnect:!0,profiles:[],activeProfileId:"",fontSize:o?_u:ao,fontFamily:Cu,toolbarVisible:!0,toolbarPosition:"bottom",vibrateOnKeyPress:!0,predictiveEcho:"auto",language:vp(),virtualKeys:Or(),adminToken:"",adminTokens:{}}}const By=["wsUrl","token","pairCode","clientId","autoReconnect","language"],Hy=["wsUrl","token","pairCode","autoReconnect"],Du=["fontSize","fontFamily","toolbarVisible","toolbarPosition","vibrateOnKeyPress","predictiveEcho","virtualKeys","adminToken","adminTokens"],Yy=Du.filter(o=>o!=="adminToken"&&o!=="adminTokens"),zm=["theme","colorMode"];function Nu(o){const a=o;if(!zm.some(d=>a[d]!==void 0))return{data:o,changed:!1};const c={...a};for(const d of zm)delete c[d];return{data:c,changed:!0}}function Sp(o){if(!o||typeof o!="object"||Array.isArray(o))return{};const a={};for(const[r,c]of Object.entries(o).slice(0,32))typeof c!="string"||c.length===0||(a[r.slice(0,512)]=c.slice(0,Lr));return a}function wp(o){var f;const a=[];if((Array.isArray(o.profiles)?o.profiles.slice(0,64):[]).forEach((p,m)=>{const b=no(p,m);b&&!a.some(S=>S.id===b.id)&&a.push(b)}),a.length===0&&(typeof o.token=="string"&&o.token||typeof o.pairCode=="string"&&o.pairCode)){const p=no({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);p&&a.push(p)}const c=typeof o.activeProfileId=="string"?o.activeProfileId:"",d=a.some(p=>p.id===c)?c:((f=a[0])==null?void 0:f.id)||"";return{profiles:a,activeProfileId:d}}function Cp(){const o=xp();if(typeof window>"u")return o;let a={};const r=to("local",Ai);if(r)try{a=JSON.parse(r)}catch(ne){console.warn("Failed to parse localStorage settings:",ne)}const c=Nu(a);c.changed&&(a=c.data,Oa("local",Ai,JSON.stringify(a)));let d=null;const f=to("session",kr);if(f)try{d=JSON.parse(f)}catch(ne){console.warn("Failed to parse sessionStorage settings:",ne)}if(!d){const ne={};for(const je of Du)a[je]!==void 0&&(ne[je]=a[je]);d=ne,Oa("session",kr,JSON.stringify(d))}let p=d.fontFamily??a.fontFamily??o.fontFamily;(!p||p===Mm||p===Oy)&&(p=Cu);const m=window.innerWidth<640?_u:ao,b=d.fontSize??a.fontSize??o.fontSize,S=eo(b,m),v=d.virtualKeys??a.virtualKeys??o.virtualKeys,C=Dy(v),D=a.language??o.language,z=D==="zh"||D==="en"?D:vp(),_=wp(a),F=_.profiles.find(ne=>ne.id===_.activeProfileId),k=Nu(d);k.changed&&(d=k.data,Oa("session",kr,JSON.stringify(d)));const I=d.toolbarVisible??a.toolbarVisible??o.toolbarVisible,ee=d.toolbarPosition??a.toolbarPosition??o.toolbarPosition,J=d.vibrateOnKeyPress??a.vibrateOnKeyPress??o.vibrateOnKeyPress,ae=(d==null?void 0:d.predictiveEcho)??(a==null?void 0:a.predictiveEcho)??o.predictiveEcho,ye=ae==="always"||ae==="off"||ae==="auto"?ae:"auto",O=typeof d.adminToken=="string"?d.adminToken.slice(0,Lr):typeof a.adminToken=="string"?a.adminToken.slice(0,Lr):o.adminToken,U=Sp(d.adminTokens),R={...o,...a,...d,wsUrl:(F==null?void 0:F.wsUrl)||(typeof a.wsUrl=="string"?a.wsUrl:o.wsUrl),token:(F==null?void 0:F.token)||"",pairCode:(F==null?void 0:F.pairCode)||"",autoReconnect:(F==null?void 0:F.autoReconnect)??o.autoReconnect,profiles:_.profiles,activeProfileId:_.activeProfileId,clientId:typeof a.clientId=="string"&&a.clientId.trim()?a.clientId.trim().slice(0,128):o.clientId,fontFamily:p,fontSize:S,toolbarVisible:I,toolbarPosition:ee,vibrateOnKeyPress:J,predictiveEcho:ye,virtualKeys:C,language:z,adminToken:O,adminTokens:U};return a.fontFamily===Mm&&(a.fontFamily=Cu,Oa("local",Ai,JSON.stringify(a))),R}function da(o){var D;const r={...Cp(),...o};r.adminTokens=Sp(r.adminTokens),typeof r.adminToken=="string"&&(r.adminToken=r.adminToken.slice(0,Lr)),o.fontSize!==void 0&&(r.fontSize=eo(o.fontSize)),o.predictiveEcho!==void 0&&(o.predictiveEcho==="auto"||o.predictiveEcho==="always"||o.predictiveEcho==="off"?r.predictiveEcho=o.predictiveEcho:r.predictiveEcho="auto");const c=wp(r);let d=c.profiles,f=c.activeProfileId;if(Hy.some(z=>o[z]!==void 0)){const z=d.findIndex(k=>k.id===f),_=z>=0?{...d[z]}:{id:zu(),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 F=no(_,Math.max(z,0));F?z>=0?d[z]=F:(d.push(F),f=F.id):z>=0&&(d=d.filter(k=>k.id!==f),f=((D=d[0])==null?void 0:D.id)||"")}d.length>0&&!d.some(z=>z.id===f)&&(f=d[0].id);const m=d.find(z=>z.id===f);r.profiles=d,r.activeProfileId=f,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=to("local",Ai);let S={};if(b)try{S=JSON.parse(b)}catch{}S=Nu(S).data;for(const z of By)r[z]!==void 0&&(S[z]=r[z]);S.profiles=d,S.activeProfileId=f,Oa("local",Ai,JSON.stringify(S));const v=to("session",kr);let C={};if(v)try{C=JSON.parse(v)}catch{}for(const z of Du)r[z]!==void 0&&(C[z]=r[z]);Oa("session",kr,JSON.stringify(C));for(const z of Yy)r[z]!==void 0&&(S[z]=r[z]);return Oa("local",Ai,JSON.stringify(S)),r}const Ky={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"}},Gy={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:"移除图片"}},pu={en:Ky,zh:Gy};function Ou(o,a,r){const c=pu[o]||pu.en,d=a.split(".");let f=c;for(const p of d)if(f&&typeof f=="object"&&p in f)f=f[p];else{let m=pu.en;for(const b of d)if(m&&typeof m=="object"&&b in m)m=m[b];else return a;f=m;break}if(typeof f!="string")return a;if(r){let p=f;for(const[m,b]of Object.entries(r))p=p.replaceAll(`{${m}}`,String(b));return p}return f}const Dm="#11111b",Eu=[{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 Om(o){if(!o||typeof o!="string")return Eu[0].font;const a=o.trim();if(a.includes("Symbols Nerd Font"))return a;if(/^['"]?monospace['"]?$/i.test(a))return'"Symbols Nerd Font Mono", monospace';const r=/,\s*['"]?monospace['"]?\s*$/i;return r.test(a)?a.replace(r,', "Symbols Nerd Font Mono", monospace'):`${a}, "Symbols Nerd Font Mono", monospace`}function qy(o){if(!o)return null;const a={};return o.background&&(a.background=o.background,a.cursorAccent=o.background),o.foreground&&(a.foreground=o.foreground),o.cursor&&(a.cursor=o.cursor),o.ansi&&Object.assign(a,o.ansi),Object.keys(a).length===0?null:a}function Lm(o){if(typeof o!="string")return null;const a=o.trim();return/^#[0-9a-f]{3}$/i.test(a)?[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)]:/^#[0-9a-f]{6}$/i.test(a)?[parseInt(a.slice(1,3),16),parseInt(a.slice(3,5),16),parseInt(a.slice(5,7),16)]:null}function Vy(o,a,r){const c=Lm(o),d=Lm(a);if(!c||!d)return;const f=Math.min(1,Math.max(0,r)),p=m=>{const b=Math.round(c[m]+(d[m]-c[m])*f);return Math.min(255,Math.max(0,b)).toString(16).padStart(2,"0")};return`#${p(0)}${p(1)}${p(2)}`}function Tp(){if(typeof document>"u")return;const o=document.querySelector('meta[name="theme-color"]');document.documentElement.style.colorScheme="dark",o==null||o.setAttribute("content",Dm),document.documentElement.classList.add("dark"),document.documentElement.classList.remove("light"),document.body.classList.add("dark"),document.body.classList.remove("light"),document.body.style.backgroundColor=Dm}const Np=1568,Xy=3*1024*1024,Fy=[.85,.7,.55,.4],tl={active:!1,phase:"idle",ratio:0,percent:0,statusText:""};function Zy(o,a,r=Np){if(o<=0||a<=0)return{width:Math.max(1,o),height:Math.max(1,a)};const c=Math.max(o,a);if(c<=r)return{width:o,height:a};const d=r/c;return{width:Math.max(1,Math.round(o*d)),height:Math.max(1,Math.round(a*d))}}function Qy(o){if(typeof o!="string"||o.length===0)return 0;const a=o.length;let r=0;o.endsWith("==")?r=2:o.endsWith("=")&&(r=1);const c=Math.floor(a*3/4)-r;return Number.isFinite(c)&&c>0?c:0}function Iy(o){return o<1024?`${o} B`:o<1024*1024?`${(o/1024).toFixed(1)} KB`:`${(o/(1024*1024)).toFixed(1)} MB`}async function Jy(o){if(typeof createImageBitmap=="function")try{const a=await createImageBitmap(o,{imageOrientation:"from-image"});return{source:a,width:a.width,height:a.height,cleanup:()=>{typeof a.close=="function"&&a.close()}}}catch{try{const a=await createImageBitmap(o);return{source:a,width:a.width,height:a.height,cleanup:()=>{typeof a.close=="function"&&a.close()}}}catch{}}return new Promise((a,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=()=>{a({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 Ep(o,a=Np,r=Xy){var d;if(!o||o.size===0||o.type&&!o.type.startsWith("image/"))return null;let c;try{c=await Jy(o)}catch(f){return console.warn("Failed to decode image for paste:",f),null}try{const{width:f,height:p}=Zy(c.width,c.height,a),m=document.createElement("canvas");m.width=f,m.height=p;const b=m.getContext("2d");if(!b)return null;b.drawImage(c.source,0,0,f,p);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 Fy){let C;try{C=m.toDataURL(S,v)}catch{continue}if(!C||!C.startsWith("data:"))continue;const D=C.indexOf(","),z=D!==-1?C.slice(D+1):"",_=Qy(z);if(_<=r)return{mime:S,dataBase64:z,dataUrl:C,byteLength:_,width:f,height:p}}return null}finally{(d=c.cleanup)==null||d.call(c)}}const Wy=4e3,Py=3,$y=4096,ev=8*1024*1024,Rp=y.createContext(null);function Ni(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 tv=({children:o})=>{const[a,r]=y.useState(Cp),[c,d]=y.useState("disconnected"),[f,p]=y.useState(),[m,b]=y.useState(),[S,v]=y.useState("viewer"),[C,D]=y.useState(),[z,_]=y.useState(),[F,k]=y.useState(),[I,ee]=y.useState(null),[J,ae]=y.useState(),[ye,O]=y.useState(null),[U,R]=y.useState(1),[ne,je]=y.useState(0),[Me,Ee]=y.useState(null),[fe,ke]=y.useState(null),[Oe,j]=y.useState({cols:80,rows:24}),[q,W]=y.useState([]);y.useEffect(()=>{Tp()},[]);const Ce=y.useRef(a);Ce.current=a;const H=y.useRef(null),qe=y.useRef(!1),Z=y.useRef(Oe);Z.current=Oe;const pe=y.useRef(new Set),[ze,ve]=y.useState(tl),me=y.useRef(null),St=y.useRef(0),Le=y.useRef(null),we=y.useCallback((L,Y)=>Ou(a.language,L,Y),[a.language]),ut=y.useRef(we);ut.current=we;const nt=y.useRef(null),ht=y.useRef([]),Ht=y.useRef(0),gt=y.useCallback(L=>{for(ht.current.push(L),Ht.current+=L.byteLength;ht.current.length>$y||Ht.current>ev;){const Y=ht.current.shift();if(!Y)break;Ht.current-=Y.byteLength}},[]),zn=y.useCallback(L=>{const Y=nt.current;if(Y)try{Y(L);return}catch(ie){console.debug("Terminal output sink threw, buffering chunk instead:",ie)}gt(L)},[gt]),Dn=y.useRef(zn);Dn.current=zn;const _t=y.useCallback(L=>{nt.current=L;const Y=ht.current;ht.current=[],Ht.current=0;for(let ie=0;ie<Y.length;ie++)try{L(Y[ie])}catch(Ae){console.debug("Terminal sink threw while flushing, re-buffering the tail:",Ae);for(let xe=ie;xe<Y.length;xe++)gt(Y[xe]);break}return()=>{nt.current===L&&(nt.current=null)}},[gt]),sn=y.useRef(null),On=y.useCallback(L=>(sn.current=L,()=>{sn.current===L&&(sn.current=null)}),[]),kt=y.useCallback(()=>ht.current.length,[]),Fe=y.useCallback(()=>{ht.current=[],Ht.current=0},[]),Vt=y.useCallback((L=!0)=>{v("viewer"),D(void 0),_(void 0),k(void 0),ee(null),ae(void 0),O(null),R(1),Ee(null),Fe(),L&&je(Y=>Y+1)},[Fe]),Yt=y.useRef([]),$=y.useRef(new Map),Re=y.useCallback(L=>{Yt.current=L,W(L)},[]),Ke=y.useCallback(L=>{const Y=$.current.get(L);Y&&(clearTimeout(Y),$.current.delete(L)),Re(Yt.current.filter(ie=>ie.id!==L))},[Re]),We=y.useRef(Ke);We.current=Ke;const et=y.useCallback((L,Y)=>{const ie=Date.now(),Ae=Yt.current,xe=Ae.find(bt=>bt.type===L&&bt.message===Y),he=xe?xe.id:`${ie}-${Math.random().toString(36).substring(2,6)}`;let _e;if(xe)_e=Ae.map(bt=>bt.id===he?{...bt,count:bt.count+1,timestamp:ie}:bt);else for(_e=[...Ae,{id:he,type:L,message:Y,timestamp:ie,count:1}];_e.length>Py;){const[bt,...Un]=_e,al=$.current.get(bt.id);al&&(clearTimeout(al),$.current.delete(bt.id)),_e=Un}Re(_e);const Tt=$.current.get(he);Tt&&clearTimeout(Tt),$.current.set(he,setTimeout(()=>We.current(he),Wy))},[Re]),hn=y.useCallback(L=>{We.current(L)},[]),mt=y.useRef(!0);y.useEffect(()=>{S==="controller"&&(mt.current=!0)},[S]);const At=y.useCallback(()=>{mt.current&&(mt.current=!1,et("warning",ut.current("toasts.viewerModeWarning")))},[et]);y.useEffect(()=>{const L=$.current;return()=>{for(const Y of L.values())clearTimeout(Y);L.clear()}},[]);const Qt=y.useCallback(L=>{const Y=da(L);Ce.current=Y,r(Y)},[]),tn=y.useCallback(L=>{Qt({language:L})},[Qt]),lt=y.useCallback(L=>{Ce.current=L,r(L)},[]),zt=y.useCallback(L=>{var xe;const Y=Ce.current,ie=_m({...L,wsUrl:L.wsUrl||"/ws/client",token:L.token||"",displayName:L.displayName||`Herdr ${Y.profiles.length+1}`,autoReconnect:L.autoReconnect!==!1},Y.profiles.length),Ae=da({profiles:[...Y.profiles,ie],activeProfileId:ie.id,wsUrl:ie.wsUrl,token:ie.token,pairCode:ie.pairCode||"",autoReconnect:ie.autoReconnect});lt(Ae),Vt(),(xe=H.current)==null||xe.reconnectWith(Ni(Ae))},[lt,Vt]),wt=y.useCallback(L=>{var xe;const Y=Ce.current,ie=Y.profiles.find(he=>he.id===L);if(!ie||ie.id===Y.activeProfileId)return;const Ae=da({activeProfileId:ie.id,wsUrl:ie.wsUrl,token:ie.token,pairCode:ie.pairCode||"",autoReconnect:ie.autoReconnect,profiles:Y.profiles.map(he=>he.id===ie.id?{...he,lastUsedAt:Date.now()}:he)});lt(Ae),Vt(),(xe=H.current)==null||xe.reconnectWith(Ni(Ae))},[lt,Vt]),Ha=y.useCallback((L,Y)=>{const ie=Ce.current;if(!ie.profiles.find(_e=>_e.id===L))return;const xe=Y.trim().slice(0,64);if(!xe)return;const he=da({profiles:ie.profiles.map(_e=>_e.id===L?{..._e,displayName:xe}:_e)});lt(he)},[lt]),mn=y.useCallback(L=>{var he;const Y=Ce.current;if(!Y.profiles.some(_e=>_e.id===L))return;const ie=Y.profiles.filter(_e=>_e.id!==L),Ae=ie.find(_e=>_e.id===Y.activeProfileId)||ie[0],xe=da(Ae?{profiles:ie,activeProfileId:Ae.id,wsUrl:Ae.wsUrl,token:Ae.token,pairCode:Ae.pairCode||"",autoReconnect:Ae.autoReconnect}:{profiles:[],activeProfileId:"",wsUrl:"/ws/client",token:"",pairCode:""});lt(xe),L===Y.activeProfileId&&(Vt(),(he=H.current)==null||he.reconnectWith(Ni(xe)))},[lt,Vt]),Ya=y.useCallback(L=>{const Y=Ce.current,ie=Y.profiles.find(gn=>gn.id===Y.activeProfileId),Ae=L.hostId?km({wsUrl:Y.wsUrl,hostId:L.hostId}):null,xe=Ae?Y.profiles.findIndex(gn=>km(gn)===Ae):-1,he=xe>=0?xe:Math.max(0,Y.profiles.findIndex(gn=>gn.id===Y.activeProfileId)),Tt={...Y.profiles[he]||ie||_m({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 bt=[...Y.profiles];he>=0&&he<bt.length?bt[he]=Tt:bt.push(Tt);const Un=ie==null?void 0:ie.id;bt=bt.filter((gn,il)=>il===he||gn.id===Tt.id?!0:!(xe>=0&&Un&&gn.id===Un));const al=da({profiles:bt,activeProfileId:Tt.id,wsUrl:Tt.wsUrl,token:Tt.token,pairCode:"",autoReconnect:Tt.autoReconnect});return lt(al),al},[lt]),Ln=y.useCallback(L=>{const Y=Ce.current,ie=Y.profiles.find(_e=>_e.id===Y.activeProfileId);if(!ie||!L.hostId&&!L.hostname)return;const Ae=/^Herdr \d+$/.test(ie.displayName),xe={...ie,...L.hostId?{hostId:L.hostId}:{},...L.hostname?{hostname:L.hostname}:{},...L.hostname&&Ae?{displayName:L.hostname}:{}},he=da({profiles:Y.profiles.map(_e=>_e.id===ie.id?xe:_e)});lt(he)},[lt]);if(!H.current){const L=new Ay(Ni(a));H.current=L,L.on("stateChange",(Y,ie,Ae)=>{d(Y),b(Ae);const xe=Ae?`serverErrors.${Ae}`:null,he=xe?ut.current(xe):null,_e=he&&he!==xe?he:ie;p(_e),Y==="connected"?et("success",ut.current("toasts.connected")):Y==="error"&&et("error",_e||ut.current("toasts.connectionError"))}),L.on("ready",Y=>{qe.current&&(Fe(),je(ie=>ie+1)),qe.current=!0,v(Y.role),D(Y.controllerId),_(Y.hostId),k(Y.hostname),Ln(Y),Y.clientId&&ae(Y.clientId),ee(Y.terminalPalette||null)}),L.on("hostReconnecting",Y=>{b(Y||"host_reconnecting"),p(ut.current(`serverErrors.${Y||"host_reconnecting"}`)),v("viewer"),D(void 0),k(void 0),ee(null),O(null),R(1),Ee(null),Fe()}),L.on("sessionRestarted",(Y,ie,Ae,xe)=>{Fe(),k(xe),Ln({hostId:L.getHostId(),hostname:xe}),ee(Ae||null),je(he=>he+1)}),L.on("roleChange",(Y,ie,Ae,xe)=>{v(Y),D(ie),Ae&&_(Ae),xe&&ae(xe)}),L.on("controlGranted",()=>{v("controller"),et("success",ut.current("toasts.controlGranted"))}),L.on("controlDenied",Y=>{et("warning",Y||ut.current("toasts.controlDenied"))}),L.on("controlRevoked",Y=>{v("viewer"),et("warning",Y||ut.current("toasts.controlRevoked"))}),L.on("paired",Y=>{const ie=Ya(Y);et("success",ut.current("toasts.pairedSuccess")),ke(Date.now()),L.reconnectWith(Ni(ie))}),L.on("exit",(Y,ie)=>{et("info",`${ut.current("toasts.sessionEnded")}${ie?`: ${ie}`:""}${Y!==void 0?` (${Y})`:""}`)}),L.on("status",Y=>{Ee(Y)}),L.on("error",Y=>{me.current!==null&&(Le.current&&(clearTimeout(Le.current),Le.current=null),me.current=null,ve(tl));const Ae=`serverErrors.${String(Y.code)}`,xe=ut.current(Ae),he=xe&&xe!==Ae?xe:Y.message||`[${Y.code}]`;et("error",he)}),L.on("pasteFileReady",Y=>{const ie=me.current;ie!==null&&(Le.current&&(clearTimeout(Le.current),Le.current=null),ve({active:!0,phase:"completed",ratio:1,percent:100,statusText:ut.current("virtualKeyboard.uploadProgressCompleted")}),setTimeout(()=>{me.current===ie&&(me.current=null,ve(tl))},1200));for(const Ae of pe.current)try{Ae(Y)}catch(xe){console.error("Error in pasteFileReady listener:",xe)}}),L.on("rttUpdate",Y=>{O(Y)}),L.on("peerCount",Y=>{R(Math.max(1,Y))}),L.on("sessionReady",()=>{d("connected")}),L.on("binaryData",Y=>{Dn.current(Y)})}const fl=H.current,hl=a.profiles.find(L=>L.id===a.activeProfileId);y.useEffect(()=>{var L;(L=H.current)==null||L.updateConfig(Ni(a))},[a]);const It=y.useCallback(L=>{H.current&&(L&&H.current.updateConfig(L),H.current.connect(Z.current))},[]),on=y.useCallback(()=>{H.current&&H.current.disconnect()},[]),pn=y.useCallback((L=!1)=>{H.current&&H.current.claimControl(L)},[]),ml=y.useCallback(()=>{var L;(L=H.current)==null||L.releaseControl()},[]),Ka=y.useCallback(L=>{var ie;if(S!=="controller"){At();return}if(!H.current)return;const Y=Mu(L);H.current.sendInput(Y),(ie=sn.current)==null||ie.call(sn,Y)},[S,At]),Bl=y.useCallback(L=>{S!=="controller"&&!Dr(L)||H.current&&H.current.sendInput(L)},[S]),ll=y.useCallback((L,Y)=>{Z.current={cols:L,rows:Y},j({cols:L,rows:Y}),H.current&&H.current.sendResize(L,Y)},[]),Hl=y.useCallback((L,Y)=>S!=="controller"?(At(),!1):H.current?(H.current.sendPasteFile(L,Y),!0):!1,[S,At]),pl=y.useCallback(L=>(pe.current.add(L),()=>{pe.current.delete(L)}),[]),gl=y.useCallback(()=>{Le.current&&(clearTimeout(Le.current),Le.current=null),me.current=null,ve(tl)},[]);y.useEffect(()=>{c!=="connected"&&me.current!==null&&(Le.current&&(clearTimeout(Le.current),Le.current=null),me.current=null,ve(tl))},[c]),y.useEffect(()=>()=>{Le.current&&clearTimeout(Le.current)},[]);const Ga=y.useCallback(async L=>{if(S!=="controller")return At(),!1;if(!H.current||c!=="connected")return et("error",we("serverErrors.host_offline")),!1;if(me.current!==null)return!1;const Y=++St.current;me.current=Y,Le.current&&(clearTimeout(Le.current),Le.current=null);const ie="dataBase64"in L&&typeof L.dataBase64=="string";try{let Ae;if(ie)Ae=L;else{const he=L;if(ve({active:!0,phase:"reading",ratio:.1,percent:10,statusText:we("virtualKeyboard.uploadProgressReading")}),!he||he.size===0)return et("error",we("clipboard.fileEmpty")),me.current=null,ve(tl),!1;if(he.type&&!he.type.startsWith("image/"))return et("error",we("clipboard.unsupportedType")),me.current=null,ve(tl),!1;ve({active:!0,phase:"processing",ratio:.35,percent:35,statusText:we("virtualKeyboard.uploadProgressProcessing")});const _e=await Ep(he);if(me.current!==Y)return!1;if(!_e)return et("error",we("clipboard.imageTooLarge")),me.current=null,ve(tl),!1;Ae=_e,ve({active:!0,phase:"processing",ratio:.6,percent:60,statusText:we("virtualKeyboard.uploadProgressProcessing")})}ve({active:!0,phase:"sending",ratio:.75,percent:75,statusText:we("virtualKeyboard.uploadProgressSending")});const xe=Hl(Ae.mime,Ae.dataBase64);return me.current!==Y?!1:xe?(ve({active:!0,phase:"waitingHost",ratio:.88,percent:88,statusText:we("virtualKeyboard.uploadProgressWaitingHost")}),Le.current=setTimeout(()=>{me.current===Y&&(me.current=null,et("error",we("serverErrors.paste_file_write_failed")),ve(tl))},3e4),!0):(me.current=null,ve(tl),!1)}catch(Ae){return console.error("Failed to process/upload image:",Ae),me.current===Y&&(me.current=null,et("error",we("clipboard.imageTooLarge")),ve(tl)),!1}},[S,c,At,et,we,Hl]);return u.jsx(Rp.Provider,{value:{connectionState:c,stateDetail:f,stateCode:m,role:S,controllerId:C,hostId:z,hostname:F,assignedClientId:J,profiles:a.profiles,activeProfileId:a.activeProfileId,activeProfile:hl,isController:S==="controller",sharedWindowCount:U,terminalResetVersion:ne,rttMs:ye,statusPayload:Me,lastPairedAt:fe,settings:a,hostPalette:I,terminalDimensions:Oe,toasts:q,adapter:fl,language:a.language,t:we,setLanguage:tn,connect:It,disconnect:on,switchProfile:wt,addProfileAndConnect:zt,renameProfile:Ha,removeProfile:mn,claimControl:pn,releaseControl:ml,sendKey:Ka,sendBinary:Bl,sendResize:ll,updateSettings:Qt,addToast:et,removeToast:hn,warnViewerMode:At,subscribeToOutput:_t,registerInputObserver:On,getPendingOutputChunkCount:kt,sendPasteFile:Hl,subscribeToPasteFileReady:pl,uploadProgress:ze,uploadImage:Ga,resetUploadProgress:gl},children:o})};function Ct(){const o=y.useContext(Rp);if(!o)throw new Error("useTerminal must be used within a TerminalProvider");return o}function Ap(o){var a,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(a=0;a<d;a++)o[a]&&(r=Ap(o[a]))&&(c&&(c+=" "),c+=r)}else for(r in o)o[r]&&(c&&(c+=" "),c+=r);return c}function nv(){for(var o,a,r=0,c="",d=arguments.length;r<d;r++)(o=arguments[r])&&(a=Ap(o))&&(c&&(c+=" "),c+=a);return c}const lv=(o,a)=>{const r=new Array(o.length+a.length);for(let c=0;c<o.length;c++)r[c]=o[c];for(let c=0;c<a.length;c++)r[o.length+c]=a[c];return r},av=(o,a)=>({classGroupId:o,validator:a}),jp=(o=new Map,a=null,r)=>({nextPart:o,validators:a,classGroupId:r}),lo="-",Um=[],iv="arbitrary..",rv=o=>{const a=ov(o),{conflictingClassGroups:r,conflictingClassGroupModifiers:c}=o;return{getClassGroupId:p=>{if(p.startsWith("[")&&p.endsWith("]"))return sv(p);const m=p.split(lo),b=m[0]===""&&m.length>1?1:0;return Mp(m,b,a)},getConflictingClassGroupIds:(p,m)=>{if(m){const b=c[p],S=r[p];return b?S?lv(S,b):b:S||Um}return r[p]||Um}}},Mp=(o,a,r)=>{if(o.length-a===0)return r.classGroupId;const d=o[a],f=r.nextPart.get(d);if(f){const S=Mp(o,a+1,f);if(S)return S}const p=r.validators;if(p===null)return;const m=a===0?o.join(lo):o.slice(a).join(lo),b=p.length;for(let S=0;S<b;S++){const v=p[S];if(v.validator(m))return v.classGroupId}},sv=o=>o.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const a=o.slice(1,-1),r=a.indexOf(":"),c=a.slice(0,r);return c?iv+c:void 0})(),ov=o=>{const{theme:a,classGroups:r}=o;return cv(r,a)},cv=(o,a)=>{const r=jp();for(const c in o){const d=o[c];Lu(d,r,c,a)}return r},Lu=(o,a,r,c)=>{const d=o.length;for(let f=0;f<d;f++){const p=o[f];uv(p,a,r,c)}},uv=(o,a,r,c)=>{if(typeof o=="string"){dv(o,a,r);return}if(typeof o=="function"){fv(o,a,r,c);return}hv(o,a,r,c)},dv=(o,a,r)=>{const c=o===""?a:_p(a,o);c.classGroupId=r},fv=(o,a,r,c)=>{if(mv(o)){Lu(o(c),a,r,c);return}a.validators===null&&(a.validators=[]),a.validators.push(av(r,o))},hv=(o,a,r,c)=>{const d=Object.entries(o),f=d.length;for(let p=0;p<f;p++){const[m,b]=d[p];Lu(b,_p(a,m),r,c)}},_p=(o,a)=>{let r=o;const c=a.split(lo),d=c.length;for(let f=0;f<d;f++){const p=c[f];let m=r.nextPart.get(p);m||(m=jp(),r.nextPart.set(p,m)),r=m}return r},mv=o=>"isThemeGetter"in o&&o.isThemeGetter===!0,pv=o=>{if(o<1)return{get:()=>{},set:()=>{}};let a=0,r=Object.create(null),c=Object.create(null);const d=(f,p)=>{r[f]=p,a++,a>o&&(a=0,c=r,r=Object.create(null))};return{get(f){let p=r[f];if(p!==void 0)return p;if((p=c[f])!==void 0)return d(f,p),p},set(f,p){f in r?r[f]=p:d(f,p)}}},Ru="!",Bm=":",gv=[],Hm=(o,a,r,c,d)=>({modifiers:o,hasImportantModifier:a,baseClassName:r,maybePostfixModifierPosition:c,isExternal:d}),bv=o=>{const{prefix:a,experimentalParseClassName:r}=o;let c=d=>{const f=[];let p=0,m=0,b=0,S;const v=d.length;for(let F=0;F<v;F++){const k=d[F];if(p===0&&m===0){if(k===Bm){f.push(d.slice(b,F)),b=F+1;continue}if(k==="/"){S=F;continue}}k==="["?p++:k==="]"?p--:k==="("?m++:k===")"&&m--}const C=f.length===0?d:d.slice(b);let D=C,z=!1;C.endsWith(Ru)?(D=C.slice(0,-1),z=!0):C.startsWith(Ru)&&(D=C.slice(1),z=!0);const _=S&&S>b?S-b:void 0;return Hm(f,z,D,_)};if(a){const d=a+Bm,f=c;c=p=>p.startsWith(d)?f(p.slice(d.length)):Hm(gv,!1,p,void 0,!0)}if(r){const d=c;c=f=>r({className:f,parseClassName:d})}return c},yv=o=>{const a=new Map;return o.orderSensitiveModifiers.forEach((r,c)=>{a.set(r,1e6+c)}),r=>{const c=[];let d=[];for(let f=0;f<r.length;f++){const p=r[f],m=p[0]==="[",b=a.has(p);m||b?(d.length>0&&(d.sort(),c.push(...d),d=[]),c.push(p)):d.push(p)}return d.length>0&&(d.sort(),c.push(...d)),c}},vv=o=>({cache:pv(o.cacheSize),parseClassName:bv(o),sortModifiers:yv(o),postfixLookupClassGroupIds:xv(o),...rv(o)}),xv=o=>{const a=Object.create(null),r=o.postfixLookupClassGroups;if(r)for(let c=0;c<r.length;c++)a[r[c]]=!0;return a},Sv=/\s+/,wv=(o,a)=>{const{parseClassName:r,getClassGroupId:c,getConflictingClassGroupIds:d,sortModifiers:f,postfixLookupClassGroupIds:p}=a,m=[],b=o.trim().split(Sv);let S="";for(let v=b.length-1;v>=0;v-=1){const C=b[v],{isExternal:D,modifiers:z,hasImportantModifier:_,baseClassName:F,maybePostfixModifierPosition:k}=r(C);if(D){S=C+(S.length>0?" "+S:S);continue}let I=!!k,ee;if(I){const U=F.substring(0,k);ee=c(U);const R=ee&&p[ee]?c(F):void 0;R&&R!==ee&&(ee=R,I=!1)}else ee=c(F);if(!ee){if(!I){S=C+(S.length>0?" "+S:S);continue}if(ee=c(F),!ee){S=C+(S.length>0?" "+S:S);continue}I=!1}const J=z.length===0?"":z.length===1?z[0]:f(z).join(":"),ae=_?J+Ru:J,ye=ae+ee;if(m.indexOf(ye)>-1)continue;m.push(ye);const O=d(ee,I);for(let U=0;U<O.length;++U){const R=O[U];m.push(ae+R)}S=C+(S.length>0?" "+S:S)}return S},Cv=(...o)=>{let a=0,r,c,d="";for(;a<o.length;)(r=o[a++])&&(c=kp(r))&&(d&&(d+=" "),d+=c);return d},kp=o=>{if(typeof o=="string")return o;let a,r="";for(let c=0;c<o.length;c++)o[c]&&(a=kp(o[c]))&&(r&&(r+=" "),r+=a);return r},Tv=(o,...a)=>{let r,c,d,f;const p=b=>{const S=a.reduce((v,C)=>C(v),o());return r=vv(S),c=r.cache.get,d=r.cache.set,f=m,m(b)},m=b=>{const S=c(b);if(S)return S;const v=wv(b,r);return d(b,v),v};return f=p,(...b)=>f(Cv(...b))},Nv=[],qt=o=>{const a=r=>r[o]||Nv;return a.isThemeGetter=!0,a},zp=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Dp=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Ev=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Rv=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Av=/\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$/,jv=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Mv=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,_v=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,fa=o=>Ev.test(o),Ye=o=>!!o&&!Number.isNaN(Number(o)),ul=o=>!!o&&Number.isInteger(Number(o)),gu=o=>o.endsWith("%")&&Ye(o.slice(0,-1)),Ll=o=>Rv.test(o),Op=()=>!0,kv=o=>Av.test(o)&&!jv.test(o),Uu=()=>!1,zv=o=>Mv.test(o),Dv=o=>_v.test(o),Ov=o=>!re(o)&&!se(o),Lv=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)),Uv=o=>ma(o,Bp,Uu),re=o=>zp.test(o),Da=o=>ma(o,Hp,kv),Ym=o=>ma(o,Xv,Ye),Bv=o=>ma(o,Kp,Op),Hv=o=>ma(o,Yp,Uu),Km=o=>ma(o,Lp,Uu),Yv=o=>ma(o,Up,Dv),Zs=o=>ma(o,Gp,zv),se=o=>Dp.test(o),wr=o=>Ba(o,Hp),Kv=o=>Ba(o,Yp),Gm=o=>Ba(o,Lp),Gv=o=>Ba(o,Bp),qv=o=>Ba(o,Up),Qs=o=>Ba(o,Gp,!0),Vv=o=>Ba(o,Kp,!0),ma=(o,a,r)=>{const c=zp.exec(o);return c?c[1]?a(c[1]):r(c[2]):!1},Ba=(o,a,r=!1)=>{const c=Dp.exec(o);return c?c[1]?a(c[1]):r:!1},Lp=o=>o==="position"||o==="percentage",Up=o=>o==="image"||o==="url",Bp=o=>o==="length"||o==="size"||o==="bg-size",Hp=o=>o==="length",Xv=o=>o==="number",Yp=o=>o==="family-name",Kp=o=>o==="number"||o==="weight",Gp=o=>o==="shadow",Fv=()=>{const o=qt("color"),a=qt("font"),r=qt("text"),c=qt("font-weight"),d=qt("tracking"),f=qt("leading"),p=qt("breakpoint"),m=qt("container"),b=qt("spacing"),S=qt("radius"),v=qt("shadow"),C=qt("inset-shadow"),D=qt("text-shadow"),z=qt("drop-shadow"),_=qt("blur"),F=qt("perspective"),k=qt("aspect"),I=qt("ease"),ee=qt("animate"),J=()=>["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"],ye=()=>[...ae(),se,re],O=()=>["auto","hidden","clip","visible","scroll"],U=()=>["auto","contain","none"],R=()=>[se,re,b],ne=()=>[fa,"full","auto",...R()],je=()=>[ul,"none","subgrid",se,re],Me=()=>["auto",{span:["full",ul,se,re]},ul,se,re],Ee=()=>[ul,"auto",se,re],fe=()=>["auto","min","max","fr",se,re],ke=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Oe=()=>["start","end","center","stretch","center-safe","end-safe"],j=()=>["auto",...R()],q=()=>[fa,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],W=()=>[fa,"screen","full","dvw","lvw","svw","min","max","fit",...R()],Ce=()=>[fa,"screen","full","lh","dvh","lvh","svh","min","max","fit",...R()],H=()=>[o,se,re],qe=()=>[...ae(),Gm,Km,{position:[se,re]}],Z=()=>["no-repeat",{repeat:["","x","y","space","round"]}],pe=()=>["auto","cover","contain",Gv,Uv,{size:[se,re]}],ze=()=>[gu,wr,Da],ve=()=>["","none","full",S,se,re],me=()=>["",Ye,wr,Da],St=()=>["solid","dashed","dotted","double"],Le=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],we=()=>[Ye,gu,Gm,Km],ut=()=>["","none",_,se,re],nt=()=>["none",Ye,se,re],ht=()=>["none",Ye,se,re],Ht=()=>[Ye,se,re],gt=()=>[fa,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ll],breakpoint:[Ll],color:[Op],container:[Ll],"drop-shadow":[Ll],ease:["in","out","in-out"],font:[Ov],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ll],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ll],shadow:[Ll],spacing:["px",Ye],text:[Ll],"text-shadow":[Ll],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",fa,re,se,k]}],container:["container"],"container-type":[{"@container":["","normal","size",se,re]}],"container-named":[Lv],columns:[{columns:[Ye,re,se,m]}],"break-after":[{"break-after":J()}],"break-before":[{"break-before":J()}],"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:ye()}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:U()}],"overscroll-x":[{"overscroll-x":U()}],"overscroll-y":[{"overscroll-y":U()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:ne()}],"inset-x":[{"inset-x":ne()}],"inset-y":[{"inset-y":ne()}],start:[{"inset-s":ne(),start:ne()}],end:[{"inset-e":ne(),end:ne()}],"inset-bs":[{"inset-bs":ne()}],"inset-be":[{"inset-be":ne()}],top:[{top:ne()}],right:[{right:ne()}],bottom:[{bottom:ne()}],left:[{left:ne()}],visibility:["visible","invisible","collapse"],z:[{z:[ul,"auto",se,re]}],basis:[{basis:[fa,"full","auto",m,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ye,fa,"auto","initial","none",re]}],grow:[{grow:["",Ye,se,re]}],shrink:[{shrink:["",Ye,se,re]}],order:[{order:[ul,"first","last","none",se,re]}],"grid-cols":[{"grid-cols":je()}],"col-start-end":[{col:Me()}],"col-start":[{"col-start":Ee()}],"col-end":[{"col-end":Ee()}],"grid-rows":[{"grid-rows":je()}],"row-start-end":[{row:Me()}],"row-start":[{"row-start":Ee()}],"row-end":[{"row-end":Ee()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":fe()}],"auto-rows":[{"auto-rows":fe()}],gap:[{gap:R()}],"gap-x":[{"gap-x":R()}],"gap-y":[{"gap-y":R()}],"justify-content":[{justify:[...ke(),"normal"]}],"justify-items":[{"justify-items":[...Oe(),"normal"]}],"justify-self":[{"justify-self":["auto",...Oe()]}],"align-content":[{content:["normal",...ke()]}],"align-items":[{items:[...Oe(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Oe(),{baseline:["","last"]}]}],"place-content":[{"place-content":ke()}],"place-items":[{"place-items":[...Oe(),"baseline"]}],"place-self":[{"place-self":["auto",...Oe()]}],p:[{p:R()}],px:[{px:R()}],py:[{py:R()}],ps:[{ps:R()}],pe:[{pe:R()}],pbs:[{pbs:R()}],pbe:[{pbe:R()}],pt:[{pt:R()}],pr:[{pr:R()}],pb:[{pb:R()}],pl:[{pl:R()}],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":R()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":R()}],"space-y-reverse":["space-y-reverse"],size:[{size:q()}],"inline-size":[{inline:["auto",...W()]}],"min-inline-size":[{"min-inline":["auto",...W()]}],"max-inline-size":[{"max-inline":["none",...W()]}],"block-size":[{block:["auto",...Ce()]}],"min-block-size":[{"min-block":["auto",...Ce()]}],"max-block-size":[{"max-block":["none",...Ce()]}],w:[{w:[m,"screen",...q()]}],"min-w":[{"min-w":[m,"screen","none",...q()]}],"max-w":[{"max-w":[m,"screen","none","prose",{screen:[p]},...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,wr,Da]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[c,Vv,Bv]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",gu,re]}],"font-family":[{font:[Kv,Hv,a]}],"font-features":[{"font-features":[re]}],"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,re]}],"line-clamp":[{"line-clamp":[Ye,"none",se,Ym]}],leading:[{leading:[f,...R()]}],"list-image":[{"list-image":["none",se,re]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",se,re]}],"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:[...St(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ye,"from-font","auto",se,Da]}],"text-decoration-color":[{decoration:H()}],"underline-offset":[{"underline-offset":[Ye,"auto",se,re]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"tab-size":[{tab:[ul,se,re]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",se,re]}],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,re]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:qe()}],"bg-repeat":[{bg:Z()}],"bg-size":[{bg:pe()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ul,se,re],radial:["",se,re],conic:[ul,se,re]},qv,Yv]}],"bg-color":[{bg:H()}],"gradient-from-pos":[{from:ze()}],"gradient-via-pos":[{via:ze()}],"gradient-to-pos":[{to:ze()}],"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:me()}],"border-w-x":[{"border-x":me()}],"border-w-y":[{"border-y":me()}],"border-w-s":[{"border-s":me()}],"border-w-e":[{"border-e":me()}],"border-w-bs":[{"border-bs":me()}],"border-w-be":[{"border-be":me()}],"border-w-t":[{"border-t":me()}],"border-w-r":[{"border-r":me()}],"border-w-b":[{"border-b":me()}],"border-w-l":[{"border-l":me()}],"divide-x":[{"divide-x":me()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":me()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...St(),"hidden","none"]}],"divide-style":[{divide:[...St(),"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:[...St(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ye,se,re]}],"outline-w":[{outline:["",Ye,wr,Da]}],"outline-color":[{outline:H()}],shadow:[{shadow:["","none",v,Qs,Zs]}],"shadow-color":[{shadow:H()}],"inset-shadow":[{"inset-shadow":["none",C,Qs,Zs]}],"inset-shadow-color":[{"inset-shadow":H()}],"ring-w":[{ring:me()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:H()}],"ring-offset-w":[{"ring-offset":[Ye,Da]}],"ring-offset-color":[{"ring-offset":H()}],"inset-ring-w":[{"inset-ring":me()}],"inset-ring-color":[{"inset-ring":H()}],"text-shadow":[{"text-shadow":["none",D,Qs,Zs]}],"text-shadow-color":[{"text-shadow":H()}],opacity:[{opacity:[Ye,se,re]}],"mix-blend":[{"mix-blend":[...Le(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Le()}],"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":[Ye]}],"mask-image-linear-from-pos":[{"mask-linear-from":we()}],"mask-image-linear-to-pos":[{"mask-linear-to":we()}],"mask-image-linear-from-color":[{"mask-linear-from":H()}],"mask-image-linear-to-color":[{"mask-linear-to":H()}],"mask-image-t-from-pos":[{"mask-t-from":we()}],"mask-image-t-to-pos":[{"mask-t-to":we()}],"mask-image-t-from-color":[{"mask-t-from":H()}],"mask-image-t-to-color":[{"mask-t-to":H()}],"mask-image-r-from-pos":[{"mask-r-from":we()}],"mask-image-r-to-pos":[{"mask-r-to":we()}],"mask-image-r-from-color":[{"mask-r-from":H()}],"mask-image-r-to-color":[{"mask-r-to":H()}],"mask-image-b-from-pos":[{"mask-b-from":we()}],"mask-image-b-to-pos":[{"mask-b-to":we()}],"mask-image-b-from-color":[{"mask-b-from":H()}],"mask-image-b-to-color":[{"mask-b-to":H()}],"mask-image-l-from-pos":[{"mask-l-from":we()}],"mask-image-l-to-pos":[{"mask-l-to":we()}],"mask-image-l-from-color":[{"mask-l-from":H()}],"mask-image-l-to-color":[{"mask-l-to":H()}],"mask-image-x-from-pos":[{"mask-x-from":we()}],"mask-image-x-to-pos":[{"mask-x-to":we()}],"mask-image-x-from-color":[{"mask-x-from":H()}],"mask-image-x-to-color":[{"mask-x-to":H()}],"mask-image-y-from-pos":[{"mask-y-from":we()}],"mask-image-y-to-pos":[{"mask-y-to":we()}],"mask-image-y-from-color":[{"mask-y-from":H()}],"mask-image-y-to-color":[{"mask-y-to":H()}],"mask-image-radial":[{"mask-radial":[se,re]}],"mask-image-radial-from-pos":[{"mask-radial-from":we()}],"mask-image-radial-to-pos":[{"mask-radial-to":we()}],"mask-image-radial-from-color":[{"mask-radial-from":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":[Ye]}],"mask-image-conic-from-pos":[{"mask-conic-from":we()}],"mask-image-conic-to-pos":[{"mask-conic-to":we()}],"mask-image-conic-from-color":[{"mask-conic-from":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:qe()}],"mask-repeat":[{mask:Z()}],"mask-size":[{mask:pe()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",se,re]}],filter:[{filter:["","none",se,re]}],blur:[{blur:ut()}],brightness:[{brightness:[Ye,se,re]}],contrast:[{contrast:[Ye,se,re]}],"drop-shadow":[{"drop-shadow":["","none",z,Qs,Zs]}],"drop-shadow-color":[{"drop-shadow":H()}],grayscale:[{grayscale:["",Ye,se,re]}],"hue-rotate":[{"hue-rotate":[Ye,se,re]}],invert:[{invert:["",Ye,se,re]}],saturate:[{saturate:[Ye,se,re]}],sepia:[{sepia:["",Ye,se,re]}],"backdrop-filter":[{"backdrop-filter":["","none",se,re]}],"backdrop-blur":[{"backdrop-blur":ut()}],"backdrop-brightness":[{"backdrop-brightness":[Ye,se,re]}],"backdrop-contrast":[{"backdrop-contrast":[Ye,se,re]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ye,se,re]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ye,se,re]}],"backdrop-invert":[{"backdrop-invert":["",Ye,se,re]}],"backdrop-opacity":[{"backdrop-opacity":[Ye,se,re]}],"backdrop-saturate":[{"backdrop-saturate":[Ye,se,re]}],"backdrop-sepia":[{"backdrop-sepia":["",Ye,se,re]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":R()}],"border-spacing-x":[{"border-spacing-x":R()}],"border-spacing-y":[{"border-spacing-y":R()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",se,re]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ye,"initial",se,re]}],ease:[{ease:["linear","initial",I,se,re]}],delay:[{delay:[Ye,se,re]}],animate:[{animate:["none",ee,se,re]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[F,se,re]}],"perspective-origin":[{"perspective-origin":ye()}],rotate:[{rotate:nt()}],"rotate-x":[{"rotate-x":nt()}],"rotate-y":[{"rotate-y":nt()}],"rotate-z":[{"rotate-z":nt()}],scale:[{scale:ht()}],"scale-x":[{"scale-x":ht()}],"scale-y":[{"scale-y":ht()}],"scale-z":[{"scale-z":ht()}],"scale-3d":["scale-3d"],skew:[{skew:Ht()}],"skew-x":[{"skew-x":Ht()}],"skew-y":[{"skew-y":Ht()}],transform:[{transform:[se,re,"","none","gpu","cpu"]}],"transform-origin":[{origin:ye()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:gt()}],"translate-x":[{"translate-x":gt()}],"translate-y":[{"translate-y":gt()}],"translate-z":[{"translate-z":gt()}],"translate-none":["translate-none"],zoom:[{zoom:[ul,se,re]}],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,re]}],"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":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mbs":[{"scroll-mbs":R()}],"scroll-mbe":[{"scroll-mbe":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pbs":[{"scroll-pbs":R()}],"scroll-pbe":[{"scroll-pbe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"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,re]}],fill:[{fill:["none",...H()]}],"stroke-w":[{stroke:[Ye,wr,Da,Ym]}],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"]}},Zv=Tv(Fv);function P(...o){return Zv(nv(o))}var Qv=dp();const Ge={cursor:"▸",on:"●",off:"○",dot:"·",check:"✓",cross:"✗",warn:"!",arrowRight:"→",arrowLeft:"←",chevronDown:"▾",chevronRight:"▸",ellipsis:"…",meterFull:"█",meterEmpty:"░",tabDivider:"│"},Qn={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"}},Ur={ok:Qn.ok.text,warn:Qn.warn.text,bad:Qn.bad.text,idle:Qn.idle.text,accent:Qn.accent.text,alt:Qn.alt.text,info:Qn.info.text},Jn=({level:o,className:a})=>u.jsx("span",{"aria-hidden":"true",className:P("select-none leading-none",Ur[o],a),children:o==="idle"?Ge.off:Ge.on}),qp=({className:o})=>u.jsx("span",{"aria-hidden":"true",className:P("select-none text-tui-faint",o),children:Ge.dot}),rn=({title:o,aside:a,tone:r="accent",className:c,bodyClassName:d,children:f,...p})=>u.jsxs("fieldset",{className:P("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),...p,children:[o?u.jsx("legend",{className:P("flex items-center gap-2 text-tui font-bold",Ur[r]),children:u.jsx("span",{children:o})}):null,a?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:a}):null,u.jsx("div",{className:P("min-w-0",d),children:f})]}),nl=({label:o,labelWidth:a=16,className:r,children:c})=>u.jsxs("div",{className:P("flex items-baseline gap-2 text-tui",r),children:[u.jsx("span",{className:"shrink-0 truncate text-tui-muted",style:{width:`${a}ch`},title:typeof o=="string"?o:void 0,children:o}),u.jsx("span",{className:"min-w-0 flex-1 text-tui-text",children:c})]}),La=({className:o,label:a})=>a?u.jsxs("div",{className:P("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:a}),u.jsx("span",{className:"h-px flex-1 bg-tui-border-dim","aria-hidden":"true"})]}):u.jsx("div",{className:P("h-px w-full bg-tui-border-dim",o),"aria-hidden":"true"}),Iv={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"},He=({variant:o="default",brackets:a=!0,glyph:r,block:c=!1,className:d,children:f,type:p="button",...m})=>u.jsxs("button",{type:p,className:P("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",Iv[o],c&&"w-full",d),...m,children:[a?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:f}),a?u.jsx("span",{"aria-hidden":"true",className:"opacity-60",children:"]"}):null]}),io=({tone:o="accent",dot:a=!1,className:r,children:c})=>u.jsxs("span",{className:P("inline-flex select-none items-center gap-1 whitespace-nowrap text-tui font-bold uppercase",Ur[o],r),children:[a?u.jsx(Jn,{level:o}):null,c]}),Bu=({tabs:o,activeId:a,onSelect:r,ariaLabel:c,className:d,labelClassName:f})=>u.jsx("nav",{className:P("flex items-center gap-2",d),"aria-label":c,children:o.map((p,m)=>{const b=p.id===a;return u.jsxs(dl.Fragment,{children:[m>0?u.jsx("span",{"aria-hidden":"true",className:"select-none text-tui-border",children:Ge.tabDivider}):null,u.jsxs("button",{type:"button",onClick:()=>r(p.id),"aria-current":b?"page":void 0,"aria-label":p.ariaLabel??p.label,title:p.title,className:P("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:[p.index!==void 0?u.jsx("span",{"aria-hidden":"true",className:P("text-tui-faint",b&&"text-tui-accent"),children:p.index}):null,u.jsx("span",{"aria-hidden":"true",className:P("ml-1",f),children:p.label})]})]},p.id)})}),Vp=({hints:o,className:a})=>u.jsx("div",{className:P("flex flex-wrap items-center gap-x-3 gap-y-0.5 text-tui-sm text-tui-faint",a),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}`))}),kn=({htmlFor:o,hint:a,className:r,children:c})=>u.jsxs("label",{htmlFor:o,className:P("block text-tui-sm font-bold text-tui-muted",r),children:[c,a?u.jsx("span",{className:"ml-2 font-normal text-tui-faint",children:a}):null]}),In=dl.forwardRef(({className:o,...a},r)=>u.jsx("input",{ref:r,className:P("tui-input w-full px-2 py-1 text-tui",o),...a}));In.displayName="Input";const Hu=dl.forwardRef(({className:o,children:a,...r},c)=>u.jsx("select",{ref:c,className:P("tui-input w-full px-2 py-1 text-tui",o),...r,children:a}));Hu.displayName="Select";const Au=({checked:o,onChange:a,disabled:r=!1,label:c,description:d,className:f,id:p})=>u.jsxs("label",{className:P("group flex cursor-pointer select-none items-start gap-2 py-0.5 text-tui",r&&"cursor-not-allowed opacity-60",f),children:[u.jsx("input",{id:p,type:"checkbox",className:"sr-only",checked:o,disabled:r,onChange:m=>a(m.target.checked)}),u.jsx("span",{"aria-hidden":"true",className:P("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:P("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]})]}),Cr=({checked:o,onChange:a,name:r,disabled:c=!1,label:d,description:f,className:p})=>u.jsxs("label",{className:P("group flex cursor-pointer select-none items-start gap-2 py-0.5 text-tui",c&&"cursor-not-allowed opacity-60",p),children:[u.jsx("input",{type:"radio",name:r,className:"sr-only",checked:o,disabled:c,onChange:a}),u.jsx("span",{"aria-hidden":"true",className:P("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:P("block",o?"text-tui-text":"text-tui-muted"),children:d}),f?u.jsx("span",{className:"mt-0.5 block text-tui-sm leading-snug text-tui-faint",children:f}):null]})]}),Jv=({value:o,width:a=20,tone:r="accent",className:c})=>{const d=Number.isFinite(o)?Math.min(1,Math.max(0,o)):0,f=Math.round(d*a);return u.jsxs("span",{className:P("inline-flex select-none whitespace-pre font-mono leading-none",c),role:"presentation",children:[u.jsx("span",{className:Ur[r],children:Ge.meterFull.repeat(f)}),u.jsx("span",{className:"text-tui-border",children:Ge.meterEmpty.repeat(Math.max(0,a-f))})]})},Wv={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"},Pv=({ratio:o,label:a,tone:r="accent",className:c,...d})=>{const f=Number.isFinite(o)?Math.min(1,Math.max(0,o)):0;return u.jsxs("div",{className:P("relative h-[var(--tui-row)] w-full overflow-hidden border border-tui-border bg-tui-mantle",c),role:"progressbar","aria-valuenow":Math.round(f*100),"aria-valuemin":0,"aria-valuemax":100,...d,children:[u.jsx("div",{className:P("absolute inset-y-0 left-0",Wv[r]),style:{width:`${f*100}%`},"aria-hidden":"true"}),a!==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:a}):null]})};function Yu({columns:o,items:a,rowKey:r,empty:c,className:d}){return a.length===0?u.jsx("div",{className:P("px-1 py-4 text-center text-tui text-tui-faint",d),children:c}):u.jsx("div",{className:P("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(f=>u.jsx("th",{scope:"col",style:f.width?{width:`${f.width}ch`}:void 0,className:P("whitespace-nowrap px-2 py-1 text-tui-sm font-bold text-tui-muted",f.align==="right"?"text-right":"text-left",f.className),children:f.header},f.key))})}),u.jsx("tbody",{children:a.map((f,p)=>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:P("px-2 py-1 align-top text-tui-text",m.align==="right"?"text-right":"text-left",m.className),children:m.render(f,p)},m.key))},r(f,p)))})]})})}const Ku=({isOpen:o,onClose:a,title:r,subtitle:c,closeLabel:d,footer:f,hints:p,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()}`,D=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&&a()},children:u.jsxs("div",{className:P("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(He,{variant:"ghost",onClick:a,"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}),f||p?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:[p?u.jsx(Vp,{hints:p}):u.jsx("span",{}),f?u.jsx("div",{className:"flex items-center gap-2",children:f}):null]}):null]})});return typeof document>"u"?D:Qv.createPortal(D,document.body)},$s=({tone:o="accent",className:a,children:r,action:c})=>{const d=o==="ok"?Ge.check:o==="bad"?Ge.cross:o==="warn"?Ge.warn:"›",f=Qn[o].edgeL;return u.jsxs("div",{className:P("flex items-start gap-2 border border-tui-border-dim border-l-2 bg-tui-mantle px-2 py-1.5 text-tui",f,a),children:[u.jsx("span",{"aria-hidden":"true",className:P("shrink-0 font-bold",Ur[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]})},$v=({active:o=!1,className:a,children:r})=>u.jsx("span",{className:P("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",a),children:r}),qm=({items:o,className:a})=>{const r=o.filter(Boolean);return u.jsx("span",{className:P("flex min-w-0 items-center gap-1.5",a),children:r.map((c,d)=>u.jsxs(dl.Fragment,{children:[d>0?u.jsx(qp,{className:"shrink-0"}):null,c]},d))})},Xp=({left:o,right:a,className:r})=>u.jsxs("footer",{className:P("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:a})]}),ex=({name:o,tagline:a,aside:r,tabs:c,activeTabId:d,onSelectTab:f,tabsAriaLabel:p,hints:m,footerAside:b,bodyClassName:S,className:v,children:C})=>u.jsxs("div",{className:P("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}),a?u.jsx("span",{className:"hidden truncate text-tui-sm text-tui-faint sm:block",children:a}):null]}),r?u.jsx("span",{className:"flex shrink-0 items-center gap-2",children:r}):null]}),c&&c.length>0&&d!==void 0&&f?u.jsx("div",{className:"scrollbar-none shrink-0 overflow-x-auto border-b border-tui-border bg-tui-mantle px-2",children:u.jsx(Bu,{tabs:c,activeId:d,onSelect:f,ariaLabel:p,className:"gap-3"})}):null,u.jsx("div",{className:P("min-h-0 flex-1 overflow-y-auto p-2",S),children:C}),m||b?u.jsx(Xp,{left:m?u.jsx(Vp,{hints:m}):null,right:b}):null]}),Vm=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],ji=({className:o,label:a})=>{const[r,c]=dl.useState(0);return dl.useEffect(()=>{const d=setInterval(()=>c(f=>(f+1)%Vm.length),90);return()=>clearInterval(d)},[]),u.jsxs("span",{className:P("inline-flex items-center gap-1.5",o),role:"status",children:[u.jsx("span",{"aria-hidden":"true",className:"text-tui-accent",children:Vm[r]}),a?u.jsx("span",{children:a}):null]})},Is="tui-focusable select-none border border-transparent px-1.5 text-tui uppercase transition-colors",Js="text-tui-muted hover:border-tui-border hover:text-tui-accent",tx="border-tui-accent bg-tui-accent text-tui-crust",nx=({currentView:o,onNavigate:a,showAdminEntry:r=!0,onOpenPairing:c,onOpenSettings:d,onToggleVirtualKeyboard:f,isVirtualKeyboardOpen:p})=>{const{addToast:m,language:b,setLanguage:S,t:v}=Ct(),C=()=>{const z=b==="zh"?"en":"zh";S(z),m("info",Ou(z,"toasts.switchedLanguage",{lang:z==="zh"?"简体中文":"English"}))},D=[{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(Bu,{tabs:D,activeId:o,onSelect:z=>a(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:P(Is,Js),title:v("header.languageToggleTitle"),"aria-label":v("header.languageToggleTitle"),children:v("header.languageShort")}),o==="terminal"&&u.jsx("button",{type:"button",onClick:f,className:P(Is,p?tx:Js),title:v("header.virtualKeyboardTitle"),"aria-label":v("header.virtualKeyboardTitle"),children:v("header.actionKeyboard")}),u.jsx("button",{type:"button",onClick:c,className:P(Is,Js),title:v("header.pairingTitle"),"aria-label":v("header.pairingTitle"),children:v("header.actionPairing")}),u.jsx("button",{type:"button",onClick:d,className:P(Is,Js),title:v("header.settingsTitle"),"aria-label":v("header.settingsTitle"),children:v("header.actionSettings")})]})]})})},Ws=({tone:o,glyph:a,message:r,assertive:c=!1,action:d})=>u.jsxs("aside",{className:P("flex w-full items-center justify-between gap-3 border-b bg-tui-mantle px-2 py-0.5 text-tui sm:px-3",Qn[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:P("shrink-0",Qn[o].text),children:a}),u.jsx("span",{className:"truncate text-tui-text",children:r})]}),d]}),lx=()=>{const{connectionState:o,stateDetail:a,connect:r,settings:c,t:d}=Ct();return o==="connected"||!c.token&&!c.pairCode&&o==="disconnected"?null:o==="connecting"?u.jsx(Ws,{tone:"accent",glyph:u.jsx(ji,{}),message:d("statusBanner.connecting")}):o==="reconnecting"?u.jsx(Ws,{tone:"warn",glyph:u.jsx(ji,{}),assertive:!0,message:a||d("statusBanner.reconnectingDefault"),action:u.jsx(He,{variant:"warn",onClick:()=>r(),className:"shrink-0",children:d("statusBanner.reconnectNow")})}):o==="error"?u.jsx(Ws,{tone:"bad",glyph:Ge.cross,assertive:!0,message:a||d("statusBanner.errorDefault"),action:u.jsx(He,{variant:"danger",onClick:()=>r(),className:"shrink-0",children:d("common.retry")})}):o==="disconnected"?u.jsx(Ws,{tone:"idle",glyph:Ge.off,message:d("statusBanner.disconnected"),action:u.jsx(He,{variant:"primary",onClick:()=>r(),className:"shrink-0",children:d("common.connect")})}):null};var ax=iy(),ix=ry();const rx=20,sx=6,ox=500,cx=300,Mi=13,Fp=.602,Zp=1.3;function Ul(o,a){return Number.isFinite(o)&&o>0?o:a}function Xm(o,a,r){return Math.min(r,Math.max(a,o))}function Fm(o){const{width:a,height:r,cellWidth:c,cellHeight:d,minCols:f=rx,minRows:p=sx,maxCols:m=ox,maxRows:b=cx}=o,S=Ul(c,Mi*Fp),v=Ul(d,Mi*Zp);return{cols:Xm(Math.floor(Ul(a,0)/S),f,m),rows:Xm(Math.floor(Ul(r,0)/v),p,b)}}function ha(o,a=Mi){var c,d,f;if(o)try{const p=o._core,m=(f=(d=(c=p==null?void 0:p._renderService)==null?void 0:c.dimensions)==null?void 0:d.css)==null?void 0:f.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=Ul(a,Mi);return{cellWidth:Math.round(r*Fp*100)/100,cellHeight:Math.round(r*Zp*100)/100,measured:!1}}function ux(o){var c;const a=(c=o==null?void 0:o.querySelector)==null?void 0:c.call(o,".xterm-viewport");if(!a)return 0;const r=(a.offsetWidth||0)-(a.clientWidth||0);return Number.isFinite(r)&&r>0?r:0}function bu(o,a,r){if(!o)return{width:a,height:r};let c=0,d=0;if(typeof o.getBoundingClientRect=="function"){const f=o.getBoundingClientRect();c=(f==null?void 0:f.width)||0,d=(f==null?void 0:f.height)||0}return{width:Ul(c,Ul(o.clientWidth,a)),height:Ul(d,Ul(o.clientHeight,r))}}function Qp(o,a,r,c){const d=Number.isFinite(c)&&c>.01?c:1;return{clientX:r.left+(o-r.left)/d,clientY:r.top+(a-r.top)/d}}function Tr(o){var a,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((a=d==null?void 0:d._coreMouseService)!=null&&a.areMouseEventsActive||(r=d==null?void 0:d.coreMouseService)!=null&&r.areMouseEventsActive||d!=null&&d.mouseMode&&d.mouseMode!=="none")return!0}catch{}return!1}function dx(o,a){const r=a.button??0,c=a.buttons??(o==="mouseup"?0:1);return new MouseEvent(o,{bubbles:!0,cancelable:!0,clientX:a.clientX,clientY:a.clientY,screenX:a.clientX,screenY:a.clientY,button:r,buttons:c})}function Zm(o,a,r){const c=dx(a,r);return o.dispatchEvent(c)}class fx{constructor(a){Se(this,"options");Se(this,"state","idle");Se(this,"startX",0);Se(this,"startY",0);Se(this,"lastX",0);Se(this,"lastY",0);Se(this,"activeTarget",null);Se(this,"longPressTimer",null);Se(this,"capturedPointerId",null);Se(this,"captureElement",null);Se(this,"scrollRemainderY",0);Se(this,"isSnapshotScrolling",!1);Se(this,"snapshotRows",0);this.options={longPressDelayMs:500,dragThresholdPx:8,scrollLineHeightPx:18,...a}}getState(){return this.state}setGestureState(a){var r,c;this.state!==a&&(this.state=a,(c=(r=this.options).onGestureStateChange)==null||c.call(r,a))}getActiveBuffer(a){var r;try{return((r=a.buffer)==null?void 0:r.active)||null}catch{return null}}getViewportY(a){var c;const r=(c=this.getActiveBuffer(a))==null?void 0:c.viewportY;return typeof r=="number"&&Number.isFinite(r)?r:null}blurTerminal(a){var r;try{(r=a.blur)==null||r.call(a)}catch{}}getLogicalCoordinates(a,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 f=d.getBoundingClientRect();return Qp(a,r,f,c)}return{clientX:a,clientY:r}}getViewportElement(a){var d;const r=this.options.getSurfaceElement?this.options.getSurfaceElement():null;return(r==null?void 0:r.querySelector(".xterm-viewport"))||((d=a.element)==null?void 0:d.querySelector(".xterm-viewport"))||null}isInputLineHit(a,r){var ee;const c=(ee=r.buffer)==null?void 0:ee.active,d=this.options.getSurfaceElement?this.options.getSurfaceElement():null,f=(d==null?void 0:d.querySelector(".xterm-screen"))||r.element||d,p=ha(r);if(!f||typeof f.getBoundingClientRect!="function"||p.cellHeight<=0)return!1;const m=f.getBoundingClientRect(),b=this.getLogicalCoordinates(a.clientX,a.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(J=>typeof J=="number"&&Number.isFinite(J)))return!1;const C=c==null?void 0:c.cursorY,D=c==null?void 0:c.viewportY,_=(c==null?void 0:c.baseY)+C-D,F=m.top+_*p.cellHeight,k=F+p.cellHeight,I=Number(r.rows);return _>=0&&(!Number.isFinite(I)||_<I)&&b.clientY>=F-2&&b.clientY<=k+2&&(!S||b.clientX>=m.left&&b.clientX<=m.right)}resolveDispatchTarget(a,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,f=((m=d==null?void 0:d.closest)==null?void 0:m.call(d,".xterm"))||null;let p=null;return typeof document<"u"&&typeof document.elementFromPoint=="function"&&(p=document.elementFromPoint(a.clientX,a.clientY)),p&&f&&(p===f||f.contains(p))?p:d||c||r}getMouseReport(a,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 f=d.getBoundingClientRect(),p=this.getLogicalCoordinates(a.clientX,a.clientY),m=ha(r);if(m.cellWidth<=0||m.cellHeight<=0)return null;const b=Math.max(1,f.width||r.cols*m.cellWidth),S=Math.max(1,f.height||r.rows*m.cellHeight),v=Math.max(0,Math.min(b-1,p.clientX-f.left)),C=Math.max(0,Math.min(S-1,p.clientY-f.top)),D=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:D,row:z,x:Math.floor(v),y:Math.floor(C),button:0,action:0}}getCoreMouseService(a){var c,d;const r=a;return r.coreMouseService||((c=r._core)==null?void 0:c.coreMouseService)||((d=r._core)==null?void 0:d._coreMouseService)||null}getCoreService(a){var c;const r=a;return r.coreService||((c=r._core)==null?void 0:c.coreService)||null}getWheelDispatchTarget(a){const r=this.options.getSurfaceElement?this.options.getSurfaceElement():null;return(r==null?void 0:r.querySelector(".xterm"))||a.element||null}dispatchWheel(a,r,c,d){const f=this.getWheelDispatchTarget(c);if(!f||typeof WheelEvent>"u"||r===0)return!1;const p=this.getLogicalCoordinates(a.clientX,a.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:p.clientX,clientY:p.clientY,deltaX:0,deltaY:m,deltaMode:1,ctrlKey:!!(d!=null&&d.ctrlKey),altKey:!!(d!=null&&d.altKey),shiftKey:!!(d!=null&&d.shiftKey)});f.dispatchEvent(v),b+=1}catch{return b>0}return b>0}emitWheel(a,r,c,d){if(r===0)return!1;if(this.dispatchWheel(a,r,c,d))return!0;const f=this.getCoreMouseService(c);if(!(f!=null&&f.triggerMouseEvent))return!1;let p=0;for(let m=0;m<Math.abs(r);m+=1){const b=this.getMouseReport(a,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),f.triggerMouseEvent(b)&&(p+=1))}return p>0}scrollAlternateBuffer(a,r,c,d){var p;if(r===0)return"none";const f=Tr(c);if(!f&&!this.options.getIsController())return"none";if(this.emitWheel(a,r,c,d))return f?"application-mouse":"application-keys";if(!f){const m=this.getCoreService(c);if(!(m!=null&&m.triggerDataEvent))return"none";const S=`\x1B${!!((p=m.decPrivateModes)!=null&&p.applicationCursorKeys)?"O":"["}${r<0?"A":"B"}`;return m.triggerDataEvent(S.repeat(Math.abs(r)),!0),"application-keys"}return"none"}emitMouse(a,r,c){const d=this.options.getTerminal();if(!d)return;const f=this.getCoreMouseService(d);if(f!=null&&f.triggerMouseEvent){const m=this.getMouseReport(r,d);m&&(m.action=a==="mousedown"?1:a==="mouseup"?0:32,m.ctrl=!!(c!=null&&c.ctrlKey),m.alt=!!(c!=null&&c.altKey),m.shift=!!(c!=null&&c.shiftKey),f.triggerMouseEvent(m));return}if(this.options.allowSyntheticMouseFallback===!1||!this.activeTarget)return;const p=this.getLogicalCoordinates(r.clientX,r.clientY);Zm(this.activeTarget,a,{clientX:p.clientX,clientY:p.clientY,button:0,buttons:a==="mouseup"?0:1})}beginGesture(a,r){this.startX=a.clientX,this.startY=a.clientY,this.lastX=a.clientX,this.lastY=a.clientY,this.setGestureState("pending"),this.scrollRemainderY=0,this.activeTarget=this.resolveDispatchTarget(a,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(a,r){var S,v,C,D;if(this.state==="longpress"){(v=(S=this.options).onSelectionExtend)==null||v.call(S,{clientX:a.clientX,clientY:a.clientY}),r!=null&&r.cancelable&&((C=r.preventDefault)==null||C.call(r));return}if(this.state==="idle")return;const c=a.clientX-this.startX,d=a.clientY-this.startY,f=Math.hypot(c,d);if(this.state==="scrolling"){this.scrollGesture(a,r);return}const p=this.options.getTerminal(),m=this.options.getIsController(),b=Tr(p);if(!(f<=(this.options.dragThresholdPx||8))){if(this.clearLongPressTimer(),Math.abs(d)>=Math.abs(c)||!b||!m){this.setGestureState("scrolling"),p&&this.blurTerminal(p),this.lastX=a.clientX,this.lastY=this.startY,this.scrollRemainderY=0,this.scrollGesture(a,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=a.clientX,this.lastY=a.clientY,this.emitMouse("mousemove",a,r),r!=null&&r.cancelable&&((D=r.preventDefault)==null||D.call(r)));return}this.lastX=a.clientX,this.lastY=a.clientY}}scrollGesture(a,r){var _,F,k,I,ee,J,ae;const c=this.options.getTerminal();if(!c)return;const d=a.clientY-this.lastY;this.lastX=a.clientX,this.lastY=a.clientY;const f=ha(c),p=f.measured?f.cellHeight:this.options.scrollLineHeightPx||f.cellHeight||18;this.scrollRemainderY+=d;const m=Math.trunc(this.scrollRemainderY/p),b=-m;let S=!1,v="none";const C=this.getActiveBuffer(c),D=Tr(c);if(b!==0){if((C==null?void 0:C.type)==="alternate")v=this.scrollAlternateBuffer(a,b,c,r),S=v!=="none",S&&(this.isSnapshotScrolling||(this.isSnapshotScrolling=!0,this.snapshotRows=0,(F=(_=this.options).onSnapshotScrollStart)==null||F.call(_)),this.snapshotRows-=b,(I=(k=this.options).onSnapshotScrollMove)==null||I.call(k,this.snapshotRows));else{const ye=this.getViewportY(c);c.scrollLines(b);const O=this.getViewportY(c);v="buffer",S=ye===null||O===null||ye!==O}this.scrollRemainderY-=m*p}const z=this.getViewportElement(c);(J=(ee=this.options).onGestureScroll)==null||J.call(ee,{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:D,scrollMode:v}),r!=null&&r.cancelable&&((ae=r.preventDefault)==null||ae.call(r))}endGesture(a,r){var p,m,b;this.clearLongPressTimer();const c=this.options.getTerminal(),d=this.options.getIsController(),f=Tr(c);if(this.state==="pending"){if(f&&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=(p=this.options).onFocus)==null||m.call(p))}else if(this.state==="dragging"&&f&&d){const S=a??{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(a,r){if(a.pointerType==="mouse")return!1;if(!a.isPrimary)return this.releasePointerCapture(),this.reset(),!1;if(a.cancelable&&a.preventDefault(),this.beginGesture(a,r),a.pointerType!=="touch")try{typeof r.setPointerCapture=="function"&&(r.setPointerCapture(a.pointerId),this.capturedPointerId=a.pointerId,this.captureElement=r)}catch{}return!0}handlePointerMove(a){a.pointerType==="mouse"||this.state==="idle"||this.moveGesture(a,a)}handlePointerUp(a){a.pointerType==="mouse"||this.state==="idle"||(this.releasePointerCapture(),this.endGesture(a,a))}handlePointerCancel(a){a&&a.pointerType==="mouse"||(this.releasePointerCapture(),this.cancelGesture())}handleTouchStart(a,r){if(a.touches.length!==1){this.reset();return}a.cancelable&&a.preventDefault(),this.beginGesture(a.touches[0],r)}handleTouchMove(a){a.touches.length===1&&this.moveGesture(a.touches[0],a)}handleTouchEnd(a){a.cancelable&&a.preventDefault(),this.endGesture(null,a)}handleTouchCancel(){this.cancelGesture()}cancelGesture(){this.clearLongPressTimer();const a=this.options.getTerminal(),r=this.options.getIsController(),c=Tr(a);if(this.state==="dragging"&&c&&r&&this.activeTarget){const d=this.getLogicalCoordinates(this.lastX,this.lastY);Zm(this.activeTarget,"mouseup",{clientX:d.clientX,clientY:d.clientY,button:0,buttons:0})}this.reset()}releasePointerCapture(){const a=this.captureElement,r=this.capturedPointerId;if(this.captureElement=null,this.capturedPointerId=null,!(!a||r===null))try{typeof a.releasePointerCapture=="function"&&(typeof a.hasPointerCapture!="function"||a.hasPointerCapture(r))&&a.releasePointerCapture(r)}catch{}}clearLongPressTimer(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressTimer=null)}reset(){var a,r;this.clearLongPressTimer(),this.releasePointerCapture(),this.setGestureState("idle"),this.activeTarget=null,this.isSnapshotScrolling&&(this.isSnapshotScrolling=!1,this.snapshotRows=0,(r=(a=this.options).onSnapshotScrollEnd)==null||r.call(a))}}var yu=sy(),hx=oy();const zr="herdr_remote_renderer_probe_v1",Ps=1,mx=720*60*60*1e3,ju={};function Ip(){let o=null;if(typeof window>"u")o=ju[zr]||null;else try{o=window.localStorage?window.localStorage.getItem(zr):null}catch{o=ju[zr]||null}if(!o)return{v:Ps,ua:{}};try{const a=JSON.parse(o);return typeof a=="object"&&a!==null&&a.v===Ps&&typeof a.ua=="object"&&a.ua!==null?a:{v:Ps,ua:{}}}catch{return{v:Ps,ua:{}}}}function px(o,a=Date.now()){var d;const r=Ip();r.ua[o]={failedAt:a};const c=JSON.stringify(r);if(ju[zr]=c,typeof window<"u")try{(d=window.localStorage)==null||d.setItem(zr,c)}catch(f){console.warn("Failed to write renderer probe result to localStorage:",f)}}function gx(o,a=Date.now()){const r=typeof navigator<"u"?navigator.userAgent:"";if(!r)return!1;const d=Ip().ua[r];return!(!d||typeof d.failedAt!="number"||a-d.failedAt>mx)}function Qm(o,a=Date.now()){const r=typeof navigator<"u"?navigator.userAgent:"";r&&px(r,a)}function bx(o){if(o.length<4)return!0;const a=o[0],r=o[1],c=o[2],d=o[3];for(let f=4;f<o.length;f+=4)if(o[f]!==a||o[f+1]!==r||o[f+2]!==c||o[f+3]!==d)return!1;return!0}function yx(o){if(!o||o.width<=0||o.height<=0)return console.debug("Canvas probe inconclusive: text layer canvas missing or zero dimensions"),"inconclusive";let a=null;try{a=o.getContext("2d",{willReadFrequently:!0})||o.getContext("2d")}catch(d){return console.debug("Canvas probe inconclusive: failed to acquire 2D context:",d),"inconclusive"}if(!a)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=a.getImageData(0,0,r,c);return bx(d.data)?"blank":"healthy"}catch(d){return console.debug("Canvas probe inconclusive: getImageData threw exception:",d),"inconclusive"}}function vx(o=2){return new Promise(a=>{if(typeof requestAnimationFrame!="function"){setTimeout(a,32);return}let r=o;const c=()=>{r--,r<=0?a():requestAnimationFrame(c)};requestAnimationFrame(c)})}function xx(o,a){if(a.coarsePointer){if(gx())return{kind:"dom",dispose:()=>{},verify:async()=>{}};try{const r=new yu.CanvasAddon;o.loadAddon(r);let c="canvas",d=!1,f=null;const p=()=>{var b;if(c!=="dom"){Qm();try{r.dispose()}catch{}c="dom",(b=a.onRendererSwapped)==null||b.call(a,"dom")}};return{get kind(){return c},dispose:()=>{d=!0;try{r.dispose()}catch{}},verify:async()=>{if(!(d||c!=="canvas"))return f||(f=(async()=>{var b;try{if(await vx(2),d||c!=="canvas")return;const S=(b=o.element)==null?void 0:b.querySelector("canvas.xterm-text-layer"),v=yx(S);v==="blank"?p():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{f=null}})(),f)}}}catch(r){return console.debug("Canvas renderer constructor/addon load unavailable for coarse pointer, falling back to DOM:",r),Qm(),{kind:"dom",dispose:()=>{},verify:async()=>{}}}}try{const r=new hx.WebglAddon;let c=null,d="webgl",f=!1;return r.onContextLoss(()=>{var p,m;if(!f){try{r.dispose()}catch{}try{c=new yu.CanvasAddon,o.loadAddon(c),d="canvas",(p=a.onRendererSwapped)==null||p.call(a,"canvas")}catch(b){console.debug("Canvas fallback failed after WebGL context loss:",b),d="dom",(m=a.onRendererSwapped)==null||m.call(a,"dom")}}}),o.loadAddon(r),{get kind(){return d},dispose:()=>{f=!0;for(const p of[c,r])try{p==null||p.dispose()}catch{}},verify:async()=>{}}}catch(r){console.debug("WebGL renderer unavailable, falling back to canvas:",r)}try{const r=new yu.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 Im(o,a){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,f=Math.max(0,o.width),p=Math.max(0,o.height),m=Math.round(f*c*100)/100,b=Math.round(p*c*100)/100;return{dpr:c,scale:d,cssWidth:f,cssHeight:p,physicalWidth:m,physicalHeight:b}}function Sx(o){const{lastSnapshot:a,currentSnapshot:r,physicalTolerancePx:c=6}=o;if(!a)return{shouldIgnore:!1,isVisualZoom:!1,reason:"initial"};const d=Math.abs(r.scale-a.scale)>.01,f=Math.abs(r.scale-1)>.01;if(d||f)return{shouldIgnore:!0,isVisualZoom:!0,reason:"visual_pinch_zoom"};if(Math.abs(r.dpr-a.dpr)>.01){const S=Math.abs(r.physicalWidth-a.physicalWidth),v=Math.abs(r.physicalHeight-a.physicalHeight);if(S<=c&&v<=c)return{shouldIgnore:!0,isVisualZoom:!0,reason:"dpr_zoom"}}const m=Math.abs(r.cssWidth-a.cssWidth),b=Math.abs(r.cssHeight-a.cssHeight);return m<1&&b<1?{shouldIgnore:!0,isVisualZoom:!1,reason:"no_box_change"}:{shouldIgnore:!1,isVisualZoom:!1,reason:"genuine_resize"}}const wx=" ()[]{}'\"\\`";function Jm(o,a,r,c=1){var k,I;if(!a||!((k=a.buffer)!=null&&k.active)||a.cols<=0||a.rows<=0)return null;const d=r||((I=a.element)==null?void 0:I.querySelector(".xterm-screen"))||a.element;if(!d||typeof d.getBoundingClientRect!="function")return null;const f=d.getBoundingClientRect(),p=Qp(o.clientX,o.clientY,f,c),m=ha(a);if(m.cellWidth<=0||m.cellHeight<=0)return null;const b=Math.max(1,f.width||a.cols*m.cellWidth),S=Math.max(1,f.height||a.rows*m.cellHeight),v=Math.max(0,Math.min(b-1,p.clientX-f.left)),C=Math.max(0,Math.min(S-1,p.clientY-f.top)),D=Math.max(0,Math.min(a.cols-1,Math.floor(v/m.cellWidth))),z=Math.max(0,Math.min(a.rows-1,Math.floor(C/m.cellHeight))),F=(a.buffer.active.viewportY??0)+z;return{col:D,bufferRow:F}}function Cx(o,a){if(!o||o.length===0||o==="\0")return!0;for(const r of o)if(r==="\0"||/\s/.test(r)||a.includes(r))return!0;return!1}function Tx(o,a,r){var D,z;if(!o||!((D=o.buffer)!=null&&D.active)||a<0||a>=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)??wx,f=new Array(o.cols).fill(null),p=Math.min(o.cols,c.length);let m=0;for(;m<p;){const _=c.getCell(m);if(!_){f[m]={startCol:m,endCol:m+1,isSeparator:!0},m++;continue}const F=_.getWidth();if(F===0){f[m]||(f[m]={startCol:m,endCol:m+1,isSeparator:!0}),m++;continue}const k=_.getChars(),I=Cx(k,d),ee=Math.min(o.cols,m+F),J={startCol:m,endCol:ee,isSeparator:I};for(let ae=m;ae<ee;ae++)f[ae]=J;m+=Math.max(1,F)}for(let _=p;_<o.cols;_++)f[_]||(f[_]={startCol:_,endCol:_+1,isSeparator:!0});const b=f[a];if(!b||b.isSeparator)return null;let S=b.startCol;for(;S>0;){const _=f[S-1];if(_&&!_.isSeparator)S=_.startCol;else break}let v=b.endCol;for(;v<o.cols;){const _=f[v];if(_&&!_.isSeparator)v=_.endCol;else break}const C=v-S;return C<=0?null:{startCol:S,length:C}}function Nx(o){var f;if(!o||!((f=o.buffer)!=null&&f.active))return"";const a=o.buffer.active,r=a.viewportY??0,c=o.rows,d=[];for(let p=0;p<c;p++){const m=a.getLine(r+p);d.push(m?m.translateToString(!0):"")}for(;d.length>0&&d[d.length-1]==="";)d.pop();return d.join(`
|
|
34
|
+
`)}const Wm=new Set(["│","┃","╎","╏","┆","┇","┊","┋","║","▏","▕","|"]),Ex=.6,Rx=new Set(["─","━","═","┄","┅","┈","┉","-"]),Ax=.8;function vu(o,a){if(!o)return!1;let r=0;const c=Math.min(a,o.length);for(let d=0;d<c;d++){const f=o.getCell(d);if(f){const p=f.getChars();p&&Rx.has(p)&&r++}}return r>=Math.max(5,Math.min(a*.25,10))}function xu(o,a,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,f=Math.max(0,Math.min(d-1,a)),p=c.viewportY??0,m=o.rows>0?o.rows:1,b=new Int32Array(d);let S=0;for(let _=0;_<m;_++){const F=c.getLine(p+_);if(S++,!F)continue;const k=Math.min(d,F.length);for(let I=0;I<k;I++){const ee=F.getCell(I);if(ee){const J=ee.getChars();J&&Wm.has(J)&&b[I]++}}}if(S===0)return{startCol:0,endCol:d-1};const v=S*Ex,C=_=>b[_]>=v;let D=!1;for(let _=0;_<d;_++)if(C(_)){D=!0;break}if(D){if(C(f))return{startCol:f,endCol:f};let _=-1;for(let k=f-1;k>=0;k--)if(C(k)){_=k;break}let F=d;for(let k=f+1;k<d;k++)if(C(k)){F=k;break}return{startCol:_+1,endCol:F-1}}if(r!==void 0){const _=Math.max(p,Math.min(p+m-1,r)),F=c.getLine(_);if(!vu(F,d)){let k=p;for(let J=_-1;J>=p;J--)if(vu(c.getLine(J),d)){k=J+1;break}let I=p+m-1;for(let J=_+1;J<=p+m-1;J++)if(vu(c.getLine(J),d)){I=J-1;break}const ee=I-k+1;if(ee>=2){const J=new Int32Array(d);for(let U=k;U<=I;U++){const R=c.getLine(U);if(!R)continue;const ne=Math.min(d,R.length);for(let je=0;je<ne;je++){const Me=R.getCell(je);if(Me){const Ee=Me.getChars();Ee&&Wm.has(Ee)&&J[je]++}}}const ae=ee*Ax,ye=U=>J[U]>=ae;let O=!1;for(let U=0;U<d;U++)if(ye(U)){O=!0;break}if(O){if(ye(f))return{startCol:f,endCol:f};let U=-1;for(let ne=f-1;ne>=0;ne--)if(ye(ne)){U=ne;break}let R=d;for(let ne=f+1;ne<d;ne++)if(ye(ne)){R=ne;break}return{startCol:U+1,endCol:R-1}}}}}return{startCol:0,endCol:d-1}}function Pm(o,a){const r=Math.min(o.startCol,o.endCol),c=Math.max(o.startCol,o.endCol),d=Math.min(o.startRow,o.endRow),f=Math.max(o.startRow,o.endRow);return{startCol:Math.max(a.startCol,Math.min(a.endCol,r)),endCol:Math.max(a.startCol,Math.min(a.endCol,c)),startRow:d,endRow:f}}function Su(o,a){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(a.startRow,a.endRow),f=Math.max(a.startRow,a.endRow),p=Math.max(0,Math.min(a.startCol,a.endCol)),m=Math.min(c-1,Math.max(a.startCol,a.endCol));if(p>m||d>f)return"";const b=[];for(let v=d;v<=f;v++){const C=r.getLine(v);if(!C){b.push("");continue}const D=C.translateToString(!0,p,m+1);b.push(D.trimEnd())}return b.join(`
|
|
35
|
+
`)}async function Ua(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 a=null,r=null,c=null;try{if(a=document.createElement("textarea"),a.style.userSelect="text",a.style.webkitUserSelect="text",a.style.position="fixed",a.style.top="0",a.style.left="0",a.style.width="1px",a.style.height="1px",a.style.padding="0",a.style.border="none",a.style.outline="none",a.style.boxShadow="none",a.style.background="transparent",a.style.opacity="0",a.style.fontSize="16px",a.setAttribute("readonly",""),a.setAttribute("aria-hidden","true"),a.value=o,typeof window<"u"&&typeof window.getSelection=="function"&&(c=window.getSelection(),c&&c.rangeCount>0&&(r=c.getRangeAt(0))),document.body.appendChild(a),typeof navigator<"u"&&(/iPad|iPhone|iPod/.test(navigator.userAgent||"")||navigator.platform==="MacIntel"&&(navigator.maxTouchPoints||0)>1)){const p=document.createRange();p.selectNodeContents(a),c&&(c.removeAllRanges(),c.addRange(p)),a.setSelectionRange(0,o.length)}else a.focus({preventScroll:!0}),a.select();if(document.execCommand("copy"))return"exec"}catch{}finally{a&&a.parentNode&&a.parentNode.removeChild(a),c&&(c.removeAllRanges(),r&&c.addRange(r))}}return"failed"}async function jx(){if(!(typeof window>"u"||window.isSecureContext!==!1)||typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.readText!="function")return{ok:!1,reason:"insecure"};try{const a=await navigator.clipboard.readText();return!a||a.length===0?{ok:!1,reason:"empty"}:{ok:!0,text:a}}catch(a){return typeof window<"u"&&window.isSecureContext===!1?{ok:!1,reason:"insecure"}:(a==null?void 0:a.name)==="SecurityError"?{ok:!1,reason:"insecure"}:{ok:!1,reason:"denied"}}}async function Mx(){if(!(typeof window>"u"||window.isSecureContext!==!1)||typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.read!="function")return{ok:!1,reason:"insecure"};try{const a=await navigator.clipboard.read();if(!a||a.length===0)return{ok:!1,reason:"empty"};for(const r of a){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(a){if(typeof window<"u"&&window.isSecureContext===!1)return{ok:!1,reason:"insecure"};const r=a==null?void 0:a.name;return r==="SecurityError"?{ok:!1,reason:"insecure"}:r==="NotAllowedError"?{ok:!1,reason:"denied"}:{ok:!1,reason:"empty"}}}function Jp(o){const a=o.clipboardData;if(!a)return null;if(a.files&&a.files.length>0)for(let r=0;r<a.files.length;r++){const c=a.files[r];if(c&&c.type.startsWith("image/"))return c}if(a.items&&a.items.length>0)for(let r=0;r<a.items.length;r++){const c=a.items[r];if(c&&c.type.startsWith("image/")){const d=c.getAsFile();if(d)return d}}return null}function _x(o){if(!o||o.length===0)return null;for(let a=0;a<o.length;a++){const r=o[a];if(r&&(r.type.startsWith("image/")||/\.(png|jpe?g|webp|gif)$/i.test(r.name)))return r}return null}const Nr="tui-focusable group flex h-11 w-full select-none items-center gap-2 border px-2 text-left text-tui transition-colors",Er="border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",kx=({anchorPoint:o,hasSelection:a,isController:r,vibrateOnKeyPress:c=!1,onCopySelection:d,onCopyLine:f,onCopyScreen:p,onPaste:m,onClose:b})=>{const{t:S}=Ct(),v=y.useRef(null),[C,D]=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 I=k.parentElement.getBoundingClientRect(),ee=k.getBoundingClientRect(),J=ee.width||208,ae=ee.height||220,ye=I.width,O=I.height;let U=o.x-J/2;U=Math.max(8,Math.min(Math.max(8,ye-J-8),U));let R=o.y-ae-8;R<8&&(R=o.y+8),R=Math.max(8,Math.min(Math.max(8,O-ae-8),R)),D({x:U,y:R})},[o.x,o.y,a,r]);const z=Math.max(8,o.x-104),_=Math.max(8,o.y-200),F={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:F,onMouseDown:k=>k.stopPropagation(),onTouchStart:k=>k.stopPropagation(),onPointerDown:k=>k.stopPropagation(),children:u.jsxs(rn,{tone:"accent",className:"border border-tui-border bg-tui-base p-1.5 shadow-lg",bodyClassName:"flex flex-col gap-1",children:[a&&u.jsxs("button",{type:"button",role:"menuitem",className:P(Nr,Er),onClick:()=>{d(),b()},children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ge.cursor}),u.jsx("span",{className:"truncate",children:S("clipboard.copySelection")})]}),u.jsxs("button",{type:"button",role:"menuitem",className:P(Nr,Er),onClick:()=>{f(),b()},children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ge.cursor}),u.jsx("span",{className:"truncate",children:S("clipboard.copyLine")})]}),u.jsxs("button",{type:"button",role:"menuitem",className:P(Nr,Er),onClick:()=>{p(),b()},children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ge.cursor}),u.jsx("span",{className:"truncate",children:S("clipboard.copyScreen")})]}),r&&u.jsxs("button",{type:"button",role:"menuitem",className:P(Nr,Er),onClick:()=>{m(),b()},children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ge.cursor}),u.jsx("span",{className:"truncate",children:S("clipboard.paste")})]}),u.jsxs("button",{type:"button",role:"menuitem",className:P(Nr,Er),onClick:b,children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ge.cursor}),u.jsx("span",{className:"truncate",children:S("clipboard.cancel")})]})]})})},zx=({isOpen:o,onClose:a,onSend:r,onSendImage:c})=>{const{t:d,addToast:f}=Ct(),[p,m]=y.useState(""),[b,S]=y.useState(null),[v,C]=y.useState(!1),D=y.useRef(null),z=y.useRef(null),_=y.useRef(null);y.useEffect(()=>{o&&(m(""),S(null),C(!1),D.current&&(D.current.value=""),z.current&&(z.current.value=""))},[o]);const F=async O=>{if(O.size===0){f("error",d("clipboard.fileEmpty"));return}C(!0);try{const U=await Ep(O);U?(S(U),m("")):f("error",d("clipboard.imageTooLarge"))}catch(U){console.error("Failed to process image:",U),f("error",d("clipboard.imageTooLarge"))}finally{C(!1)}},k=async O=>{const U=Jp(O);U&&(O.preventDefault(),await F(U))},I=async O=>{const U=_x(O.target.files);O.target.value="",U&&await F(U)},ee=O=>{const U=O.target.value;m(U),U&&b&&S(null)},J=()=>{S(null),D.current&&(D.current.value=""),z.current&&(z.current.value="")},ae=()=>{b?(c==null||c(b),a()):p.trim()&&(r(p),a())},ye=!!(p.trim()||b);return u.jsx(Ku,{isOpen:o,onClose:a,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(He,{variant:"ghost",onClick:a,children:d("clipboard.cancel")}),u.jsx(He,{variant:"primary",onClick:ae,disabled:!ye||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:p,onChange:ee,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:D,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",className:"hidden","data-testid":"paste-fallback-file-input",onChange:I}),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:I}),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:Iy(b.byteLength)})}),u.jsx(He,{variant:"ghost",onClick:J,"aria-label":d("clipboard.removeImage"),children:d("clipboard.cancel")})]})]}):u.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[u.jsx(He,{variant:"default",onClick:()=>{var O;return(O=D.current)==null?void 0:O.click()},disabled:v||!!p.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(He,{variant:"default",onClick:()=>{var O;return(O=z.current)==null?void 0:O.click()},disabled:v||!!p.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")})})]})]})})},Dx=[[4352,4447],[11904,12350],[12353,13311],[13312,19903],[19968,40959],[40960,42191],[43360,43391],[44032,55203],[63744,64255],[65040,65049],[65072,65135],[65280,65376],[65504,65510]],Ox=[[161,767],[880,1023],[1024,1327]];function $m(o){return o.buffer.active.type==="alternate"}function ep(o,a){for(const[r,c]of a){if(o>=r&&o<=c)return!0;if(o<r)return!1}return!1}function Lx(o){return o>=32&&o<=126?1:o<160||o>65535?null:ep(o,Dx)?2:ep(o,Ox)?1:null}class Ux{constructor(a){Se(this,"getTerminal");Se(this,"now");Se(this,"textDecoder",new TextDecoder("utf-8"));Se(this,"state","tentative");Se(this,"predictions",[]);Se(this,"predictedCursor",null);Se(this,"srtt",null);Se(this,"isSuppressed",!1);Se(this,"suppressCursor",null);Se(this,"suppressSentAt",0);Se(this,"lineStartCursor",null);this.getTerminal=a.getTerminal,this.now=a.now??(typeof performance<"u"&&typeof performance.now=="function"?()=>performance.now():()=>Date.now())}handleUserInput(a){if(this.pruneExpired(),a.length===0)return;const r=this.textDecoder.decode(a,{stream:!1});if(!r)return;const c=this.getTerminal();if(!c){this.reset("terminal unavailable",!0);return}if($m(c)){this.reset("alternate buffer",!0);return}for(const d of r){const f=d.codePointAt(0);if(f===void 0)continue;if(f===10||f===13){this.handleLineFeed(c);return}if(f===27||f===9||f<32&&f!==8){this.reset("control or escape sequence",!0);return}if(f===8||f===127){this.handleBackspace(c);continue}const p=Lx(f);if(p===null){this.reset("character of unknown width",!0);return}this.handlePrintable(d,p,c)}}onServerOutput(){const a=this.getTerminal();if(a&&$m(a)){this.predictions=[],this.predictedCursor=null,this.lineStartCursor=null;return}if(this.isSuppressed){const d=this.getTerminal(),f=Math.max(300,(this.srtt??300)*1.5),p=this.now()-this.suppressSentAt>=f;let m=!1;if(d&&this.suppressCursor){const b=d.buffer.active.baseY+d.buffer.active.cursorY,S=d.buffer.active.cursorX;m=b!==this.suppressCursor.row||S!==this.suppressCursor.col}(m||p)&&(this.isSuppressed=!1,this.suppressCursor=null,this.lineStartCursor=null)}if(this.pruneExpired(),this.predictions.length===0)return;const r=this.getTerminal();if(!r)return;const c=[];for(let d=0;d<this.predictions.length;d++){const f=this.predictions[d],p=r.buffer.active.getLine(f.row),m=p?p.getCell(f.col):void 0,b=m?m.getChars():"";if(b===f.charBefore)c.push(f);else if(b===f.char){const S=Math.max(0,this.now()-f.sentAt);this.updateSrtt(S),this.state="confident"}else{this.predictions=[],this.predictedCursor=null,this.lineStartCursor=null,this.state="tentative",this.isSuppressed=!1,this.suppressCursor=null;return}}this.predictions=c}reset(a,r){if(this.predictions=[],this.predictedCursor=null,this.lineStartCursor=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(a=>({row:a.row,col:a.col,char:a.char,width:a.width}))}getPredictedCursor(){return this.pruneExpired(),this.predictedCursor??this.lineStartCursor}getVisibleCursor(){if(this.state!=="confident")return null;const a=this.getPredictedCursor();if(!a)return null;const r=this.getTerminal();if(!r)return null;const c=r.buffer.active.baseY+r.buffer.active.cursorY,d=r.buffer.active.cursorX;return a.row===c&&a.col===d||a.col<0||a.col>=r.cols||a.row<r.buffer.active.baseY||a.row>=r.buffer.active.baseY+r.rows?null:a}getState(){return this.state}getBufferType(){var a;return((a=this.getTerminal())==null?void 0:a.buffer.active.type)??null}getEchoSrttMs(){return this.srtt}handleLineFeed(a){const r=a.buffer.active.baseY+a.buffer.active.cursorY;this.reset("line feed",!0),!(r+1>=a.buffer.active.baseY+a.rows)&&(this.lineStartCursor={row:r+1,col:0})}handlePrintable(a,r,c){if(this.isSuppressed){const m=Math.max(300,(this.srtt??300)*1.5);if(this.now()-this.suppressSentAt>=m)this.isSuppressed=!1,this.suppressCursor=null,this.lineStartCursor=null;else return}if(this.predictedCursor||(this.predictedCursor={row:c.buffer.active.baseY+c.buffer.active.cursorY,col:c.buffer.active.cursorX}),this.predictedCursor.col+r>=c.cols){this.reset("cursor would reach or exceed column boundary",!0);return}const d=c.buffer.active.getLine(this.predictedCursor.row),f=d?d.getCell(this.predictedCursor.col):void 0,p=f?f.getChars():"";this.predictions.push({row:this.predictedCursor.row,col:this.predictedCursor.col,char:a,charBefore:p,width:r,sentAt:this.now()}),this.predictedCursor.col+=r}handleBackspace(a){if(this.predictedCursor&&this.predictions.length>0){const r=this.predictions[this.predictions.length-1];if(r.row===this.predictedCursor.row&&r.col===this.predictedCursor.col-r.width){this.predictions.pop(),this.predictedCursor.col-=r.width;return}}this.predictErase(a)||this.reset("backspace into server content",!0)}predictErase(a){if(this.isSuppressed)return!1;const r=this.predictedCursor??{row:a.buffer.active.baseY+a.buffer.active.cursorY,col:a.buffer.active.cursorX};if(r.col<=0)return!1;const c=a.buffer.active.getLine(r.row);if(!c)return!1;const d=c.getCell(r.col-1);if(!d)return!1;const f=d.getChars(),p=typeof d.getWidth=="function"?d.getWidth():void 0;if(p===0){if(r.col-2<0)return!1;const m=c.getCell(r.col-2),b=(m==null?void 0:m.getChars())??"";return b?(this.pushErase(r.row,r.col-2,b,2),this.predictedCursor={row:r.row,col:r.col-2},!0):!1}return!f||p!==void 0&&p!==1?!1:(this.pushErase(r.row,r.col-1,f,1),this.predictedCursor={row:r.row,col:r.col-1},!0)}pushErase(a,r,c,d){this.predictions.push({row:a,col:r,char:" ",charBefore:c,width:d,sentAt:this.now()})}pruneExpired(){if(this.predictions.length===0)return;const a=this.now(),r=[];for(const c of this.predictions)a-c.sentAt<=1500&&r.push(c);r.length!==this.predictions.length&&(this.predictions=r,this.predictions.length===0&&(this.predictedCursor=null))}updateSrtt(a){this.srtt===null?this.srtt=a:this.srtt=this.srtt*.8+a*.2}}const tp="cursor";class Bx{constructor(a){Se(this,"options");Se(this,"activeDecorations",new Map);Se(this,"appliedStyles",new WeakMap);this.options=a}sync(a,r){var f;const c=this.options.getTerminal();if(!c){this.clear();return}if(a.length===0&&!r){this.clear();return}if(typeof c.registerMarker!="function"||typeof c.registerDecoration!="function"||!((f=c.buffer)!=null&&f.active)){this.clear();return}if(c.buffer.active.type==="alternate"){this.clear();return}const d=new Set;for(const p of a){const m=`${p.row}:${p.col}`;d.add(m),this.mount(c,m,p.row,p.col,p.char,p.width??1,!1)}r&&(d.add(tp),this.mount(c,tp,r.row,r.col," ",1,!0));for(const[p,m]of this.activeDecorations)d.has(p)||(this.disposeEntry(m),this.activeDecorations.delete(p))}mount(a,r,c,d,f,p,m){var S;const b=this.activeDecorations.get(r);if(b){if(b.char===f&&b.isCursor===m&&b.row===c&&b.col===d){b.decoration.element&&this.applyStyleToElement(b.decoration.element,b.char,m);return}this.disposeEntry(b),this.activeDecorations.delete(r)}try{const v=a.buffer.active.baseY+a.buffer.active.cursorY,C=c-v,D=a.registerMarker(C);if(!D||D.isDisposed||D.line===-1)return;const z={marker:D,anchor:"left",x:d,width:Math.max(1,p),height:1,layer:"top"},_=a.registerDecoration(z);if(!_||_.isDisposed){try{D.dispose()}catch{}return}_.element&&this.applyStyleToElement(_.element,f,m),_.onRender(F=>{this.applyStyleToElement(F,f,m)}),(S=D.onDispose)==null||S.call(D,()=>{this.activeDecorations.delete(r)}),this.activeDecorations.set(r,{decoration:_,marker:D,char:f,isCursor:m,row:c,col:d})}catch(v){console.debug("Failed to create prediction decoration:",v)}}clear(){for(const a of this.activeDecorations.values())this.disposeEntry(a);this.activeDecorations.clear()}dispose(){this.clear()}applyStyleToElement(a,r,c=!1){const d=this.options.getStyle(),f=c?d.background:d.color,p=c?d.cursorColor??d.color:d.background,m=!c&&d.underline?"underline":"none",b=`${r}\0${f??""}\0${p??""}\0${m}`;this.appliedStyles.get(a)!==b&&(this.appliedStyles.set(a,b),a.textContent=r,a.style.pointerEvents="none",a.style.userSelect="none",f&&(a.style.color=f),p&&(a.style.backgroundColor=p),a.style.textDecoration=m,a.style.fontFamily="inherit",a.style.fontSize="inherit",a.style.overflow="hidden",a.style.whiteSpace="pre")}disposeEntry(a){try{a.decoration.dispose()}catch{}try{a.marker.dispose()}catch{}}}const np=120,Hx=400;class Yx{constructor(a){Se(this,"options");Se(this,"state","idle");Se(this,"layer",null);Se(this,"content",null);Se(this,"releaseTimer",null);Se(this,"fadeTimer",null);this.options=a}getState(){return this.state}isActive(){return this.state!=="idle"}capture(){this.dispose();const a=this.options.getFrameElement(),r=this.options.getScreenElement();if(!a||!r)return!1;const c=this.options.getRendererKind();if(c==="webgl")return!1;const d=c==="dom"?this.cloneScreen(r):this.compositeCanvases(r);if(!d)return!1;const f=document.createElement("div");f.dataset.testid="terminal-scroll-snapshot",f.setAttribute("aria-hidden","true"),f.style.position="absolute",f.style.inset="0",f.style.overflow="hidden",f.style.pointerEvents="none",f.style.userSelect="none",f.style.zIndex="10",f.style.opacity="1",f.style.transition=`opacity ${np}ms linear`;const p=this.options.getBackgroundColor();return p&&(f.style.backgroundColor=p),d.style.position="absolute",d.style.top="0",d.style.left="0",d.style.width="100%",d.style.height="100%",d.style.willChange="transform",d.style.transform="translateY(0px)",f.appendChild(d),a.appendChild(f),this.layer=f,this.content=d,this.state="tracking",!0}translateRows(a){if(!this.content||this.state!=="tracking")return;const r=this.options.getRowHeight();!Number.isFinite(r)||r<=0||(this.content.style.transform=`translateY(${a*r}px)`)}release(){this.state==="tracking"&&(this.state="releasing",this.clearReleaseTimer(),this.releaseTimer=setTimeout(()=>{this.releaseTimer=null,this.beginFade()},Hx))}settle(){this.state==="releasing"&&(this.clearReleaseTimer(),this.beginFade())}dispose(){var a;this.clearReleaseTimer(),this.clearFadeTimer(),(a=this.layer)!=null&&a.parentNode&&this.layer.parentNode.removeChild(this.layer),this.layer=null,this.content=null,this.state="idle"}beginFade(){if(!this.layer){this.dispose();return}this.state="fading",this.layer.style.opacity="0",this.clearFadeTimer(),this.fadeTimer=setTimeout(()=>{this.fadeTimer=null,this.dispose()},np)}clearReleaseTimer(){this.releaseTimer&&(clearTimeout(this.releaseTimer),this.releaseTimer=null)}clearFadeTimer(){this.fadeTimer&&(clearTimeout(this.fadeTimer),this.fadeTimer=null)}compositeCanvases(a){const r=Array.from(a.querySelectorAll("canvas"));if(r.length===0)return null;const c=r[0].width,d=r[0].height;if(!(c>0)||!(d>0))return null;const f=document.createElement("canvas");f.width=c,f.height=d;let p=null;try{p=f.getContext("2d")}catch{return null}if(!p)return null;try{for(const m of r)m.width<=0||m.height<=0||p.drawImage(m,0,0,c,d)}catch{return null}return f.style.display="block",f}cloneScreen(a){let r;try{r=a.cloneNode(!0)}catch{return null}return r.removeAttribute("id"),r.setAttribute("aria-hidden","true"),r}}const Kx=40,Gx=.45;function lp(o,a){return o==="off"?!1:o==="always"?!0:a!==null&&a>Kx}const qx=250,Vx=({onTerminalFocus:o,isActive:a=!0})=>{var il,qa,bl,yl,Yl;const r=y.useRef(null),c=y.useRef(null),d=y.useRef(null),f=y.useRef(null),p=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),D=y.useRef({width:0,height:0}),z=y.useRef(null),_=_y(),F=_||typeof navigator<"u"&&navigator.maxTouchPoints>0||typeof window<"u"&&"ontouchstart"in window,k=typeof window<"u"&&new URLSearchParams(window.location.search).get("debug")==="1",[I,ee]=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}),[J,ae]=y.useState({framesPerSec:0,bytesPerSec:0}),[ye,O]=y.useState(null),U=y.useRef(null),R=y.useRef(!1),ne=y.useRef(!1),je=y.useRef([]);y.useEffect(()=>{if(!k)return;const X=setInterval(()=>{const de=performance.now()-1e3,ge=je.current;for(;ge.length>0&&ge[0].time<de;)ge.shift();let Ie=0;for(let le=0;le<ge.length;le++)Ie+=ge[le].bytes;ae({framesPerSec:ge.length,bytesPerSec:Ie})},1e3);return()=>clearInterval(X)},[k]);const{isController:Me,connectionState:Ee,settings:fe,hostPalette:ke,terminalResetVersion:Oe,sendResize:j,sendBinary:q,addToast:W,warnViewerMode:Ce,connect:H,subscribeToOutput:qe,registerInputObserver:Z,subscribeToPasteFileReady:pe,uploadImage:ze,t:ve,rttMs:me}=Ct(),St=dl.useMemo(()=>qy(ke),[ke]),Le=y.useRef(St);Le.current=St;const we=y.useRef(Me);we.current=Me;const ut=y.useRef(q);ut.current=q;const nt=y.useRef(W);nt.current=W;const ht=y.useRef(Ce);ht.current=Ce;const Ht=y.useRef(j);Ht.current=j;const gt=y.useRef(ze);gt.current=ze;const zn=y.useRef(a);zn.current=a;const Dn=y.useRef(fe);Dn.current=fe;const _t=y.useRef(ve);_t.current=ve;const sn=y.useRef(Z);sn.current=Z;const On=y.useRef(()=>{}),kt=y.useRef(()=>{}),Fe=y.useRef(null),Vt=y.useRef(null),Yt=y.useRef(null),$=y.useRef(null),Re=y.useCallback(X=>{const Q=f.current;if(!Q){$.current=null;return}if(X){$.current===null&&($.current=Q.options.cursorStyle??"block"),Q.options.cursorStyle!=="underline"&&(Q.options.cursorStyle="underline");return}$.current!==null&&(Q.options.cursorStyle=$.current,$.current=null)},[]),Ke=y.useCallback(()=>{var X;(X=Vt.current)==null||X.clear(),Re(!1)},[Re]);On.current=Re,kt.current=Ke;const We=y.useRef(null),[et,hn]=y.useState(null),mt=y.useRef(null);mt.current=et;const[At,Qt]=y.useState(null),tn=y.useRef(null);tn.current=At;const[lt,zt]=y.useState(""),wt=y.useRef("");wt.current=lt;const[Ha,mn]=y.useState(!1),Ya=y.useRef(!1);Ya.current=Ha;const Ln=y.useRef(!1),[fl,hl]=y.useState(0),It=y.useRef(null),on=y.useRef(null),pn=y.useRef(null),ml=y.useRef(null),[Ka,Bl]=y.useState(!1),ll=y.useCallback(X=>{var Ie;const Q=f.current;if(!Q)return;const de=((Ie=d.current)==null?void 0:Ie.querySelector(".xterm-screen"))||d.current,ge=Jm(X,Q,de,p.current);if(ge){pn.current=ge;const le=xu(Q,ge.col,ge.bufferRow);ml.current=le;const nn=Tx(Q,ge.col,ge.bufferRow);if(nn){const Jt={startCol:nn.startCol,endCol:nn.startCol+nn.length-1,startRow:ge.bufferRow,endRow:ge.bufferRow},Dt=Pm(Jt,le),at=Su(Q,Dt);Qt(Dt),zt(at),mn(!0)}else Qt(null),zt(""),mn(!1),pn.current=null,ml.current=null}else Qt(null),zt(""),mn(!1),pn.current=null,ml.current=null;It.current=X,on.current=null},[]),Hl=y.useCallback(X=>{var at;const Q=f.current,de=pn.current;if(!Q||!de)return;on.current=X;const ge=((at=d.current)==null?void 0:at.querySelector(".xterm-screen"))||d.current,Ie=Jm(X,Q,ge,p.current);if(!Ie)return;const le=ml.current??xu(Q,de.col,de.bufferRow),nn={startCol:Math.min(de.col,Ie.col),endCol:Math.max(de.col,Ie.col),startRow:Math.min(de.bufferRow,Ie.bufferRow),endRow:Math.max(de.bufferRow,Ie.bufferRow)},Jt=Pm(nn,le),Dt=Su(Q,Jt);Qt(Jt),zt(Dt),mn(!0)},[]),pl=y.useRef(ll);pl.current=ll;const gl=y.useRef(Hl);gl.current=Hl;const Ga=y.useCallback(async()=>{const X=wt.current;if(!X)return;await Ua(X)==="failed"?nt.current("error",_t.current("clipboard.copyFailed")):nt.current("success",_t.current("clipboard.copied"))},[]),L=y.useCallback(async()=>{var Jt,Dt,at,ln;const X=f.current;if(!X)return;const Q=(Jt=X.buffer)==null?void 0:Jt.active;if(!Q)return;const de=((Dt=tn.current)==null?void 0:Dt.startRow)??((at=pn.current)==null?void 0:at.bufferRow)??Q.viewportY,ge=ml.current??xu(X,((ln=pn.current)==null?void 0:ln.col)??0,de),Ie={startCol:ge.startCol,endCol:ge.endCol,startRow:de,endRow:de},le=Su(X,Ie);await Ua(le)==="failed"?nt.current("error",_t.current("clipboard.copyFailed")):nt.current("success",_t.current("clipboard.copied"))},[]),Y=y.useCallback(async()=>{const X=f.current;if(!X)return;const Q=Nx(X);await Ua(Q)==="failed"?nt.current("error",_t.current("clipboard.copyFailed")):nt.current("success",_t.current("clipboard.copied"))},[]),ie=y.useCallback(async()=>{var Q;const X=f.current;if(X){if(!we.current){ht.current();return}try{const de=await Mx();if(de.ok){await gt.current(de.blob);return}}catch{}try{const de=await jx();if(de.ok){(Q=Fe.current)==null||Q.reset("paste"),kt.current(),X.paste(de.text),nt.current("success",_t.current("clipboard.pasted"));return}else if(de.reason==="empty"){nt.current("info",_t.current("clipboard.pasteUnavailable"));return}}catch{}Bl(!0)}},[]),Ae=y.useCallback(X=>{var de;const Q=f.current;if(Q){if(!we.current){ht.current();return}(de=Fe.current)==null||de.reset("paste"),kt.current(),Q.paste(X),nt.current("success",_t.current("clipboard.pasted"))}},[]),xe=y.useCallback(X=>{if(f.current){if(!we.current){ht.current();return}gt.current(X)}},[]);y.useEffect(()=>pe(Q=>{var ge;const de=f.current;de&&((ge=Fe.current)==null||ge.reset("paste"),kt.current(),de.paste(Q),nt.current("success",_t.current("clipboard.pasted")))}),[pe]);const he=y.useCallback((X,Q)=>{!Number.isFinite(X)||!Number.isFinite(Q)||X<=0||Q<=0||X===m.current.cols&&Q===m.current.rows||(b.current={cols:X,rows:Q},!S.current&&(S.current=setTimeout(()=>{var ge;S.current=null;const de=b.current;b.current=null,de&&(de.cols===m.current.cols&&de.rows===m.current.rows||(m.current=de,Ht.current(de.cols,de.rows),(ge=Fe.current)==null||ge.reset("resize"),kt.current()))},qx)))},[]),_e=y.useCallback((X=!1)=>{var cn;const Q=f.current,de=r.current,ge=d.current,Ie=c.current;if(!Q||!de||!ge||!Ie)return;const le=bu(de,Ri(),mu());if(le.width<=0||le.height<=0)return;Ie.style.width="100%",Ie.style.height="100%",ge.style.width="100%",ge.style.height="100%",ge.style.transform="none",ge.style.transformOrigin="top left",p.current=1;const nn=Im(le),Jt=Sx({lastSnapshot:z.current,currentSnapshot:nn});if(Jt.isVisualZoom&&!X){z.current=nn;try{Q.refresh(0,Math.max(0,Q.rows-1))}catch{}return}if(Jt.shouldIgnore&&!X)return;z.current=nn;const Dt=ha(Q,Mi),at=Fm({width:le.width-ux(ge),height:le.height,cellWidth:Dt.cellWidth,cellHeight:Dt.cellHeight}),ln=Math.abs(le.width-D.current.width)>1||Math.abs(le.height-D.current.height)>1;if(Q.cols!==at.cols||Q.rows!==at.rows)try{Q.resize(at.cols,at.rows)}catch(Kt){console.debug("Error resizing terminal grid:",Kt)}R.current&&!ne.current&&(ln||Q.cols!==at.cols||Q.rows!==at.rows)&&(ne.current=!0,(cn=U.current)==null||cn.verify());const Wn=at.cols!==m.current.cols||at.rows!==m.current.rows;zn.current&&(ln||X||Wn)&&(D.current={width:le.width,height:le.height},he(at.cols,at.rows));try{Q.refresh(0,Math.max(0,Q.rows-1))}catch{}},[he]),Tt=y.useRef(_e);Tt.current=_e;const bt=y.useCallback(()=>{if(v.current===null){if(typeof requestAnimationFrame!="function"){Tt.current();return}v.current=requestAnimationFrame(()=>{v.current=null,Tt.current()})}},[]),Un=y.useCallback((X=30)=>{C.current!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(C.current),C.current=null);let Q=0;const de=()=>{C.current=null,Q++;const ge=Q>=X;Tt.current(!0),!ge&&Q<2&&typeof requestAnimationFrame=="function"&&(C.current=requestAnimationFrame(de))};typeof requestAnimationFrame=="function"?C.current=requestAnimationFrame(de):de()},[]);y.useEffect(()=>{var Hn,Qa,Ia;if(!r.current||!d.current)return;const X=r.current,Q=bu(X,Ri(),mu()),de=ha(null,Mi),ge=Fm({width:Q.width,height:Q.height,cellWidth:de.cellWidth,cellHeight:de.cellHeight});Ht.current(ge.cols,ge.rows),D.current={width:Q.width,height:Q.height},z.current=Im(Q);const Ie=Am(fe.fontSize,Q.width),le=new ax.Terminal({fontSize:Ie,fontFamily:Om(fe.fontFamily),lineHeight:1.15,...Le.current?{theme:{...Le.current}}:{},allowProposedApi:!0,convertEol:!0,scrollback:5e3,cols:ge.cols,rows:ge.rows,screenReaderMode:!1});try{const V=new ix.Unicode11Addon;le.loadAddon(V),le.unicode.activeVersion="11"}catch(V){console.debug("Unicode11 addon unavailable, using default width table:",V)}le.open(d.current),f.current=le;const nn=new Ux({getTerminal:()=>f.current});Fe.current=nn;const Jt=new Bx({getTerminal:()=>f.current,getStyle:()=>{var Ft,an,ce,pt,dt,Nt,yn,dn,ga;const V=((Ft=Le.current)==null?void 0:Ft.foreground)??((ce=(an=f.current)==null?void 0:an.options.theme)==null?void 0:ce.foreground),te=((pt=Le.current)==null?void 0:pt.background)??((Nt=(dt=f.current)==null?void 0:dt.options.theme)==null?void 0:Nt.background),Be=Vy(V,te,Gx)??V,Xt=((yn=Le.current)==null?void 0:yn.cursor)??((ga=(dn=f.current)==null?void 0:dn.options.theme)==null?void 0:ga.cursor)??V;return{color:Be,background:te,underline:!0,cursorColor:Xt}}});Vt.current=Jt;const Dt=()=>{const V=Fe.current,te=Vt.current;if(!V||!te)return;const Be=Dn.current.predictiveEcho,Xt=V.getEchoSrttMs();if(!lp(Be,Xt)){kt.current();return}const Ft=V.getVisibleCursor();te.sync(V.getVisiblePredictions(),Ft),On.current(Ft!==null)};let at=null,ln=!1;const Wn=()=>{if(at!==null){ln=!0;return}Dt(),typeof requestAnimationFrame=="function"&&(at=requestAnimationFrame(()=>{at=null,ln&&(ln=!1,Dt())}))};_&&le.textarea&&(le.textarea.readOnly=!1,le.textarea.tabIndex=0,le.textarea.inputMode="text");let cn=()=>{};if(k&&le.textarea){const V=()=>{ee(te=>({...te,focused:document.activeElement===le.textarea}))};le.textarea.addEventListener("focus",V),le.textarea.addEventListener("blur",V),cn=()=>{var te,Be;(te=le.textarea)==null||te.removeEventListener("focus",V),(Be=le.textarea)==null||Be.removeEventListener("blur",V)},V()}const Kt=async V=>{var Be;(Be=Fe.current)==null||Be.reset("paste"),kt.current();const te=Jp(V);if(te){if(V.preventDefault(),V.stopPropagation(),!we.current){ht.current();return}await gt.current(te)}};(Hn=le.textarea)==null||Hn.addEventListener("paste",Kt),X.addEventListener("paste",Kt);const Kl=xx(le,{coarsePointer:_,onRendererSwapped:V=>{X&&(X.dataset.renderer=V),O(V);try{le.refresh(0,Math.max(0,le.rows-1))}catch{}}});U.current=Kl,X&&(X.dataset.renderer=Kl.kind),O(Kl.kind);const so=_t.current("terminal.bannerTitle"),_i=_t.current("terminal.bannerSubtitle");if(le.writeln(" ___ ___ .___ "),le.writeln(` / | \\ ____ _______| _/______ \x1B[1m${so}\x1B[0m`),le.writeln(`/ ~ \\/ __ \\\\_ __ \\ __/ ___/ \x1B[2m${_i}\x1B[0m`),le.writeln("\\ Y / ___/ | | \\/|_ \\___ \\ "),le.writeln(" \\___|_ / \\___ >|__| /___/____ >"),le.writeln(" \\/ \\/ \\/ "),le.writeln(""),R.current=!0,Kl.verify(),!_)try{le.focus()}catch{}typeof document<"u"&&"fonts"in document&&typeof((Qa=document.fonts)==null?void 0:Qa.load)=="function"&&document.fonts.load('13px "Symbols Nerd Font Mono"').then(()=>{if(f.current){try{f.current.refresh(0,Math.max(0,f.current.rows-1))}catch{}Un(5)}}).catch(()=>{});const Br=le.onData(V=>{var Be;const te=Mu(V);if(!we.current&&!Dr(te)){ht.current();return}ut.current(te),(Be=Fe.current)==null||Be.handleUserInput(te),Dt()}),Va=sn.current(V=>{var te;(te=Fe.current)==null||te.handleUserInput(V),Dt()}),oo=le.onBinary(V=>{const te=new Uint8Array(V.length);for(let Be=0;Be<V.length;Be++)te[Be]=V.charCodeAt(Be)&255;!we.current&&!Dr(te)||ut.current(te)}),bn=typeof le.onWriteParsed=="function"?le.onWriteParsed(()=>{var V,te;Ln.current=!0,(V=Fe.current)==null||V.onServerOutput(),Wn(),(te=Yt.current)==null||te.settle()}):{dispose:()=>{}},ki=typeof le.onRender=="function"?le.onRender(V=>{const te=le.buffer.active.viewportY??0;hl(te);const Be=tn.current;if(Be&&Ya.current){const Xt=Be.startRow-te,Ft=Be.endRow-te;Ln.current&&V.start<=Ft&&V.end>=Xt&&(mn(!1),Ln.current=!1)}else Ln.current=!1}):{dispose:()=>{}},Hr=typeof le.onScroll=="function"?le.onScroll(()=>{var te;const V=le.buffer.active.viewportY??0;hl(V),(te=Fe.current)==null||te.reset("scroll"),kt.current()}):{dispose:()=>{}},zi=typeof((Ia=le.buffer)==null?void 0:Ia.onBufferChange)=="function"?le.buffer.onBufferChange(()=>{var V;(V=Fe.current)==null||V.reset("buffer switch"),kt.current()}):{dispose:()=>{}},vl=new Yx({getFrameElement:()=>c.current,getScreenElement:()=>{var V;return((V=d.current)==null?void 0:V.querySelector(".xterm-screen"))??d.current},getRendererKind:()=>{var V;return((V=U.current)==null?void 0:V.kind)??"dom"},getRowHeight:()=>ha(f.current).cellHeight,getBackgroundColor:()=>{var V,te,Be;return((V=Le.current)==null?void 0:V.background)??((Be=(te=f.current)==null?void 0:te.options.theme)==null?void 0:Be.background)}});Yt.current=vl;const un=new fx({getTerminal:()=>f.current,getIsController:()=>we.current,getScale:()=>p.current,getSurfaceElement:()=>d.current,allowSyntheticMouseFallback:!1,onFocus:()=>{try{le.focus()}catch{}k&&ee(V=>({...V,focused:document.activeElement===le.textarea})),o==null||o()},onGestureStateChange:V=>{k&&ee(te=>({...te,state:V}))},onGestureScroll:({deltaY:V,lines:te,viewportY:Be,scrollTop:Xt,scrollHeight:Ft,clientHeight:an,moved:ce,bufferType:pt,baseY:dt,cursorY:Nt,hasScrollback:yn,mouseTracking:dn,scrollMode:ga})=>{k&&ee(ba=>({...ba,deltaY:V,lines:te,viewportY:Be,scrollTop:Xt,scrollHeight:Ft,clientHeight:an,moved:ce,focused:document.activeElement===le.textarea,bufferType:pt,baseY:dt,cursorY:Nt,hasScrollback:yn,mouseTracking:dn,scrollMode:ga,scrollCalls:ba.scrollCalls+(te!==0?1:0),lastScrollLines:te}))},onSnapshotScrollStart:()=>{var V;(V=Yt.current)==null||V.capture()},onSnapshotScrollMove:V=>{var te;(te=Yt.current)==null||te.translateRows(V)},onSnapshotScrollEnd:()=>{var V;(V=Yt.current)==null||V.release()},longPressDelayMs:500,dragThresholdPx:8,scrollLineHeightPx:18,onLongPress:_?(V=>{var te;return(te=pl.current)==null?void 0:te.call(pl,V)}):void 0,onSelectionExtend:_?(V=>{var te;return(te=gl.current)==null?void 0:te.call(gl,V)}):void 0}),Yr=typeof window<"u"&&"PointerEvent"in window,Gl=typeof TouchEvent<"u",pa=[],Bn=(V,te=!1)=>{const Be=V.target;return Be instanceof Node&&X.contains(Be)||te&&un.getState()!=="idle"};if(Yr){const V={passive:!1,capture:!0},te=ce=>{k&&ee(pt=>({...pt,pointerEvents:pt.pointerEvents+1,lastInputEvent:ce}))},Be=ce=>{if(!Bn(ce))return;if(te("pointerdown"),mt.current){hn(null),mt.current=null,Qt(null),tn.current=null,zt(""),wt.current="",mn(!1),It.current=null,on.current=null,ce.cancelable&&ce.preventDefault(),ce.stopPropagation();return}un.handlePointerDown(ce,X)&&ce.stopPropagation()},Xt=ce=>{Bn(ce,!0)&&(te("pointermove"),un.handlePointerMove(ce),ce.pointerType!=="mouse"&&ce.stopPropagation())},Ft=ce=>{if(!Bn(ce,!0))return;if(te("pointerup"),un.getState()==="longpress"&&We.current){const dt=on.current??It.current;if(dt){const Nt=We.current.getBoundingClientRect(),yn=dt.clientX-Nt.left,dn=dt.clientY-Nt.top;hn({x:yn,y:dn}),mt.current={x:yn,y:dn}}}un.handlePointerUp(ce),ce.pointerType!=="mouse"&&ce.stopPropagation()},an=ce=>{var pt;Bn(ce,!0)&&(te("pointercancel"),hn(null),mt.current=null,Qt(null),tn.current=null,zt(""),wt.current="",mn(!1),It.current=null,on.current=null,un.handlePointerCancel(ce),(pt=Yt.current)==null||pt.dispose(),ce.pointerType!=="mouse"&&ce.stopPropagation())};if(document.addEventListener("pointerdown",Be,V),document.addEventListener("pointermove",Xt,V),document.addEventListener("pointerup",Ft,V),document.addEventListener("pointercancel",an,V),pa.push(()=>{document.removeEventListener("pointerdown",Be,V),document.removeEventListener("pointermove",Xt,V),document.removeEventListener("pointerup",Ft,V),document.removeEventListener("pointercancel",an,V)}),Gl){const ce=dt=>{Bn(dt,!0)&&(k&&ee(Nt=>({...Nt,touchEvents:Nt.touchEvents+1})),dt.cancelable&&dt.preventDefault(),dt.stopPropagation())},pt=["touchstart","touchmove","touchend","touchcancel"];for(const dt of pt)document.addEventListener(dt,ce,V);pa.push(()=>{for(const dt of pt)document.removeEventListener(dt,ce,V)})}}else{const V={passive:!1,capture:!0},te=ce=>{k&&ee(pt=>({...pt,touchEvents:pt.touchEvents+1,lastInputEvent:ce}))},Be=ce=>{if(Bn(ce)){if(te("touchstart"),mt.current){hn(null),mt.current=null,Qt(null),tn.current=null,zt(""),wt.current="",mn(!1),It.current=null,on.current=null,ce.cancelable&&ce.preventDefault(),ce.stopPropagation();return}ce.touches.length===1&&ce.stopPropagation(),un.handleTouchStart(ce,X)}},Xt=ce=>{Bn(ce,!0)&&(te("touchmove"),ce.touches.length===1&&ce.stopPropagation(),un.handleTouchMove(ce))},Ft=ce=>{if(!Bn(ce,!0))return;if(te("touchend"),un.getState()==="longpress"&&We.current){const dt=on.current??It.current;if(dt){const Nt=We.current.getBoundingClientRect(),yn=dt.clientX-Nt.left,dn=dt.clientY-Nt.top;hn({x:yn,y:dn}),mt.current={x:yn,y:dn}}}ce.stopPropagation(),un.handleTouchEnd(ce)},an=ce=>{var pt;Bn(ce,!0)&&(te("touchcancel"),hn(null),mt.current=null,Qt(null),tn.current=null,zt(""),wt.current="",mn(!1),It.current=null,on.current=null,ce.stopPropagation(),un.handleTouchCancel(),(pt=Yt.current)==null||pt.dispose())};document.addEventListener("touchstart",Be,V),document.addEventListener("touchmove",Xt,V),document.addEventListener("touchend",Ft,V),document.addEventListener("touchcancel",an,V),pa.push(()=>{document.removeEventListener("touchstart",Be,V),document.removeEventListener("touchmove",Xt,V),document.removeEventListener("touchend",Ft,V),document.removeEventListener("touchcancel",an,V)})}const Di=V=>{V.preventDefault()};X.addEventListener("contextmenu",Di),pa.push(()=>{X.removeEventListener("contextmenu",Di)});const Xa=new ResizeObserver(()=>{bt()});Xa.observe(X);const Fa=()=>{bt()},Za=()=>{var V,te;if(document.visibilityState==="visible"){Un(10);try{(te=f.current)==null||te.refresh(0,Math.max(0,(((V=f.current)==null?void 0:V.rows)||1)-1))}catch{}}};window.addEventListener("resize",Fa),window.addEventListener("orientationchange",Fa),document.addEventListener("visibilitychange",Za),window.addEventListener("pageshow",Za);const xl=()=>{bt()};return typeof window<"u"&&window.visualViewport&&(window.visualViewport.addEventListener("resize",xl),window.visualViewport.addEventListener("scroll",xl)),()=>{var V,te;Br.dispose(),oo.dispose(),ki.dispose(),Hr.dispose(),bn.dispose(),zi.dispose(),Va(),at!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(at),at=null),On.current(!1),(V=Vt.current)==null||V.dispose(),Vt.current=null,Fe.current=null,vl.dispose(),Yt.current=null,un.handlePointerCancel();for(const Be of pa)Be();Xa.disconnect(),window.removeEventListener("resize",Fa),window.removeEventListener("orientationchange",Fa),document.removeEventListener("visibilitychange",Za),window.removeEventListener("pageshow",Za),typeof window<"u"&&window.visualViewport&&(window.visualViewport.removeEventListener("resize",xl),window.visualViewport.removeEventListener("scroll",xl)),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),cn(),(te=le.textarea)==null||te.removeEventListener("paste",Kt),X.removeEventListener("paste",Kt),Kl.dispose(),U.current=null,le.dispose(),f.current=null}},[]),y.useEffect(()=>{const X=f.current;if(!X)return;const Q=bu(r.current,Ri(),mu());X.options.fontSize=Am(fe.fontSize,Q.width),X.options.fontFamily=Om(fe.fontFamily);try{X.refresh(0,Math.max(0,X.rows-1))}catch{}Un(10)},[fe.fontSize,fe.fontFamily]),y.useEffect(()=>{const X=Fe.current,Q=Vt.current;if(!X||!Q)return;const de=X.getEchoSrttMs();if(!lp(fe.predictiveEcho,de))Ke();else{const ge=X.getVisibleCursor();Q.sync(X.getVisiblePredictions(),ge),Re(ge!==null)}},[fe.predictiveEcho,Ke,Re]);const al=y.useRef(Oe);y.useEffect(()=>{var Q,de,ge;if(al.current===Oe)return;al.current=Oe,(Q=Fe.current)==null||Q.reset("resetVersion"),kt.current(),(de=Yt.current)==null||de.dispose();const X=f.current;if(X)try{(ge=X.reset)==null||ge.call(X),X.clear(),X.refresh(0,Math.max(0,X.rows-1))}catch{}},[Oe]),y.useEffect(()=>{var X,Q;(X=Fe.current)==null||X.reset("connectionState"),kt.current(),(Q=Yt.current)==null||Q.dispose()},[Ee]),y.useEffect(()=>{const X=f.current;if(!(!X||!St)){X.options.theme={...St};try{X.refresh(0,Math.max(0,X.rows-1))}catch{}}},[St]),y.useEffect(()=>qe(Q=>{const de=f.current;if(!de)throw new Error("terminal not ready");if(de.write(Q),k){const ge=performance.now(),Ie=je.current;Ie.push({time:ge,bytes:Q.byteLength});const le=ge-1e3;for(;Ie.length>0&&Ie[0].time<le;)Ie.shift()}}),[qe,k]),y.useEffect(()=>{if(!a)return;Un(10);const X=f.current;if(X){try{X.refresh(0,Math.max(0,X.rows-1))}catch{}if(!_)try{X.focus()}catch{}}},[a,_,Un]),y.useEffect(()=>{Ee==="disconnected"&&H()},[]);const gn=X=>{X.preventDefault()};return u.jsxs("main",{ref:We,className:"flex-1 w-full min-w-0 min-h-0 overflow-hidden relative flex flex-col",onContextMenu:gn,"aria-label":ve("terminal.windowAriaLabel"),children:[u.jsx("div",{id:"terminal-container",ref:r,className:"absolute inset-0 overflow-hidden cursor-text",style:{touchAction:F?"none":"auto"},tabIndex:0,onContextMenu:gn,"aria-label":ve("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: ${I.state}
|
|
36
|
+
`,`deltaY: ${I.deltaY} lines: ${I.lines}
|
|
37
|
+
`,`viewportY: ${I.viewportY??"-"} focus: ${I.focused}
|
|
38
|
+
`,`buffer: ${I.bufferType??"-"} base: ${I.baseY??"-"} cursor: ${I.cursorY??"-"} scrollback: ${I.hasScrollback??"-"}
|
|
39
|
+
`,`scroll: ${I.scrollTop??"-"} / ${I.scrollHeight??"-"} (h ${I.clientHeight??"-"}) moved: ${I.moved}
|
|
40
|
+
`,`mode: ${I.scrollMode} calls: ${I.scrollCalls} lines: ${I.lastScrollLines??"-"} mouse: ${I.mouseTracking}
|
|
41
|
+
`,`event: ${I.lastInputEvent||"-"} pointer: ${I.pointerEvents} touch: ${I.touchEvents}
|
|
42
|
+
`,`rtt: ${me!==null?`${me}ms`:"-"} frames/s: ${J.framesPerSec} bytes/s: ${J.bytesPerSec} renderer: ${ye??"-"}
|
|
43
|
+
`,`prediction: ${((il=Fe.current)==null?void 0:il.getState())??"-"} mode: ${fe.predictiveEcho} buf: ${((qa=Fe.current)==null?void 0:qa.getBufferType())??"-"} pending: ${((bl=Fe.current)==null?void 0:bl.getVisiblePredictions().length)??0} srtt: ${((yl=Fe.current)==null?void 0:yl.getEchoSrttMs())!==null&&((Yl=Fe.current)==null?void 0:Yl.getEchoSrttMs())!==void 0?`${Math.round(Fe.current.getEchoSrttMs())}ms`:"-"}
|
|
44
|
+
`,`caret: ${(()=>{var Q;const X=(Q=Fe.current)==null?void 0:Q.getVisibleCursor();return X?`${X.row},${X.col}`:"-"})()} real cursor: ${I.cursorY??"-"} borrowed: ${$.current??"-"}`]}),_&&At&&Ha&&(()=>{var Wn;const X=f.current;if(!X||!We.current)return null;const Q=ha(X);if(Q.cellWidth<=0||Q.cellHeight<=0)return null;const de=((Wn=d.current)==null?void 0:Wn.querySelector(".xterm-screen"))||d.current;if(!de)return null;const ge=de.getBoundingClientRect(),Ie=We.current.getBoundingClientRect(),le=At.startRow-fl;if(At.endRow-fl<0||le>=X.rows)return null;const Jt=ge.top-Ie.top+le*Q.cellHeight,Dt=ge.left-Ie.left+At.startCol*Q.cellWidth,at=(At.endCol-At.startCol+1)*Q.cellWidth,ln=(At.endRow-At.startRow+1)*Q.cellHeight;return u.jsx("div",{"data-testid":"terminal-selection-overlay",className:"pointer-events-none absolute z-20 bg-tui-accent/35",style:{top:`${Jt}px`,left:`${Dt}px`,width:`${at}px`,height:`${ln}px`}})})(),_&&et&&u.jsx(kx,{anchorPoint:et,hasSelection:!!lt,isController:Me,vibrateOnKeyPress:fe.vibrateOnKeyPress,onCopySelection:Ga,onCopyLine:L,onCopyScreen:Y,onPaste:ie,onClose:()=>{hn(null),mt.current=null,Qt(null),tn.current=null,zt(""),wt.current="",mn(!1)}}),_&&u.jsx(zx,{isOpen:Ka,onClose:()=>Bl(!1),onSend:Ae,onSendImage:xe})]})},Xx=({onPairedSuccess:o})=>{const{settings:a,updateSettings:r,connect:c,connectionState:d,stateDetail:f,addToast:p,t:m}=Ct(),[b,S]=y.useState(""),[v,C]=y.useState(null),[D,z]=y.useState(!1),[_,F]=y.useState(a.wsUrl||"/ws/client"),[k,I]=y.useState(a.token||""),[ee,J]=y.useState(a.clientId||""),ae="node bin/service.js pair",ye="node bin/config-tui.js",O="herdr plugin pane open --plugin herdr.remote.web --entrypoint config --placement zoomed --focus",U=Me=>{Ua(Me).then(Ee=>{if(Ee==="failed"){p("error",m("clipboard.copyFailed"));return}C(Me),p("success",m("toasts.commandCopied")),setTimeout(()=>C(null),2e3)})},R=Me=>{Me.preventDefault();const Ee=b.trim().toUpperCase();if(!Ee&&!k.trim()){p("warning",m("toasts.connectionError"));return}const fe={pairCode:Ee,wsUrl:_.trim()||"/ws/client",clientId:ee.trim()||a.clientId};k.trim()&&(fe.token=k.trim()),r(fe),c({pairCode:Ee||void 0,token:k.trim()||void 0,wsUrl:_.trim()||"/ws/client",clientId:ee.trim()||a.clientId}),o&&o()},ne=d==="connecting"||d==="reconnecting",je=({n:Me})=>u.jsxs("span",{"aria-hidden":"true",className:"shrink-0 font-bold text-tui-accent",children:["[",Me,"]"]});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($s,{tone:"warn",action:u.jsx(He,{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:f||m("onboarding.authRequiredDesc")})]}),u.jsxs("form",{onSubmit:R,className:"grid gap-3",children:[u.jsx(rn,{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(je,{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(He,{onClick:()=>U(ae),glyph:v===ae?Ge.check:"⧉",className:P("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:()=>U(O),className:"tui-focusable shrink-0 text-tui-accent underline-offset-2 hover:underline",children:m(v===O?"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:()=>U(ye),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:ye})]})]})]})}),u.jsx(rn,{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(je,{n:2}),u.jsx(In,{type:"text",value:b,onChange:Me=>S(Me.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(He,{variant:"primary",type:"submit",block:!0,disabled:ne,className:"py-1.5",children:ne?u.jsx(ji,{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(!D),"aria-expanded":D,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:D?Ge.chevronDown:Ge.chevronRight}),u.jsx("span",{className:"uppercase",children:m("onboarding.advancedTitle")})]}),D&&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(kn,{htmlFor:"onboarding-token",children:m("onboarding.manualTokenLabel")}),u.jsx(In,{id:"onboarding-token",type:"password",value:k,onChange:Me=>I(Me.target.value),placeholder:m("onboarding.manualTokenPlaceholder")})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(kn,{htmlFor:"onboarding-ws",children:m("onboarding.wsEndpointLabel")}),u.jsx(In,{id:"onboarding-ws",type:"text",value:_,onChange:Me=>F(Me.target.value),placeholder:m("onboarding.wsEndpointPlaceholder")})]}),u.jsx(La,{}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(kn,{htmlFor:"onboarding-client-id",children:m("onboarding.clientIdLabel")}),u.jsx(In,{id:"onboarding-client-id",type:"text",value:ee,onChange:Me=>J(Me.target.value)})]})]})]})]})]})})},Ei="tui-focusable inline-flex shrink-0 select-none items-center justify-center border text-tui font-medium transition-colors",Rr="border-tui-border bg-tui-surface text-tui-text hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",Fx="border-tui-accent bg-tui-accent text-tui-crust font-bold",Zx="border-tui-ok bg-transparent text-tui-ok hover:bg-tui-ok hover:text-tui-crust font-bold",Qx=({compact:o=!1})=>{const{sendKey:a,settings:r,updateSettings:c,isController:d,warnViewerMode:f,t:p,uploadProgress:m,uploadImage:b}=Ct(),S="h-9 min-w-[2.25rem] px-2",v="h-9 w-9",C="h-9 px-2",D=y.useRef(null),z=y.useRef(null),_=y.useCallback(()=>{if(r.vibrateOnKeyPress&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(8)}catch{}},[r.vibrateOnKeyPress]),F=y.useCallback(()=>{var Z;if(_(),!d){f();return}m.active||(Z=D.current)==null||Z.click()},[_,d,f,m.active]),k=y.useCallback(Z=>{const pe=Z.target.files,ze=pe&&pe[0];Z.target.value="",ze&&b(ze)},[b]),I=()=>u.jsxs(u.Fragment,{children:[u.jsx("input",{ref:D,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})]}),ee=(Z=!1)=>m.active?u.jsx("div",{"data-testid":Z?"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(Pv,{ratio:m.ratio,label:m.statusText,tone:m.phase==="completed"?"ok":m.phase==="error"?"bad":"accent","aria-label":m.statusText})}):null,J=()=>{const Z=m.active;return u.jsx("button",{type:"button","data-testid":"image-upload-btn",onClick:F,disabled:Z,className:P(Ei,S,Z?"border-tui-border-dim bg-tui-surface opacity-60 cursor-not-allowed":Rr),title:Z?m.statusText:p("virtualKeyboard.uploadImageTitle"),"aria-label":p("virtualKeyboard.uploadImage"),children:u.jsx("span",{className:"font-medium",children:Z?`${m.percent}%`:p("virtualKeyboard.image")})})},[ae,ye]=y.useState(!1),[O,U]=y.useState(!1),[R,ne]=y.useState(!1),[je,Me]=y.useState(!1),[Ee,fe]=y.useState(!1),[ke,Oe]=y.useState(!1),j=y.useCallback((Z,pe=!1)=>{if(_(),!d){f();return}let ze=Z;pe&&(ae||O||R)&&(ze=xy(Z,{ctrl:ae,alt:O,shift:R})),a(ze),ae&&ye(!1),O&&U(!1),R&&ne(!1)},[d,ae,O,R,a,f,_,p]);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:[I(),ee(!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:p("virtualKeyboard.expandToolbar"),"aria-label":p("virtualKeyboard.expandToolbar"),"aria-expanded":!1,children:[u.jsx("span",{"aria-hidden":"true",children:"▴"}),u.jsx("span",{"aria-hidden":"true",children:p("common.keyBar")})]})})]});const q=r.virtualKeys&&r.virtualKeys.length>0?r.virtualKeys.filter(Z=>Z.enabled):bp,W=Z=>Z.id==="left"?u.jsx("span",{"aria-hidden":"true",children:"←"}):Z.id==="up"?u.jsx("span",{"aria-hidden":"true",children:"↑"}):Z.id==="down"?u.jsx("span",{"aria-hidden":"true",children:"↓"}):Z.id==="right"?u.jsx("span",{"aria-hidden":"true",children:"→"}):Z.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:p("virtualKeyboard.keyEnter")})]}):Z.id==="drawer_chords"?u.jsx("span",{children:"^C"}):Z.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:je?"▾":"▴"})]}):u.jsx("span",{children:Z.label}),Ce=Z=>{if(_(),Z.type==="modifier"){Z.modifierType==="ctrl"?ye(!ae):Z.modifierType==="alt"?U(!O):Z.modifierType==="shift"?ne(!R):Z.modifierType==="meta"&&j(Ne.ESC);return}if(Z.type==="drawer"){Z.drawerType==="fn"?(Me(!je),fe(!1),Oe(!1)):Z.drawerType==="chords"?(Oe(!ke),Me(!1),fe(!1)):Z.drawerType==="symbols"&&(fe(!Ee),Me(!1),Oe(!1));return}j(Z.code,Z.isPlainChar||Z.type==="symbol")},H=Z=>{if(Z.type==="modifier"){if(Z.modifierType==="ctrl")return ae;if(Z.modifierType==="alt")return O;if(Z.modifierType==="shift")return R}if(Z.type==="drawer"){if(Z.drawerType==="fn")return je;if(Z.drawerType==="chords")return ke;if(Z.drawerType==="symbols")return Ee}return!1},qe=(Z,pe,ze,ve,me="default")=>u.jsxs("button",{type:"button",onClick:()=>j(Z),className:P(Ei,"h-8 gap-1.5 px-2",me==="bad"?"border-tui-bad text-tui-bad hover:bg-tui-bad hover:text-tui-crust":me==="warn"?"border-tui-warn text-tui-warn hover:bg-tui-warn hover:text-tui-crust":Rr),title:ze,children:[u.jsx("span",{className:"font-bold",children:pe}),u.jsx("span",{className:"text-tui-sm opacity-70",children:ve})]});return u.jsxs("div",{"data-testid":"key-toolbar",className:P("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":p("virtualKeyboard.touchKeyboardShortcuts"),children:[I(),ee(!1),je&&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(Z=>{const pe=`F${Z}`;return u.jsxs("button",{type:"button",onClick:()=>j(Ne[pe]),className:P(Ei,Rr,"h-8"),children:["F",Z]},pe)})}),ke&&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:[qe(Ne.CTRL_C,"^C",p("virtualKeyboard.ctrlCTitle"),p("virtualKeyboard.badgeSigint"),"bad"),qe(Ne.CTRL_D,"^D",p("virtualKeyboard.ctrlDTitle"),p("virtualKeyboard.badgeEof")),qe(Ne.CTRL_Z,"^Z",p("virtualKeyboard.ctrlZTitle"),p("virtualKeyboard.badgeTstp"),"warn"),qe(Ne.CTRL_L,"^L",p("virtualKeyboard.ctrlLTitle"),p("virtualKeyboard.badgeClear")),qe(Ne.CTRL_R,"^R",p("virtualKeyboard.ctrlRTitle"),p("virtualKeyboard.badgeSearch")),qe(Ne.CTRL_A,"^A",p("virtualKeyboard.ctrlATitle"),p("virtualKeyboard.badgeStart")),qe(Ne.CTRL_E,"^E",p("virtualKeyboard.ctrlETitle"),p("virtualKeyboard.badgeEnd")),qe(Ne.CTRL_K,"^K",p("virtualKeyboard.ctrlKTitle"),p("virtualKeyboard.badgeKill"))]}),Ee&&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(Z=>u.jsx("button",{type:"button",onClick:()=>j(Z,!0),className:P(Ei,Rr,"h-8 w-8 font-bold"),children:Z},Z))}),u.jsxs("div",{"data-testid":"key-toolbar-row",className:P("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:P(Ei,v,"mr-1 border-tui-border-dim bg-transparent text-tui-faint hover:border-tui-border hover:text-tui-text"),title:p("virtualKeyboard.collapseToolbar"),"aria-label":p("virtualKeyboard.collapseToolbar"),"aria-expanded":!0,children:u.jsx("span",{"aria-hidden":"true",children:"▾"})}),q.map(Z=>{const pe=H(Z),ze=Z.id==="enter",ve=["left","up","down","right"].includes(Z.id),me=Z.type==="drawer",St=wu(Z,p),Le=u.jsx("button",{type:"button",onClick:()=>Ce(Z),className:P(Ei,ve?v:me?C:S,ze?Zx:pe?Fx:Rr),title:St,"aria-label":St,"aria-pressed":pe,children:W(Z)},Z.id);return ze?u.jsxs(dl.Fragment,{children:[J(),Le]},"enter-with-image"):Le}),!q.some(Z=>Z.id==="enter")&&J()]})]})},Ix=["ls -la","clear","git status","pwd","top","exit","cat"],Jx=({isOpen:o,onClose:a})=>{const{sendKey:r,isController:c,warnViewerMode:d,t:f}=Ct(),[p,m]=y.useState("");if(!o)return null;const b=v=>{if(v&&v.preventDefault(),!c){d();return}p.length>0?(r(p+"\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":f("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:f("virtualKeyboard.helperTitle")}),u.jsx(He,{variant:"ghost",onClick:a,"aria-label":f("virtualKeyboard.closeHelper"),children:"esc"})]}),u.jsx("div",{className:"scrollbar-none flex items-center gap-1 overflow-x-auto py-0.5",children:Ix.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:f("virtualKeyboard.placeholder")}),u.jsx(In,{id:"virtual-keyboard-input",name:"terminal-input",type:"text",value:p,onChange:v=>m(v.target.value),placeholder:f("virtualKeyboard.placeholder"),inputMode:"text",enterKeyHint:"send",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,className:"select-text pr-7"}),p.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":f("virtualKeyboard.clearInput"),children:u.jsx("span",{"aria-hidden":"true",children:Ge.cross})})]}),u.jsx(He,{variant:"primary",type:"submit",title:f("virtualKeyboard.sendButton"),glyph:"⏎",className:"h-9 shrink-0",children:u.jsx("span",{className:"hidden sm:inline",children:f("virtualKeyboard.sendButton")})})]})]})};function ro(o,a){const r=(c,d)=>a?a(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 Wx={connected:"ok",connecting:"warn",reconnecting:"warn",error:"bad",disconnected:"idle"},Px=({isOpen:o,onClose:a,isAddMode:r=!1})=>{const{settings:c,updateSettings:d,connect:f,disconnect:p,connectionState:m,hostId:b,addToast:S,t:v,activeProfile:C,activeProfileId:D,addProfileAndConnect:z,renameProfile:_}=Ct(),[F,k]=y.useState(c.wsUrl),[I,ee]=y.useState(c.token),[J,ae]=y.useState(c.pairCode),[ye,O]=y.useState(c.clientId),[U,R]=y.useState((C==null?void 0:C.displayName)||""),[ne,je]=y.useState(c.autoReconnect),[Me,Ee]=y.useState(!1);if(y.useEffect(()=>{o&&(k(c.wsUrl),ee(r?"":c.token),ae(r?"":c.pairCode),O(c.clientId),R(r?"":(C==null?void 0:C.displayName)||""),je(c.autoReconnect))},[o,r,c,C]),!o)return null;const fe=q=>{q.preventDefault();const W={wsUrl:F.trim()||"/ws/client",token:I.trim(),pairCode:J.trim().toUpperCase(),clientId:ye.trim()||c.clientId,autoReconnect:ne};if(!W.token&&!W.pairCode){S("warning",v("pairing.credentialsRequired"));return}r?z({...W,displayName:U.trim()||void 0}):(d(W),D&&U.trim()&&_(D,U),p(),f({wsUrl:W.wsUrl,token:W.token||void 0,pairCode:W.pairCode||void 0,clientId:W.clientId,autoReconnect:ne})),a()},ke=()=>{const q=`client-${Math.random().toString(36).substring(2,8)}`;O(q)},Oe=()=>{const q=new URL(window.location.href);q.search="",J.trim()&&q.searchParams.set("pairCode",J.trim().toUpperCase()),Ua(q.toString()).then(W=>{if(W==="failed"){S("error",v("clipboard.copyFailed"));return}Ee(!0),S("success",v("toasts.pairingLinkCopied")),setTimeout(()=>Ee(!1),2e3)})},j=Wx[m]??"idle";return u.jsxs(Ku,{isOpen:o,onClose:a,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(He,{variant:"danger",onClick:()=>{p(),a()},children:v("common.disconnect")}),u.jsx(He,{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(Jn,{level:j}),u.jsx("span",{className:"text-tui-muted",children:v("common.status")}),u.jsx("span",{className:P(j==="ok"?"text-tui-ok":j==="bad"?"text-tui-bad":j==="warn"?"text-tui-warn":"text-tui-faint"),children:ro(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:fe,className:"space-y-3",children:[u.jsxs("div",{className:"space-y-1",children:[u.jsx(kn,{htmlFor:"pairing-name",children:v("pairing.displayNameLabel")}),u.jsx(In,{id:"pairing-name",type:"text",value:U,onChange:q=>R(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(kn,{htmlFor:"pairing-code",hint:v("pairing.pairCodeNote"),children:v("pairing.pairCodeLabel")}),u.jsx(In,{id:"pairing-code",type:"text",value:J,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(kn,{htmlFor:"pairing-token",hint:v("pairing.tokenNote"),children:v("pairing.tokenLabel")}),u.jsx(In,{id:"pairing-token",type:"password",value:I,onChange:q=>ee(q.target.value),placeholder:v("pairing.tokenPlaceholder")})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(kn,{htmlFor:"pairing-ws",children:v("pairing.wsUrlLabel")}),u.jsx(In,{id:"pairing-ws",type:"text",value:F,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(kn,{htmlFor:"pairing-client-id",children:v("pairing.clientIdLabel")}),u.jsxs("div",{className:"flex gap-2",children:[u.jsx(In,{id:"pairing-client-id",type:"text",value:ye,onChange:q=>O(q.target.value),className:"flex-1"}),u.jsx(He,{onClick:ke,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(Au,{checked:ne,onChange:je,label:v("pairing.autoReconnectLabel"),description:v("pairing.autoReconnectDesc")})}),u.jsx("div",{className:"border-t border-tui-border-dim pt-2",children:u.jsx(He,{onClick:Oe,block:!0,glyph:Me?Ge.check:"⧉",className:P(Me&&"border-tui-ok text-tui-ok"),children:v("pairing.copyDirectLink")})})]})]})},$x=({isOpen:o,onClose:a})=>{const{settings:r,updateSettings:c,addToast:d,language:f,setLanguage:p,t:m}=Ct(),[b,S]=y.useState("appearance"),[v,C]=y.useState(!1);if(!o)return null;const D=Eu.find(O=>O.font===r.fontFamily),z=r.virtualKeys&&r.virtualKeys.length>0?r.virtualKeys:Or(),_=()=>{const O=xp();c({fontSize:O.fontSize,fontFamily:O.fontFamily,toolbarVisible:O.toolbarVisible,vibrateOnKeyPress:O.vibrateOnKeyPress,predictiveEcho:O.predictiveEcho,language:O.language,virtualKeys:O.virtualKeys}),d("info",m("settings.resetDefaultsToast"))},F=O=>{const U=z.map(R=>R.id===O?{...R,enabled:!R.enabled}:R);c({virtualKeys:U})},k=(O,U)=>{const R=U==="up"?O-1:O+1;if(R<0||R>=z.length)return;const ne=[...z],je=ne[O];ne[O]=ne[R],ne[R]=je,c({virtualKeys:ne})},I=O=>{if(z.some(R=>R.id===O.id)){const R=z.map(ne=>ne.id===O.id?{...ne,enabled:!0}:ne);c({virtualKeys:R})}else{const R=[...z,{...O,enabled:!0}];c({virtualKeys:R})}C(!1)},ee=O=>{const U=z.filter(R=>R.id!==O);c({virtualKeys:U})},J=()=>{c({virtualKeys:Or()}),d("info",m("toasts.keyLayoutReset"))},ae=10,ye=24;return u.jsxs(Ku,{isOpen:o,onClose:a,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(He,{variant:"ghost",onClick:_,children:m("settings.resetDefaults")}),u.jsx(He,{variant:"primary",onClick:a,children:m("common.done")})]}),children:[u.jsx(Bu,{tabs:[{id:"appearance",label:m("settings.tabAppearance"),index:1},{id:"virtualKeys",label:m("settings.tabVirtualKeys"),index:2}],activeId:b,onSelect:O=>S(O),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(kn,{children:m("settings.languageLabel")}),u.jsxs("div",{className:"grid gap-0.5 sm:grid-cols-2",children:[u.jsx(Cr,{name:"ui-language",checked:f==="zh",onChange:()=>p("zh"),label:"简体中文"}),u.jsx(Cr,{name:"ui-language",checked:f==="en",onChange:()=>p("en"),label:"English"})]})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(kn,{htmlFor:"terminal-font-select",children:m("settings.fontFamilyLabel")}),u.jsxs(Hu,{id:"terminal-font-select",value:r.fontFamily,onChange:O=>c({fontFamily:O.target.value}),"aria-label":m("settings.fontFamilyLabel"),children:[!D&&u.jsx("option",{value:r.fontFamily,children:r.fontFamily}),Eu.map(O=>u.jsx("option",{value:O.font,children:m(`fontPresets.${O.id}`)||O.name},O.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(kn,{htmlFor:"terminal-font-size",children:m("settings.fontSizeLabel",{size:r.fontSize})}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(Jv,{value:(r.fontSize-ae)/(ye-ae),width:24,className:"hidden shrink-0 sm:inline-flex"}),u.jsx("input",{id:"terminal-font-size",type:"range",min:ae,max:ye,step:1,value:r.fontSize,onChange:O=>c({fontSize:Number(O.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(La,{}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(kn,{children:m("settings.predictiveEchoLabel")}),u.jsxs("div",{className:"grid gap-0.5 sm:grid-cols-3",children:[u.jsx(Cr,{name:"predictive-echo",checked:r.predictiveEcho==="auto",onChange:()=>c({predictiveEcho:"auto"}),label:m("settings.predictiveEchoAuto")}),u.jsx(Cr,{name:"predictive-echo",checked:r.predictiveEcho==="always",onChange:()=>c({predictiveEcho:"always"}),label:m("settings.predictiveEchoAlways")}),u.jsx(Cr,{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(La,{}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(Au,{checked:r.toolbarVisible,onChange:O=>c({toolbarVisible:O}),label:m("settings.touchKeyToolbar"),description:m("settings.touchKeyToolbarDesc")}),u.jsx(Au,{checked:r.vibrateOnKeyPress,onChange:O=>c({vibrateOnKeyPress:O}),label:m("settings.touchHaptics"),description:m("settings.touchHapticsDesc")})]}),u.jsx(La,{}),u.jsxs("p",{className:"text-tui-sm leading-snug text-tui-faint",children:[u.jsx("span",{"aria-hidden":"true",className:"mr-1",children:Ge.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(He,{variant:"ghost",onClick:J,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((O,U)=>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:O.enabled,onChange:()=>F(O.id),className:"sr-only",id:`toggle-${O.id}`}),u.jsx("label",{htmlFor:`toggle-${O.id}`,className:P("shrink-0 cursor-pointer select-none font-bold",O.enabled?"text-tui-ok":"text-tui-faint"),"aria-hidden":"true",children:O.enabled?"[x]":"[ ]"}),u.jsx($v,{className:P(!O.enabled&&"opacity-50"),children:O.label}),u.jsx("span",{className:"truncate text-tui-sm text-tui-muted",children:wu(O,m)})]}),u.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[u.jsx(He,{variant:"ghost",brackets:!1,disabled:U===0,onClick:()=>k(U,"up"),title:m("virtualKeyboard.moveUp"),"aria-label":m("virtualKeyboard.moveUp"),className:"px-1",children:"↑"}),u.jsx(He,{variant:"ghost",brackets:!1,disabled:U===z.length-1,onClick:()=>k(U,"down"),title:m("virtualKeyboard.moveDown"),"aria-label":m("virtualKeyboard.moveDown"),className:"px-1",children:"↓"}),u.jsx(He,{variant:"ghost",brackets:!1,onClick:()=>ee(O.id),title:m("virtualKeyboard.deleteKeyTitle"),"aria-label":m("virtualKeyboard.deleteKeyTitle"),className:"px-1 text-tui-bad hover:text-tui-bad",children:Ge.cross})]})]},O.id))}),u.jsx(He,{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(La,{label:m("virtualKeyboard.availableKeys")}),u.jsx("div",{className:"flex max-h-48 flex-wrap gap-1 overflow-y-auto",children:ky.map(O=>{const U=z.some(R=>R.id===O.id);return u.jsxs("button",{type:"button",onClick:()=>I(O),title:wu(O,m),className:P("tui-focusable flex select-none items-center gap-1 border px-1.5 py-0.5 text-tui-sm transition-colors",U?"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:O.label}),u.jsx("span",{"aria-hidden":"true",className:U?"text-tui-ok":"text-tui-accent",children:U?Ge.check:"+"})]},O.id)})})]})]})]})},e0={success:"ok",warning:"warn",error:"bad",info:"accent"},t0={success:Ge.check,warning:Ge.warn,error:Ge.cross,info:"›"},n0=()=>{const{toasts:o,removeToast:a,t:r}=Ct();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=e0[c.type];return u.jsxs("div",{className:P("pointer-events-auto flex items-start gap-2 border border-tui-border border-l-2 bg-tui-base px-2 py-1 text-tui",Qn[d].edgeL),role:"alert",children:[u.jsx("span",{"aria-hidden":"true",className:P("shrink-0 font-bold",Qn[d].text),children:t0[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:()=>a(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:Ge.cross})})]},c.id)})})},Gu=({onAddProfile:o,mobile:a=!1,statusBar:r=!1})=>{const{profiles:c,activeProfileId:d,activeProfile:f,connectionState:p,switchProfile:m,renameProfile:b,removeProfile:S,t:v}=Ct(),[C,D]=y.useState(!1),[z,_]=y.useState(null),[F,k]=y.useState(""),I=y.useRef(null);y.useEffect(()=>{if(!C)return;const U=R=>{I.current&&!I.current.contains(R.target)&&D(!1)};return document.addEventListener("pointerdown",U),()=>document.removeEventListener("pointerdown",U)},[C]);const ee=(U,R)=>{_(U),k(R)},J=U=>{const R=F.trim();R&&b(U,R),_(null)},ae=U=>{typeof window<"u"&&!window.confirm(v("profiles.removeConfirm"))||(S(U),_(null))},ye=(f==null?void 0:f.displayName)||v("profiles.addHost"),O=p==="connected"?"ok":p==="connecting"||p==="reconnecting"?"warn":p==="error"?"bad":"idle";return u.jsxs("div",{ref:I,className:P("relative min-w-0",a&&"w-full",r&&"flex-1"),children:[u.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":C,"aria-label":v("profiles.switcherLabel"),onClick:()=>D(U=>!U),className:P("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":a?"min-h-11 w-full px-2":"min-h-[24px] max-w-[18rem] px-1"),children:[u.jsx(Jn,{level:O}),u.jsx("span",{className:P("truncate text-tui-text",r&&"min-w-0 flex-1"),children:ye}),u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint",children:C?Ge.chevronDown:Ge.chevronRight})]}),C&&u.jsxs("div",{role:"menu","aria-label":v("profiles.switcherLabel"),className:P("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)]":a?"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(U=>{const R=U.id===d,ne=U.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":R?"true":void 0,onClick:()=>{m(U.id),D(!1)},className:P("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",R?"text-tui-accent":"text-tui-text"),children:[u.jsx("span",{"aria-hidden":"true",className:"w-3 shrink-0",children:R?Ge.cursor:""}),u.jsxs("span",{className:"min-w-0 flex-1",children:[u.jsx("span",{className:"block truncate font-bold",children:U.displayName}),u.jsx("span",{className:"block truncate text-tui-sm text-tui-faint",title:U.hostname||U.hostId,children:U.hostname||U.hostId||U.wsUrl})]}),R&&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:()=>ee(U.id,U.displayName),className:"tui-focusable min-h-11 min-w-11 px-2 text-tui-muted hover:text-tui-accent",children:Ge.ellipsis})]}),ne&&u.jsxs("div",{className:"flex items-center gap-1 px-2 pb-2",children:[u.jsx("input",{autoFocus:!0,value:F,maxLength:64,onChange:je=>k(je.target.value),onKeyDown:je=>{je.key==="Enter"&&J(U.id),je.key==="Escape"&&_(null)},"aria-label":v("profiles.rename"),className:"tui-input min-w-0 flex-1 px-2 py-1 text-tui"}),u.jsx(He,{onClick:()=>J(U.id),variant:"primary",className:"min-h-11",children:v("common.save")}),u.jsx(He,{onClick:()=>ae(U.id),variant:"danger",className:"min-h-11",children:v("profiles.remove")})]})]},U.id)}),u.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{D(!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")})]})]})]})},l0=({onAddProfile:o=()=>{}})=>{const{connectionState:a,role:r,hostId:c,assignedClientId:d,sharedWindowCount:f,settings:p,rttMs:m,t:b}=Ct(),S=ro(a,b),v=a==="connected";return u.jsx(Xp,{left:u.jsxs(u.Fragment,{children:[u.jsx(Gu,{onAddProfile:o}),u.jsx(qm,{items:[u.jsxs("span",{className:"flex items-center gap-1",children:[u.jsx(Jn,{level:S.level}),u.jsx("span",{className:"text-tui-text",children:S.label})]},"status"),v?u.jsx(io,{tone:r==="controller"?"ok":"warn",children:b(r==="controller"?"role.sharedControl":"common.viewer")},"role"):null,v&&f>1?u.jsx("span",{className:"text-tui-muted",children:b("role.sharedWindows",{count:f})},"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||p.clientId})]},"client")]})]}),right:u.jsx(qm,{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")]})})},a0=[[/\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"]],i0=[[/\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 ap(o,a){for(const[r,c]of o)if(r.test(a))return c;return null}function qu(o){const a=typeof o=="string"?o.trim():"";if(!a)return{label:"",raw:""};const r=ap(a0,a),c=ap(i0,a);return r&&c?{label:`${r} · ${c}`,raw:a}:r?{label:r,raw:a}:c?{label:c,raw:a}:{label:a.length>32?`${a.slice(0,32)}…`:a,raw:a}}function ip(o){if(o===0)return"0 B";const a=1024,r=["B","KB","MB","GB"],c=Math.floor(Math.log(o)/Math.log(a));return`${(o/Math.pow(a,c)).toFixed(1)} ${r[c]}`}const r0=({clients:o})=>{const{t:a}=Ct(),r=[{key:"id",header:a("admin.colClientId"),render:c=>u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(Jn,{level:"ok"}),u.jsx("span",{className:"font-bold text-tui-text",children:c.id})]})},{key:"role",header:a("admin.colRole"),width:12,render:c=>{const d=c.role==="controller";return u.jsx(io,{tone:d?"ok":"warn",children:a(d?"common.controller":"common.viewer")})}},{key:"device",header:a("admin.colDevice"),render:c=>{const d=qu(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:a("admin.unknownDevice")})}},{key:"ip",header:a("admin.colIp"),render:c=>u.jsx("span",{className:"text-tui-muted",children:c.ip||"127.0.0.1"})},{key:"connectedAt",header:a("admin.colConnectedAt"),render:c=>u.jsx("span",{className:"text-tui-muted",children:c.connectedAt?new Date(c.connectedAt).toLocaleTimeString():a("admin.startedRecently")})},{key:"traffic",header:a("admin.colTraffic"),align:"right",render:c=>u.jsxs("span",{className:"whitespace-nowrap",children:[u.jsx("span",{className:"text-tui-accent",children:ip(c.bytesReceived||0)}),u.jsx("span",{"aria-hidden":"true",className:"mx-1 text-tui-faint",children:"/"}),u.jsx("span",{className:"text-tui-ok",children:ip(c.bytesSent||0)})]})}];return u.jsx(rn,{title:a("admin.connectedClientsTitle",{count:o.length}),bodyClassName:"-mx-1",children:u.jsx(Yu,{columns:r,items:o,rowKey:c=>c.id,empty:a("admin.noClients")})})},rp={online:"ok",busy:"ok",reconnecting:"warn",offline:"idle"};function s0(o=[],a=[]){const r=new Map;for(const f of a){if(!(f!=null&&f.hostId))continue;const p=r.get(f.hostId);p?p.push(f):r.set(f.hostId,[f])}const c=o.map(f=>{const p=r.get(f.id)||[];return{id:f.id,hostname:f.hostname||f.id,status:f.status||"online",connectedDeviceCount:f.connectedDeviceCount??0,pairedDeviceCount:f.pairedDeviceCount??p.length,devices:p,fromRosterOnly:!1}}),d=new Set(c.map(f=>f.id));for(const[f,p]of r)d.has(f)||c.push({id:f,hostname:f,status:"offline",connectedDeviceCount:0,pairedDeviceCount:p.length,devices:p,fromRosterOnly:!0});return c.sort((f,p)=>f.fromRosterOnly!==p.fromRosterOnly?f.fromRosterOnly?1:-1:f.hostname.localeCompare(p.hostname))}const o0=({hosts:o,devices:a})=>{const{t:r}=Ct(),c=s0(o,a),d={online:r("admin.hostStatusOnline"),busy:r("admin.hostStatusBusy"),reconnecting:r("admin.hostStatusReconnecting"),offline:r("admin.hostStatusOffline")};return u.jsx(rn,{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(f=>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(Jn,{level:rp[f.status]}),u.jsx("span",{className:"truncate font-bold text-tui-text",children:f.hostname}),f.hostname!==f.id?u.jsx("code",{className:"truncate text-tui-sm text-tui-faint",children:f.id}):null]}),u.jsxs("span",{className:"flex shrink-0 items-center gap-3 text-tui-sm",children:[u.jsx(io,{tone:rp[f.status],children:d[f.status]}),u.jsx("span",{className:"text-tui-accent",children:r("admin.hostConnectedDevices",{count:f.connectedDeviceCount})}),u.jsx("span",{className:"text-tui-muted",children:r("admin.hostPairedDevices",{count:f.pairedDeviceCount})})]})]}),f.devices.length>0?u.jsx("ul",{className:"divide-y divide-tui-border-dim",children:f.devices.map(p=>{const m=qu(p.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:p.deviceId}),u.jsx("span",{className:"ml-auto shrink-0 text-tui-sm text-tui-faint",children:p.lastIp||"—"})]},p.deviceId)})}):u.jsx("p",{className:"px-2 py-1 text-tui-sm text-tui-faint",children:f.pairedDeviceCount>0?r("admin.hostRosterOperatorOnly"):r("admin.noDevices")})]},f.id))})},c0=({ptys:o})=>{const{t:a}=Ct(),r=[{key:"id",header:a("admin.colPtyId"),render:c=>u.jsx("span",{className:"font-bold text-tui-accent",children:c.id})},{key:"pid",header:a("admin.colPid"),width:9,render:c=>u.jsx("span",{className:"text-tui-muted",children:c.pid})},{key:"command",header:a("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:a("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:a("admin.colCwd"),className:"max-w-xs truncate",render:c=>u.jsx("span",{className:"text-tui-muted",children:c.cwd||"~"})},{key:"viewers",header:a("admin.colViewers"),align:"right",width:9,render:c=>u.jsx("span",{className:"font-bold text-tui-ok",children:c.activeClients})}];return u.jsx(rn,{title:a("admin.activePtysTitle",{count:o.length}),bodyClassName:"-mx-1",children:u.jsx(Yu,{columns:r,items:o,rowKey:c=>c.id,empty:a("admin.noPtys")})})};function u0(o){if(!o)return"—";const a=new Date(o);return Number.isNaN(a.getTime())?"—":a.toLocaleString()}const d0=({devices:o,onRevoke:a})=>{const{t:r}=Ct(),[c,d]=y.useState(null),[f,p]=y.useState(null),m=async S=>{if(c!==S){d(S);return}p(S);try{await a(S)}finally{p(null),d(null)}},b=[{key:"device",header:r("admin.colDevice"),render:S=>{const v=qu(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:u0(S.lastSeenAt)})},{key:"actions",header:r("admin.colActions"),align:"right",render:S=>{const v=c===S.deviceId,C=f===S.deviceId;return u.jsx(He,{variant:"danger",disabled:C,onClick:()=>void m(S.deviceId),onBlur:()=>d(D=>D===S.deviceId?null:D),"aria-label":r("admin.revokeDevice"),className:v?"bg-tui-bad text-tui-crust":void 0,children:C?u.jsx(ji,{}):r(v?"admin.revokeConfirm":"admin.revokeDevice")})}}];return u.jsx(rn,{title:r("admin.pairedDevicesTitle",{count:o.length}),bodyClassName:"-mx-1",children:u.jsx(Yu,{columns:b,items:o,rowKey:S=>S.deviceId,empty:r("admin.noDevices")})})};function Wp(o){if(typeof window>"u"||!o||o.startsWith("/"))return"";try{const a=new URL(o.replace(/^ws/,"http")),r=a.pathname.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"");return a.origin===window.location.origin&&!r?"":`${a.origin}${r}`}catch{return""}}function Ar(o,a){const r=Wp(o);return r?`${r}${a.startsWith("/")?a:`/${a}`}`:a}const f0=({onBackToTerminal:o,onOpenPairing:a})=>{var ut,nt,ht,Ht,gt,zn,Dn,_t,sn,On,kt,Fe,Vt,Yt;const{settings:r,updateSettings:c,addToast:d,t:f}=Ct(),p=Wp(r.wsUrl)||(typeof window<"u"?window.location.origin:"local"),m=((ut=r.adminTokens)==null?void 0:ut[p])||(p===(typeof window<"u"?window.location.origin:"local")?r.adminToken:"")||"",[b,S]=y.useState(null),[v,C]=y.useState(null),[D,z]=y.useState(!1),[_,F]=y.useState(!0),[k,I]=y.useState(null),[ee,J]=y.useState(!1),[ae,ye]=y.useState(3e3),[O,U]=y.useState(null),[R,ne]=y.useState("overview"),[je,Me]=y.useState(!1),[Ee,fe]=y.useState(m),[ke,Oe]=y.useState(!!m),j="node bin/service.js pair";y.useEffect(()=>{fe(m),Oe(!!m),S(null),C(null),z(!1)},[p]);const q=()=>{Ua(j).then($=>{if($==="failed"){d("error",f("clipboard.copyFailed"));return}Me(!0),d("success",f("toasts.commandCopied")),setTimeout(()=>Me(!1),2e3)})};y.useEffect(()=>{let $=!0;F(!0);async function Re(){try{const Ke=await fetch(Ar(r.wsUrl,"/api/info"),{headers:{Accept:"application/json"}});if(Ke.ok){const We=await Ke.json();$&&(C(We),z(!0));return}}catch{}if($){const Ke=!!(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:Ke?"remote":"local",adminConfigured:!1,adminPath:"/admin",adminStatusPath:"/api/admin/status"}),z(!0)}}return Re(),()=>{$=!1}},[r.wsUrl,p]);const W=(v==null?void 0:v.relayMode)==="remote",Ce=()=>{if(v!=null&&v.adminPath)return v.publicUrl?`${v.publicUrl.replace(/\/$/,"")}${v.adminPath}`:Ar(r.wsUrl,v.adminPath);if(b!=null&&b.remoteAdminUrl)return b.remoteAdminUrl;if(r.wsUrl)try{return Ar(r.wsUrl,"/admin")}catch{}return"/admin"},H=y.useCallback(async()=>{if(D){if(W){if(!ke&&!Ee){S(null),F(!1),I(null),J(!1);return}try{F(!0);const $=Ar(r.wsUrl,(v==null?void 0:v.adminStatusPath)||"/api/admin/status"),Ke=await fetch($,{headers:{Accept:"application/json","X-Relay-Admin-Token":Ee}});if(Ke.status===401||Ke.status===403){J(!0),I(f("admin.relayAdminAuthError")),S(null);return}if(!Ke.ok)throw new Error(`HTTP ${Ke.status}: ${Ke.statusText}`);const We=await Ke.json();S(We),I(null),J(!1),U(new Date)}catch($){console.warn("GET /api/admin/status request failed:",$),J(!1),I($ instanceof Error?$.message:"Failed to fetch remote admin status"),S(null)}finally{F(!1)}return}try{F(!0);const $={Accept:"application/json"};r.token&&($.Authorization=`Bearer ${r.token}`);const Re=await fetch("/api/status",{headers:$});if(Re.status===401||Re.status===403){J(!0),I(`Authentication failed (HTTP ${Re.status}): Access denied. Please configure an authorized token or pair with the host.`),S(null);return}if(!Re.ok)throw new Error(`HTTP ${Re.status}: ${Re.statusText}`);const Ke=await Re.json();S(Ke),I(null),J(!1),U(new Date)}catch($){console.warn("GET /api/status request failed:",$),J(!1),I($ instanceof Error?$.message:"Failed to fetch status"),S(null)}finally{F(!1)}}},[D,W,ke,Ee,v,r.token,r.wsUrl,p,f]),qe=y.useCallback(async $=>{try{if(!(await fetch(Ar(r.wsUrl,`/api/admin/devices/${encodeURIComponent($)}`),{method:"DELETE",headers:{Accept:"application/json","X-Relay-Admin-Token":Ee}})).ok){I(f("admin.revokeFailed"));return}await H()}catch{I(f("admin.revokeFailed"))}},[Ee,H,r.wsUrl,f]);y.useEffect(()=>{if(!D)return;H();let $=null;const Re=()=>{ae>0&&!$&&($=setInterval(()=>{document.visibilityState==="visible"&&H()},ae))},Ke=()=>{$&&(clearInterval($),$=null)},We=()=>{document.visibilityState==="visible"?(H(),Re()):Ke()};return Re(),document.addEventListener("visibilitychange",We),()=>{Ke(),document.removeEventListener("visibilitychange",We)}},[D,H,ae]);const Z=$=>{$.preventDefault();const Re=Ee.trim();c({adminToken:Re,adminTokens:{...r.adminTokens||{},[p]:Re}}),Oe(!!Re)},pe=$=>{const Re=Math.max(0,Math.floor($)),Ke=Math.floor(Re/86400),We=Math.floor(Re%86400/3600),et=Math.floor(Re%3600/60),hn=Re%60,mt=(At,Qt)=>`${At}${f(`admin.unit${Qt}`)}`;return Ke>0?[mt(Ke,"Day"),mt(We,"Hour"),mt(et,"Minute")].join(" "):We>0?[mt(We,"Hour"),mt(et,"Minute"),mt(hn,"Second")].join(" "):[mt(et,"Minute"),mt(hn,"Second")].join(" ")},ze=$=>{if(!$||$===0)return"0 B";const Re=1024,Ke=["B","KB","MB","GB"],We=Math.floor(Math.log($)/Math.log(Re));return`${($/Math.pow(Re,We)).toFixed(1)} ${Ke[We]}`},ve=()=>{const $=Ce();window.open($,"_blank","noopener,noreferrer")},me=b?b.activeUserCount??((nt=b.clients)==null?void 0:nt.length)??0:0,St=b?[{id:"overview",label:f("admin.tabOverview"),index:1},{id:"clients",label:f("admin.tabClients",{count:((ht=b.clients)==null?void 0:ht.length)||0}),index:2},{id:"ptys",label:f("admin.tabPtys",{count:((Ht=b.ptys)==null?void 0:Ht.length)||0}),index:3},...b.devices?[{id:"devices",label:f("admin.tabDevices",{count:b.devices.length}),index:4}]:[]]:[],Le=St.map($=>$.id);y.useEffect(()=>{const $=Re=>{if(Re.ctrlKey||Re.altKey||Re.metaKey)return;const Ke=Re.target;if(Ke instanceof HTMLInputElement||Ke instanceof HTMLTextAreaElement||Ke instanceof HTMLSelectElement||Ke!=null&&Ke.isContentEditable||document.querySelector('[role="dialog"]'))return;if(Re.key==="Escape"&&o){Re.preventDefault(),o();return}if(Re.key.toLowerCase()==="r"){Re.preventDefault(),H();return}const We=Number.parseInt(Re.key,10)-1;Number.isInteger(We)&&We>=0&&We<Le.length&&(Re.preventDefault(),ne(Le[We]))};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[H,Le.join("|")]);const we=u.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[o&&u.jsx(He,{variant:"ghost",onClick:o,title:f("admin.returnToTerminal"),"aria-label":f("admin.returnToTerminal"),glyph:Ge.arrowLeft,brackets:!1,className:"shrink-0",children:u.jsx("span",{className:"sr-only",children:f("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(io,{tone:W?"alt":"ok",children:f(W?"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:f("admin.autoRefresh")}),u.jsxs(Hu,{value:ae,onChange:$=>ye(Number($.target.value)),"aria-label":f("admin.autoRefresh"),className:"w-auto",children:[u.jsx("option",{value:0,children:f("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(He,{variant:"primary",onClick:H,disabled:_,title:f("admin.refreshNow"),children:_?u.jsx(ji,{}):f("admin.refreshNow")})]});return u.jsxs(ex,{name:f("admin.title"),tagline:f("admin.subtitle"),aside:we,tabs:St,activeTabId:R,onSelectTab:$=>ne($),tabsAriaLabel:f("header.mainNavigationAria"),hints:[{keys:"1–4",action:f("admin.hintTabs")},{keys:"r",action:f("admin.hintRefresh")},...o?[{keys:"esc",action:f("admin.hintBack")}]:[]],footerAside:O?u.jsx("span",{className:"text-tui-faint",children:f("admin.updatedAt",{time:O.toLocaleTimeString()})}):null,bodyClassName:"space-y-3 pb-2",children:[!D&&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(ji,{label:f("admin.loadingStatus")})}),D&&W&&!ke&&u.jsxs(rn,{title:f("admin.remoteRelayTitle"),aside:f("admin.remoteRelayBadge"),bodyClassName:"space-y-2",children:[u.jsx("p",{className:"text-tui leading-snug text-tui-muted",children:f("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(nl,{label:f("admin.remoteRelayEndpoint"),labelWidth:18,children:u.jsx("code",{className:"break-all text-tui-accent",children:r.wsUrl})}),u.jsx(nl,{label:f("admin.remoteRelayAdminUrl"),labelWidth:18,children:u.jsx("code",{className:"break-all text-tui-ok",children:Ce()})})]}),u.jsx(La,{}),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:f("admin.remoteRelayHelp")}),u.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[u.jsx(He,{onClick:()=>Oe(!0),children:f("admin.relayAdminLoginBtn")}),u.jsx(He,{variant:"primary",onClick:ve,glyph:Ge.arrowRight,children:f("admin.openRemoteAdminBtn")})]})]})]}),D&&W&&ke&&!b&&u.jsxs(rn,{title:f("admin.relayAdminTitle"),bodyClassName:"space-y-2",children:[u.jsx($s,{tone:(v==null?void 0:v.adminConfigured)===!1?"warn":"bad",children:(v==null?void 0:v.adminConfigured)===!1?f("admin.relayAdminNotConfigured"):f("admin.relayAdminAuthError")}),u.jsxs("form",{onSubmit:Z,className:"space-y-2",children:[u.jsxs("div",{className:"space-y-1",children:[u.jsx(kn,{htmlFor:"relay-admin-token",children:f("admin.relayAdminTokenLabel")}),u.jsx(In,{id:"relay-admin-token",type:"password",value:Ee,onChange:$=>fe($.target.value),placeholder:f("admin.relayAdminTokenPlaceholder")})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(He,{variant:"primary",type:"submit",children:f("admin.relayAdminLoginBtn")}),u.jsx(He,{variant:"ghost",onClick:()=>Oe(!1),children:f("common.cancel")})]})]})]}),D&&!W&&ee&&u.jsxs(rn,{title:f("admin.unauthorizedTitle"),tone:"bad",bodyClassName:"space-y-2",children:[u.jsx($s,{tone:"bad",children:f("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:f("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(He,{onClick:q,glyph:je?Ge.check:"⧉",className:P("shrink-0",je&&"border-tui-ok text-tui-ok"),children:f(je?"admin.copiedJson":"common.copy")})]}),u.jsx("p",{className:"text-tui-sm text-tui-faint",children:f("admin.pairingStepsHelp")})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[a&&u.jsx(He,{variant:"primary",onClick:a,children:f("admin.enterPairCodeBtn")}),u.jsx(He,{onClick:H,children:f("admin.retryFetchBtn")})]})]}),D&&k&&!ee&&!(!W&&ee)&&u.jsx($s,{tone:"warn",action:u.jsx(He,{variant:"warn",onClick:H,children:f("common.retry")}),children:f("admin.errorConnecting",{error:k})}),b&&u.jsxs(u.Fragment,{children:[R==="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(rn,{title:f("admin.accessPanel"),aside:pe(b.uptimeSeconds||0),bodyClassName:"space-y-0.5",children:[u.jsx(nl,{label:f("admin.connectedHosts"),labelWidth:14,children:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(Jn,{level:(gt=b.hosts)!=null&>.length?"ok":"idle"}),u.jsx("span",{className:"font-bold",children:((zn=b.hosts)==null?void 0:zn.length)||0})]})}),u.jsx(nl,{label:f("admin.activeUsers"),labelWidth:14,children:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(Jn,{level:me?"ok":"idle"}),u.jsx("span",{className:"font-bold",children:me}),u.jsx("span",{className:"text-tui-faint",children:f("admin.acrossWindows",{count:((Dn=b.clients)==null?void 0:Dn.length)||0})})]})}),u.jsxs(nl,{label:f("admin.activePtys"),labelWidth:14,children:[u.jsx("span",{className:"font-bold",children:((_t=b.ptys)==null?void 0:_t.length)||0}),u.jsx("span",{className:"ml-1.5 text-tui-faint",children:f("admin.terminalShells")})]}),u.jsx(nl,{label:f("admin.uptime"),labelWidth:14,children:u.jsx("span",{className:"text-tui-muted",children:b.startTime?f("admin.startedAt",{time:new Date(b.startTime).toLocaleTimeString()}):f("admin.startedRecently")})})]}),u.jsxs(rn,{title:f("admin.throughput"),aside:f("admin.perSecond",{value:ze(((sn=b.throughput)==null?void 0:sn.bytesOutPerSec)||0)}),bodyClassName:"space-y-0.5",children:[u.jsxs(nl,{label:f("admin.bytesInTotal"),labelWidth:13,children:[u.jsx("span",{className:"font-bold text-tui-accent",children:ze(((On=b.throughput)==null?void 0:On.bytesIn)||0)}),u.jsx("span",{className:"ml-1.5 text-tui-faint",children:f("admin.perSecond",{value:ze(((kt=b.throughput)==null?void 0:kt.bytesInPerSec)||0)})})]}),u.jsxs(nl,{label:f("admin.bytesOutTotal"),labelWidth:13,children:[u.jsx("span",{className:"font-bold text-tui-ok",children:ze(((Fe=b.throughput)==null?void 0:Fe.bytesOut)||0)}),u.jsx("span",{className:"ml-1.5 text-tui-faint",children:f("admin.perSecond",{value:ze(((Vt=b.throughput)==null?void 0:Vt.bytesOutPerSec)||0)})})]}),u.jsx(La,{}),u.jsx(nl,{label:f("admin.frameRate"),labelWidth:13,children:u.jsx("span",{className:"font-bold",children:f("admin.framesPerSecond",{count:(((Yt=b.throughput)==null?void 0:Yt.framesOutPerSec)||0).toFixed(0)})})})]})]}),u.jsx(o0,{hosts:b.hosts||[],devices:b.devices})]}),R==="clients"&&u.jsx(r0,{clients:b.clients||[]}),R==="ptys"&&u.jsx(c0,{ptys:b.ptys||[]}),R==="devices"&&u.jsx(d0,{devices:b.devices||[],onRevoke:qe})]})]})},h0=({compact:o=!1})=>{const{role:a,connectionState:r,sharedWindowCount:c,assignedClientId:d,t:f}=Ct();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":f("terminal.offlineStatusAria"),children:[u.jsx(Jn,{level:"idle"}),u.jsx("span",{children:f("common.offline")})]});const m=a==="controller",b=c>1,S=u.jsxs("div",{className:P("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":f(m?"role.controllerMode":"role.viewerMode"),children:[u.jsx(Jn,{level:m?"ok":"warn"}),u.jsx("span",{className:"truncate",children:f(m?"role.sharedControl":"role.viewerReadOnly")}),b?u.jsx("span",{className:"shrink-0 normal-case text-tui-muted",children:f("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:f("role.sharedControlDesc")}),d?u.jsx(nl,{label:f("role.thisWindow"),labelWidth:9,className:"text-tui-sm",children:u.jsx("span",{className:"truncate text-tui-muted",children:d})}):null]})},jr="tui-focusable group flex h-11 w-full select-none items-center gap-2 border px-2 text-left text-tui transition-colors",Mr="border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",m0="border-tui-accent bg-tui-selection text-tui-accent",_r=({active:o=!1})=>u.jsx("span",{"aria-hidden":"true",className:P("shrink-0",o?"text-tui-accent":"text-tui-faint group-hover:text-tui-accent"),children:Ge.cursor}),p0=({onClose:o,onNavigateAdmin:a,showAdminEntry:r=!0,onOpenPairing:c,onOpenSettings:d,onAddProfile:f=()=>{}})=>{const{connectionState:p,stateDetail:m,rttMs:b,hostId:S,settings:v,updateSettings:C,connect:D,addToast:z,language:_,setLanguage:F,t:k}=Ct(),[I,ee]=dl.useState(!1),J=ro(p,k),ae=U=>()=>{var ne;const R=document.activeElement;(ne=R==null?void 0:R.blur)==null||ne.call(R),U()},ye=()=>{Ua(v.clientId).then(U=>{if(U==="failed"){z("error",k("clipboard.copyFailed"));return}ee(!0),z("info",k("toasts.clientIdCopied",{id:v.clientId})),setTimeout(()=>ee(!1),2e3)})},O=()=>{const U=_==="zh"?"en":"zh";F(U),z("info",Ou(U,"toasts.switchedLanguage",{lang:U==="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(He,{variant:"ghost",onClick:o,"aria-label":k("mobile.closeSessionControls"),children:"esc"})]}),u.jsx(rn,{title:k("profiles.title"),tone:"accent",bodyClassName:"space-y-1",children:u.jsx(Gu,{mobile:!0,onAddProfile:f})}),u.jsxs(rn,{title:k("common.status"),tone:J.level==="ok"?"ok":J.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(Jn,{level:J.level}),u.jsx("span",{className:"truncate text-tui uppercase text-tui-text",children:J.label}),p==="connected"&&b!==null&&u.jsxs("span",{className:"text-tui-sm text-tui-muted",children:[b,"ms"]})]}),J.actionLabel&&u.jsx(He,{variant:"primary",onClick:()=>D(),className:"shrink-0",children:J.actionLabel})]}),J.needsAttention&&m&&u.jsx("p",{className:"text-tui-sm leading-snug text-tui-muted",children:m}),S&&u.jsx(nl,{label:k("common.host"),labelWidth:9,children:S}),u.jsxs("button",{type:"button",onClick:ye,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:P("shrink-0",I?"text-tui-ok":"text-tui-faint"),children:I?Ge.check:"⧉"})]})]}),u.jsx(rn,{title:k("mobile.inputControl"),tone:"accent","aria-label":k("mobile.terminalControlAria"),children:u.jsx(h0,{})}),u.jsxs(rn,{title:k("mobile.menu"),tone:"accent",bodyClassName:"flex flex-col gap-1",children:[u.jsxs("button",{type:"button",onClick:O,className:P(jr,Mr),"aria-label":k("header.languageToggleTitle"),children:[u.jsx(_r,{}),u.jsx("span",{className:"truncate",children:_==="zh"?"English":"中文"})]}),u.jsxs("button",{type:"button",onClick:ae(d),className:P(jr,Mr),"aria-label":k("mobile.settingsAria"),children:[u.jsx(_r,{}),u.jsx("span",{className:"truncate",children:k("common.settings")})]}),u.jsxs("button",{type:"button",onClick:ae(c),className:P(jr,Mr),"aria-label":k("mobile.pairingAria"),children:[u.jsx(_r,{}),u.jsx("span",{className:"truncate",children:k("common.pairing")})]}),r&&u.jsxs("button",{type:"button",onClick:ae(a),className:P(jr,Mr),"aria-label":k("mobile.adminAria"),children:[u.jsx(_r,{}),u.jsx("span",{className:"truncate",children:k("common.admin")})]}),u.jsxs("button",{type:"button",onClick:()=>C({toolbarVisible:!v.toolbarVisible}),className:P(jr,v.toolbarVisible?m0:Mr),"aria-label":k("mobile.keybarAria"),"aria-pressed":v.toolbarVisible,children:[u.jsx(_r,{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]":"[ ]"})]})]})]})},g0=({onAddProfile:o})=>{const{rttMs:a,t:r}=Ct();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(Gu,{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:P(a===null?"text-tui-faint":"text-tui-text"),children:a===null?"—":`${a}ms`})]})]})},b0=({onNavigateAdmin:o,showAdminEntry:a=!0,onOpenPairing:r,onOpenSettings:c,onAddProfile:d=()=>{}})=>{const{connectionState:f,isController:p,t:m}=Ct(),[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 F=_.target;F&&typeof F.closest=="function"&&!!F.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 D=ro(f,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(qp,{className:"shrink-0"}),u.jsx(Jn,{level:D.level}),u.jsx("span",{className:"truncate uppercase",children:D.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:P("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",D.needsAttention?"border-tui-warn text-tui-warn":p?"border-tui-border text-tui-muted":"border-tui-accent text-tui-accent"),children:[!p&&!D.needsAttention&&u.jsx("span",{className:"max-w-[8rem] truncate",children:m("common.viewer")}),u.jsx("span",{"aria-hidden":"true",className:"text-tui",children:Ge.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(p0,{onClose:C,showAdminEntry:a,onNavigateAdmin:()=>{C(),o()},onOpenPairing:()=>{C(),r()},onOpenSettings:()=>{C(),c()},onAddProfile:()=>{C(),d()}})})]}),u.jsx(g0,{onAddProfile:d})]})},Pp="--app-height",$p="--keyboard-inset",y0=80;function v0(){if(typeof window>"u")return{height:768,keyboardInset:0};const o=window.innerHeight||768,a=window.visualViewport;if(a&&typeof a.height=="number"&&a.height>0){const r=o-a.height-(a.offsetTop||0),c=r>=y0?Math.round(r):0;return{height:Math.round(a.height),keyboardInset:c}}return{height:o,keyboardInset:0}}function sp(o,a=v0()){return o.style.setProperty(Pp,`${a.height}px`),o.style.setProperty($p,`${a.keyboardInset}px`),a}function x0(o=typeof document<"u"?document.documentElement:null){if(!o||typeof window>"u")return()=>{};let a=null;const r=()=>{a=null,sp(o)},c=()=>{if(a===null){if(typeof requestAnimationFrame!="function"){r();return}a=requestAnimationFrame(r)}};sp(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),()=>{a!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(a),a=null),d==null||d.removeEventListener("resize",c),d==null||d.removeEventListener("scroll",c),window.removeEventListener("resize",c),window.removeEventListener("orientationchange",c),o.style.removeProperty(Pp),o.style.removeProperty($p)}}const S0=900;function op(){if(typeof window>"u")return!1;const o=Ri();return o<ku?!0:o<=S0}function w0(){const[o,a]=y.useState(op);return y.useEffect(()=>{var d,f;const r=()=>{const p=op();a(m=>m===p?m:p)};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),(f=window.visualViewport)==null||f.addEventListener("resize",r),()=>{var p,m;(p=c==null?void 0:c.removeEventListener)==null||p.call(c,"change",r),window.removeEventListener("resize",r),window.removeEventListener("orientationchange",r),(m=window.visualViewport)==null||m.removeEventListener("resize",r)}},[]),o}function C0(o){const a=o.target;if(!a)return!1;if(a.id==="terminal-container"||a.id==="terminal-frame"||a.id==="terminal-surface"||a.classList.contains("xterm-helper-textarea")||a.classList.contains("xterm")||a.closest("#terminal-container")||a.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 T0(o,a={}){if(typeof window>"u")return()=>{};const r=c=>{var d;c.ctrlKey||c.altKey||c.metaKey||c.key==="Escape"&&(a.isModalOpen||a.isSheetOpen)&&(C0(c)||(c.preventDefault(),c.stopPropagation(),(d=o.onCloseModals)==null||d.call(o)))};return window.addEventListener("keydown",r),()=>{window.removeEventListener("keydown",r)}}function N0(){const[o,a]=y.useState("terminal"),[r,c]=y.useState(!1),[d,f]=y.useState(!1),[p,m]=y.useState(!1),[b,S]=y.useState(!1),{updateSettings:v,settings:C,connectionState:D,stateDetail:z,stateCode:_,lastPairedAt:F}=Ct(),k=w0();y.useEffect(()=>x0(),[]);const[I,ee]=y.useState(!0);y.useEffect(()=>{let fe=!1;return fetch("/api/info",{headers:{Accept:"application/json"}}).then(ke=>ke.ok?ke.json():null).then(ke=>{fe||!ke||ee(!ke.isRemoteRelay)}).catch(()=>{}),()=>{fe=!0}},[]),y.useEffect(()=>{Tp()},[]),y.useEffect(()=>{const fe=r||p||b;if(fe)return T0({onCloseModals:()=>{c(!1),m(!1),S(!1)}},{isModalOpen:fe})},[r,p,b]),y.useEffect(()=>{const fe=()=>{const ke=window.location.pathname,Oe=window.location.hash;a(ke==="/admin"||Oe==="#admin"?"admin":"terminal")};fe(),window.addEventListener("popstate",fe),window.addEventListener("hashchange",fe);try{const ke=new URL(window.location.href),Oe=ke.searchParams.get("token"),j=ke.searchParams.get("pairCode"),q=ke.searchParams.get("ws")||ke.searchParams.get("wsUrl"),W={};Oe&&(W.token=Oe),j&&(W.pairCode=j.toUpperCase()),q&&(W.wsUrl=q),Object.keys(W).length>0&&v(W);let Ce=!1;if(ke.searchParams.has("token")&&(ke.searchParams.delete("token"),Ce=!0),ke.searchParams.has("pairCode")&&(ke.searchParams.delete("pairCode"),Ce=!0),Ce){const H=ke.searchParams.toString(),qe=ke.pathname+(H?`?${H}`:"")+ke.hash;window.history.replaceState({},"",qe)}}catch(ke){console.warn("Failed to parse URL query params:",ke)}return()=>{window.removeEventListener("popstate",fe),window.removeEventListener("hashchange",fe)}},[]);const J=(fe=!1)=>{f(fe),c(!0)},ae=()=>{c(!1),f(!1)},ye=fe=>{a(fe),fe==="admin"?window.history.pushState({},"","/admin"):window.history.pushState({},"","/")},O=!C.token&&!C.pairCode&&D!=="connected",U=D==="error"&&(["auth_required","unauthorized","device_revoked"].includes(_||"")||/auth|unauthor|forbidden|permission|token|pair/i.test(z||"")),R=O||U,[ne,je]=y.useState(!R);y.useEffect(()=>{R||je(!0)},[R]),y.useEffect(()=>{F&&(c(!1),je(!0),a("terminal"))},[F]);const Me=o==="terminal"&&!R,Ee=fe=>({visibility:fe?"visible":"hidden",opacity:fe?1:0,pointerEvents:fe?"auto":"none",zIndex:fe?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:fe=>{fe.preventDefault(),fe.stopPropagation()},children:[!k&&u.jsx(nx,{currentView:o,onNavigate:ye,showAdminEntry:I,onOpenPairing:()=>J(!1),onOpenSettings:()=>m(!0),onToggleVirtualKeyboard:()=>S(!b),isVirtualKeyboardOpen:b}),!k&&!R&&u.jsx(lx,{}),u.jsxs("div",{className:"flex-1 min-h-0 w-full overflow-hidden relative",children:[ne&&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:Ee(Me),"aria-hidden":!Me,children:[u.jsx(Vx,{isActive:Me}),!k&&u.jsx(Jx,{isOpen:b,onClose:()=>S(!1)}),u.jsx(Qx,{compact:k})]}),o==="terminal"&&R&&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(Xx,{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(f0,{onBackToTerminal:()=>ye("terminal"),onOpenPairing:()=>J(!1)})}),k&&Me&&u.jsx(b0,{onNavigateAdmin:()=>ye("admin"),showAdminEntry:I,onOpenPairing:()=>J(!1),onOpenSettings:()=>m(!0),onAddProfile:()=>J(!0)})]}),!k&&o!=="admin"&&u.jsx(l0,{onAddProfile:()=>J(!0)}),u.jsx(Px,{isOpen:r,isAddMode:d,onClose:ae}),u.jsx($x,{isOpen:p,onClose:()=>m(!1)}),u.jsx(n0,{})]})}function E0(){return u.jsx(tv,{children:u.jsx(N0,{})})}const eg=document.getElementById("root");if(!eg)throw new Error("Root element not found");gy.createRoot(eg).render(u.jsx(dl.StrictMode,{children:u.jsx(E0,{})}));
|