herdr-remote-relay 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,43 @@
1
+ var uy=Object.defineProperty;var dy=(r,i,o)=>i in r?uy(r,i,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[i]=o;var _e=(r,i,o)=>dy(r,typeof i!="symbol"?i+"":i,o);import{r as fp,g as hp,a as mp}from"./vendor-react-CYSfZuHu.js";import{r as fy,a as hy,b as my}from"./vendor-xterm-Yo7-doCv.js";(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))c(d);new MutationObserver(d=>{for(const 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 o(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=o(d);fetch(d.href,f)}})();var ru={exports:{}},ys={};/**
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 Nm;function py(){if(Nm)return ys;Nm=1;var r=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function o(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:r,type:c,key:p,ref:d!==void 0?d:null,props:f}}return ys.Fragment=i,ys.jsx=o,ys.jsxs=o,ys}var Em;function gy(){return Em||(Em=1,ru.exports=py()),ru.exports}var u=gy(),v=fp();const tl=hp(v);var ou={exports:{}},vs={},cu={exports:{}},uu={};/**
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 Am;function by(){return Am||(Am=1,(function(r){function i(_,V){var $=_.length;_.push(V);e:for(;0<$;){var ze=$-1>>>1,I=_[ze];if(0<d(I,V))_[ze]=V,_[$]=I,$=ze;else break e}}function o(_){return _.length===0?null:_[0]}function c(_){if(_.length===0)return null;var V=_[0],$=_.pop();if($!==V){_[0]=$;e:for(var ze=0,I=_.length,ke=I>>>1;ze<ke;){var H=2*(ze+1)-1,Se=_[H],je=H+1,Ke=_[je];if(0>d(Se,$))je<I&&0>d(Ke,Se)?(_[ze]=Ke,_[je]=$,ze=je):(_[ze]=Se,_[H]=$,ze=H);else if(je<I&&0>d(Ke,$))_[ze]=Ke,_[je]=$,ze=je;else break e}}return V}function d(_,V){var $=_.sortIndex-V.sortIndex;return $!==0?$:_.id-V.id}if(r.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;r.unstable_now=function(){return f.now()}}else{var p=Date,m=p.now();r.unstable_now=function(){return p.now()-m}}var b=[],S=[],y=1,x=null,R=3,E=!1,k=!1,q=!1,z=!1,X=typeof setTimeout=="function"?setTimeout:null,Q=typeof clearTimeout=="function"?clearTimeout:null,Z=typeof setImmediate<"u"?setImmediate:null;function te(_){for(var V=o(S);V!==null;){if(V.callback===null)c(S);else if(V.startTime<=_)c(S),V.sortIndex=V.expirationTime,i(b,V);else break;V=o(S)}}function he(_){if(q=!1,te(_),!k)if(o(b)!==null)k=!0,L||(L=!0,xe());else{var V=o(S);V!==null&&Ye(he,V.startTime-_)}}var L=!1,O=-1,j=5,ee=-1;function be(){return z?!0:!(r.unstable_now()-ee<j)}function Ae(){if(z=!1,L){var _=r.unstable_now();ee=_;var V=!0;try{e:{k=!1,q&&(q=!1,Q(O),O=-1),E=!0;var $=R;try{t:{for(te(_),x=o(b);x!==null&&!(x.expirationTime>_&&be());){var ze=x.callback;if(typeof ze=="function"){x.callback=null,R=x.priorityLevel;var I=ze(x.expirationTime<=_);if(_=r.unstable_now(),typeof I=="function"){x.callback=I,te(_),V=!0;break t}x===o(b)&&c(b),te(_)}else c(b);x=o(b)}if(x!==null)V=!0;else{var ke=o(S);ke!==null&&Ye(he,ke.startTime-_),V=!1}}break e}finally{x=null,R=$,E=!1}V=void 0}}finally{V?xe():L=!1}}}var xe;if(typeof Z=="function")xe=function(){Z(Ae)};else if(typeof MessageChannel<"u"){var pe=new MessageChannel,Re=pe.port2;pe.port1.onmessage=Ae,xe=function(){Re.postMessage(null)}}else xe=function(){X(Ae,0)};function Ye(_,V){O=X(function(){_(r.unstable_now())},V)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function(_){_.callback=null},r.unstable_forceFrameRate=function(_){0>_||125<_?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):j=0<_?Math.floor(1e3/_):5},r.unstable_getCurrentPriorityLevel=function(){return R},r.unstable_next=function(_){switch(R){case 1:case 2:case 3:var V=3;break;default:V=R}var $=R;R=V;try{return _()}finally{R=$}},r.unstable_requestPaint=function(){z=!0},r.unstable_runWithPriority=function(_,V){switch(_){case 1:case 2:case 3:case 4:case 5:break;default:_=3}var $=R;R=_;try{return V()}finally{R=$}},r.unstable_scheduleCallback=function(_,V,$){var ze=r.unstable_now();switch(typeof $=="object"&&$!==null?($=$.delay,$=typeof $=="number"&&0<$?ze+$:ze):$=ze,_){case 1:var I=-1;break;case 2:I=250;break;case 5:I=1073741823;break;case 4:I=1e4;break;default:I=5e3}return I=$+I,_={id:y++,callback:V,priorityLevel:_,startTime:$,expirationTime:I,sortIndex:-1},$>ze?(_.sortIndex=$,i(S,_),o(b)===null&&_===o(S)&&(q?(Q(O),O=-1):q=!0,Ye(he,$-ze))):(_.sortIndex=I,i(b,_),k||E||(k=!0,L||(L=!0,xe()))),_},r.unstable_shouldYield=be,r.unstable_wrapCallback=function(_){var V=R;return function(){var $=R;R=V;try{return _.apply(this,arguments)}finally{R=$}}}})(uu)),uu}var Rm;function yy(){return Rm||(Rm=1,cu.exports=by()),cu.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 jm;function vy(){if(jm)return vs;jm=1;var r=yy(),i=fp(),o=mp();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 a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(l=a.return,l!==null){n=l;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return b(a),e;if(s===l)return b(a),t;s=s.sibling}throw Error(c(188))}if(n.return!==l.return)n=a,l=s;else{for(var h=!1,g=a.child;g;){if(g===n){h=!0,n=a,l=s;break}if(g===l){h=!0,l=a,n=s;break}g=g.sibling}if(!h){for(g=s.child;g;){if(g===n){h=!0,n=s,l=a;break}if(g===l){h=!0,l=s,n=a;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 y(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=y(e),t!==null)return t;e=e.sibling}return null}var x=Object.assign,R=Symbol.for("react.element"),E=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),q=Symbol.for("react.fragment"),z=Symbol.for("react.strict_mode"),X=Symbol.for("react.profiler"),Q=Symbol.for("react.consumer"),Z=Symbol.for("react.context"),te=Symbol.for("react.forward_ref"),he=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),ee=Symbol.for("react.activity"),be=Symbol.for("react.memo_cache_sentinel"),Ae=Symbol.iterator;function xe(e){return e===null||typeof e!="object"?null:(e=Ae&&e[Ae]||e["@@iterator"],typeof e=="function"?e:null)}var pe=Symbol.for("react.client.reference");function Re(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===pe?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case q:return"Fragment";case X:return"Profiler";case z:return"StrictMode";case he:return"Suspense";case L:return"SuspenseList";case ee:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case k:return"Portal";case Z:return e.displayName||"Context";case Q:return(e._context.displayName||"Context")+".Consumer";case te:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case O:return t=e.displayName||null,t!==null?t:Re(e.type)||"Memo";case j:t=e._payload,e=e._init;try{return Re(e(t))}catch{}}return null}var Ye=Array.isArray,_=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=o.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$={pending:!1,data:null,method:null,action:null},ze=[],I=-1;function ke(e){return{current:e}}function H(e){0>I||(e.current=ze[I],ze[I]=null,I--)}function Se(e,t){I++,ze[I]=e.current,e.current=t}var je=ke(null),Ke=ke(null),Be=ke(null),Pe=ke(null);function Oe(e,t){switch(Se(Be,t),Se(Ke,e),Se(je,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=Ih(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}H(je),Se(je,e)}function $e(){H(je),H(Ke),H(Be)}function Ve(e){e.memoizedState!==null&&Se(Pe,e);var t=je.current,n=Ih(t,e.type);t!==n&&(Se(Ke,e),Se(je,n))}function nt(e){Ke.current===e&&(H(je),H(Ke)),Pe.current===e&&(H(Pe),ms._currentValue=$)}var Xe,Et;function ft(e){if(Xe===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Xe=t&&t[1]||"",Et=-1<n.stack.indexOf(`
26
+ at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
27
+ `+Xe+e+Et}var Xt=!1;function on(e,t){if(!e||Xt)return"";Xt=!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(D){var M=D}Reflect.construct(e,[],G)}else{try{G.call()}catch(D){M=D}e.call(G.prototype)}}else{try{throw Error()}catch(D){M=D}(G=e())&&typeof G.catch=="function"&&G.catch(function(){})}}catch(D){if(D&&M&&typeof D.stack=="string")return[D.stack,M.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var a=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");a&&a.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var s=l.DetermineComponentFrameRoot(),h=s[0],g=s[1];if(h&&g){var w=h.split(`
28
+ `),A=g.split(`
29
+ `);for(a=l=0;l<w.length&&!w[l].includes("DetermineComponentFrameRoot");)l++;for(;a<A.length&&!A[a].includes("DetermineComponentFrameRoot");)a++;if(l===w.length||a===A.length)for(l=w.length-1,a=A.length-1;1<=l&&0<=a&&w[l]!==A[a];)a--;for(;1<=l&&0<=a;l--,a--)if(w[l]!==A[a]){if(l!==1||a!==1)do if(l--,a--,0>a||w[l]!==A[a]){var B=`
30
+ `+w[l].replace(" at new "," at ");return e.displayName&&B.includes("<anonymous>")&&(B=B.replace("<anonymous>",e.displayName)),B}while(1<=l&&0<=a);break}}}finally{Xt=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?ft(n):""}function nl(e,t){switch(e.tag){case 26:case 27:case 5:return ft(e.type);case 16:return ft("Lazy");case 13:return e.child!==t&&t!==null?ft("Suspense Fallback"):ft("Suspense");case 19:return ft("SuspenseList");case 0:case 15:return on(e.type,!1);case 11:return on(e.type.render,!1);case 1:return on(e.type,!0);case 31:return ft("Activity");default:return""}}function St(e){try{var t="",n=null;do t+=nl(e,n),n=e,e=e.return;while(e);return t}catch(l){return`
31
+ Error generating stack: `+l.message+`
32
+ `+l.stack}}var st=Object.prototype.hasOwnProperty,wt=r.unstable_scheduleCallback,tn=r.unstable_cancelCallback,cn=r.unstable_shouldYield,Pt=r.unstable_requestPaint,ne=r.unstable_now,we=r.unstable_getCurrentPriorityLevel,Me=r.unstable_ImmediatePriority,et=r.unstable_UserBlockingPriority,Fe=r.unstable_NormalPriority,nn=r.unstable_LowPriority,Gt=r.unstable_IdlePriority,At=r.log,ln=r.unstable_setDisableYieldValue,ll=null,Ze=null;function xn(e){if(typeof At=="function"&&ln(e),Ze&&typeof Ze.setStrictMode=="function")try{Ze.setStrictMode(ll,e)}catch{}}var kt=Math.clz32?Math.clz32:Xn,La=Math.log,Oa=Math.LN2;function Xn(e){return e>>>=0,e===0?32:31-(La(e)/Oa|0)|0}var $t=256,Sn=262144,_n=4194304;function Fn(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 pl(e,t,n){var l=e.pendingLanes;if(l===0)return 0;var a=0,s=e.suspendedLanes,h=e.pingedLanes;e=e.warmLanes;var g=l&134217727;return g!==0?(l=g&~s,l!==0?a=Fn(l):(h&=g,h!==0?a=Fn(h):n||(n=g&~e,n!==0&&(a=Fn(n))))):(g=l&~s,g!==0?a=Fn(g):h!==0?a=Fn(h):n||(n=l&~e,n!==0&&(a=Fn(n)))),a===0?0:t!==0&&t!==a&&(t&s)===0&&(s=a&-a,n=t&-t,s>=n||s===32&&(n&4194048)!==0)?t:a}function al(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ua(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 ca(){var e=_n;return _n<<=1,(_n&62914560)===0&&(_n=4194304),e}function il(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function zn(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ua(e,t,n,l,a,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,w=e.expirationTimes,A=e.hiddenUpdates;for(n=h&~n;0<n;){var B=31-kt(n),G=1<<B;g[B]=0,w[B]=-1;var M=A[B];if(M!==null)for(A[B]=null,B=0;B<M.length;B++){var D=M[B];D!==null&&(D.lane&=-536870913)}n&=~G}l!==0&&Ba(e,l,0),s!==0&&a===0&&e.tag!==0&&(e.suspendedLanes|=s&~(h&~t))}function Ba(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-kt(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|n&261930}function Ha(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var l=31-kt(n),a=1<<l;a&t|e[l]&t&&(e[l]|=t),n&=~a}}function Ya(e,t){var n=t&-t;return n=(n&42)!==0?1:U(n),(n&(e.suspendedLanes|t))!==0?0:n}function U(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=V.p;return e!==0?e:(e=window.event,e===void 0?32:ym(e.type))}function Ce(e,t){var n=V.p;try{return V.p=e,t()}finally{V.p=n}}var ge=Math.random().toString(36).slice(2),me="__reactFiber$"+ge,Te="__reactProps$"+ge,_t="__reactContainer$"+ge,yt="__reactEvents$"+ge,gl="__reactListeners$"+ge,sl="__reactHandles$"+ge,un="__reactResources$"+ge,rl="__reactMarker$"+ge;function Ka(e){delete e[me],delete e[Te],delete e[yt],delete e[gl],delete e[sl]}function F(e){var t=e[me];if(t)return t;for(var n=e.parentNode;n;){if(t=n[_t]||n[me]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=nm(e);e!==null;){if(n=e[me])return n;e=nm(e)}return t}e=n,n=e.parentNode}return null}function J(e){if(e=e[me]||e[_t]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function de(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(c(33))}function ae(e){var t=e[un];return t||(t=e[un]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function ye(e){e[rl]=!0}var le=new Set,Ft={};function Ct(e,t){Rt(e,t),Rt(e+"Capture",t)}function Rt(e,t){for(Ft[e]=t,e=0;e<t.length;e++)le.add(t[e])}var pt=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]*$"),wn={},Dn={};function ol(e){return st.call(Dn,e)?!0:st.call(wn,e)?!1:pt.test(e)?Dn[e]=!0:(wn[e]=!0,!1)}function Ol(e,t,n){if(ol(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 Ga(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 Zn(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 dn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function zs(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ao(e,t,n){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var a=l.get,s=l.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(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 Ri(e){if(!e._valueTracker){var t=zs(e)?"checked":"value";e._valueTracker=ao(e,t,""+e[t])}}function an(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),l="";return e&&(l=zs(e)?e.checked?"true":"false":e.value),e=l,e!==n?(t.setValue(e),!0):!1}function qa(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 io=/[\n"\\]/g;function qt(e){return e.replace(io,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Cn(e,t,n,l,a,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=""+dn(t)):e.value!==""+dn(t)&&(e.value=""+dn(t)):h!=="submit"&&h!=="reset"||e.removeAttribute("value"),t!=null?Va(e,h,dn(t)):n!=null?Va(e,h,dn(n)):l!=null&&e.removeAttribute("value"),a==null&&s!=null&&(e.defaultChecked=!!s),a!=null&&(e.checked=a&&typeof a!="function"&&typeof a!="symbol"),g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"?e.name=""+dn(g):e.removeAttribute("name")}function ji(e,t,n,l,a,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)){Ri(e);return}n=n!=null?""+dn(n):"",t=t!=null?""+dn(t):n,g||t===e.value||(e.value=t),e.defaultValue=t}l=l??a,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),Ri(e)}function Va(e,t,n){t==="number"&&qa(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Qn(e,t,n,l){if(e=e.options,t){t={};for(var a=0;a<n.length;a++)t["$"+n[a]]=!0;for(n=0;n<e.length;n++)a=t.hasOwnProperty("$"+e[n].value),e[n].selected!==a&&(e[n].selected=a),a&&l&&(e[n].defaultSelected=!0)}else{for(n=""+dn(n),t=null,a=0;a<e.length;a++){if(e[a].value===n){e[a].selected=!0,l&&(e[a].defaultSelected=!0);return}t!==null||e[a].disabled||(t=e[a])}t!==null&&(t.selected=!0)}}function da(e,t,n){if(t!=null&&(t=""+dn(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+dn(n):""}function fa(e,t,n,l){if(t==null){if(l!=null){if(n!=null)throw Error(c(92));if(Ye(l)){if(1<l.length)throw Error(c(93));l=l[0]}n=l}n==null&&(n=""),t=n}n=dn(t),e.defaultValue=n,l=e.textContent,l===n&&l!==""&&l!==null&&(e.value=l),Ri(e)}function bl(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ds=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 P(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||Ds.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function oe(e,t,n){if(t!=null&&typeof t!="object")throw Error(c(62));if(e=e.style,n!=null){for(var l in n)!n.hasOwnProperty(l)||t!=null&&t.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var a in t)l=t[a],t.hasOwnProperty(a)&&n[a]!==l&&P(e,a,l)}else for(var s in t)t.hasOwnProperty(s)&&P(e,s,t[s])}function De(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 Ht=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"]]),fn=/^[\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 sn(e){return fn.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ue(){}var zt=null;function ht(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Dt=null,Zt=null;function cl(e){var t=J(e);if(t&&(e=t.stateNode)){var n=e[Te]||null;e:switch(e=t.stateNode,t.type){case"input":if(Cn(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="'+qt(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var l=n[t];if(l!==e&&l.form===e.form){var a=l[Te]||null;if(!a)throw Error(c(90));Cn(l,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)l=n[t],l.form===e.form&&an(l)}break e;case"textarea":da(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&Qn(e,!!n.multiple,t,!1)}}}var In=!1;function Mi(e,t,n){if(In)return e(t,n);In=!0;try{var l=e(t);return l}finally{if(In=!1,(Dt!==null||Zt!==null)&&(Sr(),Dt&&(t=Dt,e=Zt,Zt=Dt=null,cl(t),e)))for(t=0;t<e.length;t++)cl(e[t])}}function ki(e,t){var n=e.stateNode;if(n===null)return null;var l=n[Te]||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 yl=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),so=!1;if(yl)try{var _i={};Object.defineProperty(_i,"passive",{get:function(){so=!0}}),window.addEventListener("test",_i,_i),window.removeEventListener("test",_i,_i)}catch{so=!1}var Ul=null,ro=null,Ls=null;function Qu(){if(Ls)return Ls;var e,t=ro,n=t.length,l,a="value"in Ul?Ul.value:Ul.textContent,s=a.length;for(e=0;e<n&&t[e]===a[e];e++);var h=n-e;for(l=1;l<=h&&t[n-l]===a[s-l];l++);return Ls=a.slice(e,1<l?1-l:void 0)}function Os(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 Us(){return!0}function Iu(){return!1}function hn(e){function t(n,l,a,s,h){this._reactName=n,this._targetInst=a,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)?Us:Iu,this.isPropagationStopped=Iu,this}return x(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=Us)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Us)},persist:function(){},isPersistent:Us}),t}var ha={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Bs=hn(ha),zi=x({},ha,{view:0,detail:0}),og=hn(zi),oo,co,Di,Hs=x({},zi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:fo,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!==Di&&(Di&&e.type==="mousemove"?(oo=e.screenX-Di.screenX,co=e.screenY-Di.screenY):co=oo=0,Di=e),oo)},movementY:function(e){return"movementY"in e?e.movementY:co}}),Ju=hn(Hs),cg=x({},Hs,{dataTransfer:0}),ug=hn(cg),dg=x({},zi,{relatedTarget:0}),uo=hn(dg),fg=x({},ha,{animationName:0,elapsedTime:0,pseudoElement:0}),hg=hn(fg),mg=x({},ha,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),pg=hn(mg),gg=x({},ha,{data:0}),Wu=hn(gg),bg={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},yg={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"},vg={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function xg(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=vg[e])?!!t[e]:!1}function fo(){return xg}var Sg=x({},zi,{key:function(e){if(e.key){var t=bg[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Os(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?yg[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:fo,charCode:function(e){return e.type==="keypress"?Os(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Os(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),wg=hn(Sg),Cg=x({},Hs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Pu=hn(Cg),Tg=x({},zi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:fo}),Ng=hn(Tg),Eg=x({},ha,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ag=hn(Eg),Rg=x({},Hs,{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}),jg=hn(Rg),Mg=x({},ha,{newState:0,oldState:0}),kg=hn(Mg),_g=[9,13,27,32],ho=yl&&"CompositionEvent"in window,Li=null;yl&&"documentMode"in document&&(Li=document.documentMode);var zg=yl&&"TextEvent"in window&&!Li,$u=yl&&(!ho||Li&&8<Li&&11>=Li),ed=" ",td=!1;function nd(e,t){switch(e){case"keyup":return _g.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ld(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Xa=!1;function Dg(e,t){switch(e){case"compositionend":return ld(t);case"keypress":return t.which!==32?null:(td=!0,ed);case"textInput":return e=t.data,e===ed&&td?null:e;default:return null}}function Lg(e,t){if(Xa)return e==="compositionend"||!ho&&nd(e,t)?(e=Qu(),Ls=ro=Ul=null,Xa=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return $u&&t.locale!=="ko"?null:t.data;default:return null}}var Og={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 ad(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Og[e.type]:t==="textarea"}function id(e,t,n,l){Dt?Zt?Zt.push(l):Zt=[l]:Dt=l,t=Rr(t,"onChange"),0<t.length&&(n=new Bs("onChange","change",null,n,l),e.push({event:n,listeners:t}))}var Oi=null,Ui=null;function Ug(e){Gh(e,0)}function Ys(e){var t=de(e);if(an(t))return e}function sd(e,t){if(e==="change")return t}var rd=!1;if(yl){var mo;if(yl){var po="oninput"in document;if(!po){var od=document.createElement("div");od.setAttribute("oninput","return;"),po=typeof od.oninput=="function"}mo=po}else mo=!1;rd=mo&&(!document.documentMode||9<document.documentMode)}function cd(){Oi&&(Oi.detachEvent("onpropertychange",ud),Ui=Oi=null)}function ud(e){if(e.propertyName==="value"&&Ys(Ui)){var t=[];id(t,Ui,e,ht(e)),Mi(Ug,t)}}function Bg(e,t,n){e==="focusin"?(cd(),Oi=t,Ui=n,Oi.attachEvent("onpropertychange",ud)):e==="focusout"&&cd()}function Hg(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ys(Ui)}function Yg(e,t){if(e==="click")return Ys(t)}function Kg(e,t){if(e==="input"||e==="change")return Ys(t)}function Gg(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Tn=typeof Object.is=="function"?Object.is:Gg;function Bi(e,t){if(Tn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),l=Object.keys(t);if(n.length!==l.length)return!1;for(l=0;l<n.length;l++){var a=n[l];if(!st.call(t,a)||!Tn(e[a],t[a]))return!1}return!0}function dd(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function fd(e,t){var n=dd(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=dd(n)}}function hd(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?hd(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function md(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=qa(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=qa(e.document)}return t}function go(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 qg=yl&&"documentMode"in document&&11>=document.documentMode,Fa=null,bo=null,Hi=null,yo=!1;function pd(e,t,n){var l=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;yo||Fa==null||Fa!==qa(l)||(l=Fa,"selectionStart"in l&&go(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}),Hi&&Bi(Hi,l)||(Hi=l,l=Rr(bo,"onSelect"),0<l.length&&(t=new Bs("onSelect","select",null,t,n),e.push({event:t,listeners:l}),t.target=Fa)))}function ma(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Za={animationend:ma("Animation","AnimationEnd"),animationiteration:ma("Animation","AnimationIteration"),animationstart:ma("Animation","AnimationStart"),transitionrun:ma("Transition","TransitionRun"),transitionstart:ma("Transition","TransitionStart"),transitioncancel:ma("Transition","TransitionCancel"),transitionend:ma("Transition","TransitionEnd")},vo={},gd={};yl&&(gd=document.createElement("div").style,"AnimationEvent"in window||(delete Za.animationend.animation,delete Za.animationiteration.animation,delete Za.animationstart.animation),"TransitionEvent"in window||delete Za.transitionend.transition);function pa(e){if(vo[e])return vo[e];if(!Za[e])return e;var t=Za[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in gd)return vo[e]=t[n];return e}var bd=pa("animationend"),yd=pa("animationiteration"),vd=pa("animationstart"),Vg=pa("transitionrun"),Xg=pa("transitionstart"),Fg=pa("transitioncancel"),xd=pa("transitionend"),Sd=new Map,xo="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(" ");xo.push("scrollEnd");function Jn(e,t){Sd.set(e,t),Ct(t,[e])}var Ks=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)},Ln=[],Qa=0,So=0;function Gs(){for(var e=Qa,t=So=Qa=0;t<e;){var n=Ln[t];Ln[t++]=null;var l=Ln[t];Ln[t++]=null;var a=Ln[t];Ln[t++]=null;var s=Ln[t];if(Ln[t++]=null,l!==null&&a!==null){var h=l.pending;h===null?a.next=a:(a.next=h.next,h.next=a),l.pending=a}s!==0&&wd(n,a,s)}}function qs(e,t,n,l){Ln[Qa++]=e,Ln[Qa++]=t,Ln[Qa++]=n,Ln[Qa++]=l,So|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function wo(e,t,n,l){return qs(e,t,n,l),Vs(e)}function ga(e,t){return qs(e,null,null,t),Vs(e)}function wd(e,t,n){e.lanes|=n;var l=e.alternate;l!==null&&(l.lanes|=n);for(var a=!1,s=e.return;s!==null;)s.childLanes|=n,l=s.alternate,l!==null&&(l.childLanes|=n),s.tag===22&&(e=s.stateNode,e===null||e._visibility&1||(a=!0)),e=s,s=s.return;return e.tag===3?(s=e.stateNode,a&&t!==null&&(a=31-kt(n),e=s.hiddenUpdates,l=e[a],l===null?e[a]=[t]:l.push(t),t.lane=n|536870912),s):null}function Vs(e){if(50<rs)throw rs=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 Ia={};function Zg(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 Nn(e,t,n,l){return new Zg(e,t,n,l)}function Co(e){return e=e.prototype,!(!e||!e.isReactComponent)}function vl(e,t){var n=e.alternate;return n===null?(n=Nn(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 Cd(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 Xs(e,t,n,l,a,s){var h=0;if(l=e,typeof e=="function")Co(e)&&(h=1);else if(typeof e=="string")h=Pb(e,n,je.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case ee:return e=Nn(31,n,t,a),e.elementType=ee,e.lanes=s,e;case q:return ba(n.children,a,s,t);case z:h=8,a|=24;break;case X:return e=Nn(12,n,t,a|2),e.elementType=X,e.lanes=s,e;case he:return e=Nn(13,n,t,a),e.elementType=he,e.lanes=s,e;case L:return e=Nn(19,n,t,a),e.elementType=L,e.lanes=s,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Z:h=10;break e;case Q:h=9;break e;case te:h=11;break e;case O:h=14;break e;case j:h=16,l=null;break e}h=29,n=Error(c(130,e===null?"null":typeof e,"")),l=null}return t=Nn(h,n,t,a),t.elementType=e,t.type=l,t.lanes=s,t}function ba(e,t,n,l){return e=Nn(7,e,l,t),e.lanes=n,e}function To(e,t,n){return e=Nn(6,e,null,t),e.lanes=n,e}function Td(e){var t=Nn(18,null,null,0);return t.stateNode=e,t}function No(e,t,n){return t=Nn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Nd=new WeakMap;function On(e,t){if(typeof e=="object"&&e!==null){var n=Nd.get(e);return n!==void 0?n:(t={value:e,source:t,stack:St(t)},Nd.set(e,t),t)}return{value:e,source:t,stack:St(t)}}var Ja=[],Wa=0,Fs=null,Yi=0,Un=[],Bn=0,Bl=null,ul=1,dl="";function xl(e,t){Ja[Wa++]=Yi,Ja[Wa++]=Fs,Fs=e,Yi=t}function Ed(e,t,n){Un[Bn++]=ul,Un[Bn++]=dl,Un[Bn++]=Bl,Bl=e;var l=ul;e=dl;var a=32-kt(l)-1;l&=~(1<<a),n+=1;var s=32-kt(t)+a;if(30<s){var h=a-a%5;s=(l&(1<<h)-1).toString(32),l>>=h,a-=h,ul=1<<32-kt(t)+a|n<<a|l,dl=s+e}else ul=1<<s|n<<a|l,dl=e}function Eo(e){e.return!==null&&(xl(e,1),Ed(e,1,0))}function Ao(e){for(;e===Fs;)Fs=Ja[--Wa],Ja[Wa]=null,Yi=Ja[--Wa],Ja[Wa]=null;for(;e===Bl;)Bl=Un[--Bn],Un[Bn]=null,dl=Un[--Bn],Un[Bn]=null,ul=Un[--Bn],Un[Bn]=null}function Ad(e,t){Un[Bn++]=ul,Un[Bn++]=dl,Un[Bn++]=Bl,ul=t.id,dl=t.overflow,Bl=e}var Qt=null,gt=null,tt=!1,Hl=null,Hn=!1,Ro=Error(c(519));function Yl(e){var t=Error(c(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ki(On(t,e)),Ro}function Rd(e){var t=e.stateNode,n=e.type,l=e.memoizedProps;switch(t[me]=e,t[Te]=l,n){case"dialog":Ie("cancel",t),Ie("close",t);break;case"iframe":case"object":case"embed":Ie("load",t);break;case"video":case"audio":for(n=0;n<cs.length;n++)Ie(cs[n],t);break;case"source":Ie("error",t);break;case"img":case"image":case"link":Ie("error",t),Ie("load",t);break;case"details":Ie("toggle",t);break;case"input":Ie("invalid",t),ji(t,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Ie("invalid",t);break;case"textarea":Ie("invalid",t),fa(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||Fh(t.textContent,n)?(l.popover!=null&&(Ie("beforetoggle",t),Ie("toggle",t)),l.onScroll!=null&&Ie("scroll",t),l.onScrollEnd!=null&&Ie("scrollend",t),l.onClick!=null&&(t.onclick=ue),t=!0):t=!1,t||Yl(e,!0)}function jd(e){for(Qt=e.return;Qt;)switch(Qt.tag){case 5:case 31:case 13:Hn=!1;return;case 27:case 3:Hn=!0;return;default:Qt=Qt.return}}function Pa(e){if(e!==Qt)return!1;if(!tt)return jd(e),tt=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||Fc(e.type,e.memoizedProps)),n=!n),n&&gt&&Yl(e),jd(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(317));gt=tm(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(317));gt=tm(e)}else t===27?(t=gt,ea(e.type)?(e=Wc,Wc=null,gt=e):gt=t):gt=Qt?Kn(e.stateNode.nextSibling):null;return!0}function ya(){gt=Qt=null,tt=!1}function jo(){var e=Hl;return e!==null&&(bn===null?bn=e:bn.push.apply(bn,e),Hl=null),e}function Ki(e){Hl===null?Hl=[e]:Hl.push(e)}var Mo=ke(null),va=null,Sl=null;function Kl(e,t,n){Se(Mo,t._currentValue),t._currentValue=n}function wl(e){e._currentValue=Mo.current,H(Mo)}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 _o(e,t,n,l){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var s=a.dependencies;if(s!==null){var h=a.child;s=s.firstContext;e:for(;s!==null;){var g=s;s=a;for(var w=0;w<t.length;w++)if(g.context===t[w]){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(a.tag===18){if(h=a.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=a.child;if(h!==null)h.return=a;else for(h=a;h!==null;){if(h===e){h=null;break}if(a=h.sibling,a!==null){a.return=h.return,h=a;break}h=h.return}a=h}}function $a(e,t,n,l){e=null;for(var a=t,s=!1;a!==null;){if(!s){if((a.flags&524288)!==0)s=!0;else if((a.flags&262144)!==0)break}if(a.tag===10){var h=a.alternate;if(h===null)throw Error(c(387));if(h=h.memoizedProps,h!==null){var g=a.type;Tn(a.pendingProps.value,h.value)||(e!==null?e.push(g):e=[g])}}else if(a===Pe.current){if(h=a.alternate,h===null)throw Error(c(387));h.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e!==null?e.push(ms):e=[ms])}a=a.return}e!==null&&_o(t,e,n,l),t.flags|=262144}function Zs(e){for(e=e.firstContext;e!==null;){if(!Tn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function xa(e){va=e,Sl=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function It(e){return Md(va,e)}function Qs(e,t){return va===null&&xa(e),Md(e,t)}function Md(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Sl===null){if(e===null)throw Error(c(308));Sl=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Sl=Sl.next=t;return n}var Qg=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()})}},Ig=r.unstable_scheduleCallback,Jg=r.unstable_NormalPriority,Lt={$$typeof:Z,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function zo(){return{controller:new Qg,data:new Map,refCount:0}}function Gi(e){e.refCount--,e.refCount===0&&Ig(Jg,function(){e.controller.abort()})}var qi=null,Do=0,ei=0,ti=null;function Wg(e,t){if(qi===null){var n=qi=[];Do=0,ei=Uc(),ti={status:"pending",value:void 0,then:function(l){n.push(l)}}}return Do++,t.then(kd,kd),t}function kd(){if(--Do===0&&qi!==null){ti!==null&&(ti.status="fulfilled");var e=qi;qi=null,ei=0,ti=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Pg(e,t){var n=[],l={status:"pending",value:null,reason:null,then:function(a){n.push(a)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var a=0;a<n.length;a++)(0,n[a])(t)},function(a){for(l.status="rejected",l.reason=a,a=0;a<n.length;a++)(0,n[a])(void 0)}),l}var _d=_.S;_.S=function(e,t){gh=ne(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&Wg(e,t),_d!==null&&_d(e,t)};var Sa=ke(null);function Lo(){var e=Sa.current;return e!==null?e:mt.pooledCache}function Is(e,t){t===null?Se(Sa,Sa.current):Se(Sa,t.pool)}function zd(){var e=Lo();return e===null?null:{parent:Lt._currentValue,pool:e}}var ni=Error(c(460)),Oo=Error(c(474)),Js=Error(c(542)),Ws={then:function(){}};function Dd(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Ld(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(ue,ue),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Ud(e),e;default:if(typeof t.status=="string")t.then(ue,ue);else{if(e=mt,e!==null&&100<e.shellSuspendCounter)throw Error(c(482));e=t,e.status="pending",e.then(function(l){if(t.status==="pending"){var a=t;a.status="fulfilled",a.value=l}},function(l){if(t.status==="pending"){var a=t;a.status="rejected",a.reason=l}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Ud(e),e}throw Ca=t,ni}}function wa(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Ca=n,ni):n}}var Ca=null;function Od(){if(Ca===null)throw Error(c(459));var e=Ca;return Ca=null,e}function Ud(e){if(e===ni||e===Js)throw Error(c(483))}var li=null,Vi=0;function Ps(e){var t=Vi;return Vi+=1,li===null&&(li=[]),Ld(li,e,t)}function Xi(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function $s(e,t){throw t.$$typeof===R?Error(c(525)):(e=Object.prototype.toString.call(t),Error(c(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Bd(e){function t(T,C){if(e){var N=T.deletions;N===null?(T.deletions=[C],T.flags|=16):N.push(C)}}function n(T,C){if(!e)return null;for(;C!==null;)t(T,C),C=C.sibling;return null}function l(T){for(var C=new Map;T!==null;)T.key!==null?C.set(T.key,T):C.set(T.index,T),T=T.sibling;return C}function a(T,C){return T=vl(T,C),T.index=0,T.sibling=null,T}function s(T,C,N){return T.index=N,e?(N=T.alternate,N!==null?(N=N.index,N<C?(T.flags|=67108866,C):N):(T.flags|=67108866,C)):(T.flags|=1048576,C)}function h(T){return e&&T.alternate===null&&(T.flags|=67108866),T}function g(T,C,N,K){return C===null||C.tag!==6?(C=To(N,T.mode,K),C.return=T,C):(C=a(C,N),C.return=T,C)}function w(T,C,N,K){var ve=N.type;return ve===q?B(T,C,N.props.children,K,N.key):C!==null&&(C.elementType===ve||typeof ve=="object"&&ve!==null&&ve.$$typeof===j&&wa(ve)===C.type)?(C=a(C,N.props),Xi(C,N),C.return=T,C):(C=Xs(N.type,N.key,N.props,null,T.mode,K),Xi(C,N),C.return=T,C)}function A(T,C,N,K){return C===null||C.tag!==4||C.stateNode.containerInfo!==N.containerInfo||C.stateNode.implementation!==N.implementation?(C=No(N,T.mode,K),C.return=T,C):(C=a(C,N.children||[]),C.return=T,C)}function B(T,C,N,K,ve){return C===null||C.tag!==7?(C=ba(N,T.mode,K,ve),C.return=T,C):(C=a(C,N),C.return=T,C)}function G(T,C,N){if(typeof C=="string"&&C!==""||typeof C=="number"||typeof C=="bigint")return C=To(""+C,T.mode,N),C.return=T,C;if(typeof C=="object"&&C!==null){switch(C.$$typeof){case E:return N=Xs(C.type,C.key,C.props,null,T.mode,N),Xi(N,C),N.return=T,N;case k:return C=No(C,T.mode,N),C.return=T,C;case j:return C=wa(C),G(T,C,N)}if(Ye(C)||xe(C))return C=ba(C,T.mode,N,null),C.return=T,C;if(typeof C.then=="function")return G(T,Ps(C),N);if(C.$$typeof===Z)return G(T,Qs(T,C),N);$s(T,C)}return null}function M(T,C,N,K){var ve=C!==null?C.key:null;if(typeof N=="string"&&N!==""||typeof N=="number"||typeof N=="bigint")return ve!==null?null:g(T,C,""+N,K);if(typeof N=="object"&&N!==null){switch(N.$$typeof){case E:return N.key===ve?w(T,C,N,K):null;case k:return N.key===ve?A(T,C,N,K):null;case j:return N=wa(N),M(T,C,N,K)}if(Ye(N)||xe(N))return ve!==null?null:B(T,C,N,K,null);if(typeof N.then=="function")return M(T,C,Ps(N),K);if(N.$$typeof===Z)return M(T,C,Qs(T,N),K);$s(T,N)}return null}function D(T,C,N,K,ve){if(typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint")return T=T.get(N)||null,g(C,T,""+K,ve);if(typeof K=="object"&&K!==null){switch(K.$$typeof){case E:return T=T.get(K.key===null?N:K.key)||null,w(C,T,K,ve);case k:return T=T.get(K.key===null?N:K.key)||null,A(C,T,K,ve);case j:return K=wa(K),D(T,C,N,K,ve)}if(Ye(K)||xe(K))return T=T.get(N)||null,B(C,T,K,ve,null);if(typeof K.then=="function")return D(T,C,N,Ps(K),ve);if(K.$$typeof===Z)return D(T,C,N,Qs(C,K),ve);$s(C,K)}return null}function ce(T,C,N,K){for(var ve=null,lt=null,fe=C,Ue=C=0,We=null;fe!==null&&Ue<N.length;Ue++){fe.index>Ue?(We=fe,fe=null):We=fe.sibling;var at=M(T,fe,N[Ue],K);if(at===null){fe===null&&(fe=We);break}e&&fe&&at.alternate===null&&t(T,fe),C=s(at,C,Ue),lt===null?ve=at:lt.sibling=at,lt=at,fe=We}if(Ue===N.length)return n(T,fe),tt&&xl(T,Ue),ve;if(fe===null){for(;Ue<N.length;Ue++)fe=G(T,N[Ue],K),fe!==null&&(C=s(fe,C,Ue),lt===null?ve=fe:lt.sibling=fe,lt=fe);return tt&&xl(T,Ue),ve}for(fe=l(fe);Ue<N.length;Ue++)We=D(fe,T,Ue,N[Ue],K),We!==null&&(e&&We.alternate!==null&&fe.delete(We.key===null?Ue:We.key),C=s(We,C,Ue),lt===null?ve=We:lt.sibling=We,lt=We);return e&&fe.forEach(function(ia){return t(T,ia)}),tt&&xl(T,Ue),ve}function Ne(T,C,N,K){if(N==null)throw Error(c(151));for(var ve=null,lt=null,fe=C,Ue=C=0,We=null,at=N.next();fe!==null&&!at.done;Ue++,at=N.next()){fe.index>Ue?(We=fe,fe=null):We=fe.sibling;var ia=M(T,fe,at.value,K);if(ia===null){fe===null&&(fe=We);break}e&&fe&&ia.alternate===null&&t(T,fe),C=s(ia,C,Ue),lt===null?ve=ia:lt.sibling=ia,lt=ia,fe=We}if(at.done)return n(T,fe),tt&&xl(T,Ue),ve;if(fe===null){for(;!at.done;Ue++,at=N.next())at=G(T,at.value,K),at!==null&&(C=s(at,C,Ue),lt===null?ve=at:lt.sibling=at,lt=at);return tt&&xl(T,Ue),ve}for(fe=l(fe);!at.done;Ue++,at=N.next())at=D(fe,T,Ue,at.value,K),at!==null&&(e&&at.alternate!==null&&fe.delete(at.key===null?Ue:at.key),C=s(at,C,Ue),lt===null?ve=at:lt.sibling=at,lt=at);return e&&fe.forEach(function(cy){return t(T,cy)}),tt&&xl(T,Ue),ve}function dt(T,C,N,K){if(typeof N=="object"&&N!==null&&N.type===q&&N.key===null&&(N=N.props.children),typeof N=="object"&&N!==null){switch(N.$$typeof){case E:e:{for(var ve=N.key;C!==null;){if(C.key===ve){if(ve=N.type,ve===q){if(C.tag===7){n(T,C.sibling),K=a(C,N.props.children),K.return=T,T=K;break e}}else if(C.elementType===ve||typeof ve=="object"&&ve!==null&&ve.$$typeof===j&&wa(ve)===C.type){n(T,C.sibling),K=a(C,N.props),Xi(K,N),K.return=T,T=K;break e}n(T,C);break}else t(T,C);C=C.sibling}N.type===q?(K=ba(N.props.children,T.mode,K,N.key),K.return=T,T=K):(K=Xs(N.type,N.key,N.props,null,T.mode,K),Xi(K,N),K.return=T,T=K)}return h(T);case k:e:{for(ve=N.key;C!==null;){if(C.key===ve)if(C.tag===4&&C.stateNode.containerInfo===N.containerInfo&&C.stateNode.implementation===N.implementation){n(T,C.sibling),K=a(C,N.children||[]),K.return=T,T=K;break e}else{n(T,C);break}else t(T,C);C=C.sibling}K=No(N,T.mode,K),K.return=T,T=K}return h(T);case j:return N=wa(N),dt(T,C,N,K)}if(Ye(N))return ce(T,C,N,K);if(xe(N)){if(ve=xe(N),typeof ve!="function")throw Error(c(150));return N=ve.call(N),Ne(T,C,N,K)}if(typeof N.then=="function")return dt(T,C,Ps(N),K);if(N.$$typeof===Z)return dt(T,C,Qs(T,N),K);$s(T,N)}return typeof N=="string"&&N!==""||typeof N=="number"||typeof N=="bigint"?(N=""+N,C!==null&&C.tag===6?(n(T,C.sibling),K=a(C,N),K.return=T,T=K):(n(T,C),K=To(N,T.mode,K),K.return=T,T=K),h(T)):n(T,C)}return function(T,C,N,K){try{Vi=0;var ve=dt(T,C,N,K);return li=null,ve}catch(fe){if(fe===ni||fe===Js)throw fe;var lt=Nn(29,fe,null,T.mode);return lt.lanes=K,lt.return=T,lt}finally{}}}var Ta=Bd(!0),Hd=Bd(!1),Gl=!1;function Uo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Bo(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 Vl(e,t,n){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(it&2)!==0){var a=l.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),l.pending=t,t=Vs(e),wd(e,null,n),t}return qs(e,l,t,n),Vs(e)}function Fi(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,Ha(e,n)}}function Ho(e,t){var n=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,n===l)){var a=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var h={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};s===null?a=s=h:s=s.next=h,n=n.next}while(n!==null);s===null?a=s=t:s=s.next=t}else a=s=t;n={baseState:l.baseState,firstBaseUpdate:a,lastBaseUpdate:s,shared:l.shared,callbacks:l.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Yo=!1;function Zi(){if(Yo){var e=ti;if(e!==null)throw e}}function Qi(e,t,n,l){Yo=!1;var a=e.updateQueue;Gl=!1;var s=a.firstBaseUpdate,h=a.lastBaseUpdate,g=a.shared.pending;if(g!==null){a.shared.pending=null;var w=g,A=w.next;w.next=null,h===null?s=A:h.next=A,h=w;var B=e.alternate;B!==null&&(B=B.updateQueue,g=B.lastBaseUpdate,g!==h&&(g===null?B.firstBaseUpdate=A:g.next=A,B.lastBaseUpdate=w))}if(s!==null){var G=a.baseState;h=0,B=A=w=null,g=s;do{var M=g.lane&-536870913,D=M!==g.lane;if(D?(Je&M)===M:(l&M)===M){M!==0&&M===ei&&(Yo=!0),B!==null&&(B=B.next={lane:0,tag:g.tag,payload:g.payload,callback:null,next:null});e:{var ce=e,Ne=g;M=t;var dt=n;switch(Ne.tag){case 1:if(ce=Ne.payload,typeof ce=="function"){G=ce.call(dt,G,M);break e}G=ce;break e;case 3:ce.flags=ce.flags&-65537|128;case 0:if(ce=Ne.payload,M=typeof ce=="function"?ce.call(dt,G,M):ce,M==null)break e;G=x({},G,M);break e;case 2:Gl=!0}}M=g.callback,M!==null&&(e.flags|=64,D&&(e.flags|=8192),D=a.callbacks,D===null?a.callbacks=[M]:D.push(M))}else D={lane:M,tag:g.tag,payload:g.payload,callback:g.callback,next:null},B===null?(A=B=D,w=G):B=B.next=D,h|=M;if(g=g.next,g===null){if(g=a.shared.pending,g===null)break;D=g,g=D.next,D.next=null,a.lastBaseUpdate=D,a.shared.pending=null}}while(!0);B===null&&(w=G),a.baseState=w,a.firstBaseUpdate=A,a.lastBaseUpdate=B,s===null&&(a.shared.lanes=0),Il|=h,e.lanes=h,e.memoizedState=G}}function Yd(e,t){if(typeof e!="function")throw Error(c(191,e));e.call(t)}function Kd(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Yd(n[e],t)}var ai=ke(null),er=ke(0);function Gd(e,t){e=kl,Se(er,e),Se(ai,t),kl=e|t.baseLanes}function Ko(){Se(er,kl),Se(ai,ai.current)}function Go(){kl=er.current,H(ai),H(er)}var En=ke(null),Yn=null;function Xl(e){var t=e.alternate;Se(jt,jt.current&1),Se(En,e),Yn===null&&(t===null||ai.current!==null||t.memoizedState!==null)&&(Yn=e)}function qo(e){Se(jt,jt.current),Se(En,e),Yn===null&&(Yn=e)}function qd(e){e.tag===22?(Se(jt,jt.current),Se(En,e),Yn===null&&(Yn=e)):Fl()}function Fl(){Se(jt,jt.current),Se(En,En.current)}function An(e){H(En),Yn===e&&(Yn=null),H(jt)}var jt=ke(0);function tr(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||Ic(n)||Jc(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 Cl=0,Le=null,ct=null,Ot=null,nr=!1,ii=!1,Na=!1,lr=0,Ii=0,si=null,$g=0;function Tt(){throw Error(c(321))}function Vo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Tn(e[n],t[n]))return!1;return!0}function Xo(e,t,n,l,a,s){return Cl=s,Le=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,_.H=e===null||e.memoizedState===null?Af:sc,Na=!1,s=n(l,a),Na=!1,ii&&(s=Xd(t,n,l,a)),Vd(e),s}function Vd(e){_.H=Pi;var t=ct!==null&&ct.next!==null;if(Cl=0,Ot=ct=Le=null,nr=!1,Ii=0,si=null,t)throw Error(c(300));e===null||Ut||(e=e.dependencies,e!==null&&Zs(e)&&(Ut=!0))}function Xd(e,t,n,l){Le=e;var a=0;do{if(ii&&(si=null),Ii=0,ii=!1,25<=a)throw Error(c(301));if(a+=1,Ot=ct=null,e.updateQueue!=null){var s=e.updateQueue;s.lastEffect=null,s.events=null,s.stores=null,s.memoCache!=null&&(s.memoCache.index=0)}_.H=Rf,s=t(n,l)}while(ii);return s}function eb(){var e=_.H,t=e.useState()[0];return t=typeof t.then=="function"?Ji(t):t,e=e.useState()[0],(ct!==null?ct.memoizedState:null)!==e&&(Le.flags|=1024),t}function Fo(){var e=lr!==0;return lr=0,e}function Zo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Qo(e){if(nr){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}nr=!1}Cl=0,Ot=ct=Le=null,ii=!1,Ii=lr=0,si=null}function rn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ot===null?Le.memoizedState=Ot=e:Ot=Ot.next=e,Ot}function Mt(){if(ct===null){var e=Le.alternate;e=e!==null?e.memoizedState:null}else e=ct.next;var t=Ot===null?Le.memoizedState:Ot.next;if(t!==null)Ot=t,ct=e;else{if(e===null)throw Le.alternate===null?Error(c(467)):Error(c(310));ct=e,e={memoizedState:ct.memoizedState,baseState:ct.baseState,baseQueue:ct.baseQueue,queue:ct.queue,next:null},Ot===null?Le.memoizedState=Ot=e:Ot=Ot.next=e}return Ot}function ar(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ji(e){var t=Ii;return Ii+=1,si===null&&(si=[]),e=Ld(si,e,t),t=Le,(Ot===null?t.memoizedState:Ot.next)===null&&(t=t.alternate,_.H=t===null||t.memoizedState===null?Af:sc),e}function ir(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Ji(e);if(e.$$typeof===Z)return It(e)}throw Error(c(438,String(e)))}function Io(e){var t=null,n=Le.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var l=Le.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(t={data:l.data.map(function(a){return a.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=ar(),Le.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]=be;return t.index++,n}function Tl(e,t){return typeof t=="function"?t(e):t}function sr(e){var t=Mt();return Jo(t,ct,e)}function Jo(e,t,n){var l=e.queue;if(l===null)throw Error(c(311));l.lastRenderedReducer=n;var a=e.baseQueue,s=l.pending;if(s!==null){if(a!==null){var h=a.next;a.next=s.next,s.next=h}t.baseQueue=a=s,l.pending=null}if(s=e.baseState,a===null)e.memoizedState=s;else{t=a.next;var g=h=null,w=null,A=t,B=!1;do{var G=A.lane&-536870913;if(G!==A.lane?(Je&G)===G:(Cl&G)===G){var M=A.revertLane;if(M===0)w!==null&&(w=w.next={lane:0,revertLane:0,gesture:null,action:A.action,hasEagerState:A.hasEagerState,eagerState:A.eagerState,next:null}),G===ei&&(B=!0);else if((Cl&M)===M){A=A.next,M===ei&&(B=!0);continue}else G={lane:0,revertLane:A.revertLane,gesture:null,action:A.action,hasEagerState:A.hasEagerState,eagerState:A.eagerState,next:null},w===null?(g=w=G,h=s):w=w.next=G,Le.lanes|=M,Il|=M;G=A.action,Na&&n(s,G),s=A.hasEagerState?A.eagerState:n(s,G)}else M={lane:G,revertLane:A.revertLane,gesture:A.gesture,action:A.action,hasEagerState:A.hasEagerState,eagerState:A.eagerState,next:null},w===null?(g=w=M,h=s):w=w.next=M,Le.lanes|=G,Il|=G;A=A.next}while(A!==null&&A!==t);if(w===null?h=s:w.next=g,!Tn(s,e.memoizedState)&&(Ut=!0,B&&(n=ti,n!==null)))throw n;e.memoizedState=s,e.baseState=h,e.baseQueue=w,l.lastRenderedState=s}return a===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Wo(e){var t=Mt(),n=t.queue;if(n===null)throw Error(c(311));n.lastRenderedReducer=e;var l=n.dispatch,a=n.pending,s=t.memoizedState;if(a!==null){n.pending=null;var h=a=a.next;do s=e(s,h.action),h=h.next;while(h!==a);Tn(s,t.memoizedState)||(Ut=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),n.lastRenderedState=s}return[s,l]}function Fd(e,t,n){var l=Le,a=Mt(),s=tt;if(s){if(n===void 0)throw Error(c(407));n=n()}else n=t();var h=!Tn((ct||a).memoizedState,n);if(h&&(a.memoizedState=n,Ut=!0),a=a.queue,ec(Id.bind(null,l,a,e),[e]),a.getSnapshot!==t||h||Ot!==null&&Ot.memoizedState.tag&1){if(l.flags|=2048,ri(9,{destroy:void 0},Qd.bind(null,l,a,n,t),null),mt===null)throw Error(c(349));s||(Cl&127)!==0||Zd(l,t,n)}return n}function Zd(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Le.updateQueue,t===null?(t=ar(),Le.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,Jd(t)&&Wd(e)}function Id(e,t,n){return n(function(){Jd(t)&&Wd(e)})}function Jd(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Tn(e,n)}catch{return!0}}function Wd(e){var t=ga(e,2);t!==null&&yn(t,e,2)}function Po(e){var t=rn();if(typeof e=="function"){var n=e;if(e=n(),Na){xn(!0);try{n()}finally{xn(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Tl,lastRenderedState:e},t}function Pd(e,t,n,l){return e.baseState=n,Jo(e,ct,typeof l=="function"?l:Tl)}function tb(e,t,n,l,a){if(cr(e))throw Error(c(485));if(e=t.action,e!==null){var s={payload:a,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(h){s.listeners.push(h)}};_.T!==null?n(!0):s.isTransition=!1,l(s),n=t.pending,n===null?(s.next=t.pending=s,$d(t,s)):(s.next=n.next,t.pending=n.next=s)}}function $d(e,t){var n=t.action,l=t.payload,a=e.state;if(t.isTransition){var s=_.T,h={};_.T=h;try{var g=n(a,l),w=_.S;w!==null&&w(h,g),ef(e,t,g)}catch(A){$o(e,t,A)}finally{s!==null&&h.types!==null&&(s.types=h.types),_.T=s}}else try{s=n(a,l),ef(e,t,s)}catch(A){$o(e,t,A)}}function ef(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(l){tf(e,t,l)},function(l){return $o(e,t,l)}):tf(e,t,n)}function tf(e,t,n){t.status="fulfilled",t.value=n,nf(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,$d(e,n)))}function $o(e,t,n){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=n,nf(t),t=t.next;while(t!==l)}e.action=null}function nf(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function lf(e,t){return t}function af(e,t){if(tt){var n=mt.formState;if(n!==null){e:{var l=Le;if(tt){if(gt){t:{for(var a=gt,s=Hn;a.nodeType!==8;){if(!s){a=null;break t}if(a=Kn(a.nextSibling),a===null){a=null;break t}}s=a.data,a=s==="F!"||s==="F"?a:null}if(a){gt=Kn(a.nextSibling),l=a.data==="F!";break e}}Yl(l)}l=!1}l&&(t=n[0])}}return n=rn(),n.memoizedState=n.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:lf,lastRenderedState:t},n.queue=l,n=Tf.bind(null,Le,l),l.dispatch=n,l=Po(!1),s=ic.bind(null,Le,!1,l.queue),l=rn(),a={state:t,dispatch:null,action:e,pending:null},l.queue=a,n=tb.bind(null,Le,a,s,n),a.dispatch=n,l.memoizedState=e,[t,n,!1]}function sf(e){var t=Mt();return rf(t,ct,e)}function rf(e,t,n){if(t=Jo(e,t,lf)[0],e=sr(Tl)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=Ji(t)}catch(h){throw h===ni?Js:h}else l=t;t=Mt();var a=t.queue,s=a.dispatch;return n!==t.memoizedState&&(Le.flags|=2048,ri(9,{destroy:void 0},nb.bind(null,a,n),null)),[l,s,e]}function nb(e,t){e.action=t}function of(e){var t=Mt(),n=ct;if(n!==null)return rf(t,n,e);Mt(),t=t.memoizedState,n=Mt();var l=n.queue.dispatch;return n.memoizedState=e,[t,l,!1]}function ri(e,t,n,l){return e={tag:e,create:n,deps:l,inst:t,next:null},t=Le.updateQueue,t===null&&(t=ar(),Le.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 cf(){return Mt().memoizedState}function rr(e,t,n,l){var a=rn();Le.flags|=e,a.memoizedState=ri(1|t,{destroy:void 0},n,l===void 0?null:l)}function or(e,t,n,l){var a=Mt();l=l===void 0?null:l;var s=a.memoizedState.inst;ct!==null&&l!==null&&Vo(l,ct.memoizedState.deps)?a.memoizedState=ri(t,s,n,l):(Le.flags|=e,a.memoizedState=ri(1|t,s,n,l))}function uf(e,t){rr(8390656,8,e,t)}function ec(e,t){or(2048,8,e,t)}function lb(e){Le.flags|=4;var t=Le.updateQueue;if(t===null)t=ar(),Le.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function df(e){var t=Mt().memoizedState;return lb({ref:t,nextImpl:e}),function(){if((it&2)!==0)throw Error(c(440));return t.impl.apply(void 0,arguments)}}function ff(e,t){return or(4,2,e,t)}function hf(e,t){return or(4,4,e,t)}function mf(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 pf(e,t,n){n=n!=null?n.concat([e]):null,or(4,4,mf.bind(null,t,e),n)}function tc(){}function gf(e,t){var n=Mt();t=t===void 0?null:t;var l=n.memoizedState;return t!==null&&Vo(t,l[1])?l[0]:(n.memoizedState=[e,t],e)}function bf(e,t){var n=Mt();t=t===void 0?null:t;var l=n.memoizedState;if(t!==null&&Vo(t,l[1]))return l[0];if(l=e(),Na){xn(!0);try{e()}finally{xn(!1)}}return n.memoizedState=[l,t],l}function nc(e,t,n){return n===void 0||(Cl&1073741824)!==0&&(Je&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=yh(),Le.lanes|=e,Il|=e,n)}function yf(e,t,n,l){return Tn(n,t)?n:ai.current!==null?(e=nc(e,n,l),Tn(e,t)||(Ut=!0),e):(Cl&42)===0||(Cl&1073741824)!==0&&(Je&261930)===0?(Ut=!0,e.memoizedState=n):(e=yh(),Le.lanes|=e,Il|=e,t)}function vf(e,t,n,l,a){var s=V.p;V.p=s!==0&&8>s?s:8;var h=_.T,g={};_.T=g,ic(e,!1,t,n);try{var w=a(),A=_.S;if(A!==null&&A(g,w),w!==null&&typeof w=="object"&&typeof w.then=="function"){var B=Pg(w,l);Wi(e,t,B,Mn(e))}else Wi(e,t,l,Mn(e))}catch(G){Wi(e,t,{then:function(){},status:"rejected",reason:G},Mn())}finally{V.p=s,h!==null&&g.types!==null&&(h.types=g.types),_.T=h}}function ab(){}function lc(e,t,n,l){if(e.tag!==5)throw Error(c(476));var a=xf(e).queue;vf(e,a,t,$,n===null?ab:function(){return Sf(e),n(l)})}function xf(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:$,baseState:$,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Tl,lastRenderedState:$},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Tl,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Sf(e){var t=xf(e);t.next===null&&(t=e.alternate.memoizedState),Wi(e,t.next.queue,{},Mn())}function ac(){return It(ms)}function wf(){return Mt().memoizedState}function Cf(){return Mt().memoizedState}function ib(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Mn();e=ql(n);var l=Vl(t,e,n);l!==null&&(yn(l,t,n),Fi(l,t,n)),t={cache:zo()},e.payload=t;return}t=t.return}}function sb(e,t,n){var l=Mn();n={lane:l,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},cr(e)?Nf(t,n):(n=wo(e,t,n,l),n!==null&&(yn(n,e,l),Ef(n,t,l)))}function Tf(e,t,n){var l=Mn();Wi(e,t,n,l)}function Wi(e,t,n,l){var a={lane:l,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(cr(e))Nf(t,a);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(a.hasEagerState=!0,a.eagerState=g,Tn(g,h))return qs(e,t,a,0),mt===null&&Gs(),!1}catch{}finally{}if(n=wo(e,t,a,l),n!==null)return yn(n,e,l),Ef(n,t,l),!0}return!1}function ic(e,t,n,l){if(l={lane:2,revertLane:Uc(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},cr(e)){if(t)throw Error(c(479))}else t=wo(e,n,l,2),t!==null&&yn(t,e,2)}function cr(e){var t=e.alternate;return e===Le||t!==null&&t===Le}function Nf(e,t){ii=nr=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ef(e,t,n){if((n&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,n|=l,t.lanes=n,Ha(e,n)}}var Pi={readContext:It,use:ir,useCallback:Tt,useContext:Tt,useEffect:Tt,useImperativeHandle:Tt,useLayoutEffect:Tt,useInsertionEffect:Tt,useMemo:Tt,useReducer:Tt,useRef:Tt,useState:Tt,useDebugValue:Tt,useDeferredValue:Tt,useTransition:Tt,useSyncExternalStore:Tt,useId:Tt,useHostTransitionStatus:Tt,useFormState:Tt,useActionState:Tt,useOptimistic:Tt,useMemoCache:Tt,useCacheRefresh:Tt};Pi.useEffectEvent=Tt;var Af={readContext:It,use:ir,useCallback:function(e,t){return rn().memoizedState=[e,t===void 0?null:t],e},useContext:It,useEffect:uf,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,rr(4194308,4,mf.bind(null,t,e),n)},useLayoutEffect:function(e,t){return rr(4194308,4,e,t)},useInsertionEffect:function(e,t){rr(4,2,e,t)},useMemo:function(e,t){var n=rn();t=t===void 0?null:t;var l=e();if(Na){xn(!0);try{e()}finally{xn(!1)}}return n.memoizedState=[l,t],l},useReducer:function(e,t,n){var l=rn();if(n!==void 0){var a=n(t);if(Na){xn(!0);try{n(t)}finally{xn(!1)}}}else a=t;return l.memoizedState=l.baseState=a,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:a},l.queue=e,e=e.dispatch=sb.bind(null,Le,e),[l.memoizedState,e]},useRef:function(e){var t=rn();return e={current:e},t.memoizedState=e},useState:function(e){e=Po(e);var t=e.queue,n=Tf.bind(null,Le,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:tc,useDeferredValue:function(e,t){var n=rn();return nc(n,e,t)},useTransition:function(){var e=Po(!1);return e=vf.bind(null,Le,e.queue,!0,!1),rn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var l=Le,a=rn();if(tt){if(n===void 0)throw Error(c(407));n=n()}else{if(n=t(),mt===null)throw Error(c(349));(Je&127)!==0||Zd(l,t,n)}a.memoizedState=n;var s={value:n,getSnapshot:t};return a.queue=s,uf(Id.bind(null,l,s,e),[e]),l.flags|=2048,ri(9,{destroy:void 0},Qd.bind(null,l,s,n,t),null),n},useId:function(){var e=rn(),t=mt.identifierPrefix;if(tt){var n=dl,l=ul;n=(l&~(1<<32-kt(l)-1)).toString(32)+n,t="_"+t+"R_"+n,n=lr++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=$g++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:ac,useFormState:af,useActionState:af,useOptimistic:function(e){var t=rn();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=ic.bind(null,Le,!0,n),n.dispatch=t,[e,t]},useMemoCache:Io,useCacheRefresh:function(){return rn().memoizedState=ib.bind(null,Le)},useEffectEvent:function(e){var t=rn(),n={impl:e};return t.memoizedState=n,function(){if((it&2)!==0)throw Error(c(440));return n.impl.apply(void 0,arguments)}}},sc={readContext:It,use:ir,useCallback:gf,useContext:It,useEffect:ec,useImperativeHandle:pf,useInsertionEffect:ff,useLayoutEffect:hf,useMemo:bf,useReducer:sr,useRef:cf,useState:function(){return sr(Tl)},useDebugValue:tc,useDeferredValue:function(e,t){var n=Mt();return yf(n,ct.memoizedState,e,t)},useTransition:function(){var e=sr(Tl)[0],t=Mt().memoizedState;return[typeof e=="boolean"?e:Ji(e),t]},useSyncExternalStore:Fd,useId:wf,useHostTransitionStatus:ac,useFormState:sf,useActionState:sf,useOptimistic:function(e,t){var n=Mt();return Pd(n,ct,e,t)},useMemoCache:Io,useCacheRefresh:Cf};sc.useEffectEvent=df;var Rf={readContext:It,use:ir,useCallback:gf,useContext:It,useEffect:ec,useImperativeHandle:pf,useInsertionEffect:ff,useLayoutEffect:hf,useMemo:bf,useReducer:Wo,useRef:cf,useState:function(){return Wo(Tl)},useDebugValue:tc,useDeferredValue:function(e,t){var n=Mt();return ct===null?nc(n,e,t):yf(n,ct.memoizedState,e,t)},useTransition:function(){var e=Wo(Tl)[0],t=Mt().memoizedState;return[typeof e=="boolean"?e:Ji(e),t]},useSyncExternalStore:Fd,useId:wf,useHostTransitionStatus:ac,useFormState:of,useActionState:of,useOptimistic:function(e,t){var n=Mt();return ct!==null?Pd(n,ct,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:Io,useCacheRefresh:Cf};Rf.useEffectEvent=df;function rc(e,t,n,l){t=e.memoizedState,n=n(l,t),n=n==null?t:x({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var oc={enqueueSetState:function(e,t,n){e=e._reactInternals;var l=Mn(),a=ql(l);a.payload=t,n!=null&&(a.callback=n),t=Vl(e,a,l),t!==null&&(yn(t,e,l),Fi(t,e,l))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var l=Mn(),a=ql(l);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=Vl(e,a,l),t!==null&&(yn(t,e,l),Fi(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Mn(),l=ql(n);l.tag=2,t!=null&&(l.callback=t),t=Vl(e,l,n),t!==null&&(yn(t,e,n),Fi(t,e,n))}};function jf(e,t,n,l,a,s,h){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,s,h):t.prototype&&t.prototype.isPureReactComponent?!Bi(n,l)||!Bi(a,s):!0}function Mf(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&&oc.enqueueReplaceState(t,t.state,null)}function Ea(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=x({},n));for(var a in e)n[a]===void 0&&(n[a]=e[a])}return n}function kf(e){Ks(e)}function _f(e){console.error(e)}function zf(e){Ks(e)}function ur(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function Df(e,t,n){try{var l=e.onCaughtError;l(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(a){setTimeout(function(){throw a})}}function cc(e,t,n){return n=ql(n),n.tag=3,n.payload={element:null},n.callback=function(){ur(e,t)},n}function Lf(e){return e=ql(e),e.tag=3,e}function Of(e,t,n,l){var a=n.type.getDerivedStateFromError;if(typeof a=="function"){var s=l.value;e.payload=function(){return a(s)},e.callback=function(){Df(t,n,l)}}var h=n.stateNode;h!==null&&typeof h.componentDidCatch=="function"&&(e.callback=function(){Df(t,n,l),typeof a!="function"&&(Jl===null?Jl=new Set([this]):Jl.add(this));var g=l.stack;this.componentDidCatch(l.value,{componentStack:g!==null?g:""})})}function rb(e,t,n,l,a){if(n.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=n.alternate,t!==null&&$a(t,n,a,!0),n=En.current,n!==null){switch(n.tag){case 31:case 13:return Yn===null?wr():n.alternate===null&&Nt===0&&(Nt=3),n.flags&=-257,n.flags|=65536,n.lanes=a,l===Ws?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([l]):t.add(l),Dc(e,l,a)),!1;case 22:return n.flags|=65536,l===Ws?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)),Dc(e,l,a)),!1}throw Error(c(435,n.tag))}return Dc(e,l,a),wr(),!1}if(tt)return t=En.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=a,l!==Ro&&(e=Error(c(422),{cause:l}),Ki(On(e,n)))):(l!==Ro&&(t=Error(c(423),{cause:l}),Ki(On(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,l=On(l,n),a=cc(e.stateNode,l,a),Ho(e,a),Nt!==4&&(Nt=2)),!1;var s=Error(c(520),{cause:l});if(s=On(s,n),ss===null?ss=[s]:ss.push(s),Nt!==4&&(Nt=2),t===null)return!0;l=On(l,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=cc(n.stateNode,l,e),Ho(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"&&(Jl===null||!Jl.has(s))))return n.flags|=65536,a&=-a,n.lanes|=a,a=Lf(a),Of(a,e,n,l),Ho(n,a),!1}n=n.return}while(n!==null);return!1}var uc=Error(c(461)),Ut=!1;function Jt(e,t,n,l){t.child=e===null?Hd(t,null,n,l):Ta(t,e.child,n,l)}function Uf(e,t,n,l,a){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 xa(t),l=Xo(e,t,n,h,s,a),g=Fo(),e!==null&&!Ut?(Zo(e,t,a),Nl(e,t,a)):(tt&&g&&Eo(t),t.flags|=1,Jt(e,t,l,a),t.child)}function Bf(e,t,n,l,a){if(e===null){var s=n.type;return typeof s=="function"&&!Co(s)&&s.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=s,Hf(e,t,s,l,a)):(e=Xs(n.type,null,l,t,t.mode,a),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!yc(e,a)){var h=s.memoizedProps;if(n=n.compare,n=n!==null?n:Bi,n(h,l)&&e.ref===t.ref)return Nl(e,t,a)}return t.flags|=1,e=vl(s,l),e.ref=t.ref,e.return=t,t.child=e}function Hf(e,t,n,l,a){if(e!==null){var s=e.memoizedProps;if(Bi(s,l)&&e.ref===t.ref)if(Ut=!1,t.pendingProps=l=s,yc(e,a))(e.flags&131072)!==0&&(Ut=!0);else return t.lanes=e.lanes,Nl(e,t,a)}return dc(e,t,n,l,a)}function Yf(e,t,n,l){var a=l.children,s=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((t.flags&128)!==0){if(s=s!==null?s.baseLanes|n:n,e!==null){for(l=t.child=e.child,a=0;l!==null;)a=a|l.lanes|l.childLanes,l=l.sibling;l=a&~s}else l=0,t.child=null;return Kf(e,t,s,n,l)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Is(t,s!==null?s.cachePool:null),s!==null?Gd(t,s):Ko(),qd(t);else return l=t.lanes=536870912,Kf(e,t,s!==null?s.baseLanes|n:n,n,l)}else s!==null?(Is(t,s.cachePool),Gd(t,s),Fl(),t.memoizedState=null):(e!==null&&Is(t,null),Ko(),Fl());return Jt(e,t,a,n),t.child}function $i(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Kf(e,t,n,l,a){var s=Lo();return s=s===null?null:{parent:Lt._currentValue,pool:s},t.memoizedState={baseLanes:n,cachePool:s},e!==null&&Is(t,null),Ko(),qd(t),e!==null&&$a(e,t,l,!0),t.childLanes=a,null}function dr(e,t){return t=hr({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Gf(e,t,n){return Ta(t,e.child,null,n),e=dr(t,t.pendingProps),e.flags|=2,An(t),t.memoizedState=null,e}function ob(e,t,n){var l=t.pendingProps,a=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(tt){if(l.mode==="hidden")return e=dr(t,l),t.lanes=536870912,$i(null,e);if(qo(t),(e=gt)?(e=em(e,Hn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Bl!==null?{id:ul,overflow:dl}:null,retryLane:536870912,hydrationErrors:null},n=Td(e),n.return=t,t.child=n,Qt=t,gt=null)):e=null,e===null)throw Yl(t);return t.lanes=536870912,null}return dr(t,l)}var s=e.memoizedState;if(s!==null){var h=s.dehydrated;if(qo(t),a)if(t.flags&256)t.flags&=-257,t=Gf(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||$a(e,t,n,!1),a=(n&e.childLanes)!==0,Ut||a){if(l=mt,l!==null&&(h=Ya(l,n),h!==0&&h!==s.retryLane))throw s.retryLane=h,ga(e,h),yn(l,e,h),uc;wr(),t=Gf(e,t,n)}else e=s.treeContext,gt=Kn(h.nextSibling),Qt=t,tt=!0,Hl=null,Hn=!1,e!==null&&Ad(t,e),t=dr(t,l),t.flags|=4096;return t}return e=vl(e.child,{mode:l.mode,children:l.children}),e.ref=t.ref,t.child=e,e.return=t,e}function fr(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 dc(e,t,n,l,a){return xa(t),n=Xo(e,t,n,l,void 0,a),l=Fo(),e!==null&&!Ut?(Zo(e,t,a),Nl(e,t,a)):(tt&&l&&Eo(t),t.flags|=1,Jt(e,t,n,a),t.child)}function qf(e,t,n,l,a,s){return xa(t),t.updateQueue=null,n=Xd(t,l,n,a),Vd(e),l=Fo(),e!==null&&!Ut?(Zo(e,t,s),Nl(e,t,s)):(tt&&l&&Eo(t),t.flags|=1,Jt(e,t,n,s),t.child)}function Vf(e,t,n,l,a){if(xa(t),t.stateNode===null){var s=Ia,h=n.contextType;typeof h=="object"&&h!==null&&(s=It(h)),s=new n(l,s),t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=oc,t.stateNode=s,s._reactInternals=t,s=t.stateNode,s.props=l,s.state=t.memoizedState,s.refs={},Uo(t),h=n.contextType,s.context=typeof h=="object"&&h!==null?It(h):Ia,s.state=t.memoizedState,h=n.getDerivedStateFromProps,typeof h=="function"&&(rc(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&&oc.enqueueReplaceState(s,s.state,null),Qi(t,l,s,a),Zi(),s.state=t.memoizedState),typeof s.componentDidMount=="function"&&(t.flags|=4194308),l=!0}else if(e===null){s=t.stateNode;var g=t.memoizedProps,w=Ea(n,g);s.props=w;var A=s.context,B=n.contextType;h=Ia,typeof B=="object"&&B!==null&&(h=It(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||A!==h)&&Mf(t,s,l,h),Gl=!1;var M=t.memoizedState;s.state=M,Qi(t,l,s,a),Zi(),A=t.memoizedState,g||M!==A||Gl?(typeof G=="function"&&(rc(t,n,G,l),A=t.memoizedState),(w=Gl||jf(t,n,w,l,M,A,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=A),s.props=l,s.state=A,s.context=h,l=w):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{s=t.stateNode,Bo(e,t),h=t.memoizedProps,B=Ea(n,h),s.props=B,G=t.pendingProps,M=s.context,A=n.contextType,w=Ia,typeof A=="object"&&A!==null&&(w=It(A)),g=n.getDerivedStateFromProps,(A=typeof g=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(h!==G||M!==w)&&Mf(t,s,l,w),Gl=!1,M=t.memoizedState,s.state=M,Qi(t,l,s,a),Zi();var D=t.memoizedState;h!==G||M!==D||Gl||e!==null&&e.dependencies!==null&&Zs(e.dependencies)?(typeof g=="function"&&(rc(t,n,g,l),D=t.memoizedState),(B=Gl||jf(t,n,B,l,M,D,w)||e!==null&&e.dependencies!==null&&Zs(e.dependencies))?(A||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(l,D,w),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(l,D,w)),typeof s.componentDidUpdate=="function"&&(t.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof s.componentDidUpdate!="function"||h===e.memoizedProps&&M===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||h===e.memoizedProps&&M===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=D),s.props=l,s.state=D,s.context=w,l=B):(typeof s.componentDidUpdate!="function"||h===e.memoizedProps&&M===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||h===e.memoizedProps&&M===e.memoizedState||(t.flags|=1024),l=!1)}return s=l,fr(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=Ta(t,e.child,null,a),t.child=Ta(t,null,n,a)):Jt(e,t,n,a),t.memoizedState=s.state,e=t.child):e=Nl(e,t,a),e}function Xf(e,t,n,l){return ya(),t.flags|=256,Jt(e,t,n,l),t.child}var fc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function hc(e){return{baseLanes:e,cachePool:zd()}}function mc(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=jn),e}function Ff(e,t,n){var l=t.pendingProps,a=!1,s=(t.flags&128)!==0,h;if((h=s)||(h=e!==null&&e.memoizedState===null?!1:(jt.current&2)!==0),h&&(a=!0,t.flags&=-129),h=(t.flags&32)!==0,t.flags&=-33,e===null){if(tt){if(a?Xl(t):Fl(),(e=gt)?(e=em(e,Hn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Bl!==null?{id:ul,overflow:dl}:null,retryLane:536870912,hydrationErrors:null},n=Td(e),n.return=t,t.child=n,Qt=t,gt=null)):e=null,e===null)throw Yl(t);return Jc(e)?t.lanes=32:t.lanes=536870912,null}var g=l.children;return l=l.fallback,a?(Fl(),a=t.mode,g=hr({mode:"hidden",children:g},a),l=ba(l,a,n,null),g.return=t,l.return=t,g.sibling=l,t.child=g,l=t.child,l.memoizedState=hc(n),l.childLanes=mc(e,h,n),t.memoizedState=fc,$i(null,l)):(Xl(t),pc(t,g))}var w=e.memoizedState;if(w!==null&&(g=w.dehydrated,g!==null)){if(s)t.flags&256?(Xl(t),t.flags&=-257,t=gc(e,t,n)):t.memoizedState!==null?(Fl(),t.child=e.child,t.flags|=128,t=null):(Fl(),g=l.fallback,a=t.mode,l=hr({mode:"visible",children:l.children},a),g=ba(g,a,n,null),g.flags|=2,l.return=t,g.return=t,l.sibling=g,t.child=l,Ta(t,e.child,null,n),l=t.child,l.memoizedState=hc(n),l.childLanes=mc(e,h,n),t.memoizedState=fc,t=$i(null,l));else if(Xl(t),Jc(g)){if(h=g.nextSibling&&g.nextSibling.dataset,h)var A=h.dgst;h=A,l=Error(c(419)),l.stack="",l.digest=h,Ki({value:l,source:null,stack:null}),t=gc(e,t,n)}else if(Ut||$a(e,t,n,!1),h=(n&e.childLanes)!==0,Ut||h){if(h=mt,h!==null&&(l=Ya(h,n),l!==0&&l!==w.retryLane))throw w.retryLane=l,ga(e,l),yn(h,e,l),uc;Ic(g)||wr(),t=gc(e,t,n)}else Ic(g)?(t.flags|=192,t.child=e.child,t=null):(e=w.treeContext,gt=Kn(g.nextSibling),Qt=t,tt=!0,Hl=null,Hn=!1,e!==null&&Ad(t,e),t=pc(t,l.children),t.flags|=4096);return t}return a?(Fl(),g=l.fallback,a=t.mode,w=e.child,A=w.sibling,l=vl(w,{mode:"hidden",children:l.children}),l.subtreeFlags=w.subtreeFlags&65011712,A!==null?g=vl(A,g):(g=ba(g,a,n,null),g.flags|=2),g.return=t,l.return=t,l.sibling=g,t.child=l,$i(null,l),l=t.child,g=e.child.memoizedState,g===null?g=hc(n):(a=g.cachePool,a!==null?(w=Lt._currentValue,a=a.parent!==w?{parent:w,pool:w}:a):a=zd(),g={baseLanes:g.baseLanes|n,cachePool:a}),l.memoizedState=g,l.childLanes=mc(e,h,n),t.memoizedState=fc,$i(e.child,l)):(Xl(t),n=e.child,e=n.sibling,n=vl(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 pc(e,t){return t=hr({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function hr(e,t){return e=Nn(22,e,null,t),e.lanes=0,e}function gc(e,t,n){return Ta(t,e.child,null,n),e=pc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Zf(e,t,n){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),ko(e.return,t,n)}function bc(e,t,n,l,a,s){var h=e.memoizedState;h===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:n,tailMode:a,treeForkCount:s}:(h.isBackwards=t,h.rendering=null,h.renderingStartTime=0,h.last=l,h.tail=n,h.tailMode=a,h.treeForkCount=s)}function Qf(e,t,n){var l=t.pendingProps,a=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,Se(jt,h),Jt(e,t,l,n),l=tt?Yi:0,!g&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Zf(e,n,t);else if(e.tag===19)Zf(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(a){case"forwards":for(n=t.child,a=null;n!==null;)e=n.alternate,e!==null&&tr(e)===null&&(a=n),n=n.sibling;n=a,n===null?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null),bc(t,!1,a,n,s,l);break;case"backwards":case"unstable_legacy-backwards":for(n=null,a=t.child,t.child=null;a!==null;){if(e=a.alternate,e!==null&&tr(e)===null){t.child=a;break}e=a.sibling,a.sibling=n,n=a,a=e}bc(t,!0,n,null,s,l);break;case"together":bc(t,!1,null,null,void 0,l);break;default:t.memoizedState=null}return t.child}function Nl(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Il|=t.lanes,(n&t.childLanes)===0)if(e!==null){if($a(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=vl(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=vl(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function yc(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Zs(e)))}function cb(e,t,n){switch(t.tag){case 3:Oe(t,t.stateNode.containerInfo),Kl(t,Lt,e.memoizedState.cache),ya();break;case 27:case 5:Ve(t);break;case 4:Oe(t,t.stateNode.containerInfo);break;case 10:Kl(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,qo(t),null;break;case 13:var l=t.memoizedState;if(l!==null)return l.dehydrated!==null?(Xl(t),t.flags|=128,null):(n&t.child.childLanes)!==0?Ff(e,t,n):(Xl(t),e=Nl(e,t,n),e!==null?e.sibling:null);Xl(t);break;case 19:var a=(e.flags&128)!==0;if(l=(n&t.childLanes)!==0,l||($a(e,t,n,!1),l=(n&t.childLanes)!==0),a){if(l)return Qf(e,t,n);t.flags|=128}if(a=t.memoizedState,a!==null&&(a.rendering=null,a.tail=null,a.lastEffect=null),Se(jt,jt.current),l)break;return null;case 22:return t.lanes=0,Yf(e,t,n,t.pendingProps);case 24:Kl(t,Lt,e.memoizedState.cache)}return Nl(e,t,n)}function If(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Ut=!0;else{if(!yc(e,n)&&(t.flags&128)===0)return Ut=!1,cb(e,t,n);Ut=(e.flags&131072)!==0}else Ut=!1,tt&&(t.flags&1048576)!==0&&Ed(t,Yi,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=wa(t.elementType),t.type=e,typeof e=="function")Co(e)?(l=Ea(e,l),t.tag=1,t=Vf(null,t,e,l,n)):(t.tag=0,t=dc(null,t,e,l,n));else{if(e!=null){var a=e.$$typeof;if(a===te){t.tag=11,t=Uf(null,t,e,l,n);break e}else if(a===O){t.tag=14,t=Bf(null,t,e,l,n);break e}}throw t=Re(e)||e,Error(c(306,t,""))}}return t;case 0:return dc(e,t,t.type,t.pendingProps,n);case 1:return l=t.type,a=Ea(l,t.pendingProps),Vf(e,t,l,a,n);case 3:e:{if(Oe(t,t.stateNode.containerInfo),e===null)throw Error(c(387));l=t.pendingProps;var s=t.memoizedState;a=s.element,Bo(e,t),Qi(t,l,null,n);var h=t.memoizedState;if(l=h.cache,Kl(t,Lt,l),l!==s.cache&&_o(t,[Lt],n,!0),Zi(),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=Xf(e,t,l,n);break e}else if(l!==a){a=On(Error(c(424)),t),Ki(a),t=Xf(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(gt=Kn(e.firstChild),Qt=t,tt=!0,Hl=null,Hn=!0,n=Hd(t,null,l,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(ya(),l===a){t=Nl(e,t,n);break e}Jt(e,t,l,n)}t=t.child}return t;case 26:return fr(e,t),e===null?(n=sm(t.type,null,t.pendingProps,null))?t.memoizedState=n:tt||(n=t.type,e=t.pendingProps,l=jr(Be.current).createElement(n),l[me]=t,l[Te]=e,Wt(l,n,e),ye(l),t.stateNode=l):t.memoizedState=sm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Ve(t),e===null&&tt&&(l=t.stateNode=lm(t.type,t.pendingProps,Be.current),Qt=t,Hn=!0,a=gt,ea(t.type)?(Wc=a,gt=Kn(l.firstChild)):gt=a),Jt(e,t,t.pendingProps.children,n),fr(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&tt&&((a=l=gt)&&(l=Hb(l,t.type,t.pendingProps,Hn),l!==null?(t.stateNode=l,Qt=t,gt=Kn(l.firstChild),Hn=!1,a=!0):a=!1),a||Yl(t)),Ve(t),a=t.type,s=t.pendingProps,h=e!==null?e.memoizedProps:null,l=s.children,Fc(a,s)?l=null:h!==null&&Fc(a,h)&&(t.flags|=32),t.memoizedState!==null&&(a=Xo(e,t,eb,null,null,n),ms._currentValue=a),fr(e,t),Jt(e,t,l,n),t.child;case 6:return e===null&&tt&&((e=n=gt)&&(n=Yb(n,t.pendingProps,Hn),n!==null?(t.stateNode=n,Qt=t,gt=null,e=!0):e=!1),e||Yl(t)),null;case 13:return Ff(e,t,n);case 4:return Oe(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=Ta(t,null,l,n):Jt(e,t,l,n),t.child;case 11:return Uf(e,t,t.type,t.pendingProps,n);case 7:return Jt(e,t,t.pendingProps,n),t.child;case 8:return Jt(e,t,t.pendingProps.children,n),t.child;case 12:return Jt(e,t,t.pendingProps.children,n),t.child;case 10:return l=t.pendingProps,Kl(t,t.type,l.value),Jt(e,t,l.children,n),t.child;case 9:return a=t.type._context,l=t.pendingProps.children,xa(t),a=It(a),l=l(a),t.flags|=1,Jt(e,t,l,n),t.child;case 14:return Bf(e,t,t.type,t.pendingProps,n);case 15:return Hf(e,t,t.type,t.pendingProps,n);case 19:return Qf(e,t,n);case 31:return ob(e,t,n);case 22:return Yf(e,t,n,t.pendingProps);case 24:return xa(t),l=It(Lt),e===null?(a=Lo(),a===null&&(a=mt,s=zo(),a.pooledCache=s,s.refCount++,s!==null&&(a.pooledCacheLanes|=n),a=s),t.memoizedState={parent:l,cache:a},Uo(t),Kl(t,Lt,a)):((e.lanes&n)!==0&&(Bo(e,t),Qi(t,null,null,n),Zi()),a=e.memoizedState,s=t.memoizedState,a.parent!==l?(a={parent:l,cache:l},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Kl(t,Lt,l)):(l=s.cache,Kl(t,Lt,l),l!==a.cache&&_o(t,[Lt],n,!0))),Jt(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(c(156,t.tag))}function El(e){e.flags|=4}function vc(e,t,n,l,a){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(a&335544128)===a)if(e.stateNode.complete)e.flags|=8192;else if(wh())e.flags|=8192;else throw Ca=Ws,Oo}else e.flags&=-16777217}function Jf(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!dm(t))if(wh())e.flags|=8192;else throw Ca=Ws,Oo}function mr(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?ca():536870912,e.lanes|=t,di|=t)}function es(e,t){if(!tt)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var l=null;n!==null;)n.alternate!==null&&(l=n),n=n.sibling;l===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function bt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,l=0;if(t)for(var a=e.child;a!==null;)n|=a.lanes|a.childLanes,l|=a.subtreeFlags&65011712,l|=a.flags&65011712,a.return=e,a=a.sibling;else for(a=e.child;a!==null;)n|=a.lanes|a.childLanes,l|=a.subtreeFlags,l|=a.flags,a.return=e,a=a.sibling;return e.subtreeFlags|=l,e.childLanes=n,t}function ub(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 bt(t),null;case 1:return bt(t),null;case 3:return n=t.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),wl(Lt),$e(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Pa(t)?El(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,jo())),bt(t),null;case 26:var a=t.type,s=t.memoizedState;return e===null?(El(t),s!==null?(bt(t),Jf(t,s)):(bt(t),vc(t,a,null,l,n))):s?s!==e.memoizedState?(El(t),bt(t),Jf(t,s)):(bt(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&El(t),bt(t),vc(t,a,e,l,n)),null;case 27:if(nt(t),n=Be.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&El(t);else{if(!l){if(t.stateNode===null)throw Error(c(166));return bt(t),null}e=je.current,Pa(t)?Rd(t):(e=lm(a,l,n),t.stateNode=e,El(t))}return bt(t),null;case 5:if(nt(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&El(t);else{if(!l){if(t.stateNode===null)throw Error(c(166));return bt(t),null}if(s=je.current,Pa(t))Rd(t);else{var h=jr(Be.current);switch(s){case 1:s=h.createElementNS("http://www.w3.org/2000/svg",a);break;case 2:s=h.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;default:switch(a){case"svg":s=h.createElementNS("http://www.w3.org/2000/svg",a);break;case"math":s=h.createElementNS("http://www.w3.org/1998/Math/MathML",a);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(a,{is:l.is}):h.createElement(a)}}s[me]=t,s[Te]=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(Wt(s,a,l),a){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&El(t)}}return bt(t),vc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&El(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(c(166));if(e=Be.current,Pa(t)){if(e=t.stateNode,n=t.memoizedProps,l=null,a=Qt,a!==null)switch(a.tag){case 27:case 5:l=a.memoizedProps}e[me]=t,e=!!(e.nodeValue===n||l!==null&&l.suppressHydrationWarning===!0||Fh(e.nodeValue,n)),e||Yl(t,!0)}else e=jr(e).createTextNode(l),e[me]=t,t.stateNode=e}return bt(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(l=Pa(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[me]=t}else ya(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;bt(t),e=!1}else n=jo(),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 bt(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Pa(t),l!==null&&l.dehydrated!==null){if(e===null){if(!a)throw Error(c(318));if(a=t.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(c(317));a[me]=t}else ya(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;bt(t),a=!1}else a=jo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)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,a=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(a=l.alternate.memoizedState.cachePool.pool),s=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(s=l.memoizedState.cachePool.pool),s!==a&&(l.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),mr(t,t.updateQueue),bt(t),null);case 4:return $e(),e===null&&Kc(t.stateNode.containerInfo),bt(t),null;case 10:return wl(t.type),bt(t),null;case 19:if(H(jt),l=t.memoizedState,l===null)return bt(t),null;if(a=(t.flags&128)!==0,s=l.rendering,s===null)if(a)es(l,!1);else{if(Nt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(s=tr(e),s!==null){for(t.flags|=128,es(l,!1),e=s.updateQueue,t.updateQueue=e,mr(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Cd(n,e),n=n.sibling;return Se(jt,jt.current&1|2),tt&&xl(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&ne()>vr&&(t.flags|=128,a=!0,es(l,!1),t.lanes=4194304)}else{if(!a)if(e=tr(s),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,mr(t,e),es(l,!0),l.tail===null&&l.tailMode==="hidden"&&!s.alternate&&!tt)return bt(t),null}else 2*ne()-l.renderingStartTime>vr&&n!==536870912&&(t.flags|=128,a=!0,es(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=ne(),e.sibling=null,n=jt.current,Se(jt,a?n&1|2:n&1),tt&&xl(t,l.treeForkCount),e):(bt(t),null);case 22:case 23:return An(t),Go(),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&&(bt(t),t.subtreeFlags&6&&(t.flags|=8192)):bt(t),n=t.updateQueue,n!==null&&mr(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&&H(Sa),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),wl(Lt),bt(t),null;case 25:return null;case 30:return null}throw Error(c(156,t.tag))}function db(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 wl(Lt),$e(),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));ya()}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));ya()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return H(jt),null;case 4:return $e(),null;case 10:return wl(t.type),null;case 22:case 23:return An(t),Go(),e!==null&&H(Sa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return wl(Lt),null;case 25:return null;default:return null}}function Wf(e,t){switch(Ao(t),t.tag){case 3:wl(Lt),$e();break;case 26:case 27:case 5:nt(t);break;case 4:$e();break;case 31:t.memoizedState!==null&&An(t);break;case 13:An(t);break;case 19:H(jt);break;case 10:wl(t.type);break;case 22:case 23:An(t),Go(),e!==null&&H(Sa);break;case 24:wl(Lt)}}function ts(e,t){try{var n=t.updateQueue,l=n!==null?n.lastEffect:null;if(l!==null){var a=l.next;n=a;do{if((n.tag&e)===e){l=void 0;var s=n.create,h=n.inst;l=s(),h.destroy=l}n=n.next}while(n!==a)}}catch(g){ot(t,t.return,g)}}function Zl(e,t,n){try{var l=t.updateQueue,a=l!==null?l.lastEffect:null;if(a!==null){var s=a.next;l=s;do{if((l.tag&e)===e){var h=l.inst,g=h.destroy;if(g!==void 0){h.destroy=void 0,a=t;var w=n,A=g;try{A()}catch(B){ot(a,w,B)}}}l=l.next}while(l!==s)}}catch(B){ot(t,t.return,B)}}function Pf(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Kd(t,n)}catch(l){ot(e,e.return,l)}}}function $f(e,t,n){n.props=Ea(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(l){ot(e,t,l)}}function ns(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof n=="function"?e.refCleanup=n(l):n.current=l}}catch(a){ot(e,t,a)}}function fl(e,t){var n=e.ref,l=e.refCleanup;if(n!==null)if(typeof l=="function")try{l()}catch(a){ot(e,t,a)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(a){ot(e,t,a)}else n.current=null}function eh(e){var t=e.type,n=e.memoizedProps,l=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&l.focus();break e;case"img":n.src?l.src=n.src:n.srcSet&&(l.srcset=n.srcSet)}}catch(a){ot(e,e.return,a)}}function xc(e,t,n){try{var l=e.stateNode;zb(l,e.type,n,t),l[Te]=t}catch(a){ot(e,e.return,a)}}function th(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&ea(e.type)||e.tag===4}function Sc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||th(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&&ea(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function wc(e,t,n){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=ue));else if(l!==4&&(l===27&&ea(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(wc(e,t,n),e=e.sibling;e!==null;)wc(e,t,n),e=e.sibling}function pr(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&&ea(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(pr(e,t,n),e=e.sibling;e!==null;)pr(e,t,n),e=e.sibling}function nh(e){var t=e.stateNode,n=e.memoizedProps;try{for(var l=e.type,a=t.attributes;a.length;)t.removeAttributeNode(a[0]);Wt(t,l,n),t[me]=e,t[Te]=n}catch(s){ot(e,e.return,s)}}var Al=!1,Bt=!1,Cc=!1,lh=typeof WeakSet=="function"?WeakSet:Set,Vt=null;function fb(e,t){if(e=e.containerInfo,Vc=Or,e=md(e),go(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var l=n.getSelection&&n.getSelection();if(l&&l.rangeCount!==0){n=l.anchorNode;var a=l.anchorOffset,s=l.focusNode;l=l.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var h=0,g=-1,w=-1,A=0,B=0,G=e,M=null;t:for(;;){for(var D;G!==n||a!==0&&G.nodeType!==3||(g=h+a),G!==s||l!==0&&G.nodeType!==3||(w=h+l),G.nodeType===3&&(h+=G.nodeValue.length),(D=G.firstChild)!==null;)M=G,G=D;for(;;){if(G===e)break t;if(M===n&&++A===a&&(g=h),M===s&&++B===l&&(w=h),(D=G.nextSibling)!==null)break;G=M,M=G.parentNode}G=D}n=g===-1||w===-1?null:{start:g,end:w}}else n=null}n=n||{start:0,end:0}}else n=null;for(Xc={focusedElem:e,selectionRange:n},Or=!1,Vt=t;Vt!==null;)if(t=Vt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Vt=e;else for(;Vt!==null;){switch(t=Vt,s=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&s!==null){e=void 0,n=t,a=s.memoizedProps,s=s.memoizedState,l=n.stateNode;try{var ce=Ea(n.type,a);e=l.getSnapshotBeforeUpdate(ce,s),l.__reactInternalSnapshotBeforeUpdate=e}catch(Ne){ot(n,n.return,Ne)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)Qc(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Qc(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,Vt=e;break}Vt=t.return}}function ah(e,t,n){var l=n.flags;switch(n.tag){case 0:case 11:case 15:jl(e,n),l&4&&ts(5,n);break;case 1:if(jl(e,n),l&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(h){ot(n,n.return,h)}else{var a=Ea(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(a,t,e.__reactInternalSnapshotBeforeUpdate)}catch(h){ot(n,n.return,h)}}l&64&&Pf(n),l&512&&ns(n,n.return);break;case 3:if(jl(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{Kd(e,t)}catch(h){ot(n,n.return,h)}}break;case 27:t===null&&l&4&&nh(n);case 26:case 5:jl(e,n),t===null&&l&4&&eh(n),l&512&&ns(n,n.return);break;case 12:jl(e,n);break;case 31:jl(e,n),l&4&&rh(e,n);break;case 13:jl(e,n),l&4&&oh(e,n),l&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Sb.bind(null,n),Kb(e,n))));break;case 22:if(l=n.memoizedState!==null||Al,!l){t=t!==null&&t.memoizedState!==null||Bt,a=Al;var s=Bt;Al=l,(Bt=t)&&!s?Ml(e,n,(n.subtreeFlags&8772)!==0):jl(e,n),Al=a,Bt=s}break;case 30:break;default:jl(e,n)}}function ih(e){var t=e.alternate;t!==null&&(e.alternate=null,ih(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Ka(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 vt=null,mn=!1;function Rl(e,t,n){for(n=n.child;n!==null;)sh(e,t,n),n=n.sibling}function sh(e,t,n){if(Ze&&typeof Ze.onCommitFiberUnmount=="function")try{Ze.onCommitFiberUnmount(ll,n)}catch{}switch(n.tag){case 26:Bt||fl(n,t),Rl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Bt||fl(n,t);var l=vt,a=mn;ea(n.type)&&(vt=n.stateNode,mn=!1),Rl(e,t,n),ds(n.stateNode),vt=l,mn=a;break;case 5:Bt||fl(n,t);case 6:if(l=vt,a=mn,vt=null,Rl(e,t,n),vt=l,mn=a,vt!==null)if(mn)try{(vt.nodeType===9?vt.body:vt.nodeName==="HTML"?vt.ownerDocument.body:vt).removeChild(n.stateNode)}catch(s){ot(n,t,s)}else try{vt.removeChild(n.stateNode)}catch(s){ot(n,t,s)}break;case 18:vt!==null&&(mn?(e=vt,Ph(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),vi(e)):Ph(vt,n.stateNode));break;case 4:l=vt,a=mn,vt=n.stateNode.containerInfo,mn=!0,Rl(e,t,n),vt=l,mn=a;break;case 0:case 11:case 14:case 15:Zl(2,n,t),Bt||Zl(4,n,t),Rl(e,t,n);break;case 1:Bt||(fl(n,t),l=n.stateNode,typeof l.componentWillUnmount=="function"&&$f(n,t,l)),Rl(e,t,n);break;case 21:Rl(e,t,n);break;case 22:Bt=(l=Bt)||n.memoizedState!==null,Rl(e,t,n),Bt=l;break;default:Rl(e,t,n)}}function rh(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{vi(e)}catch(n){ot(t,t.return,n)}}}function oh(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{vi(e)}catch(n){ot(t,t.return,n)}}function hb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new lh),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new lh),t;default:throw Error(c(435,e.tag))}}function gr(e,t){var n=hb(e);t.forEach(function(l){if(!n.has(l)){n.add(l);var a=wb.bind(null,e,l);l.then(a,a)}})}function pn(e,t){var n=t.deletions;if(n!==null)for(var l=0;l<n.length;l++){var a=n[l],s=e,h=t,g=h;e:for(;g!==null;){switch(g.tag){case 27:if(ea(g.type)){vt=g.stateNode,mn=!1;break e}break;case 5:vt=g.stateNode,mn=!1;break e;case 3:case 4:vt=g.stateNode.containerInfo,mn=!0;break e}g=g.return}if(vt===null)throw Error(c(160));sh(s,h,a),vt=null,mn=!1,s=a.alternate,s!==null&&(s.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)ch(t,e),t=t.sibling}var Wn=null;function ch(e,t){var n=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:pn(t,e),gn(e),l&4&&(Zl(3,e,e.return),ts(3,e),Zl(5,e,e.return));break;case 1:pn(t,e),gn(e),l&512&&(Bt||n===null||fl(n,n.return)),l&64&&Al&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?l:n.concat(l))));break;case 26:var a=Wn;if(pn(t,e),gn(e),l&512&&(Bt||n===null||fl(n,n.return)),l&4){var s=n!==null?n.memoizedState:null;if(l=e.memoizedState,n===null)if(l===null)if(e.stateNode===null){e:{l=e.type,n=e.memoizedProps,a=a.ownerDocument||a;t:switch(l){case"title":s=a.getElementsByTagName("title")[0],(!s||s[rl]||s[me]||s.namespaceURI==="http://www.w3.org/2000/svg"||s.hasAttribute("itemprop"))&&(s=a.createElement(l),a.head.insertBefore(s,a.querySelector("head > title"))),Wt(s,l,n),s[me]=e,ye(s),l=s;break e;case"link":var h=cm("link","href",a).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=a.createElement(l),Wt(s,l,n),a.head.appendChild(s);break;case"meta":if(h=cm("meta","content",a).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=a.createElement(l),Wt(s,l,n),a.head.appendChild(s);break;default:throw Error(c(468,l))}s[me]=e,ye(s),l=s}e.stateNode=l}else um(a,e.type,e.stateNode);else e.stateNode=om(a,l,e.memoizedProps);else s!==l?(s===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):s.count--,l===null?um(a,e.type,e.stateNode):om(a,l,e.memoizedProps)):l===null&&e.stateNode!==null&&xc(e,e.memoizedProps,n.memoizedProps)}break;case 27:pn(t,e),gn(e),l&512&&(Bt||n===null||fl(n,n.return)),n!==null&&l&4&&xc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(pn(t,e),gn(e),l&512&&(Bt||n===null||fl(n,n.return)),e.flags&32){a=e.stateNode;try{bl(a,"")}catch(ce){ot(e,e.return,ce)}}l&4&&e.stateNode!=null&&(a=e.memoizedProps,xc(e,a,n!==null?n.memoizedProps:a)),l&1024&&(Cc=!0);break;case 6:if(pn(t,e),gn(e),l&4){if(e.stateNode===null)throw Error(c(162));l=e.memoizedProps,n=e.stateNode;try{n.nodeValue=l}catch(ce){ot(e,e.return,ce)}}break;case 3:if(_r=null,a=Wn,Wn=Mr(t.containerInfo),pn(t,e),Wn=a,gn(e),l&4&&n!==null&&n.memoizedState.isDehydrated)try{vi(t.containerInfo)}catch(ce){ot(e,e.return,ce)}Cc&&(Cc=!1,uh(e));break;case 4:l=Wn,Wn=Mr(e.stateNode.containerInfo),pn(t,e),gn(e),Wn=l;break;case 12:pn(t,e),gn(e);break;case 31:pn(t,e),gn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,gr(e,l)));break;case 13:pn(t,e),gn(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(yr=ne()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,gr(e,l)));break;case 22:a=e.memoizedState!==null;var w=n!==null&&n.memoizedState!==null,A=Al,B=Bt;if(Al=A||a,Bt=B||w,pn(t,e),Bt=B,Al=A,gn(e),l&8192)e:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||w||Al||Bt||Aa(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){w=n=t;try{if(s=w.stateNode,a)h=s.style,typeof h.setProperty=="function"?h.setProperty("display","none","important"):h.display="none";else{g=w.stateNode;var G=w.memoizedProps.style,M=G!=null&&G.hasOwnProperty("display")?G.display:null;g.style.display=M==null||typeof M=="boolean"?"":(""+M).trim()}}catch(ce){ot(w,w.return,ce)}}}else if(t.tag===6){if(n===null){w=t;try{w.stateNode.nodeValue=a?"":w.memoizedProps}catch(ce){ot(w,w.return,ce)}}}else if(t.tag===18){if(n===null){w=t;try{var D=w.stateNode;a?$h(D,!0):$h(w.stateNode,!1)}catch(ce){ot(w,w.return,ce)}}}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,gr(e,n))));break;case 19:pn(t,e),gn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,gr(e,l)));break;case 30:break;case 21:break;default:pn(t,e),gn(e)}}function gn(e){var t=e.flags;if(t&2){try{for(var n,l=e.return;l!==null;){if(th(l)){n=l;break}l=l.return}if(n==null)throw Error(c(160));switch(n.tag){case 27:var a=n.stateNode,s=Sc(e);pr(e,s,a);break;case 5:var h=n.stateNode;n.flags&32&&(bl(h,""),n.flags&=-33);var g=Sc(e);pr(e,g,h);break;case 3:case 4:var w=n.stateNode.containerInfo,A=Sc(e);wc(e,A,w);break;default:throw Error(c(161))}}catch(B){ot(e,e.return,B)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function uh(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;uh(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function jl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)ah(e,t.alternate,t),t=t.sibling}function Aa(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Zl(4,t,t.return),Aa(t);break;case 1:fl(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&$f(t,t.return,n),Aa(t);break;case 27:ds(t.stateNode);case 26:case 5:fl(t,t.return),Aa(t);break;case 22:t.memoizedState===null&&Aa(t);break;case 30:Aa(t);break;default:Aa(t)}e=e.sibling}}function Ml(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var l=t.alternate,a=e,s=t,h=s.flags;switch(s.tag){case 0:case 11:case 15:Ml(a,s,n),ts(4,s);break;case 1:if(Ml(a,s,n),l=s,a=l.stateNode,typeof a.componentDidMount=="function")try{a.componentDidMount()}catch(A){ot(l,l.return,A)}if(l=s,a=l.updateQueue,a!==null){var g=l.stateNode;try{var w=a.shared.hiddenCallbacks;if(w!==null)for(a.shared.hiddenCallbacks=null,a=0;a<w.length;a++)Yd(w[a],g)}catch(A){ot(l,l.return,A)}}n&&h&64&&Pf(s),ns(s,s.return);break;case 27:nh(s);case 26:case 5:Ml(a,s,n),n&&l===null&&h&4&&eh(s),ns(s,s.return);break;case 12:Ml(a,s,n);break;case 31:Ml(a,s,n),n&&h&4&&rh(a,s);break;case 13:Ml(a,s,n),n&&h&4&&oh(a,s);break;case 22:s.memoizedState===null&&Ml(a,s,n),ns(s,s.return);break;case 30:break;default:Ml(a,s,n)}t=t.sibling}}function Tc(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&&Gi(n))}function Nc(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Gi(e))}function Pn(e,t,n,l){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)dh(e,t,n,l),t=t.sibling}function dh(e,t,n,l){var a=t.flags;switch(t.tag){case 0:case 11:case 15:Pn(e,t,n,l),a&2048&&ts(9,t);break;case 1:Pn(e,t,n,l);break;case 3:Pn(e,t,n,l),a&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Gi(e)));break;case 12:if(a&2048){Pn(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(w){ot(t,t.return,w)}}else Pn(e,t,n,l);break;case 31:Pn(e,t,n,l);break;case 13:Pn(e,t,n,l);break;case 23:break;case 22:s=t.stateNode,h=t.alternate,t.memoizedState!==null?s._visibility&2?Pn(e,t,n,l):ls(e,t):s._visibility&2?Pn(e,t,n,l):(s._visibility|=2,oi(e,t,n,l,(t.subtreeFlags&10256)!==0||!1)),a&2048&&Tc(h,t);break;case 24:Pn(e,t,n,l),a&2048&&Nc(t.alternate,t);break;default:Pn(e,t,n,l)}}function oi(e,t,n,l,a){for(a=a&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var s=e,h=t,g=n,w=l,A=h.flags;switch(h.tag){case 0:case 11:case 15:oi(s,h,g,w,a),ts(8,h);break;case 23:break;case 22:var B=h.stateNode;h.memoizedState!==null?B._visibility&2?oi(s,h,g,w,a):ls(s,h):(B._visibility|=2,oi(s,h,g,w,a)),a&&A&2048&&Tc(h.alternate,h);break;case 24:oi(s,h,g,w,a),a&&A&2048&&Nc(h.alternate,h);break;default:oi(s,h,g,w,a)}t=t.sibling}}function ls(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,l=t,a=l.flags;switch(l.tag){case 22:ls(n,l),a&2048&&Tc(l.alternate,l);break;case 24:ls(n,l),a&2048&&Nc(l.alternate,l);break;default:ls(n,l)}t=t.sibling}}var as=8192;function ci(e,t,n){if(e.subtreeFlags&as)for(e=e.child;e!==null;)fh(e,t,n),e=e.sibling}function fh(e,t,n){switch(e.tag){case 26:ci(e,t,n),e.flags&as&&e.memoizedState!==null&&$b(n,Wn,e.memoizedState,e.memoizedProps);break;case 5:ci(e,t,n);break;case 3:case 4:var l=Wn;Wn=Mr(e.stateNode.containerInfo),ci(e,t,n),Wn=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=as,as=16777216,ci(e,t,n),as=l):ci(e,t,n));break;default:ci(e,t,n)}}function hh(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 is(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];Vt=l,ph(l,e)}hh(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)mh(e),e=e.sibling}function mh(e){switch(e.tag){case 0:case 11:case 15:is(e),e.flags&2048&&Zl(9,e,e.return);break;case 3:is(e);break;case 12:is(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,br(e)):is(e);break;default:is(e)}}function br(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];Vt=l,ph(l,e)}hh(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Zl(8,t,t.return),br(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,br(t));break;default:br(t)}e=e.sibling}}function ph(e,t){for(;Vt!==null;){var n=Vt;switch(n.tag){case 0:case 11:case 15:Zl(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:Gi(n.memoizedState.cache)}if(l=n.child,l!==null)l.return=n,Vt=l;else e:for(n=e;Vt!==null;){l=Vt;var a=l.sibling,s=l.return;if(ih(l),l===n){Vt=null;break e}if(a!==null){a.return=s,Vt=a;break e}Vt=s}}}var mb={getCacheForType:function(e){var t=It(Lt),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return It(Lt).controller.signal}},pb=typeof WeakMap=="function"?WeakMap:Map,it=0,mt=null,Qe=null,Je=0,rt=0,Rn=null,Ql=!1,ui=!1,Ec=!1,kl=0,Nt=0,Il=0,Ra=0,Ac=0,jn=0,di=0,ss=null,bn=null,Rc=!1,yr=0,gh=0,vr=1/0,xr=null,Jl=null,Yt=0,Wl=null,fi=null,_l=0,jc=0,Mc=null,bh=null,rs=0,kc=null;function Mn(){return(it&2)!==0&&Je!==0?Je&-Je:_.T!==null?Uc():ie()}function yh(){if(jn===0)if((Je&536870912)===0||tt){var e=Sn;Sn<<=1,(Sn&3932160)===0&&(Sn=262144),jn=e}else jn=536870912;return e=En.current,e!==null&&(e.flags|=32),jn}function yn(e,t,n){(e===mt&&(rt===2||rt===9)||e.cancelPendingCommit!==null)&&(hi(e,0),Pl(e,Je,jn,!1)),zn(e,n),((it&2)===0||e!==mt)&&(e===mt&&((it&2)===0&&(Ra|=n),Nt===4&&Pl(e,Je,jn,!1)),hl(e))}function vh(e,t,n){if((it&6)!==0)throw Error(c(327));var l=!n&&(t&127)===0&&(t&e.expiredLanes)===0||al(e,t),a=l?yb(e,t):zc(e,t,!0),s=l;do{if(a===0){ui&&!l&&Pl(e,t,0,!1);break}else{if(n=e.current.alternate,s&&!gb(n)){a=zc(e,t,!1),s=!1;continue}if(a===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;a=ss;var w=g.current.memoizedState.isDehydrated;if(w&&(hi(g,h).flags|=256),h=zc(g,h,!1),h!==2){if(Ec&&!w){g.errorRecoveryDisabledLanes|=s,Ra|=s,a=4;break e}s=bn,bn=a,s!==null&&(bn===null?bn=s:bn.push.apply(bn,s))}a=h}if(s=!1,a!==2)continue}}if(a===1){hi(e,0),Pl(e,t,0,!0);break}e:{switch(l=e,s=a,s){case 0:case 1:throw Error(c(345));case 4:if((t&4194048)!==t)break;case 6:Pl(l,t,jn,!Ql);break e;case 2:bn=null;break;case 3:case 5:break;default:throw Error(c(329))}if((t&62914560)===t&&(a=yr+300-ne(),10<a)){if(Pl(l,t,jn,!Ql),pl(l,0,!0)!==0)break e;_l=t,l.timeoutHandle=Jh(xh.bind(null,l,n,bn,xr,Rc,t,jn,Ra,di,Ql,s,"Throttled",-0,0),a);break e}xh(l,n,bn,xr,Rc,t,jn,Ra,di,Ql,s,null,-0,0)}}break}while(!0);hl(e)}function xh(e,t,n,l,a,s,h,g,w,A,B,G,M,D){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:ue},fh(t,s,G);var ce=(s&62914560)===s?yr-ne():(s&4194048)===s?gh-ne():0;if(ce=ey(G,ce),ce!==null){_l=s,e.cancelPendingCommit=ce(Rh.bind(null,e,t,s,n,l,a,h,g,w,B,G,null,M,D)),Pl(e,s,h,!A);return}}Rh(e,t,s,n,l,a,h,g,w)}function gb(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var l=0;l<n.length;l++){var a=n[l],s=a.getSnapshot;a=a.value;try{if(!Tn(s(),a))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Pl(e,t,n,l){t&=~Ac,t&=~Ra,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var a=t;0<a;){var s=31-kt(a),h=1<<s;l[s]=-1,a&=~h}n!==0&&Ba(e,n,t)}function Sr(){return(it&6)===0?(os(0),!1):!0}function _c(){if(Qe!==null){if(rt===0)var e=Qe.return;else e=Qe,Sl=va=null,Qo(e),li=null,Vi=0,e=Qe;for(;e!==null;)Wf(e.alternate,e),e=e.return;Qe=null}}function hi(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Ob(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),_l=0,_c(),mt=e,Qe=n=vl(e.current,null),Je=t,rt=0,Rn=null,Ql=!1,ui=al(e,t),Ec=!1,di=jn=Ac=Ra=Il=Nt=0,bn=ss=null,Rc=!1,(t&8)!==0&&(t|=t&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=t;0<l;){var a=31-kt(l),s=1<<a;t|=e[a],l&=~s}return kl=t,Gs(),n}function Sh(e,t){Le=null,_.H=Pi,t===ni||t===Js?(t=Od(),rt=3):t===Oo?(t=Od(),rt=4):rt=t===uc?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Rn=t,Qe===null&&(Nt=1,ur(e,On(t,e.current)))}function wh(){var e=En.current;return e===null?!0:(Je&4194048)===Je?Yn===null:(Je&62914560)===Je||(Je&536870912)!==0?e===Yn:!1}function Ch(){var e=_.H;return _.H=Pi,e===null?Pi:e}function Th(){var e=_.A;return _.A=mb,e}function wr(){Nt=4,Ql||(Je&4194048)!==Je&&En.current!==null||(ui=!0),(Il&134217727)===0&&(Ra&134217727)===0||mt===null||Pl(mt,Je,jn,!1)}function zc(e,t,n){var l=it;it|=2;var a=Ch(),s=Th();(mt!==e||Je!==t)&&(xr=null,hi(e,t)),t=!1;var h=Nt;e:do try{if(rt!==0&&Qe!==null){var g=Qe,w=Rn;switch(rt){case 8:_c(),h=6;break e;case 3:case 2:case 9:case 6:En.current===null&&(t=!0);var A=rt;if(rt=0,Rn=null,mi(e,g,w,A),n&&ui){h=0;break e}break;default:A=rt,rt=0,Rn=null,mi(e,g,w,A)}}bb(),h=Nt;break}catch(B){Sh(e,B)}while(!0);return t&&e.shellSuspendCounter++,Sl=va=null,it=l,_.H=a,_.A=s,Qe===null&&(mt=null,Je=0,Gs()),h}function bb(){for(;Qe!==null;)Nh(Qe)}function yb(e,t){var n=it;it|=2;var l=Ch(),a=Th();mt!==e||Je!==t?(xr=null,vr=ne()+500,hi(e,t)):ui=al(e,t);e:do try{if(rt!==0&&Qe!==null){t=Qe;var s=Rn;t:switch(rt){case 1:rt=0,Rn=null,mi(e,t,s,1);break;case 2:case 9:if(Dd(s)){rt=0,Rn=null,Eh(t);break}t=function(){rt!==2&&rt!==9||mt!==e||(rt=7),hl(e)},s.then(t,t);break e;case 3:rt=7;break e;case 4:rt=5;break e;case 7:Dd(s)?(rt=0,Rn=null,Eh(t)):(rt=0,Rn=null,mi(e,t,s,7));break;case 5:var h=null;switch(Qe.tag){case 26:h=Qe.memoizedState;case 5:case 27:var g=Qe;if(h?dm(h):g.stateNode.complete){rt=0,Rn=null;var w=g.sibling;if(w!==null)Qe=w;else{var A=g.return;A!==null?(Qe=A,Cr(A)):Qe=null}break t}}rt=0,Rn=null,mi(e,t,s,5);break;case 6:rt=0,Rn=null,mi(e,t,s,6);break;case 8:_c(),Nt=6;break e;default:throw Error(c(462))}}vb();break}catch(B){Sh(e,B)}while(!0);return Sl=va=null,_.H=l,_.A=a,it=n,Qe!==null?0:(mt=null,Je=0,Gs(),Nt)}function vb(){for(;Qe!==null&&!cn();)Nh(Qe)}function Nh(e){var t=If(e.alternate,e,kl);e.memoizedProps=e.pendingProps,t===null?Cr(e):Qe=t}function Eh(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=qf(n,t,t.pendingProps,t.type,void 0,Je);break;case 11:t=qf(n,t,t.pendingProps,t.type.render,t.ref,Je);break;case 5:Qo(t);default:Wf(n,t),t=Qe=Cd(t,kl),t=If(n,t,kl)}e.memoizedProps=e.pendingProps,t===null?Cr(e):Qe=t}function mi(e,t,n,l){Sl=va=null,Qo(t),li=null,Vi=0;var a=t.return;try{if(rb(e,a,t,n,Je)){Nt=1,ur(e,On(n,e.current)),Qe=null;return}}catch(s){if(a!==null)throw Qe=a,s;Nt=1,ur(e,On(n,e.current)),Qe=null;return}t.flags&32768?(tt||l===1?e=!0:ui||(Je&536870912)!==0?e=!1:(Ql=e=!0,(l===2||l===9||l===3||l===6)&&(l=En.current,l!==null&&l.tag===13&&(l.flags|=16384))),Ah(t,e)):Cr(t)}function Cr(e){var t=e;do{if((t.flags&32768)!==0){Ah(t,Ql);return}e=t.return;var n=ub(t.alternate,t,kl);if(n!==null){Qe=n;return}if(t=t.sibling,t!==null){Qe=t;return}Qe=t=e}while(t!==null);Nt===0&&(Nt=5)}function Ah(e,t){do{var n=db(e.alternate,e);if(n!==null){n.flags&=32767,Qe=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Qe=e;return}Qe=e=n}while(e!==null);Nt=6,Qe=null}function Rh(e,t,n,l,a,s,h,g,w){e.cancelPendingCommit=null;do Tr();while(Yt!==0);if((it&6)!==0)throw Error(c(327));if(t!==null){if(t===e.current)throw Error(c(177));if(s=t.lanes|t.childLanes,s|=So,ua(e,n,s,h,g,w),e===mt&&(Qe=mt=null,Je=0),fi=t,Wl=e,_l=n,jc=s,Mc=a,bh=l,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Cb(Fe,function(){return zh(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||l){l=_.T,_.T=null,a=V.p,V.p=2,h=it,it|=4;try{fb(e,t,n)}finally{it=h,V.p=a,_.T=l}}Yt=1,jh(),Mh(),kh()}}function jh(){if(Yt===1){Yt=0;var e=Wl,t=fi,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=_.T,_.T=null;var l=V.p;V.p=2;var a=it;it|=4;try{ch(t,e);var s=Xc,h=md(e.containerInfo),g=s.focusedElem,w=s.selectionRange;if(h!==g&&g&&g.ownerDocument&&hd(g.ownerDocument.documentElement,g)){if(w!==null&&go(g)){var A=w.start,B=w.end;if(B===void 0&&(B=A),"selectionStart"in g)g.selectionStart=A,g.selectionEnd=Math.min(B,g.value.length);else{var G=g.ownerDocument||document,M=G&&G.defaultView||window;if(M.getSelection){var D=M.getSelection(),ce=g.textContent.length,Ne=Math.min(w.start,ce),dt=w.end===void 0?Ne:Math.min(w.end,ce);!D.extend&&Ne>dt&&(h=dt,dt=Ne,Ne=h);var T=fd(g,Ne),C=fd(g,dt);if(T&&C&&(D.rangeCount!==1||D.anchorNode!==T.node||D.anchorOffset!==T.offset||D.focusNode!==C.node||D.focusOffset!==C.offset)){var N=G.createRange();N.setStart(T.node,T.offset),D.removeAllRanges(),Ne>dt?(D.addRange(N),D.extend(C.node,C.offset)):(N.setEnd(C.node,C.offset),D.addRange(N))}}}}for(G=[],D=g;D=D.parentNode;)D.nodeType===1&&G.push({element:D,left:D.scrollLeft,top:D.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}}Or=!!Vc,Xc=Vc=null}finally{it=a,V.p=l,_.T=n}}e.current=t,Yt=2}}function Mh(){if(Yt===2){Yt=0;var e=Wl,t=fi,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=_.T,_.T=null;var l=V.p;V.p=2;var a=it;it|=4;try{ah(e,t.alternate,t)}finally{it=a,V.p=l,_.T=n}}Yt=3}}function kh(){if(Yt===4||Yt===3){Yt=0,Pt();var e=Wl,t=fi,n=_l,l=bh;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?Yt=5:(Yt=0,fi=Wl=null,_h(e,e.pendingLanes));var a=e.pendingLanes;if(a===0&&(Jl=null),Y(n),t=t.stateNode,Ze&&typeof Ze.onCommitFiberRoot=="function")try{Ze.onCommitFiberRoot(ll,t,void 0,(t.current.flags&128)===128)}catch{}if(l!==null){t=_.T,a=V.p,V.p=2,_.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{_.T=t,V.p=a}}(_l&3)!==0&&Tr(),hl(e),a=e.pendingLanes,(n&261930)!==0&&(a&42)!==0?e===kc?rs++:(rs=0,kc=e):rs=0,os(0)}}function _h(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Gi(t)))}function Tr(){return jh(),Mh(),kh(),zh()}function zh(){if(Yt!==5)return!1;var e=Wl,t=jc;jc=0;var n=Y(_l),l=_.T,a=V.p;try{V.p=32>n?32:n,_.T=null,n=Mc,Mc=null;var s=Wl,h=_l;if(Yt=0,fi=Wl=null,_l=0,(it&6)!==0)throw Error(c(331));var g=it;if(it|=4,mh(s.current),dh(s,s.current,h,n),it=g,os(0,!1),Ze&&typeof Ze.onPostCommitFiberRoot=="function")try{Ze.onPostCommitFiberRoot(ll,s)}catch{}return!0}finally{V.p=a,_.T=l,_h(e,t)}}function Dh(e,t,n){t=On(n,t),t=cc(e.stateNode,t,2),e=Vl(e,t,2),e!==null&&(zn(e,2),hl(e))}function ot(e,t,n){if(e.tag===3)Dh(e,e,n);else for(;t!==null;){if(t.tag===3){Dh(t,e,n);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Jl===null||!Jl.has(l))){e=On(n,e),n=Lf(2),l=Vl(t,n,2),l!==null&&(Of(n,l,t,e),zn(l,2),hl(l));break}}t=t.return}}function Dc(e,t,n){var l=e.pingCache;if(l===null){l=e.pingCache=new pb;var a=new Set;l.set(t,a)}else a=l.get(t),a===void 0&&(a=new Set,l.set(t,a));a.has(n)||(Ec=!0,a.add(n),e=xb.bind(null,e,t,n),t.then(e,e))}function xb(e,t,n){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,mt===e&&(Je&n)===n&&(Nt===4||Nt===3&&(Je&62914560)===Je&&300>ne()-yr?(it&2)===0&&hi(e,0):Ac|=n,di===Je&&(di=0)),hl(e)}function Lh(e,t){t===0&&(t=ca()),e=ga(e,t),e!==null&&(zn(e,t),hl(e))}function Sb(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Lh(e,n)}function wb(e,t){var n=0;switch(e.tag){case 31:case 13:var l=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(c(314))}l!==null&&l.delete(t),Lh(e,n)}function Cb(e,t){return wt(e,t)}var Nr=null,pi=null,Lc=!1,Er=!1,Oc=!1,$l=0;function hl(e){e!==pi&&e.next===null&&(pi===null?Nr=pi=e:pi=pi.next=e),Er=!0,Lc||(Lc=!0,Nb())}function os(e,t){if(!Oc&&Er){Oc=!0;do for(var n=!1,l=Nr;l!==null;){if(e!==0){var a=l.pendingLanes;if(a===0)var s=0;else{var h=l.suspendedLanes,g=l.pingedLanes;s=(1<<31-kt(42|e)+1)-1,s&=a&~(h&~g),s=s&201326741?s&201326741|1:s?s|2:0}s!==0&&(n=!0,Hh(l,s))}else s=Je,s=pl(l,l===mt?s:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(s&3)===0||al(l,s)||(n=!0,Hh(l,s));l=l.next}while(n);Oc=!1}}function Tb(){Oh()}function Oh(){Er=Lc=!1;var e=0;$l!==0&&Lb()&&(e=$l);for(var t=ne(),n=null,l=Nr;l!==null;){var a=l.next,s=Uh(l,t);s===0?(l.next=null,n===null?Nr=a:n.next=a,a===null&&(pi=n)):(n=l,(e!==0||(s&3)!==0)&&(Er=!0)),l=a}Yt!==0&&Yt!==5||os(e),$l!==0&&($l=0)}function Uh(e,t){for(var n=e.suspendedLanes,l=e.pingedLanes,a=e.expirationTimes,s=e.pendingLanes&-62914561;0<s;){var h=31-kt(s),g=1<<h,w=a[h];w===-1?((g&n)===0||(g&l)!==0)&&(a[h]=Ua(g,t)):w<=t&&(e.expiredLanes|=g),s&=~g}if(t=mt,n=Je,n=pl(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,n===0||e===t&&(rt===2||rt===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&tn(l),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||al(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(l!==null&&tn(l),Y(n)){case 2:case 8:n=et;break;case 32:n=Fe;break;case 268435456:n=Gt;break;default:n=Fe}return l=Bh.bind(null,e),n=wt(n,l),e.callbackPriority=t,e.callbackNode=n,t}return l!==null&&l!==null&&tn(l),e.callbackPriority=2,e.callbackNode=null,2}function Bh(e,t){if(Yt!==0&&Yt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Tr()&&e.callbackNode!==n)return null;var l=Je;return l=pl(e,e===mt?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(vh(e,l,t),Uh(e,ne()),e.callbackNode!=null&&e.callbackNode===n?Bh.bind(null,e):null)}function Hh(e,t){if(Tr())return null;vh(e,t,!0)}function Nb(){Ub(function(){(it&6)!==0?wt(Me,Tb):Oh()})}function Uc(){if($l===0){var e=ei;e===0&&(e=$t,$t<<=1,($t&261888)===0&&($t=256)),$l=e}return $l}function Yh(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:sn(""+e)}function Kh(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 Eb(e,t,n,l,a){if(t==="submit"&&n&&n.stateNode===a){var s=Yh((a[Te]||null).action),h=l.submitter;h&&(t=(t=h[Te]||null)?Yh(t.formAction):h.getAttribute("formAction"),t!==null&&(s=t,h=null));var g=new Bs("action","action",null,l,a);e.push({event:g,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if($l!==0){var w=h?Kh(a,h):new FormData(a);lc(n,{pending:!0,data:w,method:a.method,action:s},null,w)}}else typeof s=="function"&&(g.preventDefault(),w=h?Kh(a,h):new FormData(a),lc(n,{pending:!0,data:w,method:a.method,action:s},s,w))},currentTarget:a}]})}}for(var Bc=0;Bc<xo.length;Bc++){var Hc=xo[Bc],Ab=Hc.toLowerCase(),Rb=Hc[0].toUpperCase()+Hc.slice(1);Jn(Ab,"on"+Rb)}Jn(bd,"onAnimationEnd"),Jn(yd,"onAnimationIteration"),Jn(vd,"onAnimationStart"),Jn("dblclick","onDoubleClick"),Jn("focusin","onFocus"),Jn("focusout","onBlur"),Jn(Vg,"onTransitionRun"),Jn(Xg,"onTransitionStart"),Jn(Fg,"onTransitionCancel"),Jn(xd,"onTransitionEnd"),Rt("onMouseEnter",["mouseout","mouseover"]),Rt("onMouseLeave",["mouseout","mouseover"]),Rt("onPointerEnter",["pointerout","pointerover"]),Rt("onPointerLeave",["pointerout","pointerover"]),Ct("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ct("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ct("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ct("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ct("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ct("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var cs="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(" "),jb=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(cs));function Gh(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var l=e[n],a=l.event;l=l.listeners;e:{var s=void 0;if(t)for(var h=l.length-1;0<=h;h--){var g=l[h],w=g.instance,A=g.currentTarget;if(g=g.listener,w!==s&&a.isPropagationStopped())break e;s=g,a.currentTarget=A;try{s(a)}catch(B){Ks(B)}a.currentTarget=null,s=w}else for(h=0;h<l.length;h++){if(g=l[h],w=g.instance,A=g.currentTarget,g=g.listener,w!==s&&a.isPropagationStopped())break e;s=g,a.currentTarget=A;try{s(a)}catch(B){Ks(B)}a.currentTarget=null,s=w}}}}function Ie(e,t){var n=t[yt];n===void 0&&(n=t[yt]=new Set);var l=e+"__bubble";n.has(l)||(qh(t,e,2,!1),n.add(l))}function Yc(e,t,n){var l=0;t&&(l|=4),qh(n,e,l,t)}var Ar="_reactListening"+Math.random().toString(36).slice(2);function Kc(e){if(!e[Ar]){e[Ar]=!0,le.forEach(function(n){n!=="selectionchange"&&(jb.has(n)||Yc(n,!1,e),Yc(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ar]||(t[Ar]=!0,Yc("selectionchange",!1,t))}}function qh(e,t,n,l){switch(ym(t)){case 2:var a=ly;break;case 8:a=ay;break;default:a=nu}n=a.bind(null,t,n,e),a=void 0,!so||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(a=!0),l?a!==void 0?e.addEventListener(t,n,{capture:!0,passive:a}):e.addEventListener(t,n,!0):a!==void 0?e.addEventListener(t,n,{passive:a}):e.addEventListener(t,n,!1)}function Gc(e,t,n,l,a){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===a)break;if(h===4)for(h=l.return;h!==null;){var w=h.tag;if((w===3||w===4)&&h.stateNode.containerInfo===a)return;h=h.return}for(;g!==null;){if(h=F(g),h===null)return;if(w=h.tag,w===5||w===6||w===26||w===27){l=s=h;continue e}g=g.parentNode}}l=l.return}Mi(function(){var A=s,B=ht(n),G=[];e:{var M=Sd.get(e);if(M!==void 0){var D=Bs,ce=e;switch(e){case"keypress":if(Os(n)===0)break e;case"keydown":case"keyup":D=wg;break;case"focusin":ce="focus",D=uo;break;case"focusout":ce="blur",D=uo;break;case"beforeblur":case"afterblur":D=uo;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":D=Ju;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":D=ug;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":D=Ng;break;case bd:case yd:case vd:D=hg;break;case xd:D=Ag;break;case"scroll":case"scrollend":D=og;break;case"wheel":D=jg;break;case"copy":case"cut":case"paste":D=pg;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":D=Pu;break;case"toggle":case"beforetoggle":D=kg}var Ne=(t&4)!==0,dt=!Ne&&(e==="scroll"||e==="scrollend"),T=Ne?M!==null?M+"Capture":null:M;Ne=[];for(var C=A,N;C!==null;){var K=C;if(N=K.stateNode,K=K.tag,K!==5&&K!==26&&K!==27||N===null||T===null||(K=ki(C,T),K!=null&&Ne.push(us(C,K,N))),dt)break;C=C.return}0<Ne.length&&(M=new D(M,ce,null,n,B),G.push({event:M,listeners:Ne}))}}if((t&7)===0){e:{if(M=e==="mouseover"||e==="pointerover",D=e==="mouseout"||e==="pointerout",M&&n!==zt&&(ce=n.relatedTarget||n.fromElement)&&(F(ce)||ce[_t]))break e;if((D||M)&&(M=B.window===B?B:(M=B.ownerDocument)?M.defaultView||M.parentWindow:window,D?(ce=n.relatedTarget||n.toElement,D=A,ce=ce?F(ce):null,ce!==null&&(dt=f(ce),Ne=ce.tag,ce!==dt||Ne!==5&&Ne!==27&&Ne!==6)&&(ce=null)):(D=null,ce=A),D!==ce)){if(Ne=Ju,K="onMouseLeave",T="onMouseEnter",C="mouse",(e==="pointerout"||e==="pointerover")&&(Ne=Pu,K="onPointerLeave",T="onPointerEnter",C="pointer"),dt=D==null?M:de(D),N=ce==null?M:de(ce),M=new Ne(K,C+"leave",D,n,B),M.target=dt,M.relatedTarget=N,K=null,F(B)===A&&(Ne=new Ne(T,C+"enter",ce,n,B),Ne.target=N,Ne.relatedTarget=dt,K=Ne),dt=K,D&&ce)t:{for(Ne=Mb,T=D,C=ce,N=0,K=T;K;K=Ne(K))N++;K=0;for(var ve=C;ve;ve=Ne(ve))K++;for(;0<N-K;)T=Ne(T),N--;for(;0<K-N;)C=Ne(C),K--;for(;N--;){if(T===C||C!==null&&T===C.alternate){Ne=T;break t}T=Ne(T),C=Ne(C)}Ne=null}else Ne=null;D!==null&&Vh(G,M,D,Ne,!1),ce!==null&&dt!==null&&Vh(G,dt,ce,Ne,!0)}}e:{if(M=A?de(A):window,D=M.nodeName&&M.nodeName.toLowerCase(),D==="select"||D==="input"&&M.type==="file")var lt=sd;else if(ad(M))if(rd)lt=Kg;else{lt=Hg;var fe=Bg}else D=M.nodeName,!D||D.toLowerCase()!=="input"||M.type!=="checkbox"&&M.type!=="radio"?A&&De(A.elementType)&&(lt=sd):lt=Yg;if(lt&&(lt=lt(e,A))){id(G,lt,n,B);break e}fe&&fe(e,M,A),e==="focusout"&&A&&M.type==="number"&&A.memoizedProps.value!=null&&Va(M,"number",M.value)}switch(fe=A?de(A):window,e){case"focusin":(ad(fe)||fe.contentEditable==="true")&&(Fa=fe,bo=A,Hi=null);break;case"focusout":Hi=bo=Fa=null;break;case"mousedown":yo=!0;break;case"contextmenu":case"mouseup":case"dragend":yo=!1,pd(G,n,B);break;case"selectionchange":if(qg)break;case"keydown":case"keyup":pd(G,n,B)}var Ue;if(ho)e:{switch(e){case"compositionstart":var We="onCompositionStart";break e;case"compositionend":We="onCompositionEnd";break e;case"compositionupdate":We="onCompositionUpdate";break e}We=void 0}else Xa?nd(e,n)&&(We="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(We="onCompositionStart");We&&($u&&n.locale!=="ko"&&(Xa||We!=="onCompositionStart"?We==="onCompositionEnd"&&Xa&&(Ue=Qu()):(Ul=B,ro="value"in Ul?Ul.value:Ul.textContent,Xa=!0)),fe=Rr(A,We),0<fe.length&&(We=new Wu(We,e,null,n,B),G.push({event:We,listeners:fe}),Ue?We.data=Ue:(Ue=ld(n),Ue!==null&&(We.data=Ue)))),(Ue=zg?Dg(e,n):Lg(e,n))&&(We=Rr(A,"onBeforeInput"),0<We.length&&(fe=new Wu("onBeforeInput","beforeinput",null,n,B),G.push({event:fe,listeners:We}),fe.data=Ue)),Eb(G,e,A,n,B)}Gh(G,t)})}function us(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Rr(e,t){for(var n=t+"Capture",l=[];e!==null;){var a=e,s=a.stateNode;if(a=a.tag,a!==5&&a!==26&&a!==27||s===null||(a=ki(e,n),a!=null&&l.unshift(us(e,a,s)),a=ki(e,t),a!=null&&l.push(us(e,a,s))),e.tag===3)return l;e=e.return}return[]}function Mb(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Vh(e,t,n,l,a){for(var s=t._reactName,h=[];n!==null&&n!==l;){var g=n,w=g.alternate,A=g.stateNode;if(g=g.tag,w!==null&&w===l)break;g!==5&&g!==26&&g!==27||A===null||(w=A,a?(A=ki(n,s),A!=null&&h.unshift(us(n,A,w))):a||(A=ki(n,s),A!=null&&h.push(us(n,A,w)))),n=n.return}h.length!==0&&e.push({event:t,listeners:h})}var kb=/\r\n?/g,_b=/\u0000|\uFFFD/g;function Xh(e){return(typeof e=="string"?e:""+e).replace(kb,`
33
+ `).replace(_b,"")}function Fh(e,t){return t=Xh(t),Xh(e)===t}function ut(e,t,n,l,a,s){switch(n){case"children":typeof l=="string"?t==="body"||t==="textarea"&&l===""||bl(e,l):(typeof l=="number"||typeof l=="bigint")&&t!=="body"&&bl(e,""+l);break;case"className":Ga(e,"class",l);break;case"tabIndex":Ga(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":Ga(e,n,l);break;case"style":oe(e,l,s);break;case"data":if(t!=="object"){Ga(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=sn(""+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"&&ut(e,t,"name",a.name,a,null),ut(e,t,"formEncType",a.formEncType,a,null),ut(e,t,"formMethod",a.formMethod,a,null),ut(e,t,"formTarget",a.formTarget,a,null)):(ut(e,t,"encType",a.encType,a,null),ut(e,t,"method",a.method,a,null),ut(e,t,"target",a.target,a,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(n);break}l=sn(""+l),e.setAttribute(n,l);break;case"onClick":l!=null&&(e.onclick=ue);break;case"onScroll":l!=null&&Ie("scroll",e);break;case"onScrollEnd":l!=null&&Ie("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(c(61));if(n=l.__html,n!=null){if(a.children!=null)throw Error(c(60));e.innerHTML=n}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}n=sn(""+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":Ie("beforetoggle",e),Ie("toggle",e),Ol(e,"popover",l);break;case"xlinkActuate":Zn(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Zn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Zn(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Zn(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Zn(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Zn(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Zn(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Zn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Zn(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Ol(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=Ht.get(n)||n,Ol(e,n,l))}}function qc(e,t,n,l,a,s){switch(n){case"style":oe(e,l,s);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(c(61));if(n=l.__html,n!=null){if(a.children!=null)throw Error(c(60));e.innerHTML=n}}break;case"children":typeof l=="string"?bl(e,l):(typeof l=="number"||typeof l=="bigint")&&bl(e,""+l);break;case"onScroll":l!=null&&Ie("scroll",e);break;case"onScrollEnd":l!=null&&Ie("scrollend",e);break;case"onClick":l!=null&&(e.onclick=ue);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ft.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(a=n.endsWith("Capture"),t=n.slice(2,a?n.length-7:void 0),s=e[Te]||null,s=s!=null?s[n]:null,typeof s=="function"&&e.removeEventListener(t,s,a),typeof l=="function")){typeof s!="function"&&s!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,l,a);break e}n in e?e[n]=l:l===!0?e.setAttribute(n,""):Ol(e,n,l)}}}function Wt(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ie("error",e),Ie("load",e);var l=!1,a=!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":a=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(c(137,t));default:ut(e,t,s,h,n,null)}}a&&ut(e,t,"srcSet",n.srcSet,n,null),l&&ut(e,t,"src",n.src,n,null);return;case"input":Ie("invalid",e);var g=s=h=a=null,w=null,A=null;for(l in n)if(n.hasOwnProperty(l)){var B=n[l];if(B!=null)switch(l){case"name":a=B;break;case"type":h=B;break;case"checked":w=B;break;case"defaultChecked":A=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:ut(e,t,l,B,n,null)}}ji(e,s,g,w,A,h,a,!1);return;case"select":Ie("invalid",e),l=h=s=null;for(a in n)if(n.hasOwnProperty(a)&&(g=n[a],g!=null))switch(a){case"value":s=g;break;case"defaultValue":h=g;break;case"multiple":l=g;default:ut(e,t,a,g,n,null)}t=s,n=h,e.multiple=!!l,t!=null?Qn(e,!!l,t,!1):n!=null&&Qn(e,!!l,n,!0);return;case"textarea":Ie("invalid",e),s=a=l=null;for(h in n)if(n.hasOwnProperty(h)&&(g=n[h],g!=null))switch(h){case"value":l=g;break;case"defaultValue":a=g;break;case"children":s=g;break;case"dangerouslySetInnerHTML":if(g!=null)throw Error(c(91));break;default:ut(e,t,h,g,n,null)}fa(e,l,a,s);return;case"option":for(w in n)if(n.hasOwnProperty(w)&&(l=n[w],l!=null))switch(w){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:ut(e,t,w,l,n,null)}return;case"dialog":Ie("beforetoggle",e),Ie("toggle",e),Ie("cancel",e),Ie("close",e);break;case"iframe":case"object":Ie("load",e);break;case"video":case"audio":for(l=0;l<cs.length;l++)Ie(cs[l],e);break;case"image":Ie("error",e),Ie("load",e);break;case"details":Ie("toggle",e);break;case"embed":case"source":case"link":Ie("error",e),Ie("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(A in n)if(n.hasOwnProperty(A)&&(l=n[A],l!=null))switch(A){case"children":case"dangerouslySetInnerHTML":throw Error(c(137,t));default:ut(e,t,A,l,n,null)}return;default:if(De(t)){for(B in n)n.hasOwnProperty(B)&&(l=n[B],l!==void 0&&qc(e,t,B,l,n,void 0));return}}for(g in n)n.hasOwnProperty(g)&&(l=n[g],l!=null&&ut(e,t,g,l,n,null))}function zb(e,t,n,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var a=null,s=null,h=null,g=null,w=null,A=null,B=null;for(D in n){var G=n[D];if(n.hasOwnProperty(D)&&G!=null)switch(D){case"checked":break;case"value":break;case"defaultValue":w=G;default:l.hasOwnProperty(D)||ut(e,t,D,null,l,G)}}for(var M in l){var D=l[M];if(G=n[M],l.hasOwnProperty(M)&&(D!=null||G!=null))switch(M){case"type":s=D;break;case"name":a=D;break;case"checked":A=D;break;case"defaultChecked":B=D;break;case"value":h=D;break;case"defaultValue":g=D;break;case"children":case"dangerouslySetInnerHTML":if(D!=null)throw Error(c(137,t));break;default:D!==G&&ut(e,t,M,D,l,G)}}Cn(e,h,g,w,A,B,s,a);return;case"select":D=h=g=M=null;for(s in n)if(w=n[s],n.hasOwnProperty(s)&&w!=null)switch(s){case"value":break;case"multiple":D=w;default:l.hasOwnProperty(s)||ut(e,t,s,null,l,w)}for(a in l)if(s=l[a],w=n[a],l.hasOwnProperty(a)&&(s!=null||w!=null))switch(a){case"value":M=s;break;case"defaultValue":g=s;break;case"multiple":h=s;default:s!==w&&ut(e,t,a,s,l,w)}t=g,n=h,l=D,M!=null?Qn(e,!!n,M,!1):!!l!=!!n&&(t!=null?Qn(e,!!n,t,!0):Qn(e,!!n,n?[]:"",!1));return;case"textarea":D=M=null;for(g in n)if(a=n[g],n.hasOwnProperty(g)&&a!=null&&!l.hasOwnProperty(g))switch(g){case"value":break;case"children":break;default:ut(e,t,g,null,l,a)}for(h in l)if(a=l[h],s=n[h],l.hasOwnProperty(h)&&(a!=null||s!=null))switch(h){case"value":M=a;break;case"defaultValue":D=a;break;case"children":break;case"dangerouslySetInnerHTML":if(a!=null)throw Error(c(91));break;default:a!==s&&ut(e,t,h,a,l,s)}da(e,M,D);return;case"option":for(var ce in n)if(M=n[ce],n.hasOwnProperty(ce)&&M!=null&&!l.hasOwnProperty(ce))switch(ce){case"selected":e.selected=!1;break;default:ut(e,t,ce,null,l,M)}for(w in l)if(M=l[w],D=n[w],l.hasOwnProperty(w)&&M!==D&&(M!=null||D!=null))switch(w){case"selected":e.selected=M&&typeof M!="function"&&typeof M!="symbol";break;default:ut(e,t,w,M,l,D)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ne in n)M=n[Ne],n.hasOwnProperty(Ne)&&M!=null&&!l.hasOwnProperty(Ne)&&ut(e,t,Ne,null,l,M);for(A in l)if(M=l[A],D=n[A],l.hasOwnProperty(A)&&M!==D&&(M!=null||D!=null))switch(A){case"children":case"dangerouslySetInnerHTML":if(M!=null)throw Error(c(137,t));break;default:ut(e,t,A,M,l,D)}return;default:if(De(t)){for(var dt in n)M=n[dt],n.hasOwnProperty(dt)&&M!==void 0&&!l.hasOwnProperty(dt)&&qc(e,t,dt,void 0,l,M);for(B in l)M=l[B],D=n[B],!l.hasOwnProperty(B)||M===D||M===void 0&&D===void 0||qc(e,t,B,M,l,D);return}}for(var T in n)M=n[T],n.hasOwnProperty(T)&&M!=null&&!l.hasOwnProperty(T)&&ut(e,t,T,null,l,M);for(G in l)M=l[G],D=n[G],!l.hasOwnProperty(G)||M===D||M==null&&D==null||ut(e,t,G,M,l,D)}function Zh(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Db(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),l=0;l<n.length;l++){var a=n[l],s=a.transferSize,h=a.initiatorType,g=a.duration;if(s&&g&&Zh(h)){for(h=0,g=a.responseEnd,l+=1;l<n.length;l++){var w=n[l],A=w.startTime;if(A>g)break;var B=w.transferSize,G=w.initiatorType;B&&Zh(G)&&(w=w.responseEnd,h+=B*(w<g?1:(g-A)/(w-A)))}if(--l,t+=8*(s+h)/(a.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Vc=null,Xc=null;function jr(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 Ih(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 Fc(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 Zc=null;function Lb(){var e=window.event;return e&&e.type==="popstate"?e===Zc?!1:(Zc=e,!0):(Zc=null,!1)}var Jh=typeof setTimeout=="function"?setTimeout:void 0,Ob=typeof clearTimeout=="function"?clearTimeout:void 0,Wh=typeof Promise=="function"?Promise:void 0,Ub=typeof queueMicrotask=="function"?queueMicrotask:typeof Wh<"u"?function(e){return Wh.resolve(null).then(e).catch(Bb)}:Jh;function Bb(e){setTimeout(function(){throw e})}function ea(e){return e==="head"}function Ph(e,t){var n=t,l=0;do{var a=n.nextSibling;if(e.removeChild(n),a&&a.nodeType===8)if(n=a.data,n==="/$"||n==="/&"){if(l===0){e.removeChild(a),vi(t);return}l--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")l++;else if(n==="html")ds(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,ds(n);for(var s=n.firstChild;s;){var h=s.nextSibling,g=s.nodeName;s[rl]||g==="SCRIPT"||g==="STYLE"||g==="LINK"&&s.rel.toLowerCase()==="stylesheet"||n.removeChild(s),s=h}}else n==="body"&&ds(e.ownerDocument.body);n=a}while(n);vi(t)}function $h(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 Qc(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":Qc(n),Ka(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function Hb(e,t,n,l){for(;e.nodeType===1;){var a=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[rl])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(s=e.getAttribute("rel"),s==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(s!==a.rel||e.getAttribute("href")!==(a.href==null||a.href===""?null:a.href)||e.getAttribute("crossorigin")!==(a.crossOrigin==null?null:a.crossOrigin)||e.getAttribute("title")!==(a.title==null?null:a.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(s=e.getAttribute("src"),(s!==(a.src==null?null:a.src)||e.getAttribute("type")!==(a.type==null?null:a.type)||e.getAttribute("crossorigin")!==(a.crossOrigin==null?null:a.crossOrigin))&&s&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var s=a.name==null?null:""+a.name;if(a.type==="hidden"&&e.getAttribute("name")===s)return e}else return e;if(e=Kn(e.nextSibling),e===null)break}return null}function Yb(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Kn(e.nextSibling),e===null))return null;return e}function em(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Kn(e.nextSibling),e===null))return null;return e}function Ic(e){return e.data==="$?"||e.data==="$~"}function Jc(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Kb(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 Kn(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 Wc=null;function tm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return Kn(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function nm(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 lm(e,t,n){switch(t=jr(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 ds(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Ka(e)}var Gn=new Map,am=new Set;function Mr(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var zl=V.d;V.d={f:Gb,r:qb,D:Vb,C:Xb,L:Fb,m:Zb,X:Ib,S:Qb,M:Jb};function Gb(){var e=zl.f(),t=Sr();return e||t}function qb(e){var t=J(e);t!==null&&t.tag===5&&t.type==="form"?Sf(t):zl.r(e)}var gi=typeof document>"u"?null:document;function im(e,t,n){var l=gi;if(l&&typeof t=="string"&&t){var a=qt(t);a='link[rel="'+e+'"][href="'+a+'"]',typeof n=="string"&&(a+='[crossorigin="'+n+'"]'),am.has(a)||(am.add(a),e={rel:e,crossOrigin:n,href:t},l.querySelector(a)===null&&(t=l.createElement("link"),Wt(t,"link",e),ye(t),l.head.appendChild(t)))}}function Vb(e){zl.D(e),im("dns-prefetch",e,null)}function Xb(e,t){zl.C(e,t),im("preconnect",e,t)}function Fb(e,t,n){zl.L(e,t,n);var l=gi;if(l&&e&&t){var a='link[rel="preload"][as="'+qt(t)+'"]';t==="image"&&n&&n.imageSrcSet?(a+='[imagesrcset="'+qt(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(a+='[imagesizes="'+qt(n.imageSizes)+'"]')):a+='[href="'+qt(e)+'"]';var s=a;switch(t){case"style":s=bi(e);break;case"script":s=yi(e)}Gn.has(s)||(e=x({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Gn.set(s,e),l.querySelector(a)!==null||t==="style"&&l.querySelector(fs(s))||t==="script"&&l.querySelector(hs(s))||(t=l.createElement("link"),Wt(t,"link",e),ye(t),l.head.appendChild(t)))}}function Zb(e,t){zl.m(e,t);var n=gi;if(n&&e){var l=t&&typeof t.as=="string"?t.as:"script",a='link[rel="modulepreload"][as="'+qt(l)+'"][href="'+qt(e)+'"]',s=a;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":s=yi(e)}if(!Gn.has(s)&&(e=x({rel:"modulepreload",href:e},t),Gn.set(s,e),n.querySelector(a)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(hs(s)))return}l=n.createElement("link"),Wt(l,"link",e),ye(l),n.head.appendChild(l)}}}function Qb(e,t,n){zl.S(e,t,n);var l=gi;if(l&&e){var a=ae(l).hoistableStyles,s=bi(e);t=t||"default";var h=a.get(s);if(!h){var g={loading:0,preload:null};if(h=l.querySelector(fs(s)))g.loading=5;else{e=x({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Gn.get(s))&&Pc(e,n);var w=h=l.createElement("link");ye(w),Wt(w,"link",e),w._p=new Promise(function(A,B){w.onload=A,w.onerror=B}),w.addEventListener("load",function(){g.loading|=1}),w.addEventListener("error",function(){g.loading|=2}),g.loading|=4,kr(h,t,l)}h={type:"stylesheet",instance:h,count:1,state:g},a.set(s,h)}}}function Ib(e,t){zl.X(e,t);var n=gi;if(n&&e){var l=ae(n).hoistableScripts,a=yi(e),s=l.get(a);s||(s=n.querySelector(hs(a)),s||(e=x({src:e,async:!0},t),(t=Gn.get(a))&&$c(e,t),s=n.createElement("script"),ye(s),Wt(s,"link",e),n.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},l.set(a,s))}}function Jb(e,t){zl.M(e,t);var n=gi;if(n&&e){var l=ae(n).hoistableScripts,a=yi(e),s=l.get(a);s||(s=n.querySelector(hs(a)),s||(e=x({src:e,async:!0,type:"module"},t),(t=Gn.get(a))&&$c(e,t),s=n.createElement("script"),ye(s),Wt(s,"link",e),n.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},l.set(a,s))}}function sm(e,t,n,l){var a=(a=Be.current)?Mr(a):null;if(!a)throw Error(c(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=bi(n.href),n=ae(a).hoistableStyles,l=n.get(t),l||(l={type:"style",instance:null,count:0,state:null},n.set(t,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=bi(n.href);var s=ae(a).hoistableStyles,h=s.get(e);if(h||(a=a.ownerDocument||a,h={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},s.set(e,h),(s=a.querySelector(fs(e)))&&!s._p&&(h.instance=s,h.state.loading=5),Gn.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},Gn.set(e,n),s||Wb(a,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=yi(n),n=ae(a).hoistableScripts,l=n.get(t),l||(l={type:"script",instance:null,count:0,state:null},n.set(t,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(c(444,e))}}function bi(e){return'href="'+qt(e)+'"'}function fs(e){return'link[rel="stylesheet"]['+e+"]"}function rm(e){return x({},e,{"data-precedence":e.precedence,precedence:null})}function Wb(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}),Wt(t,"link",n),ye(t),e.head.appendChild(t))}function yi(e){return'[src="'+qt(e)+'"]'}function hs(e){return"script[async]"+e}function om(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+qt(n.href)+'"]');if(l)return t.instance=l,ye(l),l;var a=x({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),ye(l),Wt(l,"style",a),kr(l,n.precedence,e),t.instance=l;case"stylesheet":a=bi(n.href);var s=e.querySelector(fs(a));if(s)return t.state.loading|=4,t.instance=s,ye(s),s;l=rm(n),(a=Gn.get(a))&&Pc(l,a),s=(e.ownerDocument||e).createElement("link"),ye(s);var h=s;return h._p=new Promise(function(g,w){h.onload=g,h.onerror=w}),Wt(s,"link",l),t.state.loading|=4,kr(s,n.precedence,e),t.instance=s;case"script":return s=yi(n.src),(a=e.querySelector(hs(s)))?(t.instance=a,ye(a),a):(l=n,(a=Gn.get(s))&&(l=x({},n),$c(l,a)),e=e.ownerDocument||e,a=e.createElement("script"),ye(a),Wt(a,"link",l),e.head.appendChild(a),t.instance=a);case"void":return null;default:throw Error(c(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,kr(l,n.precedence,e));return t.instance}function kr(e,t,n){for(var l=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),a=l.length?l[l.length-1]:null,s=a,h=0;h<l.length;h++){var g=l[h];if(g.dataset.precedence===t)s=g;else if(s!==a)break}s?s.parentNode.insertBefore(e,s.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Pc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function $c(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var _r=null;function cm(e,t,n){if(_r===null){var l=new Map,a=_r=new Map;a.set(n,l)}else a=_r,l=a.get(n),l||(l=new Map,a.set(n,l));if(l.has(e))return l;for(l.set(e,null),n=n.getElementsByTagName(e),a=0;a<n.length;a++){var s=n[a];if(!(s[rl]||s[me]||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 um(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function Pb(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 dm(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function $b(e,t,n,l){if(n.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var a=bi(l.href),s=t.querySelector(fs(a));if(s){t=s._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=zr.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=s,ye(s);return}s=t.ownerDocument||t,l=rm(l),(a=Gn.get(a))&&Pc(l,a),s=s.createElement("link"),ye(s);var h=s;h._p=new Promise(function(g,w){h.onload=g,h.onerror=w}),Wt(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=zr.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var eu=0;function ey(e,t){return e.stylesheets&&e.count===0&&Lr(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var l=setTimeout(function(){if(e.stylesheets&&Lr(e,e.stylesheets),e.unsuspend){var s=e.unsuspend;e.unsuspend=null,s()}},6e4+t);0<e.imgBytes&&eu===0&&(eu=62500*Db());var a=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Lr(e,e.stylesheets),e.unsuspend)){var s=e.unsuspend;e.unsuspend=null,s()}},(e.imgBytes>eu?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(a)}}:null}function zr(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Lr(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Dr=null;function Lr(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Dr=new Map,t.forEach(ty,e),Dr=null,zr.call(e))}function ty(e,t){if(!(t.state.loading&4)){var n=Dr.get(e);if(n)var l=n.get(null);else{n=new Map,Dr.set(e,n);for(var a=e.querySelectorAll("link[data-precedence],style[data-precedence]"),s=0;s<a.length;s++){var h=a[s];(h.nodeName==="LINK"||h.getAttribute("media")!=="not all")&&(n.set(h.dataset.precedence,h),l=h)}l&&n.set(null,l)}a=t.instance,h=a.getAttribute("data-precedence"),s=n.get(h)||l,s===l&&n.set(null,a),n.set(h,a),this.count++,l=zr.bind(this),a.addEventListener("load",l),a.addEventListener("error",l),s?s.parentNode.insertBefore(a,s.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(a,e.firstChild)),t.state.loading|=4}}var ms={$$typeof:Z,Provider:null,Consumer:null,_currentValue:$,_currentValue2:$,_threadCount:0};function ny(e,t,n,l,a,s,h,g,w){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=il(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=il(0),this.hiddenUpdates=il(null),this.identifierPrefix=l,this.onUncaughtError=a,this.onCaughtError=s,this.onRecoverableError=h,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=w,this.incompleteTransitions=new Map}function fm(e,t,n,l,a,s,h,g,w,A,B,G){return e=new ny(e,t,n,h,w,A,B,G,g),t=1,s===!0&&(t|=24),s=Nn(3,null,null,t),e.current=s,s.stateNode=e,t=zo(),t.refCount++,e.pooledCache=t,t.refCount++,s.memoizedState={element:l,isDehydrated:n,cache:t},Uo(s),e}function hm(e){return e?(e=Ia,e):Ia}function mm(e,t,n,l,a,s){a=hm(a),l.context===null?l.context=a:l.pendingContext=a,l=ql(t),l.payload={element:n},s=s===void 0?null:s,s!==null&&(l.callback=s),n=Vl(e,l,t),n!==null&&(yn(n,e,t),Fi(n,e,t))}function pm(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function tu(e,t){pm(e,t),(e=e.alternate)&&pm(e,t)}function gm(e){if(e.tag===13||e.tag===31){var t=ga(e,67108864);t!==null&&yn(t,e,67108864),tu(e,67108864)}}function bm(e){if(e.tag===13||e.tag===31){var t=Mn();t=U(t);var n=ga(e,t);n!==null&&yn(n,e,t),tu(e,t)}}var Or=!0;function ly(e,t,n,l){var a=_.T;_.T=null;var s=V.p;try{V.p=2,nu(e,t,n,l)}finally{V.p=s,_.T=a}}function ay(e,t,n,l){var a=_.T;_.T=null;var s=V.p;try{V.p=8,nu(e,t,n,l)}finally{V.p=s,_.T=a}}function nu(e,t,n,l){if(Or){var a=lu(l);if(a===null)Gc(e,t,l,Ur,n),vm(e,l);else if(sy(a,e,t,n,l))l.stopPropagation();else if(vm(e,l),t&4&&-1<iy.indexOf(e)){for(;a!==null;){var s=J(a);if(s!==null)switch(s.tag){case 3:if(s=s.stateNode,s.current.memoizedState.isDehydrated){var h=Fn(s.pendingLanes);if(h!==0){var g=s;for(g.pendingLanes|=2,g.entangledLanes|=2;h;){var w=1<<31-kt(h);g.entanglements[1]|=w,h&=~w}hl(s),(it&6)===0&&(vr=ne()+500,os(0))}}break;case 31:case 13:g=ga(s,2),g!==null&&yn(g,s,2),Sr(),tu(s,2)}if(s=lu(l),s===null&&Gc(e,t,l,Ur,n),s===a)break;a=s}a!==null&&l.stopPropagation()}else Gc(e,t,l,null,n)}}function lu(e){return e=ht(e),au(e)}var Ur=null;function au(e){if(Ur=null,e=F(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 Ur=e,null}function ym(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(we()){case Me:return 2;case et:return 8;case Fe:case nn:return 32;case Gt:return 268435456;default:return 32}default:return 32}}var iu=!1,ta=null,na=null,la=null,ps=new Map,gs=new Map,aa=[],iy="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 vm(e,t){switch(e){case"focusin":case"focusout":ta=null;break;case"dragenter":case"dragleave":na=null;break;case"mouseover":case"mouseout":la=null;break;case"pointerover":case"pointerout":ps.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":gs.delete(t.pointerId)}}function bs(e,t,n,l,a,s){return e===null||e.nativeEvent!==s?(e={blockedOn:t,domEventName:n,eventSystemFlags:l,nativeEvent:s,targetContainers:[a]},t!==null&&(t=J(t),t!==null&&gm(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,a!==null&&t.indexOf(a)===-1&&t.push(a),e)}function sy(e,t,n,l,a){switch(t){case"focusin":return ta=bs(ta,e,t,n,l,a),!0;case"dragenter":return na=bs(na,e,t,n,l,a),!0;case"mouseover":return la=bs(la,e,t,n,l,a),!0;case"pointerover":var s=a.pointerId;return ps.set(s,bs(ps.get(s)||null,e,t,n,l,a)),!0;case"gotpointercapture":return s=a.pointerId,gs.set(s,bs(gs.get(s)||null,e,t,n,l,a)),!0}return!1}function xm(e){var t=F(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,Ce(e.priority,function(){bm(n)});return}}else if(t===31){if(t=m(n),t!==null){e.blockedOn=t,Ce(e.priority,function(){bm(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 Br(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=lu(e.nativeEvent);if(n===null){n=e.nativeEvent;var l=new n.constructor(n.type,n);zt=l,n.target.dispatchEvent(l),zt=null}else return t=J(n),t!==null&&gm(t),e.blockedOn=n,!1;t.shift()}return!0}function Sm(e,t,n){Br(e)&&n.delete(t)}function ry(){iu=!1,ta!==null&&Br(ta)&&(ta=null),na!==null&&Br(na)&&(na=null),la!==null&&Br(la)&&(la=null),ps.forEach(Sm),gs.forEach(Sm)}function Hr(e,t){e.blockedOn===t&&(e.blockedOn=null,iu||(iu=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,ry)))}var Yr=null;function wm(e){Yr!==e&&(Yr=e,r.unstable_scheduleCallback(r.unstable_NormalPriority,function(){Yr===e&&(Yr=null);for(var t=0;t<e.length;t+=3){var n=e[t],l=e[t+1],a=e[t+2];if(typeof l!="function"){if(au(l||n)===null)continue;break}var s=J(n);s!==null&&(e.splice(t,3),t-=3,lc(s,{pending:!0,data:a,method:n.method,action:l},l,a))}}))}function vi(e){function t(w){return Hr(w,e)}ta!==null&&Hr(ta,e),na!==null&&Hr(na,e),la!==null&&Hr(la,e),ps.forEach(t),gs.forEach(t);for(var n=0;n<aa.length;n++){var l=aa[n];l.blockedOn===e&&(l.blockedOn=null)}for(;0<aa.length&&(n=aa[0],n.blockedOn===null);)xm(n),n.blockedOn===null&&aa.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(l=0;l<n.length;l+=3){var a=n[l],s=n[l+1],h=a[Te]||null;if(typeof s=="function")h||wm(n);else if(h){var g=null;if(s&&s.hasAttribute("formAction")){if(a=s,h=s[Te]||null)g=h.formAction;else if(au(a)!==null)continue}else g=h.action;typeof g=="function"?n[l+1]=g:(n.splice(l,3),l-=3),wm(n)}}}function Cm(){function e(s){s.canIntercept&&s.info==="react-transition"&&s.intercept({handler:function(){return new Promise(function(h){return a=h})},focusReset:"manual",scroll:"manual"})}function t(){a!==null&&(a(),a=null),l||setTimeout(n,20)}function n(){if(!l&&!navigation.transition){var s=navigation.currentEntry;s&&s.url!=null&&navigation.navigate(s.url,{state:s.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,a=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),a!==null&&(a(),a=null)}}}function su(e){this._internalRoot=e}Kr.prototype.render=su.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(c(409));var n=t.current,l=Mn();mm(n,l,e,t,null,null)},Kr.prototype.unmount=su.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;mm(e.current,2,null,e,null,null),Sr(),t[_t]=null}};function Kr(e){this._internalRoot=e}Kr.prototype.unstable_scheduleHydration=function(e){if(e){var t=ie();e={blockedOn:null,target:e,priority:t};for(var n=0;n<aa.length&&t!==0&&t<aa[n].priority;n++);aa.splice(n,0,e),n===0&&xm(e)}};var Tm=i.version;if(Tm!=="19.2.8")throw Error(c(527,Tm,"19.2.8"));V.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?y(e):null,e=e===null?null:e.stateNode,e};var oy={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:_,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Gr=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Gr.isDisabled&&Gr.supportsFiber)try{ll=Gr.inject(oy),Ze=Gr}catch{}}return vs.createRoot=function(e,t){if(!d(e))throw Error(c(299));var n=!1,l="",a=kf,s=_f,h=zf;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(a=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(h=t.onRecoverableError)),t=fm(e,1,!1,null,null,n,l,null,a,s,h,Cm),e[_t]=t.current,Kc(e),new su(t)},vs.hydrateRoot=function(e,t,n){if(!d(e))throw Error(c(299));var l=!1,a="",s=kf,h=_f,g=zf,w=null;return n!=null&&(n.unstable_strictMode===!0&&(l=!0),n.identifierPrefix!==void 0&&(a=n.identifierPrefix),n.onUncaughtError!==void 0&&(s=n.onUncaughtError),n.onCaughtError!==void 0&&(h=n.onCaughtError),n.onRecoverableError!==void 0&&(g=n.onRecoverableError),n.formState!==void 0&&(w=n.formState)),t=fm(e,1,!0,t,n??null,l,a,w,s,h,g,Cm),t.context=hm(null),n=t.current,l=Mn(),l=U(l),a=ql(l),a.callback=null,Vl(n,a,l),n=l,t.current.lanes=n,zn(t,n),hl(t),e[_t]=t.current,Kc(e),new Kr(t)},vs.version="19.2.8",vs}var Mm;function xy(){if(Mm)return ou.exports;Mm=1;function r(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(i){console.error(i)}}return r(),ou.exports=vy(),ou.exports}var Sy=xy();const wy=hp(Sy),Ee={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~"},Cy=new TextEncoder;function pp(r){return Cy.encode(r)}function Ty(r){if(!r||r.length===0)return"";const o=r.toUpperCase().charCodeAt(0);return o>=65&&o<=90?String.fromCharCode(o-64):r==="@"||r===" "?"\0":r==="["?"\x1B":r==="\\"?"":r==="]"?"":r==="^"?"":r==="_"?"":r==="?"?"":r}function Ny(r){return`\x1B${r}`}function Ey(r,i){let o=r;return i.shift&&r.length===1&&!i.ctrl&&(o=r.toUpperCase()),i.ctrl&&(o=Ty(o)),i.alt&&(o=Ny(o)),o}const gp=27,bp=91,Ay=60,km=59,yp=77,vp=48,Ry=57,jy=64,My=-30,du=32,_m=255;function xp(r){return Number.isInteger(r)&&(r&My)===jy}function ky(r){return r>=vp&&r<=Ry}function fu(r,i){let o=i,c=0;for(;o<r.length&&ky(r[o]);){if(c=c*10+(r[o]-vp),c>65535)return null;o+=1}return o===i?null:{value:c,next:o}}function _y(r,i){if(r[i]!==gp||r[i+1]!==bp||r[i+2]!==Ay)return-1;const o=fu(r,i+3);if(!o||!xp(o.value)||r[o.next]!==km)return-1;const c=fu(r,o.next+1);if(!c||r[c.next]!==km)return-1;const d=fu(r,c.next+1);return!d||r[d.next]!==yp?-1:d.next+1}function zy(r,i){if(r[i]!==gp||r[i+1]!==bp||r[i+2]!==yp||i+6>r.length)return-1;const o=r[i+3]-du,c=r[i+4],d=r[i+5];return!xp(o)||c<du||c>_m||d<du||d>_m?-1:i+6}function Jr(r){if(!r)return!1;const i=r instanceof Uint8Array?r:new Uint8Array(r);if(i.length===0)return!1;let o=0;for(;o<i.length;){const c=_y(i,o);if(c>o){o=c;continue}const d=zy(i,o);if(d>o){o=d;continue}return!1}return!0}class Dy{constructor(i){_e(this,"ws",null);_e(this,"config");_e(this,"state","disconnected");_e(this,"currentRole","viewer");_e(this,"controllerId");_e(this,"hostId");_e(this,"assignedClientId");_e(this,"reconnectAttempts",0);_e(this,"reconnectTimer",null);_e(this,"pingTimer",null);_e(this,"pingTimestamp",null);_e(this,"isManuallyClosed",!1);_e(this,"authFailureDetail",null);_e(this,"authFailureCode",null);_e(this,"temporaryFailureCode",null);_e(this,"pendingInputSegments",[]);_e(this,"isFlushScheduled",!1);_e(this,"listeners",{stateChange:new Set,roleChange:new Set,ready:new Set,paired:new Set,controlState:new Set,controlRevoked:new Set,sessionReady:new Set,exit:new Set,controlGranted:new Set,controlDenied:new Set,status:new Set,peerCount:new Set,hostReconnecting:new Set,sessionRestarted:new Set,error:new Set,binaryData:new Set,rttUpdate:new Set,pasteFileReady:new Set,agentStatus:new Set});_e(this,"terminalCols",80);_e(this,"terminalRows",24);this.config={...i}}updateConfig(i){this.config={...this.config,...i}}getConfig(){return{...this.config}}getState(){return this.state}getRole(){return this.currentRole}getControllerId(){return this.controllerId}getHostId(){return this.hostId}getAssignedClientId(){return this.assignedClientId}on(i,o){return this.listeners[i].add(o),()=>{this.listeners[i].delete(o)}}emit(i,...o){this.listeners[i].forEach(d=>{try{d(...o)}catch(f){console.error(`Error in event listener for ${i}:`,f)}})}setState(i,o,c){this.state!==i&&(this.state=i,this.emit("stateChange",i,o,c))}connect(i){if(i&&(this.terminalCols=i.cols,this.terminalRows=i.rows),!(this.ws&&(this.ws.readyState===WebSocket.OPEN||this.ws.readyState===WebSocket.CONNECTING))){this.teardownSocket(1e3,"Replaced by a new connection"),this.isManuallyClosed=!1,this.authFailureDetail=null,this.authFailureCode=null,this.temporaryFailureCode=null,this.clearTimers(),this.setState("connecting");try{const o=this.resolveWsUrl(this.config.wsUrl),c=new WebSocket(o);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(o){this.setState("error",o instanceof Error?o.message:"Connection failed","connection_failed"),this.scheduleReconnect()}}}isStaleSocket(i){return this.ws!==i}teardownSocket(i=1e3,o="Client closed the connection"){this.pendingInputSegments=[],this.isFlushScheduled=!1;const c=this.ws;if(c){this.ws=null,c.onopen=null,c.onmessage=null,c.onerror=null,c.onclose=null;try{(c.readyState===WebSocket.OPEN||c.readyState===WebSocket.CONNECTING)&&c.close(i,o)}catch{}}}disconnect(){this.isManuallyClosed=!0,this.clearTimers(),this.pendingInputSegments=[],this.isFlushScheduled=!1,this.teardownSocket(1e3,"User initiated disconnect"),this.setState("disconnected")}reconnectWith(i){this.updateConfig(i),this.clearTimers(),this.teardownSocket(1e3,"Reconnecting with new credentials"),this.isManuallyClosed=!1,this.reconnectAttempts=0,this.authFailureDetail=null,this.authFailureCode=null,this.temporaryFailureCode=null,this.connect()}handleOpen(){this.sendHello(),this.startHeartbeat()}async handleMessage(i){if(typeof i.data=="string")try{const o=JSON.parse(i.data);this.processJsonMessage(o)}catch(o){console.warn("Received unparseable text frame from server:",o)}else if(i.data instanceof ArrayBuffer)this.emit("binaryData",new Uint8Array(i.data));else if(typeof Blob<"u"&&i.data instanceof Blob)try{const o=await i.data.arrayBuffer();this.emit("binaryData",new Uint8Array(o))}catch(o){console.error("Failed to convert Blob to ArrayBuffer:",o)}}processJsonMessage(i){switch(i.type){case"ready":{this.reconnectAttempts=0,this.setState("connected"),this.currentRole=i.role,this.controllerId=i.controllerId,this.hostId=i.hostId,this.assignedClientId=i.clientId,this.emit("ready",i),this.emit("roleChange",i.role,i.controllerId,i.hostId,i.clientId),typeof i.clientCount=="number"&&this.emit("peerCount",i.clientCount);break}case"paired":{this.emit("paired",{token:i.token,deviceId:i.deviceId,hostId:i.hostId,expiresAt:i.expiresAt});break}case"control_state":{this.currentRole=i.role,this.controllerId=i.controllerId,this.emit("controlState",i.role,i.controllerId),this.emit("roleChange",i.role,i.controllerId,this.hostId,this.assignedClientId),typeof i.clientCount=="number"&&this.emit("peerCount",i.clientCount);break}case"host_reconnecting":{this.temporaryFailureCode="host_reconnecting",this.setState("reconnecting","Herdr host is reconnecting",i.code||"host_reconnecting"),this.emit("hostReconnecting",i.code);break}case"session_restarted":{this.setState("reconnecting","Herdr session is restarting","session_restarted"),this.emit("sessionRestarted",i.cols,i.rows,i.terminalPalette,i.hostname);break}case"control_revoked":{this.currentRole="viewer",this.emit("controlRevoked",i.reason),this.emit("roleChange","viewer",this.controllerId,this.hostId,this.assignedClientId);break}case"session_ready":{this.setState("connected"),this.emit("sessionReady",i);break}case"exit":{this.emit("exit",i.code,i.reason);break}case"control_granted":{this.currentRole="controller",this.controllerId=this.assignedClientId||this.config.clientId,this.emit("controlGranted"),this.emit("roleChange","controller",this.controllerId,this.hostId,this.assignedClientId);break}case"control_denied":{this.emit("controlDenied",i.message);break}case"status":{this.emit("status",i);break}case"error":{i.code==="host_offline"||i.code==="host_reconnecting"||i.code==="host_reconnect_timeout"||i.code==="rate_limited"?(this.temporaryFailureCode=String(i.code),this.setState("reconnecting",i.message,String(i.code))):(i.code==="auth_required"||i.code==="unauthorized"||i.code==="device_revoked"||i.code==="invalid_handshake"||i.code==="too_many_hosts"||i.code===401||i.code===403)&&(this.authFailureDetail=i.message,this.authFailureCode=String(i.code),this.setState("error",i.message,this.authFailureCode)),this.emit("error",{code:i.code,message:i.message});break}case"pong":{if(this.pingTimestamp){const o=Math.max(0,performance.now()-this.pingTimestamp);this.pingTimestamp=null,this.emit("rttUpdate",Math.round(o))}break}case"paste_file_ready":{this.emit("pasteFileReady",i.path);break}case"agent_status":{this.emit("agentStatus",i);break}}}handleError(i){console.error("WebSocket error:",i),this.emit("error",{code:"WS_ERROR",message:"WebSocket connection error"})}handleClose(i){if(this.clearTimers(),this.ws=null,this.authFailureDetail){this.setState("error",this.authFailureDetail,this.authFailureCode??void 0);return}if(i.code===1008&&this.temporaryFailureCode){this.setState("reconnecting",i.reason||"The relay is temporarily unavailable",this.temporaryFailureCode),this.scheduleReconnect();return}if(i.code===1008){this.setState("error",i.reason||"The relay rejected the connection",String(i.code));return}!this.isManuallyClosed&&this.config.autoReconnect?(this.setState("reconnecting",`Connection closed (${i.code}). Retrying...`,"connection_closed"),this.scheduleReconnect()):this.setState("disconnected",`Closed: ${i.reason||i.code}`,"connection_closed")}scheduleReconnect(){if(this.isManuallyClosed||!this.config.autoReconnect)return;if(this.config.maxReconnectAttempts>0&&this.reconnectAttempts>=this.config.maxReconnectAttempts){this.setState("error","Max reconnect attempts reached");return}this.reconnectAttempts++;const i=this.config.reconnectIntervalMs||2e3,c=Math.min(3e4,Math.floor(i*Math.pow(1.5,this.reconnectAttempts-1)+Math.random()*500));this.reconnectTimer=setTimeout(()=>{this.connect()},c)}startHeartbeat(){this.pingTimer&&clearInterval(this.pingTimer);const i=this.config.pingIntervalMs||1e4;this.pingTimer=setInterval(()=>{this.ws&&this.ws.readyState===WebSocket.OPEN&&this.sendPing()},i)}clearTimers(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.pingTimer&&(clearInterval(this.pingTimer),this.pingTimer=null)}sendHello(){const i={type:"hello",protocol:1,clientId:this.config.clientId,cols:this.terminalCols,rows:this.terminalRows,capabilities:["host_handoff"]};this.config.token&&(i.token=this.config.token),this.config.pairCode&&(i.pairCode=this.config.pairCode),this.sendJson(i)}claimControl(i=!1){const o={type:"claim_control",...i?{force:!0}:{}};this.sendJson(o)}releaseControl(){const i={type:"release_control"};this.sendJson(i)}sendResize(i,o){this.terminalCols=i,this.terminalRows=o;const c={type:"resize",cols:i,rows:o};this.sendJson(c)}sendPing(){this.pingTimestamp=performance.now();const i={type:"ping"};this.sendJson(i)}sendPasteFile(i,o){this.sendJson({type:"paste_file",mime:i,dataBase64:o})}sendJson(i){this.flushInput(),this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify(i))}sendInput(i){const o=i instanceof Uint8Array?i:new Uint8Array(i);o.length!==0&&(this.pendingInputSegments.push(o),this.isFlushScheduled||(this.isFlushScheduled=!0,queueMicrotask(()=>this.flushInput())))}flushInput(){if(this.isFlushScheduled=!1,this.pendingInputSegments.length===0)return;let i=this.pendingInputSegments;if(this.pendingInputSegments=[],this.ws&&(this.ws.bufferedAmount??0)>256*1024&&(i=i.filter(c=>!Jr(c))),i.length===0)return;let o;if(i.length===1)o=i[0];else{let c=0;for(let f=0;f<i.length;f++)c+=i[f].byteLength;o=new Uint8Array(c);let d=0;for(let f=0;f<i.length;f++)o.set(i[f],d),d+=i[f].byteLength}this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(o)}sendBinary(i){this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(i)}sendText(i){const o=pp(i);this.sendInput(o)}resolveWsUrl(i){if(/^wss?:\/\//i.test(i))return i;if(/^https?:\/\//i.test(i)){const o=new URL(i);return o.protocol=o.protocol==="https:"?"wss:":"ws:",(!o.pathname||o.pathname==="/")&&(o.pathname="/ws/client"),o.toString()}if(typeof window<"u"&&window.location){const c=window.location.protocol==="https:"?"wss:":"ws:",d=window.location.host,f=i.startsWith("/")?i:`/${i}`;return`${c}//${d}${f}`}return"ws://127.0.0.1:8787/ws/client"}}const Ly=10,Oy=24,to=15,Du=13,Lu=640;function Uy(){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 Ti()<Lu}function Ti(){return typeof window>"u"?1024:window.visualViewport&&typeof window.visualViewport.width=="number"&&window.visualViewport.width>0?window.visualViewport.width:window.innerWidth||1024}function hu(){return typeof window>"u"?768:window.visualViewport&&typeof window.visualViewport.height=="number"&&window.visualViewport.height>0?window.visualViewport.height:window.innerHeight||768}function Wr(r,i=to){const o=typeof r=="number"?r:Number(r);return!Number.isFinite(o)||o<=0?i:Math.min(Oy,Math.max(Ly,Math.round(o)))}function zm(r,i=Ti()){if(i<Lu){const c=Wr(r,Du);return Math.min(15,Math.max(12,c))}return Wr(r,to)}const Sp=[{id:"esc",label:"ESC",code:Ee.ESC,type:"key",enabled:!0,title:"Escape"},{id:"tab",label:"TAB",code:Ee.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:Ee.LEFT,type:"key",enabled:!0,title:"Arrow Left"},{id:"up",label:"↑",code:Ee.UP,type:"key",enabled:!0,title:"Arrow Up"},{id:"down",label:"↓",code:Ee.DOWN,type:"key",enabled:!0,title:"Arrow Down"},{id:"right",label:"→",code:Ee.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:Ee.ENTER,type:"key",enabled:!0,title:"Enter / Return"}],By=[{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:Ee.ESC,type:"key",enabled:!0,title:"Escape"},{id:"tab",label:"TAB",code:Ee.TAB,type:"key",enabled:!0,title:"Tab"},{id:"enter",label:"Enter",code:Ee.ENTER,type:"key",enabled:!0,title:"Enter / Return"},{id:"backspace",label:"⌫",code:Ee.BACKSPACE,type:"key",enabled:!0,title:"Backspace"},{id:"delete",label:"Del",code:Ee.DELETE,type:"key",enabled:!0,title:"Delete"},{id:"left",label:"←",code:Ee.LEFT,type:"key",enabled:!0,title:"Arrow Left"},{id:"up",label:"↑",code:Ee.UP,type:"key",enabled:!0,title:"Arrow Up"},{id:"down",label:"↓",code:Ee.DOWN,type:"key",enabled:!0,title:"Arrow Down"},{id:"right",label:"→",code:Ee.RIGHT,type:"key",enabled:!0,title:"Arrow Right"},{id:"home",label:"Home",code:Ee.HOME,type:"key",enabled:!0,title:"Home"},{id:"end",label:"End",code:Ee.END,type:"key",enabled:!0,title:"End"},{id:"page_up",label:"PgUp",code:Ee.PAGE_UP,type:"key",enabled:!0,title:"Page Up"},{id:"page_down",label:"PgDn",code:Ee.PAGE_DOWN,type:"key",enabled:!0,title:"Page Down"},{id:"insert",label:"Ins",code:Ee.INSERT,type:"key",enabled:!0,title:"Insert"},{id:"ctrl_c",label:"^C",code:Ee.CTRL_C,type:"chord",enabled:!0,title:"Ctrl+C (SIGINT)"},{id:"ctrl_d",label:"^D",code:Ee.CTRL_D,type:"chord",enabled:!0,title:"Ctrl+D (EOF/Exit)"},{id:"ctrl_z",label:"^Z",code:Ee.CTRL_Z,type:"chord",enabled:!0,title:"Ctrl+Z (SIGTSTP)"},{id:"ctrl_l",label:"^L",code:Ee.CTRL_L,type:"chord",enabled:!0,title:"Ctrl+L (Clear Screen)"},{id:"ctrl_a",label:"^A",code:Ee.CTRL_A,type:"chord",enabled:!0,title:"Ctrl+A (Beginning of Line)"},{id:"ctrl_e",label:"^E",code:Ee.CTRL_E,type:"chord",enabled:!0,title:"Ctrl+E (End of Line)"},{id:"ctrl_k",label:"^K",code:Ee.CTRL_K,type:"chord",enabled:!0,title:"Ctrl+K (Kill to End)"},{id:"ctrl_r",label:"^R",code:Ee.CTRL_R,type:"chord",enabled:!0,title:"Ctrl+R (Reverse Search)"},{id:"f1",label:"F1",code:Ee.F1,type:"fn",enabled:!0,title:"F1"},{id:"f2",label:"F2",code:Ee.F2,type:"fn",enabled:!0,title:"F2"},{id:"f3",label:"F3",code:Ee.F3,type:"fn",enabled:!0,title:"F3"},{id:"f4",label:"F4",code:Ee.F4,type:"fn",enabled:!0,title:"F4"},{id:"f5",label:"F5",code:Ee.F5,type:"fn",enabled:!0,title:"F5"},{id:"f6",label:"F6",code:Ee.F6,type:"fn",enabled:!0,title:"F6"},{id:"f7",label:"F7",code:Ee.F7,type:"fn",enabled:!0,title:"F7"},{id:"f8",label:"F8",code:Ee.F8,type:"fn",enabled:!0,title:"F8"},{id:"f9",label:"F9",code:Ee.F9,type:"fn",enabled:!0,title:"F9"},{id:"f10",label:"F10",code:Ee.F10,type:"fn",enabled:!0,title:"F10"},{id:"f11",label:"F11",code:Ee.F11,type:"fn",enabled:!0,title:"F11"},{id:"f12",label:"F12",code:Ee.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 Ms(){return JSON.parse(JSON.stringify(Sp))}const Dm=["esc","tab","ctrl","alt","left","up","down","right","enter","drawer_chords","drawer_symbols","drawer_fn"];function Hy(r){return r.length!==Dm.length?!1:r.every((i,o)=>i.id===Dm[o]&&i.enabled!==!1)}function Yy(r){if(!Array.isArray(r)||r.length===0)return Ms();const i=r.filter(o=>typeof o=="object"&&o!==null&&typeof o.id=="string"&&typeof o.label=="string"&&typeof o.code=="string");return Hy(i)?Ms():i}function Nu(r,i){if(i){const o=`keyTitles.${r.id}`,c=i(o);if(c&&c!==o)return c}return r.title||r.label}const Eu='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", "Symbols Nerd Font Mono", monospace',Ky='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',Lm="JetBrains Mono, Menlo, Monaco, Consolas, monospace",Ni="herdr_remote_settings_v1",Rs="herdr_remote_session_view_v1",wp=64,ks=4096,Au={local:{},session:{}};function Pr(r,i){if(typeof window>"u")return Au[r][i]||null;try{return(r==="local"?window.localStorage:window.sessionStorage).getItem(i)}catch{return Au[r][i]||null}}function Ma(r,i,o){if(Au[r][i]=o,!(typeof window>"u"))try{(r==="local"?window.localStorage:window.sessionStorage).setItem(i,o)}catch(c){console.warn(`Failed to write to ${r}Storage:`,c)}}function Gy(){return`client-${Math.random().toString(36).substring(2,8)}`}function Ou(){const r=Math.random().toString(36).substring(2,10);return`profile-${Date.now().toString(36)}-${r}`}function qy(r,i){return(typeof r=="string"?r.trim().slice(0,wp):"")||i}function $r(r,i){if(!r||typeof r!="object"||Array.isArray(r))return null;const o=r,c=typeof o.wsUrl=="string"?o.wsUrl.trim().slice(0,2048):"",d=typeof o.token=="string"?o.token.slice(0,ks):"",f=typeof o.pairCode=="string"?o.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 o.id=="string"&&o.id.length>0?o.id.slice(0,128):Ou(),b=typeof o.hostname=="string"&&o.hostname.trim()?o.hostname.trim().slice(0,wp):`Herdr ${i+1}`;return{id:m,displayName:qy(o.displayName,b),wsUrl:c,token:d,...f?{pairCode:f}:{},...typeof o.hostId=="string"&&o.hostId.trim()?{hostId:o.hostId.trim().slice(0,128)}:{},...typeof o.hostname=="string"&&o.hostname.trim()?{hostname:o.hostname.trim().slice(0,128)}:{},...typeof o.deviceId=="string"&&o.deviceId.trim()?{deviceId:o.deviceId.trim().slice(0,128)}:{},autoReconnect:o.autoReconnect!==!1,createdAt:Number.isFinite(o.createdAt)?Number(o.createdAt):p,lastUsedAt:Number.isFinite(o.lastUsedAt)?Number(o.lastUsedAt):p}}function Om(r,i=0){const o=$r({...r,id:r.id||Ou()},i);if(!o)throw new Error("a connection profile requires a relay URL and token or pairing code");return o}function Um(r){let i=r.wsUrl.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"").toLowerCase();if(typeof window<"u")try{const o=new URL(r.wsUrl,window.location.origin);o.protocol=o.protocol==="wss:"?"https:":"http:",o.pathname=o.pathname.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"")||"/",o.search="",o.hash="",i=o.toString().replace(/\/$/,"").toLowerCase()}catch{}return`${i}::${r.hostId||""}`}function Cp(){return typeof navigator<"u"&&navigator.language&&navigator.language.toLowerCase().startsWith("zh")?"zh":"en"}function Tp(){const r=typeof window<"u"&&window.innerWidth<640;return{wsUrl:"/ws/client",token:"",pairCode:"",clientId:Gy(),autoReconnect:!0,profiles:[],activeProfileId:"",fontSize:r?Du:to,fontFamily:Eu,toolbarVisible:!0,toolbarPosition:"bottom",vibrateOnKeyPress:!0,predictiveEcho:"auto",language:Cp(),virtualKeys:Ms(),adminToken:"",adminTokens:{}}}const Vy=["wsUrl","token","pairCode","clientId","autoReconnect","language"],Xy=["wsUrl","token","pairCode","autoReconnect"],Uu=["fontSize","fontFamily","toolbarVisible","toolbarPosition","vibrateOnKeyPress","predictiveEcho","virtualKeys","adminToken","adminTokens"],Fy=Uu.filter(r=>r!=="adminToken"&&r!=="adminTokens"),Bm=["theme","colorMode"];function Ru(r){const i=r;if(!Bm.some(d=>i[d]!==void 0))return{data:r,changed:!1};const c={...i};for(const d of Bm)delete c[d];return{data:c,changed:!0}}function Np(r){if(!r||typeof r!="object"||Array.isArray(r))return{};const i={};for(const[o,c]of Object.entries(r).slice(0,32))typeof c!="string"||c.length===0||(i[o.slice(0,512)]=c.slice(0,ks));return i}function Ep(r){var f;const i=[];if((Array.isArray(r.profiles)?r.profiles.slice(0,64):[]).forEach((p,m)=>{const b=$r(p,m);b&&!i.some(S=>S.id===b.id)&&i.push(b)}),i.length===0&&(typeof r.token=="string"&&r.token||typeof r.pairCode=="string"&&r.pairCode)){const p=$r({id:"profile-migrated",displayName:"Herdr 1",wsUrl:typeof r.wsUrl=="string"&&r.wsUrl.trim()?r.wsUrl:"/ws/client",token:r.token||"",pairCode:r.pairCode||"",autoReconnect:r.autoReconnect!==!1},0);p&&i.push(p)}const c=typeof r.activeProfileId=="string"?r.activeProfileId:"",d=i.some(p=>p.id===c)?c:((f=i[0])==null?void 0:f.id)||"";return{profiles:i,activeProfileId:d}}function Ap(){const r=Tp();if(typeof window>"u")return r;let i={};const o=Pr("local",Ni);if(o)try{i=JSON.parse(o)}catch(ee){console.warn("Failed to parse localStorage settings:",ee)}const c=Ru(i);c.changed&&(i=c.data,Ma("local",Ni,JSON.stringify(i)));let d=null;const f=Pr("session",Rs);if(f)try{d=JSON.parse(f)}catch(ee){console.warn("Failed to parse sessionStorage settings:",ee)}if(!d){const ee={};for(const be of Uu)i[be]!==void 0&&(ee[be]=i[be]);d=ee,Ma("session",Rs,JSON.stringify(d))}let p=d.fontFamily??i.fontFamily??r.fontFamily;(!p||p===Lm||p===Ky)&&(p=Eu);const m=window.innerWidth<640?Du:to,b=d.fontSize??i.fontSize??r.fontSize,S=Wr(b,m),y=d.virtualKeys??i.virtualKeys??r.virtualKeys,x=Yy(y),R=i.language??r.language,E=R==="zh"||R==="en"?R:Cp(),k=Ep(i),q=k.profiles.find(ee=>ee.id===k.activeProfileId),z=Ru(d);z.changed&&(d=z.data,Ma("session",Rs,JSON.stringify(d)));const X=d.toolbarVisible??i.toolbarVisible??r.toolbarVisible,Q=d.toolbarPosition??i.toolbarPosition??r.toolbarPosition,Z=d.vibrateOnKeyPress??i.vibrateOnKeyPress??r.vibrateOnKeyPress,te=(d==null?void 0:d.predictiveEcho)??(i==null?void 0:i.predictiveEcho)??r.predictiveEcho,he=te==="always"||te==="off"||te==="auto"?te:"auto",L=typeof d.adminToken=="string"?d.adminToken.slice(0,ks):typeof i.adminToken=="string"?i.adminToken.slice(0,ks):r.adminToken,O=Np(d.adminTokens),j={...r,...i,...d,wsUrl:(q==null?void 0:q.wsUrl)||(typeof i.wsUrl=="string"?i.wsUrl:r.wsUrl),token:(q==null?void 0:q.token)||"",pairCode:(q==null?void 0:q.pairCode)||"",autoReconnect:(q==null?void 0:q.autoReconnect)??r.autoReconnect,profiles:k.profiles,activeProfileId:k.activeProfileId,clientId:typeof i.clientId=="string"&&i.clientId.trim()?i.clientId.trim().slice(0,128):r.clientId,fontFamily:p,fontSize:S,toolbarVisible:X,toolbarPosition:Q,vibrateOnKeyPress:Z,predictiveEcho:he,virtualKeys:x,language:E,adminToken:L,adminTokens:O};return i.fontFamily===Lm&&(i.fontFamily=Eu,Ma("local",Ni,JSON.stringify(i))),j}function sa(r){var R;const o={...Ap(),...r};o.adminTokens=Np(o.adminTokens),typeof o.adminToken=="string"&&(o.adminToken=o.adminToken.slice(0,ks)),r.fontSize!==void 0&&(o.fontSize=Wr(r.fontSize)),r.predictiveEcho!==void 0&&(r.predictiveEcho==="auto"||r.predictiveEcho==="always"||r.predictiveEcho==="off"?o.predictiveEcho=r.predictiveEcho:o.predictiveEcho="auto");const c=Ep(o);let d=c.profiles,f=c.activeProfileId;if(Xy.some(E=>r[E]!==void 0)){const E=d.findIndex(z=>z.id===f),k=E>=0?{...d[E]}:{id:Ou(),displayName:`Herdr ${d.length+1}`,wsUrl:o.wsUrl,token:"",autoReconnect:!0,createdAt:Date.now(),lastUsedAt:Date.now()};k.wsUrl=o.wsUrl,k.token=o.token,k.pairCode=o.pairCode||void 0,k.autoReconnect=o.autoReconnect,k.lastUsedAt=Date.now();const q=$r(k,Math.max(E,0));q?E>=0?d[E]=q:(d.push(q),f=q.id):E>=0&&(d=d.filter(z=>z.id!==f),f=((R=d[0])==null?void 0:R.id)||"")}d.length>0&&!d.some(E=>E.id===f)&&(f=d[0].id);const m=d.find(E=>E.id===f);o.profiles=d,o.activeProfileId=f,o.wsUrl=(m==null?void 0:m.wsUrl)||o.wsUrl||"/ws/client",o.token=(m==null?void 0:m.token)||"",o.pairCode=(m==null?void 0:m.pairCode)||"",o.autoReconnect=(m==null?void 0:m.autoReconnect)??o.autoReconnect;const b=Pr("local",Ni);let S={};if(b)try{S=JSON.parse(b)}catch{}S=Ru(S).data;for(const E of Vy)o[E]!==void 0&&(S[E]=o[E]);S.profiles=d,S.activeProfileId=f,Ma("local",Ni,JSON.stringify(S));const y=Pr("session",Rs);let x={};if(y)try{x=JSON.parse(y)}catch{}for(const E of Uu)o[E]!==void 0&&(x[E]=o[E]);Ma("session",Rs,JSON.stringify(x));for(const E of Fy)o[E]!==void 0&&(S[E]=o[E]);return Ma("local",Ni,JSON.stringify(S)),o}const Zy={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"},agents:{title:"Agents on this workstation",blocked:"blocked",done:"done",working:"working",allIdle:"agents idle"},clipboard:{openLink:"Open Link",openLinkFailed:"This link cannot be opened from the browser",copySelection:"Copy Selection",copyLine:"Copy Line",copyScreen:"Copy Screen",paste:"Paste",cancel:"Cancel",copied:"Copied to clipboard",copyFailed:"Failed to copy",pasteHint:"Long-press here to paste, then tap Send",pasteSend:"Send",pasteUnavailable:"Clipboard is empty or unavailable",pasteTitle:"Paste Content",pasted:"Pasted",chooseImage:"Choose Image",takePhoto:"Take Photo",imageTooLarge:"Image exceeds 3 MB limit and cannot be compressed further.",imageCompressedSize:"Compressed: {size}",fileEmpty:"File is empty.",decodeFailed:"Failed to decode image file.",unsupportedType:"Unsupported format. Only PNG, JPEG, WebP, and GIF are supported.",imageSectionTitle:"Image",textSectionTitle:"Text",imageCompressing:"Processing image...",removeImage:"Remove image"}},Qy={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"},agents:{title:"本工作站的智能体",blocked:"待确认",done:"已完成",working:"运行中",allIdle:"智能体空闲"},clipboard:{openLink:"打开链接",openLinkFailed:"该链接无法在浏览器中打开",copySelection:"复制选中",copyLine:"复制本行",copyScreen:"复制整屏",paste:"粘贴",cancel:"取消",copied:"已复制到剪贴板",copyFailed:"复制失败",pasteHint:"长按此处粘贴,然后按发送",pasteSend:"发送",pasteUnavailable:"剪贴板为空或不可用",pasteTitle:"粘贴内容",pasted:"已粘贴",chooseImage:"选择图片",takePhoto:"拍照",imageTooLarge:"图片超过 3 MB 限制且无法进一步压缩。",imageCompressedSize:"压缩后大小:{size}",fileEmpty:"文件内容为空。",decodeFailed:"无法解析图片文件。",unsupportedType:"不支持的图片格式,仅支持 PNG、JPEG、WebP 和 GIF。",imageSectionTitle:"图片",textSectionTitle:"文本",imageCompressing:"正在处理图片...",removeImage:"移除图片"}},mu={en:Zy,zh:Qy};function Bu(r,i,o){const c=mu[r]||mu.en,d=i.split(".");let f=c;for(const p of d)if(f&&typeof f=="object"&&p in f)f=f[p];else{let m=mu.en;for(const b of d)if(m&&typeof m=="object"&&b in m)m=m[b];else return i;f=m;break}if(typeof f!="string")return i;if(o){let p=f;for(const[m,b]of Object.entries(o))p=p.replaceAll(`{${m}}`,String(b));return p}return f}const Hm="#11111b",ju=[{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 Ym(r){if(!r||typeof r!="string")return ju[0].font;const i=r.trim();if(i.includes("Symbols Nerd Font"))return i;if(/^['"]?monospace['"]?$/i.test(i))return'"Symbols Nerd Font Mono", monospace';const o=/,\s*['"]?monospace['"]?\s*$/i;return o.test(i)?i.replace(o,', "Symbols Nerd Font Mono", monospace'):`${i}, "Symbols Nerd Font Mono", monospace`}function Iy(r){if(!r)return null;const i={};return r.background&&(i.background=r.background,i.cursorAccent=r.background),r.foreground&&(i.foreground=r.foreground),r.cursor&&(i.cursor=r.cursor),r.ansi&&Object.assign(i,r.ansi),Object.keys(i).length===0?null:i}function Rp(){if(typeof document>"u")return;const r=document.querySelector('meta[name="theme-color"]');document.documentElement.style.colorScheme="dark",r==null||r.setAttribute("content",Hm),document.documentElement.classList.add("dark"),document.documentElement.classList.remove("light"),document.body.classList.add("dark"),document.body.classList.remove("light"),document.body.style.backgroundColor=Hm}const jp=1568,Jy=3*1024*1024,Wy=[.85,.7,.55,.4],$n={active:!1,phase:"idle",ratio:0,percent:0,statusText:""};function Py(r,i,o=jp){if(r<=0||i<=0)return{width:Math.max(1,r),height:Math.max(1,i)};const c=Math.max(r,i);if(c<=o)return{width:r,height:i};const d=o/c;return{width:Math.max(1,Math.round(r*d)),height:Math.max(1,Math.round(i*d))}}function $y(r){if(typeof r!="string"||r.length===0)return 0;const i=r.length;let o=0;r.endsWith("==")?o=2:r.endsWith("=")&&(o=1);const c=Math.floor(i*3/4)-o;return Number.isFinite(c)&&c>0?c:0}function ev(r){return r<1024?`${r} B`:r<1024*1024?`${(r/1024).toFixed(1)} KB`:`${(r/(1024*1024)).toFixed(1)} MB`}async function tv(r){if(typeof createImageBitmap=="function")try{const i=await createImageBitmap(r,{imageOrientation:"from-image"});return{source:i,width:i.width,height:i.height,cleanup:()=>{typeof i.close=="function"&&i.close()}}}catch{try{const i=await createImageBitmap(r);return{source:i,width:i.width,height:i.height,cleanup:()=>{typeof i.close=="function"&&i.close()}}}catch{}}return new Promise((i,o)=>{if(typeof Image>"u")return o(new Error("Image decoding not supported in this environment"));const c=new Image,d=URL.createObjectURL(r);c.onload=()=>{i({source:c,width:c.naturalWidth||c.width,height:c.naturalHeight||c.height,cleanup:()=>{try{URL.revokeObjectURL(d)}catch{}}})},c.onerror=()=>{try{URL.revokeObjectURL(d)}catch{}o(new Error("Failed to decode image source"))},c.src=d})}async function Mp(r,i=jp,o=Jy){var d;if(!r||r.size===0||r.type&&!r.type.startsWith("image/"))return null;let c;try{c=await tv(r)}catch(f){return console.warn("Failed to decode image for paste:",f),null}try{const{width:f,height:p}=Py(c.width,c.height,i),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 y of Wy){let x;try{x=m.toDataURL(S,y)}catch{continue}if(!x||!x.startsWith("data:"))continue;const R=x.indexOf(","),E=R!==-1?x.slice(R+1):"",k=$y(E);if(k<=o)return{mime:S,dataBase64:E,dataUrl:x,byteLength:k,width:f,height:p}}return null}finally{(d=c.cleanup)==null||d.call(c)}}const nv=4e3,lv=3,av=4096,iv=8*1024*1024,kp=v.createContext(null);function xi(r){return{wsUrl:r.wsUrl,token:r.token||void 0,pairCode:r.pairCode||void 0,clientId:r.clientId,autoReconnect:r.autoReconnect,reconnectIntervalMs:2e3,maxReconnectAttempts:0,pingIntervalMs:1e4}}const sv=({children:r})=>{const[i,o]=v.useState(Ap),[c,d]=v.useState("disconnected"),[f,p]=v.useState(),[m,b]=v.useState(),[S,y]=v.useState("viewer"),[x,R]=v.useState(),[E,k]=v.useState(),[q,z]=v.useState(),[X,Q]=v.useState(null),[Z,te]=v.useState(),[he,L]=v.useState(null),[O,j]=v.useState(1),[ee,be]=v.useState(0),[Ae,xe]=v.useState(null),[pe,Re]=v.useState(null),[Ye,_]=v.useState(null),[V,$]=v.useState({cols:80,rows:24}),[ze,I]=v.useState([]);v.useEffect(()=>{Rp()},[]);const ke=v.useRef(i);ke.current=i;const H=v.useRef(null),Se=v.useRef(!1),je=v.useRef(V);je.current=V;const Ke=v.useRef(new Set),[Be,Pe]=v.useState($n),Oe=v.useRef(null),$e=v.useRef(0),Ve=v.useRef(null),nt=v.useCallback((U,Y)=>Bu(i.language,U,Y),[i.language]),Xe=v.useRef(nt);Xe.current=nt;const Et=v.useRef(null),ft=v.useRef([]),Xt=v.useRef(0),on=v.useCallback(U=>{for(ft.current.push(U),Xt.current+=U.byteLength;ft.current.length>av||Xt.current>iv;){const Y=ft.current.shift();if(!Y)break;Xt.current-=Y.byteLength}},[]),nl=v.useCallback(U=>{const Y=Et.current;if(Y)try{Y(U);return}catch(ie){console.debug("Terminal output sink threw, buffering chunk instead:",ie)}on(U)},[on]),St=v.useRef(nl);St.current=nl;const st=v.useCallback(U=>{Et.current=U;const Y=ft.current;ft.current=[],Xt.current=0;for(let ie=0;ie<Y.length;ie++)try{U(Y[ie])}catch(Ce){console.debug("Terminal sink threw while flushing, re-buffering the tail:",Ce);for(let ge=ie;ge<Y.length;ge++)on(Y[ge]);break}return()=>{Et.current===U&&(Et.current=null)}},[on]),wt=v.useCallback(()=>ft.current.length,[]),tn=v.useCallback(()=>{ft.current=[],Xt.current=0},[]),cn=v.useCallback((U=!0)=>{y("viewer"),R(void 0),k(void 0),z(void 0),Q(null),te(void 0),L(null),j(1),xe(null),tn(),U&&be(Y=>Y+1)},[tn]),Pt=v.useRef([]),ne=v.useRef(new Map),we=v.useCallback(U=>{Pt.current=U,I(U)},[]),Me=v.useCallback(U=>{const Y=ne.current.get(U);Y&&(clearTimeout(Y),ne.current.delete(U)),we(Pt.current.filter(ie=>ie.id!==U))},[we]),et=v.useRef(Me);et.current=Me;const Fe=v.useCallback((U,Y)=>{const ie=Date.now(),Ce=Pt.current,ge=Ce.find(yt=>yt.type===U&&yt.message===Y),me=ge?ge.id:`${ie}-${Math.random().toString(36).substring(2,6)}`;let Te;if(ge)Te=Ce.map(yt=>yt.id===me?{...yt,count:yt.count+1,timestamp:ie}:yt);else for(Te=[...Ce,{id:me,type:U,message:Y,timestamp:ie,count:1}];Te.length>lv;){const[yt,...gl]=Te,sl=ne.current.get(yt.id);sl&&(clearTimeout(sl),ne.current.delete(yt.id)),Te=gl}we(Te);const _t=ne.current.get(me);_t&&clearTimeout(_t),ne.current.set(me,setTimeout(()=>et.current(me),nv))},[we]),nn=v.useCallback(U=>{et.current(U)},[]),Gt=v.useRef(!0);v.useEffect(()=>{S==="controller"&&(Gt.current=!0)},[S]);const At=v.useCallback(()=>{Gt.current&&(Gt.current=!1,Fe("warning",Xe.current("toasts.viewerModeWarning")))},[Fe]);v.useEffect(()=>{const U=ne.current;return()=>{for(const Y of U.values())clearTimeout(Y);U.clear()}},[]);const ln=v.useCallback(U=>{const Y=sa(U);ke.current=Y,o(Y)},[]),ll=v.useCallback(U=>{ln({language:U})},[ln]),Ze=v.useCallback(U=>{ke.current=U,o(U)},[]),xn=v.useCallback(U=>{var ge;const Y=ke.current,ie=Om({...U,wsUrl:U.wsUrl||"/ws/client",token:U.token||"",displayName:U.displayName||`Herdr ${Y.profiles.length+1}`,autoReconnect:U.autoReconnect!==!1},Y.profiles.length),Ce=sa({profiles:[...Y.profiles,ie],activeProfileId:ie.id,wsUrl:ie.wsUrl,token:ie.token,pairCode:ie.pairCode||"",autoReconnect:ie.autoReconnect});Ze(Ce),cn(),(ge=H.current)==null||ge.reconnectWith(xi(Ce))},[Ze,cn]),kt=v.useCallback(U=>{var ge;const Y=ke.current,ie=Y.profiles.find(me=>me.id===U);if(!ie||ie.id===Y.activeProfileId)return;const Ce=sa({activeProfileId:ie.id,wsUrl:ie.wsUrl,token:ie.token,pairCode:ie.pairCode||"",autoReconnect:ie.autoReconnect,profiles:Y.profiles.map(me=>me.id===ie.id?{...me,lastUsedAt:Date.now()}:me)});Ze(Ce),cn(),(ge=H.current)==null||ge.reconnectWith(xi(Ce))},[Ze,cn]),La=v.useCallback((U,Y)=>{const ie=ke.current;if(!ie.profiles.find(Te=>Te.id===U))return;const ge=Y.trim().slice(0,64);if(!ge)return;const me=sa({profiles:ie.profiles.map(Te=>Te.id===U?{...Te,displayName:ge}:Te)});Ze(me)},[Ze]),Oa=v.useCallback(U=>{var me;const Y=ke.current;if(!Y.profiles.some(Te=>Te.id===U))return;const ie=Y.profiles.filter(Te=>Te.id!==U),Ce=ie.find(Te=>Te.id===Y.activeProfileId)||ie[0],ge=sa(Ce?{profiles:ie,activeProfileId:Ce.id,wsUrl:Ce.wsUrl,token:Ce.token,pairCode:Ce.pairCode||"",autoReconnect:Ce.autoReconnect}:{profiles:[],activeProfileId:"",wsUrl:"/ws/client",token:"",pairCode:""});Ze(ge),U===Y.activeProfileId&&(cn(),(me=H.current)==null||me.reconnectWith(xi(ge)))},[Ze,cn]),Xn=v.useCallback(U=>{const Y=ke.current,ie=Y.profiles.find(un=>un.id===Y.activeProfileId),Ce=U.hostId?Um({wsUrl:Y.wsUrl,hostId:U.hostId}):null,ge=Ce?Y.profiles.findIndex(un=>Um(un)===Ce):-1,me=ge>=0?ge:Math.max(0,Y.profiles.findIndex(un=>un.id===Y.activeProfileId)),_t={...Y.profiles[me]||ie||Om({wsUrl:Y.wsUrl||"/ws/client",token:"",pairCode:Y.pairCode||"PENDING",displayName:`Herdr ${Y.profiles.length+1}`},Y.profiles.length),token:U.token,pairCode:void 0,...U.hostId?{hostId:U.hostId}:{},...U.deviceId?{deviceId:U.deviceId}:{},lastUsedAt:Date.now()};let yt=[...Y.profiles];me>=0&&me<yt.length?yt[me]=_t:yt.push(_t);const gl=ie==null?void 0:ie.id;yt=yt.filter((un,rl)=>rl===me||un.id===_t.id?!0:!(ge>=0&&gl&&un.id===gl));const sl=sa({profiles:yt,activeProfileId:_t.id,wsUrl:_t.wsUrl,token:_t.token,pairCode:"",autoReconnect:_t.autoReconnect});return Ze(sl),sl},[Ze]),$t=v.useCallback(U=>{const Y=ke.current,ie=Y.profiles.find(Te=>Te.id===Y.activeProfileId);if(!ie||!U.hostId&&!U.hostname)return;const Ce=/^Herdr \d+$/.test(ie.displayName),ge={...ie,...U.hostId?{hostId:U.hostId}:{},...U.hostname?{hostname:U.hostname}:{},...U.hostname&&Ce?{displayName:U.hostname}:{}},me=sa({profiles:Y.profiles.map(Te=>Te.id===ie.id?ge:Te)});Ze(me)},[Ze]);if(!H.current){const U=new Dy(xi(i));H.current=U,U.on("stateChange",(Y,ie,Ce)=>{d(Y),b(Ce);const ge=Ce?`serverErrors.${Ce}`:null,me=ge?Xe.current(ge):null,Te=me&&me!==ge?me:ie;p(Te),Y==="connected"?Fe("success",Xe.current("toasts.connected")):Y==="error"&&Fe("error",Te||Xe.current("toasts.connectionError")),Y!=="connected"&&Re(null)}),U.on("ready",Y=>{Se.current&&(tn(),be(ie=>ie+1)),Se.current=!0,y(Y.role),R(Y.controllerId),k(Y.hostId),z(Y.hostname),$t(Y),Y.clientId&&te(Y.clientId),Q(Y.terminalPalette||null)}),U.on("hostReconnecting",Y=>{b(Y||"host_reconnecting"),p(Xe.current(`serverErrors.${Y||"host_reconnecting"}`)),y("viewer"),R(void 0),z(void 0),Q(null),L(null),j(1),xe(null),tn()}),U.on("sessionRestarted",(Y,ie,Ce,ge)=>{tn(),z(ge),$t({hostId:U.getHostId(),hostname:ge}),Q(Ce||null),be(me=>me+1)}),U.on("roleChange",(Y,ie,Ce,ge)=>{y(Y),R(ie),Ce&&k(Ce),ge&&te(ge)}),U.on("controlGranted",()=>{y("controller"),Fe("success",Xe.current("toasts.controlGranted"))}),U.on("controlDenied",Y=>{Fe("warning",Y||Xe.current("toasts.controlDenied"))}),U.on("controlRevoked",Y=>{y("viewer"),Fe("warning",Y||Xe.current("toasts.controlRevoked"))}),U.on("paired",Y=>{const ie=Xn(Y);Fe("success",Xe.current("toasts.pairedSuccess")),_(Date.now()),U.reconnectWith(xi(ie))}),U.on("exit",(Y,ie)=>{Fe("info",`${Xe.current("toasts.sessionEnded")}${ie?`: ${ie}`:""}${Y!==void 0?` (${Y})`:""}`)}),U.on("status",Y=>{xe(Y)}),U.on("error",Y=>{Oe.current!==null&&(Ve.current&&(clearTimeout(Ve.current),Ve.current=null),Oe.current=null,Pe($n));const Ce=`serverErrors.${String(Y.code)}`,ge=Xe.current(Ce),me=ge&&ge!==Ce?ge:Y.message||`[${Y.code}]`;Fe("error",me)}),U.on("pasteFileReady",Y=>{const ie=Oe.current;ie!==null&&(Ve.current&&(clearTimeout(Ve.current),Ve.current=null),Pe({active:!0,phase:"completed",ratio:1,percent:100,statusText:Xe.current("virtualKeyboard.uploadProgressCompleted")}),setTimeout(()=>{Oe.current===ie&&(Oe.current=null,Pe($n))},1200));for(const Ce of Ke.current)try{Ce(Y)}catch(ge){console.error("Error in pasteFileReady listener:",ge)}}),U.on("rttUpdate",Y=>{L(Y)}),U.on("peerCount",Y=>{j(Math.max(1,Y))}),U.on("sessionReady",()=>{d("connected")}),U.on("agentStatus",Y=>{Re(Y)}),U.on("binaryData",Y=>{St.current(Y)})}const Sn=H.current,_n=i.profiles.find(U=>U.id===i.activeProfileId);v.useEffect(()=>{var U;(U=H.current)==null||U.updateConfig(xi(i))},[i]);const Fn=v.useCallback(U=>{H.current&&(U&&H.current.updateConfig(U),H.current.connect(je.current))},[]),pl=v.useCallback(()=>{H.current&&H.current.disconnect()},[]),al=v.useCallback((U=!1)=>{H.current&&H.current.claimControl(U)},[]),Ua=v.useCallback(()=>{var U;(U=H.current)==null||U.releaseControl()},[]),ca=v.useCallback(U=>{if(S!=="controller"){At();return}H.current&&H.current.sendText(U)},[S,At]),il=v.useCallback(U=>{S!=="controller"&&!Jr(U)||H.current&&H.current.sendInput(U)},[S]),zn=v.useCallback((U,Y)=>{je.current={cols:U,rows:Y},$({cols:U,rows:Y}),H.current&&H.current.sendResize(U,Y)},[]),ua=v.useCallback((U,Y)=>S!=="controller"?(At(),!1):H.current?(H.current.sendPasteFile(U,Y),!0):!1,[S,At]),Ba=v.useCallback(U=>(Ke.current.add(U),()=>{Ke.current.delete(U)}),[]),Ha=v.useCallback(()=>{Ve.current&&(clearTimeout(Ve.current),Ve.current=null),Oe.current=null,Pe($n)},[]);v.useEffect(()=>{c!=="connected"&&Oe.current!==null&&(Ve.current&&(clearTimeout(Ve.current),Ve.current=null),Oe.current=null,Pe($n))},[c]),v.useEffect(()=>()=>{Ve.current&&clearTimeout(Ve.current)},[]);const Ya=v.useCallback(async U=>{if(S!=="controller")return At(),!1;if(!H.current||c!=="connected")return Fe("error",nt("serverErrors.host_offline")),!1;if(Oe.current!==null)return!1;const Y=++$e.current;Oe.current=Y,Ve.current&&(clearTimeout(Ve.current),Ve.current=null);const ie="dataBase64"in U&&typeof U.dataBase64=="string";try{let Ce;if(ie)Ce=U;else{const me=U;if(Pe({active:!0,phase:"reading",ratio:.1,percent:10,statusText:nt("virtualKeyboard.uploadProgressReading")}),!me||me.size===0)return Fe("error",nt("clipboard.fileEmpty")),Oe.current=null,Pe($n),!1;if(me.type&&!me.type.startsWith("image/"))return Fe("error",nt("clipboard.unsupportedType")),Oe.current=null,Pe($n),!1;Pe({active:!0,phase:"processing",ratio:.35,percent:35,statusText:nt("virtualKeyboard.uploadProgressProcessing")});const Te=await Mp(me);if(Oe.current!==Y)return!1;if(!Te)return Fe("error",nt("clipboard.imageTooLarge")),Oe.current=null,Pe($n),!1;Ce=Te,Pe({active:!0,phase:"processing",ratio:.6,percent:60,statusText:nt("virtualKeyboard.uploadProgressProcessing")})}Pe({active:!0,phase:"sending",ratio:.75,percent:75,statusText:nt("virtualKeyboard.uploadProgressSending")});const ge=ua(Ce.mime,Ce.dataBase64);return Oe.current!==Y?!1:ge?(Pe({active:!0,phase:"waitingHost",ratio:.88,percent:88,statusText:nt("virtualKeyboard.uploadProgressWaitingHost")}),Ve.current=setTimeout(()=>{Oe.current===Y&&(Oe.current=null,Fe("error",nt("serverErrors.paste_file_write_failed")),Pe($n))},3e4),!0):(Oe.current=null,Pe($n),!1)}catch(Ce){return console.error("Failed to process/upload image:",Ce),Oe.current===Y&&(Oe.current=null,Fe("error",nt("clipboard.imageTooLarge")),Pe($n)),!1}},[S,c,At,Fe,nt,ua]);return u.jsx(kp.Provider,{value:{connectionState:c,stateDetail:f,stateCode:m,role:S,controllerId:x,hostId:E,hostname:q,assignedClientId:Z,profiles:i.profiles,activeProfileId:i.activeProfileId,activeProfile:_n,isController:S==="controller",sharedWindowCount:O,terminalResetVersion:ee,rttMs:he,statusPayload:Ae,agentStatus:pe,lastPairedAt:Ye,settings:i,hostPalette:X,terminalDimensions:V,toasts:ze,adapter:Sn,language:i.language,t:nt,setLanguage:ll,connect:Fn,disconnect:pl,switchProfile:kt,addProfileAndConnect:xn,renameProfile:La,removeProfile:Oa,claimControl:al,releaseControl:Ua,sendKey:ca,sendBinary:il,sendResize:zn,updateSettings:ln,addToast:Fe,removeToast:nn,warnViewerMode:At,subscribeToOutput:st,getPendingOutputChunkCount:wt,sendPasteFile:ua,subscribeToPasteFileReady:Ba,uploadProgress:Be,uploadImage:Ya,resetUploadProgress:Ha},children:r})};function xt(){const r=v.useContext(kp);if(!r)throw new Error("useTerminal must be used within a TerminalProvider");return r}function _p(r){var i,o,c="";if(typeof r=="string"||typeof r=="number")c+=r;else if(typeof r=="object")if(Array.isArray(r)){var d=r.length;for(i=0;i<d;i++)r[i]&&(o=_p(r[i]))&&(c&&(c+=" "),c+=o)}else for(o in r)r[o]&&(c&&(c+=" "),c+=o);return c}function rv(){for(var r,i,o=0,c="",d=arguments.length;o<d;o++)(r=arguments[o])&&(i=_p(r))&&(c&&(c+=" "),c+=i);return c}const ov=(r,i)=>{const o=new Array(r.length+i.length);for(let c=0;c<r.length;c++)o[c]=r[c];for(let c=0;c<i.length;c++)o[r.length+c]=i[c];return o},cv=(r,i)=>({classGroupId:r,validator:i}),zp=(r=new Map,i=null,o)=>({nextPart:r,validators:i,classGroupId:o}),eo="-",Km=[],uv="arbitrary..",dv=r=>{const i=hv(r),{conflictingClassGroups:o,conflictingClassGroupModifiers:c}=r;return{getClassGroupId:p=>{if(p.startsWith("[")&&p.endsWith("]"))return fv(p);const m=p.split(eo),b=m[0]===""&&m.length>1?1:0;return Dp(m,b,i)},getConflictingClassGroupIds:(p,m)=>{if(m){const b=c[p],S=o[p];return b?S?ov(S,b):b:S||Km}return o[p]||Km}}},Dp=(r,i,o)=>{if(r.length-i===0)return o.classGroupId;const d=r[i],f=o.nextPart.get(d);if(f){const S=Dp(r,i+1,f);if(S)return S}const p=o.validators;if(p===null)return;const m=i===0?r.join(eo):r.slice(i).join(eo),b=p.length;for(let S=0;S<b;S++){const y=p[S];if(y.validator(m))return y.classGroupId}},fv=r=>r.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const i=r.slice(1,-1),o=i.indexOf(":"),c=i.slice(0,o);return c?uv+c:void 0})(),hv=r=>{const{theme:i,classGroups:o}=r;return mv(o,i)},mv=(r,i)=>{const o=zp();for(const c in r){const d=r[c];Hu(d,o,c,i)}return o},Hu=(r,i,o,c)=>{const d=r.length;for(let f=0;f<d;f++){const p=r[f];pv(p,i,o,c)}},pv=(r,i,o,c)=>{if(typeof r=="string"){gv(r,i,o);return}if(typeof r=="function"){bv(r,i,o,c);return}yv(r,i,o,c)},gv=(r,i,o)=>{const c=r===""?i:Lp(i,r);c.classGroupId=o},bv=(r,i,o,c)=>{if(vv(r)){Hu(r(c),i,o,c);return}i.validators===null&&(i.validators=[]),i.validators.push(cv(o,r))},yv=(r,i,o,c)=>{const d=Object.entries(r),f=d.length;for(let p=0;p<f;p++){const[m,b]=d[p];Hu(b,Lp(i,m),o,c)}},Lp=(r,i)=>{let o=r;const c=i.split(eo),d=c.length;for(let f=0;f<d;f++){const p=c[f];let m=o.nextPart.get(p);m||(m=zp(),o.nextPart.set(p,m)),o=m}return o},vv=r=>"isThemeGetter"in r&&r.isThemeGetter===!0,xv=r=>{if(r<1)return{get:()=>{},set:()=>{}};let i=0,o=Object.create(null),c=Object.create(null);const d=(f,p)=>{o[f]=p,i++,i>r&&(i=0,c=o,o=Object.create(null))};return{get(f){let p=o[f];if(p!==void 0)return p;if((p=c[f])!==void 0)return d(f,p),p},set(f,p){f in o?o[f]=p:d(f,p)}}},Mu="!",Gm=":",Sv=[],qm=(r,i,o,c,d)=>({modifiers:r,hasImportantModifier:i,baseClassName:o,maybePostfixModifierPosition:c,isExternal:d}),wv=r=>{const{prefix:i,experimentalParseClassName:o}=r;let c=d=>{const f=[];let p=0,m=0,b=0,S;const y=d.length;for(let q=0;q<y;q++){const z=d[q];if(p===0&&m===0){if(z===Gm){f.push(d.slice(b,q)),b=q+1;continue}if(z==="/"){S=q;continue}}z==="["?p++:z==="]"?p--:z==="("?m++:z===")"&&m--}const x=f.length===0?d:d.slice(b);let R=x,E=!1;x.endsWith(Mu)?(R=x.slice(0,-1),E=!0):x.startsWith(Mu)&&(R=x.slice(1),E=!0);const k=S&&S>b?S-b:void 0;return qm(f,E,R,k)};if(i){const d=i+Gm,f=c;c=p=>p.startsWith(d)?f(p.slice(d.length)):qm(Sv,!1,p,void 0,!0)}if(o){const d=c;c=f=>o({className:f,parseClassName:d})}return c},Cv=r=>{const i=new Map;return r.orderSensitiveModifiers.forEach((o,c)=>{i.set(o,1e6+c)}),o=>{const c=[];let d=[];for(let f=0;f<o.length;f++){const p=o[f],m=p[0]==="[",b=i.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}},Tv=r=>({cache:xv(r.cacheSize),parseClassName:wv(r),sortModifiers:Cv(r),postfixLookupClassGroupIds:Nv(r),...dv(r)}),Nv=r=>{const i=Object.create(null),o=r.postfixLookupClassGroups;if(o)for(let c=0;c<o.length;c++)i[o[c]]=!0;return i},Ev=/\s+/,Av=(r,i)=>{const{parseClassName:o,getClassGroupId:c,getConflictingClassGroupIds:d,sortModifiers:f,postfixLookupClassGroupIds:p}=i,m=[],b=r.trim().split(Ev);let S="";for(let y=b.length-1;y>=0;y-=1){const x=b[y],{isExternal:R,modifiers:E,hasImportantModifier:k,baseClassName:q,maybePostfixModifierPosition:z}=o(x);if(R){S=x+(S.length>0?" "+S:S);continue}let X=!!z,Q;if(X){const O=q.substring(0,z);Q=c(O);const j=Q&&p[Q]?c(q):void 0;j&&j!==Q&&(Q=j,X=!1)}else Q=c(q);if(!Q){if(!X){S=x+(S.length>0?" "+S:S);continue}if(Q=c(q),!Q){S=x+(S.length>0?" "+S:S);continue}X=!1}const Z=E.length===0?"":E.length===1?E[0]:f(E).join(":"),te=k?Z+Mu:Z,he=te+Q;if(m.indexOf(he)>-1)continue;m.push(he);const L=d(Q,X);for(let O=0;O<L.length;++O){const j=L[O];m.push(te+j)}S=x+(S.length>0?" "+S:S)}return S},Rv=(...r)=>{let i=0,o,c,d="";for(;i<r.length;)(o=r[i++])&&(c=Op(o))&&(d&&(d+=" "),d+=c);return d},Op=r=>{if(typeof r=="string")return r;let i,o="";for(let c=0;c<r.length;c++)r[c]&&(i=Op(r[c]))&&(o&&(o+=" "),o+=i);return o},jv=(r,...i)=>{let o,c,d,f;const p=b=>{const S=i.reduce((y,x)=>x(y),r());return o=Tv(S),c=o.cache.get,d=o.cache.set,f=m,m(b)},m=b=>{const S=c(b);if(S)return S;const y=Av(b,o);return d(b,y),y};return f=p,(...b)=>f(Rv(...b))},Mv=[],Kt=r=>{const i=o=>o[r]||Mv;return i.isThemeGetter=!0,i},Up=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Bp=/^\((?:(\w[\w-]*):)?(.+)\)$/i,kv=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,_v=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,zv=/\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$/,Dv=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Lv=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Ov=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ra=r=>kv.test(r),Ge=r=>!!r&&!Number.isNaN(Number(r)),ml=r=>!!r&&Number.isInteger(Number(r)),pu=r=>r.endsWith("%")&&Ge(r.slice(0,-1)),Dl=r=>_v.test(r),Hp=()=>!0,Uv=r=>zv.test(r)&&!Dv.test(r),Yu=()=>!1,Bv=r=>Lv.test(r),Hv=r=>Ov.test(r),Yv=r=>!se(r)&&!re(r),Kv=r=>r.startsWith("@container")&&(r[10]==="/"&&r[11]!==void 0||r[11]==="s"&&r[16]!==void 0&&r.startsWith("-size/",10)||r[11]==="n"&&r[18]!==void 0&&r.startsWith("-normal/",10)),Gv=r=>oa(r,Gp,Yu),se=r=>Up.test(r),ja=r=>oa(r,qp,Uv),Vm=r=>oa(r,Jv,Ge),qv=r=>oa(r,Xp,Hp),Vv=r=>oa(r,Vp,Yu),Xm=r=>oa(r,Yp,Yu),Xv=r=>oa(r,Kp,Hv),qr=r=>oa(r,Fp,Bv),re=r=>Bp.test(r),xs=r=>Da(r,qp),Fv=r=>Da(r,Vp),Fm=r=>Da(r,Yp),Zv=r=>Da(r,Gp),Qv=r=>Da(r,Kp),Vr=r=>Da(r,Fp,!0),Iv=r=>Da(r,Xp,!0),oa=(r,i,o)=>{const c=Up.exec(r);return c?c[1]?i(c[1]):o(c[2]):!1},Da=(r,i,o=!1)=>{const c=Bp.exec(r);return c?c[1]?i(c[1]):o:!1},Yp=r=>r==="position"||r==="percentage",Kp=r=>r==="image"||r==="url",Gp=r=>r==="length"||r==="size"||r==="bg-size",qp=r=>r==="length",Jv=r=>r==="number",Vp=r=>r==="family-name",Xp=r=>r==="number"||r==="weight",Fp=r=>r==="shadow",Wv=()=>{const r=Kt("color"),i=Kt("font"),o=Kt("text"),c=Kt("font-weight"),d=Kt("tracking"),f=Kt("leading"),p=Kt("breakpoint"),m=Kt("container"),b=Kt("spacing"),S=Kt("radius"),y=Kt("shadow"),x=Kt("inset-shadow"),R=Kt("text-shadow"),E=Kt("drop-shadow"),k=Kt("blur"),q=Kt("perspective"),z=Kt("aspect"),X=Kt("ease"),Q=Kt("animate"),Z=()=>["auto","avoid","all","avoid-page","page","left","right","column"],te=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],he=()=>[...te(),re,se],L=()=>["auto","hidden","clip","visible","scroll"],O=()=>["auto","contain","none"],j=()=>[re,se,b],ee=()=>[ra,"full","auto",...j()],be=()=>[ml,"none","subgrid",re,se],Ae=()=>["auto",{span:["full",ml,re,se]},ml,re,se],xe=()=>[ml,"auto",re,se],pe=()=>["auto","min","max","fr",re,se],Re=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Ye=()=>["start","end","center","stretch","center-safe","end-safe"],_=()=>["auto",...j()],V=()=>[ra,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...j()],$=()=>[ra,"screen","full","dvw","lvw","svw","min","max","fit",...j()],ze=()=>[ra,"screen","full","lh","dvh","lvh","svh","min","max","fit",...j()],I=()=>[r,re,se],ke=()=>[...te(),Fm,Xm,{position:[re,se]}],H=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Se=()=>["auto","cover","contain",Zv,Gv,{size:[re,se]}],je=()=>[pu,xs,ja],Ke=()=>["","none","full",S,re,se],Be=()=>["",Ge,xs,ja],Pe=()=>["solid","dashed","dotted","double"],Oe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],$e=()=>[Ge,pu,Fm,Xm],Ve=()=>["","none",k,re,se],nt=()=>["none",Ge,re,se],Xe=()=>["none",Ge,re,se],Et=()=>[Ge,re,se],ft=()=>[ra,"full",...j()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Dl],breakpoint:[Dl],color:[Hp],container:[Dl],"drop-shadow":[Dl],ease:["in","out","in-out"],font:[Yv],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Dl],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Dl],shadow:[Dl],spacing:["px",Ge],text:[Dl],"text-shadow":[Dl],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ra,se,re,z]}],container:["container"],"container-type":[{"@container":["","normal","size",re,se]}],"container-named":[Kv],columns:[{columns:[Ge,se,re,m]}],"break-after":[{"break-after":Z()}],"break-before":[{"break-before":Z()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:he()}],overflow:[{overflow:L()}],"overflow-x":[{"overflow-x":L()}],"overflow-y":[{"overflow-y":L()}],overscroll:[{overscroll:O()}],"overscroll-x":[{"overscroll-x":O()}],"overscroll-y":[{"overscroll-y":O()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:ee()}],"inset-x":[{"inset-x":ee()}],"inset-y":[{"inset-y":ee()}],start:[{"inset-s":ee(),start:ee()}],end:[{"inset-e":ee(),end:ee()}],"inset-bs":[{"inset-bs":ee()}],"inset-be":[{"inset-be":ee()}],top:[{top:ee()}],right:[{right:ee()}],bottom:[{bottom:ee()}],left:[{left:ee()}],visibility:["visible","invisible","collapse"],z:[{z:[ml,"auto",re,se]}],basis:[{basis:[ra,"full","auto",m,...j()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ge,ra,"auto","initial","none",se]}],grow:[{grow:["",Ge,re,se]}],shrink:[{shrink:["",Ge,re,se]}],order:[{order:[ml,"first","last","none",re,se]}],"grid-cols":[{"grid-cols":be()}],"col-start-end":[{col:Ae()}],"col-start":[{"col-start":xe()}],"col-end":[{"col-end":xe()}],"grid-rows":[{"grid-rows":be()}],"row-start-end":[{row:Ae()}],"row-start":[{"row-start":xe()}],"row-end":[{"row-end":xe()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":pe()}],"auto-rows":[{"auto-rows":pe()}],gap:[{gap:j()}],"gap-x":[{"gap-x":j()}],"gap-y":[{"gap-y":j()}],"justify-content":[{justify:[...Re(),"normal"]}],"justify-items":[{"justify-items":[...Ye(),"normal"]}],"justify-self":[{"justify-self":["auto",...Ye()]}],"align-content":[{content:["normal",...Re()]}],"align-items":[{items:[...Ye(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Ye(),{baseline:["","last"]}]}],"place-content":[{"place-content":Re()}],"place-items":[{"place-items":[...Ye(),"baseline"]}],"place-self":[{"place-self":["auto",...Ye()]}],p:[{p:j()}],px:[{px:j()}],py:[{py:j()}],ps:[{ps:j()}],pe:[{pe:j()}],pbs:[{pbs:j()}],pbe:[{pbe:j()}],pt:[{pt:j()}],pr:[{pr:j()}],pb:[{pb:j()}],pl:[{pl:j()}],m:[{m:_()}],mx:[{mx:_()}],my:[{my:_()}],ms:[{ms:_()}],me:[{me:_()}],mbs:[{mbs:_()}],mbe:[{mbe:_()}],mt:[{mt:_()}],mr:[{mr:_()}],mb:[{mb:_()}],ml:[{ml:_()}],"space-x":[{"space-x":j()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":j()}],"space-y-reverse":["space-y-reverse"],size:[{size:V()}],"inline-size":[{inline:["auto",...$()]}],"min-inline-size":[{"min-inline":["auto",...$()]}],"max-inline-size":[{"max-inline":["none",...$()]}],"block-size":[{block:["auto",...ze()]}],"min-block-size":[{"min-block":["auto",...ze()]}],"max-block-size":[{"max-block":["none",...ze()]}],w:[{w:[m,"screen",...V()]}],"min-w":[{"min-w":[m,"screen","none",...V()]}],"max-w":[{"max-w":[m,"screen","none","prose",{screen:[p]},...V()]}],h:[{h:["screen","lh",...V()]}],"min-h":[{"min-h":["screen","lh","none",...V()]}],"max-h":[{"max-h":["screen","lh",...V()]}],"font-size":[{text:["base",o,xs,ja]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[c,Iv,qv]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",pu,se]}],"font-family":[{font:[Fv,Vv,i]}],"font-features":[{"font-features":[se]}],"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,re,se]}],"line-clamp":[{"line-clamp":[Ge,"none",re,Vm]}],leading:[{leading:[f,...j()]}],"list-image":[{"list-image":["none",re,se]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",re,se]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Pe(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ge,"from-font","auto",re,ja]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[Ge,"auto",re,se]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:j()}],"tab-size":[{tab:[ml,re,se]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",re,se]}],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",re,se]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ke()}],"bg-repeat":[{bg:H()}],"bg-size":[{bg:Se()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ml,re,se],radial:["",re,se],conic:[ml,re,se]},Qv,Xv]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:je()}],"gradient-via-pos":[{via:je()}],"gradient-to-pos":[{to:je()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:Ke()}],"rounded-s":[{"rounded-s":Ke()}],"rounded-e":[{"rounded-e":Ke()}],"rounded-t":[{"rounded-t":Ke()}],"rounded-r":[{"rounded-r":Ke()}],"rounded-b":[{"rounded-b":Ke()}],"rounded-l":[{"rounded-l":Ke()}],"rounded-ss":[{"rounded-ss":Ke()}],"rounded-se":[{"rounded-se":Ke()}],"rounded-ee":[{"rounded-ee":Ke()}],"rounded-es":[{"rounded-es":Ke()}],"rounded-tl":[{"rounded-tl":Ke()}],"rounded-tr":[{"rounded-tr":Ke()}],"rounded-br":[{"rounded-br":Ke()}],"rounded-bl":[{"rounded-bl":Ke()}],"border-w":[{border:Be()}],"border-w-x":[{"border-x":Be()}],"border-w-y":[{"border-y":Be()}],"border-w-s":[{"border-s":Be()}],"border-w-e":[{"border-e":Be()}],"border-w-bs":[{"border-bs":Be()}],"border-w-be":[{"border-be":Be()}],"border-w-t":[{"border-t":Be()}],"border-w-r":[{"border-r":Be()}],"border-w-b":[{"border-b":Be()}],"border-w-l":[{"border-l":Be()}],"divide-x":[{"divide-x":Be()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Be()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Pe(),"hidden","none"]}],"divide-style":[{divide:[...Pe(),"hidden","none"]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...Pe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ge,re,se]}],"outline-w":[{outline:["",Ge,xs,ja]}],"outline-color":[{outline:I()}],shadow:[{shadow:["","none",y,Vr,qr]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":["none",x,Vr,qr]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:Be()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[Ge,ja]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":Be()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":["none",R,Vr,qr]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[Ge,re,se]}],"mix-blend":[{"mix-blend":[...Oe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Oe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ge]}],"mask-image-linear-from-pos":[{"mask-linear-from":$e()}],"mask-image-linear-to-pos":[{"mask-linear-to":$e()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":$e()}],"mask-image-t-to-pos":[{"mask-t-to":$e()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":$e()}],"mask-image-r-to-pos":[{"mask-r-to":$e()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":$e()}],"mask-image-b-to-pos":[{"mask-b-to":$e()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":$e()}],"mask-image-l-to-pos":[{"mask-l-to":$e()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":$e()}],"mask-image-x-to-pos":[{"mask-x-to":$e()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":$e()}],"mask-image-y-to-pos":[{"mask-y-to":$e()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[re,se]}],"mask-image-radial-from-pos":[{"mask-radial-from":$e()}],"mask-image-radial-to-pos":[{"mask-radial-to":$e()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":te()}],"mask-image-conic-pos":[{"mask-conic":[Ge]}],"mask-image-conic-from-pos":[{"mask-conic-from":$e()}],"mask-image-conic-to-pos":[{"mask-conic-to":$e()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ke()}],"mask-repeat":[{mask:H()}],"mask-size":[{mask:Se()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",re,se]}],filter:[{filter:["","none",re,se]}],blur:[{blur:Ve()}],brightness:[{brightness:[Ge,re,se]}],contrast:[{contrast:[Ge,re,se]}],"drop-shadow":[{"drop-shadow":["","none",E,Vr,qr]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:["",Ge,re,se]}],"hue-rotate":[{"hue-rotate":[Ge,re,se]}],invert:[{invert:["",Ge,re,se]}],saturate:[{saturate:[Ge,re,se]}],sepia:[{sepia:["",Ge,re,se]}],"backdrop-filter":[{"backdrop-filter":["","none",re,se]}],"backdrop-blur":[{"backdrop-blur":Ve()}],"backdrop-brightness":[{"backdrop-brightness":[Ge,re,se]}],"backdrop-contrast":[{"backdrop-contrast":[Ge,re,se]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ge,re,se]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ge,re,se]}],"backdrop-invert":[{"backdrop-invert":["",Ge,re,se]}],"backdrop-opacity":[{"backdrop-opacity":[Ge,re,se]}],"backdrop-saturate":[{"backdrop-saturate":[Ge,re,se]}],"backdrop-sepia":[{"backdrop-sepia":["",Ge,re,se]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":j()}],"border-spacing-x":[{"border-spacing-x":j()}],"border-spacing-y":[{"border-spacing-y":j()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",re,se]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ge,"initial",re,se]}],ease:[{ease:["linear","initial",X,re,se]}],delay:[{delay:[Ge,re,se]}],animate:[{animate:["none",Q,re,se]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[q,re,se]}],"perspective-origin":[{"perspective-origin":he()}],rotate:[{rotate:nt()}],"rotate-x":[{"rotate-x":nt()}],"rotate-y":[{"rotate-y":nt()}],"rotate-z":[{"rotate-z":nt()}],scale:[{scale:Xe()}],"scale-x":[{"scale-x":Xe()}],"scale-y":[{"scale-y":Xe()}],"scale-z":[{"scale-z":Xe()}],"scale-3d":["scale-3d"],skew:[{skew:Et()}],"skew-x":[{"skew-x":Et()}],"skew-y":[{"skew-y":Et()}],transform:[{transform:[re,se,"","none","gpu","cpu"]}],"transform-origin":[{origin:he()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ft()}],"translate-x":[{"translate-x":ft()}],"translate-y":[{"translate-y":ft()}],"translate-z":[{"translate-z":ft()}],"translate-none":["translate-none"],zoom:[{zoom:[ml,re,se]}],accent:[{accent:I()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:I()}],"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",re,se]}],"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":I()}],"scrollbar-track-color":[{"scrollbar-track":I()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mbs":[{"scroll-mbs":j()}],"scroll-mbe":[{"scroll-mbe":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pbs":[{"scroll-pbs":j()}],"scroll-pbe":[{"scroll-pbe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"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",re,se]}],fill:[{fill:["none",...I()]}],"stroke-w":[{stroke:[Ge,xs,ja,Vm]}],stroke:[{stroke:["none",...I()]}],"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"]}},Pv=jv(Wv);function W(...r){return Pv(rv(r))}var $v=mp();const qe={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"}},_s={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},vn=({level:r,className:i})=>u.jsx("span",{"aria-hidden":"true",className:W("select-none leading-none",_s[r],i),children:r==="idle"?qe.off:qe.on}),Zp=({className:r})=>u.jsx("span",{"aria-hidden":"true",className:W("select-none text-tui-faint",r),children:qe.dot}),en=({title:r,aside:i,tone:o="accent",className:c,bodyClassName:d,children:f,...p})=>u.jsxs("fieldset",{className:W("tui-panel tui-block relative min-w-0 border border-tui-border bg-tui-base",r?"px-3 pb-3 pt-1":"p-3",c),...p,children:[r?u.jsx("legend",{className:W("flex items-center gap-2 text-tui font-bold",_s[o]),children:u.jsx("span",{children:r})}):null,i?u.jsx("span",{className:"pointer-events-none absolute -top-[10px] right-2 max-w-[60%] truncate bg-tui-base px-1 text-tui-sm text-tui-faint",children:i}):null,u.jsx("div",{className:W("min-w-0",d),children:f})]}),el=({label:r,labelWidth:i=16,className:o,children:c})=>u.jsxs("div",{className:W("flex items-baseline gap-2 text-tui",o),children:[u.jsx("span",{className:"shrink-0 truncate text-tui-muted",style:{width:`${i}ch`},title:typeof r=="string"?r:void 0,children:r}),u.jsx("span",{className:"min-w-0 flex-1 text-tui-text",children:c})]}),ka=({className:r,label:i})=>i?u.jsxs("div",{className:W("flex items-center gap-2",r),children:[u.jsx("span",{className:"h-px w-3 bg-tui-border-dim","aria-hidden":"true"}),u.jsx("span",{className:"text-tui-sm text-tui-faint",children:i}),u.jsx("span",{className:"h-px flex-1 bg-tui-border-dim","aria-hidden":"true"})]}):u.jsx("div",{className:W("h-px w-full bg-tui-border-dim",r),"aria-hidden":"true"}),ex={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:r="default",brackets:i=!0,glyph:o,block:c=!1,className:d,children:f,type:p="button",...m})=>u.jsxs("button",{type:p,className:W("tui-focusable inline-flex select-none items-center justify-center gap-1.5 border bg-transparent px-2 py-0.5 text-tui font-medium transition-colors","disabled:cursor-not-allowed disabled:border-tui-border-dim disabled:text-tui-faint disabled:hover:bg-transparent",ex[r],c&&"w-full",d),...m,children:[i?u.jsx("span",{"aria-hidden":"true",className:"opacity-60",children:"["}):null,o?u.jsx("span",{"aria-hidden":"true",className:"leading-none",children:o}):null,u.jsx("span",{className:"truncate",children:f}),i?u.jsx("span",{"aria-hidden":"true",className:"opacity-60",children:"]"}):null]}),no=({tone:r="accent",dot:i=!1,className:o,children:c})=>u.jsxs("span",{className:W("inline-flex select-none items-center gap-1 whitespace-nowrap text-tui font-bold uppercase",_s[r],o),children:[i?u.jsx(vn,{level:r}):null,c]}),Ku=({tabs:r,activeId:i,onSelect:o,ariaLabel:c,className:d,labelClassName:f})=>u.jsx("nav",{className:W("flex items-center gap-2",d),"aria-label":c,children:r.map((p,m)=>{const b=p.id===i;return u.jsxs(tl.Fragment,{children:[m>0?u.jsx("span",{"aria-hidden":"true",className:"select-none text-tui-border",children:qe.tabDivider}):null,u.jsxs("button",{type:"button",onClick:()=>o(p.id),"aria-current":b?"page":void 0,"aria-label":p.ariaLabel??p.label,title:p.title,className:W("tui-focusable select-none whitespace-nowrap border-b px-0.5 pb-0.5 text-tui transition-colors",b?"border-tui-accent font-bold text-tui-accent":"border-transparent text-tui-muted hover:border-tui-border-bright hover:text-tui-text"),children:[p.index!==void 0?u.jsx("span",{"aria-hidden":"true",className:W("text-tui-faint",b&&"text-tui-accent"),children:p.index}):null,u.jsx("span",{"aria-hidden":"true",className:W("ml-1",f),children:p.label})]})]},p.id)})}),Qp=({hints:r,className:i})=>u.jsx("div",{className:W("flex flex-wrap items-center gap-x-3 gap-y-0.5 text-tui-sm text-tui-faint",i),children:r.map((o,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:o.keys}),u.jsx("span",{children:o.action})]},`${o.keys}-${c}`))}),kn=({htmlFor:r,hint:i,className:o,children:c})=>u.jsxs("label",{htmlFor:r,className:W("block text-tui-sm font-bold text-tui-muted",o),children:[c,i?u.jsx("span",{className:"ml-2 font-normal text-tui-faint",children:i}):null]}),Vn=tl.forwardRef(({className:r,...i},o)=>u.jsx("input",{ref:o,className:W("tui-input w-full px-2 py-1 text-tui",r),...i}));Vn.displayName="Input";const Gu=tl.forwardRef(({className:r,children:i,...o},c)=>u.jsx("select",{ref:c,className:W("tui-input w-full px-2 py-1 text-tui",r),...o,children:i}));Gu.displayName="Select";const ku=({checked:r,onChange:i,disabled:o=!1,label:c,description:d,className:f,id:p})=>u.jsxs("label",{className:W("group flex cursor-pointer select-none items-start gap-2 py-0.5 text-tui",o&&"cursor-not-allowed opacity-60",f),children:[u.jsx("input",{id:p,type:"checkbox",className:"sr-only",checked:r,disabled:o,onChange:m=>i(m.target.checked)}),u.jsx("span",{"aria-hidden":"true",className:W("mt-px shrink-0 font-bold leading-tight",r?"text-tui-ok":"text-tui-faint",!o&&"group-hover:text-tui-accent"),children:r?"[x]":"[ ]"}),u.jsxs("span",{className:"min-w-0 flex-1",children:[u.jsx("span",{className:W("block",r?"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]})]}),Ss=({checked:r,onChange:i,name:o,disabled:c=!1,label:d,description:f,className:p})=>u.jsxs("label",{className:W("group flex cursor-pointer select-none items-start gap-2 py-0.5 text-tui",c&&"cursor-not-allowed opacity-60",p),children:[u.jsx("input",{type:"radio",name:o,className:"sr-only",checked:r,disabled:c,onChange:i}),u.jsx("span",{"aria-hidden":"true",className:W("mt-px shrink-0 font-bold leading-tight",r?"text-tui-accent":"text-tui-faint",!c&&"group-hover:text-tui-accent"),children:r?"(•)":"( )"}),u.jsxs("span",{className:"min-w-0 flex-1",children:[u.jsx("span",{className:W("block",r?"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]})]}),tx=({value:r,width:i=20,tone:o="accent",className:c})=>{const d=Number.isFinite(r)?Math.min(1,Math.max(0,r)):0,f=Math.round(d*i);return u.jsxs("span",{className:W("inline-flex select-none whitespace-pre font-mono leading-none",c),role:"presentation",children:[u.jsx("span",{className:_s[o],children:qe.meterFull.repeat(f)}),u.jsx("span",{className:"text-tui-border",children:qe.meterEmpty.repeat(Math.max(0,i-f))})]})},nx={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"},lx=({ratio:r,label:i,tone:o="accent",className:c,...d})=>{const f=Number.isFinite(r)?Math.min(1,Math.max(0,r)):0;return u.jsxs("div",{className:W("relative h-[var(--tui-row)] w-full overflow-hidden border border-tui-border bg-tui-mantle",c),role:"progressbar","aria-valuenow":Math.round(f*100),"aria-valuemin":0,"aria-valuemax":100,...d,children:[u.jsx("div",{className:W("absolute inset-y-0 left-0",nx[o]),style:{width:`${f*100}%`},"aria-hidden":"true"}),i!==void 0?u.jsx("span",{className:"absolute inset-0 flex items-center justify-center whitespace-nowrap px-1 text-tui font-bold text-tui-text mix-blend-difference",children:i}):null]})};function qu({columns:r,items:i,rowKey:o,empty:c,className:d}){return i.length===0?u.jsx("div",{className:W("px-1 py-4 text-center text-tui text-tui-faint",d),children:c}):u.jsx("div",{className:W("w-full overflow-x-auto",d),children:u.jsxs("table",{className:"w-full border-collapse text-tui",children:[u.jsx("thead",{children:u.jsx("tr",{className:"border-b border-tui-border",children:r.map(f=>u.jsx("th",{scope:"col",style:f.width?{width:`${f.width}ch`}:void 0,className:W("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:i.map((f,p)=>u.jsx("tr",{className:"border-b border-tui-border-dim last:border-b-0 hover:bg-tui-selection",children:r.map(m=>u.jsx("td",{className:W("px-2 py-1 align-top text-tui-text",m.align==="right"?"text-right":"text-left",m.className),children:m.render(f,p)},m.key))},o(f,p)))})]})})}const Vu=({isOpen:r,onClose:i,title:o,subtitle:c,closeLabel:d,footer:f,hints:p,size:m="md",className:b,children:S})=>{if(!r)return null;const y=m==="sm"?"max-w-md":m==="lg"?"max-w-3xl":"max-w-xl",x=`tui-modal-${o.replace(/\s+/g,"-").toLowerCase()}`,R=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":x,onMouseDown:E=>{E.target===E.currentTarget&&i()},children:u.jsxs("div",{className:W("flex w-full flex-col border border-tui-border bg-tui-base",y,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:x,className:"truncate text-tui font-bold text-tui-accent",children:o}),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:i,"aria-label":d,title:d,children:"esc"})]}),u.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 py-3",children:S}),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(Qp,{hints:p}):u.jsx("span",{}),f?u.jsx("div",{className:"flex items-center gap-2",children:f}):null]}):null]})});return typeof document>"u"?R:$v.createPortal(R,document.body)},Ir=({tone:r="accent",className:i,children:o,action:c})=>{const d=r==="ok"?qe.check:r==="bad"?qe.cross:r==="warn"?qe.warn:"›",f=qn[r].edgeL;return u.jsxs("div",{className:W("flex items-start gap-2 border border-tui-border-dim border-l-2 bg-tui-mantle px-2 py-1.5 text-tui",f,i),children:[u.jsx("span",{"aria-hidden":"true",className:W("shrink-0 font-bold",_s[r]),children:d}),u.jsx("div",{className:"min-w-0 flex-1 leading-snug text-tui-text",children:o}),c?u.jsx("div",{className:"shrink-0",children:c}):null]})},ax=({active:r=!1,className:i,children:o})=>u.jsx("span",{className:W("inline-flex min-w-[2ch] select-none items-center justify-center border px-1 text-tui",r?"border-tui-accent bg-tui-accent text-tui-crust":"border-tui-border bg-tui-surface text-tui-muted",i),children:o}),Zm=({items:r,className:i})=>{const o=r.filter(Boolean);return u.jsx("span",{className:W("flex min-w-0 items-center gap-1.5",i),children:o.map((c,d)=>u.jsxs(tl.Fragment,{children:[d>0?u.jsx(Zp,{className:"shrink-0"}):null,c]},d))})},Ip=({left:r,right:i,className:o})=>u.jsxs("footer",{className:W("relative flex h-[var(--tui-row)] w-full shrink-0 items-center justify-between gap-3 overflow-visible border-t border-tui-border bg-tui-mantle px-2 text-tui-sm",o),children:[u.jsx("div",{className:"flex min-w-0 items-center gap-1.5 text-tui-muted",children:r}),u.jsx("div",{className:"flex shrink-0 items-center gap-3",children:i})]}),ix=({name:r,tagline:i,aside:o,tabs:c,activeTabId:d,onSelectTab:f,tabsAriaLabel:p,hints:m,footerAside:b,bodyClassName:S,className:y,children:x})=>u.jsxs("div",{className:W("flex h-full min-h-0 w-full flex-col bg-tui-crust",y),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:r}),i?u.jsx("span",{className:"hidden truncate text-tui-sm text-tui-faint sm:block",children:i}):null]}),o?u.jsx("span",{className:"flex shrink-0 items-center gap-2",children:o}):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(Ku,{tabs:c,activeId:d,onSelect:f,ariaLabel:p,className:"gap-3"})}):null,u.jsx("div",{className:W("min-h-0 flex-1 overflow-y-auto p-2",S),children:x}),m||b?u.jsx(Ip,{left:m?u.jsx(Qp,{hints:m}):null,right:b}):null]}),Qm=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],Ei=({className:r,label:i})=>{const[o,c]=tl.useState(0);return tl.useEffect(()=>{const d=setInterval(()=>c(f=>(f+1)%Qm.length),90);return()=>clearInterval(d)},[]),u.jsxs("span",{className:W("inline-flex items-center gap-1.5",r),role:"status",children:[u.jsx("span",{"aria-hidden":"true",className:"text-tui-accent",children:Qm[o]}),i?u.jsx("span",{children:i}):null]})},Xr="tui-focusable select-none border border-transparent px-1.5 text-tui uppercase transition-colors",Fr="text-tui-muted hover:border-tui-border hover:text-tui-accent",sx="border-tui-accent bg-tui-accent text-tui-crust",rx=({currentView:r,onNavigate:i,showAdminEntry:o=!0,onOpenPairing:c,onOpenSettings:d,onToggleVirtualKeyboard:f,isVirtualKeyboardOpen:p})=>{const{addToast:m,language:b,setLanguage:S,t:y}=xt(),x=()=>{const E=b==="zh"?"en":"zh";S(E),m("info",Bu(E,"toasts.switchedLanguage",{lang:E==="zh"?"简体中文":"English"}))},R=[{id:"terminal",label:y("header.terminalTab"),index:1,ariaLabel:y("header.terminalTab")},...o||r==="admin"?[{id:"admin",label:y("header.adminTab"),index:2,ariaLabel:y("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:y("header.tagline")})]}),u.jsx("span",{"aria-hidden":"true",className:"h-4 w-px shrink-0 bg-tui-border"}),u.jsx(Ku,{tabs:R,activeId:r,onSelect:E=>i(E),ariaLabel:y("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:x,className:W(Xr,Fr),title:y("header.languageToggleTitle"),"aria-label":y("header.languageToggleTitle"),children:y("header.languageShort")}),r==="terminal"&&u.jsx("button",{type:"button",onClick:f,className:W(Xr,p?sx:Fr),title:y("header.virtualKeyboardTitle"),"aria-label":y("header.virtualKeyboardTitle"),children:y("header.actionKeyboard")}),u.jsx("button",{type:"button",onClick:c,className:W(Xr,Fr),title:y("header.pairingTitle"),"aria-label":y("header.pairingTitle"),children:y("header.actionPairing")}),u.jsx("button",{type:"button",onClick:d,className:W(Xr,Fr),title:y("header.settingsTitle"),"aria-label":y("header.settingsTitle"),children:y("header.actionSettings")})]})]})})},Zr=({tone:r,glyph:i,message:o,assertive:c=!1,action:d})=>u.jsxs("aside",{className:W("flex w-full items-center justify-between gap-3 border-b bg-tui-mantle px-2 py-0.5 text-tui sm:px-3",qn[r].edgeB),"aria-live":c?"assertive":"polite",children:[u.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[u.jsx("span",{"aria-hidden":"true",className:W("shrink-0",qn[r].text),children:i}),u.jsx("span",{className:"truncate text-tui-text",children:o})]}),d]}),ox=()=>{const{connectionState:r,stateDetail:i,connect:o,settings:c,t:d}=xt();return r==="connected"||!c.token&&!c.pairCode&&r==="disconnected"?null:r==="connecting"?u.jsx(Zr,{tone:"accent",glyph:u.jsx(Ei,{}),message:d("statusBanner.connecting")}):r==="reconnecting"?u.jsx(Zr,{tone:"warn",glyph:u.jsx(Ei,{}),assertive:!0,message:i||d("statusBanner.reconnectingDefault"),action:u.jsx(He,{variant:"warn",onClick:()=>o(),className:"shrink-0",children:d("statusBanner.reconnectNow")})}):r==="error"?u.jsx(Zr,{tone:"bad",glyph:qe.cross,assertive:!0,message:i||d("statusBanner.errorDefault"),action:u.jsx(He,{variant:"danger",onClick:()=>o(),className:"shrink-0",children:d("common.retry")})}):r==="disconnected"?u.jsx(Zr,{tone:"idle",glyph:qe.off,message:d("statusBanner.disconnected"),action:u.jsx(He,{variant:"primary",onClick:()=>o(),className:"shrink-0",children:d("common.connect")})}):null};var cx=fy(),ux=hy(),gu={exports:{}},Im;function dx(){return Im||(Im=1,(function(r,i){(function(o,c){r.exports=c()})(self,(()=>(()=>{var o={6:(p,m)=>{function b(y){try{const x=new URL(y),R=x.password&&x.username?`${x.protocol}//${x.username}:${x.password}@${x.host}`:x.username?`${x.protocol}//${x.username}@${x.host}`:`${x.protocol}//${x.host}`;return y.toLocaleLowerCase().startsWith(R.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(m,"__esModule",{value:!0}),m.LinkComputer=m.WebLinkProvider=void 0,m.WebLinkProvider=class{constructor(y,x,R,E={}){this._terminal=y,this._regex=x,this._handler=R,this._options=E}provideLinks(y,x){const R=S.computeLink(y,this._regex,this._terminal,this._handler);x(this._addCallbacks(R))}_addCallbacks(y){return y.map((x=>(x.leave=this._options.leave,x.hover=(R,E)=>{if(this._options.hover){const{range:k}=x;this._options.hover(R,E,k)}},x)))}};class S{static computeLink(x,R,E,k){const q=new RegExp(R.source,(R.flags||"")+"g"),[z,X]=S._getWindowedLineStrings(x-1,E),Q=z.join("");let Z;const te=[];for(;Z=q.exec(Q);){const he=Z[0];if(!b(he))continue;const[L,O]=S._mapStrIdx(E,X,0,Z.index),[j,ee]=S._mapStrIdx(E,L,O,he.length);if(L===-1||O===-1||j===-1||ee===-1)continue;const be={start:{x:O+1,y:L+1},end:{x:ee,y:j+1}};te.push({range:be,text:he,activate:k})}return te}static _getWindowedLineStrings(x,R){let E,k=x,q=x,z=0,X="";const Q=[];if(E=R.buffer.active.getLine(x)){const Z=E.translateToString(!0);if(E.isWrapped&&Z[0]!==" "){for(z=0;(E=R.buffer.active.getLine(--k))&&z<2048&&(X=E.translateToString(!0),z+=X.length,Q.push(X),E.isWrapped&&X.indexOf(" ")===-1););Q.reverse()}for(Q.push(Z),z=0;(E=R.buffer.active.getLine(++q))&&E.isWrapped&&z<2048&&(X=E.translateToString(!0),z+=X.length,Q.push(X),X.indexOf(" ")===-1););}return[Q,k]}static _mapStrIdx(x,R,E,k){const q=x.buffer.active,z=q.getNullCell();let X=E;for(;k;){const Q=q.getLine(R);if(!Q)return[-1,-1];for(let Z=X;Z<Q.length;++Z){Q.getCell(Z,z);const te=z.getChars();if(z.getWidth()&&(k-=te.length||1,Z===Q.length-1&&te==="")){const he=q.getLine(R+1);he&&he.isWrapped&&(he.getCell(0,z),z.getWidth()===2&&(k+=1))}if(k<0)return[R,Z]}R++,X=0}return[R,X]}}m.LinkComputer=S}},c={};function d(p){var m=c[p];if(m!==void 0)return m.exports;var b=c[p]={exports:{}};return o[p](b,b.exports,d),b.exports}var f={};return(()=>{var p=f;Object.defineProperty(p,"__esModule",{value:!0}),p.WebLinksAddon=void 0;const m=d(6),b=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function S(y,x){const R=window.open();if(R){try{R.opener=null}catch{}R.location.href=x}else console.warn("Opening link blocked as opener could not be cleared")}p.WebLinksAddon=class{constructor(y=S,x={}){this._handler=y,this._options=x}activate(y){this._terminal=y;const x=this._options,R=x.urlRegex||b;this._linkProvider=this._terminal.registerLinkProvider(new m.WebLinkProvider(this._terminal,R,this._handler,x))}dispose(){var y;(y=this._linkProvider)==null||y.dispose()}}})(),f})()))})(gu)),gu.exports}var fx=dx();const hx=20,mx=6,px=500,gx=300,Ai=13,Jp=.602,Wp=1.3;function Ll(r,i){return Number.isFinite(r)&&r>0?r:i}function Jm(r,i,o){return Math.min(o,Math.max(i,r))}function Wm(r){const{width:i,height:o,cellWidth:c,cellHeight:d,minCols:f=hx,minRows:p=mx,maxCols:m=px,maxRows:b=gx}=r,S=Ll(c,Ai*Jp),y=Ll(d,Ai*Wp);return{cols:Jm(Math.floor(Ll(i,0)/S),f,m),rows:Jm(Math.floor(Ll(o,0)/y),p,b)}}function _a(r,i=Ai){var c,d,f;if(r)try{const p=r._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 o=Ll(i,Ai);return{cellWidth:Math.round(o*Jp*100)/100,cellHeight:Math.round(o*Wp*100)/100,measured:!1}}function bx(r){var c;const i=(c=r==null?void 0:r.querySelector)==null?void 0:c.call(r,".xterm-viewport");if(!i)return 0;const o=(i.offsetWidth||0)-(i.clientWidth||0);return Number.isFinite(o)&&o>0?o:0}function bu(r,i,o){if(!r)return{width:i,height:o};let c=0,d=0;if(typeof r.getBoundingClientRect=="function"){const f=r.getBoundingClientRect();c=(f==null?void 0:f.width)||0,d=(f==null?void 0:f.height)||0}return{width:Ll(c,Ll(r.clientWidth,i)),height:Ll(d,Ll(r.clientHeight,o))}}function Pp(r,i,o,c){const d=Number.isFinite(c)&&c>.01?c:1;return{clientX:o.left+(r-o.left)/d,clientY:o.top+(i-o.top)/d}}function ws(r){var i,o;if(!r)return!1;try{const c=r.modes;if(c&&typeof c.mouseTrackingMode=="string"&&c.mouseTrackingMode!=="none")return!0;const d=r._core;if((i=d==null?void 0:d._coreMouseService)!=null&&i.areMouseEventsActive||(o=d==null?void 0:d.coreMouseService)!=null&&o.areMouseEventsActive||d!=null&&d.mouseMode&&d.mouseMode!=="none")return!0}catch{}return!1}function yx(r,i){const o=i.button??0,c=i.buttons??(r==="mouseup"?0:1);return new MouseEvent(r,{bubbles:!0,cancelable:!0,clientX:i.clientX,clientY:i.clientY,screenX:i.clientX,screenY:i.clientY,button:o,buttons:c})}function Pm(r,i,o){const c=yx(i,o);return r.dispatchEvent(c)}class vx{constructor(i){_e(this,"options");_e(this,"state","idle");_e(this,"startX",0);_e(this,"startY",0);_e(this,"lastX",0);_e(this,"lastY",0);_e(this,"activeTarget",null);_e(this,"longPressTimer",null);_e(this,"capturedPointerId",null);_e(this,"captureElement",null);_e(this,"scrollRemainderY",0);this.options={longPressDelayMs:500,dragThresholdPx:8,scrollLineHeightPx:18,...i}}getState(){return this.state}setGestureState(i){var o,c;this.state!==i&&(this.state=i,(c=(o=this.options).onGestureStateChange)==null||c.call(o,i))}getActiveBuffer(i){var o;try{return((o=i.buffer)==null?void 0:o.active)||null}catch{return null}}getViewportY(i){var c;const o=(c=this.getActiveBuffer(i))==null?void 0:c.viewportY;return typeof o=="number"&&Number.isFinite(o)?o:null}blurTerminal(i){var o;try{(o=i.blur)==null||o.call(i)}catch{}}getLogicalCoordinates(i,o){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 Pp(i,o,f,c)}return{clientX:i,clientY:o}}getViewportElement(i){var d;const o=this.options.getSurfaceElement?this.options.getSurfaceElement():null;return(o==null?void 0:o.querySelector(".xterm-viewport"))||((d=i.element)==null?void 0:d.querySelector(".xterm-viewport"))||null}isInputLineHit(i,o){var Q;const c=(Q=o.buffer)==null?void 0:Q.active,d=this.options.getSurfaceElement?this.options.getSurfaceElement():null,f=(d==null?void 0:d.querySelector(".xterm-screen"))||o.element||d,p=_a(o);if(!f||typeof f.getBoundingClientRect!="function"||p.cellHeight<=0)return!1;const m=f.getBoundingClientRect(),b=this.getLogicalCoordinates(i.clientX,i.clientY),S=m.width>0&&m.height>0;if(![c==null?void 0:c.cursorY,c==null?void 0:c.viewportY,c==null?void 0:c.baseY].every(Z=>typeof Z=="number"&&Number.isFinite(Z)))return!1;const x=c==null?void 0:c.cursorY,R=c==null?void 0:c.viewportY,k=(c==null?void 0:c.baseY)+x-R,q=m.top+k*p.cellHeight,z=q+p.cellHeight,X=Number(o.rows);return k>=0&&(!Number.isFinite(X)||k<X)&&b.clientY>=q-2&&b.clientY<=z+2&&(!S||b.clientX>=m.left&&b.clientX<=m.right)}resolveDispatchTarget(i,o){var m;const c=this.options.getSurfaceElement?this.options.getSurfaceElement():null,d=(c==null?void 0:c.querySelector(".xterm-screen"))||o.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(i.clientX,i.clientY)),p&&f&&(p===f||f.contains(p))?p:d||c||o}getMouseReport(i,o){const c=this.options.getSurfaceElement?this.options.getSurfaceElement():null,d=(c==null?void 0:c.querySelector(".xterm-screen"))||o.element;if(!d||typeof d.getBoundingClientRect!="function")return null;const f=d.getBoundingClientRect(),p=this.getLogicalCoordinates(i.clientX,i.clientY),m=_a(o);if(m.cellWidth<=0||m.cellHeight<=0)return null;const b=Math.max(1,f.width||o.cols*m.cellWidth),S=Math.max(1,f.height||o.rows*m.cellHeight),y=Math.max(0,Math.min(b-1,p.clientX-f.left)),x=Math.max(0,Math.min(S-1,p.clientY-f.top)),R=Math.max(0,Math.min(o.cols-1,Math.floor(y/m.cellWidth))),E=Math.max(0,Math.min(o.rows-1,Math.floor(x/m.cellHeight)));return{col:R,row:E,x:Math.floor(y),y:Math.floor(x),button:0,action:0}}getCoreMouseService(i){var c,d;const o=i;return o.coreMouseService||((c=o._core)==null?void 0:c.coreMouseService)||((d=o._core)==null?void 0:d._coreMouseService)||null}getCoreService(i){var c;const o=i;return o.coreService||((c=o._core)==null?void 0:c.coreService)||null}getWheelDispatchTarget(i){const o=this.options.getSurfaceElement?this.options.getSurfaceElement():null;return(o==null?void 0:o.querySelector(".xterm"))||i.element||null}dispatchWheel(i,o,c,d){const f=this.getWheelDispatchTarget(c);if(!f||typeof WheelEvent>"u"||o===0)return!1;const p=this.getLogicalCoordinates(i.clientX,i.clientY),m=o<0?-1:1;let b=0;for(let S=0;S<Math.abs(o);S+=1)try{const y=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(y),b+=1}catch{return b>0}return b>0}emitWheel(i,o,c,d){if(o===0)return!1;if(this.dispatchWheel(i,o,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(o);m+=1){const b=this.getMouseReport(i,c);b&&(b.button=4,b.action=o<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(i,o,c,d){var p;if(o===0)return"none";const f=ws(c);if(!f&&!this.options.getIsController())return"none";if(this.emitWheel(i,o,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":"["}${o<0?"A":"B"}`;return m.triggerDataEvent(S.repeat(Math.abs(o)),!0),"application-keys"}return"none"}emitMouse(i,o,c){const d=this.options.getTerminal();if(!d)return;const f=this.getCoreMouseService(d);if(f!=null&&f.triggerMouseEvent){const m=this.getMouseReport(o,d);m&&(m.action=i==="mousedown"?1:i==="mouseup"?0:32,m.ctrl=!!(c!=null&&c.ctrlKey),m.alt=!!(c!=null&&c.altKey),m.shift=!!(c!=null&&c.shiftKey),f.triggerMouseEvent(m));return}if(this.options.allowSyntheticMouseFallback===!1||!this.activeTarget)return;const p=this.getLogicalCoordinates(o.clientX,o.clientY);Pm(this.activeTarget,i,{clientX:p.clientX,clientY:p.clientY,button:0,buttons:i==="mouseup"?0:1})}beginGesture(i,o){this.startX=i.clientX,this.startY=i.clientY,this.lastX=i.clientX,this.lastY=i.clientY,this.setGestureState("pending"),this.scrollRemainderY=0,this.activeTarget=this.resolveDispatchTarget(i,o),this.clearLongPressTimer(),this.longPressTimer=setTimeout(()=>{var c,d;this.state==="pending"&&(this.setGestureState("longpress"),(d=(c=this.options).onLongPress)==null||d.call(c,{clientX:this.startX,clientY:this.startY}))},this.options.longPressDelayMs)}moveGesture(i,o){var S,y,x,R;if(this.state==="longpress"){(y=(S=this.options).onSelectionExtend)==null||y.call(S,{clientX:i.clientX,clientY:i.clientY}),o!=null&&o.cancelable&&((x=o.preventDefault)==null||x.call(o));return}if(this.state==="idle")return;const c=i.clientX-this.startX,d=i.clientY-this.startY,f=Math.hypot(c,d);if(this.state==="scrolling"){this.scrollGesture(i,o);return}const p=this.options.getTerminal(),m=this.options.getIsController(),b=ws(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=i.clientX,this.lastY=this.startY,this.scrollRemainderY=0,this.scrollGesture(i,o);return}if(b&&m){this.state==="pending"&&(this.setGestureState("dragging"),this.emitMouse("mousedown",{clientX:this.startX,clientY:this.startY},o)),this.state==="dragging"&&(this.lastX=i.clientX,this.lastY=i.clientY,this.emitMouse("mousemove",i,o),o!=null&&o.cancelable&&((R=o.preventDefault)==null||R.call(o)));return}this.lastX=i.clientX,this.lastY=i.clientY}}scrollGesture(i,o){var k,q,z;const c=this.options.getTerminal();if(!c)return;const d=i.clientY-this.lastY;this.lastX=i.clientX,this.lastY=i.clientY;const f=_a(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,y="none";const x=this.getActiveBuffer(c),R=ws(c);if(b!==0){if((x==null?void 0:x.type)==="alternate")y=this.scrollAlternateBuffer(i,b,c,o),S=y!=="none";else{const X=this.getViewportY(c);c.scrollLines(b);const Q=this.getViewportY(c);y="buffer",S=X===null||Q===null||X!==Q}this.scrollRemainderY-=m*p}const E=this.getViewportElement(c);(q=(k=this.options).onGestureScroll)==null||q.call(k,{deltaY:d,lines:b,viewportY:this.getViewportY(c),scrollTop:(E==null?void 0:E.scrollTop)??null,scrollHeight:(E==null?void 0:E.scrollHeight)??null,clientHeight:(E==null?void 0:E.clientHeight)??null,moved:S,bufferType:(x==null?void 0:x.type)||null,baseY:typeof(x==null?void 0:x.baseY)=="number"?x.baseY:null,cursorY:typeof(x==null?void 0:x.cursorY)=="number"?x.cursorY:null,hasScrollback:typeof(x==null?void 0:x.hasScrollback)=="boolean"?x.hasScrollback:null,mouseTracking:R,scrollMode:y}),o!=null&&o.cancelable&&((z=o.preventDefault)==null||z.call(o))}endGesture(i,o){var p,m,b;this.clearLongPressTimer();const c=this.options.getTerminal(),d=this.options.getIsController(),f=ws(c);if(this.state==="pending"){if(f&&d){const y={clientX:this.startX,clientY:this.startY};this.emitMouse("mousedown",y,o),this.emitMouse("mouseup",y,o)}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=i??{clientX:this.lastX,clientY:this.lastY};this.emitMouse("mouseup",S,o),o!=null&&o.cancelable&&((b=o.preventDefault)==null||b.call(o))}this.reset()}handlePointerDown(i,o){if(i.pointerType==="mouse")return!1;if(!i.isPrimary)return this.releasePointerCapture(),this.reset(),!1;if(i.cancelable&&i.preventDefault(),this.beginGesture(i,o),i.pointerType!=="touch")try{typeof o.setPointerCapture=="function"&&(o.setPointerCapture(i.pointerId),this.capturedPointerId=i.pointerId,this.captureElement=o)}catch{}return!0}handlePointerMove(i){i.pointerType==="mouse"||this.state==="idle"||this.moveGesture(i,i)}handlePointerUp(i){i.pointerType==="mouse"||this.state==="idle"||(this.releasePointerCapture(),this.endGesture(i,i))}handlePointerCancel(i){i&&i.pointerType==="mouse"||(this.releasePointerCapture(),this.cancelGesture())}handleTouchStart(i,o){if(i.touches.length!==1){this.reset();return}i.cancelable&&i.preventDefault(),this.beginGesture(i.touches[0],o)}handleTouchMove(i){i.touches.length===1&&this.moveGesture(i.touches[0],i)}handleTouchEnd(i){i.cancelable&&i.preventDefault(),this.endGesture(null,i)}handleTouchCancel(){this.cancelGesture()}cancelGesture(){this.clearLongPressTimer();const i=this.options.getTerminal(),o=this.options.getIsController(),c=ws(i);if(this.state==="dragging"&&c&&o&&this.activeTarget){const d=this.getLogicalCoordinates(this.lastX,this.lastY);Pm(this.activeTarget,"mouseup",{clientX:d.clientX,clientY:d.clientY,button:0,buttons:0})}this.reset()}releasePointerCapture(){const i=this.captureElement,o=this.capturedPointerId;if(this.captureElement=null,this.capturedPointerId=null,!(!i||o===null))try{typeof i.releasePointerCapture=="function"&&(typeof i.hasPointerCapture!="function"||i.hasPointerCapture(o))&&i.releasePointerCapture(o)}catch{}}clearLongPressTimer(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressTimer=null)}reset(){this.clearLongPressTimer(),this.releasePointerCapture(),this.setGestureState("idle"),this.activeTarget=null}}var xx=my();const js="herdr_remote_renderer_probe_v1",Qr=1,Sx=720*60*60*1e3,_u={};function $p(){let r=null;if(typeof window>"u")r=_u[js]||null;else try{r=window.localStorage?window.localStorage.getItem(js):null}catch{r=_u[js]||null}if(!r)return{v:Qr,ua:{}};try{const i=JSON.parse(r);return typeof i=="object"&&i!==null&&i.v===Qr&&typeof i.ua=="object"&&i.ua!==null?i:{v:Qr,ua:{}}}catch{return{v:Qr,ua:{}}}}function wx(r,i=Date.now()){var d;const o=$p();o.ua[r]={failedAt:i};const c=JSON.stringify(o);if(_u[js]=c,typeof window<"u")try{(d=window.localStorage)==null||d.setItem(js,c)}catch(f){console.warn("Failed to write renderer probe result to localStorage:",f)}}function Cx(r,i=Date.now()){const o=typeof navigator<"u"?navigator.userAgent:"";if(!o)return!1;const d=$p().ua[o];return!(!d||typeof d.failedAt!="number"||i-d.failedAt>Sx)}function $m(r,i=Date.now()){const o=typeof navigator<"u"?navigator.userAgent:"";o&&wx(o,i)}function Tx(r){if(r.length<4)return!0;const i=r[0],o=r[1],c=r[2],d=r[3];for(let f=4;f<r.length;f+=4)if(r[f]!==i||r[f+1]!==o||r[f+2]!==c||r[f+3]!==d)return!1;return!0}function Nx(r){if(!r||r.width<=0||r.height<=0)return console.debug("Canvas probe inconclusive: text layer canvas missing or zero dimensions"),"inconclusive";let i=null;try{i=r.getContext("2d",{willReadFrequently:!0})||r.getContext("2d")}catch(d){return console.debug("Canvas probe inconclusive: failed to acquire 2D context:",d),"inconclusive"}if(!i)return console.debug("Canvas probe inconclusive: 2D context is null"),"inconclusive";const o=Math.min(r.width,640),c=Math.min(r.height,240);if(o<=0||c<=0)return console.debug("Canvas probe inconclusive: calculated sample dimensions are zero"),"inconclusive";try{const d=i.getImageData(0,0,o,c);return Tx(d.data)?"blank":"healthy"}catch(d){return console.debug("Canvas probe inconclusive: getImageData threw exception:",d),"inconclusive"}}function Ex(r=2){return new Promise(i=>{if(typeof requestAnimationFrame!="function"){setTimeout(i,32);return}let o=r;const c=()=>{o--,o<=0?i():requestAnimationFrame(c)};requestAnimationFrame(c)})}function Ax(r,i={}){if(Cx())return{kind:"dom",dispose:()=>{},verify:async()=>{}};try{const o=new xx.CanvasAddon;r.loadAddon(o);let c="canvas",d=!1,f=null;const p=()=>{var b;if(c!=="dom"){$m();try{o.dispose()}catch{}c="dom",(b=i.onRendererSwapped)==null||b.call(i,"dom")}};return{get kind(){return c},dispose:()=>{d=!0;try{o.dispose()}catch{}},verify:async()=>{if(!(d||c!=="canvas"))return f||(f=(async()=>{var b;try{if(await Ex(2),d||c!=="canvas")return;const S=(b=r.element)==null?void 0:b.querySelector("canvas.xterm-text-layer"),y=Nx(S);y==="blank"?p():y==="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(o){console.debug("Canvas renderer unavailable, using the DOM renderer:",o),$m()}return{kind:"dom",dispose:()=>{},verify:async()=>{}}}function ep(r,i){const o=typeof window<"u"?window:void 0,c=o&&typeof o.devicePixelRatio=="number"&&o.devicePixelRatio>0?o.devicePixelRatio:1,d=o&&o.visualViewport&&typeof o.visualViewport.scale=="number"&&o.visualViewport.scale>0?o.visualViewport.scale:1,f=Math.max(0,r.width),p=Math.max(0,r.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 Rx(r){const{lastSnapshot:i,currentSnapshot:o,physicalTolerancePx:c=6}=r;if(!i)return{shouldIgnore:!1,isVisualZoom:!1,reason:"initial"};const d=Math.abs(o.scale-i.scale)>.01,f=Math.abs(o.scale-1)>.01;if(d||f)return{shouldIgnore:!0,isVisualZoom:!0,reason:"visual_pinch_zoom"};if(Math.abs(o.dpr-i.dpr)>.01){const S=Math.abs(o.physicalWidth-i.physicalWidth),y=Math.abs(o.physicalHeight-i.physicalHeight);if(S<=c&&y<=c)return{shouldIgnore:!0,isVisualZoom:!0,reason:"dpr_zoom"}}const m=Math.abs(o.cssWidth-i.cssWidth),b=Math.abs(o.cssHeight-i.cssHeight);return m<1&&b<1?{shouldIgnore:!0,isVisualZoom:!1,reason:"no_box_change"}:{shouldIgnore:!1,isVisualZoom:!1,reason:"genuine_resize"}}const jx=" ()[]{}'\"\\`";function yu(r,i,o,c=1){var z,X;if(!i||!((z=i.buffer)!=null&&z.active)||i.cols<=0||i.rows<=0)return null;const d=o||((X=i.element)==null?void 0:X.querySelector(".xterm-screen"))||i.element;if(!d||typeof d.getBoundingClientRect!="function")return null;const f=d.getBoundingClientRect(),p=Pp(r.clientX,r.clientY,f,c),m=_a(i);if(m.cellWidth<=0||m.cellHeight<=0)return null;const b=Math.max(1,f.width||i.cols*m.cellWidth),S=Math.max(1,f.height||i.rows*m.cellHeight),y=Math.max(0,Math.min(b-1,p.clientX-f.left)),x=Math.max(0,Math.min(S-1,p.clientY-f.top)),R=Math.max(0,Math.min(i.cols-1,Math.floor(y/m.cellWidth))),E=Math.max(0,Math.min(i.rows-1,Math.floor(x/m.cellHeight))),q=(i.buffer.active.viewportY??0)+E;return{col:R,bufferRow:q}}function Mx(r,i){if(!r||r.length===0||r==="\0")return!0;for(const o of r)if(o==="\0"||/\s/.test(o)||i.includes(o))return!0;return!1}function kx(r,i,o){var R,E;if(!r||!((R=r.buffer)!=null&&R.active)||i<0||i>=r.cols)return null;const c=r.buffer.active.getLine(o);if(!c)return null;const d=((E=r.options)==null?void 0:E.wordSeparator)??jx,f=new Array(r.cols).fill(null),p=Math.min(r.cols,c.length);let m=0;for(;m<p;){const k=c.getCell(m);if(!k){f[m]={startCol:m,endCol:m+1,isSeparator:!0},m++;continue}const q=k.getWidth();if(q===0){f[m]||(f[m]={startCol:m,endCol:m+1,isSeparator:!0}),m++;continue}const z=k.getChars(),X=Mx(z,d),Q=Math.min(r.cols,m+q),Z={startCol:m,endCol:Q,isSeparator:X};for(let te=m;te<Q;te++)f[te]=Z;m+=Math.max(1,q)}for(let k=p;k<r.cols;k++)f[k]||(f[k]={startCol:k,endCol:k+1,isSeparator:!0});const b=f[i];if(!b||b.isSeparator)return null;let S=b.startCol;for(;S>0;){const k=f[S-1];if(k&&!k.isSeparator)S=k.startCol;else break}let y=b.endCol;for(;y<r.cols;){const k=f[y];if(k&&!k.isSeparator)y=k.endCol;else break}const x=y-S;return x<=0?null:{startCol:S,length:x}}function _x(r){var f;if(!r||!((f=r.buffer)!=null&&f.active))return"";const i=r.buffer.active,o=i.viewportY??0,c=r.rows,d=[];for(let p=0;p<c;p++){const m=i.getLine(o+p);d.push(m?m.translateToString(!0):"")}for(;d.length>0&&d[d.length-1]==="";)d.pop();return d.join(`
34
+ `)}const tp=new Set(["│","┃","╎","╏","┆","┇","┊","┋","║","▏","▕","|"]),zx=.6,Dx=new Set(["─","━","═","┄","┅","┈","┉","-"]),Lx=.8;function vu(r,i){if(!r)return!1;let o=0;const c=Math.min(i,r.length);for(let d=0;d<c;d++){const f=r.getCell(d);if(f){const p=f.getChars();p&&Dx.has(p)&&o++}}return o>=Math.max(5,Math.min(i*.25,10))}function xu(r,i,o){var E;if(!r||!((E=r.buffer)!=null&&E.active)||r.cols<=0)return{startCol:0,endCol:0};const c=r.buffer.active,d=r.cols,f=Math.max(0,Math.min(d-1,i)),p=c.viewportY??0,m=r.rows>0?r.rows:1,b=new Int32Array(d);let S=0;for(let k=0;k<m;k++){const q=c.getLine(p+k);if(S++,!q)continue;const z=Math.min(d,q.length);for(let X=0;X<z;X++){const Q=q.getCell(X);if(Q){const Z=Q.getChars();Z&&tp.has(Z)&&b[X]++}}}if(S===0)return{startCol:0,endCol:d-1};const y=S*zx,x=k=>b[k]>=y;let R=!1;for(let k=0;k<d;k++)if(x(k)){R=!0;break}if(R){if(x(f))return{startCol:f,endCol:f};let k=-1;for(let z=f-1;z>=0;z--)if(x(z)){k=z;break}let q=d;for(let z=f+1;z<d;z++)if(x(z)){q=z;break}return{startCol:k+1,endCol:q-1}}if(o!==void 0){const k=Math.max(p,Math.min(p+m-1,o)),q=c.getLine(k);if(!vu(q,d)){let z=p;for(let Z=k-1;Z>=p;Z--)if(vu(c.getLine(Z),d)){z=Z+1;break}let X=p+m-1;for(let Z=k+1;Z<=p+m-1;Z++)if(vu(c.getLine(Z),d)){X=Z-1;break}const Q=X-z+1;if(Q>=2){const Z=new Int32Array(d);for(let O=z;O<=X;O++){const j=c.getLine(O);if(!j)continue;const ee=Math.min(d,j.length);for(let be=0;be<ee;be++){const Ae=j.getCell(be);if(Ae){const xe=Ae.getChars();xe&&tp.has(xe)&&Z[be]++}}}const te=Q*Lx,he=O=>Z[O]>=te;let L=!1;for(let O=0;O<d;O++)if(he(O)){L=!0;break}if(L){if(he(f))return{startCol:f,endCol:f};let O=-1;for(let ee=f-1;ee>=0;ee--)if(he(ee)){O=ee;break}let j=d;for(let ee=f+1;ee<d;ee++)if(he(ee)){j=ee;break}return{startCol:O+1,endCol:j-1}}}}}return{startCol:0,endCol:d-1}}function np(r,i){const o=Math.min(r.startCol,r.endCol),c=Math.max(r.startCol,r.endCol),d=Math.min(r.startRow,r.endRow),f=Math.max(r.startRow,r.endRow);return{startCol:Math.max(i.startCol,Math.min(i.endCol,o)),endCol:Math.max(i.startCol,Math.min(i.endCol,c)),startRow:d,endRow:f}}function Su(r,i){var S;if(!r||!((S=r.buffer)!=null&&S.active)||r.cols<=0)return"";const o=r.buffer.active,c=r.cols,d=Math.min(i.startRow,i.endRow),f=Math.max(i.startRow,i.endRow),p=Math.max(0,Math.min(i.startCol,i.endCol)),m=Math.min(c-1,Math.max(i.startCol,i.endCol));if(p>m||d>f)return"";const b=[];for(let y=d;y<=f;y++){const x=o.getLine(y);if(!x){b.push("");continue}const R=x.translateToString(!0,p,m+1);b.push(R.trimEnd())}return b.join(`
35
+ `)}async function za(r){if(typeof navigator<"u"&&navigator.clipboard&&typeof navigator.clipboard.writeText=="function")try{return await navigator.clipboard.writeText(r),"clipboard"}catch{}if(typeof document<"u"&&typeof document.execCommand=="function"){let i=null,o=null,c=null;try{if(i=document.createElement("textarea"),i.style.userSelect="text",i.style.webkitUserSelect="text",i.style.position="fixed",i.style.top="0",i.style.left="0",i.style.width="1px",i.style.height="1px",i.style.padding="0",i.style.border="none",i.style.outline="none",i.style.boxShadow="none",i.style.background="transparent",i.style.opacity="0",i.style.fontSize="16px",i.setAttribute("readonly",""),i.setAttribute("aria-hidden","true"),i.value=r,typeof window<"u"&&typeof window.getSelection=="function"&&(c=window.getSelection(),c&&c.rangeCount>0&&(o=c.getRangeAt(0))),document.body.appendChild(i),typeof navigator<"u"&&(/iPad|iPhone|iPod/.test(navigator.userAgent||"")||navigator.platform==="MacIntel"&&(navigator.maxTouchPoints||0)>1)){const p=document.createRange();p.selectNodeContents(i),c&&(c.removeAllRanges(),c.addRange(p)),i.setSelectionRange(0,r.length)}else i.focus({preventScroll:!0}),i.select();if(document.execCommand("copy"))return"exec"}catch{}finally{i&&i.parentNode&&i.parentNode.removeChild(i),c&&(c.removeAllRanges(),o&&c.addRange(o))}}return"failed"}async function Ox(){if(!(typeof window>"u"||window.isSecureContext!==!1)||typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.readText!="function")return{ok:!1,reason:"insecure"};try{const i=await navigator.clipboard.readText();return!i||i.length===0?{ok:!1,reason:"empty"}:{ok:!0,text:i}}catch(i){return typeof window<"u"&&window.isSecureContext===!1?{ok:!1,reason:"insecure"}:(i==null?void 0:i.name)==="SecurityError"?{ok:!1,reason:"insecure"}:{ok:!1,reason:"denied"}}}async function Ux(){if(!(typeof window>"u"||window.isSecureContext!==!1)||typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.read!="function")return{ok:!1,reason:"insecure"};try{const i=await navigator.clipboard.read();if(!i||i.length===0)return{ok:!1,reason:"empty"};for(const o of i){const c=o.types.find(d=>d.startsWith("image/"));if(c){const d=await o.getType(c);if(d&&d.size>0)return{ok:!0,blob:d}}}return{ok:!1,reason:"empty"}}catch(i){if(typeof window<"u"&&window.isSecureContext===!1)return{ok:!1,reason:"insecure"};const o=i==null?void 0:i.name;return o==="SecurityError"?{ok:!1,reason:"insecure"}:o==="NotAllowedError"?{ok:!1,reason:"denied"}:{ok:!1,reason:"empty"}}}function eg(r){const i=r.clipboardData;if(!i)return null;if(i.files&&i.files.length>0)for(let o=0;o<i.files.length;o++){const c=i.files[o];if(c&&c.type.startsWith("image/"))return c}if(i.items&&i.items.length>0)for(let o=0;o<i.items.length;o++){const c=i.items[o];if(c&&c.type.startsWith("image/")){const d=c.getAsFile();if(d)return d}}return null}function Bx(r){if(!r||r.length===0)return null;for(let i=0;i<r.length;i++){const o=r[i];if(o&&(o.type.startsWith("image/")||/\.(png|jpe?g|webp|gif)$/i.test(o.name)))return o}return null}const wu="Herdr Remote",lp=80,Hx=/[\u0000-\u001F\u007F-\u009F]/g;function zu(r){if(typeof r!="string")return"";const i=r.replace(Hx," ").replace(/\s+/g," ").trim();return i.length<=lp?i:`${i.slice(0,lp-1).trimEnd()}…`}function Yx(r,i){const o=zu(r);if(o)return`${o} · ${wu}`;const c=zu(i);return c?`${c} · ${wu}`:wu}function Kx(r,i){const o=Yx(r,i);return typeof document<"u"&&(document.title=o),o}const Gx=new Set(["http:","https:","mailto:"]),Cu=/(?:https?:\/\/|mailto:|www\.)[^\s"'<>`]+/gi,qx=/[.,;:!?'"]+$/,ap=8;function Xu(r){return/^www\./i.test(r)?`https://${r}`:r}function Vx(r){const i=(d,f)=>d.split(f).length-1;let o=r.replace(qx,"");const c=[["(",")"],["[","]"],["{","}"]];for(const[d,f]of c)for(;o.endsWith(f)&&i(o,f)>i(o,d);)o=o.slice(0,-1);return o}function tg(r){if(typeof r!="string"||r.length===0)return!1;try{return Gx.has(new URL(Xu(r)).protocol)}catch{return!1}}function Xx(r,i){if(typeof r!="string"||i<0)return null;Cu.lastIndex=0;for(let o=Cu.exec(r);o;o=Cu.exec(r)){const c=Vx(o[0]);if(!c)continue;const d=o.index,f=d+c.length;if(i>=d&&i<f&&tg(c))return c}return null}function Fx(r,i,o){var m;const c=(m=r==null?void 0:r.buffer)==null?void 0:m.active;if(!c||typeof c.getLine!="function"||!c.getLine(o))return null;let d=o;for(let b=0;b<ap;b+=1){const S=c.getLine(d);if(!(S!=null&&S.isWrapped)||d===0)break;d-=1}let f="",p=-1;for(let b=d;b<d+ap;b+=1){const S=c.getLine(b);if(!S||b>d&&!S.isWrapped)break;b===o&&(p=f.length+i),f+=S.translateToString(!1)}return p<0?null:{text:f,index:p}}function Zx(r,i,o){const c=Fx(r,i,o);return c?Xx(c.text,c.index):null}function Qx(r){try{const i=new URL(Xu(r));return i.host||i.pathname}catch{return""}}function Tu(r){return!tg(r)||typeof window>"u"||typeof window.open!="function"?!1:(window.open(Xu(r),"_blank","noopener,noreferrer"),!0)}const Si="tui-focusable group flex h-11 w-full select-none items-center gap-2 border px-2 text-left text-tui transition-colors",wi="border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",Ix=({anchorPoint:r,hasSelection:i,isController:o,vibrateOnKeyPress:c=!1,linkUrl:d=null,onOpenLink:f,onCopySelection:p,onCopyLine:m,onCopyScreen:b,onPaste:S,onClose:y})=>{const{t:x}=xt(),R=v.useRef(null),[E,k]=v.useState(null);v.useEffect(()=>{if(c&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(8)}catch{}},[c]),v.useLayoutEffect(()=>{const Q=R.current;if(!Q||!Q.parentElement)return;const Z=Q.parentElement.getBoundingClientRect(),te=Q.getBoundingClientRect(),he=te.width||208,L=te.height||220,O=Z.width,j=Z.height;let ee=r.x-he/2;ee=Math.max(8,Math.min(Math.max(8,O-he-8),ee));let be=r.y-L-8;be<8&&(be=r.y+8),be=Math.max(8,Math.min(Math.max(8,j-L-8),be)),k({x:ee,y:be})},[r.x,r.y,i,o,d]);const q=Math.max(8,r.x-104),z=Math.max(8,r.y-200),X={position:"absolute",left:`${E?E.x:q}px`,top:`${E?E.y:z}px`,visibility:E?"visible":"hidden"};return u.jsx("div",{ref:R,role:"menu","aria-label":"终端选择操作",className:"z-50 w-52 select-none font-mono",style:X,onMouseDown:Q=>Q.stopPropagation(),onTouchStart:Q=>Q.stopPropagation(),onPointerDown:Q=>Q.stopPropagation(),children:u.jsxs(en,{tone:"accent",className:"border border-tui-border bg-tui-base p-1.5 shadow-lg",bodyClassName:"flex flex-col gap-1",children:[d&&f&&u.jsxs("button",{type:"button",role:"menuitem",className:W(Si,wi),onClick:()=>{f(d),y()},children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:qe.cursor}),u.jsx("span",{className:"truncate",children:x("clipboard.openLink")}),u.jsx("span",{className:"ml-auto max-w-[45%] truncate text-tui-faint",children:Qx(d)})]}),i&&u.jsxs("button",{type:"button",role:"menuitem",className:W(Si,wi),onClick:()=>{p(),y()},children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:qe.cursor}),u.jsx("span",{className:"truncate",children:x("clipboard.copySelection")})]}),u.jsxs("button",{type:"button",role:"menuitem",className:W(Si,wi),onClick:()=>{m(),y()},children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:qe.cursor}),u.jsx("span",{className:"truncate",children:x("clipboard.copyLine")})]}),u.jsxs("button",{type:"button",role:"menuitem",className:W(Si,wi),onClick:()=>{b(),y()},children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:qe.cursor}),u.jsx("span",{className:"truncate",children:x("clipboard.copyScreen")})]}),o&&u.jsxs("button",{type:"button",role:"menuitem",className:W(Si,wi),onClick:()=>{S(),y()},children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:qe.cursor}),u.jsx("span",{className:"truncate",children:x("clipboard.paste")})]}),u.jsxs("button",{type:"button",role:"menuitem",className:W(Si,wi),onClick:y,children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:qe.cursor}),u.jsx("span",{className:"truncate",children:x("clipboard.cancel")})]})]})})},Jx=({isOpen:r,onClose:i,onSend:o,onSendImage:c})=>{const{t:d,addToast:f}=xt(),[p,m]=v.useState(""),[b,S]=v.useState(null),[y,x]=v.useState(!1),R=v.useRef(null),E=v.useRef(null),k=v.useRef(null);v.useEffect(()=>{r&&(m(""),S(null),x(!1),R.current&&(R.current.value=""),E.current&&(E.current.value=""))},[r]);const q=async L=>{if(L.size===0){f("error",d("clipboard.fileEmpty"));return}x(!0);try{const O=await Mp(L);O?(S(O),m("")):f("error",d("clipboard.imageTooLarge"))}catch(O){console.error("Failed to process image:",O),f("error",d("clipboard.imageTooLarge"))}finally{x(!1)}},z=async L=>{const O=eg(L);O&&(L.preventDefault(),await q(O))},X=async L=>{const O=Bx(L.target.files);L.target.value="",O&&await q(O)},Q=L=>{const O=L.target.value;m(O),O&&b&&S(null)},Z=()=>{S(null),R.current&&(R.current.value=""),E.current&&(E.current.value="")},te=()=>{b?(c==null||c(b),i()):p.trim()&&(o(p),i())},he=!!(p.trim()||b);return u.jsx(Vu,{isOpen:r,onClose:i,title:d("clipboard.pasteTitle"),closeLabel:d("clipboard.cancel"),size:"sm",footer:u.jsxs("div",{className:"flex items-center justify-end gap-2",children:[u.jsx(He,{variant:"ghost",onClick:i,children:d("clipboard.cancel")}),u.jsx(He,{variant:"primary",onClick:te,disabled:!he||y,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:k,id:"paste-fallback-input","data-testid":"paste-fallback-input",rows:4,autoFocus:!0,placeholder:d("clipboard.pasteHint"),value:p,onChange:Q,onPaste:z,disabled:!!b||y,className:"tui-input min-h-[90px] w-full resize-none p-2 text-tui font-mono rounded border border-tui-border bg-tui-bg focus:outline-none focus:ring-1 focus:ring-tui-accent disabled:opacity-50"})]}),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:R,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",className:"hidden","data-testid":"paste-fallback-file-input",onChange:X}),u.jsx("input",{ref:E,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",capture:"environment",className:"hidden","data-testid":"paste-fallback-camera-input",onChange:X}),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:ev(b.byteLength)})}),u.jsx(He,{variant:"ghost",onClick:Z,"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 L;return(L=R.current)==null?void 0:L.click()},disabled:y||!!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 L;return(L=E.current)==null?void 0:L.click()},disabled:y||!!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")})]}),y&&u.jsx("div",{className:"flex items-center gap-2 text-tui-xs text-tui-muted animate-pulse",children:u.jsx("span",{children:d("clipboard.imageCompressing")})})]})]})})};class Wx{constructor(i){_e(this,"getTerminal");_e(this,"now");_e(this,"textDecoder",new TextDecoder("utf-8"));_e(this,"state","tentative");_e(this,"predictions",[]);_e(this,"predictedCursor",null);_e(this,"srtt",null);_e(this,"isSuppressed",!1);_e(this,"suppressCursor",null);_e(this,"suppressSentAt",0);this.getTerminal=i.getTerminal,this.now=i.now??(typeof performance<"u"&&typeof performance.now=="function"?()=>performance.now():()=>Date.now())}handleUserInput(i){if(this.pruneExpired(),i.length===0)return;const o=this.textDecoder.decode(i,{stream:!1});if(!o)return;const c=this.getTerminal();if(!c){this.reset("terminal unavailable",!0);return}for(const d of o){const f=d.codePointAt(0);if(f!==void 0){if(f===27||f===9||f===10||f===13||f<32&&f!==8){this.reset("control or escape sequence",!0);return}if(f===8||f===127){this.handleBackspace();continue}if(f>=32&&f<=126){this.handlePrintable(d,c);continue}this.reset("non-ASCII character",!0);return}}}onServerOutput(){if(this.isSuppressed){const c=this.getTerminal(),d=Math.max(300,(this.srtt??300)*1.5),f=this.now()-this.suppressSentAt>=d;let p=!1;if(c&&this.suppressCursor){const m=c.buffer.active.baseY+c.buffer.active.cursorY,b=c.buffer.active.cursorX;p=m!==this.suppressCursor.row||b!==this.suppressCursor.col}(p||f)&&(this.isSuppressed=!1,this.suppressCursor=null)}if(this.pruneExpired(),this.predictions.length===0)return;const i=this.getTerminal();if(!i)return;const o=[];for(let c=0;c<this.predictions.length;c++){const d=this.predictions[c],f=i.buffer.active.getLine(d.row),p=f?f.getCell(d.col):void 0,m=p?p.getChars():"";if(m===d.charBefore)o.push(d);else if(m===d.char){const b=Math.max(0,this.now()-d.sentAt);this.updateSrtt(b),this.state="confident"}else{this.predictions=[],this.predictedCursor=null,this.state="tentative",this.isSuppressed=!1,this.suppressCursor=null;return}}this.predictions=o}reset(i,o){if(this.predictions=[],this.predictedCursor=null,typeof o=="boolean"?o:(o==null?void 0:o.suppress)??!0){this.isSuppressed=!0,this.suppressSentAt=this.now();const d=this.getTerminal();d?this.suppressCursor={row:d.buffer.active.baseY+d.buffer.active.cursorY,col:d.buffer.active.cursorX}:this.suppressCursor=null}else this.isSuppressed=!1,this.suppressCursor=null}getVisiblePredictions(){return this.pruneExpired(),this.state!=="confident"?[]:this.predictions.map(i=>({row:i.row,col:i.col,char:i.char}))}getState(){return this.state}getEchoSrttMs(){return this.srtt}handlePrintable(i,o){if(this.isSuppressed){const p=Math.max(300,(this.srtt??300)*1.5);if(this.now()-this.suppressSentAt>=p)this.isSuppressed=!1,this.suppressCursor=null;else return}if(this.predictedCursor||(this.predictedCursor={row:o.buffer.active.baseY+o.buffer.active.cursorY,col:o.buffer.active.cursorX}),this.predictedCursor.col+1>=o.cols){this.reset("cursor would reach or exceed column boundary",!0);return}const c=o.buffer.active.getLine(this.predictedCursor.row),d=c?c.getCell(this.predictedCursor.col):void 0,f=d?d.getChars():"";this.predictions.push({row:this.predictedCursor.row,col:this.predictedCursor.col,char:i,charBefore:f,sentAt:this.now()}),this.predictedCursor.col++}handleBackspace(){if(this.predictedCursor&&this.predictions.length>0){const i=this.predictions[this.predictions.length-1];if(i.row===this.predictedCursor.row&&i.col===this.predictedCursor.col-1){this.predictions.pop(),this.predictedCursor.col--;return}}this.reset("backspace into server content",!0)}pruneExpired(){if(this.predictions.length===0)return;const i=this.now(),o=[];for(const c of this.predictions)i-c.sentAt<=1500&&o.push(c);o.length!==this.predictions.length&&(this.predictions=o,this.predictions.length===0&&(this.predictedCursor=null))}updateSrtt(i){this.srtt===null?this.srtt=i:this.srtt=this.srtt*.8+i*.2}}function ip(r){return typeof r=="string"&&/^#[0-9a-fA-F]{6}$/.test(r)}class Px{constructor(i){_e(this,"options");_e(this,"activeDecorations",new Map);this.options=i}sync(i){var d,f;const o=this.options.getTerminal();if(!o){this.clear();return}if(i.length===0){this.clear();return}if(typeof o.registerMarker!="function"||typeof o.registerDecoration!="function"||!((d=o.buffer)!=null&&d.active)){this.clear();return}const c=new Set;for(const p of i){const m=`${p.row}:${p.col}`;c.add(m);const b=this.activeDecorations.get(m);if(b){if(b.char===p.char){b.decoration.element&&this.applyStyleToElement(b.decoration.element,b.char);continue}this.disposeEntry(b),this.activeDecorations.delete(m)}try{const S=o.buffer.active.baseY+o.buffer.active.cursorY,y=p.row-S,x=o.registerMarker(y);if(!x||x.isDisposed||x.line===-1)continue;const R=this.options.getStyle(),E={marker:x,anchor:"left",x:p.col,width:1,height:1,layer:"top"};ip(R.background)&&(E.backgroundColor=R.background),ip(R.color)&&(E.foregroundColor=R.color);const k=o.registerDecoration(E);if(!k||k.isDisposed){try{x.dispose()}catch{}continue}k.element&&this.applyStyleToElement(k.element,p.char),k.onRender(q=>{this.applyStyleToElement(q,p.char)}),(f=x.onDispose)==null||f.call(x,()=>{this.activeDecorations.delete(m)}),this.activeDecorations.set(m,{decoration:k,marker:x,char:p.char})}catch(S){console.debug("Failed to create prediction decoration:",S)}}for(const[p,m]of this.activeDecorations)c.has(p)||(this.disposeEntry(m),this.activeDecorations.delete(p))}clear(){for(const i of this.activeDecorations.values())this.disposeEntry(i);this.activeDecorations.clear()}dispose(){this.clear()}applyStyleToElement(i,o){const c=this.options.getStyle();i.textContent=o,i.style.pointerEvents="none",i.style.userSelect="none",c.color&&(i.style.color=c.color),c.background&&(i.style.backgroundColor=c.background),i.style.textDecoration=c.underline?"underline":"none",i.style.fontFamily="inherit",i.style.fontSize="inherit",i.style.overflow="hidden",i.style.whiteSpace="pre"}disposeEntry(i){try{i.decoration.dispose()}catch{}try{i.marker.dispose()}catch{}}}const ng=40;function sp(r,i){return r==="off"?!1:r==="always"?!0:i!==null&&i>ng}const $x=250,e0=({onTerminalFocus:r,isActive:i=!0})=>{var sl,un,rl,Ka;const o=v.useRef(null),c=v.useRef(null),d=v.useRef(null),f=v.useRef(null),p=v.useRef(1),m=v.useRef({cols:0,rows:0}),b=v.useRef(null),S=v.useRef(null),y=v.useRef(null),x=v.useRef(null),R=v.useRef({width:0,height:0}),E=v.useRef(null),k=Uy(),q=k||typeof navigator<"u"&&navigator.maxTouchPoints>0||typeof window<"u"&&"ontouchstart"in window,z=typeof window<"u"&&new URLSearchParams(window.location.search).get("debug")==="1",[X,Q]=v.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}),[Z,te]=v.useState({framesPerSec:0,bytesPerSec:0}),[he,L]=v.useState(null),O=v.useRef(null),j=v.useRef(!1),ee=v.useRef(!1),be=v.useRef([]);v.useEffect(()=>{if(!z)return;const F=setInterval(()=>{const de=performance.now()-1e3,ae=be.current;for(;ae.length>0&&ae[0].time<de;)ae.shift();let ye=0;for(let le=0;le<ae.length;le++)ye+=ae[le].bytes;te({framesPerSec:ae.length,bytesPerSec:ye})},1e3);return()=>clearInterval(F)},[z]);const{isController:Ae,connectionState:xe,settings:pe,hostPalette:Re,terminalResetVersion:Ye,sendResize:_,sendBinary:V,addToast:$,warnViewerMode:ze,connect:I,subscribeToOutput:ke,subscribeToPasteFileReady:H,uploadImage:Se,profiles:je,activeProfileId:Ke,t:Be,rttMs:Pe}=xt(),Oe=tl.useMemo(()=>Iy(Re),[Re]),$e=v.useRef(Oe);$e.current=Oe;const Ve=v.useRef(Ae);Ve.current=Ae;const nt=v.useRef(V);nt.current=V;const Xe=v.useRef($);Xe.current=$;const Et=v.useRef(ze);Et.current=ze;const ft=v.useRef(_);ft.current=_;const Xt=v.useRef(Se);Xt.current=Se;const on=v.useRef(i);on.current=i;const nl=v.useRef(pe);nl.current=pe;const St=v.useRef(Be);St.current=Be;const st=v.useRef(null),wt=v.useRef(null),[tn,cn]=v.useState(null),Pt=v.useRef(null),[ne,we]=v.useState(null),Me=v.useRef(null);Me.current=ne;const[et,Fe]=v.useState(null),nn=v.useRef(null);nn.current=et;const[Gt,At]=v.useState(""),ln=v.useRef("");ln.current=Gt;const[ll,Ze]=v.useState(!1),xn=v.useRef(!1);xn.current=ll;const kt=v.useRef(!1),[La,Oa]=v.useState(0),Xn=v.useRef(null),$t=v.useRef(null),Sn=v.useRef(null),_n=v.useRef(null),[Fn,pl]=v.useState(!1),al=v.useCallback(F=>{var ye;const J=f.current;if(!J)return null;const de=((ye=d.current)==null?void 0:ye.querySelector(".xterm-screen"))||d.current,ae=yu(F,J,de,p.current);return ae?Zx(J,ae.col,ae.bufferRow):null},[]),Ua=v.useCallback(F=>{var ye;const J=f.current;if(!J)return;const de=((ye=d.current)==null?void 0:ye.querySelector(".xterm-screen"))||d.current,ae=yu(F,J,de,p.current);if(ae){Sn.current=ae;const le=xu(J,ae.col,ae.bufferRow);_n.current=le;const Ft=kx(J,ae.col,ae.bufferRow);if(Ft){const Ct={startCol:Ft.startCol,endCol:Ft.startCol+Ft.length-1,startRow:ae.bufferRow,endRow:ae.bufferRow},Rt=np(Ct,le),pt=Su(J,Rt);Fe(Rt),At(pt),Ze(!0)}else Fe(null),At(""),Ze(!1),Sn.current=null,_n.current=null}else Fe(null),At(""),Ze(!1),Sn.current=null,_n.current=null;Xn.current=F,$t.current=null},[]),ca=v.useCallback(F=>{var pt;const J=f.current,de=Sn.current;if(!J||!de)return;$t.current=F;const ae=((pt=d.current)==null?void 0:pt.querySelector(".xterm-screen"))||d.current,ye=yu(F,J,ae,p.current);if(!ye)return;const le=_n.current??xu(J,de.col,de.bufferRow),Ft={startCol:Math.min(de.col,ye.col),endCol:Math.max(de.col,ye.col),startRow:Math.min(de.bufferRow,ye.bufferRow),endRow:Math.max(de.bufferRow,ye.bufferRow)},Ct=np(Ft,le),Rt=Su(J,Ct);Fe(Ct),At(Rt),Ze(!0)},[]),il=v.useRef(Ua);il.current=Ua;const zn=v.useRef(ca);zn.current=ca;const ua=v.useCallback(async()=>{const F=ln.current;if(!F)return;await za(F)==="failed"?Xe.current("error",St.current("clipboard.copyFailed")):Xe.current("success",St.current("clipboard.copied"))},[]),Ba=v.useCallback(async()=>{var Ct,Rt,pt,wn;const F=f.current;if(!F)return;const J=(Ct=F.buffer)==null?void 0:Ct.active;if(!J)return;const de=((Rt=nn.current)==null?void 0:Rt.startRow)??((pt=Sn.current)==null?void 0:pt.bufferRow)??J.viewportY,ae=_n.current??xu(F,((wn=Sn.current)==null?void 0:wn.col)??0,de),ye={startCol:ae.startCol,endCol:ae.endCol,startRow:de,endRow:de},le=Su(F,ye);await za(le)==="failed"?Xe.current("error",St.current("clipboard.copyFailed")):Xe.current("success",St.current("clipboard.copied"))},[]),Ha=v.useCallback(async()=>{const F=f.current;if(!F)return;const J=_x(F);await za(J)==="failed"?Xe.current("error",St.current("clipboard.copyFailed")):Xe.current("success",St.current("clipboard.copied"))},[]),Ya=v.useCallback(async()=>{var J,de;const F=f.current;if(F){if(!Ve.current){Et.current();return}try{const ae=await Ux();if(ae.ok){await Xt.current(ae.blob);return}}catch{}try{const ae=await Ox();if(ae.ok){(J=st.current)==null||J.reset("paste"),(de=wt.current)==null||de.clear(),F.paste(ae.text),Xe.current("success",St.current("clipboard.pasted"));return}else if(ae.reason==="empty"){Xe.current("info",St.current("clipboard.pasteUnavailable"));return}}catch{}pl(!0)}},[]),U=v.useCallback(F=>{var de,ae;const J=f.current;if(J){if(!Ve.current){Et.current();return}(de=st.current)==null||de.reset("paste"),(ae=wt.current)==null||ae.clear(),J.paste(F),Xe.current("success",St.current("clipboard.pasted"))}},[]),Y=v.useCallback(F=>{if(f.current){if(!Ve.current){Et.current();return}Xt.current(F)}},[]);v.useEffect(()=>H(J=>{var ae,ye;const de=f.current;de&&((ae=st.current)==null||ae.reset("paste"),(ye=wt.current)==null||ye.clear(),de.paste(J),Xe.current("success",St.current("clipboard.pasted")))}),[H]);const ie=v.useCallback((F,J)=>{!Number.isFinite(F)||!Number.isFinite(J)||F<=0||J<=0||F===m.current.cols&&J===m.current.rows||(b.current={cols:F,rows:J},!S.current&&(S.current=setTimeout(()=>{var ae,ye;S.current=null;const de=b.current;b.current=null,de&&(de.cols===m.current.cols&&de.rows===m.current.rows||(m.current=de,ft.current(de.cols,de.rows),(ae=st.current)==null||ae.reset("resize"),(ye=wt.current)==null||ye.clear()))},$x)))},[]),Ce=v.useCallback((F=!1)=>{var ol;const J=f.current,de=o.current,ae=d.current,ye=c.current;if(!J||!de||!ae||!ye)return;const le=bu(de,Ti(),hu());if(le.width<=0||le.height<=0)return;ye.style.width="100%",ye.style.height="100%",ae.style.width="100%",ae.style.height="100%",ae.style.transform="none",ae.style.transformOrigin="top left",p.current=1;const Ft=ep(le),Ct=Rx({lastSnapshot:E.current,currentSnapshot:Ft});if(Ct.isVisualZoom&&!F){E.current=Ft;try{J.refresh(0,Math.max(0,J.rows-1))}catch{}return}if(Ct.shouldIgnore&&!F)return;E.current=Ft;const Rt=_a(J,Ai),pt=Wm({width:le.width-bx(ae),height:le.height,cellWidth:Rt.cellWidth,cellHeight:Rt.cellHeight}),wn=Math.abs(le.width-R.current.width)>1||Math.abs(le.height-R.current.height)>1;if(J.cols!==pt.cols||J.rows!==pt.rows)try{J.resize(pt.cols,pt.rows)}catch(Ol){console.debug("Error resizing terminal grid:",Ol)}j.current&&!ee.current&&(wn||J.cols!==pt.cols||J.rows!==pt.rows)&&(ee.current=!0,(ol=O.current)==null||ol.verify());const Dn=pt.cols!==m.current.cols||pt.rows!==m.current.rows;on.current&&(wn||F||Dn)&&(R.current={width:le.width,height:le.height},ie(pt.cols,pt.rows));try{J.refresh(0,Math.max(0,J.rows-1))}catch{}},[ie]),ge=v.useRef(Ce);ge.current=Ce;const me=v.useCallback(()=>{if(y.current===null){if(typeof requestAnimationFrame!="function"){ge.current();return}y.current=requestAnimationFrame(()=>{y.current=null,ge.current()})}},[]),Te=v.useCallback((F=30)=>{x.current!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(x.current),x.current=null);let J=0;const de=()=>{x.current=null,J++;const ae=J>=F;ge.current(!0),!ae&&J<2&&typeof requestAnimationFrame=="function"&&(x.current=requestAnimationFrame(de))};typeof requestAnimationFrame=="function"?x.current=requestAnimationFrame(de):de()},[]);v.useEffect(()=>{var bl,Ds;if(!o.current||!d.current)return;const F=o.current,J=bu(F,Ti(),hu()),de=_a(null,Ai),ae=Wm({width:J.width,height:J.height,cellWidth:de.cellWidth,cellHeight:de.cellHeight});ft.current(ae.cols,ae.rows),R.current={width:J.width,height:J.height},E.current=ep(J);const ye=zm(pe.fontSize,J.width),le=new cx.Terminal({fontSize:ye,fontFamily:Ym(pe.fontFamily),lineHeight:1.15,...$e.current?{theme:{...$e.current}}:{},allowProposedApi:!0,convertEol:!0,scrollback:5e3,cols:ae.cols,rows:ae.rows,screenReaderMode:!1,linkHandler:{activate:(P,oe)=>{Tu(oe)}}});try{const P=new ux.Unicode11Addon;le.loadAddon(P),le.unicode.activeVersion="11"}catch(P){console.debug("Unicode11 addon unavailable, using default width table:",P)}try{le.loadAddon(new fx.WebLinksAddon((P,oe)=>{Tu(oe)}))}catch(P){console.debug("WebLinks addon unavailable, URLs stay plain text:",P)}le.open(d.current),f.current=le;const Ft=le.onTitleChange(P=>{cn(zu(P)||null)}),Ct=new Wx({getTerminal:()=>f.current});st.current=Ct;const Rt=new Px({getTerminal:()=>f.current,getStyle:()=>{var fn,sn,ue,zt,ht,Dt,Zt;const P=((fn=$e.current)==null?void 0:fn.foreground)??((ue=(sn=f.current)==null?void 0:sn.options.theme)==null?void 0:ue.foreground),oe=((zt=$e.current)==null?void 0:zt.background)??((Dt=(ht=f.current)==null?void 0:ht.options.theme)==null?void 0:Dt.background),De=((Zt=st.current)==null?void 0:Zt.getEchoSrttMs())??null,Ht=De!==null&&De>ng;return{color:P,background:oe,underline:Ht}}});wt.current=Rt;const pt=()=>{const P=st.current,oe=wt.current;if(!P||!oe)return;const De=nl.current.predictiveEcho,Ht=P.getEchoSrttMs();if(!sp(De,Ht)){oe.clear();return}oe.sync(P.getVisiblePredictions())};k&&le.textarea&&(le.textarea.readOnly=!1,le.textarea.tabIndex=0,le.textarea.inputMode="text");let wn=()=>{};if(z&&le.textarea){const P=()=>{Q(oe=>({...oe,focused:document.activeElement===le.textarea}))};le.textarea.addEventListener("focus",P),le.textarea.addEventListener("blur",P),wn=()=>{var oe,De;(oe=le.textarea)==null||oe.removeEventListener("focus",P),(De=le.textarea)==null||De.removeEventListener("blur",P)},P()}const Dn=async P=>{var De,Ht;(De=st.current)==null||De.reset("paste"),(Ht=wt.current)==null||Ht.clear();const oe=eg(P);if(oe){if(P.preventDefault(),P.stopPropagation(),!Ve.current){Et.current();return}await Xt.current(oe)}};(bl=le.textarea)==null||bl.addEventListener("paste",Dn),F.addEventListener("paste",Dn);const ol=Ax(le,{onRendererSwapped:P=>{F&&(F.dataset.renderer=P),L(P);try{le.refresh(0,Math.max(0,le.rows-1))}catch{}}});O.current=ol,F&&(F.dataset.renderer=ol.kind),L(ol.kind);const Ol=St.current("terminal.bannerTitle"),Ga=St.current("terminal.bannerSubtitle");if(le.writeln(" ___ ___ .___ "),le.writeln(` / | \\ ____ _______| _/______ \x1B[1m${Ol}\x1B[0m`),le.writeln(`/ ~ \\/ __ \\\\_ __ \\ __/ ___/ \x1B[2m${Ga}\x1B[0m`),le.writeln("\\ Y / ___/ | | \\/|_ \\___ \\ "),le.writeln(" \\___|_ / \\___ >|__| /___/____ >"),le.writeln(" \\/ \\/ \\/ "),le.writeln(""),j.current=!0,ol.verify(),!k)try{le.focus()}catch{}typeof document<"u"&&"fonts"in document&&typeof((Ds=document.fonts)==null?void 0:Ds.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{}Te(5)}}).catch(()=>{});const Zn=le.onData(P=>{var De;const oe=pp(P);if(!Ve.current&&!Jr(oe)){Et.current();return}(De=st.current)==null||De.handleUserInput(oe),pt(),nt.current(oe)}),dn=le.onBinary(P=>{const oe=new Uint8Array(P.length);for(let De=0;De<P.length;De++)oe[De]=P.charCodeAt(De)&255;!Ve.current&&!Jr(oe)||nt.current(oe)}),zs=typeof le.onWriteParsed=="function"?le.onWriteParsed(()=>{var P;kt.current=!0,(P=st.current)==null||P.onServerOutput(),pt()}):{dispose:()=>{}},ao=typeof le.onRender=="function"?le.onRender(P=>{const oe=le.buffer.active.viewportY??0;Oa(oe);const De=nn.current;if(De&&xn.current){const Ht=De.startRow-oe,fn=De.endRow-oe;kt.current&&P.start<=fn&&P.end>=Ht&&(Ze(!1),kt.current=!1)}else kt.current=!1}):{dispose:()=>{}},Ri=typeof le.onScroll=="function"?le.onScroll(()=>{var oe,De;const P=le.buffer.active.viewportY??0;Oa(P),(oe=st.current)==null||oe.reset("scroll"),(De=wt.current)==null||De.clear()}):{dispose:()=>{}},an=new vx({getTerminal:()=>f.current,getIsController:()=>Ve.current,getScale:()=>p.current,getSurfaceElement:()=>d.current,allowSyntheticMouseFallback:!1,onFocus:()=>{try{le.focus()}catch{}z&&Q(P=>({...P,focused:document.activeElement===le.textarea})),r==null||r()},onGestureStateChange:P=>{z&&Q(oe=>({...oe,state:P}))},onGestureScroll:({deltaY:P,lines:oe,viewportY:De,scrollTop:Ht,scrollHeight:fn,clientHeight:sn,moved:ue,bufferType:zt,baseY:ht,cursorY:Dt,hasScrollback:Zt,mouseTracking:cl,scrollMode:In})=>{z&&Q(Mi=>({...Mi,deltaY:P,lines:oe,viewportY:De,scrollTop:Ht,scrollHeight:fn,clientHeight:sn,moved:ue,focused:document.activeElement===le.textarea,bufferType:zt,baseY:ht,cursorY:Dt,hasScrollback:Zt,mouseTracking:cl,scrollMode:In,scrollCalls:Mi.scrollCalls+(oe!==0?1:0),lastScrollLines:oe}))},longPressDelayMs:500,dragThresholdPx:8,scrollLineHeightPx:18,onLongPress:k?(P=>{var oe;return(oe=il.current)==null?void 0:oe.call(il,P)}):void 0,onSelectionExtend:k?(P=>{var oe;return(oe=zn.current)==null?void 0:oe.call(zn,P)}):void 0}),qa=typeof window<"u"&&"PointerEvent"in window,io=typeof TouchEvent<"u",qt=[],Cn=(P,oe=!1)=>{const De=P.target;return De instanceof Node&&F.contains(De)||oe&&an.getState()!=="idle"};if(qa){const P={passive:!1,capture:!0},oe=ue=>{z&&Q(zt=>({...zt,pointerEvents:zt.pointerEvents+1,lastInputEvent:ue}))},De=ue=>{if(!Cn(ue))return;if(oe("pointerdown"),Me.current){we(null),Me.current=null,Fe(null),nn.current=null,At(""),ln.current="",Ze(!1),Xn.current=null,$t.current=null,ue.cancelable&&ue.preventDefault(),ue.stopPropagation();return}an.handlePointerDown(ue,F)&&ue.stopPropagation()},Ht=ue=>{Cn(ue,!0)&&(oe("pointermove"),an.handlePointerMove(ue),ue.pointerType!=="mouse"&&ue.stopPropagation())},fn=ue=>{if(!Cn(ue,!0))return;if(oe("pointerup"),an.getState()==="longpress"&&Pt.current){const ht=$t.current??Xn.current;if(ht){const Dt=Pt.current.getBoundingClientRect(),Zt=ht.clientX-Dt.left,cl=ht.clientY-Dt.top,In=al(ht);we({x:Zt,y:cl,link:In}),Me.current={x:Zt,y:cl,link:In}}}an.handlePointerUp(ue),ue.pointerType!=="mouse"&&ue.stopPropagation()},sn=ue=>{Cn(ue,!0)&&(oe("pointercancel"),we(null),Me.current=null,Fe(null),nn.current=null,At(""),ln.current="",Ze(!1),Xn.current=null,$t.current=null,an.handlePointerCancel(ue),ue.pointerType!=="mouse"&&ue.stopPropagation())};if(document.addEventListener("pointerdown",De,P),document.addEventListener("pointermove",Ht,P),document.addEventListener("pointerup",fn,P),document.addEventListener("pointercancel",sn,P),qt.push(()=>{document.removeEventListener("pointerdown",De,P),document.removeEventListener("pointermove",Ht,P),document.removeEventListener("pointerup",fn,P),document.removeEventListener("pointercancel",sn,P)}),io){const ue=ht=>{Cn(ht,!0)&&(z&&Q(Dt=>({...Dt,touchEvents:Dt.touchEvents+1})),ht.cancelable&&ht.preventDefault(),ht.stopPropagation())},zt=["touchstart","touchmove","touchend","touchcancel"];for(const ht of zt)document.addEventListener(ht,ue,P);qt.push(()=>{for(const ht of zt)document.removeEventListener(ht,ue,P)})}}else{const P={passive:!1,capture:!0},oe=ue=>{z&&Q(zt=>({...zt,touchEvents:zt.touchEvents+1,lastInputEvent:ue}))},De=ue=>{if(Cn(ue)){if(oe("touchstart"),Me.current){we(null),Me.current=null,Fe(null),nn.current=null,At(""),ln.current="",Ze(!1),Xn.current=null,$t.current=null,ue.cancelable&&ue.preventDefault(),ue.stopPropagation();return}ue.touches.length===1&&ue.stopPropagation(),an.handleTouchStart(ue,F)}},Ht=ue=>{Cn(ue,!0)&&(oe("touchmove"),ue.touches.length===1&&ue.stopPropagation(),an.handleTouchMove(ue))},fn=ue=>{if(!Cn(ue,!0))return;if(oe("touchend"),an.getState()==="longpress"&&Pt.current){const ht=$t.current??Xn.current;if(ht){const Dt=Pt.current.getBoundingClientRect(),Zt=ht.clientX-Dt.left,cl=ht.clientY-Dt.top,In=al(ht);we({x:Zt,y:cl,link:In}),Me.current={x:Zt,y:cl,link:In}}}ue.stopPropagation(),an.handleTouchEnd(ue)},sn=ue=>{Cn(ue,!0)&&(oe("touchcancel"),we(null),Me.current=null,Fe(null),nn.current=null,At(""),ln.current="",Ze(!1),Xn.current=null,$t.current=null,ue.stopPropagation(),an.handleTouchCancel())};document.addEventListener("touchstart",De,P),document.addEventListener("touchmove",Ht,P),document.addEventListener("touchend",fn,P),document.addEventListener("touchcancel",sn,P),qt.push(()=>{document.removeEventListener("touchstart",De,P),document.removeEventListener("touchmove",Ht,P),document.removeEventListener("touchend",fn,P),document.removeEventListener("touchcancel",sn,P)})}const ji=P=>{P.preventDefault()};F.addEventListener("contextmenu",ji),qt.push(()=>{F.removeEventListener("contextmenu",ji)});const Va=new ResizeObserver(()=>{me()});Va.observe(F);const Qn=()=>{me()},da=()=>{var P,oe;if(document.visibilityState==="visible"){Te(10);try{(oe=f.current)==null||oe.refresh(0,Math.max(0,(((P=f.current)==null?void 0:P.rows)||1)-1))}catch{}}};window.addEventListener("resize",Qn),window.addEventListener("orientationchange",Qn),document.addEventListener("visibilitychange",da),window.addEventListener("pageshow",da);const fa=()=>{me()};return typeof window<"u"&&window.visualViewport&&(window.visualViewport.addEventListener("resize",fa),window.visualViewport.addEventListener("scroll",fa)),()=>{var P,oe;Zn.dispose(),dn.dispose(),ao.dispose(),Ri.dispose(),zs.dispose(),Ft.dispose(),(P=wt.current)==null||P.dispose(),wt.current=null,st.current=null,an.handlePointerCancel();for(const De of qt)De();Va.disconnect(),window.removeEventListener("resize",Qn),window.removeEventListener("orientationchange",Qn),document.removeEventListener("visibilitychange",da),window.removeEventListener("pageshow",da),typeof window<"u"&&window.visualViewport&&(window.visualViewport.removeEventListener("resize",fa),window.visualViewport.removeEventListener("scroll",fa)),S.current&&(clearTimeout(S.current),S.current=null),y.current!==null&&(cancelAnimationFrame(y.current),y.current=null),x.current!==null&&(cancelAnimationFrame(x.current),x.current=null),wn(),(oe=le.textarea)==null||oe.removeEventListener("paste",Dn),F.removeEventListener("paste",Dn),ol.dispose(),O.current=null,le.dispose(),f.current=null}},[]);const _t=tl.useMemo(()=>{var F;return((F=je.find(J=>J.id===Ke))==null?void 0:F.displayName)??null},[je,Ke]);v.useEffect(()=>{xe!=="connected"&&cn(null)},[xe]),v.useEffect(()=>{Kx(i&&xe==="connected"?tn:null,_t)},[i,xe,tn,_t]),v.useEffect(()=>{const F=f.current;if(!F)return;const J=bu(o.current,Ti(),hu());F.options.fontSize=zm(pe.fontSize,J.width),F.options.fontFamily=Ym(pe.fontFamily);try{F.refresh(0,Math.max(0,F.rows-1))}catch{}Te(10)},[pe.fontSize,pe.fontFamily]),v.useEffect(()=>{const F=st.current,J=wt.current;if(!F||!J)return;const de=F.getEchoSrttMs();sp(pe.predictiveEcho,de)?J.sync(F.getVisiblePredictions()):J.clear()},[pe.predictiveEcho]);const yt=v.useRef(Ye);v.useEffect(()=>{var J,de,ae;if(yt.current===Ye)return;yt.current=Ye,(J=st.current)==null||J.reset("resetVersion"),(de=wt.current)==null||de.clear();const F=f.current;if(F)try{(ae=F.reset)==null||ae.call(F),F.clear(),F.refresh(0,Math.max(0,F.rows-1))}catch{}},[Ye]),v.useEffect(()=>{var F,J;(F=st.current)==null||F.reset("connectionState"),(J=wt.current)==null||J.clear()},[xe]),v.useEffect(()=>{const F=f.current;if(!(!F||!Oe)){F.options.theme={...Oe};try{F.refresh(0,Math.max(0,F.rows-1))}catch{}}},[Oe]),v.useEffect(()=>ke(J=>{const de=f.current;if(!de)throw new Error("terminal not ready");if(de.write(J),z){const ae=performance.now(),ye=be.current;ye.push({time:ae,bytes:J.byteLength});const le=ae-1e3;for(;ye.length>0&&ye[0].time<le;)ye.shift()}}),[ke,z]),v.useEffect(()=>{if(!i)return;Te(10);const F=f.current;if(F){try{F.refresh(0,Math.max(0,F.rows-1))}catch{}if(!k)try{F.focus()}catch{}}},[i,k,Te]),v.useEffect(()=>{xe==="disconnected"&&I()},[]);const gl=F=>{F.preventDefault()};return u.jsxs("main",{ref:Pt,className:"flex-1 w-full min-w-0 min-h-0 overflow-hidden relative flex flex-col",onContextMenu:gl,"aria-label":Be("terminal.windowAriaLabel"),children:[u.jsx("div",{id:"terminal-container",ref:o,className:"absolute inset-0 overflow-hidden cursor-text",style:{touchAction:q?"none":"auto"},tabIndex:0,onContextMenu:gl,"aria-label":Be("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%"}})})}),z&&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: ${X.state}
36
+ `,`deltaY: ${X.deltaY} lines: ${X.lines}
37
+ `,`viewportY: ${X.viewportY??"-"} focus: ${X.focused}
38
+ `,`buffer: ${X.bufferType??"-"} base: ${X.baseY??"-"} cursor: ${X.cursorY??"-"} scrollback: ${X.hasScrollback??"-"}
39
+ `,`scroll: ${X.scrollTop??"-"} / ${X.scrollHeight??"-"} (h ${X.clientHeight??"-"}) moved: ${X.moved}
40
+ `,`mode: ${X.scrollMode} calls: ${X.scrollCalls} lines: ${X.lastScrollLines??"-"} mouse: ${X.mouseTracking}
41
+ `,`event: ${X.lastInputEvent||"-"} pointer: ${X.pointerEvents} touch: ${X.touchEvents}
42
+ `,`rtt: ${Pe!==null?`${Pe}ms`:"-"} frames/s: ${Z.framesPerSec} bytes/s: ${Z.bytesPerSec} renderer: ${he??"-"}
43
+ `,`prediction: ${((sl=st.current)==null?void 0:sl.getState())??"-"} mode: ${pe.predictiveEcho} pending: ${((un=st.current)==null?void 0:un.getVisiblePredictions().length)??0} srtt: ${((rl=st.current)==null?void 0:rl.getEchoSrttMs())!==null&&((Ka=st.current)==null?void 0:Ka.getEchoSrttMs())!==void 0?`${Math.round(st.current.getEchoSrttMs())}ms`:"-"}`]}),k&&et&&ll&&(()=>{var Dn;const F=f.current;if(!F||!Pt.current)return null;const J=_a(F);if(J.cellWidth<=0||J.cellHeight<=0)return null;const de=((Dn=d.current)==null?void 0:Dn.querySelector(".xterm-screen"))||d.current;if(!de)return null;const ae=de.getBoundingClientRect(),ye=Pt.current.getBoundingClientRect(),le=et.startRow-La;if(et.endRow-La<0||le>=F.rows)return null;const Ct=ae.top-ye.top+le*J.cellHeight,Rt=ae.left-ye.left+et.startCol*J.cellWidth,pt=(et.endCol-et.startCol+1)*J.cellWidth,wn=(et.endRow-et.startRow+1)*J.cellHeight;return u.jsx("div",{"data-testid":"terminal-selection-overlay",className:"pointer-events-none absolute z-20 bg-tui-accent/35",style:{top:`${Ct}px`,left:`${Rt}px`,width:`${pt}px`,height:`${wn}px`}})})(),k&&ne&&u.jsx(Ix,{anchorPoint:ne,hasSelection:!!Gt,isController:Ae,vibrateOnKeyPress:pe.vibrateOnKeyPress,linkUrl:ne.link??null,onOpenLink:F=>{Tu(F)||$("warning",Be("clipboard.openLinkFailed"))},onCopySelection:ua,onCopyLine:Ba,onCopyScreen:Ha,onPaste:Ya,onClose:()=>{we(null),Me.current=null,Fe(null),nn.current=null,At(""),ln.current="",Ze(!1)}}),k&&u.jsx(Jx,{isOpen:Fn,onClose:()=>pl(!1),onSend:U,onSendImage:Y})]})},t0=({onPairedSuccess:r})=>{const{settings:i,updateSettings:o,connect:c,connectionState:d,stateDetail:f,addToast:p,t:m}=xt(),[b,S]=v.useState(""),[y,x]=v.useState(null),[R,E]=v.useState(!1),[k,q]=v.useState(i.wsUrl||"/ws/client"),[z,X]=v.useState(i.token||""),[Q,Z]=v.useState(i.clientId||""),te="node bin/service.js pair",he="node bin/config-tui.js",L="herdr plugin pane open --plugin herdr.remote.web --entrypoint config --placement zoomed --focus",O=Ae=>{za(Ae).then(xe=>{if(xe==="failed"){p("error",m("clipboard.copyFailed"));return}x(Ae),p("success",m("toasts.commandCopied")),setTimeout(()=>x(null),2e3)})},j=Ae=>{Ae.preventDefault();const xe=b.trim().toUpperCase();if(!xe&&!z.trim()){p("warning",m("toasts.connectionError"));return}const pe={pairCode:xe,wsUrl:k.trim()||"/ws/client",clientId:Q.trim()||i.clientId};z.trim()&&(pe.token=z.trim()),o(pe),c({pairCode:xe||void 0,token:z.trim()||void 0,wsUrl:k.trim()||"/ws/client",clientId:Q.trim()||i.clientId}),r&&r()},ee=d==="connecting"||d==="reconnecting",be=({n:Ae})=>u.jsxs("span",{"aria-hidden":"true",className:"shrink-0 font-bold text-tui-accent",children:["[",Ae,"]"]});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(Ir,{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:j,className:"grid gap-3",children:[u.jsx(en,{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(be,{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:te}),u.jsx(He,{onClick:()=>O(te),glyph:y===te?qe.check:"⧉",className:W("shrink-0",y===te&&"border-tui-ok text-tui-ok"),children:m(y===te?"common.copied":"common.copy")})]}),u.jsxs("div",{className:"space-y-0.5 text-tui-sm",children:[u.jsxs("div",{className:"flex items-center justify-between gap-2",children:[u.jsx("span",{className:"truncate text-tui-faint",children:m("onboarding.step1CopyPlugin")}),u.jsx("button",{type:"button",onClick:()=>O(L),className:"tui-focusable shrink-0 text-tui-accent underline-offset-2 hover:underline",children:m(y===L?"common.copied":"onboarding.step1CopyCli")})]}),u.jsxs("div",{className:"flex items-center justify-between gap-2",children:[u.jsx("span",{className:"truncate text-tui-faint",children:m("onboarding.step1TuiNote")}),u.jsx("code",{onClick:()=>O(he),className:"shrink-0 cursor-pointer border border-tui-border-dim px-1 text-tui-muted hover:border-tui-accent hover:text-tui-accent",title:m("common.clickToCopy"),children:he})]})]})]})}),u.jsx(en,{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(be,{n:2}),u.jsx(Vn,{type:"text",value:b,onChange:Ae=>S(Ae.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:ee,className:"py-1.5",children:ee?u.jsx(Ei,{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:()=>E(!R),"aria-expanded":R,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:R?qe.chevronDown:qe.chevronRight}),u.jsx("span",{className:"uppercase",children:m("onboarding.advancedTitle")})]}),R&&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(Vn,{id:"onboarding-token",type:"password",value:z,onChange:Ae=>X(Ae.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(Vn,{id:"onboarding-ws",type:"text",value:k,onChange:Ae=>q(Ae.target.value),placeholder:m("onboarding.wsEndpointPlaceholder")})]}),u.jsx(ka,{}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(kn,{htmlFor:"onboarding-client-id",children:m("onboarding.clientIdLabel")}),u.jsx(Vn,{id:"onboarding-client-id",type:"text",value:Q,onChange:Ae=>Z(Ae.target.value)})]})]})]})]})]})})},Ci="tui-focusable inline-flex shrink-0 select-none items-center justify-center border text-tui font-medium transition-colors",Cs="border-tui-border bg-tui-surface text-tui-text hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",n0="border-tui-accent bg-tui-accent text-tui-crust font-bold",l0="border-tui-ok bg-transparent text-tui-ok hover:bg-tui-ok hover:text-tui-crust font-bold",a0=({compact:r=!1})=>{const{sendKey:i,settings:o,updateSettings:c,isController:d,warnViewerMode:f,t:p,uploadProgress:m,uploadImage:b}=xt(),S="h-9 min-w-[2.25rem] px-2",y="h-9 w-9",x="h-9 px-2",R=v.useRef(null),E=v.useRef(null),k=v.useCallback(()=>{if(o.vibrateOnKeyPress&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(8)}catch{}},[o.vibrateOnKeyPress]),q=v.useCallback(()=>{var H;if(k(),!d){f();return}m.active||(H=R.current)==null||H.click()},[k,d,f,m.active]),z=v.useCallback(H=>{const Se=H.target.files,je=Se&&Se[0];H.target.value="",je&&b(je)},[b]),X=()=>u.jsxs(u.Fragment,{children:[u.jsx("input",{ref:R,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",className:"hidden","data-testid":"key-toolbar-file-input",onChange:z}),u.jsx("input",{ref:E,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",capture:"environment",className:"hidden","data-testid":"key-toolbar-camera-input",onChange:z})]}),Q=(H=!1)=>m.active?u.jsx("div",{"data-testid":H?"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(lx,{ratio:m.ratio,label:m.statusText,tone:m.phase==="completed"?"ok":m.phase==="error"?"bad":"accent","aria-label":m.statusText})}):null,Z=()=>{const H=m.active;return u.jsx("button",{type:"button","data-testid":"image-upload-btn",onClick:q,disabled:H,className:W(Ci,S,H?"border-tui-border-dim bg-tui-surface opacity-60 cursor-not-allowed":Cs),title:H?m.statusText:p("virtualKeyboard.uploadImageTitle"),"aria-label":p("virtualKeyboard.uploadImage"),children:u.jsx("span",{className:"font-medium",children:H?`${m.percent}%`:p("virtualKeyboard.image")})})},[te,he]=v.useState(!1),[L,O]=v.useState(!1),[j,ee]=v.useState(!1),[be,Ae]=v.useState(!1),[xe,pe]=v.useState(!1),[Re,Ye]=v.useState(!1),_=v.useCallback((H,Se=!1)=>{if(k(),!d){f();return}let je=H;Se&&(te||L||j)&&(je=Ey(H,{ctrl:te,alt:L,shift:j})),i(je),te&&he(!1),L&&O(!1),j&&ee(!1)},[d,te,L,j,i,f,k,p]);if(!o.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:[X(),Q(!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 V=o.virtualKeys&&o.virtualKeys.length>0?o.virtualKeys.filter(H=>H.enabled):Sp,$=H=>H.id==="left"?u.jsx("span",{"aria-hidden":"true",children:"←"}):H.id==="up"?u.jsx("span",{"aria-hidden":"true",children:"↑"}):H.id==="down"?u.jsx("span",{"aria-hidden":"true",children:"↓"}):H.id==="right"?u.jsx("span",{"aria-hidden":"true",children:"→"}):H.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")})]}):H.id==="drawer_chords"?u.jsx("span",{children:"^C"}):H.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:be?"▾":"▴"})]}):u.jsx("span",{children:H.label}),ze=H=>{if(k(),H.type==="modifier"){H.modifierType==="ctrl"?he(!te):H.modifierType==="alt"?O(!L):H.modifierType==="shift"?ee(!j):H.modifierType==="meta"&&_(Ee.ESC);return}if(H.type==="drawer"){H.drawerType==="fn"?(Ae(!be),pe(!1),Ye(!1)):H.drawerType==="chords"?(Ye(!Re),Ae(!1),pe(!1)):H.drawerType==="symbols"&&(pe(!xe),Ae(!1),Ye(!1));return}_(H.code,H.isPlainChar||H.type==="symbol")},I=H=>{if(H.type==="modifier"){if(H.modifierType==="ctrl")return te;if(H.modifierType==="alt")return L;if(H.modifierType==="shift")return j}if(H.type==="drawer"){if(H.drawerType==="fn")return be;if(H.drawerType==="chords")return Re;if(H.drawerType==="symbols")return xe}return!1},ke=(H,Se,je,Ke,Be="default")=>u.jsxs("button",{type:"button",onClick:()=>_(H),className:W(Ci,"h-8 gap-1.5 px-2",Be==="bad"?"border-tui-bad text-tui-bad hover:bg-tui-bad hover:text-tui-crust":Be==="warn"?"border-tui-warn text-tui-warn hover:bg-tui-warn hover:text-tui-crust":Cs),title:je,children:[u.jsx("span",{className:"font-bold",children:Se}),u.jsx("span",{className:"text-tui-sm opacity-70",children:Ke})]});return u.jsxs("div",{"data-testid":"key-toolbar",className:W("z-20 flex shrink-0 select-none flex-col border-t border-tui-border bg-tui-mantle",r?"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:[X(),Q(!1),be&&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(H=>{const Se=`F${H}`;return u.jsxs("button",{type:"button",onClick:()=>_(Ee[Se]),className:W(Ci,Cs,"h-8"),children:["F",H]},Se)})}),Re&&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:[ke(Ee.CTRL_C,"^C",p("virtualKeyboard.ctrlCTitle"),p("virtualKeyboard.badgeSigint"),"bad"),ke(Ee.CTRL_D,"^D",p("virtualKeyboard.ctrlDTitle"),p("virtualKeyboard.badgeEof")),ke(Ee.CTRL_Z,"^Z",p("virtualKeyboard.ctrlZTitle"),p("virtualKeyboard.badgeTstp"),"warn"),ke(Ee.CTRL_L,"^L",p("virtualKeyboard.ctrlLTitle"),p("virtualKeyboard.badgeClear")),ke(Ee.CTRL_R,"^R",p("virtualKeyboard.ctrlRTitle"),p("virtualKeyboard.badgeSearch")),ke(Ee.CTRL_A,"^A",p("virtualKeyboard.ctrlATitle"),p("virtualKeyboard.badgeStart")),ke(Ee.CTRL_E,"^E",p("virtualKeyboard.ctrlETitle"),p("virtualKeyboard.badgeEnd")),ke(Ee.CTRL_K,"^K",p("virtualKeyboard.ctrlKTitle"),p("virtualKeyboard.badgeKill"))]}),xe&&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(H=>u.jsx("button",{type:"button",onClick:()=>_(H,!0),className:W(Ci,Cs,"h-8 w-8 font-bold"),children:H},H))}),u.jsxs("div",{"data-testid":"key-toolbar-row",className:W("flex flex-wrap items-center justify-center gap-1",r?"px-1.5 py-1":"px-2 py-1.5"),children:[u.jsx("button",{type:"button",onClick:()=>c({toolbarVisible:!1}),className:W(Ci,y,"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:"▾"})}),V.map(H=>{const Se=I(H),je=H.id==="enter",Ke=["left","up","down","right"].includes(H.id),Be=H.type==="drawer",Pe=Nu(H,p),Oe=u.jsx("button",{type:"button",onClick:()=>ze(H),className:W(Ci,Ke?y:Be?x:S,je?l0:Se?n0:Cs),title:Pe,"aria-label":Pe,"aria-pressed":Se,children:$(H)},H.id);return je?u.jsxs(tl.Fragment,{children:[Z(),Oe]},"enter-with-image"):Oe}),!V.some(H=>H.id==="enter")&&Z()]})]})},i0=["ls -la","clear","git status","pwd","top","exit","cat"],s0=({isOpen:r,onClose:i})=>{const{sendKey:o,isController:c,warnViewerMode:d,t:f}=xt(),[p,m]=v.useState("");if(!r)return null;const b=y=>{if(y&&y.preventDefault(),!c){d();return}p.length>0?(o(p+"\r"),m("")):o("\r")},S=y=>{if(!c){d();return}o(y+"\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:i,"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:i0.map(y=>u.jsx("button",{type:"button",onClick:()=>S(y),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:y},y))}),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(Vn,{id:"virtual-keyboard-input",name:"terminal-input",type:"text",value:p,onChange:y=>m(y.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:qe.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 lo(r,i){const o=(c,d)=>i?i(c):d;switch(r){case"connected":return{label:o("connection.live","Live"),level:"ok",needsAttention:!1};case"connecting":return{label:o("connection.connecting","Connecting"),level:"warn",needsAttention:!0};case"reconnecting":return{label:o("connection.reconnecting","Reconnecting"),level:"warn",needsAttention:!0,actionLabel:o("connection.reconnectNow","Reconnect now")};case"error":return{label:o("connection.error","Error"),level:"bad",needsAttention:!0,actionLabel:o("connection.retry","Retry")};default:return{label:o("connection.offline","Offline"),level:"idle",needsAttention:!0,actionLabel:o("connection.connect","Connect")}}}const r0={connected:"ok",connecting:"warn",reconnecting:"warn",error:"bad",disconnected:"idle"},o0=({isOpen:r,onClose:i,isAddMode:o=!1})=>{const{settings:c,updateSettings:d,connect:f,disconnect:p,connectionState:m,hostId:b,addToast:S,t:y,activeProfile:x,activeProfileId:R,addProfileAndConnect:E,renameProfile:k}=xt(),[q,z]=v.useState(c.wsUrl),[X,Q]=v.useState(c.token),[Z,te]=v.useState(c.pairCode),[he,L]=v.useState(c.clientId),[O,j]=v.useState((x==null?void 0:x.displayName)||""),[ee,be]=v.useState(c.autoReconnect),[Ae,xe]=v.useState(!1);if(v.useEffect(()=>{r&&(z(c.wsUrl),Q(o?"":c.token),te(o?"":c.pairCode),L(c.clientId),j(o?"":(x==null?void 0:x.displayName)||""),be(c.autoReconnect))},[r,o,c,x]),!r)return null;const pe=V=>{V.preventDefault();const $={wsUrl:q.trim()||"/ws/client",token:X.trim(),pairCode:Z.trim().toUpperCase(),clientId:he.trim()||c.clientId,autoReconnect:ee};if(!$.token&&!$.pairCode){S("warning",y("pairing.credentialsRequired"));return}o?E({...$,displayName:O.trim()||void 0}):(d($),R&&O.trim()&&k(R,O),p(),f({wsUrl:$.wsUrl,token:$.token||void 0,pairCode:$.pairCode||void 0,clientId:$.clientId,autoReconnect:ee})),i()},Re=()=>{const V=`client-${Math.random().toString(36).substring(2,8)}`;L(V)},Ye=()=>{const V=new URL(window.location.href);V.search="",Z.trim()&&V.searchParams.set("pairCode",Z.trim().toUpperCase()),za(V.toString()).then($=>{if($==="failed"){S("error",y("clipboard.copyFailed"));return}xe(!0),S("success",y("toasts.pairingLinkCopied")),setTimeout(()=>xe(!1),2e3)})},_=r0[m]??"idle";return u.jsxs(Vu,{isOpen:r,onClose:i,title:y(o?"pairing.addTitle":"pairing.title"),subtitle:y("pairing.subtitle"),closeLabel:y("common.closeDialog"),hints:[{keys:"esc",action:y("common.close")},{keys:"⏎",action:y("pairing.saveAndConnect")}],footer:u.jsxs(u.Fragment,{children:[m==="connected"&&u.jsx(He,{variant:"danger",onClick:()=>{p(),i()},children:y("common.disconnect")}),u.jsx(He,{variant:"primary",type:"submit",form:"pairing-form",children:y("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(vn,{level:_}),u.jsx("span",{className:"text-tui-muted",children:y("common.status")}),u.jsx("span",{className:W(_==="ok"?"text-tui-ok":_==="bad"?"text-tui-bad":_==="warn"?"text-tui-warn":"text-tui-faint"),children:lo(m,y).label})]}),b&&u.jsxs("span",{className:"flex items-center gap-1.5 text-tui-muted",children:[y("common.host")," ",u.jsx("span",{className:"text-tui-text",children:b})]})]}),u.jsxs("form",{id:"pairing-form",onSubmit:pe,className:"space-y-3",children:[u.jsxs("div",{className:"space-y-1",children:[u.jsx(kn,{htmlFor:"pairing-name",children:y("pairing.displayNameLabel")}),u.jsx(Vn,{id:"pairing-name",type:"text",value:O,onChange:V=>j(V.target.value),placeholder:y("pairing.displayNamePlaceholder"),maxLength:64,autoComplete:"off"}),u.jsx("p",{className:"text-tui-sm text-tui-faint",children:y("pairing.displayNameHelp")})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(kn,{htmlFor:"pairing-code",hint:y("pairing.pairCodeNote"),children:y("pairing.pairCodeLabel")}),u.jsx(Vn,{id:"pairing-code",type:"text",value:Z,onChange:V=>te(V.target.value.toUpperCase()),placeholder:y("pairing.pairCodePlaceholder"),maxLength:12,className:"uppercase"}),u.jsx("p",{className:"text-tui-sm text-tui-faint",children:y("pairing.pairCodeHelp")})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(kn,{htmlFor:"pairing-token",hint:y("pairing.tokenNote"),children:y("pairing.tokenLabel")}),u.jsx(Vn,{id:"pairing-token",type:"password",value:X,onChange:V=>Q(V.target.value),placeholder:y("pairing.tokenPlaceholder")})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(kn,{htmlFor:"pairing-ws",children:y("pairing.wsUrlLabel")}),u.jsx(Vn,{id:"pairing-ws",type:"text",value:q,onChange:V=>z(V.target.value),placeholder:y("pairing.wsUrlPlaceholder")}),u.jsx("p",{className:"text-tui-sm text-tui-faint",children:y("pairing.wsUrlDefaultNote")})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(kn,{htmlFor:"pairing-client-id",children:y("pairing.clientIdLabel")}),u.jsxs("div",{className:"flex gap-2",children:[u.jsx(Vn,{id:"pairing-client-id",type:"text",value:he,onChange:V=>L(V.target.value),className:"flex-1"}),u.jsx(He,{onClick:Re,title:y("pairing.regenerateClientIdTitle"),className:"shrink-0",children:y("pairing.newIdButton")})]})]}),u.jsx("div",{className:"border-t border-tui-border-dim pt-2",children:u.jsx(ku,{checked:ee,onChange:be,label:y("pairing.autoReconnectLabel"),description:y("pairing.autoReconnectDesc")})}),u.jsx("div",{className:"border-t border-tui-border-dim pt-2",children:u.jsx(He,{onClick:Ye,block:!0,glyph:Ae?qe.check:"⧉",className:W(Ae&&"border-tui-ok text-tui-ok"),children:y("pairing.copyDirectLink")})})]})]})},c0=({isOpen:r,onClose:i})=>{const{settings:o,updateSettings:c,addToast:d,language:f,setLanguage:p,t:m}=xt(),[b,S]=v.useState("appearance"),[y,x]=v.useState(!1);if(!r)return null;const R=ju.find(L=>L.font===o.fontFamily),E=o.virtualKeys&&o.virtualKeys.length>0?o.virtualKeys:Ms(),k=()=>{const L=Tp();c({fontSize:L.fontSize,fontFamily:L.fontFamily,toolbarVisible:L.toolbarVisible,vibrateOnKeyPress:L.vibrateOnKeyPress,predictiveEcho:L.predictiveEcho,language:L.language,virtualKeys:L.virtualKeys}),d("info",m("settings.resetDefaultsToast"))},q=L=>{const O=E.map(j=>j.id===L?{...j,enabled:!j.enabled}:j);c({virtualKeys:O})},z=(L,O)=>{const j=O==="up"?L-1:L+1;if(j<0||j>=E.length)return;const ee=[...E],be=ee[L];ee[L]=ee[j],ee[j]=be,c({virtualKeys:ee})},X=L=>{if(E.some(j=>j.id===L.id)){const j=E.map(ee=>ee.id===L.id?{...ee,enabled:!0}:ee);c({virtualKeys:j})}else{const j=[...E,{...L,enabled:!0}];c({virtualKeys:j})}x(!1)},Q=L=>{const O=E.filter(j=>j.id!==L);c({virtualKeys:O})},Z=()=>{c({virtualKeys:Ms()}),d("info",m("toasts.keyLayoutReset"))},te=10,he=24;return u.jsxs(Vu,{isOpen:r,onClose:i,title:m("settings.title"),subtitle:m("settings.subtitle"),closeLabel:m("common.closeDialog"),size:"lg",hints:[{keys:"esc",action:m("common.close")}],footer:u.jsxs(u.Fragment,{children:[u.jsx(He,{variant:"ghost",onClick:k,children:m("settings.resetDefaults")}),u.jsx(He,{variant:"primary",onClick:i,children:m("common.done")})]}),children:[u.jsx(Ku,{tabs:[{id:"appearance",label:m("settings.tabAppearance"),index:1},{id:"virtualKeys",label:m("settings.tabVirtualKeys"),index:2}],activeId:b,onSelect:L=>S(L),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(Ss,{name:"ui-language",checked:f==="zh",onChange:()=>p("zh"),label:"简体中文"}),u.jsx(Ss,{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(Gu,{id:"terminal-font-select",value:o.fontFamily,onChange:L=>c({fontFamily:L.target.value}),"aria-label":m("settings.fontFamilyLabel"),children:[!R&&u.jsx("option",{value:o.fontFamily,children:o.fontFamily}),ju.map(L=>u.jsx("option",{value:L.font,children:m(`fontPresets.${L.id}`)||L.name},L.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:o.fontFamily,fontSize:`${o.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:o.fontSize})}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(tx,{value:(o.fontSize-te)/(he-te),width:24,className:"hidden shrink-0 sm:inline-flex"}),u.jsx("input",{id:"terminal-font-size",type:"range",min:te,max:he,step:1,value:o.fontSize,onChange:L=>c({fontSize:Number(L.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(ka,{}),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(Ss,{name:"predictive-echo",checked:o.predictiveEcho==="auto",onChange:()=>c({predictiveEcho:"auto"}),label:m("settings.predictiveEchoAuto")}),u.jsx(Ss,{name:"predictive-echo",checked:o.predictiveEcho==="always",onChange:()=>c({predictiveEcho:"always"}),label:m("settings.predictiveEchoAlways")}),u.jsx(Ss,{name:"predictive-echo",checked:o.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(ka,{}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(ku,{checked:o.toolbarVisible,onChange:L=>c({toolbarVisible:L}),label:m("settings.touchKeyToolbar"),description:m("settings.touchKeyToolbarDesc")}),u.jsx(ku,{checked:o.vibrateOnKeyPress,onChange:L=>c({vibrateOnKeyPress:L}),label:m("settings.touchHaptics"),description:m("settings.touchHapticsDesc")})]}),u.jsx(ka,{}),u.jsxs("p",{className:"text-tui-sm leading-snug text-tui-faint",children:[u.jsx("span",{"aria-hidden":"true",className:"mr-1",children:qe.arrowRight}),m("settings.colorPassthroughNote")]})]}),b==="virtualKeys"&&u.jsxs("div",{className:"space-y-3",children:[u.jsxs("div",{className:"flex items-start justify-between gap-2",children:[u.jsxs("div",{className:"min-w-0",children:[u.jsx("h3",{className:"text-tui font-bold uppercase text-tui-accent",children:m("virtualKeyboard.customizeTitle")}),u.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:m("virtualKeyboard.customizeDesc")})]}),u.jsx(He,{variant:"ghost",onClick:Z,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:E.map((L,O)=>u.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-tui-border-dim px-2 py-1 last:border-b-0 hover:bg-tui-selection",children:[u.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[u.jsx("input",{type:"checkbox",checked:L.enabled,onChange:()=>q(L.id),className:"sr-only",id:`toggle-${L.id}`}),u.jsx("label",{htmlFor:`toggle-${L.id}`,className:W("shrink-0 cursor-pointer select-none font-bold",L.enabled?"text-tui-ok":"text-tui-faint"),"aria-hidden":"true",children:L.enabled?"[x]":"[ ]"}),u.jsx(ax,{className:W(!L.enabled&&"opacity-50"),children:L.label}),u.jsx("span",{className:"truncate text-tui-sm text-tui-muted",children:Nu(L,m)})]}),u.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[u.jsx(He,{variant:"ghost",brackets:!1,disabled:O===0,onClick:()=>z(O,"up"),title:m("virtualKeyboard.moveUp"),"aria-label":m("virtualKeyboard.moveUp"),className:"px-1",children:"↑"}),u.jsx(He,{variant:"ghost",brackets:!1,disabled:O===E.length-1,onClick:()=>z(O,"down"),title:m("virtualKeyboard.moveDown"),"aria-label":m("virtualKeyboard.moveDown"),className:"px-1",children:"↓"}),u.jsx(He,{variant:"ghost",brackets:!1,onClick:()=>Q(L.id),title:m("virtualKeyboard.deleteKeyTitle"),"aria-label":m("virtualKeyboard.deleteKeyTitle"),className:"px-1 text-tui-bad hover:text-tui-bad",children:qe.cross})]})]},L.id))}),u.jsx(He,{block:!0,glyph:"+",onClick:()=>x(!y),className:"border-dashed",children:m("virtualKeyboard.addKey")}),y&&u.jsxs("div",{className:"space-y-2 border border-tui-border bg-tui-mantle p-2",children:[u.jsx(ka,{label:m("virtualKeyboard.availableKeys")}),u.jsx("div",{className:"flex max-h-48 flex-wrap gap-1 overflow-y-auto",children:By.map(L=>{const O=E.some(j=>j.id===L.id);return u.jsxs("button",{type:"button",onClick:()=>X(L),title:Nu(L,m),className:W("tui-focusable flex select-none items-center gap-1 border px-1.5 py-0.5 text-tui-sm transition-colors",O?"border-tui-border-dim text-tui-faint":"border-tui-border text-tui-text hover:border-tui-accent hover:text-tui-accent"),children:[u.jsx("span",{children:L.label}),u.jsx("span",{"aria-hidden":"true",className:O?"text-tui-ok":"text-tui-accent",children:O?qe.check:"+"})]},L.id)})})]})]})]})},u0={success:"ok",warning:"warn",error:"bad",info:"accent"},d0={success:qe.check,warning:qe.warn,error:qe.cross,info:"›"},f0=()=>{const{toasts:r,removeToast:i,t:o}=xt();return r.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:r.map(c=>{const d=u0[c.type];return u.jsxs("div",{className:W("pointer-events-auto flex items-start gap-2 border border-tui-border border-l-2 bg-tui-base px-2 py-1 text-tui",qn[d].edgeL),role:"alert",children:[u.jsx("span",{"aria-hidden":"true",className:W("shrink-0 font-bold",qn[d].text),children:d0[c.type]}),u.jsx("div",{className:"min-w-0 flex-1 break-words leading-snug text-tui-text",children:c.message}),c.count>1&&u.jsxs("span",{className:"shrink-0 border border-tui-border-dim px-1 text-tui-sm text-tui-muted","aria-label":`×${c.count}`,children:["×",c.count]}),u.jsx("button",{type:"button",onClick:()=>i(c.id),className:"tui-focusable shrink-0 select-none px-0.5 text-tui-faint transition-colors hover:text-tui-bad","aria-label":o("common.dismissNotification"),children:u.jsx("span",{"aria-hidden":"true",children:qe.cross})})]},c.id)})})},h0=[{status:"blocked",level:"warn"},{status:"done",level:"ok"},{status:"working",level:"accent"}],lg=({className:r,compact:i=!1})=>{const{agentStatus:o,t:c}=xt();if(!o)return null;const d=h0.map(({status:p,level:m})=>{var b;return{status:p,level:m,count:((b=o.counts)==null?void 0:b[p])??0}}).filter(p=>p.count>0),f=i?d.slice(0,1):d;return f.length===0?o.total===0?null:u.jsxs("span",{"data-testid":"agent-status-chip",className:W("flex shrink-0 items-center gap-1 px-1 text-tui-muted",r),title:c("agents.title"),children:[u.jsx(vn,{level:"idle"}),u.jsx("span",{className:"text-tui-faint",children:c("agents.allIdle")})]}):u.jsx("span",{"data-testid":"agent-status-chip",className:W("flex shrink-0 items-center gap-2 px-1",r),title:c("agents.title"),children:f.map(({status:p,level:m,count:b})=>u.jsxs("span",{className:"flex items-center gap-1 text-tui-muted",children:[u.jsx(vn,{level:m}),u.jsx("span",{className:"text-tui-text",children:b}),u.jsx("span",{className:"text-tui-faint",children:c(`agents.${p}`)})]},p))})},Fu=({onAddProfile:r,mobile:i=!1,statusBar:o=!1})=>{const{profiles:c,activeProfileId:d,activeProfile:f,connectionState:p,switchProfile:m,renameProfile:b,removeProfile:S,t:y}=xt(),[x,R]=v.useState(!1),[E,k]=v.useState(null),[q,z]=v.useState(""),X=v.useRef(null);v.useEffect(()=>{if(!x)return;const O=j=>{X.current&&!X.current.contains(j.target)&&R(!1)};return document.addEventListener("pointerdown",O),()=>document.removeEventListener("pointerdown",O)},[x]);const Q=(O,j)=>{k(O),z(j)},Z=O=>{const j=q.trim();j&&b(O,j),k(null)},te=O=>{typeof window<"u"&&!window.confirm(y("profiles.removeConfirm"))||(S(O),k(null))},he=(f==null?void 0:f.displayName)||y("profiles.addHost"),L=p==="connected"?"ok":p==="connecting"||p==="reconnecting"?"warn":p==="error"?"bad":"idle";return u.jsxs("div",{ref:X,className:W("relative min-w-0",i&&"w-full",o&&"flex-1"),children:[u.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":x,"aria-label":y("profiles.switcherLabel"),onClick:()=>R(O=>!O),className:W("tui-focusable flex min-w-0 items-center gap-1.5 border border-transparent text-left text-tui-muted transition-colors hover:border-tui-border hover:text-tui-accent",o?"min-h-11 w-full max-w-none px-2":i?"min-h-11 w-full px-2":"min-h-[24px] max-w-[18rem] px-1"),children:[u.jsx(vn,{level:L}),u.jsx("span",{className:W("truncate text-tui-text",o&&"min-w-0 flex-1"),children:he}),u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint",children:x?qe.chevronDown:qe.chevronRight})]}),x&&u.jsxs("div",{role:"menu","aria-label":y("profiles.switcherLabel"),className:W("absolute bottom-full left-0 z-[100] mb-1 max-h-[min(70vh,24rem)] overflow-y-auto border border-tui-border bg-tui-base p-1 shadow-lg",o?"w-80 max-w-[calc(100vw-1rem)]":i?"inset-x-0 bottom-auto top-full mt-1 mb-0 w-full":"w-80 max-w-[calc(100vw-1rem)]"),children:[u.jsx("div",{className:"border-b border-tui-border-dim px-2 py-1 text-tui-sm uppercase text-tui-faint",children:y("profiles.title")}),c.length===0?u.jsx("p",{className:"px-2 py-2 text-tui-sm text-tui-muted",children:y("profiles.empty")}):c.map(O=>{const j=O.id===d,ee=O.id===E;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":j?"true":void 0,onClick:()=>{m(O.id),R(!1)},className:W("tui-focusable flex min-h-11 min-w-0 flex-1 items-center gap-2 px-2 text-left text-tui transition-colors hover:bg-tui-selection",j?"text-tui-accent":"text-tui-text"),children:[u.jsx("span",{"aria-hidden":"true",className:"w-3 shrink-0",children:j?qe.cursor:""}),u.jsxs("span",{className:"min-w-0 flex-1",children:[u.jsx("span",{className:"block truncate font-bold",children:O.displayName}),u.jsx("span",{className:"block truncate text-tui-sm text-tui-faint",title:O.hostname||O.hostId,children:O.hostname||O.hostId||O.wsUrl})]}),j&&u.jsx("span",{className:"shrink-0 text-tui-sm text-tui-ok",children:y("profiles.current")})]}),u.jsx("button",{type:"button",role:"menuitem","aria-label":y("profiles.rename"),title:y("profiles.rename"),onClick:()=>Q(O.id,O.displayName),className:"tui-focusable min-h-11 min-w-11 px-2 text-tui-muted hover:text-tui-accent",children:qe.ellipsis})]}),ee&&u.jsxs("div",{className:"flex items-center gap-1 px-2 pb-2",children:[u.jsx("input",{autoFocus:!0,value:q,maxLength:64,onChange:be=>z(be.target.value),onKeyDown:be=>{be.key==="Enter"&&Z(O.id),be.key==="Escape"&&k(null)},"aria-label":y("profiles.rename"),className:"tui-input min-w-0 flex-1 px-2 py-1 text-tui"}),u.jsx(He,{onClick:()=>Z(O.id),variant:"primary",className:"min-h-11",children:y("common.save")}),u.jsx(He,{onClick:()=>te(O.id),variant:"danger",className:"min-h-11",children:y("profiles.remove")})]})]},O.id)}),u.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{R(!1),r()},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:y("profiles.addHost")})]})]})]})},m0=({onAddProfile:r=()=>{}})=>{const{connectionState:i,role:o,hostId:c,assignedClientId:d,sharedWindowCount:f,settings:p,rttMs:m,t:b}=xt(),S=lo(i,b),y=i==="connected";return u.jsx(Ip,{left:u.jsxs(u.Fragment,{children:[u.jsx(Fu,{onAddProfile:r}),u.jsx(Zm,{items:[u.jsxs("span",{className:"flex items-center gap-1",children:[u.jsx(vn,{level:S.level}),u.jsx("span",{className:"text-tui-text",children:S.label})]},"status"),y?u.jsx(no,{tone:o==="controller"?"ok":"warn",children:b(o==="controller"?"role.sharedControl":"common.viewer")},"role"):null,y&&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(Zm,{items:[y?u.jsx(lg,{},"agents"):null,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")]})})},p0=[[/\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"]],g0=[[/\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 rp(r,i){for(const[o,c]of r)if(o.test(i))return c;return null}function Zu(r){const i=typeof r=="string"?r.trim():"";if(!i)return{label:"",raw:""};const o=rp(p0,i),c=rp(g0,i);return o&&c?{label:`${o} · ${c}`,raw:i}:o?{label:o,raw:i}:c?{label:c,raw:i}:{label:i.length>32?`${i.slice(0,32)}…`:i,raw:i}}function op(r){if(r===0)return"0 B";const i=1024,o=["B","KB","MB","GB"],c=Math.floor(Math.log(r)/Math.log(i));return`${(r/Math.pow(i,c)).toFixed(1)} ${o[c]}`}const b0=({clients:r})=>{const{t:i}=xt(),o=[{key:"id",header:i("admin.colClientId"),render:c=>u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(vn,{level:"ok"}),u.jsx("span",{className:"font-bold text-tui-text",children:c.id})]})},{key:"role",header:i("admin.colRole"),width:12,render:c=>{const d=c.role==="controller";return u.jsx(no,{tone:d?"ok":"warn",children:i(d?"common.controller":"common.viewer")})}},{key:"device",header:i("admin.colDevice"),render:c=>{const d=Zu(c.userAgent);return d.label?u.jsx("span",{className:"text-tui-muted",title:d.raw,children:d.label}):u.jsx("span",{className:"text-tui-faint",children:i("admin.unknownDevice")})}},{key:"ip",header:i("admin.colIp"),render:c=>u.jsx("span",{className:"text-tui-muted",children:c.ip||"127.0.0.1"})},{key:"connectedAt",header:i("admin.colConnectedAt"),render:c=>u.jsx("span",{className:"text-tui-muted",children:c.connectedAt?new Date(c.connectedAt).toLocaleTimeString():i("admin.startedRecently")})},{key:"traffic",header:i("admin.colTraffic"),align:"right",render:c=>u.jsxs("span",{className:"whitespace-nowrap",children:[u.jsx("span",{className:"text-tui-accent",children:op(c.bytesReceived||0)}),u.jsx("span",{"aria-hidden":"true",className:"mx-1 text-tui-faint",children:"/"}),u.jsx("span",{className:"text-tui-ok",children:op(c.bytesSent||0)})]})}];return u.jsx(en,{title:i("admin.connectedClientsTitle",{count:r.length}),bodyClassName:"-mx-1",children:u.jsx(qu,{columns:o,items:r,rowKey:c=>c.id,empty:i("admin.noClients")})})},cp={online:"ok",busy:"ok",reconnecting:"warn",offline:"idle"};function y0(r=[],i=[]){const o=new Map;for(const f of i){if(!(f!=null&&f.hostId))continue;const p=o.get(f.hostId);p?p.push(f):o.set(f.hostId,[f])}const c=r.map(f=>{const p=o.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 o)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 v0=({hosts:r,devices:i})=>{const{t:o}=xt(),c=y0(r,i),d={online:o("admin.hostStatusOnline"),busy:o("admin.hostStatusBusy"),reconnecting:o("admin.hostStatusReconnecting"),offline:o("admin.hostStatusOffline")};return u.jsx(en,{title:o("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:o("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(vn,{level:cp[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(no,{tone:cp[f.status],children:d[f.status]}),u.jsx("span",{className:"text-tui-accent",children:o("admin.hostConnectedDevices",{count:f.connectedDeviceCount})}),u.jsx("span",{className:"text-tui-muted",children:o("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=Zu(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||o("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?o("admin.hostRosterOperatorOnly"):o("admin.noDevices")})]},f.id))})},x0=({ptys:r})=>{const{t:i}=xt(),o=[{key:"id",header:i("admin.colPtyId"),render:c=>u.jsx("span",{className:"font-bold text-tui-accent",children:c.id})},{key:"pid",header:i("admin.colPid"),width:9,render:c=>u.jsx("span",{className:"text-tui-muted",children:c.pid})},{key:"command",header:i("admin.colCommand"),render:c=>u.jsx("code",{className:"border border-tui-border-dim bg-tui-mantle px-1 text-tui-text",children:c.command})},{key:"grid",header:i("admin.colGrid"),width:11,render:c=>u.jsxs("span",{className:"whitespace-nowrap text-tui-muted",children:[c.cols,u.jsx("span",{"aria-hidden":"true",className:"mx-0.5 text-tui-faint",children:"×"}),c.rows]})},{key:"cwd",header:i("admin.colCwd"),className:"max-w-xs truncate",render:c=>u.jsx("span",{className:"text-tui-muted",children:c.cwd||"~"})},{key:"viewers",header:i("admin.colViewers"),align:"right",width:9,render:c=>u.jsx("span",{className:"font-bold text-tui-ok",children:c.activeClients})}];return u.jsx(en,{title:i("admin.activePtysTitle",{count:r.length}),bodyClassName:"-mx-1",children:u.jsx(qu,{columns:o,items:r,rowKey:c=>c.id,empty:i("admin.noPtys")})})};function S0(r){if(!r)return"—";const i=new Date(r);return Number.isNaN(i.getTime())?"—":i.toLocaleString()}const w0=({devices:r,onRevoke:i})=>{const{t:o}=xt(),[c,d]=v.useState(null),[f,p]=v.useState(null),m=async S=>{if(c!==S){d(S);return}p(S);try{await i(S)}finally{p(null),d(null)}},b=[{key:"device",header:o("admin.colDevice"),render:S=>{const y=Zu(S.userAgent);return u.jsx("span",{className:"text-tui-text",title:y.raw,children:y.label||o("admin.unknownDevice")})}},{key:"deviceId",header:o("admin.colDeviceId"),render:S=>u.jsx("span",{className:"text-tui-muted",children:S.deviceId})},{key:"ip",header:o("admin.colIp"),render:S=>u.jsx("span",{className:"text-tui-muted",children:S.lastIp||"—"})},{key:"lastSeen",header:o("admin.colLastSeen"),render:S=>u.jsx("span",{className:"whitespace-nowrap text-tui-muted",children:S0(S.lastSeenAt)})},{key:"actions",header:o("admin.colActions"),align:"right",render:S=>{const y=c===S.deviceId,x=f===S.deviceId;return u.jsx(He,{variant:"danger",disabled:x,onClick:()=>void m(S.deviceId),onBlur:()=>d(R=>R===S.deviceId?null:R),"aria-label":o("admin.revokeDevice"),className:y?"bg-tui-bad text-tui-crust":void 0,children:x?u.jsx(Ei,{}):o(y?"admin.revokeConfirm":"admin.revokeDevice")})}}];return u.jsx(en,{title:o("admin.pairedDevicesTitle",{count:r.length}),bodyClassName:"-mx-1",children:u.jsx(qu,{columns:b,items:r,rowKey:S=>S.deviceId,empty:o("admin.noDevices")})})};function ag(r){if(typeof window>"u"||!r||r.startsWith("/"))return"";try{const i=new URL(r.replace(/^ws/,"http")),o=i.pathname.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"");return i.origin===window.location.origin&&!o?"":`${i.origin}${o}`}catch{return""}}function Ts(r,i){const o=ag(r);return o?`${o}${i.startsWith("/")?i:`/${i}`}`:i}const C0=({onBackToTerminal:r,onOpenPairing:i})=>{var Ve,nt,Xe,Et,ft,Xt,on,nl,St,st,wt,tn,cn,Pt;const{settings:o,updateSettings:c,addToast:d,t:f}=xt(),p=ag(o.wsUrl)||(typeof window<"u"?window.location.origin:"local"),m=((Ve=o.adminTokens)==null?void 0:Ve[p])||(p===(typeof window<"u"?window.location.origin:"local")?o.adminToken:"")||"",[b,S]=v.useState(null),[y,x]=v.useState(null),[R,E]=v.useState(!1),[k,q]=v.useState(!0),[z,X]=v.useState(null),[Q,Z]=v.useState(!1),[te,he]=v.useState(3e3),[L,O]=v.useState(null),[j,ee]=v.useState("overview"),[be,Ae]=v.useState(!1),[xe,pe]=v.useState(m),[Re,Ye]=v.useState(!!m),_="node bin/service.js pair";v.useEffect(()=>{pe(m),Ye(!!m),S(null),x(null),E(!1)},[p]);const V=()=>{za(_).then(ne=>{if(ne==="failed"){d("error",f("clipboard.copyFailed"));return}Ae(!0),d("success",f("toasts.commandCopied")),setTimeout(()=>Ae(!1),2e3)})};v.useEffect(()=>{let ne=!0;q(!0);async function we(){try{const Me=await fetch(Ts(o.wsUrl,"/api/info"),{headers:{Accept:"application/json"}});if(Me.ok){const et=await Me.json();ne&&(x(et),E(!0));return}}catch{}if(ne){const Me=!!(o.wsUrl&&!o.wsUrl.startsWith("/")&&!o.wsUrl.includes("localhost")&&!o.wsUrl.includes("127.0.0.1")&&typeof window<"u"&&!o.wsUrl.startsWith(window.location.origin.replace("http","ws")));x({ok:!0,version:"0.1.0",protocol:1,relayMode:Me?"remote":"local",adminConfigured:!1,adminPath:"/admin",adminStatusPath:"/api/admin/status"}),E(!0)}}return we(),()=>{ne=!1}},[o.wsUrl,p]);const $=(y==null?void 0:y.relayMode)==="remote",ze=()=>{if(y!=null&&y.adminPath)return y.publicUrl?`${y.publicUrl.replace(/\/$/,"")}${y.adminPath}`:Ts(o.wsUrl,y.adminPath);if(b!=null&&b.remoteAdminUrl)return b.remoteAdminUrl;if(o.wsUrl)try{return Ts(o.wsUrl,"/admin")}catch{}return"/admin"},I=v.useCallback(async()=>{if(R){if($){if(!Re&&!xe){S(null),q(!1),X(null),Z(!1);return}try{q(!0);const ne=Ts(o.wsUrl,(y==null?void 0:y.adminStatusPath)||"/api/admin/status"),Me=await fetch(ne,{headers:{Accept:"application/json","X-Relay-Admin-Token":xe}});if(Me.status===401||Me.status===403){Z(!0),X(f("admin.relayAdminAuthError")),S(null);return}if(!Me.ok)throw new Error(`HTTP ${Me.status}: ${Me.statusText}`);const et=await Me.json();S(et),X(null),Z(!1),O(new Date)}catch(ne){console.warn("GET /api/admin/status request failed:",ne),Z(!1),X(ne instanceof Error?ne.message:"Failed to fetch remote admin status"),S(null)}finally{q(!1)}return}try{q(!0);const ne={Accept:"application/json"};o.token&&(ne.Authorization=`Bearer ${o.token}`);const we=await fetch("/api/status",{headers:ne});if(we.status===401||we.status===403){Z(!0),X(`Authentication failed (HTTP ${we.status}): Access denied. Please configure an authorized token or pair with the host.`),S(null);return}if(!we.ok)throw new Error(`HTTP ${we.status}: ${we.statusText}`);const Me=await we.json();S(Me),X(null),Z(!1),O(new Date)}catch(ne){console.warn("GET /api/status request failed:",ne),Z(!1),X(ne instanceof Error?ne.message:"Failed to fetch status"),S(null)}finally{q(!1)}}},[R,$,Re,xe,y,o.token,o.wsUrl,p,f]),ke=v.useCallback(async ne=>{try{if(!(await fetch(Ts(o.wsUrl,`/api/admin/devices/${encodeURIComponent(ne)}`),{method:"DELETE",headers:{Accept:"application/json","X-Relay-Admin-Token":xe}})).ok){X(f("admin.revokeFailed"));return}await I()}catch{X(f("admin.revokeFailed"))}},[xe,I,o.wsUrl,f]);v.useEffect(()=>{if(!R)return;I();let ne=null;const we=()=>{te>0&&!ne&&(ne=setInterval(()=>{document.visibilityState==="visible"&&I()},te))},Me=()=>{ne&&(clearInterval(ne),ne=null)},et=()=>{document.visibilityState==="visible"?(I(),we()):Me()};return we(),document.addEventListener("visibilitychange",et),()=>{Me(),document.removeEventListener("visibilitychange",et)}},[R,I,te]);const H=ne=>{ne.preventDefault();const we=xe.trim();c({adminToken:we,adminTokens:{...o.adminTokens||{},[p]:we}}),Ye(!!we)},Se=ne=>{const we=Math.max(0,Math.floor(ne)),Me=Math.floor(we/86400),et=Math.floor(we%86400/3600),Fe=Math.floor(we%3600/60),nn=we%60,Gt=(At,ln)=>`${At}${f(`admin.unit${ln}`)}`;return Me>0?[Gt(Me,"Day"),Gt(et,"Hour"),Gt(Fe,"Minute")].join(" "):et>0?[Gt(et,"Hour"),Gt(Fe,"Minute"),Gt(nn,"Second")].join(" "):[Gt(Fe,"Minute"),Gt(nn,"Second")].join(" ")},je=ne=>{if(!ne||ne===0)return"0 B";const we=1024,Me=["B","KB","MB","GB"],et=Math.floor(Math.log(ne)/Math.log(we));return`${(ne/Math.pow(we,et)).toFixed(1)} ${Me[et]}`},Ke=()=>{const ne=ze();window.open(ne,"_blank","noopener,noreferrer")},Be=b?b.activeUserCount??((nt=b.clients)==null?void 0:nt.length)??0:0,Pe=b?[{id:"overview",label:f("admin.tabOverview"),index:1},{id:"clients",label:f("admin.tabClients",{count:((Xe=b.clients)==null?void 0:Xe.length)||0}),index:2},{id:"ptys",label:f("admin.tabPtys",{count:((Et=b.ptys)==null?void 0:Et.length)||0}),index:3},...b.devices?[{id:"devices",label:f("admin.tabDevices",{count:b.devices.length}),index:4}]:[]]:[],Oe=Pe.map(ne=>ne.id);v.useEffect(()=>{const ne=we=>{if(we.ctrlKey||we.altKey||we.metaKey)return;const Me=we.target;if(Me instanceof HTMLInputElement||Me instanceof HTMLTextAreaElement||Me instanceof HTMLSelectElement||Me!=null&&Me.isContentEditable||document.querySelector('[role="dialog"]'))return;if(we.key==="Escape"&&r){we.preventDefault(),r();return}if(we.key.toLowerCase()==="r"){we.preventDefault(),I();return}const et=Number.parseInt(we.key,10)-1;Number.isInteger(et)&&et>=0&&et<Oe.length&&(we.preventDefault(),ee(Oe[et]))};return window.addEventListener("keydown",ne),()=>window.removeEventListener("keydown",ne)},[I,Oe.join("|")]);const $e=u.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r&&u.jsx(He,{variant:"ghost",onClick:r,title:f("admin.returnToTerminal"),"aria-label":f("admin.returnToTerminal"),glyph:qe.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",(y==null?void 0:y.version)||(b==null?void 0:b.version)||"0.1.0"]}),u.jsx(no,{tone:$?"alt":"ok",children:f($?"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(Gu,{value:te,onChange:ne=>he(Number(ne.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:I,disabled:k,title:f("admin.refreshNow"),children:k?u.jsx(Ei,{}):f("admin.refreshNow")})]});return u.jsxs(ix,{name:f("admin.title"),tagline:f("admin.subtitle"),aside:$e,tabs:Pe,activeTabId:j,onSelectTab:ne=>ee(ne),tabsAriaLabel:f("header.mainNavigationAria"),hints:[{keys:"1–4",action:f("admin.hintTabs")},{keys:"r",action:f("admin.hintRefresh")},...r?[{keys:"esc",action:f("admin.hintBack")}]:[]],footerAside:L?u.jsx("span",{className:"text-tui-faint",children:f("admin.updatedAt",{time:L.toLocaleTimeString()})}):null,bodyClassName:"space-y-3 pb-2",children:[!R&&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(Ei,{label:f("admin.loadingStatus")})}),R&&$&&!Re&&u.jsxs(en,{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(el,{label:f("admin.remoteRelayEndpoint"),labelWidth:18,children:u.jsx("code",{className:"break-all text-tui-accent",children:o.wsUrl})}),u.jsx(el,{label:f("admin.remoteRelayAdminUrl"),labelWidth:18,children:u.jsx("code",{className:"break-all text-tui-ok",children:ze()})})]}),u.jsx(ka,{}),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:()=>Ye(!0),children:f("admin.relayAdminLoginBtn")}),u.jsx(He,{variant:"primary",onClick:Ke,glyph:qe.arrowRight,children:f("admin.openRemoteAdminBtn")})]})]})]}),R&&$&&Re&&!b&&u.jsxs(en,{title:f("admin.relayAdminTitle"),bodyClassName:"space-y-2",children:[u.jsx(Ir,{tone:(y==null?void 0:y.adminConfigured)===!1?"warn":"bad",children:(y==null?void 0:y.adminConfigured)===!1?f("admin.relayAdminNotConfigured"):f("admin.relayAdminAuthError")}),u.jsxs("form",{onSubmit:H,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(Vn,{id:"relay-admin-token",type:"password",value:xe,onChange:ne=>pe(ne.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:()=>Ye(!1),children:f("common.cancel")})]})]})]}),R&&!$&&Q&&u.jsxs(en,{title:f("admin.unauthorizedTitle"),tone:"bad",bodyClassName:"space-y-2",children:[u.jsx(Ir,{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:_}),u.jsx(He,{onClick:V,glyph:be?qe.check:"⧉",className:W("shrink-0",be&&"border-tui-ok text-tui-ok"),children:f(be?"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:[i&&u.jsx(He,{variant:"primary",onClick:i,children:f("admin.enterPairCodeBtn")}),u.jsx(He,{onClick:I,children:f("admin.retryFetchBtn")})]})]}),R&&z&&!Q&&!(!$&&Q)&&u.jsx(Ir,{tone:"warn",action:u.jsx(He,{variant:"warn",onClick:I,children:f("common.retry")}),children:f("admin.errorConnecting",{error:z})}),b&&u.jsxs(u.Fragment,{children:[j==="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(en,{title:f("admin.accessPanel"),aside:Se(b.uptimeSeconds||0),bodyClassName:"space-y-0.5",children:[u.jsx(el,{label:f("admin.connectedHosts"),labelWidth:14,children:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(vn,{level:(ft=b.hosts)!=null&&ft.length?"ok":"idle"}),u.jsx("span",{className:"font-bold",children:((Xt=b.hosts)==null?void 0:Xt.length)||0})]})}),u.jsx(el,{label:f("admin.activeUsers"),labelWidth:14,children:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(vn,{level:Be?"ok":"idle"}),u.jsx("span",{className:"font-bold",children:Be}),u.jsx("span",{className:"text-tui-faint",children:f("admin.acrossWindows",{count:((on=b.clients)==null?void 0:on.length)||0})})]})}),u.jsxs(el,{label:f("admin.activePtys"),labelWidth:14,children:[u.jsx("span",{className:"font-bold",children:((nl=b.ptys)==null?void 0:nl.length)||0}),u.jsx("span",{className:"ml-1.5 text-tui-faint",children:f("admin.terminalShells")})]}),u.jsx(el,{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(en,{title:f("admin.throughput"),aside:f("admin.perSecond",{value:je(((St=b.throughput)==null?void 0:St.bytesOutPerSec)||0)}),bodyClassName:"space-y-0.5",children:[u.jsxs(el,{label:f("admin.bytesInTotal"),labelWidth:13,children:[u.jsx("span",{className:"font-bold text-tui-accent",children:je(((st=b.throughput)==null?void 0:st.bytesIn)||0)}),u.jsx("span",{className:"ml-1.5 text-tui-faint",children:f("admin.perSecond",{value:je(((wt=b.throughput)==null?void 0:wt.bytesInPerSec)||0)})})]}),u.jsxs(el,{label:f("admin.bytesOutTotal"),labelWidth:13,children:[u.jsx("span",{className:"font-bold text-tui-ok",children:je(((tn=b.throughput)==null?void 0:tn.bytesOut)||0)}),u.jsx("span",{className:"ml-1.5 text-tui-faint",children:f("admin.perSecond",{value:je(((cn=b.throughput)==null?void 0:cn.bytesOutPerSec)||0)})})]}),u.jsx(ka,{}),u.jsx(el,{label:f("admin.frameRate"),labelWidth:13,children:u.jsx("span",{className:"font-bold",children:f("admin.framesPerSecond",{count:(((Pt=b.throughput)==null?void 0:Pt.framesOutPerSec)||0).toFixed(0)})})})]})]}),u.jsx(v0,{hosts:b.hosts||[],devices:b.devices})]}),j==="clients"&&u.jsx(b0,{clients:b.clients||[]}),j==="ptys"&&u.jsx(x0,{ptys:b.ptys||[]}),j==="devices"&&u.jsx(w0,{devices:b.devices||[],onRevoke:ke})]})]})},T0=({compact:r=!1})=>{const{role:i,connectionState:o,sharedWindowCount:c,assignedClientId:d,t:f}=xt();if(!(o==="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(vn,{level:"idle"}),u.jsx("span",{children:f("common.offline")})]});const m=i==="controller",b=c>1,S=u.jsxs("div",{className:W("inline-flex min-w-0 select-none items-center gap-1.5 text-tui uppercase",m?"text-tui-ok":"text-tui-warn"),role:"status","aria-label":f(m?"role.controllerMode":"role.viewerMode"),children:[u.jsx(vn,{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 r?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(el,{label:f("role.thisWindow"),labelWidth:9,className:"text-tui-sm",children:u.jsx("span",{className:"truncate text-tui-muted",children:d})}):null]})},Ns="tui-focusable group flex h-11 w-full select-none items-center gap-2 border px-2 text-left text-tui transition-colors",Es="border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",N0="border-tui-accent bg-tui-selection text-tui-accent",As=({active:r=!1})=>u.jsx("span",{"aria-hidden":"true",className:W("shrink-0",r?"text-tui-accent":"text-tui-faint group-hover:text-tui-accent"),children:qe.cursor}),E0=({onClose:r,onNavigateAdmin:i,showAdminEntry:o=!0,onOpenPairing:c,onOpenSettings:d,onAddProfile:f=()=>{}})=>{const{connectionState:p,stateDetail:m,rttMs:b,hostId:S,settings:y,updateSettings:x,connect:R,addToast:E,language:k,setLanguage:q,t:z}=xt(),[X,Q]=tl.useState(!1),Z=lo(p,z),te=O=>()=>{var ee;const j=document.activeElement;(ee=j==null?void 0:j.blur)==null||ee.call(j),O()},he=()=>{za(y.clientId).then(O=>{if(O==="failed"){E("error",z("clipboard.copyFailed"));return}Q(!0),E("info",z("toasts.clientIdCopied",{id:y.clientId})),setTimeout(()=>Q(!1),2e3)})},L=()=>{const O=k==="zh"?"en":"zh";q(O),E("info",Bu(O,"toasts.switchedLanguage",{lang:O==="zh"?"简体中文":"English"}))};return u.jsxs("div",{className:"flex flex-col gap-3 px-3 pb-2 pt-2",children:[u.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-tui-border pb-1.5",children:[u.jsx("h2",{className:"text-tui font-bold uppercase text-tui-accent",children:z("mobile.sessionControls")}),u.jsx(He,{variant:"ghost",onClick:r,"aria-label":z("mobile.closeSessionControls"),children:"esc"})]}),u.jsx(en,{title:z("profiles.title"),tone:"accent",bodyClassName:"space-y-1",children:u.jsx(Fu,{mobile:!0,onAddProfile:f})}),u.jsxs(en,{title:z("common.status"),tone:Z.level==="ok"?"ok":Z.level==="bad"?"bad":"warn",bodyClassName:"space-y-1.5",children:[u.jsxs("div",{className:"flex items-center justify-between gap-2","aria-label":z("mobile.connectionStatusAria"),children:[u.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[u.jsx(vn,{level:Z.level}),u.jsx("span",{className:"truncate text-tui uppercase text-tui-text",children:Z.label}),p==="connected"&&b!==null&&u.jsxs("span",{className:"text-tui-sm text-tui-muted",children:[b,"ms"]})]}),Z.actionLabel&&u.jsx(He,{variant:"primary",onClick:()=>R(),className:"shrink-0",children:Z.actionLabel})]}),Z.needsAttention&&m&&u.jsx("p",{className:"text-tui-sm leading-snug text-tui-muted",children:m}),S&&u.jsx(el,{label:z("common.host"),labelWidth:9,children:S}),u.jsxs("button",{type:"button",onClick:he,className:"tui-focusable flex w-full items-baseline gap-2 text-left text-tui",title:z("header.copyClientIdTitle"),children:[u.jsx("span",{className:"shrink-0 text-tui-muted",style:{width:"9ch"},children:z("header.clientIdLabel")}),u.jsx("span",{className:"min-w-0 flex-1 truncate text-tui-text",children:y.clientId}),u.jsx("span",{"aria-hidden":"true",className:W("shrink-0",X?"text-tui-ok":"text-tui-faint"),children:X?qe.check:"⧉"})]})]}),u.jsx(en,{title:z("mobile.inputControl"),tone:"accent","aria-label":z("mobile.terminalControlAria"),children:u.jsx(T0,{})}),u.jsxs(en,{title:z("mobile.menu"),tone:"accent",bodyClassName:"flex flex-col gap-1",children:[u.jsxs("button",{type:"button",onClick:L,className:W(Ns,Es),"aria-label":z("header.languageToggleTitle"),children:[u.jsx(As,{}),u.jsx("span",{className:"truncate",children:k==="zh"?"English":"中文"})]}),u.jsxs("button",{type:"button",onClick:te(d),className:W(Ns,Es),"aria-label":z("mobile.settingsAria"),children:[u.jsx(As,{}),u.jsx("span",{className:"truncate",children:z("common.settings")})]}),u.jsxs("button",{type:"button",onClick:te(c),className:W(Ns,Es),"aria-label":z("mobile.pairingAria"),children:[u.jsx(As,{}),u.jsx("span",{className:"truncate",children:z("common.pairing")})]}),o&&u.jsxs("button",{type:"button",onClick:te(i),className:W(Ns,Es),"aria-label":z("mobile.adminAria"),children:[u.jsx(As,{}),u.jsx("span",{className:"truncate",children:z("common.admin")})]}),u.jsxs("button",{type:"button",onClick:()=>x({toolbarVisible:!y.toolbarVisible}),className:W(Ns,y.toolbarVisible?N0:Es),"aria-label":z("mobile.keybarAria"),"aria-pressed":y.toolbarVisible,children:[u.jsx(As,{active:y.toolbarVisible}),u.jsx("span",{className:"truncate",children:z("common.keyBar")}),u.jsx("span",{"aria-hidden":"true",className:"ml-auto shrink-0 text-tui-sm",children:y.toolbarVisible?"[x]":"[ ]"})]})]})]})},A0=({onAddProfile:r})=>{const{rttMs:i,t:o}=xt();return u.jsxs("footer",{"data-testid":"mobile-status-bar",role:"status","aria-label":o("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(Fu,{statusBar:!0,onAddProfile:r}),u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-border",children:"│"}),u.jsx(lg,{compact:!0}),u.jsxs("span",{className:"flex shrink-0 items-center gap-1 px-1 text-tui-muted",title:o("header.latencyTitle"),children:[u.jsx("span",{className:"text-tui-faint",children:"RTT"}),u.jsx("span",{className:W(i===null?"text-tui-faint":"text-tui-text"),children:i===null?"—":`${i}ms`})]})]})},R0=({onNavigateAdmin:r,showAdminEntry:i=!0,onOpenPairing:o,onOpenSettings:c,onAddProfile:d=()=>{}})=>{const{connectionState:f,isController:p,t:m}=xt(),[b,S]=v.useState(!1),y=v.useRef(null),x=v.useCallback(()=>S(!1),[]);v.useEffect(()=>{if(!b)return;const E=k=>{if(!(k.ctrlKey||k.altKey||k.metaKey)&&k.key==="Escape"){const q=k.target;q&&typeof q.closest=="function"&&!!q.closest("#terminal-container")||(k.stopPropagation(),k.preventDefault(),x())}};return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[b,x]),v.useEffect(()=>{var E;b&&((E=y.current)==null||E.focus({preventScroll:!0}))},[b]);const R=lo(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(Zp,{className:"shrink-0"}),u.jsx(vn,{level:R.level}),u.jsx("span",{className:"truncate uppercase",children:R.label})]}),u.jsxs("button",{type:"button","data-testid":"mobile-chrome-trigger",onClick:()=>S(!0),"aria-label":m("mobile.sessionControls"),"aria-expanded":b,"aria-haspopup":"dialog",className:W("tui-focusable pointer-events-auto flex h-9 shrink-0 select-none items-center gap-1.5 border px-2 text-tui uppercase transition-colors",R.needsAttention?"border-tui-warn text-tui-warn":p?"border-tui-border text-tui-muted":"border-tui-accent text-tui-accent"),children:[!p&&!R.needsAttention&&u.jsx("span",{className:"max-w-[8rem] truncate",children:m("common.viewer")}),u.jsx("span",{"aria-hidden":"true",className:"text-tui",children:qe.chevronDown}),u.jsx("span",{"aria-hidden":"true",children:m("mobile.menu")})]})]}),b&&u.jsxs(u.Fragment,{children:[u.jsx("div",{"data-testid":"mobile-sheet-scrim",className:"absolute inset-0 z-40 bg-tui-crust/70",onClick:x,"aria-hidden":"true"}),u.jsx("div",{ref:y,"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(E0,{onClose:x,showAdminEntry:i,onNavigateAdmin:()=>{x(),r()},onOpenPairing:()=>{x(),o()},onOpenSettings:()=>{x(),c()},onAddProfile:()=>{x(),d()}})})]}),u.jsx(A0,{onAddProfile:d})]})},ig="--app-height",sg="--keyboard-inset",j0=80;function M0(){if(typeof window>"u")return{height:768,keyboardInset:0};const r=window.innerHeight||768,i=window.visualViewport;if(i&&typeof i.height=="number"&&i.height>0){const o=r-i.height-(i.offsetTop||0),c=o>=j0?Math.round(o):0;return{height:Math.round(i.height),keyboardInset:c}}return{height:r,keyboardInset:0}}function up(r,i=M0()){return r.style.setProperty(ig,`${i.height}px`),r.style.setProperty(sg,`${i.keyboardInset}px`),i}function k0(r=typeof document<"u"?document.documentElement:null){if(!r||typeof window>"u")return()=>{};let i=null;const o=()=>{i=null,up(r)},c=()=>{if(i===null){if(typeof requestAnimationFrame!="function"){o();return}i=requestAnimationFrame(o)}};up(r);const d=window.visualViewport;return d==null||d.addEventListener("resize",c),d==null||d.addEventListener("scroll",c),window.addEventListener("resize",c),window.addEventListener("orientationchange",c),()=>{i!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(i),i=null),d==null||d.removeEventListener("resize",c),d==null||d.removeEventListener("scroll",c),window.removeEventListener("resize",c),window.removeEventListener("orientationchange",c),r.style.removeProperty(ig),r.style.removeProperty(sg)}}const _0=900;function dp(){if(typeof window>"u")return!1;const r=Ti();return r<Lu?!0:r<=_0}function z0(){const[r,i]=v.useState(dp);return v.useEffect(()=>{var d,f;const o=()=>{const p=dp();i(m=>m===p?m:p)};o();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",o),window.addEventListener("resize",o),window.addEventListener("orientationchange",o),(f=window.visualViewport)==null||f.addEventListener("resize",o),()=>{var p,m;(p=c==null?void 0:c.removeEventListener)==null||p.call(c,"change",o),window.removeEventListener("resize",o),window.removeEventListener("orientationchange",o),(m=window.visualViewport)==null||m.removeEventListener("resize",o)}},[]),r}function D0(r){const i=r.target;if(!i)return!1;if(i.id==="terminal-container"||i.id==="terminal-frame"||i.id==="terminal-surface"||i.classList.contains("xterm-helper-textarea")||i.classList.contains("xterm")||i.closest("#terminal-container")||i.closest(".xterm"))return!0;if(typeof document<"u"&&document.activeElement){const o=document.activeElement;if(o.id==="terminal-container"||o.classList.contains("xterm-helper-textarea")||o.closest("#terminal-container")||o.closest(".xterm"))return!0}return!1}function L0(r,i={}){if(typeof window>"u")return()=>{};const o=c=>{var d;c.ctrlKey||c.altKey||c.metaKey||c.key==="Escape"&&(i.isModalOpen||i.isSheetOpen)&&(D0(c)||(c.preventDefault(),c.stopPropagation(),(d=r.onCloseModals)==null||d.call(r)))};return window.addEventListener("keydown",o),()=>{window.removeEventListener("keydown",o)}}function O0(){const[r,i]=v.useState("terminal"),[o,c]=v.useState(!1),[d,f]=v.useState(!1),[p,m]=v.useState(!1),[b,S]=v.useState(!1),{updateSettings:y,settings:x,connectionState:R,stateDetail:E,stateCode:k,lastPairedAt:q}=xt(),z=z0();v.useEffect(()=>k0(),[]);const[X,Q]=v.useState(!0);v.useEffect(()=>{let pe=!1;return fetch("/api/info",{headers:{Accept:"application/json"}}).then(Re=>Re.ok?Re.json():null).then(Re=>{pe||!Re||Q(!Re.isRemoteRelay)}).catch(()=>{}),()=>{pe=!0}},[]),v.useEffect(()=>{Rp()},[]),v.useEffect(()=>{const pe=o||p||b;if(pe)return L0({onCloseModals:()=>{c(!1),m(!1),S(!1)}},{isModalOpen:pe})},[o,p,b]),v.useEffect(()=>{const pe=()=>{const Re=window.location.pathname,Ye=window.location.hash;i(Re==="/admin"||Ye==="#admin"?"admin":"terminal")};pe(),window.addEventListener("popstate",pe),window.addEventListener("hashchange",pe);try{const Re=new URL(window.location.href),Ye=Re.searchParams.get("token"),_=Re.searchParams.get("pairCode"),V=Re.searchParams.get("ws")||Re.searchParams.get("wsUrl"),$={};Ye&&($.token=Ye),_&&($.pairCode=_.toUpperCase()),V&&($.wsUrl=V),Object.keys($).length>0&&y($);let ze=!1;if(Re.searchParams.has("token")&&(Re.searchParams.delete("token"),ze=!0),Re.searchParams.has("pairCode")&&(Re.searchParams.delete("pairCode"),ze=!0),ze){const I=Re.searchParams.toString(),ke=Re.pathname+(I?`?${I}`:"")+Re.hash;window.history.replaceState({},"",ke)}}catch(Re){console.warn("Failed to parse URL query params:",Re)}return()=>{window.removeEventListener("popstate",pe),window.removeEventListener("hashchange",pe)}},[]);const Z=(pe=!1)=>{f(pe),c(!0)},te=()=>{c(!1),f(!1)},he=pe=>{i(pe),pe==="admin"?window.history.pushState({},"","/admin"):window.history.pushState({},"","/")},L=!x.token&&!x.pairCode&&R!=="connected",O=R==="error"&&(["auth_required","unauthorized","device_revoked"].includes(k||"")||/auth|unauthor|forbidden|permission|token|pair/i.test(E||"")),j=L||O,[ee,be]=v.useState(!j);v.useEffect(()=>{j||be(!0)},[j]),v.useEffect(()=>{q&&(c(!1),be(!0),i("terminal"))},[q]);const Ae=r==="terminal"&&!j,xe=pe=>({visibility:pe?"visible":"hidden",opacity:pe?1:0,pointerEvents:pe?"auto":"none",zIndex:pe?1:0});return u.jsxs("div",{"data-testid":"app-shell",style:z?{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:pe=>{pe.preventDefault(),pe.stopPropagation()},children:[!z&&u.jsx(rx,{currentView:r,onNavigate:he,showAdminEntry:X,onOpenPairing:()=>Z(!1),onOpenSettings:()=>m(!0),onToggleVirtualKeyboard:()=>S(!b),isVirtualKeyboardOpen:b}),!z&&!j&&u.jsx(ox,{}),u.jsxs("div",{className:"flex-1 min-h-0 w-full overflow-hidden relative",children:[ee&&u.jsxs("div",{"data-testid":"terminal-layer",className:`absolute ${z?"inset-x-0 top-12 bottom-11":"inset-0"} flex flex-col min-h-0 w-full overflow-hidden`,style:xe(Ae),"aria-hidden":!Ae,children:[u.jsx(e0,{isActive:Ae}),!z&&u.jsx(s0,{isOpen:b,onClose:()=>S(!1)}),u.jsx(a0,{compact:z})]}),r==="terminal"&&j&&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(t0,{onPairedSuccess:()=>{}})}),r==="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(C0,{onBackToTerminal:()=>he("terminal"),onOpenPairing:()=>Z(!1)})}),z&&Ae&&u.jsx(R0,{onNavigateAdmin:()=>he("admin"),showAdminEntry:X,onOpenPairing:()=>Z(!1),onOpenSettings:()=>m(!0),onAddProfile:()=>Z(!0)})]}),!z&&r!=="admin"&&u.jsx(m0,{onAddProfile:()=>Z(!0)}),u.jsx(o0,{isOpen:o,isAddMode:d,onClose:te}),u.jsx(c0,{isOpen:p,onClose:()=>m(!1)}),u.jsx(f0,{})]})}function U0(){return u.jsx(sv,{children:u.jsx(O0,{})})}const rg=document.getElementById("root");if(!rg)throw new Error("Root element not found");wy.createRoot(rg).render(u.jsx(tl.StrictMode,{children:u.jsx(U0,{})}));