livedesk 0.1.34 → 0.1.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,38 @@
1
+ (function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))l(c);new MutationObserver(c=>{for(const d of c)if(d.type==="childList")for(const h of d.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&l(h)}).observe(document,{childList:!0,subtree:!0});function r(c){const d={};return c.integrity&&(d.integrity=c.integrity),c.referrerPolicy&&(d.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?d.credentials="include":c.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function l(c){if(c.ep)return;c.ep=!0;const d=r(c);fetch(c.href,d)}})();var ed={exports:{}},qs={};var _g;function l0(){if(_g)return qs;_g=1;var i=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function r(l,c,d){var h=null;if(d!==void 0&&(h=""+d),c.key!==void 0&&(h=""+c.key),"key"in c){d={};for(var m in c)m!=="key"&&(d[m]=c[m])}else d=c;return c=d.ref,{$$typeof:i,type:l,key:h,ref:c!==void 0?c:null,props:d}}return qs.Fragment=n,qs.jsx=r,qs.jsxs=r,qs}var Tg;function o0(){return Tg||(Tg=1,ed.exports=l0()),ed.exports}var y=o0(),td={exports:{}},pe={};var kg;function c0(){if(kg)return pe;kg=1;var i=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),h=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),T=Symbol.iterator;function A(E){return E===null||typeof E!="object"?null:(E=T&&E[T]||E["@@iterator"],typeof E=="function"?E:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},z=Object.assign,G={};function I(E,M,J){this.props=E,this.context=M,this.refs=G,this.updater=J||C}I.prototype.isReactComponent={},I.prototype.setState=function(E,M){if(typeof E!="object"&&typeof E!="function"&&E!=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,E,M,"setState")},I.prototype.forceUpdate=function(E){this.updater.enqueueForceUpdate(this,E,"forceUpdate")};function $(){}$.prototype=I.prototype;function O(E,M,J){this.props=E,this.context=M,this.refs=G,this.updater=J||C}var Y=O.prototype=new $;Y.constructor=O,z(Y,I.prototype),Y.isPureReactComponent=!0;var me=Array.isArray;function ie(){}var K={H:null,A:null,T:null,S:null},Ee=Object.prototype.hasOwnProperty;function Se(E,M,J){var Z=J.ref;return{$$typeof:i,type:E,key:M,ref:Z!==void 0?Z:null,props:J}}function Kt(E,M){return Se(E.type,M,E.props)}function te(E){return typeof E=="object"&&E!==null&&E.$$typeof===i}function Ce(E){var M={"=":"=0",":":"=2"};return"$"+E.replace(/[=:]/g,function(J){return M[J]})}var Je=/\/+/g;function Xe(E,M){return typeof E=="object"&&E!==null&&E.key!=null?Ce(""+E.key):M.toString(36)}function ze(E){switch(E.status){case"fulfilled":return E.value;case"rejected":throw E.reason;default:switch(typeof E.status=="string"?E.then(ie,ie):(E.status="pending",E.then(function(M){E.status==="pending"&&(E.status="fulfilled",E.value=M)},function(M){E.status==="pending"&&(E.status="rejected",E.reason=M)})),E.status){case"fulfilled":return E.value;case"rejected":throw E.reason}}throw E}function D(E,M,J,Z,ge){var ye=typeof E;(ye==="undefined"||ye==="boolean")&&(E=null);var Oe=!1;if(E===null)Oe=!0;else switch(ye){case"bigint":case"string":case"number":Oe=!0;break;case"object":switch(E.$$typeof){case i:case n:Oe=!0;break;case S:return Oe=E._init,D(Oe(E._payload),M,J,Z,ge)}}if(Oe)return ge=ge(E),Oe=Z===""?"."+Xe(E,0):Z,me(ge)?(J="",Oe!=null&&(J=Oe.replace(Je,"$&/")+"/"),D(ge,M,J,"",function(xn){return xn})):ge!=null&&(te(ge)&&(ge=Kt(ge,J+(ge.key==null||E&&E.key===ge.key?"":(""+ge.key).replace(Je,"$&/")+"/")+Oe)),M.push(ge)),1;Oe=0;var Qe=Z===""?".":Z+":";if(me(E))for(var Ze=0;Ze<E.length;Ze++)Z=E[Ze],ye=Qe+Xe(Z,Ze),Oe+=D(Z,M,J,ye,ge);else if(Ze=A(E),typeof Ze=="function")for(E=Ze.call(E),Ze=0;!(Z=E.next()).done;)Z=Z.value,ye=Qe+Xe(Z,Ze++),Oe+=D(Z,M,J,ye,ge);else if(ye==="object"){if(typeof E.then=="function")return D(ze(E),M,J,Z,ge);throw M=String(E),Error("Objects are not valid as a React child (found: "+(M==="[object Object]"?"object with keys {"+Object.keys(E).join(", ")+"}":M)+"). If you meant to render a collection of children, use an array instead.")}return Oe}function V(E,M,J){if(E==null)return E;var Z=[],ge=0;return D(E,Z,"","",function(ye){return M.call(J,ye,ge++)}),Z}function le(E){if(E._status===-1){var M=E._result;M=M(),M.then(function(J){(E._status===0||E._status===-1)&&(E._status=1,E._result=J)},function(J){(E._status===0||E._status===-1)&&(E._status=2,E._result=J)}),E._status===-1&&(E._status=0,E._result=M)}if(E._status===1)return E._result.default;throw E._result}var ne=typeof reportError=="function"?reportError:function(E){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var M=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(M))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",E);return}console.error(E)},xe={map:V,forEach:function(E,M,J){V(E,function(){M.apply(this,arguments)},J)},count:function(E){var M=0;return V(E,function(){M++}),M},toArray:function(E){return V(E,function(M){return M})||[]},only:function(E){if(!te(E))throw Error("React.Children.only expected to receive a single React element child.");return E}};return pe.Activity=b,pe.Children=xe,pe.Component=I,pe.Fragment=r,pe.Profiler=c,pe.PureComponent=O,pe.StrictMode=l,pe.Suspense=g,pe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=K,pe.__COMPILER_RUNTIME={__proto__:null,c:function(E){return K.H.useMemoCache(E)}},pe.cache=function(E){return function(){return E.apply(null,arguments)}},pe.cacheSignal=function(){return null},pe.cloneElement=function(E,M,J){if(E==null)throw Error("The argument must be a React element, but you passed "+E+".");var Z=z({},E.props),ge=E.key;if(M!=null)for(ye in M.key!==void 0&&(ge=""+M.key),M)!Ee.call(M,ye)||ye==="key"||ye==="__self"||ye==="__source"||ye==="ref"&&M.ref===void 0||(Z[ye]=M[ye]);var ye=arguments.length-2;if(ye===1)Z.children=J;else if(1<ye){for(var Oe=Array(ye),Qe=0;Qe<ye;Qe++)Oe[Qe]=arguments[Qe+2];Z.children=Oe}return Se(E.type,ge,Z)},pe.createContext=function(E){return E={$$typeof:h,_currentValue:E,_currentValue2:E,_threadCount:0,Provider:null,Consumer:null},E.Provider=E,E.Consumer={$$typeof:d,_context:E},E},pe.createElement=function(E,M,J){var Z,ge={},ye=null;if(M!=null)for(Z in M.key!==void 0&&(ye=""+M.key),M)Ee.call(M,Z)&&Z!=="key"&&Z!=="__self"&&Z!=="__source"&&(ge[Z]=M[Z]);var Oe=arguments.length-2;if(Oe===1)ge.children=J;else if(1<Oe){for(var Qe=Array(Oe),Ze=0;Ze<Oe;Ze++)Qe[Ze]=arguments[Ze+2];ge.children=Qe}if(E&&E.defaultProps)for(Z in Oe=E.defaultProps,Oe)ge[Z]===void 0&&(ge[Z]=Oe[Z]);return Se(E,ye,ge)},pe.createRef=function(){return{current:null}},pe.forwardRef=function(E){return{$$typeof:m,render:E}},pe.isValidElement=te,pe.lazy=function(E){return{$$typeof:S,_payload:{_status:-1,_result:E},_init:le}},pe.memo=function(E,M){return{$$typeof:p,type:E,compare:M===void 0?null:M}},pe.startTransition=function(E){var M=K.T,J={};K.T=J;try{var Z=E(),ge=K.S;ge!==null&&ge(J,Z),typeof Z=="object"&&Z!==null&&typeof Z.then=="function"&&Z.then(ie,ne)}catch(ye){ne(ye)}finally{M!==null&&J.types!==null&&(M.types=J.types),K.T=M}},pe.unstable_useCacheRefresh=function(){return K.H.useCacheRefresh()},pe.use=function(E){return K.H.use(E)},pe.useActionState=function(E,M,J){return K.H.useActionState(E,M,J)},pe.useCallback=function(E,M){return K.H.useCallback(E,M)},pe.useContext=function(E){return K.H.useContext(E)},pe.useDebugValue=function(){},pe.useDeferredValue=function(E,M){return K.H.useDeferredValue(E,M)},pe.useEffect=function(E,M){return K.H.useEffect(E,M)},pe.useEffectEvent=function(E){return K.H.useEffectEvent(E)},pe.useId=function(){return K.H.useId()},pe.useImperativeHandle=function(E,M,J){return K.H.useImperativeHandle(E,M,J)},pe.useInsertionEffect=function(E,M){return K.H.useInsertionEffect(E,M)},pe.useLayoutEffect=function(E,M){return K.H.useLayoutEffect(E,M)},pe.useMemo=function(E,M){return K.H.useMemo(E,M)},pe.useOptimistic=function(E,M){return K.H.useOptimistic(E,M)},pe.useReducer=function(E,M,J){return K.H.useReducer(E,M,J)},pe.useRef=function(E){return K.H.useRef(E)},pe.useState=function(E){return K.H.useState(E)},pe.useSyncExternalStore=function(E,M,J){return K.H.useSyncExternalStore(E,M,J)},pe.useTransition=function(){return K.H.useTransition()},pe.version="19.2.7",pe}var Eg;function Pd(){return Eg||(Eg=1,td.exports=c0()),td.exports}var H=Pd(),nd={exports:{}},$s={},ad={exports:{}},id={};var Ag;function u0(){return Ag||(Ag=1,(function(i){function n(D,V){var le=D.length;D.push(V);e:for(;0<le;){var ne=le-1>>>1,xe=D[ne];if(0<c(xe,V))D[ne]=V,D[le]=xe,le=ne;else break e}}function r(D){return D.length===0?null:D[0]}function l(D){if(D.length===0)return null;var V=D[0],le=D.pop();if(le!==V){D[0]=le;e:for(var ne=0,xe=D.length,E=xe>>>1;ne<E;){var M=2*(ne+1)-1,J=D[M],Z=M+1,ge=D[Z];if(0>c(J,le))Z<xe&&0>c(ge,J)?(D[ne]=ge,D[Z]=le,ne=Z):(D[ne]=J,D[M]=le,ne=M);else if(Z<xe&&0>c(ge,le))D[ne]=ge,D[Z]=le,ne=Z;else break e}}return V}function c(D,V){var le=D.sortIndex-V.sortIndex;return le!==0?le:D.id-V.id}if(i.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;i.unstable_now=function(){return d.now()}}else{var h=Date,m=h.now();i.unstable_now=function(){return h.now()-m}}var g=[],p=[],S=1,b=null,T=3,A=!1,C=!1,z=!1,G=!1,I=typeof setTimeout=="function"?setTimeout:null,$=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function Y(D){for(var V=r(p);V!==null;){if(V.callback===null)l(p);else if(V.startTime<=D)l(p),V.sortIndex=V.expirationTime,n(g,V);else break;V=r(p)}}function me(D){if(z=!1,Y(D),!C)if(r(g)!==null)C=!0,ie||(ie=!0,Ce());else{var V=r(p);V!==null&&ze(me,V.startTime-D)}}var ie=!1,K=-1,Ee=5,Se=-1;function Kt(){return G?!0:!(i.unstable_now()-Se<Ee)}function te(){if(G=!1,ie){var D=i.unstable_now();Se=D;var V=!0;try{e:{C=!1,z&&(z=!1,$(K),K=-1),A=!0;var le=T;try{t:{for(Y(D),b=r(g);b!==null&&!(b.expirationTime>D&&Kt());){var ne=b.callback;if(typeof ne=="function"){b.callback=null,T=b.priorityLevel;var xe=ne(b.expirationTime<=D);if(D=i.unstable_now(),typeof xe=="function"){b.callback=xe,Y(D),V=!0;break t}b===r(g)&&l(g),Y(D)}else l(g);b=r(g)}if(b!==null)V=!0;else{var E=r(p);E!==null&&ze(me,E.startTime-D),V=!1}}break e}finally{b=null,T=le,A=!1}V=void 0}}finally{V?Ce():ie=!1}}}var Ce;if(typeof O=="function")Ce=function(){O(te)};else if(typeof MessageChannel<"u"){var Je=new MessageChannel,Xe=Je.port2;Je.port1.onmessage=te,Ce=function(){Xe.postMessage(null)}}else Ce=function(){I(te,0)};function ze(D,V){K=I(function(){D(i.unstable_now())},V)}i.unstable_IdlePriority=5,i.unstable_ImmediatePriority=1,i.unstable_LowPriority=4,i.unstable_NormalPriority=3,i.unstable_Profiling=null,i.unstable_UserBlockingPriority=2,i.unstable_cancelCallback=function(D){D.callback=null},i.unstable_forceFrameRate=function(D){0>D||125<D?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Ee=0<D?Math.floor(1e3/D):5},i.unstable_getCurrentPriorityLevel=function(){return T},i.unstable_next=function(D){switch(T){case 1:case 2:case 3:var V=3;break;default:V=T}var le=T;T=V;try{return D()}finally{T=le}},i.unstable_requestPaint=function(){G=!0},i.unstable_runWithPriority=function(D,V){switch(D){case 1:case 2:case 3:case 4:case 5:break;default:D=3}var le=T;T=D;try{return V()}finally{T=le}},i.unstable_scheduleCallback=function(D,V,le){var ne=i.unstable_now();switch(typeof le=="object"&&le!==null?(le=le.delay,le=typeof le=="number"&&0<le?ne+le:ne):le=ne,D){case 1:var xe=-1;break;case 2:xe=250;break;case 5:xe=1073741823;break;case 4:xe=1e4;break;default:xe=5e3}return xe=le+xe,D={id:S++,callback:V,priorityLevel:D,startTime:le,expirationTime:xe,sortIndex:-1},le>ne?(D.sortIndex=le,n(p,D),r(g)===null&&D===r(p)&&(z?($(K),K=-1):z=!0,ze(me,le-ne))):(D.sortIndex=xe,n(g,D),C||A||(C=!0,ie||(ie=!0,Ce()))),D},i.unstable_shouldYield=Kt,i.unstable_wrapCallback=function(D){var V=T;return function(){var le=T;T=V;try{return D.apply(this,arguments)}finally{T=le}}}})(id)),id}var xg;function d0(){return xg||(xg=1,ad.exports=u0()),ad.exports}var rd={exports:{}},Rt={};var Cg;function h0(){if(Cg)return Rt;Cg=1;var i=Pd();function n(g){var p="https://react.dev/errors/"+g;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var S=2;S<arguments.length;S++)p+="&args[]="+encodeURIComponent(arguments[S])}return"Minified React error #"+g+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var l={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},c=Symbol.for("react.portal");function d(g,p,S){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:b==null?null:""+b,children:g,containerInfo:p,implementation:S}}var h=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(g,p){if(g==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return Rt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=l,Rt.createPortal=function(g,p){var S=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(n(299));return d(g,p,null,S)},Rt.flushSync=function(g){var p=h.T,S=l.p;try{if(h.T=null,l.p=2,g)return g()}finally{h.T=p,l.p=S,l.d.f()}},Rt.preconnect=function(g,p){typeof g=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,l.d.C(g,p))},Rt.prefetchDNS=function(g){typeof g=="string"&&l.d.D(g)},Rt.preinit=function(g,p){if(typeof g=="string"&&p&&typeof p.as=="string"){var S=p.as,b=m(S,p.crossOrigin),T=typeof p.integrity=="string"?p.integrity:void 0,A=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;S==="style"?l.d.S(g,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:b,integrity:T,fetchPriority:A}):S==="script"&&l.d.X(g,{crossOrigin:b,integrity:T,fetchPriority:A,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Rt.preinitModule=function(g,p){if(typeof g=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var S=m(p.as,p.crossOrigin);l.d.M(g,{crossOrigin:S,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&l.d.M(g)},Rt.preload=function(g,p){if(typeof g=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var S=p.as,b=m(S,p.crossOrigin);l.d.L(g,S,{crossOrigin:b,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},Rt.preloadModule=function(g,p){if(typeof g=="string")if(p){var S=m(p.as,p.crossOrigin);l.d.m(g,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:S,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else l.d.m(g)},Rt.requestFormReset=function(g){l.d.r(g)},Rt.unstable_batchedUpdates=function(g,p){return g(p)},Rt.useFormState=function(g,p,S){return h.H.useFormState(g,p,S)},Rt.useFormStatus=function(){return h.H.useHostTransitionStatus()},Rt.version="19.2.7",Rt}var Og;function f0(){if(Og)return rd.exports;Og=1;function i(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(n){console.error(n)}}return i(),rd.exports=h0(),rd.exports}var Rg;function m0(){if(Rg)return $s;Rg=1;var i=d0(),n=Pd(),r=f0();function l(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}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 c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function d(e){var t=e,a=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(a=t.return),e=t.return;while(e)}return t.tag===3?a:null}function h(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function m(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function g(e){if(d(e)!==e)throw Error(l(188))}function p(e){var t=e.alternate;if(!t){if(t=d(e),t===null)throw Error(l(188));return t!==e?null:e}for(var a=e,s=t;;){var o=a.return;if(o===null)break;var u=o.alternate;if(u===null){if(s=o.return,s!==null){a=s;continue}break}if(o.child===u.child){for(u=o.child;u;){if(u===a)return g(o),e;if(u===s)return g(o),t;u=u.sibling}throw Error(l(188))}if(a.return!==s.return)a=o,s=u;else{for(var f=!1,v=o.child;v;){if(v===a){f=!0,a=o,s=u;break}if(v===s){f=!0,s=o,a=u;break}v=v.sibling}if(!f){for(v=u.child;v;){if(v===a){f=!0,a=u,s=o;break}if(v===s){f=!0,s=u,a=o;break}v=v.sibling}if(!f)throw Error(l(189))}}if(a.alternate!==s)throw Error(l(190))}if(a.tag!==3)throw Error(l(188));return a.stateNode.current===a?e:t}function S(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=S(e),t!==null)return t;e=e.sibling}return null}var b=Object.assign,T=Symbol.for("react.element"),A=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),z=Symbol.for("react.fragment"),G=Symbol.for("react.strict_mode"),I=Symbol.for("react.profiler"),$=Symbol.for("react.consumer"),O=Symbol.for("react.context"),Y=Symbol.for("react.forward_ref"),me=Symbol.for("react.suspense"),ie=Symbol.for("react.suspense_list"),K=Symbol.for("react.memo"),Ee=Symbol.for("react.lazy"),Se=Symbol.for("react.activity"),Kt=Symbol.for("react.memo_cache_sentinel"),te=Symbol.iterator;function Ce(e){return e===null||typeof e!="object"?null:(e=te&&e[te]||e["@@iterator"],typeof e=="function"?e:null)}var Je=Symbol.for("react.client.reference");function Xe(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Je?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case z:return"Fragment";case I:return"Profiler";case G:return"StrictMode";case me:return"Suspense";case ie:return"SuspenseList";case Se:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case C:return"Portal";case O:return e.displayName||"Context";case $:return(e._context.displayName||"Context")+".Consumer";case Y:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case K:return t=e.displayName||null,t!==null?t:Xe(e.type)||"Memo";case Ee:t=e._payload,e=e._init;try{return Xe(e(t))}catch{}}return null}var ze=Array.isArray,D=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,le={pending:!1,data:null,method:null,action:null},ne=[],xe=-1;function E(e){return{current:e}}function M(e){0>xe||(e.current=ne[xe],ne[xe]=null,xe--)}function J(e,t){xe++,ne[xe]=e.current,e.current=t}var Z=E(null),ge=E(null),ye=E(null),Oe=E(null);function Qe(e,t){switch(J(ye,t),J(ge,e),J(Z,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vm(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vm(t),e=Km(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}M(Z),J(Z,e)}function Ze(){M(Z),M(ge),M(ye)}function xn(e){e.memoizedState!==null&&J(Oe,e);var t=Z.current,a=Km(t,e.type);t!==a&&(J(ge,e),J(Z,a))}function gn(e){ge.current===e&&(M(Z),M(ge)),Oe.current===e&&(M(Oe),Us._currentValue=le)}var xi,Ci;function In(e){if(xi===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);xi=t&&t[1]||"",Ci=-1<a.stack.indexOf(`
2
+ at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
3
+ `+xi+e+Ci}var zr=!1;function va(e,t){if(!e||zr)return"";zr=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(t){var q=function(){throw Error()};if(Object.defineProperty(q.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(q,[])}catch(L){var N=L}Reflect.construct(e,[],q)}else{try{q.call()}catch(L){N=L}e.call(q.prototype)}}else{try{throw Error()}catch(L){N=L}(q=e())&&typeof q.catch=="function"&&q.catch(function(){})}}catch(L){if(L&&N&&typeof L.stack=="string")return[L.stack,N.stack]}return[null,null]}};s.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var o=Object.getOwnPropertyDescriptor(s.DetermineComponentFrameRoot,"name");o&&o.configurable&&Object.defineProperty(s.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var u=s.DetermineComponentFrameRoot(),f=u[0],v=u[1];if(f&&v){var _=f.split(`
4
+ `),j=v.split(`
5
+ `);for(o=s=0;s<_.length&&!_[s].includes("DetermineComponentFrameRoot");)s++;for(;o<j.length&&!j[o].includes("DetermineComponentFrameRoot");)o++;if(s===_.length||o===j.length)for(s=_.length-1,o=j.length-1;1<=s&&0<=o&&_[s]!==j[o];)o--;for(;1<=s&&0<=o;s--,o--)if(_[s]!==j[o]){if(s!==1||o!==1)do if(s--,o--,0>o||_[s]!==j[o]){var U=`
6
+ `+_[s].replace(" at new "," at ");return e.displayName&&U.includes("<anonymous>")&&(U=U.replace("<anonymous>",e.displayName)),U}while(1<=s&&0<=o);break}}}finally{zr=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?In(a):""}function ec(e,t){switch(e.tag){case 26:case 27:case 5:return In(e.type);case 16:return In("Lazy");case 13:return e.child!==t&&t!==null?In("Suspense Fallback"):In("Suspense");case 19:return In("SuspenseList");case 0:case 15:return va(e.type,!1);case 11:return va(e.type.render,!1);case 1:return va(e.type,!0);case 31:return In("Activity");default:return""}}function he(e){try{var t="",a=null;do t+=ec(e,a),a=e,e=e.return;while(e);return t}catch(s){return`
7
+ Error generating stack: `+s.message+`
8
+ `+s.stack}}var Oi=Object.prototype.hasOwnProperty,Gn=i.unstable_scheduleCallback,Ri=i.unstable_cancelCallback,Br=i.unstable_shouldYield,ji=i.unstable_requestPaint,Ie=i.unstable_now,Hr=i.unstable_getCurrentPriorityLevel,Qa=i.unstable_ImmediatePriority,Cn=i.unstable_UserBlockingPriority,Ni=i.unstable_NormalPriority,qr=i.unstable_LowPriority,$r=i.unstable_IdlePriority,fl=i.log,Pr=i.unstable_setDisableYieldValue,ba=null,vt=null;function Ct(e){if(typeof fl=="function"&&Pr(e),vt&&typeof vt.setStrictMode=="function")try{vt.setStrictMode(ba,e)}catch{}}var Ot=Math.clz32?Math.clz32:pl,ml=Math.log,gl=Math.LN2;function pl(e){return e>>>=0,e===0?32:31-(ml(e)/gl|0)|0}var On=256,De=262144,Li=4194304;function bt(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 Vn(e,t,a){var s=e.pendingLanes;if(s===0)return 0;var o=0,u=e.suspendedLanes,f=e.pingedLanes;e=e.warmLanes;var v=s&134217727;return v!==0?(s=v&~u,s!==0?o=bt(s):(f&=v,f!==0?o=bt(f):a||(a=v&~e,a!==0&&(o=bt(a))))):(v=s&~u,v!==0?o=bt(v):f!==0?o=bt(f):a||(a=s&~e,a!==0&&(o=bt(a)))),o===0?0:t!==0&&t!==o&&(t&u)===0&&(u=o&-o,a=t&-t,u>=a||u===32&&(a&4194048)!==0)?t:o}function Sa(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ir(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 wa(){var e=Li;return Li<<=1,(Li&62914560)===0&&(Li=4194304),e}function Rn(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function se(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function an(e,t,a,s,o,u){var f=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var v=e.entanglements,_=e.expirationTimes,j=e.hiddenUpdates;for(a=f&~a;0<a;){var U=31-Ot(a),q=1<<U;v[U]=0,_[U]=-1;var N=j[U];if(N!==null)for(j[U]=null,U=0;U<N.length;U++){var L=N[U];L!==null&&(L.lane&=-536870913)}a&=~q}s!==0&&yl(e,s,0),u!==0&&o===0&&e.tag!==0&&(e.suspendedLanes|=u&~(f&~t))}function yl(e,t,a){e.pendingLanes|=t,e.suspendedLanes&=~t;var s=31-Ot(t);e.entangledLanes|=t,e.entanglements[s]=e.entanglements[s]|1073741824|a&261930}function Di(e,t){var a=e.entangledLanes|=t;for(e=e.entanglements;a;){var s=31-Ot(a),o=1<<s;o&t|e[s]&t&&(e[s]|=t),a&=~o}}function Gr(e,t){var a=t&-t;return a=(a&42)!==0?1:et(a),(a&(e.suspendedLanes|t))!==0?0:a}function et(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 jn(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Mi(){var e=V.p;return e!==0?e:(e=window.event,e===void 0?32:gg(e.type))}function Za(e,t){var a=V.p;try{return V.p=e,t()}finally{V.p=a}}var pn=Math.random().toString(36).slice(2),tt="__reactFiber$"+pn,Tt="__reactProps$"+pn,Yt="__reactContainer$"+pn,Vr="__reactEvents$"+pn,Kr="__reactListeners$"+pn,Yr="__reactHandles$"+pn,Nn="__reactResources$"+pn,_a="__reactMarker$"+pn;function Ui(e){delete e[tt],delete e[Tt],delete e[Vr],delete e[Kr],delete e[Yr]}function Kn(e){var t=e[tt];if(t)return t;for(var a=e.parentNode;a;){if(t=a[Yt]||a[tt]){if(a=t.alternate,t.child!==null||a!==null&&a.child!==null)for(e=Fm(e);e!==null;){if(a=e[tt])return a;e=Fm(e)}return t}e=a,a=e.parentNode}return null}function Yn(e){if(e=e[tt]||e[Yt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Jn(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(l(33))}function Xn(e){var t=e[Nn];return t||(t=e[Nn]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function dt(e){e[_a]=!0}var Fa=new Set,Wn={};function Ln(e,t){Qn(e,t),Qn(e+"Capture",t)}function Qn(e,t){for(Wn[e]=t,e=0;e<t.length;e++)Fa.add(t[e])}var ei=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]*$"),Jr={},Xr={};function ti(e){return Oi.call(Xr,e)?!0:Oi.call(Jr,e)?!1:ei.test(e)?Xr[e]=!0:(Jr[e]=!0,!1)}function ni(e,t,a){if(ti(t))if(a===null)e.removeAttribute(t);else{switch(typeof a){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,""+a)}}function zi(e,t,a){if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+a)}}function rn(e,t,a,s){if(s===null)e.removeAttribute(a);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(t,a,""+s)}}function zt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function vl(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function bl(e,t,a){var s=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var o=s.get,u=s.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(f){a=""+f,u.call(this,f)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return a},setValue:function(f){a=""+f},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function yn(e){if(!e._valueTracker){var t=vl(e)?"checked":"value";e._valueTracker=bl(e,t,""+e[t])}}function Wr(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),s="";return e&&(s=vl(e)?e.checked?"true":"false":e.value),e=s,e!==a?(t.setValue(e),!0):!1}function Bi(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 tc=/[\n"\\]/g;function Lt(e){return e.replace(tc,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Ta(e,t,a,s,o,u,f,v){e.name="",f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"?e.type=f:e.removeAttribute("type"),t!=null?f==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+zt(t)):e.value!==""+zt(t)&&(e.value=""+zt(t)):f!=="submit"&&f!=="reset"||e.removeAttribute("value"),t!=null?Qr(e,f,zt(t)):a!=null?Qr(e,f,zt(a)):s!=null&&e.removeAttribute("value"),o==null&&u!=null&&(e.defaultChecked=!!u),o!=null&&(e.checked=o&&typeof o!="function"&&typeof o!="symbol"),v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?e.name=""+zt(v):e.removeAttribute("name")}function Sl(e,t,a,s,o,u,f,v){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(e.type=u),t!=null||a!=null){if(!(u!=="submit"&&u!=="reset"||t!=null)){yn(e);return}a=a!=null?""+zt(a):"",t=t!=null?""+zt(t):a,v||t===e.value||(e.value=t),e.defaultValue=t}s=s??o,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=v?e.checked:!!s,e.defaultChecked=!!s,f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(e.name=f),yn(e)}function Qr(e,t,a){t==="number"&&Bi(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function nt(e,t,a,s){if(e=e.options,t){t={};for(var o=0;o<a.length;o++)t["$"+a[o]]=!0;for(a=0;a<e.length;a++)o=t.hasOwnProperty("$"+e[a].value),e[a].selected!==o&&(e[a].selected=o),o&&s&&(e[a].defaultSelected=!0)}else{for(a=""+zt(a),t=null,o=0;o<e.length;o++){if(e[o].value===a){e[o].selected=!0,s&&(e[o].defaultSelected=!0);return}t!==null||e[o].disabled||(t=e[o])}t!==null&&(t.selected=!0)}}function ai(e,t,a){if(t!=null&&(t=""+zt(t),t!==e.value&&(e.value=t),a==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=a!=null?""+zt(a):""}function Hi(e,t,a,s){if(t==null){if(s!=null){if(a!=null)throw Error(l(92));if(ze(s)){if(1<s.length)throw Error(l(93));s=s[0]}a=s}a==null&&(a=""),t=a}a=zt(t),e.defaultValue=a,s=e.textContent,s===a&&s!==""&&s!==null&&(e.value=s),yn(e)}function ka(e,t){if(t){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=t;return}}e.textContent=t}var Kd=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 wl(e,t,a){var s=t.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?s?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":s?e.setProperty(t,a):typeof a!="number"||a===0||Kd.has(t)?t==="float"?e.cssFloat=a:e[t]=(""+a).trim():e[t]=a+"px"}function _l(e,t,a){if(t!=null&&typeof t!="object")throw Error(l(62));if(e=e.style,a!=null){for(var s in a)!a.hasOwnProperty(s)||t!=null&&t.hasOwnProperty(s)||(s.indexOf("--")===0?e.setProperty(s,""):s==="float"?e.cssFloat="":e[s]="");for(var o in t)s=t[o],t.hasOwnProperty(o)&&a[o]!==s&&wl(e,o,s)}else for(var u in t)t.hasOwnProperty(u)&&wl(e,u,t[u])}function qi(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 $i=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"]]),ii=/^[\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 ri(e){return ii.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function vn(){}var Zr=null;function Fr(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ea=null,Dt=null;function Tl(e){var t=Yn(e);if(t&&(e=t.stateNode)){var a=e[Tt]||null;e:switch(e=t.stateNode,t.type){case"input":if(Ta(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),t=a.name,a.type==="radio"&&t!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Lt(""+t)+'"][type="radio"]'),t=0;t<a.length;t++){var s=a[t];if(s!==e&&s.form===e.form){var o=s[Tt]||null;if(!o)throw Error(l(90));Ta(s,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name)}}for(t=0;t<a.length;t++)s=a[t],s.form===e.form&&Wr(s)}break e;case"textarea":ai(e,a.value,a.defaultValue);break e;case"select":t=a.value,t!=null&&nt(e,!!a.multiple,t,!1)}}}var es=!1;function w(e,t,a){if(es)return e(t,a);es=!0;try{var s=e(t);return s}finally{if(es=!1,(Ea!==null||Dt!==null)&&(lo(),Ea&&(t=Ea,e=Dt,Dt=Ea=null,Tl(t),e)))for(t=0;t<e.length;t++)Tl(e[t])}}function P(e,t){var a=e.stateNode;if(a===null)return null;var s=a[Tt]||null;if(s===null)return null;a=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(a&&typeof a!="function")throw Error(l(231,t,typeof a));return a}var Q=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),X=!1;if(Q)try{var ue={};Object.defineProperty(ue,"passive",{get:function(){X=!0}}),window.addEventListener("test",ue,ue),window.removeEventListener("test",ue,ue)}catch{X=!1}var ae=null,fe=null,Ve=null;function Le(){if(Ve)return Ve;var e,t=fe,a=t.length,s,o="value"in ae?ae.value:ae.textContent,u=o.length;for(e=0;e<a&&t[e]===o[e];e++);var f=a-e;for(s=1;s<=f&&t[a-s]===o[u-s];s++);return Ve=o.slice(e,1<s?1-s:void 0)}function at(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 Pi(){return!0}function kl(){return!1}function St(e){function t(a,s,o,u,f){this._reactName=a,this._targetInst=o,this.type=s,this.nativeEvent=u,this.target=f,this.currentTarget=null;for(var v in e)e.hasOwnProperty(v)&&(a=e[v],this[v]=a?a(u):u[v]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?Pi:kl,this.isPropagationStopped=kl,this}return b(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Pi)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Pi)},persist:function(){},isPersistent:Pi}),t}var Dn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Aa=St(Dn),ts=b({},Dn,{view:0,detail:0}),ry=St(ts),nc,ac,ns,El=b({},ts,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:rc,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!==ns&&(ns&&e.type==="mousemove"?(nc=e.screenX-ns.screenX,ac=e.screenY-ns.screenY):ac=nc=0,ns=e),nc)},movementY:function(e){return"movementY"in e?e.movementY:ac}}),Yd=St(El),sy=b({},El,{dataTransfer:0}),ly=St(sy),oy=b({},ts,{relatedTarget:0}),ic=St(oy),cy=b({},Dn,{animationName:0,elapsedTime:0,pseudoElement:0}),uy=St(cy),dy=b({},Dn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),hy=St(dy),fy=b({},Dn,{data:0}),Jd=St(fy),my={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},gy={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"},py={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function yy(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=py[e])?!!t[e]:!1}function rc(){return yy}var vy=b({},ts,{key:function(e){if(e.key){var t=my[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=at(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?gy[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:rc,charCode:function(e){return e.type==="keypress"?at(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?at(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),by=St(vy),Sy=b({},El,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Xd=St(Sy),wy=b({},ts,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:rc}),_y=St(wy),Ty=b({},Dn,{propertyName:0,elapsedTime:0,pseudoElement:0}),ky=St(Ty),Ey=b({},El,{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}),Ay=St(Ey),xy=b({},Dn,{newState:0,oldState:0}),Cy=St(xy),Oy=[9,13,27,32],sc=Q&&"CompositionEvent"in window,as=null;Q&&"documentMode"in document&&(as=document.documentMode);var Ry=Q&&"TextEvent"in window&&!as,Wd=Q&&(!sc||as&&8<as&&11>=as),Qd=" ",Zd=!1;function Fd(e,t){switch(e){case"keyup":return Oy.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function eh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ii=!1;function jy(e,t){switch(e){case"compositionend":return eh(t);case"keypress":return t.which!==32?null:(Zd=!0,Qd);case"textInput":return e=t.data,e===Qd&&Zd?null:e;default:return null}}function Ny(e,t){if(Ii)return e==="compositionend"||!sc&&Fd(e,t)?(e=Le(),Ve=fe=ae=null,Ii=!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 Wd&&t.locale!=="ko"?null:t.data;default:return null}}var Ly={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 th(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Ly[e.type]:t==="textarea"}function nh(e,t,a,s){Ea?Dt?Dt.push(s):Dt=[s]:Ea=s,t=go(t,"onChange"),0<t.length&&(a=new Aa("onChange","change",null,a,s),e.push({event:a,listeners:t}))}var is=null,rs=null;function Dy(e){Hm(e,0)}function Al(e){var t=Jn(e);if(Wr(t))return e}function ah(e,t){if(e==="change")return t}var ih=!1;if(Q){var lc;if(Q){var oc="oninput"in document;if(!oc){var rh=document.createElement("div");rh.setAttribute("oninput","return;"),oc=typeof rh.oninput=="function"}lc=oc}else lc=!1;ih=lc&&(!document.documentMode||9<document.documentMode)}function sh(){is&&(is.detachEvent("onpropertychange",lh),rs=is=null)}function lh(e){if(e.propertyName==="value"&&Al(rs)){var t=[];nh(t,rs,e,Fr(e)),w(Dy,t)}}function My(e,t,a){e==="focusin"?(sh(),is=t,rs=a,is.attachEvent("onpropertychange",lh)):e==="focusout"&&sh()}function Uy(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Al(rs)}function zy(e,t){if(e==="click")return Al(t)}function By(e,t){if(e==="input"||e==="change")return Al(t)}function Hy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Jt=typeof Object.is=="function"?Object.is:Hy;function ss(e,t){if(Jt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var a=Object.keys(e),s=Object.keys(t);if(a.length!==s.length)return!1;for(s=0;s<a.length;s++){var o=a[s];if(!Oi.call(t,o)||!Jt(e[o],t[o]))return!1}return!0}function oh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function ch(e,t){var a=oh(e);e=0;for(var s;a;){if(a.nodeType===3){if(s=e+a.textContent.length,e<=t&&s>=t)return{node:a,offset:t-e};e=s}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=oh(a)}}function uh(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?uh(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function dh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Bi(e.document);t instanceof e.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)e=t.contentWindow;else break;t=Bi(e.document)}return t}function cc(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 qy=Q&&"documentMode"in document&&11>=document.documentMode,Gi=null,uc=null,ls=null,dc=!1;function hh(e,t,a){var s=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;dc||Gi==null||Gi!==Bi(s)||(s=Gi,"selectionStart"in s&&cc(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}),ls&&ss(ls,s)||(ls=s,s=go(uc,"onSelect"),0<s.length&&(t=new Aa("onSelect","select",null,t,a),e.push({event:t,listeners:s}),t.target=Gi)))}function si(e,t){var a={};return a[e.toLowerCase()]=t.toLowerCase(),a["Webkit"+e]="webkit"+t,a["Moz"+e]="moz"+t,a}var Vi={animationend:si("Animation","AnimationEnd"),animationiteration:si("Animation","AnimationIteration"),animationstart:si("Animation","AnimationStart"),transitionrun:si("Transition","TransitionRun"),transitionstart:si("Transition","TransitionStart"),transitioncancel:si("Transition","TransitionCancel"),transitionend:si("Transition","TransitionEnd")},hc={},fh={};Q&&(fh=document.createElement("div").style,"AnimationEvent"in window||(delete Vi.animationend.animation,delete Vi.animationiteration.animation,delete Vi.animationstart.animation),"TransitionEvent"in window||delete Vi.transitionend.transition);function li(e){if(hc[e])return hc[e];if(!Vi[e])return e;var t=Vi[e],a;for(a in t)if(t.hasOwnProperty(a)&&a in fh)return hc[e]=t[a];return e}var mh=li("animationend"),gh=li("animationiteration"),ph=li("animationstart"),$y=li("transitionrun"),Py=li("transitionstart"),Iy=li("transitioncancel"),yh=li("transitionend"),vh=new Map,fc="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(" ");fc.push("scrollEnd");function bn(e,t){vh.set(e,t),Ln(t,[e])}var xl=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)},sn=[],Ki=0,mc=0;function Cl(){for(var e=Ki,t=mc=Ki=0;t<e;){var a=sn[t];sn[t++]=null;var s=sn[t];sn[t++]=null;var o=sn[t];sn[t++]=null;var u=sn[t];if(sn[t++]=null,s!==null&&o!==null){var f=s.pending;f===null?o.next=o:(o.next=f.next,f.next=o),s.pending=o}u!==0&&bh(a,o,u)}}function Ol(e,t,a,s){sn[Ki++]=e,sn[Ki++]=t,sn[Ki++]=a,sn[Ki++]=s,mc|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function gc(e,t,a,s){return Ol(e,t,a,s),Rl(e)}function oi(e,t){return Ol(e,null,null,t),Rl(e)}function bh(e,t,a){e.lanes|=a;var s=e.alternate;s!==null&&(s.lanes|=a);for(var o=!1,u=e.return;u!==null;)u.childLanes|=a,s=u.alternate,s!==null&&(s.childLanes|=a),u.tag===22&&(e=u.stateNode,e===null||e._visibility&1||(o=!0)),e=u,u=u.return;return e.tag===3?(u=e.stateNode,o&&t!==null&&(o=31-Ot(a),e=u.hiddenUpdates,s=e[o],s===null?e[o]=[t]:s.push(t),t.lane=a|536870912),u):null}function Rl(e){if(50<Os)throw Os=0,ku=null,Error(l(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Yi={};function Gy(e,t,a,s){this.tag=e,this.key=a,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 Xt(e,t,a,s){return new Gy(e,t,a,s)}function pc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Zn(e,t){var a=e.alternate;return a===null?(a=Xt(e.tag,t,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=t,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,t=e.dependencies,a.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function Sh(e,t){e.flags&=65011714;var a=e.alternate;return a===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=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,t=a.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function jl(e,t,a,s,o,u){var f=0;if(s=e,typeof e=="function")pc(e)&&(f=1);else if(typeof e=="string")f=Xv(e,a,Z.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Se:return e=Xt(31,a,t,o),e.elementType=Se,e.lanes=u,e;case z:return ci(a.children,o,u,t);case G:f=8,o|=24;break;case I:return e=Xt(12,a,t,o|2),e.elementType=I,e.lanes=u,e;case me:return e=Xt(13,a,t,o),e.elementType=me,e.lanes=u,e;case ie:return e=Xt(19,a,t,o),e.elementType=ie,e.lanes=u,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case O:f=10;break e;case $:f=9;break e;case Y:f=11;break e;case K:f=14;break e;case Ee:f=16,s=null;break e}f=29,a=Error(l(130,e===null?"null":typeof e,"")),s=null}return t=Xt(f,a,t,o),t.elementType=e,t.type=s,t.lanes=u,t}function ci(e,t,a,s){return e=Xt(7,e,s,t),e.lanes=a,e}function yc(e,t,a){return e=Xt(6,e,null,t),e.lanes=a,e}function wh(e){var t=Xt(18,null,null,0);return t.stateNode=e,t}function vc(e,t,a){return t=Xt(4,e.children!==null?e.children:[],e.key,t),t.lanes=a,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var _h=new WeakMap;function ln(e,t){if(typeof e=="object"&&e!==null){var a=_h.get(e);return a!==void 0?a:(t={value:e,source:t,stack:he(t)},_h.set(e,t),t)}return{value:e,source:t,stack:he(t)}}var Ji=[],Xi=0,Nl=null,os=0,on=[],cn=0,xa=null,Mn=1,Un="";function Fn(e,t){Ji[Xi++]=os,Ji[Xi++]=Nl,Nl=e,os=t}function Th(e,t,a){on[cn++]=Mn,on[cn++]=Un,on[cn++]=xa,xa=e;var s=Mn;e=Un;var o=32-Ot(s)-1;s&=~(1<<o),a+=1;var u=32-Ot(t)+o;if(30<u){var f=o-o%5;u=(s&(1<<f)-1).toString(32),s>>=f,o-=f,Mn=1<<32-Ot(t)+o|a<<o|s,Un=u+e}else Mn=1<<u|a<<o|s,Un=e}function bc(e){e.return!==null&&(Fn(e,1),Th(e,1,0))}function Sc(e){for(;e===Nl;)Nl=Ji[--Xi],Ji[Xi]=null,os=Ji[--Xi],Ji[Xi]=null;for(;e===xa;)xa=on[--cn],on[cn]=null,Un=on[--cn],on[cn]=null,Mn=on[--cn],on[cn]=null}function kh(e,t){on[cn++]=Mn,on[cn++]=Un,on[cn++]=xa,Mn=t.id,Un=t.overflow,xa=e}var kt=null,Ke=null,Ae=!1,Ca=null,un=!1,wc=Error(l(519));function Oa(e){var t=Error(l(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw cs(ln(t,e)),wc}function Eh(e){var t=e.stateNode,a=e.type,s=e.memoizedProps;switch(t[tt]=e,t[Tt]=s,a){case"dialog":_e("cancel",t),_e("close",t);break;case"iframe":case"object":case"embed":_e("load",t);break;case"video":case"audio":for(a=0;a<js.length;a++)_e(js[a],t);break;case"source":_e("error",t);break;case"img":case"image":case"link":_e("error",t),_e("load",t);break;case"details":_e("toggle",t);break;case"input":_e("invalid",t),Sl(t,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":_e("invalid",t);break;case"textarea":_e("invalid",t),Hi(t,s.value,s.defaultValue,s.children)}a=s.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||t.textContent===""+a||s.suppressHydrationWarning===!0||Im(t.textContent,a)?(s.popover!=null&&(_e("beforetoggle",t),_e("toggle",t)),s.onScroll!=null&&_e("scroll",t),s.onScrollEnd!=null&&_e("scrollend",t),s.onClick!=null&&(t.onclick=vn),t=!0):t=!1,t||Oa(e,!0)}function Ah(e){for(kt=e.return;kt;)switch(kt.tag){case 5:case 31:case 13:un=!1;return;case 27:case 3:un=!0;return;default:kt=kt.return}}function Wi(e){if(e!==kt)return!1;if(!Ae)return Ah(e),Ae=!0,!1;var t=e.tag,a;if((a=t!==3&&t!==27)&&((a=t===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||Hu(e.type,e.memoizedProps)),a=!a),a&&Ke&&Oa(e),Ah(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Ke=Zm(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Ke=Zm(e)}else t===27?(t=Ke,Ia(e.type)?(e=Gu,Gu=null,Ke=e):Ke=t):Ke=kt?hn(e.stateNode.nextSibling):null;return!0}function ui(){Ke=kt=null,Ae=!1}function _c(){var e=Ca;return e!==null&&($t===null?$t=e:$t.push.apply($t,e),Ca=null),e}function cs(e){Ca===null?Ca=[e]:Ca.push(e)}var Tc=E(null),di=null,ea=null;function Ra(e,t,a){J(Tc,t._currentValue),t._currentValue=a}function ta(e){e._currentValue=Tc.current,M(Tc)}function kc(e,t,a){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===a)break;e=e.return}}function Ec(e,t,a,s){var o=e.child;for(o!==null&&(o.return=e);o!==null;){var u=o.dependencies;if(u!==null){var f=o.child;u=u.firstContext;e:for(;u!==null;){var v=u;u=o;for(var _=0;_<t.length;_++)if(v.context===t[_]){u.lanes|=a,v=u.alternate,v!==null&&(v.lanes|=a),kc(u.return,a,e),s||(f=null);break e}u=v.next}}else if(o.tag===18){if(f=o.return,f===null)throw Error(l(341));f.lanes|=a,u=f.alternate,u!==null&&(u.lanes|=a),kc(f,a,e),f=null}else f=o.child;if(f!==null)f.return=o;else for(f=o;f!==null;){if(f===e){f=null;break}if(o=f.sibling,o!==null){o.return=f.return,f=o;break}f=f.return}o=f}}function Qi(e,t,a,s){e=null;for(var o=t,u=!1;o!==null;){if(!u){if((o.flags&524288)!==0)u=!0;else if((o.flags&262144)!==0)break}if(o.tag===10){var f=o.alternate;if(f===null)throw Error(l(387));if(f=f.memoizedProps,f!==null){var v=o.type;Jt(o.pendingProps.value,f.value)||(e!==null?e.push(v):e=[v])}}else if(o===Oe.current){if(f=o.alternate,f===null)throw Error(l(387));f.memoizedState.memoizedState!==o.memoizedState.memoizedState&&(e!==null?e.push(Us):e=[Us])}o=o.return}e!==null&&Ec(t,e,a,s),t.flags|=262144}function Ll(e){for(e=e.firstContext;e!==null;){if(!Jt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function hi(e){di=e,ea=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Et(e){return xh(di,e)}function Dl(e,t){return di===null&&hi(e),xh(e,t)}function xh(e,t){var a=t._currentValue;if(t={context:t,memoizedValue:a,next:null},ea===null){if(e===null)throw Error(l(308));ea=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ea=ea.next=t;return a}var Vy=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(a,s){e.push(s)}};this.abort=function(){t.aborted=!0,e.forEach(function(a){return a()})}},Ky=i.unstable_scheduleCallback,Yy=i.unstable_NormalPriority,ht={$$typeof:O,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ac(){return{controller:new Vy,data:new Map,refCount:0}}function us(e){e.refCount--,e.refCount===0&&Ky(Yy,function(){e.controller.abort()})}var ds=null,xc=0,Zi=0,Fi=null;function Jy(e,t){if(ds===null){var a=ds=[];xc=0,Zi=Ru(),Fi={status:"pending",value:void 0,then:function(s){a.push(s)}}}return xc++,t.then(Ch,Ch),t}function Ch(){if(--xc===0&&ds!==null){Fi!==null&&(Fi.status="fulfilled");var e=ds;ds=null,Zi=0,Fi=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Xy(e,t){var a=[],s={status:"pending",value:null,reason:null,then:function(o){a.push(o)}};return e.then(function(){s.status="fulfilled",s.value=t;for(var o=0;o<a.length;o++)(0,a[o])(t)},function(o){for(s.status="rejected",s.reason=o,o=0;o<a.length;o++)(0,a[o])(void 0)}),s}var Oh=D.S;D.S=function(e,t){fm=Ie(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&Jy(e,t),Oh!==null&&Oh(e,t)};var fi=E(null);function Cc(){var e=fi.current;return e!==null?e:Pe.pooledCache}function Ml(e,t){t===null?J(fi,fi.current):J(fi,t.pool)}function Rh(){var e=Cc();return e===null?null:{parent:ht._currentValue,pool:e}}var er=Error(l(460)),Oc=Error(l(474)),Ul=Error(l(542)),zl={then:function(){}};function jh(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Nh(e,t,a){switch(a=e[a],a===void 0?e.push(t):a!==t&&(t.then(vn,vn),t=a),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Dh(e),e;default:if(typeof t.status=="string")t.then(vn,vn);else{if(e=Pe,e!==null&&100<e.shellSuspendCounter)throw Error(l(482));e=t,e.status="pending",e.then(function(s){if(t.status==="pending"){var o=t;o.status="fulfilled",o.value=s}},function(s){if(t.status==="pending"){var o=t;o.status="rejected",o.reason=s}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Dh(e),e}throw gi=t,er}}function mi(e){try{var t=e._init;return t(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(gi=a,er):a}}var gi=null;function Lh(){if(gi===null)throw Error(l(459));var e=gi;return gi=null,e}function Dh(e){if(e===er||e===Ul)throw Error(l(483))}var tr=null,hs=0;function Bl(e){var t=hs;return hs+=1,tr===null&&(tr=[]),Nh(tr,e,t)}function fs(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Hl(e,t){throw t.$$typeof===T?Error(l(525)):(e=Object.prototype.toString.call(t),Error(l(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Mh(e){function t(x,k){if(e){var R=x.deletions;R===null?(x.deletions=[k],x.flags|=16):R.push(k)}}function a(x,k){if(!e)return null;for(;k!==null;)t(x,k),k=k.sibling;return null}function s(x){for(var k=new Map;x!==null;)x.key!==null?k.set(x.key,x):k.set(x.index,x),x=x.sibling;return k}function o(x,k){return x=Zn(x,k),x.index=0,x.sibling=null,x}function u(x,k,R){return x.index=R,e?(R=x.alternate,R!==null?(R=R.index,R<k?(x.flags|=67108866,k):R):(x.flags|=67108866,k)):(x.flags|=1048576,k)}function f(x){return e&&x.alternate===null&&(x.flags|=67108866),x}function v(x,k,R,B){return k===null||k.tag!==6?(k=yc(R,x.mode,B),k.return=x,k):(k=o(k,R),k.return=x,k)}function _(x,k,R,B){var oe=R.type;return oe===z?U(x,k,R.props.children,B,R.key):k!==null&&(k.elementType===oe||typeof oe=="object"&&oe!==null&&oe.$$typeof===Ee&&mi(oe)===k.type)?(k=o(k,R.props),fs(k,R),k.return=x,k):(k=jl(R.type,R.key,R.props,null,x.mode,B),fs(k,R),k.return=x,k)}function j(x,k,R,B){return k===null||k.tag!==4||k.stateNode.containerInfo!==R.containerInfo||k.stateNode.implementation!==R.implementation?(k=vc(R,x.mode,B),k.return=x,k):(k=o(k,R.children||[]),k.return=x,k)}function U(x,k,R,B,oe){return k===null||k.tag!==7?(k=ci(R,x.mode,B,oe),k.return=x,k):(k=o(k,R),k.return=x,k)}function q(x,k,R){if(typeof k=="string"&&k!==""||typeof k=="number"||typeof k=="bigint")return k=yc(""+k,x.mode,R),k.return=x,k;if(typeof k=="object"&&k!==null){switch(k.$$typeof){case A:return R=jl(k.type,k.key,k.props,null,x.mode,R),fs(R,k),R.return=x,R;case C:return k=vc(k,x.mode,R),k.return=x,k;case Ee:return k=mi(k),q(x,k,R)}if(ze(k)||Ce(k))return k=ci(k,x.mode,R,null),k.return=x,k;if(typeof k.then=="function")return q(x,Bl(k),R);if(k.$$typeof===O)return q(x,Dl(x,k),R);Hl(x,k)}return null}function N(x,k,R,B){var oe=k!==null?k.key:null;if(typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint")return oe!==null?null:v(x,k,""+R,B);if(typeof R=="object"&&R!==null){switch(R.$$typeof){case A:return R.key===oe?_(x,k,R,B):null;case C:return R.key===oe?j(x,k,R,B):null;case Ee:return R=mi(R),N(x,k,R,B)}if(ze(R)||Ce(R))return oe!==null?null:U(x,k,R,B,null);if(typeof R.then=="function")return N(x,k,Bl(R),B);if(R.$$typeof===O)return N(x,k,Dl(x,R),B);Hl(x,R)}return null}function L(x,k,R,B,oe){if(typeof B=="string"&&B!==""||typeof B=="number"||typeof B=="bigint")return x=x.get(R)||null,v(k,x,""+B,oe);if(typeof B=="object"&&B!==null){switch(B.$$typeof){case A:return x=x.get(B.key===null?R:B.key)||null,_(k,x,B,oe);case C:return x=x.get(B.key===null?R:B.key)||null,j(k,x,B,oe);case Ee:return B=mi(B),L(x,k,R,B,oe)}if(ze(B)||Ce(B))return x=x.get(R)||null,U(k,x,B,oe,null);if(typeof B.then=="function")return L(x,k,R,Bl(B),oe);if(B.$$typeof===O)return L(x,k,R,Dl(k,B),oe);Hl(k,B)}return null}function F(x,k,R,B){for(var oe=null,Re=null,re=k,be=k=0,ke=null;re!==null&&be<R.length;be++){re.index>be?(ke=re,re=null):ke=re.sibling;var je=N(x,re,R[be],B);if(je===null){re===null&&(re=ke);break}e&&re&&je.alternate===null&&t(x,re),k=u(je,k,be),Re===null?oe=je:Re.sibling=je,Re=je,re=ke}if(be===R.length)return a(x,re),Ae&&Fn(x,be),oe;if(re===null){for(;be<R.length;be++)re=q(x,R[be],B),re!==null&&(k=u(re,k,be),Re===null?oe=re:Re.sibling=re,Re=re);return Ae&&Fn(x,be),oe}for(re=s(re);be<R.length;be++)ke=L(re,x,be,R[be],B),ke!==null&&(e&&ke.alternate!==null&&re.delete(ke.key===null?be:ke.key),k=u(ke,k,be),Re===null?oe=ke:Re.sibling=ke,Re=ke);return e&&re.forEach(function(Ja){return t(x,Ja)}),Ae&&Fn(x,be),oe}function de(x,k,R,B){if(R==null)throw Error(l(151));for(var oe=null,Re=null,re=k,be=k=0,ke=null,je=R.next();re!==null&&!je.done;be++,je=R.next()){re.index>be?(ke=re,re=null):ke=re.sibling;var Ja=N(x,re,je.value,B);if(Ja===null){re===null&&(re=ke);break}e&&re&&Ja.alternate===null&&t(x,re),k=u(Ja,k,be),Re===null?oe=Ja:Re.sibling=Ja,Re=Ja,re=ke}if(je.done)return a(x,re),Ae&&Fn(x,be),oe;if(re===null){for(;!je.done;be++,je=R.next())je=q(x,je.value,B),je!==null&&(k=u(je,k,be),Re===null?oe=je:Re.sibling=je,Re=je);return Ae&&Fn(x,be),oe}for(re=s(re);!je.done;be++,je=R.next())je=L(re,x,be,je.value,B),je!==null&&(e&&je.alternate!==null&&re.delete(je.key===null?be:je.key),k=u(je,k,be),Re===null?oe=je:Re.sibling=je,Re=je);return e&&re.forEach(function(s0){return t(x,s0)}),Ae&&Fn(x,be),oe}function qe(x,k,R,B){if(typeof R=="object"&&R!==null&&R.type===z&&R.key===null&&(R=R.props.children),typeof R=="object"&&R!==null){switch(R.$$typeof){case A:e:{for(var oe=R.key;k!==null;){if(k.key===oe){if(oe=R.type,oe===z){if(k.tag===7){a(x,k.sibling),B=o(k,R.props.children),B.return=x,x=B;break e}}else if(k.elementType===oe||typeof oe=="object"&&oe!==null&&oe.$$typeof===Ee&&mi(oe)===k.type){a(x,k.sibling),B=o(k,R.props),fs(B,R),B.return=x,x=B;break e}a(x,k);break}else t(x,k);k=k.sibling}R.type===z?(B=ci(R.props.children,x.mode,B,R.key),B.return=x,x=B):(B=jl(R.type,R.key,R.props,null,x.mode,B),fs(B,R),B.return=x,x=B)}return f(x);case C:e:{for(oe=R.key;k!==null;){if(k.key===oe)if(k.tag===4&&k.stateNode.containerInfo===R.containerInfo&&k.stateNode.implementation===R.implementation){a(x,k.sibling),B=o(k,R.children||[]),B.return=x,x=B;break e}else{a(x,k);break}else t(x,k);k=k.sibling}B=vc(R,x.mode,B),B.return=x,x=B}return f(x);case Ee:return R=mi(R),qe(x,k,R,B)}if(ze(R))return F(x,k,R,B);if(Ce(R)){if(oe=Ce(R),typeof oe!="function")throw Error(l(150));return R=oe.call(R),de(x,k,R,B)}if(typeof R.then=="function")return qe(x,k,Bl(R),B);if(R.$$typeof===O)return qe(x,k,Dl(x,R),B);Hl(x,R)}return typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint"?(R=""+R,k!==null&&k.tag===6?(a(x,k.sibling),B=o(k,R),B.return=x,x=B):(a(x,k),B=yc(R,x.mode,B),B.return=x,x=B),f(x)):a(x,k)}return function(x,k,R,B){try{hs=0;var oe=qe(x,k,R,B);return tr=null,oe}catch(re){if(re===er||re===Ul)throw re;var Re=Xt(29,re,null,x.mode);return Re.lanes=B,Re.return=x,Re}}}var pi=Mh(!0),Uh=Mh(!1),ja=!1;function Rc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function jc(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 Na(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function La(e,t,a){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(Ne&2)!==0){var o=s.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),s.pending=t,t=Rl(e),bh(e,null,a),t}return Ol(e,s,t,a),Rl(e)}function ms(e,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var s=t.lanes;s&=e.pendingLanes,a|=s,t.lanes=a,Di(e,a)}}function Nc(e,t){var a=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,a===s)){var o=null,u=null;if(a=a.firstBaseUpdate,a!==null){do{var f={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};u===null?o=u=f:u=u.next=f,a=a.next}while(a!==null);u===null?o=u=t:u=u.next=t}else o=u=t;a={baseState:s.baseState,firstBaseUpdate:o,lastBaseUpdate:u,shared:s.shared,callbacks:s.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var Lc=!1;function gs(){if(Lc){var e=Fi;if(e!==null)throw e}}function ps(e,t,a,s){Lc=!1;var o=e.updateQueue;ja=!1;var u=o.firstBaseUpdate,f=o.lastBaseUpdate,v=o.shared.pending;if(v!==null){o.shared.pending=null;var _=v,j=_.next;_.next=null,f===null?u=j:f.next=j,f=_;var U=e.alternate;U!==null&&(U=U.updateQueue,v=U.lastBaseUpdate,v!==f&&(v===null?U.firstBaseUpdate=j:v.next=j,U.lastBaseUpdate=_))}if(u!==null){var q=o.baseState;f=0,U=j=_=null,v=u;do{var N=v.lane&-536870913,L=N!==v.lane;if(L?(Te&N)===N:(s&N)===N){N!==0&&N===Zi&&(Lc=!0),U!==null&&(U=U.next={lane:0,tag:v.tag,payload:v.payload,callback:null,next:null});e:{var F=e,de=v;N=t;var qe=a;switch(de.tag){case 1:if(F=de.payload,typeof F=="function"){q=F.call(qe,q,N);break e}q=F;break e;case 3:F.flags=F.flags&-65537|128;case 0:if(F=de.payload,N=typeof F=="function"?F.call(qe,q,N):F,N==null)break e;q=b({},q,N);break e;case 2:ja=!0}}N=v.callback,N!==null&&(e.flags|=64,L&&(e.flags|=8192),L=o.callbacks,L===null?o.callbacks=[N]:L.push(N))}else L={lane:N,tag:v.tag,payload:v.payload,callback:v.callback,next:null},U===null?(j=U=L,_=q):U=U.next=L,f|=N;if(v=v.next,v===null){if(v=o.shared.pending,v===null)break;L=v,v=L.next,L.next=null,o.lastBaseUpdate=L,o.shared.pending=null}}while(!0);U===null&&(_=q),o.baseState=_,o.firstBaseUpdate=j,o.lastBaseUpdate=U,u===null&&(o.shared.lanes=0),Ba|=f,e.lanes=f,e.memoizedState=q}}function zh(e,t){if(typeof e!="function")throw Error(l(191,e));e.call(t)}function Bh(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)zh(a[e],t)}var nr=E(null),ql=E(0);function Hh(e,t){e=ua,J(ql,e),J(nr,t),ua=e|t.baseLanes}function Dc(){J(ql,ua),J(nr,nr.current)}function Mc(){ua=ql.current,M(nr),M(ql)}var Wt=E(null),dn=null;function Da(e){var t=e.alternate;J(lt,lt.current&1),J(Wt,e),dn===null&&(t===null||nr.current!==null||t.memoizedState!==null)&&(dn=e)}function Uc(e){J(lt,lt.current),J(Wt,e),dn===null&&(dn=e)}function qh(e){e.tag===22?(J(lt,lt.current),J(Wt,e),dn===null&&(dn=e)):Ma()}function Ma(){J(lt,lt.current),J(Wt,Wt.current)}function Qt(e){M(Wt),dn===e&&(dn=null),M(lt)}var lt=E(0);function $l(e){for(var t=e;t!==null;){if(t.tag===13){var a=t.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Pu(a)||Iu(a)))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 na=0,ve=null,Be=null,ft=null,Pl=!1,ar=!1,yi=!1,Il=0,ys=0,ir=null,Wy=0;function it(){throw Error(l(321))}function zc(e,t){if(t===null)return!1;for(var a=0;a<t.length&&a<e.length;a++)if(!Jt(e[a],t[a]))return!1;return!0}function Bc(e,t,a,s,o,u){return na=u,ve=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,D.H=e===null||e.memoizedState===null?kf:Fc,yi=!1,u=a(s,o),yi=!1,ar&&(u=Ph(t,a,s,o)),$h(e),u}function $h(e){D.H=Ss;var t=Be!==null&&Be.next!==null;if(na=0,ft=Be=ve=null,Pl=!1,ys=0,ir=null,t)throw Error(l(300));e===null||mt||(e=e.dependencies,e!==null&&Ll(e)&&(mt=!0))}function Ph(e,t,a,s){ve=e;var o=0;do{if(ar&&(ir=null),ys=0,ar=!1,25<=o)throw Error(l(301));if(o+=1,ft=Be=null,e.updateQueue!=null){var u=e.updateQueue;u.lastEffect=null,u.events=null,u.stores=null,u.memoCache!=null&&(u.memoCache.index=0)}D.H=Ef,u=t(a,s)}while(ar);return u}function Qy(){var e=D.H,t=e.useState()[0];return t=typeof t.then=="function"?vs(t):t,e=e.useState()[0],(Be!==null?Be.memoizedState:null)!==e&&(ve.flags|=1024),t}function Hc(){var e=Il!==0;return Il=0,e}function qc(e,t,a){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a}function $c(e){if(Pl){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Pl=!1}na=0,ft=Be=ve=null,ar=!1,ys=Il=0,ir=null}function Mt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ft===null?ve.memoizedState=ft=e:ft=ft.next=e,ft}function ot(){if(Be===null){var e=ve.alternate;e=e!==null?e.memoizedState:null}else e=Be.next;var t=ft===null?ve.memoizedState:ft.next;if(t!==null)ft=t,Be=e;else{if(e===null)throw ve.alternate===null?Error(l(467)):Error(l(310));Be=e,e={memoizedState:Be.memoizedState,baseState:Be.baseState,baseQueue:Be.baseQueue,queue:Be.queue,next:null},ft===null?ve.memoizedState=ft=e:ft=ft.next=e}return ft}function Gl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function vs(e){var t=ys;return ys+=1,ir===null&&(ir=[]),e=Nh(ir,e,t),t=ve,(ft===null?t.memoizedState:ft.next)===null&&(t=t.alternate,D.H=t===null||t.memoizedState===null?kf:Fc),e}function Vl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return vs(e);if(e.$$typeof===O)return Et(e)}throw Error(l(438,String(e)))}function Pc(e){var t=null,a=ve.updateQueue;if(a!==null&&(t=a.memoCache),t==null){var s=ve.alternate;s!==null&&(s=s.updateQueue,s!==null&&(s=s.memoCache,s!=null&&(t={data:s.data.map(function(o){return o.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),a===null&&(a=Gl(),ve.updateQueue=a),a.memoCache=t,a=t.data[t.index],a===void 0)for(a=t.data[t.index]=Array(e),s=0;s<e;s++)a[s]=Kt;return t.index++,a}function aa(e,t){return typeof t=="function"?t(e):t}function Kl(e){var t=ot();return Ic(t,Be,e)}function Ic(e,t,a){var s=e.queue;if(s===null)throw Error(l(311));s.lastRenderedReducer=a;var o=e.baseQueue,u=s.pending;if(u!==null){if(o!==null){var f=o.next;o.next=u.next,u.next=f}t.baseQueue=o=u,s.pending=null}if(u=e.baseState,o===null)e.memoizedState=u;else{t=o.next;var v=f=null,_=null,j=t,U=!1;do{var q=j.lane&-536870913;if(q!==j.lane?(Te&q)===q:(na&q)===q){var N=j.revertLane;if(N===0)_!==null&&(_=_.next={lane:0,revertLane:0,gesture:null,action:j.action,hasEagerState:j.hasEagerState,eagerState:j.eagerState,next:null}),q===Zi&&(U=!0);else if((na&N)===N){j=j.next,N===Zi&&(U=!0);continue}else q={lane:0,revertLane:j.revertLane,gesture:null,action:j.action,hasEagerState:j.hasEagerState,eagerState:j.eagerState,next:null},_===null?(v=_=q,f=u):_=_.next=q,ve.lanes|=N,Ba|=N;q=j.action,yi&&a(u,q),u=j.hasEagerState?j.eagerState:a(u,q)}else N={lane:q,revertLane:j.revertLane,gesture:j.gesture,action:j.action,hasEagerState:j.hasEagerState,eagerState:j.eagerState,next:null},_===null?(v=_=N,f=u):_=_.next=N,ve.lanes|=q,Ba|=q;j=j.next}while(j!==null&&j!==t);if(_===null?f=u:_.next=v,!Jt(u,e.memoizedState)&&(mt=!0,U&&(a=Fi,a!==null)))throw a;e.memoizedState=u,e.baseState=f,e.baseQueue=_,s.lastRenderedState=u}return o===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function Gc(e){var t=ot(),a=t.queue;if(a===null)throw Error(l(311));a.lastRenderedReducer=e;var s=a.dispatch,o=a.pending,u=t.memoizedState;if(o!==null){a.pending=null;var f=o=o.next;do u=e(u,f.action),f=f.next;while(f!==o);Jt(u,t.memoizedState)||(mt=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),a.lastRenderedState=u}return[u,s]}function Ih(e,t,a){var s=ve,o=ot(),u=Ae;if(u){if(a===void 0)throw Error(l(407));a=a()}else a=t();var f=!Jt((Be||o).memoizedState,a);if(f&&(o.memoizedState=a,mt=!0),o=o.queue,Yc(Kh.bind(null,s,o,e),[e]),o.getSnapshot!==t||f||ft!==null&&ft.memoizedState.tag&1){if(s.flags|=2048,rr(9,{destroy:void 0},Vh.bind(null,s,o,a,t),null),Pe===null)throw Error(l(349));u||(na&127)!==0||Gh(s,t,a)}return a}function Gh(e,t,a){e.flags|=16384,e={getSnapshot:t,value:a},t=ve.updateQueue,t===null?(t=Gl(),ve.updateQueue=t,t.stores=[e]):(a=t.stores,a===null?t.stores=[e]:a.push(e))}function Vh(e,t,a,s){t.value=a,t.getSnapshot=s,Yh(t)&&Jh(e)}function Kh(e,t,a){return a(function(){Yh(t)&&Jh(e)})}function Yh(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!Jt(e,a)}catch{return!0}}function Jh(e){var t=oi(e,2);t!==null&&Pt(t,e,2)}function Vc(e){var t=Mt();if(typeof e=="function"){var a=e;if(e=a(),yi){Ct(!0);try{a()}finally{Ct(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:aa,lastRenderedState:e},t}function Xh(e,t,a,s){return e.baseState=a,Ic(e,Be,typeof s=="function"?s:aa)}function Zy(e,t,a,s,o){if(Xl(e))throw Error(l(485));if(e=t.action,e!==null){var u={payload:o,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(f){u.listeners.push(f)}};D.T!==null?a(!0):u.isTransition=!1,s(u),a=t.pending,a===null?(u.next=t.pending=u,Wh(t,u)):(u.next=a.next,t.pending=a.next=u)}}function Wh(e,t){var a=t.action,s=t.payload,o=e.state;if(t.isTransition){var u=D.T,f={};D.T=f;try{var v=a(o,s),_=D.S;_!==null&&_(f,v),Qh(e,t,v)}catch(j){Kc(e,t,j)}finally{u!==null&&f.types!==null&&(u.types=f.types),D.T=u}}else try{u=a(o,s),Qh(e,t,u)}catch(j){Kc(e,t,j)}}function Qh(e,t,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(s){Zh(e,t,s)},function(s){return Kc(e,t,s)}):Zh(e,t,a)}function Zh(e,t,a){t.status="fulfilled",t.value=a,Fh(t),e.state=a,t=e.pending,t!==null&&(a=t.next,a===t?e.pending=null:(a=a.next,t.next=a,Wh(e,a)))}function Kc(e,t,a){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do t.status="rejected",t.reason=a,Fh(t),t=t.next;while(t!==s)}e.action=null}function Fh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function ef(e,t){return t}function tf(e,t){if(Ae){var a=Pe.formState;if(a!==null){e:{var s=ve;if(Ae){if(Ke){t:{for(var o=Ke,u=un;o.nodeType!==8;){if(!u){o=null;break t}if(o=hn(o.nextSibling),o===null){o=null;break t}}u=o.data,o=u==="F!"||u==="F"?o:null}if(o){Ke=hn(o.nextSibling),s=o.data==="F!";break e}}Oa(s)}s=!1}s&&(t=a[0])}}return a=Mt(),a.memoizedState=a.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ef,lastRenderedState:t},a.queue=s,a=wf.bind(null,ve,s),s.dispatch=a,s=Vc(!1),u=Zc.bind(null,ve,!1,s.queue),s=Mt(),o={state:t,dispatch:null,action:e,pending:null},s.queue=o,a=Zy.bind(null,ve,o,u,a),o.dispatch=a,s.memoizedState=e,[t,a,!1]}function nf(e){var t=ot();return af(t,Be,e)}function af(e,t,a){if(t=Ic(e,t,ef)[0],e=Kl(aa)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=vs(t)}catch(f){throw f===er?Ul:f}else s=t;t=ot();var o=t.queue,u=o.dispatch;return a!==t.memoizedState&&(ve.flags|=2048,rr(9,{destroy:void 0},Fy.bind(null,o,a),null)),[s,u,e]}function Fy(e,t){e.action=t}function rf(e){var t=ot(),a=Be;if(a!==null)return af(t,a,e);ot(),t=t.memoizedState,a=ot();var s=a.queue.dispatch;return a.memoizedState=e,[t,s,!1]}function rr(e,t,a,s){return e={tag:e,create:a,deps:s,inst:t,next:null},t=ve.updateQueue,t===null&&(t=Gl(),ve.updateQueue=t),a=t.lastEffect,a===null?t.lastEffect=e.next=e:(s=a.next,a.next=e,e.next=s,t.lastEffect=e),e}function sf(){return ot().memoizedState}function Yl(e,t,a,s){var o=Mt();ve.flags|=e,o.memoizedState=rr(1|t,{destroy:void 0},a,s===void 0?null:s)}function Jl(e,t,a,s){var o=ot();s=s===void 0?null:s;var u=o.memoizedState.inst;Be!==null&&s!==null&&zc(s,Be.memoizedState.deps)?o.memoizedState=rr(t,u,a,s):(ve.flags|=e,o.memoizedState=rr(1|t,u,a,s))}function lf(e,t){Yl(8390656,8,e,t)}function Yc(e,t){Jl(2048,8,e,t)}function ev(e){ve.flags|=4;var t=ve.updateQueue;if(t===null)t=Gl(),ve.updateQueue=t,t.events=[e];else{var a=t.events;a===null?t.events=[e]:a.push(e)}}function of(e){var t=ot().memoizedState;return ev({ref:t,nextImpl:e}),function(){if((Ne&2)!==0)throw Error(l(440));return t.impl.apply(void 0,arguments)}}function cf(e,t){return Jl(4,2,e,t)}function uf(e,t){return Jl(4,4,e,t)}function df(e,t){if(typeof t=="function"){e=e();var a=t(e);return function(){typeof a=="function"?a():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function hf(e,t,a){a=a!=null?a.concat([e]):null,Jl(4,4,df.bind(null,t,e),a)}function Jc(){}function ff(e,t){var a=ot();t=t===void 0?null:t;var s=a.memoizedState;return t!==null&&zc(t,s[1])?s[0]:(a.memoizedState=[e,t],e)}function mf(e,t){var a=ot();t=t===void 0?null:t;var s=a.memoizedState;if(t!==null&&zc(t,s[1]))return s[0];if(s=e(),yi){Ct(!0);try{e()}finally{Ct(!1)}}return a.memoizedState=[s,t],s}function Xc(e,t,a){return a===void 0||(na&1073741824)!==0&&(Te&261930)===0?e.memoizedState=t:(e.memoizedState=a,e=gm(),ve.lanes|=e,Ba|=e,a)}function gf(e,t,a,s){return Jt(a,t)?a:nr.current!==null?(e=Xc(e,a,s),Jt(e,t)||(mt=!0),e):(na&42)===0||(na&1073741824)!==0&&(Te&261930)===0?(mt=!0,e.memoizedState=a):(e=gm(),ve.lanes|=e,Ba|=e,t)}function pf(e,t,a,s,o){var u=V.p;V.p=u!==0&&8>u?u:8;var f=D.T,v={};D.T=v,Zc(e,!1,t,a);try{var _=o(),j=D.S;if(j!==null&&j(v,_),_!==null&&typeof _=="object"&&typeof _.then=="function"){var U=Xy(_,s);bs(e,t,U,en(e))}else bs(e,t,s,en(e))}catch(q){bs(e,t,{then:function(){},status:"rejected",reason:q},en())}finally{V.p=u,f!==null&&v.types!==null&&(f.types=v.types),D.T=f}}function tv(){}function Wc(e,t,a,s){if(e.tag!==5)throw Error(l(476));var o=yf(e).queue;pf(e,o,t,le,a===null?tv:function(){return vf(e),a(s)})}function yf(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:le,baseState:le,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:aa,lastRenderedState:le},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:aa,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function vf(e){var t=yf(e);t.next===null&&(t=e.alternate.memoizedState),bs(e,t.next.queue,{},en())}function Qc(){return Et(Us)}function bf(){return ot().memoizedState}function Sf(){return ot().memoizedState}function nv(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=en();e=Na(a);var s=La(t,e,a);s!==null&&(Pt(s,t,a),ms(s,t,a)),t={cache:Ac()},e.payload=t;return}t=t.return}}function av(e,t,a){var s=en();a={lane:s,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Xl(e)?_f(t,a):(a=gc(e,t,a,s),a!==null&&(Pt(a,e,s),Tf(a,t,s)))}function wf(e,t,a){var s=en();bs(e,t,a,s)}function bs(e,t,a,s){var o={lane:s,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Xl(e))_f(t,o);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var f=t.lastRenderedState,v=u(f,a);if(o.hasEagerState=!0,o.eagerState=v,Jt(v,f))return Ol(e,t,o,0),Pe===null&&Cl(),!1}catch{}if(a=gc(e,t,o,s),a!==null)return Pt(a,e,s),Tf(a,t,s),!0}return!1}function Zc(e,t,a,s){if(s={lane:2,revertLane:Ru(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Xl(e)){if(t)throw Error(l(479))}else t=gc(e,a,s,2),t!==null&&Pt(t,e,2)}function Xl(e){var t=e.alternate;return e===ve||t!==null&&t===ve}function _f(e,t){ar=Pl=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function Tf(e,t,a){if((a&4194048)!==0){var s=t.lanes;s&=e.pendingLanes,a|=s,t.lanes=a,Di(e,a)}}var Ss={readContext:Et,use:Vl,useCallback:it,useContext:it,useEffect:it,useImperativeHandle:it,useLayoutEffect:it,useInsertionEffect:it,useMemo:it,useReducer:it,useRef:it,useState:it,useDebugValue:it,useDeferredValue:it,useTransition:it,useSyncExternalStore:it,useId:it,useHostTransitionStatus:it,useFormState:it,useActionState:it,useOptimistic:it,useMemoCache:it,useCacheRefresh:it};Ss.useEffectEvent=it;var kf={readContext:Et,use:Vl,useCallback:function(e,t){return Mt().memoizedState=[e,t===void 0?null:t],e},useContext:Et,useEffect:lf,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,Yl(4194308,4,df.bind(null,t,e),a)},useLayoutEffect:function(e,t){return Yl(4194308,4,e,t)},useInsertionEffect:function(e,t){Yl(4,2,e,t)},useMemo:function(e,t){var a=Mt();t=t===void 0?null:t;var s=e();if(yi){Ct(!0);try{e()}finally{Ct(!1)}}return a.memoizedState=[s,t],s},useReducer:function(e,t,a){var s=Mt();if(a!==void 0){var o=a(t);if(yi){Ct(!0);try{a(t)}finally{Ct(!1)}}}else o=t;return s.memoizedState=s.baseState=o,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:o},s.queue=e,e=e.dispatch=av.bind(null,ve,e),[s.memoizedState,e]},useRef:function(e){var t=Mt();return e={current:e},t.memoizedState=e},useState:function(e){e=Vc(e);var t=e.queue,a=wf.bind(null,ve,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:Jc,useDeferredValue:function(e,t){var a=Mt();return Xc(a,e,t)},useTransition:function(){var e=Vc(!1);return e=pf.bind(null,ve,e.queue,!0,!1),Mt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var s=ve,o=Mt();if(Ae){if(a===void 0)throw Error(l(407));a=a()}else{if(a=t(),Pe===null)throw Error(l(349));(Te&127)!==0||Gh(s,t,a)}o.memoizedState=a;var u={value:a,getSnapshot:t};return o.queue=u,lf(Kh.bind(null,s,u,e),[e]),s.flags|=2048,rr(9,{destroy:void 0},Vh.bind(null,s,u,a,t),null),a},useId:function(){var e=Mt(),t=Pe.identifierPrefix;if(Ae){var a=Un,s=Mn;a=(s&~(1<<32-Ot(s)-1)).toString(32)+a,t="_"+t+"R_"+a,a=Il++,0<a&&(t+="H"+a.toString(32)),t+="_"}else a=Wy++,t="_"+t+"r_"+a.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Qc,useFormState:tf,useActionState:tf,useOptimistic:function(e){var t=Mt();t.memoizedState=t.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=a,t=Zc.bind(null,ve,!0,a),a.dispatch=t,[e,t]},useMemoCache:Pc,useCacheRefresh:function(){return Mt().memoizedState=nv.bind(null,ve)},useEffectEvent:function(e){var t=Mt(),a={impl:e};return t.memoizedState=a,function(){if((Ne&2)!==0)throw Error(l(440));return a.impl.apply(void 0,arguments)}}},Fc={readContext:Et,use:Vl,useCallback:ff,useContext:Et,useEffect:Yc,useImperativeHandle:hf,useInsertionEffect:cf,useLayoutEffect:uf,useMemo:mf,useReducer:Kl,useRef:sf,useState:function(){return Kl(aa)},useDebugValue:Jc,useDeferredValue:function(e,t){var a=ot();return gf(a,Be.memoizedState,e,t)},useTransition:function(){var e=Kl(aa)[0],t=ot().memoizedState;return[typeof e=="boolean"?e:vs(e),t]},useSyncExternalStore:Ih,useId:bf,useHostTransitionStatus:Qc,useFormState:nf,useActionState:nf,useOptimistic:function(e,t){var a=ot();return Xh(a,Be,e,t)},useMemoCache:Pc,useCacheRefresh:Sf};Fc.useEffectEvent=of;var Ef={readContext:Et,use:Vl,useCallback:ff,useContext:Et,useEffect:Yc,useImperativeHandle:hf,useInsertionEffect:cf,useLayoutEffect:uf,useMemo:mf,useReducer:Gc,useRef:sf,useState:function(){return Gc(aa)},useDebugValue:Jc,useDeferredValue:function(e,t){var a=ot();return Be===null?Xc(a,e,t):gf(a,Be.memoizedState,e,t)},useTransition:function(){var e=Gc(aa)[0],t=ot().memoizedState;return[typeof e=="boolean"?e:vs(e),t]},useSyncExternalStore:Ih,useId:bf,useHostTransitionStatus:Qc,useFormState:rf,useActionState:rf,useOptimistic:function(e,t){var a=ot();return Be!==null?Xh(a,Be,e,t):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:Pc,useCacheRefresh:Sf};Ef.useEffectEvent=of;function eu(e,t,a,s){t=e.memoizedState,a=a(s,t),a=a==null?t:b({},t,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var tu={enqueueSetState:function(e,t,a){e=e._reactInternals;var s=en(),o=Na(s);o.payload=t,a!=null&&(o.callback=a),t=La(e,o,s),t!==null&&(Pt(t,e,s),ms(t,e,s))},enqueueReplaceState:function(e,t,a){e=e._reactInternals;var s=en(),o=Na(s);o.tag=1,o.payload=t,a!=null&&(o.callback=a),t=La(e,o,s),t!==null&&(Pt(t,e,s),ms(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=en(),s=Na(a);s.tag=2,t!=null&&(s.callback=t),t=La(e,s,a),t!==null&&(Pt(t,e,a),ms(t,e,a))}};function Af(e,t,a,s,o,u,f){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,u,f):t.prototype&&t.prototype.isPureReactComponent?!ss(a,s)||!ss(o,u):!0}function xf(e,t,a,s){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(a,s),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(a,s),t.state!==e&&tu.enqueueReplaceState(t,t.state,null)}function vi(e,t){var a=t;if("ref"in t){a={};for(var s in t)s!=="ref"&&(a[s]=t[s])}if(e=e.defaultProps){a===t&&(a=b({},a));for(var o in e)a[o]===void 0&&(a[o]=e[o])}return a}function Cf(e){xl(e)}function Of(e){console.error(e)}function Rf(e){xl(e)}function Wl(e,t){try{var a=e.onUncaughtError;a(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function jf(e,t,a){try{var s=e.onCaughtError;s(a.value,{componentStack:a.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(o){setTimeout(function(){throw o})}}function nu(e,t,a){return a=Na(a),a.tag=3,a.payload={element:null},a.callback=function(){Wl(e,t)},a}function Nf(e){return e=Na(e),e.tag=3,e}function Lf(e,t,a,s){var o=a.type.getDerivedStateFromError;if(typeof o=="function"){var u=s.value;e.payload=function(){return o(u)},e.callback=function(){jf(t,a,s)}}var f=a.stateNode;f!==null&&typeof f.componentDidCatch=="function"&&(e.callback=function(){jf(t,a,s),typeof o!="function"&&(Ha===null?Ha=new Set([this]):Ha.add(this));var v=s.stack;this.componentDidCatch(s.value,{componentStack:v!==null?v:""})})}function iv(e,t,a,s,o){if(a.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=a.alternate,t!==null&&Qi(t,a,o,!0),a=Wt.current,a!==null){switch(a.tag){case 31:case 13:return dn===null?oo():a.alternate===null&&rt===0&&(rt=3),a.flags&=-257,a.flags|=65536,a.lanes=o,s===zl?a.flags|=16384:(t=a.updateQueue,t===null?a.updateQueue=new Set([s]):t.add(s),xu(e,s,o)),!1;case 22:return a.flags|=65536,s===zl?a.flags|=16384:(t=a.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([s])},a.updateQueue=t):(a=t.retryQueue,a===null?t.retryQueue=new Set([s]):a.add(s)),xu(e,s,o)),!1}throw Error(l(435,a.tag))}return xu(e,s,o),oo(),!1}if(Ae)return t=Wt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=o,s!==wc&&(e=Error(l(422),{cause:s}),cs(ln(e,a)))):(s!==wc&&(t=Error(l(423),{cause:s}),cs(ln(t,a))),e=e.current.alternate,e.flags|=65536,o&=-o,e.lanes|=o,s=ln(s,a),o=nu(e.stateNode,s,o),Nc(e,o),rt!==4&&(rt=2)),!1;var u=Error(l(520),{cause:s});if(u=ln(u,a),Cs===null?Cs=[u]:Cs.push(u),rt!==4&&(rt=2),t===null)return!0;s=ln(s,a),a=t;do{switch(a.tag){case 3:return a.flags|=65536,e=o&-o,a.lanes|=e,e=nu(a.stateNode,s,e),Nc(a,e),!1;case 1:if(t=a.type,u=a.stateNode,(a.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||u!==null&&typeof u.componentDidCatch=="function"&&(Ha===null||!Ha.has(u))))return a.flags|=65536,o&=-o,a.lanes|=o,o=Nf(o),Lf(o,e,a,s),Nc(a,o),!1}a=a.return}while(a!==null);return!1}var au=Error(l(461)),mt=!1;function At(e,t,a,s){t.child=e===null?Uh(t,null,a,s):pi(t,e.child,a,s)}function Df(e,t,a,s,o){a=a.render;var u=t.ref;if("ref"in s){var f={};for(var v in s)v!=="ref"&&(f[v]=s[v])}else f=s;return hi(t),s=Bc(e,t,a,f,u,o),v=Hc(),e!==null&&!mt?(qc(e,t,o),ia(e,t,o)):(Ae&&v&&bc(t),t.flags|=1,At(e,t,s,o),t.child)}function Mf(e,t,a,s,o){if(e===null){var u=a.type;return typeof u=="function"&&!pc(u)&&u.defaultProps===void 0&&a.compare===null?(t.tag=15,t.type=u,Uf(e,t,u,s,o)):(e=jl(a.type,null,s,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!du(e,o)){var f=u.memoizedProps;if(a=a.compare,a=a!==null?a:ss,a(f,s)&&e.ref===t.ref)return ia(e,t,o)}return t.flags|=1,e=Zn(u,s),e.ref=t.ref,e.return=t,t.child=e}function Uf(e,t,a,s,o){if(e!==null){var u=e.memoizedProps;if(ss(u,s)&&e.ref===t.ref)if(mt=!1,t.pendingProps=s=u,du(e,o))(e.flags&131072)!==0&&(mt=!0);else return t.lanes=e.lanes,ia(e,t,o)}return iu(e,t,a,s,o)}function zf(e,t,a,s){var o=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|a:a,e!==null){for(s=t.child=e.child,o=0;s!==null;)o=o|s.lanes|s.childLanes,s=s.sibling;s=o&~u}else s=0,t.child=null;return Bf(e,t,u,a,s)}if((a&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ml(t,u!==null?u.cachePool:null),u!==null?Hh(t,u):Dc(),qh(t);else return s=t.lanes=536870912,Bf(e,t,u!==null?u.baseLanes|a:a,a,s)}else u!==null?(Ml(t,u.cachePool),Hh(t,u),Ma(),t.memoizedState=null):(e!==null&&Ml(t,null),Dc(),Ma());return At(e,t,o,a),t.child}function ws(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Bf(e,t,a,s,o){var u=Cc();return u=u===null?null:{parent:ht._currentValue,pool:u},t.memoizedState={baseLanes:a,cachePool:u},e!==null&&Ml(t,null),Dc(),qh(t),e!==null&&Qi(e,t,s,!0),t.childLanes=o,null}function Ql(e,t){return t=Fl({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Hf(e,t,a){return pi(t,e.child,null,a),e=Ql(t,t.pendingProps),e.flags|=2,Qt(t),t.memoizedState=null,e}function rv(e,t,a){var s=t.pendingProps,o=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Ae){if(s.mode==="hidden")return e=Ql(t,s),t.lanes=536870912,ws(null,e);if(Uc(t),(e=Ke)?(e=Qm(e,un),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:xa!==null?{id:Mn,overflow:Un}:null,retryLane:536870912,hydrationErrors:null},a=wh(e),a.return=t,t.child=a,kt=t,Ke=null)):e=null,e===null)throw Oa(t);return t.lanes=536870912,null}return Ql(t,s)}var u=e.memoizedState;if(u!==null){var f=u.dehydrated;if(Uc(t),o)if(t.flags&256)t.flags&=-257,t=Hf(e,t,a);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(l(558));else if(mt||Qi(e,t,a,!1),o=(a&e.childLanes)!==0,mt||o){if(s=Pe,s!==null&&(f=Gr(s,a),f!==0&&f!==u.retryLane))throw u.retryLane=f,oi(e,f),Pt(s,e,f),au;oo(),t=Hf(e,t,a)}else e=u.treeContext,Ke=hn(f.nextSibling),kt=t,Ae=!0,Ca=null,un=!1,e!==null&&kh(t,e),t=Ql(t,s),t.flags|=4096;return t}return e=Zn(e.child,{mode:s.mode,children:s.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Zl(e,t){var a=t.ref;if(a===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(l(284));(e===null||e.ref!==a)&&(t.flags|=4194816)}}function iu(e,t,a,s,o){return hi(t),a=Bc(e,t,a,s,void 0,o),s=Hc(),e!==null&&!mt?(qc(e,t,o),ia(e,t,o)):(Ae&&s&&bc(t),t.flags|=1,At(e,t,a,o),t.child)}function qf(e,t,a,s,o,u){return hi(t),t.updateQueue=null,a=Ph(t,s,a,o),$h(e),s=Hc(),e!==null&&!mt?(qc(e,t,u),ia(e,t,u)):(Ae&&s&&bc(t),t.flags|=1,At(e,t,a,u),t.child)}function $f(e,t,a,s,o){if(hi(t),t.stateNode===null){var u=Yi,f=a.contextType;typeof f=="object"&&f!==null&&(u=Et(f)),u=new a(s,u),t.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=tu,t.stateNode=u,u._reactInternals=t,u=t.stateNode,u.props=s,u.state=t.memoizedState,u.refs={},Rc(t),f=a.contextType,u.context=typeof f=="object"&&f!==null?Et(f):Yi,u.state=t.memoizedState,f=a.getDerivedStateFromProps,typeof f=="function"&&(eu(t,a,f,s),u.state=t.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(f=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),f!==u.state&&tu.enqueueReplaceState(u,u.state,null),ps(t,s,u,o),gs(),u.state=t.memoizedState),typeof u.componentDidMount=="function"&&(t.flags|=4194308),s=!0}else if(e===null){u=t.stateNode;var v=t.memoizedProps,_=vi(a,v);u.props=_;var j=u.context,U=a.contextType;f=Yi,typeof U=="object"&&U!==null&&(f=Et(U));var q=a.getDerivedStateFromProps;U=typeof q=="function"||typeof u.getSnapshotBeforeUpdate=="function",v=t.pendingProps!==v,U||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(v||j!==f)&&xf(t,u,s,f),ja=!1;var N=t.memoizedState;u.state=N,ps(t,s,u,o),gs(),j=t.memoizedState,v||N!==j||ja?(typeof q=="function"&&(eu(t,a,q,s),j=t.memoizedState),(_=ja||Af(t,a,_,s,N,j,f))?(U||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=j),u.props=s,u.state=j,u.context=f,s=_):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{u=t.stateNode,jc(e,t),f=t.memoizedProps,U=vi(a,f),u.props=U,q=t.pendingProps,N=u.context,j=a.contextType,_=Yi,typeof j=="object"&&j!==null&&(_=Et(j)),v=a.getDerivedStateFromProps,(j=typeof v=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(f!==q||N!==_)&&xf(t,u,s,_),ja=!1,N=t.memoizedState,u.state=N,ps(t,s,u,o),gs();var L=t.memoizedState;f!==q||N!==L||ja||e!==null&&e.dependencies!==null&&Ll(e.dependencies)?(typeof v=="function"&&(eu(t,a,v,s),L=t.memoizedState),(U=ja||Af(t,a,U,s,N,L,_)||e!==null&&e.dependencies!==null&&Ll(e.dependencies))?(j||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(s,L,_),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(s,L,_)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||f===e.memoizedProps&&N===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||f===e.memoizedProps&&N===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=L),u.props=s,u.state=L,u.context=_,s=U):(typeof u.componentDidUpdate!="function"||f===e.memoizedProps&&N===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||f===e.memoizedProps&&N===e.memoizedState||(t.flags|=1024),s=!1)}return u=s,Zl(e,t),s=(t.flags&128)!==0,u||s?(u=t.stateNode,a=s&&typeof a.getDerivedStateFromError!="function"?null:u.render(),t.flags|=1,e!==null&&s?(t.child=pi(t,e.child,null,o),t.child=pi(t,null,a,o)):At(e,t,a,o),t.memoizedState=u.state,e=t.child):e=ia(e,t,o),e}function Pf(e,t,a,s){return ui(),t.flags|=256,At(e,t,a,s),t.child}var ru={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function su(e){return{baseLanes:e,cachePool:Rh()}}function lu(e,t,a){return e=e!==null?e.childLanes&~a:0,t&&(e|=Ft),e}function If(e,t,a){var s=t.pendingProps,o=!1,u=(t.flags&128)!==0,f;if((f=u)||(f=e!==null&&e.memoizedState===null?!1:(lt.current&2)!==0),f&&(o=!0,t.flags&=-129),f=(t.flags&32)!==0,t.flags&=-33,e===null){if(Ae){if(o?Da(t):Ma(),(e=Ke)?(e=Qm(e,un),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:xa!==null?{id:Mn,overflow:Un}:null,retryLane:536870912,hydrationErrors:null},a=wh(e),a.return=t,t.child=a,kt=t,Ke=null)):e=null,e===null)throw Oa(t);return Iu(e)?t.lanes=32:t.lanes=536870912,null}var v=s.children;return s=s.fallback,o?(Ma(),o=t.mode,v=Fl({mode:"hidden",children:v},o),s=ci(s,o,a,null),v.return=t,s.return=t,v.sibling=s,t.child=v,s=t.child,s.memoizedState=su(a),s.childLanes=lu(e,f,a),t.memoizedState=ru,ws(null,s)):(Da(t),ou(t,v))}var _=e.memoizedState;if(_!==null&&(v=_.dehydrated,v!==null)){if(u)t.flags&256?(Da(t),t.flags&=-257,t=cu(e,t,a)):t.memoizedState!==null?(Ma(),t.child=e.child,t.flags|=128,t=null):(Ma(),v=s.fallback,o=t.mode,s=Fl({mode:"visible",children:s.children},o),v=ci(v,o,a,null),v.flags|=2,s.return=t,v.return=t,s.sibling=v,t.child=s,pi(t,e.child,null,a),s=t.child,s.memoizedState=su(a),s.childLanes=lu(e,f,a),t.memoizedState=ru,t=ws(null,s));else if(Da(t),Iu(v)){if(f=v.nextSibling&&v.nextSibling.dataset,f)var j=f.dgst;f=j,s=Error(l(419)),s.stack="",s.digest=f,cs({value:s,source:null,stack:null}),t=cu(e,t,a)}else if(mt||Qi(e,t,a,!1),f=(a&e.childLanes)!==0,mt||f){if(f=Pe,f!==null&&(s=Gr(f,a),s!==0&&s!==_.retryLane))throw _.retryLane=s,oi(e,s),Pt(f,e,s),au;Pu(v)||oo(),t=cu(e,t,a)}else Pu(v)?(t.flags|=192,t.child=e.child,t=null):(e=_.treeContext,Ke=hn(v.nextSibling),kt=t,Ae=!0,Ca=null,un=!1,e!==null&&kh(t,e),t=ou(t,s.children),t.flags|=4096);return t}return o?(Ma(),v=s.fallback,o=t.mode,_=e.child,j=_.sibling,s=Zn(_,{mode:"hidden",children:s.children}),s.subtreeFlags=_.subtreeFlags&65011712,j!==null?v=Zn(j,v):(v=ci(v,o,a,null),v.flags|=2),v.return=t,s.return=t,s.sibling=v,t.child=s,ws(null,s),s=t.child,v=e.child.memoizedState,v===null?v=su(a):(o=v.cachePool,o!==null?(_=ht._currentValue,o=o.parent!==_?{parent:_,pool:_}:o):o=Rh(),v={baseLanes:v.baseLanes|a,cachePool:o}),s.memoizedState=v,s.childLanes=lu(e,f,a),t.memoizedState=ru,ws(e.child,s)):(Da(t),a=e.child,e=a.sibling,a=Zn(a,{mode:"visible",children:s.children}),a.return=t,a.sibling=null,e!==null&&(f=t.deletions,f===null?(t.deletions=[e],t.flags|=16):f.push(e)),t.child=a,t.memoizedState=null,a)}function ou(e,t){return t=Fl({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Fl(e,t){return e=Xt(22,e,null,t),e.lanes=0,e}function cu(e,t,a){return pi(t,e.child,null,a),e=ou(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Gf(e,t,a){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),kc(e.return,t,a)}function uu(e,t,a,s,o,u){var f=e.memoizedState;f===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:a,tailMode:o,treeForkCount:u}:(f.isBackwards=t,f.rendering=null,f.renderingStartTime=0,f.last=s,f.tail=a,f.tailMode=o,f.treeForkCount=u)}function Vf(e,t,a){var s=t.pendingProps,o=s.revealOrder,u=s.tail;s=s.children;var f=lt.current,v=(f&2)!==0;if(v?(f=f&1|2,t.flags|=128):f&=1,J(lt,f),At(e,t,s,a),s=Ae?os:0,!v&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Gf(e,a,t);else if(e.tag===19)Gf(e,a,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(o){case"forwards":for(a=t.child,o=null;a!==null;)e=a.alternate,e!==null&&$l(e)===null&&(o=a),a=a.sibling;a=o,a===null?(o=t.child,t.child=null):(o=a.sibling,a.sibling=null),uu(t,!1,o,a,u,s);break;case"backwards":case"unstable_legacy-backwards":for(a=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&$l(e)===null){t.child=o;break}e=o.sibling,o.sibling=a,a=o,o=e}uu(t,!0,a,null,u,s);break;case"together":uu(t,!1,null,null,void 0,s);break;default:t.memoizedState=null}return t.child}function ia(e,t,a){if(e!==null&&(t.dependencies=e.dependencies),Ba|=t.lanes,(a&t.childLanes)===0)if(e!==null){if(Qi(e,t,a,!1),(a&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(l(153));if(t.child!==null){for(e=t.child,a=Zn(e,e.pendingProps),t.child=a,a.return=t;e.sibling!==null;)e=e.sibling,a=a.sibling=Zn(e,e.pendingProps),a.return=t;a.sibling=null}return t.child}function du(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Ll(e)))}function sv(e,t,a){switch(t.tag){case 3:Qe(t,t.stateNode.containerInfo),Ra(t,ht,e.memoizedState.cache),ui();break;case 27:case 5:xn(t);break;case 4:Qe(t,t.stateNode.containerInfo);break;case 10:Ra(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Uc(t),null;break;case 13:var s=t.memoizedState;if(s!==null)return s.dehydrated!==null?(Da(t),t.flags|=128,null):(a&t.child.childLanes)!==0?If(e,t,a):(Da(t),e=ia(e,t,a),e!==null?e.sibling:null);Da(t);break;case 19:var o=(e.flags&128)!==0;if(s=(a&t.childLanes)!==0,s||(Qi(e,t,a,!1),s=(a&t.childLanes)!==0),o){if(s)return Vf(e,t,a);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),J(lt,lt.current),s)break;return null;case 22:return t.lanes=0,zf(e,t,a,t.pendingProps);case 24:Ra(t,ht,e.memoizedState.cache)}return ia(e,t,a)}function Kf(e,t,a){if(e!==null)if(e.memoizedProps!==t.pendingProps)mt=!0;else{if(!du(e,a)&&(t.flags&128)===0)return mt=!1,sv(e,t,a);mt=(e.flags&131072)!==0}else mt=!1,Ae&&(t.flags&1048576)!==0&&Th(t,os,t.index);switch(t.lanes=0,t.tag){case 16:e:{var s=t.pendingProps;if(e=mi(t.elementType),t.type=e,typeof e=="function")pc(e)?(s=vi(e,s),t.tag=1,t=$f(null,t,e,s,a)):(t.tag=0,t=iu(null,t,e,s,a));else{if(e!=null){var o=e.$$typeof;if(o===Y){t.tag=11,t=Df(null,t,e,s,a);break e}else if(o===K){t.tag=14,t=Mf(null,t,e,s,a);break e}}throw t=Xe(e)||e,Error(l(306,t,""))}}return t;case 0:return iu(e,t,t.type,t.pendingProps,a);case 1:return s=t.type,o=vi(s,t.pendingProps),$f(e,t,s,o,a);case 3:e:{if(Qe(t,t.stateNode.containerInfo),e===null)throw Error(l(387));s=t.pendingProps;var u=t.memoizedState;o=u.element,jc(e,t),ps(t,s,null,a);var f=t.memoizedState;if(s=f.cache,Ra(t,ht,s),s!==u.cache&&Ec(t,[ht],a,!0),gs(),s=f.element,u.isDehydrated)if(u={element:s,isDehydrated:!1,cache:f.cache},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){t=Pf(e,t,s,a);break e}else if(s!==o){o=ln(Error(l(424)),t),cs(o),t=Pf(e,t,s,a);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,Ke=hn(e.firstChild),kt=t,Ae=!0,Ca=null,un=!0,a=Uh(t,null,s,a),t.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(ui(),s===o){t=ia(e,t,a);break e}At(e,t,s,a)}t=t.child}return t;case 26:return Zl(e,t),e===null?(a=ag(t.type,null,t.pendingProps,null))?t.memoizedState=a:Ae||(a=t.type,e=t.pendingProps,s=po(ye.current).createElement(a),s[tt]=t,s[Tt]=e,xt(s,a,e),dt(s),t.stateNode=s):t.memoizedState=ag(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return xn(t),e===null&&Ae&&(s=t.stateNode=eg(t.type,t.pendingProps,ye.current),kt=t,un=!0,o=Ke,Ia(t.type)?(Gu=o,Ke=hn(s.firstChild)):Ke=o),At(e,t,t.pendingProps.children,a),Zl(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ae&&((o=s=Ke)&&(s=Uv(s,t.type,t.pendingProps,un),s!==null?(t.stateNode=s,kt=t,Ke=hn(s.firstChild),un=!1,o=!0):o=!1),o||Oa(t)),xn(t),o=t.type,u=t.pendingProps,f=e!==null?e.memoizedProps:null,s=u.children,Hu(o,u)?s=null:f!==null&&Hu(o,f)&&(t.flags|=32),t.memoizedState!==null&&(o=Bc(e,t,Qy,null,null,a),Us._currentValue=o),Zl(e,t),At(e,t,s,a),t.child;case 6:return e===null&&Ae&&((e=a=Ke)&&(a=zv(a,t.pendingProps,un),a!==null?(t.stateNode=a,kt=t,Ke=null,e=!0):e=!1),e||Oa(t)),null;case 13:return If(e,t,a);case 4:return Qe(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=pi(t,null,s,a):At(e,t,s,a),t.child;case 11:return Df(e,t,t.type,t.pendingProps,a);case 7:return At(e,t,t.pendingProps,a),t.child;case 8:return At(e,t,t.pendingProps.children,a),t.child;case 12:return At(e,t,t.pendingProps.children,a),t.child;case 10:return s=t.pendingProps,Ra(t,t.type,s.value),At(e,t,s.children,a),t.child;case 9:return o=t.type._context,s=t.pendingProps.children,hi(t),o=Et(o),s=s(o),t.flags|=1,At(e,t,s,a),t.child;case 14:return Mf(e,t,t.type,t.pendingProps,a);case 15:return Uf(e,t,t.type,t.pendingProps,a);case 19:return Vf(e,t,a);case 31:return rv(e,t,a);case 22:return zf(e,t,a,t.pendingProps);case 24:return hi(t),s=Et(ht),e===null?(o=Cc(),o===null&&(o=Pe,u=Ac(),o.pooledCache=u,u.refCount++,u!==null&&(o.pooledCacheLanes|=a),o=u),t.memoizedState={parent:s,cache:o},Rc(t),Ra(t,ht,o)):((e.lanes&a)!==0&&(jc(e,t),ps(t,null,null,a),gs()),o=e.memoizedState,u=t.memoizedState,o.parent!==s?(o={parent:s,cache:s},t.memoizedState=o,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=o),Ra(t,ht,s)):(s=u.cache,Ra(t,ht,s),s!==o.cache&&Ec(t,[ht],a,!0))),At(e,t,t.pendingProps.children,a),t.child;case 29:throw t.pendingProps}throw Error(l(156,t.tag))}function ra(e){e.flags|=4}function hu(e,t,a,s,o){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(o&335544128)===o)if(e.stateNode.complete)e.flags|=8192;else if(bm())e.flags|=8192;else throw gi=zl,Oc}else e.flags&=-16777217}function Yf(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!og(t))if(bm())e.flags|=8192;else throw gi=zl,Oc}function eo(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?wa():536870912,e.lanes|=t,cr|=t)}function _s(e,t){if(!Ae)switch(e.tailMode){case"hidden":t=e.tail;for(var a=null;t!==null;)t.alternate!==null&&(a=t),t=t.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var s=null;a!==null;)a.alternate!==null&&(s=a),a=a.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function Ye(e){var t=e.alternate!==null&&e.alternate.child===e.child,a=0,s=0;if(t)for(var o=e.child;o!==null;)a|=o.lanes|o.childLanes,s|=o.subtreeFlags&65011712,s|=o.flags&65011712,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)a|=o.lanes|o.childLanes,s|=o.subtreeFlags,s|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=s,e.childLanes=a,t}function lv(e,t,a){var s=t.pendingProps;switch(Sc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ye(t),null;case 1:return Ye(t),null;case 3:return a=t.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),ta(ht),Ze(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Wi(t)?ra(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,_c())),Ye(t),null;case 26:var o=t.type,u=t.memoizedState;return e===null?(ra(t),u!==null?(Ye(t),Yf(t,u)):(Ye(t),hu(t,o,null,s,a))):u?u!==e.memoizedState?(ra(t),Ye(t),Yf(t,u)):(Ye(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&ra(t),Ye(t),hu(t,o,e,s,a)),null;case 27:if(gn(t),a=ye.current,o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&ra(t);else{if(!s){if(t.stateNode===null)throw Error(l(166));return Ye(t),null}e=Z.current,Wi(t)?Eh(t):(e=eg(o,s,a),t.stateNode=e,ra(t))}return Ye(t),null;case 5:if(gn(t),o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&ra(t);else{if(!s){if(t.stateNode===null)throw Error(l(166));return Ye(t),null}if(u=Z.current,Wi(t))Eh(t);else{var f=po(ye.current);switch(u){case 1:u=f.createElementNS("http://www.w3.org/2000/svg",o);break;case 2:u=f.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;default:switch(o){case"svg":u=f.createElementNS("http://www.w3.org/2000/svg",o);break;case"math":u=f.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;case"script":u=f.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof s.is=="string"?f.createElement("select",{is:s.is}):f.createElement("select"),s.multiple?u.multiple=!0:s.size&&(u.size=s.size);break;default:u=typeof s.is=="string"?f.createElement(o,{is:s.is}):f.createElement(o)}}u[tt]=t,u[Tt]=s;e:for(f=t.child;f!==null;){if(f.tag===5||f.tag===6)u.appendChild(f.stateNode);else if(f.tag!==4&&f.tag!==27&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===t)break e;for(;f.sibling===null;){if(f.return===null||f.return===t)break e;f=f.return}f.sibling.return=f.return,f=f.sibling}t.stateNode=u;e:switch(xt(u,o,s),o){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&ra(t)}}return Ye(t),hu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&ra(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(l(166));if(e=ye.current,Wi(t)){if(e=t.stateNode,a=t.memoizedProps,s=null,o=kt,o!==null)switch(o.tag){case 27:case 5:s=o.memoizedProps}e[tt]=t,e=!!(e.nodeValue===a||s!==null&&s.suppressHydrationWarning===!0||Im(e.nodeValue,a)),e||Oa(t,!0)}else e=po(e).createTextNode(s),e[tt]=t,t.stateNode=e}return Ye(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(s=Wi(t),a!==null){if(e===null){if(!s)throw Error(l(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(557));e[tt]=t}else ui(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ye(t),e=!1}else a=_c(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(Qt(t),t):(Qt(t),null);if((t.flags&128)!==0)throw Error(l(558))}return Ye(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(o=Wi(t),s!==null&&s.dehydrated!==null){if(e===null){if(!o)throw Error(l(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(l(317));o[tt]=t}else ui(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ye(t),o=!1}else o=_c(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=o),o=!0;if(!o)return t.flags&256?(Qt(t),t):(Qt(t),null)}return Qt(t),(t.flags&128)!==0?(t.lanes=a,t):(a=s!==null,e=e!==null&&e.memoizedState!==null,a&&(s=t.child,o=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(o=s.alternate.memoizedState.cachePool.pool),u=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),u!==o&&(s.flags|=2048)),a!==e&&a&&(t.child.flags|=8192),eo(t,t.updateQueue),Ye(t),null);case 4:return Ze(),e===null&&Du(t.stateNode.containerInfo),Ye(t),null;case 10:return ta(t.type),Ye(t),null;case 19:if(M(lt),s=t.memoizedState,s===null)return Ye(t),null;if(o=(t.flags&128)!==0,u=s.rendering,u===null)if(o)_s(s,!1);else{if(rt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=$l(e),u!==null){for(t.flags|=128,_s(s,!1),e=u.updateQueue,t.updateQueue=e,eo(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)Sh(a,e),a=a.sibling;return J(lt,lt.current&1|2),Ae&&Fn(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&Ie()>ro&&(t.flags|=128,o=!0,_s(s,!1),t.lanes=4194304)}else{if(!o)if(e=$l(u),e!==null){if(t.flags|=128,o=!0,e=e.updateQueue,t.updateQueue=e,eo(t,e),_s(s,!0),s.tail===null&&s.tailMode==="hidden"&&!u.alternate&&!Ae)return Ye(t),null}else 2*Ie()-s.renderingStartTime>ro&&a!==536870912&&(t.flags|=128,o=!0,_s(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=Ie(),e.sibling=null,a=lt.current,J(lt,o?a&1|2:a&1),Ae&&Fn(t,s.treeForkCount),e):(Ye(t),null);case 22:case 23:return Qt(t),Mc(),s=t.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(t.flags|=8192):s&&(t.flags|=8192),s?(a&536870912)!==0&&(t.flags&128)===0&&(Ye(t),t.subtreeFlags&6&&(t.flags|=8192)):Ye(t),a=t.updateQueue,a!==null&&eo(t,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),s=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),s!==a&&(t.flags|=2048),e!==null&&M(fi),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),ta(ht),Ye(t),null;case 25:return null;case 30:return null}throw Error(l(156,t.tag))}function ov(e,t){switch(Sc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ta(ht),Ze(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return gn(t),null;case 31:if(t.memoizedState!==null){if(Qt(t),t.alternate===null)throw Error(l(340));ui()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Qt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(l(340));ui()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return M(lt),null;case 4:return Ze(),null;case 10:return ta(t.type),null;case 22:case 23:return Qt(t),Mc(),e!==null&&M(fi),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ta(ht),null;case 25:return null;default:return null}}function Jf(e,t){switch(Sc(t),t.tag){case 3:ta(ht),Ze();break;case 26:case 27:case 5:gn(t);break;case 4:Ze();break;case 31:t.memoizedState!==null&&Qt(t);break;case 13:Qt(t);break;case 19:M(lt);break;case 10:ta(t.type);break;case 22:case 23:Qt(t),Mc(),e!==null&&M(fi);break;case 24:ta(ht)}}function Ts(e,t){try{var a=t.updateQueue,s=a!==null?a.lastEffect:null;if(s!==null){var o=s.next;a=o;do{if((a.tag&e)===e){s=void 0;var u=a.create,f=a.inst;s=u(),f.destroy=s}a=a.next}while(a!==o)}}catch(v){Ue(t,t.return,v)}}function Ua(e,t,a){try{var s=t.updateQueue,o=s!==null?s.lastEffect:null;if(o!==null){var u=o.next;s=u;do{if((s.tag&e)===e){var f=s.inst,v=f.destroy;if(v!==void 0){f.destroy=void 0,o=t;var _=a,j=v;try{j()}catch(U){Ue(o,_,U)}}}s=s.next}while(s!==u)}}catch(U){Ue(t,t.return,U)}}function Xf(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{Bh(t,a)}catch(s){Ue(e,e.return,s)}}}function Wf(e,t,a){a.props=vi(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(s){Ue(e,t,s)}}function ks(e,t){try{var a=e.ref;if(a!==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 a=="function"?e.refCleanup=a(s):a.current=s}}catch(o){Ue(e,t,o)}}function zn(e,t){var a=e.ref,s=e.refCleanup;if(a!==null)if(typeof s=="function")try{s()}catch(o){Ue(e,t,o)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(o){Ue(e,t,o)}else a.current=null}function Qf(e){var t=e.type,a=e.memoizedProps,s=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&s.focus();break e;case"img":a.src?s.src=a.src:a.srcSet&&(s.srcset=a.srcSet)}}catch(o){Ue(e,e.return,o)}}function fu(e,t,a){try{var s=e.stateNode;Rv(s,e.type,a,t),s[Tt]=t}catch(o){Ue(e,e.return,o)}}function Zf(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ia(e.type)||e.tag===4}function mu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Zf(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&&Ia(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 gu(e,t,a){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(e),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=vn));else if(s!==4&&(s===27&&Ia(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(gu(e,t,a),e=e.sibling;e!==null;)gu(e,t,a),e=e.sibling}function to(e,t,a){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?a.insertBefore(e,t):a.appendChild(e);else if(s!==4&&(s===27&&Ia(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(to(e,t,a),e=e.sibling;e!==null;)to(e,t,a),e=e.sibling}function Ff(e){var t=e.stateNode,a=e.memoizedProps;try{for(var s=e.type,o=t.attributes;o.length;)t.removeAttributeNode(o[0]);xt(t,s,a),t[tt]=e,t[Tt]=a}catch(u){Ue(e,e.return,u)}}var sa=!1,gt=!1,pu=!1,em=typeof WeakSet=="function"?WeakSet:Set,wt=null;function cv(e,t){if(e=e.containerInfo,zu=To,e=dh(e),cc(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var s=a.getSelection&&a.getSelection();if(s&&s.rangeCount!==0){a=s.anchorNode;var o=s.anchorOffset,u=s.focusNode;s=s.focusOffset;try{a.nodeType,u.nodeType}catch{a=null;break e}var f=0,v=-1,_=-1,j=0,U=0,q=e,N=null;t:for(;;){for(var L;q!==a||o!==0&&q.nodeType!==3||(v=f+o),q!==u||s!==0&&q.nodeType!==3||(_=f+s),q.nodeType===3&&(f+=q.nodeValue.length),(L=q.firstChild)!==null;)N=q,q=L;for(;;){if(q===e)break t;if(N===a&&++j===o&&(v=f),N===u&&++U===s&&(_=f),(L=q.nextSibling)!==null)break;q=N,N=q.parentNode}q=L}a=v===-1||_===-1?null:{start:v,end:_}}else a=null}a=a||{start:0,end:0}}else a=null;for(Bu={focusedElem:e,selectionRange:a},To=!1,wt=t;wt!==null;)if(t=wt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,wt=e;else for(;wt!==null;){switch(t=wt,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(a=0;a<e.length;a++)o=e[a],o.ref.impl=o.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&u!==null){e=void 0,a=t,o=u.memoizedProps,u=u.memoizedState,s=a.stateNode;try{var F=vi(a.type,o);e=s.getSnapshotBeforeUpdate(F,u),s.__reactInternalSnapshotBeforeUpdate=e}catch(de){Ue(a,a.return,de)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,a=e.nodeType,a===9)$u(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":$u(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(l(163))}if(e=t.sibling,e!==null){e.return=t.return,wt=e;break}wt=t.return}}function tm(e,t,a){var s=a.flags;switch(a.tag){case 0:case 11:case 15:oa(e,a),s&4&&Ts(5,a);break;case 1:if(oa(e,a),s&4)if(e=a.stateNode,t===null)try{e.componentDidMount()}catch(f){Ue(a,a.return,f)}else{var o=vi(a.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(o,t,e.__reactInternalSnapshotBeforeUpdate)}catch(f){Ue(a,a.return,f)}}s&64&&Xf(a),s&512&&ks(a,a.return);break;case 3:if(oa(e,a),s&64&&(e=a.updateQueue,e!==null)){if(t=null,a.child!==null)switch(a.child.tag){case 27:case 5:t=a.child.stateNode;break;case 1:t=a.child.stateNode}try{Bh(e,t)}catch(f){Ue(a,a.return,f)}}break;case 27:t===null&&s&4&&Ff(a);case 26:case 5:oa(e,a),t===null&&s&4&&Qf(a),s&512&&ks(a,a.return);break;case 12:oa(e,a);break;case 31:oa(e,a),s&4&&im(e,a);break;case 13:oa(e,a),s&4&&rm(e,a),s&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=vv.bind(null,a),Bv(e,a))));break;case 22:if(s=a.memoizedState!==null||sa,!s){t=t!==null&&t.memoizedState!==null||gt,o=sa;var u=gt;sa=s,(gt=t)&&!u?ca(e,a,(a.subtreeFlags&8772)!==0):oa(e,a),sa=o,gt=u}break;case 30:break;default:oa(e,a)}}function nm(e){var t=e.alternate;t!==null&&(e.alternate=null,nm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Ui(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 We=null,Bt=!1;function la(e,t,a){for(a=a.child;a!==null;)am(e,t,a),a=a.sibling}function am(e,t,a){if(vt&&typeof vt.onCommitFiberUnmount=="function")try{vt.onCommitFiberUnmount(ba,a)}catch{}switch(a.tag){case 26:gt||zn(a,t),la(e,t,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:gt||zn(a,t);var s=We,o=Bt;Ia(a.type)&&(We=a.stateNode,Bt=!1),la(e,t,a),Ls(a.stateNode),We=s,Bt=o;break;case 5:gt||zn(a,t);case 6:if(s=We,o=Bt,We=null,la(e,t,a),We=s,Bt=o,We!==null)if(Bt)try{(We.nodeType===9?We.body:We.nodeName==="HTML"?We.ownerDocument.body:We).removeChild(a.stateNode)}catch(u){Ue(a,t,u)}else try{We.removeChild(a.stateNode)}catch(u){Ue(a,t,u)}break;case 18:We!==null&&(Bt?(e=We,Xm(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),yr(e)):Xm(We,a.stateNode));break;case 4:s=We,o=Bt,We=a.stateNode.containerInfo,Bt=!0,la(e,t,a),We=s,Bt=o;break;case 0:case 11:case 14:case 15:Ua(2,a,t),gt||Ua(4,a,t),la(e,t,a);break;case 1:gt||(zn(a,t),s=a.stateNode,typeof s.componentWillUnmount=="function"&&Wf(a,t,s)),la(e,t,a);break;case 21:la(e,t,a);break;case 22:gt=(s=gt)||a.memoizedState!==null,la(e,t,a),gt=s;break;default:la(e,t,a)}}function im(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{yr(e)}catch(a){Ue(t,t.return,a)}}}function rm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{yr(e)}catch(a){Ue(t,t.return,a)}}function uv(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new em),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new em),t;default:throw Error(l(435,e.tag))}}function no(e,t){var a=uv(e);t.forEach(function(s){if(!a.has(s)){a.add(s);var o=bv.bind(null,e,s);s.then(o,o)}})}function Ht(e,t){var a=t.deletions;if(a!==null)for(var s=0;s<a.length;s++){var o=a[s],u=e,f=t,v=f;e:for(;v!==null;){switch(v.tag){case 27:if(Ia(v.type)){We=v.stateNode,Bt=!1;break e}break;case 5:We=v.stateNode,Bt=!1;break e;case 3:case 4:We=v.stateNode.containerInfo,Bt=!0;break e}v=v.return}if(We===null)throw Error(l(160));am(u,f,o),We=null,Bt=!1,u=o.alternate,u!==null&&(u.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)sm(t,e),t=t.sibling}var Sn=null;function sm(e,t){var a=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Ht(t,e),qt(e),s&4&&(Ua(3,e,e.return),Ts(3,e),Ua(5,e,e.return));break;case 1:Ht(t,e),qt(e),s&512&&(gt||a===null||zn(a,a.return)),s&64&&sa&&(e=e.updateQueue,e!==null&&(s=e.callbacks,s!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?s:a.concat(s))));break;case 26:var o=Sn;if(Ht(t,e),qt(e),s&512&&(gt||a===null||zn(a,a.return)),s&4){var u=a!==null?a.memoizedState:null;if(s=e.memoizedState,a===null)if(s===null)if(e.stateNode===null){e:{s=e.type,a=e.memoizedProps,o=o.ownerDocument||o;t:switch(s){case"title":u=o.getElementsByTagName("title")[0],(!u||u[_a]||u[tt]||u.namespaceURI==="http://www.w3.org/2000/svg"||u.hasAttribute("itemprop"))&&(u=o.createElement(s),o.head.insertBefore(u,o.querySelector("head > title"))),xt(u,s,a),u[tt]=e,dt(u),s=u;break e;case"link":var f=sg("link","href",o).get(s+(a.href||""));if(f){for(var v=0;v<f.length;v++)if(u=f[v],u.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&u.getAttribute("rel")===(a.rel==null?null:a.rel)&&u.getAttribute("title")===(a.title==null?null:a.title)&&u.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){f.splice(v,1);break t}}u=o.createElement(s),xt(u,s,a),o.head.appendChild(u);break;case"meta":if(f=sg("meta","content",o).get(s+(a.content||""))){for(v=0;v<f.length;v++)if(u=f[v],u.getAttribute("content")===(a.content==null?null:""+a.content)&&u.getAttribute("name")===(a.name==null?null:a.name)&&u.getAttribute("property")===(a.property==null?null:a.property)&&u.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&u.getAttribute("charset")===(a.charSet==null?null:a.charSet)){f.splice(v,1);break t}}u=o.createElement(s),xt(u,s,a),o.head.appendChild(u);break;default:throw Error(l(468,s))}u[tt]=e,dt(u),s=u}e.stateNode=s}else lg(o,e.type,e.stateNode);else e.stateNode=rg(o,s,e.memoizedProps);else u!==s?(u===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):u.count--,s===null?lg(o,e.type,e.stateNode):rg(o,s,e.memoizedProps)):s===null&&e.stateNode!==null&&fu(e,e.memoizedProps,a.memoizedProps)}break;case 27:Ht(t,e),qt(e),s&512&&(gt||a===null||zn(a,a.return)),a!==null&&s&4&&fu(e,e.memoizedProps,a.memoizedProps);break;case 5:if(Ht(t,e),qt(e),s&512&&(gt||a===null||zn(a,a.return)),e.flags&32){o=e.stateNode;try{ka(o,"")}catch(F){Ue(e,e.return,F)}}s&4&&e.stateNode!=null&&(o=e.memoizedProps,fu(e,o,a!==null?a.memoizedProps:o)),s&1024&&(pu=!0);break;case 6:if(Ht(t,e),qt(e),s&4){if(e.stateNode===null)throw Error(l(162));s=e.memoizedProps,a=e.stateNode;try{a.nodeValue=s}catch(F){Ue(e,e.return,F)}}break;case 3:if(bo=null,o=Sn,Sn=yo(t.containerInfo),Ht(t,e),Sn=o,qt(e),s&4&&a!==null&&a.memoizedState.isDehydrated)try{yr(t.containerInfo)}catch(F){Ue(e,e.return,F)}pu&&(pu=!1,lm(e));break;case 4:s=Sn,Sn=yo(e.stateNode.containerInfo),Ht(t,e),qt(e),Sn=s;break;case 12:Ht(t,e),qt(e);break;case 31:Ht(t,e),qt(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,no(e,s)));break;case 13:Ht(t,e),qt(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(io=Ie()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,no(e,s)));break;case 22:o=e.memoizedState!==null;var _=a!==null&&a.memoizedState!==null,j=sa,U=gt;if(sa=j||o,gt=U||_,Ht(t,e),gt=U,sa=j,qt(e),s&8192)e:for(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,o&&(a===null||_||sa||gt||bi(e)),a=null,t=e;;){if(t.tag===5||t.tag===26){if(a===null){_=a=t;try{if(u=_.stateNode,o)f=u.style,typeof f.setProperty=="function"?f.setProperty("display","none","important"):f.display="none";else{v=_.stateNode;var q=_.memoizedProps.style,N=q!=null&&q.hasOwnProperty("display")?q.display:null;v.style.display=N==null||typeof N=="boolean"?"":(""+N).trim()}}catch(F){Ue(_,_.return,F)}}}else if(t.tag===6){if(a===null){_=t;try{_.stateNode.nodeValue=o?"":_.memoizedProps}catch(F){Ue(_,_.return,F)}}}else if(t.tag===18){if(a===null){_=t;try{var L=_.stateNode;o?Wm(L,!0):Wm(_.stateNode,!1)}catch(F){Ue(_,_.return,F)}}}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;a===t&&(a=null),t=t.return}a===t&&(a=null),t.sibling.return=t.return,t=t.sibling}s&4&&(s=e.updateQueue,s!==null&&(a=s.retryQueue,a!==null&&(s.retryQueue=null,no(e,a))));break;case 19:Ht(t,e),qt(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,no(e,s)));break;case 30:break;case 21:break;default:Ht(t,e),qt(e)}}function qt(e){var t=e.flags;if(t&2){try{for(var a,s=e.return;s!==null;){if(Zf(s)){a=s;break}s=s.return}if(a==null)throw Error(l(160));switch(a.tag){case 27:var o=a.stateNode,u=mu(e);to(e,u,o);break;case 5:var f=a.stateNode;a.flags&32&&(ka(f,""),a.flags&=-33);var v=mu(e);to(e,v,f);break;case 3:case 4:var _=a.stateNode.containerInfo,j=mu(e);gu(e,j,_);break;default:throw Error(l(161))}}catch(U){Ue(e,e.return,U)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function lm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;lm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function oa(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)tm(e,t.alternate,t),t=t.sibling}function bi(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),bi(t);break;case 1:zn(t,t.return);var a=t.stateNode;typeof a.componentWillUnmount=="function"&&Wf(t,t.return,a),bi(t);break;case 27:Ls(t.stateNode);case 26:case 5:zn(t,t.return),bi(t);break;case 22:t.memoizedState===null&&bi(t);break;case 30:bi(t);break;default:bi(t)}e=e.sibling}}function ca(e,t,a){for(a=a&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var s=t.alternate,o=e,u=t,f=u.flags;switch(u.tag){case 0:case 11:case 15:ca(o,u,a),Ts(4,u);break;case 1:if(ca(o,u,a),s=u,o=s.stateNode,typeof o.componentDidMount=="function")try{o.componentDidMount()}catch(j){Ue(s,s.return,j)}if(s=u,o=s.updateQueue,o!==null){var v=s.stateNode;try{var _=o.shared.hiddenCallbacks;if(_!==null)for(o.shared.hiddenCallbacks=null,o=0;o<_.length;o++)zh(_[o],v)}catch(j){Ue(s,s.return,j)}}a&&f&64&&Xf(u),ks(u,u.return);break;case 27:Ff(u);case 26:case 5:ca(o,u,a),a&&s===null&&f&4&&Qf(u),ks(u,u.return);break;case 12:ca(o,u,a);break;case 31:ca(o,u,a),a&&f&4&&im(o,u);break;case 13:ca(o,u,a),a&&f&4&&rm(o,u);break;case 22:u.memoizedState===null&&ca(o,u,a),ks(u,u.return);break;case 30:break;default:ca(o,u,a)}t=t.sibling}}function yu(e,t){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&us(a))}function vu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&us(e))}function wn(e,t,a,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)om(e,t,a,s),t=t.sibling}function om(e,t,a,s){var o=t.flags;switch(t.tag){case 0:case 11:case 15:wn(e,t,a,s),o&2048&&Ts(9,t);break;case 1:wn(e,t,a,s);break;case 3:wn(e,t,a,s),o&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&us(e)));break;case 12:if(o&2048){wn(e,t,a,s),e=t.stateNode;try{var u=t.memoizedProps,f=u.id,v=u.onPostCommit;typeof v=="function"&&v(f,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(_){Ue(t,t.return,_)}}else wn(e,t,a,s);break;case 31:wn(e,t,a,s);break;case 13:wn(e,t,a,s);break;case 23:break;case 22:u=t.stateNode,f=t.alternate,t.memoizedState!==null?u._visibility&2?wn(e,t,a,s):Es(e,t):u._visibility&2?wn(e,t,a,s):(u._visibility|=2,sr(e,t,a,s,(t.subtreeFlags&10256)!==0||!1)),o&2048&&yu(f,t);break;case 24:wn(e,t,a,s),o&2048&&vu(t.alternate,t);break;default:wn(e,t,a,s)}}function sr(e,t,a,s,o){for(o=o&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var u=e,f=t,v=a,_=s,j=f.flags;switch(f.tag){case 0:case 11:case 15:sr(u,f,v,_,o),Ts(8,f);break;case 23:break;case 22:var U=f.stateNode;f.memoizedState!==null?U._visibility&2?sr(u,f,v,_,o):Es(u,f):(U._visibility|=2,sr(u,f,v,_,o)),o&&j&2048&&yu(f.alternate,f);break;case 24:sr(u,f,v,_,o),o&&j&2048&&vu(f.alternate,f);break;default:sr(u,f,v,_,o)}t=t.sibling}}function Es(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var a=e,s=t,o=s.flags;switch(s.tag){case 22:Es(a,s),o&2048&&yu(s.alternate,s);break;case 24:Es(a,s),o&2048&&vu(s.alternate,s);break;default:Es(a,s)}t=t.sibling}}var As=8192;function lr(e,t,a){if(e.subtreeFlags&As)for(e=e.child;e!==null;)cm(e,t,a),e=e.sibling}function cm(e,t,a){switch(e.tag){case 26:lr(e,t,a),e.flags&As&&e.memoizedState!==null&&Wv(a,Sn,e.memoizedState,e.memoizedProps);break;case 5:lr(e,t,a);break;case 3:case 4:var s=Sn;Sn=yo(e.stateNode.containerInfo),lr(e,t,a),Sn=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=As,As=16777216,lr(e,t,a),As=s):lr(e,t,a));break;default:lr(e,t,a)}}function um(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 xs(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var s=t[a];wt=s,hm(s,e)}um(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)dm(e),e=e.sibling}function dm(e){switch(e.tag){case 0:case 11:case 15:xs(e),e.flags&2048&&Ua(9,e,e.return);break;case 3:xs(e);break;case 12:xs(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,ao(e)):xs(e);break;default:xs(e)}}function ao(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var s=t[a];wt=s,hm(s,e)}um(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ua(8,t,t.return),ao(t);break;case 22:a=t.stateNode,a._visibility&2&&(a._visibility&=-3,ao(t));break;default:ao(t)}e=e.sibling}}function hm(e,t){for(;wt!==null;){var a=wt;switch(a.tag){case 0:case 11:case 15:Ua(8,a,t);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var s=a.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:us(a.memoizedState.cache)}if(s=a.child,s!==null)s.return=a,wt=s;else e:for(a=e;wt!==null;){s=wt;var o=s.sibling,u=s.return;if(nm(s),s===a){wt=null;break e}if(o!==null){o.return=u,wt=o;break e}wt=u}}}var dv={getCacheForType:function(e){var t=Et(ht),a=t.data.get(e);return a===void 0&&(a=e(),t.data.set(e,a)),a},cacheSignal:function(){return Et(ht).controller.signal}},hv=typeof WeakMap=="function"?WeakMap:Map,Ne=0,Pe=null,we=null,Te=0,Me=0,Zt=null,za=!1,or=!1,bu=!1,ua=0,rt=0,Ba=0,Si=0,Su=0,Ft=0,cr=0,Cs=null,$t=null,wu=!1,io=0,fm=0,ro=1/0,so=null,Ha=null,yt=0,qa=null,ur=null,da=0,_u=0,Tu=null,mm=null,Os=0,ku=null;function en(){return(Ne&2)!==0&&Te!==0?Te&-Te:D.T!==null?Ru():Mi()}function gm(){if(Ft===0)if((Te&536870912)===0||Ae){var e=De;De<<=1,(De&3932160)===0&&(De=262144),Ft=e}else Ft=536870912;return e=Wt.current,e!==null&&(e.flags|=32),Ft}function Pt(e,t,a){(e===Pe&&(Me===2||Me===9)||e.cancelPendingCommit!==null)&&(dr(e,0),$a(e,Te,Ft,!1)),se(e,a),((Ne&2)===0||e!==Pe)&&(e===Pe&&((Ne&2)===0&&(Si|=a),rt===4&&$a(e,Te,Ft,!1)),Bn(e))}function pm(e,t,a){if((Ne&6)!==0)throw Error(l(327));var s=!a&&(t&127)===0&&(t&e.expiredLanes)===0||Sa(e,t),o=s?gv(e,t):Au(e,t,!0),u=s;do{if(o===0){or&&!s&&$a(e,t,0,!1);break}else{if(a=e.current.alternate,u&&!fv(a)){o=Au(e,t,!1),u=!1;continue}if(o===2){if(u=t,e.errorRecoveryDisabledLanes&u)var f=0;else f=e.pendingLanes&-536870913,f=f!==0?f:f&536870912?536870912:0;if(f!==0){t=f;e:{var v=e;o=Cs;var _=v.current.memoizedState.isDehydrated;if(_&&(dr(v,f).flags|=256),f=Au(v,f,!1),f!==2){if(bu&&!_){v.errorRecoveryDisabledLanes|=u,Si|=u,o=4;break e}u=$t,$t=o,u!==null&&($t===null?$t=u:$t.push.apply($t,u))}o=f}if(u=!1,o!==2)continue}}if(o===1){dr(e,0),$a(e,t,0,!0);break}e:{switch(s=e,u=o,u){case 0:case 1:throw Error(l(345));case 4:if((t&4194048)!==t)break;case 6:$a(s,t,Ft,!za);break e;case 2:$t=null;break;case 3:case 5:break;default:throw Error(l(329))}if((t&62914560)===t&&(o=io+300-Ie(),10<o)){if($a(s,t,Ft,!za),Vn(s,0,!0)!==0)break e;da=t,s.timeoutHandle=Ym(ym.bind(null,s,a,$t,so,wu,t,Ft,Si,cr,za,u,"Throttled",-0,0),o);break e}ym(s,a,$t,so,wu,t,Ft,Si,cr,za,u,null,-0,0)}}break}while(!0);Bn(e)}function ym(e,t,a,s,o,u,f,v,_,j,U,q,N,L){if(e.timeoutHandle=-1,q=t.subtreeFlags,q&8192||(q&16785408)===16785408){q={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:vn},cm(t,u,q);var F=(u&62914560)===u?io-Ie():(u&4194048)===u?fm-Ie():0;if(F=Qv(q,F),F!==null){da=u,e.cancelPendingCommit=F(Em.bind(null,e,t,u,a,s,o,f,v,_,U,q,null,N,L)),$a(e,u,f,!j);return}}Em(e,t,u,a,s,o,f,v,_)}function fv(e){for(var t=e;;){var a=t.tag;if((a===0||a===11||a===15)&&t.flags&16384&&(a=t.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var s=0;s<a.length;s++){var o=a[s],u=o.getSnapshot;o=o.value;try{if(!Jt(u(),o))return!1}catch{return!1}}if(a=t.child,t.subtreeFlags&16384&&a!==null)a.return=t,t=a;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 $a(e,t,a,s){t&=~Su,t&=~Si,e.suspendedLanes|=t,e.pingedLanes&=~t,s&&(e.warmLanes|=t),s=e.expirationTimes;for(var o=t;0<o;){var u=31-Ot(o),f=1<<u;s[u]=-1,o&=~f}a!==0&&yl(e,a,t)}function lo(){return(Ne&6)===0?(Rs(0),!1):!0}function Eu(){if(we!==null){if(Me===0)var e=we.return;else e=we,ea=di=null,$c(e),tr=null,hs=0,e=we;for(;e!==null;)Jf(e.alternate,e),e=e.return;we=null}}function dr(e,t){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,Lv(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),da=0,Eu(),Pe=e,we=a=Zn(e.current,null),Te=t,Me=0,Zt=null,za=!1,or=Sa(e,t),bu=!1,cr=Ft=Su=Si=Ba=rt=0,$t=Cs=null,wu=!1,(t&8)!==0&&(t|=t&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=t;0<s;){var o=31-Ot(s),u=1<<o;t|=e[o],s&=~u}return ua=t,Cl(),a}function vm(e,t){ve=null,D.H=Ss,t===er||t===Ul?(t=Lh(),Me=3):t===Oc?(t=Lh(),Me=4):Me=t===au?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Zt=t,we===null&&(rt=1,Wl(e,ln(t,e.current)))}function bm(){var e=Wt.current;return e===null?!0:(Te&4194048)===Te?dn===null:(Te&62914560)===Te||(Te&536870912)!==0?e===dn:!1}function Sm(){var e=D.H;return D.H=Ss,e===null?Ss:e}function wm(){var e=D.A;return D.A=dv,e}function oo(){rt=4,za||(Te&4194048)!==Te&&Wt.current!==null||(or=!0),(Ba&134217727)===0&&(Si&134217727)===0||Pe===null||$a(Pe,Te,Ft,!1)}function Au(e,t,a){var s=Ne;Ne|=2;var o=Sm(),u=wm();(Pe!==e||Te!==t)&&(so=null,dr(e,t)),t=!1;var f=rt;e:do try{if(Me!==0&&we!==null){var v=we,_=Zt;switch(Me){case 8:Eu(),f=6;break e;case 3:case 2:case 9:case 6:Wt.current===null&&(t=!0);var j=Me;if(Me=0,Zt=null,hr(e,v,_,j),a&&or){f=0;break e}break;default:j=Me,Me=0,Zt=null,hr(e,v,_,j)}}mv(),f=rt;break}catch(U){vm(e,U)}while(!0);return t&&e.shellSuspendCounter++,ea=di=null,Ne=s,D.H=o,D.A=u,we===null&&(Pe=null,Te=0,Cl()),f}function mv(){for(;we!==null;)_m(we)}function gv(e,t){var a=Ne;Ne|=2;var s=Sm(),o=wm();Pe!==e||Te!==t?(so=null,ro=Ie()+500,dr(e,t)):or=Sa(e,t);e:do try{if(Me!==0&&we!==null){t=we;var u=Zt;t:switch(Me){case 1:Me=0,Zt=null,hr(e,t,u,1);break;case 2:case 9:if(jh(u)){Me=0,Zt=null,Tm(t);break}t=function(){Me!==2&&Me!==9||Pe!==e||(Me=7),Bn(e)},u.then(t,t);break e;case 3:Me=7;break e;case 4:Me=5;break e;case 7:jh(u)?(Me=0,Zt=null,Tm(t)):(Me=0,Zt=null,hr(e,t,u,7));break;case 5:var f=null;switch(we.tag){case 26:f=we.memoizedState;case 5:case 27:var v=we;if(f?og(f):v.stateNode.complete){Me=0,Zt=null;var _=v.sibling;if(_!==null)we=_;else{var j=v.return;j!==null?(we=j,co(j)):we=null}break t}}Me=0,Zt=null,hr(e,t,u,5);break;case 6:Me=0,Zt=null,hr(e,t,u,6);break;case 8:Eu(),rt=6;break e;default:throw Error(l(462))}}pv();break}catch(U){vm(e,U)}while(!0);return ea=di=null,D.H=s,D.A=o,Ne=a,we!==null?0:(Pe=null,Te=0,Cl(),rt)}function pv(){for(;we!==null&&!Br();)_m(we)}function _m(e){var t=Kf(e.alternate,e,ua);e.memoizedProps=e.pendingProps,t===null?co(e):we=t}function Tm(e){var t=e,a=t.alternate;switch(t.tag){case 15:case 0:t=qf(a,t,t.pendingProps,t.type,void 0,Te);break;case 11:t=qf(a,t,t.pendingProps,t.type.render,t.ref,Te);break;case 5:$c(t);default:Jf(a,t),t=we=Sh(t,ua),t=Kf(a,t,ua)}e.memoizedProps=e.pendingProps,t===null?co(e):we=t}function hr(e,t,a,s){ea=di=null,$c(t),tr=null,hs=0;var o=t.return;try{if(iv(e,o,t,a,Te)){rt=1,Wl(e,ln(a,e.current)),we=null;return}}catch(u){if(o!==null)throw we=o,u;rt=1,Wl(e,ln(a,e.current)),we=null;return}t.flags&32768?(Ae||s===1?e=!0:or||(Te&536870912)!==0?e=!1:(za=e=!0,(s===2||s===9||s===3||s===6)&&(s=Wt.current,s!==null&&s.tag===13&&(s.flags|=16384))),km(t,e)):co(t)}function co(e){var t=e;do{if((t.flags&32768)!==0){km(t,za);return}e=t.return;var a=lv(t.alternate,t,ua);if(a!==null){we=a;return}if(t=t.sibling,t!==null){we=t;return}we=t=e}while(t!==null);rt===0&&(rt=5)}function km(e,t){do{var a=ov(e.alternate,e);if(a!==null){a.flags&=32767,we=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!t&&(e=e.sibling,e!==null)){we=e;return}we=e=a}while(e!==null);rt=6,we=null}function Em(e,t,a,s,o,u,f,v,_){e.cancelPendingCommit=null;do uo();while(yt!==0);if((Ne&6)!==0)throw Error(l(327));if(t!==null){if(t===e.current)throw Error(l(177));if(u=t.lanes|t.childLanes,u|=mc,an(e,a,u,f,v,_),e===Pe&&(we=Pe=null,Te=0),ur=t,qa=e,da=a,_u=u,Tu=o,mm=s,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Sv(Ni,function(){return Rm(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||s){s=D.T,D.T=null,o=V.p,V.p=2,f=Ne,Ne|=4;try{cv(e,t,a)}finally{Ne=f,V.p=o,D.T=s}}yt=1,Am(),xm(),Cm()}}function Am(){if(yt===1){yt=0;var e=qa,t=ur,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=D.T,D.T=null;var s=V.p;V.p=2;var o=Ne;Ne|=4;try{sm(t,e);var u=Bu,f=dh(e.containerInfo),v=u.focusedElem,_=u.selectionRange;if(f!==v&&v&&v.ownerDocument&&uh(v.ownerDocument.documentElement,v)){if(_!==null&&cc(v)){var j=_.start,U=_.end;if(U===void 0&&(U=j),"selectionStart"in v)v.selectionStart=j,v.selectionEnd=Math.min(U,v.value.length);else{var q=v.ownerDocument||document,N=q&&q.defaultView||window;if(N.getSelection){var L=N.getSelection(),F=v.textContent.length,de=Math.min(_.start,F),qe=_.end===void 0?de:Math.min(_.end,F);!L.extend&&de>qe&&(f=qe,qe=de,de=f);var x=ch(v,de),k=ch(v,qe);if(x&&k&&(L.rangeCount!==1||L.anchorNode!==x.node||L.anchorOffset!==x.offset||L.focusNode!==k.node||L.focusOffset!==k.offset)){var R=q.createRange();R.setStart(x.node,x.offset),L.removeAllRanges(),de>qe?(L.addRange(R),L.extend(k.node,k.offset)):(R.setEnd(k.node,k.offset),L.addRange(R))}}}}for(q=[],L=v;L=L.parentNode;)L.nodeType===1&&q.push({element:L,left:L.scrollLeft,top:L.scrollTop});for(typeof v.focus=="function"&&v.focus(),v=0;v<q.length;v++){var B=q[v];B.element.scrollLeft=B.left,B.element.scrollTop=B.top}}To=!!zu,Bu=zu=null}finally{Ne=o,V.p=s,D.T=a}}e.current=t,yt=2}}function xm(){if(yt===2){yt=0;var e=qa,t=ur,a=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||a){a=D.T,D.T=null;var s=V.p;V.p=2;var o=Ne;Ne|=4;try{tm(e,t.alternate,t)}finally{Ne=o,V.p=s,D.T=a}}yt=3}}function Cm(){if(yt===4||yt===3){yt=0,ji();var e=qa,t=ur,a=da,s=mm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?yt=5:(yt=0,ur=qa=null,Om(e,e.pendingLanes));var o=e.pendingLanes;if(o===0&&(Ha=null),jn(a),t=t.stateNode,vt&&typeof vt.onCommitFiberRoot=="function")try{vt.onCommitFiberRoot(ba,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=D.T,o=V.p,V.p=2,D.T=null;try{for(var u=e.onRecoverableError,f=0;f<s.length;f++){var v=s[f];u(v.value,{componentStack:v.stack})}}finally{D.T=t,V.p=o}}(da&3)!==0&&uo(),Bn(e),o=e.pendingLanes,(a&261930)!==0&&(o&42)!==0?e===ku?Os++:(Os=0,ku=e):Os=0,Rs(0)}}function Om(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,us(t)))}function uo(){return Am(),xm(),Cm(),Rm()}function Rm(){if(yt!==5)return!1;var e=qa,t=_u;_u=0;var a=jn(da),s=D.T,o=V.p;try{V.p=32>a?32:a,D.T=null,a=Tu,Tu=null;var u=qa,f=da;if(yt=0,ur=qa=null,da=0,(Ne&6)!==0)throw Error(l(331));var v=Ne;if(Ne|=4,dm(u.current),om(u,u.current,f,a),Ne=v,Rs(0,!1),vt&&typeof vt.onPostCommitFiberRoot=="function")try{vt.onPostCommitFiberRoot(ba,u)}catch{}return!0}finally{V.p=o,D.T=s,Om(e,t)}}function jm(e,t,a){t=ln(a,t),t=nu(e.stateNode,t,2),e=La(e,t,2),e!==null&&(se(e,2),Bn(e))}function Ue(e,t,a){if(e.tag===3)jm(e,e,a);else for(;t!==null;){if(t.tag===3){jm(t,e,a);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Ha===null||!Ha.has(s))){e=ln(a,e),a=Nf(2),s=La(t,a,2),s!==null&&(Lf(a,s,t,e),se(s,2),Bn(s));break}}t=t.return}}function xu(e,t,a){var s=e.pingCache;if(s===null){s=e.pingCache=new hv;var o=new Set;s.set(t,o)}else o=s.get(t),o===void 0&&(o=new Set,s.set(t,o));o.has(a)||(bu=!0,o.add(a),e=yv.bind(null,e,t,a),t.then(e,e))}function yv(e,t,a){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,Pe===e&&(Te&a)===a&&(rt===4||rt===3&&(Te&62914560)===Te&&300>Ie()-io?(Ne&2)===0&&dr(e,0):Su|=a,cr===Te&&(cr=0)),Bn(e)}function Nm(e,t){t===0&&(t=wa()),e=oi(e,t),e!==null&&(se(e,t),Bn(e))}function vv(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),Nm(e,a)}function bv(e,t){var a=0;switch(e.tag){case 31:case 13:var s=e.stateNode,o=e.memoizedState;o!==null&&(a=o.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(l(314))}s!==null&&s.delete(t),Nm(e,a)}function Sv(e,t){return Gn(e,t)}var ho=null,fr=null,Cu=!1,fo=!1,Ou=!1,Pa=0;function Bn(e){e!==fr&&e.next===null&&(fr===null?ho=fr=e:fr=fr.next=e),fo=!0,Cu||(Cu=!0,_v())}function Rs(e,t){if(!Ou&&fo){Ou=!0;do for(var a=!1,s=ho;s!==null;){if(e!==0){var o=s.pendingLanes;if(o===0)var u=0;else{var f=s.suspendedLanes,v=s.pingedLanes;u=(1<<31-Ot(42|e)+1)-1,u&=o&~(f&~v),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(a=!0,Um(s,u))}else u=Te,u=Vn(s,s===Pe?u:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(u&3)===0||Sa(s,u)||(a=!0,Um(s,u));s=s.next}while(a);Ou=!1}}function wv(){Lm()}function Lm(){fo=Cu=!1;var e=0;Pa!==0&&Nv()&&(e=Pa);for(var t=Ie(),a=null,s=ho;s!==null;){var o=s.next,u=Dm(s,t);u===0?(s.next=null,a===null?ho=o:a.next=o,o===null&&(fr=a)):(a=s,(e!==0||(u&3)!==0)&&(fo=!0)),s=o}yt!==0&&yt!==5||Rs(e),Pa!==0&&(Pa=0)}function Dm(e,t){for(var a=e.suspendedLanes,s=e.pingedLanes,o=e.expirationTimes,u=e.pendingLanes&-62914561;0<u;){var f=31-Ot(u),v=1<<f,_=o[f];_===-1?((v&a)===0||(v&s)!==0)&&(o[f]=Ir(v,t)):_<=t&&(e.expiredLanes|=v),u&=~v}if(t=Pe,a=Te,a=Vn(e,e===t?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,a===0||e===t&&(Me===2||Me===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&Ri(s),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||Sa(e,a)){if(t=a&-a,t===e.callbackPriority)return t;switch(s!==null&&Ri(s),jn(a)){case 2:case 8:a=Cn;break;case 32:a=Ni;break;case 268435456:a=$r;break;default:a=Ni}return s=Mm.bind(null,e),a=Gn(a,s),e.callbackPriority=t,e.callbackNode=a,t}return s!==null&&s!==null&&Ri(s),e.callbackPriority=2,e.callbackNode=null,2}function Mm(e,t){if(yt!==0&&yt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(uo()&&e.callbackNode!==a)return null;var s=Te;return s=Vn(e,e===Pe?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(pm(e,s,t),Dm(e,Ie()),e.callbackNode!=null&&e.callbackNode===a?Mm.bind(null,e):null)}function Um(e,t){if(uo())return null;pm(e,t,!0)}function _v(){Dv(function(){(Ne&6)!==0?Gn(Qa,wv):Lm()})}function Ru(){if(Pa===0){var e=Zi;e===0&&(e=On,On<<=1,(On&261888)===0&&(On=256)),Pa=e}return Pa}function zm(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:ri(""+e)}function Bm(e,t){var a=t.ownerDocument.createElement("input");return a.name=t.name,a.value=t.value,e.id&&a.setAttribute("form",e.id),t.parentNode.insertBefore(a,t),e=new FormData(e),a.parentNode.removeChild(a),e}function Tv(e,t,a,s,o){if(t==="submit"&&a&&a.stateNode===o){var u=zm((o[Tt]||null).action),f=s.submitter;f&&(t=(t=f[Tt]||null)?zm(t.formAction):f.getAttribute("formAction"),t!==null&&(u=t,f=null));var v=new Aa("action","action",null,s,o);e.push({event:v,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(Pa!==0){var _=f?Bm(o,f):new FormData(o);Wc(a,{pending:!0,data:_,method:o.method,action:u},null,_)}}else typeof u=="function"&&(v.preventDefault(),_=f?Bm(o,f):new FormData(o),Wc(a,{pending:!0,data:_,method:o.method,action:u},u,_))},currentTarget:o}]})}}for(var ju=0;ju<fc.length;ju++){var Nu=fc[ju],kv=Nu.toLowerCase(),Ev=Nu[0].toUpperCase()+Nu.slice(1);bn(kv,"on"+Ev)}bn(mh,"onAnimationEnd"),bn(gh,"onAnimationIteration"),bn(ph,"onAnimationStart"),bn("dblclick","onDoubleClick"),bn("focusin","onFocus"),bn("focusout","onBlur"),bn($y,"onTransitionRun"),bn(Py,"onTransitionStart"),bn(Iy,"onTransitionCancel"),bn(yh,"onTransitionEnd"),Qn("onMouseEnter",["mouseout","mouseover"]),Qn("onMouseLeave",["mouseout","mouseover"]),Qn("onPointerEnter",["pointerout","pointerover"]),Qn("onPointerLeave",["pointerout","pointerover"]),Ln("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ln("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ln("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ln("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ln("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ln("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var js="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(" "),Av=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(js));function Hm(e,t){t=(t&4)!==0;for(var a=0;a<e.length;a++){var s=e[a],o=s.event;s=s.listeners;e:{var u=void 0;if(t)for(var f=s.length-1;0<=f;f--){var v=s[f],_=v.instance,j=v.currentTarget;if(v=v.listener,_!==u&&o.isPropagationStopped())break e;u=v,o.currentTarget=j;try{u(o)}catch(U){xl(U)}o.currentTarget=null,u=_}else for(f=0;f<s.length;f++){if(v=s[f],_=v.instance,j=v.currentTarget,v=v.listener,_!==u&&o.isPropagationStopped())break e;u=v,o.currentTarget=j;try{u(o)}catch(U){xl(U)}o.currentTarget=null,u=_}}}}function _e(e,t){var a=t[Vr];a===void 0&&(a=t[Vr]=new Set);var s=e+"__bubble";a.has(s)||(qm(t,e,2,!1),a.add(s))}function Lu(e,t,a){var s=0;t&&(s|=4),qm(a,e,s,t)}var mo="_reactListening"+Math.random().toString(36).slice(2);function Du(e){if(!e[mo]){e[mo]=!0,Fa.forEach(function(a){a!=="selectionchange"&&(Av.has(a)||Lu(a,!1,e),Lu(a,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[mo]||(t[mo]=!0,Lu("selectionchange",!1,t))}}function qm(e,t,a,s){switch(gg(t)){case 2:var o=e0;break;case 8:o=t0;break;default:o=Xu}a=o.bind(null,t,a,e),o=void 0,!X||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(o=!0),s?o!==void 0?e.addEventListener(t,a,{capture:!0,passive:o}):e.addEventListener(t,a,!0):o!==void 0?e.addEventListener(t,a,{passive:o}):e.addEventListener(t,a,!1)}function Mu(e,t,a,s,o){var u=s;if((t&1)===0&&(t&2)===0&&s!==null)e:for(;;){if(s===null)return;var f=s.tag;if(f===3||f===4){var v=s.stateNode.containerInfo;if(v===o)break;if(f===4)for(f=s.return;f!==null;){var _=f.tag;if((_===3||_===4)&&f.stateNode.containerInfo===o)return;f=f.return}for(;v!==null;){if(f=Kn(v),f===null)return;if(_=f.tag,_===5||_===6||_===26||_===27){s=u=f;continue e}v=v.parentNode}}s=s.return}w(function(){var j=u,U=Fr(a),q=[];e:{var N=vh.get(e);if(N!==void 0){var L=Aa,F=e;switch(e){case"keypress":if(at(a)===0)break e;case"keydown":case"keyup":L=by;break;case"focusin":F="focus",L=ic;break;case"focusout":F="blur",L=ic;break;case"beforeblur":case"afterblur":L=ic;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":L=Yd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":L=ly;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":L=_y;break;case mh:case gh:case ph:L=uy;break;case yh:L=ky;break;case"scroll":case"scrollend":L=ry;break;case"wheel":L=Ay;break;case"copy":case"cut":case"paste":L=hy;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":L=Xd;break;case"toggle":case"beforetoggle":L=Cy}var de=(t&4)!==0,qe=!de&&(e==="scroll"||e==="scrollend"),x=de?N!==null?N+"Capture":null:N;de=[];for(var k=j,R;k!==null;){var B=k;if(R=B.stateNode,B=B.tag,B!==5&&B!==26&&B!==27||R===null||x===null||(B=P(k,x),B!=null&&de.push(Ns(k,B,R))),qe)break;k=k.return}0<de.length&&(N=new L(N,F,null,a,U),q.push({event:N,listeners:de}))}}if((t&7)===0){e:{if(N=e==="mouseover"||e==="pointerover",L=e==="mouseout"||e==="pointerout",N&&a!==Zr&&(F=a.relatedTarget||a.fromElement)&&(Kn(F)||F[Yt]))break e;if((L||N)&&(N=U.window===U?U:(N=U.ownerDocument)?N.defaultView||N.parentWindow:window,L?(F=a.relatedTarget||a.toElement,L=j,F=F?Kn(F):null,F!==null&&(qe=d(F),de=F.tag,F!==qe||de!==5&&de!==27&&de!==6)&&(F=null)):(L=null,F=j),L!==F)){if(de=Yd,B="onMouseLeave",x="onMouseEnter",k="mouse",(e==="pointerout"||e==="pointerover")&&(de=Xd,B="onPointerLeave",x="onPointerEnter",k="pointer"),qe=L==null?N:Jn(L),R=F==null?N:Jn(F),N=new de(B,k+"leave",L,a,U),N.target=qe,N.relatedTarget=R,B=null,Kn(U)===j&&(de=new de(x,k+"enter",F,a,U),de.target=R,de.relatedTarget=qe,B=de),qe=B,L&&F)t:{for(de=xv,x=L,k=F,R=0,B=x;B;B=de(B))R++;B=0;for(var oe=k;oe;oe=de(oe))B++;for(;0<R-B;)x=de(x),R--;for(;0<B-R;)k=de(k),B--;for(;R--;){if(x===k||k!==null&&x===k.alternate){de=x;break t}x=de(x),k=de(k)}de=null}else de=null;L!==null&&$m(q,N,L,de,!1),F!==null&&qe!==null&&$m(q,qe,F,de,!0)}}e:{if(N=j?Jn(j):window,L=N.nodeName&&N.nodeName.toLowerCase(),L==="select"||L==="input"&&N.type==="file")var Re=ah;else if(th(N))if(ih)Re=By;else{Re=Uy;var re=My}else L=N.nodeName,!L||L.toLowerCase()!=="input"||N.type!=="checkbox"&&N.type!=="radio"?j&&qi(j.elementType)&&(Re=ah):Re=zy;if(Re&&(Re=Re(e,j))){nh(q,Re,a,U);break e}re&&re(e,N,j),e==="focusout"&&j&&N.type==="number"&&j.memoizedProps.value!=null&&Qr(N,"number",N.value)}switch(re=j?Jn(j):window,e){case"focusin":(th(re)||re.contentEditable==="true")&&(Gi=re,uc=j,ls=null);break;case"focusout":ls=uc=Gi=null;break;case"mousedown":dc=!0;break;case"contextmenu":case"mouseup":case"dragend":dc=!1,hh(q,a,U);break;case"selectionchange":if(qy)break;case"keydown":case"keyup":hh(q,a,U)}var be;if(sc)e:{switch(e){case"compositionstart":var ke="onCompositionStart";break e;case"compositionend":ke="onCompositionEnd";break e;case"compositionupdate":ke="onCompositionUpdate";break e}ke=void 0}else Ii?Fd(e,a)&&(ke="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(ke="onCompositionStart");ke&&(Wd&&a.locale!=="ko"&&(Ii||ke!=="onCompositionStart"?ke==="onCompositionEnd"&&Ii&&(be=Le()):(ae=U,fe="value"in ae?ae.value:ae.textContent,Ii=!0)),re=go(j,ke),0<re.length&&(ke=new Jd(ke,e,null,a,U),q.push({event:ke,listeners:re}),be?ke.data=be:(be=eh(a),be!==null&&(ke.data=be)))),(be=Ry?jy(e,a):Ny(e,a))&&(ke=go(j,"onBeforeInput"),0<ke.length&&(re=new Jd("onBeforeInput","beforeinput",null,a,U),q.push({event:re,listeners:ke}),re.data=be)),Tv(q,e,j,a,U)}Hm(q,t)})}function Ns(e,t,a){return{instance:e,listener:t,currentTarget:a}}function go(e,t){for(var a=t+"Capture",s=[];e!==null;){var o=e,u=o.stateNode;if(o=o.tag,o!==5&&o!==26&&o!==27||u===null||(o=P(e,a),o!=null&&s.unshift(Ns(e,o,u)),o=P(e,t),o!=null&&s.push(Ns(e,o,u))),e.tag===3)return s;e=e.return}return[]}function xv(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function $m(e,t,a,s,o){for(var u=t._reactName,f=[];a!==null&&a!==s;){var v=a,_=v.alternate,j=v.stateNode;if(v=v.tag,_!==null&&_===s)break;v!==5&&v!==26&&v!==27||j===null||(_=j,o?(j=P(a,u),j!=null&&f.unshift(Ns(a,j,_))):o||(j=P(a,u),j!=null&&f.push(Ns(a,j,_)))),a=a.return}f.length!==0&&e.push({event:t,listeners:f})}var Cv=/\r\n?/g,Ov=/\u0000|\uFFFD/g;function Pm(e){return(typeof e=="string"?e:""+e).replace(Cv,`
9
+ `).replace(Ov,"")}function Im(e,t){return t=Pm(t),Pm(e)===t}function He(e,t,a,s,o,u){switch(a){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||ka(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&ka(e,""+s);break;case"className":zi(e,"class",s);break;case"tabIndex":zi(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":zi(e,a,s);break;case"style":_l(e,s,u);break;case"data":if(t!=="object"){zi(e,"data",s);break}case"src":case"href":if(s===""&&(t!=="a"||a!=="href")){e.removeAttribute(a);break}if(s==null||typeof s=="function"||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(a);break}s=ri(""+s),e.setAttribute(a,s);break;case"action":case"formAction":if(typeof s=="function"){e.setAttribute(a,"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"&&(a==="formAction"?(t!=="input"&&He(e,t,"name",o.name,o,null),He(e,t,"formEncType",o.formEncType,o,null),He(e,t,"formMethod",o.formMethod,o,null),He(e,t,"formTarget",o.formTarget,o,null)):(He(e,t,"encType",o.encType,o,null),He(e,t,"method",o.method,o,null),He(e,t,"target",o.target,o,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(a);break}s=ri(""+s),e.setAttribute(a,s);break;case"onClick":s!=null&&(e.onclick=vn);break;case"onScroll":s!=null&&_e("scroll",e);break;case"onScrollEnd":s!=null&&_e("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(l(61));if(a=s.__html,a!=null){if(o.children!=null)throw Error(l(60));e.innerHTML=a}}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}a=ri(""+s),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);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(a,""+s):e.removeAttribute(a);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(a,""):e.removeAttribute(a);break;case"capture":case"download":s===!0?e.setAttribute(a,""):s!==!1&&s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(a,s):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":s!=null&&typeof s!="function"&&typeof s!="symbol"&&!isNaN(s)&&1<=s?e.setAttribute(a,s):e.removeAttribute(a);break;case"rowSpan":case"start":s==null||typeof s=="function"||typeof s=="symbol"||isNaN(s)?e.removeAttribute(a):e.setAttribute(a,s);break;case"popover":_e("beforetoggle",e),_e("toggle",e),ni(e,"popover",s);break;case"xlinkActuate":rn(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":rn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":rn(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":rn(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":rn(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":rn(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":rn(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":rn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":rn(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":ni(e,"is",s);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=$i.get(a)||a,ni(e,a,s))}}function Uu(e,t,a,s,o,u){switch(a){case"style":_l(e,s,u);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(l(61));if(a=s.__html,a!=null){if(o.children!=null)throw Error(l(60));e.innerHTML=a}}break;case"children":typeof s=="string"?ka(e,s):(typeof s=="number"||typeof s=="bigint")&&ka(e,""+s);break;case"onScroll":s!=null&&_e("scroll",e);break;case"onScrollEnd":s!=null&&_e("scrollend",e);break;case"onClick":s!=null&&(e.onclick=vn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Wn.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(o=a.endsWith("Capture"),t=a.slice(2,o?a.length-7:void 0),u=e[Tt]||null,u=u!=null?u[a]:null,typeof u=="function"&&e.removeEventListener(t,u,o),typeof s=="function")){typeof u!="function"&&u!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(t,s,o);break e}a in e?e[a]=s:s===!0?e.setAttribute(a,""):ni(e,a,s)}}}function xt(e,t,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":_e("error",e),_e("load",e);var s=!1,o=!1,u;for(u in a)if(a.hasOwnProperty(u)){var f=a[u];if(f!=null)switch(u){case"src":s=!0;break;case"srcSet":o=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(l(137,t));default:He(e,t,u,f,a,null)}}o&&He(e,t,"srcSet",a.srcSet,a,null),s&&He(e,t,"src",a.src,a,null);return;case"input":_e("invalid",e);var v=u=f=o=null,_=null,j=null;for(s in a)if(a.hasOwnProperty(s)){var U=a[s];if(U!=null)switch(s){case"name":o=U;break;case"type":f=U;break;case"checked":_=U;break;case"defaultChecked":j=U;break;case"value":u=U;break;case"defaultValue":v=U;break;case"children":case"dangerouslySetInnerHTML":if(U!=null)throw Error(l(137,t));break;default:He(e,t,s,U,a,null)}}Sl(e,u,v,_,j,f,o,!1);return;case"select":_e("invalid",e),s=f=u=null;for(o in a)if(a.hasOwnProperty(o)&&(v=a[o],v!=null))switch(o){case"value":u=v;break;case"defaultValue":f=v;break;case"multiple":s=v;default:He(e,t,o,v,a,null)}t=u,a=f,e.multiple=!!s,t!=null?nt(e,!!s,t,!1):a!=null&&nt(e,!!s,a,!0);return;case"textarea":_e("invalid",e),u=o=s=null;for(f in a)if(a.hasOwnProperty(f)&&(v=a[f],v!=null))switch(f){case"value":s=v;break;case"defaultValue":o=v;break;case"children":u=v;break;case"dangerouslySetInnerHTML":if(v!=null)throw Error(l(91));break;default:He(e,t,f,v,a,null)}Hi(e,s,o,u);return;case"option":for(_ in a)a.hasOwnProperty(_)&&(s=a[_],s!=null)&&(_==="selected"?e.selected=s&&typeof s!="function"&&typeof s!="symbol":He(e,t,_,s,a,null));return;case"dialog":_e("beforetoggle",e),_e("toggle",e),_e("cancel",e),_e("close",e);break;case"iframe":case"object":_e("load",e);break;case"video":case"audio":for(s=0;s<js.length;s++)_e(js[s],e);break;case"image":_e("error",e),_e("load",e);break;case"details":_e("toggle",e);break;case"embed":case"source":case"link":_e("error",e),_e("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(j in a)if(a.hasOwnProperty(j)&&(s=a[j],s!=null))switch(j){case"children":case"dangerouslySetInnerHTML":throw Error(l(137,t));default:He(e,t,j,s,a,null)}return;default:if(qi(t)){for(U in a)a.hasOwnProperty(U)&&(s=a[U],s!==void 0&&Uu(e,t,U,s,a,void 0));return}}for(v in a)a.hasOwnProperty(v)&&(s=a[v],s!=null&&He(e,t,v,s,a,null))}function Rv(e,t,a,s){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var o=null,u=null,f=null,v=null,_=null,j=null,U=null;for(L in a){var q=a[L];if(a.hasOwnProperty(L)&&q!=null)switch(L){case"checked":break;case"value":break;case"defaultValue":_=q;default:s.hasOwnProperty(L)||He(e,t,L,null,s,q)}}for(var N in s){var L=s[N];if(q=a[N],s.hasOwnProperty(N)&&(L!=null||q!=null))switch(N){case"type":u=L;break;case"name":o=L;break;case"checked":j=L;break;case"defaultChecked":U=L;break;case"value":f=L;break;case"defaultValue":v=L;break;case"children":case"dangerouslySetInnerHTML":if(L!=null)throw Error(l(137,t));break;default:L!==q&&He(e,t,N,L,s,q)}}Ta(e,f,v,_,j,U,u,o);return;case"select":L=f=v=N=null;for(u in a)if(_=a[u],a.hasOwnProperty(u)&&_!=null)switch(u){case"value":break;case"multiple":L=_;default:s.hasOwnProperty(u)||He(e,t,u,null,s,_)}for(o in s)if(u=s[o],_=a[o],s.hasOwnProperty(o)&&(u!=null||_!=null))switch(o){case"value":N=u;break;case"defaultValue":v=u;break;case"multiple":f=u;default:u!==_&&He(e,t,o,u,s,_)}t=v,a=f,s=L,N!=null?nt(e,!!a,N,!1):!!s!=!!a&&(t!=null?nt(e,!!a,t,!0):nt(e,!!a,a?[]:"",!1));return;case"textarea":L=N=null;for(v in a)if(o=a[v],a.hasOwnProperty(v)&&o!=null&&!s.hasOwnProperty(v))switch(v){case"value":break;case"children":break;default:He(e,t,v,null,s,o)}for(f in s)if(o=s[f],u=a[f],s.hasOwnProperty(f)&&(o!=null||u!=null))switch(f){case"value":N=o;break;case"defaultValue":L=o;break;case"children":break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(l(91));break;default:o!==u&&He(e,t,f,o,s,u)}ai(e,N,L);return;case"option":for(var F in a)N=a[F],a.hasOwnProperty(F)&&N!=null&&!s.hasOwnProperty(F)&&(F==="selected"?e.selected=!1:He(e,t,F,null,s,N));for(_ in s)N=s[_],L=a[_],s.hasOwnProperty(_)&&N!==L&&(N!=null||L!=null)&&(_==="selected"?e.selected=N&&typeof N!="function"&&typeof N!="symbol":He(e,t,_,N,s,L));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 de in a)N=a[de],a.hasOwnProperty(de)&&N!=null&&!s.hasOwnProperty(de)&&He(e,t,de,null,s,N);for(j in s)if(N=s[j],L=a[j],s.hasOwnProperty(j)&&N!==L&&(N!=null||L!=null))switch(j){case"children":case"dangerouslySetInnerHTML":if(N!=null)throw Error(l(137,t));break;default:He(e,t,j,N,s,L)}return;default:if(qi(t)){for(var qe in a)N=a[qe],a.hasOwnProperty(qe)&&N!==void 0&&!s.hasOwnProperty(qe)&&Uu(e,t,qe,void 0,s,N);for(U in s)N=s[U],L=a[U],!s.hasOwnProperty(U)||N===L||N===void 0&&L===void 0||Uu(e,t,U,N,s,L);return}}for(var x in a)N=a[x],a.hasOwnProperty(x)&&N!=null&&!s.hasOwnProperty(x)&&He(e,t,x,null,s,N);for(q in s)N=s[q],L=a[q],!s.hasOwnProperty(q)||N===L||N==null&&L==null||He(e,t,q,N,s,L)}function Gm(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function jv(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,a=performance.getEntriesByType("resource"),s=0;s<a.length;s++){var o=a[s],u=o.transferSize,f=o.initiatorType,v=o.duration;if(u&&v&&Gm(f)){for(f=0,v=o.responseEnd,s+=1;s<a.length;s++){var _=a[s],j=_.startTime;if(j>v)break;var U=_.transferSize,q=_.initiatorType;U&&Gm(q)&&(_=_.responseEnd,f+=U*(_<v?1:(v-j)/(_-j)))}if(--s,t+=8*(u+f)/(o.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 zu=null,Bu=null;function po(e){return e.nodeType===9?e:e.ownerDocument}function Vm(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 Km(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Hu(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var qu=null;function Nv(){var e=window.event;return e&&e.type==="popstate"?e===qu?!1:(qu=e,!0):(qu=null,!1)}var Ym=typeof setTimeout=="function"?setTimeout:void 0,Lv=typeof clearTimeout=="function"?clearTimeout:void 0,Jm=typeof Promise=="function"?Promise:void 0,Dv=typeof queueMicrotask=="function"?queueMicrotask:typeof Jm<"u"?function(e){return Jm.resolve(null).then(e).catch(Mv)}:Ym;function Mv(e){setTimeout(function(){throw e})}function Ia(e){return e==="head"}function Xm(e,t){var a=t,s=0;do{var o=a.nextSibling;if(e.removeChild(a),o&&o.nodeType===8)if(a=o.data,a==="/$"||a==="/&"){if(s===0){e.removeChild(o),yr(t);return}s--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")s++;else if(a==="html")Ls(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,Ls(a);for(var u=a.firstChild;u;){var f=u.nextSibling,v=u.nodeName;u[_a]||v==="SCRIPT"||v==="STYLE"||v==="LINK"&&u.rel.toLowerCase()==="stylesheet"||a.removeChild(u),u=f}}else a==="body"&&Ls(e.ownerDocument.body);a=o}while(a);yr(t)}function Wm(e,t){var a=e;e=0;do{var s=a.nextSibling;if(a.nodeType===1?t?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(t?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),s&&s.nodeType===8)if(a=s.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=s}while(a)}function $u(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var a=t;switch(t=t.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":$u(a),Ui(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function Uv(e,t,a,s){for(;e.nodeType===1;){var o=a;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!s&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(s){if(!e[_a])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!==o.rel||e.getAttribute("href")!==(o.href==null||o.href===""?null:o.href)||e.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin)||e.getAttribute("title")!==(o.title==null?null:o.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(u=e.getAttribute("src"),(u!==(o.src==null?null:o.src)||e.getAttribute("type")!==(o.type==null?null:o.type)||e.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin))&&u&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var u=o.name==null?null:""+o.name;if(o.type==="hidden"&&e.getAttribute("name")===u)return e}else return e;if(e=hn(e.nextSibling),e===null)break}return null}function zv(e,t,a){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=hn(e.nextSibling),e===null))return null;return e}function Qm(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=hn(e.nextSibling),e===null))return null;return e}function Pu(e){return e.data==="$?"||e.data==="$~"}function Iu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Bv(e,t){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||a.readyState!=="loading")t();else{var s=function(){t(),a.removeEventListener("DOMContentLoaded",s)};a.addEventListener("DOMContentLoaded",s),e._reactRetry=s}}function hn(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 Gu=null;function Zm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(t===0)return hn(e.nextSibling);t--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||t++}e=e.nextSibling}return null}function Fm(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(t===0)return e;t--}else a!=="/$"&&a!=="/&"||t++}e=e.previousSibling}return null}function eg(e,t,a){switch(t=po(a),e){case"html":if(e=t.documentElement,!e)throw Error(l(452));return e;case"head":if(e=t.head,!e)throw Error(l(453));return e;case"body":if(e=t.body,!e)throw Error(l(454));return e;default:throw Error(l(451))}}function Ls(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Ui(e)}var fn=new Map,tg=new Set;function yo(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var ha=V.d;V.d={f:Hv,r:qv,D:$v,C:Pv,L:Iv,m:Gv,X:Kv,S:Vv,M:Yv};function Hv(){var e=ha.f(),t=lo();return e||t}function qv(e){var t=Yn(e);t!==null&&t.tag===5&&t.type==="form"?vf(t):ha.r(e)}var mr=typeof document>"u"?null:document;function ng(e,t,a){var s=mr;if(s&&typeof t=="string"&&t){var o=Lt(t);o='link[rel="'+e+'"][href="'+o+'"]',typeof a=="string"&&(o+='[crossorigin="'+a+'"]'),tg.has(o)||(tg.add(o),e={rel:e,crossOrigin:a,href:t},s.querySelector(o)===null&&(t=s.createElement("link"),xt(t,"link",e),dt(t),s.head.appendChild(t)))}}function $v(e){ha.D(e),ng("dns-prefetch",e,null)}function Pv(e,t){ha.C(e,t),ng("preconnect",e,t)}function Iv(e,t,a){ha.L(e,t,a);var s=mr;if(s&&e&&t){var o='link[rel="preload"][as="'+Lt(t)+'"]';t==="image"&&a&&a.imageSrcSet?(o+='[imagesrcset="'+Lt(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(o+='[imagesizes="'+Lt(a.imageSizes)+'"]')):o+='[href="'+Lt(e)+'"]';var u=o;switch(t){case"style":u=gr(e);break;case"script":u=pr(e)}fn.has(u)||(e=b({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),fn.set(u,e),s.querySelector(o)!==null||t==="style"&&s.querySelector(Ds(u))||t==="script"&&s.querySelector(Ms(u))||(t=s.createElement("link"),xt(t,"link",e),dt(t),s.head.appendChild(t)))}}function Gv(e,t){ha.m(e,t);var a=mr;if(a&&e){var s=t&&typeof t.as=="string"?t.as:"script",o='link[rel="modulepreload"][as="'+Lt(s)+'"][href="'+Lt(e)+'"]',u=o;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=pr(e)}if(!fn.has(u)&&(e=b({rel:"modulepreload",href:e},t),fn.set(u,e),a.querySelector(o)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Ms(u)))return}s=a.createElement("link"),xt(s,"link",e),dt(s),a.head.appendChild(s)}}}function Vv(e,t,a){ha.S(e,t,a);var s=mr;if(s&&e){var o=Xn(s).hoistableStyles,u=gr(e);t=t||"default";var f=o.get(u);if(!f){var v={loading:0,preload:null};if(f=s.querySelector(Ds(u)))v.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":t},a),(a=fn.get(u))&&Vu(e,a);var _=f=s.createElement("link");dt(_),xt(_,"link",e),_._p=new Promise(function(j,U){_.onload=j,_.onerror=U}),_.addEventListener("load",function(){v.loading|=1}),_.addEventListener("error",function(){v.loading|=2}),v.loading|=4,vo(f,t,s)}f={type:"stylesheet",instance:f,count:1,state:v},o.set(u,f)}}}function Kv(e,t){ha.X(e,t);var a=mr;if(a&&e){var s=Xn(a).hoistableScripts,o=pr(e),u=s.get(o);u||(u=a.querySelector(Ms(o)),u||(e=b({src:e,async:!0},t),(t=fn.get(o))&&Ku(e,t),u=a.createElement("script"),dt(u),xt(u,"link",e),a.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},s.set(o,u))}}function Yv(e,t){ha.M(e,t);var a=mr;if(a&&e){var s=Xn(a).hoistableScripts,o=pr(e),u=s.get(o);u||(u=a.querySelector(Ms(o)),u||(e=b({src:e,async:!0,type:"module"},t),(t=fn.get(o))&&Ku(e,t),u=a.createElement("script"),dt(u),xt(u,"link",e),a.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},s.set(o,u))}}function ag(e,t,a,s){var o=(o=ye.current)?yo(o):null;if(!o)throw Error(l(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=gr(a.href),a=Xn(o).hoistableStyles,s=a.get(t),s||(s={type:"style",instance:null,count:0,state:null},a.set(t,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=gr(a.href);var u=Xn(o).hoistableStyles,f=u.get(e);if(f||(o=o.ownerDocument||o,f={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,f),(u=o.querySelector(Ds(e)))&&!u._p&&(f.instance=u,f.state.loading=5),fn.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},fn.set(e,a),u||Jv(o,e,a,f.state))),t&&s===null)throw Error(l(528,""));return f}if(t&&s!==null)throw Error(l(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=pr(a),a=Xn(o).hoistableScripts,s=a.get(t),s||(s={type:"script",instance:null,count:0,state:null},a.set(t,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,e))}}function gr(e){return'href="'+Lt(e)+'"'}function Ds(e){return'link[rel="stylesheet"]['+e+"]"}function ig(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function Jv(e,t,a,s){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?s.loading=1:(t=e.createElement("link"),s.preload=t,t.addEventListener("load",function(){return s.loading|=1}),t.addEventListener("error",function(){return s.loading|=2}),xt(t,"link",a),dt(t),e.head.appendChild(t))}function pr(e){return'[src="'+Lt(e)+'"]'}function Ms(e){return"script[async]"+e}function rg(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+Lt(a.href)+'"]');if(s)return t.instance=s,dt(s),s;var o=b({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),dt(s),xt(s,"style",o),vo(s,a.precedence,e),t.instance=s;case"stylesheet":o=gr(a.href);var u=e.querySelector(Ds(o));if(u)return t.state.loading|=4,t.instance=u,dt(u),u;s=ig(a),(o=fn.get(o))&&Vu(s,o),u=(e.ownerDocument||e).createElement("link"),dt(u);var f=u;return f._p=new Promise(function(v,_){f.onload=v,f.onerror=_}),xt(u,"link",s),t.state.loading|=4,vo(u,a.precedence,e),t.instance=u;case"script":return u=pr(a.src),(o=e.querySelector(Ms(u)))?(t.instance=o,dt(o),o):(s=a,(o=fn.get(u))&&(s=b({},a),Ku(s,o)),e=e.ownerDocument||e,o=e.createElement("script"),dt(o),xt(o,"link",s),e.head.appendChild(o),t.instance=o);case"void":return null;default:throw Error(l(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(s=t.instance,t.state.loading|=4,vo(s,a.precedence,e));return t.instance}function vo(e,t,a){for(var s=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),o=s.length?s[s.length-1]:null,u=o,f=0;f<s.length;f++){var v=s[f];if(v.dataset.precedence===t)u=v;else if(u!==o)break}u?u.parentNode.insertBefore(e,u.nextSibling):(t=a.nodeType===9?a.head:a,t.insertBefore(e,t.firstChild))}function Vu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Ku(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var bo=null;function sg(e,t,a){if(bo===null){var s=new Map,o=bo=new Map;o.set(a,s)}else o=bo,s=o.get(a),s||(s=new Map,o.set(a,s));if(s.has(e))return s;for(s.set(e,null),a=a.getElementsByTagName(e),o=0;o<a.length;o++){var u=a[o];if(!(u[_a]||u[tt]||e==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var f=u.getAttribute(t)||"";f=e+f;var v=s.get(f);v?v.push(u):s.set(f,[u])}}return s}function lg(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function Xv(e,t,a){if(a===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;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!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 og(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Wv(e,t,a,s){if(a.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var o=gr(s.href),u=t.querySelector(Ds(o));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=So.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=u,dt(u);return}u=t.ownerDocument||t,s=ig(s),(o=fn.get(o))&&Vu(s,o),u=u.createElement("link"),dt(u);var f=u;f._p=new Promise(function(v,_){f.onload=v,f.onerror=_}),xt(u,"link",s),a.instance=u}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=So.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var Yu=0;function Qv(e,t){return e.stylesheets&&e.count===0&&_o(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var s=setTimeout(function(){if(e.stylesheets&&_o(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&Yu===0&&(Yu=62500*jv());var o=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&_o(e,e.stylesheets),e.unsuspend)){var u=e.unsuspend;e.unsuspend=null,u()}},(e.imgBytes>Yu?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(o)}}:null}function So(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)_o(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var wo=null;function _o(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,wo=new Map,t.forEach(Zv,e),wo=null,So.call(e))}function Zv(e,t){if(!(t.state.loading&4)){var a=wo.get(e);if(a)var s=a.get(null);else{a=new Map,wo.set(e,a);for(var o=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<o.length;u++){var f=o[u];(f.nodeName==="LINK"||f.getAttribute("media")!=="not all")&&(a.set(f.dataset.precedence,f),s=f)}s&&a.set(null,s)}o=t.instance,f=o.getAttribute("data-precedence"),u=a.get(f)||s,u===s&&a.set(null,o),a.set(f,o),this.count++,s=So.bind(this),o.addEventListener("load",s),o.addEventListener("error",s),u?u.parentNode.insertBefore(o,u.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(o,e.firstChild)),t.state.loading|=4}}var Us={$$typeof:O,Provider:null,Consumer:null,_currentValue:le,_currentValue2:le,_threadCount:0};function Fv(e,t,a,s,o,u,f,v,_){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=Rn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Rn(0),this.hiddenUpdates=Rn(null),this.identifierPrefix=s,this.onUncaughtError=o,this.onCaughtError=u,this.onRecoverableError=f,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=_,this.incompleteTransitions=new Map}function cg(e,t,a,s,o,u,f,v,_,j,U,q){return e=new Fv(e,t,a,f,_,j,U,q,v),t=1,u===!0&&(t|=24),u=Xt(3,null,null,t),e.current=u,u.stateNode=e,t=Ac(),t.refCount++,e.pooledCache=t,t.refCount++,u.memoizedState={element:s,isDehydrated:a,cache:t},Rc(u),e}function ug(e){return e?(e=Yi,e):Yi}function dg(e,t,a,s,o,u){o=ug(o),s.context===null?s.context=o:s.pendingContext=o,s=Na(t),s.payload={element:a},u=u===void 0?null:u,u!==null&&(s.callback=u),a=La(e,s,t),a!==null&&(Pt(a,e,t),ms(a,e,t))}function hg(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function Ju(e,t){hg(e,t),(e=e.alternate)&&hg(e,t)}function fg(e){if(e.tag===13||e.tag===31){var t=oi(e,67108864);t!==null&&Pt(t,e,67108864),Ju(e,67108864)}}function mg(e){if(e.tag===13||e.tag===31){var t=en();t=et(t);var a=oi(e,t);a!==null&&Pt(a,e,t),Ju(e,t)}}var To=!0;function e0(e,t,a,s){var o=D.T;D.T=null;var u=V.p;try{V.p=2,Xu(e,t,a,s)}finally{V.p=u,D.T=o}}function t0(e,t,a,s){var o=D.T;D.T=null;var u=V.p;try{V.p=8,Xu(e,t,a,s)}finally{V.p=u,D.T=o}}function Xu(e,t,a,s){if(To){var o=Wu(s);if(o===null)Mu(e,t,s,ko,a),pg(e,s);else if(a0(o,e,t,a,s))s.stopPropagation();else if(pg(e,s),t&4&&-1<n0.indexOf(e)){for(;o!==null;){var u=Yn(o);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var f=bt(u.pendingLanes);if(f!==0){var v=u;for(v.pendingLanes|=2,v.entangledLanes|=2;f;){var _=1<<31-Ot(f);v.entanglements[1]|=_,f&=~_}Bn(u),(Ne&6)===0&&(ro=Ie()+500,Rs(0))}}break;case 31:case 13:v=oi(u,2),v!==null&&Pt(v,u,2),lo(),Ju(u,2)}if(u=Wu(s),u===null&&Mu(e,t,s,ko,a),u===o)break;o=u}o!==null&&s.stopPropagation()}else Mu(e,t,s,null,a)}}function Wu(e){return e=Fr(e),Qu(e)}var ko=null;function Qu(e){if(ko=null,e=Kn(e),e!==null){var t=d(e);if(t===null)e=null;else{var a=t.tag;if(a===13){if(e=h(t),e!==null)return e;e=null}else if(a===31){if(e=m(t),e!==null)return e;e=null}else if(a===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return ko=e,null}function gg(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(Hr()){case Qa:return 2;case Cn:return 8;case Ni:case qr:return 32;case $r:return 268435456;default:return 32}default:return 32}}var Zu=!1,Ga=null,Va=null,Ka=null,zs=new Map,Bs=new Map,Ya=[],n0="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 pg(e,t){switch(e){case"focusin":case"focusout":Ga=null;break;case"dragenter":case"dragleave":Va=null;break;case"mouseover":case"mouseout":Ka=null;break;case"pointerover":case"pointerout":zs.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Bs.delete(t.pointerId)}}function Hs(e,t,a,s,o,u){return e===null||e.nativeEvent!==u?(e={blockedOn:t,domEventName:a,eventSystemFlags:s,nativeEvent:u,targetContainers:[o]},t!==null&&(t=Yn(t),t!==null&&fg(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function a0(e,t,a,s,o){switch(t){case"focusin":return Ga=Hs(Ga,e,t,a,s,o),!0;case"dragenter":return Va=Hs(Va,e,t,a,s,o),!0;case"mouseover":return Ka=Hs(Ka,e,t,a,s,o),!0;case"pointerover":var u=o.pointerId;return zs.set(u,Hs(zs.get(u)||null,e,t,a,s,o)),!0;case"gotpointercapture":return u=o.pointerId,Bs.set(u,Hs(Bs.get(u)||null,e,t,a,s,o)),!0}return!1}function yg(e){var t=Kn(e.target);if(t!==null){var a=d(t);if(a!==null){if(t=a.tag,t===13){if(t=h(a),t!==null){e.blockedOn=t,Za(e.priority,function(){mg(a)});return}}else if(t===31){if(t=m(a),t!==null){e.blockedOn=t,Za(e.priority,function(){mg(a)});return}}else if(t===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Eo(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=Wu(e.nativeEvent);if(a===null){a=e.nativeEvent;var s=new a.constructor(a.type,a);Zr=s,a.target.dispatchEvent(s),Zr=null}else return t=Yn(a),t!==null&&fg(t),e.blockedOn=a,!1;t.shift()}return!0}function vg(e,t,a){Eo(e)&&a.delete(t)}function i0(){Zu=!1,Ga!==null&&Eo(Ga)&&(Ga=null),Va!==null&&Eo(Va)&&(Va=null),Ka!==null&&Eo(Ka)&&(Ka=null),zs.forEach(vg),Bs.forEach(vg)}function Ao(e,t){e.blockedOn===t&&(e.blockedOn=null,Zu||(Zu=!0,i.unstable_scheduleCallback(i.unstable_NormalPriority,i0)))}var xo=null;function bg(e){xo!==e&&(xo=e,i.unstable_scheduleCallback(i.unstable_NormalPriority,function(){xo===e&&(xo=null);for(var t=0;t<e.length;t+=3){var a=e[t],s=e[t+1],o=e[t+2];if(typeof s!="function"){if(Qu(s||a)===null)continue;break}var u=Yn(a);u!==null&&(e.splice(t,3),t-=3,Wc(u,{pending:!0,data:o,method:a.method,action:s},s,o))}}))}function yr(e){function t(_){return Ao(_,e)}Ga!==null&&Ao(Ga,e),Va!==null&&Ao(Va,e),Ka!==null&&Ao(Ka,e),zs.forEach(t),Bs.forEach(t);for(var a=0;a<Ya.length;a++){var s=Ya[a];s.blockedOn===e&&(s.blockedOn=null)}for(;0<Ya.length&&(a=Ya[0],a.blockedOn===null);)yg(a),a.blockedOn===null&&Ya.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(s=0;s<a.length;s+=3){var o=a[s],u=a[s+1],f=o[Tt]||null;if(typeof u=="function")f||bg(a);else if(f){var v=null;if(u&&u.hasAttribute("formAction")){if(o=u,f=u[Tt]||null)v=f.formAction;else if(Qu(o)!==null)continue}else v=f.action;typeof v=="function"?a[s+1]=v:(a.splice(s,3),s-=3),bg(a)}}}function Sg(){function e(u){u.canIntercept&&u.info==="react-transition"&&u.intercept({handler:function(){return new Promise(function(f){return o=f})},focusReset:"manual",scroll:"manual"})}function t(){o!==null&&(o(),o=null),s||setTimeout(a,20)}function a(){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,o=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(a,100),function(){s=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),o!==null&&(o(),o=null)}}}function Fu(e){this._internalRoot=e}Co.prototype.render=Fu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(l(409));var a=t.current,s=en();dg(a,s,e,t,null,null)},Co.prototype.unmount=Fu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;dg(e.current,2,null,e,null,null),lo(),t[Yt]=null}};function Co(e){this._internalRoot=e}Co.prototype.unstable_scheduleHydration=function(e){if(e){var t=Mi();e={blockedOn:null,target:e,priority:t};for(var a=0;a<Ya.length&&t!==0&&t<Ya[a].priority;a++);Ya.splice(a,0,e),a===0&&yg(e)}};var wg=n.version;if(wg!=="19.2.7")throw Error(l(527,wg,"19.2.7"));V.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(l(188)):(e=Object.keys(e).join(","),Error(l(268,e)));return e=p(t),e=e!==null?S(e):null,e=e===null?null:e.stateNode,e};var r0={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:D,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Oo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Oo.isDisabled&&Oo.supportsFiber)try{ba=Oo.inject(r0),vt=Oo}catch{}}return $s.createRoot=function(e,t){if(!c(e))throw Error(l(299));var a=!1,s="",o=Cf,u=Of,f=Rf;return t!=null&&(t.unstable_strictMode===!0&&(a=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(u=t.onCaughtError),t.onRecoverableError!==void 0&&(f=t.onRecoverableError)),t=cg(e,1,!1,null,null,a,s,null,o,u,f,Sg),e[Yt]=t.current,Du(e),new Fu(t)},$s.hydrateRoot=function(e,t,a){if(!c(e))throw Error(l(299));var s=!1,o="",u=Cf,f=Of,v=Rf,_=null;return a!=null&&(a.unstable_strictMode===!0&&(s=!0),a.identifierPrefix!==void 0&&(o=a.identifierPrefix),a.onUncaughtError!==void 0&&(u=a.onUncaughtError),a.onCaughtError!==void 0&&(f=a.onCaughtError),a.onRecoverableError!==void 0&&(v=a.onRecoverableError),a.formState!==void 0&&(_=a.formState)),t=cg(e,1,!0,t,a??null,s,o,_,u,f,v,Sg),t.context=ug(null),a=t.current,s=en(),s=et(s),o=Na(s),o.callback=null,La(a,o,s),a=s,t.current.lanes=a,se(t,a),Bn(t),e[Yt]=t.current,Du(e),new Co(t)},$s.version="19.2.7",$s}var jg;function g0(){if(jg)return nd.exports;jg=1;function i(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(n){console.error(n)}}return i(),nd.exports=m0(),nd.exports}var p0=g0();const y0=i=>i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),v0=i=>i.replace(/^([A-Z])|[\s-_]+(\w)/g,(n,r,l)=>l?l.toUpperCase():r.toLowerCase()),Ng=i=>{const n=v0(i);return n.charAt(0).toUpperCase()+n.slice(1)},Ep=(...i)=>i.filter((n,r,l)=>!!n&&n.trim()!==""&&l.indexOf(n)===r).join(" ").trim(),b0=i=>{for(const n in i)if(n.startsWith("aria-")||n==="role"||n==="title")return!0};var S0={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const w0=H.forwardRef(({color:i="currentColor",size:n=24,strokeWidth:r=2,absoluteStrokeWidth:l,className:c="",children:d,iconNode:h,...m},g)=>H.createElement("svg",{ref:g,...S0,width:n,height:n,stroke:i,strokeWidth:l?Number(r)*24/Number(n):r,className:Ep("lucide",c),...!d&&!b0(m)&&{"aria-hidden":"true"},...m},[...h.map(([p,S])=>H.createElement(p,S)),...Array.isArray(d)?d:[d]]));const $e=(i,n)=>{const r=H.forwardRef(({className:l,...c},d)=>H.createElement(w0,{ref:d,iconNode:n,className:Ep(`lucide-${y0(Ng(i))}`,`lucide-${i}`,l),...c}));return r.displayName=Ng(i),r};const _0=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Lg=$e("activity",_0);const T0=[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],k0=$e("badge-check",T0);const E0=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],Ad=$e("book-open",E0);const A0=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Ap=$e("chevron-left",A0);const x0=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],xp=$e("chevron-right",x0);const C0=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],O0=$e("circle-check",C0);const R0=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]],Ps=$e("clipboard",R0);const j0=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],xd=$e("credit-card",j0);const N0=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],sd=$e("database",N0);const L0=[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],D0=$e("earth",L0);const M0=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],ld=$e("folder-open",M0);const U0=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],Cp=$e("layout-grid",U0);const z0=[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]],od=$e("log-in",z0);const B0=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],H0=$e("log-out",B0);const q0=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],jr=$e("monitor",q0);const $0=[["path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z",key:"edeuup"}]],Cd=$e("mouse-pointer-2",$0);const P0=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],cd=$e("play",P0);const I0=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],G0=$e("power",I0);const V0=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],K0=$e("rotate-ccw",V0);const Y0=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],ud=$e("send",Y0);const J0=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],dd=$e("server",J0);const X0=[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Op=$e("settings",X0);const W0=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Dg=$e("shield-check",W0);const Q0=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],Z0=$e("star",Q0);const F0=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Ar=$e("terminal",F0);const eb=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],Mg=$e("volume-2",eb);const tb=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],Ug=$e("wifi",tb);const nb=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],zg=$e("x",nb);function Xo(i,n){var r={};for(var l in i)Object.prototype.hasOwnProperty.call(i,l)&&n.indexOf(l)<0&&(r[l]=i[l]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var c=0,l=Object.getOwnPropertySymbols(i);c<l.length;c++)n.indexOf(l[c])<0&&Object.prototype.propertyIsEnumerable.call(i,l[c])&&(r[l[c]]=i[l[c]]);return r}function ab(i,n,r,l){function c(d){return d instanceof r?d:new r(function(h){h(d)})}return new(r||(r=Promise))(function(d,h){function m(S){try{p(l.next(S))}catch(b){h(b)}}function g(S){try{p(l.throw(S))}catch(b){h(b)}}function p(S){S.done?d(S.value):c(S.value).then(m,g)}p((l=l.apply(i,n||[])).next())})}const ib=i=>i?(...n)=>i(...n):(...n)=>fetch(...n);class Id extends Error{constructor(n,r="FunctionsError",l){super(n),this.name=r,this.context=l}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class rb extends Id{constructor(n){super("Failed to send a request to the Edge Function","FunctionsFetchError",n)}}class Bg extends Id{constructor(n){super("Relay Error invoking the Edge Function","FunctionsRelayError",n)}}class Hg extends Id{constructor(n){super("Edge Function returned a non-2xx status code","FunctionsHttpError",n)}}var Od;(function(i){i.Any="any",i.ApNortheast1="ap-northeast-1",i.ApNortheast2="ap-northeast-2",i.ApSouth1="ap-south-1",i.ApSoutheast1="ap-southeast-1",i.ApSoutheast2="ap-southeast-2",i.CaCentral1="ca-central-1",i.EuCentral1="eu-central-1",i.EuWest1="eu-west-1",i.EuWest2="eu-west-2",i.EuWest3="eu-west-3",i.SaEast1="sa-east-1",i.UsEast1="us-east-1",i.UsWest1="us-west-1",i.UsWest2="us-west-2"})(Od||(Od={}));class sb{constructor(n,{headers:r={},customFetch:l,region:c=Od.Any}={}){this.url=n,this.headers=r,this.region=c,this.fetch=ib(l)}setAuth(n){this.headers.Authorization=`Bearer ${n}`}invoke(n){return ab(this,arguments,void 0,function*(r,l={}){var c;let d,h;try{const{headers:m,method:g,body:p,signal:S,timeout:b}=l;let T={},{region:A}=l;A||(A=this.region);const C=new URL(`${this.url}/${r}`);A&&A!=="any"&&(T["x-region"]=A,C.searchParams.set("forceFunctionRegion",A));let z;const G=!!m&&Object.keys(m).some(ie=>ie.toLowerCase()==="content-type");p&&!G?typeof Blob<"u"&&p instanceof Blob||p instanceof ArrayBuffer?(T["Content-Type"]="application/octet-stream",z=p):typeof p=="string"?(T["Content-Type"]="text/plain",z=p):typeof FormData<"u"&&p instanceof FormData?z=p:(T["Content-Type"]="application/json",z=JSON.stringify(p)):p&&typeof p!="string"&&!(typeof Blob<"u"&&p instanceof Blob)&&!(p instanceof ArrayBuffer)&&!(typeof FormData<"u"&&p instanceof FormData)?z=JSON.stringify(p):z=p;let I=S;b&&(h=new AbortController,d=setTimeout(()=>h.abort(),b),S?(I=h.signal,S.addEventListener("abort",()=>h.abort())):I=h.signal);const $=yield this.fetch(C.toString(),{method:g||"POST",headers:Object.assign(Object.assign(Object.assign({},T),this.headers),m),body:z,signal:I}).catch(ie=>{throw new rb(ie)}),O=$.headers.get("x-relay-error");if(O&&O==="true")throw new Bg($);if(!$.ok)throw new Hg($);let Y=((c=$.headers.get("Content-Type"))!==null&&c!==void 0?c:"text/plain").split(";")[0].trim(),me;return Y==="application/json"?me=yield $.json():Y==="application/octet-stream"||Y==="application/pdf"?me=yield $.blob():Y==="text/event-stream"?me=$:Y==="multipart/form-data"?me=yield $.formData():me=yield $.text(),{data:me,error:null,response:$}}catch(m){return{data:null,error:m,response:m instanceof Hg||m instanceof Bg?m.context:void 0}}finally{d&&clearTimeout(d)}})}}const Rp=3,qg=i=>Math.min(1e3*2**i,3e4),lb=[520,503],jp=["GET","HEAD","OPTIONS"];var $g=class extends Error{constructor(i){super(i.message),this.name="PostgrestError",this.details=i.details,this.hint=i.hint,this.code=i.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function Pg(i,n){return new Promise(r=>{if(n?.aborted){r();return}const l=setTimeout(()=>{n?.removeEventListener("abort",c),r()},i);function c(){clearTimeout(l),r()}n?.addEventListener("abort",c)})}function ob(i,n,r,l){return!(!l||r>=Rp||!jp.includes(i)||!lb.includes(n))}var cb=class{constructor(i){var n,r,l,c,d;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=i.method,this.url=i.url,this.headers=new Headers(i.headers),this.schema=i.schema,this.body=i.body,this.shouldThrowOnError=(n=i.shouldThrowOnError)!==null&&n!==void 0?n:!1,this.signal=i.signal,this.isMaybeSingle=(r=i.isMaybeSingle)!==null&&r!==void 0?r:!1,this.shouldStripNulls=(l=i.shouldStripNulls)!==null&&l!==void 0?l:!1,this.urlLengthLimit=(c=i.urlLengthLimit)!==null&&c!==void 0?c:8e3,this.retryEnabled=(d=i.retry)!==null&&d!==void 0?d:!0,i.fetch?this.fetch=i.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if(this.headers.get("Accept")==="text/csv")throw new Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(i,n){return this.headers=new Headers(this.headers),this.headers.set(i,n),this}retry(i){return this.retryEnabled=i,this}then(i,n){var r=this;if(this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json"),this.shouldStripNulls){const h=this.headers.get("Accept");h==="application/vnd.pgrst.object+json"?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):(!h||h==="application/json")&&this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const l=this.fetch;let d=(async()=>{let h=0;for(;;){const p={};r.headers.forEach((b,T)=>{p[T]=b}),h>0&&(p["X-Retry-Count"]=String(h));let S;try{S=await l(r.url.toString(),{method:r.method,headers:p,body:JSON.stringify(r.body,(b,T)=>typeof T=="bigint"?T.toString():T),signal:r.signal})}catch(b){if(b?.name==="AbortError"||b?.code==="ABORT_ERR"||!jp.includes(r.method))throw b;if(r.retryEnabled&&h<Rp){const T=qg(h);h++,await Pg(T,r.signal);continue}throw b}if(ob(r.method,S.status,h,r.retryEnabled)){var m,g;const b=(m=(g=S.headers)===null||g===void 0?void 0:g.get("Retry-After"))!==null&&m!==void 0?m:null,T=b!==null?Math.max(0,parseInt(b,10)||0)*1e3:qg(h);await S.text(),h++,await Pg(T,r.signal);continue}return await r.processResponse(S)}})();return this.shouldThrowOnError||(d=d.catch(h=>{var m;let g="",p="",S="";const b=h?.cause;if(b){var T,A,C,z;const $=(T=b?.message)!==null&&T!==void 0?T:"",O=(A=b?.code)!==null&&A!==void 0?A:"";g=`${(C=h?.name)!==null&&C!==void 0?C:"FetchError"}: ${h?.message}`,g+=`
10
+
11
+ Caused by: ${(z=b?.name)!==null&&z!==void 0?z:"Error"}: ${$}`,O&&(g+=` (${O})`),b?.stack&&(g+=`
12
+ ${b.stack}`)}else{var G;g=(G=h?.stack)!==null&&G!==void 0?G:""}const I=this.url.toString().length;return h?.name==="AbortError"||h?.code==="ABORT_ERR"?(S="",p="Request was aborted (timeout or manual cancellation)",I>this.urlLengthLimit&&(p+=`. Note: Your request URL is ${I} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):(b?.name==="HeadersOverflowError"||b?.code==="UND_ERR_HEADERS_OVERFLOW")&&(S="",p="HTTP headers exceeded server limits (typically 16KB)",I>this.urlLengthLimit&&(p+=`. Your request URL is ${I} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${(m=h?.name)!==null&&m!==void 0?m:"FetchError"}: ${h?.message}`,details:g,hint:p,code:S},data:null,count:null,status:0,statusText:""}})),d.then(i,n)}async processResponse(i){var n=this;let r=null,l=null,c=null,d=i.status,h=i.statusText;if(i.ok){var m,g;if(n.method!=="HEAD"){var p;const T=await i.text();if(T!=="")if(n.headers.get("Accept")==="text/csv")l=T;else if(n.headers.get("Accept")&&(!((p=n.headers.get("Accept"))===null||p===void 0)&&p.includes("application/vnd.pgrst.plan+text")))l=T;else try{l=JSON.parse(T)}catch{if(r={message:T},l=null,n.shouldThrowOnError)throw new $g({message:T,details:"",hint:"",code:""})}}const S=(m=n.headers.get("Prefer"))===null||m===void 0?void 0:m.match(/count=(exact|planned|estimated)/),b=(g=i.headers.get("content-range"))===null||g===void 0?void 0:g.split("/");S&&b&&b.length>1&&(c=parseInt(b[1])),n.isMaybeSingle&&Array.isArray(l)&&(l.length>1?(r={code:"PGRST116",details:`Results contain ${l.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},l=null,c=null,d=406,h="Not Acceptable"):l.length===1?l=l[0]:l=null)}else{const S=await i.text();try{r=JSON.parse(S),Array.isArray(r)&&i.status===404&&(l=[],r=null,d=200,h="OK")}catch{i.status===404&&S===""?(d=204,h="No Content"):r={message:S}}if(r&&n.shouldThrowOnError)throw new $g(r)}return{success:r===null,error:r,data:l,count:c,status:d,statusText:h}}returns(){return this}overrideTypes(){return this}},ub=class extends cb{throwOnError(){return super.throwOnError()}select(i){let n=!1;const r=(i??"*").split("").map(l=>/\s/.test(l)&&!n?"":(l==='"'&&(n=!n),l)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(i,{ascending:n=!0,nullsFirst:r,foreignTable:l,referencedTable:c=l}={}){const d=c?`${c}.order`:"order",h=this.url.searchParams.get(d);return this.url.searchParams.set(d,`${h?`${h},`:""}${i}.${n?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(i,{foreignTable:n,referencedTable:r=n}={}){const l=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(l,`${i}`),this}range(i,n,{foreignTable:r,referencedTable:l=r}={}){const c=typeof l>"u"?"offset":`${l}.offset`,d=typeof l>"u"?"limit":`${l}.limit`;return this.url.searchParams.set(c,`${i}`),this.url.searchParams.set(d,`${n-i+1}`),this}abortSignal(i){return this.signal=i,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:i=!1,verbose:n=!1,settings:r=!1,buffers:l=!1,wal:c=!1,format:d="text"}={}){var h;const m=[i?"analyze":null,n?"verbose":null,r?"settings":null,l?"buffers":null,c?"wal":null].filter(Boolean).join("|"),g=(h=this.headers.get("Accept"))!==null&&h!==void 0?h:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${d}; for="${g}"; options=${m};`),d==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(i){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${i}`),this}};const Ig=new RegExp("[,()]");var xr=class extends ub{throwOnError(){return super.throwOnError()}eq(i,n){return this.url.searchParams.append(i,`eq.${n}`),this}neq(i,n){return this.url.searchParams.append(i,`neq.${n}`),this}gt(i,n){return this.url.searchParams.append(i,`gt.${n}`),this}gte(i,n){return this.url.searchParams.append(i,`gte.${n}`),this}lt(i,n){return this.url.searchParams.append(i,`lt.${n}`),this}lte(i,n){return this.url.searchParams.append(i,`lte.${n}`),this}like(i,n){return this.url.searchParams.append(i,`like.${n}`),this}likeAllOf(i,n){return this.url.searchParams.append(i,`like(all).{${n.join(",")}}`),this}likeAnyOf(i,n){return this.url.searchParams.append(i,`like(any).{${n.join(",")}}`),this}ilike(i,n){return this.url.searchParams.append(i,`ilike.${n}`),this}ilikeAllOf(i,n){return this.url.searchParams.append(i,`ilike(all).{${n.join(",")}}`),this}ilikeAnyOf(i,n){return this.url.searchParams.append(i,`ilike(any).{${n.join(",")}}`),this}regexMatch(i,n){return this.url.searchParams.append(i,`match.${n}`),this}regexIMatch(i,n){return this.url.searchParams.append(i,`imatch.${n}`),this}is(i,n){return this.url.searchParams.append(i,`is.${n}`),this}isDistinct(i,n){return this.url.searchParams.append(i,`isdistinct.${n}`),this}in(i,n){const r=Array.from(new Set(n)).map(l=>typeof l=="string"&&Ig.test(l)?`"${l}"`:`${l}`).join(",");return this.url.searchParams.append(i,`in.(${r})`),this}notIn(i,n){const r=Array.from(new Set(n)).map(l=>typeof l=="string"&&Ig.test(l)?`"${l}"`:`${l}`).join(",");return this.url.searchParams.append(i,`not.in.(${r})`),this}contains(i,n){return typeof n=="string"?this.url.searchParams.append(i,`cs.${n}`):Array.isArray(n)?this.url.searchParams.append(i,`cs.{${n.join(",")}}`):this.url.searchParams.append(i,`cs.${JSON.stringify(n)}`),this}containedBy(i,n){return typeof n=="string"?this.url.searchParams.append(i,`cd.${n}`):Array.isArray(n)?this.url.searchParams.append(i,`cd.{${n.join(",")}}`):this.url.searchParams.append(i,`cd.${JSON.stringify(n)}`),this}rangeGt(i,n){return this.url.searchParams.append(i,`sr.${n}`),this}rangeGte(i,n){return this.url.searchParams.append(i,`nxl.${n}`),this}rangeLt(i,n){return this.url.searchParams.append(i,`sl.${n}`),this}rangeLte(i,n){return this.url.searchParams.append(i,`nxr.${n}`),this}rangeAdjacent(i,n){return this.url.searchParams.append(i,`adj.${n}`),this}overlaps(i,n){return typeof n=="string"?this.url.searchParams.append(i,`ov.${n}`):this.url.searchParams.append(i,`ov.{${n.join(",")}}`),this}textSearch(i,n,{config:r,type:l}={}){let c="";l==="plain"?c="pl":l==="phrase"?c="ph":l==="websearch"&&(c="w");const d=r===void 0?"":`(${r})`;return this.url.searchParams.append(i,`${c}fts${d}.${n}`),this}match(i){return Object.entries(i).filter(([n,r])=>r!==void 0).forEach(([n,r])=>{this.url.searchParams.append(n,`eq.${r}`)}),this}not(i,n,r){return this.url.searchParams.append(i,`not.${n}.${r}`),this}or(i,{foreignTable:n,referencedTable:r=n}={}){const l=r?`${r}.or`:"or";return this.url.searchParams.append(l,`(${i})`),this}filter(i,n,r){return this.url.searchParams.append(i,`${n}.${r}`),this}},db=class{constructor(i,{headers:n={},schema:r,fetch:l,urlLengthLimit:c=8e3,retry:d}){this.url=i,this.headers=new Headers(n),this.schema=r,this.fetch=l,this.urlLengthLimit=c,this.retry=d}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(i,n){const{head:r=!1,count:l}=n??{},c=r?"HEAD":"GET";let d=!1;const h=(i??"*").split("").map(p=>/\s/.test(p)&&!d?"":(p==='"'&&(d=!d),p)).join(""),{url:m,headers:g}=this.cloneRequestState();return m.searchParams.set("select",h),l&&g.append("Prefer",`count=${l}`),new xr({method:c,url:m,headers:g,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(i,{count:n,defaultToNull:r=!0}={}){var l;const c="POST",{url:d,headers:h}=this.cloneRequestState();if(n&&h.append("Prefer",`count=${n}`),r||h.append("Prefer","missing=default"),Array.isArray(i)){const m=i.reduce((g,p)=>g.concat(Object.keys(p)),[]);if(m.length>0){const g=[...new Set(m)].map(p=>`"${p}"`);d.searchParams.set("columns",g.join(","))}}return new xr({method:c,url:d,headers:h,schema:this.schema,body:i,fetch:(l=this.fetch)!==null&&l!==void 0?l:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(i,{onConflict:n,ignoreDuplicates:r=!1,count:l,defaultToNull:c=!0}={}){var d;const h="POST",{url:m,headers:g}=this.cloneRequestState();if(g.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),n!==void 0&&m.searchParams.set("on_conflict",n),l&&g.append("Prefer",`count=${l}`),c||g.append("Prefer","missing=default"),Array.isArray(i)){const p=i.reduce((S,b)=>S.concat(Object.keys(b)),[]);if(p.length>0){const S=[...new Set(p)].map(b=>`"${b}"`);m.searchParams.set("columns",S.join(","))}}return new xr({method:h,url:m,headers:g,schema:this.schema,body:i,fetch:(d=this.fetch)!==null&&d!==void 0?d:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(i,{count:n}={}){var r;const l="PATCH",{url:c,headers:d}=this.cloneRequestState();return n&&d.append("Prefer",`count=${n}`),new xr({method:l,url:c,headers:d,schema:this.schema,body:i,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:i}={}){var n;const r="DELETE",{url:l,headers:c}=this.cloneRequestState();return i&&c.append("Prefer",`count=${i}`),new xr({method:r,url:l,headers:c,schema:this.schema,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function al(i){"@babel/helpers - typeof";return al=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},al(i)}function hb(i,n){if(al(i)!="object"||!i)return i;var r=i[Symbol.toPrimitive];if(r!==void 0){var l=r.call(i,n);if(al(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(i)}function fb(i){var n=hb(i,"string");return al(n)=="symbol"?n:n+""}function mb(i,n,r){return(n=fb(n))in i?Object.defineProperty(i,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):i[n]=r,i}function Gg(i,n){var r=Object.keys(i);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(i);n&&(l=l.filter(function(c){return Object.getOwnPropertyDescriptor(i,c).enumerable})),r.push.apply(r,l)}return r}function Ro(i){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?Gg(Object(r),!0).forEach(function(l){mb(i,l,r[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(r)):Gg(Object(r)).forEach(function(l){Object.defineProperty(i,l,Object.getOwnPropertyDescriptor(r,l))})}return i}var gb=class Np{constructor(n,{headers:r={},schema:l,fetch:c,timeout:d,urlLengthLimit:h=8e3,retry:m}={}){this.url=n,this.headers=new Headers(r),this.schemaName=l,this.urlLengthLimit=h;const g=c??globalThis.fetch;d!==void 0&&d>0?this.fetch=(p,S)=>{const b=new AbortController,T=setTimeout(()=>b.abort(),d),A=S?.signal;if(A){if(A.aborted)return clearTimeout(T),g(p,S);const C=()=>{clearTimeout(T),b.abort()};return A.addEventListener("abort",C,{once:!0}),g(p,Ro(Ro({},S),{},{signal:b.signal})).finally(()=>{clearTimeout(T),A.removeEventListener("abort",C)})}return g(p,Ro(Ro({},S),{},{signal:b.signal})).finally(()=>clearTimeout(T))}:this.fetch=g,this.retry=m}from(n){if(!n||typeof n!="string"||n.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new db(new URL(`${this.url}/${n}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(n){return new Np(this.url,{headers:this.headers,schema:n,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(n,r={},{head:l=!1,get:c=!1,count:d}={}){var h;let m;const g=new URL(`${this.url}/rpc/${n}`);let p;const S=A=>A!==null&&typeof A=="object"&&(!Array.isArray(A)||A.some(S)),b=l&&Object.values(r).some(S);b?(m="POST",p=r):l||c?(m=l?"HEAD":"GET",Object.entries(r).filter(([A,C])=>C!==void 0).map(([A,C])=>[A,Array.isArray(C)?`{${C.join(",")}}`:`${C}`]).forEach(([A,C])=>{g.searchParams.append(A,C)})):(m="POST",p=r);const T=new Headers(this.headers);return b?T.set("Prefer",d?`count=${d},return=minimal`:"return=minimal"):d&&T.set("Prefer",`count=${d}`),new xr({method:m,url:g,headers:T,schema:this.schemaName,body:p,fetch:(h=this.fetch)!==null&&h!==void 0?h:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};class pb{constructor(){}static detectEnvironment(){var n;if(typeof WebSocket<"u")return{type:"native",wsConstructor:WebSocket};const r=globalThis;if(typeof globalThis<"u"&&typeof r.WebSocket<"u")return{type:"native",wsConstructor:r.WebSocket};const l=typeof global<"u"?global:void 0;if(l&&typeof l.WebSocket<"u")return{type:"native",wsConstructor:l.WebSocket};if(typeof globalThis<"u"&&typeof r.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&r.EdgeRuntime||typeof navigator<"u"&&(!((n=navigator.userAgent)===null||n===void 0)&&n.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const c=globalThis.process;if(c){const d=c.versions;if(d&&d.node)return{type:"unsupported",error:"Node.js detected but native WebSocket not found.",workaround:"Ensure you are running Node.js 22+ or provide a WebSocket implementation via the transport option."}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const n=this.detectEnvironment();if(n.wsConstructor)return n.wsConstructor;let r=n.error||"WebSocket not supported in this environment.";throw n.workaround&&(r+=`
13
+
14
+ Suggested solution: ${n.workaround}`),new Error(r)}static isWebSocketSupported(){try{return this.detectEnvironment().type==="native"}catch{return!1}}}const yb="2.110.0",vb=`realtime-js/${yb}`,bb="1.0.0",Lp="2.0.0",Sb=Lp,wb=1e4,_b=100,Xa={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Dp={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},Rd={connecting:"connecting",closing:"closing",closed:"closed"};class Tb{constructor(n){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=n??[]}encode(n,r){if(n.event===this.BROADCAST_EVENT&&!(n.payload instanceof ArrayBuffer)&&typeof n.payload.event=="string")return r(this._binaryEncodeUserBroadcastPush(n));let l=[n.join_ref,n.ref,n.topic,n.event,n.payload];return r(JSON.stringify(l))}_binaryEncodeUserBroadcastPush(n){var r;return this._isArrayBuffer((r=n.payload)===null||r===void 0?void 0:r.payload)?this._encodeBinaryUserBroadcastPush(n):this._encodeJsonUserBroadcastPush(n)}_encodeBinaryUserBroadcastPush(n){var r,l;const c=(l=(r=n.payload)===null||r===void 0?void 0:r.payload)!==null&&l!==void 0?l:new ArrayBuffer(0);return this._encodeUserBroadcastPush(n,this.BINARY_ENCODING,c)}_encodeJsonUserBroadcastPush(n){var r,l;const c=(l=(r=n.payload)===null||r===void 0?void 0:r.payload)!==null&&l!==void 0?l:{},h=new TextEncoder().encode(JSON.stringify(c)).buffer;return this._encodeUserBroadcastPush(n,this.JSON_ENCODING,h)}_encodeUserBroadcastPush(n,r,l){var c,d;const h=n.topic,m=(c=n.ref)!==null&&c!==void 0?c:"",g=(d=n.join_ref)!==null&&d!==void 0?d:"",p=n.payload.event,S=this.allowedMetadataKeys?this._pick(n.payload,this.allowedMetadataKeys):{},b=Object.keys(S).length===0?"":JSON.stringify(S);if(g.length>255)throw new Error(`joinRef length ${g.length} exceeds maximum of 255`);if(m.length>255)throw new Error(`ref length ${m.length} exceeds maximum of 255`);if(h.length>255)throw new Error(`topic length ${h.length} exceeds maximum of 255`);if(p.length>255)throw new Error(`userEvent length ${p.length} exceeds maximum of 255`);if(b.length>255)throw new Error(`metadata length ${b.length} exceeds maximum of 255`);const T=this.USER_BROADCAST_PUSH_META_LENGTH+g.length+m.length+h.length+p.length+b.length,A=new ArrayBuffer(this.HEADER_LENGTH+T);let C=new DataView(A),z=0;C.setUint8(z++,this.KINDS.userBroadcastPush),C.setUint8(z++,g.length),C.setUint8(z++,m.length),C.setUint8(z++,h.length),C.setUint8(z++,p.length),C.setUint8(z++,b.length),C.setUint8(z++,r),Array.from(g,I=>C.setUint8(z++,I.charCodeAt(0))),Array.from(m,I=>C.setUint8(z++,I.charCodeAt(0))),Array.from(h,I=>C.setUint8(z++,I.charCodeAt(0))),Array.from(p,I=>C.setUint8(z++,I.charCodeAt(0))),Array.from(b,I=>C.setUint8(z++,I.charCodeAt(0)));var G=new Uint8Array(A.byteLength+l.byteLength);return G.set(new Uint8Array(A),0),G.set(new Uint8Array(l),A.byteLength),G.buffer}decode(n,r){if(this._isArrayBuffer(n)){let l=this._binaryDecode(n);return r(l)}if(typeof n=="string"){const l=JSON.parse(n),[c,d,h,m,g]=l;return r({join_ref:c,ref:d,topic:h,event:m,payload:g})}return r({})}_binaryDecode(n){const r=new DataView(n),l=r.getUint8(0),c=new TextDecoder;if(l===this.KINDS.userBroadcast)return this._decodeUserBroadcast(n,r,c)}_decodeUserBroadcast(n,r,l){const c=r.getUint8(1),d=r.getUint8(2),h=r.getUint8(3),m=r.getUint8(4);let g=this.HEADER_LENGTH+4;const p=l.decode(n.slice(g,g+c));g=g+c;const S=l.decode(n.slice(g,g+d));g=g+d;const b=l.decode(n.slice(g,g+h));g=g+h;const T=n.slice(g,n.byteLength),A=m===this.JSON_ENCODING?JSON.parse(l.decode(T)):T,C={type:this.BROADCAST_EVENT,event:S,payload:A};return h>0&&(C.meta=JSON.parse(b)),{join_ref:null,ref:null,topic:p,event:this.BROADCAST_EVENT,payload:C}}_isArrayBuffer(n){var r;return n instanceof ArrayBuffer||((r=n?.constructor)===null||r===void 0?void 0:r.name)==="ArrayBuffer"}_pick(n,r){return!n||typeof n!="object"?{}:Object.fromEntries(Object.entries(n).filter(([l])=>r.includes(l)))}}var Ge;(function(i){i.abstime="abstime",i.bool="bool",i.date="date",i.daterange="daterange",i.float4="float4",i.float8="float8",i.int2="int2",i.int4="int4",i.int4range="int4range",i.int8="int8",i.int8range="int8range",i.json="json",i.jsonb="jsonb",i.money="money",i.numeric="numeric",i.oid="oid",i.reltime="reltime",i.text="text",i.time="time",i.timestamp="timestamp",i.timestamptz="timestamptz",i.timetz="timetz",i.tsrange="tsrange",i.tstzrange="tstzrange"})(Ge||(Ge={}));const Vg=(i,n,r={})=>{var l;const c=(l=r.skipTypes)!==null&&l!==void 0?l:[];return n?Object.keys(n).reduce((d,h)=>(d[h]=kb(h,i,n,c),d),{}):{}},kb=(i,n,r,l)=>{const c=n.find(m=>m.name===i),d=c?.type,h=r[i];return d&&!l.includes(d)?Mp(d,h):jd(h)},Mp=(i,n)=>{if(i.charAt(0)==="_"){const r=i.slice(1,i.length);return Cb(n,r)}switch(i){case Ge.bool:return Eb(n);case Ge.float4:case Ge.float8:case Ge.int2:case Ge.int4:case Ge.int8:case Ge.numeric:case Ge.oid:return Ab(n);case Ge.json:case Ge.jsonb:return xb(n);case Ge.timestamp:return Ob(n);case Ge.abstime:case Ge.date:case Ge.daterange:case Ge.int4range:case Ge.int8range:case Ge.money:case Ge.reltime:case Ge.text:case Ge.time:case Ge.timestamptz:case Ge.timetz:case Ge.tsrange:case Ge.tstzrange:return jd(n);default:return jd(n)}},jd=i=>i,Eb=i=>{switch(i){case"t":return!0;case"f":return!1;default:return i}},Ab=i=>{if(typeof i=="string"){const n=parseFloat(i);if(!Number.isNaN(n))return n}return i},xb=i=>{if(typeof i=="string")try{return JSON.parse(i)}catch{return i}return i},Cb=(i,n)=>{if(typeof i!="string")return i;const r=i.length-1,l=i[r];if(i[0]==="{"&&l==="}"){let d;const h=i.slice(1,r);try{d=JSON.parse("["+h+"]")}catch{d=h?h.split(","):[]}return d.map(m=>Mp(n,m))}return i},Ob=i=>typeof i=="string"?i.replace(" ","T"):i,Up=i=>{const n=new URL(i);return n.protocol=n.protocol.replace(/^ws/i,"http"),n.pathname=n.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),n.pathname===""||n.pathname==="/"?n.pathname="/api/broadcast":n.pathname=n.pathname+"/api/broadcast",n.href};var Ws=i=>typeof i=="function"?i:function(){return i},Rb=typeof self<"u"?self:null,Cr=typeof window<"u"?window:null,Hn=Rb||Cr||globalThis,jb="2.0.0",Nb=1e4,Lb=1e3,qn={connecting:0,open:1,closing:2,closed:3},It={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},ga={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},Nd={longpoll:"longpoll",websocket:"websocket"},Db={complete:4},Ld="base64url.bearer.phx.",jo=class{constructor(i,n,r,l){this.channel=i,this.event=n,this.payload=r||function(){return{}},this.receivedResp=null,this.timeout=l,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(i){this.timeout=i,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(i,n){return this.hasReceived(i)&&n(this.receivedResp.response),this.recHooks.push({status:i,callback:n}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:i,response:n,_ref:r}){this.recHooks.filter(l=>l.status===i).forEach(l=>l.callback(n))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,i=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=i,this.matchReceive(i)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(i){return this.receivedResp&&this.receivedResp.status===i}trigger(i,n){this.channel.trigger(this.refEvent,{status:i,response:n})}},zp=class{constructor(i,n){this.callback=i,this.timerCalc=n,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},Mb=class{constructor(i,n,r){this.state=It.closed,this.topic=i,this.params=Ws(n||{}),this.socket=r,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new jo(this,ga.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new zp(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=It.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(l=>l.send()),this.pushBuffer=[]}),this.joinPush.receive("error",l=>{this.state=It.errored,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,l),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=It.closed,this.socket.remove(this)}),this.onError(l=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,l),this.isJoining()&&this.joinPush.reset(),this.state=It.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),new jo(this,ga.leave,Ws({}),this.timeout).send(),this.state=It.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(ga.reply,(l,c)=>{this.trigger(this.replyEventName(c),l)})}join(i=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=i,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(i=>i.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=It.closed,this.bindings=[]}onClose(i){this.on(ga.close,i)}onError(i){return this.on(ga.error,n=>i(n))}on(i,n){let r=this.bindingRef++;return this.bindings.push({event:i,ref:r,callback:n}),r}off(i,n){this.bindings=this.bindings.filter(r=>!(r.event===i&&(typeof n>"u"||n===r.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(i,n,r=this.timeout){if(n=n||{},!this.joinedOnce)throw new Error(`tried to push '${i}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let l=new jo(this,i,function(){return n},r);return this.canPush()?l.send():(l.startTimeout(),this.pushBuffer.push(l)),l}leave(i=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=It.leaving;let n=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(ga.close,"leave")},r=new jo(this,ga.leave,Ws({}),i);return r.receive("ok",()=>n()).receive("timeout",()=>n()),r.send(),this.canPush()||r.trigger("ok",{}),r}onMessage(i,n,r){return n}filterBindings(i,n,r){return!0}isMember(i,n,r,l){return this.topic!==i?!1:l&&l!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:i,event:n,payload:r,joinRef:l}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(i=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=It.joining,this.joinPush.resend(i))}trigger(i,n,r,l){let c=this.onMessage(i,n,r,l);if(n&&!c)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let d=this.bindings.filter(h=>h.event===i&&this.filterBindings(h,n,r));for(let h=0;h<d.length;h++)d[h].callback(c,r,l||this.joinRef())}replyEventName(i){return`chan_reply_${i}`}isClosed(){return this.state===It.closed}isErrored(){return this.state===It.errored}isJoined(){return this.state===It.joined}isJoining(){return this.state===It.joining}isLeaving(){return this.state===It.leaving}},$o=class{static request(i,n,r,l,c,d,h){if(Hn.XDomainRequest){let m=new Hn.XDomainRequest;return this.xdomainRequest(m,i,n,l,c,d,h)}else if(Hn.XMLHttpRequest){let m=new Hn.XMLHttpRequest;return this.xhrRequest(m,i,n,r,l,c,d,h)}else{if(Hn.fetch&&Hn.AbortController)return this.fetchRequest(i,n,r,l,c,d,h);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(i,n,r,l,c,d,h){let m={method:i,headers:r,body:l},g=null;return c&&(g=new AbortController,setTimeout(()=>g.abort(),c),m.signal=g.signal),Hn.fetch(n,m).then(p=>p.text()).then(p=>this.parseJSON(p)).then(p=>h&&h(p)).catch(p=>{p.name==="AbortError"&&d?d():h&&h(null)}),g}static xdomainRequest(i,n,r,l,c,d,h){return i.timeout=c,i.open(n,r),i.onload=()=>{let m=this.parseJSON(i.responseText);h&&h(m)},d&&(i.ontimeout=d),i.onprogress=()=>{},i.send(l),i}static xhrRequest(i,n,r,l,c,d,h,m){i.open(n,r,!0),i.timeout=d;for(let[g,p]of Object.entries(l))i.setRequestHeader(g,p);return i.onerror=()=>m&&m(null),i.onreadystatechange=()=>{if(i.readyState===Db.complete&&m){let g=this.parseJSON(i.responseText);m(g)}},h&&(i.ontimeout=h),i.send(c),i}static parseJSON(i){if(!i||i==="")return null;try{return JSON.parse(i)}catch{return console&&console.log("failed to parse JSON response",i),null}}static serialize(i,n){let r=[];for(var l in i){if(!Object.prototype.hasOwnProperty.call(i,l))continue;let c=n?`${n}[${l}]`:l,d=i[l];typeof d=="object"?r.push(this.serialize(d,c)):r.push(encodeURIComponent(c)+"="+encodeURIComponent(d))}return r.join("&")}static appendParams(i,n){if(Object.keys(n).length===0)return i;let r=i.match(/\?/)?"&":"?";return`${i}${r}${this.serialize(n)}`}},Ub=i=>{let n="",r=new Uint8Array(i),l=r.byteLength;for(let c=0;c<l;c++)n+=String.fromCharCode(r[c]);return btoa(n)},vr=class{constructor(i,n){n&&n.length===2&&n[1].startsWith(Ld)&&(this.authToken=atob(n[1].slice(Ld.length))),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(i),this.readyState=qn.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(i){return i.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+Nd.websocket),"$1/"+Nd.longpoll)}endpointURL(){return $o.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(i,n,r){this.close(i,n,r),this.readyState=qn.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===qn.open||this.readyState===qn.connecting}poll(){const i={Accept:"application/json"};this.authToken&&(i["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",i,null,()=>this.ontimeout(),n=>{if(n){var{status:r,token:l,messages:c}=n;if(r===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=l}else r=0;switch(r){case 200:c.forEach(d=>{setTimeout(()=>this.onmessage({data:d}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=qn.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${r}`)}})}send(i){typeof i!="string"&&(i=Ub(i)),this.currentBatch?this.currentBatch.push(i):this.awaitingBatchAck?this.batchBuffer.push(i):(this.currentBatch=[i],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(i){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},i.join(`
15
+ `),()=>this.onerror("timeout"),n=>{this.awaitingBatchAck=!1,!n||n.status!==200?(this.onerror(n&&n.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(i,n,r){for(let c of this.reqs)c.abort();this.readyState=qn.closed;let l=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:i,reason:n,wasClean:r});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",l)):this.onclose(l)}ajax(i,n,r,l,c){let d,h=()=>{this.reqs.delete(d),l()};d=$o.request(i,this.endpointURL(),n,r,this.timeout,h,m=>{this.reqs.delete(d),this.isActive()&&c(m)}),this.reqs.add(d)}},zb=class Ys{constructor(n,r={}){let l=r.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=n,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(l.state,c=>{let{onJoin:d,onLeave:h,onSync:m}=this.caller;this.joinRef=this.channel.joinRef(),this.state=Ys.syncState(this.state,c,d,h),this.pendingDiffs.forEach(g=>{this.state=Ys.syncDiff(this.state,g,d,h)}),this.pendingDiffs=[],m()}),this.channel.on(l.diff,c=>{let{onJoin:d,onLeave:h,onSync:m}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(c):(this.state=Ys.syncDiff(this.state,c,d,h),m())})}onJoin(n){this.caller.onJoin=n}onLeave(n){this.caller.onLeave=n}onSync(n){this.caller.onSync=n}list(n){return Ys.list(this.state,n)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(n,r,l,c){let d=this.clone(n),h={},m={};return this.map(d,(g,p)=>{r[g]||(m[g]=p)}),this.map(r,(g,p)=>{let S=d[g];if(S){let b=p.metas.map(z=>z.phx_ref),T=S.metas.map(z=>z.phx_ref),A=p.metas.filter(z=>T.indexOf(z.phx_ref)<0),C=S.metas.filter(z=>b.indexOf(z.phx_ref)<0);A.length>0&&(h[g]=p,h[g].metas=A),C.length>0&&(m[g]=this.clone(S),m[g].metas=C)}else h[g]=p}),this.syncDiff(d,{joins:h,leaves:m},l,c)}static syncDiff(n,r,l,c){let{joins:d,leaves:h}=this.clone(r);return l||(l=function(){}),c||(c=function(){}),this.map(d,(m,g)=>{let p=n[m];if(n[m]=this.clone(g),p){let S=n[m].metas.map(T=>T.phx_ref),b=p.metas.filter(T=>S.indexOf(T.phx_ref)<0);n[m].metas.unshift(...b)}l(m,p,g)}),this.map(h,(m,g)=>{let p=n[m];if(!p)return;let S=g.metas.map(b=>b.phx_ref);p.metas=p.metas.filter(b=>S.indexOf(b.phx_ref)<0),c(m,p,g),p.metas.length===0&&delete n[m]}),n}static list(n,r){return r||(r=function(l,c){return c}),this.map(n,(l,c)=>r(l,c))}static map(n,r){return Object.getOwnPropertyNames(n).map(l=>r(l,n[l]))}static clone(n){return JSON.parse(JSON.stringify(n))}},No={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(i,n){if(i.payload.constructor===ArrayBuffer)return n(this.binaryEncode(i));{let r=[i.join_ref,i.ref,i.topic,i.event,i.payload];return n(JSON.stringify(r))}},decode(i,n){if(i.constructor===ArrayBuffer)return n(this.binaryDecode(i));{let[r,l,c,d,h]=JSON.parse(i);return n({join_ref:r,ref:l,topic:c,event:d,payload:h})}},binaryEncode(i){let{join_ref:n,ref:r,event:l,topic:c,payload:d}=i,h=this.META_LENGTH+n.length+r.length+c.length+l.length,m=new ArrayBuffer(this.HEADER_LENGTH+h),g=new DataView(m),p=0;g.setUint8(p++,this.KINDS.push),g.setUint8(p++,n.length),g.setUint8(p++,r.length),g.setUint8(p++,c.length),g.setUint8(p++,l.length),Array.from(n,b=>g.setUint8(p++,b.charCodeAt(0))),Array.from(r,b=>g.setUint8(p++,b.charCodeAt(0))),Array.from(c,b=>g.setUint8(p++,b.charCodeAt(0))),Array.from(l,b=>g.setUint8(p++,b.charCodeAt(0)));var S=new Uint8Array(m.byteLength+d.byteLength);return S.set(new Uint8Array(m),0),S.set(new Uint8Array(d),m.byteLength),S.buffer},binaryDecode(i){let n=new DataView(i),r=n.getUint8(0),l=new TextDecoder;switch(r){case this.KINDS.push:return this.decodePush(i,n,l);case this.KINDS.reply:return this.decodeReply(i,n,l);case this.KINDS.broadcast:return this.decodeBroadcast(i,n,l)}},decodePush(i,n,r){let l=n.getUint8(1),c=n.getUint8(2),d=n.getUint8(3),h=this.HEADER_LENGTH+this.META_LENGTH-1,m=r.decode(i.slice(h,h+l));h=h+l;let g=r.decode(i.slice(h,h+c));h=h+c;let p=r.decode(i.slice(h,h+d));h=h+d;let S=i.slice(h,i.byteLength);return{join_ref:m,ref:null,topic:g,event:p,payload:S}},decodeReply(i,n,r){let l=n.getUint8(1),c=n.getUint8(2),d=n.getUint8(3),h=n.getUint8(4),m=this.HEADER_LENGTH+this.META_LENGTH,g=r.decode(i.slice(m,m+l));m=m+l;let p=r.decode(i.slice(m,m+c));m=m+c;let S=r.decode(i.slice(m,m+d));m=m+d;let b=r.decode(i.slice(m,m+h));m=m+h;let T=i.slice(m,i.byteLength),A={status:b,response:T};return{join_ref:g,ref:p,topic:S,event:ga.reply,payload:A}},decodeBroadcast(i,n,r){let l=n.getUint8(1),c=n.getUint8(2),d=this.HEADER_LENGTH+2,h=r.decode(i.slice(d,d+l));d=d+l;let m=r.decode(i.slice(d,d+c));d=d+c;let g=i.slice(d,i.byteLength);return{join_ref:null,ref:null,topic:h,event:m,payload:g}}},Bb=class{constructor(i,n={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=n.timeout||Nb,this.transport=n.transport||Hn.WebSocket||vr,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=n.longPollFallbackMs,this.fallbackTimer=null;let r=null;try{r=Hn&&Hn.sessionStorage}catch{}this.sessionStore=n.sessionStorage||r,this.establishedConnections=0,this.defaultEncoder=No.encode.bind(No),this.defaultDecoder=No.decode.bind(No),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=n.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==vr?(this.encode=n.encode||this.defaultEncoder,this.decode=n.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let l=null;Cr&&Cr.addEventListener&&(Cr.addEventListener("pagehide",c=>{this.conn&&(this.disconnect(),l=this.connectClock)}),Cr.addEventListener("pageshow",c=>{l===this.connectClock&&(l=null,this.connect())}),Cr.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=n.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=n.autoSendHeartbeat??!0,this.heartbeatCallback=n.heartbeatCallback??(()=>{}),this.rejoinAfterMs=c=>n.rejoinAfterMs?n.rejoinAfterMs(c):[1e3,2e3,5e3][c-1]||1e4,this.reconnectAfterMs=c=>n.reconnectAfterMs?n.reconnectAfterMs(c):[10,50,100,150,200,250,500,1e3,2e3][c-1]||5e3,this.logger=n.logger||null,!this.logger&&n.debug&&(this.logger=(c,d,h)=>{console.log(`${c}: ${d}`,h)}),this.longpollerTimeout=n.longpollerTimeout||2e4,this.params=Ws(n.params||{}),this.endPoint=`${i}/${Nd.websocket}`,this.vsn=n.vsn||jb,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new zp(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(async()=>{n.beforeReconnect&&await n.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=n.authToken}getLongPollTransport(){return vr}replaceTransport(i){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=i}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let i=$o.appendParams($o.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return i.charAt(0)!=="/"?i:i.charAt(1)==="/"?`${this.protocol()}:${i}`:`${this.protocol()}://${location.host}${i}`}disconnect(i,n,r){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,i&&i()},n,r)}connect(i){i&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=Ws(i)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==vr?this.connectWithFallback(vr,this.longPollFallbackMs):this.transportConnect())}log(i,n,r){this.logger&&this.logger(i,n,r)}hasLogger(){return this.logger!==null}onOpen(i){let n=this.makeRef();return this.stateChangeCallbacks.open.push([n,i]),n}onClose(i){let n=this.makeRef();return this.stateChangeCallbacks.close.push([n,i]),n}onError(i){let n=this.makeRef();return this.stateChangeCallbacks.error.push([n,i]),n}onMessage(i){let n=this.makeRef();return this.stateChangeCallbacks.message.push([n,i]),n}onHeartbeat(i){this.heartbeatCallback=i}ping(i){if(!this.isConnected())return!1;let n=this.makeRef(),r=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:n});let l=this.onMessage(c=>{c.ref===n&&(this.off([l]),i(Date.now()-r))});return!0}transportName(i){return i===vr?"LongPoll":i.name}transportConnect(){this.connectClock++,this.closeWasClean=!1;let i;this.authToken&&(i=["phoenix",`${Ld}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),i),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=n=>this.onConnError(n),this.conn.onmessage=n=>this.onConnMessage(n),this.conn.onclose=n=>this.onConnClose(n)}getSession(i){return this.sessionStore&&this.sessionStore.getItem(i)}storeSession(i,n){this.sessionStore&&this.sessionStore.setItem(i,n)}connectWithFallback(i,n=2500){clearTimeout(this.fallbackTimer);let r=!1,l=!0,c,d,h=this.transportName(i),m=g=>{this.log("transport",`falling back to ${h}...`,g),this.off([c,d]),l=!1,this.replaceTransport(i),this.transportConnect()};if(this.getSession(`phx:fallback:${h}`))return m("memorized");this.fallbackTimer=setTimeout(m,n),d=this.onError(g=>{this.log("transport","error",g),l&&!r&&(clearTimeout(this.fallbackTimer),m(g))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(r=!0,!l){let g=this.transportName(i);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${g}`,"true"),this.log("transport",`established ${g} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(m,n),this.ping(g=>{this.log("transport","connected to primary after",g),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(i){this.log("error","error in heartbeat callback",i)}this.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),Lb,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(i,n,r){if(!this.conn)return i&&i();const l=this.conn;this.waitForBufferDone(l,()=>{n?l.close(n,r||""):l.close(),this.waitForSocketClosed(l,()=>{this.conn===l&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),i&&i()})})}waitForBufferDone(i,n,r=1){if(r===5||!i.bufferedAmount){n();return}setTimeout(()=>{this.waitForBufferDone(i,n,r+1)},150*r)}waitForSocketClosed(i,n,r=1){if(r===5||i.readyState===qn.closed){n();return}setTimeout(()=>{this.waitForSocketClosed(i,n,r+1)},150*r)}onConnClose(i){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",i),this.triggerChanError(i),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",i)}onConnError(i){this.hasLogger()&&this.log("transport","error",i);let n=this.transport,r=this.establishedConnections;this.triggerStateCallbacks("error",i,n,r),(n===this.transport||r>0)&&this.triggerChanError(i)}triggerChanError(i){this.channels.forEach(n=>{n.isErrored()||n.isLeaving()||n.isClosed()||n.trigger(ga.error,i)})}connectionState(){switch(this.conn&&this.conn.readyState){case qn.connecting:return"connecting";case qn.open:return"open";case qn.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(i){this.off(i.stateChangeRefs),this.channels=this.channels.filter(n=>n!==i)}off(i){for(let n in this.stateChangeCallbacks)this.stateChangeCallbacks[n]=this.stateChangeCallbacks[n].filter(([r])=>i.indexOf(r)===-1)}channel(i,n={}){let r=new Mb(i,n,this);return this.channels.push(r),r}push(i){if(this.hasLogger()){let{topic:n,event:r,payload:l,ref:c,join_ref:d}=i;this.log("push",`${n} ${r} (${d}, ${c})`,l)}this.isConnected()?this.encode(i,n=>this.conn.send(n)):this.sendBuffer.push(()=>this.encode(i,n=>this.conn.send(n)))}makeRef(){let i=this.ref+1;return i===this.ref?this.ref=0:this.ref=i,this.ref.toString()}sendHeartbeat(){if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(i){this.log("error","error in heartbeat callback",i)}return}if(this.pendingHeartbeatRef){this.heartbeatTimeout();return}this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(i){this.log("error","error in heartbeat callback",i)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(i=>i()),this.sendBuffer=[])}onConnMessage(i){this.decode(i.data,n=>{let{topic:r,event:l,payload:c,ref:d,join_ref:h}=n;if(d&&d===this.pendingHeartbeatRef){const m=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(c.status==="ok"?"ok":"error",m)}catch(g){this.log("error","error in heartbeat callback",g)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${c.status||""} ${r} ${l} ${d&&"("+d+")"||""}`.trim(),c);for(let m=0;m<this.channels.length;m++){const g=this.channels[m];g.isMember(r,l,c,h)&&g.trigger(l,c,d,h)}this.triggerStateCallbacks("message",n)})}triggerStateCallbacks(i,...n){try{this.stateChangeCallbacks[i].forEach(([r,l])=>{try{l(...n)}catch(c){this.log("error",`error in ${i} callback`,c)}})}catch(r){this.log("error",`error triggering ${i} callbacks`,r)}}leaveOpenTopic(i){let n=this.channels.find(r=>r.topic===i&&(r.isJoined()||r.isJoining()));n&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${i}"`),n.leave())}};class Qs{constructor(n,r){const l=qb(r);this.presence=new zb(n.getChannel(),l),this.presence.onJoin((c,d,h)=>{const m=Qs.onJoinPayload(c,d,h);n.getChannel().trigger("presence",m)}),this.presence.onLeave((c,d,h)=>{const m=Qs.onLeavePayload(c,d,h);n.getChannel().trigger("presence",m)}),this.presence.onSync(()=>{n.getChannel().trigger("presence",{event:"sync"})})}get state(){return Qs.transformState(this.presence.state)}static transformState(n){return n=Hb(n),Object.getOwnPropertyNames(n).reduce((r,l)=>{const c=n[l];return r[l]=Ho(c),r},{})}static onJoinPayload(n,r,l){const c=Kg(r),d=Ho(l);return{event:"join",key:n,currentPresences:c,newPresences:d}}static onLeavePayload(n,r,l){const c=Kg(r),d=Ho(l);return{event:"leave",key:n,currentPresences:c,leftPresences:d}}}function Ho(i){return i.metas.map(n=>(n.presence_ref=n.phx_ref,delete n.phx_ref,delete n.phx_ref_prev,n))}function Hb(i){return JSON.parse(JSON.stringify(i))}function qb(i){return i?.events&&{events:i.events}}function Kg(i){return i?.metas?Ho(i):[]}var Yg;(function(i){i.SYNC="sync",i.JOIN="join",i.LEAVE="leave"})(Yg||(Yg={}));class $b{get state(){return this.presenceAdapter.state}constructor(n,r){this.channel=n,this.presenceAdapter=new Qs(this.channel.channelAdapter,r)}}function Pb(i){if(i instanceof Error)return i;if(typeof i=="string")return new Error(i);if(i&&typeof i=="object"){const n=i;if(typeof n.code=="number"){const r=typeof n.reason=="string"&&n.reason?` (${n.reason})`:"";return new Error(`socket closed: ${n.code}${r}`,{cause:i})}return new Error("channel error: transport failure",{cause:i})}return new Error("channel error: connection lost")}class Ib{constructor(n,r,l){const c=Gb(l);this.channel=n.getSocket().channel(r,c),this.socket=n}get state(){return this.channel.state}set state(n){this.channel.state=n}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(n,r){return this.channel.on(n,r)}off(n,r){this.channel.off(n,r)}subscribe(n){return this.channel.join(n)}unsubscribe(n){return this.channel.leave(n)}teardown(){this.channel.teardown()}onClose(n){this.channel.onClose(n)}onError(n){return this.channel.onError(n)}push(n,r,l){let c;try{c=this.channel.push(n,r,l)}catch{throw new Error(`tried to push '${n}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>_b){const d=this.channel.pushBuffer.shift();d.cancelTimeout(),this.socket.log("channel",`discarded push due to buffer overflow: ${d.event}`,d.payload())}return c}updateJoinPayload(n){const r=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},r),n)}canPush(){return this.socket.isConnected()&&this.state===Xa.joined}isJoined(){return this.state===Xa.joined}isJoining(){return this.state===Xa.joining}isClosed(){return this.state===Xa.closed}isLeaving(){return this.state===Xa.leaving}updateFilterBindings(n){this.channel.filterBindings=n}updatePayloadTransform(n){this.channel.onMessage=n}getChannel(){return this.channel}}function Gb(i){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},i.config)}}const Vb=/[,()"\\]/,Kb=i=>Vb.test(i)||i!==i.trim(),Yb=i=>`"${i.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,Jg=i=>{const n=i===null?"null":String(i);return Kb(n)?Yb(n):n},Jb=i=>i===null?"null":String(i),Xb=(i,n)=>{if(i==="in"){const r=Array.isArray(n)?n:[n];if(r.length===0)throw new Error("Realtime `in` filter requires at least one value.");return`in.(${Array.from(new Set(r)).map(c=>Jg(c)).join(",")})`}return i==="is"?`is.${Jb(n)}`:`${i}.${Jg(n)}`};class Wb{constructor(){this.filters=[]}add(n,r,l,c=!1){const d=c?"not.":"";return this.filters.push(`${n}=${d}${Xb(r,l)}`),this}eq(n,r){return this.add(n,"eq",r)}neq(n,r){return this.add(n,"neq",r)}gt(n,r){return this.add(n,"gt",r)}gte(n,r){return this.add(n,"gte",r)}lt(n,r){return this.add(n,"lt",r)}lte(n,r){return this.add(n,"lte",r)}in(n,r){return this.add(n,"in",r)}like(n,r){return this.add(n,"like",r)}ilike(n,r){return this.add(n,"ilike",r)}match(n,r){return this.add(n,"match",r)}imatch(n,r){return this.add(n,"imatch",r)}is(n,r){return this.add(n,"is",r)}isDistinct(n,r){return this.add(n,"isdistinct",r)}not(n,r,l){return this.add(n,r,l,!0)}build(){return this.filters.join(",")}toString(){return this.build()}}var Xg;(function(i){i.ALL="*",i.INSERT="INSERT",i.UPDATE="UPDATE",i.DELETE="DELETE"})(Xg||(Xg={}));var Nr;(function(i){i.BROADCAST="broadcast",i.PRESENCE="presence",i.POSTGRES_CHANGES="postgres_changes",i.SYSTEM="system"})(Nr||(Nr={}));var pa;(function(i){i.SUBSCRIBED="SUBSCRIBED",i.TIMED_OUT="TIMED_OUT",i.CLOSED="CLOSED",i.CHANNEL_ERROR="CHANNEL_ERROR"})(pa||(pa={}));class Zs{get state(){return this.channelAdapter.state}set state(n){this.channelAdapter.state=n}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(n,r={config:{}},l){var c,d;if(this.topic=n,this.params=r,this.socket=l,this.bindings={},this.subTopic=n.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},r.config),this.channelAdapter=new Ib(this.socket.socketAdapter,n,this.params),this.presence=new $b(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=Up(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(!((d=(c=this.params.config)===null||c===void 0?void 0:c.broadcast)===null||d===void 0)&&d.replay))throw new Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(n,r=this.timeout){var l,c,d;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:h,presence:m,private:g}}=this.params,p=(c=(l=this.bindings.postgres_changes)===null||l===void 0?void 0:l.map(A=>A.filter))!==null&&c!==void 0?c:[],S=!!this.bindings[Nr.PRESENCE]&&this.bindings[Nr.PRESENCE].length>0||((d=this.params.config.presence)===null||d===void 0?void 0:d.enabled)===!0,b={},T={broadcast:h,presence:Object.assign(Object.assign({},m),{enabled:S}),postgres_changes:p,private:g};this.socket.accessTokenValue&&(b.access_token=this.socket.accessTokenValue),this._onError(A=>{n?.(pa.CHANNEL_ERROR,Pb(A))}),this._onClose(()=>n?.(pa.CLOSED)),this.updateJoinPayload(Object.assign({config:T},b)),this._updateFilterMessage(),this.channelAdapter.subscribe(r).receive("ok",async({postgres_changes:A})=>{if(this.socket._isManualToken()||this.socket.setAuth(),A===void 0){n?.(pa.SUBSCRIBED);return}this._updatePostgresBindings(A,n)}).receive("error",A=>{this.state=Xa.errored;const C=Object.values(A).join(", ")||"error";n?.(pa.CHANNEL_ERROR,new Error(C,{cause:A}))}).receive("timeout",()=>{n?.(pa.TIMED_OUT)})}return this}_updatePostgresBindings(n,r){var l;const c=this.bindings.postgres_changes,d=(l=c?.length)!==null&&l!==void 0?l:0,h=[];for(let m=0;m<d;m++){const g=c[m],{filter:{event:p,schema:S,table:b,filter:T}}=g,A=n&&n[m];if(A&&A.event===p&&Zs.isFilterValueEqual(A.schema,S)&&Zs.isFilterValueEqual(A.table,b)&&Zs.isFilterValueEqual(A.filter,T))h.push(Object.assign(Object.assign({},g),{id:A.id}));else{this.unsubscribe(),this.state=Xa.errored,r?.(pa.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=h,this.state!=Xa.errored&&r&&r(pa.SUBSCRIBED)}presenceState(){return this.presence.state}async track(n,r={}){return await this.send({type:"presence",event:"track",payload:n},r.timeout||this.timeout)}async untrack(n={}){return await this.send({type:"presence",event:"untrack"},n)}on(n,r,l){const c=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),d=n===Nr.PRESENCE||n===Nr.POSTGRES_CHANGES;if(c&&d)throw this.socket.log("channel",`cannot add \`${n}\` callbacks for ${this.topic} after \`subscribe()\`.`),new Error(`cannot add \`${n}\` callbacks for ${this.topic} after \`subscribe()\`.`);return this._on(n,r,l)}async httpSend(n,r,l={}){var c;if(r==null)return Promise.reject(new Error("Payload is required for httpSend()"));const d=r instanceof ArrayBuffer||ArrayBuffer.isView(r),h={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":d?"application/octet-stream":"application/json"};this.socket.accessTokenValue&&(h.Authorization=`Bearer ${this.socket.accessTokenValue}`);const m=new URL(this.broadcastEndpointURL);m.pathname+=`/${encodeURIComponent(this.subTopic)}/events/${encodeURIComponent(n)}`,this.private&&m.searchParams.set("private","true");const g={method:"POST",headers:h,body:d?r:JSON.stringify(r)},p=await this._fetchWithTimeout(m.toString(),g,(c=l.timeout)!==null&&c!==void 0?c:this.timeout);if(p.status===202)return{success:!0};if(p.status===404)return Promise.reject(new Error("httpSend() requires Realtime server v2.97.0 or newer; the endpoint returned 404. Update your Supabase CLI to a recent version, or upgrade the Realtime server in your self-hosted setup. See https://github.com/supabase/supabase-js/blob/master/packages/core/realtime-js/migrations/httpsend-server-version.md"));let S=p.statusText;try{const b=await p.json();S=b.error||b.message||S}catch{}return Promise.reject(new Error(S))}async send(n,r={}){var l,c;if(!this.channelAdapter.canPush()&&n.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:d,payload:h}=n,m={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(m.Authorization=`Bearer ${this.socket.accessTokenValue}`);const g={method:"POST",headers:m,body:JSON.stringify({messages:[{topic:this.subTopic,event:d,payload:h,private:this.private}]})};try{const p=await this._fetchWithTimeout(this.broadcastEndpointURL,g,(l=r.timeout)!==null&&l!==void 0?l:this.timeout);return await((c=p.body)===null||c===void 0?void 0:c.cancel()),p.ok?"ok":"error"}catch(p){return p instanceof Error&&p.name==="AbortError"?"timed out":"error"}}else return new Promise(d=>{var h,m,g;const p=this.channelAdapter.push(n.type,n,r.timeout||this.timeout);n.type==="broadcast"&&!(!((g=(m=(h=this.params)===null||h===void 0?void 0:h.config)===null||m===void 0?void 0:m.broadcast)===null||g===void 0)&&g.ack)&&d("ok"),p.receive("ok",()=>d("ok")),p.receive("error",()=>d("error")),p.receive("timeout",()=>d("timed out"))})}updateJoinPayload(n){this.channelAdapter.updateJoinPayload(n)}async unsubscribe(n=this.timeout){return new Promise(r=>{this.channelAdapter.unsubscribe(n).receive("ok",()=>r("ok")).receive("timeout",()=>r("timed out")).receive("error",()=>r("error"))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(n,r,l){const c=new AbortController,d=setTimeout(()=>c.abort(),l),h=await this.socket.fetch(n,Object.assign(Object.assign({},r),{signal:c.signal}));return clearTimeout(d),h}_on(n,r,l){const c=n.toLocaleLowerCase(),d=r?.filter;(d instanceof Wb||typeof d=="object"&&d!==null&&typeof d.build=="function")&&(r=Object.assign(Object.assign({},r),{filter:d.build()}));const h=this.channelAdapter.on(n,l),m={type:c,filter:r,callback:l,ref:h};return this.bindings[c]?this.bindings[c].push(m):this.bindings[c]=[m],this._updateFilterMessage(),this}_onClose(n){this.channelAdapter.onClose(n)}_onError(n){this.channelAdapter.onError(n)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((n,r,l)=>{var c,d,h,m,g,p,S;const b=n.event.toLocaleLowerCase();if(this._notThisChannelEvent(b,l))return!1;const T=(c=this.bindings[b])===null||c===void 0?void 0:c.find(A=>A.ref===n.ref);if(!T)return!0;if(["broadcast","presence","postgres_changes"].includes(b))if("id"in T){const A=T.id,C=(d=T.filter)===null||d===void 0?void 0:d.event;return A&&((h=r.ids)===null||h===void 0?void 0:h.includes(A))&&(C==="*"||C?.toLocaleLowerCase()===((m=r.data)===null||m===void 0?void 0:m.type.toLocaleLowerCase()))}else{const A=(p=(g=T?.filter)===null||g===void 0?void 0:g.event)===null||p===void 0?void 0:p.toLocaleLowerCase();return A==="*"||A===((S=r?.event)===null||S===void 0?void 0:S.toLocaleLowerCase())}else return T.type.toLocaleLowerCase()===b})}_notThisChannelEvent(n,r){const{close:l,error:c,leave:d,join:h}=Dp;return r&&[l,c,d,h].includes(n)&&r!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((n,r,l)=>{if(typeof r=="object"&&"ids"in r){const c=r.data,{schema:d,table:h,commit_timestamp:m,type:g,errors:p}=c;return Object.assign(Object.assign({},{schema:d,table:h,commit_timestamp:m,eventType:g,new:{},old:{},errors:p}),this._getPayloadRecords(c))}return r})}copyBindings(n){if(this.joinedOnce)throw new Error("cannot copy bindings into joined channel");for(const r in n.bindings)for(const l of n.bindings[r])this._on(l.type,l.filter,l.callback)}static isFilterValueEqual(n,r){return(n??void 0)===(r??void 0)}_getPayloadRecords(n){const r={new:{},old:{}};return(n.type==="INSERT"||n.type==="UPDATE")&&(r.new=Vg(n.columns,n.record)),(n.type==="UPDATE"||n.type==="DELETE")&&(r.old=Vg(n.columns,n.old_record)),r}}class Qb{constructor(n,r){this.socket=new Bb(n,r)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(n){this.socket.heartbeatCallback=n}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(n,r,l,c=1e4){return new Promise(d=>{setTimeout(()=>d("timeout"),c),this.socket.disconnect(()=>{n(),d("ok")},r,l)})}push(n){this.socket.push(n)}log(n,r,l){this.socket.log(n,r,l)}makeRef(){return this.socket.makeRef()}onOpen(n){this.socket.onOpen(n)}onClose(n){this.socket.onClose(n)}onError(n){this.socket.onError(n)}onMessage(n){this.socket.onMessage(n)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==Rd.connecting}isDisconnecting(){return this.socket.connectionState()==Rd.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const Wg={HEARTBEAT_INTERVAL:25e3},Zb=[1e3,2e3,5e3,1e4],Fb=1e4;function eS(){const i=new Map;return{get length(){return i.size},clear(){i.clear()},getItem(n){return i.has(n)?i.get(n):null},key(n){var r;return(r=Array.from(i.keys())[n])!==null&&r!==void 0?r:null},removeItem(n){i.delete(n)},setItem(n,r){i.set(n,String(r))}}}function tS(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return eS()}const nS=`
16
+ addEventListener("message", (e) => {
17
+ if (e.data.event === "start") {
18
+ setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
19
+ }
20
+ });`;class aS{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(n,r){var l;if(this.channels=new Array,this.accessTokenValue=null,this.accessToken=null,this.apiKey=null,this.httpEndpoint="",this.headers={},this.params={},this.ref=0,this.serializer=new Tb,this._manuallySetToken=!1,this._authPromise=null,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._pendingDisconnectTimer=null,this._disconnectOnEmptyChannelsAfterMs=0,this._resolveFetch=d=>d?(...h)=>d(...h):(...h)=>fetch(...h),!(!((l=r?.params)===null||l===void 0)&&l.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=r.params.apikey;const c=this._initializeOptions(r);this.socketAdapter=new Qb(n,c),this.httpEndpoint=Up(n),this.fetch=this._resolveFetch(r?.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(n){const r=n.message;throw new Error(`WebSocket not available: ${r}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(n,r){return this._cancelPendingDisconnect(),this.isDisconnecting()?"ok":await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},n,r)}getChannels(){return this.channels}async removeChannel(n){const r=await n.unsubscribe();return r==="ok"&&n.teardown(),r}async removeAllChannels(){const n=this.channels.map(async l=>{const c=await l.unsubscribe();return l.teardown(),c}),r=await Promise.all(n);return await this.disconnect(),r}log(n,r,l){this.socketAdapter.log(n,r,l)}connectionState(){return this.socketAdapter.connectionState()||Rd.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(n,r={config:{}}){const l=`realtime:${n}`,c=this.getChannels().find(d=>d.topic===l);if(c)return c;{const d=new Zs(`realtime:${n}`,r,this);return this._cancelPendingDisconnect(),this.channels.push(d),d}}push(n){this.socketAdapter.push(n)}async setAuth(n=null){this._authPromise=this._performAuth(n);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(n){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(n)}_makeRef(){return this.socketAdapter.makeRef()}_remove(n){this.channels=this.channels.filter(r=>r.topic!==n.topic),this.channels.length===0&&(this.log("transport","no channels remaining, scheduling disconnect"),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),this._disconnectOnEmptyChannelsAfterMs===0){this.log("transport","disconnecting immediately - no channels"),this.disconnect();return}this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,this.channels.length===0&&(this.log("transport","deferred disconnect fired - no channels, disconnecting"),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log("transport",`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){this._pendingDisconnectTimer!==null&&(this.log("transport","pending disconnect cancelled - channel activity detected"),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(n=null){let r,l=!1;if(n)r=n,l=!0;else if(this.accessToken)try{r=await this.accessToken()}catch(c){this.log("error","Error fetching access token from callback",c),r=this.accessTokenValue}else r=this.accessTokenValue;l?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=r&&(this.accessTokenValue=r,this.channels.forEach(c=>{const d={access_token:r,version:vb};r&&c.updateJoinPayload(d),c.joinedOnce&&c.channelAdapter.isJoined()&&c.channelAdapter.push(Dp.access_token,{access_token:r})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(n="general"){this._isManualToken()||this.setAuth().catch(r=>{this.log("error",`Error setting auth in ${n}`,r)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(r=>{this.log("error","error waiting for auth on connect",r)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(n=>{n.ref&&n.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(n){return(r,l)=>{r=="sent"&&this._setAuthSafely(),n&&n(r,l)}}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const n=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(n),this.workerRef.onerror=r=>{this.log("worker","worker error",r.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=r=>{r.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_workerObjectUrl(n){let r;if(n)r=n;else{const l=new Blob([nS],{type:"application/javascript"});r=URL.createObjectURL(l)}return r}_initializeOptions(n){var r,l,c,d,h,m,g,p,S,b,T,A;this.worker=(r=n?.worker)!==null&&r!==void 0?r:!1,this.accessToken=(l=n?.accessToken)!==null&&l!==void 0?l:null;const C={};C.timeout=(c=n?.timeout)!==null&&c!==void 0?c:wb,C.heartbeatIntervalMs=(d=n?.heartbeatIntervalMs)!==null&&d!==void 0?d:Wg.HEARTBEAT_INTERVAL,this._disconnectOnEmptyChannelsAfterMs=(h=n?.disconnectOnEmptyChannelsAfterMs)!==null&&h!==void 0?h:2*((m=n?.heartbeatIntervalMs)!==null&&m!==void 0?m:Wg.HEARTBEAT_INTERVAL),C.transport=(g=n?.transport)!==null&&g!==void 0?g:pb.getWebSocketConstructor(),C.params=n?.params,C.logger=n?.logger,C.heartbeatCallback=this._wrapHeartbeatCallback(n?.heartbeatCallback),C.sessionStorage=(p=n?.sessionStorage)!==null&&p!==void 0?p:tS(),C.reconnectAfterMs=(S=n?.reconnectAfterMs)!==null&&S!==void 0?S:($=>Zb[$-1]||Fb);let z,G;const I=(b=n?.vsn)!==null&&b!==void 0?b:Sb;switch(I){case bb:z=($,O)=>O(JSON.stringify($)),G=($,O)=>O(JSON.parse($));break;case Lp:z=this.serializer.encode.bind(this.serializer),G=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${C.vsn}`)}if(C.vsn=I,C.encode=(T=n?.encode)!==null&&T!==void 0?T:z,C.decode=(A=n?.decode)!==null&&A!==void 0?A:G,C.beforeReconnect=this._reconnectAuth.bind(this),(n?.logLevel||n?.log_level)&&(this.logLevel=n.logLevel||n.log_level,C.params=Object.assign(Object.assign({},C.params),{log_level:this.logLevel})),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=n?.workerUrl,C.autoSendHeartbeat=!this.worker}return C}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}var il=class extends Error{constructor(i,n){super(i),this.name="IcebergError",this.status=n.status,this.icebergType=n.icebergType,this.icebergCode=n.icebergCode,this.details=n.details,this.isCommitStateUnknown=n.icebergType==="CommitStateUnknownException"||[500,502,504].includes(n.status)&&n.icebergType?.includes("CommitState")===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function iS(i,n,r){const l=new URL(n,i);if(r)for(const[c,d]of Object.entries(r))d!==void 0&&l.searchParams.set(c,d);return l.toString()}async function rS(i){return!i||i.type==="none"?{}:i.type==="bearer"?{Authorization:`Bearer ${i.token}`}:i.type==="header"?{[i.name]:i.value}:i.type==="custom"?await i.getHeaders():{}}function sS(i){const n=i.fetchImpl??globalThis.fetch;return{async request({method:r,path:l,query:c,body:d,headers:h}){const m=iS(i.baseUrl,l,c),g=await rS(i.auth),p=await n(m,{method:r,headers:{...d?{"Content-Type":"application/json"}:{},...g,...h},body:d?JSON.stringify(d):void 0}),S=await p.text(),b=(p.headers.get("content-type")||"").includes("application/json"),T=b&&S?JSON.parse(S):S;if(!p.ok){const A=b?T:void 0,C=A?.error;throw new il(C?.message??`Request failed with status ${p.status}`,{status:p.status,icebergType:C?.type,icebergCode:C?.code,details:A})}return{status:p.status,headers:p.headers,data:T}}}}function Lo(i){return i.join("")}var lS=class{constructor(i,n=""){this.client=i,this.prefix=n}async listNamespaces(i){const n=i?{parent:Lo(i.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:n})).data.namespaces.map(l=>({namespace:l}))}async createNamespace(i,n){const r={namespace:i.namespace,properties:n?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:r})).data}async dropNamespace(i){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Lo(i.namespace)}`})}async loadNamespaceMetadata(i){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Lo(i.namespace)}`})).data.properties}}async namespaceExists(i){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Lo(i.namespace)}`}),!0}catch(n){if(n instanceof il&&n.status===404)return!1;throw n}}async createNamespaceIfNotExists(i,n){try{return await this.createNamespace(i,n)}catch(r){if(r instanceof il&&r.status===409)return;throw r}}};function br(i){return i.join("")}var oS=class{constructor(i,n="",r){this.client=i,this.prefix=n,this.accessDelegation=r}async listTables(i){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${br(i.namespace)}/tables`})).data.identifiers}async createTable(i,n){const r={};return this.accessDelegation&&(r["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${br(i.namespace)}/tables`,body:n,headers:r})).data.metadata}async updateTable(i,n){const r=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${br(i.namespace)}/tables/${i.name}`,body:n});return{"metadata-location":r.data["metadata-location"],metadata:r.data.metadata}}async dropTable(i,n){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${br(i.namespace)}/tables/${i.name}`,query:{purgeRequested:String(n?.purge??!1)}})}async loadTable(i){const n={};return this.accessDelegation&&(n["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${br(i.namespace)}/tables/${i.name}`,headers:n})).data.metadata}async tableExists(i){const n={};this.accessDelegation&&(n["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${br(i.namespace)}/tables/${i.name}`,headers:n}),!0}catch(r){if(r instanceof il&&r.status===404)return!1;throw r}}async createTableIfNotExists(i,n){try{return await this.createTable(i,n)}catch(r){if(r instanceof il&&r.status===409)return await this.loadTable({namespace:i.namespace,name:n.name});throw r}}},cS=class{constructor(i){let n="v1";i.catalogName&&(n+=`/${i.catalogName}`);const r=i.baseUrl.endsWith("/")?i.baseUrl:`${i.baseUrl}/`;this.client=sS({baseUrl:r,auth:i.auth,fetchImpl:i.fetch}),this.accessDelegation=i.accessDelegation?.join(","),this.namespaceOps=new lS(this.client,n),this.tableOps=new oS(this.client,n,this.accessDelegation)}async listNamespaces(i){return this.namespaceOps.listNamespaces(i)}async createNamespace(i,n){return this.namespaceOps.createNamespace(i,n)}async dropNamespace(i){await this.namespaceOps.dropNamespace(i)}async loadNamespaceMetadata(i){return this.namespaceOps.loadNamespaceMetadata(i)}async listTables(i){return this.tableOps.listTables(i)}async createTable(i,n){return this.tableOps.createTable(i,n)}async updateTable(i,n){return this.tableOps.updateTable(i,n)}async dropTable(i,n){await this.tableOps.dropTable(i,n)}async loadTable(i){return this.tableOps.loadTable(i)}async namespaceExists(i){return this.namespaceOps.namespaceExists(i)}async tableExists(i){return this.tableOps.tableExists(i)}async createNamespaceIfNotExists(i,n){return this.namespaceOps.createNamespaceIfNotExists(i,n)}async createTableIfNotExists(i,n){return this.tableOps.createTableIfNotExists(i,n)}};function rl(i){"@babel/helpers - typeof";return rl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},rl(i)}function uS(i,n){if(rl(i)!="object"||!i)return i;var r=i[Symbol.toPrimitive];if(r!==void 0){var l=r.call(i,n);if(rl(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(i)}function dS(i){var n=uS(i,"string");return rl(n)=="symbol"?n:n+""}function hS(i,n,r){return(n=dS(n))in i?Object.defineProperty(i,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):i[n]=r,i}function Qg(i,n){var r=Object.keys(i);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(i);n&&(l=l.filter(function(c){return Object.getOwnPropertyDescriptor(i,c).enumerable})),r.push.apply(r,l)}return r}function ce(i){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?Qg(Object(r),!0).forEach(function(l){hS(i,l,r[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(r)):Qg(Object(r)).forEach(function(l){Object.defineProperty(i,l,Object.getOwnPropertyDescriptor(r,l))})}return i}var Wo=class extends Error{constructor(i,n="storage",r,l){super(i),this.__isStorageError=!0,this.namespace=n,this.name=n==="vectors"?"StorageVectorsError":"StorageError",this.status=r,this.statusCode=l}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function Qo(i){return typeof i=="object"&&i!==null&&"__isStorageError"in i}var Dd=class extends Wo{constructor(i,n,r,l="storage"){super(i,l,n,r),this.name=l==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=n,this.statusCode=r}toJSON(){return ce({},super.toJSON())}},Bp=class extends Wo{constructor(i,n,r="storage"){super(i,r),this.name=r==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=n}};function Po(i,n,r){const l=ce({},i),c=n.toLowerCase();for(const d of Object.keys(l))d.toLowerCase()===c&&delete l[d];return l[c]=r,l}function fS(i){const n={};for(const[r,l]of Object.entries(i))n[r.toLowerCase()]=l;return n}const mS=i=>i?(...n)=>i(...n):(...n)=>fetch(...n),gS=i=>{if(typeof i!="object"||i===null)return!1;const n=Object.getPrototypeOf(i);return(n===null||n===Object.prototype||Object.getPrototypeOf(n)===null)&&!(Symbol.toStringTag in i)&&!(Symbol.iterator in i)},Md=i=>{if(Array.isArray(i))return i.map(r=>Md(r));if(typeof i=="function"||i!==Object(i))return i;const n={};return Object.entries(i).forEach(([r,l])=>{const c=r.replace(/([-_][a-z])/gi,d=>d.toUpperCase().replace(/[-_]/g,""));n[c]=Md(l)}),n},pS=i=>!i||typeof i!="string"||i.length===0||i.length>100||i.trim()!==i||i.includes("/")||i.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(i),Zg=i=>{if(typeof i=="object"&&i!==null){const n=i;if(typeof n.msg=="string")return n.msg;if(typeof n.message=="string")return n.message;if(typeof n.error_description=="string")return n.error_description;if(typeof n.error=="string")return n.error;if(typeof n.error=="object"&&n.error!==null){const r=n.error;if(typeof r.message=="string")return r.message}}return JSON.stringify(i)},yS=async(i,n,r,l)=>{if(i!==null&&typeof i=="object"&&"json"in i&&typeof i.json=="function"){const c=i;let d=parseInt(String(c.status),10);Number.isFinite(d)||(d=500),c.json().then(h=>{const m=h?.statusCode||h?.code||d+"";n(new Dd(Zg(h),d,m,l))}).catch(()=>{const h=d+"";n(new Dd(c.statusText||`HTTP ${d} error`,d,h,l))})}else n(new Bp(Zg(i),i,l))},vS=(i,n,r,l)=>{const c={method:i,headers:n?.headers||{}};if(i==="GET"||i==="HEAD"||!l)return ce(ce({},c),r);if(gS(l)){var d;const h=n?.headers||{};let m;for(const[g,p]of Object.entries(h))g.toLowerCase()==="content-type"&&(m=p);c.headers=Po(h,"Content-Type",(d=m)!==null&&d!==void 0?d:"application/json"),c.body=JSON.stringify(l)}else c.body=l;return n?.duplex&&(c.duplex=n.duplex),ce(ce({},c),r)};async function Is(i,n,r,l,c,d,h){return new Promise((m,g)=>{i(r,vS(n,l,c,d)).then(p=>{if(!p.ok)throw p;if(l?.noResolveJson)return p;if(h==="vectors"){const S=p.headers.get("content-type");if(p.headers.get("content-length")==="0"||p.status===204)return{};if(!S||!S.includes("application/json"))return{}}return p.json()}).then(p=>m(p)).catch(p=>yS(p,g,l,h))})}function Hp(i="storage"){return{get:async(n,r,l,c)=>Is(n,"GET",r,l,c,void 0,i),post:async(n,r,l,c,d)=>Is(n,"POST",r,c,d,l,i),put:async(n,r,l,c,d)=>Is(n,"PUT",r,c,d,l,i),head:async(n,r,l,c)=>Is(n,"HEAD",r,ce(ce({},l),{},{noResolveJson:!0}),c,void 0,i),remove:async(n,r,l,c,d)=>Is(n,"DELETE",r,c,d,l,i)}}const bS=Hp("storage"),{get:sl,post:En,put:Ud,head:SS,remove:ll}=bS,nn=Hp("vectors");var Ur=class{constructor(i,n={},r,l="storage"){this.shouldThrowOnError=!1,this.url=i,this.headers=fS(n),this.fetch=mS(r),this.namespace=l}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(i,n){return this.headers=Po(this.headers,i,n),this}async handleOperation(i){var n=this;try{return{data:await i(),error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(Qo(r))return{data:null,error:r};throw r}}};let qp;qp=Symbol.toStringTag;var wS=class{constructor(i,n){this.downloadFn=i,this.shouldThrowOnError=n,this[qp]="StreamDownloadBuilder",this.promise=null}then(i,n){return this.getPromise().then(i,n)}catch(i){return this.getPromise().catch(i)}finally(i){return this.getPromise().finally(i)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var i=this;try{return{data:(await i.downloadFn()).body,error:null}}catch(n){if(i.shouldThrowOnError)throw n;if(Qo(n))return{data:null,error:n};throw n}}};let $p;$p=Symbol.toStringTag;var _S=class{constructor(i,n){this.downloadFn=i,this.shouldThrowOnError=n,this[$p]="BlobDownloadBuilder",this.promise=null}asStream(){return new wS(this.downloadFn,this.shouldThrowOnError)}then(i,n){return this.getPromise().then(i,n)}catch(i){return this.getPromise().catch(i)}finally(i){return this.getPromise().finally(i)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var i=this;try{return{data:await(await i.downloadFn()).blob(),error:null}}catch(n){if(i.shouldThrowOnError)throw n;if(Qo(n))return{data:null,error:n};throw n}}};const hd={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Fg={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var TS=class extends Ur{constructor(i,n={},r,l){super(i,n,l,"storage"),this.bucketId=r}async uploadOrUpdate(i,n,r,l){var c=this;return c.handleOperation(async()=>{let d;const h=ce(ce({},Fg),l);let m=ce(ce({},c.headers),i==="POST"&&{"x-upsert":String(h.upsert)});const g=h.metadata;if(typeof Blob<"u"&&r instanceof Blob?(d=new FormData,d.append("cacheControl",h.cacheControl),g&&d.append("metadata",c.encodeMetadata(g)),d.append("",r)):typeof FormData<"u"&&r instanceof FormData?(d=r,d.has("cacheControl")||d.append("cacheControl",h.cacheControl),g&&!d.has("metadata")&&d.append("metadata",c.encodeMetadata(g))):(d=r,m["cache-control"]=`max-age=${h.cacheControl}`,m["content-type"]=h.contentType,g&&(m["x-metadata"]=c.toBase64(c.encodeMetadata(g))),(typeof ReadableStream<"u"&&d instanceof ReadableStream||d&&typeof d=="object"&&"pipe"in d&&typeof d.pipe=="function")&&!h.duplex&&(h.duplex="half")),l?.headers)for(const[T,A]of Object.entries(l.headers))m=Po(m,T,A);const p=c._removeEmptyFolders(n),S=c._getFinalPath(p),b=await(i=="PUT"?Ud:En)(c.fetch,`${c.url}/object/${S}`,d,ce({headers:m},h?.duplex?{duplex:h.duplex}:{}));return{path:p,id:b.Id,fullPath:b.Key}})}async upload(i,n,r){return this.uploadOrUpdate("POST",i,n,r)}async uploadToSignedUrl(i,n,r,l){var c=this;const d=c._removeEmptyFolders(i),h=c._getFinalPath(d),m=new URL(c.url+`/object/upload/sign/${h}`);return m.searchParams.set("token",n),c.handleOperation(async()=>{let g;const p=ce(ce({},Fg),l);let S=ce(ce({},c.headers),{"x-upsert":String(p.upsert)});const b=p.metadata;if(typeof Blob<"u"&&r instanceof Blob?(g=new FormData,g.append("cacheControl",p.cacheControl),b&&g.append("metadata",c.encodeMetadata(b)),g.append("",r)):typeof FormData<"u"&&r instanceof FormData?(g=r,g.has("cacheControl")||g.append("cacheControl",p.cacheControl),b&&!g.has("metadata")&&g.append("metadata",c.encodeMetadata(b))):(g=r,S["cache-control"]=`max-age=${p.cacheControl}`,S["content-type"]=p.contentType,b&&(S["x-metadata"]=c.toBase64(c.encodeMetadata(b))),(typeof ReadableStream<"u"&&g instanceof ReadableStream||g&&typeof g=="object"&&"pipe"in g&&typeof g.pipe=="function")&&!p.duplex&&(p.duplex="half")),l?.headers)for(const[T,A]of Object.entries(l.headers))S=Po(S,T,A);return{path:d,fullPath:(await Ud(c.fetch,m.toString(),g,ce({headers:S},p?.duplex?{duplex:p.duplex}:{}))).Key}})}async createSignedUploadUrl(i,n){var r=this;return r.handleOperation(async()=>{let l=r._getFinalPath(i);const c=ce({},r.headers);n?.upsert&&(c["x-upsert"]="true");const d=await En(r.fetch,`${r.url}/object/upload/sign/${l}`,{},{headers:c}),h=new URL(r.url+d.url),m=h.searchParams.get("token");if(!m)throw new Wo("No token returned by API");return{signedUrl:h.toString(),path:i,token:m}})}async update(i,n,r){return this.uploadOrUpdate("PUT",i,n,r)}async move(i,n,r){var l=this;return l.handleOperation(async()=>await En(l.fetch,`${l.url}/object/move`,{bucketId:l.bucketId,sourceKey:i,destinationKey:n,destinationBucket:r?.destinationBucket},{headers:l.headers}))}async copy(i,n,r){var l=this;return l.handleOperation(async()=>({path:(await En(l.fetch,`${l.url}/object/copy`,{bucketId:l.bucketId,sourceKey:i,destinationKey:n,destinationBucket:r?.destinationBucket},{headers:l.headers})).Key}))}async createSignedUrl(i,n,r){var l=this;return l.handleOperation(async()=>{let c=l._getFinalPath(i);const d=typeof r?.transform=="object"&&r.transform!==null&&Object.keys(r.transform).length>0;let h=await En(l.fetch,`${l.url}/object/sign/${c}`,ce({expiresIn:n},d?{transform:r.transform}:{}),{headers:l.headers});const m=new URLSearchParams;r?.download&&m.set("download",r.download===!0?"":r.download),r?.cacheNonce!=null&&m.set("cacheNonce",String(r.cacheNonce));const g=m.toString();return{signedUrl:encodeURI(`${l.url}${h.signedURL}${g?`&${g}`:""}`)}})}async createSignedUrls(i,n,r){var l=this;return l.handleOperation(async()=>{const c=await En(l.fetch,`${l.url}/object/sign/${l.bucketId}`,{expiresIn:n,paths:i},{headers:l.headers}),d=new URLSearchParams;r?.download&&d.set("download",r.download===!0?"":r.download),r?.cacheNonce!=null&&d.set("cacheNonce",String(r.cacheNonce));const h=d.toString();return c.map(m=>ce(ce({},m),{},{signedUrl:m.signedURL?encodeURI(`${l.url}${m.signedURL}${h?`&${h}`:""}`):null}))})}download(i,n,r){const l=typeof n?.transform=="object"&&n.transform!==null&&Object.keys(n.transform).length>0?"render/image/authenticated":"object",c=new URLSearchParams;n?.transform&&this.applyTransformOptsToQuery(c,n.transform),n?.cacheNonce!=null&&c.set("cacheNonce",String(n.cacheNonce));const d=c.toString(),h=this._getFinalPath(i),m=()=>sl(this.fetch,`${this.url}/${l}/${h}${d?`?${d}`:""}`,{headers:this.headers,noResolveJson:!0},r);return new _S(m,this.shouldThrowOnError)}async info(i){var n=this;const r=n._getFinalPath(i);return n.handleOperation(async()=>Md(await sl(n.fetch,`${n.url}/object/info/${r}`,{headers:n.headers})))}async exists(i){var n=this;const r=n._getFinalPath(i);try{return await SS(n.fetch,`${n.url}/object/${r}`,{headers:n.headers}),{data:!0,error:null}}catch(c){if(n.shouldThrowOnError)throw c;if(Qo(c)){var l;const d=c instanceof Dd?c.status:c instanceof Bp?(l=c.originalError)===null||l===void 0?void 0:l.status:void 0;if(d!==void 0&&[400,404].includes(d))return{data:!1,error:c}}throw c}}getPublicUrl(i,n){const r=this._getFinalPath(i),l=new URLSearchParams;n?.download&&l.set("download",n.download===!0?"":n.download),n?.transform&&this.applyTransformOptsToQuery(l,n.transform),n?.cacheNonce!=null&&l.set("cacheNonce",String(n.cacheNonce));const c=l.toString(),d=typeof n?.transform=="object"&&n.transform!==null&&Object.keys(n.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${d}/public/${r}`)+(c?`?${c}`:"")}}}async remove(i){var n=this;return n.handleOperation(async()=>await ll(n.fetch,`${n.url}/object/${n.bucketId}`,{prefixes:i},{headers:n.headers}))}async purgeCache(i,n,r){var l=this;return l.handleOperation(async()=>{const c=l._getFinalPath(i),d=new URLSearchParams;n?.transformations&&d.set("transformations","true");const h=d.toString();return await ll(l.fetch,`${l.url}/cdn/${c}${h?`?${h}`:""}`,{},{headers:l.headers},r)})}async list(i,n,r){var l=this;return l.handleOperation(async()=>{const c=n?.sortBy?ce(ce({},hd.sortBy),n.sortBy):hd.sortBy,d=ce(ce(ce({},hd),n),{},{sortBy:c,prefix:i||""});return await En(l.fetch,`${l.url}/object/list/${l.bucketId}`,d,{headers:l.headers},r)})}async listV2(i,n){var r=this;return r.handleOperation(async()=>{const l=ce({},i);return await En(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,l,{headers:r.headers},n)})}encodeMetadata(i){return JSON.stringify(i)}toBase64(i){return typeof Buffer<"u"?Buffer.from(i).toString("base64"):btoa(i)}_getFinalPath(i){return`${this.bucketId}/${i.replace(/^\/+/,"")}`}_removeEmptyFolders(i){return i.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(i,n){return n.width&&i.set("width",n.width.toString()),n.height&&i.set("height",n.height.toString()),n.resize&&i.set("resize",n.resize),n.format&&i.set("format",n.format),n.quality&&i.set("quality",n.quality.toString()),i}};const kS="2.110.0",dl={"X-Client-Info":`storage-js/${kS}`};var ES=class extends Ur{constructor(i,n={},r,l){const c=new URL(i);l?.useNewHostname&&/supabase\.(co|in|red)$/.test(c.hostname)&&!c.hostname.includes("storage.supabase.")&&(c.hostname=c.hostname.replace("supabase.","storage.supabase."));const d=c.href.replace(/\/$/,""),h=ce(ce({},dl),n);super(d,h,r,"storage")}async listBuckets(i){var n=this;return n.handleOperation(async()=>{const r=n.listBucketOptionsToQueryString(i);return await sl(n.fetch,`${n.url}/bucket${r}`,{headers:n.headers})})}async getBucket(i){var n=this;return n.handleOperation(async()=>await sl(n.fetch,`${n.url}/bucket/${i}`,{headers:n.headers}))}async createBucket(i,n={public:!1}){var r=this;return r.handleOperation(async()=>await En(r.fetch,`${r.url}/bucket`,{id:i,name:i,type:n.type,public:n.public,file_size_limit:n.fileSizeLimit,allowed_mime_types:n.allowedMimeTypes},{headers:r.headers}))}async updateBucket(i,n){var r=this;return r.handleOperation(async()=>await Ud(r.fetch,`${r.url}/bucket/${i}`,{id:i,name:i,public:n.public,file_size_limit:n.fileSizeLimit,allowed_mime_types:n.allowedMimeTypes},{headers:r.headers}))}async emptyBucket(i){var n=this;return n.handleOperation(async()=>await En(n.fetch,`${n.url}/bucket/${i}/empty`,{},{headers:n.headers}))}async deleteBucket(i){var n=this;return n.handleOperation(async()=>await ll(n.fetch,`${n.url}/bucket/${i}`,{},{headers:n.headers}))}async purgeBucketCache(i,n,r){var l=this;return l.handleOperation(async()=>{const c=new URLSearchParams;n?.transformations&&c.set("transformations","true");const d=c.toString();return await ll(l.fetch,`${l.url}/cdn/${i}${d?`?${d}`:""}`,{},{headers:l.headers},r)})}listBucketOptionsToQueryString(i){const n={};return i&&("limit"in i&&(n.limit=String(i.limit)),"offset"in i&&(n.offset=String(i.offset)),i.search&&(n.search=i.search),i.sortColumn&&(n.sortColumn=i.sortColumn),i.sortOrder&&(n.sortOrder=i.sortOrder)),Object.keys(n).length>0?"?"+new URLSearchParams(n).toString():""}},AS=class extends Ur{constructor(i,n={},r){const l=i.replace(/\/$/,""),c=ce(ce({},dl),n);super(l,c,r,"storage")}async createBucket(i){var n=this;return n.handleOperation(async()=>await En(n.fetch,`${n.url}/bucket`,{name:i},{headers:n.headers}))}async listBuckets(i){var n=this;return n.handleOperation(async()=>{const r=new URLSearchParams;i?.limit!==void 0&&r.set("limit",i.limit.toString()),i?.offset!==void 0&&r.set("offset",i.offset.toString()),i?.sortColumn&&r.set("sortColumn",i.sortColumn),i?.sortOrder&&r.set("sortOrder",i.sortOrder),i?.search&&r.set("search",i.search);const l=r.toString(),c=l?`${n.url}/bucket?${l}`:`${n.url}/bucket`;return await sl(n.fetch,c,{headers:n.headers})})}async deleteBucket(i){var n=this;return n.handleOperation(async()=>await ll(n.fetch,`${n.url}/bucket/${i}`,{},{headers:n.headers}))}from(i){var n=this;if(!pS(i))throw new Wo("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const r=new cS({baseUrl:this.url,catalogName:i,auth:{type:"custom",getHeaders:async()=>n.headers},fetch:this.fetch}),l=this.shouldThrowOnError;return new Proxy(r,{get(c,d){const h=c[d];return typeof h!="function"?h:async(...m)=>{try{return{data:await h.apply(c,m),error:null}}catch(g){if(l)throw g;return{data:null,error:g}}}}})}},xS=class extends Ur{constructor(i,n={},r){const l=i.replace(/\/$/,""),c=ce(ce({},dl),{},{"Content-Type":"application/json"},n);super(l,c,r,"vectors")}async createIndex(i){var n=this;return n.handleOperation(async()=>await nn.post(n.fetch,`${n.url}/CreateIndex`,i,{headers:n.headers})||{})}async getIndex(i,n){var r=this;return r.handleOperation(async()=>await nn.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:i,indexName:n},{headers:r.headers}))}async listIndexes(i){var n=this;return n.handleOperation(async()=>await nn.post(n.fetch,`${n.url}/ListIndexes`,i,{headers:n.headers}))}async deleteIndex(i,n){var r=this;return r.handleOperation(async()=>await nn.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:i,indexName:n},{headers:r.headers})||{})}},CS=class extends Ur{constructor(i,n={},r){const l=i.replace(/\/$/,""),c=ce(ce({},dl),{},{"Content-Type":"application/json"},n);super(l,c,r,"vectors")}async putVectors(i){var n=this;if(i.vectors.length<1||i.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return n.handleOperation(async()=>await nn.post(n.fetch,`${n.url}/PutVectors`,i,{headers:n.headers})||{})}async getVectors(i){var n=this;return n.handleOperation(async()=>await nn.post(n.fetch,`${n.url}/GetVectors`,i,{headers:n.headers}))}async listVectors(i){var n=this;if(i.segmentCount!==void 0){if(i.segmentCount<1||i.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(i.segmentIndex!==void 0&&(i.segmentIndex<0||i.segmentIndex>=i.segmentCount))throw new Error(`segmentIndex must be between 0 and ${i.segmentCount-1}`)}return n.handleOperation(async()=>await nn.post(n.fetch,`${n.url}/ListVectors`,i,{headers:n.headers}))}async queryVectors(i){var n=this;return n.handleOperation(async()=>await nn.post(n.fetch,`${n.url}/QueryVectors`,i,{headers:n.headers}))}async deleteVectors(i){var n=this;if(i.keys.length<1||i.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return n.handleOperation(async()=>await nn.post(n.fetch,`${n.url}/DeleteVectors`,i,{headers:n.headers})||{})}},OS=class extends Ur{constructor(i,n={},r){const l=i.replace(/\/$/,""),c=ce(ce({},dl),{},{"Content-Type":"application/json"},n);super(l,c,r,"vectors")}async createBucket(i){var n=this;return n.handleOperation(async()=>await nn.post(n.fetch,`${n.url}/CreateVectorBucket`,{vectorBucketName:i},{headers:n.headers})||{})}async getBucket(i){var n=this;return n.handleOperation(async()=>await nn.post(n.fetch,`${n.url}/GetVectorBucket`,{vectorBucketName:i},{headers:n.headers}))}async listBuckets(i={}){var n=this;return n.handleOperation(async()=>await nn.post(n.fetch,`${n.url}/ListVectorBuckets`,i,{headers:n.headers}))}async deleteBucket(i){var n=this;return n.handleOperation(async()=>await nn.post(n.fetch,`${n.url}/DeleteVectorBucket`,{vectorBucketName:i},{headers:n.headers})||{})}},RS=class extends OS{constructor(i,n={}){super(i,n.headers||{},n.fetch)}from(i){return new jS(this.url,this.headers,i,this.fetch)}async createBucket(i){var n=()=>super.createBucket,r=this;return n().call(r,i)}async getBucket(i){var n=()=>super.getBucket,r=this;return n().call(r,i)}async listBuckets(i={}){var n=()=>super.listBuckets,r=this;return n().call(r,i)}async deleteBucket(i){var n=()=>super.deleteBucket,r=this;return n().call(r,i)}},jS=class extends xS{constructor(i,n,r,l){super(i,n,l),this.vectorBucketName=r}async createIndex(i){var n=()=>super.createIndex,r=this;return n().call(r,ce(ce({},i),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(i={}){var n=()=>super.listIndexes,r=this;return n().call(r,ce(ce({},i),{},{vectorBucketName:r.vectorBucketName}))}async getIndex(i){var n=()=>super.getIndex,r=this;return n().call(r,r.vectorBucketName,i)}async deleteIndex(i){var n=()=>super.deleteIndex,r=this;return n().call(r,r.vectorBucketName,i)}index(i){return new NS(this.url,this.headers,this.vectorBucketName,i,this.fetch)}},NS=class extends CS{constructor(i,n,r,l,c){super(i,n,c),this.vectorBucketName=r,this.indexName=l}async putVectors(i){var n=()=>super.putVectors,r=this;return n().call(r,ce(ce({},i),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(i){var n=()=>super.getVectors,r=this;return n().call(r,ce(ce({},i),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(i={}){var n=()=>super.listVectors,r=this;return n().call(r,ce(ce({},i),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(i){var n=()=>super.queryVectors,r=this;return n().call(r,ce(ce({},i),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(i){var n=()=>super.deleteVectors,r=this;return n().call(r,ce(ce({},i),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},LS=class extends ES{constructor(i,n={},r,l){super(i,n,r,l)}from(i){return new TS(this.url,this.headers,i,this.fetch)}get vectors(){return new RS(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new AS(this.url+"/iceberg",this.headers,this.fetch)}};const Pp="2.110.0",ya=30*1e3,Js=3,fd=Js*ya,DS=2*ya,MS="http://localhost:9999",US="supabase.auth.token",zS={"X-Client-Info":`gotrue-js/${Pp}`},zd="X-Supabase-Api-Version",Ip={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},BS=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,HS=600*1e3;class ol extends Error{constructor(n,r,l){super(n),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=l}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function W(i){return typeof i=="object"&&i!==null&&"__isAuthError"in i}class qS extends ol{constructor(n,r,l){super(n,r,l),this.name="AuthApiError",this.status=r,this.code=l}}function $S(i){return W(i)&&i.name==="AuthApiError"}class An extends ol{constructor(n,r){super(n),this.name="AuthUnknownError",this.originalError=r}}class Pn extends ol{constructor(n,r,l,c){super(n,l,c),this.name=r,this.status=l}}class _t extends Pn{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function Do(i){return W(i)&&i.name==="AuthSessionMissingError"}class Sr extends Pn{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class Mo extends Pn{constructor(n){super(n,"AuthInvalidCredentialsError",400,void 0)}}class Uo extends Pn{constructor(n,r=null){super(n,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}function PS(i){return W(i)&&i.name==="AuthImplicitGrantRedirectError"}class ep extends Pn{constructor(n,r=null){super(n,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class IS extends Pn{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}class Bd extends Pn{constructor(n,r){super(n,"AuthRetryableFetchError",r,void 0)}}function tp(i){return W(i)&&i.name==="AuthRetryableFetchError"}class np extends Pn{constructor(n="Refresh result discarded: session state changed mid-flight (e.g., concurrent signOut)"){super(n,"AuthRefreshDiscardedError",409,void 0)}}function GS(i){return W(i)&&i.name==="AuthRefreshDiscardedError"}class ap extends Pn{constructor(n,r,l){super(n,"AuthWeakPasswordError",r,"weak_password"),this.reasons=l}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class Io extends Pn{constructor(n){super(n,"AuthInvalidJwtError",400,"invalid_jwt")}}const Go="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),ip=`
21
+ \r=`.split(""),VS=(()=>{const i=new Array(128);for(let n=0;n<i.length;n+=1)i[n]=-1;for(let n=0;n<ip.length;n+=1)i[ip[n].charCodeAt(0)]=-2;for(let n=0;n<Go.length;n+=1)i[Go[n].charCodeAt(0)]=n;return i})();function rp(i,n,r){if(i!==null)for(n.queue=n.queue<<8|i,n.queuedBits+=8;n.queuedBits>=6;){const l=n.queue>>n.queuedBits-6&63;r(Go[l]),n.queuedBits-=6}else if(n.queuedBits>0)for(n.queue=n.queue<<6-n.queuedBits,n.queuedBits=6;n.queuedBits>=6;){const l=n.queue>>n.queuedBits-6&63;r(Go[l]),n.queuedBits-=6}}function Gp(i,n,r){const l=VS[i];if(l>-1)for(n.queue=n.queue<<6|l,n.queuedBits+=6;n.queuedBits>=8;)r(n.queue>>n.queuedBits-8&255),n.queuedBits-=8;else{if(l===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(i)}"`)}}function sp(i){const n=[],r=h=>{n.push(String.fromCodePoint(h))},l={utf8seq:0,codepoint:0},c={queue:0,queuedBits:0},d=h=>{JS(h,l,r)};for(let h=0;h<i.length;h+=1)Gp(i.charCodeAt(h),c,d);return n.join("")}function KS(i,n){if(i<=127){n(i);return}else if(i<=2047){n(192|i>>6),n(128|i&63);return}else if(i<=65535){n(224|i>>12),n(128|i>>6&63),n(128|i&63);return}else if(i<=1114111){n(240|i>>18),n(128|i>>12&63),n(128|i>>6&63),n(128|i&63);return}throw new Error(`Unrecognized Unicode codepoint: ${i.toString(16)}`)}function YS(i,n){for(let r=0;r<i.length;r+=1){let l=i.charCodeAt(r);if(l>55295&&l<=56319){const c=(l-55296)*1024&65535;l=(i.charCodeAt(r+1)-56320&65535|c)+65536,r+=1}KS(l,n)}}function JS(i,n,r){if(n.utf8seq===0){if(i<=127){r(i);return}for(let l=1;l<6;l+=1)if((i>>7-l&1)===0){n.utf8seq=l;break}if(n.utf8seq===2)n.codepoint=i&31;else if(n.utf8seq===3)n.codepoint=i&15;else if(n.utf8seq===4)n.codepoint=i&7;else throw new Error("Invalid UTF-8 sequence");n.utf8seq-=1}else if(n.utf8seq>0){if(i<=127)throw new Error("Invalid UTF-8 sequence");n.codepoint=n.codepoint<<6|i&63,n.utf8seq-=1,n.utf8seq===0&&r(n.codepoint)}}function Dr(i){const n=[],r={queue:0,queuedBits:0},l=c=>{n.push(c)};for(let c=0;c<i.length;c+=1)Gp(i.charCodeAt(c),r,l);return new Uint8Array(n)}function XS(i){const n=[];return YS(i,r=>n.push(r)),new Uint8Array(n)}function Ei(i){const n=[],r={queue:0,queuedBits:0},l=c=>{n.push(c)};return i.forEach(c=>rp(c,r,l)),rp(null,r,l),n.join("")}function WS(i){return Math.round(Date.now()/1e3)+i}function QS(){return Symbol("auth-callback")}const Nt=()=>typeof window<"u"&&typeof document<"u",wi={tested:!1,writable:!1},Vp=()=>{if(!Nt())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(wi.tested)return wi.writable;const i=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(i,i),globalThis.localStorage.removeItem(i),wi.tested=!0,wi.writable=!0}catch{wi.tested=!0,wi.writable=!1}return wi.writable};function ZS(i){const n={},r=new URL(i);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEach((c,d)=>{n[d]=c})}catch{}return r.searchParams.forEach((l,c)=>{n[c]=l}),n}const Kp=i=>i?(...n)=>i(...n):(...n)=>fetch(...n),FS=i=>typeof i=="object"&&i!==null&&"status"in i&&"ok"in i&&"json"in i&&typeof i.json=="function",Or=async(i,n,r)=>{await i.setItem(n,JSON.stringify(r))},_n=async(i,n)=>{const r=await i.getItem(n);if(!r)return null;try{return JSON.parse(r)}catch{return null}},ct=async(i,n)=>{await i.removeItem(n)};class Zo{constructor(){this.promise=new Zo.promiseConstructor((n,r)=>{this.resolve=n,this.reject=r})}}Zo.promiseConstructor=Promise;function zo(i){const n=i.split(".");if(n.length!==3)throw new Io("Invalid JWT structure");for(let l=0;l<n.length;l++)if(!BS.test(n[l]))throw new Io("JWT not in base64url format");return{header:JSON.parse(sp(n[0])),payload:JSON.parse(sp(n[1])),signature:Dr(n[2]),raw:{header:n[0],payload:n[1]}}}async function ew(i){return await new Promise(n=>{setTimeout(()=>n(null),i)})}function tw(i,n){return new Promise((l,c)=>{(async()=>{for(let d=0;d<1/0;d++)try{const h=await i(d);if(!n(d,null,h)){l(h);return}}catch(h){if(!n(d,h)){c(h);return}}})()})}function nw(i){return("0"+i.toString(16)).substr(-2)}function aw(){const n=new Uint32Array(56);if(typeof crypto>"u"){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",l=r.length;let c="";for(let d=0;d<56;d++)c+=r.charAt(Math.floor(Math.random()*l));return c}return crypto.getRandomValues(n),Array.from(n,nw).join("")}async function iw(i){const r=new TextEncoder().encode(i),l=await crypto.subtle.digest("SHA-256",r),c=new Uint8Array(l);return Array.from(c).map(d=>String.fromCharCode(d)).join("")}async function rw(i){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),i;const r=await iw(i);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function _i(i,n,r=!1){const l=aw();let c=l;r&&(c+="/recovery"),await Or(i,`${n}-code-verifier`,c);const d=await rw(l);return[d,l===d?"plain":"s256"]}const sw=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function lw(i){const n=i.headers.get(zd);if(!n||!n.match(sw))return null;try{return new Date(`${n}T00:00:00.0Z`)}catch{return null}}function ow(i){if(!i)throw new Error("Missing exp claim");const n=Math.floor(Date.now()/1e3);if(i<=n)throw new Error("JWT has expired")}function cw(i){switch(i){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const uw=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function fa(i){if(!uw.test(i))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function Tn(i){if(!i.passkey)throw new Error("@supabase/auth-js: the passkey API is experimental and disabled by default. Enable it by passing `auth: { experimental: { passkey: true } }` to createClient (or to the GoTrueClient constructor).")}function md(){const i={};return new Proxy(i,{get:(n,r)=>{if(r==="__isUserNotAvailableProxy")return!0;if(typeof r=="symbol"){const l=r.toString();if(l==="Symbol(Symbol.toPrimitive)"||l==="Symbol(Symbol.toStringTag)"||l==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${r}" property of the session object is not supported. Please use getUser() instead.`)},set:(n,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(n,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function dw(i,n){return new Proxy(i,{get:(r,l,c)=>{if(l==="__isInsecureUserWarningProxy")return!0;if(typeof l=="symbol"){const d=l.toString();if(d==="Symbol(Symbol.toPrimitive)"||d==="Symbol(Symbol.toStringTag)"||d==="Symbol(util.inspect.custom)"||d==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(r,l,c)}return!n.value&&typeof l=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),n.value=!0),Reflect.get(r,l,c)}})}function lp(i){return JSON.parse(JSON.stringify(i))}const ki=i=>{if(typeof i=="object"&&i!==null){const n=i;if(typeof n.msg=="string")return n.msg;if(typeof n.message=="string")return n.message;if(typeof n.error_description=="string")return n.error_description;if(typeof n.error=="string")return n.error}return JSON.stringify(i)},hw=[500,501,502,503,504,520,521,522,523,524,525,526,527,528,529,530];async function op(i){var n;if(!FS(i))throw new Bd(ki(i),0);if(hw.includes(i.status))throw new Bd(ki(i),i.status);let r;try{r=await i.json()}catch(d){throw new An(ki(d),d)}let l;const c=lw(i);if(c&&c.getTime()>=Ip["2024-01-01"].timestamp&&typeof r=="object"&&r&&typeof r.code=="string"?l=r.code:typeof r=="object"&&r&&typeof r.error_code=="string"&&(l=r.error_code),l){if(l==="weak_password")throw new ap(ki(r),i.status,((n=r.weak_password)===null||n===void 0?void 0:n.reasons)||[]);if(l==="session_not_found")throw new _t}else if(typeof r=="object"&&r&&typeof r.weak_password=="object"&&r.weak_password&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.reasons.reduce((d,h)=>d&&typeof h=="string",!0))throw new ap(ki(r),i.status,r.weak_password.reasons);throw new qS(ki(r),i.status||500,l)}const fw=(i,n,r,l)=>{const c={method:i,headers:n?.headers||{}};return i==="GET"?c:(c.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},n?.headers),c.body=JSON.stringify(l),Object.assign(Object.assign({},c),r))};async function ee(i,n,r,l){var c;const d=Object.assign({},l?.headers);d[zd]||(d[zd]=Ip["2024-01-01"].name),l?.jwt&&(d.Authorization=`Bearer ${l.jwt}`);const h=(c=l?.query)!==null&&c!==void 0?c:{};l?.redirectTo&&(h.redirect_to=l.redirectTo);const m=Object.keys(h).length?"?"+new URLSearchParams(h).toString():"",g=await mw(i,n,r+m,{headers:d,noResolveJson:l?.noResolveJson},{},l?.body);return l?.xform?l?.xform(g):{data:Object.assign({},g),error:null}}async function mw(i,n,r,l,c,d){const h=fw(n,l,c,d);let m;try{m=await i(r,Object.assign({},h))}catch(g){throw console.error(g),new Bd(ki(g),0)}if(m.ok||await op(m),l?.noResolveJson)return m;try{return await m.json()}catch(g){await op(g)}}function mn(i){var n;let r=null;yw(i)&&(r=Object.assign({},i),i.expires_at||(r.expires_at=WS(i.expires_in)));const l=(n=i.user)!==null&&n!==void 0?n:typeof i?.id=="string"?i:null;return{data:{session:r,user:l},error:null}}function cp(i){const n=mn(i);return!n.error&&i.weak_password&&typeof i.weak_password=="object"&&Array.isArray(i.weak_password.reasons)&&i.weak_password.reasons.length&&i.weak_password.message&&typeof i.weak_password.message=="string"&&i.weak_password.reasons.reduce((r,l)=>r&&typeof l=="string",!0)&&(n.data.weak_password=i.weak_password),n}function Wa(i){var n;return{data:{user:(n=i.user)!==null&&n!==void 0?n:i},error:null}}function gw(i){return{data:i,error:null}}function pw(i){const{action_link:n,email_otp:r,hashed_token:l,redirect_to:c,verification_type:d}=i,h=Xo(i,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),m={action_link:n,email_otp:r,hashed_token:l,redirect_to:c,verification_type:d},g=Object.assign({},h);return{data:{properties:m,user:g},error:null}}function up(i){return i}function yw(i){return!!i.access_token&&!!i.refresh_token&&!!i.expires_in}const gd=["global","local","others"];class vw{constructor({url:n="",headers:r={},fetch:l,experimental:c}){this.url=n,this.headers=r,this.fetch=Kp(l),this.experimental=c??{},this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)},this.passkey={listPasskeys:this._adminListPasskeys.bind(this),deletePasskey:this._adminDeletePasskey.bind(this)}}async signOut(n,r=gd[0]){if(gd.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${gd.join(", ")}`);try{return await ee(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:n,noResolveJson:!0}),{data:null,error:null}}catch(l){if(W(l))return{data:null,error:l};throw l}}async inviteUserByEmail(n,r={}){try{return await ee(this.fetch,"POST",`${this.url}/invite`,{body:{email:n,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:Wa})}catch(l){if(W(l))return{data:{user:null},error:l};throw l}}async generateLink(n){try{const{options:r}=n,l=Xo(n,["options"]),c=Object.assign(Object.assign({},l),r);return"newEmail"in l&&(c.new_email=l?.newEmail,delete c.newEmail),await ee(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:c,headers:this.headers,xform:pw,redirectTo:r?.redirectTo})}catch(r){if(W(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(n){try{return await ee(this.fetch,"POST",`${this.url}/admin/users`,{body:n,headers:this.headers,xform:Wa})}catch(r){if(W(r))return{data:{user:null},error:r};throw r}}async listUsers(n){var r,l,c,d,h,m,g;try{const p={nextPage:null,lastPage:0,total:0},S=await ee(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(l=(r=n?.page)===null||r===void 0?void 0:r.toString())!==null&&l!==void 0?l:"",per_page:(d=(c=n?.perPage)===null||c===void 0?void 0:c.toString())!==null&&d!==void 0?d:""},xform:up});if(S.error)throw S.error;const b=await S.json(),T=(h=S.headers.get("x-total-count"))!==null&&h!==void 0?h:0,A=(g=(m=S.headers.get("link"))===null||m===void 0?void 0:m.split(","))!==null&&g!==void 0?g:[];return A.length>0&&(A.forEach(C=>{const z=parseInt(C.split(";")[0].split("=")[1].substring(0,1)),G=JSON.parse(C.split(";")[1].split("=")[1]);p[`${G}Page`]=z}),p.total=parseInt(T)),{data:Object.assign(Object.assign({},b),p),error:null}}catch(p){if(W(p))return{data:{users:[]},error:p};throw p}}async getUserById(n){fa(n);try{return await ee(this.fetch,"GET",`${this.url}/admin/users/${n}`,{headers:this.headers,xform:Wa})}catch(r){if(W(r))return{data:{user:null},error:r};throw r}}async updateUserById(n,r){fa(n);try{return await ee(this.fetch,"PUT",`${this.url}/admin/users/${n}`,{body:r,headers:this.headers,xform:Wa})}catch(l){if(W(l))return{data:{user:null},error:l};throw l}}async deleteUser(n,r=!1){fa(n);try{return await ee(this.fetch,"DELETE",`${this.url}/admin/users/${n}`,{headers:this.headers,body:{should_soft_delete:r},xform:Wa})}catch(l){if(W(l))return{data:{user:null},error:l};throw l}}async _listFactors(n){fa(n.userId);try{const{data:r,error:l}=await ee(this.fetch,"GET",`${this.url}/admin/users/${n.userId}/factors`,{headers:this.headers,xform:c=>({data:{factors:c},error:null})});return{data:r,error:l}}catch(r){if(W(r))return{data:null,error:r};throw r}}async _deleteFactor(n){fa(n.userId),fa(n.id);try{return{data:await ee(this.fetch,"DELETE",`${this.url}/admin/users/${n.userId}/factors/${n.id}`,{headers:this.headers}),error:null}}catch(r){if(W(r))return{data:null,error:r};throw r}}async _listOAuthClients(n){var r,l,c,d,h,m,g;try{const p={nextPage:null,lastPage:0,total:0},S=await ee(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(l=(r=n?.page)===null||r===void 0?void 0:r.toString())!==null&&l!==void 0?l:"",per_page:(d=(c=n?.perPage)===null||c===void 0?void 0:c.toString())!==null&&d!==void 0?d:""},xform:up});if(S.error)throw S.error;const b=await S.json(),T=(h=S.headers.get("x-total-count"))!==null&&h!==void 0?h:0,A=(g=(m=S.headers.get("link"))===null||m===void 0?void 0:m.split(","))!==null&&g!==void 0?g:[];return A.length>0&&(A.forEach(C=>{const z=parseInt(C.split(";")[0].split("=")[1].substring(0,1)),G=JSON.parse(C.split(";")[1].split("=")[1]);p[`${G}Page`]=z}),p.total=parseInt(T)),{data:Object.assign(Object.assign({},b),p),error:null}}catch(p){if(W(p))return{data:{clients:[]},error:p};throw p}}async _createOAuthClient(n){try{return await ee(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:n,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(W(r))return{data:null,error:r};throw r}}async _getOAuthClient(n){try{return await ee(this.fetch,"GET",`${this.url}/admin/oauth/clients/${n}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(W(r))return{data:null,error:r};throw r}}async _updateOAuthClient(n,r){try{return await ee(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${n}`,{body:r,headers:this.headers,xform:l=>({data:l,error:null})})}catch(l){if(W(l))return{data:null,error:l};throw l}}async _deleteOAuthClient(n){try{return await ee(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${n}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(W(r))return{data:null,error:r};throw r}}async _regenerateOAuthClientSecret(n){try{return await ee(this.fetch,"POST",`${this.url}/admin/oauth/clients/${n}/regenerate_secret`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(W(r))return{data:null,error:r};throw r}}async _listCustomProviders(n){try{const r={};return n?.type&&(r.type=n.type),await ee(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:r,xform:l=>{var c;return{data:{providers:(c=l?.providers)!==null&&c!==void 0?c:[]},error:null}}})}catch(r){if(W(r))return{data:{providers:[]},error:r};throw r}}async _createCustomProvider(n){try{return await ee(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:n,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(W(r))return{data:null,error:r};throw r}}async _getCustomProvider(n){try{return await ee(this.fetch,"GET",`${this.url}/admin/custom-providers/${n}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(W(r))return{data:null,error:r};throw r}}async _updateCustomProvider(n,r){try{return await ee(this.fetch,"PUT",`${this.url}/admin/custom-providers/${n}`,{body:r,headers:this.headers,xform:l=>({data:l,error:null})})}catch(l){if(W(l))return{data:null,error:l};throw l}}async _deleteCustomProvider(n){try{return await ee(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${n}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(W(r))return{data:null,error:r};throw r}}async _adminListPasskeys(n){Tn(this.experimental),fa(n.userId);try{return await ee(this.fetch,"GET",`${this.url}/admin/users/${n.userId}/passkeys`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(W(r))return{data:null,error:r};throw r}}async _adminDeletePasskey(n){Tn(this.experimental),fa(n.userId),fa(n.passkeyId);try{return await ee(this.fetch,"DELETE",`${this.url}/admin/users/${n.userId}/passkeys/${n.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(W(r))return{data:null,error:r};throw r}}}function dp(i={}){return{getItem:n=>i[n]||null,setItem:(n,r)=>{i[n]=r},removeItem:n=>{delete i[n]}}}globalThis&&Vp()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug");class bw extends Error{constructor(n){super(n),this.isAcquireTimeout=!0}}function Sw(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}function Yp(i){if(!/^0x[a-fA-F0-9]{40}$/.test(i))throw new Error(`@supabase/auth-js: Address "${i}" is invalid.`);return i.toLowerCase()}function ww(i){return parseInt(i,16)}function _w(i){const n=new TextEncoder().encode(i);return"0x"+Array.from(n,l=>l.toString(16).padStart(2,"0")).join("")}function Tw(i){var n;const{chainId:r,domain:l,expirationTime:c,issuedAt:d=new Date,nonce:h,notBefore:m,requestId:g,resources:p,scheme:S,uri:b,version:T}=i;{if(!Number.isInteger(r))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${r}`);if(!l)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(h&&h.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${h}`);if(!b)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(T!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${T}`);if(!((n=i.statement)===null||n===void 0)&&n.includes(`
22
+ `))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${i.statement}`)}const A=Yp(i.address),C=S?`${S}://${l}`:l,z=i.statement?`${i.statement}
23
+ `:"",G=`${C} wants you to sign in with your Ethereum account:
24
+ ${A}
25
+
26
+ ${z}`;let I=`URI: ${b}
27
+ Version: ${T}
28
+ Chain ID: ${r}${h?`
29
+ Nonce: ${h}`:""}
30
+ Issued At: ${d.toISOString()}`;if(c&&(I+=`
31
+ Expiration Time: ${c.toISOString()}`),m&&(I+=`
32
+ Not Before: ${m.toISOString()}`),g&&(I+=`
33
+ Request ID: ${g}`),p){let $=`
34
+ Resources:`;for(const O of p){if(!O||typeof O!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${O}`);$+=`
35
+ - ${O}`}I+=$}return`${G}
36
+ ${I}`}class pt extends Error{constructor({message:n,code:r,cause:l,name:c}){var d;super(n,{cause:l}),this.__isWebAuthnError=!0,this.name=(d=c??(l instanceof Error?l.name:void 0))!==null&&d!==void 0?d:"Unknown Error",this.code=r}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class Vo extends pt{constructor(n,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:n}),this.name="WebAuthnUnknownError",this.originalError=r}}function kw({error:i,options:n}){var r,l,c;const{publicKey:d}=n;if(!d)throw Error("options was missing required publicKey property");if(i.name==="AbortError"){if(n.signal instanceof AbortSignal)return new pt({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:i})}else if(i.name==="ConstraintError"){if(((r=d.authenticatorSelection)===null||r===void 0?void 0:r.requireResidentKey)===!0)return new pt({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:i});if(n.mediation==="conditional"&&((l=d.authenticatorSelection)===null||l===void 0?void 0:l.userVerification)==="required")return new pt({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:i});if(((c=d.authenticatorSelection)===null||c===void 0?void 0:c.userVerification)==="required")return new pt({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:i})}else{if(i.name==="InvalidStateError")return new pt({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:i});if(i.name==="NotAllowedError")return new pt({message:i.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:i});if(i.name==="NotSupportedError")return d.pubKeyCredParams.filter(m=>m.type==="public-key").length===0?new pt({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:i}):new pt({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:i});if(i.name==="SecurityError"){const h=window.location.hostname;if(Jp(h)){if(d.rp.id!==h)return new pt({message:`The RP ID "${d.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:i})}else return new pt({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:i})}else if(i.name==="TypeError"){if(d.user.id.byteLength<1||d.user.id.byteLength>64)return new pt({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:i})}else if(i.name==="UnknownError")return new pt({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:i})}return new pt({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:i})}function Ew({error:i,options:n}){const{publicKey:r}=n;if(!r)throw Error("options was missing required publicKey property");if(i.name==="AbortError"){if(n.signal instanceof AbortSignal)return new pt({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:i})}else{if(i.name==="NotAllowedError")return new pt({message:i.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:i});if(i.name==="SecurityError"){const l=window.location.hostname;if(Jp(l)){if(r.rpId!==l)return new pt({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:i})}else return new pt({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:i})}else if(i.name==="UnknownError")return new pt({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:i})}return new pt({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:i})}class Aw{createNewAbortSignal(){if(this.controller){const r=new Error("Cancelling existing WebAuthn API call for new one");r.name="AbortError",this.controller.abort(r)}const n=new AbortController;return this.controller=n,n.signal}cancelCeremony(){if(this.controller){const n=new Error("Manually cancelling existing WebAuthn API call");n.name="AbortError",this.controller.abort(n),this.controller=void 0}}}const Hd=new Aw;function hp(i){if(!i)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(i);const{challenge:n,user:r,excludeCredentials:l}=i,c=Xo(i,["challenge","user","excludeCredentials"]),d=Dr(n).buffer,h=Object.assign(Object.assign({},r),{id:Dr(r.id).buffer}),m=Object.assign(Object.assign({},c),{challenge:d,user:h});if(l&&l.length>0){m.excludeCredentials=new Array(l.length);for(let g=0;g<l.length;g++){const p=l[g];m.excludeCredentials[g]=Object.assign(Object.assign({},p),{id:Dr(p.id).buffer,type:p.type||"public-key",transports:p.transports})}}return m}function fp(i){if(!i)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(i);const{challenge:n,allowCredentials:r}=i,l=Xo(i,["challenge","allowCredentials"]),c=Dr(n).buffer,d=Object.assign(Object.assign({},l),{challenge:c});if(r&&r.length>0){d.allowCredentials=new Array(r.length);for(let h=0;h<r.length;h++){const m=r[h];d.allowCredentials[h]=Object.assign(Object.assign({},m),{id:Dr(m.id).buffer,type:m.type||"public-key",transports:m.transports})}}return d}function mp(i){var n;if("toJSON"in i&&typeof i.toJSON=="function")return i.toJSON();const r=i;return{id:i.id,rawId:i.id,response:{attestationObject:Ei(new Uint8Array(i.response.attestationObject)),clientDataJSON:Ei(new Uint8Array(i.response.clientDataJSON))},type:"public-key",clientExtensionResults:i.getClientExtensionResults(),authenticatorAttachment:(n=r.authenticatorAttachment)!==null&&n!==void 0?n:void 0}}function gp(i){var n;if("toJSON"in i&&typeof i.toJSON=="function")return i.toJSON();const r=i,l=i.getClientExtensionResults(),c=i.response;return{id:i.id,rawId:i.id,response:{authenticatorData:Ei(new Uint8Array(c.authenticatorData)),clientDataJSON:Ei(new Uint8Array(c.clientDataJSON)),signature:Ei(new Uint8Array(c.signature)),userHandle:c.userHandle?Ei(new Uint8Array(c.userHandle)):void 0},type:"public-key",clientExtensionResults:l,authenticatorAttachment:(n=r.authenticatorAttachment)!==null&&n!==void 0?n:void 0}}function Jp(i){return i==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(i)}function Ko(){var i,n;return!!(Nt()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((i=navigator?.credentials)===null||i===void 0?void 0:i.create)=="function"&&typeof((n=navigator?.credentials)===null||n===void 0?void 0:n.get)=="function")}async function Xp(i){try{const n=await navigator.credentials.create(i);return n?n instanceof PublicKeyCredential?{data:n,error:null}:{data:null,error:new Vo("Browser returned unexpected credential type",n)}:{data:null,error:new Vo("Empty credential response",n)}}catch(n){return{data:null,error:kw({error:n,options:i})}}}async function Wp(i){try{const n=await navigator.credentials.get(i);return n?n instanceof PublicKeyCredential?{data:n,error:null}:{data:null,error:new Vo("Browser returned unexpected credential type",n)}:{data:null,error:new Vo("Empty credential response",n)}}catch(n){return{data:null,error:Ew({error:n,options:i})}}}const xw={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},Cw={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Yo(...i){const n=c=>c!==null&&typeof c=="object"&&!Array.isArray(c),r=c=>c instanceof ArrayBuffer||ArrayBuffer.isView(c),l={};for(const c of i)if(c)for(const d in c){const h=c[d];if(h!==void 0)if(Array.isArray(h))l[d]=h;else if(r(h))l[d]=h;else if(n(h)){const m=l[d];n(m)?l[d]=Yo(m,h):l[d]=Yo(h)}else l[d]=h}return l}function Ow(i,n){return Yo(xw,i,n||{})}function Rw(i,n){return Yo(Cw,i,n||{})}class jw{constructor(n){this.client=n,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(n){return this.client.mfa.enroll(Object.assign(Object.assign({},n),{factorType:"webauthn"}))}async _challenge({factorId:n,webauthn:r,friendlyName:l,signal:c},d){var h;try{const{data:m,error:g}=await this.client.mfa.challenge({factorId:n,webauthn:r});if(!m)return{data:null,error:g};const p=c??Hd.createNewAbortSignal();if(m.webauthn.type==="create"){const{user:S}=m.webauthn.credential_options.publicKey;if(!S.name){const b=l;if(b)S.name=`${S.id}:${b}`;else{const A=(await this.client.getUser()).data.user,C=((h=A?.user_metadata)===null||h===void 0?void 0:h.name)||A?.email||A?.id||"User";S.name=`${S.id}:${C}`}}S.displayName||(S.displayName=S.name)}switch(m.webauthn.type){case"create":{const S=Ow(m.webauthn.credential_options.publicKey,d?.create),{data:b,error:T}=await Xp({publicKey:S,signal:p});return b?{data:{factorId:n,challengeId:m.id,webauthn:{type:m.webauthn.type,credential_response:b}},error:null}:{data:null,error:T}}case"request":{const S=Rw(m.webauthn.credential_options.publicKey,d?.request),{data:b,error:T}=await Wp(Object.assign(Object.assign({},m.webauthn.credential_options),{publicKey:S,signal:p}));return b?{data:{factorId:n,challengeId:m.id,webauthn:{type:m.webauthn.type,credential_response:b}},error:null}:{data:null,error:T}}}}catch(m){return W(m)?{data:null,error:m}:{data:null,error:new An("Unexpected error in challenge",m)}}}async _verify({challengeId:n,factorId:r,webauthn:l}){return this.client.mfa.verify({factorId:r,challengeId:n,webauthn:l})}async _authenticate({factorId:n,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:l=typeof window<"u"?[window.location.origin]:void 0,signal:c}={}},d){if(!r)return{data:null,error:new ol("rpId is required for WebAuthn authentication")};try{if(!Ko())return{data:null,error:new An("Browser does not support WebAuthn",null)};const{data:h,error:m}=await this.challenge({factorId:n,webauthn:{rpId:r,rpOrigins:l},signal:c},{request:d});if(!h)return{data:null,error:m};const{webauthn:g}=h;return this._verify({factorId:n,challengeId:h.challengeId,webauthn:{type:g.type,rpId:r,rpOrigins:l,credential_response:g.credential_response}})}catch(h){return W(h)?{data:null,error:h}:{data:null,error:new An("Unexpected error in authenticate",h)}}}async _register({friendlyName:n,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:l=typeof window<"u"?[window.location.origin]:void 0,signal:c}={}},d){if(!r)return{data:null,error:new ol("rpId is required for WebAuthn registration")};try{if(!Ko())return{data:null,error:new An("Browser does not support WebAuthn",null)};const{data:h,error:m}=await this._enroll({friendlyName:n});if(!h)return await this.client.mfa.listFactors().then(S=>{var b;return(b=S.data)===null||b===void 0?void 0:b.all.find(T=>T.factor_type==="webauthn"&&T.friendly_name===n&&T.status!=="unverified")}).then(S=>S?this.client.mfa.unenroll({factorId:S?.id}):void 0),{data:null,error:m};const{data:g,error:p}=await this._challenge({factorId:h.id,friendlyName:h.friendly_name,webauthn:{rpId:r,rpOrigins:l},signal:c},{create:d});return g?this._verify({factorId:h.id,challengeId:g.challengeId,webauthn:{rpId:r,rpOrigins:l,type:g.webauthn.type,credential_response:g.webauthn.credential_response}}):{data:null,error:p}}catch(h){return W(h)?{data:null,error:h}:{data:null,error:new An("Unexpected error in register",h)}}}}Sw();const Nw={url:MS,storageKey:US,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:zS,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}},wr={};class cl{get jwks(){var n,r;return(r=(n=wr[this.storageKey])===null||n===void 0?void 0:n.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(n){wr[this.storageKey]=Object.assign(Object.assign({},wr[this.storageKey]),{jwks:n})}get jwks_cached_at(){var n,r;return(r=(n=wr[this.storageKey])===null||n===void 0?void 0:n.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(n){wr[this.storageKey]=Object.assign(Object.assign({},wr[this.storageKey]),{cachedAt:n})}constructor(n){var r,l,c;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.lastRefreshFailure=null,this._sessionRemovalEpoch=0,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lock=null,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const d=Object.assign(Object.assign({},Nw),n);if(this.storageKey=d.storageKey,this.instanceID=(r=cl.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,cl.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!d.debug,typeof d.debug=="function"&&(this.logger=d.debug),this.instanceID>0&&Nt()){const h=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(h),this.logDebugMessages&&console.trace(h)}if(this.persistSession=d.persistSession,this.autoRefreshToken=d.autoRefreshToken,this.experimental=(l=d.experimental)!==null&&l!==void 0?l:{},this.admin=new vw({url:d.url,headers:d.headers,fetch:d.fetch,experimental:this.experimental}),this.url=d.url,this.headers=d.headers,this.fetch=Kp(d.fetch),this.detectSessionInUrl=d.detectSessionInUrl,this.flowType=d.flowType,this.hasCustomAuthorizationHeader=d.hasCustomAuthorizationHeader,this.throwOnError=d.throwOnError,this.lockAcquireTimeout=d.lockAcquireTimeout,d.lock!=null&&(this.lock=d.lock),this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new jw(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.passkey={startRegistration:this._startPasskeyRegistration.bind(this),verifyRegistration:this._verifyPasskeyRegistration.bind(this),startAuthentication:this._startPasskeyAuthentication.bind(this),verifyAuthentication:this._verifyPasskeyAuthentication.bind(this),list:this._listPasskeys.bind(this),update:this._updatePasskey.bind(this),delete:this._deletePasskey.bind(this)},this.persistSession?(d.storage?this.storage=d.storage:Vp()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=dp(this.memoryStorage)),d.userStorage&&(this.userStorage=d.userStorage)):(this.memoryStorage={},this.storage=dp(this.memoryStorage)),Nt()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(h){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",h)}(c=this.broadcastChannel)===null||c===void 0||c.addEventListener("message",async h=>{this._debug("received broadcast notification from other tab or client",h),(h.data.event==="TOKEN_REFRESHED"||h.data.event==="SIGNED_IN")&&(this.lastRefreshFailure=null);try{await this._notifyAllSubscribers(h.data.event,h.data.session,!1)}catch(m){this._debug("#broadcastChannel","error",m)}})}d.skipAutoInitialize||this.initialize().catch(h=>{this._debug("#initialize()","error",h)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(n){if(this.throwOnError&&n&&n.error)throw n.error;return n}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${Pp}) ${new Date().toISOString()}`}_debug(...n){return this.logDebugMessages&&this.logger(this._logPrefix(),...n),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()):await this._initialize())(),await this.initializePromise)}async _initialize(){var n;try{let r={},l="none";if(Nt()&&(r=ZS(window.location.href),this._isImplicitGrantCallback(r)?l="implicit":await this._isPKCECallback(r)&&(l="pkce")),Nt()&&this.detectSessionInUrl&&l!=="none"){const{data:c,error:d}=await this._getSessionFromURL(r,l);if(d){if(this._debug("#_initialize()","error detecting session from URL",d),PS(d)){const g=(n=d.details)===null||n===void 0?void 0:n.code;if(g==="identity_already_exists"||g==="identity_not_found"||g==="single_identity_not_deletable")return{error:d}}return{error:d}}const{session:h,redirectType:m}=c;return this._debug("#_initialize()","detected session in URL",h,"redirect type",m),await this._saveSession(h),setTimeout(async()=>{m==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",h):await this._notifyAllSubscribers("SIGNED_IN",h)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(r){return W(r)?this._returnResult({error:r}):this._returnResult({error:new An("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(n){var r,l,c;try{const d=await ee(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(l=(r=n?.options)===null||r===void 0?void 0:r.data)!==null&&l!==void 0?l:{},gotrue_meta_security:{captcha_token:(c=n?.options)===null||c===void 0?void 0:c.captchaToken}},xform:mn}),{data:h,error:m}=d;if(m||!h)return this._returnResult({data:{user:null,session:null},error:m});const g=h.session,p=h.user;return h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("SIGNED_IN",g)),this._returnResult({data:{user:p,session:g},error:null})}catch(d){if(W(d))return this._returnResult({data:{user:null,session:null},error:d});throw d}}async signUp(n){var r,l,c;try{let d;if("email"in n){const{email:S,password:b,options:T}=n;let A=null,C=null;this.flowType==="pkce"&&([A,C]=await _i(this.storage,this.storageKey)),d=await ee(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:T?.emailRedirectTo,body:{email:S,password:b,data:(r=T?.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:T?.captchaToken},code_challenge:A,code_challenge_method:C},xform:mn})}else if("phone"in n){const{phone:S,password:b,options:T}=n;d=await ee(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:S,password:b,data:(l=T?.data)!==null&&l!==void 0?l:{},channel:(c=T?.channel)!==null&&c!==void 0?c:"sms",gotrue_meta_security:{captcha_token:T?.captchaToken}},xform:mn})}else throw new Mo("You must provide either an email or phone number and a password");const{data:h,error:m}=d;if(m||!h)return await ct(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:m});const g=h.session,p=h.user;return h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("SIGNED_IN",g)),this._returnResult({data:{user:p,session:g},error:null})}catch(d){if(await ct(this.storage,`${this.storageKey}-code-verifier`),W(d))return this._returnResult({data:{user:null,session:null},error:d});throw d}}async signInWithPassword(n){try{let r;if("email"in n){const{email:d,password:h,options:m}=n;r=await ee(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:d,password:h,gotrue_meta_security:{captcha_token:m?.captchaToken}},xform:cp})}else if("phone"in n){const{phone:d,password:h,options:m}=n;r=await ee(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:d,password:h,gotrue_meta_security:{captcha_token:m?.captchaToken}},xform:cp})}else throw new Mo("You must provide either an email or phone number and a password");const{data:l,error:c}=r;if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!l||!l.session||!l.user){const d=new Sr;return this._returnResult({data:{user:null,session:null},error:d})}return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",l.session)),this._returnResult({data:Object.assign({user:l.user,session:l.session},l.weak_password?{weakPassword:l.weak_password}:null),error:c})}catch(r){if(W(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOAuth(n){var r,l,c,d;return await this._handleProviderSignIn(n.provider,{redirectTo:(r=n.options)===null||r===void 0?void 0:r.redirectTo,scopes:(l=n.options)===null||l===void 0?void 0:l.scopes,queryParams:(c=n.options)===null||c===void 0?void 0:c.queryParams,skipBrowserRedirect:(d=n.options)===null||d===void 0?void 0:d.skipBrowserRedirect})}async exchangeCodeForSession(n){return await this.initializePromise,this.lock!=null?this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(n)):this._exchangeCodeForSession(n)}async signInWithWeb3(n){const{chain:r}=n;switch(r){case"ethereum":return await this.signInWithEthereum(n);case"solana":return await this.signInWithSolana(n);default:throw new Error(`@supabase/auth-js: Unsupported chain "${r}"`)}}async signInWithEthereum(n){var r,l,c,d,h,m,g,p,S,b,T;let A,C;if("message"in n)A=n.message,C=n.signature;else{const{chain:z,wallet:G,statement:I,options:$}=n;let O;if(Nt())if(typeof G=="object")O=G;else{const Se=window;if("ethereum"in Se&&typeof Se.ethereum=="object"&&"request"in Se.ethereum&&typeof Se.ethereum.request=="function")O=Se.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof G!="object"||!$?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");O=G}const Y=new URL((r=$?.url)!==null&&r!==void 0?r:window.location.href),me=await O.request({method:"eth_requestAccounts"}).then(Se=>Se).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!me||me.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const ie=Yp(me[0]);let K=(l=$?.signInWithEthereum)===null||l===void 0?void 0:l.chainId;if(!K){const Se=await O.request({method:"eth_chainId"});K=ww(Se)}const Ee={domain:Y.host,address:ie,statement:I,uri:Y.href,version:"1",chainId:K,nonce:(c=$?.signInWithEthereum)===null||c===void 0?void 0:c.nonce,issuedAt:(h=(d=$?.signInWithEthereum)===null||d===void 0?void 0:d.issuedAt)!==null&&h!==void 0?h:new Date,expirationTime:(m=$?.signInWithEthereum)===null||m===void 0?void 0:m.expirationTime,notBefore:(g=$?.signInWithEthereum)===null||g===void 0?void 0:g.notBefore,requestId:(p=$?.signInWithEthereum)===null||p===void 0?void 0:p.requestId,resources:(S=$?.signInWithEthereum)===null||S===void 0?void 0:S.resources};A=Tw(Ee),C=await O.request({method:"personal_sign",params:[_w(A),ie]})}try{const{data:z,error:G}=await ee(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:A,signature:C},!((b=n.options)===null||b===void 0)&&b.captchaToken?{gotrue_meta_security:{captcha_token:(T=n.options)===null||T===void 0?void 0:T.captchaToken}}:null),xform:mn});if(G)throw G;if(!z||!z.session||!z.user){const I=new Sr;return this._returnResult({data:{user:null,session:null},error:I})}return z.session&&(await this._saveSession(z.session),await this._notifyAllSubscribers("SIGNED_IN",z.session)),this._returnResult({data:Object.assign({},z),error:G})}catch(z){if(W(z))return this._returnResult({data:{user:null,session:null},error:z});throw z}}async signInWithSolana(n){var r,l,c,d,h,m,g,p,S,b,T,A;let C,z;if("message"in n)C=n.message,z=n.signature;else{const{chain:G,wallet:I,statement:$,options:O}=n;let Y;if(Nt())if(typeof I=="object")Y=I;else{const ie=window;if("solana"in ie&&typeof ie.solana=="object"&&("signIn"in ie.solana&&typeof ie.solana.signIn=="function"||"signMessage"in ie.solana&&typeof ie.solana.signMessage=="function"))Y=ie.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof I!="object"||!O?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");Y=I}const me=new URL((r=O?.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in Y&&Y.signIn){const ie=await Y.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},O?.signInWithSolana),{version:"1",domain:me.host,uri:me.href}),$?{statement:$}:null));let K;if(Array.isArray(ie)&&ie[0]&&typeof ie[0]=="object")K=ie[0];else if(ie&&typeof ie=="object"&&"signedMessage"in ie&&"signature"in ie)K=ie;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in K&&"signature"in K&&(typeof K.signedMessage=="string"||K.signedMessage instanceof Uint8Array)&&K.signature instanceof Uint8Array)C=typeof K.signedMessage=="string"?K.signedMessage:new TextDecoder().decode(K.signedMessage),z=K.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in Y)||typeof Y.signMessage!="function"||!("publicKey"in Y)||typeof Y!="object"||!Y.publicKey||!("toBase58"in Y.publicKey)||typeof Y.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");C=[`${me.host} wants you to sign in with your Solana account:`,Y.publicKey.toBase58(),...$?["",$,""]:[""],"Version: 1",`URI: ${me.href}`,`Issued At: ${(c=(l=O?.signInWithSolana)===null||l===void 0?void 0:l.issuedAt)!==null&&c!==void 0?c:new Date().toISOString()}`,...!((d=O?.signInWithSolana)===null||d===void 0)&&d.notBefore?[`Not Before: ${O.signInWithSolana.notBefore}`]:[],...!((h=O?.signInWithSolana)===null||h===void 0)&&h.expirationTime?[`Expiration Time: ${O.signInWithSolana.expirationTime}`]:[],...!((m=O?.signInWithSolana)===null||m===void 0)&&m.chainId?[`Chain ID: ${O.signInWithSolana.chainId}`]:[],...!((g=O?.signInWithSolana)===null||g===void 0)&&g.nonce?[`Nonce: ${O.signInWithSolana.nonce}`]:[],...!((p=O?.signInWithSolana)===null||p===void 0)&&p.requestId?[`Request ID: ${O.signInWithSolana.requestId}`]:[],...!((b=(S=O?.signInWithSolana)===null||S===void 0?void 0:S.resources)===null||b===void 0)&&b.length?["Resources",...O.signInWithSolana.resources.map(K=>`- ${K}`)]:[]].join(`
37
+ `);const ie=await Y.signMessage(new TextEncoder().encode(C),"utf8");if(!ie||!(ie instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");z=ie}}try{const{data:G,error:I}=await ee(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:C,signature:Ei(z)},!((T=n.options)===null||T===void 0)&&T.captchaToken?{gotrue_meta_security:{captcha_token:(A=n.options)===null||A===void 0?void 0:A.captchaToken}}:null),xform:mn});if(I)throw I;if(!G||!G.session||!G.user){const $=new Sr;return this._returnResult({data:{user:null,session:null},error:$})}return G.session&&(await this._saveSession(G.session),await this._notifyAllSubscribers("SIGNED_IN",G.session)),this._returnResult({data:Object.assign({},G),error:I})}catch(G){if(W(G))return this._returnResult({data:{user:null,session:null},error:G});throw G}}async _exchangeCodeForSession(n){const r=await _n(this.storage,`${this.storageKey}-code-verifier`),[l,c]=(r??"").split("/");try{if(!l&&this.flowType==="pkce")throw new IS;const{data:d,error:h}=await ee(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:n,code_verifier:l},xform:mn});if(await ct(this.storage,`${this.storageKey}-code-verifier`),h)throw h;if(!d||!d.session||!d.user){const m=new Sr;return this._returnResult({data:{user:null,session:null,redirectType:null},error:m})}return d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers(c==="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",d.session)),this._returnResult({data:Object.assign(Object.assign({},d),{redirectType:c??null}),error:h})}catch(d){if(await ct(this.storage,`${this.storageKey}-code-verifier`),W(d))return this._returnResult({data:{user:null,session:null,redirectType:null},error:d});throw d}}async signInWithIdToken(n){try{const{options:r,provider:l,token:c,access_token:d,nonce:h}=n,m=await ee(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:l,id_token:c,access_token:d,nonce:h,gotrue_meta_security:{captcha_token:r?.captchaToken}},xform:mn}),{data:g,error:p}=m;if(p)return this._returnResult({data:{user:null,session:null},error:p});if(!g||!g.session||!g.user){const S=new Sr;return this._returnResult({data:{user:null,session:null},error:S})}return g.session&&(await this._saveSession(g.session),await this._notifyAllSubscribers("SIGNED_IN",g.session)),this._returnResult({data:g,error:p})}catch(r){if(W(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOtp(n){var r,l,c,d,h;try{if("email"in n){const{email:m,options:g}=n;let p=null,S=null;this.flowType==="pkce"&&([p,S]=await _i(this.storage,this.storageKey));const{error:b}=await ee(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:m,data:(r=g?.data)!==null&&r!==void 0?r:{},create_user:(l=g?.shouldCreateUser)!==null&&l!==void 0?l:!0,gotrue_meta_security:{captcha_token:g?.captchaToken},code_challenge:p,code_challenge_method:S},redirectTo:g?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:b})}if("phone"in n){const{phone:m,options:g}=n,{data:p,error:S}=await ee(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:m,data:(c=g?.data)!==null&&c!==void 0?c:{},create_user:(d=g?.shouldCreateUser)!==null&&d!==void 0?d:!0,gotrue_meta_security:{captcha_token:g?.captchaToken},channel:(h=g?.channel)!==null&&h!==void 0?h:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:p?.message_id},error:S})}throw new Mo("You must provide either an email or phone number.")}catch(m){if(await ct(this.storage,`${this.storageKey}-code-verifier`),W(m))return this._returnResult({data:{user:null,session:null},error:m});throw m}}async verifyOtp(n){var r,l;try{let c,d;"options"in n&&(c=(r=n.options)===null||r===void 0?void 0:r.redirectTo,d=(l=n.options)===null||l===void 0?void 0:l.captchaToken);const{data:h,error:m}=await ee(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},n),{gotrue_meta_security:{captcha_token:d}}),redirectTo:c,xform:mn});if(m)throw m;if(!h)throw new Error("An error occurred on token verification.");const g=h.session,p=h.user;return g?.access_token&&(await this._saveSession(g),await this._notifyAllSubscribers(n.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",g)),this._returnResult({data:{user:p,session:g},error:null})}catch(c){if(W(c))return this._returnResult({data:{user:null,session:null},error:c});throw c}}async signInWithSSO(n){var r,l,c,d,h;try{let m=null,g=null;this.flowType==="pkce"&&([m,g]=await _i(this.storage,this.storageKey));const p=await ee(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in n?{provider_id:n.providerId}:null),"domain"in n?{domain:n.domain}:null),{redirect_to:(l=(r=n.options)===null||r===void 0?void 0:r.redirectTo)!==null&&l!==void 0?l:void 0}),!((c=n?.options)===null||c===void 0)&&c.captchaToken?{gotrue_meta_security:{captcha_token:n.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:m,code_challenge_method:g}),headers:this.headers,xform:gw});return!((d=p.data)===null||d===void 0)&&d.url&&Nt()&&!(!((h=n.options)===null||h===void 0)&&h.skipBrowserRedirect)&&window.location.assign(p.data.url),this._returnResult(p)}catch(m){if(await ct(this.storage,`${this.storageKey}-code-verifier`),W(m))return this._returnResult({data:null,error:m});throw m}}async reauthenticate(){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate()):await this._reauthenticate()}async _reauthenticate(){try{return await this._useSession(async n=>{const{data:{session:r},error:l}=n;if(l)throw l;if(!r)throw new _t;const{error:c}=await ee(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return this._returnResult({data:{user:null,session:null},error:c})})}catch(n){if(W(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async resend(n){try{const r=`${this.url}/resend`;if("email"in n){const{email:l,type:c,options:d}=n;let h=null,m=null;this.flowType==="pkce"&&([h,m]=await _i(this.storage,this.storageKey));const{error:g}=await ee(this.fetch,"POST",r,{headers:this.headers,body:{email:l,type:c,gotrue_meta_security:{captcha_token:d?.captchaToken},code_challenge:h,code_challenge_method:m},redirectTo:d?.emailRedirectTo});return g&&await ct(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:g})}else if("phone"in n){const{phone:l,type:c,options:d}=n,{data:h,error:m}=await ee(this.fetch,"POST",r,{headers:this.headers,body:{phone:l,type:c,gotrue_meta_security:{captcha_token:d?.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:h?.message_id},error:m})}throw new Mo("You must provide either an email or phone number and a type")}catch(r){if(await ct(this.storage,`${this.storageKey}-code-verifier`),W(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async getSession(){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async n=>n)):await this._useSession(async n=>n)}async _acquireLock(n,r){this._debug("#_acquireLock","begin",n);try{if(this.lockAcquired){const l=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),c=(async()=>(await l,await r()))();return this.pendingInLock.push((async()=>{try{await c}catch{}})()),c}return await this.lock(`lock:${this.storageKey}`,n,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const l=r();for(this.pendingInLock.push((async()=>{try{await l}catch{}})()),await l;this.pendingInLock.length;){const c=[...this.pendingInLock];await Promise.all(c),this.pendingInLock.splice(0,c.length)}return await l}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(n){this._debug("#_useSession","begin");try{const r=await this.__loadSession();return await n(r)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lock!=null&&!this.lockAcquired&&this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let n=null;const r=await _n(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?n=r:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!n)return{data:{session:null},error:null};const l=n.expires_at?n.expires_at*1e3-Date.now()<fd:!1;if(this._debug("#__loadSession()",`session has${l?"":" not"} expired`,"expires_at",n.expires_at),!l){if(this.userStorage){const h=await _n(this.userStorage,this.storageKey+"-user");h?.user?n.user=h.user:n.user=md()}if(this.storage.isServer&&n.user&&!n.user.__isUserNotAvailableProxy){const h={value:this.suppressGetSessionWarning};n.user=dw(n.user,h),h.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:n},error:null}}const{data:c,error:d}=await this._callRefreshToken(n.refresh_token);if(d){if(!!(n.expires_at&&n.expires_at*1e3>Date.now())){const m=await _n(this.storage,this.storageKey);if(m&&m.refresh_token===n.refresh_token)return this._returnResult({data:{session:n},error:null})}return this._returnResult({data:{session:null},error:d})}return this._returnResult({data:{session:c},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(n){if(n)return await this._getUser(n);await this.initializePromise;let r;return this.lock!=null?r=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser()):r=await this._getUser(),r.data.user&&(this.suppressGetSessionWarning=!0),r}async _getUser(n){try{return n?await ee(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:n,xform:Wa}):await this._useSession(async r=>{var l,c,d;const{data:h,error:m}=r;if(m)throw m;return!(!((l=h.session)===null||l===void 0)&&l.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new _t}:await ee(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(d=(c=h.session)===null||c===void 0?void 0:c.access_token)!==null&&d!==void 0?d:void 0,xform:Wa})})}catch(r){if(W(r))return Do(r)&&(await this._removeSession(),await ct(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:r});throw r}}async updateUser(n,r={}){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(n,r)):await this._updateUser(n,r)}async _updateUser(n,r={}){try{return await this._useSession(async l=>{const{data:c,error:d}=l;if(d)throw d;if(!c.session)throw new _t;const h=c.session;let m=null,g=null;this.flowType==="pkce"&&n.email!=null&&([m,g]=await _i(this.storage,this.storageKey));const{data:p,error:S}=await ee(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r?.emailRedirectTo,body:Object.assign(Object.assign({},n),{code_challenge:m,code_challenge_method:g}),jwt:h.access_token,xform:Wa});if(S)throw S;return h.user=p.user,await this._saveSession(h),await this._notifyAllSubscribers("USER_UPDATED",h),this._returnResult({data:{user:h.user},error:null})})}catch(l){if(await ct(this.storage,`${this.storageKey}-code-verifier`),W(l))return this._returnResult({data:{user:null},error:l});throw l}}async setSession(n){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(n)):await this._setSession(n)}async _setSession(n){try{if(!n.access_token||!n.refresh_token)throw new _t;const r=Date.now()/1e3;let l=r,c=!0,d=null;const{payload:h}=zo(n.access_token);if(h.exp&&(l=h.exp,c=l<=r),c){const{data:m,error:g}=await this._callRefreshToken(n.refresh_token);if(g)return this._returnResult({data:{user:null,session:null},error:g});if(!m)return{data:{user:null,session:null},error:null};d=m}else{const{data:m,error:g}=await this._getUser(n.access_token);if(g)return this._returnResult({data:{user:null,session:null},error:g});d={access_token:n.access_token,refresh_token:n.refresh_token,user:m.user,token_type:"bearer",expires_in:l-r,expires_at:l},await this._saveSession(d),await this._notifyAllSubscribers("SIGNED_IN",d)}return this._returnResult({data:{user:d.user,session:d},error:null})}catch(r){if(W(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}}async refreshSession(n){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(n)):await this._refreshSession(n)}async _refreshSession(n){try{return await this._useSession(async r=>{var l;if(!n){const{data:h,error:m}=r;if(m)throw m;n=(l=h.session)!==null&&l!==void 0?l:void 0}if(!n?.refresh_token)throw new _t;const{data:c,error:d}=await this._callRefreshToken(n.refresh_token);return d?this._returnResult({data:{user:null,session:null},error:d}):c?this._returnResult({data:{user:c.user,session:c},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(r){if(W(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(n,r){var l;try{if(!Nt())throw new Uo("No browser detected.");if(n.error||n.error_description||n.error_code)throw new Uo(n.error_description||"Error in URL with unspecified error_description",{error:n.error||"unspecified_error",code:n.error_code||"unspecified_code"});switch(r){case"implicit":if(this.flowType==="pkce")throw new ep("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Uo("Not a valid implicit grant flow url.");break;default:}if(r==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!n.code)throw new ep("No code detected.");const{data:O,error:Y}=await this._exchangeCodeForSession(n.code);if(Y)throw Y;const me=new URL(window.location.href);return me.searchParams.delete("code"),window.history.replaceState(window.history.state,"",me.toString()),{data:{session:O.session,redirectType:(l=O.redirectType)!==null&&l!==void 0?l:null},error:null}}const{provider_token:c,provider_refresh_token:d,access_token:h,refresh_token:m,expires_in:g,expires_at:p,token_type:S}=n;if(!h||!g||!m||!S)throw new Uo("No session defined in URL");const b=Math.round(Date.now()/1e3),T=parseInt(g);let A=b+T;p&&(A=parseInt(p));const C=A-b;C*1e3<=ya&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${C}s, should have been closer to ${T}s`);const z=A-T;b-z>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",z,A,b):b-z<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",z,A,b);const{data:G,error:I}=await this._getUser(h);if(I)throw I;const $={provider_token:c,provider_refresh_token:d,access_token:h,expires_in:T,expires_at:A,refresh_token:m,token_type:S,user:G.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:$,redirectType:n.type},error:null})}catch(c){if(W(c))return this._returnResult({data:{session:null,redirectType:null},error:c});throw c}}_isImplicitGrantCallback(n){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),n):!!(n.access_token||n.error||n.error_description||n.error_code)}async _isPKCECallback(n){const r=await _n(this.storage,`${this.storageKey}-code-verifier`);return!!(n.code&&r)}async signOut(n={scope:"global"}){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(n)):await this._signOut(n)}async _signOut({scope:n}={scope:"global"}){return await this._useSession(async r=>{var l;const{data:c,error:d}=r;if(d&&!Do(d))return this._returnResult({error:d});const h=(l=c.session)===null||l===void 0?void 0:l.access_token;if(h){const{error:m}=await this.admin.signOut(h,n);if(m&&!($S(m)&&(m.status===404||m.status===401||m.status===403)||Do(m)))return this._returnResult({error:m})}return n!=="others"&&(await this._removeSession(),await ct(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(n){const r=QS(),l={id:r,callback:n,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",r),this.stateChangeEmitters.delete(r)}};return this._debug("#onAuthStateChange()","registered callback with id",r),this.stateChangeEmitters.set(r,l),(async()=>(await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(r)}):await this._emitInitialSession(r)))(),{data:{subscription:l}}}async _emitInitialSession(n){return await this._useSession(async r=>{var l,c;try{const{data:{session:d},error:h}=r;if(h)throw h;await((l=this.stateChangeEmitters.get(n))===null||l===void 0?void 0:l.callback("INITIAL_SESSION",d)),this._debug("INITIAL_SESSION","callback id",n,"session",d)}catch(d){await((c=this.stateChangeEmitters.get(n))===null||c===void 0?void 0:c.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",n,"error",d),Do(d)?console.warn(d):console.error(d)}})}async resetPasswordForEmail(n,r={}){let l=null,c=null;this.flowType==="pkce"&&([l,c]=await _i(this.storage,this.storageKey,!0));try{return await ee(this.fetch,"POST",`${this.url}/recover`,{body:{email:n,code_challenge:l,code_challenge_method:c,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(d){if(await ct(this.storage,`${this.storageKey}-code-verifier`),W(d))return this._returnResult({data:null,error:d});throw d}}async getUserIdentities(){var n;try{const{data:r,error:l}=await this.getUser();if(l)throw l;return this._returnResult({data:{identities:(n=r.user.identities)!==null&&n!==void 0?n:[]},error:null})}catch(r){if(W(r))return this._returnResult({data:null,error:r});throw r}}async linkIdentity(n){return"token"in n?this.linkIdentityIdToken(n):this.linkIdentityOAuth(n)}async linkIdentityOAuth(n){var r;try{const{data:l,error:c}=await this._useSession(async d=>{var h,m,g,p,S;const{data:b,error:T}=d;if(T)throw T;const A=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,n.provider,{redirectTo:(h=n.options)===null||h===void 0?void 0:h.redirectTo,scopes:(m=n.options)===null||m===void 0?void 0:m.scopes,queryParams:(g=n.options)===null||g===void 0?void 0:g.queryParams,skipBrowserRedirect:!0});return await ee(this.fetch,"GET",A,{headers:this.headers,jwt:(S=(p=b.session)===null||p===void 0?void 0:p.access_token)!==null&&S!==void 0?S:void 0})});if(c)throw c;return Nt()&&!(!((r=n.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(l?.url),this._returnResult({data:{provider:n.provider,url:l?.url},error:null})}catch(l){if(W(l))return this._returnResult({data:{provider:n.provider,url:null},error:l});throw l}}async linkIdentityIdToken(n){return await this._useSession(async r=>{var l;try{const{error:c,data:{session:d}}=r;if(c)throw c;const{options:h,provider:m,token:g,access_token:p,nonce:S}=n,b=await ee(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(l=d?.access_token)!==null&&l!==void 0?l:void 0,body:{provider:m,id_token:g,access_token:p,nonce:S,link_identity:!0,gotrue_meta_security:{captcha_token:h?.captchaToken}},xform:mn}),{data:T,error:A}=b;return A?this._returnResult({data:{user:null,session:null},error:A}):!T||!T.session||!T.user?this._returnResult({data:{user:null,session:null},error:new Sr}):(T.session&&(await this._saveSession(T.session),await this._notifyAllSubscribers("USER_UPDATED",T.session)),this._returnResult({data:T,error:A}))}catch(c){if(await ct(this.storage,`${this.storageKey}-code-verifier`),W(c))return this._returnResult({data:{user:null,session:null},error:c});throw c}})}async unlinkIdentity(n){try{return await this._useSession(async r=>{var l,c;const{data:d,error:h}=r;if(h)throw h;return await ee(this.fetch,"DELETE",`${this.url}/user/identities/${n.identity_id}`,{headers:this.headers,jwt:(c=(l=d.session)===null||l===void 0?void 0:l.access_token)!==null&&c!==void 0?c:void 0})})}catch(r){if(W(r))return this._returnResult({data:null,error:r});throw r}}async _refreshAccessToken(n){const r="#_refreshAccessToken()";this._debug(r,"begin");try{const l=Date.now();return await tw(async c=>(c>0&&await ew(200*Math.pow(2,c-1)),this._debug(r,"refreshing attempt",c),await ee(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:n},headers:this.headers,xform:mn})),(c,d)=>{const h=200*Math.pow(2,c);return d&&tp(d)&&Date.now()+h-l<ya})}catch(l){if(this._debug(r,"error",l),W(l))return this._returnResult({data:{session:null,user:null},error:l});throw l}finally{this._debug(r,"end")}}_isValidSession(n){return typeof n=="object"&&n!==null&&"access_token"in n&&"refresh_token"in n&&"expires_at"in n}async _handleProviderSignIn(n,r){const l=await this._getUrlForProvider(`${this.url}/authorize`,n,{redirectTo:r.redirectTo,scopes:r.scopes,queryParams:r.queryParams});return this._debug("#_handleProviderSignIn()","provider",n,"options",r,"url",l),Nt()&&!r.skipBrowserRedirect&&window.location.assign(l),{data:{provider:n,url:l},error:null}}async _recoverAndRefresh(){var n,r;const l="#_recoverAndRefresh()";this._debug(l,"begin");try{const c=await _n(this.storage,this.storageKey);if(c&&this.userStorage){let h=await _n(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!h&&(h={user:c.user},await Or(this.userStorage,this.storageKey+"-user",h)),c.user=(n=h?.user)!==null&&n!==void 0?n:md()}else if(c&&!c.user&&!c.user){const h=await _n(this.storage,this.storageKey+"-user");h&&h?.user?(c.user=h.user,await ct(this.storage,this.storageKey+"-user"),await Or(this.storage,this.storageKey,c)):c.user=md()}if(this._debug(l,"session from storage",c),!this._isValidSession(c)){this._debug(l,"session is not valid"),c!==null&&await this._removeSession();return}const d=((r=c.expires_at)!==null&&r!==void 0?r:1/0)*1e3-Date.now()<fd;if(this._debug(l,`session has${d?"":" not"} expired with margin of ${fd}s`),d){if(this.autoRefreshToken&&c.refresh_token){const{error:h}=await this._callRefreshToken(c.refresh_token);h&&(GS(h)?this._debug(l,"refresh discarded by commit guard",h):this._debug(l,"refresh failed",h))}}else if(c.user&&c.user.__isUserNotAvailableProxy===!0)try{const{data:h,error:m}=await this._getUser(c.access_token);!m&&h?.user?(c.user=h.user,await this._saveSession(c),await this._notifyAllSubscribers("SIGNED_IN",c)):this._debug(l,"could not get user data, skipping SIGNED_IN notification")}catch(h){console.error("Error getting user data:",h),this._debug(l,"error getting user data, skipping SIGNED_IN notification",h)}else await this._notifyAllSubscribers("SIGNED_IN",c)}catch(c){this._debug(l,"error",c),console.error(c);return}finally{this._debug(l,"end")}}async _callRefreshToken(n){var r,l;if(!n)throw new _t;if(this.refreshingDeferred)return this.refreshingDeferred.promise;if(this.lastRefreshFailure&&this.lastRefreshFailure.refreshToken===n&&Date.now()<this.lastRefreshFailure.expiresAt)return this._debug("#_callRefreshToken()","returning cached failure (cooldown active)"),this.lastRefreshFailure.result;const c="#_callRefreshToken()";this._debug(c,"begin");try{this.refreshingDeferred=new Zo;const d=await _n(this.storage,this.storageKey),{data:h,error:m}=await this._refreshAccessToken(n);if(m)throw m;if(!h.session)throw new _t;const g=await _n(this.storage,this.storageKey);if(d!==null&&(g===null||g.refresh_token!==d.refresh_token)){this._debug(c,"commit guard: storage changed since refresh started, discarding rotated tokens",{startedWith:"present",nowHolds:g?"replaced":"cleared"});const T={data:null,error:new np};return this.refreshingDeferred.resolve(T),T}const S=this._sessionRemovalEpoch;if(await this._saveSession(h.session),this._sessionRemovalEpoch!==S){this._debug(c,"commit guard (post-save): _removeSession ran during _saveSession, undoing write"),await ct(this.storage,this.storageKey),this.userStorage&&await ct(this.userStorage,this.storageKey+"-user");const T={data:null,error:new np};return this.refreshingDeferred.resolve(T),T}await this._notifyAllSubscribers("TOKEN_REFRESHED",h.session);const b={data:h.session,error:null};return this.lastRefreshFailure=null,this.refreshingDeferred.resolve(b),b}catch(d){if(this._debug(c,"error",d),W(d)){const h={data:null,error:d};if(!tp(d)){const m=await _n(this.storage,this.storageKey);!!(m?.expires_at&&m.expires_at*1e3>Date.now())?this._debug(c,"proactive refresh failed, access token still valid — preserving session"):await this._removeSession()}return this.lastRefreshFailure={refreshToken:n,result:h,expiresAt:Date.now()+DS},(r=this.refreshingDeferred)===null||r===void 0||r.resolve(h),h}throw(l=this.refreshingDeferred)===null||l===void 0||l.reject(d),d}finally{this.refreshingDeferred=null,this._debug(c,"end")}}async _notifyAllSubscribers(n,r,l=!0){const c=`#_notifyAllSubscribers(${n})`;this._debug(c,"begin",r,`broadcast = ${l}`);try{this.broadcastChannel&&l&&this.broadcastChannel.postMessage({event:n,session:r});const d=[],h=Array.from(this.stateChangeEmitters.values()).map(async m=>{try{await m.callback(n,r)}catch(g){d.push(g)}});if(await Promise.all(h),d.length>0){for(let m=0;m<d.length;m+=1)console.error(d[m]);throw d[0]}}finally{this._debug(c,"end")}}async _saveSession(n){this._debug("#_saveSession()",n),this.suppressGetSessionWarning=!0,await ct(this.storage,`${this.storageKey}-code-verifier`);const r=Object.assign({},n),l=r.user&&r.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!l&&r.user&&await Or(this.userStorage,this.storageKey+"-user",{user:r.user});const c=Object.assign({},r);delete c.user;const d=lp(c);await Or(this.storage,this.storageKey,d)}else{const c=lp(r);await Or(this.storage,this.storageKey,c)}}async _removeSession(){this._sessionRemovalEpoch+=1,this._debug("#_removeSession()"),this.lastRefreshFailure=null,this.suppressGetSessionWarning=!1,await ct(this.storage,this.storageKey),await ct(this.storage,this.storageKey+"-code-verifier"),await ct(this.storage,this.storageKey+"-user"),this.userStorage&&await ct(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const n=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{n&&Nt()&&window?.removeEventListener&&window.removeEventListener("visibilitychange",n)}catch(r){console.error("removing visibilitychange callback failed",r)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const n=setInterval(()=>this._autoRefreshTokenTick(),ya);this.autoRefreshTicker=n,n&&typeof n=="object"&&typeof n.unref=="function"?n.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(n);const r=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=r,r&&typeof r=="object"&&typeof r.unref=="function"?r.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(r)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const n=this.autoRefreshTicker;this.autoRefreshTicker=null,n&&clearInterval(n);const r=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,r&&clearTimeout(r)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async dispose(){var n;this._removeVisibilityChangedCallback(),await this._stopAutoRefresh(),(n=this.broadcastChannel)===null||n===void 0||n.close(),this.broadcastChannel=null,this.stateChangeEmitters.clear()}async _autoRefreshTokenTick(){if(this._debug("#_autoRefreshTokenTick()","begin"),this.lock!=null){try{await this._acquireLock(0,async()=>{try{const n=Date.now();try{return await this._useSession(async r=>{const{data:{session:l}}=r;if(!l||!l.refresh_token||!l.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const c=Math.floor((l.expires_at*1e3-n)/ya);this._debug("#_autoRefreshTokenTick()",`access token expires in ${c} ticks, a tick lasts ${ya}ms, refresh threshold is ${Js} ticks`),c<=Js&&await this._callRefreshToken(l.refresh_token)})}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(n){if(n instanceof bw)this._debug("auto refresh token tick lock not available");else throw n}return}if(this.refreshingDeferred!==null){this._debug("#_autoRefreshTokenTick()","refresh already in flight, skipping");return}try{const n=Date.now();try{await this._useSession(async r=>{const{data:{session:l}}=r;if(!l||!l.refresh_token||!l.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const c=Math.floor((l.expires_at*1e3-n)/ya);this._debug("#_autoRefreshTokenTick()",`access token expires in ${c} ticks, a tick lasts ${ya}ms, refresh threshold is ${Js} ticks`),c<=Js&&await this._callRefreshToken(l.refresh_token)})}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Nt()||!window?.addEventListener)return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(n){this._debug("#visibilityChangedCallback","error",n)}},window?.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(n){console.error("_handleVisibilityChange",n)}}async _onVisibilityChanged(n){const r=`#_onVisibilityChanged(${n})`;if(this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"){if(this.autoRefreshToken&&this._startAutoRefresh(),!n)if(await this.initializePromise,this.lock!=null)await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(r,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()});else{if(document.visibilityState!=="visible"){this._debug(r,"visibilityState is no longer visible, skipping recovery");return}await this._recoverAndRefresh()}}else document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(n,r,l){const c=[`provider=${encodeURIComponent(r)}`];if(l?.redirectTo&&c.push(`redirect_to=${encodeURIComponent(l.redirectTo)}`),l?.scopes&&c.push(`scopes=${encodeURIComponent(l.scopes)}`),this.flowType==="pkce"){const[d,h]=await _i(this.storage,this.storageKey),m=new URLSearchParams({code_challenge:`${encodeURIComponent(d)}`,code_challenge_method:`${encodeURIComponent(h)}`});c.push(m.toString())}if(l?.queryParams){const d=new URLSearchParams(l.queryParams);c.push(d.toString())}return l?.skipBrowserRedirect&&c.push(`skip_http_redirect=${l.skipBrowserRedirect}`),`${n}?${c.join("&")}`}async _unenroll(n){try{return await this._useSession(async r=>{var l;const{data:c,error:d}=r;return d?this._returnResult({data:null,error:d}):await ee(this.fetch,"DELETE",`${this.url}/factors/${n.factorId}`,{headers:this.headers,jwt:(l=c?.session)===null||l===void 0?void 0:l.access_token})})}catch(r){if(W(r))return this._returnResult({data:null,error:r});throw r}}async _enroll(n){try{return await this._useSession(async r=>{var l,c;const{data:d,error:h}=r;if(h)return this._returnResult({data:null,error:h});const m=Object.assign({friendly_name:n.friendlyName,factor_type:n.factorType},n.factorType==="phone"?{phone:n.phone}:n.factorType==="totp"?{issuer:n.issuer}:{}),{data:g,error:p}=await ee(this.fetch,"POST",`${this.url}/factors`,{body:m,headers:this.headers,jwt:(l=d?.session)===null||l===void 0?void 0:l.access_token});return p?this._returnResult({data:null,error:p}):(n.factorType==="totp"&&g.type==="totp"&&(!((c=g?.totp)===null||c===void 0)&&c.qr_code)&&(g.totp.qr_code=`data:image/svg+xml;utf-8,${g.totp.qr_code}`),this._returnResult({data:g,error:null}))})}catch(r){if(W(r))return this._returnResult({data:null,error:r});throw r}}async _verify(n){const r=async()=>{try{return await this._useSession(async l=>{var c;const{data:d,error:h}=l;if(h)return this._returnResult({data:null,error:h});const m=Object.assign({challenge_id:n.challengeId},"webauthn"in n?{webauthn:Object.assign(Object.assign({},n.webauthn),{credential_response:n.webauthn.type==="create"?mp(n.webauthn.credential_response):gp(n.webauthn.credential_response)})}:{code:n.code}),{data:g,error:p}=await ee(this.fetch,"POST",`${this.url}/factors/${n.factorId}/verify`,{body:m,headers:this.headers,jwt:(c=d?.session)===null||c===void 0?void 0:c.access_token});return p?this._returnResult({data:null,error:p}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+g.expires_in},g)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",g),this._returnResult({data:g,error:p}))})}catch(l){if(W(l))return this._returnResult({data:null,error:l});throw l}};return this.lock!=null?this._acquireLock(this.lockAcquireTimeout,r):r()}async _challenge(n){const r=async()=>{try{return await this._useSession(async l=>{var c;const{data:d,error:h}=l;if(h)return this._returnResult({data:null,error:h});const m=await ee(this.fetch,"POST",`${this.url}/factors/${n.factorId}/challenge`,{body:n,headers:this.headers,jwt:(c=d?.session)===null||c===void 0?void 0:c.access_token});if(m.error)return m;const{data:g}=m;if(g.type!=="webauthn")return{data:g,error:null};switch(g.webauthn.type){case"create":return{data:Object.assign(Object.assign({},g),{webauthn:Object.assign(Object.assign({},g.webauthn),{credential_options:Object.assign(Object.assign({},g.webauthn.credential_options),{publicKey:hp(g.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},g),{webauthn:Object.assign(Object.assign({},g.webauthn),{credential_options:Object.assign(Object.assign({},g.webauthn.credential_options),{publicKey:fp(g.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(l){if(W(l))return this._returnResult({data:null,error:l});throw l}};return this.lock!=null?this._acquireLock(this.lockAcquireTimeout,r):r()}async _challengeAndVerify(n){const{data:r,error:l}=await this._challenge({factorId:n.factorId});return l?this._returnResult({data:null,error:l}):await this._verify({factorId:n.factorId,challengeId:r.id,code:n.code})}async _listFactors(){var n;const{data:{user:r},error:l}=await this.getUser();if(l)return{data:null,error:l};const c={all:[],phone:[],totp:[],webauthn:[]};for(const d of(n=r?.factors)!==null&&n!==void 0?n:[])c.all.push(d),d.status==="verified"&&c[d.factor_type].push(d);return{data:c,error:null}}async _getAuthenticatorAssuranceLevel(n){var r,l,c,d;if(n)try{const{payload:A}=zo(n);let C=null;A.aal&&(C=A.aal);let z=C;const{data:{user:G},error:I}=await this.getUser(n);if(I)return this._returnResult({data:null,error:I});((l=(r=G?.factors)===null||r===void 0?void 0:r.filter(Y=>Y.status==="verified"))!==null&&l!==void 0?l:[]).length>0&&(z="aal2");const O=A.amr||[];return{data:{currentLevel:C,nextLevel:z,currentAuthenticationMethods:O},error:null}}catch(A){if(W(A))return this._returnResult({data:null,error:A});throw A}const{data:{session:h},error:m}=await this.getSession();if(m)return this._returnResult({data:null,error:m});if(!h)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:g}=zo(h.access_token);let p=null;g.aal&&(p=g.aal);let S=p;((d=(c=h.user.factors)===null||c===void 0?void 0:c.filter(A=>A.status==="verified"))!==null&&d!==void 0?d:[]).length>0&&(S="aal2");const T=g.amr||[];return{data:{currentLevel:p,nextLevel:S,currentAuthenticationMethods:T},error:null}}async _getAuthorizationDetails(n){try{return await this._useSession(async r=>{const{data:{session:l},error:c}=r;return c?this._returnResult({data:null,error:c}):l?await ee(this.fetch,"GET",`${this.url}/oauth/authorizations/${n}`,{headers:this.headers,jwt:l.access_token,xform:d=>({data:d,error:null})}):this._returnResult({data:null,error:new _t})})}catch(r){if(W(r))return this._returnResult({data:null,error:r});throw r}}async _approveAuthorization(n,r){try{return await this._useSession(async l=>{const{data:{session:c},error:d}=l;if(d)return this._returnResult({data:null,error:d});if(!c)return this._returnResult({data:null,error:new _t});const h=await ee(this.fetch,"POST",`${this.url}/oauth/authorizations/${n}/consent`,{headers:this.headers,jwt:c.access_token,body:{action:"approve"},xform:m=>({data:m,error:null})});return h.data&&h.data.redirect_url&&Nt()&&!r?.skipBrowserRedirect&&window.location.assign(h.data.redirect_url),h})}catch(l){if(W(l))return this._returnResult({data:null,error:l});throw l}}async _denyAuthorization(n,r){try{return await this._useSession(async l=>{const{data:{session:c},error:d}=l;if(d)return this._returnResult({data:null,error:d});if(!c)return this._returnResult({data:null,error:new _t});const h=await ee(this.fetch,"POST",`${this.url}/oauth/authorizations/${n}/consent`,{headers:this.headers,jwt:c.access_token,body:{action:"deny"},xform:m=>({data:m,error:null})});return h.data&&h.data.redirect_url&&Nt()&&!r?.skipBrowserRedirect&&window.location.assign(h.data.redirect_url),h})}catch(l){if(W(l))return this._returnResult({data:null,error:l});throw l}}async _listOAuthGrants(){try{return await this._useSession(async n=>{const{data:{session:r},error:l}=n;return l?this._returnResult({data:null,error:l}):r?await ee(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,xform:c=>({data:c,error:null})}):this._returnResult({data:null,error:new _t})})}catch(n){if(W(n))return this._returnResult({data:null,error:n});throw n}}async _revokeOAuthGrant(n){try{return await this._useSession(async r=>{const{data:{session:l},error:c}=r;return c?this._returnResult({data:null,error:c}):l?(await ee(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:l.access_token,query:{client_id:n.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new _t})})}catch(r){if(W(r))return this._returnResult({data:null,error:r});throw r}}async fetchJwk(n,r={keys:[]}){let l=r.keys.find(m=>m.kid===n);if(l)return l;const c=Date.now();if(l=this.jwks.keys.find(m=>m.kid===n),l&&this.jwks_cached_at+HS>c)return l;const{data:d,error:h}=await ee(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(h)throw h;return!d.keys||d.keys.length===0||(this.jwks=d,this.jwks_cached_at=c,l=d.keys.find(m=>m.kid===n),!l)?null:l}async getClaims(n,r={}){try{let l=n;if(!l){const{data:A,error:C}=await this.getSession();if(C||!A.session)return this._returnResult({data:null,error:C});l=A.session.access_token}const{header:c,payload:d,signature:h,raw:{header:m,payload:g}}=zo(l);if(!r?.allowExpired)try{ow(d.exp)}catch(A){throw new Io(A instanceof Error?A.message:"JWT validation failed")}const p=!c.alg||c.alg.startsWith("HS")||!c.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(c.kid,r?.keys?{keys:r.keys}:r?.jwks);if(!p){const{error:A}=await this.getUser(l);if(A)throw A;return{data:{claims:d,header:c,signature:h},error:null}}const S=cw(c.alg),b=await crypto.subtle.importKey("jwk",p,S,!0,["verify"]);if(!await crypto.subtle.verify(S,b,h,XS(`${m}.${g}`)))throw new Io("Invalid JWT signature");return{data:{claims:d,header:c,signature:h},error:null}}catch(l){if(W(l))return this._returnResult({data:null,error:l});throw l}}async signInWithPasskey(n){var r,l,c;Tn(this.experimental);try{if(!Ko())return this._returnResult({data:null,error:new An("Browser does not support WebAuthn",null)});const{data:d,error:h}=await this._startPasskeyAuthentication({options:{captchaToken:(r=n?.options)===null||r===void 0?void 0:r.captchaToken}});if(h||!d)return this._returnResult({data:null,error:h});const m=fp(d.options),g=(c=(l=n?.options)===null||l===void 0?void 0:l.signal)!==null&&c!==void 0?c:Hd.createNewAbortSignal(),{data:p,error:S}=await Wp({publicKey:m,signal:g});if(S||!p)return this._returnResult({data:null,error:S??new An("WebAuthn ceremony failed",null)});const b=gp(p);return this._verifyPasskeyAuthentication({challengeId:d.challenge_id,credential:b})}catch(d){if(W(d))return this._returnResult({data:null,error:d});throw d}}async registerPasskey(n){var r,l;Tn(this.experimental);try{if(!Ko())return this._returnResult({data:null,error:new An("Browser does not support WebAuthn",null)});const{data:c,error:d}=await this._startPasskeyRegistration();if(d||!c)return this._returnResult({data:null,error:d});const h=hp(c.options),m=(l=(r=n?.options)===null||r===void 0?void 0:r.signal)!==null&&l!==void 0?l:Hd.createNewAbortSignal(),{data:g,error:p}=await Xp({publicKey:h,signal:m});if(p||!g)return this._returnResult({data:null,error:p??new An("WebAuthn ceremony failed",null)});const S=mp(g);return this._verifyPasskeyRegistration({challengeId:c.challenge_id,credential:S})}catch(c){if(W(c))return this._returnResult({data:null,error:c});throw c}}async _startPasskeyRegistration(){Tn(this.experimental);try{return await this._useSession(async n=>{const{data:{session:r},error:l}=n;if(l)return this._returnResult({data:null,error:l});if(!r)return this._returnResult({data:null,error:new _t});const{data:c,error:d}=await ee(this.fetch,"POST",`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:r.access_token,body:{}});return d?this._returnResult({data:null,error:d}):this._returnResult({data:c,error:null})})}catch(n){if(W(n))return this._returnResult({data:null,error:n});throw n}}async _verifyPasskeyRegistration(n){Tn(this.experimental);try{return await this._useSession(async r=>{const{data:{session:l},error:c}=r;if(c)return this._returnResult({data:null,error:c});if(!l)return this._returnResult({data:null,error:new _t});const{data:d,error:h}=await ee(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:l.access_token,body:{challenge_id:n.challengeId,credential:n.credential}});return h?this._returnResult({data:null,error:h}):this._returnResult({data:d,error:null})})}catch(r){if(W(r))return this._returnResult({data:null,error:r});throw r}}async _startPasskeyAuthentication(n){var r;Tn(this.experimental);try{const{data:l,error:c}=await ee(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:(r=n?.options)===null||r===void 0?void 0:r.captchaToken}}});return c?this._returnResult({data:null,error:c}):this._returnResult({data:l,error:null})}catch(l){if(W(l))return this._returnResult({data:null,error:l});throw l}}async _verifyPasskeyAuthentication(n){Tn(this.experimental);try{const{data:r,error:l}=await ee(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:n.challengeId,credential:n.credential},xform:mn});return l?this._returnResult({data:null,error:l}):(r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:r,error:null}))}catch(r){if(W(r))return this._returnResult({data:null,error:r});throw r}}async _listPasskeys(){Tn(this.experimental);try{return await this._useSession(async n=>{const{data:{session:r},error:l}=n;if(l)return this._returnResult({data:null,error:l});if(!r)return this._returnResult({data:null,error:new _t});const{data:c,error:d}=await ee(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:r.access_token,xform:h=>({data:h,error:null})});return d?this._returnResult({data:null,error:d}):this._returnResult({data:c,error:null})})}catch(n){if(W(n))return this._returnResult({data:null,error:n});throw n}}async _updatePasskey(n){Tn(this.experimental);try{return await this._useSession(async r=>{const{data:{session:l},error:c}=r;if(c)return this._returnResult({data:null,error:c});if(!l)return this._returnResult({data:null,error:new _t});const{data:d,error:h}=await ee(this.fetch,"PATCH",`${this.url}/passkeys/${n.passkeyId}`,{headers:this.headers,jwt:l.access_token,body:{friendly_name:n.friendlyName}});return h?this._returnResult({data:null,error:h}):this._returnResult({data:d,error:null})})}catch(r){if(W(r))return this._returnResult({data:null,error:r});throw r}}async _deletePasskey(n){Tn(this.experimental);try{return await this._useSession(async r=>{const{data:{session:l},error:c}=r;if(c)return this._returnResult({data:null,error:c});if(!l)return this._returnResult({data:null,error:new _t});const{error:d}=await ee(this.fetch,"DELETE",`${this.url}/passkeys/${n.passkeyId}`,{headers:this.headers,jwt:l.access_token,noResolveJson:!0});return d?this._returnResult({data:null,error:d}):this._returnResult({data:null,error:null})})}catch(r){if(W(r))return this._returnResult({data:null,error:r});throw r}}}cl.nextInstanceID={};const Lw=cl,Dw="2.110.0";let Xs="",Jo;if(typeof Deno<"u"){var pd;Xs="deno",Jo=(pd=Deno.version)===null||pd===void 0?void 0:pd.deno}else if(typeof document<"u")Xs="web";else if(typeof navigator<"u"&&navigator.product==="ReactNative")Xs="react-native";else{var yd;Xs="node",Jo=typeof process<"u"?(yd=process.version)===null||yd===void 0?void 0:yd.replace(/^v/,""):void 0}const Qp=[`runtime=${Xs}`];Jo&&Qp.push(`runtime-version=${Jo}`);const Mw={"X-Client-Info":`supabase-js/${Dw}; ${Qp.join("; ")}`},Uw={headers:Mw},zw={schema:"public"},Bw={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Hw={},qw={enabled:!1,respectSamplingDecision:!0};function $w(i,n,r,l){function c(d){return d instanceof r?d:new r(function(h){h(d)})}return new(r||(r=Promise))(function(d,h){function m(S){try{p(l.next(S))}catch(b){h(b)}}function g(S){try{p(l.throw(S))}catch(b){h(b)}}function p(S){S.done?d(S.value):c(S.value).then(m,g)}p((l=l.apply(i,[])).next())})}let vd=null;const Pw="@opentelemetry/api";function Iw(){return vd===null&&(vd=import(Pw).catch(()=>null)),vd}function Gw(){return $w(this,void 0,void 0,function*(){try{const i=yield Iw();if(!i||!i.propagation||!i.context)return null;const n={};i.propagation.inject(i.context.active(),n);const r=n.traceparent;return r?{traceparent:r,tracestate:n.tracestate,baggage:n.baggage}:null}catch{return null}})}function Vw(i){if(!i||typeof i!="string")return null;const n=i.split("-");if(n.length!==4)return null;const[r,l,c,d]=n;if(r.length!==2||l.length!==32||c.length!==16||d.length!==2)return null;const h=/^[0-9a-f]+$/i;return!h.test(r)||!h.test(l)||!h.test(c)||!h.test(d)||l==="00000000000000000000000000000000"||c==="0000000000000000"?null:{version:r,traceId:l,parentId:c,traceFlags:d,isSampled:(parseInt(d,16)&1)===1}}function Kw(i,n){if(!i||!n||n.length===0)return!1;let r;if(i instanceof URL)r=i;else try{r=new URL(i)}catch{return!1}for(const l of n)try{if(typeof l=="string"){if(Yw(r.hostname,l))return!0}else if(l instanceof RegExp){if(l.test(r.hostname))return!0}else if(typeof l=="function"&&l(r))return!0}catch{continue}return!1}function Yw(i,n){if(n===i)return!0;if(n.startsWith("*.")){const r=n.slice(2);if(i.endsWith(r)&&(i===r||i.endsWith("."+r)))return!0}return!1}function Jw(i){const n=[];try{const r=new URL(i);n.push(r.hostname)}catch{}return n.push("*.supabase.co","*.supabase.in"),n.push("localhost","127.0.0.1","[::1]"),n}function ul(i){"@babel/helpers - typeof";return ul=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},ul(i)}function Xw(i,n){if(ul(i)!="object"||!i)return i;var r=i[Symbol.toPrimitive];if(r!==void 0){var l=r.call(i,n);if(ul(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(i)}function Ww(i){var n=Xw(i,"string");return ul(n)=="symbol"?n:n+""}function Qw(i,n,r){return(n=Ww(n))in i?Object.defineProperty(i,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):i[n]=r,i}function pp(i,n){var r=Object.keys(i);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(i);n&&(l=l.filter(function(c){return Object.getOwnPropertyDescriptor(i,c).enumerable})),r.push.apply(r,l)}return r}function st(i){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?pp(Object(r),!0).forEach(function(l){Qw(i,l,r[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(r)):pp(Object(r)).forEach(function(l){Object.defineProperty(i,l,Object.getOwnPropertyDescriptor(r,l))})}return i}const Zw=i=>i?(...n)=>i(...n):(...n)=>fetch(...n),Fw=()=>Headers,e_=(i,n,r,l,c)=>{const d=Zw(l),h=Fw(),m=c?.enabled===!0,g=c?.respectSamplingDecision!==!1,p=m?Jw(n):null;return async(S,b)=>{var T;const A=(T=await r())!==null&&T!==void 0?T:i;let C=new h(b?.headers);if(C.has("apikey")||C.set("apikey",i),C.has("Authorization")||C.set("Authorization",`Bearer ${A}`),p){const z=await t_(S,p,g);z&&(z.traceparent&&!C.has("traceparent")&&C.set("traceparent",z.traceparent),z.tracestate&&!C.has("tracestate")&&C.set("tracestate",z.tracestate),z.baggage&&!C.has("baggage")&&C.set("baggage",z.baggage))}return d(S,st(st({},b),{},{headers:C}))}};async function t_(i,n,r){if(!Kw(typeof i=="string"||i instanceof URL?i:i.url,n))return null;const l=await Gw();if(!l||!l.traceparent)return null;if(r){const c=Vw(l.traceparent);if(c&&!c.isSampled)return null}return l}function yp(i){return typeof i=="boolean"?{enabled:i}:i}function n_(i){return i.endsWith("/")?i:i+"/"}function a_(i,n){var r,l,c,d,h,m;const{db:g,auth:p,realtime:S,global:b}=i,{db:T,auth:A,realtime:C,global:z}=n,G=yp(i.tracePropagation),I=yp(n.tracePropagation),$={db:st(st({},T),g),auth:st(st({},A),p),realtime:st(st({},C),S),storage:{},global:st(st(st({},z),b),{},{headers:st(st({},(r=z?.headers)!==null&&r!==void 0?r:{}),(l=b?.headers)!==null&&l!==void 0?l:{})}),tracePropagation:{enabled:(c=(d=G?.enabled)!==null&&d!==void 0?d:I?.enabled)!==null&&c!==void 0?c:!1,respectSamplingDecision:(h=(m=G?.respectSamplingDecision)!==null&&m!==void 0?m:I?.respectSamplingDecision)!==null&&h!==void 0?h:!0},accessToken:async()=>""};return i.accessToken?$.accessToken=i.accessToken:delete $.accessToken,$}function i_(i){const n=i?.trim();if(!n)throw new Error("supabaseUrl is required.");if(!n.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(n_(n))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var r_=class extends Lw{constructor(i){super(i)}},s_=class{constructor(i,n,r){var l,c;this.supabaseUrl=i,this.supabaseKey=n;const d=i_(i);if(!n)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",d),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",d),this.storageUrl=new URL("storage/v1",d),this.functionsUrl=new URL("functions/v1",d);const h=`sb-${d.hostname.split(".")[0]}-auth-token`,m={db:zw,realtime:Hw,auth:st(st({},Bw),{},{storageKey:h}),global:Uw,tracePropagation:qw},g=a_(r??{},m);if(this.settings=g,this.storageKey=(l=g.auth.storageKey)!==null&&l!==void 0?l:"",this.headers=(c=g.global.headers)!==null&&c!==void 0?c:{},g.accessToken)this.accessToken=g.accessToken,this.auth=new Proxy({},{get:(S,b)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(b)} is not possible`)}});else{var p;this.auth=this._initSupabaseAuthClient((p=g.auth)!==null&&p!==void 0?p:{},this.headers,g.global.fetch)}this.fetch=e_(n,i,this._getAccessToken.bind(this),g.global.fetch,g.tracePropagation),this.realtime=this._initRealtimeClient(st({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},g.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(S=>this.realtime.setAuth(S)).catch(S=>console.warn("Failed to set initial Realtime auth token:",S)),this.rest=new gb(new URL("rest/v1",d).href,{headers:this.headers,schema:g.db.schema,fetch:this.fetch,timeout:g.db.timeout,urlLengthLimit:g.db.urlLengthLimit}),this.storage=new LS(this.storageUrl.href,this.headers,this.fetch,r?.storage),g.accessToken||this._listenForAuthEvents()}get functions(){return new sb(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(i){return this.rest.from(i)}schema(i){return this.rest.schema(i)}rpc(i,n={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(i,n,r)}channel(i,n={config:{}}){return this.realtime.channel(i,n)}getChannels(){return this.realtime.getChannels()}removeChannel(i){return this.realtime.removeChannel(i)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var i=this,n,r;if(i.accessToken)return await i.accessToken();const{data:l}=await i.auth.getSession();return(n=(r=l.session)===null||r===void 0?void 0:r.access_token)!==null&&n!==void 0?n:i.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:i,persistSession:n,detectSessionInUrl:r,storage:l,userStorage:c,storageKey:d,flowType:h,lock:m,debug:g,throwOnError:p,experimental:S,lockAcquireTimeout:b,skipAutoInitialize:T},A,C){const z={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new r_({url:this.authUrl.href,headers:st(st({},z),A),storageKey:d,autoRefreshToken:i,persistSession:n,detectSessionInUrl:r,storage:l,userStorage:c,flowType:h,lock:m,debug:g,throwOnError:p,experimental:S,fetch:C,lockAcquireTimeout:b,skipAutoInitialize:T,hasCustomAuthorizationHeader:Object.keys(this.headers).some(G=>G.toLowerCase()==="authorization")})}_initRealtimeClient(i){return new aS(this.realtimeUrl.href,st(st({},i),{},{params:st(st({},{apikey:this.supabaseKey}),i?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((i,n)=>{this._handleTokenChanged(i,"CLIENT",n?.access_token)})}_handleTokenChanged(i,n,r){(i==="TOKEN_REFRESHED"||i==="SIGNED_IN")&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):i==="SIGNED_OUT"&&(this.realtime.setAuth(),n=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const l_=(i,n,r)=>new s_(i,n,r);function o_(){if(typeof window<"u")return!1;const i=globalThis.process;if(!i)return!1;const n=i.version;if(n==null)return!1;const r=n.match(/^v(\d+)\./);return r?parseInt(r[1],10)<=20:!1}o_()&&console.warn("⚠️ Node.js 20 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 22 or later. For more information, visit: https://github.com/orgs/supabase/discussions/45715");const c_="https://otbyfkjxrkngvjziawki.supabase.co",u_="sb_publishable_NpUs0RDJH2YnllsqTKO6TQ_1jTdSsNQ",$n=l_(c_,u_,{auth:{autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"pkce",storageKey:"livedesk.mindexec.supabase.auth"}}),bd=new WeakMap;function d_(i){return String(i.frameMode||i.mode||"").toLowerCase()==="mode2-lz4"||String(i.compression||"").toLowerCase()==="lz4"||String(i.mimeType||"").toLowerCase()==="application/vnd.livedesk.lz4-raw"}function h_(i){return String(i.frameMode||i.mode||"").toLowerCase()==="mode3-h264-hw"||String(i.codec||"").toLowerCase()==="h264"||String(i.mimeType||"").toLowerCase()==="video/h264"}function vp(i,n,r){let l=r,c=n;if(l===15){let d=255;for(;d===255;){if(c>=i.length)throw new Error("Invalid LZ4 block: length overrun.");d=i[c],c+=1,l+=d}}return{length:l,cursor:c}}function f_(i,n){const r=new Uint8Array(n);let l=0,c=0;for(;l<i.length;){const d=i[l];l+=1;const h=vp(i,l,d>>4);l=h.cursor;const m=h.length;if(l+m>i.length||c+m>r.length)throw new Error("Invalid LZ4 block: literal overrun.");if(r.set(i.subarray(l,l+m),c),l+=m,c+=m,l>=i.length)break;if(l+2>i.length)throw new Error("Invalid LZ4 block: missing offset.");const g=i[l]|i[l+1]<<8;if(l+=2,g<=0||g>c)throw new Error("Invalid LZ4 block: bad match offset.");const p=vp(i,l,d&15);l=p.cursor;const S=p.length+4;if(c+S>r.length)throw new Error("Invalid LZ4 block: match overrun.");let b=c-g;for(let T=0;T<S;T+=1)r[c]=r[b],c+=1,b+=1}if(c!==r.length)throw new Error("Invalid LZ4 block: incomplete output.");return r}function m_(i){const n=Math.max(1,Math.floor(i.width||0)),r=Math.max(1,Math.floor(i.height||0)),l=Math.max(1,Math.floor(i.bytesPerPixel||4)),c=Math.max(n*r*l,Math.floor(i.uncompressedByteLength||0)),d=f_(new Uint8Array(i.payload),c),h=String(i.pixelFormat||i.codec||"").toLowerCase();if(l!==4)throw new Error(`Unsupported mode2 pixel size: ${l}`);const m=new Uint8ClampedArray(n*r*4);if(h==="rgba32"||h==="rgba")m.set(d.subarray(0,m.length));else for(let g=0,p=0;p<m.length;g+=4,p+=4)m[p]=d[g+2],m[p+1]=d[g+1],m[p+2]=d[g],m[p+3]=d[g+3];return new ImageData(m,n,r)}function g_(i){const n=window.VideoDecoder;if(!n||!window.EncodedVideoChunk)throw new Error("WebCodecs H.264 decode is not supported in this browser.");const r=bd.get(i);if(r&&r.decoder.state!=="closed")return r;const c={decoder:new n({output:d=>{try{const h=d.displayWidth||d.codedWidth||i.width||960,m=d.displayHeight||d.codedHeight||i.height||540;(i.width!==h||i.height!==m)&&(i.width=h,i.height=m),i.getContext("2d")?.drawImage(d,0,0,h,m)}finally{d.close()}},error:()=>{bd.delete(i)}}),configured:!1,keyFrameSeen:!1};return bd.set(i,c),c}function p_(i,n){const r=g_(i);if(!r.configured){const d={codec:"avc1.42E01E",codedWidth:Math.max(1,Math.floor(n.width||960)),codedHeight:Math.max(1,Math.floor(n.height||540)),hardwareAcceleration:"prefer-hardware",optimizeForLatency:!0,avc:{format:String(n.h264Format||"").toLowerCase()==="avc"?"avc":"annexb"}};r.decoder.configure(d),r.configured=!0}const l=n.isKeyFrame===!0||String(n.chunkType||"").toLowerCase()==="key";if(!l&&!r.keyFrameSeen)return;l&&(r.keyFrameSeen=!0);const c=new EncodedVideoChunk({type:l?"key":"delta",timestamp:Math.max(0,Math.floor(n.timestampUs||n.frameSeq*1e3)),duration:Math.max(0,Math.floor(n.durationUs||0))||void 0,data:n.payload});r.decoder.decode(c)}async function y_(i,n,r){if(h_(n)){r()||p_(i,n);return}if(d_(n)){const g=m_(n);if(r())return;(i.width!==g.width||i.height!==g.height)&&(i.width=g.width,i.height=g.height),i.getContext("2d")?.putImageData(g,0,0);return}const l=new Blob([n.payload],{type:n.mimeType}),c=await createImageBitmap(l);if(r()){c.close();return}const d=n.width||c.width||960,h=n.height||c.height||540;(i.width!==d||i.height!==h)&&(i.width=d,i.height=h);const m=i.getContext("2d");m&&(m.clearRect(0,0,d,h),m.drawImage(c,0,0,d,h)),c.close()}const Fs=5179,Ut=hl(`http://127.0.0.1:${Fs}`);function v_(i){const n=i.split(".").map(r=>Number(r));return n.length===4&&n.every(r=>Number.isInteger(r)&&r>=0&&r<=255)?n:[]}function b_(i){const n=i.trim().toLowerCase();return n==="localhost"||n==="127.0.0.1"||n==="::1"||n==="[::1]"}function S_(i){const n=i.trim().toLowerCase();return!n||n==="0.0.0.0"||n==="::"||n==="[::]"}function w_(i){const n=v_(i);return n.length===0?!1:n[0]===10||n[0]===172&&n[1]>=16&&n[1]<=31||n[0]===192&&n[1]===168}function __(i){return i.includes(":")&&!i.startsWith("[")?`[${i}]`:i}function T_(i){const n=String(i||"").trim();if(!n)return null;const r=/^[a-z][a-z\d+.-]*:\/\//i.test(n)?n:`tcp://${n}`;try{const l=new URL(r),c=l.hostname.replace(/^\[|\]$/g,""),d=Number(l.port);return!c||!Number.isInteger(d)||d<1||d>65535||S_(c)?null:{host:c,port:d}}catch{return null}}function hl(i){const n=String(i||"").trim()||`http://127.0.0.1:${Fs}`,r=/^[a-z][a-z\d+.-]*:\/\//i.test(n)?n:`http://${n}`;try{const l=new URL(r);return l.port||(l.port=String(Fs)),l.hash="",l.search="",l.toString().replace(/\/+$/,"")}catch{return`http://127.0.0.1:${Fs}`}}function k_(i){const n=T_(i);return n?hl(`http://${__(n.host)}:${Fs}`):""}function bp(i){const r=[i?.endpoint,...Array.isArray(i?.endpoint_candidates)?i.endpoint_candidates:[]].map(l=>k_(String(l||""))).filter(Boolean);return[...new Set(r)]}function el(i=Ut){if(!(typeof window>"u"||window.location.protocol!=="https:"))try{const n=new URL(i);if(n.protocol!=="http:")return;if(b_(n.hostname))return"loopback";if(w_(n.hostname))return"local"}catch{return}}function Gd(i,n=Ut){const r=new URL(i,hl(n));return r.protocol=r.protocol==="https:"?"wss:":"ws:",r.toString()}async function kn(i,n,r=Ut){const l=hl(r),c={...n,headers:{"Content-Type":"application/json",...n?.headers||{}},cache:"no-store"},d=el(l);d&&(c.targetAddressSpace=d);let h;try{h=await fetch(`${l}${i}`,c)}catch(m){throw d?new Error("LiveDesk Hub is not reachable at this local network address. If Chrome shows a local network prompt, allow it; otherwise restart the Hub so port 5179 is open on the network."):m}if(!h.ok)throw new Error(`${h.status} ${h.statusText}`);return await h.json()}function E_(i){if(!i)return"-";const n=Date.now()-Date.parse(i);return Number.isFinite(n)?n<1e3?"now":n<6e4?`${Math.round(n/1e3)}s`:n<36e5?`${Math.round(n/6e4)}m`:`${Math.round(n/36e5)}h`:"-"}async function Gs(i){await navigator.clipboard.writeText(i)}const Sp="livedesk_remote_host_targets",A_="livedesk_entitlements";function x_(i){const r=(Array.isArray(i)?i:[i||Ut]).map(l=>hl(l||Ut));return[...new Set(r.filter(Boolean))]}function C_(){const[i,n]=H.useState(null),[r,l]=H.useState(!0);return H.useEffect(()=>{let c=!0;$n.auth.getSession().then(({data:h})=>{c&&(n(h.session??null),l(!1))});const{data:{subscription:d}}=$n.auth.onAuthStateChange((h,m)=>{n(m),l(!1)});return()=>{c=!1,d.unsubscribe()}},[]),{session:i,loading:r}}function O_(i,n=!0){const[r,l]=H.useState(null),[c,d]=H.useState([]),[h,m]=H.useState(""),[g,p]=H.useState(""),[S,b]=H.useState(0),T=Array.isArray(i)?i.join(`
38
+ `):String(i||""),A=H.useMemo(()=>x_(i),[T]),C=H.useMemo(()=>A.find(I=>el(I)==="loopback")||A[0]||Ut,[A]),z=H.useCallback(async()=>{if(!n){l(null),d([]),p(""),m("");return}let I=null;for(const $ of A)try{const[O,Y]=await Promise.all([kn("/api/remote/status",void 0,$),kn("/api/remote/devices",void 0,$)]);l(O),d(Y.devices||[]),p($),m("");return}catch(O){I=O}throw p(""),I||new Error("No LiveDesk Hub endpoint is reachable.")},[n,A]),G=H.useCallback(()=>{z().catch(I=>{m(I instanceof Error?I.message:String(I))}),b(I=>I+1)},[z]);return H.useEffect(()=>{if(!n){l(null),d([]),p(""),m("");return}let I=!0;const $=async()=>{try{await z()}catch(Y){I&&m(Y instanceof Error?Y.message:String(Y))}};$();const O=window.setInterval($,2500);return()=>{I=!1,window.clearInterval(O)}},[n,z,S]),{status:r,devices:c,error:h,refresh:G,hubBaseUrl:g||C,hubCandidates:A}}function R_(i){const[n,r]=H.useState(null),[l,c]=H.useState(""),d=i?.user?.id||"",h=H.useCallback(async()=>{if(!d){r(null);return}const{data:m,error:g}=await $n.from(Sp).select("*").eq("user_id",d).maybeSingle();if(g){c(g.message);return}r(m),c("")},[d]);return H.useEffect(()=>{h()},[h]),H.useEffect(()=>{if(!d)return;const m=$n.channel(`livedesk-remote-host-targets-${d.replace(/[^a-zA-Z0-9]/g,"")}`).on("postgres_changes",{event:"*",schema:"public",table:Sp,filter:`user_id=eq.${d}`},g=>r(g.new)).subscribe();return()=>{$n.removeChannel(m)}},[d]),{target:n,error:l,refresh:h}}function j_(i){const[n,r]=H.useState(null),[l,c]=H.useState(!1),[d,h]=H.useState(""),m=i?.user?.id||"",g=H.useCallback(async()=>{if(!m){r(null),h(""),c(!1);return}c(!0);const{data:S,error:b}=await $n.from(A_).select("*").eq("user_id",m).eq("product_key","livedesk").maybeSingle();if(b){h(b.message),c(!1);return}r(S),h(""),c(!1)},[m]);H.useEffect(()=>{g()},[g]);const p=H.useMemo(()=>!n||n.status!=="active"?!1:n.expires_at?new Date(n.expires_at).getTime()>Date.now():!0,[n]);return{entitlement:n,licensed:p,loading:l,error:d,refresh:g}}const Sd={totalFrames:0,totalBytes:0,framesPerSecond:0,bytesPerSecond:0,sampleMs:0,lastUpdatedAt:0};function N_(i,n,r=Ut,l={}){const[c,d]=H.useState(new Map),[h,m]=H.useState("idle"),[g,p]=H.useState(Sd),S=H.useRef({totalFrames:0,totalBytes:0,sampleFrames:0,sampleBytes:0,sampleStartedAt:0}),b=H.useMemo(()=>[...i].sort().join(","),[i]),T=Number.isFinite(l.fps)?Number(l.fps):2,A=Number.isFinite(l.maxWidth)?Number(l.maxWidth):640,C=Number.isFinite(l.maxHeight)?Number(l.maxHeight):360,z=Number.isFinite(l.quality)?Number(l.quality):45,G=String(l.frameMode||l.mode||"mode3-h264-hw").trim()||"mode3-h264-hw",I=H.useMemo(()=>{const $=Object.entries(l.monitorSelections||{}).filter(([O])=>!!O).sort(([O],[Y])=>O.localeCompare(Y));return JSON.stringify(Object.fromEntries($))},[l.monitorSelections]);return H.useEffect(()=>{const $=b?b.split(",").filter(Boolean):[];if($.length===0){m("idle"),d(new Map),S.current={totalFrames:0,totalBytes:0,sampleFrames:0,sampleBytes:0,sampleStartedAt:0},p(Sd);return}const O=new WebSocket(Gd(`/api/remote/frames/ws?devices=${encodeURIComponent($.join(","))}`,r));O.binaryType="arraybuffer",m("connecting");const Y=performance.now();S.current={totalFrames:0,totalBytes:0,sampleFrames:0,sampleBytes:0,sampleStartedAt:Y},p({...Sd,lastUpdatedAt:Date.now()}),O.addEventListener("open",()=>{m("open"),O.send(JSON.stringify({type:"subscribe",deviceIds:$,autoStartLive:n,fps:T,maxWidth:A,maxHeight:C,quality:z,mode:G,frameMode:G,monitorSelections:l.monitorSelections||{}}))}),O.addEventListener("message",ie=>{if(typeof ie.data=="string")return;const K=ie.data instanceof ArrayBuffer?ie.data:null;if(!K||K.byteLength<5)return;const Se=new DataView(K).getUint32(0,!1);if(Se<=0||Se+4>K.byteLength)return;const Kt=new Uint8Array(K.slice(4,4+Se)),te=JSON.parse(new TextDecoder().decode(Kt)),Ce=K.slice(4+Se),Je=S.current;Je.totalFrames+=1,Je.totalBytes+=Ce.byteLength,Je.sampleFrames+=1,Je.sampleBytes+=Ce.byteLength;const Xe={deviceId:String(te.deviceId||""),kind:te.kind==="thumbnail"?"thumbnail":"live",frameSeq:Number(te.frameSeq||0),streamId:String(te.streamId||""),width:Number(te.width||0),height:Number(te.height||0),mimeType:String(te.mimeType||"image/jpeg"),mode:te.mode?String(te.mode):void 0,frameMode:te.frameMode?String(te.frameMode):void 0,frameProfile:te.frameProfile?String(te.frameProfile):void 0,encoding:te.encoding?String(te.encoding):void 0,codec:te.codec?String(te.codec):void 0,compression:te.compression?String(te.compression):void 0,pixelFormat:te.pixelFormat?String(te.pixelFormat):void 0,bytesPerPixel:Number(te.bytesPerPixel||0)||0,uncompressedByteLength:Number(te.uncompressedByteLength||0)||0,h264Format:te.h264Format?String(te.h264Format):void 0,isKeyFrame:te.isKeyFrame===!0,chunkType:te.chunkType?String(te.chunkType):void 0,timestampUs:Number(te.timestampUs||0)||0,durationUs:Number(te.durationUs||0)||0,hardwareEncoder:te.hardwareEncoder?String(te.hardwareEncoder):void 0,platformProfile:te.platformProfile?String(te.platformProfile):void 0,monitorIndex:Number.isFinite(Number(te.monitorIndex))?Number(te.monitorIndex):void 0,monitorCount:Number.isFinite(Number(te.monitorCount))?Number(te.monitorCount):void 0,capturedAt:String(te.capturedAt||""),receivedAt:String(te.receivedAt||""),byteLength:Number(te.byteLength||Ce.byteLength),contentHash:te.contentHash?String(te.contentHash):void 0,payload:Ce};Xe.deviceId&&d(ze=>{const D=ze.get(Xe.deviceId);if(D&&D.frameSeq>Xe.frameSeq)return ze;const V=new Map(ze);return V.set(Xe.deviceId,Xe),V})}),O.addEventListener("error",()=>m("error")),O.addEventListener("close",()=>m("closed"));const me=window.setInterval(()=>{const ie=performance.now(),K=S.current,Ee=Math.max(1,ie-K.sampleStartedAt);p({totalFrames:K.totalFrames,totalBytes:K.totalBytes,framesPerSecond:K.sampleFrames*1e3/Ee,bytesPerSecond:K.sampleBytes*1e3/Ee,sampleMs:Ee,lastUpdatedAt:Date.now()}),K.sampleFrames=0,K.sampleBytes=0,K.sampleStartedAt=ie},2e3);return()=>{window.clearInterval(me),O.close()}},[n,b,T,G,r,C,A,I,l.monitorSelections,z]),{frames:c,state:h,stats:g}}function L_(i,n=Ut){const r=H.useRef(null),[l,c]=H.useState("idle");H.useEffect(()=>{if(!i){r.current?.close(),r.current=null,c("idle");return}const h=new WebSocket(Gd("/api/remote/input/ws",n));return r.current=h,c("connecting"),h.addEventListener("open",()=>c("open")),h.addEventListener("close",()=>c("closed")),h.addEventListener("error",()=>c("error")),()=>{h.close(),r.current===h&&(r.current=null)}},[i,n]);const d=H.useCallback((h,m)=>{const g=r.current;return!g||g.readyState!==WebSocket.OPEN||!h?!1:(g.send(JSON.stringify({type:"input",requestId:crypto.randomUUID(),deviceId:h,input:{...m,issuedAt:new Date().toISOString()}})),!0)},[]);return{state:l,sendInput:d}}function D_(i){const n=String(i||"").toLowerCase();return n.includes("audio/pcm")||n.includes("audio/l16")||n.includes("f32le")||n.includes("s16le")}function M_(i,n,r){const l=Math.max(1,Math.min(8,Math.floor(n.channels||2))),c=Math.max(8e3,Math.min(192e3,Math.floor(n.sampleRate||48e3))),d=String(n.mimeType||"").toLowerCase(),h=d.includes("s16le")||d.includes("audio/l16"),m=h?2:4,g=Math.floor(r.byteLength/m),p=Math.floor(g/l),S=i.createBuffer(l,p,c),b=new DataView(r);for(let T=0;T<l;T+=1){const A=S.getChannelData(T);for(let C=0;C<p;C+=1){const G=(C*l+T)*m;A[C]=h?Math.max(-1,Math.min(1,b.getInt16(G,!0)/32768)):Math.max(-1,Math.min(1,b.getFloat32(G,!0)))}}return S}function U_(i,n,r=Ut){const l=H.useRef(null),c=H.useRef(0),[d,h]=H.useState("idle"),[m,g]=H.useState(null),[p,S]=H.useState("");return H.useEffect(()=>{if(!n||!i){h("idle"),g(null),S("");return}const b=window.AudioContext||window.webkitAudioContext;if(!b){h("unsupported"),S("Audio playback is not supported in this browser.");return}const T=new b;l.current=T,c.current=T.currentTime;const A=new WebSocket(Gd(`/api/remote/audio/ws?devices=${encodeURIComponent(i)}`,r));A.binaryType="arraybuffer";let C=!1;return h("connecting"),S(""),A.addEventListener("open",()=>{C||(h("open"),A.send(JSON.stringify({type:"subscribe",deviceIds:[i]})),T.resume())}),A.addEventListener("message",z=>{if(typeof z.data=="string")return;const G=z.data instanceof ArrayBuffer?z.data:null;!G||G.byteLength<5||(async()=>{try{const $=new DataView(G).getUint32(0,!1);if($<=0||$+4>G.byteLength)return;const O=new Uint8Array(G.slice(4,4+$)),Y=JSON.parse(new TextDecoder().decode(O)),me=G.slice(4+$),ie={deviceId:String(Y.deviceId||""),frameSeq:Number(Y.frameSeq||0),streamId:String(Y.streamId||""),mimeType:String(Y.mimeType||"audio/webm;codecs=opus"),sampleRate:Number(Y.sampleRate||48e3),channels:Number(Y.channels||2),capturedAt:String(Y.capturedAt||""),receivedAt:String(Y.receivedAt||""),byteLength:Number(Y.byteLength||me.byteLength),payload:me};if(!ie.deviceId||C)return;const K=D_(ie.mimeType)?M_(T,ie,me):await T.decodeAudioData(me.slice(0));if(C)return;const Ee=T.createBufferSource();Ee.buffer=K,Ee.connect(T.destination);const Se=Math.max(T.currentTime+.02,c.current);Ee.start(Se),c.current=Se+K.duration,g(ie),h("playing")}catch(I){C||(h("error"),S(I instanceof Error?I.message:String(I)))}})()}),A.addEventListener("error",()=>{C||h("error")}),A.addEventListener("close",()=>{C||h("closed")}),()=>{C=!0,A.close(),T.close().catch(()=>{}),l.current===T&&(l.current=null)}},[i,n,r]),{state:d,lastFrame:m,error:p}}const z_=120,B_=999,_r=4,Zp="livedesk.remoteDirectory",qd="livedesk.localHubAccessEnabled",Fp="livedesk.streamSettings",ey=4,H_=24*1024*1024,ty={"mode1-jpeg":5,"mode2-lz4":5,"mode3-h264-hw":12},tn={frameMode:"mode3-h264-hw",fps:ty["mode3-h264-hw"],maxWidth:960,maxHeight:540,quality:60,autoStartLive:!0,showScreenStatus:!0,visibleOnlyLive:!0,adaptiveLoadShedding:!0},qo=[{id:"mode3-h264-hw",label:"Mode 3",detail:"H.264 hardware"},{id:"mode2-lz4",label:"Mode 2",detail:"LZ4 raw"},{id:"mode1-jpeg",label:"Mode 1",detail:"JPEG test"}],wd=[{id:"640x360",label:"Compact",width:640,height:360},{id:"960x540",label:"Standard",width:960,height:540},{id:"1280x720",label:"HD",width:1280,height:720}],Vd=[1,2,5,8,12,20,24],q_=[45,60,75,90],Gt={visibleRootMargin:"520px 0px 760px 0px",fallbackVisibleCounts:{large:18,medium:32,small:56},maxWallFramesPerSecond:1800,maxWallBytesPerSecond:80*1024*1024,lowLoadFrameRatio:.58,lowLoadByteRatio:.52,downshiftCooldownMs:4500,recoveryCooldownMs:14e3,minFps:1};function tl(i,n){const r=i.capabilities?.[n];return typeof r=="boolean"?r:/^(1|true|yes|on)$/i.test(String(r||"").trim())}function nl(i){return i.deviceName||i.hostname||i.deviceId}function $_(){return"npx -y livedesk client"}function P_(){return"npx -y livedesk"}function I_(){try{return localStorage.getItem(Zp)||""}catch{return""}}function G_(){try{return localStorage.getItem(qd)==="1"}catch{return!1}}function Tr(i){try{i?localStorage.setItem(qd,"1"):localStorage.removeItem(qd)}catch{}}function Lr(i,n,r,l){const c=Number(i);return Number.isFinite(c)?Math.max(n,Math.min(r,Math.round(c))):l}function $d(i){const n=String(i||"").trim();return qo.some(r=>r.id===n)?n:tn.frameMode}function ny(i){return ty[i]||12}function _d(i){return i&&typeof i=="object"&&!Array.isArray(i)?i:{}}function Ti(i){const n=_d(i.status),r=_d(n.screens),l=_d(i.capabilities),c=[n.monitorCount,n.screenCount,r.count,l.monitorCount,l.screenCount];for(const d of c){const h=Number(d);if(Number.isFinite(h)&&h>0)return Math.max(1,Math.min(64,Math.floor(h)))}return 1}function Rr(i,n){const r=Math.max(1,Math.min(64,Math.floor(Number(n)||1))),l=Math.floor(Number(i));return Number.isFinite(l)?Math.max(0,Math.min(r-1,l)):0}function V_(){try{const i=JSON.parse(localStorage.getItem(Fp)||"{}");if(i.version!==ey)return tn;const n=$d(i.frameMode),r=Lr(i.maxWidth,320,2560,tn.maxWidth),l=Lr(i.maxHeight,180,1440,tn.maxHeight);return{frameMode:n,fps:Lr(i.fps,1,24,ny(n)),maxWidth:r,maxHeight:l,quality:Lr(i.quality,20,95,tn.quality),autoStartLive:typeof i.autoStartLive=="boolean"?i.autoStartLive:tn.autoStartLive,showScreenStatus:typeof i.showScreenStatus=="boolean"?i.showScreenStatus:tn.showScreenStatus,visibleOnlyLive:typeof i.visibleOnlyLive=="boolean"?i.visibleOnlyLive:tn.visibleOnlyLive,adaptiveLoadShedding:typeof i.adaptiveLoadShedding=="boolean"?i.adaptiveLoadShedding:tn.adaptiveLoadShedding}}catch{return tn}}function K_(i){try{localStorage.setItem(Fp,JSON.stringify({...i,version:ey}))}catch{}}function Td(i,n){return i.length!==n.length?!1:i.every((r,l)=>r===n[l])}function wp(i){return[...new Set(i.filter(Boolean))].sort()}function Y_(i){return Gt.fallbackVisibleCounts[i]||Gt.fallbackVisibleCounts.large}function J_(i){const n=[...Vd].sort((l,c)=>l-c),r=Math.max(Gt.minFps,Math.floor(i/2));return[...n].reverse().find(l=>l<i)||r}function X_(i,n){return[...Vd].sort((l,c)=>l-c).find(l=>l>i&&l<=n)||n}function Ai(i){if(!Number.isFinite(i)||i<=0)return"0 B";const n=["B","KB","MB","GB","TB"];let r=i,l=0;for(;r>=1024&&l<n.length-1;)r/=1024,l+=1;const c=l===0||r>=100?0:1;return`${r.toFixed(c)} ${n[l]}`}function W_(i){const n=new Uint8Array(i),r=32768;let l="";for(let c=0;c<n.length;c+=r){const d=n.subarray(c,c+r);l+=String.fromCharCode(...d)}return btoa(l)}function Q_(i){return i===1?"middle":i===2?"right":"left"}function _p(i,...n){for(const r of n){const l=i?.[r];if(typeof l=="string"&&l.trim())return l.trim()}return""}function Vs(i){const n=Number(i);return Number.isInteger(n)&&n>=1&&n<=B_?n:0}const Z_={cpu:"CPU",memory:"MEM",disk:"Disk",gpu:"GPU",npu:"NPU",temp:"Temp",network:"Net"};function F_(i,n,r){if(i==="online")return"Online";if(i==="busy")return"Busy";if(i==="stale")return"Stale";if(i==="offline")return"Offline";if(r==="failed")return"Task failed";const l=i==="critical"?"critical":"warn",c=n.find(h=>h.state===l)||n.find(h=>h.state==="critical"||h.state==="warn");if(!c)return i==="critical"?"Issue":"Check";const d=Z_[c.id]||c.label;return c.value&&c.value!=="-"?`${d} ${c.value}`:d}function Fo(i,n){const r=n.split(".");let l=i;for(const c of r){if(l==null)return;if(Array.isArray(l)){const d=Number(c);l=Number.isInteger(d)?l[d]:void 0;continue}if(typeof l=="object"){l=l[c];continue}return}return l}function Fe(i,...n){for(const r of n){const l=Fo(i,r),c=Number(l);if(Number.isFinite(c))return c}}function Vt(i,...n){for(const r of n){const l=Fo(i,r);if(typeof l=="string"&&l.trim())return l.trim();if(typeof l=="number"&&Number.isFinite(l))return String(l)}return""}function e1(i,...n){for(const r of n){const l=Fo(i,r);if(typeof l=="boolean")return l;if(/^(1|true|yes|on|online|running|ready)$/i.test(String(l||"").trim()))return!0;if(/^(0|false|no|off|offline|stopped|missing)$/i.test(String(l||"").trim()))return!1}}function ma(i){const n=Number(i);if(Number.isFinite(n))return Math.max(0,Math.min(1,n>1?n/100:n))}function kd(i,n){if(!(typeof i!="number"||typeof n!="number"||!Number.isFinite(i)||!Number.isFinite(n)||i<=0))return ma((i-Math.max(0,n))/i)}function Ks(i){return i===void 0?"-":`${Math.round(i*100)}%`}function Ed(i){return i===void 0||!Number.isFinite(i)?"":i>=1e3?`${(i/1e3).toFixed(i>=1e4?0:1)}Gb/s`:`${Math.round(i)}Mb/s`}function kr(i,n=.92,r=.78){return i===void 0?"unknown":i>=n?"critical":i>=r?"warn":"good"}function ay(i){return!Number.isFinite(i)||!i||i<=0?"-":i<3600?`${Math.round(i/60)}m`:i<86400?`${Math.round(i/3600)}h`:`${Math.round(i/86400)}d`}function Bo(i,n,r){const l=Fo(i,`tools.${n}`),c=Vt(i,`tools.${n}.status`,`tooling.${n}.status`,`${n}.status`).toLowerCase(),d=e1(i,`tools.${n}.running`,`tooling.${n}.running`,`${n}.running`),h=Vt(i,`tools.${n}.version`,`tooling.${n}.version`,`${n}.version`),m=Vt(i,`tools.${n}.port`,`tooling.${n}.port`,`${n}.port`);let g="unknown";return c==="busy"?g="busy":["online","running","ready","active"].includes(c)||d===!0?g="online":(["offline","stopped","missing","not-found"].includes(c)||d===!1||l===!1)&&(g="offline"),{id:n,label:r,status:g,detail:g==="offline"?"offline":h||(m?`:${m}`:g==="unknown"?"not reported":g)}}function iy(i){const n=i.status||{},r=Fe(n,"cpu.cores","cpuCores","processorCount"),l=Fe(n,"loadavg.0","cpu.load1"),c=ma(Fe(n,"cpu.usedRatio","cpu.usageRatio","cpu.ratio","cpu.usedPct","cpu.usagePct","cpu.percent")??(r&&l!==void 0?l/Math.max(1,r):void 0)),d=Fe(n,"memory.totalBytes","totalMem"),h=Fe(n,"memory.freeBytes","freeMem"),m=ma(Fe(n,"memory.usedRatio","memory.usedPct","usedMemRatio"))??kd(d,h),g=Fe(n,"disk.totalBytes","rootDisk.totalBytes","storage.totalBytes"),p=Fe(n,"disk.freeBytes","rootDisk.freeBytes","storage.freeBytes"),S=ma(Fe(n,"disk.usedRatio","disk.usedPct","rootDisk.usedRatio","storage.usedRatio"))??kd(g,p),b=Fe(n,"thermal.cpuC","temperatureC","cpu.temperatureC","gpu.temperatureC"),T=ma(Fe(n,"gpu.usedRatio","gpu.usageRatio","gpu.usedPct","gpu.usagePct","gpu.percent","accelerators.gpu.usageRatio")),A=Vt(n,"gpu.name","gpu.model","accelerators.gpu.name"),C=Fe(n,"gpu.memory.totalBytes","gpu.totalMemoryBytes","gpu.vramTotalBytes"),z=Fe(n,"gpu.memory.freeBytes","gpu.freeMemoryBytes","gpu.vramFreeBytes"),G=ma(Fe(n,"gpu.memory.usedRatio","gpu.vramUsedRatio"))??kd(C,z),I=Fe(n,"gpu.temperatureC","thermal.gpuC"),$=ma(Fe(n,"npu.usedRatio","npu.usageRatio","npu.usedPct","npu.usagePct","npu.percent","accelerators.npu.usageRatio")),O=Vt(n,"npu.name","npu.model","accelerators.npu.name"),Y=Fe(n,"npu.tops","npu.topsInt8","accelerators.npu.tops"),me=Fe(n,"network.rxMbps","network.receiveMbps","network.downMbps"),ie=Fe(n,"network.txMbps","network.transmitMbps","network.upMbps"),K=Fe(n,"network.latencyMs","network.rttMs"),Ee=ma(Fe(n,"network.usedRatio","network.usageRatio","network.saturationRatio")),Se=Vt(n,"network.link","network.interface","network.name"),Kt=b===void 0?void 0:ma((b-35)/60),te=Vt(n,"workload.role","role","lane")||(tl(i,"aiAssist")?"Agent worker":tl(i,"taskDispatch")?"Task worker":"Local machine"),Ce=Vt(i.latestTask,"status")||Vt(n,"workload.status")||"idle",Je=Vt(i.latestTask,"title","instructionPreview")||Vt(n,"workload.title"),Xe=Vt(i.latestTask,"resultSummary","error","instructionPreview")||Vt(n,"workload.summary"),ze=[Bo(n,"ollama","Ollama"),Bo(n,"lmStudio","LM Studio"),Bo(n,"comfyui","ComfyUI"),Bo(n,"stableDiffusion","Stable Diffusion")],D=ze.some(M=>M.status!=="unknown"),V=Date.parse(i.lastSeenAt||i.connectedAt||""),le=Number.isFinite(V)?Date.now()-V:0;let ne="online";i.connected?le>5*6e4?ne="stale":(b??0)>=86||(I??0)>=88||(c??0)>=.94||(T??0)>=.96||($??0)>=.96||(m??0)>=.94||(S??0)>=.94||(K??0)>=200||Ce==="failed"?ne="critical":(b??0)>=78||(I??0)>=80||(c??0)>=.82||(T??0)>=.86||($??0)>=.86||(m??0)>=.82||(S??0)>=.86||(K??0)>=80?ne="warn":(["queued","running","targeted"].includes(Ce)||ze.some(M=>M.status==="busy"))&&(ne="busy"):ne="offline";const xe=ze.filter(M=>M.status==="online"||M.status==="busy").length,E=[{id:"cpu",label:"CPU",value:Ks(c),detail:r?`${r} cores`:l!==void 0?`load ${l.toFixed(1)}`:"not reported",ratio:c,state:kr(c,.92,.78)},{id:"memory",label:"RAM",value:Ks(m),detail:d?`${Ai(d-(h||0))} / ${Ai(d)}`:"not reported",ratio:m,state:kr(m,.92,.78)},{id:"disk",label:"DISK",value:Ks(S),detail:g&&p!==void 0?`${Ai(p)} free`:"not reported",ratio:S,state:kr(S,.92,.82)},{id:"gpu",label:"GPU",value:Ks(T??G),detail:A||(C&&z!==void 0?`${Ai(z)} VRAM free`:I!==void 0?`${Math.round(I)}C`:"not reported"),ratio:T??G,state:I!==void 0&&I>=88?"critical":I!==void 0&&I>=80?"warn":kr(T??G,.96,.86)},{id:"npu",label:"NPU",value:$!==void 0?Ks($):Y!==void 0?`${Math.round(Y)} TOPS`:"-",detail:O||(Y!==void 0?"neural engine":"not reported"),ratio:$,state:kr($,.96,.86)},{id:"temp",label:"TEMP",value:b===void 0?"-":`${Math.round(b)}C`,detail:xe>0?`${xe} local tools`:`uptime ${ay(Fe(n,"uptimeSec"))}`,ratio:Kt,state:b===void 0?"unknown":b>=86?"critical":b>=78?"warn":"good"},{id:"network",label:"NET",value:Ed(me)||(K!==void 0?`${Math.round(K)}ms`:Se||"-"),detail:Ed(ie)?`${Ed(ie)} up`:Se||"not reported",ratio:Ee,state:K!==void 0&&K>=200?"critical":K!==void 0&&K>=80?"warn":kr(Ee,.9,.75)}];return{state:ne,label:F_(ne,E,Ce),role:te,taskLabel:Je||(Ce==="idle"?"idle":Ce),taskStatus:Ce,taskSummary:Xe,tools:D?ze:ze.map(M=>({...M,detail:"not reported"})),metrics:E}}const t1=[{id:"small",label:"Small"},{id:"medium",label:"Medium"},{id:"large",label:"Large"}],n1=[{id:"wall",label:"Wall",icon:Cp,accent:"blue"},{id:"control",label:"Control",icon:Cd,accent:"red"},{id:"agents",label:"Agents",icon:Ar,accent:"violet"},{id:"doc",label:"Doc",icon:Ad,accent:"amber"},{id:"pricing",label:"Pricing",icon:xd,accent:"green"},{id:"settings",label:"Settings",icon:Op,accent:"gray"}];function ut(i){return i.replace(/\bRemoteHub\b/g,"Hub client endpoint").replace(/\bManagers\b/g,"Hubs").replace(/\bManager\b/g,"Hub").replace(/\bmanager\b/g,"Hub").replace(/\bMANAGER\b/g,"HUB").replace(/매니저/g,"Hub")}function Er(i){return i.map(n=>ut(n))}function jt(i){return{languageName:i.languageName,languageLabel:i.languageLabel,eyebrow:i.eyebrow,title:ut(i.title),intro:ut(i.intro),sections:[{title:ut(i.managerTitle),body:ut(i.managerBody),points:Er(i.managerPoints)},{title:ut(i.clientTitle),body:ut(i.clientBody),points:Er(i.clientPoints)},{title:ut(i.syncTitle),body:ut(i.syncBody),points:Er(i.syncPoints)},{title:ut(i.platformTitle),body:ut(i.platformBody),points:Er(i.platformPoints)}],sync:{title:ut(i.syncTitle),body:ut(i.syncBody),points:Er(i.syncPoints)},firewall:{title:ut(i.firewallTitle),body:ut(i.firewallBody),points:Er(i.firewallPoints)},commands:{title:ut(i.commandsTitle),body:ut(i.commandsBody),manager:ut(i.managerCommandLabel),primary:ut(i.clientCommandLabel),slot:ut(i.slotCommandLabel),manual:ut(i.manualCommandLabel)}}}const Mr={ko:jt({languageName:"한국어",languageLabel:"문서 언어",eyebrow:"LiveDesk Manual",title:"한 줄로 여는 로컬 Screen Wall",intro:"LiveDesk는 매니저 PC 한 대에서 여러 작업 PC, AI 박스, 맥미니, 개발 장비를 한 화면에 모니터링하고 필요한 제어를 실행하는 npm-first 원격 작업 데크입니다.",managerTitle:"1. 매니저 실행",managerBody:"화면을 모아 볼 컴퓨터에서 LiveDesk 매니저를 실행합니다. 매니저는 UI와 로컬 서버를 같이 열고 브라우저를 http://127.0.0.1:5179 로 띄웁니다.",managerPoints:["명령은 npx -y livedesk 입니다.","매니저는 Screen Wall/API 포트 5179와 클라이언트 접속 포트 5197을 사용합니다.","기존 LiveDesk 포트가 남아 있으면 기본적으로 정리하고 새로 시작합니다. 필요하면 --no-clean 을 붙입니다."],clientTitle:"2. 워크스테이션 연결",clientBody:"모니터링할 PC에서는 같은 Google 계정으로 로그인합니다. 매니저가 켜져 있지 않아도 클라이언트는 종료하지 않고 5초마다 계속 찾습니다.",clientPoints:["빈 자리에 자동 배치하려면 npx -y livedesk client 를 실행합니다.","자리 번호를 고정하려면 npx -y livedesk client 3 처럼 번호를 붙입니다.","컴퓨터가 많을 때도 다시 로그인하지 않도록 집요하게 재접속을 시도합니다."],syncTitle:"3. Sync Server와 자동 발견",syncBody:"Sync Server는 이 매니저를 현재 계정의 활성 Screen Wall로 Supabase에 등록합니다. 클라이언트는 같은 Google 계정으로 로그인한 뒤 그 기록을 읽고 접속 후보들을 순서대로 시도합니다.",syncPoints:["등록 정보에는 host instance, LAN/private 주소, public 후보 주소, pair token, 짧은 lease가 포함됩니다.","같은 LAN 후보를 먼저 쓰고, 필요하면 외부 주소 후보를 시도합니다.","매니저 위치, VPN, 방화벽, 공유기 설정이 바뀌었거나 개발 중 활성 매니저를 바꿀 때 Sync Server를 누릅니다.","이제 livedesk.pages.dev의 Chrome Local Network Access 허용은 기본 실행 경로가 아닙니다. npm 매니저 앱이 실제 서버입니다."],platformTitle:"4. 현재 플랫폼 상태",platformBody:"Windows는 실제 화면 전송까지 확인되었습니다. macOS와 Linux도 npm 구조로 같은 명령을 목표로 지원을 넓히고 있습니다.",platformPoints:["Windows: 현재 작동 확인.","macOS: manager/client 경로는 준비되어 있으며 화면 캡처와 제어에는 Screen Recording/Accessibility 권한이 필요합니다.","Linux: linux-x64 runtime, grim/gnome-screenshot/import/scrot 캡처, xdotool 입력 백엔드가 추가되었습니다. 오디오는 아직 비활성입니다."],firewallTitle:"방화벽과 외부 장소 연결",firewallBody:"같은 LAN 안에서는 보통 공유기 포트포워딩이 필요 없습니다. 다른 장소의 PC를 붙이려면 클라이언트가 매니저의 클라이언트 접속 포트에 도달할 수 있어야 합니다.",firewallPoints:["클라이언트 접속 포트는 TCP 5197입니다.","클라이언트 쪽은 나가는 연결이므로 보통 인바운드 포트 개방이 필요 없습니다.","다른 네트워크에서 붙일 때는 매니저 PC 방화벽에서 TCP 5197 인바운드를 허용하고, 공유기에서는 TCP 5197을 매니저 PC로 전달합니다.","Screen Wall/API 포트 5179는 매니저 UI용입니다. 외부 브라우저에서 Wall을 직접 열 필요가 있을 때만 별도로 노출을 검토합니다.","공개 인터넷에 바로 열기보다 VPN, Tailscale, ZeroTier, 고정 IP allowlist를 우선합니다."],commandsTitle:"현재 사용 명령",commandsBody:"웹사이트를 찾아가 설치 파일을 받는 방식보다 터미널 한 줄로 모든 운영체제에서 거의 같은 흐름을 쓰는 것이 LiveDesk의 기본 방향입니다.",managerCommandLabel:"매니저 시작",clientCommandLabel:"워크스테이션 연결",slotCommandLabel:"3번 슬롯에 고정",manualCommandLabel:"고급 수동 연결"}),en:jt({languageName:"English",languageLabel:"Document language",eyebrow:"LiveDesk Manual",title:"Open a local Screen Wall with one command",intro:"LiveDesk is an npm-first remote work deck for monitoring many workstations, AI boxes, Mac minis, and dev machines from one manager PC.",managerTitle:"1. Run the manager",managerBody:"Run LiveDesk on the computer that will watch the screens. The manager starts the UI and local server together, then opens http://127.0.0.1:5179.",managerPoints:["The command is npx -y livedesk.","The manager uses port 5179 for the Screen Wall/API and port 5197 for client connections.","If an old LiveDesk process still owns those ports, startup cleans it by default. Add --no-clean when you want to keep it."],clientTitle:"2. Connect a workstation",clientBody:"On each monitored computer, sign in with the same Google account. If no manager is online yet, the client keeps running and retries every 5 seconds.",clientPoints:["Run npx -y livedesk client for first available placement.","Run npx -y livedesk client 3 to pin the machine to slot 3.","Clients keep trying so large workstation stacks do not need repeated sign-in."],syncTitle:"3. Sync Server and discovery",syncBody:"Sync Server publishes this manager as the active Screen Wall for the signed-in account. Clients read that Supabase record after Google sign-in and try the endpoint candidates in order.",syncPoints:["The record includes host instance, LAN/private addresses, public endpoint candidates, pair token, and a short lease.","LAN candidates are preferred first, then public candidates if needed.","Press Sync Server after manager moves, VPN/firewall/router changes, or when this development machine should take over as active manager.","Chrome Local Network Access on livedesk.pages.dev is no longer the default runtime path. The npm manager app is the real server."],platformTitle:"4. Current platform state",platformBody:"Windows has been verified with live screen transfer. macOS and Linux follow the same npm command path as support expands.",platformPoints:["Windows: verified working.","macOS: manager/client paths are prepared; screen capture and control require Screen Recording/Accessibility permissions.","Linux: linux-x64 runtime, grim/gnome-screenshot/import/scrot capture, and xdotool input backend are added. Audio is still disabled."],firewallTitle:"Firewall and remote locations",firewallBody:"On the same LAN, router forwarding is usually unnecessary. For another office, building, or country, clients must be able to reach the manager client port.",firewallPoints:["Client connection port: TCP 5197.","Client machines normally only need outbound access.","For remote networks, allow inbound TCP 5197 on the manager firewall and forward TCP 5197 from the router to the manager PC.","Screen Wall/API port 5179 is for the manager UI. Expose it only if a remote browser must open the Wall directly.","Prefer VPN, Tailscale, ZeroTier, or fixed-IP allowlists over public internet exposure."],commandsTitle:"Current commands",commandsBody:"The product direction is one terminal command across operating systems instead of finding a website, downloading, and installing manually.",managerCommandLabel:"Start manager",clientCommandLabel:"Connect workstation",slotCommandLabel:"Pin to slot 3",manualCommandLabel:"Advanced manual connection"}),ja:jt({languageName:"日本語",languageLabel:"ドキュメント言語",eyebrow:"LiveDesk Manual",title:"1行でローカル Screen Wall を開く",intro:"LiveDesk は、複数の作業 PC、AI マシン、Mac mini、開発機を1台の manager PC から監視する npm-first のリモート作業デッキです。",managerTitle:"1. manager を実行",managerBody:"画面を集めて見るコンピューターで LiveDesk manager を実行します。UI とローカルサーバーが同時に起動し、http://127.0.0.1:5179 が開きます。",managerPoints:["コマンドは npx -y livedesk です。","Screen Wall/API は 5179、client 接続は 5197 を使います。","古い LiveDesk プロセスがポートを使っている場合は、基本的に自動で整理して起動します。"],clientTitle:"2. workstation を接続",clientBody:"監視される PC で同じ Google アカウントにログインします。manager がまだ無くても client は終了せず、5秒ごとに再試行します。",clientPoints:["空きスロットに入れるには npx -y livedesk client を実行します。","スロットを固定するには npx -y livedesk client 3 のように番号を付けます。","大量の PC でも再ログインなしで待ち続けます。"],syncTitle:"3. Sync Server と自動検出",syncBody:"Sync Server はこの manager を現在の Google アカウントの active Screen Wall として Supabase に登録します。",syncPoints:["host instance、LAN/private アドレス、public 候補、pair token、短い lease を登録します。","client は LAN 候補を優先し、必要なら public 候補も試します。","VPN、firewall、router、manager の場所が変わったら Sync Server を押します。","livedesk.pages.dev の Chrome Local Network Access は標準実行経路ではありません。npm manager アプリが実際のサーバーです。"],platformTitle:"4. 現在のプラットフォーム状態",platformBody:"Windows は live screen transfer まで確認済みです。macOS と Linux も同じ npm コマンド経路を目標に対応を広げています。",platformPoints:["Windows: 動作確認済み。","macOS: 画面取得と制御には Screen Recording/Accessibility 権限が必要です。","Linux: linux-x64 runtime、grim/gnome-screenshot/import/scrot capture、xdotool input backend を追加済み。audio は未対応です。"],firewallTitle:"Firewall と外部拠点",firewallBody:"同じ LAN なら通常 router forwarding は不要です。外部拠点では client が manager の接続ポートへ到達できる必要があります。",firewallPoints:["client 接続ポートは TCP 5197 です。","client 側は通常 outbound だけで足ります。","外部 network では manager PC の firewall で TCP 5197 inbound を許可し、router から manager PC へ forward します。","5179 は manager UI 用なので、外部ブラウザで Wall を開く必要がある時だけ公開を検討します。","公開 internet より VPN、Tailscale、ZeroTier、IP allowlist を優先してください。"],commandsTitle:"現在のコマンド",commandsBody:"Web サイトから installer を探すより、OS をまたいで terminal 1行で動かす方向です。",managerCommandLabel:"manager 起動",clientCommandLabel:"workstation 接続",slotCommandLabel:"slot 3 に固定",manualCommandLabel:"高度な手動接続"}),"zh-CN":jt({languageName:"简体中文",languageLabel:"文档语言",eyebrow:"LiveDesk Manual",title:"用一条命令打开本地 Screen Wall",intro:"LiveDesk 是 npm-first 的远程工作台,用一台 manager PC 监控多台工作站、AI 主机、Mac mini 和开发机器。",managerTitle:"1. 运行 manager",managerBody:"在负责查看屏幕的电脑上运行 LiveDesk manager。它会同时启动 UI 和本地服务器,并打开 http://127.0.0.1:5179。",managerPoints:["命令是 npx -y livedesk。","Screen Wall/API 使用 5179,client 连接使用 5197。","如果旧的 LiveDesk 进程占用端口,默认会清理后重新启动。"],clientTitle:"2. 连接 workstation",clientBody:"在被监控的电脑上使用同一个 Google 账号登录。即使 manager 还没在线,client 也会继续运行并每 5 秒重试。",clientPoints:["自动放入空位: npx -y livedesk client。","固定到 3 号位置: npx -y livedesk client 3。","大量电脑也可以持续等待,不需要反复登录。"],syncTitle:"3. Sync Server 和自动发现",syncBody:"Sync Server 会把当前 manager 作为该账号的 active Screen Wall 写入 Supabase。client 登录后读取记录并依次尝试连接候选地址。",syncPoints:["记录包括 host instance、LAN/private 地址、public 候选、pair token 和短 lease。","优先尝试同一 LAN 地址,需要时再尝试外部地址。","manager 位置、VPN、防火墙或路由变化后请点击 Sync Server。","livedesk.pages.dev 的 Chrome Local Network Access 不再是默认运行方式。npm manager app 才是真正服务器。"],platformTitle:"4. 当前平台状态",platformBody:"Windows 已确认可传输实时画面。macOS 和 Linux 正按同一 npm 命令路径扩展支持。",platformPoints:["Windows: 已确认可用。","macOS: 画面捕获和控制需要 Screen Recording/Accessibility 权限。","Linux: 已加入 linux-x64 runtime、grim/gnome-screenshot/import/scrot 捕获、xdotool 输入后端。音频尚未启用。"],firewallTitle:"防火墙和外部地点",firewallBody:"同一 LAN 通常不需要路由端口转发。不同地点连接时,client 必须能访问 manager 的 client 连接端口。",firewallPoints:["client 连接端口是 TCP 5197。","client 机器通常只需要出站访问。","跨网络时,在 manager 防火墙放行 TCP 5197 入站,并在路由器转发到 manager PC。","5179 是 manager UI 端口,仅在需要远程浏览器直接打开 Wall 时考虑暴露。","优先使用 VPN、Tailscale、ZeroTier 或固定 IP allowlist。"],commandsTitle:"当前命令",commandsBody:"产品方向是跨操作系统使用一条终端命令,而不是先找网站、下载、安装。",managerCommandLabel:"启动 manager",clientCommandLabel:"连接 workstation",slotCommandLabel:"固定到 slot 3",manualCommandLabel:"高级手动连接"}),"zh-TW":jt({languageName:"繁體中文",languageLabel:"文件語言",eyebrow:"LiveDesk Manual",title:"用一行指令開啟本機 Screen Wall",intro:"LiveDesk 是 npm-first 的遠端工作台,用一台 manager PC 監看多台工作站、AI 主機、Mac mini 與開發機。",managerTitle:"1. 執行 manager",managerBody:"在負責看畫面的電腦上執行 LiveDesk manager。它會同時啟動 UI 與本機伺服器,並開啟 http://127.0.0.1:5179。",managerPoints:["指令是 npx -y livedesk。","Screen Wall/API 使用 5179,client 連線使用 5197。","若舊的 LiveDesk 程序占用連接埠,預設會清理後重新啟動。"],clientTitle:"2. 連接 workstation",clientBody:"在被監看的電腦上使用同一個 Google 帳號登入。即使 manager 尚未上線,client 也會持續執行並每 5 秒重試。",clientPoints:["自動放入空位: npx -y livedesk client。","固定到 3 號位置: npx -y livedesk client 3。","大量電腦也能持續等待,不需要反覆登入。"],syncTitle:"3. Sync Server 與自動探索",syncBody:"Sync Server 會把目前 manager 登錄為此帳號的 active Screen Wall。client 登入後讀取 Supabase 記錄並依序嘗試連線候選地址。",syncPoints:["記錄包含 host instance、LAN/private 位址、public 候選、pair token 與短 lease。","優先嘗試 LAN 位址,需要時再嘗試外部位址。","manager 位置、VPN、防火牆或路由設定改變後請按 Sync Server。","livedesk.pages.dev 的 Chrome Local Network Access 不再是預設執行路徑。npm manager app 才是真正伺服器。"],platformTitle:"4. 目前平台狀態",platformBody:"Windows 已確認可傳輸即時畫面。macOS 與 Linux 也沿用相同 npm 指令路徑擴充支援。",platformPoints:["Windows: 已確認可用。","macOS: 畫面擷取與控制需要 Screen Recording/Accessibility 權限。","Linux: 已加入 linux-x64 runtime、grim/gnome-screenshot/import/scrot capture、xdotool input backend。音訊尚未啟用。"],firewallTitle:"防火牆與外部地點",firewallBody:"同一 LAN 通常不需要路由器轉發。不同地點連線時,client 必須能到達 manager 的 client 連線埠。",firewallPoints:["client 連線埠是 TCP 5197。","client 電腦通常只需要對外連線。","跨網路時,請在 manager 防火牆允許 TCP 5197 inbound,並從路由器轉發到 manager PC。","5179 是 manager UI 連接埠,只在需要遠端瀏覽器直接打開 Wall 時才考慮公開。","優先使用 VPN、Tailscale、ZeroTier 或固定 IP allowlist。"],commandsTitle:"目前指令",commandsBody:"產品方向是跨作業系統用一行 terminal 指令,而不是先找網站、下載、安裝。",managerCommandLabel:"啟動 manager",clientCommandLabel:"連接 workstation",slotCommandLabel:"固定到 slot 3",manualCommandLabel:"進階手動連線"}),es:jt({languageName:"Español",languageLabel:"Idioma del documento",eyebrow:"LiveDesk Manual",title:"Abre un Screen Wall local con un comando",intro:"LiveDesk es una consola npm-first para vigilar muchas estaciones, cajas de IA, Mac mini y equipos de desarrollo desde un PC manager.",managerTitle:"1. Ejecuta el manager",managerBody:"Ejecuta LiveDesk en el equipo que verá las pantallas. El manager inicia la UI y el servidor local juntos y abre http://127.0.0.1:5179.",managerPoints:["El comando es npx -y livedesk.","El manager usa 5179 para Screen Wall/API y 5197 para conexiones client.","Si un proceso antiguo ocupa los puertos, el arranque lo limpia por defecto."],clientTitle:"2. Conecta una workstation",clientBody:"En cada equipo monitoreado, inicia sesión con la misma cuenta Google. Si el manager aún no está activo, el client sigue intentando cada 5 segundos.",clientPoints:["Usa npx -y livedesk client para el primer slot libre.","Usa npx -y livedesk client 3 para fijar el equipo al slot 3.","Los clients siguen esperando para no repetir login en muchas máquinas."],syncTitle:"3. Sync Server y descubrimiento",syncBody:"Sync Server publica este manager como Screen Wall activo para la cuenta. Los clients leen el registro en Supabase y prueban los endpoints.",syncPoints:["Incluye host instance, direcciones LAN/private, candidatos public, pair token y lease corto.","Primero se prueban candidatos LAN, luego públicos si hace falta.","Pulsa Sync Server después de cambios de manager, VPN, firewall o router.","Chrome Local Network Access en livedesk.pages.dev ya no es el flujo principal. La app npm manager es el servidor real."],platformTitle:"4. Estado de plataformas",platformBody:"Windows ya fue verificado con transferencia de pantalla. macOS y Linux siguen el mismo camino npm.",platformPoints:["Windows: verificado.","macOS: captura y control requieren permisos Screen Recording/Accessibility.","Linux: agregado linux-x64 runtime, captura grim/gnome-screenshot/import/scrot y entrada xdotool. Audio aún desactivado."],firewallTitle:"Firewall y sedes remotas",firewallBody:"En la misma LAN normalmente no hace falta port forwarding. Para otra red, los clients deben llegar al puerto client del manager.",firewallPoints:["Puerto de conexión client: TCP 5197.","Los equipos client normalmente solo necesitan salida.","Para redes remotas, permite TCP 5197 inbound en el manager y reenvía TCP 5197 al PC manager.","El puerto 5179 es para la UI del manager; expónlo solo si un navegador remoto debe abrir el Wall.","Prefiere VPN, Tailscale, ZeroTier o allowlist de IP fijas."],commandsTitle:"Comandos actuales",commandsBody:"La dirección del producto es un comando de terminal común entre sistemas, no descargar e instalar desde una web.",managerCommandLabel:"Iniciar manager",clientCommandLabel:"Conectar workstation",slotCommandLabel:"Fijar al slot 3",manualCommandLabel:"Conexión manual avanzada"}),fr:jt({languageName:"Français",languageLabel:"Langue du document",eyebrow:"LiveDesk Manual",title:"Ouvrir un Screen Wall local en une commande",intro:"LiveDesk est un deck npm-first pour surveiller plusieurs postes, machines IA, Mac mini et machines dev depuis un PC manager.",managerTitle:"1. Lancer le manager",managerBody:"Lancez LiveDesk sur l’ordinateur qui observe les écrans. Le manager démarre l’UI et le serveur local, puis ouvre http://127.0.0.1:5179.",managerPoints:["La commande est npx -y livedesk.","Le manager utilise 5179 pour Screen Wall/API et 5197 pour les connexions client.","Si un ancien processus utilise les ports, le démarrage le nettoie par défaut."],clientTitle:"2. Connecter une workstation",clientBody:"Sur chaque ordinateur surveillé, connectez-vous avec le même compte Google. Si le manager n’est pas encore actif, le client réessaie toutes les 5 secondes.",clientPoints:["Utilisez npx -y livedesk client pour le premier slot libre.","Utilisez npx -y livedesk client 3 pour fixer la machine au slot 3.","Les clients continuent d’attendre pour éviter les reconnexions répétées."],syncTitle:"3. Sync Server et découverte",syncBody:"Sync Server publie ce manager comme Screen Wall actif du compte. Les clients lisent l’enregistrement Supabase et testent les endpoints.",syncPoints:["Il contient host instance, adresses LAN/private, candidats public, pair token et lease court.","Les candidats LAN sont essayés en premier, puis les candidats publics si besoin.","Cliquez Sync Server après un changement de manager, VPN, firewall ou routeur.","Chrome Local Network Access sur livedesk.pages.dev n’est plus le chemin par défaut. L’app npm manager est le vrai serveur."],platformTitle:"4. État des plateformes",platformBody:"Windows est vérifié avec transfert d’écran live. macOS et Linux suivent le même chemin npm.",platformPoints:["Windows: vérifié.","macOS: capture et contrôle nécessitent Screen Recording/Accessibility.","Linux: runtime linux-x64, capture grim/gnome-screenshot/import/scrot et entrée xdotool ajoutés. Audio désactivé."],firewallTitle:"Firewall et sites distants",firewallBody:"Sur le même LAN, le port forwarding est rarement nécessaire. Depuis un autre réseau, les clients doivent atteindre le port client du manager.",firewallPoints:["Port de connexion client: TCP 5197.","Les machines client ont normalement seulement besoin de sortie réseau.","Pour un réseau distant, autorisez TCP 5197 entrant sur le manager et redirigez TCP 5197 vers le PC manager.","Le port 5179 sert à l’UI manager; exposez-le seulement si un navigateur distant doit ouvrir le Wall.","Préférez VPN, Tailscale, ZeroTier ou allowlist IP fixes."],commandsTitle:"Commandes actuelles",commandsBody:"La direction produit est une commande terminal commune aux OS, plutôt qu’un téléchargement manuel depuis un site.",managerCommandLabel:"Démarrer manager",clientCommandLabel:"Connecter workstation",slotCommandLabel:"Fixer au slot 3",manualCommandLabel:"Connexion manuelle avancée"}),de:jt({languageName:"Deutsch",languageLabel:"Dokumentsprache",eyebrow:"LiveDesk Manual",title:"Lokale Screen Wall mit einem Befehl öffnen",intro:"LiveDesk ist ein npm-first Arbeitsdeck, um viele Workstations, AI-Boxen, Mac minis und Dev-Rechner von einem Manager-PC zu überwachen.",managerTitle:"1. Manager starten",managerBody:"Starte LiveDesk auf dem Computer, der die Screens sieht. Der Manager startet UI und lokalen Server zusammen und öffnet http://127.0.0.1:5179.",managerPoints:["Der Befehl ist npx -y livedesk.","Der Manager nutzt 5179 für Screen Wall/API und 5197 für Client-Verbindungen.","Wenn alte LiveDesk-Prozesse Ports belegen, werden sie beim Start standardmäßig bereinigt."],clientTitle:"2. Workstation verbinden",clientBody:"Melde dich auf jedem überwachten Computer mit demselben Google-Konto an. Wenn kein Manager online ist, versucht der Client alle 5 Sekunden weiter.",clientPoints:["npx -y livedesk client nutzt den ersten freien Slot.","npx -y livedesk client 3 fixiert den Rechner auf Slot 3.","Clients warten weiter, damit große Setups kein wiederholtes Login brauchen."],syncTitle:"3. Sync Server und Discovery",syncBody:"Sync Server veröffentlicht diesen Manager als aktive Screen Wall des Kontos. Clients lesen den Supabase-Eintrag und testen Endpoints der Reihe nach.",syncPoints:["Enthält host instance, LAN/private Adressen, public Kandidaten, pair token und kurze lease.","LAN-Kandidaten werden zuerst versucht, danach public Kandidaten.","Nach Änderungen an Manager, VPN, Firewall oder Router Sync Server drücken.","Chrome Local Network Access auf livedesk.pages.dev ist nicht mehr der Standardpfad. Die npm Manager App ist der echte Server."],platformTitle:"4. Plattformstatus",platformBody:"Windows wurde mit Live-Screen-Transfer geprüft. macOS und Linux folgen demselben npm-Pfad.",platformPoints:["Windows: verifiziert.","macOS: Capture und Control brauchen Screen Recording/Accessibility Rechte.","Linux: linux-x64 Runtime, grim/gnome-screenshot/import/scrot Capture und xdotool Input Backend sind ergänzt. Audio ist deaktiviert."],firewallTitle:"Firewall und entfernte Standorte",firewallBody:"Im gleichen LAN ist Router-Forwarding meist unnötig. Aus anderen Netzwerken müssen Clients den Client-Port des Managers erreichen.",firewallPoints:["Client-Verbindungsport: TCP 5197.","Client-Rechner brauchen normalerweise nur ausgehenden Zugriff.","Für entfernte Netzwerke TCP 5197 inbound am Manager erlauben und vom Router zum Manager-PC forwarden.","Port 5179 ist für die Manager-UI; nur öffnen, wenn ein Remote-Browser die Wall direkt öffnen muss.","VPN, Tailscale, ZeroTier oder feste IP-Allowlists bevorzugen."],commandsTitle:"Aktuelle Befehle",commandsBody:"Die Produktlinie ist ein Terminalbefehl über Betriebssysteme hinweg, statt Website suchen, herunterladen und installieren.",managerCommandLabel:"Manager starten",clientCommandLabel:"Workstation verbinden",slotCommandLabel:"An Slot 3 fixieren",manualCommandLabel:"Erweiterte manuelle Verbindung"}),"pt-BR":jt({languageName:"Português",languageLabel:"Idioma do documento",eyebrow:"LiveDesk Manual",title:"Abra um Screen Wall local com um comando",intro:"LiveDesk é um deck npm-first para monitorar várias estações, caixas de IA, Mac minis e máquinas dev a partir de um PC manager.",managerTitle:"1. Execute o manager",managerBody:"Rode LiveDesk no computador que verá as telas. O manager inicia a UI e o servidor local juntos e abre http://127.0.0.1:5179.",managerPoints:["O comando é npx -y livedesk.","O manager usa 5179 para Screen Wall/API e 5197 para conexões client.","Se um processo antigo ocupa as portas, a inicialização limpa por padrão."],clientTitle:"2. Conecte uma workstation",clientBody:"Em cada computador monitorado, entre com a mesma conta Google. Se o manager ainda não estiver online, o client tenta a cada 5 segundos.",clientPoints:["Use npx -y livedesk client para o primeiro slot livre.","Use npx -y livedesk client 3 para fixar no slot 3.","Clients continuam tentando para evitar login repetido em muitos PCs."],syncTitle:"3. Sync Server e descoberta",syncBody:"Sync Server publica este manager como Screen Wall ativo da conta. Clients leem o registro no Supabase e testam endpoints.",syncPoints:["Inclui host instance, endereços LAN/private, candidatos public, pair token e lease curto.","Candidatos LAN vêm primeiro; public depois se necessário.","Clique Sync Server após mudanças de manager, VPN, firewall ou roteador.","Chrome Local Network Access em livedesk.pages.dev não é mais o caminho padrão. O app npm manager é o servidor real."],platformTitle:"4. Estado das plataformas",platformBody:"Windows foi verificado com transferência de tela. macOS e Linux seguem o mesmo caminho npm.",platformPoints:["Windows: verificado.","macOS: captura e controle precisam de permissões Screen Recording/Accessibility.","Linux: runtime linux-x64, captura grim/gnome-screenshot/import/scrot e entrada xdotool adicionados. Áudio ainda desativado."],firewallTitle:"Firewall e locais remotos",firewallBody:"Na mesma LAN normalmente não é preciso port forwarding. Em outra rede, clients precisam alcançar a porta client do manager.",firewallPoints:["Porta client: TCP 5197.","Máquinas client normalmente só precisam de saída.","Para redes remotas, permita TCP 5197 inbound no manager e encaminhe TCP 5197 para o PC manager.","A porta 5179 é para a UI do manager; exponha apenas se um navegador remoto precisar abrir o Wall.","Prefira VPN, Tailscale, ZeroTier ou allowlist de IP fixo."],commandsTitle:"Comandos atuais",commandsBody:"A direção do produto é um comando de terminal comum entre sistemas, não baixar e instalar manualmente.",managerCommandLabel:"Iniciar manager",clientCommandLabel:"Conectar workstation",slotCommandLabel:"Fixar no slot 3",manualCommandLabel:"Conexão manual avançada"}),it:jt({languageName:"Italiano",languageLabel:"Lingua documento",eyebrow:"LiveDesk Manual",title:"Apri uno Screen Wall locale con un comando",intro:"LiveDesk è un deck npm-first per monitorare workstation, box AI, Mac mini e macchine dev da un solo PC manager.",managerTitle:"1. Avvia il manager",managerBody:"Esegui LiveDesk sul computer che guarderà gli schermi. Il manager avvia UI e server locale e apre http://127.0.0.1:5179.",managerPoints:["Il comando è npx -y livedesk.","Il manager usa 5179 per Screen Wall/API e 5197 per connessioni client.","Se vecchi processi occupano le porte, l’avvio le pulisce di default."],clientTitle:"2. Connetti una workstation",clientBody:"Su ogni computer monitorato, accedi con lo stesso account Google. Se il manager non è online, il client riprova ogni 5 secondi.",clientPoints:["npx -y livedesk client usa il primo slot libero.","npx -y livedesk client 3 fissa la macchina allo slot 3.","I client continuano a provare per evitare login ripetuti."],syncTitle:"3. Sync Server e discovery",syncBody:"Sync Server pubblica questo manager come Screen Wall attivo dell’account. I client leggono Supabase e provano gli endpoint.",syncPoints:["Include host instance, indirizzi LAN/private, candidati public, pair token e lease breve.","Prima LAN, poi public se necessario.","Premi Sync Server dopo cambi di manager, VPN, firewall o router.","Chrome Local Network Access su livedesk.pages.dev non è più il percorso principale. L’app npm manager è il server reale."],platformTitle:"4. Stato piattaforme",platformBody:"Windows è verificato con trasferimento schermo live. macOS e Linux seguono lo stesso percorso npm.",platformPoints:["Windows: verificato.","macOS: capture e control richiedono permessi Screen Recording/Accessibility.","Linux: aggiunti runtime linux-x64, capture grim/gnome-screenshot/import/scrot e input xdotool. Audio disattivato."],firewallTitle:"Firewall e sedi remote",firewallBody:"Nella stessa LAN di solito non serve port forwarding. Da altre reti, i client devono raggiungere la porta client del manager.",firewallPoints:["Porta client: TCP 5197.","I client normalmente richiedono solo uscita.","Per reti remote, abilita TCP 5197 inbound sul manager e inoltra TCP 5197 al PC manager.","La porta 5179 è per la UI manager; esponila solo se un browser remoto deve aprire il Wall.","Preferisci VPN, Tailscale, ZeroTier o IP allowlist."],commandsTitle:"Comandi attuali",commandsBody:"La direzione è un comando terminale comune tra sistemi operativi, invece di download e install manuale.",managerCommandLabel:"Avvia manager",clientCommandLabel:"Connetti workstation",slotCommandLabel:"Fissa allo slot 3",manualCommandLabel:"Connessione manuale avanzata"}),id:jt({languageName:"Bahasa Indonesia",languageLabel:"Bahasa dokumen",eyebrow:"LiveDesk Manual",title:"Buka Screen Wall lokal dengan satu perintah",intro:"LiveDesk adalah deck npm-first untuk memantau banyak workstation, AI box, Mac mini, dan mesin dev dari satu PC manager.",managerTitle:"1. Jalankan manager",managerBody:"Jalankan LiveDesk di komputer yang melihat layar. Manager membuka UI dan server lokal bersama, lalu membuka http://127.0.0.1:5179.",managerPoints:["Perintahnya npx -y livedesk.","Manager memakai 5179 untuk Screen Wall/API dan 5197 untuk koneksi client.","Jika proses lama memakai port itu, startup membersihkannya secara default."],clientTitle:"2. Hubungkan workstation",clientBody:"Di komputer yang dipantau, masuk dengan akun Google yang sama. Jika manager belum online, client tetap mencoba tiap 5 detik.",clientPoints:["npx -y livedesk client memakai slot kosong pertama.","npx -y livedesk client 3 mengunci mesin ke slot 3.","Client terus mencoba agar banyak PC tidak perlu login berulang."],syncTitle:"3. Sync Server dan discovery",syncBody:"Sync Server menerbitkan manager ini sebagai Screen Wall aktif untuk akun. Client membaca Supabase dan mencoba endpoint.",syncPoints:["Berisi host instance, alamat LAN/private, kandidat public, pair token, dan lease pendek.","Kandidat LAN dicoba lebih dulu, lalu public jika perlu.","Tekan Sync Server setelah perubahan manager, VPN, firewall, atau router.","Chrome Local Network Access di livedesk.pages.dev bukan jalur utama lagi. App npm manager adalah server sebenarnya."],platformTitle:"4. Status platform",platformBody:"Windows sudah diverifikasi dengan live screen transfer. macOS dan Linux mengikuti jalur npm yang sama.",platformPoints:["Windows: terverifikasi.","macOS: capture dan control perlu izin Screen Recording/Accessibility.","Linux: runtime linux-x64, capture grim/gnome-screenshot/import/scrot, dan input xdotool sudah ditambahkan. Audio belum aktif."],firewallTitle:"Firewall dan lokasi luar",firewallBody:"Di LAN yang sama biasanya tidak perlu port forwarding. Dari jaringan lain, client harus mencapai port client manager.",firewallPoints:["Port client: TCP 5197.","Mesin client biasanya hanya perlu akses keluar.","Untuk jaringan luar, izinkan TCP 5197 inbound di manager dan forward TCP 5197 ke PC manager.","Port 5179 untuk UI manager; buka hanya jika browser luar harus membuka Wall.","Utamakan VPN, Tailscale, ZeroTier, atau IP allowlist."],commandsTitle:"Perintah saat ini",commandsBody:"Arah produk adalah satu perintah terminal lintas OS, bukan download dan instal manual.",managerCommandLabel:"Mulai manager",clientCommandLabel:"Hubungkan workstation",slotCommandLabel:"Kunci ke slot 3",manualCommandLabel:"Koneksi manual lanjutan"}),vi:jt({languageName:"Tiếng Việt",languageLabel:"Ngôn ngữ tài liệu",eyebrow:"LiveDesk Manual",title:"Mở Screen Wall cục bộ bằng một lệnh",intro:"LiveDesk là deck npm-first để giám sát nhiều workstation, máy AI, Mac mini và máy dev từ một PC manager.",managerTitle:"1. Chạy manager",managerBody:"Chạy LiveDesk trên máy dùng để xem màn hình. Manager khởi động UI và server cục bộ cùng lúc, rồi mở http://127.0.0.1:5179.",managerPoints:["Lệnh là npx -y livedesk.","Manager dùng 5179 cho Screen Wall/API và 5197 cho kết nối client.","Nếu tiến trình cũ giữ port, startup mặc định sẽ dọn và khởi động lại."],clientTitle:"2. Kết nối workstation",clientBody:"Trên mỗi máy được giám sát, đăng nhập cùng tài khoản Google. Nếu manager chưa online, client tiếp tục thử mỗi 5 giây.",clientPoints:["npx -y livedesk client dùng slot trống đầu tiên.","npx -y livedesk client 3 ghim máy vào slot 3.","Client tiếp tục chờ để nhiều máy không cần đăng nhập lại."],syncTitle:"3. Sync Server và tự phát hiện",syncBody:"Sync Server đăng manager này là Screen Wall đang hoạt động của tài khoản. Client đọc Supabase và thử các endpoint.",syncPoints:["Bao gồm host instance, địa chỉ LAN/private, public candidate, pair token và lease ngắn.","Ưu tiên LAN trước, sau đó thử public nếu cần.","Bấm Sync Server sau thay đổi manager, VPN, firewall hoặc router.","Chrome Local Network Access trên livedesk.pages.dev không còn là đường chạy chính. App npm manager mới là server thật."],platformTitle:"4. Trạng thái nền tảng",platformBody:"Windows đã được kiểm chứng với truyền màn hình live. macOS và Linux đi theo cùng đường npm.",platformPoints:["Windows: đã kiểm chứng.","macOS: capture và control cần quyền Screen Recording/Accessibility.","Linux: đã thêm runtime linux-x64, capture grim/gnome-screenshot/import/scrot và input xdotool. Audio chưa bật."],firewallTitle:"Firewall và địa điểm ngoài",firewallBody:"Trong cùng LAN thường không cần port forwarding. Từ mạng khác, client phải truy cập được port client của manager.",firewallPoints:["Port client: TCP 5197.","Máy client thường chỉ cần kết nối outbound.","Với mạng ngoài, cho phép TCP 5197 inbound trên manager và forward TCP 5197 tới PC manager.","Port 5179 dành cho UI manager; chỉ mở nếu trình duyệt từ xa cần mở Wall trực tiếp.","Ưu tiên VPN, Tailscale, ZeroTier hoặc allowlist IP cố định."],commandsTitle:"Lệnh hiện tại",commandsBody:"Hướng sản phẩm là một lệnh terminal dùng chung giữa các OS, thay vì tải và cài thủ công.",managerCommandLabel:"Khởi động manager",clientCommandLabel:"Kết nối workstation",slotCommandLabel:"Ghim vào slot 3",manualCommandLabel:"Kết nối thủ công nâng cao"}),th:jt({languageName:"ไทย",languageLabel:"ภาษาของเอกสาร",eyebrow:"LiveDesk Manual",title:"เปิด Screen Wall ภายในด้วยคำสั่งเดียว",intro:"LiveDesk คือ deck แบบ npm-first สำหรับดู workstation, กล่อง AI, Mac mini และเครื่อง dev หลายเครื่องจาก manager PC เครื่องเดียว",managerTitle:"1. รัน manager",managerBody:"รัน LiveDesk บนเครื่องที่ใช้ดูหน้าจอ Manager จะเปิด UI และ local server พร้อมกัน แล้วเปิด http://127.0.0.1:5179",managerPoints:["คำสั่งคือ npx -y livedesk","Manager ใช้ 5179 สำหรับ Screen Wall/API และ 5197 สำหรับ client connection","ถ้า process เก่ายังใช้ port อยู่ startup จะล้างให้โดย default"],clientTitle:"2. เชื่อม workstation",clientBody:"บนเครื่องที่ต้อง monitor ให้ login ด้วย Google account เดียวกัน ถ้า manager ยังไม่ออนไลน์ client จะลองใหม่ทุก 5 วินาที",clientPoints:["npx -y livedesk client จะใช้ slot ว่างแรก","npx -y livedesk client 3 จะตรึงเครื่องไว้ที่ slot 3","Client จะรอต่อเนื่องเพื่อไม่ต้อง login ซ้ำเมื่อมีหลายเครื่อง"],syncTitle:"3. Sync Server และ discovery",syncBody:"Sync Server จะ publish manager นี้เป็น active Screen Wall ของ account แล้ว client อ่านข้อมูลจาก Supabase และลอง endpoint ต่างๆ",syncPoints:["มี host instance, LAN/private address, public candidate, pair token และ short lease","ลอง LAN ก่อน แล้วค่อยลอง public ถ้าจำเป็น","กด Sync Server หลังเปลี่ยน manager, VPN, firewall หรือ router","Chrome Local Network Access บน livedesk.pages.dev ไม่ใช่ runtime หลักแล้ว app npm manager คือ server จริง"],platformTitle:"4. สถานะ platform",platformBody:"Windows ตรวจสอบแล้วว่าส่งภาพ live ได้ macOS และ Linux ใช้เส้นทาง npm เดียวกัน",platformPoints:["Windows: verified","macOS: capture/control ต้องใช้สิทธิ์ Screen Recording/Accessibility","Linux: เพิ่ม linux-x64 runtime, grim/gnome-screenshot/import/scrot capture และ xdotool input แล้ว audio ยังปิดอยู่"],firewallTitle:"Firewall และเครื่องต่างสถานที่",firewallBody:"ใน LAN เดียวกันปกติไม่ต้อง port forwarding ถ้าอยู่คนละ network client ต้องเข้าถึง client port ของ manager ได้",firewallPoints:["Client port คือ TCP 5197","เครื่อง client ปกติต้องการ outbound เท่านั้น","ถ้าอยู่นอก network ให้เปิด TCP 5197 inbound ที่ manager และ forward TCP 5197 ไปยัง manager PC","Port 5179 เป็น UI ของ manager เปิดเฉพาะเมื่อ browser ระยะไกลต้องเปิด Wall โดยตรง","ควรใช้ VPN, Tailscale, ZeroTier หรือ IP allowlist ก่อนเปิดสู่ public internet"],commandsTitle:"คำสั่งปัจจุบัน",commandsBody:"ทิศทาง product คือคำสั่ง terminal เดียวข้าม OS ไม่ใช่ download/install จากเว็บไซต์",managerCommandLabel:"เริ่ม manager",clientCommandLabel:"เชื่อม workstation",slotCommandLabel:"ตรึง slot 3",manualCommandLabel:"manual connection ขั้นสูง"}),hi:jt({languageName:"हिन्दी",languageLabel:"दस्तावेज़ भाषा",eyebrow:"LiveDesk Manual",title:"एक कमांड से local Screen Wall खोलें",intro:"LiveDesk एक npm-first remote work deck है जिससे एक manager PC से कई workstation, AI box, Mac mini और dev machines देखे जा सकते हैं।",managerTitle:"1. manager चलाएं",managerBody:"जिस computer से screens देखनी हैं उस पर LiveDesk manager चलाएं। यह UI और local server साथ में शुरू करता है और http://127.0.0.1:5179 खोलता है।",managerPoints:["कमांड है npx -y livedesk।","Manager Screen Wall/API के लिए 5179 और client connections के लिए 5197 इस्तेमाल करता है।","अगर पुराने LiveDesk ports बचे हों तो startup default रूप से साफ करता है।"],clientTitle:"2. workstation जोड़ें",clientBody:"हर monitored computer पर उसी Google account से sign in करें। Manager online न हो तब भी client बंद नहीं होता और हर 5 सेकंड retry करता है।",clientPoints:["npx -y livedesk client पहला खाली slot लेता है।","npx -y livedesk client 3 machine को slot 3 पर pin करता है।","बहुत सी machines हों तब भी बार-बार login की जरूरत नहीं रहती।"],syncTitle:"3. Sync Server और discovery",syncBody:"Sync Server इस manager को account का active Screen Wall बनाकर Supabase में publish करता है। Clients record पढ़कर endpoints try करते हैं।",syncPoints:["इसमें host instance, LAN/private addresses, public candidates, pair token और short lease होता है।","LAN candidates पहले try होते हैं, जरूरत हो तो public candidates।","Manager, VPN, firewall या router बदलने के बाद Sync Server दबाएं।","livedesk.pages.dev का Chrome Local Network Access अब default runtime नहीं है। npm manager app ही real server है।"],platformTitle:"4. Platform status",platformBody:"Windows live screen transfer के साथ verified है। macOS और Linux भी इसी npm path पर आगे बढ़ रहे हैं।",platformPoints:["Windows: verified.","macOS: capture/control के लिए Screen Recording/Accessibility permissions चाहिए।","Linux: linux-x64 runtime, grim/gnome-screenshot/import/scrot capture और xdotool input backend जोड़े गए हैं। Audio अभी disabled है।"],firewallTitle:"Firewall और remote locations",firewallBody:"Same LAN में आम तौर पर router forwarding जरूरी नहीं। दूसरे network से clients को manager client port तक पहुंचना होगा।",firewallPoints:["Client connection port: TCP 5197.","Client machines को आम तौर पर सिर्फ outbound access चाहिए।","Remote network के लिए manager firewall में TCP 5197 inbound allow करें और router से TCP 5197 manager PC पर forward करें।","5179 manager UI port है; इसे तभी expose करें जब remote browser को Wall खोलना हो।","Public internet से पहले VPN, Tailscale, ZeroTier या fixed IP allowlist बेहतर है।"],commandsTitle:"Current commands",commandsBody:"Product direction है OS के बीच एक terminal command, website से download/install नहीं।",managerCommandLabel:"Start manager",clientCommandLabel:"Connect workstation",slotCommandLabel:"Pin to slot 3",manualCommandLabel:"Advanced manual connection"}),ar:jt({languageName:"العربية",languageLabel:"لغة المستند",eyebrow:"LiveDesk Manual",title:"افتح Screen Wall محلي بأمر واحد",intro:"LiveDesk هو deck بنمط npm-first لمراقبة عدة workstations وأجهزة AI وMac mini وأجهزة تطوير من كمبيوتر manager واحد.",managerTitle:"1. شغل manager",managerBody:"شغل LiveDesk على الكمبيوتر الذي سيعرض الشاشات. يبدأ manager الواجهة والخادم المحلي معا ويفتح http://127.0.0.1:5179.",managerPoints:["الأمر هو npx -y livedesk.","يستخدم manager المنفذ 5179 للواجهة/API والمنفذ 5197 لاتصالات client.","إذا بقيت عملية LiveDesk قديمة على المنافذ، يتم تنظيفها افتراضيا عند التشغيل."],clientTitle:"2. وصل workstation",clientBody:"على كل كمبيوتر تتم مراقبته، سجل الدخول بنفس حساب Google. إذا لم يكن manager متاحا، يبقى client يعمل ويحاول كل 5 ثوان.",clientPoints:["npx -y livedesk client يختار أول slot فارغ.","npx -y livedesk client 3 يثبت الجهاز في slot 3.","clients تستمر بالمحاولة لتجنب تكرار تسجيل الدخول عند كثرة الأجهزة."],syncTitle:"3. Sync Server والاكتشاف",syncBody:"Sync Server ينشر هذا manager كـ active Screen Wall للحساب. يقرأ clients سجل Supabase ويجربون endpoints بالترتيب.",syncPoints:["السجل يتضمن host instance وعناوين LAN/private وpublic candidates وpair token وlease قصير.","يتم تفضيل LAN أولا، ثم public عند الحاجة.","اضغط Sync Server بعد تغيير manager أو VPN أو firewall أو router.","Chrome Local Network Access على livedesk.pages.dev لم يعد مسار التشغيل الافتراضي. تطبيق npm manager هو الخادم الحقيقي."],platformTitle:"4. حالة المنصات",platformBody:"Windows تم التحقق منه مع نقل شاشة live. macOS وLinux يتبعان نفس مسار npm.",platformPoints:["Windows: تم التحقق.","macOS: capture/control يحتاجان أذونات Screen Recording/Accessibility.","Linux: تمت إضافة linux-x64 runtime وgrim/gnome-screenshot/import/scrot capture وxdotool input. الصوت ما زال معطلا."],firewallTitle:"Firewall والمواقع البعيدة",firewallBody:"داخل نفس LAN غالبا لا تحتاج port forwarding. من شبكة أخرى يجب أن يصل client إلى منفذ manager client.",firewallPoints:["منفذ client: TCP 5197.","أجهزة client تحتاج عادة اتصال outbound فقط.","للشبكات البعيدة، اسمح TCP 5197 inbound على manager ووجه TCP 5197 من router إلى manager PC.","المنفذ 5179 مخصص لواجهة manager؛ اكشفه فقط إذا كان متصفح بعيد يحتاج فتح Wall مباشرة.","يفضل VPN أو Tailscale أو ZeroTier أو fixed IP allowlist بدل التعريض العام."],commandsTitle:"الأوامر الحالية",commandsBody:"اتجاه المنتج هو أمر terminal واحد عبر الأنظمة، وليس تحميل وتثبيت يدوي من موقع.",managerCommandLabel:"Start manager",clientCommandLabel:"Connect workstation",slotCommandLabel:"Pin to slot 3",manualCommandLabel:"Advanced manual connection"}),tr:jt({languageName:"Türkçe",languageLabel:"Belge dili",eyebrow:"LiveDesk Manual",title:"Yerel Screen Wall tek komutla açılsın",intro:"LiveDesk, tek bir manager PC üzerinden birçok workstation, AI box, Mac mini ve dev machine izlemek için npm-first bir çalışma deckidir.",managerTitle:"1. Manager çalıştır",managerBody:"Ekranları izleyecek bilgisayarda LiveDesk manager çalıştır. Manager UI ve local server birlikte başlar ve http://127.0.0.1:5179 açılır.",managerPoints:["Komut: npx -y livedesk.","Manager Screen Wall/API için 5179, client bağlantıları için 5197 kullanır.","Eski LiveDesk process portları tutuyorsa başlangıç varsayılan olarak temizler."],clientTitle:"2. Workstation bağla",clientBody:"İzlenecek bilgisayarda aynı Google hesabıyla giriş yap. Manager henüz online değilse client kapanmaz ve her 5 saniyede tekrar dener.",clientPoints:["npx -y livedesk client ilk boş slota yerleşir.","npx -y livedesk client 3 makineyi slot 3’e sabitler.","Çok makinede tekrar tekrar login gerekmesin diye client beklemeye devam eder."],syncTitle:"3. Sync Server ve discovery",syncBody:"Sync Server bu managerı hesabın active Screen Wall kaydı olarak Supabase’e yazar. Clients bu kaydı okuyup endpoint adaylarını dener.",syncPoints:["Host instance, LAN/private adresler, public adaylar, pair token ve kısa lease içerir.","Önce LAN adayları, gerekirse public adaylar denenir.","Manager, VPN, firewall veya router değişince Sync Server’a bas.","livedesk.pages.dev üzerindeki Chrome Local Network Access artık default runtime yolu değil. Gerçek server npm manager app."],platformTitle:"4. Platform durumu",platformBody:"Windows live screen transfer ile doğrulandı. macOS ve Linux aynı npm yolunu takip ediyor.",platformPoints:["Windows: doğrulandı.","macOS: capture/control için Screen Recording/Accessibility izinleri gerekir.","Linux: linux-x64 runtime, grim/gnome-screenshot/import/scrot capture ve xdotool input backend eklendi. Audio kapalı."],firewallTitle:"Firewall ve uzak konumlar",firewallBody:"Aynı LAN içinde genelde router forwarding gerekmez. Başka ağdan clients manager client portuna ulaşabilmelidir.",firewallPoints:["Client port: TCP 5197.","Client makineler normalde sadece outbound erişim ister.","Uzak ağ için manager firewall üzerinde TCP 5197 inbound aç ve routerdan TCP 5197yi manager PCye forward et.","5179 manager UI portudur; sadece uzak browser Wall açacaksa expose et.","Public internet yerine VPN, Tailscale, ZeroTier veya sabit IP allowlist tercih et."],commandsTitle:"Güncel komutlar",commandsBody:"Ürün yönü, webden indirip kurmak yerine işletim sistemleri arasında ortak tek terminal komutu.",managerCommandLabel:"Manager başlat",clientCommandLabel:"Workstation bağla",slotCommandLabel:"Slot 3’e sabitle",manualCommandLabel:"Gelişmiş manuel bağlantı"})},a1=Object.entries(Mr).map(([i,n])=>({id:i,label:n.languageName}));function i1(){if(typeof navigator>"u")return"en";const i=navigator.languages?.length?navigator.languages:[navigator.language];for(const n of i){const r=n.toLowerCase();if(Mr[n])return n;if(r.startsWith("zh-tw")||r.startsWith("zh-hk"))return"zh-TW";if(r.startsWith("pt"))return"pt-BR";const l=r.split("-")[0];if(Mr[l])return l}return"en"}function Tp({index:i,selected:n,onSelect:r}){const l=i+1;return y.jsx("article",{className:`device-tile placeholder-tile ${n?"selected":""}`,children:y.jsxs("button",{className:"tile-screen",onClick:r,"aria-pressed":n,title:`Select slot ${l}`,type:"button",children:[y.jsx("span",{className:"slot-grid","aria-hidden":"true"}),y.jsxs("span",{className:"empty-screen",children:[y.jsx(jr,{size:24}),y.jsxs("strong",{children:["Slot ",String(l).padStart(3,"0")]})]})]})})}function kp({device:i,frame:n,selected:r,controlEnabled:l,showStatus:c,monitorIndex:d,monitorCount:h,onSelect:m,onFocusDevice:g,onOpenControl:p,onCycleMonitor:S,sendInput:b}){const T=H.useRef(null),A=H.useRef(0),C=iy(i),z=Rr(d,h),G=h>1;H.useEffect(()=>{const O=T.current;if(!O||!n)return;let Y=!1;return y_(O,n,()=>Y).catch(()=>{}),()=>{Y=!0}},[n]);const I=O=>{const Y=O.currentTarget.getBoundingClientRect();return{normalizedX:Math.max(0,Math.min(1,(O.clientX-Y.left)/Math.max(1,Y.width))),normalizedY:Math.max(0,Math.min(1,(O.clientY-Y.top)/Math.max(1,Y.height)))}},$=(O,Y)=>{if(l){if(Y==="pointermove"){const me=performance.now();if(me-A.current<24)return;A.current=me}b(i.deviceId,{type:Y,...I(O),button:Q_(O.button)})}};return y.jsx("article",{className:`device-tile ${r?"selected":""} ${i.connected?"online":"offline"}`,"data-live-device-id":i.deviceId,children:y.jsxs("div",{className:"tile-screen",role:"button",tabIndex:l?-1:0,"aria-pressed":r,onClick:()=>{l||m()},onKeyDown:O=>{l||(O.key==="Enter"||O.key===" ")&&(O.preventDefault(),m())},onDoubleClick:O=>{O.preventDefault(),p()},children:[y.jsx("canvas",{ref:T,className:"remote-canvas",tabIndex:l?0:-1,onPointerDown:O=>{l&&(g(),O.currentTarget.focus(),O.currentTarget.setPointerCapture(O.pointerId),$(O,"pointerdown"))},onPointerMove:O=>$(O,"pointermove"),onPointerUp:O=>$(O,"pointerup"),onWheel:O=>{l&&(O.preventDefault(),b(i.deviceId,{type:"wheel",deltaX:O.deltaX,deltaY:O.deltaY}))},onKeyDown:O=>{l&&b(i.deviceId,{type:"keydown",key:O.key,code:O.code,text:O.key.length===1?O.key:"",repeat:O.repeat})},onKeyUp:O=>{l&&b(i.deviceId,{type:"keyup",key:O.key,code:O.code,text:O.key.length===1?O.key:"",repeat:!1})},onContextMenu:O=>l&&O.preventDefault()}),!n&&y.jsx("span",{className:"empty-screen",children:y.jsx(jr,{size:26})}),c&&y.jsxs(y.Fragment,{children:[y.jsx("span",{className:`tile-health-pill state-${C.state}`,children:C.label}),y.jsx("span",{className:"tile-metrics","aria-label":`${nl(i)} status`,children:C.metrics.slice(0,3).map(O=>y.jsxs("span",{className:`tile-metric state-${O.state}`,children:[y.jsx("b",{children:O.label}),y.jsx("em",{children:O.value}),O.ratio!==void 0&&y.jsx("i",{style:{width:`${Math.round(O.ratio*100)}%`}})]},O.id))})]}),G&&y.jsxs("span",{className:"monitor-cycle","aria-label":`${nl(i)} display ${z+1} of ${h}`,children:[y.jsx("button",{className:"monitor-cycle-button previous",onClick:O=>{O.preventDefault(),O.stopPropagation(),S(-1)},title:"Previous display",type:"button",children:y.jsx(Ap,{size:18})}),y.jsxs("span",{className:"monitor-cycle-count",children:["Screen ",z+1,"/",h]}),y.jsx("button",{className:"monitor-cycle-button next",onClick:O=>{O.preventDefault(),O.stopPropagation(),S(1)},title:"Next display",type:"button",children:y.jsx(xp,{size:18})})]})]})})}function r1(){const{session:i,loading:n}=C_(),{target:r,error:l,refresh:c}=R_(i),d=H.useMemo(()=>{if(!r?.active)return null;const w=r.expires_at?Date.parse(r.expires_at):Number.POSITIVE_INFINITY;return Number.isFinite(w)&&w<=Date.now()?null:r},[r]),h=H.useMemo(()=>bp(d),[d]),m=H.useMemo(()=>h.length>0?[...new Set([...h,Ut])]:[Ut],[h]),[g,p]=H.useState(G_),S=H.useMemo(()=>m.some(w=>!!el(w)),[m]),b=!S||g,{status:T,devices:A,error:C,refresh:z,hubBaseUrl:G}=O_(m,b),{entitlement:I,licensed:$,loading:O,error:Y,refresh:me}=j_(i),[ie,K]=H.useState([]),[Ee,Se]=H.useState([]),[Kt,te]=H.useState(""),[Ce,Je]=H.useState(!1),[Xe,ze]=H.useState(!1),[D,V]=H.useState(""),[le,ne]=H.useState(""),[xe,E]=H.useState(""),[M,J]=H.useState("wall"),[Z,ge]=H.useState("large"),[ye,Oe]=H.useState(i1),[Qe,Ze]=H.useState(!1),[xn,gn]=H.useState(!1),[xi,Ci]=H.useState(!1),[In,zr]=H.useState(!1),[va,ec]=H.useState(I_),[he,Oi]=H.useState(V_),[Gn,Ri]=H.useState({}),[Br,ji]=H.useState([]),[Ie,Hr]=H.useState(he.fps),[Qa,Cn]=H.useState(null),[Ni,qr]=H.useState(!1),$r=H.useRef(null),fl=H.useRef(null),Pr=H.useRef(!1),ba=H.useRef(0),vt=H.useRef(0),Ct=H.useRef(0),Ot=M==="settings",ml=M==="pricing",gl=M==="doc",pl=!ml&&!gl,On=M==="control",De=H.useMemo(()=>A.filter(w=>w.connected),[A]),Li=H.useMemo(()=>De.reduce((w,P)=>Math.max(w,Vs(P.slotNumber)),0),[De]),bt=Math.max(z_,De.length,Li),Vn=H.useMemo(()=>{const w=Array(bt).fill(null),P=[];for(const Q of De){const X=Vs(Q.slotNumber);X>0&&X<=bt&&!w[X-1]?w[X-1]=Q:P.push(Q)}for(const Q of P){const X=w.findIndex(ue=>!ue);X<0?w.push(Q):w[X]=Q}return w},[De,bt]),Sa=H.useMemo(()=>De.map(w=>w.deviceId),[De]),Ir=H.useMemo(()=>new Set(ie),[ie]),wa=H.useMemo(()=>new Set(Ee),[Ee]),Rn=H.useMemo(()=>De.filter(w=>Ir.has(w.deviceId)||wa.has(Vs(w.slotNumber))),[De,Ir,wa]),se=H.useMemo(()=>A.find(w=>w.deviceId===Kt)||Rn[0]||null,[A,Kt,Rn]),an=H.useMemo(()=>se?iy(se):null,[se]),yl=se?tl(se,"control"):!1,Di=se?tl(se,"audio")||tl(se,"remoteAudio"):!1,Gr=De.length<=_r,et=$||Gr,jn=`Free plan includes up to ${_r} workstations. Upgrade to LTD for ${De.length} workstations.`,Mi=et&&!!se,Za=et&&!!se&&yl,pn=et&&!!se&&Di,tt=H.useMemo(()=>Vn.filter(w=>!!w?.connected).slice(0,Y_(Z)).map(w=>w.deviceId),[Vn,Z]),Tt=H.useMemo(()=>he.visibleOnlyLive?Br.length>0?Br:tt:Sa,[tt,Br,he.visibleOnlyLive,Sa]),Yt=H.useMemo(()=>et?On&&se?[se.deviceId]:wp(Tt):[],[et,se,On,Tt]),Vr=H.useMemo(()=>({fps:Ie,maxWidth:he.maxWidth,maxHeight:he.maxHeight,quality:he.quality,mode:he.frameMode,frameMode:he.frameMode,monitorSelections:Gn}),[Ie,Gn,he]),{frames:Kr,state:Yr,stats:Nn}=N_(Yt,he.autoStartLive&&Yt.length>0,G,Vr),{state:_a,sendInput:Ui}=L_(Za&&Ce,G),{state:Kn,error:Yn}=U_(se?.deviceId||"",pn&&Xe,G);H.useEffect(()=>{Hr(he.fps),vt.current=Date.now(),Ct.current=0},[he.fps,he.frameMode,he.adaptiveLoadShedding]),H.useEffect(()=>{if(!et||On||!he.visibleOnlyLive){ji([]);return}const w=$r.current;if(!w||typeof IntersectionObserver>"u"){ji(tt);return}const P=Array.from(w.querySelectorAll("[data-live-device-id]"));if(P.length===0){ji([]);return}const Q=new Map,X=()=>{const ae=wp(P.map(fe=>String(fe.dataset.liveDeviceId||"")).filter(fe=>(Q.get(fe)||0)>0));ji(fe=>Td(fe,ae)?fe:ae)},ue=new IntersectionObserver(ae=>{for(const fe of ae){const Ve=String(fe.target.dataset.liveDeviceId||"");Ve&&Q.set(Ve,fe.isIntersecting?fe.intersectionRatio||.01:0)}X()},{root:null,rootMargin:Gt.visibleRootMargin,threshold:[0,.01,.2,.6,1]});return P.forEach(ae=>ue.observe(ae)),X(),()=>ue.disconnect()},[tt,et,On,Vn,he.visibleOnlyLive,Z]),H.useEffect(()=>{if(!he.adaptiveLoadShedding||!he.autoStartLive||Yt.length===0||Yr!=="open"||Nn.sampleMs<500)return;const w=Date.now(),P=he.fps,Q=Yt.length*Ie,X=Nn.framesPerSecond,ue=Nn.bytesPerSecond,ae=Q>8&&X>0&&X<Q*.72;if(X>Gt.maxWallFramesPerSecond||ue>Gt.maxWallBytesPerSecond||ae){if(Ct.current=0,w-vt.current>=Gt.downshiftCooldownMs&&Ie>Gt.minFps){const Le=Math.max(Gt.minFps,J_(Ie));Le<Ie&&(Hr(Le),vt.current=w)}return}const Ve=X<Gt.maxWallFramesPerSecond*Gt.lowLoadFrameRatio&&ue<Gt.maxWallBytesPerSecond*Gt.lowLoadByteRatio;if(!Ve||Ie>=P){Ve||(Ct.current=0);return}if(!Ct.current){Ct.current=w;return}if(w-Ct.current>=Gt.recoveryCooldownMs){const Le=Math.min(P,X_(Ie,P));Le>Ie&&(Hr(Le),vt.current=w,Ct.current=0)}},[Ie,Yt.length,Yr,Nn.bytesPerSecond,Nn.framesPerSecond,Nn.lastUpdatedAt,Nn.sampleMs,he.adaptiveLoadShedding,he.autoStartLive,he.fps]),H.useEffect(()=>{const w=new URLSearchParams(window.location.search).get("checkout");if(w==="success"){ne("Checkout returned. Waiting for Dodo confirmation."),me();const P=window.setInterval(()=>{me()},4e3),Q=window.setTimeout(()=>{window.clearInterval(P)},45e3);return()=>{window.clearInterval(P),window.clearTimeout(Q)}}w==="cancelled"&&ne("Checkout cancelled.")},[me]),H.useEffect(()=>{!et&&Ce&&Je(!1),!et&&Xe&&ze(!1)},[Xe,Ce,et]),H.useEffect(()=>{ze(!1)},[se?.deviceId]),H.useEffect(()=>{const w=De.map(X=>X.deviceId),P=new Set(w),Q=new Map(De.map(X=>[X.deviceId,X]));K(X=>{const ue=X.filter(ae=>P.has(ae));return Td(X,ue)?X:ue}),te(X=>X&&P.has(X)?X:""),Se(X=>{const ue=X.filter(ae=>ae>=1&&ae<=bt);return Td(X.map(String),ue.map(String))?X:ue}),Ri(X=>{let ue=!1;const ae={};for(const[fe,Ve]of Object.entries(X)){if(!P.has(fe)){ue=!0;continue}const Le=Q.get(fe),at=Rr(Ve,Le?Ti(Le):1);ae[fe]=at,at!==Ve&&(ue=!0)}return ue?ae:X})},[De,bt]),H.useEffect(()=>{try{localStorage.setItem(Zp,va)}catch{}},[va]),H.useEffect(()=>{K_(he)},[he]);const Jn=H.useCallback(async()=>{const w=new Set(m);w.add(Ut);try{const ae=await kn("/api/remote/status",void 0,Ut);bp({endpoint:ae.agentEndpoint,endpoint_candidates:[...ae.agentEndpointCandidates||[],...ae.hostTargetEndpointCandidates||[]]}).forEach(fe=>w.add(fe))}catch{}const P=[...w].sort((ae,fe)=>{const Ve=Le=>{const at=el(Le);return at==="local"?0:at==="loopback"?1:2};return Ve(ae)-Ve(fe)||ae.localeCompare(fe)});let Q=!1,X="",ue=!1;try{for(const ae of P){const fe=el(ae);try{if(await kn("/api/health",void 0,ae),fe==="local")return p(!0),Tr(!0),ae;fe==="loopback"&&(Q=!0,X=ae)}catch{fe==="local"&&(ue=!0)}}return Q?(ue&&ne("LiveDesk Hub is reachable on this PC, but not through the LAN address yet. Restart LiveDesk Hub to bind 5179 on the network."),p(!0),Tr(!0),X||Ut):(p(!1),Tr(!1),"")}catch{return p(!1),Tr(!1),""}},[m]),Xn=async()=>{V("auth"),gn(!1),await Jn();const{error:w}=await $n.auth.signInWithOAuth({provider:"google",options:{redirectTo:window.location.origin}});w&&(ne(w.message),V(""))},dt=async()=>{V("auth"),gn(!1),await $n.auth.signOut(),V("")};H.useEffect(()=>{if(!xn)return;const w=Q=>{Q.target instanceof Element&&(Q.target.closest(".account-popover, .rail-account")||gn(!1))},P=Q=>{Q.key==="Escape"&&gn(!1)};return window.addEventListener("pointerdown",w),window.addEventListener("keydown",P),()=>{window.removeEventListener("pointerdown",w),window.removeEventListener("keydown",P)}},[xn]);const Fa=H.useCallback(async(w={})=>{const P=w.silent===!0,Q=w.takeover===!0,X=w.requestLocalAccess===!0,ue=X?await Jn():"";if(!i?.user){P||ne("Sign in before publishing this host.");return}if(!Pr.current){Pr.current=!0,P||V("host");try{const ae=ue||G||Ut,fe=T||await kn("/api/remote/status",void 0,ae);if(!fe.started)throw new Error("Start LiveDesk on this computer before syncing the server.");const Ve=`livedesk-${i.user.id}`,Le=await kn("/api/remote/host-target",{method:"POST",body:JSON.stringify({nodeId:Ve,leaseMs:6e4,takeover:Q})},ae);if(!Le.ok)throw new Error(Le.error||"host-target-failed");const at=await kn("/api/remote/status",void 0,ae),Pi=Le.hostTarget||{},kl=at.hostTargetEndpointCandidates||at.agentEndpointCandidates||fe.agentEndpointCandidates||[at.agentEndpoint||fe.agentEndpoint].filter(Boolean),{data:St,error:Dn}=await $n.rpc("set_livedesk_remote_host_target",{p_node_id:Ve,p_lease_id:String(Pi.leaseId||at.hostTargetLeaseId||crypto.randomUUID()),p_host_instance_id:at.hostInstanceId||Ve,p_endpoint:at.hostTargetEndpoint||at.agentEndpoint||fe.agentEndpoint,p_pair_token:at.pairToken||"",p_manager_package:"@livedesk/hub",p_manager_version:at.managerVersion||"0.1.0",p_agent_package:"@livedesk/client",p_activated_at:new Date().toISOString(),p_expires_at:new Date(Date.now()+6e4).toISOString(),p_takeover:Q,p_endpoint_candidates:kl});if(Dn)throw Dn;const Aa=Array.isArray(St)?St[0]:St;if(Aa&&Aa.ok===!1)throw new Error(Aa.reason||"registry-rejected");P||(ne("Host published."),(X||S)&&(p(!0),Tr(!0)),z()),c()}catch(ae){if(!P){const fe=ae instanceof Error?ae.message:String(ae);fe.includes("local network access")&&(p(!1),Tr(!1)),ne(fe)}}finally{Pr.current=!1,P||V("")}}},[G,S,z,c,Jn,i,T]);H.useEffect(()=>{if(!i?.user||!T?.started||C)return;const w=r?.expires_at?Date.parse(r.expires_at):Number.POSITIVE_INFINITY,P=r?.active===!0&&(!r.expires_at||!Number.isFinite(w)||w>Date.now()),Q=!!r?.host_instance_id&&!!T.hostInstanceId&&r.host_instance_id===T.hostInstanceId;if(P&&!Q)return;let X=!1;const ue=()=>{if(X)return;const fe=Date.now();fe-ba.current<25e3||(ba.current=fe,Fa({silent:!0}))};ue();const ae=window.setInterval(ue,3e4);return()=>{X=!0,window.clearInterval(ae)}},[C,Fa,i?.user?.id,T?.agentEndpoint,T?.hostInstanceId,T?.started,r?.active,r?.expires_at,r?.host_instance_id]);const Wn=H.useCallback(w=>{w&&(te(w),K(P=>P.includes(w)?P:[...P,w]))},[]),Ln=H.useCallback(w=>{if(!w)return;const P=De.find(X=>X.deviceId===w),Q=Vs(P?.slotNumber);te(w),Q>0&&Se(X=>X.filter(ue=>ue!==Q)),K(X=>X.includes(w)?X:[...X,w])},[De]),Qn=H.useCallback(w=>{!Number.isInteger(w)||w<1||w>bt||(te(""),Se(P=>P.includes(w)?P.filter(Q=>Q!==w):[...P,w].sort((Q,X)=>Q-X)))},[bt]),ei=H.useCallback(()=>{K([]),Se([]),te(""),Je(!1),ze(!1)},[]),Jr=H.useCallback(()=>{K([]),te(""),Je(!1),ze(!1),Se(Array.from({length:bt},(w,P)=>P+1))},[bt]),Xr=H.useCallback((w,P)=>{const Q=De.find(ue=>ue.deviceId===w);if(!Q)return;const X=Ti(Q);X<=1||(Ri(ue=>{const fe=(Rr(ue[w],X)+P+X)%X;return{...ue,[w]:fe}}),Wn(w))},[De,Wn]);H.useEffect(()=>{const w=P=>{const Q=P.target,X=Q?.tagName?.toLowerCase();Q?.isContentEditable||X==="input"||X==="textarea"||X==="select"||((P.ctrlKey||P.metaKey)&&P.key.toLowerCase()==="a"&&(P.preventDefault(),Jr()),P.key==="Escape"&&ei())};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[ei,Jr]);const ti=async w=>{if(!et){ne(jn);return}Wn(w);try{const P=De.find(Q=>Q.deviceId===w);await kn(`/api/remote/devices/${encodeURIComponent(w)}/live/start`,{method:"POST",body:JSON.stringify({fps:Ie,maxWidth:he.maxWidth,maxHeight:he.maxHeight,quality:he.quality,mode:he.frameMode,frameMode:he.frameMode,monitorIndex:Rr(Gn[w],P?Ti(P):1)})},G),ne("Live stream requested."),z()}catch(P){ne(P instanceof Error?P.message:String(P))}},ni=async w=>{if(Wn(w),J("control"),!et){Je(!1),ne(jn);return}Je(!0),await ti(w)},zi=async()=>{if(!se){ne("Select a workstation before playing audio.");return}if(!et){ne(jn);return}if(!Di){ne("Selected workstation does not report remote audio support yet.");return}const w=!Xe;ze(w);try{await kn(`/api/remote/devices/${encodeURIComponent(se.deviceId)}/audio/${w?"start":"stop"}`,{method:"POST",body:JSON.stringify({mimeType:"audio/webm;codecs=opus",sampleRate:48e3,channels:2})},G),ne(w?"Remote audio requested.":"Remote audio stopped.")}catch(P){ze(!1),ne(P instanceof Error?P.message:String(P))}},rn=async w=>{const P=Array.from(w).filter(ae=>ae.size>=0);if(P.length===0)return;if(!et){ne(jn);return}const Q=Rn.length>0?Rn.map(ae=>ae.deviceId):se?[se.deviceId]:[];if(Q.length===0){ne("Select at least one workstation before dropping files.");return}const X=P.reduce((ae,fe)=>ae+fe.size,0),ue=crypto.randomUUID();if(X>H_){Cn({id:ue,status:"failed",progress:100,message:`Transfer is too large (${Ai(X)}).`});return}Cn({id:ue,status:"reading",progress:2,message:`Preparing ${P.length} file${P.length===1?"":"s"}`});try{let ae=0;const fe=[];for(const Le of P){const at=await Le.arrayBuffer();ae+=Le.size,Cn({id:ue,status:"reading",progress:Math.max(4,Math.round(ae/Math.max(1,X)*58)),message:`Preparing ${Ai(ae)} / ${Ai(X)}`}),fe.push({name:Le.name,relativePath:Le.webkitRelativePath||Le.name,size:Le.size,type:Le.type,lastModified:Le.lastModified,dataBase64:W_(at)})}Cn({id:ue,status:"sending",progress:72,message:`Sending to ${Q.length} workstation${Q.length===1?"":"s"}`});const Ve=await kn("/api/remote/files/transfer",{method:"POST",body:JSON.stringify({transferId:ue,deviceIds:Q,remoteDirectory:va.trim(),files:fe})},G);if(!Ve.ok)throw new Error(Ve.error||"file-transfer-not-queued");Cn({id:ue,status:"queued",progress:100,message:`Queued ${P.length} file${P.length===1?"":"s"} to ${Ve.queued}/${Ve.total}`}),window.setTimeout(()=>{Cn(Le=>Le?.id===ue&&Le.status==="queued"?null:Le)},4500)}catch(ae){Cn({id:ue,status:"failed",progress:100,message:ae instanceof Error?ae.message:String(ae)})}},zt=w=>{w.preventDefault(),w.stopPropagation(),qr(!1),rn(w.dataTransfer.files)},vl=async()=>{const w=xe.trim();if(w){if(!et){ne(jn);return}V("task");try{await kn("/api/remote/tasks",{method:"POST",body:JSON.stringify({instruction:w,allConnected:!0,approvalLevel:"task-only"})},G),E(""),ne("Task queued."),z()}catch(P){ne(P instanceof Error?P.message:String(P))}finally{V("")}}},bl=async()=>{if(!i){ne("Sign in with Google before checkout.");return}if($){ne("LiveDesk license is already active.");return}V("checkout");try{const{data:w,error:P}=await $n.functions.invoke("dodo-checkout",{body:{plan:"ltd"}});if(P)throw P;if(!w?.checkout_url)throw new Error("Checkout function did not return a checkout URL.");window.location.assign(w.checkout_url)}catch(w){ne(w instanceof Error?w.message:String(w)),V("")}},yn=$_(),Wr=P_(),Bi=De.length,tc=Yt.filter(w=>Kr.has(w)).length,Lt=C?"offline":T?.started?"online":"starting",Ta=Rn.length+Ee.filter(w=>!De.some(P=>Vs(P.slotNumber)===w)).length,Sl=Ee.length===1?`Slot ${String(Ee[0]).padStart(3,"0")}`:`${Ee.length} slots selected`,Qr=Ta===0?"No workstation":Ta>1?`${Ta} selected`:se?nl(se):Sl,nt=Mr[ye]||Mr.en,ai=nt.sync||Mr.en.sync,Hi=n||O?"checking":$?`${(I?.plan||"ltd").toUpperCase()} active`:Gr?`Free ${De.length}/${_r}`:`Upgrade ${De.length}/${_r}`,ka=$?"Licensed":D==="checkout"?"Opening":"$30 LTD",wl=$?"License active":i?$?"Licensed":D==="checkout"?"Opening checkout":"Buy with Dodo":D==="auth"?"Opening Google":"Sign in to buy",_l=$||D==="checkout"||D==="auth"||n||O,qi=i?.user.user_metadata,$i=_p(qi,"avatar_url","picture"),ii=_p(qi,"full_name","name")||i?.user.email||"Google",ri=ii.slice(0,1).toUpperCase(),vn=T?.started?"Local app ready":"Start LiveDesk",Zr=r?.active?"Published":i?"Not published":"Sign in required",Fr=wd.find(w=>w.width===he.maxWidth&&w.height===he.maxHeight)?.id||`${he.maxWidth}x${he.maxHeight}`,Ea=qo.find(w=>w.id===he.frameMode)||qo[0],Dt=w=>{Oi(P=>{const Q=w.frameMode?$d(w.frameMode):P.frameMode,X=w.frameMode!==void 0&&Q!==P.frameMode;return{...P,...w,frameMode:Q,fps:w.fps??(X?ny(Q):P.fps)}})},Tl=w=>{const P=wd.find(Q=>Q.id===w);P&&Dt({maxWidth:P.width,maxHeight:P.height})},es=w=>{if(w==="control"){if(J(w),!et){Je(!1),ne(jn);return}Je(!0),se&&ti(se.deviceId);return}J(w),Je(!1)};return y.jsxs("main",{className:"app-shell",children:[y.jsxs("aside",{className:"tool-rail","aria-label":"LiveDesk tools",children:[y.jsx("div",{className:"rail-brand",title:"LiveDesk",children:y.jsx(jr,{size:22})}),y.jsx("nav",{className:"rail-tools",children:n1.map(w=>{const P=w.icon;return y.jsxs("button",{className:`rail-tool ${M===w.id?"active":""} accent-${w.accent}`,onClick:()=>es(w.id),title:w.label,type:"button",children:[y.jsx(P,{size:19}),y.jsx("span",{children:w.label})]},w.id)})}),y.jsxs("div",{className:"rail-footer",children:[y.jsxs("button",{className:"rail-tool compact sync-server",onClick:()=>Fa({takeover:!0,requestLocalAccess:!0}),title:"Sync Server",type:"button",children:[y.jsx(sd,{size:18}),y.jsx("span",{children:"Sync Server"})]}),y.jsxs("button",{className:`rail-tool compact local-settings ${xi?"active":""}`,onClick:()=>{Ci(w=>!w),gn(!1)},title:"Local Settings",type:"button",children:[y.jsx(Op,{size:18}),y.jsx("span",{children:"Settings"})]}),xi&&y.jsxs("section",{className:"local-settings-popover",role:"dialog","aria-label":"LiveDesk local settings",children:[y.jsxs("div",{className:"local-settings-head",children:[y.jsxs("div",{children:[y.jsx("strong",{children:"Local Settings"}),y.jsx("p",{children:"Saved on this browser"})]}),y.jsx("button",{className:"icon-button",onClick:()=>Ci(!1),title:"Close settings",type:"button",children:y.jsx(zg,{size:15})})]}),y.jsxs("label",{className:"local-setting-row",children:[y.jsx("span",{children:"Frame mode"}),y.jsx("select",{value:he.frameMode,onChange:w=>Dt({frameMode:$d(w.target.value)}),children:qo.map(w=>y.jsxs("option",{value:w.id,children:[w.label," - ",w.detail]},w.id))})]}),y.jsxs("div",{className:"local-setting-grid",children:[y.jsxs("label",{className:"local-setting-row",children:[y.jsx("span",{children:"FPS"}),y.jsx("select",{value:he.fps,onChange:w=>Dt({fps:Lr(w.target.value,1,24,tn.fps)}),children:Vd.map(w=>y.jsx("option",{value:w,children:w},w))})]}),y.jsxs("label",{className:"local-setting-row",children:[y.jsx("span",{children:"Size"}),y.jsx("select",{value:Fr,onChange:w=>Tl(w.target.value),children:wd.map(w=>y.jsx("option",{value:w.id,children:w.label},w.id))})]})]}),y.jsxs("label",{className:"local-setting-row",children:[y.jsx("span",{children:"Quality"}),y.jsx("select",{value:he.quality,onChange:w=>Dt({quality:Lr(w.target.value,20,95,tn.quality)}),children:q_.map(w=>y.jsx("option",{value:w,children:w},w))})]}),y.jsxs("label",{className:"local-setting-toggle",children:[y.jsx("input",{type:"checkbox",checked:he.autoStartLive,onChange:w=>Dt({autoStartLive:w.target.checked})}),y.jsx("span",{children:"Auto live on connected screens"})]}),y.jsxs("label",{className:"local-setting-toggle",children:[y.jsx("input",{type:"checkbox",checked:he.visibleOnlyLive,onChange:w=>Dt({visibleOnlyLive:w.target.checked})}),y.jsx("span",{children:"Stream visible tiles first"})]}),y.jsxs("label",{className:"local-setting-toggle",children:[y.jsx("input",{type:"checkbox",checked:he.adaptiveLoadShedding,onChange:w=>Dt({adaptiveLoadShedding:w.target.checked})}),y.jsx("span",{children:"Reduce FPS under load"})]}),y.jsxs("label",{className:"local-setting-toggle",children:[y.jsx("input",{type:"checkbox",checked:he.showScreenStatus,onChange:w=>Dt({showScreenStatus:w.target.checked})}),y.jsx("span",{children:"Screen status overlay"})]}),y.jsxs("div",{className:"local-settings-summary",children:[y.jsx("span",{children:Ea.label}),y.jsxs("strong",{children:[he.maxWidth,"x",he.maxHeight," / ",Ie,"fps"]})]}),y.jsx("button",{className:"local-settings-reset",onClick:()=>Oi(tn),type:"button",children:"Reset local settings"})]}),y.jsxs("button",{className:`rail-account ${i?"signed-in":""}`,onClick:()=>{gn(w=>!w),Ci(!1)},disabled:n||D==="auth","aria-expanded":xn,title:i?`Account: ${i.user.email||ii}`:"Sign in with Google",type:"button",children:[i?$i?y.jsx("img",{src:$i,alt:ii,referrerPolicy:"no-referrer"}):y.jsx("span",{className:"avatar-fallback",children:ri}):y.jsx(od,{size:18}),y.jsx("span",{children:i?"Account":"Google"})]}),xn&&y.jsxs("section",{className:"account-popover",role:"dialog","aria-label":"LiveDesk account",children:[y.jsxs("div",{className:"account-popover-head",children:[y.jsx("div",{className:"account-popover-avatar",children:i&&$i?y.jsx("img",{src:$i,alt:ii,referrerPolicy:"no-referrer"}):i?y.jsx("span",{children:ri}):y.jsx(od,{size:18})}),y.jsxs("div",{children:[y.jsx("strong",{children:i?ii:"Account"}),y.jsx("p",{children:i?.user.email||"Not signed in"})]})]}),y.jsxs("dl",{className:"account-popover-facts",children:[y.jsx("dt",{children:"User"}),y.jsx("dd",{children:i?.user.email||"Not signed in"}),y.jsx("dt",{children:"Network"}),y.jsx("dd",{children:vn}),y.jsx("dt",{children:"Access"}),y.jsx("dd",{children:Zr}),y.jsx("dt",{children:"Plan"}),y.jsx("dd",{children:Hi})]}),i?y.jsxs("button",{className:"account-popover-action",onClick:dt,disabled:D==="auth",type:"button",children:[y.jsx(H0,{size:16}),"Logout"]}):y.jsxs("button",{className:"account-popover-action primary",onClick:Xn,disabled:D==="auth",type:"button",children:[y.jsx(od,{size:16}),"Sign in with Google"]})]})]})]}),y.jsxs("section",{className:`desk-stage ${pl&&!Qe?"dock-open":""}`,children:[y.jsxs("header",{className:"topbar",children:[y.jsxs("div",{className:"brand",children:[y.jsx("span",{className:"brand-mark",children:y.jsx(Lg,{size:18})}),y.jsxs("div",{children:[y.jsx("h1",{children:"LiveDesk"}),y.jsx("p",{children:"Control wall for local machines"})]})]}),pl&&y.jsx("div",{className:"top-actions",children:y.jsx("div",{className:"segmented-control","aria-label":"Screen size",children:t1.map(w=>y.jsx("button",{className:Z===w.id?"active":"",onClick:()=>ge(w.id),type:"button",children:w.label},w.id))})})]}),gl?y.jsxs("section",{className:"doc-page",lang:ye,dir:ye==="ar"?"rtl":"ltr",children:[y.jsxs("section",{className:"doc-hero",children:[y.jsxs("div",{className:"doc-hero-copy",children:[y.jsxs("span",{className:"pricing-eyebrow",children:[y.jsx(Ad,{size:16}),nt.eyebrow]}),y.jsx("h2",{children:nt.title}),y.jsx("p",{children:nt.intro})]}),y.jsxs("label",{className:"doc-language-picker",children:[y.jsxs("span",{children:[y.jsx(D0,{size:17}),nt.languageLabel]}),y.jsx("select",{value:ye,onChange:w=>Oe(w.target.value),children:a1.map(w=>y.jsx("option",{value:w.id,children:w.label},w.id))})]})]}),y.jsx("section",{className:"doc-grid",children:nt.sections.map((w,P)=>{const X=[dd,Ar,Cp,Ug][P]||Ad;return y.jsxs("article",{className:"doc-card",children:[y.jsx("div",{className:"doc-card-icon",children:y.jsx(X,{size:19})}),y.jsxs("div",{children:[y.jsx("h3",{children:w.title}),y.jsx("p",{children:w.body}),y.jsx("ul",{children:w.points.map(ue=>y.jsx("li",{children:ue},ue))})]})]},w.title)})}),ai&&y.jsxs("section",{className:"doc-sync",children:[y.jsxs("div",{className:"doc-sync-head",children:[y.jsx(sd,{size:20}),y.jsxs("div",{children:[y.jsx("h3",{children:ai.title}),y.jsx("p",{children:ai.body})]})]}),y.jsx("ul",{children:ai.points.map(w=>y.jsx("li",{children:w},w))})]}),y.jsxs("section",{className:"doc-firewall",children:[y.jsxs("div",{className:"doc-firewall-head",children:[y.jsx(Dg,{size:20}),y.jsxs("div",{children:[y.jsx("h3",{children:nt.firewall.title}),y.jsx("p",{children:nt.firewall.body})]})]}),y.jsx("ul",{children:nt.firewall.points.map(w=>y.jsx("li",{children:w},w))})]}),y.jsxs("section",{className:"doc-command-panel",children:[y.jsxs("div",{className:"doc-command-head",children:[y.jsx(Ar,{size:20}),y.jsxs("div",{children:[y.jsx("h3",{children:nt.commands.title}),y.jsx("p",{children:nt.commands.body})]})]}),y.jsxs("div",{className:"doc-command-list",children:[nt.commands.manager&&y.jsxs("div",{className:"doc-command-row",children:[y.jsx("span",{children:nt.commands.manager}),y.jsx("code",{children:Wr}),y.jsx("button",{className:"icon-button",onClick:()=>Gs(Wr),title:"Copy command",type:"button",children:y.jsx(Ps,{size:16})})]}),y.jsxs("div",{className:"doc-command-row",children:[y.jsx("span",{children:nt.commands.primary}),y.jsx("code",{children:yn}),y.jsx("button",{className:"icon-button",onClick:()=>Gs(yn),title:"Copy command",type:"button",children:y.jsx(Ps,{size:16})})]}),y.jsxs("div",{className:"doc-command-row",children:[y.jsx("span",{children:nt.commands.slot}),y.jsx("code",{children:`${yn} 3`}),y.jsx("button",{className:"icon-button",onClick:()=>Gs(`${yn} 3`),title:"Copy command",type:"button",children:y.jsx(Ps,{size:16})})]})]})]})]}):ml?y.jsxs("section",{className:"pricing-page",children:[(Y||le)&&y.jsx("section",{className:"notice-band",children:Y||le}),y.jsxs("section",{className:"pricing-offer",children:[y.jsx("button",{className:"pricing-close",onClick:()=>J("wall"),title:"Close pricing",type:"button",children:y.jsx(zg,{size:18})}),y.jsxs("div",{className:"pricing-offer-head",children:[y.jsxs("span",{className:"pricing-eyebrow",children:[y.jsx(Z0,{size:15}),"Founder launch"]}),y.jsxs("div",{className:"deal-price-line",children:[y.jsx("span",{className:"deal-original",children:"$59"}),y.jsx("span",{className:"deal-arrow",children:"→"}),y.jsx("strong",{children:"$30"}),y.jsxs("span",{className:"deal-badge",children:[y.jsx(k0,{size:15}),"Lifetime deal"]})]}),y.jsx("p",{children:"Monitor and control your local workstation wall. Free for 4 PCs, then unlock larger local setups with one payment."})]}),y.jsxs("div",{className:"deal-table",role:"table","aria-label":"LiveDesk launch pricing",children:[y.jsxs("div",{className:"deal-row deal-row-head",role:"row",children:[y.jsx("span",{role:"columnheader",children:"Plan"}),y.jsx("span",{role:"columnheader",children:"Launch benefit"}),y.jsx("span",{role:"columnheader",children:"Now"})]}),y.jsxs("div",{className:"deal-row deal-row-highlight",role:"row",children:[y.jsx("strong",{role:"cell",children:"Founder LTD"}),y.jsxs("span",{role:"cell",children:[y.jsx("s",{children:"$59"})," local lifetime unlock"]}),y.jsx("strong",{role:"cell",children:"$30"})]}),y.jsxs("div",{className:"deal-row",role:"row",children:[y.jsx("strong",{role:"cell",children:"Free"}),y.jsx("span",{role:"cell",children:"Live, control, audio, files, tasks"}),y.jsx("strong",{role:"cell",children:"$0"})]}),y.jsxs("div",{className:"deal-row",role:"row",children:[y.jsx("strong",{role:"cell",children:"Workstations"}),y.jsx("span",{role:"cell",children:"4 free, larger walls with LTD"}),y.jsxs("strong",{role:"cell",children:[De.length,"/",_r]})]}),y.jsxs("div",{className:"deal-row",role:"row",children:[y.jsx("strong",{role:"cell",children:"Future monthly"}),y.jsx("span",{role:"cell",children:"Cloud relay and team features later"}),y.jsx("strong",{role:"cell",children:"separate"})]})]}),y.jsxs("section",{className:"deal-module",children:[y.jsxs("div",{className:"deal-module-title",children:[y.jsx("strong",{children:"LiveDesk includes"}),y.jsx("span",{children:Hi})]}),y.jsxs("ul",{className:"deal-feature-list",children:[y.jsxs("li",{children:[y.jsx(jr,{size:16}),y.jsx("span",{children:"Screen wall slots"}),y.jsx("b",{children:"120+"})]}),y.jsxs("li",{children:[y.jsx(Cd,{size:16}),y.jsx("span",{children:"Focused control"}),y.jsx("b",{children:"Local"})]}),y.jsxs("li",{children:[y.jsx(Mg,{size:16}),y.jsx("span",{children:"Remote PC audio"}),y.jsx("b",{children:"PCM"})]}),y.jsxs("li",{children:[y.jsx(ld,{size:16}),y.jsx("span",{children:"File transfer"}),y.jsx("b",{children:"24MB"})]})]})]}),y.jsxs("section",{className:"deal-open-price",children:[y.jsx("span",{children:"Opening special price"}),y.jsx("strong",{children:"$30 LTD"}),y.jsx("small",{children:"Early buyers keep this local lifetime license after monthly plans arrive."})]}),y.jsxs("p",{className:"deal-note",children:[y.jsx(O0,{size:15}),"Free plan stays available for up to ",_r," local workstations."]}),y.jsxs("button",{className:"deal-cta",onClick:i?bl:Xn,disabled:_l,type:"button",children:[y.jsx(xd,{size:18}),wl]}),y.jsx("button",{className:"deal-later",onClick:()=>J("wall"),type:"button",children:"Later"})]})]}):y.jsx(y.Fragment,{children:y.jsxs("section",{className:`monitor-layout ${Qe?"dock-collapsed":""}`,children:[y.jsx("section",{ref:$r,className:`screen-wall-panel ${Ni?"drop-active":""}`,onClick:w=>{w.currentTarget===w.target&&ei()},onDragEnter:w=>{w.preventDefault(),qr(!0)},onDragOver:w=>{w.preventDefault(),w.dataTransfer.dropEffect="copy"},onDragLeave:w=>{w.currentTarget===w.target&&qr(!1)},onDrop:zt,children:On?y.jsxs("section",{className:"control-focus",children:[y.jsxs("div",{className:"control-focus-head",children:[y.jsxs("div",{children:[y.jsx("span",{children:"Focused control"}),y.jsx("strong",{children:se?nl(se):"No workstation"})]}),y.jsxs("button",{className:"text-button",onClick:()=>se&&ti(se.deviceId),disabled:!Mi,type:"button",children:[y.jsx(cd,{size:16}),"Start live"]})]}),y.jsx("div",{className:"screen-wall control-wall",onClick:w=>{w.currentTarget===w.target&&ei()},children:se?y.jsx(kp,{device:se,frame:Kr.get(se.deviceId),selected:!0,controlEnabled:Za&&Ce,showStatus:he.showScreenStatus,monitorIndex:Rr(Gn[se.deviceId],Ti(se)),monitorCount:Ti(se),onSelect:()=>Ln(se.deviceId),onFocusDevice:()=>Wn(se.deviceId),onOpenControl:()=>ni(se.deviceId),onCycleMonitor:w=>Xr(se.deviceId,w),sendInput:Ui},se.deviceId):y.jsx(Tp,{index:0,selected:wa.has(1),onSelect:()=>Qn(1)})})]}):y.jsx("div",{className:`screen-wall size-${Z}`,onClick:w=>{w.currentTarget===w.target&&ei()},children:Vn.map((w,P)=>{const Q=P+1;return w?y.jsx(kp,{device:w,frame:Kr.get(w.deviceId),selected:Ir.has(w.deviceId)||wa.has(Q),controlEnabled:Za&&Ce&&se?.deviceId===w.deviceId,showStatus:he.showScreenStatus,monitorIndex:Rr(Gn[w.deviceId],Ti(w)),monitorCount:Ti(w),onSelect:()=>Ln(w.deviceId),onFocusDevice:()=>Wn(w.deviceId),onOpenControl:()=>ni(w.deviceId),onCycleMonitor:X=>Xr(w.deviceId,X),sendInput:Ui},w.deviceId):y.jsx(Tp,{index:P,selected:wa.has(Q),onSelect:()=>Qn(Q)},`slot-${P}`)})})}),y.jsxs("aside",{className:`right-dock ${Ot?"settings-mode":"actions-mode"} ${Qe?"collapsed":""}`,"aria-label":"LiveDesk tools",children:[y.jsx("button",{className:"dock-toggle",onClick:()=>Ze(w=>!w),"aria-label":Qe?"Show control panel":"Hide control panel",title:Qe?"Show control panel":"Hide control panel",type:"button",children:Qe?y.jsx(Ap,{size:18}):y.jsx(xp,{size:18})}),!Qe&&(Ot?y.jsxs(y.Fragment,{children:[(C||l||Y||le)&&y.jsx("section",{className:"notice-band",children:C||l||Y||le}),y.jsxs("section",{className:"command-deck",children:[y.jsxs("div",{className:"setup-card",children:[y.jsxs("div",{className:"setup-head",children:[y.jsx("span",{className:"setup-icon",children:y.jsx(jr,{size:18})}),y.jsxs("div",{children:[y.jsx("strong",{children:"Add workstation"}),y.jsx("span",{children:"Connect another local PC to this wall."})]})]}),y.jsxs("button",{className:"text-button primary full",onClick:()=>Gs(yn),type:"button",children:[y.jsx(Ps,{size:16}),"Copy setup"]}),y.jsxs("button",{className:"setup-disclosure",onClick:()=>zr(w=>!w),type:"button",children:[y.jsx(Ar,{size:15}),"Advanced setup"]}),In&&y.jsxs("div",{className:"setup-code-row",children:[y.jsx("code",{children:yn}),y.jsx("button",{className:"icon-button",onClick:()=>Gs(yn),title:"Copy setup command",type:"button",children:y.jsx(Ps,{size:16})})]})]}),y.jsxs("div",{className:"settings-card",children:[y.jsxs("div",{className:"panel-title",children:[y.jsx(ld,{size:17}),y.jsx("h2",{children:"Files"})]}),y.jsxs("label",{className:"field-row",children:[y.jsx("span",{children:"Remote folder"}),y.jsx("input",{value:va,onChange:w=>ec(w.target.value),placeholder:"Desktop/LiveDeskFiles"})]}),y.jsx("p",{className:"muted",children:"Blank uses Desktop/LiveDeskFiles on each workstation."})]}),y.jsxs("div",{className:"deck-actions",children:[y.jsxs("button",{className:"text-button primary",onClick:()=>Fa({takeover:!0,requestLocalAccess:!0}),disabled:!i||D==="host",type:"button",children:[y.jsx(sd,{size:16}),"Sync access"]}),y.jsxs("button",{className:"text-button buy",onClick:bl,disabled:D==="checkout"||$,type:"button",children:[y.jsx(xd,{size:16}),ka]})]})]}),y.jsxs("section",{className:"status-strip",children:[y.jsxs("div",{className:`status-item state-${Lt}`,children:[y.jsx(dd,{size:18}),y.jsx("span",{children:"Local app"}),y.jsx("strong",{children:Lt})]}),y.jsxs("div",{className:"status-item",children:[y.jsx(Ug,{size:18}),y.jsx("span",{children:"Slots"}),y.jsxs("strong",{children:[Bi,"/",bt]})]}),y.jsxs("div",{className:"status-item",children:[y.jsx(Lg,{size:18}),y.jsx("span",{children:"Frames"}),y.jsxs("strong",{children:[tc," ",Yr]})]}),y.jsxs("div",{className:"status-item",children:[y.jsx(Dg,{size:18}),y.jsx("span",{children:"Plan"}),y.jsx("strong",{children:Hi})]})]})]}):y.jsxs(y.Fragment,{children:[y.jsxs("section",{className:"action-dock",children:[y.jsxs("div",{className:"action-context",children:[y.jsx("span",{children:Ta>0?"Selection":"No selection"}),y.jsx("strong",{children:Qr})]}),y.jsx("input",{ref:fl,className:"hidden-file-input",type:"file",multiple:!0,onChange:w=>{w.currentTarget.files&&rn(w.currentTarget.files),w.currentTarget.value=""}}),(C||le)&&y.jsx("div",{className:"notice-band compact",children:y.jsx("span",{children:C||le})}),y.jsxs("div",{className:"action-grid",children:[y.jsxs("button",{className:"action-tile primary",onClick:()=>se&&ti(se.deviceId),disabled:!Mi,type:"button",children:[y.jsx(cd,{size:21}),y.jsx("span",{children:"Live"})]}),y.jsxs("button",{className:`action-tile ${Ce?"active":""}`,onClick:()=>Je(w=>!w),disabled:!Za,type:"button",children:[y.jsx(Cd,{size:21}),y.jsx("span",{children:_a!=="idle"?_a:"Control"})]}),y.jsxs("button",{className:`action-tile ${Xe?"active":""}`,onClick:zi,disabled:!pn,type:"button",title:Di?"Remote PC audio":"Remote audio is not supported by this workstation yet",children:[y.jsx(Mg,{size:21}),y.jsx("span",{children:Xe&&Kn!=="idle"?Kn:"Audio"})]}),y.jsxs("button",{className:"action-tile",onClick:()=>fl.current?.click(),disabled:!et||Rn.length===0,type:"button",title:"File transfer",children:[y.jsx(ld,{size:21}),y.jsx("span",{children:"Files"})]}),y.jsxs("button",{className:"action-tile",disabled:!0,type:"button",title:"Reboot",children:[y.jsx(K0,{size:21}),y.jsx("span",{children:"Reboot"})]}),y.jsxs("button",{className:"action-tile",disabled:!0,type:"button",title:"Power",children:[y.jsx(G0,{size:21}),y.jsx("span",{children:"Power"})]}),y.jsxs("button",{className:"action-tile",disabled:!0,type:"button",title:"Terminal",children:[y.jsx(Ar,{size:21}),y.jsx("span",{children:"Shell"})]})]})]}),se&&an&&y.jsxs("section",{className:"side-panel selected-panel",children:[y.jsxs("div",{className:"machine-detail-head",children:[y.jsxs("div",{className:"panel-title",children:[y.jsx(jr,{size:17}),y.jsx("h2",{children:"Machine detail"})]}),y.jsx("span",{className:`machine-health state-${an.state}`,children:an.label})]}),y.jsxs("div",{className:"machine-title",children:[y.jsx("strong",{children:nl(se)}),y.jsx("span",{children:an.role})]}),y.jsx("div",{className:"machine-metric-grid",children:an.metrics.map(w=>y.jsxs("article",{className:`machine-metric state-${w.state}`,children:[y.jsx("span",{children:w.label}),y.jsx("strong",{children:w.value}),y.jsx("small",{children:w.detail}),w.ratio!==void 0&&y.jsx("i",{children:y.jsx("b",{style:{width:`${Math.round(w.ratio*100)}%`}})})]},w.id))}),y.jsxs("section",{className:"machine-section",children:[y.jsxs("div",{className:"machine-section-title",children:[y.jsx(Ar,{size:15}),y.jsx("span",{children:"Local services"})]}),y.jsx("div",{className:"tool-probe-list",children:an.tools.map(w=>y.jsxs("span",{className:`tool-probe state-${w.status}`,children:[y.jsx("b",{children:w.label}),y.jsx("em",{children:w.detail})]},w.id))})]}),y.jsxs("section",{className:"machine-section",children:[y.jsxs("div",{className:"machine-section-title",children:[y.jsx(ud,{size:15}),y.jsx("span",{children:"Workload"})]}),y.jsxs("div",{className:"workload-card",children:[y.jsx("strong",{children:an.taskLabel}),y.jsx("span",{children:an.taskStatus}),an.taskSummary&&y.jsx("p",{children:an.taskSummary})]})]}),y.jsxs("div",{className:"machine-section",children:[y.jsxs("div",{className:"machine-section-title",children:[y.jsx(dd,{size:15}),y.jsx("span",{children:"System"})]}),y.jsxs("dl",{className:"facts compact",children:[y.jsx("dt",{children:"Platform"}),y.jsxs("dd",{children:[se.platform||"-"," ",se.arch||""]}),y.jsx("dt",{children:"Release"}),y.jsx("dd",{children:Vt(se.status,"release")||"-"}),y.jsx("dt",{children:"Uptime"}),y.jsx("dd",{children:ay(Fe(se.status,"uptimeSec"))}),y.jsx("dt",{children:"Last seen"}),y.jsx("dd",{children:E_(se.lastSeenAt||se.connectedAt)}),y.jsx("dt",{children:"Agent"}),y.jsx("dd",{children:se.agentVersion||"-"}),y.jsx("dt",{children:"Address"}),y.jsx("dd",{children:se.remoteAddress||"-"})]})]}),Yn&&y.jsx("p",{className:"panel-warning",children:Yn}),y.jsxs("button",{className:"text-button full",onClick:()=>se&&ti(se.deviceId),disabled:!Mi,type:"button",children:[y.jsx(cd,{size:16}),"Start live"]})]}),y.jsxs("section",{className:"side-panel task-panel",children:[y.jsxs("div",{className:"panel-title",children:[y.jsx(ud,{size:17}),y.jsx("h2",{children:"Task"})]}),y.jsx("textarea",{value:xe,onChange:w=>E(w.target.value),placeholder:"Prepare a short status report.",rows:4}),y.jsxs("button",{className:"text-button full primary",onClick:vl,disabled:D==="task"||!xe.trim()||!et,type:"button",children:[y.jsx(ud,{size:16}),"Send to connected"]})]})]}))]})]})})]}),Qa&&y.jsxs("aside",{className:`transfer-bar state-${Qa.status}`,"aria-live":"polite",children:[y.jsx("div",{className:"transfer-bar-track",children:y.jsx("span",{style:{width:`${Math.max(0,Math.min(100,Qa.progress))}%`}})}),y.jsx("p",{children:Qa.message})]})]})}p0.createRoot(document.getElementById("root")).render(y.jsx(H.StrictMode,{children:y.jsx(r1,{})}));