herdr-remote-relay 0.3.12 → 0.3.13
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.
- package/bin/herdr-remote-relay.js +20 -20
- package/dist/auth-store.d.ts +114 -0
- package/dist/auth-store.js +276 -0
- package/dist/metrics.d.ts +76 -0
- package/dist/metrics.js +249 -0
- package/dist/protocol/frames.d.ts +27 -0
- package/dist/protocol/frames.js +110 -0
- package/dist/protocol/http.d.ts +161 -0
- package/dist/protocol/http.js +3 -0
- package/dist/protocol/index.d.ts +5 -0
- package/dist/protocol/index.js +7 -0
- package/dist/protocol/messages.d.ts +321 -0
- package/dist/protocol/messages.js +18 -0
- package/dist/protocol/paste.d.ts +14 -0
- package/dist/protocol/paste.js +50 -0
- package/dist/protocol/terminal.d.ts +79 -0
- package/dist/protocol/terminal.js +150 -0
- package/dist/relay-config.d.ts +74 -0
- package/dist/relay-config.js +316 -0
- package/dist/relay-server.d.ts +64 -0
- package/dist/relay-server.js +194 -0
- package/dist/scroll-input.d.ts +17 -0
- package/dist/scroll-input.js +124 -0
- package/dist/server/client-channel.d.ts +3 -0
- package/dist/server/client-channel.js +365 -0
- package/dist/server/font-proxy.d.ts +19 -0
- package/dist/server/font-proxy.js +155 -0
- package/dist/server/host-broadcasts.d.ts +25 -0
- package/dist/server/host-broadcasts.js +79 -0
- package/dist/server/host-channel.d.ts +3 -0
- package/dist/server/host-channel.js +266 -0
- package/dist/server/http-api.d.ts +3 -0
- package/dist/server/http-api.js +214 -0
- package/dist/server/maintenance.d.ts +5 -0
- package/dist/server/maintenance.js +64 -0
- package/dist/server/requests.d.ts +34 -0
- package/dist/server/requests.js +142 -0
- package/dist/server/sessions.d.ts +36 -0
- package/dist/server/sessions.js +225 -0
- package/dist/server/sockets.d.ts +12 -0
- package/dist/server/sockets.js +64 -0
- package/dist/server/status.d.ts +11 -0
- package/dist/server/status.js +95 -0
- package/dist/server/transport.d.ts +16 -0
- package/dist/server/transport.js +110 -0
- package/dist/server/types.d.ts +123 -0
- package/dist/server/types.js +3 -0
- package/dist/server/version.d.ts +2 -0
- package/dist/server/version.js +5 -0
- package/dist/state.d.ts +6 -0
- package/dist/state.js +47 -0
- package/package.json +32 -8
- package/web/dist/assets/index-B-5zRmL_.js +61 -0
- package/web/dist/assets/{index-CPVUfBt4.css → index-DKt8KLog.css} +1 -1
- package/web/dist/assets/{vendor-xterm-Bbu8R_5E.js → vendor-xterm-BhCxil_4.js} +2 -2
- package/web/dist/index.html +3 -3
- package/src/auth-store.js +0 -256
- package/src/metrics.js +0 -241
- package/src/relay-config.js +0 -312
- package/src/relay-server.js +0 -1799
- package/src/scroll-input.js +0 -139
- package/src/state.js +0 -47
- package/src/stream-frame.js +0 -238
- package/web/dist/assets/index-6WucmdNP.js +0 -61
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
var ax=Object.defineProperty;var lx=(a,i,l)=>i in a?ax(a,i,{enumerable:!0,configurable:!0,writable:!0,value:l}):a[i]=l;var W=(a,i,l)=>lx(a,typeof i!="symbol"?i+"":i,l);import{r as tb,g as nb,a as ib}from"./vendor-react-CYSfZuHu.js";import{r as sx,a as ox}from"./vendor-xterm-BhCxil_4.js";(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))o(r);new MutationObserver(r=>{for(const u of r)if(u.type==="childList")for(const h of u.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&o(h)}).observe(document,{childList:!0,subtree:!0});function l(r){const u={};return r.integrity&&(u.integrity=r.integrity),r.referrerPolicy&&(u.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?u.credentials="include":r.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function o(r){if(r.ep)return;r.ep=!0;const u=l(r);fetch(r.href,u)}})();var Nu={exports:{}},Wl={};/**
|
|
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 Hp;function rx(){if(Hp)return Wl;Hp=1;var a=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function l(o,r,u){var h=null;if(u!==void 0&&(h=""+u),r.key!==void 0&&(h=""+r.key),"key"in r){u={};for(var m in r)m!=="key"&&(u[m]=r[m])}else u=r;return r=u.ref,{$$typeof:a,type:o,key:h,ref:r!==void 0?r:null,props:u}}return Wl.Fragment=i,Wl.jsx=l,Wl.jsxs=l,Wl}var Bp;function cx(){return Bp||(Bp=1,Nu.exports=rx()),Nu.exports}var f=cx(),C=tb();const qn=nb(C);var ku={exports:{}},Jl={},Lu={exports:{}},Ru={};/**
|
|
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 Up;function ux(){return Up||(Up=1,(function(a){function i(E,Y){var X=E.length;E.push(Y);e:for(;0<X;){var le=X-1>>>1,Q=E[le];if(0<r(Q,Y))E[le]=Y,E[X]=Q,X=le;else break e}}function l(E){return E.length===0?null:E[0]}function o(E){if(E.length===0)return null;var Y=E[0],X=E.pop();if(X!==Y){E[0]=X;e:for(var le=0,Q=E.length,ve=Q>>>1;le<ve;){var ye=2*(le+1)-1,xe=E[ye],me=ye+1,de=E[me];if(0>r(xe,X))me<Q&&0>r(de,xe)?(E[le]=de,E[me]=X,le=me):(E[le]=xe,E[ye]=X,le=ye);else if(me<Q&&0>r(de,X))E[le]=de,E[me]=X,le=me;else break e}}return Y}function r(E,Y){var X=E.sortIndex-Y.sortIndex;return X!==0?X:E.id-Y.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;a.unstable_now=function(){return u.now()}}else{var h=Date,m=h.now();a.unstable_now=function(){return h.now()-m}}var p=[],g=[],b=1,v=null,w=3,x=!1,T=!1,M=!1,A=!1,N=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;function V(E){for(var Y=l(g);Y!==null;){if(Y.callback===null)o(g);else if(Y.startTime<=E)o(g),Y.sortIndex=Y.expirationTime,i(p,Y);else break;Y=l(g)}}function _(E){if(M=!1,V(E),!T)if(l(p)!==null)T=!0,D||(D=!0,P());else{var Y=l(g);Y!==null&&F(_,Y.startTime-E)}}var D=!1,L=-1,z=5,U=-1;function ee(){return A?!0:!(a.unstable_now()-U<z)}function q(){if(A=!1,D){var E=a.unstable_now();U=E;var Y=!0;try{e:{T=!1,M&&(M=!1,R(L),L=-1),x=!0;var X=w;try{t:{for(V(E),v=l(p);v!==null&&!(v.expirationTime>E&&ee());){var le=v.callback;if(typeof le=="function"){v.callback=null,w=v.priorityLevel;var Q=le(v.expirationTime<=E);if(E=a.unstable_now(),typeof Q=="function"){v.callback=Q,V(E),Y=!0;break t}v===l(p)&&o(p),V(E)}else o(p);v=l(p)}if(v!==null)Y=!0;else{var ve=l(g);ve!==null&&F(_,ve.startTime-E),Y=!1}}break e}finally{v=null,w=X,x=!1}Y=void 0}}finally{Y?P():D=!1}}}var P;if(typeof j=="function")P=function(){j(q)};else if(typeof MessageChannel<"u"){var ie=new MessageChannel,ae=ie.port2;ie.port1.onmessage=q,P=function(){ae.postMessage(null)}}else P=function(){N(q,0)};function F(E,Y){L=N(function(){E(a.unstable_now())},Y)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(E){E.callback=null},a.unstable_forceFrameRate=function(E){0>E||125<E?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<E?Math.floor(1e3/E):5},a.unstable_getCurrentPriorityLevel=function(){return w},a.unstable_next=function(E){switch(w){case 1:case 2:case 3:var Y=3;break;default:Y=w}var X=w;w=Y;try{return E()}finally{w=X}},a.unstable_requestPaint=function(){A=!0},a.unstable_runWithPriority=function(E,Y){switch(E){case 1:case 2:case 3:case 4:case 5:break;default:E=3}var X=w;w=E;try{return Y()}finally{w=X}},a.unstable_scheduleCallback=function(E,Y,X){var le=a.unstable_now();switch(typeof X=="object"&&X!==null?(X=X.delay,X=typeof X=="number"&&0<X?le+X:le):X=le,E){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=X+Q,E={id:b++,callback:Y,priorityLevel:E,startTime:X,expirationTime:Q,sortIndex:-1},X>le?(E.sortIndex=X,i(g,E),l(p)===null&&E===l(g)&&(M?(R(L),L=-1):M=!0,F(_,X-le))):(E.sortIndex=Q,i(p,E),T||x||(T=!0,D||(D=!0,P()))),E},a.unstable_shouldYield=ee,a.unstable_wrapCallback=function(E){var Y=w;return function(){var X=w;w=Y;try{return E.apply(this,arguments)}finally{w=X}}}})(Ru)),Ru}var Kp;function dx(){return Kp||(Kp=1,Lu.exports=ux()),Lu.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 Ip;function fx(){if(Ip)return Jl;Ip=1;var a=dx(),i=tb(),l=ib();function o(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function u(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function 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(u(e)!==e)throw Error(o(188))}function g(e){var t=e.alternate;if(!t){if(t=u(e),t===null)throw Error(o(188));return t!==e?null:e}for(var n=e,s=t;;){var c=n.return;if(c===null)break;var d=c.alternate;if(d===null){if(s=c.return,s!==null){n=s;continue}break}if(c.child===d.child){for(d=c.child;d;){if(d===n)return p(c),e;if(d===s)return p(c),t;d=d.sibling}throw Error(o(188))}if(n.return!==s.return)n=c,s=d;else{for(var y=!1,S=c.child;S;){if(S===n){y=!0,n=c,s=d;break}if(S===s){y=!0,s=c,n=d;break}S=S.sibling}if(!y){for(S=d.child;S;){if(S===n){y=!0,n=d,s=c;break}if(S===s){y=!0,s=d,n=c;break}S=S.sibling}if(!y)throw Error(o(189))}}if(n.alternate!==s)throw Error(o(190))}if(n.tag!==3)throw Error(o(188));return n.stateNode.current===n?e:t}function b(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=b(e),t!==null)return t;e=e.sibling}return null}var v=Object.assign,w=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),T=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),j=Symbol.for("react.context"),V=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),U=Symbol.for("react.activity"),ee=Symbol.for("react.memo_cache_sentinel"),q=Symbol.iterator;function P(e){return e===null||typeof e!="object"?null:(e=q&&e[q]||e["@@iterator"],typeof e=="function"?e:null)}var ie=Symbol.for("react.client.reference");function ae(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 N:return"Profiler";case A:return"StrictMode";case _:return"Suspense";case D:return"SuspenseList";case U:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case T:return"Portal";case j:return e.displayName||"Context";case R:return(e._context.displayName||"Context")+".Consumer";case V:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case L:return t=e.displayName||null,t!==null?t:ae(e.type)||"Memo";case z:t=e._payload,e=e._init;try{return ae(e(t))}catch{}}return null}var F=Array.isArray,E=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=l.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X={pending:!1,data:null,method:null,action:null},le=[],Q=-1;function ve(e){return{current:e}}function ye(e){0>Q||(e.current=le[Q],le[Q]=null,Q--)}function xe(e,t){Q++,le[Q]=e.current,e.current=t}var me=ve(null),de=ve(null),we=ve(null),oe=ve(null);function Se(e,t){switch(xe(we,t),xe(de,e),xe(me,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?sp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=sp(t),e=op(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}ye(me),xe(me,e)}function se(){ye(me),ye(de),ye(we)}function pe(e){e.memoizedState!==null&&xe(oe,e);var t=me.current,n=op(t,e.type);t!==n&&(xe(de,e),xe(me,n))}function Ee(e){de.current===e&&(ye(me),ye(de)),oe.current===e&&(ye(oe),Pl._currentValue=X)}var Be,ce;function Ae(e){if(Be===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Be=t&&t[1]||"",ce=-1<n.stack.indexOf(`
|
|
26
|
+
at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
27
|
+
`+Be+e+ce}var Pe=!1;function wt(e,t){if(!e||Pe)return"";Pe=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(t){var te=function(){throw Error()};if(Object.defineProperty(te.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(te,[])}catch($){var G=$}Reflect.construct(e,[],te)}else{try{te.call()}catch($){G=$}e.call(te.prototype)}}else{try{throw Error()}catch($){G=$}(te=e())&&typeof te.catch=="function"&&te.catch(function(){})}}catch($){if($&&G&&typeof $.stack=="string")return[$.stack,G.stack]}return[null,null]}};s.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var c=Object.getOwnPropertyDescriptor(s.DetermineComponentFrameRoot,"name");c&&c.configurable&&Object.defineProperty(s.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var d=s.DetermineComponentFrameRoot(),y=d[0],S=d[1];if(y&&S){var k=y.split(`
|
|
28
|
+
`),I=S.split(`
|
|
29
|
+
`);for(c=s=0;s<k.length&&!k[s].includes("DetermineComponentFrameRoot");)s++;for(;c<I.length&&!I[c].includes("DetermineComponentFrameRoot");)c++;if(s===k.length||c===I.length)for(s=k.length-1,c=I.length-1;1<=s&&0<=c&&k[s]!==I[c];)c--;for(;1<=s&&0<=c;s--,c--)if(k[s]!==I[c]){if(s!==1||c!==1)do if(s--,c--,0>c||k[s]!==I[c]){var Z=`
|
|
30
|
+
`+k[s].replace(" at new "," at ");return e.displayName&&Z.includes("<anonymous>")&&(Z=Z.replace("<anonymous>",e.displayName)),Z}while(1<=s&&0<=c);break}}}finally{Pe=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Ae(n):""}function Nt(e,t){switch(e.tag){case 26:case 27:case 5:return Ae(e.type);case 16:return Ae("Lazy");case 13:return e.child!==t&&t!==null?Ae("Suspense Fallback"):Ae("Suspense");case 19:return Ae("SuspenseList");case 0:case 15:return wt(e.type,!1);case 11:return wt(e.type.render,!1);case 1:return wt(e.type,!0);case 31:return Ae("Activity");default:return""}}function Vn(e){try{var t="",n=null;do t+=Nt(e,n),n=e,e=e.return;while(e);return t}catch(s){return`
|
|
31
|
+
Error generating stack: `+s.message+`
|
|
32
|
+
`+s.stack}}var Pn=Object.prototype.hasOwnProperty,kt=a.unstable_scheduleCallback,Sn=a.unstable_cancelCallback,ps=a.unstable_shouldYield,gs=a.unstable_requestPaint,St=a.unstable_now,bs=a.unstable_getCurrentPriorityLevel,al=a.unstable_ImmediatePriority,ll=a.unstable_UserBlockingPriority,ki=a.unstable_NormalPriority,ys=a.unstable_LowPriority,sl=a.unstable_IdlePriority,vs=a.log,xs=a.unstable_setDisableYieldValue,Li=null,Mt=null;function rn(e){if(typeof vs=="function"&&xs(e),Mt&&typeof Mt.setStrictMode=="function")try{Mt.setStrictMode(Li,e)}catch{}}var Ct=Math.clz32?Math.clz32:qt,ge=Math.log,We=Math.LN2;function qt(e){return e>>>=0,e===0?32:31-(ge(e)/We|0)|0}var Vt=256,Ri=262144,ws=4194304;function _i(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 Ss(e,t,n){var s=e.pendingLanes;if(s===0)return 0;var c=0,d=e.suspendedLanes,y=e.pingedLanes;e=e.warmLanes;var S=s&134217727;return S!==0?(s=S&~d,s!==0?c=_i(s):(y&=S,y!==0?c=_i(y):n||(n=S&~e,n!==0&&(c=_i(n))))):(S=s&~d,S!==0?c=_i(S):y!==0?c=_i(y):n||(n=s&~e,n!==0&&(c=_i(n)))),c===0?0:t!==0&&t!==c&&(t&d)===0&&(d=c&-c,n=t&-t,d>=n||d===32&&(n&4194048)!==0)?t:c}function ol(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function $y(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 Kd(){var e=ws;return ws<<=1,(ws&62914560)===0&&(ws=4194304),e}function gr(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function rl(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function qy(e,t,n,s,c,d){var y=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var S=e.entanglements,k=e.expirationTimes,I=e.hiddenUpdates;for(n=y&~n;0<n;){var Z=31-Ct(n),te=1<<Z;S[Z]=0,k[Z]=-1;var G=I[Z];if(G!==null)for(I[Z]=null,Z=0;Z<G.length;Z++){var $=G[Z];$!==null&&($.lane&=-536870913)}n&=~te}s!==0&&Id(e,s,0),d!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=d&~(y&~t))}function Id(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var s=31-Ct(t);e.entangledLanes|=t,e.entanglements[s]=e.entanglements[s]|1073741824|n&261930}function Fd(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var s=31-Ct(n),c=1<<s;c&t|e[s]&t&&(e[s]|=t),n&=~c}}function Gd(e,t){var n=t&-t;return n=(n&42)!==0?1:br(n),(n&(e.suspendedLanes|t))!==0?0:n}function br(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 yr(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Yd(){var e=Y.p;return e!==0?e:(e=window.event,e===void 0?32:Lp(e.type))}function $d(e,t){var n=Y.p;try{return Y.p=e,t()}finally{Y.p=n}}var Xn=Math.random().toString(36).slice(2),gt="__reactFiber$"+Xn,Lt="__reactProps$"+Xn,la="__reactContainer$"+Xn,vr="__reactEvents$"+Xn,Vy="__reactListeners$"+Xn,Py="__reactHandles$"+Xn,qd="__reactResources$"+Xn,cl="__reactMarker$"+Xn;function xr(e){delete e[gt],delete e[Lt],delete e[vr],delete e[Vy],delete e[Py]}function sa(e){var t=e[gt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[la]||n[gt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=mp(e);e!==null;){if(n=e[gt])return n;e=mp(e)}return t}e=n,n=e.parentNode}return null}function oa(e){if(e=e[gt]||e[la]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function ul(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function ra(e){var t=e[qd];return t||(t=e[qd]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function ht(e){e[cl]=!0}var Vd=new Set,Pd={};function ji(e,t){ca(e,t),ca(e+"Capture",t)}function ca(e,t){for(Pd[e]=t,e=0;e<t.length;e++)Vd.add(t[e])}var Xy=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]*$"),Xd={},Qd={};function Qy(e){return Pn.call(Qd,e)?!0:Pn.call(Xd,e)?!1:Xy.test(e)?Qd[e]=!0:(Xd[e]=!0,!1)}function Cs(e,t,n){if(Qy(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var s=t.toLowerCase().slice(0,5);if(s!=="data-"&&s!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+n)}}function Ts(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+n)}}function Cn(e,t,n,s){if(s===null)e.removeAttribute(n);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+s)}}function Pt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Zd(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Zy(e,t,n){var s=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var c=s.get,d=s.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(y){n=""+y,d.call(this,y)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return n},setValue:function(y){n=""+y},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function wr(e){if(!e._valueTracker){var t=Zd(e)?"checked":"value";e._valueTracker=Zy(e,t,""+e[t])}}function Wd(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=Zd(e)?e.checked?"true":"false":e.value),e=s,e!==n?(t.setValue(e),!0):!1}function Ms(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 Wy=/[\n"\\]/g;function Xt(e){return e.replace(Wy,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Sr(e,t,n,s,c,d,y,S){e.name="",y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?e.type=y:e.removeAttribute("type"),t!=null?y==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Pt(t)):e.value!==""+Pt(t)&&(e.value=""+Pt(t)):y!=="submit"&&y!=="reset"||e.removeAttribute("value"),t!=null?Cr(e,y,Pt(t)):n!=null?Cr(e,y,Pt(n)):s!=null&&e.removeAttribute("value"),c==null&&d!=null&&(e.defaultChecked=!!d),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?e.name=""+Pt(S):e.removeAttribute("name")}function Jd(e,t,n,s,c,d,y,S){if(d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(e.type=d),t!=null||n!=null){if(!(d!=="submit"&&d!=="reset"||t!=null)){wr(e);return}n=n!=null?""+Pt(n):"",t=t!=null?""+Pt(t):n,S||t===e.value||(e.value=t),e.defaultValue=t}s=s??c,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=S?e.checked:!!s,e.defaultChecked=!!s,y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(e.name=y),wr(e)}function Cr(e,t,n){t==="number"&&Ms(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function ua(e,t,n,s){if(e=e.options,t){t={};for(var c=0;c<n.length;c++)t["$"+n[c]]=!0;for(n=0;n<e.length;n++)c=t.hasOwnProperty("$"+e[n].value),e[n].selected!==c&&(e[n].selected=c),c&&s&&(e[n].defaultSelected=!0)}else{for(n=""+Pt(n),t=null,c=0;c<e.length;c++){if(e[c].value===n){e[c].selected=!0,s&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function ef(e,t,n){if(t!=null&&(t=""+Pt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Pt(n):""}function tf(e,t,n,s){if(t==null){if(s!=null){if(n!=null)throw Error(o(92));if(F(s)){if(1<s.length)throw Error(o(93));s=s[0]}n=s}n==null&&(n=""),t=n}n=Pt(t),e.defaultValue=n,s=e.textContent,s===n&&s!==""&&s!==null&&(e.value=s),wr(e)}function da(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Jy=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 nf(e,t,n){var s=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?s?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":s?e.setProperty(t,n):typeof n!="number"||n===0||Jy.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function af(e,t,n){if(t!=null&&typeof t!="object")throw Error(o(62));if(e=e.style,n!=null){for(var s in n)!n.hasOwnProperty(s)||t!=null&&t.hasOwnProperty(s)||(s.indexOf("--")===0?e.setProperty(s,""):s==="float"?e.cssFloat="":e[s]="");for(var c in t)s=t[c],t.hasOwnProperty(c)&&n[c]!==s&&nf(e,c,s)}else for(var d in t)t.hasOwnProperty(d)&&nf(e,d,t[d])}function Tr(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 e0=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 As(e){return t0.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Tn(){}var Mr=null;function Ar(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var fa=null,ha=null;function lf(e){var t=oa(e);if(t&&(e=t.stateNode)){var n=e[Lt]||null;e:switch(e=t.stateNode,t.type){case"input":if(Sr(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+Xt(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var s=n[t];if(s!==e&&s.form===e.form){var c=s[Lt]||null;if(!c)throw Error(o(90));Sr(s,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name)}}for(t=0;t<n.length;t++)s=n[t],s.form===e.form&&Wd(s)}break e;case"textarea":ef(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&ua(e,!!n.multiple,t,!1)}}}var Er=!1;function sf(e,t,n){if(Er)return e(t,n);Er=!0;try{var s=e(t);return s}finally{if(Er=!1,(fa!==null||ha!==null)&&(mo(),fa&&(t=fa,e=ha,ha=fa=null,lf(t),e)))for(t=0;t<e.length;t++)lf(e[t])}}function dl(e,t){var n=e.stateNode;if(n===null)return null;var s=n[Lt]||null;if(s===null)return null;n=s[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":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(o(231,t,typeof n));return n}var Mn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Nr=!1;if(Mn)try{var fl={};Object.defineProperty(fl,"passive",{get:function(){Nr=!0}}),window.addEventListener("test",fl,fl),window.removeEventListener("test",fl,fl)}catch{Nr=!1}var Qn=null,kr=null,Es=null;function of(){if(Es)return Es;var e,t=kr,n=t.length,s,c="value"in Qn?Qn.value:Qn.textContent,d=c.length;for(e=0;e<n&&t[e]===c[e];e++);var y=n-e;for(s=1;s<=y&&t[n-s]===c[d-s];s++);return Es=c.slice(e,1<s?1-s:void 0)}function Ns(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function ks(){return!0}function rf(){return!1}function Rt(e){function t(n,s,c,d,y){this._reactName=n,this._targetInst=c,this.type=s,this.nativeEvent=d,this.target=y,this.currentTarget=null;for(var S in e)e.hasOwnProperty(S)&&(n=e[S],this[S]=n?n(d):d[S]);return this.isDefaultPrevented=(d.defaultPrevented!=null?d.defaultPrevented:d.returnValue===!1)?ks:rf,this.isPropagationStopped=rf,this}return v(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=ks)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=ks)},persist:function(){},isPersistent:ks}),t}var Oi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ls=Rt(Oi),hl=v({},Oi,{view:0,detail:0}),n0=Rt(hl),Lr,Rr,ml,Rs=v({},hl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:jr,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!==ml&&(ml&&e.type==="mousemove"?(Lr=e.screenX-ml.screenX,Rr=e.screenY-ml.screenY):Rr=Lr=0,ml=e),Lr)},movementY:function(e){return"movementY"in e?e.movementY:Rr}}),cf=Rt(Rs),i0=v({},Rs,{dataTransfer:0}),a0=Rt(i0),l0=v({},hl,{relatedTarget:0}),_r=Rt(l0),s0=v({},Oi,{animationName:0,elapsedTime:0,pseudoElement:0}),o0=Rt(s0),r0=v({},Oi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),c0=Rt(r0),u0=v({},Oi,{data:0}),uf=Rt(u0),d0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},f0={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"},h0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function m0(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=h0[e])?!!t[e]:!1}function jr(){return m0}var p0=v({},hl,{key:function(e){if(e.key){var t=d0[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Ns(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?f0[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:jr,charCode:function(e){return e.type==="keypress"?Ns(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ns(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),g0=Rt(p0),b0=v({},Rs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),df=Rt(b0),y0=v({},hl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:jr}),v0=Rt(y0),x0=v({},Oi,{propertyName:0,elapsedTime:0,pseudoElement:0}),w0=Rt(x0),S0=v({},Rs,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),C0=Rt(S0),T0=v({},Oi,{newState:0,oldState:0}),M0=Rt(T0),A0=[9,13,27,32],Or=Mn&&"CompositionEvent"in window,pl=null;Mn&&"documentMode"in document&&(pl=document.documentMode);var E0=Mn&&"TextEvent"in window&&!pl,ff=Mn&&(!Or||pl&&8<pl&&11>=pl),hf=" ",mf=!1;function pf(e,t){switch(e){case"keyup":return A0.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function gf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ma=!1;function N0(e,t){switch(e){case"compositionend":return gf(t);case"keypress":return t.which!==32?null:(mf=!0,hf);case"textInput":return e=t.data,e===hf&&mf?null:e;default:return null}}function k0(e,t){if(ma)return e==="compositionend"||!Or&&pf(e,t)?(e=of(),Es=kr=Qn=null,ma=!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 ff&&t.locale!=="ko"?null:t.data;default:return null}}var L0={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 bf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!L0[e.type]:t==="textarea"}function yf(e,t,n,s){fa?ha?ha.push(s):ha=[s]:fa=s,t=wo(t,"onChange"),0<t.length&&(n=new Ls("onChange","change",null,n,s),e.push({event:n,listeners:t}))}var gl=null,bl=null;function R0(e){ep(e,0)}function _s(e){var t=ul(e);if(Wd(t))return e}function vf(e,t){if(e==="change")return t}var xf=!1;if(Mn){var Dr;if(Mn){var zr="oninput"in document;if(!zr){var wf=document.createElement("div");wf.setAttribute("oninput","return;"),zr=typeof wf.oninput=="function"}Dr=zr}else Dr=!1;xf=Dr&&(!document.documentMode||9<document.documentMode)}function Sf(){gl&&(gl.detachEvent("onpropertychange",Cf),bl=gl=null)}function Cf(e){if(e.propertyName==="value"&&_s(bl)){var t=[];yf(t,bl,e,Ar(e)),sf(R0,t)}}function _0(e,t,n){e==="focusin"?(Sf(),gl=t,bl=n,gl.attachEvent("onpropertychange",Cf)):e==="focusout"&&Sf()}function j0(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return _s(bl)}function O0(e,t){if(e==="click")return _s(t)}function D0(e,t){if(e==="input"||e==="change")return _s(t)}function z0(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ut=typeof Object.is=="function"?Object.is:z0;function yl(e,t){if(Ut(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(s=0;s<n.length;s++){var c=n[s];if(!Pn.call(t,c)||!Ut(e[c],t[c]))return!1}return!0}function Tf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Mf(e,t){var n=Tf(e);e=0;for(var s;n;){if(n.nodeType===3){if(s=e+n.textContent.length,e<=t&&s>=t)return{node:n,offset:t-e};e=s}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Tf(n)}}function Af(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Af(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ef(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ms(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ms(e.document)}return t}function Hr(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 H0=Mn&&"documentMode"in document&&11>=document.documentMode,pa=null,Br=null,vl=null,Ur=!1;function Nf(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ur||pa==null||pa!==Ms(s)||(s=pa,"selectionStart"in s&&Hr(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),vl&&yl(vl,s)||(vl=s,s=wo(Br,"onSelect"),0<s.length&&(t=new Ls("onSelect","select",null,t,n),e.push({event:t,listeners:s}),t.target=pa)))}function Di(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var ga={animationend:Di("Animation","AnimationEnd"),animationiteration:Di("Animation","AnimationIteration"),animationstart:Di("Animation","AnimationStart"),transitionrun:Di("Transition","TransitionRun"),transitionstart:Di("Transition","TransitionStart"),transitioncancel:Di("Transition","TransitionCancel"),transitionend:Di("Transition","TransitionEnd")},Kr={},kf={};Mn&&(kf=document.createElement("div").style,"AnimationEvent"in window||(delete ga.animationend.animation,delete ga.animationiteration.animation,delete ga.animationstart.animation),"TransitionEvent"in window||delete ga.transitionend.transition);function zi(e){if(Kr[e])return Kr[e];if(!ga[e])return e;var t=ga[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in kf)return Kr[e]=t[n];return e}var Lf=zi("animationend"),Rf=zi("animationiteration"),_f=zi("animationstart"),B0=zi("transitionrun"),U0=zi("transitionstart"),K0=zi("transitioncancel"),jf=zi("transitionend"),Of=new Map,Ir="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(" ");Ir.push("scrollEnd");function cn(e,t){Of.set(e,t),ji(t,[e])}var js=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)},Qt=[],ba=0,Fr=0;function Os(){for(var e=ba,t=Fr=ba=0;t<e;){var n=Qt[t];Qt[t++]=null;var s=Qt[t];Qt[t++]=null;var c=Qt[t];Qt[t++]=null;var d=Qt[t];if(Qt[t++]=null,s!==null&&c!==null){var y=s.pending;y===null?c.next=c:(c.next=y.next,y.next=c),s.pending=c}d!==0&&Df(n,c,d)}}function Ds(e,t,n,s){Qt[ba++]=e,Qt[ba++]=t,Qt[ba++]=n,Qt[ba++]=s,Fr|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function Gr(e,t,n,s){return Ds(e,t,n,s),zs(e)}function Hi(e,t){return Ds(e,null,null,t),zs(e)}function Df(e,t,n){e.lanes|=n;var s=e.alternate;s!==null&&(s.lanes|=n);for(var c=!1,d=e.return;d!==null;)d.childLanes|=n,s=d.alternate,s!==null&&(s.childLanes|=n),d.tag===22&&(e=d.stateNode,e===null||e._visibility&1||(c=!0)),e=d,d=d.return;return e.tag===3?(d=e.stateNode,c&&t!==null&&(c=31-Ct(n),e=d.hiddenUpdates,s=e[c],s===null?e[c]=[t]:s.push(t),t.lane=n|536870912),d):null}function zs(e){if(50<Il)throw Il=0,Wc=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ya={};function I0(e,t,n,s){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Kt(e,t,n,s){return new I0(e,t,n,s)}function Yr(e){return e=e.prototype,!(!e||!e.isReactComponent)}function An(e,t){var n=e.alternate;return n===null?(n=Kt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function zf(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Hs(e,t,n,s,c,d){var y=0;if(s=e,typeof e=="function")Yr(e)&&(y=1);else if(typeof e=="string")y=qv(e,n,me.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case U:return e=Kt(31,n,t,c),e.elementType=U,e.lanes=d,e;case M:return Bi(n.children,c,d,t);case A:y=8,c|=24;break;case N:return e=Kt(12,n,t,c|2),e.elementType=N,e.lanes=d,e;case _:return e=Kt(13,n,t,c),e.elementType=_,e.lanes=d,e;case D:return e=Kt(19,n,t,c),e.elementType=D,e.lanes=d,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case j:y=10;break e;case R:y=9;break e;case V:y=11;break e;case L:y=14;break e;case z:y=16,s=null;break e}y=29,n=Error(o(130,e===null?"null":typeof e,"")),s=null}return t=Kt(y,n,t,c),t.elementType=e,t.type=s,t.lanes=d,t}function Bi(e,t,n,s){return e=Kt(7,e,s,t),e.lanes=n,e}function $r(e,t,n){return e=Kt(6,e,null,t),e.lanes=n,e}function Hf(e){var t=Kt(18,null,null,0);return t.stateNode=e,t}function qr(e,t,n){return t=Kt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Bf=new WeakMap;function Zt(e,t){if(typeof e=="object"&&e!==null){var n=Bf.get(e);return n!==void 0?n:(t={value:e,source:t,stack:Vn(t)},Bf.set(e,t),t)}return{value:e,source:t,stack:Vn(t)}}var va=[],xa=0,Bs=null,xl=0,Wt=[],Jt=0,Zn=null,mn=1,pn="";function En(e,t){va[xa++]=xl,va[xa++]=Bs,Bs=e,xl=t}function Uf(e,t,n){Wt[Jt++]=mn,Wt[Jt++]=pn,Wt[Jt++]=Zn,Zn=e;var s=mn;e=pn;var c=32-Ct(s)-1;s&=~(1<<c),n+=1;var d=32-Ct(t)+c;if(30<d){var y=c-c%5;d=(s&(1<<y)-1).toString(32),s>>=y,c-=y,mn=1<<32-Ct(t)+c|n<<c|s,pn=d+e}else mn=1<<d|n<<c|s,pn=e}function Vr(e){e.return!==null&&(En(e,1),Uf(e,1,0))}function Pr(e){for(;e===Bs;)Bs=va[--xa],va[xa]=null,xl=va[--xa],va[xa]=null;for(;e===Zn;)Zn=Wt[--Jt],Wt[Jt]=null,pn=Wt[--Jt],Wt[Jt]=null,mn=Wt[--Jt],Wt[Jt]=null}function Kf(e,t){Wt[Jt++]=mn,Wt[Jt++]=pn,Wt[Jt++]=Zn,mn=t.id,pn=t.overflow,Zn=e}var bt=null,Xe=null,He=!1,Wn=null,en=!1,Xr=Error(o(519));function Jn(e){var t=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw wl(Zt(t,e)),Xr}function If(e){var t=e.stateNode,n=e.type,s=e.memoizedProps;switch(t[gt]=e,t[Lt]=s,n){case"dialog":Oe("cancel",t),Oe("close",t);break;case"iframe":case"object":case"embed":Oe("load",t);break;case"video":case"audio":for(n=0;n<Gl.length;n++)Oe(Gl[n],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),Jd(t,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":Oe("invalid",t);break;case"textarea":Oe("invalid",t),tf(t,s.value,s.defaultValue,s.children)}n=s.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||s.suppressHydrationWarning===!0||ap(t.textContent,n)?(s.popover!=null&&(Oe("beforetoggle",t),Oe("toggle",t)),s.onScroll!=null&&Oe("scroll",t),s.onScrollEnd!=null&&Oe("scrollend",t),s.onClick!=null&&(t.onclick=Tn),t=!0):t=!1,t||Jn(e,!0)}function Ff(e){for(bt=e.return;bt;)switch(bt.tag){case 5:case 31:case 13:en=!1;return;case 27:case 3:en=!0;return;default:bt=bt.return}}function wa(e){if(e!==bt)return!1;if(!He)return Ff(e),He=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||hu(e.type,e.memoizedProps)),n=!n),n&&Xe&&Jn(e),Ff(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));Xe=hp(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));Xe=hp(e)}else t===27?(t=Xe,hi(e.type)?(e=yu,yu=null,Xe=e):Xe=t):Xe=bt?nn(e.stateNode.nextSibling):null;return!0}function Ui(){Xe=bt=null,He=!1}function Qr(){var e=Wn;return e!==null&&(Dt===null?Dt=e:Dt.push.apply(Dt,e),Wn=null),e}function wl(e){Wn===null?Wn=[e]:Wn.push(e)}var Zr=ve(null),Ki=null,Nn=null;function ei(e,t,n){xe(Zr,t._currentValue),t._currentValue=n}function kn(e){e._currentValue=Zr.current,ye(Zr)}function Wr(e,t,n){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===n)break;e=e.return}}function Jr(e,t,n,s){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var d=c.dependencies;if(d!==null){var y=c.child;d=d.firstContext;e:for(;d!==null;){var S=d;d=c;for(var k=0;k<t.length;k++)if(S.context===t[k]){d.lanes|=n,S=d.alternate,S!==null&&(S.lanes|=n),Wr(d.return,n,e),s||(y=null);break e}d=S.next}}else if(c.tag===18){if(y=c.return,y===null)throw Error(o(341));y.lanes|=n,d=y.alternate,d!==null&&(d.lanes|=n),Wr(y,n,e),y=null}else y=c.child;if(y!==null)y.return=c;else for(y=c;y!==null;){if(y===e){y=null;break}if(c=y.sibling,c!==null){c.return=y.return,y=c;break}y=y.return}c=y}}function Sa(e,t,n,s){e=null;for(var c=t,d=!1;c!==null;){if(!d){if((c.flags&524288)!==0)d=!0;else if((c.flags&262144)!==0)break}if(c.tag===10){var y=c.alternate;if(y===null)throw Error(o(387));if(y=y.memoizedProps,y!==null){var S=c.type;Ut(c.pendingProps.value,y.value)||(e!==null?e.push(S):e=[S])}}else if(c===oe.current){if(y=c.alternate,y===null)throw Error(o(387));y.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(Pl):e=[Pl])}c=c.return}e!==null&&Jr(t,e,n,s),t.flags|=262144}function Us(e){for(e=e.firstContext;e!==null;){if(!Ut(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ii(e){Ki=e,Nn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function yt(e){return Gf(Ki,e)}function Ks(e,t){return Ki===null&&Ii(e),Gf(e,t)}function Gf(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Nn===null){if(e===null)throw Error(o(308));Nn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Nn=Nn.next=t;return n}var F0=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,s){e.push(s)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},G0=a.unstable_scheduleCallback,Y0=a.unstable_NormalPriority,lt={$$typeof:j,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ec(){return{controller:new F0,data:new Map,refCount:0}}function Sl(e){e.refCount--,e.refCount===0&&G0(Y0,function(){e.controller.abort()})}var Cl=null,tc=0,Ca=0,Ta=null;function $0(e,t){if(Cl===null){var n=Cl=[];tc=0,Ca=au(),Ta={status:"pending",value:void 0,then:function(s){n.push(s)}}}return tc++,t.then(Yf,Yf),t}function Yf(){if(--tc===0&&Cl!==null){Ta!==null&&(Ta.status="fulfilled");var e=Cl;Cl=null,Ca=0,Ta=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function q0(e,t){var n=[],s={status:"pending",value:null,reason:null,then:function(c){n.push(c)}};return e.then(function(){s.status="fulfilled",s.value=t;for(var c=0;c<n.length;c++)(0,n[c])(t)},function(c){for(s.status="rejected",s.reason=c,c=0;c<n.length;c++)(0,n[c])(void 0)}),s}var $f=E.S;E.S=function(e,t){Nm=St(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&$0(e,t),$f!==null&&$f(e,t)};var Fi=ve(null);function nc(){var e=Fi.current;return e!==null?e:Ve.pooledCache}function Is(e,t){t===null?xe(Fi,Fi.current):xe(Fi,t.pool)}function qf(){var e=nc();return e===null?null:{parent:lt._currentValue,pool:e}}var Ma=Error(o(460)),ic=Error(o(474)),Fs=Error(o(542)),Gs={then:function(){}};function Vf(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Pf(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Tn,Tn),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Qf(e),e;default:if(typeof t.status=="string")t.then(Tn,Tn);else{if(e=Ve,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status="pending",e.then(function(s){if(t.status==="pending"){var c=t;c.status="fulfilled",c.value=s}},function(s){if(t.status==="pending"){var c=t;c.status="rejected",c.reason=s}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Qf(e),e}throw Yi=t,Ma}}function Gi(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Yi=n,Ma):n}}var Yi=null;function Xf(){if(Yi===null)throw Error(o(459));var e=Yi;return Yi=null,e}function Qf(e){if(e===Ma||e===Fs)throw Error(o(483))}var Aa=null,Tl=0;function Ys(e){var t=Tl;return Tl+=1,Aa===null&&(Aa=[]),Pf(Aa,e,t)}function Ml(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function $s(e,t){throw t.$$typeof===w?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Zf(e){function t(B,O){if(e){var K=B.deletions;K===null?(B.deletions=[O],B.flags|=16):K.push(O)}}function n(B,O){if(!e)return null;for(;O!==null;)t(B,O),O=O.sibling;return null}function s(B){for(var O=new Map;B!==null;)B.key!==null?O.set(B.key,B):O.set(B.index,B),B=B.sibling;return O}function c(B,O){return B=An(B,O),B.index=0,B.sibling=null,B}function d(B,O,K){return B.index=K,e?(K=B.alternate,K!==null?(K=K.index,K<O?(B.flags|=67108866,O):K):(B.flags|=67108866,O)):(B.flags|=1048576,O)}function y(B){return e&&B.alternate===null&&(B.flags|=67108866),B}function S(B,O,K,J){return O===null||O.tag!==6?(O=$r(K,B.mode,J),O.return=B,O):(O=c(O,K),O.return=B,O)}function k(B,O,K,J){var Ce=K.type;return Ce===M?Z(B,O,K.props.children,J,K.key):O!==null&&(O.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===z&&Gi(Ce)===O.type)?(O=c(O,K.props),Ml(O,K),O.return=B,O):(O=Hs(K.type,K.key,K.props,null,B.mode,J),Ml(O,K),O.return=B,O)}function I(B,O,K,J){return O===null||O.tag!==4||O.stateNode.containerInfo!==K.containerInfo||O.stateNode.implementation!==K.implementation?(O=qr(K,B.mode,J),O.return=B,O):(O=c(O,K.children||[]),O.return=B,O)}function Z(B,O,K,J,Ce){return O===null||O.tag!==7?(O=Bi(K,B.mode,J,Ce),O.return=B,O):(O=c(O,K),O.return=B,O)}function te(B,O,K){if(typeof O=="string"&&O!==""||typeof O=="number"||typeof O=="bigint")return O=$r(""+O,B.mode,K),O.return=B,O;if(typeof O=="object"&&O!==null){switch(O.$$typeof){case x:return K=Hs(O.type,O.key,O.props,null,B.mode,K),Ml(K,O),K.return=B,K;case T:return O=qr(O,B.mode,K),O.return=B,O;case z:return O=Gi(O),te(B,O,K)}if(F(O)||P(O))return O=Bi(O,B.mode,K,null),O.return=B,O;if(typeof O.then=="function")return te(B,Ys(O),K);if(O.$$typeof===j)return te(B,Ks(B,O),K);$s(B,O)}return null}function G(B,O,K,J){var Ce=O!==null?O.key:null;if(typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint")return Ce!==null?null:S(B,O,""+K,J);if(typeof K=="object"&&K!==null){switch(K.$$typeof){case x:return K.key===Ce?k(B,O,K,J):null;case T:return K.key===Ce?I(B,O,K,J):null;case z:return K=Gi(K),G(B,O,K,J)}if(F(K)||P(K))return Ce!==null?null:Z(B,O,K,J,null);if(typeof K.then=="function")return G(B,O,Ys(K),J);if(K.$$typeof===j)return G(B,O,Ks(B,K),J);$s(B,K)}return null}function $(B,O,K,J,Ce){if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return B=B.get(K)||null,S(O,B,""+J,Ce);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case x:return B=B.get(J.key===null?K:J.key)||null,k(O,B,J,Ce);case T:return B=B.get(J.key===null?K:J.key)||null,I(O,B,J,Ce);case z:return J=Gi(J),$(B,O,K,J,Ce)}if(F(J)||P(J))return B=B.get(K)||null,Z(O,B,J,Ce,null);if(typeof J.then=="function")return $(B,O,K,Ys(J),Ce);if(J.$$typeof===j)return $(B,O,K,Ks(O,J),Ce);$s(O,J)}return null}function he(B,O,K,J){for(var Ce=null,Ue=null,be=O,Re=O=0,ze=null;be!==null&&Re<K.length;Re++){be.index>Re?(ze=be,be=null):ze=be.sibling;var Ke=G(B,be,K[Re],J);if(Ke===null){be===null&&(be=ze);break}e&&be&&Ke.alternate===null&&t(B,be),O=d(Ke,O,Re),Ue===null?Ce=Ke:Ue.sibling=Ke,Ue=Ke,be=ze}if(Re===K.length)return n(B,be),He&&En(B,Re),Ce;if(be===null){for(;Re<K.length;Re++)be=te(B,K[Re],J),be!==null&&(O=d(be,O,Re),Ue===null?Ce=be:Ue.sibling=be,Ue=be);return He&&En(B,Re),Ce}for(be=s(be);Re<K.length;Re++)ze=$(be,B,Re,K[Re],J),ze!==null&&(e&&ze.alternate!==null&&be.delete(ze.key===null?Re:ze.key),O=d(ze,O,Re),Ue===null?Ce=ze:Ue.sibling=ze,Ue=ze);return e&&be.forEach(function(yi){return t(B,yi)}),He&&En(B,Re),Ce}function Te(B,O,K,J){if(K==null)throw Error(o(151));for(var Ce=null,Ue=null,be=O,Re=O=0,ze=null,Ke=K.next();be!==null&&!Ke.done;Re++,Ke=K.next()){be.index>Re?(ze=be,be=null):ze=be.sibling;var yi=G(B,be,Ke.value,J);if(yi===null){be===null&&(be=ze);break}e&&be&&yi.alternate===null&&t(B,be),O=d(yi,O,Re),Ue===null?Ce=yi:Ue.sibling=yi,Ue=yi,be=ze}if(Ke.done)return n(B,be),He&&En(B,Re),Ce;if(be===null){for(;!Ke.done;Re++,Ke=K.next())Ke=te(B,Ke.value,J),Ke!==null&&(O=d(Ke,O,Re),Ue===null?Ce=Ke:Ue.sibling=Ke,Ue=Ke);return He&&En(B,Re),Ce}for(be=s(be);!Ke.done;Re++,Ke=K.next())Ke=$(be,B,Re,Ke.value,J),Ke!==null&&(e&&Ke.alternate!==null&&be.delete(Ke.key===null?Re:Ke.key),O=d(Ke,O,Re),Ue===null?Ce=Ke:Ue.sibling=Ke,Ue=Ke);return e&&be.forEach(function(ix){return t(B,ix)}),He&&En(B,Re),Ce}function qe(B,O,K,J){if(typeof K=="object"&&K!==null&&K.type===M&&K.key===null&&(K=K.props.children),typeof K=="object"&&K!==null){switch(K.$$typeof){case x:e:{for(var Ce=K.key;O!==null;){if(O.key===Ce){if(Ce=K.type,Ce===M){if(O.tag===7){n(B,O.sibling),J=c(O,K.props.children),J.return=B,B=J;break e}}else if(O.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===z&&Gi(Ce)===O.type){n(B,O.sibling),J=c(O,K.props),Ml(J,K),J.return=B,B=J;break e}n(B,O);break}else t(B,O);O=O.sibling}K.type===M?(J=Bi(K.props.children,B.mode,J,K.key),J.return=B,B=J):(J=Hs(K.type,K.key,K.props,null,B.mode,J),Ml(J,K),J.return=B,B=J)}return y(B);case T:e:{for(Ce=K.key;O!==null;){if(O.key===Ce)if(O.tag===4&&O.stateNode.containerInfo===K.containerInfo&&O.stateNode.implementation===K.implementation){n(B,O.sibling),J=c(O,K.children||[]),J.return=B,B=J;break e}else{n(B,O);break}else t(B,O);O=O.sibling}J=qr(K,B.mode,J),J.return=B,B=J}return y(B);case z:return K=Gi(K),qe(B,O,K,J)}if(F(K))return he(B,O,K,J);if(P(K)){if(Ce=P(K),typeof Ce!="function")throw Error(o(150));return K=Ce.call(K),Te(B,O,K,J)}if(typeof K.then=="function")return qe(B,O,Ys(K),J);if(K.$$typeof===j)return qe(B,O,Ks(B,K),J);$s(B,K)}return typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint"?(K=""+K,O!==null&&O.tag===6?(n(B,O.sibling),J=c(O,K),J.return=B,B=J):(n(B,O),J=$r(K,B.mode,J),J.return=B,B=J),y(B)):n(B,O)}return function(B,O,K,J){try{Tl=0;var Ce=qe(B,O,K,J);return Aa=null,Ce}catch(be){if(be===Ma||be===Fs)throw be;var Ue=Kt(29,be,null,B.mode);return Ue.lanes=J,Ue.return=B,Ue}finally{}}}var $i=Zf(!0),Wf=Zf(!1),ti=!1;function ac(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function lc(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 ni(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ii(e,t,n){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(Ie&2)!==0){var c=s.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),s.pending=t,t=zs(e),Df(e,null,n),t}return Ds(e,s,t,n),zs(e)}function Al(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,Fd(e,n)}}function sc(e,t){var n=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,n===s)){var c=null,d=null;if(n=n.firstBaseUpdate,n!==null){do{var y={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};d===null?c=d=y:d=d.next=y,n=n.next}while(n!==null);d===null?c=d=t:d=d.next=t}else c=d=t;n={baseState:s.baseState,firstBaseUpdate:c,lastBaseUpdate:d,shared:s.shared,callbacks:s.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var oc=!1;function El(){if(oc){var e=Ta;if(e!==null)throw e}}function Nl(e,t,n,s){oc=!1;var c=e.updateQueue;ti=!1;var d=c.firstBaseUpdate,y=c.lastBaseUpdate,S=c.shared.pending;if(S!==null){c.shared.pending=null;var k=S,I=k.next;k.next=null,y===null?d=I:y.next=I,y=k;var Z=e.alternate;Z!==null&&(Z=Z.updateQueue,S=Z.lastBaseUpdate,S!==y&&(S===null?Z.firstBaseUpdate=I:S.next=I,Z.lastBaseUpdate=k))}if(d!==null){var te=c.baseState;y=0,Z=I=k=null,S=d;do{var G=S.lane&-536870913,$=G!==S.lane;if($?(De&G)===G:(s&G)===G){G!==0&&G===Ca&&(oc=!0),Z!==null&&(Z=Z.next={lane:0,tag:S.tag,payload:S.payload,callback:null,next:null});e:{var he=e,Te=S;G=t;var qe=n;switch(Te.tag){case 1:if(he=Te.payload,typeof he=="function"){te=he.call(qe,te,G);break e}te=he;break e;case 3:he.flags=he.flags&-65537|128;case 0:if(he=Te.payload,G=typeof he=="function"?he.call(qe,te,G):he,G==null)break e;te=v({},te,G);break e;case 2:ti=!0}}G=S.callback,G!==null&&(e.flags|=64,$&&(e.flags|=8192),$=c.callbacks,$===null?c.callbacks=[G]:$.push(G))}else $={lane:G,tag:S.tag,payload:S.payload,callback:S.callback,next:null},Z===null?(I=Z=$,k=te):Z=Z.next=$,y|=G;if(S=S.next,S===null){if(S=c.shared.pending,S===null)break;$=S,S=$.next,$.next=null,c.lastBaseUpdate=$,c.shared.pending=null}}while(!0);Z===null&&(k=te),c.baseState=k,c.firstBaseUpdate=I,c.lastBaseUpdate=Z,d===null&&(c.shared.lanes=0),ri|=y,e.lanes=y,e.memoizedState=te}}function Jf(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function eh(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Jf(n[e],t)}var Ea=ve(null),qs=ve(0);function th(e,t){e=Bn,xe(qs,e),xe(Ea,t),Bn=e|t.baseLanes}function rc(){xe(qs,Bn),xe(Ea,Ea.current)}function cc(){Bn=qs.current,ye(Ea),ye(qs)}var It=ve(null),tn=null;function ai(e){var t=e.alternate;xe(it,it.current&1),xe(It,e),tn===null&&(t===null||Ea.current!==null||t.memoizedState!==null)&&(tn=e)}function uc(e){xe(it,it.current),xe(It,e),tn===null&&(tn=e)}function nh(e){e.tag===22?(xe(it,it.current),xe(It,e),tn===null&&(tn=e)):li()}function li(){xe(it,it.current),xe(It,It.current)}function Ft(e){ye(It),tn===e&&(tn=null),ye(it)}var it=ve(0);function Vs(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||gu(n)||bu(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Ln=0,Ne=null,Ye=null,st=null,Ps=!1,Na=!1,qi=!1,Xs=0,kl=0,ka=null,V0=0;function tt(){throw Error(o(321))}function dc(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Ut(e[n],t[n]))return!1;return!0}function fc(e,t,n,s,c,d){return Ln=d,Ne=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,E.H=e===null||e.memoizedState===null?Uh:Ec,qi=!1,d=n(s,c),qi=!1,Na&&(d=ah(t,n,s,c)),ih(e),d}function ih(e){E.H=_l;var t=Ye!==null&&Ye.next!==null;if(Ln=0,st=Ye=Ne=null,Ps=!1,kl=0,ka=null,t)throw Error(o(300));e===null||ot||(e=e.dependencies,e!==null&&Us(e)&&(ot=!0))}function ah(e,t,n,s){Ne=e;var c=0;do{if(Na&&(ka=null),kl=0,Na=!1,25<=c)throw Error(o(301));if(c+=1,st=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)}E.H=Kh,d=t(n,s)}while(Na);return d}function P0(){var e=E.H,t=e.useState()[0];return t=typeof t.then=="function"?Ll(t):t,e=e.useState()[0],(Ye!==null?Ye.memoizedState:null)!==e&&(Ne.flags|=1024),t}function hc(){var e=Xs!==0;return Xs=0,e}function mc(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function pc(e){if(Ps){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Ps=!1}Ln=0,st=Ye=Ne=null,Na=!1,kl=Xs=0,ka=null}function At(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return st===null?Ne.memoizedState=st=e:st=st.next=e,st}function at(){if(Ye===null){var e=Ne.alternate;e=e!==null?e.memoizedState:null}else e=Ye.next;var t=st===null?Ne.memoizedState:st.next;if(t!==null)st=t,Ye=e;else{if(e===null)throw Ne.alternate===null?Error(o(467)):Error(o(310));Ye=e,e={memoizedState:Ye.memoizedState,baseState:Ye.baseState,baseQueue:Ye.baseQueue,queue:Ye.queue,next:null},st===null?Ne.memoizedState=st=e:st=st.next=e}return st}function Qs(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ll(e){var t=kl;return kl+=1,ka===null&&(ka=[]),e=Pf(ka,e,t),t=Ne,(st===null?t.memoizedState:st.next)===null&&(t=t.alternate,E.H=t===null||t.memoizedState===null?Uh:Ec),e}function Zs(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Ll(e);if(e.$$typeof===j)return yt(e)}throw Error(o(438,String(e)))}function gc(e){var t=null,n=Ne.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var s=Ne.alternate;s!==null&&(s=s.updateQueue,s!==null&&(s=s.memoCache,s!=null&&(t={data:s.data.map(function(c){return c.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=Qs(),Ne.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),s=0;s<e;s++)n[s]=ee;return t.index++,n}function Rn(e,t){return typeof t=="function"?t(e):t}function Ws(e){var t=at();return bc(t,Ye,e)}function bc(e,t,n){var s=e.queue;if(s===null)throw Error(o(311));s.lastRenderedReducer=n;var c=e.baseQueue,d=s.pending;if(d!==null){if(c!==null){var y=c.next;c.next=d.next,d.next=y}t.baseQueue=c=d,s.pending=null}if(d=e.baseState,c===null)e.memoizedState=d;else{t=c.next;var S=y=null,k=null,I=t,Z=!1;do{var te=I.lane&-536870913;if(te!==I.lane?(De&te)===te:(Ln&te)===te){var G=I.revertLane;if(G===0)k!==null&&(k=k.next={lane:0,revertLane:0,gesture:null,action:I.action,hasEagerState:I.hasEagerState,eagerState:I.eagerState,next:null}),te===Ca&&(Z=!0);else if((Ln&G)===G){I=I.next,G===Ca&&(Z=!0);continue}else te={lane:0,revertLane:I.revertLane,gesture:null,action:I.action,hasEagerState:I.hasEagerState,eagerState:I.eagerState,next:null},k===null?(S=k=te,y=d):k=k.next=te,Ne.lanes|=G,ri|=G;te=I.action,qi&&n(d,te),d=I.hasEagerState?I.eagerState:n(d,te)}else G={lane:te,revertLane:I.revertLane,gesture:I.gesture,action:I.action,hasEagerState:I.hasEagerState,eagerState:I.eagerState,next:null},k===null?(S=k=G,y=d):k=k.next=G,Ne.lanes|=te,ri|=te;I=I.next}while(I!==null&&I!==t);if(k===null?y=d:k.next=S,!Ut(d,e.memoizedState)&&(ot=!0,Z&&(n=Ta,n!==null)))throw n;e.memoizedState=d,e.baseState=y,e.baseQueue=k,s.lastRenderedState=d}return c===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function yc(e){var t=at(),n=t.queue;if(n===null)throw Error(o(311));n.lastRenderedReducer=e;var s=n.dispatch,c=n.pending,d=t.memoizedState;if(c!==null){n.pending=null;var y=c=c.next;do d=e(d,y.action),y=y.next;while(y!==c);Ut(d,t.memoizedState)||(ot=!0),t.memoizedState=d,t.baseQueue===null&&(t.baseState=d),n.lastRenderedState=d}return[d,s]}function lh(e,t,n){var s=Ne,c=at(),d=He;if(d){if(n===void 0)throw Error(o(407));n=n()}else n=t();var y=!Ut((Ye||c).memoizedState,n);if(y&&(c.memoizedState=n,ot=!0),c=c.queue,wc(rh.bind(null,s,c,e),[e]),c.getSnapshot!==t||y||st!==null&&st.memoizedState.tag&1){if(s.flags|=2048,La(9,{destroy:void 0},oh.bind(null,s,c,n,t),null),Ve===null)throw Error(o(349));d||(Ln&127)!==0||sh(s,t,n)}return n}function sh(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Ne.updateQueue,t===null?(t=Qs(),Ne.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function oh(e,t,n,s){t.value=n,t.getSnapshot=s,ch(t)&&uh(e)}function rh(e,t,n){return n(function(){ch(t)&&uh(e)})}function ch(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Ut(e,n)}catch{return!0}}function uh(e){var t=Hi(e,2);t!==null&&zt(t,e,2)}function vc(e){var t=At();if(typeof e=="function"){var n=e;if(e=n(),qi){rn(!0);try{n()}finally{rn(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rn,lastRenderedState:e},t}function dh(e,t,n,s){return e.baseState=n,bc(e,Ye,typeof s=="function"?s:Rn)}function X0(e,t,n,s,c){if(to(e))throw Error(o(485));if(e=t.action,e!==null){var d={payload:c,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(y){d.listeners.push(y)}};E.T!==null?n(!0):d.isTransition=!1,s(d),n=t.pending,n===null?(d.next=t.pending=d,fh(t,d)):(d.next=n.next,t.pending=n.next=d)}}function fh(e,t){var n=t.action,s=t.payload,c=e.state;if(t.isTransition){var d=E.T,y={};E.T=y;try{var S=n(c,s),k=E.S;k!==null&&k(y,S),hh(e,t,S)}catch(I){xc(e,t,I)}finally{d!==null&&y.types!==null&&(d.types=y.types),E.T=d}}else try{d=n(c,s),hh(e,t,d)}catch(I){xc(e,t,I)}}function hh(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(s){mh(e,t,s)},function(s){return xc(e,t,s)}):mh(e,t,n)}function mh(e,t,n){t.status="fulfilled",t.value=n,ph(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,fh(e,n)))}function xc(e,t,n){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do t.status="rejected",t.reason=n,ph(t),t=t.next;while(t!==s)}e.action=null}function ph(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function gh(e,t){return t}function bh(e,t){if(He){var n=Ve.formState;if(n!==null){e:{var s=Ne;if(He){if(Xe){t:{for(var c=Xe,d=en;c.nodeType!==8;){if(!d){c=null;break t}if(c=nn(c.nextSibling),c===null){c=null;break t}}d=c.data,c=d==="F!"||d==="F"?c:null}if(c){Xe=nn(c.nextSibling),s=c.data==="F!";break e}}Jn(s)}s=!1}s&&(t=n[0])}}return n=At(),n.memoizedState=n.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:gh,lastRenderedState:t},n.queue=s,n=zh.bind(null,Ne,s),s.dispatch=n,s=vc(!1),d=Ac.bind(null,Ne,!1,s.queue),s=At(),c={state:t,dispatch:null,action:e,pending:null},s.queue=c,n=X0.bind(null,Ne,c,d,n),c.dispatch=n,s.memoizedState=e,[t,n,!1]}function yh(e){var t=at();return vh(t,Ye,e)}function vh(e,t,n){if(t=bc(e,t,gh)[0],e=Ws(Rn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=Ll(t)}catch(y){throw y===Ma?Fs:y}else s=t;t=at();var c=t.queue,d=c.dispatch;return n!==t.memoizedState&&(Ne.flags|=2048,La(9,{destroy:void 0},Q0.bind(null,c,n),null)),[s,d,e]}function Q0(e,t){e.action=t}function xh(e){var t=at(),n=Ye;if(n!==null)return vh(t,n,e);at(),t=t.memoizedState,n=at();var s=n.queue.dispatch;return n.memoizedState=e,[t,s,!1]}function La(e,t,n,s){return e={tag:e,create:n,deps:s,inst:t,next:null},t=Ne.updateQueue,t===null&&(t=Qs(),Ne.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(s=n.next,n.next=e,e.next=s,t.lastEffect=e),e}function wh(){return at().memoizedState}function Js(e,t,n,s){var c=At();Ne.flags|=e,c.memoizedState=La(1|t,{destroy:void 0},n,s===void 0?null:s)}function eo(e,t,n,s){var c=at();s=s===void 0?null:s;var d=c.memoizedState.inst;Ye!==null&&s!==null&&dc(s,Ye.memoizedState.deps)?c.memoizedState=La(t,d,n,s):(Ne.flags|=e,c.memoizedState=La(1|t,d,n,s))}function Sh(e,t){Js(8390656,8,e,t)}function wc(e,t){eo(2048,8,e,t)}function Z0(e){Ne.flags|=4;var t=Ne.updateQueue;if(t===null)t=Qs(),Ne.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Ch(e){var t=at().memoizedState;return Z0({ref:t,nextImpl:e}),function(){if((Ie&2)!==0)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function Th(e,t){return eo(4,2,e,t)}function Mh(e,t){return eo(4,4,e,t)}function Ah(e,t){if(typeof t=="function"){e=e();var n=t(e);return function(){typeof n=="function"?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Eh(e,t,n){n=n!=null?n.concat([e]):null,eo(4,4,Ah.bind(null,t,e),n)}function Sc(){}function Nh(e,t){var n=at();t=t===void 0?null:t;var s=n.memoizedState;return t!==null&&dc(t,s[1])?s[0]:(n.memoizedState=[e,t],e)}function kh(e,t){var n=at();t=t===void 0?null:t;var s=n.memoizedState;if(t!==null&&dc(t,s[1]))return s[0];if(s=e(),qi){rn(!0);try{e()}finally{rn(!1)}}return n.memoizedState=[s,t],s}function Cc(e,t,n){return n===void 0||(Ln&1073741824)!==0&&(De&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=Lm(),Ne.lanes|=e,ri|=e,n)}function Lh(e,t,n,s){return Ut(n,t)?n:Ea.current!==null?(e=Cc(e,n,s),Ut(e,t)||(ot=!0),e):(Ln&42)===0||(Ln&1073741824)!==0&&(De&261930)===0?(ot=!0,e.memoizedState=n):(e=Lm(),Ne.lanes|=e,ri|=e,t)}function Rh(e,t,n,s,c){var d=Y.p;Y.p=d!==0&&8>d?d:8;var y=E.T,S={};E.T=S,Ac(e,!1,t,n);try{var k=c(),I=E.S;if(I!==null&&I(S,k),k!==null&&typeof k=="object"&&typeof k.then=="function"){var Z=q0(k,s);Rl(e,t,Z,$t(e))}else Rl(e,t,s,$t(e))}catch(te){Rl(e,t,{then:function(){},status:"rejected",reason:te},$t())}finally{Y.p=d,y!==null&&S.types!==null&&(y.types=S.types),E.T=y}}function W0(){}function Tc(e,t,n,s){if(e.tag!==5)throw Error(o(476));var c=_h(e).queue;Rh(e,c,t,X,n===null?W0:function(){return jh(e),n(s)})}function _h(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:X,baseState:X,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rn,lastRenderedState:X},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rn,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function jh(e){var t=_h(e);t.next===null&&(t=e.alternate.memoizedState),Rl(e,t.next.queue,{},$t())}function Mc(){return yt(Pl)}function Oh(){return at().memoizedState}function Dh(){return at().memoizedState}function J0(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=$t();e=ni(n);var s=ii(t,e,n);s!==null&&(zt(s,t,n),Al(s,t,n)),t={cache:ec()},e.payload=t;return}t=t.return}}function ev(e,t,n){var s=$t();n={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},to(e)?Hh(t,n):(n=Gr(e,t,n,s),n!==null&&(zt(n,e,s),Bh(n,t,s)))}function zh(e,t,n){var s=$t();Rl(e,t,n,s)}function Rl(e,t,n,s){var c={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(to(e))Hh(t,c);else{var d=e.alternate;if(e.lanes===0&&(d===null||d.lanes===0)&&(d=t.lastRenderedReducer,d!==null))try{var y=t.lastRenderedState,S=d(y,n);if(c.hasEagerState=!0,c.eagerState=S,Ut(S,y))return Ds(e,t,c,0),Ve===null&&Os(),!1}catch{}finally{}if(n=Gr(e,t,c,s),n!==null)return zt(n,e,s),Bh(n,t,s),!0}return!1}function Ac(e,t,n,s){if(s={lane:2,revertLane:au(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},to(e)){if(t)throw Error(o(479))}else t=Gr(e,n,s,2),t!==null&&zt(t,e,2)}function to(e){var t=e.alternate;return e===Ne||t!==null&&t===Ne}function Hh(e,t){Na=Ps=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Bh(e,t,n){if((n&4194048)!==0){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,Fd(e,n)}}var _l={readContext:yt,use:Zs,useCallback:tt,useContext:tt,useEffect:tt,useImperativeHandle:tt,useLayoutEffect:tt,useInsertionEffect:tt,useMemo:tt,useReducer:tt,useRef:tt,useState:tt,useDebugValue:tt,useDeferredValue:tt,useTransition:tt,useSyncExternalStore:tt,useId:tt,useHostTransitionStatus:tt,useFormState:tt,useActionState:tt,useOptimistic:tt,useMemoCache:tt,useCacheRefresh:tt};_l.useEffectEvent=tt;var Uh={readContext:yt,use:Zs,useCallback:function(e,t){return At().memoizedState=[e,t===void 0?null:t],e},useContext:yt,useEffect:Sh,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,Js(4194308,4,Ah.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Js(4194308,4,e,t)},useInsertionEffect:function(e,t){Js(4,2,e,t)},useMemo:function(e,t){var n=At();t=t===void 0?null:t;var s=e();if(qi){rn(!0);try{e()}finally{rn(!1)}}return n.memoizedState=[s,t],s},useReducer:function(e,t,n){var s=At();if(n!==void 0){var c=n(t);if(qi){rn(!0);try{n(t)}finally{rn(!1)}}}else c=t;return s.memoizedState=s.baseState=c,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:c},s.queue=e,e=e.dispatch=ev.bind(null,Ne,e),[s.memoizedState,e]},useRef:function(e){var t=At();return e={current:e},t.memoizedState=e},useState:function(e){e=vc(e);var t=e.queue,n=zh.bind(null,Ne,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Sc,useDeferredValue:function(e,t){var n=At();return Cc(n,e,t)},useTransition:function(){var e=vc(!1);return e=Rh.bind(null,Ne,e.queue,!0,!1),At().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var s=Ne,c=At();if(He){if(n===void 0)throw Error(o(407));n=n()}else{if(n=t(),Ve===null)throw Error(o(349));(De&127)!==0||sh(s,t,n)}c.memoizedState=n;var d={value:n,getSnapshot:t};return c.queue=d,Sh(rh.bind(null,s,d,e),[e]),s.flags|=2048,La(9,{destroy:void 0},oh.bind(null,s,d,n,t),null),n},useId:function(){var e=At(),t=Ve.identifierPrefix;if(He){var n=pn,s=mn;n=(s&~(1<<32-Ct(s)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Xs++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=V0++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Mc,useFormState:bh,useActionState:bh,useOptimistic:function(e){var t=At();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Ac.bind(null,Ne,!0,n),n.dispatch=t,[e,t]},useMemoCache:gc,useCacheRefresh:function(){return At().memoizedState=J0.bind(null,Ne)},useEffectEvent:function(e){var t=At(),n={impl:e};return t.memoizedState=n,function(){if((Ie&2)!==0)throw Error(o(440));return n.impl.apply(void 0,arguments)}}},Ec={readContext:yt,use:Zs,useCallback:Nh,useContext:yt,useEffect:wc,useImperativeHandle:Eh,useInsertionEffect:Th,useLayoutEffect:Mh,useMemo:kh,useReducer:Ws,useRef:wh,useState:function(){return Ws(Rn)},useDebugValue:Sc,useDeferredValue:function(e,t){var n=at();return Lh(n,Ye.memoizedState,e,t)},useTransition:function(){var e=Ws(Rn)[0],t=at().memoizedState;return[typeof e=="boolean"?e:Ll(e),t]},useSyncExternalStore:lh,useId:Oh,useHostTransitionStatus:Mc,useFormState:yh,useActionState:yh,useOptimistic:function(e,t){var n=at();return dh(n,Ye,e,t)},useMemoCache:gc,useCacheRefresh:Dh};Ec.useEffectEvent=Ch;var Kh={readContext:yt,use:Zs,useCallback:Nh,useContext:yt,useEffect:wc,useImperativeHandle:Eh,useInsertionEffect:Th,useLayoutEffect:Mh,useMemo:kh,useReducer:yc,useRef:wh,useState:function(){return yc(Rn)},useDebugValue:Sc,useDeferredValue:function(e,t){var n=at();return Ye===null?Cc(n,e,t):Lh(n,Ye.memoizedState,e,t)},useTransition:function(){var e=yc(Rn)[0],t=at().memoizedState;return[typeof e=="boolean"?e:Ll(e),t]},useSyncExternalStore:lh,useId:Oh,useHostTransitionStatus:Mc,useFormState:xh,useActionState:xh,useOptimistic:function(e,t){var n=at();return Ye!==null?dh(n,Ye,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:gc,useCacheRefresh:Dh};Kh.useEffectEvent=Ch;function Nc(e,t,n,s){t=e.memoizedState,n=n(s,t),n=n==null?t:v({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var kc={enqueueSetState:function(e,t,n){e=e._reactInternals;var s=$t(),c=ni(s);c.payload=t,n!=null&&(c.callback=n),t=ii(e,c,s),t!==null&&(zt(t,e,s),Al(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var s=$t(),c=ni(s);c.tag=1,c.payload=t,n!=null&&(c.callback=n),t=ii(e,c,s),t!==null&&(zt(t,e,s),Al(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=$t(),s=ni(n);s.tag=2,t!=null&&(s.callback=t),t=ii(e,s,n),t!==null&&(zt(t,e,n),Al(t,e,n))}};function Ih(e,t,n,s,c,d,y){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,d,y):t.prototype&&t.prototype.isPureReactComponent?!yl(n,s)||!yl(c,d):!0}function Fh(e,t,n,s){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,s),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,s),t.state!==e&&kc.enqueueReplaceState(t,t.state,null)}function Vi(e,t){var n=t;if("ref"in t){n={};for(var s in t)s!=="ref"&&(n[s]=t[s])}if(e=e.defaultProps){n===t&&(n=v({},n));for(var c in e)n[c]===void 0&&(n[c]=e[c])}return n}function Gh(e){js(e)}function Yh(e){console.error(e)}function $h(e){js(e)}function no(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function qh(e,t,n){try{var s=e.onCaughtError;s(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(c){setTimeout(function(){throw c})}}function Lc(e,t,n){return n=ni(n),n.tag=3,n.payload={element:null},n.callback=function(){no(e,t)},n}function Vh(e){return e=ni(e),e.tag=3,e}function Ph(e,t,n,s){var c=n.type.getDerivedStateFromError;if(typeof c=="function"){var d=s.value;e.payload=function(){return c(d)},e.callback=function(){qh(t,n,s)}}var y=n.stateNode;y!==null&&typeof y.componentDidCatch=="function"&&(e.callback=function(){qh(t,n,s),typeof c!="function"&&(ci===null?ci=new Set([this]):ci.add(this));var S=s.stack;this.componentDidCatch(s.value,{componentStack:S!==null?S:""})})}function tv(e,t,n,s,c){if(n.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=n.alternate,t!==null&&Sa(t,n,c,!0),n=It.current,n!==null){switch(n.tag){case 31:case 13:return tn===null?po():n.alternate===null&&nt===0&&(nt=3),n.flags&=-257,n.flags|=65536,n.lanes=c,s===Gs?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([s]):t.add(s),tu(e,s,c)),!1;case 22:return n.flags|=65536,s===Gs?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([s])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([s]):n.add(s)),tu(e,s,c)),!1}throw Error(o(435,n.tag))}return tu(e,s,c),po(),!1}if(He)return t=It.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,s!==Xr&&(e=Error(o(422),{cause:s}),wl(Zt(e,n)))):(s!==Xr&&(t=Error(o(423),{cause:s}),wl(Zt(t,n))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,s=Zt(s,n),c=Lc(e.stateNode,s,c),sc(e,c),nt!==4&&(nt=2)),!1;var d=Error(o(520),{cause:s});if(d=Zt(d,n),Kl===null?Kl=[d]:Kl.push(d),nt!==4&&(nt=2),t===null)return!0;s=Zt(s,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=c&-c,n.lanes|=e,e=Lc(n.stateNode,s,e),sc(n,e),!1;case 1:if(t=n.type,d=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||d!==null&&typeof d.componentDidCatch=="function"&&(ci===null||!ci.has(d))))return n.flags|=65536,c&=-c,n.lanes|=c,c=Vh(c),Ph(c,e,n,s),sc(n,c),!1}n=n.return}while(n!==null);return!1}var Rc=Error(o(461)),ot=!1;function vt(e,t,n,s){t.child=e===null?Wf(t,null,n,s):$i(t,e.child,n,s)}function Xh(e,t,n,s,c){n=n.render;var d=t.ref;if("ref"in s){var y={};for(var S in s)S!=="ref"&&(y[S]=s[S])}else y=s;return Ii(t),s=fc(e,t,n,y,d,c),S=hc(),e!==null&&!ot?(mc(e,t,c),_n(e,t,c)):(He&&S&&Vr(t),t.flags|=1,vt(e,t,s,c),t.child)}function Qh(e,t,n,s,c){if(e===null){var d=n.type;return typeof d=="function"&&!Yr(d)&&d.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=d,Zh(e,t,d,s,c)):(e=Hs(n.type,null,s,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(d=e.child,!Uc(e,c)){var y=d.memoizedProps;if(n=n.compare,n=n!==null?n:yl,n(y,s)&&e.ref===t.ref)return _n(e,t,c)}return t.flags|=1,e=An(d,s),e.ref=t.ref,e.return=t,t.child=e}function Zh(e,t,n,s,c){if(e!==null){var d=e.memoizedProps;if(yl(d,s)&&e.ref===t.ref)if(ot=!1,t.pendingProps=s=d,Uc(e,c))(e.flags&131072)!==0&&(ot=!0);else return t.lanes=e.lanes,_n(e,t,c)}return _c(e,t,n,s,c)}function Wh(e,t,n,s){var c=s.children,d=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.mode==="hidden"){if((t.flags&128)!==0){if(d=d!==null?d.baseLanes|n:n,e!==null){for(s=t.child=e.child,c=0;s!==null;)c=c|s.lanes|s.childLanes,s=s.sibling;s=c&~d}else s=0,t.child=null;return Jh(e,t,d,n,s)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Is(t,d!==null?d.cachePool:null),d!==null?th(t,d):rc(),nh(t);else return s=t.lanes=536870912,Jh(e,t,d!==null?d.baseLanes|n:n,n,s)}else d!==null?(Is(t,d.cachePool),th(t,d),li(),t.memoizedState=null):(e!==null&&Is(t,null),rc(),li());return vt(e,t,c,n),t.child}function jl(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Jh(e,t,n,s,c){var d=nc();return d=d===null?null:{parent:lt._currentValue,pool:d},t.memoizedState={baseLanes:n,cachePool:d},e!==null&&Is(t,null),rc(),nh(t),e!==null&&Sa(e,t,s,!0),t.childLanes=c,null}function io(e,t){return t=lo({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function em(e,t,n){return $i(t,e.child,null,n),e=io(t,t.pendingProps),e.flags|=2,Ft(t),t.memoizedState=null,e}function nv(e,t,n){var s=t.pendingProps,c=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(He){if(s.mode==="hidden")return e=io(t,s),t.lanes=536870912,jl(null,e);if(uc(t),(e=Xe)?(e=fp(e,en),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Zn!==null?{id:mn,overflow:pn}:null,retryLane:536870912,hydrationErrors:null},n=Hf(e),n.return=t,t.child=n,bt=t,Xe=null)):e=null,e===null)throw Jn(t);return t.lanes=536870912,null}return io(t,s)}var d=e.memoizedState;if(d!==null){var y=d.dehydrated;if(uc(t),c)if(t.flags&256)t.flags&=-257,t=em(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558));else if(ot||Sa(e,t,n,!1),c=(n&e.childLanes)!==0,ot||c){if(s=Ve,s!==null&&(y=Gd(s,n),y!==0&&y!==d.retryLane))throw d.retryLane=y,Hi(e,y),zt(s,e,y),Rc;po(),t=em(e,t,n)}else e=d.treeContext,Xe=nn(y.nextSibling),bt=t,He=!0,Wn=null,en=!1,e!==null&&Kf(t,e),t=io(t,s),t.flags|=4096;return t}return e=An(e.child,{mode:s.mode,children:s.children}),e.ref=t.ref,t.child=e,e.return=t,e}function ao(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!="function"&&typeof n!="object")throw Error(o(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function _c(e,t,n,s,c){return Ii(t),n=fc(e,t,n,s,void 0,c),s=hc(),e!==null&&!ot?(mc(e,t,c),_n(e,t,c)):(He&&s&&Vr(t),t.flags|=1,vt(e,t,n,c),t.child)}function tm(e,t,n,s,c,d){return Ii(t),t.updateQueue=null,n=ah(t,s,n,c),ih(e),s=hc(),e!==null&&!ot?(mc(e,t,d),_n(e,t,d)):(He&&s&&Vr(t),t.flags|=1,vt(e,t,n,d),t.child)}function nm(e,t,n,s,c){if(Ii(t),t.stateNode===null){var d=ya,y=n.contextType;typeof y=="object"&&y!==null&&(d=yt(y)),d=new n(s,d),t.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,d.updater=kc,t.stateNode=d,d._reactInternals=t,d=t.stateNode,d.props=s,d.state=t.memoizedState,d.refs={},ac(t),y=n.contextType,d.context=typeof y=="object"&&y!==null?yt(y):ya,d.state=t.memoizedState,y=n.getDerivedStateFromProps,typeof y=="function"&&(Nc(t,n,y,s),d.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof d.getSnapshotBeforeUpdate=="function"||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(y=d.state,typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount(),y!==d.state&&kc.enqueueReplaceState(d,d.state,null),Nl(t,s,d,c),El(),d.state=t.memoizedState),typeof d.componentDidMount=="function"&&(t.flags|=4194308),s=!0}else if(e===null){d=t.stateNode;var S=t.memoizedProps,k=Vi(n,S);d.props=k;var I=d.context,Z=n.contextType;y=ya,typeof Z=="object"&&Z!==null&&(y=yt(Z));var te=n.getDerivedStateFromProps;Z=typeof te=="function"||typeof d.getSnapshotBeforeUpdate=="function",S=t.pendingProps!==S,Z||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(S||I!==y)&&Fh(t,d,s,y),ti=!1;var G=t.memoizedState;d.state=G,Nl(t,s,d,c),El(),I=t.memoizedState,S||G!==I||ti?(typeof te=="function"&&(Nc(t,n,te,s),I=t.memoizedState),(k=ti||Ih(t,n,k,s,G,I,y))?(Z||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=s,t.memoizedState=I),d.props=s,d.state=I,d.context=y,s=k):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{d=t.stateNode,lc(e,t),y=t.memoizedProps,Z=Vi(n,y),d.props=Z,te=t.pendingProps,G=d.context,I=n.contextType,k=ya,typeof I=="object"&&I!==null&&(k=yt(I)),S=n.getDerivedStateFromProps,(I=typeof S=="function"||typeof d.getSnapshotBeforeUpdate=="function")||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(y!==te||G!==k)&&Fh(t,d,s,k),ti=!1,G=t.memoizedState,d.state=G,Nl(t,s,d,c),El();var $=t.memoizedState;y!==te||G!==$||ti||e!==null&&e.dependencies!==null&&Us(e.dependencies)?(typeof S=="function"&&(Nc(t,n,S,s),$=t.memoizedState),(Z=ti||Ih(t,n,Z,s,G,$,k)||e!==null&&e.dependencies!==null&&Us(e.dependencies))?(I||typeof d.UNSAFE_componentWillUpdate!="function"&&typeof d.componentWillUpdate!="function"||(typeof d.componentWillUpdate=="function"&&d.componentWillUpdate(s,$,k),typeof d.UNSAFE_componentWillUpdate=="function"&&d.UNSAFE_componentWillUpdate(s,$,k)),typeof d.componentDidUpdate=="function"&&(t.flags|=4),typeof d.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof d.componentDidUpdate!="function"||y===e.memoizedProps&&G===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&G===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=$),d.props=s,d.state=$,d.context=k,s=Z):(typeof d.componentDidUpdate!="function"||y===e.memoizedProps&&G===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&G===e.memoizedState||(t.flags|=1024),s=!1)}return d=s,ao(e,t),s=(t.flags&128)!==0,d||s?(d=t.stateNode,n=s&&typeof n.getDerivedStateFromError!="function"?null:d.render(),t.flags|=1,e!==null&&s?(t.child=$i(t,e.child,null,c),t.child=$i(t,null,n,c)):vt(e,t,n,c),t.memoizedState=d.state,e=t.child):e=_n(e,t,c),e}function im(e,t,n,s){return Ui(),t.flags|=256,vt(e,t,n,s),t.child}var jc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Oc(e){return{baseLanes:e,cachePool:qf()}}function Dc(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Yt),e}function am(e,t,n){var s=t.pendingProps,c=!1,d=(t.flags&128)!==0,y;if((y=d)||(y=e!==null&&e.memoizedState===null?!1:(it.current&2)!==0),y&&(c=!0,t.flags&=-129),y=(t.flags&32)!==0,t.flags&=-33,e===null){if(He){if(c?ai(t):li(),(e=Xe)?(e=fp(e,en),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Zn!==null?{id:mn,overflow:pn}:null,retryLane:536870912,hydrationErrors:null},n=Hf(e),n.return=t,t.child=n,bt=t,Xe=null)):e=null,e===null)throw Jn(t);return bu(e)?t.lanes=32:t.lanes=536870912,null}var S=s.children;return s=s.fallback,c?(li(),c=t.mode,S=lo({mode:"hidden",children:S},c),s=Bi(s,c,n,null),S.return=t,s.return=t,S.sibling=s,t.child=S,s=t.child,s.memoizedState=Oc(n),s.childLanes=Dc(e,y,n),t.memoizedState=jc,jl(null,s)):(ai(t),zc(t,S))}var k=e.memoizedState;if(k!==null&&(S=k.dehydrated,S!==null)){if(d)t.flags&256?(ai(t),t.flags&=-257,t=Hc(e,t,n)):t.memoizedState!==null?(li(),t.child=e.child,t.flags|=128,t=null):(li(),S=s.fallback,c=t.mode,s=lo({mode:"visible",children:s.children},c),S=Bi(S,c,n,null),S.flags|=2,s.return=t,S.return=t,s.sibling=S,t.child=s,$i(t,e.child,null,n),s=t.child,s.memoizedState=Oc(n),s.childLanes=Dc(e,y,n),t.memoizedState=jc,t=jl(null,s));else if(ai(t),bu(S)){if(y=S.nextSibling&&S.nextSibling.dataset,y)var I=y.dgst;y=I,s=Error(o(419)),s.stack="",s.digest=y,wl({value:s,source:null,stack:null}),t=Hc(e,t,n)}else if(ot||Sa(e,t,n,!1),y=(n&e.childLanes)!==0,ot||y){if(y=Ve,y!==null&&(s=Gd(y,n),s!==0&&s!==k.retryLane))throw k.retryLane=s,Hi(e,s),zt(y,e,s),Rc;gu(S)||po(),t=Hc(e,t,n)}else gu(S)?(t.flags|=192,t.child=e.child,t=null):(e=k.treeContext,Xe=nn(S.nextSibling),bt=t,He=!0,Wn=null,en=!1,e!==null&&Kf(t,e),t=zc(t,s.children),t.flags|=4096);return t}return c?(li(),S=s.fallback,c=t.mode,k=e.child,I=k.sibling,s=An(k,{mode:"hidden",children:s.children}),s.subtreeFlags=k.subtreeFlags&65011712,I!==null?S=An(I,S):(S=Bi(S,c,n,null),S.flags|=2),S.return=t,s.return=t,s.sibling=S,t.child=s,jl(null,s),s=t.child,S=e.child.memoizedState,S===null?S=Oc(n):(c=S.cachePool,c!==null?(k=lt._currentValue,c=c.parent!==k?{parent:k,pool:k}:c):c=qf(),S={baseLanes:S.baseLanes|n,cachePool:c}),s.memoizedState=S,s.childLanes=Dc(e,y,n),t.memoizedState=jc,jl(e.child,s)):(ai(t),n=e.child,e=n.sibling,n=An(n,{mode:"visible",children:s.children}),n.return=t,n.sibling=null,e!==null&&(y=t.deletions,y===null?(t.deletions=[e],t.flags|=16):y.push(e)),t.child=n,t.memoizedState=null,n)}function zc(e,t){return t=lo({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function lo(e,t){return e=Kt(22,e,null,t),e.lanes=0,e}function Hc(e,t,n){return $i(t,e.child,null,n),e=zc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function lm(e,t,n){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),Wr(e.return,t,n)}function Bc(e,t,n,s,c,d){var y=e.memoizedState;y===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:n,tailMode:c,treeForkCount:d}:(y.isBackwards=t,y.rendering=null,y.renderingStartTime=0,y.last=s,y.tail=n,y.tailMode=c,y.treeForkCount=d)}function sm(e,t,n){var s=t.pendingProps,c=s.revealOrder,d=s.tail;s=s.children;var y=it.current,S=(y&2)!==0;if(S?(y=y&1|2,t.flags|=128):y&=1,xe(it,y),vt(e,t,s,n),s=He?xl:0,!S&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&lm(e,n,t);else if(e.tag===19)lm(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(c){case"forwards":for(n=t.child,c=null;n!==null;)e=n.alternate,e!==null&&Vs(e)===null&&(c=n),n=n.sibling;n=c,n===null?(c=t.child,t.child=null):(c=n.sibling,n.sibling=null),Bc(t,!1,c,n,d,s);break;case"backwards":case"unstable_legacy-backwards":for(n=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&Vs(e)===null){t.child=c;break}e=c.sibling,c.sibling=n,n=c,c=e}Bc(t,!0,n,null,d,s);break;case"together":Bc(t,!1,null,null,void 0,s);break;default:t.memoizedState=null}return t.child}function _n(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),ri|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Sa(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,n=An(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=An(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Uc(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Us(e)))}function iv(e,t,n){switch(t.tag){case 3:Se(t,t.stateNode.containerInfo),ei(t,lt,e.memoizedState.cache),Ui();break;case 27:case 5:pe(t);break;case 4:Se(t,t.stateNode.containerInfo);break;case 10:ei(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,uc(t),null;break;case 13:var s=t.memoizedState;if(s!==null)return s.dehydrated!==null?(ai(t),t.flags|=128,null):(n&t.child.childLanes)!==0?am(e,t,n):(ai(t),e=_n(e,t,n),e!==null?e.sibling:null);ai(t);break;case 19:var c=(e.flags&128)!==0;if(s=(n&t.childLanes)!==0,s||(Sa(e,t,n,!1),s=(n&t.childLanes)!==0),c){if(s)return sm(e,t,n);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),xe(it,it.current),s)break;return null;case 22:return t.lanes=0,Wh(e,t,n,t.pendingProps);case 24:ei(t,lt,e.memoizedState.cache)}return _n(e,t,n)}function om(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)ot=!0;else{if(!Uc(e,n)&&(t.flags&128)===0)return ot=!1,iv(e,t,n);ot=(e.flags&131072)!==0}else ot=!1,He&&(t.flags&1048576)!==0&&Uf(t,xl,t.index);switch(t.lanes=0,t.tag){case 16:e:{var s=t.pendingProps;if(e=Gi(t.elementType),t.type=e,typeof e=="function")Yr(e)?(s=Vi(e,s),t.tag=1,t=nm(null,t,e,s,n)):(t.tag=0,t=_c(null,t,e,s,n));else{if(e!=null){var c=e.$$typeof;if(c===V){t.tag=11,t=Xh(null,t,e,s,n);break e}else if(c===L){t.tag=14,t=Qh(null,t,e,s,n);break e}}throw t=ae(e)||e,Error(o(306,t,""))}}return t;case 0:return _c(e,t,t.type,t.pendingProps,n);case 1:return s=t.type,c=Vi(s,t.pendingProps),nm(e,t,s,c,n);case 3:e:{if(Se(t,t.stateNode.containerInfo),e===null)throw Error(o(387));s=t.pendingProps;var d=t.memoizedState;c=d.element,lc(e,t),Nl(t,s,null,n);var y=t.memoizedState;if(s=y.cache,ei(t,lt,s),s!==d.cache&&Jr(t,[lt],n,!0),El(),s=y.element,d.isDehydrated)if(d={element:s,isDehydrated:!1,cache:y.cache},t.updateQueue.baseState=d,t.memoizedState=d,t.flags&256){t=im(e,t,s,n);break e}else if(s!==c){c=Zt(Error(o(424)),t),wl(c),t=im(e,t,s,n);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Xe=nn(e.firstChild),bt=t,He=!0,Wn=null,en=!0,n=Wf(t,null,s,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ui(),s===c){t=_n(e,t,n);break e}vt(e,t,s,n)}t=t.child}return t;case 26:return ao(e,t),e===null?(n=yp(t.type,null,t.pendingProps,null))?t.memoizedState=n:He||(n=t.type,e=t.pendingProps,s=So(we.current).createElement(n),s[gt]=t,s[Lt]=e,xt(s,n,e),ht(s),t.stateNode=s):t.memoizedState=yp(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return pe(t),e===null&&He&&(s=t.stateNode=pp(t.type,t.pendingProps,we.current),bt=t,en=!0,c=Xe,hi(t.type)?(yu=c,Xe=nn(s.firstChild)):Xe=c),vt(e,t,t.pendingProps.children,n),ao(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&He&&((c=s=Xe)&&(s=jv(s,t.type,t.pendingProps,en),s!==null?(t.stateNode=s,bt=t,Xe=nn(s.firstChild),en=!1,c=!0):c=!1),c||Jn(t)),pe(t),c=t.type,d=t.pendingProps,y=e!==null?e.memoizedProps:null,s=d.children,hu(c,d)?s=null:y!==null&&hu(c,y)&&(t.flags|=32),t.memoizedState!==null&&(c=fc(e,t,P0,null,null,n),Pl._currentValue=c),ao(e,t),vt(e,t,s,n),t.child;case 6:return e===null&&He&&((e=n=Xe)&&(n=Ov(n,t.pendingProps,en),n!==null?(t.stateNode=n,bt=t,Xe=null,e=!0):e=!1),e||Jn(t)),null;case 13:return am(e,t,n);case 4:return Se(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=$i(t,null,s,n):vt(e,t,s,n),t.child;case 11:return Xh(e,t,t.type,t.pendingProps,n);case 7:return vt(e,t,t.pendingProps,n),t.child;case 8:return vt(e,t,t.pendingProps.children,n),t.child;case 12:return vt(e,t,t.pendingProps.children,n),t.child;case 10:return s=t.pendingProps,ei(t,t.type,s.value),vt(e,t,s.children,n),t.child;case 9:return c=t.type._context,s=t.pendingProps.children,Ii(t),c=yt(c),s=s(c),t.flags|=1,vt(e,t,s,n),t.child;case 14:return Qh(e,t,t.type,t.pendingProps,n);case 15:return Zh(e,t,t.type,t.pendingProps,n);case 19:return sm(e,t,n);case 31:return nv(e,t,n);case 22:return Wh(e,t,n,t.pendingProps);case 24:return Ii(t),s=yt(lt),e===null?(c=nc(),c===null&&(c=Ve,d=ec(),c.pooledCache=d,d.refCount++,d!==null&&(c.pooledCacheLanes|=n),c=d),t.memoizedState={parent:s,cache:c},ac(t),ei(t,lt,c)):((e.lanes&n)!==0&&(lc(e,t),Nl(t,null,null,n),El()),c=e.memoizedState,d=t.memoizedState,c.parent!==s?(c={parent:s,cache:s},t.memoizedState=c,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=c),ei(t,lt,s)):(s=d.cache,ei(t,lt,s),s!==c.cache&&Jr(t,[lt],n,!0))),vt(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function jn(e){e.flags|=4}function Kc(e,t,n,s,c){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(c&335544128)===c)if(e.stateNode.complete)e.flags|=8192;else if(Om())e.flags|=8192;else throw Yi=Gs,ic}else e.flags&=-16777217}function rm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Cp(t))if(Om())e.flags|=8192;else throw Yi=Gs,ic}function so(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Kd():536870912,e.lanes|=t,Oa|=t)}function Ol(e,t){if(!He)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var s=null;n!==null;)n.alternate!==null&&(s=n),n=n.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function Qe(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,s=0;if(t)for(var c=e.child;c!==null;)n|=c.lanes|c.childLanes,s|=c.subtreeFlags&65011712,s|=c.flags&65011712,c.return=e,c=c.sibling;else for(c=e.child;c!==null;)n|=c.lanes|c.childLanes,s|=c.subtreeFlags,s|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=s,e.childLanes=n,t}function av(e,t,n){var s=t.pendingProps;switch(Pr(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Qe(t),null;case 1:return Qe(t),null;case 3:return n=t.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),kn(lt),se(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(wa(t)?jn(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Qr())),Qe(t),null;case 26:var c=t.type,d=t.memoizedState;return e===null?(jn(t),d!==null?(Qe(t),rm(t,d)):(Qe(t),Kc(t,c,null,s,n))):d?d!==e.memoizedState?(jn(t),Qe(t),rm(t,d)):(Qe(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&jn(t),Qe(t),Kc(t,c,e,s,n)),null;case 27:if(Ee(t),n=we.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&jn(t);else{if(!s){if(t.stateNode===null)throw Error(o(166));return Qe(t),null}e=me.current,wa(t)?If(t):(e=pp(c,s,n),t.stateNode=e,jn(t))}return Qe(t),null;case 5:if(Ee(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&jn(t);else{if(!s){if(t.stateNode===null)throw Error(o(166));return Qe(t),null}if(d=me.current,wa(t))If(t);else{var y=So(we.current);switch(d){case 1:d=y.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:d=y.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":d=y.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":d=y.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":d=y.createElement("div"),d.innerHTML="<script><\/script>",d=d.removeChild(d.firstChild);break;case"select":d=typeof s.is=="string"?y.createElement("select",{is:s.is}):y.createElement("select"),s.multiple?d.multiple=!0:s.size&&(d.size=s.size);break;default:d=typeof s.is=="string"?y.createElement(c,{is:s.is}):y.createElement(c)}}d[gt]=t,d[Lt]=s;e:for(y=t.child;y!==null;){if(y.tag===5||y.tag===6)d.appendChild(y.stateNode);else if(y.tag!==4&&y.tag!==27&&y.child!==null){y.child.return=y,y=y.child;continue}if(y===t)break e;for(;y.sibling===null;){if(y.return===null||y.return===t)break e;y=y.return}y.sibling.return=y.return,y=y.sibling}t.stateNode=d;e:switch(xt(d,c,s),c){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&jn(t)}}return Qe(t),Kc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&jn(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(o(166));if(e=we.current,wa(t)){if(e=t.stateNode,n=t.memoizedProps,s=null,c=bt,c!==null)switch(c.tag){case 27:case 5:s=c.memoizedProps}e[gt]=t,e=!!(e.nodeValue===n||s!==null&&s.suppressHydrationWarning===!0||ap(e.nodeValue,n)),e||Jn(t,!0)}else e=So(e).createTextNode(s),e[gt]=t,t.stateNode=e}return Qe(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(s=wa(t),n!==null){if(e===null){if(!s)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[gt]=t}else Ui(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Qe(t),e=!1}else n=Qr(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Ft(t),t):(Ft(t),null);if((t.flags&128)!==0)throw Error(o(558))}return Qe(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(c=wa(t),s!==null&&s.dehydrated!==null){if(e===null){if(!c)throw Error(o(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(o(317));c[gt]=t}else Ui(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Qe(t),c=!1}else c=Qr(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(Ft(t),t):(Ft(t),null)}return Ft(t),(t.flags&128)!==0?(t.lanes=n,t):(n=s!==null,e=e!==null&&e.memoizedState!==null,n&&(s=t.child,c=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(c=s.alternate.memoizedState.cachePool.pool),d=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(d=s.memoizedState.cachePool.pool),d!==c&&(s.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),so(t,t.updateQueue),Qe(t),null);case 4:return se(),e===null&&ru(t.stateNode.containerInfo),Qe(t),null;case 10:return kn(t.type),Qe(t),null;case 19:if(ye(it),s=t.memoizedState,s===null)return Qe(t),null;if(c=(t.flags&128)!==0,d=s.rendering,d===null)if(c)Ol(s,!1);else{if(nt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(d=Vs(e),d!==null){for(t.flags|=128,Ol(s,!1),e=d.updateQueue,t.updateQueue=e,so(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)zf(n,e),n=n.sibling;return xe(it,it.current&1|2),He&&En(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&St()>fo&&(t.flags|=128,c=!0,Ol(s,!1),t.lanes=4194304)}else{if(!c)if(e=Vs(d),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,so(t,e),Ol(s,!0),s.tail===null&&s.tailMode==="hidden"&&!d.alternate&&!He)return Qe(t),null}else 2*St()-s.renderingStartTime>fo&&n!==536870912&&(t.flags|=128,c=!0,Ol(s,!1),t.lanes=4194304);s.isBackwards?(d.sibling=t.child,t.child=d):(e=s.last,e!==null?e.sibling=d:t.child=d,s.last=d)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=St(),e.sibling=null,n=it.current,xe(it,c?n&1|2:n&1),He&&En(t,s.treeForkCount),e):(Qe(t),null);case 22:case 23:return Ft(t),cc(),s=t.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(t.flags|=8192):s&&(t.flags|=8192),s?(n&536870912)!==0&&(t.flags&128)===0&&(Qe(t),t.subtreeFlags&6&&(t.flags|=8192)):Qe(t),n=t.updateQueue,n!==null&&so(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),s=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),s!==n&&(t.flags|=2048),e!==null&&ye(Fi),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),kn(lt),Qe(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function lv(e,t){switch(Pr(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return kn(lt),se(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Ee(t),null;case 31:if(t.memoizedState!==null){if(Ft(t),t.alternate===null)throw Error(o(340));Ui()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Ft(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));Ui()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ye(it),null;case 4:return se(),null;case 10:return kn(t.type),null;case 22:case 23:return Ft(t),cc(),e!==null&&ye(Fi),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return kn(lt),null;case 25:return null;default:return null}}function cm(e,t){switch(Pr(t),t.tag){case 3:kn(lt),se();break;case 26:case 27:case 5:Ee(t);break;case 4:se();break;case 31:t.memoizedState!==null&&Ft(t);break;case 13:Ft(t);break;case 19:ye(it);break;case 10:kn(t.type);break;case 22:case 23:Ft(t),cc(),e!==null&&ye(Fi);break;case 24:kn(lt)}}function Dl(e,t){try{var n=t.updateQueue,s=n!==null?n.lastEffect:null;if(s!==null){var c=s.next;n=c;do{if((n.tag&e)===e){s=void 0;var d=n.create,y=n.inst;s=d(),y.destroy=s}n=n.next}while(n!==c)}}catch(S){Ge(t,t.return,S)}}function si(e,t,n){try{var s=t.updateQueue,c=s!==null?s.lastEffect:null;if(c!==null){var d=c.next;s=d;do{if((s.tag&e)===e){var y=s.inst,S=y.destroy;if(S!==void 0){y.destroy=void 0,c=t;var k=n,I=S;try{I()}catch(Z){Ge(c,k,Z)}}}s=s.next}while(s!==d)}}catch(Z){Ge(t,t.return,Z)}}function um(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{eh(t,n)}catch(s){Ge(e,e.return,s)}}}function dm(e,t,n){n.props=Vi(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(s){Ge(e,t,s)}}function zl(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof n=="function"?e.refCleanup=n(s):n.current=s}}catch(c){Ge(e,t,c)}}function gn(e,t){var n=e.ref,s=e.refCleanup;if(n!==null)if(typeof s=="function")try{s()}catch(c){Ge(e,t,c)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(c){Ge(e,t,c)}else n.current=null}function fm(e){var t=e.type,n=e.memoizedProps,s=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&s.focus();break e;case"img":n.src?s.src=n.src:n.srcSet&&(s.srcset=n.srcSet)}}catch(c){Ge(e,e.return,c)}}function Ic(e,t,n){try{var s=e.stateNode;Ev(s,e.type,n,t),s[Lt]=t}catch(c){Ge(e,e.return,c)}}function hm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&hi(e.type)||e.tag===4}function Fc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||hm(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&&hi(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Gc(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Tn));else if(s!==4&&(s===27&&hi(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Gc(e,t,n),e=e.sibling;e!==null;)Gc(e,t,n),e=e.sibling}function oo(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(s!==4&&(s===27&&hi(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(oo(e,t,n),e=e.sibling;e!==null;)oo(e,t,n),e=e.sibling}function mm(e){var t=e.stateNode,n=e.memoizedProps;try{for(var s=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);xt(t,s,n),t[gt]=e,t[Lt]=n}catch(d){Ge(e,e.return,d)}}var On=!1,rt=!1,Yc=!1,pm=typeof WeakSet=="function"?WeakSet:Set,mt=null;function sv(e,t){if(e=e.containerInfo,du=ko,e=Ef(e),Hr(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var s=n.getSelection&&n.getSelection();if(s&&s.rangeCount!==0){n=s.anchorNode;var c=s.anchorOffset,d=s.focusNode;s=s.focusOffset;try{n.nodeType,d.nodeType}catch{n=null;break e}var y=0,S=-1,k=-1,I=0,Z=0,te=e,G=null;t:for(;;){for(var $;te!==n||c!==0&&te.nodeType!==3||(S=y+c),te!==d||s!==0&&te.nodeType!==3||(k=y+s),te.nodeType===3&&(y+=te.nodeValue.length),($=te.firstChild)!==null;)G=te,te=$;for(;;){if(te===e)break t;if(G===n&&++I===c&&(S=y),G===d&&++Z===s&&(k=y),($=te.nextSibling)!==null)break;te=G,G=te.parentNode}te=$}n=S===-1||k===-1?null:{start:S,end:k}}else n=null}n=n||{start:0,end:0}}else n=null;for(fu={focusedElem:e,selectionRange:n},ko=!1,mt=t;mt!==null;)if(t=mt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,mt=e;else for(;mt!==null;){switch(t=mt,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(n=0;n<e.length;n++)c=e[n],c.ref.impl=c.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&d!==null){e=void 0,n=t,c=d.memoizedProps,d=d.memoizedState,s=n.stateNode;try{var he=Vi(n.type,c);e=s.getSnapshotBeforeUpdate(he,d),s.__reactInternalSnapshotBeforeUpdate=e}catch(Te){Ge(n,n.return,Te)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)pu(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":pu(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(o(163))}if(e=t.sibling,e!==null){e.return=t.return,mt=e;break}mt=t.return}}function gm(e,t,n){var s=n.flags;switch(n.tag){case 0:case 11:case 15:zn(e,n),s&4&&Dl(5,n);break;case 1:if(zn(e,n),s&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(y){Ge(n,n.return,y)}else{var c=Vi(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(y){Ge(n,n.return,y)}}s&64&&um(n),s&512&&zl(n,n.return);break;case 3:if(zn(e,n),s&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{eh(e,t)}catch(y){Ge(n,n.return,y)}}break;case 27:t===null&&s&4&&mm(n);case 26:case 5:zn(e,n),t===null&&s&4&&fm(n),s&512&&zl(n,n.return);break;case 12:zn(e,n);break;case 31:zn(e,n),s&4&&vm(e,n);break;case 13:zn(e,n),s&4&&xm(e,n),s&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=pv.bind(null,n),Dv(e,n))));break;case 22:if(s=n.memoizedState!==null||On,!s){t=t!==null&&t.memoizedState!==null||rt,c=On;var d=rt;On=s,(rt=t)&&!d?Hn(e,n,(n.subtreeFlags&8772)!==0):zn(e,n),On=c,rt=d}break;case 30:break;default:zn(e,n)}}function bm(e){var t=e.alternate;t!==null&&(e.alternate=null,bm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&xr(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 Je=null,_t=!1;function Dn(e,t,n){for(n=n.child;n!==null;)ym(e,t,n),n=n.sibling}function ym(e,t,n){if(Mt&&typeof Mt.onCommitFiberUnmount=="function")try{Mt.onCommitFiberUnmount(Li,n)}catch{}switch(n.tag){case 26:rt||gn(n,t),Dn(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:rt||gn(n,t);var s=Je,c=_t;hi(n.type)&&(Je=n.stateNode,_t=!1),Dn(e,t,n),$l(n.stateNode),Je=s,_t=c;break;case 5:rt||gn(n,t);case 6:if(s=Je,c=_t,Je=null,Dn(e,t,n),Je=s,_t=c,Je!==null)if(_t)try{(Je.nodeType===9?Je.body:Je.nodeName==="HTML"?Je.ownerDocument.body:Je).removeChild(n.stateNode)}catch(d){Ge(n,t,d)}else try{Je.removeChild(n.stateNode)}catch(d){Ge(n,t,d)}break;case 18:Je!==null&&(_t?(e=Je,up(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Fa(e)):up(Je,n.stateNode));break;case 4:s=Je,c=_t,Je=n.stateNode.containerInfo,_t=!0,Dn(e,t,n),Je=s,_t=c;break;case 0:case 11:case 14:case 15:si(2,n,t),rt||si(4,n,t),Dn(e,t,n);break;case 1:rt||(gn(n,t),s=n.stateNode,typeof s.componentWillUnmount=="function"&&dm(n,t,s)),Dn(e,t,n);break;case 21:Dn(e,t,n);break;case 22:rt=(s=rt)||n.memoizedState!==null,Dn(e,t,n),rt=s;break;default:Dn(e,t,n)}}function vm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Fa(e)}catch(n){Ge(t,t.return,n)}}}function xm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Fa(e)}catch(n){Ge(t,t.return,n)}}function ov(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new pm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new pm),t;default:throw Error(o(435,e.tag))}}function ro(e,t){var n=ov(e);t.forEach(function(s){if(!n.has(s)){n.add(s);var c=gv.bind(null,e,s);s.then(c,c)}})}function jt(e,t){var n=t.deletions;if(n!==null)for(var s=0;s<n.length;s++){var c=n[s],d=e,y=t,S=y;e:for(;S!==null;){switch(S.tag){case 27:if(hi(S.type)){Je=S.stateNode,_t=!1;break e}break;case 5:Je=S.stateNode,_t=!1;break e;case 3:case 4:Je=S.stateNode.containerInfo,_t=!0;break e}S=S.return}if(Je===null)throw Error(o(160));ym(d,y,c),Je=null,_t=!1,d=c.alternate,d!==null&&(d.return=null),c.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)wm(t,e),t=t.sibling}var un=null;function wm(e,t){var n=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:jt(t,e),Ot(e),s&4&&(si(3,e,e.return),Dl(3,e),si(5,e,e.return));break;case 1:jt(t,e),Ot(e),s&512&&(rt||n===null||gn(n,n.return)),s&64&&On&&(e=e.updateQueue,e!==null&&(s=e.callbacks,s!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?s:n.concat(s))));break;case 26:var c=un;if(jt(t,e),Ot(e),s&512&&(rt||n===null||gn(n,n.return)),s&4){var d=n!==null?n.memoizedState:null;if(s=e.memoizedState,n===null)if(s===null)if(e.stateNode===null){e:{s=e.type,n=e.memoizedProps,c=c.ownerDocument||c;t:switch(s){case"title":d=c.getElementsByTagName("title")[0],(!d||d[cl]||d[gt]||d.namespaceURI==="http://www.w3.org/2000/svg"||d.hasAttribute("itemprop"))&&(d=c.createElement(s),c.head.insertBefore(d,c.querySelector("head > title"))),xt(d,s,n),d[gt]=e,ht(d),s=d;break e;case"link":var y=wp("link","href",c).get(s+(n.href||""));if(y){for(var S=0;S<y.length;S++)if(d=y[S],d.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&d.getAttribute("rel")===(n.rel==null?null:n.rel)&&d.getAttribute("title")===(n.title==null?null:n.title)&&d.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){y.splice(S,1);break t}}d=c.createElement(s),xt(d,s,n),c.head.appendChild(d);break;case"meta":if(y=wp("meta","content",c).get(s+(n.content||""))){for(S=0;S<y.length;S++)if(d=y[S],d.getAttribute("content")===(n.content==null?null:""+n.content)&&d.getAttribute("name")===(n.name==null?null:n.name)&&d.getAttribute("property")===(n.property==null?null:n.property)&&d.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&d.getAttribute("charset")===(n.charSet==null?null:n.charSet)){y.splice(S,1);break t}}d=c.createElement(s),xt(d,s,n),c.head.appendChild(d);break;default:throw Error(o(468,s))}d[gt]=e,ht(d),s=d}e.stateNode=s}else Sp(c,e.type,e.stateNode);else e.stateNode=xp(c,s,e.memoizedProps);else d!==s?(d===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):d.count--,s===null?Sp(c,e.type,e.stateNode):xp(c,s,e.memoizedProps)):s===null&&e.stateNode!==null&&Ic(e,e.memoizedProps,n.memoizedProps)}break;case 27:jt(t,e),Ot(e),s&512&&(rt||n===null||gn(n,n.return)),n!==null&&s&4&&Ic(e,e.memoizedProps,n.memoizedProps);break;case 5:if(jt(t,e),Ot(e),s&512&&(rt||n===null||gn(n,n.return)),e.flags&32){c=e.stateNode;try{da(c,"")}catch(he){Ge(e,e.return,he)}}s&4&&e.stateNode!=null&&(c=e.memoizedProps,Ic(e,c,n!==null?n.memoizedProps:c)),s&1024&&(Yc=!0);break;case 6:if(jt(t,e),Ot(e),s&4){if(e.stateNode===null)throw Error(o(162));s=e.memoizedProps,n=e.stateNode;try{n.nodeValue=s}catch(he){Ge(e,e.return,he)}}break;case 3:if(Mo=null,c=un,un=Co(t.containerInfo),jt(t,e),un=c,Ot(e),s&4&&n!==null&&n.memoizedState.isDehydrated)try{Fa(t.containerInfo)}catch(he){Ge(e,e.return,he)}Yc&&(Yc=!1,Sm(e));break;case 4:s=un,un=Co(e.stateNode.containerInfo),jt(t,e),Ot(e),un=s;break;case 12:jt(t,e),Ot(e);break;case 31:jt(t,e),Ot(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,ro(e,s)));break;case 13:jt(t,e),Ot(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(uo=St()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,ro(e,s)));break;case 22:c=e.memoizedState!==null;var k=n!==null&&n.memoizedState!==null,I=On,Z=rt;if(On=I||c,rt=Z||k,jt(t,e),rt=Z,On=I,Ot(e),s&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(n===null||k||On||rt||Pi(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){k=n=t;try{if(d=k.stateNode,c)y=d.style,typeof y.setProperty=="function"?y.setProperty("display","none","important"):y.display="none";else{S=k.stateNode;var te=k.memoizedProps.style,G=te!=null&&te.hasOwnProperty("display")?te.display:null;S.style.display=G==null||typeof G=="boolean"?"":(""+G).trim()}}catch(he){Ge(k,k.return,he)}}}else if(t.tag===6){if(n===null){k=t;try{k.stateNode.nodeValue=c?"":k.memoizedProps}catch(he){Ge(k,k.return,he)}}}else if(t.tag===18){if(n===null){k=t;try{var $=k.stateNode;c?dp($,!0):dp(k.stateNode,!1)}catch(he){Ge(k,k.return,he)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}s&4&&(s=e.updateQueue,s!==null&&(n=s.retryQueue,n!==null&&(s.retryQueue=null,ro(e,n))));break;case 19:jt(t,e),Ot(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,ro(e,s)));break;case 30:break;case 21:break;default:jt(t,e),Ot(e)}}function Ot(e){var t=e.flags;if(t&2){try{for(var n,s=e.return;s!==null;){if(hm(s)){n=s;break}s=s.return}if(n==null)throw Error(o(160));switch(n.tag){case 27:var c=n.stateNode,d=Fc(e);oo(e,d,c);break;case 5:var y=n.stateNode;n.flags&32&&(da(y,""),n.flags&=-33);var S=Fc(e);oo(e,S,y);break;case 3:case 4:var k=n.stateNode.containerInfo,I=Fc(e);Gc(e,I,k);break;default:throw Error(o(161))}}catch(Z){Ge(e,e.return,Z)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Sm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Sm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function zn(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)gm(e,t.alternate,t),t=t.sibling}function Pi(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:si(4,t,t.return),Pi(t);break;case 1:gn(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&dm(t,t.return,n),Pi(t);break;case 27:$l(t.stateNode);case 26:case 5:gn(t,t.return),Pi(t);break;case 22:t.memoizedState===null&&Pi(t);break;case 30:Pi(t);break;default:Pi(t)}e=e.sibling}}function Hn(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var s=t.alternate,c=e,d=t,y=d.flags;switch(d.tag){case 0:case 11:case 15:Hn(c,d,n),Dl(4,d);break;case 1:if(Hn(c,d,n),s=d,c=s.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(I){Ge(s,s.return,I)}if(s=d,c=s.updateQueue,c!==null){var S=s.stateNode;try{var k=c.shared.hiddenCallbacks;if(k!==null)for(c.shared.hiddenCallbacks=null,c=0;c<k.length;c++)Jf(k[c],S)}catch(I){Ge(s,s.return,I)}}n&&y&64&&um(d),zl(d,d.return);break;case 27:mm(d);case 26:case 5:Hn(c,d,n),n&&s===null&&y&4&&fm(d),zl(d,d.return);break;case 12:Hn(c,d,n);break;case 31:Hn(c,d,n),n&&y&4&&vm(c,d);break;case 13:Hn(c,d,n),n&&y&4&&xm(c,d);break;case 22:d.memoizedState===null&&Hn(c,d,n),zl(d,d.return);break;case 30:break;default:Hn(c,d,n)}t=t.sibling}}function $c(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Sl(n))}function qc(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Sl(e))}function dn(e,t,n,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Cm(e,t,n,s),t=t.sibling}function Cm(e,t,n,s){var c=t.flags;switch(t.tag){case 0:case 11:case 15:dn(e,t,n,s),c&2048&&Dl(9,t);break;case 1:dn(e,t,n,s);break;case 3:dn(e,t,n,s),c&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Sl(e)));break;case 12:if(c&2048){dn(e,t,n,s),e=t.stateNode;try{var d=t.memoizedProps,y=d.id,S=d.onPostCommit;typeof S=="function"&&S(y,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(k){Ge(t,t.return,k)}}else dn(e,t,n,s);break;case 31:dn(e,t,n,s);break;case 13:dn(e,t,n,s);break;case 23:break;case 22:d=t.stateNode,y=t.alternate,t.memoizedState!==null?d._visibility&2?dn(e,t,n,s):Hl(e,t):d._visibility&2?dn(e,t,n,s):(d._visibility|=2,Ra(e,t,n,s,(t.subtreeFlags&10256)!==0||!1)),c&2048&&$c(y,t);break;case 24:dn(e,t,n,s),c&2048&&qc(t.alternate,t);break;default:dn(e,t,n,s)}}function Ra(e,t,n,s,c){for(c=c&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var d=e,y=t,S=n,k=s,I=y.flags;switch(y.tag){case 0:case 11:case 15:Ra(d,y,S,k,c),Dl(8,y);break;case 23:break;case 22:var Z=y.stateNode;y.memoizedState!==null?Z._visibility&2?Ra(d,y,S,k,c):Hl(d,y):(Z._visibility|=2,Ra(d,y,S,k,c)),c&&I&2048&&$c(y.alternate,y);break;case 24:Ra(d,y,S,k,c),c&&I&2048&&qc(y.alternate,y);break;default:Ra(d,y,S,k,c)}t=t.sibling}}function Hl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,s=t,c=s.flags;switch(s.tag){case 22:Hl(n,s),c&2048&&$c(s.alternate,s);break;case 24:Hl(n,s),c&2048&&qc(s.alternate,s);break;default:Hl(n,s)}t=t.sibling}}var Bl=8192;function _a(e,t,n){if(e.subtreeFlags&Bl)for(e=e.child;e!==null;)Tm(e,t,n),e=e.sibling}function Tm(e,t,n){switch(e.tag){case 26:_a(e,t,n),e.flags&Bl&&e.memoizedState!==null&&Vv(n,un,e.memoizedState,e.memoizedProps);break;case 5:_a(e,t,n);break;case 3:case 4:var s=un;un=Co(e.stateNode.containerInfo),_a(e,t,n),un=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=Bl,Bl=16777216,_a(e,t,n),Bl=s):_a(e,t,n));break;default:_a(e,t,n)}}function Mm(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 Ul(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var s=t[n];mt=s,Em(s,e)}Mm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Am(e),e=e.sibling}function Am(e){switch(e.tag){case 0:case 11:case 15:Ul(e),e.flags&2048&&si(9,e,e.return);break;case 3:Ul(e);break;case 12:Ul(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,co(e)):Ul(e);break;default:Ul(e)}}function co(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var s=t[n];mt=s,Em(s,e)}Mm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:si(8,t,t.return),co(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,co(t));break;default:co(t)}e=e.sibling}}function Em(e,t){for(;mt!==null;){var n=mt;switch(n.tag){case 0:case 11:case 15:si(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var s=n.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:Sl(n.memoizedState.cache)}if(s=n.child,s!==null)s.return=n,mt=s;else e:for(n=e;mt!==null;){s=mt;var c=s.sibling,d=s.return;if(bm(s),s===n){mt=null;break e}if(c!==null){c.return=d,mt=c;break e}mt=d}}}var rv={getCacheForType:function(e){var t=yt(lt),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return yt(lt).controller.signal}},cv=typeof WeakMap=="function"?WeakMap:Map,Ie=0,Ve=null,je=null,De=0,Fe=0,Gt=null,oi=!1,ja=!1,Vc=!1,Bn=0,nt=0,ri=0,Xi=0,Pc=0,Yt=0,Oa=0,Kl=null,Dt=null,Xc=!1,uo=0,Nm=0,fo=1/0,ho=null,ci=null,dt=0,ui=null,Da=null,Un=0,Qc=0,Zc=null,km=null,Il=0,Wc=null;function $t(){return(Ie&2)!==0&&De!==0?De&-De:E.T!==null?au():Yd()}function Lm(){if(Yt===0)if((De&536870912)===0||He){var e=Ri;Ri<<=1,(Ri&3932160)===0&&(Ri=262144),Yt=e}else Yt=536870912;return e=It.current,e!==null&&(e.flags|=32),Yt}function zt(e,t,n){(e===Ve&&(Fe===2||Fe===9)||e.cancelPendingCommit!==null)&&(za(e,0),di(e,De,Yt,!1)),rl(e,n),((Ie&2)===0||e!==Ve)&&(e===Ve&&((Ie&2)===0&&(Xi|=n),nt===4&&di(e,De,Yt,!1)),bn(e))}function Rm(e,t,n){if((Ie&6)!==0)throw Error(o(327));var s=!n&&(t&127)===0&&(t&e.expiredLanes)===0||ol(e,t),c=s?fv(e,t):eu(e,t,!0),d=s;do{if(c===0){ja&&!s&&di(e,t,0,!1);break}else{if(n=e.current.alternate,d&&!uv(n)){c=eu(e,t,!1),d=!1;continue}if(c===2){if(d=t,e.errorRecoveryDisabledLanes&d)var y=0;else y=e.pendingLanes&-536870913,y=y!==0?y:y&536870912?536870912:0;if(y!==0){t=y;e:{var S=e;c=Kl;var k=S.current.memoizedState.isDehydrated;if(k&&(za(S,y).flags|=256),y=eu(S,y,!1),y!==2){if(Vc&&!k){S.errorRecoveryDisabledLanes|=d,Xi|=d,c=4;break e}d=Dt,Dt=c,d!==null&&(Dt===null?Dt=d:Dt.push.apply(Dt,d))}c=y}if(d=!1,c!==2)continue}}if(c===1){za(e,0),di(e,t,0,!0);break}e:{switch(s=e,d=c,d){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t)break;case 6:di(s,t,Yt,!oi);break e;case 2:Dt=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(c=uo+300-St(),10<c)){if(di(s,t,Yt,!oi),Ss(s,0,!0)!==0)break e;Un=t,s.timeoutHandle=rp(_m.bind(null,s,n,Dt,ho,Xc,t,Yt,Xi,Oa,oi,d,"Throttled",-0,0),c);break e}_m(s,n,Dt,ho,Xc,t,Yt,Xi,Oa,oi,d,null,-0,0)}}break}while(!0);bn(e)}function _m(e,t,n,s,c,d,y,S,k,I,Z,te,G,$){if(e.timeoutHandle=-1,te=t.subtreeFlags,te&8192||(te&16785408)===16785408){te={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Tn},Tm(t,d,te);var he=(d&62914560)===d?uo-St():(d&4194048)===d?Nm-St():0;if(he=Pv(te,he),he!==null){Un=d,e.cancelPendingCommit=he(Km.bind(null,e,t,d,n,s,c,y,S,k,Z,te,null,G,$)),di(e,d,y,!I);return}}Km(e,t,d,n,s,c,y,S,k)}function uv(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var s=0;s<n.length;s++){var c=n[s],d=c.getSnapshot;c=c.value;try{if(!Ut(d(),c))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function di(e,t,n,s){t&=~Pc,t&=~Xi,e.suspendedLanes|=t,e.pingedLanes&=~t,s&&(e.warmLanes|=t),s=e.expirationTimes;for(var c=t;0<c;){var d=31-Ct(c),y=1<<d;s[d]=-1,c&=~y}n!==0&&Id(e,n,t)}function mo(){return(Ie&6)===0?(Fl(0),!1):!0}function Jc(){if(je!==null){if(Fe===0)var e=je.return;else e=je,Nn=Ki=null,pc(e),Aa=null,Tl=0,e=je;for(;e!==null;)cm(e.alternate,e),e=e.return;je=null}}function za(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Lv(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Un=0,Jc(),Ve=e,je=n=An(e.current,null),De=t,Fe=0,Gt=null,oi=!1,ja=ol(e,t),Vc=!1,Oa=Yt=Pc=Xi=ri=nt=0,Dt=Kl=null,Xc=!1,(t&8)!==0&&(t|=t&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=t;0<s;){var c=31-Ct(s),d=1<<c;t|=e[c],s&=~d}return Bn=t,Os(),n}function jm(e,t){Ne=null,E.H=_l,t===Ma||t===Fs?(t=Xf(),Fe=3):t===ic?(t=Xf(),Fe=4):Fe=t===Rc?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Gt=t,je===null&&(nt=1,no(e,Zt(t,e.current)))}function Om(){var e=It.current;return e===null?!0:(De&4194048)===De?tn===null:(De&62914560)===De||(De&536870912)!==0?e===tn:!1}function Dm(){var e=E.H;return E.H=_l,e===null?_l:e}function zm(){var e=E.A;return E.A=rv,e}function po(){nt=4,oi||(De&4194048)!==De&&It.current!==null||(ja=!0),(ri&134217727)===0&&(Xi&134217727)===0||Ve===null||di(Ve,De,Yt,!1)}function eu(e,t,n){var s=Ie;Ie|=2;var c=Dm(),d=zm();(Ve!==e||De!==t)&&(ho=null,za(e,t)),t=!1;var y=nt;e:do try{if(Fe!==0&&je!==null){var S=je,k=Gt;switch(Fe){case 8:Jc(),y=6;break e;case 3:case 2:case 9:case 6:It.current===null&&(t=!0);var I=Fe;if(Fe=0,Gt=null,Ha(e,S,k,I),n&&ja){y=0;break e}break;default:I=Fe,Fe=0,Gt=null,Ha(e,S,k,I)}}dv(),y=nt;break}catch(Z){jm(e,Z)}while(!0);return t&&e.shellSuspendCounter++,Nn=Ki=null,Ie=s,E.H=c,E.A=d,je===null&&(Ve=null,De=0,Os()),y}function dv(){for(;je!==null;)Hm(je)}function fv(e,t){var n=Ie;Ie|=2;var s=Dm(),c=zm();Ve!==e||De!==t?(ho=null,fo=St()+500,za(e,t)):ja=ol(e,t);e:do try{if(Fe!==0&&je!==null){t=je;var d=Gt;t:switch(Fe){case 1:Fe=0,Gt=null,Ha(e,t,d,1);break;case 2:case 9:if(Vf(d)){Fe=0,Gt=null,Bm(t);break}t=function(){Fe!==2&&Fe!==9||Ve!==e||(Fe=7),bn(e)},d.then(t,t);break e;case 3:Fe=7;break e;case 4:Fe=5;break e;case 7:Vf(d)?(Fe=0,Gt=null,Bm(t)):(Fe=0,Gt=null,Ha(e,t,d,7));break;case 5:var y=null;switch(je.tag){case 26:y=je.memoizedState;case 5:case 27:var S=je;if(y?Cp(y):S.stateNode.complete){Fe=0,Gt=null;var k=S.sibling;if(k!==null)je=k;else{var I=S.return;I!==null?(je=I,go(I)):je=null}break t}}Fe=0,Gt=null,Ha(e,t,d,5);break;case 6:Fe=0,Gt=null,Ha(e,t,d,6);break;case 8:Jc(),nt=6;break e;default:throw Error(o(462))}}hv();break}catch(Z){jm(e,Z)}while(!0);return Nn=Ki=null,E.H=s,E.A=c,Ie=n,je!==null?0:(Ve=null,De=0,Os(),nt)}function hv(){for(;je!==null&&!ps();)Hm(je)}function Hm(e){var t=om(e.alternate,e,Bn);e.memoizedProps=e.pendingProps,t===null?go(e):je=t}function Bm(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=tm(n,t,t.pendingProps,t.type,void 0,De);break;case 11:t=tm(n,t,t.pendingProps,t.type.render,t.ref,De);break;case 5:pc(t);default:cm(n,t),t=je=zf(t,Bn),t=om(n,t,Bn)}e.memoizedProps=e.pendingProps,t===null?go(e):je=t}function Ha(e,t,n,s){Nn=Ki=null,pc(t),Aa=null,Tl=0;var c=t.return;try{if(tv(e,c,t,n,De)){nt=1,no(e,Zt(n,e.current)),je=null;return}}catch(d){if(c!==null)throw je=c,d;nt=1,no(e,Zt(n,e.current)),je=null;return}t.flags&32768?(He||s===1?e=!0:ja||(De&536870912)!==0?e=!1:(oi=e=!0,(s===2||s===9||s===3||s===6)&&(s=It.current,s!==null&&s.tag===13&&(s.flags|=16384))),Um(t,e)):go(t)}function go(e){var t=e;do{if((t.flags&32768)!==0){Um(t,oi);return}e=t.return;var n=av(t.alternate,t,Bn);if(n!==null){je=n;return}if(t=t.sibling,t!==null){je=t;return}je=t=e}while(t!==null);nt===0&&(nt=5)}function Um(e,t){do{var n=lv(e.alternate,e);if(n!==null){n.flags&=32767,je=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){je=e;return}je=e=n}while(e!==null);nt=6,je=null}function Km(e,t,n,s,c,d,y,S,k){e.cancelPendingCommit=null;do bo();while(dt!==0);if((Ie&6)!==0)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));if(d=t.lanes|t.childLanes,d|=Fr,qy(e,n,d,y,S,k),e===Ve&&(je=Ve=null,De=0),Da=t,ui=e,Un=n,Qc=d,Zc=c,km=s,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,bv(ki,function(){return $m(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||s){s=E.T,E.T=null,c=Y.p,Y.p=2,y=Ie,Ie|=4;try{sv(e,t,n)}finally{Ie=y,Y.p=c,E.T=s}}dt=1,Im(),Fm(),Gm()}}function Im(){if(dt===1){dt=0;var e=ui,t=Da,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=E.T,E.T=null;var s=Y.p;Y.p=2;var c=Ie;Ie|=4;try{wm(t,e);var d=fu,y=Ef(e.containerInfo),S=d.focusedElem,k=d.selectionRange;if(y!==S&&S&&S.ownerDocument&&Af(S.ownerDocument.documentElement,S)){if(k!==null&&Hr(S)){var I=k.start,Z=k.end;if(Z===void 0&&(Z=I),"selectionStart"in S)S.selectionStart=I,S.selectionEnd=Math.min(Z,S.value.length);else{var te=S.ownerDocument||document,G=te&&te.defaultView||window;if(G.getSelection){var $=G.getSelection(),he=S.textContent.length,Te=Math.min(k.start,he),qe=k.end===void 0?Te:Math.min(k.end,he);!$.extend&&Te>qe&&(y=qe,qe=Te,Te=y);var B=Mf(S,Te),O=Mf(S,qe);if(B&&O&&($.rangeCount!==1||$.anchorNode!==B.node||$.anchorOffset!==B.offset||$.focusNode!==O.node||$.focusOffset!==O.offset)){var K=te.createRange();K.setStart(B.node,B.offset),$.removeAllRanges(),Te>qe?($.addRange(K),$.extend(O.node,O.offset)):(K.setEnd(O.node,O.offset),$.addRange(K))}}}}for(te=[],$=S;$=$.parentNode;)$.nodeType===1&&te.push({element:$,left:$.scrollLeft,top:$.scrollTop});for(typeof S.focus=="function"&&S.focus(),S=0;S<te.length;S++){var J=te[S];J.element.scrollLeft=J.left,J.element.scrollTop=J.top}}ko=!!du,fu=du=null}finally{Ie=c,Y.p=s,E.T=n}}e.current=t,dt=2}}function Fm(){if(dt===2){dt=0;var e=ui,t=Da,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=E.T,E.T=null;var s=Y.p;Y.p=2;var c=Ie;Ie|=4;try{gm(e,t.alternate,t)}finally{Ie=c,Y.p=s,E.T=n}}dt=3}}function Gm(){if(dt===4||dt===3){dt=0,gs();var e=ui,t=Da,n=Un,s=km;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?dt=5:(dt=0,Da=ui=null,Ym(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(ci=null),yr(n),t=t.stateNode,Mt&&typeof Mt.onCommitFiberRoot=="function")try{Mt.onCommitFiberRoot(Li,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=E.T,c=Y.p,Y.p=2,E.T=null;try{for(var d=e.onRecoverableError,y=0;y<s.length;y++){var S=s[y];d(S.value,{componentStack:S.stack})}}finally{E.T=t,Y.p=c}}(Un&3)!==0&&bo(),bn(e),c=e.pendingLanes,(n&261930)!==0&&(c&42)!==0?e===Wc?Il++:(Il=0,Wc=e):Il=0,Fl(0)}}function Ym(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Sl(t)))}function bo(){return Im(),Fm(),Gm(),$m()}function $m(){if(dt!==5)return!1;var e=ui,t=Qc;Qc=0;var n=yr(Un),s=E.T,c=Y.p;try{Y.p=32>n?32:n,E.T=null,n=Zc,Zc=null;var d=ui,y=Un;if(dt=0,Da=ui=null,Un=0,(Ie&6)!==0)throw Error(o(331));var S=Ie;if(Ie|=4,Am(d.current),Cm(d,d.current,y,n),Ie=S,Fl(0,!1),Mt&&typeof Mt.onPostCommitFiberRoot=="function")try{Mt.onPostCommitFiberRoot(Li,d)}catch{}return!0}finally{Y.p=c,E.T=s,Ym(e,t)}}function qm(e,t,n){t=Zt(n,t),t=Lc(e.stateNode,t,2),e=ii(e,t,2),e!==null&&(rl(e,2),bn(e))}function Ge(e,t,n){if(e.tag===3)qm(e,e,n);else for(;t!==null;){if(t.tag===3){qm(t,e,n);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(ci===null||!ci.has(s))){e=Zt(n,e),n=Vh(2),s=ii(t,n,2),s!==null&&(Ph(n,s,t,e),rl(s,2),bn(s));break}}t=t.return}}function tu(e,t,n){var s=e.pingCache;if(s===null){s=e.pingCache=new cv;var c=new Set;s.set(t,c)}else c=s.get(t),c===void 0&&(c=new Set,s.set(t,c));c.has(n)||(Vc=!0,c.add(n),e=mv.bind(null,e,t,n),t.then(e,e))}function mv(e,t,n){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ve===e&&(De&n)===n&&(nt===4||nt===3&&(De&62914560)===De&&300>St()-uo?(Ie&2)===0&&za(e,0):Pc|=n,Oa===De&&(Oa=0)),bn(e)}function Vm(e,t){t===0&&(t=Kd()),e=Hi(e,t),e!==null&&(rl(e,t),bn(e))}function pv(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Vm(e,n)}function gv(e,t){var n=0;switch(e.tag){case 31:case 13:var s=e.stateNode,c=e.memoizedState;c!==null&&(n=c.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(o(314))}s!==null&&s.delete(t),Vm(e,n)}function bv(e,t){return kt(e,t)}var yo=null,Ba=null,nu=!1,vo=!1,iu=!1,fi=0;function bn(e){e!==Ba&&e.next===null&&(Ba===null?yo=Ba=e:Ba=Ba.next=e),vo=!0,nu||(nu=!0,vv())}function Fl(e,t){if(!iu&&vo){iu=!0;do for(var n=!1,s=yo;s!==null;){if(e!==0){var c=s.pendingLanes;if(c===0)var d=0;else{var y=s.suspendedLanes,S=s.pingedLanes;d=(1<<31-Ct(42|e)+1)-1,d&=c&~(y&~S),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(n=!0,Zm(s,d))}else d=De,d=Ss(s,s===Ve?d:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(d&3)===0||ol(s,d)||(n=!0,Zm(s,d));s=s.next}while(n);iu=!1}}function yv(){Pm()}function Pm(){vo=nu=!1;var e=0;fi!==0&&kv()&&(e=fi);for(var t=St(),n=null,s=yo;s!==null;){var c=s.next,d=Xm(s,t);d===0?(s.next=null,n===null?yo=c:n.next=c,c===null&&(Ba=n)):(n=s,(e!==0||(d&3)!==0)&&(vo=!0)),s=c}dt!==0&&dt!==5||Fl(e),fi!==0&&(fi=0)}function Xm(e,t){for(var n=e.suspendedLanes,s=e.pingedLanes,c=e.expirationTimes,d=e.pendingLanes&-62914561;0<d;){var y=31-Ct(d),S=1<<y,k=c[y];k===-1?((S&n)===0||(S&s)!==0)&&(c[y]=$y(S,t)):k<=t&&(e.expiredLanes|=S),d&=~S}if(t=Ve,n=De,n=Ss(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,n===0||e===t&&(Fe===2||Fe===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&Sn(s),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||ol(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(s!==null&&Sn(s),yr(n)){case 2:case 8:n=ll;break;case 32:n=ki;break;case 268435456:n=sl;break;default:n=ki}return s=Qm.bind(null,e),n=kt(n,s),e.callbackPriority=t,e.callbackNode=n,t}return s!==null&&s!==null&&Sn(s),e.callbackPriority=2,e.callbackNode=null,2}function Qm(e,t){if(dt!==0&&dt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(bo()&&e.callbackNode!==n)return null;var s=De;return s=Ss(e,e===Ve?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(Rm(e,s,t),Xm(e,St()),e.callbackNode!=null&&e.callbackNode===n?Qm.bind(null,e):null)}function Zm(e,t){if(bo())return null;Rm(e,t,!0)}function vv(){Rv(function(){(Ie&6)!==0?kt(al,yv):Pm()})}function au(){if(fi===0){var e=Ca;e===0&&(e=Vt,Vt<<=1,(Vt&261888)===0&&(Vt=256)),fi=e}return fi}function Wm(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:As(""+e)}function Jm(e,t){var n=t.ownerDocument.createElement("input");return n.name=t.name,n.value=t.value,e.id&&n.setAttribute("form",e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function xv(e,t,n,s,c){if(t==="submit"&&n&&n.stateNode===c){var d=Wm((c[Lt]||null).action),y=s.submitter;y&&(t=(t=y[Lt]||null)?Wm(t.formAction):y.getAttribute("formAction"),t!==null&&(d=t,y=null));var S=new Ls("action","action",null,s,c);e.push({event:S,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(fi!==0){var k=y?Jm(c,y):new FormData(c);Tc(n,{pending:!0,data:k,method:c.method,action:d},null,k)}}else typeof d=="function"&&(S.preventDefault(),k=y?Jm(c,y):new FormData(c),Tc(n,{pending:!0,data:k,method:c.method,action:d},d,k))},currentTarget:c}]})}}for(var lu=0;lu<Ir.length;lu++){var su=Ir[lu],wv=su.toLowerCase(),Sv=su[0].toUpperCase()+su.slice(1);cn(wv,"on"+Sv)}cn(Lf,"onAnimationEnd"),cn(Rf,"onAnimationIteration"),cn(_f,"onAnimationStart"),cn("dblclick","onDoubleClick"),cn("focusin","onFocus"),cn("focusout","onBlur"),cn(B0,"onTransitionRun"),cn(U0,"onTransitionStart"),cn(K0,"onTransitionCancel"),cn(jf,"onTransitionEnd"),ca("onMouseEnter",["mouseout","mouseover"]),ca("onMouseLeave",["mouseout","mouseover"]),ca("onPointerEnter",["pointerout","pointerover"]),ca("onPointerLeave",["pointerout","pointerover"]),ji("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ji("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ji("onBeforeInput",["compositionend","keypress","textInput","paste"]),ji("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ji("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ji("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Gl="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(" "),Cv=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Gl));function ep(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var s=e[n],c=s.event;s=s.listeners;e:{var d=void 0;if(t)for(var y=s.length-1;0<=y;y--){var S=s[y],k=S.instance,I=S.currentTarget;if(S=S.listener,k!==d&&c.isPropagationStopped())break e;d=S,c.currentTarget=I;try{d(c)}catch(Z){js(Z)}c.currentTarget=null,d=k}else for(y=0;y<s.length;y++){if(S=s[y],k=S.instance,I=S.currentTarget,S=S.listener,k!==d&&c.isPropagationStopped())break e;d=S,c.currentTarget=I;try{d(c)}catch(Z){js(Z)}c.currentTarget=null,d=k}}}}function Oe(e,t){var n=t[vr];n===void 0&&(n=t[vr]=new Set);var s=e+"__bubble";n.has(s)||(tp(t,e,2,!1),n.add(s))}function ou(e,t,n){var s=0;t&&(s|=4),tp(n,e,s,t)}var xo="_reactListening"+Math.random().toString(36).slice(2);function ru(e){if(!e[xo]){e[xo]=!0,Vd.forEach(function(n){n!=="selectionchange"&&(Cv.has(n)||ou(n,!1,e),ou(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[xo]||(t[xo]=!0,ou("selectionchange",!1,t))}}function tp(e,t,n,s){switch(Lp(t)){case 2:var c=Zv;break;case 8:c=Wv;break;default:c=Cu}n=c.bind(null,t,n,e),c=void 0,!Nr||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),s?c!==void 0?e.addEventListener(t,n,{capture:!0,passive:c}):e.addEventListener(t,n,!0):c!==void 0?e.addEventListener(t,n,{passive:c}):e.addEventListener(t,n,!1)}function cu(e,t,n,s,c){var d=s;if((t&1)===0&&(t&2)===0&&s!==null)e:for(;;){if(s===null)return;var y=s.tag;if(y===3||y===4){var S=s.stateNode.containerInfo;if(S===c)break;if(y===4)for(y=s.return;y!==null;){var k=y.tag;if((k===3||k===4)&&y.stateNode.containerInfo===c)return;y=y.return}for(;S!==null;){if(y=sa(S),y===null)return;if(k=y.tag,k===5||k===6||k===26||k===27){s=d=y;continue e}S=S.parentNode}}s=s.return}sf(function(){var I=d,Z=Ar(n),te=[];e:{var G=Of.get(e);if(G!==void 0){var $=Ls,he=e;switch(e){case"keypress":if(Ns(n)===0)break e;case"keydown":case"keyup":$=g0;break;case"focusin":he="focus",$=_r;break;case"focusout":he="blur",$=_r;break;case"beforeblur":case"afterblur":$=_r;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":$=cf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":$=a0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":$=v0;break;case Lf:case Rf:case _f:$=o0;break;case jf:$=w0;break;case"scroll":case"scrollend":$=n0;break;case"wheel":$=C0;break;case"copy":case"cut":case"paste":$=c0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":$=df;break;case"toggle":case"beforetoggle":$=M0}var Te=(t&4)!==0,qe=!Te&&(e==="scroll"||e==="scrollend"),B=Te?G!==null?G+"Capture":null:G;Te=[];for(var O=I,K;O!==null;){var J=O;if(K=J.stateNode,J=J.tag,J!==5&&J!==26&&J!==27||K===null||B===null||(J=dl(O,B),J!=null&&Te.push(Yl(O,J,K))),qe)break;O=O.return}0<Te.length&&(G=new $(G,he,null,n,Z),te.push({event:G,listeners:Te}))}}if((t&7)===0){e:{if(G=e==="mouseover"||e==="pointerover",$=e==="mouseout"||e==="pointerout",G&&n!==Mr&&(he=n.relatedTarget||n.fromElement)&&(sa(he)||he[la]))break e;if(($||G)&&(G=Z.window===Z?Z:(G=Z.ownerDocument)?G.defaultView||G.parentWindow:window,$?(he=n.relatedTarget||n.toElement,$=I,he=he?sa(he):null,he!==null&&(qe=u(he),Te=he.tag,he!==qe||Te!==5&&Te!==27&&Te!==6)&&(he=null)):($=null,he=I),$!==he)){if(Te=cf,J="onMouseLeave",B="onMouseEnter",O="mouse",(e==="pointerout"||e==="pointerover")&&(Te=df,J="onPointerLeave",B="onPointerEnter",O="pointer"),qe=$==null?G:ul($),K=he==null?G:ul(he),G=new Te(J,O+"leave",$,n,Z),G.target=qe,G.relatedTarget=K,J=null,sa(Z)===I&&(Te=new Te(B,O+"enter",he,n,Z),Te.target=K,Te.relatedTarget=qe,J=Te),qe=J,$&&he)t:{for(Te=Tv,B=$,O=he,K=0,J=B;J;J=Te(J))K++;J=0;for(var Ce=O;Ce;Ce=Te(Ce))J++;for(;0<K-J;)B=Te(B),K--;for(;0<J-K;)O=Te(O),J--;for(;K--;){if(B===O||O!==null&&B===O.alternate){Te=B;break t}B=Te(B),O=Te(O)}Te=null}else Te=null;$!==null&&np(te,G,$,Te,!1),he!==null&&qe!==null&&np(te,qe,he,Te,!0)}}e:{if(G=I?ul(I):window,$=G.nodeName&&G.nodeName.toLowerCase(),$==="select"||$==="input"&&G.type==="file")var Ue=vf;else if(bf(G))if(xf)Ue=D0;else{Ue=j0;var be=_0}else $=G.nodeName,!$||$.toLowerCase()!=="input"||G.type!=="checkbox"&&G.type!=="radio"?I&&Tr(I.elementType)&&(Ue=vf):Ue=O0;if(Ue&&(Ue=Ue(e,I))){yf(te,Ue,n,Z);break e}be&&be(e,G,I),e==="focusout"&&I&&G.type==="number"&&I.memoizedProps.value!=null&&Cr(G,"number",G.value)}switch(be=I?ul(I):window,e){case"focusin":(bf(be)||be.contentEditable==="true")&&(pa=be,Br=I,vl=null);break;case"focusout":vl=Br=pa=null;break;case"mousedown":Ur=!0;break;case"contextmenu":case"mouseup":case"dragend":Ur=!1,Nf(te,n,Z);break;case"selectionchange":if(H0)break;case"keydown":case"keyup":Nf(te,n,Z)}var Re;if(Or)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 ma?pf(e,n)&&(ze="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(ze="onCompositionStart");ze&&(ff&&n.locale!=="ko"&&(ma||ze!=="onCompositionStart"?ze==="onCompositionEnd"&&ma&&(Re=of()):(Qn=Z,kr="value"in Qn?Qn.value:Qn.textContent,ma=!0)),be=wo(I,ze),0<be.length&&(ze=new uf(ze,e,null,n,Z),te.push({event:ze,listeners:be}),Re?ze.data=Re:(Re=gf(n),Re!==null&&(ze.data=Re)))),(Re=E0?N0(e,n):k0(e,n))&&(ze=wo(I,"onBeforeInput"),0<ze.length&&(be=new uf("onBeforeInput","beforeinput",null,n,Z),te.push({event:be,listeners:ze}),be.data=Re)),xv(te,e,I,n,Z)}ep(te,t)})}function Yl(e,t,n){return{instance:e,listener:t,currentTarget:n}}function wo(e,t){for(var n=t+"Capture",s=[];e!==null;){var c=e,d=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||d===null||(c=dl(e,n),c!=null&&s.unshift(Yl(e,c,d)),c=dl(e,t),c!=null&&s.push(Yl(e,c,d))),e.tag===3)return s;e=e.return}return[]}function Tv(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function np(e,t,n,s,c){for(var d=t._reactName,y=[];n!==null&&n!==s;){var S=n,k=S.alternate,I=S.stateNode;if(S=S.tag,k!==null&&k===s)break;S!==5&&S!==26&&S!==27||I===null||(k=I,c?(I=dl(n,d),I!=null&&y.unshift(Yl(n,I,k))):c||(I=dl(n,d),I!=null&&y.push(Yl(n,I,k)))),n=n.return}y.length!==0&&e.push({event:t,listeners:y})}var Mv=/\r\n?/g,Av=/\u0000|\uFFFD/g;function ip(e){return(typeof e=="string"?e:""+e).replace(Mv,`
|
|
33
|
+
`).replace(Av,"")}function ap(e,t){return t=ip(t),ip(e)===t}function $e(e,t,n,s,c,d){switch(n){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||da(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&da(e,""+s);break;case"className":Ts(e,"class",s);break;case"tabIndex":Ts(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":Ts(e,n,s);break;case"style":af(e,s,d);break;case"data":if(t!=="object"){Ts(e,"data",s);break}case"src":case"href":if(s===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(s==null||typeof s=="function"||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(n);break}s=As(""+s),e.setAttribute(n,s);break;case"action":case"formAction":if(typeof s=="function"){e.setAttribute(n,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof d=="function"&&(n==="formAction"?(t!=="input"&&$e(e,t,"name",c.name,c,null),$e(e,t,"formEncType",c.formEncType,c,null),$e(e,t,"formMethod",c.formMethod,c,null),$e(e,t,"formTarget",c.formTarget,c,null)):($e(e,t,"encType",c.encType,c,null),$e(e,t,"method",c.method,c,null),$e(e,t,"target",c.target,c,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(n);break}s=As(""+s),e.setAttribute(n,s);break;case"onClick":s!=null&&(e.onclick=Tn);break;case"onScroll":s!=null&&Oe("scroll",e);break;case"onScrollEnd":s!=null&&Oe("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(o(61));if(n=s.__html,n!=null){if(c.children!=null)throw Error(o(60));e.innerHTML=n}}break;case"multiple":e.multiple=s&&typeof s!="function"&&typeof s!="symbol";break;case"muted":e.muted=s&&typeof s!="function"&&typeof s!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(s==null||typeof s=="function"||typeof s=="boolean"||typeof s=="symbol"){e.removeAttribute("xlink:href");break}n=As(""+s),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(n,""+s):e.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":s&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":s===!0?e.setAttribute(n,""):s!==!1&&s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(n,s):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":s!=null&&typeof s!="function"&&typeof s!="symbol"&&!isNaN(s)&&1<=s?e.setAttribute(n,s):e.removeAttribute(n);break;case"rowSpan":case"start":s==null||typeof s=="function"||typeof s=="symbol"||isNaN(s)?e.removeAttribute(n):e.setAttribute(n,s);break;case"popover":Oe("beforetoggle",e),Oe("toggle",e),Cs(e,"popover",s);break;case"xlinkActuate":Cn(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":Cn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":Cn(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":Cn(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":Cn(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":Cn(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":Cn(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":Cn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":Cn(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":Cs(e,"is",s);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=e0.get(n)||n,Cs(e,n,s))}}function uu(e,t,n,s,c,d){switch(n){case"style":af(e,s,d);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(o(61));if(n=s.__html,n!=null){if(c.children!=null)throw Error(o(60));e.innerHTML=n}}break;case"children":typeof s=="string"?da(e,s):(typeof s=="number"||typeof s=="bigint")&&da(e,""+s);break;case"onScroll":s!=null&&Oe("scroll",e);break;case"onScrollEnd":s!=null&&Oe("scrollend",e);break;case"onClick":s!=null&&(e.onclick=Tn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Pd.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(c=n.endsWith("Capture"),t=n.slice(2,c?n.length-7:void 0),d=e[Lt]||null,d=d!=null?d[n]:null,typeof d=="function"&&e.removeEventListener(t,d,c),typeof s=="function")){typeof d!="function"&&d!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,s,c);break e}n in e?e[n]=s:s===!0?e.setAttribute(n,""):Cs(e,n,s)}}}function xt(e,t,n){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 s=!1,c=!1,d;for(d in n)if(n.hasOwnProperty(d)){var y=n[d];if(y!=null)switch(d){case"src":s=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:$e(e,t,d,y,n,null)}}c&&$e(e,t,"srcSet",n.srcSet,n,null),s&&$e(e,t,"src",n.src,n,null);return;case"input":Oe("invalid",e);var S=d=y=c=null,k=null,I=null;for(s in n)if(n.hasOwnProperty(s)){var Z=n[s];if(Z!=null)switch(s){case"name":c=Z;break;case"type":y=Z;break;case"checked":k=Z;break;case"defaultChecked":I=Z;break;case"value":d=Z;break;case"defaultValue":S=Z;break;case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(o(137,t));break;default:$e(e,t,s,Z,n,null)}}Jd(e,d,S,k,I,y,c,!1);return;case"select":Oe("invalid",e),s=y=d=null;for(c in n)if(n.hasOwnProperty(c)&&(S=n[c],S!=null))switch(c){case"value":d=S;break;case"defaultValue":y=S;break;case"multiple":s=S;default:$e(e,t,c,S,n,null)}t=d,n=y,e.multiple=!!s,t!=null?ua(e,!!s,t,!1):n!=null&&ua(e,!!s,n,!0);return;case"textarea":Oe("invalid",e),d=c=s=null;for(y in n)if(n.hasOwnProperty(y)&&(S=n[y],S!=null))switch(y){case"value":s=S;break;case"defaultValue":c=S;break;case"children":d=S;break;case"dangerouslySetInnerHTML":if(S!=null)throw Error(o(91));break;default:$e(e,t,y,S,n,null)}tf(e,s,c,d);return;case"option":for(k in n)if(n.hasOwnProperty(k)&&(s=n[k],s!=null))switch(k){case"selected":e.selected=s&&typeof s!="function"&&typeof s!="symbol";break;default:$e(e,t,k,s,n,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(s=0;s<Gl.length;s++)Oe(Gl[s],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(I in n)if(n.hasOwnProperty(I)&&(s=n[I],s!=null))switch(I){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:$e(e,t,I,s,n,null)}return;default:if(Tr(t)){for(Z in n)n.hasOwnProperty(Z)&&(s=n[Z],s!==void 0&&uu(e,t,Z,s,n,void 0));return}}for(S in n)n.hasOwnProperty(S)&&(s=n[S],s!=null&&$e(e,t,S,s,n,null))}function Ev(e,t,n,s){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var c=null,d=null,y=null,S=null,k=null,I=null,Z=null;for($ in n){var te=n[$];if(n.hasOwnProperty($)&&te!=null)switch($){case"checked":break;case"value":break;case"defaultValue":k=te;default:s.hasOwnProperty($)||$e(e,t,$,null,s,te)}}for(var G in s){var $=s[G];if(te=n[G],s.hasOwnProperty(G)&&($!=null||te!=null))switch(G){case"type":d=$;break;case"name":c=$;break;case"checked":I=$;break;case"defaultChecked":Z=$;break;case"value":y=$;break;case"defaultValue":S=$;break;case"children":case"dangerouslySetInnerHTML":if($!=null)throw Error(o(137,t));break;default:$!==te&&$e(e,t,G,$,s,te)}}Sr(e,y,S,k,I,Z,d,c);return;case"select":$=y=S=G=null;for(d in n)if(k=n[d],n.hasOwnProperty(d)&&k!=null)switch(d){case"value":break;case"multiple":$=k;default:s.hasOwnProperty(d)||$e(e,t,d,null,s,k)}for(c in s)if(d=s[c],k=n[c],s.hasOwnProperty(c)&&(d!=null||k!=null))switch(c){case"value":G=d;break;case"defaultValue":S=d;break;case"multiple":y=d;default:d!==k&&$e(e,t,c,d,s,k)}t=S,n=y,s=$,G!=null?ua(e,!!n,G,!1):!!s!=!!n&&(t!=null?ua(e,!!n,t,!0):ua(e,!!n,n?[]:"",!1));return;case"textarea":$=G=null;for(S in n)if(c=n[S],n.hasOwnProperty(S)&&c!=null&&!s.hasOwnProperty(S))switch(S){case"value":break;case"children":break;default:$e(e,t,S,null,s,c)}for(y in s)if(c=s[y],d=n[y],s.hasOwnProperty(y)&&(c!=null||d!=null))switch(y){case"value":G=c;break;case"defaultValue":$=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(o(91));break;default:c!==d&&$e(e,t,y,c,s,d)}ef(e,G,$);return;case"option":for(var he in n)if(G=n[he],n.hasOwnProperty(he)&&G!=null&&!s.hasOwnProperty(he))switch(he){case"selected":e.selected=!1;break;default:$e(e,t,he,null,s,G)}for(k in s)if(G=s[k],$=n[k],s.hasOwnProperty(k)&&G!==$&&(G!=null||$!=null))switch(k){case"selected":e.selected=G&&typeof G!="function"&&typeof G!="symbol";break;default:$e(e,t,k,G,s,$)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Te in n)G=n[Te],n.hasOwnProperty(Te)&&G!=null&&!s.hasOwnProperty(Te)&&$e(e,t,Te,null,s,G);for(I in s)if(G=s[I],$=n[I],s.hasOwnProperty(I)&&G!==$&&(G!=null||$!=null))switch(I){case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(o(137,t));break;default:$e(e,t,I,G,s,$)}return;default:if(Tr(t)){for(var qe in n)G=n[qe],n.hasOwnProperty(qe)&&G!==void 0&&!s.hasOwnProperty(qe)&&uu(e,t,qe,void 0,s,G);for(Z in s)G=s[Z],$=n[Z],!s.hasOwnProperty(Z)||G===$||G===void 0&&$===void 0||uu(e,t,Z,G,s,$);return}}for(var B in n)G=n[B],n.hasOwnProperty(B)&&G!=null&&!s.hasOwnProperty(B)&&$e(e,t,B,null,s,G);for(te in s)G=s[te],$=n[te],!s.hasOwnProperty(te)||G===$||G==null&&$==null||$e(e,t,te,G,s,$)}function lp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Nv(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),s=0;s<n.length;s++){var c=n[s],d=c.transferSize,y=c.initiatorType,S=c.duration;if(d&&S&&lp(y)){for(y=0,S=c.responseEnd,s+=1;s<n.length;s++){var k=n[s],I=k.startTime;if(I>S)break;var Z=k.transferSize,te=k.initiatorType;Z&&lp(te)&&(k=k.responseEnd,y+=Z*(k<S?1:(S-I)/(k-I)))}if(--s,t+=8*(d+y)/(c.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 du=null,fu=null;function So(e){return e.nodeType===9?e:e.ownerDocument}function sp(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 op(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 hu(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 mu=null;function kv(){var e=window.event;return e&&e.type==="popstate"?e===mu?!1:(mu=e,!0):(mu=null,!1)}var rp=typeof setTimeout=="function"?setTimeout:void 0,Lv=typeof clearTimeout=="function"?clearTimeout:void 0,cp=typeof Promise=="function"?Promise:void 0,Rv=typeof queueMicrotask=="function"?queueMicrotask:typeof cp<"u"?function(e){return cp.resolve(null).then(e).catch(_v)}:rp;function _v(e){setTimeout(function(){throw e})}function hi(e){return e==="head"}function up(e,t){var n=t,s=0;do{var c=n.nextSibling;if(e.removeChild(n),c&&c.nodeType===8)if(n=c.data,n==="/$"||n==="/&"){if(s===0){e.removeChild(c),Fa(t);return}s--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")s++;else if(n==="html")$l(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,$l(n);for(var d=n.firstChild;d;){var y=d.nextSibling,S=d.nodeName;d[cl]||S==="SCRIPT"||S==="STYLE"||S==="LINK"&&d.rel.toLowerCase()==="stylesheet"||n.removeChild(d),d=y}}else n==="body"&&$l(e.ownerDocument.body);n=c}while(n);Fa(t)}function dp(e,t){var n=e;e=0;do{var s=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),s&&s.nodeType===8)if(n=s.data,n==="/$"){if(e===0)break;e--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=s}while(n)}function pu(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":pu(n),xr(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function jv(e,t,n,s){for(;e.nodeType===1;){var c=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!s&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(s){if(!e[cl])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!==c.rel||e.getAttribute("href")!==(c.href==null||c.href===""?null:c.href)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin)||e.getAttribute("title")!==(c.title==null?null:c.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(d=e.getAttribute("src"),(d!==(c.src==null?null:c.src)||e.getAttribute("type")!==(c.type==null?null:c.type)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&d&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var d=c.name==null?null:""+c.name;if(c.type==="hidden"&&e.getAttribute("name")===d)return e}else return e;if(e=nn(e.nextSibling),e===null)break}return null}function Ov(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=nn(e.nextSibling),e===null))return null;return e}function fp(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=nn(e.nextSibling),e===null))return null;return e}function gu(e){return e.data==="$?"||e.data==="$~"}function bu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Dv(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var s=function(){t(),n.removeEventListener("DOMContentLoaded",s)};n.addEventListener("DOMContentLoaded",s),e._reactRetry=s}}function nn(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 yu=null;function hp(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return nn(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function mp(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(t===0)return e;t--}else n!=="/$"&&n!=="/&"||t++}e=e.previousSibling}return null}function pp(e,t,n){switch(t=So(n),e){case"html":if(e=t.documentElement,!e)throw Error(o(452));return e;case"head":if(e=t.head,!e)throw Error(o(453));return e;case"body":if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function $l(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);xr(e)}var an=new Map,gp=new Set;function Co(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Kn=Y.d;Y.d={f:zv,r:Hv,D:Bv,C:Uv,L:Kv,m:Iv,X:Gv,S:Fv,M:Yv};function zv(){var e=Kn.f(),t=mo();return e||t}function Hv(e){var t=oa(e);t!==null&&t.tag===5&&t.type==="form"?jh(t):Kn.r(e)}var Ua=typeof document>"u"?null:document;function bp(e,t,n){var s=Ua;if(s&&typeof t=="string"&&t){var c=Xt(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof n=="string"&&(c+='[crossorigin="'+n+'"]'),gp.has(c)||(gp.add(c),e={rel:e,crossOrigin:n,href:t},s.querySelector(c)===null&&(t=s.createElement("link"),xt(t,"link",e),ht(t),s.head.appendChild(t)))}}function Bv(e){Kn.D(e),bp("dns-prefetch",e,null)}function Uv(e,t){Kn.C(e,t),bp("preconnect",e,t)}function Kv(e,t,n){Kn.L(e,t,n);var s=Ua;if(s&&e&&t){var c='link[rel="preload"][as="'+Xt(t)+'"]';t==="image"&&n&&n.imageSrcSet?(c+='[imagesrcset="'+Xt(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(c+='[imagesizes="'+Xt(n.imageSizes)+'"]')):c+='[href="'+Xt(e)+'"]';var d=c;switch(t){case"style":d=Ka(e);break;case"script":d=Ia(e)}an.has(d)||(e=v({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),an.set(d,e),s.querySelector(c)!==null||t==="style"&&s.querySelector(ql(d))||t==="script"&&s.querySelector(Vl(d))||(t=s.createElement("link"),xt(t,"link",e),ht(t),s.head.appendChild(t)))}}function Iv(e,t){Kn.m(e,t);var n=Ua;if(n&&e){var s=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+Xt(s)+'"][href="'+Xt(e)+'"]',d=c;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":d=Ia(e)}if(!an.has(d)&&(e=v({rel:"modulepreload",href:e},t),an.set(d,e),n.querySelector(c)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Vl(d)))return}s=n.createElement("link"),xt(s,"link",e),ht(s),n.head.appendChild(s)}}}function Fv(e,t,n){Kn.S(e,t,n);var s=Ua;if(s&&e){var c=ra(s).hoistableStyles,d=Ka(e);t=t||"default";var y=c.get(d);if(!y){var S={loading:0,preload:null};if(y=s.querySelector(ql(d)))S.loading=5;else{e=v({rel:"stylesheet",href:e,"data-precedence":t},n),(n=an.get(d))&&vu(e,n);var k=y=s.createElement("link");ht(k),xt(k,"link",e),k._p=new Promise(function(I,Z){k.onload=I,k.onerror=Z}),k.addEventListener("load",function(){S.loading|=1}),k.addEventListener("error",function(){S.loading|=2}),S.loading|=4,To(y,t,s)}y={type:"stylesheet",instance:y,count:1,state:S},c.set(d,y)}}}function Gv(e,t){Kn.X(e,t);var n=Ua;if(n&&e){var s=ra(n).hoistableScripts,c=Ia(e),d=s.get(c);d||(d=n.querySelector(Vl(c)),d||(e=v({src:e,async:!0},t),(t=an.get(c))&&xu(e,t),d=n.createElement("script"),ht(d),xt(d,"link",e),n.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},s.set(c,d))}}function Yv(e,t){Kn.M(e,t);var n=Ua;if(n&&e){var s=ra(n).hoistableScripts,c=Ia(e),d=s.get(c);d||(d=n.querySelector(Vl(c)),d||(e=v({src:e,async:!0,type:"module"},t),(t=an.get(c))&&xu(e,t),d=n.createElement("script"),ht(d),xt(d,"link",e),n.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},s.set(c,d))}}function yp(e,t,n,s){var c=(c=we.current)?Co(c):null;if(!c)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=Ka(n.href),n=ra(c).hoistableStyles,s=n.get(t),s||(s={type:"style",instance:null,count:0,state:null},n.set(t,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=Ka(n.href);var d=ra(c).hoistableStyles,y=d.get(e);if(y||(c=c.ownerDocument||c,y={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},d.set(e,y),(d=c.querySelector(ql(e)))&&!d._p&&(y.instance=d,y.state.loading=5),an.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},an.set(e,n),d||$v(c,e,n,y.state))),t&&s===null)throw Error(o(528,""));return y}if(t&&s!==null)throw Error(o(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Ia(n),n=ra(c).hoistableScripts,s=n.get(t),s||(s={type:"script",instance:null,count:0,state:null},n.set(t,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function Ka(e){return'href="'+Xt(e)+'"'}function ql(e){return'link[rel="stylesheet"]['+e+"]"}function vp(e){return v({},e,{"data-precedence":e.precedence,precedence:null})}function $v(e,t,n,s){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?s.loading=1:(t=e.createElement("link"),s.preload=t,t.addEventListener("load",function(){return s.loading|=1}),t.addEventListener("error",function(){return s.loading|=2}),xt(t,"link",n),ht(t),e.head.appendChild(t))}function Ia(e){return'[src="'+Xt(e)+'"]'}function Vl(e){return"script[async]"+e}function xp(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+Xt(n.href)+'"]');if(s)return t.instance=s,ht(s),s;var c=v({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),ht(s),xt(s,"style",c),To(s,n.precedence,e),t.instance=s;case"stylesheet":c=Ka(n.href);var d=e.querySelector(ql(c));if(d)return t.state.loading|=4,t.instance=d,ht(d),d;s=vp(n),(c=an.get(c))&&vu(s,c),d=(e.ownerDocument||e).createElement("link"),ht(d);var y=d;return y._p=new Promise(function(S,k){y.onload=S,y.onerror=k}),xt(d,"link",s),t.state.loading|=4,To(d,n.precedence,e),t.instance=d;case"script":return d=Ia(n.src),(c=e.querySelector(Vl(d)))?(t.instance=c,ht(c),c):(s=n,(c=an.get(d))&&(s=v({},n),xu(s,c)),e=e.ownerDocument||e,c=e.createElement("script"),ht(c),xt(c,"link",s),e.head.appendChild(c),t.instance=c);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(s=t.instance,t.state.loading|=4,To(s,n.precedence,e));return t.instance}function To(e,t,n){for(var s=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=s.length?s[s.length-1]:null,d=c,y=0;y<s.length;y++){var S=s[y];if(S.dataset.precedence===t)d=S;else if(d!==c)break}d?d.parentNode.insertBefore(e,d.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function vu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function xu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Mo=null;function wp(e,t,n){if(Mo===null){var s=new Map,c=Mo=new Map;c.set(n,s)}else c=Mo,s=c.get(n),s||(s=new Map,c.set(n,s));if(s.has(e))return s;for(s.set(e,null),n=n.getElementsByTagName(e),c=0;c<n.length;c++){var d=n[c];if(!(d[cl]||d[gt]||e==="link"&&d.getAttribute("rel")==="stylesheet")&&d.namespaceURI!=="http://www.w3.org/2000/svg"){var y=d.getAttribute(t)||"";y=e+y;var S=s.get(y);S?S.push(d):s.set(y,[d])}}return s}function Sp(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function qv(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Cp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Vv(e,t,n,s){if(n.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var c=Ka(s.href),d=t.querySelector(ql(c));if(d){t=d._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Ao.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=d,ht(d);return}d=t.ownerDocument||t,s=vp(s),(c=an.get(c))&&vu(s,c),d=d.createElement("link"),ht(d);var y=d;y._p=new Promise(function(S,k){y.onload=S,y.onerror=k}),xt(d,"link",s),n.instance=d}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=Ao.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var wu=0;function Pv(e,t){return e.stylesheets&&e.count===0&&No(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var s=setTimeout(function(){if(e.stylesheets&&No(e,e.stylesheets),e.unsuspend){var d=e.unsuspend;e.unsuspend=null,d()}},6e4+t);0<e.imgBytes&&wu===0&&(wu=62500*Nv());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&No(e,e.stylesheets),e.unsuspend)){var d=e.unsuspend;e.unsuspend=null,d()}},(e.imgBytes>wu?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(c)}}:null}function Ao(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)No(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Eo=null;function No(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Eo=new Map,t.forEach(Xv,e),Eo=null,Ao.call(e))}function Xv(e,t){if(!(t.state.loading&4)){var n=Eo.get(e);if(n)var s=n.get(null);else{n=new Map,Eo.set(e,n);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;d<c.length;d++){var y=c[d];(y.nodeName==="LINK"||y.getAttribute("media")!=="not all")&&(n.set(y.dataset.precedence,y),s=y)}s&&n.set(null,s)}c=t.instance,y=c.getAttribute("data-precedence"),d=n.get(y)||s,d===s&&n.set(null,c),n.set(y,c),this.count++,s=Ao.bind(this),c.addEventListener("load",s),c.addEventListener("error",s),d?d.parentNode.insertBefore(c,d.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(c,e.firstChild)),t.state.loading|=4}}var Pl={$$typeof:j,Provider:null,Consumer:null,_currentValue:X,_currentValue2:X,_threadCount:0};function Qv(e,t,n,s,c,d,y,S,k){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=gr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gr(0),this.hiddenUpdates=gr(null),this.identifierPrefix=s,this.onUncaughtError=c,this.onCaughtError=d,this.onRecoverableError=y,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=k,this.incompleteTransitions=new Map}function Tp(e,t,n,s,c,d,y,S,k,I,Z,te){return e=new Qv(e,t,n,y,k,I,Z,te,S),t=1,d===!0&&(t|=24),d=Kt(3,null,null,t),e.current=d,d.stateNode=e,t=ec(),t.refCount++,e.pooledCache=t,t.refCount++,d.memoizedState={element:s,isDehydrated:n,cache:t},ac(d),e}function Mp(e){return e?(e=ya,e):ya}function Ap(e,t,n,s,c,d){c=Mp(c),s.context===null?s.context=c:s.pendingContext=c,s=ni(t),s.payload={element:n},d=d===void 0?null:d,d!==null&&(s.callback=d),n=ii(e,s,t),n!==null&&(zt(n,e,t),Al(n,e,t))}function Ep(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Su(e,t){Ep(e,t),(e=e.alternate)&&Ep(e,t)}function Np(e){if(e.tag===13||e.tag===31){var t=Hi(e,67108864);t!==null&&zt(t,e,67108864),Su(e,67108864)}}function kp(e){if(e.tag===13||e.tag===31){var t=$t();t=br(t);var n=Hi(e,t);n!==null&&zt(n,e,t),Su(e,t)}}var ko=!0;function Zv(e,t,n,s){var c=E.T;E.T=null;var d=Y.p;try{Y.p=2,Cu(e,t,n,s)}finally{Y.p=d,E.T=c}}function Wv(e,t,n,s){var c=E.T;E.T=null;var d=Y.p;try{Y.p=8,Cu(e,t,n,s)}finally{Y.p=d,E.T=c}}function Cu(e,t,n,s){if(ko){var c=Tu(s);if(c===null)cu(e,t,s,Lo,n),Rp(e,s);else if(ex(c,e,t,n,s))s.stopPropagation();else if(Rp(e,s),t&4&&-1<Jv.indexOf(e)){for(;c!==null;){var d=oa(c);if(d!==null)switch(d.tag){case 3:if(d=d.stateNode,d.current.memoizedState.isDehydrated){var y=_i(d.pendingLanes);if(y!==0){var S=d;for(S.pendingLanes|=2,S.entangledLanes|=2;y;){var k=1<<31-Ct(y);S.entanglements[1]|=k,y&=~k}bn(d),(Ie&6)===0&&(fo=St()+500,Fl(0))}}break;case 31:case 13:S=Hi(d,2),S!==null&&zt(S,d,2),mo(),Su(d,2)}if(d=Tu(s),d===null&&cu(e,t,s,Lo,n),d===c)break;c=d}c!==null&&s.stopPropagation()}else cu(e,t,s,null,n)}}function Tu(e){return e=Ar(e),Mu(e)}var Lo=null;function Mu(e){if(Lo=null,e=sa(e),e!==null){var t=u(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=h(t),e!==null)return e;e=null}else if(n===31){if(e=m(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Lo=e,null}function Lp(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(bs()){case al:return 2;case ll:return 8;case ki:case ys:return 32;case sl:return 268435456;default:return 32}default:return 32}}var Au=!1,mi=null,pi=null,gi=null,Xl=new Map,Ql=new Map,bi=[],Jv="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 Rp(e,t){switch(e){case"focusin":case"focusout":mi=null;break;case"dragenter":case"dragleave":pi=null;break;case"mouseover":case"mouseout":gi=null;break;case"pointerover":case"pointerout":Xl.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ql.delete(t.pointerId)}}function Zl(e,t,n,s,c,d){return e===null||e.nativeEvent!==d?(e={blockedOn:t,domEventName:n,eventSystemFlags:s,nativeEvent:d,targetContainers:[c]},t!==null&&(t=oa(t),t!==null&&Np(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function ex(e,t,n,s,c){switch(t){case"focusin":return mi=Zl(mi,e,t,n,s,c),!0;case"dragenter":return pi=Zl(pi,e,t,n,s,c),!0;case"mouseover":return gi=Zl(gi,e,t,n,s,c),!0;case"pointerover":var d=c.pointerId;return Xl.set(d,Zl(Xl.get(d)||null,e,t,n,s,c)),!0;case"gotpointercapture":return d=c.pointerId,Ql.set(d,Zl(Ql.get(d)||null,e,t,n,s,c)),!0}return!1}function _p(e){var t=sa(e.target);if(t!==null){var n=u(t);if(n!==null){if(t=n.tag,t===13){if(t=h(n),t!==null){e.blockedOn=t,$d(e.priority,function(){kp(n)});return}}else if(t===31){if(t=m(n),t!==null){e.blockedOn=t,$d(e.priority,function(){kp(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ro(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Tu(e.nativeEvent);if(n===null){n=e.nativeEvent;var s=new n.constructor(n.type,n);Mr=s,n.target.dispatchEvent(s),Mr=null}else return t=oa(n),t!==null&&Np(t),e.blockedOn=n,!1;t.shift()}return!0}function jp(e,t,n){Ro(e)&&n.delete(t)}function tx(){Au=!1,mi!==null&&Ro(mi)&&(mi=null),pi!==null&&Ro(pi)&&(pi=null),gi!==null&&Ro(gi)&&(gi=null),Xl.forEach(jp),Ql.forEach(jp)}function _o(e,t){e.blockedOn===t&&(e.blockedOn=null,Au||(Au=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,tx)))}var jo=null;function Op(e){jo!==e&&(jo=e,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){jo===e&&(jo=null);for(var t=0;t<e.length;t+=3){var n=e[t],s=e[t+1],c=e[t+2];if(typeof s!="function"){if(Mu(s||n)===null)continue;break}var d=oa(n);d!==null&&(e.splice(t,3),t-=3,Tc(d,{pending:!0,data:c,method:n.method,action:s},s,c))}}))}function Fa(e){function t(k){return _o(k,e)}mi!==null&&_o(mi,e),pi!==null&&_o(pi,e),gi!==null&&_o(gi,e),Xl.forEach(t),Ql.forEach(t);for(var n=0;n<bi.length;n++){var s=bi[n];s.blockedOn===e&&(s.blockedOn=null)}for(;0<bi.length&&(n=bi[0],n.blockedOn===null);)_p(n),n.blockedOn===null&&bi.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(s=0;s<n.length;s+=3){var c=n[s],d=n[s+1],y=c[Lt]||null;if(typeof d=="function")y||Op(n);else if(y){var S=null;if(d&&d.hasAttribute("formAction")){if(c=d,y=d[Lt]||null)S=y.formAction;else if(Mu(c)!==null)continue}else S=y.action;typeof S=="function"?n[s+1]=S:(n.splice(s,3),s-=3),Op(n)}}}function Dp(){function e(d){d.canIntercept&&d.info==="react-transition"&&d.intercept({handler:function(){return new Promise(function(y){return c=y})},focusReset:"manual",scroll:"manual"})}function t(){c!==null&&(c(),c=null),s||setTimeout(n,20)}function n(){if(!s&&!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 s=!1,c=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){s=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),c!==null&&(c(),c=null)}}}function Eu(e){this._internalRoot=e}Oo.prototype.render=Eu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var n=t.current,s=$t();Ap(n,s,e,t,null,null)},Oo.prototype.unmount=Eu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Ap(e.current,2,null,e,null,null),mo(),t[la]=null}};function Oo(e){this._internalRoot=e}Oo.prototype.unstable_scheduleHydration=function(e){if(e){var t=Yd();e={blockedOn:null,target:e,priority:t};for(var n=0;n<bi.length&&t!==0&&t<bi[n].priority;n++);bi.splice(n,0,e),n===0&&_p(e)}};var zp=i.version;if(zp!=="19.2.8")throw Error(o(527,zp,"19.2.8"));Y.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=g(t),e=e!==null?b(e):null,e=e===null?null:e.stateNode,e};var nx={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:E,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Do=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Do.isDisabled&&Do.supportsFiber)try{Li=Do.inject(nx),Mt=Do}catch{}}return Jl.createRoot=function(e,t){if(!r(e))throw Error(o(299));var n=!1,s="",c=Gh,d=Yh,y=$h;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onUncaughtError!==void 0&&(c=t.onUncaughtError),t.onCaughtError!==void 0&&(d=t.onCaughtError),t.onRecoverableError!==void 0&&(y=t.onRecoverableError)),t=Tp(e,1,!1,null,null,n,s,null,c,d,y,Dp),e[la]=t.current,ru(e),new Eu(t)},Jl.hydrateRoot=function(e,t,n){if(!r(e))throw Error(o(299));var s=!1,c="",d=Gh,y=Yh,S=$h,k=null;return n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(c=n.identifierPrefix),n.onUncaughtError!==void 0&&(d=n.onUncaughtError),n.onCaughtError!==void 0&&(y=n.onCaughtError),n.onRecoverableError!==void 0&&(S=n.onRecoverableError),n.formState!==void 0&&(k=n.formState)),t=Tp(e,1,!0,t,n??null,s,c,k,d,y,S,Dp),t.context=Mp(null),n=t.current,s=$t(),s=br(s),c=ni(s),c.callback=null,ii(n,c,s),n=s,t.current.lanes=n,rl(t,n),bn(t),e[la]=t.current,ru(e),new Oo(t)},Jl.version="19.2.8",Jl}var Fp;function hx(){if(Fp)return ku.exports;Fp=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(i){console.error(i)}}return a(),ku.exports=fx(),ku.exports}var mx=hx();const px=nb(mx),ab={header:{appName:"Herdr",tagline:"remote terminal client",terminalTab:"Terminal",adminTab:"Admin",rttMs:"{rtt}ms",hostLabel:"Host",clientIdLabel:"ID:",copyClientIdTitle:"Click to copy Client ID",languageToggleTitle:"Switch language (EN / 中文)",pairingTitle:"Connection & pairing",settingsTitle:"Terminal settings",virtualKeyboardTitle:"Quick command helper",latencyTitle:"Round-trip latency (RTT)",mainNavigationAria:"Main Navigation",actionKeyboard:"cmd",actionPairing:"link",actionSettings:"cfg",languageShort:"en"},common:{connecting:"Connecting...",connected:"Connected",reconnecting:"Reconnecting...",disconnected:"Disconnected",error:"Error",save:"Save",cancel:"Cancel",close:"Close",done:"Done",retry:"Retry",connect:"Connect",disconnect:"Disconnect",copy:"Copy",copied:"Copied",loading:"Loading...",offline:"Offline",role:"Role",host:"Host",status:"Status",settings:"Settings",admin:"Admin",terminal:"Terminal",pairing:"Pairing",keyBar:"Key bar",quickInput:"Quick input",dismissNotification:"Dismiss notification",closeDialog:"Close dialog",clickToCopy:"Click to copy",controller:"Controller",viewer:"Viewer",live:"Live"},connection:{live:"Live",connecting:"Connecting",reconnecting:"Reconnecting",reconnectNow:"Reconnect now",error:"Error",offline:"Offline",connect:"Connect",retry:"Retry"},role:{controllerMode:"Controller mode active",viewerMode:"Viewer mode",controlActive:"Full Control",viewerReadOnly:"Viewer",viewerWithController:"Viewer (Active: {controllerId})",sharedControl:"Full control",sharedControlDesc:"Every paired window shares this terminal and may type into it.",sharedWindows:"{count} windows",thisWindow:"Window",claimControl:"Claim Control",claimControlTitle:"Claim terminal control",releaseControl:"Release",releaseControlTitle:"Switch to viewer mode",takeoverControl:"Takeover",takeoverControlTitle:"Take over control from {controllerId}",takeoverModalTitle:"Confirm Control Takeover",takeoverModalDesc:"Another client is controlling this terminal.",takeoverModalWarning:"Input focus will transfer to this window.",confirmTakeover:"Confirm Takeover"},statusBanner:{connecting:"Connecting to relay...",reconnectingDefault:"Connection lost. Reconnecting...",reconnectNow:"Reconnect Now",errorDefault:"Unable to connect to relay",disconnected:"Terminal disconnected"},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"},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 5 minutes; credentials are saved automatically.",connectAndPair:"Connect & Pair",connectingAndPairing:"Pairing with Relay...",advancedTitle:"Advanced Options",manualTokenLabel:"Authentication Token",manualTokenPlaceholder:"Optional token (skips pairing code)",wsEndpointLabel:"Relay WebSocket Endpoint",wsEndpointPlaceholder:"/ws/client or wss://your-relay-host/ws/client",clientIdLabel:"Device Client Identifier"},pairing:{title:"Relay Connection & Pairing",addTitle:"Add Herdr Instance",displayNameLabel:"Host Name",displayNamePlaceholder:"e.g. Workstation",displayNameHelp:"This name is stored only in this browser.",credentialsRequired:"Enter a pairing code or device token.",subtitle:"Manage WebSocket endpoints and credentials",pairCodeLabel:"Pairing Code",pairCodeNote:"(6-char code)",pairCodePlaceholder:"e.g. A1B2C3",pairCodeHelp:'Run "herdr-remote pair" on host.',tokenLabel:"Access Token",tokenNote:"(Device secret)",tokenPlaceholder:"Device token...",wsUrlLabel:"Relay WebSocket Endpoint URL",wsUrlPlaceholder:"/ws/client",wsUrlDefaultNote:"Defaults to same-origin /ws/client",clientIdLabel:"Client Identifier",newIdButton:"New ID",regenerateClientIdTitle:"Regenerate client ID",autoReconnectLabel:"Auto-reconnect",autoReconnectDesc:"Automatically reconnect when disconnected",copyDirectLink:"Copy direct pairing link",saveAndConnect:"Save & Connect"},settings:{title:"Terminal Preferences",subtitle:"Interface, font, input and alerts",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",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"},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",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:'In viewer mode. Click "Claim Control" first.',clientIdCopied:"Client ID copied: {id}",pairingLinkCopied:"Pairing link copied",switchedLanguage:"Language switched to {lang}",settingsReset:"Settings reset to default",fontReset:"Font reset to default",commandCopied:"Command copied",keyLayoutReset:"Key layout reset"},shortcuts:{title:"Shortcuts",help:"Active outside terminal input area:",terminalInputNote:"Terminal shortcuts pass directly to host PTY."},serverErrors:{auth_required:"Pairing required: enter a pairing code, or a device token that is still valid.",unauthorized:"This device is not authorised for that workstation.",host_offline:"The paired workstation is not connected to this relay.",host_disconnected:"The workstation disconnected.",stale_host:"The workstation stopped answering and was dropped.",too_many_clients:"That workstation has reached its window limit.",rate_limited:"Too many pairing attempts. Wait a minute and try again.",invalid_handshake:"The relay rejected the handshake. Reload the page.",device_revoked:"This device was revoked by the relay operator.",connection_closed:"Connection closed. Reconnecting…",connection_stale:"The connection went quiet while the page was away. Reconnecting…",connection_stalled:"Connecting took too long. Trying again…",connection_failed:"Could not open a connection to the relay.",host_reconnecting:"The Herdr host is reconnecting.",host_reconnect_timeout:"The Herdr host did not reconnect in time.",host_replaced:"The Herdr host connection was replaced.",slow_client:"This browser was disconnected because it could not keep up.",client_send_failed:"The relay could not send data to this browser.",too_many_hosts:"This relay has reached its host limit.",paste_file_unsupported:"Unsupported image format for paste.",paste_file_too_large:"Pasted image exceeds 3 MB limit.",paste_file_write_failed:"Failed to save pasted image on host.",paste_file_empty:"Pasted image payload is empty.",paste_file_corrupt:"Pasted image data is corrupt or does not match declared MIME.",viewer_mode:"Viewer mode cannot paste to terminal.",no_session:"Terminal session is not ready."},fontPresets:{host:"Workstation terminal 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"}},gx={header:{appName:"Herdr",tagline:"远程终端客户端",terminalTab:"终端",adminTab:"管理面板",rttMs:"{rtt}ms",hostLabel:"主机",clientIdLabel:"客户端 ID:",copyClientIdTitle:"点击复制客户端 ID",languageToggleTitle:"切换语言 (EN / 中文)",pairingTitle:"连接与配对",settingsTitle:"终端设置",virtualKeyboardTitle:"快捷命令",latencyTitle:"网络延迟 (RTT)",mainNavigationAria:"主导航菜单",actionKeyboard:"命令",actionPairing:"配对",actionSettings:"设置",languageShort:"中"},common:{connecting:"连接中...",connected:"已连接",reconnecting:"重连中...",disconnected:"已断开",error:"错误",save:"保存",cancel:"取消",close:"关闭",done:"完成",retry:"重试",connect:"连接",disconnect:"断开连接",copy:"复制",copied:"已复制",loading:"加载中...",offline:"离线",role:"角色",host:"主机",status:"连接状态",settings:"设置",admin:"管理面板",terminal:"终端",pairing:"配对",keyBar:"按键条",quickInput:"快捷输入",dismissNotification:"关闭通知",closeDialog:"关闭对话框",clickToCopy:"点击复制",controller:"控制端",viewer:"观察者",live:"运行中"},connection:{live:"在线",connecting:"连接中",reconnecting:"正在重连",reconnectNow:"立即重连",error:"连接错误",offline:"离线",connect:"发起连接",retry:"重试"},role:{controllerMode:"控制模式",viewerMode:"观察者模式",controlActive:"控制端",viewerReadOnly:"观察者",viewerWithController:"观察者(控制者: {controllerId})",sharedControl:"完全控制",sharedControlDesc:"所有已配对窗口共享同一个终端,均可输入。",sharedWindows:"{count} 个窗口",thisWindow:"本窗口",claimControl:"获取控制权",claimControlTitle:"获取终端控制权",releaseControl:"释放控制权",releaseControlTitle:"切回观察者模式",takeoverControl:"强占控制权",takeoverControlTitle:"从 {controllerId} 接管控制权",takeoverModalTitle:"确认接管终端控制权?",takeoverModalDesc:"当前已有其他客户端控制该终端。",takeoverModalWarning:"接管后输入焦点切换至当前窗口。",confirmTakeover:"确认接管"},statusBanner:{connecting:"连接 Relay 服务中...",reconnectingDefault:"连接断开,正在重连...",reconnectNow:"立即重连",errorDefault:"无法连接 Relay 服务",disconnected:"会话已断开"},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:"忽略此版本"},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:"配对码 5 分钟内有效,连接后自动保存凭据。",connectAndPair:"连接并完成配对",connectingAndPairing:"配对中...",advancedTitle:"高级选项",manualTokenLabel:"认证 Token",manualTokenPlaceholder:"可选 Token(跳过配对码)",wsEndpointLabel:"Relay WebSocket 端点",wsEndpointPlaceholder:"/ws/client 或 wss://relay-host/ws/client",clientIdLabel:"客户端标识 (Client ID)"},pairing:{title:"Relay 连接与配对",addTitle:"添加 Herdr 实例",displayNameLabel:"主机名称",displayNamePlaceholder:"例如:工作电脑",displayNameHelp:"名称仅保存在此浏览器中。",credentialsRequired:"请输入配对码或设备令牌。",subtitle:"管理 WebSocket 服务端点与凭证",pairCodeLabel:"配对码",pairCodeNote:"(6 位代码)",pairCodePlaceholder:"例如:A1B2C3",pairCodeHelp:'在主机运行 "herdr-remote pair" 获取。',tokenLabel:"访问 Token",tokenNote:"(设备凭据)",tokenPlaceholder:"设备 Token...",wsUrlLabel:"Relay WebSocket 端点",wsUrlPlaceholder:"/ws/client",wsUrlDefaultNote:'默认同源端点 "/ws/client"',clientIdLabel:"客户端标识",newIdButton:"生成新 ID",regenerateClientIdTitle:"重新生成客户端 ID",autoReconnectLabel:"掉线自动重连",autoReconnectDesc:"连接断开时自动尝试重连",copyDirectLink:"复制配对链接(含配对码)",saveAndConnect:"保存并连接"},settings:{title:"终端设置",subtitle:"界面、字体、输入与提醒",tabGeneral:"通用",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:"显示语言",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:"获取终端控制权"},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}",relayAdminPrompt:"输入 RELAY_ADMIN_TOKEN,查看本 Relay 的主机、设备与流量。"},toasts:{connected:"已连接至 Relay 服务",connectionError:"连接发生错误",controlGranted:"已获得控制权",pairedSuccess:"设备配对成功,已保存凭证",sessionEnded:"终端会话已结束",controlReleased:"已释放控制权,切回观察者模式",viewerModeWarning:"处于观察者模式,请先获取控制权",clientIdCopied:"客户端 ID 已复制: {id}",pairingLinkCopied:"配对链接已复制",switchedLanguage:"语言已切换为 {lang}",settingsReset:"设置已恢复默认",fontReset:"字体已恢复默认",commandCopied:"命令已复制",keyLayoutReset:"虚拟按键布局已恢复默认"},shortcuts:{title:"WebUI 快捷键",help:"以下快捷键仅在非终端输入区域生效:",terminalInputNote:"终端操作快捷键直接透传至宿主 PTY。"},serverErrors:{auth_required:"需要配对:请输入配对码,或填写仍然有效的设备令牌。",unauthorized:"该设备无权访问此工作站。",host_offline:"已配对的工作站未连接到该 relay。",host_disconnected:"工作站已断开连接。",stale_host:"工作站长时间无响应,已被断开。",too_many_clients:"该工作站的窗口数量已达上限。",rate_limited:"配对尝试过于频繁,请稍后再试。",invalid_handshake:"relay 拒绝了握手,请刷新页面。",device_revoked:"该设备已被 relay 管理员撤销。",connection_closed:"连接已断开,正在重连…",connection_stale:"页面回到前台时连接已无响应,正在重连…",connection_stalled:"连接超时,正在重试…",connection_failed:"无法建立到 relay 的连接。",host_reconnecting:"Herdr 主机正在重连。",host_reconnect_timeout:"Herdr 主机未能及时恢复连接。",host_replaced:"Herdr 主机连接已被替换。",slow_client:"由于浏览器处理速度过慢,连接已关闭。",client_send_failed:"Relay 无法向此浏览器发送数据。",too_many_hosts:"此 relay 已达到主机数量上限。",paste_file_unsupported:"不支持的粘贴图片格式。",paste_file_too_large:"粘贴图片超过 3 MB 上限。",paste_file_write_failed:"工作站保存图片失败。",paste_file_empty:"粘贴图片内容为空。",paste_file_corrupt:"粘贴图片数据损坏或与声明格式不符。",viewer_mode:"观察者模式无法粘贴到终端。",no_session:"终端会话未准备就绪。"},fontPresets:{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:ab,zh:gx};function wd(a,i,l){const o=_u[a]||_u.en,r=i.split(".");let u=o;for(const h of r)if(u&&typeof u=="object"&&h in u)u=u[h];else{let m=_u.en;for(const p of r)if(m&&typeof m=="object"&&p in m)m=m[p];else return i;u=m;break}if(typeof u!="string")return i;if(l){let h=u;for(const[m,p]of Object.entries(l))h=h.replaceAll(`{${m}}`,String(p));return h}return u}function ju(a){return typeof a=="string"&&Object.hasOwn(ab.serverErrors,a)}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~"},bx=new TextEncoder;function Sd(a){return bx.encode(a)}function lb(a){if(!a||a.length===0)return"";const l=a.toUpperCase().charCodeAt(0);return l>=65&&l<=90?String.fromCharCode(l-64):a==="@"||a===" "?"\0":a==="["?"\x1B":a==="\\"?"":a==="]"?"":a==="^"?"":a==="_"?"":a==="?"?"":a}function yx(a){return`\x1B${a}`}function Gp({ctrl:a,alt:i,shift:l}){return 1+(l?1:0)+(i?2:0)+(a?4:0)}const sb=/^\x1b[[O]([ABCDHF])$/,ob=/^\x1bO([PQRS])$/,rb=/^\x1b\[(\d+)~$/;function tr(a,i){const{ctrl:l=!1,alt:o=!1,shift:r=!1}=i;if(!l&&!o&&!r)return a;const u=Gp(i),h=o&&!l&&!r,m=sb.exec(a);if(m)return`\x1B[1;${u}${m[1]}`;const p=ob.exec(a);if(p)return`\x1B[1;${u}${p[1]}`;const g=rb.exec(a);if(g)return`\x1B[${g[1]};${u}~`;switch(a){case re.TAB:return r&&!l&&!o?re.SHIFT_TAB:h?`\x1B${a}`:`\x1B[9;${u}u`;case re.SHIFT_TAB:return!l&&!o?a:`\x1B[9;${Gp({...i,shift:!0})}u`;case re.ENTER:return h?`\x1B${a}`:`\x1B[13;${u}u`;case re.BACKSPACE:return l&&!o&&!r?"\b":h?`\x1B${a}`:`\x1B[127;${u}u`;case re.ESC:return h?`\x1B${a}`:`\x1B[27;${u}u`}let b=a;return r&&a.length===1&&!l&&(b=a.toUpperCase()),l&&(b=lb(b)),o&&(b=yx(b)),b}function vx(a){return[...a].length===1?!0:sb.test(a)||ob.test(a)||rb.test(a)||a===re.SHIFT_TAB}class vn extends Error{constructor(l,o={}){super(l);W(this,"code");W(this,"params");this.name="KeyComboError",this.code=l,this.params=o}}const xx={escape:"esc",return:"enter",pgup:"pageup",pgdn:"pagedown",backslash:"\\",plus:"+"},Yp={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:" ","+":"+"},wx={esc:"ESC",tab:"TAB",enter:"⏎",backspace:"⌫",delete:"DEL",left:"←",right:"→",up:"↑",down:"↓",home:"HOME",end:"END",pageup:"PGUP",pagedown:"PGDN",insert:"INS",space:"SPACE","+":"+"},Sx={2:"²",3:"³",4:"⁴",5:"⁵",6:"⁶",7:"⁷",8:"⁸",9:"⁹"};function cb(a,i){const l=a.toLowerCase().split("+");if(l.some(p=>!p))throw new vn("invalidStepSyntax",{step:i+1});const o={};let r;for(const p of l)if(p==="ctrl"||p==="control"){if(o.ctrl)throw new vn("duplicateModifier",{step:i+1,modifier:"Ctrl"});o.ctrl=!0}else if(p==="alt"||p==="option"){if(o.alt)throw new vn("duplicateModifier",{step:i+1,modifier:"Alt"});o.alt=!0}else if(p==="shift"){if(o.shift)throw new vn("duplicateModifier",{step:i+1,modifier:"Shift"});o.shift=!0}else if(r===void 0)r=p;else throw new vn("multipleKeys",{step:i+1});if(!r)throw new vn("missingKey",{step:i+1});const u=xx[r]||r,h=/^f(?:[1-9]|1[0-2])$/.exec(u);let m;if(h)m=re[u.toUpperCase()];else if(Object.hasOwn(Yp,u))m=Yp[u];else if([...u].length===1&&/^[\x21-\x7e]$/.test(u))m=u;else throw new vn("unsupportedKey",{step:i+1,key:u});return{key:m,keyName:u,modifiers:o,sequence:Tx(m,u,o)}}function Cx(a){return 1+(a.shift?1:0)+(a.alt?2:0)+(a.ctrl?4:0)}function $p(a,i){const l=[...a][0].codePointAt(0);return l===void 0?"":`\x1B[${l};${Cx(i)}u`}function Tx(a,i,l){if(!l.ctrl)return tr(a,l);if(i.length===1&&/^[\x20-\x7e]$/.test(i)){const o=i.toLowerCase();if(l.alt||l.shift||o==="m"||o==="i")return $p(o,l);if(o==="-"||o==="/"||o==="_")return"";const r=lb(o);return r!==o?r:$p(o,l)}return tr(a,l)}function xn(a){if(typeof a!="string"||!a.trim())throw new vn("empty");const i=a.trim().split(/\s+/);if(i.length>8)throw new vn("tooManySteps",{count:8});return i.map((l,o)=>cb(l,o).sequence)}function is(a){const i=a.trim().split(/\s+/);return i.length>1&&i.every(l=>["esc","escape"].includes(l.toLowerCase()))?`ESC${Sx[i.length]||` ×${i.length}`}`:i.map((l,o)=>{const{keyName:r,modifiers:u}=cb(l,o),h=wx[r]||(/^f\d+$/.test(r),r.toUpperCase());return u.ctrl&&u.alt&&u.shift?`Ctrl+Alt+⇧${h}`:u.ctrl&&u.alt?`Ctrl+Alt+${h}`:u.ctrl&&u.shift?`^⇧${h}`:u.ctrl?`^${h}`:u.alt&&u.shift?`Alt+⇧${h}`:u.alt?`Alt+${h}`:u.shift?`⇧${h}`:h}).join(" ")}const H=(a,i,l,o=!0)=>({id:a,labelKey:i,combo:l,verified:o}),ub={claude:{id:"claude",name:"Claude Code",shortName:"Claude",configHint:"~/.claude/keybindings.json",bar:["mode","rewind","details","model"],actions:[H("mode","mode","shift+tab"),H("rewind","rewind","esc esc"),H("details","details","ctrl+o"),H("model","model","alt+p"),H("thinking","thinking","alt+t"),H("todos","todos","ctrl+t"),H("background","background","ctrl+b"),H("editor","editor","ctrl+g"),H("history","history","ctrl+r"),H("stash","stash","ctrl+s"),H("pasteImage","pasteImage","ctrl+v"),H("newline","newline","ctrl+j"),H("interrupt","interrupt","esc")]},codex:{id:"codex",name:"Codex",shortName:"Codex",configHint:"~/.codex/config.toml [tui.keymap]",bar:["mode","editPrevious","details"],actions:[H("mode","mode","shift+tab"),H("editPrevious","editPrevious","esc esc"),H("details","details","ctrl+t"),H("queue","queue","tab"),H("history","history","ctrl+r"),H("copy","copy","ctrl+o"),H("editor","editor","ctrl+g"),H("newline","newline","ctrl+j"),H("clear","clear","ctrl+l"),H("interrupt","interrupt","esc")]},gemini:{id:"gemini",name:"Gemini CLI",shortName:"Gemini",configHint:"~/.gemini/keybindings.json",bar:["mode","yolo","rewind"],actions:[H("mode","mode","shift+tab"),H("yolo","yolo","ctrl+y"),H("rewind","rewind","esc esc"),H("todos","todos","ctrl+t"),H("expand","expand","ctrl+o"),H("background","background","ctrl+b"),H("editor","editor","ctrl+g"),H("history","history","ctrl+r"),H("undo","undo","ctrl+z"),H("newline","newline","ctrl+j"),H("interrupt","interrupt","esc")]},qwen:{id:"qwen",name:"Qwen Code",shortName:"Qwen",bar:["mode","history"],actions:[H("mode","mode","shift+tab"),H("interrupt","interrupt","esc"),H("history","history","ctrl+r"),H("newline","newline","ctrl+j"),H("todos","todos","ctrl+t",!1),H("rewind","rewind","esc esc",!1)]},opencode:{id:"opencode",name:"OpenCode",shortName:"OpenCode",configHint:"tui.json keybinds",bar:["palette","model","sessions"],actions:[H("agent","agent","tab"),H("agentBack","agentBack","shift+tab"),H("interrupt","interrupt","esc"),H("palette","palette","ctrl+p"),H("model","model","ctrl+x m"),H("recentModel","recentModel","f2"),H("variant","variant","ctrl+t"),H("newSession","newSession","ctrl+x n"),H("sessions","sessions","ctrl+x l"),H("undo","undo","ctrl+x u"),H("editor","editor","ctrl+x e"),H("newline","newline","ctrl+j")]},kilo:{id:"kilo",name:"Kilo Code",shortName:"Kilo",configHint:"~/.config/kilo/tui.jsonc",bar:["palette","model","sessions"],actions:[H("agent","agent","tab",!1),H("agentBack","agentBack","shift+tab",!1),H("interrupt","interrupt","esc"),H("palette","palette","ctrl+p"),H("model","model","ctrl+x m"),H("recentModel","recentModel","f2"),H("variant","variant","ctrl+t"),H("newSession","newSession","ctrl+x n"),H("sessions","sessions","ctrl+x l"),H("undo","undo","ctrl+x u"),H("editor","editor","ctrl+x e"),H("newline","newline","ctrl+j")]},pi:{id:"pi",name:"Pi",shortName:"Pi",configHint:"~/.pi/agent/keybindings.json",bar:["thinkingMode","modelPicker","tools"],actions:[H("thinkingMode","thinkingMode","shift+tab"),H("interrupt","interrupt","esc"),H("nextModel","nextModel","ctrl+p"),H("modelPicker","modelPicker","ctrl+l"),H("tools","tools","ctrl+o"),H("thinkingBlocks","thinkingBlocks","ctrl+t"),H("editor","editor","ctrl+g"),H("followup","followup","alt+enter"),H("dequeue","dequeue","alt+up"),H("newline","newline","shift+enter")]},omp:{id:"omp",name:"Oh My Pi",shortName:"OMP",configHint:"~/.omp/agent/keybindings.yml",bar:["thinkingMode","plan","model"],actions:[H("thinkingMode","thinkingMode","shift+tab"),H("plan","plan","alt+shift+p"),H("model","model","alt+m"),H("temporaryModel","temporaryModel","alt+p"),H("nextModel","nextModel","ctrl+p"),H("tools","tools","ctrl+o"),H("thinking","thinking","ctrl+t"),H("history","history","ctrl+r"),H("editor","editor","ctrl+g"),H("followup","followup","ctrl+enter"),H("interrupt","interrupt","esc")]},copilot:{id:"copilot",name:"GitHub Copilot",shortName:"Copilot",bar:["mode","expand","reasoning"],actions:[H("mode","mode","shift+tab"),H("interrupt","interrupt","esc"),H("expand","expand","ctrl+o"),H("expandAll","expandAll","ctrl+e"),H("reasoning","reasoning","ctrl+t"),H("editor","editor","ctrl+g"),H("clear","clear","ctrl+l")]},cursor:{id:"cursor",name:"Cursor",shortName:"Cursor",bar:["mode","review"],actions:[H("mode","mode","shift+tab"),H("review","review","ctrl+r"),H("newline","newline","ctrl+j"),H("interrupt","interrupt","esc",!1)]},droid:{id:"droid",name:"Factory Droid",shortName:"Droid",configHint:"In-app settings",bar:["specMode","autonomy"],actions:[H("specMode","specMode","shift+tab"),H("autonomy","autonomy","ctrl+l"),H("details","details","ctrl+o",!1),H("queue","queue","ctrl+enter"),H("interrupt","interrupt","esc",!1)]},kimi:{id:"kimi",name:"Kimi Code",shortName:"Kimi",bar:["plan","undoPicker","expand"],actions:[H("plan","plan","shift+tab"),H("interrupt","interrupt","esc"),H("undoPicker","undoPicker","esc esc"),H("expand","expand","ctrl+o"),H("editor","editor","ctrl+g"),H("steer","steer","ctrl+s"),H("undo","undo","ctrl+-"),H("newline","newline","ctrl+j"),H("pasteImage","pasteImage","ctrl+v")]},amp:{id:"amp",name:"Amp",shortName:"Amp",bar:["palette","reasoning","mode"],actions:[H("palette","palette","ctrl+o"),H("reasoning","reasoning","alt+d"),H("mode","mode","ctrl+s",!1),H("editor","editor","ctrl+g"),H("history","history","ctrl+r"),H("sidebar","sidebar","ctrl+backslash"),H("pasteImage","pasteImage","ctrl+v"),H("interrupt","interrupt","esc",!1)]},hermes:{id:"hermes",name:"Hermes",shortName:"Hermes",bar:["interrupt","agents","sessions"],actions:[H("interrupt","interrupt","ctrl+c"),H("newline","newline","ctrl+j"),H("editor","editor","ctrl+g"),H("agents","agents","ctrl+t"),H("sessions","sessions","ctrl+x")]},qodercli:{id:"qodercli",name:"Qoder CLI",shortName:"Qoder",configHint:"/shortcuts in-app",bar:["permissionMode","bypass","tasks","interrupt"],actions:[H("permissionMode","permissionMode","shift+tab"),H("bypass","bypass","ctrl+y"),H("tasks","tasks","ctrl+t"),H("editor","editor","ctrl+x"),H("history","history","ctrl+r"),H("queue","queue","ctrl+enter"),H("newline","newline","ctrl+j"),H("pasteImage","pasteImage","alt+v"),H("interrupt","interrupt","ctrl+c")]},devin:{id:"devin",name:"Devin",shortName:"Devin",configHint:"~/.config/devin/config.json keymap",bar:["mode","thinking","interrupt"],actions:[H("mode","mode","shift+tab"),H("interrupt","interrupt","ctrl+c"),H("thinking","thinking","alt+t"),H("newline","newline","ctrl+j"),H("pasteImage","pasteImage","ctrl+v")]},grok:{id:"grok",name:"Grok CLI",shortName:"Grok",bar:["mode","rewind","interrupt"],actions:[H("mode","mode","shift+tab"),H("interrupt","interrupt","ctrl+c"),H("rewind","rewind","esc esc"),H("interject","interject","ctrl+enter"),H("multiline","multiline","ctrl+m"),H("newline","newline","alt+enter"),H("shortcuts","shortcuts","ctrl+.")]},agy:{id:"agy",name:"Antigravity",shortName:"Antigravity",configHint:"~/.gemini/antigravity-cli/keybindings.json",bar:["mode","approve","interrupt"],actions:[H("mode","mode","shift+tab"),H("interrupt","interrupt","ctrl+c"),H("background","background","ctrl+b"),H("approve","approve","ctrl+k"),H("clear","clear","esc esc")]},mastracode:{id:"mastracode",name:"MastraCode",shortName:"MastraCode",bar:["interrupt","thinking","expand"],actions:[H("interrupt","interrupt","ctrl+c"),H("thinking","thinking","ctrl+t"),H("expand","expand","ctrl+e"),H("followup","followup","ctrl+f")]},letta:{id:"letta",name:"Letta Code",shortName:"Letta",bar:["permissionMode"],actions:[H("permissionMode","permissionMode","shift+tab"),H("interrupt","interrupt","esc",!1)]},kiro:{id:"kiro",name:"Kiro CLI",shortName:"Kiro",configHint:"kiro-cli settings chat.keybindings.*",bar:["agentSwap","details","steer"],actions:[H("agentSwap","agentSwap","shift+tab"),H("interrupt","interrupt","esc"),H("details","details","ctrl+t"),H("steer","steer","ctrl+s"),H("expand","expand","ctrl+o"),H("activity","activity","ctrl+x"),H("newline","newline","ctrl+j")]},cline:{id:"cline",name:"Cline",shortName:"Cline",bar:["autoApprove"],actions:[H("planAct","planAct","tab"),H("autoApprove","autoApprove","shift+tab"),H("interrupt","interrupt","esc",!1)]},maki:{id:"maki",name:"Maki",shortName:"Maki",bar:["rewind","search"],actions:[H("rewind","rewind","esc esc"),H("search","search","ctrl+f"),H("interrupt","interrupt","esc",!1)]},muse:{id:"muse",name:"Muse",shortName:"Muse",configHint:"/keymap in-app",bar:["queue","interruptCtrl"],actions:[H("interrupt","interrupt","esc"),H("queue","queue","alt+enter"),H("interruptCtrl","interrupt","ctrl+c")]},shell:{id:"shell",name:"Shell",shortName:"Shell",actions:[]}},Ji=ub,Mx=Object.keys(ub),qp={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 Ax(a){return a&&a.trim().toLowerCase().replace(/\\/g,"/").split("/").at(-1)||""}function Vp(a){const i=Ax(a);return qp[i]?qp[i]:/^muse-bin-\d/.test(i)?"muse":null}function Ex(a,i="auto"){return i&&i!=="auto"?Vp(i)||"shell":Vp(a)||"shell"}const Nx=[H("genericCtrlC","interrupt","ctrl+c"),H("genericCtrlD","eof","ctrl+d"),H("genericCtrlZ","suspend","ctrl+z"),H("genericCtrlL","clear","ctrl+l"),H("genericCtrlR","history","ctrl+r"),H("genericCtrlA","startOfLine","ctrl+a"),H("genericCtrlE","endOfLine","ctrl+e"),H("genericCtrlK","killToEnd","ctrl+k")],kx=["genericCtrlC","genericCtrlD","genericCtrlL","genericCtrlR"],Lx=["genericCtrlC"];function Rx(a,i){var r,u;const l=a.map(h=>{var g;const m=(g=i==null?void 0:i.actions)==null?void 0:g[h.id];let p=typeof(m==null?void 0:m.keys)=="string"?m.keys:h.combo;try{xn(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}}),o=new Set(l.map(h=>h.id));for(const h of(i==null?void 0:i.custom)||[]){if(!h||typeof h.id!="string"||o.has(h.id))continue;const m=h.keys;try{xn(m)}catch{continue}l.push({id:h.id,labelKey:"custom",defaultCombo:m,combo:m,verified:!0,hidden:((u=(r=i==null?void 0:i.actions)==null?void 0:r[h.id])==null?void 0:u.hidden)===!0,custom:!0,customLabel:h.label}),o.add(h.id)}if(Array.isArray(i==null?void 0:i.order)){const h=new Map(i.order.map((m,p)=>[m,p]));l.sort((m,p)=>(h.get(m.id)??Number.MAX_SAFE_INTEGER)-(h.get(p.id)??Number.MAX_SAFE_INTEGER))}return l}function _x(a,i){const l=new Set(a.map(o=>o.combo.trim().toLowerCase()));return i.filter(o=>!l.has(o.combo.trim().toLowerCase()))}const ls=a=>a.id.startsWith("generic");function db(a,i){const l=Ji[a],o=new Set([...l.bar||[],...a==="shell"?kx:Lx]),r=[...l.actions,...Nx].map(u=>({...u,defaultHidden:!o.has(u.id)}));return Rx(r,i)}function fb(a,i){const l=db(a,i),o=l.filter(u=>!ls(u)),r=new Set(_x(o,l.filter(ls)));return l.filter(u=>!ls(u)||r.has(u))}function jx(a,i){const l=fb(a,i).filter(o=>!o.hidden);return{agentActions:l.filter(o=>!ls(o)),genericActions:l.filter(ls)}}function Ox(a){const i={};for(const[l,o]of Object.entries(a.actions||{})){const r={...o};delete r.hidden,Object.keys(r).length>0&&(i[l]=r)}return{...a,actions:i}}function hb(a){if(!a||typeof a!="object"||Array.isArray(a))return{};const i=Object.create(null);for(const[l,o]of Object.entries(a).slice(0,32)){if(!/^[a-z][a-z0-9_-]{0,31}$/i.test(l)||["__proto__","constructor","prototype"].includes(l)||!o||typeof o!="object"||Array.isArray(o))continue;const r=o,u={};if(Array.isArray(r.order)&&(u.order=[...new Set(r.order.filter(h=>typeof h=="string"&&/^[a-zA-Z0-9_-]{1,64}$/.test(h)))].slice(0,256)),r.actions&&typeof r.actions=="object"&&!Array.isArray(r.actions)){const h=Object.create(null);for(const[m,p]of Object.entries(r.actions).slice(0,256)){if(!/^[a-zA-Z0-9_-]{1,64}$/.test(m)||!p||typeof p!="object"||Array.isArray(p))continue;const g=p,b={};if(typeof g.keys=="string"&&g.keys.trim()){const v=g.keys.trim().slice(0,80);try{xn(v),b.keys=v}catch{}}typeof g.hidden=="boolean"&&(b.hidden=g.hidden),Object.keys(b).length>0&&(h[m]=b)}u.actions=h}if(Array.isArray(r.custom)){const h=new Set;u.custom=r.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{xn(g)}catch{return[]}return h.add(p.id),[{id:p.id,label:p.label.trim().slice(0,64),keys:g}]})}i[l]=u}return i}const Dx=10,zx=24,ss=15,nr=13,Cd=640;function Hx(){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 Za()<Cd}function Za(){return typeof window>"u"?1024:window.visualViewport&&typeof window.visualViewport.width=="number"&&window.visualViewport.width>0?window.visualViewport.width:window.innerWidth||1024}function ed(){return typeof window>"u"?768:window.visualViewport&&typeof window.visualViewport.height=="number"&&window.visualViewport.height>0?window.visualViewport.height:window.innerHeight||768}function Wa(a,i=ss){const l=typeof a=="number"?a:Number(a);return!Number.isFinite(l)||l<=0?i:Math.min(zx,Math.max(Dx,Math.round(l)))}function Pp(a,i=Za()){if(i<Cd){const o=Wa(a,nr);return Math.min(15,Math.max(12,o))}return Wa(a,ss)}const Xp="#11111b",Bx=['"Symbols Nerd Font Mono"','"Sarasa Mono SC"','"Noto Sans Mono CJK SC"','"Noto Sans Mono CJK TC"','"Microsoft YaHei Mono"','"PingFang SC"',"monospace"],ir=["ui-monospace","SFMono-Regular","Menlo","Monaco","Consolas",'"Liberation Mono"','"Courier New"'],td=[{id:"host",name:"Host terminal font",faces:[]},{id:"system",name:"System monospace",faces:ir},{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"']}],mb="host",Ux='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", "Symbols Nerd Font Mono", monospace',Kx='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',Ix="JetBrains Mono, Menlo, Monaco, Consolas, monospace",Fx={[Ux]:"host",[Kx]:"host",[Ix]:"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 Ou(a){return typeof a!="string"||!a.trim()?mb:Fx[a]??a}const Gx=[[/^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 Yx(a){const i=Gx.find(([l])=>l.test(a.trim()));return i?i[1]:null}function es(a){return`"${a.replace(/["\\]/g,"")}"`}function nd(a){return[...new Set([...a,...Bx])].join(", ")}const $x=nd(ir);function qx(a,i){const l=typeof a=="string"?a.trim():"";if(!l||l==="host"){if(!(i!=null&&i.family))return $x;const u=[],h=i.glyphs;(h==null?void 0:h.scope)==="all"&&h.alias&&u.push(es(h.alias)),i.alias&&u.push(es(i.alias)),u.push(es(i.family));const m=Yx(i.family);return m&&u.push(m),(h==null?void 0:h.scope)==="cjk"&&(h.alias&&u.push(es(h.alias)),u.push(es(h.family))),nd([...u,...ir])}const o=td.find(u=>u.id===l);if(o)return nd([...o.faces,...ir]);if(l.includes("Symbols Nerd Font"))return l;if(/^['"]?monospace['"]?$/i.test(l))return'"Symbols Nerd Font Mono", monospace';const r=/,\s*['"]?monospace['"]?\s*$/i;return r.test(l)?l.replace(r,', "Symbols Nerd Font Mono", monospace'):`${l}, "Symbols Nerd Font Mono", monospace`}function Vx(a){if(!a)return null;const i={};return a.background&&(i.background=a.background,i.cursorAccent=a.background),a.foreground&&(i.foreground=a.foreground),a.cursor&&(i.cursor=a.cursor),a.ansi&&Object.assign(i,a.ansi),Object.keys(i).length===0?null:i}function pb(){if(typeof document>"u")return;const a=document.querySelector('meta[name="theme-color"]');document.documentElement.style.colorScheme="dark",a==null||a.setAttribute("content",Xp),document.documentElement.classList.add("dark"),document.documentElement.classList.remove("light"),document.body.classList.add("dark"),document.body.classList.remove("light"),document.body.style.backgroundColor=Xp}const pt={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"},id={local:{},session:{}};function Mi(a,i){if(typeof window>"u")return id[a][i]||null;try{return(a==="local"?window.localStorage:window.sessionStorage).getItem(i)}catch{return id[a][i]||null}}function wn(a,i,l){if(id[a][i]=l,!(typeof window>"u"))try{(a==="local"?window.localStorage:window.sessionStorage).setItem(i,l)}catch(o){console.warn(`Failed to write to ${a}Storage:`,o)}}const Qp=["啊阿埃挨哎唉哀皑癌蔼矮艾碍爱隘鞍氨安俺按暗岸胺案肮昂盎凹敖熬翱袄傲奥懊澳芭捌扒叭吧笆八疤巴拔跋靶把耙坝霸罢爸白柏百摆佰败拜稗斑班搬扳般颁板版扮拌伴瓣半办绊邦帮梆","榜膀绑棒磅蚌镑傍谤苞胞包褒剥薄雹保堡饱宝抱报暴豹鲍爆杯碑悲卑北辈背贝钡倍狈备惫焙被奔苯本笨崩绷甭泵蹦迸逼鼻比鄙笔彼碧蓖蔽毕毙毖币庇痹闭敝弊必辟壁臂避陛鞭边编贬扁","便变卞辨辩辫遍标彪膘表鳖憋别瘪彬斌濒滨宾摈兵冰柄丙秉饼炳病并玻菠播拨钵波博勃搏铂箔伯帛舶脖膊渤泊驳捕卜哺补埠不布步簿部怖擦猜裁材才财睬踩采彩菜蔡餐参蚕残惭惨灿苍","舱仓沧藏操糙槽曹草厕策侧册测层蹭插叉茬茶查碴搽察岔差诧拆柴豺搀掺蝉馋谗缠铲产阐颤昌猖场尝常长偿肠厂敞畅唱倡超抄钞朝嘲潮巢吵炒车扯撤掣彻澈郴臣辰尘晨忱沉陈趁衬撑称","城橙成呈乘程惩澄诚承逞骋秤吃痴持匙池迟弛驰耻齿侈尺赤翅斥炽充冲虫崇宠抽酬畴踌稠愁筹仇绸瞅丑臭初出橱厨躇锄雏滁除楚础储矗搐触处揣川穿椽传船喘串疮窗幢床闯创吹炊捶锤","垂春椿醇唇淳纯蠢戳绰疵茨磁雌辞慈瓷词此刺赐次聪葱囱匆从丛凑粗醋簇促蹿篡窜摧崔催脆瘁粹淬翠村存寸磋撮搓措挫错搭达答瘩打大呆歹傣戴带殆代贷袋待逮怠耽担丹单郸掸胆旦氮","但惮淡诞弹蛋当挡党荡档刀捣蹈倒岛祷导到稻悼道盗德得的蹬灯登等瞪凳邓堤低滴迪敌笛狄涤翟嫡抵底地蒂第帝弟递缔颠掂滇碘点典靛垫电佃甸店惦奠淀殿碉叼雕凋刁掉吊钓调跌爹碟","蝶迭谍叠丁盯叮钉顶鼎锭定订丢东冬董懂动栋侗恫冻洞兜抖斗陡豆逗痘都督毒犊独读堵睹赌杜镀肚度渡妒端短锻段断缎堆兑队对墩吨蹲敦顿囤钝盾遁掇哆多夺垛躲朵跺舵剁惰堕蛾峨鹅","俄额讹娥恶厄扼遏鄂饿恩而儿耳尔饵洱二贰发罚筏伐乏阀法珐藩帆番翻樊矾钒繁凡烦反返范贩犯饭泛坊芳方肪房防妨仿访纺放菲非啡飞肥匪诽吠肺废沸费芬酚吩氛分纷坟焚汾粉奋份忿","愤粪丰封枫蜂峰锋风疯烽逢冯缝讽奉凤佛否夫敷肤孵扶拂辐幅氟符伏俘服浮涪福袱弗甫抚辅俯釜斧脯腑府腐赴副覆赋复傅付阜父腹负富讣附妇缚咐噶嘎该改概钙盖溉干甘杆柑竿肝赶感","秆敢赣冈刚钢缸肛纲岗港杠篙皋高膏羔糕搞镐稿告哥歌搁戈鸽胳疙割革葛格蛤阁隔铬个各给根跟耕更庚羹埂耿梗工攻功恭龚供躬公宫弓巩汞拱贡共钩勾沟苟狗垢构购够辜菇咕箍估沽孤","姑鼓古蛊骨谷股故顾固雇刮瓜剐寡挂褂乖拐怪棺关官冠观管馆罐惯灌贯光广逛瑰规圭硅归龟闺轨鬼诡癸桂柜跪贵刽辊滚棍锅郭国果裹过哈骸孩海氦亥害骇酣憨邯韩含涵寒函喊罕翰撼捍","旱憾悍焊汗汉夯杭航壕嚎豪毫郝好耗号浩呵喝荷菏核禾和何合盒貉阂河涸赫褐鹤贺嘿黑痕很狠恨哼亨横衡恒轰哄烘虹鸿洪宏弘红喉侯猴吼厚候后呼乎忽瑚壶葫胡蝴狐糊湖弧虎唬护互沪","户花哗华猾滑画划化话槐徊怀淮坏欢环桓还缓换患唤痪豢焕涣宦幻荒慌黄磺蝗簧皇凰惶煌晃幌恍谎灰挥辉徽恢蛔回毁悔慧卉惠晦贿秽会烩汇讳诲绘荤昏婚魂浑混豁活伙火获或惑霍货祸","击圾基机畸稽积箕肌饥迹激讥鸡姬绩缉吉极棘辑籍集及急疾汲即嫉级挤几脊己蓟技冀季伎祭剂悸济寄寂计记既忌际妓继纪嘉枷夹佳家加荚颊贾甲钾假稼价架驾嫁歼监坚尖笺间煎兼肩艰","奸缄茧检柬碱硷拣捡简俭剪减荐槛鉴践贱见键箭件健舰剑饯渐溅涧建僵姜将浆江疆蒋桨奖讲匠酱降蕉椒礁焦胶交郊浇骄娇嚼搅铰矫侥脚狡角饺缴绞剿教酵轿较叫窖揭接皆秸街阶截劫节","桔杰捷睫竭洁结解姐戒藉芥界借介疥诫届巾筋斤金今津襟紧锦仅谨进靳晋禁近烬浸尽劲荆兢茎睛晶鲸京惊精粳经井警景颈静境敬镜径痉靖竟竞净炯窘揪究纠玖韭久灸九酒厩救旧臼舅咎","就疚鞠拘狙疽居驹菊局咀矩举沮聚拒据巨具距踞锯俱句惧炬剧捐鹃娟倦眷卷绢撅攫抉掘倔爵觉决诀绝均菌钧军君峻俊竣浚郡骏喀咖卡咯开揩楷凯慨刊堪勘坎砍看康慷糠扛抗亢炕考拷烤","靠坷苛柯棵磕颗科壳咳可渴克刻客课肯啃垦恳坑吭空恐孔控抠口扣寇枯哭窟苦酷库裤夸垮挎跨胯块筷侩快宽款匡筐狂框矿眶旷况亏盔岿窥葵奎魁傀馈愧溃坤昆捆困括扩廓阔垃拉喇蜡腊","辣啦莱来赖蓝婪栏拦篮阑兰澜谰揽览懒缆烂滥琅榔狼廊郎朗浪捞劳牢老佬姥酪烙涝勒乐雷镭蕾磊累儡垒擂肋类泪棱楞冷厘梨犁黎篱狸离漓理李里鲤礼莉荔吏栗丽厉励砾历利傈例俐痢立","粒沥隶力璃哩俩联莲连镰廉怜涟帘敛脸链恋炼练粮凉梁粱良两辆量晾亮谅撩聊僚疗燎寥辽潦了撂镣廖料列裂烈劣猎琳林磷霖临邻鳞淋凛赁吝拎玲菱零龄铃伶羚凌灵陵岭领另令溜琉榴硫","馏留刘瘤流柳六龙聋咙笼窿隆垄拢陇楼娄搂篓漏陋芦卢颅庐炉掳卤虏鲁麓碌露路赂鹿潞禄录陆戮驴吕铝侣旅履屡缕虑氯律率滤绿峦挛孪滦卵乱掠略抡轮伦仑沦纶论萝螺罗逻锣箩骡裸落","洛骆络妈麻玛码蚂马骂嘛吗埋买麦卖迈脉瞒馒蛮满蔓曼慢漫谩芒茫盲氓忙莽猫茅锚毛矛铆卯茂冒帽貌贸么玫枚梅酶霉煤没眉媒镁每美昧寐妹媚门闷们萌蒙檬盟锰猛梦孟眯醚靡糜迷谜弥","米秘觅泌蜜密幂棉眠绵冕免勉娩缅面苗描瞄藐秒渺庙妙蔑灭民抿皿敏悯闽明螟鸣铭名命谬摸摹蘑模膜磨摩魔抹末莫墨默沫漠寞陌谋牟某拇牡亩姆母墓暮幕募慕木目睦牧穆拿哪呐钠那娜","纳氖乃奶耐奈南男难囊挠脑恼闹淖呢馁内嫩能妮霓倪泥尼拟你匿腻逆溺蔫拈年碾撵捻念娘酿鸟尿捏聂孽啮镊镍涅您柠狞凝宁拧泞牛扭钮纽脓浓农弄奴努怒女暖虐疟挪懦糯诺哦欧鸥殴藕","呕偶沤啪趴爬帕怕琶拍排牌徘湃派攀潘盘磐盼畔判叛乓庞旁耪胖抛咆刨炮袍跑泡呸胚培裴赔陪配佩沛喷盆砰抨烹澎彭蓬棚硼篷膨朋鹏捧碰坯砒霹批披劈琵毗啤脾疲皮匹痞僻屁譬篇偏片","骗飘漂瓢票撇瞥拼频贫品聘乒坪苹萍平凭瓶评屏坡泼颇婆破魄迫粕剖扑铺仆莆葡菩蒲埔朴圃普浦谱曝瀑期欺栖戚妻七凄漆柒沏其棋奇歧畦崎脐齐旗祈祁骑起岂乞企启契砌器气迄弃汽泣","讫掐恰洽牵扦钎铅千迁签仟谦乾黔钱钳前潜遣浅谴堑嵌欠歉枪呛腔羌墙蔷强抢橇锹敲悄桥瞧乔侨巧鞘撬翘峭俏窍切茄且怯窃钦侵亲秦琴勤芹擒禽寝沁青轻氢倾卿清擎晴氰情顷请庆琼穷","秋丘邱球求囚酋泅趋区蛆曲躯屈驱渠取娶龋趣去圈颧权醛泉全痊拳犬券劝缺炔瘸却鹊榷确雀裙群然燃冉染瓤壤攘嚷让饶扰绕惹热壬仁人忍韧任认刃妊纫扔仍日戎茸蓉荣融熔溶容绒冗揉","柔肉茹蠕儒孺如辱乳汝入褥软阮蕊瑞锐闰润若弱撒洒萨腮鳃塞赛三叁伞散桑嗓丧搔骚扫嫂瑟色涩森僧莎砂杀刹沙纱傻啥煞筛晒珊苫杉山删煽衫闪陕擅赡膳善汕扇缮墒伤商赏晌上尚裳梢","捎稍烧芍勺韶少哨邵绍奢赊蛇舌舍赦摄射慑涉社设砷申呻伸身深娠绅神沈审婶甚肾慎渗声生甥牲升绳省盛剩胜圣师失狮施湿诗尸虱十石拾时什食蚀实识史矢使屎驶始式示士世柿事拭誓","逝势是嗜噬适仕侍释饰氏市恃室视试收手首守寿授售受瘦兽蔬枢梳殊抒输叔舒淑疏书赎孰熟薯暑曙署蜀黍鼠属术述树束戍竖墅庶数漱恕刷耍摔衰甩帅栓拴霜双爽谁水睡税吮瞬顺舜说硕","朔烁斯撕嘶思私司丝死肆寺嗣四伺似饲巳松耸怂颂送宋讼诵搜艘擞嗽苏酥俗素速粟僳塑溯宿诉肃酸蒜算虽隋随绥髓碎岁穗遂隧祟孙损笋蓑梭唆缩琐索锁所塌他它她塔獭挞蹋踏胎苔抬台","泰酞太态汰坍摊贪瘫滩坛檀痰潭谭谈坦毯袒碳探叹炭汤塘搪堂棠膛唐糖倘躺淌趟烫掏涛滔绦萄桃逃淘陶讨套特藤腾疼誊梯剔踢锑提题蹄啼体替嚏惕涕剃屉天添填田甜恬舔腆挑条迢眺跳","贴铁帖厅听烃汀廷停亭庭挺艇通桐酮瞳同铜彤童桶捅筒统痛偷投头透凸秃突图徒途涂屠土吐兔湍团推颓腿蜕褪退吞屯臀拖托脱鸵陀驮驼椭妥拓唾挖哇蛙洼娃瓦袜歪外豌弯湾玩顽丸烷完","碗挽晚皖惋宛婉万腕汪王亡枉网往旺望忘妄威巍微危韦违桅围唯惟为潍维苇萎委伟伪尾纬未蔚味畏胃喂魏位渭谓尉慰卫瘟温蚊文闻纹吻稳紊问嗡翁瓮挝蜗涡窝我斡卧握沃巫呜钨乌污诬","屋无芜梧吾吴毋武五捂午舞伍侮坞戊雾晤物勿务悟误昔熙析西硒矽晰嘻吸锡牺稀息希悉膝夕惜熄烯溪汐犀檄袭席习媳喜铣洗系隙戏细瞎虾匣霞辖暇峡侠狭下厦夏吓掀锨先仙鲜纤咸贤衔","舷闲涎弦嫌显险现献县腺馅羡宪陷限线相厢镶香箱襄湘乡翔祥详想响享项巷橡像向象萧硝霄削哮嚣销消宵淆晓小孝校肖啸笑效楔些歇蝎鞋协挟携邪斜胁谐写械卸蟹懈泄泻谢屑薪芯锌欣","辛新忻心信衅星腥猩惺兴刑型形邢行醒幸杏性姓兄凶胸匈汹雄熊休修羞朽嗅锈秀袖绣墟戌需虚嘘须徐许蓄酗叙旭序畜恤絮婿绪续轩喧宣悬旋玄选癣眩绚靴薛学穴雪血勋熏循旬询寻驯巡","殉汛训讯逊迅压押鸦鸭呀丫芽牙蚜崖衙涯雅哑亚讶焉咽阉烟淹盐严研蜒岩延言颜阎炎沿奄掩眼衍演艳堰燕厌砚雁唁彦焰宴谚验殃央鸯秧杨扬佯疡羊洋阳氧仰痒养样漾邀腰妖瑶摇尧遥窑","谣姚咬舀药要耀椰噎耶爷野冶也页掖业叶曳腋夜液一壹医揖铱依伊衣颐夷遗移仪胰疑沂宜姨彝椅蚁倚已乙矣以艺抑易邑屹亿役臆逸肄疫亦裔意毅忆义益溢诣议谊译异翼翌绎茵荫因殷音","阴姻吟银淫寅饮尹引隐印英樱婴鹰应缨莹萤营荧蝇迎赢盈影颖硬映哟拥佣臃痈庸雍踊蛹咏泳涌永恿勇用幽优悠忧尤由邮铀犹油游酉有友右佑釉诱又幼迂淤于盂榆虞愚舆余俞逾鱼愉渝渔","隅予娱雨与屿禹宇语羽玉域芋郁吁遇喻峪御愈欲狱育誉浴寓裕预豫驭鸳渊冤元垣袁原援辕园员圆猿源缘远苑愿怨院曰约越跃钥岳粤月悦阅耘云郧匀陨允运蕴酝晕韵孕匝砸杂栽哉灾宰载","再在咱攒暂赞赃脏葬遭糟凿藻枣早澡蚤躁噪造皂灶燥责择则泽贼怎增憎曾赠扎喳渣札轧铡闸眨栅榨咋乍炸诈摘斋宅窄债寨瞻毡詹粘沾盏斩辗崭展蘸栈占战站湛绽樟章彰漳张掌涨杖丈帐","账仗胀瘴障招昭找沼赵照罩兆肇召遮折哲蛰辙者锗蔗这浙珍斟真甄砧臻贞针侦枕疹诊震振镇阵蒸挣睁征狰争怔整拯正政帧症郑证芝枝支吱蜘知肢脂汁之织职直植殖执值侄址指止趾只旨","纸志挚掷至致置帜峙制智秩稚质炙痔滞治窒中盅忠钟衷终种肿重仲众舟周州洲诌粥轴肘帚咒皱宙昼骤珠株蛛朱猪诸诛逐竹烛煮拄瞩嘱主著柱助蛀贮铸筑住注祝驻抓爪拽专砖转撰赚篆桩","庄装妆撞壮状椎锥追赘坠缀谆准捉拙卓桌琢茁酌啄着灼浊兹咨资姿滋淄孜紫仔籽滓子自渍字鬃棕踪宗综总纵邹走奏揍租足卒族祖诅阻组钻纂嘴醉最罪尊遵昨左佐柞做作坐座"," 、。〃〄々〆〇〈〉《》「」『』【】〒〓〔〕〖〗〘〙〚〛〜〝〞〟〠〡〢〣〤〥〦〧〨〩〪〭〮〯〫〬〰〱〲〳〴〵〶〷〸〹〺〻〼〽〾〿!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~¢£¬ ̄¦¥₩"].join(""),Du=256*1024,Px=2,Xx={regular:{weight:"400",style:"normal"},bold:{weight:"700",style:"normal"},italic:{weight:"400",style:"italic"},boldItalic:{weight:"700",style:"italic"}};function Qi(a){return a?[a.family,...a.faces.map(i=>i.sha256),...(a.subsets||[]).map(i=>i.sha256)].join("|"):null}function Zp(a){const i=a==null?void 0:a.faces.find(l=>l.style==="regular");return i?`Herdr Host ${i.sha256.slice(0,12)}`:null}function Wp(a){return a?a.faces.reduce((i,l)=>i+l.bytes,0):0}function zu(a){return a>=1024*1024?`${(a/(1024*1024)).toFixed(1)} MB`:`${Math.max(1,Math.round(a/1024))} KB`}function Qx(a){if(typeof document>"u")return!1;let i=null;try{i=document.createElement("canvas").getContext("2d")}catch{return!1}if(!i)return!1;const l="mmmmmmmmmmlli10OQ@#WWww";for(const o of["serif","sans-serif"]){i.font=`72px ${o}`;const r=i.measureText(l).width;if(i.font=`72px "${a}", ${o}`,i.measureText(l).width!==r)return!0}return!1}const Zx="herdr-remote-fonts",Ja="faces",el="subsets",gb=new Map,ad=new Map;function cr(){return new Promise(a=>{if(typeof indexedDB>"u"){a(null);return}try{const i=indexedDB.open(Zx,2);i.onupgradeneeded=()=>{i.result.objectStoreNames.contains(Ja)||i.result.createObjectStore(Ja),i.result.objectStoreNames.contains(el)||i.result.createObjectStore(el)},i.onsuccess=()=>a(i.result),i.onerror=()=>a(null),i.onblocked=()=>a(null)}catch{a(null)}})}async function Wx(a){const i=gb.get(a);if(i)return i;const l=await cr();return l?new Promise(o=>{try{const r=l.transaction(Ja,"readonly").objectStore(Ja).get(a);r.onsuccess=()=>{const u=r.result;o(u instanceof ArrayBuffer?u:null)},r.onerror=()=>o(null)}catch{o(null)}finally{l.close()}}):null}async function Jx(a,i){gb.set(a,i);const l=await cr();l&&await new Promise(o=>{try{const r=l.transaction(Ja,"readwrite");r.objectStore(Ja).put(i,a),r.oncomplete=()=>o(),r.onerror=()=>o(),r.onabort=()=>o()}catch{o()}finally{l.close()}})}async function ew(a){const i=await cr();return i?new Promise(l=>{try{const o=IDBKeyRange.bound(`${a}:`,`${a}:`),r=i.transaction(el,"readonly").objectStore(el).getAll(o);r.onsuccess=()=>{const u=Array.isArray(r.result)?r.result:[];l(u.filter(h=>h&&h.data instanceof ArrayBuffer&&Array.isArray(h.codepoints)))},r.onerror=()=>l([])}catch{l([])}finally{i.close()}}):ad.get(a)??[]}async function tw(a,i){ad.set(a,[...ad.get(a)??[],i]);const l=await cr();l&&await new Promise(o=>{try{const r=l.transaction(el,"readwrite");r.objectStore(el).put(i,`${a}:${i.subsetSha}`),r.oncomplete=()=>o(),r.onerror=()=>o(),r.onabort=()=>o()}catch{o()}finally{l.close()}})}function Hu(a){return a?`Herdr Glyphs ${a.sha256.slice(0,12)}`:null}function nw(a){return a>=11904&&a<=12255||a>=12288&&a<=13311||a>=13312&&a<=19903||a>=19968&&a<=40959||a>=44032&&a<=55215||a>=63744&&a<=64255||a>=65072&&a<=65103||a>=65280&&a<=65519||a>=131072&&a<=201551}function bb(a,i){return i<32||i>=127&&i<160||i>=9472&&i<=9631?!1:a==="all"||nw(i)}function iw(a){const i=[...new Set(a)].sort((o,r)=>o-r),l=[];for(let o=0;o<i.length;o+=1){const r=i[o];let u=r;for(;o+1<i.length&&i[o+1]===u+1;)u=i[o+1],o+=1;const h=m=>m.toString(16).toUpperCase();l.push(r===u?`U+${h(r)}`:`U+${h(r)}-${h(u)}`)}return l.join(", ")}async function aw(a,i){if(typeof FontFace>"u"||typeof document>"u"||!document.fonts)throw new Error("font_api_unavailable");const l=new FontFace(a,i.data,{weight:"400",style:"normal",unicodeRange:iw(i.codepoints)});document.fonts.add(await l.load())}const ld=new Set;function lw(a){return!!(a&&ld.has(a))}async function sw(a,i){if(ld.has(a))return;if(typeof FontFace>"u"||typeof document>"u"||!document.fonts)throw new Error("font_api_unavailable");const l=await Promise.all(i.map(({face:o,data:r})=>new FontFace(a,r,Xx[o.style]).load()));for(const o of l)document.fonts.add(o);ld.add(a)}function Jp(a){const i=atob(a),l=new Uint8Array(i.length);for(let o=0;o<i.length;o+=1)l[o]=i.charCodeAt(o);return l}async function yb(a,i,l){const o=Math.ceil(a.bytes/Du),r=new Uint8Array(a.bytes);let u=0;const h=async()=>{for(;u<o;){const m=u;u+=1;const p=await i(a.sha256,m),g=m*Du,b=Math.min(Du,a.bytes-g);if(p.length!==b)throw new Error("host_font_corrupt");r.set(p,g),l(p.length)}};return await Promise.all(Array.from({length:Math.min(Px,o)},h)),r.buffer}function vb(){try{const a=JSON.parse(Mi("local",pt.hostFontConsent)||"{}");return a&&typeof a=="object"&&!Array.isArray(a)?a:{}}catch{return{}}}function eg(a,i){const l=vb()[a];return l&&l.fingerprint===i?l.decision:null}function tg(a,i,l){const o=vb();o[a]={fingerprint:i,decision:l},wn("local",pt.hostFontConsent,JSON.stringify(o))}const xb={source:null,status:"none",alias:null,covered:0},Bu={font:null,status:"none",alias:null,receivedBytes:0,totalBytes:0,error:null,glyphs:xb,interactive:!1,glyphRevision:0},ow=String.fromCodePoint(...Array.from({length:95},(a,i)=>32+i),...Array.from({length:96},(a,i)=>160+i),...Array.from({length:112},(a,i)=>8192+i));function ng(a){const i=(a==null?void 0:a.subsets)??[];return i.find(l=>l.scope==="all")??i.find(l=>l.scope==="cjk")??null}function rw(a,i){const l=new Set;for(const o of a){const r=o.codePointAt(0);bb(i,r)&&l.add(r)}return[...l]}const ig=3e4;function cw(a){const i=C.useRef(new Map),l=C.useRef(new Map),o=C.useRef(new Map),r=C.useCallback(m=>{for(const p of[i.current,l.current]){for(const g of p.values())clearTimeout(g.timer),g.reject(new Error(m));p.clear()}},[]),u=C.useCallback((m,p)=>new Promise((g,b)=>{if(!a){b(new Error("disconnected"));return}const v=`${m}:${p}`,w=setTimeout(()=>{i.current.delete(v),b(new Error("host_font_timeout"))},ig);i.current.set(v,{resolve:g,reject:b,timer:w}),a.sendHostFontChunkRequest(m,p)}),[a]),h=C.useCallback((m,p,g)=>new Promise((b,v)=>{if(!a){v(new Error("disconnected"));return}const w=Math.random().toString(36).slice(2,12),x=setTimeout(()=>{l.current.delete(w),v(new Error("host_font_timeout"))},ig);l.current.set(w,{resolve:T=>b({...T,codepoints:p}),reject:v,timer:x}),o.current.set(w,g),a.sendHostFontSubsetRequest(m.sha256,String.fromCodePoint(...p),w)}),[a]);return C.useEffect(()=>{if(!a)return;const m=i.current,p=l.current,g=a.on("hostFontChunk",x=>{const T=`${x.sha256}:${x.index}`,M=m.get(T);if(M){m.delete(T),clearTimeout(M.timer);try{M.resolve(Jp(x.dataBase64))}catch{M.reject(new Error("host_font_corrupt"))}}}),b=a.on("hostFontSubset",x=>{const T=p.get(x.requestId);if(!T)return;p.delete(x.requestId),clearTimeout(T.timer);const M=o.current.get(x.requestId)??(()=>{});if(o.current.delete(x.requestId),x.dataBase64!==void 0){try{const N=Jp(x.dataBase64);M(N.length,N.length),T.resolve({subsetSha:x.subsetSha,data:N.buffer,codepoints:[]})}catch{T.reject(new Error("host_font_corrupt"))}return}M(0,x.bytes);const A={bytes:x.bytes,sha256:x.subsetSha};yb(A,u,N=>M(N,x.bytes)).then(N=>T.resolve({subsetSha:x.subsetSha,data:N,codepoints:[]})).catch(N=>T.reject(N instanceof Error?N:new Error("host_font_failed")))}),v=a.on("error",x=>{(x.code==="host_font_unavailable"||x.code==="host_font_subset_failed")&&r(String(x.code))}),w=a.on("stateChange",x=>{x!=="connected"&&r("disconnected")});return()=>{g(),b(),v(),w(),r("disconnected")}},[a,r,u]),{requestChunk:u,requestSubset:h,rejectPending:r}}const uw=15e3,dw=80,fw=2e3;function hw(a,i={}){const[l,o]=C.useState(Bu),r=C.useRef(l);r.current=l;const u=C.useRef(i);u.current=i;const h=C.useRef(0),m=C.useRef(0),p=C.useRef(new Set),g=C.useRef(new Set),b=C.useRef(new Set),v=C.useRef(null),{requestChunk:w,requestSubset:x,rejectPending:T}=cw(a),M=C.useCallback(()=>({isInstalled:u.current.isInstalled??Qx,readCached:u.current.readCached??Wx,writeCached:u.current.writeCached??Jx,register:u.current.register??sw,isRegistered:u.current.isRegistered??lw,readSubsets:u.current.readSubsets??ew,writeSubset:u.current.writeSubset??tw,registerGlyphs:u.current.registerGlyphs??aw}),[]),A=C.useCallback(()=>(a==null?void 0:a.getHostId())||"default",[a]),N=C.useCallback((U,ee)=>{U===h.current&&o(q=>({...q,glyphs:{...q.glyphs,...ee}}))},[]),R=C.useCallback(async(U,ee,q)=>{const{registerGlyphs:P}=M();for(const ie of q){if(await P(ee,ie),U!==h.current)return;for(const ae of ie.codepoints)p.current.add(ae)}U!==h.current||!q.length||o(ie=>({...ie,glyphs:{...ie.glyphs,alias:ee,covered:p.current.size},glyphRevision:ie.glyphRevision+1}))},[M]),j=C.useCallback(async(U,ee,q)=>{const P=Hu(ee),ie=ee.scope==="all"?ow+Qp:Qp,ae=rw(ie,ee.scope).filter(E=>!p.current.has(E));if(!ae.length)return;for(const E of ae)g.current.add(E);const F=await x(ee,ae,q);U===h.current&&(await M().writeSubset(ee.sha256,F),await R(U,P,[F]))},[x,M,R]),V=C.useCallback(async(U,{interactive:ee=!0}={})=>{const q=U??r.current.font,P=Qi(q);if(!q||!P)return;const ie=r.current,ae=Qi(ie.font)===P;if(ae&&(ie.status==="loading"||ie.glyphs.status==="loading"))return;const F=h.current,{isInstalled:E,isRegistered:Y,readCached:X,writeCached:le,register:Q}=M();tg(A(),P,"accepted");const ve=Zp(q),ye=ng(q),xe=!!(ve&&!Y(ve)&&!E(q.family)),me=ae?ie.glyphs:{...xb,source:ye},de=!!(ye&&!["installed","ready","none"].includes(me.status));let we=xe?Wp(q):0,oe=0;const Se=()=>{F===h.current&&o(se=>({...se,receivedBytes:oe,totalBytes:we}))};if(o(se=>({...se,font:q,interactive:ee,receivedBytes:0,totalBytes:we,error:null,status:xe?"loading":se.status,glyphs:de?{...me,status:"loading"}:me})),xe&&ve)try{const se=[];for(const pe of q.faces){let Ee=await X(pe.sha256);if(Ee?(oe+=pe.bytes,Se()):(Ee=await yb(pe,w,Be=>{oe+=Be,Se()}),await le(pe.sha256,Ee)),F!==h.current)return;se.push({face:pe,data:Ee})}if(await Q(ve,se),F!==h.current)return;o(pe=>({...pe,status:"loaded",alias:ve}))}catch(se){if(F!==h.current)return;const pe=se instanceof Error&&se.message?se.message:"host_font_failed";o(Ee=>({...Ee,status:"failed",alias:null,error:pe}))}if(de&&ye){let se=0;try{await j(F,ye,(pe,Ee)=>{Ee&&!se&&(se=Ee,we+=Ee),oe+=pe,Se()}),N(F,{status:"ready"})}catch(pe){if(F!==h.current)return;const Ee=pe instanceof Error&&pe.message?pe.message:"host_font_failed";o(Be=>({...Be,error:Be.error??Ee,glyphs:{...Be.glyphs,status:"failed"}}))}}},[w,j,M,A,N]),_=C.useCallback(async U=>{const ee=Qi(U)!==Qi(r.current.font);ee&&(T("superseded"),p.current=new Set,g.current=new Set,b.current=new Set);const q=++h.current;if(!U){o(Bu);return}const{isInstalled:P,readCached:ie,register:ae,isRegistered:F,readSubsets:E}=M(),Y=Zp(U),X=Qi(U),le=ng(U);let Q="checking";Y&&F(Y)?Q="loaded":P(U.family)?Q="installed":Y||(Q="unavailable");let ve="checking";if(le?(le.scope==="cjk"?P(le.family):Q==="installed")&&(ve="installed"):ve="none",o(de=>({...Bu,font:U,status:Q==="checking"?"checking":Q,alias:Q==="loaded"?Y:null,totalBytes:Wp(U),glyphs:{source:le,status:ve,alias:ee?null:de.glyphs.alias,covered:p.current.size},glyphRevision:de.glyphRevision})),Q==="checking"&&Y){const de=await Promise.all(U.faces.map(we=>ie(we.sha256)));if(q!==h.current)return;if(Q="needs",de.every(Boolean))try{if(await ae(Y,U.faces.map((we,oe)=>({face:we,data:de[oe]}))),q!==h.current)return;Q="loaded",o(we=>({...we,status:"loaded",alias:Y}))}catch{}}if(ve==="checking"&&le){const de=await E(le.sha256);if(q!==h.current)return;if(de.length)try{await R(q,Hu(le),de),ve="cached"}catch{ve="needs"}else ve="needs";if(q!==h.current)return}const ye=eg(A(),X),xe=ye==="accepted"||ve==="cached"||Date.now()<m.current;if(ve==="cached"&&(ve="ready",N(q,{status:"ready"}),j(q,le,()=>{}).catch(()=>{})),Q!=="needs"&&ve!=="needs")return;if(xe){V(U,{interactive:!1});return}const me=ye==="declined"?"declined":"available";o(de=>({...de,status:Q==="needs"?me:de.status,glyphs:ve==="needs"?{...de.glyphs,status:me}:de.glyphs}))},[V,T,A,N,j,M,R]),D=C.useCallback(()=>{const U=Qi(r.current.font);U&&tg(A(),U,"declined"),o(ee=>({...ee,interactive:!1,status:["available","failed"].includes(ee.status)?"declined":ee.status,glyphs:["available","failed"].includes(ee.glyphs.status)?{...ee.glyphs,status:"declined"}:ee.glyphs}))},[A]),L=C.useCallback(()=>{m.current=Date.now()+uw,a==null||a.sendHostFontRefresh();const U=r.current,ee=["available","declined","failed"];U.font&&(ee.includes(U.status)||ee.includes(U.glyphs.status))&&V(U.font,{interactive:!1})},[a,V]),z=C.useCallback(U=>{const{glyphs:ee}=r.current;if(ee.status!=="ready"||!ee.source)return;const q=ee.source;for(const P of U){const ie=P.codePointAt(0);ie<128&&q.scope!=="all"||bb(q.scope,ie)&&(p.current.has(ie)||g.current.has(ie)||b.current.add(ie))}!b.current.size||v.current||(v.current=setTimeout(()=>{v.current=null;const P=h.current,ie=[...b.current].slice(0,fw);for(const ae of ie)b.current.delete(ae),g.current.add(ae);(async()=>{const ae=await x(q,ie,()=>{});P===h.current&&(await M().writeSubset(q.sha256,ae),await R(P,Hu(q),[ae]))})().catch(()=>{})},dw))},[x,M,R]);return C.useEffect(()=>{if(!a)return;const U=a.on("terminalFont",ee=>{_(ee)});return()=>{U(),v.current&&clearTimeout(v.current),v.current=null}},[a,_]),C.useEffect(()=>{const U=ee=>{if(ee.key!==pt.hostFontConsent)return;const q=r.current,P=Qi(q.font),ie=q.status==="available"||q.glyphs.status==="available";if(!P||!ie)return;const ae=eg(A(),P);ae==="accepted"?V(q.font,{interactive:!1}):ae==="declined"&&D()};return window.addEventListener("storage",U),()=>window.removeEventListener("storage",U)},[V,D,A]),{hostFont:l,loadHostFont:V,declineHostFont:D,syncHostFont:L,ensureHostGlyphs:z}}function mw(a,i=window,l=document){const o=g=>{var b;((b=i.navigator)==null?void 0:b.onLine)!==!1&&a.wake(g)},r=()=>{l.visibilityState==="visible"&&o("visible")},u=()=>o("pageshow"),h=()=>o("online"),m=()=>o("focus"),p=()=>o("resume");return l.addEventListener("visibilitychange",r),l.addEventListener("resume",p),i.addEventListener("pageshow",u),i.addEventListener("online",h),i.addEventListener("focus",m),()=>{l.removeEventListener("visibilitychange",r),l.removeEventListener("resume",p),i.removeEventListener("pageshow",u),i.removeEventListener("online",h),i.removeEventListener("focus",m)}}function zo(a){return{wsUrl:a.wsUrl,token:a.token||void 0,pairCode:a.pairCode||void 0,clientId:a.clientId,autoReconnect:a.autoReconnect,reconnectIntervalMs:2e3,maxReconnectAttempts:0,pingIntervalMs:1e4}}const pw={connectionState:"disconnected",role:"viewer",hostPalette:null,rttMs:null,sharedWindowCount:1,terminalResetVersion:0,agentStatus:null,lastPairedAt:null},ag={role:"viewer",controllerId:void 0,hostname:void 0,hostPalette:null,rttMs:null,sharedWindowCount:1};function gw(a,i){switch(i.type){case"stateChange":return{...a,connectionState:i.state,stateCode:i.code,stateDetail:i.detail,agentStatus:i.state==="connected"?a.agentStatus:null};case"ready":{const{message:l}=i;return{...a,terminalResetVersion:a.terminalResetVersion+(i.resetTerminal?1:0),role:l.role,controllerId:l.controllerId,hostId:l.hostId,hostname:l.hostname,assignedClientId:l.clientId||a.assignedClientId,hostPalette:l.terminalPalette||null}}case"hostReconnecting":return{...a,...ag,stateCode:i.code,stateDetail:i.detail};case"sessionRestarted":return{...a,hostname:i.hostname,hostPalette:i.palette||null,terminalResetVersion:a.terminalResetVersion+1};case"roleChange":return{...a,role:i.role,controllerId:i.controllerId,hostId:i.hostId||a.hostId,assignedClientId:i.assignedClientId||a.assignedClientId};case"controlGranted":return{...a,role:"controller"};case"paired":return{...a,lastPairedAt:i.at};case"rtt":return{...a,rttMs:i.rttMs};case"peerCount":return{...a,sharedWindowCount:Math.max(1,i.count)};case"sessionReady":return{...a,connectionState:"connected"};case"agentStatus":return{...a,agentStatus:i.status};case"reset":return{...a,...ag,hostId:void 0,assignedClientId:void 0,terminalResetVersion:a.terminalResetVersion+(i.resetTerminal?1:0)}}}const bw=3e4;function yw(a,i){const[l,o]=C.useState(null),r=C.useRef(null),u=C.useRef(null),h=C.useCallback(b=>{(b==null?void 0:b.phase)!=="starting"&&u.current&&(clearTimeout(u.current),u.current=null),r.current=b,o(b)},[]),m=C.useCallback(()=>{const b=a.current;b&&(h({phase:"starting"}),b.sendHerdrStart(),u.current=setTimeout(()=>{var v;u.current=null,((v=r.current)==null?void 0:v.phase)==="starting"&&h({phase:"failed",message:i.current("herdrLaunch.timeout")})},bw))},[a,i,h]),p=C.useCallback(b=>{var v;return b.code==="herdr_not_running"?(((v=r.current)==null?void 0:v.phase)!=="starting"&&h({phase:"stopped"}),!0):b.code==="herdr_start_failed"&&r.current?(h({phase:"failed",message:b.message||""}),!0):!1},[h]),g=C.useCallback(()=>h(null),[h]);return C.useEffect(()=>()=>{u.current&&clearTimeout(u.current)},[]),{herdrLaunch:l,startHerdr:m,handleLaunchError:p,forgetHerdrLaunch:g}}const hn="/ws/client";class vw{constructor(){W(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(i,l){return this.listeners[i].add(l),()=>{this.listeners[i].delete(l)}}emit(i,...l){this.listeners[i].forEach(r=>{try{r(...l)}catch(u){console.error(`Error in event listener for ${i}:`,u)}})}}const wb=27,Sb=91,xw=60,lg=59,Cb=77,Tb=48,ww=57,Sw=64,Cw=-30,Uu=32,sg=255;function Mb(a){return Number.isInteger(a)&&(a&Cw)===Sw}function Tw(a){return a>=Tb&&a<=ww}function Ku(a,i){let l=i,o=0;for(;l<a.length&&Tw(a[l]);){if(o=o*10+(a[l]-Tb),o>65535)return null;l+=1}return l===i?null:{value:o,next:l}}function Mw(a,i){if(a[i]!==wb||a[i+1]!==Sb||a[i+2]!==xw)return-1;const l=Ku(a,i+3);if(!l||!Mb(l.value)||a[l.next]!==lg)return-1;const o=Ku(a,l.next+1);if(!o||a[o.next]!==lg)return-1;const r=Ku(a,o.next+1);return!r||a[r.next]!==Cb?-1:r.next+1}function Aw(a,i){if(a[i]!==wb||a[i+1]!==Sb||a[i+2]!==Cb||i+6>a.length)return-1;const l=a[i+3]-Uu,o=a[i+4],r=a[i+5];return!Mb(l)||o<Uu||o>sg||r<Uu||r>sg?-1:i+6}function ar(a){if(!a)return!1;const i=a instanceof Uint8Array?a:new Uint8Array(a);if(i.length===0)return!1;let l=0;for(;l<i.length;){const o=Mw(i,l);if(o>l){l=o;continue}const r=Aw(i,l);if(r>l){l=r;continue}return!1}return!0}class Ew{constructor(i){W(this,"segments",[]);W(this,"flushScheduled",!1);this.getSocket=i}push(i){const l=i instanceof Uint8Array?i:new Uint8Array(i);l.length!==0&&(this.segments.push(l),this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flush())))}flush(){if(this.flushScheduled=!1,this.segments.length===0)return;let i=this.segments;this.segments=[];const l=this.getSocket();if(l&&(l.bufferedAmount??0)>256*1024&&(i=i.filter(r=>!ar(r))),i.length===0)return;let o;if(i.length===1)o=i[0];else{let r=0;for(let h=0;h<i.length;h++)r+=i[h].byteLength;o=new Uint8Array(r);let u=0;for(let h=0;h<i.length;h++)o.set(i[h],u),u+=i[h].byteLength}l&&l.readyState===WebSocket.OPEN&&l.send(o)}clear(){this.segments=[],this.flushScheduled=!1}}const Nw=3e3,kw=1e4,Lw=1500;class Rw extends vw{constructor(l){super();W(this,"ws",null);W(this,"config");W(this,"state","disconnected");W(this,"reconnectAttempts",0);W(this,"reconnectTimer",null);W(this,"pingTimer",null);W(this,"pingTimestamp",null);W(this,"lastInboundAt",0);W(this,"pingSentAt",null);W(this,"connectStartedAt",0);W(this,"lastWakeConnectAt",0);W(this,"probeTimer",null);W(this,"rejectedByRelay",!1);W(this,"isManuallyClosed",!1);W(this,"authFailureDetail",null);W(this,"authFailureCode",null);W(this,"temporaryFailureCode",null);W(this,"input",new Ew(()=>this.ws));W(this,"terminalCols",80);W(this,"terminalRows",24);this.config={...l}}updateConfig(l){this.config={...this.config,...l}}getConfig(){return{...this.config}}getState(){return this.state}setState(l,o,r){this.state!==l&&(this.state=l,this.emit("stateChange",l,o,r))}connect(l){if(l&&(this.terminalCols=l.cols,this.terminalRows=l.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 o=_w(this.config.wsUrl),r=new WebSocket(o);this.ws=r,this.connectStartedAt=Date.now(),r.binaryType="arraybuffer",r.onopen=()=>{this.isStaleSocket(r)||this.handleOpen()},r.onmessage=u=>{this.isStaleSocket(r)||this.handleMessage(u)},r.onerror=u=>{this.isStaleSocket(r)||this.handleError(u)},r.onclose=u=>{this.isStaleSocket(r)||this.handleClose(u)}}catch(o){this.setState("error",o instanceof Error?o.message:"Connection failed","connection_failed"),this.scheduleReconnect()}}}isStaleSocket(l){return this.ws!==l}teardownSocket(l=1e3,o="Client closed the connection"){this.input.clear();const r=this.ws;if(r){this.ws=null,r.onopen=null,r.onmessage=null,r.onerror=null,r.onclose=null;try{(r.readyState===WebSocket.OPEN||r.readyState===WebSocket.CONNECTING)&&r.close(l,o)}catch{}}}disconnect(){this.isManuallyClosed=!0,this.clearTimers(),this.input.clear(),this.teardownSocket(1e3,"User initiated disconnect"),this.setState("disconnected")}reconnectWith(l){this.updateConfig(l),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(l){if(this.isManuallyClosed||!this.config.autoReconnect||this.authFailureDetail||this.rejectedByRelay)return;const o=Date.now(),r=this.ws;if(!r){if(o-this.lastWakeConnectAt<Lw)return;this.lastWakeConnectAt=o,this.reconnectAttempts=0,this.connect();return}if(r.readyState===WebSocket.CONNECTING){o-this.connectStartedAt>kw&&this.dropStaleSocket("connection_stalled");return}r.readyState===WebSocket.OPEN&&o-this.lastInboundAt>this.pingIntervalMs()+2e3&&this.probeLiveness()}pingIntervalMs(){return this.config.pingIntervalMs||1e4}probeLiveness(){const l=this.ws;if(!l||l.readyState!==WebSocket.OPEN||this.probeTimer)return;const o=Date.now();this.sendPing(),this.probeTimer=setTimeout(()=>{this.probeTimer=null,this.ws===l&&this.lastInboundAt<o&&this.dropStaleSocket("connection_stale")},Nw)}dropStaleSocket(l){this.clearTimers(),this.teardownSocket(4e3,"Connection went silent"),this.setState("reconnecting","The connection went silent. Reconnecting...",l),this.reconnectAttempts=0,this.lastWakeConnectAt=Date.now(),this.connect()}handleOpen(){this.lastInboundAt=Date.now(),this.sendHello(),this.startHeartbeat()}async handleMessage(l){if(this.lastInboundAt=Date.now(),typeof l.data=="string")try{const o=JSON.parse(l.data);o.type==="pong"?this.handlePong():this.handleServerMessage(o)}catch(o){console.warn("Received unparseable text frame from server:",o)}else if(l.data instanceof ArrayBuffer)this.emit("binaryData",new Uint8Array(l.data));else if(typeof Blob<"u"&&l.data instanceof Blob)try{const o=await l.data.arrayBuffer();this.emit("binaryData",new Uint8Array(o))}catch(o){console.error("Failed to convert Blob to ArrayBuffer:",o)}}handlePong(){if(this.pingTimestamp){const l=Math.max(0,performance.now()-this.pingTimestamp);this.pingTimestamp=null,this.emit("rttUpdate",Math.round(l))}}handleError(l){console.error("WebSocket error:",l),this.emit("error",{code:"WS_ERROR",message:"WebSocket connection error"})}handleClose(l){if(this.clearTimers(),this.ws=null,this.authFailureDetail){this.setState("error",this.authFailureDetail,this.authFailureCode??void 0);return}if(l.code===1008&&this.temporaryFailureCode){this.setState("reconnecting",l.reason||"The relay is temporarily unavailable",this.temporaryFailureCode),this.scheduleReconnect();return}if(l.code===1008){this.rejectedByRelay=!0,this.setState("error",l.reason||"The relay rejected the connection",String(l.code));return}!this.isManuallyClosed&&this.config.autoReconnect?(this.setState("reconnecting",`Connection closed (${l.code}). Retrying...`,"connection_closed"),this.scheduleReconnect()):this.setState("disconnected",`Closed: ${l.reason||l.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 l=this.config.reconnectIntervalMs||2e3,r=Math.min(3e4,Math.floor(l*1.5**(this.reconnectAttempts-1)+Math.random()*500));this.reconnectTimer=setTimeout(()=>{this.connect()},r)}startHeartbeat(){this.pingTimer&&clearInterval(this.pingTimer);const l=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>=l){this.probeLiveness();return}this.sendPing()}},l)}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 l={type:"ping"};this.sendJson(l)}sendJson(l){this.flushInput(),this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify(l))}sendInput(l){this.input.push(l)}flushInput(){this.input.flush()}sendBinary(l){this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(l)}sendText(l){const o=Sd(l);this.sendInput(o)}}function _w(a){if(/^wss?:\/\//i.test(a))return a;if(/^https?:\/\//i.test(a)){const i=new URL(a);return i.protocol=i.protocol==="https:"?"wss:":"ws:",(!i.pathname||i.pathname==="/")&&(i.pathname=hn),i.toString()}if(typeof window<"u"&&window.location){const l=window.location.protocol==="https:"?"wss:":"ws:",o=window.location.host,r=a.startsWith("/")?a:`/${a}`;return`${l}//${o}${r}`}return"ws://127.0.0.1:8787/ws/client"}class jw extends Rw{constructor(){super(...arguments);W(this,"currentRole","viewer");W(this,"controllerId");W(this,"hostId");W(this,"assignedClientId")}getRole(){return this.currentRole}getControllerId(){return this.controllerId}getHostId(){return this.hostId}getAssignedClientId(){return this.assignedClientId}handleServerMessage(l){switch(l.type){case"ready":{this.reconnectAttempts=0,this.setState("connected"),this.currentRole=l.role,this.controllerId=l.controllerId,this.hostId=l.hostId,this.assignedClientId=l.clientId,this.emit("ready",l),this.emit("roleChange",l.role,l.controllerId,l.hostId,l.clientId),typeof l.clientCount=="number"&&this.emit("peerCount",l.clientCount),this.emit("terminalFont",l.terminalFont??null);break}case"paired":{this.emit("paired",{token:l.token,deviceId:l.deviceId,hostId:l.hostId,expiresAt:l.expiresAt});break}case"control_state":{this.currentRole=l.role,this.controllerId=l.controllerId,this.emit("controlState",l.role,l.controllerId),this.emit("roleChange",l.role,l.controllerId,this.hostId,this.assignedClientId),typeof l.clientCount=="number"&&this.emit("peerCount",l.clientCount);break}case"host_reconnecting":{this.temporaryFailureCode="host_reconnecting",this.setState("reconnecting","Herdr host is reconnecting",l.code||"host_reconnecting"),this.emit("hostReconnecting",l.code);break}case"session_restarted":{this.setState("reconnecting","Herdr session is restarting","session_restarted"),this.emit("sessionRestarted",l.cols,l.rows,l.terminalPalette,l.hostname),this.emit("terminalFont",l.terminalFont??null);break}case"session_ready":{this.setState("connected"),this.emit("sessionReady",l);break}case"exit":{this.emit("exit",l.code,l.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":{l.code==="host_offline"||l.code==="host_reconnecting"||l.code==="host_reconnect_timeout"||l.code==="rate_limited"?(this.temporaryFailureCode=String(l.code),this.setState("reconnecting",l.message,String(l.code))):(l.code==="auth_required"||l.code==="unauthorized"||l.code==="device_revoked"||l.code==="invalid_handshake"||l.code==="too_many_hosts"||l.code===401||l.code===403)&&(this.authFailureDetail=l.message,this.authFailureCode=String(l.code),this.setState("error",l.message,this.authFailureCode)),this.emit("error",{code:l.code,message:l.message});break}case"paste_file_ready":{this.emit("pasteFileReady",l.path);break}case"agent_status":{this.emit("agentStatus",l);break}case"update_status":{this.emit("updateStatus",l);break}case"terminal_font":{this.emit("terminalFont",l.terminalFont??null);break}case"host_font_chunk":{this.emit("hostFontChunk",l);break}case"host_font_subset_ready":{this.emit("hostFontSubset",l);break}}}sendHello(){const l={type:"hello",protocol:1,clientId:this.config.clientId,cols:this.terminalCols,rows:this.terminalRows,capabilities:["host_handoff"]};this.config.token&&(l.token=this.config.token),this.config.pairCode&&(l.pairCode=this.config.pairCode),this.sendJson(l)}claimControl(l=!1){const o={type:"claim_control",...l?{force:!0}:{}};this.sendJson(o)}releaseControl(){const l={type:"release_control"};this.sendJson(l)}sendResize(l,o){this.terminalCols=l,this.terminalRows=o;const r={type:"resize",cols:l,rows:o};this.sendJson(r)}sendPasteFile(l,o){this.sendJson({type:"paste_file",mime:l,dataBase64:o})}sendHostFontChunkRequest(l,o){this.sendJson({type:"host_font_chunk_request",sha256:l,index:o})}sendHostFontSubsetRequest(l,o,r){this.sendJson({type:"host_font_subset_request",sha256:l,text:o,requestId:r})}sendHostFontRefresh(){this.sendJson({type:"host_font_refresh"})}sendHerdrStart(){this.sendJson({type:"herdr_start"})}}function Ow(a,i,l){const o=C.useRef(l);if(o.current=l,!a.current){const r=new jw(i());for(const u of Object.keys(l)){const h=(...m)=>{var p,g;return(g=(p=o.current)[u])==null?void 0:g.call(p,...m)};r.on(u,h)}a.current=r}return a.current}const Dw=3*1024*1024,Ab=1568,zw=[.85,.7,.55,.4],Ho={active:!1,phase:"idle",ratio:0,percent:0,statusText:""};function Hw(a,i,l=Ab){if(a<=0||i<=0)return{width:Math.max(1,a),height:Math.max(1,i)};const o=Math.max(a,i);if(o<=l)return{width:a,height:i};const r=l/o;return{width:Math.max(1,Math.round(a*r)),height:Math.max(1,Math.round(i*r))}}function Bw(a){if(typeof a!="string"||a.length===0)return 0;const i=a.length;let l=0;a.endsWith("==")?l=2:a.endsWith("=")&&(l=1);const o=Math.floor(i*3/4)-l;return Number.isFinite(o)&&o>0?o:0}function Uw(a){return a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(1)} KB`:`${(a/(1024*1024)).toFixed(1)} MB`}async function Kw(a){if(typeof createImageBitmap=="function")try{const i=await createImageBitmap(a,{imageOrientation:"from-image"});return{source:i,width:i.width,height:i.height,cleanup:()=>{typeof i.close=="function"&&i.close()}}}catch{try{const i=await createImageBitmap(a);return{source:i,width:i.width,height:i.height,cleanup:()=>{typeof i.close=="function"&&i.close()}}}catch{}}return new Promise((i,l)=>{if(typeof Image>"u")return l(new Error("Image decoding not supported in this environment"));const o=new Image,r=URL.createObjectURL(a);o.onload=()=>{i({source:o,width:o.naturalWidth||o.width,height:o.naturalHeight||o.height,cleanup:()=>{try{URL.revokeObjectURL(r)}catch{}}})},o.onerror=()=>{try{URL.revokeObjectURL(r)}catch{}l(new Error("Failed to decode image source"))},o.src=r})}async function Eb(a,i=Ab,l=Dw){var r;if(!a||a.size===0||a.type&&!a.type.startsWith("image/"))return null;let o;try{o=await Kw(a)}catch(u){return console.warn("Failed to decode image for paste:",u),null}try{const{width:u,height:h}=Hw(o.width,o.height,i),m=document.createElement("canvas");m.width=u,m.height=h;const p=m.getContext("2d");if(!p)return null;p.drawImage(o.source,0,0,u,h);let g="image/webp";try{m.toDataURL("image/webp",.85).startsWith("data:image/webp")||(g="image/jpeg")}catch{g="image/jpeg"}for(const b of zw){let v;try{v=m.toDataURL(g,b)}catch{continue}if(!(v!=null&&v.startsWith("data:")))continue;const w=v.indexOf(","),x=w!==-1?v.slice(w+1):"",T=Bw(x);if(T<=l)return{mime:g,dataBase64:x,dataUrl:v,byteLength:T,width:u,height:h}}return null}finally{(r=o.cleanup)==null||r.call(o)}}const Iw=3e4,Fw=1200;function Gw({adapterRef:a,role:i,connectionState:l,warnViewerMode:o,addToast:r,t:u,sendPasteFile:h}){const[m,p]=C.useState(Ho),g=C.useRef(null),b=C.useRef(0),v=C.useRef(null),w=C.useCallback(()=>{v.current&&(clearTimeout(v.current),v.current=null)},[]),x=C.useCallback(()=>{w(),g.current=null,p(Ho)},[w]),T=C.useCallback(()=>{g.current!==null&&x()},[x]),M=C.useCallback(()=>{const N=g.current;N!==null&&(w(),p({active:!0,phase:"completed",ratio:1,percent:100,statusText:u("virtualKeyboard.uploadProgressCompleted")}),setTimeout(()=>{g.current===N&&(g.current=null,p(Ho))},Fw))},[w,u]);C.useEffect(()=>{l!=="connected"&&T()},[l,T]),C.useEffect(()=>w,[w]);const A=C.useCallback(async N=>{if(i!=="controller")return o(),!1;if(!a.current||l!=="connected")return r("error",u("serverErrors.host_offline")),!1;if(g.current!==null)return!1;const R=++b.current;g.current=R,w();const j=_=>(_&&r("error",_),g.current=null,p(Ho),!1),V="dataBase64"in N&&typeof N.dataBase64=="string";try{let _;if(V)_=N;else{const L=N;if(p({active:!0,phase:"reading",ratio:.1,percent:10,statusText:u("virtualKeyboard.uploadProgressReading")}),!L||L.size===0)return j(u("clipboard.fileEmpty"));if(L.type&&!L.type.startsWith("image/"))return j(u("clipboard.unsupportedType"));p({active:!0,phase:"processing",ratio:.35,percent:35,statusText:u("virtualKeyboard.uploadProgressProcessing")});const z=await Eb(L);if(g.current!==R)return!1;if(!z)return j(u("clipboard.imageTooLarge"));_=z,p({active:!0,phase:"processing",ratio:.6,percent:60,statusText:u("virtualKeyboard.uploadProgressProcessing")})}p({active:!0,phase:"sending",ratio:.75,percent:75,statusText:u("virtualKeyboard.uploadProgressSending")});const D=h(_.mime,_.dataBase64);return g.current!==R?!1:D?(p({active:!0,phase:"waitingHost",ratio:.88,percent:88,statusText:u("virtualKeyboard.uploadProgressWaitingHost")}),v.current=setTimeout(()=>{g.current===R&&j(u("serverErrors.paste_file_write_failed"))},Iw),!0):j()}catch(_){return console.error("Failed to process/upload image:",_),g.current===R&&j(u("clipboard.imageTooLarge")),!1}},[a,i,l,o,r,u,h,w]);return{uploadProgress:m,uploadImage:A,resetUploadProgress:x,abortUpload:T,completeUpload:M}}const Yw=4096,$w=8*1024*1024;function qw(){const a=C.useRef(null),i=C.useRef([]),l=C.useRef(0),o=C.useCallback(p=>{for(i.current.push(p),l.current+=p.byteLength;i.current.length>Yw||l.current>$w;){const g=i.current.shift();if(!g)break;l.current-=g.byteLength}},[]),r=C.useCallback(p=>{const g=a.current;if(g)try{g(p);return}catch(b){console.debug("Terminal output sink threw, buffering chunk instead:",b)}o(p)},[o]),u=C.useCallback(p=>{a.current=p;const g=i.current;i.current=[],l.current=0;for(let b=0;b<g.length;b++)try{p(g[b])}catch(v){console.debug("Terminal sink threw while flushing, re-buffering the tail:",v);for(let w=b;w<g.length;w++)o(g[w]);break}return()=>{a.current===p&&(a.current=null)}},[o]),h=C.useCallback(()=>i.current.length,[]),m=C.useCallback(()=>{i.current=[],l.current=0},[]);return{receiveOutput:r,subscribeToOutput:u,getPendingOutputChunkCount:h,clearPendingOutput:m}}const Nb=64,os=4096;function Td(){const a=Math.random().toString(36).substring(2,10);return`profile-${Date.now().toString(36)}-${a}`}function Vw(a,i){return(typeof a=="string"?a.trim().slice(0,Nb):"")||i}function lr(a,i){if(!a||typeof a!="object"||Array.isArray(a))return null;const l=a,o=typeof l.wsUrl=="string"?l.wsUrl.trim().slice(0,2048):"",r=typeof l.token=="string"?l.token.slice(0,os):"",u=typeof l.pairCode=="string"?l.pairCode.trim().toUpperCase().slice(0,32):"";if(!o||!o.startsWith("/")&&!/^(?:wss?|https?):\/\//i.test(o)||!r&&!u)return null;const h=Date.now(),m=typeof l.id=="string"&&l.id.length>0?l.id.slice(0,128):Td(),p=typeof l.hostname=="string"&&l.hostname.trim()?l.hostname.trim().slice(0,Nb):`Herdr ${i+1}`;return{id:m,displayName:Vw(l.displayName,p),wsUrl:o,token:r,...u?{pairCode:u}:{},...typeof l.hostId=="string"&&l.hostId.trim()?{hostId:l.hostId.trim().slice(0,128)}:{},...typeof l.hostname=="string"&&l.hostname.trim()?{hostname:l.hostname.trim().slice(0,128)}:{},...typeof l.deviceId=="string"&&l.deviceId.trim()?{deviceId:l.deviceId.trim().slice(0,128)}:{},autoReconnect:l.autoReconnect!==!1,createdAt:Number.isFinite(l.createdAt)?Number(l.createdAt):h,lastUsedAt:Number.isFinite(l.lastUsedAt)?Number(l.lastUsedAt):h}}function og(a,i=0){const l=lr({...a,id:a.id||Td()},i);if(!l)throw new Error("a connection profile requires a relay URL and token or pairing code");return l}function rg(a){let i=a.wsUrl.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"").toLowerCase();if(typeof window<"u")try{const l=new URL(a.wsUrl,window.location.origin);l.protocol=l.protocol==="wss:"?"https:":"http:",l.pathname=l.pathname.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"")||"/",l.search="",l.hash="",i=l.toString().replace(/\/$/,"").toLowerCase()}catch{}return`${i}::${a.hostId||""}`}function kb(a){var u;const i=[];if((Array.isArray(a.profiles)?a.profiles.slice(0,64):[]).forEach((h,m)=>{const p=lr(h,m);p&&!i.some(g=>g.id===p.id)&&i.push(p)}),i.length===0&&(typeof a.token=="string"&&a.token||typeof a.pairCode=="string"&&a.pairCode)){const h=lr({id:"profile-migrated",displayName:"Herdr 1",wsUrl:typeof a.wsUrl=="string"&&a.wsUrl.trim()?a.wsUrl:hn,token:a.token||"",pairCode:a.pairCode||"",autoReconnect:a.autoReconnect!==!1},0);h&&i.push(h)}const o=typeof a.activeProfileId=="string"?a.activeProfileId:"",r=i.some(h=>h.id===o)?o:((u=i[0])==null?void 0:u.id)||"";return{profiles:i,activeProfileId:r}}const Lb=[{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"}],Pw=[{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 rs(){return JSON.parse(JSON.stringify(Lb))}const Xw=[["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 Qw(a){return Xw.some(i=>a.length===i.length&&a.every((l,o)=>l.id===i[o]&&l.enabled!==!1))}function Zw(a){if(!Array.isArray(a)||a.length===0)return rs();const i=a.filter(l=>typeof l=="object"&&l!==null&&typeof l.id=="string"&&typeof l.label=="string"&&typeof l.code=="string");return Qw(i)?rs():i.filter(l=>l.id!=="drawer_agent")}function sd(a,i){if(i){const l=`keyTitles.${a.id}`,o=i(l);if(o&&o!==l)return o}return a.title||a.label}const cg="herdr-remote.ignoredUpdate";function Ww(){const a=Mi("local",pt.ignoredUpdate);if(a!==null)return a;const i=Mi("local",cg);if(i===null)return null;Rb(i);try{window.localStorage.removeItem(cg)}catch{}return i}function Rb(a){wn("local",pt.ignoredUpdate,a)}function Jw(){return`client-${Math.random().toString(36).substring(2,8)}`}function _b(){return typeof navigator<"u"&&navigator.language&&navigator.language.toLowerCase().startsWith("zh")?"zh":"en"}function jb(){const a=typeof window<"u"&&window.innerWidth<640;return{wsUrl:hn,token:"",pairCode:"",clientId:Jw(),autoReconnect:!0,profiles:[],activeProfileId:"",fontSize:a?nr:ss,fontSizeFollowsHost:!0,fontFamily:mb,toolbarVisible:!0,toolbarPosition:"bottom",vibrateOnKeyPress:!0,predictiveEcho:"auto",agentAlertBadge:!0,agentAlertSound:!1,agentAlertVibrate:!1,agentAlertNotify:!1,language:_b(),virtualKeys:rs(),agentKeymaps:{},adminToken:"",adminTokens:{}}}const e1=["wsUrl","token","pairCode","clientId","autoReconnect","language","agentKeymaps"],t1=["wsUrl","token","pairCode","autoReconnect"],Md=["fontSize","fontSizeFollowsHost","fontFamily","toolbarVisible","toolbarPosition","vibrateOnKeyPress","predictiveEcho","virtualKeys","agentAlertBadge","agentAlertSound","agentAlertVibrate","agentAlertNotify","adminToken","adminTokens"],n1=Md.filter(a=>a!=="adminToken"&&a!=="adminTokens"),ug=["theme","colorMode"];function od(a){const i=a;if(!ug.some(r=>i[r]!==void 0))return{data:a,changed:!1};const o={...i};for(const r of ug)delete o[r];return{data:o,changed:!0}}function Ob(a){if(!a||typeof a!="object"||Array.isArray(a))return{};const i={};for(const[l,o]of Object.entries(a).slice(0,32))typeof o!="string"||o.length===0||(i[l.slice(0,512)]=o.slice(0,os));return i}function Db(){const a=jb();if(typeof window>"u")return a;let i={};const l=Mi("local",pt.settings);if(l)try{i=JSON.parse(l)}catch(P){console.warn("Failed to parse localStorage settings:",P)}const o=od(i);o.changed&&(i=o.data,wn("local",pt.settings,JSON.stringify(i)));let r=null;const u=Mi("session",pt.sessionView);if(u)try{r=JSON.parse(u)}catch(P){console.warn("Failed to parse sessionStorage settings:",P)}if(!r){const P={};for(const ie of Md)i[ie]!==void 0&&(P[ie]=i[ie]);r=P,wn("session",pt.sessionView,JSON.stringify(r))}const h=Ou(r.fontFamily??i.fontFamily??a.fontFamily),m=window.innerWidth<640?nr:ss,p=r.fontSize??i.fontSize??a.fontSize,g=Wa(p,m),b=r.fontSizeFollowsHost??i.fontSizeFollowsHost,v=typeof b=="boolean"?b:p===void 0||g===ss||g===nr,w=r.virtualKeys??i.virtualKeys??a.virtualKeys,x=Zw(w),T=i.language??a.language,M=T==="zh"||T==="en"?T:_b(),A=kb(i),N=A.profiles.find(P=>P.id===A.activeProfileId),R=od(r);R.changed&&(r=R.data,wn("session",pt.sessionView,JSON.stringify(r)));const j=r.toolbarVisible??i.toolbarVisible??a.toolbarVisible,V=r.toolbarPosition??i.toolbarPosition??a.toolbarPosition,_=r.vibrateOnKeyPress??i.vibrateOnKeyPress??a.vibrateOnKeyPress,D=P=>{const ie=r[P]??i[P];return typeof ie=="boolean"?ie:a[P]},L=(r==null?void 0:r.predictiveEcho)??(i==null?void 0:i.predictiveEcho)??a.predictiveEcho,z=L==="always"||L==="off"||L==="auto"?L:"auto",U=typeof r.adminToken=="string"?r.adminToken.slice(0,os):typeof i.adminToken=="string"?i.adminToken.slice(0,os):a.adminToken,ee=Ob(r.adminTokens),q={...a,...i,...r,wsUrl:(N==null?void 0:N.wsUrl)||(typeof i.wsUrl=="string"?i.wsUrl:a.wsUrl),token:(N==null?void 0:N.token)||"",pairCode:(N==null?void 0:N.pairCode)||"",autoReconnect:(N==null?void 0:N.autoReconnect)??a.autoReconnect,profiles:A.profiles,activeProfileId:A.activeProfileId,clientId:typeof i.clientId=="string"&&i.clientId.trim()?i.clientId.trim().slice(0,128):a.clientId,fontFamily:h,fontSize:g,fontSizeFollowsHost:v,toolbarVisible:j,toolbarPosition:V,vibrateOnKeyPress:_,predictiveEcho:z,virtualKeys:x,agentKeymaps:hb(i.agentKeymaps),agentAlertBadge:D("agentAlertBadge"),agentAlertSound:D("agentAlertSound"),agentAlertVibrate:D("agentAlertVibrate"),agentAlertNotify:D("agentAlertNotify"),language:M,adminToken:U,adminTokens:ee};return typeof i.fontFamily=="string"&&Ou(i.fontFamily)!==i.fontFamily&&(i.fontFamily=Ou(i.fontFamily),wn("local",pt.settings,JSON.stringify(i))),q}function vi(a){var w;const l={...Db(),...a};l.agentKeymaps=hb(l.agentKeymaps),l.adminTokens=Ob(l.adminTokens),typeof l.adminToken=="string"&&(l.adminToken=l.adminToken.slice(0,os)),a.fontSize!==void 0&&(l.fontSize=Wa(a.fontSize)),a.predictiveEcho!==void 0&&(a.predictiveEcho==="auto"||a.predictiveEcho==="always"||a.predictiveEcho==="off"?l.predictiveEcho=a.predictiveEcho:l.predictiveEcho="auto");const o=kb(l);let r=o.profiles,u=o.activeProfileId;if(t1.some(x=>a[x]!==void 0)){const x=r.findIndex(A=>A.id===u),T=x>=0?{...r[x]}:{id:Td(),displayName:`Herdr ${r.length+1}`,wsUrl:l.wsUrl,token:"",autoReconnect:!0,createdAt:Date.now(),lastUsedAt:Date.now()};T.wsUrl=l.wsUrl,T.token=l.token,T.pairCode=l.pairCode||void 0,T.autoReconnect=l.autoReconnect,T.lastUsedAt=Date.now();const M=lr(T,Math.max(x,0));M?x>=0?r[x]=M:(r.push(M),u=M.id):x>=0&&(r=r.filter(A=>A.id!==u),u=((w=r[0])==null?void 0:w.id)||"")}r.length>0&&!r.some(x=>x.id===u)&&(u=r[0].id);const m=r.find(x=>x.id===u);l.profiles=r,l.activeProfileId=u,l.wsUrl=(m==null?void 0:m.wsUrl)||l.wsUrl||hn,l.token=(m==null?void 0:m.token)||"",l.pairCode=(m==null?void 0:m.pairCode)||"",l.autoReconnect=(m==null?void 0:m.autoReconnect)??l.autoReconnect;const p=Mi("local",pt.settings);let g={};if(p)try{g=JSON.parse(p)}catch{}g=od(g).data;for(const x of e1)l[x]!==void 0&&(g[x]=l[x]);g.profiles=r,g.activeProfileId=u,wn("local",pt.settings,JSON.stringify(g));const b=Mi("session",pt.sessionView);let v={};if(b)try{v=JSON.parse(b)}catch{}for(const x of Md)l[x]!==void 0&&(v[x]=l[x]);wn("session",pt.sessionView,JSON.stringify(v));for(const x of n1)l[x]!==void 0&&(g[x]=l[x]);return wn("local",pt.settings,JSON.stringify(g)),l}function i1(a){const[i,l]=C.useState(Db),o=C.useRef(i);o.current=i;const r=C.useRef(a);r.current=a;const u=C.useCallback(x=>{const T=vi(x);o.current=T,l(T)},[]),h=C.useCallback(x=>{o.current=x,l(x)},[]),m=C.useCallback(x=>{const T=o.current,M=og({...x,wsUrl:x.wsUrl||hn,token:x.token||"",displayName:x.displayName||`Herdr ${T.profiles.length+1}`,autoReconnect:x.autoReconnect!==!1},T.profiles.length),A=vi({profiles:[...T.profiles,M],activeProfileId:M.id,wsUrl:M.wsUrl,token:M.token,pairCode:M.pairCode||"",autoReconnect:M.autoReconnect});h(A),r.current(A)},[h]),p=C.useCallback(x=>{const T=o.current,M=T.profiles.find(N=>N.id===x);if(!M||M.id===T.activeProfileId)return;const A=vi({activeProfileId:M.id,wsUrl:M.wsUrl,token:M.token,pairCode:M.pairCode||"",autoReconnect:M.autoReconnect,profiles:T.profiles.map(N=>N.id===M.id?{...N,lastUsedAt:Date.now()}:N)});h(A),r.current(A)},[h]),g=C.useCallback((x,T)=>{const M=o.current;if(!M.profiles.find(j=>j.id===x))return;const N=T.trim().slice(0,64);if(!N)return;const R=vi({profiles:M.profiles.map(j=>j.id===x?{...j,displayName:N}:j)});h(R)},[h]),b=C.useCallback(x=>{const T=o.current;if(!T.profiles.some(R=>R.id===x))return;const M=T.profiles.filter(R=>R.id!==x),A=M.find(R=>R.id===T.activeProfileId)||M[0],N=vi(A?{profiles:M,activeProfileId:A.id,wsUrl:A.wsUrl,token:A.token,pairCode:A.pairCode||"",autoReconnect:A.autoReconnect}:{profiles:[],activeProfileId:"",wsUrl:hn,token:"",pairCode:""});h(N),x===T.activeProfileId&&r.current(N)},[h]),v=C.useCallback(x=>{const T=o.current,M=T.profiles.find(z=>z.id===T.activeProfileId),A=x.hostId?rg({wsUrl:T.wsUrl,hostId:x.hostId}):null,N=A?T.profiles.findIndex(z=>rg(z)===A):-1,R=N>=0?N:Math.max(0,T.profiles.findIndex(z=>z.id===T.activeProfileId)),V={...T.profiles[R]||M||og({wsUrl:T.wsUrl||hn,token:"",pairCode:T.pairCode||"PENDING",displayName:`Herdr ${T.profiles.length+1}`},T.profiles.length),token:x.token,pairCode:void 0,...x.hostId?{hostId:x.hostId}:{},...x.deviceId?{deviceId:x.deviceId}:{},lastUsedAt:Date.now()};let _=[...T.profiles];R>=0&&R<_.length?_[R]=V:_.push(V);const D=M==null?void 0:M.id;_=_.filter((z,U)=>U===R||z.id===V.id?!0:!(N>=0&&D&&z.id===D));const L=vi({profiles:_,activeProfileId:V.id,wsUrl:V.wsUrl,token:V.token,pairCode:"",autoReconnect:V.autoReconnect});return h(L),L},[h]),w=C.useCallback(x=>{const T=o.current,M=T.profiles.find(j=>j.id===T.activeProfileId);if(!M||!x.hostId&&!x.hostname)return;const A=/^Herdr \d+$/.test(M.displayName),N={...M,...x.hostId?{hostId:x.hostId}:{},...x.hostname?{hostname:x.hostname}:{},...x.hostname&&A?{displayName:x.hostname}:{}},R=vi({profiles:T.profiles.map(j=>j.id===M.id?N:j)});h(R)},[h]);return{settings:i,updateSettings:u,addProfileAndConnect:m,switchProfile:p,renameProfile:g,removeProfile:b,savePairedProfile:v,noteReadyProfile:w}}const Bo={ctrl:!1,alt:!1,shift:!1};function a1({adapterRef:a,role:i,addToast:l,tRef:o}){const[r,u]=C.useState({cols:80,rows:24}),h=C.useRef(r);h.current=r;const m=C.useRef(new Set),p=C.useRef(new Set),g=C.useRef(!0);C.useEffect(()=>{i==="controller"&&(g.current=!0)},[i]);const b=C.useCallback(()=>{g.current&&(g.current=!1,l("warning",o.current("toasts.viewerModeWarning")))},[l,o]),v=C.useCallback(L=>{if(i!=="controller"){b();return}const z=a.current;if(!z)return;const U=Sd(L);for(const ee of p.current)try{ee(U)}catch(q){console.debug("Key input observer threw:",q)}z.sendInput(U)},[a,i,b]),w=C.useCallback(L=>(p.current.add(L),()=>{p.current.delete(L)}),[]),[x,T]=C.useState(Bo),M=C.useRef(Bo),A=C.useCallback(L=>{const z={...M.current,[L]:!M.current[L]};M.current=z,T(z)},[]),N=C.useCallback(()=>{const L=M.current;return!L.ctrl&&!L.alt&&!L.shift?null:(M.current=Bo,T(Bo),L)},[]),R=C.useCallback(L=>{var z;i!=="controller"&&!ar(L)||(z=a.current)==null||z.sendInput(L)},[a,i]),j=C.useCallback((L,z)=>{var U;h.current={cols:L,rows:z},u({cols:L,rows:z}),(U=a.current)==null||U.sendResize(L,z)},[a]),V=C.useCallback((L,z)=>i!=="controller"?(b(),!1):a.current?(a.current.sendPasteFile(L,z),!0):!1,[a,i,b]),_=C.useCallback(L=>(m.current.add(L),()=>{m.current.delete(L)}),[]),D=C.useCallback(L=>{for(const z of m.current)try{z(L)}catch(U){console.error("Error in pasteFileReady listener:",U)}},[]);return{terminalDimensions:r,dimensionsRef:h,warnViewerMode:b,sendKey:v,observeKeyInput:w,modifierLatch:x,toggleModifierLatch:A,consumeModifierLatch:N,sendBinary:R,sendResize:j,sendPasteFile:V,subscribeToPasteFileReady:_,notifyPasteFileReady:D}}const l1=4e3,s1=3;function o1(){const[a,i]=C.useState([]),l=C.useRef([]),o=C.useRef(new Map),r=C.useCallback(m=>{l.current=m,i(m)},[]),u=C.useCallback(m=>{const p=o.current.get(m);p&&(clearTimeout(p),o.current.delete(m)),r(l.current.filter(g=>g.id!==m))},[r]),h=C.useCallback((m,p)=>{const g=Date.now(),b=l.current,v=b.find(M=>M.type===m&&M.message===p),w=v?v.id:`${g}-${Math.random().toString(36).substring(2,6)}`;let x;if(v)x=b.map(M=>M.id===w?{...M,count:M.count+1,timestamp:g}:M);else for(x=[...b,{id:w,type:m,message:p,timestamp:g,count:1}];x.length>s1;){const[M,...A]=x,N=o.current.get(M.id);N&&(clearTimeout(N),o.current.delete(M.id)),x=A}r(x);const T=o.current.get(w);T&&clearTimeout(T),o.current.set(w,setTimeout(()=>u(w),l1))},[r,u]);return C.useEffect(()=>{const m=o.current;return()=>{for(const p of m.values())clearTimeout(p);m.clear()}},[]),{toasts:a,addToast:h,removeToast:u}}function r1(a,i){const[l,o]=C.useState(null),[r,u]=C.useState(Ww),h=C.useRef(r),m=C.useRef(new Set),p=C.useCallback(v=>{h.current=v,u(v),Rb(v)},[]),g=C.useCallback(v=>{if(o(v),!v.updateAvailable||h.current===v.latest)return;const w=`${v.latest}:${v.restartPending?"restart":"update"}`;m.current.has(w)||(m.current.add(w),a("info",v.restartPending?i.current("update.toastRestart",{version:v.latest}):i.current("update.toast",{version:v.latest})))},[a,i]),b=C.useCallback(()=>o(null),[]);return{updateStatus:l,ignoredUpdate:r,ignoreUpdate:p,receiveUpdateStatus:g,forgetUpdateStatus:b}}const zb=C.createContext(null),Hb=C.createContext(null),Bb=C.createContext(null),Ub=C.createContext(null),Kb=C.createContext(null),c1=({children:a})=>{var rn,Ct;const[i,l]=C.useReducer(gw,pw),o=C.useRef(null),r=C.useRef(!1);C.useEffect(()=>{pb()},[]);const{receiveOutput:u,subscribeToOutput:h,getPendingOutputChunkCount:m,clearPendingOutput:p}=qw(),{toasts:g,addToast:b,removeToast:v}=o1(),w=C.useCallback(()=>{p(),l({type:"reset",resetTerminal:!0})},[p]),{settings:x,updateSettings:T,addProfileAndConnect:M,switchProfile:A,renameProfile:N,removeProfile:R,savePairedProfile:j,noteReadyProfile:V}=i1(ge=>{var We;w(),(We=o.current)==null||We.reconnectWith(zo(ge))}),_=C.useCallback((ge,We)=>wd(x.language,ge,We),[x.language]),D=C.useRef(_);D.current=_;const{herdrLaunch:L,startHerdr:z,handleLaunchError:U,forgetHerdrLaunch:ee}=yw(o,D),{updateStatus:q,ignoredUpdate:P,ignoreUpdate:ie,receiveUpdateStatus:ae,forgetUpdateStatus:F}=r1(b,D),E=a1({adapterRef:o,role:i.role,addToast:b,tRef:D}),{uploadProgress:Y,uploadImage:X,resetUploadProgress:le,abortUpload:Q,completeUpload:ve}=Gw({adapterRef:o,role:i.role,connectionState:i.connectionState,warnViewerMode:E.warnViewerMode,addToast:b,t:_,sendPasteFile:E.sendPasteFile}),ye=Ow(o,()=>zo(x),{stateChange:(ge,We,qt)=>{const Vt=ju(qt)?_(`serverErrors.${qt}`):We;l({type:"stateChange",state:ge,detail:Vt,code:qt}),ge==="connected"?b("success",_("toasts.connected")):ge==="error"&&b("error",Vt||_("toasts.connectionError")),ge!=="connected"&&ee()},ready:ge=>{const We=r.current;We&&p(),r.current=!0,ee(),F(),l({type:"ready",message:ge,resetTerminal:We}),V(ge)},hostReconnecting:ge=>{l({type:"hostReconnecting",code:ge||"host_reconnecting",detail:_(`serverErrors.${ju(ge)?ge:"host_reconnecting"}`)}),p()},sessionRestarted:(ge,We,qt,Vt)=>{var Ri;p(),l({type:"sessionRestarted",hostname:Vt,palette:qt}),V({hostId:(Ri=o.current)==null?void 0:Ri.getHostId(),hostname:Vt})},roleChange:(ge,We,qt,Vt)=>{l({type:"roleChange",role:ge,controllerId:We,hostId:qt,assignedClientId:Vt})},controlGranted:()=>{l({type:"controlGranted"}),b("success",_("toasts.controlGranted"))},paired:ge=>{var qt;const We=j(ge);b("success",_("toasts.pairedSuccess")),l({type:"paired",at:Date.now()}),(qt=o.current)==null||qt.reconnectWith(zo(We))},exit:(ge,We)=>{b("info",`${_("toasts.sessionEnded")}${We?`: ${We}`:""}${ge!=null?` (${ge})`:""}`)},error:ge=>{if(U(ge)||ge.code==="host_font_unavailable")return;Q();const We=ju(ge.code)?_(`serverErrors.${ge.code}`):ge.message||`[${ge.code}]`;b("error",We)},pasteFileReady:ge=>{ve(),E.notifyPasteFileReady(ge)},rttUpdate:ge=>l({type:"rtt",rttMs:ge}),peerCount:ge=>l({type:"peerCount",count:ge}),sessionReady:()=>{l({type:"sessionReady"}),ee()},agentStatus:ge=>l({type:"agentStatus",status:ge}),updateStatus:ae,binaryData:u}),xe=x.profiles.find(ge=>ge.id===x.activeProfileId),{hostFont:me,loadHostFont:de,declineHostFont:we,syncHostFont:oe,ensureHostGlyphs:Se}=hw(ye),se=C.useCallback(()=>{de()},[de]),pe=qx(x.fontFamily,me.font?{family:me.font.family,alias:me.status==="loaded"?me.alias:null,glyphs:me.glyphs.source?{family:me.glyphs.source.family,scope:me.glyphs.source.scope,alias:me.glyphs.alias}:null}:null),Ee=x.fontSizeFollowsHost&&((rn=me.font)!=null&&rn.sizePx)?Wa(me.font.sizePx,x.fontSize):x.fontSize;C.useEffect(()=>{document.documentElement.style.setProperty("--tui-font",pe)},[pe]),C.useEffect(()=>{var ge;(ge=o.current)==null||ge.updateConfig(zo(x))},[x]),C.useEffect(()=>{const ge=o.current;return ge?mw(ge):void 0},[]);const{dimensionsRef:Be}=E,ce=C.useCallback(ge=>{o.current&&(ge&&o.current.updateConfig(ge),o.current.connect(Be.current))},[Be]),Ae=C.useCallback(()=>{var ge;(ge=o.current)==null||ge.disconnect()},[]),Pe=C.useCallback((ge=!1)=>{var We;(We=o.current)==null||We.claimControl(ge)},[]),wt=C.useCallback(()=>{var ge;(ge=o.current)==null||ge.releaseControl()},[]),Nt=C.useCallback(ge=>T({language:ge}),[T]),Vn=Ex((Ct=i.agentStatus)==null?void 0:Ct.focusedAgent,"auto"),Pn=C.useMemo(()=>({settings:x,updateSettings:T,language:x.language,setLanguage:Nt,t:_,profiles:x.profiles,activeProfileId:x.activeProfileId,activeProfile:xe,switchProfile:A,addProfileAndConnect:M,renameProfile:N,removeProfile:R,hostFont:me,loadHostFont:se,declineHostFont:we,syncHostFont:oe,ensureHostGlyphs:Se,terminalFontFamily:pe,terminalFontSize:Ee}),[x,T,Nt,_,xe,A,M,N,R,me,se,we,oe,Se,pe,Ee]),kt=C.useMemo(()=>({...i,isController:i.role==="controller",agentProfile:Vn,adapter:ye,connect:ce,disconnect:Ae,claimControl:Pe,releaseControl:wt,herdrLaunch:L,startHerdr:z,updateStatus:q,ignoredUpdate:P,ignoreUpdate:ie}),[i,Vn,ye,ce,Ae,Pe,wt,L,z,q,P,ie]),Sn=C.useMemo(()=>({toasts:g,addToast:b,removeToast:v}),[g,b,v]),{terminalDimensions:ps,sendKey:gs,observeKeyInput:St,modifierLatch:bs,toggleModifierLatch:al,consumeModifierLatch:ll,sendBinary:ki,sendResize:ys,warnViewerMode:sl,sendPasteFile:vs,subscribeToPasteFileReady:xs}=E,Li=C.useMemo(()=>({terminalDimensions:ps,sendKey:gs,observeKeyInput:St,modifierLatch:bs,toggleModifierLatch:al,consumeModifierLatch:ll,sendBinary:ki,sendResize:ys,warnViewerMode:sl,sendPasteFile:vs,subscribeToPasteFileReady:xs,subscribeToOutput:h,getPendingOutputChunkCount:m}),[ps,gs,St,bs,al,ll,ki,ys,sl,vs,xs,h,m]),Mt=C.useMemo(()=>({uploadProgress:Y,uploadImage:X,resetUploadProgress:le}),[Y,X,le]);return f.jsx(zb.Provider,{value:Pn,children:f.jsx(Hb.Provider,{value:kt,children:f.jsx(Bb.Provider,{value:Sn,children:f.jsx(Ub.Provider,{value:Li,children:f.jsx(Kb.Provider,{value:Mt,children:a})})})})})};function fs(a,i){const l=C.useContext(a);if(!l)throw new Error(`${i} must be used within a TerminalProvider`);return l}const Le=()=>fs(zb,"useSettings"),et=()=>fs(Hb,"useConnection"),on=()=>fs(Bb,"useToasts"),hs=()=>fs(Ub,"useTerminalIO"),ur=()=>fs(Kb,"useUpload");function cs(a){var i,l;return a?{blocked:((i=a.counts)==null?void 0:i.blocked)??0,done:((l=a.counts)==null?void 0:l.done)??0}:null}function u1(a){return a?a.blocked>0?"blocked":a.done>0?"done":null:null}function d1(a){if(!a)return"";const i=[];return a.blocked>0&&i.push(`${a.blocked}⚠`),a.done>0&&i.push(`${a.done}✓`),i.length>0?`(${i.join(" ")})`:""}function f1(a,i){if(!a||!i)return null;const l=new Map(a.agents.map(h=>[h.paneId,h.status]));let o=null;for(const h of i.agents)if(!(h.status!=="blocked"&&h.status!=="done")&&l.get(h.paneId)!==h.status){if(h.status==="blocked")return"blocked";o="done"}const r=cs(a),u=cs(i);return u.blocked>r.blocked?"blocked":(!o&&u.done>r.done&&(o="done"),o)}const h1={blocked:"%23f9e2af",done:"%23a6e3a1"};function m1(a){return`<circle cx='19' cy='5' r='4.5' fill='${h1[a]}' stroke='%2311111b' stroke-width='1.5'/>`}function p1(a,i){return!i||!a.includes("</svg>")?a:a.replace("</svg>",`${m1(i)}</svg>`)}function dg(a,i=document){const l=i.querySelector('link[rel~="icon"]');if(!l)return;l.dataset.baseHref===void 0&&(l.dataset.baseHref=l.getAttribute("href")??"");const o=p1(l.dataset.baseHref,a);l.getAttribute("href")!==o&&l.setAttribute("href",o)}let ln=null;function g1(){if(typeof window>"u")return null;const a=window;return a.AudioContext??a.webkitAudioContext??null}function Ib(){const a=g1();if(a)try{ln=ln??new a,ln.state==="suspended"&&ln.resume()}catch{ln=null}}function b1(a=window){const i=()=>{Ib(),l()},l=()=>{a.removeEventListener("pointerdown",i),a.removeEventListener("keydown",i)};return a.addEventListener("pointerdown",i),a.addEventListener("keydown",i),l}const y1={blocked:[880,660],done:[660,880]};function Fb(a){if((ln==null?void 0:ln.state)==="running")try{const i=ln.currentTime;y1[a].forEach((l,o)=>{const r=ln.createOscillator(),u=ln.createGain(),h=i+o*.11;r.type="sine",r.frequency.value=l,u.gain.setValueAtTime(1e-4,h),u.gain.exponentialRampToValueAtTime(.06,h+.01),u.gain.exponentialRampToValueAtTime(1e-4,h+.09),r.connect(u),u.connect(ln.destination),r.start(h),r.stop(h+.1)})}catch{}}const v1=15e3,x1={blocked:[70,50,70],done:[40]};function w1(){const{settings:a,t:i}=Le(),{agentStatus:l}=et(),o=C.useRef(a);o.current=a;const r=C.useRef(i);r.current=i;const u=C.useRef(null),h=C.useRef(Number.NEGATIVE_INFINITY);C.useEffect(()=>{dg(a.agentAlertBadge?u1(cs(l)):null)},[l,a.agentAlertBadge]),C.useEffect(()=>()=>dg(null),[]),C.useEffect(()=>{if(!(!a.agentAlertSound||typeof window>"u"))return b1(window)},[a.agentAlertSound]),C.useEffect(()=>{const m=u.current;u.current=l;const p=f1(m,l);if(!p)return;const g=Date.now();if(g-h.current<v1)return;h.current=g;const b=o.current,v=typeof document<"u"&&document.visibilityState==="hidden",w=v||typeof document<"u"&&!document.hasFocus();if(b.agentAlertVibrate&&!v&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(x1[p])}catch{}if(b.agentAlertSound&&w&&Fb(p),b.agentAlertNotify&&v&&typeof window<"u"&&window.isSecureContext&&"Notification"in window&&Notification.permission==="granted"){const x=cs(l),T=p==="blocked"?r.current("agents.notifyBlocked",{count:x.blocked}):r.current("agents.notifyDone",{count:x.done});try{new Notification("Herdr Remote",{body:T,tag:"herdr-agents"})}catch{}}},[l])}function Gb(a){var i,l,o="";if(typeof a=="string"||typeof a=="number")o+=a;else if(typeof a=="object")if(Array.isArray(a)){var r=a.length;for(i=0;i<r;i++)a[i]&&(l=Gb(a[i]))&&(o&&(o+=" "),o+=l)}else for(l in a)a[l]&&(o&&(o+=" "),o+=l);return o}function S1(){for(var a,i,l=0,o="",r=arguments.length;l<r;l++)(a=arguments[l])&&(i=Gb(a))&&(o&&(o+=" "),o+=i);return o}const C1=(a,i)=>{const l=new Array(a.length+i.length);for(let o=0;o<a.length;o++)l[o]=a[o];for(let o=0;o<i.length;o++)l[a.length+o]=i[o];return l},T1=(a,i)=>({classGroupId:a,validator:i}),Yb=(a=new Map,i=null,l)=>({nextPart:a,validators:i,classGroupId:l}),sr="-",fg=[],M1="arbitrary..",A1=a=>{const i=N1(a),{conflictingClassGroups:l,conflictingClassGroupModifiers:o}=a;return{getClassGroupId:h=>{if(h.startsWith("[")&&h.endsWith("]"))return E1(h);const m=h.split(sr),p=m[0]===""&&m.length>1?1:0;return $b(m,p,i)},getConflictingClassGroupIds:(h,m)=>{if(m){const p=o[h],g=l[h];return p?g?C1(g,p):p:g||fg}return l[h]||fg}}},$b=(a,i,l)=>{if(a.length-i===0)return l.classGroupId;const r=a[i],u=l.nextPart.get(r);if(u){const g=$b(a,i+1,u);if(g)return g}const h=l.validators;if(h===null)return;const m=i===0?a.join(sr):a.slice(i).join(sr),p=h.length;for(let g=0;g<p;g++){const b=h[g];if(b.validator(m))return b.classGroupId}},E1=a=>a.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const i=a.slice(1,-1),l=i.indexOf(":"),o=i.slice(0,l);return o?M1+o:void 0})(),N1=a=>{const{theme:i,classGroups:l}=a;return k1(l,i)},k1=(a,i)=>{const l=Yb();for(const o in a){const r=a[o];Ad(r,l,o,i)}return l},Ad=(a,i,l,o)=>{const r=a.length;for(let u=0;u<r;u++){const h=a[u];L1(h,i,l,o)}},L1=(a,i,l,o)=>{if(typeof a=="string"){R1(a,i,l);return}if(typeof a=="function"){_1(a,i,l,o);return}j1(a,i,l,o)},R1=(a,i,l)=>{const o=a===""?i:qb(i,a);o.classGroupId=l},_1=(a,i,l,o)=>{if(O1(a)){Ad(a(o),i,l,o);return}i.validators===null&&(i.validators=[]),i.validators.push(T1(l,a))},j1=(a,i,l,o)=>{const r=Object.entries(a),u=r.length;for(let h=0;h<u;h++){const[m,p]=r[h];Ad(p,qb(i,m),l,o)}},qb=(a,i)=>{let l=a;const o=i.split(sr),r=o.length;for(let u=0;u<r;u++){const h=o[u];let m=l.nextPart.get(h);m||(m=Yb(),l.nextPart.set(h,m)),l=m}return l},O1=a=>"isThemeGetter"in a&&a.isThemeGetter===!0,D1=a=>{if(a<1)return{get:()=>{},set:()=>{}};let i=0,l=Object.create(null),o=Object.create(null);const r=(u,h)=>{l[u]=h,i++,i>a&&(i=0,o=l,l=Object.create(null))};return{get(u){let h=l[u];if(h!==void 0)return h;if((h=o[u])!==void 0)return r(u,h),h},set(u,h){u in l?l[u]=h:r(u,h)}}},rd="!",hg=":",z1=[],mg=(a,i,l,o,r)=>({modifiers:a,hasImportantModifier:i,baseClassName:l,maybePostfixModifierPosition:o,isExternal:r}),H1=a=>{const{prefix:i,experimentalParseClassName:l}=a;let o=r=>{const u=[];let h=0,m=0,p=0,g;const b=r.length;for(let M=0;M<b;M++){const A=r[M];if(h===0&&m===0){if(A===hg){u.push(r.slice(p,M)),p=M+1;continue}if(A==="/"){g=M;continue}}A==="["?h++:A==="]"?h--:A==="("?m++:A===")"&&m--}const v=u.length===0?r:r.slice(p);let w=v,x=!1;v.endsWith(rd)?(w=v.slice(0,-1),x=!0):v.startsWith(rd)&&(w=v.slice(1),x=!0);const T=g&&g>p?g-p:void 0;return mg(u,x,w,T)};if(i){const r=i+hg,u=o;o=h=>h.startsWith(r)?u(h.slice(r.length)):mg(z1,!1,h,void 0,!0)}if(l){const r=o;o=u=>l({className:u,parseClassName:r})}return o},B1=a=>{const i=new Map;return a.orderSensitiveModifiers.forEach((l,o)=>{i.set(l,1e6+o)}),l=>{const o=[];let r=[];for(let u=0;u<l.length;u++){const h=l[u],m=h[0]==="[",p=i.has(h);m||p?(r.length>0&&(r.sort(),o.push(...r),r=[]),o.push(h)):r.push(h)}return r.length>0&&(r.sort(),o.push(...r)),o}},U1=a=>({cache:D1(a.cacheSize),parseClassName:H1(a),sortModifiers:B1(a),postfixLookupClassGroupIds:K1(a),...A1(a)}),K1=a=>{const i=Object.create(null),l=a.postfixLookupClassGroups;if(l)for(let o=0;o<l.length;o++)i[l[o]]=!0;return i},I1=/\s+/,F1=(a,i)=>{const{parseClassName:l,getClassGroupId:o,getConflictingClassGroupIds:r,sortModifiers:u,postfixLookupClassGroupIds:h}=i,m=[],p=a.trim().split(I1);let g="";for(let b=p.length-1;b>=0;b-=1){const v=p[b],{isExternal:w,modifiers:x,hasImportantModifier:T,baseClassName:M,maybePostfixModifierPosition:A}=l(v);if(w){g=v+(g.length>0?" "+g:g);continue}let N=!!A,R;if(N){const L=M.substring(0,A);R=o(L);const z=R&&h[R]?o(M):void 0;z&&z!==R&&(R=z,N=!1)}else R=o(M);if(!R){if(!N){g=v+(g.length>0?" "+g:g);continue}if(R=o(M),!R){g=v+(g.length>0?" "+g:g);continue}N=!1}const j=x.length===0?"":x.length===1?x[0]:u(x).join(":"),V=T?j+rd:j,_=V+R;if(m.indexOf(_)>-1)continue;m.push(_);const D=r(R,N);for(let L=0;L<D.length;++L){const z=D[L];m.push(V+z)}g=v+(g.length>0?" "+g:g)}return g},G1=(...a)=>{let i=0,l,o,r="";for(;i<a.length;)(l=a[i++])&&(o=Vb(l))&&(r&&(r+=" "),r+=o);return r},Vb=a=>{if(typeof a=="string")return a;let i,l="";for(let o=0;o<a.length;o++)a[o]&&(i=Vb(a[o]))&&(l&&(l+=" "),l+=i);return l},pg=(a,...i)=>{let l,o,r,u;const h=p=>{const g=i.reduce((b,v)=>v(b),a());return l=U1(g),o=l.cache.get,r=l.cache.set,u=m,m(p)},m=p=>{const g=o(p);if(g)return g;const b=F1(p,l);return r(p,b),b};return u=h,(...p)=>u(G1(...p))},Y1=[],ft=a=>{const i=l=>l[a]||Y1;return i.isThemeGetter=!0,i},Pb=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Xb=/^\((?:(\w[\w-]*):)?(.+)\)$/i,$1=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,q1=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,V1=/\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$/,P1=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,X1=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Q1=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,xi=a=>$1.test(a),_e=a=>!!a&&!Number.isNaN(Number(a)),yn=a=>!!a&&Number.isInteger(Number(a)),Iu=a=>a.endsWith("%")&&_e(a.slice(0,-1)),In=a=>q1.test(a),Qb=()=>!0,Z1=a=>V1.test(a)&&!P1.test(a),Ed=()=>!1,W1=a=>X1.test(a),J1=a=>Q1.test(a),eS=a=>!ue(a)&&!fe(a),tS=a=>a.startsWith("@container")&&(a[10]==="/"&&a[11]!==void 0||a[11]==="s"&&a[16]!==void 0&&a.startsWith("-size/",10)||a[11]==="n"&&a[18]!==void 0&&a.startsWith("-normal/",10)),nS=a=>Ni(a,Jb,Ed),ue=a=>Pb.test(a),Zi=a=>Ni(a,ey,Z1),gg=a=>Ni(a,uS,_e),iS=a=>Ni(a,ny,Qb),aS=a=>Ni(a,ty,Ed),bg=a=>Ni(a,Zb,Ed),lS=a=>Ni(a,Wb,J1),Uo=a=>Ni(a,iy,W1),fe=a=>Xb.test(a),ts=a=>aa(a,ey),sS=a=>aa(a,ty),yg=a=>aa(a,Zb),oS=a=>aa(a,Jb),rS=a=>aa(a,Wb),Ko=a=>aa(a,iy,!0),cS=a=>aa(a,ny,!0),Ni=(a,i,l)=>{const o=Pb.exec(a);return o?o[1]?i(o[1]):l(o[2]):!1},aa=(a,i,l=!1)=>{const o=Xb.exec(a);return o?o[1]?i(o[1]):l:!1},Zb=a=>a==="position"||a==="percentage",Wb=a=>a==="image"||a==="url",Jb=a=>a==="length"||a==="size"||a==="bg-size",ey=a=>a==="length",uS=a=>a==="number",ty=a=>a==="family-name",ny=a=>a==="number"||a==="weight",iy=a=>a==="shadow",vg=()=>{const a=ft("color"),i=ft("font"),l=ft("text"),o=ft("font-weight"),r=ft("tracking"),u=ft("leading"),h=ft("breakpoint"),m=ft("container"),p=ft("spacing"),g=ft("radius"),b=ft("shadow"),v=ft("inset-shadow"),w=ft("text-shadow"),x=ft("drop-shadow"),T=ft("blur"),M=ft("perspective"),A=ft("aspect"),N=ft("ease"),R=ft("animate"),j=()=>["auto","avoid","all","avoid-page","page","left","right","column"],V=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],_=()=>[...V(),fe,ue],D=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto","contain","none"],z=()=>[fe,ue,p],U=()=>[xi,"full","auto",...z()],ee=()=>[yn,"none","subgrid",fe,ue],q=()=>["auto",{span:["full",yn,fe,ue]},yn,fe,ue],P=()=>[yn,"auto",fe,ue],ie=()=>["auto","min","max","fr",fe,ue],ae=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],F=()=>["start","end","center","stretch","center-safe","end-safe"],E=()=>["auto",...z()],Y=()=>[xi,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...z()],X=()=>[xi,"screen","full","dvw","lvw","svw","min","max","fit",...z()],le=()=>[xi,"screen","full","lh","dvh","lvh","svh","min","max","fit",...z()],Q=()=>[a,fe,ue],ve=()=>[...V(),yg,bg,{position:[fe,ue]}],ye=()=>["no-repeat",{repeat:["","x","y","space","round"]}],xe=()=>["auto","cover","contain",oS,nS,{size:[fe,ue]}],me=()=>[Iu,ts,Zi],de=()=>["","none","full",g,fe,ue],we=()=>["",_e,ts,Zi],oe=()=>["solid","dashed","dotted","double"],Se=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],se=()=>[_e,Iu,yg,bg],pe=()=>["","none",T,fe,ue],Ee=()=>["none",_e,fe,ue],Be=()=>["none",_e,fe,ue],ce=()=>[_e,fe,ue],Ae=()=>[xi,"full",...z()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[In],breakpoint:[In],color:[Qb],container:[In],"drop-shadow":[In],ease:["in","out","in-out"],font:[eS],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[In],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[In],shadow:[In],spacing:["px",_e],text:[In],"text-shadow":[In],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",xi,ue,fe,A]}],container:["container"],"container-type":[{"@container":["","normal","size",fe,ue]}],"container-named":[tS],columns:[{columns:[_e,ue,fe,m]}],"break-after":[{"break-after":j()}],"break-before":[{"break-before":j()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:_()}],overflow:[{overflow:D()}],"overflow-x":[{"overflow-x":D()}],"overflow-y":[{"overflow-y":D()}],overscroll:[{overscroll:L()}],"overscroll-x":[{"overscroll-x":L()}],"overscroll-y":[{"overscroll-y":L()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:U()}],"inset-x":[{"inset-x":U()}],"inset-y":[{"inset-y":U()}],start:[{"inset-s":U(),start:U()}],end:[{"inset-e":U(),end:U()}],"inset-bs":[{"inset-bs":U()}],"inset-be":[{"inset-be":U()}],top:[{top:U()}],right:[{right:U()}],bottom:[{bottom:U()}],left:[{left:U()}],visibility:["visible","invisible","collapse"],z:[{z:[yn,"auto",fe,ue]}],basis:[{basis:[xi,"full","auto",m,...z()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[_e,xi,"auto","initial","none",ue]}],grow:[{grow:["",_e,fe,ue]}],shrink:[{shrink:["",_e,fe,ue]}],order:[{order:[yn,"first","last","none",fe,ue]}],"grid-cols":[{"grid-cols":ee()}],"col-start-end":[{col:q()}],"col-start":[{"col-start":P()}],"col-end":[{"col-end":P()}],"grid-rows":[{"grid-rows":ee()}],"row-start-end":[{row:q()}],"row-start":[{"row-start":P()}],"row-end":[{"row-end":P()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ie()}],"auto-rows":[{"auto-rows":ie()}],gap:[{gap:z()}],"gap-x":[{"gap-x":z()}],"gap-y":[{"gap-y":z()}],"justify-content":[{justify:[...ae(),"normal"]}],"justify-items":[{"justify-items":[...F(),"normal"]}],"justify-self":[{"justify-self":["auto",...F()]}],"align-content":[{content:["normal",...ae()]}],"align-items":[{items:[...F(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...F(),{baseline:["","last"]}]}],"place-content":[{"place-content":ae()}],"place-items":[{"place-items":[...F(),"baseline"]}],"place-self":[{"place-self":["auto",...F()]}],p:[{p:z()}],px:[{px:z()}],py:[{py:z()}],ps:[{ps:z()}],pe:[{pe:z()}],pbs:[{pbs:z()}],pbe:[{pbe:z()}],pt:[{pt:z()}],pr:[{pr:z()}],pb:[{pb:z()}],pl:[{pl:z()}],m:[{m:E()}],mx:[{mx:E()}],my:[{my:E()}],ms:[{ms:E()}],me:[{me:E()}],mbs:[{mbs:E()}],mbe:[{mbe:E()}],mt:[{mt:E()}],mr:[{mr:E()}],mb:[{mb:E()}],ml:[{ml:E()}],"space-x":[{"space-x":z()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":z()}],"space-y-reverse":["space-y-reverse"],size:[{size:Y()}],"inline-size":[{inline:["auto",...X()]}],"min-inline-size":[{"min-inline":["auto",...X()]}],"max-inline-size":[{"max-inline":["none",...X()]}],"block-size":[{block:["auto",...le()]}],"min-block-size":[{"min-block":["auto",...le()]}],"max-block-size":[{"max-block":["none",...le()]}],w:[{w:[m,"screen",...Y()]}],"min-w":[{"min-w":[m,"screen","none",...Y()]}],"max-w":[{"max-w":[m,"screen","none","prose",{screen:[h]},...Y()]}],h:[{h:["screen","lh",...Y()]}],"min-h":[{"min-h":["screen","lh","none",...Y()]}],"max-h":[{"max-h":["screen","lh",...Y()]}],"font-size":[{text:["base",l,ts,Zi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,cS,iS]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Iu,ue]}],"font-family":[{font:[sS,aS,i]}],"font-features":[{"font-features":[ue]}],"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:[r,fe,ue]}],"line-clamp":[{"line-clamp":[_e,"none",fe,gg]}],leading:[{leading:[u,...z()]}],"list-image":[{"list-image":["none",fe,ue]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",fe,ue]}],"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:[...oe(),"wavy"]}],"text-decoration-thickness":[{decoration:[_e,"from-font","auto",fe,Zi]}],"text-decoration-color":[{decoration:Q()}],"underline-offset":[{"underline-offset":[_e,"auto",fe,ue]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:z()}],"tab-size":[{tab:[yn,fe,ue]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",fe,ue]}],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",fe,ue]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ve()}],"bg-repeat":[{bg:ye()}],"bg-size":[{bg:xe()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},yn,fe,ue],radial:["",fe,ue],conic:[yn,fe,ue]},rS,lS]}],"bg-color":[{bg:Q()}],"gradient-from-pos":[{from:me()}],"gradient-via-pos":[{via:me()}],"gradient-to-pos":[{to:me()}],"gradient-from":[{from:Q()}],"gradient-via":[{via:Q()}],"gradient-to":[{to:Q()}],rounded:[{rounded:de()}],"rounded-s":[{"rounded-s":de()}],"rounded-e":[{"rounded-e":de()}],"rounded-t":[{"rounded-t":de()}],"rounded-r":[{"rounded-r":de()}],"rounded-b":[{"rounded-b":de()}],"rounded-l":[{"rounded-l":de()}],"rounded-ss":[{"rounded-ss":de()}],"rounded-se":[{"rounded-se":de()}],"rounded-ee":[{"rounded-ee":de()}],"rounded-es":[{"rounded-es":de()}],"rounded-tl":[{"rounded-tl":de()}],"rounded-tr":[{"rounded-tr":de()}],"rounded-br":[{"rounded-br":de()}],"rounded-bl":[{"rounded-bl":de()}],"border-w":[{border:we()}],"border-w-x":[{"border-x":we()}],"border-w-y":[{"border-y":we()}],"border-w-s":[{"border-s":we()}],"border-w-e":[{"border-e":we()}],"border-w-bs":[{"border-bs":we()}],"border-w-be":[{"border-be":we()}],"border-w-t":[{"border-t":we()}],"border-w-r":[{"border-r":we()}],"border-w-b":[{"border-b":we()}],"border-w-l":[{"border-l":we()}],"divide-x":[{"divide-x":we()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":we()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...oe(),"hidden","none"]}],"divide-style":[{divide:[...oe(),"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:[...oe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[_e,fe,ue]}],"outline-w":[{outline:["",_e,ts,Zi]}],"outline-color":[{outline:Q()}],shadow:[{shadow:["","none",b,Ko,Uo]}],"shadow-color":[{shadow:Q()}],"inset-shadow":[{"inset-shadow":["none",v,Ko,Uo]}],"inset-shadow-color":[{"inset-shadow":Q()}],"ring-w":[{ring:we()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:Q()}],"ring-offset-w":[{"ring-offset":[_e,Zi]}],"ring-offset-color":[{"ring-offset":Q()}],"inset-ring-w":[{"inset-ring":we()}],"inset-ring-color":[{"inset-ring":Q()}],"text-shadow":[{"text-shadow":["none",w,Ko,Uo]}],"text-shadow-color":[{"text-shadow":Q()}],opacity:[{opacity:[_e,fe,ue]}],"mix-blend":[{"mix-blend":[...Se(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Se()}],"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":[_e]}],"mask-image-linear-from-pos":[{"mask-linear-from":se()}],"mask-image-linear-to-pos":[{"mask-linear-to":se()}],"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":se()}],"mask-image-t-to-pos":[{"mask-t-to":se()}],"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":se()}],"mask-image-r-to-pos":[{"mask-r-to":se()}],"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":se()}],"mask-image-b-to-pos":[{"mask-b-to":se()}],"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":se()}],"mask-image-l-to-pos":[{"mask-l-to":se()}],"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":se()}],"mask-image-x-to-pos":[{"mask-x-to":se()}],"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":se()}],"mask-image-y-to-pos":[{"mask-y-to":se()}],"mask-image-y-from-color":[{"mask-y-from":Q()}],"mask-image-y-to-color":[{"mask-y-to":Q()}],"mask-image-radial":[{"mask-radial":[fe,ue]}],"mask-image-radial-from-pos":[{"mask-radial-from":se()}],"mask-image-radial-to-pos":[{"mask-radial-to":se()}],"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":V()}],"mask-image-conic-pos":[{"mask-conic":[_e]}],"mask-image-conic-from-pos":[{"mask-conic-from":se()}],"mask-image-conic-to-pos":[{"mask-conic-to":se()}],"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:ve()}],"mask-repeat":[{mask:ye()}],"mask-size":[{mask:xe()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",fe,ue]}],filter:[{filter:["","none",fe,ue]}],blur:[{blur:pe()}],brightness:[{brightness:[_e,fe,ue]}],contrast:[{contrast:[_e,fe,ue]}],"drop-shadow":[{"drop-shadow":["","none",x,Ko,Uo]}],"drop-shadow-color":[{"drop-shadow":Q()}],grayscale:[{grayscale:["",_e,fe,ue]}],"hue-rotate":[{"hue-rotate":[_e,fe,ue]}],invert:[{invert:["",_e,fe,ue]}],saturate:[{saturate:[_e,fe,ue]}],sepia:[{sepia:["",_e,fe,ue]}],"backdrop-filter":[{"backdrop-filter":["","none",fe,ue]}],"backdrop-blur":[{"backdrop-blur":pe()}],"backdrop-brightness":[{"backdrop-brightness":[_e,fe,ue]}],"backdrop-contrast":[{"backdrop-contrast":[_e,fe,ue]}],"backdrop-grayscale":[{"backdrop-grayscale":["",_e,fe,ue]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[_e,fe,ue]}],"backdrop-invert":[{"backdrop-invert":["",_e,fe,ue]}],"backdrop-opacity":[{"backdrop-opacity":[_e,fe,ue]}],"backdrop-saturate":[{"backdrop-saturate":[_e,fe,ue]}],"backdrop-sepia":[{"backdrop-sepia":["",_e,fe,ue]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":z()}],"border-spacing-x":[{"border-spacing-x":z()}],"border-spacing-y":[{"border-spacing-y":z()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",fe,ue]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[_e,"initial",fe,ue]}],ease:[{ease:["linear","initial",N,fe,ue]}],delay:[{delay:[_e,fe,ue]}],animate:[{animate:["none",R,fe,ue]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[M,fe,ue]}],"perspective-origin":[{"perspective-origin":_()}],rotate:[{rotate:Ee()}],"rotate-x":[{"rotate-x":Ee()}],"rotate-y":[{"rotate-y":Ee()}],"rotate-z":[{"rotate-z":Ee()}],scale:[{scale:Be()}],"scale-x":[{"scale-x":Be()}],"scale-y":[{"scale-y":Be()}],"scale-z":[{"scale-z":Be()}],"scale-3d":["scale-3d"],skew:[{skew:ce()}],"skew-x":[{"skew-x":ce()}],"skew-y":[{"skew-y":ce()}],transform:[{transform:[fe,ue,"","none","gpu","cpu"]}],"transform-origin":[{origin:_()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ae()}],"translate-x":[{"translate-x":Ae()}],"translate-y":[{"translate-y":Ae()}],"translate-z":[{"translate-z":Ae()}],"translate-none":["translate-none"],zoom:[{zoom:[yn,fe,ue]}],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",fe,ue]}],"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":z()}],"scroll-mx":[{"scroll-mx":z()}],"scroll-my":[{"scroll-my":z()}],"scroll-ms":[{"scroll-ms":z()}],"scroll-me":[{"scroll-me":z()}],"scroll-mbs":[{"scroll-mbs":z()}],"scroll-mbe":[{"scroll-mbe":z()}],"scroll-mt":[{"scroll-mt":z()}],"scroll-mr":[{"scroll-mr":z()}],"scroll-mb":[{"scroll-mb":z()}],"scroll-ml":[{"scroll-ml":z()}],"scroll-p":[{"scroll-p":z()}],"scroll-px":[{"scroll-px":z()}],"scroll-py":[{"scroll-py":z()}],"scroll-ps":[{"scroll-ps":z()}],"scroll-pe":[{"scroll-pe":z()}],"scroll-pbs":[{"scroll-pbs":z()}],"scroll-pbe":[{"scroll-pbe":z()}],"scroll-pt":[{"scroll-pt":z()}],"scroll-pr":[{"scroll-pr":z()}],"scroll-pb":[{"scroll-pb":z()}],"scroll-pl":[{"scroll-pl":z()}],"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",fe,ue]}],fill:[{fill:["none",...Q()]}],"stroke-w":[{stroke:[_e,ts,Zi,gg]}],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"]}},dS=(a,{cacheSize:i,prefix:l,experimentalParseClassName:o,extend:r={},override:u={}})=>(qa(a,"cacheSize",i),qa(a,"prefix",l),qa(a,"experimentalParseClassName",o),Io(a.theme,u.theme),Io(a.classGroups,u.classGroups),Io(a.conflictingClassGroups,u.conflictingClassGroups),Io(a.conflictingClassGroupModifiers,u.conflictingClassGroupModifiers),qa(a,"postfixLookupClassGroups",u.postfixLookupClassGroups),qa(a,"orderSensitiveModifiers",u.orderSensitiveModifiers),Fo(a.theme,r.theme),Fo(a.classGroups,r.classGroups),Fo(a.conflictingClassGroups,r.conflictingClassGroups),Fo(a.conflictingClassGroupModifiers,r.conflictingClassGroupModifiers),cd(a,r,"postfixLookupClassGroups"),cd(a,r,"orderSensitiveModifiers"),a),qa=(a,i,l)=>{l!==void 0&&(a[i]=l)},Io=(a,i)=>{if(i)for(const l in i)qa(a,l,i[l])},Fo=(a,i)=>{if(i)for(const l in i)cd(a,i,l)},cd=(a,i,l)=>{const o=i[l];o!==void 0&&(a[l]=a[l]?a[l].concat(o):o)},fS=(a,...i)=>typeof a=="function"?pg(vg,a,...i):pg(()=>dS(vg(),a),...i),hS=fS({extend:{classGroups:{"font-size":[{text:["tui","tui-sm","tui-lg"]}]}}});function ne(...a){return hS(S1(a))}const ke={cursor:"▸",on:"●",off:"○",dot:"·",check:"✓",cross:"✗",warn:"!",arrowRight:"→",arrowLeft:"←",chevronDown:"▾",chevronRight:"▸",ellipsis:"…",meterFull:"█",meterEmpty:"░",tabDivider:"│"},sn={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"}},il={ok:sn.ok.text,warn:sn.warn.text,bad:sn.bad.text,idle:sn.idle.text,accent:sn.accent.text,alt:sn.alt.text,info:sn.info.text},Bt=({level:a,className:i})=>f.jsx("span",{"aria-hidden":"true",className:ne("select-none leading-none",il[a],i),children:a==="idle"?ke.off:ke.on}),Nd=({className:a})=>f.jsx("span",{"aria-hidden":"true",className:ne("select-none text-tui-faint",a),children:ke.dot}),ay={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"},Tt=({title:a,aside:i,tone:l="accent",className:o,bodyClassName:r,children:u,...h})=>f.jsxs("fieldset",{className:ne("tui-panel tui-block relative min-w-0 border border-tui-border bg-tui-base",a?"px-3 pb-3 pt-1":"p-3",o),...h,children:[a?f.jsx("legend",{className:ne("flex items-center gap-2 text-tui font-bold",il[l]),children:f.jsx("span",{children:a})}):null,i?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:i}):null,f.jsx("div",{className:ne("min-w-0",r),children:u})]}),Si=({label:a,labelWidth:i=16,className:l,children:o})=>f.jsxs("div",{className:ne("flex items-baseline gap-2 text-tui",l),children:[f.jsx("span",{className:"shrink-0 truncate text-tui-muted",style:{width:`${i}ch`},title:typeof a=="string"?a:void 0,children:a}),f.jsx("span",{className:"min-w-0 flex-1 text-tui-text",children:o})]}),mS=({className:a,label:i})=>i?f.jsxs("div",{className:ne("flex items-center gap-2",a),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:i}),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",a),"aria-hidden":"true"}),Ti=({tone:a="accent",className:i,children:l,action:o})=>{const r=a==="ok"?ke.check:a==="bad"?ke.cross:a==="warn"?ke.warn:"›",u=sn[a].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",u,i),children:[f.jsx("span",{"aria-hidden":"true",className:ne("shrink-0 font-bold",il[a]),children:r}),f.jsx("div",{className:"min-w-0 flex-1 leading-snug text-tui-text",children:l}),o?f.jsx("div",{className:"shrink-0",children:o}):null]})},pS={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:a="default",brackets:i=!0,glyph:l,block:o=!1,className:r,children:u,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",pS[a],o&&"w-full",r),...m,children:[i?f.jsx("span",{"aria-hidden":"true",className:"opacity-60",children:"["}):null,l?f.jsx("span",{"aria-hidden":"true",className:"leading-none",children:l}):null,f.jsx("span",{className:"truncate",children:u}),i?f.jsx("span",{"aria-hidden":"true",className:"opacity-60",children:"]"}):null]}),kd=({tone:a="accent",dot:i=!1,className:l,children:o})=>f.jsxs("span",{className:ne("inline-flex select-none items-center gap-1 whitespace-nowrap text-tui font-bold uppercase",il[a],l),children:[i?f.jsx(Bt,{level:a}):null,o]}),Ld=({tabs:a,activeId:i,onSelect:l,ariaLabel:o,className:r,labelClassName:u})=>f.jsx("nav",{className:ne("flex items-center gap-2",r),"aria-label":o,children:a.map((h,m)=>{const p=h.id===i;return f.jsxs(qn.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:()=>l(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",u),children:h.label})]})]},h.id)})}),ly=({hints:a,className:i})=>f.jsx("div",{className:ne("flex flex-wrap items-center gap-x-3 gap-y-0.5 text-tui-sm text-tui-faint",i),children:a.map(l=>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:l.keys}),f.jsx("span",{children:l.action})]},`${l.keys} ${l.action}`))}),sy=({active:a=!1,className:i,children:l})=>f.jsx("span",{className:ne("inline-flex min-w-[2ch] select-none items-center justify-center border px-1 text-tui",a?"border-tui-accent bg-tui-accent text-tui-crust":"border-tui-border bg-tui-surface text-tui-muted",i),children:l}),Fn=({htmlFor:a,hint:i,className:l,children:o})=>f.jsxs("label",{htmlFor:a,className:ne("block text-tui-sm font-bold text-tui-muted",l),children:[o,i?f.jsx("span",{className:"ml-2 font-normal text-tui-faint",children:i}):null]}),Et=qn.forwardRef(({className:a,...i},l)=>f.jsx("input",{ref:l,className:ne("tui-input w-full px-2 py-1 text-tui",a),...i}));Et.displayName="Input";const dr=qn.forwardRef(({className:a,children:i,...l},o)=>f.jsx("select",{ref:o,className:ne("tui-input w-full px-2 py-1 text-tui",a),...l,children:i}));dr.displayName="Select";const gS=({checked:a,onChange:i,disabled:l=!1,label:o,description:r,className:u,id:h})=>f.jsxs("label",{className:ne("group flex cursor-pointer select-none items-start gap-2 py-0.5 text-tui",l&&"cursor-not-allowed opacity-60",u),children:[f.jsx("input",{id:h,type:"checkbox",className:"sr-only",checked:a,disabled:l,onChange:m=>i(m.target.checked)}),f.jsx("span",{"aria-hidden":"true",className:ne("mt-px shrink-0 font-bold leading-tight",a?"text-tui-ok":"text-tui-faint",!l&&"group-hover:text-tui-accent"),children:a?"[x]":"[ ]"}),f.jsxs("span",{className:"min-w-0 flex-1",children:[f.jsx("span",{className:ne("block",a?"text-tui-text":"text-tui-muted"),children:o}),r?f.jsx("span",{className:"mt-0.5 block text-tui-sm leading-snug text-tui-faint",children:r}):null]})]}),fr="h-8",fn=({title:a,aside:i,className:l,children:o})=>f.jsxs("section",{className:ne("min-w-0",l),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:a}),i?f.jsx("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:i}):null]}),f.jsx("div",{className:"divide-y divide-tui-border-dim",children:o})]}),Ht=({label:a,hint:i,htmlFor:l,control:o,className:r})=>f.jsxs("div",{className:ne("flex flex-col gap-1 py-1.5 sm:flex-row sm:items-center sm:gap-4",r),children:[f.jsxs("div",{className:"min-w-0 flex-1",children:[l?f.jsx("label",{htmlFor:l,className:"block text-tui text-tui-text",children:a}):f.jsx("span",{className:"block text-tui text-tui-text",children:a}),i?f.jsx("span",{className:"block text-tui-sm leading-snug text-tui-faint",children:i}):null]}),f.jsx("div",{className:"w-full shrink-0 sm:w-[18rem]",children:o})]}),ud="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",dd="text-tui-muted hover:bg-tui-selection hover:text-tui-text";function xg({name:a,value:i,options:l,onChange:o,tone:r="accent",className:u,"aria-label":h}){return f.jsx("div",{role:"radiogroup","aria-label":h,className:ne("grid w-full border border-tui-border bg-tui-mantle",fr,u),style:{gridTemplateColumns:`repeat(${l.length}, minmax(0, 1fr))`},children:l.map((m,p)=>{const g=m.value===i;return f.jsxs("label",{className:ne(ud,p>0&&"border-l border-tui-border",g?ne(ay[r],"font-bold text-tui-crust"):dd),children:[f.jsx("input",{type:"radio",name:a,value:m.value,className:"sr-only",checked:g,onChange:()=>o(m.value)}),f.jsx("span",{className:"truncate",children:m.label})]},m.value)})})}const wi=({checked:a,onChange:i,label:l,offLabel:o,onLabel:r,disabled:u=!1,className:h})=>{const m=p=>g=>{g.preventDefault(),!(u||p===a)&&i(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",fr,u&&"cursor-not-allowed opacity-60",h),children:[f.jsx("input",{type:"checkbox",className:"sr-only","aria-label":l,checked:a,disabled:u,onChange:p=>i(p.target.checked)}),f.jsx("span",{"aria-hidden":"true",onClick:m(!1),className:ne(ud,a?dd:"bg-tui-selection font-bold text-tui-text"),children:o}),f.jsx("span",{"aria-hidden":"true",onClick:m(!0),className:ne(ud,"border-l border-tui-border",a?"bg-tui-ok font-bold text-tui-crust":dd),children:r})]})},ta=({variant:a="neutral",className:i,type:l="button",children:o,...r})=>f.jsx("button",{type:l,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",a==="danger"?"text-tui-bad hover:border-tui-bad":"text-tui-muted hover:border-tui-border hover:text-tui-accent",i),...r,children:o}),bS=({value:a,width:i=20,tone:l="accent",className:o})=>{const r=Number.isFinite(a)?Math.min(1,Math.max(0,a)):0,u=Math.round(r*i);return f.jsxs("span",{className:ne("inline-flex select-none whitespace-pre font-mono leading-none",o),role:"presentation",children:[f.jsx("span",{className:il[l],children:ke.meterFull.repeat(u)}),f.jsx("span",{className:"text-tui-border",children:ke.meterEmpty.repeat(Math.max(0,i-u))})]})},yS=({ratio:a,label:i,tone:l="accent",className:o,...r})=>{const u=Number.isFinite(a)?Math.min(1,Math.max(0,a)):0;return f.jsxs("div",{className:ne("relative h-[var(--tui-row)] w-full overflow-hidden border border-tui-border bg-tui-mantle",o),role:"progressbar","aria-valuenow":Math.round(u*100),"aria-valuemin":0,"aria-valuemax":100,...r,children:[f.jsx("div",{className:ne("absolute inset-y-0 left-0",ay[l]),style:{width:`${u*100}%`},"aria-hidden":"true"}),i!==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:i}):null]})},Ga=({label:a,value:i,sub:l,tone:o,title:r,className:u})=>f.jsxs("div",{className:ne("min-w-0 border border-tui-border bg-tui-base px-2.5 py-1.5",u),title:r,children:[f.jsx("div",{className:"truncate text-tui-sm text-tui-muted",children:a}),f.jsx("div",{className:ne("truncate text-tui-lg font-bold",o?il[o]:"text-tui-text"),children:i}),f.jsx("div",{className:"truncate text-tui-sm text-tui-faint",children:l||" "})]}),wg=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],na=({className:a,label:i})=>{const[l,o]=qn.useState(0);return qn.useEffect(()=>{const r=setInterval(()=>o(u=>(u+1)%wg.length),90);return()=>clearInterval(r)},[]),f.jsxs("span",{className:ne("inline-flex items-center gap-1.5",a),role:"status",children:[f.jsx("span",{"aria-hidden":"true",className:"text-tui-accent",children:wg[l]}),i?f.jsx("span",{children:i}):null]})};function Rd({columns:a,items:i,rowKey:l,empty:o,className:r}){return i.length===0?f.jsx("div",{className:ne("px-1 py-4 text-center text-tui text-tui-faint",r),children:o}):f.jsx("div",{className:ne("w-full overflow-x-auto",r),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:a.map(u=>f.jsx("th",{scope:"col",style:u.width?{width:`${u.width}ch`}:void 0,className:ne("whitespace-nowrap px-2 py-1 text-tui-sm font-bold text-tui-muted",u.align==="right"?"text-right":"text-left",u.className),children:u.header},u.key))})}),f.jsx("tbody",{children:i.map((u,h)=>f.jsx("tr",{className:"border-b border-tui-border-dim last:border-b-0 hover:bg-tui-selection",children:a.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(u,h)},m.key))},l(u,h)))})]})})}var vS=ib();const hr=({isOpen:a,onClose:i,title:l,subtitle:o,closeLabel:r,footer:u,hints:h,size:m="md",fixedHeight:p=!1,className:g,children:b})=>{if(!a)return null;const v=m==="sm"?"max-w-md":m==="lg"?"max-w-3xl":"max-w-xl",w=`tui-modal-${l.replace(/\s+/g,"-").toLowerCase()}`,x=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":w,onMouseDown:T=>{T.target===T.currentTarget&&i()},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.jsx("h2",{id:w,className:"truncate text-tui font-bold text-tui-accent",children:l}),o?f.jsx("span",{className:"min-w-0 flex-1 truncate text-tui-sm text-tui-faint",children:o}):f.jsx("span",{className:"flex-1"}),f.jsx(Me,{variant:"ghost",onClick:i,"aria-label":r,title:r,children:"esc"})]}),f.jsx("div",{className:"relative min-h-0 flex-1 overflow-y-auto overscroll-contain px-3 py-3",children:b}),u||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(ly,{hints:h}):f.jsx("span",{}),u?f.jsx("div",{className:"flex items-center gap-2",children:u}):null]}):null]})});return typeof document>"u"?x:vS.createPortal(x,document.body)},fd=({items:a,className:i})=>{const l=a.filter(Boolean);return f.jsx("span",{className:ne("flex min-w-0 items-center gap-1.5",i),children:l.map((o,r)=>f.jsxs(qn.Fragment,{children:[r>0?f.jsx(Nd,{className:"shrink-0"}):null,o]},r))})},oy=({left:a,right:i,className:l})=>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",l),children:[f.jsx("div",{className:"flex min-w-0 items-center gap-1.5 text-tui-muted",children:a}),f.jsx("div",{className:"flex shrink-0 items-center gap-3",children:i})]}),xS=({name:a,tagline:i,aside:l,tabs:o,activeTabId:r,onSelectTab:u,tabsAriaLabel:h,toolbarStart:m,toolbarAside:p,hints:g,footerAside:b,bodyClassName:v,className:w,children:x})=>{const T=!!(o&&o.length>0&&r!==void 0&&u);return f.jsxs("div",{className:ne("flex h-full min-h-0 w-full flex-col bg-tui-crust",w),children:[a?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:a}),i?f.jsx("span",{className:"hidden truncate text-tui-sm text-tui-faint sm:block",children:i}):null]}),l?f.jsx("span",{className:"flex shrink-0 items-center gap-2",children:l}):null]}):null,T||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,T?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(Ld,{tabs:o,activeId:r,onSelect:u,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:x}),g||b?f.jsx(oy,{left:g?f.jsx(ly,{hints:g}):null,right:b}):null]})},Go="tui-focusable select-none border border-transparent px-1.5 text-tui uppercase transition-colors",Yo="text-tui-muted hover:border-tui-border hover:text-tui-accent",wS="border-tui-accent bg-tui-accent text-tui-crust",SS=({currentView:a,onNavigate:i,onOpenPairing:l,onOpenSettings:o,onToggleVirtualKeyboard:r,isVirtualKeyboardOpen:u})=>{const{language:h,setLanguage:m,t:p}=Le(),{addToast:g}=on(),b=()=>{const w=h==="zh"?"en":"zh";m(w),g("info",wd(w,"toasts.switchedLanguage",{lang:w==="zh"?"简体中文":"English"}))},v=[{id:"terminal",label:p("header.terminalTab"),index:1,ariaLabel:p("header.terminalTab")},...a==="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(Ld,{tabs:v,activeId:a,onSelect:w=>i(w),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:b,className:ne(Go,Yo),title:p("header.languageToggleTitle"),"aria-label":p("header.languageToggleTitle"),children:p("header.languageShort")}),a==="terminal"&&f.jsx("button",{type:"button",onClick:r,className:ne(Go,u?wS:Yo),title:p("header.virtualKeyboardTitle"),"aria-label":p("header.virtualKeyboardTitle"),children:p("header.actionKeyboard")}),f.jsx("button",{type:"button",onClick:l,className:ne(Go,Yo),title:p("header.pairingTitle"),"aria-label":p("header.pairingTitle"),children:p("header.actionPairing")}),f.jsx("button",{type:"button",onClick:o,className:ne(Go,Yo),title:p("header.settingsTitle"),"aria-label":p("header.settingsTitle"),children:p("header.actionSettings")})]})]})})},$o=({tone:a,glyph:i,message:l,assertive:o=!1,action:r})=>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",sn[a].edgeB),"aria-live":o?"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",sn[a].text),children:i}),f.jsx("span",{className:"truncate text-tui-text",children:l})]}),r]}),CS=()=>{const{settings:a,t:i}=Le(),{connectionState:l,stateDetail:o,connect:r}=et();return l==="connected"||!a.token&&!a.pairCode&&l==="disconnected"?null:l==="connecting"?f.jsx($o,{tone:"accent",glyph:f.jsx(na,{}),message:i("statusBanner.connecting")}):l==="reconnecting"?f.jsx($o,{tone:"warn",glyph:f.jsx(na,{}),assertive:!0,message:o||i("statusBanner.reconnectingDefault"),action:f.jsx(Me,{variant:"warn",onClick:()=>r(),className:"shrink-0",children:i("statusBanner.reconnectNow")})}):l==="error"?f.jsx($o,{tone:"bad",glyph:ke.cross,assertive:!0,message:o||i("statusBanner.errorDefault"),action:f.jsx(Me,{variant:"danger",onClick:()=>r(),className:"shrink-0",children:i("common.retry")})}):l==="disconnected"?f.jsx($o,{tone:"idle",glyph:ke.off,message:i("statusBanner.disconnected"),action:f.jsx(Me,{variant:"primary",onClick:()=>r(),className:"shrink-0",children:i("common.connect")})}):null},Fu="Herdr Remote",Sg=80,TS=/[\u0000-\u001F\u007F-\u009F]/g;function hd(a){if(typeof a!="string")return"";const i=a.replace(TS," ").replace(/\s+/g," ").trim();return i.length<=Sg?i:`${i.slice(0,Sg-1).trimEnd()}…`}function MS(a,i,l){const o=d1(l??null),r=o?`${o} `:"",u=hd(a);if(u)return`${r}${u} · ${Fu}`;const h=hd(i);return h?`${r}${h} · ${Fu}`:`${r}${Fu}`}function AS(a,i,l){const o=MS(a,i,l);return typeof document<"u"&&(document.title=o),o}const ES=new Set(["http:","https:","mailto:"]),Gu=/(?:https?:\/\/|mailto:|www\.)[^\s"'<>`]+/gi,NS=/[.,;:!?'"]+$/,Cg=8;function _d(a){return/^www\./i.test(a)?`https://${a}`:a}function kS(a){const i=(r,u)=>r.split(u).length-1;let l=a.replace(NS,"");const o=[["(",")"],["[","]"],["{","}"]];for(const[r,u]of o)for(;l.endsWith(u)&&i(l,u)>i(l,r);)l=l.slice(0,-1);return l}function ry(a){if(typeof a!="string"||a.length===0)return!1;try{return ES.has(new URL(_d(a)).protocol)}catch{return!1}}function LS(a,i){if(typeof a!="string"||i<0)return null;Gu.lastIndex=0;for(let l=Gu.exec(a);l;l=Gu.exec(a)){const o=kS(l[0]);if(!o)continue;const r=l.index,u=r+o.length;if(i>=r&&i<u&&ry(o))return o}return null}function RS(a,i,l){var m;const o=(m=a==null?void 0:a.buffer)==null?void 0:m.active;if(!o||typeof o.getLine!="function"||!o.getLine(l))return null;let r=l;for(let p=0;p<Cg;p+=1){const g=o.getLine(r);if(!(g!=null&&g.isWrapped)||r===0)break;r-=1}let u="",h=-1;for(let p=r;p<r+Cg;p+=1){const g=o.getLine(p);if(!g||p>r&&!g.isWrapped)break;p===l&&(h=u.length+i),u+=g.translateToString(!1)}return h<0?null:{text:u,index:h}}function _S(a,i,l){const o=RS(a,i,l);return o?LS(o.text,o.index):null}function jS(a){try{const i=new URL(_d(a));return i.host||i.pathname}catch{return""}}function md(a){return!ry(a)||typeof window>"u"||typeof window.open!="function"?!1:(window.open(_d(a),"_blank","noopener,noreferrer"),!0)}async function jd(a){if(typeof navigator<"u"&&navigator.clipboard&&typeof navigator.clipboard.writeText=="function")try{return await navigator.clipboard.writeText(a),"clipboard"}catch{}if(typeof document<"u"&&typeof document.execCommand=="function"){let i=null,l=null,o=null;try{if(i=document.createElement("textarea"),i.style.userSelect="text",i.style.webkitUserSelect="text",i.style.position="fixed",i.style.top="0",i.style.left="0",i.style.width="1px",i.style.height="1px",i.style.padding="0",i.style.border="none",i.style.outline="none",i.style.boxShadow="none",i.style.background="transparent",i.style.opacity="0",i.style.fontSize="16px",i.setAttribute("readonly",""),i.setAttribute("aria-hidden","true"),i.value=a,typeof window<"u"&&typeof window.getSelection=="function"&&(o=window.getSelection(),o&&o.rangeCount>0&&(l=o.getRangeAt(0))),document.body.appendChild(i),typeof navigator<"u"&&(/iPad|iPhone|iPod/.test(navigator.userAgent||"")||navigator.platform==="MacIntel"&&(navigator.maxTouchPoints||0)>1)){const h=document.createRange();h.selectNodeContents(i),o&&(o.removeAllRanges(),o.addRange(h)),i.setSelectionRange(0,a.length)}else i.focus({preventScroll:!0}),i.select();if(document.execCommand("copy"))return"exec"}catch{}finally{i!=null&&i.parentNode&&i.parentNode.removeChild(i),o&&(o.removeAllRanges(),l&&o.addRange(l))}}return"failed"}async function OS(){if(!(typeof window>"u"||window.isSecureContext!==!1)||typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.readText!="function")return{ok:!1,reason:"insecure"};try{const i=await navigator.clipboard.readText();return!i||i.length===0?{ok:!1,reason:"empty"}:{ok:!0,text:i}}catch(i){return typeof window<"u"&&window.isSecureContext===!1?{ok:!1,reason:"insecure"}:(i==null?void 0:i.name)==="SecurityError"?{ok:!1,reason:"insecure"}:{ok:!1,reason:"denied"}}}async function DS(){if(!(typeof window>"u"||window.isSecureContext!==!1)||typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.read!="function")return{ok:!1,reason:"insecure"};try{const i=await navigator.clipboard.read();if(!i||i.length===0)return{ok:!1,reason:"empty"};for(const l of i){const o=l.types.find(r=>r.startsWith("image/"));if(o){const r=await l.getType(o);if(r&&r.size>0)return{ok:!0,blob:r}}}return{ok:!1,reason:"empty"}}catch(i){if(typeof window<"u"&&window.isSecureContext===!1)return{ok:!1,reason:"insecure"};const l=i==null?void 0:i.name;return l==="SecurityError"?{ok:!1,reason:"insecure"}:l==="NotAllowedError"?{ok:!1,reason:"denied"}:{ok:!1,reason:"empty"}}}function cy(a){const i=a.clipboardData;if(!i)return null;if(i.files&&i.files.length>0)for(let l=0;l<i.files.length;l++){const o=i.files[l];if(o!=null&&o.type.startsWith("image/"))return o}if(i.items&&i.items.length>0)for(let l=0;l<i.items.length;l++){const o=i.items[l];if(o!=null&&o.type.startsWith("image/")){const r=o.getAsFile();if(r)return r}}return null}function zS(a){if(!a||a.length===0)return null;for(let i=0;i<a.length;i++){const l=a[i];if(l&&(l.type.startsWith("image/")||/\.(png|jpe?g|webp|gif)$/i.test(l.name)))return l}return null}const HS=({isOpen:a,onClose:i,onSend:l,onSendImage:o})=>{const{t:r}=Le(),{addToast:u}=on(),[h,m]=C.useState(""),[p,g]=C.useState(null),[b,v]=C.useState(!1),w=C.useRef(null),x=C.useRef(null),T=C.useRef(null);C.useEffect(()=>{a&&(m(""),g(null),v(!1),w.current&&(w.current.value=""),x.current&&(x.current.value=""))},[a]);const M=async D=>{if(D.size===0){u("error",r("clipboard.fileEmpty"));return}v(!0);try{const L=await Eb(D);L?(g(L),m("")):u("error",r("clipboard.imageTooLarge"))}catch(L){console.error("Failed to process image:",L),u("error",r("clipboard.imageTooLarge"))}finally{v(!1)}},A=async D=>{const L=cy(D);L&&(D.preventDefault(),await M(L))},N=async D=>{const L=zS(D.target.files);D.target.value="",L&&await M(L)},R=D=>{const L=D.target.value;m(L),L&&p&&g(null)},j=()=>{g(null),w.current&&(w.current.value=""),x.current&&(x.current.value="")},V=()=>{p?(o==null||o(p),i()):h.trim()&&(l(h),i())},_=!!(h.trim()||p);return f.jsx(hr,{isOpen:a,onClose:i,title:r("clipboard.pasteTitle"),closeLabel:r("clipboard.cancel"),size:"sm",footer:f.jsxs("div",{className:"flex items-center justify-end gap-2",children:[f.jsx(Me,{variant:"ghost",onClick:i,children:r("clipboard.cancel")}),f.jsx(Me,{variant:"primary",onClick:V,disabled:!_||b,children:r("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:r("clipboard.pasteHint")}),f.jsx("textarea",{ref:T,id:"paste-fallback-input","data-testid":"paste-fallback-input",rows:4,autoFocus:!0,placeholder:r("clipboard.pasteHint"),value:h,onChange:R,onPaste:A,disabled:!!p||b,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:r("clipboard.imageSectionTitle")})})]}),f.jsxs("div",{className:"flex flex-col gap-2",children:[f.jsx("input",{ref:w,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",className:"hidden","data-testid":"paste-fallback-file-input",onChange:N}),f.jsx("input",{ref:x,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",capture:"environment",className:"hidden","data-testid":"paste-fallback-camera-input",onChange:N}),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:r("clipboard.imageCompressedSize",{size:Uw(p.byteLength)})}),f.jsx(Me,{variant:"ghost",onClick:j,"aria-label":r("clipboard.removeImage"),children:r("clipboard.cancel")})]})]}):f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx(Me,{variant:"default",onClick:()=>{var D;return(D=w.current)==null?void 0:D.click()},disabled:b||!!h.trim(),className:"min-h-[44px] px-3 touch-manipulation text-tui-sm font-sans flex-1","aria-label":r("clipboard.chooseImage"),children:r("clipboard.chooseImage")}),f.jsx(Me,{variant:"default",onClick:()=>{var D;return(D=x.current)==null?void 0:D.click()},disabled:b||!!h.trim(),className:"min-h-[44px] px-3 touch-manipulation text-tui-sm font-sans flex-1","aria-label":r("clipboard.takePhoto"),children:r("clipboard.takePhoto")})]}),b&&f.jsx("div",{className:"flex items-center gap-2 text-tui-xs text-tui-muted animate-pulse",children:f.jsx("span",{children:r("clipboard.imageCompressing")})})]})]})})},Ya="tui-focusable group flex h-11 w-full select-none items-center gap-2 border px-2 text-left text-tui transition-colors",$a="border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",BS=({anchorPoint:a,hasSelection:i,isController:l,vibrateOnKeyPress:o=!1,linkUrl:r=null,onOpenLink:u,onCopySelection:h,onCopyLine:m,onCopyScreen:p,onPaste:g,onClose:b})=>{const{t:v}=Le(),w=C.useRef(null),[x,T]=C.useState(null);C.useEffect(()=>{if(o&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(8)}catch{}},[o]),C.useLayoutEffect(()=>{const R=w.current;if(!(R!=null&&R.parentElement))return;const j=R.parentElement.getBoundingClientRect(),V=R.getBoundingClientRect(),_=V.width||208,D=V.height||220,L=j.width,z=j.height;let U=a.x-_/2;U=Math.max(8,Math.min(Math.max(8,L-_-8),U));let ee=a.y-D-8;ee<8&&(ee=a.y+8),ee=Math.max(8,Math.min(Math.max(8,z-D-8),ee)),T({x:U,y:ee})},[a.x,a.y,i,l,r]);const M=Math.max(8,a.x-104),A=Math.max(8,a.y-200),N={position:"absolute",left:`${x?x.x:M}px`,top:`${x?x.y:A}px`,visibility:x?"visible":"hidden"};return f.jsx("div",{ref:w,role:"menu","aria-label":"终端选择操作",className:"z-50 w-52 select-none font-mono",style:N,onMouseDown:R=>R.stopPropagation(),onTouchStart:R=>R.stopPropagation(),onPointerDown:R=>R.stopPropagation(),children:f.jsxs(Tt,{tone:"accent",className:"border border-tui-border bg-tui-base p-1.5 shadow-lg",bodyClassName:"flex flex-col gap-1",children:[r&&u&&f.jsxs("button",{type:"button",role:"menuitem",className:ne(Ya,$a),onClick:()=>{u(r),b()},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:jS(r)})]}),i&&f.jsxs("button",{type:"button",role:"menuitem",className:ne(Ya,$a),onClick:()=>{h(),b()},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(Ya,$a),onClick:()=>{m(),b()},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(Ya,$a),onClick:()=>{p(),b()},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")})]}),l&&f.jsxs("button",{type:"button",role:"menuitem",className:ne(Ya,$a),onClick:()=>{g(),b()},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(Ya,$a),onClick:b,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")})]})]})})},US={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 KS(){return typeof window<"u"&&new URLSearchParams(window.location.search).get("debug")==="1"}function IS(a){const i=C.useRef([]),[l,o]=C.useState({framesPerSec:0,bytesPerSec:0}),r=C.useCallback(h=>{const m=h-1e3,p=i.current;for(;p.length>0&&p[0].time<m;)p.shift()},[]);C.useEffect(()=>{if(!a)return;const h=setInterval(()=>{r(performance.now());let m=0;for(const p of i.current)m+=p.bytes;o({framesPerSec:i.current.length,bytesPerSec:m})},1e3);return()=>clearInterval(h)},[a,r]);const u=C.useCallback(h=>{const m=performance.now();i.current.push({time:m,bytes:h}),r(m)},[r]);return{metrics:l,record:u}}function FS(a){return a?`${a.kind} row ${a.row} cols ${a.startCol}-${a.endCol} caret ${a.caretCol}`:"none"}function GS(a){var o;const i=(o=a==null?void 0:a.canvas)==null?void 0:o.stats;if(!i)return`paint: ${(a==null?void 0:a.kind)??"-"} renderer
|
|
34
|
+
`;const l=i.lastInputToPaintMs!==null?`${i.lastInputToPaintMs.toFixed(1)}ms`:"-";return`paint: ${i.lastPaintMs.toFixed(2)}ms cells: ${i.lastCells} frames: ${i.frames} held: ${i.heldFrames} key→paint: ${l}
|
|
35
|
+
`}function YS(a){const i=(a==null?void 0:a.getTrace())??[];return i.length===0?"trace: -":`trace:
|
|
36
|
+
${i.slice(-6).map(l=>` ${l.event}${l.count>1?` ×${l.count}`:""}`).join(`
|
|
37
|
+
`)}`}const $S=({debug:a,rttMs:i,metrics:l,rendererKind:o,predictiveEcho:r,predictor:u,field:h,renderer:m})=>{const p=u==null?void 0:u.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: ${a.state}
|
|
38
|
+
`,`deltaY: ${a.deltaY} lines: ${a.lines}
|
|
39
|
+
`,`viewportY: ${a.viewportY??"-"} focus: ${a.focused}
|
|
40
|
+
`,`buffer: ${a.bufferType??"-"} base: ${a.baseY??"-"} cursor: ${a.cursorY??"-"} scrollback: ${a.hasScrollback??"-"}
|
|
41
|
+
`,`scroll: ${a.scrollTop??"-"} / ${a.scrollHeight??"-"} (h ${a.clientHeight??"-"}) moved: ${a.moved}
|
|
42
|
+
`,`mode: ${a.scrollMode} calls: ${a.scrollCalls} lines: ${a.lastScrollLines??"-"} mouse: ${a.mouseTracking}
|
|
43
|
+
`,`event: ${a.lastInputEvent||"-"} pointer: ${a.pointerEvents} touch: ${a.touchEvents}
|
|
44
|
+
`,`rtt: ${i!==null?`${i}ms`:"-"} frames/s: ${l.framesPerSec} bytes/s: ${l.bytesPerSec} renderer: ${o??"-"}
|
|
45
|
+
`,`prediction: ${(u==null?void 0:u.getState())??"-"} mode: ${r} pending: ${(u==null?void 0:u.getVisiblePredictions().length)??0} srtt: ${p!=null?`${Math.round(p)}ms`:"-"}
|
|
46
|
+
`,`field: ${FS(h)} mismatches: ${(u==null?void 0:u.getMismatchCount())??0}
|
|
47
|
+
`,GS(m),YS(u)]})};function $n(a){const i=C.useRef(a);return i.current=a,i}function qS(a){const i=$n(a),{termRef:l,subscribeToPasteFileReady:o}=a,[r,u]=C.useState(!1),h=C.useCallback((v,w)=>{i.current.onPaste(),v.paste(w),i.current.addToast("success",i.current.t("clipboard.pasted"))},[i]),m=C.useCallback(()=>{const v=l.current;return v?i.current.isController?v:(i.current.warnViewerMode(),null):null},[l,i]),p=C.useCallback(async()=>{const v=m();if(v){try{const w=await DS();if(w.ok){await i.current.uploadImage(w.blob);return}}catch{}try{const w=await OS();if(w.ok){h(v,w.text);return}else if(w.reason==="empty"){i.current.addToast("info",i.current.t("clipboard.pasteUnavailable"));return}}catch{}u(!0)}},[m,h,i]),g=C.useCallback(v=>{const w=m();w&&h(w,v)},[m,h]),b=C.useCallback(v=>{m()&&i.current.uploadImage(v)},[m,i]);return C.useEffect(()=>o(v=>{const w=l.current;w&&h(w,v)}),[o,l,h]),{isPasteFallbackOpen:r,closePasteFallback:()=>u(!1),handlePaste:p,handleFallbackPasteSend:g,handleFallbackImageSend:b}}const Jo=new Set(["│","┃","║","▐","▕","▏","▌"]),or=new Set(["┌","┐","└","┘","╭","╮","╰","╯","├","┤","┬","┴","┼","┏","┓","┗","┛","╔","╗","╚","╝","╠","╣","╟","╢","╞","╡"]),VS=new Set(["╭","┌","┏","╔"]),PS=new Set(["╭","┌","┏","╔","├","┣","┠","┝","╟","╠","┞","┟","┡","┢"]),XS=new Set(["╮","┐","┓","╗"]),QS=new Set(["╰","└","┗","╚"]),ZS=new Set(["╯","┘","┛","╝"]),Yu=new Set(["─","━","═","╌","┄"]),WS=new Set(["❯","›",">","!"]),Tg=new Set(["$","#","%",">","❯","›","➜","λ","»"]);function Qa(a){return a===""||a===" "||a===" "}class JS{constructor(i){W(this,"cell");W(this,"top");W(this,"bottom");var l;this.screen=i,this.cell=(l=i.getNullCell)==null?void 0:l.call(i),this.top=i.baseY,this.bottom=i.baseY+i.rows-1}get cols(){return this.screen.cols}at(i,l){var o;if(!(i<this.top||i>this.bottom||l<0||l>=this.screen.cols))return(o=this.screen.getLine(i))==null?void 0:o.getCell(l,this.cell)}char(i,l){var o;return((o=this.at(i,l))==null?void 0:o.getChars())??""}dim(i,l){var o,r;return!!((r=(o=this.at(i,l))==null?void 0:o.isDim)!=null&&r.call(o))}text(i,l,o){var r;return i<this.top||i>this.bottom?"":((r=this.screen.getLine(i))==null?void 0:r.translateToString(!0,l,o))??""}isEdge(i,l){if(!Jo.has(this.char(i,l)))return!1;const o=this.char(i-1,l),r=this.char(i+1,l);return Jo.has(o)||or.has(o)||Jo.has(r)||or.has(r)}blankOrDim(i,l,o){var r;for(let u=l;u<o;u++){const h=this.at(i,u);if(h&&!Qa(h.getChars())&&!((r=h.isDim)!=null&&r.call(h)))return!1}return!0}}function eC(a,i,l){if(a.isEdge(i,l))return null;let o=0;for(let u=l-1;u>=0;u--)if(a.isEdge(i,u)){o=u+1;break}let r=a.cols;for(let u=l+1;u<a.cols;u++)if(a.isEdge(i,u)){r=u;break}return o<r?{start:o,end:r}:null}const pd=8,tC=12,Mg=2,Ag=1,nC=4,iC=3,Eg=/-- INSERT --/,aC=/-- (?:NORMAL|VISUAL(?: LINE| BLOCK)?|REPLACE) --/,lC=/Esc to cancel|Enter to (?:confirm|select)|to navigate|Space to (?:change|toggle|select)/i,sC=/^\s*\d+[.)]\s/;function Ng(a,i,l){if(!Yu.has(a.char(i,l.start))||!Yu.has(a.char(i,l.end-1))||or.has(a.char(i,l.start-1)))return!1;const o=l.end-l.start;let r=0;for(let u=l.start;u<l.end;u++)if(Yu.has(a.char(i,u)))r++;else if(u-l.start-r>o*.1)return!1;return r>=o*.9}function tl(a){return`${a.start}-${a.end}`}function uy(a,i,l){if(l.start===0)return a.top;for(let o=i-1;o>=a.top;o--)if(PS.has(a.char(o,l.start-1)))return o;return a.top}function oC(a,i,l){const o=l.start-1,r=l.end,{row:u}=i;if(o<0||r>=a.cols)return null;const h=a.char(u,o);if(!Jo.has(h)||a.char(u,r)!==h)return null;let m=u-1;for(;m>=a.top&&a.char(m,o)===h;)m--;let p=u+1;for(;p<=a.bottom&&a.char(p,o)===h;)p++;if(p-m-1>pd||!VS.has(a.char(m,o))||!XS.has(a.char(m,r))||!QS.has(a.char(p,o))||!ZS.has(a.char(p,r))||a.dim(u,o))return null;const g=l.start+Ag,b=l.end-Ag;return i.col<g||i.col>=b?null:{kind:"frame",key:`frame:${tl(l)}`,region:tl(l),layout:`${m}`,row:u,caretCol:i.col,startCol:g,endCol:b,empty:m+2===p&&i.col===g&&a.blankOrDim(u,g,b),agentLike:!0,vimInsert:null,modal:!1}}function rC(a,i,l){const{row:o}=i;let r=-1;for(let b=o-1;b>=Math.max(a.top,o-pd);b--)if(Ng(a,b,l)){r=b;break}if(r<0)return null;let u=-1;for(let b=o+1;b<=Math.min(a.bottom,o+pd);b++)if(Ng(a,b,l)){u=b;break}if(u<0)return null;const h=r+1;let m=-1;for(let b=l.start;b<Math.min(l.end,l.start+3);b++){const v=a.char(h,b);if(!Qa(v)){WS.has(v)&&Qa(a.char(h,b+1))&&(m=b);break}}if(m<0||a.dim(h,m)||sC.test(a.text(h,m+1,l.end)))return null;for(let b=h+1;b<u;b++)for(let v=l.start;v<l.start+Mg;v++)if(!Qa(a.char(b,v)))return null;let p="";for(let b=u+1;b<=Math.min(a.bottom,u+tC)&&!or.has(a.char(b,l.start-1));b++)p+=`${a.text(b,l.start,l.end)}
|
|
48
|
+
`;if(lC.test(p)||aC.test(p))return null;const g=o===h?m+2:l.start+Mg;return i.col<g||i.col>=l.end?null:{kind:"rule",key:`rule:${tl(l)}:${uy(a,r,l)}`,region:tl(l),layout:`${r}`,row:o,caretCol:i.col,startCol:g,endCol:l.end,empty:u-r===2&&i.col===g&&a.blankOrDim(o,g,l.end),agentLike:!0,vimInsert:Eg.test(p),modal:Eg.test(p)}}function cC(a,i,l){if(i.hidden)return null;const{row:o,col:r}=i;for(let u=r-2;u>=l.start;u--)if(!(!Tg.has(a.char(o,u))||!Qa(a.char(o,u+1))))return a.dim(o,u)?null:kg(a,i,l,o,u+2,u===l.start);for(let u=o-1;u>=Math.max(a.top,o-iC);u--){let h=l.end-1;for(;h>=l.start&&Qa(a.char(u,h));)h--;if(h>=l.end-1-nC&&Tg.has(a.char(u,h)))return a.dim(u,h)?null:kg(a,i,l,u,l.start,!1);if(h<l.end-1)return null}return null}function kg(a,i,l,o,r,u){const h=i.row===o?r:l.start;return i.col<h||i.col>=l.end?null:{kind:"prompt",key:`prompt:${tl(l)}:${uy(a,o,l)}`,region:tl(l),layout:`${o}`,row:i.row,caretCol:i.col,startCol:h,endCol:l.end,empty:i.row===o&&i.col===h&&a.blankOrDim(i.row,h,l.end),agentLike:u,vimInsert:null,modal:!1}}function uC(a,i){const l=new JS(a);if(i.row<l.top||i.row>l.bottom||i.col<0||i.col>=a.cols)return null;const o=eC(l,i.row,i.col);return o?oC(l,i,o)??rC(l,i,o)??cC(l,i,o):null}class dC{constructor(){W(this,"insertSeen",new Set)}detect(i,l){const o=uC(i,l);return!o||o.vimInsert===null?o:o.vimInsert?(this.insertSeen.add(o.region),o):this.insertSeen.has(o.region)?null:o}reset(){this.insertSeen.clear()}}class fC{constructor(i){W(this,"tracker",new dC);W(this,"cached");W(this,"lastComplete",null);W(this,"detect",()=>{var i,l;if((l=(i=this.options).isSynchronizing)!=null&&l.call(i))return this.lastComplete;if(this.cached===void 0){const o=this.options.getScreen(),r=this.options.getCursor();this.cached=o&&r?this.tracker.detect(o,r):null,this.lastComplete=this.cached}return this.cached});this.options=i}invalidate(){this.cached=void 0}reset(){this.tracker.reset(),this.cached=void 0,this.lastComplete=null}}var ct=(a=>(a[a.CODEPOINT_MASK=2097151]="CODEPOINT_MASK",a[a.IS_COMBINED_MASK=2097152]="IS_COMBINED_MASK",a[a.WIDTH_SHIFT=22]="WIDTH_SHIFT",a))(ct||{}),Ze=(a=>(a[a.PCOLOR_MASK=255]="PCOLOR_MASK",a[a.CM_MASK=50331648]="CM_MASK",a[a.CM_DEFAULT=0]="CM_DEFAULT",a[a.CM_P16=16777216]="CM_P16",a[a.CM_P256=33554432]="CM_P256",a[a.CM_RGB=50331648]="CM_RGB",a[a.RGB_MASK=16777215]="RGB_MASK",a))(Ze||{}),ut=(a=>(a[a.INVERSE=67108864]="INVERSE",a[a.BOLD=134217728]="BOLD",a[a.UNDERLINE=268435456]="UNDERLINE",a[a.BLINK=536870912]="BLINK",a[a.INVISIBLE=1073741824]="INVISIBLE",a[a.STRIKETHROUGH=2147483648]="STRIKETHROUGH",a))(ut||{}),Ai=(a=>(a[a.ITALIC=67108864]="ITALIC",a[a.DIM=134217728]="DIM",a[a.HAS_EXTENDED=268435456]="HAS_EXTENDED",a[a.PROTECTED=536870912]="PROTECTED",a[a.OVERLINE=1073741824]="OVERLINE",a))(Ai||{}),Va=(a=>(a[a.NONE=0]="NONE",a[a.SINGLE=1]="SINGLE",a[a.DOUBLE=2]="DOUBLE",a[a.CURLY=3]="CURLY",a[a.DOTTED=4]="DOTTED",a[a.DASHED=5]="DASHED",a))(Va||{});function hC(){return{content:0,fg:0,bg:0,combinedData:"",extended:void 0}}const dy={fg:0,bg:0,ext:0};function fy(a){return a.bg&268435456&&a.extended?a.extended.ext>>>0:0}function mC(a){return a>>>26&7}function pC(a){return a&67108863}function gC(a,i){const l=a.codePointAt(0)??0;return a.length>0&&String.fromCodePoint(l).length===a.length?{content:l|i<<22,combinedData:""}:{content:2097152|i<<22,combinedData:a}}function hy(a){const i=a;return!i||typeof i.fg!="number"||typeof i.bg!="number"?null:{fg:i.fg>>>0,bg:i.bg>>>0,ext:fy(i)}}class bC{constructor(i){W(this,"items",[]);W(this,"target",null);W(this,"provider",()=>this.paint());this.options=i}attach(i){var l;this.target!==i&&((l=this.target)==null||l.setOverlayProvider(null),this.target=i,i==null||i.setOverlayProvider(this.provider))}sync(i){var l;i.length===0&&this.items.length===0||(this.items=i,(l=this.target)==null||l.invalidateOverlay())}clear(){var i;this.items.length!==0&&(this.items=[],(i=this.target)==null||i.invalidateOverlay())}hasItems(){return this.items.length>0}dispose(){this.attach(null),this.items=[]}paint(){if(this.items.length===0)return null;const i=this.options.getTerminal(),l=i==null?void 0:i.buffer.active;if(!i||!l)return null;const o=[],r=this.options.isCursorHidden(),u=l.baseY+l.cursorY,h=l.cursorX,m=gd(i,u,h),p=r&&!!m&&my(m);let g;for(const b of this.items)switch(b.kind){case"char":o.push({row:b.row,col:b.col,chars:b.char,width:b.width,style:b.style??xC(i,b.row,b.col)});break;case"erase":o.push({row:b.row,col:b.col,chars:" ",width:b.width,style:vC(b.style??gd(i,b.row,b.col)??dy)});break;case"mask":p&&b.row===u&&b.col===h&&o.push({row:b.row,col:b.col,chars:b.char,width:1,style:b.style??yC(m)});break;case"caret":r?p&&o.push({row:b.row,col:b.col,chars:b.char,width:1,style:m}):g={row:b.row,col:b.col};break}return g===void 0?{cells:o}:{cells:o,cursor:g}}}function gd(a,i,l){var o;return l<0||l>=a.cols?null:hy((o=a.buffer.active.getLine(i))==null?void 0:o.getCell(l))}function my(a){return(a.fg&ut.INVERSE)!==0||(a.bg&Ze.CM_MASK)!==Ze.CM_DEFAULT}function yC(a){return{fg:a.fg&~ut.INVERSE,bg:a.bg&~(Ze.CM_MASK|Ze.RGB_MASK),ext:a.ext}}function vC(a){return{fg:a.fg&ut.INVERSE?a.fg&(ut.INVERSE|Ze.CM_MASK|Ze.RGB_MASK):0,bg:a.bg&(Ze.CM_MASK|Ze.RGB_MASK),ext:0}}function xC(a,i,l){const o=gd(a,i,l-1);return o&&!my(o)&&!(o.bg&Ai.DIM)?o:dy}const py="\x1B",wC=/^\x1b\[[IO]/,gy=/^\x1b\[<(\d+);\d+;\d+[Mm]/,SC=/^\x1b\[M[\s\S]{3}/,CC=[/^\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\\/],TC=/^\x1b\[1;[2-8]R/;function Lg(a){if(TC.test(a))return 0;const i=wC.exec(a);if(i)return i[0].length;const l=gy.exec(a);if(l){const o=Number(l[1]);return(o&32)!==0&&(o&3)===3&&(o&64)===0?l[0].length:0}for(const o of CC){const r=o.exec(a);if(r)return r[0].length}return 0}function by(a){if(!a.startsWith(py))return"keys";if(gy.test(a)||SC.test(a)){let l=a;for(;l.length>0;){const o=Lg(l);if(o===0)return"pointer";l=l.slice(o)}return"passive"}let i=a;for(;i.length>0;){const l=Lg(i);if(l===0)return"keys";i=i.slice(l)}return"passive"}function MC(a){return a===py}function Gn(a){return a===""||a===" "?" ":a}function AC(a,i,l,o=64){var h;const r=a.buffer.active.getLine(i),u=[];for(let m=l-1;m>=0&&u.length<o;m--){const p=r==null?void 0:r.getCell(m);if(!p)break;((h=p.getWidth)==null?void 0:h.call(p))!==0&&u.unshift(Gn(p.getChars()))}return u}function EC(a,i){for(let l=Math.min(a.length,i.length);l>0;l--){let o=!0;for(let r=0;r<l&&o;r++)o=i[i.length-l+r]===Gn(a[r]);if(o)return l}return 0}function NC(a){const i=a.buffer.active;return{key:"legacy",row:i.baseY+i.cursorY,caretCol:i.cursorX,startCol:i.cursorX,endCol:a.cols,empty:!1,agentLike:!1}}function kC(a,{style:i,predictedCursor:l,field:o,runStartedEmpty:r,active:u}){var w,x,T,M,A;const h=a.map(N=>{const R={row:N.row,col:N.col,char:N.char,width:N.width,kind:N.kind};return i&&(R.style=i),R}),m=a[a.length-1],p=l??{row:m.row,col:m.kind==="erase"?m.col:m.col+m.width},g=(N,R)=>h.some(j=>j.row===N&&j.col<=R&&R<j.col+j.width);if(u&&o&&r&&o.agentLike&&p.row===o.row){const N=u.getLine(p.row);for(let R=p.col;R<o.endCol;R++){if(g(p.row,R)||Gn(((w=N==null?void 0:N.getCell(R))==null?void 0:w.getChars())??"")===" ")continue;const j={row:p.row,col:R,char:" ",width:1,kind:"erase"};i&&(j.style=i),h.push(j)}}if(u){const N={row:u.baseY+u.cursorY,col:u.cursorX};if(!g(N.row,N.col)&&(N.row!==p.row||N.col!==p.col)){const R=((T=(x=u.getLine(N.row))==null?void 0:x.getCell(N.col))==null?void 0:T.getChars())??"",j={row:N.row,col:N.col,char:Gn(R),width:1,kind:"mask"};i&&(j.style=i),h.push(j)}}const b=h.find(N=>N.row===p.row&&N.col===p.col&&N.kind!=="mask"),v=b?b.char:Gn(((A=(M=u==null?void 0:u.getLine(p.row))==null?void 0:M.getCell(p.col))==null?void 0:A.getChars())??"");return h.push({row:p.row,col:p.col,char:v,width:1,kind:"caret"}),h}const LC=[[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 yy(a){if(a>=32&&a<=126)return 1;if(a<12288)return 0;for(const[i,l]of LC){if(a<i)return 0;if(a<=l)return 2}return 0}const Rg=8,RC=1500,_C=4e3,jC=20;class OC{constructor(i){W(this,"getTerminal");W(this,"getFieldOption");W(this,"charWidth");W(this,"now");W(this,"textDecoder",new TextDecoder("utf-8"));W(this,"confidentKeys",new Set);W(this,"fieldStyles",new Map);W(this,"field",null);W(this,"runStartedEmpty",!1);W(this,"predictions",[]);W(this,"predictedCursor",null);W(this,"srtt",null);W(this,"isSuppressed",!1);W(this,"suppressCursor",null);W(this,"suppressSentAt",0);W(this,"inFlight",[]);W(this,"inFlightUnknown",!1);W(this,"runInFlight",[]);W(this,"probationRun",!1);W(this,"runSent",[]);W(this,"lastSentUndrawn",!1);W(this,"awaitingPrefixCommand",!1);W(this,"mismatches",0);W(this,"trace",[]);this.getTerminal=i.getTerminal,this.getFieldOption=i.getField,this.charWidth=i.charWidth,this.now=i.now??(typeof performance<"u"&&typeof performance.now=="function"?()=>performance.now():()=>Date.now())}updateSuppression(i){if(!this.isSuppressed)return;if(this.predictions.some(o=>o.frozenFrom)){this.suppressSentAt=this.now();return}!!i&&!!this.suppressCursor&&(i.row!==this.suppressCursor.row||i.col!==this.suppressCursor.col)?this.liftSuppression():this.stillSuppressed()}reset(i,l){var u;this.predictions=[],this.predictedCursor=null;const o=typeof l=="boolean"?l:(l==null?void 0:l.suppress)??!0,r=typeof l=="object"&&(l==null?void 0:l.demote)===!0;if(this.note(`reset: ${i??"unspecified"}`),r){const h=this.field??((u=this.getFieldOption)==null?void 0:u.call(this))??null;h&&this.confidentKeys.delete(h.key)}if(this.forgetInFlight(),o){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}getTrace(){return this.trace}visiblePredictions(){const i=this.getState()==="confident";return this.predictions.filter(l=>l.frozenFrom?l.shownWhenFrozen:i&&!l.probation)}freeze(i,l={}){var p;const o=this.getTerminal(),r=o?{row:o.buffer.active.baseY+o.buffer.active.cursorY,col:o.buffer.active.cursorX}:null,u=this.getState()==="confident";for(const g of this.predictions)g.frozenFrom||(g.frozenFrom=r??{row:g.row,col:g.col},g.shownWhenFrozen=u&&!g.probation);const h=this.predictedCursor?{...this.predictedCursor}:r,m=this.inFlight.length>0||this.inFlightUnknown||this.lastSentUndrawn;if(this.predictedCursor=null,this.note(`freeze: ${i}${l.demote?" (demote)":""}`),l.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(_C,Math.max(RC,(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(i){var o;const l=(o=this.charWidth)==null?void 0:o.call(this,i);return l===0||l===1||l===2?l:1}coveredByPrediction(i,l){return this.predictions.some(o=>o.echoed&&o.row===i&&o.col<=l&&l<o.col+o.width)}ensureField(i){if(this.predictedCursor&&this.field)return this.field;const l=this.getFieldOption?this.getFieldOption():NC(i);if(!l)return null;let o=l.caretCol,r=[],u=this.inFlightUnknown;if(this.inFlight.length>0&&!this.inFlightUnknown){r=this.inFlight.slice(EC(this.inFlight,AC(i,l.row,o)));for(const h of r){const m=h.codePointAt(0)??0;o+=yy(m)||this.assumedWidth(m)}u=r.length>0}return this.inFlight=[],this.inFlightUnknown=!1,this.field=l,this.runStartedEmpty=l.empty&&r.length===0,this.predictions=this.predictions.filter(h=>h.frozenFrom),this.predictedCursor={row:l.row,col:o},this.runInFlight=r,this.probationRun=u,this.runSent=[],l}confirm(i,l){if(this.updateSrtt(Math.max(0,this.now()-i.sentAt)),l&&!i.frozenFrom&&this.markConfident(l.key),i.probation){for(const o of this.predictions)o.probation=void 0;this.probationRun=!1,this.runInFlight=[],this.runSent=[]}}learnStyle(i,l){const o=hy(l);if(o)for(this.fieldStyles.delete(i),this.fieldStyles.set(i,o);this.fieldStyles.size>Rg;){const r=this.fieldStyles.keys().next().value;if(r===void 0)break;this.fieldStyles.delete(r)}}markConfident(i){for(this.confidentKeys.delete(i),this.confidentKeys.add(i);this.confidentKeys.size>Rg;){const l=this.confidentKeys.values().next().value;if(l===void 0)break;this.confidentKeys.delete(l)}}mismatch(i){this.mismatches++,this.note(`mismatch: ${i}`),this.predictions=[],this.predictedCursor=null,this.field&&this.confidentKeys.delete(this.field.key),this.isSuppressed=!1,this.suppressCursor=null}note(i){const l=this.trace[this.trace.length-1];if(l&&l.event===i){l.count++,l.at=this.now();return}this.trace.push({at:this.now(),event:i,count:1}),this.trace.length>jC&&this.trace.shift()}pruneExpired(){if(this.predictions.length===0)return;const i=this.now(),l=this.predictionTimeout(),o=this.predictions.filter(r=>i-r.sentAt<=l);o.length!==this.predictions.length&&(this.note("expired without an echo"),this.predictions=o,this.predictions.length===0&&(this.predictedCursor=null))}updateSrtt(i){this.srtt===null?this.srtt=i:this.srtt=this.srtt*.8+i*.2}}const DC=2,zC="?!#";class HC extends OC{handleUserInput(i){var h;if(this.pruneExpired(),i.length===0)return;const l=this.textDecoder.decode(i,{stream:!1});if(!l)return;const o=by(l);if(o==="passive")return;if(o==="pointer"){this.freeze("pointer");return}if(this.awaitingPrefixCommand){this.awaitingPrefixCommand=!1,this.freeze("Herdr prefix command",{demote:!0});return}if(MC(l)){const m=this.field??((h=this.getFieldOption)==null?void 0:h.call(this))??null;this.freeze("escape",{demote:(m==null?void 0:m.modal)!==!1});return}const r=this.getTerminal();if(!r){this.reset("terminal unavailable",!0);return}const u=Array.from(l);for(let m=0;m<u.length;m++){const p=u[m],g=p.codePointAt(0);if(g===void 0)continue;if(g===DC){this.awaitingPrefixCommand=!0,this.freeze("Herdr prefix",{demote:!0});return}if(g===27||g===9||g===10||g===13||g<32&&g!==8){this.freeze("control or escape sequence");return}if(g===8||g===127){if(!this.handleBackspace(r))return;continue}if(this.stillSuppressed()){this.inFlight.push(p),this.note("refused: waiting for the caret to move");continue}const b=yy(g);if(b===0){if(!this.skipUnpredictable(p,g,r)){m<u.length-1&&(this.inFlightUnknown=!0);return}continue}if(!this.handlePrintable(p,b,r)){m<u.length-1&&(this.inFlightUnknown=!0);return}}}onServerOutput(){const i=this.getTerminal(),l=i?{row:i.buffer.active.baseY+i.buffer.active.cursorY,col:i.buffer.active.cursorX}:null;this.pruneExpired(),i&&l&&this.predictions.length>0&&this.settle(i,l),this.updateSuppression(l)}settle(i,l){var u,h;const o=this.field;if(this.getFieldOption){const m=this.getFieldOption();if(!m||m.key!==(o==null?void 0:o.key)){if(this.predictions.every(p=>p.frozenFrom||p.echoed)){this.predictions=[],this.predictedCursor=null;return}this.mismatch("field changed");return}if(m.layout!==o.layout){this.predictions=[],this.predictedCursor=null,this.field=m,this.note("layout changed");return}}const r=[];for(const m of this.predictions){const p=(u=i.buffer.active.getLine(m.row))==null?void 0:u.getCell(m.col),g=Gn(p?p.getChars():""),b=m.kind==="char"?g===m.char&&(m.width===1||(((h=p==null?void 0:p.getWidth)==null?void 0:h.call(p))??2)===2):g===" ",v=m.kind==="char"?l.row>m.row||l.row===m.row&&l.col>=m.col+m.width:l.row<m.row||l.row===m.row&&l.col<=m.col,w=m.before.includes(g),x=m.kind==="char"&&g===m.char&&!b;if(!(m.echoed&&!b))if(b&&(v||!w)){if(m.echoed||this.confirm(m,o),v){m.kind==="char"&&o&&!m.frozenFrom&&this.learnStyle(o.key,p);continue}m.echoed=!0,r.push(m)}else if(m.frozenFrom){const T=m.frozenFrom;!v&&l.row===T.row&&l.col>=T.col?r.push(m):v&&m.probation&&(this.inFlightUnknown=!0)}else if(!v&&!x)r.push(m);else if(m.probation){this.note("probation guess dropped"),this.predictions.some(T=>!T.frozenFrom&&T.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(T=>T.frozenFrom),this.predictedCursor=null;return}else{this.mismatch(`cell shows ${JSON.stringify(g)} for ${JSON.stringify(m.char)}`);return}}this.predictions=r,r.length===0&&(this.predictedCursor=null)}getVisiblePredictions(){return this.pruneExpired(),this.visiblePredictions().filter(i=>!i.echoed).map(i=>({row:i.row,col:i.col,char:i.char}))}getOverlayItems(){var l;this.pruneExpired();const i=this.visiblePredictions();return i.length===0?[]:kC(i,{style:this.field?this.fieldStyles.get(this.field.key):void 0,predictedCursor:this.predictedCursor,field:this.field,runStartedEmpty:this.runStartedEmpty,active:(l=this.getTerminal())==null?void 0:l.buffer.active})}handlePrintable(i,l,o){var v;const r=this.ensureField(o);if(!r||!this.predictedCursor)return this.note("refused: caret is not in an input field"),!1;const u=this.predictedCursor,h=this.predictions.every(w=>w.frozenFrom)&&u.col===r.caretCol;if(r.agentLike&&r.empty&&h&&zC.includes(i))return this.freeze("agent mode switch"),!1;if(u.col+l>r.endCol-1)return this.freeze("cursor would reach the edge of the field"),!1;const m=(v=o.buffer.active.getLine(u.row))==null?void 0:v.getCell(u.col),p=[Gn(m?m.getChars():"")],g=this.predictions[this.predictions.length-1];let b;return g&&g.kind==="erase"&&!g.frozenFrom&&g.row===u.row&&g.col===u.col&&(b=this.predictions.pop(),p.push(...g.before," ")),this.predictions.push({row:u.row,col:u.col,char:i,width:l,kind:"char",before:p,sentAt:this.now(),replaces:b,probation:this.probationRun||void 0}),this.probationRun&&this.runSent.push(i),this.lastSentUndrawn=!1,u.col+=l,!0}skipUnpredictable(i,l,o){const r=this.ensureField(o),u=this.predictedCursor;if(!r||!u)return this.note("refused: caret is not in an input field"),!1;const h=this.assumedWidth(l);return u.col+h>r.endCol-1?(this.freeze("cursor would reach the edge of the field"),!1):(this.probationRun||(this.probationRun=!0,this.runSent=[]),this.runSent.push(i),this.lastSentUndrawn=!0,u.col+=h,this.note("width unknown: guessing"),!0)}handleBackspace(i){var o,r,u;const l=this.predictions[this.predictions.length-1];if(this.predictedCursor&&l&&!l.frozenFrom&&!l.echoed&&l.kind==="char"&&l.row===this.predictedCursor.row&&l.col+l.width===this.predictedCursor.col)return this.predictions.pop(),l.probation&&this.runSent.pop(),this.predictedCursor.col=l.col,l.replaces&&this.predictions.push(l.replaces),!0;if(this.stillSuppressed())this.inFlightUnknown=!0;else{const h=this.ensureField(i),m=this.predictedCursor;if(h&&m){const p=i.buffer.active.getLine(m.row),g=p==null?void 0:p.getCell(m.col-1),b=g&&((o=g.getWidth)==null?void 0:o.call(g))===0?2:1,v=m.col-b;let w=!0;for(let T=m.col;T<h.endCol&&w;T++)w=this.coveredByPrediction(m.row,T)||Gn(((r=p==null?void 0:p.getCell(T))==null?void 0:r.getChars())??"")===" ";const x=Gn(((u=p==null?void 0:p.getCell(v))==null?void 0:u.getChars())??"");if(v>h.startCol&&w&&x!==" ")return this.predictions=this.predictions.filter(T=>!(T.echoed&&T.row===m.row&&T.col+T.width>v)),this.predictions.push({row:m.row,col:v,char:" ",width:b,kind:"erase",before:[x],sentAt:this.now(),probation:this.probationRun||void 0}),this.lastSentUndrawn=!1,m.col=v,!0}}return this.freeze("backspace into server content"),!1}}const BC=25,UC=2026,KC=1e3;function IC(a,i=()=>performance.now()){let l=!1,o=null;const r=new Set,u=b=>(r.add(b),{dispose:()=>void r.delete(b)}),h=()=>{l=!1,o=null},m=a.parser;if(!m||typeof m.registerCsiHandler!="function")return{isCursorHidden:()=>!1,isSynchronizing:()=>!1,onSyncEnd:u,reset:h,dispose:()=>{}};const p=b=>v=>{for(const w of v.flat())if(w===BC&&(l=!b),w===UC){const x=!b&&o!==null;if(o=b?i():null,x)for(const T of[...r])T()}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:()=>l,isSynchronizing:()=>o!==null&&i()-o<KC,onSyncEnd:u,reset:h,dispose:()=>{for(const b of g)b.dispose();r.clear()}}}const FC=40;function GC(a,i){return a==="off"?!1:a==="always"?!0:i!==null&&i>FC}function YC(a,i){var m;const l=IC(a),o=new fC({getScreen:()=>{const p=i();if(!p)return null;const g=p.buffer.active;return{cols:p.cols,rows:p.rows,baseY:g.baseY,getLine:b=>g.getLine(b),getNullCell:typeof g.getNullCell=="function"?()=>g.getNullCell():void 0}},getCursor:()=>{var g;const p=(g=i())==null?void 0:g.buffer.active;return p?{row:p.baseY+p.cursorY,col:p.cursorX,hidden:l.isCursorHidden()}:null},isSynchronizing:l.isSynchronizing}),r=(m=a._core)==null?void 0:m.unicodeService,u=new HC({getTerminal:i,getField:o.detect,charWidth:typeof(r==null?void 0:r.wcwidth)=="function"?p=>r.wcwidth(p):void 0}),h=new bC({getTerminal:i,isCursorHidden:()=>l.isCursorHidden()});return{screenState:l,fieldProbe:o,predictor:u,overlay:h}}function $C({termRef:a,rendererRef:i,mode:l,connectionState:o,observeKeyInput:r}){const u=C.useRef(null),h=C.useRef(null),m=C.useRef(null),p=$n(l),g=C.useCallback(()=>{const M=u.current,A=h.current;if(!(!M||!A)){if(!GC(p.current,M.getEchoSrttMs())){A.clear();return}A.sync(M.getOverlayItems())}},[p]),b=C.useCallback(M=>{var A,N,R,j;(A=u.current)==null||A.reset(M),(N=u.current)==null||N.forgetConfidence(),(R=m.current)==null||R.reset(),(j=h.current)==null||j.clear()},[]),v=C.useCallback(M=>{var A,N;(A=u.current)==null||A.reset(M),(N=h.current)==null||N.clear()},[]),w=C.useCallback(M=>{var A,N,R;(A=u.current)==null||A.handleUserInput(M),g(),(R=(N=i.current)==null?void 0:N.canvas)==null||R.markInput()},[g,i]),x=C.useCallback(M=>{const A=YC(M,()=>a.current);return m.current=A.fieldProbe,u.current=A.predictor,h.current=A.overlay,A},[a]),T=C.useCallback(()=>{var M;(M=h.current)==null||M.dispose(),h.current=null,u.current=null,m.current=null},[]);return C.useEffect(()=>r(w),[r,w]),C.useEffect(()=>{g()},[l,g]),C.useEffect(()=>{b("connectionState")},[o,b]),{predictorRef:u,overlayRef:h,fieldProbeRef:m,attach:x,detach:T,sync:g,forget:b,discard:v,onUserInput:w}}const qC=20,VC=6,PC=500,XC=300,nl=13,vy=.602,xy=1.3;function Yn(a,i){return Number.isFinite(a)&&a>0?a:i}function _g(a,i,l){return Math.min(l,Math.max(i,a))}function wy(a){const{width:i,height:l,cellWidth:o,cellHeight:r,minCols:u=qC,minRows:h=VC,maxCols:m=PC,maxRows:p=XC}=a,g=Yn(o,nl*vy),b=Yn(r,nl*xy);return{cols:_g(Math.floor(Yn(i,0)/g),u,m),rows:_g(Math.floor(Yn(l,0)/b),h,p)}}function ia(a,i=nl){var o,r,u;if(a)try{const h=a._core,m=(u=(r=(o=h==null?void 0:h._renderService)==null?void 0:o.dimensions)==null?void 0:r.css)==null?void 0:u.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 l=Yn(i,nl);return{cellWidth:Math.round(l*vy*100)/100,cellHeight:Math.round(l*xy*100)/100,measured:!1}}function QC(a){var o;const i=(o=a==null?void 0:a.querySelector)==null?void 0:o.call(a,".xterm-viewport");if(!i)return 0;const l=(i.offsetWidth||0)-(i.clientWidth||0);return Number.isFinite(l)&&l>0?l:0}function bd(a,i,l){if(!a)return{width:i,height:l};let o=0,r=0;if(typeof a.getBoundingClientRect=="function"){const u=a.getBoundingClientRect();o=(u==null?void 0:u.width)||0,r=(u==null?void 0:u.height)||0}return{width:Yn(o,Yn(a.clientWidth,i)),height:Yn(r,Yn(a.clientHeight,l))}}function Sy(a,i,l,o){const r=Number.isFinite(o)&&o>.01?o:1;return{clientX:l.left+(a-l.left)/r,clientY:l.top+(i-l.top)/r}}function jg(a,i){const l=typeof window<"u"?window:void 0,o=l&&typeof l.devicePixelRatio=="number"&&l.devicePixelRatio>0?l.devicePixelRatio:1,r=l!=null&&l.visualViewport&&typeof l.visualViewport.scale=="number"&&l.visualViewport.scale>0?l.visualViewport.scale:1,u=Math.max(0,a.width),h=Math.max(0,a.height),m=Math.round(u*o*100)/100,p=Math.round(h*o*100)/100;return{dpr:o,scale:r,cssWidth:u,cssHeight:h,physicalWidth:m,physicalHeight:p}}function ZC(a){const{lastSnapshot:i,currentSnapshot:l,physicalTolerancePx:o=6}=a;if(!i)return{shouldIgnore:!1,isVisualZoom:!1,reason:"initial"};const r=Math.abs(l.scale-i.scale)>.01,u=Math.abs(l.scale-1)>.01;if(r||u)return{shouldIgnore:!0,isVisualZoom:!0,reason:"visual_pinch_zoom"};if(Math.abs(l.dpr-i.dpr)>.01){const g=Math.abs(l.physicalWidth-i.physicalWidth),b=Math.abs(l.physicalHeight-i.physicalHeight);if(g<=o&&b<=o)return{shouldIgnore:!0,isVisualZoom:!0,reason:"dpr_zoom"}}const m=Math.abs(l.cssWidth-i.cssWidth),p=Math.abs(l.cssHeight-i.cssHeight);return m<1&&p<1?{shouldIgnore:!0,isVisualZoom:!1,reason:"no_box_change"}:{shouldIgnore:!1,isVisualZoom:!1,reason:"genuine_resize"}}const WC=250;function JC({termRef:a,containerRef:i,frameRef:l,surfaceRef:o,currentScaleRef:r,rendererRef:u,initialBannerWrittenRef:h,isActiveRef:m,sendResize:p,onResized:g}){const b=$n(p),v=$n(g),w=C.useRef({cols:0,rows:0}),x=C.useRef(null),T=C.useRef(null),M=C.useRef(null),A=C.useRef(null),N=C.useRef({width:0,height:0}),R=C.useRef(null),j=C.useRef(!1),V=C.useCallback((q,P)=>{!Number.isFinite(q)||!Number.isFinite(P)||q<=0||P<=0||q===w.current.cols&&P===w.current.rows||(x.current={cols:q,rows:P},!T.current&&(T.current=setTimeout(()=>{T.current=null;const ie=x.current;x.current=null,ie&&(ie.cols===w.current.cols&&ie.rows===w.current.rows||(w.current=ie,b.current(ie.cols,ie.rows),v.current()))},WC)))},[b,v]),_=C.useCallback((q=!1)=>{var xe;const P=a.current,ie=i.current,ae=o.current,F=l.current;if(!P||!ie||!ae||!F)return;const E=bd(ie,Za(),ed());if(E.width<=0||E.height<=0)return;F.style.width="100%",F.style.height="100%",ae.style.width="100%",ae.style.height="100%",ae.style.transform="none",ae.style.transformOrigin="top left",r.current=1;const Y=jg(E),X=ZC({lastSnapshot:R.current,currentSnapshot:Y});if(X.isVisualZoom&&!q){R.current=Y;try{P.refresh(0,Math.max(0,P.rows-1))}catch{}return}if(X.shouldIgnore&&!q)return;R.current=Y;const le=ia(P,nl),Q=wy({width:E.width-QC(ae),height:E.height,cellWidth:le.cellWidth,cellHeight:le.cellHeight}),ve=Math.abs(E.width-N.current.width)>1||Math.abs(E.height-N.current.height)>1;if(P.cols!==Q.cols||P.rows!==Q.rows)try{P.resize(Q.cols,Q.rows)}catch(me){console.debug("Error resizing terminal grid:",me)}h.current&&!j.current&&(ve||P.cols!==Q.cols||P.rows!==Q.rows)&&(j.current=!0,(xe=u.current)==null||xe.verify());const ye=Q.cols!==w.current.cols||Q.rows!==w.current.rows;m.current&&(ve||q||ye)&&(N.current={width:E.width,height:E.height},V(Q.cols,Q.rows));try{P.refresh(0,Math.max(0,P.rows-1))}catch{}},[a,i,o,l,r,u,h,m,V]),D=C.useRef(_);D.current=_;const L=C.useCallback(()=>{if(M.current===null){if(typeof requestAnimationFrame!="function"){D.current();return}M.current=requestAnimationFrame(()=>{M.current=null,D.current()})}},[]),z=C.useCallback((q=30)=>{A.current!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(A.current),A.current=null);let P=0;const ie=()=>{A.current=null,P++;const ae=P>=q;D.current(!0),!ae&&P<2&&typeof requestAnimationFrame=="function"&&(A.current=requestAnimationFrame(ie))};typeof requestAnimationFrame=="function"?A.current=requestAnimationFrame(ie):ie()},[]),U=C.useCallback(q=>{N.current={width:q.width,height:q.height},R.current=jg(q)},[]),ee=C.useCallback(()=>{T.current&&(clearTimeout(T.current),T.current=null),M.current!==null&&(cancelAnimationFrame(M.current),M.current=null),A.current!==null&&(cancelAnimationFrame(A.current),A.current=null)},[]);return{requestFit:L,scheduleBoundedFit:z,seedFit:U,cancelPendingFits:ee}}const eT=" ()[]{}'\"\\`";function tT(a,i,l,o=1){var A,N;if(!((A=i==null?void 0:i.buffer)!=null&&A.active)||i.cols<=0||i.rows<=0)return null;const r=l||((N=i.element)==null?void 0:N.querySelector(".xterm-screen"))||i.element;if(!r||typeof r.getBoundingClientRect!="function")return null;const u=r.getBoundingClientRect(),h=Sy(a.clientX,a.clientY,u,o),m=ia(i);if(m.cellWidth<=0||m.cellHeight<=0)return null;const p=Math.max(1,u.width||i.cols*m.cellWidth),g=Math.max(1,u.height||i.rows*m.cellHeight),b=Math.max(0,Math.min(p-1,h.clientX-u.left)),v=Math.max(0,Math.min(g-1,h.clientY-u.top)),w=Math.max(0,Math.min(i.cols-1,Math.floor(b/m.cellWidth))),x=Math.max(0,Math.min(i.rows-1,Math.floor(v/m.cellHeight))),M=(i.buffer.active.viewportY??0)+x;return{col:w,bufferRow:M}}function nT(a,i){if(!a||a.length===0||a==="\0")return!0;for(const l of a)if(l==="\0"||/\s/.test(l)||i.includes(l))return!0;return!1}function iT(a,i,l){var w,x;if(!((w=a==null?void 0:a.buffer)!=null&&w.active)||i<0||i>=a.cols)return null;const o=a.buffer.active.getLine(l);if(!o)return null;const r=((x=a.options)==null?void 0:x.wordSeparator)??eT,u=new Array(a.cols).fill(null),h=Math.min(a.cols,o.length);let m=0;for(;m<h;){const T=o.getCell(m);if(!T){u[m]={startCol:m,endCol:m+1,isSeparator:!0},m++;continue}const M=T.getWidth();if(M===0){u[m]||(u[m]={startCol:m,endCol:m+1,isSeparator:!0}),m++;continue}const A=T.getChars(),N=nT(A,r),R=Math.min(a.cols,m+M),j={startCol:m,endCol:R,isSeparator:N};for(let V=m;V<R;V++)u[V]=j;m+=Math.max(1,M)}for(let T=h;T<a.cols;T++)u[T]||(u[T]={startCol:T,endCol:T+1,isSeparator:!0});const p=u[i];if(!p||p.isSeparator)return null;let g=p.startCol;for(;g>0;){const T=u[g-1];if(T&&!T.isSeparator)g=T.startCol;else break}let b=p.endCol;for(;b<a.cols;){const T=u[b];if(T&&!T.isSeparator)b=T.endCol;else break}const v=b-g;return v<=0?null:{startCol:g,length:v}}function aT(a){var u;if(!((u=a==null?void 0:a.buffer)!=null&&u.active))return"";const i=a.buffer.active,l=i.viewportY??0,o=a.rows,r=[];for(let h=0;h<o;h++){const m=i.getLine(l+h);r.push(m?m.translateToString(!0):"")}for(;r.length>0&&r[r.length-1]==="";)r.pop();return r.join(`
|
|
49
|
+
`)}const Og=new Set(["│","┃","╎","╏","┆","┇","┊","┋","║","▏","▕","|"]),lT=.6,sT=new Set(["─","━","═","┄","┅","┈","┉","-"]),oT=.8;function $u(a,i){if(!a)return!1;let l=0;const o=Math.min(i,a.length);for(let r=0;r<o;r++){const u=a.getCell(r);if(u){const h=u.getChars();h&&sT.has(h)&&l++}}return l>=Math.max(5,Math.min(i*.25,10))}function qu(a,i,l){var x;if(!((x=a==null?void 0:a.buffer)!=null&&x.active)||a.cols<=0)return{startCol:0,endCol:0};const o=a.buffer.active,r=a.cols,u=Math.max(0,Math.min(r-1,i)),h=o.viewportY??0,m=a.rows>0?a.rows:1,p=new Int32Array(r);let g=0;for(let T=0;T<m;T++){const M=o.getLine(h+T);if(g++,!M)continue;const A=Math.min(r,M.length);for(let N=0;N<A;N++){const R=M.getCell(N);if(R){const j=R.getChars();j&&Og.has(j)&&p[N]++}}}if(g===0)return{startCol:0,endCol:r-1};const b=g*lT,v=T=>p[T]>=b;let w=!1;for(let T=0;T<r;T++)if(v(T)){w=!0;break}if(w){if(v(u))return{startCol:u,endCol:u};let T=-1;for(let A=u-1;A>=0;A--)if(v(A)){T=A;break}let M=r;for(let A=u+1;A<r;A++)if(v(A)){M=A;break}return{startCol:T+1,endCol:M-1}}if(l!==void 0){const T=Math.max(h,Math.min(h+m-1,l)),M=o.getLine(T);if(!$u(M,r)){let A=h;for(let j=T-1;j>=h;j--)if($u(o.getLine(j),r)){A=j+1;break}let N=h+m-1;for(let j=T+1;j<=h+m-1;j++)if($u(o.getLine(j),r)){N=j-1;break}const R=N-A+1;if(R>=2){const j=new Int32Array(r);for(let L=A;L<=N;L++){const z=o.getLine(L);if(!z)continue;const U=Math.min(r,z.length);for(let ee=0;ee<U;ee++){const q=z.getCell(ee);if(q){const P=q.getChars();P&&Og.has(P)&&j[ee]++}}}const V=R*oT,_=L=>j[L]>=V;let D=!1;for(let L=0;L<r;L++)if(_(L)){D=!0;break}if(D){if(_(u))return{startCol:u,endCol:u};let L=-1;for(let U=u-1;U>=0;U--)if(_(U)){L=U;break}let z=r;for(let U=u+1;U<r;U++)if(_(U)){z=U;break}return{startCol:L+1,endCol:z-1}}}}}return{startCol:0,endCol:r-1}}function Dg(a,i){const l=Math.min(a.startCol,a.endCol),o=Math.max(a.startCol,a.endCol),r=Math.min(a.startRow,a.endRow),u=Math.max(a.startRow,a.endRow);return{startCol:Math.max(i.startCol,Math.min(i.endCol,l)),endCol:Math.max(i.startCol,Math.min(i.endCol,o)),startRow:r,endRow:u}}function zg(a,i){var g;if(!((g=a==null?void 0:a.buffer)!=null&&g.active)||a.cols<=0)return"";const l=a.buffer.active,o=a.cols,r=Math.min(i.startRow,i.endRow),u=Math.max(i.startRow,i.endRow),h=Math.max(0,Math.min(i.startCol,i.endCol)),m=Math.min(o-1,Math.max(i.startCol,i.endCol));if(h>m||r>u)return"";const p=[];for(let b=r;b<=u;b++){const v=l.getLine(b);if(!v){p.push("");continue}const w=v.translateToString(!0,h,m+1);p.push(w.trimEnd())}return p.join(`
|
|
50
|
+
`)}function rT({termRef:a,surfaceRef:i,mainRef:l,currentScaleRef:o,addToast:r,t:u}){const h=$n(r),m=$n(u),[p,g]=C.useState(null),b=C.useRef(null);b.current=p;const[v,w]=C.useState(null),x=C.useRef(null);x.current=v;const[T,M]=C.useState(""),A=C.useRef("");A.current=T;const[N,R]=C.useState(!1),j=C.useRef(!1);j.current=N;const V=C.useRef(!1),[_,D]=C.useState(0),L=C.useRef(0),z=C.useRef(null),U=C.useRef(null),ee=C.useRef(null),q=C.useRef(null),P=C.useCallback(oe=>{var pe;const Se=a.current;if(!Se)return null;const se=((pe=i.current)==null?void 0:pe.querySelector(".xterm-screen"))||i.current;return tT(oe,Se,se,o.current)},[a,i,o]),ie=C.useCallback(oe=>{const Se=a.current,se=P(oe);return!Se||!se?null:_S(Se,se.col,se.bufferRow)},[a,P]),ae=C.useCallback((oe,Se)=>{w(Se),M(zg(oe,Se)),R(!0)},[]),F=C.useCallback(()=>{w(null),M(""),R(!1),ee.current=null,q.current=null},[]),E=C.useCallback(()=>{g(null),b.current=null,w(null),x.current=null,M(""),A.current="",R(!1),z.current=null,U.current=null},[]),Y=C.useCallback(oe=>{const Se=a.current;if(!Se)return;const se=P(oe),pe=se?iT(Se,se.col,se.bufferRow):null;if(se&&pe){ee.current=se;const Ee=qu(Se,se.col,se.bufferRow);q.current=Ee;const Be={startCol:pe.startCol,endCol:pe.startCol+pe.length-1,startRow:se.bufferRow,endRow:se.bufferRow};ae(Se,Dg(Be,Ee))}else F();z.current=oe,U.current=null},[a,P,ae,F]),X=C.useCallback(oe=>{const Se=a.current,se=ee.current;if(!Se||!se)return;U.current=oe;const pe=P(oe);if(!pe)return;const Ee=q.current??qu(Se,se.col,se.bufferRow),Be={startCol:Math.min(se.col,pe.col),endCol:Math.max(se.col,pe.col),startRow:Math.min(se.bufferRow,pe.bufferRow),endRow:Math.max(se.bufferRow,pe.bufferRow)};ae(Se,Dg(Be,Ee))},[a,P,ae]),le=C.useCallback(()=>{const oe=U.current??z.current;if(!oe||!l.current)return;const Se=l.current.getBoundingClientRect(),se=oe.clientX-Se.left,pe=oe.clientY-Se.top,Ee=ie(oe);g({x:se,y:pe,link:Ee}),b.current={x:se,y:pe,link:Ee}},[l,ie]),Q=C.useCallback(async oe=>{await jd(oe)==="failed"?h.current("error",m.current("clipboard.copyFailed")):h.current("success",m.current("clipboard.copied"))},[h,m]),ve=C.useCallback(async()=>{const oe=A.current;oe&&await Q(oe)},[Q]),ye=C.useCallback(async()=>{var Ee,Be,ce,Ae;const oe=a.current,Se=(Ee=oe==null?void 0:oe.buffer)==null?void 0:Ee.active;if(!oe||!Se)return;const se=((Be=x.current)==null?void 0:Be.startRow)??((ce=ee.current)==null?void 0:ce.bufferRow)??Se.viewportY,pe=q.current??qu(oe,((Ae=ee.current)==null?void 0:Ae.col)??0,se);await Q(zg(oe,{startCol:pe.startCol,endCol:pe.endCol,startRow:se,endRow:se}))},[a,Q]),xe=C.useCallback(async()=>{const oe=a.current;oe&&await Q(aT(oe))},[a,Q]),me=C.useCallback((oe,Se,se)=>{const pe=oe.buffer.active.viewportY??0;pe!==L.current&&(L.current=pe,D(pe));const Ee=x.current;if(Ee&&j.current){const Be=Ee.startRow-pe,ce=Ee.endRow-pe;V.current&&Se<=ce&&se>=Be&&(R(!1),V.current=!1)}else V.current=!1},[]),de=C.useCallback(oe=>{const Se=oe.buffer.active.viewportY??0;L.current=Se,D(Se)},[]),we=C.useCallback(()=>{V.current=!0},[]);return{selectionMenu:p,selectionRect:v,selectionSnapshot:T,isHighlightVisible:N,viewportY:_,hasOpenMenu:()=>b.current!==null,clearSelection:E,handleLongPress:Y,handleSelectionExtend:X,openMenuAtGesture:le,handleCopySelection:ve,handleCopyLine:ye,handleCopyScreen:xe,onTerminalRender:me,onTerminalScroll:de,onTerminalContentChanged:we}}const cT=({term:a,surface:i,main:l,rect:o,viewportY:r})=>{if(!a||!l)return null;const u=ia(a);if(u.cellWidth<=0||u.cellHeight<=0)return null;const h=(i==null?void 0:i.querySelector(".xterm-screen"))||i;if(!h)return null;const m=h.getBoundingClientRect(),p=l.getBoundingClientRect(),g=o.startRow-r;if(o.endRow-r<0||g>=a.rows)return null;const v=m.top-p.top+g*u.cellHeight,w=m.left-p.left+o.startCol*u.cellWidth,x=(o.endCol-o.startCol+1)*u.cellWidth,T=(o.endRow-o.startRow+1)*u.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:`${w}px`,width:`${x}px`,height:`${T}px`}})},qo=new Map;function Cy(a){let i=qo.get(a);return i===void 0&&(i=`#${(a&Ze.RGB_MASK).toString(16).padStart(6,"0")}`,qo.size>4096&&qo.clear(),qo.set(a,i)),i}function Ty(a,i,l){var o;switch(a&Ze.CM_MASK){case Ze.CM_P16:case Ze.CM_P256:return((o=i.ansi[a&Ze.PCOLOR_MASK])==null?void 0:o.css)??l;case Ze.CM_RGB:return Cy(a&Ze.RGB_MASK);default:return l}}function Hg(a,i,l,o){var v;const r=(a&ut.INVERSE)!==0,u=r?i:a,h=r?a:i;let m;const p=u&Ze.CM_MASK;if(p===Ze.CM_P16||p===Ze.CM_P256){let w=u&Ze.PCOLOR_MASK;o&&a&ut.BOLD&&w<8&&(w+=8),m=((v=l.ansi[w])==null?void 0:v.css)??l.foreground.css}else p===Ze.CM_RGB?m=Cy(u&Ze.RGB_MASK):m=r?l.background.css:l.foreground.css;const g=h&Ze.CM_MASK,b=g===Ze.CM_DEFAULT?r?l.foreground.css:l.background.css:Ty(h,l,l.background.css);return{fg:m,bg:b,bgIsDefault:!r&&g===Ze.CM_DEFAULT}}function er(a){return(a&ut.BOLD)!==0}function Vu(a){return(a&Ai.ITALIC)!==0}function yd(a){return(a&Ai.DIM)!==0}function Vo(a){return(a&ut.INVISIBLE)!==0}const uT=600;var Pa=(a=>(a[a.NONE=0]="NONE",a[a.BLOCK=1]="BLOCK",a[a.BAR=2]="BAR",a[a.UNDERLINE=3]="UNDERLINE",a[a.OUTLINE=4]="OUTLINE",a))(Pa||{});function Bg(a){switch(a){case"bar":return 2;case"underline":return 3;case"outline":return 4;default:return 1}}function dT(a,i,l,o,r,u,{css:h,dpr:m,cursorWidth:p}){switch(a.save(),a.fillStyle=h,a.strokeStyle=h,u){case 2:a.fillRect(l,o,Math.max(1,Math.round(p*m)),i.cell.height);break;case 3:a.fillRect(l,o+i.cell.height-Math.max(1,Math.round(m))-1,r,Math.max(1,Math.round(m)));break;case 4:{const g=Math.max(1,Math.round(m));a.lineWidth=g,a.strokeRect(l+g/2,o+g/2,r-g,i.cell.height-g);break}}a.restore()}function fT(a,i,l,o,r){let u,h;if(l&&l.cursor!==void 0){if(l.cursor===null)return null;u=l.cursor.row,h=l.cursor.col}else{if(!a.coreService.isCursorInitialized||a.coreService.isCursorHidden)return null;u=i.ybase+i.y,h=i.x}const m=u-i.ydisp;if(m<0||m>=o.rows)return null;const p=Math.min(Math.max(0,h),o.cols-1),g=a.optionsService.rawOptions;let b;if(a._coreBrowserService.isFocused)r?b=0:b=Bg(g.cursorStyle||"block");else{const v=g.cursorInactiveStyle??"outline";b=v==="none"?0:Bg(v)}return b===0?null:{x:p,y:m,shape:b}}class hT{constructor(i){W(this,"timer",null);W(this,"visible",!0);this.onToggle=i}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()},uT)}stop(){this.timer&&clearInterval(this.timer),this.timer=null,this.visible=!0}}/**
|
|
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 Ug(a){if(!a)throw new Error("value must not be falsy");return a}const mT={"▀":[{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}]},pT={"░":[[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]]},gT={"─":{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:(a,i)=>`M0,${.5-i} L1,${.5-i} M0,${.5+i} L1,${.5+i}`},"║":{1:(a,i)=>`M${.5-a},0 L${.5-a},1 M${.5+a},0 L${.5+a},1`},"╒":{1:(a,i)=>`M.5,1 L.5,${.5-i} L1,${.5-i} M.5,${.5+i} L1,${.5+i}`},"╓":{1:(a,i)=>`M${.5-a},1 L${.5-a},.5 L1,.5 M${.5+a},.5 L${.5+a},1`},"╔":{1:(a,i)=>`M1,${.5-i} L${.5-a},${.5-i} L${.5-a},1 M1,${.5+i} L${.5+a},${.5+i} L${.5+a},1`},"╕":{1:(a,i)=>`M0,${.5-i} L.5,${.5-i} L.5,1 M0,${.5+i} L.5,${.5+i}`},"╖":{1:(a,i)=>`M${.5+a},1 L${.5+a},.5 L0,.5 M${.5-a},.5 L${.5-a},1`},"╗":{1:(a,i)=>`M0,${.5+i} L${.5-a},${.5+i} L${.5-a},1 M0,${.5-i} L${.5+a},${.5-i} L${.5+a},1`},"╘":{1:(a,i)=>`M.5,0 L.5,${.5+i} L1,${.5+i} M.5,${.5-i} L1,${.5-i}`},"╙":{1:(a,i)=>`M1,.5 L${.5-a},.5 L${.5-a},0 M${.5+a},.5 L${.5+a},0`},"╚":{1:(a,i)=>`M1,${.5-i} L${.5+a},${.5-i} L${.5+a},0 M1,${.5+i} L${.5-a},${.5+i} L${.5-a},0`},"╛":{1:(a,i)=>`M0,${.5+i} L.5,${.5+i} L.5,0 M0,${.5-i} L.5,${.5-i}`},"╜":{1:(a,i)=>`M0,.5 L${.5+a},.5 L${.5+a},0 M${.5-a},.5 L${.5-a},0`},"╝":{1:(a,i)=>`M0,${.5-i} L${.5-a},${.5-i} L${.5-a},0 M0,${.5+i} L${.5+a},${.5+i} L${.5+a},0`},"╞":{1:(a,i)=>`M.5,0 L.5,1 M.5,${.5-i} L1,${.5-i} M.5,${.5+i} L1,${.5+i}`},"╟":{1:(a,i)=>`M${.5-a},0 L${.5-a},1 M${.5+a},0 L${.5+a},1 M${.5+a},.5 L1,.5`},"╠":{1:(a,i)=>`M${.5-a},0 L${.5-a},1 M1,${.5+i} L${.5+a},${.5+i} L${.5+a},1 M1,${.5-i} L${.5+a},${.5-i} L${.5+a},0`},"╡":{1:(a,i)=>`M.5,0 L.5,1 M0,${.5-i} L.5,${.5-i} M0,${.5+i} L.5,${.5+i}`},"╢":{1:(a,i)=>`M0,.5 L${.5-a},.5 M${.5-a},0 L${.5-a},1 M${.5+a},0 L${.5+a},1`},"╣":{1:(a,i)=>`M${.5+a},0 L${.5+a},1 M0,${.5+i} L${.5-a},${.5+i} L${.5-a},1 M0,${.5-i} L${.5-a},${.5-i} L${.5-a},0`},"╤":{1:(a,i)=>`M0,${.5-i} L1,${.5-i} M0,${.5+i} L1,${.5+i} M.5,${.5+i} L.5,1`},"╥":{1:(a,i)=>`M0,.5 L1,.5 M${.5-a},.5 L${.5-a},1 M${.5+a},.5 L${.5+a},1`},"╦":{1:(a,i)=>`M0,${.5-i} L1,${.5-i} M0,${.5+i} L${.5-a},${.5+i} L${.5-a},1 M1,${.5+i} L${.5+a},${.5+i} L${.5+a},1`},"╧":{1:(a,i)=>`M.5,0 L.5,${.5-i} M0,${.5-i} L1,${.5-i} M0,${.5+i} L1,${.5+i}`},"╨":{1:(a,i)=>`M0,.5 L1,.5 M${.5-a},.5 L${.5-a},0 M${.5+a},.5 L${.5+a},0`},"╩":{1:(a,i)=>`M0,${.5+i} L1,${.5+i} M0,${.5-i} L${.5-a},${.5-i} L${.5-a},0 M1,${.5-i} L${.5+a},${.5-i} L${.5+a},0`},"╪":{1:(a,i)=>`M.5,0 L.5,1 M0,${.5-i} L1,${.5-i} M0,${.5+i} L1,${.5+i}`},"╫":{1:(a,i)=>`M0,.5 L1,.5 M${.5-a},0 L${.5-a},1 M${.5+a},0 L${.5+a},1`},"╬":{1:(a,i)=>`M0,${.5+i} L${.5-a},${.5+i} L${.5-a},1 M1,${.5+i} L${.5+a},${.5+i} L${.5+a},1 M0,${.5-i} L${.5-a},${.5-i} L${.5-a},0 M1,${.5-i} L${.5+a},${.5-i} L${.5+a},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:(a,i)=>`M.5,1 L.5,${.5+i/.15*.5} C.5,${.5+i/.15*.5},.5,.5,1,.5`},"╮":{1:(a,i)=>`M.5,1 L.5,${.5+i/.15*.5} C.5,${.5+i/.15*.5},.5,.5,0,.5`},"╯":{1:(a,i)=>`M.5,0 L.5,${.5-i/.15*.5} C.5,${.5-i/.15*.5},.5,.5,0,.5`},"╰":{1:(a,i)=>`M.5,0 L.5,${.5-i/.15*.5} C.5,${.5-i/.15*.5},.5,.5,1,.5`}},us={"":{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}};us[""]=us[""];us[""]=us[""];function bT(a,i,l,o,r,u,h,m){const p=mT[i];if(p)return yT(a,p,l,o,r,u),!0;const g=pT[i];if(g)return vT(a,g,l,o,r,u),!0;const b=gT[i];if(b)return xT(a,b,l,o,r,u,m),!0;const v=us[i];return v?(wT(a,v,l,o,r,u,h,m),!0):!1}function yT(a,i,l,o,r,u){for(let h=0;h<i.length;h++){const m=i[h],p=r/8,g=u/8;a.fillRect(l+m.x*p,o+m.y*g,m.w*p,m.h*g)}}const Kg=new Map;function vT(a,i,l,o,r,u){let h=Kg.get(i);h||(h=new Map,Kg.set(i,h));const m=a.fillStyle;if(typeof m!="string")throw new Error(`Unexpected fillStyle type "${m}"`);let p=h.get(m);if(!p){const g=i[0].length,b=i.length,v=a.canvas.ownerDocument.createElement("canvas");v.width=g,v.height=b;const w=Ug(v.getContext("2d")),x=new ImageData(g,b);let T,M,A,N;if(m.startsWith("#"))T=parseInt(m.slice(1,3),16),M=parseInt(m.slice(3,5),16),A=parseInt(m.slice(5,7),16),N=m.length>7&&parseInt(m.slice(7,9),16)||1;else if(m.startsWith("rgba"))[T,M,A,N]=m.substring(5,m.length-1).split(",").map(R=>parseFloat(R));else throw new Error(`Unexpected fillStyle color format "${m}" when drawing pattern glyph`);for(let R=0;R<b;R++)for(let j=0;j<g;j++)x.data[(R*g+j)*4]=T,x.data[(R*g+j)*4+1]=M,x.data[(R*g+j)*4+2]=A,x.data[(R*g+j)*4+3]=i[R][j]*(N*255);w.putImageData(x,0,0),p=Ug(a.createPattern(v,null)),h.set(m,p)}a.fillStyle=p,a.fillRect(l,o,r,u)}function xT(a,i,l,o,r,u,h){a.strokeStyle=a.fillStyle;for(const[m,p]of Object.entries(i)){a.beginPath(),a.lineWidth=h*Number.parseInt(m,10);let g;if(typeof p=="function"){const v=.15/u*r;g=p(.15,v)}else g=p;for(const b of g.split(" ")){const v=b[0],w=My[v];if(!w){console.error(`Could not find drawing instructions for "${v}"`);continue}const x=b.substring(1).split(",");!x[0]||!x[1]||w(a,Ay(x,r,u,l,o,!0,h))}a.stroke(),a.closePath()}}function wT(a,i,l,o,r,u,h,m){const p=new Path2D;p.rect(l,o,r,u),a.clip(p),a.beginPath();const g=h/12;a.lineWidth=m*g;for(const b of i.d.split(" ")){const v=b[0],w=My[v];if(!w){console.error(`Could not find drawing instructions for "${v}"`);continue}const x=b.substring(1).split(",");!x[0]||!x[1]||w(a,Ay(x,r,u,l,o,!1,m,(i.leftPadding??0)*(g/2),(i.rightPadding??0)*(g/2)))}i.type===1?(a.strokeStyle=a.fillStyle,a.stroke()):a.fill(),a.closePath()}function Ig(a,i,l=0){return Math.max(Math.min(a,i),l)}const My={C:(a,i)=>a.bezierCurveTo(i[0],i[1],i[2],i[3],i[4],i[5]),L:(a,i)=>a.lineTo(i[0],i[1]),M:(a,i)=>a.moveTo(i[0],i[1])};function Ay(a,i,l,o,r,u,h,m=0,p=0){const g=a.map(b=>parseFloat(b)||parseInt(b,10));if(g.length<2)throw new Error("Too few arguments for instruction");for(let b=0;b<g.length;b+=2)g[b]*=i-m*h-p*h,u&&g[b]!==0&&(g[b]=Ig(Math.round(g[b]+.5)-.5,i,0)),g[b]+=o+m*h;for(let b=1;b<g.length;b+=2)g[b]*=l,u&&g[b]!==0&&(g[b]=Ig(Math.round(g[b]+.5)-.5,l,0)),g[b]+=r;return g}const Od=.5,ST=1024,CT=6;function TT(a){return/Firefox\//.test(a)||/Edge\/\d/.test(a)?"bottom":"ideographic"}class MT{constructor(i,l=typeof navigator<"u"?navigator.userAgent:""){W(this,"pages",[]);W(this,"slots",new Map);W(this,"inkCache",new Map);W(this,"metrics",null);W(this,"font",null);W(this,"baseline");W(this,"generation",0);W(this,"scratch");this.document=i,this.baseline=TT(l)}configure(i,l){const o=this.metrics&&this.font&&this.metrics.cellWidth===i.cellWidth&&this.metrics.cellHeight===i.cellHeight&&this.metrics.charWidth===i.charWidth&&this.metrics.charHeight===i.charHeight&&this.metrics.charLeft===i.charLeft&&this.metrics.charTop===i.charTop&&this.metrics.dpr===i.dpr&&this.font.fontFamily===l.fontFamily&&this.font.fontSize===l.fontSize&&this.font.fontWeight===l.fontWeight&&this.font.fontWeightBold===l.fontWeightBold&&this.font.customGlyphs===l.customGlyphs;this.metrics={...i},this.font={...l},o||this.clear()}clear(){this.slots.clear(),this.inkCache.clear();for(const i of this.pages)i.shelfX=0,i.shelfY=0;this.generation++}dispose(){this.slots.clear(),this.inkCache.clear();for(const i of this.pages)i.canvas.width=0,i.canvas.height=0;this.pages=[]}get pageCount(){return this.pages.length}fontString(i,l){const o=this.font,r=i?o.fontWeightBold:o.fontWeight;return`${l?"italic ":""}${r} ${o.fontSize*this.metrics.dpr}px ${o.fontFamily}`}overflow(i,l,o){if(!this.metrics||!this.font||i.length===1&&i.charCodeAt(0)<128)return 0;const r=`${l?1:0}${o?1:0}${i}`,u=this.inkCache.get(r);if(u!==void 0)return u;let h=0;const m=this.scratchContext();if(m&&!(this.font.customGlyphs&&Ey(i))){m.font=this.fontString(l,o),m.textBaseline=this.baseline;const p=m.measureText(i),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(r,h),h}get(i){const l=this.metrics,o=this.font;if(!l||!o||l.cellWidth<=0||l.cellHeight<=0)return null;const r=`${i.cells}${i.bold?1:0}${i.italic?1:0}${i.dim?1:0}${i.fg}\0${i.bg}\0${i.chars}`,u=this.slots.get(r);if(u)return u;const h=l.cellWidth*i.cells,m=l.cellHeight,p=this.allocate(h,m);if(!p)return null;const{page:g,x:b,y:v}=p,w=g.ctx;w.save(),w.beginPath(),w.rect(b,v,h,m),w.clip(),w.globalAlpha=1,w.fillStyle=i.bg,w.fillRect(b,v,h,m),w.fillStyle=i.fg,i.dim&&(w.globalAlpha=Od);let x=!1;o.customGlyphs&&(x=bT(w,i.chars,b,v,l.cellWidth,l.cellHeight,o.fontSize,l.dpr)),x||(w.font=this.fontString(i.bold,i.italic),w.textBaseline=this.baseline,w.fillText(i.chars,b+l.charLeft,v+l.charTop+l.charHeight)),w.restore();const T={source:g.canvas,x:b,y:v,width:h,height:m};return this.slots.set(r,T),T}allocate(i,l){for(const o of this.pages){const r=this.fit(o,i,l);if(r)return r}if(this.pages.length<CT){const o=this.createPage(Math.max(ST,i,l));return o?(this.pages.push(o),this.fit(o,i,l)):null}return this.clear(),this.pages[0]?this.fit(this.pages[0],i,l):null}fit(i,l,o){if(i.shelfX+l>i.canvas.width&&(i.shelfX=0,i.shelfY+=o),i.shelfY+o>i.canvas.height||l>i.canvas.width)return null;const r={page:i,x:i.shelfX,y:i.shelfY};return i.shelfX+=l,r}createPage(i){const l=this.document.createElement("canvas");l.width=i,l.height=i;const o=l.getContext("2d",{alpha:!1});return o?{canvas:l,ctx:o,shelfX:0,shelfY:0}:null}scratchContext(){if(this.scratch===void 0){const i=this.document.createElement("canvas");i.width=1,i.height=1,this.scratch=i.getContext("2d")}return this.scratch}}function Ey(a){if(a.length!==1)return!1;const i=a.charCodeAt(0);return i>=9472&&i<=9631||i>=57504&&i<=57558}function AT(a,i){return(a&(ut.UNDERLINE|ut.STRIKETHROUGH))!==0||(i&Ai.OVERLINE)!==0}function ET(a,i,{px:l,py:o,cells:r,fgWord:u,bgWord:h,ext:m,fgCss:p},{fontSize:g,dpr:b,colors:v,boldBright:w}){const x=(u&ut.UNDERLINE)!==0,T=(u&ut.STRIKETHROUGH)!==0,M=(h&Ai.OVERLINE)!==0,A=r*i.cell.width;a.save(),a.beginPath(),a.rect(l,o,A,i.cell.height),a.clip(),yd(h)&&(a.globalAlpha=Od);const N=Math.max(1,Math.floor(g*b/15)),R=N%2===1?.5:0;if(x){const j=pC(m);let V=p;if(j){let L=j;w&&er(u)&&(L&50331648)!==50331648&&(L&255)<8&&(L+=8),V=Ty(L,v,p)}a.strokeStyle=V,a.lineWidth=N;const _=o+i.char.top+Math.ceil(i.char.height)-R-N*2,D=m?mC(m):Va.SINGLE;switch(a.beginPath(),D){case Va.DOUBLE:a.moveTo(l,_),a.lineTo(l+A,_),a.moveTo(l,_+N*2),a.lineTo(l+A,_+N*2);break;case Va.CURLY:{const L=_+N,z=Math.max(1,N);for(let U=0;U<r;U++){const ee=l+U*i.cell.width,q=ee+i.cell.width/2,P=ee+i.cell.width;a.moveTo(ee,L),a.bezierCurveTo(ee,L-z,q,L-z,q,L),a.bezierCurveTo(q,L+z,P,L+z,P,L)}break}case Va.DOTTED:a.setLineDash([N,N]),a.moveTo(l,_),a.lineTo(l+A,_);break;case Va.DASHED:{const L=Math.floor(.6*i.cell.width),z=Math.floor(.3*i.cell.width);a.setLineDash([L,z,i.cell.width-L-z]),a.moveTo(l,_),a.lineTo(l+A,_);break}default:a.moveTo(l,_),a.lineTo(l+A,_)}a.stroke(),a.setLineDash([])}if(M&&(a.strokeStyle=p,a.lineWidth=N,a.beginPath(),a.moveTo(l,o+i.char.top+R),a.lineTo(l+A,o+i.char.top+R),a.stroke()),T){const j=Math.max(1,Math.floor(g*b/10)),V=o+i.char.top+Math.floor(i.char.height/2)-(j%2===1?.5:0);a.strokeStyle=p,a.lineWidth=j,a.beginPath(),a.moveTo(l,V),a.lineTo(l+A,V),a.stroke()}a.restore()}const ns=4294967295,Pu=4,NT=3;class kT{constructor(i,l,o,r){W(this,"atlas");W(this,"cols",0);W(this,"rows",0);W(this,"painted",{content:new Uint32Array(0),fg:new Uint32Array(0),bg:new Uint32Array(0),ext:new Uint32Array(0),meta:new Uint32Array(0),combined:[]});W(this,"row",{content:new Uint32Array(0),fg:new Uint32Array(0),bg:new Uint32Array(0),ext:new Uint32Array(0),combined:[]});W(this,"work",hC());this.ctx=i,this.core=o,this.dimensions=r,this.atlas=new MT(l)}resize(i,l){this.cols=i,this.rows=l;const o=i*l;this.painted={content:new Uint32Array(o).fill(ns),fg:new Uint32Array(o),bg:new Uint32Array(o),ext:new Uint32Array(o),meta:new Uint32Array(o).fill(ns),combined:new Array(o).fill("")},this.row={content:new Uint32Array(i),fg:new Uint32Array(i),bg:new Uint32Array(i),ext:new Uint32Array(i),combined:new Array(i).fill("")}}invalidate(){this.painted.content.fill(ns),this.painted.meta.fill(ns)}hasPaintedInk(i,l){const o=this.dimensions.device;if(!o.cell.width||!o.cell.height)return!1;const r=Math.min(this.cols,Math.floor(i/o.cell.width)),u=Math.min(this.rows,Math.floor(l/o.cell.height)),h=this.painted;for(let m=0;m<u;m++)for(let p=0;p<r;p++){const g=m*this.cols+p,b=h.content[g];if(b===ns||h.meta[g]===Pu||Vo(h.fg[g]))continue;const v=b&ct.CODEPOINT_MASK;if(b&ct.IS_COMBINED_MASK?h.combined[g]!=="":v!==0&&v!==32)return!0}return!1}loadRow(i,l){const{content:o,fg:r,bg:u,ext:h,combined:m}=this.row,p=this.work;for(let g=0;g<this.cols;g++)i&&g<i.length?(i.loadCell(g,p),o[g]=p.content,r[g]=p.fg,u[g]=p.bg,h[g]=fy(p),m[g]=p.content&ct.IS_COMBINED_MASK?p.combinedData:""):(o[g]=1<<ct.WIDTH_SHIFT,r[g]=0,u[g]=0,h[g]=0,m[g]="");if(l)for(const g of l){const b=g.col;if(b<0||b+g.width>this.cols)continue;b>0&&!(o[b]>>>ct.WIDTH_SHIFT)&&this.blankAt(b-1);const v=b+g.width;v<this.cols&&!(o[v]>>>ct.WIDTH_SHIFT)&&o[v-1]>>>ct.WIDTH_SHIFT===2&&this.blankAt(v);const w=gC(g.chars,g.width);o[b]=w.content,m[b]=w.combinedData,r[b]=g.style.fg,u[b]=g.style.bg,h[b]=g.style.ext,g.width===2&&(o[b+1]=0,m[b+1]="",r[b+1]=g.style.fg,u[b+1]=g.style.bg,h[b+1]=g.style.ext)}}blankAt(i){this.row.content[i]=32|1<<ct.WIDTH_SHIFT,this.row.combined[i]=""}paintRow(i,l){const o=this.cols,{content:r,fg:u,bg:h,ext:m,combined:p}=this.row,g=this.painted,b=i*o;let v=0,w=-1,x=-1,T="";const M=()=>{w<0||(this.fillCells(w,i,x-w,T),w=-1)};let A=0;for(;A<o;){let R=r[A]>>>ct.WIDTH_SHIFT;R===0&&(R=1),A+R>o&&(R=o-A),R===1&&A+1<o&&this.overflowsInto(A)&&(R=2);const j=l&&l.y===i&&l.x>=A&&l.x<A+R?l.shape:Pa.NONE,V=R|j<<NT;let _=this.differs(b+A,A,V);for(let D=1;D<R;D++)this.differs(b+A+D,A+D,Pu)&&(_=!0);if(_){for(let L=0;L<R;L++){const z=b+A+L;g.content[z]=r[A+L],g.fg[z]=u[A+L],g.bg[z]=h[A+L],g.ext[z]=m[A+L],g.meta[z]=L===0?V:Pu,g.combined[z]=p[A+L]}v+=R;const D=this.plainFill(A,j);D!==null?w>=0&&x===A&&T===D?x=A+R:(M(),w=A,x=A+R,T=D):(M(),this.paintCell(A,i,R,j))}A+=R}return M(),v}differs(i,l,o){const r=this.painted,u=this.row;return r.meta[i]!==o||r.content[i]!==u.content[l]||r.fg[i]!==u.fg[l]||r.bg[i]!==u.bg[l]||r.ext[i]!==u.ext[l]||r.combined[i]!==u.combined[l]}overflowsInto(i){const{content:l,fg:o,bg:r,ext:u}=this.row,h=l[i];if((h&ct.CODEPOINT_MASK)<128&&!(h&ct.IS_COMBINED_MASK)||h>>>ct.WIDTH_SHIFT!==1||Vo(o[i]))return!1;const p=l[i+1],g=p&ct.CODEPOINT_MASK;if(p>>>ct.WIDTH_SHIFT!==1||p&ct.IS_COMBINED_MASK||g!==0&&g!==32||r[i]!==r[i+1]||u[i+1]!==0||(o[i]&ut.INVERSE)!==(o[i+1]&ut.INVERSE)||o[i]&ut.INVERSE&&o[i]!==o[i+1]||o[i+1]&(ut.UNDERLINE|ut.STRIKETHROUGH)||r[i+1]&Ai.OVERLINE)return!1;const b=this.charsAt(i);return this.core.optionsService.rawOptions.customGlyphs!==!1&&Ey(b)?!1:this.atlas.overflow(b,er(o[i]),Vu(r[i]))>0}charsAt(i){const l=this.row.content[i];if(l&ct.IS_COMBINED_MASK)return this.row.combined[i];const o=l&ct.CODEPOINT_MASK;return o?String.fromCodePoint(o):""}plainFill(i,l){if(l!==Pa.NONE)return null;const{content:o,fg:r,bg:u}=this.row,h=o[i],m=h&ct.CODEPOINT_MASK,p=!(h&ct.IS_COMBINED_MASK)&&(m===0||m===32),g=Vo(r[i]);return!p&&!g||(r[i]&(ut.UNDERLINE|ut.STRIKETHROUGH)||u[i]&Ai.OVERLINE)&&!g?null:Hg(r[i],u[i],this.colors(),this.boldBright()).bg}paintCell(i,l,o,r){const u=this.ctx,h=this.dimensions.device,m=this.colors(),p=this.row.fg[i],g=this.row.bg[i],b=this.row.ext[i],v=Hg(p,g,m,this.boldBright());let w=v.fg,x=v.bg;r===Pa.BLOCK&&(x=m.cursor.css,w=m.cursorAccent.css);const T=Vo(p),M=this.charsAt(i),A=i*h.cell.width,N=l*h.cell.height,R=o*h.cell.width,j=h.cell.height,V=T||M===""||M===" ",_=V?null:this.atlas.get({chars:M,bold:er(p),italic:Vu(g),dim:yd(g),fg:w,bg:x,cells:o});_?u.drawImage(_.source,_.x,_.y,_.width,_.height,A,N,R,j):(u.fillStyle=x,u.fillRect(A,N,R,j),V||(u.save(),u.beginPath(),u.rect(A,N,R,j),u.clip(),u.fillStyle=w,yd(g)&&(u.globalAlpha=Od),u.font=this.atlas.fontString(er(p),Vu(g)),u.fillText(M,A+h.char.left,N+h.char.top+h.char.height),u.restore())),!T&&AT(p,g)&&ET(u,h,{px:A,py:N,cells:o,fgWord:p,bgWord:g,ext:b,fgCss:w},{fontSize:this.core.optionsService.rawOptions.fontSize,dpr:this.core._coreBrowserService.dpr,colors:m,boldBright:this.boldBright()}),r!==Pa.NONE&&r!==Pa.BLOCK&&dT(u,h,A,N,R,r,{css:m.cursor.css,dpr:this.core._coreBrowserService.dpr,cursorWidth:this.core.optionsService.rawOptions.cursorWidth})}fillCells(i,l,o,r){const u=this.dimensions.device;this.ctx.fillStyle=r,this.ctx.fillRect(i*u.cell.width,l*u.cell.height,o*u.cell.width,u.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 i=this.dimensions.device,l=this.core.optionsService.rawOptions;this.atlas.configure({cellWidth:i.cell.width,cellHeight:i.cell.height,charWidth:i.char.width,charHeight:i.char.height,charLeft:i.char.left,charTop:i.char.top,dpr:this.core._coreBrowserService.dpr},{fontFamily:l.fontFamily,fontSize:l.fontSize,fontWeight:l.fontWeight,fontWeightBold:l.fontWeightBold,customGlyphs:l.customGlyphs!==!1})}colors(){return this.core._themeService.colors}boldBright(){return this.core.optionsService.rawOptions.drawBoldTextInBrightColors!==!1}}class LT{constructor(i){W(this,"canvas");W(this,"ctx");W(this,"selection",null);W(this,"link",null);this.canvas=i.createElement("canvas"),this.canvas.classList.add("xterm-decor-layer"),this.canvas.style.zIndex="2";const l=this.canvas.getContext("2d");if(!l)throw new Error("2D canvas unavailable");this.ctx=l}setSelection(i,l,o){this.selection=i&&l&&!(i[0]===l[0]&&i[1]===l[1])?{start:[i[0],i[1]],end:[l[0],l[1]],columnSelectMode:o}:null}paint({dims:i,rows:l,cols:o,ydisp:r,colors:u,focused:h,dpr:m}){var w;const p=this.ctx;if(p.clearRect(0,0,this.canvas.width,this.canvas.height),!i.cell.width||!l)return;const{selection:g,link:b}=this,v=(x,T,M,A)=>p.fillRect(x*i.cell.width,T*i.cell.height,M*i.cell.width,A*i.cell.height);if(g){const x=g.start[1]-r,T=g.end[1]-r,M=Math.max(x,0),A=Math.min(T,l-1);if(M<l&&A>=0)if(p.fillStyle=(h?u.selectionBackgroundTransparent:u.selectionInactiveBackgroundTransparent).css,g.columnSelectMode)v(g.start[0],M,g.end[0]-g.start[0],A-M+1);else{const N=x===M?g.start[0]:0,R=M===T?g.end[0]:o;v(N,M,R-N,1),v(0,M+1,o,Math.max(A-M-1,0)),M!==A&&v(0,A,T===A?g.end[0]:o,1)}}if(b){p.fillStyle=b.fg===257?u.background.css:b.fg!==void 0&&b.fg<256?((w=u.ansi[b.fg])==null?void 0:w.css)??u.foreground.css:u.foreground.css;const x=(T,M,A)=>p.fillRect(T*i.cell.width,(M+1)*i.cell.height-m-1,A*i.cell.width,m);if(b.y1===b.y2)x(b.x1,b.y1,b.x2-b.x1);else{x(b.x1,b.y1,b.cols-b.x1);for(let T=b.y1+1;T<b.y2;T++)x(0,T,b.cols);x(0,b.y2,b.x2)}}}}function RT(){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 _T(a,i,l,o){const r=i._charSizeService;if(!r.hasValidSize)return!1;const u=i._coreBrowserService.dpr,h=i.optionsService.rawOptions;return a.device.char.width=Math.floor(r.width*u),a.device.char.height=Math.ceil(r.height*u),a.device.cell.height=Math.floor(a.device.char.height*h.lineHeight),a.device.char.top=h.lineHeight===1?0:Math.round((a.device.cell.height-a.device.char.height)/2),a.device.cell.width=a.device.char.width+Math.round(h.letterSpacing),a.device.char.left=Math.floor(h.letterSpacing/2),a.device.canvas.height=o*a.device.cell.height,a.device.canvas.width=l*a.device.cell.width,a.css.canvas.height=Math.round(a.device.canvas.height/u),a.css.canvas.width=Math.round(a.device.canvas.width/u),a.css.cell.height=a.css.canvas.height/o,a.css.cell.width=a.css.canvas.width/l,!0}function jT(a,i,l){if(!a||typeof a.ResizeObserver!="function")return null;let o=new a.ResizeObserver(r=>{var p;const u=r.find(g=>g.target===i);if(!u)return;if(!("devicePixelContentBoxSize"in u)||!((p=u.devicePixelContentBoxSize)!=null&&p[0])){o==null||o.disconnect(),o=null;return}const h=u.devicePixelContentBoxSize[0].inlineSize,m=u.devicePixelContentBoxSize[0].blockSize;h<=0||m<=0||h===i.width&&m===i.height||l(h,m)});try{o.observe(i,{box:"device-pixel-content-box"})}catch{o.disconnect(),o=null}return{dispose:()=>o==null?void 0:o.disconnect()}}function OT(a){if(!a)return[];const i=a.cells.map(l=>l.row);return a.cursor&&i.push(a.cursor.row),i}function DT(a){const i=new Map;for(const l of(a==null?void 0:a.cells)??[]){const o=i.get(l.row);o?o.push(l):i.set(l.row,[l])}return i}class zT{constructor(i,l,o){W(this,"startedAt",null);W(this,"held",null);W(this,"timer",null);this.now=i,this.maxHoldMs=l,this.onExpire=o}get pending(){return this.held}hold(i,l){const o=this.now();return this.startedAt===null&&(this.startedAt=o),o-this.startedAt>=this.maxHoldMs?!1:(this.held=this.held?{start:Math.min(this.held.start,i),end:Math.max(this.held.end,l)}:{start:i,end:l},this.timer||(this.timer=setTimeout(()=>{this.timer=null,this.onExpire()},this.maxHoldMs)),!0)}release(i,l){return this.held&&(i=Math.min(i,this.held.start),l=Math.max(l,this.held.end)),this.held=null,this.startedAt=null,this.timer&&(clearTimeout(this.timer),this.timer=null),{start:i,end:l}}dispose(){this.timer&&clearTimeout(this.timer)}}function HT(a){var l,o,r,u;const i=a._core;return!(i!=null&&i.screenElement)||!i.coreService||!((l=i.optionsService)!=null&&l.rawOptions)||!((o=i._bufferService)!=null&&o.buffer)||!i._charSizeService||!i._coreBrowserService||!((r=i._themeService)!=null&&r.colors)||typeof((u=i._renderService)==null?void 0:u.setRenderer)!="function"?null:i}class BT{constructor(){W(this,"listeners",new Set);W(this,"event",i=>(this.listeners.add(i),{dispose:()=>this.listeners.delete(i)}))}fire(i){for(const l of[...this.listeners])l(i)}dispose(){this.listeners.clear()}}const UT=150;class Dd{constructor(i,l){W(this,"dimensions",RT());W(this,"redraw",new BT);W(this,"onRequestRedraw",this.redraw.event);W(this,"stats",{frames:0,heldFrames:0,lastPaintMs:0,lastCells:0,lastInputToPaintMs:null});W(this,"canvas");W(this,"decor");W(this,"cells");W(this,"disposables",[]);W(this,"now");W(this,"syncHold");W(this,"cols",0);W(this,"rows",0);W(this,"overlayProvider",null);W(this,"paintedOverlayRows",new Set);W(this,"paintedCursorRow",-1);W(this,"lastYdisp",0);W(this,"inputAt",null);W(this,"blink",new hT(()=>this.requestCursorRow()));W(this,"disposed",!1);W(this,"isSynchronizing");W(this,"dprUsed",0);this.core=i,this.now=l.now??(()=>performance.now()),this.syncHold=new zT(this.now,l.maxSyncHoldMs??UT,()=>this.flushHeld()),this.isSynchronizing=l.isSynchronizing??(()=>!1);const o=i._coreBrowserService.mainDocument,r=i.screenElement;this.canvas=o.createElement("canvas"),this.canvas.classList.add("xterm-text-layer"),this.canvas.style.zIndex="0";const u=this.canvas.getContext("2d",{alpha:!1});if(!u)throw new Error("2D canvas unavailable");this.decor=new LT(o),r.appendChild(this.canvas),r.appendChild(this.decor.canvas),this.cells=new kT(u,o,i,this.dimensions),this.disposables.push(i._themeService.onChangeColors(()=>{this.cells.atlas.clear(),this.invalidateAll(),this.redrawDecor()}),i.optionsService.onOptionChange(h=>{(h==="cursorBlink"||h==="cursorStyle")&&this.restartBlink()})),i.linkifier&&this.disposables.push(i.linkifier.onShowLinkUnderline(h=>{this.decor.link=h,this.redrawDecor()}),i.linkifier.onHideLinkUnderline(()=>{this.decor.link=null,this.redrawDecor()})),this.observeDevicePixels(),this.observeFonts(o),this.restartBlink()}static install(i,l={}){const o=HT(i);if(!o)return null;const r=new Dd(o,l);return o._renderService.setRenderer(r),o._renderService.handleResize(o._bufferService.cols,o._bufferService.rows),r}setOverlayProvider(i){this.overlayProvider=i,this.invalidateOverlay()}invalidateOverlay(){var o;const i=((o=this.overlayProvider)==null?void 0:o.call(this))??null,l=new Set(this.paintedOverlayRows);for(const r of OT(i))l.add(r);this.paintedCursorRow>=0&&l.add(this.paintedCursorRow+this.buffer().ydisp),this.requestAbsoluteRows(l)}markInput(){this.inputAt=this.now()}flushHeld(){const i=this.syncHold.pending;i&&this.redraw.fire({start:i.start,end:i.end})}handleDevicePixelRatioChange(){this.dimensions.device.cell.width&&this.dprUsed!==this.core._coreBrowserService.dpr&&this.handleResize(this.core._bufferService.cols,this.core._bufferService.rows)}handleResize(i,l){_T(this.dimensions,this.core,i,l)&&(this.dprUsed=this.core._coreBrowserService.dpr);const o=this.dimensions;for(const u of[this.canvas,this.decor.canvas])u.width=o.device.canvas.width,u.height=o.device.canvas.height,u.style.width=`${o.css.canvas.width}px`,u.style.height=`${o.css.canvas.height}px`;const r=this.core.screenElement;r&&(r.style.width=`${o.css.canvas.width}px`,r.style.height=`${o.css.canvas.height}px`),this.cols=i,this.rows=l,this.cells.resize(i,l),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(i,l,o){this.decor.setSelection(i,l,o),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(i,l){if(this.disposed||!this.cols||!this.rows||!this.dimensions.device.cell.width)return;if(this.isSynchronizing()&&this.syncHold.hold(i,l)){this.stats.heldFrames++;return}const o=this.syncHold.release(i,l);this.paint(Math.max(0,o.start),Math.min(this.rows-1,o.end))}dispose(){if(!this.disposed){this.disposed=!0,this.blink.stop(),this.syncHold.dispose();for(const i of this.disposables)i.dispose();this.disposables.length=0,this.redraw.dispose(),this.cells.atlas.dispose(),this.canvas.remove(),this.decor.canvas.remove()}}uninstall(){const i=this.core._createRenderer;typeof i=="function"&&(this.core._renderService.setRenderer(i.call(this.core)),this.core._renderService.handleResize(this.core._bufferService.cols,this.core._bufferService.rows)),this.dispose()}get textCanvas(){return this.canvas}hasPaintedInk(i,l){return this.cells.hasPaintedInk(i,l)}paint(i,l){var v;const o=this.now(),r=this.buffer(),u=r.ydisp;u!==this.lastYdisp&&(this.lastYdisp=u,this.redrawDecor());const h=((v=this.overlayProvider)==null?void 0:v.call(this))??null,m=DT(h),p=this.cursorState(h),g=new Set;for(let w=i;w<=l;w++)g.add(w);for(const w of this.paintedOverlayRows)Po(g,w-u,this.rows);for(const w of m.keys())Po(g,w-u,this.rows);this.paintedCursorRow>=0&&Po(g,this.paintedCursorRow,this.rows),p&&Po(g,p.y,this.rows);let b=0;for(const w of g)this.cells.loadRow(r.lines.get(u+w),m.get(w+u)),b+=this.cells.paintRow(w,p);this.paintedOverlayRows=new Set(m.keys()),this.paintedCursorRow=p?p.y:-1,this.stats.frames++,this.stats.lastCells=b,this.stats.lastPaintMs=this.now()-o,this.inputAt!==null&&b>0&&(this.stats.lastInputToPaintMs=this.now()-this.inputAt,this.inputAt=null)}cursorState(i){return fT(this.core,this.buffer(),i,{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 i=this.buffer(),l=new Set;l.add(i.ybase+i.y),this.paintedCursorRow>=0&&l.add(this.paintedCursorRow+i.ydisp),this.requestAbsoluteRows(l)}redrawDecor(){this.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})}invalidateAll(){this.cells.invalidate(),this.paintedCursorRow=-1}observeDevicePixels(){const i=jT(this.core._coreBrowserService.window,this.canvas,(l,o)=>{const r=this.core._coreBrowserService.dpr,u=this.dimensions.css.canvas;if(!(Math.abs(l-u.width*r)>2||Math.abs(o-u.height*r)>2)){this.dimensions.device.canvas.width=l,this.dimensions.device.canvas.height=o;for(const h of[this.canvas,this.decor.canvas])h.width=l,h.height=o;this.invalidateAll(),this.cells.fillBackground(),this.redrawDecor(),this.redraw.fire({start:0,end:Math.max(0,this.rows-1)})}});i&&this.disposables.push(i)}observeFonts(i){const l=i.fonts;if(!l||typeof l.addEventListener!="function")return;const o=()=>this.clearTextureAtlas();l.addEventListener("loadingdone",o),this.disposables.push({dispose:()=>l.removeEventListener("loadingdone",o)})}buffer(){return this.core._bufferService.buffer}colors(){return this.core._themeService.colors}requestAbsoluteRows(i){if(!this.rows)return;const l=this.buffer().ydisp;let o=1/0,r=-1/0;for(const u of i){const h=u-l;h<0||h>=this.rows||(o=Math.min(o,h),r=Math.max(r,h))}o<=r&&this.redraw.fire({start:o,end:r})}}function Po(a,i,l){i>=0&&i<l&&a.add(i)}const KT=30,Ny=640,ky=240,Xo=1,IT=720*60*60*1e3;function Ly(){const a=Mi("local",pt.rendererProbe);if(!a)return{v:Xo,ua:{}};try{const i=JSON.parse(a);return typeof i=="object"&&i!==null&&i.v===Xo&&typeof i.ua=="object"&&i.ua!==null?i:{v:Xo,ua:{}}}catch{return{v:Xo,ua:{}}}}function FT(a,i=Date.now()){const l=Ly();l.ua[a]={failedAt:i},wn("local",pt.rendererProbe,JSON.stringify(l))}function GT(a,i=Date.now()){const l=typeof navigator<"u"?navigator.userAgent:"";if(!l)return!1;const r=Ly().ua[l];return!(!r||typeof r.failedAt!="number"||i-r.failedAt>IT)}function Fg(a,i=Date.now()){const l=typeof navigator<"u"?navigator.userAgent:"";l&&FT(l,i)}function YT(a){if(a.length<4)return!0;const i=a[0],l=a[1],o=a[2],r=a[3];for(let u=4;u<a.length;u+=4)if(a[u]!==i||a[u+1]!==l||a[u+2]!==o||a[u+3]!==r)return!1;return!0}function $T(a){if(!a||a.width<=0||a.height<=0)return console.debug("Canvas probe inconclusive: text layer canvas missing or zero dimensions"),"inconclusive";let i=null;try{i=a.getContext("2d",{willReadFrequently:!0})||a.getContext("2d")}catch(r){return console.debug("Canvas probe inconclusive: failed to acquire 2D context:",r),"inconclusive"}if(!i)return console.debug("Canvas probe inconclusive: 2D context is null"),"inconclusive";const l=Math.min(a.width,Ny),o=Math.min(a.height,ky);if(l<=0||o<=0)return console.debug("Canvas probe inconclusive: calculated sample dimensions are zero"),"inconclusive";try{const r=i.getImageData(0,0,l,o);return YT(r.data)?"blank":"healthy"}catch(r){return console.debug("Canvas probe inconclusive: getImageData threw exception:",r),"inconclusive"}}function Gg(a=2){return new Promise(i=>{if(typeof requestAnimationFrame!="function"){setTimeout(i,32);return}let l=a;const o=()=>{l--,l<=0?i():requestAnimationFrame(o)};requestAnimationFrame(o)})}const Xu={kind:"dom",canvas:null,dispose:()=>{},verify:async()=>{}};function qT(a,i={}){if(GT())return Xu;let l;try{l=Dd.install(a,{isSynchronizing:i.isSynchronizing})}catch(m){return console.debug("Canvas renderer unavailable, using the DOM renderer:",m),Fg(),Xu}if(!l)return Xu;let o=l,r=null;const u=()=>{var p;if(!o)return;Fg();const m=o;o=null;try{m.uninstall()}catch{}(p=i.onRendererSwapped)==null||p.call(i,"dom")};return{get kind(){return o?"canvas":"dom"},get canvas(){return o},dispose:()=>{const m=o;o=null;try{m==null||m.dispose()}catch{}},verify:async()=>{if(o)return r||(r=(async()=>{try{const m=o.stats.frames;await Gg(2);for(let g=0;g<KT&&o&&o.stats.frames===m;g++)await Gg(1);if(!o)return;const p=$T(o.textCanvas);p==="blank"&&o.hasPaintedInk(Ny,ky)?u():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{r=null}})(),r)}}}function VT(a,i,l){a.writeln(" ___ ___ .___ "),a.writeln(` / | \\ ____ _______| _/______ \x1B[1m${i}\x1B[0m`),a.writeln(`/ ~ \\/ __ \\\\_ __ \\ __/ ___/ \x1B[2m${l}\x1B[0m`),a.writeln("\\ Y / ___/ | | \\/|_ \\___ \\ "),a.writeln(" \\___|_ / \\___ >|__| /___/____ >"),a.writeln(" \\/ \\/ \\/ "),a.writeln("")}var PT=sx(),Qu={exports:{}},Yg;function XT(){return Yg||(Yg=1,(function(a,i){(function(l,o){a.exports=o()})(self,(()=>(()=>{var l={6:(h,m)=>{function p(b){try{const v=new URL(b),w=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 b.toLocaleLowerCase().startsWith(w.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(m,"__esModule",{value:!0}),m.LinkComputer=m.WebLinkProvider=void 0,m.WebLinkProvider=class{constructor(b,v,w,x={}){this._terminal=b,this._regex=v,this._handler=w,this._options=x}provideLinks(b,v){const w=g.computeLink(b,this._regex,this._terminal,this._handler);v(this._addCallbacks(w))}_addCallbacks(b){return b.map((v=>(v.leave=this._options.leave,v.hover=(w,x)=>{if(this._options.hover){const{range:T}=v;this._options.hover(w,x,T)}},v)))}};class g{static computeLink(v,w,x,T){const M=new RegExp(w.source,(w.flags||"")+"g"),[A,N]=g._getWindowedLineStrings(v-1,x),R=A.join("");let j;const V=[];for(;j=M.exec(R);){const _=j[0];if(!p(_))continue;const[D,L]=g._mapStrIdx(x,N,0,j.index),[z,U]=g._mapStrIdx(x,D,L,_.length);if(D===-1||L===-1||z===-1||U===-1)continue;const ee={start:{x:L+1,y:D+1},end:{x:U,y:z+1}};V.push({range:ee,text:_,activate:T})}return V}static _getWindowedLineStrings(v,w){let x,T=v,M=v,A=0,N="";const R=[];if(x=w.buffer.active.getLine(v)){const j=x.translateToString(!0);if(x.isWrapped&&j[0]!==" "){for(A=0;(x=w.buffer.active.getLine(--T))&&A<2048&&(N=x.translateToString(!0),A+=N.length,R.push(N),x.isWrapped&&N.indexOf(" ")===-1););R.reverse()}for(R.push(j),A=0;(x=w.buffer.active.getLine(++M))&&x.isWrapped&&A<2048&&(N=x.translateToString(!0),A+=N.length,R.push(N),N.indexOf(" ")===-1););}return[R,T]}static _mapStrIdx(v,w,x,T){const M=v.buffer.active,A=M.getNullCell();let N=x;for(;T;){const R=M.getLine(w);if(!R)return[-1,-1];for(let j=N;j<R.length;++j){R.getCell(j,A);const V=A.getChars();if(A.getWidth()&&(T-=V.length||1,j===R.length-1&&V==="")){const _=M.getLine(w+1);_&&_.isWrapped&&(_.getCell(0,A),A.getWidth()===2&&(T+=1))}if(T<0)return[w,j]}w++,N=0}return[w,N]}}m.LinkComputer=g}},o={};function r(h){var m=o[h];if(m!==void 0)return m.exports;var p=o[h]={exports:{}};return l[h](p,p.exports,r),p.exports}var u={};return(()=>{var h=u;Object.defineProperty(h,"__esModule",{value:!0}),h.WebLinksAddon=void 0;const m=r(6),p=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function g(b,v){const w=window.open();if(w){try{w.opener=null}catch{}w.location.href=v}else console.warn("Opening link blocked as opener could not be cleared")}h.WebLinksAddon=class{constructor(b=g,v={}){this._handler=b,this._options=v}activate(b){this._terminal=b;const v=this._options,w=v.urlRegex||p;this._linkProvider=this._terminal.registerLinkProvider(new m.WebLinkProvider(this._terminal,w,this._handler,v))}dispose(){var b;(b=this._linkProvider)==null||b.dispose()}}})(),u})()))})(Qu)),Qu.exports}var QT=XT(),ZT=ox();function WT({fontSize:a,fontFamily:i,theme:l,cols:o,rows:r}){const u=new ZT.Terminal({fontSize:a,fontFamily:i,lineHeight:1.15,...l?{theme:{...l}}:{},allowProposedApi:!0,convertEol:!0,scrollback:5e3,cols:o,rows:r,screenReaderMode:!1,linkHandler:{activate:(h,m)=>{md(m)}}});try{const h=new PT.Unicode11Addon;u.loadAddon(h),u.unicode.activeVersion="11"}catch(h){console.debug("Unicode11 addon unavailable, using default width table:",h)}try{u.loadAddon(new QT.WebLinksAddon((h,m)=>{md(m)}))}catch(h){console.debug("WebLinks addon unavailable, URLs stay plain text:",h)}return u}function as(a){var i,l;if(!a)return!1;try{const o=a.modes;if(o&&typeof o.mouseTrackingMode=="string"&&o.mouseTrackingMode!=="none")return!0;const r=a._core;if((i=r==null?void 0:r._coreMouseService)!=null&&i.areMouseEventsActive||(l=r==null?void 0:r.coreMouseService)!=null&&l.areMouseEventsActive||r!=null&&r.mouseMode&&r.mouseMode!=="none")return!0}catch{}return!1}function JT(a,i){const l=i.button??0,o=i.buttons??(a==="mouseup"?0:1);return new MouseEvent(a,{bubbles:!0,cancelable:!0,clientX:i.clientX,clientY:i.clientY,screenX:i.clientX,screenY:i.clientY,button:l,buttons:o})}function Ry(a,i,l){const o=JT(i,l);return a.dispatchEvent(o)}function _y(a){var i;try{return((i=a.buffer)==null?void 0:i.active)||null}catch{return null}}function Zu(a){var l;const i=(l=_y(a))==null?void 0:l.viewportY;return typeof i=="number"&&Number.isFinite(i)?i:null}function e5(a){var i;try{(i=a.blur)==null||i.call(a)}catch{}}function $g(a){var l,o;const i=a;return i.coreMouseService||((l=i._core)==null?void 0:l.coreMouseService)||((o=i._core)==null?void 0:o._coreMouseService)||null}function t5(a){var l;const i=a;return i.coreService||((l=i._core)==null?void 0:l.coreService)||null}class n5{constructor(i){this.options=i}getLogicalCoordinates(i,l){const o=this.options.getScale?this.options.getScale():1,r=this.options.getSurfaceElement?this.options.getSurfaceElement():null;if(o!==1&&r&&typeof r.getBoundingClientRect=="function"){const u=r.getBoundingClientRect();return Sy(i,l,u,o)}return{clientX:i,clientY:l}}getViewportElement(i){var r;const l=this.options.getSurfaceElement?this.options.getSurfaceElement():null;return(l==null?void 0:l.querySelector(".xterm-viewport"))||((r=i.element)==null?void 0:r.querySelector(".xterm-viewport"))||null}isInputLineHit(i,l){var R;const o=(R=l.buffer)==null?void 0:R.active,r=this.options.getSurfaceElement?this.options.getSurfaceElement():null,u=(r==null?void 0:r.querySelector(".xterm-screen"))||l.element||r,h=ia(l);if(!u||typeof u.getBoundingClientRect!="function"||h.cellHeight<=0)return!1;const m=u.getBoundingClientRect(),p=this.getLogicalCoordinates(i.clientX,i.clientY),g=m.width>0&&m.height>0;if(![o==null?void 0:o.cursorY,o==null?void 0:o.viewportY,o==null?void 0:o.baseY].every(j=>typeof j=="number"&&Number.isFinite(j)))return!1;const v=o==null?void 0:o.cursorY,w=o==null?void 0:o.viewportY,T=(o==null?void 0:o.baseY)+v-w,M=m.top+T*h.cellHeight,A=M+h.cellHeight,N=Number(l.rows);return T>=0&&(!Number.isFinite(N)||T<N)&&p.clientY>=M-2&&p.clientY<=A+2&&(!g||p.clientX>=m.left&&p.clientX<=m.right)}resolveDispatchTarget(i,l){var m;const o=this.options.getSurfaceElement?this.options.getSurfaceElement():null,r=(o==null?void 0:o.querySelector(".xterm-screen"))||l.querySelector(".xterm-screen")||null,u=((m=r==null?void 0:r.closest)==null?void 0:m.call(r,".xterm"))||null;let h=null;return typeof document<"u"&&typeof document.elementFromPoint=="function"&&(h=document.elementFromPoint(i.clientX,i.clientY)),h&&u&&(h===u||u.contains(h))?h:r||o||l}getMouseReport(i,l){const o=this.options.getSurfaceElement?this.options.getSurfaceElement():null,r=(o==null?void 0:o.querySelector(".xterm-screen"))||l.element;if(!r||typeof r.getBoundingClientRect!="function")return null;const u=r.getBoundingClientRect(),h=this.getLogicalCoordinates(i.clientX,i.clientY),m=ia(l);if(m.cellWidth<=0||m.cellHeight<=0)return null;const p=Math.max(1,u.width||l.cols*m.cellWidth),g=Math.max(1,u.height||l.rows*m.cellHeight),b=Math.max(0,Math.min(p-1,h.clientX-u.left)),v=Math.max(0,Math.min(g-1,h.clientY-u.top)),w=Math.max(0,Math.min(l.cols-1,Math.floor(b/m.cellWidth))),x=Math.max(0,Math.min(l.rows-1,Math.floor(v/m.cellHeight)));return{col:w,row:x,x:Math.floor(b),y:Math.floor(v),button:0,action:0}}getWheelDispatchTarget(i){const l=this.options.getSurfaceElement?this.options.getSurfaceElement():null;return(l==null?void 0:l.querySelector(".xterm"))||i.element||null}dispatchWheel(i,l,o,r){const u=this.getWheelDispatchTarget(o);if(!u||typeof WheelEvent>"u"||l===0)return!1;const h=this.getLogicalCoordinates(i.clientX,i.clientY),m=l<0?-1:1;let p=0;for(let g=0;g<Math.abs(l);g+=1)try{const b=new WheelEvent("wheel",{bubbles:!0,cancelable:!0,clientX:h.clientX,clientY:h.clientY,deltaX:0,deltaY:m,deltaMode:1,ctrlKey:!!(r!=null&&r.ctrlKey),altKey:!!(r!=null&&r.altKey),shiftKey:!!(r!=null&&r.shiftKey)});u.dispatchEvent(b),p+=1}catch{return p>0}return p>0}emitWheel(i,l,o,r){if(l===0)return!1;if(this.dispatchWheel(i,l,o,r))return!0;const u=$g(o);if(!(u!=null&&u.triggerMouseEvent))return!1;let h=0;for(let m=0;m<Math.abs(l);m+=1){const p=this.getMouseReport(i,o);p&&(p.button=4,p.action=l<0?0:1,p.ctrl=!!(r!=null&&r.ctrlKey),p.alt=!!(r!=null&&r.altKey),p.shift=!!(r!=null&&r.shiftKey),u.triggerMouseEvent(p)&&(h+=1))}return h>0}scrollAlternateBuffer(i,l,o,r){var h;if(l===0)return"none";const u=as(o);if(!u&&!this.options.getIsController())return"none";if(this.emitWheel(i,l,o,r))return u?"application-mouse":"application-keys";if(!u){const m=t5(o);if(!(m!=null&&m.triggerDataEvent))return"none";const g=`\x1B${!!((h=m.decPrivateModes)!=null&&h.applicationCursorKeys)?"O":"["}${l<0?"A":"B"}`;return m.triggerDataEvent(g.repeat(Math.abs(l)),!0),"application-keys"}return"none"}emitMouse(i,l,o,r){const u=this.options.getTerminal();if(!u)return;const h=$g(u);if(h!=null&&h.triggerMouseEvent){const p=this.getMouseReport(l,u);p&&(p.action=i==="mousedown"?1:i==="mouseup"?0:32,p.ctrl=!!(o!=null&&o.ctrlKey),p.alt=!!(o!=null&&o.altKey),p.shift=!!(o!=null&&o.shiftKey),h.triggerMouseEvent(p));return}if(this.options.allowSyntheticMouseFallback===!1||!r)return;const m=this.getLogicalCoordinates(l.clientX,l.clientY);Ry(r,i,{clientX:m.clientX,clientY:m.clientY,button:0,buttons:i==="mouseup"?0:1})}}class i5{constructor(i){W(this,"options");W(this,"state","idle");W(this,"startX",0);W(this,"startY",0);W(this,"lastX",0);W(this,"lastY",0);W(this,"activeTarget",null);W(this,"longPressTimer",null);W(this,"capturedPointerId",null);W(this,"captureElement",null);W(this,"scrollRemainderY",0);W(this,"delivery");this.options={longPressDelayMs:500,dragThresholdPx:8,scrollLineHeightPx:18,...i},this.delivery=new n5(this.options)}getState(){return this.state}setGestureState(i){var l,o;this.state!==i&&(this.state=i,(o=(l=this.options).onGestureStateChange)==null||o.call(l,i))}beginGesture(i,l){this.startX=i.clientX,this.startY=i.clientY,this.lastX=i.clientX,this.lastY=i.clientY,this.setGestureState("pending"),this.scrollRemainderY=0,this.activeTarget=this.delivery.resolveDispatchTarget(i,l),this.clearLongPressTimer(),this.longPressTimer=setTimeout(()=>{var o,r;this.state==="pending"&&(this.setGestureState("longpress"),(r=(o=this.options).onLongPress)==null||r.call(o,{clientX:this.startX,clientY:this.startY}))},this.options.longPressDelayMs)}moveGesture(i,l){var g,b,v,w;if(this.state==="longpress"){(b=(g=this.options).onSelectionExtend)==null||b.call(g,{clientX:i.clientX,clientY:i.clientY}),l!=null&&l.cancelable&&((v=l.preventDefault)==null||v.call(l));return}if(this.state==="idle")return;const o=i.clientX-this.startX,r=i.clientY-this.startY,u=Math.hypot(o,r);if(this.state==="scrolling"){this.scrollGesture(i,l);return}const h=this.options.getTerminal(),m=this.options.getIsController(),p=as(h);if(!(u<=(this.options.dragThresholdPx||8))){if(this.clearLongPressTimer(),Math.abs(r)>=Math.abs(o)||!p||!m){this.setGestureState("scrolling"),h&&e5(h),this.lastX=i.clientX,this.lastY=this.startY,this.scrollRemainderY=0,this.scrollGesture(i,l);return}if(p&&m){this.state==="pending"&&(this.setGestureState("dragging"),this.delivery.emitMouse("mousedown",{clientX:this.startX,clientY:this.startY},l,this.activeTarget)),this.state==="dragging"&&(this.lastX=i.clientX,this.lastY=i.clientY,this.delivery.emitMouse("mousemove",i,l,this.activeTarget),l!=null&&l.cancelable&&((w=l.preventDefault)==null||w.call(l)));return}this.lastX=i.clientX,this.lastY=i.clientY}}scrollGesture(i,l){var T,M,A;const o=this.options.getTerminal();if(!o)return;const r=i.clientY-this.lastY;this.lastX=i.clientX,this.lastY=i.clientY;const u=ia(o),h=u.measured?u.cellHeight:this.options.scrollLineHeightPx||u.cellHeight||18;this.scrollRemainderY+=r;const m=Math.trunc(this.scrollRemainderY/h),p=-m;let g=!1,b="none";const v=_y(o),w=as(o);if(p!==0){if((v==null?void 0:v.type)==="alternate")b=this.delivery.scrollAlternateBuffer(i,p,o,l),g=b!=="none";else{const N=Zu(o);o.scrollLines(p);const R=Zu(o);b="buffer",g=N===null||R===null||N!==R}this.scrollRemainderY-=m*h}const x=this.delivery.getViewportElement(o);(M=(T=this.options).onGestureScroll)==null||M.call(T,{deltaY:r,lines:p,viewportY:Zu(o),scrollTop:(x==null?void 0:x.scrollTop)??null,scrollHeight:(x==null?void 0:x.scrollHeight)??null,clientHeight:(x==null?void 0:x.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:w,scrollMode:b}),l!=null&&l.cancelable&&((A=l.preventDefault)==null||A.call(l))}endGesture(i,l){var h,m,p;this.clearLongPressTimer();const o=this.options.getTerminal(),r=this.options.getIsController(),u=as(o);if(this.state==="pending"){if(u&&r){const b={clientX:this.startX,clientY:this.startY};this.delivery.emitMouse("mousedown",b,l,this.activeTarget),this.delivery.emitMouse("mouseup",b,l,this.activeTarget)}const g={clientX:this.startX,clientY:this.startY};r&&o&&this.delivery.isInputLineHit(g,o)&&((m=(h=this.options).onFocus)==null||m.call(h))}else if(this.state==="dragging"&&u&&r){const g=i??{clientX:this.lastX,clientY:this.lastY};this.delivery.emitMouse("mouseup",g,l,this.activeTarget),l!=null&&l.cancelable&&((p=l.preventDefault)==null||p.call(l))}this.reset()}handlePointerDown(i,l){if(i.pointerType==="mouse")return!1;if(!i.isPrimary)return this.releasePointerCapture(),this.reset(),!1;if(i.cancelable&&i.preventDefault(),this.beginGesture(i,l),i.pointerType!=="touch")try{typeof l.setPointerCapture=="function"&&(l.setPointerCapture(i.pointerId),this.capturedPointerId=i.pointerId,this.captureElement=l)}catch{}return!0}handlePointerMove(i){i.pointerType==="mouse"||this.state==="idle"||this.moveGesture(i,i)}handlePointerUp(i){i.pointerType==="mouse"||this.state==="idle"||(this.releasePointerCapture(),this.endGesture(i,i))}handlePointerCancel(i){i&&i.pointerType==="mouse"||(this.releasePointerCapture(),this.cancelGesture())}handleTouchStart(i,l){if(i.touches.length!==1){this.reset();return}i.cancelable&&i.preventDefault(),this.beginGesture(i.touches[0],l)}handleTouchMove(i){i.touches.length===1&&this.moveGesture(i.touches[0],i)}handleTouchEnd(i){i.cancelable&&i.preventDefault(),this.endGesture(null,i)}handleTouchCancel(){this.cancelGesture()}cancelGesture(){this.clearLongPressTimer();const i=this.options.getTerminal(),l=this.options.getIsController(),o=as(i);if(this.state==="dragging"&&o&&l&&this.activeTarget){const r=this.delivery.getLogicalCoordinates(this.lastX,this.lastY);Ry(this.activeTarget,"mouseup",{clientX:r.clientX,clientY:r.clientY,button:0,buttons:0})}this.reset()}releasePointerCapture(){const i=this.captureElement,l=this.capturedPointerId;if(this.captureElement=null,this.capturedPointerId=null,!(!i||l===null))try{typeof i.releasePointerCapture=="function"&&(typeof i.hasPointerCapture!="function"||i.hasPointerCapture(l))&&i.releasePointerCapture(l)}catch{}}clearLongPressTimer(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressTimer=null)}reset(){this.clearLongPressTimer(),this.releasePointerCapture(),this.setGestureState("idle"),this.activeTarget=null}}function a5({container:a,term:i,isTouchDevice:l,debug:o,getTerminal:r,getIsController:u,getScale:h,getSurfaceElement:m,getSelection:p,onFocus:g}){const b=new i5({getTerminal:r,getIsController:u,getScale:h,getSurfaceElement:m,allowSyntheticMouseFallback:!1,onFocus:()=>{try{i.focus()}catch{}o==null||o(_=>({..._,focused:document.activeElement===i.textarea})),g()},onGestureStateChange:_=>{o==null||o(D=>({...D,state:_}))},onGestureScroll:({deltaY:_,lines:D,viewportY:L,scrollTop:z,scrollHeight:U,clientHeight:ee,moved:q,bufferType:P,baseY:ie,cursorY:ae,hasScrollback:F,mouseTracking:E,scrollMode:Y})=>{o==null||o(X=>({...X,deltaY:_,lines:D,viewportY:L,scrollTop:z,scrollHeight:U,clientHeight:ee,moved:q,focused:document.activeElement===i.textarea,bufferType:P,baseY:ie,cursorY:ae,hasScrollback:F,mouseTracking:E,scrollMode:Y,scrollCalls:X.scrollCalls+(D!==0?1:0),lastScrollLines:D}))},longPressDelayMs:500,dragThresholdPx:8,scrollLineHeightPx:18,onLongPress:l?_=>p().handleLongPress(_):void 0,onSelectionExtend:l?_=>p().handleSelectionExtend(_):void 0}),v=typeof window<"u"&&"PointerEvent"in window,w=typeof TouchEvent<"u",x=[],T={passive:!1,capture:!0},M=(_,D)=>{document.addEventListener(_,D,T),x.push(()=>document.removeEventListener(_,D,T))},A=(_,D=!1)=>{const L=_.target;return L instanceof Node&&a.contains(L)||D&&b.getState()!=="idle"},N=(_,D)=>{o==null||o(L=>({...L,[_]:L[_]+1,lastInputEvent:D}))},R=_=>{const D=p();return D.hasOpenMenu()?(D.clearSelection(),_.cancelable&&_.preventDefault(),_.stopPropagation(),!0):!1},j=()=>{b.getState()==="longpress"&&p().openMenuAtGesture()};if(v){if(M("pointerdown",_=>{if(!A(_)||(N("pointerEvents","pointerdown"),R(_)))return;b.handlePointerDown(_,a)&&_.stopPropagation()}),M("pointermove",_=>{A(_,!0)&&(N("pointerEvents","pointermove"),b.handlePointerMove(_),_.pointerType!=="mouse"&&_.stopPropagation())}),M("pointerup",_=>{A(_,!0)&&(N("pointerEvents","pointerup"),j(),b.handlePointerUp(_),_.pointerType!=="mouse"&&_.stopPropagation())}),M("pointercancel",_=>{A(_,!0)&&(N("pointerEvents","pointercancel"),p().clearSelection(),b.handlePointerCancel(_),_.pointerType!=="mouse"&&_.stopPropagation())}),w){const _=D=>{A(D,!0)&&(o==null||o(L=>({...L,touchEvents:L.touchEvents+1})),D.cancelable&&D.preventDefault(),D.stopPropagation())};for(const D of["touchstart","touchmove","touchend","touchcancel"])M(D,_)}}else M("touchstart",_=>{A(_)&&(N("touchEvents","touchstart"),!R(_)&&(_.touches.length===1&&_.stopPropagation(),b.handleTouchStart(_,a)))}),M("touchmove",_=>{A(_,!0)&&(N("touchEvents","touchmove"),_.touches.length===1&&_.stopPropagation(),b.handleTouchMove(_))}),M("touchend",_=>{A(_,!0)&&(N("touchEvents","touchend"),j(),_.stopPropagation(),b.handleTouchEnd(_))}),M("touchcancel",_=>{A(_,!0)&&(N("touchEvents","touchcancel"),p().clearSelection(),_.stopPropagation(),b.handleTouchCancel())});const V=_=>{_.preventDefault()};return a.addEventListener("contextmenu",V),x.push(()=>a.removeEventListener("contextmenu",V)),()=>{b.handlePointerCancel();for(const _ of x)_()}}function l5(a,{requestFit:i,onPageVisible:l}){const o=new ResizeObserver(()=>{i()});o.observe(a);const r=()=>{i()},u=()=>{document.visibilityState==="visible"&&l()};window.addEventListener("resize",r),window.addEventListener("orientationchange",r),document.addEventListener("visibilitychange",u),window.addEventListener("pageshow",u);const h=()=>{i()};return typeof window<"u"&&window.visualViewport&&(window.visualViewport.addEventListener("resize",h),window.visualViewport.addEventListener("scroll",h)),()=>{o.disconnect(),window.removeEventListener("resize",r),window.removeEventListener("orientationchange",r),document.removeEventListener("visibilitychange",u),window.removeEventListener("pageshow",u),typeof window<"u"&&window.visualViewport&&(window.visualViewport.removeEventListener("resize",h),window.visualViewport.removeEventListener("scroll",h))}}function Wi(a){if(a)try{a.refresh(0,Math.max(0,a.rows-1))}catch{}}function s5({containerRef:a,surfaceRef:i,termRef:l,rendererRef:o,currentScaleRef:r,initialBannerWrittenRef:u,live:h,selection:m,prediction:p,fit:g,isTouchDevice:b,debug:v,terminalFontSize:w,terminalFontFamily:x,hostTheme:T,glyphRevision:M,terminalResetVersion:A,isActive:N,subscribeToOutput:R,onOutput:j,onTitle:V,onRendererKind:_}){const{requestFit:D,scheduleBoundedFit:L,seedFit:z,cancelPendingFits:U}=g;C.useEffect(()=>{var Be;if(!a.current||!i.current)return;const q=a.current,P=bd(q,Za(),ed()),ie=ia(null,nl),ae=wy({width:P.width,height:P.height,cellWidth:ie.cellWidth,cellHeight:ie.cellHeight});h.current.sendResize(ae.cols,ae.rows),z(P);const F=WT({fontSize:Pp(w,P.width),fontFamily:x,theme:h.current.hostTheme,cols:ae.cols,rows:ae.rows});F.open(i.current),l.current=F;const E=F.onTitleChange(ce=>{V(hd(ce)||null)}),{screenState:Y,fieldProbe:X,overlay:le}=p.attach(F);b&&F.textarea&&(F.textarea.readOnly=!1,F.textarea.tabIndex=0,F.textarea.inputMode="text");let Q=()=>{};if(v&&F.textarea){const ce=()=>{v(Ae=>({...Ae,focused:document.activeElement===F.textarea}))};F.textarea.addEventListener("focus",ce),F.textarea.addEventListener("blur",ce),Q=()=>{var Ae,Pe;(Ae=F.textarea)==null||Ae.removeEventListener("focus",ce),(Pe=F.textarea)==null||Pe.removeEventListener("blur",ce)},ce()}const ve=async ce=>{p.discard("paste");const Ae=cy(ce);if(Ae){if(ce.preventDefault(),ce.stopPropagation(),!h.current.isController){h.current.warnViewerMode();return}await h.current.uploadImage(Ae)}};(Be=F.textarea)==null||Be.addEventListener("paste",ve),q.addEventListener("paste",ve);const ye=qT(F,{isSynchronizing:Y.isSynchronizing,onRendererSwapped:ce=>{var Ae;q.dataset.renderer=ce,_(ce),(Ae=p.overlayRef.current)==null||Ae.attach(null),Wi(F)}});le.attach(ye.canvas);const xe=Y.onSyncEnd(()=>{var ce,Ae;return(Ae=(ce=o.current)==null?void 0:ce.canvas)==null?void 0:Ae.flushHeld()});if(o.current=ye,q.dataset.renderer=ye.kind,_(ye.kind),VT(F,h.current.t("terminal.bannerTitle"),h.current.t("terminal.bannerSubtitle")),u.current=!0,F.write("",()=>void ye.verify()),!b)try{F.focus()}catch{}const me=typeof document<"u"?document.fonts:void 0;typeof(me==null?void 0:me.load)=="function"&&me.load('13px "Symbols Nerd Font Mono"').then(()=>{l.current&&(Wi(l.current),L(5))}).catch(()=>{});const de=F.onData(ce=>{const{isController:Ae}=h.current;let Pe=ce;if(Ae&&by(ce)==="keys"&&vx(ce)){const Nt=h.current.consumeModifierLatch();Nt&&(Pe=tr(ce,Nt))}const wt=Sd(Pe);if(!Ae&&!ar(wt)){h.current.warnViewerMode();return}p.onUserInput(wt),h.current.sendBinary(wt)}),we=F.onBinary(ce=>{const Ae=new Uint8Array(ce.length);for(let Pe=0;Pe<ce.length;Pe++)Ae[Pe]=ce.charCodeAt(Pe)&255;!h.current.isController&&!ar(Ae)||h.current.sendBinary(Ae)}),oe=typeof F.onWriteParsed=="function"?F.onWriteParsed(()=>{var ce;m.current.onTerminalContentChanged(),X.invalidate(),!Y.isSynchronizing()&&((ce=p.predictorRef.current)==null||ce.onServerOutput(),p.sync())}):{dispose:()=>{}},Se=typeof F.onRender=="function"?F.onRender(ce=>{var Ae;if(h.current.glyphScan){const Pe=F.buffer.active.viewportY??0;let wt="";for(let Nt=ce.start;Nt<=ce.end;Nt+=1)wt+=((Ae=F.buffer.active.getLine(Pe+Nt))==null?void 0:Ae.translateToString(!0))??"";/[^\x00-\x7f]/.test(wt)&&h.current.ensureHostGlyphs(wt)}m.current.onTerminalRender(F,ce.start,ce.end)}):{dispose:()=>{}},se=typeof F.onScroll=="function"?F.onScroll(()=>{m.current.onTerminalScroll(F),p.discard("scroll")}):{dispose:()=>{}},pe=a5({container:q,term:F,isTouchDevice:b,debug:v,getTerminal:()=>l.current,getIsController:()=>h.current.isController,getScale:()=>r.current,getSurfaceElement:()=>i.current,getSelection:()=>m.current,onFocus:()=>{var ce,Ae;return(Ae=(ce=h.current).onTerminalFocus)==null?void 0:Ae.call(ce)}}),Ee=l5(q,{requestFit:D,onPageVisible:()=>{L(10),Wi(l.current)}});return()=>{var ce;de.dispose(),we.dispose(),Se.dispose(),se.dispose(),oe.dispose(),E.dispose(),xe.dispose(),p.detach(),Y.dispose(),pe(),Ee(),U(),Q(),(ce=F.textarea)==null||ce.removeEventListener("paste",ve),q.removeEventListener("paste",ve),ye.dispose(),o.current=null,F.dispose(),l.current=null}},[]),C.useEffect(()=>{const q=l.current;if(!q)return;const P=bd(a.current,Za(),ed());q.options.fontSize=Pp(w,P.width),q.options.fontFamily=x,Wi(q),L(10)},[w,x]),C.useEffect(()=>{var P,ie;const q=l.current;!q||!M||((ie=(P=o.current)==null?void 0:P.canvas)==null||ie.clearTextureAtlas(),Wi(q))},[M]);const ee=C.useRef(A);C.useEffect(()=>{var P;if(ee.current===A)return;ee.current=A,p.forget("resetVersion");const q=l.current;if(q)try{(P=q.reset)==null||P.call(q),q.clear(),q.refresh(0,Math.max(0,q.rows-1))}catch{}},[A]),C.useEffect(()=>{const q=l.current;!q||!T||(q.options.theme={...T},Wi(q))},[T]),C.useEffect(()=>R(P=>{const ie=l.current;if(!ie)throw new Error("terminal not ready");ie.write(P),j==null||j(P.byteLength)}),[R,l,j]),C.useEffect(()=>{if(!N)return;L(10);const q=l.current;if(q&&(Wi(q),!b))try{q.focus()}catch{}},[N,b,L,l])}const o5=({onTerminalFocus:a,isActive:i=!0})=>{var Pn;const l=C.useRef(null),o=C.useRef(null),r=C.useRef(null),u=C.useRef(null),h=C.useRef(null),m=C.useRef(1),p=C.useRef(null),g=C.useRef(!1),b=Hx(),v=b||typeof navigator<"u"&&navigator.maxTouchPoints>0||typeof window<"u"&&"ontouchstart"in window,w=KS(),[x,T]=C.useState(US),{metrics:M,record:A}=IS(w),[N,R]=C.useState(null),{settings:j,terminalFontFamily:V,terminalFontSize:_,hostFont:D,ensureHostGlyphs:L,profiles:z,activeProfileId:U,t:ee}=Le(),{isController:q,connectionState:P,hostPalette:ie,terminalResetVersion:ae,agentStatus:F,connect:E,rttMs:Y}=et(),{addToast:X}=on(),{sendResize:le,sendBinary:Q,observeKeyInput:ve,consumeModifierLatch:ye,warnViewerMode:xe,subscribeToOutput:me,subscribeToPasteFileReady:de}=hs(),{uploadImage:we}=ur(),oe=qn.useMemo(()=>Vx(ie),[ie]),Se=$n({isController:q,sendBinary:Q,sendResize:le,warnViewerMode:xe,uploadImage:we,t:ee,consumeModifierLatch:ye,hostTheme:oe,onTerminalFocus:a,ensureHostGlyphs:L,glyphScan:D.glyphs.status==="ready"}),se=$n(i),pe=$C({termRef:h,rendererRef:p,mode:j.predictiveEcho,connectionState:P,observeKeyInput:ve}),[Ee,Be]=C.useState(null),ce=rT({termRef:h,surfaceRef:r,mainRef:u,currentScaleRef:m,addToast:X,t:ee}),Ae=$n(ce),Pe=qS({termRef:h,isController:q,warnViewerMode:xe,uploadImage:we,addToast:X,t:ee,onPaste:()=>pe.discard("paste"),subscribeToPasteFileReady:de}),wt=JC({termRef:h,containerRef:l,frameRef:o,surfaceRef:r,currentScaleRef:m,rendererRef:p,initialBannerWrittenRef:g,isActiveRef:se,sendResize:le,onResized:()=>pe.forget("resize")});s5({containerRef:l,surfaceRef:r,termRef:h,rendererRef:p,currentScaleRef:m,initialBannerWrittenRef:g,live:Se,selection:Ae,prediction:pe,fit:wt,isTouchDevice:b,debug:w?T:null,terminalFontSize:_,terminalFontFamily:V,hostTheme:oe,glyphRevision:D.glyphRevision,terminalResetVersion:ae,isActive:i,subscribeToOutput:me,onOutput:w?A:null,onTitle:Be,onRendererKind:R});const Nt=qn.useMemo(()=>{var kt;return((kt=z.find(Sn=>Sn.id===U))==null?void 0:kt.displayName)??null},[z,U]);C.useEffect(()=>{P!=="connected"&&Be(null)},[P]),C.useEffect(()=>{const kt=i&&P==="connected",Sn=j.agentAlertBadge?cs(F):null;AS(kt?Ee:null,Nt,Sn)},[i,P,Ee,Nt,F,j.agentAlertBadge]),C.useEffect(()=>{P==="disconnected"&&E()},[]);const Vn=kt=>{kt.preventDefault()};return f.jsxs("main",{ref:u,className:"flex-1 w-full min-w-0 min-h-0 overflow-hidden relative flex flex-col",onContextMenu:Vn,"aria-label":ee("terminal.windowAriaLabel"),children:[f.jsx("div",{id:"terminal-container",ref:l,className:"absolute inset-0 overflow-hidden cursor-text",style:{touchAction:v?"none":"auto"},tabIndex:0,onContextMenu:Vn,"aria-label":ee("terminal.bufferAriaLabel"),role:"region",children:f.jsx("div",{id:"terminal-frame",ref:o,className:"relative overflow-hidden",style:{width:"100%",height:"100%"},children:f.jsx("div",{id:"terminal-surface",ref:r,className:"absolute top-0 left-0",style:{transformOrigin:"top left",width:"100%",height:"100%"}})})}),w&&f.jsx($S,{debug:x,rttMs:Y,metrics:M,rendererKind:N,predictiveEcho:j.predictiveEcho,predictor:pe.predictorRef.current,field:((Pn=pe.fieldProbeRef.current)==null?void 0:Pn.detect())??null,renderer:p.current}),b&&ce.selectionRect&&ce.isHighlightVisible&&f.jsx(cT,{term:h.current,surface:r.current,main:u.current,rect:ce.selectionRect,viewportY:ce.viewportY}),b&&ce.selectionMenu&&f.jsx(BS,{anchorPoint:ce.selectionMenu,hasSelection:!!ce.selectionSnapshot,isController:q,vibrateOnKeyPress:j.vibrateOnKeyPress,linkUrl:ce.selectionMenu.link??null,onOpenLink:kt=>{md(kt)||X("warning",ee("clipboard.openLinkFailed"))},onCopySelection:ce.handleCopySelection,onCopyLine:ce.handleCopyLine,onCopyScreen:ce.handleCopyScreen,onPaste:Pe.handlePaste,onClose:ce.clearSelection}),b&&f.jsx(HS,{isOpen:Pe.isPasteFallbackOpen,onClose:Pe.closePasteFallback,onSend:Pe.handleFallbackPasteSend,onSendImage:Pe.handleFallbackImageSend})]})},r5=2e3;function mr(){const{t:a}=Le(),{addToast:i}=on(),[l,o]=C.useState(null),r=C.useRef(null);C.useEffect(()=>()=>{r.current&&clearTimeout(r.current)},[]);const u=C.useCallback((h,m,p="success")=>{jd(h).then(g=>{if(g==="failed"){i("error",a("clipboard.copyFailed"));return}o(h),i(p,m),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>o(null),r5)})},[i,a]);return{copied:l,copy:u}}const ea="herdr-remote pair",c5=({onPairedSuccess:a})=>{const{settings:i,updateSettings:l,t:o}=Le(),{connect:r,connectionState:u,stateDetail:h}=et(),{addToast:m}=on(),[p,g]=C.useState(""),{copied:b,copy:v}=mr(),[w,x]=C.useState(!1),[T,M]=C.useState(i.wsUrl||hn),[A,N]=C.useState(i.token||""),[R,j]=C.useState(i.clientId||""),V="node bin/config-tui.js",_=U=>v(U,o("toasts.commandCopied")),D=U=>{U.preventDefault();const ee=p.trim().toUpperCase();if(!ee&&!A.trim()){m("warning",o("toasts.connectionError"));return}const q={pairCode:ee,wsUrl:T.trim()||hn,clientId:R.trim()||i.clientId};A.trim()&&(q.token=A.trim()),l(q),r({pairCode:ee||void 0,token:A.trim()||void 0,wsUrl:T.trim()||hn,clientId:R.trim()||i.clientId}),a&&a()},L=u==="connecting"||u==="reconnecting",z=({n:U})=>f.jsxs("span",{"aria-hidden":"true",className:"shrink-0 font-bold text-tui-accent",children:["[",U,"]"]});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:o("onboarding.title")}),f.jsx("span",{className:"text-tui uppercase text-tui-warn",children:o("onboarding.firstTimeSetup")})]}),f.jsx("p",{className:"mt-0.5 text-tui leading-snug text-tui-muted",children:o("onboarding.description")})]}),u==="error"&&f.jsxs(Ti,{tone:"warn",action:f.jsx(Me,{variant:"warn",onClick:()=>r(),children:o("common.retry")}),children:[f.jsx("span",{className:"block font-bold",children:o("onboarding.authRequired")}),f.jsx("span",{className:"block text-tui-muted",children:h||o("onboarding.authRequiredDesc")})]}),f.jsxs("form",{onSubmit:D,className:"grid gap-3",children:[f.jsx(Tt,{title:o("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(z,{n:1}),f.jsx("span",{className:"leading-snug",children:o("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:ea}),f.jsx(Me,{onClick:()=>_(ea),glyph:b===ea?ke.check:"⧉",className:ne("shrink-0",b===ea&&"border-tui-ok text-tui-ok"),children:o(b===ea?"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:o("onboarding.step1TuiNote")}),f.jsx("button",{type:"button",onClick:()=>_(V),className:"shrink-0 cursor-pointer border border-tui-border-dim px-1 text-tui-muted hover:border-tui-accent hover:text-tui-accent",title:o("common.clickToCopy"),children:f.jsx("code",{children:V})})]})})]})}),f.jsx(Tt,{title:o("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(z,{n:2}),f.jsx(Et,{type:"text",value:p,onChange:U=>g(U.target.value.toUpperCase()),placeholder:o("onboarding.step2Placeholder"),maxLength:12,autoFocus:!0,"aria-label":o("onboarding.step2Title"),className:"font-bold uppercase"})]}),f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:o("onboarding.step2Note")})]})}),f.jsx(Me,{variant:"primary",type:"submit",block:!0,disabled:L,className:"py-1.5",children:L?f.jsx(na,{label:o("onboarding.connectingAndPairing")}):o("onboarding.connectAndPair")}),f.jsxs("div",{className:"border border-tui-border bg-tui-base",children:[f.jsxs("button",{type:"button",onClick:()=>x(!w),"aria-expanded":w,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:w?ke.chevronDown:ke.chevronRight}),f.jsx("span",{className:"uppercase",children:o("onboarding.advancedTitle")})]}),w&&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(Fn,{htmlFor:"onboarding-token",children:o("onboarding.manualTokenLabel")}),f.jsx(Et,{id:"onboarding-token",type:"password",value:A,onChange:U=>N(U.target.value),placeholder:o("onboarding.manualTokenPlaceholder")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(Fn,{htmlFor:"onboarding-ws",children:o("onboarding.wsEndpointLabel")}),f.jsx(Et,{id:"onboarding-ws",type:"text",value:T,onChange:U=>M(U.target.value),placeholder:o("onboarding.wsEndpointPlaceholder")})]}),f.jsx(mS,{}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(Fn,{htmlFor:"onboarding-client-id",children:o("onboarding.clientIdLabel")}),f.jsx(Et,{id:"onboarding-client-id",type:"text",value:R,onChange:U=>j(U.target.value)})]})]})]})]})]})})},Ei="tui-focusable inline-flex shrink-0 select-none items-center justify-center border text-tui font-medium transition-colors",ms="border-tui-border bg-tui-surface text-tui-text hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",u5="border-tui-accent bg-tui-accent text-tui-crust font-bold",d5="border-tui-ok bg-transparent text-tui-ok hover:bg-tui-ok hover:text-tui-crust font-bold",jy={default:ms,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 f5(a){return{capHeight:a?"h-8":"h-7",keyClass:a?"h-8 min-w-[2rem] px-1.5":"h-7 min-w-[1.75rem] px-1.5",squareKeyClass:a?"h-8 w-8":"h-7 w-7",drawerToggleClass:a?"h-8 px-1.5":"h-7 px-1.5"}}function h5({capHeight:a,onCustomize:i,sendCombo:l}){const{settings:o,t:r}=Le(),{agentProfile:u}=et(),h=jx(u,o.agentKeymaps[u]),m=g=>{let b="";try{b=is(g.combo)}catch{}const v=g.custom?g.customLabel||"":r(`agentActions.${g.labelKey}`),w=g.labelKey==="interrupt"&&g.combo.trim().toLowerCase()==="ctrl+c"?"bad":g.combo.trim().toLowerCase()==="ctrl+z"?"warn":"default";return f.jsxs("button",{type:"button","data-testid":`agent-key-${g.id}`,onClick:()=>l(g.combo),className:ne(Ei,a,"max-w-[10rem] gap-1 px-1.5",jy[w]),title:`${b} ${v}`.trim(),"aria-label":`${b} ${v}`.trim(),children:[f.jsx("span",{className:"font-bold",children:b}),f.jsx("span",{className:"max-w-[5rem] truncate text-tui-sm opacity-70",children:v})]},g.id)},p=[...h.agentActions,...h.genericActions];return p.length===0&&!i?null:f.jsxs("div",{"data-testid":"agent-key-actions",role:"group","aria-label":`${Ji[u].name} ${r("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"}),p.map(m),i&&f.jsx("button",{type:"button","data-testid":"agent-key-customize",onClick:i,className:ne(Ei,a,"px-1.5 text-tui-sm border-tui-border-dim bg-transparent text-tui-faint hover:border-tui-accent hover:text-tui-accent"),title:r("agentKeymaps.customizeBar"),"aria-label":r("agentKeymaps.customizeBar"),children:r("agentKeymaps.customizeBarShort")})]})}const Oy="scrollbar-none flex items-center gap-1 overflow-x-auto border-b border-tui-border-dim bg-tui-crust p-1.5";function m5({capHeight:a,onKey:i}){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(l=>{const o=`F${l}`;return f.jsxs("button",{type:"button",onClick:()=>i(re[o]),className:ne(Ei,ms,a),children:["F",l]},o)})})}const p5=[{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 g5({capHeight:a,onKey:i}){const{t:l}=Le();return f.jsx("div",{className:Oy,children:p5.map(o=>f.jsxs("button",{type:"button",onClick:()=>i(o.code,!1),className:ne(Ei,a,"gap-1.5 px-2",jy[o.tone??"default"]),title:l(o.title),children:[f.jsx("span",{className:"font-bold",children:o.caption}),f.jsx("span",{className:"text-tui-sm opacity-70",children:l(o.badge)})]},o.caption))})}const b5=["|","~","/","\\","-","_","$","&",";",":","`",'"',"'",">","<","=","#","@","{","}","[","]"];function y5({squareKeyClass:a,onKey:i}){return f.jsx("div",{className:Oy,children:b5.map(l=>f.jsx("button",{type:"button",onClick:()=>i(l,!0),className:ne(Ei,ms,a,"font-bold"),children:l},l))})}const qg="image/png,image/jpeg,image/webp,image/gif,image/*";function Vg({fileInputRef:a}){const{uploadImage:i}=ur(),l=o=>{var u;const r=(u=o.target.files)==null?void 0:u[0];o.target.value="",r&&i(r)};return f.jsxs(f.Fragment,{children:[f.jsx("input",{ref:a,type:"file",accept:qg,className:"hidden","data-testid":"key-toolbar-file-input",onChange:l}),f.jsx("input",{type:"file",accept:qg,capture:"environment",className:"hidden","data-testid":"key-toolbar-camera-input",onChange:l})]})}function Pg({collapsed:a}){const{uploadProgress:i}=ur();return i.active?f.jsx("div",{"data-testid":a?"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(yS,{ratio:i.ratio,label:i.statusText,tone:i.phase==="completed"?"ok":i.phase==="error"?"bad":"accent","aria-label":i.statusText})}):null}function v5({fileInputRef:a,keyClass:i,vibrate:l}){const{t:o}=Le(),{isController:r}=et(),{warnViewerMode:u}=hs(),{uploadProgress:h}=ur(),m=h.active,p=()=>{var g;if(l(),!r){u();return}m||(g=a.current)==null||g.click()};return f.jsx("button",{type:"button","data-testid":"image-upload-btn",onClick:p,disabled:m,className:ne(Ei,i,m?"border-tui-border-dim bg-tui-surface opacity-60 cursor-not-allowed":ms),title:m?h.statusText:o("virtualKeyboard.uploadImageTitle"),"aria-label":o("virtualKeyboard.uploadImage"),children:f.jsx("span",{className:"font-medium",children:m?`${h.percent}%`:o("virtualKeyboard.image")})})}function x5(){const{settings:a}=Le(),{isController:i}=et(),{sendKey:l,warnViewerMode:o,consumeModifierLatch:r}=hs(),u=C.useRef([]);C.useEffect(()=>()=>{for(const g of u.current)clearTimeout(g);u.current=[]},[]);const h=C.useCallback(()=>{if(a.vibrateOnKeyPress&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(8)}catch{}},[a.vibrateOnKeyPress]),m=C.useCallback((g,b=!0)=>{if(h(),!i){o();return}const v=r();l(b&&v?tr(g,v):g)},[i,l,o,h,r]),p=C.useCallback(g=>{if(h(),!i){o();return}let b;try{b=xn(g)}catch{return}if(r(),b.length===1){l(b[0]);return}b.forEach((v,w)=>{const x=setTimeout(()=>{u.current=u.current.filter(T=>T!==x),l(v)},w*120);u.current.push(x)})},[r,i,l,h,o]);return{vibrate:h,pressKey:m,sendCombo:p}}const w5=({compact:a=!1,onCustomize:i})=>{const{settings:l,updateSettings:o,t:r}=Le(),{modifierLatch:u,toggleModifierLatch:h}=hs(),{vibrate:m,pressKey:p,sendCombo:g}=x5(),{capHeight:b,keyClass:v,squareKeyClass:w,drawerToggleClass:x}=f5(a),T=C.useRef(null),[M,A]=C.useState(!1),[N,R]=C.useState(!1),[j,V]=C.useState(!1),_=C.useRef(null),[D,L]=C.useState(!1),z=C.useCallback(()=>{const F=_.current;L(!!F&&F.scrollLeft+F.clientWidth<F.scrollWidth-1)},[]);if(C.useEffect(z),C.useEffect(()=>{const F=_.current;if(!F||typeof ResizeObserver!="function")return;const E=new ResizeObserver(z);return E.observe(F),()=>E.disconnect()},[z,l.toolbarVisible]),!l.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(Vg,{fileInputRef:T}),f.jsx(Pg,{collapsed:!0}),f.jsx("div",{className:"flex items-center justify-center px-2 py-0.5",children:f.jsxs("button",{type:"button",onClick:()=>o({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:r("virtualKeyboard.expandToolbar"),"aria-label":r("virtualKeyboard.expandToolbar"),"aria-expanded":!1,children:[f.jsx("span",{"aria-hidden":"true",children:"▴"}),f.jsx("span",{"aria-hidden":"true",children:r("common.keyBar")})]})})]});const U=l.virtualKeys&&l.virtualKeys.length>0?l.virtualKeys.filter(F=>F.enabled):Lb,ee=F=>F.id==="left"?f.jsx("span",{"aria-hidden":"true",children:"←"}):F.id==="up"?f.jsx("span",{"aria-hidden":"true",children:"↑"}):F.id==="down"?f.jsx("span",{"aria-hidden":"true",children:"↓"}):F.id==="right"?f.jsx("span",{"aria-hidden":"true",children:"→"}):F.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:r("virtualKeyboard.keyEnter")})]}):F.id==="drawer_chords"?f.jsx("span",{children:"^C"}):F.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:F.label}),q=F=>{if(m(),F.type==="modifier"){F.modifierType==="ctrl"||F.modifierType==="alt"||F.modifierType==="shift"?h(F.modifierType):F.modifierType==="meta"&&p(re.ESC);return}if(F.type==="drawer"){F.drawerType==="fn"?(A(!M),R(!1),V(!1)):F.drawerType==="chords"?(V(!j),A(!1),R(!1)):F.drawerType==="symbols"&&(R(!N),A(!1),V(!1));return}p(F.code,F.type!=="chord")},P=F=>{if(F.type==="modifier"){if(F.modifierType==="ctrl")return u.ctrl;if(F.modifierType==="alt")return u.alt;if(F.modifierType==="shift")return u.shift}if(F.type==="drawer"){if(F.drawerType==="fn")return M;if(F.drawerType==="chords")return j;if(F.drawerType==="symbols")return N}return!1},ie=F=>{const E=P(F),Y=["left","up","down","right"].includes(F.id),X=F.type==="drawer",le=sd(F,r);return f.jsx("button",{type:"button",onClick:()=>q(F),className:ne(Ei,Y?w:X?x:v,F.id==="enter"?d5:E?u5:ms),title:le,"aria-label":le,"aria-pressed":E,children:ee(F)},F.id)},ae=U.find(F=>F.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",a?"pb-[max(env(safe-area-inset-bottom,0px),0.125rem)]":"pb-[max(env(safe-area-inset-bottom,0px),0.25rem)]"),role:"toolbar","aria-label":r("virtualKeyboard.touchKeyboardShortcuts"),children:[f.jsx(Vg,{fileInputRef:T}),f.jsx(Pg,{collapsed:!1}),M&&f.jsx(m5,{capHeight:b,onKey:p}),j&&f.jsx(g5,{capHeight:b,onKey:p}),N&&f.jsx(y5,{squareKeyClass:w,onKey:p}),f.jsxs("div",{"data-testid":"key-toolbar-row",className:ne("flex flex-nowrap items-center justify-start gap-1",a?"px-1.5 py-1":"px-2 py-1.5"),children:[f.jsxs("div",{className:"relative min-w-0",children:[f.jsxs("div",{ref:_,"data-testid":"key-toolbar-scroll",onScroll:z,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:()=>o({toolbarVisible:!1}),className:ne(Ei,w,"mr-1 border-tui-border-dim bg-transparent text-tui-faint hover:border-tui-border hover:text-tui-text"),title:r("virtualKeyboard.collapseToolbar"),"aria-label":r("virtualKeyboard.collapseToolbar"),"aria-expanded":!0,children:f.jsx("span",{"aria-hidden":"true",children:"▾"})}),U.filter(F=>F.id!=="enter").map(ie),f.jsx(h5,{capHeight:b,onCustomize:i,sendCombo:g}),f.jsx(v5,{fileInputRef:T,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"})]}),ae&&ie(ae)]})]})},S5=["ls -la","clear","git status","pwd","top","exit","cat"],C5=({isOpen:a,onClose:i})=>{const{t:l}=Le(),{isController:o}=et(),{sendKey:r,warnViewerMode:u}=hs(),[h,m]=C.useState("");if(!a)return null;const p=b=>{if(b&&b.preventDefault(),!o){u();return}h.length>0?(r(`${h}\r`),m("")):r("\r")},g=b=>{if(!o){u();return}r(`${b}\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":l("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:l("virtualKeyboard.helperTitle")}),f.jsx(Me,{variant:"ghost",onClick:i,"aria-label":l("virtualKeyboard.closeHelper"),children:"esc"})]}),f.jsx("div",{className:"scrollbar-none flex items-center gap-1 overflow-x-auto py-0.5",children:S5.map(b=>f.jsx("button",{type:"button",onClick:()=>g(b),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:b},b))}),f.jsxs("form",{onSubmit:p,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:l("virtualKeyboard.placeholder")}),f.jsx(Et,{id:"virtual-keyboard-input",name:"terminal-input",type:"text",value:h,onChange:b=>m(b.target.value),placeholder:l("virtualKeyboard.placeholder"),inputMode:"text",enterKeyHint:"send",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,className:"select-text pr-7"}),h.length>0&&f.jsx("button",{type:"button",onClick:()=>m(""),className:"tui-focusable absolute right-1 top-1/2 -translate-y-1/2 px-1 text-tui-faint hover:text-tui-bad","aria-label":l("virtualKeyboard.clearInput"),children:f.jsx("span",{"aria-hidden":"true",children:ke.cross})})]}),f.jsx(Me,{variant:"primary",type:"submit",title:l("virtualKeyboard.sendButton"),glyph:"⏎",className:"h-9 shrink-0",children:f.jsx("span",{className:"hidden sm:inline",children:l("virtualKeyboard.sendButton")})})]})]})};function pr(a,i){const l=(o,r)=>i?i(o):r;switch(a){case"connected":return{label:l("connection.live","Live"),level:"ok",needsAttention:!1};case"connecting":return{label:l("connection.connecting","Connecting"),level:"warn",needsAttention:!0};case"reconnecting":return{label:l("connection.reconnecting","Reconnecting"),level:"warn",needsAttention:!0,actionLabel:l("connection.reconnectNow","Reconnect now")};case"error":return{label:l("connection.error","Error"),level:"bad",needsAttention:!0,actionLabel:l("connection.retry","Retry")};default:return{label:l("connection.offline","Offline"),level:"idle",needsAttention:!0,actionLabel:l("connection.connect","Connect")}}}const T5={connected:"ok",connecting:"warn",reconnecting:"warn",error:"bad",disconnected:"idle"},M5=({isOpen:a,onClose:i,isAddMode:l=!1})=>{const{settings:o,updateSettings:r,t:u,activeProfile:h,activeProfileId:m,addProfileAndConnect:p,renameProfile:g}=Le(),{connect:b,disconnect:v,connectionState:w,hostId:x}=et(),{addToast:T}=on(),[M,A]=C.useState(o.wsUrl),[N,R]=C.useState(o.token),[j,V]=C.useState(o.pairCode),[_,D]=C.useState(o.clientId),[L,z]=C.useState((h==null?void 0:h.displayName)||""),[U,ee]=C.useState(o.autoReconnect),{copied:q,copy:P}=mr(),ie=q!==null;if(C.useEffect(()=>{a&&(A(o.wsUrl),R(l?"":o.token),V(l?"":o.pairCode),D(o.clientId),z(l?"":(h==null?void 0:h.displayName)||""),ee(o.autoReconnect))},[a,l,o,h]),!a)return null;const ae=X=>{X.preventDefault();const le={wsUrl:M.trim()||hn,token:N.trim(),pairCode:j.trim().toUpperCase(),clientId:_.trim()||o.clientId,autoReconnect:U};if(!le.token&&!le.pairCode){T("warning",u("pairing.credentialsRequired"));return}l?p({...le,displayName:L.trim()||void 0}):(r(le),m&&L.trim()&&g(m,L),v(),b({wsUrl:le.wsUrl,token:le.token||void 0,pairCode:le.pairCode||void 0,clientId:le.clientId,autoReconnect:U})),i()},F=()=>{const X=`client-${Math.random().toString(36).substring(2,8)}`;D(X)},E=()=>{const X=new URL(window.location.href);X.search="",j.trim()&&X.searchParams.set("pairCode",j.trim().toUpperCase()),P(X.toString(),u("toasts.pairingLinkCopied"))},Y=T5[w]??"idle";return f.jsxs(hr,{isOpen:a,onClose:i,title:u(l?"pairing.addTitle":"pairing.title"),subtitle:u("pairing.subtitle"),closeLabel:u("common.closeDialog"),hints:[{keys:"esc",action:u("common.close")},{keys:"⏎",action:u("pairing.saveAndConnect")}],footer:f.jsxs(f.Fragment,{children:[w==="connected"&&f.jsx(Me,{variant:"danger",onClick:()=>{v(),i()},children:u("common.disconnect")}),f.jsx(Me,{variant:"primary",type:"submit",form:"pairing-form",children:u("pairing.saveAndConnect")})]}),children:[f.jsxs("div",{className:"mb-3 flex flex-wrap items-center justify-between gap-2 border-b border-tui-border-dim pb-2 text-tui",children:[f.jsxs("span",{className:"flex items-center gap-1.5",children:[f.jsx(Bt,{level:Y}),f.jsx("span",{className:"text-tui-muted",children:u("common.status")}),f.jsx("span",{className:ne(Y==="ok"?"text-tui-ok":Y==="bad"?"text-tui-bad":Y==="warn"?"text-tui-warn":"text-tui-faint"),children:pr(w,u).label})]}),x&&f.jsxs("span",{className:"flex items-center gap-1.5 text-tui-muted",children:[u("common.host")," ",f.jsx("span",{className:"text-tui-text",children:x})]})]}),f.jsxs("form",{id:"pairing-form",onSubmit:ae,className:"space-y-3",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(Fn,{htmlFor:"pairing-name",children:u("pairing.displayNameLabel")}),f.jsx(Et,{id:"pairing-name",type:"text",value:L,onChange:X=>z(X.target.value),placeholder:u("pairing.displayNamePlaceholder"),maxLength:64,autoComplete:"off"}),f.jsx("p",{className:"text-tui-sm text-tui-faint",children:u("pairing.displayNameHelp")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(Fn,{htmlFor:"pairing-code",hint:u("pairing.pairCodeNote"),children:u("pairing.pairCodeLabel")}),f.jsx(Et,{id:"pairing-code",type:"text",value:j,onChange:X=>V(X.target.value.toUpperCase()),placeholder:u("pairing.pairCodePlaceholder"),maxLength:12,className:"uppercase"}),f.jsx("p",{className:"text-tui-sm text-tui-faint",children:u("pairing.pairCodeHelp")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(Fn,{htmlFor:"pairing-token",hint:u("pairing.tokenNote"),children:u("pairing.tokenLabel")}),f.jsx(Et,{id:"pairing-token",type:"password",value:N,onChange:X=>R(X.target.value),placeholder:u("pairing.tokenPlaceholder")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(Fn,{htmlFor:"pairing-ws",children:u("pairing.wsUrlLabel")}),f.jsx(Et,{id:"pairing-ws",type:"text",value:M,onChange:X=>A(X.target.value),placeholder:u("pairing.wsUrlPlaceholder")}),f.jsx("p",{className:"text-tui-sm text-tui-faint",children:u("pairing.wsUrlDefaultNote")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(Fn,{htmlFor:"pairing-client-id",children:u("pairing.clientIdLabel")}),f.jsxs("div",{className:"flex gap-2",children:[f.jsx(Et,{id:"pairing-client-id",type:"text",value:_,onChange:X=>D(X.target.value),className:"flex-1"}),f.jsx(Me,{onClick:F,title:u("pairing.regenerateClientIdTitle"),className:"shrink-0",children:u("pairing.newIdButton")})]})]}),f.jsx("div",{className:"border-t border-tui-border-dim pt-2",children:f.jsx(gS,{checked:U,onChange:ee,label:u("pairing.autoReconnectLabel"),description:u("pairing.autoReconnectDesc")})}),f.jsx("div",{className:"border-t border-tui-border-dim pt-2",children:f.jsx(Me,{onClick:E,block:!0,glyph:ie?ke.check:"⧉",className:ne(ie&&"border-tui-ok text-tui-ok"),children:u("pairing.copyDirectLink")})})]})]})},Ci=ne(fr,"py-0"),A5="h-7 py-0",vd="h-7 py-0 px-1.5",rr="text-tui-bad hover:border-tui-bad hover:text-tui-bad",E5=["grid items-center gap-x-2 gap-y-1 py-1","grid-cols-[4rem_minmax(0,1fr)_7rem] [grid-template-areas:'cap_label_actions'_'combo_combo_default']","sm:grid-cols-[4rem_minmax(0,1fr)_9rem_7rem_7rem] sm:[grid-template-areas:'cap_label_combo_default_actions']"].join(" ");function Dy(a){return{offLabel:a("settings.toggleOff"),onLabel:a("settings.toggleOn")}}const N5=({profile:a,onProfileChange:i})=>{const{settings:l,updateSettings:o,t:r}=Le(),{agentProfile:u}=et(),[h,m]=C.useState({}),p=C.useRef({}),[g,b]=C.useState(""),[v,w]=C.useState(""),x=a||u,T=l.agentKeymaps[x]||{},M=db(x,T),A=fb(x,T),N=A.filter(E=>!E.hidden).length,R=E=>E.custom?E.customLabel||"":r(`agentActions.${E.labelKey}`),j=E=>{try{return is(E.combo)}catch{return E.combo}},V=E=>{o({agentKeymaps:{...l.agentKeymaps,[x]:E}})},_=(E,Y)=>{var X;V({...T,actions:{...T.actions,[E]:{...(X=T.actions)==null?void 0:X[E],...Y}}})},D=E=>{_(E.id,{keys:E.defaultCombo})},L=(E,Y)=>{const X=E+(Y==="up"?-1:1);if(X<0||X>=M.length)return;const le=M.map(Q=>Q.id);[le[E],le[X]]=[le[X],le[E]],V({...T,order:le})},z=E=>{var Y;V({...T,custom:(T.custom||[]).filter(X=>X.id!==E),order:(Y=T.order)==null?void 0:Y.filter(X=>X!==E)})},U=()=>V(Ox(T)),ee=()=>{const E={...l.agentKeymaps};delete E[x],o({agentKeymaps:E})},q=()=>{const E=g.trim();if(!E)return;try{xn(v)}catch{return}const Y=`custom-${Date.now().toString(36)}`;V({...T,custom:[...T.custom||[],{id:Y,label:E,keys:v.trim()}],order:[...M.map(X=>X.id),Y]}),b(""),w("")},P=E=>E instanceof vn?r(`agentKeymaps.errors.${E.code}`,E.params):String(E),ie=(E,Y)=>`${E}:${Y}`,ae=(E,Y)=>{const X=ie(x,E);p.current={...p.current,[X]:Y},m(p.current);try{xn(Y),_(E,{keys:Y})}catch{}},F=E=>{const Y=ie(x,E),X=p.current[Y];if(X!==void 0){delete p.current[Y],m({...p.current});try{xn(X),_(E,{keys:X})}catch{}}};return f.jsxs("div",{className:"space-y-4",children:[f.jsx(fn,{title:r("agentKeymaps.settingsProfileLabel"),aside:f.jsx(Me,{variant:"ghost",onClick:ee,className:ne(rr,vd),children:r("agentKeymaps.restoreProfile")}),children:f.jsx(Ht,{label:r("agentKeymaps.profileRowLabel"),htmlFor:"agent-keymap-profile",hint:Ji[x].configHint?r("agentKeymaps.configHint",{path:Ji[x].configHint}):void 0,control:f.jsx(dr,{id:"agent-keymap-profile","aria-label":r("agentKeymaps.settingsProfileLabel"),value:x,onChange:E=>i(E.target.value),className:Ci,children:Mx.map(E=>f.jsx("option",{value:E,children:Ji[E].name},E))})})}),f.jsx(fn,{title:r("agentKeymaps.barGroup"),aside:f.jsx(Me,{variant:"ghost",onClick:U,className:ne(rr,vd),children:r("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:r("agentKeymaps.barHint",{profile:Ji[x].name,count:N})}),f.jsx("div",{role:"group","aria-label":r("agentKeymaps.barGroup"),"data-testid":"agent-bar-choices",className:"flex flex-wrap gap-1",children:A.map(E=>{const Y=R(E),X=j(E),le=!E.hidden;return f.jsxs("button",{type:"button","data-testid":`agent-bar-toggle-${E.id}`,"aria-pressed":le,onClick:()=>_(E.id,{hidden:le}),title:`${X} ${Y}`.trim(),className:ne("tui-focusable inline-flex h-7 select-none items-center gap-1 border px-1.5 text-tui-sm transition-colors",le?"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:le?ke.check:"+"}),f.jsx("span",{className:"font-bold",children:X}),f.jsx("span",{className:le?void 0:"opacity-80",children:Y})]},E.id)})})]})}),f.jsx(fn,{title:r("agentKeymaps.listGroup",{profile:Ji[x].name}),children:M.map((E,Y)=>{var de,we;const X=R(E),le=r("agentKeymaps.defaultCombo",{combo:is(E.defaultCombo)}),Q=((we=(de=T.actions)==null?void 0:de[E.id])==null?void 0:we.keys)??E.combo,ve=ie(x,E.id),ye=h[ve]??Q;let xe="",me=null;try{xn(ye),xe=is(ye)}catch(oe){me=P(oe)}return f.jsxs("div",{"data-testid":`agent-setting-row-${E.id}`,className:E5,children:[f.jsx(sy,{className:"w-full overflow-hidden whitespace-nowrap font-bold [grid-area:cap]",children:xe||"—"}),f.jsxs("span",{className:"min-w-0 truncate text-tui text-tui-text [grid-area:label]",title:X,children:[X,!E.verified&&f.jsx("span",{className:"ml-1 text-tui-sm text-tui-faint",children:r("agentKeymaps.unverified")})]}),f.jsxs("label",{className:"sr-only",htmlFor:`agent-combo-${E.id}`,children:[r("agentKeymaps.shortcutLabel")," ",X]}),f.jsx(Et,{id:`agent-combo-${E.id}`,"aria-label":`${r("agentKeymaps.shortcutLabel")} ${X}`,value:ye,onChange:oe=>ae(E.id,oe.target.value),onBlur:()=>F(E.id),onKeyDown:oe=>{oe.key==="Enter"&&oe.currentTarget.blur()},placeholder:r("agentKeymaps.comboPlaceholder"),"aria-invalid":!!me,className:ne("w-full min-w-0 [grid-area:combo]",A5)}),f.jsx("span",{className:"min-w-0 truncate text-tui-sm text-tui-faint [grid-area:default]",title:le,children:le}),f.jsxs("div",{className:"flex items-center justify-end [grid-area:actions]",children:[f.jsx(ta,{onClick:()=>D(E),title:r("agentKeymaps.resetAction"),"aria-label":`${r("agentKeymaps.resetAction")} ${X}`,children:"↺"}),f.jsx(ta,{disabled:Y===0,onClick:()=>L(Y,"up"),title:r("agentKeymaps.moveUp"),"aria-label":`${r("agentKeymaps.moveUp")} ${X}`,children:"↑"}),f.jsx(ta,{disabled:Y===M.length-1,onClick:()=>L(Y,"down"),title:r("agentKeymaps.moveDown"),"aria-label":`${r("agentKeymaps.moveDown")} ${X}`,children:"↓"}),E.custom?f.jsx(ta,{variant:"danger",onClick:()=>z(E.id),title:r("agentKeymaps.removeCustom"),"aria-label":`${r("agentKeymaps.removeCustom")} ${X}`,children:ke.cross}):f.jsx("span",{"aria-hidden":"true",className:"h-7 w-7 shrink-0"})]}),me&&f.jsx("p",{className:"col-span-full text-tui-sm text-tui-bad",role:"alert",children:r("agentKeymaps.invalidCombo",{error:me})})]},E.id)})}),f.jsx(fn,{title:r("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:r("agentKeymaps.customLabel")}),f.jsx(Et,{value:g,onChange:E=>b(E.target.value),className:Ci})]}),f.jsxs("label",{className:"min-w-[9rem] flex-1 space-y-1 text-tui-sm text-tui-muted",children:[f.jsx("span",{children:r("agentKeymaps.customCombo")}),f.jsx(Et,{value:v,onChange:E=>w(E.target.value),placeholder:r("agentKeymaps.comboPlaceholder"),className:Ci})]}),f.jsx(Me,{variant:"primary",glyph:"+",onClick:q,disabled:!g.trim()||!v.trim(),className:Ci,children:r("agentKeymaps.addAction")})]}),v.trim()&&(()=>{try{return xn(v),f.jsx("p",{className:"text-tui-sm text-tui-info",children:is(v)})}catch(E){const Y=P(E);return f.jsx("p",{className:"text-tui-sm text-tui-bad",role:"alert",children:Y})}})()]})})]})},zy={"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"},k5=["host_font_unavailable","host_font_timeout","disconnected","font_api_unavailable"],L5=()=>{const{hostFont:a,loadHostFont:i,declineHostFont:l,settings:o,activeProfile:r,t:u}=Le(),{herdrLaunch:h,hostname:m}=et(),{addToast:p}=on(),{font:g,status:b,glyphs:v}=a,w=b==="loading"||v.status==="loading",x=b==="failed"||v.status==="failed",T=C.useRef(!1);C.useEffect(()=>{T.current&&!w&&!x&&a.interactive&&p("success",u("hostFont.loaded")),T.current=w&&a.interactive},[w,x,a.interactive,p,u]);const M=b==="available"||v.status==="available",A=a.interactive&&(w||x);if(!(g&&o.fontFamily==="host"&&!h&&(M||A)))return null;const R=b==="available"||a.interactive&&(b==="loading"||b==="failed"),j=v.source&&(v.status==="available"||a.interactive&&(v.status==="loading"||v.status==="failed")),V=m||(r==null?void 0:r.displayName)||u("herdrLaunch.thisHost"),_=[g.sizePx?`${Math.round(g.sizePx)}px`:null,g.source?zy[g.source]||g.source:null].filter(Boolean).join(u("hostFont.detailSeparator")),D=a.error&&k5.includes(a.error)?a.error:"other",L=a.totalBytes?a.receivedBytes/a.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(Tt,{title:u("hostFont.title"),tone:b==="failed"?"bad":"accent",className:"w-full max-w-md",bodyClassName:"space-y-3","aria-label":u("hostFont.title"),children:[f.jsx("p",{className:"leading-snug text-tui-text",children:R||!v.source?u("hostFont.body",{host:V,family:g.family,detail:_?u("hostFont.detail",{detail:_}):""}):u("hostFont.bodyGlyphsOnly",{host:V,family:v.source.family})}),w?f.jsxs("div",{className:"space-y-1",role:"status",children:[f.jsx(bS,{value:L,width:32,className:"max-w-full overflow-hidden"}),f.jsx("p",{className:"text-tui-sm text-tui-muted",children:u("hostFont.loading",{received:zu(a.receivedBytes),total:zu(a.totalBytes)})})]}):f.jsxs(f.Fragment,{children:[x?f.jsx(Ti,{tone:"bad",children:u("hostFont.failed",{reason:u(`hostFont.reasons.${D}`)})}):f.jsxs("div",{className:"space-y-1 text-tui-sm leading-snug text-tui-faint",children:[R&&g.faces.length?f.jsx("p",{children:u("hostFont.download",{count:g.faces.length,size:zu(a.totalBytes)})}):null,j&&v.source?f.jsx("p",{children:u(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:l,children:u("hostFont.decline")}),f.jsx(Me,{variant:"primary",onClick:i,autoFocus:!0,children:u(x?"common.retry":"hostFont.load")})]})]})]})})},R5=({onOpenAdmin:a})=>{var _;const{settings:i,updateSettings:l,language:o,setLanguage:r,t:u,hostFont:h,syncHostFont:m,terminalFontFamily:p,terminalFontSize:g}=Le(),{connectionState:b}=et(),v=td.find(D=>D.id===i.fontFamily),w=(D,L)=>D==="host"||D==="system"?u(`fontPresets.${D}`):L,x=(()=>{const{font:D,status:L}=h,z=h.totalBytes?Math.round(h.receivedBytes/h.totalBytes*100):0,U=u(`settings.hostFontStatus.${L}`,{percent:z});return D?[D.family,D.sizePx?`${Math.round(D.sizePx)}px`:null,D.source?zy[D.source]||D.source:null,U].filter(Boolean).join(" · "):U})(),T=(_=h.font)!=null&&_.sizePx?Wa(h.font.sizePx):null,M=h.glyphs.source&&h.glyphs.status!=="none"?u("settings.hostGlyphLine",{family:h.glyphs.source.family,status:u(`settings.hostGlyphStatus.${h.glyphs.status}`,{count:h.glyphs.covered.toLocaleString()})}):null,A=typeof window<"u"&&window.isSecureContext&&"Notification"in window,N=10,R=24,j=Dy(u),V=T?u("settings.fontSizeFollowHost",{size:T}):u("settings.fontSizeFollowHostUnknown");return f.jsxs("div",{className:"space-y-4",children:[f.jsx(fn,{title:u("settings.sectionInterface"),children:f.jsx(Ht,{label:u("settings.languageLabel"),control:f.jsx(xg,{name:"ui-language","aria-label":u("settings.languageLabel"),value:o,onChange:r,options:[{value:"zh",label:"简体中文"},{value:"en",label:"English"}]})})}),f.jsxs(fn,{title:u("settings.sectionFont"),children:[f.jsx(Ht,{label:u("settings.fontFamilyLabel"),htmlFor:"terminal-font-select",control:f.jsxs(dr,{id:"terminal-font-select",value:i.fontFamily,onChange:D=>l({fontFamily:D.target.value}),"aria-label":u("settings.fontFamilyLabel"),className:Ci,children:[!v&&f.jsx("option",{value:i.fontFamily,children:i.fontFamily}),td.map(D=>f.jsx("option",{value:D.id,children:w(D.id,D.name)},D.id))]})}),i.fontFamily==="host"&&f.jsx(Ht,{label:u("settings.hostFontLabel"),hint:f.jsxs(f.Fragment,{children:[f.jsx("span",{"data-testid":"host-font-status",className:"block break-words text-tui-info",children:x}),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:b!=="connected"||h.status==="loading"||h.glyphs.status==="loading",className:Ci,children:u("settings.hostFontSync")})}),f.jsx(Ht,{label:u("settings.fontSizeLabel",{size:g}),hint:u("settings.fontSizeHint"),htmlFor:"terminal-font-size",control:f.jsx("div",{className:ne("flex items-center",fr),children:f.jsx("input",{id:"terminal-font-size",type:"range",min:N,max:R,step:1,value:g,onChange:D=>l({fontSize:Number(D.target.value),fontSizeFollowsHost:!1}),className:"h-1 w-full cursor-pointer appearance-none bg-tui-border accent-tui-accent"})})}),f.jsx(Ht,{label:V,control:f.jsx(wi,{label:V,...j,checked:i.fontSizeFollowsHost,onChange:D=>l(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(fn,{title:u("settings.sectionInput"),children:[f.jsx(Ht,{label:u("settings.predictiveEchoLabel"),hint:u("settings.predictiveEchoDesc"),control:f.jsx(xg,{name:"predictive-echo","aria-label":u("settings.predictiveEchoLabel"),value:i.predictiveEcho,onChange:D=>l({predictiveEcho:D}),options:[{value:"auto",label:u("settings.predictiveEchoAuto")},{value:"always",label:u("settings.predictiveEchoAlways")},{value:"off",label:u("settings.predictiveEchoOff")}]})}),f.jsx(Ht,{label:u("settings.touchKeyToolbar"),hint:u("settings.touchKeyToolbarDesc"),control:f.jsx(wi,{label:u("settings.touchKeyToolbar"),...j,checked:i.toolbarVisible,onChange:D=>l({toolbarVisible:D})})}),f.jsx(Ht,{label:u("settings.touchHaptics"),hint:u("settings.touchHapticsDesc"),control:f.jsx(wi,{label:u("settings.touchHaptics"),...j,checked:i.vibrateOnKeyPress,onChange:D=>l({vibrateOnKeyPress:D})})})]}),f.jsxs(fn,{title:u("settings.agentAlertsLabel"),children:[f.jsx(Ht,{label:u("settings.agentAlertBadge"),hint:u("settings.agentAlertBadgeDesc"),control:f.jsx(wi,{label:u("settings.agentAlertBadge"),...j,checked:i.agentAlertBadge,onChange:D=>l({agentAlertBadge:D})})}),f.jsx(Ht,{label:u("settings.agentAlertVibrate"),hint:u("settings.agentAlertVibrateDesc"),control:f.jsx(wi,{label:u("settings.agentAlertVibrate"),...j,checked:i.agentAlertVibrate,onChange:D=>l({agentAlertVibrate:D})})}),f.jsx(Ht,{label:u("settings.agentAlertSound"),hint:u("settings.agentAlertSoundDesc"),control:f.jsx(wi,{label:u("settings.agentAlertSound"),...j,checked:i.agentAlertSound,onChange:D=>{l({agentAlertSound:D}),D&&(Ib(),Fb("done"))}})}),A&&f.jsx(Ht,{label:u("settings.agentAlertNotify"),hint:u("settings.agentAlertNotifyDesc"),control:f.jsx(wi,{label:u("settings.agentAlertNotify"),...j,checked:i.agentAlertNotify,onChange:D=>{if(D&&Notification.permission!=="granted"){Notification.requestPermission().then(L=>l({agentAlertNotify:L==="granted"}));return}l({agentAlertNotify:D})}})})]}),a&&f.jsx(fn,{title:u("settings.sectionAdmin"),children:f.jsx(Ht,{label:u("settings.adminEntry"),hint:u("settings.adminEntryHint"),control:f.jsx(Me,{block:!0,variant:"primary",glyph:ke.arrowRight,onClick:a,className:Ci,children:u("settings.adminEntryOpen")})})})]})},_5=()=>{const{settings:a,updateSettings:i,t:l}=Le(),{addToast:o}=on(),[r,u]=C.useState(!1),h=Dy(l),m=a.virtualKeys&&a.virtualKeys.length>0?a.virtualKeys:rs(),p=x=>{const T=m.map(M=>M.id===x?{...M,enabled:!M.enabled}:M);i({virtualKeys:T})},g=(x,T)=>{const M=T==="up"?x-1:x+1;if(M<0||M>=m.length)return;const A=[...m],N=A[x];A[x]=A[M],A[M]=N,i({virtualKeys:A})},b=x=>{if(m.some(M=>M.id===x.id)){const M=m.map(A=>A.id===x.id?{...A,enabled:!0}:A);i({virtualKeys:M})}else{const M=[...m,{...x,enabled:!0}];i({virtualKeys:M})}u(!1)},v=x=>{const T=m.filter(M=>M.id!==x);i({virtualKeys:T})},w=()=>{i({virtualKeys:rs()}),o("info",l("toasts.keyLayoutReset"))};return f.jsxs("div",{className:"space-y-3",children:[f.jsx(fn,{title:l("virtualKeyboard.customizeTitle"),aside:f.jsx(Me,{variant:"ghost",onClick:w,className:ne(rr,vd),children:l("virtualKeyboard.resetLayout")}),children:m.map((x,T)=>{const M=sd(x,l);return f.jsxs("div",{className:"flex items-center gap-2 py-1",children:[f.jsx(sy,{className:ne("w-16 shrink-0 truncate",!x.enabled&&"opacity-50"),children:x.label}),f.jsx("span",{className:ne("min-w-0 flex-1 truncate text-tui",x.enabled?"text-tui-text":"text-tui-faint"),children:M}),f.jsx(wi,{label:`${l("virtualKeyboard.enableKey")} ${x.label}`,...h,checked:x.enabled,onChange:()=>p(x.id),className:"h-7 w-24 shrink-0"}),f.jsx(ta,{disabled:T===0,onClick:()=>g(T,"up"),title:l("virtualKeyboard.moveUp"),"aria-label":l("virtualKeyboard.moveUp"),children:"↑"}),f.jsx(ta,{disabled:T===m.length-1,onClick:()=>g(T,"down"),title:l("virtualKeyboard.moveDown"),"aria-label":l("virtualKeyboard.moveDown"),children:"↓"}),f.jsx(ta,{variant:"danger",onClick:()=>v(x.id),title:l("virtualKeyboard.deleteKeyTitle"),"aria-label":l("virtualKeyboard.deleteKeyTitle"),children:ke.cross})]},x.id)})}),f.jsx(Me,{block:!0,glyph:"+",onClick:()=>u(!r),className:ne("border-dashed",Ci),children:l("virtualKeyboard.addKey")}),r&&f.jsx(fn,{title:l("virtualKeyboard.availableKeys"),children:f.jsx("div",{className:"flex flex-wrap gap-1 py-1.5",children:Pw.map(x=>{const T=m.some(M=>M.id===x.id);return f.jsxs("button",{type:"button",onClick:()=>b(x),title:sd(x,l),className:ne("tui-focusable flex h-7 select-none items-center gap-1 border px-1.5 text-tui-sm transition-colors",T?"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:x.label}),f.jsx("span",{"aria-hidden":"true",className:T?"text-tui-ok":"text-tui-accent",children:T?ke.check:"+"})]},x.id)})})})]})},j5=({isOpen:a,onClose:i,initialTab:l,onOpenAdmin:o})=>{const{updateSettings:r,t:u}=Le(),{addToast:h}=on(),[m,p]=C.useState("general"),[g,b]=C.useState(null);if(C.useEffect(()=>{!a||!l||(p(l),b(null))},[a,l]),!a)return null;const v=()=>{const w=jb();r({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,language:w.language,virtualKeys:w.virtualKeys}),h("info",u("settings.resetDefaultsToast"))};return f.jsxs(hr,{isOpen:a,onClose:i,title:u("settings.title"),subtitle:u("settings.subtitle"),closeLabel:u("common.closeDialog"),size:"lg",fixedHeight:!0,hints:[{keys:"esc",action:u("common.close")}],footer:f.jsxs(f.Fragment,{children:[f.jsx(Me,{variant:"ghost",onClick:v,className:rr,children:u("settings.resetDefaults")}),f.jsx(Me,{variant:"primary",onClick:i,children:u("common.done")})]}),children:[f.jsx(Ld,{tabs:[{id:"general",label:u("settings.tabGeneral"),index:1},{id:"virtualKeys",label:u("settings.tabVirtualKeys"),index:2},{id:"agentKeymaps",label:u("settings.tabAgentKeymaps"),index:3}],activeId:m,onSelect:w=>p(w),className:"mb-3 border-b border-tui-border-dim pb-1"}),m==="general"&&f.jsx(R5,{onOpenAdmin:o}),m==="virtualKeys"&&f.jsx(_5,{}),m==="agentKeymaps"&&f.jsx(N5,{profile:g,onProfileChange:b})]})},O5={success:"ok",warning:"warn",error:"bad",info:"accent"},D5={success:ke.check,warning:ke.warn,error:ke.cross,info:"›"},z5=()=>{const{t:a}=Le(),{toasts:i,removeToast:l}=on();return i.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:i.map(o=>{const r=O5[o.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",sn[r].edgeL),role:"alert",children:[f.jsx("span",{"aria-hidden":"true",className:ne("shrink-0 font-bold",sn[r].text),children:D5[o.type]}),f.jsx("div",{className:"min-w-0 flex-1 break-words leading-snug text-tui-text",children:o.message}),o.count>1&&f.jsxs("span",{className:"shrink-0 border border-tui-border-dim px-1 text-tui-sm text-tui-muted",children:["×",o.count]}),f.jsx("button",{type:"button",onClick:()=>l(o.id),className:"tui-focusable shrink-0 select-none px-0.5 text-tui-faint transition-colors hover:text-tui-bad","aria-label":a("common.dismissNotification"),children:f.jsx("span",{"aria-hidden":"true",children:ke.cross})})]},o.id)})})},Hy=[{status:"blocked",level:"warn"},{status:"done",level:"ok"},{status:"working",level:"accent"}];function H5(a){return a?a.total>0||Hy.some(({status:i})=>{var l;return(((l=a.counts)==null?void 0:l[i])??0)>0}):!1}const By=({className:a,compact:i=!1})=>{const{t:l}=Le(),{agentStatus:o}=et();if(!o)return null;const r=Hy.map(({status:h,level:m})=>{var p;return{status:h,level:m,count:((p=o.counts)==null?void 0:p[h])??0}}).filter(h=>h.count>0),u=i?r.slice(0,1):r;return u.length===0?o.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",a),title:l("agents.title"),children:[f.jsx(Bt,{level:"idle"}),f.jsx("span",{className:"text-tui-faint",children:l("agents.allIdle")})]}):f.jsx("span",{"data-testid":"agent-status-chip",className:ne("flex shrink-0 items-center gap-2 px-1",a),title:l("agents.title"),children:u.map(({status:h,level:m,count:p})=>f.jsxs("span",{className:"flex items-center gap-1 text-tui-muted",children:[f.jsx(Bt,{level:m}),f.jsx("span",{className:"text-tui-text",children:p}),f.jsx("span",{className:"text-tui-faint",children:l(`agents.${h}`)})]},h))})},zd=({onAddProfile:a,mobile:i=!1,statusBar:l=!1})=>{const{profiles:o,activeProfileId:r,activeProfile:u,switchProfile:h,renameProfile:m,removeProfile:p,t:g}=Le(),{connectionState:b}=et(),[v,w]=C.useState(!1),[x,T]=C.useState(null),[M,A]=C.useState(""),N=C.useRef(null);C.useEffect(()=>{if(!v)return;const L=z=>{N.current&&!N.current.contains(z.target)&&w(!1)};return document.addEventListener("pointerdown",L),()=>document.removeEventListener("pointerdown",L)},[v]);const R=(L,z)=>{T(L),A(z)},j=L=>{const z=M.trim();z&&m(L,z),T(null)},V=L=>{typeof window<"u"&&!window.confirm(g("profiles.removeConfirm"))||(p(L),T(null))},_=(u==null?void 0:u.displayName)||g("profiles.addHost"),D=b==="connected"?"ok":b==="connecting"||b==="reconnecting"?"warn":b==="error"?"bad":"idle";return f.jsxs("div",{ref:N,className:ne("relative min-w-0",i&&"w-full",l&&"flex-1"),children:[f.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":v,"aria-label":g("profiles.switcherLabel"),onClick:()=>w(L=>!L),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",l?"min-h-11 w-full max-w-none px-2":i?"min-h-11 w-full px-2":"min-h-[24px] max-w-[18rem] px-1"),children:[f.jsx(Bt,{level:D}),f.jsx("span",{className:ne("truncate text-tui-text",l&&"min-w-0 flex-1"),children:_}),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",l?"w-80 max-w-[calc(100vw-1rem)]":i?"inset-x-0 bottom-auto top-full mt-1 mb-0 w-full":"w-80 max-w-[calc(100vw-1rem)]"),children:[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")}),o.length===0?f.jsx("p",{className:"px-2 py-2 text-tui-sm text-tui-muted",children:g("profiles.empty")}):o.map(L=>{const z=L.id===r,U=L.id===x;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":z?"true":void 0,onClick:()=>{h(L.id),w(!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",z?"text-tui-accent":"text-tui-text"),children:[f.jsx("span",{"aria-hidden":"true",className:"w-3 shrink-0",children:z?ke.cursor:""}),f.jsxs("span",{className:"min-w-0 flex-1",children:[f.jsx("span",{className:"block truncate font-bold",children:L.displayName}),f.jsx("span",{className:"block truncate text-tui-sm text-tui-faint",title:L.hostname||L.hostId,children:L.hostname||L.hostId||L.wsUrl})]}),z&&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:()=>R(L.id,L.displayName),className:"tui-focusable min-h-11 min-w-11 px-2 text-tui-muted hover:text-tui-accent",children:ke.ellipsis})]}),U&&f.jsxs("div",{className:"flex items-center gap-1 px-2 pb-2",children:[f.jsx("input",{autoFocus:!0,value:M,maxLength:64,onChange:ee=>A(ee.target.value),onKeyDown:ee=>{ee.key==="Enter"&&j(L.id),ee.key==="Escape"&&T(null)},"aria-label":g("profiles.rename"),className:"tui-input min-w-0 flex-1 px-2 py-1 text-tui"}),f.jsx(Me,{onClick:()=>j(L.id),variant:"primary",className:"min-h-11",children:g("common.save")}),f.jsx(Me,{onClick:()=>V(L.id),variant:"danger",className:"min-h-11",children:g("profiles.remove")})]})]},L.id)}),f.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{w(!1),a()},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")})]})]})]})};function Uy(){const{updateStatus:a,ignoredUpdate:i}=et();return!!(a!=null&&a.updateAvailable)&&i!==(a==null?void 0:a.latest)}const Ky=({compact:a=!1,className:i})=>{const{t:l}=Le(),{updateStatus:o}=et(),r=Uy(),[u,h]=C.useState(!1);if(!r||!o)return null;const{latest:m,restartPending:p}=o,g=p?l("update.chipRestart",{version:m}):a?l("update.chipCompact",{version:m}):l("update.chip",{version:m});return f.jsxs(f.Fragment,{children:[f.jsx("button",{type:"button","data-testid":"update-chip",onClick:()=>h(!0),title:l("update.title"),className:ne("tui-focusable shrink-0 whitespace-nowrap px-1 text-tui-warn hover:underline",i),children:g}),f.jsx(B5,{isOpen:u,onClose:()=>h(!1)})]})},Wu=({command:a})=>{const{t:i}=Le(),{addToast:l}=on();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:a}),f.jsx(Me,{glyph:"⧉",className:"shrink-0",onClick:()=>{jd(a).then(o=>{l(o==="failed"?"error":"success",i(o==="failed"?"clipboard.copyFailed":"toasts.commandCopied"))})},children:i("common.copy")})]})},B5=({isOpen:a,onClose:i})=>{const{t:l}=Le(),{updateStatus:o,ignoreUpdate:r,hostname:u,hostId:h}=et();if(!o)return null;const{current:m,installed:p,latest:g,restartPending:b}=o;return f.jsx(hr,{isOpen:a,onClose:i,title:l("update.title"),closeLabel:l("common.closeDialog"),size:"md",footer:f.jsxs(f.Fragment,{children:[f.jsx(Me,{variant:"ghost",onClick:()=>{r(g),i()},children:l("update.ignore")}),f.jsx(Me,{variant:"primary",onClick:i,children:l("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(Si,{label:l("common.host"),labelWidth:10,children:u||h||"—"}),f.jsx(Si,{label:l("update.running"),labelWidth:10,children:m}),p!==m?f.jsx(Si,{label:l("update.installed"),labelWidth:10,children:p}):null,f.jsx(Si,{label:l("update.latest"),labelWidth:10,children:f.jsx("span",{className:"text-tui-ok",children:g})})]}),b?f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"leading-snug text-tui-text",children:l("update.restartPending",{version:p})}),f.jsx(Wu,{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}),l("update.stepTui")]}),f.jsx("p",{className:"leading-snug text-tui-muted",children:l("update.stepCli")}),f.jsx(Wu,{command:`npm install -g herdr-remote@${g} --prefer-online`}),f.jsx(Wu,{command:"herdr-remote restart"}),f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:l("update.restartNote")})]})]})})},U5=({onAddProfile:a=()=>{}})=>{const{settings:i,t:l}=Le(),{connectionState:o,role:r,hostId:u,assignedClientId:h,sharedWindowCount:m,rttMs:p,agentStatus:g}=et(),b=pr(o,l),v=o==="connected",w=Uy();return f.jsx(oy,{left:f.jsxs(f.Fragment,{children:[f.jsx(zd,{onAddProfile:a}),f.jsx(fd,{items:[f.jsxs("span",{className:"flex items-center gap-1",children:[f.jsx(Bt,{level:b.level}),f.jsx("span",{className:"text-tui-text",children:b.label})]},"status"),v?f.jsx(kd,{tone:r==="controller"?"ok":"warn",children:l(r==="controller"?"role.sharedControl":"common.viewer")},"role"):null,v&&m>1?f.jsx("span",{className:"text-tui-muted",children:l("role.sharedWindows",{count:m})},"windows"):null,u?f.jsxs("span",{children:[f.jsxs("span",{className:"text-tui-faint",children:[l("common.host"),":"]})," ",f.jsx("span",{className:"text-tui-text",children:u})]},"host"):null,f.jsxs("span",{children:[f.jsx("span",{className:"text-tui-faint",children:l("header.clientIdLabel")})," ",f.jsx("span",{className:"text-tui-text",children:h||i.clientId})]},"client")]})]}),right:f.jsx(fd,{items:[w?f.jsx(Ky,{},"update"):null,v&&H5(g)?f.jsx(By,{},"agents"):null,p!==null?f.jsxs("span",{className:"text-tui-muted",children:[l("header.latencyTitle"),": ",f.jsxs("span",{className:"text-tui-text",children:[p,"ms"]})]},"rtt"):null,f.jsx("span",{className:"hidden text-tui-faint sm:inline",children:l("header.tagline")},"mode")]})})},K5=({wsUrl:a,adminUrl:i,onOpenRemoteAdmin:l,onSignIn:o})=>{const{t:r}=Le();return f.jsxs(Tt,{title:r("admin.remoteRelayTitle"),bodyClassName:"space-y-2",children:[f.jsx("p",{className:"text-tui leading-snug text-tui-muted",children:r("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(Si,{label:r("admin.remoteRelayEndpoint"),labelWidth:18,children:f.jsx("code",{className:"break-all text-tui-accent",children:a})}),f.jsx(Si,{label:r("admin.remoteRelayAdminUrl"),labelWidth:18,children:f.jsx("code",{className:"break-all text-tui-ok",children:i})})]}),f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx(Me,{variant:"primary",onClick:l,glyph:ke.arrowRight,children:r("admin.openRemoteAdminBtn")}),f.jsx(Me,{onClick:o,children:r("admin.relayAdminLoginBtn")})]})]})},I5=({adminConfigured:a,isAuthError:i,tokenInput:l,onTokenInput:o,onSubmit:r,isSameOriginRelay:u,onBackToTerminal:h,showBack:m,onCancel:p})=>{const{t:g}=Le();return f.jsxs(Tt,{title:g("admin.relayAdminTitle"),bodyClassName:"space-y-2",children:[a===!1?f.jsx(Ti,{tone:"warn",children:g("admin.relayAdminNotConfigured")}):i?f.jsx(Ti,{tone:"bad",children:g("admin.relayAdminAuthError")}):f.jsx(Ti,{tone:"accent",children:g("admin.relayAdminPrompt")}),f.jsxs("form",{onSubmit:r,className:"space-y-2",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(Fn,{htmlFor:"relay-admin-token",children:g("admin.relayAdminTokenLabel")}),f.jsx(Et,{id:"relay-admin-token",type:"password",autoComplete:"current-password",value:l,onChange:b=>o(b.target.value),placeholder:g("admin.relayAdminTokenPlaceholder")})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(Me,{variant:"primary",type:"submit",disabled:!l.trim(),children:g("admin.relayAdminLoginBtn")}),u?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")})]})]})]})},F5=({onOpenPairing:a,onRetry:i})=>{const{t:l}=Le(),{copied:o,copy:r}=mr(),u=o!==null,h=()=>r(ea,l("toasts.commandCopied"));return f.jsxs(Tt,{title:l("admin.unauthorizedTitle"),tone:"bad",bodyClassName:"space-y-2",children:[f.jsx(Ti,{tone:"bad",children:l("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:l("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:ea}),f.jsx(Me,{onClick:h,glyph:u?ke.check:"⧉",className:ne("shrink-0",u&&"border-tui-ok text-tui-ok"),children:l(u?"admin.copiedJson":"common.copy")})]}),f.jsx("p",{className:"text-tui-sm text-tui-faint",children:l("admin.pairingStepsHelp")})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[a&&f.jsx(Me,{variant:"primary",onClick:a,children:l("admin.enterPairCodeBtn")}),f.jsx(Me,{onClick:i,children:l("admin.retryFetchBtn")})]})]})},G5=[[/\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"]],Y5=[[/\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 Xg(a,i){for(const[l,o]of a)if(l.test(i))return o;return null}function Hd(a){const i=typeof a=="string"?a.trim():"";if(!i)return{label:"",raw:""};const l=Xg(G5,i),o=Xg(Y5,i);return l&&o?{label:`${l} · ${o}`,raw:i}:l?{label:l,raw:i}:o?{label:o,raw:i}:{label:i.length>32?`${i.slice(0,32)}…`:i,raw:i}}function Xa(a){if(!a||a<=0)return"0 B";const i=1024,l=["B","KB","MB","GB","TB"],o=Math.min(l.length-1,Math.floor(Math.log(a)/Math.log(i)));return`${(a/i**o).toFixed(1)} ${l[o]}`}function Qg(a,i,l=!1){const o=Math.max(0,Math.floor(a)),r=Math.floor(o/86400),u=Math.floor(o%86400/3600),h=Math.floor(o%3600/60),m=o%60,p=(b,v)=>`${b}${i(`admin.unit${v}`)}`,g=r>0?[p(r,"Day"),p(u,"Hour"),p(h,"Minute")]:u>0?[p(u,"Hour"),p(h,"Minute"),p(m,"Second")]:[p(h,"Minute"),p(m,"Second")];return(l?g.slice(0,2):g).join(" ")}function Bd(a,i,l=Date.now()){if(!a)return"—";const o=new Date(a).getTime();if(Number.isNaN(o))return"—";const r=Math.max(0,Math.floor((l-o)/1e3));return r<60?i("admin.relJustNow"):r<3600?i("admin.relMinutes",{count:Math.floor(r/60)}):r<86400?i("admin.relHours",{count:Math.floor(r/3600)}):i("admin.relDays",{count:Math.floor(r/86400)})}function Ud(a){if(!a)return"";const i=new Date(a);return Number.isNaN(i.getTime())?"":i.toLocaleString()}function Iy(a=[]){const i=new Map;for(const l of a)l.deviceId&&i.set(l.deviceId,(i.get(l.deviceId)||0)+1);return i}const $5=({clients:a})=>{const{t:i}=Le(),l=a.some(r=>r.hostId),o=[{key:"id",header:i("admin.colClientId"),render:r=>f.jsxs("span",{className:"flex items-center gap-1.5",children:[f.jsx(Bt,{level:"ok"}),f.jsx("span",{className:"font-bold text-tui-text",children:r.id})]})},...l?[{key:"host",header:i("admin.colHost"),render:r=>f.jsx("span",{className:"text-tui-text",children:r.hostId||"—"})}]:[],{key:"role",header:i("admin.colRole"),width:10,render:r=>{const u=r.role==="controller";return f.jsx(kd,{tone:u?"ok":"warn",className:"text-tui-sm",children:i(u?"common.controller":"common.viewer")})}},{key:"device",header:i("admin.colDevice"),render:r=>{const u=Hd(r.userAgent);return f.jsxs("span",{className:"flex min-w-0 items-baseline gap-1.5",children:[f.jsx("span",{className:u.label?"text-tui-text":"text-tui-faint",title:u.raw,children:u.label||i("admin.unknownDevice")}),r.deviceId?f.jsx("code",{className:"text-tui-sm text-tui-faint",children:r.deviceId}):null]})}},{key:"ip",header:i("admin.colIp"),render:r=>f.jsx("span",{className:"text-tui-muted",children:r.ip||"127.0.0.1"})},{key:"connectedAt",header:i("admin.colConnectedAt"),render:r=>f.jsx("span",{className:"whitespace-nowrap text-tui-muted",title:Ud(r.connectedAt),children:r.connectedAt?Bd(r.connectedAt,i):i("admin.startedRecently")})},{key:"traffic",header:i("admin.colTraffic"),align:"right",render:r=>f.jsxs("span",{className:"whitespace-nowrap",children:[f.jsxs("span",{className:"text-tui-accent",children:["↓",Xa(r.bytesReceived||0)]}),f.jsx("span",{"aria-hidden":"true",className:"mx-1 text-tui-faint",children:"/"}),f.jsxs("span",{className:"text-tui-ok",children:["↑",Xa(r.bytesSent||0)]})]})}];return f.jsx(Tt,{title:i("admin.connectedClientsTitle",{count:a.length}),bodyClassName:"-mx-1",children:f.jsx(Rd,{columns:o,items:a,rowKey:r=>r.id,empty:i("admin.noClients")})})},q5=({devices:a,clients:i,onRevoke:l})=>{const{t:o}=Le(),[r,u]=C.useState(null),[h,m]=C.useState(null),p=Iy(i),g=[...a].sort((w,x)=>{const T=+!!p.get(x.deviceId)-+!!p.get(w.deviceId);return T||(Date.parse(x.lastSeenAt)||0)-(Date.parse(w.lastSeenAt)||0)}),b=async w=>{if(r!==w){u(w);return}m(w);try{await l(w)}finally{m(null),u(null)}},v=[{key:"status",header:o("admin.colStatus"),width:12,render:w=>{const x=p.get(w.deviceId)||0;return f.jsxs("span",{className:ne("flex items-center gap-1.5 whitespace-nowrap",x?"text-tui-ok":"text-tui-faint"),children:[f.jsx(Bt,{level:x?"ok":"idle"}),o(x?"admin.hostStatusOnline":"admin.hostStatusOffline")]})}},{key:"device",header:o("admin.colDevice"),render:w=>{const x=Hd(w.userAgent);return f.jsxs("span",{className:"flex min-w-0 items-baseline gap-1.5",children:[f.jsx("span",{className:"text-tui-text",title:x.raw,children:x.label||o("admin.unknownDevice")}),f.jsx("code",{className:"text-tui-sm text-tui-faint",children:w.deviceId})]})}},{key:"host",header:o("admin.colHost"),render:w=>f.jsx("span",{className:"text-tui-text",children:w.hostId||"—"})},{key:"ip",header:o("admin.colIp"),render:w=>f.jsx("span",{className:"text-tui-muted",children:w.lastIp||"—"})},{key:"lastSeen",header:o("admin.colLastSeen"),render:w=>{const x=p.get(w.deviceId)||0;return f.jsx("span",{className:ne("whitespace-nowrap",x?"text-tui-ok":"text-tui-muted"),title:Ud(w.lastSeenAt),children:x?o("admin.deviceWindows",{count:x}):Bd(w.lastSeenAt,o)})}},{key:"actions",header:o("admin.colActions"),align:"right",render:w=>{const x=r===w.deviceId,T=h===w.deviceId;return f.jsx(Me,{variant:"danger",disabled:T,onClick:()=>void b(w.deviceId),onBlur:()=>u(M=>M===w.deviceId?null:M),"aria-label":o("admin.revokeDevice"),className:ne("h-6 py-0 text-tui-sm",x&&"bg-tui-bad text-tui-crust"),children:T?f.jsx(na,{}):o(x?"admin.revokeConfirm":"admin.revokeDevice")})}}];return f.jsx(Tt,{title:o("admin.pairedDevicesTitle",{count:a.length}),bodyClassName:"-mx-1",children:f.jsx(Rd,{columns:v,items:g,rowKey:w=>w.deviceId,empty:o("admin.noDevices")})})},Zg={online:"ok",busy:"ok",reconnecting:"warn",offline:"idle"};function V5(a=[],i=[]){const l=new Map;for(const u of i){if(!(u!=null&&u.hostId))continue;const h=l.get(u.hostId);h?h.push(u):l.set(u.hostId,[u])}const o=a.map(u=>{const h=l.get(u.id)||[];return{id:u.id,hostname:u.hostname||u.id,status:u.status||"online",connectedDeviceCount:u.connectedDeviceCount??0,pairedDeviceCount:u.pairedDeviceCount??h.length,activePtyCount:u.activePtyCount??0,devices:h,fromRosterOnly:!1}}),r=new Set(o.map(u=>u.id));for(const[u,h]of l)r.has(u)||o.push({id:u,hostname:u,status:"offline",connectedDeviceCount:0,pairedDeviceCount:h.length,activePtyCount:0,devices:h,fromRosterOnly:!0});return o.sort((u,h)=>u.fromRosterOnly!==h.fromRosterOnly?u.fromRosterOnly?1:-1:u.hostname.localeCompare(h.hostname))}const P5=({hosts:a,devices:i,clients:l})=>{const{t:o}=Le(),r=V5(a,i),u=Iy(l),h={online:o("admin.hostStatusOnline"),busy:o("admin.hostStatusBusy"),reconnecting:o("admin.hostStatusReconnecting"),offline:o("admin.hostStatusOffline")};return f.jsx(Tt,{title:o("admin.hostsTitle",{count:r.length}),bodyClassName:"space-y-2",children:r.length===0?f.jsx("p",{className:"px-1 py-2 text-tui text-tui-faint",children:o("admin.noHosts")}):r.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(Bt,{level:Zg[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(kd,{tone:Zg[m.status],className:"ml-1 text-tui-sm",children:h[m.status]})]}),f.jsx(fd,{className:"shrink-0 text-tui-sm",items:[f.jsx("span",{className:m.connectedDeviceCount?"text-tui-ok":"text-tui-faint",children:o("admin.hostConnectedDevices",{count:m.connectedDeviceCount})},"connected"),f.jsx("span",{className:"text-tui-muted",children:o("admin.hostPairedDevices",{count:m.pairedDeviceCount})},"paired"),m.fromRosterOnly?null:f.jsx("span",{className:m.activePtyCount?"text-tui-info":"text-tui-faint",children:o("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=Hd(p.userAgent),b=u.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_12ch]",children:[f.jsx(Bt,{level:b?"ok":"idle"}),f.jsx("span",{className:"truncate text-tui-text",title:g.raw,children:g.label||o("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("truncate text-right text-tui-sm",b?"text-tui-ok":"text-tui-faint"),title:Ud(p.lastSeenAt),children:b?o("admin.deviceWindows",{count:b}):Bd(p.lastSeenAt,o)})]},p.deviceId)})}):f.jsx("p",{className:"px-2 py-1 text-tui-sm text-tui-faint",children:m.pairedDeviceCount>0?o("admin.hostRosterOperatorOnly"):o("admin.noDevices")})]},m.id))})},X5=({data:a})=>{var r,u,h,m,p,g,b,v,w,x;const{t:i}=Le(),l=a.activeUserCount??((r=a.clients)==null?void 0:r.length)??0,o=new Set((a.devices||[]).map(T=>T.hostId).filter(T=>T&&!(a.hosts||[]).some(M=>M.id===T))).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(Ga,{label:i("admin.connectedHosts"),value:((u=a.hosts)==null?void 0:u.length)||0,sub:o?i("admin.hostsOfflineSub",{count:o}):void 0,tone:(h=a.hosts)!=null&&h.length?"ok":"idle"}),f.jsx(Ga,{label:i("admin.activeUsers"),value:l,sub:i("admin.acrossWindows",{count:((m=a.clients)==null?void 0:m.length)||0}),tone:l?"accent":"idle"}),f.jsx(Ga,{label:i("admin.activePtys"),value:((p=a.ptys)==null?void 0:p.length)||0,sub:i("admin.terminalShells"),tone:(g=a.ptys)!=null&&g.length?"info":"idle"}),f.jsx(Ga,{label:i("admin.statInbound"),value:i("admin.perSecond",{value:Xa(((b=a.throughput)==null?void 0:b.bytesInPerSec)||0)}),sub:i("admin.statTotal",{value:Xa(((v=a.throughput)==null?void 0:v.bytesIn)||0)}),tone:"accent"}),f.jsx(Ga,{label:i("admin.statOutbound"),value:i("admin.perSecond",{value:Xa(((w=a.throughput)==null?void 0:w.bytesOutPerSec)||0)}),sub:i("admin.statTotal",{value:Xa(((x=a.throughput)==null?void 0:x.bytesOut)||0)}),tone:"ok"}),f.jsx(Ga,{label:i("admin.uptime"),value:Qg(a.uptimeSeconds||0,i,!0),title:Qg(a.uptimeSeconds||0,i),sub:a.startTime?i("admin.startedAt",{time:new Date(a.startTime).toLocaleTimeString()}):i("admin.startedRecently")})]}),f.jsx(P5,{hosts:a.hosts||[],devices:a.devices,clients:a.clients||[]})]})},Q5=({ptys:a})=>{const{t:i}=Le(),l=a.some(r=>r.hostId),o=[{key:"id",header:i("admin.colPtyId"),render:r=>f.jsx("span",{className:"font-bold text-tui-accent",children:r.id})},...l?[{key:"host",header:i("admin.colHost"),render:r=>f.jsx("span",{className:"text-tui-text",children:r.hostId})}]:[],{key:"pid",header:i("admin.colPid"),width:9,render:r=>f.jsx("span",{className:"text-tui-muted",children:r.pid})},{key:"command",header:i("admin.colCommand"),render:r=>f.jsx("code",{className:"border border-tui-border-dim bg-tui-mantle px-1 text-tui-text",children:r.command})},{key:"grid",header:i("admin.colGrid"),width:11,render:r=>f.jsxs("span",{className:"whitespace-nowrap text-tui-muted",children:[r.cols,f.jsx("span",{"aria-hidden":"true",className:"mx-0.5 text-tui-faint",children:"×"}),r.rows]})},{key:"cwd",header:i("admin.colCwd"),className:"max-w-xs truncate",render:r=>f.jsx("span",{className:"text-tui-muted",children:r.cwd||"~"})},{key:"viewers",header:i("admin.colViewers"),align:"right",width:9,render:r=>f.jsx("span",{className:"font-bold text-tui-ok",children:r.activeClients})}];return f.jsx(Tt,{title:i("admin.activePtysTitle",{count:a.length}),bodyClassName:"-mx-1",children:f.jsx(Rd,{columns:o,items:a,rowKey:r=>r.id,empty:i("admin.noPtys")})})};function xd(a){if(typeof window>"u"||!a||a.startsWith("/"))return"";try{const i=new URL(a.replace(/^ws/,"http")),l=i.pathname.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"");return i.origin===window.location.origin&&!l?"":`${i.origin}${l}`}catch{return""}}function ds(a,i){const l=xd(a);return l?`${l}${i.startsWith("/")?i:`/${i}`}`:i}async function Z5(a){try{const l=await fetch(ds(a,"/api/info"),{headers:{Accept:"application/json"}});if(l.ok)return await l.json()}catch{}return{ok:!0,version:"0.1.0",protocol:1,relayMode:!!(a&&!a.startsWith("/")&&!a.includes("localhost")&&!a.includes("127.0.0.1")&&typeof window<"u"&&!a.startsWith(window.location.origin.replace("http","ws")))?"remote":"local",adminConfigured:!1,adminPath:"/admin",adminStatusPath:"/api/admin/status"}}async function Wg(a,i){const l=await fetch(a,{headers:{Accept:"application/json",...i}});if(l.status===401||l.status===403)return{kind:"denied",status:l.status};if(!l.ok)throw new Error(`HTTP ${l.status}: ${l.statusText}`);return{kind:"ok",data:await l.json()}}async function W5(a,i,l){return(await fetch(ds(a,`/api/admin/devices/${encodeURIComponent(l)}`),{method:"DELETE",headers:{Accept:"application/json","X-Relay-Admin-Token":i}})).ok}function J5(a,i,l){return a!=null&&a.adminPath?a.publicUrl?`${a.publicUrl.replace(/\/$/,"")}${a.adminPath}`:ds(l,a.adminPath):i!=null&&i.remoteAdminUrl?i.remoteAdminUrl:l?ds(l,"/admin"):"/admin"}function eM({wsUrl:a,deviceToken:i,adminToken:l,relayOrigin:o,refreshInterval:r,t:u}){const[h,m]=C.useState(null),[p,g]=C.useState(null),[b,v]=C.useState(!1),[w,x]=C.useState(!0),[T,M]=C.useState(null),[A,N]=C.useState(!1),[R,j]=C.useState(null);C.useEffect(()=>{m(null),g(null),v(!1)},[o]),C.useEffect(()=>{let U=!0;return x(!0),Z5(a).then(ee=>{U&&(g(ee),v(!0))}),()=>{U=!1}},[a,o]);const V=(p==null?void 0:p.relayMode)==="remote",_=C.useCallback((U,ee)=>{if(U.kind==="denied"){N(!0),M(ee),m(null);return}m(U.data),M(null),N(!1),j(new Date)},[]),D=C.useCallback((U,ee)=>{N(!1),M(U instanceof Error?U.message:ee),m(null)},[]),L=C.useCallback(async()=>{if(b){if(V){if(!l){m(null),x(!1),M(null),N(!1);return}try{x(!0);const U=await Wg(ds(a,(p==null?void 0:p.adminStatusPath)||"/api/admin/status"),{"X-Relay-Admin-Token":l});_(U,u("admin.relayAdminAuthError"))}catch(U){console.warn("GET /api/admin/status request failed:",U),D(U,"Failed to fetch remote admin status")}finally{x(!1)}return}try{x(!0);const U=await Wg("/api/status",i?{Authorization:`Bearer ${i}`}:{});_(U,U.kind==="denied"?`Authentication failed (HTTP ${U.status}): Access denied. Please configure an authorized token or pair with the host.`:"")}catch(U){console.warn("GET /api/status request failed:",U),D(U,"Failed to fetch status")}finally{x(!1)}}},[b,V,l,p,i,a,o,u]),z=C.useCallback(async U=>{try{if(!await W5(a,l,U)){M(u("admin.revokeFailed"));return}await L()}catch{M(u("admin.revokeFailed"))}},[l,L,a,u]);return C.useEffect(()=>{if(!b)return;L();let U=null;const ee=()=>{r>0&&!U&&(U=setInterval(()=>{document.visibilityState==="visible"&&L()},r))},q=()=>{U&&(clearInterval(U),U=null)},P=()=>{document.visibilityState==="visible"?(L(),ee()):q()};return ee(),document.addEventListener("visibilitychange",P),()=>{q(),document.removeEventListener("visibilitychange",P)}},[b,L,r]),{data:h,relayInfo:p,infoLoaded:b,isRemoteRelay:V,loading:w,error:T,isAuthError:A,lastUpdated:R,fetchStatus:L,revokeDevice:z}}const Ju="h-7 py-0",tM=({onBackToTerminal:a,onOpenPairing:i,showBack:l=!1})=>{var ye,xe,me;const{settings:o,updateSettings:r,t:u}=Le(),h=xd(o.wsUrl)||(typeof window<"u"?window.location.origin:"local"),m=((ye=o.adminTokens)==null?void 0:ye[h])||(h===(typeof window<"u"?window.location.origin:"local")?o.adminToken:"")||"",[p,g]=C.useState(3e3),[b,v]=C.useState("overview"),[w,x]=C.useState(m),[T,M]=C.useState(m),[A,N]=C.useState(!!m),R=!xd(o.wsUrl);C.useEffect(()=>{x(m),M(m),N(!!m)},[h]);const{data:j,relayInfo:V,infoLoaded:_,isRemoteRelay:D,loading:L,error:z,isAuthError:U,lastUpdated:ee,fetchStatus:q,revokeDevice:P}=eM({wsUrl:o.wsUrl,deviceToken:o.token,adminToken:T,relayOrigin:h,refreshInterval:p,t:u}),ie=de=>{de.preventDefault();const we=w.trim();r({adminToken:we,adminTokens:{...o.adminTokens||{},[h]:we}}),M(we),N(!!we)},ae=J5(V,j,o.wsUrl),F=j?[{id:"overview",label:u("admin.tabOverview"),index:1},{id:"clients",label:u("admin.tabClients",{count:((xe=j.clients)==null?void 0:xe.length)||0}),index:2},{id:"ptys",label:u("admin.tabPtys",{count:((me=j.ptys)==null?void 0:me.length)||0}),index:3},...j.devices?[{id:"devices",label:u("admin.tabDevices",{count:j.devices.length}),index:4}]:[]]:[],E=F.map(de=>de.id).join("|");C.useEffect(()=>{const de=E?E.split("|"):[],we=oe=>{if(oe.ctrlKey||oe.altKey||oe.metaKey)return;const Se=oe.target;if(Se instanceof HTMLInputElement||Se instanceof HTMLTextAreaElement||Se instanceof HTMLSelectElement||Se!=null&&Se.isContentEditable||document.querySelector('[role="dialog"]'))return;if(oe.key==="Escape"&&a){oe.preventDefault(),a();return}if(oe.key.toLowerCase()==="r"){oe.preventDefault(),q();return}const se=Number.parseInt(oe.key,10)-1;Number.isInteger(se)&&se>=0&&se<de.length&&(oe.preventDefault(),v(de[se]))};return window.addEventListener("keydown",we),()=>window.removeEventListener("keydown",we)},[q,a,E]);const Y=(V==null?void 0:V.version)||(j==null?void 0:j.version)||"0.1.0",X=l&&a?f.jsx(Me,{variant:"ghost",onClick:a,title:u("admin.returnToTerminal"),"aria-label":u("admin.returnToTerminal"),glyph:ke.arrowLeft,brackets:!1,className:Ju,children:f.jsx("span",{className:"sr-only",children:u("admin.returnToTerminal")})}):null,le=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",Y]}),f.jsx(Nd,{}),f.jsx("span",{className:D?"text-tui-alt":"text-tui-ok",children:u(D?"admin.modeRemote":"admin.localWorkstationBadge")})]}),j?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:u("admin.autoRefresh")}),f.jsxs(dr,{value:p,onChange:de=>g(Number(de.target.value)),"aria-label":u("admin.autoRefresh"),className:ne("w-auto",Ju),children:[f.jsx("option",{value:0,children:u("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:q,disabled:L,title:u("admin.refreshNow"),className:Ju,children:L?f.jsx(na,{}):u("admin.refreshNow")})]}):null]}),Q=_&&D&&!A&&!R,ve=_&&D&&(A||R)&&!j;return f.jsxs(xS,{tabs:F,activeTabId:b,onSelectTab:de=>v(de),tabsAriaLabel:u("header.mainNavigationAria"),toolbarStart:X,toolbarAside:le,hints:[...j?[{keys:"1–4",action:u("admin.hintTabs")},{keys:"r",action:u("admin.hintRefresh")}]:[],...a?[{keys:"esc",action:u("admin.hintBack")}]:[]],footerAside:ee?f.jsx("span",{className:"text-tui-faint",children:u("admin.updatedAt",{time:ee.toLocaleTimeString()})}):null,bodyClassName:"space-y-3 pb-2",children:[!_&&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(na,{label:u("admin.loadingStatus")})}),Q&&f.jsx(K5,{wsUrl:o.wsUrl,adminUrl:ae,onOpenRemoteAdmin:()=>window.open(ae,"_blank","noopener,noreferrer"),onSignIn:()=>N(!0)}),ve&&f.jsx(I5,{adminConfigured:V==null?void 0:V.adminConfigured,isAuthError:U,tokenInput:w,onTokenInput:x,onSubmit:ie,isSameOriginRelay:R,onBackToTerminal:a,showBack:l,onCancel:()=>N(!1)}),_&&!D&&U&&f.jsx(F5,{onOpenPairing:i,onRetry:q}),_&&z&&!U&&f.jsx(Ti,{tone:"warn",action:f.jsx(Me,{variant:"warn",onClick:q,children:u("common.retry")}),children:u("admin.errorConnecting",{error:z})}),j&&f.jsxs(f.Fragment,{children:[b==="overview"&&f.jsx(X5,{data:j}),b==="clients"&&f.jsx($5,{clients:j.clients||[]}),b==="ptys"&&f.jsx(Q5,{ptys:j.ptys||[]}),b==="devices"&&f.jsx(q5,{devices:j.devices||[],clients:j.clients||[],onRevoke:P})]})]})},nM=({compact:a=!1})=>{const{t:i}=Le(),{role:l,connectionState:o,sharedWindowCount:r,assignedClientId:u}=et();if(!(o==="connected"))return f.jsxs("div",{className:"inline-flex select-none items-center gap-1.5 text-tui uppercase text-tui-faint",role:"status","aria-label":i("terminal.offlineStatusAria"),children:[f.jsx(Bt,{level:"idle"}),f.jsx("span",{children:i("common.offline")})]});const m=l==="controller",p=r>1,g=f.jsxs("div",{className:ne("inline-flex min-w-0 select-none items-center gap-1.5 text-tui uppercase",m?"text-tui-ok":"text-tui-warn"),role:"status","aria-label":i(m?"role.controllerMode":"role.viewerMode"),children:[f.jsx(Bt,{level:m?"ok":"warn"}),f.jsx("span",{className:"truncate",children:i(m?"role.sharedControl":"role.viewerReadOnly")}),p?f.jsx("span",{className:"shrink-0 normal-case text-tui-muted",children:i("role.sharedWindows",{count:r})}):null]});return a?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:i("role.sharedControlDesc")}),u?f.jsx(Si,{label:i("role.thisWindow"),labelWidth:9,className:"text-tui-sm",children:f.jsx("span",{className:"truncate text-tui-muted",children:u})}):null]})},Qo="tui-focusable group flex h-11 w-full select-none items-center gap-2 border px-2 text-left text-tui transition-colors",Zo="border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",iM="border-tui-accent bg-tui-selection text-tui-accent",Wo=({active:a=!1})=>f.jsx("span",{"aria-hidden":"true",className:ne("shrink-0",a?"text-tui-accent":"text-tui-faint group-hover:text-tui-accent"),children:ke.cursor}),aM=({onClose:a,onOpenPairing:i,onOpenSettings:l,onAddProfile:o=()=>{}})=>{const{settings:r,updateSettings:u,language:h,setLanguage:m,t:p}=Le(),{connectionState:g,stateDetail:b,rttMs:v,hostId:w,connect:x}=et(),{addToast:T}=on(),{copied:M,copy:A}=mr(),N=M!==null,R=pr(g,p),j=D=>()=>{var z;const L=document.activeElement;(z=L==null?void 0:L.blur)==null||z.call(L),D()},V=()=>A(r.clientId,p("toasts.clientIdCopied",{id:r.clientId}),"info"),_=()=>{const D=h==="zh"?"en":"zh";m(D),T("info",wd(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:a,"aria-label":p("mobile.closeSessionControls"),children:"esc"})]}),f.jsx(Tt,{title:p("profiles.title"),tone:"accent",bodyClassName:"space-y-1",children:f.jsx(zd,{mobile:!0,onAddProfile:o})}),f.jsxs(Tt,{title:p("common.status"),tone:R.level==="ok"?"ok":R.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(Bt,{level:R.level}),f.jsx("span",{className:"truncate text-tui uppercase text-tui-text",children:R.label}),g==="connected"&&v!==null&&f.jsxs("span",{className:"text-tui-sm text-tui-muted",children:[v,"ms"]})]}),R.actionLabel&&f.jsx(Me,{variant:"primary",onClick:()=>x(),className:"shrink-0",children:R.actionLabel})]}),R.needsAttention&&b&&f.jsx("p",{className:"text-tui-sm leading-snug text-tui-muted",children:b}),w&&f.jsx(Si,{label:p("common.host"),labelWidth:9,children:w}),f.jsxs("button",{type:"button",onClick:V,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:r.clientId}),f.jsx("span",{"aria-hidden":"true",className:ne("shrink-0",N?"text-tui-ok":"text-tui-faint"),children:N?ke.check:"⧉"})]})]}),f.jsx(Tt,{title:p("mobile.inputControl"),tone:"accent","aria-label":p("mobile.terminalControlAria"),children:f.jsx(nM,{})}),f.jsxs(Tt,{title:p("mobile.menu"),tone:"accent",bodyClassName:"flex flex-col gap-1",children:[f.jsxs("button",{type:"button",onClick:_,className:ne(Qo,Zo),"aria-label":p("header.languageToggleTitle"),children:[f.jsx(Wo,{}),f.jsx("span",{className:"truncate",children:h==="zh"?"English":"中文"})]}),f.jsxs("button",{type:"button",onClick:j(l),className:ne(Qo,Zo),"aria-label":p("mobile.settingsAria"),children:[f.jsx(Wo,{}),f.jsx("span",{className:"truncate",children:p("common.settings")})]}),f.jsxs("button",{type:"button",onClick:j(i),className:ne(Qo,Zo),"aria-label":p("mobile.pairingAria"),children:[f.jsx(Wo,{}),f.jsx("span",{className:"truncate",children:p("common.pairing")})]}),f.jsxs("button",{type:"button",onClick:()=>u({toolbarVisible:!r.toolbarVisible}),className:ne(Qo,r.toolbarVisible?iM:Zo),"aria-label":p("mobile.keybarAria"),"aria-pressed":r.toolbarVisible,children:[f.jsx(Wo,{active:r.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:r.toolbarVisible?"[x]":"[ ]"})]})]})]})},lM=({onAddProfile:a})=>{const{t:i}=Le(),{rttMs:l}=et();return f.jsxs("footer",{"data-testid":"mobile-status-bar",role:"status","aria-label":i("mobile.statusBarAria"),className:"absolute inset-x-0 bottom-0 z-40 flex h-11 shrink-0 items-center gap-2 border-t border-tui-border bg-tui-mantle px-1 text-tui-sm",children:[f.jsx(zd,{statusBar:!0,onAddProfile:a}),f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-border",children:"│"}),f.jsx(By,{compact:!0}),f.jsx(Ky,{compact:!0}),f.jsxs("span",{className:"flex shrink-0 items-center gap-1 px-1 text-tui-muted",title:i("header.latencyTitle"),children:[f.jsx("span",{className:"text-tui-faint",children:"RTT"}),f.jsx("span",{className:ne(l===null?"text-tui-faint":"text-tui-text"),children:l===null?"—":`${l}ms`})]})]})},sM=({onOpenPairing:a,onOpenSettings:i,onAddProfile:l=()=>{}})=>{const{t:o}=Le(),{connectionState:r,isController:u}=et(),[h,m]=C.useState(!1),p=C.useRef(null),g=C.useCallback(()=>m(!1),[]);C.useEffect(()=>{if(!h)return;const v=w=>{if(!(w.ctrlKey||w.altKey||w.metaKey)&&w.key==="Escape"){const x=w.target;x&&typeof x.closest=="function"&&!!x.closest("#terminal-container")||(w.stopPropagation(),w.preventDefault(),g())}};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[h,g]),C.useEffect(()=>{var v;h&&((v=p.current)==null||v.focus({preventScroll:!0}))},[h]);const b=pr(r,o);return f.jsxs(f.Fragment,{children:[f.jsxs("div",{"data-testid":"mobile-topbar",role:"toolbar","aria-label":o("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(Nd,{className:"shrink-0"}),f.jsx(Bt,{level:b.level}),f.jsx("span",{className:"truncate uppercase",children:b.label})]}),f.jsxs("button",{type:"button","data-testid":"mobile-chrome-trigger",onClick:()=>m(!0),"aria-label":o("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",b.needsAttention?"border-tui-warn text-tui-warn":u?"border-tui-border text-tui-muted":"border-tui-accent text-tui-accent"),children:[!u&&!b.needsAttention&&f.jsx("span",{className:"max-w-[8rem] truncate",children:o("common.viewer")}),f.jsx("span",{"aria-hidden":"true",className:"text-tui",children:ke.chevronDown}),f.jsx("span",{"aria-hidden":"true",children:o("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":o("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(aM,{onClose:g,onOpenPairing:()=>{g(),a()},onOpenSettings:()=>{g(),i()},onAddProfile:()=>{g(),l()}})})]}),f.jsx(lM,{onAddProfile:l})]})},oM=()=>{const{activeProfile:a,t:i}=Le(),{herdrLaunch:l,startHerdr:o,hostname:r}=et();if(!l)return null;const u=r||(a==null?void 0:a.displayName)||i("herdrLaunch.thisHost"),h=l.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(Tt,{title:i(h?"herdrLaunch.failedTitle":"herdrLaunch.title"),tone:h?"bad":"warn",className:"w-full max-w-md",bodyClassName:"space-y-3","aria-label":i("herdrLaunch.title"),children:l.phase==="starting"?f.jsxs("p",{className:"flex items-center gap-2 text-tui-text",role:"status",children:[f.jsx(na,{}),f.jsx("span",{children:i("herdrLaunch.starting",{host:u})})]}):f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"leading-snug text-tui-text",children:i("herdrLaunch.body",{host:u})}),h&&l.message?f.jsx(Ti,{tone:"bad",children:f.jsx("pre",{className:"max-h-40 overflow-y-auto whitespace-pre-wrap break-words font-mono text-tui-sm",children:l.message})}):null,f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:i("herdrLaunch.scope")}),f.jsx("div",{className:"flex justify-end",children:f.jsx(Me,{variant:"primary",onClick:o,autoFocus:!0,children:i(h?"common.retry":"herdrLaunch.start")})})]})})})},Fy="--app-height",Gy="--keyboard-inset",rM=80;function cM(){if(typeof window>"u")return{height:768,keyboardInset:0};const a=window.innerHeight||768,i=window.visualViewport;if(i&&typeof i.height=="number"&&i.height>0){const l=a-i.height-(i.offsetTop||0),o=l>=rM?Math.round(l):0;return{height:Math.round(i.height),keyboardInset:o}}return{height:a,keyboardInset:0}}function Jg(a,i=cM()){return a.style.setProperty(Fy,`${i.height}px`),a.style.setProperty(Gy,`${i.keyboardInset}px`),i}function uM(a=typeof document<"u"?document.documentElement:null){if(!a||typeof window>"u")return()=>{};let i=null;const l=()=>{i=null,Jg(a)},o=()=>{if(i===null){if(typeof requestAnimationFrame!="function"){l();return}i=requestAnimationFrame(l)}};Jg(a);const r=window.visualViewport;return r==null||r.addEventListener("resize",o),r==null||r.addEventListener("scroll",o),window.addEventListener("resize",o),window.addEventListener("orientationchange",o),()=>{i!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(i),i=null),r==null||r.removeEventListener("resize",o),r==null||r.removeEventListener("scroll",o),window.removeEventListener("resize",o),window.removeEventListener("orientationchange",o),a.style.removeProperty(Fy),a.style.removeProperty(Gy)}}const dM=900;function eb(){if(typeof window>"u")return!1;const a=Za();return a<Cd?!0:a<=dM}function fM(){const[a,i]=C.useState(eb);return C.useEffect(()=>{var r,u;const l=()=>{const h=eb();i(m=>m===h?m:h)};l();let o=null;try{o=typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null}catch{o=null}return(r=o==null?void 0:o.addEventListener)==null||r.call(o,"change",l),window.addEventListener("resize",l),window.addEventListener("orientationchange",l),(u=window.visualViewport)==null||u.addEventListener("resize",l),()=>{var h,m;(h=o==null?void 0:o.removeEventListener)==null||h.call(o,"change",l),window.removeEventListener("resize",l),window.removeEventListener("orientationchange",l),(m=window.visualViewport)==null||m.removeEventListener("resize",l)}},[]),a}function hM(a){const i=a.target;if(!i)return!1;if(i.id==="terminal-container"||i.id==="terminal-frame"||i.id==="terminal-surface"||i.classList.contains("xterm-helper-textarea")||i.classList.contains("xterm")||i.closest("#terminal-container")||i.closest(".xterm"))return!0;if(typeof document<"u"&&document.activeElement){const l=document.activeElement;if(l.id==="terminal-container"||l.classList.contains("xterm-helper-textarea")||l.closest("#terminal-container")||l.closest(".xterm"))return!0}return!1}function mM(a,i={}){if(typeof window>"u")return()=>{};const l=o=>{var r;o.ctrlKey||o.altKey||o.metaKey||o.key==="Escape"&&(i.isModalOpen||i.isSheetOpen)&&(hM(o)||(o.preventDefault(),o.stopPropagation(),(r=a.onCloseModals)==null||r.call(a)))};return window.addEventListener("keydown",l),()=>{window.removeEventListener("keydown",l)}}function pM(){const[a,i]=C.useState("terminal"),[l,o]=C.useState(!1),[r,u]=C.useState(!1),[h,m]=C.useState(!1),[p,g]=C.useState(void 0),b=ae=>{g(ae),m(!0)},[v,w]=C.useState(!1),{updateSettings:x,settings:T}=Le(),{connectionState:M,stateDetail:A,stateCode:N,lastPairedAt:R}=et();w1();const j=fM();C.useEffect(()=>uM(),[]),C.useEffect(()=>{pb()},[]),C.useEffect(()=>{const ae=l||h||v;if(ae)return mM({onCloseModals:()=>{o(!1),m(!1),w(!1)}},{isModalOpen:ae})},[l,h,v]),C.useEffect(()=>{const ae=()=>{const F=window.location.pathname,E=window.location.hash;i(F==="/admin"||E==="#admin"?"admin":"terminal")};ae(),window.addEventListener("popstate",ae),window.addEventListener("hashchange",ae);try{const F=new URL(window.location.href),E=F.searchParams.get("token"),Y=F.searchParams.get("pairCode"),X=F.searchParams.get("ws")||F.searchParams.get("wsUrl"),le={};E&&(le.token=E),Y&&(le.pairCode=Y.toUpperCase()),X&&(le.wsUrl=X),Object.keys(le).length>0&&x(le);let Q=!1;if(F.searchParams.has("token")&&(F.searchParams.delete("token"),Q=!0),F.searchParams.has("pairCode")&&(F.searchParams.delete("pairCode"),Q=!0),Q){const ve=F.searchParams.toString(),ye=F.pathname+(ve?`?${ve}`:"")+F.hash;window.history.replaceState({},"",ye)}}catch(F){console.warn("Failed to parse URL query params:",F)}return()=>{window.removeEventListener("popstate",ae),window.removeEventListener("hashchange",ae)}},[x]);const V=(ae=!1)=>{u(ae),o(!0)},_=()=>{o(!1),u(!1)},D=ae=>{i(ae),ae==="admin"?window.history.pushState({},"","/admin"):window.history.pushState({},"","/")},L=!T.token&&!T.pairCode&&M!=="connected",z=M==="error"&&(["auth_required","unauthorized","device_revoked"].includes(N||"")||/auth|unauthor|forbidden|permission|token|pair/i.test(A||"")),U=L||z,[ee,q]=C.useState(!U);C.useEffect(()=>{U||q(!0)},[U]),C.useEffect(()=>{R&&(o(!1),q(!0),i("terminal"))},[R]);const P=a==="terminal"&&!U,ie=ae=>({visibility:ae?"visible":"hidden",opacity:ae?1:0,pointerEvents:ae?"auto":"none",zIndex:ae?1:0});return f.jsxs("div",{"data-testid":"app-shell",style:j?{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:ae=>{ae.preventDefault(),ae.stopPropagation()},children:[!j&&f.jsx(SS,{currentView:a,onNavigate:D,onOpenPairing:()=>V(!1),onOpenSettings:()=>b(),onToggleVirtualKeyboard:()=>w(!v),isVirtualKeyboardOpen:v}),!j&&!U&&f.jsx(CS,{}),f.jsxs("div",{className:"flex-1 min-h-0 w-full overflow-hidden relative",children:[ee&&f.jsxs("div",{"data-testid":"terminal-layer",className:`absolute ${j?"inset-x-0 top-12 bottom-11":"inset-0"} flex flex-col min-h-0 w-full overflow-hidden`,style:ie(P),"aria-hidden":!P,children:[f.jsx(o5,{isActive:P}),!j&&f.jsx(C5,{isOpen:v,onClose:()=>w(!1)}),f.jsx(w5,{compact:j,onCustomize:()=>b("agentKeymaps")}),f.jsx(oM,{}),f.jsx(L5,{})]}),a==="terminal"&&U&&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(c5,{onPairedSuccess:()=>{}})}),a==="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(tM,{onBackToTerminal:()=>D("terminal"),onOpenPairing:()=>V(!1),showBack:j})}),j&&P&&f.jsx(sM,{onOpenPairing:()=>V(!1),onOpenSettings:()=>b(),onAddProfile:()=>V(!0)})]}),!j&&a!=="admin"&&f.jsx(U5,{onAddProfile:()=>V(!0)}),f.jsx(M5,{isOpen:l,isAddMode:r,onClose:_}),f.jsx(j5,{isOpen:h,initialTab:p,onClose:()=>m(!1),onOpenAdmin:()=>{m(!1),D("admin")}}),f.jsx(z5,{})]})}function gM(){return f.jsx(c1,{children:f.jsx(pM,{})})}const Yy=document.getElementById("root");if(!Yy)throw new Error("Root element not found");px.createRoot(Yy).render(f.jsx(qn.StrictMode,{children:f.jsx(gM,{})}));
|