herdr-remote-relay 0.3.25 → 0.3.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,61 @@
1
+ var Ex=Object.defineProperty;var Nx=(l,n,a)=>n in l?Ex(l,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):l[n]=a;var $=(l,n,a)=>Nx(l,typeof n!="symbol"?n+"":n,a);import{r as yb,g as vb,a as xb}from"./vendor-react-CYSfZuHu.js";import{r as kx,a as Lx}from"./vendor-xterm-BhCxil_4.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))s(o);new MutationObserver(o=>{for(const c of o)if(c.type==="childList")for(const h of c.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&s(h)}).observe(document,{childList:!0,subtree:!0});function a(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerPolicy&&(c.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?c.credentials="include":o.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function s(o){if(o.ep)return;o.ep=!0;const c=a(o);fetch(o.href,c)}})();var Fu={exports:{}},rs={};/**
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 Xp;function _x(){if(Xp)return rs;Xp=1;var l=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function a(s,o,c){var h=null;if(c!==void 0&&(h=""+c),o.key!==void 0&&(h=""+o.key),"key"in o){c={};for(var m in o)m!=="key"&&(c[m]=o[m])}else c=o;return o=c.ref,{$$typeof:l,type:s,key:h,ref:o!==void 0?o:null,props:c}}return rs.Fragment=n,rs.jsx=a,rs.jsxs=a,rs}var Zp;function Rx(){return Zp||(Zp=1,Fu.exports=_x()),Fu.exports}var f=Rx(),T=yb();const Jn=vb(T);var Gu={exports:{}},os={},Yu={exports:{}},Pu={};/**
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 Wp;function jx(){return Wp||(Wp=1,(function(l){function n(A,G){var W=A.length;A.push(G);e:for(;0<W;){var se=W-1>>>1,Q=A[se];if(0<o(Q,G))A[se]=G,A[W]=Q,W=se;else break e}}function a(A){return A.length===0?null:A[0]}function s(A){if(A.length===0)return null;var G=A[0],W=A.pop();if(W!==G){A[0]=W;e:for(var se=0,Q=A.length,ge=Q>>>1;se<ge;){var ye=2*(se+1)-1,ue=A[ye],Te=ye+1,ce=A[Te];if(0>o(ue,W))Te<Q&&0>o(ce,ue)?(A[se]=ce,A[Te]=W,se=Te):(A[se]=ue,A[ye]=W,se=ye);else if(Te<Q&&0>o(ce,W))A[se]=ce,A[Te]=W,se=Te;else break e}}return G}function o(A,G){var W=A.sortIndex-G.sortIndex;return W!==0?W:A.id-G.id}if(l.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;l.unstable_now=function(){return c.now()}}else{var h=Date,m=h.now();l.unstable_now=function(){return h.now()-m}}var p=[],g=[],y=1,v=null,x=3,w=!1,S=!1,M=!1,N=!1,L=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;function z(A){for(var G=a(g);G!==null;){if(G.callback===null)s(g);else if(G.startTime<=A)s(g),G.sortIndex=G.expirationTime,n(p,G);else break;G=a(g)}}function R(A){if(M=!1,z(A),!S)if(a(p)!==null)S=!0,D||(D=!0,Z());else{var G=a(g);G!==null&&P(R,G.startTime-A)}}var D=!1,j=-1,H=5,K=-1;function q(){return N?!0:!(l.unstable_now()-K<H)}function te(){if(N=!1,D){var A=l.unstable_now();K=A;var G=!0;try{e:{S=!1,M&&(M=!1,E(j),j=-1),w=!0;var W=x;try{t:{for(z(A),v=a(p);v!==null&&!(v.expirationTime>A&&q());){var se=v.callback;if(typeof se=="function"){v.callback=null,x=v.priorityLevel;var Q=se(v.expirationTime<=A);if(A=l.unstable_now(),typeof Q=="function"){v.callback=Q,z(A),G=!0;break t}v===a(p)&&s(p),z(A)}else s(p);v=a(p)}if(v!==null)G=!0;else{var ge=a(g);ge!==null&&P(R,ge.startTime-A),G=!1}}break e}finally{v=null,x=W,w=!1}G=void 0}}finally{G?Z():D=!1}}}var Z;if(typeof k=="function")Z=function(){k(te)};else if(typeof MessageChannel<"u"){var ie=new MessageChannel,oe=ie.port2;ie.port1.onmessage=te,Z=function(){oe.postMessage(null)}}else Z=function(){L(te,0)};function P(A,G){j=L(function(){A(l.unstable_now())},G)}l.unstable_IdlePriority=5,l.unstable_ImmediatePriority=1,l.unstable_LowPriority=4,l.unstable_NormalPriority=3,l.unstable_Profiling=null,l.unstable_UserBlockingPriority=2,l.unstable_cancelCallback=function(A){A.callback=null},l.unstable_forceFrameRate=function(A){0>A||125<A?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):H=0<A?Math.floor(1e3/A):5},l.unstable_getCurrentPriorityLevel=function(){return x},l.unstable_next=function(A){switch(x){case 1:case 2:case 3:var G=3;break;default:G=x}var W=x;x=G;try{return A()}finally{x=W}},l.unstable_requestPaint=function(){N=!0},l.unstable_runWithPriority=function(A,G){switch(A){case 1:case 2:case 3:case 4:case 5:break;default:A=3}var W=x;x=A;try{return G()}finally{x=W}},l.unstable_scheduleCallback=function(A,G,W){var se=l.unstable_now();switch(typeof W=="object"&&W!==null?(W=W.delay,W=typeof W=="number"&&0<W?se+W:se):W=se,A){case 1:var Q=-1;break;case 2:Q=250;break;case 5:Q=1073741823;break;case 4:Q=1e4;break;default:Q=5e3}return Q=W+Q,A={id:y++,callback:G,priorityLevel:A,startTime:W,expirationTime:Q,sortIndex:-1},W>se?(A.sortIndex=W,n(g,A),a(p)===null&&A===a(g)&&(M?(E(j),j=-1):M=!0,P(R,W-se))):(A.sortIndex=Q,n(p,A),S||w||(S=!0,D||(D=!0,Z()))),A},l.unstable_shouldYield=q,l.unstable_wrapCallback=function(A){var G=x;return function(){var W=x;x=G;try{return A.apply(this,arguments)}finally{x=W}}}})(Pu)),Pu}var Qp;function Ox(){return Qp||(Qp=1,Yu.exports=jx()),Yu.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 Jp;function Dx(){if(Jp)return os;Jp=1;var l=Ox(),n=yb(),a=xb();function s(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)t+="&args[]="+encodeURIComponent(arguments[i])}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 o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function c(e){var t=e,i=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(i=t.return),e=t.return;while(e)}return t.tag===3?i:null}function h(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function m(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function p(e){if(c(e)!==e)throw Error(s(188))}function g(e){var t=e.alternate;if(!t){if(t=c(e),t===null)throw Error(s(188));return t!==e?null:e}for(var i=e,r=t;;){var u=i.return;if(u===null)break;var d=u.alternate;if(d===null){if(r=u.return,r!==null){i=r;continue}break}if(u.child===d.child){for(d=u.child;d;){if(d===i)return p(u),e;if(d===r)return p(u),t;d=d.sibling}throw Error(s(188))}if(i.return!==r.return)i=u,r=d;else{for(var b=!1,C=u.child;C;){if(C===i){b=!0,i=u,r=d;break}if(C===r){b=!0,r=u,i=d;break}C=C.sibling}if(!b){for(C=d.child;C;){if(C===i){b=!0,i=d,r=u;break}if(C===r){b=!0,r=d,i=u;break}C=C.sibling}if(!b)throw Error(s(189))}}if(i.alternate!==r)throw Error(s(190))}if(i.tag!==3)throw Error(s(188));return i.stateNode.current===i?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 v=Object.assign,x=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),k=Symbol.for("react.context"),z=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),j=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),K=Symbol.for("react.activity"),q=Symbol.for("react.memo_cache_sentinel"),te=Symbol.iterator;function Z(e){return e===null||typeof e!="object"?null:(e=te&&e[te]||e["@@iterator"],typeof e=="function"?e:null)}var ie=Symbol.for("react.client.reference");function oe(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ie?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case M:return"Fragment";case L:return"Profiler";case N:return"StrictMode";case R:return"Suspense";case D:return"SuspenseList";case K:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case S:return"Portal";case k:return e.displayName||"Context";case E:return(e._context.displayName||"Context")+".Consumer";case z:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case j:return t=e.displayName||null,t!==null?t:oe(e.type)||"Memo";case H:t=e._payload,e=e._init;try{return oe(e(t))}catch{}}return null}var P=Array.isArray,A=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W={pending:!1,data:null,method:null,action:null},se=[],Q=-1;function ge(e){return{current:e}}function ye(e){0>Q||(e.current=se[Q],se[Q]=null,Q--)}function ue(e,t){Q++,se[Q]=e.current,e.current=t}var Te=ge(null),ce=ge(null),be=ge(null),le=ge(null);function we(e,t){switch(ue(be,t),ue(ce,e),ue(Te,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?yp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=yp(t),e=vp(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}ye(Te),ue(Te,e)}function ae(){ye(Te),ye(ce),ye(be)}function ve(e){e.memoizedState!==null&&ue(le,e);var t=Te.current,i=vp(t,e.type);t!==i&&(ue(ce,e),ue(Te,i))}function Ne(e){ce.current===e&&(ye(Te),ye(ce)),le.current===e&&(ye(le),is._currentValue=W)}var Ie,Xe;function tt(e){if(Ie===void 0)try{throw Error()}catch(i){var t=i.stack.trim().match(/\n( *(at )?)/);Ie=t&&t[1]||"",Xe=-1<i.stack.indexOf(`
26
+ at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
27
+ `+Ie+e+Xe}var xe=!1;function Ae(e,t){if(!e||xe)return"";xe=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var ee=function(){throw Error()};if(Object.defineProperty(ee.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ee,[])}catch(V){var Y=V}Reflect.construct(e,[],ee)}else{try{ee.call()}catch(V){Y=V}e.call(ee.prototype)}}else{try{throw Error()}catch(V){Y=V}(ee=e())&&typeof ee.catch=="function"&&ee.catch(function(){})}}catch(V){if(V&&Y&&typeof V.stack=="string")return[V.stack,Y.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var d=r.DetermineComponentFrameRoot(),b=d[0],C=d[1];if(b&&C){var _=b.split(`
28
+ `),F=C.split(`
29
+ `);for(u=r=0;r<_.length&&!_[r].includes("DetermineComponentFrameRoot");)r++;for(;u<F.length&&!F[u].includes("DetermineComponentFrameRoot");)u++;if(r===_.length||u===F.length)for(r=_.length-1,u=F.length-1;1<=r&&0<=u&&_[r]!==F[u];)u--;for(;1<=r&&0<=u;r--,u--)if(_[r]!==F[u]){if(r!==1||u!==1)do if(r--,u--,0>u||_[r]!==F[u]){var X=`
30
+ `+_[r].replace(" at new "," at ");return e.displayName&&X.includes("<anonymous>")&&(X=X.replace("<anonymous>",e.displayName)),X}while(1<=r&&0<=u);break}}}finally{xe=!1,Error.prepareStackTrace=i}return(i=e?e.displayName||e.name:"")?tt(i):""}function rt(e,t){switch(e.tag){case 26:case 27:case 5:return tt(e.type);case 16:return tt("Lazy");case 13:return e.child!==t&&t!==null?tt("Suspense Fallback"):tt("Suspense");case 19:return tt("SuspenseList");case 0:case 15:return Ae(e.type,!1);case 11:return Ae(e.type.render,!1);case 1:return Ae(e.type,!0);case 31:return tt("Activity");default:return""}}function it(e){try{var t="",i=null;do t+=rt(e,i),i=e,e=e.return;while(e);return t}catch(r){return`
31
+ Error generating stack: `+r.message+`
32
+ `+r.stack}}var bt=Object.prototype.hasOwnProperty,yn=l.unstable_scheduleCallback,vn=l.unstable_cancelCallback,kn=l.unstable_shouldYield,Zt=l.unstable_requestPaint,ut=l.unstable_now,Ls=l.unstable_getCurrentPriorityLevel,ha=l.unstable_ImmediatePriority,ma=l.unstable_UserBlockingPriority,Di=l.unstable_NormalPriority,_s=l.unstable_LowPriority,pa=l.unstable_IdlePriority,Rs=l.log,js=l.unstable_setDisableYieldValue,ti=null,At=null;function xn(e){if(typeof Rs=="function"&&js(e),At&&typeof At.setStrictMode=="function")try{At.setStrictMode(ti,e)}catch{}}var kt=Math.clz32?Math.clz32:qe,Os=Math.log,de=Math.LN2;function qe(e){return e>>>=0,e===0?32:31-(Os(e)/de|0)|0}var Lt=256,It=262144,cl=4194304;function Ln(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 ul(e,t,i){var r=e.pendingLanes;if(r===0)return 0;var u=0,d=e.suspendedLanes,b=e.pingedLanes;e=e.warmLanes;var C=r&134217727;return C!==0?(r=C&~d,r!==0?u=Ln(r):(b&=C,b!==0?u=Ln(b):i||(i=C&~e,i!==0&&(u=Ln(i))))):(C=r&~d,C!==0?u=Ln(C):b!==0?u=Ln(b):i||(i=r&~e,i!==0&&(u=Ln(i)))),u===0?0:t!==0&&t!==u&&(t&d)===0&&(d=u&-u,i=t&-t,d>=i||d===32&&(i&4194048)!==0)?t:u}function ni(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function ko(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 ga(){var e=cl;return cl<<=1,(cl&62914560)===0&&(cl=4194304),e}function Lo(e){for(var t=[],i=0;31>i;i++)t.push(e);return t}function ba(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function p0(e,t,i,r,u,d){var b=e.pendingLanes;e.pendingLanes=i,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=i,e.entangledLanes&=i,e.errorRecoveryDisabledLanes&=i,e.shellSuspendCounter=0;var C=e.entanglements,_=e.expirationTimes,F=e.hiddenUpdates;for(i=b&~i;0<i;){var X=31-kt(i),ee=1<<X;C[X]=0,_[X]=-1;var Y=F[X];if(Y!==null)for(F[X]=null,X=0;X<Y.length;X++){var V=Y[X];V!==null&&(V.lane&=-536870913)}i&=~ee}r!==0&&Jd(e,r,0),d!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=d&~(b&~t))}function Jd(e,t,i){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-kt(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|i&261930}function ef(e,t){var i=e.entangledLanes|=t;for(e=e.entanglements;i;){var r=31-kt(i),u=1<<r;u&t|e[r]&t&&(e[r]|=t),i&=~u}}function tf(e,t){var i=t&-t;return i=(i&42)!==0?1:_o(i),(i&(e.suspendedLanes|t))!==0?0:i}function _o(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 Ro(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function nf(){var e=G.p;return e!==0?e:(e=window.event,e===void 0?32:Fp(e.type))}function lf(e,t){var i=G.p;try{return G.p=e,t()}finally{G.p=i}}var ii=Math.random().toString(36).slice(2),wt="__reactFiber$"+ii,jt="__reactProps$"+ii,dl="__reactContainer$"+ii,jo="__reactEvents$"+ii,g0="__reactListeners$"+ii,b0="__reactHandles$"+ii,af="__reactResources$"+ii,ya="__reactMarker$"+ii;function Oo(e){delete e[wt],delete e[jt],delete e[jo],delete e[g0],delete e[b0]}function fl(e){var t=e[wt];if(t)return t;for(var i=e.parentNode;i;){if(t=i[dl]||i[wt]){if(i=t.alternate,t.child!==null||i!==null&&i.child!==null)for(e=Ap(e);e!==null;){if(i=e[wt])return i;e=Ap(e)}return t}e=i,i=e.parentNode}return null}function hl(e){if(e=e[wt]||e[dl]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function va(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(s(33))}function ml(e){var t=e[af];return t||(t=e[af]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function yt(e){e[ya]=!0}var sf=new Set,rf={};function zi(e,t){pl(e,t),pl(e+"Capture",t)}function pl(e,t){for(rf[e]=t,e=0;e<t.length;e++)sf.add(t[e])}var y0=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]*$"),of={},cf={};function v0(e){return bt.call(cf,e)?!0:bt.call(of,e)?!1:y0.test(e)?cf[e]=!0:(of[e]=!0,!1)}function Ds(e,t,i){if(v0(t))if(i===null)e.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var r=t.toLowerCase().slice(0,5);if(r!=="data-"&&r!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+i)}}function zs(e,t,i){if(i===null)e.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+i)}}function _n(e,t,i,r){if(r===null)e.removeAttribute(i);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(i);return}e.setAttributeNS(t,i,""+r)}}function Wt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function uf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function x0(e,t,i){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var u=r.get,d=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return u.call(this)},set:function(b){i=""+b,d.call(this,b)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return i},setValue:function(b){i=""+b},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Do(e){if(!e._valueTracker){var t=uf(e)?"checked":"value";e._valueTracker=x0(e,t,""+e[t])}}function df(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),r="";return e&&(r=uf(e)?e.checked?"true":"false":e.value),e=r,e!==i?(t.setValue(e),!0):!1}function Hs(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 w0=/[\n"\\]/g;function Qt(e){return e.replace(w0,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function zo(e,t,i,r,u,d,b,C){e.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.type=b:e.removeAttribute("type"),t!=null?b==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Wt(t)):e.value!==""+Wt(t)&&(e.value=""+Wt(t)):b!=="submit"&&b!=="reset"||e.removeAttribute("value"),t!=null?Ho(e,b,Wt(t)):i!=null?Ho(e,b,Wt(i)):r!=null&&e.removeAttribute("value"),u==null&&d!=null&&(e.defaultChecked=!!d),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?e.name=""+Wt(C):e.removeAttribute("name")}function ff(e,t,i,r,u,d,b,C){if(d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(e.type=d),t!=null||i!=null){if(!(d!=="submit"&&d!=="reset"||t!=null)){Do(e);return}i=i!=null?""+Wt(i):"",t=t!=null?""+Wt(t):i,C||t===e.value||(e.value=t),e.defaultValue=t}r=r??u,r=typeof r!="function"&&typeof r!="symbol"&&!!r,e.checked=C?e.checked:!!r,e.defaultChecked=!!r,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(e.name=b),Do(e)}function Ho(e,t,i){t==="number"&&Hs(e.ownerDocument)===e||e.defaultValue===""+i||(e.defaultValue=""+i)}function gl(e,t,i,r){if(e=e.options,t){t={};for(var u=0;u<i.length;u++)t["$"+i[u]]=!0;for(i=0;i<e.length;i++)u=t.hasOwnProperty("$"+e[i].value),e[i].selected!==u&&(e[i].selected=u),u&&r&&(e[i].defaultSelected=!0)}else{for(i=""+Wt(i),t=null,u=0;u<e.length;u++){if(e[u].value===i){e[u].selected=!0,r&&(e[u].defaultSelected=!0);return}t!==null||e[u].disabled||(t=e[u])}t!==null&&(t.selected=!0)}}function hf(e,t,i){if(t!=null&&(t=""+Wt(t),t!==e.value&&(e.value=t),i==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=i!=null?""+Wt(i):""}function mf(e,t,i,r){if(t==null){if(r!=null){if(i!=null)throw Error(s(92));if(P(r)){if(1<r.length)throw Error(s(93));r=r[0]}i=r}i==null&&(i=""),t=i}i=Wt(t),e.defaultValue=i,r=e.textContent,r===i&&r!==""&&r!==null&&(e.value=r),Do(e)}function bl(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=t;return}}e.textContent=t}var S0=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 pf(e,t,i){var r=t.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?r?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":r?e.setProperty(t,i):typeof i!="number"||i===0||S0.has(t)?t==="float"?e.cssFloat=i:e[t]=(""+i).trim():e[t]=i+"px"}function gf(e,t,i){if(t!=null&&typeof t!="object")throw Error(s(62));if(e=e.style,i!=null){for(var r in i)!i.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf("--")===0?e.setProperty(r,""):r==="float"?e.cssFloat="":e[r]="");for(var u in t)r=t[u],t.hasOwnProperty(u)&&i[u]!==r&&pf(e,u,r)}else for(var d in t)t.hasOwnProperty(d)&&pf(e,d,t[d])}function Bo(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 C0=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"]]),T0=/^[\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 Bs(e){return T0.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Rn(){}var Uo=null;function Ko(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var yl=null,vl=null;function bf(e){var t=hl(e);if(t&&(e=t.stateNode)){var i=e[jt]||null;e:switch(e=t.stateNode,t.type){case"input":if(zo(e,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),t=i.name,i.type==="radio"&&t!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+Qt(""+t)+'"][type="radio"]'),t=0;t<i.length;t++){var r=i[t];if(r!==e&&r.form===e.form){var u=r[jt]||null;if(!u)throw Error(s(90));zo(r,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(t=0;t<i.length;t++)r=i[t],r.form===e.form&&df(r)}break e;case"textarea":hf(e,i.value,i.defaultValue);break e;case"select":t=i.value,t!=null&&gl(e,!!i.multiple,t,!1)}}}var Io=!1;function yf(e,t,i){if(Io)return e(t,i);Io=!0;try{var r=e(t);return r}finally{if(Io=!1,(yl!==null||vl!==null)&&(Mr(),yl&&(t=yl,e=vl,vl=yl=null,bf(t),e)))for(t=0;t<e.length;t++)bf(e[t])}}function xa(e,t){var i=e.stateNode;if(i===null)return null;var r=i[jt]||null;if(r===null)return null;i=r[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":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(s(231,t,typeof i));return i}var jn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Fo=!1;if(jn)try{var wa={};Object.defineProperty(wa,"passive",{get:function(){Fo=!0}}),window.addEventListener("test",wa,wa),window.removeEventListener("test",wa,wa)}catch{Fo=!1}var li=null,Go=null,Us=null;function vf(){if(Us)return Us;var e,t=Go,i=t.length,r,u="value"in li?li.value:li.textContent,d=u.length;for(e=0;e<i&&t[e]===u[e];e++);var b=i-e;for(r=1;r<=b&&t[i-r]===u[d-r];r++);return Us=u.slice(e,1<r?1-r:void 0)}function Ks(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 Is(){return!0}function xf(){return!1}function Ot(e){function t(i,r,u,d,b){this._reactName=i,this._targetInst=u,this.type=r,this.nativeEvent=d,this.target=b,this.currentTarget=null;for(var C in e)e.hasOwnProperty(C)&&(i=e[C],this[C]=i?i(d):d[C]);return this.isDefaultPrevented=(d.defaultPrevented!=null?d.defaultPrevented:d.returnValue===!1)?Is:xf,this.isPropagationStopped=xf,this}return v(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=Is)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=Is)},persist:function(){},isPersistent:Is}),t}var Hi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Fs=Ot(Hi),Sa=v({},Hi,{view:0,detail:0}),M0=Ot(Sa),Yo,Po,Ca,Gs=v({},Sa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Vo,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!==Ca&&(Ca&&e.type==="mousemove"?(Yo=e.screenX-Ca.screenX,Po=e.screenY-Ca.screenY):Po=Yo=0,Ca=e),Yo)},movementY:function(e){return"movementY"in e?e.movementY:Po}}),wf=Ot(Gs),A0=v({},Gs,{dataTransfer:0}),E0=Ot(A0),N0=v({},Sa,{relatedTarget:0}),$o=Ot(N0),k0=v({},Hi,{animationName:0,elapsedTime:0,pseudoElement:0}),L0=Ot(k0),_0=v({},Hi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),R0=Ot(_0),j0=v({},Hi,{data:0}),Sf=Ot(j0),O0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},D0={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"},z0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function H0(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=z0[e])?!!t[e]:!1}function Vo(){return H0}var B0=v({},Sa,{key:function(e){if(e.key){var t=O0[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Ks(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?D0[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Vo,charCode:function(e){return e.type==="keypress"?Ks(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ks(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),U0=Ot(B0),K0=v({},Gs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Cf=Ot(K0),I0=v({},Sa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Vo}),F0=Ot(I0),G0=v({},Hi,{propertyName:0,elapsedTime:0,pseudoElement:0}),Y0=Ot(G0),P0=v({},Gs,{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}),$0=Ot(P0),V0=v({},Hi,{newState:0,oldState:0}),q0=Ot(V0),X0=[9,13,27,32],qo=jn&&"CompositionEvent"in window,Ta=null;jn&&"documentMode"in document&&(Ta=document.documentMode);var Z0=jn&&"TextEvent"in window&&!Ta,Tf=jn&&(!qo||Ta&&8<Ta&&11>=Ta),Mf=" ",Af=!1;function Ef(e,t){switch(e){case"keyup":return X0.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Nf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var xl=!1;function W0(e,t){switch(e){case"compositionend":return Nf(t);case"keypress":return t.which!==32?null:(Af=!0,Mf);case"textInput":return e=t.data,e===Mf&&Af?null:e;default:return null}}function Q0(e,t){if(xl)return e==="compositionend"||!qo&&Ef(e,t)?(e=vf(),Us=Go=li=null,xl=!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 Tf&&t.locale!=="ko"?null:t.data;default:return null}}var J0={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 kf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!J0[e.type]:t==="textarea"}function Lf(e,t,i,r){yl?vl?vl.push(r):vl=[r]:yl=r,t=Rr(t,"onChange"),0<t.length&&(i=new Fs("onChange","change",null,i,r),e.push({event:i,listeners:t}))}var Ma=null,Aa=null;function ev(e){fp(e,0)}function Ys(e){var t=va(e);if(df(t))return e}function _f(e,t){if(e==="change")return t}var Rf=!1;if(jn){var Xo;if(jn){var Zo="oninput"in document;if(!Zo){var jf=document.createElement("div");jf.setAttribute("oninput","return;"),Zo=typeof jf.oninput=="function"}Xo=Zo}else Xo=!1;Rf=Xo&&(!document.documentMode||9<document.documentMode)}function Of(){Ma&&(Ma.detachEvent("onpropertychange",Df),Aa=Ma=null)}function Df(e){if(e.propertyName==="value"&&Ys(Aa)){var t=[];Lf(t,Aa,e,Ko(e)),yf(ev,t)}}function tv(e,t,i){e==="focusin"?(Of(),Ma=t,Aa=i,Ma.attachEvent("onpropertychange",Df)):e==="focusout"&&Of()}function nv(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ys(Aa)}function iv(e,t){if(e==="click")return Ys(t)}function lv(e,t){if(e==="input"||e==="change")return Ys(t)}function av(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ft=typeof Object.is=="function"?Object.is:av;function Ea(e,t){if(Ft(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var i=Object.keys(e),r=Object.keys(t);if(i.length!==r.length)return!1;for(r=0;r<i.length;r++){var u=i[r];if(!bt.call(t,u)||!Ft(e[u],t[u]))return!1}return!0}function zf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Hf(e,t){var i=zf(e);e=0;for(var r;i;){if(i.nodeType===3){if(r=e+i.textContent.length,e<=t&&r>=t)return{node:i,offset:t-e};e=r}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=zf(i)}}function Bf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Bf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Uf(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Hs(e.document);t instanceof e.HTMLIFrameElement;){try{var i=typeof t.contentWindow.location.href=="string"}catch{i=!1}if(i)e=t.contentWindow;else break;t=Hs(e.document)}return t}function Wo(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 sv=jn&&"documentMode"in document&&11>=document.documentMode,wl=null,Qo=null,Na=null,Jo=!1;function Kf(e,t,i){var r=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;Jo||wl==null||wl!==Hs(r)||(r=wl,"selectionStart"in r&&Wo(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Na&&Ea(Na,r)||(Na=r,r=Rr(Qo,"onSelect"),0<r.length&&(t=new Fs("onSelect","select",null,t,i),e.push({event:t,listeners:r}),t.target=wl)))}function Bi(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var Sl={animationend:Bi("Animation","AnimationEnd"),animationiteration:Bi("Animation","AnimationIteration"),animationstart:Bi("Animation","AnimationStart"),transitionrun:Bi("Transition","TransitionRun"),transitionstart:Bi("Transition","TransitionStart"),transitioncancel:Bi("Transition","TransitionCancel"),transitionend:Bi("Transition","TransitionEnd")},ec={},If={};jn&&(If=document.createElement("div").style,"AnimationEvent"in window||(delete Sl.animationend.animation,delete Sl.animationiteration.animation,delete Sl.animationstart.animation),"TransitionEvent"in window||delete Sl.transitionend.transition);function Ui(e){if(ec[e])return ec[e];if(!Sl[e])return e;var t=Sl[e],i;for(i in t)if(t.hasOwnProperty(i)&&i in If)return ec[e]=t[i];return e}var Ff=Ui("animationend"),Gf=Ui("animationiteration"),Yf=Ui("animationstart"),rv=Ui("transitionrun"),ov=Ui("transitionstart"),cv=Ui("transitioncancel"),Pf=Ui("transitionend"),$f=new Map,tc="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(" ");tc.push("scrollEnd");function fn(e,t){$f.set(e,t),zi(t,[e])}var Ps=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)},Jt=[],Cl=0,nc=0;function $s(){for(var e=Cl,t=nc=Cl=0;t<e;){var i=Jt[t];Jt[t++]=null;var r=Jt[t];Jt[t++]=null;var u=Jt[t];Jt[t++]=null;var d=Jt[t];if(Jt[t++]=null,r!==null&&u!==null){var b=r.pending;b===null?u.next=u:(u.next=b.next,b.next=u),r.pending=u}d!==0&&Vf(i,u,d)}}function Vs(e,t,i,r){Jt[Cl++]=e,Jt[Cl++]=t,Jt[Cl++]=i,Jt[Cl++]=r,nc|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function ic(e,t,i,r){return Vs(e,t,i,r),qs(e)}function Ki(e,t){return Vs(e,null,null,t),qs(e)}function Vf(e,t,i){e.lanes|=i;var r=e.alternate;r!==null&&(r.lanes|=i);for(var u=!1,d=e.return;d!==null;)d.childLanes|=i,r=d.alternate,r!==null&&(r.childLanes|=i),d.tag===22&&(e=d.stateNode,e===null||e._visibility&1||(u=!0)),e=d,d=d.return;return e.tag===3?(d=e.stateNode,u&&t!==null&&(u=31-kt(i),e=d.hiddenUpdates,r=e[u],r===null?e[u]=[t]:r.push(t),t.lane=i|536870912),d):null}function qs(e){if(50<Za)throw Za=0,fu=null,Error(s(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Tl={};function uv(e,t,i,r){this.tag=e,this.key=i,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=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Gt(e,t,i,r){return new uv(e,t,i,r)}function lc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function On(e,t){var i=e.alternate;return i===null?(i=Gt(e.tag,t,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=t,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&65011712,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,t=e.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i.refCleanup=e.refCleanup,i}function qf(e,t){e.flags&=65011714;var i=e.alternate;return i===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=i.childLanes,e.lanes=i.lanes,e.child=i.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=i.memoizedProps,e.memoizedState=i.memoizedState,e.updateQueue=i.updateQueue,e.type=i.type,t=i.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Xs(e,t,i,r,u,d){var b=0;if(r=e,typeof e=="function")lc(e)&&(b=1);else if(typeof e=="string")b=px(e,i,Te.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case K:return e=Gt(31,i,t,u),e.elementType=K,e.lanes=d,e;case M:return Ii(i.children,u,d,t);case N:b=8,u|=24;break;case L:return e=Gt(12,i,t,u|2),e.elementType=L,e.lanes=d,e;case R:return e=Gt(13,i,t,u),e.elementType=R,e.lanes=d,e;case D:return e=Gt(19,i,t,u),e.elementType=D,e.lanes=d,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case k:b=10;break e;case E:b=9;break e;case z:b=11;break e;case j:b=14;break e;case H:b=16,r=null;break e}b=29,i=Error(s(130,e===null?"null":typeof e,"")),r=null}return t=Gt(b,i,t,u),t.elementType=e,t.type=r,t.lanes=d,t}function Ii(e,t,i,r){return e=Gt(7,e,r,t),e.lanes=i,e}function ac(e,t,i){return e=Gt(6,e,null,t),e.lanes=i,e}function Xf(e){var t=Gt(18,null,null,0);return t.stateNode=e,t}function sc(e,t,i){return t=Gt(4,e.children!==null?e.children:[],e.key,t),t.lanes=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Zf=new WeakMap;function en(e,t){if(typeof e=="object"&&e!==null){var i=Zf.get(e);return i!==void 0?i:(t={value:e,source:t,stack:it(t)},Zf.set(e,t),t)}return{value:e,source:t,stack:it(t)}}var Ml=[],Al=0,Zs=null,ka=0,tn=[],nn=0,ai=null,wn=1,Sn="";function Dn(e,t){Ml[Al++]=ka,Ml[Al++]=Zs,Zs=e,ka=t}function Wf(e,t,i){tn[nn++]=wn,tn[nn++]=Sn,tn[nn++]=ai,ai=e;var r=wn;e=Sn;var u=32-kt(r)-1;r&=~(1<<u),i+=1;var d=32-kt(t)+u;if(30<d){var b=u-u%5;d=(r&(1<<b)-1).toString(32),r>>=b,u-=b,wn=1<<32-kt(t)+u|i<<u|r,Sn=d+e}else wn=1<<d|i<<u|r,Sn=e}function rc(e){e.return!==null&&(Dn(e,1),Wf(e,1,0))}function oc(e){for(;e===Zs;)Zs=Ml[--Al],Ml[Al]=null,ka=Ml[--Al],Ml[Al]=null;for(;e===ai;)ai=tn[--nn],tn[nn]=null,Sn=tn[--nn],tn[nn]=null,wn=tn[--nn],tn[nn]=null}function Qf(e,t){tn[nn++]=wn,tn[nn++]=Sn,tn[nn++]=ai,wn=t.id,Sn=t.overflow,ai=e}var St=null,Ze=null,He=!1,si=null,ln=!1,cc=Error(s(519));function ri(e){var t=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw La(en(t,e)),cc}function Jf(e){var t=e.stateNode,i=e.type,r=e.memoizedProps;switch(t[wt]=e,t[jt]=r,i){case"dialog":Oe("cancel",t),Oe("close",t);break;case"iframe":case"object":case"embed":Oe("load",t);break;case"video":case"audio":for(i=0;i<Qa.length;i++)Oe(Qa[i],t);break;case"source":Oe("error",t);break;case"img":case"image":case"link":Oe("error",t),Oe("load",t);break;case"details":Oe("toggle",t);break;case"input":Oe("invalid",t),ff(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case"select":Oe("invalid",t);break;case"textarea":Oe("invalid",t),mf(t,r.value,r.defaultValue,r.children)}i=r.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||t.textContent===""+i||r.suppressHydrationWarning===!0||gp(t.textContent,i)?(r.popover!=null&&(Oe("beforetoggle",t),Oe("toggle",t)),r.onScroll!=null&&Oe("scroll",t),r.onScrollEnd!=null&&Oe("scrollend",t),r.onClick!=null&&(t.onclick=Rn),t=!0):t=!1,t||ri(e,!0)}function eh(e){for(St=e.return;St;)switch(St.tag){case 5:case 31:case 13:ln=!1;return;case 27:case 3:ln=!0;return;default:St=St.return}}function El(e){if(e!==St)return!1;if(!He)return eh(e),He=!0,!1;var t=e.tag,i;if((i=t!==3&&t!==27)&&((i=t===5)&&(i=e.type,i=!(i!=="form"&&i!=="button")||Eu(e.type,e.memoizedProps)),i=!i),i&&Ze&&ri(e),eh(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(317));Ze=Mp(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(317));Ze=Mp(e)}else t===27?(t=Ze,wi(e.type)?(e=Ru,Ru=null,Ze=e):Ze=t):Ze=St?sn(e.stateNode.nextSibling):null;return!0}function Fi(){Ze=St=null,He=!1}function uc(){var e=si;return e!==null&&(Bt===null?Bt=e:Bt.push.apply(Bt,e),si=null),e}function La(e){si===null?si=[e]:si.push(e)}var dc=ge(null),Gi=null,zn=null;function oi(e,t,i){ue(dc,t._currentValue),t._currentValue=i}function Hn(e){e._currentValue=dc.current,ye(dc)}function fc(e,t,i){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===i)break;e=e.return}}function hc(e,t,i,r){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var d=u.dependencies;if(d!==null){var b=u.child;d=d.firstContext;e:for(;d!==null;){var C=d;d=u;for(var _=0;_<t.length;_++)if(C.context===t[_]){d.lanes|=i,C=d.alternate,C!==null&&(C.lanes|=i),fc(d.return,i,e),r||(b=null);break e}d=C.next}}else if(u.tag===18){if(b=u.return,b===null)throw Error(s(341));b.lanes|=i,d=b.alternate,d!==null&&(d.lanes|=i),fc(b,i,e),b=null}else b=u.child;if(b!==null)b.return=u;else for(b=u;b!==null;){if(b===e){b=null;break}if(u=b.sibling,u!==null){u.return=b.return,b=u;break}b=b.return}u=b}}function Nl(e,t,i,r){e=null;for(var u=t,d=!1;u!==null;){if(!d){if((u.flags&524288)!==0)d=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var b=u.alternate;if(b===null)throw Error(s(387));if(b=b.memoizedProps,b!==null){var C=u.type;Ft(u.pendingProps.value,b.value)||(e!==null?e.push(C):e=[C])}}else if(u===le.current){if(b=u.alternate,b===null)throw Error(s(387));b.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(is):e=[is])}u=u.return}e!==null&&hc(t,e,i,r),t.flags|=262144}function Ws(e){for(e=e.firstContext;e!==null;){if(!Ft(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Yi(e){Gi=e,zn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Ct(e){return th(Gi,e)}function Qs(e,t){return Gi===null&&Yi(e),th(e,t)}function th(e,t){var i=t._currentValue;if(t={context:t,memoizedValue:i,next:null},zn===null){if(e===null)throw Error(s(308));zn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else zn=zn.next=t;return i}var dv=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(i,r){e.push(r)}};this.abort=function(){t.aborted=!0,e.forEach(function(i){return i()})}},fv=l.unstable_scheduleCallback,hv=l.unstable_NormalPriority,dt={$$typeof:k,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function mc(){return{controller:new dv,data:new Map,refCount:0}}function _a(e){e.refCount--,e.refCount===0&&fv(hv,function(){e.controller.abort()})}var Ra=null,pc=0,kl=0,Ll=null;function mv(e,t){if(Ra===null){var i=Ra=[];pc=0,kl=yu(),Ll={status:"pending",value:void 0,then:function(r){i.push(r)}}}return pc++,t.then(nh,nh),t}function nh(){if(--pc===0&&Ra!==null){Ll!==null&&(Ll.status="fulfilled");var e=Ra;Ra=null,kl=0,Ll=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function pv(e,t){var i=[],r={status:"pending",value:null,reason:null,then:function(u){i.push(u)}};return e.then(function(){r.status="fulfilled",r.value=t;for(var u=0;u<i.length;u++)(0,i[u])(t)},function(u){for(r.status="rejected",r.reason=u,u=0;u<i.length;u++)(0,i[u])(void 0)}),r}var ih=A.S;A.S=function(e,t){Km=ut(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&mv(e,t),ih!==null&&ih(e,t)};var Pi=ge(null);function gc(){var e=Pi.current;return e!==null?e:Ve.pooledCache}function Js(e,t){t===null?ue(Pi,Pi.current):ue(Pi,t.pool)}function lh(){var e=gc();return e===null?null:{parent:dt._currentValue,pool:e}}var _l=Error(s(460)),bc=Error(s(474)),er=Error(s(542)),tr={then:function(){}};function ah(e){return e=e.status,e==="fulfilled"||e==="rejected"}function sh(e,t,i){switch(i=e[i],i===void 0?e.push(t):i!==t&&(t.then(Rn,Rn),t=i),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,oh(e),e;default:if(typeof t.status=="string")t.then(Rn,Rn);else{if(e=Ve,e!==null&&100<e.shellSuspendCounter)throw Error(s(482));e=t,e.status="pending",e.then(function(r){if(t.status==="pending"){var u=t;u.status="fulfilled",u.value=r}},function(r){if(t.status==="pending"){var u=t;u.status="rejected",u.reason=r}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,oh(e),e}throw Vi=t,_l}}function $i(e){try{var t=e._init;return t(e._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(Vi=i,_l):i}}var Vi=null;function rh(){if(Vi===null)throw Error(s(459));var e=Vi;return Vi=null,e}function oh(e){if(e===_l||e===er)throw Error(s(483))}var Rl=null,ja=0;function nr(e){var t=ja;return ja+=1,Rl===null&&(Rl=[]),sh(Rl,e,t)}function Oa(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function ir(e,t){throw t.$$typeof===x?Error(s(525)):(e=Object.prototype.toString.call(t),Error(s(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function ch(e){function t(U,O){if(e){var I=U.deletions;I===null?(U.deletions=[O],U.flags|=16):I.push(O)}}function i(U,O){if(!e)return null;for(;O!==null;)t(U,O),O=O.sibling;return null}function r(U){for(var O=new Map;U!==null;)U.key!==null?O.set(U.key,U):O.set(U.index,U),U=U.sibling;return O}function u(U,O){return U=On(U,O),U.index=0,U.sibling=null,U}function d(U,O,I){return U.index=I,e?(I=U.alternate,I!==null?(I=I.index,I<O?(U.flags|=67108866,O):I):(U.flags|=67108866,O)):(U.flags|=1048576,O)}function b(U){return e&&U.alternate===null&&(U.flags|=67108866),U}function C(U,O,I,J){return O===null||O.tag!==6?(O=ac(I,U.mode,J),O.return=U,O):(O=u(O,I),O.return=U,O)}function _(U,O,I,J){var Se=I.type;return Se===M?X(U,O,I.props.children,J,I.key):O!==null&&(O.elementType===Se||typeof Se=="object"&&Se!==null&&Se.$$typeof===H&&$i(Se)===O.type)?(O=u(O,I.props),Oa(O,I),O.return=U,O):(O=Xs(I.type,I.key,I.props,null,U.mode,J),Oa(O,I),O.return=U,O)}function F(U,O,I,J){return O===null||O.tag!==4||O.stateNode.containerInfo!==I.containerInfo||O.stateNode.implementation!==I.implementation?(O=sc(I,U.mode,J),O.return=U,O):(O=u(O,I.children||[]),O.return=U,O)}function X(U,O,I,J,Se){return O===null||O.tag!==7?(O=Ii(I,U.mode,J,Se),O.return=U,O):(O=u(O,I),O.return=U,O)}function ee(U,O,I){if(typeof O=="string"&&O!==""||typeof O=="number"||typeof O=="bigint")return O=ac(""+O,U.mode,I),O.return=U,O;if(typeof O=="object"&&O!==null){switch(O.$$typeof){case w:return I=Xs(O.type,O.key,O.props,null,U.mode,I),Oa(I,O),I.return=U,I;case S:return O=sc(O,U.mode,I),O.return=U,O;case H:return O=$i(O),ee(U,O,I)}if(P(O)||Z(O))return O=Ii(O,U.mode,I,null),O.return=U,O;if(typeof O.then=="function")return ee(U,nr(O),I);if(O.$$typeof===k)return ee(U,Qs(U,O),I);ir(U,O)}return null}function Y(U,O,I,J){var Se=O!==null?O.key:null;if(typeof I=="string"&&I!==""||typeof I=="number"||typeof I=="bigint")return Se!==null?null:C(U,O,""+I,J);if(typeof I=="object"&&I!==null){switch(I.$$typeof){case w:return I.key===Se?_(U,O,I,J):null;case S:return I.key===Se?F(U,O,I,J):null;case H:return I=$i(I),Y(U,O,I,J)}if(P(I)||Z(I))return Se!==null?null:X(U,O,I,J,null);if(typeof I.then=="function")return Y(U,O,nr(I),J);if(I.$$typeof===k)return Y(U,O,Qs(U,I),J);ir(U,I)}return null}function V(U,O,I,J,Se){if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return U=U.get(I)||null,C(O,U,""+J,Se);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case w:return U=U.get(J.key===null?I:J.key)||null,_(O,U,J,Se);case S:return U=U.get(J.key===null?I:J.key)||null,F(O,U,J,Se);case H:return J=$i(J),V(U,O,I,J,Se)}if(P(J)||Z(J))return U=U.get(I)||null,X(O,U,J,Se,null);if(typeof J.then=="function")return V(U,O,I,nr(J),Se);if(J.$$typeof===k)return V(U,O,I,Qs(O,J),Se);ir(O,J)}return null}function me(U,O,I,J){for(var Se=null,Be=null,pe=O,_e=O=0,ze=null;pe!==null&&_e<I.length;_e++){pe.index>_e?(ze=pe,pe=null):ze=pe.sibling;var Ue=Y(U,pe,I[_e],J);if(Ue===null){pe===null&&(pe=ze);break}e&&pe&&Ue.alternate===null&&t(U,pe),O=d(Ue,O,_e),Be===null?Se=Ue:Be.sibling=Ue,Be=Ue,pe=ze}if(_e===I.length)return i(U,pe),He&&Dn(U,_e),Se;if(pe===null){for(;_e<I.length;_e++)pe=ee(U,I[_e],J),pe!==null&&(O=d(pe,O,_e),Be===null?Se=pe:Be.sibling=pe,Be=pe);return He&&Dn(U,_e),Se}for(pe=r(pe);_e<I.length;_e++)ze=V(pe,U,_e,I[_e],J),ze!==null&&(e&&ze.alternate!==null&&pe.delete(ze.key===null?_e:ze.key),O=d(ze,O,_e),Be===null?Se=ze:Be.sibling=ze,Be=ze);return e&&pe.forEach(function(Ai){return t(U,Ai)}),He&&Dn(U,_e),Se}function Ce(U,O,I,J){if(I==null)throw Error(s(151));for(var Se=null,Be=null,pe=O,_e=O=0,ze=null,Ue=I.next();pe!==null&&!Ue.done;_e++,Ue=I.next()){pe.index>_e?(ze=pe,pe=null):ze=pe.sibling;var Ai=Y(U,pe,Ue.value,J);if(Ai===null){pe===null&&(pe=ze);break}e&&pe&&Ai.alternate===null&&t(U,pe),O=d(Ai,O,_e),Be===null?Se=Ai:Be.sibling=Ai,Be=Ai,pe=ze}if(Ue.done)return i(U,pe),He&&Dn(U,_e),Se;if(pe===null){for(;!Ue.done;_e++,Ue=I.next())Ue=ee(U,Ue.value,J),Ue!==null&&(O=d(Ue,O,_e),Be===null?Se=Ue:Be.sibling=Ue,Be=Ue);return He&&Dn(U,_e),Se}for(pe=r(pe);!Ue.done;_e++,Ue=I.next())Ue=V(pe,U,_e,Ue.value,J),Ue!==null&&(e&&Ue.alternate!==null&&pe.delete(Ue.key===null?_e:Ue.key),O=d(Ue,O,_e),Be===null?Se=Ue:Be.sibling=Ue,Be=Ue);return e&&pe.forEach(function(Ax){return t(U,Ax)}),He&&Dn(U,_e),Se}function $e(U,O,I,J){if(typeof I=="object"&&I!==null&&I.type===M&&I.key===null&&(I=I.props.children),typeof I=="object"&&I!==null){switch(I.$$typeof){case w:e:{for(var Se=I.key;O!==null;){if(O.key===Se){if(Se=I.type,Se===M){if(O.tag===7){i(U,O.sibling),J=u(O,I.props.children),J.return=U,U=J;break e}}else if(O.elementType===Se||typeof Se=="object"&&Se!==null&&Se.$$typeof===H&&$i(Se)===O.type){i(U,O.sibling),J=u(O,I.props),Oa(J,I),J.return=U,U=J;break e}i(U,O);break}else t(U,O);O=O.sibling}I.type===M?(J=Ii(I.props.children,U.mode,J,I.key),J.return=U,U=J):(J=Xs(I.type,I.key,I.props,null,U.mode,J),Oa(J,I),J.return=U,U=J)}return b(U);case S:e:{for(Se=I.key;O!==null;){if(O.key===Se)if(O.tag===4&&O.stateNode.containerInfo===I.containerInfo&&O.stateNode.implementation===I.implementation){i(U,O.sibling),J=u(O,I.children||[]),J.return=U,U=J;break e}else{i(U,O);break}else t(U,O);O=O.sibling}J=sc(I,U.mode,J),J.return=U,U=J}return b(U);case H:return I=$i(I),$e(U,O,I,J)}if(P(I))return me(U,O,I,J);if(Z(I)){if(Se=Z(I),typeof Se!="function")throw Error(s(150));return I=Se.call(I),Ce(U,O,I,J)}if(typeof I.then=="function")return $e(U,O,nr(I),J);if(I.$$typeof===k)return $e(U,O,Qs(U,I),J);ir(U,I)}return typeof I=="string"&&I!==""||typeof I=="number"||typeof I=="bigint"?(I=""+I,O!==null&&O.tag===6?(i(U,O.sibling),J=u(O,I),J.return=U,U=J):(i(U,O),J=ac(I,U.mode,J),J.return=U,U=J),b(U)):i(U,O)}return function(U,O,I,J){try{ja=0;var Se=$e(U,O,I,J);return Rl=null,Se}catch(pe){if(pe===_l||pe===er)throw pe;var Be=Gt(29,pe,null,U.mode);return Be.lanes=J,Be.return=U,Be}finally{}}}var qi=ch(!0),uh=ch(!1),ci=!1;function yc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function vc(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 ui(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function di(e,t,i){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(Ke&2)!==0){var u=r.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),r.pending=t,t=qs(e),Vf(e,null,i),t}return Vs(e,r,t,i),qs(e)}function Da(e,t,i){if(t=t.updateQueue,t!==null&&(t=t.shared,(i&4194048)!==0)){var r=t.lanes;r&=e.pendingLanes,i|=r,t.lanes=i,ef(e,i)}}function xc(e,t){var i=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,i===r)){var u=null,d=null;if(i=i.firstBaseUpdate,i!==null){do{var b={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};d===null?u=d=b:d=d.next=b,i=i.next}while(i!==null);d===null?u=d=t:d=d.next=t}else u=d=t;i={baseState:r.baseState,firstBaseUpdate:u,lastBaseUpdate:d,shared:r.shared,callbacks:r.callbacks},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=t:e.next=t,i.lastBaseUpdate=t}var wc=!1;function za(){if(wc){var e=Ll;if(e!==null)throw e}}function Ha(e,t,i,r){wc=!1;var u=e.updateQueue;ci=!1;var d=u.firstBaseUpdate,b=u.lastBaseUpdate,C=u.shared.pending;if(C!==null){u.shared.pending=null;var _=C,F=_.next;_.next=null,b===null?d=F:b.next=F,b=_;var X=e.alternate;X!==null&&(X=X.updateQueue,C=X.lastBaseUpdate,C!==b&&(C===null?X.firstBaseUpdate=F:C.next=F,X.lastBaseUpdate=_))}if(d!==null){var ee=u.baseState;b=0,X=F=_=null,C=d;do{var Y=C.lane&-536870913,V=Y!==C.lane;if(V?(De&Y)===Y:(r&Y)===Y){Y!==0&&Y===kl&&(wc=!0),X!==null&&(X=X.next={lane:0,tag:C.tag,payload:C.payload,callback:null,next:null});e:{var me=e,Ce=C;Y=t;var $e=i;switch(Ce.tag){case 1:if(me=Ce.payload,typeof me=="function"){ee=me.call($e,ee,Y);break e}ee=me;break e;case 3:me.flags=me.flags&-65537|128;case 0:if(me=Ce.payload,Y=typeof me=="function"?me.call($e,ee,Y):me,Y==null)break e;ee=v({},ee,Y);break e;case 2:ci=!0}}Y=C.callback,Y!==null&&(e.flags|=64,V&&(e.flags|=8192),V=u.callbacks,V===null?u.callbacks=[Y]:V.push(Y))}else V={lane:Y,tag:C.tag,payload:C.payload,callback:C.callback,next:null},X===null?(F=X=V,_=ee):X=X.next=V,b|=Y;if(C=C.next,C===null){if(C=u.shared.pending,C===null)break;V=C,C=V.next,V.next=null,u.lastBaseUpdate=V,u.shared.pending=null}}while(!0);X===null&&(_=ee),u.baseState=_,u.firstBaseUpdate=F,u.lastBaseUpdate=X,d===null&&(u.shared.lanes=0),gi|=b,e.lanes=b,e.memoizedState=ee}}function dh(e,t){if(typeof e!="function")throw Error(s(191,e));e.call(t)}function fh(e,t){var i=e.callbacks;if(i!==null)for(e.callbacks=null,e=0;e<i.length;e++)dh(i[e],t)}var jl=ge(null),lr=ge(0);function hh(e,t){e=$n,ue(lr,e),ue(jl,t),$n=e|t.baseLanes}function Sc(){ue(lr,$n),ue(jl,jl.current)}function Cc(){$n=lr.current,ye(jl),ye(lr)}var Yt=ge(null),an=null;function fi(e){var t=e.alternate;ue(ot,ot.current&1),ue(Yt,e),an===null&&(t===null||jl.current!==null||t.memoizedState!==null)&&(an=e)}function Tc(e){ue(ot,ot.current),ue(Yt,e),an===null&&(an=e)}function mh(e){e.tag===22?(ue(ot,ot.current),ue(Yt,e),an===null&&(an=e)):hi()}function hi(){ue(ot,ot.current),ue(Yt,Yt.current)}function Pt(e){ye(Yt),an===e&&(an=null),ye(ot)}var ot=ge(0);function ar(e){for(var t=e;t!==null;){if(t.tag===13){var i=t.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||Lu(i)||_u(i)))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 Bn=0,Le=null,Ye=null,ft=null,sr=!1,Ol=!1,Xi=!1,rr=0,Ba=0,Dl=null,gv=0;function lt(){throw Error(s(321))}function Mc(e,t){if(t===null)return!1;for(var i=0;i<t.length&&i<e.length;i++)if(!Ft(e[i],t[i]))return!1;return!0}function Ac(e,t,i,r,u,d){return Bn=d,Le=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,A.H=e===null||e.memoizedState===null?Wh:Ic,Xi=!1,d=i(r,u),Xi=!1,Ol&&(d=gh(t,i,r,u)),ph(e),d}function ph(e){A.H=Ia;var t=Ye!==null&&Ye.next!==null;if(Bn=0,ft=Ye=Le=null,sr=!1,Ba=0,Dl=null,t)throw Error(s(300));e===null||ht||(e=e.dependencies,e!==null&&Ws(e)&&(ht=!0))}function gh(e,t,i,r){Le=e;var u=0;do{if(Ol&&(Dl=null),Ba=0,Ol=!1,25<=u)throw Error(s(301));if(u+=1,ft=Ye=null,e.updateQueue!=null){var d=e.updateQueue;d.lastEffect=null,d.events=null,d.stores=null,d.memoCache!=null&&(d.memoCache.index=0)}A.H=Qh,d=t(i,r)}while(Ol);return d}function bv(){var e=A.H,t=e.useState()[0];return t=typeof t.then=="function"?Ua(t):t,e=e.useState()[0],(Ye!==null?Ye.memoizedState:null)!==e&&(Le.flags|=1024),t}function Ec(){var e=rr!==0;return rr=0,e}function Nc(e,t,i){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i}function kc(e){if(sr){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}sr=!1}Bn=0,ft=Ye=Le=null,Ol=!1,Ba=rr=0,Dl=null}function _t(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ft===null?Le.memoizedState=ft=e:ft=ft.next=e,ft}function ct(){if(Ye===null){var e=Le.alternate;e=e!==null?e.memoizedState:null}else e=Ye.next;var t=ft===null?Le.memoizedState:ft.next;if(t!==null)ft=t,Ye=e;else{if(e===null)throw Le.alternate===null?Error(s(467)):Error(s(310));Ye=e,e={memoizedState:Ye.memoizedState,baseState:Ye.baseState,baseQueue:Ye.baseQueue,queue:Ye.queue,next:null},ft===null?Le.memoizedState=ft=e:ft=ft.next=e}return ft}function or(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ua(e){var t=Ba;return Ba+=1,Dl===null&&(Dl=[]),e=sh(Dl,e,t),t=Le,(ft===null?t.memoizedState:ft.next)===null&&(t=t.alternate,A.H=t===null||t.memoizedState===null?Wh:Ic),e}function cr(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Ua(e);if(e.$$typeof===k)return Ct(e)}throw Error(s(438,String(e)))}function Lc(e){var t=null,i=Le.updateQueue;if(i!==null&&(t=i.memoCache),t==null){var r=Le.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(u){return u.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),i===null&&(i=or(),Le.updateQueue=i),i.memoCache=t,i=t.data[t.index],i===void 0)for(i=t.data[t.index]=Array(e),r=0;r<e;r++)i[r]=q;return t.index++,i}function Un(e,t){return typeof t=="function"?t(e):t}function ur(e){var t=ct();return _c(t,Ye,e)}function _c(e,t,i){var r=e.queue;if(r===null)throw Error(s(311));r.lastRenderedReducer=i;var u=e.baseQueue,d=r.pending;if(d!==null){if(u!==null){var b=u.next;u.next=d.next,d.next=b}t.baseQueue=u=d,r.pending=null}if(d=e.baseState,u===null)e.memoizedState=d;else{t=u.next;var C=b=null,_=null,F=t,X=!1;do{var ee=F.lane&-536870913;if(ee!==F.lane?(De&ee)===ee:(Bn&ee)===ee){var Y=F.revertLane;if(Y===0)_!==null&&(_=_.next={lane:0,revertLane:0,gesture:null,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null}),ee===kl&&(X=!0);else if((Bn&Y)===Y){F=F.next,Y===kl&&(X=!0);continue}else ee={lane:0,revertLane:F.revertLane,gesture:null,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null},_===null?(C=_=ee,b=d):_=_.next=ee,Le.lanes|=Y,gi|=Y;ee=F.action,Xi&&i(d,ee),d=F.hasEagerState?F.eagerState:i(d,ee)}else Y={lane:ee,revertLane:F.revertLane,gesture:F.gesture,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null},_===null?(C=_=Y,b=d):_=_.next=Y,Le.lanes|=ee,gi|=ee;F=F.next}while(F!==null&&F!==t);if(_===null?b=d:_.next=C,!Ft(d,e.memoizedState)&&(ht=!0,X&&(i=Ll,i!==null)))throw i;e.memoizedState=d,e.baseState=b,e.baseQueue=_,r.lastRenderedState=d}return u===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Rc(e){var t=ct(),i=t.queue;if(i===null)throw Error(s(311));i.lastRenderedReducer=e;var r=i.dispatch,u=i.pending,d=t.memoizedState;if(u!==null){i.pending=null;var b=u=u.next;do d=e(d,b.action),b=b.next;while(b!==u);Ft(d,t.memoizedState)||(ht=!0),t.memoizedState=d,t.baseQueue===null&&(t.baseState=d),i.lastRenderedState=d}return[d,r]}function bh(e,t,i){var r=Le,u=ct(),d=He;if(d){if(i===void 0)throw Error(s(407));i=i()}else i=t();var b=!Ft((Ye||u).memoizedState,i);if(b&&(u.memoizedState=i,ht=!0),u=u.queue,Dc(xh.bind(null,r,u,e),[e]),u.getSnapshot!==t||b||ft!==null&&ft.memoizedState.tag&1){if(r.flags|=2048,zl(9,{destroy:void 0},vh.bind(null,r,u,i,t),null),Ve===null)throw Error(s(349));d||(Bn&127)!==0||yh(r,t,i)}return i}function yh(e,t,i){e.flags|=16384,e={getSnapshot:t,value:i},t=Le.updateQueue,t===null?(t=or(),Le.updateQueue=t,t.stores=[e]):(i=t.stores,i===null?t.stores=[e]:i.push(e))}function vh(e,t,i,r){t.value=i,t.getSnapshot=r,wh(t)&&Sh(e)}function xh(e,t,i){return i(function(){wh(t)&&Sh(e)})}function wh(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!Ft(e,i)}catch{return!0}}function Sh(e){var t=Ki(e,2);t!==null&&Ut(t,e,2)}function jc(e){var t=_t();if(typeof e=="function"){var i=e;if(e=i(),Xi){xn(!0);try{i()}finally{xn(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Un,lastRenderedState:e},t}function Ch(e,t,i,r){return e.baseState=i,_c(e,Ye,typeof r=="function"?r:Un)}function yv(e,t,i,r,u){if(hr(e))throw Error(s(485));if(e=t.action,e!==null){var d={payload:u,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(b){d.listeners.push(b)}};A.T!==null?i(!0):d.isTransition=!1,r(d),i=t.pending,i===null?(d.next=t.pending=d,Th(t,d)):(d.next=i.next,t.pending=i.next=d)}}function Th(e,t){var i=t.action,r=t.payload,u=e.state;if(t.isTransition){var d=A.T,b={};A.T=b;try{var C=i(u,r),_=A.S;_!==null&&_(b,C),Mh(e,t,C)}catch(F){Oc(e,t,F)}finally{d!==null&&b.types!==null&&(d.types=b.types),A.T=d}}else try{d=i(u,r),Mh(e,t,d)}catch(F){Oc(e,t,F)}}function Mh(e,t,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(r){Ah(e,t,r)},function(r){return Oc(e,t,r)}):Ah(e,t,i)}function Ah(e,t,i){t.status="fulfilled",t.value=i,Eh(t),e.state=i,t=e.pending,t!==null&&(i=t.next,i===t?e.pending=null:(i=i.next,t.next=i,Th(e,i)))}function Oc(e,t,i){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status="rejected",t.reason=i,Eh(t),t=t.next;while(t!==r)}e.action=null}function Eh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Nh(e,t){return t}function kh(e,t){if(He){var i=Ve.formState;if(i!==null){e:{var r=Le;if(He){if(Ze){t:{for(var u=Ze,d=ln;u.nodeType!==8;){if(!d){u=null;break t}if(u=sn(u.nextSibling),u===null){u=null;break t}}d=u.data,u=d==="F!"||d==="F"?u:null}if(u){Ze=sn(u.nextSibling),r=u.data==="F!";break e}}ri(r)}r=!1}r&&(t=i[0])}}return i=_t(),i.memoizedState=i.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Nh,lastRenderedState:t},i.queue=r,i=qh.bind(null,Le,r),r.dispatch=i,r=jc(!1),d=Kc.bind(null,Le,!1,r.queue),r=_t(),u={state:t,dispatch:null,action:e,pending:null},r.queue=u,i=yv.bind(null,Le,u,d,i),u.dispatch=i,r.memoizedState=e,[t,i,!1]}function Lh(e){var t=ct();return _h(t,Ye,e)}function _h(e,t,i){if(t=_c(e,t,Nh)[0],e=ur(Un)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var r=Ua(t)}catch(b){throw b===_l?er:b}else r=t;t=ct();var u=t.queue,d=u.dispatch;return i!==t.memoizedState&&(Le.flags|=2048,zl(9,{destroy:void 0},vv.bind(null,u,i),null)),[r,d,e]}function vv(e,t){e.action=t}function Rh(e){var t=ct(),i=Ye;if(i!==null)return _h(t,i,e);ct(),t=t.memoizedState,i=ct();var r=i.queue.dispatch;return i.memoizedState=e,[t,r,!1]}function zl(e,t,i,r){return e={tag:e,create:i,deps:r,inst:t,next:null},t=Le.updateQueue,t===null&&(t=or(),Le.updateQueue=t),i=t.lastEffect,i===null?t.lastEffect=e.next=e:(r=i.next,i.next=e,e.next=r,t.lastEffect=e),e}function jh(){return ct().memoizedState}function dr(e,t,i,r){var u=_t();Le.flags|=e,u.memoizedState=zl(1|t,{destroy:void 0},i,r===void 0?null:r)}function fr(e,t,i,r){var u=ct();r=r===void 0?null:r;var d=u.memoizedState.inst;Ye!==null&&r!==null&&Mc(r,Ye.memoizedState.deps)?u.memoizedState=zl(t,d,i,r):(Le.flags|=e,u.memoizedState=zl(1|t,d,i,r))}function Oh(e,t){dr(8390656,8,e,t)}function Dc(e,t){fr(2048,8,e,t)}function xv(e){Le.flags|=4;var t=Le.updateQueue;if(t===null)t=or(),Le.updateQueue=t,t.events=[e];else{var i=t.events;i===null?t.events=[e]:i.push(e)}}function Dh(e){var t=ct().memoizedState;return xv({ref:t,nextImpl:e}),function(){if((Ke&2)!==0)throw Error(s(440));return t.impl.apply(void 0,arguments)}}function zh(e,t){return fr(4,2,e,t)}function Hh(e,t){return fr(4,4,e,t)}function Bh(e,t){if(typeof t=="function"){e=e();var i=t(e);return function(){typeof i=="function"?i():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Uh(e,t,i){i=i!=null?i.concat([e]):null,fr(4,4,Bh.bind(null,t,e),i)}function zc(){}function Kh(e,t){var i=ct();t=t===void 0?null:t;var r=i.memoizedState;return t!==null&&Mc(t,r[1])?r[0]:(i.memoizedState=[e,t],e)}function Ih(e,t){var i=ct();t=t===void 0?null:t;var r=i.memoizedState;if(t!==null&&Mc(t,r[1]))return r[0];if(r=e(),Xi){xn(!0);try{e()}finally{xn(!1)}}return i.memoizedState=[r,t],r}function Hc(e,t,i){return i===void 0||(Bn&1073741824)!==0&&(De&261930)===0?e.memoizedState=t:(e.memoizedState=i,e=Fm(),Le.lanes|=e,gi|=e,i)}function Fh(e,t,i,r){return Ft(i,t)?i:jl.current!==null?(e=Hc(e,i,r),Ft(e,t)||(ht=!0),e):(Bn&42)===0||(Bn&1073741824)!==0&&(De&261930)===0?(ht=!0,e.memoizedState=i):(e=Fm(),Le.lanes|=e,gi|=e,t)}function Gh(e,t,i,r,u){var d=G.p;G.p=d!==0&&8>d?d:8;var b=A.T,C={};A.T=C,Kc(e,!1,t,i);try{var _=u(),F=A.S;if(F!==null&&F(C,_),_!==null&&typeof _=="object"&&typeof _.then=="function"){var X=pv(_,r);Ka(e,t,X,qt(e))}else Ka(e,t,r,qt(e))}catch(ee){Ka(e,t,{then:function(){},status:"rejected",reason:ee},qt())}finally{G.p=d,b!==null&&C.types!==null&&(b.types=C.types),A.T=b}}function wv(){}function Bc(e,t,i,r){if(e.tag!==5)throw Error(s(476));var u=Yh(e).queue;Gh(e,u,t,W,i===null?wv:function(){return Ph(e),i(r)})}function Yh(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:W,baseState:W,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Un,lastRenderedState:W},next:null};var i={};return t.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Un,lastRenderedState:i},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ph(e){var t=Yh(e);t.next===null&&(t=e.alternate.memoizedState),Ka(e,t.next.queue,{},qt())}function Uc(){return Ct(is)}function $h(){return ct().memoizedState}function Vh(){return ct().memoizedState}function Sv(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var i=qt();e=ui(i);var r=di(t,e,i);r!==null&&(Ut(r,t,i),Da(r,t,i)),t={cache:mc()},e.payload=t;return}t=t.return}}function Cv(e,t,i){var r=qt();i={lane:r,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},hr(e)?Xh(t,i):(i=ic(e,t,i,r),i!==null&&(Ut(i,e,r),Zh(i,t,r)))}function qh(e,t,i){var r=qt();Ka(e,t,i,r)}function Ka(e,t,i,r){var u={lane:r,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(hr(e))Xh(t,u);else{var d=e.alternate;if(e.lanes===0&&(d===null||d.lanes===0)&&(d=t.lastRenderedReducer,d!==null))try{var b=t.lastRenderedState,C=d(b,i);if(u.hasEagerState=!0,u.eagerState=C,Ft(C,b))return Vs(e,t,u,0),Ve===null&&$s(),!1}catch{}finally{}if(i=ic(e,t,u,r),i!==null)return Ut(i,e,r),Zh(i,t,r),!0}return!1}function Kc(e,t,i,r){if(r={lane:2,revertLane:yu(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},hr(e)){if(t)throw Error(s(479))}else t=ic(e,i,r,2),t!==null&&Ut(t,e,2)}function hr(e){var t=e.alternate;return e===Le||t!==null&&t===Le}function Xh(e,t){Ol=sr=!0;var i=e.pending;i===null?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function Zh(e,t,i){if((i&4194048)!==0){var r=t.lanes;r&=e.pendingLanes,i|=r,t.lanes=i,ef(e,i)}}var Ia={readContext:Ct,use:cr,useCallback:lt,useContext:lt,useEffect:lt,useImperativeHandle:lt,useLayoutEffect:lt,useInsertionEffect:lt,useMemo:lt,useReducer:lt,useRef:lt,useState:lt,useDebugValue:lt,useDeferredValue:lt,useTransition:lt,useSyncExternalStore:lt,useId:lt,useHostTransitionStatus:lt,useFormState:lt,useActionState:lt,useOptimistic:lt,useMemoCache:lt,useCacheRefresh:lt};Ia.useEffectEvent=lt;var Wh={readContext:Ct,use:cr,useCallback:function(e,t){return _t().memoizedState=[e,t===void 0?null:t],e},useContext:Ct,useEffect:Oh,useImperativeHandle:function(e,t,i){i=i!=null?i.concat([e]):null,dr(4194308,4,Bh.bind(null,t,e),i)},useLayoutEffect:function(e,t){return dr(4194308,4,e,t)},useInsertionEffect:function(e,t){dr(4,2,e,t)},useMemo:function(e,t){var i=_t();t=t===void 0?null:t;var r=e();if(Xi){xn(!0);try{e()}finally{xn(!1)}}return i.memoizedState=[r,t],r},useReducer:function(e,t,i){var r=_t();if(i!==void 0){var u=i(t);if(Xi){xn(!0);try{i(t)}finally{xn(!1)}}}else u=t;return r.memoizedState=r.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},r.queue=e,e=e.dispatch=Cv.bind(null,Le,e),[r.memoizedState,e]},useRef:function(e){var t=_t();return e={current:e},t.memoizedState=e},useState:function(e){e=jc(e);var t=e.queue,i=qh.bind(null,Le,t);return t.dispatch=i,[e.memoizedState,i]},useDebugValue:zc,useDeferredValue:function(e,t){var i=_t();return Hc(i,e,t)},useTransition:function(){var e=jc(!1);return e=Gh.bind(null,Le,e.queue,!0,!1),_t().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,i){var r=Le,u=_t();if(He){if(i===void 0)throw Error(s(407));i=i()}else{if(i=t(),Ve===null)throw Error(s(349));(De&127)!==0||yh(r,t,i)}u.memoizedState=i;var d={value:i,getSnapshot:t};return u.queue=d,Oh(xh.bind(null,r,d,e),[e]),r.flags|=2048,zl(9,{destroy:void 0},vh.bind(null,r,d,i,t),null),i},useId:function(){var e=_t(),t=Ve.identifierPrefix;if(He){var i=Sn,r=wn;i=(r&~(1<<32-kt(r)-1)).toString(32)+i,t="_"+t+"R_"+i,i=rr++,0<i&&(t+="H"+i.toString(32)),t+="_"}else i=gv++,t="_"+t+"r_"+i.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Uc,useFormState:kh,useActionState:kh,useOptimistic:function(e){var t=_t();t.memoizedState=t.baseState=e;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=i,t=Kc.bind(null,Le,!0,i),i.dispatch=t,[e,t]},useMemoCache:Lc,useCacheRefresh:function(){return _t().memoizedState=Sv.bind(null,Le)},useEffectEvent:function(e){var t=_t(),i={impl:e};return t.memoizedState=i,function(){if((Ke&2)!==0)throw Error(s(440));return i.impl.apply(void 0,arguments)}}},Ic={readContext:Ct,use:cr,useCallback:Kh,useContext:Ct,useEffect:Dc,useImperativeHandle:Uh,useInsertionEffect:zh,useLayoutEffect:Hh,useMemo:Ih,useReducer:ur,useRef:jh,useState:function(){return ur(Un)},useDebugValue:zc,useDeferredValue:function(e,t){var i=ct();return Fh(i,Ye.memoizedState,e,t)},useTransition:function(){var e=ur(Un)[0],t=ct().memoizedState;return[typeof e=="boolean"?e:Ua(e),t]},useSyncExternalStore:bh,useId:$h,useHostTransitionStatus:Uc,useFormState:Lh,useActionState:Lh,useOptimistic:function(e,t){var i=ct();return Ch(i,Ye,e,t)},useMemoCache:Lc,useCacheRefresh:Vh};Ic.useEffectEvent=Dh;var Qh={readContext:Ct,use:cr,useCallback:Kh,useContext:Ct,useEffect:Dc,useImperativeHandle:Uh,useInsertionEffect:zh,useLayoutEffect:Hh,useMemo:Ih,useReducer:Rc,useRef:jh,useState:function(){return Rc(Un)},useDebugValue:zc,useDeferredValue:function(e,t){var i=ct();return Ye===null?Hc(i,e,t):Fh(i,Ye.memoizedState,e,t)},useTransition:function(){var e=Rc(Un)[0],t=ct().memoizedState;return[typeof e=="boolean"?e:Ua(e),t]},useSyncExternalStore:bh,useId:$h,useHostTransitionStatus:Uc,useFormState:Rh,useActionState:Rh,useOptimistic:function(e,t){var i=ct();return Ye!==null?Ch(i,Ye,e,t):(i.baseState=e,[e,i.queue.dispatch])},useMemoCache:Lc,useCacheRefresh:Vh};Qh.useEffectEvent=Dh;function Fc(e,t,i,r){t=e.memoizedState,i=i(r,t),i=i==null?t:v({},t,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var Gc={enqueueSetState:function(e,t,i){e=e._reactInternals;var r=qt(),u=ui(r);u.payload=t,i!=null&&(u.callback=i),t=di(e,u,r),t!==null&&(Ut(t,e,r),Da(t,e,r))},enqueueReplaceState:function(e,t,i){e=e._reactInternals;var r=qt(),u=ui(r);u.tag=1,u.payload=t,i!=null&&(u.callback=i),t=di(e,u,r),t!==null&&(Ut(t,e,r),Da(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var i=qt(),r=ui(i);r.tag=2,t!=null&&(r.callback=t),t=di(e,r,i),t!==null&&(Ut(t,e,i),Da(t,e,i))}};function Jh(e,t,i,r,u,d,b){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,d,b):t.prototype&&t.prototype.isPureReactComponent?!Ea(i,r)||!Ea(u,d):!0}function em(e,t,i,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(i,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(i,r),t.state!==e&&Gc.enqueueReplaceState(t,t.state,null)}function Zi(e,t){var i=t;if("ref"in t){i={};for(var r in t)r!=="ref"&&(i[r]=t[r])}if(e=e.defaultProps){i===t&&(i=v({},i));for(var u in e)i[u]===void 0&&(i[u]=e[u])}return i}function tm(e){Ps(e)}function nm(e){console.error(e)}function im(e){Ps(e)}function mr(e,t){try{var i=e.onUncaughtError;i(t.value,{componentStack:t.stack})}catch(r){setTimeout(function(){throw r})}}function lm(e,t,i){try{var r=e.onCaughtError;r(i.value,{componentStack:i.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function Yc(e,t,i){return i=ui(i),i.tag=3,i.payload={element:null},i.callback=function(){mr(e,t)},i}function am(e){return e=ui(e),e.tag=3,e}function sm(e,t,i,r){var u=i.type.getDerivedStateFromError;if(typeof u=="function"){var d=r.value;e.payload=function(){return u(d)},e.callback=function(){lm(t,i,r)}}var b=i.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(e.callback=function(){lm(t,i,r),typeof u!="function"&&(bi===null?bi=new Set([this]):bi.add(this));var C=r.stack;this.componentDidCatch(r.value,{componentStack:C!==null?C:""})})}function Tv(e,t,i,r,u){if(i.flags|=32768,r!==null&&typeof r=="object"&&typeof r.then=="function"){if(t=i.alternate,t!==null&&Nl(t,i,u,!0),i=Yt.current,i!==null){switch(i.tag){case 31:case 13:return an===null?Ar():i.alternate===null&&at===0&&(at=3),i.flags&=-257,i.flags|=65536,i.lanes=u,r===tr?i.flags|=16384:(t=i.updateQueue,t===null?i.updateQueue=new Set([r]):t.add(r),pu(e,r,u)),!1;case 22:return i.flags|=65536,r===tr?i.flags|=16384:(t=i.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},i.updateQueue=t):(i=t.retryQueue,i===null?t.retryQueue=new Set([r]):i.add(r)),pu(e,r,u)),!1}throw Error(s(435,i.tag))}return pu(e,r,u),Ar(),!1}if(He)return t=Yt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=u,r!==cc&&(e=Error(s(422),{cause:r}),La(en(e,i)))):(r!==cc&&(t=Error(s(423),{cause:r}),La(en(t,i))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,r=en(r,i),u=Yc(e.stateNode,r,u),xc(e,u),at!==4&&(at=2)),!1;var d=Error(s(520),{cause:r});if(d=en(d,i),Xa===null?Xa=[d]:Xa.push(d),at!==4&&(at=2),t===null)return!0;r=en(r,i),i=t;do{switch(i.tag){case 3:return i.flags|=65536,e=u&-u,i.lanes|=e,e=Yc(i.stateNode,r,e),xc(i,e),!1;case 1:if(t=i.type,d=i.stateNode,(i.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||d!==null&&typeof d.componentDidCatch=="function"&&(bi===null||!bi.has(d))))return i.flags|=65536,u&=-u,i.lanes|=u,u=am(u),sm(u,e,i,r),xc(i,u),!1}i=i.return}while(i!==null);return!1}var Pc=Error(s(461)),ht=!1;function Tt(e,t,i,r){t.child=e===null?uh(t,null,i,r):qi(t,e.child,i,r)}function rm(e,t,i,r,u){i=i.render;var d=t.ref;if("ref"in r){var b={};for(var C in r)C!=="ref"&&(b[C]=r[C])}else b=r;return Yi(t),r=Ac(e,t,i,b,d,u),C=Ec(),e!==null&&!ht?(Nc(e,t,u),Kn(e,t,u)):(He&&C&&rc(t),t.flags|=1,Tt(e,t,r,u),t.child)}function om(e,t,i,r,u){if(e===null){var d=i.type;return typeof d=="function"&&!lc(d)&&d.defaultProps===void 0&&i.compare===null?(t.tag=15,t.type=d,cm(e,t,d,r,u)):(e=Xs(i.type,null,r,t,t.mode,u),e.ref=t.ref,e.return=t,t.child=e)}if(d=e.child,!Jc(e,u)){var b=d.memoizedProps;if(i=i.compare,i=i!==null?i:Ea,i(b,r)&&e.ref===t.ref)return Kn(e,t,u)}return t.flags|=1,e=On(d,r),e.ref=t.ref,e.return=t,t.child=e}function cm(e,t,i,r,u){if(e!==null){var d=e.memoizedProps;if(Ea(d,r)&&e.ref===t.ref)if(ht=!1,t.pendingProps=r=d,Jc(e,u))(e.flags&131072)!==0&&(ht=!0);else return t.lanes=e.lanes,Kn(e,t,u)}return $c(e,t,i,r,u)}function um(e,t,i,r){var u=r.children,d=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode==="hidden"){if((t.flags&128)!==0){if(d=d!==null?d.baseLanes|i:i,e!==null){for(r=t.child=e.child,u=0;r!==null;)u=u|r.lanes|r.childLanes,r=r.sibling;r=u&~d}else r=0,t.child=null;return dm(e,t,d,i,r)}if((i&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Js(t,d!==null?d.cachePool:null),d!==null?hh(t,d):Sc(),mh(t);else return r=t.lanes=536870912,dm(e,t,d!==null?d.baseLanes|i:i,i,r)}else d!==null?(Js(t,d.cachePool),hh(t,d),hi(),t.memoizedState=null):(e!==null&&Js(t,null),Sc(),hi());return Tt(e,t,u,i),t.child}function Fa(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function dm(e,t,i,r,u){var d=gc();return d=d===null?null:{parent:dt._currentValue,pool:d},t.memoizedState={baseLanes:i,cachePool:d},e!==null&&Js(t,null),Sc(),mh(t),e!==null&&Nl(e,t,r,!0),t.childLanes=u,null}function pr(e,t){return t=br({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function fm(e,t,i){return qi(t,e.child,null,i),e=pr(t,t.pendingProps),e.flags|=2,Pt(t),t.memoizedState=null,e}function Mv(e,t,i){var r=t.pendingProps,u=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(He){if(r.mode==="hidden")return e=pr(t,r),t.lanes=536870912,Fa(null,e);if(Tc(t),(e=Ze)?(e=Tp(e,ln),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ai!==null?{id:wn,overflow:Sn}:null,retryLane:536870912,hydrationErrors:null},i=Xf(e),i.return=t,t.child=i,St=t,Ze=null)):e=null,e===null)throw ri(t);return t.lanes=536870912,null}return pr(t,r)}var d=e.memoizedState;if(d!==null){var b=d.dehydrated;if(Tc(t),u)if(t.flags&256)t.flags&=-257,t=fm(e,t,i);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(s(558));else if(ht||Nl(e,t,i,!1),u=(i&e.childLanes)!==0,ht||u){if(r=Ve,r!==null&&(b=tf(r,i),b!==0&&b!==d.retryLane))throw d.retryLane=b,Ki(e,b),Ut(r,e,b),Pc;Ar(),t=fm(e,t,i)}else e=d.treeContext,Ze=sn(b.nextSibling),St=t,He=!0,si=null,ln=!1,e!==null&&Qf(t,e),t=pr(t,r),t.flags|=4096;return t}return e=On(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function gr(e,t){var i=t.ref;if(i===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(s(284));(e===null||e.ref!==i)&&(t.flags|=4194816)}}function $c(e,t,i,r,u){return Yi(t),i=Ac(e,t,i,r,void 0,u),r=Ec(),e!==null&&!ht?(Nc(e,t,u),Kn(e,t,u)):(He&&r&&rc(t),t.flags|=1,Tt(e,t,i,u),t.child)}function hm(e,t,i,r,u,d){return Yi(t),t.updateQueue=null,i=gh(t,r,i,u),ph(e),r=Ec(),e!==null&&!ht?(Nc(e,t,d),Kn(e,t,d)):(He&&r&&rc(t),t.flags|=1,Tt(e,t,i,d),t.child)}function mm(e,t,i,r,u){if(Yi(t),t.stateNode===null){var d=Tl,b=i.contextType;typeof b=="object"&&b!==null&&(d=Ct(b)),d=new i(r,d),t.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,d.updater=Gc,t.stateNode=d,d._reactInternals=t,d=t.stateNode,d.props=r,d.state=t.memoizedState,d.refs={},yc(t),b=i.contextType,d.context=typeof b=="object"&&b!==null?Ct(b):Tl,d.state=t.memoizedState,b=i.getDerivedStateFromProps,typeof b=="function"&&(Fc(t,i,b,r),d.state=t.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof d.getSnapshotBeforeUpdate=="function"||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(b=d.state,typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount(),b!==d.state&&Gc.enqueueReplaceState(d,d.state,null),Ha(t,r,d,u),za(),d.state=t.memoizedState),typeof d.componentDidMount=="function"&&(t.flags|=4194308),r=!0}else if(e===null){d=t.stateNode;var C=t.memoizedProps,_=Zi(i,C);d.props=_;var F=d.context,X=i.contextType;b=Tl,typeof X=="object"&&X!==null&&(b=Ct(X));var ee=i.getDerivedStateFromProps;X=typeof ee=="function"||typeof d.getSnapshotBeforeUpdate=="function",C=t.pendingProps!==C,X||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(C||F!==b)&&em(t,d,r,b),ci=!1;var Y=t.memoizedState;d.state=Y,Ha(t,r,d,u),za(),F=t.memoizedState,C||Y!==F||ci?(typeof ee=="function"&&(Fc(t,i,ee,r),F=t.memoizedState),(_=ci||Jh(t,i,_,r,Y,F,b))?(X||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount()),typeof d.componentDidMount=="function"&&(t.flags|=4194308)):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=F),d.props=r,d.state=F,d.context=b,r=_):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{d=t.stateNode,vc(e,t),b=t.memoizedProps,X=Zi(i,b),d.props=X,ee=t.pendingProps,Y=d.context,F=i.contextType,_=Tl,typeof F=="object"&&F!==null&&(_=Ct(F)),C=i.getDerivedStateFromProps,(F=typeof C=="function"||typeof d.getSnapshotBeforeUpdate=="function")||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(b!==ee||Y!==_)&&em(t,d,r,_),ci=!1,Y=t.memoizedState,d.state=Y,Ha(t,r,d,u),za();var V=t.memoizedState;b!==ee||Y!==V||ci||e!==null&&e.dependencies!==null&&Ws(e.dependencies)?(typeof C=="function"&&(Fc(t,i,C,r),V=t.memoizedState),(X=ci||Jh(t,i,X,r,Y,V,_)||e!==null&&e.dependencies!==null&&Ws(e.dependencies))?(F||typeof d.UNSAFE_componentWillUpdate!="function"&&typeof d.componentWillUpdate!="function"||(typeof d.componentWillUpdate=="function"&&d.componentWillUpdate(r,V,_),typeof d.UNSAFE_componentWillUpdate=="function"&&d.UNSAFE_componentWillUpdate(r,V,_)),typeof d.componentDidUpdate=="function"&&(t.flags|=4),typeof d.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof d.componentDidUpdate!="function"||b===e.memoizedProps&&Y===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&Y===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=V),d.props=r,d.state=V,d.context=_,r=X):(typeof d.componentDidUpdate!="function"||b===e.memoizedProps&&Y===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&Y===e.memoizedState||(t.flags|=1024),r=!1)}return d=r,gr(e,t),r=(t.flags&128)!==0,d||r?(d=t.stateNode,i=r&&typeof i.getDerivedStateFromError!="function"?null:d.render(),t.flags|=1,e!==null&&r?(t.child=qi(t,e.child,null,u),t.child=qi(t,null,i,u)):Tt(e,t,i,u),t.memoizedState=d.state,e=t.child):e=Kn(e,t,u),e}function pm(e,t,i,r){return Fi(),t.flags|=256,Tt(e,t,i,r),t.child}var Vc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function qc(e){return{baseLanes:e,cachePool:lh()}}function Xc(e,t,i){return e=e!==null?e.childLanes&~i:0,t&&(e|=Vt),e}function gm(e,t,i){var r=t.pendingProps,u=!1,d=(t.flags&128)!==0,b;if((b=d)||(b=e!==null&&e.memoizedState===null?!1:(ot.current&2)!==0),b&&(u=!0,t.flags&=-129),b=(t.flags&32)!==0,t.flags&=-33,e===null){if(He){if(u?fi(t):hi(),(e=Ze)?(e=Tp(e,ln),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ai!==null?{id:wn,overflow:Sn}:null,retryLane:536870912,hydrationErrors:null},i=Xf(e),i.return=t,t.child=i,St=t,Ze=null)):e=null,e===null)throw ri(t);return _u(e)?t.lanes=32:t.lanes=536870912,null}var C=r.children;return r=r.fallback,u?(hi(),u=t.mode,C=br({mode:"hidden",children:C},u),r=Ii(r,u,i,null),C.return=t,r.return=t,C.sibling=r,t.child=C,r=t.child,r.memoizedState=qc(i),r.childLanes=Xc(e,b,i),t.memoizedState=Vc,Fa(null,r)):(fi(t),Zc(t,C))}var _=e.memoizedState;if(_!==null&&(C=_.dehydrated,C!==null)){if(d)t.flags&256?(fi(t),t.flags&=-257,t=Wc(e,t,i)):t.memoizedState!==null?(hi(),t.child=e.child,t.flags|=128,t=null):(hi(),C=r.fallback,u=t.mode,r=br({mode:"visible",children:r.children},u),C=Ii(C,u,i,null),C.flags|=2,r.return=t,C.return=t,r.sibling=C,t.child=r,qi(t,e.child,null,i),r=t.child,r.memoizedState=qc(i),r.childLanes=Xc(e,b,i),t.memoizedState=Vc,t=Fa(null,r));else if(fi(t),_u(C)){if(b=C.nextSibling&&C.nextSibling.dataset,b)var F=b.dgst;b=F,r=Error(s(419)),r.stack="",r.digest=b,La({value:r,source:null,stack:null}),t=Wc(e,t,i)}else if(ht||Nl(e,t,i,!1),b=(i&e.childLanes)!==0,ht||b){if(b=Ve,b!==null&&(r=tf(b,i),r!==0&&r!==_.retryLane))throw _.retryLane=r,Ki(e,r),Ut(b,e,r),Pc;Lu(C)||Ar(),t=Wc(e,t,i)}else Lu(C)?(t.flags|=192,t.child=e.child,t=null):(e=_.treeContext,Ze=sn(C.nextSibling),St=t,He=!0,si=null,ln=!1,e!==null&&Qf(t,e),t=Zc(t,r.children),t.flags|=4096);return t}return u?(hi(),C=r.fallback,u=t.mode,_=e.child,F=_.sibling,r=On(_,{mode:"hidden",children:r.children}),r.subtreeFlags=_.subtreeFlags&65011712,F!==null?C=On(F,C):(C=Ii(C,u,i,null),C.flags|=2),C.return=t,r.return=t,r.sibling=C,t.child=r,Fa(null,r),r=t.child,C=e.child.memoizedState,C===null?C=qc(i):(u=C.cachePool,u!==null?(_=dt._currentValue,u=u.parent!==_?{parent:_,pool:_}:u):u=lh(),C={baseLanes:C.baseLanes|i,cachePool:u}),r.memoizedState=C,r.childLanes=Xc(e,b,i),t.memoizedState=Vc,Fa(e.child,r)):(fi(t),i=e.child,e=i.sibling,i=On(i,{mode:"visible",children:r.children}),i.return=t,i.sibling=null,e!==null&&(b=t.deletions,b===null?(t.deletions=[e],t.flags|=16):b.push(e)),t.child=i,t.memoizedState=null,i)}function Zc(e,t){return t=br({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function br(e,t){return e=Gt(22,e,null,t),e.lanes=0,e}function Wc(e,t,i){return qi(t,e.child,null,i),e=Zc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function bm(e,t,i){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),fc(e.return,t,i)}function Qc(e,t,i,r,u,d){var b=e.memoizedState;b===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:i,tailMode:u,treeForkCount:d}:(b.isBackwards=t,b.rendering=null,b.renderingStartTime=0,b.last=r,b.tail=i,b.tailMode=u,b.treeForkCount=d)}function ym(e,t,i){var r=t.pendingProps,u=r.revealOrder,d=r.tail;r=r.children;var b=ot.current,C=(b&2)!==0;if(C?(b=b&1|2,t.flags|=128):b&=1,ue(ot,b),Tt(e,t,r,i),r=He?ka:0,!C&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&bm(e,i,t);else if(e.tag===19)bm(e,i,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(u){case"forwards":for(i=t.child,u=null;i!==null;)e=i.alternate,e!==null&&ar(e)===null&&(u=i),i=i.sibling;i=u,i===null?(u=t.child,t.child=null):(u=i.sibling,i.sibling=null),Qc(t,!1,u,i,d,r);break;case"backwards":case"unstable_legacy-backwards":for(i=null,u=t.child,t.child=null;u!==null;){if(e=u.alternate,e!==null&&ar(e)===null){t.child=u;break}e=u.sibling,u.sibling=i,i=u,u=e}Qc(t,!0,i,null,d,r);break;case"together":Qc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Kn(e,t,i){if(e!==null&&(t.dependencies=e.dependencies),gi|=t.lanes,(i&t.childLanes)===0)if(e!==null){if(Nl(e,t,i,!1),(i&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(s(153));if(t.child!==null){for(e=t.child,i=On(e,e.pendingProps),t.child=i,i.return=t;e.sibling!==null;)e=e.sibling,i=i.sibling=On(e,e.pendingProps),i.return=t;i.sibling=null}return t.child}function Jc(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Ws(e)))}function Av(e,t,i){switch(t.tag){case 3:we(t,t.stateNode.containerInfo),oi(t,dt,e.memoizedState.cache),Fi();break;case 27:case 5:ve(t);break;case 4:we(t,t.stateNode.containerInfo);break;case 10:oi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Tc(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated!==null?(fi(t),t.flags|=128,null):(i&t.child.childLanes)!==0?gm(e,t,i):(fi(t),e=Kn(e,t,i),e!==null?e.sibling:null);fi(t);break;case 19:var u=(e.flags&128)!==0;if(r=(i&t.childLanes)!==0,r||(Nl(e,t,i,!1),r=(i&t.childLanes)!==0),u){if(r)return ym(e,t,i);t.flags|=128}if(u=t.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),ue(ot,ot.current),r)break;return null;case 22:return t.lanes=0,um(e,t,i,t.pendingProps);case 24:oi(t,dt,e.memoizedState.cache)}return Kn(e,t,i)}function vm(e,t,i){if(e!==null)if(e.memoizedProps!==t.pendingProps)ht=!0;else{if(!Jc(e,i)&&(t.flags&128)===0)return ht=!1,Av(e,t,i);ht=(e.flags&131072)!==0}else ht=!1,He&&(t.flags&1048576)!==0&&Wf(t,ka,t.index);switch(t.lanes=0,t.tag){case 16:e:{var r=t.pendingProps;if(e=$i(t.elementType),t.type=e,typeof e=="function")lc(e)?(r=Zi(e,r),t.tag=1,t=mm(null,t,e,r,i)):(t.tag=0,t=$c(null,t,e,r,i));else{if(e!=null){var u=e.$$typeof;if(u===z){t.tag=11,t=rm(null,t,e,r,i);break e}else if(u===j){t.tag=14,t=om(null,t,e,r,i);break e}}throw t=oe(e)||e,Error(s(306,t,""))}}return t;case 0:return $c(e,t,t.type,t.pendingProps,i);case 1:return r=t.type,u=Zi(r,t.pendingProps),mm(e,t,r,u,i);case 3:e:{if(we(t,t.stateNode.containerInfo),e===null)throw Error(s(387));r=t.pendingProps;var d=t.memoizedState;u=d.element,vc(e,t),Ha(t,r,null,i);var b=t.memoizedState;if(r=b.cache,oi(t,dt,r),r!==d.cache&&hc(t,[dt],i,!0),za(),r=b.element,d.isDehydrated)if(d={element:r,isDehydrated:!1,cache:b.cache},t.updateQueue.baseState=d,t.memoizedState=d,t.flags&256){t=pm(e,t,r,i);break e}else if(r!==u){u=en(Error(s(424)),t),La(u),t=pm(e,t,r,i);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(Ze=sn(e.firstChild),St=t,He=!0,si=null,ln=!0,i=uh(t,null,r,i),t.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(Fi(),r===u){t=Kn(e,t,i);break e}Tt(e,t,r,i)}t=t.child}return t;case 26:return gr(e,t),e===null?(i=Lp(t.type,null,t.pendingProps,null))?t.memoizedState=i:He||(i=t.type,e=t.pendingProps,r=jr(be.current).createElement(i),r[wt]=t,r[jt]=e,Mt(r,i,e),yt(r),t.stateNode=r):t.memoizedState=Lp(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ve(t),e===null&&He&&(r=t.stateNode=Ep(t.type,t.pendingProps,be.current),St=t,ln=!0,u=Ze,wi(t.type)?(Ru=u,Ze=sn(r.firstChild)):Ze=u),Tt(e,t,t.pendingProps.children,i),gr(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&He&&((u=r=Ze)&&(r=nx(r,t.type,t.pendingProps,ln),r!==null?(t.stateNode=r,St=t,Ze=sn(r.firstChild),ln=!1,u=!0):u=!1),u||ri(t)),ve(t),u=t.type,d=t.pendingProps,b=e!==null?e.memoizedProps:null,r=d.children,Eu(u,d)?r=null:b!==null&&Eu(u,b)&&(t.flags|=32),t.memoizedState!==null&&(u=Ac(e,t,bv,null,null,i),is._currentValue=u),gr(e,t),Tt(e,t,r,i),t.child;case 6:return e===null&&He&&((e=i=Ze)&&(i=ix(i,t.pendingProps,ln),i!==null?(t.stateNode=i,St=t,Ze=null,e=!0):e=!1),e||ri(t)),null;case 13:return gm(e,t,i);case 4:return we(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=qi(t,null,r,i):Tt(e,t,r,i),t.child;case 11:return rm(e,t,t.type,t.pendingProps,i);case 7:return Tt(e,t,t.pendingProps,i),t.child;case 8:return Tt(e,t,t.pendingProps.children,i),t.child;case 12:return Tt(e,t,t.pendingProps.children,i),t.child;case 10:return r=t.pendingProps,oi(t,t.type,r.value),Tt(e,t,r.children,i),t.child;case 9:return u=t.type._context,r=t.pendingProps.children,Yi(t),u=Ct(u),r=r(u),t.flags|=1,Tt(e,t,r,i),t.child;case 14:return om(e,t,t.type,t.pendingProps,i);case 15:return cm(e,t,t.type,t.pendingProps,i);case 19:return ym(e,t,i);case 31:return Mv(e,t,i);case 22:return um(e,t,i,t.pendingProps);case 24:return Yi(t),r=Ct(dt),e===null?(u=gc(),u===null&&(u=Ve,d=mc(),u.pooledCache=d,d.refCount++,d!==null&&(u.pooledCacheLanes|=i),u=d),t.memoizedState={parent:r,cache:u},yc(t),oi(t,dt,u)):((e.lanes&i)!==0&&(vc(e,t),Ha(t,null,null,i),za()),u=e.memoizedState,d=t.memoizedState,u.parent!==r?(u={parent:r,cache:r},t.memoizedState=u,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=u),oi(t,dt,r)):(r=d.cache,oi(t,dt,r),r!==u.cache&&hc(t,[dt],i,!0))),Tt(e,t,t.pendingProps.children,i),t.child;case 29:throw t.pendingProps}throw Error(s(156,t.tag))}function In(e){e.flags|=4}function eu(e,t,i,r,u){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(u&335544128)===u)if(e.stateNode.complete)e.flags|=8192;else if($m())e.flags|=8192;else throw Vi=tr,bc}else e.flags&=-16777217}function xm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Dp(t))if($m())e.flags|=8192;else throw Vi=tr,bc}function yr(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?ga():536870912,e.lanes|=t,Kl|=t)}function Ga(e,t){if(!He)switch(e.tailMode){case"hidden":t=e.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var r=null;i!==null;)i.alternate!==null&&(r=i),i=i.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function We(e){var t=e.alternate!==null&&e.alternate.child===e.child,i=0,r=0;if(t)for(var u=e.child;u!==null;)i|=u.lanes|u.childLanes,r|=u.subtreeFlags&65011712,r|=u.flags&65011712,u.return=e,u=u.sibling;else for(u=e.child;u!==null;)i|=u.lanes|u.childLanes,r|=u.subtreeFlags,r|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=r,e.childLanes=i,t}function Ev(e,t,i){var r=t.pendingProps;switch(oc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return We(t),null;case 1:return We(t),null;case 3:return i=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Hn(dt),ae(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(El(t)?In(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,uc())),We(t),null;case 26:var u=t.type,d=t.memoizedState;return e===null?(In(t),d!==null?(We(t),xm(t,d)):(We(t),eu(t,u,null,r,i))):d?d!==e.memoizedState?(In(t),We(t),xm(t,d)):(We(t),t.flags&=-16777217):(e=e.memoizedProps,e!==r&&In(t),We(t),eu(t,u,e,r,i)),null;case 27:if(Ne(t),i=be.current,u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&In(t);else{if(!r){if(t.stateNode===null)throw Error(s(166));return We(t),null}e=Te.current,El(t)?Jf(t):(e=Ep(u,r,i),t.stateNode=e,In(t))}return We(t),null;case 5:if(Ne(t),u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&In(t);else{if(!r){if(t.stateNode===null)throw Error(s(166));return We(t),null}if(d=Te.current,El(t))Jf(t);else{var b=jr(be.current);switch(d){case 1:d=b.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:d=b.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":d=b.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":d=b.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":d=b.createElement("div"),d.innerHTML="<script><\/script>",d=d.removeChild(d.firstChild);break;case"select":d=typeof r.is=="string"?b.createElement("select",{is:r.is}):b.createElement("select"),r.multiple?d.multiple=!0:r.size&&(d.size=r.size);break;default:d=typeof r.is=="string"?b.createElement(u,{is:r.is}):b.createElement(u)}}d[wt]=t,d[jt]=r;e:for(b=t.child;b!==null;){if(b.tag===5||b.tag===6)d.appendChild(b.stateNode);else if(b.tag!==4&&b.tag!==27&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===t)break e;for(;b.sibling===null;){if(b.return===null||b.return===t)break e;b=b.return}b.sibling.return=b.return,b=b.sibling}t.stateNode=d;e:switch(Mt(d,u,r),u){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&In(t)}}return We(t),eu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,i),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&In(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(s(166));if(e=be.current,El(t)){if(e=t.stateNode,i=t.memoizedProps,r=null,u=St,u!==null)switch(u.tag){case 27:case 5:r=u.memoizedProps}e[wt]=t,e=!!(e.nodeValue===i||r!==null&&r.suppressHydrationWarning===!0||gp(e.nodeValue,i)),e||ri(t,!0)}else e=jr(e).createTextNode(r),e[wt]=t,t.stateNode=e}return We(t),null;case 31:if(i=t.memoizedState,e===null||e.memoizedState!==null){if(r=El(t),i!==null){if(e===null){if(!r)throw Error(s(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(557));e[wt]=t}else Fi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;We(t),e=!1}else i=uc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),e=!0;if(!e)return t.flags&256?(Pt(t),t):(Pt(t),null);if((t.flags&128)!==0)throw Error(s(558))}return We(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=El(t),r!==null&&r.dehydrated!==null){if(e===null){if(!u)throw Error(s(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(s(317));u[wt]=t}else Fi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;We(t),u=!1}else u=uc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(Pt(t),t):(Pt(t),null)}return Pt(t),(t.flags&128)!==0?(t.lanes=i,t):(i=r!==null,e=e!==null&&e.memoizedState!==null,i&&(r=t.child,u=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(u=r.alternate.memoizedState.cachePool.pool),d=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(d=r.memoizedState.cachePool.pool),d!==u&&(r.flags|=2048)),i!==e&&i&&(t.child.flags|=8192),yr(t,t.updateQueue),We(t),null);case 4:return ae(),e===null&&Su(t.stateNode.containerInfo),We(t),null;case 10:return Hn(t.type),We(t),null;case 19:if(ye(ot),r=t.memoizedState,r===null)return We(t),null;if(u=(t.flags&128)!==0,d=r.rendering,d===null)if(u)Ga(r,!1);else{if(at!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(d=ar(e),d!==null){for(t.flags|=128,Ga(r,!1),e=d.updateQueue,t.updateQueue=e,yr(t,e),t.subtreeFlags=0,e=i,i=t.child;i!==null;)qf(i,e),i=i.sibling;return ue(ot,ot.current&1|2),He&&Dn(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&ut()>Cr&&(t.flags|=128,u=!0,Ga(r,!1),t.lanes=4194304)}else{if(!u)if(e=ar(d),e!==null){if(t.flags|=128,u=!0,e=e.updateQueue,t.updateQueue=e,yr(t,e),Ga(r,!0),r.tail===null&&r.tailMode==="hidden"&&!d.alternate&&!He)return We(t),null}else 2*ut()-r.renderingStartTime>Cr&&i!==536870912&&(t.flags|=128,u=!0,Ga(r,!1),t.lanes=4194304);r.isBackwards?(d.sibling=t.child,t.child=d):(e=r.last,e!==null?e.sibling=d:t.child=d,r.last=d)}return r.tail!==null?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=ut(),e.sibling=null,i=ot.current,ue(ot,u?i&1|2:i&1),He&&Dn(t,r.treeForkCount),e):(We(t),null);case 22:case 23:return Pt(t),Cc(),r=t.memoizedState!==null,e!==null?e.memoizedState!==null!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?(i&536870912)!==0&&(t.flags&128)===0&&(We(t),t.subtreeFlags&6&&(t.flags|=8192)):We(t),i=t.updateQueue,i!==null&&yr(t,i.retryQueue),i=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==i&&(t.flags|=2048),e!==null&&ye(Pi),null;case 24:return i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),Hn(dt),We(t),null;case 25:return null;case 30:return null}throw Error(s(156,t.tag))}function Nv(e,t){switch(oc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Hn(dt),ae(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Ne(t),null;case 31:if(t.memoizedState!==null){if(Pt(t),t.alternate===null)throw Error(s(340));Fi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Pt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(s(340));Fi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ye(ot),null;case 4:return ae(),null;case 10:return Hn(t.type),null;case 22:case 23:return Pt(t),Cc(),e!==null&&ye(Pi),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Hn(dt),null;case 25:return null;default:return null}}function wm(e,t){switch(oc(t),t.tag){case 3:Hn(dt),ae();break;case 26:case 27:case 5:Ne(t);break;case 4:ae();break;case 31:t.memoizedState!==null&&Pt(t);break;case 13:Pt(t);break;case 19:ye(ot);break;case 10:Hn(t.type);break;case 22:case 23:Pt(t),Cc(),e!==null&&ye(Pi);break;case 24:Hn(dt)}}function Ya(e,t){try{var i=t.updateQueue,r=i!==null?i.lastEffect:null;if(r!==null){var u=r.next;i=u;do{if((i.tag&e)===e){r=void 0;var d=i.create,b=i.inst;r=d(),b.destroy=r}i=i.next}while(i!==u)}}catch(C){Ge(t,t.return,C)}}function mi(e,t,i){try{var r=t.updateQueue,u=r!==null?r.lastEffect:null;if(u!==null){var d=u.next;r=d;do{if((r.tag&e)===e){var b=r.inst,C=b.destroy;if(C!==void 0){b.destroy=void 0,u=t;var _=i,F=C;try{F()}catch(X){Ge(u,_,X)}}}r=r.next}while(r!==d)}}catch(X){Ge(t,t.return,X)}}function Sm(e){var t=e.updateQueue;if(t!==null){var i=e.stateNode;try{fh(t,i)}catch(r){Ge(e,e.return,r)}}}function Cm(e,t,i){i.props=Zi(e.type,e.memoizedProps),i.state=e.memoizedState;try{i.componentWillUnmount()}catch(r){Ge(e,t,r)}}function Pa(e,t){try{var i=e.ref;if(i!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof i=="function"?e.refCleanup=i(r):i.current=r}}catch(u){Ge(e,t,u)}}function Cn(e,t){var i=e.ref,r=e.refCleanup;if(i!==null)if(typeof r=="function")try{r()}catch(u){Ge(e,t,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(u){Ge(e,t,u)}else i.current=null}function Tm(e){var t=e.type,i=e.memoizedProps,r=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":i.autoFocus&&r.focus();break e;case"img":i.src?r.src=i.src:i.srcSet&&(r.srcset=i.srcSet)}}catch(u){Ge(e,e.return,u)}}function tu(e,t,i){try{var r=e.stateNode;Zv(r,e.type,i,t),r[jt]=t}catch(u){Ge(e,e.return,u)}}function Mm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&wi(e.type)||e.tag===4}function nu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Mm(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&&wi(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 iu(e,t,i){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(e,t):(t=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,t.appendChild(e),i=i._reactRootContainer,i!=null||t.onclick!==null||(t.onclick=Rn));else if(r!==4&&(r===27&&wi(e.type)&&(i=e.stateNode,t=null),e=e.child,e!==null))for(iu(e,t,i),e=e.sibling;e!==null;)iu(e,t,i),e=e.sibling}function vr(e,t,i){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?i.insertBefore(e,t):i.appendChild(e);else if(r!==4&&(r===27&&wi(e.type)&&(i=e.stateNode),e=e.child,e!==null))for(vr(e,t,i),e=e.sibling;e!==null;)vr(e,t,i),e=e.sibling}function Am(e){var t=e.stateNode,i=e.memoizedProps;try{for(var r=e.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);Mt(t,r,i),t[wt]=e,t[jt]=i}catch(d){Ge(e,e.return,d)}}var Fn=!1,mt=!1,lu=!1,Em=typeof WeakSet=="function"?WeakSet:Set,vt=null;function kv(e,t){if(e=e.containerInfo,Mu=Kr,e=Uf(e),Wo(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var r=i.getSelection&&i.getSelection();if(r&&r.rangeCount!==0){i=r.anchorNode;var u=r.anchorOffset,d=r.focusNode;r=r.focusOffset;try{i.nodeType,d.nodeType}catch{i=null;break e}var b=0,C=-1,_=-1,F=0,X=0,ee=e,Y=null;t:for(;;){for(var V;ee!==i||u!==0&&ee.nodeType!==3||(C=b+u),ee!==d||r!==0&&ee.nodeType!==3||(_=b+r),ee.nodeType===3&&(b+=ee.nodeValue.length),(V=ee.firstChild)!==null;)Y=ee,ee=V;for(;;){if(ee===e)break t;if(Y===i&&++F===u&&(C=b),Y===d&&++X===r&&(_=b),(V=ee.nextSibling)!==null)break;ee=Y,Y=ee.parentNode}ee=V}i=C===-1||_===-1?null:{start:C,end:_}}else i=null}i=i||{start:0,end:0}}else i=null;for(Au={focusedElem:e,selectionRange:i},Kr=!1,vt=t;vt!==null;)if(t=vt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,vt=e;else for(;vt!==null;){switch(t=vt,d=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(i=0;i<e.length;i++)u=e[i],u.ref.impl=u.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&d!==null){e=void 0,i=t,u=d.memoizedProps,d=d.memoizedState,r=i.stateNode;try{var me=Zi(i.type,u);e=r.getSnapshotBeforeUpdate(me,d),r.__reactInternalSnapshotBeforeUpdate=e}catch(Ce){Ge(i,i.return,Ce)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,i=e.nodeType,i===9)ku(e);else if(i===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":ku(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(s(163))}if(e=t.sibling,e!==null){e.return=t.return,vt=e;break}vt=t.return}}function Nm(e,t,i){var r=i.flags;switch(i.tag){case 0:case 11:case 15:Yn(e,i),r&4&&Ya(5,i);break;case 1:if(Yn(e,i),r&4)if(e=i.stateNode,t===null)try{e.componentDidMount()}catch(b){Ge(i,i.return,b)}else{var u=Zi(i.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(u,t,e.__reactInternalSnapshotBeforeUpdate)}catch(b){Ge(i,i.return,b)}}r&64&&Sm(i),r&512&&Pa(i,i.return);break;case 3:if(Yn(e,i),r&64&&(e=i.updateQueue,e!==null)){if(t=null,i.child!==null)switch(i.child.tag){case 27:case 5:t=i.child.stateNode;break;case 1:t=i.child.stateNode}try{fh(e,t)}catch(b){Ge(i,i.return,b)}}break;case 27:t===null&&r&4&&Am(i);case 26:case 5:Yn(e,i),t===null&&r&4&&Tm(i),r&512&&Pa(i,i.return);break;case 12:Yn(e,i);break;case 31:Yn(e,i),r&4&&_m(e,i);break;case 13:Yn(e,i),r&4&&Rm(e,i),r&64&&(e=i.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(i=Bv.bind(null,i),lx(e,i))));break;case 22:if(r=i.memoizedState!==null||Fn,!r){t=t!==null&&t.memoizedState!==null||mt,u=Fn;var d=mt;Fn=r,(mt=t)&&!d?Pn(e,i,(i.subtreeFlags&8772)!==0):Yn(e,i),Fn=u,mt=d}break;case 30:break;default:Yn(e,i)}}function km(e){var t=e.alternate;t!==null&&(e.alternate=null,km(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Oo(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 nt=null,Dt=!1;function Gn(e,t,i){for(i=i.child;i!==null;)Lm(e,t,i),i=i.sibling}function Lm(e,t,i){if(At&&typeof At.onCommitFiberUnmount=="function")try{At.onCommitFiberUnmount(ti,i)}catch{}switch(i.tag){case 26:mt||Cn(i,t),Gn(e,t,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:mt||Cn(i,t);var r=nt,u=Dt;wi(i.type)&&(nt=i.stateNode,Dt=!1),Gn(e,t,i),es(i.stateNode),nt=r,Dt=u;break;case 5:mt||Cn(i,t);case 6:if(r=nt,u=Dt,nt=null,Gn(e,t,i),nt=r,Dt=u,nt!==null)if(Dt)try{(nt.nodeType===9?nt.body:nt.nodeName==="HTML"?nt.ownerDocument.body:nt).removeChild(i.stateNode)}catch(d){Ge(i,t,d)}else try{nt.removeChild(i.stateNode)}catch(d){Ge(i,t,d)}break;case 18:nt!==null&&(Dt?(e=nt,Sp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,i.stateNode),ql(e)):Sp(nt,i.stateNode));break;case 4:r=nt,u=Dt,nt=i.stateNode.containerInfo,Dt=!0,Gn(e,t,i),nt=r,Dt=u;break;case 0:case 11:case 14:case 15:mi(2,i,t),mt||mi(4,i,t),Gn(e,t,i);break;case 1:mt||(Cn(i,t),r=i.stateNode,typeof r.componentWillUnmount=="function"&&Cm(i,t,r)),Gn(e,t,i);break;case 21:Gn(e,t,i);break;case 22:mt=(r=mt)||i.memoizedState!==null,Gn(e,t,i),mt=r;break;default:Gn(e,t,i)}}function _m(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{ql(e)}catch(i){Ge(t,t.return,i)}}}function Rm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{ql(e)}catch(i){Ge(t,t.return,i)}}function Lv(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Em),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Em),t;default:throw Error(s(435,e.tag))}}function xr(e,t){var i=Lv(e);t.forEach(function(r){if(!i.has(r)){i.add(r);var u=Uv.bind(null,e,r);r.then(u,u)}})}function zt(e,t){var i=t.deletions;if(i!==null)for(var r=0;r<i.length;r++){var u=i[r],d=e,b=t,C=b;e:for(;C!==null;){switch(C.tag){case 27:if(wi(C.type)){nt=C.stateNode,Dt=!1;break e}break;case 5:nt=C.stateNode,Dt=!1;break e;case 3:case 4:nt=C.stateNode.containerInfo,Dt=!0;break e}C=C.return}if(nt===null)throw Error(s(160));Lm(d,b,u),nt=null,Dt=!1,d=u.alternate,d!==null&&(d.return=null),u.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)jm(t,e),t=t.sibling}var hn=null;function jm(e,t){var i=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:zt(t,e),Ht(e),r&4&&(mi(3,e,e.return),Ya(3,e),mi(5,e,e.return));break;case 1:zt(t,e),Ht(e),r&512&&(mt||i===null||Cn(i,i.return)),r&64&&Fn&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(i=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=i===null?r:i.concat(r))));break;case 26:var u=hn;if(zt(t,e),Ht(e),r&512&&(mt||i===null||Cn(i,i.return)),r&4){var d=i!==null?i.memoizedState:null;if(r=e.memoizedState,i===null)if(r===null)if(e.stateNode===null){e:{r=e.type,i=e.memoizedProps,u=u.ownerDocument||u;t:switch(r){case"title":d=u.getElementsByTagName("title")[0],(!d||d[ya]||d[wt]||d.namespaceURI==="http://www.w3.org/2000/svg"||d.hasAttribute("itemprop"))&&(d=u.createElement(r),u.head.insertBefore(d,u.querySelector("head > title"))),Mt(d,r,i),d[wt]=e,yt(d),r=d;break e;case"link":var b=jp("link","href",u).get(r+(i.href||""));if(b){for(var C=0;C<b.length;C++)if(d=b[C],d.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&d.getAttribute("rel")===(i.rel==null?null:i.rel)&&d.getAttribute("title")===(i.title==null?null:i.title)&&d.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){b.splice(C,1);break t}}d=u.createElement(r),Mt(d,r,i),u.head.appendChild(d);break;case"meta":if(b=jp("meta","content",u).get(r+(i.content||""))){for(C=0;C<b.length;C++)if(d=b[C],d.getAttribute("content")===(i.content==null?null:""+i.content)&&d.getAttribute("name")===(i.name==null?null:i.name)&&d.getAttribute("property")===(i.property==null?null:i.property)&&d.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&d.getAttribute("charset")===(i.charSet==null?null:i.charSet)){b.splice(C,1);break t}}d=u.createElement(r),Mt(d,r,i),u.head.appendChild(d);break;default:throw Error(s(468,r))}d[wt]=e,yt(d),r=d}e.stateNode=r}else Op(u,e.type,e.stateNode);else e.stateNode=Rp(u,r,e.memoizedProps);else d!==r?(d===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):d.count--,r===null?Op(u,e.type,e.stateNode):Rp(u,r,e.memoizedProps)):r===null&&e.stateNode!==null&&tu(e,e.memoizedProps,i.memoizedProps)}break;case 27:zt(t,e),Ht(e),r&512&&(mt||i===null||Cn(i,i.return)),i!==null&&r&4&&tu(e,e.memoizedProps,i.memoizedProps);break;case 5:if(zt(t,e),Ht(e),r&512&&(mt||i===null||Cn(i,i.return)),e.flags&32){u=e.stateNode;try{bl(u,"")}catch(me){Ge(e,e.return,me)}}r&4&&e.stateNode!=null&&(u=e.memoizedProps,tu(e,u,i!==null?i.memoizedProps:u)),r&1024&&(lu=!0);break;case 6:if(zt(t,e),Ht(e),r&4){if(e.stateNode===null)throw Error(s(162));r=e.memoizedProps,i=e.stateNode;try{i.nodeValue=r}catch(me){Ge(e,e.return,me)}}break;case 3:if(zr=null,u=hn,hn=Or(t.containerInfo),zt(t,e),hn=u,Ht(e),r&4&&i!==null&&i.memoizedState.isDehydrated)try{ql(t.containerInfo)}catch(me){Ge(e,e.return,me)}lu&&(lu=!1,Om(e));break;case 4:r=hn,hn=Or(e.stateNode.containerInfo),zt(t,e),Ht(e),hn=r;break;case 12:zt(t,e),Ht(e);break;case 31:zt(t,e),Ht(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,xr(e,r)));break;case 13:zt(t,e),Ht(e),e.child.flags&8192&&e.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(Sr=ut()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,xr(e,r)));break;case 22:u=e.memoizedState!==null;var _=i!==null&&i.memoizedState!==null,F=Fn,X=mt;if(Fn=F||u,mt=X||_,zt(t,e),mt=X,Fn=F,Ht(e),r&8192)e:for(t=e.stateNode,t._visibility=u?t._visibility&-2:t._visibility|1,u&&(i===null||_||Fn||mt||Wi(e)),i=null,t=e;;){if(t.tag===5||t.tag===26){if(i===null){_=i=t;try{if(d=_.stateNode,u)b=d.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none";else{C=_.stateNode;var ee=_.memoizedProps.style,Y=ee!=null&&ee.hasOwnProperty("display")?ee.display:null;C.style.display=Y==null||typeof Y=="boolean"?"":(""+Y).trim()}}catch(me){Ge(_,_.return,me)}}}else if(t.tag===6){if(i===null){_=t;try{_.stateNode.nodeValue=u?"":_.memoizedProps}catch(me){Ge(_,_.return,me)}}}else if(t.tag===18){if(i===null){_=t;try{var V=_.stateNode;u?Cp(V,!0):Cp(_.stateNode,!1)}catch(me){Ge(_,_.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;i===t&&(i=null),t=t.return}i===t&&(i=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(i=r.retryQueue,i!==null&&(r.retryQueue=null,xr(e,i))));break;case 19:zt(t,e),Ht(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,xr(e,r)));break;case 30:break;case 21:break;default:zt(t,e),Ht(e)}}function Ht(e){var t=e.flags;if(t&2){try{for(var i,r=e.return;r!==null;){if(Mm(r)){i=r;break}r=r.return}if(i==null)throw Error(s(160));switch(i.tag){case 27:var u=i.stateNode,d=nu(e);vr(e,d,u);break;case 5:var b=i.stateNode;i.flags&32&&(bl(b,""),i.flags&=-33);var C=nu(e);vr(e,C,b);break;case 3:case 4:var _=i.stateNode.containerInfo,F=nu(e);iu(e,F,_);break;default:throw Error(s(161))}}catch(X){Ge(e,e.return,X)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Om(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Om(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Yn(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Nm(e,t.alternate,t),t=t.sibling}function Wi(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:mi(4,t,t.return),Wi(t);break;case 1:Cn(t,t.return);var i=t.stateNode;typeof i.componentWillUnmount=="function"&&Cm(t,t.return,i),Wi(t);break;case 27:es(t.stateNode);case 26:case 5:Cn(t,t.return),Wi(t);break;case 22:t.memoizedState===null&&Wi(t);break;case 30:Wi(t);break;default:Wi(t)}e=e.sibling}}function Pn(e,t,i){for(i=i&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var r=t.alternate,u=e,d=t,b=d.flags;switch(d.tag){case 0:case 11:case 15:Pn(u,d,i),Ya(4,d);break;case 1:if(Pn(u,d,i),r=d,u=r.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(F){Ge(r,r.return,F)}if(r=d,u=r.updateQueue,u!==null){var C=r.stateNode;try{var _=u.shared.hiddenCallbacks;if(_!==null)for(u.shared.hiddenCallbacks=null,u=0;u<_.length;u++)dh(_[u],C)}catch(F){Ge(r,r.return,F)}}i&&b&64&&Sm(d),Pa(d,d.return);break;case 27:Am(d);case 26:case 5:Pn(u,d,i),i&&r===null&&b&4&&Tm(d),Pa(d,d.return);break;case 12:Pn(u,d,i);break;case 31:Pn(u,d,i),i&&b&4&&_m(u,d);break;case 13:Pn(u,d,i),i&&b&4&&Rm(u,d);break;case 22:d.memoizedState===null&&Pn(u,d,i),Pa(d,d.return);break;case 30:break;default:Pn(u,d,i)}t=t.sibling}}function au(e,t){var i=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==i&&(e!=null&&e.refCount++,i!=null&&_a(i))}function su(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&_a(e))}function mn(e,t,i,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Dm(e,t,i,r),t=t.sibling}function Dm(e,t,i,r){var u=t.flags;switch(t.tag){case 0:case 11:case 15:mn(e,t,i,r),u&2048&&Ya(9,t);break;case 1:mn(e,t,i,r);break;case 3:mn(e,t,i,r),u&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&_a(e)));break;case 12:if(u&2048){mn(e,t,i,r),e=t.stateNode;try{var d=t.memoizedProps,b=d.id,C=d.onPostCommit;typeof C=="function"&&C(b,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(_){Ge(t,t.return,_)}}else mn(e,t,i,r);break;case 31:mn(e,t,i,r);break;case 13:mn(e,t,i,r);break;case 23:break;case 22:d=t.stateNode,b=t.alternate,t.memoizedState!==null?d._visibility&2?mn(e,t,i,r):$a(e,t):d._visibility&2?mn(e,t,i,r):(d._visibility|=2,Hl(e,t,i,r,(t.subtreeFlags&10256)!==0||!1)),u&2048&&au(b,t);break;case 24:mn(e,t,i,r),u&2048&&su(t.alternate,t);break;default:mn(e,t,i,r)}}function Hl(e,t,i,r,u){for(u=u&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var d=e,b=t,C=i,_=r,F=b.flags;switch(b.tag){case 0:case 11:case 15:Hl(d,b,C,_,u),Ya(8,b);break;case 23:break;case 22:var X=b.stateNode;b.memoizedState!==null?X._visibility&2?Hl(d,b,C,_,u):$a(d,b):(X._visibility|=2,Hl(d,b,C,_,u)),u&&F&2048&&au(b.alternate,b);break;case 24:Hl(d,b,C,_,u),u&&F&2048&&su(b.alternate,b);break;default:Hl(d,b,C,_,u)}t=t.sibling}}function $a(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var i=e,r=t,u=r.flags;switch(r.tag){case 22:$a(i,r),u&2048&&au(r.alternate,r);break;case 24:$a(i,r),u&2048&&su(r.alternate,r);break;default:$a(i,r)}t=t.sibling}}var Va=8192;function Bl(e,t,i){if(e.subtreeFlags&Va)for(e=e.child;e!==null;)zm(e,t,i),e=e.sibling}function zm(e,t,i){switch(e.tag){case 26:Bl(e,t,i),e.flags&Va&&e.memoizedState!==null&&gx(i,hn,e.memoizedState,e.memoizedProps);break;case 5:Bl(e,t,i);break;case 3:case 4:var r=hn;hn=Or(e.stateNode.containerInfo),Bl(e,t,i),hn=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Va,Va=16777216,Bl(e,t,i),Va=r):Bl(e,t,i));break;default:Bl(e,t,i)}}function Hm(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 qa(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var i=0;i<t.length;i++){var r=t[i];vt=r,Um(r,e)}Hm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Bm(e),e=e.sibling}function Bm(e){switch(e.tag){case 0:case 11:case 15:qa(e),e.flags&2048&&mi(9,e,e.return);break;case 3:qa(e);break;case 12:qa(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,wr(e)):qa(e);break;default:qa(e)}}function wr(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var i=0;i<t.length;i++){var r=t[i];vt=r,Um(r,e)}Hm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:mi(8,t,t.return),wr(t);break;case 22:i=t.stateNode,i._visibility&2&&(i._visibility&=-3,wr(t));break;default:wr(t)}e=e.sibling}}function Um(e,t){for(;vt!==null;){var i=vt;switch(i.tag){case 0:case 11:case 15:mi(8,i,t);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var r=i.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:_a(i.memoizedState.cache)}if(r=i.child,r!==null)r.return=i,vt=r;else e:for(i=e;vt!==null;){r=vt;var u=r.sibling,d=r.return;if(km(r),r===i){vt=null;break e}if(u!==null){u.return=d,vt=u;break e}vt=d}}}var _v={getCacheForType:function(e){var t=Ct(dt),i=t.data.get(e);return i===void 0&&(i=e(),t.data.set(e,i)),i},cacheSignal:function(){return Ct(dt).controller.signal}},Rv=typeof WeakMap=="function"?WeakMap:Map,Ke=0,Ve=null,je=null,De=0,Fe=0,$t=null,pi=!1,Ul=!1,ru=!1,$n=0,at=0,gi=0,Qi=0,ou=0,Vt=0,Kl=0,Xa=null,Bt=null,cu=!1,Sr=0,Km=0,Cr=1/0,Tr=null,bi=null,pt=0,yi=null,Il=null,Vn=0,uu=0,du=null,Im=null,Za=0,fu=null;function qt(){return(Ke&2)!==0&&De!==0?De&-De:A.T!==null?yu():nf()}function Fm(){if(Vt===0)if((De&536870912)===0||He){var e=It;It<<=1,(It&3932160)===0&&(It=262144),Vt=e}else Vt=536870912;return e=Yt.current,e!==null&&(e.flags|=32),Vt}function Ut(e,t,i){(e===Ve&&(Fe===2||Fe===9)||e.cancelPendingCommit!==null)&&(Fl(e,0),vi(e,De,Vt,!1)),ba(e,i),((Ke&2)===0||e!==Ve)&&(e===Ve&&((Ke&2)===0&&(Qi|=i),at===4&&vi(e,De,Vt,!1)),Tn(e))}function Gm(e,t,i){if((Ke&6)!==0)throw Error(s(327));var r=!i&&(t&127)===0&&(t&e.expiredLanes)===0||ni(e,t),u=r?Dv(e,t):mu(e,t,!0),d=r;do{if(u===0){Ul&&!r&&vi(e,t,0,!1);break}else{if(i=e.current.alternate,d&&!jv(i)){u=mu(e,t,!1),d=!1;continue}if(u===2){if(d=t,e.errorRecoveryDisabledLanes&d)var b=0;else b=e.pendingLanes&-536870913,b=b!==0?b:b&536870912?536870912:0;if(b!==0){t=b;e:{var C=e;u=Xa;var _=C.current.memoizedState.isDehydrated;if(_&&(Fl(C,b).flags|=256),b=mu(C,b,!1),b!==2){if(ru&&!_){C.errorRecoveryDisabledLanes|=d,Qi|=d,u=4;break e}d=Bt,Bt=u,d!==null&&(Bt===null?Bt=d:Bt.push.apply(Bt,d))}u=b}if(d=!1,u!==2)continue}}if(u===1){Fl(e,0),vi(e,t,0,!0);break}e:{switch(r=e,d=u,d){case 0:case 1:throw Error(s(345));case 4:if((t&4194048)!==t)break;case 6:vi(r,t,Vt,!pi);break e;case 2:Bt=null;break;case 3:case 5:break;default:throw Error(s(329))}if((t&62914560)===t&&(u=Sr+300-ut(),10<u)){if(vi(r,t,Vt,!pi),ul(r,0,!0)!==0)break e;Vn=t,r.timeoutHandle=xp(Ym.bind(null,r,i,Bt,Tr,cu,t,Vt,Qi,Kl,pi,d,"Throttled",-0,0),u);break e}Ym(r,i,Bt,Tr,cu,t,Vt,Qi,Kl,pi,d,null,-0,0)}}break}while(!0);Tn(e)}function Ym(e,t,i,r,u,d,b,C,_,F,X,ee,Y,V){if(e.timeoutHandle=-1,ee=t.subtreeFlags,ee&8192||(ee&16785408)===16785408){ee={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Rn},zm(t,d,ee);var me=(d&62914560)===d?Sr-ut():(d&4194048)===d?Km-ut():0;if(me=bx(ee,me),me!==null){Vn=d,e.cancelPendingCommit=me(Qm.bind(null,e,t,d,i,r,u,b,C,_,X,ee,null,Y,V)),vi(e,d,b,!F);return}}Qm(e,t,d,i,r,u,b,C,_)}function jv(e){for(var t=e;;){var i=t.tag;if((i===0||i===11||i===15)&&t.flags&16384&&(i=t.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var r=0;r<i.length;r++){var u=i[r],d=u.getSnapshot;u=u.value;try{if(!Ft(d(),u))return!1}catch{return!1}}if(i=t.child,t.subtreeFlags&16384&&i!==null)i.return=t,t=i;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 vi(e,t,i,r){t&=~ou,t&=~Qi,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var u=t;0<u;){var d=31-kt(u),b=1<<d;r[d]=-1,u&=~b}i!==0&&Jd(e,i,t)}function Mr(){return(Ke&6)===0?(Wa(0),!1):!0}function hu(){if(je!==null){if(Fe===0)var e=je.return;else e=je,zn=Gi=null,kc(e),Rl=null,ja=0,e=je;for(;e!==null;)wm(e.alternate,e),e=e.return;je=null}}function Fl(e,t){var i=e.timeoutHandle;i!==-1&&(e.timeoutHandle=-1,Jv(i)),i=e.cancelPendingCommit,i!==null&&(e.cancelPendingCommit=null,i()),Vn=0,hu(),Ve=e,je=i=On(e.current,null),De=t,Fe=0,$t=null,pi=!1,Ul=ni(e,t),ru=!1,Kl=Vt=ou=Qi=gi=at=0,Bt=Xa=null,cu=!1,(t&8)!==0&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var u=31-kt(r),d=1<<u;t|=e[u],r&=~d}return $n=t,$s(),i}function Pm(e,t){Le=null,A.H=Ia,t===_l||t===er?(t=rh(),Fe=3):t===bc?(t=rh(),Fe=4):Fe=t===Pc?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,$t=t,je===null&&(at=1,mr(e,en(t,e.current)))}function $m(){var e=Yt.current;return e===null?!0:(De&4194048)===De?an===null:(De&62914560)===De||(De&536870912)!==0?e===an:!1}function Vm(){var e=A.H;return A.H=Ia,e===null?Ia:e}function qm(){var e=A.A;return A.A=_v,e}function Ar(){at=4,pi||(De&4194048)!==De&&Yt.current!==null||(Ul=!0),(gi&134217727)===0&&(Qi&134217727)===0||Ve===null||vi(Ve,De,Vt,!1)}function mu(e,t,i){var r=Ke;Ke|=2;var u=Vm(),d=qm();(Ve!==e||De!==t)&&(Tr=null,Fl(e,t)),t=!1;var b=at;e:do try{if(Fe!==0&&je!==null){var C=je,_=$t;switch(Fe){case 8:hu(),b=6;break e;case 3:case 2:case 9:case 6:Yt.current===null&&(t=!0);var F=Fe;if(Fe=0,$t=null,Gl(e,C,_,F),i&&Ul){b=0;break e}break;default:F=Fe,Fe=0,$t=null,Gl(e,C,_,F)}}Ov(),b=at;break}catch(X){Pm(e,X)}while(!0);return t&&e.shellSuspendCounter++,zn=Gi=null,Ke=r,A.H=u,A.A=d,je===null&&(Ve=null,De=0,$s()),b}function Ov(){for(;je!==null;)Xm(je)}function Dv(e,t){var i=Ke;Ke|=2;var r=Vm(),u=qm();Ve!==e||De!==t?(Tr=null,Cr=ut()+500,Fl(e,t)):Ul=ni(e,t);e:do try{if(Fe!==0&&je!==null){t=je;var d=$t;t:switch(Fe){case 1:Fe=0,$t=null,Gl(e,t,d,1);break;case 2:case 9:if(ah(d)){Fe=0,$t=null,Zm(t);break}t=function(){Fe!==2&&Fe!==9||Ve!==e||(Fe=7),Tn(e)},d.then(t,t);break e;case 3:Fe=7;break e;case 4:Fe=5;break e;case 7:ah(d)?(Fe=0,$t=null,Zm(t)):(Fe=0,$t=null,Gl(e,t,d,7));break;case 5:var b=null;switch(je.tag){case 26:b=je.memoizedState;case 5:case 27:var C=je;if(b?Dp(b):C.stateNode.complete){Fe=0,$t=null;var _=C.sibling;if(_!==null)je=_;else{var F=C.return;F!==null?(je=F,Er(F)):je=null}break t}}Fe=0,$t=null,Gl(e,t,d,5);break;case 6:Fe=0,$t=null,Gl(e,t,d,6);break;case 8:hu(),at=6;break e;default:throw Error(s(462))}}zv();break}catch(X){Pm(e,X)}while(!0);return zn=Gi=null,A.H=r,A.A=u,Ke=i,je!==null?0:(Ve=null,De=0,$s(),at)}function zv(){for(;je!==null&&!kn();)Xm(je)}function Xm(e){var t=vm(e.alternate,e,$n);e.memoizedProps=e.pendingProps,t===null?Er(e):je=t}function Zm(e){var t=e,i=t.alternate;switch(t.tag){case 15:case 0:t=hm(i,t,t.pendingProps,t.type,void 0,De);break;case 11:t=hm(i,t,t.pendingProps,t.type.render,t.ref,De);break;case 5:kc(t);default:wm(i,t),t=je=qf(t,$n),t=vm(i,t,$n)}e.memoizedProps=e.pendingProps,t===null?Er(e):je=t}function Gl(e,t,i,r){zn=Gi=null,kc(t),Rl=null,ja=0;var u=t.return;try{if(Tv(e,u,t,i,De)){at=1,mr(e,en(i,e.current)),je=null;return}}catch(d){if(u!==null)throw je=u,d;at=1,mr(e,en(i,e.current)),je=null;return}t.flags&32768?(He||r===1?e=!0:Ul||(De&536870912)!==0?e=!1:(pi=e=!0,(r===2||r===9||r===3||r===6)&&(r=Yt.current,r!==null&&r.tag===13&&(r.flags|=16384))),Wm(t,e)):Er(t)}function Er(e){var t=e;do{if((t.flags&32768)!==0){Wm(t,pi);return}e=t.return;var i=Ev(t.alternate,t,$n);if(i!==null){je=i;return}if(t=t.sibling,t!==null){je=t;return}je=t=e}while(t!==null);at===0&&(at=5)}function Wm(e,t){do{var i=Nv(e.alternate,e);if(i!==null){i.flags&=32767,je=i;return}if(i=e.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!t&&(e=e.sibling,e!==null)){je=e;return}je=e=i}while(e!==null);at=6,je=null}function Qm(e,t,i,r,u,d,b,C,_){e.cancelPendingCommit=null;do Nr();while(pt!==0);if((Ke&6)!==0)throw Error(s(327));if(t!==null){if(t===e.current)throw Error(s(177));if(d=t.lanes|t.childLanes,d|=nc,p0(e,i,d,b,C,_),e===Ve&&(je=Ve=null,De=0),Il=t,yi=e,Vn=i,uu=d,du=u,Im=r,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Kv(Di,function(){return ip(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||r){r=A.T,A.T=null,u=G.p,G.p=2,b=Ke,Ke|=4;try{kv(e,t,i)}finally{Ke=b,G.p=u,A.T=r}}pt=1,Jm(),ep(),tp()}}function Jm(){if(pt===1){pt=0;var e=yi,t=Il,i=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||i){i=A.T,A.T=null;var r=G.p;G.p=2;var u=Ke;Ke|=4;try{jm(t,e);var d=Au,b=Uf(e.containerInfo),C=d.focusedElem,_=d.selectionRange;if(b!==C&&C&&C.ownerDocument&&Bf(C.ownerDocument.documentElement,C)){if(_!==null&&Wo(C)){var F=_.start,X=_.end;if(X===void 0&&(X=F),"selectionStart"in C)C.selectionStart=F,C.selectionEnd=Math.min(X,C.value.length);else{var ee=C.ownerDocument||document,Y=ee&&ee.defaultView||window;if(Y.getSelection){var V=Y.getSelection(),me=C.textContent.length,Ce=Math.min(_.start,me),$e=_.end===void 0?Ce:Math.min(_.end,me);!V.extend&&Ce>$e&&(b=$e,$e=Ce,Ce=b);var U=Hf(C,Ce),O=Hf(C,$e);if(U&&O&&(V.rangeCount!==1||V.anchorNode!==U.node||V.anchorOffset!==U.offset||V.focusNode!==O.node||V.focusOffset!==O.offset)){var I=ee.createRange();I.setStart(U.node,U.offset),V.removeAllRanges(),Ce>$e?(V.addRange(I),V.extend(O.node,O.offset)):(I.setEnd(O.node,O.offset),V.addRange(I))}}}}for(ee=[],V=C;V=V.parentNode;)V.nodeType===1&&ee.push({element:V,left:V.scrollLeft,top:V.scrollTop});for(typeof C.focus=="function"&&C.focus(),C=0;C<ee.length;C++){var J=ee[C];J.element.scrollLeft=J.left,J.element.scrollTop=J.top}}Kr=!!Mu,Au=Mu=null}finally{Ke=u,G.p=r,A.T=i}}e.current=t,pt=2}}function ep(){if(pt===2){pt=0;var e=yi,t=Il,i=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||i){i=A.T,A.T=null;var r=G.p;G.p=2;var u=Ke;Ke|=4;try{Nm(e,t.alternate,t)}finally{Ke=u,G.p=r,A.T=i}}pt=3}}function tp(){if(pt===4||pt===3){pt=0,Zt();var e=yi,t=Il,i=Vn,r=Im;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?pt=5:(pt=0,Il=yi=null,np(e,e.pendingLanes));var u=e.pendingLanes;if(u===0&&(bi=null),Ro(i),t=t.stateNode,At&&typeof At.onCommitFiberRoot=="function")try{At.onCommitFiberRoot(ti,t,void 0,(t.current.flags&128)===128)}catch{}if(r!==null){t=A.T,u=G.p,G.p=2,A.T=null;try{for(var d=e.onRecoverableError,b=0;b<r.length;b++){var C=r[b];d(C.value,{componentStack:C.stack})}}finally{A.T=t,G.p=u}}(Vn&3)!==0&&Nr(),Tn(e),u=e.pendingLanes,(i&261930)!==0&&(u&42)!==0?e===fu?Za++:(Za=0,fu=e):Za=0,Wa(0)}}function np(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,_a(t)))}function Nr(){return Jm(),ep(),tp(),ip()}function ip(){if(pt!==5)return!1;var e=yi,t=uu;uu=0;var i=Ro(Vn),r=A.T,u=G.p;try{G.p=32>i?32:i,A.T=null,i=du,du=null;var d=yi,b=Vn;if(pt=0,Il=yi=null,Vn=0,(Ke&6)!==0)throw Error(s(331));var C=Ke;if(Ke|=4,Bm(d.current),Dm(d,d.current,b,i),Ke=C,Wa(0,!1),At&&typeof At.onPostCommitFiberRoot=="function")try{At.onPostCommitFiberRoot(ti,d)}catch{}return!0}finally{G.p=u,A.T=r,np(e,t)}}function lp(e,t,i){t=en(i,t),t=Yc(e.stateNode,t,2),e=di(e,t,2),e!==null&&(ba(e,2),Tn(e))}function Ge(e,t,i){if(e.tag===3)lp(e,e,i);else for(;t!==null;){if(t.tag===3){lp(t,e,i);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(bi===null||!bi.has(r))){e=en(i,e),i=am(2),r=di(t,i,2),r!==null&&(sm(i,r,t,e),ba(r,2),Tn(r));break}}t=t.return}}function pu(e,t,i){var r=e.pingCache;if(r===null){r=e.pingCache=new Rv;var u=new Set;r.set(t,u)}else u=r.get(t),u===void 0&&(u=new Set,r.set(t,u));u.has(i)||(ru=!0,u.add(i),e=Hv.bind(null,e,t,i),t.then(e,e))}function Hv(e,t,i){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&i,e.warmLanes&=~i,Ve===e&&(De&i)===i&&(at===4||at===3&&(De&62914560)===De&&300>ut()-Sr?(Ke&2)===0&&Fl(e,0):ou|=i,Kl===De&&(Kl=0)),Tn(e)}function ap(e,t){t===0&&(t=ga()),e=Ki(e,t),e!==null&&(ba(e,t),Tn(e))}function Bv(e){var t=e.memoizedState,i=0;t!==null&&(i=t.retryLane),ap(e,i)}function Uv(e,t){var i=0;switch(e.tag){case 31:case 13:var r=e.stateNode,u=e.memoizedState;u!==null&&(i=u.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(s(314))}r!==null&&r.delete(t),ap(e,i)}function Kv(e,t){return yn(e,t)}var kr=null,Yl=null,gu=!1,Lr=!1,bu=!1,xi=0;function Tn(e){e!==Yl&&e.next===null&&(Yl===null?kr=Yl=e:Yl=Yl.next=e),Lr=!0,gu||(gu=!0,Fv())}function Wa(e,t){if(!bu&&Lr){bu=!0;do for(var i=!1,r=kr;r!==null;){if(e!==0){var u=r.pendingLanes;if(u===0)var d=0;else{var b=r.suspendedLanes,C=r.pingedLanes;d=(1<<31-kt(42|e)+1)-1,d&=u&~(b&~C),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(i=!0,cp(r,d))}else d=De,d=ul(r,r===Ve?d:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),(d&3)===0||ni(r,d)||(i=!0,cp(r,d));r=r.next}while(i);bu=!1}}function Iv(){sp()}function sp(){Lr=gu=!1;var e=0;xi!==0&&Qv()&&(e=xi);for(var t=ut(),i=null,r=kr;r!==null;){var u=r.next,d=rp(r,t);d===0?(r.next=null,i===null?kr=u:i.next=u,u===null&&(Yl=i)):(i=r,(e!==0||(d&3)!==0)&&(Lr=!0)),r=u}pt!==0&&pt!==5||Wa(e),xi!==0&&(xi=0)}function rp(e,t){for(var i=e.suspendedLanes,r=e.pingedLanes,u=e.expirationTimes,d=e.pendingLanes&-62914561;0<d;){var b=31-kt(d),C=1<<b,_=u[b];_===-1?((C&i)===0||(C&r)!==0)&&(u[b]=ko(C,t)):_<=t&&(e.expiredLanes|=C),d&=~C}if(t=Ve,i=De,i=ul(e,e===t?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,i===0||e===t&&(Fe===2||Fe===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&vn(r),e.callbackNode=null,e.callbackPriority=0;if((i&3)===0||ni(e,i)){if(t=i&-i,t===e.callbackPriority)return t;switch(r!==null&&vn(r),Ro(i)){case 2:case 8:i=ma;break;case 32:i=Di;break;case 268435456:i=pa;break;default:i=Di}return r=op.bind(null,e),i=yn(i,r),e.callbackPriority=t,e.callbackNode=i,t}return r!==null&&r!==null&&vn(r),e.callbackPriority=2,e.callbackNode=null,2}function op(e,t){if(pt!==0&&pt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var i=e.callbackNode;if(Nr()&&e.callbackNode!==i)return null;var r=De;return r=ul(e,e===Ve?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Gm(e,r,t),rp(e,ut()),e.callbackNode!=null&&e.callbackNode===i?op.bind(null,e):null)}function cp(e,t){if(Nr())return null;Gm(e,t,!0)}function Fv(){ex(function(){(Ke&6)!==0?yn(ha,Iv):sp()})}function yu(){if(xi===0){var e=kl;e===0&&(e=Lt,Lt<<=1,(Lt&261888)===0&&(Lt=256)),xi=e}return xi}function up(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Bs(""+e)}function dp(e,t){var i=t.ownerDocument.createElement("input");return i.name=t.name,i.value=t.value,e.id&&i.setAttribute("form",e.id),t.parentNode.insertBefore(i,t),e=new FormData(e),i.parentNode.removeChild(i),e}function Gv(e,t,i,r,u){if(t==="submit"&&i&&i.stateNode===u){var d=up((u[jt]||null).action),b=r.submitter;b&&(t=(t=b[jt]||null)?up(t.formAction):b.getAttribute("formAction"),t!==null&&(d=t,b=null));var C=new Fs("action","action",null,r,u);e.push({event:C,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(xi!==0){var _=b?dp(u,b):new FormData(u);Bc(i,{pending:!0,data:_,method:u.method,action:d},null,_)}}else typeof d=="function"&&(C.preventDefault(),_=b?dp(u,b):new FormData(u),Bc(i,{pending:!0,data:_,method:u.method,action:d},d,_))},currentTarget:u}]})}}for(var vu=0;vu<tc.length;vu++){var xu=tc[vu],Yv=xu.toLowerCase(),Pv=xu[0].toUpperCase()+xu.slice(1);fn(Yv,"on"+Pv)}fn(Ff,"onAnimationEnd"),fn(Gf,"onAnimationIteration"),fn(Yf,"onAnimationStart"),fn("dblclick","onDoubleClick"),fn("focusin","onFocus"),fn("focusout","onBlur"),fn(rv,"onTransitionRun"),fn(ov,"onTransitionStart"),fn(cv,"onTransitionCancel"),fn(Pf,"onTransitionEnd"),pl("onMouseEnter",["mouseout","mouseover"]),pl("onMouseLeave",["mouseout","mouseover"]),pl("onPointerEnter",["pointerout","pointerover"]),pl("onPointerLeave",["pointerout","pointerover"]),zi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),zi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),zi("onBeforeInput",["compositionend","keypress","textInput","paste"]),zi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),zi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),zi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Qa="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(" "),$v=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Qa));function fp(e,t){t=(t&4)!==0;for(var i=0;i<e.length;i++){var r=e[i],u=r.event;r=r.listeners;e:{var d=void 0;if(t)for(var b=r.length-1;0<=b;b--){var C=r[b],_=C.instance,F=C.currentTarget;if(C=C.listener,_!==d&&u.isPropagationStopped())break e;d=C,u.currentTarget=F;try{d(u)}catch(X){Ps(X)}u.currentTarget=null,d=_}else for(b=0;b<r.length;b++){if(C=r[b],_=C.instance,F=C.currentTarget,C=C.listener,_!==d&&u.isPropagationStopped())break e;d=C,u.currentTarget=F;try{d(u)}catch(X){Ps(X)}u.currentTarget=null,d=_}}}}function Oe(e,t){var i=t[jo];i===void 0&&(i=t[jo]=new Set);var r=e+"__bubble";i.has(r)||(hp(t,e,2,!1),i.add(r))}function wu(e,t,i){var r=0;t&&(r|=4),hp(i,e,r,t)}var _r="_reactListening"+Math.random().toString(36).slice(2);function Su(e){if(!e[_r]){e[_r]=!0,sf.forEach(function(i){i!=="selectionchange"&&($v.has(i)||wu(i,!1,e),wu(i,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[_r]||(t[_r]=!0,wu("selectionchange",!1,t))}}function hp(e,t,i,r){switch(Fp(t)){case 2:var u=xx;break;case 8:u=wx;break;default:u=Hu}i=u.bind(null,t,i,e),u=void 0,!Fo||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(u=!0),r?u!==void 0?e.addEventListener(t,i,{capture:!0,passive:u}):e.addEventListener(t,i,!0):u!==void 0?e.addEventListener(t,i,{passive:u}):e.addEventListener(t,i,!1)}function Cu(e,t,i,r,u){var d=r;if((t&1)===0&&(t&2)===0&&r!==null)e:for(;;){if(r===null)return;var b=r.tag;if(b===3||b===4){var C=r.stateNode.containerInfo;if(C===u)break;if(b===4)for(b=r.return;b!==null;){var _=b.tag;if((_===3||_===4)&&b.stateNode.containerInfo===u)return;b=b.return}for(;C!==null;){if(b=fl(C),b===null)return;if(_=b.tag,_===5||_===6||_===26||_===27){r=d=b;continue e}C=C.parentNode}}r=r.return}yf(function(){var F=d,X=Ko(i),ee=[];e:{var Y=$f.get(e);if(Y!==void 0){var V=Fs,me=e;switch(e){case"keypress":if(Ks(i)===0)break e;case"keydown":case"keyup":V=U0;break;case"focusin":me="focus",V=$o;break;case"focusout":me="blur",V=$o;break;case"beforeblur":case"afterblur":V=$o;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":V=wf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":V=E0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":V=F0;break;case Ff:case Gf:case Yf:V=L0;break;case Pf:V=Y0;break;case"scroll":case"scrollend":V=M0;break;case"wheel":V=$0;break;case"copy":case"cut":case"paste":V=R0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":V=Cf;break;case"toggle":case"beforetoggle":V=q0}var Ce=(t&4)!==0,$e=!Ce&&(e==="scroll"||e==="scrollend"),U=Ce?Y!==null?Y+"Capture":null:Y;Ce=[];for(var O=F,I;O!==null;){var J=O;if(I=J.stateNode,J=J.tag,J!==5&&J!==26&&J!==27||I===null||U===null||(J=xa(O,U),J!=null&&Ce.push(Ja(O,J,I))),$e)break;O=O.return}0<Ce.length&&(Y=new V(Y,me,null,i,X),ee.push({event:Y,listeners:Ce}))}}if((t&7)===0){e:{if(Y=e==="mouseover"||e==="pointerover",V=e==="mouseout"||e==="pointerout",Y&&i!==Uo&&(me=i.relatedTarget||i.fromElement)&&(fl(me)||me[dl]))break e;if((V||Y)&&(Y=X.window===X?X:(Y=X.ownerDocument)?Y.defaultView||Y.parentWindow:window,V?(me=i.relatedTarget||i.toElement,V=F,me=me?fl(me):null,me!==null&&($e=c(me),Ce=me.tag,me!==$e||Ce!==5&&Ce!==27&&Ce!==6)&&(me=null)):(V=null,me=F),V!==me)){if(Ce=wf,J="onMouseLeave",U="onMouseEnter",O="mouse",(e==="pointerout"||e==="pointerover")&&(Ce=Cf,J="onPointerLeave",U="onPointerEnter",O="pointer"),$e=V==null?Y:va(V),I=me==null?Y:va(me),Y=new Ce(J,O+"leave",V,i,X),Y.target=$e,Y.relatedTarget=I,J=null,fl(X)===F&&(Ce=new Ce(U,O+"enter",me,i,X),Ce.target=I,Ce.relatedTarget=$e,J=Ce),$e=J,V&&me)t:{for(Ce=Vv,U=V,O=me,I=0,J=U;J;J=Ce(J))I++;J=0;for(var Se=O;Se;Se=Ce(Se))J++;for(;0<I-J;)U=Ce(U),I--;for(;0<J-I;)O=Ce(O),J--;for(;I--;){if(U===O||O!==null&&U===O.alternate){Ce=U;break t}U=Ce(U),O=Ce(O)}Ce=null}else Ce=null;V!==null&&mp(ee,Y,V,Ce,!1),me!==null&&$e!==null&&mp(ee,$e,me,Ce,!0)}}e:{if(Y=F?va(F):window,V=Y.nodeName&&Y.nodeName.toLowerCase(),V==="select"||V==="input"&&Y.type==="file")var Be=_f;else if(kf(Y))if(Rf)Be=lv;else{Be=nv;var pe=tv}else V=Y.nodeName,!V||V.toLowerCase()!=="input"||Y.type!=="checkbox"&&Y.type!=="radio"?F&&Bo(F.elementType)&&(Be=_f):Be=iv;if(Be&&(Be=Be(e,F))){Lf(ee,Be,i,X);break e}pe&&pe(e,Y,F),e==="focusout"&&F&&Y.type==="number"&&F.memoizedProps.value!=null&&Ho(Y,"number",Y.value)}switch(pe=F?va(F):window,e){case"focusin":(kf(pe)||pe.contentEditable==="true")&&(wl=pe,Qo=F,Na=null);break;case"focusout":Na=Qo=wl=null;break;case"mousedown":Jo=!0;break;case"contextmenu":case"mouseup":case"dragend":Jo=!1,Kf(ee,i,X);break;case"selectionchange":if(sv)break;case"keydown":case"keyup":Kf(ee,i,X)}var _e;if(qo)e:{switch(e){case"compositionstart":var ze="onCompositionStart";break e;case"compositionend":ze="onCompositionEnd";break e;case"compositionupdate":ze="onCompositionUpdate";break e}ze=void 0}else xl?Ef(e,i)&&(ze="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(ze="onCompositionStart");ze&&(Tf&&i.locale!=="ko"&&(xl||ze!=="onCompositionStart"?ze==="onCompositionEnd"&&xl&&(_e=vf()):(li=X,Go="value"in li?li.value:li.textContent,xl=!0)),pe=Rr(F,ze),0<pe.length&&(ze=new Sf(ze,e,null,i,X),ee.push({event:ze,listeners:pe}),_e?ze.data=_e:(_e=Nf(i),_e!==null&&(ze.data=_e)))),(_e=Z0?W0(e,i):Q0(e,i))&&(ze=Rr(F,"onBeforeInput"),0<ze.length&&(pe=new Sf("onBeforeInput","beforeinput",null,i,X),ee.push({event:pe,listeners:ze}),pe.data=_e)),Gv(ee,e,F,i,X)}fp(ee,t)})}function Ja(e,t,i){return{instance:e,listener:t,currentTarget:i}}function Rr(e,t){for(var i=t+"Capture",r=[];e!==null;){var u=e,d=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||d===null||(u=xa(e,i),u!=null&&r.unshift(Ja(e,u,d)),u=xa(e,t),u!=null&&r.push(Ja(e,u,d))),e.tag===3)return r;e=e.return}return[]}function Vv(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function mp(e,t,i,r,u){for(var d=t._reactName,b=[];i!==null&&i!==r;){var C=i,_=C.alternate,F=C.stateNode;if(C=C.tag,_!==null&&_===r)break;C!==5&&C!==26&&C!==27||F===null||(_=F,u?(F=xa(i,d),F!=null&&b.unshift(Ja(i,F,_))):u||(F=xa(i,d),F!=null&&b.push(Ja(i,F,_)))),i=i.return}b.length!==0&&e.push({event:t,listeners:b})}var qv=/\r\n?/g,Xv=/\u0000|\uFFFD/g;function pp(e){return(typeof e=="string"?e:""+e).replace(qv,`
33
+ `).replace(Xv,"")}function gp(e,t){return t=pp(t),pp(e)===t}function Pe(e,t,i,r,u,d){switch(i){case"children":typeof r=="string"?t==="body"||t==="textarea"&&r===""||bl(e,r):(typeof r=="number"||typeof r=="bigint")&&t!=="body"&&bl(e,""+r);break;case"className":zs(e,"class",r);break;case"tabIndex":zs(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":zs(e,i,r);break;case"style":gf(e,r,d);break;case"data":if(t!=="object"){zs(e,"data",r);break}case"src":case"href":if(r===""&&(t!=="a"||i!=="href")){e.removeAttribute(i);break}if(r==null||typeof r=="function"||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(i);break}r=Bs(""+r),e.setAttribute(i,r);break;case"action":case"formAction":if(typeof r=="function"){e.setAttribute(i,"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 d=="function"&&(i==="formAction"?(t!=="input"&&Pe(e,t,"name",u.name,u,null),Pe(e,t,"formEncType",u.formEncType,u,null),Pe(e,t,"formMethod",u.formMethod,u,null),Pe(e,t,"formTarget",u.formTarget,u,null)):(Pe(e,t,"encType",u.encType,u,null),Pe(e,t,"method",u.method,u,null),Pe(e,t,"target",u.target,u,null)));if(r==null||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(i);break}r=Bs(""+r),e.setAttribute(i,r);break;case"onClick":r!=null&&(e.onclick=Rn);break;case"onScroll":r!=null&&Oe("scroll",e);break;case"onScrollEnd":r!=null&&Oe("scrollend",e);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(s(61));if(i=r.__html,i!=null){if(u.children!=null)throw Error(s(60));e.innerHTML=i}}break;case"multiple":e.multiple=r&&typeof r!="function"&&typeof r!="symbol";break;case"muted":e.muted=r&&typeof r!="function"&&typeof r!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(r==null||typeof r=="function"||typeof r=="boolean"||typeof r=="symbol"){e.removeAttribute("xlink:href");break}i=Bs(""+r),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(i,""+r):e.removeAttribute(i);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":r&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(i,""):e.removeAttribute(i);break;case"capture":case"download":r===!0?e.setAttribute(i,""):r!==!1&&r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(i,r):e.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":r!=null&&typeof r!="function"&&typeof r!="symbol"&&!isNaN(r)&&1<=r?e.setAttribute(i,r):e.removeAttribute(i);break;case"rowSpan":case"start":r==null||typeof r=="function"||typeof r=="symbol"||isNaN(r)?e.removeAttribute(i):e.setAttribute(i,r);break;case"popover":Oe("beforetoggle",e),Oe("toggle",e),Ds(e,"popover",r);break;case"xlinkActuate":_n(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":_n(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":_n(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":_n(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":_n(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":_n(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":_n(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":_n(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":_n(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":Ds(e,"is",r);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=C0.get(i)||i,Ds(e,i,r))}}function Tu(e,t,i,r,u,d){switch(i){case"style":gf(e,r,d);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(s(61));if(i=r.__html,i!=null){if(u.children!=null)throw Error(s(60));e.innerHTML=i}}break;case"children":typeof r=="string"?bl(e,r):(typeof r=="number"||typeof r=="bigint")&&bl(e,""+r);break;case"onScroll":r!=null&&Oe("scroll",e);break;case"onScrollEnd":r!=null&&Oe("scrollend",e);break;case"onClick":r!=null&&(e.onclick=Rn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!rf.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(u=i.endsWith("Capture"),t=i.slice(2,u?i.length-7:void 0),d=e[jt]||null,d=d!=null?d[i]:null,typeof d=="function"&&e.removeEventListener(t,d,u),typeof r=="function")){typeof d!="function"&&d!==null&&(i in e?e[i]=null:e.hasAttribute(i)&&e.removeAttribute(i)),e.addEventListener(t,r,u);break e}i in e?e[i]=r:r===!0?e.setAttribute(i,""):Ds(e,i,r)}}}function Mt(e,t,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Oe("error",e),Oe("load",e);var r=!1,u=!1,d;for(d in i)if(i.hasOwnProperty(d)){var b=i[d];if(b!=null)switch(d){case"src":r=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,t));default:Pe(e,t,d,b,i,null)}}u&&Pe(e,t,"srcSet",i.srcSet,i,null),r&&Pe(e,t,"src",i.src,i,null);return;case"input":Oe("invalid",e);var C=d=b=u=null,_=null,F=null;for(r in i)if(i.hasOwnProperty(r)){var X=i[r];if(X!=null)switch(r){case"name":u=X;break;case"type":b=X;break;case"checked":_=X;break;case"defaultChecked":F=X;break;case"value":d=X;break;case"defaultValue":C=X;break;case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(s(137,t));break;default:Pe(e,t,r,X,i,null)}}ff(e,d,C,_,F,b,u,!1);return;case"select":Oe("invalid",e),r=b=d=null;for(u in i)if(i.hasOwnProperty(u)&&(C=i[u],C!=null))switch(u){case"value":d=C;break;case"defaultValue":b=C;break;case"multiple":r=C;default:Pe(e,t,u,C,i,null)}t=d,i=b,e.multiple=!!r,t!=null?gl(e,!!r,t,!1):i!=null&&gl(e,!!r,i,!0);return;case"textarea":Oe("invalid",e),d=u=r=null;for(b in i)if(i.hasOwnProperty(b)&&(C=i[b],C!=null))switch(b){case"value":r=C;break;case"defaultValue":u=C;break;case"children":d=C;break;case"dangerouslySetInnerHTML":if(C!=null)throw Error(s(91));break;default:Pe(e,t,b,C,i,null)}mf(e,r,u,d);return;case"option":for(_ in i)if(i.hasOwnProperty(_)&&(r=i[_],r!=null))switch(_){case"selected":e.selected=r&&typeof r!="function"&&typeof r!="symbol";break;default:Pe(e,t,_,r,i,null)}return;case"dialog":Oe("beforetoggle",e),Oe("toggle",e),Oe("cancel",e),Oe("close",e);break;case"iframe":case"object":Oe("load",e);break;case"video":case"audio":for(r=0;r<Qa.length;r++)Oe(Qa[r],e);break;case"image":Oe("error",e),Oe("load",e);break;case"details":Oe("toggle",e);break;case"embed":case"source":case"link":Oe("error",e),Oe("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(F in i)if(i.hasOwnProperty(F)&&(r=i[F],r!=null))switch(F){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,t));default:Pe(e,t,F,r,i,null)}return;default:if(Bo(t)){for(X in i)i.hasOwnProperty(X)&&(r=i[X],r!==void 0&&Tu(e,t,X,r,i,void 0));return}}for(C in i)i.hasOwnProperty(C)&&(r=i[C],r!=null&&Pe(e,t,C,r,i,null))}function Zv(e,t,i,r){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,d=null,b=null,C=null,_=null,F=null,X=null;for(V in i){var ee=i[V];if(i.hasOwnProperty(V)&&ee!=null)switch(V){case"checked":break;case"value":break;case"defaultValue":_=ee;default:r.hasOwnProperty(V)||Pe(e,t,V,null,r,ee)}}for(var Y in r){var V=r[Y];if(ee=i[Y],r.hasOwnProperty(Y)&&(V!=null||ee!=null))switch(Y){case"type":d=V;break;case"name":u=V;break;case"checked":F=V;break;case"defaultChecked":X=V;break;case"value":b=V;break;case"defaultValue":C=V;break;case"children":case"dangerouslySetInnerHTML":if(V!=null)throw Error(s(137,t));break;default:V!==ee&&Pe(e,t,Y,V,r,ee)}}zo(e,b,C,_,F,X,d,u);return;case"select":V=b=C=Y=null;for(d in i)if(_=i[d],i.hasOwnProperty(d)&&_!=null)switch(d){case"value":break;case"multiple":V=_;default:r.hasOwnProperty(d)||Pe(e,t,d,null,r,_)}for(u in r)if(d=r[u],_=i[u],r.hasOwnProperty(u)&&(d!=null||_!=null))switch(u){case"value":Y=d;break;case"defaultValue":C=d;break;case"multiple":b=d;default:d!==_&&Pe(e,t,u,d,r,_)}t=C,i=b,r=V,Y!=null?gl(e,!!i,Y,!1):!!r!=!!i&&(t!=null?gl(e,!!i,t,!0):gl(e,!!i,i?[]:"",!1));return;case"textarea":V=Y=null;for(C in i)if(u=i[C],i.hasOwnProperty(C)&&u!=null&&!r.hasOwnProperty(C))switch(C){case"value":break;case"children":break;default:Pe(e,t,C,null,r,u)}for(b in r)if(u=r[b],d=i[b],r.hasOwnProperty(b)&&(u!=null||d!=null))switch(b){case"value":Y=u;break;case"defaultValue":V=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(s(91));break;default:u!==d&&Pe(e,t,b,u,r,d)}hf(e,Y,V);return;case"option":for(var me in i)if(Y=i[me],i.hasOwnProperty(me)&&Y!=null&&!r.hasOwnProperty(me))switch(me){case"selected":e.selected=!1;break;default:Pe(e,t,me,null,r,Y)}for(_ in r)if(Y=r[_],V=i[_],r.hasOwnProperty(_)&&Y!==V&&(Y!=null||V!=null))switch(_){case"selected":e.selected=Y&&typeof Y!="function"&&typeof Y!="symbol";break;default:Pe(e,t,_,Y,r,V)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ce in i)Y=i[Ce],i.hasOwnProperty(Ce)&&Y!=null&&!r.hasOwnProperty(Ce)&&Pe(e,t,Ce,null,r,Y);for(F in r)if(Y=r[F],V=i[F],r.hasOwnProperty(F)&&Y!==V&&(Y!=null||V!=null))switch(F){case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(s(137,t));break;default:Pe(e,t,F,Y,r,V)}return;default:if(Bo(t)){for(var $e in i)Y=i[$e],i.hasOwnProperty($e)&&Y!==void 0&&!r.hasOwnProperty($e)&&Tu(e,t,$e,void 0,r,Y);for(X in r)Y=r[X],V=i[X],!r.hasOwnProperty(X)||Y===V||Y===void 0&&V===void 0||Tu(e,t,X,Y,r,V);return}}for(var U in i)Y=i[U],i.hasOwnProperty(U)&&Y!=null&&!r.hasOwnProperty(U)&&Pe(e,t,U,null,r,Y);for(ee in r)Y=r[ee],V=i[ee],!r.hasOwnProperty(ee)||Y===V||Y==null&&V==null||Pe(e,t,ee,Y,r,V)}function bp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Wv(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,i=performance.getEntriesByType("resource"),r=0;r<i.length;r++){var u=i[r],d=u.transferSize,b=u.initiatorType,C=u.duration;if(d&&C&&bp(b)){for(b=0,C=u.responseEnd,r+=1;r<i.length;r++){var _=i[r],F=_.startTime;if(F>C)break;var X=_.transferSize,ee=_.initiatorType;X&&bp(ee)&&(_=_.responseEnd,b+=X*(_<C?1:(C-F)/(_-F)))}if(--r,t+=8*(d+b)/(u.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 Mu=null,Au=null;function jr(e){return e.nodeType===9?e:e.ownerDocument}function yp(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 vp(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 Eu(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 Nu=null;function Qv(){var e=window.event;return e&&e.type==="popstate"?e===Nu?!1:(Nu=e,!0):(Nu=null,!1)}var xp=typeof setTimeout=="function"?setTimeout:void 0,Jv=typeof clearTimeout=="function"?clearTimeout:void 0,wp=typeof Promise=="function"?Promise:void 0,ex=typeof queueMicrotask=="function"?queueMicrotask:typeof wp<"u"?function(e){return wp.resolve(null).then(e).catch(tx)}:xp;function tx(e){setTimeout(function(){throw e})}function wi(e){return e==="head"}function Sp(e,t){var i=t,r=0;do{var u=i.nextSibling;if(e.removeChild(i),u&&u.nodeType===8)if(i=u.data,i==="/$"||i==="/&"){if(r===0){e.removeChild(u),ql(t);return}r--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")r++;else if(i==="html")es(e.ownerDocument.documentElement);else if(i==="head"){i=e.ownerDocument.head,es(i);for(var d=i.firstChild;d;){var b=d.nextSibling,C=d.nodeName;d[ya]||C==="SCRIPT"||C==="STYLE"||C==="LINK"&&d.rel.toLowerCase()==="stylesheet"||i.removeChild(d),d=b}}else i==="body"&&es(e.ownerDocument.body);i=u}while(i);ql(t)}function Cp(e,t){var i=e;e=0;do{var r=i.nextSibling;if(i.nodeType===1?t?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(t?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),r&&r.nodeType===8)if(i=r.data,i==="/$"){if(e===0)break;e--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||e++;i=r}while(i)}function ku(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var i=t;switch(t=t.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":ku(i),Oo(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}e.removeChild(i)}}function nx(e,t,i,r){for(;e.nodeType===1;){var u=i;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(r){if(!e[ya])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(d=e.getAttribute("rel"),d==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(d!==u.rel||e.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||e.getAttribute("title")!==(u.title==null?null:u.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(d=e.getAttribute("src"),(d!==(u.src==null?null:u.src)||e.getAttribute("type")!==(u.type==null?null:u.type)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&d&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var d=u.name==null?null:""+u.name;if(u.type==="hidden"&&e.getAttribute("name")===d)return e}else return e;if(e=sn(e.nextSibling),e===null)break}return null}function ix(e,t,i){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!i||(e=sn(e.nextSibling),e===null))return null;return e}function Tp(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=sn(e.nextSibling),e===null))return null;return e}function Lu(e){return e.data==="$?"||e.data==="$~"}function _u(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function lx(e,t){var i=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||i.readyState!=="loading")t();else{var r=function(){t(),i.removeEventListener("DOMContentLoaded",r)};i.addEventListener("DOMContentLoaded",r),e._reactRetry=r}}function sn(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 Ru=null;function Mp(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"||i==="/&"){if(t===0)return sn(e.nextSibling);t--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||t++}e=e.nextSibling}return null}function Ap(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(t===0)return e;t--}else i!=="/$"&&i!=="/&"||t++}e=e.previousSibling}return null}function Ep(e,t,i){switch(t=jr(i),e){case"html":if(e=t.documentElement,!e)throw Error(s(452));return e;case"head":if(e=t.head,!e)throw Error(s(453));return e;case"body":if(e=t.body,!e)throw Error(s(454));return e;default:throw Error(s(451))}}function es(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Oo(e)}var rn=new Map,Np=new Set;function Or(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var qn=G.d;G.d={f:ax,r:sx,D:rx,C:ox,L:cx,m:ux,X:fx,S:dx,M:hx};function ax(){var e=qn.f(),t=Mr();return e||t}function sx(e){var t=hl(e);t!==null&&t.tag===5&&t.type==="form"?Ph(t):qn.r(e)}var Pl=typeof document>"u"?null:document;function kp(e,t,i){var r=Pl;if(r&&typeof t=="string"&&t){var u=Qt(t);u='link[rel="'+e+'"][href="'+u+'"]',typeof i=="string"&&(u+='[crossorigin="'+i+'"]'),Np.has(u)||(Np.add(u),e={rel:e,crossOrigin:i,href:t},r.querySelector(u)===null&&(t=r.createElement("link"),Mt(t,"link",e),yt(t),r.head.appendChild(t)))}}function rx(e){qn.D(e),kp("dns-prefetch",e,null)}function ox(e,t){qn.C(e,t),kp("preconnect",e,t)}function cx(e,t,i){qn.L(e,t,i);var r=Pl;if(r&&e&&t){var u='link[rel="preload"][as="'+Qt(t)+'"]';t==="image"&&i&&i.imageSrcSet?(u+='[imagesrcset="'+Qt(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(u+='[imagesizes="'+Qt(i.imageSizes)+'"]')):u+='[href="'+Qt(e)+'"]';var d=u;switch(t){case"style":d=$l(e);break;case"script":d=Vl(e)}rn.has(d)||(e=v({rel:"preload",href:t==="image"&&i&&i.imageSrcSet?void 0:e,as:t},i),rn.set(d,e),r.querySelector(u)!==null||t==="style"&&r.querySelector(ts(d))||t==="script"&&r.querySelector(ns(d))||(t=r.createElement("link"),Mt(t,"link",e),yt(t),r.head.appendChild(t)))}}function ux(e,t){qn.m(e,t);var i=Pl;if(i&&e){var r=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+Qt(r)+'"][href="'+Qt(e)+'"]',d=u;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":d=Vl(e)}if(!rn.has(d)&&(e=v({rel:"modulepreload",href:e},t),rn.set(d,e),i.querySelector(u)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(ns(d)))return}r=i.createElement("link"),Mt(r,"link",e),yt(r),i.head.appendChild(r)}}}function dx(e,t,i){qn.S(e,t,i);var r=Pl;if(r&&e){var u=ml(r).hoistableStyles,d=$l(e);t=t||"default";var b=u.get(d);if(!b){var C={loading:0,preload:null};if(b=r.querySelector(ts(d)))C.loading=5;else{e=v({rel:"stylesheet",href:e,"data-precedence":t},i),(i=rn.get(d))&&ju(e,i);var _=b=r.createElement("link");yt(_),Mt(_,"link",e),_._p=new Promise(function(F,X){_.onload=F,_.onerror=X}),_.addEventListener("load",function(){C.loading|=1}),_.addEventListener("error",function(){C.loading|=2}),C.loading|=4,Dr(b,t,r)}b={type:"stylesheet",instance:b,count:1,state:C},u.set(d,b)}}}function fx(e,t){qn.X(e,t);var i=Pl;if(i&&e){var r=ml(i).hoistableScripts,u=Vl(e),d=r.get(u);d||(d=i.querySelector(ns(u)),d||(e=v({src:e,async:!0},t),(t=rn.get(u))&&Ou(e,t),d=i.createElement("script"),yt(d),Mt(d,"link",e),i.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},r.set(u,d))}}function hx(e,t){qn.M(e,t);var i=Pl;if(i&&e){var r=ml(i).hoistableScripts,u=Vl(e),d=r.get(u);d||(d=i.querySelector(ns(u)),d||(e=v({src:e,async:!0,type:"module"},t),(t=rn.get(u))&&Ou(e,t),d=i.createElement("script"),yt(d),Mt(d,"link",e),i.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},r.set(u,d))}}function Lp(e,t,i,r){var u=(u=be.current)?Or(u):null;if(!u)throw Error(s(446));switch(e){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(t=$l(i.href),i=ml(u).hoistableStyles,r=i.get(t),r||(r={type:"style",instance:null,count:0,state:null},i.set(t,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){e=$l(i.href);var d=ml(u).hoistableStyles,b=d.get(e);if(b||(u=u.ownerDocument||u,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},d.set(e,b),(d=u.querySelector(ts(e)))&&!d._p&&(b.instance=d,b.state.loading=5),rn.has(e)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},rn.set(e,i),d||mx(u,e,i,b.state))),t&&r===null)throw Error(s(528,""));return b}if(t&&r!==null)throw Error(s(529,""));return null;case"script":return t=i.async,i=i.src,typeof i=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Vl(i),i=ml(u).hoistableScripts,r=i.get(t),r||(r={type:"script",instance:null,count:0,state:null},i.set(t,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,e))}}function $l(e){return'href="'+Qt(e)+'"'}function ts(e){return'link[rel="stylesheet"]['+e+"]"}function _p(e){return v({},e,{"data-precedence":e.precedence,precedence:null})}function mx(e,t,i,r){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?r.loading=1:(t=e.createElement("link"),r.preload=t,t.addEventListener("load",function(){return r.loading|=1}),t.addEventListener("error",function(){return r.loading|=2}),Mt(t,"link",i),yt(t),e.head.appendChild(t))}function Vl(e){return'[src="'+Qt(e)+'"]'}function ns(e){return"script[async]"+e}function Rp(e,t,i){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+Qt(i.href)+'"]');if(r)return t.instance=r,yt(r),r;var u=v({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),yt(r),Mt(r,"style",u),Dr(r,i.precedence,e),t.instance=r;case"stylesheet":u=$l(i.href);var d=e.querySelector(ts(u));if(d)return t.state.loading|=4,t.instance=d,yt(d),d;r=_p(i),(u=rn.get(u))&&ju(r,u),d=(e.ownerDocument||e).createElement("link"),yt(d);var b=d;return b._p=new Promise(function(C,_){b.onload=C,b.onerror=_}),Mt(d,"link",r),t.state.loading|=4,Dr(d,i.precedence,e),t.instance=d;case"script":return d=Vl(i.src),(u=e.querySelector(ns(d)))?(t.instance=u,yt(u),u):(r=i,(u=rn.get(d))&&(r=v({},i),Ou(r,u)),e=e.ownerDocument||e,u=e.createElement("script"),yt(u),Mt(u,"link",r),e.head.appendChild(u),t.instance=u);case"void":return null;default:throw Error(s(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(r=t.instance,t.state.loading|=4,Dr(r,i.precedence,e));return t.instance}function Dr(e,t,i){for(var r=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=r.length?r[r.length-1]:null,d=u,b=0;b<r.length;b++){var C=r[b];if(C.dataset.precedence===t)d=C;else if(d!==u)break}d?d.parentNode.insertBefore(e,d.nextSibling):(t=i.nodeType===9?i.head:i,t.insertBefore(e,t.firstChild))}function ju(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Ou(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var zr=null;function jp(e,t,i){if(zr===null){var r=new Map,u=zr=new Map;u.set(i,r)}else u=zr,r=u.get(i),r||(r=new Map,u.set(i,r));if(r.has(e))return r;for(r.set(e,null),i=i.getElementsByTagName(e),u=0;u<i.length;u++){var d=i[u];if(!(d[ya]||d[wt]||e==="link"&&d.getAttribute("rel")==="stylesheet")&&d.namespaceURI!=="http://www.w3.org/2000/svg"){var b=d.getAttribute(t)||"";b=e+b;var C=r.get(b);C?C.push(d):r.set(b,[d])}}return r}function Op(e,t,i){e=e.ownerDocument||e,e.head.insertBefore(i,t==="title"?e.querySelector("head > title"):null)}function px(e,t,i){if(i===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 Dp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function gx(e,t,i,r){if(i.type==="stylesheet"&&(typeof r.media!="string"||matchMedia(r.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var u=$l(r.href),d=t.querySelector(ts(u));if(d){t=d._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Hr.bind(e),t.then(e,e)),i.state.loading|=4,i.instance=d,yt(d);return}d=t.ownerDocument||t,r=_p(r),(u=rn.get(u))&&ju(r,u),d=d.createElement("link"),yt(d);var b=d;b._p=new Promise(function(C,_){b.onload=C,b.onerror=_}),Mt(d,"link",r),i.instance=d}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(i,t),(t=i.state.preload)&&(i.state.loading&3)===0&&(e.count++,i=Hr.bind(e),t.addEventListener("load",i),t.addEventListener("error",i))}}var Du=0;function bx(e,t){return e.stylesheets&&e.count===0&&Ur(e,e.stylesheets),0<e.count||0<e.imgCount?function(i){var r=setTimeout(function(){if(e.stylesheets&&Ur(e,e.stylesheets),e.unsuspend){var d=e.unsuspend;e.unsuspend=null,d()}},6e4+t);0<e.imgBytes&&Du===0&&(Du=62500*Wv());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Ur(e,e.stylesheets),e.unsuspend)){var d=e.unsuspend;e.unsuspend=null,d()}},(e.imgBytes>Du?50:800)+t);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(u)}}:null}function Hr(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ur(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Br=null;function Ur(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Br=new Map,t.forEach(yx,e),Br=null,Hr.call(e))}function yx(e,t){if(!(t.state.loading&4)){var i=Br.get(e);if(i)var r=i.get(null);else{i=new Map,Br.set(e,i);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;d<u.length;d++){var b=u[d];(b.nodeName==="LINK"||b.getAttribute("media")!=="not all")&&(i.set(b.dataset.precedence,b),r=b)}r&&i.set(null,r)}u=t.instance,b=u.getAttribute("data-precedence"),d=i.get(b)||r,d===r&&i.set(null,u),i.set(b,u),this.count++,r=Hr.bind(this),u.addEventListener("load",r),u.addEventListener("error",r),d?d.parentNode.insertBefore(u,d.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(u,e.firstChild)),t.state.loading|=4}}var is={$$typeof:k,Provider:null,Consumer:null,_currentValue:W,_currentValue2:W,_threadCount:0};function vx(e,t,i,r,u,d,b,C,_){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Lo(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Lo(0),this.hiddenUpdates=Lo(null),this.identifierPrefix=r,this.onUncaughtError=u,this.onCaughtError=d,this.onRecoverableError=b,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=_,this.incompleteTransitions=new Map}function zp(e,t,i,r,u,d,b,C,_,F,X,ee){return e=new vx(e,t,i,b,_,F,X,ee,C),t=1,d===!0&&(t|=24),d=Gt(3,null,null,t),e.current=d,d.stateNode=e,t=mc(),t.refCount++,e.pooledCache=t,t.refCount++,d.memoizedState={element:r,isDehydrated:i,cache:t},yc(d),e}function Hp(e){return e?(e=Tl,e):Tl}function Bp(e,t,i,r,u,d){u=Hp(u),r.context===null?r.context=u:r.pendingContext=u,r=ui(t),r.payload={element:i},d=d===void 0?null:d,d!==null&&(r.callback=d),i=di(e,r,t),i!==null&&(Ut(i,e,t),Da(i,e,t))}function Up(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<t?i:t}}function zu(e,t){Up(e,t),(e=e.alternate)&&Up(e,t)}function Kp(e){if(e.tag===13||e.tag===31){var t=Ki(e,67108864);t!==null&&Ut(t,e,67108864),zu(e,67108864)}}function Ip(e){if(e.tag===13||e.tag===31){var t=qt();t=_o(t);var i=Ki(e,t);i!==null&&Ut(i,e,t),zu(e,t)}}var Kr=!0;function xx(e,t,i,r){var u=A.T;A.T=null;var d=G.p;try{G.p=2,Hu(e,t,i,r)}finally{G.p=d,A.T=u}}function wx(e,t,i,r){var u=A.T;A.T=null;var d=G.p;try{G.p=8,Hu(e,t,i,r)}finally{G.p=d,A.T=u}}function Hu(e,t,i,r){if(Kr){var u=Bu(r);if(u===null)Cu(e,t,r,Ir,i),Gp(e,r);else if(Cx(u,e,t,i,r))r.stopPropagation();else if(Gp(e,r),t&4&&-1<Sx.indexOf(e)){for(;u!==null;){var d=hl(u);if(d!==null)switch(d.tag){case 3:if(d=d.stateNode,d.current.memoizedState.isDehydrated){var b=Ln(d.pendingLanes);if(b!==0){var C=d;for(C.pendingLanes|=2,C.entangledLanes|=2;b;){var _=1<<31-kt(b);C.entanglements[1]|=_,b&=~_}Tn(d),(Ke&6)===0&&(Cr=ut()+500,Wa(0))}}break;case 31:case 13:C=Ki(d,2),C!==null&&Ut(C,d,2),Mr(),zu(d,2)}if(d=Bu(r),d===null&&Cu(e,t,r,Ir,i),d===u)break;u=d}u!==null&&r.stopPropagation()}else Cu(e,t,r,null,i)}}function Bu(e){return e=Ko(e),Uu(e)}var Ir=null;function Uu(e){if(Ir=null,e=fl(e),e!==null){var t=c(e);if(t===null)e=null;else{var i=t.tag;if(i===13){if(e=h(t),e!==null)return e;e=null}else if(i===31){if(e=m(t),e!==null)return e;e=null}else if(i===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Ir=e,null}function Fp(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(Ls()){case ha:return 2;case ma:return 8;case Di:case _s:return 32;case pa:return 268435456;default:return 32}default:return 32}}var Ku=!1,Si=null,Ci=null,Ti=null,ls=new Map,as=new Map,Mi=[],Sx="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 Gp(e,t){switch(e){case"focusin":case"focusout":Si=null;break;case"dragenter":case"dragleave":Ci=null;break;case"mouseover":case"mouseout":Ti=null;break;case"pointerover":case"pointerout":ls.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":as.delete(t.pointerId)}}function ss(e,t,i,r,u,d){return e===null||e.nativeEvent!==d?(e={blockedOn:t,domEventName:i,eventSystemFlags:r,nativeEvent:d,targetContainers:[u]},t!==null&&(t=hl(t),t!==null&&Kp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,u!==null&&t.indexOf(u)===-1&&t.push(u),e)}function Cx(e,t,i,r,u){switch(t){case"focusin":return Si=ss(Si,e,t,i,r,u),!0;case"dragenter":return Ci=ss(Ci,e,t,i,r,u),!0;case"mouseover":return Ti=ss(Ti,e,t,i,r,u),!0;case"pointerover":var d=u.pointerId;return ls.set(d,ss(ls.get(d)||null,e,t,i,r,u)),!0;case"gotpointercapture":return d=u.pointerId,as.set(d,ss(as.get(d)||null,e,t,i,r,u)),!0}return!1}function Yp(e){var t=fl(e.target);if(t!==null){var i=c(t);if(i!==null){if(t=i.tag,t===13){if(t=h(i),t!==null){e.blockedOn=t,lf(e.priority,function(){Ip(i)});return}}else if(t===31){if(t=m(i),t!==null){e.blockedOn=t,lf(e.priority,function(){Ip(i)});return}}else if(t===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Fr(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var i=Bu(e.nativeEvent);if(i===null){i=e.nativeEvent;var r=new i.constructor(i.type,i);Uo=r,i.target.dispatchEvent(r),Uo=null}else return t=hl(i),t!==null&&Kp(t),e.blockedOn=i,!1;t.shift()}return!0}function Pp(e,t,i){Fr(e)&&i.delete(t)}function Tx(){Ku=!1,Si!==null&&Fr(Si)&&(Si=null),Ci!==null&&Fr(Ci)&&(Ci=null),Ti!==null&&Fr(Ti)&&(Ti=null),ls.forEach(Pp),as.forEach(Pp)}function Gr(e,t){e.blockedOn===t&&(e.blockedOn=null,Ku||(Ku=!0,l.unstable_scheduleCallback(l.unstable_NormalPriority,Tx)))}var Yr=null;function $p(e){Yr!==e&&(Yr=e,l.unstable_scheduleCallback(l.unstable_NormalPriority,function(){Yr===e&&(Yr=null);for(var t=0;t<e.length;t+=3){var i=e[t],r=e[t+1],u=e[t+2];if(typeof r!="function"){if(Uu(r||i)===null)continue;break}var d=hl(i);d!==null&&(e.splice(t,3),t-=3,Bc(d,{pending:!0,data:u,method:i.method,action:r},r,u))}}))}function ql(e){function t(_){return Gr(_,e)}Si!==null&&Gr(Si,e),Ci!==null&&Gr(Ci,e),Ti!==null&&Gr(Ti,e),ls.forEach(t),as.forEach(t);for(var i=0;i<Mi.length;i++){var r=Mi[i];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Mi.length&&(i=Mi[0],i.blockedOn===null);)Yp(i),i.blockedOn===null&&Mi.shift();if(i=(e.ownerDocument||e).$$reactFormReplay,i!=null)for(r=0;r<i.length;r+=3){var u=i[r],d=i[r+1],b=u[jt]||null;if(typeof d=="function")b||$p(i);else if(b){var C=null;if(d&&d.hasAttribute("formAction")){if(u=d,b=d[jt]||null)C=b.formAction;else if(Uu(u)!==null)continue}else C=b.action;typeof C=="function"?i[r+1]=C:(i.splice(r,3),r-=3),$p(i)}}}function Vp(){function e(d){d.canIntercept&&d.info==="react-transition"&&d.intercept({handler:function(){return new Promise(function(b){return u=b})},focusReset:"manual",scroll:"manual"})}function t(){u!==null&&(u(),u=null),r||setTimeout(i,20)}function i(){if(!r&&!navigation.transition){var d=navigation.currentEntry;d&&d.url!=null&&navigation.navigate(d.url,{state:d.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var r=!1,u=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(i,100),function(){r=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),u!==null&&(u(),u=null)}}}function Iu(e){this._internalRoot=e}Pr.prototype.render=Iu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(s(409));var i=t.current,r=qt();Bp(i,r,e,t,null,null)},Pr.prototype.unmount=Iu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Bp(e.current,2,null,e,null,null),Mr(),t[dl]=null}};function Pr(e){this._internalRoot=e}Pr.prototype.unstable_scheduleHydration=function(e){if(e){var t=nf();e={blockedOn:null,target:e,priority:t};for(var i=0;i<Mi.length&&t!==0&&t<Mi[i].priority;i++);Mi.splice(i,0,e),i===0&&Yp(e)}};var qp=n.version;if(qp!=="19.2.8")throw Error(s(527,qp,"19.2.8"));G.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(s(188)):(e=Object.keys(e).join(","),Error(s(268,e)));return e=g(t),e=e!==null?y(e):null,e=e===null?null:e.stateNode,e};var Mx={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:A,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var $r=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!$r.isDisabled&&$r.supportsFiber)try{ti=$r.inject(Mx),At=$r}catch{}}return os.createRoot=function(e,t){if(!o(e))throw Error(s(299));var i=!1,r="",u=tm,d=nm,b=im;return t!=null&&(t.unstable_strictMode===!0&&(i=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(u=t.onUncaughtError),t.onCaughtError!==void 0&&(d=t.onCaughtError),t.onRecoverableError!==void 0&&(b=t.onRecoverableError)),t=zp(e,1,!1,null,null,i,r,null,u,d,b,Vp),e[dl]=t.current,Su(e),new Iu(t)},os.hydrateRoot=function(e,t,i){if(!o(e))throw Error(s(299));var r=!1,u="",d=tm,b=nm,C=im,_=null;return i!=null&&(i.unstable_strictMode===!0&&(r=!0),i.identifierPrefix!==void 0&&(u=i.identifierPrefix),i.onUncaughtError!==void 0&&(d=i.onUncaughtError),i.onCaughtError!==void 0&&(b=i.onCaughtError),i.onRecoverableError!==void 0&&(C=i.onRecoverableError),i.formState!==void 0&&(_=i.formState)),t=zp(e,1,!0,t,i??null,r,u,_,d,b,C,Vp),t.context=Hp(null),i=t.current,r=qt(),r=_o(r),u=ui(r),u.callback=null,di(i,u,r),i=r,t.current.lanes=i,ba(t,i),Tn(t),e[dl]=t.current,Su(e),new Pr(t)},os.version="19.2.8",os}var eg;function zx(){if(eg)return Gu.exports;eg=1;function l(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l)}catch(n){console.error(n)}}return l(),Gu.exports=Dx(),Gu.exports}var Hx=zx();const Bx=vb(Hx),Rt="/ws/client",wb={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",controlActive:"Full Control",viewerWithController:"Viewer (Active: {controllerId})",sharedControl:"Full control",sharedWindows:"{count} windows",modeLabel:"Input mode",controlHint:"Keys, paste and clicks go to the terminal",observerHint:"Watch only: input is held back, scrolling still works",thisWindow:"Window",claimControl:"Claim Control",claimControlTitle:"Claim terminal control",releaseControl:"Release",releaseControlTitle:"Switch to viewer mode",takeoverControl:"Takeover",takeoverControlTitle:"Take over control from {controllerId}",takeoverModalTitle:"Confirm Control Takeover",takeoverModalDesc:"Another client is controlling this terminal.",takeoverModalWarning:"Input focus will transfer to this window.",confirmTakeover:"Confirm Takeover"},statusBanner:{connecting:"Connecting to relay...",reconnectingDefault:"Connection lost. Reconnecting...",reconnectNow:"Reconnect Now",errorDefault:"Unable to connect to relay",disconnected:"Terminal disconnected"},update:{chip:"↑ herdr-remote {version}",chipCompact:"↑ {version}",chipRestart:"↻ restart for {version}",toast:"herdr-remote {version} is out for this workstation",toastRestart:"herdr-remote {version} is installed; restart it to apply",title:"herdr-remote update",running:"Running",installed:"Installed",latest:"Latest",restartPending:"{version} is installed but not running yet. Restart herdr-remote on the workstation:",stepTui:'On the workstation, open herdr-remote (the TUI), go to "Language & about" and press Enter on the update row.',stepCli:"Or run on the workstation:",restartNote:"Restarting reconnects this window after a few seconds.",ignore:"Skip this version",chipOutdated:"↑ update herdr-remote",toastOutdated:"{host} runs an old herdr-remote; please update it",thisHost:"this workstation",outdatedVersion:"too old to tell",outdated:"This workstation runs a herdr-remote too old to report its version or check for updates, and it lacks recent features and fixes. On the workstation, run:",windowsStop:"On Windows, first stop the running herdr-remote in PowerShell:"},herdrLaunch:{title:"Herdr is not running",body:"Herdr is not running on {host}. Start it on that workstation?",scope:"Only this paired workstation's own Herdr starts, as that workstation's user. No other machine is touched.",start:"Start Herdr",starting:"Starting Herdr on {host}…",failedTitle:"Herdr did not start",timeout:"The workstation did not answer within 30 seconds. Its herdr-remote may be too old to start Herdr from a browser.",thisHost:"this workstation"},onboarding:{title:"Pair with Herdr Remote",subtitle:"Connect your mobile or browser to your local terminal session",description:"Control Herdr sessions from any browser or phone.",firstTimeSetup:"First-time Setup",authRequired:"Authorization Required",authRequiredDesc:"Pair your device or provide a valid access token.",step1Title:"Generate Pairing Code on Host",step1Desc:"Run on the host running Herdr:",step1TuiNote:"Interactive TUI config:",step2Title:"Enter 6-character Pairing Code",step2Placeholder:"e.g. 7X9K2A",step2Note:"Pairing code expires in 10 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",addSubtitle:"A pairing code is all it takes",advancedTitle:"Advanced",advancedHint:"another relay, or a device token",pairAndConnect:"Pair & Connect",displayNameLabel:"Host Name",displayNamePlaceholder:"e.g. Workstation",credentialsRequired:"Enter a pairing code or device token.",pairCodeLabel:"Pairing Code",pairCodeNote:"(6-char code)",pairCodePlaceholder:"e.g. A2B3C4",pairCodeHelp:'Run "herdr-remote pair" on host.',repairNote:"(only to pair again)",editAdvancedHint:"relay, token, client ID",tokenLabel:"Access Token",tokenNote:"(Device secret)",tokenPlaceholder:"Device token...",wsUrlLabel:"Relay WebSocket Endpoint URL",wsUrlPlaceholder:"/ws/client",clientIdLabel:"Client Identifier",newIdButton:"New ID",autoReconnectLabel:"Auto-reconnect",saveAndConnect:"Save & Connect"},settings:{title:"Terminal Preferences",subtitle:"Interface, font, input and alerts",subtitleInstance:"Only for {name}",tabGeneral:"General",sectionInterface:"Interface",sectionFont:"Font",sectionInput:"Input",sectionAdmin:"Administration",toggleOn:"On",toggleOff:"Off",hostFontLabel:"Workstation font",adminEntry:"Relay dashboard",adminEntryHint:"Hosts, devices and traffic; needs the admin token",adminEntryOpen:"Open",tabVirtualKeys:"Virtual Keys",tabAgentKeymaps:"Agent Keys",fontFamilyLabel:"Monospace Font",fontSizeHint:"This window only",fontSizeLabel:"Terminal Text Size ({size}px)",predictiveEchoLabel:"Predictive Echo",predictiveEchoAuto:"Auto",predictiveEchoAlways:"Always On",predictiveEchoOff:"Off",predictiveEchoDesc:"Show typing before the echo returns on slow links",touchKeyToolbar:"Touch Key Toolbar",touchKeyToolbarDesc:"Modifier and arrow keys",touchHaptics:"Haptic Feedback",touchHapticsDesc:"Vibrate on key press",agentAlertsLabel:"Agent alerts",agentAlertBadge:"Title and icon badge",agentAlertBadgeDesc:"Count waiting and finished agents in the tab title",agentAlertVibrate:"Vibrate",agentAlertVibrateDesc:"When an agent waits or finishes (page on screen)",agentAlertSound:"Chime",agentAlertSoundDesc:"In the background; works after your next tap",agentAlertNotify:"System notification",agentAlertNotifyDesc:"In the background (HTTPS only)",languageLabel:"Language",languageHint:"Shared by every instance",resetDefaults:"Reset to Defaults",resetDefaultsToast:"Settings reset to defaults",fontSizeFollowHost:"Same size as the workstation terminal ({size}px)",fontSizeFollowHostUnknown:"Same size as the workstation terminal (not reported)",hostFontSync:"Sync host font",hostGlyphLine:"CJK: {family} · {status}",hostGlyphStatus:{none:"",checking:"Checking…",installed:"Installed on this device",available:"Not loaded",declined:"Not loaded — using this device’s fonts",loading:"Loading common characters",ready:"{count} characters on this device; others load as they appear",failed:"Could not be loaded"},hostFontStatus:{none:"The workstation did not report its terminal font",checking:"Checking…",installed:"Installed on this device",loaded:"Loaded from the workstation",available:"Not loaded",declined:"Not loaded — using this device’s fonts",loading:"Loading {percent}%",failed:"Could not be loaded",unavailable:"No font file to load; drawn by name where installed"}},agentKeymaps:{keymapLabel:"Keymap",auto:"Auto",shell:"Shell",agentGroup:"Agent",listGroup:"{profile} shortcuts",genericGroup:"General",profileRowLabel:"Agent to edit",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); 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",terminalControlAria:"Terminal control",inputControl:"Input control",settingsAria:"Terminal settings",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",newAdminTerminal:"Open an administrator PowerShell tab in Herdr",adminShort:"Admin",adminTerminalSetup:"On the Windows host, open the herdr-remote TUI, go to Keep-alive, and choose Set up admin terminal access. Approve the one-time Windows prompt under the same account as Herdr Remote.",adminTerminalUpdate:"Update the relay and Windows host connector before opening an administrator terminal."},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:{returnToTerminal:"Return to Terminal",terminalShells:"terminal sessions",startedAt:"Started at {time}",acrossWindows:"across {count} windows",perSecond:"{value}/s",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})",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",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",remoteRelayNotice:"Connected to remote relay. For server metrics, access the operator dashboard.",remoteRelayEndpoint:"Remote WebSocket Endpoint:",remoteRelayAdminUrl:"Remote Admin URL:",openRemoteAdminBtn:"Open Remote Admin",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",relJustNow:"just now",relMinutes:"{count}m ago",relHours:"{count}h ago",relDays:"{count}d ago",statInbound:"Inbound",statOutbound:"Outbound",statTotal:"{value} total",hostsOfflineSub:"{count} more offline",colHost:"Host",colStatus:"Status",deviceWindows:"{count} windows open",hostPtys:"{count} PTY",hostVersion:"herdr-remote {version}",hostVersionBehind:"herdr-remote {version} → {latest}",hostVersionUnknown:"herdr-remote too old",relayAdminPrompt:"Enter RELAY_ADMIN_TOKEN to see this relay's hosts, devices and traffic."},toasts:{connected:"Connected to relay",connectionError:"Connection error",controlGranted:"Control granted",pairedSuccess:"Paired successfully",sessionEnded:"Session ended",controlReleased:"Control released",viewerModeWarning:"This window is in viewer mode. Switch to Full control to type.",clientIdCopied:"Client ID copied: {id}",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.",admin_broker_unavailable:"The administrator terminal broker is not running. On the Windows host, open the herdr-remote TUI, go to Keep-alive, and choose Set up admin terminal access, then tap Admin again.",admin_terminal_unsupported:"This relay or Windows host connector cannot open administrator terminals. Upgrade both, then try again.",admin_tab_failed:"Could not open the administrator tab in Herdr. The host connector log has the details."},fontPresets:{host:"Workstation font (default)",system:"System monospace"},hostFont:{title:"Workstation terminal font",body:"The terminal on {host} uses {family}{detail}. This device does not have it.",bodyGlyphsOnly:"The terminal on {host} draws Chinese with {family}. This device does not have it.",glyphs:"Chinese in {family}: about 2 MB of common characters first; any other character loads the first time it appears.",glyphsAll:"{family} is too large to send whole: about 2 MB of common characters first; any other character loads the first time it appears.",detail:" ({detail})",detailSeparator:", ",download:"Load {count} font file(s), {size} in total. Downloaded once, then kept in this browser.",load:"Load font",decline:"Use this device’s fonts",loading:"Loading {received} of {total}",failed:"The font could not be loaded: {reason}",loaded:"Workstation font loaded",reasons:{host_font_unavailable:"the font changed on the workstation. Sync it again from Settings",host_font_timeout:"the workstation stopped answering",disconnected:"the connection dropped",font_api_unavailable:"this browser cannot load fonts",other:"the browser could not read the font file"}},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"}},Ux={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:"控制模式",controlActive:"控制端",viewerWithController:"观察者(控制者: {controllerId})",sharedControl:"完全控制",sharedWindows:"{count} 个窗口",modeLabel:"输入模式",controlHint:"按键、粘贴和点击都会发送到终端",observerHint:"只看不动:输入被拦下,仍可滚动",thisWindow:"本窗口",claimControl:"获取控制权",claimControlTitle:"获取终端控制权",releaseControl:"释放控制权",releaseControlTitle:"切回观察者模式",takeoverControl:"强占控制权",takeoverControlTitle:"从 {controllerId} 接管控制权",takeoverModalTitle:"确认接管终端控制权?",takeoverModalDesc:"当前已有其他客户端控制该终端。",takeoverModalWarning:"接管后输入焦点切换至当前窗口。",confirmTakeover:"确认接管"},statusBanner:{connecting:"连接 Relay 服务中...",reconnectingDefault:"连接断开,正在重连...",reconnectNow:"立即重连",errorDefault:"无法连接 Relay 服务",disconnected:"会话已断开"},update:{chip:"↑ herdr-remote {version}",chipCompact:"↑ {version}",chipRestart:"↻ 重启以应用 {version}",toast:"宿主机的 herdr-remote 有新版本 {version}",toastRestart:"herdr-remote {version} 已安装,重启后生效",title:"herdr-remote 更新",running:"正在运行",installed:"已安装",latest:"最新版本",restartPending:"{version} 已安装但尚未运行。在宿主机上重启 herdr-remote:",stepTui:"在宿主机打开 herdr-remote(TUI),进入「语言与关于」,在更新一行按 Enter。",stepCli:"或在宿主机上执行:",restartNote:"重启后这个窗口会在几秒内自动重连。",ignore:"忽略此版本",chipOutdated:"↑ 升级 herdr-remote",toastOutdated:"{host} 的 herdr-remote 版本过旧,请升级",thisHost:"这台宿主机",outdatedVersion:"过旧,无法获知版本",outdated:"这台宿主机的 herdr-remote 太旧,不会报告版本,也不会检查更新,还缺少近期的功能和修复。在宿主机上执行:",windowsStop:"Windows 上先在 PowerShell 里结束正在运行的 herdr-remote:"},herdrLaunch:{title:"Herdr 未运行",body:"{host} 上没有正在运行的 Herdr。要在这台宿主机上启动吗?",scope:"只会以这台已配对宿主机自己的用户身份,启动它自己的 Herdr,不会碰其他任何机器。",start:"启动 Herdr",starting:"正在 {host} 上启动 Herdr…",failedTitle:"Herdr 没有启动",timeout:"宿主机 30 秒内没有回应。它的 herdr-remote 可能版本过旧,不支持从浏览器启动 Herdr。",thisHost:"这台宿主机"},onboarding:{title:"配对 Herdr Remote",subtitle:"连接手机或浏览器至本地终端会话",description:"在浏览器或移动设备中控制 Herdr 会话。",firstTimeSetup:"首次配对",authRequired:"需要认证",authRequiredDesc:"使用配对码配对设备,或提供有效访问令牌。",step1Title:"在 Herdr 宿主机生成配对码",step1Desc:"在运行 Herdr 的主机终端执行:",step1TuiNote:"交互式 TUI 配置:",step2Title:"输入 6 位配对码",step2Placeholder:"例如:7X9K2A",step2Note:"配对码 10 分钟内有效,连接后自动保存凭据。",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 实例",addSubtitle:"只需输入配对码",advancedTitle:"高级选项",advancedHint:"其他 Relay 或已有设备 Token",pairAndConnect:"配对并连接",displayNameLabel:"主机名称",displayNamePlaceholder:"例如:工作电脑",credentialsRequired:"请输入配对码或设备令牌。",pairCodeLabel:"配对码",pairCodeNote:"(6 位代码)",pairCodePlaceholder:"例如:A2B3C4",pairCodeHelp:'在主机运行 "herdr-remote pair" 获取。',repairNote:"(重新配对时填写)",editAdvancedHint:"Relay 端点、Token、客户端 ID",tokenLabel:"访问 Token",tokenNote:"(设备凭据)",tokenPlaceholder:"设备 Token...",wsUrlLabel:"Relay WebSocket 端点",wsUrlPlaceholder:"/ws/client",clientIdLabel:"客户端标识",newIdButton:"生成新 ID",autoReconnectLabel:"掉线自动重连",saveAndConnect:"保存并连接"},settings:{title:"终端设置",subtitle:"界面、字体、输入与提醒",subtitleInstance:"仅对 {name} 生效",tabGeneral:"通用",sectionInterface:"界面",sectionFont:"字体",sectionInput:"输入",sectionAdmin:"管理",toggleOn:"开",toggleOff:"关",hostFontLabel:"宿主机字体",adminEntry:"Relay 管理面板",adminEntryHint:"主机、设备与流量;需要管理员令牌",adminEntryOpen:"打开",tabVirtualKeys:"虚拟按键",tabAgentKeymaps:"智能体按键",fontFamilyLabel:"等宽字体",fontSizeHint:"只影响当前窗口",fontSizeLabel:"终端字号 ({size}px)",predictiveEchoLabel:"预测回显",predictiveEchoAuto:"自动",predictiveEchoAlways:"始终开启",predictiveEchoOff:"关闭",predictiveEchoDesc:"高延迟时先显示输入,回显到达后校正",touchKeyToolbar:"底部触控按键条",touchKeyToolbarDesc:"修饰键与方向键",touchHaptics:"触控振动反馈",touchHapticsDesc:"按键时轻微震动",agentAlertsLabel:"智能体提醒",agentAlertBadge:"标题与图标角标",agentAlertBadgeDesc:"标签页标题显示等待与完成数",agentAlertVibrate:"震动",agentAlertVibrateDesc:"等待确认或完成时(页面在前台)",agentAlertSound:"提示音",agentAlertSoundDesc:"页面在后台时播放,下次点击后生效",agentAlertNotify:"系统通知",agentAlertNotifyDesc:"页面在后台时通知(仅 HTTPS)",languageLabel:"显示语言",languageHint:"所有实例共用",resetDefaults:"恢复默认设置",resetDefaultsToast:"设置已恢复默认",fontSizeFollowHost:"与宿主机终端同字号({size}px)",fontSizeFollowHostUnknown:"与宿主机终端同字号(宿主机未报告)",hostFontSync:"同步宿主机字体",hostGlyphLine:"中文:{family} · {status}",hostGlyphStatus:{none:"",checking:"检查中…",installed:"本机已安装",available:"未加载",declined:"未加载,正在使用本机字体",loading:"正在加载常用字",ready:"本机已有 {count} 字,其余出现时自动补齐",failed:"加载失败"},hostFontStatus:{none:"宿主机未报告终端字体",checking:"检查中…",installed:"本机已安装",loaded:"已从宿主机加载",available:"未加载",declined:"未加载,正在使用本机字体",loading:"加载中 {percent}%",failed:"加载失败",unavailable:"没有可传输的字体文件,已安装该字体的设备按名称显示"}},agentKeymaps:{keymapLabel:"按键方案",auto:"自动",shell:"Shell",agentGroup:"智能体",listGroup:"{profile} 快捷键",genericGroup:"通用",profileRowLabel:"编辑的智能体",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:"关闭会话控制面板",terminalControlAria:"终端控制权",inputControl:"输入控制权",settingsAria:"终端设置",pairingAria:"连接与配对设置",keybarAria:"切换触控按键条",quickInputAria:"切换快捷命令",menu:"菜单",statusBarAria:"会话状态栏"},terminal:{bannerTitle:"Herdr Remote WebUI",bannerSubtitle:"已连接至 Herdr 会话。",windowAriaLabel:"远程终端窗口",bufferAriaLabel:"xterm 终端缓冲区",offlineStatusAria:"离线状态",releaseControlAria:"释放终端控制权",takeoverControlAria:"强占终端控制权",claimControlAria:"获取终端控制权",newAdminTerminal:"在 Herdr 中新建管理员 PowerShell 标签页",adminShort:"管理员",adminTerminalSetup:"请在 Windows 主机打开 herdr-remote TUI,进入「保活」并选择「设置管理员终端」,再使用运行 Herdr Remote 的同一账户批准一次 Windows 提权提示。",adminTerminalUpdate:"请先升级 relay 和 Windows 主机连接器,再新建管理员终端。"},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:{returnToTerminal:"返回终端",terminalShells:"终端会话",startedAt:"启动于 {time}",acrossWindows:"共 {count} 个窗口",perSecond:"{value}/秒",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})",hostsTitle:"主机 ({count})",noHosts:"暂无接入或配对的主机",hostConnectedDevices:"{count} 台在线",hostPairedDevices:"{count} 台已配对",hostStatusOnline:"在线",hostStatusBusy:"使用中",hostStatusReconnecting:"重连中",hostStatusOffline:"离线",hostRosterOperatorOnly:"设备清单仅 Relay 操作员可见。",connectedClientsTitle:"已连接客户端 ({count})",noClients:"当前暂无客户端连接",colClientId:"客户端 ID",colDevice:"设备",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 服务管理",remoteRelayNotice:"当前连接至远程独立 Relay 服务。如需查看服务端指标,请使用操作员后台。",remoteRelayEndpoint:"远程端点:",remoteRelayAdminUrl:"远程后台地址:",openRemoteAdminBtn:"前往远程管理后台",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:"返回终端",relJustNow:"刚刚",relMinutes:"{count} 分钟前",relHours:"{count} 小时前",relDays:"{count} 天前",statInbound:"入站流量",statOutbound:"出站流量",statTotal:"累计 {value}",hostsOfflineSub:"另有 {count} 台离线",colHost:"主机",colStatus:"状态",deviceWindows:"{count} 个窗口在线",hostPtys:"PTY {count}",hostVersion:"herdr-remote {version}",hostVersionBehind:"herdr-remote {version} → {latest}",hostVersionUnknown:"herdr-remote 过旧",relayAdminPrompt:"输入 RELAY_ADMIN_TOKEN,查看本 Relay 的主机、设备与流量。"},toasts:{connected:"已连接至 Relay 服务",connectionError:"连接发生错误",controlGranted:"已获得控制权",pairedSuccess:"设备配对成功,已保存凭证",sessionEnded:"终端会话已结束",controlReleased:"已释放控制权,切回观察者模式",viewerModeWarning:"本窗口处于观察者模式,切到「完全控制」才能输入",clientIdCopied:"客户端 ID 已复制: {id}",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:"终端会话未准备就绪。",admin_broker_unavailable:"管理员终端 broker 尚未运行。请在 Windows 主机打开 herdr-remote TUI,进入「保活」并选择「设置管理员终端」,然后再点一次「管理员」。",admin_terminal_unsupported:"当前 relay 或 Windows 主机连接器不支持管理员终端。请升级两端后再试。",admin_tab_failed:"无法在 Herdr 中打开管理员标签页,详情见主机连接器日志。"},fontPresets:{host:"宿主机终端字体(默认)",system:"系统等宽字体"},hostFont:{title:"宿主机终端字体",body:"{host} 的终端使用 {family}{detail}。这台设备没有安装该字体。",bodyGlyphsOnly:"{host} 的终端显示中文用 {family},这台设备没有安装该字体。",glyphs:"中文使用 {family}:先下载常用字约 2 MB,其余的字第一次出现时再补。",glyphsAll:"{family} 太大,不整包传输:先下载常用字符约 2 MB,其余字符第一次出现时再补。",detail:"({detail})",detailSeparator:",",download:"加载 {count} 个字体文件,共 {size}。只下载一次,之后保存在本浏览器。",load:"加载字体",decline:"使用本机字体",loading:"正在加载 {received} / {total}",failed:"字体加载失败:{reason}",loaded:"宿主机字体已加载",reasons:{host_font_unavailable:"宿主机上的字体已变化,请在设置里重新同步",host_font_timeout:"宿主机没有响应",disconnected:"连接已断开",font_api_unavailable:"此浏览器不支持加载字体",other:"浏览器无法解析该字体文件"}},agents:{title:"本工作站的智能体",blocked:"待确认",done:"已完成",working:"运行中",allIdle:"智能体空闲",notifyBlocked:"{count} 个智能体在等你确认",notifyDone:"{count} 个智能体已完成"},clipboard:{openLink:"打开链接",openLinkFailed:"该链接无法在浏览器中打开",copySelection:"复制选中",copyLine:"复制本行",copyScreen:"复制整屏",paste:"粘贴",cancel:"取消",copied:"已复制到剪贴板",copyFailed:"复制失败",pasteHint:"长按此处粘贴,然后按发送",pasteSend:"发送",pasteUnavailable:"剪贴板为空或不可用",pasteTitle:"粘贴内容",pasted:"已粘贴",chooseImage:"选择图片",takePhoto:"拍照",imageTooLarge:"图片超过 3 MB 限制且无法进一步压缩。",imageCompressedSize:"压缩后大小:{size}",fileEmpty:"文件内容为空。",decodeFailed:"无法解析图片文件。",unsupportedType:"不支持的图片格式,仅支持 PNG、JPEG、WebP 和 GIF。",imageSectionTitle:"图片",textSectionTitle:"文本",imageCompressing:"正在处理图片...",removeImage:"移除图片"}},$u={en:wb,zh:Ux};function Od(l,n,a){const s=$u[l]||$u.en,o=n.split(".");let c=s;for(const h of o)if(c&&typeof c=="object"&&h in c)c=c[h];else{let m=$u.en;for(const p of o)if(m&&typeof m=="object"&&p in m)m=m[p];else return n;c=m;break}if(typeof c!="string")return n;if(a){let h=c;for(const[m,p]of Object.entries(a))h=h.replaceAll(`{${m}}`,String(p));return h}return c}function Vu(l){return typeof l=="string"&&Object.hasOwn(wb.serverErrors,l)}const 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~"},Kx=new TextEncoder;function Dd(l){return Kx.encode(l)}function zd(l){if(!l||l.length===0)return"";const a=l.toUpperCase().charCodeAt(0);return a>=65&&a<=90?String.fromCharCode(a-64):l==="@"||l===" "?"\0":l==="["?"\x1B":l==="\\"?"":l==="]"?"":l==="^"?"":l==="_"?"":l==="?"?"":l}function Ix(l){return`\x1B${l}`}function tg({ctrl:l,alt:n,shift:a}){return 1+(a?1:0)+(n?2:0)+(l?4:0)}const Sb=/^\x1b[[O]([ABCDHF])$/,Cb=/^\x1bO([PQRS])$/,Tb=/^\x1b\[(\d+)~$/;function uo(l,n){const{ctrl:a=!1,alt:s=!1,shift:o=!1}=n;if(!a&&!s&&!o)return l;const c=tg(n),h=s&&!a&&!o,m=Sb.exec(l);if(m)return`\x1B[1;${c}${m[1]}`;const p=Cb.exec(l);if(p)return`\x1B[1;${c}${p[1]}`;const g=Tb.exec(l);if(g)return`\x1B[${g[1]};${c}~`;switch(l){case re.TAB:return o&&!a&&!s?re.SHIFT_TAB:h?`\x1B${l}`:`\x1B[9;${c}u`;case re.SHIFT_TAB:return!a&&!s?l:`\x1B[9;${tg({...n,shift:!0})}u`;case re.ENTER:return h?`\x1B${l}`:`\x1B[13;${c}u`;case re.BACKSPACE:return a&&!s&&!o?"\b":h?`\x1B${l}`:`\x1B[127;${c}u`;case re.ESC:return h?`\x1B${l}`:`\x1B[27;${c}u`}let y=l;return o&&l.length===1&&!a&&(y=l.toUpperCase()),a&&(y=zd(y)),s&&(y=Ix(y)),y}function Fx(l){return[...l].length===1?!0:Sb.test(l)||Cb.test(l)||Tb.test(l)||l===re.SHIFT_TAB}class pn extends Error{constructor(a,s={}){super(a);$(this,"code");$(this,"params");this.name="KeyComboError",this.code=a,this.params=s}}const Gx={escape:"esc",return:"enter",pgup:"pageup",pgdn:"pagedown",backslash:"\\",plus:"+"},ng={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:" ","+":"+"},Yx={esc:"ESC",tab:"TAB",enter:"⏎",backspace:"⌫",delete:"DEL",left:"←",right:"→",up:"↑",down:"↓",home:"HOME",end:"END",pageup:"PGUP",pagedown:"PGDN",insert:"INS",space:"SPACE","+":"+"},Px={2:"²",3:"³",4:"⁴",5:"⁵",6:"⁶",7:"⁷",8:"⁸",9:"⁹"};function Mb(l,n){const a=l.toLowerCase().split("+");if(a.some(p=>!p))throw new pn("invalidStepSyntax",{step:n+1});const s={};let o;for(const p of a)if(p==="ctrl"||p==="control"){if(s.ctrl)throw new pn("duplicateModifier",{step:n+1,modifier:"Ctrl"});s.ctrl=!0}else if(p==="alt"||p==="option"){if(s.alt)throw new pn("duplicateModifier",{step:n+1,modifier:"Alt"});s.alt=!0}else if(p==="shift"){if(s.shift)throw new pn("duplicateModifier",{step:n+1,modifier:"Shift"});s.shift=!0}else if(o===void 0)o=p;else throw new pn("multipleKeys",{step:n+1});if(!o)throw new pn("missingKey",{step:n+1});const c=Gx[o]||o,h=/^f(?:[1-9]|1[0-2])$/.exec(c);let m;if(h)m=re[c.toUpperCase()];else if(Object.hasOwn(ng,c))m=ng[c];else if([...c].length===1&&/^[\x21-\x7e]$/.test(c))m=c;else throw new pn("unsupportedKey",{step:n+1,key:c});return{key:m,keyName:c,modifiers:s,sequence:Vx(m,c,s)}}function $x(l){return 1+(l.shift?1:0)+(l.alt?2:0)+(l.ctrl?4:0)}function ig(l,n){const a=[...l][0].codePointAt(0);return a===void 0?"":`\x1B[${a};${$x(n)}u`}function Vx(l,n,a){if(!a.ctrl)return uo(l,a);if(n.length===1&&/^[\x20-\x7e]$/.test(n)){const s=n.toLowerCase();if(a.alt||a.shift||s==="m"||s==="i")return ig(s,a);if(s==="-"||s==="/"||s==="_")return"";const o=zd(s);return o!==s?o:ig(s,a)}return uo(l,a)}function gn(l){if(typeof l!="string"||!l.trim())throw new pn("empty");const n=l.trim().split(/\s+/);if(n.length>8)throw new pn("tooManySteps",{count:8});return n.map((a,s)=>Mb(a,s).sequence)}function hs(l){const n=l.trim().split(/\s+/);return n.length>1&&n.every(a=>["esc","escape"].includes(a.toLowerCase()))?`ESC${Px[n.length]||` ×${n.length}`}`:n.map((a,s)=>{const{keyName:o,modifiers:c}=Mb(a,s),h=Yx[o]||(/^f\d+$/.test(o),o.toUpperCase());return c.ctrl&&c.alt&&c.shift?`Ctrl+Alt+⇧${h}`:c.ctrl&&c.alt?`Ctrl+Alt+${h}`:c.ctrl&&c.shift?`^⇧${h}`:c.ctrl?`^${h}`:c.alt&&c.shift?`Alt+⇧${h}`:c.alt?`Alt+${h}`:c.shift?`⇧${h}`:h}).join(" ")}const B=(l,n,a,s=!0)=>({id:l,labelKey:n,combo:a,verified:s}),Ab={claude:{id:"claude",name:"Claude Code",shortName:"Claude",configHint:"~/.claude/keybindings.json",bar:["mode","rewind","details","model"],actions:[B("mode","mode","shift+tab"),B("rewind","rewind","esc esc"),B("details","details","ctrl+o"),B("model","model","alt+p"),B("thinking","thinking","alt+t"),B("todos","todos","ctrl+t"),B("background","background","ctrl+b"),B("editor","editor","ctrl+g"),B("history","history","ctrl+r"),B("stash","stash","ctrl+s"),B("pasteImage","pasteImage","ctrl+v"),B("newline","newline","ctrl+j"),B("interrupt","interrupt","esc")]},codex:{id:"codex",name:"Codex",shortName:"Codex",configHint:"~/.codex/config.toml [tui.keymap]",bar:["mode","editPrevious","details"],actions:[B("mode","mode","shift+tab"),B("editPrevious","editPrevious","esc esc"),B("details","details","ctrl+t"),B("queue","queue","tab"),B("history","history","ctrl+r"),B("copy","copy","ctrl+o"),B("editor","editor","ctrl+g"),B("newline","newline","ctrl+j"),B("clear","clear","ctrl+l"),B("interrupt","interrupt","esc")]},gemini:{id:"gemini",name:"Gemini CLI",shortName:"Gemini",configHint:"~/.gemini/keybindings.json",bar:["mode","yolo","rewind"],actions:[B("mode","mode","shift+tab"),B("yolo","yolo","ctrl+y"),B("rewind","rewind","esc esc"),B("todos","todos","ctrl+t"),B("expand","expand","ctrl+o"),B("background","background","ctrl+b"),B("editor","editor","ctrl+g"),B("history","history","ctrl+r"),B("undo","undo","ctrl+z"),B("newline","newline","ctrl+j"),B("interrupt","interrupt","esc")]},qwen:{id:"qwen",name:"Qwen Code",shortName:"Qwen",bar:["mode","history"],actions:[B("mode","mode","shift+tab"),B("interrupt","interrupt","esc"),B("history","history","ctrl+r"),B("newline","newline","ctrl+j"),B("todos","todos","ctrl+t",!1),B("rewind","rewind","esc esc",!1)]},opencode:{id:"opencode",name:"OpenCode",shortName:"OpenCode",configHint:"tui.json keybinds",bar:["palette","model","sessions"],actions:[B("agent","agent","tab"),B("agentBack","agentBack","shift+tab"),B("interrupt","interrupt","esc"),B("palette","palette","ctrl+p"),B("model","model","ctrl+x m"),B("recentModel","recentModel","f2"),B("variant","variant","ctrl+t"),B("newSession","newSession","ctrl+x n"),B("sessions","sessions","ctrl+x l"),B("undo","undo","ctrl+x u"),B("editor","editor","ctrl+x e"),B("newline","newline","ctrl+j")]},kilo:{id:"kilo",name:"Kilo Code",shortName:"Kilo",configHint:"~/.config/kilo/tui.jsonc",bar:["palette","model","sessions"],actions:[B("agent","agent","tab",!1),B("agentBack","agentBack","shift+tab",!1),B("interrupt","interrupt","esc"),B("palette","palette","ctrl+p"),B("model","model","ctrl+x m"),B("recentModel","recentModel","f2"),B("variant","variant","ctrl+t"),B("newSession","newSession","ctrl+x n"),B("sessions","sessions","ctrl+x l"),B("undo","undo","ctrl+x u"),B("editor","editor","ctrl+x e"),B("newline","newline","ctrl+j")]},pi:{id:"pi",name:"Pi",shortName:"Pi",configHint:"~/.pi/agent/keybindings.json",bar:["thinkingMode","modelPicker","tools"],actions:[B("thinkingMode","thinkingMode","shift+tab"),B("interrupt","interrupt","esc"),B("nextModel","nextModel","ctrl+p"),B("modelPicker","modelPicker","ctrl+l"),B("tools","tools","ctrl+o"),B("thinkingBlocks","thinkingBlocks","ctrl+t"),B("editor","editor","ctrl+g"),B("followup","followup","alt+enter"),B("dequeue","dequeue","alt+up"),B("newline","newline","shift+enter")]},omp:{id:"omp",name:"Oh My Pi",shortName:"OMP",configHint:"~/.omp/agent/keybindings.yml",bar:["thinkingMode","plan","model"],actions:[B("thinkingMode","thinkingMode","shift+tab"),B("plan","plan","alt+shift+p"),B("model","model","alt+m"),B("temporaryModel","temporaryModel","alt+p"),B("nextModel","nextModel","ctrl+p"),B("tools","tools","ctrl+o"),B("thinking","thinking","ctrl+t"),B("history","history","ctrl+r"),B("editor","editor","ctrl+g"),B("followup","followup","ctrl+enter"),B("interrupt","interrupt","esc")]},copilot:{id:"copilot",name:"GitHub Copilot",shortName:"Copilot",bar:["mode","expand","reasoning"],actions:[B("mode","mode","shift+tab"),B("interrupt","interrupt","esc"),B("expand","expand","ctrl+o"),B("expandAll","expandAll","ctrl+e"),B("reasoning","reasoning","ctrl+t"),B("editor","editor","ctrl+g"),B("clear","clear","ctrl+l")]},cursor:{id:"cursor",name:"Cursor",shortName:"Cursor",bar:["mode","review"],actions:[B("mode","mode","shift+tab"),B("review","review","ctrl+r"),B("newline","newline","ctrl+j"),B("interrupt","interrupt","esc",!1)]},droid:{id:"droid",name:"Factory Droid",shortName:"Droid",configHint:"In-app settings",bar:["specMode","autonomy"],actions:[B("specMode","specMode","shift+tab"),B("autonomy","autonomy","ctrl+l"),B("details","details","ctrl+o",!1),B("queue","queue","ctrl+enter"),B("interrupt","interrupt","esc",!1)]},kimi:{id:"kimi",name:"Kimi Code",shortName:"Kimi",bar:["plan","undoPicker","expand"],actions:[B("plan","plan","shift+tab"),B("interrupt","interrupt","esc"),B("undoPicker","undoPicker","esc esc"),B("expand","expand","ctrl+o"),B("editor","editor","ctrl+g"),B("steer","steer","ctrl+s"),B("undo","undo","ctrl+-"),B("newline","newline","ctrl+j"),B("pasteImage","pasteImage","ctrl+v")]},amp:{id:"amp",name:"Amp",shortName:"Amp",bar:["palette","reasoning","mode"],actions:[B("palette","palette","ctrl+o"),B("reasoning","reasoning","alt+d"),B("mode","mode","ctrl+s",!1),B("editor","editor","ctrl+g"),B("history","history","ctrl+r"),B("sidebar","sidebar","ctrl+backslash"),B("pasteImage","pasteImage","ctrl+v"),B("interrupt","interrupt","esc",!1)]},hermes:{id:"hermes",name:"Hermes",shortName:"Hermes",bar:["interrupt","agents","sessions"],actions:[B("interrupt","interrupt","ctrl+c"),B("newline","newline","ctrl+j"),B("editor","editor","ctrl+g"),B("agents","agents","ctrl+t"),B("sessions","sessions","ctrl+x")]},qodercli:{id:"qodercli",name:"Qoder CLI",shortName:"Qoder",configHint:"/shortcuts in-app",bar:["permissionMode","bypass","tasks","interrupt"],actions:[B("permissionMode","permissionMode","shift+tab"),B("bypass","bypass","ctrl+y"),B("tasks","tasks","ctrl+t"),B("editor","editor","ctrl+x"),B("history","history","ctrl+r"),B("queue","queue","ctrl+enter"),B("newline","newline","ctrl+j"),B("pasteImage","pasteImage","alt+v"),B("interrupt","interrupt","ctrl+c")]},devin:{id:"devin",name:"Devin",shortName:"Devin",configHint:"~/.config/devin/config.json keymap",bar:["mode","thinking","interrupt"],actions:[B("mode","mode","shift+tab"),B("interrupt","interrupt","ctrl+c"),B("thinking","thinking","alt+t"),B("newline","newline","ctrl+j"),B("pasteImage","pasteImage","ctrl+v")]},grok:{id:"grok",name:"Grok CLI",shortName:"Grok",bar:["mode","rewind","interrupt"],actions:[B("mode","mode","shift+tab"),B("interrupt","interrupt","ctrl+c"),B("rewind","rewind","esc esc"),B("interject","interject","ctrl+enter"),B("multiline","multiline","ctrl+m"),B("newline","newline","alt+enter"),B("shortcuts","shortcuts","ctrl+.")]},agy:{id:"agy",name:"Antigravity",shortName:"Antigravity",configHint:"~/.gemini/antigravity-cli/keybindings.json",bar:["mode","approve","interrupt"],actions:[B("mode","mode","shift+tab"),B("interrupt","interrupt","ctrl+c"),B("background","background","ctrl+b"),B("approve","approve","ctrl+k"),B("clear","clear","esc esc")]},mastracode:{id:"mastracode",name:"MastraCode",shortName:"MastraCode",bar:["interrupt","thinking","expand"],actions:[B("interrupt","interrupt","ctrl+c"),B("thinking","thinking","ctrl+t"),B("expand","expand","ctrl+e"),B("followup","followup","ctrl+f")]},letta:{id:"letta",name:"Letta Code",shortName:"Letta",bar:["permissionMode"],actions:[B("permissionMode","permissionMode","shift+tab"),B("interrupt","interrupt","esc",!1)]},kiro:{id:"kiro",name:"Kiro CLI",shortName:"Kiro",configHint:"kiro-cli settings chat.keybindings.*",bar:["agentSwap","details","steer"],actions:[B("agentSwap","agentSwap","shift+tab"),B("interrupt","interrupt","esc"),B("details","details","ctrl+t"),B("steer","steer","ctrl+s"),B("expand","expand","ctrl+o"),B("activity","activity","ctrl+x"),B("newline","newline","ctrl+j")]},cline:{id:"cline",name:"Cline",shortName:"Cline",bar:["autoApprove"],actions:[B("planAct","planAct","tab"),B("autoApprove","autoApprove","shift+tab"),B("interrupt","interrupt","esc",!1)]},maki:{id:"maki",name:"Maki",shortName:"Maki",bar:["rewind","search"],actions:[B("rewind","rewind","esc esc"),B("search","search","ctrl+f"),B("interrupt","interrupt","esc",!1)]},muse:{id:"muse",name:"Muse",shortName:"Muse",configHint:"/keymap in-app",bar:["queue","interruptCtrl"],actions:[B("interrupt","interrupt","esc"),B("queue","queue","alt+enter"),B("interruptCtrl","interrupt","ctrl+c")]},shell:{id:"shell",name:"Shell",shortName:"Shell",actions:[]}},nl=Ab,qx=Object.keys(Ab),lg={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"};function Xx(l){return l&&l.trim().toLowerCase().replace(/\\/g,"/").split("/").at(-1)||""}function ag(l){const n=Xx(l);return lg[n]?lg[n]:/^muse-bin-\d/.test(n)?"muse":null}function Zx(l,n="auto"){return n&&n!=="auto"?ag(n)||"shell":ag(l)||"shell"}const ys=[B("genericCtrlC","interrupt","ctrl+c"),B("genericCtrlD","eof","ctrl+d"),B("genericCtrlZ","suspend","ctrl+z"),B("genericCtrlL","clear","ctrl+l"),B("genericCtrlR","history","ctrl+r"),B("genericCtrlA","startOfLine","ctrl+a"),B("genericCtrlE","endOfLine","ctrl+e"),B("genericCtrlK","killToEnd","ctrl+k")],sg=["genericCtrlC","genericCtrlD","genericCtrlL","genericCtrlR"],Wx=["genericCtrlC"],Qx=ys.filter(({id:l})=>l!=="genericCtrlD"&&l!=="genericCtrlZ"),Jx=ys.filter(({id:l})=>l==="genericCtrlC"||l==="genericCtrlZ").map(l=>l.id==="genericCtrlZ"?{...l,labelKey:"eof"}:l),ew={posix:ys,"git-bash":ys,cmd:Jx,powershell:Qx},tw={posix:sg,"git-bash":sg,cmd:["genericCtrlC","genericCtrlZ"],powershell:["genericCtrlC","genericCtrlL","genericCtrlR"]};function nw(l,n){var o,c;const a=l.map(h=>{var g;const m=(g=n==null?void 0:n.actions)==null?void 0:g[h.id];let p=typeof(m==null?void 0:m.keys)=="string"?m.keys:h.combo;try{gn(p)}catch{p=h.combo}return{...h,defaultCombo:h.combo,combo:p,hidden:typeof(m==null?void 0:m.hidden)=="boolean"?m.hidden:h.defaultHidden===!0,custom:!1}}),s=new Set(a.map(h=>h.id));for(const h of(n==null?void 0:n.custom)||[]){if(!h||typeof h.id!="string"||s.has(h.id))continue;const m=h.keys;try{gn(m)}catch{continue}a.push({id:h.id,labelKey:"custom",defaultCombo:m,combo:m,verified:!0,hidden:((c=(o=n==null?void 0:n.actions)==null?void 0:o[h.id])==null?void 0:c.hidden)===!0,custom:!0,customLabel:h.label}),s.add(h.id)}if(Array.isArray(n==null?void 0:n.order)){const h=new Map(n.order.map((m,p)=>[m,p]));a.sort((m,p)=>(h.get(m.id)??Number.MAX_SAFE_INTEGER)-(h.get(p.id)??Number.MAX_SAFE_INTEGER))}return a}function iw(l,n){const a=new Set(l.map(s=>s.combo.trim().toLowerCase()));return n.filter(s=>!a.has(s.combo.trim().toLowerCase()))}const ps=l=>l.id.startsWith("generic");function Eb(l,n,a="posix"){const s=nl[l],o=l==="shell"?ew[a]:ys,c=new Set([...s.bar||[],...l==="shell"?tw[a]:Wx]),h=[...s.actions,...o].map(m=>({...m,defaultHidden:!c.has(m.id)}));return nw(h,n)}function Nb(l,n,a="posix"){const s=Eb(l,n,a),o=s.filter(h=>!ps(h)),c=new Set(iw(o,s.filter(ps)));return s.filter(h=>!ps(h)||c.has(h))}function lw(l,n,a="posix"){const s=Nb(l,n,a).filter(o=>!o.hidden);return{agentActions:s.filter(o=>!ps(o)),genericActions:s.filter(ps)}}function aw(l){const n={};for(const[a,s]of Object.entries(l.actions||{})){const o={...s};delete o.hidden,Object.keys(o).length>0&&(n[a]=o)}return{...l,actions:n}}function kb(l){if(!l||typeof l!="object"||Array.isArray(l))return{};const n=Object.create(null);for(const[a,s]of Object.entries(l).slice(0,32)){if(!/^[a-z][a-z0-9_-]{0,31}$/i.test(a)||["__proto__","constructor","prototype"].includes(a)||!s||typeof s!="object"||Array.isArray(s))continue;const o=s,c={};if(Array.isArray(o.order)&&(c.order=[...new Set(o.order.filter(h=>typeof h=="string"&&/^[a-zA-Z0-9_-]{1,64}$/.test(h)))].slice(0,256)),o.actions&&typeof o.actions=="object"&&!Array.isArray(o.actions)){const h=Object.create(null);for(const[m,p]of Object.entries(o.actions).slice(0,256)){if(!/^[a-zA-Z0-9_-]{1,64}$/.test(m)||!p||typeof p!="object"||Array.isArray(p))continue;const g=p,y={};if(typeof g.keys=="string"&&g.keys.trim()){const v=g.keys.trim().slice(0,80);try{gn(v),y.keys=v}catch{}}typeof g.hidden=="boolean"&&(y.hidden=g.hidden),Object.keys(y).length>0&&(h[m]=y)}c.actions=h}if(Array.isArray(o.custom)){const h=new Set;c.custom=o.custom.slice(0,64).flatMap(m=>{if(!m||typeof m!="object"||Array.isArray(m))return[];const p=m;if(typeof p.id!="string"||!/^[a-zA-Z0-9_-]{1,64}$/.test(p.id)||["__proto__","constructor","prototype"].includes(p.id)||h.has(p.id))return[];if(typeof p.label!="string"||!p.label.trim()||typeof p.keys!="string"||!p.keys.trim())return[];const g=p.keys.trim().slice(0,80);try{gn(g)}catch{return[]}return h.add(p.id),[{id:p.id,label:p.label.trim().slice(0,64),keys:g}]})}n[a]=c}return n}const sw=10,rw=24,vs=15,fo=13,Hd=640;function ow(){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 aa()<Hd}function aa(){return typeof window>"u"?1024:window.visualViewport&&typeof window.visualViewport.width=="number"&&window.visualViewport.width>0?window.visualViewport.width:window.innerWidth||1024}function fd(){return typeof window>"u"?768:window.visualViewport&&typeof window.visualViewport.height=="number"&&window.visualViewport.height>0?window.visualViewport.height:window.innerHeight||768}function sa(l,n=vs){const a=typeof l=="number"?l:Number(l);return!Number.isFinite(a)||a<=0?n:Math.min(rw,Math.max(sw,Math.round(a)))}function rg(l,n=aa()){if(n<Hd){const s=sa(l,fo);return Math.min(15,Math.max(12,s))}return sa(l,vs)}const og="#11111b",cw=['"Symbols Nerd Font Mono"','"Sarasa Mono SC"','"Noto Sans Mono CJK SC"','"Noto Sans Mono CJK TC"','"Microsoft YaHei Mono"','"PingFang SC"',"monospace"],ho=["ui-monospace","SFMono-Regular","Menlo","Monaco","Consolas",'"Liberation Mono"','"Courier New"'],hd=[{id:"host",name:"Host terminal font",faces:[]},{id:"system",name:"System monospace",faces:ho},{id:"jetbrains-mono",name:"JetBrains Mono",faces:['"JetBrains Mono"','"Herdr JetBrains Mono"']},{id:"fira-code",name:"Fira Code",faces:['"Fira Code"','"Herdr Fira Code"']},{id:"cascadia-code",name:"Cascadia Code",faces:['"Cascadia Code"','"Herdr Cascadia Code"']},{id:"source-code-pro",name:"Source Code Pro",faces:['"Source Code Pro"','"Herdr Source Code Pro"']},{id:"ibm-plex-mono",name:"IBM Plex Mono",faces:['"IBM Plex Mono"','"Herdr IBM Plex Mono"']}],Lb="host",uw='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", "Symbols Nerd Font Mono", monospace',dw='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',fw="JetBrains Mono, Menlo, Monaco, Consolas, monospace",hw={[uw]:"host",[dw]:"host",[fw]:"host",'SFMono-Regular, Menlo, Monaco, "Symbols Nerd Font Mono", monospace':"system",'Consolas, "Lucida Console", "Symbols Nerd Font Mono", monospace':"system",'"Liberation Mono", "DejaVu Sans Mono", "Symbols Nerd Font Mono", monospace':"system",'"Courier New", Courier, "Symbols Nerd Font Mono", monospace':"system",'"Fira Code", "Symbols Nerd Font Mono", monospace':"fira-code"};function qu(l){return typeof l!="string"||!l.trim()?Lb:hw[l]??l}const mw=[[/^jetbrains\s*mono/i,'"Herdr JetBrains Mono"'],[/^fira\s*code/i,'"Herdr Fira Code"'],[/^(cascadia\s*(code|mono)|caskaydia\s*(cove|mono))/i,'"Herdr Cascadia Code"'],[/^(source\s*code\s*pro|sauce\s*code\s*pro)/i,'"Herdr Source Code Pro"'],[/^(ibm\s*plex\s*mono|blex\s*mono)/i,'"Herdr IBM Plex Mono"']];function pw(l){const n=mw.find(([a])=>a.test(l.trim()));return n?n[1]:null}function cs(l){return`"${l.replace(/["\\]/g,"")}"`}function md(l){return[...new Set([...l,...cw])].join(", ")}const gw=md(ho);function bw(l,n){const a=typeof l=="string"?l.trim():"";if(!a||a==="host"){if(!(n!=null&&n.family))return gw;const c=[],h=n.glyphs;(h==null?void 0:h.scope)==="all"&&h.alias&&c.push(cs(h.alias)),n.alias&&c.push(cs(n.alias)),c.push(cs(n.family));const m=pw(n.family);return m&&c.push(m),(h==null?void 0:h.scope)==="cjk"&&(h.alias&&c.push(cs(h.alias)),c.push(cs(h.family))),md([...c,...ho])}const s=hd.find(c=>c.id===a);if(s)return md([...s.faces,...ho]);if(a.includes("Symbols Nerd Font"))return a;if(/^['"]?monospace['"]?$/i.test(a))return'"Symbols Nerd Font Mono", monospace';const o=/,\s*['"]?monospace['"]?\s*$/i;return o.test(a)?a.replace(o,', "Symbols Nerd Font Mono", monospace'):`${a}, "Symbols Nerd Font Mono", monospace`}function yw(l){if(!l)return null;const n={};return l.background&&(n.background=l.background,n.cursorAccent=l.background),l.foreground&&(n.foreground=l.foreground),l.cursor&&(n.cursor=l.cursor),l.ansi&&Object.assign(n,l.ansi),Object.keys(n).length===0?null:n}function _b(){if(typeof document>"u")return;const l=document.querySelector('meta[name="theme-color"]');document.documentElement.style.colorScheme="dark",l==null||l.setAttribute("content",og),document.documentElement.classList.add("dark"),document.documentElement.classList.remove("light"),document.body.classList.add("dark"),document.body.classList.remove("light"),document.body.style.backgroundColor=og}const Et={settings:"herdr_remote_settings_v1",sessionView:"herdr_remote_session_view_v1",ignoredUpdate:"herdr_remote_ignored_update_v1",hostFontConsent:"herdr_remote_host_font_consent_v1",rendererProbe:"herdr_remote_renderer_probe_v3"},pd={local:{},session:{}};function xs(l,n){if(typeof window>"u")return pd[l][n]||null;try{return(l==="local"?window.localStorage:window.sessionStorage).getItem(n)}catch{return pd[l][n]||null}}function _i(l,n,a){if(pd[l][n]=a,!(typeof window>"u"))try{(l==="local"?window.localStorage:window.sessionStorage).setItem(n,a)}catch(s){console.warn(`Failed to write to ${l}Storage:`,s)}}const cg=["啊阿埃挨哎唉哀皑癌蔼矮艾碍爱隘鞍氨安俺按暗岸胺案肮昂盎凹敖熬翱袄傲奥懊澳芭捌扒叭吧笆八疤巴拔跋靶把耙坝霸罢爸白柏百摆佰败拜稗斑班搬扳般颁板版扮拌伴瓣半办绊邦帮梆","榜膀绑棒磅蚌镑傍谤苞胞包褒剥薄雹保堡饱宝抱报暴豹鲍爆杯碑悲卑北辈背贝钡倍狈备惫焙被奔苯本笨崩绷甭泵蹦迸逼鼻比鄙笔彼碧蓖蔽毕毙毖币庇痹闭敝弊必辟壁臂避陛鞭边编贬扁","便变卞辨辩辫遍标彪膘表鳖憋别瘪彬斌濒滨宾摈兵冰柄丙秉饼炳病并玻菠播拨钵波博勃搏铂箔伯帛舶脖膊渤泊驳捕卜哺补埠不布步簿部怖擦猜裁材才财睬踩采彩菜蔡餐参蚕残惭惨灿苍","舱仓沧藏操糙槽曹草厕策侧册测层蹭插叉茬茶查碴搽察岔差诧拆柴豺搀掺蝉馋谗缠铲产阐颤昌猖场尝常长偿肠厂敞畅唱倡超抄钞朝嘲潮巢吵炒车扯撤掣彻澈郴臣辰尘晨忱沉陈趁衬撑称","城橙成呈乘程惩澄诚承逞骋秤吃痴持匙池迟弛驰耻齿侈尺赤翅斥炽充冲虫崇宠抽酬畴踌稠愁筹仇绸瞅丑臭初出橱厨躇锄雏滁除楚础储矗搐触处揣川穿椽传船喘串疮窗幢床闯创吹炊捶锤","垂春椿醇唇淳纯蠢戳绰疵茨磁雌辞慈瓷词此刺赐次聪葱囱匆从丛凑粗醋簇促蹿篡窜摧崔催脆瘁粹淬翠村存寸磋撮搓措挫错搭达答瘩打大呆歹傣戴带殆代贷袋待逮怠耽担丹单郸掸胆旦氮","但惮淡诞弹蛋当挡党荡档刀捣蹈倒岛祷导到稻悼道盗德得的蹬灯登等瞪凳邓堤低滴迪敌笛狄涤翟嫡抵底地蒂第帝弟递缔颠掂滇碘点典靛垫电佃甸店惦奠淀殿碉叼雕凋刁掉吊钓调跌爹碟","蝶迭谍叠丁盯叮钉顶鼎锭定订丢东冬董懂动栋侗恫冻洞兜抖斗陡豆逗痘都督毒犊独读堵睹赌杜镀肚度渡妒端短锻段断缎堆兑队对墩吨蹲敦顿囤钝盾遁掇哆多夺垛躲朵跺舵剁惰堕蛾峨鹅","俄额讹娥恶厄扼遏鄂饿恩而儿耳尔饵洱二贰发罚筏伐乏阀法珐藩帆番翻樊矾钒繁凡烦反返范贩犯饭泛坊芳方肪房防妨仿访纺放菲非啡飞肥匪诽吠肺废沸费芬酚吩氛分纷坟焚汾粉奋份忿","愤粪丰封枫蜂峰锋风疯烽逢冯缝讽奉凤佛否夫敷肤孵扶拂辐幅氟符伏俘服浮涪福袱弗甫抚辅俯釜斧脯腑府腐赴副覆赋复傅付阜父腹负富讣附妇缚咐噶嘎该改概钙盖溉干甘杆柑竿肝赶感","秆敢赣冈刚钢缸肛纲岗港杠篙皋高膏羔糕搞镐稿告哥歌搁戈鸽胳疙割革葛格蛤阁隔铬个各给根跟耕更庚羹埂耿梗工攻功恭龚供躬公宫弓巩汞拱贡共钩勾沟苟狗垢构购够辜菇咕箍估沽孤","姑鼓古蛊骨谷股故顾固雇刮瓜剐寡挂褂乖拐怪棺关官冠观管馆罐惯灌贯光广逛瑰规圭硅归龟闺轨鬼诡癸桂柜跪贵刽辊滚棍锅郭国果裹过哈骸孩海氦亥害骇酣憨邯韩含涵寒函喊罕翰撼捍","旱憾悍焊汗汉夯杭航壕嚎豪毫郝好耗号浩呵喝荷菏核禾和何合盒貉阂河涸赫褐鹤贺嘿黑痕很狠恨哼亨横衡恒轰哄烘虹鸿洪宏弘红喉侯猴吼厚候后呼乎忽瑚壶葫胡蝴狐糊湖弧虎唬护互沪","户花哗华猾滑画划化话槐徊怀淮坏欢环桓还缓换患唤痪豢焕涣宦幻荒慌黄磺蝗簧皇凰惶煌晃幌恍谎灰挥辉徽恢蛔回毁悔慧卉惠晦贿秽会烩汇讳诲绘荤昏婚魂浑混豁活伙火获或惑霍货祸","击圾基机畸稽积箕肌饥迹激讥鸡姬绩缉吉极棘辑籍集及急疾汲即嫉级挤几脊己蓟技冀季伎祭剂悸济寄寂计记既忌际妓继纪嘉枷夹佳家加荚颊贾甲钾假稼价架驾嫁歼监坚尖笺间煎兼肩艰","奸缄茧检柬碱硷拣捡简俭剪减荐槛鉴践贱见键箭件健舰剑饯渐溅涧建僵姜将浆江疆蒋桨奖讲匠酱降蕉椒礁焦胶交郊浇骄娇嚼搅铰矫侥脚狡角饺缴绞剿教酵轿较叫窖揭接皆秸街阶截劫节","桔杰捷睫竭洁结解姐戒藉芥界借介疥诫届巾筋斤金今津襟紧锦仅谨进靳晋禁近烬浸尽劲荆兢茎睛晶鲸京惊精粳经井警景颈静境敬镜径痉靖竟竞净炯窘揪究纠玖韭久灸九酒厩救旧臼舅咎","就疚鞠拘狙疽居驹菊局咀矩举沮聚拒据巨具距踞锯俱句惧炬剧捐鹃娟倦眷卷绢撅攫抉掘倔爵觉决诀绝均菌钧军君峻俊竣浚郡骏喀咖卡咯开揩楷凯慨刊堪勘坎砍看康慷糠扛抗亢炕考拷烤","靠坷苛柯棵磕颗科壳咳可渴克刻客课肯啃垦恳坑吭空恐孔控抠口扣寇枯哭窟苦酷库裤夸垮挎跨胯块筷侩快宽款匡筐狂框矿眶旷况亏盔岿窥葵奎魁傀馈愧溃坤昆捆困括扩廓阔垃拉喇蜡腊","辣啦莱来赖蓝婪栏拦篮阑兰澜谰揽览懒缆烂滥琅榔狼廊郎朗浪捞劳牢老佬姥酪烙涝勒乐雷镭蕾磊累儡垒擂肋类泪棱楞冷厘梨犁黎篱狸离漓理李里鲤礼莉荔吏栗丽厉励砾历利傈例俐痢立","粒沥隶力璃哩俩联莲连镰廉怜涟帘敛脸链恋炼练粮凉梁粱良两辆量晾亮谅撩聊僚疗燎寥辽潦了撂镣廖料列裂烈劣猎琳林磷霖临邻鳞淋凛赁吝拎玲菱零龄铃伶羚凌灵陵岭领另令溜琉榴硫","馏留刘瘤流柳六龙聋咙笼窿隆垄拢陇楼娄搂篓漏陋芦卢颅庐炉掳卤虏鲁麓碌露路赂鹿潞禄录陆戮驴吕铝侣旅履屡缕虑氯律率滤绿峦挛孪滦卵乱掠略抡轮伦仑沦纶论萝螺罗逻锣箩骡裸落","洛骆络妈麻玛码蚂马骂嘛吗埋买麦卖迈脉瞒馒蛮满蔓曼慢漫谩芒茫盲氓忙莽猫茅锚毛矛铆卯茂冒帽貌贸么玫枚梅酶霉煤没眉媒镁每美昧寐妹媚门闷们萌蒙檬盟锰猛梦孟眯醚靡糜迷谜弥","米秘觅泌蜜密幂棉眠绵冕免勉娩缅面苗描瞄藐秒渺庙妙蔑灭民抿皿敏悯闽明螟鸣铭名命谬摸摹蘑模膜磨摩魔抹末莫墨默沫漠寞陌谋牟某拇牡亩姆母墓暮幕募慕木目睦牧穆拿哪呐钠那娜","纳氖乃奶耐奈南男难囊挠脑恼闹淖呢馁内嫩能妮霓倪泥尼拟你匿腻逆溺蔫拈年碾撵捻念娘酿鸟尿捏聂孽啮镊镍涅您柠狞凝宁拧泞牛扭钮纽脓浓农弄奴努怒女暖虐疟挪懦糯诺哦欧鸥殴藕","呕偶沤啪趴爬帕怕琶拍排牌徘湃派攀潘盘磐盼畔判叛乓庞旁耪胖抛咆刨炮袍跑泡呸胚培裴赔陪配佩沛喷盆砰抨烹澎彭蓬棚硼篷膨朋鹏捧碰坯砒霹批披劈琵毗啤脾疲皮匹痞僻屁譬篇偏片","骗飘漂瓢票撇瞥拼频贫品聘乒坪苹萍平凭瓶评屏坡泼颇婆破魄迫粕剖扑铺仆莆葡菩蒲埔朴圃普浦谱曝瀑期欺栖戚妻七凄漆柒沏其棋奇歧畦崎脐齐旗祈祁骑起岂乞企启契砌器气迄弃汽泣","讫掐恰洽牵扦钎铅千迁签仟谦乾黔钱钳前潜遣浅谴堑嵌欠歉枪呛腔羌墙蔷强抢橇锹敲悄桥瞧乔侨巧鞘撬翘峭俏窍切茄且怯窃钦侵亲秦琴勤芹擒禽寝沁青轻氢倾卿清擎晴氰情顷请庆琼穷","秋丘邱球求囚酋泅趋区蛆曲躯屈驱渠取娶龋趣去圈颧权醛泉全痊拳犬券劝缺炔瘸却鹊榷确雀裙群然燃冉染瓤壤攘嚷让饶扰绕惹热壬仁人忍韧任认刃妊纫扔仍日戎茸蓉荣融熔溶容绒冗揉","柔肉茹蠕儒孺如辱乳汝入褥软阮蕊瑞锐闰润若弱撒洒萨腮鳃塞赛三叁伞散桑嗓丧搔骚扫嫂瑟色涩森僧莎砂杀刹沙纱傻啥煞筛晒珊苫杉山删煽衫闪陕擅赡膳善汕扇缮墒伤商赏晌上尚裳梢","捎稍烧芍勺韶少哨邵绍奢赊蛇舌舍赦摄射慑涉社设砷申呻伸身深娠绅神沈审婶甚肾慎渗声生甥牲升绳省盛剩胜圣师失狮施湿诗尸虱十石拾时什食蚀实识史矢使屎驶始式示士世柿事拭誓","逝势是嗜噬适仕侍释饰氏市恃室视试收手首守寿授售受瘦兽蔬枢梳殊抒输叔舒淑疏书赎孰熟薯暑曙署蜀黍鼠属术述树束戍竖墅庶数漱恕刷耍摔衰甩帅栓拴霜双爽谁水睡税吮瞬顺舜说硕","朔烁斯撕嘶思私司丝死肆寺嗣四伺似饲巳松耸怂颂送宋讼诵搜艘擞嗽苏酥俗素速粟僳塑溯宿诉肃酸蒜算虽隋随绥髓碎岁穗遂隧祟孙损笋蓑梭唆缩琐索锁所塌他它她塔獭挞蹋踏胎苔抬台","泰酞太态汰坍摊贪瘫滩坛檀痰潭谭谈坦毯袒碳探叹炭汤塘搪堂棠膛唐糖倘躺淌趟烫掏涛滔绦萄桃逃淘陶讨套特藤腾疼誊梯剔踢锑提题蹄啼体替嚏惕涕剃屉天添填田甜恬舔腆挑条迢眺跳","贴铁帖厅听烃汀廷停亭庭挺艇通桐酮瞳同铜彤童桶捅筒统痛偷投头透凸秃突图徒途涂屠土吐兔湍团推颓腿蜕褪退吞屯臀拖托脱鸵陀驮驼椭妥拓唾挖哇蛙洼娃瓦袜歪外豌弯湾玩顽丸烷完","碗挽晚皖惋宛婉万腕汪王亡枉网往旺望忘妄威巍微危韦违桅围唯惟为潍维苇萎委伟伪尾纬未蔚味畏胃喂魏位渭谓尉慰卫瘟温蚊文闻纹吻稳紊问嗡翁瓮挝蜗涡窝我斡卧握沃巫呜钨乌污诬","屋无芜梧吾吴毋武五捂午舞伍侮坞戊雾晤物勿务悟误昔熙析西硒矽晰嘻吸锡牺稀息希悉膝夕惜熄烯溪汐犀檄袭席习媳喜铣洗系隙戏细瞎虾匣霞辖暇峡侠狭下厦夏吓掀锨先仙鲜纤咸贤衔","舷闲涎弦嫌显险现献县腺馅羡宪陷限线相厢镶香箱襄湘乡翔祥详想响享项巷橡像向象萧硝霄削哮嚣销消宵淆晓小孝校肖啸笑效楔些歇蝎鞋协挟携邪斜胁谐写械卸蟹懈泄泻谢屑薪芯锌欣","辛新忻心信衅星腥猩惺兴刑型形邢行醒幸杏性姓兄凶胸匈汹雄熊休修羞朽嗅锈秀袖绣墟戌需虚嘘须徐许蓄酗叙旭序畜恤絮婿绪续轩喧宣悬旋玄选癣眩绚靴薛学穴雪血勋熏循旬询寻驯巡","殉汛训讯逊迅压押鸦鸭呀丫芽牙蚜崖衙涯雅哑亚讶焉咽阉烟淹盐严研蜒岩延言颜阎炎沿奄掩眼衍演艳堰燕厌砚雁唁彦焰宴谚验殃央鸯秧杨扬佯疡羊洋阳氧仰痒养样漾邀腰妖瑶摇尧遥窑","谣姚咬舀药要耀椰噎耶爷野冶也页掖业叶曳腋夜液一壹医揖铱依伊衣颐夷遗移仪胰疑沂宜姨彝椅蚁倚已乙矣以艺抑易邑屹亿役臆逸肄疫亦裔意毅忆义益溢诣议谊译异翼翌绎茵荫因殷音","阴姻吟银淫寅饮尹引隐印英樱婴鹰应缨莹萤营荧蝇迎赢盈影颖硬映哟拥佣臃痈庸雍踊蛹咏泳涌永恿勇用幽优悠忧尤由邮铀犹油游酉有友右佑釉诱又幼迂淤于盂榆虞愚舆余俞逾鱼愉渝渔","隅予娱雨与屿禹宇语羽玉域芋郁吁遇喻峪御愈欲狱育誉浴寓裕预豫驭鸳渊冤元垣袁原援辕园员圆猿源缘远苑愿怨院曰约越跃钥岳粤月悦阅耘云郧匀陨允运蕴酝晕韵孕匝砸杂栽哉灾宰载","再在咱攒暂赞赃脏葬遭糟凿藻枣早澡蚤躁噪造皂灶燥责择则泽贼怎增憎曾赠扎喳渣札轧铡闸眨栅榨咋乍炸诈摘斋宅窄债寨瞻毡詹粘沾盏斩辗崭展蘸栈占战站湛绽樟章彰漳张掌涨杖丈帐","账仗胀瘴障招昭找沼赵照罩兆肇召遮折哲蛰辙者锗蔗这浙珍斟真甄砧臻贞针侦枕疹诊震振镇阵蒸挣睁征狰争怔整拯正政帧症郑证芝枝支吱蜘知肢脂汁之织职直植殖执值侄址指止趾只旨","纸志挚掷至致置帜峙制智秩稚质炙痔滞治窒中盅忠钟衷终种肿重仲众舟周州洲诌粥轴肘帚咒皱宙昼骤珠株蛛朱猪诸诛逐竹烛煮拄瞩嘱主著柱助蛀贮铸筑住注祝驻抓爪拽专砖转撰赚篆桩","庄装妆撞壮状椎锥追赘坠缀谆准捉拙卓桌琢茁酌啄着灼浊兹咨资姿滋淄孜紫仔籽滓子自渍字鬃棕踪宗综总纵邹走奏揍租足卒族祖诅阻组钻纂嘴醉最罪尊遵昨左佐柞做作坐座"," 、。〃〄々〆〇〈〉《》「」『』【】〒〓〔〕〖〗〘〙〚〛〜〝〞〟〠〡〢〣〤〥〦〧〨〩〪〭〮〯〫〬〰〱〲〳〴〵〶〷〸〹〺〻〼〽〾〿!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~¢£¬ ̄¦¥₩"].join(""),Xu=256*1024,vw=2,xw={regular:{weight:"400",style:"normal"},bold:{weight:"700",style:"normal"},italic:{weight:"400",style:"italic"},boldItalic:{weight:"700",style:"italic"}};function Ji(l){return l?[l.family,...l.faces.map(n=>n.sha256),...(l.subsets||[]).map(n=>n.sha256)].join("|"):null}function ug(l){const n=l==null?void 0:l.faces.find(a=>a.style==="regular");return n?`Herdr Host ${n.sha256.slice(0,12)}`:null}function dg(l){return l?l.faces.reduce((n,a)=>n+a.bytes,0):0}function Zu(l){return l>=1024*1024?`${(l/(1024*1024)).toFixed(1)} MB`:`${Math.max(1,Math.round(l/1024))} KB`}function ww(l){if(typeof document>"u")return!1;let n=null;try{n=document.createElement("canvas").getContext("2d")}catch{return!1}if(!n)return!1;const a="mmmmmmmmmmlli10OQ@#WWww";for(const s of["serif","sans-serif"]){n.font=`72px ${s}`;const o=n.measureText(a).width;if(n.font=`72px "${l}", ${s}`,n.measureText(a).width!==o)return!0}return!1}const Sw="herdr-remote-fonts",ra="faces",oa="subsets",Rb=new Map,gd=new Map;function To(){return new Promise(l=>{if(typeof indexedDB>"u"){l(null);return}try{const n=indexedDB.open(Sw,2);n.onupgradeneeded=()=>{n.result.objectStoreNames.contains(ra)||n.result.createObjectStore(ra),n.result.objectStoreNames.contains(oa)||n.result.createObjectStore(oa)},n.onsuccess=()=>l(n.result),n.onerror=()=>l(null),n.onblocked=()=>l(null)}catch{l(null)}})}async function Cw(l){const n=Rb.get(l);if(n)return n;const a=await To();return a?new Promise(s=>{try{const o=a.transaction(ra,"readonly").objectStore(ra).get(l);o.onsuccess=()=>{const c=o.result;s(c instanceof ArrayBuffer?c:null)},o.onerror=()=>s(null)}catch{s(null)}finally{a.close()}}):null}async function Tw(l,n){Rb.set(l,n);const a=await To();a&&await new Promise(s=>{try{const o=a.transaction(ra,"readwrite");o.objectStore(ra).put(n,l),o.oncomplete=()=>s(),o.onerror=()=>s(),o.onabort=()=>s()}catch{s()}finally{a.close()}})}async function Mw(l){const n=await To();return n?new Promise(a=>{try{const s=IDBKeyRange.bound(`${l}:`,`${l}:￿`),o=n.transaction(oa,"readonly").objectStore(oa).getAll(s);o.onsuccess=()=>{const c=Array.isArray(o.result)?o.result:[];a(c.filter(h=>h&&h.data instanceof ArrayBuffer&&Array.isArray(h.codepoints)))},o.onerror=()=>a([])}catch{a([])}finally{n.close()}}):gd.get(l)??[]}async function Aw(l,n){gd.set(l,[...gd.get(l)??[],n]);const a=await To();a&&await new Promise(s=>{try{const o=a.transaction(oa,"readwrite");o.objectStore(oa).put(n,`${l}:${n.subsetSha}`),o.oncomplete=()=>s(),o.onerror=()=>s(),o.onabort=()=>s()}catch{s()}finally{a.close()}})}function Wu(l){return l?`Herdr Glyphs ${l.sha256.slice(0,12)}`:null}function Ew(l){return l>=11904&&l<=12255||l>=12288&&l<=13311||l>=13312&&l<=19903||l>=19968&&l<=40959||l>=44032&&l<=55215||l>=63744&&l<=64255||l>=65072&&l<=65103||l>=65280&&l<=65519||l>=131072&&l<=201551}function jb(l,n){return n<32||n>=127&&n<160||n>=9472&&n<=9631?!1:l==="all"||Ew(n)}function Nw(l){const n=[...new Set(l)].sort((s,o)=>s-o),a=[];for(let s=0;s<n.length;s+=1){const o=n[s];let c=o;for(;s+1<n.length&&n[s+1]===c+1;)c=n[s+1],s+=1;const h=m=>m.toString(16).toUpperCase();a.push(o===c?`U+${h(o)}`:`U+${h(o)}-${h(c)}`)}return a.join(", ")}async function kw(l,n){if(typeof FontFace>"u"||typeof document>"u"||!document.fonts)throw new Error("font_api_unavailable");const a=new FontFace(l,n.data,{weight:"400",style:"normal",unicodeRange:Nw(n.codepoints)});document.fonts.add(await a.load())}const bd=new Set;function Lw(l){return!!(l&&bd.has(l))}async function _w(l,n){if(bd.has(l))return;if(typeof FontFace>"u"||typeof document>"u"||!document.fonts)throw new Error("font_api_unavailable");const a=await Promise.all(n.map(({face:s,data:o})=>new FontFace(l,o,xw[s.style]).load()));for(const s of a)document.fonts.add(s);bd.add(l)}function fg(l){const n=atob(l),a=new Uint8Array(n.length);for(let s=0;s<n.length;s+=1)a[s]=n.charCodeAt(s);return a}async function Ob(l,n,a){const s=Math.ceil(l.bytes/Xu),o=new Uint8Array(l.bytes);let c=0;const h=async()=>{for(;c<s;){const m=c;c+=1;const p=await n(l.sha256,m),g=m*Xu,y=Math.min(Xu,l.bytes-g);if(p.length!==y)throw new Error("host_font_corrupt");o.set(p,g),a(p.length)}};return await Promise.all(Array.from({length:Math.min(vw,s)},h)),o.buffer}function Db(){try{const l=JSON.parse(xs("local",Et.hostFontConsent)||"{}");return l&&typeof l=="object"&&!Array.isArray(l)?l:{}}catch{return{}}}function hg(l,n){const a=Db()[l];return a&&a.fingerprint===n?a.decision:null}function mg(l,n,a){const s=Db();s[l]={fingerprint:n,decision:a},_i("local",Et.hostFontConsent,JSON.stringify(s))}const zb={source:null,status:"none",alias:null,covered:0},Qu={font:null,status:"none",alias:null,receivedBytes:0,totalBytes:0,error:null,glyphs:zb,interactive:!1,glyphRevision:0},Rw=String.fromCodePoint(...Array.from({length:95},(l,n)=>32+n),...Array.from({length:96},(l,n)=>160+n),...Array.from({length:112},(l,n)=>8192+n));function pg(l){const n=(l==null?void 0:l.subsets)??[];return n.find(a=>a.scope==="all")??n.find(a=>a.scope==="cjk")??null}function jw(l,n){const a=new Set;for(const s of l){const o=s.codePointAt(0);jb(n,o)&&a.add(o)}return[...a]}const gg=3e4;function Ow(l){const n=T.useRef(new Map),a=T.useRef(new Map),s=T.useRef(new Map),o=T.useCallback(m=>{for(const p of[n.current,a.current]){for(const g of p.values())clearTimeout(g.timer),g.reject(new Error(m));p.clear()}},[]),c=T.useCallback((m,p)=>new Promise((g,y)=>{if(!l){y(new Error("disconnected"));return}const v=`${m}:${p}`,x=setTimeout(()=>{n.current.delete(v),y(new Error("host_font_timeout"))},gg);n.current.set(v,{resolve:g,reject:y,timer:x}),l.sendHostFontChunkRequest(m,p)}),[l]),h=T.useCallback((m,p,g)=>new Promise((y,v)=>{if(!l){v(new Error("disconnected"));return}const x=Math.random().toString(36).slice(2,12),w=setTimeout(()=>{a.current.delete(x),v(new Error("host_font_timeout"))},gg);a.current.set(x,{resolve:S=>y({...S,codepoints:p}),reject:v,timer:w}),s.current.set(x,g),l.sendHostFontSubsetRequest(m.sha256,String.fromCodePoint(...p),x)}),[l]);return T.useEffect(()=>{if(!l)return;const m=n.current,p=a.current,g=l.on("hostFontChunk",w=>{const S=`${w.sha256}:${w.index}`,M=m.get(S);if(M){m.delete(S),clearTimeout(M.timer);try{M.resolve(fg(w.dataBase64))}catch{M.reject(new Error("host_font_corrupt"))}}}),y=l.on("hostFontSubset",w=>{const S=p.get(w.requestId);if(!S)return;p.delete(w.requestId),clearTimeout(S.timer);const M=s.current.get(w.requestId)??(()=>{});if(s.current.delete(w.requestId),w.dataBase64!==void 0){try{const L=fg(w.dataBase64);M(L.length,L.length),S.resolve({subsetSha:w.subsetSha,data:L.buffer,codepoints:[]})}catch{S.reject(new Error("host_font_corrupt"))}return}M(0,w.bytes);const N={bytes:w.bytes,sha256:w.subsetSha};Ob(N,c,L=>M(L,w.bytes)).then(L=>S.resolve({subsetSha:w.subsetSha,data:L,codepoints:[]})).catch(L=>S.reject(L instanceof Error?L:new Error("host_font_failed")))}),v=l.on("error",w=>{(w.code==="host_font_unavailable"||w.code==="host_font_subset_failed")&&o(String(w.code))}),x=l.on("stateChange",w=>{w!=="connected"&&o("disconnected")});return()=>{g(),y(),v(),x(),o("disconnected")}},[l,o,c]),{requestChunk:c,requestSubset:h,rejectPending:o}}const Dw=15e3,zw=80,Hw=2e3;function Bw(l,n={}){const[a,s]=T.useState(Qu),o=T.useRef(a);o.current=a;const c=T.useRef(n);c.current=n;const h=T.useRef(0),m=T.useRef(0),p=T.useRef(new Set),g=T.useRef(new Set),y=T.useRef(new Set),v=T.useRef(null),{requestChunk:x,requestSubset:w,rejectPending:S}=Ow(l),M=T.useCallback(()=>({isInstalled:c.current.isInstalled??ww,readCached:c.current.readCached??Cw,writeCached:c.current.writeCached??Tw,register:c.current.register??_w,isRegistered:c.current.isRegistered??Lw,readSubsets:c.current.readSubsets??Mw,writeSubset:c.current.writeSubset??Aw,registerGlyphs:c.current.registerGlyphs??kw}),[]),N=T.useCallback(()=>(l==null?void 0:l.getHostId())||"default",[l]),L=T.useCallback((K,q)=>{K===h.current&&s(te=>({...te,glyphs:{...te.glyphs,...q}}))},[]),E=T.useCallback(async(K,q,te)=>{const{registerGlyphs:Z}=M();for(const ie of te){if(await Z(q,ie),K!==h.current)return;for(const oe of ie.codepoints)p.current.add(oe)}K!==h.current||!te.length||s(ie=>({...ie,glyphs:{...ie.glyphs,alias:q,covered:p.current.size},glyphRevision:ie.glyphRevision+1}))},[M]),k=T.useCallback(async(K,q,te)=>{const Z=Wu(q),ie=q.scope==="all"?Rw+cg:cg,oe=jw(ie,q.scope).filter(A=>!p.current.has(A));if(!oe.length)return;for(const A of oe)g.current.add(A);const P=await w(q,oe,te);K===h.current&&(await M().writeSubset(q.sha256,P),await E(K,Z,[P]))},[w,M,E]),z=T.useCallback(async(K,{interactive:q=!0}={})=>{const te=K??o.current.font,Z=Ji(te);if(!te||!Z)return;const ie=o.current,oe=Ji(ie.font)===Z;if(oe&&(ie.status==="loading"||ie.glyphs.status==="loading"))return;const P=h.current,{isInstalled:A,isRegistered:G,readCached:W,writeCached:se,register:Q}=M();mg(N(),Z,"accepted");const ge=ug(te),ye=pg(te),ue=!!(ge&&!G(ge)&&!A(te.family)),Te=oe?ie.glyphs:{...zb,source:ye},ce=!!(ye&&!["installed","ready","none"].includes(Te.status));let be=ue?dg(te):0,le=0;const we=()=>{P===h.current&&s(ae=>({...ae,receivedBytes:le,totalBytes:be}))};if(s(ae=>({...ae,font:te,interactive:q,receivedBytes:0,totalBytes:be,error:null,status:ue?"loading":ae.status,glyphs:ce?{...Te,status:"loading"}:Te})),ue&&ge)try{const ae=[];for(const ve of te.faces){let Ne=await W(ve.sha256);if(Ne?(le+=ve.bytes,we()):(Ne=await Ob(ve,x,Ie=>{le+=Ie,we()}),await se(ve.sha256,Ne)),P!==h.current)return;ae.push({face:ve,data:Ne})}if(await Q(ge,ae),P!==h.current)return;s(ve=>({...ve,status:"loaded",alias:ge}))}catch(ae){if(P!==h.current)return;const ve=ae instanceof Error&&ae.message?ae.message:"host_font_failed";s(Ne=>({...Ne,status:"failed",alias:null,error:ve}))}if(ce&&ye){let ae=0;try{await k(P,ye,(ve,Ne)=>{Ne&&!ae&&(ae=Ne,be+=Ne),le+=ve,we()}),L(P,{status:"ready"})}catch(ve){if(P!==h.current)return;const Ne=ve instanceof Error&&ve.message?ve.message:"host_font_failed";s(Ie=>({...Ie,error:Ie.error??Ne,glyphs:{...Ie.glyphs,status:"failed"}}))}}},[x,k,M,N,L]),R=T.useCallback(async K=>{const q=Ji(K)!==Ji(o.current.font);q&&(S("superseded"),p.current=new Set,g.current=new Set,y.current=new Set);const te=++h.current;if(!K){s(Qu);return}const{isInstalled:Z,readCached:ie,register:oe,isRegistered:P,readSubsets:A}=M(),G=ug(K),W=Ji(K),se=pg(K);let Q="checking";G&&P(G)?Q="loaded":Z(K.family)?Q="installed":G||(Q="unavailable");let ge="checking";if(se?(se.scope==="cjk"?Z(se.family):Q==="installed")&&(ge="installed"):ge="none",s(ce=>({...Qu,font:K,status:Q==="checking"?"checking":Q,alias:Q==="loaded"?G:null,totalBytes:dg(K),glyphs:{source:se,status:ge,alias:q?null:ce.glyphs.alias,covered:p.current.size},glyphRevision:ce.glyphRevision})),Q==="checking"&&G){const ce=await Promise.all(K.faces.map(be=>ie(be.sha256)));if(te!==h.current)return;if(Q="needs",ce.every(Boolean))try{if(await oe(G,K.faces.map((be,le)=>({face:be,data:ce[le]}))),te!==h.current)return;Q="loaded",s(be=>({...be,status:"loaded",alias:G}))}catch{}}if(ge==="checking"&&se){const ce=await A(se.sha256);if(te!==h.current)return;if(ce.length)try{await E(te,Wu(se),ce),ge="cached"}catch{ge="needs"}else ge="needs";if(te!==h.current)return}const ye=hg(N(),W),ue=ye==="accepted"||ge==="cached"||Date.now()<m.current;if(ge==="cached"&&(ge="ready",L(te,{status:"ready"}),k(te,se,()=>{}).catch(()=>{})),Q!=="needs"&&ge!=="needs")return;if(ue){z(K,{interactive:!1});return}const Te=ye==="declined"?"declined":"available";s(ce=>({...ce,status:Q==="needs"?Te:ce.status,glyphs:ge==="needs"?{...ce.glyphs,status:Te}:ce.glyphs}))},[z,S,N,L,k,M,E]),D=T.useCallback(()=>{const K=Ji(o.current.font);K&&mg(N(),K,"declined"),s(q=>({...q,interactive:!1,status:["available","failed"].includes(q.status)?"declined":q.status,glyphs:["available","failed"].includes(q.glyphs.status)?{...q.glyphs,status:"declined"}:q.glyphs}))},[N]),j=T.useCallback(()=>{m.current=Date.now()+Dw,l==null||l.sendHostFontRefresh();const K=o.current,q=["available","declined","failed"];K.font&&(q.includes(K.status)||q.includes(K.glyphs.status))&&z(K.font,{interactive:!1})},[l,z]),H=T.useCallback(K=>{const{glyphs:q}=o.current;if(q.status!=="ready"||!q.source)return;const te=q.source;for(const Z of K){const ie=Z.codePointAt(0);ie<128&&te.scope!=="all"||jb(te.scope,ie)&&(p.current.has(ie)||g.current.has(ie)||y.current.add(ie))}!y.current.size||v.current||(v.current=setTimeout(()=>{v.current=null;const Z=h.current,ie=[...y.current].slice(0,Hw);for(const oe of ie)y.current.delete(oe),g.current.add(oe);(async()=>{const oe=await w(te,ie,()=>{});Z===h.current&&(await M().writeSubset(te.sha256,oe),await E(Z,Wu(te),[oe]))})().catch(()=>{})},zw))},[w,M,E]);return T.useEffect(()=>{if(!l)return;const K=l.on("terminalFont",q=>{R(q)});return()=>{K(),v.current&&clearTimeout(v.current),v.current=null}},[l,R]),T.useEffect(()=>{const K=q=>{if(q.key!==Et.hostFontConsent)return;const te=o.current,Z=Ji(te.font),ie=te.status==="available"||te.glyphs.status==="available";if(!Z||!ie)return;const oe=hg(N(),Z);oe==="accepted"?z(te.font,{interactive:!1}):oe==="declined"&&D()};return window.addEventListener("storage",K),()=>window.removeEventListener("storage",K)},[z,D,N]),{hostFont:a,loadHostFont:z,declineHostFont:D,syncHostFont:j,ensureHostGlyphs:H}}function Uw(l,n=window,a=document){const s=g=>{var y;((y=n.navigator)==null?void 0:y.onLine)!==!1&&l.wake(g)},o=()=>{a.visibilityState==="visible"&&s("visible")},c=()=>s("pageshow"),h=()=>s("online"),m=()=>s("focus"),p=()=>s("resume");return a.addEventListener("visibilitychange",o),a.addEventListener("resume",p),n.addEventListener("pageshow",c),n.addEventListener("online",h),n.addEventListener("focus",m),()=>{a.removeEventListener("visibilitychange",o),a.removeEventListener("resume",p),n.removeEventListener("pageshow",c),n.removeEventListener("online",h),n.removeEventListener("focus",m)}}function Vr(l){return{wsUrl:l.wsUrl,token:l.token||void 0,pairCode:l.pairCode||void 0,clientId:l.clientId,autoReconnect:l.autoReconnect,reconnectIntervalMs:2e3,maxReconnectAttempts:0,pingIntervalMs:1e4}}function bg(l,n){return n||(l==="win32"?"powershell":"posix")}function Kw(l,n){if(n!=="win32")return n?"posix":null;for(const a of l.slice(-8).reverse()){if(/\b(?:MINGW32|MINGW64|MSYS)\b/i.test(a))return"git-bash";if(/^\s*PS\s+[a-z]:\\[^>]*>/i.test(a))return"powershell";if(/^\s*(?:[a-z]:\\[^>]*|\\\\[^\\]+\\[^>]+)>/i.test(a))return"cmd"}return null}function Iw(l){return l==="cmd"?["dir","cls","git status","cd","tasklist","exit","type"]:l==="powershell"?["Get-ChildItem","Clear-Host","git status","Get-Location","Get-Process","exit","Get-Content"]:["ls -la","clear","git status","pwd","top","exit","cat"]}const Fw={connectionState:"disconnected",role:"viewer",shellProfile:"posix",hostPalette:null,rttMs:null,sharedWindowCount:1,terminalResetVersion:0,agentStatus:null,lastPairedAt:null},yg={role:"viewer",controllerId:void 0,hostname:void 0,platform:void 0,adminTerminalSupported:void 0,hostVersion:void 0,herdrPrefixKeys:void 0,shellProfile:"posix",hostPalette:null,rttMs:null,sharedWindowCount:1};function Gw(l,n){switch(n.type){case"stateChange":return{...l,connectionState:n.state,stateCode:n.code,stateDetail:n.detail,agentStatus:n.state==="connected"?l.agentStatus:null};case"ready":{const{message:a}=n;return{...l,terminalResetVersion:l.terminalResetVersion+(n.resetTerminal?1:0),role:a.role,controllerId:a.controllerId,hostId:a.hostId,hostname:a.hostname,platform:a.platform,adminTerminalSupported:a.adminTerminalSupported,hostVersion:a.hostVersion,herdrPrefixKeys:a.herdrPrefixKeys,shellProfile:bg(a.platform,a.shellProfile),assignedClientId:a.clientId||l.assignedClientId,hostPalette:a.terminalPalette||null}}case"hostReconnecting":return{...l,...yg,stateCode:n.code,stateDetail:n.detail};case"sessionRestarted":return{...l,hostname:n.hostname,platform:n.platform,adminTerminalSupported:n.adminTerminalSupported,hostVersion:n.hostVersion,herdrPrefixKeys:n.herdrPrefixKeys,shellProfile:bg(n.platform,n.shellProfile),hostPalette:n.palette||null,terminalResetVersion:l.terminalResetVersion+1};case"roleChange":return{...l,role:n.role,controllerId:n.controllerId,hostId:n.hostId||l.hostId,assignedClientId:n.assignedClientId||l.assignedClientId};case"controlGranted":return{...l,role:"controller"};case"paired":return{...l,lastPairedAt:n.at};case"rtt":return{...l,rttMs:n.rttMs};case"peerCount":return{...l,sharedWindowCount:Math.max(1,n.count)};case"sessionReady":return{...l,connectionState:"connected"};case"agentStatus":return{...l,agentStatus:n.status};case"shellProfile":return l.shellProfile===n.profile?l:{...l,shellProfile:n.profile};case"reset":return{...l,...yg,hostId:void 0,platform:void 0,assignedClientId:void 0,terminalResetVersion:l.terminalResetVersion+(n.resetTerminal?1:0)}}}const Yw=3e4;function Pw(l,n){const[a,s]=T.useState(null),o=T.useRef(null),c=T.useRef(null),h=T.useCallback(y=>{(y==null?void 0:y.phase)!=="starting"&&c.current&&(clearTimeout(c.current),c.current=null),o.current=y,s(y)},[]),m=T.useCallback(()=>{const y=l.current;y&&(h({phase:"starting"}),y.sendHerdrStart(),c.current=setTimeout(()=>{var v;c.current=null,((v=o.current)==null?void 0:v.phase)==="starting"&&h({phase:"failed",message:n.current("herdrLaunch.timeout")})},Yw))},[l,n,h]),p=T.useCallback(y=>{var v;return y.code==="herdr_not_running"?(((v=o.current)==null?void 0:v.phase)!=="starting"&&h({phase:"stopped"}),!0):y.code==="herdr_start_failed"&&o.current?(h({phase:"failed",message:y.message||""}),!0):!1},[h]),g=T.useCallback(()=>h(null),[h]);return T.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]),{herdrLaunch:a,startHerdr:m,handleLaunchError:p,forgetHerdrLaunch:g}}class $w{constructor(){$(this,"listeners",{stateChange:new Set,roleChange:new Set,ready:new Set,paired:new Set,controlState:new Set,sessionReady:new Set,exit:new Set,controlGranted:new Set,peerCount:new Set,hostReconnecting:new Set,sessionRestarted:new Set,error:new Set,binaryData:new Set,rttUpdate:new Set,pasteFileReady:new Set,agentStatus:new Set,updateStatus:new Set,terminalFont:new Set,hostFontChunk:new Set,hostFontSubset:new Set})}on(n,a){return this.listeners[n].add(a),()=>{this.listeners[n].delete(a)}}emit(n,...a){this.listeners[n].forEach(o=>{try{o(...a)}catch(c){console.error(`Error in event listener for ${n}:`,c)}})}}const Hb=27,Bb=91,Vw=60,vg=59,Ub=77,Kb=48,qw=57,Xw=64,Zw=-30,Ju=32,xg=255;function Ib(l){return Number.isInteger(l)&&(l&Zw)===Xw}function Ww(l){return l>=Kb&&l<=qw}function ed(l,n){let a=n,s=0;for(;a<l.length&&Ww(l[a]);){if(s=s*10+(l[a]-Kb),s>65535)return null;a+=1}return a===n?null:{value:s,next:a}}function Qw(l,n){if(l[n]!==Hb||l[n+1]!==Bb||l[n+2]!==Vw)return-1;const a=ed(l,n+3);if(!a||!Ib(a.value)||l[a.next]!==vg)return-1;const s=ed(l,a.next+1);if(!s||l[s.next]!==vg)return-1;const o=ed(l,s.next+1);return!o||l[o.next]!==Ub?-1:o.next+1}function Jw(l,n){if(l[n]!==Hb||l[n+1]!==Bb||l[n+2]!==Ub||n+6>l.length)return-1;const a=l[n+3]-Ju,s=l[n+4],o=l[n+5];return!Ib(a)||s<Ju||s>xg||o<Ju||o>xg?-1:n+6}function mo(l){if(!l)return!1;const n=l instanceof Uint8Array?l:new Uint8Array(l);if(n.length===0)return!1;let a=0;for(;a<n.length;){const s=Qw(n,a);if(s>a){a=s;continue}const o=Jw(n,a);if(o>a){a=o;continue}return!1}return!0}class e1{constructor(n){$(this,"segments",[]);$(this,"flushScheduled",!1);this.getSocket=n}push(n){const a=n instanceof Uint8Array?n:new Uint8Array(n);a.length!==0&&(this.segments.push(a),this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flush())))}flush(){if(this.flushScheduled=!1,this.segments.length===0)return;let n=this.segments;this.segments=[];const a=this.getSocket();if(a&&(a.bufferedAmount??0)>256*1024&&(n=n.filter(o=>!mo(o))),n.length===0)return;let s;if(n.length===1)s=n[0];else{let o=0;for(let h=0;h<n.length;h++)o+=n[h].byteLength;s=new Uint8Array(o);let c=0;for(let h=0;h<n.length;h++)s.set(n[h],c),c+=n[h].byteLength}a&&a.readyState===WebSocket.OPEN&&a.send(s)}clear(){this.segments=[],this.flushScheduled=!1}}const t1=3e3,n1=1e4,i1=1500;class l1 extends $w{constructor(a){super();$(this,"ws",null);$(this,"config");$(this,"state","disconnected");$(this,"reconnectAttempts",0);$(this,"reconnectTimer",null);$(this,"pingTimer",null);$(this,"pingTimestamp",null);$(this,"lastInboundAt",0);$(this,"pingSentAt",null);$(this,"connectStartedAt",0);$(this,"lastWakeConnectAt",0);$(this,"probeTimer",null);$(this,"rejectedByRelay",!1);$(this,"isManuallyClosed",!1);$(this,"authFailureDetail",null);$(this,"authFailureCode",null);$(this,"temporaryFailureCode",null);$(this,"input",new e1(()=>this.ws));$(this,"terminalCols",80);$(this,"terminalRows",24);this.config={...a}}updateConfig(a){this.config={...this.config,...a}}getConfig(){return{...this.config}}getState(){return this.state}setState(a,s,o){this.state!==a&&(this.state=a,this.emit("stateChange",a,s,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 s=a1(this.config.wsUrl),o=new WebSocket(s);this.ws=o,this.connectStartedAt=Date.now(),o.binaryType="arraybuffer",o.onopen=()=>{this.isStaleSocket(o)||this.handleOpen()},o.onmessage=c=>{this.isStaleSocket(o)||this.handleMessage(c)},o.onerror=c=>{this.isStaleSocket(o)||this.handleError(c)},o.onclose=c=>{this.isStaleSocket(o)||this.handleClose(c)}}catch(s){this.setState("error",s instanceof Error?s.message:"Connection failed","connection_failed"),this.scheduleReconnect()}}}isStaleSocket(a){return this.ws!==a}teardownSocket(a=1e3,s="Client closed the connection"){this.input.clear();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,s)}catch{}}}disconnect(){this.isManuallyClosed=!0,this.clearTimers(),this.input.clear(),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 s=Date.now(),o=this.ws;if(!o){if(s-this.lastWakeConnectAt<i1)return;this.lastWakeConnectAt=s,this.reconnectAttempts=0,this.connect();return}if(o.readyState===WebSocket.CONNECTING){s-this.connectStartedAt>n1&&this.dropStaleSocket("connection_stalled");return}o.readyState===WebSocket.OPEN&&s-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 s=Date.now();this.sendPing(),this.probeTimer=setTimeout(()=>{this.probeTimer=null,this.ws===a&&this.lastInboundAt<s&&this.dropStaleSocket("connection_stale")},t1)}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 s=JSON.parse(a.data);s.type==="pong"?this.handlePong():this.handleServerMessage(s)}catch(s){console.warn("Received unparseable text frame from server:",s)}else if(a.data instanceof ArrayBuffer)this.emit("binaryData",new Uint8Array(a.data));else if(typeof Blob<"u"&&a.data instanceof Blob)try{const s=await a.data.arrayBuffer();this.emit("binaryData",new Uint8Array(s))}catch(s){console.error("Failed to convert Blob to ArrayBuffer:",s)}}handlePong(){if(this.pingTimestamp){const a=Math.max(0,performance.now()-this.pingTimestamp);this.pingTimestamp=null,this.emit("rttUpdate",Math.round(a))}}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*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)}sendPing(){this.pingTimestamp=performance.now(),this.pingSentAt=Date.now();const a={type:"ping"};this.sendJson(a)}sendJson(a){this.flushInput(),this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify(a))}sendInput(a){this.input.push(a)}flushInput(){this.input.flush()}sendBinary(a){this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(a)}sendText(a){const s=Dd(a);this.sendInput(s)}}function a1(l){if(/^wss?:\/\//i.test(l))return l;if(/^https?:\/\//i.test(l)){const n=new URL(l);return n.protocol=n.protocol==="https:"?"wss:":"ws:",(!n.pathname||n.pathname==="/")&&(n.pathname=Rt),n.toString()}if(typeof window<"u"&&window.location){const a=window.location.protocol==="https:"?"wss:":"ws:",s=window.location.host,o=l.startsWith("/")?l:`/${l}`;return`${a}//${s}${o}`}return"ws://127.0.0.1:8787/ws/client"}class s1 extends l1{constructor(){super(...arguments);$(this,"currentRole","viewer");$(this,"controllerId");$(this,"hostId");$(this,"assignedClientId")}getRole(){return this.currentRole}getControllerId(){return this.controllerId}getHostId(){return this.hostId}getAssignedClientId(){return this.assignedClientId}handleServerMessage(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),this.emit("terminalFont",a.terminalFont??null);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,a.platform,a.shellProfile,a.adminTerminalSupported,a.hostVersion,a.herdrPrefixKeys),this.emit("terminalFont",a.terminalFont??null);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"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"paste_file_ready":{this.emit("pasteFileReady",a.path);break}case"agent_status":{this.emit("agentStatus",a);break}case"update_status":{this.emit("updateStatus",a);break}case"terminal_font":{this.emit("terminalFont",a.terminalFont??null);break}case"host_font_chunk":{this.emit("hostFontChunk",a);break}case"host_font_subset_ready":{this.emit("hostFontSubset",a);break}}}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 s={type:"claim_control",...a?{force:!0}:{}};this.sendJson(s)}releaseControl(){const a={type:"release_control"};this.sendJson(a)}sendResize(a,s){this.terminalCols=a,this.terminalRows=s;const o={type:"resize",cols:a,rows:s};this.sendJson(o)}sendPasteFile(a,s){this.sendJson({type:"paste_file",mime:a,dataBase64:s})}sendHostFontChunkRequest(a,s){this.sendJson({type:"host_font_chunk_request",sha256:a,index:s})}sendHostFontSubsetRequest(a,s,o){this.sendJson({type:"host_font_subset_request",sha256:a,text:s,requestId:o})}sendHostFontRefresh(){this.sendJson({type:"host_font_refresh"})}sendHerdrStart(){this.sendJson({type:"herdr_start"})}sendAdminTabOpen(){this.sendJson({type:"admin_tab_open"})}}function r1(l,n,a){const s=T.useRef(a);if(s.current=a,!l.current){const o=new s1(n());for(const c of Object.keys(a)){const h=(...m)=>{var p,g;return(g=(p=s.current)[c])==null?void 0:g.call(p,...m)};o.on(c,h)}l.current=o}return l.current}const o1=3*1024*1024,Fb=1568,c1=[.85,.7,.55,.4],qr={active:!1,phase:"idle",ratio:0,percent:0,statusText:""};function u1(l,n,a=Fb){if(l<=0||n<=0)return{width:Math.max(1,l),height:Math.max(1,n)};const s=Math.max(l,n);if(s<=a)return{width:l,height:n};const o=a/s;return{width:Math.max(1,Math.round(l*o)),height:Math.max(1,Math.round(n*o))}}function d1(l){if(typeof l!="string"||l.length===0)return 0;const n=l.length;let a=0;l.endsWith("==")?a=2:l.endsWith("=")&&(a=1);const s=Math.floor(n*3/4)-a;return Number.isFinite(s)&&s>0?s:0}function f1(l){return l<1024?`${l} B`:l<1024*1024?`${(l/1024).toFixed(1)} KB`:`${(l/(1024*1024)).toFixed(1)} MB`}async function h1(l){if(typeof createImageBitmap=="function")try{const n=await createImageBitmap(l,{imageOrientation:"from-image"});return{source:n,width:n.width,height:n.height,cleanup:()=>{typeof n.close=="function"&&n.close()}}}catch{try{const n=await createImageBitmap(l);return{source:n,width:n.width,height:n.height,cleanup:()=>{typeof n.close=="function"&&n.close()}}}catch{}}return new Promise((n,a)=>{if(typeof Image>"u")return a(new Error("Image decoding not supported in this environment"));const s=new Image,o=URL.createObjectURL(l);s.onload=()=>{n({source:s,width:s.naturalWidth||s.width,height:s.naturalHeight||s.height,cleanup:()=>{try{URL.revokeObjectURL(o)}catch{}}})},s.onerror=()=>{try{URL.revokeObjectURL(o)}catch{}a(new Error("Failed to decode image source"))},s.src=o})}async function Gb(l,n=Fb,a=o1){var o;if(!l||l.size===0||l.type&&!l.type.startsWith("image/"))return null;let s;try{s=await h1(l)}catch(c){return console.warn("Failed to decode image for paste:",c),null}try{const{width:c,height:h}=u1(s.width,s.height,n),m=document.createElement("canvas");m.width=c,m.height=h;const p=m.getContext("2d");if(!p)return null;p.drawImage(s.source,0,0,c,h);let g="image/webp";try{m.toDataURL("image/webp",.85).startsWith("data:image/webp")||(g="image/jpeg")}catch{g="image/jpeg"}for(const y of c1){let v;try{v=m.toDataURL(g,y)}catch{continue}if(!(v!=null&&v.startsWith("data:")))continue;const x=v.indexOf(","),w=x!==-1?v.slice(x+1):"",S=d1(w);if(S<=a)return{mime:g,dataBase64:w,dataUrl:v,byteLength:S,width:c,height:h}}return null}finally{(o=s.cleanup)==null||o.call(s)}}const m1=3e4,p1=1200;function g1({adapterRef:l,role:n,connectionState:a,warnViewerMode:s,addToast:o,t:c,sendPasteFile:h}){const[m,p]=T.useState(qr),g=T.useRef(null),y=T.useRef(0),v=T.useRef(null),x=T.useCallback(()=>{v.current&&(clearTimeout(v.current),v.current=null)},[]),w=T.useCallback(()=>{x(),g.current=null,p(qr)},[x]),S=T.useCallback(()=>{g.current!==null&&w()},[w]),M=T.useCallback(()=>{const L=g.current;L!==null&&(x(),p({active:!0,phase:"completed",ratio:1,percent:100,statusText:c("virtualKeyboard.uploadProgressCompleted")}),setTimeout(()=>{g.current===L&&(g.current=null,p(qr))},p1))},[x,c]);T.useEffect(()=>{a!=="connected"&&S()},[a,S]),T.useEffect(()=>x,[x]);const N=T.useCallback(async L=>{if(n!=="controller")return s(),!1;if(!l.current||a!=="connected")return o("error",c("serverErrors.host_offline")),!1;if(g.current!==null)return!1;const E=++y.current;g.current=E,x();const k=R=>(R&&o("error",R),g.current=null,p(qr),!1),z="dataBase64"in L&&typeof L.dataBase64=="string";try{let R;if(z)R=L;else{const j=L;if(p({active:!0,phase:"reading",ratio:.1,percent:10,statusText:c("virtualKeyboard.uploadProgressReading")}),!j||j.size===0)return k(c("clipboard.fileEmpty"));if(j.type&&!j.type.startsWith("image/"))return k(c("clipboard.unsupportedType"));p({active:!0,phase:"processing",ratio:.35,percent:35,statusText:c("virtualKeyboard.uploadProgressProcessing")});const H=await Gb(j);if(g.current!==E)return!1;if(!H)return k(c("clipboard.imageTooLarge"));R=H,p({active:!0,phase:"processing",ratio:.6,percent:60,statusText:c("virtualKeyboard.uploadProgressProcessing")})}p({active:!0,phase:"sending",ratio:.75,percent:75,statusText:c("virtualKeyboard.uploadProgressSending")});const D=h(R.mime,R.dataBase64);return g.current!==E?!1:D?(p({active:!0,phase:"waitingHost",ratio:.88,percent:88,statusText:c("virtualKeyboard.uploadProgressWaitingHost")}),v.current=setTimeout(()=>{g.current===E&&k(c("serverErrors.paste_file_write_failed"))},m1),!0):k()}catch(R){return console.error("Failed to process/upload image:",R),g.current===E&&k(c("clipboard.imageTooLarge")),!1}},[l,n,a,s,o,c,h,x]);return{uploadProgress:m,uploadImage:N,resetUploadProgress:w,abortUpload:S,completeUpload:M}}const b1=4096,y1=8*1024*1024;function v1(){const l=T.useRef(null),n=T.useRef([]),a=T.useRef(0),s=T.useCallback(p=>{for(n.current.push(p),a.current+=p.byteLength;n.current.length>b1||a.current>y1;){const g=n.current.shift();if(!g)break;a.current-=g.byteLength}},[]),o=T.useCallback(p=>{const g=l.current;if(g)try{g(p);return}catch(y){console.debug("Terminal output sink threw, buffering chunk instead:",y)}s(p)},[s]),c=T.useCallback(p=>{l.current=p;const g=n.current;n.current=[],a.current=0;for(let y=0;y<g.length;y++)try{p(g[y])}catch(v){console.debug("Terminal sink threw while flushing, re-buffering the tail:",v);for(let x=y;x<g.length;x++)s(g[x]);break}return()=>{l.current===p&&(l.current=null)}},[s]),h=T.useCallback(()=>n.current.length,[]),m=T.useCallback(()=>{n.current=[],a.current=0},[]);return{receiveOutput:o,subscribeToOutput:c,getPendingOutputChunkCount:h,clearPendingOutput:m}}const wg=["fontSize","fontSizeFollowsHost","fontFamily","toolbarVisible","toolbarPosition","vibrateOnKeyPress","predictiveEcho","virtualKeys","agentAlertBadge","agentAlertSound","agentAlertVibrate","agentAlertNotify"],x1=["agentKeymaps"],w1=64;function S1(l,n){const a=l,s={};for(const o of n)a[o]!==void 0&&(s[o]=a[o]);return s}function ia(l,n){return S1(l,n==="local"?[...wg,...x1]:wg)}function po(l,n,a){const s=Object.create(null);if(!l||typeof l!="object"||Array.isArray(l))return s;for(const[o,c]of Object.entries(l).slice(0,w1))(o===""?n.length>0:!n.includes(o))||!c||typeof c!="object"||Array.isArray(c)||(s[o]=ia(c,a));return s}const Yb=64,ws=4096;function Bd(){const l=Math.random().toString(36).substring(2,10);return`profile-${Date.now().toString(36)}-${l}`}function C1(l,n){return(typeof l=="string"?l.trim().slice(0,Yb):"")||n}function go(l,n){if(!l||typeof l!="object"||Array.isArray(l))return null;const a=l,s=typeof a.wsUrl=="string"?a.wsUrl.trim().slice(0,2048):"",o=typeof a.token=="string"?a.token.slice(0,ws):"",c=typeof a.pairCode=="string"?a.pairCode.trim().toUpperCase().slice(0,32):"";if(!s||!s.startsWith("/")&&!/^(?:wss?|https?):\/\//i.test(s)||!o&&!c)return null;const h=Date.now(),m=typeof a.id=="string"&&a.id.length>0?a.id.slice(0,128):Bd(),p=typeof a.hostname=="string"&&a.hostname.trim()?a.hostname.trim().slice(0,Yb):`Herdr ${n+1}`;return{id:m,displayName:C1(a.displayName,p),wsUrl:s,token:o,...c?{pairCode:c}:{},...typeof a.hostId=="string"&&a.hostId.trim()?{hostId:a.hostId.trim().slice(0,128)}:{},...typeof a.hostname=="string"&&a.hostname.trim()?{hostname:a.hostname.trim().slice(0,128)}:{},...typeof a.deviceId=="string"&&a.deviceId.trim()?{deviceId:a.deviceId.trim().slice(0,128)}:{},autoReconnect:a.autoReconnect!==!1,createdAt:Number.isFinite(a.createdAt)?Number(a.createdAt):h,lastUsedAt:Number.isFinite(a.lastUsedAt)?Number(a.lastUsedAt):h}}function Sg(l,n=0){const a=go({...l,id:l.id||Bd()},n);if(!a)throw new Error("a connection profile requires a relay URL and token or pairing code");return a}function Cg(l){let n=l.wsUrl.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"").toLowerCase();if(typeof window<"u")try{const a=new URL(l.wsUrl,window.location.origin);a.protocol=a.protocol==="wss:"?"https:":"http:",a.pathname=a.pathname.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"")||"/",a.search="",a.hash="",n=a.toString().replace(/\/$/,"").toLowerCase()}catch{}return`${n}::${l.hostId||""}`}function Pb(l){var c;const n=[];if((Array.isArray(l.profiles)?l.profiles.slice(0,64):[]).forEach((h,m)=>{const p=go(h,m);p&&!n.some(g=>g.id===p.id)&&n.push(p)}),n.length===0&&(typeof l.token=="string"&&l.token||typeof l.pairCode=="string"&&l.pairCode)){const h=go({id:"profile-migrated",displayName:"Herdr 1",wsUrl:typeof l.wsUrl=="string"&&l.wsUrl.trim()?l.wsUrl:Rt,token:l.token||"",pairCode:l.pairCode||"",autoReconnect:l.autoReconnect!==!1},0);h&&n.push(h)}const s=typeof l.activeProfileId=="string"?l.activeProfileId:"",o=n.some(h=>h.id===s)?s:((c=n[0])==null?void 0:c.id)||"";return{profiles:n,activeProfileId:o}}const $b=[{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"}],T1=[{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 Ss(){return JSON.parse(JSON.stringify($b))}const M1=[["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 A1(l){return M1.some(n=>l.length===n.length&&l.every((a,s)=>a.id===n[s]&&a.enabled!==!1))}function E1(l){if(!Array.isArray(l)||l.length===0)return Ss();const n=l.filter(a=>typeof a=="object"&&a!==null&&typeof a.id=="string"&&typeof a.label=="string"&&typeof a.code=="string");return A1(n)?Ss():n.filter(a=>a.id!=="drawer_agent")}function yd(l,n){if(n){const a=`keyTitles.${l.id}`,s=n(a);if(s&&s!==a)return s}return l.title||l.label}const Tg="herdr-remote.ignoredUpdate";function N1(){const l=xs("local",Et.ignoredUpdate);if(l!==null)return l;const n=xs("local",Tg);if(n===null)return null;Vb(n);try{window.localStorage.removeItem(Tg)}catch{}return n}function Vb(l){_i("local",Et.ignoredUpdate,l)}function k1(){return`client-${Math.random().toString(36).substring(2,8)}`}function qb(){return typeof navigator<"u"&&navigator.language&&navigator.language.toLowerCase().startsWith("zh")?"zh":"en"}function Xb(){const l=typeof window<"u"&&window.innerWidth<640;return{wsUrl:Rt,token:"",pairCode:"",clientId:k1(),autoReconnect:!0,profiles:[],activeProfileId:"",fontSize:l?fo:vs,fontSizeFollowsHost:!0,fontFamily:Lb,toolbarVisible:!0,toolbarPosition:"bottom",vibrateOnKeyPress:!0,predictiveEcho:"auto",agentAlertBadge:!0,agentAlertSound:!1,agentAlertVibrate:!1,agentAlertNotify:!1,language:qb(),virtualKeys:Ss(),agentKeymaps:{},observerMode:!1,adminToken:"",adminTokens:{}}}const L1=["wsUrl","token","pairCode","clientId","autoReconnect","language"],_1=["wsUrl","token","pairCode","autoReconnect"],Mg=["theme","colorMode"];function Zb(l){const n=l;if(!Mg.some(o=>n[o]!==void 0))return{data:l,changed:!1};const s={...n};for(const o of Mg)delete s[o];return{data:s,changed:!0}}function Wb(l){if(!l||typeof l!="object"||Array.isArray(l))return{};const n={};for(const[a,s]of Object.entries(l).slice(0,32))typeof s!="string"||s.length===0||(n[a.slice(0,512)]=s.slice(0,ws));return n}function bo(l,n){const a=xs(l,n);if(!a)return{};try{const s=JSON.parse(a);return s&&typeof s=="object"&&!Array.isArray(s)?s:{}}catch(s){return console.warn(`Failed to parse ${l}Storage settings:`,s),{}}}function yo(){const l=Xb();if(typeof window>"u")return l;let n=bo("local",Et.settings);const a=Zb(n);a.changed&&(n=a.data,_i("local",Et.settings,JSON.stringify(n)));const s=bo("session",Et.sessionView),o=Pb(n),c=o.profiles.map(te=>te.id),h=typeof s.activeProfileId=="string"&&c.includes(s.activeProfileId)?s.activeProfileId:o.activeProfileId,m=o.profiles.find(te=>te.id===h),p={...ia(n,"local"),...po(n.instances,c,"local")[h]},g=po(s.instances,c,"session");let y=g[h];y||(y=ia({...p,...ia(s,"session")},"session"),g[h]=y,_i("session",Et.sessionView,JSON.stringify({activeProfileId:h,instances:g,observerMode:s.observerMode,adminToken:s.adminToken,adminTokens:s.adminTokens})));const v={...p,...y},x=qu(v.fontFamily??l.fontFamily),w=window.innerWidth<640?fo:vs,S=v.fontSize??l.fontSize,M=sa(S,w),N=v.fontSizeFollowsHost,L=typeof N=="boolean"?N:M===vs||M===fo,E=E1(v.virtualKeys??l.virtualKeys),k=n.language??l.language,z=k==="zh"||k==="en"?k:qb(),R=te=>{const Z=v[te];return typeof Z=="boolean"?Z:l[te]},D=v.predictiveEcho??l.predictiveEcho,j=D==="always"||D==="off"||D==="auto"?D:"auto",H=typeof s.adminToken=="string"?s.adminToken.slice(0,ws):typeof n.adminToken=="string"?n.adminToken.slice(0,ws):l.adminToken,K=Wb(s.adminTokens),q={...l,wsUrl:(m==null?void 0:m.wsUrl)||(typeof n.wsUrl=="string"?n.wsUrl:l.wsUrl),token:(m==null?void 0:m.token)||"",pairCode:(m==null?void 0:m.pairCode)||"",autoReconnect:(m==null?void 0:m.autoReconnect)??l.autoReconnect,profiles:o.profiles,activeProfileId:h,clientId:typeof n.clientId=="string"&&n.clientId.trim()?n.clientId.trim().slice(0,128):l.clientId,fontFamily:x,fontSize:M,fontSizeFollowsHost:L,toolbarVisible:v.toolbarVisible??l.toolbarVisible,toolbarPosition:v.toolbarPosition??l.toolbarPosition,vibrateOnKeyPress:v.vibrateOnKeyPress??l.vibrateOnKeyPress,predictiveEcho:j,virtualKeys:E,agentKeymaps:kb(v.agentKeymaps),agentAlertBadge:R("agentAlertBadge"),agentAlertSound:R("agentAlertSound"),agentAlertVibrate:R("agentAlertVibrate"),agentAlertNotify:R("agentAlertNotify"),language:z,observerMode:s.observerMode===!0,adminToken:H,adminTokens:K};return typeof n.fontFamily=="string"&&qu(n.fontFamily)!==n.fontFamily&&(n.fontFamily=qu(n.fontFamily),_i("local",Et.settings,JSON.stringify(n))),q}function Ei(l){var M;const n=yo(),a={...n,...l};a.agentKeymaps=kb(a.agentKeymaps),a.adminTokens=Wb(a.adminTokens),typeof a.adminToken=="string"&&(a.adminToken=a.adminToken.slice(0,ws)),l.fontSize!==void 0&&(a.fontSize=sa(l.fontSize)),l.predictiveEcho!==void 0&&(l.predictiveEcho==="auto"||l.predictiveEcho==="always"||l.predictiveEcho==="off"?a.predictiveEcho=l.predictiveEcho:a.predictiveEcho="auto");const s=Pb(a);let o=s.profiles,c=s.activeProfileId;if(_1.some(N=>l[N]!==void 0)){const N=o.findIndex(k=>k.id===c),L=N>=0?{...o[N]}:{id:Bd(),displayName:`Herdr ${o.length+1}`,wsUrl:a.wsUrl,token:"",autoReconnect:!0,createdAt:Date.now(),lastUsedAt:Date.now()};L.wsUrl=a.wsUrl,L.token=a.token,L.pairCode=a.pairCode||void 0,L.autoReconnect=a.autoReconnect,L.lastUsedAt=Date.now();const E=go(L,Math.max(N,0));E?N>=0?o[N]=E:(o.push(E),c=E.id):N>=0&&(o=o.filter(k=>k.id!==c),c=((M=o[0])==null?void 0:M.id)||"")}o.length>0&&!o.some(N=>N.id===c)&&(c=o[0].id);const m=o.find(N=>N.id===c);a.wsUrl=(m==null?void 0:m.wsUrl)||a.wsUrl||Rt,a.token=(m==null?void 0:m.token)||"",a.pairCode=(m==null?void 0:m.pairCode)||"",a.autoReconnect=(m==null?void 0:m.autoReconnect)??a.autoReconnect;const p=o.map(N=>N.id),g=Zb(bo("local",Et.settings)).data,y=bo("session",Et.sessionView),v=po(g.instances,p,"local"),x=po(y.instances,p,"session"),S=c===n.activeProfileId||!n.activeProfileId?a:l;v[c]={...v[c],...ia(S,"local")},x[c]={...x[c],...ia(S,"session")};for(const N of L1)a[N]!==void 0&&(g[N]=a[N]);return g.profiles=o,g.instances=v,(c!==n.activeProfileId||!p.includes(g.activeProfileId??""))&&(g.activeProfileId=c),_i("local",Et.settings,JSON.stringify(g)),_i("session",Et.sessionView,JSON.stringify({activeProfileId:c,instances:x,observerMode:a.observerMode===!0,adminToken:a.adminToken,adminTokens:a.adminTokens})),yo()}function R1(l){const[n,a]=T.useState(yo),s=T.useRef(n);s.current=n;const o=T.useRef(l);o.current=l;const c=T.useCallback(w=>{const S=Ei(w);s.current=S,a(S)},[]),h=T.useCallback(w=>{s.current=w,a(w)},[]),m=T.useCallback(w=>{const S=s.current,M=Sg({...w,wsUrl:w.wsUrl||Rt,token:w.token||"",displayName:w.displayName||`Herdr ${S.profiles.length+1}`,autoReconnect:w.autoReconnect!==!1},S.profiles.length),N=Ei({profiles:[...S.profiles,M],activeProfileId:M.id,wsUrl:M.wsUrl,token:M.token,pairCode:M.pairCode||"",autoReconnect:M.autoReconnect});h(N),o.current(N)},[h]),p=T.useCallback(w=>{const S=s.current,M=S.profiles.find(L=>L.id===w);if(!M||M.id===S.activeProfileId)return;const N=Ei({activeProfileId:M.id,wsUrl:M.wsUrl,token:M.token,pairCode:M.pairCode||"",autoReconnect:M.autoReconnect,profiles:S.profiles.map(L=>L.id===M.id?{...L,lastUsedAt:Date.now()}:L)});h(N),o.current(N)},[h]),g=T.useCallback((w,S)=>{const M=s.current;if(!M.profiles.find(k=>k.id===w))return;const L=S.trim().slice(0,64);if(!L)return;const E=Ei({profiles:M.profiles.map(k=>k.id===w?{...k,displayName:L}:k)});h(E)},[h]),y=T.useCallback(w=>{const S=s.current;if(!S.profiles.some(E=>E.id===w))return;const M=S.profiles.filter(E=>E.id!==w),N=M.find(E=>E.id===S.activeProfileId)||M[0],L=Ei(N?{profiles:M,activeProfileId:N.id,wsUrl:N.wsUrl,token:N.token,pairCode:N.pairCode||"",autoReconnect:N.autoReconnect}:{profiles:[],activeProfileId:"",wsUrl:Rt,token:"",pairCode:""});h(L),w===S.activeProfileId&&o.current(L)},[h]),v=T.useCallback(w=>{const S=s.current,M=S.profiles.find(H=>H.id===S.activeProfileId),N=w.hostId?Cg({wsUrl:S.wsUrl,hostId:w.hostId}):null,L=N?S.profiles.findIndex(H=>Cg(H)===N):-1,E=L>=0?L:Math.max(0,S.profiles.findIndex(H=>H.id===S.activeProfileId)),z={...S.profiles[E]||M||Sg({wsUrl:S.wsUrl||Rt,token:"",pairCode:S.pairCode||"PENDING",displayName:`Herdr ${S.profiles.length+1}`},S.profiles.length),token:w.token,pairCode:void 0,...w.hostId?{hostId:w.hostId}:{},...w.deviceId?{deviceId:w.deviceId}:{},lastUsedAt:Date.now()};let R=[...S.profiles];E>=0&&E<R.length?R[E]=z:R.push(z);const D=M==null?void 0:M.id;R=R.filter((H,K)=>K===E||H.id===z.id?!0:!(L>=0&&D&&H.id===D));const j=Ei({profiles:R,activeProfileId:z.id,wsUrl:z.wsUrl,token:z.token,pairCode:"",autoReconnect:z.autoReconnect});return h(j),j},[h]),x=T.useCallback(w=>{const S=s.current,M=S.profiles.find(k=>k.id===S.activeProfileId);if(!M||!w.hostId&&!w.hostname)return;const N=/^Herdr \d+$/.test(M.displayName),L={...M,...w.hostId?{hostId:w.hostId}:{},...w.hostname?{hostname:w.hostname}:{},...w.hostname&&N?{displayName:w.hostname}:{}},E=Ei({profiles:S.profiles.map(k=>k.id===M.id?L:k)});h(E)},[h]);return{settings:n,updateSettings:c,addProfileAndConnect:m,switchProfile:p,renameProfile:g,removeProfile:y,savePairedProfile:v,noteReadyProfile:x}}const Xr={ctrl:!1,alt:!1,shift:!1};function j1({adapterRef:l,role:n,addToast:a,tRef:s}){const[o,c]=T.useState({cols:80,rows:24}),h=T.useRef(o);h.current=o;const m=T.useRef(new Set),p=T.useRef(new Set),g=T.useRef(!0);T.useEffect(()=>{n==="controller"&&(g.current=!0)},[n]);const y=T.useCallback(()=>{g.current&&(g.current=!1,a("warning",s.current("toasts.viewerModeWarning")))},[a,s]),v=T.useCallback(j=>{if(n!=="controller"){y();return}const H=l.current;if(!H)return;const K=Dd(j);for(const q of p.current)try{q(K)}catch(te){console.debug("Key input observer threw:",te)}H.sendInput(K)},[l,n,y]),x=T.useCallback(j=>(p.current.add(j),()=>{p.current.delete(j)}),[]),[w,S]=T.useState(Xr),M=T.useRef(Xr),N=T.useCallback(j=>{const H={...M.current,[j]:!M.current[j]};M.current=H,S(H)},[]),L=T.useCallback(()=>{const j=M.current;return!j.ctrl&&!j.alt&&!j.shift?null:(M.current=Xr,S(Xr),j)},[]),E=T.useCallback(j=>{var H;n!=="controller"&&!mo(j)||(H=l.current)==null||H.sendInput(j)},[l,n]),k=T.useCallback((j,H)=>{var K;h.current={cols:j,rows:H},c({cols:j,rows:H}),(K=l.current)==null||K.sendResize(j,H)},[l]),z=T.useCallback((j,H)=>n!=="controller"?(y(),!1):l.current?(l.current.sendPasteFile(j,H),!0):!1,[l,n,y]),R=T.useCallback(j=>(m.current.add(j),()=>{m.current.delete(j)}),[]),D=T.useCallback(j=>{for(const H of m.current)try{H(j)}catch(K){console.error("Error in pasteFileReady listener:",K)}},[]);return{terminalDimensions:o,dimensionsRef:h,warnViewerMode:y,sendKey:v,observeKeyInput:x,modifierLatch:w,toggleModifierLatch:N,consumeModifierLatch:L,sendBinary:E,sendResize:k,sendPasteFile:z,subscribeToPasteFileReady:R,notifyPasteFileReady:D}}const O1=4e3,D1=3;function z1(){const[l,n]=T.useState([]),a=T.useRef([]),s=T.useRef(new Map),o=T.useCallback(m=>{a.current=m,n(m)},[]),c=T.useCallback(m=>{const p=s.current.get(m);p&&(clearTimeout(p),s.current.delete(m)),o(a.current.filter(g=>g.id!==m))},[o]),h=T.useCallback((m,p)=>{const g=Date.now(),y=a.current,v=y.find(M=>M.type===m&&M.message===p),x=v?v.id:`${g}-${Math.random().toString(36).substring(2,6)}`;let w;if(v)w=y.map(M=>M.id===x?{...M,count:M.count+1,timestamp:g}:M);else for(w=[...y,{id:x,type:m,message:p,timestamp:g,count:1}];w.length>D1;){const[M,...N]=w,L=s.current.get(M.id);L&&(clearTimeout(L),s.current.delete(M.id)),w=N}o(w);const S=s.current.get(x);S&&clearTimeout(S),s.current.set(x,setTimeout(()=>c(x),O1))},[o,c]);return T.useEffect(()=>{const m=s.current;return()=>{for(const p of m.values())clearTimeout(p);m.clear()}},[]),{toasts:l,addToast:h,removeToast:c}}function H1(l,n){const[a,s]=T.useState(null),[o,c]=T.useState(N1),h=T.useRef(o),m=T.useRef(new Set),p=T.useCallback(x=>{h.current=x,c(x),Vb(x)},[]),g=T.useCallback(x=>{if(s(x),!x.updateAvailable||h.current===x.latest)return;const w=`${x.latest}:${x.restartPending?"restart":"update"}`;m.current.has(w)||(m.current.add(w),l("info",x.restartPending?n.current("update.toastRestart",{version:x.latest}):n.current("update.toast",{version:x.latest})))},[l,n]),y=T.useCallback(()=>s(null),[]),v=T.useCallback((x,w)=>{if(x!==null)return;const S=`outdated:${w||""}`;m.current.has(S)||(m.current.add(S),l("warning",n.current("update.toastOutdated",{host:w||n.current("update.thisHost")})))},[l,n]);return{updateStatus:a,ignoredUpdate:o,ignoreUpdate:p,receiveUpdateStatus:g,forgetUpdateStatus:y,noteHostVersion:v}}const Qb=T.createContext(null),Jb=T.createContext(null),ey=T.createContext(null),ty=T.createContext(null),ny=T.createContext(null),B1=({children:l})=>{var Os;const[n,a]=T.useReducer(Gw,Fw),s=T.useRef(null),o=T.useRef(!1);T.useEffect(()=>{_b()},[]);const{receiveOutput:c,subscribeToOutput:h,getPendingOutputChunkCount:m,clearPendingOutput:p}=v1(),{toasts:g,addToast:y,removeToast:v}=z1(),x=T.useCallback(()=>{p(),a({type:"reset",resetTerminal:!0})},[p]),{settings:w,updateSettings:S,addProfileAndConnect:M,switchProfile:N,renameProfile:L,removeProfile:E,savePairedProfile:k,noteReadyProfile:z}=R1(de=>{var qe;x(),(qe=s.current)==null||qe.reconnectWith(Vr(de))}),R=T.useCallback((de,qe)=>Od(w.language,de,qe),[w.language]),D=T.useRef(R);D.current=R;const{herdrLaunch:j,startHerdr:H,handleLaunchError:K,forgetHerdrLaunch:q}=Pw(s,D),{updateStatus:te,ignoredUpdate:Z,ignoreUpdate:ie,receiveUpdateStatus:oe,forgetUpdateStatus:P,noteHostVersion:A}=H1(y,D),G=w.observerMode?"viewer":n.role,W=j1({adapterRef:s,role:G,addToast:y,tRef:D}),{uploadProgress:se,uploadImage:Q,resetUploadProgress:ge,abortUpload:ye,completeUpload:ue}=g1({adapterRef:s,role:G,connectionState:n.connectionState,warnViewerMode:W.warnViewerMode,addToast:y,t:R,sendPasteFile:W.sendPasteFile}),Te=r1(s,()=>Vr(w),{stateChange:(de,qe,Lt)=>{const It=Vu(Lt)?R(`serverErrors.${Lt}`):qe;a({type:"stateChange",state:de,detail:It,code:Lt}),de==="connected"?y("success",R("toasts.connected")):de==="error"&&y("error",It||R("toasts.connectionError")),de!=="connected"&&q()},ready:de=>{const qe=o.current;qe&&p(),o.current=!0,q(),P(),a({type:"ready",message:de,resetTerminal:qe}),z(de),A(de.hostVersion,de.hostname||de.hostId)},hostReconnecting:de=>{a({type:"hostReconnecting",code:de||"host_reconnecting",detail:R(`serverErrors.${Vu(de)?de:"host_reconnecting"}`)}),p()},sessionRestarted:(de,qe,Lt,It,cl,Ln,ul,ni,ko)=>{var ga;p(),a({type:"sessionRestarted",hostname:It,palette:Lt,platform:cl,shellProfile:Ln,adminTerminalSupported:ul,hostVersion:ni,herdrPrefixKeys:ko}),A(ni,It),z({hostId:(ga=s.current)==null?void 0:ga.getHostId(),hostname:It})},roleChange:(de,qe,Lt,It)=>{a({type:"roleChange",role:de,controllerId:qe,hostId:Lt,assignedClientId:It})},controlGranted:()=>{a({type:"controlGranted"}),y("success",R("toasts.controlGranted"))},paired:de=>{var Lt;const qe=k(de);y("success",R("toasts.pairedSuccess")),a({type:"paired",at:Date.now()}),(Lt=s.current)==null||Lt.reconnectWith(Vr(qe))},exit:(de,qe)=>{y("info",`${R("toasts.sessionEnded")}${qe?`: ${qe}`:""}${de!=null?` (${de})`:""}`)},error:de=>{if(K(de)||de.code==="host_font_unavailable")return;ye();const qe=Vu(de.code)?R(`serverErrors.${de.code}`):de.message||`[${de.code}]`;y("error",qe)},pasteFileReady:de=>{ue(),W.notifyPasteFileReady(de)},rttUpdate:de=>a({type:"rtt",rttMs:de}),peerCount:de=>a({type:"peerCount",count:de}),sessionReady:()=>{a({type:"sessionReady"}),q()},agentStatus:de=>a({type:"agentStatus",status:de}),updateStatus:oe,binaryData:c}),{activeProfileId:ce}=w,be=w.profiles.find(de=>de.id===ce),{hostFont:le,loadHostFont:we,declineHostFont:ae,syncHostFont:ve,ensureHostGlyphs:Ne}=Bw(Te),Ie=T.useCallback(()=>{we()},[we]),Xe=bw(w.fontFamily,le.font?{family:le.font.family,alias:le.status==="loaded"?le.alias:null,glyphs:le.glyphs.source?{family:le.glyphs.source.family,scope:le.glyphs.source.scope,alias:le.glyphs.alias}:null}:null),tt=w.fontSizeFollowsHost&&((Os=le.font)!=null&&Os.sizePx)?sa(le.font.sizePx,w.fontSize):w.fontSize;T.useEffect(()=>{document.documentElement.style.setProperty("--tui-font",Xe)},[Xe]),T.useEffect(()=>{var de;(de=s.current)==null||de.updateConfig(Vr(w))},[w]),T.useEffect(()=>{const de=s.current;return de?Uw(de):void 0},[]);const{dimensionsRef:xe}=W,Ae=T.useCallback(de=>{s.current&&(de&&s.current.updateConfig(de),s.current.connect(xe.current))},[xe]),rt=T.useCallback(()=>{var de;(de=s.current)==null||de.disconnect()},[]),it=T.useCallback((de=!1)=>{var qe;(qe=s.current)==null||qe.claimControl(de)},[]),bt=T.useCallback(()=>{var de;(de=s.current)==null||de.releaseControl()},[]),yn=T.useCallback(de=>S({language:de}),[S]),vn=T.useMemo(()=>({settings:w,updateSettings:S,language:w.language,setLanguage:yn,t:R,profiles:w.profiles,activeProfileId:ce,activeProfile:be,switchProfile:N,addProfileAndConnect:M,renameProfile:L,removeProfile:E,hostFont:le,loadHostFont:Ie,declineHostFont:ae,syncHostFont:ve,ensureHostGlyphs:Ne,terminalFontFamily:Xe,terminalFontSize:tt}),[w,S,yn,R,ce,be,N,M,L,E,le,Ie,ae,ve,Ne,Xe,tt]),kn=T.useMemo(()=>{var de;return{...n,role:G,isController:G==="controller",agentProfile:Zx((de=n.agentStatus)==null?void 0:de.focusedAgent,"auto"),reportShellProfile:qe=>a({type:"shellProfile",profile:qe}),adapter:Te,connect:Ae,disconnect:rt,claimControl:it,releaseControl:bt,herdrLaunch:j,startHerdr:H,updateStatus:te,ignoredUpdate:Z,ignoreUpdate:ie}},[n,G,Te,Ae,rt,it,bt,j,H,te,Z,ie]),Zt=T.useMemo(()=>({toasts:g,addToast:y,removeToast:v}),[g,y,v]),{terminalDimensions:ut,sendKey:Ls,observeKeyInput:ha,modifierLatch:ma,toggleModifierLatch:Di,consumeModifierLatch:_s,sendBinary:pa,sendResize:Rs,warnViewerMode:js,sendPasteFile:ti,subscribeToPasteFileReady:At}=W,xn=T.useMemo(()=>({terminalDimensions:ut,sendKey:Ls,observeKeyInput:ha,modifierLatch:ma,toggleModifierLatch:Di,consumeModifierLatch:_s,sendBinary:pa,sendResize:Rs,warnViewerMode:js,sendPasteFile:ti,subscribeToPasteFileReady:At,subscribeToOutput:h,getPendingOutputChunkCount:m}),[ut,Ls,ha,ma,Di,_s,pa,Rs,js,ti,At,h,m]),kt=T.useMemo(()=>({uploadProgress:se,uploadImage:Q,resetUploadProgress:ge}),[se,Q,ge]);return f.jsx(Qb.Provider,{value:vn,children:f.jsx(Jb.Provider,{value:kn,children:f.jsx(ey.Provider,{value:Zt,children:f.jsx(ty.Provider,{value:xn,children:f.jsx(ny.Provider,{value:kt,children:l})})})})})};function Es(l,n){const a=T.useContext(l);if(!a)throw new Error(`${n} must be used within a TerminalProvider`);return a}const Ee=()=>Es(Qb,"useSettings"),et=()=>Es(Jb,"useConnection"),Xt=()=>Es(ey,"useToasts"),Ns=()=>Es(ty,"useTerminalIO"),Mo=()=>Es(ny,"useUpload");function Cs(l){var n,a;return l?{blocked:((n=l.counts)==null?void 0:n.blocked)??0,done:((a=l.counts)==null?void 0:a.done)??0}:null}function U1(l){return l?l.blocked>0?"blocked":l.done>0?"done":null:null}function K1(l){if(!l)return"";const n=[];return l.blocked>0&&n.push(`${l.blocked}⚠`),l.done>0&&n.push(`${l.done}✓`),n.length>0?`(${n.join(" ")})`:""}function I1(l,n){if(!l||!n)return null;const a=new Map(l.agents.map(h=>[h.paneId,h.status]));let s=null;for(const h of n.agents)if(!(h.status!=="blocked"&&h.status!=="done")&&a.get(h.paneId)!==h.status){if(h.status==="blocked")return"blocked";s="done"}const o=Cs(l),c=Cs(n);return c.blocked>o.blocked?"blocked":(!s&&c.done>o.done&&(s="done"),s)}const F1={blocked:"%23f9e2af",done:"%23a6e3a1"};function G1(l){return`<circle cx='19' cy='5' r='4.5' fill='${F1[l]}' stroke='%2311111b' stroke-width='1.5'/>`}function Y1(l,n){return!n||!l.includes("</svg>")?l:l.replace("</svg>",`${G1(n)}</svg>`)}function Ag(l,n=document){const a=n.querySelector('link[rel~="icon"]');if(!a)return;a.dataset.baseHref===void 0&&(a.dataset.baseHref=a.getAttribute("href")??"");const s=Y1(a.dataset.baseHref,l);a.getAttribute("href")!==s&&a.setAttribute("href",s)}let on=null;function P1(){if(typeof window>"u")return null;const l=window;return l.AudioContext??l.webkitAudioContext??null}function iy(){const l=P1();if(l)try{on=on??new l,on.state==="suspended"&&on.resume()}catch{on=null}}function $1(l=window){const n=()=>{iy(),a()},a=()=>{l.removeEventListener("pointerdown",n),l.removeEventListener("keydown",n)};return l.addEventListener("pointerdown",n),l.addEventListener("keydown",n),a}const V1={blocked:[880,660],done:[660,880]};function ly(l){if((on==null?void 0:on.state)==="running")try{const n=on.currentTime;V1[l].forEach((a,s)=>{const o=on.createOscillator(),c=on.createGain(),h=n+s*.11;o.type="sine",o.frequency.value=a,c.gain.setValueAtTime(1e-4,h),c.gain.exponentialRampToValueAtTime(.06,h+.01),c.gain.exponentialRampToValueAtTime(1e-4,h+.09),o.connect(c),c.connect(on.destination),o.start(h),o.stop(h+.1)})}catch{}}const q1=15e3,X1={blocked:[70,50,70],done:[40]};function Z1(){const{settings:l,t:n}=Ee(),{agentStatus:a}=et(),s=T.useRef(l);s.current=l;const o=T.useRef(n);o.current=n;const c=T.useRef(null),h=T.useRef(Number.NEGATIVE_INFINITY);T.useEffect(()=>{Ag(l.agentAlertBadge?U1(Cs(a)):null)},[a,l.agentAlertBadge]),T.useEffect(()=>()=>Ag(null),[]),T.useEffect(()=>{if(!(!l.agentAlertSound||typeof window>"u"))return $1(window)},[l.agentAlertSound]),T.useEffect(()=>{const m=c.current;c.current=a;const p=I1(m,a);if(!p)return;const g=Date.now();if(g-h.current<q1)return;h.current=g;const y=s.current,v=typeof document<"u"&&document.visibilityState==="hidden",x=v||typeof document<"u"&&!document.hasFocus();if(y.agentAlertVibrate&&!v&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(X1[p])}catch{}if(y.agentAlertSound&&x&&ly(p),y.agentAlertNotify&&v&&typeof window<"u"&&window.isSecureContext&&"Notification"in window&&Notification.permission==="granted"){const w=Cs(a),S=p==="blocked"?o.current("agents.notifyBlocked",{count:w.blocked}):o.current("agents.notifyDone",{count:w.done});try{new Notification("Herdr Remote",{body:S,tag:"herdr-agents"})}catch{}}},[a])}function ay(l){var n,a,s="";if(typeof l=="string"||typeof l=="number")s+=l;else if(typeof l=="object")if(Array.isArray(l)){var o=l.length;for(n=0;n<o;n++)l[n]&&(a=ay(l[n]))&&(s&&(s+=" "),s+=a)}else for(a in l)l[a]&&(s&&(s+=" "),s+=a);return s}function W1(){for(var l,n,a=0,s="",o=arguments.length;a<o;a++)(l=arguments[a])&&(n=ay(l))&&(s&&(s+=" "),s+=n);return s}const Q1=(l,n)=>{const a=new Array(l.length+n.length);for(let s=0;s<l.length;s++)a[s]=l[s];for(let s=0;s<n.length;s++)a[l.length+s]=n[s];return a},J1=(l,n)=>({classGroupId:l,validator:n}),sy=(l=new Map,n=null,a)=>({nextPart:l,validators:n,classGroupId:a}),vo="-",Eg=[],eS="arbitrary..",tS=l=>{const n=iS(l),{conflictingClassGroups:a,conflictingClassGroupModifiers:s}=l;return{getClassGroupId:h=>{if(h.startsWith("[")&&h.endsWith("]"))return nS(h);const m=h.split(vo),p=m[0]===""&&m.length>1?1:0;return ry(m,p,n)},getConflictingClassGroupIds:(h,m)=>{if(m){const p=s[h],g=a[h];return p?g?Q1(g,p):p:g||Eg}return a[h]||Eg}}},ry=(l,n,a)=>{if(l.length-n===0)return a.classGroupId;const o=l[n],c=a.nextPart.get(o);if(c){const g=ry(l,n+1,c);if(g)return g}const h=a.validators;if(h===null)return;const m=n===0?l.join(vo):l.slice(n).join(vo),p=h.length;for(let g=0;g<p;g++){const y=h[g];if(y.validator(m))return y.classGroupId}},nS=l=>l.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const n=l.slice(1,-1),a=n.indexOf(":"),s=n.slice(0,a);return s?eS+s:void 0})(),iS=l=>{const{theme:n,classGroups:a}=l;return lS(a,n)},lS=(l,n)=>{const a=sy();for(const s in l){const o=l[s];Ud(o,a,s,n)}return a},Ud=(l,n,a,s)=>{const o=l.length;for(let c=0;c<o;c++){const h=l[c];aS(h,n,a,s)}},aS=(l,n,a,s)=>{if(typeof l=="string"){sS(l,n,a);return}if(typeof l=="function"){rS(l,n,a,s);return}oS(l,n,a,s)},sS=(l,n,a)=>{const s=l===""?n:oy(n,l);s.classGroupId=a},rS=(l,n,a,s)=>{if(cS(l)){Ud(l(s),n,a,s);return}n.validators===null&&(n.validators=[]),n.validators.push(J1(a,l))},oS=(l,n,a,s)=>{const o=Object.entries(l),c=o.length;for(let h=0;h<c;h++){const[m,p]=o[h];Ud(p,oy(n,m),a,s)}},oy=(l,n)=>{let a=l;const s=n.split(vo),o=s.length;for(let c=0;c<o;c++){const h=s[c];let m=a.nextPart.get(h);m||(m=sy(),a.nextPart.set(h,m)),a=m}return a},cS=l=>"isThemeGetter"in l&&l.isThemeGetter===!0,uS=l=>{if(l<1)return{get:()=>{},set:()=>{}};let n=0,a=Object.create(null),s=Object.create(null);const o=(c,h)=>{a[c]=h,n++,n>l&&(n=0,s=a,a=Object.create(null))};return{get(c){let h=a[c];if(h!==void 0)return h;if((h=s[c])!==void 0)return o(c,h),h},set(c,h){c in a?a[c]=h:o(c,h)}}},vd="!",Ng=":",dS=[],kg=(l,n,a,s,o)=>({modifiers:l,hasImportantModifier:n,baseClassName:a,maybePostfixModifierPosition:s,isExternal:o}),fS=l=>{const{prefix:n,experimentalParseClassName:a}=l;let s=o=>{const c=[];let h=0,m=0,p=0,g;const y=o.length;for(let M=0;M<y;M++){const N=o[M];if(h===0&&m===0){if(N===Ng){c.push(o.slice(p,M)),p=M+1;continue}if(N==="/"){g=M;continue}}N==="["?h++:N==="]"?h--:N==="("?m++:N===")"&&m--}const v=c.length===0?o:o.slice(p);let x=v,w=!1;v.endsWith(vd)?(x=v.slice(0,-1),w=!0):v.startsWith(vd)&&(x=v.slice(1),w=!0);const S=g&&g>p?g-p:void 0;return kg(c,w,x,S)};if(n){const o=n+Ng,c=s;s=h=>h.startsWith(o)?c(h.slice(o.length)):kg(dS,!1,h,void 0,!0)}if(a){const o=s;s=c=>a({className:c,parseClassName:o})}return s},hS=l=>{const n=new Map;return l.orderSensitiveModifiers.forEach((a,s)=>{n.set(a,1e6+s)}),a=>{const s=[];let o=[];for(let c=0;c<a.length;c++){const h=a[c],m=h[0]==="[",p=n.has(h);m||p?(o.length>0&&(o.sort(),s.push(...o),o=[]),s.push(h)):o.push(h)}return o.length>0&&(o.sort(),s.push(...o)),s}},mS=l=>({cache:uS(l.cacheSize),parseClassName:fS(l),sortModifiers:hS(l),postfixLookupClassGroupIds:pS(l),...tS(l)}),pS=l=>{const n=Object.create(null),a=l.postfixLookupClassGroups;if(a)for(let s=0;s<a.length;s++)n[a[s]]=!0;return n},gS=/\s+/,bS=(l,n)=>{const{parseClassName:a,getClassGroupId:s,getConflictingClassGroupIds:o,sortModifiers:c,postfixLookupClassGroupIds:h}=n,m=[],p=l.trim().split(gS);let g="";for(let y=p.length-1;y>=0;y-=1){const v=p[y],{isExternal:x,modifiers:w,hasImportantModifier:S,baseClassName:M,maybePostfixModifierPosition:N}=a(v);if(x){g=v+(g.length>0?" "+g:g);continue}let L=!!N,E;if(L){const j=M.substring(0,N);E=s(j);const H=E&&h[E]?s(M):void 0;H&&H!==E&&(E=H,L=!1)}else E=s(M);if(!E){if(!L){g=v+(g.length>0?" "+g:g);continue}if(E=s(M),!E){g=v+(g.length>0?" "+g:g);continue}L=!1}const k=w.length===0?"":w.length===1?w[0]:c(w).join(":"),z=S?k+vd:k,R=z+E;if(m.indexOf(R)>-1)continue;m.push(R);const D=o(E,L);for(let j=0;j<D.length;++j){const H=D[j];m.push(z+H)}g=v+(g.length>0?" "+g:g)}return g},yS=(...l)=>{let n=0,a,s,o="";for(;n<l.length;)(a=l[n++])&&(s=cy(a))&&(o&&(o+=" "),o+=s);return o},cy=l=>{if(typeof l=="string")return l;let n,a="";for(let s=0;s<l.length;s++)l[s]&&(n=cy(l[s]))&&(a&&(a+=" "),a+=n);return a},Lg=(l,...n)=>{let a,s,o,c;const h=p=>{const g=n.reduce((y,v)=>v(y),l());return a=mS(g),s=a.cache.get,o=a.cache.set,c=m,m(p)},m=p=>{const g=s(p);if(g)return g;const y=bS(p,a);return o(p,y),y};return c=h,(...p)=>c(yS(...p))},vS=[],gt=l=>{const n=a=>a[l]||vS;return n.isThemeGetter=!0,n},uy=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,dy=/^\((?:(\w[\w-]*):)?(.+)\)$/i,xS=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,wS=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,SS=/\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$/,CS=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,TS=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,MS=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ni=l=>xS.test(l),Re=l=>!!l&&!Number.isNaN(Number(l)),Mn=l=>!!l&&Number.isInteger(Number(l)),td=l=>l.endsWith("%")&&Re(l.slice(0,-1)),Xn=l=>wS.test(l),fy=()=>!0,AS=l=>SS.test(l)&&!CS.test(l),Kd=()=>!1,ES=l=>TS.test(l),NS=l=>MS.test(l),kS=l=>!fe(l)&&!he(l),LS=l=>l.startsWith("@container")&&(l[10]==="/"&&l[11]!==void 0||l[11]==="s"&&l[16]!==void 0&&l.startsWith("-size/",10)||l[11]==="n"&&l[18]!==void 0&&l.startsWith("-normal/",10)),_S=l=>Oi(l,py,Kd),fe=l=>uy.test(l),el=l=>Oi(l,gy,AS),_g=l=>Oi(l,US,Re),RS=l=>Oi(l,yy,fy),jS=l=>Oi(l,by,Kd),Rg=l=>Oi(l,hy,Kd),OS=l=>Oi(l,my,NS),Zr=l=>Oi(l,vy,ES),he=l=>dy.test(l),us=l=>ol(l,gy),DS=l=>ol(l,by),jg=l=>ol(l,hy),zS=l=>ol(l,py),HS=l=>ol(l,my),Wr=l=>ol(l,vy,!0),BS=l=>ol(l,yy,!0),Oi=(l,n,a)=>{const s=uy.exec(l);return s?s[1]?n(s[1]):a(s[2]):!1},ol=(l,n,a=!1)=>{const s=dy.exec(l);return s?s[1]?n(s[1]):a:!1},hy=l=>l==="position"||l==="percentage",my=l=>l==="image"||l==="url",py=l=>l==="length"||l==="size"||l==="bg-size",gy=l=>l==="length",US=l=>l==="number",by=l=>l==="family-name",yy=l=>l==="number"||l==="weight",vy=l=>l==="shadow",Og=()=>{const l=gt("color"),n=gt("font"),a=gt("text"),s=gt("font-weight"),o=gt("tracking"),c=gt("leading"),h=gt("breakpoint"),m=gt("container"),p=gt("spacing"),g=gt("radius"),y=gt("shadow"),v=gt("inset-shadow"),x=gt("text-shadow"),w=gt("drop-shadow"),S=gt("blur"),M=gt("perspective"),N=gt("aspect"),L=gt("ease"),E=gt("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],z=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],R=()=>[...z(),he,fe],D=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto","contain","none"],H=()=>[he,fe,p],K=()=>[Ni,"full","auto",...H()],q=()=>[Mn,"none","subgrid",he,fe],te=()=>["auto",{span:["full",Mn,he,fe]},Mn,he,fe],Z=()=>[Mn,"auto",he,fe],ie=()=>["auto","min","max","fr",he,fe],oe=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],P=()=>["start","end","center","stretch","center-safe","end-safe"],A=()=>["auto",...H()],G=()=>[Ni,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...H()],W=()=>[Ni,"screen","full","dvw","lvw","svw","min","max","fit",...H()],se=()=>[Ni,"screen","full","lh","dvh","lvh","svh","min","max","fit",...H()],Q=()=>[l,he,fe],ge=()=>[...z(),jg,Rg,{position:[he,fe]}],ye=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ue=()=>["auto","cover","contain",zS,_S,{size:[he,fe]}],Te=()=>[td,us,el],ce=()=>["","none","full",g,he,fe],be=()=>["",Re,us,el],le=()=>["solid","dashed","dotted","double"],we=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ae=()=>[Re,td,jg,Rg],ve=()=>["","none",S,he,fe],Ne=()=>["none",Re,he,fe],Ie=()=>["none",Re,he,fe],Xe=()=>[Re,he,fe],tt=()=>[Ni,"full",...H()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Xn],breakpoint:[Xn],color:[fy],container:[Xn],"drop-shadow":[Xn],ease:["in","out","in-out"],font:[kS],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Xn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Xn],shadow:[Xn],spacing:["px",Re],text:[Xn],"text-shadow":[Xn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ni,fe,he,N]}],container:["container"],"container-type":[{"@container":["","normal","size",he,fe]}],"container-named":[LS],columns:[{columns:[Re,fe,he,m]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"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:R()}],overflow:[{overflow:D()}],"overflow-x":[{"overflow-x":D()}],"overflow-y":[{"overflow-y":D()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:K()}],"inset-x":[{"inset-x":K()}],"inset-y":[{"inset-y":K()}],start:[{"inset-s":K(),start:K()}],end:[{"inset-e":K(),end:K()}],"inset-bs":[{"inset-bs":K()}],"inset-be":[{"inset-be":K()}],top:[{top:K()}],right:[{right:K()}],bottom:[{bottom:K()}],left:[{left:K()}],visibility:["visible","invisible","collapse"],z:[{z:[Mn,"auto",he,fe]}],basis:[{basis:[Ni,"full","auto",m,...H()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Re,Ni,"auto","initial","none",fe]}],grow:[{grow:["",Re,he,fe]}],shrink:[{shrink:["",Re,he,fe]}],order:[{order:[Mn,"first","last","none",he,fe]}],"grid-cols":[{"grid-cols":q()}],"col-start-end":[{col:te()}],"col-start":[{"col-start":Z()}],"col-end":[{"col-end":Z()}],"grid-rows":[{"grid-rows":q()}],"row-start-end":[{row:te()}],"row-start":[{"row-start":Z()}],"row-end":[{"row-end":Z()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ie()}],"auto-rows":[{"auto-rows":ie()}],gap:[{gap:H()}],"gap-x":[{"gap-x":H()}],"gap-y":[{"gap-y":H()}],"justify-content":[{justify:[...oe(),"normal"]}],"justify-items":[{"justify-items":[...P(),"normal"]}],"justify-self":[{"justify-self":["auto",...P()]}],"align-content":[{content:["normal",...oe()]}],"align-items":[{items:[...P(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...P(),{baseline:["","last"]}]}],"place-content":[{"place-content":oe()}],"place-items":[{"place-items":[...P(),"baseline"]}],"place-self":[{"place-self":["auto",...P()]}],p:[{p:H()}],px:[{px:H()}],py:[{py:H()}],ps:[{ps:H()}],pe:[{pe:H()}],pbs:[{pbs:H()}],pbe:[{pbe:H()}],pt:[{pt:H()}],pr:[{pr:H()}],pb:[{pb:H()}],pl:[{pl:H()}],m:[{m:A()}],mx:[{mx:A()}],my:[{my:A()}],ms:[{ms:A()}],me:[{me:A()}],mbs:[{mbs:A()}],mbe:[{mbe:A()}],mt:[{mt:A()}],mr:[{mr:A()}],mb:[{mb:A()}],ml:[{ml:A()}],"space-x":[{"space-x":H()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":H()}],"space-y-reverse":["space-y-reverse"],size:[{size:G()}],"inline-size":[{inline:["auto",...W()]}],"min-inline-size":[{"min-inline":["auto",...W()]}],"max-inline-size":[{"max-inline":["none",...W()]}],"block-size":[{block:["auto",...se()]}],"min-block-size":[{"min-block":["auto",...se()]}],"max-block-size":[{"max-block":["none",...se()]}],w:[{w:[m,"screen",...G()]}],"min-w":[{"min-w":[m,"screen","none",...G()]}],"max-w":[{"max-w":[m,"screen","none","prose",{screen:[h]},...G()]}],h:[{h:["screen","lh",...G()]}],"min-h":[{"min-h":["screen","lh","none",...G()]}],"max-h":[{"max-h":["screen","lh",...G()]}],"font-size":[{text:["base",a,us,el]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,BS,RS]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",td,fe]}],"font-family":[{font:[DS,jS,n]}],"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:[o,he,fe]}],"line-clamp":[{"line-clamp":[Re,"none",he,_g]}],leading:[{leading:[c,...H()]}],"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:Q()}],"text-color":[{text:Q()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...le(),"wavy"]}],"text-decoration-thickness":[{decoration:[Re,"from-font","auto",he,el]}],"text-decoration-color":[{decoration:Q()}],"underline-offset":[{"underline-offset":[Re,"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:H()}],"tab-size":[{tab:[Mn,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:ge()}],"bg-repeat":[{bg:ye()}],"bg-size":[{bg:ue()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Mn,he,fe],radial:["",he,fe],conic:[Mn,he,fe]},HS,OS]}],"bg-color":[{bg:Q()}],"gradient-from-pos":[{from:Te()}],"gradient-via-pos":[{via:Te()}],"gradient-to-pos":[{to:Te()}],"gradient-from":[{from:Q()}],"gradient-via":[{via:Q()}],"gradient-to":[{to:Q()}],rounded:[{rounded:ce()}],"rounded-s":[{"rounded-s":ce()}],"rounded-e":[{"rounded-e":ce()}],"rounded-t":[{"rounded-t":ce()}],"rounded-r":[{"rounded-r":ce()}],"rounded-b":[{"rounded-b":ce()}],"rounded-l":[{"rounded-l":ce()}],"rounded-ss":[{"rounded-ss":ce()}],"rounded-se":[{"rounded-se":ce()}],"rounded-ee":[{"rounded-ee":ce()}],"rounded-es":[{"rounded-es":ce()}],"rounded-tl":[{"rounded-tl":ce()}],"rounded-tr":[{"rounded-tr":ce()}],"rounded-br":[{"rounded-br":ce()}],"rounded-bl":[{"rounded-bl":ce()}],"border-w":[{border:be()}],"border-w-x":[{"border-x":be()}],"border-w-y":[{"border-y":be()}],"border-w-s":[{"border-s":be()}],"border-w-e":[{"border-e":be()}],"border-w-bs":[{"border-bs":be()}],"border-w-be":[{"border-be":be()}],"border-w-t":[{"border-t":be()}],"border-w-r":[{"border-r":be()}],"border-w-b":[{"border-b":be()}],"border-w-l":[{"border-l":be()}],"divide-x":[{"divide-x":be()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":be()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...le(),"hidden","none"]}],"divide-style":[{divide:[...le(),"hidden","none"]}],"border-color":[{border:Q()}],"border-color-x":[{"border-x":Q()}],"border-color-y":[{"border-y":Q()}],"border-color-s":[{"border-s":Q()}],"border-color-e":[{"border-e":Q()}],"border-color-bs":[{"border-bs":Q()}],"border-color-be":[{"border-be":Q()}],"border-color-t":[{"border-t":Q()}],"border-color-r":[{"border-r":Q()}],"border-color-b":[{"border-b":Q()}],"border-color-l":[{"border-l":Q()}],"divide-color":[{divide:Q()}],"outline-style":[{outline:[...le(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Re,he,fe]}],"outline-w":[{outline:["",Re,us,el]}],"outline-color":[{outline:Q()}],shadow:[{shadow:["","none",y,Wr,Zr]}],"shadow-color":[{shadow:Q()}],"inset-shadow":[{"inset-shadow":["none",v,Wr,Zr]}],"inset-shadow-color":[{"inset-shadow":Q()}],"ring-w":[{ring:be()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:Q()}],"ring-offset-w":[{"ring-offset":[Re,el]}],"ring-offset-color":[{"ring-offset":Q()}],"inset-ring-w":[{"inset-ring":be()}],"inset-ring-color":[{"inset-ring":Q()}],"text-shadow":[{"text-shadow":["none",x,Wr,Zr]}],"text-shadow-color":[{"text-shadow":Q()}],opacity:[{opacity:[Re,he,fe]}],"mix-blend":[{"mix-blend":[...we(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":we()}],"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":[Re]}],"mask-image-linear-from-pos":[{"mask-linear-from":ae()}],"mask-image-linear-to-pos":[{"mask-linear-to":ae()}],"mask-image-linear-from-color":[{"mask-linear-from":Q()}],"mask-image-linear-to-color":[{"mask-linear-to":Q()}],"mask-image-t-from-pos":[{"mask-t-from":ae()}],"mask-image-t-to-pos":[{"mask-t-to":ae()}],"mask-image-t-from-color":[{"mask-t-from":Q()}],"mask-image-t-to-color":[{"mask-t-to":Q()}],"mask-image-r-from-pos":[{"mask-r-from":ae()}],"mask-image-r-to-pos":[{"mask-r-to":ae()}],"mask-image-r-from-color":[{"mask-r-from":Q()}],"mask-image-r-to-color":[{"mask-r-to":Q()}],"mask-image-b-from-pos":[{"mask-b-from":ae()}],"mask-image-b-to-pos":[{"mask-b-to":ae()}],"mask-image-b-from-color":[{"mask-b-from":Q()}],"mask-image-b-to-color":[{"mask-b-to":Q()}],"mask-image-l-from-pos":[{"mask-l-from":ae()}],"mask-image-l-to-pos":[{"mask-l-to":ae()}],"mask-image-l-from-color":[{"mask-l-from":Q()}],"mask-image-l-to-color":[{"mask-l-to":Q()}],"mask-image-x-from-pos":[{"mask-x-from":ae()}],"mask-image-x-to-pos":[{"mask-x-to":ae()}],"mask-image-x-from-color":[{"mask-x-from":Q()}],"mask-image-x-to-color":[{"mask-x-to":Q()}],"mask-image-y-from-pos":[{"mask-y-from":ae()}],"mask-image-y-to-pos":[{"mask-y-to":ae()}],"mask-image-y-from-color":[{"mask-y-from":Q()}],"mask-image-y-to-color":[{"mask-y-to":Q()}],"mask-image-radial":[{"mask-radial":[he,fe]}],"mask-image-radial-from-pos":[{"mask-radial-from":ae()}],"mask-image-radial-to-pos":[{"mask-radial-to":ae()}],"mask-image-radial-from-color":[{"mask-radial-from":Q()}],"mask-image-radial-to-color":[{"mask-radial-to":Q()}],"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":z()}],"mask-image-conic-pos":[{"mask-conic":[Re]}],"mask-image-conic-from-pos":[{"mask-conic-from":ae()}],"mask-image-conic-to-pos":[{"mask-conic-to":ae()}],"mask-image-conic-from-color":[{"mask-conic-from":Q()}],"mask-image-conic-to-color":[{"mask-conic-to":Q()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ge()}],"mask-repeat":[{mask:ye()}],"mask-size":[{mask:ue()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",he,fe]}],filter:[{filter:["","none",he,fe]}],blur:[{blur:ve()}],brightness:[{brightness:[Re,he,fe]}],contrast:[{contrast:[Re,he,fe]}],"drop-shadow":[{"drop-shadow":["","none",w,Wr,Zr]}],"drop-shadow-color":[{"drop-shadow":Q()}],grayscale:[{grayscale:["",Re,he,fe]}],"hue-rotate":[{"hue-rotate":[Re,he,fe]}],invert:[{invert:["",Re,he,fe]}],saturate:[{saturate:[Re,he,fe]}],sepia:[{sepia:["",Re,he,fe]}],"backdrop-filter":[{"backdrop-filter":["","none",he,fe]}],"backdrop-blur":[{"backdrop-blur":ve()}],"backdrop-brightness":[{"backdrop-brightness":[Re,he,fe]}],"backdrop-contrast":[{"backdrop-contrast":[Re,he,fe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Re,he,fe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Re,he,fe]}],"backdrop-invert":[{"backdrop-invert":["",Re,he,fe]}],"backdrop-opacity":[{"backdrop-opacity":[Re,he,fe]}],"backdrop-saturate":[{"backdrop-saturate":[Re,he,fe]}],"backdrop-sepia":[{"backdrop-sepia":["",Re,he,fe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":H()}],"border-spacing-x":[{"border-spacing-x":H()}],"border-spacing-y":[{"border-spacing-y":H()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",he,fe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Re,"initial",he,fe]}],ease:[{ease:["linear","initial",L,he,fe]}],delay:[{delay:[Re,he,fe]}],animate:[{animate:["none",E,he,fe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[M,he,fe]}],"perspective-origin":[{"perspective-origin":R()}],rotate:[{rotate:Ne()}],"rotate-x":[{"rotate-x":Ne()}],"rotate-y":[{"rotate-y":Ne()}],"rotate-z":[{"rotate-z":Ne()}],scale:[{scale:Ie()}],"scale-x":[{"scale-x":Ie()}],"scale-y":[{"scale-y":Ie()}],"scale-z":[{"scale-z":Ie()}],"scale-3d":["scale-3d"],skew:[{skew:Xe()}],"skew-x":[{"skew-x":Xe()}],"skew-y":[{"skew-y":Xe()}],transform:[{transform:[he,fe,"","none","gpu","cpu"]}],"transform-origin":[{origin:R()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:tt()}],"translate-x":[{"translate-x":tt()}],"translate-y":[{"translate-y":tt()}],"translate-z":[{"translate-z":tt()}],"translate-none":["translate-none"],zoom:[{zoom:[Mn,he,fe]}],accent:[{accent:Q()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:Q()}],"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":Q()}],"scrollbar-track-color":[{"scrollbar-track":Q()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":H()}],"scroll-mx":[{"scroll-mx":H()}],"scroll-my":[{"scroll-my":H()}],"scroll-ms":[{"scroll-ms":H()}],"scroll-me":[{"scroll-me":H()}],"scroll-mbs":[{"scroll-mbs":H()}],"scroll-mbe":[{"scroll-mbe":H()}],"scroll-mt":[{"scroll-mt":H()}],"scroll-mr":[{"scroll-mr":H()}],"scroll-mb":[{"scroll-mb":H()}],"scroll-ml":[{"scroll-ml":H()}],"scroll-p":[{"scroll-p":H()}],"scroll-px":[{"scroll-px":H()}],"scroll-py":[{"scroll-py":H()}],"scroll-ps":[{"scroll-ps":H()}],"scroll-pe":[{"scroll-pe":H()}],"scroll-pbs":[{"scroll-pbs":H()}],"scroll-pbe":[{"scroll-pbe":H()}],"scroll-pt":[{"scroll-pt":H()}],"scroll-pr":[{"scroll-pr":H()}],"scroll-pb":[{"scroll-pb":H()}],"scroll-pl":[{"scroll-pl":H()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",he,fe]}],fill:[{fill:["none",...Q()]}],"stroke-w":[{stroke:[Re,us,el,_g]}],stroke:[{stroke:["none",...Q()]}],"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"]}},KS=(l,{cacheSize:n,prefix:a,experimentalParseClassName:s,extend:o={},override:c={}})=>(Ql(l,"cacheSize",n),Ql(l,"prefix",a),Ql(l,"experimentalParseClassName",s),Qr(l.theme,c.theme),Qr(l.classGroups,c.classGroups),Qr(l.conflictingClassGroups,c.conflictingClassGroups),Qr(l.conflictingClassGroupModifiers,c.conflictingClassGroupModifiers),Ql(l,"postfixLookupClassGroups",c.postfixLookupClassGroups),Ql(l,"orderSensitiveModifiers",c.orderSensitiveModifiers),Jr(l.theme,o.theme),Jr(l.classGroups,o.classGroups),Jr(l.conflictingClassGroups,o.conflictingClassGroups),Jr(l.conflictingClassGroupModifiers,o.conflictingClassGroupModifiers),xd(l,o,"postfixLookupClassGroups"),xd(l,o,"orderSensitiveModifiers"),l),Ql=(l,n,a)=>{a!==void 0&&(l[n]=a)},Qr=(l,n)=>{if(n)for(const a in n)Ql(l,a,n[a])},Jr=(l,n)=>{if(n)for(const a in n)xd(l,n,a)},xd=(l,n,a)=>{const s=n[a];s!==void 0&&(l[a]=l[a]?l[a].concat(s):s)},IS=(l,...n)=>typeof l=="function"?Lg(Og,l,...n):Lg(()=>KS(Og(),l),...n),FS=IS({extend:{classGroups:{"font-size":[{text:["tui","tui-sm","tui-lg"]}]}}});function ne(...l){return FS(W1(l))}const ke={cursor:"▸",on:"●",off:"○",dot:"·",check:"✓",cross:"✗",warn:"!",arrowRight:"→",arrowLeft:"←",chevronDown:"▾",chevronRight:"▸",ellipsis:"…",meterFull:"█",meterEmpty:"░",tabDivider:"│"},cn={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"}},da={ok:cn.ok.text,warn:cn.warn.text,bad:cn.bad.text,idle:cn.idle.text,accent:cn.accent.text,alt:cn.alt.text,info:cn.info.text},dn=({level:l,className:n})=>f.jsx("span",{"aria-hidden":"true",className:ne("select-none leading-none",da[l],n),children:l==="idle"?ke.off:ke.on}),Id=({className:l})=>f.jsx("span",{"aria-hidden":"true",className:ne("select-none text-tui-faint",l),children:ke.dot}),xy={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"},Nt=({title:l,aside:n,tone:a="accent",className:s,bodyClassName:o,children:c,...h})=>f.jsxs("fieldset",{className:ne("tui-panel tui-block relative min-w-0 border border-tui-border bg-tui-base",l?"px-3 pb-3 pt-1":"p-3",s),...h,children:[l?f.jsx("legend",{className:ne("flex items-center gap-2 text-tui font-bold",da[a]),children:f.jsx("span",{children:l})}):null,n?f.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:n}):null,f.jsx("div",{className:ne("min-w-0",o),children:c})]}),An=({label:l,labelWidth:n=16,className:a,children:s})=>f.jsxs("div",{className:ne("flex items-baseline gap-2 text-tui",a),children:[f.jsx("span",{className:"shrink-0 truncate text-tui-muted",style:{width:`${n}ch`},title:typeof l=="string"?l:void 0,children:l}),f.jsx("span",{className:"min-w-0 flex-1 text-tui-text",children:s})]}),GS=({className:l,label:n})=>n?f.jsxs("div",{className:ne("flex items-center gap-2",l),children:[f.jsx("span",{className:"h-px w-3 bg-tui-border-dim","aria-hidden":"true"}),f.jsx("span",{className:"text-tui-sm text-tui-faint",children:n}),f.jsx("span",{className:"h-px flex-1 bg-tui-border-dim","aria-hidden":"true"})]}):f.jsx("div",{className:ne("h-px w-full bg-tui-border-dim",l),"aria-hidden":"true"}),Ri=({tone:l="accent",className:n,children:a,action:s})=>{const o=l==="ok"?ke.check:l==="bad"?ke.cross:l==="warn"?ke.warn:"›",c=cn[l].edgeL;return f.jsxs("div",{className:ne("flex items-start gap-2 border border-tui-border-dim border-l-2 bg-tui-mantle px-2 py-1.5 text-tui",c,n),children:[f.jsx("span",{"aria-hidden":"true",className:ne("shrink-0 font-bold",da[l]),children:o}),f.jsx("div",{className:"min-w-0 flex-1 leading-snug text-tui-text",children:a}),s?f.jsx("div",{className:"shrink-0",children:s}):null]})},YS={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"},Me=({variant:l="default",brackets:n=!0,glyph:a,block:s=!1,className:o,children:c,type:h="button",...m})=>f.jsxs("button",{type:h,className:ne("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",YS[l],s&&"w-full",o),...m,children:[n?f.jsx("span",{"aria-hidden":"true",className:"opacity-60",children:"["}):null,a?f.jsx("span",{"aria-hidden":"true",className:"leading-none",children:a}):null,f.jsx("span",{className:"truncate",children:c}),n?f.jsx("span",{"aria-hidden":"true",className:"opacity-60",children:"]"}):null]}),wy=({tone:l="accent",dot:n=!1,className:a,children:s})=>f.jsxs("span",{className:ne("inline-flex select-none items-center gap-1 whitespace-nowrap text-tui font-bold uppercase",da[l],a),children:[n?f.jsx(dn,{level:l}):null,s]}),Fd=({tabs:l,activeId:n,onSelect:a,ariaLabel:s,className:o,labelClassName:c})=>f.jsx("nav",{className:ne("flex items-center gap-2",o),"aria-label":s,children:l.map((h,m)=>{const p=h.id===n;return f.jsxs(Jn.Fragment,{children:[m>0?f.jsx("span",{"aria-hidden":"true",className:"select-none text-tui-border",children:ke.tabDivider}):null,f.jsxs("button",{type:"button",onClick:()=>a(h.id),"aria-current":p?"page":void 0,"aria-label":h.ariaLabel??h.label,title:h.title,className:ne("tui-focusable select-none whitespace-nowrap border-b px-0.5 pb-0.5 text-tui transition-colors",p?"border-tui-accent font-bold text-tui-accent":"border-transparent text-tui-muted hover:border-tui-border-bright hover:text-tui-text"),children:[h.index!==void 0?f.jsx("span",{"aria-hidden":"true",className:ne("text-tui-faint",p&&"text-tui-accent"),children:h.index}):null,f.jsx("span",{"aria-hidden":"true",className:ne("ml-1",c),children:h.label})]})]},h.id)})}),Sy=({hints:l,className:n})=>f.jsx("div",{className:ne("flex flex-wrap items-center gap-x-3 gap-y-0.5 text-tui-sm text-tui-faint",n),children:l.map(a=>f.jsxs("span",{className:"flex items-center gap-1",children:[f.jsx("kbd",{className:"border border-tui-border-dim px-1 not-italic text-tui-muted",children:a.keys}),f.jsx("span",{children:a.action})]},`${a.keys} ${a.action}`))}),Cy=({active:l=!1,className:n,children:a})=>f.jsx("span",{className:ne("inline-flex min-w-[2ch] select-none items-center justify-center border px-1 text-tui",l?"border-tui-accent bg-tui-accent text-tui-crust":"border-tui-border bg-tui-surface text-tui-muted",n),children:a}),un=({htmlFor:l,hint:n,className:a,children:s})=>f.jsxs("label",{htmlFor:l,className:ne("block text-tui-sm font-bold text-tui-muted",a),children:[s,n?f.jsx("span",{className:"ml-2 font-normal text-tui-faint",children:n}):null]}),xt=Jn.forwardRef(({className:l,...n},a)=>f.jsx("input",{ref:a,className:ne("tui-input w-full px-2 py-1 text-tui",l),...n}));xt.displayName="Input";const Ao=Jn.forwardRef(({className:l,children:n,...a},s)=>f.jsx("select",{ref:s,className:ne("tui-input w-full px-2 py-1 text-tui",l),...a,children:n}));Ao.displayName="Select";const PS=({checked:l,onChange:n,disabled:a=!1,label:s,description:o,className:c,id:h})=>f.jsxs("label",{className:ne("group flex cursor-pointer select-none items-start gap-2 py-0.5 text-tui",a&&"cursor-not-allowed opacity-60",c),children:[f.jsx("input",{id:h,type:"checkbox",className:"sr-only",checked:l,disabled:a,onChange:m=>n(m.target.checked)}),f.jsx("span",{"aria-hidden":"true",className:ne("mt-px shrink-0 font-bold leading-tight",l?"text-tui-ok":"text-tui-faint",!a&&"group-hover:text-tui-accent"),children:l?"[x]":"[ ]"}),f.jsxs("span",{className:"min-w-0 flex-1",children:[f.jsx("span",{className:ne("block",l?"text-tui-text":"text-tui-muted"),children:s}),o?f.jsx("span",{className:"mt-0.5 block text-tui-sm leading-snug text-tui-faint",children:o}):null]})]}),Eo="h-8",bn=({title:l,aside:n,className:a,children:s})=>f.jsxs("section",{className:ne("min-w-0",a),children:[f.jsxs("div",{className:"flex min-h-[var(--tui-row)] items-center gap-2 border-b border-tui-border pb-1",children:[f.jsx("h3",{className:"text-tui font-bold text-tui-accent",children:l}),n?f.jsx("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:n}):null]}),f.jsx("div",{className:"divide-y divide-tui-border-dim",children:s})]}),Kt=({label:l,hint:n,htmlFor:a,control:s,className:o})=>f.jsxs("div",{className:ne("flex flex-col gap-1 py-1.5 sm:flex-row sm:items-center sm:gap-4",o),children:[f.jsxs("div",{className:"min-w-0 flex-1",children:[a?f.jsx("label",{htmlFor:a,className:"block text-tui text-tui-text",children:l}):f.jsx("span",{className:"block text-tui text-tui-text",children:l}),n?f.jsx("span",{className:"block text-tui-sm leading-snug text-tui-faint",children:n}):null]}),f.jsx("div",{className:"w-full shrink-0 sm:w-[20rem]",children:s})]}),wd="flex min-w-0 cursor-pointer select-none items-center justify-center px-1 text-tui transition-colors has-[:focus-visible]:outline has-[:focus-visible]:outline-1 has-[:focus-visible]:-outline-offset-2 has-[:focus-visible]:outline-tui-text",Sd="text-tui-muted hover:bg-tui-selection hover:text-tui-text";function Cd({name:l,value:n,options:a,onChange:s,tone:o="accent",size:c="md",className:h,"aria-label":m}){return f.jsx("div",{role:"radiogroup","aria-label":m,className:ne("grid w-full border border-tui-border bg-tui-mantle",Eo,h),style:{gridTemplateColumns:`repeat(${a.length}, minmax(max-content, 1fr))`},children:a.map((p,g)=>{const y=p.value===n;return f.jsxs("label",{className:ne(wd,c==="sm"&&"px-1.5 text-tui-sm",g>0&&"border-l border-tui-border",y?ne(xy[o],"font-bold text-tui-crust"):Sd),children:[f.jsx("input",{type:"radio",name:l,value:p.value,className:"sr-only",checked:y,onChange:()=>s(p.value)}),f.jsx("span",{className:"whitespace-nowrap",children:p.label})]},p.value)})})}const ki=({checked:l,onChange:n,label:a,offLabel:s,onLabel:o,disabled:c=!1,className:h})=>{const m=p=>g=>{g.preventDefault(),!(c||p===l)&&n(p)};return f.jsxs("label",{className:ne("grid w-full grid-cols-2 border border-tui-border bg-tui-mantle has-[:focus-visible]:outline has-[:focus-visible]:outline-1 has-[:focus-visible]:outline-tui-accent",Eo,c&&"cursor-not-allowed opacity-60",h),children:[f.jsx("input",{type:"checkbox",className:"sr-only","aria-label":a,checked:l,disabled:c,onChange:p=>n(p.target.checked)}),f.jsx("span",{"aria-hidden":"true",onClick:m(!1),className:ne(wd,l?Sd:"bg-tui-selection font-bold text-tui-text"),children:s}),f.jsx("span",{"aria-hidden":"true",onClick:m(!0),className:ne(wd,"border-l border-tui-border",l?"bg-tui-ok font-bold text-tui-crust":Sd),children:o})]})},ll=({variant:l="neutral",className:n,type:a="button",children:s,...o})=>f.jsx("button",{type:a,className:ne("tui-focusable inline-flex h-7 w-7 shrink-0 select-none items-center justify-center border border-transparent text-tui transition-colors","disabled:cursor-not-allowed disabled:text-tui-border disabled:hover:border-transparent disabled:hover:bg-transparent",l==="danger"?"text-tui-bad hover:border-tui-bad":"text-tui-muted hover:border-tui-border hover:text-tui-accent",n),...o,children:s}),$S=({value:l,width:n=20,tone:a="accent",className:s})=>{const o=Number.isFinite(l)?Math.min(1,Math.max(0,l)):0,c=Math.round(o*n);return f.jsxs("span",{className:ne("inline-flex select-none whitespace-pre font-mono leading-none",s),role:"presentation",children:[f.jsx("span",{className:da[a],children:ke.meterFull.repeat(c)}),f.jsx("span",{className:"text-tui-border",children:ke.meterEmpty.repeat(Math.max(0,n-c))})]})},VS=({ratio:l,label:n,tone:a="accent",className:s,...o})=>{const c=Number.isFinite(l)?Math.min(1,Math.max(0,l)):0;return f.jsxs("div",{className:ne("relative h-[var(--tui-row)] w-full overflow-hidden border border-tui-border bg-tui-mantle",s),role:"progressbar","aria-valuenow":Math.round(c*100),"aria-valuemin":0,"aria-valuemax":100,...o,children:[f.jsx("div",{className:ne("absolute inset-y-0 left-0",xy[a]),style:{width:`${c*100}%`},"aria-hidden":"true"}),n!==void 0?f.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:n}):null]})},Xl=({label:l,value:n,sub:a,tone:s,title:o,className:c})=>f.jsxs("div",{className:ne("min-w-0 border border-tui-border bg-tui-base px-2.5 py-1.5",c),title:o,children:[f.jsx("div",{className:"truncate text-tui-sm text-tui-muted",children:l}),f.jsx("div",{className:ne("truncate text-tui-lg font-bold",s?da[s]:"text-tui-text"),children:n}),f.jsx("div",{className:"truncate text-tui-sm text-tui-faint",children:a||" "})]}),Dg=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],sl=({className:l,label:n})=>{const[a,s]=Jn.useState(0);return Jn.useEffect(()=>{const o=setInterval(()=>s(c=>(c+1)%Dg.length),90);return()=>clearInterval(o)},[]),f.jsxs("span",{className:ne("inline-flex items-center gap-1.5",l),role:"status",children:[f.jsx("span",{"aria-hidden":"true",className:"text-tui-accent",children:Dg[a]}),n?f.jsx("span",{children:n}):null]})};function Gd({columns:l,items:n,rowKey:a,empty:s,className:o}){return n.length===0?f.jsx("div",{className:ne("px-1 py-4 text-center text-tui text-tui-faint",o),children:s}):f.jsx("div",{className:ne("w-full overflow-x-auto",o),children:f.jsxs("table",{className:"w-full border-collapse text-tui",children:[f.jsx("thead",{children:f.jsx("tr",{className:"border-b border-tui-border",children:l.map(c=>f.jsx("th",{scope:"col",style:c.width?{width:`${c.width}ch`}:void 0,className:ne("whitespace-nowrap px-2 py-1 text-tui-sm font-bold text-tui-muted",c.align==="right"?"text-right":"text-left",c.className),children:c.header},c.key))})}),f.jsx("tbody",{children:n.map((c,h)=>f.jsx("tr",{className:"border-b border-tui-border-dim last:border-b-0 hover:bg-tui-selection",children:l.map(m=>f.jsx("td",{className:ne("px-2 py-1 align-top text-tui-text",m.align==="right"?"text-right":"text-left",m.className),children:m.render(c,h)},m.key))},a(c,h)))})]})})}var qS=xb();const fa=({isOpen:l,onClose:n,title:a,subtitle:s,closeLabel:o,footer:c,hints:h,size:m="md",fixedHeight:p=!1,className:g,children:y})=>{if(!l)return null;const v=m==="sm"?"max-w-md":m==="lg"?"max-w-3xl":"max-w-xl",x=`tui-modal-${a.replace(/\s+/g,"-").toLowerCase()}`,w=f.jsx("div",{className:"fixed inset-0 inset-x-0 z-50 flex items-center justify-center overflow-hidden bg-tui-crust/85 p-3 sm:p-6",style:{height:"var(--app-height, 100dvh)",width:"100vw"},role:"dialog","aria-modal":"true","aria-labelledby":x,onMouseDown:S=>{S.target===S.currentTarget&&n()},children:f.jsxs("div",{className:ne("relative flex max-h-full w-full flex-col border border-tui-border bg-tui-base",v,p&&"h-[46rem]",g),children:[f.jsxs("header",{className:"flex shrink-0 items-center gap-2 border-b border-tui-border bg-tui-mantle px-3 py-1.5",children:[f.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-baseline gap-x-2",children:[f.jsx("h2",{id:x,className:"break-words text-tui font-bold text-tui-accent",children:a}),s?f.jsx("span",{className:"min-w-0 break-words text-tui-sm text-tui-faint",children:s}):null]}),f.jsx(Me,{variant:"ghost",onClick:n,"aria-label":o,title:o,children:"esc"})]}),f.jsx("div",{className:"relative min-h-0 flex-1 overflow-y-auto overscroll-contain px-3 py-3",children:y}),c||h?f.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:[h?f.jsx(Sy,{hints:h}):f.jsx("span",{}),c?f.jsx("div",{className:"flex items-center gap-2",children:c}):null]}):null]})});return typeof document>"u"?w:qS.createPortal(w,document.body)},Td=({items:l,className:n})=>{const a=l.filter(Boolean);return f.jsx("span",{className:ne("flex min-w-0 items-center gap-1.5",n),children:a.map((s,o)=>f.jsxs(Jn.Fragment,{children:[o>0?f.jsx(Id,{className:"shrink-0"}):null,s]},o))})},Ty=({left:l,right:n,className:a})=>f.jsxs("footer",{className:ne("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",a),children:[f.jsx("div",{className:"flex min-w-0 items-center gap-1.5 text-tui-muted",children:l}),f.jsx("div",{className:"flex shrink-0 items-center gap-3",children:n})]}),XS=({name:l,tagline:n,aside:a,tabs:s,activeTabId:o,onSelectTab:c,tabsAriaLabel:h,toolbarStart:m,toolbarAside:p,hints:g,footerAside:y,bodyClassName:v,className:x,children:w})=>{const S=!!(s&&s.length>0&&o!==void 0&&c);return f.jsxs("div",{className:ne("flex h-full min-h-0 w-full flex-col bg-tui-crust",x),children:[l?f.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:[f.jsxs("span",{className:"flex min-w-0 items-baseline gap-2",children:[f.jsx("span",{className:"shrink-0 font-bold text-tui-accent",children:l}),n?f.jsx("span",{className:"hidden truncate text-tui-sm text-tui-faint sm:block",children:n}):null]}),a?f.jsx("span",{className:"flex shrink-0 items-center gap-2",children:a}):null]}):null,S||m||p?f.jsxs("div",{className:"flex min-h-[var(--tui-row)] shrink-0 flex-wrap items-center gap-x-3 gap-y-1 border-b border-tui-border bg-tui-mantle px-2 py-1",children:[m?f.jsx("div",{className:"flex shrink-0 items-center",children:m}):null,S?f.jsx("div",{className:"scrollbar-none order-last min-w-0 basis-full overflow-x-auto sm:order-none sm:basis-auto",children:f.jsx(Fd,{tabs:s,activeId:o,onSelect:c,ariaLabel:h,className:"gap-3"})}):null,p?f.jsx("div",{className:"ml-auto flex shrink-0 items-center gap-2",children:p}):null]}):null,f.jsx("div",{className:ne("min-h-0 flex-1 overflow-y-auto p-2",v),children:w}),g||y?f.jsx(Ty,{left:g?f.jsx(Sy,{hints:g}):null,right:y}):null]})},eo="tui-focusable select-none border border-transparent px-1.5 text-tui uppercase transition-colors",to="text-tui-muted hover:border-tui-border hover:text-tui-accent",ZS="border-tui-accent bg-tui-accent text-tui-crust",WS=({currentView:l,onNavigate:n,onOpenPairing:a,onOpenSettings:s,onToggleVirtualKeyboard:o,isVirtualKeyboardOpen:c})=>{const{language:h,setLanguage:m,t:p}=Ee(),{addToast:g}=Xt(),y=()=>{const x=h==="zh"?"en":"zh";m(x),g("info",Od(x,"toasts.switchedLanguage",{lang:x==="zh"?"简体中文":"English"}))},v=[{id:"terminal",label:p("header.terminalTab"),index:1,ariaLabel:p("header.terminalTab")},...l==="admin"?[{id:"admin",label:p("header.adminTab"),index:2,ariaLabel:p("header.adminTab")}]:[]];return f.jsx("header",{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:f.jsxs("div",{className:"scrollbar-none flex min-h-[var(--tui-row)] items-center gap-2 overflow-x-auto text-tui",children:[f.jsxs("span",{className:"flex shrink-0 items-baseline gap-2",children:[f.jsx("span",{className:"font-bold text-tui-accent",children:"herdr-remote"}),f.jsx("span",{className:"hidden text-tui-sm text-tui-faint sm:inline",children:p("header.tagline")})]}),f.jsx("span",{"aria-hidden":"true",className:"h-4 w-px shrink-0 bg-tui-border"}),f.jsx(Fd,{tabs:v,activeId:l,onSelect:x=>n(x),ariaLabel:p("header.mainNavigationAria"),className:"shrink-0 gap-3"}),f.jsx("span",{"aria-hidden":"true",className:"h-4 w-px shrink-0 bg-tui-border"}),f.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[f.jsx("button",{type:"button",onClick:y,className:ne(eo,to),title:p("header.languageToggleTitle"),"aria-label":p("header.languageToggleTitle"),children:p("header.languageShort")}),l==="terminal"&&f.jsx("button",{type:"button",onClick:o,className:ne(eo,c?ZS:to),title:p("header.virtualKeyboardTitle"),"aria-label":p("header.virtualKeyboardTitle"),children:p("header.actionKeyboard")}),f.jsx("button",{type:"button",onClick:a,className:ne(eo,to),title:p("header.pairingTitle"),"aria-label":p("header.pairingTitle"),children:p("header.actionPairing")}),f.jsx("button",{type:"button",onClick:s,className:ne(eo,to),title:p("header.settingsTitle"),"aria-label":p("header.settingsTitle"),children:p("header.actionSettings")})]})]})})},no=({tone:l,glyph:n,message:a,assertive:s=!1,action:o})=>f.jsxs("aside",{className:ne("flex w-full items-center justify-between gap-3 border-b bg-tui-mantle px-2 py-0.5 text-tui sm:px-3",cn[l].edgeB),"aria-live":s?"assertive":"polite",children:[f.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[f.jsx("span",{"aria-hidden":"true",className:ne("shrink-0",cn[l].text),children:n}),f.jsx("span",{className:"truncate text-tui-text",children:a})]}),o]}),QS=()=>{const{settings:l,t:n}=Ee(),{connectionState:a,stateDetail:s,connect:o}=et();return a==="connected"||!l.token&&!l.pairCode&&a==="disconnected"?null:a==="connecting"?f.jsx(no,{tone:"accent",glyph:f.jsx(sl,{}),message:n("statusBanner.connecting")}):a==="reconnecting"?f.jsx(no,{tone:"warn",glyph:f.jsx(sl,{}),assertive:!0,message:s||n("statusBanner.reconnectingDefault"),action:f.jsx(Me,{variant:"warn",onClick:()=>o(),className:"shrink-0",children:n("statusBanner.reconnectNow")})}):a==="error"?f.jsx(no,{tone:"bad",glyph:ke.cross,assertive:!0,message:s||n("statusBanner.errorDefault"),action:f.jsx(Me,{variant:"danger",onClick:()=>o(),className:"shrink-0",children:n("common.retry")})}):a==="disconnected"?f.jsx(no,{tone:"idle",glyph:ke.off,message:n("statusBanner.disconnected"),action:f.jsx(Me,{variant:"primary",onClick:()=>o(),className:"shrink-0",children:n("common.connect")})}):null},nd="Herdr Remote",zg=80,JS=/[\u0000-\u001F\u007F-\u009F]/g;function Md(l){if(typeof l!="string")return"";const n=l.replace(JS," ").replace(/\s+/g," ").trim();return n.length<=zg?n:`${n.slice(0,zg-1).trimEnd()}…`}function eC(l,n,a){const s=K1(a??null),o=s?`${s} `:"",c=Md(l);if(c)return`${o}${c} · ${nd}`;const h=Md(n);return h?`${o}${h} · ${nd}`:`${o}${nd}`}function tC(l,n,a){const s=eC(l,n,a);return typeof document<"u"&&(document.title=s),s}const nC=new Set(["http:","https:","mailto:"]),id=/(?:https?:\/\/|mailto:|www\.)[^\s"'<>`]+/gi,iC=/[.,;:!?'"]+$/,Hg=8;function Yd(l){return/^www\./i.test(l)?`https://${l}`:l}function lC(l){const n=(o,c)=>o.split(c).length-1;let a=l.replace(iC,"");const s=[["(",")"],["[","]"],["{","}"]];for(const[o,c]of s)for(;a.endsWith(c)&&n(a,c)>n(a,o);)a=a.slice(0,-1);return a}function My(l){if(typeof l!="string"||l.length===0)return!1;try{return nC.has(new URL(Yd(l)).protocol)}catch{return!1}}function aC(l,n){if(typeof l!="string"||n<0)return null;id.lastIndex=0;for(let a=id.exec(l);a;a=id.exec(l)){const s=lC(a[0]);if(!s)continue;const o=a.index,c=o+s.length;if(n>=o&&n<c&&My(s))return s}return null}function sC(l,n,a){var m;const s=(m=l==null?void 0:l.buffer)==null?void 0:m.active;if(!s||typeof s.getLine!="function"||!s.getLine(a))return null;let o=a;for(let p=0;p<Hg;p+=1){const g=s.getLine(o);if(!(g!=null&&g.isWrapped)||o===0)break;o-=1}let c="",h=-1;for(let p=o;p<o+Hg;p+=1){const g=s.getLine(p);if(!g||p>o&&!g.isWrapped)break;p===a&&(h=c.length+n),c+=g.translateToString(!1)}return h<0?null:{text:c,index:h}}function rC(l,n,a){const s=sC(l,n,a);return s?aC(s.text,s.index):null}function oC(l){try{const n=new URL(Yd(l));return n.host||n.pathname}catch{return""}}function Ad(l){return!My(l)||typeof window>"u"||typeof window.open!="function"?!1:(window.open(Yd(l),"_blank","noopener,noreferrer"),!0)}async function Pd(l){if(typeof navigator<"u"&&navigator.clipboard&&typeof navigator.clipboard.writeText=="function")try{return await navigator.clipboard.writeText(l),"clipboard"}catch{}if(typeof document<"u"&&typeof document.execCommand=="function"){let n=null,a=null,s=null;try{if(n=document.createElement("textarea"),n.style.userSelect="text",n.style.webkitUserSelect="text",n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.width="1px",n.style.height="1px",n.style.padding="0",n.style.border="none",n.style.outline="none",n.style.boxShadow="none",n.style.background="transparent",n.style.opacity="0",n.style.fontSize="16px",n.setAttribute("readonly",""),n.setAttribute("aria-hidden","true"),n.value=l,typeof window<"u"&&typeof window.getSelection=="function"&&(s=window.getSelection(),s&&s.rangeCount>0&&(a=s.getRangeAt(0))),document.body.appendChild(n),typeof navigator<"u"&&(/iPad|iPhone|iPod/.test(navigator.userAgent||"")||navigator.platform==="MacIntel"&&(navigator.maxTouchPoints||0)>1)){const h=document.createRange();h.selectNodeContents(n),s&&(s.removeAllRanges(),s.addRange(h)),n.setSelectionRange(0,l.length)}else n.focus({preventScroll:!0}),n.select();if(document.execCommand("copy"))return"exec"}catch{}finally{n!=null&&n.parentNode&&n.parentNode.removeChild(n),s&&(s.removeAllRanges(),a&&s.addRange(a))}}return"failed"}async function cC(){if(!(typeof window>"u"||window.isSecureContext!==!1)||typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.readText!="function")return{ok:!1,reason:"insecure"};try{const n=await navigator.clipboard.readText();return!n||n.length===0?{ok:!1,reason:"empty"}:{ok:!0,text:n}}catch(n){return typeof window<"u"&&window.isSecureContext===!1?{ok:!1,reason:"insecure"}:(n==null?void 0:n.name)==="SecurityError"?{ok:!1,reason:"insecure"}:{ok:!1,reason:"denied"}}}async function uC(){if(!(typeof window>"u"||window.isSecureContext!==!1)||typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.read!="function")return{ok:!1,reason:"insecure"};try{const n=await navigator.clipboard.read();if(!n||n.length===0)return{ok:!1,reason:"empty"};for(const a of n){const s=a.types.find(o=>o.startsWith("image/"));if(s){const o=await a.getType(s);if(o&&o.size>0)return{ok:!0,blob:o}}}return{ok:!1,reason:"empty"}}catch(n){if(typeof window<"u"&&window.isSecureContext===!1)return{ok:!1,reason:"insecure"};const a=n==null?void 0:n.name;return a==="SecurityError"?{ok:!1,reason:"insecure"}:a==="NotAllowedError"?{ok:!1,reason:"denied"}:{ok:!1,reason:"empty"}}}function Ay(l){const n=l.clipboardData;if(!n)return null;if(n.files&&n.files.length>0)for(let a=0;a<n.files.length;a++){const s=n.files[a];if(s!=null&&s.type.startsWith("image/"))return s}if(n.items&&n.items.length>0)for(let a=0;a<n.items.length;a++){const s=n.items[a];if(s!=null&&s.type.startsWith("image/")){const o=s.getAsFile();if(o)return o}}return null}function dC(l){if(!l||l.length===0)return null;for(let n=0;n<l.length;n++){const a=l[n];if(a&&(a.type.startsWith("image/")||/\.(png|jpe?g|webp|gif)$/i.test(a.name)))return a}return null}const fC=({isOpen:l,onClose:n,onSend:a,onSendImage:s})=>{const{t:o}=Ee(),{addToast:c}=Xt(),[h,m]=T.useState(""),[p,g]=T.useState(null),[y,v]=T.useState(!1),x=T.useRef(null),w=T.useRef(null),S=T.useRef(null),M=async D=>{if(D.size===0){c("error",o("clipboard.fileEmpty"));return}v(!0);try{const j=await Gb(D);j?(g(j),m("")):c("error",o("clipboard.imageTooLarge"))}catch(j){console.error("Failed to process image:",j),c("error",o("clipboard.imageTooLarge"))}finally{v(!1)}},N=async D=>{const j=Ay(D);j&&(D.preventDefault(),await M(j))},L=async D=>{const j=dC(D.target.files);D.target.value="",j&&await M(j)},E=D=>{const j=D.target.value;m(j),j&&p&&g(null)},k=()=>{g(null),x.current&&(x.current.value=""),w.current&&(w.current.value="")},z=()=>{p?(s==null||s(p),n()):h.trim()&&(a(h),n())},R=!!(h.trim()||p);return f.jsx(fa,{isOpen:l,onClose:n,title:o("clipboard.pasteTitle"),closeLabel:o("clipboard.cancel"),size:"sm",footer:f.jsxs("div",{className:"flex items-center justify-end gap-2",children:[f.jsx(Me,{variant:"ghost",onClick:n,children:o("clipboard.cancel")}),f.jsx(Me,{variant:"primary",onClick:z,disabled:!R||y,children:o("clipboard.pasteSend")})]}),children:f.jsxs("div",{className:"flex flex-col gap-3 p-3 font-mono select-text",children:[f.jsxs("div",{className:"flex flex-col gap-1.5",children:[f.jsx("label",{htmlFor:"paste-fallback-input",className:"text-tui-sm text-tui-muted font-sans font-medium",children:o("clipboard.pasteHint")}),f.jsx("textarea",{ref:S,id:"paste-fallback-input","data-testid":"paste-fallback-input",rows:4,autoFocus:!0,placeholder:o("clipboard.pasteHint"),value:h,onChange:E,onPaste:N,disabled:!!p||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"})]}),f.jsxs("div",{className:"relative my-1",children:[f.jsx("div",{className:"absolute inset-0 flex items-center",children:f.jsx("div",{className:"w-full border-t border-tui-border"})}),f.jsx("div",{className:"relative flex justify-center text-tui-xs uppercase",children:f.jsx("span",{className:"bg-tui-bg px-2 text-tui-muted font-sans",children:o("clipboard.imageSectionTitle")})})]}),f.jsxs("div",{className:"flex flex-col gap-2",children:[f.jsx("input",{ref:x,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",className:"hidden","data-testid":"paste-fallback-file-input",onChange:L}),f.jsx("input",{ref:w,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",capture:"environment",className:"hidden","data-testid":"paste-fallback-camera-input",onChange:L}),p?f.jsxs("div",{className:"flex flex-col items-center gap-2 p-3 border border-tui-border bg-tui-bg rounded",children:[f.jsx("img",{src:p.dataUrl,alt:"Pasted preview","data-testid":"pasted-image-preview",className:"max-h-40 max-w-full object-contain rounded border border-tui-border"}),f.jsxs("div",{className:"flex items-center justify-between w-full text-tui-xs text-tui-muted pt-1",children:[f.jsx("span",{children:o("clipboard.imageCompressedSize",{size:f1(p.byteLength)})}),f.jsx(Me,{variant:"ghost",onClick:k,"aria-label":o("clipboard.removeImage"),children:o("clipboard.cancel")})]})]}):f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx(Me,{variant:"default",onClick:()=>{var D;return(D=x.current)==null?void 0:D.click()},disabled:y||!!h.trim(),className:"min-h-[44px] px-3 touch-manipulation text-tui-sm font-sans flex-1","aria-label":o("clipboard.chooseImage"),children:o("clipboard.chooseImage")}),f.jsx(Me,{variant:"default",onClick:()=>{var D;return(D=w.current)==null?void 0:D.click()},disabled:y||!!h.trim(),className:"min-h-[44px] px-3 touch-manipulation text-tui-sm font-sans flex-1","aria-label":o("clipboard.takePhoto"),children:o("clipboard.takePhoto")})]}),y&&f.jsx("div",{className:"flex items-center gap-2 text-tui-xs text-tui-muted animate-pulse",children:f.jsx("span",{children:o("clipboard.imageCompressing")})})]})]})})},Zl="tui-focusable group flex h-11 w-full select-none items-center gap-2 border px-2 text-left text-tui transition-colors",Wl="border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",hC=({anchorPoint:l,hasSelection:n,isController:a,vibrateOnKeyPress:s=!1,linkUrl:o=null,onOpenLink:c,onCopySelection:h,onCopyLine:m,onCopyScreen:p,onPaste:g,onClose:y})=>{const{t:v}=Ee(),x=T.useRef(null),[w,S]=T.useState(null);T.useEffect(()=>{if(s&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(8)}catch{}},[s]),T.useLayoutEffect(()=>{const E=x.current;if(!(E!=null&&E.parentElement))return;const k=E.parentElement.getBoundingClientRect(),z=E.getBoundingClientRect(),R=z.width||208,D=z.height||220,j=k.width,H=k.height;let K=l.x-R/2;K=Math.max(8,Math.min(Math.max(8,j-R-8),K));let q=l.y-D-8;q<8&&(q=l.y+8),q=Math.max(8,Math.min(Math.max(8,H-D-8),q)),S({x:K,y:q})},[l.x,l.y,n,a,o]);const M=Math.max(8,l.x-104),N=Math.max(8,l.y-200),L={position:"absolute",left:`${w?w.x:M}px`,top:`${w?w.y:N}px`,visibility:w?"visible":"hidden"};return f.jsx("div",{ref:x,role:"menu","aria-label":"终端选择操作",className:"z-50 w-52 select-none font-mono",style:L,onMouseDown:E=>E.stopPropagation(),onTouchStart:E=>E.stopPropagation(),onPointerDown:E=>E.stopPropagation(),children:f.jsxs(Nt,{tone:"accent",className:"border border-tui-border bg-tui-base p-1.5 shadow-lg",bodyClassName:"flex flex-col gap-1",children:[o&&c&&f.jsxs("button",{type:"button",role:"menuitem",className:ne(Zl,Wl),onClick:()=>{c(o),y()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:ke.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.openLink")}),f.jsx("span",{className:"ml-auto max-w-[45%] truncate text-tui-faint",children:oC(o)})]}),n&&f.jsxs("button",{type:"button",role:"menuitem",className:ne(Zl,Wl),onClick:()=>{h(),y()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:ke.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.copySelection")})]}),f.jsxs("button",{type:"button",role:"menuitem",className:ne(Zl,Wl),onClick:()=>{m(),y()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:ke.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.copyLine")})]}),f.jsxs("button",{type:"button",role:"menuitem",className:ne(Zl,Wl),onClick:()=>{p(),y()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:ke.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.copyScreen")})]}),a&&f.jsxs("button",{type:"button",role:"menuitem",className:ne(Zl,Wl),onClick:()=>{g(),y()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:ke.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.paste")})]}),f.jsxs("button",{type:"button",role:"menuitem",className:ne(Zl,Wl),onClick:y,children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:ke.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.cancel")})]})]})})},mC={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};function pC(){return typeof window<"u"&&new URLSearchParams(window.location.search).get("debug")==="1"}function gC(l){const n=T.useRef([]),[a,s]=T.useState({framesPerSec:0,bytesPerSec:0}),o=T.useCallback(h=>{const m=h-1e3,p=n.current;for(;p.length>0&&p[0].time<m;)p.shift()},[]);T.useEffect(()=>{if(!l)return;const h=setInterval(()=>{o(performance.now());let m=0;for(const p of n.current)m+=p.bytes;s({framesPerSec:n.current.length,bytesPerSec:m})},1e3);return()=>clearInterval(h)},[l,o]);const c=T.useCallback(h=>{const m=performance.now();n.current.push({time:m,bytes:h}),o(m)},[o]);return{metrics:a,record:c}}function bC(l){return l?`${l.kind} row ${l.row} cols ${l.startCol}-${l.endCol} caret ${l.caretCol}`:"none"}function yC(l){var s;const n=(s=l==null?void 0:l.canvas)==null?void 0:s.stats;if(!n)return`paint: ${(l==null?void 0:l.kind)??"-"} renderer
34
+ `;const a=n.lastInputToPaintMs!==null?`${n.lastInputToPaintMs.toFixed(1)}ms`:"-";return`paint: ${n.lastPaintMs.toFixed(2)}ms cells: ${n.lastCells} frames: ${n.frames} held: ${n.heldFrames} key→paint: ${a}
35
+ `}function vC(l){const n=(l==null?void 0:l.getTrace())??[];return n.length===0?"trace: -":`trace:
36
+ ${n.slice(-6).map(a=>` ${a.event}${a.count>1?` ×${a.count}`:""}`).join(`
37
+ `)}`}const xC=({debug:l,rttMs:n,metrics:a,rendererKind:s,predictiveEcho:o,predictor:c,field:h,renderer:m})=>{const p=c==null?void 0:c.getEchoSrttMs();return f.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: ${l.state}
38
+ `,`deltaY: ${l.deltaY} lines: ${l.lines}
39
+ `,`viewportY: ${l.viewportY??"-"} focus: ${l.focused}
40
+ `,`buffer: ${l.bufferType??"-"} base: ${l.baseY??"-"} cursor: ${l.cursorY??"-"} scrollback: ${l.hasScrollback??"-"}
41
+ `,`scroll: ${l.scrollTop??"-"} / ${l.scrollHeight??"-"} (h ${l.clientHeight??"-"}) moved: ${l.moved}
42
+ `,`mode: ${l.scrollMode} calls: ${l.scrollCalls} lines: ${l.lastScrollLines??"-"} mouse: ${l.mouseTracking}
43
+ `,`event: ${l.lastInputEvent||"-"} pointer: ${l.pointerEvents} touch: ${l.touchEvents}
44
+ `,`rtt: ${n!==null?`${n}ms`:"-"} frames/s: ${a.framesPerSec} bytes/s: ${a.bytesPerSec} renderer: ${s??"-"}
45
+ `,`prediction: ${(c==null?void 0:c.getState())??"-"} mode: ${o} pending: ${(c==null?void 0:c.getVisiblePredictions().length)??0} srtt: ${p!=null?`${Math.round(p)}ms`:"-"}
46
+ `,`field: ${bC(h)} mismatches: ${(c==null?void 0:c.getMismatchCount())??0}
47
+ `,yC(m),vC(c)]})};function En(l){const n=T.useRef(l);return n.current=l,n}function wC(l){const n=En(l),{termRef:a,subscribeToPasteFileReady:s}=l,[o,c]=T.useState(!1),h=T.useCallback((v,x)=>{n.current.onPaste(),v.paste(x),n.current.addToast("success",n.current.t("clipboard.pasted"))},[n]),m=T.useCallback(()=>{const v=a.current;return v?n.current.isController?v:(n.current.warnViewerMode(),null):null},[a,n]),p=T.useCallback(async()=>{const v=m();if(v){try{const x=await uC();if(x.ok){await n.current.uploadImage(x.blob);return}}catch{}try{const x=await cC();if(x.ok){h(v,x.text);return}else if(x.reason==="empty"){n.current.addToast("info",n.current.t("clipboard.pasteUnavailable"));return}}catch{}c(!0)}},[m,h,n]),g=T.useCallback(v=>{const x=m();x&&h(x,v)},[m,h]),y=T.useCallback(v=>{m()&&n.current.uploadImage(v)},[m,n]);return T.useEffect(()=>s(v=>{const x=a.current;x&&h(x,v)}),[s,a,h]),{isPasteFallbackOpen:o,closePasteFallback:()=>c(!1),handlePaste:p,handleFallbackPasteSend:g,handleFallbackImageSend:y}}const oo=new Set(["│","┃","║","▐","▕","▏","▌"]),xo=new Set(["┌","┐","└","┘","╭","╮","╰","╯","├","┤","┬","┴","┼","┏","┓","┗","┛","╔","╗","╚","╝","╠","╣","╟","╢","╞","╡"]),SC=new Set(["╭","┌","┏","╔"]),CC=new Set(["╭","┌","┏","╔","├","┣","┠","┝","╟","╠","┞","┟","┡","┢"]),TC=new Set(["╮","┐","┓","╗"]),MC=new Set(["╰","└","┗","╚"]),AC=new Set(["╯","┘","┛","╝"]),ld=new Set(["─","━","═","╌","┄"]),Ey=new Set(["❯","›",">","!"]),Bg=new Set(["$","#","%",">","❯","›","➜","λ","»"]);function Nn(l){return l===""||l===" "||l===" "}class EC{constructor(n){$(this,"cell");$(this,"top");$(this,"bottom");var a;this.screen=n,this.cell=(a=n.getNullCell)==null?void 0:a.call(n),this.top=n.baseY,this.bottom=n.baseY+n.rows-1}get cols(){return this.screen.cols}at(n,a){var s;if(!(n<this.top||n>this.bottom||a<0||a>=this.screen.cols))return(s=this.screen.getLine(n))==null?void 0:s.getCell(a,this.cell)}char(n,a){var s;return((s=this.at(n,a))==null?void 0:s.getChars())??""}dim(n,a){var s,o;return!!((o=(s=this.at(n,a))==null?void 0:s.isDim)!=null&&o.call(s))}text(n,a,s){var o;return n<this.top||n>this.bottom?"":((o=this.screen.getLine(n))==null?void 0:o.translateToString(!0,a,s))??""}isEdge(n,a){if(!oo.has(this.char(n,a)))return!1;const s=this.char(n-1,a),o=this.char(n+1,a);return oo.has(s)||xo.has(s)||oo.has(o)||xo.has(o)}blankOrDim(n,a,s){var o;for(let c=a;c<s;c++){const h=this.at(n,c);if(h&&!Nn(h.getChars())&&!((o=h.isDim)!=null&&o.call(h)))return!1}return!0}}function NC(l,n,a){if(l.isEdge(n,a))return null;let s=0;for(let c=a-1;c>=0;c--)if(l.isEdge(n,c)){s=c+1;break}let o=l.cols;for(let c=a+1;c<l.cols;c++)if(l.isEdge(n,c)){o=c;break}return s<o?{start:s,end:o}:null}const Ed=8,kC=12,Nd=2,Ug=1,LC=4,_C=3,RC=20,Kg=/-- INSERT --/,jC=/-- (?:NORMAL|VISUAL(?: LINE| BLOCK)?|REPLACE) --/,OC=/Esc to cancel|Enter to (?:confirm|select)|to navigate|Space to (?:change|toggle|select)/i,DC=/^\s*\d+[.)]\s/;function Ig(l,n,a){if(!ld.has(l.char(n,a.start))||!ld.has(l.char(n,a.end-1))||xo.has(l.char(n,a.start-1)))return!1;const s=a.end-a.start;let o=0;for(let c=a.start;c<a.end;c++)if(ld.has(l.char(n,c)))o++;else if(c-a.start-o>s*.1)return!1;return o>=s*.9}function ca(l){return`${l.start}-${l.end}`}function Ny(l,n,a){if(a.start===0)return l.top;for(let s=n-1;s>=l.top;s--)if(CC.has(l.char(s,a.start-1)))return s;return l.top}function zC(l,n,a){const s=a.start-1,o=a.end,{row:c}=n;if(s<0||o>=l.cols)return null;const h=l.char(c,s);if(!oo.has(h)||l.char(c,o)!==h)return null;let m=c-1;for(;m>=l.top&&l.char(m,s)===h;)m--;let p=c+1;for(;p<=l.bottom&&l.char(p,s)===h;)p++;if(p-m-1>Ed||!SC.has(l.char(m,s))||!TC.has(l.char(m,o))||!MC.has(l.char(p,s))||!AC.has(l.char(p,o))||l.dim(c,s))return null;const g=a.start+Ug,y=a.end-Ug;return n.col<g||n.col>=y?null:{kind:"frame",key:`frame:${ca(a)}`,region:ca(a),layout:`${m}`,row:c,caretCol:n.col,startCol:g,endCol:y,empty:m+2===p&&n.col===g&&l.blankOrDim(c,g,y),agentLike:!0,vimInsert:null,modal:!1,midWord:!1}}function HC(l,n,a){const{row:s}=n;let o=-1;for(let y=s-1;y>=Math.max(l.top,s-Ed);y--)if(Ig(l,y,a)){o=y;break}if(o<0)return null;let c=-1;for(let y=s+1;y<=Math.min(l.bottom,s+Ed);y++)if(Ig(l,y,a)){c=y;break}if(c<0)return null;const h=o+1;let m=-1;for(let y=a.start;y<Math.min(a.end,a.start+3);y++){const v=l.char(h,y);if(!Nn(v)){Ey.has(v)&&Nn(l.char(h,y+1))&&(m=y);break}}if(m<0||l.dim(h,m)||DC.test(l.text(h,m+1,a.end)))return null;for(let y=h+1;y<c;y++)for(let v=a.start;v<a.start+Nd;v++)if(!Nn(l.char(y,v)))return null;let p="";for(let y=c+1;y<=Math.min(l.bottom,c+kC)&&!xo.has(l.char(y,a.start-1));y++)p+=`${l.text(y,a.start,a.end)}
48
+ `;if(OC.test(p)||jC.test(p))return null;const g=s===h?m+2:a.start+Nd;return n.col<g||n.col>=a.end?null:{kind:"rule",key:`rule:${ca(a)}:${Ny(l,o,a)}`,region:ca(a),layout:`${o}`,row:s,caretCol:n.col,startCol:g,endCol:a.end,empty:c-o===2&&n.col===g&&l.blankOrDim(s,g,a.end),agentLike:!0,vimInsert:Kg.test(p),modal:Kg.test(p),midWord:!1}}function BC(l,n,a){if(n.hidden)return null;const{row:s,col:o}=n,c=UC(l,n,a);if(c!==void 0)return c;for(let h=o-1;h>=a.start;h--){if(l.char(s,h)!==">")continue;const m=l.text(s,a.start,h+1).trimStart();if(/^(?:[a-z]:\\.*|\\\\[^\\]+\\[^\\]+.*|PS\s+[a-z]:\\.*)>$/i.test(m))return co(l,n,a,s,h+1,!1)}for(let h=o-2;h>=a.start;h--)if(!(!Bg.has(l.char(s,h))||!Nn(l.char(s,h+1))))return l.dim(s,h)?null:co(l,n,a,s,h+2,h===a.start);for(let h=s-1;h>=Math.max(l.top,s-_C);h--){let m=a.end-1;for(;m>=a.start&&Nn(l.char(h,m));)m--;if(m>=a.end-1-LC&&Bg.has(l.char(h,m)))return l.dim(h,m)?null:co(l,n,a,h,a.start,!1);if(m<a.end-1)return null}return null}function UC(l,n,a){const{row:s}=n,o=a.start+Nd,c=h=>Nn(l.char(h,a.start))&&Nn(l.char(h,a.start+1));if(c(s))for(let h=s-1;h>=Math.max(l.top,s-RC);h--){if(Ey.has(l.char(h,a.start))&&Nn(l.char(h,a.start+1)))return l.dim(h,a.start)?null:co(l,n,a,h,o,!0,o);if(!c(h)||l.blankOrDim(h,o,a.end))return}}function co(l,n,a,s,o,c,h=a.start){const m=n.row===s?o:h;if(n.col<m||n.col>=a.end)return null;const p=a.end-2,g=n.row>s&&h>a.start&&n.col===m&&!Nn(l.char(n.row-1,p));return{kind:"prompt",key:`prompt:${ca(a)}:${Ny(l,s,a)}`,region:ca(a),layout:`${s}`,row:n.row,caretCol:n.col,startCol:m,endCol:a.end,empty:n.row===s&&n.col===m&&l.blankOrDim(n.row,m,a.end),agentLike:c,vimInsert:null,modal:!1,midWord:g}}function KC(l,n){const a=new EC(l);if(n.row<a.top||n.row>a.bottom||n.col<0||n.col>=l.cols)return null;const s=NC(a,n.row,n.col);return s?zC(a,n,s)??HC(a,n,s)??BC(a,n,s):null}class IC{constructor(){$(this,"insertSeen",new Set)}detect(n,a){const s=KC(n,a);return!s||s.vimInsert===null?s:s.vimInsert?(this.insertSeen.add(s.region),s):this.insertSeen.has(s.region)?null:s}reset(){this.insertSeen.clear()}}class FC{constructor(n){$(this,"tracker",new IC);$(this,"cached");$(this,"lastComplete",null);$(this,"detect",()=>{var n,a;if((a=(n=this.options).isSynchronizing)!=null&&a.call(n))return this.lastComplete;if(this.cached===void 0){const s=this.options.getScreen(),o=this.options.getCursor();this.cached=s&&o?this.tracker.detect(s,o):null,this.lastComplete=this.cached}return this.cached});this.options=n}invalidate(){this.cached=void 0}reset(){this.tracker.reset(),this.cached=void 0,this.lastComplete=null}}const Jl=4294967295;var Qe=(l=>(l[l.CODEPOINT_MASK=2097151]="CODEPOINT_MASK",l[l.IS_COMBINED_MASK=2097152]="IS_COMBINED_MASK",l[l.WIDTH_SHIFT=22]="WIDTH_SHIFT",l))(Qe||{}),Je=(l=>(l[l.PCOLOR_MASK=255]="PCOLOR_MASK",l[l.CM_MASK=50331648]="CM_MASK",l[l.CM_DEFAULT=0]="CM_DEFAULT",l[l.CM_P16=16777216]="CM_P16",l[l.CM_P256=33554432]="CM_P256",l[l.CM_RGB=50331648]="CM_RGB",l[l.RGB_MASK=16777215]="RGB_MASK",l))(Je||{}),st=(l=>(l[l.INVERSE=67108864]="INVERSE",l[l.BOLD=134217728]="BOLD",l[l.UNDERLINE=268435456]="UNDERLINE",l[l.BLINK=536870912]="BLINK",l[l.INVISIBLE=1073741824]="INVISIBLE",l[l.STRIKETHROUGH=2147483648]="STRIKETHROUGH",l))(st||{}),ji=(l=>(l[l.ITALIC=67108864]="ITALIC",l[l.DIM=134217728]="DIM",l[l.HAS_EXTENDED=268435456]="HAS_EXTENDED",l[l.PROTECTED=536870912]="PROTECTED",l[l.OVERLINE=1073741824]="OVERLINE",l))(ji||{}),ea=(l=>(l[l.NONE=0]="NONE",l[l.SINGLE=1]="SINGLE",l[l.DOUBLE=2]="DOUBLE",l[l.CURLY=3]="CURLY",l[l.DOTTED=4]="DOTTED",l[l.DASHED=5]="DASHED",l))(ea||{});function GC(){return{content:0,fg:0,bg:0,combinedData:"",extended:void 0}}const wo={fg:0,bg:0,ext:0};function ky(l){return l.bg&268435456&&l.extended?l.extended.ext>>>0:0}function YC(l){return l>>>26&7}function PC(l){return l&67108863}function $C(l,n){const a=l.codePointAt(0)??0;return l.length>0&&String.fromCodePoint(a).length===l.length?{content:a|n<<22,combinedData:""}:{content:2097152|n<<22,combinedData:l}}function So(l){const n=l;return!n||typeof n.fg!="number"||typeof n.bg!="number"?null:{fg:n.fg>>>0,bg:n.bg>>>0,ext:ky(n)}}const io=new Map;function Ly(l){let n=io.get(l);return n===void 0&&(n=`#${(l&Je.RGB_MASK).toString(16).padStart(6,"0")}`,io.size>4096&&io.clear(),io.set(l,n)),n}function _y(l,n,a){var s;switch(l&Je.CM_MASK){case Je.CM_P16:case Je.CM_P256:return((s=n.ansi[l&Je.PCOLOR_MASK])==null?void 0:s.css)??a;case Je.CM_RGB:return Ly(l&Je.RGB_MASK);default:return a}}function gs(l,n,a,s){var v;const o=(l&st.INVERSE)!==0,c=o?n:l,h=o?l:n;let m;const p=c&Je.CM_MASK;if(p===Je.CM_P16||p===Je.CM_P256){let x=c&Je.PCOLOR_MASK;s&&l&st.BOLD&&x<8&&(x+=8),m=((v=a.ansi[x])==null?void 0:v.css)??a.foreground.css}else p===Je.CM_RGB?m=Ly(c&Je.RGB_MASK):m=o?a.background.css:a.foreground.css;const g=h&Je.CM_MASK,y=g===Je.CM_DEFAULT?o?a.foreground.css:a.background.css:_y(h,a,a.background.css);return{fg:m,bg:y,bgIsDefault:!o&&g===Je.CM_DEFAULT}}function la(l){return(l&st.BOLD)!==0}function bs(l){return(l&ji.ITALIC)!==0}function Ts(l){return(l&ji.DIM)!==0}function ta(l){return(l&st.INVISIBLE)!==0}function Ry(l){var a,s,o,c;const n=l._core;return!(n!=null&&n.screenElement)||!n.coreService||!((a=n.optionsService)!=null&&a.rawOptions)||!((s=n._bufferService)!=null&&s.buffer)||!n._charSizeService||!n._coreBrowserService||!((o=n._themeService)!=null&&o.colors)||typeof((c=n._renderService)==null?void 0:c.setRenderer)!="function"?null:n}class VC{constructor(){$(this,"listeners",new Set);$(this,"event",n=>(this.listeners.add(n),{dispose:()=>this.listeners.delete(n)}))}fire(n){for(const a of[...this.listeners])a(n)}dispose(){this.listeners.clear()}}class qC{constructor(n){$(this,"provider",null);$(this,"core");$(this,"layer");$(this,"subscriptions",[]);var s;this.terminal=n,this.core=Ry(n);const a=(s=this.core)==null?void 0:s.screenElement;this.layer=a?a.ownerDocument.createElement("div"):null,a&&this.layer&&(this.layer.setAttribute("aria-hidden","true"),Object.assign(this.layer.style,{position:"absolute",inset:"0",pointerEvents:"none",zIndex:"7",overflow:"hidden"}),a.append(this.layer),this.subscriptions.push(n.onRender(()=>this.invalidateOverlay()),n.onScroll(()=>this.invalidateOverlay())))}setOverlayProvider(n){this.provider=n,this.invalidateOverlay()}invalidateOverlay(){var y,v,x,w;const n=this.core,a=this.layer,s=n==null?void 0:n.screenElement;if(!n||!a||!s)return;a.replaceChildren(),delete s.dataset.predictiveEcho;const o=(y=this.provider)==null?void 0:y.call(this),c=(v=n._renderService.dimensions)==null?void 0:v.css.cell;if(!(o!=null&&o.cells.length)||!(c!=null&&c.width)||!c.height)return;const h=n.optionsService.rawOptions,m=n._themeService.colors,p=this.terminal.buffer.active,g=S=>{const M=S.row-p.viewportY;if(M<0||M>=this.terminal.rows)return null;const N=s.ownerDocument.createElement("span"),L=gs(S.style.fg,S.style.bg,m,h.drawBoldTextInBrightColors);return N.textContent=ta(S.style.fg)?" ":S.chars,Object.assign(N.style,{position:"absolute",left:`${S.col*c.width}px`,top:`${M*c.height}px`,width:`${S.width*c.width}px`,height:`${c.height}px`,lineHeight:`${c.height}px`,whiteSpace:"pre",color:Ts(S.style.bg)?`color-mix(in srgb, ${L.fg} 50%, ${L.bg})`:L.fg,backgroundColor:L.bg,fontFamily:h.fontFamily,fontSize:`${h.fontSize}px`,fontWeight:String(la(S.style.fg)?h.fontWeightBold:h.fontWeight),fontStyle:bs(S.style.bg)?"italic":"normal",textDecoration:S.style.fg&st.UNDERLINE?"underline":"none"}),a.append(N),N};if(o.cursor){s.dataset.predictiveEcho="true";const S=s.ownerDocument.createElement("style");S.textContent=".xterm-screen[data-predictive-echo] .xterm-cursor { visibility: hidden; }",a.append(S);const M=p.baseY+p.cursorY,N=(x=p.getLine(M))==null?void 0:x.getCell(p.cursorX);g({row:M,col:p.cursorX,chars:(N==null?void 0:N.getChars())||" ",width:(N==null?void 0:N.getWidth())===2?2:1,style:So(N)??wo})}for(const S of o.cells)g(S);if(o.cursor){const{row:S,col:M}=o.cursor,N=(w=p.getLine(S))==null?void 0:w.getCell(M),L=[...o.cells].reverse().find(k=>k.row===S&&k.col===M),E=g(L??{row:S,col:M,chars:(N==null?void 0:N.getChars())||" ",width:1,style:So(N)??wo});if(E){const k=h.cursorStyle;if(!n._coreBrowserService.isFocused||k!=="block"){E.style.backgroundColor="transparent",E.textContent="",E.style.boxSizing="border-box";const z=k==="bar"?"borderLeft":k==="underline"?"borderBottom":"border";E.style[z]=`${k==="bar"&&h.cursorWidth||1}px solid ${m.cursor.css}`}else E.style.color=m.cursorAccent.css,E.style.backgroundColor=m.cursor.css}}}dispose(){var n,a;this.provider=null;for(const s of this.subscriptions)s.dispose();(n=this.layer)==null||n.remove(),(a=this.core)!=null&&a.screenElement&&delete this.core.screenElement.dataset.predictiveEcho}}class XC{constructor(n){$(this,"items",[]);$(this,"target",null);$(this,"domTarget",null);$(this,"provider",()=>this.paint());this.options=n}attach(n){var a;if(!n){const s=this.options.getTerminal();s&&(n=this.domTarget??(this.domTarget=new qC(s)))}this.target!==n&&((a=this.target)==null||a.setOverlayProvider(null),this.target=n,n==null||n.setOverlayProvider(this.provider))}sync(n){var a;n.length===0&&this.items.length===0||(this.items=n,(a=this.target)==null||a.invalidateOverlay())}clear(){var n;this.items.length!==0&&(this.items=[],(n=this.target)==null||n.invalidateOverlay())}hasItems(){return this.items.length>0}dispose(){var n,a;(n=this.target)==null||n.setOverlayProvider(null),this.target=null,(a=this.domTarget)==null||a.dispose(),this.domTarget=null,this.items=[]}paint(){var x,w;const n=this.options.getTerminal(),a=n==null?void 0:n.buffer.active;if(!n||!a)return null;const s=this.options.isCursorHidden(),o=a.baseY+a.cursorY,c=a.cursorX,h=kd(n,o,c),m=s&&!!h&&jy(h);if(this.items.length===0){if(!m)return null;const S=((w=(x=a.getLine(o))==null?void 0:x.getCell(c))==null?void 0:w.getChars())??"";return{cells:[],paintedCaret:Fg(o,c,S,h)}}const p=[];let g,y;for(const S of this.items)switch(S.kind){case"char":p.push({row:S.row,col:S.col,chars:S.char,width:S.width,style:S.style??WC(n,S.row,S.col)});break;case"erase":p.push({row:S.row,col:S.col,chars:" ",width:S.width,style:ZC(S.style??kd(n,S.row,S.col)??wo)});break;case"mask":m&&S.row===o&&S.col===c&&p.push({row:S.row,col:S.col,chars:S.char,width:1,style:S.style??Oy(h)});break;case"caret":s?m&&(p.push({row:S.row,col:S.col,chars:S.char,width:1,style:h}),y=Fg(S.row,S.col,S.char,h)):g={row:S.row,col:S.col};break}const v={cells:p};return g!==void 0&&(v.cursor=g),y&&(v.paintedCaret=y),v}}function Fg(l,n,a,s){return{row:l,col:n,style:s,plain:{row:l,col:n,chars:a||" ",width:1,style:Oy(s)}}}function kd(l,n,a){var s;return a<0||a>=l.cols?null:So((s=l.buffer.active.getLine(n))==null?void 0:s.getCell(a))}function jy(l){return(l.fg&st.INVERSE)!==0||(l.bg&Je.CM_MASK)!==Je.CM_DEFAULT}function Oy(l){return{fg:l.fg&~st.INVERSE,bg:l.bg&~(Je.CM_MASK|Je.RGB_MASK),ext:l.ext}}function ZC(l){return{fg:l.fg&st.INVERSE?l.fg&(st.INVERSE|Je.CM_MASK|Je.RGB_MASK):0,bg:l.bg&(Je.CM_MASK|Je.RGB_MASK),ext:0}}function WC(l,n,a){const s=kd(l,n,a-1);return s&&!jy(s)&&!(s.bg&ji.DIM)?s:wo}const Dy="\x1B",QC=/^\x1b\[[IO]/,zy=/^\x1b\[<(\d+);\d+;\d+[Mm]/,JC=/^\x1b\[M[\s\S]{3}/,eT=[/^\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\\/],tT=/^\x1b\[1;[2-8]R/;function Gg(l){if(tT.test(l))return 0;const n=QC.exec(l);if(n)return n[0].length;const a=zy.exec(l);if(a){const s=Number(a[1]);return(s&32)!==0&&(s&3)===3&&(s&64)===0?a[0].length:0}for(const s of eT){const o=s.exec(l);if(o)return o[0].length}return 0}function Hy(l){if(!l.startsWith(Dy))return"keys";if(zy.test(l)||JC.test(l)){let a=l;for(;a.length>0;){const s=Gg(a);if(s===0)return"pointer";a=a.slice(s)}return"passive"}let n=l;for(;n.length>0;){const a=Gg(n);if(a===0)return"keys";n=n.slice(a)}return"passive"}function nT(l){return l===Dy}function Qn(l){return l===""||l===" "?" ":l}function iT(l,n,a,s=64){var h;const o=l.buffer.active.getLine(n),c=[];for(let m=a-1;m>=0&&c.length<s;m--){const p=o==null?void 0:o.getCell(m);if(!p)break;((h=p.getWidth)==null?void 0:h.call(p))!==0&&c.unshift(Qn(p.getChars()))}return c}function lT(l,n){for(let a=Math.min(l.length,n.length);a>0;a--){let s=!0;for(let o=0;o<a&&s;o++)s=n[n.length-a+o]===Qn(l[o]);if(s)return a}return 0}function aT(l){const n=l.buffer.active;return{key:"legacy",row:n.baseY+n.cursorY,caretCol:n.cursorX,startCol:n.cursorX,endCol:l.cols,empty:!1,agentLike:!1}}function sT(l,{style:n,predictedCursor:a,field:s,runStartedEmpty:o,active:c}){var w,S,M,N,L;const h=l.map(E=>{const k={row:E.row,col:E.col,char:E.cancelled?" ":E.char,width:E.width,kind:E.cancelled?"erase":E.kind};return n&&(k.style=n),k}),m=l[l.length-1],p=a??{row:m.row,col:m.kind==="erase"||m.cancelled?m.col:m.col+m.width},g=(E,k)=>h.some(z=>z.row===E&&z.col<=k&&k<z.col+z.width),y=l.some(E=>E.kind==="char"&&!E.cancelled);if(c&&s&&o&&y&&s.agentLike&&p.row===s.row){const E=c.getLine(p.row);for(let k=p.col;k<s.endCol;k++){if(g(p.row,k)||Qn(((w=E==null?void 0:E.getCell(k))==null?void 0:w.getChars())??"")===" ")continue;const z={row:p.row,col:k,char:" ",width:1,kind:"erase"};n&&(z.style=n),h.push(z)}}if(c){const E={row:c.baseY+c.cursorY,col:c.cursorX};if(!g(E.row,E.col)&&(E.row!==p.row||E.col!==p.col)){const k=((M=(S=c.getLine(E.row))==null?void 0:S.getCell(E.col))==null?void 0:M.getChars())??"",z={row:E.row,col:E.col,char:Qn(k),width:1,kind:"mask"};n&&(z.style=n),h.push(z)}}const v=h.find(E=>E.row===p.row&&E.col===p.col&&E.kind!=="mask"),x=v?v.char:Qn(((L=(N=c==null?void 0:c.getLine(p.row))==null?void 0:N.getCell(p.col))==null?void 0:L.getChars())??"");return h.push({row:p.row,col:p.col,char:x,width:1,kind:"caret"}),h}const rT=[[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 By(l){if(l>=32&&l<=126)return 1;if(l<12288)return 0;for(const[n,a]of rT){if(l<n)return 0;if(l<=a)return 2}return 0}const Ld=["ctrl+b"],oT=new Map([["meta","alt"],["bs","backspace"],["minus","-"],["comma",","],["period","."],["slash","/"],["quote","'"],["double_quote",'"'],["double-quote",'"'],["semicolon",";"],["colon",":"],["percent","%"],["ampersand","&"],["backtick","`"]]),Uy=["ctrl","control"],Ky=["alt","option","meta"],cT=[...Uy,...Ky,"shift"];function Yg(l){const n=l.split("+"),a=[];try{a.push(...gn(n.map(c=>oT.get(c)??c).join("+")))}catch(c){if(c instanceof pn)return[];throw c}if(a.length!==1)return[];const s=n.find(c=>!cT.includes(c)),o=s==="space"?" ":s;if((o==null?void 0:o.length)===1&&n.some(c=>Uy.includes(c))){const c=zd(o);c!==o&&a.push(n.some(h=>Ky.includes(h))?`\x1B${c}`:c)}return a}class Pg{constructor(n){$(this,"sequences");const a=new Set(n.flatMap(Yg));this.sequences=a.size>0?[...a]:[...new Set(Ld.flatMap(Yg))]}startsAt(n,a){return this.sequences.some(s=>n.startsWith(s,a))}}function uT(l){let n,a=new Pg(Ld);return()=>{const s=l==null?void 0:l();return s!==n&&(n=s,a=new Pg(s??Ld)),a}}const $g=8,dT=1500,fT=4e3,hT=20;class mT{constructor(n){$(this,"getTerminal");$(this,"getFieldOption");$(this,"charWidth");$(this,"herdrPrefix");$(this,"now");$(this,"textDecoder",new TextDecoder("utf-8"));$(this,"confidentKeys",new Set);$(this,"fieldStyles",new Map);$(this,"field",null);$(this,"runStartedEmpty",!1);$(this,"predictions",[]);$(this,"predictedCursor",null);$(this,"srtt",null);$(this,"isSuppressed",!1);$(this,"suppressCursor",null);$(this,"suppressSentAt",0);$(this,"inFlight",[]);$(this,"inFlightUnknown",!1);$(this,"runInFlight",[]);$(this,"probationRun",!1);$(this,"runSent",[]);$(this,"lastSentUndrawn",!1);$(this,"awaitingPrefixCommand",!1);$(this,"mismatches",0);$(this,"trace",[]);this.getTerminal=n.getTerminal,this.getFieldOption=n.getField,this.charWidth=n.charWidth,this.herdrPrefix=uT(n.getHerdrPrefixKeys),this.now=n.now??(typeof performance<"u"&&typeof performance.now=="function"?()=>performance.now():()=>Date.now())}updateSuppression(n){if(!this.isSuppressed)return;if(this.predictions.some(s=>s.frozenFrom)){this.suppressSentAt=this.now();return}!!n&&!!this.suppressCursor&&(n.row!==this.suppressCursor.row||n.col!==this.suppressCursor.col)?this.liftSuppression():this.stillSuppressed()}reset(n,a){var c;this.predictions=[],this.predictedCursor=null;const s=typeof a=="boolean"?a:(a==null?void 0:a.suppress)??!0,o=typeof a=="object"&&(a==null?void 0:a.demote)===!0;if(this.note(`reset: ${n??"unspecified"}`),o){const h=this.field??((c=this.getFieldOption)==null?void 0:c.call(this))??null;h&&this.confidentKeys.delete(h.key)}if(this.forgetInFlight(),s){this.isSuppressed=!0,this.suppressSentAt=this.now();const h=this.getTerminal();h?this.suppressCursor={row:h.buffer.active.baseY+h.buffer.active.cursorY,col:h.buffer.active.cursorX}:this.suppressCursor=null}else this.isSuppressed=!1,this.suppressCursor=null}forgetConfidence(){this.confidentKeys.clear(),this.fieldStyles.clear(),this.field=null}getState(){return this.field&&this.confidentKeys.has(this.field.key)?"confident":"tentative"}getField(){return this.field}getMismatchCount(){return this.mismatches}getEchoSrttMs(){return this.srtt}getExpiryDelayMs(){if(this.predictions.length===0)return null;const n=Math.min(...this.predictions.map(a=>a.sentAt));return Math.max(1,n+this.predictionTimeout()-this.now()+1)}getTrace(){return this.trace}visiblePredictions(){const n=this.getState()==="confident";return this.predictions.filter(a=>a.frozenFrom?a.shownWhenFrozen:n&&!a.probation)}freeze(n,a={}){var p;const s=this.getTerminal(),o=s?{row:s.buffer.active.baseY+s.buffer.active.cursorY,col:s.buffer.active.cursorX}:null,c=this.getState()==="confident";this.predictions=this.predictions.filter(g=>!g.cancelled);for(const g of this.predictions)g.frozenFrom||(g.frozenFrom=o??{row:g.row,col:g.col},g.shownWhenFrozen=c&&!g.probation);const h=this.predictedCursor?{...this.predictedCursor}:o,m=this.inFlight.length>0||this.inFlightUnknown||this.lastSentUndrawn||this.probationRun&&this.runSent.length===0;if(this.predictedCursor=null,this.note(`freeze: ${n}${a.demote?" (demote)":""}`),a.demote){const g=this.field??((p=this.getFieldOption)==null?void 0:p.call(this))??null;g&&this.confidentKeys.delete(g.key)}this.isSuppressed=!0,this.suppressSentAt=this.now(),this.suppressCursor=h,this.forgetInFlight(),this.inFlightUnknown=m}forgetInFlight(){this.inFlight=[],this.inFlightUnknown=!1,this.runInFlight=[],this.runSent=[],this.probationRun=!1,this.lastSentUndrawn=!1}suppressTimeout(){return Math.max(300,(this.srtt??300)*1.5)}predictionTimeout(){return Math.min(fT,Math.max(dT,(this.srtt??0)*4))}stillSuppressed(){return this.isSuppressed?this.now()-this.suppressSentAt>=this.suppressTimeout()?(this.liftSuppression(),!1):!0:!1}liftSuppression(){this.isSuppressed=!1,this.suppressCursor=null}assumedWidth(n){var s;const a=(s=this.charWidth)==null?void 0:s.call(this,n);return a===0||a===1||a===2?a:1}coveredByPrediction(n,a){return this.predictions.some(s=>(s.echoed||s.cancelled||s.kind==="erase"&&!s.frozenFrom)&&s.row===n&&s.col<=a&&a<s.col+s.width)}ensureField(n){if(this.predictedCursor&&this.field)return this.field;const a=this.getFieldOption?this.getFieldOption():aT(n);if(!a)return null;let s=a.caretCol,o=[],c=this.inFlightUnknown;if(this.inFlight.length>0&&!this.inFlightUnknown){o=this.inFlight.slice(lT(this.inFlight,iT(n,a.row,s)));for(const h of o){const m=h.codePointAt(0)??0;s+=By(m)||this.assumedWidth(m)}c=o.length>0}return this.inFlight=[],this.inFlightUnknown=!1,this.field=a,this.runStartedEmpty=a.empty&&o.length===0,this.predictions=this.predictions.filter(h=>h.frozenFrom),this.predictedCursor={row:a.row,col:s},this.runInFlight=o,this.probationRun=c,this.runSent=[],a}confirm(n,a){if(this.updateSrtt(Math.max(0,this.now()-n.sentAt)),a&&!n.frozenFrom&&this.markConfident(a.key),n.probation&&n.kind==="char"){for(const s of this.predictions)s.probation=void 0;this.probationRun=!1,this.runInFlight=[],this.runSent=[]}}learnStyle(n,a){const s=So(a);if(s)for(this.fieldStyles.delete(n),this.fieldStyles.set(n,s);this.fieldStyles.size>$g;){const o=this.fieldStyles.keys().next().value;if(o===void 0)break;this.fieldStyles.delete(o)}}markConfident(n){for(this.confidentKeys.delete(n),this.confidentKeys.add(n);this.confidentKeys.size>$g;){const a=this.confidentKeys.values().next().value;if(a===void 0)break;this.confidentKeys.delete(a)}}mismatch(n){this.mismatches++,this.note(`mismatch: ${n}`),this.predictions=[],this.predictedCursor=null,this.field&&this.confidentKeys.delete(this.field.key),this.isSuppressed=!1,this.suppressCursor=null}note(n){const a=this.trace[this.trace.length-1];if(a&&a.event===n){a.count++,a.at=this.now();return}this.trace.push({at:this.now(),event:n,count:1}),this.trace.length>hT&&this.trace.shift()}pruneExpired(){if(this.predictions.length===0)return;const n=this.now(),a=this.predictionTimeout(),s=this.predictions.filter(o=>n-o.sentAt<=a);s.length!==this.predictions.length&&(this.note("expired without an echo"),this.predictions=s,this.predictions.length===0&&(this.predictedCursor=null))}updateSrtt(n){this.srtt===null?this.srtt=n:this.srtt=this.srtt*.8+n*.2}}const pT="?!#";class gT extends mT{handlePrintable(n,a,s){var S;const o=this.ensureField(s);if(!o||!this.predictedCursor)return this.note("refused: caret is not in an input field"),!1;const c=this.predictedCursor,h=this.predictions.every(M=>M.frozenFrom||M.cancelled)&&c.col===o.caretCol;if(o.agentLike&&o.empty&&h&&pT.includes(n))return this.freeze("agent mode switch"),!1;if(o.midWord&&h)return this.freeze("the word above may move down"),!1;if(c.col+a>o.endCol-1)return this.freeze("cursor would reach the edge of the field"),!1;const m=(S=s.buffer.active.getLine(c.row))==null?void 0:S.getCell(c.col),p=[Qn(m?m.getChars():"")],g=this.predictions.findIndex(M=>M.kind==="erase"&&!M.frozenFrom&&M.row===c.row&&M.col===c.col);let y;g>=0&&([y]=this.predictions.splice(g,1),p.push(...y.before," "));for(const M of this.predictions)M.cancelled&&M.row===c.row&&M.col===c.col&&p.push(M.char);const v=s.buffer.active,x=v.baseY+v.cursorY,w=x>c.row||x===c.row&&v.cursorX>c.col;return this.predictions.push({row:c.row,col:c.col,char:n,width:a,kind:"char",before:p,sentAt:this.now(),replaces:y,probation:this.probationRun||void 0,behindCaret:w||void 0}),this.probationRun&&this.runSent.push(n),this.lastSentUndrawn=!1,c.col+=a,!0}skipUnpredictable(n,a,s){const o=this.ensureField(s),c=this.predictedCursor;if(!o||!c)return this.note("refused: caret is not in an input field"),!1;const h=this.assumedWidth(a);return c.col+h>o.endCol-1?(this.freeze("cursor would reach the edge of the field"),!1):(this.probationRun||(this.probationRun=!0,this.runSent=[]),this.runSent.push(n),this.lastSentUndrawn=!0,c.col+=h,this.note("width unknown: guessing"),!0)}handleBackspace(n){var s,o,c;let a;for(let h=this.predictions.length-1;h>=0&&!a;h--)this.predictions[h].cancelled||(a=this.predictions[h]);if(this.predictedCursor&&a&&!a.frozenFrom&&!a.echoed&&a.kind==="char"&&a.row===this.predictedCursor.row&&a.col+a.width===this.predictedCursor.col)return a.cancelled=!0,a.probation&&this.runSent.pop(),this.predictedCursor.col=a.col,a.replaces&&(this.predictions.splice(this.predictions.indexOf(a),0,a.replaces),a.replaces=void 0),!0;if(this.stillSuppressed())this.inFlightUnknown=!0;else{const h=this.ensureField(n),m=this.predictedCursor;if(h&&m){const p=n.buffer.active.getLine(m.row),g=p==null?void 0:p.getCell(m.col-1),y=g&&((s=g.getWidth)==null?void 0:s.call(g))===0?2:1,v=m.col-y;let x=!0;for(let S=m.col;S<h.endCol&&x;S++)x=this.coveredByPrediction(m.row,S)||Qn(((o=p==null?void 0:p.getCell(S))==null?void 0:o.getChars())??"")===" ";const w=Qn(((c=p==null?void 0:p.getCell(v))==null?void 0:c.getChars())??"");if(v>=h.startCol&&x&&w!==" ")return this.predictions=this.predictions.filter(S=>!(S.echoed&&S.row===m.row&&S.col+S.width>v)),this.predictions.push({row:m.row,col:v,char:" ",width:y,kind:"erase",before:[w],sentAt:this.now(),probation:this.probationRun||void 0}),this.lastSentUndrawn=!1,m.col=v,!0}}return this.freeze("backspace into server content"),!1}}class bT extends gT{handleUserInput(n){var p;if(this.pruneExpired(),n.length===0)return;const a=this.textDecoder.decode(n,{stream:!1});if(!a)return;const s=Hy(a);if(s==="passive")return;if(s==="pointer"){this.freeze("pointer");return}if(this.awaitingPrefixCommand){this.awaitingPrefixCommand=!1,this.freeze("Herdr prefix command",{demote:!0});return}const o=this.herdrPrefix();if(nT(a)&&!o.startsAt(a,0)){const g=this.field??((p=this.getFieldOption)==null?void 0:p.call(this))??null;this.freeze("escape",{demote:(g==null?void 0:g.modal)!==!1});return}const c=this.getTerminal();if(!c){this.reset("terminal unavailable",!0);return}const h=Array.from(a);let m=0;for(let g=0;g<h.length;g++){const y=h[g],v=y.codePointAt(0);if(v===void 0)continue;const x=m;if(m+=y.length,o.startsAt(a,x)){this.awaitingPrefixCommand=!0,this.freeze("Herdr prefix",{demote:!0});return}if(v===27||v===9||v===10||v===13||v<32&&v!==8){this.freeze("control or escape sequence");return}if(v===8||v===127){if(!this.handleBackspace(c)){g<h.length-1&&(this.inFlightUnknown=!0);return}continue}if(this.stillSuppressed()){this.inFlight.push(y),this.note("refused: waiting for the caret to move");continue}const w=By(v);if(w===0){if(!this.skipUnpredictable(y,v,c)){g<h.length-1&&(this.inFlightUnknown=!0);return}continue}if(!this.handlePrintable(y,w,c)){g<h.length-1&&(this.inFlightUnknown=!0);return}}}onServerOutput(){const n=this.getTerminal(),a=n?{row:n.buffer.active.baseY+n.buffer.active.cursorY,col:n.buffer.active.cursorX}:null;this.pruneExpired(),n&&a&&this.predictions.length>0&&this.settle(n,a),this.field&&this.getFieldOption&&!this.getFieldOption()&&(this.reset("left input field",{suppress:!1,demote:!0}),this.field=null),this.updateSuppression(a)}settle(n,a){var h,m;const s=this.field;if(this.getFieldOption){const p=this.getFieldOption();if(!p||p.key!==(s==null?void 0:s.key)){if(this.predictions.every(g=>g.frozenFrom||g.echoed||g.cancelled)){this.predictions=[],this.predictedCursor=null;return}this.mismatch("field changed");return}if(p.layout!==s.layout){this.predictions=[],this.predictedCursor=null,this.field=p,this.note("layout changed");return}}let o=[],c=!1;for(const p of this.predictions){if(p.cancelled){if(!c){const M=a.row>p.row||a.row===p.row&&a.col>=p.col+p.width;if(M||(p.behindCaret=void 0),p.passed&&!M)continue;M&&!p.behindCaret&&(p.passed=!0)}o.push(p),c=!0;continue}const g=(h=n.buffer.active.getLine(p.row))==null?void 0:h.getCell(p.col),y=Qn(g?g.getChars():""),v=p.kind==="char"?y===p.char&&(p.width===1||(((m=g==null?void 0:g.getWidth)==null?void 0:m.call(g))??2)===2):y===" ",x=p.before.includes(y);p.behindCaret&&(a.row<p.row||a.row===p.row&&a.col<=p.col)&&(p.behindCaret=void 0);const w=p.kind==="char"?(a.row>p.row||a.row===p.row&&a.col>=p.col+p.width)&&!(p.behindCaret&&x):a.row<p.row||a.row===p.row&&a.col<=p.col,S=p.kind==="char"&&y===p.char&&!v;if(c&&!p.frozenFrom){if(!v||x){o.push(p);continue}o=o.filter(M=>!M.cancelled),c=!1}if(!(p.echoed&&!v))if(v&&(w||!x)){if(p.echoed||this.confirm(p,s),w){p.kind==="char"&&s&&!p.frozenFrom&&this.learnStyle(s.key,g);continue}p.echoed=!0,o.push(p)}else if(p.frozenFrom){const M=p.frozenFrom,N=p.kind==="erase"||a.col>=M.col;!w&&a.row===M.row&&N?o.push(p):w&&p.probation&&(this.inFlightUnknown=!0)}else if(!w&&!S)o.push(p);else if(p.probation){this.note("probation guess dropped"),this.predictions.some(M=>!M.frozenFrom&&M.kind==="erase")&&(this.inFlightUnknown=!0),this.inFlight=[...this.runInFlight,...this.runSent,...this.inFlight],this.runInFlight=[],this.runSent=[],this.probationRun=!1,this.predictions=this.predictions.filter(M=>M.frozenFrom),this.predictedCursor=null;return}else{this.mismatch("echo differs from prediction");return}}this.predictions=o,o.length===0&&(this.predictedCursor=null,this.probationRun&&(this.inFlightUnknown=!0))}getVisiblePredictions(){return this.pruneExpired(),this.visiblePredictions().filter(n=>!n.echoed&&!n.cancelled).map(n=>({row:n.row,col:n.col,char:n.char}))}getOverlayItems(){var a;this.pruneExpired();const n=this.visiblePredictions();return n.length===0?[]:sT(n,{style:this.field?this.fieldStyles.get(this.field.key):void 0,predictedCursor:this.predictedCursor,field:this.field,runStartedEmpty:this.runStartedEmpty,active:(a=this.getTerminal())==null?void 0:a.buffer.active})}}const yT=25,vT=2026,xT=1e3;function wT(l,n=()=>performance.now()){let a=!1,s=null;const o=new Set,c=y=>(o.add(y),{dispose:()=>void o.delete(y)}),h=()=>{a=!1,s=null},m=l.parser;if(!m||typeof m.registerCsiHandler!="function")return{isCursorHidden:()=>!1,isSynchronizing:()=>!1,onSyncEnd:c,reset:h,dispose:()=>{}};const p=y=>v=>{for(const x of v.flat())if(x===yT&&(a=!y),x===vT){const w=!y&&s!==null;if(s=y?n():null,w)for(const S of[...o])S()}return!1},g=[m.registerCsiHandler({prefix:"?",final:"h"},p(!0)),m.registerCsiHandler({prefix:"?",final:"l"},p(!1)),m.registerCsiHandler({intermediates:"!",final:"p"},()=>(h(),!1))];return typeof m.registerEscHandler=="function"&&g.push(m.registerEscHandler({final:"c"},()=>(h(),!1))),{isCursorHidden:()=>a,isSynchronizing:()=>s!==null&&n()-s<xT,onSyncEnd:c,reset:h,dispose:()=>{for(const y of g)y.dispose();o.clear()}}}const ST=40;function CT(l,n){return l==="off"?!1:l==="always"?!0:n!==null&&n>ST}function TT(l,n,a){var p;const s=wT(l),o=new FC({getScreen:()=>{const g=n();if(!g)return null;const y=g.buffer.active;return{cols:g.cols,rows:g.rows,baseY:y.baseY,getLine:v=>y.getLine(v),getNullCell:typeof y.getNullCell=="function"?()=>y.getNullCell():void 0}},getCursor:()=>{var y;const g=(y=n())==null?void 0:y.buffer.active;return g?{row:g.baseY+g.cursorY,col:g.cursorX,hidden:s.isCursorHidden()}:null},isSynchronizing:s.isSynchronizing}),c=(p=l._core)==null?void 0:p.unicodeService,h=new bT({getTerminal:n,getField:o.detect,getHerdrPrefixKeys:a,charWidth:typeof(c==null?void 0:c.wcwidth)=="function"?g=>c.wcwidth(g):void 0}),m=new XC({getTerminal:n,isCursorHidden:()=>s.isCursorHidden()});return{screenState:s,fieldProbe:o,predictor:h,overlay:m}}function MT({termRef:l,rendererRef:n,mode:a,connectionState:s,observeKeyInput:o,herdrPrefixKeys:c}){const h=T.useRef(null),m=T.useRef(null),p=T.useRef(null),g=T.useRef(null),y=En(a),v=En(c),x=T.useCallback(()=>{g.current!==null&&clearTimeout(g.current),g.current=null;const E=h.current,k=m.current;if(!E||!k)return;const z=E.getOverlayItems(),R=E.getExpiryDelayMs();if(R!==null&&(g.current=setTimeout(x,R)),!CT(y.current,E.getEchoSrttMs())){k.clear();return}k.sync(z)},[y]),w=T.useCallback(E=>{var k,z,R,D;(k=h.current)==null||k.reset(E),(z=h.current)==null||z.forgetConfidence(),(R=p.current)==null||R.reset(),(D=m.current)==null||D.clear()},[]),S=T.useCallback(E=>{var k,z;(k=h.current)==null||k.reset(E),(z=m.current)==null||z.clear()},[]),M=T.useCallback(E=>{var k,z,R;(k=h.current)==null||k.handleUserInput(E),x(),(R=(z=n.current)==null?void 0:z.canvas)==null||R.markInput()},[x,n]),N=T.useCallback(E=>{const k=TT(E,()=>l.current,()=>v.current);return p.current=k.fieldProbe,h.current=k.predictor,m.current=k.overlay,k},[l,v]),L=T.useCallback(()=>{var E;g.current!==null&&clearTimeout(g.current),g.current=null,(E=m.current)==null||E.dispose(),m.current=null,h.current=null,p.current=null},[]);return T.useEffect(()=>()=>{g.current!==null&&clearTimeout(g.current)},[]),T.useEffect(()=>o(M),[o,M]),T.useEffect(()=>{x()},[a,x]),T.useEffect(()=>{w("connectionState")},[s,w]),{predictorRef:h,overlayRef:m,fieldProbeRef:p,attach:N,detach:L,sync:x,forget:w,discard:S,onUserInput:M}}const AT=20,ET=6,NT=500,kT=300,ua=13,Iy=.602,Fy=1.3;function Wn(l,n){return Number.isFinite(l)&&l>0?l:n}function Vg(l,n,a){return Math.min(a,Math.max(n,l))}function Gy(l){const{width:n,height:a,cellWidth:s,cellHeight:o,minCols:c=AT,minRows:h=ET,maxCols:m=NT,maxRows:p=kT}=l,g=Wn(s,ua*Iy),y=Wn(o,ua*Fy);return{cols:Vg(Math.floor(Wn(n,0)/g),c,m),rows:Vg(Math.floor(Wn(a,0)/y),h,p)}}function rl(l,n=ua){var s,o,c;if(l)try{const h=l._core,m=(c=(o=(s=h==null?void 0:h._renderService)==null?void 0:s.dimensions)==null?void 0:o.css)==null?void 0:c.cell;if(m!=null&&m.width&&m.width>0&&m.height&&m.height>0)return{cellWidth:m.width,cellHeight:m.height,measured:!0}}catch{}const a=Wn(n,ua);return{cellWidth:Math.round(a*Iy*100)/100,cellHeight:Math.round(a*Fy*100)/100,measured:!1}}function LT(l){var s;const n=(s=l==null?void 0:l.querySelector)==null?void 0:s.call(l,".xterm-viewport");if(!n)return 0;const a=(n.offsetWidth||0)-(n.clientWidth||0);return Number.isFinite(a)&&a>0?a:0}function _d(l,n,a){if(!l)return{width:n,height:a};let s=0,o=0;if(typeof l.getBoundingClientRect=="function"){const c=l.getBoundingClientRect();s=(c==null?void 0:c.width)||0,o=(c==null?void 0:c.height)||0}return{width:Wn(s,Wn(l.clientWidth,n)),height:Wn(o,Wn(l.clientHeight,a))}}function Yy(l,n,a,s){const o=Number.isFinite(s)&&s>.01?s:1;return{clientX:a.left+(l-a.left)/o,clientY:a.top+(n-a.top)/o}}function qg(l,n){const a=typeof window<"u"?window:void 0,s=a&&typeof a.devicePixelRatio=="number"&&a.devicePixelRatio>0?a.devicePixelRatio:1,o=a!=null&&a.visualViewport&&typeof a.visualViewport.scale=="number"&&a.visualViewport.scale>0?a.visualViewport.scale:1,c=Math.max(0,l.width),h=Math.max(0,l.height),m=Math.round(c*s*100)/100,p=Math.round(h*s*100)/100;return{dpr:s,scale:o,cssWidth:c,cssHeight:h,physicalWidth:m,physicalHeight:p}}function _T(l){const{lastSnapshot:n,currentSnapshot:a,physicalTolerancePx:s=6}=l;if(!n)return{shouldIgnore:!1,isVisualZoom:!1,reason:"initial"};const o=Math.abs(a.scale-n.scale)>.01,c=Math.abs(a.scale-1)>.01;if(o||c)return{shouldIgnore:!0,isVisualZoom:!0,reason:"visual_pinch_zoom"};if(Math.abs(a.dpr-n.dpr)>.01){const g=Math.abs(a.physicalWidth-n.physicalWidth),y=Math.abs(a.physicalHeight-n.physicalHeight);if(g<=s&&y<=s)return{shouldIgnore:!0,isVisualZoom:!0,reason:"dpr_zoom"}}const m=Math.abs(a.cssWidth-n.cssWidth),p=Math.abs(a.cssHeight-n.cssHeight);return m<1&&p<1?{shouldIgnore:!0,isVisualZoom:!1,reason:"no_box_change"}:{shouldIgnore:!1,isVisualZoom:!1,reason:"genuine_resize"}}const RT=250;function jT({termRef:l,containerRef:n,frameRef:a,surfaceRef:s,currentScaleRef:o,rendererRef:c,initialBannerWrittenRef:h,isActiveRef:m,sendResize:p,onResized:g}){const y=En(p),v=En(g),x=T.useRef({cols:0,rows:0}),w=T.useRef(null),S=T.useRef(null),M=T.useRef(null),N=T.useRef(null),L=T.useRef({width:0,height:0}),E=T.useRef(null),k=T.useRef(!1),z=T.useCallback(()=>{const ie=w.current;w.current=null,ie&&(ie.cols===x.current.cols&&ie.rows===x.current.rows||(x.current=ie,y.current(ie.cols,ie.rows),v.current()))},[y,v]),R=T.useCallback((ie,oe,P=!1)=>{if(!(!Number.isFinite(ie)||!Number.isFinite(oe)||ie<=0||oe<=0)&&!(ie===x.current.cols&&oe===x.current.rows)){if(w.current={cols:ie,rows:oe},P){S.current&&clearTimeout(S.current),S.current=null,z();return}S.current||(S.current=setTimeout(()=>{S.current=null,z()},RT))}},[z]),D=T.useCallback((ie=!1,oe=!1)=>{var be;const P=l.current,A=n.current,G=s.current,W=a.current;if(!P||!A||!G||!W)return;const se=_d(A,aa(),fd());if(se.width<=0||se.height<=0)return;W.style.width="100%",W.style.height="100%",G.style.width="100%",G.style.height="100%",G.style.transform="none",G.style.transformOrigin="top left",o.current=1;const Q=qg(se),ge=_T({lastSnapshot:E.current,currentSnapshot:Q});if(ge.isVisualZoom&&!ie){E.current=Q;try{P.refresh(0,Math.max(0,P.rows-1))}catch{}return}if(ge.shouldIgnore&&!ie)return;E.current=Q;const ye=rl(P,ua),ue=Gy({width:se.width-LT(G),height:se.height,cellWidth:ye.cellWidth,cellHeight:ye.cellHeight}),Te=Math.abs(se.width-L.current.width)>1||Math.abs(se.height-L.current.height)>1;if(P.cols!==ue.cols||P.rows!==ue.rows)try{P.resize(ue.cols,ue.rows)}catch(le){console.debug("Error resizing terminal grid:",le)}h.current&&!k.current&&(Te||P.cols!==ue.cols||P.rows!==ue.rows)&&(k.current=!0,(be=c.current)==null||be.verify());const ce=ue.cols!==x.current.cols||ue.rows!==x.current.rows;m.current&&(Te||ie||ce)&&(L.current={width:se.width,height:se.height},R(ue.cols,ue.rows,oe));try{P.refresh(0,Math.max(0,P.rows-1))}catch{}},[l,n,s,a,o,c,h,m,R]),j=T.useRef(D);j.current=D;const H=T.useCallback(()=>{if(M.current===null){if(typeof requestAnimationFrame!="function"){j.current();return}M.current=requestAnimationFrame(()=>{M.current=null,j.current()})}},[]),K=T.useCallback((ie=30)=>{N.current!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(N.current),N.current=null);let oe=0;const P=()=>{N.current=null,oe++;const A=oe>=ie;j.current(!0),!A&&oe<2&&typeof requestAnimationFrame=="function"&&(N.current=requestAnimationFrame(P))};typeof requestAnimationFrame=="function"?N.current=requestAnimationFrame(P):P()},[]),q=T.useCallback(()=>j.current(!0,!0),[]),te=T.useCallback(ie=>{L.current={width:ie.width,height:ie.height},E.current=qg(ie)},[]),Z=T.useCallback(()=>{S.current&&(clearTimeout(S.current),S.current=null),M.current!==null&&(cancelAnimationFrame(M.current),M.current=null),N.current!==null&&(cancelAnimationFrame(N.current),N.current=null)},[]);return{requestFit:H,scheduleBoundedFit:K,fitNow:q,seedFit:te,cancelPendingFits:Z}}const OT=" ()[]{}'\"\\`";function DT(l,n,a,s=1){var N,L;if(!((N=n==null?void 0:n.buffer)!=null&&N.active)||n.cols<=0||n.rows<=0)return null;const o=a||((L=n.element)==null?void 0:L.querySelector(".xterm-screen"))||n.element;if(!o||typeof o.getBoundingClientRect!="function")return null;const c=o.getBoundingClientRect(),h=Yy(l.clientX,l.clientY,c,s),m=rl(n);if(m.cellWidth<=0||m.cellHeight<=0)return null;const p=Math.max(1,c.width||n.cols*m.cellWidth),g=Math.max(1,c.height||n.rows*m.cellHeight),y=Math.max(0,Math.min(p-1,h.clientX-c.left)),v=Math.max(0,Math.min(g-1,h.clientY-c.top)),x=Math.max(0,Math.min(n.cols-1,Math.floor(y/m.cellWidth))),w=Math.max(0,Math.min(n.rows-1,Math.floor(v/m.cellHeight))),M=(n.buffer.active.viewportY??0)+w;return{col:x,bufferRow:M}}function zT(l,n){if(!l||l.length===0||l==="\0")return!0;for(const a of l)if(a==="\0"||/\s/.test(a)||n.includes(a))return!0;return!1}function HT(l,n,a){var x,w;if(!((x=l==null?void 0:l.buffer)!=null&&x.active)||n<0||n>=l.cols)return null;const s=l.buffer.active.getLine(a);if(!s)return null;const o=((w=l.options)==null?void 0:w.wordSeparator)??OT,c=new Array(l.cols).fill(null),h=Math.min(l.cols,s.length);let m=0;for(;m<h;){const S=s.getCell(m);if(!S){c[m]={startCol:m,endCol:m+1,isSeparator:!0},m++;continue}const M=S.getWidth();if(M===0){c[m]||(c[m]={startCol:m,endCol:m+1,isSeparator:!0}),m++;continue}const N=S.getChars(),L=zT(N,o),E=Math.min(l.cols,m+M),k={startCol:m,endCol:E,isSeparator:L};for(let z=m;z<E;z++)c[z]=k;m+=Math.max(1,M)}for(let S=h;S<l.cols;S++)c[S]||(c[S]={startCol:S,endCol:S+1,isSeparator:!0});const p=c[n];if(!p||p.isSeparator)return null;let g=p.startCol;for(;g>0;){const S=c[g-1];if(S&&!S.isSeparator)g=S.startCol;else break}let y=p.endCol;for(;y<l.cols;){const S=c[y];if(S&&!S.isSeparator)y=S.endCol;else break}const v=y-g;return v<=0?null:{startCol:g,length:v}}function BT(l){var c;if(!((c=l==null?void 0:l.buffer)!=null&&c.active))return"";const n=l.buffer.active,a=n.viewportY??0,s=l.rows,o=[];for(let h=0;h<s;h++){const m=n.getLine(a+h);o.push(m?m.translateToString(!0):"")}for(;o.length>0&&o[o.length-1]==="";)o.pop();return o.join(`
49
+ `)}const Xg=new Set(["│","┃","╎","╏","┆","┇","┊","┋","║","▏","▕","|"]),UT=.6,KT=new Set(["─","━","═","┄","┅","┈","┉","-"]),IT=.8;function ad(l,n){if(!l)return!1;let a=0;const s=Math.min(n,l.length);for(let o=0;o<s;o++){const c=l.getCell(o);if(c){const h=c.getChars();h&&KT.has(h)&&a++}}return a>=Math.max(5,Math.min(n*.25,10))}function sd(l,n,a){var w;if(!((w=l==null?void 0:l.buffer)!=null&&w.active)||l.cols<=0)return{startCol:0,endCol:0};const s=l.buffer.active,o=l.cols,c=Math.max(0,Math.min(o-1,n)),h=s.viewportY??0,m=l.rows>0?l.rows:1,p=new Int32Array(o);let g=0;for(let S=0;S<m;S++){const M=s.getLine(h+S);if(g++,!M)continue;const N=Math.min(o,M.length);for(let L=0;L<N;L++){const E=M.getCell(L);if(E){const k=E.getChars();k&&Xg.has(k)&&p[L]++}}}if(g===0)return{startCol:0,endCol:o-1};const y=g*UT,v=S=>p[S]>=y;let x=!1;for(let S=0;S<o;S++)if(v(S)){x=!0;break}if(x){if(v(c))return{startCol:c,endCol:c};let S=-1;for(let N=c-1;N>=0;N--)if(v(N)){S=N;break}let M=o;for(let N=c+1;N<o;N++)if(v(N)){M=N;break}return{startCol:S+1,endCol:M-1}}if(a!==void 0){const S=Math.max(h,Math.min(h+m-1,a)),M=s.getLine(S);if(!ad(M,o)){let N=h;for(let k=S-1;k>=h;k--)if(ad(s.getLine(k),o)){N=k+1;break}let L=h+m-1;for(let k=S+1;k<=h+m-1;k++)if(ad(s.getLine(k),o)){L=k-1;break}const E=L-N+1;if(E>=2){const k=new Int32Array(o);for(let j=N;j<=L;j++){const H=s.getLine(j);if(!H)continue;const K=Math.min(o,H.length);for(let q=0;q<K;q++){const te=H.getCell(q);if(te){const Z=te.getChars();Z&&Xg.has(Z)&&k[q]++}}}const z=E*IT,R=j=>k[j]>=z;let D=!1;for(let j=0;j<o;j++)if(R(j)){D=!0;break}if(D){if(R(c))return{startCol:c,endCol:c};let j=-1;for(let K=c-1;K>=0;K--)if(R(K)){j=K;break}let H=o;for(let K=c+1;K<o;K++)if(R(K)){H=K;break}return{startCol:j+1,endCol:H-1}}}}}return{startCol:0,endCol:o-1}}function Zg(l,n){const a=Math.min(l.startCol,l.endCol),s=Math.max(l.startCol,l.endCol),o=Math.min(l.startRow,l.endRow),c=Math.max(l.startRow,l.endRow);return{startCol:Math.max(n.startCol,Math.min(n.endCol,a)),endCol:Math.max(n.startCol,Math.min(n.endCol,s)),startRow:o,endRow:c}}function Wg(l,n){var g;if(!((g=l==null?void 0:l.buffer)!=null&&g.active)||l.cols<=0)return"";const a=l.buffer.active,s=l.cols,o=Math.min(n.startRow,n.endRow),c=Math.max(n.startRow,n.endRow),h=Math.max(0,Math.min(n.startCol,n.endCol)),m=Math.min(s-1,Math.max(n.startCol,n.endCol));if(h>m||o>c)return"";const p=[];for(let y=o;y<=c;y++){const v=a.getLine(y);if(!v){p.push("");continue}const x=v.translateToString(!0,h,m+1);p.push(x.trimEnd())}return p.join(`
50
+ `)}function FT({termRef:l,surfaceRef:n,mainRef:a,currentScaleRef:s,addToast:o,t:c}){const h=En(o),m=En(c),[p,g]=T.useState(null),y=T.useRef(null);y.current=p;const[v,x]=T.useState(null),w=T.useRef(null);w.current=v;const[S,M]=T.useState(""),N=T.useRef("");N.current=S;const[L,E]=T.useState(!1),k=T.useRef(!1);k.current=L;const z=T.useRef(!1),[R,D]=T.useState(0),j=T.useRef(0),H=T.useRef(null),K=T.useRef(null),q=T.useRef(null),te=T.useRef(null),Z=T.useCallback(le=>{var ve;const we=l.current;if(!we)return null;const ae=((ve=n.current)==null?void 0:ve.querySelector(".xterm-screen"))||n.current;return DT(le,we,ae,s.current)},[l,n,s]),ie=T.useCallback(le=>{const we=l.current,ae=Z(le);return!we||!ae?null:rC(we,ae.col,ae.bufferRow)},[l,Z]),oe=T.useCallback((le,we)=>{x(we),M(Wg(le,we)),E(!0)},[]),P=T.useCallback(()=>{x(null),M(""),E(!1),q.current=null,te.current=null},[]),A=T.useCallback(()=>{g(null),y.current=null,x(null),w.current=null,M(""),N.current="",E(!1),H.current=null,K.current=null},[]),G=T.useCallback(le=>{const we=l.current;if(!we)return;const ae=Z(le),ve=ae?HT(we,ae.col,ae.bufferRow):null;if(ae&&ve){q.current=ae;const Ne=sd(we,ae.col,ae.bufferRow);te.current=Ne;const Ie={startCol:ve.startCol,endCol:ve.startCol+ve.length-1,startRow:ae.bufferRow,endRow:ae.bufferRow};oe(we,Zg(Ie,Ne))}else P();H.current=le,K.current=null},[l,Z,oe,P]),W=T.useCallback(le=>{const we=l.current,ae=q.current;if(!we||!ae)return;K.current=le;const ve=Z(le);if(!ve)return;const Ne=te.current??sd(we,ae.col,ae.bufferRow),Ie={startCol:Math.min(ae.col,ve.col),endCol:Math.max(ae.col,ve.col),startRow:Math.min(ae.bufferRow,ve.bufferRow),endRow:Math.max(ae.bufferRow,ve.bufferRow)};oe(we,Zg(Ie,Ne))},[l,Z,oe]),se=T.useCallback(()=>{const le=K.current??H.current;if(!le||!a.current)return;const we=a.current.getBoundingClientRect(),ae=le.clientX-we.left,ve=le.clientY-we.top,Ne=ie(le);g({x:ae,y:ve,link:Ne}),y.current={x:ae,y:ve,link:Ne}},[a,ie]),Q=T.useCallback(async le=>{await Pd(le)==="failed"?h.current("error",m.current("clipboard.copyFailed")):h.current("success",m.current("clipboard.copied"))},[h,m]),ge=T.useCallback(async()=>{const le=N.current;le&&await Q(le)},[Q]),ye=T.useCallback(async()=>{var Ne,Ie,Xe,tt;const le=l.current,we=(Ne=le==null?void 0:le.buffer)==null?void 0:Ne.active;if(!le||!we)return;const ae=((Ie=w.current)==null?void 0:Ie.startRow)??((Xe=q.current)==null?void 0:Xe.bufferRow)??we.viewportY,ve=te.current??sd(le,((tt=q.current)==null?void 0:tt.col)??0,ae);await Q(Wg(le,{startCol:ve.startCol,endCol:ve.endCol,startRow:ae,endRow:ae}))},[l,Q]),ue=T.useCallback(async()=>{const le=l.current;le&&await Q(BT(le))},[l,Q]),Te=T.useCallback((le,we,ae)=>{const ve=le.buffer.active.viewportY??0;ve!==j.current&&(j.current=ve,D(ve));const Ne=w.current;if(Ne&&k.current){const Ie=Ne.startRow-ve,Xe=Ne.endRow-ve;z.current&&we<=Xe&&ae>=Ie&&(E(!1),z.current=!1)}else z.current=!1},[]),ce=T.useCallback(le=>{const we=le.buffer.active.viewportY??0;j.current=we,D(we)},[]),be=T.useCallback(()=>{z.current=!0},[]);return{selectionMenu:p,selectionRect:v,selectionSnapshot:S,isHighlightVisible:L,viewportY:R,hasOpenMenu:()=>y.current!==null,clearSelection:A,handleLongPress:G,handleSelectionExtend:W,openMenuAtGesture:se,handleCopySelection:ge,handleCopyLine:ye,handleCopyScreen:ue,onTerminalRender:Te,onTerminalScroll:ce,onTerminalContentChanged:be}}const GT=({term:l,surface:n,main:a,rect:s,viewportY:o})=>{if(!l||!a)return null;const c=rl(l);if(c.cellWidth<=0||c.cellHeight<=0)return null;const h=(n==null?void 0:n.querySelector(".xterm-screen"))||n;if(!h)return null;const m=h.getBoundingClientRect(),p=a.getBoundingClientRect(),g=s.startRow-o;if(s.endRow-o<0||g>=l.rows)return null;const v=m.top-p.top+g*c.cellHeight,x=m.left-p.left+s.startCol*c.cellWidth,w=(s.endCol-s.startCol+1)*c.cellWidth,S=(s.endRow-s.startRow+1)*c.cellHeight;return f.jsx("div",{"data-testid":"terminal-selection-overlay",className:"pointer-events-none absolute z-20 bg-tui-accent/35",style:{top:`${v}px`,left:`${x}px`,width:`${w}px`,height:`${S}px`}})},YT=600;var Zn=(l=>(l[l.NONE=0]="NONE",l[l.BLOCK=1]="BLOCK",l[l.BAR=2]="BAR",l[l.UNDERLINE=3]="UNDERLINE",l[l.OUTLINE=4]="OUTLINE",l))(Zn||{});function Qg(l){switch(l){case"bar":return 2;case"underline":return 3;case"outline":return 4;default:return 1}}function Py(l,n,a,s,o,c,{css:h,dpr:m,cursorWidth:p}){switch(l.save(),l.fillStyle=h,l.strokeStyle=h,c){case 2:l.fillRect(a,s,Math.max(1,Math.round(p*m)),n.cell.height);break;case 3:l.fillRect(a,s+n.cell.height-Math.max(1,Math.round(m))-1,o,Math.max(1,Math.round(m)));break;case 4:{const g=Math.max(1,Math.round(m));l.lineWidth=g,l.strokeRect(a+g/2,s+g/2,o-g,n.cell.height-g);break}}l.restore()}function PT(l,n,a,s,o){let c,h;if(a&&a.cursor!==void 0){if(a.cursor===null)return null;c=a.cursor.row,h=a.cursor.col}else{if(!l.coreService.isCursorInitialized||l.coreService.isCursorHidden)return null;c=n.ybase+n.y,h=n.x}const m=c-n.ydisp;if(m<0||m>=s.rows)return null;const p=Math.min(Math.max(0,h),s.cols-1),g=l.optionsService.rawOptions;let y;if(l._coreBrowserService.isFocused)o?y=0:y=Qg(g.cursorStyle||"block");else{const v=g.cursorInactiveStyle??"outline";y=v==="none"?0:Qg(v)}return y===0?null:{x:p,y:m,shape:y}}class $T{constructor(n){$(this,"timer",null);$(this,"visible",!0);this.onToggle=n}get running(){return this.timer!==null}get hidden(){return this.timer!==null&&!this.visible}start(){this.stop(),this.timer=setInterval(()=>{this.visible=!this.visible,this.onToggle()},YT)}stop(){this.timer&&clearInterval(this.timer),this.timer=null,this.visible=!0}}const Jg=80,VT=16;class qT{constructor(){$(this,"last",null);$(this,"fromX",0);$(this,"toX",0);$(this,"start",0);$(this,"sliding",!1)}update(n,a,s){const o=this.last;if(this.last=n&&{x:n.x,y:n.y},!n)return this.sliding=!1,null;if(!o||o.x!==n.x||o.y!==n.y){const c=o!==null&&o.y===n.y&&n.y===a&&Math.abs(n.x-o.x)<=VT;this.fromX=!c||!o?n.x:this.sliding?this.x(s):o.x,this.toX=n.x,this.start=s,this.sliding=c}return this.sliding?s-this.start>=Jg?(this.sliding=!1,null):{x:this.x(s),y:n.y,shape:n.shape,css:n.css}:null}x(n){const a=Math.min(1,Math.max(0,(n-this.start)/Jg));return this.fromX+(this.toX-this.fromX)*(1-(1-a)**3)}}function XT(l,n,a,s){if(l)return{x:l.x,y:l.y,shape:l.shape,css:s.cursor.css};const o=n==null?void 0:n.paintedCaret;if(!o)return null;const{bg:c}=gs(o.style.fg,o.style.bg,s,!0);return{x:o.col,y:o.row-a,shape:Zn.BLOCK,css:c,plain:o.plain}}const ZT=120,WT=16,QT=96,JT=32,e5=64;function ds(l,n){const a=l.content[n];if(!(a>>>Qe.WIDTH_SHIFT)||ta(l.fg[n]))return!1;if(a&Qe.IS_COMBINED_MASK)return l.combined[n]!=="";const s=a&Qe.CODEPOINT_MASK;return s!==0&&s!==32}function eb(l,n){return{content:l.content[n],fg:l.fg[n],bg:l.bg[n],combined:l.combined[n]}}class t5{constructor(){$(this,"fades",new Map)}get size(){return this.fades.size}clear(){this.fades.clear()}rows(n){const a=new Set;for(const s of this.fades.keys())a.add(Math.floor(s/n));return a}begin(n,a,s,o,c,h){const m=n*a,p=Math.max(0,s.start),g=Math.min(a,s.end);let y=0;for(let x=p;x<g;x++){const w=m+x;if(o.content[w]===Jl)return;const S=ds(o,w),M=ds(c,x);if(S&&M){if(o.content[w]!==c.content[x]||o.combined[w]!==c.combined[x])return}else(S||M)&&y++}if(y===0||y>JT)return;let v=0;for(let x=p;x<g;x++){const w=m+x,S=ds(o,w),M=ds(c,x);if(M&&!S){const N=Math.min(v++*WT,QT);this.fades.set(w,{...eb(c,x),start:h+N,out:!1})}else S&&!M&&this.fades.set(w,{...eb(o,w),start:h,out:!0})}}at(n,a,s,o){const c=this.fades.get(n);if(!c)return null;const h=c.out?!ds(s,a):s.content[a]===c.content&&s.combined[a]===c.combined,m=(o-c.start)/ZT;if(!h||m>=1)return this.fades.delete(n),null;const p=Math.max(0,m);return c.out?{alpha:(1-p)**2,gone:c}:{alpha:1-(1-p)**3}}}function n5(l,n,{gone:a,alpha:s},o,c){if(!a)return;const h=a.content&Qe.IS_COMBINED_MASK?a.combined:String.fromCodePoint(a.content&Qe.CODEPOINT_MASK),m=n.get({chars:h,bold:la(a.fg),italic:bs(a.bg),dim:Ts(a.bg),fg:o.fg,bg:o.bg,cells:c.cells});m&&(l.globalAlpha=s,l.drawImage(m.source,m.x,m.y,m.width,m.height,c.px,c.py,c.width,c.height),l.globalAlpha=1)}/**
51
+ * Box drawing, block element and Powerline glyphs, drawn as shapes rather than
52
+ * taken from the font.
53
+ *
54
+ * Vendored verbatim from @xterm/xterm 5.5.0,
55
+ * src/browser/renderer/shared/CustomGlyphs.ts. The only edits are the one
56
+ * helper it imported, inlined below, and underscores on parameters the strict
57
+ * compiler flags as unused.
58
+ *
59
+ * Copyright (c) 2021 The xterm.js authors. All rights reserved.
60
+ * @license MIT
61
+ */function tb(l){if(!l)throw new Error("value must not be falsy");return l}const i5={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},l5={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]},a5={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(l,n)=>`M0,${.5-n} L1,${.5-n} M0,${.5+n} L1,${.5+n}`},"║":{1:(l,n)=>`M${.5-l},0 L${.5-l},1 M${.5+l},0 L${.5+l},1`},"╒":{1:(l,n)=>`M.5,1 L.5,${.5-n} L1,${.5-n} M.5,${.5+n} L1,${.5+n}`},"╓":{1:(l,n)=>`M${.5-l},1 L${.5-l},.5 L1,.5 M${.5+l},.5 L${.5+l},1`},"╔":{1:(l,n)=>`M1,${.5-n} L${.5-l},${.5-n} L${.5-l},1 M1,${.5+n} L${.5+l},${.5+n} L${.5+l},1`},"╕":{1:(l,n)=>`M0,${.5-n} L.5,${.5-n} L.5,1 M0,${.5+n} L.5,${.5+n}`},"╖":{1:(l,n)=>`M${.5+l},1 L${.5+l},.5 L0,.5 M${.5-l},.5 L${.5-l},1`},"╗":{1:(l,n)=>`M0,${.5+n} L${.5-l},${.5+n} L${.5-l},1 M0,${.5-n} L${.5+l},${.5-n} L${.5+l},1`},"╘":{1:(l,n)=>`M.5,0 L.5,${.5+n} L1,${.5+n} M.5,${.5-n} L1,${.5-n}`},"╙":{1:(l,n)=>`M1,.5 L${.5-l},.5 L${.5-l},0 M${.5+l},.5 L${.5+l},0`},"╚":{1:(l,n)=>`M1,${.5-n} L${.5+l},${.5-n} L${.5+l},0 M1,${.5+n} L${.5-l},${.5+n} L${.5-l},0`},"╛":{1:(l,n)=>`M0,${.5+n} L.5,${.5+n} L.5,0 M0,${.5-n} L.5,${.5-n}`},"╜":{1:(l,n)=>`M0,.5 L${.5+l},.5 L${.5+l},0 M${.5-l},.5 L${.5-l},0`},"╝":{1:(l,n)=>`M0,${.5-n} L${.5-l},${.5-n} L${.5-l},0 M0,${.5+n} L${.5+l},${.5+n} L${.5+l},0`},"╞":{1:(l,n)=>`M.5,0 L.5,1 M.5,${.5-n} L1,${.5-n} M.5,${.5+n} L1,${.5+n}`},"╟":{1:(l,n)=>`M${.5-l},0 L${.5-l},1 M${.5+l},0 L${.5+l},1 M${.5+l},.5 L1,.5`},"╠":{1:(l,n)=>`M${.5-l},0 L${.5-l},1 M1,${.5+n} L${.5+l},${.5+n} L${.5+l},1 M1,${.5-n} L${.5+l},${.5-n} L${.5+l},0`},"╡":{1:(l,n)=>`M.5,0 L.5,1 M0,${.5-n} L.5,${.5-n} M0,${.5+n} L.5,${.5+n}`},"╢":{1:(l,n)=>`M0,.5 L${.5-l},.5 M${.5-l},0 L${.5-l},1 M${.5+l},0 L${.5+l},1`},"╣":{1:(l,n)=>`M${.5+l},0 L${.5+l},1 M0,${.5+n} L${.5-l},${.5+n} L${.5-l},1 M0,${.5-n} L${.5-l},${.5-n} L${.5-l},0`},"╤":{1:(l,n)=>`M0,${.5-n} L1,${.5-n} M0,${.5+n} L1,${.5+n} M.5,${.5+n} L.5,1`},"╥":{1:(l,n)=>`M0,.5 L1,.5 M${.5-l},.5 L${.5-l},1 M${.5+l},.5 L${.5+l},1`},"╦":{1:(l,n)=>`M0,${.5-n} L1,${.5-n} M0,${.5+n} L${.5-l},${.5+n} L${.5-l},1 M1,${.5+n} L${.5+l},${.5+n} L${.5+l},1`},"╧":{1:(l,n)=>`M.5,0 L.5,${.5-n} M0,${.5-n} L1,${.5-n} M0,${.5+n} L1,${.5+n}`},"╨":{1:(l,n)=>`M0,.5 L1,.5 M${.5-l},.5 L${.5-l},0 M${.5+l},.5 L${.5+l},0`},"╩":{1:(l,n)=>`M0,${.5+n} L1,${.5+n} M0,${.5-n} L${.5-l},${.5-n} L${.5-l},0 M1,${.5-n} L${.5+l},${.5-n} L${.5+l},0`},"╪":{1:(l,n)=>`M.5,0 L.5,1 M0,${.5-n} L1,${.5-n} M0,${.5+n} L1,${.5+n}`},"╫":{1:(l,n)=>`M0,.5 L1,.5 M${.5-l},0 L${.5-l},1 M${.5+l},0 L${.5+l},1`},"╬":{1:(l,n)=>`M0,${.5+n} L${.5-l},${.5+n} L${.5-l},1 M1,${.5+n} L${.5+l},${.5+n} L${.5+l},1 M0,${.5-n} L${.5-l},${.5-n} L${.5-l},0 M1,${.5-n} L${.5+l},${.5-n} L${.5+l},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(l,n)=>`M.5,1 L.5,${.5+n/.15*.5} C.5,${.5+n/.15*.5},.5,.5,1,.5`},"╮":{1:(l,n)=>`M.5,1 L.5,${.5+n/.15*.5} C.5,${.5+n/.15*.5},.5,.5,0,.5`},"╯":{1:(l,n)=>`M.5,0 L.5,${.5-n/.15*.5} C.5,${.5-n/.15*.5},.5,.5,0,.5`},"╰":{1:(l,n)=>`M.5,0 L.5,${.5-n/.15*.5} C.5,${.5-n/.15*.5},.5,.5,1,.5`}},Ms={"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};Ms[""]=Ms[""];Ms[""]=Ms[""];function s5(l,n,a,s,o,c,h,m){const p=i5[n];if(p)return r5(l,p,a,s,o,c),!0;const g=l5[n];if(g)return o5(l,g,a,s,o,c),!0;const y=a5[n];if(y)return c5(l,y,a,s,o,c,m),!0;const v=Ms[n];return v?(u5(l,v,a,s,o,c,h,m),!0):!1}function r5(l,n,a,s,o,c){for(let h=0;h<n.length;h++){const m=n[h],p=o/8,g=c/8;l.fillRect(a+m.x*p,s+m.y*g,m.w*p,m.h*g)}}const nb=new Map;function o5(l,n,a,s,o,c){let h=nb.get(n);h||(h=new Map,nb.set(n,h));const m=l.fillStyle;if(typeof m!="string")throw new Error(`Unexpected fillStyle type "${m}"`);let p=h.get(m);if(!p){const g=n[0].length,y=n.length,v=l.canvas.ownerDocument.createElement("canvas");v.width=g,v.height=y;const x=tb(v.getContext("2d")),w=new ImageData(g,y);let S,M,N,L;if(m.startsWith("#"))S=parseInt(m.slice(1,3),16),M=parseInt(m.slice(3,5),16),N=parseInt(m.slice(5,7),16),L=m.length>7&&parseInt(m.slice(7,9),16)||1;else if(m.startsWith("rgba"))[S,M,N,L]=m.substring(5,m.length-1).split(",").map(E=>parseFloat(E));else throw new Error(`Unexpected fillStyle color format "${m}" when drawing pattern glyph`);for(let E=0;E<y;E++)for(let k=0;k<g;k++)w.data[(E*g+k)*4]=S,w.data[(E*g+k)*4+1]=M,w.data[(E*g+k)*4+2]=N,w.data[(E*g+k)*4+3]=n[E][k]*(L*255);x.putImageData(w,0,0),p=tb(l.createPattern(v,null)),h.set(m,p)}l.fillStyle=p,l.fillRect(a,s,o,c)}function c5(l,n,a,s,o,c,h){l.strokeStyle=l.fillStyle;for(const[m,p]of Object.entries(n)){l.beginPath(),l.lineWidth=h*Number.parseInt(m,10);let g;if(typeof p=="function"){const v=.15/c*o;g=p(.15,v)}else g=p;for(const y of g.split(" ")){const v=y[0],x=$y[v];if(!x){console.error(`Could not find drawing instructions for "${v}"`);continue}const w=y.substring(1).split(",");!w[0]||!w[1]||x(l,Vy(w,o,c,a,s,!0,h))}l.stroke(),l.closePath()}}function u5(l,n,a,s,o,c,h,m){const p=new Path2D;p.rect(a,s,o,c),l.clip(p),l.beginPath();const g=h/12;l.lineWidth=m*g;for(const y of n.d.split(" ")){const v=y[0],x=$y[v];if(!x){console.error(`Could not find drawing instructions for "${v}"`);continue}const w=y.substring(1).split(",");!w[0]||!w[1]||x(l,Vy(w,o,c,a,s,!1,m,(n.leftPadding??0)*(g/2),(n.rightPadding??0)*(g/2)))}n.type===1?(l.strokeStyle=l.fillStyle,l.stroke()):l.fill(),l.closePath()}function ib(l,n,a=0){return Math.max(Math.min(l,n),a)}const $y={C:(l,n)=>l.bezierCurveTo(n[0],n[1],n[2],n[3],n[4],n[5]),L:(l,n)=>l.lineTo(n[0],n[1]),M:(l,n)=>l.moveTo(n[0],n[1])};function Vy(l,n,a,s,o,c,h,m=0,p=0){const g=l.map(y=>parseFloat(y)||parseInt(y,10));if(g.length<2)throw new Error("Too few arguments for instruction");for(let y=0;y<g.length;y+=2)g[y]*=n-m*h-p*h,c&&g[y]!==0&&(g[y]=ib(Math.round(g[y]+.5)-.5,n,0)),g[y]+=s+m*h;for(let y=1;y<g.length;y+=2)g[y]*=a,c&&g[y]!==0&&(g[y]=ib(Math.round(g[y]+.5)-.5,a,0)),g[y]+=o;return g}const $d=.5,d5=1024,f5=6;function h5(l){return/Firefox\//.test(l)||/Edge\/\d/.test(l)?"bottom":"ideographic"}class m5{constructor(n,a=typeof navigator<"u"?navigator.userAgent:""){$(this,"pages",[]);$(this,"slots",new Map);$(this,"inkCache",new Map);$(this,"metrics",null);$(this,"font",null);$(this,"baseline");$(this,"generation",0);$(this,"scratch");this.document=n,this.baseline=h5(a)}configure(n,a){const s=this.metrics&&this.font&&this.metrics.cellWidth===n.cellWidth&&this.metrics.cellHeight===n.cellHeight&&this.metrics.charWidth===n.charWidth&&this.metrics.charHeight===n.charHeight&&this.metrics.charLeft===n.charLeft&&this.metrics.charTop===n.charTop&&this.metrics.dpr===n.dpr&&this.font.fontFamily===a.fontFamily&&this.font.fontSize===a.fontSize&&this.font.fontWeight===a.fontWeight&&this.font.fontWeightBold===a.fontWeightBold&&this.font.customGlyphs===a.customGlyphs;this.metrics={...n},this.font={...a},s||this.clear()}clear(){this.slots.clear(),this.inkCache.clear();for(const n of this.pages)n.shelfX=0,n.shelfY=0;this.generation++}dispose(){this.slots.clear(),this.inkCache.clear();for(const n of this.pages)n.canvas.width=0,n.canvas.height=0;this.pages=[]}get pageCount(){return this.pages.length}fontString(n,a){const s=this.font,o=n?s.fontWeightBold:s.fontWeight;return`${a?"italic ":""}${o} ${s.fontSize*this.metrics.dpr}px ${s.fontFamily}`}overflow(n,a,s){if(!this.metrics||!this.font||n.length===1&&n.charCodeAt(0)<128)return 0;const o=`${a?1:0}${s?1:0}${n}`,c=this.inkCache.get(o);if(c!==void 0)return c;let h=0;const m=this.scratchContext();if(m&&!(this.font.customGlyphs&&qy(n))){m.font=this.fontString(a,s),m.textBaseline=this.baseline;const p=m.measureText(n),g=typeof p.actualBoundingBoxRight=="number"?p.actualBoundingBoxRight:p.width;h=Math.max(0,Math.ceil(this.metrics.charLeft+g-this.metrics.cellWidth))}return this.inkCache.set(o,h),h}get(n){const a=this.metrics,s=this.font;if(!a||!s||a.cellWidth<=0||a.cellHeight<=0)return null;const o=`${n.cells}${n.bold?1:0}${n.italic?1:0}${n.dim?1:0}${n.fg}\0${n.bg}\0${n.chars}`,c=this.slots.get(o);if(c)return c;const h=a.cellWidth*n.cells,m=a.cellHeight,p=this.allocate(h,m);if(!p)return null;const{page:g,x:y,y:v}=p,x=g.ctx;x.save(),x.beginPath(),x.rect(y,v,h,m),x.clip(),x.globalAlpha=1,x.fillStyle=n.bg,x.fillRect(y,v,h,m),x.fillStyle=n.fg,n.dim&&(x.globalAlpha=$d);let w=!1;s.customGlyphs&&(w=s5(x,n.chars,y,v,a.cellWidth,a.cellHeight,s.fontSize,a.dpr)),w||(x.font=this.fontString(n.bold,n.italic),x.textBaseline=this.baseline,x.fillText(n.chars,y+a.charLeft,v+a.charTop+a.charHeight)),x.restore();const S={source:g.canvas,x:y,y:v,width:h,height:m};return this.slots.set(o,S),S}allocate(n,a){for(const s of this.pages){const o=this.fit(s,n,a);if(o)return o}if(this.pages.length<f5){const s=this.createPage(Math.max(d5,n,a));return s?(this.pages.push(s),this.fit(s,n,a)):null}return this.clear(),this.pages[0]?this.fit(this.pages[0],n,a):null}fit(n,a,s){if(n.shelfX+a>n.canvas.width&&(n.shelfX=0,n.shelfY+=s),n.shelfY+s>n.canvas.height||a>n.canvas.width)return null;const o={page:n,x:n.shelfX,y:n.shelfY};return n.shelfX+=a,o}createPage(n){const a=this.document.createElement("canvas");a.width=n,a.height=n;const s=a.getContext("2d",{alpha:!1});return s?{canvas:a,ctx:s,shelfX:0,shelfY:0}:null}scratchContext(){if(this.scratch===void 0){const n=this.document.createElement("canvas");n.width=1,n.height=1,this.scratch=n.getContext("2d")}return this.scratch}}function qy(l){if(l.length!==1)return!1;const n=l.charCodeAt(0);return n>=9472&&n<=9631||n>=57504&&n<=57558}function p5(l,n){return(l&(st.UNDERLINE|st.STRIKETHROUGH))!==0||(n&ji.OVERLINE)!==0}function g5(l,n,{px:a,py:s,cells:o,fgWord:c,bgWord:h,ext:m,fgCss:p},{fontSize:g,dpr:y,colors:v,boldBright:x}){const w=(c&st.UNDERLINE)!==0,S=(c&st.STRIKETHROUGH)!==0,M=(h&ji.OVERLINE)!==0,N=o*n.cell.width;l.save(),l.beginPath(),l.rect(a,s,N,n.cell.height),l.clip(),Ts(h)&&(l.globalAlpha=$d);const L=Math.max(1,Math.floor(g*y/15)),E=L%2===1?.5:0;if(w){const k=PC(m);let z=p;if(k){let j=k;x&&la(c)&&(j&50331648)!==50331648&&(j&255)<8&&(j+=8),z=_y(j,v,p)}l.strokeStyle=z,l.lineWidth=L;const R=s+n.char.top+Math.ceil(n.char.height)-E-L*2,D=m?YC(m):ea.SINGLE;switch(l.beginPath(),D){case ea.DOUBLE:l.moveTo(a,R),l.lineTo(a+N,R),l.moveTo(a,R+L*2),l.lineTo(a+N,R+L*2);break;case ea.CURLY:{const j=R+L,H=Math.max(1,L);for(let K=0;K<o;K++){const q=a+K*n.cell.width,te=q+n.cell.width/2,Z=q+n.cell.width;l.moveTo(q,j),l.bezierCurveTo(q,j-H,te,j-H,te,j),l.bezierCurveTo(te,j+H,Z,j+H,Z,j)}break}case ea.DOTTED:l.setLineDash([L,L]),l.moveTo(a,R),l.lineTo(a+N,R);break;case ea.DASHED:{const j=Math.floor(.6*n.cell.width),H=Math.floor(.3*n.cell.width);l.setLineDash([j,H,n.cell.width-j-H]),l.moveTo(a,R),l.lineTo(a+N,R);break}default:l.moveTo(a,R),l.lineTo(a+N,R)}l.stroke(),l.setLineDash([])}if(M&&(l.strokeStyle=p,l.lineWidth=L,l.beginPath(),l.moveTo(a,s+n.char.top+E),l.lineTo(a+N,s+n.char.top+E),l.stroke()),S){const k=Math.max(1,Math.floor(g*y/10)),z=s+n.char.top+Math.floor(n.char.height/2)-(k%2===1?.5:0);l.strokeStyle=p,l.lineWidth=k,l.beginPath(),l.moveTo(a,z),l.lineTo(a+N,z),l.stroke()}l.restore()}const rd=4,b5=3;class y5{constructor(n,a,s,o){$(this,"atlas");$(this,"fades",new t5);$(this,"cols",0);$(this,"rows",0);$(this,"painted",{content:new Uint32Array(0),fg:new Uint32Array(0),bg:new Uint32Array(0),ext:new Uint32Array(0),meta:new Uint32Array(0),combined:[]});$(this,"row",{content:new Uint32Array(0),fg:new Uint32Array(0),bg:new Uint32Array(0),ext:new Uint32Array(0),combined:[]});$(this,"work",GC());this.ctx=n,this.core=s,this.dimensions=o,this.atlas=new m5(a)}resize(n,a){this.cols=n,this.rows=a,this.fades.clear();const s=n*a;this.painted={content:new Uint32Array(s).fill(Jl),fg:new Uint32Array(s),bg:new Uint32Array(s),ext:new Uint32Array(s),meta:new Uint32Array(s).fill(Jl),combined:new Array(s).fill("")},this.row={content:new Uint32Array(n),fg:new Uint32Array(n),bg:new Uint32Array(n),ext:new Uint32Array(n),combined:new Array(n).fill("")}}invalidate(){this.painted.content.fill(Jl),this.painted.meta.fill(Jl),this.fades.clear()}hasPaintedInk(n,a){const s=this.dimensions.device;if(!s.cell.width||!s.cell.height)return!1;const o=Math.min(this.cols,Math.floor(n/s.cell.width)),c=Math.min(this.rows,Math.floor(a/s.cell.height)),h=this.painted;for(let m=0;m<c;m++)for(let p=0;p<o;p++){const g=m*this.cols+p,y=h.content[g];if(y===Jl||h.meta[g]===rd||ta(h.fg[g]))continue;const v=y&Qe.CODEPOINT_MASK;if(y&Qe.IS_COMBINED_MASK?h.combined[g]!=="":v!==0&&v!==32)return!0}return!1}loadRow(n,a){const{content:s,fg:o,bg:c,ext:h,combined:m}=this.row,p=this.work;for(let g=0;g<this.cols;g++)n&&g<n.length?(n.loadCell(g,p),s[g]=p.content,o[g]=p.fg,c[g]=p.bg,h[g]=ky(p),m[g]=p.content&Qe.IS_COMBINED_MASK?p.combinedData:""):(s[g]=1<<Qe.WIDTH_SHIFT,o[g]=0,c[g]=0,h[g]=0,m[g]="");if(a)for(const g of a){const y=g.col;if(y<0||y+g.width>this.cols)continue;y>0&&!(s[y]>>>Qe.WIDTH_SHIFT)&&this.blankAt(y-1);const v=y+g.width;v<this.cols&&!(s[v]>>>Qe.WIDTH_SHIFT)&&s[v-1]>>>Qe.WIDTH_SHIFT===2&&this.blankAt(v);const x=$C(g.chars,g.width);s[y]=x.content,m[y]=x.combinedData,o[y]=g.style.fg,c[y]=g.style.bg,h[y]=g.style.ext,g.width===2&&(s[y+1]=0,m[y+1]="",o[y+1]=g.style.fg,c[y+1]=g.style.bg,h[y+1]=g.style.ext)}}blankAt(n){this.row.content[n]=32|1<<Qe.WIDTH_SHIFT,this.row.combined[n]=""}paintRow(n,a,s=null,o=0){const c=this.cols,{content:h,fg:m,bg:p,ext:g,combined:y}=this.row,v=this.painted,x=n*c;s&&this.fades.begin(n,c,s,v,this.row,o);let w=0,S=-1,M=-1,N="";const L=()=>{S<0||(this.fillCells(S,n,M-S,N),S=-1)};let E=0;for(;E<c;){let z=h[E]>>>Qe.WIDTH_SHIFT;z===0&&(z=1),E+z>c&&(z=c-E),z===1&&E+1<c&&this.overflowsInto(E)&&(z=2);const R=a&&a.y===n&&a.x>=E&&a.x<E+z?a.shape:Zn.NONE,D=z|R<<b5,j=this.fades.size>0?this.fades.at(x+E,E,this.row,o):null;let H=j!==null||this.differs(x+E,E,D);for(let K=1;K<z;K++)this.differs(x+E+K,E+K,rd)&&(H=!0);if(H){for(let q=0;q<z;q++){const te=x+E+q;v.content[te]=h[E+q],v.fg[te]=m[E+q],v.bg[te]=p[E+q],v.ext[te]=g[E+q],v.meta[te]=q===0?j?D|e5:D:rd,v.combined[te]=y[E+q]}w+=z;const K=j?null:this.plainFill(E,R);K!==null?S>=0&&M===E&&N===K?M=E+z:(L(),S=E,M=E+z,N=K):(L(),this.paintCell(E,n,z,R,j))}E+=z}return L(),w}differs(n,a,s){const o=this.painted,c=this.row;return o.meta[n]!==s||o.content[n]!==c.content[a]||o.fg[n]!==c.fg[a]||o.bg[n]!==c.bg[a]||o.ext[n]!==c.ext[a]||o.combined[n]!==c.combined[a]}overflowsInto(n){const{content:a,fg:s,bg:o,ext:c}=this.row,h=a[n];if((h&Qe.CODEPOINT_MASK)<128&&!(h&Qe.IS_COMBINED_MASK)||h>>>Qe.WIDTH_SHIFT!==1||ta(s[n]))return!1;const p=a[n+1],g=p&Qe.CODEPOINT_MASK;if(p>>>Qe.WIDTH_SHIFT!==1||p&Qe.IS_COMBINED_MASK||g!==0&&g!==32||o[n]!==o[n+1]||c[n+1]!==0||(s[n]&st.INVERSE)!==(s[n+1]&st.INVERSE)||s[n]&st.INVERSE&&s[n]!==s[n+1]||s[n+1]&(st.UNDERLINE|st.STRIKETHROUGH)||o[n+1]&ji.OVERLINE)return!1;const y=this.charsAt(n);return this.core.optionsService.rawOptions.customGlyphs!==!1&&qy(y)?!1:this.atlas.overflow(y,la(s[n]),bs(o[n]))>0}charsAt(n){const a=this.row.content[n];if(a&Qe.IS_COMBINED_MASK)return this.row.combined[n];const s=a&Qe.CODEPOINT_MASK;return s?String.fromCodePoint(s):""}plainFill(n,a){if(a!==Zn.NONE)return null;const{content:s,fg:o,bg:c}=this.row,h=s[n],m=h&Qe.CODEPOINT_MASK,p=!(h&Qe.IS_COMBINED_MASK)&&(m===0||m===32),g=ta(o[n]);return!p&&!g||(o[n]&(st.UNDERLINE|st.STRIKETHROUGH)||c[n]&ji.OVERLINE)&&!g?null:gs(o[n],c[n],this.colors(),this.boldBright()).bg}paintCell(n,a,s,o,c=null){const h=this.ctx,m=this.dimensions.device,p=this.colors(),g=this.row.fg[n],y=this.row.bg[n],v=this.row.ext[n],x=gs(g,y,p,this.boldBright());let w=x.fg,S=x.bg;o===Zn.BLOCK&&(S=p.cursor.css,w=p.cursorAccent.css);const M=ta(g),N=this.charsAt(n),L=n*m.cell.width,E=a*m.cell.height,k=s*m.cell.width,z=m.cell.height,R=M||N===""||N===" ",D=R?null:this.atlas.get({chars:N,bold:la(g),italic:bs(y),dim:Ts(y),fg:w,bg:S,cells:s}),j=c&&!c.gone?c.alpha:1;if(D&&j===1?h.drawImage(D.source,D.x,D.y,D.width,D.height,L,E,k,z):(h.fillStyle=S,h.fillRect(L,E,k,z),D?(h.globalAlpha=j,h.drawImage(D.source,D.x,D.y,D.width,D.height,L,E,k,z),h.globalAlpha=1):R||(h.save(),h.beginPath(),h.rect(L,E,k,z),h.clip(),h.fillStyle=w,h.globalAlpha=(Ts(y)?$d:1)*j,h.font=this.atlas.fontString(la(g),bs(y)),h.fillText(N,L+m.char.left,E+m.char.top+m.char.height),h.restore())),c!=null&&c.gone){const K=o===Zn.BLOCK||(g&st.INVERSE)!==0?w:gs(c.gone.fg,c.gone.bg,p,this.boldBright()).fg;n5(h,this.atlas,c,{fg:K,bg:S},{px:L,py:E,width:k,height:z,cells:s})}!M&&p5(g,y)&&g5(h,m,{px:L,py:E,cells:s,fgWord:g,bgWord:y,ext:v,fgCss:w},{fontSize:this.core.optionsService.rawOptions.fontSize,dpr:this.core._coreBrowserService.dpr,colors:p,boldBright:this.boldBright()}),o!==Zn.NONE&&o!==Zn.BLOCK&&Py(h,m,L,E,k,o,{css:p.cursor.css,dpr:this.core._coreBrowserService.dpr,cursorWidth:this.core.optionsService.rawOptions.cursorWidth})}fillCells(n,a,s,o){const c=this.dimensions.device;this.ctx.fillStyle=o,this.ctx.fillRect(n*c.cell.width,a*c.cell.height,s*c.cell.width,c.cell.height)}fillBackground(){this.ctx.fillStyle=this.colors().background.css,this.ctx.fillRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height)}configureAtlas(){const n=this.dimensions.device,a=this.core.optionsService.rawOptions;this.atlas.configure({cellWidth:n.cell.width,cellHeight:n.cell.height,charWidth:n.char.width,charHeight:n.char.height,charLeft:n.char.left,charTop:n.char.top,dpr:this.core._coreBrowserService.dpr},{fontFamily:a.fontFamily,fontSize:a.fontSize,fontWeight:a.fontWeight,fontWeightBold:a.fontWeightBold,customGlyphs:a.customGlyphs!==!1})}colors(){return this.core._themeService.colors}boldBright(){return this.core.optionsService.rawOptions.drawBoldTextInBrightColors!==!1}}function v5(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}}function x5(l,n,a,s){const o=n._charSizeService;if(!o.hasValidSize)return!1;const c=n._coreBrowserService.dpr,h=n.optionsService.rawOptions;return l.device.char.width=Math.floor(o.width*c),l.device.char.height=Math.ceil(o.height*c),l.device.cell.height=Math.floor(l.device.char.height*h.lineHeight),l.device.char.top=h.lineHeight===1?0:Math.round((l.device.cell.height-l.device.char.height)/2),l.device.cell.width=l.device.char.width+Math.round(h.letterSpacing),l.device.char.left=Math.floor(h.letterSpacing/2),l.device.canvas.height=s*l.device.cell.height,l.device.canvas.width=a*l.device.cell.width,l.css.canvas.height=Math.round(l.device.canvas.height/c),l.css.canvas.width=Math.round(l.device.canvas.width/c),l.css.cell.height=l.css.canvas.height/s,l.css.cell.width=l.css.canvas.width/a,!0}function w5(l,n,a){if(!l||typeof l.ResizeObserver!="function")return null;let s=new l.ResizeObserver(o=>{var p;const c=o.find(g=>g.target===n);if(!c)return;if(!("devicePixelContentBoxSize"in c)||!((p=c.devicePixelContentBoxSize)!=null&&p[0])){s==null||s.disconnect(),s=null;return}const h=c.devicePixelContentBoxSize[0].inlineSize,m=c.devicePixelContentBoxSize[0].blockSize;h<=0||m<=0||h===n.width&&m===n.height||a(h,m)});try{s.observe(n,{box:"device-pixel-content-box"})}catch{s.disconnect(),s=null}return{dispose:()=>s==null?void 0:s.disconnect()}}function S5(l){if(!l)return[];const n=l.cells.map(a=>a.row);return l.cursor&&n.push(l.cursor.row),n}function C5(l){const n=new Map;for(const a of(l==null?void 0:l.cells)??[]){const s=n.get(a.row);s?s.push(a):n.set(a.row,[a])}return n}class T5{constructor(n){$(this,"canvas");$(this,"ctx");$(this,"selection",null);$(this,"link",null);this.canvas=n.createElement("canvas"),this.canvas.classList.add("xterm-decor-layer"),this.canvas.style.zIndex="2";const a=this.canvas.getContext("2d");if(!a)throw new Error("2D canvas unavailable");this.ctx=a}setSelection(n,a,s){this.selection=n&&a&&!(n[0]===a[0]&&n[1]===a[1])?{start:[n[0],n[1]],end:[a[0],a[1]],columnSelectMode:s}:null}paint({dims:n,rows:a,cols:s,ydisp:o,colors:c,focused:h,dpr:m,cursorWidth:p,caret:g}){var S;const y=this.ctx;if(y.clearRect(0,0,this.canvas.width,this.canvas.height),!n.cell.width||!a)return;const{selection:v,link:x}=this,w=(M,N,L,E)=>y.fillRect(M*n.cell.width,N*n.cell.height,L*n.cell.width,E*n.cell.height);if(v){const M=v.start[1]-o,N=v.end[1]-o,L=Math.max(M,0),E=Math.min(N,a-1);if(L<a&&E>=0)if(y.fillStyle=(h?c.selectionBackgroundTransparent:c.selectionInactiveBackgroundTransparent).css,v.columnSelectMode)w(v.start[0],L,v.end[0]-v.start[0],E-L+1);else{const k=M===L?v.start[0]:0,z=L===N?v.end[0]:s;w(k,L,z-k,1),w(0,L+1,s,Math.max(E-L-1,0)),L!==E&&w(0,E,N===E?v.end[0]:s,1)}}if(x){y.fillStyle=x.fg===257?c.background.css:x.fg!==void 0&&x.fg<256?((S=c.ansi[x.fg])==null?void 0:S.css)??c.foreground.css:c.foreground.css;const M=(N,L,E)=>y.fillRect(N*n.cell.width,(L+1)*n.cell.height-m-1,E*n.cell.width,m);if(x.y1===x.y2)M(x.x1,x.y1,x.x2-x.x1);else{M(x.x1,x.y1,x.cols-x.x1);for(let N=x.y1+1;N<x.y2;N++)M(0,N,x.cols);M(0,x.y2,x.x2)}}if(g){const M=Math.round(g.x*n.cell.width),N=g.y*n.cell.height;g.shape===Zn.BLOCK?(y.fillStyle=g.css,y.fillRect(M,N,n.cell.width,n.cell.height)):Py(y,n,M,N,n.cell.width,g.shape,{css:g.css,dpr:m,cursorWidth:p})}}}class M5{constructor(n,a){$(this,"text");$(this,"textContext");$(this,"decor");this.screen=a,this.text=n.createElement("canvas"),this.text.classList.add("xterm-text-layer"),this.text.style.zIndex="0";const s=this.text.getContext("2d",{alpha:!1});if(!s)throw new Error("2D canvas unavailable");this.textContext=s,this.decor=new T5(n),a.appendChild(this.text),a.appendChild(this.decor.canvas)}size(n){for(const a of[this.text,this.decor.canvas])a.width=n.device.canvas.width,a.height=n.device.canvas.height,a.style.width=`${n.css.canvas.width}px`,a.style.height=`${n.css.canvas.height}px`;this.screen.style.width=`${n.css.canvas.width}px`,this.screen.style.height=`${n.css.canvas.height}px`}watchDevicePixels(n,a,s,o){return w5(n,this.text,(c,h)=>{const m=a.css.canvas;if(!(Math.abs(c-m.width*s())>2||Math.abs(h-m.height*s())>2)){a.device.canvas.width=c,a.device.canvas.height=h;for(const p of[this.text,this.decor.canvas])p.width=c,p.height=h;o()}})}remove(){this.text.remove(),this.decor.canvas.remove()}}function A5(l,n){const a=l.fonts;return!a||typeof a.addEventListener!="function"?null:(a.addEventListener("loadingdone",n),{dispose:()=>a.removeEventListener("loadingdone",n)})}class E5{constructor(n,a,s){$(this,"startedAt",null);$(this,"held",null);$(this,"timer",null);this.now=n,this.maxHoldMs=a,this.onExpire=s}get pending(){return this.held}hold(n,a){const s=this.now();return this.startedAt===null&&(this.startedAt=s),s-this.startedAt>=this.maxHoldMs?!1:(this.held=this.held?{start:Math.min(this.held.start,n),end:Math.max(this.held.end,a)}:{start:n,end:a},this.timer||(this.timer=setTimeout(()=>{this.timer=null,this.onExpire()},this.maxHoldMs)),!0)}release(n,a){return this.held&&(n=Math.min(n,this.held.start),a=Math.max(a,this.held.end)),this.held=null,this.startedAt=null,this.timer&&(clearTimeout(this.timer),this.timer=null),{start:n,end:a}}dispose(){this.timer&&clearTimeout(this.timer)}}const N5=150;class Vd{constructor(n,a){$(this,"dimensions",v5());$(this,"redraw",new VC);$(this,"onRequestRedraw",this.redraw.event);$(this,"stats",{frames:0,heldFrames:0,lastPaintMs:0,lastCells:0,lastInputToPaintMs:null});$(this,"surface");$(this,"cells");$(this,"disposables",[]);$(this,"now");$(this,"syncHold");$(this,"cols",0);$(this,"rows",0);$(this,"overlayProvider",null);$(this,"typingZoneProvider",null);$(this,"reducedMotion");$(this,"paintedOverlayRows",new Set);$(this,"paintedCursorRow",-1);$(this,"lastYdisp",0);$(this,"inputAt",null);$(this,"blink",new $T(()=>this.requestCursorRow()));$(this,"glide",new qT);$(this,"slidingCaret",null);$(this,"disposed",!1);$(this,"isSynchronizing");$(this,"dprUsed",0);var h,m;this.core=n,this.now=a.now??(()=>performance.now()),this.syncHold=new E5(this.now,a.maxSyncHoldMs??N5,()=>this.flushHeld()),this.isSynchronizing=a.isSynchronizing??(()=>!1),this.reducedMotion=(m=(h=n._coreBrowserService.window).matchMedia)==null?void 0:m.call(h,"(prefers-reduced-motion: reduce)");const s=n._coreBrowserService.mainDocument;this.surface=new M5(s,n.screenElement),this.cells=new y5(this.surface.textContext,s,n,this.dimensions),this.disposables.push(n._themeService.onChangeColors(()=>{this.cells.atlas.clear(),this.invalidateAll(),this.redrawDecor()}),n.optionsService.onOptionChange(p=>{(p==="cursorBlink"||p==="cursorStyle")&&this.restartBlink()})),n.linkifier&&this.disposables.push(n.linkifier.onShowLinkUnderline(p=>{this.surface.decor.link=p,this.redrawDecor()}),n.linkifier.onHideLinkUnderline(()=>{this.surface.decor.link=null,this.redrawDecor()}));const o=this.surface.watchDevicePixels(n._coreBrowserService.window,this.dimensions,()=>n._coreBrowserService.dpr,()=>{this.invalidateAll(),this.cells.fillBackground(),this.redrawDecor(),this.redraw.fire({start:0,end:Math.max(0,this.rows-1)})});o&&this.disposables.push(o);const c=A5(s,()=>this.clearTextureAtlas());c&&this.disposables.push(c),this.restartBlink()}static install(n,a={}){const s=Ry(n);if(!s)return null;const o=new Vd(s,a);return s._renderService.setRenderer(o),s._renderService.handleResize(s._bufferService.cols,s._bufferService.rows),o}setOverlayProvider(n){this.overlayProvider=n,this.invalidateOverlay()}setTypingZoneProvider(n){this.typingZoneProvider=n}invalidateOverlay(){var s;const n=((s=this.overlayProvider)==null?void 0:s.call(this))??null,a=new Set(this.paintedOverlayRows);for(const o of S5(n))a.add(o);this.paintedCursorRow>=0&&a.add(this.paintedCursorRow+this.buffer().ydisp),this.requestAbsoluteRows(a)}markInput(){this.inputAt=this.now()}flushHeld(){const n=this.syncHold.pending;n&&this.redraw.fire({start:n.start,end:n.end})}handleDevicePixelRatioChange(){this.dimensions.device.cell.width&&this.dprUsed!==this.core._coreBrowserService.dpr&&this.handleResize(this.core._bufferService.cols,this.core._bufferService.rows)}handleResize(n,a){x5(this.dimensions,this.core,n,a)&&(this.dprUsed=this.core._coreBrowserService.dpr),this.surface.size(this.dimensions),this.cols=n,this.rows=a,this.cells.resize(n,a),this.paintedOverlayRows.clear(),this.paintedCursorRow=-1,this.cells.configureAtlas(),this.cells.fillBackground(),this.redrawDecor()}handleCharSizeChanged(){this.handleResize(this.core._bufferService.cols,this.core._bufferService.rows)}handleBlur(){this.blink.stop(),this.requestCursorRow(),this.redrawDecor()}handleFocus(){this.restartBlink(),this.requestCursorRow(),this.redrawDecor()}handleSelectionChanged(n,a,s){this.surface.decor.setSelection(n,a,s),this.redrawDecor()}handleCursorMove(){this.blink.running&&this.restartBlink()}clear(){this.invalidateAll(),this.cells.fillBackground()}clearTextureAtlas(){this.cells.atlas.clear(),this.invalidateAll(),this.redraw.fire({start:0,end:Math.max(0,this.rows-1)})}renderRows(n,a){if(this.disposed||!this.cols||!this.rows||!this.dimensions.device.cell.width)return;if(this.isSynchronizing()&&this.syncHold.hold(n,a)){this.stats.heldFrames++;return}const s=this.syncHold.release(n,a);this.paint(Math.max(0,s.start),Math.min(this.rows-1,s.end))}dispose(){if(!this.disposed){this.disposed=!0,this.blink.stop(),this.syncHold.dispose();for(const n of this.disposables)n.dispose();this.disposables.length=0,this.redraw.dispose(),this.cells.atlas.dispose(),this.surface.remove()}}uninstall(){const n=this.core._createRenderer;typeof n=="function"&&(this.core._renderService.setRenderer(n.call(this.core)),this.core._renderService.handleResize(this.core._bufferService.cols,this.core._bufferService.rows)),this.dispose()}get textCanvas(){return this.surface.text}hasPaintedInk(n,a){return this.cells.hasPaintedInk(n,a)}paint(n,a){var L,E,k;const s=this.now(),o=this.buffer(),c=o.ydisp;c!==this.lastYdisp&&(this.lastYdisp=c,this.cells.fades.clear(),this.redrawDecor());const h=(L=this.reducedMotion)!=null&&L.matches?null:((E=this.typingZoneProvider)==null?void 0:E.call(this))??null,m=h?h.row-c:-1,p=((k=this.overlayProvider)==null?void 0:k.call(this))??null,g=C5(p),y=this.cursorState(p),v=XT(y,p,c,this.colors()),x=this.glide.update(v,m,s),w=x?null:y,S=x&&(v==null?void 0:v.plain);S&&g.set(S.row,[...g.get(S.row)??[],S]);const M=new Set;for(let z=n;z<=a;z++)M.add(z);for(const z of this.paintedOverlayRows)fs(M,z-c,this.rows);for(const z of g.keys())fs(M,z-c,this.rows);this.paintedCursorRow>=0&&fs(M,this.paintedCursorRow,this.rows),w&&fs(M,w.y,this.rows);for(const z of this.cells.fades.rows(this.cols))fs(M,z,this.rows);let N=0;for(const z of M){this.cells.loadRow(o.lines.get(c+z),g.get(z+c));const R=z===m?{start:h.startCol,end:h.endCol}:null;N+=this.cells.paintRow(z,w,R,s)}this.cells.fades.size>0&&this.requestAbsoluteRows([...this.cells.fades.rows(this.cols)].map(z=>z+c)),(x||this.slidingCaret)&&(this.slidingCaret=x,this.redrawDecor(),x&&this.requestAbsoluteRows([x.y+c])),this.paintedOverlayRows=new Set(g.keys()),this.paintedCursorRow=w?w.y:-1,this.stats.frames++,this.stats.lastCells=N,this.stats.lastPaintMs=this.now()-s,this.inputAt!==null&&N>0&&(this.stats.lastInputToPaintMs=this.now()-this.inputAt,this.inputAt=null)}cursorState(n){return PT(this.core,this.buffer(),n,{rows:this.rows,cols:this.cols},this.blink.hidden)}restartBlink(){if(this.blink.stop(),this.disposed||!this.core.optionsService.rawOptions.cursorBlink||!this.core._coreBrowserService.isFocused){this.requestCursorRow();return}this.blink.start(),this.requestCursorRow()}requestCursorRow(){if(!this.rows)return;const n=this.buffer(),a=new Set;a.add(n.ybase+n.y),this.paintedCursorRow>=0&&a.add(this.paintedCursorRow+n.ydisp),this.requestAbsoluteRows(a)}redrawDecor(){this.surface.decor.paint({dims:this.dimensions.device,rows:this.rows,cols:this.cols,ydisp:this.buffer().ydisp,colors:this.colors(),focused:this.core._coreBrowserService.isFocused,dpr:this.core._coreBrowserService.dpr,cursorWidth:this.core.optionsService.rawOptions.cursorWidth,caret:this.slidingCaret})}invalidateAll(){this.cells.invalidate(),this.paintedCursorRow=-1}buffer(){return this.core._bufferService.buffer}colors(){return this.core._themeService.colors}requestAbsoluteRows(n){if(!this.rows)return;const a=this.buffer().ydisp;let s=1/0,o=-1/0;for(const c of n){const h=c-a;h<0||h>=this.rows||(s=Math.min(s,h),o=Math.max(o,h))}s<=o&&this.redraw.fire({start:s,end:o})}}function fs(l,n,a){n>=0&&n<a&&l.add(n)}const k5=30,Xy=640,Zy=240,lo=1,L5=720*60*60*1e3;function Wy(){const l=xs("local",Et.rendererProbe);if(!l)return{v:lo,ua:{}};try{const n=JSON.parse(l);return typeof n=="object"&&n!==null&&n.v===lo&&typeof n.ua=="object"&&n.ua!==null?n:{v:lo,ua:{}}}catch{return{v:lo,ua:{}}}}function _5(l,n=Date.now()){const a=Wy();a.ua[l]={failedAt:n},_i("local",Et.rendererProbe,JSON.stringify(a))}function R5(l,n=Date.now()){const a=typeof navigator<"u"?navigator.userAgent:"";if(!a)return!1;const o=Wy().ua[a];return!(!o||typeof o.failedAt!="number"||n-o.failedAt>L5)}function lb(l,n=Date.now()){const a=typeof navigator<"u"?navigator.userAgent:"";a&&_5(a,n)}function j5(l){if(l.length<4)return!0;const n=l[0],a=l[1],s=l[2],o=l[3];for(let c=4;c<l.length;c+=4)if(l[c]!==n||l[c+1]!==a||l[c+2]!==s||l[c+3]!==o)return!1;return!0}function O5(l){if(!l||l.width<=0||l.height<=0)return console.debug("Canvas probe inconclusive: text layer canvas missing or zero dimensions"),"inconclusive";let n=null;try{n=l.getContext("2d",{willReadFrequently:!0})||l.getContext("2d")}catch(o){return console.debug("Canvas probe inconclusive: failed to acquire 2D context:",o),"inconclusive"}if(!n)return console.debug("Canvas probe inconclusive: 2D context is null"),"inconclusive";const a=Math.min(l.width,Xy),s=Math.min(l.height,Zy);if(a<=0||s<=0)return console.debug("Canvas probe inconclusive: calculated sample dimensions are zero"),"inconclusive";try{const o=n.getImageData(0,0,a,s);return j5(o.data)?"blank":"healthy"}catch(o){return console.debug("Canvas probe inconclusive: getImageData threw exception:",o),"inconclusive"}}function ab(l=2){return new Promise(n=>{if(typeof requestAnimationFrame!="function"){setTimeout(n,32);return}let a=l;const s=()=>{a--,a<=0?n():requestAnimationFrame(s)};requestAnimationFrame(s)})}const od={kind:"dom",canvas:null,dispose:()=>{},verify:async()=>{}};function D5(l,n={}){if(R5())return od;let a;try{a=Vd.install(l,{isSynchronizing:n.isSynchronizing})}catch(m){return console.debug("Canvas renderer unavailable, using the DOM renderer:",m),lb(),od}if(!a)return od;let s=a,o=null;const c=()=>{var p;if(!s)return;lb();const m=s;s=null;try{m.uninstall()}catch{}(p=n.onRendererSwapped)==null||p.call(n,"dom")};return{get kind(){return s?"canvas":"dom"},get canvas(){return s},dispose:()=>{const m=s;s=null;try{m==null||m.dispose()}catch{}},verify:async()=>{if(s)return o||(o=(async()=>{try{const m=s.stats.frames;await ab(2);for(let g=0;g<k5&&s&&s.stats.frames===m;g++)await ab(1);if(!s)return;const p=O5(s.textCanvas);p==="blank"&&s.hasPaintedInk(Xy,Zy)?c():p==="blank"?console.debug("Canvas probe inconclusive: uniform, but no character was painted there"):p==="inconclusive"&&console.debug("Canvas probe inconclusive; retaining canvas renderer without blacklisting")}catch(m){console.debug("Canvas probe inconclusive: unexpected error during verify():",m)}finally{o=null}})(),o)}}}function z5(l,n,a){l.writeln(" ___ ___ .___ "),l.writeln(` / | \\ ____ _______| _/______ \x1B[1m${n}\x1B[0m`),l.writeln(`/ ~ \\/ __ \\\\_ __ \\ __/ ___/ \x1B[2m${a}\x1B[0m`),l.writeln("\\ Y / ___/ | | \\/|_ \\___ \\ "),l.writeln(" \\___|_ / \\___ >|__| /___/____ >"),l.writeln(" \\/ \\/ \\/ "),l.writeln("")}var H5=kx(),cd={exports:{}},sb;function B5(){return sb||(sb=1,(function(l,n){(function(a,s){l.exports=s()})(self,(()=>(()=>{var a={6:(h,m)=>{function p(y){try{const v=new URL(y),x=v.password&&v.username?`${v.protocol}//${v.username}:${v.password}@${v.host}`:v.username?`${v.protocol}//${v.username}@${v.host}`:`${v.protocol}//${v.host}`;return y.toLocaleLowerCase().startsWith(x.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(m,"__esModule",{value:!0}),m.LinkComputer=m.WebLinkProvider=void 0,m.WebLinkProvider=class{constructor(y,v,x,w={}){this._terminal=y,this._regex=v,this._handler=x,this._options=w}provideLinks(y,v){const x=g.computeLink(y,this._regex,this._terminal,this._handler);v(this._addCallbacks(x))}_addCallbacks(y){return y.map((v=>(v.leave=this._options.leave,v.hover=(x,w)=>{if(this._options.hover){const{range:S}=v;this._options.hover(x,w,S)}},v)))}};class g{static computeLink(v,x,w,S){const M=new RegExp(x.source,(x.flags||"")+"g"),[N,L]=g._getWindowedLineStrings(v-1,w),E=N.join("");let k;const z=[];for(;k=M.exec(E);){const R=k[0];if(!p(R))continue;const[D,j]=g._mapStrIdx(w,L,0,k.index),[H,K]=g._mapStrIdx(w,D,j,R.length);if(D===-1||j===-1||H===-1||K===-1)continue;const q={start:{x:j+1,y:D+1},end:{x:K,y:H+1}};z.push({range:q,text:R,activate:S})}return z}static _getWindowedLineStrings(v,x){let w,S=v,M=v,N=0,L="";const E=[];if(w=x.buffer.active.getLine(v)){const k=w.translateToString(!0);if(w.isWrapped&&k[0]!==" "){for(N=0;(w=x.buffer.active.getLine(--S))&&N<2048&&(L=w.translateToString(!0),N+=L.length,E.push(L),w.isWrapped&&L.indexOf(" ")===-1););E.reverse()}for(E.push(k),N=0;(w=x.buffer.active.getLine(++M))&&w.isWrapped&&N<2048&&(L=w.translateToString(!0),N+=L.length,E.push(L),L.indexOf(" ")===-1););}return[E,S]}static _mapStrIdx(v,x,w,S){const M=v.buffer.active,N=M.getNullCell();let L=w;for(;S;){const E=M.getLine(x);if(!E)return[-1,-1];for(let k=L;k<E.length;++k){E.getCell(k,N);const z=N.getChars();if(N.getWidth()&&(S-=z.length||1,k===E.length-1&&z==="")){const R=M.getLine(x+1);R&&R.isWrapped&&(R.getCell(0,N),N.getWidth()===2&&(S+=1))}if(S<0)return[x,k]}x++,L=0}return[x,L]}}m.LinkComputer=g}},s={};function o(h){var m=s[h];if(m!==void 0)return m.exports;var p=s[h]={exports:{}};return a[h](p,p.exports,o),p.exports}var c={};return(()=>{var h=c;Object.defineProperty(h,"__esModule",{value:!0}),h.WebLinksAddon=void 0;const m=o(6),p=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function g(y,v){const x=window.open();if(x){try{x.opener=null}catch{}x.location.href=v}else console.warn("Opening link blocked as opener could not be cleared")}h.WebLinksAddon=class{constructor(y=g,v={}){this._handler=y,this._options=v}activate(y){this._terminal=y;const v=this._options,x=v.urlRegex||p;this._linkProvider=this._terminal.registerLinkProvider(new m.WebLinkProvider(this._terminal,x,this._handler,v))}dispose(){var y;(y=this._linkProvider)==null||y.dispose()}}})(),c})()))})(cd)),cd.exports}var U5=B5(),K5=Lx();function I5({fontSize:l,fontFamily:n,theme:a,cols:s,rows:o}){const c=new K5.Terminal({fontSize:l,fontFamily:n,lineHeight:1.15,...a?{theme:{...a}}:{},allowProposedApi:!0,convertEol:!0,scrollback:5e3,cols:s,rows:o,screenReaderMode:!1,linkHandler:{activate:(h,m)=>{Ad(m)}}});try{const h=new H5.Unicode11Addon;c.loadAddon(h),c.unicode.activeVersion="11"}catch(h){console.debug("Unicode11 addon unavailable, using default width table:",h)}try{c.loadAddon(new U5.WebLinksAddon((h,m)=>{Ad(m)}))}catch(h){console.debug("WebLinks addon unavailable, URLs stay plain text:",h)}return c}function ms(l){var n,a;if(!l)return!1;try{const s=l.modes;if(s&&typeof s.mouseTrackingMode=="string"&&s.mouseTrackingMode!=="none")return!0;const o=l._core;if((n=o==null?void 0:o._coreMouseService)!=null&&n.areMouseEventsActive||(a=o==null?void 0:o.coreMouseService)!=null&&a.areMouseEventsActive||o!=null&&o.mouseMode&&o.mouseMode!=="none")return!0}catch{}return!1}function F5(l,n){const a=n.button??0,s=n.buttons??(l==="mouseup"?0:1);return new MouseEvent(l,{bubbles:!0,cancelable:!0,clientX:n.clientX,clientY:n.clientY,screenX:n.clientX,screenY:n.clientY,button:a,buttons:s})}function Qy(l,n,a){const s=F5(n,a);return l.dispatchEvent(s)}function Jy(l){var n;try{return((n=l.buffer)==null?void 0:n.active)||null}catch{return null}}function ud(l){var a;const n=(a=Jy(l))==null?void 0:a.viewportY;return typeof n=="number"&&Number.isFinite(n)?n:null}function G5(l){var n;try{(n=l.blur)==null||n.call(l)}catch{}}function rb(l){var a,s;const n=l;return n.coreMouseService||((a=n._core)==null?void 0:a.coreMouseService)||((s=n._core)==null?void 0:s._coreMouseService)||null}function Y5(l){var a;const n=l;return n.coreService||((a=n._core)==null?void 0:a.coreService)||null}class P5{constructor(n){this.options=n}getLogicalCoordinates(n,a){const s=this.options.getScale?this.options.getScale():1,o=this.options.getSurfaceElement?this.options.getSurfaceElement():null;if(s!==1&&o&&typeof o.getBoundingClientRect=="function"){const c=o.getBoundingClientRect();return Yy(n,a,c,s)}return{clientX:n,clientY:a}}getViewportElement(n){var o;const a=this.options.getSurfaceElement?this.options.getSurfaceElement():null;return(a==null?void 0:a.querySelector(".xterm-viewport"))||((o=n.element)==null?void 0:o.querySelector(".xterm-viewport"))||null}isInputLineHit(n,a){var E;const s=(E=a.buffer)==null?void 0:E.active,o=this.options.getSurfaceElement?this.options.getSurfaceElement():null,c=(o==null?void 0:o.querySelector(".xterm-screen"))||a.element||o,h=rl(a);if(!c||typeof c.getBoundingClientRect!="function"||h.cellHeight<=0)return!1;const m=c.getBoundingClientRect(),p=this.getLogicalCoordinates(n.clientX,n.clientY),g=m.width>0&&m.height>0;if(![s==null?void 0:s.cursorY,s==null?void 0:s.viewportY,s==null?void 0:s.baseY].every(k=>typeof k=="number"&&Number.isFinite(k)))return!1;const v=s==null?void 0:s.cursorY,x=s==null?void 0:s.viewportY,S=(s==null?void 0:s.baseY)+v-x,M=m.top+S*h.cellHeight,N=M+h.cellHeight,L=Number(a.rows);return S>=0&&(!Number.isFinite(L)||S<L)&&p.clientY>=M-2&&p.clientY<=N+2&&(!g||p.clientX>=m.left&&p.clientX<=m.right)}resolveDispatchTarget(n,a){var m;const s=this.options.getSurfaceElement?this.options.getSurfaceElement():null,o=(s==null?void 0:s.querySelector(".xterm-screen"))||a.querySelector(".xterm-screen")||null,c=((m=o==null?void 0:o.closest)==null?void 0:m.call(o,".xterm"))||null;let h=null;return typeof document<"u"&&typeof document.elementFromPoint=="function"&&(h=document.elementFromPoint(n.clientX,n.clientY)),h&&c&&(h===c||c.contains(h))?h:o||s||a}getMouseReport(n,a){const s=this.options.getSurfaceElement?this.options.getSurfaceElement():null,o=(s==null?void 0:s.querySelector(".xterm-screen"))||a.element;if(!o||typeof o.getBoundingClientRect!="function")return null;const c=o.getBoundingClientRect(),h=this.getLogicalCoordinates(n.clientX,n.clientY),m=rl(a);if(m.cellWidth<=0||m.cellHeight<=0)return null;const p=Math.max(1,c.width||a.cols*m.cellWidth),g=Math.max(1,c.height||a.rows*m.cellHeight),y=Math.max(0,Math.min(p-1,h.clientX-c.left)),v=Math.max(0,Math.min(g-1,h.clientY-c.top)),x=Math.max(0,Math.min(a.cols-1,Math.floor(y/m.cellWidth))),w=Math.max(0,Math.min(a.rows-1,Math.floor(v/m.cellHeight)));return{col:x,row:w,x:Math.floor(y),y:Math.floor(v),button:0,action:0}}getWheelDispatchTarget(n){const a=this.options.getSurfaceElement?this.options.getSurfaceElement():null;return(a==null?void 0:a.querySelector(".xterm"))||n.element||null}dispatchWheel(n,a,s,o){const c=this.getWheelDispatchTarget(s);if(!c||typeof WheelEvent>"u"||a===0)return!1;const h=this.getLogicalCoordinates(n.clientX,n.clientY),m=a<0?-1:1;let p=0;for(let g=0;g<Math.abs(a);g+=1)try{const y=new WheelEvent("wheel",{bubbles:!0,cancelable:!0,clientX:h.clientX,clientY:h.clientY,deltaX:0,deltaY:m,deltaMode:1,ctrlKey:!!(o!=null&&o.ctrlKey),altKey:!!(o!=null&&o.altKey),shiftKey:!!(o!=null&&o.shiftKey)});c.dispatchEvent(y),p+=1}catch{return p>0}return p>0}emitWheel(n,a,s,o){if(a===0)return!1;if(this.dispatchWheel(n,a,s,o))return!0;const c=rb(s);if(!(c!=null&&c.triggerMouseEvent))return!1;let h=0;for(let m=0;m<Math.abs(a);m+=1){const p=this.getMouseReport(n,s);p&&(p.button=4,p.action=a<0?0:1,p.ctrl=!!(o!=null&&o.ctrlKey),p.alt=!!(o!=null&&o.altKey),p.shift=!!(o!=null&&o.shiftKey),c.triggerMouseEvent(p)&&(h+=1))}return h>0}scrollAlternateBuffer(n,a,s,o){var h;if(a===0)return"none";const c=ms(s);if(!c&&!this.options.getIsController())return"none";if(this.emitWheel(n,a,s,o))return c?"application-mouse":"application-keys";if(!c){const m=Y5(s);if(!(m!=null&&m.triggerDataEvent))return"none";const g=`\x1B${!!((h=m.decPrivateModes)!=null&&h.applicationCursorKeys)?"O":"["}${a<0?"A":"B"}`;return m.triggerDataEvent(g.repeat(Math.abs(a)),!0),"application-keys"}return"none"}emitMouse(n,a,s,o){const c=this.options.getTerminal();if(!c)return;const h=rb(c);if(h!=null&&h.triggerMouseEvent){const p=this.getMouseReport(a,c);p&&(p.action=n==="mousedown"?1:n==="mouseup"?0:32,p.ctrl=!!(s!=null&&s.ctrlKey),p.alt=!!(s!=null&&s.altKey),p.shift=!!(s!=null&&s.shiftKey),h.triggerMouseEvent(p));return}if(this.options.allowSyntheticMouseFallback===!1||!o)return;const m=this.getLogicalCoordinates(a.clientX,a.clientY);Qy(o,n,{clientX:m.clientX,clientY:m.clientY,button:0,buttons:n==="mouseup"?0:1})}}class $5{constructor(n){$(this,"options");$(this,"state","idle");$(this,"startX",0);$(this,"startY",0);$(this,"lastX",0);$(this,"lastY",0);$(this,"activeTarget",null);$(this,"longPressTimer",null);$(this,"capturedPointerId",null);$(this,"captureElement",null);$(this,"scrollRemainderY",0);$(this,"delivery");this.options={longPressDelayMs:500,dragThresholdPx:8,scrollLineHeightPx:18,...n},this.delivery=new P5(this.options)}getState(){return this.state}setGestureState(n){var a,s;this.state!==n&&(this.state=n,(s=(a=this.options).onGestureStateChange)==null||s.call(a,n))}beginGesture(n,a){this.startX=n.clientX,this.startY=n.clientY,this.lastX=n.clientX,this.lastY=n.clientY,this.setGestureState("pending"),this.scrollRemainderY=0,this.activeTarget=this.delivery.resolveDispatchTarget(n,a),this.clearLongPressTimer(),this.longPressTimer=setTimeout(()=>{var s,o;this.state==="pending"&&(this.setGestureState("longpress"),(o=(s=this.options).onLongPress)==null||o.call(s,{clientX:this.startX,clientY:this.startY}))},this.options.longPressDelayMs)}moveGesture(n,a){var g,y,v,x;if(this.state==="longpress"){(y=(g=this.options).onSelectionExtend)==null||y.call(g,{clientX:n.clientX,clientY:n.clientY}),a!=null&&a.cancelable&&((v=a.preventDefault)==null||v.call(a));return}if(this.state==="idle")return;const s=n.clientX-this.startX,o=n.clientY-this.startY,c=Math.hypot(s,o);if(this.state==="scrolling"){this.scrollGesture(n,a);return}const h=this.options.getTerminal(),m=this.options.getIsController(),p=ms(h);if(!(c<=(this.options.dragThresholdPx||8))){if(this.clearLongPressTimer(),Math.abs(o)>=Math.abs(s)||!p||!m){this.setGestureState("scrolling"),h&&G5(h),this.lastX=n.clientX,this.lastY=this.startY,this.scrollRemainderY=0,this.scrollGesture(n,a);return}if(p&&m){this.state==="pending"&&(this.setGestureState("dragging"),this.delivery.emitMouse("mousedown",{clientX:this.startX,clientY:this.startY},a,this.activeTarget)),this.state==="dragging"&&(this.lastX=n.clientX,this.lastY=n.clientY,this.delivery.emitMouse("mousemove",n,a,this.activeTarget),a!=null&&a.cancelable&&((x=a.preventDefault)==null||x.call(a)));return}this.lastX=n.clientX,this.lastY=n.clientY}}scrollGesture(n,a){var S,M,N;const s=this.options.getTerminal();if(!s)return;const o=n.clientY-this.lastY;this.lastX=n.clientX,this.lastY=n.clientY;const c=rl(s),h=c.measured?c.cellHeight:this.options.scrollLineHeightPx||c.cellHeight||18;this.scrollRemainderY+=o;const m=Math.trunc(this.scrollRemainderY/h),p=-m;let g=!1,y="none";const v=Jy(s),x=ms(s);if(p!==0){if((v==null?void 0:v.type)==="alternate")y=this.delivery.scrollAlternateBuffer(n,p,s,a),g=y!=="none";else{const L=ud(s);s.scrollLines(p);const E=ud(s);y="buffer",g=L===null||E===null||L!==E}this.scrollRemainderY-=m*h}const w=this.delivery.getViewportElement(s);(M=(S=this.options).onGestureScroll)==null||M.call(S,{deltaY:o,lines:p,viewportY:ud(s),scrollTop:(w==null?void 0:w.scrollTop)??null,scrollHeight:(w==null?void 0:w.scrollHeight)??null,clientHeight:(w==null?void 0:w.clientHeight)??null,moved:g,bufferType:(v==null?void 0:v.type)||null,baseY:typeof(v==null?void 0:v.baseY)=="number"?v.baseY:null,cursorY:typeof(v==null?void 0:v.cursorY)=="number"?v.cursorY:null,hasScrollback:typeof(v==null?void 0:v.hasScrollback)=="boolean"?v.hasScrollback:null,mouseTracking:x,scrollMode:y}),a!=null&&a.cancelable&&((N=a.preventDefault)==null||N.call(a))}endGesture(n,a){var h,m,p;this.clearLongPressTimer();const s=this.options.getTerminal(),o=this.options.getIsController(),c=ms(s);if(this.state==="pending"){if(c&&o){const y={clientX:this.startX,clientY:this.startY};this.delivery.emitMouse("mousedown",y,a,this.activeTarget),this.delivery.emitMouse("mouseup",y,a,this.activeTarget)}const g={clientX:this.startX,clientY:this.startY};o&&s&&this.delivery.isInputLineHit(g,s)&&((m=(h=this.options).onFocus)==null||m.call(h))}else if(this.state==="dragging"&&c&&o){const g=n??{clientX:this.lastX,clientY:this.lastY};this.delivery.emitMouse("mouseup",g,a,this.activeTarget),a!=null&&a.cancelable&&((p=a.preventDefault)==null||p.call(a))}this.reset()}handlePointerDown(n,a){if(n.pointerType==="mouse")return!1;if(!n.isPrimary)return this.releasePointerCapture(),this.reset(),!1;if(n.cancelable&&n.preventDefault(),this.beginGesture(n,a),n.pointerType!=="touch")try{typeof a.setPointerCapture=="function"&&(a.setPointerCapture(n.pointerId),this.capturedPointerId=n.pointerId,this.captureElement=a)}catch{}return!0}handlePointerMove(n){n.pointerType==="mouse"||this.state==="idle"||this.moveGesture(n,n)}handlePointerUp(n){n.pointerType==="mouse"||this.state==="idle"||(this.releasePointerCapture(),this.endGesture(n,n))}handlePointerCancel(n){n&&n.pointerType==="mouse"||(this.releasePointerCapture(),this.cancelGesture())}handleTouchStart(n,a){if(n.touches.length!==1){this.reset();return}n.cancelable&&n.preventDefault(),this.beginGesture(n.touches[0],a)}handleTouchMove(n){n.touches.length===1&&this.moveGesture(n.touches[0],n)}handleTouchEnd(n){n.cancelable&&n.preventDefault(),this.endGesture(null,n)}handleTouchCancel(){this.cancelGesture()}cancelGesture(){this.clearLongPressTimer();const n=this.options.getTerminal(),a=this.options.getIsController(),s=ms(n);if(this.state==="dragging"&&s&&a&&this.activeTarget){const o=this.delivery.getLogicalCoordinates(this.lastX,this.lastY);Qy(this.activeTarget,"mouseup",{clientX:o.clientX,clientY:o.clientY,button:0,buttons:0})}this.reset()}releasePointerCapture(){const n=this.captureElement,a=this.capturedPointerId;if(this.captureElement=null,this.capturedPointerId=null,!(!n||a===null))try{typeof n.releasePointerCapture=="function"&&(typeof n.hasPointerCapture!="function"||n.hasPointerCapture(a))&&n.releasePointerCapture(a)}catch{}}clearLongPressTimer(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressTimer=null)}reset(){this.clearLongPressTimer(),this.releasePointerCapture(),this.setGestureState("idle"),this.activeTarget=null}}function V5({container:l,term:n,isTouchDevice:a,debug:s,getTerminal:o,getIsController:c,getScale:h,getSurfaceElement:m,getSelection:p,onFocus:g}){const y=new $5({getTerminal:o,getIsController:c,getScale:h,getSurfaceElement:m,allowSyntheticMouseFallback:!1,onFocus:()=>{try{n.focus()}catch{}s==null||s(R=>({...R,focused:document.activeElement===n.textarea})),g()},onGestureStateChange:R=>{s==null||s(D=>({...D,state:R}))},onGestureScroll:({deltaY:R,lines:D,viewportY:j,scrollTop:H,scrollHeight:K,clientHeight:q,moved:te,bufferType:Z,baseY:ie,cursorY:oe,hasScrollback:P,mouseTracking:A,scrollMode:G})=>{s==null||s(W=>({...W,deltaY:R,lines:D,viewportY:j,scrollTop:H,scrollHeight:K,clientHeight:q,moved:te,focused:document.activeElement===n.textarea,bufferType:Z,baseY:ie,cursorY:oe,hasScrollback:P,mouseTracking:A,scrollMode:G,scrollCalls:W.scrollCalls+(D!==0?1:0),lastScrollLines:D}))},longPressDelayMs:500,dragThresholdPx:8,scrollLineHeightPx:18,onLongPress:a?R=>p().handleLongPress(R):void 0,onSelectionExtend:a?R=>p().handleSelectionExtend(R):void 0}),v=typeof window<"u"&&"PointerEvent"in window,x=typeof TouchEvent<"u",w=[],S={passive:!1,capture:!0},M=(R,D)=>{document.addEventListener(R,D,S),w.push(()=>document.removeEventListener(R,D,S))},N=(R,D=!1)=>{const j=R.target;return j instanceof Node&&l.contains(j)||D&&y.getState()!=="idle"},L=(R,D)=>{s==null||s(j=>({...j,[R]:j[R]+1,lastInputEvent:D}))},E=R=>{const D=p();return D.hasOpenMenu()?(D.clearSelection(),R.cancelable&&R.preventDefault(),R.stopPropagation(),!0):!1},k=()=>{y.getState()==="longpress"&&p().openMenuAtGesture()};if(v){if(M("pointerdown",R=>{if(!N(R)||(L("pointerEvents","pointerdown"),E(R)))return;y.handlePointerDown(R,l)&&R.stopPropagation()}),M("pointermove",R=>{N(R,!0)&&(L("pointerEvents","pointermove"),y.handlePointerMove(R),R.pointerType!=="mouse"&&R.stopPropagation())}),M("pointerup",R=>{N(R,!0)&&(L("pointerEvents","pointerup"),k(),y.handlePointerUp(R),R.pointerType!=="mouse"&&R.stopPropagation())}),M("pointercancel",R=>{N(R,!0)&&(L("pointerEvents","pointercancel"),p().clearSelection(),y.handlePointerCancel(R),R.pointerType!=="mouse"&&R.stopPropagation())}),x){const R=D=>{N(D,!0)&&(s==null||s(j=>({...j,touchEvents:j.touchEvents+1})),D.cancelable&&D.preventDefault(),D.stopPropagation())};for(const D of["touchstart","touchmove","touchend","touchcancel"])M(D,R)}}else M("touchstart",R=>{N(R)&&(L("touchEvents","touchstart"),!E(R)&&(R.touches.length===1&&R.stopPropagation(),y.handleTouchStart(R,l)))}),M("touchmove",R=>{N(R,!0)&&(L("touchEvents","touchmove"),R.touches.length===1&&R.stopPropagation(),y.handleTouchMove(R))}),M("touchend",R=>{N(R,!0)&&(L("touchEvents","touchend"),k(),R.stopPropagation(),y.handleTouchEnd(R))}),M("touchcancel",R=>{N(R,!0)&&(L("touchEvents","touchcancel"),p().clearSelection(),R.stopPropagation(),y.handleTouchCancel())});const z=R=>{R.preventDefault()};return l.addEventListener("contextmenu",z),w.push(()=>l.removeEventListener("contextmenu",z)),()=>{y.handlePointerCancel();for(const R of w)R()}}function q5(l,{requestFit:n,onPageVisible:a}){const s=new ResizeObserver(()=>{n()});s.observe(l);const o=()=>{n()},c=()=>{document.visibilityState==="visible"&&a()};window.addEventListener("resize",o),window.addEventListener("orientationchange",o),document.addEventListener("visibilitychange",c),window.addEventListener("pageshow",c);const h=()=>{n()};return typeof window<"u"&&window.visualViewport&&(window.visualViewport.addEventListener("resize",h),window.visualViewport.addEventListener("scroll",h)),()=>{s.disconnect(),window.removeEventListener("resize",o),window.removeEventListener("orientationchange",o),document.removeEventListener("visibilitychange",c),window.removeEventListener("pageshow",c),typeof window<"u"&&window.visualViewport&&(window.visualViewport.removeEventListener("resize",h),window.visualViewport.removeEventListener("scroll",h))}}function tl(l){if(l)try{l.refresh(0,Math.max(0,l.rows-1))}catch{}}function X5({containerRef:l,surfaceRef:n,termRef:a,rendererRef:s,currentScaleRef:o,initialBannerWrittenRef:c,live:h,selection:m,prediction:p,fit:g,isTouchDevice:y,debug:v,terminalFontSize:x,terminalFontFamily:w,hostTheme:S,glyphRevision:M,terminalResetVersion:N,isActive:L,subscribeToOutput:E,onOutput:k,onTitle:z,onRendererKind:R}){const{requestFit:D,scheduleBoundedFit:j,fitNow:H,seedFit:K,cancelPendingFits:q}=g;T.useEffect(()=>{var Xe,tt;if(!l.current||!n.current)return;const Z=l.current,ie=_d(Z,aa(),fd()),oe=rl(null,ua),P=Gy({width:ie.width,height:ie.height,cellWidth:oe.cellWidth,cellHeight:oe.cellHeight});h.current.sendResize(P.cols,P.rows),K(ie);const A=I5({fontSize:rg(x,ie.width),fontFamily:w,theme:h.current.hostTheme,cols:P.cols,rows:P.rows});A.open(n.current),a.current=A;const G=A.onTitleChange(xe=>{z(Md(xe)||null)}),{screenState:W,fieldProbe:se,overlay:Q}=p.attach(A);y&&A.textarea&&(A.textarea.readOnly=!1,A.textarea.tabIndex=0,A.textarea.inputMode="text");let ge=()=>{};if(v&&A.textarea){const xe=()=>{v(Ae=>({...Ae,focused:document.activeElement===A.textarea}))};A.textarea.addEventListener("focus",xe),A.textarea.addEventListener("blur",xe),ge=()=>{var Ae,rt;(Ae=A.textarea)==null||Ae.removeEventListener("focus",xe),(rt=A.textarea)==null||rt.removeEventListener("blur",xe)},xe()}const ye=async xe=>{p.discard("paste");const Ae=Ay(xe);if(Ae){if(xe.preventDefault(),xe.stopPropagation(),!h.current.isController){h.current.warnViewerMode();return}await h.current.uploadImage(Ae)}};(Xe=A.textarea)==null||Xe.addEventListener("paste",ye),Z.addEventListener("paste",ye);const ue=D5(A,{isSynchronizing:W.isSynchronizing,onRendererSwapped:xe=>{var Ae;Z.dataset.renderer=xe,R(xe),(Ae=p.overlayRef.current)==null||Ae.attach(null),tl(A)}});Q.attach(ue.canvas),(tt=ue.canvas)==null||tt.setTypingZoneProvider(()=>{const xe=se.detect();return xe&&{row:xe.row,startCol:xe.startCol,endCol:xe.endCol}});const Te=W.onSyncEnd(()=>{var xe,Ae;return(Ae=(xe=s.current)==null?void 0:xe.canvas)==null?void 0:Ae.flushHeld()});if(s.current=ue,Z.dataset.renderer=ue.kind,R(ue.kind),z5(A,h.current.t("terminal.bannerTitle"),h.current.t("terminal.bannerSubtitle")),c.current=!0,A.write("",()=>void ue.verify()),!y)try{A.focus()}catch{}const ce=typeof document<"u"?document.fonts:void 0;typeof(ce==null?void 0:ce.load)=="function"&&ce.load('13px "Symbols Nerd Font Mono"').then(()=>{a.current&&(tl(a.current),j(5))}).catch(()=>{});const be=A.onData(xe=>{const{isController:Ae}=h.current;let rt=xe;if(Ae&&Hy(xe)==="keys"&&Fx(xe)){const bt=h.current.consumeModifierLatch();bt&&(rt=uo(xe,bt))}const it=Dd(rt);if(!Ae&&!mo(it)){h.current.warnViewerMode();return}p.onUserInput(it),h.current.sendBinary(it)}),le=A.onBinary(xe=>{const Ae=new Uint8Array(xe.length);for(let rt=0;rt<xe.length;rt++)Ae[rt]=xe.charCodeAt(rt)&255;!h.current.isController&&!mo(Ae)||h.current.sendBinary(Ae)}),we=typeof A.onWriteParsed=="function"?A.onWriteParsed(()=>{var bt;if(m.current.onTerminalContentChanged(),se.invalidate(),W.isSynchronizing())return;const xe=A.buffer.active,Ae=xe.baseY+xe.cursorY,rt=Array.from({length:8},(yn,vn)=>{var kn;return((kn=xe.getLine(Ae-7+vn))==null?void 0:kn.translateToString(!0))??""}),it=Kw(rt,h.current.platform);it&&h.current.reportShellProfile(it),(bt=p.predictorRef.current)==null||bt.onServerOutput(),p.sync()}):{dispose:()=>{}},ae=typeof A.onRender=="function"?A.onRender(xe=>{var Ae;if(h.current.glyphScan){const rt=A.buffer.active.viewportY??0;let it="";for(let bt=xe.start;bt<=xe.end;bt+=1)it+=((Ae=A.buffer.active.getLine(rt+bt))==null?void 0:Ae.translateToString(!0))??"";/[^\x00-\x7f]/.test(it)&&h.current.ensureHostGlyphs(it)}m.current.onTerminalRender(A,xe.start,xe.end)}):{dispose:()=>{}},ve=typeof A.onScroll=="function"?A.onScroll(()=>{m.current.onTerminalScroll(A),p.discard("scroll")}):{dispose:()=>{}},Ne=V5({container:Z,term:A,isTouchDevice:y,debug:v,getTerminal:()=>a.current,getIsController:()=>h.current.isController,getScale:()=>o.current,getSurfaceElement:()=>n.current,getSelection:()=>m.current,onFocus:()=>{var xe,Ae;return(Ae=(xe=h.current).onTerminalFocus)==null?void 0:Ae.call(xe)}}),Ie=q5(Z,{requestFit:D,onPageVisible:()=>{j(10),tl(a.current)}});return()=>{var xe;be.dispose(),le.dispose(),ae.dispose(),ve.dispose(),we.dispose(),G.dispose(),Te.dispose(),p.detach(),W.dispose(),Ne(),Ie(),q(),ge(),(xe=A.textarea)==null||xe.removeEventListener("paste",ye),Z.removeEventListener("paste",ye),ue.dispose(),s.current=null,A.dispose(),a.current=null}},[]),T.useEffect(()=>{const Z=a.current;if(!Z)return;const ie=_d(l.current,aa(),fd()),oe=rg(x,ie.width),P=Z.options.fontSize!==oe||Z.options.fontFamily!==w;Z.options.fontSize=oe,Z.options.fontFamily=w,tl(Z),P&&H(),j(10)},[x,w]),T.useEffect(()=>{var ie,oe;const Z=a.current;!Z||!M||((oe=(ie=s.current)==null?void 0:ie.canvas)==null||oe.clearTextureAtlas(),tl(Z))},[M]);const te=T.useRef(N);T.useEffect(()=>{var ie;if(te.current===N)return;te.current=N,p.forget("resetVersion");const Z=a.current;if(Z)try{(ie=Z.reset)==null||ie.call(Z),Z.clear(),Z.refresh(0,Math.max(0,Z.rows-1))}catch{}},[N]),T.useEffect(()=>{const Z=a.current;!Z||!S||(Z.options.theme={...S},tl(Z))},[S]),T.useEffect(()=>E(ie=>{const oe=a.current;if(!oe)throw new Error("terminal not ready");oe.write(ie),k==null||k(ie.byteLength)}),[E,a,k]),T.useEffect(()=>{if(!L)return;j(10);const Z=a.current;if(Z&&(tl(Z),!y))try{Z.focus()}catch{}},[L,y,j,a])}const Z5=({onTerminalFocus:l,isActive:n=!0})=>{var kn;const a=T.useRef(null),s=T.useRef(null),o=T.useRef(null),c=T.useRef(null),h=T.useRef(null),m=T.useRef(1),p=T.useRef(null),g=T.useRef(!1),y=ow(),v=y||typeof navigator<"u"&&navigator.maxTouchPoints>0||typeof window<"u"&&"ontouchstart"in window,x=pC(),[w,S]=T.useState(mC),{metrics:M,record:N}=gC(x),[L,E]=T.useState(null),{settings:k,terminalFontFamily:z,terminalFontSize:R,hostFont:D,ensureHostGlyphs:j,profiles:H,activeProfileId:K,t:q}=Ee(),{isController:te,connectionState:Z,hostPalette:ie,herdrPrefixKeys:oe,terminalResetVersion:P,agentStatus:A,platform:G,reportShellProfile:W,connect:se,rttMs:Q}=et(),{addToast:ge}=Xt(),{sendResize:ye,sendBinary:ue,observeKeyInput:Te,consumeModifierLatch:ce,warnViewerMode:be,subscribeToOutput:le,subscribeToPasteFileReady:we}=Ns(),{uploadImage:ae}=Mo(),ve=Jn.useMemo(()=>yw(ie),[ie]),Ne=En({isController:te,sendBinary:ue,sendResize:ye,warnViewerMode:be,uploadImage:ae,t:q,consumeModifierLatch:ce,hostTheme:ve,onTerminalFocus:l,ensureHostGlyphs:j,glyphScan:D.glyphs.status==="ready",platform:G,reportShellProfile:W}),Ie=En(n),Xe=MT({termRef:h,rendererRef:p,mode:k.predictiveEcho,connectionState:Z,observeKeyInput:Te,herdrPrefixKeys:oe}),[tt,xe]=T.useState(null),Ae=FT({termRef:h,surfaceRef:o,mainRef:c,currentScaleRef:m,addToast:ge,t:q}),rt=En(Ae),it=wC({termRef:h,isController:te,warnViewerMode:be,uploadImage:ae,addToast:ge,t:q,onPaste:()=>Xe.discard("paste"),subscribeToPasteFileReady:we}),bt=jT({termRef:h,containerRef:a,frameRef:s,surfaceRef:o,currentScaleRef:m,rendererRef:p,initialBannerWrittenRef:g,isActiveRef:Ie,sendResize:ye,onResized:()=>Xe.forget("resize")});X5({containerRef:a,surfaceRef:o,termRef:h,rendererRef:p,currentScaleRef:m,initialBannerWrittenRef:g,live:Ne,selection:rt,prediction:Xe,fit:bt,isTouchDevice:y,debug:x?S:null,terminalFontSize:R,terminalFontFamily:z,hostTheme:ve,glyphRevision:D.glyphRevision,terminalResetVersion:P,isActive:n,subscribeToOutput:le,onOutput:x?N:null,onTitle:xe,onRendererKind:E});const yn=Jn.useMemo(()=>{var Zt;return((Zt=H.find(ut=>ut.id===K))==null?void 0:Zt.displayName)??null},[H,K]);T.useEffect(()=>{Z!=="connected"&&xe(null)},[Z]),T.useEffect(()=>{const Zt=n&&Z==="connected",ut=k.agentAlertBadge?Cs(A):null;tC(Zt?tt:null,yn,ut)},[n,Z,tt,yn,A,k.agentAlertBadge]),T.useEffect(()=>{Z==="disconnected"&&se()},[]);const vn=Zt=>{Zt.preventDefault()};return f.jsxs("main",{ref:c,className:"flex-1 w-full min-w-0 min-h-0 overflow-hidden relative flex flex-col",onContextMenu:vn,"aria-label":q("terminal.windowAriaLabel"),children:[f.jsx("div",{id:"terminal-container",ref:a,className:"absolute inset-0 overflow-hidden cursor-text",style:{touchAction:v?"none":"auto"},tabIndex:0,onContextMenu:vn,"aria-label":q("terminal.bufferAriaLabel"),role:"region",children:f.jsx("div",{id:"terminal-frame",ref:s,className:"relative overflow-hidden",style:{width:"100%",height:"100%"},children:f.jsx("div",{id:"terminal-surface",ref:o,className:"absolute top-0 left-0",style:{transformOrigin:"top left",width:"100%",height:"100%"}})})}),x&&f.jsx(xC,{debug:w,rttMs:Q,metrics:M,rendererKind:L,predictiveEcho:k.predictiveEcho,predictor:Xe.predictorRef.current,field:((kn=Xe.fieldProbeRef.current)==null?void 0:kn.detect())??null,renderer:p.current}),y&&Ae.selectionRect&&Ae.isHighlightVisible&&f.jsx(GT,{term:h.current,surface:o.current,main:c.current,rect:Ae.selectionRect,viewportY:Ae.viewportY}),y&&Ae.selectionMenu&&f.jsx(hC,{anchorPoint:Ae.selectionMenu,hasSelection:!!Ae.selectionSnapshot,isController:te,vibrateOnKeyPress:k.vibrateOnKeyPress,linkUrl:Ae.selectionMenu.link??null,onOpenLink:Zt=>{Ad(Zt)||ge("warning",q("clipboard.openLinkFailed"))},onCopySelection:Ae.handleCopySelection,onCopyLine:Ae.handleCopyLine,onCopyScreen:Ae.handleCopyScreen,onPaste:it.handlePaste,onClose:Ae.clearSelection}),y&&it.isPasteFallbackOpen&&f.jsx(fC,{isOpen:it.isPasteFallbackOpen,onClose:it.closePasteFallback,onSend:it.handleFallbackPasteSend,onSendImage:it.handleFallbackImageSend})]})},W5=2e3;function qd(){const{t:l}=Ee(),{addToast:n}=Xt(),[a,s]=T.useState(null),o=T.useRef(null);T.useEffect(()=>()=>{o.current&&clearTimeout(o.current)},[]);const c=T.useCallback((h,m,p="success")=>{Pd(h).then(g=>{if(g==="failed"){n("error",l("clipboard.copyFailed"));return}s(h),n(p,m),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>s(null),W5)})},[n,l]);return{copied:a,copy:c}}const il="herdr-remote pair",ob="herdr-remote",Q5=({onPairedSuccess:l})=>{const{settings:n,updateSettings:a,t:s}=Ee(),{connect:o,connectionState:c,stateDetail:h}=et(),{addToast:m}=Xt(),[p,g]=T.useState(""),{copied:y,copy:v}=qd(),[x,w]=T.useState(!1),[S,M]=T.useState(n.wsUrl||Rt),[N,L]=T.useState(n.token||""),[E,k]=T.useState(n.clientId||""),z=H=>v(H,s("toasts.commandCopied")),R=H=>{H.preventDefault();const K=p.trim().toUpperCase();if(!K&&!N.trim()){m("warning",s("toasts.connectionError"));return}const q={pairCode:K,wsUrl:S.trim()||Rt,clientId:E.trim()||n.clientId};N.trim()&&(q.token=N.trim()),a(q),o({pairCode:K||void 0,token:N.trim()||void 0,wsUrl:S.trim()||Rt,clientId:E.trim()||n.clientId}),l&&l()},D=c==="connecting"||c==="reconnecting",j=({n:H})=>f.jsxs("span",{"aria-hidden":"true",className:"shrink-0 font-bold text-tui-accent",children:["[",H,"]"]});return f.jsx("div",{className:"flex h-full w-full flex-1 justify-center overflow-y-auto bg-tui-crust p-2 sm:p-4",children:f.jsxs("div",{className:"my-auto w-full max-w-3xl space-y-3",children:[f.jsxs("div",{className:"border border-tui-border bg-tui-base px-3 py-2",children:[f.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[f.jsx("span",{"aria-hidden":"true",className:"font-bold text-tui-accent",children:"herdr-remote"}),f.jsx("h1",{className:"text-tui font-bold text-tui-text",children:s("onboarding.title")}),f.jsx("span",{className:"text-tui uppercase text-tui-warn",children:s("onboarding.firstTimeSetup")})]}),f.jsx("p",{className:"mt-0.5 text-tui leading-snug text-tui-muted",children:s("onboarding.description")})]}),c==="error"&&f.jsxs(Ri,{tone:"warn",action:f.jsx(Me,{variant:"warn",onClick:()=>o(),children:s("common.retry")}),children:[f.jsx("span",{className:"block font-bold",children:s("onboarding.authRequired")}),f.jsx("span",{className:"block text-tui-muted",children:h||s("onboarding.authRequiredDesc")})]}),f.jsxs("form",{onSubmit:R,className:"grid gap-3",children:[f.jsx(Nt,{title:s("onboarding.step1Title"),className:"min-w-0",children:f.jsxs("div",{className:"space-y-2",children:[f.jsxs("p",{className:"flex items-start gap-2 text-tui text-tui-muted",children:[f.jsx(j,{n:1}),f.jsx("span",{className:"leading-snug",children:s("onboarding.step1Desc")})]}),f.jsxs("div",{className:"flex items-center gap-2 border border-tui-border bg-tui-mantle px-2 py-1",children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 select-none text-tui-ok",children:"$"}),f.jsx("code",{className:"min-w-0 flex-1 truncate text-tui text-tui-text",children:il}),f.jsx(Me,{onClick:()=>z(il),glyph:y===il?ke.check:"⧉",className:ne("shrink-0",y===il&&"border-tui-ok text-tui-ok"),children:s(y===il?"common.copied":"common.copy")})]}),f.jsx("div",{className:"space-y-0.5 text-tui-sm",children:f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsx("span",{className:"truncate text-tui-faint",children:s("onboarding.step1TuiNote")}),f.jsx("button",{type:"button",onClick:()=>z(ob),className:"shrink-0 cursor-pointer border border-tui-border-dim px-1 text-tui-muted hover:border-tui-accent hover:text-tui-accent",title:s("common.clickToCopy"),children:f.jsx("code",{children:ob})})]})})]})}),f.jsx(Nt,{title:s("onboarding.step2Title"),className:"min-w-0",children:f.jsxs("div",{className:"space-y-2",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(j,{n:2}),f.jsx(xt,{type:"text",value:p,onChange:H=>g(H.target.value.toUpperCase()),placeholder:s("onboarding.step2Placeholder"),maxLength:12,autoFocus:!0,"aria-label":s("onboarding.step2Title"),className:"font-bold uppercase"})]}),f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:s("onboarding.step2Note")})]})}),f.jsx(Me,{variant:"primary",type:"submit",block:!0,disabled:D,className:"py-1.5",children:D?f.jsx(sl,{label:s("onboarding.connectingAndPairing")}):s("onboarding.connectAndPair")}),f.jsxs("div",{className:"border border-tui-border bg-tui-base",children:[f.jsxs("button",{type:"button",onClick:()=>w(!x),"aria-expanded":x,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:[f.jsx("span",{"aria-hidden":"true",className:"text-tui-accent",children:x?ke.chevronDown:ke.chevronRight}),f.jsx("span",{className:"uppercase",children:s("onboarding.advancedTitle")})]}),x&&f.jsxs("div",{className:"space-y-2.5 border-t border-tui-border-dim px-2 py-2",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(un,{htmlFor:"onboarding-token",children:s("onboarding.manualTokenLabel")}),f.jsx(xt,{id:"onboarding-token",type:"password",value:N,onChange:H=>L(H.target.value),placeholder:s("onboarding.manualTokenPlaceholder")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(un,{htmlFor:"onboarding-ws",children:s("onboarding.wsEndpointLabel")}),f.jsx(xt,{id:"onboarding-ws",type:"text",value:S,onChange:H=>M(H.target.value),placeholder:s("onboarding.wsEndpointPlaceholder")})]}),f.jsx(GS,{}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(un,{htmlFor:"onboarding-client-id",children:s("onboarding.clientIdLabel")}),f.jsx(xt,{id:"onboarding-client-id",type:"text",value:E,onChange:H=>k(H.target.value)})]})]})]})]})]})})},ei="tui-focusable inline-flex shrink-0 select-none items-center justify-center border text-tui font-medium transition-colors",ks="border-tui-border bg-tui-surface text-tui-text hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",J5="border-tui-accent bg-tui-accent text-tui-crust font-bold",eM="border-tui-ok bg-transparent text-tui-ok hover:bg-tui-ok hover:text-tui-crust font-bold",e0={default:ks,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"};function tM(l){return{capHeight:l?"h-8":"h-7",keyClass:l?"h-8 min-w-[2rem] px-1.5":"h-7 min-w-[1.75rem] px-1.5",squareKeyClass:l?"h-8 w-8":"h-7 w-7",drawerToggleClass:l?"h-8 px-1.5":"h-7 px-1.5"}}function nM({capHeight:l,onCustomize:n,sendCombo:a}){const{settings:s,t:o}=Ee(),{agentProfile:c,shellProfile:h}=et(),m=lw(c,s.agentKeymaps[c],h),p=y=>{let v="";try{v=hs(y.combo)}catch{}const x=y.custom?y.customLabel||"":o(`agentActions.${y.labelKey}`),w=y.labelKey==="interrupt"&&y.combo.trim().toLowerCase()==="ctrl+c"?"bad":y.combo.trim().toLowerCase()==="ctrl+z"?"warn":"default";return f.jsxs("button",{type:"button","data-testid":`agent-key-${y.id}`,onClick:()=>a(y.combo),className:ne(ei,l,"max-w-[10rem] gap-1 px-1.5",e0[w]),title:`${v} ${x}`.trim(),"aria-label":`${v} ${x}`.trim(),children:[f.jsx("span",{className:"font-bold",children:v}),f.jsx("span",{className:"max-w-[5rem] truncate text-tui-sm opacity-70",children:x})]},y.id)},g=[...m.agentActions,...m.genericActions];return g.length===0&&!n?null:f.jsxs("div",{"data-testid":"agent-key-actions",role:"group","aria-label":`${nl[c].name} ${o("agentKeymaps.agentGroup")}`,className:"flex shrink-0 items-center gap-1",children:[f.jsx("span",{"aria-hidden":"true",className:"mx-1 h-5 w-px shrink-0 bg-tui-border-dim"}),g.map(p),n&&f.jsx("button",{type:"button","data-testid":"agent-key-customize",onClick:n,className:ne(ei,l,"px-1.5 text-tui-sm border-tui-border-dim bg-transparent text-tui-faint hover:border-tui-accent hover:text-tui-accent"),title:o("agentKeymaps.customizeBar"),"aria-label":o("agentKeymaps.customizeBar"),children:o("agentKeymaps.customizeBarShort")})]})}const t0="scrollbar-none flex items-center gap-1 overflow-x-auto border-b border-tui-border-dim bg-tui-crust p-1.5";function iM({capHeight:l,onKey:n}){return f.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(a=>{const s=`F${a}`;return f.jsxs("button",{type:"button",onClick:()=>n(re[s]),className:ne(ei,ks,l),children:["F",a]},s)})})}const lM=[{code:re.CTRL_C,caption:"^C",title:"virtualKeyboard.ctrlCTitle",badge:"virtualKeyboard.badgeSigint",tone:"bad"},{code:re.CTRL_D,caption:"^D",title:"virtualKeyboard.ctrlDTitle",badge:"virtualKeyboard.badgeEof"},{code:re.CTRL_Z,caption:"^Z",title:"virtualKeyboard.ctrlZTitle",badge:"virtualKeyboard.badgeTstp",tone:"warn"},{code:re.CTRL_L,caption:"^L",title:"virtualKeyboard.ctrlLTitle",badge:"virtualKeyboard.badgeClear"},{code:re.CTRL_R,caption:"^R",title:"virtualKeyboard.ctrlRTitle",badge:"virtualKeyboard.badgeSearch"},{code:re.CTRL_A,caption:"^A",title:"virtualKeyboard.ctrlATitle",badge:"virtualKeyboard.badgeStart"},{code:re.CTRL_E,caption:"^E",title:"virtualKeyboard.ctrlETitle",badge:"virtualKeyboard.badgeEnd"},{code:re.CTRL_K,caption:"^K",title:"virtualKeyboard.ctrlKTitle",badge:"virtualKeyboard.badgeKill"}];function aM({capHeight:l,onKey:n}){const{t:a}=Ee();return f.jsx("div",{className:t0,children:lM.map(s=>f.jsxs("button",{type:"button",onClick:()=>n(s.code,!1),className:ne(ei,l,"gap-1.5 px-2",e0[s.tone??"default"]),title:a(s.title),children:[f.jsx("span",{className:"font-bold",children:s.caption}),f.jsx("span",{className:"text-tui-sm opacity-70",children:a(s.badge)})]},s.caption))})}const sM=["|","~","/","\\","-","_","$","&",";",":","`",'"',"'",">","<","=","#","@","{","}","[","]"];function rM({squareKeyClass:l,onKey:n}){return f.jsx("div",{className:t0,children:sM.map(a=>f.jsx("button",{type:"button",onClick:()=>n(a,!0),className:ne(ei,ks,l,"font-bold"),children:a},a))})}const cb="image/png,image/jpeg,image/webp,image/gif,image/*";function ub({fileInputRef:l}){const{uploadImage:n}=Mo(),a=s=>{var c;const o=(c=s.target.files)==null?void 0:c[0];s.target.value="",o&&n(o)};return f.jsxs(f.Fragment,{children:[f.jsx("input",{ref:l,type:"file",accept:cb,className:"hidden","data-testid":"key-toolbar-file-input",onChange:a}),f.jsx("input",{type:"file",accept:cb,capture:"environment",className:"hidden","data-testid":"key-toolbar-camera-input",onChange:a})]})}function db({collapsed:l}){const{uploadProgress:n}=Mo();return n.active?f.jsx("div",{"data-testid":l?"key-toolbar-progress-collapsed":"key-toolbar-progress",className:"w-full border-b border-tui-border-dim bg-tui-crust px-2 py-1",children:f.jsx(VS,{ratio:n.ratio,label:n.statusText,tone:n.phase==="completed"?"ok":n.phase==="error"?"bad":"accent","aria-label":n.statusText})}):null}function oM({fileInputRef:l,keyClass:n,vibrate:a}){const{t:s}=Ee(),{isController:o}=et(),{warnViewerMode:c}=Ns(),{uploadProgress:h}=Mo(),m=h.active,p=()=>{var g;if(a(),!o){c();return}m||(g=l.current)==null||g.click()};return f.jsx("button",{type:"button","data-testid":"image-upload-btn",onClick:p,disabled:m,className:ne(ei,n,m?"border-tui-border-dim bg-tui-surface opacity-60 cursor-not-allowed":ks),title:m?h.statusText:s("virtualKeyboard.uploadImageTitle"),"aria-label":s("virtualKeyboard.uploadImage"),children:f.jsx("span",{className:"font-medium",children:m?`${h.percent}%`:s("virtualKeyboard.image")})})}function cM(){const{settings:l}=Ee(),{isController:n}=et(),{sendKey:a,warnViewerMode:s,consumeModifierLatch:o}=Ns(),c=T.useRef([]);T.useEffect(()=>()=>{for(const g of c.current)clearTimeout(g);c.current=[]},[]);const h=T.useCallback(()=>{if(l.vibrateOnKeyPress&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(8)}catch{}},[l.vibrateOnKeyPress]),m=T.useCallback((g,y=!0)=>{if(h(),!n){s();return}const v=o();a(y&&v?uo(g,v):g)},[n,a,s,h,o]),p=T.useCallback(g=>{if(h(),!n){s();return}let y;try{y=gn(g)}catch{return}if(o(),y.length===1){a(y[0]);return}y.forEach((v,x)=>{const w=setTimeout(()=>{c.current=c.current.filter(S=>S!==w),a(v)},x*120);c.current.push(w)})},[o,n,a,h,s]);return{vibrate:h,pressKey:m,sendCombo:p}}function uM({capHeight:l}){const{platform:n,adminTerminalSupported:a,adapter:s}=et(),{t:o}=Ee();if(n!=="win32")return null;const c=a!==!1;return f.jsxs("button",{type:"button","data-testid":"new-admin-terminal",onClick:()=>s==null?void 0:s.sendAdminTabOpen(),disabled:!c,className:ne(ei,l,"shrink-0 gap-1 border-amber-500/50 bg-amber-500/10 px-2 text-amber-200 hover:border-amber-400 hover:bg-amber-500/20 disabled:cursor-not-allowed disabled:opacity-50"),title:o(c?"terminal.adminTerminalSetup":"terminal.adminTerminalUpdate"),"aria-label":o("terminal.newAdminTerminal"),children:[f.jsx("span",{"aria-hidden":"true",children:"⬆"}),f.jsx("span",{children:o("terminal.adminShort")})]})}const dM=({compact:l=!1,onCustomize:n})=>{const{settings:a,updateSettings:s,t:o}=Ee(),{modifierLatch:c,toggleModifierLatch:h}=Ns(),{vibrate:m,pressKey:p,sendCombo:g}=cM(),{capHeight:y,keyClass:v,squareKeyClass:x,drawerToggleClass:w}=tM(l),S=T.useRef(null),[M,N]=T.useState(!1),[L,E]=T.useState(!1),[k,z]=T.useState(!1),R=T.useRef(null),[D,j]=T.useState(!1),H=T.useCallback(()=>{const P=R.current;j(!!P&&P.scrollLeft+P.clientWidth<P.scrollWidth-1)},[]);if(T.useEffect(H),T.useEffect(()=>{const P=R.current;if(!P||typeof ResizeObserver!="function")return;const A=new ResizeObserver(H);return A.observe(P),()=>A.disconnect()},[H,a.toolbarVisible]),!a.toolbarVisible)return f.jsxs("div",{"data-testid":"key-toolbar-collapsed",className:"z-20 flex shrink-0 flex-col border-t border-tui-border bg-tui-mantle pb-[max(env(safe-area-inset-bottom,0px),0.125rem)]",children:[f.jsx(ub,{fileInputRef:S}),f.jsx(db,{collapsed:!0}),f.jsx("div",{className:"flex items-center justify-center px-2 py-0.5",children:f.jsxs("button",{type:"button",onClick:()=>s({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:o("virtualKeyboard.expandToolbar"),"aria-label":o("virtualKeyboard.expandToolbar"),"aria-expanded":!1,children:[f.jsx("span",{"aria-hidden":"true",children:"▴"}),f.jsx("span",{"aria-hidden":"true",children:o("common.keyBar")})]})})]});const K=a.virtualKeys&&a.virtualKeys.length>0?a.virtualKeys.filter(P=>P.enabled):$b,q=P=>P.id==="left"?f.jsx("span",{"aria-hidden":"true",children:"←"}):P.id==="up"?f.jsx("span",{"aria-hidden":"true",children:"↑"}):P.id==="down"?f.jsx("span",{"aria-hidden":"true",children:"↓"}):P.id==="right"?f.jsx("span",{"aria-hidden":"true",children:"→"}):P.id==="enter"?f.jsxs("span",{className:"flex items-center gap-1",children:[f.jsx("span",{"aria-hidden":"true",children:"⏎"}),f.jsx("span",{className:"hidden sm:inline",children:o("virtualKeyboard.keyEnter")})]}):P.id==="drawer_chords"?f.jsx("span",{children:"^C"}):P.id==="drawer_fn"?f.jsxs("span",{className:"flex items-center gap-0.5",children:[f.jsx("span",{children:"Fn"}),f.jsx("span",{"aria-hidden":"true",children:M?"▾":"▴"})]}):f.jsx("span",{children:P.label}),te=P=>{if(m(),P.type==="modifier"){P.modifierType==="ctrl"||P.modifierType==="alt"||P.modifierType==="shift"?h(P.modifierType):P.modifierType==="meta"&&p(re.ESC);return}if(P.type==="drawer"){P.drawerType==="fn"?(N(!M),E(!1),z(!1)):P.drawerType==="chords"?(z(!k),N(!1),E(!1)):P.drawerType==="symbols"&&(E(!L),N(!1),z(!1));return}p(P.code,P.type!=="chord")},Z=P=>{if(P.type==="modifier"){if(P.modifierType==="ctrl")return c.ctrl;if(P.modifierType==="alt")return c.alt;if(P.modifierType==="shift")return c.shift}if(P.type==="drawer"){if(P.drawerType==="fn")return M;if(P.drawerType==="chords")return k;if(P.drawerType==="symbols")return L}return!1},ie=P=>{const A=Z(P),G=["left","up","down","right"].includes(P.id),W=P.type==="drawer",se=yd(P,o);return f.jsx("button",{type:"button",onClick:()=>te(P),className:ne(ei,G?x:W?w:v,P.id==="enter"?eM:A?J5:ks),title:se,"aria-label":se,"aria-pressed":A,children:q(P)},P.id)},oe=K.find(P=>P.id==="enter");return f.jsxs("div",{"data-testid":"key-toolbar",className:ne("z-20 flex shrink-0 select-none flex-col border-t border-tui-border bg-tui-mantle",l?"pb-[max(env(safe-area-inset-bottom,0px),0.125rem)]":"pb-[max(env(safe-area-inset-bottom,0px),0.25rem)]"),role:"toolbar","aria-label":o("virtualKeyboard.touchKeyboardShortcuts"),children:[f.jsx(ub,{fileInputRef:S}),f.jsx(db,{collapsed:!1}),M&&f.jsx(iM,{capHeight:y,onKey:p}),k&&f.jsx(aM,{capHeight:y,onKey:p}),L&&f.jsx(rM,{squareKeyClass:x,onKey:p}),f.jsxs("div",{"data-testid":"key-toolbar-row",className:ne("flex flex-nowrap items-center justify-start gap-1",l?"px-1.5 py-1":"px-2 py-1.5"),children:[f.jsxs("div",{className:"relative min-w-0",children:[f.jsxs("div",{ref:R,"data-testid":"key-toolbar-scroll",onScroll:H,className:"scrollbar-none flex flex-nowrap touch-pan-x items-center gap-1 overflow-x-auto overscroll-x-contain",children:[f.jsx("button",{type:"button",onClick:()=>s({toolbarVisible:!1}),className:ne(ei,x,"mr-1 border-tui-border-dim bg-transparent text-tui-faint hover:border-tui-border hover:text-tui-text"),title:o("virtualKeyboard.collapseToolbar"),"aria-label":o("virtualKeyboard.collapseToolbar"),"aria-expanded":!0,children:f.jsx("span",{"aria-hidden":"true",children:"▾"})}),K.filter(P=>P.id!=="enter").map(ie),f.jsx(uM,{capHeight:y}),f.jsx(nM,{capHeight:y,onCustomize:n,sendCombo:g}),f.jsx(oM,{fileInputRef:S,keyClass:v,vibrate:m})]}),D&&f.jsx("span",{"aria-hidden":"true","data-testid":"key-toolbar-more",className:"pointer-events-none absolute inset-y-0 right-0 w-4 bg-gradient-to-l from-tui-mantle"})]}),oe&&ie(oe)]})]})},fM=({isOpen:l,onClose:n})=>{const{t:a}=Ee(),{isController:s,shellProfile:o}=et(),{sendKey:c,warnViewerMode:h}=Ns(),[m,p]=T.useState("");if(!l)return null;const g=Iw(o),y=x=>{if(x&&x.preventDefault(),!s){h();return}m.length>0?(c(`${m}\r`),p("")):c("\r")},v=x=>{if(!s){h();return}c(`${x}\r`)};return f.jsxs("section",{className:"z-20 flex flex-col gap-1.5 border-t border-tui-border bg-tui-mantle p-2","aria-label":a("virtualKeyboard.helperTitle"),children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("span",{className:"text-tui font-bold uppercase text-tui-accent",children:a("virtualKeyboard.helperTitle")}),f.jsx(Me,{variant:"ghost",onClick:n,"aria-label":a("virtualKeyboard.closeHelper"),children:"esc"})]}),f.jsx("div",{className:"scrollbar-none flex items-center gap-1 overflow-x-auto py-0.5",children:g.map(x=>f.jsx("button",{type:"button",onClick:()=>v(x),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:x},x))}),f.jsxs("form",{onSubmit:y,className:"flex items-center gap-1.5",children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 select-none font-bold text-tui-ok",children:"$"}),f.jsxs("div",{className:"relative flex-1",children:[f.jsx("label",{htmlFor:"virtual-keyboard-input",className:"sr-only",children:a("virtualKeyboard.placeholder")}),f.jsx(xt,{id:"virtual-keyboard-input",name:"terminal-input",type:"text",value:m,onChange:x=>p(x.target.value),placeholder:a("virtualKeyboard.placeholder"),inputMode:"text",enterKeyHint:"send",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,className:"select-text pr-7"}),m.length>0&&f.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":a("virtualKeyboard.clearInput"),children:f.jsx("span",{"aria-hidden":"true",children:ke.cross})})]}),f.jsx(Me,{variant:"primary",type:"submit",title:a("virtualKeyboard.sendButton"),glyph:"⏎",className:"h-9 shrink-0",children:f.jsx("span",{className:"hidden sm:inline",children:a("virtualKeyboard.sendButton")})})]})]})};function No(l,n){const a=(s,o)=>n?n(s):o;switch(l){case"connected":return{label:a("connection.live","Live"),level:"ok",needsAttention:!1};case"connecting":return{label:a("connection.connecting","Connecting"),level:"warn",needsAttention:!0};case"reconnecting":return{label:a("connection.reconnecting","Reconnecting"),level:"warn",needsAttention:!0,actionLabel:a("connection.reconnectNow","Reconnect now")};case"error":return{label:a("connection.error","Error"),level:"bad",needsAttention:!0,actionLabel:a("connection.retry","Retry")};default:return{label:a("connection.offline","Offline"),level:"idle",needsAttention:!0,actionLabel:a("connection.connect","Connect")}}}const n0=({hint:l,children:n})=>{const{t:a}=Ee(),[s,o]=T.useState(!1);return f.jsxs("div",{className:"border border-tui-border-dim",children:[f.jsxs("button",{type:"button",onClick:()=>o(!s),"aria-expanded":s,className:"tui-focusable flex w-full items-center gap-2 px-2 py-1 text-left text-tui text-tui-muted transition-colors hover:text-tui-accent",children:[f.jsx("span",{"aria-hidden":"true",className:"text-tui-accent",children:s?ke.chevronDown:ke.chevronRight}),f.jsx("span",{children:a("pairing.advancedTitle")}),f.jsx("span",{className:"min-w-0 truncate text-tui-sm text-tui-faint",children:l})]}),s&&f.jsx("div",{className:"space-y-2.5 border-t border-tui-border-dim px-2 py-2",children:n})]})},hM=({isOpen:l,onClose:n})=>{const{settings:a,updateSettings:s,t:o,activeProfile:c,activeProfileId:h,renameProfile:m}=Ee(),{connect:p,disconnect:g,connectionState:y,hostId:v}=et(),{addToast:x}=Xt(),[w,S]=T.useState(a.wsUrl),[M,N]=T.useState(a.token),[L,E]=T.useState(a.pairCode),[k,z]=T.useState(a.clientId),[R,D]=T.useState((c==null?void 0:c.displayName)||""),[j,H]=T.useState(a.autoReconnect);if(T.useEffect(()=>{l&&(S(a.wsUrl),N(a.token),E(a.pairCode),z(a.clientId),D((c==null?void 0:c.displayName)||""),H(a.autoReconnect))},[l,a,c]),!l)return null;const K=te=>{te.preventDefault();const Z={wsUrl:w.trim()||Rt,token:M.trim(),pairCode:L.trim().toUpperCase(),clientId:k.trim()||a.clientId,autoReconnect:j};if(!Z.token&&!Z.pairCode){x("warning",o("pairing.credentialsRequired"));return}s(Z),h&&R.trim()&&m(h,R),g(),p({wsUrl:Z.wsUrl,token:Z.token||void 0,pairCode:Z.pairCode||void 0,clientId:Z.clientId,autoReconnect:j}),n()},q=No(y,o);return f.jsxs(fa,{isOpen:l,onClose:n,title:o("pairing.title"),closeLabel:o("common.closeDialog"),hints:[{keys:"esc",action:o("common.close")},{keys:"⏎",action:o("pairing.saveAndConnect")}],footer:f.jsxs(f.Fragment,{children:[y==="connected"&&f.jsx(Me,{variant:"danger",onClick:()=>{g(),n()},children:o("common.disconnect")}),f.jsx(Me,{variant:"primary",type:"submit",form:"pairing-form",children:o("pairing.saveAndConnect")})]}),children:[f.jsxs("div",{className:"mb-3 flex min-w-0 items-center gap-1.5 border-b border-tui-border-dim pb-2 text-tui",children:[f.jsx(dn,{level:q.level}),f.jsx("span",{className:"shrink-0 text-tui-text",children:q.label}),v&&f.jsxs("span",{className:"truncate text-tui-muted",children:["· ",v]})]}),f.jsxs("form",{id:"pairing-form",onSubmit:K,className:"space-y-3",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(un,{htmlFor:"pairing-name",children:o("pairing.displayNameLabel")}),f.jsx(xt,{id:"pairing-name",type:"text",value:R,onChange:te=>D(te.target.value),placeholder:o("pairing.displayNamePlaceholder"),maxLength:64,autoComplete:"off"})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(un,{htmlFor:"pairing-code",hint:o("pairing.repairNote"),children:o("pairing.pairCodeLabel")}),f.jsx(xt,{id:"pairing-code",type:"text",value:L,onChange:te=>E(te.target.value.toUpperCase()),placeholder:o("pairing.pairCodePlaceholder"),maxLength:12,autoComplete:"off",className:"uppercase"})]}),f.jsxs(n0,{hint:o("pairing.editAdvancedHint"),children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(un,{htmlFor:"pairing-ws",children:o("pairing.wsUrlLabel")}),f.jsx(xt,{id:"pairing-ws",type:"text",value:w,onChange:te=>S(te.target.value),placeholder:o("pairing.wsUrlPlaceholder")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(un,{htmlFor:"pairing-token",hint:o("pairing.tokenNote"),children:o("pairing.tokenLabel")}),f.jsx(xt,{id:"pairing-token",type:"password",value:M,onChange:te=>N(te.target.value),placeholder:o("pairing.tokenPlaceholder")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(un,{htmlFor:"pairing-client-id",children:o("pairing.clientIdLabel")}),f.jsxs("div",{className:"flex gap-2",children:[f.jsx(xt,{id:"pairing-client-id",type:"text",value:k,onChange:te=>z(te.target.value),className:"flex-1"}),f.jsx(Me,{onClick:()=>z(`client-${Math.random().toString(36).substring(2,8)}`),className:"shrink-0",children:o("pairing.newIdButton")})]})]}),f.jsx(PS,{checked:j,onChange:H,label:o("pairing.autoReconnectLabel")})]})]})]})},mM=({isOpen:l,onClose:n})=>{const{t:a,addProfileAndConnect:s}=Ee(),{addToast:o}=Xt(),[c,h]=T.useState(""),[m,p]=T.useState(Rt),[g,y]=T.useState("");T.useEffect(()=>{l&&(h(""),p(Rt),y(""))},[l]);const v=x=>{x.preventDefault();const w=c.trim().toUpperCase();if(!w&&!g.trim()){o("warning",a("pairing.credentialsRequired"));return}s({wsUrl:m.trim()||Rt,pairCode:w,token:g.trim()}),n()};return f.jsx(fa,{isOpen:l,onClose:n,title:a("pairing.addTitle"),subtitle:a("pairing.addSubtitle"),closeLabel:a("common.closeDialog"),size:"sm",hints:[{keys:"esc",action:a("common.close")},{keys:"⏎",action:a("pairing.pairAndConnect")}],footer:f.jsx(Me,{variant:"primary",type:"submit",form:"add-host-form",children:a("pairing.pairAndConnect")}),children:f.jsxs("form",{id:"add-host-form",onSubmit:v,className:"space-y-3",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(un,{htmlFor:"add-host-code",hint:a("pairing.pairCodeNote"),children:a("pairing.pairCodeLabel")}),f.jsx(xt,{id:"add-host-code",type:"text",value:c,onChange:x=>h(x.target.value.toUpperCase()),placeholder:a("pairing.pairCodePlaceholder"),maxLength:12,autoComplete:"off",autoFocus:!0,className:"font-bold uppercase"}),f.jsx("p",{className:"text-tui-sm text-tui-faint",children:a("pairing.pairCodeHelp")})]}),f.jsxs(n0,{hint:a("pairing.advancedHint"),children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(un,{htmlFor:"add-host-ws",children:a("pairing.wsUrlLabel")}),f.jsx(xt,{id:"add-host-ws",type:"text",value:m,onChange:x=>p(x.target.value),placeholder:a("onboarding.wsEndpointPlaceholder")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(un,{htmlFor:"add-host-token",hint:a("pairing.tokenNote"),children:a("pairing.tokenLabel")}),f.jsx(xt,{id:"add-host-token",type:"password",value:g,onChange:x=>y(x.target.value),placeholder:a("onboarding.manualTokenPlaceholder")})]})]})]})})},Li=ne(Eo,"py-0"),pM="h-7 py-0",Rd="h-7 py-0 px-1.5",Co="text-tui-bad hover:border-tui-bad hover:text-tui-bad",gM=["grid items-center gap-x-2 gap-y-1 py-1","grid-cols-[4rem_minmax(0,1fr)_9rem] [grid-template-areas:'cap_label_actions'_'combo_combo_default']","sm:grid-cols-[4rem_minmax(0,1fr)_9rem_9rem_7rem] sm:[grid-template-areas:'cap_label_combo_default_actions']"].join(" ");function i0(l){return{offLabel:l("settings.toggleOff"),onLabel:l("settings.toggleOn")}}const bM=({profile:l,onProfileChange:n})=>{const{settings:a,updateSettings:s,t:o}=Ee(),{agentProfile:c}=et(),[h,m]=T.useState({}),p=T.useRef({}),[g,y]=T.useState(""),[v,x]=T.useState(""),w=l||c,S=a.agentKeymaps[w]||{},M=Eb(w,S),N=Nb(w,S),L=N.filter(A=>!A.hidden).length,E=A=>A.custom?A.customLabel||"":o(`agentActions.${A.labelKey}`),k=A=>{try{return hs(A.combo)}catch{return A.combo}},z=A=>{s({agentKeymaps:{...a.agentKeymaps,[w]:A}})},R=(A,G)=>{var W;z({...S,actions:{...S.actions,[A]:{...(W=S.actions)==null?void 0:W[A],...G}}})},D=A=>{R(A.id,{keys:A.defaultCombo})},j=(A,G)=>{const W=A+(G==="up"?-1:1);if(W<0||W>=M.length)return;const se=M.map(Q=>Q.id);[se[A],se[W]]=[se[W],se[A]],z({...S,order:se})},H=A=>{var G;z({...S,custom:(S.custom||[]).filter(W=>W.id!==A),order:(G=S.order)==null?void 0:G.filter(W=>W!==A)})},K=()=>z(aw(S)),q=()=>{const A={...a.agentKeymaps};delete A[w],s({agentKeymaps:A})},te=()=>{const A=g.trim();if(!A)return;try{gn(v)}catch{return}const G=`custom-${Date.now().toString(36)}`;z({...S,custom:[...S.custom||[],{id:G,label:A,keys:v.trim()}],order:[...M.map(W=>W.id),G]}),y(""),x("")},Z=A=>A instanceof pn?o(`agentKeymaps.errors.${A.code}`,A.params):String(A),ie=(A,G)=>`${A}:${G}`,oe=(A,G)=>{const W=ie(w,A);p.current={...p.current,[W]:G},m(p.current);try{gn(G),R(A,{keys:G})}catch{}},P=A=>{const G=ie(w,A),W=p.current[G];if(W!==void 0){delete p.current[G],m({...p.current});try{gn(W),R(A,{keys:W})}catch{}}};return f.jsxs("div",{className:"space-y-4",children:[f.jsx(bn,{title:o("agentKeymaps.settingsProfileLabel"),aside:f.jsx(Me,{variant:"ghost",onClick:q,className:ne(Co,Rd),children:o("agentKeymaps.restoreProfile")}),children:f.jsx(Kt,{label:o("agentKeymaps.profileRowLabel"),htmlFor:"agent-keymap-profile",hint:nl[w].configHint?o("agentKeymaps.configHint",{path:nl[w].configHint}):void 0,control:f.jsx(Ao,{id:"agent-keymap-profile","aria-label":o("agentKeymaps.settingsProfileLabel"),value:w,onChange:A=>n(A.target.value),className:Li,children:qx.map(A=>f.jsx("option",{value:A,children:nl[A].name},A))})})}),f.jsx(bn,{title:o("agentKeymaps.barGroup"),aside:f.jsx(Me,{variant:"ghost",onClick:K,className:ne(Co,Rd),children:o("agentKeymaps.restoreBar")}),children:f.jsxs("div",{className:"space-y-2 py-1.5",children:[f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:o("agentKeymaps.barHint",{profile:nl[w].name,count:L})}),f.jsx("div",{role:"group","aria-label":o("agentKeymaps.barGroup"),"data-testid":"agent-bar-choices",className:"flex flex-wrap gap-1",children:N.map(A=>{const G=E(A),W=k(A),se=!A.hidden;return f.jsxs("button",{type:"button","data-testid":`agent-bar-toggle-${A.id}`,"aria-pressed":se,onClick:()=>R(A.id,{hidden:se}),title:`${W} ${G}`.trim(),className:ne("tui-focusable inline-flex h-7 select-none items-center gap-1 border px-1.5 text-tui-sm transition-colors",se?"border-tui-accent bg-tui-accent text-tui-crust":"border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent"),children:[f.jsx("span",{"aria-hidden":"true",className:"font-bold",children:se?ke.check:"+"}),f.jsx("span",{className:"font-bold",children:W}),f.jsx("span",{className:se?void 0:"opacity-80",children:G})]},A.id)})})]})}),f.jsx(bn,{title:o("agentKeymaps.listGroup",{profile:nl[w].name}),children:M.map((A,G)=>{var ce,be;const W=E(A),se=o("agentKeymaps.defaultCombo",{combo:hs(A.defaultCombo)}),Q=((be=(ce=S.actions)==null?void 0:ce[A.id])==null?void 0:be.keys)??A.combo,ge=ie(w,A.id),ye=h[ge]??Q;let ue="",Te=null;try{gn(ye),ue=hs(ye)}catch(le){Te=Z(le)}return f.jsxs("div",{"data-testid":`agent-setting-row-${A.id}`,className:gM,children:[f.jsx(Cy,{className:"w-full overflow-hidden whitespace-nowrap font-bold [grid-area:cap]",children:ue||"—"}),f.jsxs("span",{className:"min-w-0 break-words text-tui text-tui-text [grid-area:label]",title:W,children:[W,!A.verified&&f.jsx("span",{className:"ml-1 text-tui-sm text-tui-faint",children:o("agentKeymaps.unverified")})]}),f.jsxs("label",{className:"sr-only",htmlFor:`agent-combo-${A.id}`,children:[o("agentKeymaps.shortcutLabel")," ",W]}),f.jsx(xt,{id:`agent-combo-${A.id}`,"aria-label":`${o("agentKeymaps.shortcutLabel")} ${W}`,value:ye,onChange:le=>oe(A.id,le.target.value),onBlur:()=>P(A.id),onKeyDown:le=>{le.key==="Enter"&&le.currentTarget.blur()},placeholder:o("agentKeymaps.comboPlaceholder"),"aria-invalid":!!Te,className:ne("w-full min-w-0 [grid-area:combo]",pM)}),f.jsx("span",{className:"min-w-0 break-words text-tui-sm text-tui-faint [grid-area:default]",title:se,children:se}),f.jsxs("div",{className:"flex items-center justify-end [grid-area:actions]",children:[f.jsx(ll,{onClick:()=>D(A),title:o("agentKeymaps.resetAction"),"aria-label":`${o("agentKeymaps.resetAction")} ${W}`,children:"↺"}),f.jsx(ll,{disabled:G===0,onClick:()=>j(G,"up"),title:o("agentKeymaps.moveUp"),"aria-label":`${o("agentKeymaps.moveUp")} ${W}`,children:"↑"}),f.jsx(ll,{disabled:G===M.length-1,onClick:()=>j(G,"down"),title:o("agentKeymaps.moveDown"),"aria-label":`${o("agentKeymaps.moveDown")} ${W}`,children:"↓"}),A.custom?f.jsx(ll,{variant:"danger",onClick:()=>H(A.id),title:o("agentKeymaps.removeCustom"),"aria-label":`${o("agentKeymaps.removeCustom")} ${W}`,children:ke.cross}):f.jsx("span",{"aria-hidden":"true",className:"h-7 w-7 shrink-0"})]}),Te&&f.jsx("p",{className:"col-span-full text-tui-sm text-tui-bad",role:"alert",children:o("agentKeymaps.invalidCombo",{error:Te})})]},A.id)})}),f.jsx(bn,{title:o("agentKeymaps.addCustom"),children:f.jsxs("div",{className:"space-y-1 py-1.5",children:[f.jsxs("div",{className:"flex flex-wrap items-end gap-2",children:[f.jsxs("label",{className:"min-w-[9rem] flex-1 space-y-1 text-tui-sm text-tui-muted",children:[f.jsx("span",{children:o("agentKeymaps.customLabel")}),f.jsx(xt,{value:g,onChange:A=>y(A.target.value),className:Li})]}),f.jsxs("label",{className:"min-w-[9rem] flex-1 space-y-1 text-tui-sm text-tui-muted",children:[f.jsx("span",{children:o("agentKeymaps.customCombo")}),f.jsx(xt,{value:v,onChange:A=>x(A.target.value),placeholder:o("agentKeymaps.comboPlaceholder"),className:Li})]}),f.jsx(Me,{variant:"primary",glyph:"+",onClick:te,disabled:!g.trim()||!v.trim(),className:Li,children:o("agentKeymaps.addAction")})]}),v.trim()&&(()=>{try{return gn(v),f.jsx("p",{className:"text-tui-sm text-tui-info",children:hs(v)})}catch(A){const G=Z(A);return f.jsx("p",{className:"text-tui-sm text-tui-bad",role:"alert",children:G})}})()]})})]})},l0={"gnome-terminal":"GNOME Terminal",ptyxis:"Ptyxis",tilix:"Tilix",konsole:"Konsole","xfce4-terminal":"Xfce Terminal",kitty:"kitty",alacritty:"Alacritty",ghostty:"Ghostty",wezterm:"WezTerm",foot:"foot",vscode:"VS Code",iterm2:"iTerm2","apple-terminal":"Terminal",xterm:"xterm",urxvt:"urxvt"},yM=["host_font_unavailable","host_font_timeout","disconnected","font_api_unavailable"],vM=()=>{const{hostFont:l,loadHostFont:n,declineHostFont:a,settings:s,activeProfile:o,t:c}=Ee(),{herdrLaunch:h,hostname:m}=et(),{addToast:p}=Xt(),{font:g,status:y,glyphs:v}=l,x=y==="loading"||v.status==="loading",w=y==="failed"||v.status==="failed",S=T.useRef(!1);T.useEffect(()=>{S.current&&!x&&!w&&l.interactive&&p("success",c("hostFont.loaded")),S.current=x&&l.interactive},[x,w,l.interactive,p,c]);const M=y==="available"||v.status==="available",N=l.interactive&&(x||w);if(!(g&&s.fontFamily==="host"&&!h&&(M||N)))return null;const E=y==="available"||l.interactive&&(y==="loading"||y==="failed"),k=v.source&&(v.status==="available"||l.interactive&&(v.status==="loading"||v.status==="failed")),z=m||(o==null?void 0:o.displayName)||c("herdrLaunch.thisHost"),R=[g.sizePx?`${Math.round(g.sizePx)}px`:null,g.source?l0[g.source]||g.source:null].filter(Boolean).join(c("hostFont.detailSeparator")),D=l.error&&yM.includes(l.error)?l.error:"other",j=l.totalBytes?l.receivedBytes/l.totalBytes:0;return f.jsx("div",{"data-testid":"host-font-prompt",className:"absolute inset-0 z-30 flex items-center justify-center bg-tui-crust/85 p-3",children:f.jsxs(Nt,{title:c("hostFont.title"),tone:y==="failed"?"bad":"accent",className:"w-full max-w-md",bodyClassName:"space-y-3","aria-label":c("hostFont.title"),children:[f.jsx("p",{className:"leading-snug text-tui-text",children:E||!v.source?c("hostFont.body",{host:z,family:g.family,detail:R?c("hostFont.detail",{detail:R}):""}):c("hostFont.bodyGlyphsOnly",{host:z,family:v.source.family})}),x?f.jsxs("div",{className:"space-y-1",role:"status",children:[f.jsx($S,{value:j,width:32,className:"max-w-full overflow-hidden"}),f.jsx("p",{className:"text-tui-sm text-tui-muted",children:c("hostFont.loading",{received:Zu(l.receivedBytes),total:Zu(l.totalBytes)})})]}):f.jsxs(f.Fragment,{children:[w?f.jsx(Ri,{tone:"bad",children:c("hostFont.failed",{reason:c(`hostFont.reasons.${D}`)})}):f.jsxs("div",{className:"space-y-1 text-tui-sm leading-snug text-tui-faint",children:[E&&g.faces.length?f.jsx("p",{children:c("hostFont.download",{count:g.faces.length,size:Zu(l.totalBytes)})}):null,k&&v.source?f.jsx("p",{children:c(v.source.scope==="all"?"hostFont.glyphsAll":"hostFont.glyphs",{family:v.source.family})}):null]}),f.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[f.jsx(Me,{onClick:a,children:c("hostFont.decline")}),f.jsx(Me,{variant:"primary",onClick:n,autoFocus:!0,children:c(w?"common.retry":"hostFont.load")})]})]})]})})},xM=({onOpenAdmin:l})=>{var R;const{settings:n,updateSettings:a,language:s,setLanguage:o,t:c,hostFont:h,syncHostFont:m,terminalFontFamily:p,terminalFontSize:g}=Ee(),{connectionState:y}=et(),v=hd.find(D=>D.id===n.fontFamily),x=(D,j)=>D==="host"||D==="system"?c(`fontPresets.${D}`):j,w=(()=>{const{font:D,status:j}=h,H=h.totalBytes?Math.round(h.receivedBytes/h.totalBytes*100):0,K=c(`settings.hostFontStatus.${j}`,{percent:H});return D?[D.family,D.sizePx?`${Math.round(D.sizePx)}px`:null,D.source?l0[D.source]||D.source:null,K].filter(Boolean).join(" · "):K})(),S=(R=h.font)!=null&&R.sizePx?sa(h.font.sizePx):null,M=h.glyphs.source&&h.glyphs.status!=="none"?c("settings.hostGlyphLine",{family:h.glyphs.source.family,status:c(`settings.hostGlyphStatus.${h.glyphs.status}`,{count:h.glyphs.covered.toLocaleString()})}):null,N=typeof window<"u"&&window.isSecureContext&&"Notification"in window,L=10,E=24,k=i0(c),z=S?c("settings.fontSizeFollowHost",{size:S}):c("settings.fontSizeFollowHostUnknown");return f.jsxs("div",{className:"space-y-4",children:[f.jsx(bn,{title:c("settings.sectionInterface"),children:f.jsx(Kt,{label:c("settings.languageLabel"),hint:c("settings.languageHint"),control:f.jsx(Cd,{name:"ui-language","aria-label":c("settings.languageLabel"),value:s,onChange:o,options:[{value:"zh",label:"简体中文"},{value:"en",label:"English"}]})})}),f.jsxs(bn,{title:c("settings.sectionFont"),children:[f.jsx(Kt,{label:c("settings.fontFamilyLabel"),htmlFor:"terminal-font-select",control:f.jsxs(Ao,{id:"terminal-font-select",value:n.fontFamily,onChange:D=>a({fontFamily:D.target.value}),"aria-label":c("settings.fontFamilyLabel"),className:Li,children:[!v&&f.jsx("option",{value:n.fontFamily,children:n.fontFamily}),hd.map(D=>f.jsx("option",{value:D.id,children:x(D.id,D.name)},D.id))]})}),n.fontFamily==="host"&&f.jsx(Kt,{label:c("settings.hostFontLabel"),hint:f.jsxs(f.Fragment,{children:[f.jsx("span",{"data-testid":"host-font-status",className:"block break-words text-tui-info",children:w}),M?f.jsx("span",{"data-testid":"host-glyph-status",className:"block break-words",children:M}):null]}),control:f.jsx(Me,{block:!0,onClick:m,disabled:y!=="connected"||h.status==="loading"||h.glyphs.status==="loading",className:Li,children:c("settings.hostFontSync")})}),f.jsx(Kt,{label:c("settings.fontSizeLabel",{size:g}),hint:c("settings.fontSizeHint"),htmlFor:"terminal-font-size",control:f.jsx("div",{className:ne("flex items-center",Eo),children:f.jsx("input",{id:"terminal-font-size",type:"range",min:L,max:E,step:1,value:g,onChange:D=>a({fontSize:Number(D.target.value),fontSizeFollowsHost:!1}),className:"h-1 w-full cursor-pointer appearance-none bg-tui-border accent-tui-accent"})})}),f.jsx(Kt,{label:z,control:f.jsx(ki,{label:z,...k,checked:n.fontSizeFollowsHost,onChange:D=>a(D?{fontSizeFollowsHost:!0}:{fontSizeFollowsHost:!1,fontSize:g})})}),f.jsx("div",{className:"py-1.5",children:f.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:p,fontSize:`${g}px`},children:[f.jsx("span",{className:"text-tui-ok",children:"$"}),' echo "Herdr 0O 1lI ',' [] () -> => !="']})})]}),f.jsxs(bn,{title:c("settings.sectionInput"),children:[f.jsx(Kt,{label:c("settings.predictiveEchoLabel"),hint:c("settings.predictiveEchoDesc"),control:f.jsx(Cd,{name:"predictive-echo","aria-label":c("settings.predictiveEchoLabel"),value:n.predictiveEcho,onChange:D=>a({predictiveEcho:D}),options:[{value:"auto",label:c("settings.predictiveEchoAuto")},{value:"always",label:c("settings.predictiveEchoAlways")},{value:"off",label:c("settings.predictiveEchoOff")}]})}),f.jsx(Kt,{label:c("settings.touchKeyToolbar"),hint:c("settings.touchKeyToolbarDesc"),control:f.jsx(ki,{label:c("settings.touchKeyToolbar"),...k,checked:n.toolbarVisible,onChange:D=>a({toolbarVisible:D})})}),f.jsx(Kt,{label:c("settings.touchHaptics"),hint:c("settings.touchHapticsDesc"),control:f.jsx(ki,{label:c("settings.touchHaptics"),...k,checked:n.vibrateOnKeyPress,onChange:D=>a({vibrateOnKeyPress:D})})})]}),f.jsxs(bn,{title:c("settings.agentAlertsLabel"),children:[f.jsx(Kt,{label:c("settings.agentAlertBadge"),hint:c("settings.agentAlertBadgeDesc"),control:f.jsx(ki,{label:c("settings.agentAlertBadge"),...k,checked:n.agentAlertBadge,onChange:D=>a({agentAlertBadge:D})})}),f.jsx(Kt,{label:c("settings.agentAlertVibrate"),hint:c("settings.agentAlertVibrateDesc"),control:f.jsx(ki,{label:c("settings.agentAlertVibrate"),...k,checked:n.agentAlertVibrate,onChange:D=>a({agentAlertVibrate:D})})}),f.jsx(Kt,{label:c("settings.agentAlertSound"),hint:c("settings.agentAlertSoundDesc"),control:f.jsx(ki,{label:c("settings.agentAlertSound"),...k,checked:n.agentAlertSound,onChange:D=>{a({agentAlertSound:D}),D&&(iy(),ly("done"))}})}),N&&f.jsx(Kt,{label:c("settings.agentAlertNotify"),hint:c("settings.agentAlertNotifyDesc"),control:f.jsx(ki,{label:c("settings.agentAlertNotify"),...k,checked:n.agentAlertNotify,onChange:D=>{if(D&&Notification.permission!=="granted"){Notification.requestPermission().then(j=>a({agentAlertNotify:j==="granted"}));return}a({agentAlertNotify:D})}})})]}),l&&f.jsx(bn,{title:c("settings.sectionAdmin"),children:f.jsx(Kt,{label:c("settings.adminEntry"),hint:c("settings.adminEntryHint"),control:f.jsx(Me,{block:!0,variant:"primary",glyph:ke.arrowRight,onClick:l,className:Li,children:c("settings.adminEntryOpen")})})})]})},wM=()=>{const{settings:l,updateSettings:n,t:a}=Ee(),{addToast:s}=Xt(),[o,c]=T.useState(!1),h=i0(a),m=l.virtualKeys&&l.virtualKeys.length>0?l.virtualKeys:Ss(),p=w=>{const S=m.map(M=>M.id===w?{...M,enabled:!M.enabled}:M);n({virtualKeys:S})},g=(w,S)=>{const M=S==="up"?w-1:w+1;if(M<0||M>=m.length)return;const N=[...m],L=N[w];N[w]=N[M],N[M]=L,n({virtualKeys:N})},y=w=>{if(m.some(M=>M.id===w.id)){const M=m.map(N=>N.id===w.id?{...N,enabled:!0}:N);n({virtualKeys:M})}else{const M=[...m,{...w,enabled:!0}];n({virtualKeys:M})}c(!1)},v=w=>{const S=m.filter(M=>M.id!==w);n({virtualKeys:S})},x=()=>{n({virtualKeys:Ss()}),s("info",a("toasts.keyLayoutReset"))};return f.jsxs("div",{className:"space-y-3",children:[f.jsx(bn,{title:a("virtualKeyboard.customizeTitle"),aside:f.jsx(Me,{variant:"ghost",onClick:x,className:ne(Co,Rd),children:a("virtualKeyboard.resetLayout")}),children:m.map((w,S)=>{const M=yd(w,a);return f.jsxs("div",{className:"flex items-center gap-2 py-1",children:[f.jsx(Cy,{className:ne("w-16 shrink-0 truncate",!w.enabled&&"opacity-50"),children:w.label}),f.jsx("span",{className:ne("min-w-0 flex-1 break-words text-tui",w.enabled?"text-tui-text":"text-tui-faint"),children:M}),f.jsx(ki,{label:`${a("virtualKeyboard.enableKey")} ${w.label}`,...h,checked:w.enabled,onChange:()=>p(w.id),className:"h-7 w-24 shrink-0"}),f.jsx(ll,{disabled:S===0,onClick:()=>g(S,"up"),title:a("virtualKeyboard.moveUp"),"aria-label":a("virtualKeyboard.moveUp"),children:"↑"}),f.jsx(ll,{disabled:S===m.length-1,onClick:()=>g(S,"down"),title:a("virtualKeyboard.moveDown"),"aria-label":a("virtualKeyboard.moveDown"),children:"↓"}),f.jsx(ll,{variant:"danger",onClick:()=>v(w.id),title:a("virtualKeyboard.deleteKeyTitle"),"aria-label":a("virtualKeyboard.deleteKeyTitle"),children:ke.cross})]},w.id)})}),f.jsx(Me,{block:!0,glyph:"+",onClick:()=>c(!o),className:ne("border-dashed",Li),children:a("virtualKeyboard.addKey")}),o&&f.jsx(bn,{title:a("virtualKeyboard.availableKeys"),children:f.jsx("div",{className:"flex flex-wrap gap-1 py-1.5",children:T1.map(w=>{const S=m.some(M=>M.id===w.id);return f.jsxs("button",{type:"button",onClick:()=>y(w),title:yd(w,a),className:ne("tui-focusable flex h-7 select-none items-center gap-1 border px-1.5 text-tui-sm transition-colors",S?"border-tui-border-dim text-tui-faint":"border-tui-border text-tui-text hover:border-tui-accent hover:text-tui-accent"),children:[f.jsx("span",{children:w.label}),f.jsx("span",{"aria-hidden":"true",className:S?"text-tui-ok":"text-tui-accent",children:S?ke.check:"+"})]},w.id)})})})]})},SM=({isOpen:l,onClose:n,initialTab:a,onOpenAdmin:s})=>{const{updateSettings:o,t:c,activeProfile:h}=Ee(),{addToast:m}=Xt(),[p,g]=T.useState("general"),[y,v]=T.useState(null);if(T.useEffect(()=>{!l||!a||(g(a),v(null))},[l,a]),!l)return null;const x=()=>{const w=Xb();o({fontSize:w.fontSize,fontSizeFollowsHost:w.fontSizeFollowsHost,fontFamily:w.fontFamily,toolbarVisible:w.toolbarVisible,vibrateOnKeyPress:w.vibrateOnKeyPress,predictiveEcho:w.predictiveEcho,agentAlertBadge:w.agentAlertBadge,agentAlertSound:w.agentAlertSound,agentAlertVibrate:w.agentAlertVibrate,agentAlertNotify:w.agentAlertNotify,virtualKeys:w.virtualKeys}),m("info",c("settings.resetDefaultsToast"))};return f.jsxs(fa,{isOpen:l,onClose:n,title:c("settings.title"),subtitle:h?c("settings.subtitleInstance",{name:h.displayName}):c("settings.subtitle"),closeLabel:c("common.closeDialog"),size:"lg",fixedHeight:!0,hints:[{keys:"esc",action:c("common.close")}],footer:f.jsxs(f.Fragment,{children:[f.jsx(Me,{variant:"ghost",onClick:x,className:Co,children:c("settings.resetDefaults")}),f.jsx(Me,{variant:"primary",onClick:n,children:c("common.done")})]}),children:[f.jsx(Fd,{tabs:[{id:"general",label:c("settings.tabGeneral"),index:1},{id:"virtualKeys",label:c("settings.tabVirtualKeys"),index:2},{id:"agentKeymaps",label:c("settings.tabAgentKeymaps"),index:3}],activeId:p,onSelect:w=>g(w),className:"mb-3 border-b border-tui-border-dim pb-1"}),p==="general"&&f.jsx(xM,{onOpenAdmin:s}),p==="virtualKeys"&&f.jsx(wM,{}),p==="agentKeymaps"&&f.jsx(bM,{profile:y,onProfileChange:v})]})},CM={success:"ok",warning:"warn",error:"bad",info:"accent"},TM={success:ke.check,warning:ke.warn,error:ke.cross,info:"›"},MM=()=>{const{t:l}=Ee(),{toasts:n,removeToast:a}=Xt();return n.length===0?null:f.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:n.map(s=>{const o=CM[s.type];return f.jsxs("div",{className:ne("pointer-events-auto flex items-start gap-2 border border-tui-border border-l-2 bg-tui-base px-2 py-1 text-tui",cn[o].edgeL),role:"alert",children:[f.jsx("span",{"aria-hidden":"true",className:ne("shrink-0 font-bold",cn[o].text),children:TM[s.type]}),f.jsx("div",{className:"min-w-0 flex-1 break-words leading-snug text-tui-text",children:s.message}),s.count>1&&f.jsxs("span",{className:"shrink-0 border border-tui-border-dim px-1 text-tui-sm text-tui-muted",children:["×",s.count]}),f.jsx("button",{type:"button",onClick:()=>a(s.id),className:"tui-focusable shrink-0 select-none px-0.5 text-tui-faint transition-colors hover:text-tui-bad","aria-label":l("common.dismissNotification"),children:f.jsx("span",{"aria-hidden":"true",children:ke.cross})})]},s.id)})})},a0=[{status:"blocked",level:"warn"},{status:"done",level:"ok"},{status:"working",level:"accent"}];function AM(l){return l?l.total>0||a0.some(({status:n})=>{var a;return(((a=l.counts)==null?void 0:a[n])??0)>0}):!1}const s0=({className:l,compact:n=!1})=>{const{t:a}=Ee(),{agentStatus:s}=et();if(!s)return null;const o=a0.map(({status:h,level:m})=>{var p;return{status:h,level:m,count:((p=s.counts)==null?void 0:p[h])??0}}).filter(h=>h.count>0),c=n?o.slice(0,1):o;return c.length===0?s.total===0?null:f.jsxs("span",{"data-testid":"agent-status-chip",className:ne("flex shrink-0 items-center gap-1 px-1 text-tui-muted",l),title:a("agents.title"),children:[f.jsx(dn,{level:"idle"}),f.jsx("span",{className:"text-tui-faint",children:a("agents.allIdle")})]}):f.jsx("span",{"data-testid":"agent-status-chip",className:ne("flex shrink-0 items-center gap-2 px-1",l),title:a("agents.title"),children:c.map(({status:h,level:m,count:p})=>f.jsxs("span",{className:"flex items-center gap-1 text-tui-muted",children:[f.jsx(dn,{level:m}),f.jsx("span",{className:"text-tui-text",children:p}),f.jsx("span",{className:"text-tui-faint",children:a(`agents.${h}`)})]},h))})},Xd=({onAddProfile:l,mobile:n=!1,statusBar:a=!1})=>{const{profiles:s,activeProfileId:o,activeProfile:c,switchProfile:h,renameProfile:m,removeProfile:p,t:g}=Ee(),{connectionState:y}=et(),[v,x]=T.useState(!1),[w,S]=T.useState(null),[M,N]=T.useState(""),L=T.useRef(null);T.useEffect(()=>{if(!v)return;const j=H=>{L.current&&!L.current.contains(H.target)&&x(!1)};return document.addEventListener("pointerdown",j),()=>document.removeEventListener("pointerdown",j)},[v]);const E=(j,H)=>{S(j),N(H)},k=j=>{const H=M.trim();H&&m(j,H),S(null)},z=j=>{typeof window<"u"&&!window.confirm(g("profiles.removeConfirm"))||(p(j),S(null))},R=(c==null?void 0:c.displayName)||g("profiles.addHost"),D=y==="connected"?"ok":y==="connecting"||y==="reconnecting"?"warn":y==="error"?"bad":"idle";return f.jsxs("div",{ref:L,className:ne("relative min-w-0",n&&"w-full",a&&"flex-1",!n&&!a&&"h-full"),children:[f.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":v,"aria-label":g("profiles.switcherLabel"),onClick:()=>x(j=>!j),className:ne("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",a?"min-h-11 w-full max-w-none px-2":n?"min-h-11 w-full px-2":"h-full max-w-[18rem] px-1"),children:[f.jsx(dn,{level:D}),f.jsx("span",{className:ne("truncate text-tui-text",a&&"min-w-0 flex-1"),children:R}),f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint",children:v?ke.chevronDown:ke.chevronRight})]}),v&&f.jsxs("div",{role:"menu","aria-label":g("profiles.switcherLabel"),className:ne("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",a?"w-80 max-w-[calc(100vw-1rem)]":n?"inset-x-0 bottom-auto top-full mt-1 mb-0 w-full":"w-80 max-w-[calc(100vw-1rem)]"),children:[f.jsx("div",{className:"border-b border-tui-border-dim px-2 py-1 text-tui-sm uppercase text-tui-faint",children:g("profiles.title")}),s.length===0?f.jsx("p",{className:"px-2 py-2 text-tui-sm text-tui-muted",children:g("profiles.empty")}):s.map(j=>{const H=j.id===o,K=j.id===w;return f.jsxs("div",{role:"none",className:"border-b border-tui-border-dim last:border-b-0",children:[f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsxs("button",{type:"button",role:"menuitem","aria-current":H?"true":void 0,onClick:()=>{h(j.id),x(!1)},className:ne("tui-focusable flex min-h-11 min-w-0 flex-1 items-center gap-2 px-2 text-left text-tui transition-colors hover:bg-tui-selection",H?"text-tui-accent":"text-tui-text"),children:[f.jsx("span",{"aria-hidden":"true",className:"w-3 shrink-0",children:H?ke.cursor:""}),f.jsxs("span",{className:"min-w-0 flex-1",children:[f.jsx("span",{className:"block truncate font-bold",children:j.displayName}),f.jsx("span",{className:"block truncate text-tui-sm text-tui-faint",title:j.hostname||j.hostId,children:j.hostname||j.hostId||j.wsUrl})]}),H&&f.jsx("span",{className:"shrink-0 text-tui-sm text-tui-ok",children:g("profiles.current")})]}),f.jsx("button",{type:"button",role:"menuitem","aria-label":g("profiles.rename"),title:g("profiles.rename"),onClick:()=>E(j.id,j.displayName),className:"tui-focusable min-h-11 min-w-11 px-2 text-tui-muted hover:text-tui-accent",children:ke.ellipsis})]}),K&&f.jsxs("div",{className:"grid grid-cols-2 gap-1 px-2 pb-2",children:[f.jsx("input",{autoFocus:!0,value:M,maxLength:64,onChange:q=>N(q.target.value),onKeyDown:q=>{q.key==="Enter"&&k(j.id),q.key==="Escape"&&S(null)},"aria-label":g("profiles.rename"),className:"tui-input col-span-2 h-11 min-w-0 px-2 py-1 text-tui"}),f.jsx(Me,{onClick:()=>k(j.id),variant:"primary",className:"h-11 w-full min-w-0 whitespace-nowrap",children:g("common.save")}),f.jsx(Me,{onClick:()=>z(j.id),variant:"danger",className:"h-11 w-full min-w-0 whitespace-nowrap",children:g("profiles.remove")})]})]},j.id)}),f.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{x(!1),l()},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:[f.jsx("span",{"aria-hidden":"true",children:"+"}),f.jsx("span",{children:g("profiles.addHost")})]})]})]})},r0=({compact:l=!1,className:n})=>{const{settings:a,updateSettings:s,t:o}=Ee(),{connectionState:c,sharedWindowCount:h,assignedClientId:m}=et(),p=a.observerMode,g=f.jsx(Cd,{name:"control-mode","aria-label":o("role.modeLabel"),value:p?"observe":"control",onChange:y=>s({observerMode:y==="observe"}),tone:p?"warn":"ok",size:l?"sm":"md",options:[{value:"control",label:o("role.sharedControl")},{value:"observe",label:o("common.viewer")}],className:n});return l?g:f.jsxs("div",{className:"flex w-full flex-col gap-1",children:[g,f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:o(p?"role.observerHint":"role.controlHint")}),c==="connected"&&h>1?f.jsx("p",{className:"text-tui-sm text-tui-muted",children:o("role.sharedWindows",{count:h})}):null,m?f.jsx(An,{label:o("role.thisWindow"),labelWidth:9,className:"text-tui-sm",children:f.jsx("span",{className:"truncate text-tui-muted",children:m})}):null]})},EM="dibin666/herdr-remote",o0=`https://github.com/${EM}/releases`,NM=`${o0}/latest/download/herdr-remote.tgz`;function kM(l){return`${o0}/download/herdr-remote-v${l}/herdr-remote-${l}.tgz`}function c0(){const{updateStatus:l,ignoredUpdate:n,hostVersion:a}=et();return a===null||!!(l!=null&&l.updateAvailable)&&n!==(l==null?void 0:l.latest)}const LM="Get-CimInstance Win32_Process | Where-Object { $_.CommandLine -like '*node_modules\\herdr-remote*' } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force }",u0=({compact:l=!1,className:n})=>{const{t:a}=Ee(),{updateStatus:s}=et(),o=c0(),[c,h]=T.useState(!1);if(!o)return null;const m=s!=null&&s.updateAvailable?s:null,p=m?m.restartPending?a("update.chipRestart",{version:m.latest}):l?a("update.chipCompact",{version:m.latest}):a("update.chip",{version:m.latest}):a("update.chipOutdated");return f.jsxs(f.Fragment,{children:[f.jsx("button",{type:"button","data-testid":"update-chip",onClick:()=>h(!0),title:a("update.title"),className:ne("tui-focusable shrink-0 whitespace-nowrap px-1 text-tui-warn hover:underline",n),children:p}),f.jsx(_M,{isOpen:c,onClose:()=>h(!1)})]})},al=({command:l})=>{const{t:n}=Ee(),{addToast:a}=Xt();return f.jsxs("div",{className:"flex items-center gap-2 border border-tui-border bg-tui-mantle px-2 py-1",children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 select-none text-tui-ok",children:"$"}),f.jsx("code",{className:"min-w-0 flex-1 break-all text-tui-text",children:l}),f.jsx(Me,{glyph:"⧉",className:"shrink-0",onClick:()=>{Pd(l).then(s=>{a(s==="failed"?"error":"success",n(s==="failed"?"clipboard.copyFailed":"toasts.commandCopied"))})},children:n("common.copy")})]})},_M=({isOpen:l,onClose:n})=>{const{t:a}=Ee(),{updateStatus:s,ignoreUpdate:o,hostname:c,hostId:h,platform:m}=et();if(!(s!=null&&s.updateAvailable))return f.jsx(RM,{isOpen:l,onClose:n,host:c||h,win:m==="win32"});const{current:p,installed:g,latest:y,restartPending:v,updateCommand:x}=s;return f.jsx(fa,{isOpen:l,onClose:n,title:a("update.title"),closeLabel:a("common.closeDialog"),size:"md",footer:f.jsxs(f.Fragment,{children:[f.jsx(Me,{variant:"ghost",onClick:()=>{o(y),n()},children:a("update.ignore")}),f.jsx(Me,{variant:"primary",onClick:n,children:a("common.done")})]}),children:f.jsxs("div",{className:"space-y-3","data-testid":"update-modal",children:[f.jsxs("div",{className:"space-y-0.5",children:[f.jsx(An,{label:a("common.host"),labelWidth:10,children:c||h||"—"}),f.jsx(An,{label:a("update.running"),labelWidth:10,children:p}),g!==p?f.jsx(An,{label:a("update.installed"),labelWidth:10,children:g}):null,f.jsx(An,{label:a("update.latest"),labelWidth:10,children:f.jsx("span",{className:"text-tui-ok",children:y})})]}),v?f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"leading-snug text-tui-text",children:a("update.restartPending",{version:g})}),f.jsx(al,{command:"herdr-remote restart"})]}):f.jsxs(f.Fragment,{children:[f.jsxs("p",{className:"leading-snug text-tui-text",children:[f.jsx("span",{"aria-hidden":"true",className:"mr-1 text-tui-accent",children:ke.arrowRight}),a("update.stepTui")]}),f.jsx("p",{className:"leading-snug text-tui-muted",children:a("update.stepCli")}),x?f.jsx(al,{command:"herdr-remote update"}):f.jsxs(f.Fragment,{children:[f.jsx(al,{command:`npm install -g ${kM(y)}`}),f.jsx(al,{command:"herdr-remote restart"})]}),f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:a("update.restartNote")})]})]})})},RM=({isOpen:l,onClose:n,host:a,win:s})=>{const{t:o}=Ee();return f.jsx(fa,{isOpen:l,onClose:n,title:o("update.title"),closeLabel:o("common.closeDialog"),size:"md",footer:f.jsx(Me,{variant:"primary",onClick:n,children:o("common.done")}),children:f.jsxs("div",{className:"space-y-3","data-testid":"update-modal",children:[f.jsxs("div",{className:"space-y-0.5",children:[f.jsx(An,{label:o("common.host"),labelWidth:10,children:a||"—"}),f.jsx(An,{label:o("update.running"),labelWidth:10,children:f.jsx("span",{className:"text-tui-warn",children:o("update.outdatedVersion")})})]}),f.jsx("p",{className:"leading-snug text-tui-text",children:o("update.outdated")}),s?f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"leading-snug text-tui-muted",children:o("update.windowsStop")}),f.jsx(al,{command:LM})]}):null,f.jsx(al,{command:`npm install -g ${NM}`}),f.jsx(al,{command:"herdr-remote restart"}),f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:o("update.restartNote")})]})})},jM=({onAddProfile:l=()=>{}})=>{const{settings:n,t:a}=Ee(),{connectionState:s,hostId:o,assignedClientId:c,sharedWindowCount:h,rttMs:m,agentStatus:p}=et(),g=No(s,a),y=s==="connected",v=c0();return f.jsx(Ty,{left:f.jsxs(f.Fragment,{children:[f.jsx(Xd,{onAddProfile:l}),f.jsx(Td,{items:[f.jsxs("span",{className:"flex items-center gap-1",children:[f.jsx(dn,{level:g.level}),f.jsx("span",{className:"text-tui-text",children:g.label})]},"status"),y?f.jsx(r0,{compact:!0,className:"h-full w-auto"},"role"):null,y&&h>1?f.jsx("span",{className:"text-tui-muted",children:a("role.sharedWindows",{count:h})},"windows"):null,o?f.jsxs("span",{children:[f.jsxs("span",{className:"text-tui-faint",children:[a("common.host"),":"]})," ",f.jsx("span",{className:"text-tui-text",children:o})]},"host"):null,f.jsxs("span",{children:[f.jsx("span",{className:"text-tui-faint",children:a("header.clientIdLabel")})," ",f.jsx("span",{className:"text-tui-text",children:c||n.clientId})]},"client")]})]}),right:f.jsx(Td,{items:[v?f.jsx(u0,{},"update"):null,y&&AM(p)?f.jsx(s0,{},"agents"):null,m!==null?f.jsxs("span",{className:"text-tui-muted",children:[a("header.latencyTitle"),": ",f.jsxs("span",{className:"text-tui-text",children:[m,"ms"]})]},"rtt"):null,f.jsx("span",{className:"hidden text-tui-faint sm:inline",children:a("header.tagline")},"mode")]})})},OM=({wsUrl:l,adminUrl:n,onOpenRemoteAdmin:a,onSignIn:s})=>{const{t:o}=Ee();return f.jsxs(Nt,{title:o("admin.remoteRelayTitle"),bodyClassName:"space-y-2",children:[f.jsx("p",{className:"text-tui leading-snug text-tui-muted",children:o("admin.remoteRelayNotice")}),f.jsxs("div",{className:"space-y-0.5 border border-tui-border-dim bg-tui-mantle px-2 py-1.5",children:[f.jsx(An,{label:o("admin.remoteRelayEndpoint"),labelWidth:18,children:f.jsx("code",{className:"break-all text-tui-accent",children:l})}),f.jsx(An,{label:o("admin.remoteRelayAdminUrl"),labelWidth:18,children:f.jsx("code",{className:"break-all text-tui-ok",children:n})})]}),f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx(Me,{variant:"primary",onClick:a,glyph:ke.arrowRight,children:o("admin.openRemoteAdminBtn")}),f.jsx(Me,{onClick:s,children:o("admin.relayAdminLoginBtn")})]})]})},DM=({adminConfigured:l,isAuthError:n,tokenInput:a,onTokenInput:s,onSubmit:o,isSameOriginRelay:c,onBackToTerminal:h,showBack:m,onCancel:p})=>{const{t:g}=Ee();return f.jsxs(Nt,{title:g("admin.relayAdminTitle"),bodyClassName:"space-y-2",children:[l===!1?f.jsx(Ri,{tone:"warn",children:g("admin.relayAdminNotConfigured")}):n?f.jsx(Ri,{tone:"bad",children:g("admin.relayAdminAuthError")}):f.jsx(Ri,{tone:"accent",children:g("admin.relayAdminPrompt")}),f.jsxs("form",{onSubmit:o,className:"space-y-2",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(un,{htmlFor:"relay-admin-token",children:g("admin.relayAdminTokenLabel")}),f.jsx(xt,{id:"relay-admin-token",type:"password",autoComplete:"current-password",value:a,onChange:y=>s(y.target.value),placeholder:g("admin.relayAdminTokenPlaceholder")})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(Me,{variant:"primary",type:"submit",disabled:!a.trim(),children:g("admin.relayAdminLoginBtn")}),c?h&&!m?f.jsx(Me,{variant:"ghost",onClick:h,children:g("admin.returnToTerminal")}):null:f.jsx(Me,{variant:"ghost",onClick:p,children:g("common.cancel")})]})]})]})},zM=({onOpenPairing:l,onRetry:n})=>{const{t:a}=Ee(),{copied:s,copy:o}=qd(),c=s!==null,h=()=>o(il,a("toasts.commandCopied"));return f.jsxs(Nt,{title:a("admin.unauthorizedTitle"),tone:"bad",bodyClassName:"space-y-2",children:[f.jsx(Ri,{tone:"bad",children:a("admin.unauthorizedDesc")}),f.jsxs("div",{className:"space-y-1.5 border border-tui-border-dim bg-tui-mantle px-2 py-1.5",children:[f.jsx("span",{className:"block text-tui-sm uppercase text-tui-muted",children:a("admin.pairingStepsTitle")}),f.jsxs("div",{className:"flex items-center gap-2 border border-tui-border bg-tui-crust px-2 py-1",children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 select-none text-tui-ok",children:"$"}),f.jsx("code",{className:"min-w-0 flex-1 truncate text-tui-text",children:il}),f.jsx(Me,{onClick:h,glyph:c?ke.check:"⧉",className:ne("shrink-0",c&&"border-tui-ok text-tui-ok"),children:a(c?"admin.copiedJson":"common.copy")})]}),f.jsx("p",{className:"text-tui-sm text-tui-faint",children:a("admin.pairingStepsHelp")})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[l&&f.jsx(Me,{variant:"primary",onClick:l,children:a("admin.enterPairCodeBtn")}),f.jsx(Me,{onClick:n,children:a("admin.retryFetchBtn")})]})]})},HM=[[/\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"]],BM=[[/\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 fb(l,n){for(const[a,s]of l)if(a.test(n))return s;return null}function Zd(l){const n=typeof l=="string"?l.trim():"";if(!n)return{label:"",raw:""};const a=fb(HM,n),s=fb(BM,n);return a&&s?{label:`${a} · ${s}`,raw:n}:a?{label:a,raw:n}:s?{label:s,raw:n}:{label:n.length>32?`${n.slice(0,32)}…`:n,raw:n}}function na(l){if(!l||l<=0)return"0 B";const n=1024,a=["B","KB","MB","GB","TB"],s=Math.min(a.length-1,Math.floor(Math.log(l)/Math.log(n)));return`${(l/n**s).toFixed(1)} ${a[s]}`}function hb(l,n,a=!1){const s=Math.max(0,Math.floor(l)),o=Math.floor(s/86400),c=Math.floor(s%86400/3600),h=Math.floor(s%3600/60),m=s%60,p=(y,v)=>`${y}${n(`admin.unit${v}`)}`,g=o>0?[p(o,"Day"),p(c,"Hour"),p(h,"Minute")]:c>0?[p(c,"Hour"),p(h,"Minute"),p(m,"Second")]:[p(h,"Minute"),p(m,"Second")];return(a?g.slice(0,2):g).join(" ")}function Wd(l,n,a=Date.now()){if(!l)return"—";const s=new Date(l).getTime();if(Number.isNaN(s))return"—";const o=Math.max(0,Math.floor((a-s)/1e3));return o<60?n("admin.relJustNow"):o<3600?n("admin.relMinutes",{count:Math.floor(o/60)}):o<86400?n("admin.relHours",{count:Math.floor(o/3600)}):n("admin.relDays",{count:Math.floor(o/86400)})}function Qd(l){if(!l)return"";const n=new Date(l);return Number.isNaN(n.getTime())?"":n.toLocaleString()}function d0(l=[]){const n=new Map;for(const a of l)a.deviceId&&n.set(a.deviceId,(n.get(a.deviceId)||0)+1);return n}const UM=({clients:l})=>{const{t:n}=Ee(),a=l.some(o=>o.hostId),s=[{key:"id",header:n("admin.colClientId"),render:o=>f.jsxs("span",{className:"flex items-center gap-1.5",children:[f.jsx(dn,{level:"ok"}),f.jsx("span",{className:"font-bold text-tui-text",children:o.id})]})},...a?[{key:"host",header:n("admin.colHost"),render:o=>f.jsx("span",{className:"text-tui-text",children:o.hostId||"—"})}]:[],{key:"role",header:n("admin.colRole"),width:10,render:o=>{const c=o.role==="controller";return f.jsx(wy,{tone:c?"ok":"warn",className:"text-tui-sm",children:n(c?"common.controller":"common.viewer")})}},{key:"device",header:n("admin.colDevice"),render:o=>{const c=Zd(o.userAgent);return f.jsxs("span",{className:"flex min-w-0 items-baseline gap-1.5",children:[f.jsx("span",{className:c.label?"text-tui-text":"text-tui-faint",title:c.raw,children:c.label||n("admin.unknownDevice")}),o.deviceId?f.jsx("code",{className:"text-tui-sm text-tui-faint",children:o.deviceId}):null]})}},{key:"ip",header:n("admin.colIp"),render:o=>f.jsx("span",{className:"text-tui-muted",children:o.ip||"127.0.0.1"})},{key:"connectedAt",header:n("admin.colConnectedAt"),render:o=>f.jsx("span",{className:"whitespace-nowrap text-tui-muted",title:Qd(o.connectedAt),children:o.connectedAt?Wd(o.connectedAt,n):n("admin.startedRecently")})},{key:"traffic",header:n("admin.colTraffic"),align:"right",render:o=>f.jsxs("span",{className:"whitespace-nowrap",children:[f.jsxs("span",{className:"text-tui-accent",children:["↓",na(o.bytesReceived||0)]}),f.jsx("span",{"aria-hidden":"true",className:"mx-1 text-tui-faint",children:"/"}),f.jsxs("span",{className:"text-tui-ok",children:["↑",na(o.bytesSent||0)]})]})}];return f.jsx(Nt,{title:n("admin.connectedClientsTitle",{count:l.length}),bodyClassName:"-mx-1",children:f.jsx(Gd,{columns:s,items:l,rowKey:o=>o.id,empty:n("admin.noClients")})})},KM=({devices:l,clients:n,onRevoke:a})=>{const{t:s}=Ee(),[o,c]=T.useState(null),[h,m]=T.useState(null),p=d0(n),g=[...l].sort((x,w)=>{const S=+!!p.get(w.deviceId)-+!!p.get(x.deviceId);return S||(Date.parse(w.lastSeenAt)||0)-(Date.parse(x.lastSeenAt)||0)}),y=async x=>{if(o!==x){c(x);return}m(x);try{await a(x)}finally{m(null),c(null)}},v=[{key:"status",header:s("admin.colStatus"),width:12,render:x=>{const w=p.get(x.deviceId)||0;return f.jsxs("span",{className:ne("flex items-center gap-1.5 whitespace-nowrap",w?"text-tui-ok":"text-tui-faint"),children:[f.jsx(dn,{level:w?"ok":"idle"}),s(w?"admin.hostStatusOnline":"admin.hostStatusOffline")]})}},{key:"device",header:s("admin.colDevice"),render:x=>{const w=Zd(x.userAgent);return f.jsxs("span",{className:"flex min-w-0 items-baseline gap-1.5",children:[f.jsx("span",{className:"text-tui-text",title:w.raw,children:w.label||s("admin.unknownDevice")}),f.jsx("code",{className:"text-tui-sm text-tui-faint",children:x.deviceId})]})}},{key:"host",header:s("admin.colHost"),render:x=>f.jsx("span",{className:"text-tui-text",children:x.hostId||"—"})},{key:"ip",header:s("admin.colIp"),render:x=>f.jsx("span",{className:"text-tui-muted",children:x.lastIp||"—"})},{key:"lastSeen",header:s("admin.colLastSeen"),render:x=>{const w=p.get(x.deviceId)||0;return f.jsx("span",{className:ne("whitespace-nowrap",w?"text-tui-ok":"text-tui-muted"),title:Qd(x.lastSeenAt),children:w?s("admin.deviceWindows",{count:w}):Wd(x.lastSeenAt,s)})}},{key:"actions",header:s("admin.colActions"),align:"right",render:x=>{const w=o===x.deviceId,S=h===x.deviceId;return f.jsx(Me,{variant:"danger",disabled:S,onClick:()=>void y(x.deviceId),onBlur:()=>c(M=>M===x.deviceId?null:M),"aria-label":s("admin.revokeDevice"),className:ne("h-6 py-0 text-tui-sm",w&&"bg-tui-bad text-tui-crust"),children:S?f.jsx(sl,{}):s(w?"admin.revokeConfirm":"admin.revokeDevice")})}}];return f.jsx(Nt,{title:s("admin.pairedDevicesTitle",{count:l.length}),bodyClassName:"-mx-1",children:f.jsx(Gd,{columns:v,items:g,rowKey:x=>x.deviceId,empty:s("admin.noDevices")})})},mb={online:"ok",busy:"ok",reconnecting:"warn",offline:"idle"};function IM(l=[],n=[]){const a=new Map;for(const c of n){if(!(c!=null&&c.hostId))continue;const h=a.get(c.hostId);h?h.push(c):a.set(c.hostId,[c])}const s=l.map(c=>{const h=a.get(c.id)||[];return{id:c.id,hostname:c.hostname||c.id,status:c.status||"online",connectedDeviceCount:c.connectedDeviceCount??0,pairedDeviceCount:c.pairedDeviceCount??h.length,activePtyCount:c.activePtyCount??0,version:c.version,latestVersion:c.latestVersion,devices:h,fromRosterOnly:!1}}),o=new Set(s.map(c=>c.id));for(const[c,h]of a)o.has(c)||s.push({id:c,hostname:c,status:"offline",connectedDeviceCount:0,pairedDeviceCount:h.length,activePtyCount:0,devices:h,fromRosterOnly:!0});return s.sort((c,h)=>c.fromRosterOnly!==h.fromRosterOnly?c.fromRosterOnly?1:-1:c.hostname.localeCompare(h.hostname))}const FM=({hosts:l,devices:n,clients:a})=>{const{t:s}=Ee(),o=IM(l,n),c=d0(a),h={online:s("admin.hostStatusOnline"),busy:s("admin.hostStatusBusy"),reconnecting:s("admin.hostStatusReconnecting"),offline:s("admin.hostStatusOffline")};return f.jsx(Nt,{title:s("admin.hostsTitle",{count:o.length}),bodyClassName:"space-y-2",children:o.length===0?f.jsx("p",{className:"px-1 py-2 text-tui text-tui-faint",children:s("admin.noHosts")}):o.map(m=>f.jsxs("div",{className:"border border-tui-border-dim bg-tui-mantle",children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 border-b border-tui-border-dim px-2 py-1",children:[f.jsxs("span",{className:"flex min-w-0 flex-auto items-center gap-1.5 text-tui",children:[f.jsx(dn,{level:mb[m.status]}),f.jsx("span",{className:"truncate font-bold text-tui-text",children:m.hostname}),m.hostname!==m.id?f.jsx("code",{className:"truncate text-tui-sm text-tui-faint",children:m.id}):null,f.jsx(wy,{tone:mb[m.status],className:"ml-1 text-tui-sm",children:h[m.status]})]}),f.jsx(Td,{className:"shrink-0 text-tui-sm",items:[f.jsx("span",{className:m.connectedDeviceCount?"text-tui-ok":"text-tui-faint",children:s("admin.hostConnectedDevices",{count:m.connectedDeviceCount})},"connected"),f.jsx("span",{className:"text-tui-muted",children:s("admin.hostPairedDevices",{count:m.pairedDeviceCount})},"paired"),m.version===void 0?null:f.jsx("span",{className:m.version&&!m.latestVersion?"text-tui-muted":"text-tui-warn",children:m.version?m.latestVersion?s("admin.hostVersionBehind",{version:m.version,latest:m.latestVersion}):s("admin.hostVersion",{version:m.version}):s("admin.hostVersionUnknown")},"version"),m.fromRosterOnly?null:f.jsx("span",{className:m.activePtyCount?"text-tui-info":"text-tui-faint",children:s("admin.hostPtys",{count:m.activePtyCount})},"ptys")]})]}),m.devices.length>0?f.jsx("ul",{className:"divide-y divide-tui-border-dim",children:m.devices.map(p=>{const g=Zd(p.userAgent),y=c.get(p.deviceId)||0;return f.jsxs("li",{className:"grid grid-cols-[1ch_minmax(0,1fr)_auto] items-baseline gap-x-2 px-2 py-0.5 text-tui sm:grid-cols-[1ch_minmax(0,18ch)_minmax(0,1fr)_16ch_16ch]",children:[f.jsx(dn,{level:y?"ok":"idle"}),f.jsx("span",{className:"truncate text-tui-text",title:g.raw,children:g.label||s("admin.unknownDevice")}),f.jsx("code",{className:"hidden truncate text-tui-sm text-tui-faint sm:block",children:p.deviceId}),f.jsx("span",{className:"hidden truncate text-tui-sm text-tui-muted sm:block",children:p.lastIp||"—"}),f.jsx("span",{className:ne("whitespace-nowrap text-right text-tui-sm",y?"text-tui-ok":"text-tui-faint"),title:Qd(p.lastSeenAt),children:y?s("admin.deviceWindows",{count:y}):Wd(p.lastSeenAt,s)})]},p.deviceId)})}):f.jsx("p",{className:"px-2 py-1 text-tui-sm text-tui-faint",children:m.pairedDeviceCount>0?s("admin.hostRosterOperatorOnly"):s("admin.noDevices")})]},m.id))})},GM=({data:l})=>{var o,c,h,m,p,g,y,v,x,w;const{t:n}=Ee(),a=l.activeUserCount??((o=l.clients)==null?void 0:o.length)??0,s=new Set((l.devices||[]).map(S=>S.hostId).filter(S=>S&&!(l.hosts||[]).some(M=>M.id===S))).size;return f.jsxs("div",{className:"space-y-3",children:[f.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3 xl:grid-cols-6",children:[f.jsx(Xl,{label:n("admin.connectedHosts"),value:((c=l.hosts)==null?void 0:c.length)||0,sub:s?n("admin.hostsOfflineSub",{count:s}):void 0,tone:(h=l.hosts)!=null&&h.length?"ok":"idle"}),f.jsx(Xl,{label:n("admin.activeUsers"),value:a,sub:n("admin.acrossWindows",{count:((m=l.clients)==null?void 0:m.length)||0}),tone:a?"accent":"idle"}),f.jsx(Xl,{label:n("admin.activePtys"),value:((p=l.ptys)==null?void 0:p.length)||0,sub:n("admin.terminalShells"),tone:(g=l.ptys)!=null&&g.length?"info":"idle"}),f.jsx(Xl,{label:n("admin.statInbound"),value:n("admin.perSecond",{value:na(((y=l.throughput)==null?void 0:y.bytesInPerSec)||0)}),sub:n("admin.statTotal",{value:na(((v=l.throughput)==null?void 0:v.bytesIn)||0)}),tone:"accent"}),f.jsx(Xl,{label:n("admin.statOutbound"),value:n("admin.perSecond",{value:na(((x=l.throughput)==null?void 0:x.bytesOutPerSec)||0)}),sub:n("admin.statTotal",{value:na(((w=l.throughput)==null?void 0:w.bytesOut)||0)}),tone:"ok"}),f.jsx(Xl,{label:n("admin.uptime"),value:hb(l.uptimeSeconds||0,n,!0),title:hb(l.uptimeSeconds||0,n),sub:l.startTime?n("admin.startedAt",{time:new Date(l.startTime).toLocaleTimeString()}):n("admin.startedRecently")})]}),f.jsx(FM,{hosts:l.hosts||[],devices:l.devices,clients:l.clients||[]})]})},YM=({ptys:l})=>{const{t:n}=Ee(),a=l.some(o=>o.hostId),s=[{key:"id",header:n("admin.colPtyId"),render:o=>f.jsx("span",{className:"font-bold text-tui-accent",children:o.id})},...a?[{key:"host",header:n("admin.colHost"),render:o=>f.jsx("span",{className:"text-tui-text",children:o.hostId})}]:[],{key:"pid",header:n("admin.colPid"),width:9,render:o=>f.jsx("span",{className:"text-tui-muted",children:o.pid})},{key:"command",header:n("admin.colCommand"),render:o=>f.jsx("code",{className:"border border-tui-border-dim bg-tui-mantle px-1 text-tui-text",children:o.command})},{key:"grid",header:n("admin.colGrid"),width:11,render:o=>f.jsxs("span",{className:"whitespace-nowrap text-tui-muted",children:[o.cols,f.jsx("span",{"aria-hidden":"true",className:"mx-0.5 text-tui-faint",children:"×"}),o.rows]})},{key:"cwd",header:n("admin.colCwd"),className:"max-w-xs truncate",render:o=>f.jsx("span",{className:"text-tui-muted",children:o.cwd||"~"})},{key:"viewers",header:n("admin.colViewers"),align:"right",width:9,render:o=>f.jsx("span",{className:"font-bold text-tui-ok",children:o.activeClients})}];return f.jsx(Nt,{title:n("admin.activePtysTitle",{count:l.length}),bodyClassName:"-mx-1",children:f.jsx(Gd,{columns:s,items:l,rowKey:o=>o.id,empty:n("admin.noPtys")})})};function jd(l){if(typeof window>"u"||!l||l.startsWith("/"))return"";try{const n=new URL(l.replace(/^ws/,"http")),a=n.pathname.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"");return n.origin===window.location.origin&&!a?"":`${n.origin}${a}`}catch{return""}}function As(l,n){const a=jd(l);return a?`${a}${n.startsWith("/")?n:`/${n}`}`:n}async function PM(l){try{const a=await fetch(As(l,"/api/info"),{headers:{Accept:"application/json"}});if(a.ok)return await a.json()}catch{}return{ok:!0,version:"0.1.0",protocol:1,relayMode:!!(l&&!l.startsWith("/")&&!l.includes("localhost")&&!l.includes("127.0.0.1")&&typeof window<"u"&&!l.startsWith(window.location.origin.replace("http","ws")))?"remote":"local",adminConfigured:!1,adminPath:"/admin",adminStatusPath:"/api/admin/status"}}async function pb(l,n){const a=await fetch(l,{headers:{Accept:"application/json",...n}});if(a.status===401||a.status===403)return{kind:"denied",status:a.status};if(!a.ok)throw new Error(`HTTP ${a.status}: ${a.statusText}`);return{kind:"ok",data:await a.json()}}async function $M(l,n,a){return(await fetch(As(l,`/api/admin/devices/${encodeURIComponent(a)}`),{method:"DELETE",headers:{Accept:"application/json","X-Relay-Admin-Token":n}})).ok}function VM(l,n,a){return l!=null&&l.adminPath?l.publicUrl?`${l.publicUrl.replace(/\/$/,"")}${l.adminPath}`:As(a,l.adminPath):n!=null&&n.remoteAdminUrl?n.remoteAdminUrl:a?As(a,"/admin"):"/admin"}function qM({wsUrl:l,deviceToken:n,adminToken:a,relayOrigin:s,refreshInterval:o,t:c}){const[h,m]=T.useState(null),[p,g]=T.useState(null),[y,v]=T.useState(!1),[x,w]=T.useState(!0),[S,M]=T.useState(null),[N,L]=T.useState(!1),[E,k]=T.useState(null);T.useEffect(()=>{m(null),g(null),v(!1)},[s]),T.useEffect(()=>{let K=!0;return w(!0),PM(l).then(q=>{K&&(g(q),v(!0))}),()=>{K=!1}},[l,s]);const z=(p==null?void 0:p.relayMode)==="remote",R=T.useCallback((K,q)=>{if(K.kind==="denied"){L(!0),M(q),m(null);return}m(K.data),M(null),L(!1),k(new Date)},[]),D=T.useCallback((K,q)=>{L(!1),M(K instanceof Error?K.message:q),m(null)},[]),j=T.useCallback(async()=>{if(y){if(z){if(!a){m(null),w(!1),M(null),L(!1);return}try{w(!0);const K=await pb(As(l,(p==null?void 0:p.adminStatusPath)||"/api/admin/status"),{"X-Relay-Admin-Token":a});R(K,c("admin.relayAdminAuthError"))}catch(K){console.warn("GET /api/admin/status request failed:",K),D(K,"Failed to fetch remote admin status")}finally{w(!1)}return}try{w(!0);const K=await pb("/api/status",n?{Authorization:`Bearer ${n}`}:{});R(K,K.kind==="denied"?`Authentication failed (HTTP ${K.status}): Access denied. Please configure an authorized token or pair with the host.`:"")}catch(K){console.warn("GET /api/status request failed:",K),D(K,"Failed to fetch status")}finally{w(!1)}}},[y,z,a,p,n,l,s,c]),H=T.useCallback(async K=>{try{if(!await $M(l,a,K)){M(c("admin.revokeFailed"));return}await j()}catch{M(c("admin.revokeFailed"))}},[a,j,l,c]);return T.useEffect(()=>{if(!y)return;j();let K=null;const q=()=>{o>0&&!K&&(K=setInterval(()=>{document.visibilityState==="visible"&&j()},o))},te=()=>{K&&(clearInterval(K),K=null)},Z=()=>{document.visibilityState==="visible"?(j(),q()):te()};return q(),document.addEventListener("visibilitychange",Z),()=>{te(),document.removeEventListener("visibilitychange",Z)}},[y,j,o]),{data:h,relayInfo:p,infoLoaded:y,isRemoteRelay:z,loading:x,error:S,isAuthError:N,lastUpdated:E,fetchStatus:j,revokeDevice:H}}const dd="h-7 py-0",XM=({onBackToTerminal:l,onOpenPairing:n,showBack:a=!1})=>{var ye,ue,Te;const{settings:s,updateSettings:o,t:c}=Ee(),h=jd(s.wsUrl)||(typeof window<"u"?window.location.origin:"local"),m=((ye=s.adminTokens)==null?void 0:ye[h])||(h===(typeof window<"u"?window.location.origin:"local")?s.adminToken:"")||"",[p,g]=T.useState(3e3),[y,v]=T.useState("overview"),[x,w]=T.useState(m),[S,M]=T.useState(m),[N,L]=T.useState(!!m),E=!jd(s.wsUrl);T.useEffect(()=>{w(m),M(m),L(!!m)},[h]);const{data:k,relayInfo:z,infoLoaded:R,isRemoteRelay:D,loading:j,error:H,isAuthError:K,lastUpdated:q,fetchStatus:te,revokeDevice:Z}=qM({wsUrl:s.wsUrl,deviceToken:s.token,adminToken:S,relayOrigin:h,refreshInterval:p,t:c}),ie=ce=>{ce.preventDefault();const be=x.trim();o({adminToken:be,adminTokens:{...s.adminTokens||{},[h]:be}}),M(be),L(!!be)},oe=VM(z,k,s.wsUrl),P=k?[{id:"overview",label:c("admin.tabOverview"),index:1},{id:"clients",label:c("admin.tabClients",{count:((ue=k.clients)==null?void 0:ue.length)||0}),index:2},{id:"ptys",label:c("admin.tabPtys",{count:((Te=k.ptys)==null?void 0:Te.length)||0}),index:3},...k.devices?[{id:"devices",label:c("admin.tabDevices",{count:k.devices.length}),index:4}]:[]]:[],A=P.map(ce=>ce.id).join("|");T.useEffect(()=>{const ce=A?A.split("|"):[],be=le=>{if(le.ctrlKey||le.altKey||le.metaKey)return;const we=le.target;if(we instanceof HTMLInputElement||we instanceof HTMLTextAreaElement||we instanceof HTMLSelectElement||we!=null&&we.isContentEditable||document.querySelector('[role="dialog"]'))return;if(le.key==="Escape"&&l){le.preventDefault(),l();return}if(le.key.toLowerCase()==="r"){le.preventDefault(),te();return}const ae=Number.parseInt(le.key,10)-1;Number.isInteger(ae)&&ae>=0&&ae<ce.length&&(le.preventDefault(),v(ce[ae]))};return window.addEventListener("keydown",be),()=>window.removeEventListener("keydown",be)},[te,l,A]);const G=(z==null?void 0:z.version)||(k==null?void 0:k.version)||"0.1.0",W=a&&l?f.jsx(Me,{variant:"ghost",onClick:l,title:c("admin.returnToTerminal"),"aria-label":c("admin.returnToTerminal"),glyph:ke.arrowLeft,brackets:!1,className:dd,children:f.jsx("span",{className:"sr-only",children:c("admin.returnToTerminal")})}):null,se=f.jsxs(f.Fragment,{children:[f.jsxs("span",{className:"hidden items-center gap-1.5 whitespace-nowrap text-tui-sm sm:flex",children:[f.jsxs("span",{className:"text-tui-faint",children:["v",G]}),f.jsx(Id,{}),f.jsx("span",{className:D?"text-tui-alt":"text-tui-ok",children:c(D?"admin.modeRemote":"admin.localWorkstationBadge")})]}),k?f.jsxs(f.Fragment,{children:[f.jsxs("label",{className:"hidden items-center gap-1.5 text-tui-sm text-tui-muted md:flex",children:[f.jsx("span",{children:c("admin.autoRefresh")}),f.jsxs(Ao,{value:p,onChange:ce=>g(Number(ce.target.value)),"aria-label":c("admin.autoRefresh"),className:ne("w-auto",dd),children:[f.jsx("option",{value:0,children:c("admin.paused")}),f.jsx("option",{value:1e3,children:"1s"}),f.jsx("option",{value:3e3,children:"3s"}),f.jsx("option",{value:5e3,children:"5s"}),f.jsx("option",{value:1e4,children:"10s"})]})]}),f.jsx(Me,{variant:"primary",onClick:te,disabled:j,title:c("admin.refreshNow"),className:dd,children:j?f.jsx(sl,{}):c("admin.refreshNow")})]}):null]}),Q=R&&D&&!N&&!E,ge=R&&D&&(N||E)&&!k;return f.jsxs(XS,{tabs:P,activeTabId:y,onSelectTab:ce=>v(ce),tabsAriaLabel:c("header.mainNavigationAria"),toolbarStart:W,toolbarAside:se,hints:[...k?[{keys:"1–4",action:c("admin.hintTabs")},{keys:"r",action:c("admin.hintRefresh")}]:[],...l?[{keys:"esc",action:c("admin.hintBack")}]:[]],footerAside:q?f.jsx("span",{className:"text-tui-faint",children:c("admin.updatedAt",{time:q.toLocaleTimeString()})}):null,bodyClassName:"space-y-3 pb-2",children:[!R&&f.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:f.jsx(sl,{label:c("admin.loadingStatus")})}),Q&&f.jsx(OM,{wsUrl:s.wsUrl,adminUrl:oe,onOpenRemoteAdmin:()=>window.open(oe,"_blank","noopener,noreferrer"),onSignIn:()=>L(!0)}),ge&&f.jsx(DM,{adminConfigured:z==null?void 0:z.adminConfigured,isAuthError:K,tokenInput:x,onTokenInput:w,onSubmit:ie,isSameOriginRelay:E,onBackToTerminal:l,showBack:a,onCancel:()=>L(!1)}),R&&!D&&K&&f.jsx(zM,{onOpenPairing:n,onRetry:te}),R&&H&&!K&&f.jsx(Ri,{tone:"warn",action:f.jsx(Me,{variant:"warn",onClick:te,children:c("common.retry")}),children:c("admin.errorConnecting",{error:H})}),k&&f.jsxs(f.Fragment,{children:[y==="overview"&&f.jsx(GM,{data:k}),y==="clients"&&f.jsx(UM,{clients:k.clients||[]}),y==="ptys"&&f.jsx(YM,{ptys:k.ptys||[]}),y==="devices"&&f.jsx(KM,{devices:k.devices||[],clients:k.clients||[],onRevoke:Z})]})]})},ao="tui-focusable group flex h-11 w-full select-none items-center gap-2 border px-2 text-left text-tui transition-colors",so="border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",ZM="border-tui-accent bg-tui-selection text-tui-accent",ro=({active:l=!1})=>f.jsx("span",{"aria-hidden":"true",className:ne("shrink-0",l?"text-tui-accent":"text-tui-faint group-hover:text-tui-accent"),children:ke.cursor}),WM=({onClose:l,onOpenPairing:n,onOpenSettings:a,onAddProfile:s=()=>{}})=>{const{settings:o,updateSettings:c,language:h,setLanguage:m,t:p}=Ee(),{connectionState:g,stateDetail:y,rttMs:v,hostId:x,connect:w}=et(),{addToast:S}=Xt(),{copied:M,copy:N}=qd(),L=M!==null,E=No(g,p),k=D=>()=>{var H;const j=document.activeElement;(H=j==null?void 0:j.blur)==null||H.call(j),D()},z=()=>N(o.clientId,p("toasts.clientIdCopied",{id:o.clientId}),"info"),R=()=>{const D=h==="zh"?"en":"zh";m(D),S("info",Od(D,"toasts.switchedLanguage",{lang:D==="zh"?"简体中文":"English"}))};return f.jsxs("div",{className:"flex flex-col gap-3 px-3 pb-2 pt-2",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-tui-border pb-1.5",children:[f.jsx("h2",{className:"text-tui font-bold uppercase text-tui-accent",children:p("mobile.sessionControls")}),f.jsx(Me,{variant:"ghost",onClick:l,"aria-label":p("mobile.closeSessionControls"),children:"esc"})]}),f.jsx(Nt,{title:p("profiles.title"),tone:"accent",bodyClassName:"space-y-1",children:f.jsx(Xd,{mobile:!0,onAddProfile:s})}),f.jsxs(Nt,{title:p("common.status"),tone:E.level==="ok"?"ok":E.level==="bad"?"bad":"warn",bodyClassName:"space-y-1.5",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[f.jsx(dn,{level:E.level}),f.jsx("span",{className:"truncate text-tui uppercase text-tui-text",children:E.label}),g==="connected"&&v!==null&&f.jsxs("span",{className:"text-tui-sm text-tui-muted",children:[v,"ms"]})]}),E.actionLabel&&f.jsx(Me,{variant:"primary",onClick:()=>w(),className:"shrink-0",children:E.actionLabel})]}),E.needsAttention&&y&&f.jsx("p",{className:"text-tui-sm leading-snug text-tui-muted",children:y}),x&&f.jsx(An,{label:p("common.host"),labelWidth:9,children:x}),f.jsxs("button",{type:"button",onClick:z,className:"tui-focusable flex w-full items-baseline gap-2 text-left text-tui",title:p("header.copyClientIdTitle"),children:[f.jsx("span",{className:"shrink-0 text-tui-muted",style:{width:"9ch"},children:p("header.clientIdLabel")}),f.jsx("span",{className:"min-w-0 flex-1 truncate text-tui-text",children:o.clientId}),f.jsx("span",{"aria-hidden":"true",className:ne("shrink-0",L?"text-tui-ok":"text-tui-faint"),children:L?ke.check:"⧉"})]})]}),f.jsx(Nt,{title:p("mobile.inputControl"),tone:"accent","aria-label":p("mobile.terminalControlAria"),children:f.jsx(r0,{className:"h-11"})}),f.jsxs(Nt,{title:p("mobile.menu"),tone:"accent",bodyClassName:"flex flex-col gap-1",children:[f.jsxs("button",{type:"button",onClick:R,className:ne(ao,so),"aria-label":p("header.languageToggleTitle"),children:[f.jsx(ro,{}),f.jsx("span",{className:"truncate",children:h==="zh"?"English":"中文"})]}),f.jsxs("button",{type:"button",onClick:k(a),className:ne(ao,so),"aria-label":p("mobile.settingsAria"),children:[f.jsx(ro,{}),f.jsx("span",{className:"truncate",children:p("common.settings")})]}),f.jsxs("button",{type:"button",onClick:k(n),className:ne(ao,so),"aria-label":p("mobile.pairingAria"),children:[f.jsx(ro,{}),f.jsx("span",{className:"truncate",children:p("common.pairing")})]}),f.jsxs("button",{type:"button",onClick:()=>c({toolbarVisible:!o.toolbarVisible}),className:ne(ao,o.toolbarVisible?ZM:so),"aria-label":p("mobile.keybarAria"),"aria-pressed":o.toolbarVisible,children:[f.jsx(ro,{active:o.toolbarVisible}),f.jsx("span",{className:"truncate",children:p("common.keyBar")}),f.jsx("span",{"aria-hidden":"true",className:"ml-auto shrink-0 text-tui-sm",children:o.toolbarVisible?"[x]":"[ ]"})]})]})]})},QM=({onAddProfile:l})=>{const{t:n}=Ee(),{rttMs:a}=et();return f.jsxs("footer",{"data-testid":"mobile-status-bar",role:"status","aria-label":n("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:[f.jsx(Xd,{statusBar:!0,onAddProfile:l}),f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-border",children:"│"}),f.jsx(s0,{compact:!0}),f.jsx(u0,{compact:!0}),f.jsxs("span",{className:"flex shrink-0 items-center gap-1 px-1 text-tui-muted",title:n("header.latencyTitle"),children:[f.jsx("span",{className:"text-tui-faint",children:"RTT"}),f.jsx("span",{className:ne(a===null?"text-tui-faint":"text-tui-text"),children:a===null?"—":`${a}ms`})]})]})},JM=({onOpenPairing:l,onOpenSettings:n,onAddProfile:a=()=>{}})=>{const{t:s}=Ee(),{connectionState:o,isController:c}=et(),[h,m]=T.useState(!1),p=T.useRef(null),g=T.useCallback(()=>m(!1),[]);T.useEffect(()=>{if(!h)return;const v=x=>{if(!(x.ctrlKey||x.altKey||x.metaKey)&&x.key==="Escape"){const w=x.target;w&&typeof w.closest=="function"&&!!w.closest("#terminal-container")||(x.stopPropagation(),x.preventDefault(),g())}};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[h,g]),T.useEffect(()=>{var v;h&&((v=p.current)==null||v.focus({preventScroll:!0}))},[h]);const y=No(o,s);return f.jsxs(f.Fragment,{children:[f.jsxs("div",{"data-testid":"mobile-topbar",role:"toolbar","aria-label":s("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:[f.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 text-tui-sm text-tui-muted",children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 font-bold text-tui-accent",children:"herdr"}),f.jsx(Id,{className:"shrink-0"}),f.jsx(dn,{level:y.level}),f.jsx("span",{className:"truncate uppercase",children:y.label})]}),f.jsxs("button",{type:"button","data-testid":"mobile-chrome-trigger",onClick:()=>m(!0),"aria-label":s("mobile.sessionControls"),"aria-expanded":h,"aria-haspopup":"dialog",className:ne("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",y.needsAttention?"border-tui-warn text-tui-warn":c?"border-tui-border text-tui-muted":"border-tui-accent text-tui-accent"),children:[!c&&!y.needsAttention&&f.jsx("span",{className:"max-w-[8rem] truncate",children:s("common.viewer")}),f.jsx("span",{"aria-hidden":"true",className:"text-tui",children:ke.chevronDown}),f.jsx("span",{"aria-hidden":"true",children:s("mobile.menu")})]})]}),h&&f.jsxs(f.Fragment,{children:[f.jsx("div",{"data-testid":"mobile-sheet-scrim",className:"absolute inset-0 z-40 bg-tui-crust/70",onClick:g,"aria-hidden":"true"}),f.jsx("div",{ref:p,"data-testid":"mobile-control-sheet",role:"dialog","aria-modal":"true","aria-label":s("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:f.jsx(WM,{onClose:g,onOpenPairing:()=>{g(),l()},onOpenSettings:()=>{g(),n()},onAddProfile:()=>{g(),a()}})})]}),f.jsx(QM,{onAddProfile:a})]})},eA=()=>{const{activeProfile:l,t:n}=Ee(),{herdrLaunch:a,startHerdr:s,hostname:o}=et();if(!a)return null;const c=o||(l==null?void 0:l.displayName)||n("herdrLaunch.thisHost"),h=a.phase==="failed";return f.jsx("div",{"data-testid":"herdr-start-prompt",className:"absolute inset-0 z-30 flex items-center justify-center bg-tui-crust/85 p-3",children:f.jsx(Nt,{title:n(h?"herdrLaunch.failedTitle":"herdrLaunch.title"),tone:h?"bad":"warn",className:"w-full max-w-md",bodyClassName:"space-y-3","aria-label":n("herdrLaunch.title"),children:a.phase==="starting"?f.jsxs("p",{className:"flex items-center gap-2 text-tui-text",role:"status",children:[f.jsx(sl,{}),f.jsx("span",{children:n("herdrLaunch.starting",{host:c})})]}):f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"leading-snug text-tui-text",children:n("herdrLaunch.body",{host:c})}),h&&a.message?f.jsx(Ri,{tone:"bad",children:f.jsx("pre",{className:"max-h-40 overflow-y-auto whitespace-pre-wrap break-words font-mono text-tui-sm",children:a.message})}):null,f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:n("herdrLaunch.scope")}),f.jsx("div",{className:"flex justify-end",children:f.jsx(Me,{variant:"primary",onClick:s,autoFocus:!0,children:n(h?"common.retry":"herdrLaunch.start")})})]})})})},f0="--app-height",h0="--keyboard-inset",tA=80;function nA(){if(typeof window>"u")return{height:768,keyboardInset:0};const l=window.innerHeight||768,n=window.visualViewport;if(n&&typeof n.height=="number"&&n.height>0){const a=l-n.height-(n.offsetTop||0),s=a>=tA?Math.round(a):0;return{height:Math.round(n.height),keyboardInset:s}}return{height:l,keyboardInset:0}}function gb(l,n=nA()){return l.style.setProperty(f0,`${n.height}px`),l.style.setProperty(h0,`${n.keyboardInset}px`),n}function iA(l=typeof document<"u"?document.documentElement:null){if(!l||typeof window>"u")return()=>{};let n=null;const a=()=>{n=null,gb(l)},s=()=>{if(n===null){if(typeof requestAnimationFrame!="function"){a();return}n=requestAnimationFrame(a)}};gb(l);const o=window.visualViewport;return o==null||o.addEventListener("resize",s),o==null||o.addEventListener("scroll",s),window.addEventListener("resize",s),window.addEventListener("orientationchange",s),()=>{n!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(n),n=null),o==null||o.removeEventListener("resize",s),o==null||o.removeEventListener("scroll",s),window.removeEventListener("resize",s),window.removeEventListener("orientationchange",s),l.style.removeProperty(f0),l.style.removeProperty(h0)}}const lA=900;function bb(){if(typeof window>"u")return!1;const l=aa();return l<Hd?!0:l<=lA}function aA(){const[l,n]=T.useState(bb);return T.useEffect(()=>{var o,c;const a=()=>{const h=bb();n(m=>m===h?m:h)};a();let s=null;try{s=typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null}catch{s=null}return(o=s==null?void 0:s.addEventListener)==null||o.call(s,"change",a),window.addEventListener("resize",a),window.addEventListener("orientationchange",a),(c=window.visualViewport)==null||c.addEventListener("resize",a),()=>{var h,m;(h=s==null?void 0:s.removeEventListener)==null||h.call(s,"change",a),window.removeEventListener("resize",a),window.removeEventListener("orientationchange",a),(m=window.visualViewport)==null||m.removeEventListener("resize",a)}},[]),l}function sA(l){const n=l.target;if(!n)return!1;if(n.id==="terminal-container"||n.id==="terminal-frame"||n.id==="terminal-surface"||n.classList.contains("xterm-helper-textarea")||n.classList.contains("xterm")||n.closest("#terminal-container")||n.closest(".xterm"))return!0;if(typeof document<"u"&&document.activeElement){const a=document.activeElement;if(a.id==="terminal-container"||a.classList.contains("xterm-helper-textarea")||a.closest("#terminal-container")||a.closest(".xterm"))return!0}return!1}function rA(l,n={}){if(typeof window>"u")return()=>{};const a=s=>{var o;s.ctrlKey||s.altKey||s.metaKey||s.key==="Escape"&&(n.isModalOpen||n.isSheetOpen)&&(sA(s)||(s.preventDefault(),s.stopPropagation(),(o=l.onCloseModals)==null||o.call(l)))};return window.addEventListener("keydown",a),()=>{window.removeEventListener("keydown",a)}}function oA(){const[l,n]=T.useState("terminal"),[a,s]=T.useState(!1),[o,c]=T.useState(!1),[h,m]=T.useState(!1),[p,g]=T.useState(void 0),y=P=>{g(P),m(!0)},[v,x]=T.useState(!1),{updateSettings:w,addProfileAndConnect:S,settings:M}=Ee(),{connectionState:N,stateDetail:L,stateCode:E,lastPairedAt:k}=et();Z1();const z=aA();T.useEffect(()=>iA(),[]),T.useEffect(()=>{_b()},[]),T.useEffect(()=>{const P=a||o||h||v;if(P)return rA({onCloseModals:()=>{s(!1),c(!1),m(!1),x(!1)}},{isModalOpen:P})},[a,o,h,v]),T.useEffect(()=>{var A;const P=()=>{const G=window.location.pathname,W=window.location.hash;n(G==="/admin"||W==="#admin"?"admin":"terminal")};P(),window.addEventListener("popstate",P),window.addEventListener("hashchange",P);try{const G=new URL(window.location.href),W=(A=G.searchParams.get("pairCode"))==null?void 0:A.toUpperCase();W&&yo().token?S({wsUrl:Rt,pairCode:W}):W&&w({pairCode:W});let se=!1;if(G.searchParams.has("token")&&(G.searchParams.delete("token"),se=!0),G.searchParams.has("pairCode")&&(G.searchParams.delete("pairCode"),se=!0),se){const Q=G.searchParams.toString(),ge=G.pathname+(Q?`?${Q}`:"")+G.hash;window.history.replaceState({},"",ge)}}catch(G){console.warn("Failed to parse URL query params:",G)}return()=>{window.removeEventListener("popstate",P),window.removeEventListener("hashchange",P)}},[w,S]);const R=()=>s(!0),D=()=>c(!0),j=P=>{n(P),P==="admin"?window.history.pushState({},"","/admin"):window.history.pushState({},"","/")},H=!M.token&&!M.pairCode&&N!=="connected",K=N==="error"&&(["auth_required","unauthorized","device_revoked"].includes(E||"")||/auth|unauthor|forbidden|permission|token|pair/i.test(L||"")),q=H||K,[te,Z]=T.useState(!q);T.useEffect(()=>{q||Z(!0)},[q]),T.useEffect(()=>{k&&(s(!1),c(!1),Z(!0),n("terminal"))},[k]);const ie=l==="terminal"&&!q,oe=P=>({visibility:P?"visible":"hidden",opacity:P?1:0,pointerEvents:P?"auto":"none",zIndex:P?1:0});return f.jsxs("div",{"data-testid":"app-shell",style:z?{paddingTop:"env(safe-area-inset-top, 0px)",paddingBottom:"env(safe-area-inset-bottom, 0px)",paddingLeft:"env(safe-area-inset-left, 0px)",paddingRight:"env(safe-area-inset-right, 0px)"}:void 0,className:"flex h-full w-full select-none flex-col overflow-hidden bg-tui-crust font-mono text-tui text-tui-text",onContextMenu:P=>{P.preventDefault(),P.stopPropagation()},children:[!z&&f.jsx(WS,{currentView:l,onNavigate:j,onOpenPairing:R,onOpenSettings:()=>y(),onToggleVirtualKeyboard:()=>x(!v),isVirtualKeyboardOpen:v}),!z&&!q&&f.jsx(QS,{}),f.jsxs("div",{className:"flex-1 min-h-0 w-full overflow-hidden relative",children:[te&&f.jsxs("div",{"data-testid":"terminal-layer",className:`absolute ${z?"inset-x-0 top-12 bottom-11":"inset-0"} flex flex-col min-h-0 w-full overflow-hidden`,style:oe(ie),"aria-hidden":!ie,children:[f.jsx(Z5,{isActive:ie}),!z&&f.jsx(fM,{isOpen:v,onClose:()=>x(!1)}),f.jsx(dM,{compact:z,onCustomize:()=>y("agentKeymaps")}),f.jsx(eA,{}),f.jsx(vM,{})]}),l==="terminal"&&q&&f.jsx("div",{"data-testid":"onboarding-layer",className:"absolute inset-0 flex flex-col min-h-0 w-full overflow-hidden z-10",children:f.jsx(Q5,{onPairedSuccess:()=>{}})}),l==="admin"&&f.jsx("div",{"data-testid":"admin-layer",className:"absolute inset-0 flex flex-col min-h-0 w-full overflow-hidden z-20",children:f.jsx(XM,{onBackToTerminal:()=>j("terminal"),onOpenPairing:R,showBack:z})}),z&&ie&&f.jsx(JM,{onOpenPairing:R,onOpenSettings:()=>y(),onAddProfile:D})]}),!z&&l!=="admin"&&f.jsx(jM,{onAddProfile:D}),f.jsx(hM,{isOpen:a,onClose:()=>s(!1)}),f.jsx(mM,{isOpen:o,onClose:()=>c(!1)}),f.jsx(SM,{isOpen:h,initialTab:p,onClose:()=>m(!1),onOpenAdmin:()=>{m(!1),j("admin")}}),f.jsx(MM,{})]})}function cA(){return f.jsx(B1,{children:f.jsx(oA,{})})}const m0=document.getElementById("root");if(!m0)throw new Error("Root element not found");Bx.createRoot(m0).render(f.jsx(Jn.StrictMode,{children:f.jsx(cA,{})}));