herdr-remote-relay 0.3.4 → 0.3.6

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,45 @@
1
+ var ev=Object.defineProperty;var tv=(r,a,i)=>a in r?ev(r,a,{enumerable:!0,configurable:!0,writable:!0,value:i}):r[a]=i;var de=(r,a,i)=>tv(r,typeof a!="symbol"?a+"":a,i);import{r as Vp,g as Fp,a as Xp}from"./vendor-react-CYSfZuHu.js";import{r as nv,a as lv,b as av}from"./vendor-xterm-Yo7-doCv.js";(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))o(d);new MutationObserver(d=>{for(const f of d)if(f.type==="childList")for(const m of f.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&o(m)}).observe(document,{childList:!0,subtree:!0});function i(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 o(d){if(d.ep)return;d.ep=!0;const f=i(d);fetch(d.href,f)}})();var Eu={exports:{}},Dr={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var Vm;function iv(){if(Vm)return Dr;Vm=1;var r=Symbol.for("react.transitional.element"),a=Symbol.for("react.fragment");function i(o,d,f){var m=null;if(f!==void 0&&(m=""+f),d.key!==void 0&&(m=""+d.key),"key"in d){f={};for(var p in d)p!=="key"&&(f[p]=d[p])}else f=d;return d=f.ref,{$$typeof:r,type:o,key:m,ref:d!==void 0?d:null,props:f}}return Dr.Fragment=a,Dr.jsx=i,Dr.jsxs=i,Dr}var Fm;function rv(){return Fm||(Fm=1,Eu.exports=iv()),Eu.exports}var u=rv(),x=Vp();const fl=Fp(x);var ku={exports:{}},Or={},Ru={exports:{}},ju={};/**
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 Xm;function sv(){return Xm||(Xm=1,(function(r){function a(E,B){var ee=E.length;E.push(B);e:for(;0<ee;){var ze=ee-1>>>1,Z=E[ze];if(0<d(Z,B))E[ze]=B,E[ee]=Z,ee=ze;else break e}}function i(E){return E.length===0?null:E[0]}function o(E){if(E.length===0)return null;var B=E[0],ee=E.pop();if(ee!==B){E[0]=ee;e:for(var ze=0,Z=E.length,Pe=Z>>>1;ze<Pe;){var je=2*(ze+1)-1,ue=E[je],Ge=je+1,Me=E[Ge];if(0>d(ue,ee))Ge<Z&&0>d(Me,ue)?(E[ze]=Me,E[Ge]=ee,ze=Ge):(E[ze]=ue,E[je]=ee,ze=je);else if(Ge<Z&&0>d(Me,ee))E[ze]=Me,E[Ge]=ee,ze=Ge;else break e}}return B}function d(E,B){var ee=E.sortIndex-B.sortIndex;return ee!==0?ee:E.id-B.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 m=Date,p=m.now();r.unstable_now=function(){return m.now()-p}}var g=[],v=[],y=1,w=null,T=3,R=!1,k=!1,Y=!1,z=!1,I=typeof setTimeout=="function"?setTimeout:null,P=typeof clearTimeout=="function"?clearTimeout:null,V=typeof setImmediate<"u"?setImmediate:null;function oe(E){for(var B=i(v);B!==null;){if(B.callback===null)o(v);else if(B.startTime<=E)o(v),B.sortIndex=B.expirationTime,a(g,B);else break;B=i(v)}}function ve(E){if(Y=!1,oe(E),!k)if(i(g)!==null)k=!0,ne||(ne=!0,Te());else{var B=i(v);B!==null&&Xe(ve,B.startTime-E)}}var ne=!1,X=-1,U=5,te=-1;function ae(){return z?!0:!(r.unstable_now()-te<U)}function ge(){if(z=!1,ne){var E=r.unstable_now();te=E;var B=!0;try{e:{k=!1,Y&&(Y=!1,P(X),X=-1),R=!0;var ee=T;try{t:{for(oe(E),w=i(g);w!==null&&!(w.expirationTime>E&&ae());){var ze=w.callback;if(typeof ze=="function"){w.callback=null,T=w.priorityLevel;var Z=ze(w.expirationTime<=E);if(E=r.unstable_now(),typeof Z=="function"){w.callback=Z,oe(E),B=!0;break t}w===i(g)&&o(g),oe(E)}else o(g);w=i(g)}if(w!==null)B=!0;else{var Pe=i(v);Pe!==null&&Xe(ve,Pe.startTime-E),B=!1}}break e}finally{w=null,T=ee,R=!1}B=void 0}}finally{B?Te():ne=!1}}}var Te;if(typeof V=="function")Te=function(){V(ge)};else if(typeof MessageChannel<"u"){var Oe=new MessageChannel,st=Oe.port2;Oe.port1.onmessage=ge,Te=function(){st.postMessage(null)}}else Te=function(){I(ge,0)};function Xe(E,B){X=I(function(){E(r.unstable_now())},B)}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(E){E.callback=null},r.unstable_forceFrameRate=function(E){0>E||125<E?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):U=0<E?Math.floor(1e3/E):5},r.unstable_getCurrentPriorityLevel=function(){return T},r.unstable_next=function(E){switch(T){case 1:case 2:case 3:var B=3;break;default:B=T}var ee=T;T=B;try{return E()}finally{T=ee}},r.unstable_requestPaint=function(){z=!0},r.unstable_runWithPriority=function(E,B){switch(E){case 1:case 2:case 3:case 4:case 5:break;default:E=3}var ee=T;T=E;try{return B()}finally{T=ee}},r.unstable_scheduleCallback=function(E,B,ee){var ze=r.unstable_now();switch(typeof ee=="object"&&ee!==null?(ee=ee.delay,ee=typeof ee=="number"&&0<ee?ze+ee:ze):ee=ze,E){case 1:var Z=-1;break;case 2:Z=250;break;case 5:Z=1073741823;break;case 4:Z=1e4;break;default:Z=5e3}return Z=ee+Z,E={id:y++,callback:B,priorityLevel:E,startTime:ee,expirationTime:Z,sortIndex:-1},ee>ze?(E.sortIndex=ee,a(v,E),i(g)===null&&E===i(v)&&(Y?(P(X),X=-1):Y=!0,Xe(ve,ee-ze))):(E.sortIndex=Z,a(g,E),k||R||(k=!0,ne||(ne=!0,Te()))),E},r.unstable_shouldYield=ae,r.unstable_wrapCallback=function(E){var B=T;return function(){var ee=T;T=B;try{return E.apply(this,arguments)}finally{T=ee}}}})(ju)),ju}var Im;function ov(){return Im||(Im=1,Ru.exports=sv()),Ru.exports}/**
18
+ * @license React
19
+ * react-dom-client.production.js
20
+ *
21
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */var Zm;function cv(){if(Zm)return Or;Zm=1;var r=ov(),a=Vp(),i=Xp();function o(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 m(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function p(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 g(e){if(f(e)!==e)throw Error(o(188))}function v(e){var t=e.alternate;if(!t){if(t=f(e),t===null)throw Error(o(188));return t!==e?null:e}for(var n=e,l=t;;){var s=n.return;if(s===null)break;var c=s.alternate;if(c===null){if(l=s.return,l!==null){n=l;continue}break}if(s.child===c.child){for(c=s.child;c;){if(c===n)return g(s),e;if(c===l)return g(s),t;c=c.sibling}throw Error(o(188))}if(n.return!==l.return)n=s,l=c;else{for(var h=!1,b=s.child;b;){if(b===n){h=!0,n=s,l=c;break}if(b===l){h=!0,l=s,n=c;break}b=b.sibling}if(!h){for(b=c.child;b;){if(b===n){h=!0,n=c,l=s;break}if(b===l){h=!0,l=c,n=s;break}b=b.sibling}if(!h)throw Error(o(189))}}if(n.alternate!==l)throw Error(o(190))}if(n.tag!==3)throw Error(o(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 w=Object.assign,T=Symbol.for("react.element"),R=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),Y=Symbol.for("react.fragment"),z=Symbol.for("react.strict_mode"),I=Symbol.for("react.profiler"),P=Symbol.for("react.consumer"),V=Symbol.for("react.context"),oe=Symbol.for("react.forward_ref"),ve=Symbol.for("react.suspense"),ne=Symbol.for("react.suspense_list"),X=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),te=Symbol.for("react.activity"),ae=Symbol.for("react.memo_cache_sentinel"),ge=Symbol.iterator;function Te(e){return e===null||typeof e!="object"?null:(e=ge&&e[ge]||e["@@iterator"],typeof e=="function"?e:null)}var Oe=Symbol.for("react.client.reference");function st(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Oe?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Y:return"Fragment";case I:return"Profiler";case z:return"StrictMode";case ve:return"Suspense";case ne:return"SuspenseList";case te:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case k:return"Portal";case V:return e.displayName||"Context";case P:return(e._context.displayName||"Context")+".Consumer";case oe:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case X:return t=e.displayName||null,t!==null?t:st(e.type)||"Memo";case U:t=e._payload,e=e._init;try{return st(e(t))}catch{}}return null}var Xe=Array.isArray,E=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,B=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee={pending:!1,data:null,method:null,action:null},ze=[],Z=-1;function Pe(e){return{current:e}}function je(e){0>Z||(e.current=ze[Z],ze[Z]=null,Z--)}function ue(e,t){Z++,ze[Z]=e.current,e.current=t}var Ge=Pe(null),Me=Pe(null),G=Pe(null),Ue=Pe(null);function lt(e,t){switch(ue(G,t),ue(Me,e),ue(Ge,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?hm(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=hm(t),e=mm(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}je(Ge),ue(Ge,e)}function we(){je(Ge),je(Me),je(G)}function He(e){e.memoizedState!==null&&ue(Ue,e);var t=Ge.current,n=mm(t,e.type);t!==n&&(ue(Me,e),ue(Ge,n))}function gt(e){Me.current===e&&(je(Ge),je(Me)),Ue.current===e&&(je(Ue),Mr._currentValue=ee)}var Ke,We;function at(e){if(Ke===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Ke=t&&t[1]||"",We=-1<n.stack.indexOf(`
26
+ at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
27
+ `+Ke+e+We}var wt=!1;function _t(e,t){if(!e||wt)return"";wt=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(t){var F=function(){throw Error()};if(Object.defineProperty(F.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(F,[])}catch(O){var L=O}Reflect.construct(e,[],F)}else{try{F.call()}catch(O){L=O}e.call(F.prototype)}}else{try{throw Error()}catch(O){L=O}(F=e())&&typeof F.catch=="function"&&F.catch(function(){})}}catch(O){if(O&&L&&typeof O.stack=="string")return[O.stack,L.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var s=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");s&&s.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var c=l.DetermineComponentFrameRoot(),h=c[0],b=c[1];if(h&&b){var S=h.split(`
28
+ `),_=b.split(`
29
+ `);for(s=l=0;l<S.length&&!S[l].includes("DetermineComponentFrameRoot");)l++;for(;s<_.length&&!_[s].includes("DetermineComponentFrameRoot");)s++;if(l===S.length||s===_.length)for(l=S.length-1,s=_.length-1;1<=l&&0<=s&&S[l]!==_[s];)s--;for(;1<=l&&0<=s;l--,s--)if(S[l]!==_[s]){if(l!==1||s!==1)do if(l--,s--,0>s||S[l]!==_[s]){var H=`
30
+ `+S[l].replace(" at new "," at ");return e.displayName&&H.includes("<anonymous>")&&(H=H.replace("<anonymous>",e.displayName)),H}while(1<=l&&0<=s);break}}}finally{wt=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?at(n):""}function j(e,t){switch(e.tag){case 26:case 27:case 5:return at(e.type);case 16:return at("Lazy");case 13:return e.child!==t&&t!==null?at("Suspense Fallback"):at("Suspense");case 19:return at("SuspenseList");case 0:case 15:return _t(e.type,!1);case 11:return _t(e.type.render,!1);case 1:return _t(e.type,!0);case 31:return at("Activity");default:return""}}function be(e){try{var t="",n=null;do t+=j(e,n),n=e,e=e.return;while(e);return t}catch(l){return`
31
+ Error generating stack: `+l.message+`
32
+ `+l.stack}}var pe=Object.prototype.hasOwnProperty,Je=r.unstable_scheduleCallback,bt=r.unstable_cancelCallback,ft=r.unstable_shouldYield,St=r.unstable_requestPaint,le=r.unstable_now,ke=r.unstable_getCurrentPriorityLevel,De=r.unstable_ImmediatePriority,ot=r.unstable_UserBlockingPriority,Yt=r.unstable_NormalPriority,$n=r.unstable_LowPriority,Qe=r.unstable_IdlePriority,hl=r.log,fn=r.unstable_setDisableYieldValue,Lt=null,Ct=null;function Ft(e){if(typeof hl=="function"&&fn(e),Ct&&typeof Ct.setStrictMode=="function")try{Ct.setStrictMode(Lt,e)}catch{}}var it=Math.clz32?Math.clz32:el,ai=Math.log,Mn=Math.LN2;function el(e){return e>>>=0,e===0?32:31-(ai(e)/Mn|0)|0}var kl=256,an=262144,ml=4194304;function vn(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 Rl(e,t,n){var l=e.pendingLanes;if(l===0)return 0;var s=0,c=e.suspendedLanes,h=e.pingedLanes;e=e.warmLanes;var b=l&134217727;return b!==0?(l=b&~c,l!==0?s=vn(l):(h&=b,h!==0?s=vn(h):n||(n=b&~e,n!==0&&(s=vn(n))))):(b=l&~c,b!==0?s=vn(b):h!==0?s=vn(h):n||(n=l&~e,n!==0&&(s=vn(n)))),s===0?0:t!==0&&t!==s&&(t&c)===0&&(c=s&-s,n=t&-t,c>=n||c===32&&(n&4194048)!==0)?t:s}function pl(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function tl(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 _n(){var e=ml;return ml<<=1,(ml&62914560)===0&&(ml=4194304),e}function qn(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ln(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Zi(e,t,n,l,s,c){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 b=e.entanglements,S=e.expirationTimes,_=e.hiddenUpdates;for(n=h&~n;0<n;){var H=31-it(n),F=1<<H;b[H]=0,S[H]=-1;var L=_[H];if(L!==null)for(_[H]=null,H=0;H<L.length;H++){var O=L[H];O!==null&&(O.lane&=-536870913)}n&=~F}l!==0&&La(e,l,0),c!==0&&s===0&&e.tag!==0&&(e.suspendedLanes|=c&~(h&~t))}function La(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-it(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|n&261930}function Jl(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var l=31-it(n),s=1<<l;s&t|e[l]&t&&(e[l]|=t),n&=~s}}function nl(e,t){var n=t&-t;return n=(n&42)!==0?1:$l(n),(n&(e.suspendedLanes|t))!==0?0:n}function $l(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function gl(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function jl(){var e=B.p;return e!==0?e:(e=window.event,e===void 0?32:Um(e.type))}function ii(e,t){var n=B.p;try{return B.p=e,t()}finally{B.p=n}}var xn=Math.random().toString(36).slice(2),Gt="__reactFiber$"+xn,en="__reactProps$"+xn,bl="__reactContainer$"+xn,D="__reactEvents$"+xn,K="__reactListeners$"+xn,ce="__reactHandles$"+xn,Ae="__reactResources$"+xn,Ne="__reactMarker$"+xn;function _e(e){delete e[Gt],delete e[en],delete e[D],delete e[K],delete e[ce]}function Ie(e){var t=e[Gt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[bl]||n[Gt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=wm(e);e!==null;){if(n=e[Gt])return n;e=wm(e)}return t}e=n,n=e.parentNode}return null}function Xt(e){if(e=e[Gt]||e[bl]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function kt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function wn(e){var t=e[Ae];return t||(t=e[Ae]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Tt(e){e[Ne]=!0}var Sn=new Set,za={};function yl(e,t){Ml(e,t),Ml(e+"Capture",t)}function Ml(e,t){for(za[e]=t,e=0;e<t.length;e++)Sn.add(t[e])}var Q=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]*$"),J={},Se={};function ye(e){return pe.call(Se,e)?!0:pe.call(J,e)?!1:Q.test(e)?Se[e]=!0:(J[e]=!0,!1)}function qe(e,t,n){if(ye(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 ie(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 zt(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 ht(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Wt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Dt(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 s=l.get,c=l.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(h){n=""+h,c.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 zn(e){if(!e._valueTracker){var t=Wt(e)?"checked":"value";e._valueTracker=Dt(e,t,""+e[t])}}function ll(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),l="";return e&&(l=Wt(e)?e.checked?"true":"false":e.value),e=l,e!==n?(t.setValue(e),!0):!1}function vl(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 ea=/[\n"\\]/g;function tn(e){return e.replace(ea,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Qi(e,t,n,l,s,c,h,b){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=""+ht(t)):e.value!==""+ht(t)&&(e.value=""+ht(t)):h!=="submit"&&h!=="reset"||e.removeAttribute("value"),t!=null?Pi(e,h,ht(t)):n!=null?Pi(e,h,ht(n)):l!=null&&e.removeAttribute("value"),s==null&&c!=null&&(e.defaultChecked=!!c),s!=null&&(e.checked=s&&typeof s!="function"&&typeof s!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.name=""+ht(b):e.removeAttribute("name")}function $r(e,t,n,l,s,c,h,b){if(c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"&&(e.type=c),t!=null||n!=null){if(!(c!=="submit"&&c!=="reset"||t!=null)){zn(e);return}n=n!=null?""+ht(n):"",t=t!=null?""+ht(t):n,b||t===e.value||(e.value=t),e.defaultValue=t}l=l??s,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=b?e.checked:!!l,e.defaultChecked=!!l,h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(e.name=h),zn(e)}function Pi(e,t,n){t==="number"&&vl(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function ta(e,t,n,l){if(e=e.options,t){t={};for(var s=0;s<n.length;s++)t["$"+n[s]]=!0;for(n=0;n<e.length;n++)s=t.hasOwnProperty("$"+e[n].value),e[n].selected!==s&&(e[n].selected=s),s&&l&&(e[n].defaultSelected=!0)}else{for(n=""+ht(n),t=null,s=0;s<e.length;s++){if(e[s].value===n){e[s].selected=!0,l&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function es(e,t,n){if(t!=null&&(t=""+ht(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+ht(n):""}function ts(e,t,n,l){if(t==null){if(l!=null){if(n!=null)throw Error(o(92));if(Xe(l)){if(1<l.length)throw Error(o(93));l=l[0]}n=l}n==null&&(n=""),t=n}n=ht(t),e.defaultValue=n,l=e.textContent,l===n&&l!==""&&l!==null&&(e.value=l),zn(e)}function na(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Cn=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 ns(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||Cn.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function ls(e,t,n){if(t!=null&&typeof t!="object")throw Error(o(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 s in t)l=t[s],t.hasOwnProperty(s)&&n[s]!==l&&ns(e,s,l)}else for(var c in t)t.hasOwnProperty(c)&&ns(e,c,t[c])}function _l(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 al=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"]]),as=/^[\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 Da(e){return as.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Tn(){}var la=null;function aa(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ll=null,zl=null;function W(e){var t=Xt(e);if(t&&(e=t.stateNode)){var n=e[en]||null;e:switch(e=t.stateNode,t.type){case"input":if(Qi(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="'+tn(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var l=n[t];if(l!==e&&l.form===e.form){var s=l[en]||null;if(!s)throw Error(o(90));Qi(l,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name)}}for(t=0;t<n.length;t++)l=n[t],l.form===e.form&&ll(l)}break e;case"textarea":es(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&ta(e,!!n.multiple,t,!1)}}}var se=!1;function Be(e,t,n){if(se)return e(t,n);se=!0;try{var l=e(t);return l}finally{if(se=!1,(Ll!==null||zl!==null)&&(Gs(),Ll&&(t=Ll,e=zl,zl=Ll=null,W(t),e)))for(t=0;t<e.length;t++)W(e[t])}}function At(e,t){var n=e.stateNode;if(n===null)return null;var l=n[en]||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(o(231,t,typeof n));return n}var Ot=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),hn=!1;if(Ot)try{var Ce={};Object.defineProperty(Ce,"passive",{get:function(){hn=!0}}),window.addEventListener("test",Ce,Ce),window.removeEventListener("test",Ce,Ce)}catch{hn=!1}var Ut=null,Nt=null,nn=null;function Dn(){if(nn)return nn;var e,t=Nt,n=t.length,l,s="value"in Ut?Ut.value:Ut.textContent,c=s.length;for(e=0;e<n&&t[e]===s[e];e++);var h=n-e;for(l=1;l<=h&&t[n-l]===s[c-l];l++);return nn=s.slice(e,1<l?1-l:void 0)}function mn(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 pn(){return!0}function ia(){return!1}function rn(e){function t(n,l,s,c,h){this._reactName=n,this._targetInst=s,this.type=l,this.nativeEvent=c,this.target=h,this.currentTarget=null;for(var b in e)e.hasOwnProperty(b)&&(n=e[b],this[b]=n?n(c):c[b]);return this.isDefaultPrevented=(c.defaultPrevented!=null?c.defaultPrevented:c.returnValue===!1)?pn:ia,this.isPropagationStopped=ia,this}return w(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=pn)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=pn)},persist:function(){},isPersistent:pn}),t}var xl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Oa=rn(xl),ra=w({},xl,{view:0,detail:0}),is=rn(ra),ri,si,Wi,rs=w({},ra,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:_o,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!==Wi&&(Wi&&e.type==="mousemove"?(ri=e.screenX-Wi.screenX,si=e.screenY-Wi.screenY):si=ri=0,Wi=e),ri)},movementY:function(e){return"movementY"in e?e.movementY:si}}),pd=rn(rs),$g=w({},rs,{dataTransfer:0}),eb=rn($g),tb=w({},ra,{relatedTarget:0}),Mo=rn(tb),nb=w({},xl,{animationName:0,elapsedTime:0,pseudoElement:0}),lb=rn(nb),ab=w({},xl,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),ib=rn(ab),rb=w({},xl,{data:0}),gd=rn(rb),sb={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ob={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"},cb={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ub(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=cb[e])?!!t[e]:!1}function _o(){return ub}var db=w({},ra,{key:function(e){if(e.key){var t=sb[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=mn(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?ob[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:_o,charCode:function(e){return e.type==="keypress"?mn(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?mn(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),fb=rn(db),hb=w({},rs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),bd=rn(hb),mb=w({},ra,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:_o}),pb=rn(mb),gb=w({},xl,{propertyName:0,elapsedTime:0,pseudoElement:0}),bb=rn(gb),yb=w({},rs,{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}),vb=rn(yb),xb=w({},xl,{newState:0,oldState:0}),wb=rn(xb),Sb=[9,13,27,32],Lo=Ot&&"CompositionEvent"in window,Ji=null;Ot&&"documentMode"in document&&(Ji=document.documentMode);var Cb=Ot&&"TextEvent"in window&&!Ji,yd=Ot&&(!Lo||Ji&&8<Ji&&11>=Ji),vd=" ",xd=!1;function wd(e,t){switch(e){case"keyup":return Sb.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Sd(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var oi=!1;function Tb(e,t){switch(e){case"compositionend":return Sd(t);case"keypress":return t.which!==32?null:(xd=!0,vd);case"textInput":return e=t.data,e===vd&&xd?null:e;default:return null}}function Ab(e,t){if(oi)return e==="compositionend"||!Lo&&wd(e,t)?(e=Dn(),nn=Nt=Ut=null,oi=!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 yd&&t.locale!=="ko"?null:t.data;default:return null}}var Nb={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 Cd(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Nb[e.type]:t==="textarea"}function Td(e,t,n,l){Ll?zl?zl.push(l):zl=[l]:Ll=l,t=Qs(t,"onChange"),0<t.length&&(n=new Oa("onChange","change",null,n,l),e.push({event:n,listeners:t}))}var $i=null,er=null;function Eb(e){sm(e,0)}function ss(e){var t=kt(e);if(ll(t))return e}function Ad(e,t){if(e==="change")return t}var Nd=!1;if(Ot){var zo;if(Ot){var Do="oninput"in document;if(!Do){var Ed=document.createElement("div");Ed.setAttribute("oninput","return;"),Do=typeof Ed.oninput=="function"}zo=Do}else zo=!1;Nd=zo&&(!document.documentMode||9<document.documentMode)}function kd(){$i&&($i.detachEvent("onpropertychange",Rd),er=$i=null)}function Rd(e){if(e.propertyName==="value"&&ss(er)){var t=[];Td(t,er,e,aa(e)),Be(Eb,t)}}function kb(e,t,n){e==="focusin"?(kd(),$i=t,er=n,$i.attachEvent("onpropertychange",Rd)):e==="focusout"&&kd()}function Rb(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ss(er)}function jb(e,t){if(e==="click")return ss(t)}function Mb(e,t){if(e==="input"||e==="change")return ss(t)}function _b(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var On=typeof Object.is=="function"?Object.is:_b;function tr(e,t){if(On(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 s=n[l];if(!pe.call(t,s)||!On(e[s],t[s]))return!1}return!0}function jd(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Md(e,t){var n=jd(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=jd(n)}}function _d(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?_d(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ld(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=vl(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=vl(e.document)}return t}function Oo(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 Lb=Ot&&"documentMode"in document&&11>=document.documentMode,ci=null,Uo=null,nr=null,Bo=!1;function zd(e,t,n){var l=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Bo||ci==null||ci!==vl(l)||(l=ci,"selectionStart"in l&&Oo(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}),nr&&tr(nr,l)||(nr=l,l=Qs(Uo,"onSelect"),0<l.length&&(t=new Oa("onSelect","select",null,t,n),e.push({event:t,listeners:l}),t.target=ci)))}function Ua(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var ui={animationend:Ua("Animation","AnimationEnd"),animationiteration:Ua("Animation","AnimationIteration"),animationstart:Ua("Animation","AnimationStart"),transitionrun:Ua("Transition","TransitionRun"),transitionstart:Ua("Transition","TransitionStart"),transitioncancel:Ua("Transition","TransitionCancel"),transitionend:Ua("Transition","TransitionEnd")},Ho={},Dd={};Ot&&(Dd=document.createElement("div").style,"AnimationEvent"in window||(delete ui.animationend.animation,delete ui.animationiteration.animation,delete ui.animationstart.animation),"TransitionEvent"in window||delete ui.transitionend.transition);function Ba(e){if(Ho[e])return Ho[e];if(!ui[e])return e;var t=ui[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Dd)return Ho[e]=t[n];return e}var Od=Ba("animationend"),Ud=Ba("animationiteration"),Bd=Ba("animationstart"),zb=Ba("transitionrun"),Db=Ba("transitionstart"),Ob=Ba("transitioncancel"),Hd=Ba("transitionend"),Kd=new Map,Ko="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(" ");Ko.push("scrollEnd");function il(e,t){Kd.set(e,t),yl(t,[e])}var os=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)},Vn=[],di=0,Yo=0;function cs(){for(var e=di,t=Yo=di=0;t<e;){var n=Vn[t];Vn[t++]=null;var l=Vn[t];Vn[t++]=null;var s=Vn[t];Vn[t++]=null;var c=Vn[t];if(Vn[t++]=null,l!==null&&s!==null){var h=l.pending;h===null?s.next=s:(s.next=h.next,h.next=s),l.pending=s}c!==0&&Yd(n,s,c)}}function us(e,t,n,l){Vn[di++]=e,Vn[di++]=t,Vn[di++]=n,Vn[di++]=l,Yo|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function Go(e,t,n,l){return us(e,t,n,l),ds(e)}function Ha(e,t){return us(e,null,null,t),ds(e)}function Yd(e,t,n){e.lanes|=n;var l=e.alternate;l!==null&&(l.lanes|=n);for(var s=!1,c=e.return;c!==null;)c.childLanes|=n,l=c.alternate,l!==null&&(l.childLanes|=n),c.tag===22&&(e=c.stateNode,e===null||e._visibility&1||(s=!0)),e=c,c=c.return;return e.tag===3?(c=e.stateNode,s&&t!==null&&(s=31-it(n),e=c.hiddenUpdates,l=e[s],l===null?e[s]=[t]:l.push(t),t.lane=n|536870912),c):null}function ds(e){if(50<Tr)throw Tr=0,Wc=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var fi={};function Ub(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 Un(e,t,n,l){return new Ub(e,t,n,l)}function qo(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Dl(e,t){var n=e.alternate;return n===null?(n=Un(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 Gd(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 fs(e,t,n,l,s,c){var h=0;if(l=e,typeof e=="function")qo(e)&&(h=1);else if(typeof e=="string")h=Gy(e,n,Ge.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case te:return e=Un(31,n,t,s),e.elementType=te,e.lanes=c,e;case Y:return Ka(n.children,s,c,t);case z:h=8,s|=24;break;case I:return e=Un(12,n,t,s|2),e.elementType=I,e.lanes=c,e;case ve:return e=Un(13,n,t,s),e.elementType=ve,e.lanes=c,e;case ne:return e=Un(19,n,t,s),e.elementType=ne,e.lanes=c,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case V:h=10;break e;case P:h=9;break e;case oe:h=11;break e;case X:h=14;break e;case U:h=16,l=null;break e}h=29,n=Error(o(130,e===null?"null":typeof e,"")),l=null}return t=Un(h,n,t,s),t.elementType=e,t.type=l,t.lanes=c,t}function Ka(e,t,n,l){return e=Un(7,e,l,t),e.lanes=n,e}function Vo(e,t,n){return e=Un(6,e,null,t),e.lanes=n,e}function qd(e){var t=Un(18,null,null,0);return t.stateNode=e,t}function Fo(e,t,n){return t=Un(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Vd=new WeakMap;function Fn(e,t){if(typeof e=="object"&&e!==null){var n=Vd.get(e);return n!==void 0?n:(t={value:e,source:t,stack:be(t)},Vd.set(e,t),t)}return{value:e,source:t,stack:be(t)}}var hi=[],mi=0,hs=null,lr=0,Xn=[],In=0,sa=null,wl=1,Sl="";function Ol(e,t){hi[mi++]=lr,hi[mi++]=hs,hs=e,lr=t}function Fd(e,t,n){Xn[In++]=wl,Xn[In++]=Sl,Xn[In++]=sa,sa=e;var l=wl;e=Sl;var s=32-it(l)-1;l&=~(1<<s),n+=1;var c=32-it(t)+s;if(30<c){var h=s-s%5;c=(l&(1<<h)-1).toString(32),l>>=h,s-=h,wl=1<<32-it(t)+s|n<<s|l,Sl=c+e}else wl=1<<c|n<<s|l,Sl=e}function Xo(e){e.return!==null&&(Ol(e,1),Fd(e,1,0))}function Io(e){for(;e===hs;)hs=hi[--mi],hi[mi]=null,lr=hi[--mi],hi[mi]=null;for(;e===sa;)sa=Xn[--In],Xn[In]=null,Sl=Xn[--In],Xn[In]=null,wl=Xn[--In],Xn[In]=null}function Xd(e,t){Xn[In++]=wl,Xn[In++]=Sl,Xn[In++]=sa,wl=t.id,Sl=t.overflow,sa=e}var sn=null,Rt=null,rt=!1,oa=null,Zn=!1,Zo=Error(o(519));function ca(e){var t=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ar(Fn(t,e)),Zo}function Id(e){var t=e.stateNode,n=e.type,l=e.memoizedProps;switch(t[Gt]=e,t[en]=l,n){case"dialog":et("cancel",t),et("close",t);break;case"iframe":case"object":case"embed":et("load",t);break;case"video":case"audio":for(n=0;n<Nr.length;n++)et(Nr[n],t);break;case"source":et("error",t);break;case"img":case"image":case"link":et("error",t),et("load",t);break;case"details":et("toggle",t);break;case"input":et("invalid",t),$r(t,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":et("invalid",t);break;case"textarea":et("invalid",t),ts(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||dm(t.textContent,n)?(l.popover!=null&&(et("beforetoggle",t),et("toggle",t)),l.onScroll!=null&&et("scroll",t),l.onScrollEnd!=null&&et("scrollend",t),l.onClick!=null&&(t.onclick=Tn),t=!0):t=!1,t||ca(e,!0)}function Zd(e){for(sn=e.return;sn;)switch(sn.tag){case 5:case 31:case 13:Zn=!1;return;case 27:case 3:Zn=!0;return;default:sn=sn.return}}function pi(e){if(e!==sn)return!1;if(!rt)return Zd(e),rt=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||fu(e.type,e.memoizedProps)),n=!n),n&&Rt&&ca(e),Zd(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));Rt=xm(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));Rt=xm(e)}else t===27?(t=Rt,Ca(e.type)?(e=bu,bu=null,Rt=e):Rt=t):Rt=sn?Pn(e.stateNode.nextSibling):null;return!0}function Ya(){Rt=sn=null,rt=!1}function Qo(){var e=oa;return e!==null&&(kn===null?kn=e:kn.push.apply(kn,e),oa=null),e}function ar(e){oa===null?oa=[e]:oa.push(e)}var Po=Pe(null),Ga=null,Ul=null;function ua(e,t,n){ue(Po,t._currentValue),t._currentValue=n}function Bl(e){e._currentValue=Po.current,je(Po)}function Wo(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 Jo(e,t,n,l){var s=e.child;for(s!==null&&(s.return=e);s!==null;){var c=s.dependencies;if(c!==null){var h=s.child;c=c.firstContext;e:for(;c!==null;){var b=c;c=s;for(var S=0;S<t.length;S++)if(b.context===t[S]){c.lanes|=n,b=c.alternate,b!==null&&(b.lanes|=n),Wo(c.return,n,e),l||(h=null);break e}c=b.next}}else if(s.tag===18){if(h=s.return,h===null)throw Error(o(341));h.lanes|=n,c=h.alternate,c!==null&&(c.lanes|=n),Wo(h,n,e),h=null}else h=s.child;if(h!==null)h.return=s;else for(h=s;h!==null;){if(h===e){h=null;break}if(s=h.sibling,s!==null){s.return=h.return,h=s;break}h=h.return}s=h}}function gi(e,t,n,l){e=null;for(var s=t,c=!1;s!==null;){if(!c){if((s.flags&524288)!==0)c=!0;else if((s.flags&262144)!==0)break}if(s.tag===10){var h=s.alternate;if(h===null)throw Error(o(387));if(h=h.memoizedProps,h!==null){var b=s.type;On(s.pendingProps.value,h.value)||(e!==null?e.push(b):e=[b])}}else if(s===Ue.current){if(h=s.alternate,h===null)throw Error(o(387));h.memoizedState.memoizedState!==s.memoizedState.memoizedState&&(e!==null?e.push(Mr):e=[Mr])}s=s.return}e!==null&&Jo(t,e,n,l),t.flags|=262144}function ms(e){for(e=e.firstContext;e!==null;){if(!On(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function qa(e){Ga=e,Ul=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function on(e){return Qd(Ga,e)}function ps(e,t){return Ga===null&&qa(e),Qd(e,t)}function Qd(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Ul===null){if(e===null)throw Error(o(308));Ul=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ul=Ul.next=t;return n}var Bb=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()})}},Hb=r.unstable_scheduleCallback,Kb=r.unstable_NormalPriority,It={$$typeof:V,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function $o(){return{controller:new Bb,data:new Map,refCount:0}}function ir(e){e.refCount--,e.refCount===0&&Hb(Kb,function(){e.controller.abort()})}var rr=null,ec=0,bi=0,yi=null;function Yb(e,t){if(rr===null){var n=rr=[];ec=0,bi=lu(),yi={status:"pending",value:void 0,then:function(l){n.push(l)}}}return ec++,t.then(Pd,Pd),t}function Pd(){if(--ec===0&&rr!==null){yi!==null&&(yi.status="fulfilled");var e=rr;rr=null,bi=0,yi=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Gb(e,t){var n=[],l={status:"pending",value:null,reason:null,then:function(s){n.push(s)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var s=0;s<n.length;s++)(0,n[s])(t)},function(s){for(l.status="rejected",l.reason=s,s=0;s<n.length;s++)(0,n[s])(void 0)}),l}var Wd=E.S;E.S=function(e,t){Dh=le(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&Yb(e,t),Wd!==null&&Wd(e,t)};var Va=Pe(null);function tc(){var e=Va.current;return e!==null?e:Et.pooledCache}function gs(e,t){t===null?ue(Va,Va.current):ue(Va,t.pool)}function Jd(){var e=tc();return e===null?null:{parent:It._currentValue,pool:e}}var vi=Error(o(460)),nc=Error(o(474)),bs=Error(o(542)),ys={then:function(){}};function $d(e){return e=e.status,e==="fulfilled"||e==="rejected"}function ef(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Tn,Tn),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,nf(e),e;default:if(typeof t.status=="string")t.then(Tn,Tn);else{if(e=Et,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status="pending",e.then(function(l){if(t.status==="pending"){var s=t;s.status="fulfilled",s.value=l}},function(l){if(t.status==="pending"){var s=t;s.status="rejected",s.reason=l}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,nf(e),e}throw Xa=t,vi}}function Fa(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Xa=n,vi):n}}var Xa=null;function tf(){if(Xa===null)throw Error(o(459));var e=Xa;return Xa=null,e}function nf(e){if(e===vi||e===bs)throw Error(o(483))}var xi=null,sr=0;function vs(e){var t=sr;return sr+=1,xi===null&&(xi=[]),ef(xi,e,t)}function or(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function xs(e,t){throw t.$$typeof===T?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function lf(e){function t(N,C){if(e){var M=N.deletions;M===null?(N.deletions=[C],N.flags|=16):M.push(C)}}function n(N,C){if(!e)return null;for(;C!==null;)t(N,C),C=C.sibling;return null}function l(N){for(var C=new Map;N!==null;)N.key!==null?C.set(N.key,N):C.set(N.index,N),N=N.sibling;return C}function s(N,C){return N=Dl(N,C),N.index=0,N.sibling=null,N}function c(N,C,M){return N.index=M,e?(M=N.alternate,M!==null?(M=M.index,M<C?(N.flags|=67108866,C):M):(N.flags|=67108866,C)):(N.flags|=1048576,C)}function h(N){return e&&N.alternate===null&&(N.flags|=67108866),N}function b(N,C,M,q){return C===null||C.tag!==6?(C=Vo(M,N.mode,q),C.return=N,C):(C=s(C,M),C.return=N,C)}function S(N,C,M,q){var Ee=M.type;return Ee===Y?H(N,C,M.props.children,q,M.key):C!==null&&(C.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===U&&Fa(Ee)===C.type)?(C=s(C,M.props),or(C,M),C.return=N,C):(C=fs(M.type,M.key,M.props,null,N.mode,q),or(C,M),C.return=N,C)}function _(N,C,M,q){return C===null||C.tag!==4||C.stateNode.containerInfo!==M.containerInfo||C.stateNode.implementation!==M.implementation?(C=Fo(M,N.mode,q),C.return=N,C):(C=s(C,M.children||[]),C.return=N,C)}function H(N,C,M,q,Ee){return C===null||C.tag!==7?(C=Ka(M,N.mode,q,Ee),C.return=N,C):(C=s(C,M),C.return=N,C)}function F(N,C,M){if(typeof C=="string"&&C!==""||typeof C=="number"||typeof C=="bigint")return C=Vo(""+C,N.mode,M),C.return=N,C;if(typeof C=="object"&&C!==null){switch(C.$$typeof){case R:return M=fs(C.type,C.key,C.props,null,N.mode,M),or(M,C),M.return=N,M;case k:return C=Fo(C,N.mode,M),C.return=N,C;case U:return C=Fa(C),F(N,C,M)}if(Xe(C)||Te(C))return C=Ka(C,N.mode,M,null),C.return=N,C;if(typeof C.then=="function")return F(N,vs(C),M);if(C.$$typeof===V)return F(N,ps(N,C),M);xs(N,C)}return null}function L(N,C,M,q){var Ee=C!==null?C.key:null;if(typeof M=="string"&&M!==""||typeof M=="number"||typeof M=="bigint")return Ee!==null?null:b(N,C,""+M,q);if(typeof M=="object"&&M!==null){switch(M.$$typeof){case R:return M.key===Ee?S(N,C,M,q):null;case k:return M.key===Ee?_(N,C,M,q):null;case U:return M=Fa(M),L(N,C,M,q)}if(Xe(M)||Te(M))return Ee!==null?null:H(N,C,M,q,null);if(typeof M.then=="function")return L(N,C,vs(M),q);if(M.$$typeof===V)return L(N,C,ps(N,M),q);xs(N,M)}return null}function O(N,C,M,q,Ee){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return N=N.get(M)||null,b(C,N,""+q,Ee);if(typeof q=="object"&&q!==null){switch(q.$$typeof){case R:return N=N.get(q.key===null?M:q.key)||null,S(C,N,q,Ee);case k:return N=N.get(q.key===null?M:q.key)||null,_(C,N,q,Ee);case U:return q=Fa(q),O(N,C,M,q,Ee)}if(Xe(q)||Te(q))return N=N.get(M)||null,H(C,N,q,Ee,null);if(typeof q.then=="function")return O(N,C,M,vs(q),Ee);if(q.$$typeof===V)return O(N,C,M,ps(C,q),Ee);xs(C,q)}return null}function me(N,C,M,q){for(var Ee=null,ct=null,xe=C,Ve=C=0,nt=null;xe!==null&&Ve<M.length;Ve++){xe.index>Ve?(nt=xe,xe=null):nt=xe.sibling;var ut=L(N,xe,M[Ve],q);if(ut===null){xe===null&&(xe=nt);break}e&&xe&&ut.alternate===null&&t(N,xe),C=c(ut,C,Ve),ct===null?Ee=ut:ct.sibling=ut,ct=ut,xe=nt}if(Ve===M.length)return n(N,xe),rt&&Ol(N,Ve),Ee;if(xe===null){for(;Ve<M.length;Ve++)xe=F(N,M[Ve],q),xe!==null&&(C=c(xe,C,Ve),ct===null?Ee=xe:ct.sibling=xe,ct=xe);return rt&&Ol(N,Ve),Ee}for(xe=l(xe);Ve<M.length;Ve++)nt=O(xe,N,Ve,M[Ve],q),nt!==null&&(e&&nt.alternate!==null&&xe.delete(nt.key===null?Ve:nt.key),C=c(nt,C,Ve),ct===null?Ee=nt:ct.sibling=nt,ct=nt);return e&&xe.forEach(function(ka){return t(N,ka)}),rt&&Ol(N,Ve),Ee}function Re(N,C,M,q){if(M==null)throw Error(o(151));for(var Ee=null,ct=null,xe=C,Ve=C=0,nt=null,ut=M.next();xe!==null&&!ut.done;Ve++,ut=M.next()){xe.index>Ve?(nt=xe,xe=null):nt=xe.sibling;var ka=L(N,xe,ut.value,q);if(ka===null){xe===null&&(xe=nt);break}e&&xe&&ka.alternate===null&&t(N,xe),C=c(ka,C,Ve),ct===null?Ee=ka:ct.sibling=ka,ct=ka,xe=nt}if(ut.done)return n(N,xe),rt&&Ol(N,Ve),Ee;if(xe===null){for(;!ut.done;Ve++,ut=M.next())ut=F(N,ut.value,q),ut!==null&&(C=c(ut,C,Ve),ct===null?Ee=ut:ct.sibling=ut,ct=ut);return rt&&Ol(N,Ve),Ee}for(xe=l(xe);!ut.done;Ve++,ut=M.next())ut=O(xe,N,Ve,ut.value,q),ut!==null&&(e&&ut.alternate!==null&&xe.delete(ut.key===null?Ve:ut.key),C=c(ut,C,Ve),ct===null?Ee=ut:ct.sibling=ut,ct=ut);return e&&xe.forEach(function($y){return t(N,$y)}),rt&&Ol(N,Ve),Ee}function xt(N,C,M,q){if(typeof M=="object"&&M!==null&&M.type===Y&&M.key===null&&(M=M.props.children),typeof M=="object"&&M!==null){switch(M.$$typeof){case R:e:{for(var Ee=M.key;C!==null;){if(C.key===Ee){if(Ee=M.type,Ee===Y){if(C.tag===7){n(N,C.sibling),q=s(C,M.props.children),q.return=N,N=q;break e}}else if(C.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===U&&Fa(Ee)===C.type){n(N,C.sibling),q=s(C,M.props),or(q,M),q.return=N,N=q;break e}n(N,C);break}else t(N,C);C=C.sibling}M.type===Y?(q=Ka(M.props.children,N.mode,q,M.key),q.return=N,N=q):(q=fs(M.type,M.key,M.props,null,N.mode,q),or(q,M),q.return=N,N=q)}return h(N);case k:e:{for(Ee=M.key;C!==null;){if(C.key===Ee)if(C.tag===4&&C.stateNode.containerInfo===M.containerInfo&&C.stateNode.implementation===M.implementation){n(N,C.sibling),q=s(C,M.children||[]),q.return=N,N=q;break e}else{n(N,C);break}else t(N,C);C=C.sibling}q=Fo(M,N.mode,q),q.return=N,N=q}return h(N);case U:return M=Fa(M),xt(N,C,M,q)}if(Xe(M))return me(N,C,M,q);if(Te(M)){if(Ee=Te(M),typeof Ee!="function")throw Error(o(150));return M=Ee.call(M),Re(N,C,M,q)}if(typeof M.then=="function")return xt(N,C,vs(M),q);if(M.$$typeof===V)return xt(N,C,ps(N,M),q);xs(N,M)}return typeof M=="string"&&M!==""||typeof M=="number"||typeof M=="bigint"?(M=""+M,C!==null&&C.tag===6?(n(N,C.sibling),q=s(C,M),q.return=N,N=q):(n(N,C),q=Vo(M,N.mode,q),q.return=N,N=q),h(N)):n(N,C)}return function(N,C,M,q){try{sr=0;var Ee=xt(N,C,M,q);return xi=null,Ee}catch(xe){if(xe===vi||xe===bs)throw xe;var ct=Un(29,xe,null,N.mode);return ct.lanes=q,ct.return=N,ct}finally{}}}var Ia=lf(!0),af=lf(!1),da=!1;function lc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ac(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 fa(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ha(e,t,n){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(dt&2)!==0){var s=l.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),l.pending=t,t=ds(e),Yd(e,null,n),t}return us(e,l,t,n),ds(e)}function cr(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,Jl(e,n)}}function ic(e,t){var n=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,n===l)){var s=null,c=null;if(n=n.firstBaseUpdate,n!==null){do{var h={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};c===null?s=c=h:c=c.next=h,n=n.next}while(n!==null);c===null?s=c=t:c=c.next=t}else s=c=t;n={baseState:l.baseState,firstBaseUpdate:s,lastBaseUpdate:c,shared:l.shared,callbacks:l.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var rc=!1;function ur(){if(rc){var e=yi;if(e!==null)throw e}}function dr(e,t,n,l){rc=!1;var s=e.updateQueue;da=!1;var c=s.firstBaseUpdate,h=s.lastBaseUpdate,b=s.shared.pending;if(b!==null){s.shared.pending=null;var S=b,_=S.next;S.next=null,h===null?c=_:h.next=_,h=S;var H=e.alternate;H!==null&&(H=H.updateQueue,b=H.lastBaseUpdate,b!==h&&(b===null?H.firstBaseUpdate=_:b.next=_,H.lastBaseUpdate=S))}if(c!==null){var F=s.baseState;h=0,H=_=S=null,b=c;do{var L=b.lane&-536870913,O=L!==b.lane;if(O?(tt&L)===L:(l&L)===L){L!==0&&L===bi&&(rc=!0),H!==null&&(H=H.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var me=e,Re=b;L=t;var xt=n;switch(Re.tag){case 1:if(me=Re.payload,typeof me=="function"){F=me.call(xt,F,L);break e}F=me;break e;case 3:me.flags=me.flags&-65537|128;case 0:if(me=Re.payload,L=typeof me=="function"?me.call(xt,F,L):me,L==null)break e;F=w({},F,L);break e;case 2:da=!0}}L=b.callback,L!==null&&(e.flags|=64,O&&(e.flags|=8192),O=s.callbacks,O===null?s.callbacks=[L]:O.push(L))}else O={lane:L,tag:b.tag,payload:b.payload,callback:b.callback,next:null},H===null?(_=H=O,S=F):H=H.next=O,h|=L;if(b=b.next,b===null){if(b=s.shared.pending,b===null)break;O=b,b=O.next,O.next=null,s.lastBaseUpdate=O,s.shared.pending=null}}while(!0);H===null&&(S=F),s.baseState=S,s.firstBaseUpdate=_,s.lastBaseUpdate=H,c===null&&(s.shared.lanes=0),ya|=h,e.lanes=h,e.memoizedState=F}}function rf(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function sf(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)rf(n[e],t)}var wi=Pe(null),ws=Pe(0);function of(e,t){e=Il,ue(ws,e),ue(wi,t),Il=e|t.baseLanes}function sc(){ue(ws,Il),ue(wi,wi.current)}function oc(){Il=ws.current,je(wi),je(ws)}var Bn=Pe(null),Qn=null;function ma(e){var t=e.alternate;ue(qt,qt.current&1),ue(Bn,e),Qn===null&&(t===null||wi.current!==null||t.memoizedState!==null)&&(Qn=e)}function cc(e){ue(qt,qt.current),ue(Bn,e),Qn===null&&(Qn=e)}function cf(e){e.tag===22?(ue(qt,qt.current),ue(Bn,e),Qn===null&&(Qn=e)):pa()}function pa(){ue(qt,qt.current),ue(Bn,Bn.current)}function Hn(e){je(Bn),Qn===e&&(Qn=null),je(qt)}var qt=Pe(0);function Ss(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||pu(n)||gu(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 Hl=0,Ye=null,yt=null,Zt=null,Cs=!1,Si=!1,Za=!1,Ts=0,fr=0,Ci=null,qb=0;function Ht(){throw Error(o(321))}function uc(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!On(e[n],t[n]))return!1;return!0}function dc(e,t,n,l,s,c){return Hl=c,Ye=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,E.H=e===null||e.memoizedState===null?Xf:Nc,Za=!1,c=n(l,s),Za=!1,Si&&(c=df(t,n,l,s)),uf(e),c}function uf(e){E.H=pr;var t=yt!==null&&yt.next!==null;if(Hl=0,Zt=yt=Ye=null,Cs=!1,fr=0,Ci=null,t)throw Error(o(300));e===null||Qt||(e=e.dependencies,e!==null&&ms(e)&&(Qt=!0))}function df(e,t,n,l){Ye=e;var s=0;do{if(Si&&(Ci=null),fr=0,Si=!1,25<=s)throw Error(o(301));if(s+=1,Zt=yt=null,e.updateQueue!=null){var c=e.updateQueue;c.lastEffect=null,c.events=null,c.stores=null,c.memoCache!=null&&(c.memoCache.index=0)}E.H=If,c=t(n,l)}while(Si);return c}function Vb(){var e=E.H,t=e.useState()[0];return t=typeof t.then=="function"?hr(t):t,e=e.useState()[0],(yt!==null?yt.memoizedState:null)!==e&&(Ye.flags|=1024),t}function fc(){var e=Ts!==0;return Ts=0,e}function hc(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function mc(e){if(Cs){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Cs=!1}Hl=0,Zt=yt=Ye=null,Si=!1,fr=Ts=0,Ci=null}function gn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Zt===null?Ye.memoizedState=Zt=e:Zt=Zt.next=e,Zt}function Vt(){if(yt===null){var e=Ye.alternate;e=e!==null?e.memoizedState:null}else e=yt.next;var t=Zt===null?Ye.memoizedState:Zt.next;if(t!==null)Zt=t,yt=e;else{if(e===null)throw Ye.alternate===null?Error(o(467)):Error(o(310));yt=e,e={memoizedState:yt.memoizedState,baseState:yt.baseState,baseQueue:yt.baseQueue,queue:yt.queue,next:null},Zt===null?Ye.memoizedState=Zt=e:Zt=Zt.next=e}return Zt}function As(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function hr(e){var t=fr;return fr+=1,Ci===null&&(Ci=[]),e=ef(Ci,e,t),t=Ye,(Zt===null?t.memoizedState:Zt.next)===null&&(t=t.alternate,E.H=t===null||t.memoizedState===null?Xf:Nc),e}function Ns(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return hr(e);if(e.$$typeof===V)return on(e)}throw Error(o(438,String(e)))}function pc(e){var t=null,n=Ye.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var l=Ye.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(t={data:l.data.map(function(s){return s.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=As(),Ye.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),l=0;l<e;l++)n[l]=ae;return t.index++,n}function Kl(e,t){return typeof t=="function"?t(e):t}function Es(e){var t=Vt();return gc(t,yt,e)}function gc(e,t,n){var l=e.queue;if(l===null)throw Error(o(311));l.lastRenderedReducer=n;var s=e.baseQueue,c=l.pending;if(c!==null){if(s!==null){var h=s.next;s.next=c.next,c.next=h}t.baseQueue=s=c,l.pending=null}if(c=e.baseState,s===null)e.memoizedState=c;else{t=s.next;var b=h=null,S=null,_=t,H=!1;do{var F=_.lane&-536870913;if(F!==_.lane?(tt&F)===F:(Hl&F)===F){var L=_.revertLane;if(L===0)S!==null&&(S=S.next={lane:0,revertLane:0,gesture:null,action:_.action,hasEagerState:_.hasEagerState,eagerState:_.eagerState,next:null}),F===bi&&(H=!0);else if((Hl&L)===L){_=_.next,L===bi&&(H=!0);continue}else F={lane:0,revertLane:_.revertLane,gesture:null,action:_.action,hasEagerState:_.hasEagerState,eagerState:_.eagerState,next:null},S===null?(b=S=F,h=c):S=S.next=F,Ye.lanes|=L,ya|=L;F=_.action,Za&&n(c,F),c=_.hasEagerState?_.eagerState:n(c,F)}else L={lane:F,revertLane:_.revertLane,gesture:_.gesture,action:_.action,hasEagerState:_.hasEagerState,eagerState:_.eagerState,next:null},S===null?(b=S=L,h=c):S=S.next=L,Ye.lanes|=F,ya|=F;_=_.next}while(_!==null&&_!==t);if(S===null?h=c:S.next=b,!On(c,e.memoizedState)&&(Qt=!0,H&&(n=yi,n!==null)))throw n;e.memoizedState=c,e.baseState=h,e.baseQueue=S,l.lastRenderedState=c}return s===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function bc(e){var t=Vt(),n=t.queue;if(n===null)throw Error(o(311));n.lastRenderedReducer=e;var l=n.dispatch,s=n.pending,c=t.memoizedState;if(s!==null){n.pending=null;var h=s=s.next;do c=e(c,h.action),h=h.next;while(h!==s);On(c,t.memoizedState)||(Qt=!0),t.memoizedState=c,t.baseQueue===null&&(t.baseState=c),n.lastRenderedState=c}return[c,l]}function ff(e,t,n){var l=Ye,s=Vt(),c=rt;if(c){if(n===void 0)throw Error(o(407));n=n()}else n=t();var h=!On((yt||s).memoizedState,n);if(h&&(s.memoizedState=n,Qt=!0),s=s.queue,xc(pf.bind(null,l,s,e),[e]),s.getSnapshot!==t||h||Zt!==null&&Zt.memoizedState.tag&1){if(l.flags|=2048,Ti(9,{destroy:void 0},mf.bind(null,l,s,n,t),null),Et===null)throw Error(o(349));c||(Hl&127)!==0||hf(l,t,n)}return n}function hf(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Ye.updateQueue,t===null?(t=As(),Ye.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function mf(e,t,n,l){t.value=n,t.getSnapshot=l,gf(t)&&bf(e)}function pf(e,t,n){return n(function(){gf(t)&&bf(e)})}function gf(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!On(e,n)}catch{return!0}}function bf(e){var t=Ha(e,2);t!==null&&Rn(t,e,2)}function yc(e){var t=gn();if(typeof e=="function"){var n=e;if(e=n(),Za){Ft(!0);try{n()}finally{Ft(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kl,lastRenderedState:e},t}function yf(e,t,n,l){return e.baseState=n,gc(e,yt,typeof l=="function"?l:Kl)}function Fb(e,t,n,l,s){if(js(e))throw Error(o(485));if(e=t.action,e!==null){var c={payload:s,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(h){c.listeners.push(h)}};E.T!==null?n(!0):c.isTransition=!1,l(c),n=t.pending,n===null?(c.next=t.pending=c,vf(t,c)):(c.next=n.next,t.pending=n.next=c)}}function vf(e,t){var n=t.action,l=t.payload,s=e.state;if(t.isTransition){var c=E.T,h={};E.T=h;try{var b=n(s,l),S=E.S;S!==null&&S(h,b),xf(e,t,b)}catch(_){vc(e,t,_)}finally{c!==null&&h.types!==null&&(c.types=h.types),E.T=c}}else try{c=n(s,l),xf(e,t,c)}catch(_){vc(e,t,_)}}function xf(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(l){wf(e,t,l)},function(l){return vc(e,t,l)}):wf(e,t,n)}function wf(e,t,n){t.status="fulfilled",t.value=n,Sf(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,vf(e,n)))}function vc(e,t,n){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=n,Sf(t),t=t.next;while(t!==l)}e.action=null}function Sf(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Cf(e,t){return t}function Tf(e,t){if(rt){var n=Et.formState;if(n!==null){e:{var l=Ye;if(rt){if(Rt){t:{for(var s=Rt,c=Zn;s.nodeType!==8;){if(!c){s=null;break t}if(s=Pn(s.nextSibling),s===null){s=null;break t}}c=s.data,s=c==="F!"||c==="F"?s:null}if(s){Rt=Pn(s.nextSibling),l=s.data==="F!";break e}}ca(l)}l=!1}l&&(t=n[0])}}return n=gn(),n.memoizedState=n.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Cf,lastRenderedState:t},n.queue=l,n=qf.bind(null,Ye,l),l.dispatch=n,l=yc(!1),c=Ac.bind(null,Ye,!1,l.queue),l=gn(),s={state:t,dispatch:null,action:e,pending:null},l.queue=s,n=Fb.bind(null,Ye,s,c,n),s.dispatch=n,l.memoizedState=e,[t,n,!1]}function Af(e){var t=Vt();return Nf(t,yt,e)}function Nf(e,t,n){if(t=gc(e,t,Cf)[0],e=Es(Kl)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=hr(t)}catch(h){throw h===vi?bs:h}else l=t;t=Vt();var s=t.queue,c=s.dispatch;return n!==t.memoizedState&&(Ye.flags|=2048,Ti(9,{destroy:void 0},Xb.bind(null,s,n),null)),[l,c,e]}function Xb(e,t){e.action=t}function Ef(e){var t=Vt(),n=yt;if(n!==null)return Nf(t,n,e);Vt(),t=t.memoizedState,n=Vt();var l=n.queue.dispatch;return n.memoizedState=e,[t,l,!1]}function Ti(e,t,n,l){return e={tag:e,create:n,deps:l,inst:t,next:null},t=Ye.updateQueue,t===null&&(t=As(),Ye.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 kf(){return Vt().memoizedState}function ks(e,t,n,l){var s=gn();Ye.flags|=e,s.memoizedState=Ti(1|t,{destroy:void 0},n,l===void 0?null:l)}function Rs(e,t,n,l){var s=Vt();l=l===void 0?null:l;var c=s.memoizedState.inst;yt!==null&&l!==null&&uc(l,yt.memoizedState.deps)?s.memoizedState=Ti(t,c,n,l):(Ye.flags|=e,s.memoizedState=Ti(1|t,c,n,l))}function Rf(e,t){ks(8390656,8,e,t)}function xc(e,t){Rs(2048,8,e,t)}function Ib(e){Ye.flags|=4;var t=Ye.updateQueue;if(t===null)t=As(),Ye.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function jf(e){var t=Vt().memoizedState;return Ib({ref:t,nextImpl:e}),function(){if((dt&2)!==0)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function Mf(e,t){return Rs(4,2,e,t)}function _f(e,t){return Rs(4,4,e,t)}function Lf(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 zf(e,t,n){n=n!=null?n.concat([e]):null,Rs(4,4,Lf.bind(null,t,e),n)}function wc(){}function Df(e,t){var n=Vt();t=t===void 0?null:t;var l=n.memoizedState;return t!==null&&uc(t,l[1])?l[0]:(n.memoizedState=[e,t],e)}function Of(e,t){var n=Vt();t=t===void 0?null:t;var l=n.memoizedState;if(t!==null&&uc(t,l[1]))return l[0];if(l=e(),Za){Ft(!0);try{e()}finally{Ft(!1)}}return n.memoizedState=[l,t],l}function Sc(e,t,n){return n===void 0||(Hl&1073741824)!==0&&(tt&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=Uh(),Ye.lanes|=e,ya|=e,n)}function Uf(e,t,n,l){return On(n,t)?n:wi.current!==null?(e=Sc(e,n,l),On(e,t)||(Qt=!0),e):(Hl&42)===0||(Hl&1073741824)!==0&&(tt&261930)===0?(Qt=!0,e.memoizedState=n):(e=Uh(),Ye.lanes|=e,ya|=e,t)}function Bf(e,t,n,l,s){var c=B.p;B.p=c!==0&&8>c?c:8;var h=E.T,b={};E.T=b,Ac(e,!1,t,n);try{var S=s(),_=E.S;if(_!==null&&_(b,S),S!==null&&typeof S=="object"&&typeof S.then=="function"){var H=Gb(S,l);mr(e,t,H,Gn(e))}else mr(e,t,l,Gn(e))}catch(F){mr(e,t,{then:function(){},status:"rejected",reason:F},Gn())}finally{B.p=c,h!==null&&b.types!==null&&(h.types=b.types),E.T=h}}function Zb(){}function Cc(e,t,n,l){if(e.tag!==5)throw Error(o(476));var s=Hf(e).queue;Bf(e,s,t,ee,n===null?Zb:function(){return Kf(e),n(l)})}function Hf(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ee,baseState:ee,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kl,lastRenderedState:ee},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kl,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Kf(e){var t=Hf(e);t.next===null&&(t=e.alternate.memoizedState),mr(e,t.next.queue,{},Gn())}function Tc(){return on(Mr)}function Yf(){return Vt().memoizedState}function Gf(){return Vt().memoizedState}function Qb(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Gn();e=fa(n);var l=ha(t,e,n);l!==null&&(Rn(l,t,n),cr(l,t,n)),t={cache:$o()},e.payload=t;return}t=t.return}}function Pb(e,t,n){var l=Gn();n={lane:l,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},js(e)?Vf(t,n):(n=Go(e,t,n,l),n!==null&&(Rn(n,e,l),Ff(n,t,l)))}function qf(e,t,n){var l=Gn();mr(e,t,n,l)}function mr(e,t,n,l){var s={lane:l,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(js(e))Vf(t,s);else{var c=e.alternate;if(e.lanes===0&&(c===null||c.lanes===0)&&(c=t.lastRenderedReducer,c!==null))try{var h=t.lastRenderedState,b=c(h,n);if(s.hasEagerState=!0,s.eagerState=b,On(b,h))return us(e,t,s,0),Et===null&&cs(),!1}catch{}finally{}if(n=Go(e,t,s,l),n!==null)return Rn(n,e,l),Ff(n,t,l),!0}return!1}function Ac(e,t,n,l){if(l={lane:2,revertLane:lu(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},js(e)){if(t)throw Error(o(479))}else t=Go(e,n,l,2),t!==null&&Rn(t,e,2)}function js(e){var t=e.alternate;return e===Ye||t!==null&&t===Ye}function Vf(e,t){Si=Cs=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ff(e,t,n){if((n&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,n|=l,t.lanes=n,Jl(e,n)}}var pr={readContext:on,use:Ns,useCallback:Ht,useContext:Ht,useEffect:Ht,useImperativeHandle:Ht,useLayoutEffect:Ht,useInsertionEffect:Ht,useMemo:Ht,useReducer:Ht,useRef:Ht,useState:Ht,useDebugValue:Ht,useDeferredValue:Ht,useTransition:Ht,useSyncExternalStore:Ht,useId:Ht,useHostTransitionStatus:Ht,useFormState:Ht,useActionState:Ht,useOptimistic:Ht,useMemoCache:Ht,useCacheRefresh:Ht};pr.useEffectEvent=Ht;var Xf={readContext:on,use:Ns,useCallback:function(e,t){return gn().memoizedState=[e,t===void 0?null:t],e},useContext:on,useEffect:Rf,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,ks(4194308,4,Lf.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ks(4194308,4,e,t)},useInsertionEffect:function(e,t){ks(4,2,e,t)},useMemo:function(e,t){var n=gn();t=t===void 0?null:t;var l=e();if(Za){Ft(!0);try{e()}finally{Ft(!1)}}return n.memoizedState=[l,t],l},useReducer:function(e,t,n){var l=gn();if(n!==void 0){var s=n(t);if(Za){Ft(!0);try{n(t)}finally{Ft(!1)}}}else s=t;return l.memoizedState=l.baseState=s,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:s},l.queue=e,e=e.dispatch=Pb.bind(null,Ye,e),[l.memoizedState,e]},useRef:function(e){var t=gn();return e={current:e},t.memoizedState=e},useState:function(e){e=yc(e);var t=e.queue,n=qf.bind(null,Ye,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:wc,useDeferredValue:function(e,t){var n=gn();return Sc(n,e,t)},useTransition:function(){var e=yc(!1);return e=Bf.bind(null,Ye,e.queue,!0,!1),gn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var l=Ye,s=gn();if(rt){if(n===void 0)throw Error(o(407));n=n()}else{if(n=t(),Et===null)throw Error(o(349));(tt&127)!==0||hf(l,t,n)}s.memoizedState=n;var c={value:n,getSnapshot:t};return s.queue=c,Rf(pf.bind(null,l,c,e),[e]),l.flags|=2048,Ti(9,{destroy:void 0},mf.bind(null,l,c,n,t),null),n},useId:function(){var e=gn(),t=Et.identifierPrefix;if(rt){var n=Sl,l=wl;n=(l&~(1<<32-it(l)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Ts++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=qb++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Tc,useFormState:Tf,useActionState:Tf,useOptimistic:function(e){var t=gn();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Ac.bind(null,Ye,!0,n),n.dispatch=t,[e,t]},useMemoCache:pc,useCacheRefresh:function(){return gn().memoizedState=Qb.bind(null,Ye)},useEffectEvent:function(e){var t=gn(),n={impl:e};return t.memoizedState=n,function(){if((dt&2)!==0)throw Error(o(440));return n.impl.apply(void 0,arguments)}}},Nc={readContext:on,use:Ns,useCallback:Df,useContext:on,useEffect:xc,useImperativeHandle:zf,useInsertionEffect:Mf,useLayoutEffect:_f,useMemo:Of,useReducer:Es,useRef:kf,useState:function(){return Es(Kl)},useDebugValue:wc,useDeferredValue:function(e,t){var n=Vt();return Uf(n,yt.memoizedState,e,t)},useTransition:function(){var e=Es(Kl)[0],t=Vt().memoizedState;return[typeof e=="boolean"?e:hr(e),t]},useSyncExternalStore:ff,useId:Yf,useHostTransitionStatus:Tc,useFormState:Af,useActionState:Af,useOptimistic:function(e,t){var n=Vt();return yf(n,yt,e,t)},useMemoCache:pc,useCacheRefresh:Gf};Nc.useEffectEvent=jf;var If={readContext:on,use:Ns,useCallback:Df,useContext:on,useEffect:xc,useImperativeHandle:zf,useInsertionEffect:Mf,useLayoutEffect:_f,useMemo:Of,useReducer:bc,useRef:kf,useState:function(){return bc(Kl)},useDebugValue:wc,useDeferredValue:function(e,t){var n=Vt();return yt===null?Sc(n,e,t):Uf(n,yt.memoizedState,e,t)},useTransition:function(){var e=bc(Kl)[0],t=Vt().memoizedState;return[typeof e=="boolean"?e:hr(e),t]},useSyncExternalStore:ff,useId:Yf,useHostTransitionStatus:Tc,useFormState:Ef,useActionState:Ef,useOptimistic:function(e,t){var n=Vt();return yt!==null?yf(n,yt,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:pc,useCacheRefresh:Gf};If.useEffectEvent=jf;function Ec(e,t,n,l){t=e.memoizedState,n=n(l,t),n=n==null?t:w({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var kc={enqueueSetState:function(e,t,n){e=e._reactInternals;var l=Gn(),s=fa(l);s.payload=t,n!=null&&(s.callback=n),t=ha(e,s,l),t!==null&&(Rn(t,e,l),cr(t,e,l))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var l=Gn(),s=fa(l);s.tag=1,s.payload=t,n!=null&&(s.callback=n),t=ha(e,s,l),t!==null&&(Rn(t,e,l),cr(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Gn(),l=fa(n);l.tag=2,t!=null&&(l.callback=t),t=ha(e,l,n),t!==null&&(Rn(t,e,n),cr(t,e,n))}};function Zf(e,t,n,l,s,c,h){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,c,h):t.prototype&&t.prototype.isPureReactComponent?!tr(n,l)||!tr(s,c):!0}function Qf(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&&kc.enqueueReplaceState(t,t.state,null)}function Qa(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=w({},n));for(var s in e)n[s]===void 0&&(n[s]=e[s])}return n}function Pf(e){os(e)}function Wf(e){console.error(e)}function Jf(e){os(e)}function Ms(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function $f(e,t,n){try{var l=e.onCaughtError;l(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(s){setTimeout(function(){throw s})}}function Rc(e,t,n){return n=fa(n),n.tag=3,n.payload={element:null},n.callback=function(){Ms(e,t)},n}function eh(e){return e=fa(e),e.tag=3,e}function th(e,t,n,l){var s=n.type.getDerivedStateFromError;if(typeof s=="function"){var c=l.value;e.payload=function(){return s(c)},e.callback=function(){$f(t,n,l)}}var h=n.stateNode;h!==null&&typeof h.componentDidCatch=="function"&&(e.callback=function(){$f(t,n,l),typeof s!="function"&&(va===null?va=new Set([this]):va.add(this));var b=l.stack;this.componentDidCatch(l.value,{componentStack:b!==null?b:""})})}function Wb(e,t,n,l,s){if(n.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=n.alternate,t!==null&&gi(t,n,s,!0),n=Bn.current,n!==null){switch(n.tag){case 31:case 13:return Qn===null?qs():n.alternate===null&&Kt===0&&(Kt=3),n.flags&=-257,n.flags|=65536,n.lanes=s,l===ys?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([l]):t.add(l),eu(e,l,s)),!1;case 22:return n.flags|=65536,l===ys?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)),eu(e,l,s)),!1}throw Error(o(435,n.tag))}return eu(e,l,s),qs(),!1}if(rt)return t=Bn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=s,l!==Zo&&(e=Error(o(422),{cause:l}),ar(Fn(e,n)))):(l!==Zo&&(t=Error(o(423),{cause:l}),ar(Fn(t,n))),e=e.current.alternate,e.flags|=65536,s&=-s,e.lanes|=s,l=Fn(l,n),s=Rc(e.stateNode,l,s),ic(e,s),Kt!==4&&(Kt=2)),!1;var c=Error(o(520),{cause:l});if(c=Fn(c,n),Cr===null?Cr=[c]:Cr.push(c),Kt!==4&&(Kt=2),t===null)return!0;l=Fn(l,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=s&-s,n.lanes|=e,e=Rc(n.stateNode,l,e),ic(n,e),!1;case 1:if(t=n.type,c=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||c!==null&&typeof c.componentDidCatch=="function"&&(va===null||!va.has(c))))return n.flags|=65536,s&=-s,n.lanes|=s,s=eh(s),th(s,e,n,l),ic(n,s),!1}n=n.return}while(n!==null);return!1}var jc=Error(o(461)),Qt=!1;function cn(e,t,n,l){t.child=e===null?af(t,null,n,l):Ia(t,e.child,n,l)}function nh(e,t,n,l,s){n=n.render;var c=t.ref;if("ref"in l){var h={};for(var b in l)b!=="ref"&&(h[b]=l[b])}else h=l;return qa(t),l=dc(e,t,n,h,c,s),b=fc(),e!==null&&!Qt?(hc(e,t,s),Yl(e,t,s)):(rt&&b&&Xo(t),t.flags|=1,cn(e,t,l,s),t.child)}function lh(e,t,n,l,s){if(e===null){var c=n.type;return typeof c=="function"&&!qo(c)&&c.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=c,ah(e,t,c,l,s)):(e=fs(n.type,null,l,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(c=e.child,!Bc(e,s)){var h=c.memoizedProps;if(n=n.compare,n=n!==null?n:tr,n(h,l)&&e.ref===t.ref)return Yl(e,t,s)}return t.flags|=1,e=Dl(c,l),e.ref=t.ref,e.return=t,t.child=e}function ah(e,t,n,l,s){if(e!==null){var c=e.memoizedProps;if(tr(c,l)&&e.ref===t.ref)if(Qt=!1,t.pendingProps=l=c,Bc(e,s))(e.flags&131072)!==0&&(Qt=!0);else return t.lanes=e.lanes,Yl(e,t,s)}return Mc(e,t,n,l,s)}function ih(e,t,n,l){var s=l.children,c=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((t.flags&128)!==0){if(c=c!==null?c.baseLanes|n:n,e!==null){for(l=t.child=e.child,s=0;l!==null;)s=s|l.lanes|l.childLanes,l=l.sibling;l=s&~c}else l=0,t.child=null;return rh(e,t,c,n,l)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&gs(t,c!==null?c.cachePool:null),c!==null?of(t,c):sc(),cf(t);else return l=t.lanes=536870912,rh(e,t,c!==null?c.baseLanes|n:n,n,l)}else c!==null?(gs(t,c.cachePool),of(t,c),pa(),t.memoizedState=null):(e!==null&&gs(t,null),sc(),pa());return cn(e,t,s,n),t.child}function gr(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function rh(e,t,n,l,s){var c=tc();return c=c===null?null:{parent:It._currentValue,pool:c},t.memoizedState={baseLanes:n,cachePool:c},e!==null&&gs(t,null),sc(),cf(t),e!==null&&gi(e,t,l,!0),t.childLanes=s,null}function _s(e,t){return t=zs({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function sh(e,t,n){return Ia(t,e.child,null,n),e=_s(t,t.pendingProps),e.flags|=2,Hn(t),t.memoizedState=null,e}function Jb(e,t,n){var l=t.pendingProps,s=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(rt){if(l.mode==="hidden")return e=_s(t,l),t.lanes=536870912,gr(null,e);if(cc(t),(e=Rt)?(e=vm(e,Zn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:sa!==null?{id:wl,overflow:Sl}:null,retryLane:536870912,hydrationErrors:null},n=qd(e),n.return=t,t.child=n,sn=t,Rt=null)):e=null,e===null)throw ca(t);return t.lanes=536870912,null}return _s(t,l)}var c=e.memoizedState;if(c!==null){var h=c.dehydrated;if(cc(t),s)if(t.flags&256)t.flags&=-257,t=sh(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558));else if(Qt||gi(e,t,n,!1),s=(n&e.childLanes)!==0,Qt||s){if(l=Et,l!==null&&(h=nl(l,n),h!==0&&h!==c.retryLane))throw c.retryLane=h,Ha(e,h),Rn(l,e,h),jc;qs(),t=sh(e,t,n)}else e=c.treeContext,Rt=Pn(h.nextSibling),sn=t,rt=!0,oa=null,Zn=!1,e!==null&&Xd(t,e),t=_s(t,l),t.flags|=4096;return t}return e=Dl(e.child,{mode:l.mode,children:l.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Ls(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(o(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function Mc(e,t,n,l,s){return qa(t),n=dc(e,t,n,l,void 0,s),l=fc(),e!==null&&!Qt?(hc(e,t,s),Yl(e,t,s)):(rt&&l&&Xo(t),t.flags|=1,cn(e,t,n,s),t.child)}function oh(e,t,n,l,s,c){return qa(t),t.updateQueue=null,n=df(t,l,n,s),uf(e),l=fc(),e!==null&&!Qt?(hc(e,t,c),Yl(e,t,c)):(rt&&l&&Xo(t),t.flags|=1,cn(e,t,n,c),t.child)}function ch(e,t,n,l,s){if(qa(t),t.stateNode===null){var c=fi,h=n.contextType;typeof h=="object"&&h!==null&&(c=on(h)),c=new n(l,c),t.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,c.updater=kc,t.stateNode=c,c._reactInternals=t,c=t.stateNode,c.props=l,c.state=t.memoizedState,c.refs={},lc(t),h=n.contextType,c.context=typeof h=="object"&&h!==null?on(h):fi,c.state=t.memoizedState,h=n.getDerivedStateFromProps,typeof h=="function"&&(Ec(t,n,h,l),c.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof c.getSnapshotBeforeUpdate=="function"||typeof c.UNSAFE_componentWillMount!="function"&&typeof c.componentWillMount!="function"||(h=c.state,typeof c.componentWillMount=="function"&&c.componentWillMount(),typeof c.UNSAFE_componentWillMount=="function"&&c.UNSAFE_componentWillMount(),h!==c.state&&kc.enqueueReplaceState(c,c.state,null),dr(t,l,c,s),ur(),c.state=t.memoizedState),typeof c.componentDidMount=="function"&&(t.flags|=4194308),l=!0}else if(e===null){c=t.stateNode;var b=t.memoizedProps,S=Qa(n,b);c.props=S;var _=c.context,H=n.contextType;h=fi,typeof H=="object"&&H!==null&&(h=on(H));var F=n.getDerivedStateFromProps;H=typeof F=="function"||typeof c.getSnapshotBeforeUpdate=="function",b=t.pendingProps!==b,H||typeof c.UNSAFE_componentWillReceiveProps!="function"&&typeof c.componentWillReceiveProps!="function"||(b||_!==h)&&Qf(t,c,l,h),da=!1;var L=t.memoizedState;c.state=L,dr(t,l,c,s),ur(),_=t.memoizedState,b||L!==_||da?(typeof F=="function"&&(Ec(t,n,F,l),_=t.memoizedState),(S=da||Zf(t,n,S,l,L,_,h))?(H||typeof c.UNSAFE_componentWillMount!="function"&&typeof c.componentWillMount!="function"||(typeof c.componentWillMount=="function"&&c.componentWillMount(),typeof c.UNSAFE_componentWillMount=="function"&&c.UNSAFE_componentWillMount()),typeof c.componentDidMount=="function"&&(t.flags|=4194308)):(typeof c.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=_),c.props=l,c.state=_,c.context=h,l=S):(typeof c.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{c=t.stateNode,ac(e,t),h=t.memoizedProps,H=Qa(n,h),c.props=H,F=t.pendingProps,L=c.context,_=n.contextType,S=fi,typeof _=="object"&&_!==null&&(S=on(_)),b=n.getDerivedStateFromProps,(_=typeof b=="function"||typeof c.getSnapshotBeforeUpdate=="function")||typeof c.UNSAFE_componentWillReceiveProps!="function"&&typeof c.componentWillReceiveProps!="function"||(h!==F||L!==S)&&Qf(t,c,l,S),da=!1,L=t.memoizedState,c.state=L,dr(t,l,c,s),ur();var O=t.memoizedState;h!==F||L!==O||da||e!==null&&e.dependencies!==null&&ms(e.dependencies)?(typeof b=="function"&&(Ec(t,n,b,l),O=t.memoizedState),(H=da||Zf(t,n,H,l,L,O,S)||e!==null&&e.dependencies!==null&&ms(e.dependencies))?(_||typeof c.UNSAFE_componentWillUpdate!="function"&&typeof c.componentWillUpdate!="function"||(typeof c.componentWillUpdate=="function"&&c.componentWillUpdate(l,O,S),typeof c.UNSAFE_componentWillUpdate=="function"&&c.UNSAFE_componentWillUpdate(l,O,S)),typeof c.componentDidUpdate=="function"&&(t.flags|=4),typeof c.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof c.componentDidUpdate!="function"||h===e.memoizedProps&&L===e.memoizedState||(t.flags|=4),typeof c.getSnapshotBeforeUpdate!="function"||h===e.memoizedProps&&L===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=O),c.props=l,c.state=O,c.context=S,l=H):(typeof c.componentDidUpdate!="function"||h===e.memoizedProps&&L===e.memoizedState||(t.flags|=4),typeof c.getSnapshotBeforeUpdate!="function"||h===e.memoizedProps&&L===e.memoizedState||(t.flags|=1024),l=!1)}return c=l,Ls(e,t),l=(t.flags&128)!==0,c||l?(c=t.stateNode,n=l&&typeof n.getDerivedStateFromError!="function"?null:c.render(),t.flags|=1,e!==null&&l?(t.child=Ia(t,e.child,null,s),t.child=Ia(t,null,n,s)):cn(e,t,n,s),t.memoizedState=c.state,e=t.child):e=Yl(e,t,s),e}function uh(e,t,n,l){return Ya(),t.flags|=256,cn(e,t,n,l),t.child}var _c={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Lc(e){return{baseLanes:e,cachePool:Jd()}}function zc(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Yn),e}function dh(e,t,n){var l=t.pendingProps,s=!1,c=(t.flags&128)!==0,h;if((h=c)||(h=e!==null&&e.memoizedState===null?!1:(qt.current&2)!==0),h&&(s=!0,t.flags&=-129),h=(t.flags&32)!==0,t.flags&=-33,e===null){if(rt){if(s?ma(t):pa(),(e=Rt)?(e=vm(e,Zn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:sa!==null?{id:wl,overflow:Sl}:null,retryLane:536870912,hydrationErrors:null},n=qd(e),n.return=t,t.child=n,sn=t,Rt=null)):e=null,e===null)throw ca(t);return gu(e)?t.lanes=32:t.lanes=536870912,null}var b=l.children;return l=l.fallback,s?(pa(),s=t.mode,b=zs({mode:"hidden",children:b},s),l=Ka(l,s,n,null),b.return=t,l.return=t,b.sibling=l,t.child=b,l=t.child,l.memoizedState=Lc(n),l.childLanes=zc(e,h,n),t.memoizedState=_c,gr(null,l)):(ma(t),Dc(t,b))}var S=e.memoizedState;if(S!==null&&(b=S.dehydrated,b!==null)){if(c)t.flags&256?(ma(t),t.flags&=-257,t=Oc(e,t,n)):t.memoizedState!==null?(pa(),t.child=e.child,t.flags|=128,t=null):(pa(),b=l.fallback,s=t.mode,l=zs({mode:"visible",children:l.children},s),b=Ka(b,s,n,null),b.flags|=2,l.return=t,b.return=t,l.sibling=b,t.child=l,Ia(t,e.child,null,n),l=t.child,l.memoizedState=Lc(n),l.childLanes=zc(e,h,n),t.memoizedState=_c,t=gr(null,l));else if(ma(t),gu(b)){if(h=b.nextSibling&&b.nextSibling.dataset,h)var _=h.dgst;h=_,l=Error(o(419)),l.stack="",l.digest=h,ar({value:l,source:null,stack:null}),t=Oc(e,t,n)}else if(Qt||gi(e,t,n,!1),h=(n&e.childLanes)!==0,Qt||h){if(h=Et,h!==null&&(l=nl(h,n),l!==0&&l!==S.retryLane))throw S.retryLane=l,Ha(e,l),Rn(h,e,l),jc;pu(b)||qs(),t=Oc(e,t,n)}else pu(b)?(t.flags|=192,t.child=e.child,t=null):(e=S.treeContext,Rt=Pn(b.nextSibling),sn=t,rt=!0,oa=null,Zn=!1,e!==null&&Xd(t,e),t=Dc(t,l.children),t.flags|=4096);return t}return s?(pa(),b=l.fallback,s=t.mode,S=e.child,_=S.sibling,l=Dl(S,{mode:"hidden",children:l.children}),l.subtreeFlags=S.subtreeFlags&65011712,_!==null?b=Dl(_,b):(b=Ka(b,s,n,null),b.flags|=2),b.return=t,l.return=t,l.sibling=b,t.child=l,gr(null,l),l=t.child,b=e.child.memoizedState,b===null?b=Lc(n):(s=b.cachePool,s!==null?(S=It._currentValue,s=s.parent!==S?{parent:S,pool:S}:s):s=Jd(),b={baseLanes:b.baseLanes|n,cachePool:s}),l.memoizedState=b,l.childLanes=zc(e,h,n),t.memoizedState=_c,gr(e.child,l)):(ma(t),n=e.child,e=n.sibling,n=Dl(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 Dc(e,t){return t=zs({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function zs(e,t){return e=Un(22,e,null,t),e.lanes=0,e}function Oc(e,t,n){return Ia(t,e.child,null,n),e=Dc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function fh(e,t,n){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),Wo(e.return,t,n)}function Uc(e,t,n,l,s,c){var h=e.memoizedState;h===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:n,tailMode:s,treeForkCount:c}:(h.isBackwards=t,h.rendering=null,h.renderingStartTime=0,h.last=l,h.tail=n,h.tailMode=s,h.treeForkCount=c)}function hh(e,t,n){var l=t.pendingProps,s=l.revealOrder,c=l.tail;l=l.children;var h=qt.current,b=(h&2)!==0;if(b?(h=h&1|2,t.flags|=128):h&=1,ue(qt,h),cn(e,t,l,n),l=rt?lr:0,!b&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&fh(e,n,t);else if(e.tag===19)fh(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(s){case"forwards":for(n=t.child,s=null;n!==null;)e=n.alternate,e!==null&&Ss(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),Uc(t,!1,s,n,c,l);break;case"backwards":case"unstable_legacy-backwards":for(n=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&Ss(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}Uc(t,!0,n,null,c,l);break;case"together":Uc(t,!1,null,null,void 0,l);break;default:t.memoizedState=null}return t.child}function Yl(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),ya|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(gi(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,n=Dl(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Dl(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Bc(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&ms(e)))}function $b(e,t,n){switch(t.tag){case 3:lt(t,t.stateNode.containerInfo),ua(t,It,e.memoizedState.cache),Ya();break;case 27:case 5:He(t);break;case 4:lt(t,t.stateNode.containerInfo);break;case 10:ua(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,cc(t),null;break;case 13:var l=t.memoizedState;if(l!==null)return l.dehydrated!==null?(ma(t),t.flags|=128,null):(n&t.child.childLanes)!==0?dh(e,t,n):(ma(t),e=Yl(e,t,n),e!==null?e.sibling:null);ma(t);break;case 19:var s=(e.flags&128)!==0;if(l=(n&t.childLanes)!==0,l||(gi(e,t,n,!1),l=(n&t.childLanes)!==0),s){if(l)return hh(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),ue(qt,qt.current),l)break;return null;case 22:return t.lanes=0,ih(e,t,n,t.pendingProps);case 24:ua(t,It,e.memoizedState.cache)}return Yl(e,t,n)}function mh(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Qt=!0;else{if(!Bc(e,n)&&(t.flags&128)===0)return Qt=!1,$b(e,t,n);Qt=(e.flags&131072)!==0}else Qt=!1,rt&&(t.flags&1048576)!==0&&Fd(t,lr,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=Fa(t.elementType),t.type=e,typeof e=="function")qo(e)?(l=Qa(e,l),t.tag=1,t=ch(null,t,e,l,n)):(t.tag=0,t=Mc(null,t,e,l,n));else{if(e!=null){var s=e.$$typeof;if(s===oe){t.tag=11,t=nh(null,t,e,l,n);break e}else if(s===X){t.tag=14,t=lh(null,t,e,l,n);break e}}throw t=st(e)||e,Error(o(306,t,""))}}return t;case 0:return Mc(e,t,t.type,t.pendingProps,n);case 1:return l=t.type,s=Qa(l,t.pendingProps),ch(e,t,l,s,n);case 3:e:{if(lt(t,t.stateNode.containerInfo),e===null)throw Error(o(387));l=t.pendingProps;var c=t.memoizedState;s=c.element,ac(e,t),dr(t,l,null,n);var h=t.memoizedState;if(l=h.cache,ua(t,It,l),l!==c.cache&&Jo(t,[It],n,!0),ur(),l=h.element,c.isDehydrated)if(c={element:l,isDehydrated:!1,cache:h.cache},t.updateQueue.baseState=c,t.memoizedState=c,t.flags&256){t=uh(e,t,l,n);break e}else if(l!==s){s=Fn(Error(o(424)),t),ar(s),t=uh(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(Rt=Pn(e.firstChild),sn=t,rt=!0,oa=null,Zn=!0,n=af(t,null,l,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ya(),l===s){t=Yl(e,t,n);break e}cn(e,t,l,n)}t=t.child}return t;case 26:return Ls(e,t),e===null?(n=Am(t.type,null,t.pendingProps,null))?t.memoizedState=n:rt||(n=t.type,e=t.pendingProps,l=Ps(G.current).createElement(n),l[Gt]=t,l[en]=e,un(l,n,e),Tt(l),t.stateNode=l):t.memoizedState=Am(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return He(t),e===null&&rt&&(l=t.stateNode=Sm(t.type,t.pendingProps,G.current),sn=t,Zn=!0,s=Rt,Ca(t.type)?(bu=s,Rt=Pn(l.firstChild)):Rt=s),cn(e,t,t.pendingProps.children,n),Ls(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&rt&&((s=l=Rt)&&(l=Ry(l,t.type,t.pendingProps,Zn),l!==null?(t.stateNode=l,sn=t,Rt=Pn(l.firstChild),Zn=!1,s=!0):s=!1),s||ca(t)),He(t),s=t.type,c=t.pendingProps,h=e!==null?e.memoizedProps:null,l=c.children,fu(s,c)?l=null:h!==null&&fu(s,h)&&(t.flags|=32),t.memoizedState!==null&&(s=dc(e,t,Vb,null,null,n),Mr._currentValue=s),Ls(e,t),cn(e,t,l,n),t.child;case 6:return e===null&&rt&&((e=n=Rt)&&(n=jy(n,t.pendingProps,Zn),n!==null?(t.stateNode=n,sn=t,Rt=null,e=!0):e=!1),e||ca(t)),null;case 13:return dh(e,t,n);case 4:return lt(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=Ia(t,null,l,n):cn(e,t,l,n),t.child;case 11:return nh(e,t,t.type,t.pendingProps,n);case 7:return cn(e,t,t.pendingProps,n),t.child;case 8:return cn(e,t,t.pendingProps.children,n),t.child;case 12:return cn(e,t,t.pendingProps.children,n),t.child;case 10:return l=t.pendingProps,ua(t,t.type,l.value),cn(e,t,l.children,n),t.child;case 9:return s=t.type._context,l=t.pendingProps.children,qa(t),s=on(s),l=l(s),t.flags|=1,cn(e,t,l,n),t.child;case 14:return lh(e,t,t.type,t.pendingProps,n);case 15:return ah(e,t,t.type,t.pendingProps,n);case 19:return hh(e,t,n);case 31:return Jb(e,t,n);case 22:return ih(e,t,n,t.pendingProps);case 24:return qa(t),l=on(It),e===null?(s=tc(),s===null&&(s=Et,c=$o(),s.pooledCache=c,c.refCount++,c!==null&&(s.pooledCacheLanes|=n),s=c),t.memoizedState={parent:l,cache:s},lc(t),ua(t,It,s)):((e.lanes&n)!==0&&(ac(e,t),dr(t,null,null,n),ur()),s=e.memoizedState,c=t.memoizedState,s.parent!==l?(s={parent:l,cache:l},t.memoizedState=s,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=s),ua(t,It,l)):(l=c.cache,ua(t,It,l),l!==s.cache&&Jo(t,[It],n,!0))),cn(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function Gl(e){e.flags|=4}function Hc(e,t,n,l,s){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(s&335544128)===s)if(e.stateNode.complete)e.flags|=8192;else if(Yh())e.flags|=8192;else throw Xa=ys,nc}else e.flags&=-16777217}function ph(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!jm(t))if(Yh())e.flags|=8192;else throw Xa=ys,nc}function Ds(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?_n():536870912,e.lanes|=t,ki|=t)}function br(e,t){if(!rt)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 jt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,l=0;if(t)for(var s=e.child;s!==null;)n|=s.lanes|s.childLanes,l|=s.subtreeFlags&65011712,l|=s.flags&65011712,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)n|=s.lanes|s.childLanes,l|=s.subtreeFlags,l|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=l,e.childLanes=n,t}function ey(e,t,n){var l=t.pendingProps;switch(Io(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return jt(t),null;case 1:return jt(t),null;case 3:return n=t.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),Bl(It),we(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(pi(t)?Gl(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Qo())),jt(t),null;case 26:var s=t.type,c=t.memoizedState;return e===null?(Gl(t),c!==null?(jt(t),ph(t,c)):(jt(t),Hc(t,s,null,l,n))):c?c!==e.memoizedState?(Gl(t),jt(t),ph(t,c)):(jt(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&Gl(t),jt(t),Hc(t,s,e,l,n)),null;case 27:if(gt(t),n=G.current,s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&Gl(t);else{if(!l){if(t.stateNode===null)throw Error(o(166));return jt(t),null}e=Ge.current,pi(t)?Id(t):(e=Sm(s,l,n),t.stateNode=e,Gl(t))}return jt(t),null;case 5:if(gt(t),s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&Gl(t);else{if(!l){if(t.stateNode===null)throw Error(o(166));return jt(t),null}if(c=Ge.current,pi(t))Id(t);else{var h=Ps(G.current);switch(c){case 1:c=h.createElementNS("http://www.w3.org/2000/svg",s);break;case 2:c=h.createElementNS("http://www.w3.org/1998/Math/MathML",s);break;default:switch(s){case"svg":c=h.createElementNS("http://www.w3.org/2000/svg",s);break;case"math":c=h.createElementNS("http://www.w3.org/1998/Math/MathML",s);break;case"script":c=h.createElement("div"),c.innerHTML="<script><\/script>",c=c.removeChild(c.firstChild);break;case"select":c=typeof l.is=="string"?h.createElement("select",{is:l.is}):h.createElement("select"),l.multiple?c.multiple=!0:l.size&&(c.size=l.size);break;default:c=typeof l.is=="string"?h.createElement(s,{is:l.is}):h.createElement(s)}}c[Gt]=t,c[en]=l;e:for(h=t.child;h!==null;){if(h.tag===5||h.tag===6)c.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=c;e:switch(un(c,s,l),s){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&Gl(t)}}return jt(t),Hc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&Gl(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(o(166));if(e=G.current,pi(t)){if(e=t.stateNode,n=t.memoizedProps,l=null,s=sn,s!==null)switch(s.tag){case 27:case 5:l=s.memoizedProps}e[Gt]=t,e=!!(e.nodeValue===n||l!==null&&l.suppressHydrationWarning===!0||dm(e.nodeValue,n)),e||ca(t,!0)}else e=Ps(e).createTextNode(l),e[Gt]=t,t.stateNode=e}return jt(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(l=pi(t),n!==null){if(e===null){if(!l)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[Gt]=t}else Ya(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;jt(t),e=!1}else n=Qo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Hn(t),t):(Hn(t),null);if((t.flags&128)!==0)throw Error(o(558))}return jt(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(s=pi(t),l!==null&&l.dehydrated!==null){if(e===null){if(!s)throw Error(o(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(o(317));s[Gt]=t}else Ya(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;jt(t),s=!1}else s=Qo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),s=!0;if(!s)return t.flags&256?(Hn(t),t):(Hn(t),null)}return Hn(t),(t.flags&128)!==0?(t.lanes=n,t):(n=l!==null,e=e!==null&&e.memoizedState!==null,n&&(l=t.child,s=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(s=l.alternate.memoizedState.cachePool.pool),c=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(c=l.memoizedState.cachePool.pool),c!==s&&(l.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Ds(t,t.updateQueue),jt(t),null);case 4:return we(),e===null&&su(t.stateNode.containerInfo),jt(t),null;case 10:return Bl(t.type),jt(t),null;case 19:if(je(qt),l=t.memoizedState,l===null)return jt(t),null;if(s=(t.flags&128)!==0,c=l.rendering,c===null)if(s)br(l,!1);else{if(Kt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(c=Ss(e),c!==null){for(t.flags|=128,br(l,!1),e=c.updateQueue,t.updateQueue=e,Ds(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Gd(n,e),n=n.sibling;return ue(qt,qt.current&1|2),rt&&Ol(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&le()>Ks&&(t.flags|=128,s=!0,br(l,!1),t.lanes=4194304)}else{if(!s)if(e=Ss(c),e!==null){if(t.flags|=128,s=!0,e=e.updateQueue,t.updateQueue=e,Ds(t,e),br(l,!0),l.tail===null&&l.tailMode==="hidden"&&!c.alternate&&!rt)return jt(t),null}else 2*le()-l.renderingStartTime>Ks&&n!==536870912&&(t.flags|=128,s=!0,br(l,!1),t.lanes=4194304);l.isBackwards?(c.sibling=t.child,t.child=c):(e=l.last,e!==null?e.sibling=c:t.child=c,l.last=c)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=le(),e.sibling=null,n=qt.current,ue(qt,s?n&1|2:n&1),rt&&Ol(t,l.treeForkCount),e):(jt(t),null);case 22:case 23:return Hn(t),oc(),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&&(jt(t),t.subtreeFlags&6&&(t.flags|=8192)):jt(t),n=t.updateQueue,n!==null&&Ds(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&&je(Va),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Bl(It),jt(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function ty(e,t){switch(Io(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Bl(It),we(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return gt(t),null;case 31:if(t.memoizedState!==null){if(Hn(t),t.alternate===null)throw Error(o(340));Ya()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Hn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));Ya()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return je(qt),null;case 4:return we(),null;case 10:return Bl(t.type),null;case 22:case 23:return Hn(t),oc(),e!==null&&je(Va),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Bl(It),null;case 25:return null;default:return null}}function gh(e,t){switch(Io(t),t.tag){case 3:Bl(It),we();break;case 26:case 27:case 5:gt(t);break;case 4:we();break;case 31:t.memoizedState!==null&&Hn(t);break;case 13:Hn(t);break;case 19:je(qt);break;case 10:Bl(t.type);break;case 22:case 23:Hn(t),oc(),e!==null&&je(Va);break;case 24:Bl(It)}}function yr(e,t){try{var n=t.updateQueue,l=n!==null?n.lastEffect:null;if(l!==null){var s=l.next;n=s;do{if((n.tag&e)===e){l=void 0;var c=n.create,h=n.inst;l=c(),h.destroy=l}n=n.next}while(n!==s)}}catch(b){pt(t,t.return,b)}}function ga(e,t,n){try{var l=t.updateQueue,s=l!==null?l.lastEffect:null;if(s!==null){var c=s.next;l=c;do{if((l.tag&e)===e){var h=l.inst,b=h.destroy;if(b!==void 0){h.destroy=void 0,s=t;var S=n,_=b;try{_()}catch(H){pt(s,S,H)}}}l=l.next}while(l!==c)}}catch(H){pt(t,t.return,H)}}function bh(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{sf(t,n)}catch(l){pt(e,e.return,l)}}}function yh(e,t,n){n.props=Qa(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(l){pt(e,t,l)}}function vr(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(s){pt(e,t,s)}}function Cl(e,t){var n=e.ref,l=e.refCleanup;if(n!==null)if(typeof l=="function")try{l()}catch(s){pt(e,t,s)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(s){pt(e,t,s)}else n.current=null}function vh(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(s){pt(e,e.return,s)}}function Kc(e,t,n){try{var l=e.stateNode;Cy(l,e.type,n,t),l[en]=t}catch(s){pt(e,e.return,s)}}function xh(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ca(e.type)||e.tag===4}function Yc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||xh(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&&Ca(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 Gc(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=Tn));else if(l!==4&&(l===27&&Ca(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Gc(e,t,n),e=e.sibling;e!==null;)Gc(e,t,n),e=e.sibling}function Os(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&&Ca(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Os(e,t,n),e=e.sibling;e!==null;)Os(e,t,n),e=e.sibling}function wh(e){var t=e.stateNode,n=e.memoizedProps;try{for(var l=e.type,s=t.attributes;s.length;)t.removeAttributeNode(s[0]);un(t,l,n),t[Gt]=e,t[en]=n}catch(c){pt(e,e.return,c)}}var ql=!1,Pt=!1,qc=!1,Sh=typeof WeakSet=="function"?WeakSet:Set,ln=null;function ny(e,t){if(e=e.containerInfo,uu=lo,e=Ld(e),Oo(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 s=l.anchorOffset,c=l.focusNode;l=l.focusOffset;try{n.nodeType,c.nodeType}catch{n=null;break e}var h=0,b=-1,S=-1,_=0,H=0,F=e,L=null;t:for(;;){for(var O;F!==n||s!==0&&F.nodeType!==3||(b=h+s),F!==c||l!==0&&F.nodeType!==3||(S=h+l),F.nodeType===3&&(h+=F.nodeValue.length),(O=F.firstChild)!==null;)L=F,F=O;for(;;){if(F===e)break t;if(L===n&&++_===s&&(b=h),L===c&&++H===l&&(S=h),(O=F.nextSibling)!==null)break;F=L,L=F.parentNode}F=O}n=b===-1||S===-1?null:{start:b,end:S}}else n=null}n=n||{start:0,end:0}}else n=null;for(du={focusedElem:e,selectionRange:n},lo=!1,ln=t;ln!==null;)if(t=ln,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ln=e;else for(;ln!==null;){switch(t=ln,c=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n<e.length;n++)s=e[n],s.ref.impl=s.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&c!==null){e=void 0,n=t,s=c.memoizedProps,c=c.memoizedState,l=n.stateNode;try{var me=Qa(n.type,s);e=l.getSnapshotBeforeUpdate(me,c),l.__reactInternalSnapshotBeforeUpdate=e}catch(Re){pt(n,n.return,Re)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)mu(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":mu(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(o(163))}if(e=t.sibling,e!==null){e.return=t.return,ln=e;break}ln=t.return}}function Ch(e,t,n){var l=n.flags;switch(n.tag){case 0:case 11:case 15:Fl(e,n),l&4&&yr(5,n);break;case 1:if(Fl(e,n),l&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(h){pt(n,n.return,h)}else{var s=Qa(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(s,t,e.__reactInternalSnapshotBeforeUpdate)}catch(h){pt(n,n.return,h)}}l&64&&bh(n),l&512&&vr(n,n.return);break;case 3:if(Fl(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{sf(e,t)}catch(h){pt(n,n.return,h)}}break;case 27:t===null&&l&4&&wh(n);case 26:case 5:Fl(e,n),t===null&&l&4&&vh(n),l&512&&vr(n,n.return);break;case 12:Fl(e,n);break;case 31:Fl(e,n),l&4&&Nh(e,n);break;case 13:Fl(e,n),l&4&&Eh(e,n),l&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=dy.bind(null,n),My(e,n))));break;case 22:if(l=n.memoizedState!==null||ql,!l){t=t!==null&&t.memoizedState!==null||Pt,s=ql;var c=Pt;ql=l,(Pt=t)&&!c?Xl(e,n,(n.subtreeFlags&8772)!==0):Fl(e,n),ql=s,Pt=c}break;case 30:break;default:Fl(e,n)}}function Th(e){var t=e.alternate;t!==null&&(e.alternate=null,Th(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&_e(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 Bt=null,An=!1;function Vl(e,t,n){for(n=n.child;n!==null;)Ah(e,t,n),n=n.sibling}function Ah(e,t,n){if(Ct&&typeof Ct.onCommitFiberUnmount=="function")try{Ct.onCommitFiberUnmount(Lt,n)}catch{}switch(n.tag){case 26:Pt||Cl(n,t),Vl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Pt||Cl(n,t);var l=Bt,s=An;Ca(n.type)&&(Bt=n.stateNode,An=!1),Vl(e,t,n),kr(n.stateNode),Bt=l,An=s;break;case 5:Pt||Cl(n,t);case 6:if(l=Bt,s=An,Bt=null,Vl(e,t,n),Bt=l,An=s,Bt!==null)if(An)try{(Bt.nodeType===9?Bt.body:Bt.nodeName==="HTML"?Bt.ownerDocument.body:Bt).removeChild(n.stateNode)}catch(c){pt(n,t,c)}else try{Bt.removeChild(n.stateNode)}catch(c){pt(n,t,c)}break;case 18:Bt!==null&&(An?(e=Bt,bm(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Oi(e)):bm(Bt,n.stateNode));break;case 4:l=Bt,s=An,Bt=n.stateNode.containerInfo,An=!0,Vl(e,t,n),Bt=l,An=s;break;case 0:case 11:case 14:case 15:ga(2,n,t),Pt||ga(4,n,t),Vl(e,t,n);break;case 1:Pt||(Cl(n,t),l=n.stateNode,typeof l.componentWillUnmount=="function"&&yh(n,t,l)),Vl(e,t,n);break;case 21:Vl(e,t,n);break;case 22:Pt=(l=Pt)||n.memoizedState!==null,Vl(e,t,n),Pt=l;break;default:Vl(e,t,n)}}function Nh(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Oi(e)}catch(n){pt(t,t.return,n)}}}function Eh(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Oi(e)}catch(n){pt(t,t.return,n)}}function ly(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Sh),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Sh),t;default:throw Error(o(435,e.tag))}}function Us(e,t){var n=ly(e);t.forEach(function(l){if(!n.has(l)){n.add(l);var s=fy.bind(null,e,l);l.then(s,s)}})}function Nn(e,t){var n=t.deletions;if(n!==null)for(var l=0;l<n.length;l++){var s=n[l],c=e,h=t,b=h;e:for(;b!==null;){switch(b.tag){case 27:if(Ca(b.type)){Bt=b.stateNode,An=!1;break e}break;case 5:Bt=b.stateNode,An=!1;break e;case 3:case 4:Bt=b.stateNode.containerInfo,An=!0;break e}b=b.return}if(Bt===null)throw Error(o(160));Ah(c,h,s),Bt=null,An=!1,c=s.alternate,c!==null&&(c.return=null),s.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)kh(t,e),t=t.sibling}var rl=null;function kh(e,t){var n=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Nn(t,e),En(e),l&4&&(ga(3,e,e.return),yr(3,e),ga(5,e,e.return));break;case 1:Nn(t,e),En(e),l&512&&(Pt||n===null||Cl(n,n.return)),l&64&&ql&&(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 s=rl;if(Nn(t,e),En(e),l&512&&(Pt||n===null||Cl(n,n.return)),l&4){var c=n!==null?n.memoizedState:null;if(l=e.memoizedState,n===null)if(l===null)if(e.stateNode===null){e:{l=e.type,n=e.memoizedProps,s=s.ownerDocument||s;t:switch(l){case"title":c=s.getElementsByTagName("title")[0],(!c||c[Ne]||c[Gt]||c.namespaceURI==="http://www.w3.org/2000/svg"||c.hasAttribute("itemprop"))&&(c=s.createElement(l),s.head.insertBefore(c,s.querySelector("head > title"))),un(c,l,n),c[Gt]=e,Tt(c),l=c;break e;case"link":var h=km("link","href",s).get(l+(n.href||""));if(h){for(var b=0;b<h.length;b++)if(c=h[b],c.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&c.getAttribute("rel")===(n.rel==null?null:n.rel)&&c.getAttribute("title")===(n.title==null?null:n.title)&&c.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){h.splice(b,1);break t}}c=s.createElement(l),un(c,l,n),s.head.appendChild(c);break;case"meta":if(h=km("meta","content",s).get(l+(n.content||""))){for(b=0;b<h.length;b++)if(c=h[b],c.getAttribute("content")===(n.content==null?null:""+n.content)&&c.getAttribute("name")===(n.name==null?null:n.name)&&c.getAttribute("property")===(n.property==null?null:n.property)&&c.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&c.getAttribute("charset")===(n.charSet==null?null:n.charSet)){h.splice(b,1);break t}}c=s.createElement(l),un(c,l,n),s.head.appendChild(c);break;default:throw Error(o(468,l))}c[Gt]=e,Tt(c),l=c}e.stateNode=l}else Rm(s,e.type,e.stateNode);else e.stateNode=Em(s,l,e.memoizedProps);else c!==l?(c===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):c.count--,l===null?Rm(s,e.type,e.stateNode):Em(s,l,e.memoizedProps)):l===null&&e.stateNode!==null&&Kc(e,e.memoizedProps,n.memoizedProps)}break;case 27:Nn(t,e),En(e),l&512&&(Pt||n===null||Cl(n,n.return)),n!==null&&l&4&&Kc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Nn(t,e),En(e),l&512&&(Pt||n===null||Cl(n,n.return)),e.flags&32){s=e.stateNode;try{na(s,"")}catch(me){pt(e,e.return,me)}}l&4&&e.stateNode!=null&&(s=e.memoizedProps,Kc(e,s,n!==null?n.memoizedProps:s)),l&1024&&(qc=!0);break;case 6:if(Nn(t,e),En(e),l&4){if(e.stateNode===null)throw Error(o(162));l=e.memoizedProps,n=e.stateNode;try{n.nodeValue=l}catch(me){pt(e,e.return,me)}}break;case 3:if($s=null,s=rl,rl=Ws(t.containerInfo),Nn(t,e),rl=s,En(e),l&4&&n!==null&&n.memoizedState.isDehydrated)try{Oi(t.containerInfo)}catch(me){pt(e,e.return,me)}qc&&(qc=!1,Rh(e));break;case 4:l=rl,rl=Ws(e.stateNode.containerInfo),Nn(t,e),En(e),rl=l;break;case 12:Nn(t,e),En(e);break;case 31:Nn(t,e),En(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Us(e,l)));break;case 13:Nn(t,e),En(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Hs=le()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Us(e,l)));break;case 22:s=e.memoizedState!==null;var S=n!==null&&n.memoizedState!==null,_=ql,H=Pt;if(ql=_||s,Pt=H||S,Nn(t,e),Pt=H,ql=_,En(e),l&8192)e:for(t=e.stateNode,t._visibility=s?t._visibility&-2:t._visibility|1,s&&(n===null||S||ql||Pt||Pa(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){S=n=t;try{if(c=S.stateNode,s)h=c.style,typeof h.setProperty=="function"?h.setProperty("display","none","important"):h.display="none";else{b=S.stateNode;var F=S.memoizedProps.style,L=F!=null&&F.hasOwnProperty("display")?F.display:null;b.style.display=L==null||typeof L=="boolean"?"":(""+L).trim()}}catch(me){pt(S,S.return,me)}}}else if(t.tag===6){if(n===null){S=t;try{S.stateNode.nodeValue=s?"":S.memoizedProps}catch(me){pt(S,S.return,me)}}}else if(t.tag===18){if(n===null){S=t;try{var O=S.stateNode;s?ym(O,!0):ym(S.stateNode,!1)}catch(me){pt(S,S.return,me)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;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,Us(e,n))));break;case 19:Nn(t,e),En(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Us(e,l)));break;case 30:break;case 21:break;default:Nn(t,e),En(e)}}function En(e){var t=e.flags;if(t&2){try{for(var n,l=e.return;l!==null;){if(xh(l)){n=l;break}l=l.return}if(n==null)throw Error(o(160));switch(n.tag){case 27:var s=n.stateNode,c=Yc(e);Os(e,c,s);break;case 5:var h=n.stateNode;n.flags&32&&(na(h,""),n.flags&=-33);var b=Yc(e);Os(e,b,h);break;case 3:case 4:var S=n.stateNode.containerInfo,_=Yc(e);Gc(e,_,S);break;default:throw Error(o(161))}}catch(H){pt(e,e.return,H)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Rh(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Rh(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Fl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Ch(e,t.alternate,t),t=t.sibling}function Pa(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:ga(4,t,t.return),Pa(t);break;case 1:Cl(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&yh(t,t.return,n),Pa(t);break;case 27:kr(t.stateNode);case 26:case 5:Cl(t,t.return),Pa(t);break;case 22:t.memoizedState===null&&Pa(t);break;case 30:Pa(t);break;default:Pa(t)}e=e.sibling}}function Xl(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var l=t.alternate,s=e,c=t,h=c.flags;switch(c.tag){case 0:case 11:case 15:Xl(s,c,n),yr(4,c);break;case 1:if(Xl(s,c,n),l=c,s=l.stateNode,typeof s.componentDidMount=="function")try{s.componentDidMount()}catch(_){pt(l,l.return,_)}if(l=c,s=l.updateQueue,s!==null){var b=l.stateNode;try{var S=s.shared.hiddenCallbacks;if(S!==null)for(s.shared.hiddenCallbacks=null,s=0;s<S.length;s++)rf(S[s],b)}catch(_){pt(l,l.return,_)}}n&&h&64&&bh(c),vr(c,c.return);break;case 27:wh(c);case 26:case 5:Xl(s,c,n),n&&l===null&&h&4&&vh(c),vr(c,c.return);break;case 12:Xl(s,c,n);break;case 31:Xl(s,c,n),n&&h&4&&Nh(s,c);break;case 13:Xl(s,c,n),n&&h&4&&Eh(s,c);break;case 22:c.memoizedState===null&&Xl(s,c,n),vr(c,c.return);break;case 30:break;default:Xl(s,c,n)}t=t.sibling}}function Vc(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&&ir(n))}function Fc(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ir(e))}function sl(e,t,n,l){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)jh(e,t,n,l),t=t.sibling}function jh(e,t,n,l){var s=t.flags;switch(t.tag){case 0:case 11:case 15:sl(e,t,n,l),s&2048&&yr(9,t);break;case 1:sl(e,t,n,l);break;case 3:sl(e,t,n,l),s&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ir(e)));break;case 12:if(s&2048){sl(e,t,n,l),e=t.stateNode;try{var c=t.memoizedProps,h=c.id,b=c.onPostCommit;typeof b=="function"&&b(h,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(S){pt(t,t.return,S)}}else sl(e,t,n,l);break;case 31:sl(e,t,n,l);break;case 13:sl(e,t,n,l);break;case 23:break;case 22:c=t.stateNode,h=t.alternate,t.memoizedState!==null?c._visibility&2?sl(e,t,n,l):xr(e,t):c._visibility&2?sl(e,t,n,l):(c._visibility|=2,Ai(e,t,n,l,(t.subtreeFlags&10256)!==0||!1)),s&2048&&Vc(h,t);break;case 24:sl(e,t,n,l),s&2048&&Fc(t.alternate,t);break;default:sl(e,t,n,l)}}function Ai(e,t,n,l,s){for(s=s&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var c=e,h=t,b=n,S=l,_=h.flags;switch(h.tag){case 0:case 11:case 15:Ai(c,h,b,S,s),yr(8,h);break;case 23:break;case 22:var H=h.stateNode;h.memoizedState!==null?H._visibility&2?Ai(c,h,b,S,s):xr(c,h):(H._visibility|=2,Ai(c,h,b,S,s)),s&&_&2048&&Vc(h.alternate,h);break;case 24:Ai(c,h,b,S,s),s&&_&2048&&Fc(h.alternate,h);break;default:Ai(c,h,b,S,s)}t=t.sibling}}function xr(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,l=t,s=l.flags;switch(l.tag){case 22:xr(n,l),s&2048&&Vc(l.alternate,l);break;case 24:xr(n,l),s&2048&&Fc(l.alternate,l);break;default:xr(n,l)}t=t.sibling}}var wr=8192;function Ni(e,t,n){if(e.subtreeFlags&wr)for(e=e.child;e!==null;)Mh(e,t,n),e=e.sibling}function Mh(e,t,n){switch(e.tag){case 26:Ni(e,t,n),e.flags&wr&&e.memoizedState!==null&&qy(n,rl,e.memoizedState,e.memoizedProps);break;case 5:Ni(e,t,n);break;case 3:case 4:var l=rl;rl=Ws(e.stateNode.containerInfo),Ni(e,t,n),rl=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=wr,wr=16777216,Ni(e,t,n),wr=l):Ni(e,t,n));break;default:Ni(e,t,n)}}function _h(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Sr(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var l=t[n];ln=l,zh(l,e)}_h(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Lh(e),e=e.sibling}function Lh(e){switch(e.tag){case 0:case 11:case 15:Sr(e),e.flags&2048&&ga(9,e,e.return);break;case 3:Sr(e);break;case 12:Sr(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Bs(e)):Sr(e);break;default:Sr(e)}}function Bs(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];ln=l,zh(l,e)}_h(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:ga(8,t,t.return),Bs(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Bs(t));break;default:Bs(t)}e=e.sibling}}function zh(e,t){for(;ln!==null;){var n=ln;switch(n.tag){case 0:case 11:case 15:ga(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:ir(n.memoizedState.cache)}if(l=n.child,l!==null)l.return=n,ln=l;else e:for(n=e;ln!==null;){l=ln;var s=l.sibling,c=l.return;if(Th(l),l===n){ln=null;break e}if(s!==null){s.return=c,ln=s;break e}ln=c}}}var ay={getCacheForType:function(e){var t=on(It),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return on(It).controller.signal}},iy=typeof WeakMap=="function"?WeakMap:Map,dt=0,Et=null,$e=null,tt=0,mt=0,Kn=null,ba=!1,Ei=!1,Xc=!1,Il=0,Kt=0,ya=0,Wa=0,Ic=0,Yn=0,ki=0,Cr=null,kn=null,Zc=!1,Hs=0,Dh=0,Ks=1/0,Ys=null,va=null,Jt=0,xa=null,Ri=null,Zl=0,Qc=0,Pc=null,Oh=null,Tr=0,Wc=null;function Gn(){return(dt&2)!==0&&tt!==0?tt&-tt:E.T!==null?lu():jl()}function Uh(){if(Yn===0)if((tt&536870912)===0||rt){var e=an;an<<=1,(an&3932160)===0&&(an=262144),Yn=e}else Yn=536870912;return e=Bn.current,e!==null&&(e.flags|=32),Yn}function Rn(e,t,n){(e===Et&&(mt===2||mt===9)||e.cancelPendingCommit!==null)&&(ji(e,0),wa(e,tt,Yn,!1)),Ln(e,n),((dt&2)===0||e!==Et)&&(e===Et&&((dt&2)===0&&(Wa|=n),Kt===4&&wa(e,tt,Yn,!1)),Tl(e))}function Bh(e,t,n){if((dt&6)!==0)throw Error(o(327));var l=!n&&(t&127)===0&&(t&e.expiredLanes)===0||pl(e,t),s=l?oy(e,t):$c(e,t,!0),c=l;do{if(s===0){Ei&&!l&&wa(e,t,0,!1);break}else{if(n=e.current.alternate,c&&!ry(n)){s=$c(e,t,!1),c=!1;continue}if(s===2){if(c=t,e.errorRecoveryDisabledLanes&c)var h=0;else h=e.pendingLanes&-536870913,h=h!==0?h:h&536870912?536870912:0;if(h!==0){t=h;e:{var b=e;s=Cr;var S=b.current.memoizedState.isDehydrated;if(S&&(ji(b,h).flags|=256),h=$c(b,h,!1),h!==2){if(Xc&&!S){b.errorRecoveryDisabledLanes|=c,Wa|=c,s=4;break e}c=kn,kn=s,c!==null&&(kn===null?kn=c:kn.push.apply(kn,c))}s=h}if(c=!1,s!==2)continue}}if(s===1){ji(e,0),wa(e,t,0,!0);break}e:{switch(l=e,c=s,c){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t)break;case 6:wa(l,t,Yn,!ba);break e;case 2:kn=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(s=Hs+300-le(),10<s)){if(wa(l,t,Yn,!ba),Rl(l,0,!0)!==0)break e;Zl=t,l.timeoutHandle=pm(Hh.bind(null,l,n,kn,Ys,Zc,t,Yn,Wa,ki,ba,c,"Throttled",-0,0),s);break e}Hh(l,n,kn,Ys,Zc,t,Yn,Wa,ki,ba,c,null,-0,0)}}break}while(!0);Tl(e)}function Hh(e,t,n,l,s,c,h,b,S,_,H,F,L,O){if(e.timeoutHandle=-1,F=t.subtreeFlags,F&8192||(F&16785408)===16785408){F={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Tn},Mh(t,c,F);var me=(c&62914560)===c?Hs-le():(c&4194048)===c?Dh-le():0;if(me=Vy(F,me),me!==null){Zl=c,e.cancelPendingCommit=me(Ih.bind(null,e,t,c,n,l,s,h,b,S,H,F,null,L,O)),wa(e,c,h,!_);return}}Ih(e,t,c,n,l,s,h,b,S)}function ry(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 s=n[l],c=s.getSnapshot;s=s.value;try{if(!On(c(),s))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 wa(e,t,n,l){t&=~Ic,t&=~Wa,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var s=t;0<s;){var c=31-it(s),h=1<<c;l[c]=-1,s&=~h}n!==0&&La(e,n,t)}function Gs(){return(dt&6)===0?(Ar(0),!1):!0}function Jc(){if($e!==null){if(mt===0)var e=$e.return;else e=$e,Ul=Ga=null,mc(e),xi=null,sr=0,e=$e;for(;e!==null;)gh(e.alternate,e),e=e.return;$e=null}}function ji(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Ny(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Zl=0,Jc(),Et=e,$e=n=Dl(e.current,null),tt=t,mt=0,Kn=null,ba=!1,Ei=pl(e,t),Xc=!1,ki=Yn=Ic=Wa=ya=Kt=0,kn=Cr=null,Zc=!1,(t&8)!==0&&(t|=t&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=t;0<l;){var s=31-it(l),c=1<<s;t|=e[s],l&=~c}return Il=t,cs(),n}function Kh(e,t){Ye=null,E.H=pr,t===vi||t===bs?(t=tf(),mt=3):t===nc?(t=tf(),mt=4):mt=t===jc?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Kn=t,$e===null&&(Kt=1,Ms(e,Fn(t,e.current)))}function Yh(){var e=Bn.current;return e===null?!0:(tt&4194048)===tt?Qn===null:(tt&62914560)===tt||(tt&536870912)!==0?e===Qn:!1}function Gh(){var e=E.H;return E.H=pr,e===null?pr:e}function qh(){var e=E.A;return E.A=ay,e}function qs(){Kt=4,ba||(tt&4194048)!==tt&&Bn.current!==null||(Ei=!0),(ya&134217727)===0&&(Wa&134217727)===0||Et===null||wa(Et,tt,Yn,!1)}function $c(e,t,n){var l=dt;dt|=2;var s=Gh(),c=qh();(Et!==e||tt!==t)&&(Ys=null,ji(e,t)),t=!1;var h=Kt;e:do try{if(mt!==0&&$e!==null){var b=$e,S=Kn;switch(mt){case 8:Jc(),h=6;break e;case 3:case 2:case 9:case 6:Bn.current===null&&(t=!0);var _=mt;if(mt=0,Kn=null,Mi(e,b,S,_),n&&Ei){h=0;break e}break;default:_=mt,mt=0,Kn=null,Mi(e,b,S,_)}}sy(),h=Kt;break}catch(H){Kh(e,H)}while(!0);return t&&e.shellSuspendCounter++,Ul=Ga=null,dt=l,E.H=s,E.A=c,$e===null&&(Et=null,tt=0,cs()),h}function sy(){for(;$e!==null;)Vh($e)}function oy(e,t){var n=dt;dt|=2;var l=Gh(),s=qh();Et!==e||tt!==t?(Ys=null,Ks=le()+500,ji(e,t)):Ei=pl(e,t);e:do try{if(mt!==0&&$e!==null){t=$e;var c=Kn;t:switch(mt){case 1:mt=0,Kn=null,Mi(e,t,c,1);break;case 2:case 9:if($d(c)){mt=0,Kn=null,Fh(t);break}t=function(){mt!==2&&mt!==9||Et!==e||(mt=7),Tl(e)},c.then(t,t);break e;case 3:mt=7;break e;case 4:mt=5;break e;case 7:$d(c)?(mt=0,Kn=null,Fh(t)):(mt=0,Kn=null,Mi(e,t,c,7));break;case 5:var h=null;switch($e.tag){case 26:h=$e.memoizedState;case 5:case 27:var b=$e;if(h?jm(h):b.stateNode.complete){mt=0,Kn=null;var S=b.sibling;if(S!==null)$e=S;else{var _=b.return;_!==null?($e=_,Vs(_)):$e=null}break t}}mt=0,Kn=null,Mi(e,t,c,5);break;case 6:mt=0,Kn=null,Mi(e,t,c,6);break;case 8:Jc(),Kt=6;break e;default:throw Error(o(462))}}cy();break}catch(H){Kh(e,H)}while(!0);return Ul=Ga=null,E.H=l,E.A=s,dt=n,$e!==null?0:(Et=null,tt=0,cs(),Kt)}function cy(){for(;$e!==null&&!ft();)Vh($e)}function Vh(e){var t=mh(e.alternate,e,Il);e.memoizedProps=e.pendingProps,t===null?Vs(e):$e=t}function Fh(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=oh(n,t,t.pendingProps,t.type,void 0,tt);break;case 11:t=oh(n,t,t.pendingProps,t.type.render,t.ref,tt);break;case 5:mc(t);default:gh(n,t),t=$e=Gd(t,Il),t=mh(n,t,Il)}e.memoizedProps=e.pendingProps,t===null?Vs(e):$e=t}function Mi(e,t,n,l){Ul=Ga=null,mc(t),xi=null,sr=0;var s=t.return;try{if(Wb(e,s,t,n,tt)){Kt=1,Ms(e,Fn(n,e.current)),$e=null;return}}catch(c){if(s!==null)throw $e=s,c;Kt=1,Ms(e,Fn(n,e.current)),$e=null;return}t.flags&32768?(rt||l===1?e=!0:Ei||(tt&536870912)!==0?e=!1:(ba=e=!0,(l===2||l===9||l===3||l===6)&&(l=Bn.current,l!==null&&l.tag===13&&(l.flags|=16384))),Xh(t,e)):Vs(t)}function Vs(e){var t=e;do{if((t.flags&32768)!==0){Xh(t,ba);return}e=t.return;var n=ey(t.alternate,t,Il);if(n!==null){$e=n;return}if(t=t.sibling,t!==null){$e=t;return}$e=t=e}while(t!==null);Kt===0&&(Kt=5)}function Xh(e,t){do{var n=ty(e.alternate,e);if(n!==null){n.flags&=32767,$e=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){$e=e;return}$e=e=n}while(e!==null);Kt=6,$e=null}function Ih(e,t,n,l,s,c,h,b,S){e.cancelPendingCommit=null;do Fs();while(Jt!==0);if((dt&6)!==0)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));if(c=t.lanes|t.childLanes,c|=Yo,Zi(e,n,c,h,b,S),e===Et&&($e=Et=null,tt=0),Ri=t,xa=e,Zl=n,Qc=c,Pc=s,Oh=l,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,hy(Yt,function(){return Jh(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||l){l=E.T,E.T=null,s=B.p,B.p=2,h=dt,dt|=4;try{ny(e,t,n)}finally{dt=h,B.p=s,E.T=l}}Jt=1,Zh(),Qh(),Ph()}}function Zh(){if(Jt===1){Jt=0;var e=xa,t=Ri,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=E.T,E.T=null;var l=B.p;B.p=2;var s=dt;dt|=4;try{kh(t,e);var c=du,h=Ld(e.containerInfo),b=c.focusedElem,S=c.selectionRange;if(h!==b&&b&&b.ownerDocument&&_d(b.ownerDocument.documentElement,b)){if(S!==null&&Oo(b)){var _=S.start,H=S.end;if(H===void 0&&(H=_),"selectionStart"in b)b.selectionStart=_,b.selectionEnd=Math.min(H,b.value.length);else{var F=b.ownerDocument||document,L=F&&F.defaultView||window;if(L.getSelection){var O=L.getSelection(),me=b.textContent.length,Re=Math.min(S.start,me),xt=S.end===void 0?Re:Math.min(S.end,me);!O.extend&&Re>xt&&(h=xt,xt=Re,Re=h);var N=Md(b,Re),C=Md(b,xt);if(N&&C&&(O.rangeCount!==1||O.anchorNode!==N.node||O.anchorOffset!==N.offset||O.focusNode!==C.node||O.focusOffset!==C.offset)){var M=F.createRange();M.setStart(N.node,N.offset),O.removeAllRanges(),Re>xt?(O.addRange(M),O.extend(C.node,C.offset)):(M.setEnd(C.node,C.offset),O.addRange(M))}}}}for(F=[],O=b;O=O.parentNode;)O.nodeType===1&&F.push({element:O,left:O.scrollLeft,top:O.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b<F.length;b++){var q=F[b];q.element.scrollLeft=q.left,q.element.scrollTop=q.top}}lo=!!uu,du=uu=null}finally{dt=s,B.p=l,E.T=n}}e.current=t,Jt=2}}function Qh(){if(Jt===2){Jt=0;var e=xa,t=Ri,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=E.T,E.T=null;var l=B.p;B.p=2;var s=dt;dt|=4;try{Ch(e,t.alternate,t)}finally{dt=s,B.p=l,E.T=n}}Jt=3}}function Ph(){if(Jt===4||Jt===3){Jt=0,St();var e=xa,t=Ri,n=Zl,l=Oh;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?Jt=5:(Jt=0,Ri=xa=null,Wh(e,e.pendingLanes));var s=e.pendingLanes;if(s===0&&(va=null),gl(n),t=t.stateNode,Ct&&typeof Ct.onCommitFiberRoot=="function")try{Ct.onCommitFiberRoot(Lt,t,void 0,(t.current.flags&128)===128)}catch{}if(l!==null){t=E.T,s=B.p,B.p=2,E.T=null;try{for(var c=e.onRecoverableError,h=0;h<l.length;h++){var b=l[h];c(b.value,{componentStack:b.stack})}}finally{E.T=t,B.p=s}}(Zl&3)!==0&&Fs(),Tl(e),s=e.pendingLanes,(n&261930)!==0&&(s&42)!==0?e===Wc?Tr++:(Tr=0,Wc=e):Tr=0,Ar(0)}}function Wh(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ir(t)))}function Fs(){return Zh(),Qh(),Ph(),Jh()}function Jh(){if(Jt!==5)return!1;var e=xa,t=Qc;Qc=0;var n=gl(Zl),l=E.T,s=B.p;try{B.p=32>n?32:n,E.T=null,n=Pc,Pc=null;var c=xa,h=Zl;if(Jt=0,Ri=xa=null,Zl=0,(dt&6)!==0)throw Error(o(331));var b=dt;if(dt|=4,Lh(c.current),jh(c,c.current,h,n),dt=b,Ar(0,!1),Ct&&typeof Ct.onPostCommitFiberRoot=="function")try{Ct.onPostCommitFiberRoot(Lt,c)}catch{}return!0}finally{B.p=s,E.T=l,Wh(e,t)}}function $h(e,t,n){t=Fn(n,t),t=Rc(e.stateNode,t,2),e=ha(e,t,2),e!==null&&(Ln(e,2),Tl(e))}function pt(e,t,n){if(e.tag===3)$h(e,e,n);else for(;t!==null;){if(t.tag===3){$h(t,e,n);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(va===null||!va.has(l))){e=Fn(n,e),n=eh(2),l=ha(t,n,2),l!==null&&(th(n,l,t,e),Ln(l,2),Tl(l));break}}t=t.return}}function eu(e,t,n){var l=e.pingCache;if(l===null){l=e.pingCache=new iy;var s=new Set;l.set(t,s)}else s=l.get(t),s===void 0&&(s=new Set,l.set(t,s));s.has(n)||(Xc=!0,s.add(n),e=uy.bind(null,e,t,n),t.then(e,e))}function uy(e,t,n){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Et===e&&(tt&n)===n&&(Kt===4||Kt===3&&(tt&62914560)===tt&&300>le()-Hs?(dt&2)===0&&ji(e,0):Ic|=n,ki===tt&&(ki=0)),Tl(e)}function em(e,t){t===0&&(t=_n()),e=Ha(e,t),e!==null&&(Ln(e,t),Tl(e))}function dy(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),em(e,n)}function fy(e,t){var n=0;switch(e.tag){case 31:case 13:var l=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(o(314))}l!==null&&l.delete(t),em(e,n)}function hy(e,t){return Je(e,t)}var Xs=null,_i=null,tu=!1,Is=!1,nu=!1,Sa=0;function Tl(e){e!==_i&&e.next===null&&(_i===null?Xs=_i=e:_i=_i.next=e),Is=!0,tu||(tu=!0,py())}function Ar(e,t){if(!nu&&Is){nu=!0;do for(var n=!1,l=Xs;l!==null;){if(e!==0){var s=l.pendingLanes;if(s===0)var c=0;else{var h=l.suspendedLanes,b=l.pingedLanes;c=(1<<31-it(42|e)+1)-1,c&=s&~(h&~b),c=c&201326741?c&201326741|1:c?c|2:0}c!==0&&(n=!0,am(l,c))}else c=tt,c=Rl(l,l===Et?c:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(c&3)===0||pl(l,c)||(n=!0,am(l,c));l=l.next}while(n);nu=!1}}function my(){tm()}function tm(){Is=tu=!1;var e=0;Sa!==0&&Ay()&&(e=Sa);for(var t=le(),n=null,l=Xs;l!==null;){var s=l.next,c=nm(l,t);c===0?(l.next=null,n===null?Xs=s:n.next=s,s===null&&(_i=n)):(n=l,(e!==0||(c&3)!==0)&&(Is=!0)),l=s}Jt!==0&&Jt!==5||Ar(e),Sa!==0&&(Sa=0)}function nm(e,t){for(var n=e.suspendedLanes,l=e.pingedLanes,s=e.expirationTimes,c=e.pendingLanes&-62914561;0<c;){var h=31-it(c),b=1<<h,S=s[h];S===-1?((b&n)===0||(b&l)!==0)&&(s[h]=tl(b,t)):S<=t&&(e.expiredLanes|=b),c&=~b}if(t=Et,n=tt,n=Rl(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,n===0||e===t&&(mt===2||mt===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&bt(l),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||pl(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(l!==null&&bt(l),gl(n)){case 2:case 8:n=ot;break;case 32:n=Yt;break;case 268435456:n=Qe;break;default:n=Yt}return l=lm.bind(null,e),n=Je(n,l),e.callbackPriority=t,e.callbackNode=n,t}return l!==null&&l!==null&&bt(l),e.callbackPriority=2,e.callbackNode=null,2}function lm(e,t){if(Jt!==0&&Jt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Fs()&&e.callbackNode!==n)return null;var l=tt;return l=Rl(e,e===Et?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(Bh(e,l,t),nm(e,le()),e.callbackNode!=null&&e.callbackNode===n?lm.bind(null,e):null)}function am(e,t){if(Fs())return null;Bh(e,t,!0)}function py(){Ey(function(){(dt&6)!==0?Je(De,my):tm()})}function lu(){if(Sa===0){var e=bi;e===0&&(e=kl,kl<<=1,(kl&261888)===0&&(kl=256)),Sa=e}return Sa}function im(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Da(""+e)}function rm(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 gy(e,t,n,l,s){if(t==="submit"&&n&&n.stateNode===s){var c=im((s[en]||null).action),h=l.submitter;h&&(t=(t=h[en]||null)?im(t.formAction):h.getAttribute("formAction"),t!==null&&(c=t,h=null));var b=new Oa("action","action",null,l,s);e.push({event:b,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Sa!==0){var S=h?rm(s,h):new FormData(s);Cc(n,{pending:!0,data:S,method:s.method,action:c},null,S)}}else typeof c=="function"&&(b.preventDefault(),S=h?rm(s,h):new FormData(s),Cc(n,{pending:!0,data:S,method:s.method,action:c},c,S))},currentTarget:s}]})}}for(var au=0;au<Ko.length;au++){var iu=Ko[au],by=iu.toLowerCase(),yy=iu[0].toUpperCase()+iu.slice(1);il(by,"on"+yy)}il(Od,"onAnimationEnd"),il(Ud,"onAnimationIteration"),il(Bd,"onAnimationStart"),il("dblclick","onDoubleClick"),il("focusin","onFocus"),il("focusout","onBlur"),il(zb,"onTransitionRun"),il(Db,"onTransitionStart"),il(Ob,"onTransitionCancel"),il(Hd,"onTransitionEnd"),Ml("onMouseEnter",["mouseout","mouseover"]),Ml("onMouseLeave",["mouseout","mouseover"]),Ml("onPointerEnter",["pointerout","pointerover"]),Ml("onPointerLeave",["pointerout","pointerover"]),yl("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),yl("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),yl("onBeforeInput",["compositionend","keypress","textInput","paste"]),yl("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),yl("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),yl("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Nr="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(" "),vy=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Nr));function sm(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var l=e[n],s=l.event;l=l.listeners;e:{var c=void 0;if(t)for(var h=l.length-1;0<=h;h--){var b=l[h],S=b.instance,_=b.currentTarget;if(b=b.listener,S!==c&&s.isPropagationStopped())break e;c=b,s.currentTarget=_;try{c(s)}catch(H){os(H)}s.currentTarget=null,c=S}else for(h=0;h<l.length;h++){if(b=l[h],S=b.instance,_=b.currentTarget,b=b.listener,S!==c&&s.isPropagationStopped())break e;c=b,s.currentTarget=_;try{c(s)}catch(H){os(H)}s.currentTarget=null,c=S}}}}function et(e,t){var n=t[D];n===void 0&&(n=t[D]=new Set);var l=e+"__bubble";n.has(l)||(om(t,e,2,!1),n.add(l))}function ru(e,t,n){var l=0;t&&(l|=4),om(n,e,l,t)}var Zs="_reactListening"+Math.random().toString(36).slice(2);function su(e){if(!e[Zs]){e[Zs]=!0,Sn.forEach(function(n){n!=="selectionchange"&&(vy.has(n)||ru(n,!1,e),ru(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Zs]||(t[Zs]=!0,ru("selectionchange",!1,t))}}function om(e,t,n,l){switch(Um(t)){case 2:var s=Iy;break;case 8:s=Zy;break;default:s=Su}n=s.bind(null,t,n,e),s=void 0,!hn||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),l?s!==void 0?e.addEventListener(t,n,{capture:!0,passive:s}):e.addEventListener(t,n,!0):s!==void 0?e.addEventListener(t,n,{passive:s}):e.addEventListener(t,n,!1)}function ou(e,t,n,l,s){var c=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 b=l.stateNode.containerInfo;if(b===s)break;if(h===4)for(h=l.return;h!==null;){var S=h.tag;if((S===3||S===4)&&h.stateNode.containerInfo===s)return;h=h.return}for(;b!==null;){if(h=Ie(b),h===null)return;if(S=h.tag,S===5||S===6||S===26||S===27){l=c=h;continue e}b=b.parentNode}}l=l.return}Be(function(){var _=c,H=aa(n),F=[];e:{var L=Kd.get(e);if(L!==void 0){var O=Oa,me=e;switch(e){case"keypress":if(mn(n)===0)break e;case"keydown":case"keyup":O=fb;break;case"focusin":me="focus",O=Mo;break;case"focusout":me="blur",O=Mo;break;case"beforeblur":case"afterblur":O=Mo;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":O=pd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":O=eb;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":O=pb;break;case Od:case Ud:case Bd:O=lb;break;case Hd:O=bb;break;case"scroll":case"scrollend":O=is;break;case"wheel":O=vb;break;case"copy":case"cut":case"paste":O=ib;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":O=bd;break;case"toggle":case"beforetoggle":O=wb}var Re=(t&4)!==0,xt=!Re&&(e==="scroll"||e==="scrollend"),N=Re?L!==null?L+"Capture":null:L;Re=[];for(var C=_,M;C!==null;){var q=C;if(M=q.stateNode,q=q.tag,q!==5&&q!==26&&q!==27||M===null||N===null||(q=At(C,N),q!=null&&Re.push(Er(C,q,M))),xt)break;C=C.return}0<Re.length&&(L=new O(L,me,null,n,H),F.push({event:L,listeners:Re}))}}if((t&7)===0){e:{if(L=e==="mouseover"||e==="pointerover",O=e==="mouseout"||e==="pointerout",L&&n!==la&&(me=n.relatedTarget||n.fromElement)&&(Ie(me)||me[bl]))break e;if((O||L)&&(L=H.window===H?H:(L=H.ownerDocument)?L.defaultView||L.parentWindow:window,O?(me=n.relatedTarget||n.toElement,O=_,me=me?Ie(me):null,me!==null&&(xt=f(me),Re=me.tag,me!==xt||Re!==5&&Re!==27&&Re!==6)&&(me=null)):(O=null,me=_),O!==me)){if(Re=pd,q="onMouseLeave",N="onMouseEnter",C="mouse",(e==="pointerout"||e==="pointerover")&&(Re=bd,q="onPointerLeave",N="onPointerEnter",C="pointer"),xt=O==null?L:kt(O),M=me==null?L:kt(me),L=new Re(q,C+"leave",O,n,H),L.target=xt,L.relatedTarget=M,q=null,Ie(H)===_&&(Re=new Re(N,C+"enter",me,n,H),Re.target=M,Re.relatedTarget=xt,q=Re),xt=q,O&&me)t:{for(Re=xy,N=O,C=me,M=0,q=N;q;q=Re(q))M++;q=0;for(var Ee=C;Ee;Ee=Re(Ee))q++;for(;0<M-q;)N=Re(N),M--;for(;0<q-M;)C=Re(C),q--;for(;M--;){if(N===C||C!==null&&N===C.alternate){Re=N;break t}N=Re(N),C=Re(C)}Re=null}else Re=null;O!==null&&cm(F,L,O,Re,!1),me!==null&&xt!==null&&cm(F,xt,me,Re,!0)}}e:{if(L=_?kt(_):window,O=L.nodeName&&L.nodeName.toLowerCase(),O==="select"||O==="input"&&L.type==="file")var ct=Ad;else if(Cd(L))if(Nd)ct=Mb;else{ct=Rb;var xe=kb}else O=L.nodeName,!O||O.toLowerCase()!=="input"||L.type!=="checkbox"&&L.type!=="radio"?_&&_l(_.elementType)&&(ct=Ad):ct=jb;if(ct&&(ct=ct(e,_))){Td(F,ct,n,H);break e}xe&&xe(e,L,_),e==="focusout"&&_&&L.type==="number"&&_.memoizedProps.value!=null&&Pi(L,"number",L.value)}switch(xe=_?kt(_):window,e){case"focusin":(Cd(xe)||xe.contentEditable==="true")&&(ci=xe,Uo=_,nr=null);break;case"focusout":nr=Uo=ci=null;break;case"mousedown":Bo=!0;break;case"contextmenu":case"mouseup":case"dragend":Bo=!1,zd(F,n,H);break;case"selectionchange":if(Lb)break;case"keydown":case"keyup":zd(F,n,H)}var Ve;if(Lo)e:{switch(e){case"compositionstart":var nt="onCompositionStart";break e;case"compositionend":nt="onCompositionEnd";break e;case"compositionupdate":nt="onCompositionUpdate";break e}nt=void 0}else oi?wd(e,n)&&(nt="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(nt="onCompositionStart");nt&&(yd&&n.locale!=="ko"&&(oi||nt!=="onCompositionStart"?nt==="onCompositionEnd"&&oi&&(Ve=Dn()):(Ut=H,Nt="value"in Ut?Ut.value:Ut.textContent,oi=!0)),xe=Qs(_,nt),0<xe.length&&(nt=new gd(nt,e,null,n,H),F.push({event:nt,listeners:xe}),Ve?nt.data=Ve:(Ve=Sd(n),Ve!==null&&(nt.data=Ve)))),(Ve=Cb?Tb(e,n):Ab(e,n))&&(nt=Qs(_,"onBeforeInput"),0<nt.length&&(xe=new gd("onBeforeInput","beforeinput",null,n,H),F.push({event:xe,listeners:nt}),xe.data=Ve)),gy(F,e,_,n,H)}sm(F,t)})}function Er(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Qs(e,t){for(var n=t+"Capture",l=[];e!==null;){var s=e,c=s.stateNode;if(s=s.tag,s!==5&&s!==26&&s!==27||c===null||(s=At(e,n),s!=null&&l.unshift(Er(e,s,c)),s=At(e,t),s!=null&&l.push(Er(e,s,c))),e.tag===3)return l;e=e.return}return[]}function xy(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function cm(e,t,n,l,s){for(var c=t._reactName,h=[];n!==null&&n!==l;){var b=n,S=b.alternate,_=b.stateNode;if(b=b.tag,S!==null&&S===l)break;b!==5&&b!==26&&b!==27||_===null||(S=_,s?(_=At(n,c),_!=null&&h.unshift(Er(n,_,S))):s||(_=At(n,c),_!=null&&h.push(Er(n,_,S)))),n=n.return}h.length!==0&&e.push({event:t,listeners:h})}var wy=/\r\n?/g,Sy=/\u0000|\uFFFD/g;function um(e){return(typeof e=="string"?e:""+e).replace(wy,`
33
+ `).replace(Sy,"")}function dm(e,t){return t=um(t),um(e)===t}function vt(e,t,n,l,s,c){switch(n){case"children":typeof l=="string"?t==="body"||t==="textarea"&&l===""||na(e,l):(typeof l=="number"||typeof l=="bigint")&&t!=="body"&&na(e,""+l);break;case"className":ie(e,"class",l);break;case"tabIndex":ie(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":ie(e,n,l);break;case"style":ls(e,l,c);break;case"data":if(t!=="object"){ie(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=Da(""+l),e.setAttribute(n,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(n,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof c=="function"&&(n==="formAction"?(t!=="input"&&vt(e,t,"name",s.name,s,null),vt(e,t,"formEncType",s.formEncType,s,null),vt(e,t,"formMethod",s.formMethod,s,null),vt(e,t,"formTarget",s.formTarget,s,null)):(vt(e,t,"encType",s.encType,s,null),vt(e,t,"method",s.method,s,null),vt(e,t,"target",s.target,s,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(n);break}l=Da(""+l),e.setAttribute(n,l);break;case"onClick":l!=null&&(e.onclick=Tn);break;case"onScroll":l!=null&&et("scroll",e);break;case"onScrollEnd":l!=null&&et("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(o(61));if(n=l.__html,n!=null){if(s.children!=null)throw Error(o(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=Da(""+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":et("beforetoggle",e),et("toggle",e),qe(e,"popover",l);break;case"xlinkActuate":zt(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":zt(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":zt(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":zt(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":zt(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":zt(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":zt(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":zt(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":zt(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":qe(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=al.get(n)||n,qe(e,n,l))}}function cu(e,t,n,l,s,c){switch(n){case"style":ls(e,l,c);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(o(61));if(n=l.__html,n!=null){if(s.children!=null)throw Error(o(60));e.innerHTML=n}}break;case"children":typeof l=="string"?na(e,l):(typeof l=="number"||typeof l=="bigint")&&na(e,""+l);break;case"onScroll":l!=null&&et("scroll",e);break;case"onScrollEnd":l!=null&&et("scrollend",e);break;case"onClick":l!=null&&(e.onclick=Tn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!za.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(s=n.endsWith("Capture"),t=n.slice(2,s?n.length-7:void 0),c=e[en]||null,c=c!=null?c[n]:null,typeof c=="function"&&e.removeEventListener(t,c,s),typeof l=="function")){typeof c!="function"&&c!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,l,s);break e}n in e?e[n]=l:l===!0?e.setAttribute(n,""):qe(e,n,l)}}}function un(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":et("error",e),et("load",e);var l=!1,s=!1,c;for(c in n)if(n.hasOwnProperty(c)){var h=n[c];if(h!=null)switch(c){case"src":l=!0;break;case"srcSet":s=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:vt(e,t,c,h,n,null)}}s&&vt(e,t,"srcSet",n.srcSet,n,null),l&&vt(e,t,"src",n.src,n,null);return;case"input":et("invalid",e);var b=c=h=s=null,S=null,_=null;for(l in n)if(n.hasOwnProperty(l)){var H=n[l];if(H!=null)switch(l){case"name":s=H;break;case"type":h=H;break;case"checked":S=H;break;case"defaultChecked":_=H;break;case"value":c=H;break;case"defaultValue":b=H;break;case"children":case"dangerouslySetInnerHTML":if(H!=null)throw Error(o(137,t));break;default:vt(e,t,l,H,n,null)}}$r(e,c,b,S,_,h,s,!1);return;case"select":et("invalid",e),l=h=c=null;for(s in n)if(n.hasOwnProperty(s)&&(b=n[s],b!=null))switch(s){case"value":c=b;break;case"defaultValue":h=b;break;case"multiple":l=b;default:vt(e,t,s,b,n,null)}t=c,n=h,e.multiple=!!l,t!=null?ta(e,!!l,t,!1):n!=null&&ta(e,!!l,n,!0);return;case"textarea":et("invalid",e),c=s=l=null;for(h in n)if(n.hasOwnProperty(h)&&(b=n[h],b!=null))switch(h){case"value":l=b;break;case"defaultValue":s=b;break;case"children":c=b;break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(o(91));break;default:vt(e,t,h,b,n,null)}ts(e,l,s,c);return;case"option":for(S in n)if(n.hasOwnProperty(S)&&(l=n[S],l!=null))switch(S){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:vt(e,t,S,l,n,null)}return;case"dialog":et("beforetoggle",e),et("toggle",e),et("cancel",e),et("close",e);break;case"iframe":case"object":et("load",e);break;case"video":case"audio":for(l=0;l<Nr.length;l++)et(Nr[l],e);break;case"image":et("error",e),et("load",e);break;case"details":et("toggle",e);break;case"embed":case"source":case"link":et("error",e),et("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(_ in n)if(n.hasOwnProperty(_)&&(l=n[_],l!=null))switch(_){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:vt(e,t,_,l,n,null)}return;default:if(_l(t)){for(H in n)n.hasOwnProperty(H)&&(l=n[H],l!==void 0&&cu(e,t,H,l,n,void 0));return}}for(b in n)n.hasOwnProperty(b)&&(l=n[b],l!=null&&vt(e,t,b,l,n,null))}function Cy(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 s=null,c=null,h=null,b=null,S=null,_=null,H=null;for(O in n){var F=n[O];if(n.hasOwnProperty(O)&&F!=null)switch(O){case"checked":break;case"value":break;case"defaultValue":S=F;default:l.hasOwnProperty(O)||vt(e,t,O,null,l,F)}}for(var L in l){var O=l[L];if(F=n[L],l.hasOwnProperty(L)&&(O!=null||F!=null))switch(L){case"type":c=O;break;case"name":s=O;break;case"checked":_=O;break;case"defaultChecked":H=O;break;case"value":h=O;break;case"defaultValue":b=O;break;case"children":case"dangerouslySetInnerHTML":if(O!=null)throw Error(o(137,t));break;default:O!==F&&vt(e,t,L,O,l,F)}}Qi(e,h,b,S,_,H,c,s);return;case"select":O=h=b=L=null;for(c in n)if(S=n[c],n.hasOwnProperty(c)&&S!=null)switch(c){case"value":break;case"multiple":O=S;default:l.hasOwnProperty(c)||vt(e,t,c,null,l,S)}for(s in l)if(c=l[s],S=n[s],l.hasOwnProperty(s)&&(c!=null||S!=null))switch(s){case"value":L=c;break;case"defaultValue":b=c;break;case"multiple":h=c;default:c!==S&&vt(e,t,s,c,l,S)}t=b,n=h,l=O,L!=null?ta(e,!!n,L,!1):!!l!=!!n&&(t!=null?ta(e,!!n,t,!0):ta(e,!!n,n?[]:"",!1));return;case"textarea":O=L=null;for(b in n)if(s=n[b],n.hasOwnProperty(b)&&s!=null&&!l.hasOwnProperty(b))switch(b){case"value":break;case"children":break;default:vt(e,t,b,null,l,s)}for(h in l)if(s=l[h],c=n[h],l.hasOwnProperty(h)&&(s!=null||c!=null))switch(h){case"value":L=s;break;case"defaultValue":O=s;break;case"children":break;case"dangerouslySetInnerHTML":if(s!=null)throw Error(o(91));break;default:s!==c&&vt(e,t,h,s,l,c)}es(e,L,O);return;case"option":for(var me in n)if(L=n[me],n.hasOwnProperty(me)&&L!=null&&!l.hasOwnProperty(me))switch(me){case"selected":e.selected=!1;break;default:vt(e,t,me,null,l,L)}for(S in l)if(L=l[S],O=n[S],l.hasOwnProperty(S)&&L!==O&&(L!=null||O!=null))switch(S){case"selected":e.selected=L&&typeof L!="function"&&typeof L!="symbol";break;default:vt(e,t,S,L,l,O)}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 Re in n)L=n[Re],n.hasOwnProperty(Re)&&L!=null&&!l.hasOwnProperty(Re)&&vt(e,t,Re,null,l,L);for(_ in l)if(L=l[_],O=n[_],l.hasOwnProperty(_)&&L!==O&&(L!=null||O!=null))switch(_){case"children":case"dangerouslySetInnerHTML":if(L!=null)throw Error(o(137,t));break;default:vt(e,t,_,L,l,O)}return;default:if(_l(t)){for(var xt in n)L=n[xt],n.hasOwnProperty(xt)&&L!==void 0&&!l.hasOwnProperty(xt)&&cu(e,t,xt,void 0,l,L);for(H in l)L=l[H],O=n[H],!l.hasOwnProperty(H)||L===O||L===void 0&&O===void 0||cu(e,t,H,L,l,O);return}}for(var N in n)L=n[N],n.hasOwnProperty(N)&&L!=null&&!l.hasOwnProperty(N)&&vt(e,t,N,null,l,L);for(F in l)L=l[F],O=n[F],!l.hasOwnProperty(F)||L===O||L==null&&O==null||vt(e,t,F,L,l,O)}function fm(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Ty(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),l=0;l<n.length;l++){var s=n[l],c=s.transferSize,h=s.initiatorType,b=s.duration;if(c&&b&&fm(h)){for(h=0,b=s.responseEnd,l+=1;l<n.length;l++){var S=n[l],_=S.startTime;if(_>b)break;var H=S.transferSize,F=S.initiatorType;H&&fm(F)&&(S=S.responseEnd,h+=H*(S<b?1:(b-_)/(S-_)))}if(--l,t+=8*(c+h)/(s.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 uu=null,du=null;function Ps(e){return e.nodeType===9?e:e.ownerDocument}function hm(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 mm(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 fu(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 hu=null;function Ay(){var e=window.event;return e&&e.type==="popstate"?e===hu?!1:(hu=e,!0):(hu=null,!1)}var pm=typeof setTimeout=="function"?setTimeout:void 0,Ny=typeof clearTimeout=="function"?clearTimeout:void 0,gm=typeof Promise=="function"?Promise:void 0,Ey=typeof queueMicrotask=="function"?queueMicrotask:typeof gm<"u"?function(e){return gm.resolve(null).then(e).catch(ky)}:pm;function ky(e){setTimeout(function(){throw e})}function Ca(e){return e==="head"}function bm(e,t){var n=t,l=0;do{var s=n.nextSibling;if(e.removeChild(n),s&&s.nodeType===8)if(n=s.data,n==="/$"||n==="/&"){if(l===0){e.removeChild(s),Oi(t);return}l--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")l++;else if(n==="html")kr(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,kr(n);for(var c=n.firstChild;c;){var h=c.nextSibling,b=c.nodeName;c[Ne]||b==="SCRIPT"||b==="STYLE"||b==="LINK"&&c.rel.toLowerCase()==="stylesheet"||n.removeChild(c),c=h}}else n==="body"&&kr(e.ownerDocument.body);n=s}while(n);Oi(t)}function ym(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 mu(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":mu(n),_e(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function Ry(e,t,n,l){for(;e.nodeType===1;){var s=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[Ne])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(c=e.getAttribute("rel"),c==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(c!==s.rel||e.getAttribute("href")!==(s.href==null||s.href===""?null:s.href)||e.getAttribute("crossorigin")!==(s.crossOrigin==null?null:s.crossOrigin)||e.getAttribute("title")!==(s.title==null?null:s.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(c=e.getAttribute("src"),(c!==(s.src==null?null:s.src)||e.getAttribute("type")!==(s.type==null?null:s.type)||e.getAttribute("crossorigin")!==(s.crossOrigin==null?null:s.crossOrigin))&&c&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var c=s.name==null?null:""+s.name;if(s.type==="hidden"&&e.getAttribute("name")===c)return e}else return e;if(e=Pn(e.nextSibling),e===null)break}return null}function jy(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Pn(e.nextSibling),e===null))return null;return e}function vm(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Pn(e.nextSibling),e===null))return null;return e}function pu(e){return e.data==="$?"||e.data==="$~"}function gu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function My(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 Pn(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 bu=null;function xm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return Pn(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function wm(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 Sm(e,t,n){switch(t=Ps(n),e){case"html":if(e=t.documentElement,!e)throw Error(o(452));return e;case"head":if(e=t.head,!e)throw Error(o(453));return e;case"body":if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function kr(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);_e(e)}var Wn=new Map,Cm=new Set;function Ws(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ql=B.d;B.d={f:_y,r:Ly,D:zy,C:Dy,L:Oy,m:Uy,X:Hy,S:By,M:Ky};function _y(){var e=Ql.f(),t=Gs();return e||t}function Ly(e){var t=Xt(e);t!==null&&t.tag===5&&t.type==="form"?Kf(t):Ql.r(e)}var Li=typeof document>"u"?null:document;function Tm(e,t,n){var l=Li;if(l&&typeof t=="string"&&t){var s=tn(t);s='link[rel="'+e+'"][href="'+s+'"]',typeof n=="string"&&(s+='[crossorigin="'+n+'"]'),Cm.has(s)||(Cm.add(s),e={rel:e,crossOrigin:n,href:t},l.querySelector(s)===null&&(t=l.createElement("link"),un(t,"link",e),Tt(t),l.head.appendChild(t)))}}function zy(e){Ql.D(e),Tm("dns-prefetch",e,null)}function Dy(e,t){Ql.C(e,t),Tm("preconnect",e,t)}function Oy(e,t,n){Ql.L(e,t,n);var l=Li;if(l&&e&&t){var s='link[rel="preload"][as="'+tn(t)+'"]';t==="image"&&n&&n.imageSrcSet?(s+='[imagesrcset="'+tn(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(s+='[imagesizes="'+tn(n.imageSizes)+'"]')):s+='[href="'+tn(e)+'"]';var c=s;switch(t){case"style":c=zi(e);break;case"script":c=Di(e)}Wn.has(c)||(e=w({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Wn.set(c,e),l.querySelector(s)!==null||t==="style"&&l.querySelector(Rr(c))||t==="script"&&l.querySelector(jr(c))||(t=l.createElement("link"),un(t,"link",e),Tt(t),l.head.appendChild(t)))}}function Uy(e,t){Ql.m(e,t);var n=Li;if(n&&e){var l=t&&typeof t.as=="string"?t.as:"script",s='link[rel="modulepreload"][as="'+tn(l)+'"][href="'+tn(e)+'"]',c=s;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":c=Di(e)}if(!Wn.has(c)&&(e=w({rel:"modulepreload",href:e},t),Wn.set(c,e),n.querySelector(s)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(jr(c)))return}l=n.createElement("link"),un(l,"link",e),Tt(l),n.head.appendChild(l)}}}function By(e,t,n){Ql.S(e,t,n);var l=Li;if(l&&e){var s=wn(l).hoistableStyles,c=zi(e);t=t||"default";var h=s.get(c);if(!h){var b={loading:0,preload:null};if(h=l.querySelector(Rr(c)))b.loading=5;else{e=w({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Wn.get(c))&&yu(e,n);var S=h=l.createElement("link");Tt(S),un(S,"link",e),S._p=new Promise(function(_,H){S.onload=_,S.onerror=H}),S.addEventListener("load",function(){b.loading|=1}),S.addEventListener("error",function(){b.loading|=2}),b.loading|=4,Js(h,t,l)}h={type:"stylesheet",instance:h,count:1,state:b},s.set(c,h)}}}function Hy(e,t){Ql.X(e,t);var n=Li;if(n&&e){var l=wn(n).hoistableScripts,s=Di(e),c=l.get(s);c||(c=n.querySelector(jr(s)),c||(e=w({src:e,async:!0},t),(t=Wn.get(s))&&vu(e,t),c=n.createElement("script"),Tt(c),un(c,"link",e),n.head.appendChild(c)),c={type:"script",instance:c,count:1,state:null},l.set(s,c))}}function Ky(e,t){Ql.M(e,t);var n=Li;if(n&&e){var l=wn(n).hoistableScripts,s=Di(e),c=l.get(s);c||(c=n.querySelector(jr(s)),c||(e=w({src:e,async:!0,type:"module"},t),(t=Wn.get(s))&&vu(e,t),c=n.createElement("script"),Tt(c),un(c,"link",e),n.head.appendChild(c)),c={type:"script",instance:c,count:1,state:null},l.set(s,c))}}function Am(e,t,n,l){var s=(s=G.current)?Ws(s):null;if(!s)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=zi(n.href),n=wn(s).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=zi(n.href);var c=wn(s).hoistableStyles,h=c.get(e);if(h||(s=s.ownerDocument||s,h={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},c.set(e,h),(c=s.querySelector(Rr(e)))&&!c._p&&(h.instance=c,h.state.loading=5),Wn.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},Wn.set(e,n),c||Yy(s,e,n,h.state))),t&&l===null)throw Error(o(528,""));return h}if(t&&l!==null)throw Error(o(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Di(n),n=wn(s).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(o(444,e))}}function zi(e){return'href="'+tn(e)+'"'}function Rr(e){return'link[rel="stylesheet"]['+e+"]"}function Nm(e){return w({},e,{"data-precedence":e.precedence,precedence:null})}function Yy(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}),un(t,"link",n),Tt(t),e.head.appendChild(t))}function Di(e){return'[src="'+tn(e)+'"]'}function jr(e){return"script[async]"+e}function Em(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+tn(n.href)+'"]');if(l)return t.instance=l,Tt(l),l;var s=w({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),Tt(l),un(l,"style",s),Js(l,n.precedence,e),t.instance=l;case"stylesheet":s=zi(n.href);var c=e.querySelector(Rr(s));if(c)return t.state.loading|=4,t.instance=c,Tt(c),c;l=Nm(n),(s=Wn.get(s))&&yu(l,s),c=(e.ownerDocument||e).createElement("link"),Tt(c);var h=c;return h._p=new Promise(function(b,S){h.onload=b,h.onerror=S}),un(c,"link",l),t.state.loading|=4,Js(c,n.precedence,e),t.instance=c;case"script":return c=Di(n.src),(s=e.querySelector(jr(c)))?(t.instance=s,Tt(s),s):(l=n,(s=Wn.get(c))&&(l=w({},n),vu(l,s)),e=e.ownerDocument||e,s=e.createElement("script"),Tt(s),un(s,"link",l),e.head.appendChild(s),t.instance=s);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,Js(l,n.precedence,e));return t.instance}function Js(e,t,n){for(var l=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),s=l.length?l[l.length-1]:null,c=s,h=0;h<l.length;h++){var b=l[h];if(b.dataset.precedence===t)c=b;else if(c!==s)break}c?c.parentNode.insertBefore(e,c.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function yu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function vu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var $s=null;function km(e,t,n){if($s===null){var l=new Map,s=$s=new Map;s.set(n,l)}else s=$s,l=s.get(n),l||(l=new Map,s.set(n,l));if(l.has(e))return l;for(l.set(e,null),n=n.getElementsByTagName(e),s=0;s<n.length;s++){var c=n[s];if(!(c[Ne]||c[Gt]||e==="link"&&c.getAttribute("rel")==="stylesheet")&&c.namespaceURI!=="http://www.w3.org/2000/svg"){var h=c.getAttribute(t)||"";h=e+h;var b=l.get(h);b?b.push(c):l.set(h,[c])}}return l}function Rm(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function Gy(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 jm(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function qy(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 s=zi(l.href),c=t.querySelector(Rr(s));if(c){t=c._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=eo.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=c,Tt(c);return}c=t.ownerDocument||t,l=Nm(l),(s=Wn.get(s))&&yu(l,s),c=c.createElement("link"),Tt(c);var h=c;h._p=new Promise(function(b,S){h.onload=b,h.onerror=S}),un(c,"link",l),n.instance=c}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=eo.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var xu=0;function Vy(e,t){return e.stylesheets&&e.count===0&&no(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var l=setTimeout(function(){if(e.stylesheets&&no(e,e.stylesheets),e.unsuspend){var c=e.unsuspend;e.unsuspend=null,c()}},6e4+t);0<e.imgBytes&&xu===0&&(xu=62500*Ty());var s=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&no(e,e.stylesheets),e.unsuspend)){var c=e.unsuspend;e.unsuspend=null,c()}},(e.imgBytes>xu?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(s)}}:null}function eo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)no(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var to=null;function no(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,to=new Map,t.forEach(Fy,e),to=null,eo.call(e))}function Fy(e,t){if(!(t.state.loading&4)){var n=to.get(e);if(n)var l=n.get(null);else{n=new Map,to.set(e,n);for(var s=e.querySelectorAll("link[data-precedence],style[data-precedence]"),c=0;c<s.length;c++){var h=s[c];(h.nodeName==="LINK"||h.getAttribute("media")!=="not all")&&(n.set(h.dataset.precedence,h),l=h)}l&&n.set(null,l)}s=t.instance,h=s.getAttribute("data-precedence"),c=n.get(h)||l,c===l&&n.set(null,s),n.set(h,s),this.count++,l=eo.bind(this),s.addEventListener("load",l),s.addEventListener("error",l),c?c.parentNode.insertBefore(s,c.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(s,e.firstChild)),t.state.loading|=4}}var Mr={$$typeof:V,Provider:null,Consumer:null,_currentValue:ee,_currentValue2:ee,_threadCount:0};function Xy(e,t,n,l,s,c,h,b,S){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=qn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qn(0),this.hiddenUpdates=qn(null),this.identifierPrefix=l,this.onUncaughtError=s,this.onCaughtError=c,this.onRecoverableError=h,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=S,this.incompleteTransitions=new Map}function Mm(e,t,n,l,s,c,h,b,S,_,H,F){return e=new Xy(e,t,n,h,S,_,H,F,b),t=1,c===!0&&(t|=24),c=Un(3,null,null,t),e.current=c,c.stateNode=e,t=$o(),t.refCount++,e.pooledCache=t,t.refCount++,c.memoizedState={element:l,isDehydrated:n,cache:t},lc(c),e}function _m(e){return e?(e=fi,e):fi}function Lm(e,t,n,l,s,c){s=_m(s),l.context===null?l.context=s:l.pendingContext=s,l=fa(t),l.payload={element:n},c=c===void 0?null:c,c!==null&&(l.callback=c),n=ha(e,l,t),n!==null&&(Rn(n,e,t),cr(n,e,t))}function zm(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function wu(e,t){zm(e,t),(e=e.alternate)&&zm(e,t)}function Dm(e){if(e.tag===13||e.tag===31){var t=Ha(e,67108864);t!==null&&Rn(t,e,67108864),wu(e,67108864)}}function Om(e){if(e.tag===13||e.tag===31){var t=Gn();t=$l(t);var n=Ha(e,t);n!==null&&Rn(n,e,t),wu(e,t)}}var lo=!0;function Iy(e,t,n,l){var s=E.T;E.T=null;var c=B.p;try{B.p=2,Su(e,t,n,l)}finally{B.p=c,E.T=s}}function Zy(e,t,n,l){var s=E.T;E.T=null;var c=B.p;try{B.p=8,Su(e,t,n,l)}finally{B.p=c,E.T=s}}function Su(e,t,n,l){if(lo){var s=Cu(l);if(s===null)ou(e,t,l,ao,n),Bm(e,l);else if(Py(s,e,t,n,l))l.stopPropagation();else if(Bm(e,l),t&4&&-1<Qy.indexOf(e)){for(;s!==null;){var c=Xt(s);if(c!==null)switch(c.tag){case 3:if(c=c.stateNode,c.current.memoizedState.isDehydrated){var h=vn(c.pendingLanes);if(h!==0){var b=c;for(b.pendingLanes|=2,b.entangledLanes|=2;h;){var S=1<<31-it(h);b.entanglements[1]|=S,h&=~S}Tl(c),(dt&6)===0&&(Ks=le()+500,Ar(0))}}break;case 31:case 13:b=Ha(c,2),b!==null&&Rn(b,c,2),Gs(),wu(c,2)}if(c=Cu(l),c===null&&ou(e,t,l,ao,n),c===s)break;s=c}s!==null&&l.stopPropagation()}else ou(e,t,l,null,n)}}function Cu(e){return e=aa(e),Tu(e)}var ao=null;function Tu(e){if(ao=null,e=Ie(e),e!==null){var t=f(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=m(t),e!==null)return e;e=null}else if(n===31){if(e=p(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 ao=e,null}function Um(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(ke()){case De:return 2;case ot:return 8;case Yt:case $n:return 32;case Qe:return 268435456;default:return 32}default:return 32}}var Au=!1,Ta=null,Aa=null,Na=null,_r=new Map,Lr=new Map,Ea=[],Qy="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 Bm(e,t){switch(e){case"focusin":case"focusout":Ta=null;break;case"dragenter":case"dragleave":Aa=null;break;case"mouseover":case"mouseout":Na=null;break;case"pointerover":case"pointerout":_r.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Lr.delete(t.pointerId)}}function zr(e,t,n,l,s,c){return e===null||e.nativeEvent!==c?(e={blockedOn:t,domEventName:n,eventSystemFlags:l,nativeEvent:c,targetContainers:[s]},t!==null&&(t=Xt(t),t!==null&&Dm(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function Py(e,t,n,l,s){switch(t){case"focusin":return Ta=zr(Ta,e,t,n,l,s),!0;case"dragenter":return Aa=zr(Aa,e,t,n,l,s),!0;case"mouseover":return Na=zr(Na,e,t,n,l,s),!0;case"pointerover":var c=s.pointerId;return _r.set(c,zr(_r.get(c)||null,e,t,n,l,s)),!0;case"gotpointercapture":return c=s.pointerId,Lr.set(c,zr(Lr.get(c)||null,e,t,n,l,s)),!0}return!1}function Hm(e){var t=Ie(e.target);if(t!==null){var n=f(t);if(n!==null){if(t=n.tag,t===13){if(t=m(n),t!==null){e.blockedOn=t,ii(e.priority,function(){Om(n)});return}}else if(t===31){if(t=p(n),t!==null){e.blockedOn=t,ii(e.priority,function(){Om(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 io(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Cu(e.nativeEvent);if(n===null){n=e.nativeEvent;var l=new n.constructor(n.type,n);la=l,n.target.dispatchEvent(l),la=null}else return t=Xt(n),t!==null&&Dm(t),e.blockedOn=n,!1;t.shift()}return!0}function Km(e,t,n){io(e)&&n.delete(t)}function Wy(){Au=!1,Ta!==null&&io(Ta)&&(Ta=null),Aa!==null&&io(Aa)&&(Aa=null),Na!==null&&io(Na)&&(Na=null),_r.forEach(Km),Lr.forEach(Km)}function ro(e,t){e.blockedOn===t&&(e.blockedOn=null,Au||(Au=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,Wy)))}var so=null;function Ym(e){so!==e&&(so=e,r.unstable_scheduleCallback(r.unstable_NormalPriority,function(){so===e&&(so=null);for(var t=0;t<e.length;t+=3){var n=e[t],l=e[t+1],s=e[t+2];if(typeof l!="function"){if(Tu(l||n)===null)continue;break}var c=Xt(n);c!==null&&(e.splice(t,3),t-=3,Cc(c,{pending:!0,data:s,method:n.method,action:l},l,s))}}))}function Oi(e){function t(S){return ro(S,e)}Ta!==null&&ro(Ta,e),Aa!==null&&ro(Aa,e),Na!==null&&ro(Na,e),_r.forEach(t),Lr.forEach(t);for(var n=0;n<Ea.length;n++){var l=Ea[n];l.blockedOn===e&&(l.blockedOn=null)}for(;0<Ea.length&&(n=Ea[0],n.blockedOn===null);)Hm(n),n.blockedOn===null&&Ea.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(l=0;l<n.length;l+=3){var s=n[l],c=n[l+1],h=s[en]||null;if(typeof c=="function")h||Ym(n);else if(h){var b=null;if(c&&c.hasAttribute("formAction")){if(s=c,h=c[en]||null)b=h.formAction;else if(Tu(s)!==null)continue}else b=h.action;typeof b=="function"?n[l+1]=b:(n.splice(l,3),l-=3),Ym(n)}}}function Gm(){function e(c){c.canIntercept&&c.info==="react-transition"&&c.intercept({handler:function(){return new Promise(function(h){return s=h})},focusReset:"manual",scroll:"manual"})}function t(){s!==null&&(s(),s=null),l||setTimeout(n,20)}function n(){if(!l&&!navigation.transition){var c=navigation.currentEntry;c&&c.url!=null&&navigation.navigate(c.url,{state:c.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,s=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),s!==null&&(s(),s=null)}}}function Nu(e){this._internalRoot=e}oo.prototype.render=Nu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var n=t.current,l=Gn();Lm(n,l,e,t,null,null)},oo.prototype.unmount=Nu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Lm(e.current,2,null,e,null,null),Gs(),t[bl]=null}};function oo(e){this._internalRoot=e}oo.prototype.unstable_scheduleHydration=function(e){if(e){var t=jl();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ea.length&&t!==0&&t<Ea[n].priority;n++);Ea.splice(n,0,e),n===0&&Hm(e)}};var qm=a.version;if(qm!=="19.2.8")throw Error(o(527,qm,"19.2.8"));B.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=v(t),e=e!==null?y(e):null,e=e===null?null:e.stateNode,e};var Jy={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:E,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var co=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!co.isDisabled&&co.supportsFiber)try{Lt=co.inject(Jy),Ct=co}catch{}}return Or.createRoot=function(e,t){if(!d(e))throw Error(o(299));var n=!1,l="",s=Pf,c=Wf,h=Jf;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(s=t.onUncaughtError),t.onCaughtError!==void 0&&(c=t.onCaughtError),t.onRecoverableError!==void 0&&(h=t.onRecoverableError)),t=Mm(e,1,!1,null,null,n,l,null,s,c,h,Gm),e[bl]=t.current,su(e),new Nu(t)},Or.hydrateRoot=function(e,t,n){if(!d(e))throw Error(o(299));var l=!1,s="",c=Pf,h=Wf,b=Jf,S=null;return n!=null&&(n.unstable_strictMode===!0&&(l=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onUncaughtError!==void 0&&(c=n.onUncaughtError),n.onCaughtError!==void 0&&(h=n.onCaughtError),n.onRecoverableError!==void 0&&(b=n.onRecoverableError),n.formState!==void 0&&(S=n.formState)),t=Mm(e,1,!0,t,n??null,l,s,S,c,h,b,Gm),t.context=_m(null),n=t.current,l=Gn(),l=$l(l),s=fa(l),s.callback=null,ha(n,s,l),n=l,t.current.lanes=n,Ln(t,n),Tl(t),e[bl]=t.current,su(e),new oo(t)},Or.version="19.2.8",Or}var Qm;function uv(){if(Qm)return ku.exports;Qm=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(a){console.error(a)}}return r(),ku.exports=cv(),ku.exports}var dv=uv();const fv=Fp(dv),re={ESC:"\x1B",TAB:" ",SHIFT_TAB:"\x1B[Z",ENTER:"\r",BACKSPACE:"",UP:"\x1B[A",DOWN:"\x1B[B",RIGHT:"\x1B[C",LEFT:"\x1B[D",HOME:"\x1B[H",END:"\x1B[F",PAGE_UP:"\x1B[5~",PAGE_DOWN:"\x1B[6~",INSERT:"\x1B[2~",DELETE:"\x1B[3~",CTRL_C:"",CTRL_D:"",CTRL_Z:"",CTRL_L:"\f",CTRL_A:"",CTRL_E:"",CTRL_K:"\v",CTRL_R:"",CTRL_W:"",CTRL_U:"",CTRL_X:"",CTRL_N:"",CTRL_P:"",F1:"\x1BOP",F2:"\x1BOQ",F3:"\x1BOR",F4:"\x1BOS",F5:"\x1B[15~",F6:"\x1B[17~",F7:"\x1B[18~",F8:"\x1B[19~",F9:"\x1B[20~",F10:"\x1B[21~",F11:"\x1B[23~",F12:"\x1B[24~"},hv=new TextEncoder;function td(r){return hv.encode(r)}function Ip(r){if(!r||r.length===0)return"";const i=r.toUpperCase().charCodeAt(0);return i>=65&&i<=90?String.fromCharCode(i-64):r==="@"||r===" "?"\0":r==="["?"\x1B":r==="\\"?"":r==="]"?"":r==="^"?"":r==="_"?"":r==="?"?"":r}function mv(r){return`\x1B${r}`}function Pm({ctrl:r,alt:a,shift:i}){return 1+(i?1:0)+(a?2:0)+(r?4:0)}const Zp=/^\x1b[[O]([ABCDHF])$/,Qp=/^\x1bO([PQRS])$/,Pp=/^\x1b\[(\d+)~$/;function xo(r,a){const{ctrl:i=!1,alt:o=!1,shift:d=!1}=a;if(!i&&!o&&!d)return r;const f=Pm(a),m=o&&!i&&!d,p=Zp.exec(r);if(p)return`\x1B[1;${f}${p[1]}`;const g=Qp.exec(r);if(g)return`\x1B[1;${f}${g[1]}`;const v=Pp.exec(r);if(v)return`\x1B[${v[1]};${f}~`;switch(r){case re.TAB:return d&&!i&&!o?re.SHIFT_TAB:m?`\x1B${r}`:`\x1B[9;${f}u`;case re.SHIFT_TAB:return!i&&!o?r:`\x1B[9;${Pm({...a,shift:!0})}u`;case re.ENTER:return m?`\x1B${r}`:`\x1B[13;${f}u`;case re.BACKSPACE:return i&&!o&&!d?"\b":m?`\x1B${r}`:`\x1B[127;${f}u`;case re.ESC:return m?`\x1B${r}`:`\x1B[27;${f}u`}let y=r;return d&&r.length===1&&!i&&(y=r.toUpperCase()),i&&(y=Ip(y)),o&&(y=mv(y)),y}function pv(r){return[...r].length===1?!0:Zp.test(r)||Qp.test(r)||Pp.test(r)||r===re.SHIFT_TAB}const Wp=27,Jp=91,gv=60,Wm=59,$p=77,eg=48,bv=57,yv=64,vv=-30,Mu=32,Jm=255;function tg(r){return Number.isInteger(r)&&(r&vv)===yv}function xv(r){return r>=eg&&r<=bv}function _u(r,a){let i=a,o=0;for(;i<r.length&&xv(r[i]);){if(o=o*10+(r[i]-eg),o>65535)return null;i+=1}return i===a?null:{value:o,next:i}}function wv(r,a){if(r[a]!==Wp||r[a+1]!==Jp||r[a+2]!==gv)return-1;const i=_u(r,a+3);if(!i||!tg(i.value)||r[i.next]!==Wm)return-1;const o=_u(r,i.next+1);if(!o||r[o.next]!==Wm)return-1;const d=_u(r,o.next+1);return!d||r[d.next]!==$p?-1:d.next+1}function Sv(r,a){if(r[a]!==Wp||r[a+1]!==Jp||r[a+2]!==$p||a+6>r.length)return-1;const i=r[a+3]-Mu,o=r[a+4],d=r[a+5];return!tg(i)||o<Mu||o>Jm||d<Mu||d>Jm?-1:a+6}function wo(r){if(!r)return!1;const a=r instanceof Uint8Array?r:new Uint8Array(r);if(a.length===0)return!1;let i=0;for(;i<a.length;){const o=wv(a,i);if(o>i){i=o;continue}const d=Sv(a,i);if(d>i){i=d;continue}return!1}return!0}const Cv=3e3,Tv=1e4,Av=1500;class Nv{constructor(a){de(this,"ws",null);de(this,"config");de(this,"state","disconnected");de(this,"currentRole","viewer");de(this,"controllerId");de(this,"hostId");de(this,"assignedClientId");de(this,"reconnectAttempts",0);de(this,"reconnectTimer",null);de(this,"pingTimer",null);de(this,"pingTimestamp",null);de(this,"lastInboundAt",0);de(this,"pingSentAt",null);de(this,"connectStartedAt",0);de(this,"lastWakeConnectAt",0);de(this,"probeTimer",null);de(this,"rejectedByRelay",!1);de(this,"isManuallyClosed",!1);de(this,"authFailureDetail",null);de(this,"authFailureCode",null);de(this,"temporaryFailureCode",null);de(this,"pendingInputSegments",[]);de(this,"isFlushScheduled",!1);de(this,"listeners",{stateChange:new Set,roleChange:new Set,ready:new Set,paired:new Set,controlState:new Set,controlRevoked:new Set,sessionReady:new Set,exit:new Set,controlGranted:new Set,controlDenied:new Set,status:new Set,peerCount:new Set,hostReconnecting:new Set,sessionRestarted:new Set,error:new Set,binaryData:new Set,rttUpdate:new Set,pasteFileReady:new Set,agentStatus:new Set});de(this,"terminalCols",80);de(this,"terminalRows",24);this.config={...a}}updateConfig(a){this.config={...this.config,...a}}getConfig(){return{...this.config}}getState(){return this.state}getRole(){return this.currentRole}getControllerId(){return this.controllerId}getHostId(){return this.hostId}getAssignedClientId(){return this.assignedClientId}on(a,i){return this.listeners[a].add(i),()=>{this.listeners[a].delete(i)}}emit(a,...i){this.listeners[a].forEach(d=>{try{d(...i)}catch(f){console.error(`Error in event listener for ${a}:`,f)}})}setState(a,i,o){this.state!==a&&(this.state=a,this.emit("stateChange",a,i,o))}connect(a){if(a&&(this.terminalCols=a.cols,this.terminalRows=a.rows),!(this.ws&&(this.ws.readyState===WebSocket.OPEN||this.ws.readyState===WebSocket.CONNECTING))){this.teardownSocket(1e3,"Replaced by a new connection"),this.isManuallyClosed=!1,this.authFailureDetail=null,this.authFailureCode=null,this.temporaryFailureCode=null,this.rejectedByRelay=!1,this.clearTimers(),this.setState("connecting");try{const i=this.resolveWsUrl(this.config.wsUrl),o=new WebSocket(i);this.ws=o,this.connectStartedAt=Date.now(),o.binaryType="arraybuffer",o.onopen=()=>{this.isStaleSocket(o)||this.handleOpen()},o.onmessage=d=>{this.isStaleSocket(o)||this.handleMessage(d)},o.onerror=d=>{this.isStaleSocket(o)||this.handleError(d)},o.onclose=d=>{this.isStaleSocket(o)||this.handleClose(d)}}catch(i){this.setState("error",i instanceof Error?i.message:"Connection failed","connection_failed"),this.scheduleReconnect()}}}isStaleSocket(a){return this.ws!==a}teardownSocket(a=1e3,i="Client closed the connection"){this.pendingInputSegments=[],this.isFlushScheduled=!1;const o=this.ws;if(o){this.ws=null,o.onopen=null,o.onmessage=null,o.onerror=null,o.onclose=null;try{(o.readyState===WebSocket.OPEN||o.readyState===WebSocket.CONNECTING)&&o.close(a,i)}catch{}}}disconnect(){this.isManuallyClosed=!0,this.clearTimers(),this.pendingInputSegments=[],this.isFlushScheduled=!1,this.teardownSocket(1e3,"User initiated disconnect"),this.setState("disconnected")}reconnectWith(a){this.updateConfig(a),this.clearTimers(),this.teardownSocket(1e3,"Reconnecting with new credentials"),this.isManuallyClosed=!1,this.reconnectAttempts=0,this.authFailureDetail=null,this.authFailureCode=null,this.temporaryFailureCode=null,this.connect()}wake(a){if(this.isManuallyClosed||!this.config.autoReconnect||this.authFailureDetail||this.rejectedByRelay)return;const i=Date.now(),o=this.ws;if(!o){if(i-this.lastWakeConnectAt<Av)return;this.lastWakeConnectAt=i,this.reconnectAttempts=0,this.connect();return}if(o.readyState===WebSocket.CONNECTING){i-this.connectStartedAt>Tv&&this.dropStaleSocket("connection_stalled");return}o.readyState===WebSocket.OPEN&&i-this.lastInboundAt>this.pingIntervalMs()+2e3&&this.probeLiveness()}pingIntervalMs(){return this.config.pingIntervalMs||1e4}probeLiveness(){const a=this.ws;if(!a||a.readyState!==WebSocket.OPEN||this.probeTimer)return;const i=Date.now();this.sendPing(),this.probeTimer=setTimeout(()=>{this.probeTimer=null,this.ws===a&&this.lastInboundAt<i&&this.dropStaleSocket("connection_stale")},Cv)}dropStaleSocket(a){this.clearTimers(),this.teardownSocket(4e3,"Connection went silent"),this.setState("reconnecting","The connection went silent. Reconnecting...",a),this.reconnectAttempts=0,this.lastWakeConnectAt=Date.now(),this.connect()}handleOpen(){this.lastInboundAt=Date.now(),this.sendHello(),this.startHeartbeat()}async handleMessage(a){if(this.lastInboundAt=Date.now(),typeof a.data=="string")try{const i=JSON.parse(a.data);this.processJsonMessage(i)}catch(i){console.warn("Received unparseable text frame from server:",i)}else if(a.data instanceof ArrayBuffer)this.emit("binaryData",new Uint8Array(a.data));else if(typeof Blob<"u"&&a.data instanceof Blob)try{const i=await a.data.arrayBuffer();this.emit("binaryData",new Uint8Array(i))}catch(i){console.error("Failed to convert Blob to ArrayBuffer:",i)}}processJsonMessage(a){switch(a.type){case"ready":{this.reconnectAttempts=0,this.setState("connected"),this.currentRole=a.role,this.controllerId=a.controllerId,this.hostId=a.hostId,this.assignedClientId=a.clientId,this.emit("ready",a),this.emit("roleChange",a.role,a.controllerId,a.hostId,a.clientId),typeof a.clientCount=="number"&&this.emit("peerCount",a.clientCount);break}case"paired":{this.emit("paired",{token:a.token,deviceId:a.deviceId,hostId:a.hostId,expiresAt:a.expiresAt});break}case"control_state":{this.currentRole=a.role,this.controllerId=a.controllerId,this.emit("controlState",a.role,a.controllerId),this.emit("roleChange",a.role,a.controllerId,this.hostId,this.assignedClientId),typeof a.clientCount=="number"&&this.emit("peerCount",a.clientCount);break}case"host_reconnecting":{this.temporaryFailureCode="host_reconnecting",this.setState("reconnecting","Herdr host is reconnecting",a.code||"host_reconnecting"),this.emit("hostReconnecting",a.code);break}case"session_restarted":{this.setState("reconnecting","Herdr session is restarting","session_restarted"),this.emit("sessionRestarted",a.cols,a.rows,a.terminalPalette,a.hostname);break}case"control_revoked":{this.currentRole="viewer",this.emit("controlRevoked",a.reason),this.emit("roleChange","viewer",this.controllerId,this.hostId,this.assignedClientId);break}case"session_ready":{this.setState("connected"),this.emit("sessionReady",a);break}case"exit":{this.emit("exit",a.code,a.reason);break}case"control_granted":{this.currentRole="controller",this.controllerId=this.assignedClientId||this.config.clientId,this.emit("controlGranted"),this.emit("roleChange","controller",this.controllerId,this.hostId,this.assignedClientId);break}case"control_denied":{this.emit("controlDenied",a.message);break}case"status":{this.emit("status",a);break}case"error":{a.code==="host_offline"||a.code==="host_reconnecting"||a.code==="host_reconnect_timeout"||a.code==="rate_limited"?(this.temporaryFailureCode=String(a.code),this.setState("reconnecting",a.message,String(a.code))):(a.code==="auth_required"||a.code==="unauthorized"||a.code==="device_revoked"||a.code==="invalid_handshake"||a.code==="too_many_hosts"||a.code===401||a.code===403)&&(this.authFailureDetail=a.message,this.authFailureCode=String(a.code),this.setState("error",a.message,this.authFailureCode)),this.emit("error",{code:a.code,message:a.message});break}case"pong":{if(this.pingTimestamp){const i=Math.max(0,performance.now()-this.pingTimestamp);this.pingTimestamp=null,this.emit("rttUpdate",Math.round(i))}break}case"paste_file_ready":{this.emit("pasteFileReady",a.path);break}case"agent_status":{this.emit("agentStatus",a);break}}}handleError(a){console.error("WebSocket error:",a),this.emit("error",{code:"WS_ERROR",message:"WebSocket connection error"})}handleClose(a){if(this.clearTimers(),this.ws=null,this.authFailureDetail){this.setState("error",this.authFailureDetail,this.authFailureCode??void 0);return}if(a.code===1008&&this.temporaryFailureCode){this.setState("reconnecting",a.reason||"The relay is temporarily unavailable",this.temporaryFailureCode),this.scheduleReconnect();return}if(a.code===1008){this.rejectedByRelay=!0,this.setState("error",a.reason||"The relay rejected the connection",String(a.code));return}!this.isManuallyClosed&&this.config.autoReconnect?(this.setState("reconnecting",`Connection closed (${a.code}). Retrying...`,"connection_closed"),this.scheduleReconnect()):this.setState("disconnected",`Closed: ${a.reason||a.code}`,"connection_closed")}scheduleReconnect(){if(this.isManuallyClosed||!this.config.autoReconnect)return;if(this.config.maxReconnectAttempts>0&&this.reconnectAttempts>=this.config.maxReconnectAttempts){this.setState("error","Max reconnect attempts reached");return}this.reconnectAttempts++;const a=this.config.reconnectIntervalMs||2e3,o=Math.min(3e4,Math.floor(a*Math.pow(1.5,this.reconnectAttempts-1)+Math.random()*500));this.reconnectTimer=setTimeout(()=>{this.connect()},o)}startHeartbeat(){this.pingTimer&&clearInterval(this.pingTimer);const a=this.pingIntervalMs();this.pingSentAt=null,this.pingTimer=setInterval(()=>{if(!(!this.ws||this.ws.readyState!==WebSocket.OPEN)){if(this.pingSentAt!==null&&this.lastInboundAt<this.pingSentAt&&Date.now()-this.pingSentAt>=a){this.probeLiveness();return}this.sendPing()}},a)}clearTimers(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.pingTimer&&(clearInterval(this.pingTimer),this.pingTimer=null),this.probeTimer&&(clearTimeout(this.probeTimer),this.probeTimer=null)}sendHello(){const a={type:"hello",protocol:1,clientId:this.config.clientId,cols:this.terminalCols,rows:this.terminalRows,capabilities:["host_handoff"]};this.config.token&&(a.token=this.config.token),this.config.pairCode&&(a.pairCode=this.config.pairCode),this.sendJson(a)}claimControl(a=!1){const i={type:"claim_control",...a?{force:!0}:{}};this.sendJson(i)}releaseControl(){const a={type:"release_control"};this.sendJson(a)}sendResize(a,i){this.terminalCols=a,this.terminalRows=i;const o={type:"resize",cols:a,rows:i};this.sendJson(o)}sendPing(){this.pingTimestamp=performance.now(),this.pingSentAt=Date.now();const a={type:"ping"};this.sendJson(a)}sendPasteFile(a,i){this.sendJson({type:"paste_file",mime:a,dataBase64:i})}sendJson(a){this.flushInput(),this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify(a))}sendInput(a){const i=a instanceof Uint8Array?a:new Uint8Array(a);i.length!==0&&(this.pendingInputSegments.push(i),this.isFlushScheduled||(this.isFlushScheduled=!0,queueMicrotask(()=>this.flushInput())))}flushInput(){if(this.isFlushScheduled=!1,this.pendingInputSegments.length===0)return;let a=this.pendingInputSegments;if(this.pendingInputSegments=[],this.ws&&(this.ws.bufferedAmount??0)>256*1024&&(a=a.filter(o=>!wo(o))),a.length===0)return;let i;if(a.length===1)i=a[0];else{let o=0;for(let f=0;f<a.length;f++)o+=a[f].byteLength;i=new Uint8Array(o);let d=0;for(let f=0;f<a.length;f++)i.set(a[f],d),d+=a[f].byteLength}this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(i)}sendBinary(a){this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(a)}sendText(a){const i=td(a);this.sendInput(i)}resolveWsUrl(a){if(/^wss?:\/\//i.test(a))return a;if(/^https?:\/\//i.test(a)){const i=new URL(a);return i.protocol=i.protocol==="https:"?"wss:":"ws:",(!i.pathname||i.pathname==="/")&&(i.pathname="/ws/client"),i.toString()}if(typeof window<"u"&&window.location){const o=window.location.protocol==="https:"?"wss:":"ws:",d=window.location.host,f=a.startsWith("/")?a:`/${a}`;return`${o}//${d}${f}`}return"ws://127.0.0.1:8787/ws/client"}}function Ev(r,a=window,i=document){const o=v=>{var y;((y=a.navigator)==null?void 0:y.onLine)!==!1&&r.wake(v)},d=()=>{i.visibilityState==="visible"&&o("visible")},f=()=>o("pageshow"),m=()=>o("online"),p=()=>o("focus"),g=()=>o("resume");return i.addEventListener("visibilitychange",d),i.addEventListener("resume",g),a.addEventListener("pageshow",f),a.addEventListener("online",m),a.addEventListener("focus",p),()=>{i.removeEventListener("visibilitychange",d),i.removeEventListener("resume",g),a.removeEventListener("pageshow",f),a.removeEventListener("online",m),a.removeEventListener("focus",p)}}const kv=10,Rv=24,ko=15,nd=13,ld=640;function jv(){if(typeof window>"u")return!1;try{if(typeof window.matchMedia=="function"&&(window.matchMedia("(pointer: coarse)").matches||window.matchMedia("(hover: none)").matches))return!0}catch{}return Gi()<ld}function Gi(){return typeof window>"u"?1024:window.visualViewport&&typeof window.visualViewport.width=="number"&&window.visualViewport.width>0?window.visualViewport.width:window.innerWidth||1024}function Lu(){return typeof window>"u"?768:window.visualViewport&&typeof window.visualViewport.height=="number"&&window.visualViewport.height>0?window.visualViewport.height:window.innerHeight||768}function So(r,a=ko){const i=typeof r=="number"?r:Number(r);return!Number.isFinite(i)||i<=0?a:Math.min(Rv,Math.max(kv,Math.round(i)))}function $m(r,a=Gi()){if(a<ld){const o=So(r,nd);return Math.min(15,Math.max(12,o))}return So(r,ko)}const ng=[{id:"esc",label:"ESC",code:re.ESC,type:"key",enabled:!0,title:"Escape"},{id:"tab",label:"TAB",code:re.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:re.LEFT,type:"key",enabled:!0,title:"Arrow Left"},{id:"up",label:"↑",code:re.UP,type:"key",enabled:!0,title:"Arrow Up"},{id:"down",label:"↓",code:re.DOWN,type:"key",enabled:!0,title:"Arrow Down"},{id:"right",label:"→",code:re.RIGHT,type:"key",enabled:!0,title:"Arrow Right"},{id:"drawer_symbols",label:"~|/",code:"",type:"drawer",enabled:!0,drawerType:"symbols",title:"Special Symbols"},{id:"drawer_fn",label:"Fn",code:"",type:"drawer",enabled:!0,drawerType:"fn",title:"Function Keys (F1-F12)"},{id:"enter",label:"Enter",code:re.ENTER,type:"key",enabled:!0,title:"Enter / Return"}],Mv=[{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:re.ESC,type:"key",enabled:!0,title:"Escape"},{id:"tab",label:"TAB",code:re.TAB,type:"key",enabled:!0,title:"Tab"},{id:"shift_tab",label:"⇧TAB",code:re.SHIFT_TAB,type:"key",enabled:!0,title:"Shift+Tab"},{id:"enter",label:"Enter",code:re.ENTER,type:"key",enabled:!0,title:"Enter / Return"},{id:"backspace",label:"⌫",code:re.BACKSPACE,type:"key",enabled:!0,title:"Backspace"},{id:"delete",label:"Del",code:re.DELETE,type:"key",enabled:!0,title:"Delete"},{id:"left",label:"←",code:re.LEFT,type:"key",enabled:!0,title:"Arrow Left"},{id:"up",label:"↑",code:re.UP,type:"key",enabled:!0,title:"Arrow Up"},{id:"down",label:"↓",code:re.DOWN,type:"key",enabled:!0,title:"Arrow Down"},{id:"right",label:"→",code:re.RIGHT,type:"key",enabled:!0,title:"Arrow Right"},{id:"home",label:"Home",code:re.HOME,type:"key",enabled:!0,title:"Home"},{id:"end",label:"End",code:re.END,type:"key",enabled:!0,title:"End"},{id:"page_up",label:"PgUp",code:re.PAGE_UP,type:"key",enabled:!0,title:"Page Up"},{id:"page_down",label:"PgDn",code:re.PAGE_DOWN,type:"key",enabled:!0,title:"Page Down"},{id:"insert",label:"Ins",code:re.INSERT,type:"key",enabled:!0,title:"Insert"},{id:"ctrl_c",label:"^C",code:re.CTRL_C,type:"chord",enabled:!0,title:"Ctrl+C (SIGINT)"},{id:"ctrl_d",label:"^D",code:re.CTRL_D,type:"chord",enabled:!0,title:"Ctrl+D (EOF/Exit)"},{id:"ctrl_z",label:"^Z",code:re.CTRL_Z,type:"chord",enabled:!0,title:"Ctrl+Z (SIGTSTP)"},{id:"ctrl_l",label:"^L",code:re.CTRL_L,type:"chord",enabled:!0,title:"Ctrl+L (Clear Screen)"},{id:"ctrl_a",label:"^A",code:re.CTRL_A,type:"chord",enabled:!0,title:"Ctrl+A (Beginning of Line)"},{id:"ctrl_e",label:"^E",code:re.CTRL_E,type:"chord",enabled:!0,title:"Ctrl+E (End of Line)"},{id:"ctrl_k",label:"^K",code:re.CTRL_K,type:"chord",enabled:!0,title:"Ctrl+K (Kill to End)"},{id:"ctrl_r",label:"^R",code:re.CTRL_R,type:"chord",enabled:!0,title:"Ctrl+R (Reverse Search)"},{id:"f1",label:"F1",code:re.F1,type:"fn",enabled:!0,title:"F1"},{id:"f2",label:"F2",code:re.F2,type:"fn",enabled:!0,title:"F2"},{id:"f3",label:"F3",code:re.F3,type:"fn",enabled:!0,title:"F3"},{id:"f4",label:"F4",code:re.F4,type:"fn",enabled:!0,title:"F4"},{id:"f5",label:"F5",code:re.F5,type:"fn",enabled:!0,title:"F5"},{id:"f6",label:"F6",code:re.F6,type:"fn",enabled:!0,title:"F6"},{id:"f7",label:"F7",code:re.F7,type:"fn",enabled:!0,title:"F7"},{id:"f8",label:"F8",code:re.F8,type:"fn",enabled:!0,title:"F8"},{id:"f9",label:"F9",code:re.F9,type:"fn",enabled:!0,title:"F9"},{id:"f10",label:"F10",code:re.F10,type:"fn",enabled:!0,title:"F10"},{id:"f11",label:"F11",code:re.F11,type:"fn",enabled:!0,title:"F11"},{id:"f12",label:"F12",code:re.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 Qr(){return JSON.parse(JSON.stringify(ng))}const _v=[["esc","tab","shift_tab","ctrl","alt","left","up","down","right","drawer_chords","drawer_symbols","drawer_fn","enter"],["esc","tab","ctrl","alt","left","up","down","right","enter","drawer_chords","drawer_symbols","drawer_fn"],["esc","tab","ctrl","alt","left","up","down","right","drawer_chords","drawer_symbols","drawer_fn","enter"],["esc","tab","ctrl","alt","left","up","down","right","drawer_agent","drawer_symbols","drawer_fn","enter"]];function Lv(r){return _v.some(a=>r.length===a.length&&r.every((i,o)=>i.id===a[o]&&i.enabled!==!1))}function zv(r){if(!Array.isArray(r)||r.length===0)return Qr();const a=r.filter(i=>typeof i=="object"&&i!==null&&typeof i.id=="string"&&typeof i.label=="string"&&typeof i.code=="string");return Lv(a)?Qr():a.filter(i=>i.id!=="drawer_agent")}function Xu(r,a){if(a){const i=`keyTitles.${r.id}`,o=a(i);if(o&&o!==i)return o}return r.title||r.label}class Nl extends Error{constructor(i,o={}){super(i);de(this,"code");de(this,"params");this.name="KeyComboError",this.code=i,this.params=o}}const Dv={escape:"esc",return:"enter",pgup:"pageup",pgdn:"pagedown",backslash:"\\",plus:"+"},ep={esc:re.ESC,tab:re.TAB,enter:re.ENTER,backspace:re.BACKSPACE,delete:re.DELETE,left:re.LEFT,right:re.RIGHT,up:re.UP,down:re.DOWN,home:re.HOME,end:re.END,pageup:re.PAGE_UP,pagedown:re.PAGE_DOWN,insert:re.INSERT,space:" ","+":"+"},Ov={esc:"ESC",tab:"TAB",enter:"⏎",backspace:"⌫",delete:"DEL",left:"←",right:"→",up:"↑",down:"↓",home:"HOME",end:"END",pageup:"PGUP",pagedown:"PGDN",insert:"INS",space:"SPACE","+":"+"},Uv={2:"²",3:"³",4:"⁴",5:"⁵",6:"⁶",7:"⁷",8:"⁸",9:"⁹"};function lg(r,a){const i=r.toLowerCase().split("+");if(i.some(g=>!g))throw new Nl("invalidStepSyntax",{step:a+1});const o={};let d;for(const g of i)if(g==="ctrl"||g==="control"){if(o.ctrl)throw new Nl("duplicateModifier",{step:a+1,modifier:"Ctrl"});o.ctrl=!0}else if(g==="alt"||g==="option"){if(o.alt)throw new Nl("duplicateModifier",{step:a+1,modifier:"Alt"});o.alt=!0}else if(g==="shift"){if(o.shift)throw new Nl("duplicateModifier",{step:a+1,modifier:"Shift"});o.shift=!0}else if(d===void 0)d=g;else throw new Nl("multipleKeys",{step:a+1});if(!d)throw new Nl("missingKey",{step:a+1});const f=Dv[d]||d,m=/^f(?:[1-9]|1[0-2])$/.exec(f);let p;if(m)p=re[f.toUpperCase()];else if(Object.hasOwn(ep,f))p=ep[f];else if([...f].length===1&&/^[\x21-\x7e]$/.test(f))p=f;else throw new Nl("unsupportedKey",{step:a+1,key:f});return{key:p,keyName:f,modifiers:o,sequence:Hv(p,f,o)}}function Bv(r){return 1+(r.shift?1:0)+(r.alt?2:0)+(r.ctrl?4:0)}function tp(r,a){const i=[...r][0].codePointAt(0);return i===void 0?"":`\x1B[${i};${Bv(a)}u`}function Hv(r,a,i){if(!i.ctrl)return xo(r,i);if(a.length===1&&/^[\x20-\x7e]$/.test(a)){const o=a.toLowerCase();if(i.alt||i.shift||o==="m"||o==="i")return tp(o,i);if(o==="-"||o==="/"||o==="_")return"";const d=Ip(o);return d!==o?d:tp(o,i)}return xo(r,i)}function El(r){if(typeof r!="string"||!r.trim())throw new Nl("empty");const a=r.trim().split(/\s+/);if(a.length>8)throw new Nl("tooManySteps",{count:8});return a.map((i,o)=>lg(i,o).sequence)}function Vr(r){const a=r.trim().split(/\s+/);return a.length>1&&a.every(i=>["esc","escape"].includes(i.toLowerCase()))?`ESC${Uv[a.length]||` ×${a.length}`}`:a.map((i,o)=>{const{keyName:d,modifiers:f}=lg(i,o),m=Ov[d]||(/^f\d+$/.test(d),d.toUpperCase());return f.ctrl&&f.alt&&f.shift?`Ctrl+Alt+⇧${m}`:f.ctrl&&f.alt?`Ctrl+Alt+${m}`:f.ctrl&&f.shift?`^⇧${m}`:f.ctrl?`^${m}`:f.alt&&f.shift?`Alt+⇧${m}`:f.alt?`Alt+${m}`:f.shift?`⇧${m}`:m}).join(" ")}const Iu='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", "Symbols Nerd Font Mono", monospace',Kv='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',np="JetBrains Mono, Menlo, Monaco, Consolas, monospace",qi="herdr_remote_settings_v1",Xr="herdr_remote_session_view_v1",ag=64,Pr=4096,Zu={local:{},session:{}};function Co(r,a){if(typeof window>"u")return Zu[r][a]||null;try{return(r==="local"?window.localStorage:window.sessionStorage).getItem(a)}catch{return Zu[r][a]||null}}function ei(r,a,i){if(Zu[r][a]=i,!(typeof window>"u"))try{(r==="local"?window.localStorage:window.sessionStorage).setItem(a,i)}catch(o){console.warn(`Failed to write to ${r}Storage:`,o)}}function Yv(){return`client-${Math.random().toString(36).substring(2,8)}`}function ad(){const r=Math.random().toString(36).substring(2,10);return`profile-${Date.now().toString(36)}-${r}`}function Gv(r,a){return(typeof r=="string"?r.trim().slice(0,ag):"")||a}function To(r,a){if(!r||typeof r!="object"||Array.isArray(r))return null;const i=r,o=typeof i.wsUrl=="string"?i.wsUrl.trim().slice(0,2048):"",d=typeof i.token=="string"?i.token.slice(0,Pr):"",f=typeof i.pairCode=="string"?i.pairCode.trim().toUpperCase().slice(0,32):"";if(!o||!o.startsWith("/")&&!/^(?:wss?|https?):\/\//i.test(o)||!d&&!f)return null;const m=Date.now(),p=typeof i.id=="string"&&i.id.length>0?i.id.slice(0,128):ad(),g=typeof i.hostname=="string"&&i.hostname.trim()?i.hostname.trim().slice(0,ag):`Herdr ${a+1}`;return{id:p,displayName:Gv(i.displayName,g),wsUrl:o,token:d,...f?{pairCode:f}:{},...typeof i.hostId=="string"&&i.hostId.trim()?{hostId:i.hostId.trim().slice(0,128)}:{},...typeof i.hostname=="string"&&i.hostname.trim()?{hostname:i.hostname.trim().slice(0,128)}:{},...typeof i.deviceId=="string"&&i.deviceId.trim()?{deviceId:i.deviceId.trim().slice(0,128)}:{},autoReconnect:i.autoReconnect!==!1,createdAt:Number.isFinite(i.createdAt)?Number(i.createdAt):m,lastUsedAt:Number.isFinite(i.lastUsedAt)?Number(i.lastUsedAt):m}}function lp(r,a=0){const i=To({...r,id:r.id||ad()},a);if(!i)throw new Error("a connection profile requires a relay URL and token or pairing code");return i}function ap(r){let a=r.wsUrl.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"").toLowerCase();if(typeof window<"u")try{const i=new URL(r.wsUrl,window.location.origin);i.protocol=i.protocol==="wss:"?"https:":"http:",i.pathname=i.pathname.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"")||"/",i.search="",i.hash="",a=i.toString().replace(/\/$/,"").toLowerCase()}catch{}return`${a}::${r.hostId||""}`}function ig(){return typeof navigator<"u"&&navigator.language&&navigator.language.toLowerCase().startsWith("zh")?"zh":"en"}function rg(){const r=typeof window<"u"&&window.innerWidth<640;return{wsUrl:"/ws/client",token:"",pairCode:"",clientId:Yv(),autoReconnect:!0,profiles:[],activeProfileId:"",fontSize:r?nd:ko,fontFamily:Iu,toolbarVisible:!0,toolbarPosition:"bottom",vibrateOnKeyPress:!0,predictiveEcho:"auto",agentAlertBadge:!0,agentAlertSound:!1,agentAlertVibrate:!1,agentAlertNotify:!1,language:ig(),virtualKeys:Qr(),agentKeymaps:{},adminToken:"",adminTokens:{}}}const qv=["wsUrl","token","pairCode","clientId","autoReconnect","language","agentKeymaps"],Vv=["wsUrl","token","pairCode","autoReconnect"],id=["fontSize","fontFamily","toolbarVisible","toolbarPosition","vibrateOnKeyPress","predictiveEcho","virtualKeys","agentAlertBadge","agentAlertSound","agentAlertVibrate","agentAlertNotify","adminToken","adminTokens"],Fv=id.filter(r=>r!=="adminToken"&&r!=="adminTokens"),ip=["theme","colorMode"];function Qu(r){const a=r;if(!ip.some(d=>a[d]!==void 0))return{data:r,changed:!1};const o={...a};for(const d of ip)delete o[d];return{data:o,changed:!0}}function sg(r){if(!r||typeof r!="object"||Array.isArray(r))return{};const a={};for(const[i,o]of Object.entries(r).slice(0,32))typeof o!="string"||o.length===0||(a[i.slice(0,512)]=o.slice(0,Pr));return a}function og(r){if(!r||typeof r!="object"||Array.isArray(r))return{};const a=Object.create(null);for(const[i,o]of Object.entries(r).slice(0,32)){if(!/^[a-z][a-z0-9_-]{0,31}$/i.test(i)||["__proto__","constructor","prototype"].includes(i)||!o||typeof o!="object"||Array.isArray(o))continue;const d=o,f={};if(Array.isArray(d.order)&&(f.order=[...new Set(d.order.filter(m=>typeof m=="string"&&/^[a-zA-Z0-9_-]{1,64}$/.test(m)))].slice(0,256)),d.actions&&typeof d.actions=="object"&&!Array.isArray(d.actions)){const m=Object.create(null);for(const[p,g]of Object.entries(d.actions).slice(0,256)){if(!/^[a-zA-Z0-9_-]{1,64}$/.test(p)||!g||typeof g!="object"||Array.isArray(g))continue;const v=g,y={};if(typeof v.keys=="string"&&v.keys.trim()){const w=v.keys.trim().slice(0,80);try{El(w),y.keys=w}catch{}}typeof v.hidden=="boolean"&&(y.hidden=v.hidden),Object.keys(y).length>0&&(m[p]=y)}f.actions=m}if(Array.isArray(d.custom)){const m=new Set;f.custom=d.custom.slice(0,64).flatMap(p=>{if(!p||typeof p!="object"||Array.isArray(p))return[];const g=p;if(typeof g.id!="string"||!/^[a-zA-Z0-9_-]{1,64}$/.test(g.id)||["__proto__","constructor","prototype"].includes(g.id)||m.has(g.id))return[];if(typeof g.label!="string"||!g.label.trim()||typeof g.keys!="string"||!g.keys.trim())return[];const v=g.keys.trim().slice(0,80);try{El(v)}catch{return[]}return m.add(g.id),[{id:g.id,label:g.label.trim().slice(0,64),keys:v}]})}a[i]=f}return a}function cg(r){var f;const a=[];if((Array.isArray(r.profiles)?r.profiles.slice(0,64):[]).forEach((m,p)=>{const g=To(m,p);g&&!a.some(v=>v.id===g.id)&&a.push(g)}),a.length===0&&(typeof r.token=="string"&&r.token||typeof r.pairCode=="string"&&r.pairCode)){const m=To({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);m&&a.push(m)}const o=typeof r.activeProfileId=="string"?r.activeProfileId:"",d=a.some(m=>m.id===o)?o:((f=a[0])==null?void 0:f.id)||"";return{profiles:a,activeProfileId:d}}function ug(){const r=rg();if(typeof window>"u")return r;let a={};const i=Co("local",qi);if(i)try{a=JSON.parse(i)}catch(ae){console.warn("Failed to parse localStorage settings:",ae)}const o=Qu(a);o.changed&&(a=o.data,ei("local",qi,JSON.stringify(a)));let d=null;const f=Co("session",Xr);if(f)try{d=JSON.parse(f)}catch(ae){console.warn("Failed to parse sessionStorage settings:",ae)}if(!d){const ae={};for(const ge of id)a[ge]!==void 0&&(ae[ge]=a[ge]);d=ae,ei("session",Xr,JSON.stringify(d))}let m=d.fontFamily??a.fontFamily??r.fontFamily;(!m||m===np||m===Kv)&&(m=Iu);const p=window.innerWidth<640?nd:ko,g=d.fontSize??a.fontSize??r.fontSize,v=So(g,p),y=d.virtualKeys??a.virtualKeys??r.virtualKeys,w=zv(y),T=a.language??r.language,R=T==="zh"||T==="en"?T:ig(),k=cg(a),Y=k.profiles.find(ae=>ae.id===k.activeProfileId),z=Qu(d);z.changed&&(d=z.data,ei("session",Xr,JSON.stringify(d)));const I=d.toolbarVisible??a.toolbarVisible??r.toolbarVisible,P=d.toolbarPosition??a.toolbarPosition??r.toolbarPosition,V=d.vibrateOnKeyPress??a.vibrateOnKeyPress??r.vibrateOnKeyPress,oe=ae=>{const ge=d[ae]??a[ae];return typeof ge=="boolean"?ge:r[ae]},ve=(d==null?void 0:d.predictiveEcho)??(a==null?void 0:a.predictiveEcho)??r.predictiveEcho,ne=ve==="always"||ve==="off"||ve==="auto"?ve:"auto",X=typeof d.adminToken=="string"?d.adminToken.slice(0,Pr):typeof a.adminToken=="string"?a.adminToken.slice(0,Pr):r.adminToken,U=sg(d.adminTokens),te={...r,...a,...d,wsUrl:(Y==null?void 0:Y.wsUrl)||(typeof a.wsUrl=="string"?a.wsUrl:r.wsUrl),token:(Y==null?void 0:Y.token)||"",pairCode:(Y==null?void 0:Y.pairCode)||"",autoReconnect:(Y==null?void 0:Y.autoReconnect)??r.autoReconnect,profiles:k.profiles,activeProfileId:k.activeProfileId,clientId:typeof a.clientId=="string"&&a.clientId.trim()?a.clientId.trim().slice(0,128):r.clientId,fontFamily:m,fontSize:v,toolbarVisible:I,toolbarPosition:P,vibrateOnKeyPress:V,predictiveEcho:ne,virtualKeys:w,agentKeymaps:og(a.agentKeymaps),agentAlertBadge:oe("agentAlertBadge"),agentAlertSound:oe("agentAlertSound"),agentAlertVibrate:oe("agentAlertVibrate"),agentAlertNotify:oe("agentAlertNotify"),language:R,adminToken:X,adminTokens:U};return a.fontFamily===np&&(a.fontFamily=Iu,ei("local",qi,JSON.stringify(a))),te}function Ra(r){var T;const i={...ug(),...r};i.agentKeymaps=og(i.agentKeymaps),i.adminTokens=sg(i.adminTokens),typeof i.adminToken=="string"&&(i.adminToken=i.adminToken.slice(0,Pr)),r.fontSize!==void 0&&(i.fontSize=So(r.fontSize)),r.predictiveEcho!==void 0&&(r.predictiveEcho==="auto"||r.predictiveEcho==="always"||r.predictiveEcho==="off"?i.predictiveEcho=r.predictiveEcho:i.predictiveEcho="auto");const o=cg(i);let d=o.profiles,f=o.activeProfileId;if(Vv.some(R=>r[R]!==void 0)){const R=d.findIndex(z=>z.id===f),k=R>=0?{...d[R]}:{id:ad(),displayName:`Herdr ${d.length+1}`,wsUrl:i.wsUrl,token:"",autoReconnect:!0,createdAt:Date.now(),lastUsedAt:Date.now()};k.wsUrl=i.wsUrl,k.token=i.token,k.pairCode=i.pairCode||void 0,k.autoReconnect=i.autoReconnect,k.lastUsedAt=Date.now();const Y=To(k,Math.max(R,0));Y?R>=0?d[R]=Y:(d.push(Y),f=Y.id):R>=0&&(d=d.filter(z=>z.id!==f),f=((T=d[0])==null?void 0:T.id)||"")}d.length>0&&!d.some(R=>R.id===f)&&(f=d[0].id);const p=d.find(R=>R.id===f);i.profiles=d,i.activeProfileId=f,i.wsUrl=(p==null?void 0:p.wsUrl)||i.wsUrl||"/ws/client",i.token=(p==null?void 0:p.token)||"",i.pairCode=(p==null?void 0:p.pairCode)||"",i.autoReconnect=(p==null?void 0:p.autoReconnect)??i.autoReconnect;const g=Co("local",qi);let v={};if(g)try{v=JSON.parse(g)}catch{}v=Qu(v).data;for(const R of qv)i[R]!==void 0&&(v[R]=i[R]);v.profiles=d,v.activeProfileId=f,ei("local",qi,JSON.stringify(v));const y=Co("session",Xr);let w={};if(y)try{w=JSON.parse(y)}catch{}for(const R of id)i[R]!==void 0&&(w[R]=i[R]);ei("session",Xr,JSON.stringify(w));for(const R of Fv)i[R]!==void 0&&(v[R]=i[R]);return ei("local",qi,JSON.stringify(v)),i}const Xv={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",tabAgentKeymaps:"Agent Keys",fontFamilyLabel:"Monospace Font",fontSizeLabel:"Terminal Text Size ({size}px)",fontSizeCompact:"10px (Compact)",fontSizeDefault:"15px (Default)",fontSizeLarge:"24px (Large)",mobileFontNote:"Terminal font scales automatically on small screens for 80-column layout.",colorPassthroughNote:"Terminal colors and cursor style pass through from the host.",predictiveEchoLabel:"Predictive Echo",predictiveEchoAuto:"Auto",predictiveEchoAlways:"Always On",predictiveEchoOff:"Off",predictiveEchoDesc:"Under high latency, show what you type in a shell prompt or an agent’s input box before the echo comes back. Menus and other screens are never predicted.",touchKeyToolbar:"Touch Key Toolbar",touchKeyToolbarDesc:"Show modifier and navigation keys",touchHaptics:"Haptic Feedback",touchHapticsDesc:"Vibrate on key press",agentAlertsLabel:"Agent alerts",agentAlertBadge:"Title and icon badge",agentAlertBadgeDesc:"Count blocked and finished agents in the tab title, and mark the tab icon",agentAlertVibrate:"Vibrate",agentAlertVibrateDesc:"When an agent stops to ask or finishes, while this page is on screen",agentAlertSound:"Chime",agentAlertSoundDesc:"A short sound while this page is in the background; starts working after your next tap",agentAlertNotify:"System notification",agentAlertNotifyDesc:"While this page is in the background (HTTPS only)",languageLabel:"Language",languageDesc:"Choose English or 简体中文",resetDefaults:"Reset to Defaults",resetDefaultsToast:"Settings reset to defaults",windowZoomSharedNote:"Host view isolation is not active; zoom applies locally.",fontSizeZoomHelp:"Adjusts font size in this window only."},agentKeymaps:{keymapLabel:"Keymap",auto:"Auto",shell:"Shell",agentGroup:"Agent",genericGroup:"General",settingsProfileLabel:"Agent profile",autoProfile:"Auto · {profile}",pinnedProfile:"Pinned · {profile}",barGroup:"Key bar",barHint:"Tap to choose which {profile} shortcuts appear on the key bar ({count} shown). Saved in this browser, per agent. ESC, arrows and other base keys are on the Virtual Keys tab.",restoreBar:"Restore default keys",customizeBar:"Choose which shortcuts the key bar shows",customizeBarShort:"Edit",shortcutLabel:"Shortcut",comboPlaceholder:"e.g. ctrl+e or esc esc",invalidCombo:"Invalid shortcut: {error}",defaultCombo:"Default: {combo}",resetAction:"Reset",moveUp:"Move up",moveDown:"Move down",unverified:"Unverified",addCustom:"Custom key",customLabel:"Function name",customCombo:"Key combo",addAction:"Add custom key",restoreProfile:"Restore this agent defaults",removeCustom:"Remove custom key",configHint:"Agent config: {path}",noAgentActions:"No agent-specific shortcuts.",errors:{empty:"Enter at least one key.",tooManySteps:"A shortcut can have at most {count} steps.",invalidStepSyntax:"Step {step} has invalid syntax. Use ctrl+o or esc esc.",duplicateModifier:"Step {step} repeats {modifier}.",missingKey:"Step {step} needs a key after the modifiers.",multipleKeys:"Step {step} can have only one key.",unsupportedKey:"Step {step} does not support “{key}”."}},agentActions:{mode:"Mode",rewind:"Rewind",details:"Details",model:"Model",thinking:"Thinking",todos:"Tasks",background:"Background",editor:"Editor",history:"History",stash:"Stash",pasteImage:"Paste image",newline:"New line",interrupt:"Interrupt",editPrevious:"Edit previous",queue:"Queue prompt",copy:"Copy",clear:"Clear",yolo:"YOLO mode",expand:"Expand",undo:"Undo",agent:"Next agent",agentBack:"Previous agent",palette:"Command palette",recentModel:"Recent model",variant:"Model variant",newSession:"New session",sessions:"Sessions",thinkingMode:"Thinking mode",nextModel:"Next model",modelPicker:"Model picker",tools:"Tools",thinkingBlocks:"Thinking blocks",followup:"Follow-up",dequeue:"Remove from queue",plan:"Plan mode",temporaryModel:"Temporary model",expandAll:"Expand all",reasoning:"Reasoning effort",review:"Review",specMode:"Spec mode",autonomy:"Autonomy",undoPicker:"Undo picker",steer:"Steer",sidebar:"Sidebar",agents:"Agents",permissionMode:"Permission mode",bypass:"Bypass permissions",tasks:"Tasks",interject:"Interject",multiline:"Multiline input",shortcuts:"Shortcuts",approve:"Approve",eof:"End of input",suspend:"Suspend",startOfLine:"Line start",endOfLine:"Line end",killToEnd:"Delete to line end",agentSwap:"Switch agent",activity:"Activity",planAct:"Plan / Act",autoApprove:"Auto-approve",search:"Search"},virtualKeyboard:{collapseToolbar:"Collapse Toolbar",expandToolbar:"Expand Toolbar",helperTitle:"Quick Commands",closeHelper:"Close Helper",placeholder:"Type command and press Enter...",sendButton:"Send",clearInput:"Clear Input",customizeTitle:"Custom Key Toolbar",customizeDesc:"Reorder, enable, or disable keys for your toolbar.",enabledKeysCount:"{count} keys enabled",resetLayout:"Reset to Default",addKey:"Add Key",availableKeys:"Available Keys",moveUp:"Move Up",moveDown:"Move Down",enableKey:"Enable Key",disableKey:"Disable Key",deleteKeyTitle:"Remove Key",keyTypeModifier:"Modifier",keyTypeNav:"Navigation",keyTypeAction:"Action",keyTypeChord:"Chord",keyTypeFn:"Function",keyTypeSymbol:"Symbol",fnDrawerTitle:"Function Keys (F1-F12)",chordsDrawerTitle:"Control Chords (^C, ^D, ^Z)",symbolsDrawerTitle:"Symbols (~, |, /, \\)",touchKeyboardShortcuts:"Shortcuts Toolbar",ctrlCTitle:"Ctrl+C (SIGINT)",ctrlDTitle:"Ctrl+D (EOF)",ctrlZTitle:"Ctrl+Z (SIGTSTP)",ctrlLTitle:"Ctrl+L (Clear)",ctrlRTitle:"Ctrl+R (Search)",ctrlATitle:"Ctrl+A (Start of line)",ctrlETitle:"Ctrl+E (End of line)",ctrlKTitle:"Ctrl+K (Kill to end)",badgeSigint:"SIGINT",badgeEof:"EOF",badgeTstp:"SIGTSTP",badgeClear:"CLEAR",badgeSearch:"SEARCH",badgeStart:"START",badgeEnd:"END",badgeKill:"KILL",keyEnter:"Enter",uploadImage:"Upload Image",uploadImageTitle:"Select and upload image to terminal",image:"Image",uploadProgressReading:"Reading...",uploadProgressProcessing:"Compressing...",uploadProgressSending:"Uploading...",uploadProgressWaitingHost:"Waiting for host...",uploadProgressCompleted:"Completed",uploadProgressFailed:"Upload failed"},profiles:{title:"Herdr instances",switcherLabel:"Switch Herdr instance",current:"current",empty:"No paired Herdr instances yet.",addHost:"Add Herdr instance",rename:"Rename instance",remove:"Remove locally",removeConfirm:"Remove this saved connection from this browser?"},mobile:{sessionControls:"Session controls",closeSessionControls:"Close session controls",connectionStatusAria:"Connection status",terminalControlAria:"Terminal control",inputControl:"Input control",settingsAria:"Terminal settings",adminAria:"Admin dashboard",pairingAria:"Connection & pairing",keybarAria:"Toggle key toolbar",quickInputAria:"Toggle quick commands",menu:"Menu",statusBarAria:"Session status bar"},terminal:{bannerTitle:"Herdr Remote WebUI",bannerSubtitle:"Connected to Herdr session.",windowAriaLabel:"Terminal Window",bufferAriaLabel:"Terminal Buffer",offlineStatusAria:"Offline Status",releaseControlAria:"Release Control",takeoverControlAria:"Takeover Control",claimControlAria:"Claim Control"},keyTitles:{esc:"Escape (ESC)",tab:"Tab",shift_tab:"Shift+Tab (Claude Code: cycle modes)",ctrl:"Toggle Ctrl Lock",alt:"Toggle Alt Lock",shift:"Toggle Shift Lock",meta:"Meta / Cmd",enter:"Enter",backspace:"Backspace",delete:"Delete",left:"Left (←)",up:"Up (↑)",down:"Down (↓)",right:"Right (→)",home:"Home",end:"End",page_up:"Page Up",page_down:"Page Down",insert:"Insert",drawer_chords:"Ctrl Chords",drawer_agent:"Agent shortcuts",drawer_symbols:"Symbols",drawer_fn:"Function Keys (F1-F12)",ctrl_c:"Ctrl+C (SIGINT)",ctrl_d:"Ctrl+D (EOF)",ctrl_z:"Ctrl+Z (SIGTSTP)",ctrl_l:"Ctrl+L (Clear)",ctrl_a:"Ctrl+A (Start of line)",ctrl_e:"Ctrl+E (End of line)",ctrl_k:"Ctrl+K (Kill to end)",ctrl_r:"Ctrl+R (Search history)",f1:"F1",f2:"F2",f3:"F3",f4:"F4",f5:"F5",f6:"F6",f7:"F7",f8:"F8",f9:"F9",f10:"F10",f11:"F11",f12:"F12",sym_pipe:"Pipe (|)",sym_tilde:"Tilde (~)",sym_slash:"Slash (/)",sym_backslash:"Backslash (\\)",sym_dash:"Dash (-)",sym_underscore:"Underscore (_)",sym_dollar:"Dollar ($)",sym_ampersand:"Ampersand (&)",sym_quote:'Quote (")',sym_backtick:"Backtick (`)"},admin:{title:"Admin Dashboard",subtitle:"Connected hosts, paired devices, and relay traffic",returnToTerminal:"Return to Terminal",terminalShells:"Terminal Shells",startedAt:"Started at {time}",accessPanel:"Access",acrossWindows:"across {count} windows",perSecond:"{value}/s",framesPerSecond:"{count} fps",unitDay:"d",unitHour:"h",unitMinute:"m",unitSecond:"s",startedRecently:"Started recently",updatedAt:"Updated at {time}",autoRefresh:"Auto Refresh:",paused:"Paused",refreshNow:"Refresh",connectedHosts:"Connected Hosts",activeUsers:"Active Users",activePtys:"Active PTYs",activeController:"Active Controller",uptime:"Uptime",none:"None",noHost:"No host connected",tabOverview:"Overview",tabClients:"Clients ({count})",tabPtys:"PTY Sessions ({count})",tabDevices:"Paired Devices ({count})",throughput:"Throughput",bytesInTotal:"Total Inbound:",bytesOutTotal:"Total Outbound:",frameRate:"Frame Rate:",hostsTitle:"Hosts ({count})",noHosts:"No hosts connected or paired",hostConnectedDevices:"{count} connected",hostPairedDevices:"{count} paired",hostStatusOnline:"Online",hostStatusBusy:"In use",hostStatusReconnecting:"Reconnecting",hostStatusOffline:"Offline",hostRosterOperatorOnly:"Device list is visible to the relay operator only.",connectedClientsTitle:"Connected Clients ({count})",noClients:"No clients connected",colClientId:"Client ID",colDevice:"Device",colDeviceId:"Device ID",colLastSeen:"Last Seen",colActions:"Actions",unknownDevice:"Unknown Device",pairedDevicesTitle:"Paired Devices ({count})",noDevices:"No paired devices",revokeDevice:"Revoke",revokeConfirm:"Confirm Revocation",revokeFailed:"Revocation failed",colRole:"Role",colIp:"IP Address",colConnectedAt:"Connected At",colTraffic:"Traffic (In/Out)",activePtysTitle:"Active PTY Sessions ({count})",noPtys:"No active PTY sessions",colPtyId:"PTY ID",colPid:"PID",colCommand:"Command",colGrid:"Grid",colCwd:"Working Directory",colViewers:"Windows",copiedJson:"Copied",unauthorizedTitle:"Unauthorized (401/403)",unauthorizedDesc:"GET /api/status requires an authorized device token.",pairingStepsTitle:"Device Pairing:",pairingStepsHelp:"Run pairing command on host to get a code, then enter it here.",enterPairCodeBtn:"Enter Pairing Code",retryFetchBtn:"Retry Status",errorConnecting:"Failed to fetch GET /api/status: {error}",loadingStatus:"Loading status from /api/status...",remoteRelayTitle:"Remote Relay Administration",remoteRelayBadge:"Connected to Remote Relay",remoteRelayNotice:"Connected to remote relay. For server metrics, access the operator dashboard.",remoteRelayEndpoint:"Remote WebSocket Endpoint:",remoteRelayAdminUrl:"Remote Admin URL:",openRemoteAdminBtn:"Open Remote Admin",remoteRelayHelp:"Open remote relay admin dashboard.",relayAdminTitle:"Relay Operator Dashboard",relayAdminTokenLabel:"Relay Admin Token (X-Relay-Admin-Token)",relayAdminTokenPlaceholder:"Enter RELAY_ADMIN_TOKEN...",relayAdminNotConfigured:"RELAY_ADMIN_TOKEN is not configured on this relay.",relayAdminLoginBtn:"Verify & View Metrics",relayAdminAuthError:"Invalid or unauthorized admin token.",remoteRelayClientNotice:"Terminal client connection. For server metrics, use the operator dashboard.",openOperatorPortal:"Open Operator Dashboard",localWorkstationBadge:"Local Relay",modeLocal:"Local Mode",modeRemote:"Remote Mode",hintTabs:"switch tabs",hintRefresh:"refresh status",hintBack:"return to terminal"},toasts:{connected:"Connected to relay",connectionError:"Connection error",controlGranted:"Control granted",controlDenied:"Request denied: another controller is active",controlRevoked:"Control transferred to another device",pairedSuccess:"Paired successfully",sessionEnded:"Session ended",controlReleased:"Control released",viewerModeWarning:'In viewer mode. Click "Claim Control" first.',clientIdCopied:"Client ID copied: {id}",pairingLinkCopied:"Pairing link copied",switchedLanguage:"Language switched to {lang}",settingsReset:"Settings reset to default",fontReset:"Font reset to default",commandCopied:"Command copied",keyLayoutReset:"Key layout reset"},shortcuts:{title:"Shortcuts",help:"Active outside terminal input area:",terminalInputNote:"Terminal shortcuts pass directly to host PTY."},serverErrors:{auth_required:"Pairing required: enter a pairing code, or a device token that is still valid.",unauthorized:"This device is not authorised for that workstation.",host_offline:"The paired workstation is not connected to this relay.",host_disconnected:"The workstation disconnected.",stale_host:"The workstation stopped answering and was dropped.",too_many_clients:"That workstation has reached its window limit.",rate_limited:"Too many pairing attempts. Wait a minute and try again.",invalid_handshake:"The relay rejected the handshake. Reload the page.",device_revoked:"This device was revoked by the relay operator.",connection_closed:"Connection closed. Reconnecting…",connection_stale:"The connection went quiet while the page was away. Reconnecting…",connection_stalled:"Connecting took too long. Trying again…",connection_failed:"Could not open a connection to the relay.",host_reconnecting:"The Herdr host is reconnecting.",host_reconnect_timeout:"The Herdr host did not reconnect in time.",host_replaced:"The Herdr host connection was replaced.",slow_client:"This browser was disconnected because it could not keep up.",client_send_failed:"The relay could not send data to this browser.",too_many_hosts:"This relay has reached its host limit.",paste_file_unsupported:"Unsupported image format for paste.",paste_file_too_large:"Pasted image exceeds 3 MB limit.",paste_file_write_failed:"Failed to save pasted image on host.",paste_file_empty:"Pasted image payload is empty.",paste_file_corrupt:"Pasted image data is corrupt or does not match declared MIME.",viewer_mode:"Viewer mode cannot paste to terminal.",no_session:"Terminal session is not ready."},fontPresets:{system:"System Default",apple:"SF Mono / Menlo",windows:"Consolas",linux:"Liberation Mono",courier:"Courier New",firacode:"Fira Code"},agents:{title:"Agents on this workstation",blocked:"blocked",done:"done",working:"working",allIdle:"agents idle",notifyBlocked:"{count} agent(s) waiting for you",notifyDone:"{count} agent(s) finished"},clipboard:{openLink:"Open Link",openLinkFailed:"This link cannot be opened from the browser",copySelection:"Copy Selection",copyLine:"Copy Line",copyScreen:"Copy Screen",paste:"Paste",cancel:"Cancel",copied:"Copied to clipboard",copyFailed:"Failed to copy",pasteHint:"Long-press here to paste, then tap Send",pasteSend:"Send",pasteUnavailable:"Clipboard is empty or unavailable",pasteTitle:"Paste Content",pasted:"Pasted",chooseImage:"Choose Image",takePhoto:"Take Photo",imageTooLarge:"Image exceeds 3 MB limit and cannot be compressed further.",imageCompressedSize:"Compressed: {size}",fileEmpty:"File is empty.",decodeFailed:"Failed to decode image file.",unsupportedType:"Unsupported format. Only PNG, JPEG, WebP, and GIF are supported.",imageSectionTitle:"Image",textSectionTitle:"Text",imageCompressing:"Processing image...",removeImage:"Remove image"}},Iv={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:"虚拟按键",tabAgentKeymaps:"智能体按键",fontFamilyLabel:"等宽字体",fontSizeLabel:"终端字号 ({size}px)",fontSizeCompact:"10px (紧凑)",fontSizeDefault:"15px (默认)",fontSizeLarge:"24px (大字号)",mobileFontNote:"小屏设备自动适配字号,保持 80 列完整显示。",colorPassthroughNote:"终端配色与光标样式透传自宿主环境。",predictiveEchoLabel:"预测回显",predictiveEchoAuto:"自动",predictiveEchoAlways:"始终开启",predictiveEchoOff:"关闭",predictiveEchoDesc:"高延迟时,在 shell 提示符或智能体输入框里先行显示输入的字符,回显到达后自动校正。菜单等其他界面不做预测。",touchKeyToolbar:"底部触控按键条",touchKeyToolbarDesc:"显示移动端修饰键与方向键工具栏",touchHaptics:"触控振动反馈",touchHapticsDesc:"移动端按键时轻微震动",agentAlertsLabel:"智能体提醒",agentAlertBadge:"标题与图标角标",agentAlertBadgeDesc:"在标签页标题里显示等待确认和已完成的智能体数量,并在图标上加角标",agentAlertVibrate:"震动",agentAlertVibrateDesc:"智能体停下来等你确认或完成时震动(页面在前台时)",agentAlertSound:"提示音",agentAlertSoundDesc:"页面在后台时播放短提示音;下次点击页面后生效",agentAlertNotify:"系统通知",agentAlertNotifyDesc:"页面在后台时发系统通知(仅 HTTPS)",languageLabel:"显示语言",languageDesc:"选择 English 或 简体中文",resetDefaults:"恢复默认设置",resetDefaultsToast:"设置已恢复默认",windowZoomSharedNote:"当前宿主未启用视图隔离,字号调整仅影响本地窗口。",fontSizeZoomHelp:"仅调节当前窗口字号,不影响其他窗口。"},agentKeymaps:{keymapLabel:"按键方案",auto:"自动",shell:"Shell",agentGroup:"智能体",genericGroup:"通用",settingsProfileLabel:"智能体方案",autoProfile:"自动 · {profile}",pinnedProfile:"固定 · {profile}",barGroup:"按键栏显示",barHint:"点选要在底部按键栏显示的 {profile} 快捷键(已显示 {count} 个)。按智能体分别保存在当前浏览器;ESC、方向键等基础按键在「虚拟按键」页设置。",restoreBar:"恢复默认显示",customizeBar:"自定义按键栏显示哪些快捷键",customizeBarShort:"自定义",shortcutLabel:"快捷键",comboPlaceholder:"例如 ctrl+e 或 esc esc",invalidCombo:"快捷键无效:{error}",defaultCombo:"默认:{combo}",resetAction:"重置",moveUp:"上移",moveDown:"下移",unverified:"未验证",addCustom:"自定义按键",customLabel:"功能名称",customCombo:"按键组合",addAction:"添加自定义按键",restoreProfile:"恢复此智能体默认设置",removeCustom:"删除自定义按键",configHint:"智能体配置:{path}",noAgentActions:"此智能体没有专用快捷键。",errors:{empty:"至少输入一个按键。",tooManySteps:"快捷键最多包含 {count} 个步骤。",invalidStepSyntax:"第 {step} 步格式无效。可输入 ctrl+o 或 esc esc。",duplicateModifier:"第 {step} 步重复使用了 {modifier}。",missingKey:"第 {step} 步需要在修饰键后输入一个按键。",multipleKeys:"第 {step} 步只能包含一个按键。",unsupportedKey:"第 {step} 步不支持按键“{key}”。"}},agentActions:{mode:"模式",rewind:"回退",details:"详情",model:"模型",thinking:"思考",todos:"任务",background:"后台运行",editor:"编辑器",history:"历史",stash:"暂存",pasteImage:"粘贴图片",newline:"换行",interrupt:"中断",editPrevious:"编辑上一条",queue:"排队发送",copy:"复制",clear:"清屏",yolo:"YOLO 模式",expand:"展开",undo:"撤销",agent:"下一个智能体",agentBack:"上一个智能体",palette:"命令面板",recentModel:"最近模型",variant:"模型变体",newSession:"新会话",sessions:"会话列表",thinkingMode:"思考模式",nextModel:"下一个模型",modelPicker:"模型选择器",tools:"工具",thinkingBlocks:"思考内容",followup:"后续提问",dequeue:"移出队列",plan:"计划模式",temporaryModel:"临时模型",expandAll:"全部展开",reasoning:"推理强度",review:"代码审查",specMode:"规格模式",autonomy:"自主模式",undoPicker:"撤销菜单",steer:"引导",sidebar:"侧栏",agents:"智能体列表",permissionMode:"权限模式",bypass:"绕过权限",tasks:"任务",interject:"插话",multiline:"多行输入",shortcuts:"快捷键",approve:"批准",eof:"结束输入",suspend:"挂起",startOfLine:"行首",endOfLine:"行尾",killToEnd:"删除至行尾",agentSwap:"切换智能体",activity:"活动面板",planAct:"计划 / 执行",autoApprove:"自动批准",search:"搜索"},virtualKeyboard:{collapseToolbar:"收起按键栏",expandToolbar:"展开按键栏",helperTitle:"快捷命令",closeHelper:"关闭命令助手",placeholder:"输入终端命令并回车...",sendButton:"发送",clearInput:"清除输入内容",customizeTitle:"自定义虚拟按键",customizeDesc:"调整按键顺序与启禁用状态。",enabledKeysCount:"已启用 {count} 个按键",resetLayout:"恢复默认布局",addKey:"添加按键",availableKeys:"可选按键库",moveUp:"前移",moveDown:"后移",enableKey:"启用按键",disableKey:"禁用按键",deleteKeyTitle:"删除按键",keyTypeModifier:"修饰键",keyTypeNav:"导航键",keyTypeAction:"动作键",keyTypeChord:"组合键",keyTypeFn:"功能键",keyTypeSymbol:"符号",fnDrawerTitle:"功能键 (F1-F12)",chordsDrawerTitle:"控制组合键 (^C, ^D, ^Z)",symbolsDrawerTitle:"终端常用符号 (~, |, /, \\)",touchKeyboardShortcuts:"快捷键工具栏",ctrlCTitle:"Ctrl+C (中断)",ctrlDTitle:"Ctrl+D (退出)",ctrlZTitle:"Ctrl+Z (挂起)",ctrlLTitle:"Ctrl+L (清屏)",ctrlRTitle:"Ctrl+R (搜索)",ctrlATitle:"Ctrl+A (行首)",ctrlETitle:"Ctrl+E (行尾)",ctrlKTitle:"Ctrl+K (剪切)",badgeSigint:"中断",badgeEof:"退出",badgeTstp:"挂起",badgeClear:"清屏",badgeSearch:"搜索",badgeStart:"行首",badgeEnd:"行尾",badgeKill:"剪切",keyEnter:"回车",uploadImage:"上传图片",uploadImageTitle:"选择图片并上传至终端",image:"图片",uploadProgressReading:"读取中...",uploadProgressProcessing:"处理压缩中...",uploadProgressSending:"上传中...",uploadProgressWaitingHost:"等待工作站保存...",uploadProgressCompleted:"完成",uploadProgressFailed:"上传失败"},profiles:{title:"Herdr 实例",switcherLabel:"切换 Herdr 实例",current:"当前",empty:"还没有已配对的 Herdr 实例。",addHost:"添加 Herdr 实例",rename:"重命名实例",remove:"仅本地移除",removeConfirm:"确认从此浏览器移除已保存的连接?"},mobile:{sessionControls:"会话控制",closeSessionControls:"关闭会话控制面板",connectionStatusAria:"连接状态",terminalControlAria:"终端控制权",inputControl:"输入控制权",settingsAria:"终端设置",adminAria:"打开管理面板",pairingAria:"连接与配对设置",keybarAria:"切换触控按键条",quickInputAria:"切换快捷命令",menu:"菜单",statusBarAria:"会话状态栏"},terminal:{bannerTitle:"Herdr Remote WebUI",bannerSubtitle:"已连接至 Herdr 会话。",windowAriaLabel:"远程终端窗口",bufferAriaLabel:"xterm 终端缓冲区",offlineStatusAria:"离线状态",releaseControlAria:"释放终端控制权",takeoverControlAria:"强占终端控制权",claimControlAria:"获取终端控制权"},keyTitles:{esc:"Escape (ESC)",tab:"Tab",shift_tab:"Shift+Tab(Claude Code 切换模式)",ctrl:"切换 Ctrl 锁定",alt:"切换 Alt 锁定",shift:"切换 Shift 锁定",meta:"Meta / 命令键",enter:"回车 (Enter)",backspace:"退格 (Backspace)",delete:"删除 (Delete)",left:"左箭头 (←)",up:"上箭头 (↑)",down:"下箭头 (↓)",right:"右箭头 (→)",home:"行首 (Home)",end:"行尾 (End)",page_up:"向上翻页 (Page Up)",page_down:"向下翻页 (Page Down)",insert:"插入 (Insert)",drawer_chords:"常用 Ctrl 组合键",drawer_agent:"智能体快捷键",drawer_symbols:"常用特殊符号",drawer_fn:"功能键 (F1-F12)",ctrl_c:"Ctrl+C (中断)",ctrl_d:"Ctrl+D (退出)",ctrl_z:"Ctrl+Z (挂起)",ctrl_l:"Ctrl+L (清屏)",ctrl_a:"Ctrl+A (行首)",ctrl_e:"Ctrl+E (行尾)",ctrl_k:"Ctrl+K (剪切)",ctrl_r:"Ctrl+R (历史搜索)",f1:"F1",f2:"F2",f3:"F3",f4:"F4",f5:"F5",f6:"F6",f7:"F7",f8:"F8",f9:"F9",f10:"F10",f11:"F11",f12:"F12",sym_pipe:"管道符 (|)",sym_tilde:"波浪号 (~)",sym_slash:"正斜杠 (/)",sym_backslash:"反斜杠 (\\)",sym_dash:"连字符 (-)",sym_underscore:"下划线 (_)",sym_dollar:"美元符 ($)",sym_ampersand:"与符号 (&)",sym_quote:'双引号 (")',sym_backtick:"反引号 (`)"},admin:{title:"系统管理面板",subtitle:"接入主机、配对设备与中转流量",returnToTerminal:"返回终端",terminalShells:"个终端 Shell",startedAt:"启动于 {time}",accessPanel:"接入概览",acrossWindows:"共 {count} 个窗口",perSecond:"{value}/秒",framesPerSecond:"{count} 帧/秒",unitDay:" 天",unitHour:" 小时",unitMinute:" 分",unitSecond:" 秒",startedRecently:"最近启动",updatedAt:"更新于 {time}",autoRefresh:"自动刷新:",paused:"暂停刷新",refreshNow:"立即刷新",connectedHosts:"接入主机",activeUsers:"活跃用户",activePtys:"活动 PTY",activeController:"活跃控制者",uptime:"运行时间",none:"无",noHost:"未连接主机",tabOverview:"系统概览",tabClients:"客户端列表 ({count})",tabPtys:"PTY 会话 ({count})",tabDevices:"已配对设备 ({count})",throughput:"网络吞吐流量",bytesInTotal:"入站流量:",bytesOutTotal:"出站流量:",frameRate:"帧率统计:",hostsTitle:"主机 ({count})",noHosts:"暂无接入或配对的主机",hostConnectedDevices:"{count} 台在线",hostPairedDevices:"{count} 台已配对",hostStatusOnline:"在线",hostStatusBusy:"使用中",hostStatusReconnecting:"重连中",hostStatusOffline:"离线",hostRosterOperatorOnly:"设备清单仅 Relay 操作员可见。",connectedClientsTitle:"已连接客户端 ({count})",noClients:"当前暂无客户端连接",colClientId:"客户端 ID",colDevice:"设备",colDeviceId:"设备 ID",colLastSeen:"最近活动",colActions:"操作",unknownDevice:"未知设备",pairedDevicesTitle:"已配对设备 ({count})",noDevices:"尚未配对任何设备",revokeDevice:"撤销",revokeConfirm:"确认撤销",revokeFailed:"撤销失败",colRole:"角色",colIp:"IP 地址",colConnectedAt:"连接时间",colTraffic:"网络流量 (入/出)",activePtysTitle:"活动 PTY 终端会话 ({count})",noPtys:"当前无活跃的 PTY 会话",colPtyId:"PTY 标识",colPid:"进程 PID",colCommand:"运行命令",colGrid:"网格规格",colCwd:"工作目录",colViewers:"窗口数",copiedJson:"已复制",unauthorizedTitle:"管理接口未授权 (401/403)",unauthorizedDesc:"访问 GET /api/status 需要已授权的设备 Token。",pairingStepsTitle:"设备配对指引:",pairingStepsHelp:"在主机运行配对命令获取配对码后输入。",enterPairCodeBtn:"输入配对码",retryFetchBtn:"重新获取状态",errorConnecting:"连接 GET /api/status 失败:{error}",loadingStatus:"正在加载系统状态...",remoteRelayTitle:"远程 Relay 服务管理",remoteRelayBadge:"已连接远程 Relay 服务",remoteRelayNotice:"当前连接至远程独立 Relay 服务。如需查看服务端指标,请使用操作员后台。",remoteRelayEndpoint:"远程端点:",remoteRelayAdminUrl:"远程后台地址:",openRemoteAdminBtn:"前往远程管理后台",remoteRelayHelp:"直接访问远程 Relay 管理后台。",relayAdminTitle:"Relay 操作员管理后台",relayAdminTokenLabel:"Relay 管理员令牌 (X-Relay-Admin-Token)",relayAdminTokenPlaceholder:"请输入 RELAY_ADMIN_TOKEN...",relayAdminNotConfigured:"该 Relay 服务未配置 RELAY_ADMIN_TOKEN。",relayAdminLoginBtn:"验证并查看服务端指标",relayAdminAuthError:"管理员令牌无效或未授权。",remoteRelayClientNotice:"当前为终端客户端连接。如需查看服务端指标,请访问操作员后台。",openOperatorPortal:"打开服务端管理后台",localWorkstationBadge:"本地宿主 Relay",modeLocal:"本地模式",modeRemote:"远程模式",hintTabs:"切换标签页",hintRefresh:"刷新状态",hintBack:"返回终端"},toasts:{connected:"已连接至 Relay 服务",connectionError:"连接发生错误",controlGranted:"已获得控制权",controlDenied:"控制请求被拒绝:已有活跃控制者",controlRevoked:"控制权已转移",pairedSuccess:"设备配对成功,已保存凭证",sessionEnded:"终端会话已结束",controlReleased:"已释放控制权,切回观察者模式",viewerModeWarning:"处于观察者模式,请先获取控制权",clientIdCopied:"客户端 ID 已复制: {id}",pairingLinkCopied:"配对链接已复制",switchedLanguage:"语言已切换为 {lang}",settingsReset:"设置已恢复默认",fontReset:"字体已恢复默认",commandCopied:"命令已复制",keyLayoutReset:"虚拟按键布局已恢复默认"},shortcuts:{title:"WebUI 快捷键",help:"以下快捷键仅在非终端输入区域生效:",terminalInputNote:"终端操作快捷键直接透传至宿主 PTY。"},serverErrors:{auth_required:"需要配对:请输入配对码,或填写仍然有效的设备令牌。",unauthorized:"该设备无权访问此工作站。",host_offline:"已配对的工作站未连接到该 relay。",host_disconnected:"工作站已断开连接。",stale_host:"工作站长时间无响应,已被断开。",too_many_clients:"该工作站的窗口数量已达上限。",rate_limited:"配对尝试过于频繁,请稍后再试。",invalid_handshake:"relay 拒绝了握手,请刷新页面。",device_revoked:"该设备已被 relay 管理员撤销。",connection_closed:"连接已断开,正在重连…",connection_stale:"页面回到前台时连接已无响应,正在重连…",connection_stalled:"连接超时,正在重试…",connection_failed:"无法建立到 relay 的连接。",host_reconnecting:"Herdr 主机正在重连。",host_reconnect_timeout:"Herdr 主机未能及时恢复连接。",host_replaced:"Herdr 主机连接已被替换。",slow_client:"由于浏览器处理速度过慢,连接已关闭。",client_send_failed:"Relay 无法向此浏览器发送数据。",too_many_hosts:"此 relay 已达到主机数量上限。",paste_file_unsupported:"不支持的粘贴图片格式。",paste_file_too_large:"粘贴图片超过 3 MB 上限。",paste_file_write_failed:"工作站保存图片失败。",paste_file_empty:"粘贴图片内容为空。",paste_file_corrupt:"粘贴图片数据损坏或与声明格式不符。",viewer_mode:"观察者模式无法粘贴到终端。",no_session:"终端会话未准备就绪。"},fontPresets:{system:"系统默认",apple:"Apple SF Mono / Menlo",windows:"Windows Consolas",linux:"Linux Liberation Mono",courier:"Courier New",firacode:"Fira Code"},agents:{title:"本工作站的智能体",blocked:"待确认",done:"已完成",working:"运行中",allIdle:"智能体空闲",notifyBlocked:"{count} 个智能体在等你确认",notifyDone:"{count} 个智能体已完成"},clipboard:{openLink:"打开链接",openLinkFailed:"该链接无法在浏览器中打开",copySelection:"复制选中",copyLine:"复制本行",copyScreen:"复制整屏",paste:"粘贴",cancel:"取消",copied:"已复制到剪贴板",copyFailed:"复制失败",pasteHint:"长按此处粘贴,然后按发送",pasteSend:"发送",pasteUnavailable:"剪贴板为空或不可用",pasteTitle:"粘贴内容",pasted:"已粘贴",chooseImage:"选择图片",takePhoto:"拍照",imageTooLarge:"图片超过 3 MB 限制且无法进一步压缩。",imageCompressedSize:"压缩后大小:{size}",fileEmpty:"文件内容为空。",decodeFailed:"无法解析图片文件。",unsupportedType:"不支持的图片格式,仅支持 PNG、JPEG、WebP 和 GIF。",imageSectionTitle:"图片",textSectionTitle:"文本",imageCompressing:"正在处理图片...",removeImage:"移除图片"}},zu={en:Xv,zh:Iv};function rd(r,a,i){const o=zu[r]||zu.en,d=a.split(".");let f=o;for(const m of d)if(f&&typeof f=="object"&&m in f)f=f[m];else{let p=zu.en;for(const g of d)if(p&&typeof p=="object"&&g in p)p=p[g];else return a;f=p;break}if(typeof f!="string")return a;if(i){let m=f;for(const[p,g]of Object.entries(i))m=m.replaceAll(`{${p}}`,String(g));return m}return f}const rp="#11111b",Pu=[{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 sp(r){if(!r||typeof r!="string")return Pu[0].font;const a=r.trim();if(a.includes("Symbols Nerd Font"))return a;if(/^['"]?monospace['"]?$/i.test(a))return'"Symbols Nerd Font Mono", monospace';const i=/,\s*['"]?monospace['"]?\s*$/i;return i.test(a)?a.replace(i,', "Symbols Nerd Font Mono", monospace'):`${a}, "Symbols Nerd Font Mono", monospace`}function Zv(r){if(!r)return null;const a={};return r.background&&(a.background=r.background,a.cursorAccent=r.background),r.foreground&&(a.foreground=r.foreground),r.cursor&&(a.cursor=r.cursor),r.ansi&&Object.assign(a,r.ansi),Object.keys(a).length===0?null:a}function dg(){if(typeof document>"u")return;const r=document.querySelector('meta[name="theme-color"]');document.documentElement.style.colorScheme="dark",r==null||r.setAttribute("content",rp),document.documentElement.classList.add("dark"),document.documentElement.classList.remove("light"),document.body.classList.add("dark"),document.body.classList.remove("light"),document.body.style.backgroundColor=rp}const A=(r,a,i,o=!0)=>({id:r,labelKey:a,combo:i,verified:o}),fg={claude:{id:"claude",name:"Claude Code",shortName:"Claude",configHint:"~/.claude/keybindings.json",bar:["mode","rewind","details","model"],actions:[A("mode","mode","shift+tab"),A("rewind","rewind","esc esc"),A("details","details","ctrl+o"),A("model","model","alt+p"),A("thinking","thinking","alt+t"),A("todos","todos","ctrl+t"),A("background","background","ctrl+b"),A("editor","editor","ctrl+g"),A("history","history","ctrl+r"),A("stash","stash","ctrl+s"),A("pasteImage","pasteImage","ctrl+v"),A("newline","newline","ctrl+j"),A("interrupt","interrupt","esc")]},codex:{id:"codex",name:"Codex",shortName:"Codex",configHint:"~/.codex/config.toml [tui.keymap]",bar:["mode","editPrevious","details"],actions:[A("mode","mode","shift+tab"),A("editPrevious","editPrevious","esc esc"),A("details","details","ctrl+t"),A("queue","queue","tab"),A("history","history","ctrl+r"),A("copy","copy","ctrl+o"),A("editor","editor","ctrl+g"),A("newline","newline","ctrl+j"),A("clear","clear","ctrl+l"),A("interrupt","interrupt","esc")]},gemini:{id:"gemini",name:"Gemini CLI",shortName:"Gemini",configHint:"~/.gemini/keybindings.json",bar:["mode","yolo","rewind"],actions:[A("mode","mode","shift+tab"),A("yolo","yolo","ctrl+y"),A("rewind","rewind","esc esc"),A("todos","todos","ctrl+t"),A("expand","expand","ctrl+o"),A("background","background","ctrl+b"),A("editor","editor","ctrl+g"),A("history","history","ctrl+r"),A("undo","undo","ctrl+z"),A("newline","newline","ctrl+j"),A("interrupt","interrupt","esc")]},qwen:{id:"qwen",name:"Qwen Code",shortName:"Qwen",bar:["mode","history"],actions:[A("mode","mode","shift+tab"),A("interrupt","interrupt","esc"),A("history","history","ctrl+r"),A("newline","newline","ctrl+j"),A("todos","todos","ctrl+t",!1),A("rewind","rewind","esc esc",!1)]},opencode:{id:"opencode",name:"OpenCode",shortName:"OpenCode",configHint:"tui.json keybinds",bar:["palette","model","sessions"],actions:[A("agent","agent","tab"),A("agentBack","agentBack","shift+tab"),A("interrupt","interrupt","esc"),A("palette","palette","ctrl+p"),A("model","model","ctrl+x m"),A("recentModel","recentModel","f2"),A("variant","variant","ctrl+t"),A("newSession","newSession","ctrl+x n"),A("sessions","sessions","ctrl+x l"),A("undo","undo","ctrl+x u"),A("editor","editor","ctrl+x e"),A("newline","newline","ctrl+j")]},kilo:{id:"kilo",name:"Kilo Code",shortName:"Kilo",configHint:"~/.config/kilo/tui.jsonc",bar:["palette","model","sessions"],actions:[A("agent","agent","tab",!1),A("agentBack","agentBack","shift+tab",!1),A("interrupt","interrupt","esc"),A("palette","palette","ctrl+p"),A("model","model","ctrl+x m"),A("recentModel","recentModel","f2"),A("variant","variant","ctrl+t"),A("newSession","newSession","ctrl+x n"),A("sessions","sessions","ctrl+x l"),A("undo","undo","ctrl+x u"),A("editor","editor","ctrl+x e"),A("newline","newline","ctrl+j")]},pi:{id:"pi",name:"Pi",shortName:"Pi",configHint:"~/.pi/agent/keybindings.json",bar:["thinkingMode","modelPicker","tools"],actions:[A("thinkingMode","thinkingMode","shift+tab"),A("interrupt","interrupt","esc"),A("nextModel","nextModel","ctrl+p"),A("modelPicker","modelPicker","ctrl+l"),A("tools","tools","ctrl+o"),A("thinkingBlocks","thinkingBlocks","ctrl+t"),A("editor","editor","ctrl+g"),A("followup","followup","alt+enter"),A("dequeue","dequeue","alt+up"),A("newline","newline","shift+enter")]},omp:{id:"omp",name:"Oh My Pi",shortName:"OMP",configHint:"~/.omp/agent/keybindings.yml",bar:["thinkingMode","plan","model"],actions:[A("thinkingMode","thinkingMode","shift+tab"),A("plan","plan","alt+shift+p"),A("model","model","alt+m"),A("temporaryModel","temporaryModel","alt+p"),A("nextModel","nextModel","ctrl+p"),A("tools","tools","ctrl+o"),A("thinking","thinking","ctrl+t"),A("history","history","ctrl+r"),A("editor","editor","ctrl+g"),A("followup","followup","ctrl+enter"),A("interrupt","interrupt","esc")]},copilot:{id:"copilot",name:"GitHub Copilot",shortName:"Copilot",bar:["mode","expand","reasoning"],actions:[A("mode","mode","shift+tab"),A("interrupt","interrupt","esc"),A("expand","expand","ctrl+o"),A("expandAll","expandAll","ctrl+e"),A("reasoning","reasoning","ctrl+t"),A("editor","editor","ctrl+g"),A("clear","clear","ctrl+l")]},cursor:{id:"cursor",name:"Cursor",shortName:"Cursor",bar:["mode","review"],actions:[A("mode","mode","shift+tab"),A("review","review","ctrl+r"),A("newline","newline","ctrl+j"),A("interrupt","interrupt","esc",!1)]},droid:{id:"droid",name:"Factory Droid",shortName:"Droid",configHint:"In-app settings",bar:["specMode","autonomy"],actions:[A("specMode","specMode","shift+tab"),A("autonomy","autonomy","ctrl+l"),A("details","details","ctrl+o",!1),A("queue","queue","ctrl+enter"),A("interrupt","interrupt","esc",!1)]},kimi:{id:"kimi",name:"Kimi Code",shortName:"Kimi",bar:["plan","undoPicker","expand"],actions:[A("plan","plan","shift+tab"),A("interrupt","interrupt","esc"),A("undoPicker","undoPicker","esc esc"),A("expand","expand","ctrl+o"),A("editor","editor","ctrl+g"),A("steer","steer","ctrl+s"),A("undo","undo","ctrl+-"),A("newline","newline","ctrl+j"),A("pasteImage","pasteImage","ctrl+v")]},amp:{id:"amp",name:"Amp",shortName:"Amp",bar:["palette","reasoning","mode"],actions:[A("palette","palette","ctrl+o"),A("reasoning","reasoning","alt+d"),A("mode","mode","ctrl+s",!1),A("editor","editor","ctrl+g"),A("history","history","ctrl+r"),A("sidebar","sidebar","ctrl+backslash"),A("pasteImage","pasteImage","ctrl+v"),A("interrupt","interrupt","esc",!1)]},hermes:{id:"hermes",name:"Hermes",shortName:"Hermes",bar:["interrupt","agents","sessions"],actions:[A("interrupt","interrupt","ctrl+c"),A("newline","newline","ctrl+j"),A("editor","editor","ctrl+g"),A("agents","agents","ctrl+t"),A("sessions","sessions","ctrl+x")]},qodercli:{id:"qodercli",name:"Qoder CLI",shortName:"Qoder",configHint:"/shortcuts in-app",bar:["permissionMode","bypass","tasks","interrupt"],actions:[A("permissionMode","permissionMode","shift+tab"),A("bypass","bypass","ctrl+y"),A("tasks","tasks","ctrl+t"),A("editor","editor","ctrl+x"),A("history","history","ctrl+r"),A("queue","queue","ctrl+enter"),A("newline","newline","ctrl+j"),A("pasteImage","pasteImage","alt+v"),A("interrupt","interrupt","ctrl+c")]},devin:{id:"devin",name:"Devin",shortName:"Devin",configHint:"~/.config/devin/config.json keymap",bar:["mode","thinking","interrupt"],actions:[A("mode","mode","shift+tab"),A("interrupt","interrupt","ctrl+c"),A("thinking","thinking","alt+t"),A("newline","newline","ctrl+j"),A("pasteImage","pasteImage","ctrl+v")]},grok:{id:"grok",name:"Grok CLI",shortName:"Grok",bar:["mode","rewind","interrupt"],actions:[A("mode","mode","shift+tab"),A("interrupt","interrupt","ctrl+c"),A("rewind","rewind","esc esc"),A("interject","interject","ctrl+enter"),A("multiline","multiline","ctrl+m"),A("newline","newline","alt+enter"),A("shortcuts","shortcuts","ctrl+.")]},agy:{id:"agy",name:"Antigravity",shortName:"Antigravity",configHint:"~/.gemini/antigravity-cli/keybindings.json",bar:["mode","approve","interrupt"],actions:[A("mode","mode","shift+tab"),A("interrupt","interrupt","ctrl+c"),A("background","background","ctrl+b"),A("approve","approve","ctrl+k"),A("clear","clear","esc esc")]},mastracode:{id:"mastracode",name:"MastraCode",shortName:"MastraCode",bar:["interrupt","thinking","expand"],actions:[A("interrupt","interrupt","ctrl+c"),A("thinking","thinking","ctrl+t"),A("expand","expand","ctrl+e"),A("followup","followup","ctrl+f")]},letta:{id:"letta",name:"Letta Code",shortName:"Letta",bar:["permissionMode"],actions:[A("permissionMode","permissionMode","shift+tab"),A("interrupt","interrupt","esc",!1)]},kiro:{id:"kiro",name:"Kiro CLI",shortName:"Kiro",configHint:"kiro-cli settings chat.keybindings.*",bar:["agentSwap","details","steer"],actions:[A("agentSwap","agentSwap","shift+tab"),A("interrupt","interrupt","esc"),A("details","details","ctrl+t"),A("steer","steer","ctrl+s"),A("expand","expand","ctrl+o"),A("activity","activity","ctrl+x"),A("newline","newline","ctrl+j")]},cline:{id:"cline",name:"Cline",shortName:"Cline",bar:["autoApprove"],actions:[A("planAct","planAct","tab"),A("autoApprove","autoApprove","shift+tab"),A("interrupt","interrupt","esc",!1)]},maki:{id:"maki",name:"Maki",shortName:"Maki",bar:["rewind","search"],actions:[A("rewind","rewind","esc esc"),A("search","search","ctrl+f"),A("interrupt","interrupt","esc",!1)]},muse:{id:"muse",name:"Muse",shortName:"Muse",configHint:"/keymap in-app",bar:["queue","interruptCtrl"],actions:[A("interrupt","interrupt","esc"),A("queue","queue","alt+enter"),A("interruptCtrl","interrupt","ctrl+c")]},shell:{id:"shell",name:"Shell",shortName:"Shell",actions:[]}},Yi=fg,Qv=Object.keys(fg),op={pi:"pi",claude:"claude","claude-code":"claude",codex:"codex",gemini:"gemini",cursor:"cursor","cursor-agent":"cursor",devin:"devin","devin-cli":"devin","devin cli":"devin",agy:"agy",antigravity:"agy","antigravity-cli":"agy",cline:"cline",".cline":"cline",omp:"omp",mastracode:"mastracode","mastra-code":"mastracode","mastra code":"mastracode",opencode:"opencode",opencode2:"opencode","open-code":"opencode",copilot:"copilot","github-copilot":"copilot",ghcs:"copilot",kimi:"kimi","kimi-code":"kimi","kimi code":"kimi",kiro:"kiro","kiro-cli":"kiro",droid:"droid",amp:"amp","amp-local":"amp",grok:"grok","grok-build":"grok",hermes:"hermes","hermes-agent":"hermes",kilo:"kilo","kilo-code":"kilo","kilo code":"kilo",qodercli:"qodercli",qoderclicn:"qodercli",qoder:"qodercli",qodercn:"qodercli",qwen:"qwen","qwen-code":"qwen","qwen code":"qwen",letta:"letta","letta-code":"letta","letta code":"letta",maki:"maki",muse:"muse","muse-code":"muse","muse-cli":"muse",shell:"shell"},Pv=[A("genericCtrlC","interrupt","ctrl+c"),A("genericCtrlD","eof","ctrl+d"),A("genericCtrlZ","suspend","ctrl+z"),A("genericCtrlL","clear","ctrl+l"),A("genericCtrlR","history","ctrl+r"),A("genericCtrlA","startOfLine","ctrl+a"),A("genericCtrlE","endOfLine","ctrl+e"),A("genericCtrlK","killToEnd","ctrl+k")],Wv=["genericCtrlC","genericCtrlD","genericCtrlL","genericCtrlR"],Jv=["genericCtrlC"];function $v(r){return r&&r.trim().toLowerCase().replace(/\\/g,"/").split("/").at(-1)||""}function cp(r){const a=$v(r);return op[a]?op[a]:/^muse-bin-\d/.test(a)?"muse":null}function ex(r,a="auto"){return a&&a!=="auto"?cp(a)||"shell":cp(r)||"shell"}function tx(r,a){var d,f;const i=r.map(m=>{var v;const p=(v=a==null?void 0:a.actions)==null?void 0:v[m.id];let g=typeof(p==null?void 0:p.keys)=="string"?p.keys:m.combo;try{El(g)}catch{g=m.combo}return{...m,defaultCombo:m.combo,combo:g,hidden:typeof(p==null?void 0:p.hidden)=="boolean"?p.hidden:m.defaultHidden===!0,custom:!1}}),o=new Set(i.map(m=>m.id));for(const m of(a==null?void 0:a.custom)||[]){if(!m||typeof m.id!="string"||o.has(m.id))continue;let p=m.keys;try{El(p)}catch{continue}i.push({id:m.id,labelKey:"custom",defaultCombo:p,combo:p,verified:!0,hidden:((f=(d=a==null?void 0:a.actions)==null?void 0:d[m.id])==null?void 0:f.hidden)===!0,custom:!0,customLabel:m.label}),o.add(m.id)}if(Array.isArray(a==null?void 0:a.order)){const m=new Map(a.order.map((p,g)=>[p,g]));i.sort((p,g)=>(m.get(p.id)??Number.MAX_SAFE_INTEGER)-(m.get(g.id)??Number.MAX_SAFE_INTEGER))}return i}function nx(r,a){const i=new Set(r.map(o=>o.combo.trim().toLowerCase()));return a.filter(o=>!i.has(o.combo.trim().toLowerCase()))}const Ir=r=>r.id.startsWith("generic");function hg(r,a){const i=Yi[r],o=new Set([...i.bar||[],...r==="shell"?Wv:Jv]),d=[...i.actions,...Pv].map(f=>({...f,defaultHidden:!o.has(f.id)}));return tx(d,a)}function mg(r,a){const i=hg(r,a),o=i.filter(f=>!Ir(f)),d=new Set(nx(o,i.filter(Ir)));return i.filter(f=>!Ir(f)||d.has(f))}function lx(r,a){const i=mg(r,a).filter(o=>!o.hidden);return{agentActions:i.filter(o=>!Ir(o)),genericActions:i.filter(Ir)}}function ax(r){const a={};for(const[i,o]of Object.entries(r.actions||{})){const d={...o};delete d.hidden,Object.keys(d).length>0&&(a[i]=d)}return{...r,actions:a}}const pg=1568,ix=3*1024*1024,rx=[.85,.7,.55,.4],ol={active:!1,phase:"idle",ratio:0,percent:0,statusText:""};function sx(r,a,i=pg){if(r<=0||a<=0)return{width:Math.max(1,r),height:Math.max(1,a)};const o=Math.max(r,a);if(o<=i)return{width:r,height:a};const d=i/o;return{width:Math.max(1,Math.round(r*d)),height:Math.max(1,Math.round(a*d))}}function ox(r){if(typeof r!="string"||r.length===0)return 0;const a=r.length;let i=0;r.endsWith("==")?i=2:r.endsWith("=")&&(i=1);const o=Math.floor(a*3/4)-i;return Number.isFinite(o)&&o>0?o:0}function cx(r){return r<1024?`${r} B`:r<1024*1024?`${(r/1024).toFixed(1)} KB`:`${(r/(1024*1024)).toFixed(1)} MB`}async function ux(r){if(typeof createImageBitmap=="function")try{const a=await createImageBitmap(r,{imageOrientation:"from-image"});return{source:a,width:a.width,height:a.height,cleanup:()=>{typeof a.close=="function"&&a.close()}}}catch{try{const a=await createImageBitmap(r);return{source:a,width:a.width,height:a.height,cleanup:()=>{typeof a.close=="function"&&a.close()}}}catch{}}return new Promise((a,i)=>{if(typeof Image>"u")return i(new Error("Image decoding not supported in this environment"));const o=new Image,d=URL.createObjectURL(r);o.onload=()=>{a({source:o,width:o.naturalWidth||o.width,height:o.naturalHeight||o.height,cleanup:()=>{try{URL.revokeObjectURL(d)}catch{}}})},o.onerror=()=>{try{URL.revokeObjectURL(d)}catch{}i(new Error("Failed to decode image source"))},o.src=d})}async function gg(r,a=pg,i=ix){var d;if(!r||r.size===0||r.type&&!r.type.startsWith("image/"))return null;let o;try{o=await ux(r)}catch(f){return console.warn("Failed to decode image for paste:",f),null}try{const{width:f,height:m}=sx(o.width,o.height,a),p=document.createElement("canvas");p.width=f,p.height=m;const g=p.getContext("2d");if(!g)return null;g.drawImage(o.source,0,0,f,m);let v="image/webp";try{p.toDataURL("image/webp",.85).startsWith("data:image/webp")||(v="image/jpeg")}catch{v="image/jpeg"}for(const y of rx){let w;try{w=p.toDataURL(v,y)}catch{continue}if(!w||!w.startsWith("data:"))continue;const T=w.indexOf(","),R=T!==-1?w.slice(T+1):"",k=ox(R);if(k<=i)return{mime:v,dataBase64:R,dataUrl:w,byteLength:k,width:f,height:m}}return null}finally{(d=o.cleanup)==null||d.call(o)}}const dx=4e3,fx=3,hx=4096,mx=8*1024*1024,uo={ctrl:!1,alt:!1,shift:!1},bg=x.createContext(null);function Ui(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 px=({children:r})=>{const[a,i]=x.useState(ug),[o,d]=x.useState("disconnected"),[f,m]=x.useState(),[p,g]=x.useState(),[v,y]=x.useState("viewer"),[w,T]=x.useState(),[R,k]=x.useState(),[Y,z]=x.useState(),[I,P]=x.useState(null),[V,oe]=x.useState(),[ve,ne]=x.useState(null),[X,U]=x.useState(1),[te,ae]=x.useState(0),[ge,Te]=x.useState(null),[Oe,st]=x.useState(null),[Xe,E]=x.useState(null),[B,ee]=x.useState({cols:80,rows:24}),[ze,Z]=x.useState([]),Pe=ex(Oe==null?void 0:Oe.focusedAgent,"auto");x.useEffect(()=>{dg()},[]);const je=x.useRef(a);je.current=a;const ue=x.useRef(null),Ge=x.useRef(!1),Me=x.useRef(B);Me.current=B;const G=x.useRef(new Set),Ue=x.useRef(new Set),[lt,we]=x.useState(ol),He=x.useRef(null),gt=x.useRef(0),Ke=x.useRef(null),We=x.useCallback((D,K)=>rd(a.language,D,K),[a.language]),at=x.useRef(We);at.current=We;const wt=x.useRef(null),_t=x.useRef([]),j=x.useRef(0),be=x.useCallback(D=>{for(_t.current.push(D),j.current+=D.byteLength;_t.current.length>hx||j.current>mx;){const K=_t.current.shift();if(!K)break;j.current-=K.byteLength}},[]),pe=x.useCallback(D=>{const K=wt.current;if(K)try{K(D);return}catch(ce){console.debug("Terminal output sink threw, buffering chunk instead:",ce)}be(D)},[be]),Je=x.useRef(pe);Je.current=pe;const bt=x.useCallback(D=>{wt.current=D;const K=_t.current;_t.current=[],j.current=0;for(let ce=0;ce<K.length;ce++)try{D(K[ce])}catch(Ae){console.debug("Terminal sink threw while flushing, re-buffering the tail:",Ae);for(let Ne=ce;Ne<K.length;Ne++)be(K[Ne]);break}return()=>{wt.current===D&&(wt.current=null)}},[be]),ft=x.useCallback(()=>_t.current.length,[]),St=x.useCallback(()=>{_t.current=[],j.current=0},[]),le=x.useCallback((D=!0)=>{y("viewer"),T(void 0),k(void 0),z(void 0),P(null),oe(void 0),ne(null),U(1),Te(null),St(),D&&ae(K=>K+1)},[St]),ke=x.useRef([]),De=x.useRef(new Map),ot=x.useCallback(D=>{ke.current=D,Z(D)},[]),Yt=x.useCallback(D=>{const K=De.current.get(D);K&&(clearTimeout(K),De.current.delete(D)),ot(ke.current.filter(ce=>ce.id!==D))},[ot]),$n=x.useRef(Yt);$n.current=Yt;const Qe=x.useCallback((D,K)=>{const ce=Date.now(),Ae=ke.current,Ne=Ae.find(kt=>kt.type===D&&kt.message===K),_e=Ne?Ne.id:`${ce}-${Math.random().toString(36).substring(2,6)}`;let Ie;if(Ne)Ie=Ae.map(kt=>kt.id===_e?{...kt,count:kt.count+1,timestamp:ce}:kt);else for(Ie=[...Ae,{id:_e,type:D,message:K,timestamp:ce,count:1}];Ie.length>fx;){const[kt,...wn]=Ie,Tt=De.current.get(kt.id);Tt&&(clearTimeout(Tt),De.current.delete(kt.id)),Ie=wn}ot(Ie);const Xt=De.current.get(_e);Xt&&clearTimeout(Xt),De.current.set(_e,setTimeout(()=>$n.current(_e),dx))},[ot]),hl=x.useCallback(D=>{$n.current(D)},[]),fn=x.useRef(!0);x.useEffect(()=>{v==="controller"&&(fn.current=!0)},[v]);const Lt=x.useCallback(()=>{fn.current&&(fn.current=!1,Qe("warning",at.current("toasts.viewerModeWarning")))},[Qe]);x.useEffect(()=>{const D=De.current;return()=>{for(const K of D.values())clearTimeout(K);D.clear()}},[]);const Ct=x.useCallback(D=>{const K=Ra(D);je.current=K,i(K)},[]),Ft=x.useCallback(D=>{Ct({language:D})},[Ct]),it=x.useCallback(D=>{je.current=D,i(D)},[]),ai=x.useCallback(D=>{var Ne;const K=je.current,ce=lp({...D,wsUrl:D.wsUrl||"/ws/client",token:D.token||"",displayName:D.displayName||`Herdr ${K.profiles.length+1}`,autoReconnect:D.autoReconnect!==!1},K.profiles.length),Ae=Ra({profiles:[...K.profiles,ce],activeProfileId:ce.id,wsUrl:ce.wsUrl,token:ce.token,pairCode:ce.pairCode||"",autoReconnect:ce.autoReconnect});it(Ae),le(),(Ne=ue.current)==null||Ne.reconnectWith(Ui(Ae))},[it,le]),Mn=x.useCallback(D=>{var Ne;const K=je.current,ce=K.profiles.find(_e=>_e.id===D);if(!ce||ce.id===K.activeProfileId)return;const Ae=Ra({activeProfileId:ce.id,wsUrl:ce.wsUrl,token:ce.token,pairCode:ce.pairCode||"",autoReconnect:ce.autoReconnect,profiles:K.profiles.map(_e=>_e.id===ce.id?{..._e,lastUsedAt:Date.now()}:_e)});it(Ae),le(),(Ne=ue.current)==null||Ne.reconnectWith(Ui(Ae))},[it,le]),el=x.useCallback((D,K)=>{const ce=je.current;if(!ce.profiles.find(Ie=>Ie.id===D))return;const Ne=K.trim().slice(0,64);if(!Ne)return;const _e=Ra({profiles:ce.profiles.map(Ie=>Ie.id===D?{...Ie,displayName:Ne}:Ie)});it(_e)},[it]),kl=x.useCallback(D=>{var _e;const K=je.current;if(!K.profiles.some(Ie=>Ie.id===D))return;const ce=K.profiles.filter(Ie=>Ie.id!==D),Ae=ce.find(Ie=>Ie.id===K.activeProfileId)||ce[0],Ne=Ra(Ae?{profiles:ce,activeProfileId:Ae.id,wsUrl:Ae.wsUrl,token:Ae.token,pairCode:Ae.pairCode||"",autoReconnect:Ae.autoReconnect}:{profiles:[],activeProfileId:"",wsUrl:"/ws/client",token:"",pairCode:""});it(Ne),D===K.activeProfileId&&(le(),(_e=ue.current)==null||_e.reconnectWith(Ui(Ne)))},[it,le]),an=x.useCallback(D=>{const K=je.current,ce=K.profiles.find(Sn=>Sn.id===K.activeProfileId),Ae=D.hostId?ap({wsUrl:K.wsUrl,hostId:D.hostId}):null,Ne=Ae?K.profiles.findIndex(Sn=>ap(Sn)===Ae):-1,_e=Ne>=0?Ne:Math.max(0,K.profiles.findIndex(Sn=>Sn.id===K.activeProfileId)),Xt={...K.profiles[_e]||ce||lp({wsUrl:K.wsUrl||"/ws/client",token:"",pairCode:K.pairCode||"PENDING",displayName:`Herdr ${K.profiles.length+1}`},K.profiles.length),token:D.token,pairCode:void 0,...D.hostId?{hostId:D.hostId}:{},...D.deviceId?{deviceId:D.deviceId}:{},lastUsedAt:Date.now()};let kt=[...K.profiles];_e>=0&&_e<kt.length?kt[_e]=Xt:kt.push(Xt);const wn=ce==null?void 0:ce.id;kt=kt.filter((Sn,za)=>za===_e||Sn.id===Xt.id?!0:!(Ne>=0&&wn&&Sn.id===wn));const Tt=Ra({profiles:kt,activeProfileId:Xt.id,wsUrl:Xt.wsUrl,token:Xt.token,pairCode:"",autoReconnect:Xt.autoReconnect});return it(Tt),Tt},[it]),ml=x.useCallback(D=>{const K=je.current,ce=K.profiles.find(Ie=>Ie.id===K.activeProfileId);if(!ce||!D.hostId&&!D.hostname)return;const Ae=/^Herdr \d+$/.test(ce.displayName),Ne={...ce,...D.hostId?{hostId:D.hostId}:{},...D.hostname?{hostname:D.hostname}:{},...D.hostname&&Ae?{displayName:D.hostname}:{}},_e=Ra({profiles:K.profiles.map(Ie=>Ie.id===ce.id?Ne:Ie)});it(_e)},[it]);if(!ue.current){const D=new Nv(Ui(a));ue.current=D,D.on("stateChange",(K,ce,Ae)=>{d(K),g(Ae);const Ne=Ae?`serverErrors.${Ae}`:null,_e=Ne?at.current(Ne):null,Ie=_e&&_e!==Ne?_e:ce;m(Ie),K==="connected"?Qe("success",at.current("toasts.connected")):K==="error"&&Qe("error",Ie||at.current("toasts.connectionError")),K!=="connected"&&st(null)}),D.on("ready",K=>{Ge.current&&(St(),ae(ce=>ce+1)),Ge.current=!0,y(K.role),T(K.controllerId),k(K.hostId),z(K.hostname),ml(K),K.clientId&&oe(K.clientId),P(K.terminalPalette||null)}),D.on("hostReconnecting",K=>{g(K||"host_reconnecting"),m(at.current(`serverErrors.${K||"host_reconnecting"}`)),y("viewer"),T(void 0),z(void 0),P(null),ne(null),U(1),Te(null),St()}),D.on("sessionRestarted",(K,ce,Ae,Ne)=>{St(),z(Ne),ml({hostId:D.getHostId(),hostname:Ne}),P(Ae||null),ae(_e=>_e+1)}),D.on("roleChange",(K,ce,Ae,Ne)=>{y(K),T(ce),Ae&&k(Ae),Ne&&oe(Ne)}),D.on("controlGranted",()=>{y("controller"),Qe("success",at.current("toasts.controlGranted"))}),D.on("controlDenied",K=>{Qe("warning",K||at.current("toasts.controlDenied"))}),D.on("controlRevoked",K=>{y("viewer"),Qe("warning",K||at.current("toasts.controlRevoked"))}),D.on("paired",K=>{const ce=an(K);Qe("success",at.current("toasts.pairedSuccess")),E(Date.now()),D.reconnectWith(Ui(ce))}),D.on("exit",(K,ce)=>{Qe("info",`${at.current("toasts.sessionEnded")}${ce?`: ${ce}`:""}${K!==void 0?` (${K})`:""}`)}),D.on("status",K=>{Te(K)}),D.on("error",K=>{He.current!==null&&(Ke.current&&(clearTimeout(Ke.current),Ke.current=null),He.current=null,we(ol));const Ae=`serverErrors.${String(K.code)}`,Ne=at.current(Ae),_e=Ne&&Ne!==Ae?Ne:K.message||`[${K.code}]`;Qe("error",_e)}),D.on("pasteFileReady",K=>{const ce=He.current;ce!==null&&(Ke.current&&(clearTimeout(Ke.current),Ke.current=null),we({active:!0,phase:"completed",ratio:1,percent:100,statusText:at.current("virtualKeyboard.uploadProgressCompleted")}),setTimeout(()=>{He.current===ce&&(He.current=null,we(ol))},1200));for(const Ae of G.current)try{Ae(K)}catch(Ne){console.error("Error in pasteFileReady listener:",Ne)}}),D.on("rttUpdate",K=>{ne(K)}),D.on("peerCount",K=>{U(Math.max(1,K))}),D.on("sessionReady",()=>{d("connected")}),D.on("agentStatus",K=>{st(K)}),D.on("binaryData",K=>{Je.current(K)})}const vn=ue.current,Rl=a.profiles.find(D=>D.id===a.activeProfileId);x.useEffect(()=>{var D;(D=ue.current)==null||D.updateConfig(Ui(a))},[a]);const pl=x.useCallback(D=>{ue.current&&(D&&ue.current.updateConfig(D),ue.current.connect(Me.current))},[]),tl=x.useCallback(()=>{ue.current&&ue.current.disconnect()},[]),_n=x.useCallback((D=!1)=>{ue.current&&ue.current.claimControl(D)},[]),qn=x.useCallback(()=>{var D;(D=ue.current)==null||D.releaseControl()},[]),Ln=x.useCallback(D=>{if(v!=="controller"){Lt();return}const K=ue.current;if(!K)return;const ce=td(D);for(const Ae of Ue.current)try{Ae(ce)}catch(Ne){console.debug("Key input observer threw:",Ne)}K.sendInput(ce)},[v,Lt]),Zi=x.useCallback(D=>(Ue.current.add(D),()=>{Ue.current.delete(D)}),[]),[La,Jl]=x.useState(uo),nl=x.useRef(uo),$l=x.useCallback(D=>{const K={...nl.current,[D]:!nl.current[D]};nl.current=K,Jl(K)},[]),gl=x.useCallback(()=>{const D=nl.current;return!D.ctrl&&!D.alt&&!D.shift?null:(nl.current=uo,Jl(uo),D)},[]);x.useEffect(()=>{const D=ue.current;return D?Ev(D):void 0},[]);const jl=x.useCallback(D=>{v!=="controller"&&!wo(D)||ue.current&&ue.current.sendInput(D)},[v]),ii=x.useCallback((D,K)=>{Me.current={cols:D,rows:K},ee({cols:D,rows:K}),ue.current&&ue.current.sendResize(D,K)},[]),xn=x.useCallback((D,K)=>v!=="controller"?(Lt(),!1):ue.current?(ue.current.sendPasteFile(D,K),!0):!1,[v,Lt]),Gt=x.useCallback(D=>(G.current.add(D),()=>{G.current.delete(D)}),[]),en=x.useCallback(()=>{Ke.current&&(clearTimeout(Ke.current),Ke.current=null),He.current=null,we(ol)},[]);x.useEffect(()=>{o!=="connected"&&He.current!==null&&(Ke.current&&(clearTimeout(Ke.current),Ke.current=null),He.current=null,we(ol))},[o]),x.useEffect(()=>()=>{Ke.current&&clearTimeout(Ke.current)},[]);const bl=x.useCallback(async D=>{if(v!=="controller")return Lt(),!1;if(!ue.current||o!=="connected")return Qe("error",We("serverErrors.host_offline")),!1;if(He.current!==null)return!1;const K=++gt.current;He.current=K,Ke.current&&(clearTimeout(Ke.current),Ke.current=null);const ce="dataBase64"in D&&typeof D.dataBase64=="string";try{let Ae;if(ce)Ae=D;else{const _e=D;if(we({active:!0,phase:"reading",ratio:.1,percent:10,statusText:We("virtualKeyboard.uploadProgressReading")}),!_e||_e.size===0)return Qe("error",We("clipboard.fileEmpty")),He.current=null,we(ol),!1;if(_e.type&&!_e.type.startsWith("image/"))return Qe("error",We("clipboard.unsupportedType")),He.current=null,we(ol),!1;we({active:!0,phase:"processing",ratio:.35,percent:35,statusText:We("virtualKeyboard.uploadProgressProcessing")});const Ie=await gg(_e);if(He.current!==K)return!1;if(!Ie)return Qe("error",We("clipboard.imageTooLarge")),He.current=null,we(ol),!1;Ae=Ie,we({active:!0,phase:"processing",ratio:.6,percent:60,statusText:We("virtualKeyboard.uploadProgressProcessing")})}we({active:!0,phase:"sending",ratio:.75,percent:75,statusText:We("virtualKeyboard.uploadProgressSending")});const Ne=xn(Ae.mime,Ae.dataBase64);return He.current!==K?!1:Ne?(we({active:!0,phase:"waitingHost",ratio:.88,percent:88,statusText:We("virtualKeyboard.uploadProgressWaitingHost")}),Ke.current=setTimeout(()=>{He.current===K&&(He.current=null,Qe("error",We("serverErrors.paste_file_write_failed")),we(ol))},3e4),!0):(He.current=null,we(ol),!1)}catch(Ae){return console.error("Failed to process/upload image:",Ae),He.current===K&&(He.current=null,Qe("error",We("clipboard.imageTooLarge")),we(ol)),!1}},[v,o,Lt,Qe,We,xn]);return u.jsx(bg.Provider,{value:{connectionState:o,stateDetail:f,stateCode:p,role:v,controllerId:w,hostId:R,hostname:Y,assignedClientId:V,profiles:a.profiles,activeProfileId:a.activeProfileId,activeProfile:Rl,isController:v==="controller",sharedWindowCount:X,terminalResetVersion:te,rttMs:ve,statusPayload:ge,agentStatus:Oe,agentProfile:Pe,lastPairedAt:Xe,settings:a,hostPalette:I,terminalDimensions:B,toasts:ze,adapter:vn,language:a.language,t:We,setLanguage:Ft,connect:pl,disconnect:tl,switchProfile:Mn,addProfileAndConnect:ai,renameProfile:el,removeProfile:kl,claimControl:_n,releaseControl:qn,sendKey:Ln,observeKeyInput:Zi,modifierLatch:La,toggleModifierLatch:$l,consumeModifierLatch:gl,sendBinary:jl,sendResize:ii,updateSettings:Ct,addToast:Qe,removeToast:hl,warnViewerMode:Lt,subscribeToOutput:bt,getPendingOutputChunkCount:ft,sendPasteFile:xn,subscribeToPasteFileReady:Gt,uploadProgress:lt,uploadImage:bl,resetUploadProgress:en},children:r})};function Mt(){const r=x.useContext(bg);if(!r)throw new Error("useTerminal must be used within a TerminalProvider");return r}function Wr(r){var a,i;return r?{blocked:((a=r.counts)==null?void 0:a.blocked)??0,done:((i=r.counts)==null?void 0:i.done)??0}:null}function gx(r){return r?r.blocked>0?"blocked":r.done>0?"done":null:null}function bx(r){if(!r)return"";const a=[];return r.blocked>0&&a.push(`${r.blocked}⚠`),r.done>0&&a.push(`${r.done}✓`),a.length>0?`(${a.join(" ")})`:""}function yx(r,a){if(!r||!a)return null;const i=new Map(r.agents.map(m=>[m.paneId,m.status]));let o=null;for(const m of a.agents)if(!(m.status!=="blocked"&&m.status!=="done")&&i.get(m.paneId)!==m.status){if(m.status==="blocked")return"blocked";o="done"}const d=Wr(r),f=Wr(a);return f.blocked>d.blocked?"blocked":(!o&&f.done>d.done&&(o="done"),o)}const vx={blocked:"%23f9e2af",done:"%23a6e3a1"};function xx(r){return`<circle cx='19' cy='5' r='4.5' fill='${vx[r]}' stroke='%2311111b' stroke-width='1.5'/>`}function wx(r,a){return!a||!r.includes("</svg>")?r:r.replace("</svg>",`${xx(a)}</svg>`)}function up(r,a=document){const i=a.querySelector('link[rel~="icon"]');if(!i)return;i.dataset.baseHref===void 0&&(i.dataset.baseHref=i.getAttribute("href")??"");const o=wx(i.dataset.baseHref,r);i.getAttribute("href")!==o&&i.setAttribute("href",o)}let dl=null;function Sx(){if(typeof window>"u")return null;const r=window;return r.AudioContext??r.webkitAudioContext??null}function yg(){const r=Sx();if(r)try{dl=dl??new r,dl.state==="suspended"&&dl.resume()}catch{dl=null}}function Cx(r=window){const a=()=>{yg(),i()},i=()=>{r.removeEventListener("pointerdown",a),r.removeEventListener("keydown",a)};return r.addEventListener("pointerdown",a),r.addEventListener("keydown",a),i}const Tx={blocked:[880,660],done:[660,880]};function vg(r){if(!(!dl||dl.state!=="running"))try{const a=dl.currentTime;Tx[r].forEach((i,o)=>{const d=dl.createOscillator(),f=dl.createGain(),m=a+o*.11;d.type="sine",d.frequency.value=i,f.gain.setValueAtTime(1e-4,m),f.gain.exponentialRampToValueAtTime(.06,m+.01),f.gain.exponentialRampToValueAtTime(1e-4,m+.09),d.connect(f),f.connect(dl.destination),d.start(m),d.stop(m+.1)})}catch{}}const Ax=15e3,Nx={blocked:[70,50,70],done:[40]};function Ex(){const{agentStatus:r,settings:a,t:i}=Mt(),o=x.useRef(a);o.current=a;const d=x.useRef(i);d.current=i;const f=x.useRef(null),m=x.useRef(Number.NEGATIVE_INFINITY);x.useEffect(()=>{up(a.agentAlertBadge?gx(Wr(r)):null)},[r,a.agentAlertBadge]),x.useEffect(()=>()=>up(null),[]),x.useEffect(()=>{if(!(!a.agentAlertSound||typeof window>"u"))return Cx(window)},[a.agentAlertSound]),x.useEffect(()=>{const p=f.current;f.current=r;const g=yx(p,r);if(!g)return;const v=Date.now();if(v-m.current<Ax)return;m.current=v;const y=o.current,w=typeof document<"u"&&document.visibilityState==="hidden",T=w||typeof document<"u"&&!document.hasFocus();if(y.agentAlertVibrate&&!w&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(Nx[g])}catch{}if(y.agentAlertSound&&T&&vg(g),y.agentAlertNotify&&w&&typeof window<"u"&&window.isSecureContext&&"Notification"in window&&Notification.permission==="granted"){const R=Wr(r),k=g==="blocked"?d.current("agents.notifyBlocked",{count:R.blocked}):d.current("agents.notifyDone",{count:R.done});try{new Notification("Herdr Remote",{body:k,tag:"herdr-agents"})}catch{}}},[r])}function xg(r){var a,i,o="";if(typeof r=="string"||typeof r=="number")o+=r;else if(typeof r=="object")if(Array.isArray(r)){var d=r.length;for(a=0;a<d;a++)r[a]&&(i=xg(r[a]))&&(o&&(o+=" "),o+=i)}else for(i in r)r[i]&&(o&&(o+=" "),o+=i);return o}function kx(){for(var r,a,i=0,o="",d=arguments.length;i<d;i++)(r=arguments[i])&&(a=xg(r))&&(o&&(o+=" "),o+=a);return o}const Rx=(r,a)=>{const i=new Array(r.length+a.length);for(let o=0;o<r.length;o++)i[o]=r[o];for(let o=0;o<a.length;o++)i[r.length+o]=a[o];return i},jx=(r,a)=>({classGroupId:r,validator:a}),wg=(r=new Map,a=null,i)=>({nextPart:r,validators:a,classGroupId:i}),Ao="-",dp=[],Mx="arbitrary..",_x=r=>{const a=zx(r),{conflictingClassGroups:i,conflictingClassGroupModifiers:o}=r;return{getClassGroupId:m=>{if(m.startsWith("[")&&m.endsWith("]"))return Lx(m);const p=m.split(Ao),g=p[0]===""&&p.length>1?1:0;return Sg(p,g,a)},getConflictingClassGroupIds:(m,p)=>{if(p){const g=o[m],v=i[m];return g?v?Rx(v,g):g:v||dp}return i[m]||dp}}},Sg=(r,a,i)=>{if(r.length-a===0)return i.classGroupId;const d=r[a],f=i.nextPart.get(d);if(f){const v=Sg(r,a+1,f);if(v)return v}const m=i.validators;if(m===null)return;const p=a===0?r.join(Ao):r.slice(a).join(Ao),g=m.length;for(let v=0;v<g;v++){const y=m[v];if(y.validator(p))return y.classGroupId}},Lx=r=>r.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const a=r.slice(1,-1),i=a.indexOf(":"),o=a.slice(0,i);return o?Mx+o:void 0})(),zx=r=>{const{theme:a,classGroups:i}=r;return Dx(i,a)},Dx=(r,a)=>{const i=wg();for(const o in r){const d=r[o];sd(d,i,o,a)}return i},sd=(r,a,i,o)=>{const d=r.length;for(let f=0;f<d;f++){const m=r[f];Ox(m,a,i,o)}},Ox=(r,a,i,o)=>{if(typeof r=="string"){Ux(r,a,i);return}if(typeof r=="function"){Bx(r,a,i,o);return}Hx(r,a,i,o)},Ux=(r,a,i)=>{const o=r===""?a:Cg(a,r);o.classGroupId=i},Bx=(r,a,i,o)=>{if(Kx(r)){sd(r(o),a,i,o);return}a.validators===null&&(a.validators=[]),a.validators.push(jx(i,r))},Hx=(r,a,i,o)=>{const d=Object.entries(r),f=d.length;for(let m=0;m<f;m++){const[p,g]=d[m];sd(g,Cg(a,p),i,o)}},Cg=(r,a)=>{let i=r;const o=a.split(Ao),d=o.length;for(let f=0;f<d;f++){const m=o[f];let p=i.nextPart.get(m);p||(p=wg(),i.nextPart.set(m,p)),i=p}return i},Kx=r=>"isThemeGetter"in r&&r.isThemeGetter===!0,Yx=r=>{if(r<1)return{get:()=>{},set:()=>{}};let a=0,i=Object.create(null),o=Object.create(null);const d=(f,m)=>{i[f]=m,a++,a>r&&(a=0,o=i,i=Object.create(null))};return{get(f){let m=i[f];if(m!==void 0)return m;if((m=o[f])!==void 0)return d(f,m),m},set(f,m){f in i?i[f]=m:d(f,m)}}},Wu="!",fp=":",Gx=[],hp=(r,a,i,o,d)=>({modifiers:r,hasImportantModifier:a,baseClassName:i,maybePostfixModifierPosition:o,isExternal:d}),qx=r=>{const{prefix:a,experimentalParseClassName:i}=r;let o=d=>{const f=[];let m=0,p=0,g=0,v;const y=d.length;for(let Y=0;Y<y;Y++){const z=d[Y];if(m===0&&p===0){if(z===fp){f.push(d.slice(g,Y)),g=Y+1;continue}if(z==="/"){v=Y;continue}}z==="["?m++:z==="]"?m--:z==="("?p++:z===")"&&p--}const w=f.length===0?d:d.slice(g);let T=w,R=!1;w.endsWith(Wu)?(T=w.slice(0,-1),R=!0):w.startsWith(Wu)&&(T=w.slice(1),R=!0);const k=v&&v>g?v-g:void 0;return hp(f,R,T,k)};if(a){const d=a+fp,f=o;o=m=>m.startsWith(d)?f(m.slice(d.length)):hp(Gx,!1,m,void 0,!0)}if(i){const d=o;o=f=>i({className:f,parseClassName:d})}return o},Vx=r=>{const a=new Map;return r.orderSensitiveModifiers.forEach((i,o)=>{a.set(i,1e6+o)}),i=>{const o=[];let d=[];for(let f=0;f<i.length;f++){const m=i[f],p=m[0]==="[",g=a.has(m);p||g?(d.length>0&&(d.sort(),o.push(...d),d=[]),o.push(m)):d.push(m)}return d.length>0&&(d.sort(),o.push(...d)),o}},Fx=r=>({cache:Yx(r.cacheSize),parseClassName:qx(r),sortModifiers:Vx(r),postfixLookupClassGroupIds:Xx(r),..._x(r)}),Xx=r=>{const a=Object.create(null),i=r.postfixLookupClassGroups;if(i)for(let o=0;o<i.length;o++)a[i[o]]=!0;return a},Ix=/\s+/,Zx=(r,a)=>{const{parseClassName:i,getClassGroupId:o,getConflictingClassGroupIds:d,sortModifiers:f,postfixLookupClassGroupIds:m}=a,p=[],g=r.trim().split(Ix);let v="";for(let y=g.length-1;y>=0;y-=1){const w=g[y],{isExternal:T,modifiers:R,hasImportantModifier:k,baseClassName:Y,maybePostfixModifierPosition:z}=i(w);if(T){v=w+(v.length>0?" "+v:v);continue}let I=!!z,P;if(I){const X=Y.substring(0,z);P=o(X);const U=P&&m[P]?o(Y):void 0;U&&U!==P&&(P=U,I=!1)}else P=o(Y);if(!P){if(!I){v=w+(v.length>0?" "+v:v);continue}if(P=o(Y),!P){v=w+(v.length>0?" "+v:v);continue}I=!1}const V=R.length===0?"":R.length===1?R[0]:f(R).join(":"),oe=k?V+Wu:V,ve=oe+P;if(p.indexOf(ve)>-1)continue;p.push(ve);const ne=d(P,I);for(let X=0;X<ne.length;++X){const U=ne[X];p.push(oe+U)}v=w+(v.length>0?" "+v:v)}return v},Qx=(...r)=>{let a=0,i,o,d="";for(;a<r.length;)(i=r[a++])&&(o=Tg(i))&&(d&&(d+=" "),d+=o);return d},Tg=r=>{if(typeof r=="string")return r;let a,i="";for(let o=0;o<r.length;o++)r[o]&&(a=Tg(r[o]))&&(i&&(i+=" "),i+=a);return i},Px=(r,...a)=>{let i,o,d,f;const m=g=>{const v=a.reduce((y,w)=>w(y),r());return i=Fx(v),o=i.cache.get,d=i.cache.set,f=p,p(g)},p=g=>{const v=o(g);if(v)return v;const y=Zx(g,i);return d(g,y),y};return f=m,(...g)=>f(Qx(...g))},Wx=[],$t=r=>{const a=i=>i[r]||Wx;return a.isThemeGetter=!0,a},Ag=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ng=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Jx=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,$x=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,e0=/\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$/,t0=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,n0=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,l0=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ja=r=>Jx.test(r),Ze=r=>!!r&&!Number.isNaN(Number(r)),Al=r=>!!r&&Number.isInteger(Number(r)),Du=r=>r.endsWith("%")&&Ze(r.slice(0,-1)),Pl=r=>$x.test(r),Eg=()=>!0,a0=r=>e0.test(r)&&!t0.test(r),od=()=>!1,i0=r=>n0.test(r),r0=r=>l0.test(r),s0=r=>!fe(r)&&!he(r),o0=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)),c0=r=>_a(r,jg,od),fe=r=>Ag.test(r),Ja=r=>_a(r,Mg,a0),mp=r=>_a(r,b0,Ze),u0=r=>_a(r,Lg,Eg),d0=r=>_a(r,_g,od),pp=r=>_a(r,kg,od),f0=r=>_a(r,Rg,r0),fo=r=>_a(r,zg,i0),he=r=>Ng.test(r),Ur=r=>li(r,Mg),h0=r=>li(r,_g),gp=r=>li(r,kg),m0=r=>li(r,jg),p0=r=>li(r,Rg),ho=r=>li(r,zg,!0),g0=r=>li(r,Lg,!0),_a=(r,a,i)=>{const o=Ag.exec(r);return o?o[1]?a(o[1]):i(o[2]):!1},li=(r,a,i=!1)=>{const o=Ng.exec(r);return o?o[1]?a(o[1]):i:!1},kg=r=>r==="position"||r==="percentage",Rg=r=>r==="image"||r==="url",jg=r=>r==="length"||r==="size"||r==="bg-size",Mg=r=>r==="length",b0=r=>r==="number",_g=r=>r==="family-name",Lg=r=>r==="number"||r==="weight",zg=r=>r==="shadow",y0=()=>{const r=$t("color"),a=$t("font"),i=$t("text"),o=$t("font-weight"),d=$t("tracking"),f=$t("leading"),m=$t("breakpoint"),p=$t("container"),g=$t("spacing"),v=$t("radius"),y=$t("shadow"),w=$t("inset-shadow"),T=$t("text-shadow"),R=$t("drop-shadow"),k=$t("blur"),Y=$t("perspective"),z=$t("aspect"),I=$t("ease"),P=$t("animate"),V=()=>["auto","avoid","all","avoid-page","page","left","right","column"],oe=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],ve=()=>[...oe(),he,fe],ne=()=>["auto","hidden","clip","visible","scroll"],X=()=>["auto","contain","none"],U=()=>[he,fe,g],te=()=>[ja,"full","auto",...U()],ae=()=>[Al,"none","subgrid",he,fe],ge=()=>["auto",{span:["full",Al,he,fe]},Al,he,fe],Te=()=>[Al,"auto",he,fe],Oe=()=>["auto","min","max","fr",he,fe],st=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Xe=()=>["start","end","center","stretch","center-safe","end-safe"],E=()=>["auto",...U()],B=()=>[ja,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...U()],ee=()=>[ja,"screen","full","dvw","lvw","svw","min","max","fit",...U()],ze=()=>[ja,"screen","full","lh","dvh","lvh","svh","min","max","fit",...U()],Z=()=>[r,he,fe],Pe=()=>[...oe(),gp,pp,{position:[he,fe]}],je=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ue=()=>["auto","cover","contain",m0,c0,{size:[he,fe]}],Ge=()=>[Du,Ur,Ja],Me=()=>["","none","full",v,he,fe],G=()=>["",Ze,Ur,Ja],Ue=()=>["solid","dashed","dotted","double"],lt=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],we=()=>[Ze,Du,gp,pp],He=()=>["","none",k,he,fe],gt=()=>["none",Ze,he,fe],Ke=()=>["none",Ze,he,fe],We=()=>[Ze,he,fe],at=()=>[ja,"full",...U()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Pl],breakpoint:[Pl],color:[Eg],container:[Pl],"drop-shadow":[Pl],ease:["in","out","in-out"],font:[s0],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Pl],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Pl],shadow:[Pl],spacing:["px",Ze],text:[Pl],"text-shadow":[Pl],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ja,fe,he,z]}],container:["container"],"container-type":[{"@container":["","normal","size",he,fe]}],"container-named":[o0],columns:[{columns:[Ze,fe,he,p]}],"break-after":[{"break-after":V()}],"break-before":[{"break-before":V()}],"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:ve()}],overflow:[{overflow:ne()}],"overflow-x":[{"overflow-x":ne()}],"overflow-y":[{"overflow-y":ne()}],overscroll:[{overscroll:X()}],"overscroll-x":[{"overscroll-x":X()}],"overscroll-y":[{"overscroll-y":X()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:te()}],"inset-x":[{"inset-x":te()}],"inset-y":[{"inset-y":te()}],start:[{"inset-s":te(),start:te()}],end:[{"inset-e":te(),end:te()}],"inset-bs":[{"inset-bs":te()}],"inset-be":[{"inset-be":te()}],top:[{top:te()}],right:[{right:te()}],bottom:[{bottom:te()}],left:[{left:te()}],visibility:["visible","invisible","collapse"],z:[{z:[Al,"auto",he,fe]}],basis:[{basis:[ja,"full","auto",p,...U()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ze,ja,"auto","initial","none",fe]}],grow:[{grow:["",Ze,he,fe]}],shrink:[{shrink:["",Ze,he,fe]}],order:[{order:[Al,"first","last","none",he,fe]}],"grid-cols":[{"grid-cols":ae()}],"col-start-end":[{col:ge()}],"col-start":[{"col-start":Te()}],"col-end":[{"col-end":Te()}],"grid-rows":[{"grid-rows":ae()}],"row-start-end":[{row:ge()}],"row-start":[{"row-start":Te()}],"row-end":[{"row-end":Te()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Oe()}],"auto-rows":[{"auto-rows":Oe()}],gap:[{gap:U()}],"gap-x":[{"gap-x":U()}],"gap-y":[{"gap-y":U()}],"justify-content":[{justify:[...st(),"normal"]}],"justify-items":[{"justify-items":[...Xe(),"normal"]}],"justify-self":[{"justify-self":["auto",...Xe()]}],"align-content":[{content:["normal",...st()]}],"align-items":[{items:[...Xe(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Xe(),{baseline:["","last"]}]}],"place-content":[{"place-content":st()}],"place-items":[{"place-items":[...Xe(),"baseline"]}],"place-self":[{"place-self":["auto",...Xe()]}],p:[{p:U()}],px:[{px:U()}],py:[{py:U()}],ps:[{ps:U()}],pe:[{pe:U()}],pbs:[{pbs:U()}],pbe:[{pbe:U()}],pt:[{pt:U()}],pr:[{pr:U()}],pb:[{pb:U()}],pl:[{pl:U()}],m:[{m:E()}],mx:[{mx:E()}],my:[{my:E()}],ms:[{ms:E()}],me:[{me:E()}],mbs:[{mbs:E()}],mbe:[{mbe:E()}],mt:[{mt:E()}],mr:[{mr:E()}],mb:[{mb:E()}],ml:[{ml:E()}],"space-x":[{"space-x":U()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":U()}],"space-y-reverse":["space-y-reverse"],size:[{size:B()}],"inline-size":[{inline:["auto",...ee()]}],"min-inline-size":[{"min-inline":["auto",...ee()]}],"max-inline-size":[{"max-inline":["none",...ee()]}],"block-size":[{block:["auto",...ze()]}],"min-block-size":[{"min-block":["auto",...ze()]}],"max-block-size":[{"max-block":["none",...ze()]}],w:[{w:[p,"screen",...B()]}],"min-w":[{"min-w":[p,"screen","none",...B()]}],"max-w":[{"max-w":[p,"screen","none","prose",{screen:[m]},...B()]}],h:[{h:["screen","lh",...B()]}],"min-h":[{"min-h":["screen","lh","none",...B()]}],"max-h":[{"max-h":["screen","lh",...B()]}],"font-size":[{text:["base",i,Ur,Ja]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,g0,u0]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Du,fe]}],"font-family":[{font:[h0,d0,a]}],"font-features":[{"font-features":[fe]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[d,he,fe]}],"line-clamp":[{"line-clamp":[Ze,"none",he,mp]}],leading:[{leading:[f,...U()]}],"list-image":[{"list-image":["none",he,fe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",he,fe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:Z()}],"text-color":[{text:Z()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Ue(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ze,"from-font","auto",he,Ja]}],"text-decoration-color":[{decoration:Z()}],"underline-offset":[{"underline-offset":[Ze,"auto",he,fe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:U()}],"tab-size":[{tab:[Al,he,fe]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",he,fe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",he,fe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Pe()}],"bg-repeat":[{bg:je()}],"bg-size":[{bg:ue()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Al,he,fe],radial:["",he,fe],conic:[Al,he,fe]},p0,f0]}],"bg-color":[{bg:Z()}],"gradient-from-pos":[{from:Ge()}],"gradient-via-pos":[{via:Ge()}],"gradient-to-pos":[{to:Ge()}],"gradient-from":[{from:Z()}],"gradient-via":[{via:Z()}],"gradient-to":[{to:Z()}],rounded:[{rounded:Me()}],"rounded-s":[{"rounded-s":Me()}],"rounded-e":[{"rounded-e":Me()}],"rounded-t":[{"rounded-t":Me()}],"rounded-r":[{"rounded-r":Me()}],"rounded-b":[{"rounded-b":Me()}],"rounded-l":[{"rounded-l":Me()}],"rounded-ss":[{"rounded-ss":Me()}],"rounded-se":[{"rounded-se":Me()}],"rounded-ee":[{"rounded-ee":Me()}],"rounded-es":[{"rounded-es":Me()}],"rounded-tl":[{"rounded-tl":Me()}],"rounded-tr":[{"rounded-tr":Me()}],"rounded-br":[{"rounded-br":Me()}],"rounded-bl":[{"rounded-bl":Me()}],"border-w":[{border:G()}],"border-w-x":[{"border-x":G()}],"border-w-y":[{"border-y":G()}],"border-w-s":[{"border-s":G()}],"border-w-e":[{"border-e":G()}],"border-w-bs":[{"border-bs":G()}],"border-w-be":[{"border-be":G()}],"border-w-t":[{"border-t":G()}],"border-w-r":[{"border-r":G()}],"border-w-b":[{"border-b":G()}],"border-w-l":[{"border-l":G()}],"divide-x":[{"divide-x":G()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":G()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Ue(),"hidden","none"]}],"divide-style":[{divide:[...Ue(),"hidden","none"]}],"border-color":[{border:Z()}],"border-color-x":[{"border-x":Z()}],"border-color-y":[{"border-y":Z()}],"border-color-s":[{"border-s":Z()}],"border-color-e":[{"border-e":Z()}],"border-color-bs":[{"border-bs":Z()}],"border-color-be":[{"border-be":Z()}],"border-color-t":[{"border-t":Z()}],"border-color-r":[{"border-r":Z()}],"border-color-b":[{"border-b":Z()}],"border-color-l":[{"border-l":Z()}],"divide-color":[{divide:Z()}],"outline-style":[{outline:[...Ue(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ze,he,fe]}],"outline-w":[{outline:["",Ze,Ur,Ja]}],"outline-color":[{outline:Z()}],shadow:[{shadow:["","none",y,ho,fo]}],"shadow-color":[{shadow:Z()}],"inset-shadow":[{"inset-shadow":["none",w,ho,fo]}],"inset-shadow-color":[{"inset-shadow":Z()}],"ring-w":[{ring:G()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:Z()}],"ring-offset-w":[{"ring-offset":[Ze,Ja]}],"ring-offset-color":[{"ring-offset":Z()}],"inset-ring-w":[{"inset-ring":G()}],"inset-ring-color":[{"inset-ring":Z()}],"text-shadow":[{"text-shadow":["none",T,ho,fo]}],"text-shadow-color":[{"text-shadow":Z()}],opacity:[{opacity:[Ze,he,fe]}],"mix-blend":[{"mix-blend":[...lt(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":lt()}],"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":[Ze]}],"mask-image-linear-from-pos":[{"mask-linear-from":we()}],"mask-image-linear-to-pos":[{"mask-linear-to":we()}],"mask-image-linear-from-color":[{"mask-linear-from":Z()}],"mask-image-linear-to-color":[{"mask-linear-to":Z()}],"mask-image-t-from-pos":[{"mask-t-from":we()}],"mask-image-t-to-pos":[{"mask-t-to":we()}],"mask-image-t-from-color":[{"mask-t-from":Z()}],"mask-image-t-to-color":[{"mask-t-to":Z()}],"mask-image-r-from-pos":[{"mask-r-from":we()}],"mask-image-r-to-pos":[{"mask-r-to":we()}],"mask-image-r-from-color":[{"mask-r-from":Z()}],"mask-image-r-to-color":[{"mask-r-to":Z()}],"mask-image-b-from-pos":[{"mask-b-from":we()}],"mask-image-b-to-pos":[{"mask-b-to":we()}],"mask-image-b-from-color":[{"mask-b-from":Z()}],"mask-image-b-to-color":[{"mask-b-to":Z()}],"mask-image-l-from-pos":[{"mask-l-from":we()}],"mask-image-l-to-pos":[{"mask-l-to":we()}],"mask-image-l-from-color":[{"mask-l-from":Z()}],"mask-image-l-to-color":[{"mask-l-to":Z()}],"mask-image-x-from-pos":[{"mask-x-from":we()}],"mask-image-x-to-pos":[{"mask-x-to":we()}],"mask-image-x-from-color":[{"mask-x-from":Z()}],"mask-image-x-to-color":[{"mask-x-to":Z()}],"mask-image-y-from-pos":[{"mask-y-from":we()}],"mask-image-y-to-pos":[{"mask-y-to":we()}],"mask-image-y-from-color":[{"mask-y-from":Z()}],"mask-image-y-to-color":[{"mask-y-to":Z()}],"mask-image-radial":[{"mask-radial":[he,fe]}],"mask-image-radial-from-pos":[{"mask-radial-from":we()}],"mask-image-radial-to-pos":[{"mask-radial-to":we()}],"mask-image-radial-from-color":[{"mask-radial-from":Z()}],"mask-image-radial-to-color":[{"mask-radial-to":Z()}],"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":oe()}],"mask-image-conic-pos":[{"mask-conic":[Ze]}],"mask-image-conic-from-pos":[{"mask-conic-from":we()}],"mask-image-conic-to-pos":[{"mask-conic-to":we()}],"mask-image-conic-from-color":[{"mask-conic-from":Z()}],"mask-image-conic-to-color":[{"mask-conic-to":Z()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Pe()}],"mask-repeat":[{mask:je()}],"mask-size":[{mask:ue()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",he,fe]}],filter:[{filter:["","none",he,fe]}],blur:[{blur:He()}],brightness:[{brightness:[Ze,he,fe]}],contrast:[{contrast:[Ze,he,fe]}],"drop-shadow":[{"drop-shadow":["","none",R,ho,fo]}],"drop-shadow-color":[{"drop-shadow":Z()}],grayscale:[{grayscale:["",Ze,he,fe]}],"hue-rotate":[{"hue-rotate":[Ze,he,fe]}],invert:[{invert:["",Ze,he,fe]}],saturate:[{saturate:[Ze,he,fe]}],sepia:[{sepia:["",Ze,he,fe]}],"backdrop-filter":[{"backdrop-filter":["","none",he,fe]}],"backdrop-blur":[{"backdrop-blur":He()}],"backdrop-brightness":[{"backdrop-brightness":[Ze,he,fe]}],"backdrop-contrast":[{"backdrop-contrast":[Ze,he,fe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ze,he,fe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ze,he,fe]}],"backdrop-invert":[{"backdrop-invert":["",Ze,he,fe]}],"backdrop-opacity":[{"backdrop-opacity":[Ze,he,fe]}],"backdrop-saturate":[{"backdrop-saturate":[Ze,he,fe]}],"backdrop-sepia":[{"backdrop-sepia":["",Ze,he,fe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":U()}],"border-spacing-x":[{"border-spacing-x":U()}],"border-spacing-y":[{"border-spacing-y":U()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",he,fe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ze,"initial",he,fe]}],ease:[{ease:["linear","initial",I,he,fe]}],delay:[{delay:[Ze,he,fe]}],animate:[{animate:["none",P,he,fe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[Y,he,fe]}],"perspective-origin":[{"perspective-origin":ve()}],rotate:[{rotate:gt()}],"rotate-x":[{"rotate-x":gt()}],"rotate-y":[{"rotate-y":gt()}],"rotate-z":[{"rotate-z":gt()}],scale:[{scale:Ke()}],"scale-x":[{"scale-x":Ke()}],"scale-y":[{"scale-y":Ke()}],"scale-z":[{"scale-z":Ke()}],"scale-3d":["scale-3d"],skew:[{skew:We()}],"skew-x":[{"skew-x":We()}],"skew-y":[{"skew-y":We()}],transform:[{transform:[he,fe,"","none","gpu","cpu"]}],"transform-origin":[{origin:ve()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:at()}],"translate-x":[{"translate-x":at()}],"translate-y":[{"translate-y":at()}],"translate-z":[{"translate-z":at()}],"translate-none":["translate-none"],zoom:[{zoom:[Al,he,fe]}],accent:[{accent:Z()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:Z()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",he,fe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":Z()}],"scrollbar-track-color":[{"scrollbar-track":Z()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":U()}],"scroll-mx":[{"scroll-mx":U()}],"scroll-my":[{"scroll-my":U()}],"scroll-ms":[{"scroll-ms":U()}],"scroll-me":[{"scroll-me":U()}],"scroll-mbs":[{"scroll-mbs":U()}],"scroll-mbe":[{"scroll-mbe":U()}],"scroll-mt":[{"scroll-mt":U()}],"scroll-mr":[{"scroll-mr":U()}],"scroll-mb":[{"scroll-mb":U()}],"scroll-ml":[{"scroll-ml":U()}],"scroll-p":[{"scroll-p":U()}],"scroll-px":[{"scroll-px":U()}],"scroll-py":[{"scroll-py":U()}],"scroll-ps":[{"scroll-ps":U()}],"scroll-pe":[{"scroll-pe":U()}],"scroll-pbs":[{"scroll-pbs":U()}],"scroll-pbe":[{"scroll-pbe":U()}],"scroll-pt":[{"scroll-pt":U()}],"scroll-pr":[{"scroll-pr":U()}],"scroll-pb":[{"scroll-pb":U()}],"scroll-pl":[{"scroll-pl":U()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",he,fe]}],fill:[{fill:["none",...Z()]}],"stroke-w":[{stroke:[Ze,Ur,Ja,mp]}],stroke:[{stroke:["none",...Z()]}],"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"]}},v0=Px(y0);function $(...r){return v0(kx(r))}var x0=Xp();const Fe={cursor:"▸",on:"●",off:"○",dot:"·",check:"✓",cross:"✗",warn:"!",arrowRight:"→",arrowLeft:"←",chevronDown:"▾",chevronRight:"▸",ellipsis:"…",meterFull:"█",meterEmpty:"░",tabDivider:"│"},Jn={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"}},Jr={ok:Jn.ok.text,warn:Jn.warn.text,bad:Jn.bad.text,idle:Jn.idle.text,accent:Jn.accent.text,alt:Jn.alt.text,info:Jn.info.text},jn=({level:r,className:a})=>u.jsx("span",{"aria-hidden":"true",className:$("select-none leading-none",Jr[r],a),children:r==="idle"?Fe.off:Fe.on}),Dg=({className:r})=>u.jsx("span",{"aria-hidden":"true",className:$("select-none text-tui-faint",r),children:Fe.dot}),dn=({title:r,aside:a,tone:i="accent",className:o,bodyClassName:d,children:f,...m})=>u.jsxs("fieldset",{className:$("tui-panel tui-block relative min-w-0 border border-tui-border bg-tui-base",r?"px-3 pb-3 pt-1":"p-3",o),...m,children:[r?u.jsx("legend",{className:$("flex items-center gap-2 text-tui font-bold",Jr[i]),children:u.jsx("span",{children:r})}):null,a?u.jsx("span",{className:"pointer-events-none absolute -top-[10px] right-2 max-w-[60%] truncate bg-tui-base px-1 text-tui-sm text-tui-faint",children:a}):null,u.jsx("div",{className:$("min-w-0",d),children:f})]}),cl=({label:r,labelWidth:a=16,className:i,children:o})=>u.jsxs("div",{className:$("flex items-baseline gap-2 text-tui",i),children:[u.jsx("span",{className:"shrink-0 truncate text-tui-muted",style:{width:`${a}ch`},title:typeof r=="string"?r:void 0,children:r}),u.jsx("span",{className:"min-w-0 flex-1 text-tui-text",children:o})]}),ul=({className:r,label:a})=>a?u.jsxs("div",{className:$("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:a}),u.jsx("span",{className:"h-px flex-1 bg-tui-border-dim","aria-hidden":"true"})]}):u.jsx("div",{className:$("h-px w-full bg-tui-border-dim",r),"aria-hidden":"true"}),w0={default:"border-tui-border text-tui-text hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",primary:"border-tui-accent text-tui-accent hover:bg-tui-accent hover:text-tui-crust active:bg-tui-accent-dim",danger:"border-tui-bad text-tui-bad hover:bg-tui-bad hover:text-tui-crust active:bg-tui-bad",warn:"border-tui-warn text-tui-warn hover:bg-tui-warn hover:text-tui-crust active:bg-tui-warn",ghost:"border-transparent text-tui-muted hover:text-tui-accent hover:border-tui-border active:bg-tui-selection disabled:border-transparent"},Le=({variant:r="default",brackets:a=!0,glyph:i,block:o=!1,className:d,children:f,type:m="button",...p})=>u.jsxs("button",{type:m,className:$("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",w0[r],o&&"w-full",d),...p,children:[a?u.jsx("span",{"aria-hidden":"true",className:"opacity-60",children:"["}):null,i?u.jsx("span",{"aria-hidden":"true",className:"leading-none",children:i}):null,u.jsx("span",{className:"truncate",children:f}),a?u.jsx("span",{"aria-hidden":"true",className:"opacity-60",children:"]"}):null]}),Ro=({tone:r="accent",dot:a=!1,className:i,children:o})=>u.jsxs("span",{className:$("inline-flex select-none items-center gap-1 whitespace-nowrap text-tui font-bold uppercase",Jr[r],i),children:[a?u.jsx(jn,{level:r}):null,o]}),cd=({tabs:r,activeId:a,onSelect:i,ariaLabel:o,className:d,labelClassName:f})=>u.jsx("nav",{className:$("flex items-center gap-2",d),"aria-label":o,children:r.map((m,p)=>{const g=m.id===a;return u.jsxs(fl.Fragment,{children:[p>0?u.jsx("span",{"aria-hidden":"true",className:"select-none text-tui-border",children:Fe.tabDivider}):null,u.jsxs("button",{type:"button",onClick:()=>i(m.id),"aria-current":g?"page":void 0,"aria-label":m.ariaLabel??m.label,title:m.title,className:$("tui-focusable select-none whitespace-nowrap border-b px-0.5 pb-0.5 text-tui transition-colors",g?"border-tui-accent font-bold text-tui-accent":"border-transparent text-tui-muted hover:border-tui-border-bright hover:text-tui-text"),children:[m.index!==void 0?u.jsx("span",{"aria-hidden":"true",className:$("text-tui-faint",g&&"text-tui-accent"),children:m.index}):null,u.jsx("span",{"aria-hidden":"true",className:$("ml-1",f),children:m.label})]})]},m.id)})}),Og=({hints:r,className:a})=>u.jsx("div",{className:$("flex flex-wrap items-center gap-x-3 gap-y-0.5 text-tui-sm text-tui-faint",a),children:r.map((i,o)=>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:i.keys}),u.jsx("span",{children:i.action})]},`${i.keys}-${o}`))}),bn=({htmlFor:r,hint:a,className:i,children:o})=>u.jsxs("label",{htmlFor:r,className:$("block text-tui-sm font-bold text-tui-muted",i),children:[o,a?u.jsx("span",{className:"ml-2 font-normal text-tui-faint",children:a}):null]}),yn=fl.forwardRef(({className:r,...a},i)=>u.jsx("input",{ref:i,className:$("tui-input w-full px-2 py-1 text-tui",r),...a}));yn.displayName="Input";const No=fl.forwardRef(({className:r,children:a,...i},o)=>u.jsx("select",{ref:o,className:$("tui-input w-full px-2 py-1 text-tui",r),...i,children:a}));No.displayName="Select";const $a=({checked:r,onChange:a,disabled:i=!1,label:o,description:d,className:f,id:m})=>u.jsxs("label",{className:$("group flex cursor-pointer select-none items-start gap-2 py-0.5 text-tui",i&&"cursor-not-allowed opacity-60",f),children:[u.jsx("input",{id:m,type:"checkbox",className:"sr-only",checked:r,disabled:i,onChange:p=>a(p.target.checked)}),u.jsx("span",{"aria-hidden":"true",className:$("mt-px shrink-0 font-bold leading-tight",r?"text-tui-ok":"text-tui-faint",!i&&"group-hover:text-tui-accent"),children:r?"[x]":"[ ]"}),u.jsxs("span",{className:"min-w-0 flex-1",children:[u.jsx("span",{className:$("block",r?"text-tui-text":"text-tui-muted"),children:o}),d?u.jsx("span",{className:"mt-0.5 block text-tui-sm leading-snug text-tui-faint",children:d}):null]})]}),Br=({checked:r,onChange:a,name:i,disabled:o=!1,label:d,description:f,className:m})=>u.jsxs("label",{className:$("group flex cursor-pointer select-none items-start gap-2 py-0.5 text-tui",o&&"cursor-not-allowed opacity-60",m),children:[u.jsx("input",{type:"radio",name:i,className:"sr-only",checked:r,disabled:o,onChange:a}),u.jsx("span",{"aria-hidden":"true",className:$("mt-px shrink-0 font-bold leading-tight",r?"text-tui-accent":"text-tui-faint",!o&&"group-hover:text-tui-accent"),children:r?"(•)":"( )"}),u.jsxs("span",{className:"min-w-0 flex-1",children:[u.jsx("span",{className:$("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]})]}),S0=({value:r,width:a=20,tone:i="accent",className:o})=>{const d=Number.isFinite(r)?Math.min(1,Math.max(0,r)):0,f=Math.round(d*a);return u.jsxs("span",{className:$("inline-flex select-none whitespace-pre font-mono leading-none",o),role:"presentation",children:[u.jsx("span",{className:Jr[i],children:Fe.meterFull.repeat(f)}),u.jsx("span",{className:"text-tui-border",children:Fe.meterEmpty.repeat(Math.max(0,a-f))})]})},C0={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"},T0=({ratio:r,label:a,tone:i="accent",className:o,...d})=>{const f=Number.isFinite(r)?Math.min(1,Math.max(0,r)):0;return u.jsxs("div",{className:$("relative h-[var(--tui-row)] w-full overflow-hidden border border-tui-border bg-tui-mantle",o),role:"progressbar","aria-valuenow":Math.round(f*100),"aria-valuemin":0,"aria-valuemax":100,...d,children:[u.jsx("div",{className:$("absolute inset-y-0 left-0",C0[i]),style:{width:`${f*100}%`},"aria-hidden":"true"}),a!==void 0?u.jsx("span",{className:"absolute inset-0 flex items-center justify-center whitespace-nowrap px-1 text-tui font-bold text-tui-text mix-blend-difference",children:a}):null]})};function ud({columns:r,items:a,rowKey:i,empty:o,className:d}){return a.length===0?u.jsx("div",{className:$("px-1 py-4 text-center text-tui text-tui-faint",d),children:o}):u.jsx("div",{className:$("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:$("whitespace-nowrap px-2 py-1 text-tui-sm font-bold text-tui-muted",f.align==="right"?"text-right":"text-left",f.className),children:f.header},f.key))})}),u.jsx("tbody",{children:a.map((f,m)=>u.jsx("tr",{className:"border-b border-tui-border-dim last:border-b-0 hover:bg-tui-selection",children:r.map(p=>u.jsx("td",{className:$("px-2 py-1 align-top text-tui-text",p.align==="right"?"text-right":"text-left",p.className),children:p.render(f,m)},p.key))},i(f,m)))})]})})}const dd=({isOpen:r,onClose:a,title:i,subtitle:o,closeLabel:d,footer:f,hints:m,size:p="md",className:g,children:v})=>{if(!r)return null;const y=p==="sm"?"max-w-md":p==="lg"?"max-w-3xl":"max-w-xl",w=`tui-modal-${i.replace(/\s+/g,"-").toLowerCase()}`,T=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":w,onMouseDown:R=>{R.target===R.currentTarget&&a()},children:u.jsxs("div",{className:$("flex w-full flex-col border border-tui-border bg-tui-base",y,g),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:w,className:"truncate text-tui font-bold text-tui-accent",children:i}),o?u.jsx("span",{className:"min-w-0 flex-1 truncate text-tui-sm text-tui-faint",children:o}):u.jsx("span",{className:"flex-1"}),u.jsx(Le,{variant:"ghost",onClick:a,"aria-label":d,title:d,children:"esc"})]}),u.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 py-3",children:v}),f||m?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:[m?u.jsx(Og,{hints:m}):u.jsx("span",{}),f?u.jsx("div",{className:"flex items-center gap-2",children:f}):null]}):null]})});return typeof document>"u"?T:x0.createPortal(T,document.body)},yo=({tone:r="accent",className:a,children:i,action:o})=>{const d=r==="ok"?Fe.check:r==="bad"?Fe.cross:r==="warn"?Fe.warn:"›",f=Jn[r].edgeL;return u.jsxs("div",{className:$("flex items-start gap-2 border border-tui-border-dim border-l-2 bg-tui-mantle px-2 py-1.5 text-tui",f,a),children:[u.jsx("span",{"aria-hidden":"true",className:$("shrink-0 font-bold",Jr[r]),children:d}),u.jsx("div",{className:"min-w-0 flex-1 leading-snug text-tui-text",children:i}),o?u.jsx("div",{className:"shrink-0",children:o}):null]})},bp=({active:r=!1,className:a,children:i})=>u.jsx("span",{className:$("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",a),children:i}),yp=({items:r,className:a})=>{const i=r.filter(Boolean);return u.jsx("span",{className:$("flex min-w-0 items-center gap-1.5",a),children:i.map((o,d)=>u.jsxs(fl.Fragment,{children:[d>0?u.jsx(Dg,{className:"shrink-0"}):null,o]},d))})},Ug=({left:r,right:a,className:i})=>u.jsxs("footer",{className:$("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",i),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:a})]}),A0=({name:r,tagline:a,aside:i,tabs:o,activeTabId:d,onSelectTab:f,tabsAriaLabel:m,hints:p,footerAside:g,bodyClassName:v,className:y,children:w})=>u.jsxs("div",{className:$("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}),a?u.jsx("span",{className:"hidden truncate text-tui-sm text-tui-faint sm:block",children:a}):null]}),i?u.jsx("span",{className:"flex shrink-0 items-center gap-2",children:i}):null]}),o&&o.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(cd,{tabs:o,activeId:d,onSelect:f,ariaLabel:m,className:"gap-3"})}):null,u.jsx("div",{className:$("min-h-0 flex-1 overflow-y-auto p-2",v),children:w}),p||g?u.jsx(Ug,{left:p?u.jsx(Og,{hints:p}):null,right:g}):null]}),vp=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],Fi=({className:r,label:a})=>{const[i,o]=fl.useState(0);return fl.useEffect(()=>{const d=setInterval(()=>o(f=>(f+1)%vp.length),90);return()=>clearInterval(d)},[]),u.jsxs("span",{className:$("inline-flex items-center gap-1.5",r),role:"status",children:[u.jsx("span",{"aria-hidden":"true",className:"text-tui-accent",children:vp[i]}),a?u.jsx("span",{children:a}):null]})},mo="tui-focusable select-none border border-transparent px-1.5 text-tui uppercase transition-colors",po="text-tui-muted hover:border-tui-border hover:text-tui-accent",N0="border-tui-accent bg-tui-accent text-tui-crust",E0=({currentView:r,onNavigate:a,showAdminEntry:i=!0,onOpenPairing:o,onOpenSettings:d,onToggleVirtualKeyboard:f,isVirtualKeyboardOpen:m})=>{const{addToast:p,language:g,setLanguage:v,t:y}=Mt(),w=()=>{const R=g==="zh"?"en":"zh";v(R),p("info",rd(R,"toasts.switchedLanguage",{lang:R==="zh"?"简体中文":"English"}))},T=[{id:"terminal",label:y("header.terminalTab"),index:1,ariaLabel:y("header.terminalTab")},...i||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(cd,{tabs:T,activeId:r,onSelect:R=>a(R),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:w,className:$(mo,po),title:y("header.languageToggleTitle"),"aria-label":y("header.languageToggleTitle"),children:y("header.languageShort")}),r==="terminal"&&u.jsx("button",{type:"button",onClick:f,className:$(mo,m?N0:po),title:y("header.virtualKeyboardTitle"),"aria-label":y("header.virtualKeyboardTitle"),children:y("header.actionKeyboard")}),u.jsx("button",{type:"button",onClick:o,className:$(mo,po),title:y("header.pairingTitle"),"aria-label":y("header.pairingTitle"),children:y("header.actionPairing")}),u.jsx("button",{type:"button",onClick:d,className:$(mo,po),title:y("header.settingsTitle"),"aria-label":y("header.settingsTitle"),children:y("header.actionSettings")})]})]})})},go=({tone:r,glyph:a,message:i,assertive:o=!1,action:d})=>u.jsxs("aside",{className:$("flex w-full items-center justify-between gap-3 border-b bg-tui-mantle px-2 py-0.5 text-tui sm:px-3",Jn[r].edgeB),"aria-live":o?"assertive":"polite",children:[u.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[u.jsx("span",{"aria-hidden":"true",className:$("shrink-0",Jn[r].text),children:a}),u.jsx("span",{className:"truncate text-tui-text",children:i})]}),d]}),k0=()=>{const{connectionState:r,stateDetail:a,connect:i,settings:o,t:d}=Mt();return r==="connected"||!o.token&&!o.pairCode&&r==="disconnected"?null:r==="connecting"?u.jsx(go,{tone:"accent",glyph:u.jsx(Fi,{}),message:d("statusBanner.connecting")}):r==="reconnecting"?u.jsx(go,{tone:"warn",glyph:u.jsx(Fi,{}),assertive:!0,message:a||d("statusBanner.reconnectingDefault"),action:u.jsx(Le,{variant:"warn",onClick:()=>i(),className:"shrink-0",children:d("statusBanner.reconnectNow")})}):r==="error"?u.jsx(go,{tone:"bad",glyph:Fe.cross,assertive:!0,message:a||d("statusBanner.errorDefault"),action:u.jsx(Le,{variant:"danger",onClick:()=>i(),className:"shrink-0",children:d("common.retry")})}):r==="disconnected"?u.jsx(go,{tone:"idle",glyph:Fe.off,message:d("statusBanner.disconnected"),action:u.jsx(Le,{variant:"primary",onClick:()=>i(),className:"shrink-0",children:d("common.connect")})}):null};var R0=nv(),j0=lv(),Ou={exports:{}},xp;function M0(){return xp||(xp=1,(function(r,a){(function(i,o){r.exports=o()})(self,(()=>(()=>{var i={6:(m,p)=>{function g(y){try{const w=new URL(y),T=w.password&&w.username?`${w.protocol}//${w.username}:${w.password}@${w.host}`:w.username?`${w.protocol}//${w.username}@${w.host}`:`${w.protocol}//${w.host}`;return y.toLocaleLowerCase().startsWith(T.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(p,"__esModule",{value:!0}),p.LinkComputer=p.WebLinkProvider=void 0,p.WebLinkProvider=class{constructor(y,w,T,R={}){this._terminal=y,this._regex=w,this._handler=T,this._options=R}provideLinks(y,w){const T=v.computeLink(y,this._regex,this._terminal,this._handler);w(this._addCallbacks(T))}_addCallbacks(y){return y.map((w=>(w.leave=this._options.leave,w.hover=(T,R)=>{if(this._options.hover){const{range:k}=w;this._options.hover(T,R,k)}},w)))}};class v{static computeLink(w,T,R,k){const Y=new RegExp(T.source,(T.flags||"")+"g"),[z,I]=v._getWindowedLineStrings(w-1,R),P=z.join("");let V;const oe=[];for(;V=Y.exec(P);){const ve=V[0];if(!g(ve))continue;const[ne,X]=v._mapStrIdx(R,I,0,V.index),[U,te]=v._mapStrIdx(R,ne,X,ve.length);if(ne===-1||X===-1||U===-1||te===-1)continue;const ae={start:{x:X+1,y:ne+1},end:{x:te,y:U+1}};oe.push({range:ae,text:ve,activate:k})}return oe}static _getWindowedLineStrings(w,T){let R,k=w,Y=w,z=0,I="";const P=[];if(R=T.buffer.active.getLine(w)){const V=R.translateToString(!0);if(R.isWrapped&&V[0]!==" "){for(z=0;(R=T.buffer.active.getLine(--k))&&z<2048&&(I=R.translateToString(!0),z+=I.length,P.push(I),R.isWrapped&&I.indexOf(" ")===-1););P.reverse()}for(P.push(V),z=0;(R=T.buffer.active.getLine(++Y))&&R.isWrapped&&z<2048&&(I=R.translateToString(!0),z+=I.length,P.push(I),I.indexOf(" ")===-1););}return[P,k]}static _mapStrIdx(w,T,R,k){const Y=w.buffer.active,z=Y.getNullCell();let I=R;for(;k;){const P=Y.getLine(T);if(!P)return[-1,-1];for(let V=I;V<P.length;++V){P.getCell(V,z);const oe=z.getChars();if(z.getWidth()&&(k-=oe.length||1,V===P.length-1&&oe==="")){const ve=Y.getLine(T+1);ve&&ve.isWrapped&&(ve.getCell(0,z),z.getWidth()===2&&(k+=1))}if(k<0)return[T,V]}T++,I=0}return[T,I]}}p.LinkComputer=v}},o={};function d(m){var p=o[m];if(p!==void 0)return p.exports;var g=o[m]={exports:{}};return i[m](g,g.exports,d),g.exports}var f={};return(()=>{var m=f;Object.defineProperty(m,"__esModule",{value:!0}),m.WebLinksAddon=void 0;const p=d(6),g=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function v(y,w){const T=window.open();if(T){try{T.opener=null}catch{}T.location.href=w}else console.warn("Opening link blocked as opener could not be cleared")}m.WebLinksAddon=class{constructor(y=v,w={}){this._handler=y,this._options=w}activate(y){this._terminal=y;const w=this._options,T=w.urlRegex||g;this._linkProvider=this._terminal.registerLinkProvider(new p.WebLinkProvider(this._terminal,T,this._handler,w))}dispose(){var y;(y=this._linkProvider)==null||y.dispose()}}})(),f})()))})(Ou)),Ou.exports}var _0=M0();const Bg="\x1B",L0=/^\x1b\[[IO]/,Hg=/^\x1b\[<(\d+);\d+;\d+[Mm]/,z0=/^\x1b\[M[\s\S]{3}/,D0=[/^\x1b\[\?[\d;]*c/,/^\x1b\[>[\d;]*c/,/^\x1b\[\d+;\d+R/,/^\x1b\[\?\d+;\d+R/,/^\x1b\[\d+n/,/^\x1b\[\?[\d;]*\$y/,/^\x1b\[[\d;]*t/,/^\x1b\[\?\d+u/,/^\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)/,/^\x1bP[\s\S]*?\x1b\\/],O0=/^\x1b\[1;[2-8]R/;function wp(r){if(O0.test(r))return 0;const a=L0.exec(r);if(a)return a[0].length;const i=Hg.exec(r);if(i){const o=Number(i[1]);return(o&32)!==0&&(o&3)===3&&(o&64)===0?i[0].length:0}for(const o of D0){const d=o.exec(r);if(d)return d[0].length}return 0}function Kg(r){if(!r.startsWith(Bg))return"keys";if(Hg.test(r)||z0.test(r)){let i=r;for(;i.length>0;){const o=wp(i);if(o===0)return"pointer";i=i.slice(o)}return"passive"}let a=r;for(;a.length>0;){const i=wp(a);if(i===0)return"keys";a=a.slice(i)}return"passive"}function U0(r){return r===Bg}const B0=20,H0=6,K0=500,Y0=300,Xi=13,Yg=.602,Gg=1.3;function Wl(r,a){return Number.isFinite(r)&&r>0?r:a}function Sp(r,a,i){return Math.min(i,Math.max(a,r))}function Cp(r){const{width:a,height:i,cellWidth:o,cellHeight:d,minCols:f=B0,minRows:m=H0,maxCols:p=K0,maxRows:g=Y0}=r,v=Wl(o,Xi*Yg),y=Wl(d,Xi*Gg);return{cols:Sp(Math.floor(Wl(a,0)/v),f,p),rows:Sp(Math.floor(Wl(i,0)/y),m,g)}}function ti(r,a=Xi){var o,d,f;if(r)try{const m=r._core,p=(f=(d=(o=m==null?void 0:m._renderService)==null?void 0:o.dimensions)==null?void 0:d.css)==null?void 0:f.cell;if(p&&p.width&&p.width>0&&p.height&&p.height>0)return{cellWidth:p.width,cellHeight:p.height,measured:!0}}catch{}const i=Wl(a,Xi);return{cellWidth:Math.round(i*Yg*100)/100,cellHeight:Math.round(i*Gg*100)/100,measured:!1}}function G0(r){var o;const a=(o=r==null?void 0:r.querySelector)==null?void 0:o.call(r,".xterm-viewport");if(!a)return 0;const i=(a.offsetWidth||0)-(a.clientWidth||0);return Number.isFinite(i)&&i>0?i:0}function Uu(r,a,i){if(!r)return{width:a,height:i};let o=0,d=0;if(typeof r.getBoundingClientRect=="function"){const f=r.getBoundingClientRect();o=(f==null?void 0:f.width)||0,d=(f==null?void 0:f.height)||0}return{width:Wl(o,Wl(r.clientWidth,a)),height:Wl(d,Wl(r.clientHeight,i))}}function qg(r,a,i,o){const d=Number.isFinite(o)&&o>.01?o:1;return{clientX:i.left+(r-i.left)/d,clientY:i.top+(a-i.top)/d}}function Hr(r){var a,i;if(!r)return!1;try{const o=r.modes;if(o&&typeof o.mouseTrackingMode=="string"&&o.mouseTrackingMode!=="none")return!0;const d=r._core;if((a=d==null?void 0:d._coreMouseService)!=null&&a.areMouseEventsActive||(i=d==null?void 0:d.coreMouseService)!=null&&i.areMouseEventsActive||d!=null&&d.mouseMode&&d.mouseMode!=="none")return!0}catch{}return!1}function q0(r,a){const i=a.button??0,o=a.buttons??(r==="mouseup"?0:1);return new MouseEvent(r,{bubbles:!0,cancelable:!0,clientX:a.clientX,clientY:a.clientY,screenX:a.clientX,screenY:a.clientY,button:i,buttons:o})}function Tp(r,a,i){const o=q0(a,i);return r.dispatchEvent(o)}class V0{constructor(a){de(this,"options");de(this,"state","idle");de(this,"startX",0);de(this,"startY",0);de(this,"lastX",0);de(this,"lastY",0);de(this,"activeTarget",null);de(this,"longPressTimer",null);de(this,"capturedPointerId",null);de(this,"captureElement",null);de(this,"scrollRemainderY",0);this.options={longPressDelayMs:500,dragThresholdPx:8,scrollLineHeightPx:18,...a}}getState(){return this.state}setGestureState(a){var i,o;this.state!==a&&(this.state=a,(o=(i=this.options).onGestureStateChange)==null||o.call(i,a))}getActiveBuffer(a){var i;try{return((i=a.buffer)==null?void 0:i.active)||null}catch{return null}}getViewportY(a){var o;const i=(o=this.getActiveBuffer(a))==null?void 0:o.viewportY;return typeof i=="number"&&Number.isFinite(i)?i:null}blurTerminal(a){var i;try{(i=a.blur)==null||i.call(a)}catch{}}getLogicalCoordinates(a,i){const o=this.options.getScale?this.options.getScale():1,d=this.options.getSurfaceElement?this.options.getSurfaceElement():null;if(o!==1&&d&&typeof d.getBoundingClientRect=="function"){const f=d.getBoundingClientRect();return qg(a,i,f,o)}return{clientX:a,clientY:i}}getViewportElement(a){var d;const i=this.options.getSurfaceElement?this.options.getSurfaceElement():null;return(i==null?void 0:i.querySelector(".xterm-viewport"))||((d=a.element)==null?void 0:d.querySelector(".xterm-viewport"))||null}isInputLineHit(a,i){var P;const o=(P=i.buffer)==null?void 0:P.active,d=this.options.getSurfaceElement?this.options.getSurfaceElement():null,f=(d==null?void 0:d.querySelector(".xterm-screen"))||i.element||d,m=ti(i);if(!f||typeof f.getBoundingClientRect!="function"||m.cellHeight<=0)return!1;const p=f.getBoundingClientRect(),g=this.getLogicalCoordinates(a.clientX,a.clientY),v=p.width>0&&p.height>0;if(![o==null?void 0:o.cursorY,o==null?void 0:o.viewportY,o==null?void 0:o.baseY].every(V=>typeof V=="number"&&Number.isFinite(V)))return!1;const w=o==null?void 0:o.cursorY,T=o==null?void 0:o.viewportY,k=(o==null?void 0:o.baseY)+w-T,Y=p.top+k*m.cellHeight,z=Y+m.cellHeight,I=Number(i.rows);return k>=0&&(!Number.isFinite(I)||k<I)&&g.clientY>=Y-2&&g.clientY<=z+2&&(!v||g.clientX>=p.left&&g.clientX<=p.right)}resolveDispatchTarget(a,i){var p;const o=this.options.getSurfaceElement?this.options.getSurfaceElement():null,d=(o==null?void 0:o.querySelector(".xterm-screen"))||i.querySelector(".xterm-screen")||null,f=((p=d==null?void 0:d.closest)==null?void 0:p.call(d,".xterm"))||null;let m=null;return typeof document<"u"&&typeof document.elementFromPoint=="function"&&(m=document.elementFromPoint(a.clientX,a.clientY)),m&&f&&(m===f||f.contains(m))?m:d||o||i}getMouseReport(a,i){const o=this.options.getSurfaceElement?this.options.getSurfaceElement():null,d=(o==null?void 0:o.querySelector(".xterm-screen"))||i.element;if(!d||typeof d.getBoundingClientRect!="function")return null;const f=d.getBoundingClientRect(),m=this.getLogicalCoordinates(a.clientX,a.clientY),p=ti(i);if(p.cellWidth<=0||p.cellHeight<=0)return null;const g=Math.max(1,f.width||i.cols*p.cellWidth),v=Math.max(1,f.height||i.rows*p.cellHeight),y=Math.max(0,Math.min(g-1,m.clientX-f.left)),w=Math.max(0,Math.min(v-1,m.clientY-f.top)),T=Math.max(0,Math.min(i.cols-1,Math.floor(y/p.cellWidth))),R=Math.max(0,Math.min(i.rows-1,Math.floor(w/p.cellHeight)));return{col:T,row:R,x:Math.floor(y),y:Math.floor(w),button:0,action:0}}getCoreMouseService(a){var o,d;const i=a;return i.coreMouseService||((o=i._core)==null?void 0:o.coreMouseService)||((d=i._core)==null?void 0:d._coreMouseService)||null}getCoreService(a){var o;const i=a;return i.coreService||((o=i._core)==null?void 0:o.coreService)||null}getWheelDispatchTarget(a){const i=this.options.getSurfaceElement?this.options.getSurfaceElement():null;return(i==null?void 0:i.querySelector(".xterm"))||a.element||null}dispatchWheel(a,i,o,d){const f=this.getWheelDispatchTarget(o);if(!f||typeof WheelEvent>"u"||i===0)return!1;const m=this.getLogicalCoordinates(a.clientX,a.clientY),p=i<0?-1:1;let g=0;for(let v=0;v<Math.abs(i);v+=1)try{const y=new WheelEvent("wheel",{bubbles:!0,cancelable:!0,clientX:m.clientX,clientY:m.clientY,deltaX:0,deltaY:p,deltaMode:1,ctrlKey:!!(d!=null&&d.ctrlKey),altKey:!!(d!=null&&d.altKey),shiftKey:!!(d!=null&&d.shiftKey)});f.dispatchEvent(y),g+=1}catch{return g>0}return g>0}emitWheel(a,i,o,d){if(i===0)return!1;if(this.dispatchWheel(a,i,o,d))return!0;const f=this.getCoreMouseService(o);if(!(f!=null&&f.triggerMouseEvent))return!1;let m=0;for(let p=0;p<Math.abs(i);p+=1){const g=this.getMouseReport(a,o);g&&(g.button=4,g.action=i<0?0:1,g.ctrl=!!(d!=null&&d.ctrlKey),g.alt=!!(d!=null&&d.altKey),g.shift=!!(d!=null&&d.shiftKey),f.triggerMouseEvent(g)&&(m+=1))}return m>0}scrollAlternateBuffer(a,i,o,d){var m;if(i===0)return"none";const f=Hr(o);if(!f&&!this.options.getIsController())return"none";if(this.emitWheel(a,i,o,d))return f?"application-mouse":"application-keys";if(!f){const p=this.getCoreService(o);if(!(p!=null&&p.triggerDataEvent))return"none";const v=`\x1B${!!((m=p.decPrivateModes)!=null&&m.applicationCursorKeys)?"O":"["}${i<0?"A":"B"}`;return p.triggerDataEvent(v.repeat(Math.abs(i)),!0),"application-keys"}return"none"}emitMouse(a,i,o){const d=this.options.getTerminal();if(!d)return;const f=this.getCoreMouseService(d);if(f!=null&&f.triggerMouseEvent){const p=this.getMouseReport(i,d);p&&(p.action=a==="mousedown"?1:a==="mouseup"?0:32,p.ctrl=!!(o!=null&&o.ctrlKey),p.alt=!!(o!=null&&o.altKey),p.shift=!!(o!=null&&o.shiftKey),f.triggerMouseEvent(p));return}if(this.options.allowSyntheticMouseFallback===!1||!this.activeTarget)return;const m=this.getLogicalCoordinates(i.clientX,i.clientY);Tp(this.activeTarget,a,{clientX:m.clientX,clientY:m.clientY,button:0,buttons:a==="mouseup"?0:1})}beginGesture(a,i){this.startX=a.clientX,this.startY=a.clientY,this.lastX=a.clientX,this.lastY=a.clientY,this.setGestureState("pending"),this.scrollRemainderY=0,this.activeTarget=this.resolveDispatchTarget(a,i),this.clearLongPressTimer(),this.longPressTimer=setTimeout(()=>{var o,d;this.state==="pending"&&(this.setGestureState("longpress"),(d=(o=this.options).onLongPress)==null||d.call(o,{clientX:this.startX,clientY:this.startY}))},this.options.longPressDelayMs)}moveGesture(a,i){var v,y,w,T;if(this.state==="longpress"){(y=(v=this.options).onSelectionExtend)==null||y.call(v,{clientX:a.clientX,clientY:a.clientY}),i!=null&&i.cancelable&&((w=i.preventDefault)==null||w.call(i));return}if(this.state==="idle")return;const o=a.clientX-this.startX,d=a.clientY-this.startY,f=Math.hypot(o,d);if(this.state==="scrolling"){this.scrollGesture(a,i);return}const m=this.options.getTerminal(),p=this.options.getIsController(),g=Hr(m);if(!(f<=(this.options.dragThresholdPx||8))){if(this.clearLongPressTimer(),Math.abs(d)>=Math.abs(o)||!g||!p){this.setGestureState("scrolling"),m&&this.blurTerminal(m),this.lastX=a.clientX,this.lastY=this.startY,this.scrollRemainderY=0,this.scrollGesture(a,i);return}if(g&&p){this.state==="pending"&&(this.setGestureState("dragging"),this.emitMouse("mousedown",{clientX:this.startX,clientY:this.startY},i)),this.state==="dragging"&&(this.lastX=a.clientX,this.lastY=a.clientY,this.emitMouse("mousemove",a,i),i!=null&&i.cancelable&&((T=i.preventDefault)==null||T.call(i)));return}this.lastX=a.clientX,this.lastY=a.clientY}}scrollGesture(a,i){var k,Y,z;const o=this.options.getTerminal();if(!o)return;const d=a.clientY-this.lastY;this.lastX=a.clientX,this.lastY=a.clientY;const f=ti(o),m=f.measured?f.cellHeight:this.options.scrollLineHeightPx||f.cellHeight||18;this.scrollRemainderY+=d;const p=Math.trunc(this.scrollRemainderY/m),g=-p;let v=!1,y="none";const w=this.getActiveBuffer(o),T=Hr(o);if(g!==0){if((w==null?void 0:w.type)==="alternate")y=this.scrollAlternateBuffer(a,g,o,i),v=y!=="none";else{const I=this.getViewportY(o);o.scrollLines(g);const P=this.getViewportY(o);y="buffer",v=I===null||P===null||I!==P}this.scrollRemainderY-=p*m}const R=this.getViewportElement(o);(Y=(k=this.options).onGestureScroll)==null||Y.call(k,{deltaY:d,lines:g,viewportY:this.getViewportY(o),scrollTop:(R==null?void 0:R.scrollTop)??null,scrollHeight:(R==null?void 0:R.scrollHeight)??null,clientHeight:(R==null?void 0:R.clientHeight)??null,moved:v,bufferType:(w==null?void 0:w.type)||null,baseY:typeof(w==null?void 0:w.baseY)=="number"?w.baseY:null,cursorY:typeof(w==null?void 0:w.cursorY)=="number"?w.cursorY:null,hasScrollback:typeof(w==null?void 0:w.hasScrollback)=="boolean"?w.hasScrollback:null,mouseTracking:T,scrollMode:y}),i!=null&&i.cancelable&&((z=i.preventDefault)==null||z.call(i))}endGesture(a,i){var m,p,g;this.clearLongPressTimer();const o=this.options.getTerminal(),d=this.options.getIsController(),f=Hr(o);if(this.state==="pending"){if(f&&d){const y={clientX:this.startX,clientY:this.startY};this.emitMouse("mousedown",y,i),this.emitMouse("mouseup",y,i)}const v={clientX:this.startX,clientY:this.startY};d&&o&&this.isInputLineHit(v,o)&&((p=(m=this.options).onFocus)==null||p.call(m))}else if(this.state==="dragging"&&f&&d){const v=a??{clientX:this.lastX,clientY:this.lastY};this.emitMouse("mouseup",v,i),i!=null&&i.cancelable&&((g=i.preventDefault)==null||g.call(i))}this.reset()}handlePointerDown(a,i){if(a.pointerType==="mouse")return!1;if(!a.isPrimary)return this.releasePointerCapture(),this.reset(),!1;if(a.cancelable&&a.preventDefault(),this.beginGesture(a,i),a.pointerType!=="touch")try{typeof i.setPointerCapture=="function"&&(i.setPointerCapture(a.pointerId),this.capturedPointerId=a.pointerId,this.captureElement=i)}catch{}return!0}handlePointerMove(a){a.pointerType==="mouse"||this.state==="idle"||this.moveGesture(a,a)}handlePointerUp(a){a.pointerType==="mouse"||this.state==="idle"||(this.releasePointerCapture(),this.endGesture(a,a))}handlePointerCancel(a){a&&a.pointerType==="mouse"||(this.releasePointerCapture(),this.cancelGesture())}handleTouchStart(a,i){if(a.touches.length!==1){this.reset();return}a.cancelable&&a.preventDefault(),this.beginGesture(a.touches[0],i)}handleTouchMove(a){a.touches.length===1&&this.moveGesture(a.touches[0],a)}handleTouchEnd(a){a.cancelable&&a.preventDefault(),this.endGesture(null,a)}handleTouchCancel(){this.cancelGesture()}cancelGesture(){this.clearLongPressTimer();const a=this.options.getTerminal(),i=this.options.getIsController(),o=Hr(a);if(this.state==="dragging"&&o&&i&&this.activeTarget){const d=this.getLogicalCoordinates(this.lastX,this.lastY);Tp(this.activeTarget,"mouseup",{clientX:d.clientX,clientY:d.clientY,button:0,buttons:0})}this.reset()}releasePointerCapture(){const a=this.captureElement,i=this.capturedPointerId;if(this.captureElement=null,this.capturedPointerId=null,!(!a||i===null))try{typeof a.releasePointerCapture=="function"&&(typeof a.hasPointerCapture!="function"||a.hasPointerCapture(i))&&a.releasePointerCapture(i)}catch{}}clearLongPressTimer(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressTimer=null)}reset(){this.clearLongPressTimer(),this.releasePointerCapture(),this.setGestureState("idle"),this.activeTarget=null}}var F0=av();const Zr="herdr_remote_renderer_probe_v1",bo=1,X0=720*60*60*1e3,Ju={};function Vg(){let r=null;if(typeof window>"u")r=Ju[Zr]||null;else try{r=window.localStorage?window.localStorage.getItem(Zr):null}catch{r=Ju[Zr]||null}if(!r)return{v:bo,ua:{}};try{const a=JSON.parse(r);return typeof a=="object"&&a!==null&&a.v===bo&&typeof a.ua=="object"&&a.ua!==null?a:{v:bo,ua:{}}}catch{return{v:bo,ua:{}}}}function I0(r,a=Date.now()){var d;const i=Vg();i.ua[r]={failedAt:a};const o=JSON.stringify(i);if(Ju[Zr]=o,typeof window<"u")try{(d=window.localStorage)==null||d.setItem(Zr,o)}catch(f){console.warn("Failed to write renderer probe result to localStorage:",f)}}function Z0(r,a=Date.now()){const i=typeof navigator<"u"?navigator.userAgent:"";if(!i)return!1;const d=Vg().ua[i];return!(!d||typeof d.failedAt!="number"||a-d.failedAt>X0)}function Ap(r,a=Date.now()){const i=typeof navigator<"u"?navigator.userAgent:"";i&&I0(i,a)}function Q0(r){if(r.length<4)return!0;const a=r[0],i=r[1],o=r[2],d=r[3];for(let f=4;f<r.length;f+=4)if(r[f]!==a||r[f+1]!==i||r[f+2]!==o||r[f+3]!==d)return!1;return!0}function P0(r){if(!r||r.width<=0||r.height<=0)return console.debug("Canvas probe inconclusive: text layer canvas missing or zero dimensions"),"inconclusive";let a=null;try{a=r.getContext("2d",{willReadFrequently:!0})||r.getContext("2d")}catch(d){return console.debug("Canvas probe inconclusive: failed to acquire 2D context:",d),"inconclusive"}if(!a)return console.debug("Canvas probe inconclusive: 2D context is null"),"inconclusive";const i=Math.min(r.width,640),o=Math.min(r.height,240);if(i<=0||o<=0)return console.debug("Canvas probe inconclusive: calculated sample dimensions are zero"),"inconclusive";try{const d=a.getImageData(0,0,i,o);return Q0(d.data)?"blank":"healthy"}catch(d){return console.debug("Canvas probe inconclusive: getImageData threw exception:",d),"inconclusive"}}function W0(r=2){return new Promise(a=>{if(typeof requestAnimationFrame!="function"){setTimeout(a,32);return}let i=r;const o=()=>{i--,i<=0?a():requestAnimationFrame(o)};requestAnimationFrame(o)})}function J0(r,a={}){if(Z0())return{kind:"dom",dispose:()=>{},verify:async()=>{}};try{const i=new F0.CanvasAddon;r.loadAddon(i);let o="canvas",d=!1,f=null;const m=()=>{var g;if(o!=="dom"){Ap();try{i.dispose()}catch{}o="dom",(g=a.onRendererSwapped)==null||g.call(a,"dom")}};return{get kind(){return o},dispose:()=>{d=!0;try{i.dispose()}catch{}},verify:async()=>{if(!(d||o!=="canvas"))return f||(f=(async()=>{var g;try{if(await W0(2),d||o!=="canvas")return;const v=(g=r.element)==null?void 0:g.querySelector("canvas.xterm-text-layer"),y=P0(v);y==="blank"?m():y==="inconclusive"&&console.debug("Canvas probe inconclusive; retaining canvas renderer without blacklisting")}catch(v){console.debug("Canvas probe inconclusive: unexpected error during verify():",v)}finally{f=null}})(),f)}}}catch(i){console.debug("Canvas renderer unavailable, using the DOM renderer:",i),Ap()}return{kind:"dom",dispose:()=>{},verify:async()=>{}}}function Np(r,a){const i=typeof window<"u"?window:void 0,o=i&&typeof i.devicePixelRatio=="number"&&i.devicePixelRatio>0?i.devicePixelRatio:1,d=i&&i.visualViewport&&typeof i.visualViewport.scale=="number"&&i.visualViewport.scale>0?i.visualViewport.scale:1,f=Math.max(0,r.width),m=Math.max(0,r.height),p=Math.round(f*o*100)/100,g=Math.round(m*o*100)/100;return{dpr:o,scale:d,cssWidth:f,cssHeight:m,physicalWidth:p,physicalHeight:g}}function $0(r){const{lastSnapshot:a,currentSnapshot:i,physicalTolerancePx:o=6}=r;if(!a)return{shouldIgnore:!1,isVisualZoom:!1,reason:"initial"};const d=Math.abs(i.scale-a.scale)>.01,f=Math.abs(i.scale-1)>.01;if(d||f)return{shouldIgnore:!0,isVisualZoom:!0,reason:"visual_pinch_zoom"};if(Math.abs(i.dpr-a.dpr)>.01){const v=Math.abs(i.physicalWidth-a.physicalWidth),y=Math.abs(i.physicalHeight-a.physicalHeight);if(v<=o&&y<=o)return{shouldIgnore:!0,isVisualZoom:!0,reason:"dpr_zoom"}}const p=Math.abs(i.cssWidth-a.cssWidth),g=Math.abs(i.cssHeight-a.cssHeight);return p<1&&g<1?{shouldIgnore:!0,isVisualZoom:!1,reason:"no_box_change"}:{shouldIgnore:!1,isVisualZoom:!1,reason:"genuine_resize"}}const ew=" ()[]{}'\"\\`";function Bu(r,a,i,o=1){var z,I;if(!a||!((z=a.buffer)!=null&&z.active)||a.cols<=0||a.rows<=0)return null;const d=i||((I=a.element)==null?void 0:I.querySelector(".xterm-screen"))||a.element;if(!d||typeof d.getBoundingClientRect!="function")return null;const f=d.getBoundingClientRect(),m=qg(r.clientX,r.clientY,f,o),p=ti(a);if(p.cellWidth<=0||p.cellHeight<=0)return null;const g=Math.max(1,f.width||a.cols*p.cellWidth),v=Math.max(1,f.height||a.rows*p.cellHeight),y=Math.max(0,Math.min(g-1,m.clientX-f.left)),w=Math.max(0,Math.min(v-1,m.clientY-f.top)),T=Math.max(0,Math.min(a.cols-1,Math.floor(y/p.cellWidth))),R=Math.max(0,Math.min(a.rows-1,Math.floor(w/p.cellHeight))),Y=(a.buffer.active.viewportY??0)+R;return{col:T,bufferRow:Y}}function tw(r,a){if(!r||r.length===0||r==="\0")return!0;for(const i of r)if(i==="\0"||/\s/.test(i)||a.includes(i))return!0;return!1}function nw(r,a,i){var T,R;if(!r||!((T=r.buffer)!=null&&T.active)||a<0||a>=r.cols)return null;const o=r.buffer.active.getLine(i);if(!o)return null;const d=((R=r.options)==null?void 0:R.wordSeparator)??ew,f=new Array(r.cols).fill(null),m=Math.min(r.cols,o.length);let p=0;for(;p<m;){const k=o.getCell(p);if(!k){f[p]={startCol:p,endCol:p+1,isSeparator:!0},p++;continue}const Y=k.getWidth();if(Y===0){f[p]||(f[p]={startCol:p,endCol:p+1,isSeparator:!0}),p++;continue}const z=k.getChars(),I=tw(z,d),P=Math.min(r.cols,p+Y),V={startCol:p,endCol:P,isSeparator:I};for(let oe=p;oe<P;oe++)f[oe]=V;p+=Math.max(1,Y)}for(let k=m;k<r.cols;k++)f[k]||(f[k]={startCol:k,endCol:k+1,isSeparator:!0});const g=f[a];if(!g||g.isSeparator)return null;let v=g.startCol;for(;v>0;){const k=f[v-1];if(k&&!k.isSeparator)v=k.startCol;else break}let y=g.endCol;for(;y<r.cols;){const k=f[y];if(k&&!k.isSeparator)y=k.endCol;else break}const w=y-v;return w<=0?null:{startCol:v,length:w}}function lw(r){var f;if(!r||!((f=r.buffer)!=null&&f.active))return"";const a=r.buffer.active,i=a.viewportY??0,o=r.rows,d=[];for(let m=0;m<o;m++){const p=a.getLine(i+m);d.push(p?p.translateToString(!0):"")}for(;d.length>0&&d[d.length-1]==="";)d.pop();return d.join(`
34
+ `)}const Ep=new Set(["│","┃","╎","╏","┆","┇","┊","┋","║","▏","▕","|"]),aw=.6,iw=new Set(["─","━","═","┄","┅","┈","┉","-"]),rw=.8;function Hu(r,a){if(!r)return!1;let i=0;const o=Math.min(a,r.length);for(let d=0;d<o;d++){const f=r.getCell(d);if(f){const m=f.getChars();m&&iw.has(m)&&i++}}return i>=Math.max(5,Math.min(a*.25,10))}function Ku(r,a,i){var R;if(!r||!((R=r.buffer)!=null&&R.active)||r.cols<=0)return{startCol:0,endCol:0};const o=r.buffer.active,d=r.cols,f=Math.max(0,Math.min(d-1,a)),m=o.viewportY??0,p=r.rows>0?r.rows:1,g=new Int32Array(d);let v=0;for(let k=0;k<p;k++){const Y=o.getLine(m+k);if(v++,!Y)continue;const z=Math.min(d,Y.length);for(let I=0;I<z;I++){const P=Y.getCell(I);if(P){const V=P.getChars();V&&Ep.has(V)&&g[I]++}}}if(v===0)return{startCol:0,endCol:d-1};const y=v*aw,w=k=>g[k]>=y;let T=!1;for(let k=0;k<d;k++)if(w(k)){T=!0;break}if(T){if(w(f))return{startCol:f,endCol:f};let k=-1;for(let z=f-1;z>=0;z--)if(w(z)){k=z;break}let Y=d;for(let z=f+1;z<d;z++)if(w(z)){Y=z;break}return{startCol:k+1,endCol:Y-1}}if(i!==void 0){const k=Math.max(m,Math.min(m+p-1,i)),Y=o.getLine(k);if(!Hu(Y,d)){let z=m;for(let V=k-1;V>=m;V--)if(Hu(o.getLine(V),d)){z=V+1;break}let I=m+p-1;for(let V=k+1;V<=m+p-1;V++)if(Hu(o.getLine(V),d)){I=V-1;break}const P=I-z+1;if(P>=2){const V=new Int32Array(d);for(let X=z;X<=I;X++){const U=o.getLine(X);if(!U)continue;const te=Math.min(d,U.length);for(let ae=0;ae<te;ae++){const ge=U.getCell(ae);if(ge){const Te=ge.getChars();Te&&Ep.has(Te)&&V[ae]++}}}const oe=P*rw,ve=X=>V[X]>=oe;let ne=!1;for(let X=0;X<d;X++)if(ve(X)){ne=!0;break}if(ne){if(ve(f))return{startCol:f,endCol:f};let X=-1;for(let te=f-1;te>=0;te--)if(ve(te)){X=te;break}let U=d;for(let te=f+1;te<d;te++)if(ve(te)){U=te;break}return{startCol:X+1,endCol:U-1}}}}}return{startCol:0,endCol:d-1}}function kp(r,a){const i=Math.min(r.startCol,r.endCol),o=Math.max(r.startCol,r.endCol),d=Math.min(r.startRow,r.endRow),f=Math.max(r.startRow,r.endRow);return{startCol:Math.max(a.startCol,Math.min(a.endCol,i)),endCol:Math.max(a.startCol,Math.min(a.endCol,o)),startRow:d,endRow:f}}function Yu(r,a){var v;if(!r||!((v=r.buffer)!=null&&v.active)||r.cols<=0)return"";const i=r.buffer.active,o=r.cols,d=Math.min(a.startRow,a.endRow),f=Math.max(a.startRow,a.endRow),m=Math.max(0,Math.min(a.startCol,a.endCol)),p=Math.min(o-1,Math.max(a.startCol,a.endCol));if(m>p||d>f)return"";const g=[];for(let y=d;y<=f;y++){const w=i.getLine(y);if(!w){g.push("");continue}const T=w.translateToString(!0,m,p+1);g.push(T.trimEnd())}return g.join(`
35
+ `)}async function ni(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 a=null,i=null,o=null;try{if(a=document.createElement("textarea"),a.style.userSelect="text",a.style.webkitUserSelect="text",a.style.position="fixed",a.style.top="0",a.style.left="0",a.style.width="1px",a.style.height="1px",a.style.padding="0",a.style.border="none",a.style.outline="none",a.style.boxShadow="none",a.style.background="transparent",a.style.opacity="0",a.style.fontSize="16px",a.setAttribute("readonly",""),a.setAttribute("aria-hidden","true"),a.value=r,typeof window<"u"&&typeof window.getSelection=="function"&&(o=window.getSelection(),o&&o.rangeCount>0&&(i=o.getRangeAt(0))),document.body.appendChild(a),typeof navigator<"u"&&(/iPad|iPhone|iPod/.test(navigator.userAgent||"")||navigator.platform==="MacIntel"&&(navigator.maxTouchPoints||0)>1)){const m=document.createRange();m.selectNodeContents(a),o&&(o.removeAllRanges(),o.addRange(m)),a.setSelectionRange(0,r.length)}else a.focus({preventScroll:!0}),a.select();if(document.execCommand("copy"))return"exec"}catch{}finally{a&&a.parentNode&&a.parentNode.removeChild(a),o&&(o.removeAllRanges(),i&&o.addRange(i))}}return"failed"}async function sw(){if(!(typeof window>"u"||window.isSecureContext!==!1)||typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.readText!="function")return{ok:!1,reason:"insecure"};try{const a=await navigator.clipboard.readText();return!a||a.length===0?{ok:!1,reason:"empty"}:{ok:!0,text:a}}catch(a){return typeof window<"u"&&window.isSecureContext===!1?{ok:!1,reason:"insecure"}:(a==null?void 0:a.name)==="SecurityError"?{ok:!1,reason:"insecure"}:{ok:!1,reason:"denied"}}}async function ow(){if(!(typeof window>"u"||window.isSecureContext!==!1)||typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.read!="function")return{ok:!1,reason:"insecure"};try{const a=await navigator.clipboard.read();if(!a||a.length===0)return{ok:!1,reason:"empty"};for(const i of a){const o=i.types.find(d=>d.startsWith("image/"));if(o){const d=await i.getType(o);if(d&&d.size>0)return{ok:!0,blob:d}}}return{ok:!1,reason:"empty"}}catch(a){if(typeof window<"u"&&window.isSecureContext===!1)return{ok:!1,reason:"insecure"};const i=a==null?void 0:a.name;return i==="SecurityError"?{ok:!1,reason:"insecure"}:i==="NotAllowedError"?{ok:!1,reason:"denied"}:{ok:!1,reason:"empty"}}}function Fg(r){const a=r.clipboardData;if(!a)return null;if(a.files&&a.files.length>0)for(let i=0;i<a.files.length;i++){const o=a.files[i];if(o&&o.type.startsWith("image/"))return o}if(a.items&&a.items.length>0)for(let i=0;i<a.items.length;i++){const o=a.items[i];if(o&&o.type.startsWith("image/")){const d=o.getAsFile();if(d)return d}}return null}function cw(r){if(!r||r.length===0)return null;for(let a=0;a<r.length;a++){const i=r[a];if(i&&(i.type.startsWith("image/")||/\.(png|jpe?g|webp|gif)$/i.test(i.name)))return i}return null}const Gu="Herdr Remote",Rp=80,uw=/[\u0000-\u001F\u007F-\u009F]/g;function $u(r){if(typeof r!="string")return"";const a=r.replace(uw," ").replace(/\s+/g," ").trim();return a.length<=Rp?a:`${a.slice(0,Rp-1).trimEnd()}…`}function dw(r,a,i){const o=bx(i??null),d=o?`${o} `:"",f=$u(r);if(f)return`${d}${f} · ${Gu}`;const m=$u(a);return m?`${d}${m} · ${Gu}`:`${d}${Gu}`}function fw(r,a,i){const o=dw(r,a,i);return typeof document<"u"&&(document.title=o),o}const hw=new Set(["http:","https:","mailto:"]),qu=/(?:https?:\/\/|mailto:|www\.)[^\s"'<>`]+/gi,mw=/[.,;:!?'"]+$/,jp=8;function fd(r){return/^www\./i.test(r)?`https://${r}`:r}function pw(r){const a=(d,f)=>d.split(f).length-1;let i=r.replace(mw,"");const o=[["(",")"],["[","]"],["{","}"]];for(const[d,f]of o)for(;i.endsWith(f)&&a(i,f)>a(i,d);)i=i.slice(0,-1);return i}function Xg(r){if(typeof r!="string"||r.length===0)return!1;try{return hw.has(new URL(fd(r)).protocol)}catch{return!1}}function gw(r,a){if(typeof r!="string"||a<0)return null;qu.lastIndex=0;for(let i=qu.exec(r);i;i=qu.exec(r)){const o=pw(i[0]);if(!o)continue;const d=i.index,f=d+o.length;if(a>=d&&a<f&&Xg(o))return o}return null}function bw(r,a,i){var p;const o=(p=r==null?void 0:r.buffer)==null?void 0:p.active;if(!o||typeof o.getLine!="function"||!o.getLine(i))return null;let d=i;for(let g=0;g<jp;g+=1){const v=o.getLine(d);if(!(v!=null&&v.isWrapped)||d===0)break;d-=1}let f="",m=-1;for(let g=d;g<d+jp;g+=1){const v=o.getLine(g);if(!v||g>d&&!v.isWrapped)break;g===i&&(m=f.length+a),f+=v.translateToString(!1)}return m<0?null:{text:f,index:m}}function yw(r,a,i){const o=bw(r,a,i);return o?gw(o.text,o.index):null}function vw(r){try{const a=new URL(fd(r));return a.host||a.pathname}catch{return""}}function Vu(r){return!Xg(r)||typeof window>"u"||typeof window.open!="function"?!1:(window.open(fd(r),"_blank","noopener,noreferrer"),!0)}const Bi="tui-focusable group flex h-11 w-full select-none items-center gap-2 border px-2 text-left text-tui transition-colors",Hi="border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",xw=({anchorPoint:r,hasSelection:a,isController:i,vibrateOnKeyPress:o=!1,linkUrl:d=null,onOpenLink:f,onCopySelection:m,onCopyLine:p,onCopyScreen:g,onPaste:v,onClose:y})=>{const{t:w}=Mt(),T=x.useRef(null),[R,k]=x.useState(null);x.useEffect(()=>{if(o&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(8)}catch{}},[o]),x.useLayoutEffect(()=>{const P=T.current;if(!P||!P.parentElement)return;const V=P.parentElement.getBoundingClientRect(),oe=P.getBoundingClientRect(),ve=oe.width||208,ne=oe.height||220,X=V.width,U=V.height;let te=r.x-ve/2;te=Math.max(8,Math.min(Math.max(8,X-ve-8),te));let ae=r.y-ne-8;ae<8&&(ae=r.y+8),ae=Math.max(8,Math.min(Math.max(8,U-ne-8),ae)),k({x:te,y:ae})},[r.x,r.y,a,i,d]);const Y=Math.max(8,r.x-104),z=Math.max(8,r.y-200),I={position:"absolute",left:`${R?R.x:Y}px`,top:`${R?R.y:z}px`,visibility:R?"visible":"hidden"};return u.jsx("div",{ref:T,role:"menu","aria-label":"终端选择操作",className:"z-50 w-52 select-none font-mono",style:I,onMouseDown:P=>P.stopPropagation(),onTouchStart:P=>P.stopPropagation(),onPointerDown:P=>P.stopPropagation(),children:u.jsxs(dn,{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:$(Bi,Hi),onClick:()=>{f(d),y()},children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Fe.cursor}),u.jsx("span",{className:"truncate",children:w("clipboard.openLink")}),u.jsx("span",{className:"ml-auto max-w-[45%] truncate text-tui-faint",children:vw(d)})]}),a&&u.jsxs("button",{type:"button",role:"menuitem",className:$(Bi,Hi),onClick:()=>{m(),y()},children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Fe.cursor}),u.jsx("span",{className:"truncate",children:w("clipboard.copySelection")})]}),u.jsxs("button",{type:"button",role:"menuitem",className:$(Bi,Hi),onClick:()=>{p(),y()},children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Fe.cursor}),u.jsx("span",{className:"truncate",children:w("clipboard.copyLine")})]}),u.jsxs("button",{type:"button",role:"menuitem",className:$(Bi,Hi),onClick:()=>{g(),y()},children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Fe.cursor}),u.jsx("span",{className:"truncate",children:w("clipboard.copyScreen")})]}),i&&u.jsxs("button",{type:"button",role:"menuitem",className:$(Bi,Hi),onClick:()=>{v(),y()},children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Fe.cursor}),u.jsx("span",{className:"truncate",children:w("clipboard.paste")})]}),u.jsxs("button",{type:"button",role:"menuitem",className:$(Bi,Hi),onClick:y,children:[u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Fe.cursor}),u.jsx("span",{className:"truncate",children:w("clipboard.cancel")})]})]})})},ww=({isOpen:r,onClose:a,onSend:i,onSendImage:o})=>{const{t:d,addToast:f}=Mt(),[m,p]=x.useState(""),[g,v]=x.useState(null),[y,w]=x.useState(!1),T=x.useRef(null),R=x.useRef(null),k=x.useRef(null);x.useEffect(()=>{r&&(p(""),v(null),w(!1),T.current&&(T.current.value=""),R.current&&(R.current.value=""))},[r]);const Y=async ne=>{if(ne.size===0){f("error",d("clipboard.fileEmpty"));return}w(!0);try{const X=await gg(ne);X?(v(X),p("")):f("error",d("clipboard.imageTooLarge"))}catch(X){console.error("Failed to process image:",X),f("error",d("clipboard.imageTooLarge"))}finally{w(!1)}},z=async ne=>{const X=Fg(ne);X&&(ne.preventDefault(),await Y(X))},I=async ne=>{const X=cw(ne.target.files);ne.target.value="",X&&await Y(X)},P=ne=>{const X=ne.target.value;p(X),X&&g&&v(null)},V=()=>{v(null),T.current&&(T.current.value=""),R.current&&(R.current.value="")},oe=()=>{g?(o==null||o(g),a()):m.trim()&&(i(m),a())},ve=!!(m.trim()||g);return u.jsx(dd,{isOpen:r,onClose:a,title:d("clipboard.pasteTitle"),closeLabel:d("clipboard.cancel"),size:"sm",footer:u.jsxs("div",{className:"flex items-center justify-end gap-2",children:[u.jsx(Le,{variant:"ghost",onClick:a,children:d("clipboard.cancel")}),u.jsx(Le,{variant:"primary",onClick:oe,disabled:!ve||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:m,onChange:P,onPaste:z,disabled:!!g||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:T,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",className:"hidden","data-testid":"paste-fallback-file-input",onChange:I}),u.jsx("input",{ref:R,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",capture:"environment",className:"hidden","data-testid":"paste-fallback-camera-input",onChange:I}),g?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:g.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:cx(g.byteLength)})}),u.jsx(Le,{variant:"ghost",onClick:V,"aria-label":d("clipboard.removeImage"),children:d("clipboard.cancel")})]})]}):u.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[u.jsx(Le,{variant:"default",onClick:()=>{var ne;return(ne=T.current)==null?void 0:ne.click()},disabled:y||!!m.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(Le,{variant:"default",onClick:()=>{var ne;return(ne=R.current)==null?void 0:ne.click()},disabled:y||!!m.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")})})]})]})})},Sw=[[12288,12329],[12334,12335],[12337,12348],[12350,12350],[12353,12438],[12443,12543],[13312,19903],[19968,40959],[44032,55203],[63744,64255],[65281,65376],[65504,65510],[131072,196605],[196608,262141]];function Cw(r){if(r>=32&&r<=126)return 1;if(r<12288)return 0;for(const[a,i]of Sw){if(r<a)return 0;if(r<=i)return 2}return 0}const Tw=2,Aw="?!#",Nw=8,Ew=1500;function Ki(r){return r===""||r===" "?" ":r}function kw(r){const a=r.buffer.active;return{key:"legacy",row:a.baseY+a.cursorY,caretCol:a.cursorX,startCol:a.cursorX,endCol:r.cols,empty:!1,agentLike:!1}}class Rw{constructor(a){de(this,"getTerminal");de(this,"getFieldOption");de(this,"now");de(this,"textDecoder",new TextDecoder("utf-8"));de(this,"confidentKeys",new Set);de(this,"field",null);de(this,"predictions",[]);de(this,"predictedCursor",null);de(this,"srtt",null);de(this,"isSuppressed",!1);de(this,"suppressCursor",null);de(this,"suppressSentAt",0);de(this,"awaitingPrefixCommand",!1);de(this,"mismatches",0);this.getTerminal=a.getTerminal,this.getFieldOption=a.getField,this.now=a.now??(typeof performance<"u"&&typeof performance.now=="function"?()=>performance.now():()=>Date.now())}handleUserInput(a){if(this.pruneExpired(),a.length===0)return;const i=this.textDecoder.decode(a,{stream:!1});if(!i)return;const o=Kg(i);if(o==="passive")return;if(o==="pointer"){this.freeze("pointer");return}if(this.awaitingPrefixCommand){this.awaitingPrefixCommand=!1,this.freeze("Herdr prefix command",{demote:!0});return}if(U0(i)){this.freeze("escape",{demote:!0});return}const d=this.getTerminal();if(!d){this.reset("terminal unavailable",!0);return}for(const f of i){const m=f.codePointAt(0);if(m===void 0)continue;if(m===Tw){this.awaitingPrefixCommand=!0,this.freeze("Herdr prefix",{demote:!0});return}if(m===27||m===9||m===10||m===13||m<32&&m!==8){this.freeze("control or escape sequence");return}if(m===8||m===127){if(!this.handleBackspace(d))return;continue}const p=Cw(m);if(p===0){this.freeze("unpredictable character");return}if(!this.handlePrintable(f,p,d))return}}onServerOutput(){var f,m;const a=this.getTerminal(),i=a?{row:a.buffer.active.baseY+a.buffer.active.cursorY,col:a.buffer.active.cursorX}:null;if(this.isSuppressed){const p=this.now()-this.suppressSentAt>=this.suppressTimeout();(!!i&&!!this.suppressCursor&&(i.row!==this.suppressCursor.row||i.col!==this.suppressCursor.col)||p)&&(this.isSuppressed=!1,this.suppressCursor=null)}if(this.pruneExpired(),this.predictions.length===0||!a||!i)return;const o=this.field;if(this.getFieldOption){const p=this.getFieldOption();if(!p||p.key!==(o==null?void 0:o.key)){if(this.predictions.every(g=>g.frozenFrom)){this.predictions=[],this.predictedCursor=null;return}this.mismatch();return}if(p.layout!==o.layout){this.predictions=[],this.predictedCursor=null,this.field=p;return}}const d=[];for(const p of this.predictions){const g=(f=a.buffer.active.getLine(p.row))==null?void 0:f.getCell(p.col),v=Ki(g?g.getChars():""),y=p.kind==="char"?v===p.char&&(p.width===1||(((m=g==null?void 0:g.getWidth)==null?void 0:m.call(g))??2)===2):v===" ",w=p.kind==="char"?i.row>p.row||i.row===p.row&&i.col>=p.col+p.width:i.row<p.row||i.row===p.row&&i.col<=p.col,T=p.before.includes(v);if(y&&(w||!T))this.updateSrtt(Math.max(0,this.now()-p.sentAt)),o&&!p.frozenFrom&&this.markConfident(o.key);else if(p.frozenFrom){const R=p.frozenFrom;!w&&T&&i.row===R.row&&i.col>=R.col&&d.push(p)}else if(!w&&T)d.push(p);else{this.mismatch();return}}this.predictions=d,d.length===0&&(this.predictedCursor=null)}reset(a,i){var f;this.predictions=[],this.predictedCursor=null;const o=typeof i=="boolean"?i:(i==null?void 0:i.suppress)??!0;if(typeof i=="object"&&(i==null?void 0:i.demote)===!0){const m=this.field??((f=this.getFieldOption)==null?void 0:f.call(this))??null;m&&this.confidentKeys.delete(m.key)}if(o){this.isSuppressed=!0,this.suppressSentAt=this.now();const m=this.getTerminal();m?this.suppressCursor={row:m.buffer.active.baseY+m.buffer.active.cursorY,col:m.buffer.active.cursorX}:this.suppressCursor=null}else this.isSuppressed=!1,this.suppressCursor=null}forgetConfidence(){this.confidentKeys.clear(),this.field=null}getVisiblePredictions(){return this.pruneExpired(),this.visiblePredictions().map(a=>({row:a.row,col:a.col,char:a.char}))}getOverlayItems(){var y,w,T,R;this.pruneExpired();const a=this.visiblePredictions();if(a.length===0)return[];const i=a.map(k=>({row:k.row,col:k.col,char:k.char,width:k.width,kind:k.kind})),o=a[a.length-1],d=this.predictedCursor??{row:o.row,col:o.kind==="erase"?o.col:o.col+o.width},f=(k,Y)=>a.some(z=>z.row===k&&z.col<=Y&&Y<z.col+z.width),m=this.getTerminal(),p=m==null?void 0:m.buffer.active;if(p){const k={row:p.baseY+p.cursorY,col:p.cursorX};if(!f(k.row,k.col)&&(k.row!==d.row||k.col!==d.col)){const Y=((w=(y=p.getLine(k.row))==null?void 0:y.getCell(k.col))==null?void 0:w.getChars())??"";i.push({row:k.row,col:k.col,char:Ki(Y),width:1,kind:"mask"})}}const g=a.find(k=>k.row===d.row&&k.col===d.col),v=g?g.char:Ki(((R=(T=p==null?void 0:p.getLine(d.row))==null?void 0:T.getCell(d.col))==null?void 0:R.getChars())??"");return i.push({row:d.row,col:d.col,char:v,width:1,kind:"caret"}),i}getState(){return this.field&&this.confidentKeys.has(this.field.key)?"confident":"tentative"}getField(){return this.field}getMismatchCount(){return this.mismatches}getEchoSrttMs(){return this.srtt}visiblePredictions(){const a=this.getState()==="confident";return this.predictions.filter(i=>i.frozenFrom?i.shownWhenFrozen:a)}freeze(a,i={}){var m;const o=this.getTerminal(),d=o?{row:o.buffer.active.baseY+o.buffer.active.cursorY,col:o.buffer.active.cursorX}:null,f=this.getState()==="confident";for(const p of this.predictions)p.frozenFrom||(p.frozenFrom=d??{row:p.row,col:p.col},p.shownWhenFrozen=f);if(this.predictedCursor=null,i.demote){const p=this.field??((m=this.getFieldOption)==null?void 0:m.call(this))??null;p&&this.confidentKeys.delete(p.key)}this.isSuppressed=!0,this.suppressSentAt=this.now(),this.suppressCursor=d}suppressTimeout(){return Math.max(300,(this.srtt??300)*1.5)}stillSuppressed(){return this.isSuppressed?this.now()-this.suppressSentAt>=this.suppressTimeout()?(this.isSuppressed=!1,this.suppressCursor=null,!1):!0:!1}handlePrintable(a,i,o){var w;if(this.stillSuppressed())return!1;const d=this.ensureField(o);if(!d||!this.predictedCursor)return!1;const f=this.predictedCursor,m=this.predictions.length===0&&f.col===d.caretCol;if(d.agentLike&&d.empty&&m&&Aw.includes(a))return this.freeze("agent mode switch"),!1;if(f.col+i>d.endCol-1)return this.freeze("cursor would reach the edge of the field"),!1;const p=(w=o.buffer.active.getLine(f.row))==null?void 0:w.getCell(f.col),g=[Ki(p?p.getChars():"")],v=this.predictions[this.predictions.length-1];let y;return v&&v.kind==="erase"&&v.row===f.row&&v.col===f.col&&(y=this.predictions.pop(),g.push(...v.before," ")),this.predictions.push({row:f.row,col:f.col,char:a,width:i,kind:"char",before:g,sentAt:this.now(),replaces:y}),f.col+=i,!0}handleBackspace(a){var o,d,f;const i=this.predictions[this.predictions.length-1];if(this.predictedCursor&&i&&!i.frozenFrom&&i.kind==="char"&&i.row===this.predictedCursor.row&&i.col+i.width===this.predictedCursor.col)return this.predictions.pop(),this.predictedCursor.col=i.col,i.replaces&&this.predictions.push(i.replaces),!0;if(!this.stillSuppressed()){const m=this.ensureField(a),p=this.predictedCursor;if(m&&p){const g=a.buffer.active.getLine(p.row),v=g==null?void 0:g.getCell(p.col-1),y=v&&((o=v.getWidth)==null?void 0:o.call(v))===0?2:1,w=p.col-y;let T=!0;for(let k=p.col;k<m.endCol&&T;k++)T=Ki(((d=g==null?void 0:g.getCell(k))==null?void 0:d.getChars())??"")===" ";const R=Ki(((f=g==null?void 0:g.getCell(w))==null?void 0:f.getChars())??"");if(w>m.startCol&&T&&R!==" ")return this.predictions.push({row:p.row,col:w,char:" ",width:y,kind:"erase",before:[R],sentAt:this.now()}),p.col=w,!0}}return this.freeze("backspace into server content"),!1}ensureField(a){if(this.predictedCursor&&this.field)return this.field;const i=this.getFieldOption?this.getFieldOption():kw(a);return i?(this.field=i,this.predictions=this.predictions.filter(o=>o.frozenFrom),this.predictedCursor={row:i.row,col:i.caretCol},i):null}markConfident(a){for(this.confidentKeys.delete(a),this.confidentKeys.add(a);this.confidentKeys.size>Nw;){const i=this.confidentKeys.values().next().value;if(i===void 0)break;this.confidentKeys.delete(i)}}mismatch(){this.mismatches++,this.predictions=[],this.predictedCursor=null,this.field&&this.confidentKeys.delete(this.field.key),this.isSuppressed=!1,this.suppressCursor=null}pruneExpired(){if(this.predictions.length===0)return;const a=this.now(),i=this.predictions.filter(o=>a-o.sentAt<=Ew);i.length!==this.predictions.length&&(this.predictions=i,this.predictions.length===0&&(this.predictedCursor=null))}updateSrtt(a){this.srtt===null?this.srtt=a:this.srtt=this.srtt*.8+a*.2}}const Mp="hr-predicting";function jw(r){if(typeof requestAnimationFrame=="function"){const i=requestAnimationFrame(r);return()=>cancelAnimationFrame(i)}const a=setTimeout(r,16);return()=>clearTimeout(a)}function Mw(r){var i,o,d,f;const a=(f=(d=(o=(i=r._core)==null?void 0:i._renderService)==null?void 0:o.dimensions)==null?void 0:d.css)==null?void 0:f.cell;return!(a!=null&&a.width)||!(a!=null&&a.height)?null:{width:a.width,height:a.height}}function _w(r){var i,o,d,f,m;const a=(o=(i=r==null?void 0:r._core)==null?void 0:i._themeService)==null?void 0:o.colors;return{foreground:(d=a==null?void 0:a.foreground)==null?void 0:d.css,background:(f=a==null?void 0:a.background)==null?void 0:f.css,cursor:(m=a==null?void 0:a.cursor)==null?void 0:m.css}}class Lw{constructor(a){de(this,"options");de(this,"layer",null);de(this,"owner",null);de(this,"cells",new Map);de(this,"caret",null);de(this,"retiring",new Set);de(this,"cancelRetireFrame",null);this.options=a}sync(a){var y,w;const i=this.options.getTerminal(),o=i?this.ensureLayer(i):null,d=i?Mw(i):null;if(!i||!o||!d){this.clear();return}const f=this.resolveStyle(),m=((w=(y=i.buffer)==null?void 0:y.active)==null?void 0:w.viewportY)??0,p=T=>T-m>=0&&T-m<i.rows,g=new Set;let v=null;for(const T of a){const R=T.kind??"char";if(!p(T.row))continue;if(R==="caret"){v=T;continue}const k=`${T.row}:${T.col}:${R}`;g.add(k);let Y=this.cells.get(k);Y||(Y=this.createCell(o),this.cells.set(k,Y)),this.retiring.delete(Y),this.place(Y,T,m,d,f),this.paintCell(Y,T.char,R,T.width??1,f)}for(const[T,R]of this.cells)g.has(T)||(this.cells.delete(T),this.retire(R));v?(this.caret||(this.caret=this.createCell(o)),this.retiring.delete(this.caret),this.place(this.caret,v,m,d,f),this.paintCaret(this.caret,v.char,f)):this.caret&&(this.retire(this.caret),this.caret=null),this.updateOwnerClass()}afterRender(){this.flushRetired()}clear(){for(const a of this.cells.values())this.retire(a);this.cells.clear(),this.caret&&(this.retire(this.caret),this.caret=null),this.updateOwnerClass()}dispose(){var a,i,o;(a=this.cancelRetireFrame)==null||a.call(this),this.cancelRetireFrame=null,this.cells.clear(),this.retiring.clear(),this.caret=null,(i=this.layer)==null||i.remove(),this.layer=null,(o=this.owner)==null||o.classList.remove(Mp),this.owner=null}ensureLayer(a){var f;const i=a.element??null,o=i==null?void 0:i.querySelector(".xterm-screen");if(!i||!o)return null;if(this.layer&&this.layer.parentElement===o)return this.layer;(f=this.layer)==null||f.remove();const d=document.createElement("div");return d.className="hr-prediction-layer",Object.assign(d.style,{position:"absolute",left:"0",top:"0",pointerEvents:"none",zIndex:"7"}),o.appendChild(d),this.layer=d,this.owner=i,d}createCell(a){const i=document.createElement("div");return Object.assign(i.style,{position:"absolute",overflow:"hidden",whiteSpace:"pre",pointerEvents:"none",userSelect:"none"}),a.appendChild(i),i}place(a,i,o,d,f){const m=i.width??1;a.style.left=`${i.col*d.width}px`,a.style.top=`${(i.row-o)*d.height}px`,a.style.width=`${m*d.width}px`,a.style.height=`${d.height}px`,a.style.lineHeight=`${d.height}px`,a.style.fontFamily=f.fontFamily??"inherit",a.style.fontSize=f.fontSize?`${f.fontSize}px`:"inherit",a.style.textAlign=m===2?"center":"left"}paintCell(a,i,o,d,f){a.textContent=o==="erase"?" ":i,a.style.color=f.color??"",a.style.backgroundColor=f.background??"",a.style.boxShadow="none",a.style.textDecoration=o==="char"&&f.underline?"underline":"none"}paintCaret(a,i,o){const d=o.cursor??o.color;if(a.textContent=i,a.style.textDecoration="none",a.style.boxShadow="none",a.style.color=o.color??"",a.style.backgroundColor="transparent",!!d)switch(o.cursorShape??"block"){case"bar":a.style.boxShadow=`inset 2px 0 0 ${d}`;break;case"underline":a.style.boxShadow=`inset 0 -2px 0 ${d}`;break;default:a.style.backgroundColor=d,o.background&&(a.style.color=o.background)}}resolveStyle(){const a=this.options.getStyle();if(a.color&&a.background&&a.cursor)return a;const i=_w(this.options.getTerminal()),o=a.color??i.foreground;return{...a,color:o,background:a.background??i.background,cursor:a.cursor??i.cursor??o}}retire(a){this.retiring.add(a),this.cancelRetireFrame||(this.cancelRetireFrame=jw(()=>{this.cancelRetireFrame=null,this.flushRetired()}))}flushRetired(){var a;for(const i of this.retiring)i.remove();this.retiring.clear(),(a=this.cancelRetireFrame)==null||a.call(this),this.cancelRetireFrame=null,this.updateOwnerClass()}updateOwnerClass(){if(!this.owner)return;const a=this.cells.size>0||this.caret!==null||this.retiring.size>0;this.owner.classList.toggle(Mp,a)}}const vo=new Set(["│","┃","║","▐","▕","▏","▌"]),Eo=new Set(["┌","┐","└","┘","╭","╮","╰","╯","├","┤","┬","┴","┼","┏","┓","┗","┛","╔","╗","╚","╝","╠","╣","╟","╢","╞","╡"]),zw=new Set(["╭","┌","┏","╔"]),Dw=new Set(["╮","┐","┓","╗"]),Ow=new Set(["╰","└","┗","╚"]),Uw=new Set(["╯","┘","┛","╝"]),Fu=new Set(["─","━","═","╌","┄"]),Bw=new Set(["❯","›",">","!"]),_p=new Set(["$","#","%",">","❯","›","➜","λ","»"]),ed=8,Hw=12,Lp=2,zp=1,Kw=4,Yw=3,Gw=/-- INSERT --/,qw=/-- (?:NORMAL|VISUAL(?: LINE| BLOCK)?|REPLACE) --/,Vw=/Esc to cancel|Enter to (?:confirm|select)|to navigate|Space to (?:change|toggle|select)/i,Fw=/^\s*\d+[.)]\s/;function Vi(r){return r===""||r===" "||r===" "}class Xw{constructor(a){de(this,"cell");de(this,"top");de(this,"bottom");var i;this.screen=a,this.cell=(i=a.getNullCell)==null?void 0:i.call(a),this.top=a.baseY,this.bottom=a.baseY+a.rows-1}get cols(){return this.screen.cols}at(a,i){var o;if(!(a<this.top||a>this.bottom||i<0||i>=this.screen.cols))return(o=this.screen.getLine(a))==null?void 0:o.getCell(i,this.cell)}char(a,i){var o;return((o=this.at(a,i))==null?void 0:o.getChars())??""}dim(a,i){var o,d;return!!((d=(o=this.at(a,i))==null?void 0:o.isDim)!=null&&d.call(o))}text(a,i,o){var d;return a<this.top||a>this.bottom?"":((d=this.screen.getLine(a))==null?void 0:d.translateToString(!0,i,o))??""}isEdge(a,i){if(!vo.has(this.char(a,i)))return!1;const o=this.char(a-1,i),d=this.char(a+1,i);return vo.has(o)||Eo.has(o)||vo.has(d)||Eo.has(d)}blankOrDim(a,i,o){var d;for(let f=i;f<o;f++){const m=this.at(a,f);if(m&&!Vi(m.getChars())&&!((d=m.isDim)!=null&&d.call(m)))return!1}return!0}}function Iw(r,a,i){if(r.isEdge(a,i))return null;let o=0;for(let f=i-1;f>=0;f--)if(r.isEdge(a,f)){o=f+1;break}let d=r.cols;for(let f=i+1;f<r.cols;f++)if(r.isEdge(a,f)){d=f;break}return o<d?{start:o,end:d}:null}function Dp(r,a,i){if(!Fu.has(r.char(a,i.start))||!Fu.has(r.char(a,i.end-1))||Eo.has(r.char(a,i.start-1)))return!1;const o=i.end-i.start;let d=0;for(let f=i.start;f<i.end;f++)if(Fu.has(r.char(a,f)))d++;else if(f-i.start-d>o*.1)return!1;return d>=o*.9}function Ii(r){return`${r.start}-${r.end}`}function Zw(r,a,i){const o=i.start-1,d=i.end,{row:f}=a;if(o<0||d>=r.cols)return null;const m=r.char(f,o);if(!vo.has(m)||r.char(f,d)!==m)return null;let p=f-1;for(;p>=r.top&&r.char(p,o)===m;)p--;let g=f+1;for(;g<=r.bottom&&r.char(g,o)===m;)g++;if(g-p-1>ed||!zw.has(r.char(p,o))||!Dw.has(r.char(p,d))||!Ow.has(r.char(g,o))||!Uw.has(r.char(g,d))||r.dim(f,o))return null;const v=i.start+zp,y=i.end-zp;return a.col<v||a.col>=y?null:{kind:"frame",key:`frame:${Ii(i)}:${g}`,region:Ii(i),layout:`${p}`,row:f,caretCol:a.col,startCol:v,endCol:y,empty:p+2===g&&a.col===v&&r.blankOrDim(f,v,y),agentLike:!0,vimInsert:null}}function Qw(r,a,i){const{row:o}=a;let d=-1;for(let y=o-1;y>=Math.max(r.top,o-ed);y--)if(Dp(r,y,i)){d=y;break}if(d<0)return null;let f=-1;for(let y=o+1;y<=Math.min(r.bottom,o+ed);y++)if(Dp(r,y,i)){f=y;break}if(f<0)return null;const m=d+1;let p=-1;for(let y=i.start;y<Math.min(i.end,i.start+3);y++){const w=r.char(m,y);if(!Vi(w)){Bw.has(w)&&Vi(r.char(m,y+1))&&(p=y);break}}if(p<0||r.dim(m,p)||Fw.test(r.text(m,p+1,i.end)))return null;for(let y=m+1;y<f;y++)for(let w=i.start;w<i.start+Lp;w++)if(!Vi(r.char(y,w)))return null;let g="";for(let y=f+1;y<=Math.min(r.bottom,f+Hw)&&!Eo.has(r.char(y,i.start-1));y++)g+=`${r.text(y,i.start,i.end)}
36
+ `;if(Vw.test(g)||qw.test(g))return null;const v=o===m?p+2:i.start+Lp;return a.col<v||a.col>=i.end?null:{kind:"rule",key:`rule:${Ii(i)}:${f}`,region:Ii(i),layout:`${d}`,row:o,caretCol:a.col,startCol:v,endCol:i.end,empty:f-d===2&&a.col===v&&r.blankOrDim(o,v,i.end),agentLike:!0,vimInsert:Gw.test(g)}}function Pw(r,a,i){if(a.hidden)return null;const{row:o,col:d}=a;for(let f=d-2;f>=i.start;f--)if(!(!_p.has(r.char(o,f))||!Vi(r.char(o,f+1))))return r.dim(o,f)?null:Op(r,a,i,o,f+2,f===i.start);for(let f=o-1;f>=Math.max(r.top,o-Yw);f--){let m=i.end-1;for(;m>=i.start&&Vi(r.char(f,m));)m--;if(m>=i.end-1-Kw&&_p.has(r.char(f,m)))return r.dim(f,m)?null:Op(r,a,i,f,i.start,!1);if(m<i.end-1)return null}return null}function Op(r,a,i,o,d,f){const m=a.row===o?d:i.start;return a.col<m||a.col>=i.end?null:{kind:"prompt",key:`prompt:${Ii(i)}:${o}`,region:Ii(i),layout:`${o}`,row:a.row,caretCol:a.col,startCol:m,endCol:i.end,empty:a.row===o&&a.col===m&&r.blankOrDim(a.row,m,i.end),agentLike:f,vimInsert:null}}function Ww(r,a){const i=new Xw(r);if(a.row<i.top||a.row>i.bottom||a.col<0||a.col>=r.cols)return null;const o=Iw(i,a.row,a.col);return o?Zw(i,a,o)??Qw(i,a,o)??Pw(i,a,o):null}class Jw{constructor(){de(this,"insertSeen",new Set)}detect(a,i){const o=Ww(a,i);return!o||o.vimInsert===null?o:o.vimInsert?(this.insertSeen.add(o.region),o):this.insertSeen.has(o.region)?null:o}reset(){this.insertSeen.clear()}}class $w{constructor(a){de(this,"tracker",new Jw);de(this,"cached");de(this,"lastComplete",null);de(this,"detect",()=>{var a,i;if((i=(a=this.options).isSynchronizing)!=null&&i.call(a))return this.lastComplete;if(this.cached===void 0){const o=this.options.getScreen(),d=this.options.getCursor();this.cached=o&&d?this.tracker.detect(o,d):null,this.lastComplete=this.cached}return this.cached});this.options=a}invalidate(){this.cached=void 0}reset(){this.tracker.reset(),this.cached=void 0,this.lastComplete=null}}const eS=25,tS=2026,nS=1e3;function lS(r,a=()=>performance.now()){let i=!1,o=null;const d=()=>{i=!1,o=null},f=r.parser;if(!f||typeof f.registerCsiHandler!="function")return{isCursorHidden:()=>!1,isSynchronizing:()=>!1,reset:d,dispose:()=>{}};const m=g=>v=>{for(const y of v.flat())y===eS&&(i=!g),y===tS&&(o=g?a():null);return!1},p=[f.registerCsiHandler({prefix:"?",final:"h"},m(!0)),f.registerCsiHandler({prefix:"?",final:"l"},m(!1)),f.registerCsiHandler({intermediates:"!",final:"p"},()=>(d(),!1))];return typeof f.registerEscHandler=="function"&&p.push(f.registerEscHandler({final:"c"},()=>(d(),!1))),{isCursorHidden:()=>i,isSynchronizing:()=>o!==null&&a()-o<nS,reset:d,dispose:()=>{for(const g of p)g.dispose()}}}const Ig=40;function aS(r){return r?`${r.kind} row ${r.row} cols ${r.startCol}-${r.endCol} caret ${r.caretCol}`:"none"}function Up(r,a){return r==="off"?!1:r==="always"?!0:a!==null&&a>Ig}const iS=250,rS=({onTerminalFocus:r,isActive:a=!0})=>{var wn,Tt,Sn,za,yl,Ml;const i=x.useRef(null),o=x.useRef(null),d=x.useRef(null),f=x.useRef(null),m=x.useRef(1),p=x.useRef({cols:0,rows:0}),g=x.useRef(null),v=x.useRef(null),y=x.useRef(null),w=x.useRef(null),T=x.useRef({width:0,height:0}),R=x.useRef(null),k=jv(),Y=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",[I,P]=x.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}),[V,oe]=x.useState({framesPerSec:0,bytesPerSec:0}),[ve,ne]=x.useState(null),X=x.useRef(null),U=x.useRef(!1),te=x.useRef(!1),ae=x.useRef([]);x.useEffect(()=>{if(!z)return;const Q=setInterval(()=>{const Se=performance.now()-1e3,ye=ae.current;for(;ye.length>0&&ye[0].time<Se;)ye.shift();let qe=0;for(let ie=0;ie<ye.length;ie++)qe+=ye[ie].bytes;oe({framesPerSec:ye.length,bytesPerSec:qe})},1e3);return()=>clearInterval(Q)},[z]);const{isController:ge,connectionState:Te,settings:Oe,hostPalette:st,terminalResetVersion:Xe,sendResize:E,sendBinary:B,observeKeyInput:ee,consumeModifierLatch:ze,agentStatus:Z,addToast:Pe,warnViewerMode:je,connect:ue,subscribeToOutput:Ge,subscribeToPasteFileReady:Me,uploadImage:G,profiles:Ue,activeProfileId:lt,t:we,rttMs:He}=Mt(),gt=fl.useMemo(()=>Zv(st),[st]),Ke=x.useRef(gt);Ke.current=gt;const We=x.useRef(ge);We.current=ge;const at=x.useRef(B);at.current=B;const wt=x.useRef(Pe);wt.current=Pe;const _t=x.useRef(je);_t.current=je;const j=x.useRef(E);j.current=E;const be=x.useRef(G);be.current=G;const pe=x.useRef(a);pe.current=a;const Je=x.useRef(Oe);Je.current=Oe;const bt=x.useRef(we);bt.current=we;const ft=x.useRef(null),St=x.useRef(null),le=x.useRef(null),ke=x.useRef(ze);ke.current=ze;const De=x.useRef(()=>{}),ot=x.useRef(Q=>{var J,Se,ye,qe;(J=ft.current)==null||J.reset(Q),(Se=ft.current)==null||Se.forgetConfidence(),(ye=le.current)==null||ye.reset(),(qe=St.current)==null||qe.clear()}),[Yt,$n]=x.useState(null),Qe=x.useRef(null),[hl,fn]=x.useState(null),Lt=x.useRef(null);Lt.current=hl;const[Ct,Ft]=x.useState(null),it=x.useRef(null);it.current=Ct;const[ai,Mn]=x.useState(""),el=x.useRef("");el.current=ai;const[kl,an]=x.useState(!1),ml=x.useRef(!1);ml.current=kl;const vn=x.useRef(!1),[Rl,pl]=x.useState(0),tl=x.useRef(null),_n=x.useRef(null),qn=x.useRef(null),Ln=x.useRef(null),[Zi,La]=x.useState(!1),Jl=x.useCallback(Q=>{var qe;const J=f.current;if(!J)return null;const Se=((qe=d.current)==null?void 0:qe.querySelector(".xterm-screen"))||d.current,ye=Bu(Q,J,Se,m.current);return ye?yw(J,ye.col,ye.bufferRow):null},[]),nl=x.useCallback(Q=>{var qe;const J=f.current;if(!J)return;const Se=((qe=d.current)==null?void 0:qe.querySelector(".xterm-screen"))||d.current,ye=Bu(Q,J,Se,m.current);if(ye){qn.current=ye;const ie=Ku(J,ye.col,ye.bufferRow);Ln.current=ie;const zt=nw(J,ye.col,ye.bufferRow);if(zt){const ht={startCol:zt.startCol,endCol:zt.startCol+zt.length-1,startRow:ye.bufferRow,endRow:ye.bufferRow},Wt=kp(ht,ie),Dt=Yu(J,Wt);Ft(Wt),Mn(Dt),an(!0)}else Ft(null),Mn(""),an(!1),qn.current=null,Ln.current=null}else Ft(null),Mn(""),an(!1),qn.current=null,Ln.current=null;tl.current=Q,_n.current=null},[]),$l=x.useCallback(Q=>{var Dt;const J=f.current,Se=qn.current;if(!J||!Se)return;_n.current=Q;const ye=((Dt=d.current)==null?void 0:Dt.querySelector(".xterm-screen"))||d.current,qe=Bu(Q,J,ye,m.current);if(!qe)return;const ie=Ln.current??Ku(J,Se.col,Se.bufferRow),zt={startCol:Math.min(Se.col,qe.col),endCol:Math.max(Se.col,qe.col),startRow:Math.min(Se.bufferRow,qe.bufferRow),endRow:Math.max(Se.bufferRow,qe.bufferRow)},ht=kp(zt,ie),Wt=Yu(J,ht);Ft(ht),Mn(Wt),an(!0)},[]),gl=x.useRef(nl);gl.current=nl;const jl=x.useRef($l);jl.current=$l;const ii=x.useCallback(async()=>{const Q=el.current;if(!Q)return;await ni(Q)==="failed"?wt.current("error",bt.current("clipboard.copyFailed")):wt.current("success",bt.current("clipboard.copied"))},[]),xn=x.useCallback(async()=>{var ht,Wt,Dt,zn;const Q=f.current;if(!Q)return;const J=(ht=Q.buffer)==null?void 0:ht.active;if(!J)return;const Se=((Wt=it.current)==null?void 0:Wt.startRow)??((Dt=qn.current)==null?void 0:Dt.bufferRow)??J.viewportY,ye=Ln.current??Ku(Q,((zn=qn.current)==null?void 0:zn.col)??0,Se),qe={startCol:ye.startCol,endCol:ye.endCol,startRow:Se,endRow:Se},ie=Yu(Q,qe);await ni(ie)==="failed"?wt.current("error",bt.current("clipboard.copyFailed")):wt.current("success",bt.current("clipboard.copied"))},[]),Gt=x.useCallback(async()=>{const Q=f.current;if(!Q)return;const J=lw(Q);await ni(J)==="failed"?wt.current("error",bt.current("clipboard.copyFailed")):wt.current("success",bt.current("clipboard.copied"))},[]),en=x.useCallback(async()=>{var J,Se;const Q=f.current;if(Q){if(!We.current){_t.current();return}try{const ye=await ow();if(ye.ok){await be.current(ye.blob);return}}catch{}try{const ye=await sw();if(ye.ok){(J=ft.current)==null||J.reset("paste"),(Se=St.current)==null||Se.clear(),Q.paste(ye.text),wt.current("success",bt.current("clipboard.pasted"));return}else if(ye.reason==="empty"){wt.current("info",bt.current("clipboard.pasteUnavailable"));return}}catch{}La(!0)}},[]),bl=x.useCallback(Q=>{var Se,ye;const J=f.current;if(J){if(!We.current){_t.current();return}(Se=ft.current)==null||Se.reset("paste"),(ye=St.current)==null||ye.clear(),J.paste(Q),wt.current("success",bt.current("clipboard.pasted"))}},[]),D=x.useCallback(Q=>{if(f.current){if(!We.current){_t.current();return}be.current(Q)}},[]);x.useEffect(()=>Me(J=>{var ye,qe;const Se=f.current;Se&&((ye=ft.current)==null||ye.reset("paste"),(qe=St.current)==null||qe.clear(),Se.paste(J),wt.current("success",bt.current("clipboard.pasted")))}),[Me]);const K=x.useCallback((Q,J)=>{!Number.isFinite(Q)||!Number.isFinite(J)||Q<=0||J<=0||Q===p.current.cols&&J===p.current.rows||(g.current={cols:Q,rows:J},!v.current&&(v.current=setTimeout(()=>{v.current=null;const Se=g.current;g.current=null,Se&&(Se.cols===p.current.cols&&Se.rows===p.current.rows||(p.current=Se,j.current(Se.cols,Se.rows),ot.current("resize")))},iS)))},[]),ce=x.useCallback((Q=!1)=>{var vl;const J=f.current,Se=i.current,ye=d.current,qe=o.current;if(!J||!Se||!ye||!qe)return;const ie=Uu(Se,Gi(),Lu());if(ie.width<=0||ie.height<=0)return;qe.style.width="100%",qe.style.height="100%",ye.style.width="100%",ye.style.height="100%",ye.style.transform="none",ye.style.transformOrigin="top left",m.current=1;const zt=Np(ie),ht=$0({lastSnapshot:R.current,currentSnapshot:zt});if(ht.isVisualZoom&&!Q){R.current=zt;try{J.refresh(0,Math.max(0,J.rows-1))}catch{}return}if(ht.shouldIgnore&&!Q)return;R.current=zt;const Wt=ti(J,Xi),Dt=Cp({width:ie.width-G0(ye),height:ie.height,cellWidth:Wt.cellWidth,cellHeight:Wt.cellHeight}),zn=Math.abs(ie.width-T.current.width)>1||Math.abs(ie.height-T.current.height)>1;if(J.cols!==Dt.cols||J.rows!==Dt.rows)try{J.resize(Dt.cols,Dt.rows)}catch(ea){console.debug("Error resizing terminal grid:",ea)}U.current&&!te.current&&(zn||J.cols!==Dt.cols||J.rows!==Dt.rows)&&(te.current=!0,(vl=X.current)==null||vl.verify());const ll=Dt.cols!==p.current.cols||Dt.rows!==p.current.rows;pe.current&&(zn||Q||ll)&&(T.current={width:ie.width,height:ie.height},K(Dt.cols,Dt.rows));try{J.refresh(0,Math.max(0,J.rows-1))}catch{}},[K]),Ae=x.useRef(ce);Ae.current=ce;const Ne=x.useCallback(()=>{if(y.current===null){if(typeof requestAnimationFrame!="function"){Ae.current();return}y.current=requestAnimationFrame(()=>{y.current=null,Ae.current()})}},[]),_e=x.useCallback((Q=30)=>{w.current!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(w.current),w.current=null);let J=0;const Se=()=>{w.current=null,J++;const ye=J>=Q;Ae.current(!0),!ye&&J<2&&typeof requestAnimationFrame=="function"&&(w.current=requestAnimationFrame(Se))};typeof requestAnimationFrame=="function"?w.current=requestAnimationFrame(Se):Se()},[]);x.useEffect(()=>{var Ll,zl;if(!i.current||!d.current)return;const Q=i.current,J=Uu(Q,Gi(),Lu()),Se=ti(null,Xi),ye=Cp({width:J.width,height:J.height,cellWidth:Se.cellWidth,cellHeight:Se.cellHeight});j.current(ye.cols,ye.rows),T.current={width:J.width,height:J.height},R.current=Np(J);const qe=$m(Oe.fontSize,J.width),ie=new R0.Terminal({fontSize:qe,fontFamily:sp(Oe.fontFamily),lineHeight:1.15,...Ke.current?{theme:{...Ke.current}}:{},allowProposedApi:!0,convertEol:!0,scrollback:5e3,cols:ye.cols,rows:ye.rows,screenReaderMode:!1,linkHandler:{activate:(W,se)=>{Vu(se)}}});try{const W=new j0.Unicode11Addon;ie.loadAddon(W),ie.unicode.activeVersion="11"}catch(W){console.debug("Unicode11 addon unavailable, using default width table:",W)}try{ie.loadAddon(new _0.WebLinksAddon((W,se)=>{Vu(se)}))}catch(W){console.debug("WebLinks addon unavailable, URLs stay plain text:",W)}ie.open(d.current),f.current=ie;const zt=ie.onTitleChange(W=>{$n($u(W)||null)}),ht=lS(ie),Wt=new $w({getScreen:()=>{const W=f.current;if(!W)return null;const se=W.buffer.active;return{cols:W.cols,rows:W.rows,baseY:se.baseY,getLine:Be=>se.getLine(Be),getNullCell:typeof se.getNullCell=="function"?()=>se.getNullCell():void 0}},getCursor:()=>{var se;const W=(se=f.current)==null?void 0:se.buffer.active;return W?{row:W.baseY+W.cursorY,col:W.cursorX,hidden:ht.isCursorHidden()}:null},isSynchronizing:ht.isSynchronizing});le.current=Wt;const Dt=new Rw({getTerminal:()=>f.current,getField:Wt.detect});ft.current=Dt;const zn=new Lw({getTerminal:()=>f.current,getStyle:()=>{var Nt,nn,Dn,mn,pn,ia,rn,xl,Oa,ra,is,ri,si;const W=((Nt=Ke.current)==null?void 0:Nt.foreground)??((Dn=(nn=f.current)==null?void 0:nn.options.theme)==null?void 0:Dn.foreground),se=((mn=Ke.current)==null?void 0:mn.background)??((ia=(pn=f.current)==null?void 0:pn.options.theme)==null?void 0:ia.background),Be=((rn=ft.current)==null?void 0:rn.getEchoSrttMs())??null,At=Be!==null&&Be>Ig,Ot=((xl=Ke.current)==null?void 0:xl.cursor)??((ra=(Oa=f.current)==null?void 0:Oa.options.theme)==null?void 0:ra.cursor)??W,hn=(is=f.current)==null?void 0:is.options.cursorStyle,Ce=(ri=f.current)==null?void 0:ri.options.fontFamily,Ut=(si=f.current)==null?void 0:si.options.fontSize;return{color:W,background:se,underline:At,cursor:Ot,cursorShape:hn,fontFamily:Ce,fontSize:Ut}}});St.current=zn;const ll=()=>{const W=ft.current,se=St.current;if(!W||!se)return;const Be=Je.current.predictiveEcho,At=W.getEchoSrttMs();if(!Up(Be,At)){se.clear();return}se.sync(W.getOverlayItems())};De.current=ll,k&&ie.textarea&&(ie.textarea.readOnly=!1,ie.textarea.tabIndex=0,ie.textarea.inputMode="text");let vl=()=>{};if(z&&ie.textarea){const W=()=>{P(se=>({...se,focused:document.activeElement===ie.textarea}))};ie.textarea.addEventListener("focus",W),ie.textarea.addEventListener("blur",W),vl=()=>{var se,Be;(se=ie.textarea)==null||se.removeEventListener("focus",W),(Be=ie.textarea)==null||Be.removeEventListener("blur",W)},W()}const ea=async W=>{var Be,At;(Be=ft.current)==null||Be.reset("paste"),(At=St.current)==null||At.clear();const se=Fg(W);if(se){if(W.preventDefault(),W.stopPropagation(),!We.current){_t.current();return}await be.current(se)}};(Ll=ie.textarea)==null||Ll.addEventListener("paste",ea),Q.addEventListener("paste",ea);const tn=J0(ie,{onRendererSwapped:W=>{Q&&(Q.dataset.renderer=W),ne(W);try{ie.refresh(0,Math.max(0,ie.rows-1))}catch{}}});X.current=tn,Q&&(Q.dataset.renderer=tn.kind),ne(tn.kind);const Qi=bt.current("terminal.bannerTitle"),$r=bt.current("terminal.bannerSubtitle");if(ie.writeln(" ___ ___ .___ "),ie.writeln(` / | \\ ____ _______| _/______ \x1B[1m${Qi}\x1B[0m`),ie.writeln(`/ ~ \\/ __ \\\\_ __ \\ __/ ___/ \x1B[2m${$r}\x1B[0m`),ie.writeln("\\ Y / ___/ | | \\/|_ \\___ \\ "),ie.writeln(" \\___|_ / \\___ >|__| /___/____ >"),ie.writeln(" \\/ \\/ \\/ "),ie.writeln(""),U.current=!0,tn.verify(),!k)try{ie.focus()}catch{}typeof document<"u"&&"fonts"in document&&typeof((zl=document.fonts)==null?void 0:zl.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{}_e(5)}}).catch(()=>{});const Pi=ie.onData(W=>{var At;let se=W;if(We.current&&Kg(W)==="keys"&&pv(W)){const Ot=ke.current();Ot&&(se=xo(W,Ot))}const Be=td(se);if(!We.current&&!wo(Be)){_t.current();return}(At=ft.current)==null||At.handleUserInput(Be),ll(),at.current(Be)}),ta=ie.onBinary(W=>{const se=new Uint8Array(W.length);for(let Be=0;Be<W.length;Be++)se[Be]=W.charCodeAt(Be)&255;!We.current&&!wo(se)||at.current(se)}),es=typeof ie.onWriteParsed=="function"?ie.onWriteParsed(()=>{var W;vn.current=!0,Wt.invalidate(),!ht.isSynchronizing()&&((W=ft.current)==null||W.onServerOutput(),ll())}):{dispose:()=>{}},ts=typeof ie.onRender=="function"?ie.onRender(W=>{var At;(At=St.current)==null||At.afterRender();const se=ie.buffer.active.viewportY??0;pl(se);const Be=it.current;if(Be&&ml.current){const Ot=Be.startRow-se,hn=Be.endRow-se;vn.current&&W.start<=hn&&W.end>=Ot&&(an(!1),vn.current=!1)}else vn.current=!1}):{dispose:()=>{}},na=typeof ie.onScroll=="function"?ie.onScroll(()=>{var se,Be;const W=ie.buffer.active.viewportY??0;pl(W),(se=ft.current)==null||se.reset("scroll"),(Be=St.current)==null||Be.clear()}):{dispose:()=>{}},Cn=new V0({getTerminal:()=>f.current,getIsController:()=>We.current,getScale:()=>m.current,getSurfaceElement:()=>d.current,allowSyntheticMouseFallback:!1,onFocus:()=>{try{ie.focus()}catch{}z&&P(W=>({...W,focused:document.activeElement===ie.textarea})),r==null||r()},onGestureStateChange:W=>{z&&P(se=>({...se,state:W}))},onGestureScroll:({deltaY:W,lines:se,viewportY:Be,scrollTop:At,scrollHeight:Ot,clientHeight:hn,moved:Ce,bufferType:Ut,baseY:Nt,cursorY:nn,hasScrollback:Dn,mouseTracking:mn,scrollMode:pn})=>{z&&P(ia=>({...ia,deltaY:W,lines:se,viewportY:Be,scrollTop:At,scrollHeight:Ot,clientHeight:hn,moved:Ce,focused:document.activeElement===ie.textarea,bufferType:Ut,baseY:Nt,cursorY:nn,hasScrollback:Dn,mouseTracking:mn,scrollMode:pn,scrollCalls:ia.scrollCalls+(se!==0?1:0),lastScrollLines:se}))},longPressDelayMs:500,dragThresholdPx:8,scrollLineHeightPx:18,onLongPress:k?(W=>{var se;return(se=gl.current)==null?void 0:se.call(gl,W)}):void 0,onSelectionExtend:k?(W=>{var se;return(se=jl.current)==null?void 0:se.call(jl,W)}):void 0}),ns=typeof window<"u"&&"PointerEvent"in window,ls=typeof TouchEvent<"u",_l=[],al=(W,se=!1)=>{const Be=W.target;return Be instanceof Node&&Q.contains(Be)||se&&Cn.getState()!=="idle"};if(ns){const W={passive:!1,capture:!0},se=Ce=>{z&&P(Ut=>({...Ut,pointerEvents:Ut.pointerEvents+1,lastInputEvent:Ce}))},Be=Ce=>{if(!al(Ce))return;if(se("pointerdown"),Lt.current){fn(null),Lt.current=null,Ft(null),it.current=null,Mn(""),el.current="",an(!1),tl.current=null,_n.current=null,Ce.cancelable&&Ce.preventDefault(),Ce.stopPropagation();return}Cn.handlePointerDown(Ce,Q)&&Ce.stopPropagation()},At=Ce=>{al(Ce,!0)&&(se("pointermove"),Cn.handlePointerMove(Ce),Ce.pointerType!=="mouse"&&Ce.stopPropagation())},Ot=Ce=>{if(!al(Ce,!0))return;if(se("pointerup"),Cn.getState()==="longpress"&&Qe.current){const Nt=_n.current??tl.current;if(Nt){const nn=Qe.current.getBoundingClientRect(),Dn=Nt.clientX-nn.left,mn=Nt.clientY-nn.top,pn=Jl(Nt);fn({x:Dn,y:mn,link:pn}),Lt.current={x:Dn,y:mn,link:pn}}}Cn.handlePointerUp(Ce),Ce.pointerType!=="mouse"&&Ce.stopPropagation()},hn=Ce=>{al(Ce,!0)&&(se("pointercancel"),fn(null),Lt.current=null,Ft(null),it.current=null,Mn(""),el.current="",an(!1),tl.current=null,_n.current=null,Cn.handlePointerCancel(Ce),Ce.pointerType!=="mouse"&&Ce.stopPropagation())};if(document.addEventListener("pointerdown",Be,W),document.addEventListener("pointermove",At,W),document.addEventListener("pointerup",Ot,W),document.addEventListener("pointercancel",hn,W),_l.push(()=>{document.removeEventListener("pointerdown",Be,W),document.removeEventListener("pointermove",At,W),document.removeEventListener("pointerup",Ot,W),document.removeEventListener("pointercancel",hn,W)}),ls){const Ce=Nt=>{al(Nt,!0)&&(z&&P(nn=>({...nn,touchEvents:nn.touchEvents+1})),Nt.cancelable&&Nt.preventDefault(),Nt.stopPropagation())},Ut=["touchstart","touchmove","touchend","touchcancel"];for(const Nt of Ut)document.addEventListener(Nt,Ce,W);_l.push(()=>{for(const Nt of Ut)document.removeEventListener(Nt,Ce,W)})}}else{const W={passive:!1,capture:!0},se=Ce=>{z&&P(Ut=>({...Ut,touchEvents:Ut.touchEvents+1,lastInputEvent:Ce}))},Be=Ce=>{if(al(Ce)){if(se("touchstart"),Lt.current){fn(null),Lt.current=null,Ft(null),it.current=null,Mn(""),el.current="",an(!1),tl.current=null,_n.current=null,Ce.cancelable&&Ce.preventDefault(),Ce.stopPropagation();return}Ce.touches.length===1&&Ce.stopPropagation(),Cn.handleTouchStart(Ce,Q)}},At=Ce=>{al(Ce,!0)&&(se("touchmove"),Ce.touches.length===1&&Ce.stopPropagation(),Cn.handleTouchMove(Ce))},Ot=Ce=>{if(!al(Ce,!0))return;if(se("touchend"),Cn.getState()==="longpress"&&Qe.current){const Nt=_n.current??tl.current;if(Nt){const nn=Qe.current.getBoundingClientRect(),Dn=Nt.clientX-nn.left,mn=Nt.clientY-nn.top,pn=Jl(Nt);fn({x:Dn,y:mn,link:pn}),Lt.current={x:Dn,y:mn,link:pn}}}Ce.stopPropagation(),Cn.handleTouchEnd(Ce)},hn=Ce=>{al(Ce,!0)&&(se("touchcancel"),fn(null),Lt.current=null,Ft(null),it.current=null,Mn(""),el.current="",an(!1),tl.current=null,_n.current=null,Ce.stopPropagation(),Cn.handleTouchCancel())};document.addEventListener("touchstart",Be,W),document.addEventListener("touchmove",At,W),document.addEventListener("touchend",Ot,W),document.addEventListener("touchcancel",hn,W),_l.push(()=>{document.removeEventListener("touchstart",Be,W),document.removeEventListener("touchmove",At,W),document.removeEventListener("touchend",Ot,W),document.removeEventListener("touchcancel",hn,W)})}const as=W=>{W.preventDefault()};Q.addEventListener("contextmenu",as),_l.push(()=>{Q.removeEventListener("contextmenu",as)});const Da=new ResizeObserver(()=>{Ne()});Da.observe(Q);const Tn=()=>{Ne()},la=()=>{var W,se;if(document.visibilityState==="visible"){_e(10);try{(se=f.current)==null||se.refresh(0,Math.max(0,(((W=f.current)==null?void 0:W.rows)||1)-1))}catch{}}};window.addEventListener("resize",Tn),window.addEventListener("orientationchange",Tn),document.addEventListener("visibilitychange",la),window.addEventListener("pageshow",la);const aa=()=>{Ne()};return typeof window<"u"&&window.visualViewport&&(window.visualViewport.addEventListener("resize",aa),window.visualViewport.addEventListener("scroll",aa)),()=>{var W,se;Pi.dispose(),ta.dispose(),ts.dispose(),na.dispose(),es.dispose(),zt.dispose(),(W=St.current)==null||W.dispose(),St.current=null,ft.current=null,le.current=null,De.current=()=>{},ht.dispose(),Cn.handlePointerCancel();for(const Be of _l)Be();Da.disconnect(),window.removeEventListener("resize",Tn),window.removeEventListener("orientationchange",Tn),document.removeEventListener("visibilitychange",la),window.removeEventListener("pageshow",la),typeof window<"u"&&window.visualViewport&&(window.visualViewport.removeEventListener("resize",aa),window.visualViewport.removeEventListener("scroll",aa)),v.current&&(clearTimeout(v.current),v.current=null),y.current!==null&&(cancelAnimationFrame(y.current),y.current=null),w.current!==null&&(cancelAnimationFrame(w.current),w.current=null),vl(),(se=ie.textarea)==null||se.removeEventListener("paste",ea),Q.removeEventListener("paste",ea),tn.dispose(),X.current=null,ie.dispose(),f.current=null}},[]);const Ie=fl.useMemo(()=>{var Q;return((Q=Ue.find(J=>J.id===lt))==null?void 0:Q.displayName)??null},[Ue,lt]);x.useEffect(()=>{Te!=="connected"&&$n(null)},[Te]),x.useEffect(()=>{const Q=a&&Te==="connected",J=Oe.agentAlertBadge?Wr(Z):null;fw(Q?Yt:null,Ie,J)},[a,Te,Yt,Ie,Z,Oe.agentAlertBadge]),x.useEffect(()=>{const Q=f.current;if(!Q)return;const J=Uu(i.current,Gi(),Lu());Q.options.fontSize=$m(Oe.fontSize,J.width),Q.options.fontFamily=sp(Oe.fontFamily);try{Q.refresh(0,Math.max(0,Q.rows-1))}catch{}_e(10)},[Oe.fontSize,Oe.fontFamily]),x.useEffect(()=>ee(Q=>{var J;(J=ft.current)==null||J.handleUserInput(Q),De.current()}),[ee]),x.useEffect(()=>{const Q=ft.current,J=St.current;if(!Q||!J)return;const Se=Q.getEchoSrttMs();Up(Oe.predictiveEcho,Se)?J.sync(Q.getOverlayItems()):J.clear()},[Oe.predictiveEcho]);const Xt=x.useRef(Xe);x.useEffect(()=>{var J;if(Xt.current===Xe)return;Xt.current=Xe,ot.current("resetVersion");const Q=f.current;if(Q)try{(J=Q.reset)==null||J.call(Q),Q.clear(),Q.refresh(0,Math.max(0,Q.rows-1))}catch{}},[Xe]),x.useEffect(()=>{ot.current("connectionState")},[Te]),x.useEffect(()=>{const Q=f.current;if(!(!Q||!gt)){Q.options.theme={...gt};try{Q.refresh(0,Math.max(0,Q.rows-1))}catch{}}},[gt]),x.useEffect(()=>Ge(J=>{const Se=f.current;if(!Se)throw new Error("terminal not ready");if(Se.write(J),z){const ye=performance.now(),qe=ae.current;qe.push({time:ye,bytes:J.byteLength});const ie=ye-1e3;for(;qe.length>0&&qe[0].time<ie;)qe.shift()}}),[Ge,z]),x.useEffect(()=>{if(!a)return;_e(10);const Q=f.current;if(Q){try{Q.refresh(0,Math.max(0,Q.rows-1))}catch{}if(!k)try{Q.focus()}catch{}}},[a,k,_e]),x.useEffect(()=>{Te==="disconnected"&&ue()},[]);const kt=Q=>{Q.preventDefault()};return u.jsxs("main",{ref:Qe,className:"flex-1 w-full min-w-0 min-h-0 overflow-hidden relative flex flex-col",onContextMenu:kt,"aria-label":we("terminal.windowAriaLabel"),children:[u.jsx("div",{id:"terminal-container",ref:i,className:"absolute inset-0 overflow-hidden cursor-text",style:{touchAction:Y?"none":"auto"},tabIndex:0,onContextMenu:kt,"aria-label":we("terminal.bufferAriaLabel"),role:"region",children:u.jsx("div",{id:"terminal-frame",ref:o,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: ${I.state}
37
+ `,`deltaY: ${I.deltaY} lines: ${I.lines}
38
+ `,`viewportY: ${I.viewportY??"-"} focus: ${I.focused}
39
+ `,`buffer: ${I.bufferType??"-"} base: ${I.baseY??"-"} cursor: ${I.cursorY??"-"} scrollback: ${I.hasScrollback??"-"}
40
+ `,`scroll: ${I.scrollTop??"-"} / ${I.scrollHeight??"-"} (h ${I.clientHeight??"-"}) moved: ${I.moved}
41
+ `,`mode: ${I.scrollMode} calls: ${I.scrollCalls} lines: ${I.lastScrollLines??"-"} mouse: ${I.mouseTracking}
42
+ `,`event: ${I.lastInputEvent||"-"} pointer: ${I.pointerEvents} touch: ${I.touchEvents}
43
+ `,`rtt: ${He!==null?`${He}ms`:"-"} frames/s: ${V.framesPerSec} bytes/s: ${V.bytesPerSec} renderer: ${ve??"-"}
44
+ `,`prediction: ${((wn=ft.current)==null?void 0:wn.getState())??"-"} mode: ${Oe.predictiveEcho} pending: ${((Tt=ft.current)==null?void 0:Tt.getVisiblePredictions().length)??0} srtt: ${((Sn=ft.current)==null?void 0:Sn.getEchoSrttMs())!==null&&((za=ft.current)==null?void 0:za.getEchoSrttMs())!==void 0?`${Math.round(ft.current.getEchoSrttMs())}ms`:"-"}
45
+ `,`field: ${aS(((yl=le.current)==null?void 0:yl.detect())??null)} mismatches: ${((Ml=ft.current)==null?void 0:Ml.getMismatchCount())??0}`]}),k&&Ct&&kl&&(()=>{var ll;const Q=f.current;if(!Q||!Qe.current)return null;const J=ti(Q);if(J.cellWidth<=0||J.cellHeight<=0)return null;const Se=((ll=d.current)==null?void 0:ll.querySelector(".xterm-screen"))||d.current;if(!Se)return null;const ye=Se.getBoundingClientRect(),qe=Qe.current.getBoundingClientRect(),ie=Ct.startRow-Rl;if(Ct.endRow-Rl<0||ie>=Q.rows)return null;const ht=ye.top-qe.top+ie*J.cellHeight,Wt=ye.left-qe.left+Ct.startCol*J.cellWidth,Dt=(Ct.endCol-Ct.startCol+1)*J.cellWidth,zn=(Ct.endRow-Ct.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:`${ht}px`,left:`${Wt}px`,width:`${Dt}px`,height:`${zn}px`}})})(),k&&hl&&u.jsx(xw,{anchorPoint:hl,hasSelection:!!ai,isController:ge,vibrateOnKeyPress:Oe.vibrateOnKeyPress,linkUrl:hl.link??null,onOpenLink:Q=>{Vu(Q)||Pe("warning",we("clipboard.openLinkFailed"))},onCopySelection:ii,onCopyLine:xn,onCopyScreen:Gt,onPaste:en,onClose:()=>{fn(null),Lt.current=null,Ft(null),it.current=null,Mn(""),el.current="",an(!1)}}),k&&u.jsx(ww,{isOpen:Zi,onClose:()=>La(!1),onSend:bl,onSendImage:D})]})},sS=({onPairedSuccess:r})=>{const{settings:a,updateSettings:i,connect:o,connectionState:d,stateDetail:f,addToast:m,t:p}=Mt(),[g,v]=x.useState(""),[y,w]=x.useState(null),[T,R]=x.useState(!1),[k,Y]=x.useState(a.wsUrl||"/ws/client"),[z,I]=x.useState(a.token||""),[P,V]=x.useState(a.clientId||""),oe="node bin/service.js pair",ve="node bin/config-tui.js",ne="herdr plugin pane open --plugin herdr.remote.web --entrypoint config --placement zoomed --focus",X=ge=>{ni(ge).then(Te=>{if(Te==="failed"){m("error",p("clipboard.copyFailed"));return}w(ge),m("success",p("toasts.commandCopied")),setTimeout(()=>w(null),2e3)})},U=ge=>{ge.preventDefault();const Te=g.trim().toUpperCase();if(!Te&&!z.trim()){m("warning",p("toasts.connectionError"));return}const Oe={pairCode:Te,wsUrl:k.trim()||"/ws/client",clientId:P.trim()||a.clientId};z.trim()&&(Oe.token=z.trim()),i(Oe),o({pairCode:Te||void 0,token:z.trim()||void 0,wsUrl:k.trim()||"/ws/client",clientId:P.trim()||a.clientId}),r&&r()},te=d==="connecting"||d==="reconnecting",ae=({n:ge})=>u.jsxs("span",{"aria-hidden":"true",className:"shrink-0 font-bold text-tui-accent",children:["[",ge,"]"]});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:p("onboarding.title")}),u.jsx("span",{className:"text-tui uppercase text-tui-warn",children:p("onboarding.firstTimeSetup")})]}),u.jsx("p",{className:"mt-0.5 text-tui leading-snug text-tui-muted",children:p("onboarding.description")})]}),d==="error"&&u.jsxs(yo,{tone:"warn",action:u.jsx(Le,{variant:"warn",onClick:()=>o(),children:p("common.retry")}),children:[u.jsx("span",{className:"block font-bold",children:p("onboarding.authRequired")}),u.jsx("span",{className:"block text-tui-muted",children:f||p("onboarding.authRequiredDesc")})]}),u.jsxs("form",{onSubmit:U,className:"grid gap-3",children:[u.jsx(dn,{title:p("onboarding.step1Title"),className:"min-w-0",children:u.jsxs("div",{className:"space-y-2",children:[u.jsxs("p",{className:"flex items-start gap-2 text-tui text-tui-muted",children:[u.jsx(ae,{n:1}),u.jsx("span",{className:"leading-snug",children:p("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:oe}),u.jsx(Le,{onClick:()=>X(oe),glyph:y===oe?Fe.check:"⧉",className:$("shrink-0",y===oe&&"border-tui-ok text-tui-ok"),children:p(y===oe?"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:p("onboarding.step1CopyPlugin")}),u.jsx("button",{type:"button",onClick:()=>X(ne),className:"tui-focusable shrink-0 text-tui-accent underline-offset-2 hover:underline",children:p(y===ne?"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:p("onboarding.step1TuiNote")}),u.jsx("code",{onClick:()=>X(ve),className:"shrink-0 cursor-pointer border border-tui-border-dim px-1 text-tui-muted hover:border-tui-accent hover:text-tui-accent",title:p("common.clickToCopy"),children:ve})]})]})]})}),u.jsx(dn,{title:p("onboarding.step2Title"),className:"min-w-0",children:u.jsxs("div",{className:"space-y-2",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(ae,{n:2}),u.jsx(yn,{type:"text",value:g,onChange:ge=>v(ge.target.value.toUpperCase()),placeholder:p("onboarding.step2Placeholder"),maxLength:12,autoFocus:!0,"aria-label":p("onboarding.step2Title"),className:"font-bold uppercase"})]}),u.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:p("onboarding.step2Note")})]})}),u.jsx(Le,{variant:"primary",type:"submit",block:!0,disabled:te,className:"py-1.5",children:te?u.jsx(Fi,{label:p("onboarding.connectingAndPairing")}):p("onboarding.connectAndPair")}),u.jsxs("div",{className:"border border-tui-border bg-tui-base",children:[u.jsxs("button",{type:"button",onClick:()=>R(!T),"aria-expanded":T,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:T?Fe.chevronDown:Fe.chevronRight}),u.jsx("span",{className:"uppercase",children:p("onboarding.advancedTitle")})]}),T&&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(bn,{htmlFor:"onboarding-token",children:p("onboarding.manualTokenLabel")}),u.jsx(yn,{id:"onboarding-token",type:"password",value:z,onChange:ge=>I(ge.target.value),placeholder:p("onboarding.manualTokenPlaceholder")})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(bn,{htmlFor:"onboarding-ws",children:p("onboarding.wsEndpointLabel")}),u.jsx(yn,{id:"onboarding-ws",type:"text",value:k,onChange:ge=>Y(ge.target.value),placeholder:p("onboarding.wsEndpointPlaceholder")})]}),u.jsx(ul,{}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(bn,{htmlFor:"onboarding-client-id",children:p("onboarding.clientIdLabel")}),u.jsx(yn,{id:"onboarding-client-id",type:"text",value:P,onChange:ge=>V(ge.target.value)})]})]})]})]})]})})},Ma="tui-focusable inline-flex shrink-0 select-none items-center justify-center border text-tui font-medium transition-colors",Fr="border-tui-border bg-tui-surface text-tui-text hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",oS="border-tui-accent bg-tui-accent text-tui-crust font-bold",cS="border-tui-ok bg-transparent text-tui-ok hover:bg-tui-ok hover:text-tui-crust font-bold",Bp={default:Fr,bad:"border-tui-bad text-tui-bad hover:bg-tui-bad hover:text-tui-crust",warn:"border-tui-warn text-tui-warn hover:bg-tui-warn hover:text-tui-crust"},uS=({compact:r=!1,onCustomize:a})=>{const{sendKey:i,settings:o,updateSettings:d,isController:f,warnViewerMode:m,t:p,uploadProgress:g,uploadImage:v,modifierLatch:y,toggleModifierLatch:w,consumeModifierLatch:T,agentProfile:R}=Mt(),k="h-9 min-w-[2.25rem] px-2",Y="h-9 w-9",z="h-9 px-2",I=x.useRef(null),P=x.useRef(null),V=x.useCallback(()=>{if(o.vibrateOnKeyPress&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(8)}catch{}},[o.vibrateOnKeyPress]),oe=x.useCallback(()=>{var G;if(V(),!f){m();return}g.active||(G=I.current)==null||G.click()},[V,f,m,g.active]),ve=x.useCallback(G=>{const Ue=G.target.files,lt=Ue&&Ue[0];G.target.value="",lt&&v(lt)},[v]),ne=()=>u.jsxs(u.Fragment,{children:[u.jsx("input",{ref:I,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",className:"hidden","data-testid":"key-toolbar-file-input",onChange:ve}),u.jsx("input",{ref:P,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",capture:"environment",className:"hidden","data-testid":"key-toolbar-camera-input",onChange:ve})]}),X=(G=!1)=>g.active?u.jsx("div",{"data-testid":G?"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(T0,{ratio:g.ratio,label:g.statusText,tone:g.phase==="completed"?"ok":g.phase==="error"?"bad":"accent","aria-label":g.statusText})}):null,U=()=>{const G=g.active;return u.jsx("button",{type:"button","data-testid":"image-upload-btn",onClick:oe,disabled:G,className:$(Ma,k,G?"border-tui-border-dim bg-tui-surface opacity-60 cursor-not-allowed":Fr),title:G?g.statusText:p("virtualKeyboard.uploadImageTitle"),"aria-label":p("virtualKeyboard.uploadImage"),children:u.jsx("span",{className:"font-medium",children:G?`${g.percent}%`:p("virtualKeyboard.image")})})},[te,ae]=x.useState(!1),[ge,Te]=x.useState(!1),[Oe,st]=x.useState(!1),Xe=x.useRef([]);x.useEffect(()=>()=>{Xe.current.forEach(G=>clearTimeout(G)),Xe.current=[]},[]);const E=x.useCallback(G=>{if(V(),!f){m();return}let Ue;try{Ue=El(G)}catch{return}if(T(),Ue.length===1){i(Ue[0]);return}Ue.forEach((lt,we)=>{const He=setTimeout(()=>{Xe.current=Xe.current.filter(gt=>gt!==He),i(lt)},we*120);Xe.current.push(He)})},[T,f,i,V,m]),B=lx(R,o.agentKeymaps[R]),ee=G=>{let Ue="";try{Ue=Vr(G.combo)}catch{}const lt=G.custom?G.customLabel||"":p(`agentActions.${G.labelKey}`),we=G.labelKey==="interrupt"&&G.combo.trim().toLowerCase()==="ctrl+c"?"bad":G.combo.trim().toLowerCase()==="ctrl+z"?"warn":"default";return u.jsxs("button",{type:"button","data-testid":`agent-key-${G.id}`,onClick:()=>E(G.combo),className:$(Ma,"h-8 max-w-[10rem] gap-1 px-1.5",Bp[we]),title:`${Ue} ${lt}`.trim(),"aria-label":`${Ue} ${lt}`.trim(),children:[u.jsx("span",{className:"font-bold",children:Ue}),u.jsx("span",{className:"max-w-[5rem] truncate text-tui-sm opacity-70",children:lt})]},G.id)},ze=()=>{const G=[...B.agentActions,...B.genericActions];return G.length===0&&!a?null:u.jsxs("div",{"data-testid":"agent-key-actions",role:"group","aria-label":`${Yi[R].name} ${p("agentKeymaps.agentGroup")}`,className:"flex shrink-0 items-center gap-1",children:[u.jsx("span",{"aria-hidden":"true",className:"mx-1 h-6 w-px shrink-0 bg-tui-border-dim"}),G.map(ee),a&&u.jsx("button",{type:"button","data-testid":"agent-key-customize",onClick:a,className:$(Ma,"h-8 px-1.5 text-tui-sm border-tui-border-dim bg-transparent text-tui-faint hover:border-tui-accent hover:text-tui-accent"),title:p("agentKeymaps.customizeBar"),"aria-label":p("agentKeymaps.customizeBar"),children:p("agentKeymaps.customizeBarShort")})]})},Z=x.useCallback((G,Ue=!0)=>{if(V(),!f){m();return}const lt=T();i(Ue&&lt?xo(G,lt):G)},[f,i,m,V,T]);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:[ne(),X(!0),u.jsx("div",{className:"flex items-center justify-center px-2 py-0.5",children:u.jsxs("button",{type:"button",onClick:()=>d({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 Pe=o.virtualKeys&&o.virtualKeys.length>0?o.virtualKeys.filter(G=>G.enabled):ng,je=G=>G.id==="left"?u.jsx("span",{"aria-hidden":"true",children:"←"}):G.id==="up"?u.jsx("span",{"aria-hidden":"true",children:"↑"}):G.id==="down"?u.jsx("span",{"aria-hidden":"true",children:"↓"}):G.id==="right"?u.jsx("span",{"aria-hidden":"true",children:"→"}):G.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")})]}):G.id==="drawer_chords"?u.jsx("span",{children:"^C"}):G.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:te?"▾":"▴"})]}):u.jsx("span",{children:G.label}),ue=G=>{if(V(),G.type==="modifier"){G.modifierType==="ctrl"||G.modifierType==="alt"||G.modifierType==="shift"?w(G.modifierType):G.modifierType==="meta"&&Z(re.ESC);return}if(G.type==="drawer"){G.drawerType==="fn"?(ae(!te),Te(!1),st(!1)):G.drawerType==="chords"?(st(!Oe),ae(!1),Te(!1)):G.drawerType==="symbols"&&(Te(!ge),ae(!1),st(!1));return}Z(G.code,G.type!=="chord")},Ge=G=>{if(G.type==="modifier"){if(G.modifierType==="ctrl")return y.ctrl;if(G.modifierType==="alt")return y.alt;if(G.modifierType==="shift")return y.shift}if(G.type==="drawer"){if(G.drawerType==="fn")return te;if(G.drawerType==="chords")return Oe;if(G.drawerType==="symbols")return ge}return!1},Me=(G,Ue,lt,we,He="default")=>u.jsxs("button",{type:"button",onClick:()=>Z(G,!1),className:$(Ma,"h-8 gap-1.5 px-2",Bp[He]),title:lt,children:[u.jsx("span",{className:"font-bold",children:Ue}),u.jsx("span",{className:"text-tui-sm opacity-70",children:we})]});return u.jsxs("div",{"data-testid":"key-toolbar",className:$("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:[ne(),X(!1),te&&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(G=>{const Ue=`F${G}`;return u.jsxs("button",{type:"button",onClick:()=>Z(re[Ue]),className:$(Ma,Fr,"h-8"),children:["F",G]},Ue)})}),Oe&&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:[Me(re.CTRL_C,"^C",p("virtualKeyboard.ctrlCTitle"),p("virtualKeyboard.badgeSigint"),"bad"),Me(re.CTRL_D,"^D",p("virtualKeyboard.ctrlDTitle"),p("virtualKeyboard.badgeEof")),Me(re.CTRL_Z,"^Z",p("virtualKeyboard.ctrlZTitle"),p("virtualKeyboard.badgeTstp"),"warn"),Me(re.CTRL_L,"^L",p("virtualKeyboard.ctrlLTitle"),p("virtualKeyboard.badgeClear")),Me(re.CTRL_R,"^R",p("virtualKeyboard.ctrlRTitle"),p("virtualKeyboard.badgeSearch")),Me(re.CTRL_A,"^A",p("virtualKeyboard.ctrlATitle"),p("virtualKeyboard.badgeStart")),Me(re.CTRL_E,"^E",p("virtualKeyboard.ctrlETitle"),p("virtualKeyboard.badgeEnd")),Me(re.CTRL_K,"^K",p("virtualKeyboard.ctrlKTitle"),p("virtualKeyboard.badgeKill"))]}),ge&&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(G=>u.jsx("button",{type:"button",onClick:()=>Z(G,!0),className:$(Ma,Fr,"h-8 w-8 font-bold"),children:G},G))}),u.jsxs("div",{"data-testid":"key-toolbar-row",className:$("scrollbar-none flex flex-nowrap touch-pan-x items-center justify-start gap-1 overflow-x-auto overscroll-x-contain",r?"px-1.5 py-1":"px-2 py-1.5"),children:[u.jsx("button",{type:"button",onClick:()=>d({toolbarVisible:!1}),className:$(Ma,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:"▾"})}),Pe.map(G=>{const Ue=Ge(G),lt=G.id==="enter",we=["left","up","down","right"].includes(G.id),He=G.type==="drawer",gt=Xu(G,p),Ke=u.jsx("button",{type:"button",onClick:()=>ue(G),className:$(Ma,we?Y:He?z:k,lt?cS:Ue?oS:Fr),title:gt,"aria-label":gt,"aria-pressed":Ue,children:je(G)},G.id);return lt?u.jsxs(fl.Fragment,{children:[ze(),U(),Ke]},"enter-with-image"):Ke}),!Pe.some(G=>G.id==="enter")&&u.jsxs(u.Fragment,{children:[ze(),U()]})]})]})},dS=["ls -la","clear","git status","pwd","top","exit","cat"],fS=({isOpen:r,onClose:a})=>{const{sendKey:i,isController:o,warnViewerMode:d,t:f}=Mt(),[m,p]=x.useState("");if(!r)return null;const g=y=>{if(y&&y.preventDefault(),!o){d();return}m.length>0?(i(m+"\r"),p("")):i("\r")},v=y=>{if(!o){d();return}i(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(Le,{variant:"ghost",onClick:a,"aria-label":f("virtualKeyboard.closeHelper"),children:"esc"})]}),u.jsx("div",{className:"scrollbar-none flex items-center gap-1 overflow-x-auto py-0.5",children:dS.map(y=>u.jsx("button",{type:"button",onClick:()=>v(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:g,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(yn,{id:"virtual-keyboard-input",name:"terminal-input",type:"text",value:m,onChange:y=>p(y.target.value),placeholder:f("virtualKeyboard.placeholder"),inputMode:"text",enterKeyHint:"send",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,className:"select-text pr-7"}),m.length>0&&u.jsx("button",{type:"button",onClick:()=>p(""),className:"tui-focusable absolute right-1 top-1/2 -translate-y-1/2 px-1 text-tui-faint hover:text-tui-bad","aria-label":f("virtualKeyboard.clearInput"),children:u.jsx("span",{"aria-hidden":"true",children:Fe.cross})})]}),u.jsx(Le,{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 jo(r,a){const i=(o,d)=>a?a(o):d;switch(r){case"connected":return{label:i("connection.live","Live"),level:"ok",needsAttention:!1};case"connecting":return{label:i("connection.connecting","Connecting"),level:"warn",needsAttention:!0};case"reconnecting":return{label:i("connection.reconnecting","Reconnecting"),level:"warn",needsAttention:!0,actionLabel:i("connection.reconnectNow","Reconnect now")};case"error":return{label:i("connection.error","Error"),level:"bad",needsAttention:!0,actionLabel:i("connection.retry","Retry")};default:return{label:i("connection.offline","Offline"),level:"idle",needsAttention:!0,actionLabel:i("connection.connect","Connect")}}}const hS={connected:"ok",connecting:"warn",reconnecting:"warn",error:"bad",disconnected:"idle"},mS=({isOpen:r,onClose:a,isAddMode:i=!1})=>{const{settings:o,updateSettings:d,connect:f,disconnect:m,connectionState:p,hostId:g,addToast:v,t:y,activeProfile:w,activeProfileId:T,addProfileAndConnect:R,renameProfile:k}=Mt(),[Y,z]=x.useState(o.wsUrl),[I,P]=x.useState(o.token),[V,oe]=x.useState(o.pairCode),[ve,ne]=x.useState(o.clientId),[X,U]=x.useState((w==null?void 0:w.displayName)||""),[te,ae]=x.useState(o.autoReconnect),[ge,Te]=x.useState(!1);if(x.useEffect(()=>{r&&(z(o.wsUrl),P(i?"":o.token),oe(i?"":o.pairCode),ne(o.clientId),U(i?"":(w==null?void 0:w.displayName)||""),ae(o.autoReconnect))},[r,i,o,w]),!r)return null;const Oe=B=>{B.preventDefault();const ee={wsUrl:Y.trim()||"/ws/client",token:I.trim(),pairCode:V.trim().toUpperCase(),clientId:ve.trim()||o.clientId,autoReconnect:te};if(!ee.token&&!ee.pairCode){v("warning",y("pairing.credentialsRequired"));return}i?R({...ee,displayName:X.trim()||void 0}):(d(ee),T&&X.trim()&&k(T,X),m(),f({wsUrl:ee.wsUrl,token:ee.token||void 0,pairCode:ee.pairCode||void 0,clientId:ee.clientId,autoReconnect:te})),a()},st=()=>{const B=`client-${Math.random().toString(36).substring(2,8)}`;ne(B)},Xe=()=>{const B=new URL(window.location.href);B.search="",V.trim()&&B.searchParams.set("pairCode",V.trim().toUpperCase()),ni(B.toString()).then(ee=>{if(ee==="failed"){v("error",y("clipboard.copyFailed"));return}Te(!0),v("success",y("toasts.pairingLinkCopied")),setTimeout(()=>Te(!1),2e3)})},E=hS[p]??"idle";return u.jsxs(dd,{isOpen:r,onClose:a,title:y(i?"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:[p==="connected"&&u.jsx(Le,{variant:"danger",onClick:()=>{m(),a()},children:y("common.disconnect")}),u.jsx(Le,{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(jn,{level:E}),u.jsx("span",{className:"text-tui-muted",children:y("common.status")}),u.jsx("span",{className:$(E==="ok"?"text-tui-ok":E==="bad"?"text-tui-bad":E==="warn"?"text-tui-warn":"text-tui-faint"),children:jo(p,y).label})]}),g&&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:g})]})]}),u.jsxs("form",{id:"pairing-form",onSubmit:Oe,className:"space-y-3",children:[u.jsxs("div",{className:"space-y-1",children:[u.jsx(bn,{htmlFor:"pairing-name",children:y("pairing.displayNameLabel")}),u.jsx(yn,{id:"pairing-name",type:"text",value:X,onChange:B=>U(B.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(bn,{htmlFor:"pairing-code",hint:y("pairing.pairCodeNote"),children:y("pairing.pairCodeLabel")}),u.jsx(yn,{id:"pairing-code",type:"text",value:V,onChange:B=>oe(B.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(bn,{htmlFor:"pairing-token",hint:y("pairing.tokenNote"),children:y("pairing.tokenLabel")}),u.jsx(yn,{id:"pairing-token",type:"password",value:I,onChange:B=>P(B.target.value),placeholder:y("pairing.tokenPlaceholder")})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(bn,{htmlFor:"pairing-ws",children:y("pairing.wsUrlLabel")}),u.jsx(yn,{id:"pairing-ws",type:"text",value:Y,onChange:B=>z(B.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(bn,{htmlFor:"pairing-client-id",children:y("pairing.clientIdLabel")}),u.jsxs("div",{className:"flex gap-2",children:[u.jsx(yn,{id:"pairing-client-id",type:"text",value:ve,onChange:B=>ne(B.target.value),className:"flex-1"}),u.jsx(Le,{onClick:st,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($a,{checked:te,onChange:ae,label:y("pairing.autoReconnectLabel"),description:y("pairing.autoReconnectDesc")})}),u.jsx("div",{className:"border-t border-tui-border-dim pt-2",children:u.jsx(Le,{onClick:Xe,block:!0,glyph:ge?Fe.check:"⧉",className:$(ge&&"border-tui-ok text-tui-ok"),children:y("pairing.copyDirectLink")})})]})]})},pS=["grid items-center gap-x-2 gap-y-1 border-b border-tui-border-dim px-2 py-1.5 last:border-b-0","grid-cols-[5rem_minmax(0,1fr)_6.5rem] [grid-template-areas:'cap_label_actions'_'combo_combo_default']","sm:grid-cols-[5rem_minmax(0,1fr)_9rem_7rem_6.5rem] sm:[grid-template-areas:'cap_label_combo_default_actions']"].join(" "),gS=({isOpen:r,onClose:a,initialTab:i})=>{const{settings:o,updateSettings:d,addToast:f,language:m,setLanguage:p,t:g,agentProfile:v}=Mt(),[y,w]=x.useState("appearance"),[T,R]=x.useState(null),[k,Y]=x.useState({}),z=x.useRef({}),[I,P]=x.useState(""),[V,oe]=x.useState(""),[ve,ne]=x.useState(!1);if(x.useEffect(()=>{!r||!i||(w(i),R(null))},[r,i]),!r)return null;const X=Pu.find(j=>j.font===o.fontFamily),U=o.virtualKeys&&o.virtualKeys.length>0?o.virtualKeys:Qr(),te=T||v,ae=o.agentKeymaps[te]||{},ge=hg(te,ae),Te=mg(te,ae),Oe=Te.filter(j=>!j.hidden).length,st=j=>j.custom?j.customLabel||"":g(`agentActions.${j.labelKey}`),Xe=j=>{try{return Vr(j.combo)}catch{return j.combo}},E=j=>{d({agentKeymaps:{...o.agentKeymaps,[te]:j}})},B=(j,be)=>{var pe;E({...ae,actions:{...ae.actions,[j]:{...(pe=ae.actions)==null?void 0:pe[j],...be}}})},ee=j=>{B(j.id,{keys:j.defaultCombo})},ze=(j,be)=>{const pe=j+(be==="up"?-1:1);if(pe<0||pe>=ge.length)return;const Je=ge.map(bt=>bt.id);[Je[j],Je[pe]]=[Je[pe],Je[j]],E({...ae,order:Je})},Z=j=>{var be;E({...ae,custom:(ae.custom||[]).filter(pe=>pe.id!==j),order:(be=ae.order)==null?void 0:be.filter(pe=>pe!==j)})},Pe=()=>E(ax(ae)),je=()=>{const j={...o.agentKeymaps};delete j[te],d({agentKeymaps:j})},ue=()=>{const j=I.trim();if(!j)return;try{El(V)}catch{return}const be=`custom-${Date.now().toString(36)}`;E({...ae,custom:[...ae.custom||[],{id:be,label:j,keys:V.trim()}],order:[...ge.map(pe=>pe.id),be]}),P(""),oe("")},Ge=j=>j instanceof Nl?g(`agentKeymaps.errors.${j.code}`,j.params):String(j),Me=(j,be)=>`${j}:${be}`,G=(j,be)=>{const pe=Me(te,j);z.current={...z.current,[pe]:be},Y(z.current);try{El(be),B(j,{keys:be})}catch{}},Ue=j=>{const be=Me(te,j),pe=z.current[be];if(pe!==void 0){delete z.current[be],Y({...z.current});try{El(pe),B(j,{keys:pe})}catch{}}},lt=typeof window<"u"&&window.isSecureContext&&"Notification"in window,we=()=>{const j=rg();d({fontSize:j.fontSize,fontFamily:j.fontFamily,toolbarVisible:j.toolbarVisible,vibrateOnKeyPress:j.vibrateOnKeyPress,predictiveEcho:j.predictiveEcho,agentAlertBadge:j.agentAlertBadge,agentAlertSound:j.agentAlertSound,agentAlertVibrate:j.agentAlertVibrate,agentAlertNotify:j.agentAlertNotify,language:j.language,virtualKeys:j.virtualKeys}),f("info",g("settings.resetDefaultsToast"))},He=j=>{const be=U.map(pe=>pe.id===j?{...pe,enabled:!pe.enabled}:pe);d({virtualKeys:be})},gt=(j,be)=>{const pe=be==="up"?j-1:j+1;if(pe<0||pe>=U.length)return;const Je=[...U],bt=Je[j];Je[j]=Je[pe],Je[pe]=bt,d({virtualKeys:Je})},Ke=j=>{if(U.some(pe=>pe.id===j.id)){const pe=U.map(Je=>Je.id===j.id?{...Je,enabled:!0}:Je);d({virtualKeys:pe})}else{const pe=[...U,{...j,enabled:!0}];d({virtualKeys:pe})}ne(!1)},We=j=>{const be=U.filter(pe=>pe.id!==j);d({virtualKeys:be})},at=()=>{d({virtualKeys:Qr()}),f("info",g("toasts.keyLayoutReset"))},wt=10,_t=24;return u.jsxs(dd,{isOpen:r,onClose:a,title:g("settings.title"),subtitle:g("settings.subtitle"),closeLabel:g("common.closeDialog"),size:"lg",hints:[{keys:"esc",action:g("common.close")}],footer:u.jsxs(u.Fragment,{children:[u.jsx(Le,{variant:"ghost",onClick:we,children:g("settings.resetDefaults")}),u.jsx(Le,{variant:"primary",onClick:a,children:g("common.done")})]}),children:[u.jsx(cd,{tabs:[{id:"appearance",label:g("settings.tabAppearance"),index:1},{id:"virtualKeys",label:g("settings.tabVirtualKeys"),index:2},{id:"agentKeymaps",label:g("settings.tabAgentKeymaps"),index:3}],activeId:y,onSelect:j=>w(j),className:"mb-3 border-b border-tui-border-dim pb-1"}),y==="appearance"&&u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{className:"space-y-1",children:[u.jsx(bn,{children:g("settings.languageLabel")}),u.jsxs("div",{className:"grid gap-0.5 sm:grid-cols-2",children:[u.jsx(Br,{name:"ui-language",checked:m==="zh",onChange:()=>p("zh"),label:"简体中文"}),u.jsx(Br,{name:"ui-language",checked:m==="en",onChange:()=>p("en"),label:"English"})]})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(bn,{htmlFor:"terminal-font-select",children:g("settings.fontFamilyLabel")}),u.jsxs(No,{id:"terminal-font-select",value:o.fontFamily,onChange:j=>d({fontFamily:j.target.value}),"aria-label":g("settings.fontFamilyLabel"),children:[!X&&u.jsx("option",{value:o.fontFamily,children:o.fontFamily}),Pu.map(j=>u.jsx("option",{value:j.font,children:g(`fontPresets.${j.id}`)||j.name},j.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(bn,{htmlFor:"terminal-font-size",children:g("settings.fontSizeLabel",{size:o.fontSize})}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(S0,{value:(o.fontSize-wt)/(_t-wt),width:24,className:"hidden shrink-0 sm:inline-flex"}),u.jsx("input",{id:"terminal-font-size",type:"range",min:wt,max:_t,step:1,value:o.fontSize,onChange:j=>d({fontSize:Number(j.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:g("settings.fontSizeCompact")}),u.jsx("span",{children:g("settings.fontSizeDefault")}),u.jsx("span",{children:g("settings.fontSizeLarge")})]}),u.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:g("settings.mobileFontNote")}),u.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:g("settings.windowZoomSharedNote")})]}),u.jsx(ul,{}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(bn,{children:g("settings.predictiveEchoLabel")}),u.jsxs("div",{className:"grid gap-0.5 sm:grid-cols-3",children:[u.jsx(Br,{name:"predictive-echo",checked:o.predictiveEcho==="auto",onChange:()=>d({predictiveEcho:"auto"}),label:g("settings.predictiveEchoAuto")}),u.jsx(Br,{name:"predictive-echo",checked:o.predictiveEcho==="always",onChange:()=>d({predictiveEcho:"always"}),label:g("settings.predictiveEchoAlways")}),u.jsx(Br,{name:"predictive-echo",checked:o.predictiveEcho==="off",onChange:()=>d({predictiveEcho:"off"}),label:g("settings.predictiveEchoOff")})]}),u.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:g("settings.predictiveEchoDesc")})]}),u.jsx(ul,{}),u.jsxs("div",{className:"space-y-1",children:[u.jsx($a,{checked:o.toolbarVisible,onChange:j=>d({toolbarVisible:j}),label:g("settings.touchKeyToolbar"),description:g("settings.touchKeyToolbarDesc")}),u.jsx($a,{checked:o.vibrateOnKeyPress,onChange:j=>d({vibrateOnKeyPress:j}),label:g("settings.touchHaptics"),description:g("settings.touchHapticsDesc")})]}),u.jsx(ul,{}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(bn,{children:g("settings.agentAlertsLabel")}),u.jsx($a,{checked:o.agentAlertBadge,onChange:j=>d({agentAlertBadge:j}),label:g("settings.agentAlertBadge"),description:g("settings.agentAlertBadgeDesc")}),u.jsx($a,{checked:o.agentAlertVibrate,onChange:j=>d({agentAlertVibrate:j}),label:g("settings.agentAlertVibrate"),description:g("settings.agentAlertVibrateDesc")}),u.jsx($a,{checked:o.agentAlertSound,onChange:j=>{d({agentAlertSound:j}),j&&(yg(),vg("done"))},label:g("settings.agentAlertSound"),description:g("settings.agentAlertSoundDesc")}),lt&&u.jsx($a,{checked:o.agentAlertNotify,onChange:j=>{if(j&&Notification.permission!=="granted"){Notification.requestPermission().then(be=>d({agentAlertNotify:be==="granted"}));return}d({agentAlertNotify:j})},label:g("settings.agentAlertNotify"),description:g("settings.agentAlertNotifyDesc")})]}),u.jsx(ul,{}),u.jsxs("p",{className:"text-tui-sm leading-snug text-tui-faint",children:[u.jsx("span",{"aria-hidden":"true",className:"mr-1",children:Fe.arrowRight}),g("settings.colorPassthroughNote")]})]}),y==="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:g("virtualKeyboard.customizeTitle")}),u.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:g("virtualKeyboard.customizeDesc")})]}),u.jsx(Le,{variant:"ghost",onClick:at,className:"shrink-0",children:g("virtualKeyboard.resetLayout")})]}),u.jsx("div",{className:"max-h-72 overflow-y-auto border border-tui-border bg-tui-mantle",children:U.map((j,be)=>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:j.enabled,onChange:()=>He(j.id),className:"sr-only",id:`toggle-${j.id}`}),u.jsx("label",{htmlFor:`toggle-${j.id}`,className:$("shrink-0 cursor-pointer select-none font-bold",j.enabled?"text-tui-ok":"text-tui-faint"),"aria-hidden":"true",children:j.enabled?"[x]":"[ ]"}),u.jsx(bp,{className:$(!j.enabled&&"opacity-50"),children:j.label}),u.jsx("span",{className:"truncate text-tui-sm text-tui-muted",children:Xu(j,g)})]}),u.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[u.jsx(Le,{variant:"ghost",brackets:!1,disabled:be===0,onClick:()=>gt(be,"up"),title:g("virtualKeyboard.moveUp"),"aria-label":g("virtualKeyboard.moveUp"),className:"px-1",children:"↑"}),u.jsx(Le,{variant:"ghost",brackets:!1,disabled:be===U.length-1,onClick:()=>gt(be,"down"),title:g("virtualKeyboard.moveDown"),"aria-label":g("virtualKeyboard.moveDown"),className:"px-1",children:"↓"}),u.jsx(Le,{variant:"ghost",brackets:!1,onClick:()=>We(j.id),title:g("virtualKeyboard.deleteKeyTitle"),"aria-label":g("virtualKeyboard.deleteKeyTitle"),className:"px-1 text-tui-bad hover:text-tui-bad",children:Fe.cross})]})]},j.id))}),u.jsx(Le,{block:!0,glyph:"+",onClick:()=>ne(!ve),className:"border-dashed",children:g("virtualKeyboard.addKey")}),ve&&u.jsxs("div",{className:"space-y-2 border border-tui-border bg-tui-mantle p-2",children:[u.jsx(ul,{label:g("virtualKeyboard.availableKeys")}),u.jsx("div",{className:"flex max-h-48 flex-wrap gap-1 overflow-y-auto",children:Mv.map(j=>{const be=U.some(pe=>pe.id===j.id);return u.jsxs("button",{type:"button",onClick:()=>Ke(j),title:Xu(j,g),className:$("tui-focusable flex select-none items-center gap-1 border px-1.5 py-0.5 text-tui-sm transition-colors",be?"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:j.label}),u.jsx("span",{"aria-hidden":"true",className:be?"text-tui-ok":"text-tui-accent",children:be?Fe.check:"+"})]},j.id)})})]})]}),y==="agentKeymaps"&&u.jsxs("div",{className:"space-y-3",children:[u.jsxs("div",{className:"space-y-1",children:[u.jsx(bn,{htmlFor:"agent-keymap-profile",children:g("agentKeymaps.settingsProfileLabel")}),u.jsx(No,{id:"agent-keymap-profile","aria-label":g("agentKeymaps.settingsProfileLabel"),value:te,onChange:j=>R(j.target.value),children:Qv.map(j=>u.jsx("option",{value:j,children:Yi[j].name},j))}),Yi[te].configHint&&u.jsx("p",{className:"text-tui-sm text-tui-faint",children:g("agentKeymaps.configHint",{path:Yi[te].configHint})})]}),u.jsx(ul,{label:g("agentKeymaps.barGroup")}),u.jsxs("div",{className:"space-y-2",children:[u.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:g("agentKeymaps.barHint",{profile:Yi[te].name,count:Oe})}),u.jsx("div",{role:"group","aria-label":g("agentKeymaps.barGroup"),"data-testid":"agent-bar-choices",className:"flex flex-wrap gap-1",children:Te.map(j=>{const be=st(j),pe=Xe(j),Je=!j.hidden;return u.jsxs("button",{type:"button","data-testid":`agent-bar-toggle-${j.id}`,"aria-pressed":Je,onClick:()=>B(j.id,{hidden:Je}),title:`${pe} ${be}`.trim(),className:$("tui-focusable inline-flex h-8 select-none items-center gap-1 border px-1.5 text-tui-sm transition-colors",Je?"border-tui-accent bg-tui-accent text-tui-crust":"border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent"),children:[u.jsx("span",{"aria-hidden":"true",className:"font-bold",children:Je?Fe.check:"+"}),u.jsx("span",{className:"font-bold",children:pe}),u.jsx("span",{className:Je?void 0:"opacity-80",children:be})]},j.id)})}),u.jsx(Le,{variant:"ghost",onClick:Pe,children:g("agentKeymaps.restoreBar")})]}),u.jsx(ul,{label:g("agentKeymaps.agentGroup")}),u.jsx("div",{className:"max-h-72 overflow-y-auto border border-tui-border bg-tui-mantle",children:ge.map((j,be)=>{var De,ot;const pe=st(j),Je=g("agentKeymaps.defaultCombo",{combo:Vr(j.defaultCombo)}),bt=((ot=(De=ae.actions)==null?void 0:De[j.id])==null?void 0:ot.keys)??j.combo,ft=Me(te,j.id),St=k[ft]??bt;let le="",ke=null;try{El(St),le=Vr(St)}catch(Yt){ke=Ge(Yt)}return u.jsxs("div",{"data-testid":`agent-setting-row-${j.id}`,className:pS,children:[u.jsx(bp,{className:"max-w-full justify-self-start overflow-hidden whitespace-nowrap font-bold [grid-area:cap]",children:le||"—"}),u.jsxs("span",{className:"min-w-0 truncate text-tui-sm text-tui-text [grid-area:label]",title:pe,children:[pe,!j.verified&&u.jsx("span",{className:"ml-1 text-tui-sm text-tui-faint",children:g("agentKeymaps.unverified")})]}),u.jsxs("label",{className:"sr-only",htmlFor:`agent-combo-${j.id}`,children:[g("agentKeymaps.shortcutLabel")," ",pe]}),u.jsx(yn,{id:`agent-combo-${j.id}`,"aria-label":`${g("agentKeymaps.shortcutLabel")} ${pe}`,value:St,onChange:Yt=>G(j.id,Yt.target.value),onBlur:()=>Ue(j.id),onKeyDown:Yt=>{Yt.key==="Enter"&&Yt.currentTarget.blur()},placeholder:g("agentKeymaps.comboPlaceholder"),"aria-invalid":!!ke,className:"w-full min-w-0 [grid-area:combo]"}),u.jsx("span",{className:"min-w-0 truncate text-tui-sm text-tui-faint [grid-area:default]",title:Je,children:Je}),u.jsxs("div",{className:"flex items-center gap-1 [grid-area:actions]",children:[u.jsx(Le,{variant:"ghost",brackets:!1,className:"px-1",onClick:()=>ee(j),title:g("agentKeymaps.resetAction"),"aria-label":`${g("agentKeymaps.resetAction")} ${pe}`,children:"↺"}),u.jsx(Le,{variant:"ghost",brackets:!1,className:"px-1",disabled:be===0,onClick:()=>ze(be,"up"),title:g("agentKeymaps.moveUp"),"aria-label":`${g("agentKeymaps.moveUp")} ${pe}`,children:"↑"}),u.jsx(Le,{variant:"ghost",brackets:!1,className:"px-1",disabled:be===ge.length-1,onClick:()=>ze(be,"down"),title:g("agentKeymaps.moveDown"),"aria-label":`${g("agentKeymaps.moveDown")} ${pe}`,children:"↓"}),j.custom&&u.jsx(Le,{variant:"ghost",brackets:!1,className:"px-1 text-tui-bad",onClick:()=>Z(j.id),title:g("agentKeymaps.removeCustom"),"aria-label":`${g("agentKeymaps.removeCustom")} ${pe}`,children:Fe.cross})]}),ke&&u.jsx("p",{className:"col-span-full text-tui-sm text-tui-bad",role:"alert",children:g("agentKeymaps.invalidCombo",{error:ke})})]},j.id)})}),u.jsx(ul,{label:g("agentKeymaps.addCustom")}),u.jsxs("div",{className:"flex flex-wrap items-end gap-2",children:[u.jsxs("label",{className:"min-w-[9rem] flex-1 space-y-1 text-tui-sm text-tui-faint",children:[u.jsx("span",{children:g("agentKeymaps.customLabel")}),u.jsx(yn,{value:I,onChange:j=>P(j.target.value)})]}),u.jsxs("label",{className:"min-w-[9rem] flex-1 space-y-1 text-tui-sm text-tui-faint",children:[u.jsx("span",{children:g("agentKeymaps.customCombo")}),u.jsx(yn,{value:V,onChange:j=>oe(j.target.value)})]}),u.jsx(Le,{onClick:ue,disabled:!I.trim()||!V.trim(),children:g("agentKeymaps.addAction")})]}),V.trim()&&(()=>{try{return El(V),u.jsx("p",{className:"text-tui-sm text-tui-faint",children:Vr(V)})}catch(j){const be=Ge(j);return u.jsx("p",{className:"text-tui-sm text-tui-bad",role:"alert",children:be})}})(),u.jsx(Le,{variant:"ghost",onClick:je,children:g("agentKeymaps.restoreProfile")})]})]})},bS={success:"ok",warning:"warn",error:"bad",info:"accent"},yS={success:Fe.check,warning:Fe.warn,error:Fe.cross,info:"›"},vS=()=>{const{toasts:r,removeToast:a,t:i}=Mt();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(o=>{const d=bS[o.type];return u.jsxs("div",{className:$("pointer-events-auto flex items-start gap-2 border border-tui-border border-l-2 bg-tui-base px-2 py-1 text-tui",Jn[d].edgeL),role:"alert",children:[u.jsx("span",{"aria-hidden":"true",className:$("shrink-0 font-bold",Jn[d].text),children:yS[o.type]}),u.jsx("div",{className:"min-w-0 flex-1 break-words leading-snug text-tui-text",children:o.message}),o.count>1&&u.jsxs("span",{className:"shrink-0 border border-tui-border-dim px-1 text-tui-sm text-tui-muted","aria-label":`×${o.count}`,children:["×",o.count]}),u.jsx("button",{type:"button",onClick:()=>a(o.id),className:"tui-focusable shrink-0 select-none px-0.5 text-tui-faint transition-colors hover:text-tui-bad","aria-label":i("common.dismissNotification"),children:u.jsx("span",{"aria-hidden":"true",children:Fe.cross})})]},o.id)})})},xS=[{status:"blocked",level:"warn"},{status:"done",level:"ok"},{status:"working",level:"accent"}],Zg=({className:r,compact:a=!1})=>{const{agentStatus:i,t:o}=Mt();if(!i)return null;const d=xS.map(({status:m,level:p})=>{var g;return{status:m,level:p,count:((g=i.counts)==null?void 0:g[m])??0}}).filter(m=>m.count>0),f=a?d.slice(0,1):d;return f.length===0?i.total===0?null:u.jsxs("span",{"data-testid":"agent-status-chip",className:$("flex shrink-0 items-center gap-1 px-1 text-tui-muted",r),title:o("agents.title"),children:[u.jsx(jn,{level:"idle"}),u.jsx("span",{className:"text-tui-faint",children:o("agents.allIdle")})]}):u.jsx("span",{"data-testid":"agent-status-chip",className:$("flex shrink-0 items-center gap-2 px-1",r),title:o("agents.title"),children:f.map(({status:m,level:p,count:g})=>u.jsxs("span",{className:"flex items-center gap-1 text-tui-muted",children:[u.jsx(jn,{level:p}),u.jsx("span",{className:"text-tui-text",children:g}),u.jsx("span",{className:"text-tui-faint",children:o(`agents.${m}`)})]},m))})},hd=({onAddProfile:r,mobile:a=!1,statusBar:i=!1})=>{const{profiles:o,activeProfileId:d,activeProfile:f,connectionState:m,switchProfile:p,renameProfile:g,removeProfile:v,t:y}=Mt(),[w,T]=x.useState(!1),[R,k]=x.useState(null),[Y,z]=x.useState(""),I=x.useRef(null);x.useEffect(()=>{if(!w)return;const X=U=>{I.current&&!I.current.contains(U.target)&&T(!1)};return document.addEventListener("pointerdown",X),()=>document.removeEventListener("pointerdown",X)},[w]);const P=(X,U)=>{k(X),z(U)},V=X=>{const U=Y.trim();U&&g(X,U),k(null)},oe=X=>{typeof window<"u"&&!window.confirm(y("profiles.removeConfirm"))||(v(X),k(null))},ve=(f==null?void 0:f.displayName)||y("profiles.addHost"),ne=m==="connected"?"ok":m==="connecting"||m==="reconnecting"?"warn":m==="error"?"bad":"idle";return u.jsxs("div",{ref:I,className:$("relative min-w-0",a&&"w-full",i&&"flex-1"),children:[u.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":w,"aria-label":y("profiles.switcherLabel"),onClick:()=>T(X=>!X),className:$("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",i?"min-h-11 w-full max-w-none px-2":a?"min-h-11 w-full px-2":"min-h-[24px] max-w-[18rem] px-1"),children:[u.jsx(jn,{level:ne}),u.jsx("span",{className:$("truncate text-tui-text",i&&"min-w-0 flex-1"),children:ve}),u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint",children:w?Fe.chevronDown:Fe.chevronRight})]}),w&&u.jsxs("div",{role:"menu","aria-label":y("profiles.switcherLabel"),className:$("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",i?"w-80 max-w-[calc(100vw-1rem)]":a?"inset-x-0 bottom-auto top-full mt-1 mb-0 w-full":"w-80 max-w-[calc(100vw-1rem)]"),children:[u.jsx("div",{className:"border-b border-tui-border-dim px-2 py-1 text-tui-sm uppercase text-tui-faint",children:y("profiles.title")}),o.length===0?u.jsx("p",{className:"px-2 py-2 text-tui-sm text-tui-muted",children:y("profiles.empty")}):o.map(X=>{const U=X.id===d,te=X.id===R;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":U?"true":void 0,onClick:()=>{p(X.id),T(!1)},className:$("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",U?"text-tui-accent":"text-tui-text"),children:[u.jsx("span",{"aria-hidden":"true",className:"w-3 shrink-0",children:U?Fe.cursor:""}),u.jsxs("span",{className:"min-w-0 flex-1",children:[u.jsx("span",{className:"block truncate font-bold",children:X.displayName}),u.jsx("span",{className:"block truncate text-tui-sm text-tui-faint",title:X.hostname||X.hostId,children:X.hostname||X.hostId||X.wsUrl})]}),U&&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:()=>P(X.id,X.displayName),className:"tui-focusable min-h-11 min-w-11 px-2 text-tui-muted hover:text-tui-accent",children:Fe.ellipsis})]}),te&&u.jsxs("div",{className:"flex items-center gap-1 px-2 pb-2",children:[u.jsx("input",{autoFocus:!0,value:Y,maxLength:64,onChange:ae=>z(ae.target.value),onKeyDown:ae=>{ae.key==="Enter"&&V(X.id),ae.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(Le,{onClick:()=>V(X.id),variant:"primary",className:"min-h-11",children:y("common.save")}),u.jsx(Le,{onClick:()=>oe(X.id),variant:"danger",className:"min-h-11",children:y("profiles.remove")})]})]},X.id)}),u.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{T(!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")})]})]})]})},wS=({onAddProfile:r=()=>{}})=>{const{connectionState:a,role:i,hostId:o,assignedClientId:d,sharedWindowCount:f,settings:m,rttMs:p,t:g}=Mt(),v=jo(a,g),y=a==="connected";return u.jsx(Ug,{left:u.jsxs(u.Fragment,{children:[u.jsx(hd,{onAddProfile:r}),u.jsx(yp,{items:[u.jsxs("span",{className:"flex items-center gap-1",children:[u.jsx(jn,{level:v.level}),u.jsx("span",{className:"text-tui-text",children:v.label})]},"status"),y?u.jsx(Ro,{tone:i==="controller"?"ok":"warn",children:g(i==="controller"?"role.sharedControl":"common.viewer")},"role"):null,y&&f>1?u.jsx("span",{className:"text-tui-muted",children:g("role.sharedWindows",{count:f})},"windows"):null,o?u.jsxs("span",{children:[u.jsxs("span",{className:"text-tui-faint",children:[g("common.host"),":"]})," ",u.jsx("span",{className:"text-tui-text",children:o})]},"host"):null,u.jsxs("span",{children:[u.jsx("span",{className:"text-tui-faint",children:g("header.clientIdLabel")})," ",u.jsx("span",{className:"text-tui-text",children:d||m.clientId})]},"client")]})]}),right:u.jsx(yp,{items:[y?u.jsx(Zg,{},"agents"):null,p!==null?u.jsxs("span",{className:"text-tui-muted",children:[g("header.latencyTitle"),": ",u.jsxs("span",{className:"text-tui-text",children:[p,"ms"]})]},"rtt"):null,u.jsx("span",{className:"hidden text-tui-faint sm:inline",children:g("header.tagline")},"mode")]})})},SS=[[/\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"]],CS=[[/\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 Hp(r,a){for(const[i,o]of r)if(i.test(a))return o;return null}function md(r){const a=typeof r=="string"?r.trim():"";if(!a)return{label:"",raw:""};const i=Hp(SS,a),o=Hp(CS,a);return i&&o?{label:`${i} · ${o}`,raw:a}:i?{label:i,raw:a}:o?{label:o,raw:a}:{label:a.length>32?`${a.slice(0,32)}…`:a,raw:a}}function Kp(r){if(r===0)return"0 B";const a=1024,i=["B","KB","MB","GB"],o=Math.floor(Math.log(r)/Math.log(a));return`${(r/Math.pow(a,o)).toFixed(1)} ${i[o]}`}const TS=({clients:r})=>{const{t:a}=Mt(),i=[{key:"id",header:a("admin.colClientId"),render:o=>u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(jn,{level:"ok"}),u.jsx("span",{className:"font-bold text-tui-text",children:o.id})]})},{key:"role",header:a("admin.colRole"),width:12,render:o=>{const d=o.role==="controller";return u.jsx(Ro,{tone:d?"ok":"warn",children:a(d?"common.controller":"common.viewer")})}},{key:"device",header:a("admin.colDevice"),render:o=>{const d=md(o.userAgent);return d.label?u.jsx("span",{className:"text-tui-muted",title:d.raw,children:d.label}):u.jsx("span",{className:"text-tui-faint",children:a("admin.unknownDevice")})}},{key:"ip",header:a("admin.colIp"),render:o=>u.jsx("span",{className:"text-tui-muted",children:o.ip||"127.0.0.1"})},{key:"connectedAt",header:a("admin.colConnectedAt"),render:o=>u.jsx("span",{className:"text-tui-muted",children:o.connectedAt?new Date(o.connectedAt).toLocaleTimeString():a("admin.startedRecently")})},{key:"traffic",header:a("admin.colTraffic"),align:"right",render:o=>u.jsxs("span",{className:"whitespace-nowrap",children:[u.jsx("span",{className:"text-tui-accent",children:Kp(o.bytesReceived||0)}),u.jsx("span",{"aria-hidden":"true",className:"mx-1 text-tui-faint",children:"/"}),u.jsx("span",{className:"text-tui-ok",children:Kp(o.bytesSent||0)})]})}];return u.jsx(dn,{title:a("admin.connectedClientsTitle",{count:r.length}),bodyClassName:"-mx-1",children:u.jsx(ud,{columns:i,items:r,rowKey:o=>o.id,empty:a("admin.noClients")})})},Yp={online:"ok",busy:"ok",reconnecting:"warn",offline:"idle"};function AS(r=[],a=[]){const i=new Map;for(const f of a){if(!(f!=null&&f.hostId))continue;const m=i.get(f.hostId);m?m.push(f):i.set(f.hostId,[f])}const o=r.map(f=>{const m=i.get(f.id)||[];return{id:f.id,hostname:f.hostname||f.id,status:f.status||"online",connectedDeviceCount:f.connectedDeviceCount??0,pairedDeviceCount:f.pairedDeviceCount??m.length,devices:m,fromRosterOnly:!1}}),d=new Set(o.map(f=>f.id));for(const[f,m]of i)d.has(f)||o.push({id:f,hostname:f,status:"offline",connectedDeviceCount:0,pairedDeviceCount:m.length,devices:m,fromRosterOnly:!0});return o.sort((f,m)=>f.fromRosterOnly!==m.fromRosterOnly?f.fromRosterOnly?1:-1:f.hostname.localeCompare(m.hostname))}const NS=({hosts:r,devices:a})=>{const{t:i}=Mt(),o=AS(r,a),d={online:i("admin.hostStatusOnline"),busy:i("admin.hostStatusBusy"),reconnecting:i("admin.hostStatusReconnecting"),offline:i("admin.hostStatusOffline")};return u.jsx(dn,{title:i("admin.hostsTitle",{count:o.length}),bodyClassName:"space-y-2",children:o.length===0?u.jsx("p",{className:"px-1 py-2 text-tui text-tui-faint",children:i("admin.noHosts")}):o.map(f=>u.jsxs("div",{className:"border border-tui-border-dim bg-tui-mantle",children:[u.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1 border-b border-tui-border-dim px-2 py-1",children:[u.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-tui",children:[u.jsx(jn,{level:Yp[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(Ro,{tone:Yp[f.status],children:d[f.status]}),u.jsx("span",{className:"text-tui-accent",children:i("admin.hostConnectedDevices",{count:f.connectedDeviceCount})}),u.jsx("span",{className:"text-tui-muted",children:i("admin.hostPairedDevices",{count:f.pairedDeviceCount})})]})]}),f.devices.length>0?u.jsx("ul",{className:"divide-y divide-tui-border-dim",children:f.devices.map(m=>{const p=md(m.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:p.raw,children:p.label||i("admin.unknownDevice")}),u.jsx("code",{className:"truncate text-tui-sm text-tui-muted",children:m.deviceId}),u.jsx("span",{className:"ml-auto shrink-0 text-tui-sm text-tui-faint",children:m.lastIp||"—"})]},m.deviceId)})}):u.jsx("p",{className:"px-2 py-1 text-tui-sm text-tui-faint",children:f.pairedDeviceCount>0?i("admin.hostRosterOperatorOnly"):i("admin.noDevices")})]},f.id))})},ES=({ptys:r})=>{const{t:a}=Mt(),i=[{key:"id",header:a("admin.colPtyId"),render:o=>u.jsx("span",{className:"font-bold text-tui-accent",children:o.id})},{key:"pid",header:a("admin.colPid"),width:9,render:o=>u.jsx("span",{className:"text-tui-muted",children:o.pid})},{key:"command",header:a("admin.colCommand"),render:o=>u.jsx("code",{className:"border border-tui-border-dim bg-tui-mantle px-1 text-tui-text",children:o.command})},{key:"grid",header:a("admin.colGrid"),width:11,render:o=>u.jsxs("span",{className:"whitespace-nowrap text-tui-muted",children:[o.cols,u.jsx("span",{"aria-hidden":"true",className:"mx-0.5 text-tui-faint",children:"×"}),o.rows]})},{key:"cwd",header:a("admin.colCwd"),className:"max-w-xs truncate",render:o=>u.jsx("span",{className:"text-tui-muted",children:o.cwd||"~"})},{key:"viewers",header:a("admin.colViewers"),align:"right",width:9,render:o=>u.jsx("span",{className:"font-bold text-tui-ok",children:o.activeClients})}];return u.jsx(dn,{title:a("admin.activePtysTitle",{count:r.length}),bodyClassName:"-mx-1",children:u.jsx(ud,{columns:i,items:r,rowKey:o=>o.id,empty:a("admin.noPtys")})})};function kS(r){if(!r)return"—";const a=new Date(r);return Number.isNaN(a.getTime())?"—":a.toLocaleString()}const RS=({devices:r,onRevoke:a})=>{const{t:i}=Mt(),[o,d]=x.useState(null),[f,m]=x.useState(null),p=async v=>{if(o!==v){d(v);return}m(v);try{await a(v)}finally{m(null),d(null)}},g=[{key:"device",header:i("admin.colDevice"),render:v=>{const y=md(v.userAgent);return u.jsx("span",{className:"text-tui-text",title:y.raw,children:y.label||i("admin.unknownDevice")})}},{key:"deviceId",header:i("admin.colDeviceId"),render:v=>u.jsx("span",{className:"text-tui-muted",children:v.deviceId})},{key:"ip",header:i("admin.colIp"),render:v=>u.jsx("span",{className:"text-tui-muted",children:v.lastIp||"—"})},{key:"lastSeen",header:i("admin.colLastSeen"),render:v=>u.jsx("span",{className:"whitespace-nowrap text-tui-muted",children:kS(v.lastSeenAt)})},{key:"actions",header:i("admin.colActions"),align:"right",render:v=>{const y=o===v.deviceId,w=f===v.deviceId;return u.jsx(Le,{variant:"danger",disabled:w,onClick:()=>void p(v.deviceId),onBlur:()=>d(T=>T===v.deviceId?null:T),"aria-label":i("admin.revokeDevice"),className:y?"bg-tui-bad text-tui-crust":void 0,children:w?u.jsx(Fi,{}):i(y?"admin.revokeConfirm":"admin.revokeDevice")})}}];return u.jsx(dn,{title:i("admin.pairedDevicesTitle",{count:r.length}),bodyClassName:"-mx-1",children:u.jsx(ud,{columns:g,items:r,rowKey:v=>v.deviceId,empty:i("admin.noDevices")})})};function Qg(r){if(typeof window>"u"||!r||r.startsWith("/"))return"";try{const a=new URL(r.replace(/^ws/,"http")),i=a.pathname.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"");return a.origin===window.location.origin&&!i?"":`${a.origin}${i}`}catch{return""}}function Kr(r,a){const i=Qg(r);return i?`${i}${a.startsWith("/")?a:`/${a}`}`:a}const jS=({onBackToTerminal:r,onOpenPairing:a})=>{var He,gt,Ke,We,at,wt,_t,j,be,pe,Je,bt,ft,St;const{settings:i,updateSettings:o,addToast:d,t:f}=Mt(),m=Qg(i.wsUrl)||(typeof window<"u"?window.location.origin:"local"),p=((He=i.adminTokens)==null?void 0:He[m])||(m===(typeof window<"u"?window.location.origin:"local")?i.adminToken:"")||"",[g,v]=x.useState(null),[y,w]=x.useState(null),[T,R]=x.useState(!1),[k,Y]=x.useState(!0),[z,I]=x.useState(null),[P,V]=x.useState(!1),[oe,ve]=x.useState(3e3),[ne,X]=x.useState(null),[U,te]=x.useState("overview"),[ae,ge]=x.useState(!1),[Te,Oe]=x.useState(p),[st,Xe]=x.useState(!!p),E="node bin/service.js pair";x.useEffect(()=>{Oe(p),Xe(!!p),v(null),w(null),R(!1)},[m]);const B=()=>{ni(E).then(le=>{if(le==="failed"){d("error",f("clipboard.copyFailed"));return}ge(!0),d("success",f("toasts.commandCopied")),setTimeout(()=>ge(!1),2e3)})};x.useEffect(()=>{let le=!0;Y(!0);async function ke(){try{const De=await fetch(Kr(i.wsUrl,"/api/info"),{headers:{Accept:"application/json"}});if(De.ok){const ot=await De.json();le&&(w(ot),R(!0));return}}catch{}if(le){const De=!!(i.wsUrl&&!i.wsUrl.startsWith("/")&&!i.wsUrl.includes("localhost")&&!i.wsUrl.includes("127.0.0.1")&&typeof window<"u"&&!i.wsUrl.startsWith(window.location.origin.replace("http","ws")));w({ok:!0,version:"0.1.0",protocol:1,relayMode:De?"remote":"local",adminConfigured:!1,adminPath:"/admin",adminStatusPath:"/api/admin/status"}),R(!0)}}return ke(),()=>{le=!1}},[i.wsUrl,m]);const ee=(y==null?void 0:y.relayMode)==="remote",ze=()=>{if(y!=null&&y.adminPath)return y.publicUrl?`${y.publicUrl.replace(/\/$/,"")}${y.adminPath}`:Kr(i.wsUrl,y.adminPath);if(g!=null&&g.remoteAdminUrl)return g.remoteAdminUrl;if(i.wsUrl)try{return Kr(i.wsUrl,"/admin")}catch{}return"/admin"},Z=x.useCallback(async()=>{if(T){if(ee){if(!st&&!Te){v(null),Y(!1),I(null),V(!1);return}try{Y(!0);const le=Kr(i.wsUrl,(y==null?void 0:y.adminStatusPath)||"/api/admin/status"),De=await fetch(le,{headers:{Accept:"application/json","X-Relay-Admin-Token":Te}});if(De.status===401||De.status===403){V(!0),I(f("admin.relayAdminAuthError")),v(null);return}if(!De.ok)throw new Error(`HTTP ${De.status}: ${De.statusText}`);const ot=await De.json();v(ot),I(null),V(!1),X(new Date)}catch(le){console.warn("GET /api/admin/status request failed:",le),V(!1),I(le instanceof Error?le.message:"Failed to fetch remote admin status"),v(null)}finally{Y(!1)}return}try{Y(!0);const le={Accept:"application/json"};i.token&&(le.Authorization=`Bearer ${i.token}`);const ke=await fetch("/api/status",{headers:le});if(ke.status===401||ke.status===403){V(!0),I(`Authentication failed (HTTP ${ke.status}): Access denied. Please configure an authorized token or pair with the host.`),v(null);return}if(!ke.ok)throw new Error(`HTTP ${ke.status}: ${ke.statusText}`);const De=await ke.json();v(De),I(null),V(!1),X(new Date)}catch(le){console.warn("GET /api/status request failed:",le),V(!1),I(le instanceof Error?le.message:"Failed to fetch status"),v(null)}finally{Y(!1)}}},[T,ee,st,Te,y,i.token,i.wsUrl,m,f]),Pe=x.useCallback(async le=>{try{if(!(await fetch(Kr(i.wsUrl,`/api/admin/devices/${encodeURIComponent(le)}`),{method:"DELETE",headers:{Accept:"application/json","X-Relay-Admin-Token":Te}})).ok){I(f("admin.revokeFailed"));return}await Z()}catch{I(f("admin.revokeFailed"))}},[Te,Z,i.wsUrl,f]);x.useEffect(()=>{if(!T)return;Z();let le=null;const ke=()=>{oe>0&&!le&&(le=setInterval(()=>{document.visibilityState==="visible"&&Z()},oe))},De=()=>{le&&(clearInterval(le),le=null)},ot=()=>{document.visibilityState==="visible"?(Z(),ke()):De()};return ke(),document.addEventListener("visibilitychange",ot),()=>{De(),document.removeEventListener("visibilitychange",ot)}},[T,Z,oe]);const je=le=>{le.preventDefault();const ke=Te.trim();o({adminToken:ke,adminTokens:{...i.adminTokens||{},[m]:ke}}),Xe(!!ke)},ue=le=>{const ke=Math.max(0,Math.floor(le)),De=Math.floor(ke/86400),ot=Math.floor(ke%86400/3600),Yt=Math.floor(ke%3600/60),$n=ke%60,Qe=(hl,fn)=>`${hl}${f(`admin.unit${fn}`)}`;return De>0?[Qe(De,"Day"),Qe(ot,"Hour"),Qe(Yt,"Minute")].join(" "):ot>0?[Qe(ot,"Hour"),Qe(Yt,"Minute"),Qe($n,"Second")].join(" "):[Qe(Yt,"Minute"),Qe($n,"Second")].join(" ")},Ge=le=>{if(!le||le===0)return"0 B";const ke=1024,De=["B","KB","MB","GB"],ot=Math.floor(Math.log(le)/Math.log(ke));return`${(le/Math.pow(ke,ot)).toFixed(1)} ${De[ot]}`},Me=()=>{const le=ze();window.open(le,"_blank","noopener,noreferrer")},G=g?g.activeUserCount??((gt=g.clients)==null?void 0:gt.length)??0:0,Ue=g?[{id:"overview",label:f("admin.tabOverview"),index:1},{id:"clients",label:f("admin.tabClients",{count:((Ke=g.clients)==null?void 0:Ke.length)||0}),index:2},{id:"ptys",label:f("admin.tabPtys",{count:((We=g.ptys)==null?void 0:We.length)||0}),index:3},...g.devices?[{id:"devices",label:f("admin.tabDevices",{count:g.devices.length}),index:4}]:[]]:[],lt=Ue.map(le=>le.id);x.useEffect(()=>{const le=ke=>{if(ke.ctrlKey||ke.altKey||ke.metaKey)return;const De=ke.target;if(De instanceof HTMLInputElement||De instanceof HTMLTextAreaElement||De instanceof HTMLSelectElement||De!=null&&De.isContentEditable||document.querySelector('[role="dialog"]'))return;if(ke.key==="Escape"&&r){ke.preventDefault(),r();return}if(ke.key.toLowerCase()==="r"){ke.preventDefault(),Z();return}const ot=Number.parseInt(ke.key,10)-1;Number.isInteger(ot)&&ot>=0&&ot<lt.length&&(ke.preventDefault(),te(lt[ot]))};return window.addEventListener("keydown",le),()=>window.removeEventListener("keydown",le)},[Z,lt.join("|")]);const we=u.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r&&u.jsx(Le,{variant:"ghost",onClick:r,title:f("admin.returnToTerminal"),"aria-label":f("admin.returnToTerminal"),glyph:Fe.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)||(g==null?void 0:g.version)||"0.1.0"]}),u.jsx(Ro,{tone:ee?"alt":"ok",children:f(ee?"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(No,{value:oe,onChange:le=>ve(Number(le.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(Le,{variant:"primary",onClick:Z,disabled:k,title:f("admin.refreshNow"),children:k?u.jsx(Fi,{}):f("admin.refreshNow")})]});return u.jsxs(A0,{name:f("admin.title"),tagline:f("admin.subtitle"),aside:we,tabs:Ue,activeTabId:U,onSelectTab:le=>te(le),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:ne?u.jsx("span",{className:"text-tui-faint",children:f("admin.updatedAt",{time:ne.toLocaleTimeString()})}):null,bodyClassName:"space-y-3 pb-2",children:[!T&&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(Fi,{label:f("admin.loadingStatus")})}),T&&ee&&!st&&u.jsxs(dn,{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(cl,{label:f("admin.remoteRelayEndpoint"),labelWidth:18,children:u.jsx("code",{className:"break-all text-tui-accent",children:i.wsUrl})}),u.jsx(cl,{label:f("admin.remoteRelayAdminUrl"),labelWidth:18,children:u.jsx("code",{className:"break-all text-tui-ok",children:ze()})})]}),u.jsx(ul,{}),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(Le,{onClick:()=>Xe(!0),children:f("admin.relayAdminLoginBtn")}),u.jsx(Le,{variant:"primary",onClick:Me,glyph:Fe.arrowRight,children:f("admin.openRemoteAdminBtn")})]})]})]}),T&&ee&&st&&!g&&u.jsxs(dn,{title:f("admin.relayAdminTitle"),bodyClassName:"space-y-2",children:[u.jsx(yo,{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:je,className:"space-y-2",children:[u.jsxs("div",{className:"space-y-1",children:[u.jsx(bn,{htmlFor:"relay-admin-token",children:f("admin.relayAdminTokenLabel")}),u.jsx(yn,{id:"relay-admin-token",type:"password",value:Te,onChange:le=>Oe(le.target.value),placeholder:f("admin.relayAdminTokenPlaceholder")})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(Le,{variant:"primary",type:"submit",children:f("admin.relayAdminLoginBtn")}),u.jsx(Le,{variant:"ghost",onClick:()=>Xe(!1),children:f("common.cancel")})]})]})]}),T&&!ee&&P&&u.jsxs(dn,{title:f("admin.unauthorizedTitle"),tone:"bad",bodyClassName:"space-y-2",children:[u.jsx(yo,{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:E}),u.jsx(Le,{onClick:B,glyph:ae?Fe.check:"⧉",className:$("shrink-0",ae&&"border-tui-ok text-tui-ok"),children:f(ae?"admin.copiedJson":"common.copy")})]}),u.jsx("p",{className:"text-tui-sm text-tui-faint",children:f("admin.pairingStepsHelp")})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[a&&u.jsx(Le,{variant:"primary",onClick:a,children:f("admin.enterPairCodeBtn")}),u.jsx(Le,{onClick:Z,children:f("admin.retryFetchBtn")})]})]}),T&&z&&!P&&!(!ee&&P)&&u.jsx(yo,{tone:"warn",action:u.jsx(Le,{variant:"warn",onClick:Z,children:f("common.retry")}),children:f("admin.errorConnecting",{error:z})}),g&&u.jsxs(u.Fragment,{children:[U==="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(dn,{title:f("admin.accessPanel"),aside:ue(g.uptimeSeconds||0),bodyClassName:"space-y-0.5",children:[u.jsx(cl,{label:f("admin.connectedHosts"),labelWidth:14,children:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(jn,{level:(at=g.hosts)!=null&&at.length?"ok":"idle"}),u.jsx("span",{className:"font-bold",children:((wt=g.hosts)==null?void 0:wt.length)||0})]})}),u.jsx(cl,{label:f("admin.activeUsers"),labelWidth:14,children:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(jn,{level:G?"ok":"idle"}),u.jsx("span",{className:"font-bold",children:G}),u.jsx("span",{className:"text-tui-faint",children:f("admin.acrossWindows",{count:((_t=g.clients)==null?void 0:_t.length)||0})})]})}),u.jsxs(cl,{label:f("admin.activePtys"),labelWidth:14,children:[u.jsx("span",{className:"font-bold",children:((j=g.ptys)==null?void 0:j.length)||0}),u.jsx("span",{className:"ml-1.5 text-tui-faint",children:f("admin.terminalShells")})]}),u.jsx(cl,{label:f("admin.uptime"),labelWidth:14,children:u.jsx("span",{className:"text-tui-muted",children:g.startTime?f("admin.startedAt",{time:new Date(g.startTime).toLocaleTimeString()}):f("admin.startedRecently")})})]}),u.jsxs(dn,{title:f("admin.throughput"),aside:f("admin.perSecond",{value:Ge(((be=g.throughput)==null?void 0:be.bytesOutPerSec)||0)}),bodyClassName:"space-y-0.5",children:[u.jsxs(cl,{label:f("admin.bytesInTotal"),labelWidth:13,children:[u.jsx("span",{className:"font-bold text-tui-accent",children:Ge(((pe=g.throughput)==null?void 0:pe.bytesIn)||0)}),u.jsx("span",{className:"ml-1.5 text-tui-faint",children:f("admin.perSecond",{value:Ge(((Je=g.throughput)==null?void 0:Je.bytesInPerSec)||0)})})]}),u.jsxs(cl,{label:f("admin.bytesOutTotal"),labelWidth:13,children:[u.jsx("span",{className:"font-bold text-tui-ok",children:Ge(((bt=g.throughput)==null?void 0:bt.bytesOut)||0)}),u.jsx("span",{className:"ml-1.5 text-tui-faint",children:f("admin.perSecond",{value:Ge(((ft=g.throughput)==null?void 0:ft.bytesOutPerSec)||0)})})]}),u.jsx(ul,{}),u.jsx(cl,{label:f("admin.frameRate"),labelWidth:13,children:u.jsx("span",{className:"font-bold",children:f("admin.framesPerSecond",{count:(((St=g.throughput)==null?void 0:St.framesOutPerSec)||0).toFixed(0)})})})]})]}),u.jsx(NS,{hosts:g.hosts||[],devices:g.devices})]}),U==="clients"&&u.jsx(TS,{clients:g.clients||[]}),U==="ptys"&&u.jsx(ES,{ptys:g.ptys||[]}),U==="devices"&&u.jsx(RS,{devices:g.devices||[],onRevoke:Pe})]})]})},MS=({compact:r=!1})=>{const{role:a,connectionState:i,sharedWindowCount:o,assignedClientId:d,t:f}=Mt();if(!(i==="connected"))return u.jsxs("div",{className:"inline-flex select-none items-center gap-1.5 text-tui uppercase text-tui-faint",role:"status","aria-label":f("terminal.offlineStatusAria"),children:[u.jsx(jn,{level:"idle"}),u.jsx("span",{children:f("common.offline")})]});const p=a==="controller",g=o>1,v=u.jsxs("div",{className:$("inline-flex min-w-0 select-none items-center gap-1.5 text-tui uppercase",p?"text-tui-ok":"text-tui-warn"),role:"status","aria-label":f(p?"role.controllerMode":"role.viewerMode"),children:[u.jsx(jn,{level:p?"ok":"warn"}),u.jsx("span",{className:"truncate",children:f(p?"role.sharedControl":"role.viewerReadOnly")}),g?u.jsx("span",{className:"shrink-0 normal-case text-tui-muted",children:f("role.sharedWindows",{count:o})}):null]});return r?v:u.jsxs("div",{className:"flex w-full flex-col gap-1",children:[v,u.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:f("role.sharedControlDesc")}),d?u.jsx(cl,{label:f("role.thisWindow"),labelWidth:9,className:"text-tui-sm",children:u.jsx("span",{className:"truncate text-tui-muted",children:d})}):null]})},Yr="tui-focusable group flex h-11 w-full select-none items-center gap-2 border px-2 text-left text-tui transition-colors",Gr="border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",_S="border-tui-accent bg-tui-selection text-tui-accent",qr=({active:r=!1})=>u.jsx("span",{"aria-hidden":"true",className:$("shrink-0",r?"text-tui-accent":"text-tui-faint group-hover:text-tui-accent"),children:Fe.cursor}),LS=({onClose:r,onNavigateAdmin:a,showAdminEntry:i=!0,onOpenPairing:o,onOpenSettings:d,onAddProfile:f=()=>{}})=>{const{connectionState:m,stateDetail:p,rttMs:g,hostId:v,settings:y,updateSettings:w,connect:T,addToast:R,language:k,setLanguage:Y,t:z}=Mt(),[I,P]=fl.useState(!1),V=jo(m,z),oe=X=>()=>{var te;const U=document.activeElement;(te=U==null?void 0:U.blur)==null||te.call(U),X()},ve=()=>{ni(y.clientId).then(X=>{if(X==="failed"){R("error",z("clipboard.copyFailed"));return}P(!0),R("info",z("toasts.clientIdCopied",{id:y.clientId})),setTimeout(()=>P(!1),2e3)})},ne=()=>{const X=k==="zh"?"en":"zh";Y(X),R("info",rd(X,"toasts.switchedLanguage",{lang:X==="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(Le,{variant:"ghost",onClick:r,"aria-label":z("mobile.closeSessionControls"),children:"esc"})]}),u.jsx(dn,{title:z("profiles.title"),tone:"accent",bodyClassName:"space-y-1",children:u.jsx(hd,{mobile:!0,onAddProfile:f})}),u.jsxs(dn,{title:z("common.status"),tone:V.level==="ok"?"ok":V.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(jn,{level:V.level}),u.jsx("span",{className:"truncate text-tui uppercase text-tui-text",children:V.label}),m==="connected"&&g!==null&&u.jsxs("span",{className:"text-tui-sm text-tui-muted",children:[g,"ms"]})]}),V.actionLabel&&u.jsx(Le,{variant:"primary",onClick:()=>T(),className:"shrink-0",children:V.actionLabel})]}),V.needsAttention&&p&&u.jsx("p",{className:"text-tui-sm leading-snug text-tui-muted",children:p}),v&&u.jsx(cl,{label:z("common.host"),labelWidth:9,children:v}),u.jsxs("button",{type:"button",onClick:ve,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:$("shrink-0",I?"text-tui-ok":"text-tui-faint"),children:I?Fe.check:"⧉"})]})]}),u.jsx(dn,{title:z("mobile.inputControl"),tone:"accent","aria-label":z("mobile.terminalControlAria"),children:u.jsx(MS,{})}),u.jsxs(dn,{title:z("mobile.menu"),tone:"accent",bodyClassName:"flex flex-col gap-1",children:[u.jsxs("button",{type:"button",onClick:ne,className:$(Yr,Gr),"aria-label":z("header.languageToggleTitle"),children:[u.jsx(qr,{}),u.jsx("span",{className:"truncate",children:k==="zh"?"English":"中文"})]}),u.jsxs("button",{type:"button",onClick:oe(d),className:$(Yr,Gr),"aria-label":z("mobile.settingsAria"),children:[u.jsx(qr,{}),u.jsx("span",{className:"truncate",children:z("common.settings")})]}),u.jsxs("button",{type:"button",onClick:oe(o),className:$(Yr,Gr),"aria-label":z("mobile.pairingAria"),children:[u.jsx(qr,{}),u.jsx("span",{className:"truncate",children:z("common.pairing")})]}),i&&u.jsxs("button",{type:"button",onClick:oe(a),className:$(Yr,Gr),"aria-label":z("mobile.adminAria"),children:[u.jsx(qr,{}),u.jsx("span",{className:"truncate",children:z("common.admin")})]}),u.jsxs("button",{type:"button",onClick:()=>w({toolbarVisible:!y.toolbarVisible}),className:$(Yr,y.toolbarVisible?_S:Gr),"aria-label":z("mobile.keybarAria"),"aria-pressed":y.toolbarVisible,children:[u.jsx(qr,{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]":"[ ]"})]})]})]})},zS=({onAddProfile:r})=>{const{rttMs:a,t:i}=Mt();return u.jsxs("footer",{"data-testid":"mobile-status-bar",role:"status","aria-label":i("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(hd,{statusBar:!0,onAddProfile:r}),u.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-border",children:"│"}),u.jsx(Zg,{compact:!0}),u.jsxs("span",{className:"flex shrink-0 items-center gap-1 px-1 text-tui-muted",title:i("header.latencyTitle"),children:[u.jsx("span",{className:"text-tui-faint",children:"RTT"}),u.jsx("span",{className:$(a===null?"text-tui-faint":"text-tui-text"),children:a===null?"—":`${a}ms`})]})]})},DS=({onNavigateAdmin:r,showAdminEntry:a=!0,onOpenPairing:i,onOpenSettings:o,onAddProfile:d=()=>{}})=>{const{connectionState:f,isController:m,t:p}=Mt(),[g,v]=x.useState(!1),y=x.useRef(null),w=x.useCallback(()=>v(!1),[]);x.useEffect(()=>{if(!g)return;const R=k=>{if(!(k.ctrlKey||k.altKey||k.metaKey)&&k.key==="Escape"){const Y=k.target;Y&&typeof Y.closest=="function"&&!!Y.closest("#terminal-container")||(k.stopPropagation(),k.preventDefault(),w())}};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[g,w]),x.useEffect(()=>{var R;g&&((R=y.current)==null||R.focus({preventScroll:!0}))},[g]);const T=jo(f,p);return u.jsxs(u.Fragment,{children:[u.jsxs("div",{"data-testid":"mobile-topbar",role:"toolbar","aria-label":p("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(Dg,{className:"shrink-0"}),u.jsx(jn,{level:T.level}),u.jsx("span",{className:"truncate uppercase",children:T.label})]}),u.jsxs("button",{type:"button","data-testid":"mobile-chrome-trigger",onClick:()=>v(!0),"aria-label":p("mobile.sessionControls"),"aria-expanded":g,"aria-haspopup":"dialog",className:$("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",T.needsAttention?"border-tui-warn text-tui-warn":m?"border-tui-border text-tui-muted":"border-tui-accent text-tui-accent"),children:[!m&&!T.needsAttention&&u.jsx("span",{className:"max-w-[8rem] truncate",children:p("common.viewer")}),u.jsx("span",{"aria-hidden":"true",className:"text-tui",children:Fe.chevronDown}),u.jsx("span",{"aria-hidden":"true",children:p("mobile.menu")})]})]}),g&&u.jsxs(u.Fragment,{children:[u.jsx("div",{"data-testid":"mobile-sheet-scrim",className:"absolute inset-0 z-40 bg-tui-crust/70",onClick:w,"aria-hidden":"true"}),u.jsx("div",{ref:y,"data-testid":"mobile-control-sheet",role:"dialog","aria-modal":"true","aria-label":p("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(LS,{onClose:w,showAdminEntry:a,onNavigateAdmin:()=>{w(),r()},onOpenPairing:()=>{w(),i()},onOpenSettings:()=>{w(),o()},onAddProfile:()=>{w(),d()}})})]}),u.jsx(zS,{onAddProfile:d})]})},Pg="--app-height",Wg="--keyboard-inset",OS=80;function US(){if(typeof window>"u")return{height:768,keyboardInset:0};const r=window.innerHeight||768,a=window.visualViewport;if(a&&typeof a.height=="number"&&a.height>0){const i=r-a.height-(a.offsetTop||0),o=i>=OS?Math.round(i):0;return{height:Math.round(a.height),keyboardInset:o}}return{height:r,keyboardInset:0}}function Gp(r,a=US()){return r.style.setProperty(Pg,`${a.height}px`),r.style.setProperty(Wg,`${a.keyboardInset}px`),a}function BS(r=typeof document<"u"?document.documentElement:null){if(!r||typeof window>"u")return()=>{};let a=null;const i=()=>{a=null,Gp(r)},o=()=>{if(a===null){if(typeof requestAnimationFrame!="function"){i();return}a=requestAnimationFrame(i)}};Gp(r);const d=window.visualViewport;return d==null||d.addEventListener("resize",o),d==null||d.addEventListener("scroll",o),window.addEventListener("resize",o),window.addEventListener("orientationchange",o),()=>{a!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(a),a=null),d==null||d.removeEventListener("resize",o),d==null||d.removeEventListener("scroll",o),window.removeEventListener("resize",o),window.removeEventListener("orientationchange",o),r.style.removeProperty(Pg),r.style.removeProperty(Wg)}}const HS=900;function qp(){if(typeof window>"u")return!1;const r=Gi();return r<ld?!0:r<=HS}function KS(){const[r,a]=x.useState(qp);return x.useEffect(()=>{var d,f;const i=()=>{const m=qp();a(p=>p===m?p:m)};i();let o=null;try{o=typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null}catch{o=null}return(d=o==null?void 0:o.addEventListener)==null||d.call(o,"change",i),window.addEventListener("resize",i),window.addEventListener("orientationchange",i),(f=window.visualViewport)==null||f.addEventListener("resize",i),()=>{var m,p;(m=o==null?void 0:o.removeEventListener)==null||m.call(o,"change",i),window.removeEventListener("resize",i),window.removeEventListener("orientationchange",i),(p=window.visualViewport)==null||p.removeEventListener("resize",i)}},[]),r}function YS(r){const a=r.target;if(!a)return!1;if(a.id==="terminal-container"||a.id==="terminal-frame"||a.id==="terminal-surface"||a.classList.contains("xterm-helper-textarea")||a.classList.contains("xterm")||a.closest("#terminal-container")||a.closest(".xterm"))return!0;if(typeof document<"u"&&document.activeElement){const i=document.activeElement;if(i.id==="terminal-container"||i.classList.contains("xterm-helper-textarea")||i.closest("#terminal-container")||i.closest(".xterm"))return!0}return!1}function GS(r,a={}){if(typeof window>"u")return()=>{};const i=o=>{var d;o.ctrlKey||o.altKey||o.metaKey||o.key==="Escape"&&(a.isModalOpen||a.isSheetOpen)&&(YS(o)||(o.preventDefault(),o.stopPropagation(),(d=r.onCloseModals)==null||d.call(r)))};return window.addEventListener("keydown",i),()=>{window.removeEventListener("keydown",i)}}function qS(){const[r,a]=x.useState("terminal"),[i,o]=x.useState(!1),[d,f]=x.useState(!1),[m,p]=x.useState(!1),[g,v]=x.useState(void 0),y=E=>{v(E),p(!0)},[w,T]=x.useState(!1),{updateSettings:R,settings:k,connectionState:Y,stateDetail:z,stateCode:I,lastPairedAt:P}=Mt();Ex();const V=KS();x.useEffect(()=>BS(),[]);const[oe,ve]=x.useState(!0);x.useEffect(()=>{let E=!1;return fetch("/api/info",{headers:{Accept:"application/json"}}).then(B=>B.ok?B.json():null).then(B=>{E||!B||ve(!B.isRemoteRelay)}).catch(()=>{}),()=>{E=!0}},[]),x.useEffect(()=>{dg()},[]),x.useEffect(()=>{const E=i||m||w;if(E)return GS({onCloseModals:()=>{o(!1),p(!1),T(!1)}},{isModalOpen:E})},[i,m,w]),x.useEffect(()=>{const E=()=>{const B=window.location.pathname,ee=window.location.hash;a(B==="/admin"||ee==="#admin"?"admin":"terminal")};E(),window.addEventListener("popstate",E),window.addEventListener("hashchange",E);try{const B=new URL(window.location.href),ee=B.searchParams.get("token"),ze=B.searchParams.get("pairCode"),Z=B.searchParams.get("ws")||B.searchParams.get("wsUrl"),Pe={};ee&&(Pe.token=ee),ze&&(Pe.pairCode=ze.toUpperCase()),Z&&(Pe.wsUrl=Z),Object.keys(Pe).length>0&&R(Pe);let je=!1;if(B.searchParams.has("token")&&(B.searchParams.delete("token"),je=!0),B.searchParams.has("pairCode")&&(B.searchParams.delete("pairCode"),je=!0),je){const ue=B.searchParams.toString(),Ge=B.pathname+(ue?`?${ue}`:"")+B.hash;window.history.replaceState({},"",Ge)}}catch(B){console.warn("Failed to parse URL query params:",B)}return()=>{window.removeEventListener("popstate",E),window.removeEventListener("hashchange",E)}},[]);const ne=(E=!1)=>{f(E),o(!0)},X=()=>{o(!1),f(!1)},U=E=>{a(E),E==="admin"?window.history.pushState({},"","/admin"):window.history.pushState({},"","/")},te=!k.token&&!k.pairCode&&Y!=="connected",ae=Y==="error"&&(["auth_required","unauthorized","device_revoked"].includes(I||"")||/auth|unauthor|forbidden|permission|token|pair/i.test(z||"")),ge=te||ae,[Te,Oe]=x.useState(!ge);x.useEffect(()=>{ge||Oe(!0)},[ge]),x.useEffect(()=>{P&&(o(!1),Oe(!0),a("terminal"))},[P]);const st=r==="terminal"&&!ge,Xe=E=>({visibility:E?"visible":"hidden",opacity:E?1:0,pointerEvents:E?"auto":"none",zIndex:E?1:0});return u.jsxs("div",{"data-testid":"app-shell",style:V?{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:E=>{E.preventDefault(),E.stopPropagation()},children:[!V&&u.jsx(E0,{currentView:r,onNavigate:U,showAdminEntry:oe,onOpenPairing:()=>ne(!1),onOpenSettings:()=>y(),onToggleVirtualKeyboard:()=>T(!w),isVirtualKeyboardOpen:w}),!V&&!ge&&u.jsx(k0,{}),u.jsxs("div",{className:"flex-1 min-h-0 w-full overflow-hidden relative",children:[Te&&u.jsxs("div",{"data-testid":"terminal-layer",className:`absolute ${V?"inset-x-0 top-12 bottom-11":"inset-0"} flex flex-col min-h-0 w-full overflow-hidden`,style:Xe(st),"aria-hidden":!st,children:[u.jsx(rS,{isActive:st}),!V&&u.jsx(fS,{isOpen:w,onClose:()=>T(!1)}),u.jsx(uS,{compact:V,onCustomize:()=>y("agentKeymaps")})]}),r==="terminal"&&ge&&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(sS,{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(jS,{onBackToTerminal:()=>U("terminal"),onOpenPairing:()=>ne(!1)})}),V&&st&&u.jsx(DS,{onNavigateAdmin:()=>U("admin"),showAdminEntry:oe,onOpenPairing:()=>ne(!1),onOpenSettings:()=>y(),onAddProfile:()=>ne(!0)})]}),!V&&r!=="admin"&&u.jsx(wS,{onAddProfile:()=>ne(!0)}),u.jsx(mS,{isOpen:i,isAddMode:d,onClose:X}),u.jsx(gS,{isOpen:m,initialTab:g,onClose:()=>p(!1)}),u.jsx(vS,{})]})}function VS(){return u.jsx(px,{children:u.jsx(qS,{})})}const Jg=document.getElementById("root");if(!Jg)throw new Error("Root element not found");fv.createRoot(Jg).render(u.jsx(fl.StrictMode,{children:u.jsx(VS,{})}));