Files
MultiRoombaRover/server/public/assets/index-BJ-_H4qI.js
T
2026-02-24 23:15:31 -05:00

126 lines
496 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const f of document.querySelectorAll('link[rel="modulepreload"]'))o(f);new MutationObserver(f=>{for(const d of f)if(d.type==="childList")for(const h of d.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&o(h)}).observe(document,{childList:!0,subtree:!0});function i(f){const d={};return f.integrity&&(d.integrity=f.integrity),f.referrerPolicy&&(d.referrerPolicy=f.referrerPolicy),f.crossOrigin==="use-credentials"?d.credentials="include":f.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function o(f){if(f.ep)return;f.ep=!0;const d=i(f);fetch(f.href,d)}})();function Ry(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var Eu={exports:{}},Qs={};var X0;function Ty(){if(X0)return Qs;X0=1;var a=Symbol.for("react.transitional.element"),l=Symbol.for("react.fragment");function i(o,f,d){var h=null;if(d!==void 0&&(h=""+d),f.key!==void 0&&(h=""+f.key),"key"in f){d={};for(var p in f)p!=="key"&&(d[p]=f[p])}else d=f;return f=d.ref,{$$typeof:a,type:o,key:h,ref:f!==void 0?f:null,props:d}}return Qs.Fragment=l,Qs.jsx=i,Qs.jsxs=i,Qs}var Q0;function Dy(){return Q0||(Q0=1,Eu.exports=Ty()),Eu.exports}var r=Dy(),Cu={exports:{}},ye={};var K0;function _y(){if(K0)return ye;K0=1;var a=Symbol.for("react.transitional.element"),l=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),h=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),v=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),j=Symbol.iterator;function M(C){return C===null||typeof C!="object"?null:(C=j&&C[j]||C["@@iterator"],typeof C=="function"?C:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},q=Object.assign,N={};function E(C,_,W){this.props=C,this.context=_,this.refs=N,this.updater=W||w}E.prototype.isReactComponent={},E.prototype.setState=function(C,_){if(typeof C!="object"&&typeof C!="function"&&C!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,C,_,"setState")},E.prototype.forceUpdate=function(C){this.updater.enqueueForceUpdate(this,C,"forceUpdate")};function S(){}S.prototype=E.prototype;function T(C,_,W){this.props=C,this.context=_,this.refs=N,this.updater=W||w}var z=T.prototype=new S;z.constructor=T,q(z,E.prototype),z.isPureReactComponent=!0;var L=Array.isArray;function $(){}var O={H:null,A:null,T:null,S:null},V=Object.prototype.hasOwnProperty;function X(C,_,W){var te=W.ref;return{$$typeof:a,type:C,key:_,ref:te!==void 0?te:null,props:W}}function Z(C,_){return X(C.type,_,C.props)}function F(C){return typeof C=="object"&&C!==null&&C.$$typeof===a}function ae(C){var _={"=":"=0",":":"=2"};return"$"+C.replace(/[=:]/g,function(W){return _[W]})}var oe=/\/+/g;function me(C,_){return typeof C=="object"&&C!==null&&C.key!=null?ae(""+C.key):_.toString(36)}function G(C){switch(C.status){case"fulfilled":return C.value;case"rejected":throw C.reason;default:switch(typeof C.status=="string"?C.then($,$):(C.status="pending",C.then(function(_){C.status==="pending"&&(C.status="fulfilled",C.value=_)},function(_){C.status==="pending"&&(C.status="rejected",C.reason=_)})),C.status){case"fulfilled":return C.value;case"rejected":throw C.reason}}throw C}function k(C,_,W,te,le){var ie=typeof C;(ie==="undefined"||ie==="boolean")&&(C=null);var ue=!1;if(C===null)ue=!0;else switch(ie){case"bigint":case"string":case"number":ue=!0;break;case"object":switch(C.$$typeof){case a:case l:ue=!0;break;case y:return ue=C._init,k(ue(C._payload),_,W,te,le)}}if(ue)return le=le(C),ue=te===""?"."+me(C,0):te,L(le)?(W="",ue!=null&&(W=ue.replace(oe,"$&/")+"/"),k(le,_,W,"",function(Ce){return Ce})):le!=null&&(F(le)&&(le=Z(le,W+(le.key==null||C&&C.key===le.key?"":(""+le.key).replace(oe,"$&/")+"/")+ue)),_.push(le)),1;ue=0;var ve=te===""?".":te+":";if(L(C))for(var he=0;he<C.length;he++)te=C[he],ie=ve+me(te,he),ue+=k(te,_,W,ie,le);else if(he=M(C),typeof he=="function")for(C=he.call(C),he=0;!(te=C.next()).done;)te=te.value,ie=ve+me(te,he++),ue+=k(te,_,W,ie,le);else if(ie==="object"){if(typeof C.then=="function")return k(G(C),_,W,te,le);throw _=String(C),Error("Objects are not valid as a React child (found: "+(_==="[object Object]"?"object with keys {"+Object.keys(C).join(", ")+"}":_)+"). If you meant to render a collection of children, use an array instead.")}return ue}function Q(C,_,W){if(C==null)return C;var te=[],le=0;return k(C,te,"","",function(ie){return _.call(W,ie,le++)}),te}function P(C){if(C._status===-1){var _=C._result;_=_(),_.then(function(W){(C._status===0||C._status===-1)&&(C._status=1,C._result=W)},function(W){(C._status===0||C._status===-1)&&(C._status=2,C._result=W)}),C._status===-1&&(C._status=0,C._result=_)}if(C._status===1)return C._result.default;throw C._result}var re=typeof reportError=="function"?reportError:function(C){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var _=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof C=="object"&&C!==null&&typeof C.message=="string"?String(C.message):String(C),error:C});if(!window.dispatchEvent(_))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",C);return}console.error(C)},ce={map:Q,forEach:function(C,_,W){Q(C,function(){_.apply(this,arguments)},W)},count:function(C){var _=0;return Q(C,function(){_++}),_},toArray:function(C){return Q(C,function(_){return _})||[]},only:function(C){if(!F(C))throw Error("React.Children.only expected to receive a single React element child.");return C}};return ye.Activity=b,ye.Children=ce,ye.Component=E,ye.Fragment=i,ye.Profiler=f,ye.PureComponent=T,ye.StrictMode=o,ye.Suspense=g,ye.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O,ye.__COMPILER_RUNTIME={__proto__:null,c:function(C){return O.H.useMemoCache(C)}},ye.cache=function(C){return function(){return C.apply(null,arguments)}},ye.cacheSignal=function(){return null},ye.cloneElement=function(C,_,W){if(C==null)throw Error("The argument must be a React element, but you passed "+C+".");var te=q({},C.props),le=C.key;if(_!=null)for(ie in _.key!==void 0&&(le=""+_.key),_)!V.call(_,ie)||ie==="key"||ie==="__self"||ie==="__source"||ie==="ref"&&_.ref===void 0||(te[ie]=_[ie]);var ie=arguments.length-2;if(ie===1)te.children=W;else if(1<ie){for(var ue=Array(ie),ve=0;ve<ie;ve++)ue[ve]=arguments[ve+2];te.children=ue}return X(C.type,le,te)},ye.createContext=function(C){return C={$$typeof:h,_currentValue:C,_currentValue2:C,_threadCount:0,Provider:null,Consumer:null},C.Provider=C,C.Consumer={$$typeof:d,_context:C},C},ye.createElement=function(C,_,W){var te,le={},ie=null;if(_!=null)for(te in _.key!==void 0&&(ie=""+_.key),_)V.call(_,te)&&te!=="key"&&te!=="__self"&&te!=="__source"&&(le[te]=_[te]);var ue=arguments.length-2;if(ue===1)le.children=W;else if(1<ue){for(var ve=Array(ue),he=0;he<ue;he++)ve[he]=arguments[he+2];le.children=ve}if(C&&C.defaultProps)for(te in ue=C.defaultProps,ue)le[te]===void 0&&(le[te]=ue[te]);return X(C,ie,le)},ye.createRef=function(){return{current:null}},ye.forwardRef=function(C){return{$$typeof:p,render:C}},ye.isValidElement=F,ye.lazy=function(C){return{$$typeof:y,_payload:{_status:-1,_result:C},_init:P}},ye.memo=function(C,_){return{$$typeof:v,type:C,compare:_===void 0?null:_}},ye.startTransition=function(C){var _=O.T,W={};O.T=W;try{var te=C(),le=O.S;le!==null&&le(W,te),typeof te=="object"&&te!==null&&typeof te.then=="function"&&te.then($,re)}catch(ie){re(ie)}finally{_!==null&&W.types!==null&&(_.types=W.types),O.T=_}},ye.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()},ye.use=function(C){return O.H.use(C)},ye.useActionState=function(C,_,W){return O.H.useActionState(C,_,W)},ye.useCallback=function(C,_){return O.H.useCallback(C,_)},ye.useContext=function(C){return O.H.useContext(C)},ye.useDebugValue=function(){},ye.useDeferredValue=function(C,_){return O.H.useDeferredValue(C,_)},ye.useEffect=function(C,_){return O.H.useEffect(C,_)},ye.useEffectEvent=function(C){return O.H.useEffectEvent(C)},ye.useId=function(){return O.H.useId()},ye.useImperativeHandle=function(C,_,W){return O.H.useImperativeHandle(C,_,W)},ye.useInsertionEffect=function(C,_){return O.H.useInsertionEffect(C,_)},ye.useLayoutEffect=function(C,_){return O.H.useLayoutEffect(C,_)},ye.useMemo=function(C,_){return O.H.useMemo(C,_)},ye.useOptimistic=function(C,_){return O.H.useOptimistic(C,_)},ye.useReducer=function(C,_,W){return O.H.useReducer(C,_,W)},ye.useRef=function(C){return O.H.useRef(C)},ye.useState=function(C){return O.H.useState(C)},ye.useSyncExternalStore=function(C,_,W){return O.H.useSyncExternalStore(C,_,W)},ye.useTransition=function(){return O.H.useTransition()},ye.version="19.2.0",ye}var F0;function Sf(){return F0||(F0=1,Cu.exports=_y()),Cu.exports}var m=Sf();const Ia=Ry(m);var qu={exports:{}},Ks={},Mu={exports:{}},ku={};var Z0;function Oy(){return Z0||(Z0=1,(function(a){function l(k,Q){var P=k.length;k.push(Q);e:for(;0<P;){var re=P-1>>>1,ce=k[re];if(0<f(ce,Q))k[re]=Q,k[P]=ce,P=re;else break e}}function i(k){return k.length===0?null:k[0]}function o(k){if(k.length===0)return null;var Q=k[0],P=k.pop();if(P!==Q){k[0]=P;e:for(var re=0,ce=k.length,C=ce>>>1;re<C;){var _=2*(re+1)-1,W=k[_],te=_+1,le=k[te];if(0>f(W,P))te<ce&&0>f(le,W)?(k[re]=le,k[te]=P,re=te):(k[re]=W,k[_]=P,re=_);else if(te<ce&&0>f(le,P))k[re]=le,k[te]=P,re=te;else break e}}return Q}function f(k,Q){var P=k.sortIndex-Q.sortIndex;return P!==0?P:k.id-Q.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;a.unstable_now=function(){return d.now()}}else{var h=Date,p=h.now();a.unstable_now=function(){return h.now()-p}}var g=[],v=[],y=1,b=null,j=3,M=!1,w=!1,q=!1,N=!1,E=typeof setTimeout=="function"?setTimeout:null,S=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;function z(k){for(var Q=i(v);Q!==null;){if(Q.callback===null)o(v);else if(Q.startTime<=k)o(v),Q.sortIndex=Q.expirationTime,l(g,Q);else break;Q=i(v)}}function L(k){if(q=!1,z(k),!w)if(i(g)!==null)w=!0,$||($=!0,ae());else{var Q=i(v);Q!==null&&G(L,Q.startTime-k)}}var $=!1,O=-1,V=5,X=-1;function Z(){return N?!0:!(a.unstable_now()-X<V)}function F(){if(N=!1,$){var k=a.unstable_now();X=k;var Q=!0;try{e:{w=!1,q&&(q=!1,S(O),O=-1),M=!0;var P=j;try{t:{for(z(k),b=i(g);b!==null&&!(b.expirationTime>k&&Z());){var re=b.callback;if(typeof re=="function"){b.callback=null,j=b.priorityLevel;var ce=re(b.expirationTime<=k);if(k=a.unstable_now(),typeof ce=="function"){b.callback=ce,z(k),Q=!0;break t}b===i(g)&&o(g),z(k)}else o(g);b=i(g)}if(b!==null)Q=!0;else{var C=i(v);C!==null&&G(L,C.startTime-k),Q=!1}}break e}finally{b=null,j=P,M=!1}Q=void 0}}finally{Q?ae():$=!1}}}var ae;if(typeof T=="function")ae=function(){T(F)};else if(typeof MessageChannel<"u"){var oe=new MessageChannel,me=oe.port2;oe.port1.onmessage=F,ae=function(){me.postMessage(null)}}else ae=function(){E(F,0)};function G(k,Q){O=E(function(){k(a.unstable_now())},Q)}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(k){k.callback=null},a.unstable_forceFrameRate=function(k){0>k||125<k?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):V=0<k?Math.floor(1e3/k):5},a.unstable_getCurrentPriorityLevel=function(){return j},a.unstable_next=function(k){switch(j){case 1:case 2:case 3:var Q=3;break;default:Q=j}var P=j;j=Q;try{return k()}finally{j=P}},a.unstable_requestPaint=function(){N=!0},a.unstable_runWithPriority=function(k,Q){switch(k){case 1:case 2:case 3:case 4:case 5:break;default:k=3}var P=j;j=k;try{return Q()}finally{j=P}},a.unstable_scheduleCallback=function(k,Q,P){var re=a.unstable_now();switch(typeof P=="object"&&P!==null?(P=P.delay,P=typeof P=="number"&&0<P?re+P:re):P=re,k){case 1:var ce=-1;break;case 2:ce=250;break;case 5:ce=1073741823;break;case 4:ce=1e4;break;default:ce=5e3}return ce=P+ce,k={id:y++,callback:Q,priorityLevel:k,startTime:P,expirationTime:ce,sortIndex:-1},P>re?(k.sortIndex=P,l(v,k),i(g)===null&&k===i(v)&&(q?(S(O),O=-1):q=!0,G(L,P-re))):(k.sortIndex=ce,l(g,k),w||M||(w=!0,$||($=!0,ae()))),k},a.unstable_shouldYield=Z,a.unstable_wrapCallback=function(k){var Q=j;return function(){var P=j;j=Q;try{return k.apply(this,arguments)}finally{j=P}}}})(ku)),ku}var J0;function By(){return J0||(J0=1,Mu.exports=Oy()),Mu.exports}var Ru={exports:{}},Nt={};var I0;function zy(){if(I0)return Nt;I0=1;var a=Sf();function l(g){var v="https://react.dev/errors/"+g;if(1<arguments.length){v+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)v+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+g+"; visit "+v+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var o={d:{f:i,r:function(){throw Error(l(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},f=Symbol.for("react.portal");function d(g,v,y){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:f,key:b==null?null:""+b,children:g,containerInfo:v,implementation:y}}var h=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function p(g,v){if(g==="font")return"";if(typeof v=="string")return v==="use-credentials"?v:""}return Nt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,Nt.createPortal=function(g,v){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!v||v.nodeType!==1&&v.nodeType!==9&&v.nodeType!==11)throw Error(l(299));return d(g,v,null,y)},Nt.flushSync=function(g){var v=h.T,y=o.p;try{if(h.T=null,o.p=2,g)return g()}finally{h.T=v,o.p=y,o.d.f()}},Nt.preconnect=function(g,v){typeof g=="string"&&(v?(v=v.crossOrigin,v=typeof v=="string"?v==="use-credentials"?v:"":void 0):v=null,o.d.C(g,v))},Nt.prefetchDNS=function(g){typeof g=="string"&&o.d.D(g)},Nt.preinit=function(g,v){if(typeof g=="string"&&v&&typeof v.as=="string"){var y=v.as,b=p(y,v.crossOrigin),j=typeof v.integrity=="string"?v.integrity:void 0,M=typeof v.fetchPriority=="string"?v.fetchPriority:void 0;y==="style"?o.d.S(g,typeof v.precedence=="string"?v.precedence:void 0,{crossOrigin:b,integrity:j,fetchPriority:M}):y==="script"&&o.d.X(g,{crossOrigin:b,integrity:j,fetchPriority:M,nonce:typeof v.nonce=="string"?v.nonce:void 0})}},Nt.preinitModule=function(g,v){if(typeof g=="string")if(typeof v=="object"&&v!==null){if(v.as==null||v.as==="script"){var y=p(v.as,v.crossOrigin);o.d.M(g,{crossOrigin:y,integrity:typeof v.integrity=="string"?v.integrity:void 0,nonce:typeof v.nonce=="string"?v.nonce:void 0})}}else v==null&&o.d.M(g)},Nt.preload=function(g,v){if(typeof g=="string"&&typeof v=="object"&&v!==null&&typeof v.as=="string"){var y=v.as,b=p(y,v.crossOrigin);o.d.L(g,y,{crossOrigin:b,integrity:typeof v.integrity=="string"?v.integrity:void 0,nonce:typeof v.nonce=="string"?v.nonce:void 0,type:typeof v.type=="string"?v.type:void 0,fetchPriority:typeof v.fetchPriority=="string"?v.fetchPriority:void 0,referrerPolicy:typeof v.referrerPolicy=="string"?v.referrerPolicy:void 0,imageSrcSet:typeof v.imageSrcSet=="string"?v.imageSrcSet:void 0,imageSizes:typeof v.imageSizes=="string"?v.imageSizes:void 0,media:typeof v.media=="string"?v.media:void 0})}},Nt.preloadModule=function(g,v){if(typeof g=="string")if(v){var y=p(v.as,v.crossOrigin);o.d.m(g,{as:typeof v.as=="string"&&v.as!=="script"?v.as:void 0,crossOrigin:y,integrity:typeof v.integrity=="string"?v.integrity:void 0})}else o.d.m(g)},Nt.requestFormReset=function(g){o.d.r(g)},Nt.unstable_batchedUpdates=function(g,v){return g(v)},Nt.useFormState=function(g,v,y){return h.H.useFormState(g,v,y)},Nt.useFormStatus=function(){return h.H.useHostTransitionStatus()},Nt.version="19.2.0",Nt}var W0;function Ly(){if(W0)return Ru.exports;W0=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(l){console.error(l)}}return a(),Ru.exports=zy(),Ru.exports}var P0;function Uy(){if(P0)return Ks;P0=1;var a=By(),l=Sf(),i=Ly();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 f(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function d(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 p(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function g(e){if(d(e)!==e)throw Error(o(188))}function v(e){var t=e.alternate;if(!t){if(t=d(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 u=c.alternate;if(u===null){if(s=c.return,s!==null){n=s;continue}break}if(c.child===u.child){for(u=c.child;u;){if(u===n)return g(c),e;if(u===s)return g(c),t;u=u.sibling}throw Error(o(188))}if(n.return!==s.return)n=c,s=u;else{for(var x=!1,A=c.child;A;){if(A===n){x=!0,n=c,s=u;break}if(A===s){x=!0,s=c,n=u;break}A=A.sibling}if(!x){for(A=u.child;A;){if(A===n){x=!0,n=u,s=c;break}if(A===s){x=!0,s=u,n=c;break}A=A.sibling}if(!x)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 y(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=y(e),t!==null)return t;e=e.sibling}return null}var b=Object.assign,j=Symbol.for("react.element"),M=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),q=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),S=Symbol.for("react.consumer"),T=Symbol.for("react.context"),z=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),$=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),V=Symbol.for("react.lazy"),X=Symbol.for("react.activity"),Z=Symbol.for("react.memo_cache_sentinel"),F=Symbol.iterator;function ae(e){return e===null||typeof e!="object"?null:(e=F&&e[F]||e["@@iterator"],typeof e=="function"?e:null)}var oe=Symbol.for("react.client.reference");function me(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===oe?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case q:return"Fragment";case E:return"Profiler";case N:return"StrictMode";case L:return"Suspense";case $:return"SuspenseList";case X:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case w:return"Portal";case T:return e.displayName||"Context";case S:return(e._context.displayName||"Context")+".Consumer";case z:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case O:return t=e.displayName||null,t!==null?t:me(e.type)||"Memo";case V:t=e._payload,e=e._init;try{return me(e(t))}catch{}}return null}var G=Array.isArray,k=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P={pending:!1,data:null,method:null,action:null},re=[],ce=-1;function C(e){return{current:e}}function _(e){0>ce||(e.current=re[ce],re[ce]=null,ce--)}function W(e,t){ce++,re[ce]=e.current,e.current=t}var te=C(null),le=C(null),ie=C(null),ue=C(null);function ve(e,t){switch(W(ie,t),W(le,e),W(te,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?h0(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=h0(t),e=p0(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}_(te),W(te,e)}function he(){_(te),_(le),_(ie)}function Ce(e){e.memoizedState!==null&&W(ue,e);var t=te.current,n=p0(t,e.type);t!==n&&(W(le,e),W(te,n))}function ne(e){le.current===e&&(_(te),_(le)),ue.current===e&&(_(ue),Ys._currentValue=P)}var se,Se;function Oe(e){if(se===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);se=t&&t[1]||"",Se=-1<n.stack.indexOf(`
at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
`+se+e+Se}var Ne=!1;function ze(e,t){if(!e||Ne)return"";Ne=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(t){var ee=function(){throw Error()};if(Object.defineProperty(ee.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ee,[])}catch(K){var Y=K}Reflect.construct(e,[],ee)}else{try{ee.call()}catch(K){Y=K}e.call(ee.prototype)}}else{try{throw Error()}catch(K){Y=K}(ee=e())&&typeof ee.catch=="function"&&ee.catch(function(){})}}catch(K){if(K&&Y&&typeof K.stack=="string")return[K.stack,Y.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 u=s.DetermineComponentFrameRoot(),x=u[0],A=u[1];if(x&&A){var R=x.split(`
`),H=A.split(`
`);for(c=s=0;s<R.length&&!R[s].includes("DetermineComponentFrameRoot");)s++;for(;c<H.length&&!H[c].includes("DetermineComponentFrameRoot");)c++;if(s===R.length||c===H.length)for(s=R.length-1,c=H.length-1;1<=s&&0<=c&&R[s]!==H[c];)c--;for(;1<=s&&0<=c;s--,c--)if(R[s]!==H[c]){if(s!==1||c!==1)do if(s--,c--,0>c||R[s]!==H[c]){var J=`
`+R[s].replace(" at new "," at ");return e.displayName&&J.includes("<anonymous>")&&(J=J.replace("<anonymous>",e.displayName)),J}while(1<=s&&0<=c);break}}}finally{Ne=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Oe(n):""}function an(e,t){switch(e.tag){case 26:case 27:case 5:return Oe(e.type);case 16:return Oe("Lazy");case 13:return e.child!==t&&t!==null?Oe("Suspense Fallback"):Oe("Suspense");case 19:return Oe("SuspenseList");case 0:case 15:return ze(e.type,!1);case 11:return ze(e.type.render,!1);case 1:return ze(e.type,!0);case 31:return Oe("Activity");default:return""}}function wa(e){try{var t="",n=null;do t+=an(e,n),n=e,e=e.return;while(e);return t}catch(s){return`
Error generating stack: `+s.message+`
`+s.stack}}var Wn=Object.prototype.hasOwnProperty,it=a.unstable_scheduleCallback,ln=a.unstable_cancelCallback,fo=a.unstable_shouldYield,mo=a.unstable_requestPaint,mt=a.unstable_now,Pa=a.unstable_getCurrentPriorityLevel,el=a.unstable_ImmediatePriority,sn=a.unstable_UserBlockingPriority,Ea=a.unstable_NormalPriority,gi=a.unstable_LowPriority,tl=a.unstable_IdlePriority,ho=a.log,ts=a.unstable_setDisableYieldValue,rn=null,pt=null;function Yt(e){if(typeof ho=="function"&&ts(e),pt&&typeof pt.setStrictMode=="function")try{pt.setStrictMode(rn,e)}catch{}}var rt=Math.clz32?Math.clz32:xo,po=Math.log,nl=Math.LN2;function xo(e){return e>>>=0,e===0?32:31-(po(e)/nl|0)|0}var Ca=256,Fe=262144,al=4194304;function _t(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 Pn(e,t,n){var s=e.pendingLanes;if(s===0)return 0;var c=0,u=e.suspendedLanes,x=e.pingedLanes;e=e.warmLanes;var A=s&134217727;return A!==0?(s=A&~u,s!==0?c=_t(s):(x&=A,x!==0?c=_t(x):n||(n=A&~e,n!==0&&(c=_t(n))))):(A=s&~u,A!==0?c=_t(A):x!==0?c=_t(x):n||(n=s&~e,n!==0&&(c=_t(n)))),c===0?0:t!==0&&t!==c&&(t&u)===0&&(u=c&-c,n=t&-t,u>=n||u===32&&(n&4194048)!==0)?t:c}function xn(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function vi(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 yi(){var e=al;return al<<=1,(al&62914560)===0&&(al=4194304),e}function ns(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function qa(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function bi(e,t,n,s,c,u){var x=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 A=e.entanglements,R=e.expirationTimes,H=e.hiddenUpdates;for(n=x&~n;0<n;){var J=31-rt(n),ee=1<<J;A[J]=0,R[J]=-1;var Y=H[J];if(Y!==null)for(H[J]=null,J=0;J<Y.length;J++){var K=Y[J];K!==null&&(K.lane&=-536870913)}n&=~ee}s!==0&&$t(e,s,0),u!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=u&~(x&~t))}function $t(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var s=31-rt(t);e.entangledLanes|=t,e.entanglements[s]=e.entanglements[s]|1073741824|n&261930}function xe(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var s=31-rt(n),c=1<<s;c&t|e[s]&t&&(e[s]|=t),n&=~c}}function Xe(e,t){var n=t&-t;return n=(n&42)!==0?1:Qe(n),(n&(e.suspendedLanes|t))!==0?0:n}function Qe(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 je(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Le(){var e=Q.p;return e!==0?e:(e=window.event,e===void 0?32:L0(e.type))}function vt(e,t){var n=Q.p;try{return Q.p=e,t()}finally{Q.p=n}}var Et=Math.random().toString(36).slice(2),Pe="__reactFiber$"+Et,Te="__reactProps$"+Et,Gt="__reactContainer$"+Et,go="__reactEvents$"+Et,bg="__reactListeners$"+Et,Sg="__reactHandles$"+Et,td="__reactResources$"+Et,as="__reactMarker$"+Et;function vo(e){delete e[Pe],delete e[Te],delete e[go],delete e[bg],delete e[Sg]}function ll(e){var t=e[Pe];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Gt]||n[Pe]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=A0(e);e!==null;){if(n=e[Pe])return n;e=A0(e)}return t}e=n,n=e.parentNode}return null}function sl(e){if(e=e[Pe]||e[Gt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function ls(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function il(e){var t=e[td];return t||(t=e[td]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function xt(e){e[as]=!0}var nd=new Set,ad={};function Ma(e,t){rl(e,t),rl(e+"Capture",t)}function rl(e,t){for(ad[e]=t,e=0;e<t.length;e++)nd.add(t[e])}var Ag=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]*$"),ld={},sd={};function jg(e){return Wn.call(sd,e)?!0:Wn.call(ld,e)?!1:Ag.test(e)?sd[e]=!0:(ld[e]=!0,!1)}function Si(e,t,n){if(jg(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 Ai(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 Xt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function id(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Ng(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,u=s.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(x){n=""+x,u.call(this,x)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return n},setValue:function(x){n=""+x},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function yo(e){if(!e._valueTracker){var t=id(e)?"checked":"value";e._valueTracker=Ng(e,t,""+e[t])}}function rd(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=id(e)?e.checked?"true":"false":e.value),e=s,e!==n?(t.setValue(e),!0):!1}function ji(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 wg=/[\n"\\]/g;function Qt(e){return e.replace(wg,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function bo(e,t,n,s,c,u,x,A){e.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?e.type=x:e.removeAttribute("type"),t!=null?x==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Xt(t)):e.value!==""+Xt(t)&&(e.value=""+Xt(t)):x!=="submit"&&x!=="reset"||e.removeAttribute("value"),t!=null?So(e,x,Xt(t)):n!=null?So(e,x,Xt(n)):s!=null&&e.removeAttribute("value"),c==null&&u!=null&&(e.defaultChecked=!!u),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?e.name=""+Xt(A):e.removeAttribute("name")}function od(e,t,n,s,c,u,x,A){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(e.type=u),t!=null||n!=null){if(!(u!=="submit"&&u!=="reset"||t!=null)){yo(e);return}n=n!=null?""+Xt(n):"",t=t!=null?""+Xt(t):n,A||t===e.value||(e.value=t),e.defaultValue=t}s=s??c,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=A?e.checked:!!s,e.defaultChecked=!!s,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(e.name=x),yo(e)}function So(e,t,n){t==="number"&&ji(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function ol(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=""+Xt(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 cd(e,t,n){if(t!=null&&(t=""+Xt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Xt(n):""}function ud(e,t,n,s){if(t==null){if(s!=null){if(n!=null)throw Error(o(92));if(G(s)){if(1<s.length)throw Error(o(93));s=s[0]}n=s}n==null&&(n=""),t=n}n=Xt(t),e.defaultValue=n,s=e.textContent,s===n&&s!==""&&s!==null&&(e.value=s),yo(e)}function cl(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Eg=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 fd(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||Eg.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function dd(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&&fd(e,c,s)}else for(var u in t)t.hasOwnProperty(u)&&fd(e,u,t[u])}function Ao(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 Cg=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"]]),qg=/^[\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 Ni(e){return qg.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function qn(){}var jo=null;function No(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ul=null,fl=null;function md(e){var t=sl(e);if(t&&(e=t.stateNode)){var n=e[Te]||null;e:switch(e=t.stateNode,t.type){case"input":if(bo(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+Qt(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var s=n[t];if(s!==e&&s.form===e.form){var c=s[Te]||null;if(!c)throw Error(o(90));bo(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&&rd(s)}break e;case"textarea":cd(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&ol(e,!!n.multiple,t,!1)}}}var wo=!1;function hd(e,t,n){if(wo)return e(t,n);wo=!0;try{var s=e(t);return s}finally{if(wo=!1,(ul!==null||fl!==null)&&(fr(),ul&&(t=ul,e=fl,fl=ul=null,md(t),e)))for(t=0;t<e.length;t++)md(e[t])}}function ss(e,t){var n=e.stateNode;if(n===null)return null;var s=n[Te]||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"),Eo=!1;if(Mn)try{var is={};Object.defineProperty(is,"passive",{get:function(){Eo=!0}}),window.addEventListener("test",is,is),window.removeEventListener("test",is,is)}catch{Eo=!1}var ea=null,Co=null,wi=null;function pd(){if(wi)return wi;var e,t=Co,n=t.length,s,c="value"in ea?ea.value:ea.textContent,u=c.length;for(e=0;e<n&&t[e]===c[e];e++);var x=n-e;for(s=1;s<=x&&t[n-s]===c[u-s];s++);return wi=c.slice(e,1<s?1-s:void 0)}function Ei(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 Ci(){return!0}function xd(){return!1}function Ct(e){function t(n,s,c,u,x){this._reactName=n,this._targetInst=c,this.type=s,this.nativeEvent=u,this.target=x,this.currentTarget=null;for(var A in e)e.hasOwnProperty(A)&&(n=e[A],this[A]=n?n(u):u[A]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?Ci:xd,this.isPropagationStopped=xd,this}return b(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=Ci)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Ci)},persist:function(){},isPersistent:Ci}),t}var ka={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},qi=Ct(ka),rs=b({},ka,{view:0,detail:0}),Mg=Ct(rs),qo,Mo,os,Mi=b({},rs,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ro,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!==os&&(os&&e.type==="mousemove"?(qo=e.screenX-os.screenX,Mo=e.screenY-os.screenY):Mo=qo=0,os=e),qo)},movementY:function(e){return"movementY"in e?e.movementY:Mo}}),gd=Ct(Mi),kg=b({},Mi,{dataTransfer:0}),Rg=Ct(kg),Tg=b({},rs,{relatedTarget:0}),ko=Ct(Tg),Dg=b({},ka,{animationName:0,elapsedTime:0,pseudoElement:0}),_g=Ct(Dg),Og=b({},ka,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Bg=Ct(Og),zg=b({},ka,{data:0}),vd=Ct(zg),Lg={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ug={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"},Hg={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Vg(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Hg[e])?!!t[e]:!1}function Ro(){return Vg}var Yg=b({},rs,{key:function(e){if(e.key){var t=Lg[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Ei(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Ug[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ro,charCode:function(e){return e.type==="keypress"?Ei(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ei(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),$g=Ct(Yg),Gg=b({},Mi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),yd=Ct(Gg),Xg=b({},rs,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ro}),Qg=Ct(Xg),Kg=b({},ka,{propertyName:0,elapsedTime:0,pseudoElement:0}),Fg=Ct(Kg),Zg=b({},Mi,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Jg=Ct(Zg),Ig=b({},ka,{newState:0,oldState:0}),Wg=Ct(Ig),Pg=[9,13,27,32],To=Mn&&"CompositionEvent"in window,cs=null;Mn&&"documentMode"in document&&(cs=document.documentMode);var ev=Mn&&"TextEvent"in window&&!cs,bd=Mn&&(!To||cs&&8<cs&&11>=cs),Sd=" ",Ad=!1;function jd(e,t){switch(e){case"keyup":return Pg.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Nd(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var dl=!1;function tv(e,t){switch(e){case"compositionend":return Nd(t);case"keypress":return t.which!==32?null:(Ad=!0,Sd);case"textInput":return e=t.data,e===Sd&&Ad?null:e;default:return null}}function nv(e,t){if(dl)return e==="compositionend"||!To&&jd(e,t)?(e=pd(),wi=Co=ea=null,dl=!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 bd&&t.locale!=="ko"?null:t.data;default:return null}}var av={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 wd(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!av[e.type]:t==="textarea"}function Ed(e,t,n,s){ul?fl?fl.push(s):fl=[s]:ul=s,t=vr(t,"onChange"),0<t.length&&(n=new qi("onChange","change",null,n,s),e.push({event:n,listeners:t}))}var us=null,fs=null;function lv(e){o0(e,0)}function ki(e){var t=ls(e);if(rd(t))return e}function Cd(e,t){if(e==="change")return t}var qd=!1;if(Mn){var Do;if(Mn){var _o="oninput"in document;if(!_o){var Md=document.createElement("div");Md.setAttribute("oninput","return;"),_o=typeof Md.oninput=="function"}Do=_o}else Do=!1;qd=Do&&(!document.documentMode||9<document.documentMode)}function kd(){us&&(us.detachEvent("onpropertychange",Rd),fs=us=null)}function Rd(e){if(e.propertyName==="value"&&ki(fs)){var t=[];Ed(t,fs,e,No(e)),hd(lv,t)}}function sv(e,t,n){e==="focusin"?(kd(),us=t,fs=n,us.attachEvent("onpropertychange",Rd)):e==="focusout"&&kd()}function iv(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ki(fs)}function rv(e,t){if(e==="click")return ki(t)}function ov(e,t){if(e==="input"||e==="change")return ki(t)}function cv(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ot=typeof Object.is=="function"?Object.is:cv;function ds(e,t){if(Ot(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(!Wn.call(t,c)||!Ot(e[c],t[c]))return!1}return!0}function Td(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Dd(e,t){var n=Td(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=Td(n)}}function _d(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?_d(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Od(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=ji(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=ji(e.document)}return t}function Oo(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var uv=Mn&&"documentMode"in document&&11>=document.documentMode,ml=null,Bo=null,ms=null,zo=!1;function Bd(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;zo||ml==null||ml!==ji(s)||(s=ml,"selectionStart"in s&&Oo(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}),ms&&ds(ms,s)||(ms=s,s=vr(Bo,"onSelect"),0<s.length&&(t=new qi("onSelect","select",null,t,n),e.push({event:t,listeners:s}),t.target=ml)))}function Ra(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var hl={animationend:Ra("Animation","AnimationEnd"),animationiteration:Ra("Animation","AnimationIteration"),animationstart:Ra("Animation","AnimationStart"),transitionrun:Ra("Transition","TransitionRun"),transitionstart:Ra("Transition","TransitionStart"),transitioncancel:Ra("Transition","TransitionCancel"),transitionend:Ra("Transition","TransitionEnd")},Lo={},zd={};Mn&&(zd=document.createElement("div").style,"AnimationEvent"in window||(delete hl.animationend.animation,delete hl.animationiteration.animation,delete hl.animationstart.animation),"TransitionEvent"in window||delete hl.transitionend.transition);function Ta(e){if(Lo[e])return Lo[e];if(!hl[e])return e;var t=hl[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in zd)return Lo[e]=t[n];return e}var Ld=Ta("animationend"),Ud=Ta("animationiteration"),Hd=Ta("animationstart"),fv=Ta("transitionrun"),dv=Ta("transitionstart"),mv=Ta("transitioncancel"),Vd=Ta("transitionend"),Yd=new Map,Uo="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(" ");Uo.push("scrollEnd");function on(e,t){Yd.set(e,t),Ma(t,[e])}var Ri=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)},Kt=[],pl=0,Ho=0;function Ti(){for(var e=pl,t=Ho=pl=0;t<e;){var n=Kt[t];Kt[t++]=null;var s=Kt[t];Kt[t++]=null;var c=Kt[t];Kt[t++]=null;var u=Kt[t];if(Kt[t++]=null,s!==null&&c!==null){var x=s.pending;x===null?c.next=c:(c.next=x.next,x.next=c),s.pending=c}u!==0&&$d(n,c,u)}}function Di(e,t,n,s){Kt[pl++]=e,Kt[pl++]=t,Kt[pl++]=n,Kt[pl++]=s,Ho|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function Vo(e,t,n,s){return Di(e,t,n,s),_i(e)}function Da(e,t){return Di(e,null,null,t),_i(e)}function $d(e,t,n){e.lanes|=n;var s=e.alternate;s!==null&&(s.lanes|=n);for(var c=!1,u=e.return;u!==null;)u.childLanes|=n,s=u.alternate,s!==null&&(s.childLanes|=n),u.tag===22&&(e=u.stateNode,e===null||e._visibility&1||(c=!0)),e=u,u=u.return;return e.tag===3?(u=e.stateNode,c&&t!==null&&(c=31-rt(n),e=u.hiddenUpdates,s=e[c],s===null?e[c]=[t]:s.push(t),t.lane=n|536870912),u):null}function _i(e){if(50<Os)throw Os=0,Jc=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var xl={};function hv(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 Bt(e,t,n,s){return new hv(e,t,n,s)}function Yo(e){return e=e.prototype,!(!e||!e.isReactComponent)}function kn(e,t){var n=e.alternate;return n===null?(n=Bt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function Gd(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Oi(e,t,n,s,c,u){var x=0;if(s=e,typeof e=="function")Yo(e)&&(x=1);else if(typeof e=="string")x=yy(e,n,te.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case X:return e=Bt(31,n,t,c),e.elementType=X,e.lanes=u,e;case q:return _a(n.children,c,u,t);case N:x=8,c|=24;break;case E:return e=Bt(12,n,t,c|2),e.elementType=E,e.lanes=u,e;case L:return e=Bt(13,n,t,c),e.elementType=L,e.lanes=u,e;case $:return e=Bt(19,n,t,c),e.elementType=$,e.lanes=u,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case T:x=10;break e;case S:x=9;break e;case z:x=11;break e;case O:x=14;break e;case V:x=16,s=null;break e}x=29,n=Error(o(130,e===null?"null":typeof e,"")),s=null}return t=Bt(x,n,t,c),t.elementType=e,t.type=s,t.lanes=u,t}function _a(e,t,n,s){return e=Bt(7,e,s,t),e.lanes=n,e}function $o(e,t,n){return e=Bt(6,e,null,t),e.lanes=n,e}function Xd(e){var t=Bt(18,null,null,0);return t.stateNode=e,t}function Go(e,t,n){return t=Bt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Qd=new WeakMap;function Ft(e,t){if(typeof e=="object"&&e!==null){var n=Qd.get(e);return n!==void 0?n:(t={value:e,source:t,stack:wa(t)},Qd.set(e,t),t)}return{value:e,source:t,stack:wa(t)}}var gl=[],vl=0,Bi=null,hs=0,Zt=[],Jt=0,ta=null,gn=1,vn="";function Rn(e,t){gl[vl++]=hs,gl[vl++]=Bi,Bi=e,hs=t}function Kd(e,t,n){Zt[Jt++]=gn,Zt[Jt++]=vn,Zt[Jt++]=ta,ta=e;var s=gn;e=vn;var c=32-rt(s)-1;s&=~(1<<c),n+=1;var u=32-rt(t)+c;if(30<u){var x=c-c%5;u=(s&(1<<x)-1).toString(32),s>>=x,c-=x,gn=1<<32-rt(t)+c|n<<c|s,vn=u+e}else gn=1<<u|n<<c|s,vn=e}function Xo(e){e.return!==null&&(Rn(e,1),Kd(e,1,0))}function Qo(e){for(;e===Bi;)Bi=gl[--vl],gl[vl]=null,hs=gl[--vl],gl[vl]=null;for(;e===ta;)ta=Zt[--Jt],Zt[Jt]=null,vn=Zt[--Jt],Zt[Jt]=null,gn=Zt[--Jt],Zt[Jt]=null}function Fd(e,t){Zt[Jt++]=gn,Zt[Jt++]=vn,Zt[Jt++]=ta,gn=t.id,vn=t.overflow,ta=e}var yt=null,Ze=null,ke=!1,na=null,It=!1,Ko=Error(o(519));function aa(e){var t=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ps(Ft(t,e)),Ko}function Zd(e){var t=e.stateNode,n=e.type,s=e.memoizedProps;switch(t[Pe]=e,t[Te]=s,n){case"dialog":Ee("cancel",t),Ee("close",t);break;case"iframe":case"object":case"embed":Ee("load",t);break;case"video":case"audio":for(n=0;n<zs.length;n++)Ee(zs[n],t);break;case"source":Ee("error",t);break;case"img":case"image":case"link":Ee("error",t),Ee("load",t);break;case"details":Ee("toggle",t);break;case"input":Ee("invalid",t),od(t,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":Ee("invalid",t);break;case"textarea":Ee("invalid",t),ud(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||d0(t.textContent,n)?(s.popover!=null&&(Ee("beforetoggle",t),Ee("toggle",t)),s.onScroll!=null&&Ee("scroll",t),s.onScrollEnd!=null&&Ee("scrollend",t),s.onClick!=null&&(t.onclick=qn),t=!0):t=!1,t||aa(e,!0)}function Jd(e){for(yt=e.return;yt;)switch(yt.tag){case 5:case 31:case 13:It=!1;return;case 27:case 3:It=!0;return;default:yt=yt.return}}function yl(e){if(e!==yt)return!1;if(!ke)return Jd(e),ke=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||fu(e.type,e.memoizedProps)),n=!n),n&&Ze&&aa(e),Jd(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));Ze=S0(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));Ze=S0(e)}else t===27?(t=Ze,ga(e.type)?(e=xu,xu=null,Ze=e):Ze=t):Ze=yt?Pt(e.stateNode.nextSibling):null;return!0}function Oa(){Ze=yt=null,ke=!1}function Fo(){var e=na;return e!==null&&(Rt===null?Rt=e:Rt.push.apply(Rt,e),na=null),e}function ps(e){na===null?na=[e]:na.push(e)}var Zo=C(null),Ba=null,Tn=null;function la(e,t,n){W(Zo,t._currentValue),t._currentValue=n}function Dn(e){e._currentValue=Zo.current,_(Zo)}function Jo(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 Io(e,t,n,s){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var u=c.dependencies;if(u!==null){var x=c.child;u=u.firstContext;e:for(;u!==null;){var A=u;u=c;for(var R=0;R<t.length;R++)if(A.context===t[R]){u.lanes|=n,A=u.alternate,A!==null&&(A.lanes|=n),Jo(u.return,n,e),s||(x=null);break e}u=A.next}}else if(c.tag===18){if(x=c.return,x===null)throw Error(o(341));x.lanes|=n,u=x.alternate,u!==null&&(u.lanes|=n),Jo(x,n,e),x=null}else x=c.child;if(x!==null)x.return=c;else for(x=c;x!==null;){if(x===e){x=null;break}if(c=x.sibling,c!==null){c.return=x.return,x=c;break}x=x.return}c=x}}function bl(e,t,n,s){e=null;for(var c=t,u=!1;c!==null;){if(!u){if((c.flags&524288)!==0)u=!0;else if((c.flags&262144)!==0)break}if(c.tag===10){var x=c.alternate;if(x===null)throw Error(o(387));if(x=x.memoizedProps,x!==null){var A=c.type;Ot(c.pendingProps.value,x.value)||(e!==null?e.push(A):e=[A])}}else if(c===ue.current){if(x=c.alternate,x===null)throw Error(o(387));x.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(Ys):e=[Ys])}c=c.return}e!==null&&Io(t,e,n,s),t.flags|=262144}function zi(e){for(e=e.firstContext;e!==null;){if(!Ot(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function za(e){Ba=e,Tn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function bt(e){return Id(Ba,e)}function Li(e,t){return Ba===null&&za(e),Id(e,t)}function Id(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Tn===null){if(e===null)throw Error(o(308));Tn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Tn=Tn.next=t;return n}var pv=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()})}},xv=a.unstable_scheduleCallback,gv=a.unstable_NormalPriority,ot={$$typeof:T,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Wo(){return{controller:new pv,data:new Map,refCount:0}}function xs(e){e.refCount--,e.refCount===0&&xv(gv,function(){e.controller.abort()})}var gs=null,Po=0,Sl=0,Al=null;function vv(e,t){if(gs===null){var n=gs=[];Po=0,Sl=nu(),Al={status:"pending",value:void 0,then:function(s){n.push(s)}}}return Po++,t.then(Wd,Wd),t}function Wd(){if(--Po===0&&gs!==null){Al!==null&&(Al.status="fulfilled");var e=gs;gs=null,Sl=0,Al=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function yv(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 Pd=k.S;k.S=function(e,t){Bh=mt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&vv(e,t),Pd!==null&&Pd(e,t)};var La=C(null);function ec(){var e=La.current;return e!==null?e:Ke.pooledCache}function Ui(e,t){t===null?W(La,La.current):W(La,t.pool)}function em(){var e=ec();return e===null?null:{parent:ot._currentValue,pool:e}}var jl=Error(o(460)),tc=Error(o(474)),Hi=Error(o(542)),Vi={then:function(){}};function tm(e){return e=e.status,e==="fulfilled"||e==="rejected"}function nm(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(qn,qn),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,lm(e),e;default:if(typeof t.status=="string")t.then(qn,qn);else{if(e=Ke,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,lm(e),e}throw Ha=t,jl}}function Ua(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Ha=n,jl):n}}var Ha=null;function am(){if(Ha===null)throw Error(o(459));var e=Ha;return Ha=null,e}function lm(e){if(e===jl||e===Hi)throw Error(o(483))}var Nl=null,vs=0;function Yi(e){var t=vs;return vs+=1,Nl===null&&(Nl=[]),nm(Nl,e,t)}function ys(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function $i(e,t){throw t.$$typeof===j?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function sm(e){function t(B,D){if(e){var U=B.deletions;U===null?(B.deletions=[D],B.flags|=16):U.push(D)}}function n(B,D){if(!e)return null;for(;D!==null;)t(B,D),D=D.sibling;return null}function s(B){for(var D=new Map;B!==null;)B.key!==null?D.set(B.key,B):D.set(B.index,B),B=B.sibling;return D}function c(B,D){return B=kn(B,D),B.index=0,B.sibling=null,B}function u(B,D,U){return B.index=U,e?(U=B.alternate,U!==null?(U=U.index,U<D?(B.flags|=67108866,D):U):(B.flags|=67108866,D)):(B.flags|=1048576,D)}function x(B){return e&&B.alternate===null&&(B.flags|=67108866),B}function A(B,D,U,I){return D===null||D.tag!==6?(D=$o(U,B.mode,I),D.return=B,D):(D=c(D,U),D.return=B,D)}function R(B,D,U,I){var pe=U.type;return pe===q?J(B,D,U.props.children,I,U.key):D!==null&&(D.elementType===pe||typeof pe=="object"&&pe!==null&&pe.$$typeof===V&&Ua(pe)===D.type)?(D=c(D,U.props),ys(D,U),D.return=B,D):(D=Oi(U.type,U.key,U.props,null,B.mode,I),ys(D,U),D.return=B,D)}function H(B,D,U,I){return D===null||D.tag!==4||D.stateNode.containerInfo!==U.containerInfo||D.stateNode.implementation!==U.implementation?(D=Go(U,B.mode,I),D.return=B,D):(D=c(D,U.children||[]),D.return=B,D)}function J(B,D,U,I,pe){return D===null||D.tag!==7?(D=_a(U,B.mode,I,pe),D.return=B,D):(D=c(D,U),D.return=B,D)}function ee(B,D,U){if(typeof D=="string"&&D!==""||typeof D=="number"||typeof D=="bigint")return D=$o(""+D,B.mode,U),D.return=B,D;if(typeof D=="object"&&D!==null){switch(D.$$typeof){case M:return U=Oi(D.type,D.key,D.props,null,B.mode,U),ys(U,D),U.return=B,U;case w:return D=Go(D,B.mode,U),D.return=B,D;case V:return D=Ua(D),ee(B,D,U)}if(G(D)||ae(D))return D=_a(D,B.mode,U,null),D.return=B,D;if(typeof D.then=="function")return ee(B,Yi(D),U);if(D.$$typeof===T)return ee(B,Li(B,D),U);$i(B,D)}return null}function Y(B,D,U,I){var pe=D!==null?D.key:null;if(typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint")return pe!==null?null:A(B,D,""+U,I);if(typeof U=="object"&&U!==null){switch(U.$$typeof){case M:return U.key===pe?R(B,D,U,I):null;case w:return U.key===pe?H(B,D,U,I):null;case V:return U=Ua(U),Y(B,D,U,I)}if(G(U)||ae(U))return pe!==null?null:J(B,D,U,I,null);if(typeof U.then=="function")return Y(B,D,Yi(U),I);if(U.$$typeof===T)return Y(B,D,Li(B,U),I);$i(B,U)}return null}function K(B,D,U,I,pe){if(typeof I=="string"&&I!==""||typeof I=="number"||typeof I=="bigint")return B=B.get(U)||null,A(D,B,""+I,pe);if(typeof I=="object"&&I!==null){switch(I.$$typeof){case M:return B=B.get(I.key===null?U:I.key)||null,R(D,B,I,pe);case w:return B=B.get(I.key===null?U:I.key)||null,H(D,B,I,pe);case V:return I=Ua(I),K(B,D,U,I,pe)}if(G(I)||ae(I))return B=B.get(U)||null,J(D,B,I,pe,null);if(typeof I.then=="function")return K(B,D,U,Yi(I),pe);if(I.$$typeof===T)return K(B,D,U,Li(D,I),pe);$i(D,I)}return null}function fe(B,D,U,I){for(var pe=null,De=null,de=D,Ae=D=0,Me=null;de!==null&&Ae<U.length;Ae++){de.index>Ae?(Me=de,de=null):Me=de.sibling;var _e=Y(B,de,U[Ae],I);if(_e===null){de===null&&(de=Me);break}e&&de&&_e.alternate===null&&t(B,de),D=u(_e,D,Ae),De===null?pe=_e:De.sibling=_e,De=_e,de=Me}if(Ae===U.length)return n(B,de),ke&&Rn(B,Ae),pe;if(de===null){for(;Ae<U.length;Ae++)de=ee(B,U[Ae],I),de!==null&&(D=u(de,D,Ae),De===null?pe=de:De.sibling=de,De=de);return ke&&Rn(B,Ae),pe}for(de=s(de);Ae<U.length;Ae++)Me=K(de,B,Ae,U[Ae],I),Me!==null&&(e&&Me.alternate!==null&&de.delete(Me.key===null?Ae:Me.key),D=u(Me,D,Ae),De===null?pe=Me:De.sibling=Me,De=Me);return e&&de.forEach(function(Aa){return t(B,Aa)}),ke&&Rn(B,Ae),pe}function ge(B,D,U,I){if(U==null)throw Error(o(151));for(var pe=null,De=null,de=D,Ae=D=0,Me=null,_e=U.next();de!==null&&!_e.done;Ae++,_e=U.next()){de.index>Ae?(Me=de,de=null):Me=de.sibling;var Aa=Y(B,de,_e.value,I);if(Aa===null){de===null&&(de=Me);break}e&&de&&Aa.alternate===null&&t(B,de),D=u(Aa,D,Ae),De===null?pe=Aa:De.sibling=Aa,De=Aa,de=Me}if(_e.done)return n(B,de),ke&&Rn(B,Ae),pe;if(de===null){for(;!_e.done;Ae++,_e=U.next())_e=ee(B,_e.value,I),_e!==null&&(D=u(_e,D,Ae),De===null?pe=_e:De.sibling=_e,De=_e);return ke&&Rn(B,Ae),pe}for(de=s(de);!_e.done;Ae++,_e=U.next())_e=K(de,B,Ae,_e.value,I),_e!==null&&(e&&_e.alternate!==null&&de.delete(_e.key===null?Ae:_e.key),D=u(_e,D,Ae),De===null?pe=_e:De.sibling=_e,De=_e);return e&&de.forEach(function(ky){return t(B,ky)}),ke&&Rn(B,Ae),pe}function Ge(B,D,U,I){if(typeof U=="object"&&U!==null&&U.type===q&&U.key===null&&(U=U.props.children),typeof U=="object"&&U!==null){switch(U.$$typeof){case M:e:{for(var pe=U.key;D!==null;){if(D.key===pe){if(pe=U.type,pe===q){if(D.tag===7){n(B,D.sibling),I=c(D,U.props.children),I.return=B,B=I;break e}}else if(D.elementType===pe||typeof pe=="object"&&pe!==null&&pe.$$typeof===V&&Ua(pe)===D.type){n(B,D.sibling),I=c(D,U.props),ys(I,U),I.return=B,B=I;break e}n(B,D);break}else t(B,D);D=D.sibling}U.type===q?(I=_a(U.props.children,B.mode,I,U.key),I.return=B,B=I):(I=Oi(U.type,U.key,U.props,null,B.mode,I),ys(I,U),I.return=B,B=I)}return x(B);case w:e:{for(pe=U.key;D!==null;){if(D.key===pe)if(D.tag===4&&D.stateNode.containerInfo===U.containerInfo&&D.stateNode.implementation===U.implementation){n(B,D.sibling),I=c(D,U.children||[]),I.return=B,B=I;break e}else{n(B,D);break}else t(B,D);D=D.sibling}I=Go(U,B.mode,I),I.return=B,B=I}return x(B);case V:return U=Ua(U),Ge(B,D,U,I)}if(G(U))return fe(B,D,U,I);if(ae(U)){if(pe=ae(U),typeof pe!="function")throw Error(o(150));return U=pe.call(U),ge(B,D,U,I)}if(typeof U.then=="function")return Ge(B,D,Yi(U),I);if(U.$$typeof===T)return Ge(B,D,Li(B,U),I);$i(B,U)}return typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint"?(U=""+U,D!==null&&D.tag===6?(n(B,D.sibling),I=c(D,U),I.return=B,B=I):(n(B,D),I=$o(U,B.mode,I),I.return=B,B=I),x(B)):n(B,D)}return function(B,D,U,I){try{vs=0;var pe=Ge(B,D,U,I);return Nl=null,pe}catch(de){if(de===jl||de===Hi)throw de;var De=Bt(29,de,null,B.mode);return De.lanes=I,De.return=B,De}finally{}}}var Va=sm(!0),im=sm(!1),sa=!1;function nc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ac(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function ia(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ra(e,t,n){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(Be&2)!==0){var c=s.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),s.pending=t,t=_i(e),$d(e,null,n),t}return Di(e,s,t,n),_i(e)}function bs(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,xe(e,n)}}function lc(e,t){var n=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,n===s)){var c=null,u=null;if(n=n.firstBaseUpdate,n!==null){do{var x={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};u===null?c=u=x:u=u.next=x,n=n.next}while(n!==null);u===null?c=u=t:u=u.next=t}else c=u=t;n={baseState:s.baseState,firstBaseUpdate:c,lastBaseUpdate:u,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 sc=!1;function Ss(){if(sc){var e=Al;if(e!==null)throw e}}function As(e,t,n,s){sc=!1;var c=e.updateQueue;sa=!1;var u=c.firstBaseUpdate,x=c.lastBaseUpdate,A=c.shared.pending;if(A!==null){c.shared.pending=null;var R=A,H=R.next;R.next=null,x===null?u=H:x.next=H,x=R;var J=e.alternate;J!==null&&(J=J.updateQueue,A=J.lastBaseUpdate,A!==x&&(A===null?J.firstBaseUpdate=H:A.next=H,J.lastBaseUpdate=R))}if(u!==null){var ee=c.baseState;x=0,J=H=R=null,A=u;do{var Y=A.lane&-536870913,K=Y!==A.lane;if(K?(qe&Y)===Y:(s&Y)===Y){Y!==0&&Y===Sl&&(sc=!0),J!==null&&(J=J.next={lane:0,tag:A.tag,payload:A.payload,callback:null,next:null});e:{var fe=e,ge=A;Y=t;var Ge=n;switch(ge.tag){case 1:if(fe=ge.payload,typeof fe=="function"){ee=fe.call(Ge,ee,Y);break e}ee=fe;break e;case 3:fe.flags=fe.flags&-65537|128;case 0:if(fe=ge.payload,Y=typeof fe=="function"?fe.call(Ge,ee,Y):fe,Y==null)break e;ee=b({},ee,Y);break e;case 2:sa=!0}}Y=A.callback,Y!==null&&(e.flags|=64,K&&(e.flags|=8192),K=c.callbacks,K===null?c.callbacks=[Y]:K.push(Y))}else K={lane:Y,tag:A.tag,payload:A.payload,callback:A.callback,next:null},J===null?(H=J=K,R=ee):J=J.next=K,x|=Y;if(A=A.next,A===null){if(A=c.shared.pending,A===null)break;K=A,A=K.next,K.next=null,c.lastBaseUpdate=K,c.shared.pending=null}}while(!0);J===null&&(R=ee),c.baseState=R,c.firstBaseUpdate=H,c.lastBaseUpdate=J,u===null&&(c.shared.lanes=0),da|=x,e.lanes=x,e.memoizedState=ee}}function rm(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function om(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)rm(n[e],t)}var wl=C(null),Gi=C(0);function cm(e,t){e=Yn,W(Gi,e),W(wl,t),Yn=e|t.baseLanes}function ic(){W(Gi,Yn),W(wl,wl.current)}function rc(){Yn=Gi.current,_(wl),_(Gi)}var zt=C(null),Wt=null;function oa(e){var t=e.alternate;W(nt,nt.current&1),W(zt,e),Wt===null&&(t===null||wl.current!==null||t.memoizedState!==null)&&(Wt=e)}function oc(e){W(nt,nt.current),W(zt,e),Wt===null&&(Wt=e)}function um(e){e.tag===22?(W(nt,nt.current),W(zt,e),Wt===null&&(Wt=e)):ca()}function ca(){W(nt,nt.current),W(zt,zt.current)}function Lt(e){_(zt),Wt===e&&(Wt=null),_(nt)}var nt=C(0);function Xi(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||hu(n)||pu(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 _n=0,be=null,Ye=null,ct=null,Qi=!1,El=!1,Ya=!1,Ki=0,js=0,Cl=null,bv=0;function et(){throw Error(o(321))}function cc(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Ot(e[n],t[n]))return!1;return!0}function uc(e,t,n,s,c,u){return _n=u,be=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,k.H=e===null||e.memoizedState===null?Km:wc,Ya=!1,u=n(s,c),Ya=!1,El&&(u=dm(t,n,s,c)),fm(e),u}function fm(e){k.H=Es;var t=Ye!==null&&Ye.next!==null;if(_n=0,ct=Ye=be=null,Qi=!1,js=0,Cl=null,t)throw Error(o(300));e===null||ut||(e=e.dependencies,e!==null&&zi(e)&&(ut=!0))}function dm(e,t,n,s){be=e;var c=0;do{if(El&&(Cl=null),js=0,El=!1,25<=c)throw Error(o(301));if(c+=1,ct=Ye=null,e.updateQueue!=null){var u=e.updateQueue;u.lastEffect=null,u.events=null,u.stores=null,u.memoCache!=null&&(u.memoCache.index=0)}k.H=Fm,u=t(n,s)}while(El);return u}function Sv(){var e=k.H,t=e.useState()[0];return t=typeof t.then=="function"?Ns(t):t,e=e.useState()[0],(Ye!==null?Ye.memoizedState:null)!==e&&(be.flags|=1024),t}function fc(){var e=Ki!==0;return Ki=0,e}function dc(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function mc(e){if(Qi){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Qi=!1}_n=0,ct=Ye=be=null,El=!1,js=Ki=0,Cl=null}function wt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ct===null?be.memoizedState=ct=e:ct=ct.next=e,ct}function at(){if(Ye===null){var e=be.alternate;e=e!==null?e.memoizedState:null}else e=Ye.next;var t=ct===null?be.memoizedState:ct.next;if(t!==null)ct=t,Ye=e;else{if(e===null)throw be.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},ct===null?be.memoizedState=ct=e:ct=ct.next=e}return ct}function Fi(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ns(e){var t=js;return js+=1,Cl===null&&(Cl=[]),e=nm(Cl,e,t),t=be,(ct===null?t.memoizedState:ct.next)===null&&(t=t.alternate,k.H=t===null||t.memoizedState===null?Km:wc),e}function Zi(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Ns(e);if(e.$$typeof===T)return bt(e)}throw Error(o(438,String(e)))}function hc(e){var t=null,n=be.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var s=be.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=Fi(),be.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]=Z;return t.index++,n}function On(e,t){return typeof t=="function"?t(e):t}function Ji(e){var t=at();return pc(t,Ye,e)}function pc(e,t,n){var s=e.queue;if(s===null)throw Error(o(311));s.lastRenderedReducer=n;var c=e.baseQueue,u=s.pending;if(u!==null){if(c!==null){var x=c.next;c.next=u.next,u.next=x}t.baseQueue=c=u,s.pending=null}if(u=e.baseState,c===null)e.memoizedState=u;else{t=c.next;var A=x=null,R=null,H=t,J=!1;do{var ee=H.lane&-536870913;if(ee!==H.lane?(qe&ee)===ee:(_n&ee)===ee){var Y=H.revertLane;if(Y===0)R!==null&&(R=R.next={lane:0,revertLane:0,gesture:null,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null}),ee===Sl&&(J=!0);else if((_n&Y)===Y){H=H.next,Y===Sl&&(J=!0);continue}else ee={lane:0,revertLane:H.revertLane,gesture:null,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null},R===null?(A=R=ee,x=u):R=R.next=ee,be.lanes|=Y,da|=Y;ee=H.action,Ya&&n(u,ee),u=H.hasEagerState?H.eagerState:n(u,ee)}else Y={lane:ee,revertLane:H.revertLane,gesture:H.gesture,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null},R===null?(A=R=Y,x=u):R=R.next=Y,be.lanes|=ee,da|=ee;H=H.next}while(H!==null&&H!==t);if(R===null?x=u:R.next=A,!Ot(u,e.memoizedState)&&(ut=!0,J&&(n=Al,n!==null)))throw n;e.memoizedState=u,e.baseState=x,e.baseQueue=R,s.lastRenderedState=u}return c===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function xc(e){var t=at(),n=t.queue;if(n===null)throw Error(o(311));n.lastRenderedReducer=e;var s=n.dispatch,c=n.pending,u=t.memoizedState;if(c!==null){n.pending=null;var x=c=c.next;do u=e(u,x.action),x=x.next;while(x!==c);Ot(u,t.memoizedState)||(ut=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),n.lastRenderedState=u}return[u,s]}function mm(e,t,n){var s=be,c=at(),u=ke;if(u){if(n===void 0)throw Error(o(407));n=n()}else n=t();var x=!Ot((Ye||c).memoizedState,n);if(x&&(c.memoizedState=n,ut=!0),c=c.queue,yc(xm.bind(null,s,c,e),[e]),c.getSnapshot!==t||x||ct!==null&&ct.memoizedState.tag&1){if(s.flags|=2048,ql(9,{destroy:void 0},pm.bind(null,s,c,n,t),null),Ke===null)throw Error(o(349));u||(_n&127)!==0||hm(s,t,n)}return n}function hm(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=be.updateQueue,t===null?(t=Fi(),be.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function pm(e,t,n,s){t.value=n,t.getSnapshot=s,gm(t)&&vm(e)}function xm(e,t,n){return n(function(){gm(t)&&vm(e)})}function gm(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Ot(e,n)}catch{return!0}}function vm(e){var t=Da(e,2);t!==null&&Tt(t,e,2)}function gc(e){var t=wt();if(typeof e=="function"){var n=e;if(e=n(),Ya){Yt(!0);try{n()}finally{Yt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:On,lastRenderedState:e},t}function ym(e,t,n,s){return e.baseState=n,pc(e,Ye,typeof s=="function"?s:On)}function Av(e,t,n,s,c){if(Pi(e))throw Error(o(485));if(e=t.action,e!==null){var u={payload:c,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(x){u.listeners.push(x)}};k.T!==null?n(!0):u.isTransition=!1,s(u),n=t.pending,n===null?(u.next=t.pending=u,bm(t,u)):(u.next=n.next,t.pending=n.next=u)}}function bm(e,t){var n=t.action,s=t.payload,c=e.state;if(t.isTransition){var u=k.T,x={};k.T=x;try{var A=n(c,s),R=k.S;R!==null&&R(x,A),Sm(e,t,A)}catch(H){vc(e,t,H)}finally{u!==null&&x.types!==null&&(u.types=x.types),k.T=u}}else try{u=n(c,s),Sm(e,t,u)}catch(H){vc(e,t,H)}}function Sm(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(s){Am(e,t,s)},function(s){return vc(e,t,s)}):Am(e,t,n)}function Am(e,t,n){t.status="fulfilled",t.value=n,jm(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,bm(e,n)))}function vc(e,t,n){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do t.status="rejected",t.reason=n,jm(t),t=t.next;while(t!==s)}e.action=null}function jm(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Nm(e,t){return t}function wm(e,t){if(ke){var n=Ke.formState;if(n!==null){e:{var s=be;if(ke){if(Ze){t:{for(var c=Ze,u=It;c.nodeType!==8;){if(!u){c=null;break t}if(c=Pt(c.nextSibling),c===null){c=null;break t}}u=c.data,c=u==="F!"||u==="F"?c:null}if(c){Ze=Pt(c.nextSibling),s=c.data==="F!";break e}}aa(s)}s=!1}s&&(t=n[0])}}return n=wt(),n.memoizedState=n.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Nm,lastRenderedState:t},n.queue=s,n=Gm.bind(null,be,s),s.dispatch=n,s=gc(!1),u=Nc.bind(null,be,!1,s.queue),s=wt(),c={state:t,dispatch:null,action:e,pending:null},s.queue=c,n=Av.bind(null,be,c,u,n),c.dispatch=n,s.memoizedState=e,[t,n,!1]}function Em(e){var t=at();return Cm(t,Ye,e)}function Cm(e,t,n){if(t=pc(e,t,Nm)[0],e=Ji(On)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=Ns(t)}catch(x){throw x===jl?Hi:x}else s=t;t=at();var c=t.queue,u=c.dispatch;return n!==t.memoizedState&&(be.flags|=2048,ql(9,{destroy:void 0},jv.bind(null,c,n),null)),[s,u,e]}function jv(e,t){e.action=t}function qm(e){var t=at(),n=Ye;if(n!==null)return Cm(t,n,e);at(),t=t.memoizedState,n=at();var s=n.queue.dispatch;return n.memoizedState=e,[t,s,!1]}function ql(e,t,n,s){return e={tag:e,create:n,deps:s,inst:t,next:null},t=be.updateQueue,t===null&&(t=Fi(),be.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 Mm(){return at().memoizedState}function Ii(e,t,n,s){var c=wt();be.flags|=e,c.memoizedState=ql(1|t,{destroy:void 0},n,s===void 0?null:s)}function Wi(e,t,n,s){var c=at();s=s===void 0?null:s;var u=c.memoizedState.inst;Ye!==null&&s!==null&&cc(s,Ye.memoizedState.deps)?c.memoizedState=ql(t,u,n,s):(be.flags|=e,c.memoizedState=ql(1|t,u,n,s))}function km(e,t){Ii(8390656,8,e,t)}function yc(e,t){Wi(2048,8,e,t)}function Nv(e){be.flags|=4;var t=be.updateQueue;if(t===null)t=Fi(),be.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Rm(e){var t=at().memoizedState;return Nv({ref:t,nextImpl:e}),function(){if((Be&2)!==0)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function Tm(e,t){return Wi(4,2,e,t)}function Dm(e,t){return Wi(4,4,e,t)}function _m(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 Om(e,t,n){n=n!=null?n.concat([e]):null,Wi(4,4,_m.bind(null,t,e),n)}function bc(){}function Bm(e,t){var n=at();t=t===void 0?null:t;var s=n.memoizedState;return t!==null&&cc(t,s[1])?s[0]:(n.memoizedState=[e,t],e)}function zm(e,t){var n=at();t=t===void 0?null:t;var s=n.memoizedState;if(t!==null&&cc(t,s[1]))return s[0];if(s=e(),Ya){Yt(!0);try{e()}finally{Yt(!1)}}return n.memoizedState=[s,t],s}function Sc(e,t,n){return n===void 0||(_n&1073741824)!==0&&(qe&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=Lh(),be.lanes|=e,da|=e,n)}function Lm(e,t,n,s){return Ot(n,t)?n:wl.current!==null?(e=Sc(e,n,s),Ot(e,t)||(ut=!0),e):(_n&42)===0||(_n&1073741824)!==0&&(qe&261930)===0?(ut=!0,e.memoizedState=n):(e=Lh(),be.lanes|=e,da|=e,t)}function Um(e,t,n,s,c){var u=Q.p;Q.p=u!==0&&8>u?u:8;var x=k.T,A={};k.T=A,Nc(e,!1,t,n);try{var R=c(),H=k.S;if(H!==null&&H(A,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var J=yv(R,s);ws(e,t,J,Vt(e))}else ws(e,t,s,Vt(e))}catch(ee){ws(e,t,{then:function(){},status:"rejected",reason:ee},Vt())}finally{Q.p=u,x!==null&&A.types!==null&&(x.types=A.types),k.T=x}}function wv(){}function Ac(e,t,n,s){if(e.tag!==5)throw Error(o(476));var c=Hm(e).queue;Um(e,c,t,P,n===null?wv:function(){return Vm(e),n(s)})}function Hm(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:P,baseState:P,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:On,lastRenderedState:P},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:On,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Vm(e){var t=Hm(e);t.next===null&&(t=e.alternate.memoizedState),ws(e,t.next.queue,{},Vt())}function jc(){return bt(Ys)}function Ym(){return at().memoizedState}function $m(){return at().memoizedState}function Ev(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Vt();e=ia(n);var s=ra(t,e,n);s!==null&&(Tt(s,t,n),bs(s,t,n)),t={cache:Wo()},e.payload=t;return}t=t.return}}function Cv(e,t,n){var s=Vt();n={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Pi(e)?Xm(t,n):(n=Vo(e,t,n,s),n!==null&&(Tt(n,e,s),Qm(n,t,s)))}function Gm(e,t,n){var s=Vt();ws(e,t,n,s)}function ws(e,t,n,s){var c={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Pi(e))Xm(t,c);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var x=t.lastRenderedState,A=u(x,n);if(c.hasEagerState=!0,c.eagerState=A,Ot(A,x))return Di(e,t,c,0),Ke===null&&Ti(),!1}catch{}finally{}if(n=Vo(e,t,c,s),n!==null)return Tt(n,e,s),Qm(n,t,s),!0}return!1}function Nc(e,t,n,s){if(s={lane:2,revertLane:nu(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Pi(e)){if(t)throw Error(o(479))}else t=Vo(e,n,s,2),t!==null&&Tt(t,e,2)}function Pi(e){var t=e.alternate;return e===be||t!==null&&t===be}function Xm(e,t){El=Qi=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Qm(e,t,n){if((n&4194048)!==0){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,xe(e,n)}}var Es={readContext:bt,use:Zi,useCallback:et,useContext:et,useEffect:et,useImperativeHandle:et,useLayoutEffect:et,useInsertionEffect:et,useMemo:et,useReducer:et,useRef:et,useState:et,useDebugValue:et,useDeferredValue:et,useTransition:et,useSyncExternalStore:et,useId:et,useHostTransitionStatus:et,useFormState:et,useActionState:et,useOptimistic:et,useMemoCache:et,useCacheRefresh:et};Es.useEffectEvent=et;var Km={readContext:bt,use:Zi,useCallback:function(e,t){return wt().memoizedState=[e,t===void 0?null:t],e},useContext:bt,useEffect:km,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,Ii(4194308,4,_m.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ii(4194308,4,e,t)},useInsertionEffect:function(e,t){Ii(4,2,e,t)},useMemo:function(e,t){var n=wt();t=t===void 0?null:t;var s=e();if(Ya){Yt(!0);try{e()}finally{Yt(!1)}}return n.memoizedState=[s,t],s},useReducer:function(e,t,n){var s=wt();if(n!==void 0){var c=n(t);if(Ya){Yt(!0);try{n(t)}finally{Yt(!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=Cv.bind(null,be,e),[s.memoizedState,e]},useRef:function(e){var t=wt();return e={current:e},t.memoizedState=e},useState:function(e){e=gc(e);var t=e.queue,n=Gm.bind(null,be,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:bc,useDeferredValue:function(e,t){var n=wt();return Sc(n,e,t)},useTransition:function(){var e=gc(!1);return e=Um.bind(null,be,e.queue,!0,!1),wt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var s=be,c=wt();if(ke){if(n===void 0)throw Error(o(407));n=n()}else{if(n=t(),Ke===null)throw Error(o(349));(qe&127)!==0||hm(s,t,n)}c.memoizedState=n;var u={value:n,getSnapshot:t};return c.queue=u,km(xm.bind(null,s,u,e),[e]),s.flags|=2048,ql(9,{destroy:void 0},pm.bind(null,s,u,n,t),null),n},useId:function(){var e=wt(),t=Ke.identifierPrefix;if(ke){var n=vn,s=gn;n=(s&~(1<<32-rt(s)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Ki++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=bv++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:jc,useFormState:wm,useActionState:wm,useOptimistic:function(e){var t=wt();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Nc.bind(null,be,!0,n),n.dispatch=t,[e,t]},useMemoCache:hc,useCacheRefresh:function(){return wt().memoizedState=Ev.bind(null,be)},useEffectEvent:function(e){var t=wt(),n={impl:e};return t.memoizedState=n,function(){if((Be&2)!==0)throw Error(o(440));return n.impl.apply(void 0,arguments)}}},wc={readContext:bt,use:Zi,useCallback:Bm,useContext:bt,useEffect:yc,useImperativeHandle:Om,useInsertionEffect:Tm,useLayoutEffect:Dm,useMemo:zm,useReducer:Ji,useRef:Mm,useState:function(){return Ji(On)},useDebugValue:bc,useDeferredValue:function(e,t){var n=at();return Lm(n,Ye.memoizedState,e,t)},useTransition:function(){var e=Ji(On)[0],t=at().memoizedState;return[typeof e=="boolean"?e:Ns(e),t]},useSyncExternalStore:mm,useId:Ym,useHostTransitionStatus:jc,useFormState:Em,useActionState:Em,useOptimistic:function(e,t){var n=at();return ym(n,Ye,e,t)},useMemoCache:hc,useCacheRefresh:$m};wc.useEffectEvent=Rm;var Fm={readContext:bt,use:Zi,useCallback:Bm,useContext:bt,useEffect:yc,useImperativeHandle:Om,useInsertionEffect:Tm,useLayoutEffect:Dm,useMemo:zm,useReducer:xc,useRef:Mm,useState:function(){return xc(On)},useDebugValue:bc,useDeferredValue:function(e,t){var n=at();return Ye===null?Sc(n,e,t):Lm(n,Ye.memoizedState,e,t)},useTransition:function(){var e=xc(On)[0],t=at().memoizedState;return[typeof e=="boolean"?e:Ns(e),t]},useSyncExternalStore:mm,useId:Ym,useHostTransitionStatus:jc,useFormState:qm,useActionState:qm,useOptimistic:function(e,t){var n=at();return Ye!==null?ym(n,Ye,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:hc,useCacheRefresh:$m};Fm.useEffectEvent=Rm;function Ec(e,t,n,s){t=e.memoizedState,n=n(s,t),n=n==null?t:b({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Cc={enqueueSetState:function(e,t,n){e=e._reactInternals;var s=Vt(),c=ia(s);c.payload=t,n!=null&&(c.callback=n),t=ra(e,c,s),t!==null&&(Tt(t,e,s),bs(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var s=Vt(),c=ia(s);c.tag=1,c.payload=t,n!=null&&(c.callback=n),t=ra(e,c,s),t!==null&&(Tt(t,e,s),bs(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Vt(),s=ia(n);s.tag=2,t!=null&&(s.callback=t),t=ra(e,s,n),t!==null&&(Tt(t,e,n),bs(t,e,n))}};function Zm(e,t,n,s,c,u,x){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,u,x):t.prototype&&t.prototype.isPureReactComponent?!ds(n,s)||!ds(c,u):!0}function Jm(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&&Cc.enqueueReplaceState(t,t.state,null)}function $a(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=b({},n));for(var c in e)n[c]===void 0&&(n[c]=e[c])}return n}function Im(e){Ri(e)}function Wm(e){console.error(e)}function Pm(e){Ri(e)}function er(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function eh(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 qc(e,t,n){return n=ia(n),n.tag=3,n.payload={element:null},n.callback=function(){er(e,t)},n}function th(e){return e=ia(e),e.tag=3,e}function nh(e,t,n,s){var c=n.type.getDerivedStateFromError;if(typeof c=="function"){var u=s.value;e.payload=function(){return c(u)},e.callback=function(){eh(t,n,s)}}var x=n.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(e.callback=function(){eh(t,n,s),typeof c!="function"&&(ma===null?ma=new Set([this]):ma.add(this));var A=s.stack;this.componentDidCatch(s.value,{componentStack:A!==null?A:""})})}function qv(e,t,n,s,c){if(n.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=n.alternate,t!==null&&bl(t,n,c,!0),n=zt.current,n!==null){switch(n.tag){case 31:case 13:return Wt===null?dr():n.alternate===null&&tt===0&&(tt=3),n.flags&=-257,n.flags|=65536,n.lanes=c,s===Vi?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([s]):t.add(s),Pc(e,s,c)),!1;case 22:return n.flags|=65536,s===Vi?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)),Pc(e,s,c)),!1}throw Error(o(435,n.tag))}return Pc(e,s,c),dr(),!1}if(ke)return t=zt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,s!==Ko&&(e=Error(o(422),{cause:s}),ps(Ft(e,n)))):(s!==Ko&&(t=Error(o(423),{cause:s}),ps(Ft(t,n))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,s=Ft(s,n),c=qc(e.stateNode,s,c),lc(e,c),tt!==4&&(tt=2)),!1;var u=Error(o(520),{cause:s});if(u=Ft(u,n),_s===null?_s=[u]:_s.push(u),tt!==4&&(tt=2),t===null)return!0;s=Ft(s,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=c&-c,n.lanes|=e,e=qc(n.stateNode,s,e),lc(n,e),!1;case 1:if(t=n.type,u=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||u!==null&&typeof u.componentDidCatch=="function"&&(ma===null||!ma.has(u))))return n.flags|=65536,c&=-c,n.lanes|=c,c=th(c),nh(c,e,n,s),lc(n,c),!1}n=n.return}while(n!==null);return!1}var Mc=Error(o(461)),ut=!1;function St(e,t,n,s){t.child=e===null?im(t,null,n,s):Va(t,e.child,n,s)}function ah(e,t,n,s,c){n=n.render;var u=t.ref;if("ref"in s){var x={};for(var A in s)A!=="ref"&&(x[A]=s[A])}else x=s;return za(t),s=uc(e,t,n,x,u,c),A=fc(),e!==null&&!ut?(dc(e,t,c),Bn(e,t,c)):(ke&&A&&Xo(t),t.flags|=1,St(e,t,s,c),t.child)}function lh(e,t,n,s,c){if(e===null){var u=n.type;return typeof u=="function"&&!Yo(u)&&u.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=u,sh(e,t,u,s,c)):(e=Oi(n.type,null,s,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!zc(e,c)){var x=u.memoizedProps;if(n=n.compare,n=n!==null?n:ds,n(x,s)&&e.ref===t.ref)return Bn(e,t,c)}return t.flags|=1,e=kn(u,s),e.ref=t.ref,e.return=t,t.child=e}function sh(e,t,n,s,c){if(e!==null){var u=e.memoizedProps;if(ds(u,s)&&e.ref===t.ref)if(ut=!1,t.pendingProps=s=u,zc(e,c))(e.flags&131072)!==0&&(ut=!0);else return t.lanes=e.lanes,Bn(e,t,c)}return kc(e,t,n,s,c)}function ih(e,t,n,s){var c=s.children,u=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(u=u!==null?u.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&~u}else s=0,t.child=null;return rh(e,t,u,n,s)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ui(t,u!==null?u.cachePool:null),u!==null?cm(t,u):ic(),um(t);else return s=t.lanes=536870912,rh(e,t,u!==null?u.baseLanes|n:n,n,s)}else u!==null?(Ui(t,u.cachePool),cm(t,u),ca(),t.memoizedState=null):(e!==null&&Ui(t,null),ic(),ca());return St(e,t,c,n),t.child}function Cs(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function rh(e,t,n,s,c){var u=ec();return u=u===null?null:{parent:ot._currentValue,pool:u},t.memoizedState={baseLanes:n,cachePool:u},e!==null&&Ui(t,null),ic(),um(t),e!==null&&bl(e,t,s,!0),t.childLanes=c,null}function tr(e,t){return t=ar({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function oh(e,t,n){return Va(t,e.child,null,n),e=tr(t,t.pendingProps),e.flags|=2,Lt(t),t.memoizedState=null,e}function Mv(e,t,n){var s=t.pendingProps,c=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(ke){if(s.mode==="hidden")return e=tr(t,s),t.lanes=536870912,Cs(null,e);if(oc(t),(e=Ze)?(e=b0(e,It),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ta!==null?{id:gn,overflow:vn}:null,retryLane:536870912,hydrationErrors:null},n=Xd(e),n.return=t,t.child=n,yt=t,Ze=null)):e=null,e===null)throw aa(t);return t.lanes=536870912,null}return tr(t,s)}var u=e.memoizedState;if(u!==null){var x=u.dehydrated;if(oc(t),c)if(t.flags&256)t.flags&=-257,t=oh(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558));else if(ut||bl(e,t,n,!1),c=(n&e.childLanes)!==0,ut||c){if(s=Ke,s!==null&&(x=Xe(s,n),x!==0&&x!==u.retryLane))throw u.retryLane=x,Da(e,x),Tt(s,e,x),Mc;dr(),t=oh(e,t,n)}else e=u.treeContext,Ze=Pt(x.nextSibling),yt=t,ke=!0,na=null,It=!1,e!==null&&Fd(t,e),t=tr(t,s),t.flags|=4096;return t}return e=kn(e.child,{mode:s.mode,children:s.children}),e.ref=t.ref,t.child=e,e.return=t,e}function nr(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 kc(e,t,n,s,c){return za(t),n=uc(e,t,n,s,void 0,c),s=fc(),e!==null&&!ut?(dc(e,t,c),Bn(e,t,c)):(ke&&s&&Xo(t),t.flags|=1,St(e,t,n,c),t.child)}function ch(e,t,n,s,c,u){return za(t),t.updateQueue=null,n=dm(t,s,n,c),fm(e),s=fc(),e!==null&&!ut?(dc(e,t,u),Bn(e,t,u)):(ke&&s&&Xo(t),t.flags|=1,St(e,t,n,u),t.child)}function uh(e,t,n,s,c){if(za(t),t.stateNode===null){var u=xl,x=n.contextType;typeof x=="object"&&x!==null&&(u=bt(x)),u=new n(s,u),t.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=Cc,t.stateNode=u,u._reactInternals=t,u=t.stateNode,u.props=s,u.state=t.memoizedState,u.refs={},nc(t),x=n.contextType,u.context=typeof x=="object"&&x!==null?bt(x):xl,u.state=t.memoizedState,x=n.getDerivedStateFromProps,typeof x=="function"&&(Ec(t,n,x,s),u.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(x=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),x!==u.state&&Cc.enqueueReplaceState(u,u.state,null),As(t,s,u,c),Ss(),u.state=t.memoizedState),typeof u.componentDidMount=="function"&&(t.flags|=4194308),s=!0}else if(e===null){u=t.stateNode;var A=t.memoizedProps,R=$a(n,A);u.props=R;var H=u.context,J=n.contextType;x=xl,typeof J=="object"&&J!==null&&(x=bt(J));var ee=n.getDerivedStateFromProps;J=typeof ee=="function"||typeof u.getSnapshotBeforeUpdate=="function",A=t.pendingProps!==A,J||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(A||H!==x)&&Jm(t,u,s,x),sa=!1;var Y=t.memoizedState;u.state=Y,As(t,s,u,c),Ss(),H=t.memoizedState,A||Y!==H||sa?(typeof ee=="function"&&(Ec(t,n,ee,s),H=t.memoizedState),(R=sa||Zm(t,n,R,s,Y,H,x))?(J||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(t.flags|=4194308)):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=H),u.props=s,u.state=H,u.context=x,s=R):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{u=t.stateNode,ac(e,t),x=t.memoizedProps,J=$a(n,x),u.props=J,ee=t.pendingProps,Y=u.context,H=n.contextType,R=xl,typeof H=="object"&&H!==null&&(R=bt(H)),A=n.getDerivedStateFromProps,(H=typeof A=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(x!==ee||Y!==R)&&Jm(t,u,s,R),sa=!1,Y=t.memoizedState,u.state=Y,As(t,s,u,c),Ss();var K=t.memoizedState;x!==ee||Y!==K||sa||e!==null&&e.dependencies!==null&&zi(e.dependencies)?(typeof A=="function"&&(Ec(t,n,A,s),K=t.memoizedState),(J=sa||Zm(t,n,J,s,Y,K,R)||e!==null&&e.dependencies!==null&&zi(e.dependencies))?(H||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(s,K,R),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(s,K,R)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||x===e.memoizedProps&&Y===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&Y===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=K),u.props=s,u.state=K,u.context=R,s=J):(typeof u.componentDidUpdate!="function"||x===e.memoizedProps&&Y===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&Y===e.memoizedState||(t.flags|=1024),s=!1)}return u=s,nr(e,t),s=(t.flags&128)!==0,u||s?(u=t.stateNode,n=s&&typeof n.getDerivedStateFromError!="function"?null:u.render(),t.flags|=1,e!==null&&s?(t.child=Va(t,e.child,null,c),t.child=Va(t,null,n,c)):St(e,t,n,c),t.memoizedState=u.state,e=t.child):e=Bn(e,t,c),e}function fh(e,t,n,s){return Oa(),t.flags|=256,St(e,t,n,s),t.child}var Rc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Tc(e){return{baseLanes:e,cachePool:em()}}function Dc(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Ht),e}function dh(e,t,n){var s=t.pendingProps,c=!1,u=(t.flags&128)!==0,x;if((x=u)||(x=e!==null&&e.memoizedState===null?!1:(nt.current&2)!==0),x&&(c=!0,t.flags&=-129),x=(t.flags&32)!==0,t.flags&=-33,e===null){if(ke){if(c?oa(t):ca(),(e=Ze)?(e=b0(e,It),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ta!==null?{id:gn,overflow:vn}:null,retryLane:536870912,hydrationErrors:null},n=Xd(e),n.return=t,t.child=n,yt=t,Ze=null)):e=null,e===null)throw aa(t);return pu(e)?t.lanes=32:t.lanes=536870912,null}var A=s.children;return s=s.fallback,c?(ca(),c=t.mode,A=ar({mode:"hidden",children:A},c),s=_a(s,c,n,null),A.return=t,s.return=t,A.sibling=s,t.child=A,s=t.child,s.memoizedState=Tc(n),s.childLanes=Dc(e,x,n),t.memoizedState=Rc,Cs(null,s)):(oa(t),_c(t,A))}var R=e.memoizedState;if(R!==null&&(A=R.dehydrated,A!==null)){if(u)t.flags&256?(oa(t),t.flags&=-257,t=Oc(e,t,n)):t.memoizedState!==null?(ca(),t.child=e.child,t.flags|=128,t=null):(ca(),A=s.fallback,c=t.mode,s=ar({mode:"visible",children:s.children},c),A=_a(A,c,n,null),A.flags|=2,s.return=t,A.return=t,s.sibling=A,t.child=s,Va(t,e.child,null,n),s=t.child,s.memoizedState=Tc(n),s.childLanes=Dc(e,x,n),t.memoizedState=Rc,t=Cs(null,s));else if(oa(t),pu(A)){if(x=A.nextSibling&&A.nextSibling.dataset,x)var H=x.dgst;x=H,s=Error(o(419)),s.stack="",s.digest=x,ps({value:s,source:null,stack:null}),t=Oc(e,t,n)}else if(ut||bl(e,t,n,!1),x=(n&e.childLanes)!==0,ut||x){if(x=Ke,x!==null&&(s=Xe(x,n),s!==0&&s!==R.retryLane))throw R.retryLane=s,Da(e,s),Tt(x,e,s),Mc;hu(A)||dr(),t=Oc(e,t,n)}else hu(A)?(t.flags|=192,t.child=e.child,t=null):(e=R.treeContext,Ze=Pt(A.nextSibling),yt=t,ke=!0,na=null,It=!1,e!==null&&Fd(t,e),t=_c(t,s.children),t.flags|=4096);return t}return c?(ca(),A=s.fallback,c=t.mode,R=e.child,H=R.sibling,s=kn(R,{mode:"hidden",children:s.children}),s.subtreeFlags=R.subtreeFlags&65011712,H!==null?A=kn(H,A):(A=_a(A,c,n,null),A.flags|=2),A.return=t,s.return=t,s.sibling=A,t.child=s,Cs(null,s),s=t.child,A=e.child.memoizedState,A===null?A=Tc(n):(c=A.cachePool,c!==null?(R=ot._currentValue,c=c.parent!==R?{parent:R,pool:R}:c):c=em(),A={baseLanes:A.baseLanes|n,cachePool:c}),s.memoizedState=A,s.childLanes=Dc(e,x,n),t.memoizedState=Rc,Cs(e.child,s)):(oa(t),n=e.child,e=n.sibling,n=kn(n,{mode:"visible",children:s.children}),n.return=t,n.sibling=null,e!==null&&(x=t.deletions,x===null?(t.deletions=[e],t.flags|=16):x.push(e)),t.child=n,t.memoizedState=null,n)}function _c(e,t){return t=ar({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function ar(e,t){return e=Bt(22,e,null,t),e.lanes=0,e}function Oc(e,t,n){return Va(t,e.child,null,n),e=_c(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function mh(e,t,n){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),Jo(e.return,t,n)}function Bc(e,t,n,s,c,u){var x=e.memoizedState;x===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:n,tailMode:c,treeForkCount:u}:(x.isBackwards=t,x.rendering=null,x.renderingStartTime=0,x.last=s,x.tail=n,x.tailMode=c,x.treeForkCount=u)}function hh(e,t,n){var s=t.pendingProps,c=s.revealOrder,u=s.tail;s=s.children;var x=nt.current,A=(x&2)!==0;if(A?(x=x&1|2,t.flags|=128):x&=1,W(nt,x),St(e,t,s,n),s=ke?hs:0,!A&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&mh(e,n,t);else if(e.tag===19)mh(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&&Xi(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,u,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&&Xi(e)===null){t.child=c;break}e=c.sibling,c.sibling=n,n=c,c=e}Bc(t,!0,n,null,u,s);break;case"together":Bc(t,!1,null,null,void 0,s);break;default:t.memoizedState=null}return t.child}function Bn(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),da|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(bl(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=kn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=kn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function zc(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&zi(e)))}function kv(e,t,n){switch(t.tag){case 3:ve(t,t.stateNode.containerInfo),la(t,ot,e.memoizedState.cache),Oa();break;case 27:case 5:Ce(t);break;case 4:ve(t,t.stateNode.containerInfo);break;case 10:la(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,oc(t),null;break;case 13:var s=t.memoizedState;if(s!==null)return s.dehydrated!==null?(oa(t),t.flags|=128,null):(n&t.child.childLanes)!==0?dh(e,t,n):(oa(t),e=Bn(e,t,n),e!==null?e.sibling:null);oa(t);break;case 19:var c=(e.flags&128)!==0;if(s=(n&t.childLanes)!==0,s||(bl(e,t,n,!1),s=(n&t.childLanes)!==0),c){if(s)return hh(e,t,n);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),W(nt,nt.current),s)break;return null;case 22:return t.lanes=0,ih(e,t,n,t.pendingProps);case 24:la(t,ot,e.memoizedState.cache)}return Bn(e,t,n)}function ph(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)ut=!0;else{if(!zc(e,n)&&(t.flags&128)===0)return ut=!1,kv(e,t,n);ut=(e.flags&131072)!==0}else ut=!1,ke&&(t.flags&1048576)!==0&&Kd(t,hs,t.index);switch(t.lanes=0,t.tag){case 16:e:{var s=t.pendingProps;if(e=Ua(t.elementType),t.type=e,typeof e=="function")Yo(e)?(s=$a(e,s),t.tag=1,t=uh(null,t,e,s,n)):(t.tag=0,t=kc(null,t,e,s,n));else{if(e!=null){var c=e.$$typeof;if(c===z){t.tag=11,t=ah(null,t,e,s,n);break e}else if(c===O){t.tag=14,t=lh(null,t,e,s,n);break e}}throw t=me(e)||e,Error(o(306,t,""))}}return t;case 0:return kc(e,t,t.type,t.pendingProps,n);case 1:return s=t.type,c=$a(s,t.pendingProps),uh(e,t,s,c,n);case 3:e:{if(ve(t,t.stateNode.containerInfo),e===null)throw Error(o(387));s=t.pendingProps;var u=t.memoizedState;c=u.element,ac(e,t),As(t,s,null,n);var x=t.memoizedState;if(s=x.cache,la(t,ot,s),s!==u.cache&&Io(t,[ot],n,!0),Ss(),s=x.element,u.isDehydrated)if(u={element:s,isDehydrated:!1,cache:x.cache},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){t=fh(e,t,s,n);break e}else if(s!==c){c=Ft(Error(o(424)),t),ps(c),t=fh(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(Ze=Pt(e.firstChild),yt=t,ke=!0,na=null,It=!0,n=im(t,null,s,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Oa(),s===c){t=Bn(e,t,n);break e}St(e,t,s,n)}t=t.child}return t;case 26:return nr(e,t),e===null?(n=E0(t.type,null,t.pendingProps,null))?t.memoizedState=n:ke||(n=t.type,e=t.pendingProps,s=yr(ie.current).createElement(n),s[Pe]=t,s[Te]=e,At(s,n,e),xt(s),t.stateNode=s):t.memoizedState=E0(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Ce(t),e===null&&ke&&(s=t.stateNode=j0(t.type,t.pendingProps,ie.current),yt=t,It=!0,c=Ze,ga(t.type)?(xu=c,Ze=Pt(s.firstChild)):Ze=c),St(e,t,t.pendingProps.children,n),nr(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ke&&((c=s=Ze)&&(s=iy(s,t.type,t.pendingProps,It),s!==null?(t.stateNode=s,yt=t,Ze=Pt(s.firstChild),It=!1,c=!0):c=!1),c||aa(t)),Ce(t),c=t.type,u=t.pendingProps,x=e!==null?e.memoizedProps:null,s=u.children,fu(c,u)?s=null:x!==null&&fu(c,x)&&(t.flags|=32),t.memoizedState!==null&&(c=uc(e,t,Sv,null,null,n),Ys._currentValue=c),nr(e,t),St(e,t,s,n),t.child;case 6:return e===null&&ke&&((e=n=Ze)&&(n=ry(n,t.pendingProps,It),n!==null?(t.stateNode=n,yt=t,Ze=null,e=!0):e=!1),e||aa(t)),null;case 13:return dh(e,t,n);case 4:return ve(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=Va(t,null,s,n):St(e,t,s,n),t.child;case 11:return ah(e,t,t.type,t.pendingProps,n);case 7:return St(e,t,t.pendingProps,n),t.child;case 8:return St(e,t,t.pendingProps.children,n),t.child;case 12:return St(e,t,t.pendingProps.children,n),t.child;case 10:return s=t.pendingProps,la(t,t.type,s.value),St(e,t,s.children,n),t.child;case 9:return c=t.type._context,s=t.pendingProps.children,za(t),c=bt(c),s=s(c),t.flags|=1,St(e,t,s,n),t.child;case 14:return lh(e,t,t.type,t.pendingProps,n);case 15:return sh(e,t,t.type,t.pendingProps,n);case 19:return hh(e,t,n);case 31:return Mv(e,t,n);case 22:return ih(e,t,n,t.pendingProps);case 24:return za(t),s=bt(ot),e===null?(c=ec(),c===null&&(c=Ke,u=Wo(),c.pooledCache=u,u.refCount++,u!==null&&(c.pooledCacheLanes|=n),c=u),t.memoizedState={parent:s,cache:c},nc(t),la(t,ot,c)):((e.lanes&n)!==0&&(ac(e,t),As(t,null,null,n),Ss()),c=e.memoizedState,u=t.memoizedState,c.parent!==s?(c={parent:s,cache:s},t.memoizedState=c,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=c),la(t,ot,s)):(s=u.cache,la(t,ot,s),s!==c.cache&&Io(t,[ot],n,!0))),St(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function zn(e){e.flags|=4}function Lc(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(Yh())e.flags|=8192;else throw Ha=Vi,tc}else e.flags&=-16777217}function xh(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!R0(t))if(Yh())e.flags|=8192;else throw Ha=Vi,tc}function lr(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?yi():536870912,e.lanes|=t,Tl|=t)}function qs(e,t){if(!ke)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 Je(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 Rv(e,t,n){var s=t.pendingProps;switch(Qo(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Je(t),null;case 1:return Je(t),null;case 3:return n=t.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),Dn(ot),he(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(yl(t)?zn(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Fo())),Je(t),null;case 26:var c=t.type,u=t.memoizedState;return e===null?(zn(t),u!==null?(Je(t),xh(t,u)):(Je(t),Lc(t,c,null,s,n))):u?u!==e.memoizedState?(zn(t),Je(t),xh(t,u)):(Je(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&zn(t),Je(t),Lc(t,c,e,s,n)),null;case 27:if(ne(t),n=ie.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&zn(t);else{if(!s){if(t.stateNode===null)throw Error(o(166));return Je(t),null}e=te.current,yl(t)?Zd(t):(e=j0(c,s,n),t.stateNode=e,zn(t))}return Je(t),null;case 5:if(ne(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&zn(t);else{if(!s){if(t.stateNode===null)throw Error(o(166));return Je(t),null}if(u=te.current,yl(t))Zd(t);else{var x=yr(ie.current);switch(u){case 1:u=x.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:u=x.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":u=x.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":u=x.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":u=x.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof s.is=="string"?x.createElement("select",{is:s.is}):x.createElement("select"),s.multiple?u.multiple=!0:s.size&&(u.size=s.size);break;default:u=typeof s.is=="string"?x.createElement(c,{is:s.is}):x.createElement(c)}}u[Pe]=t,u[Te]=s;e:for(x=t.child;x!==null;){if(x.tag===5||x.tag===6)u.appendChild(x.stateNode);else if(x.tag!==4&&x.tag!==27&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===t)break e;for(;x.sibling===null;){if(x.return===null||x.return===t)break e;x=x.return}x.sibling.return=x.return,x=x.sibling}t.stateNode=u;e:switch(At(u,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&&zn(t)}}return Je(t),Lc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&zn(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(o(166));if(e=ie.current,yl(t)){if(e=t.stateNode,n=t.memoizedProps,s=null,c=yt,c!==null)switch(c.tag){case 27:case 5:s=c.memoizedProps}e[Pe]=t,e=!!(e.nodeValue===n||s!==null&&s.suppressHydrationWarning===!0||d0(e.nodeValue,n)),e||aa(t,!0)}else e=yr(e).createTextNode(s),e[Pe]=t,t.stateNode=e}return Je(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(s=yl(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[Pe]=t}else Oa(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Je(t),e=!1}else n=Fo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Lt(t),t):(Lt(t),null);if((t.flags&128)!==0)throw Error(o(558))}return Je(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(c=yl(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[Pe]=t}else Oa(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Je(t),c=!1}else c=Fo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(Lt(t),t):(Lt(t),null)}return Lt(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),u=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),u!==c&&(s.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),lr(t,t.updateQueue),Je(t),null);case 4:return he(),e===null&&iu(t.stateNode.containerInfo),Je(t),null;case 10:return Dn(t.type),Je(t),null;case 19:if(_(nt),s=t.memoizedState,s===null)return Je(t),null;if(c=(t.flags&128)!==0,u=s.rendering,u===null)if(c)qs(s,!1);else{if(tt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=Xi(e),u!==null){for(t.flags|=128,qs(s,!1),e=u.updateQueue,t.updateQueue=e,lr(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Gd(n,e),n=n.sibling;return W(nt,nt.current&1|2),ke&&Rn(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&mt()>cr&&(t.flags|=128,c=!0,qs(s,!1),t.lanes=4194304)}else{if(!c)if(e=Xi(u),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,lr(t,e),qs(s,!0),s.tail===null&&s.tailMode==="hidden"&&!u.alternate&&!ke)return Je(t),null}else 2*mt()-s.renderingStartTime>cr&&n!==536870912&&(t.flags|=128,c=!0,qs(s,!1),t.lanes=4194304);s.isBackwards?(u.sibling=t.child,t.child=u):(e=s.last,e!==null?e.sibling=u:t.child=u,s.last=u)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=mt(),e.sibling=null,n=nt.current,W(nt,c?n&1|2:n&1),ke&&Rn(t,s.treeForkCount),e):(Je(t),null);case 22:case 23:return Lt(t),rc(),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&&(Je(t),t.subtreeFlags&6&&(t.flags|=8192)):Je(t),n=t.updateQueue,n!==null&&lr(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&&_(La),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Dn(ot),Je(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function Tv(e,t){switch(Qo(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Dn(ot),he(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ne(t),null;case 31:if(t.memoizedState!==null){if(Lt(t),t.alternate===null)throw Error(o(340));Oa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Lt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));Oa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return _(nt),null;case 4:return he(),null;case 10:return Dn(t.type),null;case 22:case 23:return Lt(t),rc(),e!==null&&_(La),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Dn(ot),null;case 25:return null;default:return null}}function gh(e,t){switch(Qo(t),t.tag){case 3:Dn(ot),he();break;case 26:case 27:case 5:ne(t);break;case 4:he();break;case 31:t.memoizedState!==null&&Lt(t);break;case 13:Lt(t);break;case 19:_(nt);break;case 10:Dn(t.type);break;case 22:case 23:Lt(t),rc(),e!==null&&_(La);break;case 24:Dn(ot)}}function Ms(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 u=n.create,x=n.inst;s=u(),x.destroy=s}n=n.next}while(n!==c)}}catch(A){He(t,t.return,A)}}function ua(e,t,n){try{var s=t.updateQueue,c=s!==null?s.lastEffect:null;if(c!==null){var u=c.next;s=u;do{if((s.tag&e)===e){var x=s.inst,A=x.destroy;if(A!==void 0){x.destroy=void 0,c=t;var R=n,H=A;try{H()}catch(J){He(c,R,J)}}}s=s.next}while(s!==u)}}catch(J){He(t,t.return,J)}}function vh(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{om(t,n)}catch(s){He(e,e.return,s)}}}function yh(e,t,n){n.props=$a(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(s){He(e,t,s)}}function ks(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){He(e,t,c)}}function yn(e,t){var n=e.ref,s=e.refCleanup;if(n!==null)if(typeof s=="function")try{s()}catch(c){He(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){He(e,t,c)}else n.current=null}function bh(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){He(e,e.return,c)}}function Uc(e,t,n){try{var s=e.stateNode;ey(s,e.type,n,t),s[Te]=t}catch(c){He(e,e.return,c)}}function Sh(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&ga(e.type)||e.tag===4}function Hc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Sh(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&&ga(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 Vc(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=qn));else if(s!==4&&(s===27&&ga(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Vc(e,t,n),e=e.sibling;e!==null;)Vc(e,t,n),e=e.sibling}function sr(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&&ga(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(sr(e,t,n),e=e.sibling;e!==null;)sr(e,t,n),e=e.sibling}function Ah(e){var t=e.stateNode,n=e.memoizedProps;try{for(var s=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);At(t,s,n),t[Pe]=e,t[Te]=n}catch(u){He(e,e.return,u)}}var Ln=!1,ft=!1,Yc=!1,jh=typeof WeakSet=="function"?WeakSet:Set,gt=null;function Dv(e,t){if(e=e.containerInfo,cu=Er,e=Od(e),Oo(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var s=n.getSelection&&n.getSelection();if(s&&s.rangeCount!==0){n=s.anchorNode;var c=s.anchorOffset,u=s.focusNode;s=s.focusOffset;try{n.nodeType,u.nodeType}catch{n=null;break e}var x=0,A=-1,R=-1,H=0,J=0,ee=e,Y=null;t:for(;;){for(var K;ee!==n||c!==0&&ee.nodeType!==3||(A=x+c),ee!==u||s!==0&&ee.nodeType!==3||(R=x+s),ee.nodeType===3&&(x+=ee.nodeValue.length),(K=ee.firstChild)!==null;)Y=ee,ee=K;for(;;){if(ee===e)break t;if(Y===n&&++H===c&&(A=x),Y===u&&++J===s&&(R=x),(K=ee.nextSibling)!==null)break;ee=Y,Y=ee.parentNode}ee=K}n=A===-1||R===-1?null:{start:A,end:R}}else n=null}n=n||{start:0,end:0}}else n=null;for(uu={focusedElem:e,selectionRange:n},Er=!1,gt=t;gt!==null;)if(t=gt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,gt=e;else for(;gt!==null;){switch(t=gt,u=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&&u!==null){e=void 0,n=t,c=u.memoizedProps,u=u.memoizedState,s=n.stateNode;try{var fe=$a(n.type,c);e=s.getSnapshotBeforeUpdate(fe,u),s.__reactInternalSnapshotBeforeUpdate=e}catch(ge){He(n,n.return,ge)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)mu(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":mu(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(o(163))}if(e=t.sibling,e!==null){e.return=t.return,gt=e;break}gt=t.return}}function Nh(e,t,n){var s=n.flags;switch(n.tag){case 0:case 11:case 15:Hn(e,n),s&4&&Ms(5,n);break;case 1:if(Hn(e,n),s&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(x){He(n,n.return,x)}else{var c=$a(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(x){He(n,n.return,x)}}s&64&&vh(n),s&512&&ks(n,n.return);break;case 3:if(Hn(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{om(e,t)}catch(x){He(n,n.return,x)}}break;case 27:t===null&&s&4&&Ah(n);case 26:case 5:Hn(e,n),t===null&&s&4&&bh(n),s&512&&ks(n,n.return);break;case 12:Hn(e,n);break;case 31:Hn(e,n),s&4&&Ch(e,n);break;case 13:Hn(e,n),s&4&&qh(e,n),s&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Yv.bind(null,n),oy(e,n))));break;case 22:if(s=n.memoizedState!==null||Ln,!s){t=t!==null&&t.memoizedState!==null||ft,c=Ln;var u=ft;Ln=s,(ft=t)&&!u?Vn(e,n,(n.subtreeFlags&8772)!==0):Hn(e,n),Ln=c,ft=u}break;case 30:break;default:Hn(e,n)}}function wh(e){var t=e.alternate;t!==null&&(e.alternate=null,wh(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&vo(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 Ie=null,qt=!1;function Un(e,t,n){for(n=n.child;n!==null;)Eh(e,t,n),n=n.sibling}function Eh(e,t,n){if(pt&&typeof pt.onCommitFiberUnmount=="function")try{pt.onCommitFiberUnmount(rn,n)}catch{}switch(n.tag){case 26:ft||yn(n,t),Un(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:ft||yn(n,t);var s=Ie,c=qt;ga(n.type)&&(Ie=n.stateNode,qt=!1),Un(e,t,n),Us(n.stateNode),Ie=s,qt=c;break;case 5:ft||yn(n,t);case 6:if(s=Ie,c=qt,Ie=null,Un(e,t,n),Ie=s,qt=c,Ie!==null)if(qt)try{(Ie.nodeType===9?Ie.body:Ie.nodeName==="HTML"?Ie.ownerDocument.body:Ie).removeChild(n.stateNode)}catch(u){He(n,t,u)}else try{Ie.removeChild(n.stateNode)}catch(u){He(n,t,u)}break;case 18:Ie!==null&&(qt?(e=Ie,v0(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Hl(e)):v0(Ie,n.stateNode));break;case 4:s=Ie,c=qt,Ie=n.stateNode.containerInfo,qt=!0,Un(e,t,n),Ie=s,qt=c;break;case 0:case 11:case 14:case 15:ua(2,n,t),ft||ua(4,n,t),Un(e,t,n);break;case 1:ft||(yn(n,t),s=n.stateNode,typeof s.componentWillUnmount=="function"&&yh(n,t,s)),Un(e,t,n);break;case 21:Un(e,t,n);break;case 22:ft=(s=ft)||n.memoizedState!==null,Un(e,t,n),ft=s;break;default:Un(e,t,n)}}function Ch(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Hl(e)}catch(n){He(t,t.return,n)}}}function qh(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Hl(e)}catch(n){He(t,t.return,n)}}function _v(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new jh),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new jh),t;default:throw Error(o(435,e.tag))}}function ir(e,t){var n=_v(e);t.forEach(function(s){if(!n.has(s)){n.add(s);var c=$v.bind(null,e,s);s.then(c,c)}})}function Mt(e,t){var n=t.deletions;if(n!==null)for(var s=0;s<n.length;s++){var c=n[s],u=e,x=t,A=x;e:for(;A!==null;){switch(A.tag){case 27:if(ga(A.type)){Ie=A.stateNode,qt=!1;break e}break;case 5:Ie=A.stateNode,qt=!1;break e;case 3:case 4:Ie=A.stateNode.containerInfo,qt=!0;break e}A=A.return}if(Ie===null)throw Error(o(160));Eh(u,x,c),Ie=null,qt=!1,u=c.alternate,u!==null&&(u.return=null),c.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Mh(t,e),t=t.sibling}var cn=null;function Mh(e,t){var n=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Mt(t,e),kt(e),s&4&&(ua(3,e,e.return),Ms(3,e),ua(5,e,e.return));break;case 1:Mt(t,e),kt(e),s&512&&(ft||n===null||yn(n,n.return)),s&64&&Ln&&(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=cn;if(Mt(t,e),kt(e),s&512&&(ft||n===null||yn(n,n.return)),s&4){var u=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":u=c.getElementsByTagName("title")[0],(!u||u[as]||u[Pe]||u.namespaceURI==="http://www.w3.org/2000/svg"||u.hasAttribute("itemprop"))&&(u=c.createElement(s),c.head.insertBefore(u,c.querySelector("head > title"))),At(u,s,n),u[Pe]=e,xt(u),s=u;break e;case"link":var x=M0("link","href",c).get(s+(n.href||""));if(x){for(var A=0;A<x.length;A++)if(u=x[A],u.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&u.getAttribute("rel")===(n.rel==null?null:n.rel)&&u.getAttribute("title")===(n.title==null?null:n.title)&&u.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){x.splice(A,1);break t}}u=c.createElement(s),At(u,s,n),c.head.appendChild(u);break;case"meta":if(x=M0("meta","content",c).get(s+(n.content||""))){for(A=0;A<x.length;A++)if(u=x[A],u.getAttribute("content")===(n.content==null?null:""+n.content)&&u.getAttribute("name")===(n.name==null?null:n.name)&&u.getAttribute("property")===(n.property==null?null:n.property)&&u.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&u.getAttribute("charset")===(n.charSet==null?null:n.charSet)){x.splice(A,1);break t}}u=c.createElement(s),At(u,s,n),c.head.appendChild(u);break;default:throw Error(o(468,s))}u[Pe]=e,xt(u),s=u}e.stateNode=s}else k0(c,e.type,e.stateNode);else e.stateNode=q0(c,s,e.memoizedProps);else u!==s?(u===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):u.count--,s===null?k0(c,e.type,e.stateNode):q0(c,s,e.memoizedProps)):s===null&&e.stateNode!==null&&Uc(e,e.memoizedProps,n.memoizedProps)}break;case 27:Mt(t,e),kt(e),s&512&&(ft||n===null||yn(n,n.return)),n!==null&&s&4&&Uc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Mt(t,e),kt(e),s&512&&(ft||n===null||yn(n,n.return)),e.flags&32){c=e.stateNode;try{cl(c,"")}catch(fe){He(e,e.return,fe)}}s&4&&e.stateNode!=null&&(c=e.memoizedProps,Uc(e,c,n!==null?n.memoizedProps:c)),s&1024&&(Yc=!0);break;case 6:if(Mt(t,e),kt(e),s&4){if(e.stateNode===null)throw Error(o(162));s=e.memoizedProps,n=e.stateNode;try{n.nodeValue=s}catch(fe){He(e,e.return,fe)}}break;case 3:if(Ar=null,c=cn,cn=br(t.containerInfo),Mt(t,e),cn=c,kt(e),s&4&&n!==null&&n.memoizedState.isDehydrated)try{Hl(t.containerInfo)}catch(fe){He(e,e.return,fe)}Yc&&(Yc=!1,kh(e));break;case 4:s=cn,cn=br(e.stateNode.containerInfo),Mt(t,e),kt(e),cn=s;break;case 12:Mt(t,e),kt(e);break;case 31:Mt(t,e),kt(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,ir(e,s)));break;case 13:Mt(t,e),kt(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(or=mt()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,ir(e,s)));break;case 22:c=e.memoizedState!==null;var R=n!==null&&n.memoizedState!==null,H=Ln,J=ft;if(Ln=H||c,ft=J||R,Mt(t,e),ft=J,Ln=H,kt(e),s&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(n===null||R||Ln||ft||Ga(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){R=n=t;try{if(u=R.stateNode,c)x=u.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none";else{A=R.stateNode;var ee=R.memoizedProps.style,Y=ee!=null&&ee.hasOwnProperty("display")?ee.display:null;A.style.display=Y==null||typeof Y=="boolean"?"":(""+Y).trim()}}catch(fe){He(R,R.return,fe)}}}else if(t.tag===6){if(n===null){R=t;try{R.stateNode.nodeValue=c?"":R.memoizedProps}catch(fe){He(R,R.return,fe)}}}else if(t.tag===18){if(n===null){R=t;try{var K=R.stateNode;c?y0(K,!0):y0(R.stateNode,!1)}catch(fe){He(R,R.return,fe)}}}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,ir(e,n))));break;case 19:Mt(t,e),kt(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,ir(e,s)));break;case 30:break;case 21:break;default:Mt(t,e),kt(e)}}function kt(e){var t=e.flags;if(t&2){try{for(var n,s=e.return;s!==null;){if(Sh(s)){n=s;break}s=s.return}if(n==null)throw Error(o(160));switch(n.tag){case 27:var c=n.stateNode,u=Hc(e);sr(e,u,c);break;case 5:var x=n.stateNode;n.flags&32&&(cl(x,""),n.flags&=-33);var A=Hc(e);sr(e,A,x);break;case 3:case 4:var R=n.stateNode.containerInfo,H=Hc(e);Vc(e,H,R);break;default:throw Error(o(161))}}catch(J){He(e,e.return,J)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function kh(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;kh(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Hn(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Nh(e,t.alternate,t),t=t.sibling}function Ga(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:ua(4,t,t.return),Ga(t);break;case 1:yn(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&yh(t,t.return,n),Ga(t);break;case 27:Us(t.stateNode);case 26:case 5:yn(t,t.return),Ga(t);break;case 22:t.memoizedState===null&&Ga(t);break;case 30:Ga(t);break;default:Ga(t)}e=e.sibling}}function Vn(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var s=t.alternate,c=e,u=t,x=u.flags;switch(u.tag){case 0:case 11:case 15:Vn(c,u,n),Ms(4,u);break;case 1:if(Vn(c,u,n),s=u,c=s.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(H){He(s,s.return,H)}if(s=u,c=s.updateQueue,c!==null){var A=s.stateNode;try{var R=c.shared.hiddenCallbacks;if(R!==null)for(c.shared.hiddenCallbacks=null,c=0;c<R.length;c++)rm(R[c],A)}catch(H){He(s,s.return,H)}}n&&x&64&&vh(u),ks(u,u.return);break;case 27:Ah(u);case 26:case 5:Vn(c,u,n),n&&s===null&&x&4&&bh(u),ks(u,u.return);break;case 12:Vn(c,u,n);break;case 31:Vn(c,u,n),n&&x&4&&Ch(c,u);break;case 13:Vn(c,u,n),n&&x&4&&qh(c,u);break;case 22:u.memoizedState===null&&Vn(c,u,n),ks(u,u.return);break;case 30:break;default:Vn(c,u,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&&xs(n))}function Gc(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&xs(e))}function un(e,t,n,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Rh(e,t,n,s),t=t.sibling}function Rh(e,t,n,s){var c=t.flags;switch(t.tag){case 0:case 11:case 15:un(e,t,n,s),c&2048&&Ms(9,t);break;case 1:un(e,t,n,s);break;case 3:un(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&&xs(e)));break;case 12:if(c&2048){un(e,t,n,s),e=t.stateNode;try{var u=t.memoizedProps,x=u.id,A=u.onPostCommit;typeof A=="function"&&A(x,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(R){He(t,t.return,R)}}else un(e,t,n,s);break;case 31:un(e,t,n,s);break;case 13:un(e,t,n,s);break;case 23:break;case 22:u=t.stateNode,x=t.alternate,t.memoizedState!==null?u._visibility&2?un(e,t,n,s):Rs(e,t):u._visibility&2?un(e,t,n,s):(u._visibility|=2,Ml(e,t,n,s,(t.subtreeFlags&10256)!==0||!1)),c&2048&&$c(x,t);break;case 24:un(e,t,n,s),c&2048&&Gc(t.alternate,t);break;default:un(e,t,n,s)}}function Ml(e,t,n,s,c){for(c=c&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var u=e,x=t,A=n,R=s,H=x.flags;switch(x.tag){case 0:case 11:case 15:Ml(u,x,A,R,c),Ms(8,x);break;case 23:break;case 22:var J=x.stateNode;x.memoizedState!==null?J._visibility&2?Ml(u,x,A,R,c):Rs(u,x):(J._visibility|=2,Ml(u,x,A,R,c)),c&&H&2048&&$c(x.alternate,x);break;case 24:Ml(u,x,A,R,c),c&&H&2048&&Gc(x.alternate,x);break;default:Ml(u,x,A,R,c)}t=t.sibling}}function Rs(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:Rs(n,s),c&2048&&$c(s.alternate,s);break;case 24:Rs(n,s),c&2048&&Gc(s.alternate,s);break;default:Rs(n,s)}t=t.sibling}}var Ts=8192;function kl(e,t,n){if(e.subtreeFlags&Ts)for(e=e.child;e!==null;)Th(e,t,n),e=e.sibling}function Th(e,t,n){switch(e.tag){case 26:kl(e,t,n),e.flags&Ts&&e.memoizedState!==null&&by(n,cn,e.memoizedState,e.memoizedProps);break;case 5:kl(e,t,n);break;case 3:case 4:var s=cn;cn=br(e.stateNode.containerInfo),kl(e,t,n),cn=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=Ts,Ts=16777216,kl(e,t,n),Ts=s):kl(e,t,n));break;default:kl(e,t,n)}}function Dh(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 Ds(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];gt=s,Oh(s,e)}Dh(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)_h(e),e=e.sibling}function _h(e){switch(e.tag){case 0:case 11:case 15:Ds(e),e.flags&2048&&ua(9,e,e.return);break;case 3:Ds(e);break;case 12:Ds(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,rr(e)):Ds(e);break;default:Ds(e)}}function rr(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];gt=s,Oh(s,e)}Dh(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:ua(8,t,t.return),rr(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,rr(t));break;default:rr(t)}e=e.sibling}}function Oh(e,t){for(;gt!==null;){var n=gt;switch(n.tag){case 0:case 11:case 15:ua(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:xs(n.memoizedState.cache)}if(s=n.child,s!==null)s.return=n,gt=s;else e:for(n=e;gt!==null;){s=gt;var c=s.sibling,u=s.return;if(wh(s),s===n){gt=null;break e}if(c!==null){c.return=u,gt=c;break e}gt=u}}}var Ov={getCacheForType:function(e){var t=bt(ot),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return bt(ot).controller.signal}},Bv=typeof WeakMap=="function"?WeakMap:Map,Be=0,Ke=null,we=null,qe=0,Ue=0,Ut=null,fa=!1,Rl=!1,Xc=!1,Yn=0,tt=0,da=0,Xa=0,Qc=0,Ht=0,Tl=0,_s=null,Rt=null,Kc=!1,or=0,Bh=0,cr=1/0,ur=null,ma=null,ht=0,ha=null,Dl=null,$n=0,Fc=0,Zc=null,zh=null,Os=0,Jc=null;function Vt(){return(Be&2)!==0&&qe!==0?qe&-qe:k.T!==null?nu():Le()}function Lh(){if(Ht===0)if((qe&536870912)===0||ke){var e=Fe;Fe<<=1,(Fe&3932160)===0&&(Fe=262144),Ht=e}else Ht=536870912;return e=zt.current,e!==null&&(e.flags|=32),Ht}function Tt(e,t,n){(e===Ke&&(Ue===2||Ue===9)||e.cancelPendingCommit!==null)&&(_l(e,0),pa(e,qe,Ht,!1)),qa(e,n),((Be&2)===0||e!==Ke)&&(e===Ke&&((Be&2)===0&&(Xa|=n),tt===4&&pa(e,qe,Ht,!1)),bn(e))}function Uh(e,t,n){if((Be&6)!==0)throw Error(o(327));var s=!n&&(t&127)===0&&(t&e.expiredLanes)===0||xn(e,t),c=s?Uv(e,t):Wc(e,t,!0),u=s;do{if(c===0){Rl&&!s&&pa(e,t,0,!1);break}else{if(n=e.current.alternate,u&&!zv(n)){c=Wc(e,t,!1),u=!1;continue}if(c===2){if(u=t,e.errorRecoveryDisabledLanes&u)var x=0;else x=e.pendingLanes&-536870913,x=x!==0?x:x&536870912?536870912:0;if(x!==0){t=x;e:{var A=e;c=_s;var R=A.current.memoizedState.isDehydrated;if(R&&(_l(A,x).flags|=256),x=Wc(A,x,!1),x!==2){if(Xc&&!R){A.errorRecoveryDisabledLanes|=u,Xa|=u,c=4;break e}u=Rt,Rt=c,u!==null&&(Rt===null?Rt=u:Rt.push.apply(Rt,u))}c=x}if(u=!1,c!==2)continue}}if(c===1){_l(e,0),pa(e,t,0,!0);break}e:{switch(s=e,u=c,u){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t)break;case 6:pa(s,t,Ht,!fa);break e;case 2:Rt=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(c=or+300-mt(),10<c)){if(pa(s,t,Ht,!fa),Pn(s,0,!0)!==0)break e;$n=t,s.timeoutHandle=x0(Hh.bind(null,s,n,Rt,ur,Kc,t,Ht,Xa,Tl,fa,u,"Throttled",-0,0),c);break e}Hh(s,n,Rt,ur,Kc,t,Ht,Xa,Tl,fa,u,null,-0,0)}}break}while(!0);bn(e)}function Hh(e,t,n,s,c,u,x,A,R,H,J,ee,Y,K){if(e.timeoutHandle=-1,ee=t.subtreeFlags,ee&8192||(ee&16785408)===16785408){ee={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:qn},Th(t,u,ee);var fe=(u&62914560)===u?or-mt():(u&4194048)===u?Bh-mt():0;if(fe=Sy(ee,fe),fe!==null){$n=u,e.cancelPendingCommit=fe(Fh.bind(null,e,t,u,n,s,c,x,A,R,J,ee,null,Y,K)),pa(e,u,x,!H);return}}Fh(e,t,u,n,s,c,x,A,R)}function zv(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],u=c.getSnapshot;c=c.value;try{if(!Ot(u(),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 pa(e,t,n,s){t&=~Qc,t&=~Xa,e.suspendedLanes|=t,e.pingedLanes&=~t,s&&(e.warmLanes|=t),s=e.expirationTimes;for(var c=t;0<c;){var u=31-rt(c),x=1<<u;s[u]=-1,c&=~x}n!==0&&$t(e,n,t)}function fr(){return(Be&6)===0?(Bs(0),!1):!0}function Ic(){if(we!==null){if(Ue===0)var e=we.return;else e=we,Tn=Ba=null,mc(e),Nl=null,vs=0,e=we;for(;e!==null;)gh(e.alternate,e),e=e.return;we=null}}function _l(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,ay(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),$n=0,Ic(),Ke=e,we=n=kn(e.current,null),qe=t,Ue=0,Ut=null,fa=!1,Rl=xn(e,t),Xc=!1,Tl=Ht=Qc=Xa=da=tt=0,Rt=_s=null,Kc=!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-rt(s),u=1<<c;t|=e[c],s&=~u}return Yn=t,Ti(),n}function Vh(e,t){be=null,k.H=Es,t===jl||t===Hi?(t=am(),Ue=3):t===tc?(t=am(),Ue=4):Ue=t===Mc?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Ut=t,we===null&&(tt=1,er(e,Ft(t,e.current)))}function Yh(){var e=zt.current;return e===null?!0:(qe&4194048)===qe?Wt===null:(qe&62914560)===qe||(qe&536870912)!==0?e===Wt:!1}function $h(){var e=k.H;return k.H=Es,e===null?Es:e}function Gh(){var e=k.A;return k.A=Ov,e}function dr(){tt=4,fa||(qe&4194048)!==qe&&zt.current!==null||(Rl=!0),(da&134217727)===0&&(Xa&134217727)===0||Ke===null||pa(Ke,qe,Ht,!1)}function Wc(e,t,n){var s=Be;Be|=2;var c=$h(),u=Gh();(Ke!==e||qe!==t)&&(ur=null,_l(e,t)),t=!1;var x=tt;e:do try{if(Ue!==0&&we!==null){var A=we,R=Ut;switch(Ue){case 8:Ic(),x=6;break e;case 3:case 2:case 9:case 6:zt.current===null&&(t=!0);var H=Ue;if(Ue=0,Ut=null,Ol(e,A,R,H),n&&Rl){x=0;break e}break;default:H=Ue,Ue=0,Ut=null,Ol(e,A,R,H)}}Lv(),x=tt;break}catch(J){Vh(e,J)}while(!0);return t&&e.shellSuspendCounter++,Tn=Ba=null,Be=s,k.H=c,k.A=u,we===null&&(Ke=null,qe=0,Ti()),x}function Lv(){for(;we!==null;)Xh(we)}function Uv(e,t){var n=Be;Be|=2;var s=$h(),c=Gh();Ke!==e||qe!==t?(ur=null,cr=mt()+500,_l(e,t)):Rl=xn(e,t);e:do try{if(Ue!==0&&we!==null){t=we;var u=Ut;t:switch(Ue){case 1:Ue=0,Ut=null,Ol(e,t,u,1);break;case 2:case 9:if(tm(u)){Ue=0,Ut=null,Qh(t);break}t=function(){Ue!==2&&Ue!==9||Ke!==e||(Ue=7),bn(e)},u.then(t,t);break e;case 3:Ue=7;break e;case 4:Ue=5;break e;case 7:tm(u)?(Ue=0,Ut=null,Qh(t)):(Ue=0,Ut=null,Ol(e,t,u,7));break;case 5:var x=null;switch(we.tag){case 26:x=we.memoizedState;case 5:case 27:var A=we;if(x?R0(x):A.stateNode.complete){Ue=0,Ut=null;var R=A.sibling;if(R!==null)we=R;else{var H=A.return;H!==null?(we=H,mr(H)):we=null}break t}}Ue=0,Ut=null,Ol(e,t,u,5);break;case 6:Ue=0,Ut=null,Ol(e,t,u,6);break;case 8:Ic(),tt=6;break e;default:throw Error(o(462))}}Hv();break}catch(J){Vh(e,J)}while(!0);return Tn=Ba=null,k.H=s,k.A=c,Be=n,we!==null?0:(Ke=null,qe=0,Ti(),tt)}function Hv(){for(;we!==null&&!fo();)Xh(we)}function Xh(e){var t=ph(e.alternate,e,Yn);e.memoizedProps=e.pendingProps,t===null?mr(e):we=t}function Qh(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=ch(n,t,t.pendingProps,t.type,void 0,qe);break;case 11:t=ch(n,t,t.pendingProps,t.type.render,t.ref,qe);break;case 5:mc(t);default:gh(n,t),t=we=Gd(t,Yn),t=ph(n,t,Yn)}e.memoizedProps=e.pendingProps,t===null?mr(e):we=t}function Ol(e,t,n,s){Tn=Ba=null,mc(t),Nl=null,vs=0;var c=t.return;try{if(qv(e,c,t,n,qe)){tt=1,er(e,Ft(n,e.current)),we=null;return}}catch(u){if(c!==null)throw we=c,u;tt=1,er(e,Ft(n,e.current)),we=null;return}t.flags&32768?(ke||s===1?e=!0:Rl||(qe&536870912)!==0?e=!1:(fa=e=!0,(s===2||s===9||s===3||s===6)&&(s=zt.current,s!==null&&s.tag===13&&(s.flags|=16384))),Kh(t,e)):mr(t)}function mr(e){var t=e;do{if((t.flags&32768)!==0){Kh(t,fa);return}e=t.return;var n=Rv(t.alternate,t,Yn);if(n!==null){we=n;return}if(t=t.sibling,t!==null){we=t;return}we=t=e}while(t!==null);tt===0&&(tt=5)}function Kh(e,t){do{var n=Tv(e.alternate,e);if(n!==null){n.flags&=32767,we=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){we=e;return}we=e=n}while(e!==null);tt=6,we=null}function Fh(e,t,n,s,c,u,x,A,R){e.cancelPendingCommit=null;do hr();while(ht!==0);if((Be&6)!==0)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));if(u=t.lanes|t.childLanes,u|=Ho,bi(e,n,u,x,A,R),e===Ke&&(we=Ke=null,qe=0),Dl=t,ha=e,$n=n,Fc=u,Zc=c,zh=s,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Gv(Ea,function(){return Ph(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||s){s=k.T,k.T=null,c=Q.p,Q.p=2,x=Be,Be|=4;try{Dv(e,t,n)}finally{Be=x,Q.p=c,k.T=s}}ht=1,Zh(),Jh(),Ih()}}function Zh(){if(ht===1){ht=0;var e=ha,t=Dl,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=k.T,k.T=null;var s=Q.p;Q.p=2;var c=Be;Be|=4;try{Mh(t,e);var u=uu,x=Od(e.containerInfo),A=u.focusedElem,R=u.selectionRange;if(x!==A&&A&&A.ownerDocument&&_d(A.ownerDocument.documentElement,A)){if(R!==null&&Oo(A)){var H=R.start,J=R.end;if(J===void 0&&(J=H),"selectionStart"in A)A.selectionStart=H,A.selectionEnd=Math.min(J,A.value.length);else{var ee=A.ownerDocument||document,Y=ee&&ee.defaultView||window;if(Y.getSelection){var K=Y.getSelection(),fe=A.textContent.length,ge=Math.min(R.start,fe),Ge=R.end===void 0?ge:Math.min(R.end,fe);!K.extend&&ge>Ge&&(x=Ge,Ge=ge,ge=x);var B=Dd(A,ge),D=Dd(A,Ge);if(B&&D&&(K.rangeCount!==1||K.anchorNode!==B.node||K.anchorOffset!==B.offset||K.focusNode!==D.node||K.focusOffset!==D.offset)){var U=ee.createRange();U.setStart(B.node,B.offset),K.removeAllRanges(),ge>Ge?(K.addRange(U),K.extend(D.node,D.offset)):(U.setEnd(D.node,D.offset),K.addRange(U))}}}}for(ee=[],K=A;K=K.parentNode;)K.nodeType===1&&ee.push({element:K,left:K.scrollLeft,top:K.scrollTop});for(typeof A.focus=="function"&&A.focus(),A=0;A<ee.length;A++){var I=ee[A];I.element.scrollLeft=I.left,I.element.scrollTop=I.top}}Er=!!cu,uu=cu=null}finally{Be=c,Q.p=s,k.T=n}}e.current=t,ht=2}}function Jh(){if(ht===2){ht=0;var e=ha,t=Dl,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=k.T,k.T=null;var s=Q.p;Q.p=2;var c=Be;Be|=4;try{Nh(e,t.alternate,t)}finally{Be=c,Q.p=s,k.T=n}}ht=3}}function Ih(){if(ht===4||ht===3){ht=0,mo();var e=ha,t=Dl,n=$n,s=zh;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?ht=5:(ht=0,Dl=ha=null,Wh(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(ma=null),je(n),t=t.stateNode,pt&&typeof pt.onCommitFiberRoot=="function")try{pt.onCommitFiberRoot(rn,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=k.T,c=Q.p,Q.p=2,k.T=null;try{for(var u=e.onRecoverableError,x=0;x<s.length;x++){var A=s[x];u(A.value,{componentStack:A.stack})}}finally{k.T=t,Q.p=c}}($n&3)!==0&&hr(),bn(e),c=e.pendingLanes,(n&261930)!==0&&(c&42)!==0?e===Jc?Os++:(Os=0,Jc=e):Os=0,Bs(0)}}function Wh(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,xs(t)))}function hr(){return Zh(),Jh(),Ih(),Ph()}function Ph(){if(ht!==5)return!1;var e=ha,t=Fc;Fc=0;var n=je($n),s=k.T,c=Q.p;try{Q.p=32>n?32:n,k.T=null,n=Zc,Zc=null;var u=ha,x=$n;if(ht=0,Dl=ha=null,$n=0,(Be&6)!==0)throw Error(o(331));var A=Be;if(Be|=4,_h(u.current),Rh(u,u.current,x,n),Be=A,Bs(0,!1),pt&&typeof pt.onPostCommitFiberRoot=="function")try{pt.onPostCommitFiberRoot(rn,u)}catch{}return!0}finally{Q.p=c,k.T=s,Wh(e,t)}}function e0(e,t,n){t=Ft(n,t),t=qc(e.stateNode,t,2),e=ra(e,t,2),e!==null&&(qa(e,2),bn(e))}function He(e,t,n){if(e.tag===3)e0(e,e,n);else for(;t!==null;){if(t.tag===3){e0(t,e,n);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(ma===null||!ma.has(s))){e=Ft(n,e),n=th(2),s=ra(t,n,2),s!==null&&(nh(n,s,t,e),qa(s,2),bn(s));break}}t=t.return}}function Pc(e,t,n){var s=e.pingCache;if(s===null){s=e.pingCache=new Bv;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)||(Xc=!0,c.add(n),e=Vv.bind(null,e,t,n),t.then(e,e))}function Vv(e,t,n){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ke===e&&(qe&n)===n&&(tt===4||tt===3&&(qe&62914560)===qe&&300>mt()-or?(Be&2)===0&&_l(e,0):Qc|=n,Tl===qe&&(Tl=0)),bn(e)}function t0(e,t){t===0&&(t=yi()),e=Da(e,t),e!==null&&(qa(e,t),bn(e))}function Yv(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),t0(e,n)}function $v(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),t0(e,n)}function Gv(e,t){return it(e,t)}var pr=null,Bl=null,eu=!1,xr=!1,tu=!1,xa=0;function bn(e){e!==Bl&&e.next===null&&(Bl===null?pr=Bl=e:Bl=Bl.next=e),xr=!0,eu||(eu=!0,Qv())}function Bs(e,t){if(!tu&&xr){tu=!0;do for(var n=!1,s=pr;s!==null;){if(e!==0){var c=s.pendingLanes;if(c===0)var u=0;else{var x=s.suspendedLanes,A=s.pingedLanes;u=(1<<31-rt(42|e)+1)-1,u&=c&~(x&~A),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(n=!0,s0(s,u))}else u=qe,u=Pn(s,s===Ke?u:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(u&3)===0||xn(s,u)||(n=!0,s0(s,u));s=s.next}while(n);tu=!1}}function Xv(){n0()}function n0(){xr=eu=!1;var e=0;xa!==0&&ny()&&(e=xa);for(var t=mt(),n=null,s=pr;s!==null;){var c=s.next,u=a0(s,t);u===0?(s.next=null,n===null?pr=c:n.next=c,c===null&&(Bl=n)):(n=s,(e!==0||(u&3)!==0)&&(xr=!0)),s=c}ht!==0&&ht!==5||Bs(e),xa!==0&&(xa=0)}function a0(e,t){for(var n=e.suspendedLanes,s=e.pingedLanes,c=e.expirationTimes,u=e.pendingLanes&-62914561;0<u;){var x=31-rt(u),A=1<<x,R=c[x];R===-1?((A&n)===0||(A&s)!==0)&&(c[x]=vi(A,t)):R<=t&&(e.expiredLanes|=A),u&=~A}if(t=Ke,n=qe,n=Pn(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,n===0||e===t&&(Ue===2||Ue===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&ln(s),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||xn(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(s!==null&&ln(s),je(n)){case 2:case 8:n=sn;break;case 32:n=Ea;break;case 268435456:n=tl;break;default:n=Ea}return s=l0.bind(null,e),n=it(n,s),e.callbackPriority=t,e.callbackNode=n,t}return s!==null&&s!==null&&ln(s),e.callbackPriority=2,e.callbackNode=null,2}function l0(e,t){if(ht!==0&&ht!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(hr()&&e.callbackNode!==n)return null;var s=qe;return s=Pn(e,e===Ke?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(Uh(e,s,t),a0(e,mt()),e.callbackNode!=null&&e.callbackNode===n?l0.bind(null,e):null)}function s0(e,t){if(hr())return null;Uh(e,t,!0)}function Qv(){ly(function(){(Be&6)!==0?it(el,Xv):n0()})}function nu(){if(xa===0){var e=Sl;e===0&&(e=Ca,Ca<<=1,(Ca&261888)===0&&(Ca=256)),xa=e}return xa}function i0(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Ni(""+e)}function r0(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 Kv(e,t,n,s,c){if(t==="submit"&&n&&n.stateNode===c){var u=i0((c[Te]||null).action),x=s.submitter;x&&(t=(t=x[Te]||null)?i0(t.formAction):x.getAttribute("formAction"),t!==null&&(u=t,x=null));var A=new qi("action","action",null,s,c);e.push({event:A,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(xa!==0){var R=x?r0(c,x):new FormData(c);Ac(n,{pending:!0,data:R,method:c.method,action:u},null,R)}}else typeof u=="function"&&(A.preventDefault(),R=x?r0(c,x):new FormData(c),Ac(n,{pending:!0,data:R,method:c.method,action:u},u,R))},currentTarget:c}]})}}for(var au=0;au<Uo.length;au++){var lu=Uo[au],Fv=lu.toLowerCase(),Zv=lu[0].toUpperCase()+lu.slice(1);on(Fv,"on"+Zv)}on(Ld,"onAnimationEnd"),on(Ud,"onAnimationIteration"),on(Hd,"onAnimationStart"),on("dblclick","onDoubleClick"),on("focusin","onFocus"),on("focusout","onBlur"),on(fv,"onTransitionRun"),on(dv,"onTransitionStart"),on(mv,"onTransitionCancel"),on(Vd,"onTransitionEnd"),rl("onMouseEnter",["mouseout","mouseover"]),rl("onMouseLeave",["mouseout","mouseover"]),rl("onPointerEnter",["pointerout","pointerover"]),rl("onPointerLeave",["pointerout","pointerover"]),Ma("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ma("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ma("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ma("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ma("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ma("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var zs="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(" "),Jv=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(zs));function o0(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 u=void 0;if(t)for(var x=s.length-1;0<=x;x--){var A=s[x],R=A.instance,H=A.currentTarget;if(A=A.listener,R!==u&&c.isPropagationStopped())break e;u=A,c.currentTarget=H;try{u(c)}catch(J){Ri(J)}c.currentTarget=null,u=R}else for(x=0;x<s.length;x++){if(A=s[x],R=A.instance,H=A.currentTarget,A=A.listener,R!==u&&c.isPropagationStopped())break e;u=A,c.currentTarget=H;try{u(c)}catch(J){Ri(J)}c.currentTarget=null,u=R}}}}function Ee(e,t){var n=t[go];n===void 0&&(n=t[go]=new Set);var s=e+"__bubble";n.has(s)||(c0(t,e,2,!1),n.add(s))}function su(e,t,n){var s=0;t&&(s|=4),c0(n,e,s,t)}var gr="_reactListening"+Math.random().toString(36).slice(2);function iu(e){if(!e[gr]){e[gr]=!0,nd.forEach(function(n){n!=="selectionchange"&&(Jv.has(n)||su(n,!1,e),su(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[gr]||(t[gr]=!0,su("selectionchange",!1,t))}}function c0(e,t,n,s){switch(L0(t)){case 2:var c=Ny;break;case 8:c=wy;break;default:c=Su}n=c.bind(null,t,n,e),c=void 0,!Eo||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 ru(e,t,n,s,c){var u=s;if((t&1)===0&&(t&2)===0&&s!==null)e:for(;;){if(s===null)return;var x=s.tag;if(x===3||x===4){var A=s.stateNode.containerInfo;if(A===c)break;if(x===4)for(x=s.return;x!==null;){var R=x.tag;if((R===3||R===4)&&x.stateNode.containerInfo===c)return;x=x.return}for(;A!==null;){if(x=ll(A),x===null)return;if(R=x.tag,R===5||R===6||R===26||R===27){s=u=x;continue e}A=A.parentNode}}s=s.return}hd(function(){var H=u,J=No(n),ee=[];e:{var Y=Yd.get(e);if(Y!==void 0){var K=qi,fe=e;switch(e){case"keypress":if(Ei(n)===0)break e;case"keydown":case"keyup":K=$g;break;case"focusin":fe="focus",K=ko;break;case"focusout":fe="blur",K=ko;break;case"beforeblur":case"afterblur":K=ko;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":K=gd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":K=Rg;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":K=Qg;break;case Ld:case Ud:case Hd:K=_g;break;case Vd:K=Fg;break;case"scroll":case"scrollend":K=Mg;break;case"wheel":K=Jg;break;case"copy":case"cut":case"paste":K=Bg;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":K=yd;break;case"toggle":case"beforetoggle":K=Wg}var ge=(t&4)!==0,Ge=!ge&&(e==="scroll"||e==="scrollend"),B=ge?Y!==null?Y+"Capture":null:Y;ge=[];for(var D=H,U;D!==null;){var I=D;if(U=I.stateNode,I=I.tag,I!==5&&I!==26&&I!==27||U===null||B===null||(I=ss(D,B),I!=null&&ge.push(Ls(D,I,U))),Ge)break;D=D.return}0<ge.length&&(Y=new K(Y,fe,null,n,J),ee.push({event:Y,listeners:ge}))}}if((t&7)===0){e:{if(Y=e==="mouseover"||e==="pointerover",K=e==="mouseout"||e==="pointerout",Y&&n!==jo&&(fe=n.relatedTarget||n.fromElement)&&(ll(fe)||fe[Gt]))break e;if((K||Y)&&(Y=J.window===J?J:(Y=J.ownerDocument)?Y.defaultView||Y.parentWindow:window,K?(fe=n.relatedTarget||n.toElement,K=H,fe=fe?ll(fe):null,fe!==null&&(Ge=d(fe),ge=fe.tag,fe!==Ge||ge!==5&&ge!==27&&ge!==6)&&(fe=null)):(K=null,fe=H),K!==fe)){if(ge=gd,I="onMouseLeave",B="onMouseEnter",D="mouse",(e==="pointerout"||e==="pointerover")&&(ge=yd,I="onPointerLeave",B="onPointerEnter",D="pointer"),Ge=K==null?Y:ls(K),U=fe==null?Y:ls(fe),Y=new ge(I,D+"leave",K,n,J),Y.target=Ge,Y.relatedTarget=U,I=null,ll(J)===H&&(ge=new ge(B,D+"enter",fe,n,J),ge.target=U,ge.relatedTarget=Ge,I=ge),Ge=I,K&&fe)t:{for(ge=Iv,B=K,D=fe,U=0,I=B;I;I=ge(I))U++;I=0;for(var pe=D;pe;pe=ge(pe))I++;for(;0<U-I;)B=ge(B),U--;for(;0<I-U;)D=ge(D),I--;for(;U--;){if(B===D||D!==null&&B===D.alternate){ge=B;break t}B=ge(B),D=ge(D)}ge=null}else ge=null;K!==null&&u0(ee,Y,K,ge,!1),fe!==null&&Ge!==null&&u0(ee,Ge,fe,ge,!0)}}e:{if(Y=H?ls(H):window,K=Y.nodeName&&Y.nodeName.toLowerCase(),K==="select"||K==="input"&&Y.type==="file")var De=Cd;else if(wd(Y))if(qd)De=ov;else{De=iv;var de=sv}else K=Y.nodeName,!K||K.toLowerCase()!=="input"||Y.type!=="checkbox"&&Y.type!=="radio"?H&&Ao(H.elementType)&&(De=Cd):De=rv;if(De&&(De=De(e,H))){Ed(ee,De,n,J);break e}de&&de(e,Y,H),e==="focusout"&&H&&Y.type==="number"&&H.memoizedProps.value!=null&&So(Y,"number",Y.value)}switch(de=H?ls(H):window,e){case"focusin":(wd(de)||de.contentEditable==="true")&&(ml=de,Bo=H,ms=null);break;case"focusout":ms=Bo=ml=null;break;case"mousedown":zo=!0;break;case"contextmenu":case"mouseup":case"dragend":zo=!1,Bd(ee,n,J);break;case"selectionchange":if(uv)break;case"keydown":case"keyup":Bd(ee,n,J)}var Ae;if(To)e:{switch(e){case"compositionstart":var Me="onCompositionStart";break e;case"compositionend":Me="onCompositionEnd";break e;case"compositionupdate":Me="onCompositionUpdate";break e}Me=void 0}else dl?jd(e,n)&&(Me="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(Me="onCompositionStart");Me&&(bd&&n.locale!=="ko"&&(dl||Me!=="onCompositionStart"?Me==="onCompositionEnd"&&dl&&(Ae=pd()):(ea=J,Co="value"in ea?ea.value:ea.textContent,dl=!0)),de=vr(H,Me),0<de.length&&(Me=new vd(Me,e,null,n,J),ee.push({event:Me,listeners:de}),Ae?Me.data=Ae:(Ae=Nd(n),Ae!==null&&(Me.data=Ae)))),(Ae=ev?tv(e,n):nv(e,n))&&(Me=vr(H,"onBeforeInput"),0<Me.length&&(de=new vd("onBeforeInput","beforeinput",null,n,J),ee.push({event:de,listeners:Me}),de.data=Ae)),Kv(ee,e,H,n,J)}o0(ee,t)})}function Ls(e,t,n){return{instance:e,listener:t,currentTarget:n}}function vr(e,t){for(var n=t+"Capture",s=[];e!==null;){var c=e,u=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||u===null||(c=ss(e,n),c!=null&&s.unshift(Ls(e,c,u)),c=ss(e,t),c!=null&&s.push(Ls(e,c,u))),e.tag===3)return s;e=e.return}return[]}function Iv(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function u0(e,t,n,s,c){for(var u=t._reactName,x=[];n!==null&&n!==s;){var A=n,R=A.alternate,H=A.stateNode;if(A=A.tag,R!==null&&R===s)break;A!==5&&A!==26&&A!==27||H===null||(R=H,c?(H=ss(n,u),H!=null&&x.unshift(Ls(n,H,R))):c||(H=ss(n,u),H!=null&&x.push(Ls(n,H,R)))),n=n.return}x.length!==0&&e.push({event:t,listeners:x})}var Wv=/\r\n?/g,Pv=/\u0000|\uFFFD/g;function f0(e){return(typeof e=="string"?e:""+e).replace(Wv,`
`).replace(Pv,"")}function d0(e,t){return t=f0(t),f0(e)===t}function $e(e,t,n,s,c,u){switch(n){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||cl(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&cl(e,""+s);break;case"className":Ai(e,"class",s);break;case"tabIndex":Ai(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":Ai(e,n,s);break;case"style":dd(e,s,u);break;case"data":if(t!=="object"){Ai(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=Ni(""+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 u=="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=Ni(""+s),e.setAttribute(n,s);break;case"onClick":s!=null&&(e.onclick=qn);break;case"onScroll":s!=null&&Ee("scroll",e);break;case"onScrollEnd":s!=null&&Ee("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=Ni(""+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":Ee("beforetoggle",e),Ee("toggle",e),Si(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":Si(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=Cg.get(n)||n,Si(e,n,s))}}function ou(e,t,n,s,c,u){switch(n){case"style":dd(e,s,u);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"?cl(e,s):(typeof s=="number"||typeof s=="bigint")&&cl(e,""+s);break;case"onScroll":s!=null&&Ee("scroll",e);break;case"onScrollEnd":s!=null&&Ee("scrollend",e);break;case"onClick":s!=null&&(e.onclick=qn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ad.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(c=n.endsWith("Capture"),t=n.slice(2,c?n.length-7:void 0),u=e[Te]||null,u=u!=null?u[n]:null,typeof u=="function"&&e.removeEventListener(t,u,c),typeof s=="function")){typeof u!="function"&&u!==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,""):Si(e,n,s)}}}function At(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ee("error",e),Ee("load",e);var s=!1,c=!1,u;for(u in n)if(n.hasOwnProperty(u)){var x=n[u];if(x!=null)switch(u){case"src":s=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:$e(e,t,u,x,n,null)}}c&&$e(e,t,"srcSet",n.srcSet,n,null),s&&$e(e,t,"src",n.src,n,null);return;case"input":Ee("invalid",e);var A=u=x=c=null,R=null,H=null;for(s in n)if(n.hasOwnProperty(s)){var J=n[s];if(J!=null)switch(s){case"name":c=J;break;case"type":x=J;break;case"checked":R=J;break;case"defaultChecked":H=J;break;case"value":u=J;break;case"defaultValue":A=J;break;case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(o(137,t));break;default:$e(e,t,s,J,n,null)}}od(e,u,A,R,H,x,c,!1);return;case"select":Ee("invalid",e),s=x=u=null;for(c in n)if(n.hasOwnProperty(c)&&(A=n[c],A!=null))switch(c){case"value":u=A;break;case"defaultValue":x=A;break;case"multiple":s=A;default:$e(e,t,c,A,n,null)}t=u,n=x,e.multiple=!!s,t!=null?ol(e,!!s,t,!1):n!=null&&ol(e,!!s,n,!0);return;case"textarea":Ee("invalid",e),u=c=s=null;for(x in n)if(n.hasOwnProperty(x)&&(A=n[x],A!=null))switch(x){case"value":s=A;break;case"defaultValue":c=A;break;case"children":u=A;break;case"dangerouslySetInnerHTML":if(A!=null)throw Error(o(91));break;default:$e(e,t,x,A,n,null)}ud(e,s,c,u);return;case"option":for(R in n)if(n.hasOwnProperty(R)&&(s=n[R],s!=null))switch(R){case"selected":e.selected=s&&typeof s!="function"&&typeof s!="symbol";break;default:$e(e,t,R,s,n,null)}return;case"dialog":Ee("beforetoggle",e),Ee("toggle",e),Ee("cancel",e),Ee("close",e);break;case"iframe":case"object":Ee("load",e);break;case"video":case"audio":for(s=0;s<zs.length;s++)Ee(zs[s],e);break;case"image":Ee("error",e),Ee("load",e);break;case"details":Ee("toggle",e);break;case"embed":case"source":case"link":Ee("error",e),Ee("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(H in n)if(n.hasOwnProperty(H)&&(s=n[H],s!=null))switch(H){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:$e(e,t,H,s,n,null)}return;default:if(Ao(t)){for(J in n)n.hasOwnProperty(J)&&(s=n[J],s!==void 0&&ou(e,t,J,s,n,void 0));return}}for(A in n)n.hasOwnProperty(A)&&(s=n[A],s!=null&&$e(e,t,A,s,n,null))}function ey(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,u=null,x=null,A=null,R=null,H=null,J=null;for(K in n){var ee=n[K];if(n.hasOwnProperty(K)&&ee!=null)switch(K){case"checked":break;case"value":break;case"defaultValue":R=ee;default:s.hasOwnProperty(K)||$e(e,t,K,null,s,ee)}}for(var Y in s){var K=s[Y];if(ee=n[Y],s.hasOwnProperty(Y)&&(K!=null||ee!=null))switch(Y){case"type":u=K;break;case"name":c=K;break;case"checked":H=K;break;case"defaultChecked":J=K;break;case"value":x=K;break;case"defaultValue":A=K;break;case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(o(137,t));break;default:K!==ee&&$e(e,t,Y,K,s,ee)}}bo(e,x,A,R,H,J,u,c);return;case"select":K=x=A=Y=null;for(u in n)if(R=n[u],n.hasOwnProperty(u)&&R!=null)switch(u){case"value":break;case"multiple":K=R;default:s.hasOwnProperty(u)||$e(e,t,u,null,s,R)}for(c in s)if(u=s[c],R=n[c],s.hasOwnProperty(c)&&(u!=null||R!=null))switch(c){case"value":Y=u;break;case"defaultValue":A=u;break;case"multiple":x=u;default:u!==R&&$e(e,t,c,u,s,R)}t=A,n=x,s=K,Y!=null?ol(e,!!n,Y,!1):!!s!=!!n&&(t!=null?ol(e,!!n,t,!0):ol(e,!!n,n?[]:"",!1));return;case"textarea":K=Y=null;for(A in n)if(c=n[A],n.hasOwnProperty(A)&&c!=null&&!s.hasOwnProperty(A))switch(A){case"value":break;case"children":break;default:$e(e,t,A,null,s,c)}for(x in s)if(c=s[x],u=n[x],s.hasOwnProperty(x)&&(c!=null||u!=null))switch(x){case"value":Y=c;break;case"defaultValue":K=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(o(91));break;default:c!==u&&$e(e,t,x,c,s,u)}cd(e,Y,K);return;case"option":for(var fe in n)if(Y=n[fe],n.hasOwnProperty(fe)&&Y!=null&&!s.hasOwnProperty(fe))switch(fe){case"selected":e.selected=!1;break;default:$e(e,t,fe,null,s,Y)}for(R in s)if(Y=s[R],K=n[R],s.hasOwnProperty(R)&&Y!==K&&(Y!=null||K!=null))switch(R){case"selected":e.selected=Y&&typeof Y!="function"&&typeof Y!="symbol";break;default:$e(e,t,R,Y,s,K)}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 ge in n)Y=n[ge],n.hasOwnProperty(ge)&&Y!=null&&!s.hasOwnProperty(ge)&&$e(e,t,ge,null,s,Y);for(H in s)if(Y=s[H],K=n[H],s.hasOwnProperty(H)&&Y!==K&&(Y!=null||K!=null))switch(H){case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(o(137,t));break;default:$e(e,t,H,Y,s,K)}return;default:if(Ao(t)){for(var Ge in n)Y=n[Ge],n.hasOwnProperty(Ge)&&Y!==void 0&&!s.hasOwnProperty(Ge)&&ou(e,t,Ge,void 0,s,Y);for(J in s)Y=s[J],K=n[J],!s.hasOwnProperty(J)||Y===K||Y===void 0&&K===void 0||ou(e,t,J,Y,s,K);return}}for(var B in n)Y=n[B],n.hasOwnProperty(B)&&Y!=null&&!s.hasOwnProperty(B)&&$e(e,t,B,null,s,Y);for(ee in s)Y=s[ee],K=n[ee],!s.hasOwnProperty(ee)||Y===K||Y==null&&K==null||$e(e,t,ee,Y,s,K)}function m0(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function ty(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),s=0;s<n.length;s++){var c=n[s],u=c.transferSize,x=c.initiatorType,A=c.duration;if(u&&A&&m0(x)){for(x=0,A=c.responseEnd,s+=1;s<n.length;s++){var R=n[s],H=R.startTime;if(H>A)break;var J=R.transferSize,ee=R.initiatorType;J&&m0(ee)&&(R=R.responseEnd,x+=J*(R<A?1:(A-H)/(R-H)))}if(--s,t+=8*(u+x)/(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 cu=null,uu=null;function yr(e){return e.nodeType===9?e:e.ownerDocument}function h0(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 p0(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function fu(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var du=null;function ny(){var e=window.event;return e&&e.type==="popstate"?e===du?!1:(du=e,!0):(du=null,!1)}var x0=typeof setTimeout=="function"?setTimeout:void 0,ay=typeof clearTimeout=="function"?clearTimeout:void 0,g0=typeof Promise=="function"?Promise:void 0,ly=typeof queueMicrotask=="function"?queueMicrotask:typeof g0<"u"?function(e){return g0.resolve(null).then(e).catch(sy)}:x0;function sy(e){setTimeout(function(){throw e})}function ga(e){return e==="head"}function v0(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),Hl(t);return}s--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")s++;else if(n==="html")Us(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,Us(n);for(var u=n.firstChild;u;){var x=u.nextSibling,A=u.nodeName;u[as]||A==="SCRIPT"||A==="STYLE"||A==="LINK"&&u.rel.toLowerCase()==="stylesheet"||n.removeChild(u),u=x}}else n==="body"&&Us(e.ownerDocument.body);n=c}while(n);Hl(t)}function y0(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 mu(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":mu(n),vo(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function iy(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[as])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(u=e.getAttribute("rel"),u==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(u!==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(u=e.getAttribute("src"),(u!==(c.src==null?null:c.src)||e.getAttribute("type")!==(c.type==null?null:c.type)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&u&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var u=c.name==null?null:""+c.name;if(c.type==="hidden"&&e.getAttribute("name")===u)return e}else return e;if(e=Pt(e.nextSibling),e===null)break}return null}function ry(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Pt(e.nextSibling),e===null))return null;return e}function b0(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Pt(e.nextSibling),e===null))return null;return e}function hu(e){return e.data==="$?"||e.data==="$~"}function pu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function oy(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 Pt(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 xu=null;function S0(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return Pt(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function A0(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 j0(e,t,n){switch(t=yr(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 Us(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);vo(e)}var en=new Map,N0=new Set;function br(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Gn=Q.d;Q.d={f:cy,r:uy,D:fy,C:dy,L:my,m:hy,X:xy,S:py,M:gy};function cy(){var e=Gn.f(),t=fr();return e||t}function uy(e){var t=sl(e);t!==null&&t.tag===5&&t.type==="form"?Vm(t):Gn.r(e)}var zl=typeof document>"u"?null:document;function w0(e,t,n){var s=zl;if(s&&typeof t=="string"&&t){var c=Qt(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof n=="string"&&(c+='[crossorigin="'+n+'"]'),N0.has(c)||(N0.add(c),e={rel:e,crossOrigin:n,href:t},s.querySelector(c)===null&&(t=s.createElement("link"),At(t,"link",e),xt(t),s.head.appendChild(t)))}}function fy(e){Gn.D(e),w0("dns-prefetch",e,null)}function dy(e,t){Gn.C(e,t),w0("preconnect",e,t)}function my(e,t,n){Gn.L(e,t,n);var s=zl;if(s&&e&&t){var c='link[rel="preload"][as="'+Qt(t)+'"]';t==="image"&&n&&n.imageSrcSet?(c+='[imagesrcset="'+Qt(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(c+='[imagesizes="'+Qt(n.imageSizes)+'"]')):c+='[href="'+Qt(e)+'"]';var u=c;switch(t){case"style":u=Ll(e);break;case"script":u=Ul(e)}en.has(u)||(e=b({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),en.set(u,e),s.querySelector(c)!==null||t==="style"&&s.querySelector(Hs(u))||t==="script"&&s.querySelector(Vs(u))||(t=s.createElement("link"),At(t,"link",e),xt(t),s.head.appendChild(t)))}}function hy(e,t){Gn.m(e,t);var n=zl;if(n&&e){var s=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+Qt(s)+'"][href="'+Qt(e)+'"]',u=c;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=Ul(e)}if(!en.has(u)&&(e=b({rel:"modulepreload",href:e},t),en.set(u,e),n.querySelector(c)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Vs(u)))return}s=n.createElement("link"),At(s,"link",e),xt(s),n.head.appendChild(s)}}}function py(e,t,n){Gn.S(e,t,n);var s=zl;if(s&&e){var c=il(s).hoistableStyles,u=Ll(e);t=t||"default";var x=c.get(u);if(!x){var A={loading:0,preload:null};if(x=s.querySelector(Hs(u)))A.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":t},n),(n=en.get(u))&&gu(e,n);var R=x=s.createElement("link");xt(R),At(R,"link",e),R._p=new Promise(function(H,J){R.onload=H,R.onerror=J}),R.addEventListener("load",function(){A.loading|=1}),R.addEventListener("error",function(){A.loading|=2}),A.loading|=4,Sr(x,t,s)}x={type:"stylesheet",instance:x,count:1,state:A},c.set(u,x)}}}function xy(e,t){Gn.X(e,t);var n=zl;if(n&&e){var s=il(n).hoistableScripts,c=Ul(e),u=s.get(c);u||(u=n.querySelector(Vs(c)),u||(e=b({src:e,async:!0},t),(t=en.get(c))&&vu(e,t),u=n.createElement("script"),xt(u),At(u,"link",e),n.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},s.set(c,u))}}function gy(e,t){Gn.M(e,t);var n=zl;if(n&&e){var s=il(n).hoistableScripts,c=Ul(e),u=s.get(c);u||(u=n.querySelector(Vs(c)),u||(e=b({src:e,async:!0,type:"module"},t),(t=en.get(c))&&vu(e,t),u=n.createElement("script"),xt(u),At(u,"link",e),n.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},s.set(c,u))}}function E0(e,t,n,s){var c=(c=ie.current)?br(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=Ll(n.href),n=il(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=Ll(n.href);var u=il(c).hoistableStyles,x=u.get(e);if(x||(c=c.ownerDocument||c,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,x),(u=c.querySelector(Hs(e)))&&!u._p&&(x.instance=u,x.state.loading=5),en.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},en.set(e,n),u||vy(c,e,n,x.state))),t&&s===null)throw Error(o(528,""));return x}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=Ul(n),n=il(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 Ll(e){return'href="'+Qt(e)+'"'}function Hs(e){return'link[rel="stylesheet"]['+e+"]"}function C0(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function vy(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}),At(t,"link",n),xt(t),e.head.appendChild(t))}function Ul(e){return'[src="'+Qt(e)+'"]'}function Vs(e){return"script[async]"+e}function q0(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+Qt(n.href)+'"]');if(s)return t.instance=s,xt(s),s;var c=b({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),xt(s),At(s,"style",c),Sr(s,n.precedence,e),t.instance=s;case"stylesheet":c=Ll(n.href);var u=e.querySelector(Hs(c));if(u)return t.state.loading|=4,t.instance=u,xt(u),u;s=C0(n),(c=en.get(c))&&gu(s,c),u=(e.ownerDocument||e).createElement("link"),xt(u);var x=u;return x._p=new Promise(function(A,R){x.onload=A,x.onerror=R}),At(u,"link",s),t.state.loading|=4,Sr(u,n.precedence,e),t.instance=u;case"script":return u=Ul(n.src),(c=e.querySelector(Vs(u)))?(t.instance=c,xt(c),c):(s=n,(c=en.get(u))&&(s=b({},n),vu(s,c)),e=e.ownerDocument||e,c=e.createElement("script"),xt(c),At(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,Sr(s,n.precedence,e));return t.instance}function Sr(e,t,n){for(var s=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=s.length?s[s.length-1]:null,u=c,x=0;x<s.length;x++){var A=s[x];if(A.dataset.precedence===t)u=A;else if(u!==c)break}u?u.parentNode.insertBefore(e,u.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function gu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function vu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Ar=null;function M0(e,t,n){if(Ar===null){var s=new Map,c=Ar=new Map;c.set(n,s)}else c=Ar,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 u=n[c];if(!(u[as]||u[Pe]||e==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var x=u.getAttribute(t)||"";x=e+x;var A=s.get(x);A?A.push(u):s.set(x,[u])}}return s}function k0(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function yy(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 R0(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function by(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=Ll(s.href),u=t.querySelector(Hs(c));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=jr.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=u,xt(u);return}u=t.ownerDocument||t,s=C0(s),(c=en.get(c))&&gu(s,c),u=u.createElement("link"),xt(u);var x=u;x._p=new Promise(function(A,R){x.onload=A,x.onerror=R}),At(u,"link",s),n.instance=u}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=jr.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var yu=0;function Sy(e,t){return e.stylesheets&&e.count===0&&wr(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var s=setTimeout(function(){if(e.stylesheets&&wr(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&yu===0&&(yu=62500*ty());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&wr(e,e.stylesheets),e.unsuspend)){var u=e.unsuspend;e.unsuspend=null,u()}},(e.imgBytes>yu?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(c)}}:null}function jr(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)wr(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Nr=null;function wr(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Nr=new Map,t.forEach(Ay,e),Nr=null,jr.call(e))}function Ay(e,t){if(!(t.state.loading&4)){var n=Nr.get(e);if(n)var s=n.get(null);else{n=new Map,Nr.set(e,n);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<c.length;u++){var x=c[u];(x.nodeName==="LINK"||x.getAttribute("media")!=="not all")&&(n.set(x.dataset.precedence,x),s=x)}s&&n.set(null,s)}c=t.instance,x=c.getAttribute("data-precedence"),u=n.get(x)||s,u===s&&n.set(null,c),n.set(x,c),this.count++,s=jr.bind(this),c.addEventListener("load",s),c.addEventListener("error",s),u?u.parentNode.insertBefore(c,u.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(c,e.firstChild)),t.state.loading|=4}}var Ys={$$typeof:T,Provider:null,Consumer:null,_currentValue:P,_currentValue2:P,_threadCount:0};function jy(e,t,n,s,c,u,x,A,R){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=ns(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ns(0),this.hiddenUpdates=ns(null),this.identifierPrefix=s,this.onUncaughtError=c,this.onCaughtError=u,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=R,this.incompleteTransitions=new Map}function T0(e,t,n,s,c,u,x,A,R,H,J,ee){return e=new jy(e,t,n,x,R,H,J,ee,A),t=1,u===!0&&(t|=24),u=Bt(3,null,null,t),e.current=u,u.stateNode=e,t=Wo(),t.refCount++,e.pooledCache=t,t.refCount++,u.memoizedState={element:s,isDehydrated:n,cache:t},nc(u),e}function D0(e){return e?(e=xl,e):xl}function _0(e,t,n,s,c,u){c=D0(c),s.context===null?s.context=c:s.pendingContext=c,s=ia(t),s.payload={element:n},u=u===void 0?null:u,u!==null&&(s.callback=u),n=ra(e,s,t),n!==null&&(Tt(n,e,t),bs(n,e,t))}function O0(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function bu(e,t){O0(e,t),(e=e.alternate)&&O0(e,t)}function B0(e){if(e.tag===13||e.tag===31){var t=Da(e,67108864);t!==null&&Tt(t,e,67108864),bu(e,67108864)}}function z0(e){if(e.tag===13||e.tag===31){var t=Vt();t=Qe(t);var n=Da(e,t);n!==null&&Tt(n,e,t),bu(e,t)}}var Er=!0;function Ny(e,t,n,s){var c=k.T;k.T=null;var u=Q.p;try{Q.p=2,Su(e,t,n,s)}finally{Q.p=u,k.T=c}}function wy(e,t,n,s){var c=k.T;k.T=null;var u=Q.p;try{Q.p=8,Su(e,t,n,s)}finally{Q.p=u,k.T=c}}function Su(e,t,n,s){if(Er){var c=Au(s);if(c===null)ru(e,t,s,Cr,n),U0(e,s);else if(Cy(c,e,t,n,s))s.stopPropagation();else if(U0(e,s),t&4&&-1<Ey.indexOf(e)){for(;c!==null;){var u=sl(c);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var x=_t(u.pendingLanes);if(x!==0){var A=u;for(A.pendingLanes|=2,A.entangledLanes|=2;x;){var R=1<<31-rt(x);A.entanglements[1]|=R,x&=~R}bn(u),(Be&6)===0&&(cr=mt()+500,Bs(0))}}break;case 31:case 13:A=Da(u,2),A!==null&&Tt(A,u,2),fr(),bu(u,2)}if(u=Au(s),u===null&&ru(e,t,s,Cr,n),u===c)break;c=u}c!==null&&s.stopPropagation()}else ru(e,t,s,null,n)}}function Au(e){return e=No(e),ju(e)}var Cr=null;function ju(e){if(Cr=null,e=ll(e),e!==null){var t=d(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=p(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Cr=e,null}function L0(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(Pa()){case el:return 2;case sn:return 8;case Ea:case gi:return 32;case tl:return 268435456;default:return 32}default:return 32}}var Nu=!1,va=null,ya=null,ba=null,$s=new Map,Gs=new Map,Sa=[],Ey="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 U0(e,t){switch(e){case"focusin":case"focusout":va=null;break;case"dragenter":case"dragleave":ya=null;break;case"mouseover":case"mouseout":ba=null;break;case"pointerover":case"pointerout":$s.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Gs.delete(t.pointerId)}}function Xs(e,t,n,s,c,u){return e===null||e.nativeEvent!==u?(e={blockedOn:t,domEventName:n,eventSystemFlags:s,nativeEvent:u,targetContainers:[c]},t!==null&&(t=sl(t),t!==null&&B0(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function Cy(e,t,n,s,c){switch(t){case"focusin":return va=Xs(va,e,t,n,s,c),!0;case"dragenter":return ya=Xs(ya,e,t,n,s,c),!0;case"mouseover":return ba=Xs(ba,e,t,n,s,c),!0;case"pointerover":var u=c.pointerId;return $s.set(u,Xs($s.get(u)||null,e,t,n,s,c)),!0;case"gotpointercapture":return u=c.pointerId,Gs.set(u,Xs(Gs.get(u)||null,e,t,n,s,c)),!0}return!1}function H0(e){var t=ll(e.target);if(t!==null){var n=d(t);if(n!==null){if(t=n.tag,t===13){if(t=h(n),t!==null){e.blockedOn=t,vt(e.priority,function(){z0(n)});return}}else if(t===31){if(t=p(n),t!==null){e.blockedOn=t,vt(e.priority,function(){z0(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 qr(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Au(e.nativeEvent);if(n===null){n=e.nativeEvent;var s=new n.constructor(n.type,n);jo=s,n.target.dispatchEvent(s),jo=null}else return t=sl(n),t!==null&&B0(t),e.blockedOn=n,!1;t.shift()}return!0}function V0(e,t,n){qr(e)&&n.delete(t)}function qy(){Nu=!1,va!==null&&qr(va)&&(va=null),ya!==null&&qr(ya)&&(ya=null),ba!==null&&qr(ba)&&(ba=null),$s.forEach(V0),Gs.forEach(V0)}function Mr(e,t){e.blockedOn===t&&(e.blockedOn=null,Nu||(Nu=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,qy)))}var kr=null;function Y0(e){kr!==e&&(kr=e,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){kr===e&&(kr=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(ju(s||n)===null)continue;break}var u=sl(n);u!==null&&(e.splice(t,3),t-=3,Ac(u,{pending:!0,data:c,method:n.method,action:s},s,c))}}))}function Hl(e){function t(R){return Mr(R,e)}va!==null&&Mr(va,e),ya!==null&&Mr(ya,e),ba!==null&&Mr(ba,e),$s.forEach(t),Gs.forEach(t);for(var n=0;n<Sa.length;n++){var s=Sa[n];s.blockedOn===e&&(s.blockedOn=null)}for(;0<Sa.length&&(n=Sa[0],n.blockedOn===null);)H0(n),n.blockedOn===null&&Sa.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(s=0;s<n.length;s+=3){var c=n[s],u=n[s+1],x=c[Te]||null;if(typeof u=="function")x||Y0(n);else if(x){var A=null;if(u&&u.hasAttribute("formAction")){if(c=u,x=u[Te]||null)A=x.formAction;else if(ju(c)!==null)continue}else A=x.action;typeof A=="function"?n[s+1]=A:(n.splice(s,3),s-=3),Y0(n)}}}function $0(){function e(u){u.canIntercept&&u.info==="react-transition"&&u.intercept({handler:function(){return new Promise(function(x){return c=x})},focusReset:"manual",scroll:"manual"})}function t(){c!==null&&(c(),c=null),s||setTimeout(n,20)}function n(){if(!s&&!navigation.transition){var u=navigation.currentEntry;u&&u.url!=null&&navigation.navigate(u.url,{state:u.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 wu(e){this._internalRoot=e}Rr.prototype.render=wu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var n=t.current,s=Vt();_0(n,s,e,t,null,null)},Rr.prototype.unmount=wu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;_0(e.current,2,null,e,null,null),fr(),t[Gt]=null}};function Rr(e){this._internalRoot=e}Rr.prototype.unstable_scheduleHydration=function(e){if(e){var t=Le();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Sa.length&&t!==0&&t<Sa[n].priority;n++);Sa.splice(n,0,e),n===0&&H0(e)}};var G0=l.version;if(G0!=="19.2.0")throw Error(o(527,G0,"19.2.0"));Q.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=v(t),e=e!==null?y(e):null,e=e===null?null:e.stateNode,e};var My={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:k,reconcilerVersion:"19.2.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Tr=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Tr.isDisabled&&Tr.supportsFiber)try{rn=Tr.inject(My),pt=Tr}catch{}}return Ks.createRoot=function(e,t){if(!f(e))throw Error(o(299));var n=!1,s="",c=Im,u=Wm,x=Pm;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&&(u=t.onCaughtError),t.onRecoverableError!==void 0&&(x=t.onRecoverableError)),t=T0(e,1,!1,null,null,n,s,null,c,u,x,$0),e[Gt]=t.current,iu(e),new wu(t)},Ks.hydrateRoot=function(e,t,n){if(!f(e))throw Error(o(299));var s=!1,c="",u=Im,x=Wm,A=Pm,R=null;return n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(c=n.identifierPrefix),n.onUncaughtError!==void 0&&(u=n.onUncaughtError),n.onCaughtError!==void 0&&(x=n.onCaughtError),n.onRecoverableError!==void 0&&(A=n.onRecoverableError),n.formState!==void 0&&(R=n.formState)),t=T0(e,1,!0,t,n??null,s,c,R,u,x,A,$0),t.context=D0(null),n=t.current,s=Vt(),s=Qe(s),c=ia(s),c.callback=null,ra(n,c,s),n=s,t.current.lanes=n,qa(t,n),bn(t),e[Gt]=t.current,iu(e),new Rr(t)},Ks.version="19.2.0",Ks}var ep;function Hy(){if(ep)return qu.exports;ep=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(l){console.error(l)}}return a(),qu.exports=Uy(),qu.exports}var Vy=Hy();var tp="popstate";function Yy(a={}){function l(o,f){let{pathname:d,search:h,hash:p}=o.location;return nf("",{pathname:d,search:h,hash:p},f.state&&f.state.usr||null,f.state&&f.state.key||"default")}function i(o,f){return typeof f=="string"?f:li(f)}return Gy(l,i,null,a)}function We(a,l){if(a===!1||a===null||typeof a>"u")throw new Error(l)}function pn(a,l){if(!a){typeof console<"u"&&console.warn(l);try{throw new Error(l)}catch{}}}function $y(){return Math.random().toString(36).substring(2,10)}function np(a,l){return{usr:a.state,key:a.key,idx:l}}function nf(a,l,i=null,o){return{pathname:typeof a=="string"?a:a.pathname,search:"",hash:"",...typeof l=="string"?Il(l):l,state:i,key:l&&l.key||o||$y()}}function li({pathname:a="/",search:l="",hash:i=""}){return l&&l!=="?"&&(a+=l.charAt(0)==="?"?l:"?"+l),i&&i!=="#"&&(a+=i.charAt(0)==="#"?i:"#"+i),a}function Il(a){let l={};if(a){let i=a.indexOf("#");i>=0&&(l.hash=a.substring(i),a=a.substring(0,i));let o=a.indexOf("?");o>=0&&(l.search=a.substring(o),a=a.substring(0,o)),a&&(l.pathname=a)}return l}function Gy(a,l,i,o={}){let{window:f=document.defaultView,v5Compat:d=!1}=o,h=f.history,p="POP",g=null,v=y();v==null&&(v=0,h.replaceState({...h.state,idx:v},""));function y(){return(h.state||{idx:null}).idx}function b(){p="POP";let N=y(),E=N==null?null:N-v;v=N,g&&g({action:p,location:q.location,delta:E})}function j(N,E){p="PUSH";let S=nf(q.location,N,E);v=y()+1;let T=np(S,v),z=q.createHref(S);try{h.pushState(T,"",z)}catch(L){if(L instanceof DOMException&&L.name==="DataCloneError")throw L;f.location.assign(z)}d&&g&&g({action:p,location:q.location,delta:1})}function M(N,E){p="REPLACE";let S=nf(q.location,N,E);v=y();let T=np(S,v),z=q.createHref(S);h.replaceState(T,"",z),d&&g&&g({action:p,location:q.location,delta:0})}function w(N){return Xy(N)}let q={get action(){return p},get location(){return a(f,h)},listen(N){if(g)throw new Error("A history only accepts one active listener");return f.addEventListener(tp,b),g=N,()=>{f.removeEventListener(tp,b),g=null}},createHref(N){return l(f,N)},createURL:w,encodeLocation(N){let E=w(N);return{pathname:E.pathname,search:E.search,hash:E.hash}},push:j,replace:M,go(N){return h.go(N)}};return q}function Xy(a,l=!1){let i="http://localhost";typeof window<"u"&&(i=window.location.origin!=="null"?window.location.origin:window.location.href),We(i,"No window.location.(origin|href) available to create URL");let o=typeof a=="string"?a:li(a);return o=o.replace(/ $/,"%20"),!l&&o.startsWith("//")&&(o=i+o),new URL(o,i)}function Fp(a,l,i="/"){return Qy(a,l,i,!1)}function Qy(a,l,i,o){let f=typeof l=="string"?Il(l):l,d=Jn(f.pathname||"/",i);if(d==null)return null;let h=Zp(a);Ky(h);let p=null;for(let g=0;p==null&&g<h.length;++g){let v=lb(d);p=nb(h[g],v,o)}return p}function Zp(a,l=[],i=[],o="",f=!1){let d=(h,p,g=f,v)=>{let y={relativePath:v===void 0?h.path||"":v,caseSensitive:h.caseSensitive===!0,childrenIndex:p,route:h};if(y.relativePath.startsWith("/")){if(!y.relativePath.startsWith(o)&&g)return;We(y.relativePath.startsWith(o),`Absolute route path "${y.relativePath}" nested under path "${o}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),y.relativePath=y.relativePath.slice(o.length)}let b=Zn([o,y.relativePath]),j=i.concat(y);h.children&&h.children.length>0&&(We(h.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${b}".`),Zp(h.children,l,j,b,g)),!(h.path==null&&!h.index)&&l.push({path:b,score:eb(b,h.index),routesMeta:j})};return a.forEach((h,p)=>{if(h.path===""||!h.path?.includes("?"))d(h,p);else for(let g of Jp(h.path))d(h,p,!0,g)}),l}function Jp(a){let l=a.split("/");if(l.length===0)return[];let[i,...o]=l,f=i.endsWith("?"),d=i.replace(/\?$/,"");if(o.length===0)return f?[d,""]:[d];let h=Jp(o.join("/")),p=[];return p.push(...h.map(g=>g===""?d:[d,g].join("/"))),f&&p.push(...h),p.map(g=>a.startsWith("/")&&g===""?"/":g)}function Ky(a){a.sort((l,i)=>l.score!==i.score?i.score-l.score:tb(l.routesMeta.map(o=>o.childrenIndex),i.routesMeta.map(o=>o.childrenIndex)))}var Fy=/^:[\w-]+$/,Zy=3,Jy=2,Iy=1,Wy=10,Py=-2,ap=a=>a==="*";function eb(a,l){let i=a.split("/"),o=i.length;return i.some(ap)&&(o+=Py),l&&(o+=Jy),i.filter(f=>!ap(f)).reduce((f,d)=>f+(Fy.test(d)?Zy:d===""?Iy:Wy),o)}function tb(a,l){return a.length===l.length&&a.slice(0,-1).every((o,f)=>o===l[f])?a[a.length-1]-l[l.length-1]:0}function nb(a,l,i=!1){let{routesMeta:o}=a,f={},d="/",h=[];for(let p=0;p<o.length;++p){let g=o[p],v=p===o.length-1,y=d==="/"?l:l.slice(d.length)||"/",b=Zr({path:g.relativePath,caseSensitive:g.caseSensitive,end:v},y),j=g.route;if(!b&&v&&i&&!o[o.length-1].route.index&&(b=Zr({path:g.relativePath,caseSensitive:g.caseSensitive,end:!1},y)),!b)return null;Object.assign(f,b.params),h.push({params:f,pathname:Zn([d,b.pathname]),pathnameBase:cb(Zn([d,b.pathnameBase])),route:j}),b.pathnameBase!=="/"&&(d=Zn([d,b.pathnameBase]))}return h}function Zr(a,l){typeof a=="string"&&(a={path:a,caseSensitive:!1,end:!0});let[i,o]=ab(a.path,a.caseSensitive,a.end),f=l.match(i);if(!f)return null;let d=f[0],h=d.replace(/(.)\/+$/,"$1"),p=f.slice(1);return{params:o.reduce((v,{paramName:y,isOptional:b},j)=>{if(y==="*"){let w=p[j]||"";h=d.slice(0,d.length-w.length).replace(/(.)\/+$/,"$1")}const M=p[j];return b&&!M?v[y]=void 0:v[y]=(M||"").replace(/%2F/g,"/"),v},{}),pathname:d,pathnameBase:h,pattern:a}}function ab(a,l=!1,i=!0){pn(a==="*"||!a.endsWith("*")||a.endsWith("/*"),`Route path "${a}" will be treated as if it were "${a.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${a.replace(/\*$/,"/*")}".`);let o=[],f="^"+a.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(h,p,g)=>(o.push({paramName:p,isOptional:g!=null}),g?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return a.endsWith("*")?(o.push({paramName:"*"}),f+=a==="*"||a==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):i?f+="\\/*$":a!==""&&a!=="/"&&(f+="(?:(?=\\/|$))"),[new RegExp(f,l?void 0:"i"),o]}function lb(a){try{return a.split("/").map(l=>decodeURIComponent(l).replace(/\//g,"%2F")).join("/")}catch(l){return pn(!1,`The URL path "${a}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${l}).`),a}}function Jn(a,l){if(l==="/")return a;if(!a.toLowerCase().startsWith(l.toLowerCase()))return null;let i=l.endsWith("/")?l.length-1:l.length,o=a.charAt(i);return o&&o!=="/"?null:a.slice(i)||"/"}var sb=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ib=a=>sb.test(a);function rb(a,l="/"){let{pathname:i,search:o="",hash:f=""}=typeof a=="string"?Il(a):a,d;if(i)if(ib(i))d=i;else{if(i.includes("//")){let h=i;i=i.replace(/\/\/+/g,"/"),pn(!1,`Pathnames cannot have embedded double slashes - normalizing ${h} -> ${i}`)}i.startsWith("/")?d=lp(i.substring(1),"/"):d=lp(i,l)}else d=l;return{pathname:d,search:ub(o),hash:fb(f)}}function lp(a,l){let i=l.replace(/\/+$/,"").split("/");return a.split("/").forEach(f=>{f===".."?i.length>1&&i.pop():f!=="."&&i.push(f)}),i.length>1?i.join("/"):"/"}function Tu(a,l,i,o){return`Cannot include a '${a}' character in a manually specified \`to.${l}\` field [${JSON.stringify(o)}]. Please separate it out to the \`to.${i}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function ob(a){return a.filter((l,i)=>i===0||l.route.path&&l.route.path.length>0)}function Ip(a){let l=ob(a);return l.map((i,o)=>o===l.length-1?i.pathname:i.pathnameBase)}function Wp(a,l,i,o=!1){let f;typeof a=="string"?f=Il(a):(f={...a},We(!f.pathname||!f.pathname.includes("?"),Tu("?","pathname","search",f)),We(!f.pathname||!f.pathname.includes("#"),Tu("#","pathname","hash",f)),We(!f.search||!f.search.includes("#"),Tu("#","search","hash",f)));let d=a===""||f.pathname==="",h=d?"/":f.pathname,p;if(h==null)p=i;else{let b=l.length-1;if(!o&&h.startsWith("..")){let j=h.split("/");for(;j[0]==="..";)j.shift(),b-=1;f.pathname=j.join("/")}p=b>=0?l[b]:"/"}let g=rb(f,p),v=h&&h!=="/"&&h.endsWith("/"),y=(d||h===".")&&i.endsWith("/");return!g.pathname.endsWith("/")&&(v||y)&&(g.pathname+="/"),g}var Zn=a=>a.join("/").replace(/\/\/+/g,"/"),cb=a=>a.replace(/\/+$/,"").replace(/^\/*/,"/"),ub=a=>!a||a==="?"?"":a.startsWith("?")?a:"?"+a,fb=a=>!a||a==="#"?"":a.startsWith("#")?a:"#"+a;function db(a){return a!=null&&typeof a.status=="number"&&typeof a.statusText=="string"&&typeof a.internal=="boolean"&&"data"in a}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Pp=["POST","PUT","PATCH","DELETE"];new Set(Pp);var mb=["GET",...Pp];new Set(mb);var Wl=m.createContext(null);Wl.displayName="DataRouter";var no=m.createContext(null);no.displayName="DataRouterState";m.createContext(!1);var ex=m.createContext({isTransitioning:!1});ex.displayName="ViewTransition";var hb=m.createContext(new Map);hb.displayName="Fetchers";var pb=m.createContext(null);pb.displayName="Await";var wn=m.createContext(null);wn.displayName="Navigation";var di=m.createContext(null);di.displayName="Location";var In=m.createContext({outlet:null,matches:[],isDataRoute:!1});In.displayName="Route";var Af=m.createContext(null);Af.displayName="RouteError";function xb(a,{relative:l}={}){We(mi(),"useHref() may be used only in the context of a <Router> component.");let{basename:i,navigator:o}=m.useContext(wn),{hash:f,pathname:d,search:h}=hi(a,{relative:l}),p=d;return i!=="/"&&(p=d==="/"?i:Zn([i,d])),o.createHref({pathname:p,search:h,hash:f})}function mi(){return m.useContext(di)!=null}function Wa(){return We(mi(),"useLocation() may be used only in the context of a <Router> component."),m.useContext(di).location}var tx="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function nx(a){m.useContext(wn).static||m.useLayoutEffect(a)}function gb(){let{isDataRoute:a}=m.useContext(In);return a?kb():vb()}function vb(){We(mi(),"useNavigate() may be used only in the context of a <Router> component.");let a=m.useContext(Wl),{basename:l,navigator:i}=m.useContext(wn),{matches:o}=m.useContext(In),{pathname:f}=Wa(),d=JSON.stringify(Ip(o)),h=m.useRef(!1);return nx(()=>{h.current=!0}),m.useCallback((g,v={})=>{if(pn(h.current,tx),!h.current)return;if(typeof g=="number"){i.go(g);return}let y=Wp(g,JSON.parse(d),f,v.relative==="path");a==null&&l!=="/"&&(y.pathname=y.pathname==="/"?l:Zn([l,y.pathname])),(v.replace?i.replace:i.push)(y,v.state,v)},[l,i,d,f,a])}m.createContext(null);function hi(a,{relative:l}={}){let{matches:i}=m.useContext(In),{pathname:o}=Wa(),f=JSON.stringify(Ip(i));return m.useMemo(()=>Wp(a,JSON.parse(f),o,l==="path"),[a,f,o,l])}function yb(a,l){return ax(a,l)}function ax(a,l,i,o,f){We(mi(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:d}=m.useContext(wn),{matches:h}=m.useContext(In),p=h[h.length-1],g=p?p.params:{},v=p?p.pathname:"/",y=p?p.pathnameBase:"/",b=p&&p.route;{let S=b&&b.path||"";lx(v,!b||S.endsWith("*")||S.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${v}" (under <Route path="${S}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
Please change the parent <Route path="${S}"> to <Route path="${S==="/"?"*":`${S}/*`}">.`)}let j=Wa(),M;if(l){let S=typeof l=="string"?Il(l):l;We(y==="/"||S.pathname?.startsWith(y),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${y}" but pathname "${S.pathname}" was given in the \`location\` prop.`),M=S}else M=j;let w=M.pathname||"/",q=w;if(y!=="/"){let S=y.replace(/^\//,"").split("/");q="/"+w.replace(/^\//,"").split("/").slice(S.length).join("/")}let N=Fp(a,{pathname:q});pn(b||N!=null,`No routes matched location "${M.pathname}${M.search}${M.hash}" `),pn(N==null||N[N.length-1].route.element!==void 0||N[N.length-1].route.Component!==void 0||N[N.length-1].route.lazy!==void 0,`Matched leaf route at location "${M.pathname}${M.search}${M.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let E=Nb(N&&N.map(S=>Object.assign({},S,{params:Object.assign({},g,S.params),pathname:Zn([y,d.encodeLocation?d.encodeLocation(S.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?y:Zn([y,d.encodeLocation?d.encodeLocation(S.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathnameBase])})),h,i,o,f);return l&&E?m.createElement(di.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...M},navigationType:"POP"}},E):E}function bb(){let a=Mb(),l=db(a)?`${a.status} ${a.statusText}`:a instanceof Error?a.message:JSON.stringify(a),i=a instanceof Error?a.stack:null,o="rgba(200,200,200, 0.5)",f={padding:"0.5rem",backgroundColor:o},d={padding:"2px 4px",backgroundColor:o},h=null;return console.error("Error handled by React Router default ErrorBoundary:",a),h=m.createElement(m.Fragment,null,m.createElement("p",null,"💿 Hey developer 👋"),m.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",m.createElement("code",{style:d},"ErrorBoundary")," or"," ",m.createElement("code",{style:d},"errorElement")," prop on your route.")),m.createElement(m.Fragment,null,m.createElement("h2",null,"Unexpected Application Error!"),m.createElement("h3",{style:{fontStyle:"italic"}},l),i?m.createElement("pre",{style:f},i):null,h)}var Sb=m.createElement(bb,null),Ab=class extends m.Component{constructor(a){super(a),this.state={location:a.location,revalidation:a.revalidation,error:a.error}}static getDerivedStateFromError(a){return{error:a}}static getDerivedStateFromProps(a,l){return l.location!==a.location||l.revalidation!=="idle"&&a.revalidation==="idle"?{error:a.error,location:a.location,revalidation:a.revalidation}:{error:a.error!==void 0?a.error:l.error,location:l.location,revalidation:a.revalidation||l.revalidation}}componentDidCatch(a,l){this.props.onError?this.props.onError(a,l):console.error("React Router caught the following error during render",a)}render(){return this.state.error!==void 0?m.createElement(In.Provider,{value:this.props.routeContext},m.createElement(Af.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function jb({routeContext:a,match:l,children:i}){let o=m.useContext(Wl);return o&&o.static&&o.staticContext&&(l.route.errorElement||l.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=l.route.id),m.createElement(In.Provider,{value:a},i)}function Nb(a,l=[],i=null,o=null,f=null){if(a==null){if(!i)return null;if(i.errors)a=i.matches;else if(l.length===0&&!i.initialized&&i.matches.length>0)a=i.matches;else return null}let d=a,h=i?.errors;if(h!=null){let y=d.findIndex(b=>b.route.id&&h?.[b.route.id]!==void 0);We(y>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(h).join(",")}`),d=d.slice(0,Math.min(d.length,y+1))}let p=!1,g=-1;if(i)for(let y=0;y<d.length;y++){let b=d[y];if((b.route.HydrateFallback||b.route.hydrateFallbackElement)&&(g=y),b.route.id){let{loaderData:j,errors:M}=i,w=b.route.loader&&!j.hasOwnProperty(b.route.id)&&(!M||M[b.route.id]===void 0);if(b.route.lazy||w){p=!0,g>=0?d=d.slice(0,g+1):d=[d[0]];break}}}let v=i&&o?(y,b)=>{o(y,{location:i.location,params:i.matches?.[0]?.params??{},errorInfo:b})}:void 0;return d.reduceRight((y,b,j)=>{let M,w=!1,q=null,N=null;i&&(M=h&&b.route.id?h[b.route.id]:void 0,q=b.route.errorElement||Sb,p&&(g<0&&j===0?(lx("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),w=!0,N=null):g===j&&(w=!0,N=b.route.hydrateFallbackElement||null)));let E=l.concat(d.slice(0,j+1)),S=()=>{let T;return M?T=q:w?T=N:b.route.Component?T=m.createElement(b.route.Component,null):b.route.element?T=b.route.element:T=y,m.createElement(jb,{match:b,routeContext:{outlet:y,matches:E,isDataRoute:i!=null},children:T})};return i&&(b.route.ErrorBoundary||b.route.errorElement||j===0)?m.createElement(Ab,{location:i.location,revalidation:i.revalidation,component:q,error:M,children:S(),routeContext:{outlet:null,matches:E,isDataRoute:!0},onError:v}):S()},null)}function jf(a){return`${a} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function wb(a){let l=m.useContext(Wl);return We(l,jf(a)),l}function Eb(a){let l=m.useContext(no);return We(l,jf(a)),l}function Cb(a){let l=m.useContext(In);return We(l,jf(a)),l}function Nf(a){let l=Cb(a),i=l.matches[l.matches.length-1];return We(i.route.id,`${a} can only be used on routes that contain a unique "id"`),i.route.id}function qb(){return Nf("useRouteId")}function Mb(){let a=m.useContext(Af),l=Eb("useRouteError"),i=Nf("useRouteError");return a!==void 0?a:l.errors?.[i]}function kb(){let{router:a}=wb("useNavigate"),l=Nf("useNavigate"),i=m.useRef(!1);return nx(()=>{i.current=!0}),m.useCallback(async(f,d={})=>{pn(i.current,tx),i.current&&(typeof f=="number"?a.navigate(f):await a.navigate(f,{fromRouteId:l,...d}))},[a,l])}var sp={};function lx(a,l,i){!l&&!sp[a]&&(sp[a]=!0,pn(!1,i))}m.memo(Rb);function Rb({routes:a,future:l,state:i,unstable_onError:o}){return ax(a,void 0,i,o,l)}function Ur(a){We(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function Tb({basename:a="/",children:l=null,location:i,navigationType:o="POP",navigator:f,static:d=!1}){We(!mi(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let h=a.replace(/^\/*/,"/"),p=m.useMemo(()=>({basename:h,navigator:f,static:d,future:{}}),[h,f,d]);typeof i=="string"&&(i=Il(i));let{pathname:g="/",search:v="",hash:y="",state:b=null,key:j="default"}=i,M=m.useMemo(()=>{let w=Jn(g,h);return w==null?null:{location:{pathname:w,search:v,hash:y,state:b,key:j},navigationType:o}},[h,g,v,y,b,j,o]);return pn(M!=null,`<Router basename="${h}"> is not able to match the URL "${g}${v}${y}" because it does not start with the basename, so the <Router> won't render anything.`),M==null?null:m.createElement(wn.Provider,{value:p},m.createElement(di.Provider,{children:l,value:M}))}function Db({children:a,location:l}){return yb(af(a),l)}function af(a,l=[]){let i=[];return m.Children.forEach(a,(o,f)=>{if(!m.isValidElement(o))return;let d=[...l,f];if(o.type===m.Fragment){i.push.apply(i,af(o.props.children,d));return}We(o.type===Ur,`[${typeof o.type=="string"?o.type:o.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),We(!o.props.index||!o.props.children,"An index route cannot have child routes.");let h={id:o.props.id||d.join("-"),caseSensitive:o.props.caseSensitive,element:o.props.element,Component:o.props.Component,index:o.props.index,path:o.props.path,middleware:o.props.middleware,loader:o.props.loader,action:o.props.action,hydrateFallbackElement:o.props.hydrateFallbackElement,HydrateFallback:o.props.HydrateFallback,errorElement:o.props.errorElement,ErrorBoundary:o.props.ErrorBoundary,hasErrorBoundary:o.props.hasErrorBoundary===!0||o.props.ErrorBoundary!=null||o.props.errorElement!=null,shouldRevalidate:o.props.shouldRevalidate,handle:o.props.handle,lazy:o.props.lazy};o.props.children&&(h.children=af(o.props.children,d)),i.push(h)}),i}var Hr="get",Vr="application/x-www-form-urlencoded";function ao(a){return a!=null&&typeof a.tagName=="string"}function _b(a){return ao(a)&&a.tagName.toLowerCase()==="button"}function Ob(a){return ao(a)&&a.tagName.toLowerCase()==="form"}function Bb(a){return ao(a)&&a.tagName.toLowerCase()==="input"}function zb(a){return!!(a.metaKey||a.altKey||a.ctrlKey||a.shiftKey)}function Lb(a,l){return a.button===0&&(!l||l==="_self")&&!zb(a)}var Dr=null;function Ub(){if(Dr===null)try{new FormData(document.createElement("form"),0),Dr=!1}catch{Dr=!0}return Dr}var Hb=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Du(a){return a!=null&&!Hb.has(a)?(pn(!1,`"${a}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Vr}"`),null):a}function Vb(a,l){let i,o,f,d,h;if(Ob(a)){let p=a.getAttribute("action");o=p?Jn(p,l):null,i=a.getAttribute("method")||Hr,f=Du(a.getAttribute("enctype"))||Vr,d=new FormData(a)}else if(_b(a)||Bb(a)&&(a.type==="submit"||a.type==="image")){let p=a.form;if(p==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let g=a.getAttribute("formaction")||p.getAttribute("action");if(o=g?Jn(g,l):null,i=a.getAttribute("formmethod")||p.getAttribute("method")||Hr,f=Du(a.getAttribute("formenctype"))||Du(p.getAttribute("enctype"))||Vr,d=new FormData(p,a),!Ub()){let{name:v,type:y,value:b}=a;if(y==="image"){let j=v?`${v}.`:"";d.append(`${j}x`,"0"),d.append(`${j}y`,"0")}else v&&d.append(v,b)}}else{if(ao(a))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');i=Hr,o=null,f=Vr,h=a}return d&&f==="text/plain"&&(h=d,d=void 0),{action:o,method:i.toLowerCase(),encType:f,formData:d,body:h}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function wf(a,l){if(a===!1||a===null||typeof a>"u")throw new Error(l)}function Yb(a,l,i){let o=typeof a=="string"?new URL(a,typeof window>"u"?"server://singlefetch/":window.location.origin):a;return o.pathname==="/"?o.pathname=`_root.${i}`:l&&Jn(o.pathname,l)==="/"?o.pathname=`${l.replace(/\/$/,"")}/_root.${i}`:o.pathname=`${o.pathname.replace(/\/$/,"")}.${i}`,o}async function $b(a,l){if(a.id in l)return l[a.id];try{let i=await import(a.module);return l[a.id]=i,i}catch(i){return console.error(`Error loading route module \`${a.module}\`, reloading page...`),console.error(i),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Gb(a){return a==null?!1:a.href==null?a.rel==="preload"&&typeof a.imageSrcSet=="string"&&typeof a.imageSizes=="string":typeof a.rel=="string"&&typeof a.href=="string"}async function Xb(a,l,i){let o=await Promise.all(a.map(async f=>{let d=l.routes[f.route.id];if(d){let h=await $b(d,i);return h.links?h.links():[]}return[]}));return Zb(o.flat(1).filter(Gb).filter(f=>f.rel==="stylesheet"||f.rel==="preload").map(f=>f.rel==="stylesheet"?{...f,rel:"prefetch",as:"style"}:{...f,rel:"prefetch"}))}function ip(a,l,i,o,f,d){let h=(g,v)=>i[v]?g.route.id!==i[v].route.id:!0,p=(g,v)=>i[v].pathname!==g.pathname||i[v].route.path?.endsWith("*")&&i[v].params["*"]!==g.params["*"];return d==="assets"?l.filter((g,v)=>h(g,v)||p(g,v)):d==="data"?l.filter((g,v)=>{let y=o.routes[g.route.id];if(!y||!y.hasLoader)return!1;if(h(g,v)||p(g,v))return!0;if(g.route.shouldRevalidate){let b=g.route.shouldRevalidate({currentUrl:new URL(f.pathname+f.search+f.hash,window.origin),currentParams:i[0]?.params||{},nextUrl:new URL(a,window.origin),nextParams:g.params,defaultShouldRevalidate:!0});if(typeof b=="boolean")return b}return!0}):[]}function Qb(a,l,{includeHydrateFallback:i}={}){return Kb(a.map(o=>{let f=l.routes[o.route.id];if(!f)return[];let d=[f.module];return f.clientActionModule&&(d=d.concat(f.clientActionModule)),f.clientLoaderModule&&(d=d.concat(f.clientLoaderModule)),i&&f.hydrateFallbackModule&&(d=d.concat(f.hydrateFallbackModule)),f.imports&&(d=d.concat(f.imports)),d}).flat(1))}function Kb(a){return[...new Set(a)]}function Fb(a){let l={},i=Object.keys(a).sort();for(let o of i)l[o]=a[o];return l}function Zb(a,l){let i=new Set;return new Set(l),a.reduce((o,f)=>{let d=JSON.stringify(Fb(f));return i.has(d)||(i.add(d),o.push({key:d,link:f})),o},[])}function sx(){let a=m.useContext(Wl);return wf(a,"You must render this element inside a <DataRouterContext.Provider> element"),a}function Jb(){let a=m.useContext(no);return wf(a,"You must render this element inside a <DataRouterStateContext.Provider> element"),a}var Ef=m.createContext(void 0);Ef.displayName="FrameworkContext";function ix(){let a=m.useContext(Ef);return wf(a,"You must render this element inside a <HydratedRouter> element"),a}function Ib(a,l){let i=m.useContext(Ef),[o,f]=m.useState(!1),[d,h]=m.useState(!1),{onFocus:p,onBlur:g,onMouseEnter:v,onMouseLeave:y,onTouchStart:b}=l,j=m.useRef(null);m.useEffect(()=>{if(a==="render"&&h(!0),a==="viewport"){let q=E=>{E.forEach(S=>{h(S.isIntersecting)})},N=new IntersectionObserver(q,{threshold:.5});return j.current&&N.observe(j.current),()=>{N.disconnect()}}},[a]),m.useEffect(()=>{if(o){let q=setTimeout(()=>{h(!0)},100);return()=>{clearTimeout(q)}}},[o]);let M=()=>{f(!0)},w=()=>{f(!1),h(!1)};return i?a!=="intent"?[d,j,{}]:[d,j,{onFocus:Fs(p,M),onBlur:Fs(g,w),onMouseEnter:Fs(v,M),onMouseLeave:Fs(y,w),onTouchStart:Fs(b,M)}]:[!1,j,{}]}function Fs(a,l){return i=>{a&&a(i),i.defaultPrevented||l(i)}}function Wb({page:a,...l}){let{router:i}=sx(),o=m.useMemo(()=>Fp(i.routes,a,i.basename),[i.routes,a,i.basename]);return o?m.createElement(e1,{page:a,matches:o,...l}):null}function Pb(a){let{manifest:l,routeModules:i}=ix(),[o,f]=m.useState([]);return m.useEffect(()=>{let d=!1;return Xb(a,l,i).then(h=>{d||f(h)}),()=>{d=!0}},[a,l,i]),o}function e1({page:a,matches:l,...i}){let o=Wa(),{manifest:f,routeModules:d}=ix(),{basename:h}=sx(),{loaderData:p,matches:g}=Jb(),v=m.useMemo(()=>ip(a,l,g,f,o,"data"),[a,l,g,f,o]),y=m.useMemo(()=>ip(a,l,g,f,o,"assets"),[a,l,g,f,o]),b=m.useMemo(()=>{if(a===o.pathname+o.search+o.hash)return[];let w=new Set,q=!1;if(l.forEach(E=>{let S=f.routes[E.route.id];!S||!S.hasLoader||(!v.some(T=>T.route.id===E.route.id)&&E.route.id in p&&d[E.route.id]?.shouldRevalidate||S.hasClientLoader?q=!0:w.add(E.route.id))}),w.size===0)return[];let N=Yb(a,h,"data");return q&&w.size>0&&N.searchParams.set("_routes",l.filter(E=>w.has(E.route.id)).map(E=>E.route.id).join(",")),[N.pathname+N.search]},[h,p,o,f,v,l,a,d]),j=m.useMemo(()=>Qb(y,f),[y,f]),M=Pb(y);return m.createElement(m.Fragment,null,b.map(w=>m.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...i})),j.map(w=>m.createElement("link",{key:w,rel:"modulepreload",href:w,...i})),M.map(({key:w,link:q})=>m.createElement("link",{key:w,nonce:i.nonce,...q})))}function t1(...a){return l=>{a.forEach(i=>{typeof i=="function"?i(l):i!=null&&(i.current=l)})}}var rx=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{rx&&(window.__reactRouterVersion="7.9.6")}catch{}function n1({basename:a,children:l,window:i}){let o=m.useRef();o.current==null&&(o.current=Yy({window:i,v5Compat:!0}));let f=o.current,[d,h]=m.useState({action:f.action,location:f.location}),p=m.useCallback(g=>{m.startTransition(()=>h(g))},[h]);return m.useLayoutEffect(()=>f.listen(p),[f,p]),m.createElement(Tb,{basename:a,children:l,location:d.location,navigationType:d.action,navigator:f})}var ox=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,cx=m.forwardRef(function({onClick:l,discover:i="render",prefetch:o="none",relative:f,reloadDocument:d,replace:h,state:p,target:g,to:v,preventScrollReset:y,viewTransition:b,...j},M){let{basename:w}=m.useContext(wn),q=typeof v=="string"&&ox.test(v),N,E=!1;if(typeof v=="string"&&q&&(N=v,rx))try{let X=new URL(window.location.href),Z=v.startsWith("//")?new URL(X.protocol+v):new URL(v),F=Jn(Z.pathname,w);Z.origin===X.origin&&F!=null?v=F+Z.search+Z.hash:E=!0}catch{pn(!1,`<Link to="${v}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let S=xb(v,{relative:f}),[T,z,L]=Ib(o,j),$=i1(v,{replace:h,state:p,target:g,preventScrollReset:y,relative:f,viewTransition:b});function O(X){l&&l(X),X.defaultPrevented||$(X)}let V=m.createElement("a",{...j,...L,href:N||S,onClick:E||d?l:O,ref:t1(M,z),target:g,"data-discover":!q&&i==="render"?"true":void 0});return T&&!q?m.createElement(m.Fragment,null,V,m.createElement(Wb,{page:S})):V});cx.displayName="Link";var a1=m.forwardRef(function({"aria-current":l="page",caseSensitive:i=!1,className:o="",end:f=!1,style:d,to:h,viewTransition:p,children:g,...v},y){let b=hi(h,{relative:v.relative}),j=Wa(),M=m.useContext(no),{navigator:w,basename:q}=m.useContext(wn),N=M!=null&&f1(b)&&p===!0,E=w.encodeLocation?w.encodeLocation(b).pathname:b.pathname,S=j.pathname,T=M&&M.navigation&&M.navigation.location?M.navigation.location.pathname:null;i||(S=S.toLowerCase(),T=T?T.toLowerCase():null,E=E.toLowerCase()),T&&q&&(T=Jn(T,q)||T);const z=E!=="/"&&E.endsWith("/")?E.length-1:E.length;let L=S===E||!f&&S.startsWith(E)&&S.charAt(z)==="/",$=T!=null&&(T===E||!f&&T.startsWith(E)&&T.charAt(E.length)==="/"),O={isActive:L,isPending:$,isTransitioning:N},V=L?l:void 0,X;typeof o=="function"?X=o(O):X=[o,L?"active":null,$?"pending":null,N?"transitioning":null].filter(Boolean).join(" ");let Z=typeof d=="function"?d(O):d;return m.createElement(cx,{...v,"aria-current":V,className:X,ref:y,style:Z,to:h,viewTransition:p},typeof g=="function"?g(O):g)});a1.displayName="NavLink";var l1=m.forwardRef(({discover:a="render",fetcherKey:l,navigate:i,reloadDocument:o,replace:f,state:d,method:h=Hr,action:p,onSubmit:g,relative:v,preventScrollReset:y,viewTransition:b,...j},M)=>{let w=c1(),q=u1(p,{relative:v}),N=h.toLowerCase()==="get"?"get":"post",E=typeof p=="string"&&ox.test(p),S=T=>{if(g&&g(T),T.defaultPrevented)return;T.preventDefault();let z=T.nativeEvent.submitter,L=z?.getAttribute("formmethod")||h;w(z||T.currentTarget,{fetcherKey:l,method:L,navigate:i,replace:f,state:d,relative:v,preventScrollReset:y,viewTransition:b})};return m.createElement("form",{ref:M,method:N,action:q,onSubmit:o?g:S,...j,"data-discover":!E&&a==="render"?"true":void 0})});l1.displayName="Form";function s1(a){return`${a} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ux(a){let l=m.useContext(Wl);return We(l,s1(a)),l}function i1(a,{target:l,replace:i,state:o,preventScrollReset:f,relative:d,viewTransition:h}={}){let p=gb(),g=Wa(),v=hi(a,{relative:d});return m.useCallback(y=>{if(Lb(y,l)){y.preventDefault();let b=i!==void 0?i:li(g)===li(v);p(a,{replace:b,state:o,preventScrollReset:f,relative:d,viewTransition:h})}},[g,p,v,i,o,l,a,f,d,h])}var r1=0,o1=()=>`__${String(++r1)}__`;function c1(){let{router:a}=ux("useSubmit"),{basename:l}=m.useContext(wn),i=qb();return m.useCallback(async(o,f={})=>{let{action:d,method:h,encType:p,formData:g,body:v}=Vb(o,l);if(f.navigate===!1){let y=f.fetcherKey||o1();await a.fetch(y,i,f.action||d,{preventScrollReset:f.preventScrollReset,formData:g,body:v,formMethod:f.method||h,formEncType:f.encType||p,flushSync:f.flushSync})}else await a.navigate(f.action||d,{preventScrollReset:f.preventScrollReset,formData:g,body:v,formMethod:f.method||h,formEncType:f.encType||p,replace:f.replace,state:f.state,fromRouteId:i,flushSync:f.flushSync,viewTransition:f.viewTransition})},[a,l,i])}function u1(a,{relative:l}={}){let{basename:i}=m.useContext(wn),o=m.useContext(In);We(o,"useFormAction must be used inside a RouteContext");let[f]=o.matches.slice(-1),d={...hi(a||".",{relative:l})},h=Wa();if(a==null){d.search=h.search;let p=new URLSearchParams(d.search),g=p.getAll("index");if(g.some(y=>y==="")){p.delete("index"),g.filter(b=>b).forEach(b=>p.append("index",b));let y=p.toString();d.search=y?`?${y}`:""}}return(!a||a===".")&&f.route.index&&(d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index"),i!=="/"&&(d.pathname=d.pathname==="/"?i:Zn([i,d.pathname])),li(d)}function f1(a,{relative:l}={}){let i=m.useContext(ex);We(i!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=ux("useViewTransitionState"),f=hi(a,{relative:l});if(!i.isTransitioning)return!1;let d=Jn(i.currentLocation.pathname,o)||i.currentLocation.pathname,h=Jn(i.nextLocation.pathname,o)||i.nextLocation.pathname;return Zr(f.pathname,h)!=null||Zr(f.pathname,d)!=null}const Nn=Object.create(null);Nn.open="0";Nn.close="1";Nn.ping="2";Nn.pong="3";Nn.message="4";Nn.upgrade="5";Nn.noop="6";const Yr=Object.create(null);Object.keys(Nn).forEach(a=>{Yr[Nn[a]]=a});const lf={type:"error",data:"parser error"},fx=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",dx=typeof ArrayBuffer=="function",mx=a=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(a):a&&a.buffer instanceof ArrayBuffer,Cf=({type:a,data:l},i,o)=>fx&&l instanceof Blob?i?o(l):rp(l,o):dx&&(l instanceof ArrayBuffer||mx(l))?i?o(l):rp(new Blob([l]),o):o(Nn[a]+(l||"")),rp=(a,l)=>{const i=new FileReader;return i.onload=function(){const o=i.result.split(",")[1];l("b"+(o||""))},i.readAsDataURL(a)};function op(a){return a instanceof Uint8Array?a:a instanceof ArrayBuffer?new Uint8Array(a):new Uint8Array(a.buffer,a.byteOffset,a.byteLength)}let _u;function d1(a,l){if(fx&&a.data instanceof Blob)return a.data.arrayBuffer().then(op).then(l);if(dx&&(a.data instanceof ArrayBuffer||mx(a.data)))return l(op(a.data));Cf(a,!1,i=>{_u||(_u=new TextEncoder),l(_u.encode(i))})}const cp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ei=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let a=0;a<cp.length;a++)ei[cp.charCodeAt(a)]=a;const m1=a=>{let l=a.length*.75,i=a.length,o,f=0,d,h,p,g;a[a.length-1]==="="&&(l--,a[a.length-2]==="="&&l--);const v=new ArrayBuffer(l),y=new Uint8Array(v);for(o=0;o<i;o+=4)d=ei[a.charCodeAt(o)],h=ei[a.charCodeAt(o+1)],p=ei[a.charCodeAt(o+2)],g=ei[a.charCodeAt(o+3)],y[f++]=d<<2|h>>4,y[f++]=(h&15)<<4|p>>2,y[f++]=(p&3)<<6|g&63;return v},h1=typeof ArrayBuffer=="function",qf=(a,l)=>{if(typeof a!="string")return{type:"message",data:hx(a,l)};const i=a.charAt(0);return i==="b"?{type:"message",data:p1(a.substring(1),l)}:Yr[i]?a.length>1?{type:Yr[i],data:a.substring(1)}:{type:Yr[i]}:lf},p1=(a,l)=>{if(h1){const i=m1(a);return hx(i,l)}else return{base64:!0,data:a}},hx=(a,l)=>{switch(l){case"blob":return a instanceof Blob?a:new Blob([a]);case"arraybuffer":default:return a instanceof ArrayBuffer?a:a.buffer}},px="",x1=(a,l)=>{const i=a.length,o=new Array(i);let f=0;a.forEach((d,h)=>{Cf(d,!1,p=>{o[h]=p,++f===i&&l(o.join(px))})})},g1=(a,l)=>{const i=a.split(px),o=[];for(let f=0;f<i.length;f++){const d=qf(i[f],l);if(o.push(d),d.type==="error")break}return o};function v1(){return new TransformStream({transform(a,l){d1(a,i=>{const o=i.length;let f;if(o<126)f=new Uint8Array(1),new DataView(f.buffer).setUint8(0,o);else if(o<65536){f=new Uint8Array(3);const d=new DataView(f.buffer);d.setUint8(0,126),d.setUint16(1,o)}else{f=new Uint8Array(9);const d=new DataView(f.buffer);d.setUint8(0,127),d.setBigUint64(1,BigInt(o))}a.data&&typeof a.data!="string"&&(f[0]|=128),l.enqueue(f),l.enqueue(i)})}})}let Ou;function _r(a){return a.reduce((l,i)=>l+i.length,0)}function Or(a,l){if(a[0].length===l)return a.shift();const i=new Uint8Array(l);let o=0;for(let f=0;f<l;f++)i[f]=a[0][o++],o===a[0].length&&(a.shift(),o=0);return a.length&&o<a[0].length&&(a[0]=a[0].slice(o)),i}function y1(a,l){Ou||(Ou=new TextDecoder);const i=[];let o=0,f=-1,d=!1;return new TransformStream({transform(h,p){for(i.push(h);;){if(o===0){if(_r(i)<1)break;const g=Or(i,1);d=(g[0]&128)===128,f=g[0]&127,f<126?o=3:f===126?o=1:o=2}else if(o===1){if(_r(i)<2)break;const g=Or(i,2);f=new DataView(g.buffer,g.byteOffset,g.length).getUint16(0),o=3}else if(o===2){if(_r(i)<8)break;const g=Or(i,8),v=new DataView(g.buffer,g.byteOffset,g.length),y=v.getUint32(0);if(y>Math.pow(2,21)-1){p.enqueue(lf);break}f=y*Math.pow(2,32)+v.getUint32(4),o=3}else{if(_r(i)<f)break;const g=Or(i,f);p.enqueue(qf(d?g:Ou.decode(g),l)),o=0}if(f===0||f>a){p.enqueue(lf);break}}}})}const xx=4;function dt(a){if(a)return b1(a)}function b1(a){for(var l in dt.prototype)a[l]=dt.prototype[l];return a}dt.prototype.on=dt.prototype.addEventListener=function(a,l){return this._callbacks=this._callbacks||{},(this._callbacks["$"+a]=this._callbacks["$"+a]||[]).push(l),this};dt.prototype.once=function(a,l){function i(){this.off(a,i),l.apply(this,arguments)}return i.fn=l,this.on(a,i),this};dt.prototype.off=dt.prototype.removeListener=dt.prototype.removeAllListeners=dt.prototype.removeEventListener=function(a,l){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var i=this._callbacks["$"+a];if(!i)return this;if(arguments.length==1)return delete this._callbacks["$"+a],this;for(var o,f=0;f<i.length;f++)if(o=i[f],o===l||o.fn===l){i.splice(f,1);break}return i.length===0&&delete this._callbacks["$"+a],this};dt.prototype.emit=function(a){this._callbacks=this._callbacks||{};for(var l=new Array(arguments.length-1),i=this._callbacks["$"+a],o=1;o<arguments.length;o++)l[o-1]=arguments[o];if(i){i=i.slice(0);for(var o=0,f=i.length;o<f;++o)i[o].apply(this,l)}return this};dt.prototype.emitReserved=dt.prototype.emit;dt.prototype.listeners=function(a){return this._callbacks=this._callbacks||{},this._callbacks["$"+a]||[]};dt.prototype.hasListeners=function(a){return!!this.listeners(a).length};const lo=typeof Promise=="function"&&typeof Promise.resolve=="function"?l=>Promise.resolve().then(l):(l,i)=>i(l,0),nn=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),S1="arraybuffer";function gx(a,...l){return l.reduce((i,o)=>(a.hasOwnProperty(o)&&(i[o]=a[o]),i),{})}const A1=nn.setTimeout,j1=nn.clearTimeout;function so(a,l){l.useNativeTimers?(a.setTimeoutFn=A1.bind(nn),a.clearTimeoutFn=j1.bind(nn)):(a.setTimeoutFn=nn.setTimeout.bind(nn),a.clearTimeoutFn=nn.clearTimeout.bind(nn))}const N1=1.33;function w1(a){return typeof a=="string"?E1(a):Math.ceil((a.byteLength||a.size)*N1)}function E1(a){let l=0,i=0;for(let o=0,f=a.length;o<f;o++)l=a.charCodeAt(o),l<128?i+=1:l<2048?i+=2:l<55296||l>=57344?i+=3:(o++,i+=4);return i}function vx(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function C1(a){let l="";for(let i in a)a.hasOwnProperty(i)&&(l.length&&(l+="&"),l+=encodeURIComponent(i)+"="+encodeURIComponent(a[i]));return l}function q1(a){let l={},i=a.split("&");for(let o=0,f=i.length;o<f;o++){let d=i[o].split("=");l[decodeURIComponent(d[0])]=decodeURIComponent(d[1])}return l}class M1 extends Error{constructor(l,i,o){super(l),this.description=i,this.context=o,this.type="TransportError"}}class Mf extends dt{constructor(l){super(),this.writable=!1,so(this,l),this.opts=l,this.query=l.query,this.socket=l.socket,this.supportsBinary=!l.forceBase64}onError(l,i,o){return super.emitReserved("error",new M1(l,i,o)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(l){this.readyState==="open"&&this.write(l)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(l){const i=qf(l,this.socket.binaryType);this.onPacket(i)}onPacket(l){super.emitReserved("packet",l)}onClose(l){this.readyState="closed",super.emitReserved("close",l)}pause(l){}createUri(l,i={}){return l+"://"+this._hostname()+this._port()+this.opts.path+this._query(i)}_hostname(){const l=this.opts.hostname;return l.indexOf(":")===-1?l:"["+l+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(l){const i=C1(l);return i.length?"?"+i:""}}class k1 extends Mf{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(l){this.readyState="pausing";const i=()=>{this.readyState="paused",l()};if(this._polling||!this.writable){let o=0;this._polling&&(o++,this.once("pollComplete",function(){--o||i()})),this.writable||(o++,this.once("drain",function(){--o||i()}))}else i()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(l){const i=o=>{if(this.readyState==="opening"&&o.type==="open"&&this.onOpen(),o.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(o)};g1(l,this.socket.binaryType).forEach(i),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const l=()=>{this.write([{type:"close"}])};this.readyState==="open"?l():this.once("open",l)}write(l){this.writable=!1,x1(l,i=>{this.doWrite(i,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const l=this.opts.secure?"https":"http",i=this.query||{};return this.opts.timestampRequests!==!1&&(i[this.opts.timestampParam]=vx()),!this.supportsBinary&&!i.sid&&(i.b64=1),this.createUri(l,i)}}let yx=!1;try{yx=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const R1=yx;function T1(){}class D1 extends k1{constructor(l){if(super(l),typeof location<"u"){const i=location.protocol==="https:";let o=location.port;o||(o=i?"443":"80"),this.xd=typeof location<"u"&&l.hostname!==location.hostname||o!==l.port}}doWrite(l,i){const o=this.request({method:"POST",data:l});o.on("success",i),o.on("error",(f,d)=>{this.onError("xhr post error",f,d)})}doPoll(){const l=this.request();l.on("data",this.onData.bind(this)),l.on("error",(i,o)=>{this.onError("xhr poll error",i,o)}),this.pollXhr=l}}class jn extends dt{constructor(l,i,o){super(),this.createRequest=l,so(this,o),this._opts=o,this._method=o.method||"GET",this._uri=i,this._data=o.data!==void 0?o.data:null,this._create()}_create(){var l;const i=gx(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");i.xdomain=!!this._opts.xd;const o=this._xhr=this.createRequest(i);try{o.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){o.setDisableHeaderCheck&&o.setDisableHeaderCheck(!0);for(let f in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(f)&&o.setRequestHeader(f,this._opts.extraHeaders[f])}}catch{}if(this._method==="POST")try{o.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{o.setRequestHeader("Accept","*/*")}catch{}(l=this._opts.cookieJar)===null||l===void 0||l.addCookies(o),"withCredentials"in o&&(o.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(o.timeout=this._opts.requestTimeout),o.onreadystatechange=()=>{var f;o.readyState===3&&((f=this._opts.cookieJar)===null||f===void 0||f.parseCookies(o.getResponseHeader("set-cookie"))),o.readyState===4&&(o.status===200||o.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof o.status=="number"?o.status:0)},0))},o.send(this._data)}catch(f){this.setTimeoutFn(()=>{this._onError(f)},0);return}typeof document<"u"&&(this._index=jn.requestsCount++,jn.requests[this._index]=this)}_onError(l){this.emitReserved("error",l,this._xhr),this._cleanup(!0)}_cleanup(l){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=T1,l)try{this._xhr.abort()}catch{}typeof document<"u"&&delete jn.requests[this._index],this._xhr=null}}_onLoad(){const l=this._xhr.responseText;l!==null&&(this.emitReserved("data",l),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}jn.requestsCount=0;jn.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",up);else if(typeof addEventListener=="function"){const a="onpagehide"in nn?"pagehide":"unload";addEventListener(a,up,!1)}}function up(){for(let a in jn.requests)jn.requests.hasOwnProperty(a)&&jn.requests[a].abort()}const _1=(function(){const a=bx({xdomain:!1});return a&&a.responseType!==null})();class O1 extends D1{constructor(l){super(l);const i=l&&l.forceBase64;this.supportsBinary=_1&&!i}request(l={}){return Object.assign(l,{xd:this.xd},this.opts),new jn(bx,this.uri(),l)}}function bx(a){const l=a.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!l||R1))return new XMLHttpRequest}catch{}if(!l)try{return new nn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Sx=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class B1 extends Mf{get name(){return"websocket"}doOpen(){const l=this.uri(),i=this.opts.protocols,o=Sx?{}:gx(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(o.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(l,i,o)}catch(f){return this.emitReserved("error",f)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=l=>this.onClose({description:"websocket connection closed",context:l}),this.ws.onmessage=l=>this.onData(l.data),this.ws.onerror=l=>this.onError("websocket error",l)}write(l){this.writable=!1;for(let i=0;i<l.length;i++){const o=l[i],f=i===l.length-1;Cf(o,this.supportsBinary,d=>{try{this.doWrite(o,d)}catch{}f&&lo(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const l=this.opts.secure?"wss":"ws",i=this.query||{};return this.opts.timestampRequests&&(i[this.opts.timestampParam]=vx()),this.supportsBinary||(i.b64=1),this.createUri(l,i)}}const Bu=nn.WebSocket||nn.MozWebSocket;class z1 extends B1{createSocket(l,i,o){return Sx?new Bu(l,i,o):i?new Bu(l,i):new Bu(l)}doWrite(l,i){this.ws.send(i)}}class L1 extends Mf{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(l){return this.emitReserved("error",l)}this._transport.closed.then(()=>{this.onClose()}).catch(l=>{this.onError("webtransport error",l)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(l=>{const i=y1(Number.MAX_SAFE_INTEGER,this.socket.binaryType),o=l.readable.pipeThrough(i).getReader(),f=v1();f.readable.pipeTo(l.writable),this._writer=f.writable.getWriter();const d=()=>{o.read().then(({done:p,value:g})=>{p||(this.onPacket(g),d())}).catch(p=>{})};d();const h={type:"open"};this.query.sid&&(h.data=`{"sid":"${this.query.sid}"}`),this._writer.write(h).then(()=>this.onOpen())})})}write(l){this.writable=!1;for(let i=0;i<l.length;i++){const o=l[i],f=i===l.length-1;this._writer.write(o).then(()=>{f&&lo(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var l;(l=this._transport)===null||l===void 0||l.close()}}const U1={websocket:z1,webtransport:L1,polling:O1},H1=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,V1=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function sf(a){if(a.length>8e3)throw"URI too long";const l=a,i=a.indexOf("["),o=a.indexOf("]");i!=-1&&o!=-1&&(a=a.substring(0,i)+a.substring(i,o).replace(/:/g,";")+a.substring(o,a.length));let f=H1.exec(a||""),d={},h=14;for(;h--;)d[V1[h]]=f[h]||"";return i!=-1&&o!=-1&&(d.source=l,d.host=d.host.substring(1,d.host.length-1).replace(/;/g,":"),d.authority=d.authority.replace("[","").replace("]","").replace(/;/g,":"),d.ipv6uri=!0),d.pathNames=Y1(d,d.path),d.queryKey=$1(d,d.query),d}function Y1(a,l){const i=/\/{2,9}/g,o=l.replace(i,"/").split("/");return(l.slice(0,1)=="/"||l.length===0)&&o.splice(0,1),l.slice(-1)=="/"&&o.splice(o.length-1,1),o}function $1(a,l){const i={};return l.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(o,f,d){f&&(i[f]=d)}),i}const rf=typeof addEventListener=="function"&&typeof removeEventListener=="function",$r=[];rf&&addEventListener("offline",()=>{$r.forEach(a=>a())},!1);class Na extends dt{constructor(l,i){if(super(),this.binaryType=S1,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,l&&typeof l=="object"&&(i=l,l=null),l){const o=sf(l);i.hostname=o.host,i.secure=o.protocol==="https"||o.protocol==="wss",i.port=o.port,o.query&&(i.query=o.query)}else i.host&&(i.hostname=sf(i.host).host);so(this,i),this.secure=i.secure!=null?i.secure:typeof location<"u"&&location.protocol==="https:",i.hostname&&!i.port&&(i.port=this.secure?"443":"80"),this.hostname=i.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=i.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},i.transports.forEach(o=>{const f=o.prototype.name;this.transports.push(f),this._transportsByName[f]=o}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},i),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=q1(this.opts.query)),rf&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},$r.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(l){const i=Object.assign({},this.opts.query);i.EIO=xx,i.transport=l,this.id&&(i.sid=this.id);const o=Object.assign({},this.opts,{query:i,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[l]);return new this._transportsByName[l](o)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const l=this.opts.rememberUpgrade&&Na.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const i=this.createTransport(l);i.open(),this.setTransport(i)}setTransport(l){this.transport&&this.transport.removeAllListeners(),this.transport=l,l.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",i=>this._onClose("transport close",i))}onOpen(){this.readyState="open",Na.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(l){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",l),this.emitReserved("heartbeat"),l.type){case"open":this.onHandshake(JSON.parse(l.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const i=new Error("server error");i.code=l.data,this._onError(i);break;case"message":this.emitReserved("data",l.data),this.emitReserved("message",l.data);break}}onHandshake(l){this.emitReserved("handshake",l),this.id=l.sid,this.transport.query.sid=l.sid,this._pingInterval=l.pingInterval,this._pingTimeout=l.pingTimeout,this._maxPayload=l.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const l=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+l,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},l),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const l=this._getWritablePackets();this.transport.send(l),this._prevBufferLen=l.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let i=1;for(let o=0;o<this.writeBuffer.length;o++){const f=this.writeBuffer[o].data;if(f&&(i+=w1(f)),o>0&&i>this._maxPayload)return this.writeBuffer.slice(0,o);i+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const l=Date.now()>this._pingTimeoutTime;return l&&(this._pingTimeoutTime=0,lo(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),l}write(l,i,o){return this._sendPacket("message",l,i,o),this}send(l,i,o){return this._sendPacket("message",l,i,o),this}_sendPacket(l,i,o,f){if(typeof i=="function"&&(f=i,i=void 0),typeof o=="function"&&(f=o,o=null),this.readyState==="closing"||this.readyState==="closed")return;o=o||{},o.compress=o.compress!==!1;const d={type:l,data:i,options:o};this.emitReserved("packetCreate",d),this.writeBuffer.push(d),f&&this.once("flush",f),this.flush()}close(){const l=()=>{this._onClose("forced close"),this.transport.close()},i=()=>{this.off("upgrade",i),this.off("upgradeError",i),l()},o=()=>{this.once("upgrade",i),this.once("upgradeError",i)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?o():l()}):this.upgrading?o():l()),this}_onError(l){if(Na.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",l),this._onClose("transport error",l)}_onClose(l,i){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),rf&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const o=$r.indexOf(this._offlineEventListener);o!==-1&&$r.splice(o,1)}this.readyState="closed",this.id=null,this.emitReserved("close",l,i),this.writeBuffer=[],this._prevBufferLen=0}}}Na.protocol=xx;class G1 extends Na{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let l=0;l<this._upgrades.length;l++)this._probe(this._upgrades[l])}_probe(l){let i=this.createTransport(l),o=!1;Na.priorWebsocketSuccess=!1;const f=()=>{o||(i.send([{type:"ping",data:"probe"}]),i.once("packet",b=>{if(!o)if(b.type==="pong"&&b.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",i),!i)return;Na.priorWebsocketSuccess=i.name==="websocket",this.transport.pause(()=>{o||this.readyState!=="closed"&&(y(),this.setTransport(i),i.send([{type:"upgrade"}]),this.emitReserved("upgrade",i),i=null,this.upgrading=!1,this.flush())})}else{const j=new Error("probe error");j.transport=i.name,this.emitReserved("upgradeError",j)}}))};function d(){o||(o=!0,y(),i.close(),i=null)}const h=b=>{const j=new Error("probe error: "+b);j.transport=i.name,d(),this.emitReserved("upgradeError",j)};function p(){h("transport closed")}function g(){h("socket closed")}function v(b){i&&b.name!==i.name&&d()}const y=()=>{i.removeListener("open",f),i.removeListener("error",h),i.removeListener("close",p),this.off("close",g),this.off("upgrading",v)};i.once("open",f),i.once("error",h),i.once("close",p),this.once("close",g),this.once("upgrading",v),this._upgrades.indexOf("webtransport")!==-1&&l!=="webtransport"?this.setTimeoutFn(()=>{o||i.open()},200):i.open()}onHandshake(l){this._upgrades=this._filterUpgrades(l.upgrades),super.onHandshake(l)}_filterUpgrades(l){const i=[];for(let o=0;o<l.length;o++)~this.transports.indexOf(l[o])&&i.push(l[o]);return i}}let X1=class extends G1{constructor(l,i={}){const o=typeof l=="object"?l:i;(!o.transports||o.transports&&typeof o.transports[0]=="string")&&(o.transports=(o.transports||["polling","websocket","webtransport"]).map(f=>U1[f]).filter(f=>!!f)),super(l,o)}};function Q1(a,l="",i){let o=a;i=i||typeof location<"u"&&location,a==null&&(a=i.protocol+"//"+i.host),typeof a=="string"&&(a.charAt(0)==="/"&&(a.charAt(1)==="/"?a=i.protocol+a:a=i.host+a),/^(https?|wss?):\/\//.test(a)||(typeof i<"u"?a=i.protocol+"//"+a:a="https://"+a),o=sf(a)),o.port||(/^(http|ws)$/.test(o.protocol)?o.port="80":/^(http|ws)s$/.test(o.protocol)&&(o.port="443")),o.path=o.path||"/";const d=o.host.indexOf(":")!==-1?"["+o.host+"]":o.host;return o.id=o.protocol+"://"+d+":"+o.port+l,o.href=o.protocol+"://"+d+(i&&i.port===o.port?"":":"+o.port),o}const K1=typeof ArrayBuffer=="function",F1=a=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(a):a.buffer instanceof ArrayBuffer,Ax=Object.prototype.toString,Z1=typeof Blob=="function"||typeof Blob<"u"&&Ax.call(Blob)==="[object BlobConstructor]",J1=typeof File=="function"||typeof File<"u"&&Ax.call(File)==="[object FileConstructor]";function kf(a){return K1&&(a instanceof ArrayBuffer||F1(a))||Z1&&a instanceof Blob||J1&&a instanceof File}function Gr(a,l){if(!a||typeof a!="object")return!1;if(Array.isArray(a)){for(let i=0,o=a.length;i<o;i++)if(Gr(a[i]))return!0;return!1}if(kf(a))return!0;if(a.toJSON&&typeof a.toJSON=="function"&&arguments.length===1)return Gr(a.toJSON(),!0);for(const i in a)if(Object.prototype.hasOwnProperty.call(a,i)&&Gr(a[i]))return!0;return!1}function I1(a){const l=[],i=a.data,o=a;return o.data=of(i,l),o.attachments=l.length,{packet:o,buffers:l}}function of(a,l){if(!a)return a;if(kf(a)){const i={_placeholder:!0,num:l.length};return l.push(a),i}else if(Array.isArray(a)){const i=new Array(a.length);for(let o=0;o<a.length;o++)i[o]=of(a[o],l);return i}else if(typeof a=="object"&&!(a instanceof Date)){const i={};for(const o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=of(a[o],l));return i}return a}function W1(a,l){return a.data=cf(a.data,l),delete a.attachments,a}function cf(a,l){if(!a)return a;if(a&&a._placeholder===!0){if(typeof a.num=="number"&&a.num>=0&&a.num<l.length)return l[a.num];throw new Error("illegal attachments")}else if(Array.isArray(a))for(let i=0;i<a.length;i++)a[i]=cf(a[i],l);else if(typeof a=="object")for(const i in a)Object.prototype.hasOwnProperty.call(a,i)&&(a[i]=cf(a[i],l));return a}const P1=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],eS=5;var Re;(function(a){a[a.CONNECT=0]="CONNECT",a[a.DISCONNECT=1]="DISCONNECT",a[a.EVENT=2]="EVENT",a[a.ACK=3]="ACK",a[a.CONNECT_ERROR=4]="CONNECT_ERROR",a[a.BINARY_EVENT=5]="BINARY_EVENT",a[a.BINARY_ACK=6]="BINARY_ACK"})(Re||(Re={}));class tS{constructor(l){this.replacer=l}encode(l){return(l.type===Re.EVENT||l.type===Re.ACK)&&Gr(l)?this.encodeAsBinary({type:l.type===Re.EVENT?Re.BINARY_EVENT:Re.BINARY_ACK,nsp:l.nsp,data:l.data,id:l.id}):[this.encodeAsString(l)]}encodeAsString(l){let i=""+l.type;return(l.type===Re.BINARY_EVENT||l.type===Re.BINARY_ACK)&&(i+=l.attachments+"-"),l.nsp&&l.nsp!=="/"&&(i+=l.nsp+","),l.id!=null&&(i+=l.id),l.data!=null&&(i+=JSON.stringify(l.data,this.replacer)),i}encodeAsBinary(l){const i=I1(l),o=this.encodeAsString(i.packet),f=i.buffers;return f.unshift(o),f}}function fp(a){return Object.prototype.toString.call(a)==="[object Object]"}class Rf extends dt{constructor(l){super(),this.reviver=l}add(l){let i;if(typeof l=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");i=this.decodeString(l);const o=i.type===Re.BINARY_EVENT;o||i.type===Re.BINARY_ACK?(i.type=o?Re.EVENT:Re.ACK,this.reconstructor=new nS(i),i.attachments===0&&super.emitReserved("decoded",i)):super.emitReserved("decoded",i)}else if(kf(l)||l.base64)if(this.reconstructor)i=this.reconstructor.takeBinaryData(l),i&&(this.reconstructor=null,super.emitReserved("decoded",i));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+l)}decodeString(l){let i=0;const o={type:Number(l.charAt(0))};if(Re[o.type]===void 0)throw new Error("unknown packet type "+o.type);if(o.type===Re.BINARY_EVENT||o.type===Re.BINARY_ACK){const d=i+1;for(;l.charAt(++i)!=="-"&&i!=l.length;);const h=l.substring(d,i);if(h!=Number(h)||l.charAt(i)!=="-")throw new Error("Illegal attachments");o.attachments=Number(h)}if(l.charAt(i+1)==="/"){const d=i+1;for(;++i&&!(l.charAt(i)===","||i===l.length););o.nsp=l.substring(d,i)}else o.nsp="/";const f=l.charAt(i+1);if(f!==""&&Number(f)==f){const d=i+1;for(;++i;){const h=l.charAt(i);if(h==null||Number(h)!=h){--i;break}if(i===l.length)break}o.id=Number(l.substring(d,i+1))}if(l.charAt(++i)){const d=this.tryParse(l.substr(i));if(Rf.isPayloadValid(o.type,d))o.data=d;else throw new Error("invalid payload")}return o}tryParse(l){try{return JSON.parse(l,this.reviver)}catch{return!1}}static isPayloadValid(l,i){switch(l){case Re.CONNECT:return fp(i);case Re.DISCONNECT:return i===void 0;case Re.CONNECT_ERROR:return typeof i=="string"||fp(i);case Re.EVENT:case Re.BINARY_EVENT:return Array.isArray(i)&&(typeof i[0]=="number"||typeof i[0]=="string"&&P1.indexOf(i[0])===-1);case Re.ACK:case Re.BINARY_ACK:return Array.isArray(i)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class nS{constructor(l){this.packet=l,this.buffers=[],this.reconPack=l}takeBinaryData(l){if(this.buffers.push(l),this.buffers.length===this.reconPack.attachments){const i=W1(this.reconPack,this.buffers);return this.finishedReconstruction(),i}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const aS=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Rf,Encoder:tS,get PacketType(){return Re},protocol:eS},Symbol.toStringTag,{value:"Module"}));function dn(a,l,i){return a.on(l,i),function(){a.off(l,i)}}const lS=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class jx extends dt{constructor(l,i,o){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=l,this.nsp=i,o&&o.auth&&(this.auth=o.auth),this._opts=Object.assign({},o),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const l=this.io;this.subs=[dn(l,"open",this.onopen.bind(this)),dn(l,"packet",this.onpacket.bind(this)),dn(l,"error",this.onerror.bind(this)),dn(l,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...l){return l.unshift("message"),this.emit.apply(this,l),this}emit(l,...i){var o,f,d;if(lS.hasOwnProperty(l))throw new Error('"'+l.toString()+'" is a reserved event name');if(i.unshift(l),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(i),this;const h={type:Re.EVENT,data:i};if(h.options={},h.options.compress=this.flags.compress!==!1,typeof i[i.length-1]=="function"){const y=this.ids++,b=i.pop();this._registerAckCallback(y,b),h.id=y}const p=(f=(o=this.io.engine)===null||o===void 0?void 0:o.transport)===null||f===void 0?void 0:f.writable,g=this.connected&&!(!((d=this.io.engine)===null||d===void 0)&&d._hasPingExpired());return this.flags.volatile&&!p||(g?(this.notifyOutgoingListeners(h),this.packet(h)):this.sendBuffer.push(h)),this.flags={},this}_registerAckCallback(l,i){var o;const f=(o=this.flags.timeout)!==null&&o!==void 0?o:this._opts.ackTimeout;if(f===void 0){this.acks[l]=i;return}const d=this.io.setTimeoutFn(()=>{delete this.acks[l];for(let p=0;p<this.sendBuffer.length;p++)this.sendBuffer[p].id===l&&this.sendBuffer.splice(p,1);i.call(this,new Error("operation has timed out"))},f),h=(...p)=>{this.io.clearTimeoutFn(d),i.apply(this,p)};h.withError=!0,this.acks[l]=h}emitWithAck(l,...i){return new Promise((o,f)=>{const d=(h,p)=>h?f(h):o(p);d.withError=!0,i.push(d),this.emit(l,...i)})}_addToQueue(l){let i;typeof l[l.length-1]=="function"&&(i=l.pop());const o={id:this._queueSeq++,tryCount:0,pending:!1,args:l,flags:Object.assign({fromQueue:!0},this.flags)};l.push((f,...d)=>o!==this._queue[0]?void 0:(f!==null?o.tryCount>this._opts.retries&&(this._queue.shift(),i&&i(f)):(this._queue.shift(),i&&i(null,...d)),o.pending=!1,this._drainQueue())),this._queue.push(o),this._drainQueue()}_drainQueue(l=!1){if(!this.connected||this._queue.length===0)return;const i=this._queue[0];i.pending&&!l||(i.pending=!0,i.tryCount++,this.flags=i.flags,this.emit.apply(this,i.args))}packet(l){l.nsp=this.nsp,this.io._packet(l)}onopen(){typeof this.auth=="function"?this.auth(l=>{this._sendConnectPacket(l)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(l){this.packet({type:Re.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},l):l})}onerror(l){this.connected||this.emitReserved("connect_error",l)}onclose(l,i){this.connected=!1,delete this.id,this.emitReserved("disconnect",l,i),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(l=>{if(!this.sendBuffer.some(o=>String(o.id)===l)){const o=this.acks[l];delete this.acks[l],o.withError&&o.call(this,new Error("socket has been disconnected"))}})}onpacket(l){if(l.nsp===this.nsp)switch(l.type){case Re.CONNECT:l.data&&l.data.sid?this.onconnect(l.data.sid,l.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Re.EVENT:case Re.BINARY_EVENT:this.onevent(l);break;case Re.ACK:case Re.BINARY_ACK:this.onack(l);break;case Re.DISCONNECT:this.ondisconnect();break;case Re.CONNECT_ERROR:this.destroy();const o=new Error(l.data.message);o.data=l.data.data,this.emitReserved("connect_error",o);break}}onevent(l){const i=l.data||[];l.id!=null&&i.push(this.ack(l.id)),this.connected?this.emitEvent(i):this.receiveBuffer.push(Object.freeze(i))}emitEvent(l){if(this._anyListeners&&this._anyListeners.length){const i=this._anyListeners.slice();for(const o of i)o.apply(this,l)}super.emit.apply(this,l),this._pid&&l.length&&typeof l[l.length-1]=="string"&&(this._lastOffset=l[l.length-1])}ack(l){const i=this;let o=!1;return function(...f){o||(o=!0,i.packet({type:Re.ACK,id:l,data:f}))}}onack(l){const i=this.acks[l.id];typeof i=="function"&&(delete this.acks[l.id],i.withError&&l.data.unshift(null),i.apply(this,l.data))}onconnect(l,i){this.id=l,this.recovered=i&&this._pid===i,this._pid=i,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(l=>this.emitEvent(l)),this.receiveBuffer=[],this.sendBuffer.forEach(l=>{this.notifyOutgoingListeners(l),this.packet(l)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(l=>l()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Re.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(l){return this.flags.compress=l,this}get volatile(){return this.flags.volatile=!0,this}timeout(l){return this.flags.timeout=l,this}onAny(l){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(l),this}prependAny(l){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(l),this}offAny(l){if(!this._anyListeners)return this;if(l){const i=this._anyListeners;for(let o=0;o<i.length;o++)if(l===i[o])return i.splice(o,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(l){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(l),this}prependAnyOutgoing(l){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(l),this}offAnyOutgoing(l){if(!this._anyOutgoingListeners)return this;if(l){const i=this._anyOutgoingListeners;for(let o=0;o<i.length;o++)if(l===i[o])return i.splice(o,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(l){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const i=this._anyOutgoingListeners.slice();for(const o of i)o.apply(this,l.data)}}}function Pl(a){a=a||{},this.ms=a.min||100,this.max=a.max||1e4,this.factor=a.factor||2,this.jitter=a.jitter>0&&a.jitter<=1?a.jitter:0,this.attempts=0}Pl.prototype.duration=function(){var a=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var l=Math.random(),i=Math.floor(l*this.jitter*a);a=(Math.floor(l*10)&1)==0?a-i:a+i}return Math.min(a,this.max)|0};Pl.prototype.reset=function(){this.attempts=0};Pl.prototype.setMin=function(a){this.ms=a};Pl.prototype.setMax=function(a){this.max=a};Pl.prototype.setJitter=function(a){this.jitter=a};class uf extends dt{constructor(l,i){var o;super(),this.nsps={},this.subs=[],l&&typeof l=="object"&&(i=l,l=void 0),i=i||{},i.path=i.path||"/socket.io",this.opts=i,so(this,i),this.reconnection(i.reconnection!==!1),this.reconnectionAttempts(i.reconnectionAttempts||1/0),this.reconnectionDelay(i.reconnectionDelay||1e3),this.reconnectionDelayMax(i.reconnectionDelayMax||5e3),this.randomizationFactor((o=i.randomizationFactor)!==null&&o!==void 0?o:.5),this.backoff=new Pl({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(i.timeout==null?2e4:i.timeout),this._readyState="closed",this.uri=l;const f=i.parser||aS;this.encoder=new f.Encoder,this.decoder=new f.Decoder,this._autoConnect=i.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(l){return arguments.length?(this._reconnection=!!l,l||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(l){return l===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=l,this)}reconnectionDelay(l){var i;return l===void 0?this._reconnectionDelay:(this._reconnectionDelay=l,(i=this.backoff)===null||i===void 0||i.setMin(l),this)}randomizationFactor(l){var i;return l===void 0?this._randomizationFactor:(this._randomizationFactor=l,(i=this.backoff)===null||i===void 0||i.setJitter(l),this)}reconnectionDelayMax(l){var i;return l===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=l,(i=this.backoff)===null||i===void 0||i.setMax(l),this)}timeout(l){return arguments.length?(this._timeout=l,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(l){if(~this._readyState.indexOf("open"))return this;this.engine=new X1(this.uri,this.opts);const i=this.engine,o=this;this._readyState="opening",this.skipReconnect=!1;const f=dn(i,"open",function(){o.onopen(),l&&l()}),d=p=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",p),l?l(p):this.maybeReconnectOnOpen()},h=dn(i,"error",d);if(this._timeout!==!1){const p=this._timeout,g=this.setTimeoutFn(()=>{f(),d(new Error("timeout")),i.close()},p);this.opts.autoUnref&&g.unref(),this.subs.push(()=>{this.clearTimeoutFn(g)})}return this.subs.push(f),this.subs.push(h),this}connect(l){return this.open(l)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const l=this.engine;this.subs.push(dn(l,"ping",this.onping.bind(this)),dn(l,"data",this.ondata.bind(this)),dn(l,"error",this.onerror.bind(this)),dn(l,"close",this.onclose.bind(this)),dn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(l){try{this.decoder.add(l)}catch(i){this.onclose("parse error",i)}}ondecoded(l){lo(()=>{this.emitReserved("packet",l)},this.setTimeoutFn)}onerror(l){this.emitReserved("error",l)}socket(l,i){let o=this.nsps[l];return o?this._autoConnect&&!o.active&&o.connect():(o=new jx(this,l,i),this.nsps[l]=o),o}_destroy(l){const i=Object.keys(this.nsps);for(const o of i)if(this.nsps[o].active)return;this._close()}_packet(l){const i=this.encoder.encode(l);for(let o=0;o<i.length;o++)this.engine.write(i[o],l.options)}cleanup(){this.subs.forEach(l=>l()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(l,i){var o;this.cleanup(),(o=this.engine)===null||o===void 0||o.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",l,i),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const l=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const i=this.backoff.duration();this._reconnecting=!0;const o=this.setTimeoutFn(()=>{l.skipReconnect||(this.emitReserved("reconnect_attempt",l.backoff.attempts),!l.skipReconnect&&l.open(f=>{f?(l._reconnecting=!1,l.reconnect(),this.emitReserved("reconnect_error",f)):l.onreconnect()}))},i);this.opts.autoUnref&&o.unref(),this.subs.push(()=>{this.clearTimeoutFn(o)})}}onreconnect(){const l=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",l)}}const Zs={};function Xr(a,l){typeof a=="object"&&(l=a,a=void 0),l=l||{};const i=Q1(a,l.path||"/socket.io"),o=i.source,f=i.id,d=i.path,h=Zs[f]&&d in Zs[f].nsps,p=l.forceNew||l["force new connection"]||l.multiplex===!1||h;let g;return p?g=new uf(o,l):(Zs[f]||(Zs[f]=new uf(o,l)),g=Zs[f]),i.query&&!l.query&&(l.query=i.queryKey),g.socket(i.path,l)}Object.assign(Xr,{Manager:uf,Socket:jx,io:Xr,connect:Xr});const Nx="roverSettings",sS=3600*24*365;function iS(a){try{const l=decodeURIComponent(a??"");return JSON.parse(l)}catch(l){return console.warn("Failed to parse settings cookie",l),null}}function ff(){if(typeof document>"u")return{};const a=`${Nx}=`,l=document.cookie.split(";").map(o=>o.trim()).find(o=>o.startsWith(a));if(!l)return{};const i=l.substring(a.length);return iS(i)??{}}function dp(a){if(typeof document>"u")return!1;try{const l=encodeURIComponent(JSON.stringify(a??{})),i=`${Nx}=${l}; path=/; max-age=${sS}; samesite=strict`;return document.cookie=i,!0}catch(l){return console.warn("Failed to write settings cookie",l),!1}}const wx=window.location.origin;console.info("[socket] connecting to",wx);const rS=ff(),oS=rS?.page?.connectionTransport||"websocket",cS=oS==="polling"?["polling"]:["websocket","polling"],Tf=Xr(wx,{transports:cS,timeout:15e3});Tf.on("connect_error",a=>console.error("connect_error",a.code,a.message,a.data));const Ex=m.createContext(Tf),uS=({children:a})=>r.jsx(Ex.Provider,{value:Tf,children:a}),En=()=>m.useContext(Ex),Cx=m.createContext({connected:!1,session:null,logs:[],adminLogs:[],llmCommentaryStatus:null,login:async()=>{},setRole:async()=>{},requestControl:async()=>{},releaseControl:async()=>{},subscribeAll:async()=>{},homeAssistantToggle:async()=>{},homeAssistantSetState:async()=>{},homeAssistantSetLightColor:async()=>{},setNickname:async()=>{},triggerReplay:async()=>{},setCommunityGoal:async()=>{},setAdminReason:async()=>{},rebootRover:async()=>{},rebootServer:async()=>{}});function fS(a){return m.useCallback((l,i={})=>new Promise((o,f)=>{a.emit(l,i,(d={})=>{d.error?f(new Error(d.error)):o(d)})}),[a])}function dS({children:a}){const l=En(),i=fS(l),[o,f]=m.useState(null),[d,h]=m.useState([]),[p,g]=m.useState([]),[v,y]=m.useState(null),[b,j]=m.useState([]),[M,w]=m.useState(l.connected);m.useEffect(()=>{const E=()=>w(!0),S=()=>w(!1);return l.on("connect",E),l.on("disconnect",S),()=>{l.off("connect",E),l.off("disconnect",S)}},[l]),m.useEffect(()=>{function E(O){f(O)}function S(O=[]){h(O)}function T(O){h(V=>[...V.slice(-199),O])}function z(O=[]){g(O)}function L(O){g(V=>[...V.slice(-199),O])}function $(O=null){y(O&&typeof O=="object"?O:null)}return l.on("session:sync",E),l.on("log:init",S),l.on("log:entry",T),l.on("adminlog:init",z),l.on("adminlog:entry",L),l.on("llmCommentary:status",$),l.on("alert:new",(O={})=>{j(V=>[...V.slice(-49),{...O,receivedAt:Date.now()}])}),()=>{l.off("session:sync",E),l.off("log:init",S),l.off("log:entry",T),l.off("adminlog:init",z),l.off("adminlog:entry",L),l.off("llmCommentary:status",$),l.off("alert:new")}},[l]);const q=m.useMemo(()=>({login:(E,S)=>i("auth:login",{username:E,password:S}),setRole:E=>i("session:setRole",{role:E}),requestControl:(E,S={})=>i("session:requestControl",{roverId:E,...S}),releaseControl:E=>i("session:releaseControl",{roverId:E}),subscribeAll:()=>i("session:subscribeAll"),lockRover:(E,S)=>i("session:lockRover",{roverId:E,locked:S}),setMode:E=>i("setMode",{mode:E}),homeAssistantToggle:E=>i("homeAssistant:toggle",{entityId:E}),homeAssistantSetState:(E,S)=>i("homeAssistant:setState",{entityId:E,state:S}),homeAssistantSetLightColor:(E,S)=>i("homeAssistant:lightColor",{entityId:E,rgbColor:S}),setNickname:E=>i("nickname:set",{nickname:E}),triggerReplay:(E=[])=>i("replay:trigger",{sources:E}),setCommunityGoal:E=>i("communityGoal:set",{text:E}),setAdminReason:E=>i("adminReason:set",{text:E}),rebootRover:E=>i("command",{roverId:E,type:"reboot",data:{reboot:{}}}),rebootServer:()=>i("server:reboot"),pushAlert:E=>j(S=>[...S.slice(-49),{...E,receivedAt:Date.now(),id:E.id||Math.random().toString(36).slice(2)}])}),[i]),N=m.useMemo(()=>({connected:M,session:o,logs:d,adminLogs:p,llmCommentaryStatus:v,alerts:b,...q}),[q,p,b,M,v,d,o]);return r.jsx(Cx.Provider,{value:N,children:a})}function Ve(){return m.useContext(Cx)}const qx=m.createContext({frames:{}});function mS({children:a}){const l=En(),[i,o]=m.useState({});m.useEffect(()=>{function d({roverId:h,sensors:p={},frame:g={}}){h&&o(v=>({...v,[h]:{roverId:h,sensors:p,raw:g?.data||null,receivedAt:Date.now()}}))}return l.on("sensorFrame",d),()=>{l.off("sensorFrame",d)}},[l]);const f=m.useMemo(()=>({frames:i}),[i]);return r.jsx(qx.Provider,{value:f,children:a})}function Df(){return m.useContext(qx).frames}function es(a){const l=Df();return a?l[a]??null:null}const hS=650,pS={161:{red:!0},164:{green:!0},165:{force:!0},168:{red:!0,green:!0},169:{red:!0,force:!0},172:{green:!0,force:!0},173:{red:!0,green:!0,force:!0}};function zu(a){if(typeof a!="number"||a<=0)return null;const l=pS[a];return l?{code:a,...l}:null}function xS(a,l={}){const i=l.holdMs||hS,[o,f]=m.useState({left:null,right:null,omni:null}),[d,h]=m.useState(0);return m.useEffect(()=>{const p=setInterval(()=>h(Date.now()),Math.max(i/2,100));return()=>clearInterval(p)},[i]),m.useEffect(()=>{const p=Date.now(),g=zu(a?.infraredCharacterLeft),v=zu(a?.infraredCharacterRight),y=zu(a?.infraredCharacterOmni);!g&&!v&&!y||f(b=>({left:g?{...g,ts:p}:b.left,right:v?{...v,ts:p}:b.right,omni:y?{...y,ts:p}:b.omni}))},[a?.infraredCharacterLeft,a?.infraredCharacterRight,a?.infraredCharacterOmni]),m.useEffect(()=>{const{left:p,right:g,omni:v}=o;if(!(p?.ts||g?.ts||v?.ts))return;const b=new Date().toISOString();console.debug("[DockIR]",b,{left:p?.code??0,omni:v?.code??0,right:g?.code??0})},[o.left?.code,o.right?.code,o.omni?.code]),m.useMemo(()=>{const p=Date.now(),g=N=>{if(!N)return{active:!1,red:!1,green:!1,force:!1,age:null,code:null};const E=p-N.ts,S=E<=i;return{active:S,age:E,code:N.code,red:!!(N.red&&S),green:!!(N.green&&S),force:!!(N.force&&S)}},v=g(o.left),y=g(o.right),b=g(o.omni),j=v.force||y.force||b.force,M=v.active||y.active||b.active,w=v.active&&!y.active?"right":y.active&&!v.active?"left":"center",q=(y.active?1:0)-(v.active?1:0);return{visible:M,forceDetected:j,left:v,right:y,omni:b,bias:w,balance:Math.max(-1,Math.min(1,q))}},[o.left,o.right,o.omni,i,d])}function gS(){const{connected:a,session:l}=Ve(),i=l?.assignment?.roverId,o=es(i),f=o?.sensors||{},d=xS(f),h=f.voltageMv!=null?`${(f.voltageMv/1e3).toFixed(2)} V`:null,p=f.currentMa!=null?`${f.currentMa} mA`:null,g=f.batteryTemperatureC!=null?`${f.batteryTemperatureC} °C`:null,v=f.batteryChargeMah,y=f.batteryCapacityMah;o?.receivedAt&&new Date(o.receivedAt).toLocaleTimeString();const b=o?.raw?o.raw:null,j=i?l?.activeDrivers?.[i]:null;return m.useMemo(()=>i?j?j===l?.socketId?"You":(l?.users||[]).find(w=>w.socketId===j)?.nickname||j.slice(0,6):"Available":"n/a",[j,i,l?.socketId,l?.users]),r.jsxs("section",{className:"panel-section space-y-0.5 text-base text-slate-100",children:[i?o?r.jsxs(r.Fragment,{children:[r.jsx(vS,{sensors:f,voltage:h,current:p,batteryTemp:g,charge:v,capacity:y}),r.jsx(yS,{sensors:f,dockState:d})]}):r.jsx("p",{className:"text-sm text-slate-500",children:"Waiting for sensor frames…"}):r.jsx("p",{className:"text-sm text-slate-500",children:"Assign a rover to view sensors."}),b&&r.jsx("pre",{className:"surface whitespace-pre-wrap break-words text-xs text-lime-300",children:b})]})}function vS({sensors:a,voltage:l,current:i,batteryTemp:o,charge:f,capacity:d}){const h=f!=null&&d?`${Math.round(f/d*100)}`:"--",p=a?.oiMode?.label||"--",g=a?.chargingSources?.homeBase?"Yes":"No",v=a?.chargingState?.label||"--";return r.jsxs("div",{className:"grid grid-cols-2 gap-0.5 md:grid-cols-3",children:[r.jsx(Xn,{label:"Voltage",value:l??"--"}),r.jsx(Xn,{label:"Current",value:i??"--"}),r.jsx(Xn,{label:"Battery temp",value:o??"--"}),r.jsx(Xn,{label:"Charge",value:f!=null?`${f} mAh`:"--"}),r.jsx(Xn,{label:"Capacity",value:d!=null?`${d} mAh`:"--"}),r.jsx(Xn,{label:"Charge",value:h}),r.jsx(Xn,{label:"OI mode",value:p}),r.jsx(Xn,{label:"Docked",value:g}),r.jsx(Xn,{label:"Charging state",value:v})]})}function Xn({label:a,value:l}){return r.jsxs("div",{className:"surface flex items-center justify-between gap-0.5 px-1 py-0.5 text-sm",children:[r.jsx("span",{className:"text-slate-400",children:a}),r.jsx("span",{className:"text-slate-100",children:l})]})}function yS({sensors:a,dockState:l}){const i=a?.bumpsAndWheelDrops||{},o=a?.wheelOvercurrents||{},f=[{label:"Left",value:a?.lightBumpLeftSignal},{label:"Front Left",value:a?.lightBumpFrontLeftSignal},{label:"Center Left",value:a?.lightBumpCenterLeftSignal},{label:"Center Right",value:a?.lightBumpCenterRightSignal},{label:"Front Right",value:a?.lightBumpFrontRightSignal},{label:"Right",value:a?.lightBumpRightSignal}],d=[{label:"Left",value:a?.cliffLeftSignal,active:a?.cliffLeft},{label:"Front Left",value:a?.cliffFrontLeftSignal,active:a?.cliffFrontLeft},{label:"Front Right",value:a?.cliffFrontRightSignal,active:a?.cliffFrontRight},{label:"Right",value:a?.cliffRightSignal,active:a?.cliffRight}],h=[{label:"Wheel L",value:a?.wheelLeftCurrentMa,over:o.leftWheel},{label:"Wheel R",value:a?.wheelRightCurrentMa,over:o.rightWheel},{label:"Side brush",value:a?.sideBrushCurrentMa,over:o.sideBrush},{label:"Main brush",value:a?.mainBrushCurrentMa,over:o.mainBrush}];return r.jsxs("div",{className:"grid gap-0.5 md:grid-cols-2",children:[r.jsxs(Vl,{title:"Dock IR",children:[r.jsx(bS,{sensors:a}),r.jsx(SS,{state:l})]}),r.jsxs(Vl,{title:"Bumps & drops",children:[r.jsx(Qn,{label:"Bump L",value:r.jsx(Js,{active:i.bumpLeft})}),r.jsx(Qn,{label:"Bump R",value:r.jsx(Js,{active:i.bumpRight})}),r.jsx(Qn,{label:"Wheel drop L",value:r.jsx(Js,{active:i.wheelDropLeft,tone:"amber"})}),r.jsx(Qn,{label:"Wheel drop R",value:r.jsx(Js,{active:i.wheelDropRight,tone:"amber"})})]}),r.jsx(Vl,{title:"Light bumps (raw)",children:f.map(p=>r.jsx(Qn,{label:p.label,value:Is(p.value)},p.label))}),r.jsx(Vl,{title:"Cliff sensors",children:d.map(p=>r.jsx(Qn,{label:p.label,value:`${Is(p.value)} · ${p.active?"bool: true":"bool: false"}`},p.label))}),r.jsx(Vl,{title:"Currents",children:h.map(p=>r.jsx(Qn,{label:p.label,value:r.jsxs("span",{className:"flex items-center gap-0.5",children:[r.jsx("span",{children:Is(p.value,"mA")}),p.over?r.jsx(Js,{active:!0,tone:"red",label:"over"}):null]})},p.label))}),r.jsxs(Vl,{title:"Dirt detect",children:[r.jsx(Qn,{label:"Left",value:Is(a?.dirtDetectLeft)}),r.jsx(Qn,{label:"Right",value:Is(a?.dirtDetect)})]})]})}function Vl({title:a,children:l}){return r.jsxs("div",{className:"surface space-y-0.5 p-1 text-sm",children:[r.jsx("div",{className:"text-[0.8rem] uppercase tracking-wide text-slate-400",children:a}),r.jsx("div",{className:"space-y-0.5",children:l})]})}function Qn({label:a,value:l}){return r.jsxs("div",{className:"flex items-center justify-between gap-0.5",children:[r.jsx("span",{className:"text-slate-300",children:a}),r.jsx("span",{className:"text-slate-100",children:l})]})}function Js({active:a,tone:l="green",label:i}){const o="rounded px-1.5 py-0.5 text-[0.7rem] font-semibold",f=l==="red"?a?"bg-red-600 text-white":"bg-slate-700 text-slate-300":l==="amber"?a?"bg-amber-500 text-slate-900":"bg-slate-700 text-slate-300":a?"bg-emerald-600 text-white":"bg-slate-700 text-slate-300";return r.jsx("span",{className:`${o} ${f}`,children:i||(a?"true":"false")})}function Is(a,l){return a==null||Number.isNaN(a)?"--":l?`${a} ${l}`:a}function bS({sensors:a}){const l=a?.infraredCharacterLeft,i=a?.infraredCharacterRight,o=a?.infraredCharacterOmni,f=d=>r.jsx("span",{className:`rounded px-1 py-0.25 text-[0.7rem] font-semibold ${d?"bg-emerald-600 text-white":"bg-slate-700 text-slate-300"}`,children:d||"--"});return r.jsxs("div",{className:"flex items-center justify-between gap-0.5 text-xs text-slate-200",children:[r.jsxs("div",{className:"flex items-center gap-0.5",children:[r.jsx("span",{className:"text-slate-400",children:"L"}),f(l)]}),r.jsxs("div",{className:"flex items-center gap-0.5",children:[r.jsx("span",{className:"text-slate-400",children:"O"}),f(o)]}),r.jsxs("div",{className:"flex items-center gap-0.5",children:[r.jsx("span",{className:"text-slate-400",children:"R"}),f(i)]})]})}function SS({state:a}){if(!a)return null;const l=o=>{const f=[];return o?.red&&f.push("R"),o?.green&&f.push("G"),o?.force&&f.push("F"),f.length?f.join(""):"none"},i=o=>o?.age!=null?`${o.age}ms`:"--";return r.jsxs("div",{className:"text-[0.7rem] text-slate-400",children:[r.jsx("div",{children:`Left: ${a.left.code??"--"} (${l(a.left)}) · age ${i(a.left)}`}),r.jsx("div",{children:`Omni: ${a.omni.code??"--"} (${l(a.omni)}) · age ${i(a.omni)}`}),r.jsx("div",{children:`Right: ${a.right.code??"--"} (${l(a.right)}) · age ${i(a.right)}`})]})}const Mx=m.createContext(null);function AS({children:a}){const[l,i]=m.useState(()=>({status:"loading",data:{}}));m.useEffect(()=>{const p=ff();i({status:"ready",data:p??{}})},[]);const o=m.useCallback(()=>{const p=ff();i({status:"ready",data:p??{}})},[]),f=m.useCallback(p=>{const g=dp(p??{});return i(g?{status:"ready",data:p??{}}:v=>({...v,status:"error"})),g},[]),d=m.useCallback((p,g)=>{i(v=>{const y=v.data[p]||{},b=typeof g=="function"?g(y):{...y,...g??{}},j={...v.data,[p]:b};return dp(j)?{status:"ready",data:j}:{...v,status:"error"}})},[]),h=m.useMemo(()=>({data:l.data,status:l.status,reload:o,saveAll:f,setNamespace:d}),[l,o,f,d]);return r.jsx(Mx.Provider,{value:h,children:a})}function jS(){const a=m.useContext(Mx);if(!a)throw new Error("useSettings must be used within SettingsProvider");return a}function st(a,l={}){const{data:i,status:o,setNamespace:f}=jS(),d=i[a]??l??{},h=m.useCallback(v=>{f(a,y=>{const b=y??{};return typeof v=="function"?v(b):{...b,...v??{}}})},[a,f]),p=m.useCallback(v=>{f(a,()=>v??{})},[a,f]),g=m.useCallback(()=>{const v=typeof l=="object"?{...l}:l;f(a,()=>v??{})},[l,a,f]);return{value:d,status:o,save:h,replace:p,reset:g}}function NS(a=[]){return a.map(l=>!l?.type||!l?.id?null:{type:l.type,id:String(l.id),label:l.label||String(l.id),key:`${l.type}:${l.id}`}).filter(Boolean)}function _f({panelId:a="replay-sources",fillHeight:l=!1}){const{session:i,triggerReplay:o}=Ve(),f=NS(i?.replaySources||[]),{value:d,save:h}=st("replaySources",{}),[p,g]=m.useState([]),[v,y]=m.useState(!1),[b,j]=m.useState(null),[M,w]=m.useState(null),q=i?.replay||null,[N,E]=m.useState(0),S=m.useMemo(()=>{const X=i?.assignment?.roverId;return X?[`rover:${X}`]:[]},[i?.assignment?.roverId]);m.useEffect(()=>{const X=d?.[a];if(Array.isArray(X)&&X.length){g(X);return}g(S)},[d?.[a],S,a]),m.useEffect(()=>{const X=new Set(f.map(Z=>Z.key));g(Z=>Z.filter(F=>X.has(F)))},[f]);const T=m.useMemo(()=>({rovers:f.filter(X=>X.type==="rover"),rooms:f.filter(X=>X.type==="room")}),[f]);m.useEffect(()=>{if(!q?.lastTriggeredAt||!q?.cooldownMs){E(0);return}const X=()=>{const F=q.lastTriggeredAt+q.cooldownMs-Date.now();E(Math.max(0,F))};X();const Z=setInterval(X,250);return()=>clearInterval(Z)},[q?.lastTriggeredAt,q?.cooldownMs,q?.remainingMs]);const z=v||i?.mode==="lockdown"||N>0||!p.length,L=X=>{g(Z=>{const F=Z.includes(X)?Z.filter(ae=>ae!==X):[...Z,X];return h(ae=>({...ae||{},[a]:F})),F}),w(null)},$=async()=>{if(!z){y(!0),j(null),w(null);try{const X=p.map(Z=>{const[F,ae]=Z.split(":");return{type:F,id:ae}});await o(X),w("Replay sent. Check the Discord replay channel.")}catch(X){j(X.message)}finally{y(!1)}}},O=l?"h-full flex flex-col":"",V=l?"flex-1 min-h-0 overflow-y-auto":"";return r.jsxs("section",{className:`panel-section p-0.75 text-sm ${O}`,children:[r.jsxs("header",{className:"panel-muted flex items-center justify-between text-xs",children:[r.jsx("span",{children:"Replay Sources"}),r.jsx("span",{children:f.length})]}),r.jsxs("div",{className:`grid gap-0.5 md:grid-cols-2 ${V}`,children:[r.jsx(mp,{title:"Rovers",items:T.rovers,selected:p,onToggle:L}),r.jsx(mp,{title:"Room Cams",items:T.rooms,selected:p,onToggle:L})]}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("button",{type:"button",className:"button-dark w-full text-xs disabled:opacity-40",onClick:$,disabled:z,children:N>0?`Replay (${Math.ceil(N/1e3)}s)`:v?"Replay…":"Replay"}),b?r.jsx("div",{className:"text-xs text-amber-400",children:b}):null,M?r.jsx("div",{className:"text-xs text-emerald-300",children:M}):null]})]})}function mp({title:a,items:l,selected:i,onToggle:o}){return l.length?r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("div",{className:"panel-muted text-xs",children:a}),r.jsx("div",{className:"space-y-0.5",children:l.map(f=>r.jsxs("label",{className:"surface flex items-center gap-0.5 text-xs",children:[r.jsx("input",{type:"checkbox",checked:i.includes(f.key),onChange:()=>o(f.key),className:"accent-emerald-400"}),r.jsx("span",{className:"truncate",children:f.label})]},f.key))})]}):null}var kx={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},hp=Ia.createContext&&Ia.createContext(kx),wS=["attr","size","title"];function ES(a,l){if(a==null)return{};var i=CS(a,l),o,f;if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);for(f=0;f<d.length;f++)o=d[f],!(l.indexOf(o)>=0)&&Object.prototype.propertyIsEnumerable.call(a,o)&&(i[o]=a[o])}return i}function CS(a,l){if(a==null)return{};var i={};for(var o in a)if(Object.prototype.hasOwnProperty.call(a,o)){if(l.indexOf(o)>=0)continue;i[o]=a[o]}return i}function Jr(){return Jr=Object.assign?Object.assign.bind():function(a){for(var l=1;l<arguments.length;l++){var i=arguments[l];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(a[o]=i[o])}return a},Jr.apply(this,arguments)}function pp(a,l){var i=Object.keys(a);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(a);l&&(o=o.filter(function(f){return Object.getOwnPropertyDescriptor(a,f).enumerable})),i.push.apply(i,o)}return i}function Ir(a){for(var l=1;l<arguments.length;l++){var i=arguments[l]!=null?arguments[l]:{};l%2?pp(Object(i),!0).forEach(function(o){qS(a,o,i[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(i)):pp(Object(i)).forEach(function(o){Object.defineProperty(a,o,Object.getOwnPropertyDescriptor(i,o))})}return a}function qS(a,l,i){return l=MS(l),l in a?Object.defineProperty(a,l,{value:i,enumerable:!0,configurable:!0,writable:!0}):a[l]=i,a}function MS(a){var l=kS(a,"string");return typeof l=="symbol"?l:l+""}function kS(a,l){if(typeof a!="object"||!a)return a;var i=a[Symbol.toPrimitive];if(i!==void 0){var o=i.call(a,l);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(l==="string"?String:Number)(a)}function Rx(a){return a&&a.map((l,i)=>Ia.createElement(l.tag,Ir({key:i},l.attr),Rx(l.child)))}function pi(a){return l=>Ia.createElement(RS,Jr({attr:Ir({},a.attr)},l),Rx(a.child))}function RS(a){var l=i=>{var{attr:o,size:f,title:d}=a,h=ES(a,wS),p=f||i.size||"1em",g;return i.className&&(g=i.className),a.className&&(g=(g?g+" ":"")+a.className),Ia.createElement("svg",Jr({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},i.attr,o,h,{className:g,style:Ir(Ir({color:a.color||i.color},i.style),a.style),height:p,width:p,xmlns:"http://www.w3.org/2000/svg"}),d&&Ia.createElement("title",null,d),a.children)};return hp!==void 0?Ia.createElement(hp.Consumer,null,i=>l(i)):l(kx)}function Tx(a){return pi({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M524.531,69.836a1.5,1.5,0,0,0-.764-.7A485.065,485.065,0,0,0,404.081,32.03a1.816,1.816,0,0,0-1.923.91,337.461,337.461,0,0,0-14.9,30.6,447.848,447.848,0,0,0-134.426,0,309.541,309.541,0,0,0-15.135-30.6,1.89,1.89,0,0,0-1.924-.91A483.689,483.689,0,0,0,116.085,69.137a1.712,1.712,0,0,0-.788.676C39.068,183.651,18.186,294.69,28.43,404.354a2.016,2.016,0,0,0,.765,1.375A487.666,487.666,0,0,0,176.02,479.918a1.9,1.9,0,0,0,2.063-.676A348.2,348.2,0,0,0,208.12,430.4a1.86,1.86,0,0,0-1.019-2.588,321.173,321.173,0,0,1-45.868-21.853,1.885,1.885,0,0,1-.185-3.126c3.082-2.309,6.166-4.711,9.109-7.137a1.819,1.819,0,0,1,1.9-.256c96.229,43.917,200.41,43.917,295.5,0a1.812,1.812,0,0,1,1.924.233c2.944,2.426,6.027,4.851,9.132,7.16a1.884,1.884,0,0,1-.162,3.126,301.407,301.407,0,0,1-45.89,21.83,1.875,1.875,0,0,0-1,2.611,391.055,391.055,0,0,0,30.014,48.815,1.864,1.864,0,0,0,2.063.7A486.048,486.048,0,0,0,610.7,405.729a1.882,1.882,0,0,0,.765-1.352C623.729,277.594,590.933,167.465,524.531,69.836ZM222.491,337.58c-28.972,0-52.844-26.587-52.844-59.239S193.056,219.1,222.491,219.1c29.665,0,53.306,26.82,52.843,59.239C275.334,310.993,251.924,337.58,222.491,337.58Zm195.38,0c-28.971,0-52.843-26.587-52.843-59.239S388.437,219.1,417.871,219.1c29.667,0,53.307,26.82,52.844,59.239C470.715,310.993,447.538,337.58,417.871,337.58Z"},child:[]}]})(a)}function TS(a){return pi({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M448 360V24c0-13.3-10.7-24-24-24H96C43 0 0 43 0 96v320c0 53 43 96 96 96h328c13.3 0 24-10.7 24-24v-16c0-7.5-3.5-14.3-8.9-18.7-4.2-15.4-4.2-59.3 0-74.7 5.4-4.3 8.9-11.1 8.9-18.6zM128 134c0-3.3 2.7-6 6-6h212c3.3 0 6 2.7 6 6v20c0 3.3-2.7 6-6 6H134c-3.3 0-6-2.7-6-6v-20zm0 64c0-3.3 2.7-6 6-6h212c3.3 0 6 2.7 6 6v20c0 3.3-2.7 6-6 6H134c-3.3 0-6-2.7-6-6v-20zm253.4 250H96c-17.7 0-32-14.3-32-32 0-17.6 14.4-32 32-32h285.4c-1.9 17.1-1.9 46.9 0 64z"},child:[]}]})(a)}function xp(a){return pi({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M192 384h192c53 0 96-43 96-96h32c70.6 0 128-57.4 128-128S582.6 32 512 32H120c-13.3 0-24 10.7-24 24v232c0 53 43 96 96 96zM512 96c35.3 0 64 28.7 64 64s-28.7 64-64 64h-32V96h32zm47.7 384H48.3c-47.6 0-61-64-36-64h583.3c25 0 11.8 64-35.9 64z"},child:[]}]})(a)}function DS(a){return pi({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M528 448H112c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h416c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm64-320c-26.5 0-48 21.5-48 48 0 7.1 1.6 13.7 4.4 19.8L476 239.2c-15.4 9.2-35.3 4-44.2-11.6L350.3 85C361 76.2 368 63 368 48c0-26.5-21.5-48-48-48s-48 21.5-48 48c0 15 7 28.2 17.7 37l-81.5 142.6c-8.9 15.6-28.9 20.8-44.2 11.6l-72.3-43.4c2.7-6 4.4-12.7 4.4-19.8 0-26.5-21.5-48-48-48S0 149.5 0 176s21.5 48 48 48c2.6 0 5.2-.4 7.7-.8L128 416h384l72.3-192.8c2.5.4 5.1.8 7.7.8 26.5 0 48-21.5 48-48s-21.5-48-48-48z"},child:[]}]})(a)}function _S(a){return pi({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M326.612 185.391c59.747 59.809 58.927 155.698.36 214.59-.11.12-.24.25-.36.37l-67.2 67.2c-59.27 59.27-155.699 59.262-214.96 0-59.27-59.26-59.27-155.7 0-214.96l37.106-37.106c9.84-9.84 26.786-3.3 27.294 10.606.648 17.722 3.826 35.527 9.69 52.721 1.986 5.822.567 12.262-3.783 16.612l-13.087 13.087c-28.026 28.026-28.905 73.66-1.155 101.96 28.024 28.579 74.086 28.749 102.325.51l67.2-67.19c28.191-28.191 28.073-73.757 0-101.83-3.701-3.694-7.429-6.564-10.341-8.569a16.037 16.037 0 0 1-6.947-12.606c-.396-10.567 3.348-21.456 11.698-29.806l21.054-21.055c5.521-5.521 14.182-6.199 20.584-1.731a152.482 152.482 0 0 1 20.522 17.197zM467.547 44.449c-59.261-59.262-155.69-59.27-214.96 0l-67.2 67.2c-.12.12-.25.25-.36.37-58.566 58.892-59.387 154.781.36 214.59a152.454 152.454 0 0 0 20.521 17.196c6.402 4.468 15.064 3.789 20.584-1.731l21.054-21.055c8.35-8.35 12.094-19.239 11.698-29.806a16.037 16.037 0 0 0-6.947-12.606c-2.912-2.005-6.64-4.875-10.341-8.569-28.073-28.073-28.191-73.639 0-101.83l67.2-67.19c28.239-28.239 74.3-28.069 102.325.51 27.75 28.3 26.872 73.934-1.155 101.96l-13.087 13.087c-4.35 4.35-5.769 10.79-3.783 16.612 5.864 17.194 9.042 34.999 9.69 52.721.509 13.906 17.454 20.446 27.294 10.606l37.106-37.106c59.271-59.259 59.271-155.699.001-214.959z"},child:[]}]})(a)}function OS(a){switch(a){case"admin":case"lockdown":case"lockdown-admin":return"text-amber-300";case"spectator":return"text-slate-400";default:return"text-sky-300"}}function Of(a){return!!a?.system}function BS(a){const l=new Date(a);return`${l.getHours().toString().padStart(2,"0")}:${l.getMinutes().toString().padStart(2,"0")}`}function gp(a){return a.nickname||a.socketId?.slice(0,6)||"unknown"}function zS({guildIconUrl:a,userAvatarUrl:l,label:i}){return!a&&!l?null:r.jsxs("span",{className:"flex h-4 w-4 overflow-hidden rounded-full border border-slate-700/80",title:i,children:[r.jsx("span",{className:`h-full w-1/2 bg-slate-700/70 ${a?"bg-cover":""}`,style:a?{backgroundImage:`url(${a})`,backgroundPosition:"left center",backgroundSize:"200% 100%"}:void 0}),r.jsx("span",{className:`h-full w-1/2 bg-slate-700/70 ${l?"bg-cover":""}`,style:l?{backgroundImage:`url(${l})`,backgroundPosition:"right center",backgroundSize:"200% 100%"}:void 0})]})}function Dx({message:a}){const l=a.fromDiscord?`${a.discordGuildName||"Discord"} · ${gp(a)}`:null,i=Of(a),o=i?"text-emerald-300":OS(a.role);return r.jsxs(r.Fragment,{children:[a.fromDiscord?r.jsxs(r.Fragment,{children:[r.jsx(Tx,{className:"h-3.5 w-3.5 text-indigo-200"}),r.jsx(zS,{guildIconUrl:a.discordGuildIconUrl,userAvatarUrl:a.discordUserAvatarUrl,label:l})]}):null,r.jsx("span",{className:`font-semibold text-[0.85rem] ${o}`,children:gp(a)}),i?r.jsx("span",{className:"rounded bg-emerald-900/60 px-1 text-[0.65rem] font-semibold uppercase tracking-wide text-emerald-200",children:"bot"}):null,a.roverId&&r.jsx("span",{className:"rounded bg-slate-800 px-1 text-[0.7rem]",children:a.roverId})]})}function _x(a){return Of(a)?"surface-muted relative flex flex-wrap items-start gap-0.5 border border-emerald-500/40 bg-emerald-900/15 text-sm":`surface-muted relative flex flex-wrap items-start gap-0.5 text-sm ${a.role==="admin"||a.role==="lockdown"||a.role==="lockdown-admin"?"border border-amber-400/30":a.fromDiscord?"border border-indigo-400/30 bg-indigo-900/20":""}`}function Ox({message:a}){const l=Of(a);return r.jsxs("div",{className:_x(a),children:[r.jsx(Dx,{message:a}),r.jsx("span",{className:`break-words leading-tight whitespace-pre-wrap ${l?"text-emerald-100":"text-slate-100"}`,children:a.text}),r.jsx("span",{className:"absolute bottom-0.5 right-1 text-[0.65rem] text-slate-400/60",children:BS(a.ts)})]})}function Bx({message:a}){return r.jsxs("div",{className:`${_x(a)} italic opacity-80 border-slate-600/40 bg-slate-900/40`,children:[r.jsx(Dx,{message:a}),r.jsx("span",{className:"text-slate-300",children:"typing..."})]})}const LS=3e3,US="#2196f3";function HS(a){return a.id?a.id:a.timestamp?`${a.timestamp}-${a.message}`:`${a.title||"alert"}-${a.message}`}function Bf({scale:a=1}){const{alerts:l}=Ve(),[i,o]=m.useState(()=>Date.now()),f=m.useMemo(()=>l.slice(-3).map(g=>({alert:g,key:HS(g)})),[l]);m.useEffect(()=>{if(!f.length)return;const g=setInterval(()=>o(Date.now()),200);return()=>clearInterval(g)},[f.length]);const d=f.map(g=>({...g,age:i-(g.alert.receivedAt??g.alert.timestamp??0)})).filter(g=>g.age<=LS);if(!d.length)return null;const h=a===1?void 0:{transform:`translateX(-50%) scale(${a})`,transformOrigin:"top center"},p=a===1?"pointer-events-none fixed top-0.5 left-1/2 z-50 flex -translate-x-1/2 flex-col gap-0.5":"pointer-events-none fixed top-0.5 left-1/2 z-50 flex flex-col gap-0.5";return r.jsx("div",{className:p,style:h,children:d.map(g=>r.jsx(VS,{alert:g.alert},g.key))})}function vp(a){const l=typeof a=="string"?a.trim():"",i=/^#?([0-9a-fA-F]{6})$/.exec(l);if(!i)return null;const o=i[1];return{r:parseInt(o.slice(0,2),16),g:parseInt(o.slice(2,4),16),b:parseInt(o.slice(4,6),16)}}function VS({alert:a}){if(a.kind==="chat"&&a.payload)return r.jsx(Ox,{message:a.payload});if(a.kind==="chat-typing"&&a.payload)return r.jsx(Bx,{message:a.payload});const l=vp(a.color)||vp(US),i=l?`rgba(${l.r}, ${l.g}, ${l.b}, 0.18)`:"rgba(33, 150, 243, 0.18)",o=l?`rgba(${l.r}, ${l.g}, ${l.b}, 0.45)`:"rgba(33, 150, 243, 0.45)";return r.jsx("div",{className:"pointer-events-auto max-w-[80vw] rounded-full border px-2 py-0.5 text-[0.7rem] leading-tight text-slate-100 shadow-sm shadow-black/30",style:{backgroundColor:i,border:`1px solid ${o}`},children:r.jsxs("p",{className:"truncate text-slate-100",children:[r.jsx("span",{className:"text-slate-300",children:a.title||"Alert"}),r.jsx("span",{className:"text-slate-500",children:" · "}),r.jsx("span",{className:"text-white",children:a.message})]})})}const Yl={main:[-127,127],side:[-127,127],vacuum:[0,127]},Lu={maxSpeed:500,baseSpeed:250,boostSpeed:400},df=100,zf=[31,127],Fl=60,mf=8,YS=250,$S=4e3,Uu=.4,GS=.8,XS={start:[128],safe:[131],full:[132],passive:[128],dock:[143]},ni={driveForward:["w"],driveBackward:["s"],driveLeft:["a"],driveRight:["d"],boostModifier:["\\"],slowModifier:["shift"],auxMainForward:["i"],auxMainReverse:["k"],auxSideForward:["o"],auxSideReverse:["l"],auxVacuumFast:["p"],auxVacuumSlow:[";"],auxAllForward:[","],cameraUp:["u"],cameraDown:["j"],nightVisionToggle:["e"],hornHonk:["h"],driveMacro:["f"],dockMacro:["g"],chatFocus:["enter"],songNoteUp:["ArrowUp"],songNoteDown:["ArrowDown"],homeAssistantOn:["ArrowRight"],homeAssistantOff:["ArrowLeft"]},zx=[{id:"drive-sequence",label:"Drive",description:"Start, dock, and full command sequence used by the drive button.",steps:[{type:"servo",angle:0},{type:"oi",command:"start"},{type:"pause",duration:df},{type:"oi",command:"dock"},{type:"pause",duration:df},{type:"oi",command:"full"},{type:"pause",duration:300},{type:"drive",speeds:{left:-300,right:-300}},{type:"pause",duration:600},{type:"drive",speeds:{left:0,right:0}}]},{id:"seek-dock",label:"Dock",description:"Send the seek dock command.",steps:[{type:"oi",command:"dock"}]}];function hf(){return{vector:{x:0,y:0,boost:!1},speeds:{left:0,right:0},source:null,lastUpdatedAt:0}}function pf(){return{main:0,side:0,vacuum:0}}function QS(){return{enabled:!1,angle:null,config:null}}function Qr(){return{note:Fl}}function ti(){return{active:!1,heat:0,overheated:!1}}const yp={roverId:null,mode:"drive",drive:hf(),aux:pf(),camera:QS(),song:Qr(),horn:ti(),lastControlIntentAt:0,macros:zx,keymap:ni,inputs:{}};function KS(a,l){switch(l.type){case"control/set-rover":return{...a,roverId:l.payload??null,drive:l.payload?a.drive:hf(),aux:l.payload?a.aux:pf(),song:l.payload?a.song:Qr(),horn:l.payload?a.horn:ti(),lastControlIntentAt:l.payload?a.lastControlIntentAt:0};case"control/set-mode":return a.mode===l.payload?a:{...a,mode:l.payload==="dock"?"dock":"drive"};case"control/update-drive":{const{vector:i,speeds:o,source:f}=l.payload;return{...a,drive:{vector:i??a.drive.vector,speeds:o??a.drive.speeds,source:f??a.drive.source,lastUpdatedAt:Date.now()}}}case"control/set-aux-motors":return{...a,aux:{...a.aux,...l.payload}};case"control/set-camera-config":return{...a,camera:{...a.camera,enabled:!!l.payload?.config,config:l.payload?.config??null,angle:typeof l.payload?.angle=="number"?l.payload.angle:l.payload?.config?l.payload.config.homeAngle??a.camera.angle:null}};case"control/set-camera-angle":return{...a,camera:{...a.camera,angle:l.payload}};case"control/register-input-state":{const i=l.payload?.source||"unknown";return{...a,inputs:{...a.inputs,[i]:{...a.inputs[i]??{},...l.payload?.state,updatedAt:Date.now()}}}}case"control/set-keymap":return{...a,keymap:{...a.keymap,...l.payload??{}}};case"control/set-macros":return{...a,macros:Array.isArray(l.payload)?l.payload:a.macros};case"control/reset":return{...a,drive:hf(),aux:pf(),song:Qr(),horn:ti(),lastControlIntentAt:0};case"control/set-horn-active":return{...a,horn:{...a.horn||ti(),active:!!l.payload}};case"control/set-horn-heat":return{...a,horn:{...a.horn||ti(),heat:typeof l.payload?.heat=="number"?l.payload.heat:0,overheated:!!l.payload?.overheated}};case"control/record-intent":return{...a,lastControlIntentAt:Date.now()};case"control/set-song-note":return{...a,song:{...a.song||Qr(),note:l.payload??Fl}};default:return a}}function Zl(a,l,i){return typeof a!="number"||Number.isNaN(a)?l:Math.max(l,Math.min(i,a))}function Jl(a){return typeof a!="number"||Number.isNaN(a)?0:Math.max(-1,Math.min(1,a))}function tn(a,l){return!Array.isArray(l)||l.length!==2?a:Zl(a,l[0],l[1])}function FS(a={}){const l=Jl(a.x??0),i=Jl(a.y??0);return{x:l,y:i,boost:!!a.boost}}function ZS(a={},l={}){const i=FS(a),o=typeof l.maxSpeed=="number"?l.maxSpeed:Lu.maxSpeed,f=typeof l.baseSpeed=="number"?l.baseSpeed:Lu.baseSpeed,d=typeof l.boostSpeed=="number"?l.boostSpeed:Lu.boostSpeed,h=i.boost?d:f,p=i.y*h,g=i.x*h;return{vector:i,speeds:{left:Zl(Math.round(p+g),-o,o),right:Zl(Math.round(p-g),-o,o)}}}function JS(a){const l=Array.isArray(a)?a:[],i=String.fromCharCode(...l);if(typeof btoa=="function")return btoa(i);if(typeof Buffer<"u")return Buffer.from(l).toString("base64");throw new Error("No base64 encoder available")}function bp(a){return new Promise(l=>setTimeout(l,a))}function IS(a={}){const{driveTransform:l,auxTransform:i}=a,o=En(),{session:f}=Ve(),d=f?.assignment?.roverId,h=m.useMemo(()=>!d||!Array.isArray(f?.roster)?null:f.roster.find(L=>String(L.id)===String(d))||null,[d,f?.roster]),p=m.useMemo(()=>!h?.cameraServo||!h.cameraServo.enabled?null:h.cameraServo,[h]),g=m.useMemo(()=>!h?.nightVision||!h.nightVision.enabled?null:h.nightVision,[h]),v=m.useMemo(()=>!h?.horn||!h.horn.enabled?null:h.horn,[h]),y=m.useMemo(()=>h?.nightVision?.state??null,[h]),b=m.useCallback((L,$)=>{d&&o.emit("command",{roverId:d,...L},$)},[o,d]),j=m.useCallback(()=>{d&&b({type:"sensorStream",data:{sensorStream:{enable:!0}}})},[b,d]),M=m.useCallback(L=>{if(!d)return null;const $={left:tn(L?.left??0,[-500,500]),right:tn(L?.right??0,[-500,500])},O=l?l($):$,V={left:tn(O?.left??0,[-500,500]),right:tn(O?.right??0,[-500,500])};return b({type:"drive",data:{driveDirect:V}}),V},[l,b,d]),w=m.useCallback(({main:L=0,side:$=0,vacuum:O=0}={})=>{if(!d)return null;const V={main:tn(L,Yl.main),side:tn($,Yl.side),vacuum:tn(O,Yl.vacuum)},X=i?i(V):V,Z={main:tn(X?.main??0,Yl.main),side:tn(X?.side??0,Yl.side),vacuum:tn(X?.vacuum??0,Yl.vacuum)};return b({type:"motors",data:{motorPwm:Z}}),Z},[i,b,d]),q=m.useCallback(L=>!d||!p?null:(b({type:"servo",data:{servo:{angle:L}}}),L),[b,d,p]),N=m.useCallback(L=>{if(!d)return!1;const $=Array.isArray(L)?L:typeof L=="string"?XS[L]:null;return $?(b({type:"raw",data:{raw:JS($)}}),j(),!0):!1},[b,j,d]),E=m.useCallback(async L=>{if(!(!L||!Array.isArray(L.steps)||!d))for(const $ of L.steps){if(!d)break;switch($.type){case"oi":N($.command);break;case"drive":M($.speeds??{left:0,right:0});break;case"motors":w($.values??{});break;case"servo":q($.angle);break;case"pause":await bp($.duration??df);break}if($.delay||$.delayMs){const O=$.delayMs??$.delay;typeof O=="number"&&O>0&&await bp(O)}}},[d,N,M,w,q]),S=m.useCallback((L="toggle")=>!d||!g?null:(b({type:"nightVision",data:{nightVision:{action:L}}}),L),[b,g,d]),T=m.useCallback(L=>d?(b({type:"horn",data:{horn:L}}),L):null,[b,d]),z=m.useCallback((L=[],$={})=>{if(!d)return null;const V=(Array.isArray(L)&&L.length>0?L:[{note:Fl,duration:mf}]).slice(0,16).map(X=>({note:tn(Math.round(X?.note??Fl),zf),duration:tn(Math.round(X?.duration??mf),[1,255])}));return b({type:"song",data:{song:{notes:V,slot:$.slot,loop:$.loop}}}),V},[b,d]);return m.useMemo(()=>({roverId:d,rosterEntry:h,servoConfig:p,nightVision:g,nightVisionState:y,horn:v,emitCommand:b,enableSensorStream:j,sendDriveDirect:M,sendAuxMotors:w,sendServoAngle:q,sendOiCommand:N,sendNightVision:S,sendHorn:T,sendSong:z,runMacroSteps:E}),[d,h,p,g,y,v,b,j,M,w,q,N,S,T,E])}const WS={"{":"[","}":"]",":":";",'"':"'","<":",",">":".","?":"/","|":"\\",_:"-","+":"="},Sp={"[":"BracketLeft","]":"BracketRight","\\":"Backslash",";":"Semicolon","'":"Quote",",":"Comma",".":"Period","/":"Slash","-":"Minus","=":"Equal","`":"Backquote"};function xi(a){if(typeof a!="string")return"";const l=a.toLowerCase();return WS[l]??l}function PS(a){const l=xi(a);if(!l)return null;if(Sp[l])return Sp[l];if(l.length===1){if(/[a-z]/.test(l))return`Key${l.toUpperCase()}`;if(/[0-9]/.test(l))return`Digit${l}`}return null}function Lx(a){const l=xi(a);return l?`key:${l}`:null}function eA(a){const l=PS(a);return l?`code:${l}`:null}function Ap(a){const l=new Set,i=Lx(a?.key??"");i&&l.add(i);const o=a?.code?`code:${a.code}`:null;return o&&l.add(o),Array.from(l)}function tA(a={}){return Object.fromEntries(Object.entries(a).map(([l,i])=>{const o=Array.isArray(i)?i:[i],f=new Set;return o.forEach(d=>{const h=Lx(String(d));h&&f.add(h);const p=eA(String(d));p&&f.add(p)}),[l,f]}))}function An(a){const l=xi(a);return l?l===" "?"Space":l==="\\"?"Backslash":l==="`"?"Backtick":l==="["?"[ or {":l==="]"?"] or }":l===";"?"; or :":l==="'"?`' or "`:l===","?", or <":l==="."?". or >":l==="/"?"/ or ?":l==="-"?"- or _":l==="="?"= or +":l==="arrowup"?"Arrow Up":l==="arrowdown"?"Arrow Down":l==="arrowleft"?"Arrow Left":l==="arrowright"?"Arrow Right":l.length===1?l.toUpperCase():l:"—"}const Sn={keyboard:{baseSpeed:250,turboSpeed:400,precisionSpeed:125,tiltSpeed:90,tiltIntervalMs:110}},Fn={label:"Default",calibration:{driveDeadzone:.18,cameraDeadzone:.08,auxDeadzone:.05,driveCurve:"linear",cameraCurve:"linear",auxCurve:"linear",cameraMode:"absolute",cameraSensitivity:60,auxSideScale:.55},bindings:{drive:{kind:"axisPair",sources:[{kind:"axisPair",x:0,y:1,invertX:!1,invertY:!0}]},cameraTilt:{kind:"axis",sources:[{kind:"axis",index:3,invert:!0},{kind:"axis",index:1,invert:!0}]},mainBrush:{kind:"axis",sources:[{kind:"buttonAxis",index:6},{kind:"axis",index:2,invert:!1}]},sideBrush:{kind:"axis",sources:[{kind:"buttonAxis",index:7},{kind:"axis",index:5,invert:!1}]},vacuum:{kind:"button",sources:[{kind:"button",index:0}]},allAux:{kind:"button",sources:[{kind:"button",index:1}]},mainReverse:{kind:"button",sources:[{kind:"button",index:4}]},sideReverse:{kind:"button",sources:[{kind:"button",index:5}]},driveMacro:{kind:"button",sources:[{kind:"button",index:2}]},dockMacro:{kind:"button",sources:[{kind:"button",index:3}]},nightVisionToggle:{kind:"button",sources:[{kind:"button",index:9}]}}},ja={activeSignature:null,profiles:{},defaults:{profile:Fn}},Ja={waveform:"saw",freqs:[440,550,660,0]},jt={masterVolume:1,alertVolume:.5,roverVolume:1,mainBrushDuckEnabled:!0,mainBrushDuckAmount:.75},Ql=[{key:"drive",motors:["leftWheel","rightWheel"]},{key:"aux",motors:["mainBrush","sideBrush"]}],nA={downRatePerSec:.15,upRatePerSec:.7,releaseDelaySec:1,outputRateMs:250};function jp(){return Ql.reduce((a,l)=>(a[l.key]={cap:1,clearSec:0},a),{})}function Np(a){return Number.isFinite(a)?Math.max(0,Math.min(1,a)):0}function aA(a,l={}){const{session:i}=Ve(),d=(es(a)?.sensors||{})?.wheelOvercurrents||{},h=m.useMemo(()=>({...nA,...l.config||{}}),[l.config]),[p,g]=m.useState(()=>jp()),v=m.useRef(typeof performance<"u"?performance.now():Date.now()),y=m.useRef(d);m.useEffect(()=>{y.current=d||{}},[d]),m.useEffect(()=>{g(jp())},[a]),m.useEffect(()=>{const w=setInterval(()=>{const q=typeof performance<"u"?performance.now():Date.now(),N=Math.max(0,q-v.current);v.current=q;const E=N/1e3;E<=0||g(S=>{let T=!1;const z={},L=Number.isFinite(h.downRatePerSec)?Math.max(0,h.downRatePerSec):0,$=Number.isFinite(h.upRatePerSec)?Math.max(0,h.upRatePerSec):0,O=Number.isFinite(h.releaseDelaySec)?Math.max(0,h.releaseDelaySec):0;return Ql.forEach(V=>{const X=S[V.key]||{cap:1,clearSec:0},Z=Number.isFinite(X.cap)?X.cap:1,F=Number.isFinite(X.clearSec)?X.clearSec:0,ae=V.motors.some(k=>!!y.current?.[k]),oe=ae?0:F+E,me=!ae&&oe>=O,G=Np(ae?Z-L*E:me?Z+$*E:Z);(Math.abs(G-Z)>1e-4||Math.abs(oe-F)>1e-4)&&(T=!0),z[V.key]={cap:G,clearSec:oe}}),T?z:S})},100);return()=>clearInterval(w)},[h.downRatePerSec,h.releaseDelaySec,h.upRatePerSec]);const b=m.useMemo(()=>{const w=Ql.reduce((q,N)=>{const E=p?.[N.key],S=Number.isFinite(E?.cap)?E.cap:1;return q[N.key]=Np(S),q},{});return{perGroup:w,drive:{left:w.drive??1,right:w.drive??1},aux:{main:w.aux??1,side:w.aux??1,vacuum:1}}},[p]),j=m.useMemo(()=>{const w={};Ql.forEach(N=>{N.motors.forEach(E=>{w[E]=!!d?.[E]})});const q=Ql.reduce((N,E)=>(N[E.key]=E.motors.some(S=>!!d?.[S]),N),{});return{motors:w,groups:q}},[d]),M=i?.role==="admin"||i?.role==="lockdown"||i?.role==="lockdown-admin";return m.useMemo(()=>({caps:p,overcurrent:j,scales:b,isActive:(b?.drive?.left??1)<1||(b?.drive?.right??1)<1||(b?.aux?.main??1)<1||(b?.aux?.side??1)<1,config:h,adminImmune:M}),[p,j,b,h,M])}function lA(a={},l,i=!1){if(i||!l?.drive)return a;const o=typeof l.drive.left=="number"?l.drive.left:1,f=typeof l.drive.right=="number"?l.drive.right:1;return o>=.999&&f>=.999?a:{left:Math.round((a.left??0)*o),right:Math.round((a.right??0)*f)}}function sA(a={},l,i=!1){if(i||!l?.aux)return a;const o=typeof l.aux.main=="number"?l.aux.main:1,f=typeof l.aux.side=="number"?l.aux.side:1,d=typeof l.aux.vacuum=="number"?l.aux.vacuum:1;return o>=.999&&f>=.999&&d>=.999?a:{main:Math.round((a.main??0)*o),side:Math.round((a.side??0)*f),vacuum:Math.round((a.vacuum??0)*d)}}const Ux=m.createContext(null);function wp(a){return Object.fromEntries(Object.entries(a||{}).map(([l,i])=>[l,Array.isArray(i)?[...i]:[]]))}function iA(a,l){if(!a)return l;const i=typeof a.minAngle=="number"?a.minAngle:-45,o=typeof a.maxAngle=="number"?a.maxAngle:45;return Zl(l,i,o)}function rA({children:a}){const[l,i]=m.useReducer(KS,yp),o=m.useRef(null),f=m.useRef(!1),d=m.useRef(yp.camera.angle),h=m.useRef(null),p=m.useRef(0),g=m.useRef(0),{value:v,save:y}=st("controls",{keymap:ni,macros:zx}),{value:b}=st("horn",Ja),{session:j,homeAssistantSetState:M}=Ve(),w=j?.assignment?.roverId??null,q=aA(w),N=m.useCallback(ne=>lA(ne,q.scales,q.adminImmune),[q.adminImmune,q.scales]),E=m.useCallback(ne=>sA(ne,q.scales,q.adminImmune),[q.adminImmune,q.scales]),S=IS({driveTransform:N,auxTransform:E}),T=m.useCallback(()=>{const se=(j?.homeAssistant?.entities||[]).filter(Se=>(Se.type==="light"||Se.type==="switch")&&Se.available!==!1&&Se.state!=="on");if(se.length===0){f.current=!1;return}f.current=!0,se.forEach(Se=>{M(Se.id,"on").catch(()=>{})}),f.current=!1},[j?.homeAssistant?.entities,M]);m.useEffect(()=>{i({type:"control/set-rover",payload:S.roverId})},[S.roverId]),m.useEffect(()=>{const ne=o.current;o.current=l.mode,ne!=="drive"&&l.mode==="drive"&&j?.homeAssistant?.entities?T():ne!=="drive"&&l.mode==="drive"&&(f.current=!0)},[l.mode,j?.homeAssistant?.entities,T]),m.useEffect(()=>{f.current&&j?.homeAssistant?.entities&&T()},[j?.homeAssistant?.entities,T]),m.useEffect(()=>{const ne={...ni,...v?.keymap||{}};i({type:"control/set-keymap",payload:ne}),v?.macros&&i({type:"control/set-macros",payload:v.macros})},[v?.keymap,v?.macros]),m.useEffect(()=>{const ne=S.servoConfig;if(!ne){i({type:"control/set-camera-config",payload:{config:null}}),d.current=null;return}const se=typeof ne.minAngle=="number"?ne.minAngle:-45,Se=typeof ne.maxAngle=="number"?ne.maxAngle:45,Oe=typeof ne.homeAngle=="number"?ne.homeAngle:(se+Se)/2,Ne=typeof d.current=="number"?Zl(d.current,se,Se):null,ze=Ne??Zl(Oe,se,Se);i({type:"control/set-camera-config",payload:{config:ne,angle:ze}}),d.current=ze},[S.servoConfig]),m.useEffect(()=>{d.current=typeof l.camera.angle=="number"?l.camera.angle:d.current},[l.camera.angle]),m.useEffect(()=>{S.roverId&&S.enableSensorStream()},[S.roverId,S.enableSensorStream]);const z=m.useCallback(ne=>{i({type:"control/set-mode",payload:ne})},[]),L=m.useCallback(()=>{i({type:"control/record-intent"})},[]),$=m.useRef(l.drive.speeds),O=m.useRef(l.aux),V=m.useMemo(()=>JSON.stringify(q.scales),[q.scales]),X=m.useRef(0),Z=m.useRef(0);m.useEffect(()=>{$.current=l.drive.speeds},[l.drive.speeds]),m.useEffect(()=>{O.current=l.aux},[l.aux]),m.useEffect(()=>{if(!S.roverId||q.adminImmune||!q.isActive)return;const ne=Math.max(0,Number(q?.config?.outputRateMs)||0),se=typeof performance<"u"?performance.now():Date.now(),Se=$.current||{left:0,right:0},Oe=O.current||{main:0,side:0,vacuum:0},Ne=!!(Se.left||Se.right),ze=!!(Oe.main||Oe.side||Oe.vacuum);!Ne&&!ze||(Ne&&se-X.current>=ne&&(X.current=se,S.sendDriveDirect(Se)),ze&&se-Z.current>=ne&&(Z.current=se,S.sendAuxMotors(Oe)))},[V,q.adminImmune,q.config,q.isActive,S]);const F=m.useCallback((ne,se={})=>{const Se=ZS(ne,se.speedOptions);i({type:"control/update-drive",payload:{...Se,source:se.source??null}}),L(),S.sendDriveDirect(Se.speeds)},[S,L]),ae=m.useCallback((ne={})=>{const se=S.sendAuxMotors(ne)??ne;i({type:"control/set-aux-motors",payload:se}),L()},[S,L]),oe=m.useCallback((ne,se)=>{if(!ne)return!1;const Se=xi(se);if(!Se)return!1;const Oe=wp(l.keymap);return Oe[ne]=[Se],i({type:"control/set-keymap",payload:Oe}),y(Ne=>({...Ne??{},keymap:Oe})),!0},[l.keymap,y]),me=m.useCallback(()=>{const ne=wp(ni);i({type:"control/set-keymap",payload:ne}),y(se=>({...se??{},keymap:ne}))},[y]),G=m.useCallback(ne=>{if(!S.servoConfig)return;const se=iA(S.servoConfig,ne);i({type:"control/set-camera-angle",payload:se}),S.sendServoAngle(se),d.current=se,L()},[S,L]),k=m.useCallback((ne=0)=>{const se=S.servoConfig;if(!se)return;const Se=typeof ne=="number"&&ne!==0?ne:se.nudgeDegrees||1,Oe=typeof d.current=="number"?d.current:typeof se.homeAngle=="number"?se.homeAngle:0;G(Oe+Se)},[S.servoConfig,G]),Q=m.useCallback(()=>{const ne=S.servoConfig;if(!ne)return;const se=typeof ne.homeAngle=="number"?ne.homeAngle:typeof ne.minAngle=="number"&&typeof ne.maxAngle=="number"?(ne.minAngle+ne.maxAngle)/2:0;G(se)},[S.servoConfig,G]),P=m.useCallback(async ne=>{const se=l.macros.find(Se=>Se.id===ne)||null;se&&(ne==="drive-sequence"?(T(),j?.homeAssistant?.entities||(f.current=!0),L()):ne==="seek-dock"&&L(),await S.runMacroSteps(se))},[S,L,j?.homeAssistant?.entities,l.macros,T]),re=m.useCallback(()=>{i({type:"control/update-drive",payload:{vector:{x:0,y:0,boost:!1},speeds:{left:0,right:0},source:"system-stop"}}),S.sendDriveDirect({left:0,right:0}),S.sendAuxMotors({main:0,side:0,vacuum:0})},[S]),ce=m.useCallback(ne=>{S.sendOiCommand(ne)},[S]),C=m.useCallback(ne=>{S.roverId&&S.emitCommand({type:"sensorStream",data:{sensorStream:{enable:ne}}})},[S]),_=m.useCallback(ne=>{if(S.nightVision){if(typeof ne=="boolean"){const se=ne?"off":"on";S.sendNightVision(se)}else S.sendNightVision("toggle");L()}},[S,L]),W=m.useCallback(()=>{_()},[_]),te=m.useCallback(ne=>{const se=typeof ne=="number"?ne:Fl;return i({type:"control/set-song-note",payload:se}),se},[]),le=m.useCallback((ne,se)=>S.sendSong(ne,se),[S]),ie=m.useMemo(()=>{const ne=b??Ja,se=ne.waveform==="sine"?"sine":"saw",Oe=[...Array.isArray(ne.freqs)?ne.freqs:Ja.freqs,0,0,0,0].slice(0,4).map(Ne=>{const ze=Number(Ne);return Number.isFinite(ze)?ze<=0?0:Math.min(5e3,Math.round(ze)):0});return{waveform:se,freqs:Oe}},[b]),ue=m.useCallback(()=>{if(!S.horn)return;if(l.horn?.overheated||(l.horn?.heat??0)>=1||l.horn?.active)return!1;const ne=Date.now();return S.sendHorn({action:"start",...ie}),i({type:"control/set-horn-active",payload:!0}),p.current=ne,g.current=ne,h.current&&(clearTimeout(h.current),h.current=null),h.current=setTimeout(()=>{ve()},$S),L(),!0},[i,ie,S,L,l.horn?.active,l.horn?.heat,l.horn?.overheated]),ve=m.useCallback(()=>{if(!S.horn)return;S.sendHorn({action:"stop"}),i({type:"control/set-horn-active",payload:!1}),h.current&&(clearTimeout(h.current),h.current=null);const ne=Date.now(),se=p.current||ne,Se=Math.max(0,ne-se);if(p.current=0,Se>0){const Oe=l.horn?.heat??0,Ne=Se/1e3*Uu;let ze=Math.max(0,Math.min(1,Oe+Ne)),an=l.horn?.overheated??!1;ze>=1&&(ze=1,an=!0),i({type:"control/set-horn-heat",payload:{heat:ze,overheated:an}})}},[i,S,l.horn?.heat,l.horn?.overheated,Uu]);m.useEffect(()=>{const se=setInterval(()=>{const Se=Date.now(),Oe=g.current||Se;g.current=Se;const Ne=Math.min(1e3,Math.max(0,Se-Oe))/1e3,ze=l.horn?.heat??0,an=!!l.horn?.active,wa=!!l.horn?.overheated,Wn=Ne*(an?Uu:-.2);let it=Math.max(0,Math.min(1,ze+Wn)),ln=wa;it>=1?(it=1,ln=!0,an&&ve()):ln&&it<=GS&&(ln=!1),(it!==ze||ln!==wa)&&i({type:"control/set-horn-heat",payload:{heat:it,overheated:ln}})},100);return()=>clearInterval(se)},[i,l.horn?.active,l.horn?.heat,l.horn?.overheated,ve]);const he=m.useCallback((ne,se)=>{i({type:"control/register-input-state",payload:{source:ne,state:se}})},[]),Ce=m.useMemo(()=>({state:l,dispatch:i,pipeline:S,overcurrentLimiter:q,actions:{setMode:z,setDriveVector:F,setAuxMotors:ae,setServoAngle:G,nudgeServo:k,goServoHome:Q,runMacro:P,stopAllMotion:re,sendOiCommand:ce,setSensorStream:C,setNightVision:_,toggleNightVision:W,updateKeyBinding:oe,resetKeyBindings:me,registerInputState:he,setSongNote:te,sendSong:le,startHorn:ue,stopHorn:ve}}),[l,S,q,z,F,ae,G,k,Q,P,re,ce,C,_,W,oe,me,he,te,le,ue,ve]);return r.jsx(Ux.Provider,{value:Ce,children:a})}function Dt(){const a=m.useContext(Ux);if(!a)throw new Error("useControlSystem must be used within ControlSystemProvider");return a}const oA="data:audio/mpeg;base64,//uQxAAAAAAAAAAAAAAAAAAAAAAAWGluZwAAAA8AAAANAAAIpQBKSkpKSkpKXFxcXFxcXFxra2tra2tra3p6enp6enqJiYmJiYmJiZiYmJiYmJiYpqampqamprW1tbW1tbW1xMTExMTExMTT09PT09PT4uLi4uLi4uLx8fHx8fHx8f////////8AAABQTEFNRTMuMTAwBLkAAAAAAAAAABUgJAUYQQAB4AAACKVpqtMZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//ugxAAAwqQPR8CIwCh0BCj5jDwlIAAjW87wAACcOsAKPMk8ARj8w9OAWwNlV/gCgQMHEhAOVnFaNzWWAPI2zyjHjd8FAoKqyAa88AAAAABNjEd9CQOglIY9dtC+a51bGZrZgTewD3c+AAYx5hxIMheIcudKAyaykG1/h5EsPB0iTEFNRTMuMTAwqqqqqqrIBZqvAAAAAC9JXFIAHrCgAp0D0hUYOInIluqg1TNdKCzMeAAFQCKKsxUmVfireKILLBgSVgb4qBVtPWpMQU1FMy4xMDCqqqqqqqqqqqqqqqqpApm/AAAAAC7QYaHPHoCjkCysmc+QY9NNWRbKE+mqowNobwAAoSQQMLGChDlOrKMqVMC/6xy/CXbFaL7AZUxBTUUzLjEwMFVVVVVVVVVVVacDqZ8AAAAAMgzaYFBPNgIOnVCQfFfwmBBhLVNJQSdxdQRofwAGxF9xAAYs4AZDuE87li0YCASIBwaCiXUj+2BqTEFNRTMuMTAwqqqqqqqqlwOonwAAAAAtkABQSEZ1INNDgx8HeaaLCXiu5dqSciylQNXjv8GdmACQ5ogYKbnsmxkoChog+w9IhU6GsgzCIQBSxFpMQQAAMBiHjgAAAAv6FQQILmJmGLltnax9HszIVEAoEq1p8olpcPLlGpXFastuWosKNFlmlqADJbwAEFRI4iJJy0oDumUW//sgxOEAw5wfU8fnAGBvg6n5nDxUh7QuwcEzkK5Ztz7AZUxBTUUzLjEwMFVVVVVVVZUAhd8AAAAALZAAamQMWKtC7Avib0WLplt2IAp0SKV0pFFxCADLX6AIPFrWJIBQqPGW/x0QDTRLGaQYCRAZzKeoU6uqTEFN6AB3n/7wAAAxq//7EMT0AMPUHU/MawJgc4PpuYy8VQZjocBw2OgQQyQyECnbABEUC/ZoM0J56Jm0tqzNJaq8KospqUAQ5/QBghnCqQAhR4Mz1D1gJPstYsI1sYIg079I5cYjY6pMQU1FMy4xMDCqqqqq//sQxPUAw+AdT8zvAih6hCk5nWBFqqqWAFOf4AAAAEAIQZPkMcwUzFVE51cSBjIHpJRIEIjWgGar9VhgCUvwAFAUMk0RCpMkwXjPQDcoLBU+n5RuR4ZrPQLPckxBTUUzLjEwMKqqqqr/+xDE9oDEAB1NzG8CKIGEKPmd5EWqxgBWn9AAAAAKIiC5GcLJIczCEvNbWsF31jo4Bw0rXktvJF5YRyABlj+ABIQ2RGsHgdc0XsPntoEDUzaQOjTBqblFPUE1TEFNRckAt68AAAAALv/7EMT4AMQIHU3M7wIojwUo+Y2MZfAgKcwITAQIYN1TosJeLtDA0ubWNrFSADJoln4AC0hVaLiIIUChs+4HST4BgCpQHITPMBQkEnj73ORZfylh+sRLEGUiNIpMQU1FMy4xMDCqqqqq//sQxP6AxlgtK+13Yih3hCj5neBNqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqrIkT7UNAZ7NS7yMqcihSKLMn8DlKYq8ZdPCVEoJBuWqkxBTUUzLjEwMKqqqqr/+xDE+ADEXCVHzGjDIIQEqLm9PIWqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqv/7EMT+AMWoL0XNcwJoiASoeY3gVaqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq//sQxPgAxHAnRcxvAmiBBKj5jehEqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqr/+xDE+IDEmCVDzPMCKH6EqLmNYE2qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqv/7EMT9gEPgI0vMZwQgvYWlPY5gFaqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq//sQxOYDw+gpIIfgwWgAADSAAAAEqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqo=",Hx=m.createContext({messages:[],typing:[],sendMessage:async()=>{},focusChat:()=>{},blurChat:()=>{},registerInputRef:()=>{},onInputFocus:()=>{},onInputBlur:()=>{},setTypingActive:()=>{},isChatFocused:!1});function cA({children:a}){const l=En(),{session:i,pushAlert:o}=Ve(),{value:f}=st("audio",jt),[d,h]=m.useState([]),[p,g]=m.useState([]),[v,y]=m.useState(!1),b=m.useRef(null),j=m.useRef(null),M=m.useRef(null),w=m.useRef(new Map),q=m.useRef(new Map),N=m.useRef({isTyping:!1,lastSent:0}),E=Number.isFinite(f?.masterVolume)?f.masterVolume:jt.masterVolume,S=Number.isFinite(f?.alertVolume)?f.alertVolume:jt.alertVolume,T=Math.max(0,Math.min(1,E*S)),z=m.useCallback(()=>{const G=Array.from(w.current.values()).sort((k,Q)=>k.lastUpdate-Q.lastUpdate).map(k=>k.payload);g(G)},[]),L=m.useCallback(G=>!G||typeof G!="object"?null:G.typingId?G.typingId:G.fromDiscord?`discord:${G.discordUserId||G.discordUserName||G.nickname||"unknown"}`:`socket:${G.socketId||G.nickname||"unknown"}`,[]);m.useEffect(()=>{M.current=new Audio(oA),M.current.volume=T,M.current.load()},[T]);const $=m.useCallback(()=>{const G=M.current;G&&(G.volume=T,G.currentTime=0,G.play().catch(()=>{}))},[T]);m.useEffect(()=>{function G(k={}){h(Q=>[...Q.slice(-99),k]),!(k?.socketId&&i?.socketId&&k.socketId===i.socketId)&&($(),o?.({kind:"chat",payload:k,id:`chat-${k.id||Math.random().toString(36).slice(2)}`,receivedAt:Date.now()}))}return l.on("chat:message",G),()=>{l.off("chat:message",G)}},[$,i?.socketId,l]),m.useEffect(()=>{function G(k={}){const Q=L(k);if(!Q)return;const P=Date.now();if(k?.socketId&&i?.socketId&&k.socketId===i.socketId){k.isTyping||(w.current.delete(Q),z());return}if(k.isTyping){w.current.set(Q,{payload:k,expiresAt:P+6e3,lastUpdate:P});const re=q.current.get(Q)||0;P-re>=2500&&(q.current.set(Q,P),o?.({kind:"chat-typing",payload:k,id:`chat-typing-${Q}-${k.id||Math.random().toString(36).slice(2)}`,receivedAt:P}))}else w.current.delete(Q);z()}return l.on("chat:typing",G),()=>{l.off("chat:typing",G)}},[o,z,L,i?.socketId,l]),m.useEffect(()=>{const G=setInterval(()=>{const k=Date.now();let Q=!1;w.current.forEach((P,re)=>{P.expiresAt<=k&&(w.current.delete(re),Q=!0)}),Q&&z()},2e3);return()=>clearInterval(G)},[z]),m.useEffect(()=>{function G(k=[]){Array.isArray(k)&&h(Q=>{if(Q.length===0)return k.slice(-100);const P=new Set(k.map(ce=>ce?.id));return[...k,...Q.filter(ce=>ce?.id&&!P.has(ce.id))].slice(-100)})}return l.on("chat:init",G),()=>{l.off("chat:init",G)}},[l]);const O=m.useCallback(G=>{const k=!!G,Q=Date.now(),P=N.current,re=!k&&P.isTyping;!(k&&(!P.isTyping||Q-P.lastSent>=3500))&&!re||(N.current={isTyping:k,lastSent:Q},l.emit("chat:typing",{isTyping:k}))},[l]),V=m.useCallback((G,k=null)=>new Promise((Q,P)=>{l.emit("chat:send",{text:G,tts:k},(re={})=>{re.error?P(new Error(re.error)):Q(re)})}),[l]),X=m.useCallback((G,k={})=>{(k?.target==="hud"?"hud":"panel")==="hud"?j.current=G:b.current=G},[]),Z=m.useCallback(()=>{y(!0),(j.current||b.current)?.focus()},[]),F=m.useCallback(()=>{y(!1),j.current?.blur(),b.current?.blur()},[]),ae=m.useCallback(()=>y(!0),[]),oe=m.useCallback(()=>y(!1),[]),me=m.useMemo(()=>({messages:d,sendMessage:V,focusChat:Z,blurChat:F,registerInputRef:X,onInputFocus:ae,onInputBlur:oe,setTypingActive:O,typing:p,isChatFocused:v,selfSocketId:i?.socketId||null}),[F,Z,v,d,oe,ae,X,V,i?.socketId,O,p]);return r.jsx(Hx.Provider,{value:me,children:a})}function Lf(){const a=m.useContext(Hx);if(!a)throw new Error("useChat must be used inside ChatProvider");return a}const uA=new Set(["","text","search","email","password","url","tel","number","date","datetime-local","month","time","week"]);function Vx(a){if(!a||a.nodeType!==1)return!1;const l=a.tagName;if(l==="TEXTAREA"||a.isContentEditable)return!0;if(l!=="INPUT")return!1;const i=a.type?a.type.toLowerCase():"";return uA.has(i)}function fA(){return typeof document>"u"?!1:Vx(document.activeElement)}const Hu="keyboard",Vu={x:0,y:0,boost:!1},Yu={main:0,side:0,vacuum:0},Ep=zf[0],Cp=zf[1],Uf=5,si=500,ii=1,Hf=100;function $u(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(0,Math.min(500,i)):l}function dA(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(Uf,Math.min(si,i)):l}function Yx(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(ii,Math.min(Hf,i)):l}function mA(a){const i=(Yx(a,a)-ii)/(Hf-ii),o=si-i*(si-Uf);return Math.round(o)}function hA(a){const l=dA(a,a),i=(si-l)/(si-Uf),o=ii+i*(Hf-ii);return Math.round(o)}function pA(a){return Vx(a?.target)}function lt(a,l){if(!a||a.size===0)return!1;for(const i of l)if(a.has(i))return!0;return!1}function xA(a,l){const i=lt(l.driveForward,a),o=lt(l.driveBackward,a),f=lt(l.driveLeft,a),d=lt(l.driveRight,a),h=lt(l.boostModifier,a),p=lt(l.slowModifier,a);let g=0;i&&!o?g=1:o&&!i&&(g=-1);let v=0;f&&!d?v=-1:d&&!f&&(v=1);const y=p?.4:1;return{x:v*y,y:g*y,boost:h&&!p}}function gA(a,l){if(lt(l.auxAllForward,a))return{main:127,side:127,vacuum:127};const o=lt(l.auxMainForward,a)?127:lt(l.auxMainReverse,a)?-127:0,f=lt(l.auxSideForward,a)?127:lt(l.auxSideReverse,a)?-70:0,d=lt(l.auxVacuumFast,a)?127:lt(l.auxVacuumSlow,a)?50:0;return{main:o,side:f,vacuum:d}}function vA(){const{state:a,actions:{setMode:l,setDriveVector:i,setAuxMotors:o,nudgeServo:f,runMacro:d,stopAllMotion:h,registerInputState:p,toggleNightVision:g,startHorn:v,stopHorn:y,setSongNote:b,sendSong:j}}=Dt(),{session:M,homeAssistantSetState:w}=Ve(),{focusChat:q,blurChat:N,isChatFocused:E}=Lf(),{value:S}=st("inputs",Sn),T=m.useMemo(()=>tA(a.keymap),[a.keymap]),z=m.useMemo(()=>{const le=new Set;return Object.values(T).forEach(ie=>{ie&&ie.forEach(ue=>le.add(ue))}),le},[T]),L=m.useMemo(()=>{const le=Sn.keyboard,ie=S?.keyboard??{};return{baseSpeed:$u(ie.baseSpeed,le.baseSpeed),turboSpeed:$u(ie.turboSpeed,le.turboSpeed),precisionSpeed:$u(ie.precisionSpeed,le.precisionSpeed)}},[S?.keyboard]),$=m.useMemo(()=>{const le=Sn.keyboard,ie=S?.keyboard??{},ue=Yx(typeof ie.tiltSpeed=="number"?ie.tiltSpeed:typeof ie.tiltIntervalMs=="number"?hA(ie.tiltIntervalMs):le.tiltSpeed,le.tiltSpeed);return mA(ue)},[S?.keyboard]),O=m.useMemo(()=>Math.abs(a.camera?.config?.nudgeDegrees||1),[a.camera?.config?.nudgeDegrees]),V=m.useRef(new Set),X=m.useRef(Vu),Z=m.useRef(Yu),F=m.useRef(null),ae=m.useRef(null),oe=m.useRef(!1),me=m.useCallback(()=>{const le=new Set(V.current);lt(T.boostModifier,le);const ue=lt(T.slowModifier,le)?{baseSpeed:L.precisionSpeed,boostSpeed:L.precisionSpeed}:{baseSpeed:L.baseSpeed,boostSpeed:L.turboSpeed},ve=xA(le,T),he=gA(le,T);(ve.x!==X.current.x||ve.y!==X.current.y||ve.boost!==X.current.boost)&&(X.current=ve,i(ve,{source:Hu,speedOptions:ue})),(he.main!==Z.current.main||he.side!==Z.current.side||he.vacuum!==Z.current.vacuum)&&(Z.current=he,o(he)),p(Hu,{keys:Array.from(le),vector:ve,aux:he})},[T,L,p,o,i]),G=m.useCallback(()=>{F.current&&(clearTimeout(F.current),F.current=null)},[]),k=m.useCallback(()=>{const le=new Set(V.current),ie=lt(T.cameraUp,le),ue=lt(T.cameraDown,le);return(ie?1:0)-(ue?1:0)},[T]),Q=m.useCallback(()=>{if(k()===0){G();return}if(F.current)return;const ie=()=>{const ue=k();if(ue===0){G();return}f(ue*O),F.current=setTimeout(ie,$)};F.current=setTimeout(ie,0)},[k,f,$,O,G]),P=m.useCallback(()=>{ae.current&&(clearTimeout(ae.current),ae.current=null)},[]),re=m.useCallback(()=>{const le=new Set(V.current),ie=lt(T.songNoteUp,le),ue=lt(T.songNoteDown,le);return(ie?1:0)-(ue?1:0)},[T]),ce=m.useCallback(le=>{if(le===0)return;let ue=(typeof a.song?.note=="number"?a.song.note:Fl)+le;ue>Cp?ue=Ep:ue<Ep&&(ue=Cp);const ve=b(ue);j([{note:ve,duration:mf}],{slot:0})},[j,b,a.song?.note]),C=m.useCallback(()=>{if(re()===0){P();return}if(ae.current)return;const ie=()=>{const ue=re();if(ue===0){P();return}ce(ue),ae.current=setTimeout(ie,YS)};ae.current=setTimeout(ie,0)},[re,P,ce]),_=m.useCallback(()=>{V.current.clear(),X.current=Vu,Z.current=Yu,G(),P(),oe.current&&(oe.current=!1,y()),h(),p(Hu,{keys:[],vector:Vu,aux:Yu})},[p,h,y,G,P]),W=m.useCallback(le=>{const ie=M?.homeAssistant;if(!ie?.enabled||!ie?.connected)return;const ve=(ie.entities||[]).filter(he=>(he.type==="light"||he.type==="switch")&&he.available!==!1&&he.state!=="unavailable");if(ve.length!==0){if(le==="on"){const he=ve.find(Ce=>Ce.state!=="on");he&&w(he.id,"on").catch(()=>{});return}if(le==="off")for(let he=ve.length-1;he>=0;he-=1){const Ce=ve[he];if(Ce.state==="on"){w(Ce.id,"off").catch(()=>{});break}}}},[w,M?.homeAssistant]);m.useEffect(()=>{function le(ve){if(pA(ve))return;const he=Ap(ve);if(he.length===0)return;const Ce=new Set(he);if(lt(T.chatFocus,Ce)){ve.preventDefault(),_(),E||q();return}he.some(se=>z.has(se))&&ve.preventDefault();const ne=he.filter(se=>!V.current.has(se));if(ne.forEach(se=>V.current.add(se)),ne.length>0)if(ne.some(se=>T.driveMacro?.has(se)))l("drive"),d("drive-sequence");else if(ne.some(se=>T.dockMacro?.has(se)))l("dock"),d("seek-dock");else if(ne.some(se=>T.nightVisionToggle?.has(se)))g();else if(ne.some(se=>T.hornHonk?.has(se))){if(!oe.current){const se=v();oe.current=!!se}}else ne.some(se=>T.homeAssistantOn?.has(se))?W("on"):ne.some(se=>T.homeAssistantOff?.has(se))&&W("off");Q(),C(),me()}function ie(ve){Ap(ve).forEach(Ce=>V.current.delete(Ce)),oe.current&&!lt(T.hornHonk,V.current)&&(oe.current=!1,y()),Q(),C(),me()}function ue(){_()}return window.addEventListener("keydown",le,{capture:!0}),window.addEventListener("keyup",ie,{capture:!0}),window.addEventListener("blur",ue),()=>{window.removeEventListener("keydown",le,{capture:!0}),window.removeEventListener("keyup",ie,{capture:!0}),window.removeEventListener("blur",ue)}},[z,N,me,Q,C,q,E,T.chatFocus,T.dockMacro,T.driveMacro,T.hornHonk,_,d,l,h,P,v,y,W]);const te=m.useRef(_);return m.useEffect(()=>{te.current=_},[_]),m.useEffect(()=>{te.current()},[a.roverId]),m.useEffect(()=>{oe.current=!!a.horn?.active},[a.horn?.active]),m.useEffect(()=>()=>{G(),P()},[G,P]),null}const yA=1.6;function $x(a){if(!a)return"unknown::none::0::0";const l=a.id||"unknown",i=a.mapping||"none",o=Array.isArray(a.axes)?a.axes.length:0,f=Array.isArray(a.buttons)?a.buttons.length:0;return`${l}::${i}::${o}::${f}`}function bA(a){return JSON.parse(JSON.stringify(a??{}))}function Gx(a,l){const i=bA(l);return i.meta={id:a?.id??"Unknown",mapping:a?.mapping??"none",axes:a?.axes?.length??0,buttons:a?.buttons?.length??0},i}function Za(a){return Number.isFinite(a)?Math.max(-1,Math.min(1,a)):0}function Ws(a,l){if(!a)return 0;const i=Math.abs(a);return l==="expo"?Math.sign(a)*Math.pow(i,yA):a}function Gu(a,l){const i=Math.abs(a);if(i<=l)return 0;const o=(i-l)/(1-l);return Math.sign(a)*o}function SA(a,l,i){const o=Math.hypot(a,l);if(o<=i)return{x:0,y:0};const d=(o-i)/(1-i)/o;return{x:a*d,y:l*d}}function Wr(a,l){if(!a||!Array.isArray(a.axes))return null;const i=a.axes[l];return Number.isFinite(i)?Za(i):null}function xf(a,l){if(!a||!Array.isArray(a.buttons))return null;const i=a.buttons[l];if(!i)return null;const o=typeof i.value=="number"?i.value:i.pressed?1:0;return{pressed:!!(i.pressed||o>.5),value:Math.max(0,Math.min(1,o))}}function Xu(a,l=[]){for(const i of l)if(i){if(i.kind==="axis"){const o=Wr(a,i.index);if(o===null)continue;return{value:i.invert?-o:o,source:i}}if(i.kind==="buttonAxis"){const o=xf(a,i.index);if(!o)continue;return{value:Za(o.value),source:i}}}return{value:0,source:null}}function AA(a,l=[]){for(const i of l){if(!i||i.kind!=="axisPair")continue;const o=Wr(a,i.x),f=Wr(a,i.y);if(o===null||f===null)continue;const d=i.invertX?-o:o,h=i.invertY?-f:f;return{x:d,y:h,source:i}}return{x:0,y:0,source:null}}function Qa(a,l=[]){for(const i of l)if(i){if(i.kind==="button"){const o=xf(a,i.index);if(!o)continue;return{pressed:o.pressed,source:i}}if(i.kind==="axisButton"){const o=Wr(a,i.index);if(o===null)continue;const f=i.direction||1,d=typeof i.threshold=="number"?i.threshold:.6;return{pressed:o*f>d,source:i}}if(i.kind==="buttonAxis"){const o=xf(a,i.index);if(!o)continue;return{pressed:o.value>.5,source:i}}}return{pressed:!1,source:null}}function Xx(a,l){const i=l?.bindings??{},o=l?.calibration??{},f=i.drive??{},d=AA(a,f.sources);let h=Za(d.x),p=Za(d.y);const g=Math.min(Math.max(o.driveDeadzone??.18,0),.8),v=SA(h,p,g);h=Ws(v.x,o.driveCurve),p=Ws(v.y,o.driveCurve);const y=i.cameraTilt??{},b=Xu(a,y.sources),j=Math.min(Math.max(o.cameraDeadzone??.08,0),.8);let M=Gu(Za(b.value),j);M=Ws(M,o.cameraCurve);const w=Math.min(Math.max(o.auxDeadzone??.05,0),.6),q=i.mainBrush??{},N=Xu(a,q.sources);let E=Gu(Za(N.value),w);E=Ws(E,o.auxCurve);const S=i.sideBrush??{},T=Xu(a,S.sources);let z=Gu(Za(T.value),w);z=Ws(z,o.auxCurve);const L=Qa(a,i.vacuum?.sources),$=Qa(a,i.allAux?.sources),O=Qa(a,i.mainReverse?.sources),V=Qa(a,i.sideReverse?.sources),X=Qa(a,i.driveMacro?.sources),Z=Qa(a,i.dockMacro?.sources),F=Qa(a,i.nightVisionToggle?.sources);return{driveVector:{x:h,y:p,boost:!1},cameraAxis:M,auxAxis:{main:E,side:z},buttons:{vacuum:L.pressed,allAux:$.pressed,mainReverse:O.pressed,sideReverse:V.pressed,driveMacro:X.pressed,dockMacro:Z.pressed,nightVisionToggle:F.pressed},sources:{drive:d.source,cameraTilt:b.source,mainBrush:N.source,sideBrush:T.source,vacuum:L.source,allAux:$.source,mainReverse:O.source,sideReverse:V.source,driveMacro:X.source,dockMacro:Z.source,nightVisionToggle:F.source}}}const Kr=new Set;let Kl=null,Pr={pads:[],timestamp:0};function jA(){if(typeof navigator>"u"||!navigator.getGamepads)return[];const a=navigator.getGamepads();return a?Array.from(a).filter(Boolean):[]}function NA(a){return{index:a.index,id:a.id,mapping:a.mapping,connected:a.connected!==!1,timestamp:a.timestamp,axes:Array.from(a.axes??[]),buttons:(a.buttons??[]).map(l=>({pressed:!!l?.pressed,value:typeof l?.value=="number"?l.value:l?.pressed?1:0})),signature:$x(a)}}function wA(){Pr={pads:jA().map(NA),timestamp:typeof performance<"u"?performance.now():Date.now()},Kr.forEach(l=>l(Pr))}function Qx(){wA(),Kl=requestAnimationFrame(Qx)}function EA(){Kl||(Kl=requestAnimationFrame(Qx))}function CA(){Kl&&(cancelAnimationFrame(Kl),Kl=null)}function Kx(a){return Kr.add(a),EA(),a(Pr),()=>{Kr.delete(a),Kr.size===0&&CA()}}function qA(){const[a,l]=m.useState(Pr);return m.useEffect(()=>Kx(l),[]),a}const $l="gamepad",Ka={x:0,y:0,boost:!1},Fa={main:0,side:0,vacuum:0},MA=100,kA=100;function Qu(a,l){return a&&l&&a.x===l.x&&a.y===l.y&&a.boost===l.boost}function Ku(a,l){return a&&l&&a.main===l.main&&a.side===l.side&&a.vacuum===l.vacuum}function RA(a){return a?Math.hypot(a.x||0,a.y||0):0}function TA(a){return a?!a.main&&!a.side&&!a.vacuum:!0}function DA(a,l){if(!a||a.length===0)return null;if(l){const i=a.find(o=>o.signature===l);if(i)return i}return a[0]}function _A(){const{state:a,actions:{setMode:l,setDriveVector:i,setAuxMotors:o,setServoAngle:f,runMacro:d,toggleNightVision:h,registerInputState:p}}=Dt(),{value:g,save:v}=st("gamepad",ja),y=m.useRef(new Set),b=m.useRef(Ka),j=m.useRef(Fa),M=m.useRef({main:!1,side:!1}),w=m.useRef(new Map),q=m.useRef(0),N=m.useRef(0),E=m.useRef(0),S=m.useRef(null),T=m.useCallback(O=>{const V=O.signature??$x(O);g?.profiles?.[V]||y.current.has(V)||(y.current.add(V),v(X=>{const Z=X??ja;if(Z.profiles?.[V])return Z;const F=Z?.defaults?.profile??Fn,ae=Gx(O,F);return{...Z,profiles:{...Z.profiles??{},[V]:ae}}}))},[g?.profiles,v]),z=m.useCallback((O,V)=>{const X=w.current.get(O)||!1;return w.current.set(O,V),V&&!X},[]),L=m.useCallback((O,V)=>{const X=a.camera?.config;if(!X)return;const Z=typeof performance<"u"?performance.now():Date.now(),F=V?.cameraMode??"absolute",ae=Math.max(1,Math.min(180,V?.cameraSensitivity??60));if(F==="velocity"){const Q=Math.min(50,Z-E.current||16),P=O*ae*(Q/1e3);if(Math.abs(P)<.01)return;const ce=(typeof S.current=="number"?S.current:typeof a.camera?.angle=="number"?a.camera.angle:typeof X.homeAngle=="number"?X.homeAngle:0)+P;f(ce),S.current=ce,E.current=Z;return}const oe=typeof X.minAngle=="number"?X.minAngle:-45,me=typeof X.maxAngle=="number"?X.maxAngle:45,G=typeof X.homeAngle=="number"?X.homeAngle:(oe+me)/2,k=O<0?G+O*(G-oe):G+O*(me-G);typeof S.current=="number"&&Math.abs(S.current-k)<.35&&Z-E.current<80||(E.current=Z,S.current=k,f(k))},[f,a.camera?.angle,a.camera?.config]),$=m.useMemo(()=>g?.activeSignature??null,[g?.activeSignature]);return m.useEffect(()=>Kx(O=>{const V=DA(O.pads,$);if(!V){Qu(b.current,Ka)||(b.current=Ka,i(Ka,{source:$l})),Ku(j.current,Fa)||(j.current=Fa,o(Fa)),w.current=new Map,M.current={main:!1,side:!1},q.current=0,N.current=0,p($l,{connected:!1});return}if(fA()){Qu(b.current,Ka)||(b.current=Ka,i(Ka,{source:$l})),Ku(j.current,Fa)||(j.current=Fa,o(Fa)),w.current=new Map,M.current={main:!1,side:!1},p($l,{connected:!0,blocked:!0});return}T(V);const X=V.signature,Z=g?.profiles?.[X]??g?.defaults?.profile??Fn,F=Xx(V,Z);if(!Qu(F.driveVector,b.current)){const P=typeof performance<"u"?performance.now():Date.now();(RA(F.driveVector)<.02||P-q.current>=MA)&&(b.current=F.driveVector,q.current=P,i(F.driveVector,{source:$l}))}const ae=Z.calibration?.auxSideScale??.55,oe=Math.round(Math.min(Math.abs(F.auxAxis.main),1)*127),me=Math.round(Math.min(Math.abs(F.auxAxis.side),1)*127),G=M.current.main?-oe:oe,k=M.current.side?-Math.round(me*ae):Math.round(me*ae);let Q={main:F.auxAxis.main!==0?G:0,side:F.auxAxis.side!==0?k:0,vacuum:F.buttons.vacuum?127:0};if(F.buttons.allAux&&(Q={main:127,side:127,vacuum:127}),!Ku(Q,j.current)){const P=typeof performance<"u"?performance.now():Date.now();(TA(Q)||P-N.current>=kA)&&(j.current=Q,N.current=P,o(Q))}F.buttons.mainReverse&&z("mainReverse",!0)?M.current.main=!M.current.main:F.buttons.mainReverse||z("mainReverse",!1),F.buttons.sideReverse&&z("sideReverse",!0)?M.current.side=!M.current.side:F.buttons.sideReverse||z("sideReverse",!1),F.buttons.driveMacro&&z("driveMacro",!0)?(l("drive"),d("drive-sequence")):F.buttons.driveMacro||z("driveMacro",!1),F.buttons.dockMacro&&z("dockMacro",!0)?(l("dock"),d("seek-dock")):F.buttons.dockMacro||z("dockMacro",!1),F.buttons.nightVisionToggle&&z("nightVisionToggle",!0)?h():F.buttons.nightVisionToggle||z("nightVisionToggle",!1),Math.abs(F.cameraAxis)>.001&&L(F.cameraAxis,Z.calibration),p($l,{connected:!0,signature:X,id:V.id,index:V.index,axes:V.axes,buttons:V.buttons,drive:F.driveVector,aux:Q,cameraAxis:F.cameraAxis,bindings:F.sources})}),[$,T,g?.defaults?.profile,g?.profiles,z,L,p,d,o,i,l,h]),null}function Fx(a){const l=a?.sensors||{},i=l.oiMode?.label||"Unknown",o=i.toLowerCase(),f=l.chargingState?.label||"",d=!!l.chargingSources?.homeBase,h=d&&f.toLowerCase()!=="not charging"&&f!=="";return{driving:o==="full",docked:d,charging:h,dockedNotCharging:d&&!h,dockingInProgress:!d&&!h&&o==="passive",oiLabel:i,chargingLabel:f}}function Zx(a){const l=es(a);return m.useMemo(()=>Fx(l),[l])}function Gl({label:a,value:l,tone:i="neutral"}){const o=i==="good"?"border-emerald-200 bg-emerald-600 text-white":i==="warn"?"border-amber-200 bg-amber-600 text-white":i==="bad"?"border-red-200 bg-red-600 text-white":"border-slate-200/30 bg-slate-700 text-slate-100";return r.jsx("div",{className:`flex flex-1 flex-col items-center justify-center rounded-lg border px-0.75 py-0.5 text-center ${o}`,children:r.jsx("span",{className:"text-base font-semibold md:text-lg",children:l})})}function qp({label:a}){return a?r.jsx("span",{className:"rounded border border-white/40 px-1 text-[0.7rem] text-white",children:a}):null}function Fu({label:a,tone:l}){const i=l==="emerald"?"border-emerald-200/70 bg-emerald-600/70 text-emerald-50":l==="amber"?"border-amber-200/70 bg-amber-600/70 text-amber-50":"border-indigo-200/70 bg-indigo-600/70 text-indigo-50";return r.jsx("span",{className:`rounded-full border px-0.5 py-0.15 text-[0.7rem] font-semibold ${i}`,children:a})}function OA({instructions:a,onConfirm:l,onCancel:i,pending:o}){return r.jsx("div",{className:"fixed inset-0 z-40 flex items-center justify-center bg-black/70 p-1",children:r.jsxs("div",{className:"surface w-full max-w-md space-y-0.5 border border-indigo-700 bg-indigo-950/90 p-1 text-slate-100 shadow-2xl",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("p",{className:"text-lg font-semibold text-indigo-50",children:"Dock Rover"}),r.jsx("p",{className:"text-sm text-slate-200",children:a.summary}),r.jsx(gf,{steps:a.steps,tone:"indigo"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-0.5 text-sm",children:[r.jsx("button",{type:"button",onClick:i,className:"bg-slate-700 px-0.5 py-1 font-semibold text-slate-100 transition hover:bg-slate-600",children:"Cancel"}),r.jsx("button",{type:"button",disabled:o,onClick:l,className:"bg-indigo-600 px-0.5 py-1 font-semibold text-indigo-50 transition hover:bg-indigo-500 disabled:opacity-50",children:o?"Docking…":"Confirm Dock"})]})]})})}function Jx({layout:a="desktop",expand:l=!1,fill:i=!1,driveDockState:o,compactHeightClass:f=""}){const d=a==="mobile",{state:{roverId:h,keymap:p},actions:g}=Dt(),v=es(h),y=o??Fx(v),{driving:b,docked:j,charging:M,dockingInProgress:w}=y,[q,N]=m.useState(null),[E,S]=m.useState(!1),[T,z]=m.useState(!1),L=!h||q!==null,$=!h||q!==null,O=An(p?.driveMacro?.[0]),V=An(p?.dockMacro?.[0]),X={summary:"You are about to trigger an automatic docking attempt! To have a successful dock:",steps:["Line up the rover straight in front of the dock","Make sure the rover is about one foot or half a meter away from the dock","Press Confirm Dock to begin the docking process"]},Z="Click this button to initate auto-dock.",F={summary:"You must enable driving mode before you can move the rover.",steps:["Press the keybind or tap this button to enable driving mode","Once ready (should be instant), this dialog will change, and you will be able to move"]},ae=j?"Docked":"Undocked",oe=j?"good":"bad",me=M?"Charging":j?"Charging in 5s":"—",G=M?"good":j?"warn":"bad",k=async()=>{if(!(!h||q)){N("drive");try{g.setMode("drive"),await g.runMacro("drive-sequence")}catch(Ne){alert(Ne.message)}finally{N(null)}}},Q=async()=>{if(!(!h||q)){S(!1),z(!1),N("drive");try{g.setMode("drive"),await g.runMacro("drive-sequence")}catch(Ne){alert(Ne.message)}finally{N(null)}}},P=async()=>{if(!(!h||q)){N("dock");try{g.setMode("dock"),await g.runMacro("seek-dock")}catch(Ne){alert(Ne.message)}finally{N(null),S(!1),z(!1)}}},re=()=>{$||(z(!0),S(!0))},ce="flex w-full flex-col gap-0.5 overflow-hidden rounded-xl border-2 px-0.75 py-0.75 text-slate-100 shadow-md transition hover:-translate-y-0.5 hover:shadow-xl focus-visible:outline-none focus-visible:ring-2 disabled:cursor-not-allowed disabled:opacity-60 select-none no-touch-select",C="text-center",_="items-center justify-between",W="items-center justify-center",te=d?"text-sm font-semibold":"",le="border-emerald-300/70 bg-emerald-800 text-emerald-50 hover:bg-emerald-700 focus-visible:ring-emerald-300",ie="border-amber-300/70 bg-amber-900 text-amber-50 hover:bg-amber-800 focus-visible:ring-amber-300",ue="border-indigo-300/70 bg-indigo-900 text-indigo-50 hover:bg-indigo-800 focus-visible:ring-indigo-300",ve="border-amber-300/70 bg-amber-900 text-amber-50 hover:bg-amber-800 focus-visible:ring-amber-300",Ce=l||w,ne=Ce?"h-full flex-1":i?"flex-1":"",se=d&&!Ce?f:"",Se=d&&!Ce?W:_,Oe=d&&!Ce&&b&&j;if(!b&&!w)return r.jsxs("button",{type:"button",onClick:Q,onContextMenu:Ne=>Ne.preventDefault(),disabled:L,className:`${ce} ${ne} ${se} ${C} ${Se} ${te} ${le}`,children:[r.jsxs("div",{className:"space-y-0.5 w-full",children:[r.jsxs("div",{className:"flex w-full flex-col items-center gap-0.25",children:[r.jsx("span",{className:"text-base font-semibold text-emerald-50 md:text-lg",children:"Start Driving"}),!d&&Ce?r.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-0.5",children:[O?r.jsx(qp,{label:O}):null,r.jsx(Fu,{label:"Click to start",tone:"emerald"})]}):null]}),Ce?r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"text-sm text-emerald-50/90",children:F.summary}),r.jsx(gf,{steps:F.steps,tone:"emerald"})]}):null]}),Ce?r.jsxs("div",{className:"flex w-full flex-1 flex-col gap-0.5 self-stretch",children:[r.jsx(Gl,{label:"Dock",value:ae,tone:oe}),r.jsx(Gl,{label:"Charge",value:me,tone:G})]}):null]});if(w){const Ne={summary:"If the rover is failing to dock, click to drive and try again.",steps:["The rover should be slowly wiggling towards the dock","If it is obviously not working, press this button to enter driving mode and try again"]};return r.jsxs("button",{type:"button",disabled:L,onClick:k,onContextMenu:ze=>ze.preventDefault(),className:`${ce} ${ne} ${se} ${C} ${Se} ${te} ${ie}`,children:[r.jsxs("div",{className:"space-y-0.5 w-full",children:[r.jsxs("div",{className:"flex w-full flex-col items-center gap-0.25",children:[r.jsx("span",{className:"text-base font-semibold text-amber-50 md:text-lg",children:"Docking in Progress"}),Ce?r.jsx("div",{className:"flex flex-wrap items-center justify-center gap-0.5",children:r.jsx(Fu,{label:"Return to driving mode",tone:"emerald"})}):null]}),Ce?r.jsx("p",{className:"text-sm text-amber-50/90",children:Ne.summary}):null]}),Ce?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex w-full flex-1 flex-col gap-0.5 self-stretch",children:[r.jsx(Gl,{label:"Dock",value:ae,tone:oe}),r.jsx(Gl,{label:"Charge",value:me,tone:G})]}),d?null:r.jsx(gf,{steps:Ne.steps,tone:"amber"})]}):null]})}return r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",disabled:$,onClick:re,onContextMenu:Ne=>Ne.preventDefault(),className:d?`flex w-full ${ce} ${se} ${C} ${Se} ${te} ${Oe?ve:ue}`:`${ce} ${ne} ${C} ${_} ${te} ${ue}`,children:[r.jsxs("div",{className:"flex w-full flex-col items-center gap-0.25",children:[r.jsx("span",{className:"text-base font-semibold text-indigo-50 md:text-lg",children:Oe?"Docked!":"Dock and Charge"}),!d&&Ce?r.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-0.5",children:[V?r.jsx(qp,{label:V}):null,r.jsx(Fu,{label:"Click to begin docking",tone:"indigo"})]}):null]}),!d&&Ce&&r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"text-sm text-indigo-50/90",children:Z}),r.jsxs("div",{className:"flex w-full flex-1 flex-col gap-0.5 self-stretch",children:[r.jsx(Gl,{label:"Dock",value:ae,tone:oe}),r.jsx(Gl,{label:"Charge",value:me,tone:G})]}),r.jsx("div",{className:"text-xs text-indigo-100/80",children:"Line up straight, about 1 foot away, before docking."})]})]}),T||!d&&E?r.jsx(OA,{instructions:X,pending:q==="dock",onCancel:()=>{z(!1),S(!1)},onConfirm:P}):null]})}function gf({steps:a,tone:l="emerald"}){const i=l==="emerald"?"bg-emerald-900/60 text-emerald-50/90 border-emerald-700/60":l==="amber"?"bg-amber-900/60 text-amber-50/90 border-amber-700/60":"bg-indigo-900/60 text-indigo-50/90 border-indigo-700/60",o=l==="emerald"?"text-emerald-200":l==="amber"?"text-amber-200":"text-indigo-200";return r.jsx("div",{className:`space-y-0.5 rounded border px-0.5 py-0.35 text-left ${i}`,children:a.map((f,d)=>r.jsxs("div",{className:"text-[0.85rem] leading-snug break-words",children:[r.jsxs("div",{className:"flex items-start",children:[r.jsxs("span",{className:`mr-0 align-top text-[0.75rem] font-semibold ${o}`,children:[d+1,"."]}),r.jsx("span",{className:"align-top",children:f})]}),d<a.length-1?r.jsx("div",{className:"mt-0 h-px bg-white/10"}):null]},f))})}function Zu(a){return typeof a=="boolean"}function Ix({nightVisionOn:a,disabled:l,onToggle:i,keyLabel:o,className:f="",heightClass:d=""}){const[h,p]=m.useState(Zu(a)?a:null);m.useEffect(()=>{Zu(a)&&p(a)},[a]);const g=Zu(h),v=g?h:!1,y=g?v?"On":"Off":"—",b=v?"bg-emerald-500 text-emerald-950":"bg-slate-700 text-slate-200",j=()=>{if(l)return;const w=g?!v:!0;p(w),i?.(w)},M=m.useMemo(()=>["group flex w-full flex-col items-center justify-center gap-0.35 rounded-xl border-2 px-1 py-0.75 text-center select-none no-touch-select",v?"border-emerald-300/70 bg-emerald-800 text-emerald-50 hover:bg-emerald-700":"border-amber-300/70 bg-amber-900 text-amber-50 hover:bg-amber-800","disabled:opacity-50",d,f].filter(Boolean).join(" "),[f,v,d]);return r.jsxs("button",{type:"button",onClick:j,onContextMenu:w=>w.preventDefault(),disabled:l,"aria-pressed":v,className:M,children:[r.jsxs("span",{className:"flex items-center gap-0.5",children:[r.jsx("span",{className:"text-sm font-semibold",children:"Night Vision"}),o?r.jsx("span",{className:"rounded bg-slate-800 px-1 py-0.5 text-[0.6rem] font-semibold text-slate-200",children:o}):null]}),r.jsx("span",{className:`rounded px-1 py-0.5 text-[0.7rem] font-semibold ${b}`,children:y})]})}function Ju(a){const l=Number(a);return!Number.isFinite(l)||l<=0?0:Math.min(5e3,Math.round(l))}function Wx({disabled:a,onStart:l,onStop:i,keyLabel:o,active:f,heat:d=0,className:h="",defaultShowSettings:p=!0,showSettingsToggle:g=!1,compactSettings:v=!1}){const[y,b]=m.useState(!1),[j,M]=m.useState(p),{value:w,save:q}=st("horn",Ja),[N,E]=m.useState(w?.waveform||Ja.waveform),[S,T]=m.useState(()=>[...Array.isArray(w?.freqs)?w.freqs:Ja.freqs,0,0,0,0].slice(0,4).map(k=>Ju(k)));m.useEffect(()=>{E(w?.waveform||Ja.waveform),Array.isArray(w?.freqs)&&T([...w.freqs,0,0,0,0].slice(0,4).map(G=>Ju(G)))},[w?.freqs,w?.waveform]);const z=!!f,L=Math.max(0,Math.min(1,Number(d)||0)),$=m.useMemo(()=>["group relative flex w-full flex-col gap-0.5 overflow-hidden rounded-xl border-2 px-1 py-1.5 text-xs font-semibold select-none no-touch-select",z?"border-fuchsia-300/70 bg-fuchsia-700 text-fuchsia-50":"border-cyan-300/70 bg-cyan-900 text-cyan-50 hover:bg-cyan-800","disabled:opacity-50",h].filter(Boolean).join(" "),[h,z]),O=()=>{a||y||(b(!0),l?.())},V=()=>{y&&(b(!1),i?.())};m.useEffect(()=>{!z&&y&&b(!1)},[z,y]);const X=N==="sine"?"sine":"saw",Z=m.useCallback(G=>{const k=G.target.value==="sine"?"sine":"saw";E(k),q(Q=>({...Q??{},waveform:k}))},[q]),F=m.useCallback((G,k)=>{T(Q=>{const P=[...Q];return P[G]=Ju(k),q(re=>({...re??{},freqs:P})),P})},[q]),ae=G=>{if(a)return;const k=G.target?.tagName?.toLowerCase();k==="input"||k==="select"||k==="option"||k==="label"||k==="button"||(G.preventDefault(),O())},oe=G=>{const k=G.target?.tagName?.toLowerCase();k==="input"||k==="select"||k==="option"||k==="label"||k==="button"||(G.preventDefault(),V())},me=g?r.jsx("button",{type:"button",onClick:G=>{G.preventDefault(),M(k=>!k)},className:"rounded bg-black/40 px-1 py-0.5 text-[0.6rem] font-semibold text-white/90 hover:text-white",children:j?"Hide":"Settings"}):null;return r.jsxs("div",{role:"button",tabIndex:0,"aria-pressed":y,onPointerDown:ae,onPointerUp:oe,onPointerLeave:V,onPointerCancel:V,onContextMenu:G=>G.preventDefault(),onBlur:V,className:$,children:[r.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-70",style:{background:`linear-gradient(90deg, rgba(14,116,144,0.7) ${L*100}%, rgba(0,0,0,0) ${L*100}%)`}}),r.jsx("div",{className:`pointer-events-none absolute inset-0 transition-opacity ${z?"opacity-40":"opacity-0"}`,style:{background:"linear-gradient(90deg, rgba(217,70,239,0.75), rgba(244,114,182,0.35))"}}),r.jsxs("div",{className:"relative z-10 flex items-center justify-between gap-0.5",children:[r.jsxs("span",{className:"flex items-center gap-0.5 text-sm font-semibold",children:[r.jsx("span",{children:"Horn"}),o?r.jsx("span",{className:"rounded bg-black/40 px-1 py-0.5 text-[0.6rem] font-semibold text-white",children:o}):null]}),me,r.jsx("span",{className:`rounded px-1 py-0.5 text-[0.65rem] font-semibold ${z?"bg-fuchsia-200 text-fuchsia-900":"bg-slate-800 text-slate-200"}`,children:z?"Honk":"Hold"})]}),j?v?r.jsxs("div",{className:"relative z-10 flex flex-col gap-0.5 text-[0.65rem]",children:[r.jsxs("label",{className:"flex items-center justify-between gap-0.5 text-slate-200",children:[r.jsx("span",{className:"text-slate-300",children:"Wave"}),r.jsxs("select",{value:X,onChange:Z,className:"rounded border border-slate-700 bg-slate-900 px-1 py-[2px] text-[0.65rem] text-slate-100",children:[r.jsx("option",{value:"saw",children:"Saw"}),r.jsx("option",{value:"sine",children:"Sine"})]})]}),r.jsx("div",{className:"grid grid-cols-2 gap-0.5",children:S.map((G,k)=>r.jsxs("label",{className:"flex items-center gap-0.5 text-slate-200",children:[r.jsx("span",{className:"text-[0.6rem] text-slate-400",children:k+1}),r.jsx("input",{type:"number",min:0,max:5e3,step:1,value:G,onChange:Q=>F(k,Q.target.value),className:"w-full rounded border border-slate-700 bg-slate-900 px-1 py-[2px] text-right text-[0.65rem] font-mono text-slate-100"})]},`horn-freq-${k}`))})]}):r.jsxs("div",{className:"relative z-10 grid grid-cols-[minmax(0,1.2fr)_repeat(4,minmax(0,1fr))] items-center gap-0.5 text-[0.65rem]",children:[r.jsxs("label",{className:"flex items-center gap-0.5 text-slate-200",children:[r.jsx("span",{className:"text-slate-300",children:"Wave"}),r.jsxs("select",{value:X,onChange:Z,className:"rounded border border-slate-700 bg-slate-900 px-1 py-[2px] text-[0.65rem] text-slate-100",children:[r.jsx("option",{value:"saw",children:"Saw"}),r.jsx("option",{value:"sine",children:"Sine"})]})]}),S.map((G,k)=>r.jsxs("label",{className:"flex items-center gap-0.5 text-slate-200",children:[r.jsx("span",{className:"text-[0.6rem] text-slate-400",children:k+1}),r.jsx("input",{type:"number",min:0,max:5e3,step:1,value:G,onChange:Q=>F(k,Q.target.value),className:"w-full rounded border border-slate-700 bg-slate-900 px-1 py-[2px] text-right text-[0.65rem] font-mono text-slate-100"})]},`horn-freq-${k}`))]}):null]})}function Br(a){return typeof a!="number"||Number.isNaN(a)?"—":`${a>0?"+":""}${a.toFixed(1)}°`}function Mp({label:a}){return a?r.jsx("span",{className:"rounded border border-white/40 px-1 text-[0.7rem] text-white",children:a}):null}function Px({value:a,min:l,max:i,step:o=.5,label:f="Camera Tilt",orientation:d="horizontal",onChange:h,onCommit:p,throttleMs:g=0,disabled:v=!1,keyDownLabel:y,keyUpLabel:b,className:j="",labelRowClass:M="",labelClass:w="",valueClass:q="",sliderClass:N="",endpointClass:E="",endpointLabelClass:S="",accentClass:T="",showValue:z=!0,showEndpoints:L}){const $=d==="vertical",V=typeof L=="boolean"?L:!$,[X,Z]=m.useState(a),F=m.useRef(!1),ae=m.useRef(null);m.useEffect(()=>{F.current||Z(a)},[a]),m.useEffect(()=>()=>{ae.current&&clearTimeout(ae.current)},[]);const oe=P=>{if(h){if(g>0){ae.current&&clearTimeout(ae.current),ae.current=setTimeout(()=>{h(P)},g);return}h(P)}},me=P=>{const re=Number.parseFloat(P.target.value);Number.isNaN(re)||(F.current=!0,Z(re),oe(re))},G=()=>{F.current=!1,ae.current&&(clearTimeout(ae.current),ae.current=null),p?p(X):g>0&&h?.(X)};if(typeof l!="number"||typeof i!="number")return null;const k=[$?"h-28 w-5":"w-full",T,N].filter(Boolean).join(" "),Q=r.jsx("input",{type:"range",orient:$?"vertical":void 0,min:l,max:i,step:o,value:Number.isFinite(X)?X:l,onChange:me,onMouseUp:G,onTouchEnd:G,onPointerUp:G,disabled:v,className:k,style:$?{writingMode:"bt-lr",WebkitAppearance:"slider-vertical"}:void 0});return $?r.jsxs("div",{className:`flex h-full flex-col items-center gap-0.5 ${j}`.trim(),children:[z?r.jsx("div",{className:`flex flex-col items-center ${M}`.trim(),children:r.jsx("span",{className:q,children:Br(a)})}):null,r.jsxs("div",{className:"flex min-h-0 flex-1 items-center gap-0.5",children:[r.jsx("span",{className:w,children:f}),Q]})]}):r.jsxs("div",{className:`space-y-0.5 ${j}`.trim(),children:[r.jsxs("div",{className:`flex items-center justify-between ${M}`.trim(),children:[r.jsx("span",{className:w,children:f}),z?r.jsx("span",{className:q,children:Br(a)}):null]}),r.jsxs("div",{children:[Q,V?r.jsxs("div",{className:`mt-0 flex items-center justify-between ${E}`.trim(),children:[r.jsxs("span",{className:`flex items-center gap-0.5 ${S}`.trim(),children:[y?r.jsx(Mp,{label:y}):null,Br(l)]}),r.jsxs("span",{className:`flex items-center gap-0.5 ${S}`.trim(),children:[Br(i),b?r.jsx(Mp,{label:b}):null]})]}):null]})]})}const zr="mobile-joystick",BA=80,zA=.15,LA={main:0,side:0,vacuum:0},UA={main:127,side:127,vacuum:127},HA={main:-127,side:-127,vacuum:-127};function VA({disabled:a,layout:l,radius:i,onMove:o,onStop:f}){const d=m.useRef(null),h=m.useRef(null),p=m.useRef({x:0,y:0}),[g,v]=m.useState({active:!1,base:{x:0,y:0},knob:{x:0,y:0}}),y=m.useCallback(()=>{h.current=null,v({active:!1,base:{x:0,y:0},knob:{x:0,y:0}}),f?.()},[f]),b=m.useCallback(q=>{if(a||h.current!==null)return;q.preventDefault();const N=d.current;if(!N)return;const E=N.getBoundingClientRect(),S=q.clientX-E.left,T=q.clientY-E.top;p.current={x:S,y:T},h.current=q.pointerId,N.setPointerCapture?.(q.pointerId),v({active:!0,base:{x:S,y:T},knob:{x:0,y:0}})},[a]),j=m.useCallback(q=>{if(a||h.current!==q.pointerId)return;q.preventDefault();const N=d.current;if(!N)return;const E=N.getBoundingClientRect(),S=q.clientX-E.left,T=q.clientY-E.top,z=S-p.current.x,L=T-p.current.y,$=Math.min(Math.hypot(z,L),i),O=Math.atan2(L,z),V=Math.cos(O)*$,X=Math.sin(O)*$,Z={x:Jl(V/i),y:Jl(-X/i),boost:!1};v(F=>({...F,knob:{x:V,y:X}})),o?.(Z)},[a,o]),M=m.useCallback(q=>{if(h.current!==q.pointerId)return;q.preventDefault(),d.current?.releasePointerCapture?.(q.pointerId),y()},[y]);return m.useEffect(()=>{a&&y()},[a,y]),r.jsxs("div",{ref:d,role:"presentation",className:"relative w-full h-full select-none overflow-hidden rounded-xl border-2 border-slate-700 bg-slate-900/70 text-slate-100 shadow-md",style:{touchAction:"none"},onPointerDown:b,onPointerMove:j,onPointerUp:M,onPointerLeave:M,onPointerCancel:M,onContextMenu:q=>q.preventDefault(),children:[!g.active&&r.jsxs("div",{className:"absolute inset-x-0 top-0 flex flex-col items-center gap-0 text-center pt-0.5",children:[r.jsx("span",{className:"font-semibold text-slate-200",children:"Joystick area"}),r.jsx("span",{className:"text-sm text-slate-300",children:"Touch and hold to use the joystick"})]}),g.active&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"pointer-events-none absolute h-28 w-28 -translate-x-1/2 -translate-y-1/2 bg-cyan-400/10 outline outline-2 outline-cyan-400/60 [clip-path:circle(50%)]",style:{left:g.base.x,top:g.base.y}}),r.jsx("div",{className:"pointer-events-none absolute h-12 w-12 -translate-x-1/2 -translate-y-1/2 bg-cyan-300/80 shadow-lg [clip-path:circle(50%)]",style:{left:g.base.x+g.knob.x,top:g.base.y+g.knob.y}})]})]})}function YA({layout:a}){const{state:{roverId:l},actions:{setDriveVector:i,registerInputState:o}}=Dt(),f=Zx(l),d=f.docked&&!f.driving,h=d||f.dockingInProgress,p=!l,g=BA,v=zA,y=m.useRef({x:0,y:0,boost:!1});m.useEffect(()=>{p&&(y.current={x:0,y:0,boost:!1})},[p]);const b=m.useCallback((q={})=>{if(p)return;const N={x:Jl(q.x??0),y:Jl(q.y??0),boost:!!q.boost},E={x:y.current.x+(N.x-y.current.x)*(1-v),y:y.current.y+(N.y-y.current.y)*(1-v),boost:N.boost};y.current=E,i(E,{source:zr}),o(zr,{vector:E,lastEvent:"move"})},[p,o,i,v]),j=m.useCallback(()=>{if(p)return;const q={x:0,y:0,boost:!1};y.current=q,i(q,{source:zr}),o(zr,{vector:q,lastEvent:"stop"})},[p,o,i]),w=`flex h-full flex-col gap-0.5 text-slate-100 ${d?"max-h-screen self-start":""}`;return r.jsxs("div",{className:w,children:[r.jsx(Jx,{layout:"mobile",expand:h,driveDockState:f,compactHeightClass:"min-h-[5rem]"}),h?null:r.jsx("div",{className:"flex-1 min-h-0",children:r.jsx(VA,{disabled:p,layout:a,radius:g,onMove:b,onStop:j})})]})}function kp({id:a,label:l,values:i,color:o,disabled:f,onPress:d,onRelease:h}){return r.jsx("button",{type:"button",disabled:f,onPointerDown:p=>{p.preventDefault(),d(a,i)},onPointerUp:()=>h(a),onPointerLeave:()=>h(a),onPointerCancel:()=>h(a),onContextMenu:p=>p.preventDefault(),className:`flex h-full w-full items-center justify-center rounded-xl border-2 px-1 py-0.75 text-center text-sm font-semibold text-white transition select-none no-touch-select ${o} hover:brightness-110 active:brightness-125 active:scale-[0.99] disabled:opacity-30`,children:l})}function $A({layout:a}){const{state:{roverId:l,camera:i,horn:o},pipeline:f,actions:{setServoAngle:d,setNightVision:h,setAuxMotors:p,startHorn:g,stopHorn:v}}=Dt(),y=!l,b=m.useRef(null),j=i?.config,M=!!(l&&i?.enabled&&j),w=!!(l&&f?.nightVision),q=f?.nightVisionState,N=!!(l&&f?.horn),E=o?.overheated,S=typeof j?.minAngle=="number"?j.minAngle:-45,T=typeof j?.maxAngle=="number"?j.maxAngle:45,z=typeof i?.angle=="number"?i.angle:typeof j?.homeAngle=="number"?j.homeAngle:(S+T)/2,L=m.useCallback(V=>{w&&h(V)},[w,h]),$=m.useCallback((V,X)=>{y||(b.current=V,p(X))},[y,p]),O=m.useCallback(V=>{y||b.current===V&&(b.current=null,p(LA))},[y,p]);return r.jsxs("div",{className:"grid h-full min-h-0 w-full grid-rows-[minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)] gap-0.5 text-slate-100",children:[r.jsxs("div",{className:"grid min-h-0 grid-rows-2 gap-0.5",children:[r.jsx(kp,{id:"aux-vac-forward",label:"Vacuum Forward",values:UA,color:"bg-fuchsia-600",disabled:y,onPress:$,onRelease:O}),r.jsx(kp,{id:"aux-vac-backward",label:"Vacuum Backward",values:HA,color:"bg-fuchsia-800",disabled:y,onPress:$,onRelease:O})]}),r.jsxs("div",{className:"flex min-h-0 items-stretch gap-0.5",children:[M?r.jsx("div",{className:"flex-1 min-h-0 rounded bg-zinc-950 p-0.25",children:r.jsx(Px,{value:z,min:S,max:T,step:.5,onChange:d,orientation:"vertical",label:"Camera Tilt",labelClass:"text-sm font-semibold text-white [writing-mode:vertical-rl] rotate-180",labelRowClass:"text-[0.7rem] text-slate-300",valueClass:"font-mono text-slate-200",className:"h-full gap-0",sliderClass:"h-full w-7",accentClass:"accent-cyan-400",showEndpoints:!1,showValue:!1})}):null,w?r.jsx(Ix,{nightVisionOn:q?.nightVisionOn,disabled:y,onToggle:L,heightClass:"h-full"}):null]}),r.jsx("div",{className:"min-h-0",children:N?r.jsx(Wx,{disabled:y||E,onStart:g,onStop:v,active:o?.active,heat:o?.heat,defaultShowSettings:!1,showSettingsToggle:!0,compactSettings:!0,className:"h-full"}):null})]})}function eg({layout:a,className:l=""}){return r.jsx("div",{className:`flex flex-col gap-0.5 ${l}`.trim(),children:r.jsx($A,{layout:a})})}function tg({layout:a,className:l=""}){return r.jsx("div",{className:`flex flex-col gap-0.5 ${l}`.trim(),children:r.jsx(YA,{layout:a==="landscape"?"landscape":"portrait"})})}function GA(){const a="h-[min(60svh,24rem)]";return r.jsx("section",{className:"panel",children:r.jsxs("div",{className:"grid grid-cols-2 gap-0.5 items-stretch",children:[r.jsx(eg,{layout:"portrait",className:a}),r.jsx(tg,{layout:"portrait",className:a})]})})}function XA(a=[],l={}){const i=En(),{enabled:o=!0,version:f=null}=l,[d,h]=m.useState({}),p=m.useRef(new Map),g=m.useMemo(()=>a.map(w=>typeof w=="string"?w:w.id),[a]),v=m.useMemo(()=>{const w=g.join("|");return f?`${w}|v:${f}`:w},[g,f]),y=m.useRef([]),[b,j]=m.useState(0),M=m.useRef(new Map);return m.useEffect(()=>{if(!i)return;const w=()=>j(q=>q+1);return i.on("connect",w),()=>i.off("connect",w)},[i]),m.useEffect(()=>{y.current=g},[v,g]),m.useEffect(()=>{p.current.forEach(w=>URL.revokeObjectURL(w)),p.current.clear(),h({})},[v]),m.useEffect(()=>{if(!o){p.current.forEach(S=>URL.revokeObjectURL(S)),p.current.clear(),h({});return}if(!y.current.length||!i)return;let w=!1;const q=y.current,N=(S={},T)=>{if(w||!S.id||!T)return;const z=T.byteLength??T.length??0,L=Date.now(),$=M.current.get(S.id)||{count:0,totalBytes:0,lastLogAt:0},O={count:$.count+1,totalBytes:$.totalBytes+z,lastLogAt:$.lastLogAt};if(!O.lastLogAt||L-O.lastLogAt>=1e4){const F=O.count?O.totalBytes/O.count:0;console.log("[roomCamera]",S.id,`frame=${z}B`,`avg=${Math.round(F)}B`,`count=${O.count}`),O.lastLogAt=L}M.current.set(S.id,O);const V=new Blob([T],{type:"image/jpeg"}),X=URL.createObjectURL(V),Z=p.current.get(S.id);Z&&URL.revokeObjectURL(Z),p.current.set(S.id,X),h(F=>({...F,[S.id]:{status:"playing",ts:S.ts||Date.now(),error:null,objectUrl:X}}))},E=(S={})=>{w||!S.id||h(T=>({...T,[S.id]:{...T[S.id]||{},status:S.error?"error":T[S.id]?.status||"connecting",error:S.error||null,ts:S.ts||T[S.id]?.ts||null,objectUrl:T[S.id]?.objectUrl||null}}))};return i.on("roomCamera:frame",N),i.on("roomCamera:status",E),i.emit("roomCamera:subscribe",{ids:q},(S={})=>{S.error}),()=>{w=!0,i.emit("roomCamera:unsubscribe",{ids:q}),i.off("roomCamera:frame",N),i.off("roomCamera:status",E),p.current.forEach(S=>URL.revokeObjectURL(S)),p.current.clear()}},[i,v,o,b]),d}function QA({feed:a,label:l}){const[i,o]=m.useState(!1);m.useEffect(()=>{a&&(!a.ts&&!a.objectUrl||o(d=>!d))},[a?.ts,a?.objectUrl]);const f=m.useMemo(()=>a?a.error?`Error: ${a.error}`:a.status||"Connecting…":"Connecting…",[a]);return r.jsxs("div",{className:"relative w-full overflow-hidden rounded bg-black",style:{aspectRatio:"4 / 3"},children:[a?.objectUrl?r.jsx("img",{src:a.objectUrl,alt:l,className:"h-full w-full object-cover"}):r.jsx("div",{className:"flex h-full w-full items-center justify-center text-sm text-slate-300",children:"Waiting for frame…"}),r.jsx("div",{className:"pointer-events-none absolute left-0 top-0 bg-black/70 px-0.5 py-0.5 text-xs font-semibold text-white",children:l}),r.jsxs("div",{className:"pointer-events-none absolute bottom-0 left-0 m-0 flex items-center gap-0.5 rounded bg-black/70 px-0.5 py-0.25 text-[0.7rem] text-slate-100",children:[r.jsx("span",{className:`h-2 w-2 rounded-full ${i?"bg-emerald-400":"bg-slate-500"}`}),r.jsx("span",{children:f})]})]})}function KA(){return r.jsxs("div",{className:"panel-section space-y-0.5 text-sm",children:[r.jsx("p",{className:"text-center text-slate-400",children:"No room cameras configured."}),r.jsx("p",{className:"text-center text-slate-500",children:"Add entries to server config to populate this list."})]})}const ng=["horizontal","vertical"];function Iu(a,l){return ng.includes(a)?a:l}function Vf({defaultOrientation:a="horizontal",orientation:l,hideLayoutToggle:i=!1,hideHeader:o=!1,panelId:f=null}){const{session:d}=Ve(),h=d?.roomCameras||[],p=XA(h.map(N=>({id:N.id}))),{value:g,save:v}=st("roomCameraPanels",{}),[y,b]=m.useState(()=>Iu(f?g?.[f]:a,"horizontal"));m.useEffect(()=>{if(!f)return;const N=g?.[f];N&&b(Iu(N,"horizontal"))},[f,g?.[f]]);const j=l?Iu(l,"horizontal"):y,M=j==="vertical"?"flex flex-col gap-0.5":"grid gap-0.5 md:grid-cols-2",w=!i&&!l&&h.length>0,q=N=>{b(N),f&&v(E=>({...E||{},[f]:N}))};return h.length===0?r.jsx(KA,{}):r.jsxs("section",{className:"panel-section space-y-0.5 text-base",children:[!o&&r.jsxs("header",{className:"flex flex-wrap items-center justify-between gap-0.5 text-sm text-slate-400",children:[r.jsxs("div",{className:"flex items-center gap-0.5",children:[r.jsx("p",{children:"Room cameras"}),r.jsx("span",{className:"text-xs text-slate-500",children:h.length})]}),r.jsx("div",{className:"flex flex-wrap items-center gap-0.5 text-xs",children:w&&r.jsxs("div",{className:"flex items-center gap-0.5",children:[r.jsx("span",{className:"text-slate-500",children:"Layout:"}),r.jsx("div",{className:"inline-flex overflow-hidden rounded border border-slate-700",children:ng.map(N=>r.jsx("button",{type:"button",className:`px-1 py-0.5 ${j===N?"bg-slate-600 text-white":"bg-transparent text-slate-400 hover:text-white"}`,onClick:()=>q(N),children:N==="vertical"?"Vertical":"Grid"},N))})]})})]}),r.jsx("div",{className:M,children:h.map(N=>{const E=p[N.id]||null;return r.jsx("article",{className:"w-full space-y-0.5 rounded bg-zinc-950 p-0.5 shadow-inner shadow-black/40",children:r.jsx(QA,{feed:E,label:N.name||N.id})},N.id)})})]})}function Yf(){const{logs:a}=Ve();return r.jsxs("div",{className:"panel-section space-y-0.5 text-base",children:[r.jsxs("div",{className:"flex items-center justify-between text-sm text-slate-400",children:[r.jsx("span",{children:"Server logs"}),r.jsx("span",{children:a.length})]}),r.jsx("div",{className:"surface h-64 overflow-y-auto font-mono text-xs",children:a.length===0?r.jsx("p",{children:"No logs yet."}):a.slice().reverse().map(l=>r.jsxs("div",{className:"surface",children:[r.jsx("span",{className:"text-amber-400",children:l.timestamp})," ",r.jsxs("span",{className:"text-lime-400",children:["[",l.level,"]"]})," ",l.label&&r.jsxs("span",{className:"text-teal-400",children:["[",l.label,"]"]})," ",r.jsx("span",{children:l.message})]},l.id))})]})}function FA(a){if(!a)return null;if(typeof a=="string"){const l=String(a).trim();return l?{type:"rover",id:l,key:l}:null}if(typeof a=="object"){if(a.type&&a.id){const l=String(a.id);let i=a.key;return i||(i=a.type==="room"?`room:${l}`:l),{type:a.type,id:l,key:i}}if(a.roverId){const l=String(a.roverId);return{type:"rover",id:l,key:a.key||l}}if(a.roomCameraId){const l=String(a.roomCameraId);return{type:"room",id:l,key:a.key||`room:${l}`}}}return null}function ZA(a=[]){const l=new Set,i=[];return a.forEach(o=>{!o?.key||l.has(o.key)||(l.add(o.key),i.push(o))}),i.sort((o,f)=>o.key.localeCompare(f.key))}function ri(a=[],l={}){const i=En(),{enabled:o=!0,version:f=null}=l,[d,h]=m.useState({}),p=m.useMemo(()=>Array.isArray(a)?ZA(a.map(FA).filter(Boolean)):[],[a]),g=m.useMemo(()=>{const M=p.map(w=>`${w.type}:${w.id}:${w.key}`).join("|");return f?`${M}|v:${f}`:M},[p,f]),v=m.useRef([]),[y,b]=m.useState(0);return m.useEffect(()=>{if(!i)return;const M=()=>b(w=>w+1);return i.on("connect",M),()=>{i.off("connect",M)}},[i]),m.useEffect(()=>{v.current=p},[p]),m.useEffect(()=>{if(!g||!o){h({});return}const M=v.current;let w=!1;function q(N){const E=N.type==="room"?{roomCameraId:N.id}:{roverId:N.id};i.emit("video:request",E,(S={})=>{w||h(T=>({...T,[N.key]:S}))})}return M.forEach(N=>{q(N)}),()=>{w=!0}},[i,g,o,y]),m.useMemo(()=>{if(!g||!o)return{};const M={};return p.forEach(w=>{d[w.key]&&(M[w.key]=d[w.key])}),M},[g,d,p])}function $f(a=[],l={}){const i=En(),{enabled:o=!0,version:f=null}=l,[d,h]=m.useState({}),p=m.useRef(new Map),g=m.useMemo(()=>a.map(w=>typeof w=="string"?w:w.id).filter(Boolean),[a]),v=m.useMemo(()=>{const w=g.join("|");return f?`${w}|v:${f}`:w},[g,f]),y=m.useRef([]),[b,j]=m.useState(0),M=m.useRef(new Map);return m.useEffect(()=>{if(!i)return;const w=()=>j(q=>q+1);return i.on("connect",w),()=>i.off("connect",w)},[i]),m.useEffect(()=>{y.current=g},[v,g]),m.useEffect(()=>{p.current.forEach(w=>URL.revokeObjectURL(w)),p.current.clear(),h({})},[v]),m.useEffect(()=>{if(!o){p.current.forEach(S=>URL.revokeObjectURL(S)),p.current.clear(),h({});return}if(!y.current.length||!i)return;let w=!1;const q=y.current,N=(S={},T)=>{if(w||!S.id||!T)return;const z=T.byteLength??T.length??0,L=Date.now(),$=M.current.get(S.id)||{count:0,totalBytes:0,lastLogAt:0},O={count:$.count+1,totalBytes:$.totalBytes+z,lastLogAt:$.lastLogAt};if(!O.lastLogAt||L-O.lastLogAt>=1e4){const F=O.count?O.totalBytes/O.count:0;console.log("[roverSnapshot]",S.id,`frame=${z}B`,`avg=${Math.round(F)}B`,`count=${O.count}`),O.lastLogAt=L}M.current.set(S.id,O);const V=new Blob([T],{type:"image/jpeg"}),X=URL.createObjectURL(V),Z=p.current.get(S.id);Z&&URL.revokeObjectURL(Z),p.current.set(S.id,X),h(F=>({...F,[S.id]:{status:"playing",ts:S.ts||Date.now(),error:null,objectUrl:X}}))},E=(S={})=>{w||!S.id||h(T=>({...T,[S.id]:{...T[S.id]||{},status:S.error?"error":T[S.id]?.status||"connecting",error:S.error||null,ts:S.ts||T[S.id]?.ts||null,objectUrl:T[S.id]?.objectUrl||null}}))};return i.on("roverSnapshot:frame",N),i.on("roverSnapshot:status",E),i.emit("roverSnapshot:subscribe",{ids:q},(S={})=>{S.error}),()=>{w=!0,i.emit("roverSnapshot:unsubscribe",{ids:q}),i.off("roverSnapshot:frame",N),i.off("roverSnapshot:status",E),p.current.forEach(S=>URL.revokeObjectURL(S)),p.current.clear()}},[i,v,o,b]),d}const JA={iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"turn:your.turn.server:3478",username:"user",credential:"pass"}],bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"};function IA(a){if(typeof btoa=="function")return btoa(a);if(typeof Buffer<"u")return Buffer.from(a).toString("base64");throw new Error("No base64 encoder available")}function WA(a){if(!a)return{};const l=`${a}:${a}`;return{Authorization:`Basic ${IA(l)}`}}class Rp{constructor({url:l,token:i,video:o,onStatus:f,audioOnly:d=!1,receiveAudio:h=!0}){this.url=l,this.token=i,this.video=o,this.audioOnly=d,this.receiveAudio=h,this.pc=null,this.abortController=null,this.onStatus=f}notify(l,i){typeof this.onStatus=="function"&&this.onStatus(l,i)}configureVideoElement(){this.video&&(this.video.playsInline=!0,this.video.autoplay=!0,this.video.muted=!this.audioOnly,typeof this.video.disableRemotePlayback<"u"&&(this.video.disableRemotePlayback=!0),"latencyHint"in HTMLMediaElement.prototype&&(this.video.latencyHint="interactive"))}async start(){if(!this.url||!this.video)throw new Error("Media target missing");this.stop(),this.notify("connecting"),this.configureVideoElement(),this.abortController=new AbortController;const l=new RTCPeerConnection(JA);this.pc=l;const i=new MediaStream;l.ontrack=o=>{o.streams[0]?.getTracks().forEach(f=>i.addTrack(f)),this.video.srcObject=i,o.track?.kind==="video"&&"playoutDelayHint"in o.receiver&&(o.receiver.playoutDelayHint=0)},this.audioOnly?l.addTransceiver("audio",{direction:"recvonly"}):(l.addTransceiver("video",{direction:"recvonly"}),this.receiveAudio&&l.addTransceiver("audio",{direction:"recvonly"})),l.onconnectionstatechange=()=>{this.notify(l.connectionState)},l.oniceconnectionstatechange=()=>{const o=l.iceConnectionState;(o==="failed"||o==="disconnected")&&this.notify(o)};try{const o=await l.createOffer({offerToReceiveAudio:this.audioOnly?!0:this.receiveAudio,offerToReceiveVideo:!this.audioOnly});await l.setLocalDescription(o);const f=await fetch(this.url,{method:"POST",headers:{"Content-Type":"application/sdp",...WA(this.token)},body:o.sdp,signal:this.abortController.signal});if(!f.ok)throw new Error(`WHEP request failed: ${f.status}`);const d=await f.text();await l.setRemoteDescription({type:"answer",sdp:d}),l.getReceivers().forEach(h=>{"playoutDelayHint"in h&&(h.playoutDelayHint=0)}),await this.video.play().catch(()=>{}),this.notify("playing")}catch(o){throw this.notify("error",o.message),this.stop(),o}}stop(){this.abortController&&(this.abortController.abort(),this.abortController=null),this.pc&&(this.pc.getSenders().forEach(l=>l.track?.stop()),this.pc.getReceivers().forEach(l=>l.track?.stop()),this.pc.close(),this.pc=null),this.video&&(this.video.srcObject=null),this.notify("stopped")}}function vf({sensors:a={},variant:l="full",size:i,overlay:o=!1}){const f=i||(l==="mini"?190:260),d=f/2,h=f*.07,p=d,g=d+h,v=d*.8,y=v-4,b=v+4,j=v-14,M=v-6,w=v*.65,q=a?.bumpsAndWheelDrops||{},N=a?.wheelOvercurrents||{},E=a?.wheelLeftCurrentMa??0,S=a?.wheelRightCurrentMa??0,T=a?.sideBrushCurrentMa??0,z=a?.mainBrushCurrentMa??0,L=6,$=q.bumpLeft?L:0,O=q.bumpRight?L:0,V=sj({count:6,totalSpan:140,gap:6,startAngle:-70}),X=["L","FL","CL","CR","FR","R"],Z=[a?.lightBumpLeftSignal,a?.lightBumpFrontLeftSignal,a?.lightBumpCenterLeftSignal,a?.lightBumpCenterRightSignal,a?.lightBumpFrontRightSignal,a?.lightBumpRightSignal],F=V.map((G,k)=>({label:X[k],start:G.start,end:G.end,value:Z[k]})),ae=[{label:"Cliff L",start:-60,end:-46,value:a?.cliffLeftSignal,active:a?.cliffLeft},{label:"Cliff FL",start:-32,end:-16,value:a?.cliffFrontLeftSignal,active:a?.cliffFrontLeft},{label:"Cliff FR",start:16,end:32,value:a?.cliffFrontRightSignal,active:a?.cliffFrontRight},{label:"Cliff R",start:46,end:60,value:a?.cliffRightSignal,active:a?.cliffRight}],oe=Z.filter(G=>G!=null),me=oe.length?Math.max(...oe,1200):1200;return r.jsxs("div",{className:`${o?"relative":"surface relative p-1"}`,style:o?{width:`${f}px`,height:`${f}px`}:{height:"100%",width:"100%",aspectRatio:"1 / 1"},children:[o?null:r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"absolute left-1 top-1 text-xs text-slate-400",children:"Top-down"}),r.jsxs("div",{className:"absolute right-1 top-1 text-[0.65rem] text-slate-500",children:["0",me]})]}),r.jsxs("svg",{width:"100%",height:"100%",viewBox:`0 0 ${f} ${f}`,preserveAspectRatio:"xMidYMid meet",className:"mx-auto block",children:[r.jsx("circle",{cx:p,cy:g,r:v,fill:"#0f172a",stroke:"#334155",strokeWidth:"2"}),r.jsx(Tp,{cx:p-w,cy:g,current:E,drop:q.wheelDropLeft,overcurrent:N.leftWheel,label:"L"}),r.jsx(Tp,{cx:p+w,cy:g,current:S,drop:q.wheelDropRight,overcurrent:N.rightWheel,label:"R"}),r.jsx(tj,{cx:p+v*.65,cy:g-v*.55,current:T,overcurrent:N.sideBrush}),r.jsx(nj,{cx:p,cy:g,current:z,overcurrent:N.mainBrush,variant:l,dirtLeft:a?.dirtDetectLeft,dirtRight:a?.dirtDetect}),F.map(G=>{const k=aj(G.value,me),Q=b+4,P=Q+28;return r.jsx(PA,{cx:p,cy:g,rBase:P,rTip:Q,startDeg:G.start,endDeg:G.end,color:k,value:G.value,max:me},G.label)}),ae.map(G=>{const k=lj(G.value,G.active);return r.jsx(Wu,{cx:p,cy:g,rInner:j,rOuter:M,startDeg:G.start,endDeg:G.end,color:k,opacity:1,pulse:!!G.active},G.label)}),r.jsx(Wu,{cx:p,cy:g,rInner:y-$,rOuter:b-$,startDeg:-70,endDeg:-6,color:q.bumpLeft?"#ef4444":"#475569",opacity:1,pulse:!!q.bumpLeft}),r.jsx(Wu,{cx:p,cy:g,rInner:y-O,rOuter:b-O,startDeg:6,endDeg:70,color:q.bumpRight?"#ef4444":"#475569",opacity:1,pulse:!!q.bumpRight})]})]})}function Wu({cx:a,cy:l,rInner:i,rOuter:o,startDeg:f,endDeg:d,color:h,pulse:p=!1,opacity:g=1}){const v=(i+o)/2,y=o-i,b=ej(a,l,v,f,d);return r.jsxs(r.Fragment,{children:[r.jsx("path",{d:b,stroke:h,strokeWidth:y,strokeLinecap:"round",fill:"none",opacity:g}),p?r.jsx("path",{d:b,stroke:"#ef4444",strokeWidth:y,strokeLinecap:"round",fill:"none",className:"animate-pulse",opacity:1}):null]})}function PA({cx:a,cy:l,rBase:i,rTip:o,startDeg:f,endDeg:d,color:h,value:p,max:g}){const v=(f+d)/2,y=ai(a,l,o,v),b=io(p!=null?p/(g||1):0),j=Math.pow(b,.35),M=i-(i-o)*j,w=ai(a,l,M,f),q=ai(a,l,M,d),N=`M ${y.x} ${y.y} L ${w.x} ${w.y} L ${q.x} ${q.y} Z`;return r.jsx("path",{d:N,fill:h,opacity:1,stroke:"none"})}function ej(a,l,i,o,f){let d=o,h=f;h<=d&&(h+=360);const p=ai(a,l,i,d),g=ai(a,l,i,h);return["M",p.x,p.y,"A",i,i,0,0,1,g.x,g.y].join(" ")}function ai(a,l,i,o){const f=ag(o);return{x:a+i*Math.cos(f),y:l+i*Math.sin(f)}}function ag(a){return(a-90)*Math.PI/180}function Gf(a,l){if(l)return"#ef4444";const i=Math.abs(a);return i>900?"#f59e0b":i>300?"#22c55e":"#64748b"}function io(a){return Math.max(0,Math.min(1,a))}function Tp({cx:a,cy:l,current:i,drop:o,overcurrent:f,label:d}){const h=Math.abs(i),p=io(h/1200),g=Gf(i,f),v=56,y=14,b=9,j=3,M=v*p,w=d==="L"?-1:1,q=w*(-b/2-j/2),N=w*(y/2+j/2),E=y+b+j+2,S=v+4;return r.jsxs("g",{transform:`translate(${a},${l})`,children:[r.jsx("rect",{x:-E/2,y:-S/2,width:E,height:S,rx:"4",fill:"none",stroke:"#64748b",strokeWidth:"1"}),r.jsx("rect",{x:q-y/2,y:-v/2,width:y,height:v,fill:"#0f172a",stroke:"#0f172a",strokeWidth:"1",rx:"2"}),r.jsx("rect",{x:q-y/2,y:v/2-M,width:y,height:M,fill:g,className:f?"animate-pulse":""}),r.jsx("rect",{x:N-b/2,y:-v/2,width:b,height:v,fill:o?"#ef4444":"#475569",className:o?"animate-pulse":"",rx:"2"}),r.jsx("text",{x:0,y:v/2+10,textAnchor:"middle",className:"fill-slate-200 text-[0.7rem]",children:d})]})}function tj({cx:a,cy:l,current:i,overcurrent:o}){var f=Math.abs(i);f<10&&(f=0);const d=Gf(i*3,o),h=43,p=f>0?.65:null;return r.jsxs("g",{style:{transformOrigin:`${a}px ${l}px`,animation:p?`spin ${p}s linear infinite`:"none",animationDirection:p?"reverse":"normal"},children:[r.jsx("circle",{cx:a,cy:l,r:10,fill:"#64748b",stroke:"#64748b",strokeWidth:"1"}),[0,120,240].map(v=>{const y=ag(v),b=a+h*Math.cos(y),j=l+h*Math.sin(y);return r.jsx("line",{x1:a,y1:l,x2:b,y2:j,stroke:d,strokeWidth:"4",strokeLinecap:"round"},v)}),o?r.jsx("circle",{cx:a,cy:l,r:h+8,stroke:"#ef4444",strokeWidth:"3",fill:"none",className:"animate-pulse"}):null]})}function nj({cx:a,cy:l,current:i,overcurrent:o,variant:f,dirtLeft:d,dirtRight:h}){const p=Math.abs(i),g=Gf(i,o),v=1,y=96,b=12,j=`main-brush-pattern-a-${f}`,M=`main-brush-pattern-b-${f}`,w=p>0?.6:null,q=i>=0?1:-1;return r.jsxs("g",{children:[r.jsx("defs",{children:[j,M].map((N,E)=>r.jsxs("pattern",{id:N,patternUnits:"userSpaceOnUse",width:"6",height:"6",children:[r.jsx("rect",{width:"6",height:"6",fill:g,opacity:v}),r.jsx("path",{d:"M0 6 L6 0",stroke:"#0f172a",strokeWidth:"1"}),w?r.jsx("animateTransform",{attributeName:"patternTransform",type:"translate",from:"0 0",to:`0 ${q*(E===0?6:-6)}`,dur:`${w}s`,repeatCount:"indefinite"}):null]},N))}),r.jsx("rect",{x:a-y/2,y:l-14,width:y,height:b,rx:"3",fill:`url(#${j})`,stroke:"#64748b",strokeWidth:"1"}),r.jsx("rect",{x:a-y/2,y:l+4,width:y,height:b,rx:"3",fill:`url(#${M})`,stroke:"#64748b",strokeWidth:"1"}),r.jsx("circle",{cx:a-y/4,cy:l-8,r:3.5,fill:"#fbbf24"}),r.jsx("circle",{cx:a+y/4,cy:l+8,r:3.5,fill:"#fbbf24"}),o?r.jsx("rect",{x:a-y/2-4,y:l-16,width:y+8,height:b*2+16,rx:"6",stroke:"#ef4444",strokeWidth:"3",fill:"none",className:"animate-pulse"}):null]})}function aj(a,l){if(a==null||a<=0)return"hsl(200 60% 18%)";const o=io(a/(l||1));return`hsl(${(200+Math.pow(o,.45)*360)%360} 100% 60%)`}function lj(a,l){if(l)return"#ef4444";const i=io(a==null?0:a/4095),o=[47,55,69],f=[245,158,11],[d,h,p]=o.map((g,v)=>Math.round(g+(f[v]-g)*i));return`rgb(${d}, ${h}, ${p})`}function sj({count:a,totalSpan:l,gap:i,startAngle:o}){const d=(l-i*(a-1))/a,h=[];let p=o;for(let g=0;g<a;g+=1){const v=p+d;h.push({start:p,end:v}),p=v+i}return h}function lg(){const{value:a,save:l}=st("page",{hudMapDesktop:!1});return[!!a?.hudMapDesktop,f=>{l({hudMapDesktop:!!f})}]}const ij={discord:Tx,kofi:xp,"ko-fi":xp,wiki:TS,throne:DS},rj={discord:{backgroundImage:"linear-gradient(270deg,#5865F2,#404EED,#5865F2)",backgroundSize:"600% 600%",animation:"socialGradient 180s ease infinite"},kofi:{backgroundImage:"linear-gradient(270deg,#FF6433,#E04822,#FF6433)",backgroundSize:"600% 600%",animation:"socialGradient 170s ease infinite"},"ko-fi":{backgroundImage:"linear-gradient(270deg,#FF6433,#E04822,#FF6433)",backgroundSize:"600% 600%",animation:"socialGradient 170s ease infinite"},wiki:{backgroundImage:"linear-gradient(270deg,#EE8019,#C65C08,#EE8019)",backgroundSize:"600% 600%",animation:"socialGradient 180s ease infinite"},throne:{backgroundImage:"linear-gradient(270deg,#7C3AED,#5B21B6,#7C3AED)",backgroundSize:"600% 600%",animation:"socialGradient 180s ease infinite"}};function oj(){m.useEffect(()=>{if(typeof document>"u")return;const a="social-button-keyframes";if(document.getElementById(a))return;const l=document.createElement("style");l.id=a,l.textContent=`
@keyframes socialGradient {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}
`,document.head.appendChild(l)},[])}function cj(a,l){return typeof a=="string"&&a.trim()?a.trim().toLowerCase():typeof l=="string"&&l.trim()?l.trim().toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,""):""}function Xf({id:a,label:l,url:i,className:o=""}){if(!i)return null;oj();const f=cj(a,l),d=ij[f]||_S,h=rj[f]||null,p=l||a||"Link";return r.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer","aria-label":p,className:`inline-flex items-center w-full px-0.5 py-0.5 text-sm font-medium text-white transition justify-center gap-1 rounded-md ${h?"":"bg-slate-700 hover:bg-slate-600"} ${o}`,style:h||void 0,children:[r.jsx(d,{className:"mr-0"}),p]})}const oi=10;function sg({batteryState:a=null,charge:l=null,config:i=null}){const o=a?.percentDisplay!=null&&Number.isFinite(a.percentDisplay)?Math.round(a.percentDisplay):null,f=a?.warnActive??null,d=a?.urgentActive??null,h=i?.Full??null,p=i?.Warn??null,g=i?.Urgent??null,v=l??a?.charge??null;let y=o;if(y==null&&(y=uj({charge:v,full:h,warn:p,urgent:g})),y==null)return{available:!1};const b=Math.max(0,Math.min(1,y/100)),j=f??(p!=null&&v!=null&&v<=p),M=d??(g!=null&&v!=null&&v<=g);return{available:!0,percent:b,percentDisplay:y,warnActive:j,urgentActive:M,warnDisplayPercent:oi}}function uj({charge:a,full:l,warn:i,urgent:o}){if(a!=null&&l!=null&&i!=null&&o!=null&&l>i&&i>o){const f=oi/100,d=1-f;if(a<=o)return 0;if(a<=i){const p=(a-o)/(i-o);return Math.round(Math.max(0,Math.min(1,p))*oi)}if(a>=l)return 100;const h=(a-i)/(l-i);return Math.round((f+Math.max(0,Math.min(1,h))*d)*100)}return null}const fj=1600,dj=800;function fn(...a){return a.filter(Boolean).join(" ")}function yf({visual:a,orientation:l="horizontal",variant:i="inline",compact:o=!1,showLabel:f,className:d=""}){const h=i==="background",p=l==="vertical",g=f??!h;if(!a?.available){if(h){const ae=oi,oe=fn("absolute z-10",p?"left-0 right-0 h-[2px]":"top-0 bottom-0 w-[2px]","bg-black/70",M&&!j&&"battery-tick-warn"),me=p?{bottom:`${ae}%`}:{left:`${ae}%`},G=fn("absolute inset-0 pointer-events-none",d);return r.jsxs("div",{className:G,children:[r.jsx("div",{className:"absolute inset-0 bg-slate-900/35"}),r.jsx("div",{className:oe,style:me})]})}return p?null:r.jsx("p",{className:"text-xs text-slate-500",children:"Battery telemetry unavailable"})}const v=a.percentDisplay??0,y=Math.max(0,Math.min(100,v)),b=a.warnDisplayPercent??oi,j=!!a.urgentActive,M=!!a.warnActive,w=j?`${dj}ms`:M?`${fj}ms`:void 0,N=h?j||M?"bg-red-500/45":"bg-emerald-500/45":j||M?"bg-red-500":"bg-emerald-500",E=j||M?"bg-red-900/35":"bg-slate-900/35",S=j||M?"bg-red-900/45":"bg-slate-900/35",T=fn(h?"absolute inset-0 pointer-events-none":"relative pointer-events-auto",p&&!h?"flex flex-col items-center justify-center":"w-full",d);if(h){const ae=p?{height:`${y}%`}:{width:`${y}%`},oe=fn("absolute",p?"bottom-0 left-0 right-0":"left-0 top-0 bottom-0",N,"transition-[width,height]",j&&"battery-urgent-flash"),me=fn("absolute z-10",p?"left-0 right-0 h-[2px]":"top-0 bottom-0 w-[2px]","bg-black/70",M&&!j&&"battery-tick-warn"),G=p?{bottom:`${b}%`}:{left:`${b}%`};return r.jsxs("div",{className:T,children:[r.jsx("div",{className:fn("absolute inset-0",E,j&&"battery-urgent-flash")}),r.jsx("div",{className:oe,style:{...ae,animationDuration:w}}),r.jsx("div",{className:me,style:G})]})}const z=fn("relative overflow-hidden rounded-sm border border-slate-800",j||M?S:"bg-zinc-900/90",j&&"battery-urgent-flash",p?"w-full flex-1":o?"h-4":"h-5"),L=p?{height:`${y}%`}:{width:`${y}%`},$=fn("absolute",p?"bottom-0 left-0 right-0":"left-0 top-0 bottom-0",N,"transition-[width,height]",j&&"battery-urgent-flash"),O=fn("absolute z-10",p?"left-0 right-0 h-[2px]":"top-0 bottom-0 w-[2px]","bg-black/70",M&&!j&&"battery-tick-warn"),V=p?{bottom:`${b}%`}:{left:`${b}%`},X=`Battery ${v}%`,Z=fn("pointer-events-none absolute inset-0 flex items-center justify-center text-center font-semibold",p?o?"text-[0.55rem]":"text-[0.65rem]":"text-xs"),F=fn("rounded px-1.5 py-0.5",h?"bg-black/30 text-slate-100":"bg-black/50 text-slate-100");return r.jsxs("div",{className:T,children:[r.jsxs("div",{className:z,children:[r.jsx("div",{className:$,style:{...L,animationDuration:w}}),r.jsx("div",{className:O,style:V})]}),g&&!p?r.jsx("div",{className:Z,children:r.jsx("span",{className:F,children:X})}):null,g&&p?r.jsx("div",{className:"mt-0.5 text-[0.65rem] font-semibold text-slate-100",children:r.jsxs("span",{className:F,children:[v,"%"]})}):null]})}const Dp=2e3,mj=3e3,hj=3e3,pj=40,xj=1e3;function ci({sessionInfo:a,audioSessionInfo:l,videoMode:i="whep",snapshotFeed:o=null,qualityNotice:f=null,label:d,forceMute:h=!1,telemetryFrame:p,batteryConfig:g,layoutFormat:v="desktop",hudVariant:y="default",driverLabel:b=null,hudForceMap:j=!1,hudMapPosition:M="top-center",hudLabelScale:w=1,fitParent:q=!1,overcurrentLimiter:N=null,showTurnCue:E=!1,turnTimerText:S=null,turnSeconds:T=null,isActiveDriver:z=!1,idleSkipSeconds:L=null}){const{session:$}=Ve(),O=m.useRef(null),V=m.useRef(null),X=m.useRef(null),Z=m.useRef(null),F=m.useRef(null),ae=m.useRef(null),oe=m.useRef(null),me=m.useRef(null),[G,k]=m.useState("idle"),[Q,P]=m.useState(null),[re,ce]=m.useState("idle"),[C,_]=m.useState(null),[W,te]=m.useState(0),[le,ie]=m.useState(0),[ue,ve]=m.useState(!0),he=!!l?.url,Ce=i==="snapshot",ne=p?.sensors,{value:se}=st("audio",jt),Se=Number.isFinite(se?.masterVolume)?se.masterVolume:jt.masterVolume,Oe=Number.isFinite(se?.roverVolume)?se.roverVolume:jt.roverVolume,Ne=typeof se?.mainBrushDuckEnabled=="boolean"?se.mainBrushDuckEnabled:typeof se?.autoLevelEnabled=="boolean"?se.autoLevelEnabled:jt.mainBrushDuckEnabled,ze=Number.isFinite(se?.mainBrushDuckAmount)?Math.max(0,Math.min(1,se.mainBrushDuckAmount)):jt.mainBrushDuckAmount,an=Math.max(0,Math.min(1,Se*Oe)),wa=ne?.batteryChargeMah??null,Wn=v==="desktop",it=!Wn,ln=it?"top-right":M,[fo]=lg(),mo=j||it?!0:fo,mt=sg({charge:wa,config:g}),Pa=ne?.wheelOvercurrents||null,el=Pa==null?[]:Object.entries(Pa).filter(([,xe])=>!!xe).map(([xe])=>xe),sn=N?.caps||null,Ea=N?.overcurrent?.groups||null,gi=typeof window<"u"&&new URLSearchParams(window.location.search).has("debugAudio"),tl=typeof window<"u"&&new URLSearchParams(window.location.search).has("debugHud"),ho=m.useMemo(()=>{if(!sn)return null;const xe=Number.isFinite(sn?.drive?.cap)?sn.drive.cap:1,Xe=Number.isFinite(sn?.aux?.cap)?sn.aux.cap:1;return Math.max(0,Math.min(1,1-Math.min(xe,Xe)))},[sn]),ts=!!N?.isActive,rn=el.length?el:ts?["limiter"]:[],pt=ho??(el.length?1:0),Yt=!!rn.length,rt=!!((Number(ne?.mainBrushCurrentMa)||0)>pj||ne?.wheelOvercurrents?.mainBrush),po=Ne&&rt?1-ze:1,nl=Math.max(0,Math.min(1,an*po)),xo=Ne&&rt&&ze>0?`Volume decreased ${Math.round(ze*1e3)/10}%`:null,Ca=m.useRef({hasDedicatedAudio:!1,audioUrl:null,mainBrushDuckEnabled:!1,mainBrushDuckAmount:0,mainBrushActive:!1,baseRoverGain:0,effectiveRoverGain:0});m.useEffect(()=>{Ca.current={hasDedicatedAudio:he,audioUrl:l?.url||null,mainBrushDuckEnabled:Ne,mainBrushDuckAmount:ze,mainBrushActive:rt,baseRoverGain:an,effectiveRoverGain:nl}},[he,l?.url,Ne,ze,rt,an,nl]);const Fe=m.useCallback((xe,Xe={})=>{if(!gi)return;const Qe=V.current,je=Ca.current,Le={event:xe,ts:Date.now(),roverLabel:d||null,hasDedicatedAudio:je.hasDedicatedAudio,audioUrl:je.audioUrl,mainBrushDuckEnabled:je.mainBrushDuckEnabled,mainBrushDuckAmount:je.mainBrushDuckAmount,mainBrushActive:je.mainBrushActive,baseRoverGain:je.baseRoverGain,effectiveRoverGain:je.effectiveRoverGain,element:Qe?{muted:Qe.muted,volume:Qe.volume,paused:Qe.paused,ended:Qe.ended,readyState:Qe.readyState,networkState:Qe.networkState}:null,...Xe};try{console.log(`[AudioDebug] ${xe} ${JSON.stringify(Le)}`)}catch{console.log("[AudioDebug]",xe,Le)}},[gi,d]),al=$?.socials?.find(xe=>String(xe?.id||xe?.label||"").toLowerCase()==="discord")?.url||$?.discord?.invite||null;m.useEffect(()=>{tl&&console.log("[OvercurrentHUD]",{overlayVisible:Yt,overlayMotors:rn,overlayFill:pt,limiterActive:ts,limiterCaps:sn,limiterGroups:Ea,wheelOvercurrents:Pa})},[tl,pt,rn,Yt,ts,sn,Ea,Pa]),m.useEffect(()=>{Fe("settings/update")},[Fe]);const _t=m.useCallback(()=>{clearTimeout(X.current),X.current=setTimeout(()=>te(Date.now()),Dp)},[]),Pn=m.useCallback(()=>{clearTimeout(Z.current),Z.current=setTimeout(()=>ie(Date.now()),Dp)},[]),xn=m.useCallback(async()=>{const xe=O.current;if(xe)try{xe.muted=!0,await xe.play()}catch{}},[]),vi=m.useCallback((xe=0)=>{if(h||he)return;clearTimeout(ae.current);const Xe=()=>{clearTimeout(ae.current),ae.current=setTimeout(()=>{h||Qe()},mj)},Qe=async()=>{const je=O.current;if(je)try{await xn(),je.muted=!1,await je.play(),ve(!1)}catch{je.muted=!0,ve(!0),Xe()}};ae.current=setTimeout(Qe,xe)},[xn,h,he]);m.useEffect(()=>()=>{clearTimeout(X.current),clearTimeout(Z.current),clearTimeout(ae.current),clearInterval(F.current),oe.current&&(cancelAnimationFrame(oe.current),oe.current=null)},[]),m.useEffect(()=>{G==="playing"&&vi(0)},[G,vi]),m.useEffect(()=>{Ce&&(k("snapshot"),P(null))},[Ce]),m.useEffect(()=>{if(Ce||!a?.url||!O.current)return;let xe=!0,Xe;const Qe=setTimeout(()=>ve(!0),0),je=(Le,vt)=>{xe&&(Fe("video/status",{nextStatus:Le,info:vt||null}),k(Le),P(vt||null),Le==="playing"&&xn(),["error","failed","disconnected","closed"].includes(Le)&&_t())};return Xe=new Rp({url:a.url,token:a.token,video:O.current,receiveAudio:!he,onStatus:je}),Xe.start().catch(Le=>{xe&&(k("error"),P(Le.message),_t())}),()=>{xe=!1,clearTimeout(Qe),Xe?.stop()}},[Ce,a?.url,a?.token,W,_t,xn,he,Fe]),m.useEffect(()=>{G==="stopped"&&a?.url&&_t()},[G,a?.url,_t]),m.useEffect(()=>{const xe=V.current;if(!xe||!l?.url){Fe("route/no-audio-url"),me.current=null;return}const Xe=Math.max(0,Math.min(1,nl)),Qe=me.current==null?Math.max(0,Math.min(1,xe.volume)):me.current;if(oe.current&&(cancelAnimationFrame(oe.current),oe.current=null),Xe>Qe){const je=performance.now(),Le=Qe,vt=Xe-Le,Et=Pe=>{const Te=Math.min(1,(Pe-je)/xj),Gt=Le+vt*Te;xe.volume=Gt,me.current=Gt,Te<1?oe.current=requestAnimationFrame(Et):oe.current=null};oe.current=requestAnimationFrame(Et)}else xe.volume=Xe,me.current=Xe;Fe("route/direct",{elementVolume:Xe,duckEnabled:Ne,mainBrushActive:rt,duckAmount:ze})},[l?.url,nl,Ne,rt,ze,Fe]),m.useEffect(()=>{if(!l?.url||!V.current)return;let xe=!0,Xe;const Qe=(je,Le)=>{xe&&(Fe("audio/status",{nextStatus:je,info:Le||null}),_(Le||(je==="connected"?"connected":null)),ce(vt=>je==="connected"&&(vt==="playing"||vt==="connecting")||je==="new"?vt:je),["error","failed"].includes(je)&&Pn())};return Xe=new Rp({url:l.url,token:l.token,video:V.current,audioOnly:!0,onStatus:Qe}),Xe.start().catch(je=>{xe&&(ce("error"),_(je.message),Pn())}),()=>{xe=!1,Xe?.stop()}},[l?.url,l?.token,le,Pn,Fe]),m.useEffect(()=>{const xe=V.current;if(!l?.url||!xe){clearInterval(F.current);return}if(!["connecting","connected","playing","paused"].includes(re)){clearInterval(F.current);return}const Qe=async()=>{const je=V.current;je&&(je.muted=!1,!(!je.paused&&!je.ended)&&(Fe("retry/play-attempt"),je.play().then(()=>{Fe("retry/play-ok"),ce(Le=>Le==="connected"?"playing":Le),_(Le=>Le==="paused"?null:Le)}).catch(Le=>{Fe("retry/play-fail",{error:Le?.message}),_(vt=>vt||Le?.message||"autoplay blocked")})))};return Qe(),F.current=setInterval(Qe,hj),()=>clearInterval(F.current)},[l?.url,re,Fe]),m.useEffect(()=>{const xe=V.current;if(!xe)return;const Xe=()=>{Fe("element/play"),ce(Te=>Te==="error"?Te:"playing"),_(null)},Qe=()=>{Fe("element/pause"),ce(Te=>["error","failed","disconnected","closed","stopped"].includes(Te)?Te:"paused"),_(Te=>Te||"paused")},je=()=>{Fe("element/ended"),ce(Te=>Te==="error"?Te:"stopped"),_(Te=>Te||"ended")},Le=()=>{const{error:Te}=xe,Gt=Te?.message||"audio error";Fe("element/error",{error:Gt}),ce("error"),_(Gt)},vt=()=>Fe("element/waiting"),Et=()=>Fe("element/canplay"),Pe=()=>Fe("element/stalled");return xe.addEventListener("play",Xe),xe.addEventListener("pause",Qe),xe.addEventListener("ended",je),xe.addEventListener("error",Le),xe.addEventListener("waiting",vt),xe.addEventListener("canplay",Et),xe.addEventListener("stalled",Pe),()=>{xe.removeEventListener("play",Xe),xe.removeEventListener("pause",Qe),xe.removeEventListener("ended",je),xe.removeEventListener("error",Le),xe.removeEventListener("waiting",vt),xe.removeEventListener("canplay",Et),xe.removeEventListener("stalled",Pe)}},[l?.url,Fe]);const yi=o?.error?`Error: ${o.error}`:o?.objectUrl?"snapshot":o?.status||"waiting",ns=Ce?yi:a?.url?G==="error"?`Error: ${Q||"unknown"}`:Q?`${G} (${Q})`:G:"waiting",qa=l?.error?`Error: ${l.error}`:l?.url?re==="error"?`Error: ${C||"unknown"}`:C?`${re} (${C})`:re:null,bi=y==="spectator",$t=y==="none";return r.jsxs("div",{className:`flex flex-col gap-0.5 ${q?"h-full":""}`,children:[r.jsxs("div",{className:`relative w-full overflow-hidden bg-black ${q?"h-full flex-1":"aspect-[4/3]"}`,children:[Ce?o?.objectUrl?r.jsx("img",{src:o.objectUrl,alt:d,className:"h-full w-full object-contain",draggable:!1}):r.jsx("div",{className:"flex h-full w-full items-center justify-center text-sm text-slate-300",children:"Waiting for frame…"}):r.jsx("video",{ref:O,muted:h||ue||he,playsInline:!0,autoPlay:!0,controls:!1,className:"h-full w-full object-contain"}),r.jsx("audio",{ref:V,autoPlay:!0,hidden:!0}),!$t&&E?r.jsx(yj,{mobileHud:it,turnSeconds:T,isActiveDriver:z,idleSkipSeconds:L}):null,$t?null:r.jsx(vj,{frame:p,sensors:ne,label:d,status:ns,audioStatus:qa,levelStatus:xo,desktopLayout:Wn,layoutFormat:v,variant:y,driverLabel:b,battery:mt,showTopDown:mo,mobileHud:it,mapPosition:ln,turnTimerText:S,labelScale:w}),$t?null:r.jsx(jj,{compact:it}),!$t&&tl?r.jsx("div",{className:"pointer-events-none absolute left-1 top-1 z-40 rounded bg-black/80 px-1 py-0.5 text-[0.6rem] text-lime-200",children:`OC vis:${Yt?1:0} motors:${rn.length} fill:${Math.round(pt*100)}%`}):null,$t?null:r.jsx(Sj,{motors:rn,fill:pt,compact:it}),$t?null:r.jsx(Aj,{battery:mt,compact:it}),!$t&&bi&&mt.available?r.jsx("div",{className:"pointer-events-none absolute right-1 top-1/2 flex h-[70%] -translate-y-1/2 flex-col items-center justify-center rounded bg-black/60 px-0.5 pb-1 pt-1",children:r.jsx(yf,{visual:mt,orientation:"vertical",variant:"inline",compact:it,className:"h-full w-4"})}):null,!$t&&f?r.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-1/2 -translate-y-1/2",children:r.jsxs("div",{className:`mx-auto w-fit rounded border border-amber-300/80 bg-black/75 text-amber-200 ${it?"px-2 py-1 text-[0.6rem]":"px-3 py-1.5 text-sm"}`,children:[r.jsx("div",{className:"text-center",children:f}),r.jsx("div",{className:"pointer-events-auto mt-0",children:r.jsx(Xf,{id:"discord",label:"Join our Discord server while you wait!",url:al})})]})}):null]}),!$t&&!bi&&r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(gj,{sensors:ne}),r.jsx("div",{className:"panel-section space-y-0.5 text-sm",children:r.jsx(yf,{visual:mt,compact:it})})]})]})}function gj({sensors:a}){const l=[a?.lightBumpLeftSignal,a?.lightBumpFrontLeftSignal,a?.lightBumpCenterLeftSignal,a?.lightBumpCenterRightSignal,a?.lightBumpFrontRightSignal,a?.lightBumpRightSignal],i=l.filter(p=>p!=null).reduce((p,g)=>Math.max(p,g),1200),o=p=>Math.pow(Math.max(0,Math.min(1,(p??0)/i)),.35),f=p=>p==null||p<=0?"hsl(200 60% 18%)":`hsl(${(200+o(p)*360)%360} 100% 60%)`,d=6,h=12;return r.jsx("div",{className:"flex w-full items-center justify-center gap-0.5",children:l.map((p,g)=>{const v=o(p),y=g<d/2?-1:1,b=`${v*100}%`,j=f(p);return r.jsx("div",{className:"relative flex-1 min-w-[0]",style:{height:`${h}px`},children:r.jsx("div",{className:"h-full w-full overflow-hidden bg-slate-800",style:{borderRadius:0},children:r.jsx("div",{className:"h-full",style:{width:b,background:j,float:y===-1?"right":"left"}})})},g)})})}function vj({frame:a,sensors:l,label:i,status:o,audioStatus:f,levelStatus:d,desktopLayout:h=!0,layoutFormat:p="desktop",variant:g="default",driverLabel:v=null,battery:y,showTopDown:b=!1,mobileHud:j=!1,mapPosition:M="top-center",turnTimerText:w=null,labelScale:q=1}){l?.bumpsAndWheelDrops;const[N,E]=m.useState(()=>Date.now());m.useEffect(()=>{const P=setInterval(()=>E(Date.now()),150);return()=>clearInterval(P)},[]),a?.receivedAt&&N-a.receivedAt<200;const S=j,T=p==="mobile-portrait",z=S?"text-[0.45rem]":"text-[0.65rem]",L=S?"px-0.25 py-0.25":"px-1 py-0.5",$=S?"px-0.25 py-0.25":"px-0.5 py-0.5",O=S?"text-[0.55rem]":"text-[0.8rem]",V=S?"left-0.5 top-0.5":"left-1 top-1",X=S?"text-[0.5rem]":"text-[0.7rem]",Z=S?"px-0.5 py-0.25":"px-1 py-0.5",F=S?"left-0.5 top-1/2":"left-1 top-1/2",ae="bottom-0.5",oe={transform:`translateX(-50%) scale(${q})`,transformOrigin:"center bottom"},me="240px",G=T?.3:S?.33:.7,Q={width:me,height:me,opacity:S?.6:.7,transform:M==="top-center"?`translateX(-50%) scale(${G})`:`scale(${G})`,transformOrigin:M==="bottom-left"?"bottom left":M==="top-center"?"top center":"top right",...M==="bottom-left"?{left:"0.25rem",bottom:"0.25rem"}:M==="top-center"?{left:"50%",top:"0.25rem"}:{right:"0.25rem",top:"0.25rem"}};if(g==="none")return null;if(g==="spectator"){const P=[["Voltage",l?.voltageMv!=null?`${(l.voltageMv/1e3).toFixed(2)} V`:"--"],["Current",l?.currentMa!=null?`${l.currentMa} mA`:"--"],["Charge",l?.batteryChargeMah!=null?`${l.batteryChargeMah}`:"--"],["OI",l?.oiMode?.label||"--"]],re=!!l?.chargingSources?.homeBase,ce=l?.chargingState?.label||"",C=!!(ce&&ce.toLowerCase()!=="not charging"),_=l?.oiMode?.label||"Unknown",W=_.toLowerCase(),te=W==="full"?"bg-emerald-500/80 text-emerald-50":W==="safe"?"bg-amber-400/80 text-amber-950":W==="passive"?"bg-slate-700/80 text-slate-100":"bg-slate-700/60 text-slate-200",le=re?"bg-emerald-500/80 text-emerald-50":"bg-slate-700/70 text-slate-200",ie=C?"bg-emerald-500/80 text-emerald-50":re?"bg-amber-400/80 text-amber-950":"bg-slate-700/70 text-slate-200";return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:[r.jsx("div",{className:`absolute ${V} font-medium text-slate-100 ${z}`,children:r.jsxs("div",{className:"flex flex-col gap-0.5 leading-none",children:[r.jsxs("span",{children:["Status: ",o]}),f?r.jsxs("span",{children:["Audio: ",f]}):null,d?r.jsx("span",{className:"text-cyan-300",children:d}):null]})}),r.jsx("div",{className:`absolute ${F} flex -translate-y-1/2 flex-col gap-0.5 bg-black/70 text-slate-100 ${z} ${L}`,children:r.jsxs("div",{className:"space-y-0.5 leading-tight",children:[r.jsxs("div",{className:"flex flex-col gap-0.5 text-[0.75rem] font-semibold uppercase tracking-wide",children:[r.jsx("span",{className:`rounded px-1.5 py-0.5 ${le}`,children:re?"Docked":"Undocked"}),r.jsx("span",{className:`rounded px-1.5 py-0.5 ${ie}`,children:C?"Charging":"Not charging"}),r.jsxs("span",{className:`rounded px-1.5 py-0.5 ${te}`,children:["OI: ",_]})]}),P.map(([ue,ve])=>r.jsxs("span",{className:"flex items-center justify-between gap-0.5",children:[r.jsx("span",{className:"text-slate-400",children:ue}),r.jsx("span",{className:"font-semibold text-white",children:ve})]},ue))]})}),r.jsx("div",{className:`absolute ${ae} left-1/2`,style:oe,children:r.jsxs("div",{className:`flex items-center gap-0.5 bg-black/80 text-slate-100 ${$} ${O}`,children:[r.jsx("span",{className:"font-semibold text-white",children:i||"Unnamed Rover"}),v?r.jsxs("span",{className:"text-slate-300",children:["• ",v]}):null]})})]}),b?r.jsx("div",{className:"pointer-events-none absolute rounded",style:{...Q},children:r.jsx(vf,{sensors:l,size:240,overlay:!0})}):null]})}return r.jsxs("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:[r.jsx("div",{className:`absolute ${V} font-medium text-slate-100 ${z}`,children:r.jsxs("div",{className:"flex flex-col gap-0.5 leading-none",children:[r.jsxs("span",{children:["Status: ",o]}),f?r.jsxs("span",{children:["Audio: ",f]}):null,d?r.jsx("span",{className:"text-cyan-300",children:d}):null]})}),w?r.jsx("div",{className:`absolute left-1/2 top-0.5 -translate-x-1/2 rounded bg-black/70 text-slate-100 ${Z} ${X}`,children:w}):null,r.jsx("div",{className:`absolute ${ae} left-1/2`,style:oe,children:r.jsx("div",{className:`flex gap-0.5 bg-black/80 text-slate-100 ${$} ${O}`,children:r.jsxs("span",{children:['Rover: "',i||"Unnamed Rover",'"']})})}),b&&g!=="spectator"?r.jsx("div",{className:"pointer-events-none absolute rounded",style:{...Q},children:r.jsx(vf,{sensors:l,size:240,overlay:!0})}):null]})}function yj({mobileHud:a=!1,turnSeconds:l=null,isActiveDriver:i=!1,idleSkipSeconds:o=null}){const f=a?"text-3xl":"text-5xl",d=a?"text-xs":"text-sm",h=a?"text-[0.55rem]":"text-[0.75rem]",p=a?"px-4 py-3":"px-6 py-4",g=i&&typeof o=="number";return r.jsx("div",{className:"pointer-events-none absolute inset-0 z-30 flex items-center justify-center bg-black/55",children:r.jsxs("div",{className:`flex flex-col items-center gap-0.5 rounded border border-amber-300/80 bg-black/70 ${p}`,children:[r.jsx("div",{className:`font-semibold text-amber-200 ${f}`,children:"IT IS YOUR TURN!"}),r.jsx("div",{className:`text-amber-200/80 ${d}`,children:"Start driving!"}),g?r.jsxs("div",{className:`text-red-100/90 ${h}`,children:["Idle skip in ",o,"s"]}):null]})})}const bj={leftWheel:"Left wheel",rightWheel:"Right wheel",mainBrush:"Main brush",sideBrush:"Side brush",limiter:"Overcurrent limit"};function Sj({motors:a,fill:l=0,compact:i=!1}){if(!a?.length)return null;const o=a.map(y=>bj[y]||y),f=i?"w-[12rem] h-[3.5rem]":"w-[20rem] h-[7rem]",d=i?"px-2 py-1":"px-4 py-2",h=i?"text-lg":"text-4xl",p=i?"text-xs":"text-xl",g=Math.max(0,Math.min(1,l)),v=`${Math.round(g*100)}%`;return r.jsx("div",{className:`pointer-events-none absolute flex items-center justify-center bg-red-900/50 top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 ${f}`,children:r.jsxs("div",{className:"relative h-full w-full",children:[r.jsx("div",{className:"absolute inset-0 overflow-hidden",children:r.jsx("div",{className:"h-full bg-red-700/60",style:{width:v}})}),r.jsxs("div",{className:`relative z-10 flex h-full w-full flex-col items-center justify-center text-center font-semibold text-white animate-pulse ${h} ${d}`,children:[r.jsx("div",{children:"OVERCURRENT"}),r.jsx("div",{className:`mt-0 font-medium text-white ${p}`,children:o.join(", ")})]})]})})}function Aj({battery:a,compact:l=!1}){if(!a?.available||!a.warnActive&&!a.urgentActive)return null;const i=a.urgentActive?"BATTERY VERY LOW, DOCK THE ROVER AND CHARGE IMMEDIATELY!!":"Battery low! please dock and charge the rover soon.",o=l?"p-2 top-6":"p-4 top-10",f=l?"text-sm":"text-2xl";return r.jsx("div",{className:`pointer-events-none absolute flex items-center justify-center bg-amber-900/60 left-1/2 -translate-x-1/2 ${o}`,children:r.jsx("div",{className:`text-center font-semibold text-white animate-pulse ${f}`,children:r.jsx("div",{children:i})})})}function jj({compact:a=!1}){const{session:l}=Ve(),{sendMessage:i,onInputFocus:o,onInputBlur:f,blurChat:d,registerInputRef:h,setTypingActive:p}=Lf(),{value:g}=st("tts",{engine:"flite",voice:"rms",pitch:50}),[v,y]=m.useState(""),[b,j]=m.useState(!1),M=l?.role!=="spectator",w=l?.role==="spectator",q=l?.assignment?.roverId||null,E=!!m.useMemo(()=>l?.roster?.find(O=>String(O.id)===String(q))||null,[q,l?.roster])?.audio?.ttsEnabled,S=m.useMemo(()=>{if(!E)return null;const O=g?.engine==="espeak"?"espeak":"flite";if(O==="espeak"){let X=Number.isFinite(g?.pitch)?Math.round(g.pitch):void 0;return typeof X=="number"&&(X=Math.max(0,Math.min(99,X))),{speak:!0,engine:O,pitch:X}}const V=typeof g?.voice=="string"?g.voice:void 0;return{speak:!0,engine:O,voice:V}},[g?.engine,g?.pitch,g?.voice,E]),T=a?"pointer-events-auto absolute bottom-0.5 right-0.5 flex w-[9rem] max-w-[70vw] items-center gap-0.5 rounded bg-black/70 px-0.4 py-0.2":"pointer-events-auto absolute bottom-1 right-1 flex w-[12rem] max-w-[70vw] items-center gap-0.5 rounded bg-black/70 px-0.5 py-0.25",z=a?"min-w-0 flex-1 bg-transparent text-[0.55rem] text-slate-100 placeholder:text-slate-400 focus:outline-none":"min-w-0 flex-1 bg-transparent text-[0.7rem] text-slate-100 placeholder:text-slate-400 focus:outline-none",L=a?"rounded bg-cyan-500/80 px-0.35 py-0.2 text-[0.55rem] font-semibold text-black disabled:opacity-50":"rounded bg-cyan-500/80 px-0.5 py-0.25 text-[0.7rem] font-semibold text-black disabled:opacity-50";async function $(O){if(O.preventDefault(),!M)return;const V=v.trim();if(V){j(!0);try{await i(V,S),y(""),d(),p(!1)}catch(X){alert(X.message)}finally{j(!1)}}}return w?null:r.jsxs("form",{onSubmit:$,className:T,children:[r.jsx("input",{className:z,value:v,onChange:O=>{const V=O.target.value;y(V),p(!!V.trim())},onFocus:O=>{o(O),p(!!v.trim())},onBlur:O=>{f(O),p(!1)},onKeyDown:O=>{O.key==="Enter"&&!v.trim()&&(O.preventDefault(),d(),p(!1))},ref:O=>h(O,{target:"hud"}),placeholder:M?"Chat (TTS)":"Spectator",disabled:!M}),r.jsx("button",{type:"submit",disabled:!M||b,className:L,children:"Speak"})]})}function Qf({layoutFormat:a="desktop"}){const{session:l}=Ve(),{state:{song:i,lastControlIntentAt:o},overcurrentLimiter:f}=Dt(),[d,h]=m.useState(()=>Date.now()),[p,g]=m.useState(!1),[v,y]=m.useState(null),b=m.useRef({active:!1,roverId:null});m.useEffect(()=>{if(l?.mode!=="turns")return;const te=setInterval(()=>h(Date.now()),250);return()=>clearInterval(te)},[l?.mode]);const j=l?.assignment?.roverId,w=!!(j&&l?.roster?l.roster.find(te=>String(te.id)===String(j)):null)?.media?.audioPublishUrl,q=j?l?.turnQueues?.[j]:null,N=l?.socketId||null,E=j?l?.activeDrivers?.[j]:null,S=!!(N&&E===N),T=m.useMemo(()=>{const te=q?.queue||[];if(!te.length||!q?.current||te.length<=1)return null;const le=te.findIndex(ie=>ie===q.current);return le===-1?te[0]||null:te[(le+1)%te.length]||null},[q?.queue,q?.current]),z=!!(N&&T===N),L=q?.deadline||null,$=q?.idleDeadline||null,O=L?L-d:null,V=$?$-d:null,X=l?.mode==="turns"&&z&&O!=null&&O<=5e3&&O>0,Z=l?.mode!=="turns"||S||X,F=O!=null&&Number.isFinite(O)?Math.max(0,Math.ceil(O/1e3)):null,ae=V!=null&&Number.isFinite(V)?Math.max(0,Math.ceil(V/1e3)):null,oe=S?F!=null?`${F}s left`:null:z&&F!=null?`Your turn in ${F}s`:null,me=j?[...Z?[{type:"rover",id:j,key:j}]:[],...w?[{type:"rover",id:`${j}-audio`,key:`${j}-audio`}]:[]]:[],G=ri(me),k=j&&Z?G[j]:null,Q=j&&w?G[`${j}-audio`]:null,P=$f(j?[j]:[],{enabled:!!j,version:l?.mode}),re=j&&P[j]||null,ce=es(j),C=j&&l?.roster?l.roster.find(te=>String(te.id)===String(j)):null,_=C?.battery??null,W=C?.name||(j?`Rover ${j}`:"");return m.useEffect(()=>{if(l?.mode!=="turns"){g(!1),y(null),b.current={active:!1,roverId:null};return}const te=b.current,le=S&&!te.active,ie=S&&j&&j!==te.roverId;le||ie?(g(!0),y(Date.now())):!S&&te.active&&(g(!1),y(null)),b.current={active:S,roverId:j}},[S,j,l?.mode]),m.useEffect(()=>{!p||!v||o>v&&g(!1)},[o,v,p]),r.jsx("section",{className:"panel",children:j?r.jsx(ci,{sessionInfo:k,videoMode:Z?"whep":"snapshot",snapshotFeed:re,audioSessionInfo:Q,label:W,telemetryFrame:ce,batteryConfig:_,layoutFormat:a,overcurrentLimiter:f,songNote:i?.note,qualityNotice:Z?null:"Preview feed (low FPS) until your turn.",showTurnCue:p,turnTimerText:oe,turnSeconds:F,isActiveDriver:S,idleSkipSeconds:ae}):r.jsxs("div",{className:"panel-muted content-center text-center text-sm text-slate-400 aspect-[4/3]",children:[r.jsx("p",{children:"You are not assigned to a rover."}),r.jsx("p",{className:"mt-0",children:r.jsx("a",{href:"/spectate",className:"text-blue-400 underline hover:text-blue-500",children:"Click here to visit the spectator page."})})]})})}function bf({label:a,tone:l="muted"}){const i=l==="success"?"bg-emerald-900 text-emerald-100":l==="warn"?"bg-amber-900 text-amber-100":"bg-slate-800 text-slate-200";return r.jsx("span",{className:`rounded px-1 py-0.5 text-xs font-semibold leading-none ${i}`,children:a})}function ro(a){if(!Number.isFinite(a))return 0;const l=a%360;return l<0?l+360:l}function Nj(a){if(!Array.isArray(a)||a.length<3)return 0;const[l,i,o]=a,f=Math.max(0,Math.min(255,Number(l)))/255,d=Math.max(0,Math.min(255,Number(i)))/255,h=Math.max(0,Math.min(255,Number(o)))/255,p=Math.max(f,d,h),g=Math.min(f,d,h),v=p-g;if(v===0)return 0;let y=0;return p===f?y=(d-h)/v%6:p===d?y=(h-f)/v+2:y=(f-d)/v+4,ro(Math.round(y*60))}function _p(a){const l=ro(a),i=1,o=1-Math.abs(l/60%2-1);let f=0,d=0,h=0;return l<60?(f=i,d=o):l<120?(f=o,d=i):l<180?(d=i,h=o):l<240?(d=o,h=i):l<300?(f=o,h=i):(f=i,h=o),[Math.round(f*255),Math.round(d*255),Math.round(h*255)]}function Op(a){return a?Array.isArray(a.hsColor)?ro(Number(a.hsColor[0])):Array.isArray(a.rgbColor)?Nj(a.rgbColor):0:0}function wj({entity:a,connected:l,onToggle:i,onSetColor:o}){const f=a.state==="unavailable"||!a.available,d=a.state==="on",h=a.type==="light"&&a.supportsColor,p=f?"warn":d?"success":"muted",g=f?"Unavailable":d?"On":"Off",v=!l||f,y=v||!h,[b,j]=m.useState(()=>Op(a)),M=m.useRef(b),w=m.useRef(!1),q=f?"border-slate-800 bg-slate-900 text-slate-400 cursor-not-allowed":d?"border-emerald-700 bg-emerald-900/80 text-emerald-50 hover:bg-emerald-800":"border-rose-800 bg-rose-900/80 text-rose-50 hover:bg-rose-800";m.useEffect(()=>{if(!h||w.current)return;const L=Op(a);M.current=L,j(L)},[a.rgbColor,a.hsColor,h]);const N=L=>{const $=ro(Number(L.target.value));M.current=$,j($)},E=()=>{y||!o||o(a.id,_p(M.current))},S=L=>{L.stopPropagation()},z=`rgb(${(h?_p(M.current):[255,255,255]).join(",")})`;return r.jsxs("button",{type:"button",onClick:()=>i(a.id),disabled:v,className:`relative flex min-w-[12rem] flex-[1_1_12rem] items-start justify-between gap-0.5 rounded px-1 py-0.5 text-left transition-colors ${q} disabled:opacity-60 disabled:hover:bg-inherit`,children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex items-center gap-0.5 text-sm leading-normal",children:[r.jsx("span",{className:"truncate font-semibold text-white",children:a.name||a.id}),h&&r.jsxs(r.Fragment,{children:[r.jsx(bf,{label:g,tone:p}),!l&&r.jsx("span",{className:"text-xs text-amber-200",children:"Offline"})]})]}),h?r.jsx("div",{className:"-mt-0.5 w-full",onClick:S,onPointerDown:L=>{S(L),w.current=!0},onPointerUp:L=>{S(L),w.current=!1,E()},onPointerCancel:L=>{S(L),w.current=!1,E()},onKeyUp:L=>{S(L),E()},onBlur:E,children:r.jsx("div",{className:"relative w-full",children:r.jsx("input",{type:"range",min:"0",max:"360",step:"1",value:b,onChange:N,disabled:y,"aria-label":`Set color for ${a.name||a.id}`,className:"ha-hue-slider w-full"})})}):r.jsxs("div",{className:"flex items-center gap-0.5 text-xs text-slate-400",children:[r.jsx(bf,{label:g,tone:p}),!l&&r.jsx("span",{className:"text-amber-200",children:" · Offline"})]})]}),h&&r.jsx("span",{className:"pointer-events-none absolute right-1 top-1 h-2.5 w-2.5 rounded-full border border-white/60",style:{backgroundColor:z}}),!h&&r.jsx("div",{className:"self-center text-xs font-semibold text-white/90",children:d?"Turn off":"Turn on"})]})}function ig(){const{state:{keymap:a}}=Dt(),{session:l,homeAssistantToggle:i,homeAssistantSetLightColor:o}=Ve(),f=l?.homeAssistant,d=m.useMemo(()=>f?.entities||[],[f?.entities]),h=An(a?.homeAssistantOn?.[0]),p=An(a?.homeAssistantOff?.[0]);if(!f?.enabled)return r.jsxs("section",{className:"panel-section space-y-0.5 text-sm text-slate-400",children:[r.jsx("p",{className:"text-slate-300",children:"Room Controls"}),r.jsx("p",{className:"text-slate-500",children:"Not configured on the server."})]});if(d.length===0)return r.jsxs("section",{className:"panel-section space-y-0.5 text-sm text-slate-400",children:[r.jsx("p",{className:"text-slate-300",children:"Room Controls"}),r.jsx("p",{className:"text-slate-500",children:"No lights or switches configured."})]});const g=!!f?.connected;return r.jsxs("section",{className:"panel-section space-y-0.5 text-base",children:[r.jsxs("header",{className:"flex items-center justify-between gap-0.5 text-sm text-slate-400",children:[r.jsxs("div",{className:"flex items-center gap-0.5",children:[r.jsx("p",{children:"Room Controls"}),r.jsx("span",{className:"text-xs text-slate-500",children:d.length}),r.jsxs("div",{className:"flex items-center gap-0.5 text-xs text-slate-300 background-black",children:[r.jsxs("span",{className:"flex items-center gap-0.5",children:[r.jsx("span",{children:"On"}),h?r.jsx(Bp,{label:h}):null]}),r.jsxs("span",{className:"flex items-center gap-0.5",children:[r.jsx("span",{children:"Off"}),p?r.jsx(Bp,{label:p}):null]})]})]}),r.jsx(bf,{label:g?"Connected":"Offline",tone:g?"success":"warn"})]}),r.jsx("div",{className:"flex flex-wrap gap-0.5",children:d.map(v=>r.jsx(wj,{entity:v,connected:g,onToggle:i,onSetColor:o},v.id))})]})}function Bp({label:a}){return a?r.jsx("span",{className:"rounded border border-white/40 px-1 text-[0.7rem] text-white",children:a}):null}function rg(){const{login:a,setRole:l}=Ve(),[i,o]=m.useState(""),[f,d]=m.useState(""),[h,p]=m.useState(!1);async function g(v){v.preventDefault(),p(!0);try{await a(i,f),o(""),d("")}catch(y){alert(y.message)}finally{p(!1)}}return r.jsxs("div",{className:"panel-section space-y-0.5 text-base",children:[r.jsx("p",{className:"text-sm text-slate-400",children:"Admin login"}),r.jsxs("form",{className:"flex flex-col gap-0.5",onSubmit:g,children:[r.jsx("input",{className:"field-input",placeholder:"Username",value:i,onChange:v=>o(v.target.value)}),r.jsx("input",{className:"field-input",placeholder:"Password",type:"password",value:f,onChange:v=>d(v.target.value)}),r.jsx("button",{type:"submit",disabled:h,className:"button-dark w-full disabled:opacity-50",children:h?"Logging in…":"Login"})]})]})}function zp(...a){return a.filter(Boolean).join(" ")}function Ej(a){const l=a?.batteryState?.percentDisplay;return l==null?"--":`${l}%`}function Cj(a){return a?.batteryState?a.batteryState.urgentActive?"text-red-400":a.batteryState.warnActive?"text-amber-300":"text-emerald-300":"text-slate-400"}function qj({title:a,roster:l=[],emptyText:i="No roster data.",renderActions:o=null}){return r.jsxs("div",{className:"space-y-0.5 text-sm",children:[a&&r.jsx("p",{className:"text-sm text-slate-400",children:a}),l.length===0?r.jsx("p",{className:"text-sm text-slate-500",children:i}):r.jsx("ul",{className:"space-y-0.5 text-sm",children:l.map(f=>r.jsxs("li",{className:zp("surface flex flex-wrap items-center justify-between gap-0.5",f.locked&&"bg-red-900/40"),children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-slate-200",children:f.name}),r.jsxs("p",{className:"text-xs text-slate-500 flex flex-wrap items-center gap-0.5",children:[r.jsx("span",{children:f.locked?"locked":"free"}),f.lockReason&&r.jsx("span",{className:"rounded bg-black/30 px-1",children:f.lockReason}),r.jsxs("span",{className:zp("font-semibold",Cj(f)),children:["Battery ",Ej(f)]})]})]}),o?o(f):null]},f.id))})]})}const Mj=[{key:"open",label:"Open"},{key:"turns",label:"Turns"},{key:"admin",label:"Admin"},{key:"lockdown",label:"Lockdown"}];function kj(){const{session:a,lockRover:l,setMode:i,requestControl:o,setCommunityGoal:f,setAdminReason:d,rebootRover:h,rebootServer:p,adminLogs:g,llmCommentaryStatus:v}=Ve(),y=m.useMemo(()=>a?.roster??[],[a?.roster]),[b,j]=m.useState({}),[M,w]=m.useState({}),[q,N]=m.useState(!1),E=a?.health||null,S=a?.communityGoal?.text||"",T=a?.communityGoal?.updatedAt||null,[z,L]=m.useState(S),$=a?.adminReason?.text||"",O=a?.adminReason?.updatedAt||null,[V,X]=m.useState($),Z=a?.role==="admin"||a?.role==="lockdown"||a?.role==="lockdown-admin",F=a?.mode??"open",ae=async(_,W)=>{try{await l(_,W),j(te=>({...te,[_]:W}))}catch(te){alert(te.message)}},oe=async _=>{const W=_.target.value;try{await i(W)}catch(te){alert(te.message)}},me=async _=>{try{await o(_,{force:!0})}catch(W){alert(W.message)}},G=async _=>{if(!(!_?.id||!window.confirm(`Reboot rover "${_.name||_.id}" now?`))){w(te=>({...te,[_.id]:!0}));try{await h(_.id)}catch(te){alert(te.message)}finally{w(te=>({...te,[_.id]:!1}))}}},k=async()=>{if(window.confirm("Reboot the server host now? This will disconnect all users.")){N(!0);try{await p()}catch(W){alert(W.message),N(!1)}}},Q=async()=>{try{await f(z)}catch(_){alert(_.message)}},P=async()=>{try{await f(null)}catch(_){alert(_.message)}},re=async()=>{try{await d(V)}catch(_){alert(_.message)}},ce=async()=>{try{await d(null)}catch(_){alert(_.message)}};m.useEffect(()=>{L(S)},[S]),m.useEffect(()=>{X($)},[$]);const C=m.useMemo(()=>{const _={};return y.forEach(W=>{_[W.id]=b[W.id]??W.locked}),_},[y,b]);return Z?r.jsxs("section",{className:"panel-section space-y-0.5 text-base",children:[r.jsxs("div",{className:"flex items-center justify-between gap-0.5 text-sm",children:[r.jsx("span",{children:"Admin controls"}),r.jsx("select",{value:F,onChange:oe,className:"field-input text-sm",children:Mj.map(_=>r.jsx("option",{value:_.key,children:_.label},_.key))})]}),r.jsx("div",{className:"flex gap-0.5 text-xs",children:r.jsx("button",{type:"button",onClick:k,disabled:q,className:"button-danger disabled:cursor-not-allowed disabled:opacity-60",children:q?"Server rebooting...":"Reboot Server"})}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-400",children:[r.jsx("span",{children:"Community goal"}),T?r.jsxs("span",{children:["Updated ",new Date(T).toLocaleString()]}):null]}),r.jsx("input",{type:"text",value:z,onChange:_=>L(_.target.value),placeholder:"Set a community goal",className:"field-input text-sm"}),r.jsxs("div",{className:"flex gap-0.5 text-xs",children:[r.jsx("button",{type:"button",onClick:Q,className:"button-dark",children:"Set goal"}),r.jsx("button",{type:"button",onClick:P,className:"button-danger",children:"Clear"})]})]}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-400",children:[r.jsx("span",{children:"Admin mode reason"}),O?r.jsxs("span",{children:["Updated ",new Date(O).toLocaleString()]}):null]}),r.jsx("textarea",{value:V,onChange:_=>X(_.target.value),placeholder:"Set an admin mode reason",className:"field-input text-sm min-h-[3.5rem]"}),r.jsxs("div",{className:"flex gap-0.5 text-xs",children:[r.jsx("button",{type:"button",onClick:re,className:"button-dark",children:"Set reason"}),r.jsx("button",{type:"button",onClick:ce,className:"button-danger",children:"Clear"})]})]}),r.jsx(qj,{roster:y,renderActions:_=>r.jsxs("div",{className:"flex flex-wrap gap-0.5 text-xs",children:[r.jsx("button",{type:"button",onClick:()=>ae(_.id,!C[_.id]),className:"button-dark",children:C[_.id]?"Unlock":"Lock"}),r.jsx("button",{type:"button",onClick:()=>me(_.id),className:"button-dark",children:"Force"}),r.jsx("button",{type:"button",onClick:()=>G(_),disabled:!!M[_.id],className:"button-danger disabled:cursor-not-allowed disabled:opacity-60",children:M[_.id]?"Rebooting...":"Reboot"})]})}),r.jsx(Tj,{health:E}),r.jsx(Rj,{status:v}),r.jsx(Dj,{entries:g})]}):null}function Rj({status:a}){if(!a)return r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("div",{className:"panel-muted text-xs uppercase",children:"LLM Commentary"}),r.jsx("div",{className:"surface text-xs text-slate-300",children:"No status received yet."})]});const l=a.lastTickAt?new Date(a.lastTickAt).toLocaleString():"never",i=a.nextRunAt?new Date(a.nextRunAt).toLocaleString():"n/a",o=a.lastPostedAt?new Date(a.lastPostedAt).toLocaleString():"never",f=a.lastSnapshotSummary||{},d=a.lastOutcome==="failed"?"text-red-300":a.lastOutcome==="posted"?"text-emerald-300":"text-slate-300";return r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("div",{className:"panel-muted text-xs uppercase",children:"LLM Commentary"}),r.jsxs("div",{className:"surface space-y-0.5 text-xs text-slate-200",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{children:"Enabled"}),r.jsx("span",{children:a.enabled?"yes":"no"})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{children:"Running"}),r.jsx("span",{children:a.running?"yes":"no"})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{children:"In flight"}),r.jsx("span",{children:a.inFlight?"yes":"no"})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{children:"Model"}),r.jsx("span",{className:"text-slate-300",children:a.model||"--"})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{children:"Server"}),r.jsx("span",{className:"text-slate-300",children:a.ollamaUrl||"--"})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{children:"Frequency"}),r.jsxs("span",{children:[a.frequencyMs," ms"]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{children:"Tick count"}),r.jsx("span",{children:a.tickCount??0})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{children:"Last outcome"}),r.jsx("span",{className:d,children:a.lastOutcome||"--"})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{children:"Last reason"}),r.jsx("span",{className:"text-slate-300",children:a.lastReason||"--"})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{children:"Last tick"}),r.jsx("span",{className:"text-slate-300",children:l})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{children:"Next run"}),r.jsx("span",{className:"text-slate-300",children:i})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{children:"Last posted"}),r.jsx("span",{className:"text-slate-300",children:o})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{children:"Prompt chars"}),r.jsx("span",{children:a.lastPromptChars??0})]})]}),r.jsxs("div",{className:"surface space-y-0.5 text-xs text-slate-300",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{children:"Snapshot active drivers"}),r.jsx("span",{children:f.activeDrivers??0})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{children:"Snapshot rovers"}),r.jsx("span",{children:f.rovers??0})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{children:"Snapshot chat msgs"}),r.jsx("span",{children:f.chatMessages??0})]})]}),a.lastError?r.jsxs("div",{className:"surface text-xs text-red-300 break-words",children:["Error: ",a.lastError]}):null,a.lastGeneratedText?r.jsxs("div",{className:"surface text-xs text-slate-200 break-words",children:["Generated: ",a.lastGeneratedText]}):null,a.lastPostedText?r.jsxs("div",{className:"surface text-xs text-emerald-200 break-words",children:["Posted: ",a.lastPostedText]}):null,r.jsxs("details",{className:"surface text-xs text-slate-200",children:[r.jsx("summary",{className:"cursor-pointer select-none text-slate-300",children:"Most recent system prompt"}),r.jsx("pre",{className:"mt-0.5 whitespace-pre-wrap break-words text-[0.72rem] text-slate-200",children:a.lastSystemPrompt||"No prompt read yet."})]}),r.jsxs("details",{className:"surface text-xs text-slate-200",children:[r.jsx("summary",{className:"cursor-pointer select-none text-slate-300",children:"Most recent info snapshot"}),r.jsx("pre",{className:"mt-0.5 whitespace-pre-wrap break-words text-[0.72rem] text-slate-200",children:a.lastInfoSnapshot?JSON.stringify(a.lastInfoSnapshot,null,2):"No snapshot captured yet."})]})]})}function Tj({health:a}){if(!a)return null;const l=a.replay||{sources:[],readyCount:0,totalCount:0},i=a.snapshots||{rovers:[],rooms:[]},o=`${l.readyCount}/${l.totalCount} sources ready`,f=i.rovers.filter(h=>h.stale).length,d=i.rooms.filter(h=>h.stale).length;return r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("div",{className:"panel-muted text-xs uppercase",children:"Health"}),r.jsxs("div",{className:"surface space-y-0.5 text-xs text-slate-200",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{children:"Replay segments"}),r.jsx("span",{className:"text-slate-400",children:o})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{children:"Rover snapshots"}),r.jsxs("span",{className:f?"text-amber-300":"text-emerald-300",children:[i.rovers.length-f,"/",i.rovers.length," ok"]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{children:"Room cameras"}),r.jsxs("span",{className:d?"text-amber-300":"text-emerald-300",children:[i.rooms.length-d,"/",i.rooms.length," ok"]})]})]}),r.jsx("div",{className:"space-y-0.5 text-xs text-slate-300",children:l.sources.map(h=>r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{children:h.label}),r.jsxs("span",{className:h.ready?"text-emerald-300":"text-amber-300",children:[h.recentCount,"/",h.neededCount]})]},`${h.type}:${h.id}`))}),r.jsx("div",{className:"space-y-0.5 text-xs text-slate-300",children:i.rovers.map(h=>r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{children:h.name}),r.jsx("span",{className:h.stale?"text-amber-300":"text-emerald-300",children:h.stale?"stale":"ok"})]},`rover:${h.id}`))}),r.jsx("div",{className:"space-y-0.5 text-xs text-slate-300",children:i.rooms.map(h=>r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{children:h.name}),r.jsx("span",{className:h.stale?"text-amber-300":"text-emerald-300",children:h.error?"error":h.stale?"stale":"ok"})]},`room:${h.id}`))})]})}function Dj({entries:a}){const l=a||[];return r.jsxs("div",{className:"panel-section space-y-0.5 text-base",children:[r.jsxs("div",{className:"flex items-center justify-between text-sm text-slate-400",children:[r.jsx("span",{children:"Admin IP log"}),r.jsx("span",{children:l.length})]}),r.jsx("div",{className:"surface h-64 overflow-y-auto font-mono text-xs",children:l.length===0?r.jsx("p",{children:"No admin log entries yet."}):l.slice().reverse().map(i=>r.jsxs("div",{className:"surface",children:[r.jsx("span",{className:"text-amber-400",children:i.ts?new Date(i.ts).toLocaleTimeString():"--"})," ",i.label&&r.jsxs("span",{className:"text-teal-400",children:["[",i.label,"]"]})," ",r.jsx("span",{className:"text-slate-200",children:i.message})," ",i.ip&&r.jsx("span",{className:"text-cyan-300",children:i.ip})," ",i.meta&&r.jsx("span",{className:"text-slate-500",children:JSON.stringify(i.meta)})]},i.id))}),r.jsx("p",{className:"text-xs text-slate-500",children:"Admin-only log stream; IPs never appear in user data."})]})}const _j=[{id:"driveForward",label:"Drive Forward",group:"Driving"},{id:"driveBackward",label:"Drive Backward",group:"Driving"},{id:"driveLeft",label:"Turn Left",group:"Driving"},{id:"driveRight",label:"Turn Right",group:"Driving"},{id:"boostModifier",label:"Boost Modifier",group:"Driving"},{id:"slowModifier",label:"Slow Modifier",group:"Driving"},{id:"auxMainForward",label:"Main Brush Forward",group:"Aux Motors"},{id:"auxMainReverse",label:"Main Brush Reverse",group:"Aux Motors"},{id:"auxSideForward",label:"Side Brush Forward",group:"Aux Motors"},{id:"auxSideReverse",label:"Side Brush Reverse",group:"Aux Motors"},{id:"auxVacuumFast",label:"Vacuum Max",group:"Aux Motors"},{id:"auxVacuumSlow",label:"Vacuum Low",group:"Aux Motors"},{id:"auxAllForward",label:"All Aux Forward",group:"Aux Motors"},{id:"cameraUp",label:"Camera Up",group:"Camera"},{id:"cameraDown",label:"Camera Down",group:"Camera"},{id:"nightVisionToggle",label:"Toggle Night Vision",group:"Camera"},{id:"hornHonk",label:"Horn (Hold)",group:"Audio"},{id:"driveMacro",label:"Drive Macro",group:"Macros"},{id:"dockMacro",label:"Dock Macro",group:"Macros"},{id:"chatFocus",label:"Toggle Chat",group:"Chat"},{id:"songNoteUp",label:"Song Note Up",group:"Audio"},{id:"songNoteDown",label:"Song Note Down",group:"Audio"},{id:"homeAssistantOn",label:"Room Controls On (Cycle)",group:"Room Controls"},{id:"homeAssistantOff",label:"Room Controls Off (Cycle)",group:"Room Controls"}];function Oj(a){return a.reduce((l,i)=>((l[i.group]||(l[i.group]=[])).push(i),l),{})}function Bj(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(0,Math.min(500,i)):l}const Kf=5,ui=500,fi=1,Ff=100;function zj(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(Kf,Math.min(ui,i)):l}function Fr(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(fi,Math.min(Ff,i)):l}function Lj(a){const i=(Fr(a,a)-fi)/(Ff-fi),o=ui-i*(ui-Kf);return Math.round(o)}function Uj(a){const l=zj(a,a),i=(ui-l)/(ui-Kf),o=fi+i*(Ff-fi);return Math.round(o)}function Hj(a){const[l,i]=m.useState(null);return m.useEffect(()=>{if(!l)return;function o(f){if(f.preventDefault(),f.key==="Escape"){i(null);return}const d=xi(f.key??"");d&&(a(l,d,f),i(null))}return window.addEventListener("keydown",o,{capture:!0}),()=>window.removeEventListener("keydown",o,{capture:!0})},[l,a]),{active:l,startCapture:i,cancel:()=>i(null)}}function Lr({label:a,description:l,value:i,onChange:o,min:f=0,max:d=500,step:h=5}){return r.jsxs("label",{className:"surface-muted block p-0.5",children:[r.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-300",children:[r.jsx("span",{className:"font-semibold text-slate-100",children:a}),r.jsx("input",{type:"number",min:f,max:d,value:i,onChange:p=>o(p.target.value),className:"w-16 rounded border border-slate-700 bg-slate-900 px-1 py-[2px] text-right text-[0.75rem] font-mono text-slate-100"})]}),l&&r.jsx("p",{className:"text-[0.65rem] text-slate-500",children:l}),r.jsxs("div",{className:"mt-0 flex items-center gap-0.5",children:[r.jsx("input",{type:"range",min:f,max:d,step:h,value:i,onChange:p=>o(p.target.value),className:"h-2 flex-1 accent-emerald-400"}),r.jsx("span",{className:"w-12 text-right text-[0.75rem] font-mono text-slate-400",children:i})]})]})}function Vj(){const{state:{keymap:a},actions:{updateKeyBinding:l,resetKeyBindings:i}}=Dt(),{value:o,save:f}=st("inputs",Sn),d={...Sn.keyboard,...o.keyboard??{}},h=m.useMemo(()=>typeof d.tiltSpeed=="number"?Fr(d.tiltSpeed,Sn.keyboard.tiltSpeed):typeof d.tiltIntervalMs=="number"?Fr(Uj(d.tiltIntervalMs),Sn.keyboard.tiltSpeed):Sn.keyboard.tiltSpeed,[d.tiltIntervalMs,d.tiltSpeed]),p=m.useMemo(()=>Oj(_j),[]),{active:g,startCapture:v,cancel:y}=Hj((w,q)=>{l(w,q)}),b=m.useCallback(w=>a?.[w]?.[0]||ni[w]?.[0]||"",[a]),j=m.useCallback((w,q)=>{const N=Sn.keyboard,E=Bj(q,N[w]);f(S=>({...S??{},keyboard:{...S?.keyboard??N,[w]:E}}))},[f]),M=m.useCallback(w=>{const q=Sn.keyboard,N=Fr(w,q.tiltSpeed),E=Lj(N);f(S=>({...S??{},keyboard:{...S?.keyboard??q,tiltSpeed:N,tiltIntervalMs:E}}))},[f]);return r.jsxs("section",{className:"panel-section space-y-0.5 text-sm",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-xs text-slate-400",children:"Keyboard layout"}),r.jsx("p",{className:"text-[0.7rem] text-slate-500",children:"Per-browser · click to change a binding"})]}),r.jsx("button",{type:"button",onClick:()=>i(),className:"button-dark text-xs",children:"Reset defaults"})]}),r.jsxs("div",{className:"space-y-0.5 surface",children:[r.jsx("p",{className:"text-[0.7rem] text-slate-500",children:"Keyboard speeds"}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(Lr,{label:"Base speed",description:"Normal driving speed",value:d.baseSpeed,onChange:w=>j("baseSpeed",w)}),r.jsx(Lr,{label:"Turbo speed",description:"Used when holding the boost modifier",value:d.turboSpeed,onChange:w=>j("turboSpeed",w)}),r.jsx(Lr,{label:"Precision speed",description:"Used when holding the precision modifier",value:d.precisionSpeed,onChange:w=>j("precisionSpeed",w)})]})]}),r.jsxs("div",{className:"space-y-0.5 surface",children:[r.jsx("p",{className:"text-[0.7rem] text-slate-500",children:"Camera tilt"}),r.jsx(Lr,{label:"Tilt speed",description:"Higher = faster when holding tilt keys",value:h,onChange:M,min:1,max:100,step:1})]}),r.jsx("div",{className:"space-y-0.5",children:Object.entries(p).map(([w,q])=>r.jsxs("div",{className:"space-y-0.5 surface",children:[r.jsx("p",{className:"text-[0.75rem] text-slate-400",children:w}),r.jsx("div",{className:"space-y-0.5",children:q.map(N=>{const E=b(N.id),S=g===N.id;return r.jsxs("div",{className:"surface-muted flex items-center justify-between text-xs",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold text-slate-100",children:N.label}),r.jsx("p",{className:"text-[0.65rem] text-slate-400",children:An(E)})]}),r.jsxs("div",{className:"flex items-center gap-0.5",children:[S&&r.jsx("button",{type:"button",onClick:()=>y(),className:"button-danger text-[0.7rem]",children:"Cancel"}),r.jsx("button",{type:"button",onClick:()=>v(N.id),className:`${S?"px-0.5 py-0.5 bg-emerald-500 text-emerald-950 hover:bg-emerald-400":"button-dark"} text-[0.7rem] font-medium transition-colors`,children:S?"Press a key…":"Change"})]})]},N.id)})})]},w))})]})}const Kn=new Intl.NumberFormat(void 0,{maximumFractionDigits:2}),Yj=[{id:"drive",label:"Drive stick",kind:"axisPair",section:"Driving",invertDefaults:{invertX:!1,invertY:!0}},{id:"cameraTilt",label:"Camera tilt",kind:"axis",section:"Camera",invertDefaults:{invert:!0}},{id:"mainBrush",label:"Main brush",kind:"axis",section:"Brushes",invertDefaults:{invert:!1}},{id:"sideBrush",label:"Side brush",kind:"axis",section:"Brushes",invertDefaults:{invert:!1}},{id:"vacuum",label:"Vacuum",kind:"button",section:"Aux buttons"},{id:"allAux",label:"All aux",kind:"button",section:"Aux buttons"},{id:"mainReverse",label:"Main reverse toggle",kind:"button",section:"Brush toggles"},{id:"sideReverse",label:"Side reverse toggle",kind:"button",section:"Brush toggles"},{id:"driveMacro",label:"Drive macro",kind:"button",section:"Mode macros"},{id:"dockMacro",label:"Dock macro",kind:"button",section:"Mode macros"},{id:"nightVisionToggle",label:"Night vision toggle",kind:"button",section:"Camera"}],Lp=.45,$j=.6;function Ps({label:a,description:l,min:i,max:o,step:f,value:d,onChange:h}){return r.jsxs("label",{className:"surface-muted block p-0.5",children:[r.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-300",children:[r.jsx("span",{className:"font-semibold text-slate-100",children:a}),r.jsx("span",{className:"font-mono text-slate-400",children:Kn.format(d)})]}),l&&r.jsx("p",{className:"text-[0.65rem] text-slate-500",children:l}),r.jsx("input",{type:"range",min:i,max:o,step:f,value:d,onChange:p=>h(Number(p.target.value)),className:"mt-0 w-full accent-emerald-400"})]})}function Gj(a){if(!a)return"Unassigned";if(a.kind==="axisPair"){const l=`${a.invertX?"X inv ":""}${a.invertY?"Y inv":""}`.trim();return`Axes ${a.x}/${a.y}${l?` (${l})`:""}`}if(a.kind==="axis")return`Axis ${a.index}${a.invert?" (inv)":""}`;if(a.kind==="button")return`Button ${a.index}`;if(a.kind==="buttonAxis")return`Button ${a.index} (analog)`;if(a.kind==="axisButton"){const l=a.direction<0?"<":">";return`Axis ${a.index} ${l} ${Kn.format(a.threshold??.6)}`}return"Unassigned"}function Xj(a){return a.reduce((l,i)=>((l[i.section]||(l[i.section]=[])).push(i),l),{})}function Qj(a,l){if(!a||a.length===0)return null;if(l){const i=a.find(o=>o.signature===l);if(i)return i}return a[0]}function Kj(a){return{axes:Array.from(a.axes??[]),buttons:(a.buttons??[]).map(l=>({pressed:!!l?.pressed,value:typeof l?.value=="number"?l.value:l?.pressed?1:0}))}}function Fj(a,l,i){const o=(a.axes??[]).map((d,h)=>({index:h,delta:Math.abs((d??0)-(l.axes?.[h]??0)),value:d}));if(o.sort((d,h)=>h.delta-d.delta),i.kind==="axisPair"){const d=o.filter(h=>h.delta>Lp).slice(0,2);return d.length<2?null:{kind:"axisPair",x:d[0].index,y:d[1].index,...i.invertDefaults??{}}}const f=o.find(d=>d.delta>Lp);return f?{kind:"axis",index:f.index,...i.invertDefaults??{}}:null}function Zj(a,l,i){const o=a.buttons??[];for(let d=0;d<o.length;d+=1){const h=o[d],p=typeof h?.value=="number"?h.value:h?.pressed?1:0;if(h?.pressed||p>$j)return i.kind==="axis"?{kind:"buttonAxis",index:d}:{kind:"button",index:d}}const f=a.axes??[];for(let d=0;d<f.length;d+=1){const h=f[d]??0,p=Math.abs(h-(l.axes?.[d]??0));if(Math.abs(h)>.7&&p>.5)return i.kind==="axis"?{kind:"axis",index:d,...i.invertDefaults??{}}:{kind:"axisButton",index:d,direction:h>=0?1:-1,threshold:.6}}return null}function Jj(a,l,i){if(!a)return null;if(i.kind==="axis"||i.kind==="axisPair"){const o=Fj(a,l,i);if(o)return o}return Zj(a,l,i)}function Ij(){const a=qA(),{value:l,save:i}=st("gamepad",ja),[o,f]=m.useState(null),d=m.useRef(null),h=m.useMemo(()=>Xj(Yj),[]),p=m.useMemo(()=>Qj(a.pads,l.activeSignature),[a.pads,l.activeSignature]),g=p?.signature??null,v=m.useMemo(()=>g?l?.profiles?.[g]??l?.defaults?.profile??Fn:l?.defaults?.profile??Fn,[g,l?.defaults?.profile,l?.profiles]);m.useEffect(()=>{!p||!g||l?.profiles?.[g]||i(N=>{const E=N??ja;if(E.profiles?.[g])return E;const S=E?.defaults?.profile??Fn,T=Gx(p,S);return{...E,profiles:{...E.profiles??{},[g]:T}}})},[p,g,l?.profiles,i]),m.useEffect(()=>{d.current=null},[o,g]),m.useEffect(()=>{if(!o||!p)return;if(!d.current){d.current=Kj(p);return}const N=Jj(p,d.current,o);N&&(i(E=>{const S=E??ja,T=S.profiles?.[g]??S?.defaults?.profile??Fn,z={...T,bindings:{...T.bindings??{},[o.id]:{...T.bindings?.[o.id]??{},kind:o.kind,sources:[N]}}};return{...S,profiles:{...S.profiles??{},[g]:z}}}),f(null))},[p,g,o,i]);const y=m.useCallback(N=>{i(E=>({...E??ja,activeSignature:N||null}))},[i]),b=m.useCallback(N=>{i(E=>{const S=E??ja,T=(g&&S.profiles?.[g])??S?.defaults?.profile??Fn,z={...T,calibration:{...T.calibration??{},...N}};return g?{...S,profiles:{...S.profiles??{},[g]:z}}:{...S,defaults:{...S.defaults??{},profile:z}}})},[g,i]),j=m.useCallback((N,E)=>{i(S=>{const T=S??ja,z=(g&&T.profiles?.[g])??T?.defaults?.profile??Fn,L=E(z.bindings?.[N]??{}),$={...z,bindings:{...z.bindings??{},[N]:L}};return g?{...T,profiles:{...T.profiles??{},[g]:$}}:{...T,defaults:{...T.defaults??{},profile:$}}})},[g,i]),M=m.useCallback(N=>{j(N.id,E=>({...E,sources:[]}))},[j]),w=m.useCallback((N,E)=>{j(N.id,S=>{const T=Array.isArray(S.sources)?[...S.sources]:[];if(!T[0])return S;const z={...T[0]};return E==="invertX"?z.invertX=!z.invertX:E==="invertY"?z.invertY=!z.invertY:z.invert=!z.invert,T[0]=z,{...S,sources:T}})},[j]),q=m.useMemo(()=>p?{outputs:Xx(p,v)}:null,[p,v]);return r.jsxs("section",{className:"panel-section space-y-0.5 text-sm",children:[r.jsx("div",{className:"flex items-center justify-between",children:r.jsxs("div",{children:[r.jsx("p",{className:"text-xs text-slate-400",children:"Controller"}),r.jsx("p",{className:"text-[0.65rem] text-slate-500",children:p?"Move sticks or press buttons to bind":"Connect a controller to configure."}),o&&r.jsxs("p",{className:"mt-0 text-[0.7rem] text-emerald-400",children:["Capturing ",o.label,"…"]})]})}),r.jsxs("div",{className:"space-y-0.5 surface",children:[r.jsx("p",{className:"text-[0.7rem] text-slate-500",children:"Connected controller"}),a.pads.length===0?r.jsx("p",{className:"text-[0.7rem] text-slate-400",children:"No controller detected."}):r.jsxs("div",{className:"flex items-center justify-between gap-0.5 text-xs",children:[r.jsx("select",{value:g??"",onChange:N=>y(N.target.value),className:"flex-1 rounded border border-slate-700 bg-slate-900 px-1 py-[2px] text-[0.75rem] text-slate-100",children:a.pads.map(N=>r.jsx("option",{value:N.signature,children:N.id||"Unknown controller"},N.signature))}),r.jsx("span",{className:"text-[0.7rem] text-slate-400",children:p?.mapping??"unknown"})]})]}),r.jsxs("div",{className:"space-y-0.5 surface",children:[r.jsx("p",{className:"text-[0.7rem] text-slate-500",children:"Calibration"}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(Ps,{label:"Drive deadzone",description:"Ignore small drive stick drift",min:0,max:.6,step:.01,value:v.calibration?.driveDeadzone??.18,onChange:N=>b({driveDeadzone:N})}),r.jsx(Ps,{label:"Camera deadzone",description:"Ignore small camera tilt drift",min:0,max:.4,step:.01,value:v.calibration?.cameraDeadzone??.08,onChange:N=>b({cameraDeadzone:N})}),r.jsx(Ps,{label:"Aux deadzone",description:"Ignore small trigger noise",min:0,max:.4,step:.01,value:v.calibration?.auxDeadzone??.05,onChange:N=>b({auxDeadzone:N})}),r.jsx(Ps,{label:"Side brush scale",description:"Scale side brush output",min:.3,max:1,step:.05,value:v.calibration?.auxSideScale??.55,onChange:N=>b({auxSideScale:N})}),r.jsxs("label",{className:"surface-muted block p-0.5",children:[r.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-300",children:[r.jsx("span",{className:"font-semibold text-slate-100",children:"Camera mode"}),r.jsxs("select",{value:v.calibration?.cameraMode??"absolute",onChange:N=>b({cameraMode:N.target.value}),className:"rounded border border-slate-700 bg-slate-900 px-1 py-[2px] text-[0.75rem] text-slate-100",children:[r.jsx("option",{value:"absolute",children:"Absolute"}),r.jsx("option",{value:"velocity",children:"Velocity"})]})]}),r.jsx("p",{className:"text-[0.65rem] text-slate-500",children:"Absolute maps stick to angle; velocity moves over time."})]}),r.jsx(Ps,{label:"Camera sensitivity",description:"Velocity mode degrees per second",min:10,max:180,step:5,value:v.calibration?.cameraSensitivity??60,onChange:N=>b({cameraSensitivity:N})})]})]}),r.jsx("div",{className:"space-y-0.5",children:Object.entries(h).map(([N,E])=>r.jsxs("div",{className:"space-y-0.5 surface",children:[r.jsx("p",{className:"text-[0.7rem] text-slate-500",children:N}),r.jsx("div",{className:"space-y-0.5",children:E.map(S=>{const z=v.bindings?.[S.id]?.sources?.[0]??null;return r.jsxs("div",{className:"surface-muted flex items-center justify-between text-xs",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold text-slate-100",children:S.label}),r.jsx("p",{className:"text-[0.65rem] text-slate-400",children:Gj(z)})]}),r.jsxs("div",{className:"flex items-center gap-0.5",children:[S.kind==="axisPair"&&r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",disabled:!z,onClick:()=>w(S,"invertX"),className:"button-dark text-[0.7rem] font-medium disabled:opacity-50",children:"Invert X"}),r.jsx("button",{type:"button",disabled:!z,onClick:()=>w(S,"invertY"),className:"button-dark text-[0.7rem] font-medium disabled:opacity-50",children:"Invert Y"})]}),S.kind==="axis"&&r.jsx("button",{type:"button",disabled:!z,onClick:()=>w(S),className:"button-dark text-[0.7rem] font-medium disabled:opacity-50",children:"Invert"}),r.jsx("button",{type:"button",onClick:()=>M(S),className:"button-dark text-[0.7rem]",children:"Clear"}),r.jsx("button",{type:"button",onClick:()=>f(S),className:`${o?.id===S.id?"px-0.5 py-0.5 bg-emerald-500 text-emerald-950 hover:bg-emerald-400":"button-dark"} text-[0.7rem] font-medium`,children:o?.id===S.id?"Waiting…":"Capture"})]})]},S.id)})})]},N))}),r.jsxs("div",{className:"space-y-0.5 surface",children:[r.jsx("p",{className:"text-[0.7rem] text-slate-500",children:"Diagnostics"}),p?r.jsxs("div",{className:"space-y-0.5 text-[0.7rem] text-slate-300",children:[r.jsx("p",{className:"text-slate-400",children:"Raw axes"}),r.jsx("div",{className:"grid grid-cols-2 gap-0.5",children:p.axes.map((N,E)=>r.jsxs("span",{className:"font-mono text-slate-300",children:["A",E,": ",Kn.format(N)]},`axis-${E}`))}),r.jsx("p",{className:"text-slate-400",children:"Raw buttons"}),r.jsx("div",{className:"grid grid-cols-2 gap-0.5",children:p.buttons.map((N,E)=>r.jsxs("span",{className:"font-mono text-slate-300",children:["B",E,": ",Kn.format(N.value)," ",N.pressed?"●":""]},`btn-${E}`))}),q?.outputs&&r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"text-slate-400",children:"Mapped outputs"}),r.jsxs("div",{className:"grid grid-cols-2 gap-0.5",children:[r.jsxs("span",{className:"font-mono text-slate-300",children:["Drive: ",Kn.format(q.outputs.driveVector.x),","," ",Kn.format(q.outputs.driveVector.y)]}),r.jsxs("span",{className:"font-mono text-slate-300",children:["Camera: ",Kn.format(q.outputs.cameraAxis)]}),r.jsxs("span",{className:"font-mono text-slate-300",children:["Main: ",Kn.format(q.outputs.auxAxis.main)]}),r.jsxs("span",{className:"font-mono text-slate-300",children:["Side: ",Kn.format(q.outputs.auxAxis.side)]})]})]})]}):r.jsx("p",{className:"text-[0.7rem] text-slate-400",children:"No controller detected."})]})]})}const Wj={drive:"Drive wheels",aux:"Aux motors"};function Up(a){return Number.isFinite(a)?`${Math.round(a*100)}%`:"--"}function Pj({value:a,color:l="bg-emerald-500"}){const i=`${Math.round(Math.max(0,Math.min(1,a))*100)}%`;return r.jsx("div",{className:"h-2 w-full overflow-hidden rounded bg-slate-800",children:r.jsx("div",{className:`h-full ${l}`,style:{width:i}})})}function eN(){const{state:{roverId:a},overcurrentLimiter:l}=Dt(),i=m.useMemo(()=>Ql.map(o=>o.key),[]);return r.jsxs("section",{className:"panel-section space-y-0.5 text-sm",children:[r.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-400",children:[r.jsx("span",{children:"Overcurrent limiter"}),r.jsx("span",{children:l?.adminImmune?"Admin immune":"Active"})]}),a?r.jsxs("div",{className:"space-y-0.5",children:[i.map(o=>{const f=l?.caps?.[o]?.cap??0,d=l?.overcurrent?.groups?.[o]??!1,h=l?.scales?.perGroup?.[o]??1;return r.jsxs("div",{className:"surface space-y-0.5",children:[r.jsxs("div",{className:"flex items-center justify-between text-xs",children:[r.jsx("span",{className:"text-slate-200",children:Wj[o]||o}),r.jsx("span",{className:d?"text-red-300":"text-slate-400",children:d?"overcurrent":"ok"})]}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsxs("div",{className:"flex items-center justify-between text-[0.7rem] text-slate-400",children:[r.jsx("span",{children:"Cap"}),r.jsx("span",{children:Up(f)})]}),r.jsx(Pj,{value:f,color:"bg-amber-500"}),r.jsxs("div",{className:"flex items-center justify-between text-[0.7rem] text-slate-400",children:[r.jsx("span",{children:"Scale"}),r.jsx("span",{children:Up(h)})]})]})]},o)}),r.jsxs("div",{className:"surface text-[0.7rem] text-slate-400",children:[r.jsx("div",{children:`Down rate ${l?.config?.downRatePerSec}/s · Up rate ${l?.config?.upRatePerSec}/s`}),r.jsx("div",{children:`Release delay ${l?.config?.releaseDelaySec}s`}),r.jsx("div",{children:`Output rate ${l?.config?.outputRateMs}ms`})]})]}):r.jsx("p",{className:"text-xs text-slate-500",children:"Assign a rover to view limiter status."})]})}const og=m.createContext(null);function cg(){const a=m.useContext(og);if(!a)throw new Error("Tabs components must be used within a <Tabs> provider.");return a}const Hp={primary:{base:"flex-1 px-0.5 py-0.5 text-sm font-medium transition-colors focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-1 focus-visible:outline-slate-500 rounded-md",active:"bg-sky-600 text-white",inactive:"bg-zinc-900 text-slate-300 hover:bg-sky-500 hover:text-white"}},ug="primary";function Zf(...a){return a.filter(Boolean).join(" ")}function Jf({children:a,defaultTab:l,currentTab:i,onTabChange:o,variant:f=ug}){const[d,h]=m.useState(l??null),[p,g]=m.useState([]),v=m.useCallback(M=>M?(g(w=>w.includes(M)?w:[...w,M]),()=>g(w=>w.includes(M)?w.filter(q=>q!==M):w)):()=>{},[]),y=i??d??p[0]??null;m.useEffect(()=>{l&&i===void 0&&h(l)},[l,i]);const b=m.useCallback(M=>{M&&(i===void 0&&h(M),o&&o(M))},[i,o]),j=m.useMemo(()=>({activeTab:y,setActiveTab:b,registerTab:v,variant:f}),[y,b,v,f]);return r.jsx(og.Provider,{value:j,children:a})}function If({children:a,className:l=""}){return r.jsx("div",{className:Zf("flex gap-0.5",l),children:a})}function mn({id:a,children:l,className:i="",disabled:o=!1}){const{activeTab:f,setActiveTab:d,registerTab:h,variant:p}=cg();m.useEffect(()=>h(a),[a,h]);const g=Hp[p]??Hp[ug],v=f===a,y=Zf(g.base,v?g.active:g.inactive,o?"cursor-not-allowed opacity-50":"",i);return r.jsx("button",{type:"button",className:y,onClick:()=>!o&&d(a),"aria-pressed":v,"aria-disabled":o,children:l})}function Wf({children:a,className:l=""}){return r.jsx("div",{className:Zf("mt-0 space-y-0.5",l),children:a})}function hn({id:a,children:l,keepMounted:i=!1}){const{activeTab:o}=cg(),f=o===a;return!f&&!i?null:!f&&i?r.jsx("div",{hidden:!0,"aria-hidden":"true",children:l}):r.jsx(r.Fragment,{children:l})}function tN(){const{session:a}=Ve(),l=m.useMemo(()=>JSON.stringify(a??{},null,2),[a]);return r.jsxs("div",{className:"panel-section flex min-h-0 flex-col gap-0.5 text-xs",children:[r.jsx("p",{className:"text-sm text-slate-400",children:"Session snapshot"}),r.jsx("pre",{className:"surface min-h-0 flex-1 overflow-y-auto font-mono text-[0.7rem] text-lime-300",children:l})]})}const Vp=300,Yp=240;function nN(a,l){if(a===void 0)return"undefined";if(a===null)return"null";if(typeof a=="string")return a;if(typeof a=="number"||typeof a=="boolean")return String(a);if(typeof a=="function")return"[Function]";if(a instanceof Error)return`${a.name}: ${a.message}`;if(a instanceof Date)return a.toISOString();if(l||(l=new WeakSet),typeof a=="object"){if(l.has(a))return"[Circular]";l.add(a)}try{return JSON.stringify(a,(i,o)=>typeof o=="function"?"[Function]":o instanceof Error?`${o.name}: ${o.message}`:o,0)}catch{return String(a)}}function aN(a){const i=a.map(o=>nN(o)).join(" ");return i.length>Yp?`${i.slice(0,Yp)}…`:i}function lN(){const a=En(),[l,i]=m.useState([]),o=m.useMemo(()=>l.reduce((f,d)=>(d.direction==="in"&&(f.in+=1),d.direction==="out"&&(f.out+=1),f),{in:0,out:0}),[l]);return m.useEffect(()=>{const f=(g,v,y)=>{i(b=>{const j=[...b,{id:`${Date.now()}-${Math.random().toString(16).slice(2)}`,direction:g,event:v,payload:aN(y),timestamp:new Date().toLocaleTimeString()}];return j.length>Vp?j.slice(-Vp):j})},d=(g,...v)=>f("in",g,v),h=(g,...v)=>f("out",g,v);a.onAny(d);let p=null;if(typeof a.onAnyOutgoing=="function")a.onAnyOutgoing(h),p=()=>a.offAnyOutgoing(h);else{const g=a.emit.bind(a);a.emit=(v,...y)=>(h(v,...y),g(v,...y)),p=()=>{a.emit=g}}return()=>{a.offAny(d),p&&p()}},[a]),r.jsxs("section",{className:"panel-section space-y-0.5 text-base",children:[r.jsxs("div",{className:"flex items-center justify-between text-sm text-slate-400",children:[r.jsx("span",{children:"Socket activity"}),r.jsxs("div",{className:"flex items-center gap-0.5 text-xs text-slate-400",children:[r.jsxs("span",{className:"surface-muted",children:["in ",o.in]}),r.jsxs("span",{className:"surface-muted",children:["out ",o.out]}),r.jsx("button",{type:"button",className:"button-dark text-xs",onClick:()=>i([]),children:"Clear"})]})]}),r.jsx("div",{className:"surface h-64 overflow-y-auto font-mono text-xs",children:l.length===0?r.jsx("p",{children:"No socket activity yet."}):l.slice().reverse().map(f=>r.jsxs("div",{className:"surface",children:[r.jsx("span",{className:"text-slate-400",children:f.timestamp})," ",r.jsxs("span",{className:f.direction==="in"?"text-emerald-400":"text-amber-400",children:["[",f.direction.toUpperCase(),"]"]})," ",r.jsx("span",{className:"text-cyan-300",children:f.event})," ",r.jsx("span",{className:"text-slate-200",children:f.payload})]},f.id))}),r.jsx("p",{className:"text-xs text-slate-500",children:"Logs are collected only while this panel is open."})]})}const sN=[{key:"start",label:"Start OI"},{key:"safe",label:"Safe"},{key:"full",label:"Full"},{key:"passive",label:"Passive"},{key:"dock",label:"Dock"}];function fg(){const{state:{roverId:a},actions:{sendOiCommand:l,setSensorStream:i}}=Dt(),o=!!a,[f,d]=lg(),h=En(),{value:p,save:g}=st("page",{hudMapDesktop:!1,connectionTransport:"websocket"}),{value:v,save:y}=st("audio",jt),b=p?.connectionTransport||"websocket",j=Number.isFinite(v?.masterVolume)?v.masterVolume:jt.masterVolume,M=Number.isFinite(v?.alertVolume)?v.alertVolume:jt.alertVolume,w=Number.isFinite(v?.roverVolume)?v.roverVolume:jt.roverVolume,q=typeof v?.mainBrushDuckEnabled=="boolean"?v.mainBrushDuckEnabled:typeof v?.autoLevelEnabled=="boolean"?v.autoLevelEnabled:jt.mainBrushDuckEnabled,N=Number.isFinite(v?.mainBrushDuckAmount)?Math.max(0,Math.min(1,v.mainBrushDuckAmount)):jt.mainBrushDuckAmount,E=m.useMemo(()=>[{key:"start",label:"Enable stream",enable:!0},{key:"stop",label:"Disable stream",enable:!1}],[]),S=$=>{a&&i($)},T=$=>{const O=$.target.value;g(V=>({...V??{},connectionTransport:O})),h?.io?.opts&&(h.io.opts.transports=O==="polling"?["polling"]:["websocket","polling"],h.disconnect(),h.connect())},z=$=>O=>{const V=Number(O.target.value),X=Number.isFinite(V)?Math.max(0,Math.min(1,V)):0;y(Z=>({...Z??{},[$]:X}))},L=$=>{const O=!!$.target.checked;y(V=>({...V??{},mainBrushDuckEnabled:O}))};return r.jsxs(Jf,{defaultTab:"keybindings",children:[r.jsxs(If,{children:[r.jsx(mn,{id:"keybindings",children:"Keybindings"}),r.jsx(mn,{id:"controller",children:"Controller"}),r.jsx(mn,{id:"page",children:"Page settings"}),r.jsx(mn,{id:"admin",children:"Admin"})]}),r.jsxs(Wf,{children:[r.jsx(hn,{id:"keybindings",children:r.jsx("div",{className:"space-y-0.5",children:r.jsx(Vj,{})})}),r.jsx(hn,{id:"controller",children:r.jsx("div",{className:"space-y-0.5",children:r.jsx(Ij,{})})}),r.jsx(hn,{id:"page",children:r.jsxs("div",{className:"space-y-0.5",children:[r.jsxs("section",{className:"panel-section space-y-0.5 text-sm",children:[r.jsx("p",{className:"text-slate-400",children:"HUD"}),r.jsxs("label",{className:"flex items-center gap-0.5 text-slate-200",children:[r.jsx("input",{type:"checkbox",className:"accent-emerald-500",checked:f,onChange:$=>d($.target.checked)}),r.jsx("span",{children:"Show top-down map in HUD (desktop)"})]}),r.jsx("p",{className:"text-xs text-slate-500",children:"Mobile HUD keeps the map on by default."})]}),r.jsxs("section",{className:"panel-section space-y-0.5 text-sm",children:[r.jsx("p",{className:"text-slate-400",children:"Audio"}),r.jsxs("label",{className:"grid gap-0.5 text-slate-200",children:[r.jsxs("div",{className:"flex items-center justify-between gap-0.5",children:[r.jsx("span",{children:"Master volume"}),r.jsxs("span",{className:"text-xs text-slate-400",children:[Math.round(j*100),"%"]})]}),r.jsx("input",{type:"range",min:"0",max:"1",step:"0.01",value:j,onChange:z("masterVolume"),className:"w-full accent-emerald-500"})]}),r.jsxs("label",{className:"grid gap-0.5 text-slate-200",children:[r.jsxs("div",{className:"flex items-center justify-between gap-0.5",children:[r.jsx("span",{children:"Alert/page sounds"}),r.jsxs("span",{className:"text-xs text-slate-400",children:[Math.round(M*100),"%"]})]}),r.jsx("input",{type:"range",min:"0",max:"1",step:"0.01",value:M,onChange:z("alertVolume"),className:"w-full accent-emerald-500"})]}),r.jsxs("label",{className:"grid gap-0.5 text-slate-200",children:[r.jsxs("div",{className:"flex items-center justify-between gap-0.5",children:[r.jsx("span",{children:"Rover audio"}),r.jsxs("span",{className:"text-xs text-slate-400",children:[Math.round(w*100),"%"]})]}),r.jsx("input",{type:"range",min:"0",max:"1",step:"0.01",value:w,onChange:z("roverVolume"),className:"w-full accent-emerald-500"})]}),r.jsxs("label",{className:"flex items-center justify-between gap-0.5 text-slate-200",children:[r.jsx("span",{children:"Main brush ducking"}),r.jsx("input",{type:"checkbox",className:"accent-emerald-500",checked:q,onChange:L})]}),r.jsxs("label",{className:"grid gap-0.5 text-slate-200",children:[r.jsxs("div",{className:"flex items-center justify-between gap-0.5",children:[r.jsx("span",{children:"Main brush duck amount"}),r.jsxs("span",{className:"text-xs text-slate-400",children:[Math.round(N*100),"%"]})]}),r.jsx("input",{type:"range",min:"0",max:"1",step:"0.01",value:N,onChange:z("mainBrushDuckAmount"),className:"w-full accent-emerald-500",disabled:!q})]}),r.jsx("p",{className:"text-xs text-slate-500",children:"Lowers rover audio only while the main brush is running."})]}),r.jsxs("section",{className:"panel-section space-y-0.5 text-sm",children:[r.jsx("p",{className:"text-slate-400",children:"Connection"}),r.jsxs("label",{className:"flex items-center justify-between gap-0.5 text-slate-200",children:[r.jsx("span",{children:"Transport"}),r.jsxs("select",{value:b,onChange:T,className:"field-input text-sm",children:[r.jsx("option",{value:"websocket",children:"WebSocket"}),r.jsx("option",{value:"polling",children:"Polling"})]})]}),r.jsx("p",{className:"text-xs text-slate-500",children:"Switching reconnects your session."})]})]})}),r.jsx(hn,{id:"admin",children:r.jsxs("div",{className:"space-y-0.5",children:[r.jsxs("section",{className:"panel-section space-y-0.5 text-sm",children:[r.jsx("p",{className:"text-slate-400",children:"Manual OI commands"}),r.jsx("div",{className:"surface flex flex-wrap gap-0.5",children:sN.map($=>r.jsx("button",{type:"button",onClick:()=>l($.key),disabled:!o,className:"button-dark text-xs disabled:opacity-30",children:$.label},$.key))})]}),r.jsxs("section",{className:"panel-section space-y-0.5 text-sm",children:[r.jsx("p",{className:"text-slate-400",children:"Sensor stream"}),r.jsx("div",{className:"surface flex gap-0.5",children:E.map($=>r.jsx("button",{type:"button",onClick:()=>S($.enable),disabled:!o,className:"flex-1 button-dark text-xs disabled:opacity-30",children:$.label},$.key))}),!o&&r.jsx("p",{className:"text-xs text-slate-500",children:"Assign a rover to toggle streams."})]}),r.jsx(rg,{}),r.jsx(eN,{}),r.jsx(kj,{}),r.jsx(tN,{}),r.jsx(lN,{})]})})]})]})}const $p={desktop:{main:[{type:"list",title:"Chat and nicknames",items:["Set a nickname in the user list panel, on the bottom left of the page below the rover video.",{segments:["Toggle chat focus with ",{action:"chatFocus"},". Press ",{action:"chatFocus"}," again to send."]}]},{type:"list",title:"Driving the rover",items:[{segments:['Press the "Start Driving" button onscreen, or press ',{action:"driveMacro"}," on your keyboard to put the rover into driving mode."]},"Refer to the controls for the controls for the rover."]},{type:"list",title:"Docking the rover",items:["Line up the rover to the dock, about a foot away, then:",{segments:['Press the "Dock and Charge" button onscreen, or press ',{action:"dockMacro"}," on your keyboard to start docking."]},"Wait for the rover to confirm it is docked and charging before leaving it unattended."]}],aside:[{type:"keyboard",title:"Keyboard controls",footnote:"Per-browser; adjust bindings and speeds in Settings → Keybindings.",groups:[{id:"movement",title:"Movement",items:[{action:"driveForward",label:"Forward"},{action:"driveBackward",label:"Backward"},{action:"driveLeft",label:"Turn left"},{action:"driveRight",label:"Turn right"},{action:"boostModifier",label:"Boost speed"},{action:"slowModifier",label:"Precision speed"}]},{id:"macros",title:"Rover modes & chat",items:[{action:"driveMacro",label:"Drive macro"},{action:"dockMacro",label:"Dock macro"},{action:"chatFocus",label:"Chat focus"}]},{id:"camera",title:"Camera",items:[{action:"cameraUp",label:"Tilt up"},{action:"cameraDown",label:"Tilt down"},{action:"nightVisionToggle",label:"Toggle night vision"}]},{id:"motors",title:"Rover Aux Motors",items:[{action:"auxMainForward",label:"Main brush forward"},{action:"auxMainReverse",label:"Main brush reverse"},{action:"auxSideForward",label:"Side brush forward"},{action:"auxSideReverse",label:"Side brush reverse"},{action:"auxVacuumFast",label:"Vacuum max"},{action:"auxVacuumSlow",label:"Vacuum low"},{action:"auxAllForward",label:"All motors forward"}]},{id:"audio",title:"Audio / Song",items:[{action:"songNoteUp",label:"Song note up"},{action:"songNoteDown",label:"Song note down"}]},{id:"room-controls",title:"Room Controls",items:[{action:"homeAssistantOn",label:"Next room control on"},{action:"homeAssistantOff",label:"Next room control off (reverse)"}]}]},{type:"gamepad",title:"Gamepad / joystick",items:["Gamepad controls are fully configurable to handle inconsistent browser mappings.","Use Settings → Controller to bind inputs, calibrate deadzones, and view diagnostics.","If inputs behave oddly, the diagnostics panel will show raw axis/button values."]}]},"mobile-portrait":{main:[{type:"list",title:"Chat and nicknames",items:["Set a nickname in the user list panel below.","Tap in the chat box to send messages in the chat."]},{type:"list",title:"Driving the rover",items:[{segments:['Press the "Start Driving" button onscreen to put the rover into driving mode.']},"Look below the rover video. Use the joystick on the right to move the rover, and hold the buttons on the left to run the aux motors."]},{type:"list",title:"Docking the rover",items:["Line up the rover to the dock, about a foot away, then:",{segments:['Press the "Dock and Charge" button onscreen to start docking.']},"Wait for the rover to confirm it is docked and charging before leaving it unattended."]}]},"mobile-landscape":{main:[{type:"list",title:"Chat and nicknames",items:["Scroll down to see more of the page.","Set a nickname in the user list panel below.","Tap in the chat box to send messages in the chat."]},{type:"list",title:"Driving the rover",items:[{segments:['Press the "Start Driving" button, or the "Drive" button to put the rover into driving mode.']},"Use the joystick to the right of the video feed to move the rover, and hold the buttons on the left to run the aux motors."]},{type:"list",title:"Docking the rover",items:["Line up the rover to the dock, about a foot away, then:",{segments:['Press the "Dock and Charge" or the "Dock" button onscreen to start docking.']},"Wait for the rover to confirm it is docked and charging before leaving it unattended."]}]}};function iN(a){return $p[a]||$p.desktop}function dg({actionId:a,keymap:l}){const i=l?.[a]?.[0]??"";return r.jsx("span",{className:"rounded border border-slate-600 bg-slate-900/40 px-1 text-[0.7rem] text-slate-200",children:An(i)})}function Gp(a,l){return a.map((i,o)=>typeof i=="string"?r.jsx("span",{children:i},`text-${o}`):i?.action?r.jsx(dg,{actionId:i.action,keymap:l},`pill-${i.action}-${o}`):i?.text?r.jsx("span",{children:i.text},`span-${o}`):null)}function oo(a,l,i){if(typeof a=="string")return a;if(Array.isArray(a?.segments))return Gp(a.segments,l);if(a&&typeof a=="object"){if(typeof a.text=="string")return a.text;if(Array.isArray(a))return Gp(a,l)}return String(a??"")}function rN({hero:a,keymap:l}){return a?r.jsxs("div",{className:"surface space-y-0.5 px-0.5 py-0.5",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-0.5",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-semibold text-white",children:a.title}),a.subtitle&&r.jsx("p",{className:"text-xs text-slate-300",children:a.subtitle})]}),a.chips&&r.jsx("div",{className:"flex flex-wrap gap-0.5 text-[0.7rem] text-slate-200",children:a.chips.map(i=>r.jsx("span",{className:"rounded border border-slate-700 px-1 py-[2px]",children:i},i))})]}),a.bullets&&r.jsx("ul",{className:"space-y-0.5 text-[0.85rem] text-slate-200",children:a.bullets.map((i,o)=>{const f=Array.isArray(i?.segments)?`hero-${o}`:`hero-${o}`;return r.jsx("li",{className:"surface-muted px-0.5 py-0.25",children:oo(i,l)},f)})})]}):null}function oN({block:a,keymap:l}){return r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("p",{className:"text-xs font-semibold text-slate-200",children:a.title}),r.jsx("ul",{className:"space-y-0.5 text-[0.8rem] text-slate-300",children:a.items.map((i,o)=>{const f=`item-${o}`;return r.jsx("li",{className:"surface-muted flex flex-wrap items-center gap-0.5 px-0.5 py-0.25",children:oo(i,l)},f)})})]})}function cN({block:a}){const l=a.tone==="info"?"border-cyan-500/40":"border-slate-700";return r.jsxs("div",{className:`surface space-y-0.5 border ${l} px-0.5 py-0.5`,children:[r.jsx("p",{className:"text-xs font-semibold text-slate-100",children:a.title}),a.body&&r.jsx("ul",{className:"space-y-0.5 text-[0.8rem] text-slate-300",children:a.body.map((i,o)=>r.jsx("li",{className:"surface-muted px-0.5 py-0.25",children:oo(i,{})},`callout-${o}`))})]})}function uN({group:a,keymap:l}){return r.jsxs("div",{className:"space-y-0.5 surface",children:[r.jsx("p",{className:"px-0.5 py-0.25 text-[0.75rem] font-semibold text-slate-200",children:a.title}),r.jsx("div",{className:"space-y-0.5 px-0.5 pb-0.25",children:a.items.map(i=>r.jsxs("div",{className:"surface-muted flex items-center justify-between gap-0.5 px-0.5 py-0.25 text-[0.8rem]",children:[r.jsx("span",{className:"text-slate-200",children:i.label}),r.jsx(dg,{actionId:i.action,keymap:l})]},i.action))})]})}function fN({block:a,keymap:l}){return a?r.jsxs("div",{className:"space-y-0.5",children:[r.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-200",children:[r.jsx("span",{className:"font-semibold",children:a.title}),a.footnote&&r.jsx("span",{className:"text-[0.7rem] text-slate-400",children:a.footnote})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-0.5",children:a.groups?.map(i=>r.jsx(uN,{group:i,keymap:l},i.id))})]}):null}function dN({block:a}){return a?r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("p",{className:"text-xs font-semibold text-slate-200",children:a.title}),r.jsx("ul",{className:"space-y-0.5 text-[0.8rem] text-slate-300",children:a.items?.map((l,i)=>r.jsx("li",{className:"surface-muted px-0.5 py-0.25",children:oo(l,{})},`gamepad-${i}`))})]}):null}function Xp({block:a,keymap:l}){if(!a)return null;switch(a.type){case"list":return r.jsx(oN,{block:a,keymap:l});case"callout":return r.jsx(cN,{block:a});case"keyboard":return r.jsx(fN,{block:a,keymap:l});case"gamepad":return r.jsx(dN,{block:a});default:return null}}function mg({layout:a,keymap:l}){const i=m.useMemo(()=>iN(a),[a]),o=l||{},f=i.main||[],d=i.aside||[];return r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(rN,{hero:i.hero,keymap:o}),r.jsxs("div",{className:"grid gap-0.5",style:{gridTemplateColumns:"repeat(auto-fit, minmax(360px, 1fr))"},children:[r.jsx("div",{className:"space-y-0.5",children:f.map((h,p)=>r.jsx(Xp,{block:h,keymap:o},h.title||p))}),r.jsx("div",{className:"space-y-0.5",children:d.map((h,p)=>r.jsx(Xp,{block:h,keymap:o},h.title||p))})]})]})}function hg({layout:a,onOpenOverlay:l}){const{state:i}=Dt();return r.jsxs("section",{className:"panel-section space-y-0.5 text-sm",children:[r.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-400",children:[r.jsx("span",{children:"Help"}),r.jsx("button",{type:"button",onClick:l,className:"button-dark px-1 py-0.25 text-[0.75rem]",children:"Open full help"})]}),r.jsx(mg,{layout:a,keymap:i?.keymap||{}})]})}const mN=["kal","rms","slt","ksp","bdl"],hN=Array.from({length:10},(a,l)=>l*10);function co({hideInput:a=!1,hideSpectatorNotice:l=!1,fillHeight:i=!1,allowSpectatorInput:o=!1}){const{session:f}=Ve(),{messages:d,typing:h,sendMessage:p,registerInputRef:g,onInputFocus:v,onInputBlur:y,blurChat:b,setTypingActive:j}=Lf(),{value:M,save:w}=st("tts",{engine:"flite",voice:"rms",pitch:50}),[q,N]=m.useState(""),[E,S]=m.useState(!1),[T,z]=m.useState(!1),[L,$]=m.useState(()=>M?.engine||"flite"),[O,V]=m.useState(()=>M?.voice||"rms"),[X,Z]=m.useState(()=>Number.isFinite(M?.pitch)?M.pitch:50),F=f?.role!=="spectator"||o,ae=m.useRef(null),oe=f?.assignment?.roverId||null,G=!!m.useMemo(()=>f?.roster?.find(C=>String(C.id)===String(oe))||null,[oe,f?.roster])?.audio?.ttsEnabled,k=m.useMemo(()=>d.slice(-200),[d]),Q=m.useMemo(()=>h||[],[h]);m.useEffect(()=>{ae.current&&(ae.current.scrollTop=ae.current.scrollHeight)},[k,Q]),m.useEffect(()=>{const C=M?.engine||"flite",_=M?.voice||"rms",W=Number.isFinite(M?.pitch)?M.pitch:50;L!==C&&$(C),O!==_&&V(_),X!==W&&Z(W)},[L,X,M?.engine,M?.pitch,M?.voice,O]),m.useEffect(()=>{z(!!G)},[G]);const P=m.useMemo(()=>!G||!T?null:L==="espeak"?{speak:!0,engine:L,pitch:X}:{speak:!0,engine:L,voice:O},[L,X,T,G,O]);async function re(C){if(C.preventDefault(),!F||a)return;const W=q.replace(/\\n/g,`
`).trim();if(W){S(!0);try{await p(W,P),N(""),b(),j(!1)}catch(te){alert(te.message)}finally{S(!1)}}}const ce=i?"flex-1 min-h-0 overflow-y-auto":"h-48 overflow-y-auto";return r.jsxs("section",{className:`panel-section space-y-0.5 text-base ${i?"flex h-full flex-col overflow-hidden":""}`,children:[r.jsxs("div",{className:`surface overflow-y-auto space-y-0.5 px-0 ${ce}`,ref:ae,children:[k.length===0&&Q.length===0?r.jsx("p",{className:"text-sm text-slate-500",children:"No messages yet."}):k.map(C=>r.jsx(Ox,{message:C},C.id)),Q.map(C=>r.jsx(Bx,{message:C},`typing-${C.typingId||C.id}`))]}),!a&&r.jsxs("form",{className:"flex flex-wrap items-stretch gap-0.5",onSubmit:re,children:[r.jsx("input",{className:"field-input flex-1 min-w-[10rem]",value:q,onChange:C=>{const _=C.target.value;N(_),j(!!_.trim())},onFocus:C=>{v(C),j(!!q.trim())},onBlur:C=>{y(C),j(!1)},onKeyDown:C=>{C.key==="Enter"&&!q.trim()&&(C.preventDefault(),b(),j(!1))},ref:C=>g(C,{target:"panel"}),placeholder:F?"Type a message…":l?"":"Spectators cannot chat",disabled:!F}),G&&r.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 basis-full sm:basis-auto",children:[r.jsxs("label",{className:"flex items-center gap-0.5 text-xs text-slate-300",children:[r.jsx("input",{type:"checkbox",checked:T,onChange:C=>z(C.target.checked),className:"accent-cyan-500"}),r.jsx("span",{children:"Speak"})]}),r.jsxs("select",{value:L,onChange:C=>{const _=C.target.value;$(_),w(W=>({...W||{},engine:_}))},className:"field-input text-xs",children:[r.jsx("option",{value:"flite",children:"flite"}),r.jsx("option",{value:"espeak",children:"espeak"})]}),L==="flite"?r.jsx("select",{value:O,onChange:C=>{const _=C.target.value;V(_),w(W=>({...W||{},voice:_}))},className:"field-input text-xs",children:mN.map(C=>r.jsx("option",{value:C,children:C},C))}):r.jsx("select",{value:X,onChange:C=>{const _=Number(C.target.value);Z(_),w(W=>({...W||{},pitch:_}))},className:"field-input text-xs",children:hN.map(C=>r.jsxs("option",{value:C,children:["pitch ",C]},C))})]}),r.jsx("button",{type:"submit",disabled:!F||E,className:"button-dark h-full disabled:opacity-50 self-stretch",children:E?"...":"Send"})]})]})}function Pf({compact:a=!1}){const{session:l,setNickname:i}=Ve(),{value:o,save:f}=st("profile",{nickname:""}),[d,h]=m.useState(o.nickname||""),[p,g]=m.useState(!1),v=l?.role!=="spectator";m.useEffect(()=>{h(o.nickname||"")},[o.nickname]);async function y(b){if(b.preventDefault(),!v)return;const j=(d||"").trim().slice(0,32);if(j){g(!0);try{await i(j),f({nickname:j})}catch(M){alert(M.message)}finally{g(!1)}}}return r.jsxs("form",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)_auto] items-stretch gap-0.5",onSubmit:y,children:[r.jsx("input",{className:"field-input flex-1 min-w-0",value:d,onChange:b=>h(b.target.value),maxLength:32,placeholder:"Enter a nickname",disabled:!v}),r.jsx("button",{type:"submit",disabled:!v||p,className:"button-dark h-full shrink-0 whitespace-nowrap px-0.5 py-0 disabled:opacity-50",children:p?"Saving…":a?"Set":"Save"})]})}function pN(a){const l=Array.isArray(a?.socials)?a.socials:null;if(l&&l.length)return l;const i=[];return a?.discord?.invite&&i.push({id:"discord",label:"Discord",url:a.discord.invite}),a?.kofi?.link&&i.push({id:"kofi",label:"Ko-fi",url:a.kofi.link}),i}function xN(a){if(!a||typeof a!="object")return null;const l=a.id||a.service||a.key||a.name||null,i=a.label||a.title||a.name||l||"Link",o=a.url||a.link||a.href||null;return o?{id:l,label:i,url:o}:null}function pg({className:a=""}){const{session:l}=Ve(),i=pN(l).map(xN).filter(Boolean).slice(0,4);return i.length?r.jsx("div",{className:`grid grid-cols-2 grid-rows-2 gap-0.5 ${a}`,children:i.map(o=>r.jsx(Xf,{...o},`${o.id||o.label}-${o.url}`))}):null}function gN({compact:a=!1}){return r.jsx("section",{className:"panel-section flex h-full min-h-0 flex-col gap-0.5 text-base",children:r.jsx("div",{className:"surface flex w-full items-center px-0 py-0",children:r.jsx(Pf,{compact:a})})})}function vN(){return r.jsx("section",{className:"panel-section flex h-full min-h-0 flex-col gap-0.5 text-base",children:r.jsx(pg,{className:"flex-1 min-h-0"})})}function Pu(...a){return a.filter(Boolean).join(" ")}function yN(a){const l=a?.batteryState?.percentDisplay;return l==null?"--":`${l}%`}function bN(a){return a?.batteryState?a.batteryState.urgentActive?"text-red-400":a.batteryState.warnActive?"text-amber-300":"text-emerald-300":"text-slate-400"}function SN(a){switch(a){case"admin":case"lockdown":case"lockdown-admin":return"text-amber-300";case"spectator":return"text-slate-400";default:return"text-sky-300"}}function AN(a,l){if(!a)return"";const i=a.nickname||a.socketId?.slice(0,6)||"unknown";return a.socketId&&a.socketId===l?`${i} (you)`:i}function uo({title:a="Rovers"}){const{session:l,requestControl:i}=Ve(),[o,f]=m.useState({}),[d,h]=m.useState(()=>Date.now()),p=m.useMemo(()=>l?.role&&l.role!=="spectator",[l?.role]),g=l?.roster??[],v=l?.turnQueues??{},y=l?.users??[],b=l?.socketId||null,j=m.useMemo(()=>Object.values(v||{}).some(N=>N?.deadline||N?.idleDeadline),[v]);m.useEffect(()=>{if(!j)return;const N=setInterval(()=>{h(Date.now())},1e3);return()=>clearInterval(N)},[j]);const M=m.useMemo(()=>{const N=new Set(g.map(S=>String(S.id))),E=Object.keys(v||{}).filter(S=>!N.has(String(S))).map(S=>({id:S,name:S,locked:!1,batteryState:null}));return[...g,...E]},[g,v]);async function w(N){if(N){f(E=>({...E,[N]:!0}));try{await i(N)}catch(E){alert(E.message)}finally{f(E=>({...E,[N]:!1}))}}}const q=N=>y.find(E=>E.socketId===N)||{socketId:N,nickname:null,role:null};return r.jsxs("div",{className:"space-y-0.5 text-sm",children:[a&&r.jsx("p",{className:"text-sm text-slate-400",children:a}),M.length===0?r.jsx("p",{className:"text-sm text-slate-500",children:"No rovers registered."}):r.jsx("ul",{className:"space-y-0.5 text-sm",children:M.map(N=>{const E=String(N.id),S=v?.[E]||null,T=S?.queue||[],z=S?.idleDeadline||S?.deadline||null,L=z&&z>d?Math.ceil((z-d)/1e3):z?0:null,$=S?.current||null,O=$?T.findIndex(k=>k===$):-1,V=T.length>1?O>=0?T[(O+1)%T.length]:T[0]:null,X=!!(b&&$&&$===b),Z=!!(b&&V&&V===b),F=L!=null&&(X||Z),ae=!!N.locked,oe=N.lockReason?`locked: ${N.lockReason}`:"locked",me=ae?oe:o[E]?"...":"request",G=p&&!ae&&!o[E];return r.jsxs("li",{className:Pu("surface flex flex-wrap items-start justify-between gap-0.5",G&&"cursor-pointer",ae&&"bg-red-900/40"),onClick:()=>{G&&w(N.id)},children:[r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[r.jsxs("div",{className:"flex items-center justify-between gap-0.5",children:[r.jsxs("div",{className:"flex items-center gap-0.5",children:[r.jsx("p",{className:"text-slate-200",children:N.name}),F?r.jsx("span",{className:"rounded bg-slate-800 px-1 text-[0.7rem] text-slate-200",children:X?`${L}s left`:`Your turn in ${L}s`}):null]}),r.jsx("span",{className:Pu("text-[0.75rem] font-semibold",bN(N)),children:yN(N)})]}),T.length===0?r.jsx("p",{className:"text-[0.7rem] text-slate-500",children:"No queue."}):r.jsx("div",{className:"flex flex-wrap items-center gap-0.5",children:T.map((k,Q)=>{const P=q(k),re=k===$,ce=!!(V&&k===V&&!re),C=re?"bg-sky-600 text-white ring-2 ring-amber-300":ce?"bg-emerald-700/60 text-emerald-100 ring-1 ring-emerald-300/70":"bg-slate-800 text-slate-200";return r.jsxs("span",{className:`flex items-center gap-0.5 rounded px-1 text-[0.7rem] ${C}`,children:[r.jsx("span",{className:`${SN(P.role)} font-semibold`,children:AN(P,b)}),re&&r.jsx("span",{className:"text-[0.65rem] text-slate-200",children:"now"}),ce&&r.jsx("span",{className:"text-[0.65rem] text-emerald-100",children:"next"})]},`${E}-${k}-${Q}`)})})]}),p?r.jsx("button",{type:"button",onClick:k=>{k.stopPropagation(),w(N.id)},disabled:o[E]||ae,className:Pu("button-dark disabled:opacity-40",ae&&"bg-red-600/70 text-white hover:bg-red-600"),children:me}):null]},N.id)})})]})}function jN(a){switch(a){case"admin":case"lockdown":case"lockdown-admin":return"text-amber-300";case"spectator":return"text-slate-400";default:return"text-sky-300"}}function NN(a,l){if(!a)return"";const i=a.nickname||a.socketId?.slice(0,6)||"unknown";return a.socketId&&a.socketId===l?`${i} (you)`:i}function eo({hideNicknameForm:a=!1,hideHeader:l=!1,className:i="",fillHeight:o=!1,compact:f=!1}){const{session:d,setNickname:h}=Ve(),{value:p}=st("profile",{nickname:""}),g=m.useRef(null),v=En(),y=d?.role!=="spectator",b=d?.users??[],j=d?.socketId||null;m.useEffect(()=>{if(!y||!d?.socketId)return;const q=p.nickname||"";if(!q||d.socketId===g.current)return;const N=d.socketId;h(q).then(()=>{g.current=N}).catch(()=>{})},[y,d?.socketId,h,p.nickname]),m.useEffect(()=>{if(!v)return;const q=()=>{if(!y)return;const N=(p.nickname||"").trim();N&&h(N).then(()=>{g.current=d?.socketId||null}).catch(()=>{})};return v.on("connect",q),()=>v.off("connect",q)},[y,h,v,p.nickname,d?.socketId]);const M=m.useMemo(()=>[...b].sort((q,N)=>q.socketId===j?-1:N.socketId===j?1:(q.nickname||"").localeCompare(N.nickname||"")),[j,b]),w=o?"flex-1 min-h-0 overflow-y-auto":f?"h-28 overflow-y-auto":"h-48 overflow-y-auto";return r.jsxs("section",{className:`panel-section space-y-0.5 text-base ${o?"flex h-full min-h-0 flex-col overflow-hidden":""} ${i}`,children:[!a&&r.jsxs("div",{className:"space-y-0.5",children:[r.jsxs("div",{className:"grid gap-0.5 md:grid-cols-[minmax(0,1.4fr)_minmax(0,1fr)]",children:[r.jsx("div",{className:"min-w-0",children:r.jsx("div",{className:"surface flex w-full items-center px-0 py-0",children:r.jsx(Pf,{compact:f})})}),r.jsx(pg,{})]}),!y&&r.jsx("p",{className:"text-xs text-slate-500",children:"Spectators cannot set nicknames."})]}),r.jsxs("div",{className:`space-y-0.5 ${o?"flex flex-1 min-h-0 flex-col":""}`,children:[!l&&r.jsxs("div",{className:`flex items-center justify-between text-sm text-slate-400 ${f?"text-xs":""}`,children:[r.jsx("span",{children:"Users"}),r.jsx("span",{className:"text-xs text-slate-500",children:M.length})]}),r.jsx("div",{className:`surface flex flex-wrap content-start items-start gap-0.5 px-0 pb-0 ${w} ${f?"text-[0.8rem]":""}`,children:M.length===0?r.jsx("p",{className:"text-sm text-slate-500",children:"Waiting for users…"}):M.map(q=>r.jsx("span",{className:`rounded bg-slate-800/80 px-1 py-0.25 text-[0.7rem] ${jN(q.role)}`,children:NN(q,j)},q.socketId))})]})]})}function wN(){const{state:{roverId:a}}=Dt(),i=es(a)?.sensors||{};return r.jsx("section",{className:"panel-section",children:r.jsx("div",{className:"aspect-square w-full",children:r.jsx(vf,{sensors:i})})})}function EN(){const{state:{roverId:a,keymap:l,camera:i,horn:o},pipeline:f,actions:{setServoAngle:d,setNightVision:h,startHorn:p,stopHorn:g}}=Dt(),v=Zx(a),y=v.docked&&!v.driving,b=i?.config,j=!!(a&&i?.enabled&&b),M=!!(a&&f?.nightVision),w=f?.nightVisionState,q=!!(a&&f?.horn),N=o?.overheated,E=typeof b?.minAngle=="number"?b.minAngle:-30,S=typeof b?.maxAngle=="number"?b.maxAngle:30,T=typeof i?.angle=="number"?i.angle:typeof b?.homeAngle=="number"?b.homeAngle:(E+S)/2,z=An(l?.nightVisionToggle?.[0]),L=An(l?.hornHonk?.[0]),$=An(l?.cameraUp?.[0]),O=An(l?.cameraDown?.[0]);return r.jsxs("section",{className:"panel-section grid h-full min-h-0 grid-rows-[minmax(0,1fr)_auto] gap-0.5",children:[r.jsx(Jx,{layout:"desktop",expand:!0,driveDockState:v}),y?null:r.jsxs("div",{className:"surface space-y-0.5 p-0 text-sm text-slate-200",children:[M&&r.jsx(Ix,{nightVisionOn:w?.nightVisionOn,disabled:!a,onToggle:h,keyLabel:z}),q&&r.jsx(Wx,{disabled:!a||N,onStart:p,onStop:g,keyLabel:L,active:o?.active,heat:o?.heat}),j&&r.jsx(Px,{value:T,min:E,max:S,onChange:d,keyDownLabel:O,keyUpLabel:$,className:"space-y-0.5 px-1 py-1",labelRowClass:"text-xs text-slate-300",labelClass:"",valueClass:"font-mono text-slate-100",sliderClass:"w-full",accentClass:"accent-emerald-400",endpointClass:"text-[0.7rem] text-slate-400"})]})]})}function CN({layout:a,onOpenHelpOverlay:l}){return r.jsx("section",{className:"panel text-base",children:r.jsxs(Jf,{defaultTab:"telemetry",children:[r.jsxs(If,{children:[r.jsx(mn,{id:"telemetry",children:"Controls"}),r.jsx(mn,{id:"help",children:"Help"}),r.jsx(mn,{id:"settings",children:"Settings"})]}),r.jsxs(Wf,{children:[r.jsx(hn,{id:"telemetry",children:r.jsxs("div",{className:"space-y-0.5",children:[r.jsxs("div",{className:"grid items-stretch gap-0.5 grid-cols-[minmax(0,1.35fr)_minmax(0,0.95fr)]",children:[r.jsx(wN,{}),r.jsx(EN,{})]}),r.jsxs("div",{className:"grid gap-0.5 grid-cols-[minmax(0,1fr)_minmax(0,0.9fr)_minmax(0,0.75fr)]",children:[r.jsx(uo,{}),r.jsx(_f,{panelId:"replay-sources-desktop",fillHeight:!0}),r.jsx(vN,{})]}),r.jsxs("div",{className:"grid items-stretch gap-0.5 grid-cols-[minmax(0,1.3fr)_minmax(0,0.22fr)] h-[14rem]",children:[r.jsx(co,{fillHeight:!0}),r.jsxs("div",{className:"grid min-h-0 gap-0.5 grid-rows-[minmax(0,1fr)_auto]",children:[r.jsx(eo,{compact:!0,hideNicknameForm:!0,fillHeight:!0}),r.jsx(gN,{compact:!0})]})]}),r.jsx(ig,{}),r.jsx(Vf,{defaultOrientation:"horizontal",panelId:"rightpane-telemetry"})]})}),r.jsx(hn,{id:"help",children:r.jsx(hg,{layout:a,onOpenOverlay:l})}),r.jsx(hn,{id:"settings",children:r.jsx(fg,{})})]})]})})}const qN=new Set(["admin","lockdown","lockdown-admin"]),MN=new Set(["lockdown","lockdown-admin"]),kN=new Set(["admin","lockdown"]);function RN(a="admin"){return a==="lockdown"?{title:"Lockdown mode active",description:"Only the server owners can access the interface at this time."}:{title:"Admin mode active"}}function TN(){const{session:a}=Ve(),l=a?.mode,i=a?.role,o=a?.adminReason?.text||"";a?.adminReason?.updatedAt;const f=a?.timezone||"UTC",d=a?.socials?.find(j=>String(j?.id||j?.label||"").toLowerCase()==="discord")?.url||a?.discord?.invite||null,h=kN.has(l),p=l==="lockdown"?MN.has(i):qN.has(i),[g,v]=m.useState(()=>new Date),y=m.useMemo(()=>{try{return new Intl.DateTimeFormat("en-US",{timeZone:f,hour:"numeric",minute:"2-digit",second:"2-digit"}).format(g)}catch{return g.toLocaleTimeString()}},[g,f]);if(m.useEffect(()=>{const j=setInterval(()=>v(new Date),1e3);return()=>clearInterval(j)},[]),!h||p)return null;const b=RN(l);return r.jsx("div",{className:"pointer-events-auto fixed inset-0 z-50 flex items-center justify-center bg-black/85 px-0.5 py-0.5",children:r.jsxs("div",{className:"surface w-full max-w-md space-y-0.5 text-slate-100 shadow-2xl",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("p",{className:"text-lg font-semibold",children:b.title}),r.jsx("p",{className:"text-sm text-slate-300",children:b.description})]}),r.jsxs("div",{className:"surface-muted space-y-0.5",children:[r.jsx("p",{className:"text-[0.7rem] tracking-wide text-slate-400",children:"Reason for locking:"}),r.jsx("p",{className:"text-lg font-semibold text-slate-100",children:o||"No reason set."}),r.jsxs("p",{className:"text-center text-sm text-slate-300",children:["Server time: ",y]})]}),r.jsx("div",{className:"surface-muted",children:r.jsx(rg,{})}),r.jsx("div",{className:"w-full justify-center items-center",children:r.jsx(Xf,{id:"discord",label:"Join our Discord server for updates!",url:d})}),"You can still use the chat while the server is locked:",r.jsxs("div",{className:"max-h-80 overflow-y-auto",children:[r.jsx(co,{}),r.jsx(Pf,{})]})]})})}const DN="/assets/turn_alert-DVO8EZJa.mp3";function _N(a,l=1){const i=m.useRef(null);return m.useEffect(()=>{i.current=new Audio(a),i.current.volume=l,i.current.load()},[a,l]),()=>{i.current&&(i.current.volume=l,i.current.currentTime=0,i.current.play().catch(()=>{}))}}function ON(){const{session:a,pushAlert:l}=Ve(),{value:i}=st("audio",jt),o=Number.isFinite(i?.masterVolume)?i.masterVolume:jt.masterVolume,f=Number.isFinite(i?.alertVolume)?i.alertVolume:jt.alertVolume,d=Math.max(0,Math.min(1,o*f)),h=_N(DN,d),p=m.useRef(new Set),g=m.useMemo(()=>a?.turnQueues||{},[a?.turnQueues]),v=a?.socketId||null;return m.useEffect(()=>{if(!v)return;const y=[];Object.entries(g).forEach(([b,j])=>{!j||!j.current||j.current!==v||p.current.has(b)||(y.push(b),p.current.add(b))}),Object.keys(g).forEach(b=>{(!g[b]||g[b].current!==v)&&p.current.delete(b)}),y.length!==0&&(y.forEach(b=>{const j=a?.roster?.find(M=>String(M.id)===String(b))?.name||b;l({title:"Your turn!",message:`You now control ${j}.`,color:"#ff5722"})}),h())},[g,h,l,a?.roster,v]),null}function BN({visible:a,mode:l,onEnterFullscreen:i,onDismiss:o}){if(!a)return null;const f=l==="pwa-hint";return r.jsx("div",{className:"fixed inset-0 z-40 flex items-end justify-center p-2 pointer-events-none sm:items-center",children:r.jsx("div",{className:"pointer-events-auto w-full max-w-sm rounded-lg border border-cyan-500/40 bg-zinc-950/95 shadow-xl",children:r.jsxs("div",{className:"space-y-0.5 p-4 text-sm text-slate-100",children:[r.jsx("h2",{className:"text-base font-semibold text-white",children:"Better in fullscreen"}),f?r.jsxs("p",{className:"text-slate-300",children:["For fullscreen on iOS, open Safari's share menu and pick ",r.jsx("strong",{children:"Add to Home Screen"}),". Launching from the home screen removes the browser chrome."]}):r.jsx("p",{className:"text-slate-300",children:"Enable fullscreen to free up more space for the video feed and controls. You can exit fullscreen at any time via the system back or home gesture."}),r.jsxs("div",{className:"flex justify-end gap-0.5 pt-1 text-sm",children:[r.jsx("button",{type:"button",className:"rounded border border-slate-600 px-3 py-1 text-slate-200",onClick:o,children:f?"Got it":"Not now"}),!f&&r.jsx("button",{type:"button",className:"rounded bg-cyan-500 px-3 py-1 font-semibold text-black hover:bg-cyan-400",onClick:i,children:"Enter fullscreen"})]})]})})})}const xg="fullscreenPromptDismissed",zN=new Set(["mobile-portrait","mobile-landscape"]),gg=()=>{if(typeof window>"u")return null;try{return window.sessionStorage}catch{return null}},LN=()=>{const a=gg();if(!a)return!1;try{return a.getItem(xg)==="1"}catch{return!1}},Qp=()=>{const a=gg();if(a)try{a.setItem(xg,"1")}catch{}},UN=()=>{if(typeof navigator>"u")return!1;const a=navigator.userAgent||navigator.platform||"";return/iphone|ipad|ipod/i.test(a)},HN=()=>{if(typeof document>"u")return!1;const a=document;return!!(a.fullscreenEnabled||a.webkitFullscreenEnabled||a.mozFullScreenEnabled||a.msFullscreenEnabled)};function VN(a){const l=zN.has(a),[i,o]=m.useState(!1),[f,d]=m.useState("native"),h=m.useMemo(()=>UN(),[]),p=m.useCallback(()=>{if(!l){o(!1);return}if(LN()){o(!1);return}if(h){d("pwa-hint"),o(!0);return}if(!HN()){o(!1);return}if(typeof document<"u"&&document.fullscreenElement){o(!1);return}d("native"),o(!0)},[h,l]);m.useEffect(()=>{p()},[p]),m.useEffect(()=>{if(typeof document>"u")return;const y=()=>{if(document.fullscreenElement){o(!1);return}p()};return document.addEventListener("fullscreenchange",y),document.addEventListener("webkitfullscreenchange",y),()=>{document.removeEventListener("fullscreenchange",y),document.removeEventListener("webkitfullscreenchange",y)}},[p]);const g=m.useCallback(()=>{Qp(),o(!1)},[]),v=m.useCallback(async()=>{if(!l||h||typeof document>"u")return!1;const y=document.documentElement;if(!y)return!1;const b=y.requestFullscreen||y.webkitRequestFullscreen||y.mozRequestFullScreen||y.msRequestFullscreen;if(!b)return!1;try{const j=b.call(y);return j&&typeof j.then=="function"&&await j,Qp(),o(!1),!0}catch(j){return console.warn("Failed to enter fullscreen",j),!1}},[h,l]);return m.useEffect(()=>{l||o(!1)},[l]),{visible:i,mode:f,enterFullscreen:v,dismiss:g}}function YN({visible:a,layout:l,onClose:i,showOnLoad:o,onToggleShowOnLoad:f}){if(!a)return null;const{state:d}=Dt(),h=p=>{const g=!p.target.checked;f?.(g)};return r.jsx("div",{className:"fixed inset-0 z-30 flex items-center justify-center bg-black/80 px-0.5 py-0.5",children:r.jsxs("div",{className:"pointer-events-auto surface w-full max-w-4xl max-h-[90vh] overflow-hidden shadow-2xl",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-slate-700 px-0.5 py-0.25 text-sm text-slate-200",children:[r.jsx("span",{className:"font-semibold",children:"Help & controls"}),r.jsxs("div",{className:"flex items-center gap-0.5 text-[0.8rem] text-slate-300",children:[r.jsxs("label",{className:"flex items-center gap-0.5",children:[r.jsx("input",{type:"checkbox",checked:!o,onChange:h,className:"accent-cyan-500"}),r.jsx("span",{children:"Don't show again"})]}),r.jsx("button",{type:"button",onClick:i,className:"button-dark px-2 py-0.25 text-[0.8rem]",children:"Close"})]})]}),r.jsx("div",{className:"max-h-[85vh] overflow-y-auto p-0.5",children:r.jsx(mg,{layout:l,keymap:d?.keymap||{}})})]})})}const $N=`aroma
bagel
batter
beans
beer
biscuit
bread
broth
burger
burrito
butter
cake
candy
caramel
caviar
cheese
chili
chimichanga
chocolate
cider
cobbler
cocoa
coffee
cookie
cream
croissant
crumble
cuisine
curd
dessert
dish
drink
eggs
empanada
enchilada
entree
filet
fish
flour
foie gras
food
glaze
grill
hamburger
ice
juice
ketchup
kitchen
lard
liquor
margarine
marinade
mayo
mayonnaise
meat
milk
mousse
muffin
mushroom
noodle
nut
oil
olive
omelette
pan
pasta
paste
pastry
pie
pizza
plate
pot
poutine
pudding
queso
raclette
recipe
rice
salad
salsa
sandwich
sauce
seasoning
skillet
soda
sopapillas
soup
soy
spice
steak
stew
syrup
taco
taquito
tartar
taste
tea
toast
tostada
vinegar
waffle
water
wheat
wine
wok
yeast
yogurt
`;function GN(a){return a?a.charAt(0).toUpperCase()+a.slice(1):""}function XN(){const a=String($N).split(/\r?\n/).map(i=>i.trim()).filter(Boolean);return a.length?(a[Math.floor(Math.random()*a.length)]||"").trim():""}function ed(){const{setNickname:a}=Ve(),{value:l,status:i,save:o}=st("profile",{nickname:""}),f=m.useRef(!1);m.useEffect(()=>{if(i!=="ready"||f.current||(l.nickname||"").trim())return;f.current=!0;const h=GN(XN()).slice(0,32);if(!h)return;(async()=>{try{await a(h)}catch{}finally{o({nickname:h})}})()},[o,a,i,l.nickname])}const ef=1e4,tf=28,QN=14;function to({layout:a="desktop",className:l="",dismissable:i=!0}){const{session:o}=Ve(),f=o?.communityGoal?.text?String(o.communityGoal.text).trim():"",d=a==="mobile-portrait"||a==="mobile-landscape"||a==="mobile",[h,p]=m.useState(!1),[g,v]=m.useState(tf),[y,b]=m.useState(0),j=m.useRef(null),M=m.useRef(null),w=m.useRef(null);m.useEffect(()=>{if(!f){p(!1);return}if(p(!0),!d||!i)return;const S=Date.now();b(ef);const T=setTimeout(()=>p(!1),ef),z=setInterval(()=>{const L=Date.now()-S;b(Math.max(0,ef-L))},250);return()=>{clearTimeout(T),clearInterval(z)}},[f,d]),m.useEffect(()=>{if(!f)return;v(tf);let S=0;const T=()=>{const L=w.current,$=M.current;if(!L||!$)return;const O=L.clientWidth;if(!O)return;const V=$.scrollWidth;if(!V)return;const X=Math.min(1,O/V),Z=Math.max(QN,Math.floor(tf*X));v(Z)};S=window.requestAnimationFrame(T);const z=new ResizeObserver(()=>{window.cancelAnimationFrame(S),S=window.requestAnimationFrame(T)});return j.current&&z.observe(j.current),()=>{window.cancelAnimationFrame(S),z.disconnect()}},[f]);const q=m.useMemo(()=>["panel-section flex w-full items-center justify-center",d?"rounded-none":"rounded","px-1 py-1 text-center font-semibold tracking-tight",l].filter(Boolean).join(" "),[l,d]);if(!f||!h)return null;const N=d?Math.ceil(y/1e3):null,E=i?{onClick:()=>p(!1),role:"button",tabIndex:0}:{};return r.jsx("div",{ref:j,className:q,style:{fontSize:`${g}px`,lineHeight:1.1},...E,children:r.jsxs("span",{className:"flex w-full items-stretch gap-0.5 whitespace-nowrap rounded-md",children:[r.jsxs("span",{className:"flex flex-col justify-center border-r border-slate-700/60 px-0.5 text-[0.55em] font-semibold leading-tight text-slate-400",children:[r.jsx("span",{children:"Community"}),r.jsx("span",{children:"Goal"})]}),r.jsx("span",{ref:w,className:"flex-1 overflow-hidden text-slate-100",children:r.jsx("span",{ref:M,className:"block",children:f})}),d?r.jsxs("span",{className:"flex items-center border-l border-slate-700/60 px-0.5 text-[0.55em] font-semibold uppercase tracking-wide text-slate-400",children:[N,"s"]}):null]})})}function KN(){const[a,l]=m.useState(()=>typeof window>"u"||window.innerWidth>=1024?"desktop":window.innerWidth>window.innerHeight?"mobile-landscape":"mobile-portrait");return m.useEffect(()=>{function i(){if(typeof window>"u")return;const{innerWidth:o,innerHeight:f}=window;o>=1024?l("desktop"):o>f?l("mobile-landscape"):l("mobile-portrait")}return i(),window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[]),a}function FN({layout:a,onOpenHelpOverlay:l}){return r.jsxs("div",{className:"flex h-full gap-0.5 overflow-hidden",children:[r.jsxs("div",{className:"flex min-w-0 flex-[1.22] flex-col gap-0.5 overflow-y-auto pr-0",children:[r.jsx(Qf,{}),r.jsx(gS,{}),r.jsx(Yf,{})]}),r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5 overflow-y-auto",children:[r.jsx(to,{layout:a}),r.jsx(CN,{layout:a,onOpenHelpOverlay:l})]})]})}function vg({layout:a,onOpenHelpOverlay:l,roomPanelId:i,showTelemetry:o=!0}){return r.jsx("section",{className:"panel text-base",children:r.jsxs(Jf,{defaultTab:"chat",children:[r.jsxs(If,{children:[r.jsx(mn,{id:"chat",children:"Chat"}),r.jsx(mn,{id:"roomcontrols",children:"Room Controls"}),r.jsx(mn,{id:"help",children:"Help"}),r.jsx(mn,{id:"settings",children:"Settings"})]}),r.jsxs(Wf,{children:[r.jsx(hn,{id:"chat",children:r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(co,{}),r.jsx(eo,{})]})}),r.jsx(hn,{id:"roomcontrols",children:r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(ig,{}),r.jsx(Vf,{panelId:i})]})}),r.jsx(hn,{id:"help",children:r.jsx(hg,{layout:a,onOpenOverlay:l})}),r.jsx(hn,{id:"settings",children:r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(fg,{}),r.jsx(Yf,{})]})})]})]})})}function ZN({onOpenHelpOverlay:a}){return r.jsxs("div",{className:"flex flex-col gap-0.5",children:[r.jsx(Qf,{layoutFormat:"mobile-portrait"}),r.jsx(GA,{}),r.jsxs("div",{className:"grid gap-0.5 grid-cols-[minmax(0,1fr)_minmax(0,1.4fr)]",children:[r.jsx(_f,{panelId:"replay-sources-mobile-portrait"}),r.jsx(uo,{})]}),r.jsx(vg,{layout:"mobile-portrait",onOpenHelpOverlay:a,roomPanelId:"mobile-portrait-room"})]})}function JN({onOpenHelpOverlay:a}){const l="self-start h-[min(100svh,32rem)]";return r.jsxs("div",{className:"flex flex-col gap-0.5",children:[r.jsxs("section",{className:"grid min-h-screen grid-cols-[minmax(0,0.7fr)_minmax(0,2.1fr)_minmax(0,0.7fr)] gap-0.5",children:[r.jsx(eg,{layout:"landscape",className:l}),r.jsxs("div",{children:[r.jsx(Qf,{layoutFormat:"mobile-landscape"}),r.jsxs("div",{className:"grid gap-0.5 grid-cols-[minmax(0,1fr)_minmax(0,1.4fr)]",children:[r.jsx(_f,{panelId:"replay-sources-mobile-landscape"}),r.jsx(uo,{})]})]}),r.jsx(tg,{layout:"landscape",className:l})]}),r.jsx("div",{className:"flex flex-col gap-0.5 pb-0",children:r.jsx(vg,{layout:"mobile-landscape",onOpenHelpOverlay:a,roomPanelId:"mobile-landscape-room",showTelemetry:!1})})]})}function IN(){const a=KN(),l=a==="desktop",i=VN(a);return r.jsx("div",{className:`bg-black text-slate-100 ${l?"h-screen overflow-hidden":"min-h-screen"}`,children:r.jsx(WN,{layout:a,isDesktop:l,fullscreen:i})})}function WN({layout:a,isDesktop:l,fullscreen:i}){ed();const{visible:o,mode:f,enterFullscreen:d,dismiss:h}=i,{value:p,status:g,save:v}=st("help",{showOnLoad:!0}),[y,b]=m.useState(!1);m.useEffect(()=>{g==="ready"&&b(p?.showOnLoad!==!1)},[g,p?.showOnLoad]);const j=m.useCallback(()=>b(!0),[]),M=m.useCallback(()=>b(!1),[]),w=m.useCallback(N=>{const E=!!N;v(S=>({...S??{},showOnLoad:E})),E||b(!1)},[v]),q=m.useMemo(()=>l?r.jsx(FN,{layout:a,onOpenHelpOverlay:j}):a==="mobile-landscape"?r.jsx(JN,{onOpenHelpOverlay:j}):r.jsx(ZN,{onOpenHelpOverlay:j}),[l,a,j]);return r.jsxs(rA,{children:[r.jsx(vA,{}),r.jsx(_A,{}),r.jsxs("main",{className:`flex w-full flex-col gap-0.5 text-base ${l?"h-full overflow-hidden":""}`,children:[l?null:r.jsx(to,{layout:a}),q]}),r.jsx(Bf,{}),r.jsx(ON,{}),r.jsx(TN,{}),r.jsx(YN,{visible:y,layout:a,onClose:M,showOnLoad:p?.showOnLoad!==!1,onToggleShowOnLoad:w}),r.jsx(BN,{visible:o,mode:f,onEnterFullscreen:d,onDismiss:h})]})}function yg(){const{session:a,setRole:l,subscribeAll:i,connected:o}=Ve(),[f,d]=m.useState(!1);return m.useEffect(()=>{let h=!1;async function p(){if(a?.mode==="lockdown"){d(!1);return}try{a?.role!=="spectator"&&await l("spectator"),await i(),h||d(!0)}catch(g){console.error("Failed to enter spectator mode",g),h||d(!1)}}return p(),()=>{h=!0}},[o,a?.mode,a?.role,l,i]),f}function PN(){const[a,l]=m.useState(()=>typeof window>"u"?!1:window.matchMedia("(max-aspect-ratio: 4/3)").matches);return m.useEffect(()=>{if(typeof window>"u")return;const i=window.matchMedia("(max-aspect-ratio: 4/3)"),o=f=>l(f.matches);return i.addEventListener?i.addEventListener("change",o):i.addListener(o),()=>{i.removeEventListener?i.removeEventListener("change",o):i.removeListener(o)}},[]),a}function e2({roverId:a,session:l}){const i=l?.activeDrivers?.[a]||null,f=(l?.users||[]).find(g=>g.socketId===i)?.nickname||(i?i.slice(0,6):"No driver"),d=l?.mode,h=l?.turnQueues?.[a];return d==="turns"&&h?.current?`${f} (turns)`:f}function t2({rover:a,frame:l,sessionInfo:i,videoMode:o,snapshotFeed:f,audioInfo:d,session:h}){const p=e2({roverId:a.id,session:h});return r.jsx("article",{className:"min-h-[16rem] rounded bg-zinc-900 p-0 sm:min-h-[18rem]",children:r.jsx("div",{className:"min-h-0 overflow-hidden rounded bg-black/20",children:r.jsx(ci,{sessionInfo:i,videoMode:o,snapshotFeed:f,audioSessionInfo:d,label:a.name,telemetryFrame:l,batteryConfig:a.battery,hudVariant:"spectator",driverLabel:p,hudForceMap:!0,hudMapPosition:"top-center"})})})}function n2({roster:a,frames:l,videoSources:i,snapshotFeeds:o,audioSources:f,session:d,canSpectateVideo:h}){return a.length===0?r.jsx("p",{className:"col-span-full text-slate-400",children:"No rovers registered."}):r.jsx("section",{className:"grid grid-cols-1 gap-0.5 md:grid-cols-2",children:a.map(p=>r.jsx(t2,{rover:p,frame:l[p.id],sessionInfo:h&&i[p.id]||null,videoMode:h?"whep":"snapshot",snapshotFeed:h?null:o[p.id],audioInfo:f[`${p.id}-audio`],session:d,showHudMap:!0,hudMapPosition:"bottom-left"},p.id))})}function a2(){return r.jsx("section",{className:"min-h-0",children:r.jsx("div",{className:"surface min-h-[14rem] overflow-hidden",children:r.jsx(Vf,{defaultOrientation:"horizontal",hideLayoutToggle:!0,hideHeader:!0,panelId:"spectator-secondary"})})})}function l2({className:a=""}){return r.jsx("div",{className:`panel ${a}`,children:r.jsx(Yf,{})})}function s2(){const{session:a}=Ve(),l=a?.mode==="lockdown",i=!!a?.isLocalNetwork;ed(),yg();const o=PN(),f=Df(),d=a?.roster??[],h=$f(d.map(N=>N.id),{enabled:!l&&!i,version:a?.mode}),p=i?d.map(N=>({type:"rover",id:N.id,key:N.id})):[],g=ri(p,{enabled:!l&&i,version:a?.mode}),v=d.flatMap(N=>N.media?.audioPublishUrl?[{type:"rover",id:`${N.id}-audio`,key:`${N.id}-audio`}]:[]),y=ri(v,{enabled:!l,version:a?.mode});if(l)return r.jsx("div",{className:"flex min-h-screen items-center justify-center bg-black text-slate-200",children:r.jsxs("div",{className:"surface max-w-md space-y-0.5 p-1 text-center text-sm",children:[r.jsx("p",{className:"text-lg font-semibold text-white",children:"Spectate disabled during lockdown."}),r.jsx("p",{className:"text-slate-300",children:"Please wait until the server leaves lockdown to view streams."})]})});const b=o?"flex min-h-screen flex-col bg-black text-slate-100 md:h-screen md:overflow-hidden":"grid min-h-screen grid-cols-1 gap-0.5 bg-black text-slate-100 md:h-full md:min-h-0 md:grid-cols-[minmax(0,1fr)_18rem] lg:grid-cols-[minmax(0,1fr)_20rem]",j=o?"order-2 flex min-h-0 min-w-0 flex-1 flex-col gap-0.5 overflow-y-auto":"order-1 flex min-h-0 min-w-0 flex-col gap-0.5 md:overflow-y-auto",M=o?"order-1 grid w-full min-h-0 items-stretch gap-0.5 border-b border-slate-800/60 bg-slate-950/90 p-0.5 grid-cols-[minmax(0,1fr)_minmax(0,0.7fr)_minmax(0,1.9fr)_minmax(0,0.7fr)]":"order-2 flex min-h-0 min-w-0 flex-col gap-0.5 border-l border-slate-800/60 bg-slate-950/90 md:h-full md:overflow-y-auto",w="",q=o?"h-64":"";return r.jsxs("div",{className:"min-h-screen bg-black text-slate-100 md:h-screen md:overflow-hidden",children:[r.jsxs("main",{className:b,children:[r.jsxs("section",{className:M,children:[o?r.jsxs("div",{className:`${w} ${q} flex flex-col gap-0.5`,children:[r.jsx(to,{layout:"desktop",dismissable:!1,className:"text-sm"}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(eo,{hideNicknameForm:!0,hideHeader:!0,compact:!0,fillHeight:!0,className:"h-full"})})]}):r.jsx("div",{className:w,children:r.jsx(to,{layout:"desktop",dismissable:!1,className:"text-sm"})}),r.jsx("div",{className:`${w} ${o?`${q} overflow-y-auto`:""}`,children:r.jsx("div",{className:"panel h-full",children:r.jsx(uo,{title:"Rovers"})})}),o?null:r.jsx("div",{className:`${w} flex-1 min-h-0`,children:r.jsx(eo,{hideNicknameForm:!0,hideHeader:!0,compact:!0,fillHeight:!0,className:"h-full"})}),r.jsx("div",{className:`${w} ${o?q:"flex-[1.1] min-h-0"}`,children:r.jsx(co,{allowSpectatorInput:!0,hideSpectatorNotice:!0,fillHeight:!0})}),r.jsx("div",{className:`${w} ${o?q:""}`,children:r.jsx(l2,{className:`${o?"h-full":"h-40"} overflow-hidden`})})]}),r.jsxs("section",{className:j,children:[r.jsx(n2,{roster:d,frames:f,videoSources:g,snapshotFeeds:h,audioSources:y,session:a,canSpectateVideo:i}),r.jsx(a2,{})]})]}),r.jsx(Bf,{})]})}function i2(){return r.jsx(s2,{})}const r2=2e4,o2=3600*1e3;function c2({roverId:a,session:l}){const i=l?.activeDrivers?.[a]||null,f=(l?.users||[]).find(p=>p.socketId===i)?.nickname||(i?i.slice(0,6):"No driver"),d=l?.mode,h=l?.turnQueues?.[a];return d==="turns"&&h?.current?`${f}`:f}function u2({rover:a,frame:l}){const i=l?.sensors?.batteryChargeMah??null,o=a?.battery??null;return sg({batteryState:a?.batteryState??null,charge:i,config:o})}function Kp({rover:a,frame:l,driverLabel:i,sessionInfo:o,videoMode:f="snapshot",snapshotFeed:d,withDivider:h=!1,showPreview:p=!0,variant:g="stacked"}){const v=u2({rover:a,frame:l}),y=v?.available?v.percentDisplay:null,b=g==="active";return r.jsxs("div",{className:`relative flex min-w-0 flex-1 flex-col gap-4 overflow-hidden bg-black px-0 py-0 ${h?"border-r border-slate-700/60":""}`,children:[r.jsx(yf,{visual:v,orientation:b?"vertical":"horizontal",variant:"background"}),b?r.jsxs("div",{className:"relative z-10 flex min-w-0 flex-1 flex-col justify-between text-center",children:[r.jsx("div",{className:"min-w-0 bg-transparent px-0 py-0 leading-none",children:r.jsx(Xl,{className:"font-semibold leading-none text-white",maxSize:1e3,minSize:18,children:a.name||a.id})}),i?r.jsx("div",{className:"min-w-0 bg-transparent px-0 py-0 leading-none",children:r.jsx(Xl,{className:"font-semibold leading-none text-white",maxSize:1e3,minSize:16,children:i})}):r.jsx("div",{}),r.jsx("div",{className:"relative min-w-0 overflow-hidden bg-transparent px-0 py-0 leading-none",children:r.jsx("div",{className:"relative",children:r.jsx(Xl,{className:"font-semibold leading-none text-white",maxSize:1e3,minSize:16,children:y==null?"--%":`${y}%`})})})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"relative z-10 flex min-w-0 flex-col gap-1 text-center",children:[r.jsx("div",{className:"min-w-0 bg-transparent px-0 py-0 leading-none",children:r.jsx(Xl,{className:"font-semibold leading-none text-white",maxSize:1e3,minSize:18,children:a.name||a.id})}),i?r.jsx("div",{className:"min-w-0 bg-transparent px-0 py-0 leading-none",children:r.jsx(Xl,{className:"font-semibold leading-none text-white",maxSize:1e3,minSize:16,children:i})}):null,r.jsx("div",{className:"relative min-w-0 overflow-hidden bg-transparent px-0 py-0 leading-none",children:r.jsx("div",{className:"relative",children:r.jsx(Xl,{className:"font-semibold leading-none text-white",maxSize:80,minSize:16,children:y==null?"--%":`${y}%`})})})]}),r.jsx("div",{className:"relative z-10 flex min-w-0 flex-1 flex-col gap-4",children:r.jsx("div",{className:"flex w-full min-w-0 flex-1 flex-col items-center gap-4",children:p?r.jsx("div",{className:"mt-auto w-full",children:r.jsx("div",{className:"w-full aspect-[4/3]",children:r.jsx(ci,{sessionInfo:o,videoMode:f,snapshotFeed:d,audioSessionInfo:null,label:a.name||a.id,telemetryFrame:l,batteryConfig:a.battery,layoutFormat:"mobile",hudVariant:"none",fitParent:!0})})}):null})})]})]})}function Xl({children:a,className:l="",maxSize:i=1e3,minSize:o=14}){const f=m.useRef(null),d=m.useRef(null),[h,p]=m.useState(i);return m.useLayoutEffect(()=>{const g=f.current,v=d.current;if(!g||!v)return;let y=null;const b=()=>{const w=g.clientWidth;if(!w){j();return}let q=o,N=i,E=o;for(;q<=N;){const S=Math.floor((q+N)/2);v.style.fontSize=`${S}px`,v.scrollWidth<=w?(E=S,q=S+1):N=S-1}p(E)},j=()=>{y&&cancelAnimationFrame(y),y=requestAnimationFrame(b)};j();const M=new ResizeObserver(j);return M.observe(g),()=>{y&&cancelAnimationFrame(y),M.disconnect()}},[a,i,o]),r.jsx("div",{ref:f,className:"w-full min-w-0",children:r.jsx("div",{ref:d,className:`whitespace-nowrap ${l}`,style:{fontSize:`${h}px`,lineHeight:1.1},children:a})})}function f2(){const{session:a}=Ve(),l=yg();ed();const i=a?.mode==="lockdown",o=!!a?.isLocalNetwork,f=Df(),d=a?.roster??[],[h,p]=m.useState(0),g=a?.activeDrivers||{},v=m.useMemo(()=>d.filter(Z=>g[Z.id]),[d,g]),y=v.length?v:d,b=$f(y.map(Z=>Z.id),{enabled:!i&&!o,version:a?.mode}),j=m.useMemo(()=>o?y.map(Z=>({type:"rover",id:Z.id,key:Z.id})):[],[o,y]),M=ri(j,{enabled:!i&&o,version:a?.mode}),w=m.useMemo(()=>v.flatMap(Z=>{if(!Z?.id||!Z.media?.audioPublishUrl)return[];const F=String(Z.id);return[{type:"rover",id:`${F}-audio`,key:`${F}-audio`}]}),[v]),q=ri(w,{enabled:!i,version:a?.mode}),N=m.useMemo(()=>{if(!v.length)return[];if(!o){const F=v.filter(ae=>b[ae.id]?.objectUrl);return F.length?F:v}const Z=v.filter(F=>{const ae=M[F.id];return ae?.url&&!ae?.error});return Z.length?Z:v},[v,b,M,o]),E=m.useMemo(()=>N.map(Z=>({type:"rover",rover:Z})),[N]),S=m.useMemo(()=>E.map(Z=>`r:${Z.rover.id}`).join("|"),[E]);m.useEffect(()=>{p(0)},[S]),m.useEffect(()=>{if(!E.length)return;const Z=setInterval(()=>{p(F=>(F+1)%E.length)},r2);return()=>clearInterval(Z)},[E.length,S]);const T=E.length?E[h%E.length]:null,z=T?.type==="rover"?T.rover:null,L=!o&&z&&b[z.id]||null,$=o&&z&&M[z.id]||null,O=z&&q[`${z.id}-audio`]||null,V=z&&f[z.id]||null,X=z?c2({roverId:z.id,session:a}):null;return i?r.jsx("div",{className:"relative flex h-screen w-screen items-center justify-center bg-black text-slate-200",children:r.jsxs("div",{className:"surface max-w-sm space-y-0.5 p-1 text-center text-sm",children:[r.jsx("p",{className:"text-lg font-semibold text-white",children:"Mini spectator is disabled in lockdown."}),r.jsx("p",{className:"text-slate-300",children:"It will automatically resume once lockdown ends."})]})}):v.length?r.jsxs("div",{className:"relative flex h-screen w-screen overflow-hidden bg-black text-slate-100",children:[r.jsx("section",{className:"relative flex h-full shrink-0 items-center justify-start overflow-hidden bg-black",style:{width:"min(100vw, calc(100vh * 4 / 3))"},children:l?z?r.jsx(m2,{children:o?r.jsx("div",{className:"relative h-full w-full",children:E.map(Z=>{const F=Z.rover,ae=z?.id===F.id;return r.jsx("div",{className:`absolute inset-0 ${ae?"opacity-100":"opacity-0 pointer-events-none"}`,children:r.jsx(ci,{sessionInfo:M[F.id]||null,videoMode:"whep",snapshotFeed:null,audioSessionInfo:ae?O:null,forceMute:!ae,label:F.name||F.id,telemetryFrame:f[F.id]||null,batteryConfig:F.battery,layoutFormat:"mobile",hudVariant:"none",fitParent:!0})},F.id)})}):r.jsx(ci,{sessionInfo:null,videoMode:"snapshot",snapshotFeed:L,audioSessionInfo:O,label:z.name||z.id,telemetryFrame:V,batteryConfig:z.battery,layoutFormat:"mobile",hudVariant:"none",fitParent:!0})}):r.jsx("div",{className:"flex h-full w-full items-center justify-center text-sm text-slate-500",children:v.length?"No sources available.":"No active drivers."}):r.jsx("div",{className:"flex h-full w-full items-center justify-center text-sm text-slate-500",children:"Switching to spectator…"})}),r.jsx("aside",{className:"flex h-full min-w-0 flex-1 flex-col border-l border-slate-800/60 bg-black",children:z?r.jsx(Kp,{rover:z,frame:V,driverLabel:X,sessionInfo:o?$:null,videoMode:o?"whep":"snapshot",snapshotFeed:o?null:b[z.id]||null,showPreview:!1,variant:"active"}):r.jsx("div",{className:"flex h-full w-full items-center justify-center text-sm text-slate-500",children:"No active rover."})})]}):r.jsx("div",{className:"relative flex h-screen w-screen overflow-hidden bg-black text-slate-100",children:r.jsx("section",{className:"flex h-full w-full gap-x-3 bg-slate-900 px-0",children:d.length?d.map((Z,F)=>r.jsx(Kp,{rover:Z,frame:f[Z.id]||null,driverLabel:null,sessionInfo:o&&M[Z.id]||null,videoMode:o?"whep":"snapshot",snapshotFeed:o?null:b[Z.id]||null,showPreview:!0,withDivider:!1},Z.id)):r.jsx("div",{className:"flex h-full w-full items-center justify-center text-sm text-slate-500",children:"No rovers available."})})})}function d2(){return m.useEffect(()=>{if(typeof window>"u")return;const a=setTimeout(()=>{const l=new URL(window.location.href);l.searchParams.set("refresh",Date.now().toString()),window.location.replace(l.toString())},o2);return()=>clearTimeout(a)},[]),r.jsxs(r.Fragment,{children:[r.jsx(f2,{}),r.jsx(Bf,{scale:3})]})}function m2({children:a}){return r.jsx("div",{className:"flex h-full w-full items-center justify-start overflow-hidden bg-black",children:r.jsx("div",{className:"relative flex items-center justify-center overflow-hidden bg-black",style:{width:"min(100%, calc(100vh * 4 / 3))",height:"min(100%, calc(100vw * 3 / 4))",maxWidth:"100%",maxHeight:"100%",aspectRatio:"4 / 3"},children:r.jsx("div",{className:"flex h-full w-full items-center justify-center overflow-hidden",children:a})})})}Vy.createRoot(document.getElementById("root")).render(r.jsx(m.StrictMode,{children:r.jsx(uS,{children:r.jsx(dS,{children:r.jsx(mS,{children:r.jsx(AS,{children:r.jsx(cA,{children:r.jsx(n1,{children:r.jsxs(Db,{children:[r.jsx(Ur,{path:"/",element:r.jsx(IN,{})}),r.jsx(Ur,{path:"/spectate",element:r.jsx(i2,{})}),r.jsx(Ur,{path:"/mini",element:r.jsx(d2,{})})]})})})})})})})}));