const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index.esm-OyK67d2L.js","./index.esm2017-opiC1jOd.js","./index.esm-CmzND2QD.js","./DiceBoard.component-A_WKEx_L.js","./DiceBoard-CJ3uYzGw.css"])))=>i.map(i=>d[i]);
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))n(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(a){if(a.ep)return;a.ep=!0;const i=r(a);fetch(a.href,i)}})();var MSe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Sg(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function jSe(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var r=function n(){var a=!1;try{a=this instanceof n}catch{}return a?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var a=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,a.get?a:{enumerable:!0,get:function(){return t[n]}})}),r}var Sw={exports:{}},wh={};/**
 * @license React
 * react-jsx-runtime.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var PD;function J8(){if(PD)return wh;PD=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function r(n,a,i){var o=null;if(i!==void 0&&(o=""+i),a.key!==void 0&&(o=""+a.key),"key"in a){i={};for(var c in a)c!=="key"&&(i[c]=a[c])}else i=a;return a=i.ref,{$$typeof:t,type:n,key:o,ref:a!==void 0?a:null,props:i}}return wh.Fragment=e,wh.jsx=r,wh.jsxs=r,wh}var AD;function Q8(){return AD||(AD=1,Sw.exports=J8()),Sw.exports}var g=Q8(),Ew={exports:{}},rr={};/**
 * @license React
 * react.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var RD;function Z8(){if(RD)return rr;RD=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),o=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),h=Symbol.for("react.activity"),m=Symbol.iterator;function _(B){return B===null||typeof B!="object"?null:(B=m&&B[m]||B["@@iterator"],typeof B=="function"?B:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,E={};function T(B,K,ae){this.props=B,this.context=K,this.refs=E,this.updater=ae||w}T.prototype.isReactComponent={},T.prototype.setState=function(B,K){if(typeof B!="object"&&typeof B!="function"&&B!=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,B,K,"setState")},T.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function D(){}D.prototype=T.prototype;function P(B,K,ae){this.props=B,this.context=K,this.refs=E,this.updater=ae||w}var A=P.prototype=new D;A.constructor=P,b(A,T.prototype),A.isPureReactComponent=!0;var C=Array.isArray;function O(){}var I={H:null,A:null,T:null,S:null},x=Object.prototype.hasOwnProperty;function R(B,K,ae){var te=ae.ref;return{$$typeof:t,type:B,key:K,ref:te!==void 0?te:null,props:ae}}function N(B,K){return R(B.type,K,B.props)}function L(B){return typeof B=="object"&&B!==null&&B.$$typeof===t}function j(B){var K={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(ae){return K[ae]})}var q=/\/+/g;function U(B,K){return typeof B=="object"&&B!==null&&B.key!=null?j(""+B.key):K.toString(36)}function W(B){switch(B.status){case"fulfilled":return B.value;case"rejected":throw B.reason;default:switch(typeof B.status=="string"?B.then(O,O):(B.status="pending",B.then(function(K){B.status==="pending"&&(B.status="fulfilled",B.value=K)},function(K){B.status==="pending"&&(B.status="rejected",B.reason=K)})),B.status){case"fulfilled":return B.value;case"rejected":throw B.reason}}throw B}function F(B,K,ae,te,me){var ue=typeof B;(ue==="undefined"||ue==="boolean")&&(B=null);var Ae=!1;if(B===null)Ae=!0;else switch(ue){case"bigint":case"string":case"number":Ae=!0;break;case"object":switch(B.$$typeof){case t:case e:Ae=!0;break;case f:return Ae=B._init,F(Ae(B._payload),K,ae,te,me)}}if(Ae)return me=me(B),Ae=te===""?"."+U(B,0):te,C(me)?(ae="",Ae!=null&&(ae=Ae.replace(q,"$&/")+"/"),F(me,K,ae,"",function(xe){return xe})):me!=null&&(L(me)&&(me=N(me,ae+(me.key==null||B&&B.key===me.key?"":(""+me.key).replace(q,"$&/")+"/")+Ae)),K.push(me)),1;Ae=0;var He=te===""?".":te+":";if(C(B))for(var ce=0;ce<B.length;ce++)te=B[ce],ue=He+U(te,ce),Ae+=F(te,K,ae,ue,me);else if(ce=_(B),typeof ce=="function")for(B=ce.call(B),ce=0;!(te=B.next()).done;)te=te.value,ue=He+U(te,ce++),Ae+=F(te,K,ae,ue,me);else if(ue==="object"){if(typeof B.then=="function")return F(W(B),K,ae,te,me);throw K=String(B),Error("Objects are not valid as a React child (found: "+(K==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":K)+"). If you meant to render a collection of children, use an array instead.")}return Ae}function Y(B,K,ae){if(B==null)return B;var te=[],me=0;return F(B,te,"","",function(ue){return K.call(ae,ue,me++)}),te}function Q(B){if(B._status===-1){var K=B._result;K=K(),K.then(function(ae){(B._status===0||B._status===-1)&&(B._status=1,B._result=ae)},function(ae){(B._status===0||B._status===-1)&&(B._status=2,B._result=ae)}),B._status===-1&&(B._status=0,B._result=K)}if(B._status===1)return B._result.default;throw B._result}var ie=typeof reportError=="function"?reportError:function(B){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var K=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof B=="object"&&B!==null&&typeof B.message=="string"?String(B.message):String(B),error:B});if(!window.dispatchEvent(K))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",B);return}},G={map:Y,forEach:function(B,K,ae){Y(B,function(){K.apply(this,arguments)},ae)},count:function(B){var K=0;return Y(B,function(){K++}),K},toArray:function(B){return Y(B,function(K){return K})||[]},only:function(B){if(!L(B))throw Error("React.Children.only expected to receive a single React element child.");return B}};return rr.Activity=h,rr.Children=G,rr.Component=T,rr.Fragment=r,rr.Profiler=a,rr.PureComponent=P,rr.StrictMode=n,rr.Suspense=u,rr.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=I,rr.__COMPILER_RUNTIME={__proto__:null,c:function(B){return I.H.useMemoCache(B)}},rr.cache=function(B){return function(){return B.apply(null,arguments)}},rr.cacheSignal=function(){return null},rr.cloneElement=function(B,K,ae){if(B==null)throw Error("The argument must be a React element, but you passed "+B+".");var te=b({},B.props),me=B.key;if(K!=null)for(ue in K.key!==void 0&&(me=""+K.key),K)!x.call(K,ue)||ue==="key"||ue==="__self"||ue==="__source"||ue==="ref"&&K.ref===void 0||(te[ue]=K[ue]);var ue=arguments.length-2;if(ue===1)te.children=ae;else if(1<ue){for(var Ae=Array(ue),He=0;He<ue;He++)Ae[He]=arguments[He+2];te.children=Ae}return R(B.type,me,te)},rr.createContext=function(B){return B={$$typeof:o,_currentValue:B,_currentValue2:B,_threadCount:0,Provider:null,Consumer:null},B.Provider=B,B.Consumer={$$typeof:i,_context:B},B},rr.createElement=function(B,K,ae){var te,me={},ue=null;if(K!=null)for(te in K.key!==void 0&&(ue=""+K.key),K)x.call(K,te)&&te!=="key"&&te!=="__self"&&te!=="__source"&&(me[te]=K[te]);var Ae=arguments.length-2;if(Ae===1)me.children=ae;else if(1<Ae){for(var He=Array(Ae),ce=0;ce<Ae;ce++)He[ce]=arguments[ce+2];me.children=He}if(B&&B.defaultProps)for(te in Ae=B.defaultProps,Ae)me[te]===void 0&&(me[te]=Ae[te]);return R(B,ue,me)},rr.createRef=function(){return{current:null}},rr.forwardRef=function(B){return{$$typeof:c,render:B}},rr.isValidElement=L,rr.lazy=function(B){return{$$typeof:f,_payload:{_status:-1,_result:B},_init:Q}},rr.memo=function(B,K){return{$$typeof:d,type:B,compare:K===void 0?null:K}},rr.startTransition=function(B){var K=I.T,ae={};I.T=ae;try{var te=B(),me=I.S;me!==null&&me(ae,te),typeof te=="object"&&te!==null&&typeof te.then=="function"&&te.then(O,ie)}catch(ue){ie(ue)}finally{K!==null&&ae.types!==null&&(K.types=ae.types),I.T=K}},rr.unstable_useCacheRefresh=function(){return I.H.useCacheRefresh()},rr.use=function(B){return I.H.use(B)},rr.useActionState=function(B,K,ae){return I.H.useActionState(B,K,ae)},rr.useCallback=function(B,K){return I.H.useCallback(B,K)},rr.useContext=function(B){return I.H.useContext(B)},rr.useDebugValue=function(){},rr.useDeferredValue=function(B,K){return I.H.useDeferredValue(B,K)},rr.useEffect=function(B,K){return I.H.useEffect(B,K)},rr.useEffectEvent=function(B){return I.H.useEffectEvent(B)},rr.useId=function(){return I.H.useId()},rr.useImperativeHandle=function(B,K,ae){return I.H.useImperativeHandle(B,K,ae)},rr.useInsertionEffect=function(B,K){return I.H.useInsertionEffect(B,K)},rr.useLayoutEffect=function(B,K){return I.H.useLayoutEffect(B,K)},rr.useMemo=function(B,K){return I.H.useMemo(B,K)},rr.useOptimistic=function(B,K){return I.H.useOptimistic(B,K)},rr.useReducer=function(B,K,ae){return I.H.useReducer(B,K,ae)},rr.useRef=function(B){return I.H.useRef(B)},rr.useState=function(B){return I.H.useState(B)},rr.useSyncExternalStore=function(B,K,ae){return I.H.useSyncExternalStore(B,K,ae)},rr.useTransition=function(){return I.H.useTransition()},rr.version="19.2.0",rr}var DD;function ox(){return DD||(DD=1,Ew.exports=Z8()),Ew.exports}var v=ox();const Tt=Sg(v);var Tw={exports:{}},Sh={},Cw={exports:{}},xw={};/**
 * @license React
 * scheduler.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var OD;function eV(){return OD||(OD=1,(function(t){function e(F,Y){var Q=F.length;F.push(Y);e:for(;0<Q;){var ie=Q-1>>>1,G=F[ie];if(0<a(G,Y))F[ie]=Y,F[Q]=G,Q=ie;else break e}}function r(F){return F.length===0?null:F[0]}function n(F){if(F.length===0)return null;var Y=F[0],Q=F.pop();if(Q!==Y){F[0]=Q;e:for(var ie=0,G=F.length,B=G>>>1;ie<B;){var K=2*(ie+1)-1,ae=F[K],te=K+1,me=F[te];if(0>a(ae,Q))te<G&&0>a(me,ae)?(F[ie]=me,F[te]=Q,ie=te):(F[ie]=ae,F[K]=Q,ie=K);else if(te<G&&0>a(me,Q))F[ie]=me,F[te]=Q,ie=te;else break e}}return Y}function a(F,Y){var Q=F.sortIndex-Y.sortIndex;return Q!==0?Q:F.id-Y.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var o=Date,c=o.now();t.unstable_now=function(){return o.now()-c}}var u=[],d=[],f=1,h=null,m=3,_=!1,w=!1,b=!1,E=!1,T=typeof setTimeout=="function"?setTimeout:null,D=typeof clearTimeout=="function"?clearTimeout:null,P=typeof setImmediate<"u"?setImmediate:null;function A(F){for(var Y=r(d);Y!==null;){if(Y.callback===null)n(d);else if(Y.startTime<=F)n(d),Y.sortIndex=Y.expirationTime,e(u,Y);else break;Y=r(d)}}function C(F){if(b=!1,A(F),!w)if(r(u)!==null)w=!0,O||(O=!0,j());else{var Y=r(d);Y!==null&&W(C,Y.startTime-F)}}var O=!1,I=-1,x=5,R=-1;function N(){return E?!0:!(t.unstable_now()-R<x)}function L(){if(E=!1,O){var F=t.unstable_now();R=F;var Y=!0;try{e:{w=!1,b&&(b=!1,D(I),I=-1),_=!0;var Q=m;try{t:{for(A(F),h=r(u);h!==null&&!(h.expirationTime>F&&N());){var ie=h.callback;if(typeof ie=="function"){h.callback=null,m=h.priorityLevel;var G=ie(h.expirationTime<=F);if(F=t.unstable_now(),typeof G=="function"){h.callback=G,A(F),Y=!0;break t}h===r(u)&&n(u),A(F)}else n(u);h=r(u)}if(h!==null)Y=!0;else{var B=r(d);B!==null&&W(C,B.startTime-F),Y=!1}}break e}finally{h=null,m=Q,_=!1}Y=void 0}}finally{Y?j():O=!1}}}var j;if(typeof P=="function")j=function(){P(L)};else if(typeof MessageChannel<"u"){var q=new MessageChannel,U=q.port2;q.port1.onmessage=L,j=function(){U.postMessage(null)}}else j=function(){T(L,0)};function W(F,Y){I=T(function(){F(t.unstable_now())},Y)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(F){F.callback=null},t.unstable_forceFrameRate=function(F){0>F||125<F||(x=0<F?Math.floor(1e3/F):5)},t.unstable_getCurrentPriorityLevel=function(){return m},t.unstable_next=function(F){switch(m){case 1:case 2:case 3:var Y=3;break;default:Y=m}var Q=m;m=Y;try{return F()}finally{m=Q}},t.unstable_requestPaint=function(){E=!0},t.unstable_runWithPriority=function(F,Y){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var Q=m;m=F;try{return Y()}finally{m=Q}},t.unstable_scheduleCallback=function(F,Y,Q){var ie=t.unstable_now();switch(typeof Q=="object"&&Q!==null?(Q=Q.delay,Q=typeof Q=="number"&&0<Q?ie+Q:ie):Q=ie,F){case 1:var G=-1;break;case 2:G=250;break;case 5:G=1073741823;break;case 4:G=1e4;break;default:G=5e3}return G=Q+G,F={id:f++,callback:Y,priorityLevel:F,startTime:Q,expirationTime:G,sortIndex:-1},Q>ie?(F.sortIndex=Q,e(d,F),r(u)===null&&F===r(d)&&(b?(D(I),I=-1):b=!0,W(C,Q-ie))):(F.sortIndex=G,e(u,F),w||_||(w=!0,O||(O=!0,j()))),F},t.unstable_shouldYield=N,t.unstable_wrapCallback=function(F){var Y=m;return function(){var Q=m;m=Y;try{return F.apply(this,arguments)}finally{m=Q}}}})(xw)),xw}var ND;function tV(){return ND||(ND=1,Cw.exports=eV()),Cw.exports}var Pw={exports:{}},Na={};/**
 * @license React
 * react-dom.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var ID;function rV(){if(ID)return Na;ID=1;var t=ox();function e(u){var d="https://react.dev/errors/"+u;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var f=2;f<arguments.length;f++)d+="&args[]="+encodeURIComponent(arguments[f])}return"Minified React error #"+u+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var n={d:{f:r,r:function(){throw Error(e(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for("react.portal");function i(u,d,f){var h=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:h==null?null:""+h,children:u,containerInfo:d,implementation:f}}var o=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(u,d){if(u==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return Na.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,Na.createPortal=function(u,d){var f=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(e(299));return i(u,d,null,f)},Na.flushSync=function(u){var d=o.T,f=n.p;try{if(o.T=null,n.p=2,u)return u()}finally{o.T=d,n.p=f,n.d.f()}},Na.preconnect=function(u,d){typeof u=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,n.d.C(u,d))},Na.prefetchDNS=function(u){typeof u=="string"&&n.d.D(u)},Na.preinit=function(u,d){if(typeof u=="string"&&d&&typeof d.as=="string"){var f=d.as,h=c(f,d.crossOrigin),m=typeof d.integrity=="string"?d.integrity:void 0,_=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;f==="style"?n.d.S(u,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:h,integrity:m,fetchPriority:_}):f==="script"&&n.d.X(u,{crossOrigin:h,integrity:m,fetchPriority:_,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},Na.preinitModule=function(u,d){if(typeof u=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var f=c(d.as,d.crossOrigin);n.d.M(u,{crossOrigin:f,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&n.d.M(u)},Na.preload=function(u,d){if(typeof u=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var f=d.as,h=c(f,d.crossOrigin);n.d.L(u,f,{crossOrigin:h,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},Na.preloadModule=function(u,d){if(typeof u=="string")if(d){var f=c(d.as,d.crossOrigin);n.d.m(u,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:f,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else n.d.m(u)},Na.requestFormReset=function(u){n.d.r(u)},Na.unstable_batchedUpdates=function(u,d){return u(d)},Na.useFormState=function(u,d,f){return o.H.useFormState(u,d,f)},Na.useFormStatus=function(){return o.H.useHostTransitionStatus()},Na.version="19.2.0",Na}var MD;function e3(){if(MD)return Pw.exports;MD=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch{}}return t(),Pw.exports=rV(),Pw.exports}/**
 * @license React
 * react-dom-client.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var jD;function nV(){if(jD)return Sh;jD=1;var t=tV(),e=ox(),r=e3();function n(s){var l="https://react.dev/errors/"+s;if(1<arguments.length){l+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)l+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+s+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function i(s){var l=s,p=s;if(s.alternate)for(;l.return;)l=l.return;else{s=l;do l=s,(l.flags&4098)!==0&&(p=l.return),s=l.return;while(s)}return l.tag===3?p:null}function o(s){if(s.tag===13){var l=s.memoizedState;if(l===null&&(s=s.alternate,s!==null&&(l=s.memoizedState)),l!==null)return l.dehydrated}return null}function c(s){if(s.tag===31){var l=s.memoizedState;if(l===null&&(s=s.alternate,s!==null&&(l=s.memoizedState)),l!==null)return l.dehydrated}return null}function u(s){if(i(s)!==s)throw Error(n(188))}function d(s){var l=s.alternate;if(!l){if(l=i(s),l===null)throw Error(n(188));return l!==s?null:s}for(var p=s,y=l;;){var k=p.return;if(k===null)break;var S=k.alternate;if(S===null){if(y=k.return,y!==null){p=y;continue}break}if(k.child===S.child){for(S=k.child;S;){if(S===p)return u(k),s;if(S===y)return u(k),l;S=S.sibling}throw Error(n(188))}if(p.return!==y.return)p=k,y=S;else{for(var M=!1,V=k.child;V;){if(V===p){M=!0,p=k,y=S;break}if(V===y){M=!0,y=k,p=S;break}V=V.sibling}if(!M){for(V=S.child;V;){if(V===p){M=!0,p=S,y=k;break}if(V===y){M=!0,y=S,p=k;break}V=V.sibling}if(!M)throw Error(n(189))}}if(p.alternate!==y)throw Error(n(190))}if(p.tag!==3)throw Error(n(188));return p.stateNode.current===p?s:l}function f(s){var l=s.tag;if(l===5||l===26||l===27||l===6)return s;for(s=s.child;s!==null;){if(l=f(s),l!==null)return l;s=s.sibling}return null}var h=Object.assign,m=Symbol.for("react.element"),_=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),D=Symbol.for("react.consumer"),P=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),I=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),R=Symbol.for("react.activity"),N=Symbol.for("react.memo_cache_sentinel"),L=Symbol.iterator;function j(s){return s===null||typeof s!="object"?null:(s=L&&s[L]||s["@@iterator"],typeof s=="function"?s:null)}var q=Symbol.for("react.client.reference");function U(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===q?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case b:return"Fragment";case T:return"Profiler";case E:return"StrictMode";case C:return"Suspense";case O:return"SuspenseList";case R:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case w:return"Portal";case P:return s.displayName||"Context";case D:return(s._context.displayName||"Context")+".Consumer";case A:var l=s.render;return s=s.displayName,s||(s=l.displayName||l.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case I:return l=s.displayName||null,l!==null?l:U(s.type)||"Memo";case x:l=s._payload,s=s._init;try{return U(s(l))}catch{}}return null}var W=Array.isArray,F=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q={pending:!1,data:null,method:null,action:null},ie=[],G=-1;function B(s){return{current:s}}function K(s){0>G||(s.current=ie[G],ie[G]=null,G--)}function ae(s,l){G++,ie[G]=s.current,s.current=l}var te=B(null),me=B(null),ue=B(null),Ae=B(null);function He(s,l){switch(ae(ue,l),ae(me,s),ae(te,null),l.nodeType){case 9:case 11:s=(s=l.documentElement)&&(s=s.namespaceURI)?J2(s):0;break;default:if(s=l.tagName,l=l.namespaceURI)l=J2(l),s=Q2(l,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}K(te),ae(te,s)}function ce(){K(te),K(me),K(ue)}function xe(s){s.memoizedState!==null&&ae(Ae,s);var l=te.current,p=Q2(l,s.type);l!==p&&(ae(me,s),ae(te,p))}function re(s){me.current===s&&(K(te),K(me)),Ae.current===s&&(K(Ae),vh._currentValue=Q)}var H,he;function Re(s){if(H===void 0)try{throw Error()}catch(p){var l=p.stack.trim().match(/\n( *(at )?)/);H=l&&l[1]||"",he=-1<p.stack.indexOf(`
    at`)?" (<anonymous>)":-1<p.stack.indexOf("@")?"@unknown:0:0":""}return`
`+H+s+he}var fe=!1;function Ie(s,l){if(!s||fe)return"";fe=!0;var p=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var y={DetermineComponentFrameRoot:function(){try{if(l){var Ge=function(){throw Error()};if(Object.defineProperty(Ge.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ge,[])}catch(Ne){var Pe=Ne}Reflect.construct(s,[],Ge)}else{try{Ge.call()}catch(Ne){Pe=Ne}s.call(Ge.prototype)}}else{try{throw Error()}catch(Ne){Pe=Ne}(Ge=s())&&typeof Ge.catch=="function"&&Ge.catch(function(){})}}catch(Ne){if(Ne&&Pe&&typeof Ne.stack=="string")return[Ne.stack,Pe.stack]}return[null,null]}};y.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var k=Object.getOwnPropertyDescriptor(y.DetermineComponentFrameRoot,"name");k&&k.configurable&&Object.defineProperty(y.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var S=y.DetermineComponentFrameRoot(),M=S[0],V=S[1];if(M&&V){var oe=M.split(`
`),Te=V.split(`
`);for(k=y=0;y<oe.length&&!oe[y].includes("DetermineComponentFrameRoot");)y++;for(;k<Te.length&&!Te[k].includes("DetermineComponentFrameRoot");)k++;if(y===oe.length||k===Te.length)for(y=oe.length-1,k=Te.length-1;1<=y&&0<=k&&oe[y]!==Te[k];)k--;for(;1<=y&&0<=k;y--,k--)if(oe[y]!==Te[k]){if(y!==1||k!==1)do if(y--,k--,0>k||oe[y]!==Te[k]){var Ue=`
`+oe[y].replace(" at new "," at ");return s.displayName&&Ue.includes("<anonymous>")&&(Ue=Ue.replace("<anonymous>",s.displayName)),Ue}while(1<=y&&0<=k);break}}}finally{fe=!1,Error.prepareStackTrace=p}return(p=s?s.displayName||s.name:"")?Re(p):""}function ct(s,l){switch(s.tag){case 26:case 27:case 5:return Re(s.type);case 16:return Re("Lazy");case 13:return s.child!==l&&l!==null?Re("Suspense Fallback"):Re("Suspense");case 19:return Re("SuspenseList");case 0:case 15:return Ie(s.type,!1);case 11:return Ie(s.type.render,!1);case 1:return Ie(s.type,!0);case 31:return Re("Activity");default:return""}}function $e(s){try{var l="",p=null;do l+=ct(s,p),p=s,s=s.return;while(s);return l}catch(y){return`
Error generating stack: `+y.message+`
`+y.stack}}var rt=Object.prototype.hasOwnProperty,We=t.unstable_scheduleCallback,it=t.unstable_cancelCallback,Et=t.unstable_shouldYield,Mt=t.unstable_requestPaint,_t=t.unstable_now,ge=t.unstable_getCurrentPriorityLevel,Be=t.unstable_ImmediatePriority,je=t.unstable_UserBlockingPriority,nt=t.unstable_NormalPriority,Ct=t.unstable_LowPriority,jt=t.unstable_IdlePriority,De=t.log,et=t.unstable_setDisableYieldValue,at=null,we=null;function st(s){if(typeof De=="function"&&et(s),we&&typeof we.setStrictMode=="function")try{we.setStrictMode(at,s)}catch{}}var bt=Math.clz32?Math.clz32:dr,nr=Math.log,ur=Math.LN2;function dr(s){return s>>>=0,s===0?32:31-(nr(s)/ur|0)|0}var Sr=256,un=262144,Z=4194304;function X(s){var l=s&42;if(l!==0)return l;switch(s&-s){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 s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function le(s,l,p){var y=s.pendingLanes;if(y===0)return 0;var k=0,S=s.suspendedLanes,M=s.pingedLanes;s=s.warmLanes;var V=y&134217727;return V!==0?(y=V&~S,y!==0?k=X(y):(M&=V,M!==0?k=X(M):p||(p=V&~s,p!==0&&(k=X(p))))):(V=y&~S,V!==0?k=X(V):M!==0?k=X(M):p||(p=y&~s,p!==0&&(k=X(p)))),k===0?0:l!==0&&l!==k&&(l&S)===0&&(S=k&-k,p=l&-l,S>=p||S===32&&(p&4194048)!==0)?l:k}function be(s,l){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&l)===0}function z(s,l){switch(s){case 1:case 2:case 4:case 8:case 64:return l+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 l+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 ee(){var s=Z;return Z<<=1,(Z&62914560)===0&&(Z=4194304),s}function se(s){for(var l=[],p=0;31>p;p++)l.push(s);return l}function Oe(s,l){s.pendingLanes|=l,l!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function wt(s,l,p,y,k,S){var M=s.pendingLanes;s.pendingLanes=p,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=p,s.entangledLanes&=p,s.errorRecoveryDisabledLanes&=p,s.shellSuspendCounter=0;var V=s.entanglements,oe=s.expirationTimes,Te=s.hiddenUpdates;for(p=M&~p;0<p;){var Ue=31-bt(p),Ge=1<<Ue;V[Ue]=0,oe[Ue]=-1;var Pe=Te[Ue];if(Pe!==null)for(Te[Ue]=null,Ue=0;Ue<Pe.length;Ue++){var Ne=Pe[Ue];Ne!==null&&(Ne.lane&=-536870913)}p&=~Ge}y!==0&&er(s,y,0),S!==0&&k===0&&s.tag!==0&&(s.suspendedLanes|=S&~(M&~l))}function er(s,l,p){s.pendingLanes|=l,s.suspendedLanes&=~l;var y=31-bt(l);s.entangledLanes|=l,s.entanglements[y]=s.entanglements[y]|1073741824|p&261930}function Qt(s,l){var p=s.entangledLanes|=l;for(s=s.entanglements;p;){var y=31-bt(p),k=1<<y;k&l|s[y]&l&&(s[y]|=l),p&=~k}}function Zt(s,l){var p=l&-l;return p=(p&42)!==0?1:oa(p),(p&(s.suspendedLanes|l))!==0?0:p}function oa(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=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:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function On(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function Ye(){var s=Y.p;return s!==0?s:(s=window.event,s===void 0?32:kD(s.type))}function Yt(s,l){var p=Y.p;try{return Y.p=s,l()}finally{Y.p=p}}var At=Math.random().toString(36).slice(2),Rt="__reactFiber$"+At,Dt="__reactProps$"+At,Nn="__reactContainer$"+At,dn="__reactEvents$"+At,jr="__reactListeners$"+At,Ra="__reactHandles$"+At,co="__reactResources$"+At,pn="__reactMarker$"+At;function tc(s){delete s[Rt],delete s[Dt],delete s[dn],delete s[jr],delete s[Ra]}function zi(s){var l=s[Rt];if(l)return l;for(var p=s.parentNode;p;){if(l=p[Nn]||p[Rt]){if(p=l.alternate,l.child!==null||p!==null&&p.child!==null)for(s=iD(s);s!==null;){if(p=s[Rt])return p;s=iD(s)}return l}s=p,p=s.parentNode}return null}function Ts(s){if(s=s[Rt]||s[Nn]){var l=s.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return s}return null}function _i(s){var l=s.tag;if(l===5||l===26||l===27||l===6)return s.stateNode;throw Error(n(33))}function Qn(s){var l=s[co];return l||(l=s[co]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function hn(s){s[pn]=!0}var Cs=new Set,xs={};function Ps(s,l){$i(s,l),$i(s+"Capture",l)}function $i(s,l){for(xs[s]=l,s=0;s<l.length;s++)Cs.add(l[s])}var Lp=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]*$"),kd={},wd={};function Bp(s){return rt.call(wd,s)?!0:rt.call(kd,s)?!1:Lp.test(s)?wd[s]=!0:(kd[s]=!0,!1)}function rc(s,l,p){if(Bp(l))if(p===null)s.removeAttribute(l);else{switch(typeof p){case"undefined":case"function":case"symbol":s.removeAttribute(l);return;case"boolean":var y=l.toLowerCase().slice(0,5);if(y!=="data-"&&y!=="aria-"){s.removeAttribute(l);return}}s.setAttribute(l,""+p)}}function lo(s,l,p){if(p===null)s.removeAttribute(l);else{switch(typeof p){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(l);return}s.setAttribute(l,""+p)}}function ma(s,l,p,y){if(y===null)s.removeAttribute(p);else{switch(typeof y){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(p);return}s.setAttributeNS(l,p,""+y)}}function ga(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function Ba(s){var l=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function Yc(s,l,p){var y=Object.getOwnPropertyDescriptor(s.constructor.prototype,l);if(!s.hasOwnProperty(l)&&typeof y<"u"&&typeof y.get=="function"&&typeof y.set=="function"){var k=y.get,S=y.set;return Object.defineProperty(s,l,{configurable:!0,get:function(){return k.call(this)},set:function(M){p=""+M,S.call(this,M)}}),Object.defineProperty(s,l,{enumerable:y.enumerable}),{getValue:function(){return p},setValue:function(M){p=""+M},stopTracking:function(){s._valueTracker=null,delete s[l]}}}}function vu(s){if(!s._valueTracker){var l=Ba(s)?"checked":"value";s._valueTracker=Yc(s,l,""+s[l])}}function Xc(s){if(!s)return!1;var l=s._valueTracker;if(!l)return!0;var p=l.getValue(),y="";return s&&(y=Ba(s)?s.checked?"true":"false":s.value),s=y,s!==p?(l.setValue(s),!0):!1}function uo(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var Sd=/[\n"\\]/g;function ca(s){return s.replace(Sd,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function fo(s,l,p,y,k,S,M,V){s.name="",M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"?s.type=M:s.removeAttribute("type"),l!=null?M==="number"?(l===0&&s.value===""||s.value!=l)&&(s.value=""+ga(l)):s.value!==""+ga(l)&&(s.value=""+ga(l)):M!=="submit"&&M!=="reset"||s.removeAttribute("value"),l!=null?Jc(s,M,ga(l)):p!=null?Jc(s,M,ga(p)):y!=null&&s.removeAttribute("value"),k==null&&S!=null&&(s.defaultChecked=!!S),k!=null&&(s.checked=k&&typeof k!="function"&&typeof k!="symbol"),V!=null&&typeof V!="function"&&typeof V!="symbol"&&typeof V!="boolean"?s.name=""+ga(V):s.removeAttribute("name")}function bi(s,l,p,y,k,S,M,V){if(S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(s.type=S),l!=null||p!=null){if(!(S!=="submit"&&S!=="reset"||l!=null)){vu(s);return}p=p!=null?""+ga(p):"",l=l!=null?""+ga(l):p,V||l===s.value||(s.value=l),s.defaultValue=l}y=y??k,y=typeof y!="function"&&typeof y!="symbol"&&!!y,s.checked=V?s.checked:!!y,s.defaultChecked=!!y,M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"&&(s.name=M),vu(s)}function Jc(s,l,p){l==="number"&&uo(s.ownerDocument)===s||s.defaultValue===""+p||(s.defaultValue=""+p)}function _e(s,l,p,y){if(s=s.options,l){l={};for(var k=0;k<p.length;k++)l["$"+p[k]]=!0;for(p=0;p<s.length;p++)k=l.hasOwnProperty("$"+s[p].value),s[p].selected!==k&&(s[p].selected=k),k&&y&&(s[p].defaultSelected=!0)}else{for(p=""+ga(p),l=null,k=0;k<s.length;k++){if(s[k].value===p){s[k].selected=!0,y&&(s[k].defaultSelected=!0);return}l!==null||s[k].disabled||(l=s[k])}l!==null&&(l.selected=!0)}}function Ze(s,l,p){if(l!=null&&(l=""+ga(l),l!==s.value&&(s.value=l),p==null)){s.defaultValue!==l&&(s.defaultValue=l);return}s.defaultValue=p!=null?""+ga(p):""}function ot(s,l,p,y){if(l==null){if(y!=null){if(p!=null)throw Error(n(92));if(W(y)){if(1<y.length)throw Error(n(93));y=y[0]}p=y}p==null&&(p=""),l=p}p=ga(l),s.defaultValue=p,y=s.textContent,y===p&&y!==""&&y!==null&&(s.value=y),vu(s)}function Je(s,l){if(l){var p=s.firstChild;if(p&&p===s.lastChild&&p.nodeType===3){p.nodeValue=l;return}}s.textContent=l}var Nt=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 $t(s,l,p){var y=l.indexOf("--")===0;p==null||typeof p=="boolean"||p===""?y?s.setProperty(l,""):l==="float"?s.cssFloat="":s[l]="":y?s.setProperty(l,p):typeof p!="number"||p===0||Nt.has(l)?l==="float"?s.cssFloat=p:s[l]=(""+p).trim():s[l]=p+"px"}function Or(s,l,p){if(l!=null&&typeof l!="object")throw Error(n(62));if(s=s.style,p!=null){for(var y in p)!p.hasOwnProperty(y)||l!=null&&l.hasOwnProperty(y)||(y.indexOf("--")===0?s.setProperty(y,""):y==="float"?s.cssFloat="":s[y]="");for(var k in l)y=l[k],l.hasOwnProperty(k)&&p[k]!==y&&$t(s,k,y)}else for(var S in l)l.hasOwnProperty(S)&&$t(s,S,l[S])}function rn(s){if(s.indexOf("-")===-1)return!1;switch(s){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 Tn=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"]]),la=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function As(s){return la.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function ya(){}var Qc=null;function Rs(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var ki=null,wi=null;function Vi(s){var l=Ts(s);if(l&&(s=l.stateNode)){var p=s[Dt]||null;e:switch(s=l.stateNode,l.type){case"input":if(fo(s,p.value,p.defaultValue,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name),l=p.name,p.type==="radio"&&l!=null){for(p=s;p.parentNode;)p=p.parentNode;for(p=p.querySelectorAll('input[name="'+ca(""+l)+'"][type="radio"]'),l=0;l<p.length;l++){var y=p[l];if(y!==s&&y.form===s.form){var k=y[Dt]||null;if(!k)throw Error(n(90));fo(y,k.value,k.defaultValue,k.defaultValue,k.checked,k.defaultChecked,k.type,k.name)}}for(l=0;l<p.length;l++)y=p[l],y.form===s.form&&Xc(y)}break e;case"textarea":Ze(s,p.value,p.defaultValue);break e;case"select":l=p.value,l!=null&&_e(s,!!p.multiple,l,!1)}}}var po=!1;function Lr(s,l,p){if(po)return s(l,p);po=!0;try{var y=s(l);return y}finally{if(po=!1,(ki!==null||wi!==null)&&(Ny(),ki&&(l=ki,s=wi,wi=ki=null,Vi(l),s)))for(l=0;l<s.length;l++)Vi(s[l])}}function Zn(s,l){var p=s.stateNode;if(p===null)return null;var y=p[Dt]||null;if(y===null)return null;p=y[l];e:switch(l){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(y=!y.disabled)||(s=s.type,y=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!y;break e;default:s=!1}if(s)return null;if(p&&typeof p!="function")throw Error(n(231,l,typeof p));return p}var ea=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ua=!1;if(ea)try{var Da={};Object.defineProperty(Da,"passive",{get:function(){Ua=!0}}),window.addEventListener("test",Da,Da),window.removeEventListener("test",Da,Da)}catch{Ua=!1}var ta=null,Fn=null,Hi=null;function nc(){if(Hi)return Hi;var s,l=Fn,p=l.length,y,k="value"in ta?ta.value:ta.textContent,S=k.length;for(s=0;s<p&&l[s]===k[s];s++);var M=p-s;for(y=1;y<=M&&l[p-y]===k[S-y];y++);return Hi=k.slice(s,1<y?1-y:void 0)}function Ed(s){var l=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&l===13&&(s=13)):s=l,s===10&&(s=13),32<=s||s===13?s:0}function Td(){return!0}function Yg(){return!1}function Oa(s){function l(p,y,k,S,M){this._reactName=p,this._targetInst=k,this.type=y,this.nativeEvent=S,this.target=M,this.currentTarget=null;for(var V in s)s.hasOwnProperty(V)&&(p=s[V],this[V]=p?p(S):S[V]);return this.isDefaultPrevented=(S.defaultPrevented!=null?S.defaultPrevented:S.returnValue===!1)?Td:Yg,this.isPropagationStopped=Yg,this}return h(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var p=this.nativeEvent;p&&(p.preventDefault?p.preventDefault():typeof p.returnValue!="unknown"&&(p.returnValue=!1),this.isDefaultPrevented=Td)},stopPropagation:function(){var p=this.nativeEvent;p&&(p.stopPropagation?p.stopPropagation():typeof p.cancelBubble!="unknown"&&(p.cancelBubble=!0),this.isPropagationStopped=Td)},persist:function(){},isPersistent:Td}),l}var ac={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ic=Oa(ac),Zc=h({},ac,{view:0,detail:0}),x0=Oa(Zc),el,J,pe,ye=h({},Zc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Fa,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==pe&&(pe&&s.type==="mousemove"?(el=s.screenX-pe.screenX,J=s.screenY-pe.screenY):J=el=0,pe=s),el)},movementY:function(s){return"movementY"in s?s.movementY:J}}),Me=Oa(ye),Se=h({},ye,{dataTransfer:0}),Ve=Oa(Se),Qe=h({},Zc,{relatedTarget:0}),gt=Oa(Qe),Er=h({},ac,{animationName:0,elapsedTime:0,pseudoElement:0}),nn=Oa(Er),fr=h({},ac,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),an=Oa(fr),Ds=h({},ac,{data:0}),sc=Oa(Ds),_u={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Gi={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"},Cd={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Xg(s){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(s):(s=Cd[s])?!!l[s]:!1}function Fa(){return Xg}var tl=h({},Zc,{key:function(s){if(s.key){var l=_u[s.key]||s.key;if(l!=="Unidentified")return l}return s.type==="keypress"?(s=Ed(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?Gi[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Fa,charCode:function(s){return s.type==="keypress"?Ed(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?Ed(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),Jg=Oa(tl),P0=h({},ye,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),r1=Oa(P0),d$=h({},Zc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Fa}),f$=Oa(d$),p$=h({},ac,{propertyName:0,elapsedTime:0,pseudoElement:0}),h$=Oa(p$),m$=h({},ye,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),g$=Oa(m$),y$=h({},ac,{newState:0,oldState:0}),v$=Oa(y$),_$=[9,13,27,32],A0=ea&&"CompositionEvent"in window,Up=null;ea&&"documentMode"in document&&(Up=document.documentMode);var b$=ea&&"TextEvent"in window&&!Up,n1=ea&&(!A0||Up&&8<Up&&11>=Up),a1=" ",i1=!1;function s1(s,l){switch(s){case"keyup":return _$.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function o1(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var xd=!1;function k$(s,l){switch(s){case"compositionend":return o1(l);case"keypress":return l.which!==32?null:(i1=!0,a1);case"textInput":return s=l.data,s===a1&&i1?null:s;default:return null}}function w$(s,l){if(xd)return s==="compositionend"||!A0&&s1(s,l)?(s=nc(),Hi=Fn=ta=null,xd=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1<l.char.length)return l.char;if(l.which)return String.fromCharCode(l.which)}return null;case"compositionend":return n1&&l.locale!=="ko"?null:l.data;default:return null}}var S$={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 c1(s){var l=s&&s.nodeName&&s.nodeName.toLowerCase();return l==="input"?!!S$[s.type]:l==="textarea"}function l1(s,l,p,y){ki?wi?wi.push(y):wi=[y]:ki=y,l=Fy(l,"onChange"),0<l.length&&(p=new ic("onChange","change",null,p,y),s.push({event:p,listeners:l}))}var Fp=null,qp=null;function E$(s){H2(s,0)}function Qg(s){var l=_i(s);if(Xc(l))return s}function u1(s,l){if(s==="change")return l}var d1=!1;if(ea){var R0;if(ea){var D0="oninput"in document;if(!D0){var f1=document.createElement("div");f1.setAttribute("oninput","return;"),D0=typeof f1.oninput=="function"}R0=D0}else R0=!1;d1=R0&&(!document.documentMode||9<document.documentMode)}function p1(){Fp&&(Fp.detachEvent("onpropertychange",h1),qp=Fp=null)}function h1(s){if(s.propertyName==="value"&&Qg(qp)){var l=[];l1(l,qp,s,Rs(s)),Lr(E$,l)}}function T$(s,l,p){s==="focusin"?(p1(),Fp=l,qp=p,Fp.attachEvent("onpropertychange",h1)):s==="focusout"&&p1()}function C$(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return Qg(qp)}function x$(s,l){if(s==="click")return Qg(l)}function P$(s,l){if(s==="input"||s==="change")return Qg(l)}function A$(s,l){return s===l&&(s!==0||1/s===1/l)||s!==s&&l!==l}var Si=typeof Object.is=="function"?Object.is:A$;function zp(s,l){if(Si(s,l))return!0;if(typeof s!="object"||s===null||typeof l!="object"||l===null)return!1;var p=Object.keys(s),y=Object.keys(l);if(p.length!==y.length)return!1;for(y=0;y<p.length;y++){var k=p[y];if(!rt.call(l,k)||!Si(s[k],l[k]))return!1}return!0}function m1(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function g1(s,l){var p=m1(s);s=0;for(var y;p;){if(p.nodeType===3){if(y=s+p.textContent.length,s<=l&&y>=l)return{node:p,offset:l-s};s=y}e:{for(;p;){if(p.nextSibling){p=p.nextSibling;break e}p=p.parentNode}p=void 0}p=m1(p)}}function y1(s,l){return s&&l?s===l?!0:s&&s.nodeType===3?!1:l&&l.nodeType===3?y1(s,l.parentNode):"contains"in s?s.contains(l):s.compareDocumentPosition?!!(s.compareDocumentPosition(l)&16):!1:!1}function v1(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var l=uo(s.document);l instanceof s.HTMLIFrameElement;){try{var p=typeof l.contentWindow.location.href=="string"}catch{p=!1}if(p)s=l.contentWindow;else break;l=uo(s.document)}return l}function O0(s){var l=s&&s.nodeName&&s.nodeName.toLowerCase();return l&&(l==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||l==="textarea"||s.contentEditable==="true")}var R$=ea&&"documentMode"in document&&11>=document.documentMode,Pd=null,N0=null,$p=null,I0=!1;function _1(s,l,p){var y=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;I0||Pd==null||Pd!==uo(y)||(y=Pd,"selectionStart"in y&&O0(y)?y={start:y.selectionStart,end:y.selectionEnd}:(y=(y.ownerDocument&&y.ownerDocument.defaultView||window).getSelection(),y={anchorNode:y.anchorNode,anchorOffset:y.anchorOffset,focusNode:y.focusNode,focusOffset:y.focusOffset}),$p&&zp($p,y)||($p=y,y=Fy(N0,"onSelect"),0<y.length&&(l=new ic("onSelect","select",null,l,p),s.push({event:l,listeners:y}),l.target=Pd)))}function bu(s,l){var p={};return p[s.toLowerCase()]=l.toLowerCase(),p["Webkit"+s]="webkit"+l,p["Moz"+s]="moz"+l,p}var Ad={animationend:bu("Animation","AnimationEnd"),animationiteration:bu("Animation","AnimationIteration"),animationstart:bu("Animation","AnimationStart"),transitionrun:bu("Transition","TransitionRun"),transitionstart:bu("Transition","TransitionStart"),transitioncancel:bu("Transition","TransitionCancel"),transitionend:bu("Transition","TransitionEnd")},M0={},b1={};ea&&(b1=document.createElement("div").style,"AnimationEvent"in window||(delete Ad.animationend.animation,delete Ad.animationiteration.animation,delete Ad.animationstart.animation),"TransitionEvent"in window||delete Ad.transitionend.transition);function ku(s){if(M0[s])return M0[s];if(!Ad[s])return s;var l=Ad[s],p;for(p in l)if(l.hasOwnProperty(p)&&p in b1)return M0[s]=l[p];return s}var k1=ku("animationend"),w1=ku("animationiteration"),S1=ku("animationstart"),D$=ku("transitionrun"),O$=ku("transitionstart"),N$=ku("transitioncancel"),E1=ku("transitionend"),T1=new Map,j0="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(" ");j0.push("scrollEnd");function Os(s,l){T1.set(s,l),Ps(l,[s])}var Zg=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var l=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(l))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}},Wi=[],Rd=0,L0=0;function ey(){for(var s=Rd,l=L0=Rd=0;l<s;){var p=Wi[l];Wi[l++]=null;var y=Wi[l];Wi[l++]=null;var k=Wi[l];Wi[l++]=null;var S=Wi[l];if(Wi[l++]=null,y!==null&&k!==null){var M=y.pending;M===null?k.next=k:(k.next=M.next,M.next=k),y.pending=k}S!==0&&C1(p,k,S)}}function ty(s,l,p,y){Wi[Rd++]=s,Wi[Rd++]=l,Wi[Rd++]=p,Wi[Rd++]=y,L0|=y,s.lanes|=y,s=s.alternate,s!==null&&(s.lanes|=y)}function B0(s,l,p,y){return ty(s,l,p,y),ry(s)}function wu(s,l){return ty(s,null,null,l),ry(s)}function C1(s,l,p){s.lanes|=p;var y=s.alternate;y!==null&&(y.lanes|=p);for(var k=!1,S=s.return;S!==null;)S.childLanes|=p,y=S.alternate,y!==null&&(y.childLanes|=p),S.tag===22&&(s=S.stateNode,s===null||s._visibility&1||(k=!0)),s=S,S=S.return;return s.tag===3?(S=s.stateNode,k&&l!==null&&(k=31-bt(p),s=S.hiddenUpdates,y=s[k],y===null?s[k]=[l]:y.push(l),l.lane=p|536870912),S):null}function ry(s){if(50<dh)throw dh=0,Wk=null,Error(n(185));for(var l=s.return;l!==null;)s=l,l=s.return;return s.tag===3?s.stateNode:null}var Dd={};function I$(s,l,p,y){this.tag=s,this.key=p,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=y,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ei(s,l,p,y){return new I$(s,l,p,y)}function U0(s){return s=s.prototype,!(!s||!s.isReactComponent)}function oc(s,l){var p=s.alternate;return p===null?(p=Ei(s.tag,l,s.key,s.mode),p.elementType=s.elementType,p.type=s.type,p.stateNode=s.stateNode,p.alternate=s,s.alternate=p):(p.pendingProps=l,p.type=s.type,p.flags=0,p.subtreeFlags=0,p.deletions=null),p.flags=s.flags&65011712,p.childLanes=s.childLanes,p.lanes=s.lanes,p.child=s.child,p.memoizedProps=s.memoizedProps,p.memoizedState=s.memoizedState,p.updateQueue=s.updateQueue,l=s.dependencies,p.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},p.sibling=s.sibling,p.index=s.index,p.ref=s.ref,p.refCleanup=s.refCleanup,p}function x1(s,l){s.flags&=65011714;var p=s.alternate;return p===null?(s.childLanes=0,s.lanes=l,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=p.childLanes,s.lanes=p.lanes,s.child=p.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=p.memoizedProps,s.memoizedState=p.memoizedState,s.updateQueue=p.updateQueue,s.type=p.type,l=p.dependencies,s.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),s}function ny(s,l,p,y,k,S){var M=0;if(y=s,typeof s=="function")U0(s)&&(M=1);else if(typeof s=="string")M=U8(s,p,te.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case R:return s=Ei(31,p,l,k),s.elementType=R,s.lanes=S,s;case b:return Su(p.children,k,S,l);case E:M=8,k|=24;break;case T:return s=Ei(12,p,l,k|2),s.elementType=T,s.lanes=S,s;case C:return s=Ei(13,p,l,k),s.elementType=C,s.lanes=S,s;case O:return s=Ei(19,p,l,k),s.elementType=O,s.lanes=S,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case P:M=10;break e;case D:M=9;break e;case A:M=11;break e;case I:M=14;break e;case x:M=16,y=null;break e}M=29,p=Error(n(130,s===null?"null":typeof s,"")),y=null}return l=Ei(M,p,l,k),l.elementType=s,l.type=y,l.lanes=S,l}function Su(s,l,p,y){return s=Ei(7,s,y,l),s.lanes=p,s}function F0(s,l,p){return s=Ei(6,s,null,l),s.lanes=p,s}function P1(s){var l=Ei(18,null,null,0);return l.stateNode=s,l}function q0(s,l,p){return l=Ei(4,s.children!==null?s.children:[],s.key,l),l.lanes=p,l.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},l}var A1=new WeakMap;function Ki(s,l){if(typeof s=="object"&&s!==null){var p=A1.get(s);return p!==void 0?p:(l={value:s,source:l,stack:$e(l)},A1.set(s,l),l)}return{value:s,source:l,stack:$e(l)}}var Od=[],Nd=0,ay=null,Vp=0,Yi=[],Xi=0,rl=null,ho=1,mo="";function cc(s,l){Od[Nd++]=Vp,Od[Nd++]=ay,ay=s,Vp=l}function R1(s,l,p){Yi[Xi++]=ho,Yi[Xi++]=mo,Yi[Xi++]=rl,rl=s;var y=ho;s=mo;var k=32-bt(y)-1;y&=~(1<<k),p+=1;var S=32-bt(l)+k;if(30<S){var M=k-k%5;S=(y&(1<<M)-1).toString(32),y>>=M,k-=M,ho=1<<32-bt(l)+k|p<<k|y,mo=S+s}else ho=1<<S|p<<k|y,mo=s}function z0(s){s.return!==null&&(cc(s,1),R1(s,1,0))}function $0(s){for(;s===ay;)ay=Od[--Nd],Od[Nd]=null,Vp=Od[--Nd],Od[Nd]=null;for(;s===rl;)rl=Yi[--Xi],Yi[Xi]=null,mo=Yi[--Xi],Yi[Xi]=null,ho=Yi[--Xi],Yi[Xi]=null}function D1(s,l){Yi[Xi++]=ho,Yi[Xi++]=mo,Yi[Xi++]=rl,ho=l.id,mo=l.overflow,rl=s}var va=null,mn=null,Tr=!1,nl=null,Ji=!1,V0=Error(n(519));function al(s){var l=Error(n(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Hp(Ki(l,s)),V0}function O1(s){var l=s.stateNode,p=s.type,y=s.memoizedProps;switch(l[Rt]=s,l[Dt]=y,p){case"dialog":yr("cancel",l),yr("close",l);break;case"iframe":case"object":case"embed":yr("load",l);break;case"video":case"audio":for(p=0;p<ph.length;p++)yr(ph[p],l);break;case"source":yr("error",l);break;case"img":case"image":case"link":yr("error",l),yr("load",l);break;case"details":yr("toggle",l);break;case"input":yr("invalid",l),bi(l,y.value,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name,!0);break;case"select":yr("invalid",l);break;case"textarea":yr("invalid",l),ot(l,y.value,y.defaultValue,y.children)}p=y.children,typeof p!="string"&&typeof p!="number"&&typeof p!="bigint"||l.textContent===""+p||y.suppressHydrationWarning===!0||Y2(l.textContent,p)?(y.popover!=null&&(yr("beforetoggle",l),yr("toggle",l)),y.onScroll!=null&&yr("scroll",l),y.onScrollEnd!=null&&yr("scrollend",l),y.onClick!=null&&(l.onclick=ya),l=!0):l=!1,l||al(s,!0)}function N1(s){for(va=s.return;va;)switch(va.tag){case 5:case 31:case 13:Ji=!1;return;case 27:case 3:Ji=!0;return;default:va=va.return}}function Id(s){if(s!==va)return!1;if(!Tr)return N1(s),Tr=!0,!1;var l=s.tag,p;if((p=l!==3&&l!==27)&&((p=l===5)&&(p=s.type,p=!(p!=="form"&&p!=="button")||cw(s.type,s.memoizedProps)),p=!p),p&&mn&&al(s),N1(s),l===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(317));mn=aD(s)}else if(l===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(317));mn=aD(s)}else l===27?(l=mn,vl(s.type)?(s=pw,pw=null,mn=s):mn=l):mn=va?Zi(s.stateNode.nextSibling):null;return!0}function Eu(){mn=va=null,Tr=!1}function H0(){var s=nl;return s!==null&&(ei===null?ei=s:ei.push.apply(ei,s),nl=null),s}function Hp(s){nl===null?nl=[s]:nl.push(s)}var G0=B(null),Tu=null,lc=null;function il(s,l,p){ae(G0,l._currentValue),l._currentValue=p}function uc(s){s._currentValue=G0.current,K(G0)}function W0(s,l,p){for(;s!==null;){var y=s.alternate;if((s.childLanes&l)!==l?(s.childLanes|=l,y!==null&&(y.childLanes|=l)):y!==null&&(y.childLanes&l)!==l&&(y.childLanes|=l),s===p)break;s=s.return}}function K0(s,l,p,y){var k=s.child;for(k!==null&&(k.return=s);k!==null;){var S=k.dependencies;if(S!==null){var M=k.child;S=S.firstContext;e:for(;S!==null;){var V=S;S=k;for(var oe=0;oe<l.length;oe++)if(V.context===l[oe]){S.lanes|=p,V=S.alternate,V!==null&&(V.lanes|=p),W0(S.return,p,s),y||(M=null);break e}S=V.next}}else if(k.tag===18){if(M=k.return,M===null)throw Error(n(341));M.lanes|=p,S=M.alternate,S!==null&&(S.lanes|=p),W0(M,p,s),M=null}else M=k.child;if(M!==null)M.return=k;else for(M=k;M!==null;){if(M===s){M=null;break}if(k=M.sibling,k!==null){k.return=M.return,M=k;break}M=M.return}k=M}}function Md(s,l,p,y){s=null;for(var k=l,S=!1;k!==null;){if(!S){if((k.flags&524288)!==0)S=!0;else if((k.flags&262144)!==0)break}if(k.tag===10){var M=k.alternate;if(M===null)throw Error(n(387));if(M=M.memoizedProps,M!==null){var V=k.type;Si(k.pendingProps.value,M.value)||(s!==null?s.push(V):s=[V])}}else if(k===Ae.current){if(M=k.alternate,M===null)throw Error(n(387));M.memoizedState.memoizedState!==k.memoizedState.memoizedState&&(s!==null?s.push(vh):s=[vh])}k=k.return}s!==null&&K0(l,s,p,y),l.flags|=262144}function iy(s){for(s=s.firstContext;s!==null;){if(!Si(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function Cu(s){Tu=s,lc=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function _a(s){return I1(Tu,s)}function sy(s,l){return Tu===null&&Cu(s),I1(s,l)}function I1(s,l){var p=l._currentValue;if(l={context:l,memoizedValue:p,next:null},lc===null){if(s===null)throw Error(n(308));lc=l,s.dependencies={lanes:0,firstContext:l},s.flags|=524288}else lc=lc.next=l;return p}var M$=typeof AbortController<"u"?AbortController:function(){var s=[],l=this.signal={aborted:!1,addEventListener:function(p,y){s.push(y)}};this.abort=function(){l.aborted=!0,s.forEach(function(p){return p()})}},j$=t.unstable_scheduleCallback,L$=t.unstable_NormalPriority,qn={$$typeof:P,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Y0(){return{controller:new M$,data:new Map,refCount:0}}function Gp(s){s.refCount--,s.refCount===0&&j$(L$,function(){s.controller.abort()})}var Wp=null,X0=0,jd=0,Ld=null;function B$(s,l){if(Wp===null){var p=Wp=[];X0=0,jd=Zk(),Ld={status:"pending",value:void 0,then:function(y){p.push(y)}}}return X0++,l.then(M1,M1),l}function M1(){if(--X0===0&&Wp!==null){Ld!==null&&(Ld.status="fulfilled");var s=Wp;Wp=null,jd=0,Ld=null;for(var l=0;l<s.length;l++)(0,s[l])()}}function U$(s,l){var p=[],y={status:"pending",value:null,reason:null,then:function(k){p.push(k)}};return s.then(function(){y.status="fulfilled",y.value=l;for(var k=0;k<p.length;k++)(0,p[k])(l)},function(k){for(y.status="rejected",y.reason=k,k=0;k<p.length;k++)(0,p[k])(void 0)}),y}var j1=F.S;F.S=function(s,l){_2=_t(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&B$(s,l),j1!==null&&j1(s,l)};var xu=B(null);function J0(){var s=xu.current;return s!==null?s:sn.pooledCache}function oy(s,l){l===null?ae(xu,xu.current):ae(xu,l.pool)}function L1(){var s=J0();return s===null?null:{parent:qn._currentValue,pool:s}}var Bd=Error(n(460)),Q0=Error(n(474)),cy=Error(n(542)),ly={then:function(){}};function B1(s){return s=s.status,s==="fulfilled"||s==="rejected"}function U1(s,l,p){switch(p=s[p],p===void 0?s.push(l):p!==l&&(l.then(ya,ya),l=p),l.status){case"fulfilled":return l.value;case"rejected":throw s=l.reason,q1(s),s;default:if(typeof l.status=="string")l.then(ya,ya);else{if(s=sn,s!==null&&100<s.shellSuspendCounter)throw Error(n(482));s=l,s.status="pending",s.then(function(y){if(l.status==="pending"){var k=l;k.status="fulfilled",k.value=y}},function(y){if(l.status==="pending"){var k=l;k.status="rejected",k.reason=y}})}switch(l.status){case"fulfilled":return l.value;case"rejected":throw s=l.reason,q1(s),s}throw Au=l,Bd}}function Pu(s){try{var l=s._init;return l(s._payload)}catch(p){throw p!==null&&typeof p=="object"&&typeof p.then=="function"?(Au=p,Bd):p}}var Au=null;function F1(){if(Au===null)throw Error(n(459));var s=Au;return Au=null,s}function q1(s){if(s===Bd||s===cy)throw Error(n(483))}var Ud=null,Kp=0;function uy(s){var l=Kp;return Kp+=1,Ud===null&&(Ud=[]),U1(Ud,s,l)}function Yp(s,l){l=l.props.ref,s.ref=l!==void 0?l:null}function dy(s,l){throw l.$$typeof===m?Error(n(525)):(s=Object.prototype.toString.call(l),Error(n(31,s==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":s)))}function z1(s){function l(ve,de){if(s){var Ee=ve.deletions;Ee===null?(ve.deletions=[de],ve.flags|=16):Ee.push(de)}}function p(ve,de){if(!s)return null;for(;de!==null;)l(ve,de),de=de.sibling;return null}function y(ve){for(var de=new Map;ve!==null;)ve.key!==null?de.set(ve.key,ve):de.set(ve.index,ve),ve=ve.sibling;return de}function k(ve,de){return ve=oc(ve,de),ve.index=0,ve.sibling=null,ve}function S(ve,de,Ee){return ve.index=Ee,s?(Ee=ve.alternate,Ee!==null?(Ee=Ee.index,Ee<de?(ve.flags|=67108866,de):Ee):(ve.flags|=67108866,de)):(ve.flags|=1048576,de)}function M(ve){return s&&ve.alternate===null&&(ve.flags|=67108866),ve}function V(ve,de,Ee,qe){return de===null||de.tag!==6?(de=F0(Ee,ve.mode,qe),de.return=ve,de):(de=k(de,Ee),de.return=ve,de)}function oe(ve,de,Ee,qe){var Ft=Ee.type;return Ft===b?Ue(ve,de,Ee.props.children,qe,Ee.key):de!==null&&(de.elementType===Ft||typeof Ft=="object"&&Ft!==null&&Ft.$$typeof===x&&Pu(Ft)===de.type)?(de=k(de,Ee.props),Yp(de,Ee),de.return=ve,de):(de=ny(Ee.type,Ee.key,Ee.props,null,ve.mode,qe),Yp(de,Ee),de.return=ve,de)}function Te(ve,de,Ee,qe){return de===null||de.tag!==4||de.stateNode.containerInfo!==Ee.containerInfo||de.stateNode.implementation!==Ee.implementation?(de=q0(Ee,ve.mode,qe),de.return=ve,de):(de=k(de,Ee.children||[]),de.return=ve,de)}function Ue(ve,de,Ee,qe,Ft){return de===null||de.tag!==7?(de=Su(Ee,ve.mode,qe,Ft),de.return=ve,de):(de=k(de,Ee),de.return=ve,de)}function Ge(ve,de,Ee){if(typeof de=="string"&&de!==""||typeof de=="number"||typeof de=="bigint")return de=F0(""+de,ve.mode,Ee),de.return=ve,de;if(typeof de=="object"&&de!==null){switch(de.$$typeof){case _:return Ee=ny(de.type,de.key,de.props,null,ve.mode,Ee),Yp(Ee,de),Ee.return=ve,Ee;case w:return de=q0(de,ve.mode,Ee),de.return=ve,de;case x:return de=Pu(de),Ge(ve,de,Ee)}if(W(de)||j(de))return de=Su(de,ve.mode,Ee,null),de.return=ve,de;if(typeof de.then=="function")return Ge(ve,uy(de),Ee);if(de.$$typeof===P)return Ge(ve,sy(ve,de),Ee);dy(ve,de)}return null}function Pe(ve,de,Ee,qe){var Ft=de!==null?de.key:null;if(typeof Ee=="string"&&Ee!==""||typeof Ee=="number"||typeof Ee=="bigint")return Ft!==null?null:V(ve,de,""+Ee,qe);if(typeof Ee=="object"&&Ee!==null){switch(Ee.$$typeof){case _:return Ee.key===Ft?oe(ve,de,Ee,qe):null;case w:return Ee.key===Ft?Te(ve,de,Ee,qe):null;case x:return Ee=Pu(Ee),Pe(ve,de,Ee,qe)}if(W(Ee)||j(Ee))return Ft!==null?null:Ue(ve,de,Ee,qe,null);if(typeof Ee.then=="function")return Pe(ve,de,uy(Ee),qe);if(Ee.$$typeof===P)return Pe(ve,de,sy(ve,Ee),qe);dy(ve,Ee)}return null}function Ne(ve,de,Ee,qe,Ft){if(typeof qe=="string"&&qe!==""||typeof qe=="number"||typeof qe=="bigint")return ve=ve.get(Ee)||null,V(de,ve,""+qe,Ft);if(typeof qe=="object"&&qe!==null){switch(qe.$$typeof){case _:return ve=ve.get(qe.key===null?Ee:qe.key)||null,oe(de,ve,qe,Ft);case w:return ve=ve.get(qe.key===null?Ee:qe.key)||null,Te(de,ve,qe,Ft);case x:return qe=Pu(qe),Ne(ve,de,Ee,qe,Ft)}if(W(qe)||j(qe))return ve=ve.get(Ee)||null,Ue(de,ve,qe,Ft,null);if(typeof qe.then=="function")return Ne(ve,de,Ee,uy(qe),Ft);if(qe.$$typeof===P)return Ne(ve,de,Ee,sy(de,qe),Ft);dy(de,qe)}return null}function Pt(ve,de,Ee,qe){for(var Ft=null,Nr=null,Lt=de,ir=de=0,kr=null;Lt!==null&&ir<Ee.length;ir++){Lt.index>ir?(kr=Lt,Lt=null):kr=Lt.sibling;var Ir=Pe(ve,Lt,Ee[ir],qe);if(Ir===null){Lt===null&&(Lt=kr);break}s&&Lt&&Ir.alternate===null&&l(ve,Lt),de=S(Ir,de,ir),Nr===null?Ft=Ir:Nr.sibling=Ir,Nr=Ir,Lt=kr}if(ir===Ee.length)return p(ve,Lt),Tr&&cc(ve,ir),Ft;if(Lt===null){for(;ir<Ee.length;ir++)Lt=Ge(ve,Ee[ir],qe),Lt!==null&&(de=S(Lt,de,ir),Nr===null?Ft=Lt:Nr.sibling=Lt,Nr=Lt);return Tr&&cc(ve,ir),Ft}for(Lt=y(Lt);ir<Ee.length;ir++)kr=Ne(Lt,ve,ir,Ee[ir],qe),kr!==null&&(s&&kr.alternate!==null&&Lt.delete(kr.key===null?ir:kr.key),de=S(kr,de,ir),Nr===null?Ft=kr:Nr.sibling=kr,Nr=kr);return s&&Lt.forEach(function(Sl){return l(ve,Sl)}),Tr&&cc(ve,ir),Ft}function Ht(ve,de,Ee,qe){if(Ee==null)throw Error(n(151));for(var Ft=null,Nr=null,Lt=de,ir=de=0,kr=null,Ir=Ee.next();Lt!==null&&!Ir.done;ir++,Ir=Ee.next()){Lt.index>ir?(kr=Lt,Lt=null):kr=Lt.sibling;var Sl=Pe(ve,Lt,Ir.value,qe);if(Sl===null){Lt===null&&(Lt=kr);break}s&&Lt&&Sl.alternate===null&&l(ve,Lt),de=S(Sl,de,ir),Nr===null?Ft=Sl:Nr.sibling=Sl,Nr=Sl,Lt=kr}if(Ir.done)return p(ve,Lt),Tr&&cc(ve,ir),Ft;if(Lt===null){for(;!Ir.done;ir++,Ir=Ee.next())Ir=Ge(ve,Ir.value,qe),Ir!==null&&(de=S(Ir,de,ir),Nr===null?Ft=Ir:Nr.sibling=Ir,Nr=Ir);return Tr&&cc(ve,ir),Ft}for(Lt=y(Lt);!Ir.done;ir++,Ir=Ee.next())Ir=Ne(Lt,ve,ir,Ir.value,qe),Ir!==null&&(s&&Ir.alternate!==null&&Lt.delete(Ir.key===null?ir:Ir.key),de=S(Ir,de,ir),Nr===null?Ft=Ir:Nr.sibling=Ir,Nr=Ir);return s&&Lt.forEach(function(X8){return l(ve,X8)}),Tr&&cc(ve,ir),Ft}function Zr(ve,de,Ee,qe){if(typeof Ee=="object"&&Ee!==null&&Ee.type===b&&Ee.key===null&&(Ee=Ee.props.children),typeof Ee=="object"&&Ee!==null){switch(Ee.$$typeof){case _:e:{for(var Ft=Ee.key;de!==null;){if(de.key===Ft){if(Ft=Ee.type,Ft===b){if(de.tag===7){p(ve,de.sibling),qe=k(de,Ee.props.children),qe.return=ve,ve=qe;break e}}else if(de.elementType===Ft||typeof Ft=="object"&&Ft!==null&&Ft.$$typeof===x&&Pu(Ft)===de.type){p(ve,de.sibling),qe=k(de,Ee.props),Yp(qe,Ee),qe.return=ve,ve=qe;break e}p(ve,de);break}else l(ve,de);de=de.sibling}Ee.type===b?(qe=Su(Ee.props.children,ve.mode,qe,Ee.key),qe.return=ve,ve=qe):(qe=ny(Ee.type,Ee.key,Ee.props,null,ve.mode,qe),Yp(qe,Ee),qe.return=ve,ve=qe)}return M(ve);case w:e:{for(Ft=Ee.key;de!==null;){if(de.key===Ft)if(de.tag===4&&de.stateNode.containerInfo===Ee.containerInfo&&de.stateNode.implementation===Ee.implementation){p(ve,de.sibling),qe=k(de,Ee.children||[]),qe.return=ve,ve=qe;break e}else{p(ve,de);break}else l(ve,de);de=de.sibling}qe=q0(Ee,ve.mode,qe),qe.return=ve,ve=qe}return M(ve);case x:return Ee=Pu(Ee),Zr(ve,de,Ee,qe)}if(W(Ee))return Pt(ve,de,Ee,qe);if(j(Ee)){if(Ft=j(Ee),typeof Ft!="function")throw Error(n(150));return Ee=Ft.call(Ee),Ht(ve,de,Ee,qe)}if(typeof Ee.then=="function")return Zr(ve,de,uy(Ee),qe);if(Ee.$$typeof===P)return Zr(ve,de,sy(ve,Ee),qe);dy(ve,Ee)}return typeof Ee=="string"&&Ee!==""||typeof Ee=="number"||typeof Ee=="bigint"?(Ee=""+Ee,de!==null&&de.tag===6?(p(ve,de.sibling),qe=k(de,Ee),qe.return=ve,ve=qe):(p(ve,de),qe=F0(Ee,ve.mode,qe),qe.return=ve,ve=qe),M(ve)):p(ve,de)}return function(ve,de,Ee,qe){try{Kp=0;var Ft=Zr(ve,de,Ee,qe);return Ud=null,Ft}catch(Lt){if(Lt===Bd||Lt===cy)throw Lt;var Nr=Ei(29,Lt,null,ve.mode);return Nr.lanes=qe,Nr.return=ve,Nr}finally{}}}var Ru=z1(!0),$1=z1(!1),sl=!1;function Z0(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ek(s,l){s=s.updateQueue,l.updateQueue===s&&(l.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function ol(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function cl(s,l,p){var y=s.updateQueue;if(y===null)return null;if(y=y.shared,(Br&2)!==0){var k=y.pending;return k===null?l.next=l:(l.next=k.next,k.next=l),y.pending=l,l=ry(s),C1(s,null,p),l}return ty(s,y,l,p),ry(s)}function Xp(s,l,p){if(l=l.updateQueue,l!==null&&(l=l.shared,(p&4194048)!==0)){var y=l.lanes;y&=s.pendingLanes,p|=y,l.lanes=p,Qt(s,p)}}function tk(s,l){var p=s.updateQueue,y=s.alternate;if(y!==null&&(y=y.updateQueue,p===y)){var k=null,S=null;if(p=p.firstBaseUpdate,p!==null){do{var M={lane:p.lane,tag:p.tag,payload:p.payload,callback:null,next:null};S===null?k=S=M:S=S.next=M,p=p.next}while(p!==null);S===null?k=S=l:S=S.next=l}else k=S=l;p={baseState:y.baseState,firstBaseUpdate:k,lastBaseUpdate:S,shared:y.shared,callbacks:y.callbacks},s.updateQueue=p;return}s=p.lastBaseUpdate,s===null?p.firstBaseUpdate=l:s.next=l,p.lastBaseUpdate=l}var rk=!1;function Jp(){if(rk){var s=Ld;if(s!==null)throw s}}function Qp(s,l,p,y){rk=!1;var k=s.updateQueue;sl=!1;var S=k.firstBaseUpdate,M=k.lastBaseUpdate,V=k.shared.pending;if(V!==null){k.shared.pending=null;var oe=V,Te=oe.next;oe.next=null,M===null?S=Te:M.next=Te,M=oe;var Ue=s.alternate;Ue!==null&&(Ue=Ue.updateQueue,V=Ue.lastBaseUpdate,V!==M&&(V===null?Ue.firstBaseUpdate=Te:V.next=Te,Ue.lastBaseUpdate=oe))}if(S!==null){var Ge=k.baseState;M=0,Ue=Te=oe=null,V=S;do{var Pe=V.lane&-536870913,Ne=Pe!==V.lane;if(Ne?(br&Pe)===Pe:(y&Pe)===Pe){Pe!==0&&Pe===jd&&(rk=!0),Ue!==null&&(Ue=Ue.next={lane:0,tag:V.tag,payload:V.payload,callback:null,next:null});e:{var Pt=s,Ht=V;Pe=l;var Zr=p;switch(Ht.tag){case 1:if(Pt=Ht.payload,typeof Pt=="function"){Ge=Pt.call(Zr,Ge,Pe);break e}Ge=Pt;break e;case 3:Pt.flags=Pt.flags&-65537|128;case 0:if(Pt=Ht.payload,Pe=typeof Pt=="function"?Pt.call(Zr,Ge,Pe):Pt,Pe==null)break e;Ge=h({},Ge,Pe);break e;case 2:sl=!0}}Pe=V.callback,Pe!==null&&(s.flags|=64,Ne&&(s.flags|=8192),Ne=k.callbacks,Ne===null?k.callbacks=[Pe]:Ne.push(Pe))}else Ne={lane:Pe,tag:V.tag,payload:V.payload,callback:V.callback,next:null},Ue===null?(Te=Ue=Ne,oe=Ge):Ue=Ue.next=Ne,M|=Pe;if(V=V.next,V===null){if(V=k.shared.pending,V===null)break;Ne=V,V=Ne.next,Ne.next=null,k.lastBaseUpdate=Ne,k.shared.pending=null}}while(!0);Ue===null&&(oe=Ge),k.baseState=oe,k.firstBaseUpdate=Te,k.lastBaseUpdate=Ue,S===null&&(k.shared.lanes=0),pl|=M,s.lanes=M,s.memoizedState=Ge}}function V1(s,l){if(typeof s!="function")throw Error(n(191,s));s.call(l)}function H1(s,l){var p=s.callbacks;if(p!==null)for(s.callbacks=null,s=0;s<p.length;s++)V1(p[s],l)}var Fd=B(null),fy=B(0);function G1(s,l){s=_c,ae(fy,s),ae(Fd,l),_c=s|l.baseLanes}function nk(){ae(fy,_c),ae(Fd,Fd.current)}function ak(){_c=fy.current,K(Fd),K(fy)}var Ti=B(null),Qi=null;function ll(s){var l=s.alternate;ae(In,In.current&1),ae(Ti,s),Qi===null&&(l===null||Fd.current!==null||l.memoizedState!==null)&&(Qi=s)}function ik(s){ae(In,In.current),ae(Ti,s),Qi===null&&(Qi=s)}function W1(s){s.tag===22?(ae(In,In.current),ae(Ti,s),Qi===null&&(Qi=s)):ul()}function ul(){ae(In,In.current),ae(Ti,Ti.current)}function Ci(s){K(Ti),Qi===s&&(Qi=null),K(In)}var In=B(0);function py(s){for(var l=s;l!==null;){if(l.tag===13){var p=l.memoizedState;if(p!==null&&(p=p.dehydrated,p===null||dw(p)||fw(p)))return l}else if(l.tag===19&&(l.memoizedProps.revealOrder==="forwards"||l.memoizedProps.revealOrder==="backwards"||l.memoizedProps.revealOrder==="unstable_legacy-backwards"||l.memoizedProps.revealOrder==="together")){if((l.flags&128)!==0)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===s)break;for(;l.sibling===null;){if(l.return===null||l.return===s)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var dc=0,ar=null,Jr=null,zn=null,hy=!1,qd=!1,Du=!1,my=0,Zp=0,zd=null,F$=0;function Cn(){throw Error(n(321))}function sk(s,l){if(l===null)return!1;for(var p=0;p<l.length&&p<s.length;p++)if(!Si(s[p],l[p]))return!1;return!0}function ok(s,l,p,y,k,S){return dc=S,ar=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,F.H=s===null||s.memoizedState===null?RR:wk,Du=!1,S=p(y,k),Du=!1,qd&&(S=Y1(l,p,y,k)),K1(s),S}function K1(s){F.H=rh;var l=Jr!==null&&Jr.next!==null;if(dc=0,zn=Jr=ar=null,hy=!1,Zp=0,zd=null,l)throw Error(n(300));s===null||$n||(s=s.dependencies,s!==null&&iy(s)&&($n=!0))}function Y1(s,l,p,y){ar=s;var k=0;do{if(qd&&(zd=null),Zp=0,qd=!1,25<=k)throw Error(n(301));if(k+=1,zn=Jr=null,s.updateQueue!=null){var S=s.updateQueue;S.lastEffect=null,S.events=null,S.stores=null,S.memoCache!=null&&(S.memoCache.index=0)}F.H=DR,S=l(p,y)}while(qd);return S}function q$(){var s=F.H,l=s.useState()[0];return l=typeof l.then=="function"?eh(l):l,s=s.useState()[0],(Jr!==null?Jr.memoizedState:null)!==s&&(ar.flags|=1024),l}function ck(){var s=my!==0;return my=0,s}function lk(s,l,p){l.updateQueue=s.updateQueue,l.flags&=-2053,s.lanes&=~p}function uk(s){if(hy){for(s=s.memoizedState;s!==null;){var l=s.queue;l!==null&&(l.pending=null),s=s.next}hy=!1}dc=0,zn=Jr=ar=null,qd=!1,Zp=my=0,zd=null}function qa(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return zn===null?ar.memoizedState=zn=s:zn=zn.next=s,zn}function Mn(){if(Jr===null){var s=ar.alternate;s=s!==null?s.memoizedState:null}else s=Jr.next;var l=zn===null?ar.memoizedState:zn.next;if(l!==null)zn=l,Jr=s;else{if(s===null)throw ar.alternate===null?Error(n(467)):Error(n(310));Jr=s,s={memoizedState:Jr.memoizedState,baseState:Jr.baseState,baseQueue:Jr.baseQueue,queue:Jr.queue,next:null},zn===null?ar.memoizedState=zn=s:zn=zn.next=s}return zn}function gy(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function eh(s){var l=Zp;return Zp+=1,zd===null&&(zd=[]),s=U1(zd,s,l),l=ar,(zn===null?l.memoizedState:zn.next)===null&&(l=l.alternate,F.H=l===null||l.memoizedState===null?RR:wk),s}function yy(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return eh(s);if(s.$$typeof===P)return _a(s)}throw Error(n(438,String(s)))}function dk(s){var l=null,p=ar.updateQueue;if(p!==null&&(l=p.memoCache),l==null){var y=ar.alternate;y!==null&&(y=y.updateQueue,y!==null&&(y=y.memoCache,y!=null&&(l={data:y.data.map(function(k){return k.slice()}),index:0})))}if(l==null&&(l={data:[],index:0}),p===null&&(p=gy(),ar.updateQueue=p),p.memoCache=l,p=l.data[l.index],p===void 0)for(p=l.data[l.index]=Array(s),y=0;y<s;y++)p[y]=N;return l.index++,p}function fc(s,l){return typeof l=="function"?l(s):l}function vy(s){var l=Mn();return fk(l,Jr,s)}function fk(s,l,p){var y=s.queue;if(y===null)throw Error(n(311));y.lastRenderedReducer=p;var k=s.baseQueue,S=y.pending;if(S!==null){if(k!==null){var M=k.next;k.next=S.next,S.next=M}l.baseQueue=k=S,y.pending=null}if(S=s.baseState,k===null)s.memoizedState=S;else{l=k.next;var V=M=null,oe=null,Te=l,Ue=!1;do{var Ge=Te.lane&-536870913;if(Ge!==Te.lane?(br&Ge)===Ge:(dc&Ge)===Ge){var Pe=Te.revertLane;if(Pe===0)oe!==null&&(oe=oe.next={lane:0,revertLane:0,gesture:null,action:Te.action,hasEagerState:Te.hasEagerState,eagerState:Te.eagerState,next:null}),Ge===jd&&(Ue=!0);else if((dc&Pe)===Pe){Te=Te.next,Pe===jd&&(Ue=!0);continue}else Ge={lane:0,revertLane:Te.revertLane,gesture:null,action:Te.action,hasEagerState:Te.hasEagerState,eagerState:Te.eagerState,next:null},oe===null?(V=oe=Ge,M=S):oe=oe.next=Ge,ar.lanes|=Pe,pl|=Pe;Ge=Te.action,Du&&p(S,Ge),S=Te.hasEagerState?Te.eagerState:p(S,Ge)}else Pe={lane:Ge,revertLane:Te.revertLane,gesture:Te.gesture,action:Te.action,hasEagerState:Te.hasEagerState,eagerState:Te.eagerState,next:null},oe===null?(V=oe=Pe,M=S):oe=oe.next=Pe,ar.lanes|=Ge,pl|=Ge;Te=Te.next}while(Te!==null&&Te!==l);if(oe===null?M=S:oe.next=V,!Si(S,s.memoizedState)&&($n=!0,Ue&&(p=Ld,p!==null)))throw p;s.memoizedState=S,s.baseState=M,s.baseQueue=oe,y.lastRenderedState=S}return k===null&&(y.lanes=0),[s.memoizedState,y.dispatch]}function pk(s){var l=Mn(),p=l.queue;if(p===null)throw Error(n(311));p.lastRenderedReducer=s;var y=p.dispatch,k=p.pending,S=l.memoizedState;if(k!==null){p.pending=null;var M=k=k.next;do S=s(S,M.action),M=M.next;while(M!==k);Si(S,l.memoizedState)||($n=!0),l.memoizedState=S,l.baseQueue===null&&(l.baseState=S),p.lastRenderedState=S}return[S,y]}function X1(s,l,p){var y=ar,k=Mn(),S=Tr;if(S){if(p===void 0)throw Error(n(407));p=p()}else p=l();var M=!Si((Jr||k).memoizedState,p);if(M&&(k.memoizedState=p,$n=!0),k=k.queue,gk(Z1.bind(null,y,k,s),[s]),k.getSnapshot!==l||M||zn!==null&&zn.memoizedState.tag&1){if(y.flags|=2048,$d(9,{destroy:void 0},Q1.bind(null,y,k,p,l),null),sn===null)throw Error(n(349));S||(dc&127)!==0||J1(y,l,p)}return p}function J1(s,l,p){s.flags|=16384,s={getSnapshot:l,value:p},l=ar.updateQueue,l===null?(l=gy(),ar.updateQueue=l,l.stores=[s]):(p=l.stores,p===null?l.stores=[s]:p.push(s))}function Q1(s,l,p,y){l.value=p,l.getSnapshot=y,eR(l)&&tR(s)}function Z1(s,l,p){return p(function(){eR(l)&&tR(s)})}function eR(s){var l=s.getSnapshot;s=s.value;try{var p=l();return!Si(s,p)}catch{return!0}}function tR(s){var l=wu(s,2);l!==null&&ti(l,s,2)}function hk(s){var l=qa();if(typeof s=="function"){var p=s;if(s=p(),Du){st(!0);try{p()}finally{st(!1)}}}return l.memoizedState=l.baseState=s,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:fc,lastRenderedState:s},l}function rR(s,l,p,y){return s.baseState=p,fk(s,Jr,typeof y=="function"?y:fc)}function z$(s,l,p,y,k){if(ky(s))throw Error(n(485));if(s=l.action,s!==null){var S={payload:k,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(M){S.listeners.push(M)}};F.T!==null?p(!0):S.isTransition=!1,y(S),p=l.pending,p===null?(S.next=l.pending=S,nR(l,S)):(S.next=p.next,l.pending=p.next=S)}}function nR(s,l){var p=l.action,y=l.payload,k=s.state;if(l.isTransition){var S=F.T,M={};F.T=M;try{var V=p(k,y),oe=F.S;oe!==null&&oe(M,V),aR(s,l,V)}catch(Te){mk(s,l,Te)}finally{S!==null&&M.types!==null&&(S.types=M.types),F.T=S}}else try{S=p(k,y),aR(s,l,S)}catch(Te){mk(s,l,Te)}}function aR(s,l,p){p!==null&&typeof p=="object"&&typeof p.then=="function"?p.then(function(y){iR(s,l,y)},function(y){return mk(s,l,y)}):iR(s,l,p)}function iR(s,l,p){l.status="fulfilled",l.value=p,sR(l),s.state=p,l=s.pending,l!==null&&(p=l.next,p===l?s.pending=null:(p=p.next,l.next=p,nR(s,p)))}function mk(s,l,p){var y=s.pending;if(s.pending=null,y!==null){y=y.next;do l.status="rejected",l.reason=p,sR(l),l=l.next;while(l!==y)}s.action=null}function sR(s){s=s.listeners;for(var l=0;l<s.length;l++)(0,s[l])()}function oR(s,l){return l}function cR(s,l){if(Tr){var p=sn.formState;if(p!==null){e:{var y=ar;if(Tr){if(mn){t:{for(var k=mn,S=Ji;k.nodeType!==8;){if(!S){k=null;break t}if(k=Zi(k.nextSibling),k===null){k=null;break t}}S=k.data,k=S==="F!"||S==="F"?k:null}if(k){mn=Zi(k.nextSibling),y=k.data==="F!";break e}}al(y)}y=!1}y&&(l=p[0])}}return p=qa(),p.memoizedState=p.baseState=l,y={pending:null,lanes:0,dispatch:null,lastRenderedReducer:oR,lastRenderedState:l},p.queue=y,p=xR.bind(null,ar,y),y.dispatch=p,y=hk(!1),S=kk.bind(null,ar,!1,y.queue),y=qa(),k={state:l,dispatch:null,action:s,pending:null},y.queue=k,p=z$.bind(null,ar,k,S,p),k.dispatch=p,y.memoizedState=s,[l,p,!1]}function lR(s){var l=Mn();return uR(l,Jr,s)}function uR(s,l,p){if(l=fk(s,l,oR)[0],s=vy(fc)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var y=eh(l)}catch(M){throw M===Bd?cy:M}else y=l;l=Mn();var k=l.queue,S=k.dispatch;return p!==l.memoizedState&&(ar.flags|=2048,$d(9,{destroy:void 0},$$.bind(null,k,p),null)),[y,S,s]}function $$(s,l){s.action=l}function dR(s){var l=Mn(),p=Jr;if(p!==null)return uR(l,p,s);Mn(),l=l.memoizedState,p=Mn();var y=p.queue.dispatch;return p.memoizedState=s,[l,y,!1]}function $d(s,l,p,y){return s={tag:s,create:p,deps:y,inst:l,next:null},l=ar.updateQueue,l===null&&(l=gy(),ar.updateQueue=l),p=l.lastEffect,p===null?l.lastEffect=s.next=s:(y=p.next,p.next=s,s.next=y,l.lastEffect=s),s}function fR(){return Mn().memoizedState}function _y(s,l,p,y){var k=qa();ar.flags|=s,k.memoizedState=$d(1|l,{destroy:void 0},p,y===void 0?null:y)}function by(s,l,p,y){var k=Mn();y=y===void 0?null:y;var S=k.memoizedState.inst;Jr!==null&&y!==null&&sk(y,Jr.memoizedState.deps)?k.memoizedState=$d(l,S,p,y):(ar.flags|=s,k.memoizedState=$d(1|l,S,p,y))}function pR(s,l){_y(8390656,8,s,l)}function gk(s,l){by(2048,8,s,l)}function V$(s){ar.flags|=4;var l=ar.updateQueue;if(l===null)l=gy(),ar.updateQueue=l,l.events=[s];else{var p=l.events;p===null?l.events=[s]:p.push(s)}}function hR(s){var l=Mn().memoizedState;return V$({ref:l,nextImpl:s}),function(){if((Br&2)!==0)throw Error(n(440));return l.impl.apply(void 0,arguments)}}function mR(s,l){return by(4,2,s,l)}function gR(s,l){return by(4,4,s,l)}function yR(s,l){if(typeof l=="function"){s=s();var p=l(s);return function(){typeof p=="function"?p():l(null)}}if(l!=null)return s=s(),l.current=s,function(){l.current=null}}function vR(s,l,p){p=p!=null?p.concat([s]):null,by(4,4,yR.bind(null,l,s),p)}function yk(){}function _R(s,l){var p=Mn();l=l===void 0?null:l;var y=p.memoizedState;return l!==null&&sk(l,y[1])?y[0]:(p.memoizedState=[s,l],s)}function bR(s,l){var p=Mn();l=l===void 0?null:l;var y=p.memoizedState;if(l!==null&&sk(l,y[1]))return y[0];if(y=s(),Du){st(!0);try{s()}finally{st(!1)}}return p.memoizedState=[y,l],y}function vk(s,l,p){return p===void 0||(dc&1073741824)!==0&&(br&261930)===0?s.memoizedState=l:(s.memoizedState=p,s=k2(),ar.lanes|=s,pl|=s,p)}function kR(s,l,p,y){return Si(p,l)?p:Fd.current!==null?(s=vk(s,p,y),Si(s,l)||($n=!0),s):(dc&42)===0||(dc&1073741824)!==0&&(br&261930)===0?($n=!0,s.memoizedState=p):(s=k2(),ar.lanes|=s,pl|=s,l)}function wR(s,l,p,y,k){var S=Y.p;Y.p=S!==0&&8>S?S:8;var M=F.T,V={};F.T=V,kk(s,!1,l,p);try{var oe=k(),Te=F.S;if(Te!==null&&Te(V,oe),oe!==null&&typeof oe=="object"&&typeof oe.then=="function"){var Ue=U$(oe,y);th(s,l,Ue,Ai(s))}else th(s,l,y,Ai(s))}catch(Ge){th(s,l,{then:function(){},status:"rejected",reason:Ge},Ai())}finally{Y.p=S,M!==null&&V.types!==null&&(M.types=V.types),F.T=M}}function H$(){}function _k(s,l,p,y){if(s.tag!==5)throw Error(n(476));var k=SR(s).queue;wR(s,k,l,Q,p===null?H$:function(){return ER(s),p(y)})}function SR(s){var l=s.memoizedState;if(l!==null)return l;l={memoizedState:Q,baseState:Q,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:fc,lastRenderedState:Q},next:null};var p={};return l.next={memoizedState:p,baseState:p,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:fc,lastRenderedState:p},next:null},s.memoizedState=l,s=s.alternate,s!==null&&(s.memoizedState=l),l}function ER(s){var l=SR(s);l.next===null&&(l=s.alternate.memoizedState),th(s,l.next.queue,{},Ai())}function bk(){return _a(vh)}function TR(){return Mn().memoizedState}function CR(){return Mn().memoizedState}function G$(s){for(var l=s.return;l!==null;){switch(l.tag){case 24:case 3:var p=Ai();s=ol(p);var y=cl(l,s,p);y!==null&&(ti(y,l,p),Xp(y,l,p)),l={cache:Y0()},s.payload=l;return}l=l.return}}function W$(s,l,p){var y=Ai();p={lane:y,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},ky(s)?PR(l,p):(p=B0(s,l,p,y),p!==null&&(ti(p,s,y),AR(p,l,y)))}function xR(s,l,p){var y=Ai();th(s,l,p,y)}function th(s,l,p,y){var k={lane:y,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null};if(ky(s))PR(l,k);else{var S=s.alternate;if(s.lanes===0&&(S===null||S.lanes===0)&&(S=l.lastRenderedReducer,S!==null))try{var M=l.lastRenderedState,V=S(M,p);if(k.hasEagerState=!0,k.eagerState=V,Si(V,M))return ty(s,l,k,0),sn===null&&ey(),!1}catch{}finally{}if(p=B0(s,l,k,y),p!==null)return ti(p,s,y),AR(p,l,y),!0}return!1}function kk(s,l,p,y){if(y={lane:2,revertLane:Zk(),gesture:null,action:y,hasEagerState:!1,eagerState:null,next:null},ky(s)){if(l)throw Error(n(479))}else l=B0(s,p,y,2),l!==null&&ti(l,s,2)}function ky(s){var l=s.alternate;return s===ar||l!==null&&l===ar}function PR(s,l){qd=hy=!0;var p=s.pending;p===null?l.next=l:(l.next=p.next,p.next=l),s.pending=l}function AR(s,l,p){if((p&4194048)!==0){var y=l.lanes;y&=s.pendingLanes,p|=y,l.lanes=p,Qt(s,p)}}var rh={readContext:_a,use:yy,useCallback:Cn,useContext:Cn,useEffect:Cn,useImperativeHandle:Cn,useLayoutEffect:Cn,useInsertionEffect:Cn,useMemo:Cn,useReducer:Cn,useRef:Cn,useState:Cn,useDebugValue:Cn,useDeferredValue:Cn,useTransition:Cn,useSyncExternalStore:Cn,useId:Cn,useHostTransitionStatus:Cn,useFormState:Cn,useActionState:Cn,useOptimistic:Cn,useMemoCache:Cn,useCacheRefresh:Cn};rh.useEffectEvent=Cn;var RR={readContext:_a,use:yy,useCallback:function(s,l){return qa().memoizedState=[s,l===void 0?null:l],s},useContext:_a,useEffect:pR,useImperativeHandle:function(s,l,p){p=p!=null?p.concat([s]):null,_y(4194308,4,yR.bind(null,l,s),p)},useLayoutEffect:function(s,l){return _y(4194308,4,s,l)},useInsertionEffect:function(s,l){_y(4,2,s,l)},useMemo:function(s,l){var p=qa();l=l===void 0?null:l;var y=s();if(Du){st(!0);try{s()}finally{st(!1)}}return p.memoizedState=[y,l],y},useReducer:function(s,l,p){var y=qa();if(p!==void 0){var k=p(l);if(Du){st(!0);try{p(l)}finally{st(!1)}}}else k=l;return y.memoizedState=y.baseState=k,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:k},y.queue=s,s=s.dispatch=W$.bind(null,ar,s),[y.memoizedState,s]},useRef:function(s){var l=qa();return s={current:s},l.memoizedState=s},useState:function(s){s=hk(s);var l=s.queue,p=xR.bind(null,ar,l);return l.dispatch=p,[s.memoizedState,p]},useDebugValue:yk,useDeferredValue:function(s,l){var p=qa();return vk(p,s,l)},useTransition:function(){var s=hk(!1);return s=wR.bind(null,ar,s.queue,!0,!1),qa().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,l,p){var y=ar,k=qa();if(Tr){if(p===void 0)throw Error(n(407));p=p()}else{if(p=l(),sn===null)throw Error(n(349));(br&127)!==0||J1(y,l,p)}k.memoizedState=p;var S={value:p,getSnapshot:l};return k.queue=S,pR(Z1.bind(null,y,S,s),[s]),y.flags|=2048,$d(9,{destroy:void 0},Q1.bind(null,y,S,p,l),null),p},useId:function(){var s=qa(),l=sn.identifierPrefix;if(Tr){var p=mo,y=ho;p=(y&~(1<<32-bt(y)-1)).toString(32)+p,l="_"+l+"R_"+p,p=my++,0<p&&(l+="H"+p.toString(32)),l+="_"}else p=F$++,l="_"+l+"r_"+p.toString(32)+"_";return s.memoizedState=l},useHostTransitionStatus:bk,useFormState:cR,useActionState:cR,useOptimistic:function(s){var l=qa();l.memoizedState=l.baseState=s;var p={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=p,l=kk.bind(null,ar,!0,p),p.dispatch=l,[s,l]},useMemoCache:dk,useCacheRefresh:function(){return qa().memoizedState=G$.bind(null,ar)},useEffectEvent:function(s){var l=qa(),p={impl:s};return l.memoizedState=p,function(){if((Br&2)!==0)throw Error(n(440));return p.impl.apply(void 0,arguments)}}},wk={readContext:_a,use:yy,useCallback:_R,useContext:_a,useEffect:gk,useImperativeHandle:vR,useInsertionEffect:mR,useLayoutEffect:gR,useMemo:bR,useReducer:vy,useRef:fR,useState:function(){return vy(fc)},useDebugValue:yk,useDeferredValue:function(s,l){var p=Mn();return kR(p,Jr.memoizedState,s,l)},useTransition:function(){var s=vy(fc)[0],l=Mn().memoizedState;return[typeof s=="boolean"?s:eh(s),l]},useSyncExternalStore:X1,useId:TR,useHostTransitionStatus:bk,useFormState:lR,useActionState:lR,useOptimistic:function(s,l){var p=Mn();return rR(p,Jr,s,l)},useMemoCache:dk,useCacheRefresh:CR};wk.useEffectEvent=hR;var DR={readContext:_a,use:yy,useCallback:_R,useContext:_a,useEffect:gk,useImperativeHandle:vR,useInsertionEffect:mR,useLayoutEffect:gR,useMemo:bR,useReducer:pk,useRef:fR,useState:function(){return pk(fc)},useDebugValue:yk,useDeferredValue:function(s,l){var p=Mn();return Jr===null?vk(p,s,l):kR(p,Jr.memoizedState,s,l)},useTransition:function(){var s=pk(fc)[0],l=Mn().memoizedState;return[typeof s=="boolean"?s:eh(s),l]},useSyncExternalStore:X1,useId:TR,useHostTransitionStatus:bk,useFormState:dR,useActionState:dR,useOptimistic:function(s,l){var p=Mn();return Jr!==null?rR(p,Jr,s,l):(p.baseState=s,[s,p.queue.dispatch])},useMemoCache:dk,useCacheRefresh:CR};DR.useEffectEvent=hR;function Sk(s,l,p,y){l=s.memoizedState,p=p(y,l),p=p==null?l:h({},l,p),s.memoizedState=p,s.lanes===0&&(s.updateQueue.baseState=p)}var Ek={enqueueSetState:function(s,l,p){s=s._reactInternals;var y=Ai(),k=ol(y);k.payload=l,p!=null&&(k.callback=p),l=cl(s,k,y),l!==null&&(ti(l,s,y),Xp(l,s,y))},enqueueReplaceState:function(s,l,p){s=s._reactInternals;var y=Ai(),k=ol(y);k.tag=1,k.payload=l,p!=null&&(k.callback=p),l=cl(s,k,y),l!==null&&(ti(l,s,y),Xp(l,s,y))},enqueueForceUpdate:function(s,l){s=s._reactInternals;var p=Ai(),y=ol(p);y.tag=2,l!=null&&(y.callback=l),l=cl(s,y,p),l!==null&&(ti(l,s,p),Xp(l,s,p))}};function OR(s,l,p,y,k,S,M){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(y,S,M):l.prototype&&l.prototype.isPureReactComponent?!zp(p,y)||!zp(k,S):!0}function NR(s,l,p,y){s=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(p,y),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(p,y),l.state!==s&&Ek.enqueueReplaceState(l,l.state,null)}function Ou(s,l){var p=l;if("ref"in l){p={};for(var y in l)y!=="ref"&&(p[y]=l[y])}if(s=s.defaultProps){p===l&&(p=h({},p));for(var k in s)p[k]===void 0&&(p[k]=s[k])}return p}function IR(s){Zg(s)}function MR(s){}function jR(s){Zg(s)}function wy(s,l){try{var p=s.onUncaughtError;p(l.value,{componentStack:l.stack})}catch(y){setTimeout(function(){throw y})}}function LR(s,l,p){try{var y=s.onCaughtError;y(p.value,{componentStack:p.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(k){setTimeout(function(){throw k})}}function Tk(s,l,p){return p=ol(p),p.tag=3,p.payload={element:null},p.callback=function(){wy(s,l)},p}function BR(s){return s=ol(s),s.tag=3,s}function UR(s,l,p,y){var k=p.type.getDerivedStateFromError;if(typeof k=="function"){var S=y.value;s.payload=function(){return k(S)},s.callback=function(){LR(l,p,y)}}var M=p.stateNode;M!==null&&typeof M.componentDidCatch=="function"&&(s.callback=function(){LR(l,p,y),typeof k!="function"&&(hl===null?hl=new Set([this]):hl.add(this));var V=y.stack;this.componentDidCatch(y.value,{componentStack:V!==null?V:""})})}function K$(s,l,p,y,k){if(p.flags|=32768,y!==null&&typeof y=="object"&&typeof y.then=="function"){if(l=p.alternate,l!==null&&Md(l,p,k,!0),p=Ti.current,p!==null){switch(p.tag){case 31:case 13:return Qi===null?Iy():p.alternate===null&&xn===0&&(xn=3),p.flags&=-257,p.flags|=65536,p.lanes=k,y===ly?p.flags|=16384:(l=p.updateQueue,l===null?p.updateQueue=new Set([y]):l.add(y),Xk(s,y,k)),!1;case 22:return p.flags|=65536,y===ly?p.flags|=16384:(l=p.updateQueue,l===null?(l={transitions:null,markerInstances:null,retryQueue:new Set([y])},p.updateQueue=l):(p=l.retryQueue,p===null?l.retryQueue=new Set([y]):p.add(y)),Xk(s,y,k)),!1}throw Error(n(435,p.tag))}return Xk(s,y,k),Iy(),!1}if(Tr)return l=Ti.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=k,y!==V0&&(s=Error(n(422),{cause:y}),Hp(Ki(s,p)))):(y!==V0&&(l=Error(n(423),{cause:y}),Hp(Ki(l,p))),s=s.current.alternate,s.flags|=65536,k&=-k,s.lanes|=k,y=Ki(y,p),k=Tk(s.stateNode,y,k),tk(s,k),xn!==4&&(xn=2)),!1;var S=Error(n(520),{cause:y});if(S=Ki(S,p),uh===null?uh=[S]:uh.push(S),xn!==4&&(xn=2),l===null)return!0;y=Ki(y,p),p=l;do{switch(p.tag){case 3:return p.flags|=65536,s=k&-k,p.lanes|=s,s=Tk(p.stateNode,y,s),tk(p,s),!1;case 1:if(l=p.type,S=p.stateNode,(p.flags&128)===0&&(typeof l.getDerivedStateFromError=="function"||S!==null&&typeof S.componentDidCatch=="function"&&(hl===null||!hl.has(S))))return p.flags|=65536,k&=-k,p.lanes|=k,k=BR(k),UR(k,s,p,y),tk(p,k),!1}p=p.return}while(p!==null);return!1}var Ck=Error(n(461)),$n=!1;function ba(s,l,p,y){l.child=s===null?$1(l,null,p,y):Ru(l,s.child,p,y)}function FR(s,l,p,y,k){p=p.render;var S=l.ref;if("ref"in y){var M={};for(var V in y)V!=="ref"&&(M[V]=y[V])}else M=y;return Cu(l),y=ok(s,l,p,M,S,k),V=ck(),s!==null&&!$n?(lk(s,l,k),pc(s,l,k)):(Tr&&V&&z0(l),l.flags|=1,ba(s,l,y,k),l.child)}function qR(s,l,p,y,k){if(s===null){var S=p.type;return typeof S=="function"&&!U0(S)&&S.defaultProps===void 0&&p.compare===null?(l.tag=15,l.type=S,zR(s,l,S,y,k)):(s=ny(p.type,null,y,l,l.mode,k),s.ref=l.ref,s.return=l,l.child=s)}if(S=s.child,!Ik(s,k)){var M=S.memoizedProps;if(p=p.compare,p=p!==null?p:zp,p(M,y)&&s.ref===l.ref)return pc(s,l,k)}return l.flags|=1,s=oc(S,y),s.ref=l.ref,s.return=l,l.child=s}function zR(s,l,p,y,k){if(s!==null){var S=s.memoizedProps;if(zp(S,y)&&s.ref===l.ref)if($n=!1,l.pendingProps=y=S,Ik(s,k))(s.flags&131072)!==0&&($n=!0);else return l.lanes=s.lanes,pc(s,l,k)}return xk(s,l,p,y,k)}function $R(s,l,p,y){var k=y.children,S=s!==null?s.memoizedState:null;if(s===null&&l.stateNode===null&&(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),y.mode==="hidden"){if((l.flags&128)!==0){if(S=S!==null?S.baseLanes|p:p,s!==null){for(y=l.child=s.child,k=0;y!==null;)k=k|y.lanes|y.childLanes,y=y.sibling;y=k&~S}else y=0,l.child=null;return VR(s,l,S,p,y)}if((p&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},s!==null&&oy(l,S!==null?S.cachePool:null),S!==null?G1(l,S):nk(),W1(l);else return y=l.lanes=536870912,VR(s,l,S!==null?S.baseLanes|p:p,p,y)}else S!==null?(oy(l,S.cachePool),G1(l,S),ul(),l.memoizedState=null):(s!==null&&oy(l,null),nk(),ul());return ba(s,l,k,p),l.child}function nh(s,l){return s!==null&&s.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function VR(s,l,p,y,k){var S=J0();return S=S===null?null:{parent:qn._currentValue,pool:S},l.memoizedState={baseLanes:p,cachePool:S},s!==null&&oy(l,null),nk(),W1(l),s!==null&&Md(s,l,y,!0),l.childLanes=k,null}function Sy(s,l){return l=Ty({mode:l.mode,children:l.children},s.mode),l.ref=s.ref,s.child=l,l.return=s,l}function HR(s,l,p){return Ru(l,s.child,null,p),s=Sy(l,l.pendingProps),s.flags|=2,Ci(l),l.memoizedState=null,s}function Y$(s,l,p){var y=l.pendingProps,k=(l.flags&128)!==0;if(l.flags&=-129,s===null){if(Tr){if(y.mode==="hidden")return s=Sy(l,y),l.lanes=536870912,nh(null,s);if(ik(l),(s=mn)?(s=nD(s,Ji),s=s!==null&&s.data==="&"?s:null,s!==null&&(l.memoizedState={dehydrated:s,treeContext:rl!==null?{id:ho,overflow:mo}:null,retryLane:536870912,hydrationErrors:null},p=P1(s),p.return=l,l.child=p,va=l,mn=null)):s=null,s===null)throw al(l);return l.lanes=536870912,null}return Sy(l,y)}var S=s.memoizedState;if(S!==null){var M=S.dehydrated;if(ik(l),k)if(l.flags&256)l.flags&=-257,l=HR(s,l,p);else if(l.memoizedState!==null)l.child=s.child,l.flags|=128,l=null;else throw Error(n(558));else if($n||Md(s,l,p,!1),k=(p&s.childLanes)!==0,$n||k){if(y=sn,y!==null&&(M=Zt(y,p),M!==0&&M!==S.retryLane))throw S.retryLane=M,wu(s,M),ti(y,s,M),Ck;Iy(),l=HR(s,l,p)}else s=S.treeContext,mn=Zi(M.nextSibling),va=l,Tr=!0,nl=null,Ji=!1,s!==null&&D1(l,s),l=Sy(l,y),l.flags|=4096;return l}return s=oc(s.child,{mode:y.mode,children:y.children}),s.ref=l.ref,l.child=s,s.return=l,s}function Ey(s,l){var p=l.ref;if(p===null)s!==null&&s.ref!==null&&(l.flags|=4194816);else{if(typeof p!="function"&&typeof p!="object")throw Error(n(284));(s===null||s.ref!==p)&&(l.flags|=4194816)}}function xk(s,l,p,y,k){return Cu(l),p=ok(s,l,p,y,void 0,k),y=ck(),s!==null&&!$n?(lk(s,l,k),pc(s,l,k)):(Tr&&y&&z0(l),l.flags|=1,ba(s,l,p,k),l.child)}function GR(s,l,p,y,k,S){return Cu(l),l.updateQueue=null,p=Y1(l,y,p,k),K1(s),y=ck(),s!==null&&!$n?(lk(s,l,S),pc(s,l,S)):(Tr&&y&&z0(l),l.flags|=1,ba(s,l,p,S),l.child)}function WR(s,l,p,y,k){if(Cu(l),l.stateNode===null){var S=Dd,M=p.contextType;typeof M=="object"&&M!==null&&(S=_a(M)),S=new p(y,S),l.memoizedState=S.state!==null&&S.state!==void 0?S.state:null,S.updater=Ek,l.stateNode=S,S._reactInternals=l,S=l.stateNode,S.props=y,S.state=l.memoizedState,S.refs={},Z0(l),M=p.contextType,S.context=typeof M=="object"&&M!==null?_a(M):Dd,S.state=l.memoizedState,M=p.getDerivedStateFromProps,typeof M=="function"&&(Sk(l,p,M,y),S.state=l.memoizedState),typeof p.getDerivedStateFromProps=="function"||typeof S.getSnapshotBeforeUpdate=="function"||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(M=S.state,typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount(),M!==S.state&&Ek.enqueueReplaceState(S,S.state,null),Qp(l,y,S,k),Jp(),S.state=l.memoizedState),typeof S.componentDidMount=="function"&&(l.flags|=4194308),y=!0}else if(s===null){S=l.stateNode;var V=l.memoizedProps,oe=Ou(p,V);S.props=oe;var Te=S.context,Ue=p.contextType;M=Dd,typeof Ue=="object"&&Ue!==null&&(M=_a(Ue));var Ge=p.getDerivedStateFromProps;Ue=typeof Ge=="function"||typeof S.getSnapshotBeforeUpdate=="function",V=l.pendingProps!==V,Ue||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(V||Te!==M)&&NR(l,S,y,M),sl=!1;var Pe=l.memoizedState;S.state=Pe,Qp(l,y,S,k),Jp(),Te=l.memoizedState,V||Pe!==Te||sl?(typeof Ge=="function"&&(Sk(l,p,Ge,y),Te=l.memoizedState),(oe=sl||OR(l,p,oe,y,Pe,Te,M))?(Ue||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount()),typeof S.componentDidMount=="function"&&(l.flags|=4194308)):(typeof S.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=y,l.memoizedState=Te),S.props=y,S.state=Te,S.context=M,y=oe):(typeof S.componentDidMount=="function"&&(l.flags|=4194308),y=!1)}else{S=l.stateNode,ek(s,l),M=l.memoizedProps,Ue=Ou(p,M),S.props=Ue,Ge=l.pendingProps,Pe=S.context,Te=p.contextType,oe=Dd,typeof Te=="object"&&Te!==null&&(oe=_a(Te)),V=p.getDerivedStateFromProps,(Te=typeof V=="function"||typeof S.getSnapshotBeforeUpdate=="function")||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(M!==Ge||Pe!==oe)&&NR(l,S,y,oe),sl=!1,Pe=l.memoizedState,S.state=Pe,Qp(l,y,S,k),Jp();var Ne=l.memoizedState;M!==Ge||Pe!==Ne||sl||s!==null&&s.dependencies!==null&&iy(s.dependencies)?(typeof V=="function"&&(Sk(l,p,V,y),Ne=l.memoizedState),(Ue=sl||OR(l,p,Ue,y,Pe,Ne,oe)||s!==null&&s.dependencies!==null&&iy(s.dependencies))?(Te||typeof S.UNSAFE_componentWillUpdate!="function"&&typeof S.componentWillUpdate!="function"||(typeof S.componentWillUpdate=="function"&&S.componentWillUpdate(y,Ne,oe),typeof S.UNSAFE_componentWillUpdate=="function"&&S.UNSAFE_componentWillUpdate(y,Ne,oe)),typeof S.componentDidUpdate=="function"&&(l.flags|=4),typeof S.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof S.componentDidUpdate!="function"||M===s.memoizedProps&&Pe===s.memoizedState||(l.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||M===s.memoizedProps&&Pe===s.memoizedState||(l.flags|=1024),l.memoizedProps=y,l.memoizedState=Ne),S.props=y,S.state=Ne,S.context=oe,y=Ue):(typeof S.componentDidUpdate!="function"||M===s.memoizedProps&&Pe===s.memoizedState||(l.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||M===s.memoizedProps&&Pe===s.memoizedState||(l.flags|=1024),y=!1)}return S=y,Ey(s,l),y=(l.flags&128)!==0,S||y?(S=l.stateNode,p=y&&typeof p.getDerivedStateFromError!="function"?null:S.render(),l.flags|=1,s!==null&&y?(l.child=Ru(l,s.child,null,k),l.child=Ru(l,null,p,k)):ba(s,l,p,k),l.memoizedState=S.state,s=l.child):s=pc(s,l,k),s}function KR(s,l,p,y){return Eu(),l.flags|=256,ba(s,l,p,y),l.child}var Pk={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Ak(s){return{baseLanes:s,cachePool:L1()}}function Rk(s,l,p){return s=s!==null?s.childLanes&~p:0,l&&(s|=Pi),s}function YR(s,l,p){var y=l.pendingProps,k=!1,S=(l.flags&128)!==0,M;if((M=S)||(M=s!==null&&s.memoizedState===null?!1:(In.current&2)!==0),M&&(k=!0,l.flags&=-129),M=(l.flags&32)!==0,l.flags&=-33,s===null){if(Tr){if(k?ll(l):ul(),(s=mn)?(s=nD(s,Ji),s=s!==null&&s.data!=="&"?s:null,s!==null&&(l.memoizedState={dehydrated:s,treeContext:rl!==null?{id:ho,overflow:mo}:null,retryLane:536870912,hydrationErrors:null},p=P1(s),p.return=l,l.child=p,va=l,mn=null)):s=null,s===null)throw al(l);return fw(s)?l.lanes=32:l.lanes=536870912,null}var V=y.children;return y=y.fallback,k?(ul(),k=l.mode,V=Ty({mode:"hidden",children:V},k),y=Su(y,k,p,null),V.return=l,y.return=l,V.sibling=y,l.child=V,y=l.child,y.memoizedState=Ak(p),y.childLanes=Rk(s,M,p),l.memoizedState=Pk,nh(null,y)):(ll(l),Dk(l,V))}var oe=s.memoizedState;if(oe!==null&&(V=oe.dehydrated,V!==null)){if(S)l.flags&256?(ll(l),l.flags&=-257,l=Ok(s,l,p)):l.memoizedState!==null?(ul(),l.child=s.child,l.flags|=128,l=null):(ul(),V=y.fallback,k=l.mode,y=Ty({mode:"visible",children:y.children},k),V=Su(V,k,p,null),V.flags|=2,y.return=l,V.return=l,y.sibling=V,l.child=y,Ru(l,s.child,null,p),y=l.child,y.memoizedState=Ak(p),y.childLanes=Rk(s,M,p),l.memoizedState=Pk,l=nh(null,y));else if(ll(l),fw(V)){if(M=V.nextSibling&&V.nextSibling.dataset,M)var Te=M.dgst;M=Te,y=Error(n(419)),y.stack="",y.digest=M,Hp({value:y,source:null,stack:null}),l=Ok(s,l,p)}else if($n||Md(s,l,p,!1),M=(p&s.childLanes)!==0,$n||M){if(M=sn,M!==null&&(y=Zt(M,p),y!==0&&y!==oe.retryLane))throw oe.retryLane=y,wu(s,y),ti(M,s,y),Ck;dw(V)||Iy(),l=Ok(s,l,p)}else dw(V)?(l.flags|=192,l.child=s.child,l=null):(s=oe.treeContext,mn=Zi(V.nextSibling),va=l,Tr=!0,nl=null,Ji=!1,s!==null&&D1(l,s),l=Dk(l,y.children),l.flags|=4096);return l}return k?(ul(),V=y.fallback,k=l.mode,oe=s.child,Te=oe.sibling,y=oc(oe,{mode:"hidden",children:y.children}),y.subtreeFlags=oe.subtreeFlags&65011712,Te!==null?V=oc(Te,V):(V=Su(V,k,p,null),V.flags|=2),V.return=l,y.return=l,y.sibling=V,l.child=y,nh(null,y),y=l.child,V=s.child.memoizedState,V===null?V=Ak(p):(k=V.cachePool,k!==null?(oe=qn._currentValue,k=k.parent!==oe?{parent:oe,pool:oe}:k):k=L1(),V={baseLanes:V.baseLanes|p,cachePool:k}),y.memoizedState=V,y.childLanes=Rk(s,M,p),l.memoizedState=Pk,nh(s.child,y)):(ll(l),p=s.child,s=p.sibling,p=oc(p,{mode:"visible",children:y.children}),p.return=l,p.sibling=null,s!==null&&(M=l.deletions,M===null?(l.deletions=[s],l.flags|=16):M.push(s)),l.child=p,l.memoizedState=null,p)}function Dk(s,l){return l=Ty({mode:"visible",children:l},s.mode),l.return=s,s.child=l}function Ty(s,l){return s=Ei(22,s,null,l),s.lanes=0,s}function Ok(s,l,p){return Ru(l,s.child,null,p),s=Dk(l,l.pendingProps.children),s.flags|=2,l.memoizedState=null,s}function XR(s,l,p){s.lanes|=l;var y=s.alternate;y!==null&&(y.lanes|=l),W0(s.return,l,p)}function Nk(s,l,p,y,k,S){var M=s.memoizedState;M===null?s.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:y,tail:p,tailMode:k,treeForkCount:S}:(M.isBackwards=l,M.rendering=null,M.renderingStartTime=0,M.last=y,M.tail=p,M.tailMode=k,M.treeForkCount=S)}function JR(s,l,p){var y=l.pendingProps,k=y.revealOrder,S=y.tail;y=y.children;var M=In.current,V=(M&2)!==0;if(V?(M=M&1|2,l.flags|=128):M&=1,ae(In,M),ba(s,l,y,p),y=Tr?Vp:0,!V&&s!==null&&(s.flags&128)!==0)e:for(s=l.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&XR(s,p,l);else if(s.tag===19)XR(s,p,l);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===l)break e;for(;s.sibling===null;){if(s.return===null||s.return===l)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(k){case"forwards":for(p=l.child,k=null;p!==null;)s=p.alternate,s!==null&&py(s)===null&&(k=p),p=p.sibling;p=k,p===null?(k=l.child,l.child=null):(k=p.sibling,p.sibling=null),Nk(l,!1,k,p,S,y);break;case"backwards":case"unstable_legacy-backwards":for(p=null,k=l.child,l.child=null;k!==null;){if(s=k.alternate,s!==null&&py(s)===null){l.child=k;break}s=k.sibling,k.sibling=p,p=k,k=s}Nk(l,!0,p,null,S,y);break;case"together":Nk(l,!1,null,null,void 0,y);break;default:l.memoizedState=null}return l.child}function pc(s,l,p){if(s!==null&&(l.dependencies=s.dependencies),pl|=l.lanes,(p&l.childLanes)===0)if(s!==null){if(Md(s,l,p,!1),(p&l.childLanes)===0)return null}else return null;if(s!==null&&l.child!==s.child)throw Error(n(153));if(l.child!==null){for(s=l.child,p=oc(s,s.pendingProps),l.child=p,p.return=l;s.sibling!==null;)s=s.sibling,p=p.sibling=oc(s,s.pendingProps),p.return=l;p.sibling=null}return l.child}function Ik(s,l){return(s.lanes&l)!==0?!0:(s=s.dependencies,!!(s!==null&&iy(s)))}function X$(s,l,p){switch(l.tag){case 3:He(l,l.stateNode.containerInfo),il(l,qn,s.memoizedState.cache),Eu();break;case 27:case 5:xe(l);break;case 4:He(l,l.stateNode.containerInfo);break;case 10:il(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,ik(l),null;break;case 13:var y=l.memoizedState;if(y!==null)return y.dehydrated!==null?(ll(l),l.flags|=128,null):(p&l.child.childLanes)!==0?YR(s,l,p):(ll(l),s=pc(s,l,p),s!==null?s.sibling:null);ll(l);break;case 19:var k=(s.flags&128)!==0;if(y=(p&l.childLanes)!==0,y||(Md(s,l,p,!1),y=(p&l.childLanes)!==0),k){if(y)return JR(s,l,p);l.flags|=128}if(k=l.memoizedState,k!==null&&(k.rendering=null,k.tail=null,k.lastEffect=null),ae(In,In.current),y)break;return null;case 22:return l.lanes=0,$R(s,l,p,l.pendingProps);case 24:il(l,qn,s.memoizedState.cache)}return pc(s,l,p)}function QR(s,l,p){if(s!==null)if(s.memoizedProps!==l.pendingProps)$n=!0;else{if(!Ik(s,p)&&(l.flags&128)===0)return $n=!1,X$(s,l,p);$n=(s.flags&131072)!==0}else $n=!1,Tr&&(l.flags&1048576)!==0&&R1(l,Vp,l.index);switch(l.lanes=0,l.tag){case 16:e:{var y=l.pendingProps;if(s=Pu(l.elementType),l.type=s,typeof s=="function")U0(s)?(y=Ou(s,y),l.tag=1,l=WR(null,l,s,y,p)):(l.tag=0,l=xk(null,l,s,y,p));else{if(s!=null){var k=s.$$typeof;if(k===A){l.tag=11,l=FR(null,l,s,y,p);break e}else if(k===I){l.tag=14,l=qR(null,l,s,y,p);break e}}throw l=U(s)||s,Error(n(306,l,""))}}return l;case 0:return xk(s,l,l.type,l.pendingProps,p);case 1:return y=l.type,k=Ou(y,l.pendingProps),WR(s,l,y,k,p);case 3:e:{if(He(l,l.stateNode.containerInfo),s===null)throw Error(n(387));y=l.pendingProps;var S=l.memoizedState;k=S.element,ek(s,l),Qp(l,y,null,p);var M=l.memoizedState;if(y=M.cache,il(l,qn,y),y!==S.cache&&K0(l,[qn],p,!0),Jp(),y=M.element,S.isDehydrated)if(S={element:y,isDehydrated:!1,cache:M.cache},l.updateQueue.baseState=S,l.memoizedState=S,l.flags&256){l=KR(s,l,y,p);break e}else if(y!==k){k=Ki(Error(n(424)),l),Hp(k),l=KR(s,l,y,p);break e}else{switch(s=l.stateNode.containerInfo,s.nodeType){case 9:s=s.body;break;default:s=s.nodeName==="HTML"?s.ownerDocument.body:s}for(mn=Zi(s.firstChild),va=l,Tr=!0,nl=null,Ji=!0,p=$1(l,null,y,p),l.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling}else{if(Eu(),y===k){l=pc(s,l,p);break e}ba(s,l,y,p)}l=l.child}return l;case 26:return Ey(s,l),s===null?(p=lD(l.type,null,l.pendingProps,null))?l.memoizedState=p:Tr||(p=l.type,s=l.pendingProps,y=qy(ue.current).createElement(p),y[Rt]=l,y[Dt]=s,ka(y,p,s),hn(y),l.stateNode=y):l.memoizedState=lD(l.type,s.memoizedProps,l.pendingProps,s.memoizedState),null;case 27:return xe(l),s===null&&Tr&&(y=l.stateNode=sD(l.type,l.pendingProps,ue.current),va=l,Ji=!0,k=mn,vl(l.type)?(pw=k,mn=Zi(y.firstChild)):mn=k),ba(s,l,l.pendingProps.children,p),Ey(s,l),s===null&&(l.flags|=4194304),l.child;case 5:return s===null&&Tr&&((k=y=mn)&&(y=C8(y,l.type,l.pendingProps,Ji),y!==null?(l.stateNode=y,va=l,mn=Zi(y.firstChild),Ji=!1,k=!0):k=!1),k||al(l)),xe(l),k=l.type,S=l.pendingProps,M=s!==null?s.memoizedProps:null,y=S.children,cw(k,S)?y=null:M!==null&&cw(k,M)&&(l.flags|=32),l.memoizedState!==null&&(k=ok(s,l,q$,null,null,p),vh._currentValue=k),Ey(s,l),ba(s,l,y,p),l.child;case 6:return s===null&&Tr&&((s=p=mn)&&(p=x8(p,l.pendingProps,Ji),p!==null?(l.stateNode=p,va=l,mn=null,s=!0):s=!1),s||al(l)),null;case 13:return YR(s,l,p);case 4:return He(l,l.stateNode.containerInfo),y=l.pendingProps,s===null?l.child=Ru(l,null,y,p):ba(s,l,y,p),l.child;case 11:return FR(s,l,l.type,l.pendingProps,p);case 7:return ba(s,l,l.pendingProps,p),l.child;case 8:return ba(s,l,l.pendingProps.children,p),l.child;case 12:return ba(s,l,l.pendingProps.children,p),l.child;case 10:return y=l.pendingProps,il(l,l.type,y.value),ba(s,l,y.children,p),l.child;case 9:return k=l.type._context,y=l.pendingProps.children,Cu(l),k=_a(k),y=y(k),l.flags|=1,ba(s,l,y,p),l.child;case 14:return qR(s,l,l.type,l.pendingProps,p);case 15:return zR(s,l,l.type,l.pendingProps,p);case 19:return JR(s,l,p);case 31:return Y$(s,l,p);case 22:return $R(s,l,p,l.pendingProps);case 24:return Cu(l),y=_a(qn),s===null?(k=J0(),k===null&&(k=sn,S=Y0(),k.pooledCache=S,S.refCount++,S!==null&&(k.pooledCacheLanes|=p),k=S),l.memoizedState={parent:y,cache:k},Z0(l),il(l,qn,k)):((s.lanes&p)!==0&&(ek(s,l),Qp(l,null,null,p),Jp()),k=s.memoizedState,S=l.memoizedState,k.parent!==y?(k={parent:y,cache:y},l.memoizedState=k,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=k),il(l,qn,y)):(y=S.cache,il(l,qn,y),y!==k.cache&&K0(l,[qn],p,!0))),ba(s,l,l.pendingProps.children,p),l.child;case 29:throw l.pendingProps}throw Error(n(156,l.tag))}function hc(s){s.flags|=4}function Mk(s,l,p,y,k){if((l=(s.mode&32)!==0)&&(l=!1),l){if(s.flags|=16777216,(k&335544128)===k)if(s.stateNode.complete)s.flags|=8192;else if(T2())s.flags|=8192;else throw Au=ly,Q0}else s.flags&=-16777217}function ZR(s,l){if(l.type!=="stylesheet"||(l.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!hD(l))if(T2())s.flags|=8192;else throw Au=ly,Q0}function Cy(s,l){l!==null&&(s.flags|=4),s.flags&16384&&(l=s.tag!==22?ee():536870912,s.lanes|=l,Wd|=l)}function ah(s,l){if(!Tr)switch(s.tailMode){case"hidden":l=s.tail;for(var p=null;l!==null;)l.alternate!==null&&(p=l),l=l.sibling;p===null?s.tail=null:p.sibling=null;break;case"collapsed":p=s.tail;for(var y=null;p!==null;)p.alternate!==null&&(y=p),p=p.sibling;y===null?l||s.tail===null?s.tail=null:s.tail.sibling=null:y.sibling=null}}function gn(s){var l=s.alternate!==null&&s.alternate.child===s.child,p=0,y=0;if(l)for(var k=s.child;k!==null;)p|=k.lanes|k.childLanes,y|=k.subtreeFlags&65011712,y|=k.flags&65011712,k.return=s,k=k.sibling;else for(k=s.child;k!==null;)p|=k.lanes|k.childLanes,y|=k.subtreeFlags,y|=k.flags,k.return=s,k=k.sibling;return s.subtreeFlags|=y,s.childLanes=p,l}function J$(s,l,p){var y=l.pendingProps;switch($0(l),l.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return gn(l),null;case 1:return gn(l),null;case 3:return p=l.stateNode,y=null,s!==null&&(y=s.memoizedState.cache),l.memoizedState.cache!==y&&(l.flags|=2048),uc(qn),ce(),p.pendingContext&&(p.context=p.pendingContext,p.pendingContext=null),(s===null||s.child===null)&&(Id(l)?hc(l):s===null||s.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,H0())),gn(l),null;case 26:var k=l.type,S=l.memoizedState;return s===null?(hc(l),S!==null?(gn(l),ZR(l,S)):(gn(l),Mk(l,k,null,y,p))):S?S!==s.memoizedState?(hc(l),gn(l),ZR(l,S)):(gn(l),l.flags&=-16777217):(s=s.memoizedProps,s!==y&&hc(l),gn(l),Mk(l,k,s,y,p)),null;case 27:if(re(l),p=ue.current,k=l.type,s!==null&&l.stateNode!=null)s.memoizedProps!==y&&hc(l);else{if(!y){if(l.stateNode===null)throw Error(n(166));return gn(l),null}s=te.current,Id(l)?O1(l):(s=sD(k,y,p),l.stateNode=s,hc(l))}return gn(l),null;case 5:if(re(l),k=l.type,s!==null&&l.stateNode!=null)s.memoizedProps!==y&&hc(l);else{if(!y){if(l.stateNode===null)throw Error(n(166));return gn(l),null}if(S=te.current,Id(l))O1(l);else{var M=qy(ue.current);switch(S){case 1:S=M.createElementNS("http://www.w3.org/2000/svg",k);break;case 2:S=M.createElementNS("http://www.w3.org/1998/Math/MathML",k);break;default:switch(k){case"svg":S=M.createElementNS("http://www.w3.org/2000/svg",k);break;case"math":S=M.createElementNS("http://www.w3.org/1998/Math/MathML",k);break;case"script":S=M.createElement("div"),S.innerHTML="<script><\/script>",S=S.removeChild(S.firstChild);break;case"select":S=typeof y.is=="string"?M.createElement("select",{is:y.is}):M.createElement("select"),y.multiple?S.multiple=!0:y.size&&(S.size=y.size);break;default:S=typeof y.is=="string"?M.createElement(k,{is:y.is}):M.createElement(k)}}S[Rt]=l,S[Dt]=y;e:for(M=l.child;M!==null;){if(M.tag===5||M.tag===6)S.appendChild(M.stateNode);else if(M.tag!==4&&M.tag!==27&&M.child!==null){M.child.return=M,M=M.child;continue}if(M===l)break e;for(;M.sibling===null;){if(M.return===null||M.return===l)break e;M=M.return}M.sibling.return=M.return,M=M.sibling}l.stateNode=S;e:switch(ka(S,k,y),k){case"button":case"input":case"select":case"textarea":y=!!y.autoFocus;break e;case"img":y=!0;break e;default:y=!1}y&&hc(l)}}return gn(l),Mk(l,l.type,s===null?null:s.memoizedProps,l.pendingProps,p),null;case 6:if(s&&l.stateNode!=null)s.memoizedProps!==y&&hc(l);else{if(typeof y!="string"&&l.stateNode===null)throw Error(n(166));if(s=ue.current,Id(l)){if(s=l.stateNode,p=l.memoizedProps,y=null,k=va,k!==null)switch(k.tag){case 27:case 5:y=k.memoizedProps}s[Rt]=l,s=!!(s.nodeValue===p||y!==null&&y.suppressHydrationWarning===!0||Y2(s.nodeValue,p)),s||al(l,!0)}else s=qy(s).createTextNode(y),s[Rt]=l,l.stateNode=s}return gn(l),null;case 31:if(p=l.memoizedState,s===null||s.memoizedState!==null){if(y=Id(l),p!==null){if(s===null){if(!y)throw Error(n(318));if(s=l.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(557));s[Rt]=l}else Eu(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;gn(l),s=!1}else p=H0(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=p),s=!0;if(!s)return l.flags&256?(Ci(l),l):(Ci(l),null);if((l.flags&128)!==0)throw Error(n(558))}return gn(l),null;case 13:if(y=l.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(k=Id(l),y!==null&&y.dehydrated!==null){if(s===null){if(!k)throw Error(n(318));if(k=l.memoizedState,k=k!==null?k.dehydrated:null,!k)throw Error(n(317));k[Rt]=l}else Eu(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;gn(l),k=!1}else k=H0(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=k),k=!0;if(!k)return l.flags&256?(Ci(l),l):(Ci(l),null)}return Ci(l),(l.flags&128)!==0?(l.lanes=p,l):(p=y!==null,s=s!==null&&s.memoizedState!==null,p&&(y=l.child,k=null,y.alternate!==null&&y.alternate.memoizedState!==null&&y.alternate.memoizedState.cachePool!==null&&(k=y.alternate.memoizedState.cachePool.pool),S=null,y.memoizedState!==null&&y.memoizedState.cachePool!==null&&(S=y.memoizedState.cachePool.pool),S!==k&&(y.flags|=2048)),p!==s&&p&&(l.child.flags|=8192),Cy(l,l.updateQueue),gn(l),null);case 4:return ce(),s===null&&nw(l.stateNode.containerInfo),gn(l),null;case 10:return uc(l.type),gn(l),null;case 19:if(K(In),y=l.memoizedState,y===null)return gn(l),null;if(k=(l.flags&128)!==0,S=y.rendering,S===null)if(k)ah(y,!1);else{if(xn!==0||s!==null&&(s.flags&128)!==0)for(s=l.child;s!==null;){if(S=py(s),S!==null){for(l.flags|=128,ah(y,!1),s=S.updateQueue,l.updateQueue=s,Cy(l,s),l.subtreeFlags=0,s=p,p=l.child;p!==null;)x1(p,s),p=p.sibling;return ae(In,In.current&1|2),Tr&&cc(l,y.treeForkCount),l.child}s=s.sibling}y.tail!==null&&_t()>Dy&&(l.flags|=128,k=!0,ah(y,!1),l.lanes=4194304)}else{if(!k)if(s=py(S),s!==null){if(l.flags|=128,k=!0,s=s.updateQueue,l.updateQueue=s,Cy(l,s),ah(y,!0),y.tail===null&&y.tailMode==="hidden"&&!S.alternate&&!Tr)return gn(l),null}else 2*_t()-y.renderingStartTime>Dy&&p!==536870912&&(l.flags|=128,k=!0,ah(y,!1),l.lanes=4194304);y.isBackwards?(S.sibling=l.child,l.child=S):(s=y.last,s!==null?s.sibling=S:l.child=S,y.last=S)}return y.tail!==null?(s=y.tail,y.rendering=s,y.tail=s.sibling,y.renderingStartTime=_t(),s.sibling=null,p=In.current,ae(In,k?p&1|2:p&1),Tr&&cc(l,y.treeForkCount),s):(gn(l),null);case 22:case 23:return Ci(l),ak(),y=l.memoizedState!==null,s!==null?s.memoizedState!==null!==y&&(l.flags|=8192):y&&(l.flags|=8192),y?(p&536870912)!==0&&(l.flags&128)===0&&(gn(l),l.subtreeFlags&6&&(l.flags|=8192)):gn(l),p=l.updateQueue,p!==null&&Cy(l,p.retryQueue),p=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(p=s.memoizedState.cachePool.pool),y=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(y=l.memoizedState.cachePool.pool),y!==p&&(l.flags|=2048),s!==null&&K(xu),null;case 24:return p=null,s!==null&&(p=s.memoizedState.cache),l.memoizedState.cache!==p&&(l.flags|=2048),uc(qn),gn(l),null;case 25:return null;case 30:return null}throw Error(n(156,l.tag))}function Q$(s,l){switch($0(l),l.tag){case 1:return s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 3:return uc(qn),ce(),s=l.flags,(s&65536)!==0&&(s&128)===0?(l.flags=s&-65537|128,l):null;case 26:case 27:case 5:return re(l),null;case 31:if(l.memoizedState!==null){if(Ci(l),l.alternate===null)throw Error(n(340));Eu()}return s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 13:if(Ci(l),s=l.memoizedState,s!==null&&s.dehydrated!==null){if(l.alternate===null)throw Error(n(340));Eu()}return s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 19:return K(In),null;case 4:return ce(),null;case 10:return uc(l.type),null;case 22:case 23:return Ci(l),ak(),s!==null&&K(xu),s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 24:return uc(qn),null;case 25:return null;default:return null}}function e2(s,l){switch($0(l),l.tag){case 3:uc(qn),ce();break;case 26:case 27:case 5:re(l);break;case 4:ce();break;case 31:l.memoizedState!==null&&Ci(l);break;case 13:Ci(l);break;case 19:K(In);break;case 10:uc(l.type);break;case 22:case 23:Ci(l),ak(),s!==null&&K(xu);break;case 24:uc(qn)}}function ih(s,l){try{var p=l.updateQueue,y=p!==null?p.lastEffect:null;if(y!==null){var k=y.next;p=k;do{if((p.tag&s)===s){y=void 0;var S=p.create,M=p.inst;y=S(),M.destroy=y}p=p.next}while(p!==k)}}catch(V){Kr(l,l.return,V)}}function dl(s,l,p){try{var y=l.updateQueue,k=y!==null?y.lastEffect:null;if(k!==null){var S=k.next;y=S;do{if((y.tag&s)===s){var M=y.inst,V=M.destroy;if(V!==void 0){M.destroy=void 0,k=l;var oe=p,Te=V;try{Te()}catch(Ue){Kr(k,oe,Ue)}}}y=y.next}while(y!==S)}}catch(Ue){Kr(l,l.return,Ue)}}function t2(s){var l=s.updateQueue;if(l!==null){var p=s.stateNode;try{H1(l,p)}catch(y){Kr(s,s.return,y)}}}function r2(s,l,p){p.props=Ou(s.type,s.memoizedProps),p.state=s.memoizedState;try{p.componentWillUnmount()}catch(y){Kr(s,l,y)}}function sh(s,l){try{var p=s.ref;if(p!==null){switch(s.tag){case 26:case 27:case 5:var y=s.stateNode;break;case 30:y=s.stateNode;break;default:y=s.stateNode}typeof p=="function"?s.refCleanup=p(y):p.current=y}}catch(k){Kr(s,l,k)}}function go(s,l){var p=s.ref,y=s.refCleanup;if(p!==null)if(typeof y=="function")try{y()}catch(k){Kr(s,l,k)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof p=="function")try{p(null)}catch(k){Kr(s,l,k)}else p.current=null}function n2(s){var l=s.type,p=s.memoizedProps,y=s.stateNode;try{e:switch(l){case"button":case"input":case"select":case"textarea":p.autoFocus&&y.focus();break e;case"img":p.src?y.src=p.src:p.srcSet&&(y.srcset=p.srcSet)}}catch(k){Kr(s,s.return,k)}}function jk(s,l,p){try{var y=s.stateNode;b8(y,s.type,p,l),y[Dt]=l}catch(k){Kr(s,s.return,k)}}function a2(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&vl(s.type)||s.tag===4}function Lk(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||a2(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&vl(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function Bk(s,l,p){var y=s.tag;if(y===5||y===6)s=s.stateNode,l?(p.nodeType===9?p.body:p.nodeName==="HTML"?p.ownerDocument.body:p).insertBefore(s,l):(l=p.nodeType===9?p.body:p.nodeName==="HTML"?p.ownerDocument.body:p,l.appendChild(s),p=p._reactRootContainer,p!=null||l.onclick!==null||(l.onclick=ya));else if(y!==4&&(y===27&&vl(s.type)&&(p=s.stateNode,l=null),s=s.child,s!==null))for(Bk(s,l,p),s=s.sibling;s!==null;)Bk(s,l,p),s=s.sibling}function xy(s,l,p){var y=s.tag;if(y===5||y===6)s=s.stateNode,l?p.insertBefore(s,l):p.appendChild(s);else if(y!==4&&(y===27&&vl(s.type)&&(p=s.stateNode),s=s.child,s!==null))for(xy(s,l,p),s=s.sibling;s!==null;)xy(s,l,p),s=s.sibling}function i2(s){var l=s.stateNode,p=s.memoizedProps;try{for(var y=s.type,k=l.attributes;k.length;)l.removeAttributeNode(k[0]);ka(l,y,p),l[Rt]=s,l[Dt]=p}catch(S){Kr(s,s.return,S)}}var mc=!1,Vn=!1,Uk=!1,s2=typeof WeakSet=="function"?WeakSet:Set,ua=null;function Z$(s,l){if(s=s.containerInfo,sw=Ky,s=v1(s),O0(s)){if("selectionStart"in s)var p={start:s.selectionStart,end:s.selectionEnd};else e:{p=(p=s.ownerDocument)&&p.defaultView||window;var y=p.getSelection&&p.getSelection();if(y&&y.rangeCount!==0){p=y.anchorNode;var k=y.anchorOffset,S=y.focusNode;y=y.focusOffset;try{p.nodeType,S.nodeType}catch{p=null;break e}var M=0,V=-1,oe=-1,Te=0,Ue=0,Ge=s,Pe=null;t:for(;;){for(var Ne;Ge!==p||k!==0&&Ge.nodeType!==3||(V=M+k),Ge!==S||y!==0&&Ge.nodeType!==3||(oe=M+y),Ge.nodeType===3&&(M+=Ge.nodeValue.length),(Ne=Ge.firstChild)!==null;)Pe=Ge,Ge=Ne;for(;;){if(Ge===s)break t;if(Pe===p&&++Te===k&&(V=M),Pe===S&&++Ue===y&&(oe=M),(Ne=Ge.nextSibling)!==null)break;Ge=Pe,Pe=Ge.parentNode}Ge=Ne}p=V===-1||oe===-1?null:{start:V,end:oe}}else p=null}p=p||{start:0,end:0}}else p=null;for(ow={focusedElem:s,selectionRange:p},Ky=!1,ua=l;ua!==null;)if(l=ua,s=l.child,(l.subtreeFlags&1028)!==0&&s!==null)s.return=l,ua=s;else for(;ua!==null;){switch(l=ua,S=l.alternate,s=l.flags,l.tag){case 0:if((s&4)!==0&&(s=l.updateQueue,s=s!==null?s.events:null,s!==null))for(p=0;p<s.length;p++)k=s[p],k.ref.impl=k.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&S!==null){s=void 0,p=l,k=S.memoizedProps,S=S.memoizedState,y=p.stateNode;try{var Pt=Ou(p.type,k);s=y.getSnapshotBeforeUpdate(Pt,S),y.__reactInternalSnapshotBeforeUpdate=s}catch(Ht){Kr(p,p.return,Ht)}}break;case 3:if((s&1024)!==0){if(s=l.stateNode.containerInfo,p=s.nodeType,p===9)uw(s);else if(p===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":uw(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((s&1024)!==0)throw Error(n(163))}if(s=l.sibling,s!==null){s.return=l.return,ua=s;break}ua=l.return}}function o2(s,l,p){var y=p.flags;switch(p.tag){case 0:case 11:case 15:yc(s,p),y&4&&ih(5,p);break;case 1:if(yc(s,p),y&4)if(s=p.stateNode,l===null)try{s.componentDidMount()}catch(M){Kr(p,p.return,M)}else{var k=Ou(p.type,l.memoizedProps);l=l.memoizedState;try{s.componentDidUpdate(k,l,s.__reactInternalSnapshotBeforeUpdate)}catch(M){Kr(p,p.return,M)}}y&64&&t2(p),y&512&&sh(p,p.return);break;case 3:if(yc(s,p),y&64&&(s=p.updateQueue,s!==null)){if(l=null,p.child!==null)switch(p.child.tag){case 27:case 5:l=p.child.stateNode;break;case 1:l=p.child.stateNode}try{H1(s,l)}catch(M){Kr(p,p.return,M)}}break;case 27:l===null&&y&4&&i2(p);case 26:case 5:yc(s,p),l===null&&y&4&&n2(p),y&512&&sh(p,p.return);break;case 12:yc(s,p);break;case 31:yc(s,p),y&4&&u2(s,p);break;case 13:yc(s,p),y&4&&d2(s,p),y&64&&(s=p.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(p=c8.bind(null,p),P8(s,p))));break;case 22:if(y=p.memoizedState!==null||mc,!y){l=l!==null&&l.memoizedState!==null||Vn,k=mc;var S=Vn;mc=y,(Vn=l)&&!S?vc(s,p,(p.subtreeFlags&8772)!==0):yc(s,p),mc=k,Vn=S}break;case 30:break;default:yc(s,p)}}function c2(s){var l=s.alternate;l!==null&&(s.alternate=null,c2(l)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(l=s.stateNode,l!==null&&tc(l)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var _n=null,Ja=!1;function gc(s,l,p){for(p=p.child;p!==null;)l2(s,l,p),p=p.sibling}function l2(s,l,p){if(we&&typeof we.onCommitFiberUnmount=="function")try{we.onCommitFiberUnmount(at,p)}catch{}switch(p.tag){case 26:Vn||go(p,l),gc(s,l,p),p.memoizedState?p.memoizedState.count--:p.stateNode&&(p=p.stateNode,p.parentNode.removeChild(p));break;case 27:Vn||go(p,l);var y=_n,k=Ja;vl(p.type)&&(_n=p.stateNode,Ja=!1),gc(s,l,p),mh(p.stateNode),_n=y,Ja=k;break;case 5:Vn||go(p,l);case 6:if(y=_n,k=Ja,_n=null,gc(s,l,p),_n=y,Ja=k,_n!==null)if(Ja)try{(_n.nodeType===9?_n.body:_n.nodeName==="HTML"?_n.ownerDocument.body:_n).removeChild(p.stateNode)}catch(S){Kr(p,l,S)}else try{_n.removeChild(p.stateNode)}catch(S){Kr(p,l,S)}break;case 18:_n!==null&&(Ja?(s=_n,tD(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,p.stateNode),tf(s)):tD(_n,p.stateNode));break;case 4:y=_n,k=Ja,_n=p.stateNode.containerInfo,Ja=!0,gc(s,l,p),_n=y,Ja=k;break;case 0:case 11:case 14:case 15:dl(2,p,l),Vn||dl(4,p,l),gc(s,l,p);break;case 1:Vn||(go(p,l),y=p.stateNode,typeof y.componentWillUnmount=="function"&&r2(p,l,y)),gc(s,l,p);break;case 21:gc(s,l,p);break;case 22:Vn=(y=Vn)||p.memoizedState!==null,gc(s,l,p),Vn=y;break;default:gc(s,l,p)}}function u2(s,l){if(l.memoizedState===null&&(s=l.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{tf(s)}catch(p){Kr(l,l.return,p)}}}function d2(s,l){if(l.memoizedState===null&&(s=l.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{tf(s)}catch(p){Kr(l,l.return,p)}}function e8(s){switch(s.tag){case 31:case 13:case 19:var l=s.stateNode;return l===null&&(l=s.stateNode=new s2),l;case 22:return s=s.stateNode,l=s._retryCache,l===null&&(l=s._retryCache=new s2),l;default:throw Error(n(435,s.tag))}}function Py(s,l){var p=e8(s);l.forEach(function(y){if(!p.has(y)){p.add(y);var k=l8.bind(null,s,y);y.then(k,k)}})}function Qa(s,l){var p=l.deletions;if(p!==null)for(var y=0;y<p.length;y++){var k=p[y],S=s,M=l,V=M;e:for(;V!==null;){switch(V.tag){case 27:if(vl(V.type)){_n=V.stateNode,Ja=!1;break e}break;case 5:_n=V.stateNode,Ja=!1;break e;case 3:case 4:_n=V.stateNode.containerInfo,Ja=!0;break e}V=V.return}if(_n===null)throw Error(n(160));l2(S,M,k),_n=null,Ja=!1,S=k.alternate,S!==null&&(S.return=null),k.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)f2(l,s),l=l.sibling}var Ns=null;function f2(s,l){var p=s.alternate,y=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:Qa(l,s),Za(s),y&4&&(dl(3,s,s.return),ih(3,s),dl(5,s,s.return));break;case 1:Qa(l,s),Za(s),y&512&&(Vn||p===null||go(p,p.return)),y&64&&mc&&(s=s.updateQueue,s!==null&&(y=s.callbacks,y!==null&&(p=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=p===null?y:p.concat(y))));break;case 26:var k=Ns;if(Qa(l,s),Za(s),y&512&&(Vn||p===null||go(p,p.return)),y&4){var S=p!==null?p.memoizedState:null;if(y=s.memoizedState,p===null)if(y===null)if(s.stateNode===null){e:{y=s.type,p=s.memoizedProps,k=k.ownerDocument||k;t:switch(y){case"title":S=k.getElementsByTagName("title")[0],(!S||S[pn]||S[Rt]||S.namespaceURI==="http://www.w3.org/2000/svg"||S.hasAttribute("itemprop"))&&(S=k.createElement(y),k.head.insertBefore(S,k.querySelector("head > title"))),ka(S,y,p),S[Rt]=s,hn(S),y=S;break e;case"link":var M=fD("link","href",k).get(y+(p.href||""));if(M){for(var V=0;V<M.length;V++)if(S=M[V],S.getAttribute("href")===(p.href==null||p.href===""?null:p.href)&&S.getAttribute("rel")===(p.rel==null?null:p.rel)&&S.getAttribute("title")===(p.title==null?null:p.title)&&S.getAttribute("crossorigin")===(p.crossOrigin==null?null:p.crossOrigin)){M.splice(V,1);break t}}S=k.createElement(y),ka(S,y,p),k.head.appendChild(S);break;case"meta":if(M=fD("meta","content",k).get(y+(p.content||""))){for(V=0;V<M.length;V++)if(S=M[V],S.getAttribute("content")===(p.content==null?null:""+p.content)&&S.getAttribute("name")===(p.name==null?null:p.name)&&S.getAttribute("property")===(p.property==null?null:p.property)&&S.getAttribute("http-equiv")===(p.httpEquiv==null?null:p.httpEquiv)&&S.getAttribute("charset")===(p.charSet==null?null:p.charSet)){M.splice(V,1);break t}}S=k.createElement(y),ka(S,y,p),k.head.appendChild(S);break;default:throw Error(n(468,y))}S[Rt]=s,hn(S),y=S}s.stateNode=y}else pD(k,s.type,s.stateNode);else s.stateNode=dD(k,y,s.memoizedProps);else S!==y?(S===null?p.stateNode!==null&&(p=p.stateNode,p.parentNode.removeChild(p)):S.count--,y===null?pD(k,s.type,s.stateNode):dD(k,y,s.memoizedProps)):y===null&&s.stateNode!==null&&jk(s,s.memoizedProps,p.memoizedProps)}break;case 27:Qa(l,s),Za(s),y&512&&(Vn||p===null||go(p,p.return)),p!==null&&y&4&&jk(s,s.memoizedProps,p.memoizedProps);break;case 5:if(Qa(l,s),Za(s),y&512&&(Vn||p===null||go(p,p.return)),s.flags&32){k=s.stateNode;try{Je(k,"")}catch(Pt){Kr(s,s.return,Pt)}}y&4&&s.stateNode!=null&&(k=s.memoizedProps,jk(s,k,p!==null?p.memoizedProps:k)),y&1024&&(Uk=!0);break;case 6:if(Qa(l,s),Za(s),y&4){if(s.stateNode===null)throw Error(n(162));y=s.memoizedProps,p=s.stateNode;try{p.nodeValue=y}catch(Pt){Kr(s,s.return,Pt)}}break;case 3:if(Vy=null,k=Ns,Ns=zy(l.containerInfo),Qa(l,s),Ns=k,Za(s),y&4&&p!==null&&p.memoizedState.isDehydrated)try{tf(l.containerInfo)}catch(Pt){Kr(s,s.return,Pt)}Uk&&(Uk=!1,p2(s));break;case 4:y=Ns,Ns=zy(s.stateNode.containerInfo),Qa(l,s),Za(s),Ns=y;break;case 12:Qa(l,s),Za(s);break;case 31:Qa(l,s),Za(s),y&4&&(y=s.updateQueue,y!==null&&(s.updateQueue=null,Py(s,y)));break;case 13:Qa(l,s),Za(s),s.child.flags&8192&&s.memoizedState!==null!=(p!==null&&p.memoizedState!==null)&&(Ry=_t()),y&4&&(y=s.updateQueue,y!==null&&(s.updateQueue=null,Py(s,y)));break;case 22:k=s.memoizedState!==null;var oe=p!==null&&p.memoizedState!==null,Te=mc,Ue=Vn;if(mc=Te||k,Vn=Ue||oe,Qa(l,s),Vn=Ue,mc=Te,Za(s),y&8192)e:for(l=s.stateNode,l._visibility=k?l._visibility&-2:l._visibility|1,k&&(p===null||oe||mc||Vn||Nu(s)),p=null,l=s;;){if(l.tag===5||l.tag===26){if(p===null){oe=p=l;try{if(S=oe.stateNode,k)M=S.style,typeof M.setProperty=="function"?M.setProperty("display","none","important"):M.display="none";else{V=oe.stateNode;var Ge=oe.memoizedProps.style,Pe=Ge!=null&&Ge.hasOwnProperty("display")?Ge.display:null;V.style.display=Pe==null||typeof Pe=="boolean"?"":(""+Pe).trim()}}catch(Pt){Kr(oe,oe.return,Pt)}}}else if(l.tag===6){if(p===null){oe=l;try{oe.stateNode.nodeValue=k?"":oe.memoizedProps}catch(Pt){Kr(oe,oe.return,Pt)}}}else if(l.tag===18){if(p===null){oe=l;try{var Ne=oe.stateNode;k?rD(Ne,!0):rD(oe.stateNode,!1)}catch(Pt){Kr(oe,oe.return,Pt)}}}else if((l.tag!==22&&l.tag!==23||l.memoizedState===null||l===s)&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===s)break e;for(;l.sibling===null;){if(l.return===null||l.return===s)break e;p===l&&(p=null),l=l.return}p===l&&(p=null),l.sibling.return=l.return,l=l.sibling}y&4&&(y=s.updateQueue,y!==null&&(p=y.retryQueue,p!==null&&(y.retryQueue=null,Py(s,p))));break;case 19:Qa(l,s),Za(s),y&4&&(y=s.updateQueue,y!==null&&(s.updateQueue=null,Py(s,y)));break;case 30:break;case 21:break;default:Qa(l,s),Za(s)}}function Za(s){var l=s.flags;if(l&2){try{for(var p,y=s.return;y!==null;){if(a2(y)){p=y;break}y=y.return}if(p==null)throw Error(n(160));switch(p.tag){case 27:var k=p.stateNode,S=Lk(s);xy(s,S,k);break;case 5:var M=p.stateNode;p.flags&32&&(Je(M,""),p.flags&=-33);var V=Lk(s);xy(s,V,M);break;case 3:case 4:var oe=p.stateNode.containerInfo,Te=Lk(s);Bk(s,Te,oe);break;default:throw Error(n(161))}}catch(Ue){Kr(s,s.return,Ue)}s.flags&=-3}l&4096&&(s.flags&=-4097)}function p2(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var l=s;p2(l),l.tag===5&&l.flags&1024&&l.stateNode.reset(),s=s.sibling}}function yc(s,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)o2(s,l.alternate,l),l=l.sibling}function Nu(s){for(s=s.child;s!==null;){var l=s;switch(l.tag){case 0:case 11:case 14:case 15:dl(4,l,l.return),Nu(l);break;case 1:go(l,l.return);var p=l.stateNode;typeof p.componentWillUnmount=="function"&&r2(l,l.return,p),Nu(l);break;case 27:mh(l.stateNode);case 26:case 5:go(l,l.return),Nu(l);break;case 22:l.memoizedState===null&&Nu(l);break;case 30:Nu(l);break;default:Nu(l)}s=s.sibling}}function vc(s,l,p){for(p=p&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var y=l.alternate,k=s,S=l,M=S.flags;switch(S.tag){case 0:case 11:case 15:vc(k,S,p),ih(4,S);break;case 1:if(vc(k,S,p),y=S,k=y.stateNode,typeof k.componentDidMount=="function")try{k.componentDidMount()}catch(Te){Kr(y,y.return,Te)}if(y=S,k=y.updateQueue,k!==null){var V=y.stateNode;try{var oe=k.shared.hiddenCallbacks;if(oe!==null)for(k.shared.hiddenCallbacks=null,k=0;k<oe.length;k++)V1(oe[k],V)}catch(Te){Kr(y,y.return,Te)}}p&&M&64&&t2(S),sh(S,S.return);break;case 27:i2(S);case 26:case 5:vc(k,S,p),p&&y===null&&M&4&&n2(S),sh(S,S.return);break;case 12:vc(k,S,p);break;case 31:vc(k,S,p),p&&M&4&&u2(k,S);break;case 13:vc(k,S,p),p&&M&4&&d2(k,S);break;case 22:S.memoizedState===null&&vc(k,S,p),sh(S,S.return);break;case 30:break;default:vc(k,S,p)}l=l.sibling}}function Fk(s,l){var p=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(p=s.memoizedState.cachePool.pool),s=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(s=l.memoizedState.cachePool.pool),s!==p&&(s!=null&&s.refCount++,p!=null&&Gp(p))}function qk(s,l){s=null,l.alternate!==null&&(s=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==s&&(l.refCount++,s!=null&&Gp(s))}function Is(s,l,p,y){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)h2(s,l,p,y),l=l.sibling}function h2(s,l,p,y){var k=l.flags;switch(l.tag){case 0:case 11:case 15:Is(s,l,p,y),k&2048&&ih(9,l);break;case 1:Is(s,l,p,y);break;case 3:Is(s,l,p,y),k&2048&&(s=null,l.alternate!==null&&(s=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==s&&(l.refCount++,s!=null&&Gp(s)));break;case 12:if(k&2048){Is(s,l,p,y),s=l.stateNode;try{var S=l.memoizedProps,M=S.id,V=S.onPostCommit;typeof V=="function"&&V(M,l.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(oe){Kr(l,l.return,oe)}}else Is(s,l,p,y);break;case 31:Is(s,l,p,y);break;case 13:Is(s,l,p,y);break;case 23:break;case 22:S=l.stateNode,M=l.alternate,l.memoizedState!==null?S._visibility&2?Is(s,l,p,y):oh(s,l):S._visibility&2?Is(s,l,p,y):(S._visibility|=2,Vd(s,l,p,y,(l.subtreeFlags&10256)!==0||!1)),k&2048&&Fk(M,l);break;case 24:Is(s,l,p,y),k&2048&&qk(l.alternate,l);break;default:Is(s,l,p,y)}}function Vd(s,l,p,y,k){for(k=k&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var S=s,M=l,V=p,oe=y,Te=M.flags;switch(M.tag){case 0:case 11:case 15:Vd(S,M,V,oe,k),ih(8,M);break;case 23:break;case 22:var Ue=M.stateNode;M.memoizedState!==null?Ue._visibility&2?Vd(S,M,V,oe,k):oh(S,M):(Ue._visibility|=2,Vd(S,M,V,oe,k)),k&&Te&2048&&Fk(M.alternate,M);break;case 24:Vd(S,M,V,oe,k),k&&Te&2048&&qk(M.alternate,M);break;default:Vd(S,M,V,oe,k)}l=l.sibling}}function oh(s,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var p=s,y=l,k=y.flags;switch(y.tag){case 22:oh(p,y),k&2048&&Fk(y.alternate,y);break;case 24:oh(p,y),k&2048&&qk(y.alternate,y);break;default:oh(p,y)}l=l.sibling}}var ch=8192;function Hd(s,l,p){if(s.subtreeFlags&ch)for(s=s.child;s!==null;)m2(s,l,p),s=s.sibling}function m2(s,l,p){switch(s.tag){case 26:Hd(s,l,p),s.flags&ch&&s.memoizedState!==null&&F8(p,Ns,s.memoizedState,s.memoizedProps);break;case 5:Hd(s,l,p);break;case 3:case 4:var y=Ns;Ns=zy(s.stateNode.containerInfo),Hd(s,l,p),Ns=y;break;case 22:s.memoizedState===null&&(y=s.alternate,y!==null&&y.memoizedState!==null?(y=ch,ch=16777216,Hd(s,l,p),ch=y):Hd(s,l,p));break;default:Hd(s,l,p)}}function g2(s){var l=s.alternate;if(l!==null&&(s=l.child,s!==null)){l.child=null;do l=s.sibling,s.sibling=null,s=l;while(s!==null)}}function lh(s){var l=s.deletions;if((s.flags&16)!==0){if(l!==null)for(var p=0;p<l.length;p++){var y=l[p];ua=y,v2(y,s)}g2(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)y2(s),s=s.sibling}function y2(s){switch(s.tag){case 0:case 11:case 15:lh(s),s.flags&2048&&dl(9,s,s.return);break;case 3:lh(s);break;case 12:lh(s);break;case 22:var l=s.stateNode;s.memoizedState!==null&&l._visibility&2&&(s.return===null||s.return.tag!==13)?(l._visibility&=-3,Ay(s)):lh(s);break;default:lh(s)}}function Ay(s){var l=s.deletions;if((s.flags&16)!==0){if(l!==null)for(var p=0;p<l.length;p++){var y=l[p];ua=y,v2(y,s)}g2(s)}for(s=s.child;s!==null;){switch(l=s,l.tag){case 0:case 11:case 15:dl(8,l,l.return),Ay(l);break;case 22:p=l.stateNode,p._visibility&2&&(p._visibility&=-3,Ay(l));break;default:Ay(l)}s=s.sibling}}function v2(s,l){for(;ua!==null;){var p=ua;switch(p.tag){case 0:case 11:case 15:dl(8,p,l);break;case 23:case 22:if(p.memoizedState!==null&&p.memoizedState.cachePool!==null){var y=p.memoizedState.cachePool.pool;y!=null&&y.refCount++}break;case 24:Gp(p.memoizedState.cache)}if(y=p.child,y!==null)y.return=p,ua=y;else e:for(p=s;ua!==null;){y=ua;var k=y.sibling,S=y.return;if(c2(y),y===p){ua=null;break e}if(k!==null){k.return=S,ua=k;break e}ua=S}}}var t8={getCacheForType:function(s){var l=_a(qn),p=l.data.get(s);return p===void 0&&(p=s(),l.data.set(s,p)),p},cacheSignal:function(){return _a(qn).controller.signal}},r8=typeof WeakMap=="function"?WeakMap:Map,Br=0,sn=null,gr=null,br=0,Wr=0,xi=null,fl=!1,Gd=!1,zk=!1,_c=0,xn=0,pl=0,Iu=0,$k=0,Pi=0,Wd=0,uh=null,ei=null,Vk=!1,Ry=0,_2=0,Dy=1/0,Oy=null,hl=null,ra=0,ml=null,Kd=null,bc=0,Hk=0,Gk=null,b2=null,dh=0,Wk=null;function Ai(){return(Br&2)!==0&&br!==0?br&-br:F.T!==null?Zk():Ye()}function k2(){if(Pi===0)if((br&536870912)===0||Tr){var s=un;un<<=1,(un&3932160)===0&&(un=262144),Pi=s}else Pi=536870912;return s=Ti.current,s!==null&&(s.flags|=32),Pi}function ti(s,l,p){(s===sn&&(Wr===2||Wr===9)||s.cancelPendingCommit!==null)&&(Yd(s,0),gl(s,br,Pi,!1)),Oe(s,p),((Br&2)===0||s!==sn)&&(s===sn&&((Br&2)===0&&(Iu|=p),xn===4&&gl(s,br,Pi,!1)),yo(s))}function w2(s,l,p){if((Br&6)!==0)throw Error(n(327));var y=!p&&(l&127)===0&&(l&s.expiredLanes)===0||be(s,l),k=y?i8(s,l):Yk(s,l,!0),S=y;do{if(k===0){Gd&&!y&&gl(s,l,0,!1);break}else{if(p=s.current.alternate,S&&!n8(p)){k=Yk(s,l,!1),S=!1;continue}if(k===2){if(S=l,s.errorRecoveryDisabledLanes&S)var M=0;else M=s.pendingLanes&-536870913,M=M!==0?M:M&536870912?536870912:0;if(M!==0){l=M;e:{var V=s;k=uh;var oe=V.current.memoizedState.isDehydrated;if(oe&&(Yd(V,M).flags|=256),M=Yk(V,M,!1),M!==2){if(zk&&!oe){V.errorRecoveryDisabledLanes|=S,Iu|=S,k=4;break e}S=ei,ei=k,S!==null&&(ei===null?ei=S:ei.push.apply(ei,S))}k=M}if(S=!1,k!==2)continue}}if(k===1){Yd(s,0),gl(s,l,0,!0);break}e:{switch(y=s,S=k,S){case 0:case 1:throw Error(n(345));case 4:if((l&4194048)!==l)break;case 6:gl(y,l,Pi,!fl);break e;case 2:ei=null;break;case 3:case 5:break;default:throw Error(n(329))}if((l&62914560)===l&&(k=Ry+300-_t(),10<k)){if(gl(y,l,Pi,!fl),le(y,0,!0)!==0)break e;bc=l,y.timeoutHandle=Z2(S2.bind(null,y,p,ei,Oy,Vk,l,Pi,Iu,Wd,fl,S,"Throttled",-0,0),k);break e}S2(y,p,ei,Oy,Vk,l,Pi,Iu,Wd,fl,S,null,-0,0)}}break}while(!0);yo(s)}function S2(s,l,p,y,k,S,M,V,oe,Te,Ue,Ge,Pe,Ne){if(s.timeoutHandle=-1,Ge=l.subtreeFlags,Ge&8192||(Ge&16785408)===16785408){Ge={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ya},m2(l,S,Ge);var Pt=(S&62914560)===S?Ry-_t():(S&4194048)===S?_2-_t():0;if(Pt=q8(Ge,Pt),Pt!==null){bc=S,s.cancelPendingCommit=Pt(D2.bind(null,s,l,S,p,y,k,M,V,oe,Ue,Ge,null,Pe,Ne)),gl(s,S,M,!Te);return}}D2(s,l,S,p,y,k,M,V,oe)}function n8(s){for(var l=s;;){var p=l.tag;if((p===0||p===11||p===15)&&l.flags&16384&&(p=l.updateQueue,p!==null&&(p=p.stores,p!==null)))for(var y=0;y<p.length;y++){var k=p[y],S=k.getSnapshot;k=k.value;try{if(!Si(S(),k))return!1}catch{return!1}}if(p=l.child,l.subtreeFlags&16384&&p!==null)p.return=l,l=p;else{if(l===s)break;for(;l.sibling===null;){if(l.return===null||l.return===s)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function gl(s,l,p,y){l&=~$k,l&=~Iu,s.suspendedLanes|=l,s.pingedLanes&=~l,y&&(s.warmLanes|=l),y=s.expirationTimes;for(var k=l;0<k;){var S=31-bt(k),M=1<<S;y[S]=-1,k&=~M}p!==0&&er(s,p,l)}function Ny(){return(Br&6)===0?(fh(0),!1):!0}function Kk(){if(gr!==null){if(Wr===0)var s=gr.return;else s=gr,lc=Tu=null,uk(s),Ud=null,Kp=0,s=gr;for(;s!==null;)e2(s.alternate,s),s=s.return;gr=null}}function Yd(s,l){var p=s.timeoutHandle;p!==-1&&(s.timeoutHandle=-1,S8(p)),p=s.cancelPendingCommit,p!==null&&(s.cancelPendingCommit=null,p()),bc=0,Kk(),sn=s,gr=p=oc(s.current,null),br=l,Wr=0,xi=null,fl=!1,Gd=be(s,l),zk=!1,Wd=Pi=$k=Iu=pl=xn=0,ei=uh=null,Vk=!1,(l&8)!==0&&(l|=l&32);var y=s.entangledLanes;if(y!==0)for(s=s.entanglements,y&=l;0<y;){var k=31-bt(y),S=1<<k;l|=s[k],y&=~S}return _c=l,ey(),p}function E2(s,l){ar=null,F.H=rh,l===Bd||l===cy?(l=F1(),Wr=3):l===Q0?(l=F1(),Wr=4):Wr=l===Ck?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,xi=l,gr===null&&(xn=1,wy(s,Ki(l,s.current)))}function T2(){var s=Ti.current;return s===null?!0:(br&4194048)===br?Qi===null:(br&62914560)===br||(br&536870912)!==0?s===Qi:!1}function C2(){var s=F.H;return F.H=rh,s===null?rh:s}function x2(){var s=F.A;return F.A=t8,s}function Iy(){xn=4,fl||(br&4194048)!==br&&Ti.current!==null||(Gd=!0),(pl&134217727)===0&&(Iu&134217727)===0||sn===null||gl(sn,br,Pi,!1)}function Yk(s,l,p){var y=Br;Br|=2;var k=C2(),S=x2();(sn!==s||br!==l)&&(Oy=null,Yd(s,l)),l=!1;var M=xn;e:do try{if(Wr!==0&&gr!==null){var V=gr,oe=xi;switch(Wr){case 8:Kk(),M=6;break e;case 3:case 2:case 9:case 6:Ti.current===null&&(l=!0);var Te=Wr;if(Wr=0,xi=null,Xd(s,V,oe,Te),p&&Gd){M=0;break e}break;default:Te=Wr,Wr=0,xi=null,Xd(s,V,oe,Te)}}a8(),M=xn;break}catch(Ue){E2(s,Ue)}while(!0);return l&&s.shellSuspendCounter++,lc=Tu=null,Br=y,F.H=k,F.A=S,gr===null&&(sn=null,br=0,ey()),M}function a8(){for(;gr!==null;)P2(gr)}function i8(s,l){var p=Br;Br|=2;var y=C2(),k=x2();sn!==s||br!==l?(Oy=null,Dy=_t()+500,Yd(s,l)):Gd=be(s,l);e:do try{if(Wr!==0&&gr!==null){l=gr;var S=xi;t:switch(Wr){case 1:Wr=0,xi=null,Xd(s,l,S,1);break;case 2:case 9:if(B1(S)){Wr=0,xi=null,A2(l);break}l=function(){Wr!==2&&Wr!==9||sn!==s||(Wr=7),yo(s)},S.then(l,l);break e;case 3:Wr=7;break e;case 4:Wr=5;break e;case 7:B1(S)?(Wr=0,xi=null,A2(l)):(Wr=0,xi=null,Xd(s,l,S,7));break;case 5:var M=null;switch(gr.tag){case 26:M=gr.memoizedState;case 5:case 27:var V=gr;if(M?hD(M):V.stateNode.complete){Wr=0,xi=null;var oe=V.sibling;if(oe!==null)gr=oe;else{var Te=V.return;Te!==null?(gr=Te,My(Te)):gr=null}break t}}Wr=0,xi=null,Xd(s,l,S,5);break;case 6:Wr=0,xi=null,Xd(s,l,S,6);break;case 8:Kk(),xn=6;break e;default:throw Error(n(462))}}s8();break}catch(Ue){E2(s,Ue)}while(!0);return lc=Tu=null,F.H=y,F.A=k,Br=p,gr!==null?0:(sn=null,br=0,ey(),xn)}function s8(){for(;gr!==null&&!Et();)P2(gr)}function P2(s){var l=QR(s.alternate,s,_c);s.memoizedProps=s.pendingProps,l===null?My(s):gr=l}function A2(s){var l=s,p=l.alternate;switch(l.tag){case 15:case 0:l=GR(p,l,l.pendingProps,l.type,void 0,br);break;case 11:l=GR(p,l,l.pendingProps,l.type.render,l.ref,br);break;case 5:uk(l);default:e2(p,l),l=gr=x1(l,_c),l=QR(p,l,_c)}s.memoizedProps=s.pendingProps,l===null?My(s):gr=l}function Xd(s,l,p,y){lc=Tu=null,uk(l),Ud=null,Kp=0;var k=l.return;try{if(K$(s,k,l,p,br)){xn=1,wy(s,Ki(p,s.current)),gr=null;return}}catch(S){if(k!==null)throw gr=k,S;xn=1,wy(s,Ki(p,s.current)),gr=null;return}l.flags&32768?(Tr||y===1?s=!0:Gd||(br&536870912)!==0?s=!1:(fl=s=!0,(y===2||y===9||y===3||y===6)&&(y=Ti.current,y!==null&&y.tag===13&&(y.flags|=16384))),R2(l,s)):My(l)}function My(s){var l=s;do{if((l.flags&32768)!==0){R2(l,fl);return}s=l.return;var p=J$(l.alternate,l,_c);if(p!==null){gr=p;return}if(l=l.sibling,l!==null){gr=l;return}gr=l=s}while(l!==null);xn===0&&(xn=5)}function R2(s,l){do{var p=Q$(s.alternate,s);if(p!==null){p.flags&=32767,gr=p;return}if(p=s.return,p!==null&&(p.flags|=32768,p.subtreeFlags=0,p.deletions=null),!l&&(s=s.sibling,s!==null)){gr=s;return}gr=s=p}while(s!==null);xn=6,gr=null}function D2(s,l,p,y,k,S,M,V,oe){s.cancelPendingCommit=null;do jy();while(ra!==0);if((Br&6)!==0)throw Error(n(327));if(l!==null){if(l===s.current)throw Error(n(177));if(S=l.lanes|l.childLanes,S|=L0,wt(s,p,S,M,V,oe),s===sn&&(gr=sn=null,br=0),Kd=l,ml=s,bc=p,Hk=S,Gk=k,b2=y,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,u8(nt,function(){return j2(),null})):(s.callbackNode=null,s.callbackPriority=0),y=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||y){y=F.T,F.T=null,k=Y.p,Y.p=2,M=Br,Br|=4;try{Z$(s,l,p)}finally{Br=M,Y.p=k,F.T=y}}ra=1,O2(),N2(),I2()}}function O2(){if(ra===1){ra=0;var s=ml,l=Kd,p=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||p){p=F.T,F.T=null;var y=Y.p;Y.p=2;var k=Br;Br|=4;try{f2(l,s);var S=ow,M=v1(s.containerInfo),V=S.focusedElem,oe=S.selectionRange;if(M!==V&&V&&V.ownerDocument&&y1(V.ownerDocument.documentElement,V)){if(oe!==null&&O0(V)){var Te=oe.start,Ue=oe.end;if(Ue===void 0&&(Ue=Te),"selectionStart"in V)V.selectionStart=Te,V.selectionEnd=Math.min(Ue,V.value.length);else{var Ge=V.ownerDocument||document,Pe=Ge&&Ge.defaultView||window;if(Pe.getSelection){var Ne=Pe.getSelection(),Pt=V.textContent.length,Ht=Math.min(oe.start,Pt),Zr=oe.end===void 0?Ht:Math.min(oe.end,Pt);!Ne.extend&&Ht>Zr&&(M=Zr,Zr=Ht,Ht=M);var ve=g1(V,Ht),de=g1(V,Zr);if(ve&&de&&(Ne.rangeCount!==1||Ne.anchorNode!==ve.node||Ne.anchorOffset!==ve.offset||Ne.focusNode!==de.node||Ne.focusOffset!==de.offset)){var Ee=Ge.createRange();Ee.setStart(ve.node,ve.offset),Ne.removeAllRanges(),Ht>Zr?(Ne.addRange(Ee),Ne.extend(de.node,de.offset)):(Ee.setEnd(de.node,de.offset),Ne.addRange(Ee))}}}}for(Ge=[],Ne=V;Ne=Ne.parentNode;)Ne.nodeType===1&&Ge.push({element:Ne,left:Ne.scrollLeft,top:Ne.scrollTop});for(typeof V.focus=="function"&&V.focus(),V=0;V<Ge.length;V++){var qe=Ge[V];qe.element.scrollLeft=qe.left,qe.element.scrollTop=qe.top}}Ky=!!sw,ow=sw=null}finally{Br=k,Y.p=y,F.T=p}}s.current=l,ra=2}}function N2(){if(ra===2){ra=0;var s=ml,l=Kd,p=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||p){p=F.T,F.T=null;var y=Y.p;Y.p=2;var k=Br;Br|=4;try{o2(s,l.alternate,l)}finally{Br=k,Y.p=y,F.T=p}}ra=3}}function I2(){if(ra===4||ra===3){ra=0,Mt();var s=ml,l=Kd,p=bc,y=b2;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?ra=5:(ra=0,Kd=ml=null,M2(s,s.pendingLanes));var k=s.pendingLanes;if(k===0&&(hl=null),On(p),l=l.stateNode,we&&typeof we.onCommitFiberRoot=="function")try{we.onCommitFiberRoot(at,l,void 0,(l.current.flags&128)===128)}catch{}if(y!==null){l=F.T,k=Y.p,Y.p=2,F.T=null;try{for(var S=s.onRecoverableError,M=0;M<y.length;M++){var V=y[M];S(V.value,{componentStack:V.stack})}}finally{F.T=l,Y.p=k}}(bc&3)!==0&&jy(),yo(s),k=s.pendingLanes,(p&261930)!==0&&(k&42)!==0?s===Wk?dh++:(dh=0,Wk=s):dh=0,fh(0)}}function M2(s,l){(s.pooledCacheLanes&=l)===0&&(l=s.pooledCache,l!=null&&(s.pooledCache=null,Gp(l)))}function jy(){return O2(),N2(),I2(),j2()}function j2(){if(ra!==5)return!1;var s=ml,l=Hk;Hk=0;var p=On(bc),y=F.T,k=Y.p;try{Y.p=32>p?32:p,F.T=null,p=Gk,Gk=null;var S=ml,M=bc;if(ra=0,Kd=ml=null,bc=0,(Br&6)!==0)throw Error(n(331));var V=Br;if(Br|=4,y2(S.current),h2(S,S.current,M,p),Br=V,fh(0,!1),we&&typeof we.onPostCommitFiberRoot=="function")try{we.onPostCommitFiberRoot(at,S)}catch{}return!0}finally{Y.p=k,F.T=y,M2(s,l)}}function L2(s,l,p){l=Ki(p,l),l=Tk(s.stateNode,l,2),s=cl(s,l,2),s!==null&&(Oe(s,2),yo(s))}function Kr(s,l,p){if(s.tag===3)L2(s,s,p);else for(;l!==null;){if(l.tag===3){L2(l,s,p);break}else if(l.tag===1){var y=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof y.componentDidCatch=="function"&&(hl===null||!hl.has(y))){s=Ki(p,s),p=BR(2),y=cl(l,p,2),y!==null&&(UR(p,y,l,s),Oe(y,2),yo(y));break}}l=l.return}}function Xk(s,l,p){var y=s.pingCache;if(y===null){y=s.pingCache=new r8;var k=new Set;y.set(l,k)}else k=y.get(l),k===void 0&&(k=new Set,y.set(l,k));k.has(p)||(zk=!0,k.add(p),s=o8.bind(null,s,l,p),l.then(s,s))}function o8(s,l,p){var y=s.pingCache;y!==null&&y.delete(l),s.pingedLanes|=s.suspendedLanes&p,s.warmLanes&=~p,sn===s&&(br&p)===p&&(xn===4||xn===3&&(br&62914560)===br&&300>_t()-Ry?(Br&2)===0&&Yd(s,0):$k|=p,Wd===br&&(Wd=0)),yo(s)}function B2(s,l){l===0&&(l=ee()),s=wu(s,l),s!==null&&(Oe(s,l),yo(s))}function c8(s){var l=s.memoizedState,p=0;l!==null&&(p=l.retryLane),B2(s,p)}function l8(s,l){var p=0;switch(s.tag){case 31:case 13:var y=s.stateNode,k=s.memoizedState;k!==null&&(p=k.retryLane);break;case 19:y=s.stateNode;break;case 22:y=s.stateNode._retryCache;break;default:throw Error(n(314))}y!==null&&y.delete(l),B2(s,p)}function u8(s,l){return We(s,l)}var Ly=null,Jd=null,Jk=!1,By=!1,Qk=!1,yl=0;function yo(s){s!==Jd&&s.next===null&&(Jd===null?Ly=Jd=s:Jd=Jd.next=s),By=!0,Jk||(Jk=!0,f8())}function fh(s,l){if(!Qk&&By){Qk=!0;do for(var p=!1,y=Ly;y!==null;){if(s!==0){var k=y.pendingLanes;if(k===0)var S=0;else{var M=y.suspendedLanes,V=y.pingedLanes;S=(1<<31-bt(42|s)+1)-1,S&=k&~(M&~V),S=S&201326741?S&201326741|1:S?S|2:0}S!==0&&(p=!0,z2(y,S))}else S=br,S=le(y,y===sn?S:0,y.cancelPendingCommit!==null||y.timeoutHandle!==-1),(S&3)===0||be(y,S)||(p=!0,z2(y,S));y=y.next}while(p);Qk=!1}}function d8(){U2()}function U2(){By=Jk=!1;var s=0;yl!==0&&w8()&&(s=yl);for(var l=_t(),p=null,y=Ly;y!==null;){var k=y.next,S=F2(y,l);S===0?(y.next=null,p===null?Ly=k:p.next=k,k===null&&(Jd=p)):(p=y,(s!==0||(S&3)!==0)&&(By=!0)),y=k}ra!==0&&ra!==5||fh(s),yl!==0&&(yl=0)}function F2(s,l){for(var p=s.suspendedLanes,y=s.pingedLanes,k=s.expirationTimes,S=s.pendingLanes&-62914561;0<S;){var M=31-bt(S),V=1<<M,oe=k[M];oe===-1?((V&p)===0||(V&y)!==0)&&(k[M]=z(V,l)):oe<=l&&(s.expiredLanes|=V),S&=~V}if(l=sn,p=br,p=le(s,s===l?p:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),y=s.callbackNode,p===0||s===l&&(Wr===2||Wr===9)||s.cancelPendingCommit!==null)return y!==null&&y!==null&&it(y),s.callbackNode=null,s.callbackPriority=0;if((p&3)===0||be(s,p)){if(l=p&-p,l===s.callbackPriority)return l;switch(y!==null&&it(y),On(p)){case 2:case 8:p=je;break;case 32:p=nt;break;case 268435456:p=jt;break;default:p=nt}return y=q2.bind(null,s),p=We(p,y),s.callbackPriority=l,s.callbackNode=p,l}return y!==null&&y!==null&&it(y),s.callbackPriority=2,s.callbackNode=null,2}function q2(s,l){if(ra!==0&&ra!==5)return s.callbackNode=null,s.callbackPriority=0,null;var p=s.callbackNode;if(jy()&&s.callbackNode!==p)return null;var y=br;return y=le(s,s===sn?y:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),y===0?null:(w2(s,y,l),F2(s,_t()),s.callbackNode!=null&&s.callbackNode===p?q2.bind(null,s):null)}function z2(s,l){if(jy())return null;w2(s,l,!0)}function f8(){E8(function(){(Br&6)!==0?We(Be,d8):U2()})}function Zk(){if(yl===0){var s=jd;s===0&&(s=Sr,Sr<<=1,(Sr&261888)===0&&(Sr=256)),yl=s}return yl}function $2(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:As(""+s)}function V2(s,l){var p=l.ownerDocument.createElement("input");return p.name=l.name,p.value=l.value,s.id&&p.setAttribute("form",s.id),l.parentNode.insertBefore(p,l),s=new FormData(s),p.parentNode.removeChild(p),s}function p8(s,l,p,y,k){if(l==="submit"&&p&&p.stateNode===k){var S=$2((k[Dt]||null).action),M=y.submitter;M&&(l=(l=M[Dt]||null)?$2(l.formAction):M.getAttribute("formAction"),l!==null&&(S=l,M=null));var V=new ic("action","action",null,y,k);s.push({event:V,listeners:[{instance:null,listener:function(){if(y.defaultPrevented){if(yl!==0){var oe=M?V2(k,M):new FormData(k);_k(p,{pending:!0,data:oe,method:k.method,action:S},null,oe)}}else typeof S=="function"&&(V.preventDefault(),oe=M?V2(k,M):new FormData(k),_k(p,{pending:!0,data:oe,method:k.method,action:S},S,oe))},currentTarget:k}]})}}for(var ew=0;ew<j0.length;ew++){var tw=j0[ew],h8=tw.toLowerCase(),m8=tw[0].toUpperCase()+tw.slice(1);Os(h8,"on"+m8)}Os(k1,"onAnimationEnd"),Os(w1,"onAnimationIteration"),Os(S1,"onAnimationStart"),Os("dblclick","onDoubleClick"),Os("focusin","onFocus"),Os("focusout","onBlur"),Os(D$,"onTransitionRun"),Os(O$,"onTransitionStart"),Os(N$,"onTransitionCancel"),Os(E1,"onTransitionEnd"),$i("onMouseEnter",["mouseout","mouseover"]),$i("onMouseLeave",["mouseout","mouseover"]),$i("onPointerEnter",["pointerout","pointerover"]),$i("onPointerLeave",["pointerout","pointerover"]),Ps("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ps("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ps("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ps("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ps("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ps("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ph="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(" "),g8=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ph));function H2(s,l){l=(l&4)!==0;for(var p=0;p<s.length;p++){var y=s[p],k=y.event;y=y.listeners;e:{var S=void 0;if(l)for(var M=y.length-1;0<=M;M--){var V=y[M],oe=V.instance,Te=V.currentTarget;if(V=V.listener,oe!==S&&k.isPropagationStopped())break e;S=V,k.currentTarget=Te;try{S(k)}catch(Ue){Zg(Ue)}k.currentTarget=null,S=oe}else for(M=0;M<y.length;M++){if(V=y[M],oe=V.instance,Te=V.currentTarget,V=V.listener,oe!==S&&k.isPropagationStopped())break e;S=V,k.currentTarget=Te;try{S(k)}catch(Ue){Zg(Ue)}k.currentTarget=null,S=oe}}}}function yr(s,l){var p=l[dn];p===void 0&&(p=l[dn]=new Set);var y=s+"__bubble";p.has(y)||(G2(l,s,2,!1),p.add(y))}function rw(s,l,p){var y=0;l&&(y|=4),G2(p,s,y,l)}var Uy="_reactListening"+Math.random().toString(36).slice(2);function nw(s){if(!s[Uy]){s[Uy]=!0,Cs.forEach(function(p){p!=="selectionchange"&&(g8.has(p)||rw(p,!1,s),rw(p,!0,s))});var l=s.nodeType===9?s:s.ownerDocument;l===null||l[Uy]||(l[Uy]=!0,rw("selectionchange",!1,l))}}function G2(s,l,p,y){switch(kD(l)){case 2:var k=V8;break;case 8:k=H8;break;default:k=vw}p=k.bind(null,l,p,s),k=void 0,!Ua||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(k=!0),y?k!==void 0?s.addEventListener(l,p,{capture:!0,passive:k}):s.addEventListener(l,p,!0):k!==void 0?s.addEventListener(l,p,{passive:k}):s.addEventListener(l,p,!1)}function aw(s,l,p,y,k){var S=y;if((l&1)===0&&(l&2)===0&&y!==null)e:for(;;){if(y===null)return;var M=y.tag;if(M===3||M===4){var V=y.stateNode.containerInfo;if(V===k)break;if(M===4)for(M=y.return;M!==null;){var oe=M.tag;if((oe===3||oe===4)&&M.stateNode.containerInfo===k)return;M=M.return}for(;V!==null;){if(M=zi(V),M===null)return;if(oe=M.tag,oe===5||oe===6||oe===26||oe===27){y=S=M;continue e}V=V.parentNode}}y=y.return}Lr(function(){var Te=S,Ue=Rs(p),Ge=[];e:{var Pe=T1.get(s);if(Pe!==void 0){var Ne=ic,Pt=s;switch(s){case"keypress":if(Ed(p)===0)break e;case"keydown":case"keyup":Ne=Jg;break;case"focusin":Pt="focus",Ne=gt;break;case"focusout":Pt="blur",Ne=gt;break;case"beforeblur":case"afterblur":Ne=gt;break;case"click":if(p.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ne=Me;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ne=Ve;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ne=f$;break;case k1:case w1:case S1:Ne=nn;break;case E1:Ne=h$;break;case"scroll":case"scrollend":Ne=x0;break;case"wheel":Ne=g$;break;case"copy":case"cut":case"paste":Ne=an;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ne=r1;break;case"toggle":case"beforetoggle":Ne=v$}var Ht=(l&4)!==0,Zr=!Ht&&(s==="scroll"||s==="scrollend"),ve=Ht?Pe!==null?Pe+"Capture":null:Pe;Ht=[];for(var de=Te,Ee;de!==null;){var qe=de;if(Ee=qe.stateNode,qe=qe.tag,qe!==5&&qe!==26&&qe!==27||Ee===null||ve===null||(qe=Zn(de,ve),qe!=null&&Ht.push(hh(de,qe,Ee))),Zr)break;de=de.return}0<Ht.length&&(Pe=new Ne(Pe,Pt,null,p,Ue),Ge.push({event:Pe,listeners:Ht}))}}if((l&7)===0){e:{if(Pe=s==="mouseover"||s==="pointerover",Ne=s==="mouseout"||s==="pointerout",Pe&&p!==Qc&&(Pt=p.relatedTarget||p.fromElement)&&(zi(Pt)||Pt[Nn]))break e;if((Ne||Pe)&&(Pe=Ue.window===Ue?Ue:(Pe=Ue.ownerDocument)?Pe.defaultView||Pe.parentWindow:window,Ne?(Pt=p.relatedTarget||p.toElement,Ne=Te,Pt=Pt?zi(Pt):null,Pt!==null&&(Zr=i(Pt),Ht=Pt.tag,Pt!==Zr||Ht!==5&&Ht!==27&&Ht!==6)&&(Pt=null)):(Ne=null,Pt=Te),Ne!==Pt)){if(Ht=Me,qe="onMouseLeave",ve="onMouseEnter",de="mouse",(s==="pointerout"||s==="pointerover")&&(Ht=r1,qe="onPointerLeave",ve="onPointerEnter",de="pointer"),Zr=Ne==null?Pe:_i(Ne),Ee=Pt==null?Pe:_i(Pt),Pe=new Ht(qe,de+"leave",Ne,p,Ue),Pe.target=Zr,Pe.relatedTarget=Ee,qe=null,zi(Ue)===Te&&(Ht=new Ht(ve,de+"enter",Pt,p,Ue),Ht.target=Ee,Ht.relatedTarget=Zr,qe=Ht),Zr=qe,Ne&&Pt)t:{for(Ht=y8,ve=Ne,de=Pt,Ee=0,qe=ve;qe;qe=Ht(qe))Ee++;qe=0;for(var Ft=de;Ft;Ft=Ht(Ft))qe++;for(;0<Ee-qe;)ve=Ht(ve),Ee--;for(;0<qe-Ee;)de=Ht(de),qe--;for(;Ee--;){if(ve===de||de!==null&&ve===de.alternate){Ht=ve;break t}ve=Ht(ve),de=Ht(de)}Ht=null}else Ht=null;Ne!==null&&W2(Ge,Pe,Ne,Ht,!1),Pt!==null&&Zr!==null&&W2(Ge,Zr,Pt,Ht,!0)}}e:{if(Pe=Te?_i(Te):window,Ne=Pe.nodeName&&Pe.nodeName.toLowerCase(),Ne==="select"||Ne==="input"&&Pe.type==="file")var Nr=u1;else if(c1(Pe))if(d1)Nr=P$;else{Nr=C$;var Lt=T$}else Ne=Pe.nodeName,!Ne||Ne.toLowerCase()!=="input"||Pe.type!=="checkbox"&&Pe.type!=="radio"?Te&&rn(Te.elementType)&&(Nr=u1):Nr=x$;if(Nr&&(Nr=Nr(s,Te))){l1(Ge,Nr,p,Ue);break e}Lt&&Lt(s,Pe,Te),s==="focusout"&&Te&&Pe.type==="number"&&Te.memoizedProps.value!=null&&Jc(Pe,"number",Pe.value)}switch(Lt=Te?_i(Te):window,s){case"focusin":(c1(Lt)||Lt.contentEditable==="true")&&(Pd=Lt,N0=Te,$p=null);break;case"focusout":$p=N0=Pd=null;break;case"mousedown":I0=!0;break;case"contextmenu":case"mouseup":case"dragend":I0=!1,_1(Ge,p,Ue);break;case"selectionchange":if(R$)break;case"keydown":case"keyup":_1(Ge,p,Ue)}var ir;if(A0)e:{switch(s){case"compositionstart":var kr="onCompositionStart";break e;case"compositionend":kr="onCompositionEnd";break e;case"compositionupdate":kr="onCompositionUpdate";break e}kr=void 0}else xd?s1(s,p)&&(kr="onCompositionEnd"):s==="keydown"&&p.keyCode===229&&(kr="onCompositionStart");kr&&(n1&&p.locale!=="ko"&&(xd||kr!=="onCompositionStart"?kr==="onCompositionEnd"&&xd&&(ir=nc()):(ta=Ue,Fn="value"in ta?ta.value:ta.textContent,xd=!0)),Lt=Fy(Te,kr),0<Lt.length&&(kr=new sc(kr,s,null,p,Ue),Ge.push({event:kr,listeners:Lt}),ir?kr.data=ir:(ir=o1(p),ir!==null&&(kr.data=ir)))),(ir=b$?k$(s,p):w$(s,p))&&(kr=Fy(Te,"onBeforeInput"),0<kr.length&&(Lt=new sc("onBeforeInput","beforeinput",null,p,Ue),Ge.push({event:Lt,listeners:kr}),Lt.data=ir)),p8(Ge,s,Te,p,Ue)}H2(Ge,l)})}function hh(s,l,p){return{instance:s,listener:l,currentTarget:p}}function Fy(s,l){for(var p=l+"Capture",y=[];s!==null;){var k=s,S=k.stateNode;if(k=k.tag,k!==5&&k!==26&&k!==27||S===null||(k=Zn(s,p),k!=null&&y.unshift(hh(s,k,S)),k=Zn(s,l),k!=null&&y.push(hh(s,k,S))),s.tag===3)return y;s=s.return}return[]}function y8(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function W2(s,l,p,y,k){for(var S=l._reactName,M=[];p!==null&&p!==y;){var V=p,oe=V.alternate,Te=V.stateNode;if(V=V.tag,oe!==null&&oe===y)break;V!==5&&V!==26&&V!==27||Te===null||(oe=Te,k?(Te=Zn(p,S),Te!=null&&M.unshift(hh(p,Te,oe))):k||(Te=Zn(p,S),Te!=null&&M.push(hh(p,Te,oe)))),p=p.return}M.length!==0&&s.push({event:l,listeners:M})}var v8=/\r\n?/g,_8=/\u0000|\uFFFD/g;function K2(s){return(typeof s=="string"?s:""+s).replace(v8,`
`).replace(_8,"")}function Y2(s,l){return l=K2(l),K2(s)===l}function Qr(s,l,p,y,k,S){switch(p){case"children":typeof y=="string"?l==="body"||l==="textarea"&&y===""||Je(s,y):(typeof y=="number"||typeof y=="bigint")&&l!=="body"&&Je(s,""+y);break;case"className":lo(s,"class",y);break;case"tabIndex":lo(s,"tabindex",y);break;case"dir":case"role":case"viewBox":case"width":case"height":lo(s,p,y);break;case"style":Or(s,y,S);break;case"data":if(l!=="object"){lo(s,"data",y);break}case"src":case"href":if(y===""&&(l!=="a"||p!=="href")){s.removeAttribute(p);break}if(y==null||typeof y=="function"||typeof y=="symbol"||typeof y=="boolean"){s.removeAttribute(p);break}y=As(""+y),s.setAttribute(p,y);break;case"action":case"formAction":if(typeof y=="function"){s.setAttribute(p,"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 S=="function"&&(p==="formAction"?(l!=="input"&&Qr(s,l,"name",k.name,k,null),Qr(s,l,"formEncType",k.formEncType,k,null),Qr(s,l,"formMethod",k.formMethod,k,null),Qr(s,l,"formTarget",k.formTarget,k,null)):(Qr(s,l,"encType",k.encType,k,null),Qr(s,l,"method",k.method,k,null),Qr(s,l,"target",k.target,k,null)));if(y==null||typeof y=="symbol"||typeof y=="boolean"){s.removeAttribute(p);break}y=As(""+y),s.setAttribute(p,y);break;case"onClick":y!=null&&(s.onclick=ya);break;case"onScroll":y!=null&&yr("scroll",s);break;case"onScrollEnd":y!=null&&yr("scrollend",s);break;case"dangerouslySetInnerHTML":if(y!=null){if(typeof y!="object"||!("__html"in y))throw Error(n(61));if(p=y.__html,p!=null){if(k.children!=null)throw Error(n(60));s.innerHTML=p}}break;case"multiple":s.multiple=y&&typeof y!="function"&&typeof y!="symbol";break;case"muted":s.muted=y&&typeof y!="function"&&typeof y!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(y==null||typeof y=="function"||typeof y=="boolean"||typeof y=="symbol"){s.removeAttribute("xlink:href");break}p=As(""+y),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",p);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":y!=null&&typeof y!="function"&&typeof y!="symbol"?s.setAttribute(p,""+y):s.removeAttribute(p);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":y&&typeof y!="function"&&typeof y!="symbol"?s.setAttribute(p,""):s.removeAttribute(p);break;case"capture":case"download":y===!0?s.setAttribute(p,""):y!==!1&&y!=null&&typeof y!="function"&&typeof y!="symbol"?s.setAttribute(p,y):s.removeAttribute(p);break;case"cols":case"rows":case"size":case"span":y!=null&&typeof y!="function"&&typeof y!="symbol"&&!isNaN(y)&&1<=y?s.setAttribute(p,y):s.removeAttribute(p);break;case"rowSpan":case"start":y==null||typeof y=="function"||typeof y=="symbol"||isNaN(y)?s.removeAttribute(p):s.setAttribute(p,y);break;case"popover":yr("beforetoggle",s),yr("toggle",s),rc(s,"popover",y);break;case"xlinkActuate":ma(s,"http://www.w3.org/1999/xlink","xlink:actuate",y);break;case"xlinkArcrole":ma(s,"http://www.w3.org/1999/xlink","xlink:arcrole",y);break;case"xlinkRole":ma(s,"http://www.w3.org/1999/xlink","xlink:role",y);break;case"xlinkShow":ma(s,"http://www.w3.org/1999/xlink","xlink:show",y);break;case"xlinkTitle":ma(s,"http://www.w3.org/1999/xlink","xlink:title",y);break;case"xlinkType":ma(s,"http://www.w3.org/1999/xlink","xlink:type",y);break;case"xmlBase":ma(s,"http://www.w3.org/XML/1998/namespace","xml:base",y);break;case"xmlLang":ma(s,"http://www.w3.org/XML/1998/namespace","xml:lang",y);break;case"xmlSpace":ma(s,"http://www.w3.org/XML/1998/namespace","xml:space",y);break;case"is":rc(s,"is",y);break;case"innerText":case"textContent":break;default:(!(2<p.length)||p[0]!=="o"&&p[0]!=="O"||p[1]!=="n"&&p[1]!=="N")&&(p=Tn.get(p)||p,rc(s,p,y))}}function iw(s,l,p,y,k,S){switch(p){case"style":Or(s,y,S);break;case"dangerouslySetInnerHTML":if(y!=null){if(typeof y!="object"||!("__html"in y))throw Error(n(61));if(p=y.__html,p!=null){if(k.children!=null)throw Error(n(60));s.innerHTML=p}}break;case"children":typeof y=="string"?Je(s,y):(typeof y=="number"||typeof y=="bigint")&&Je(s,""+y);break;case"onScroll":y!=null&&yr("scroll",s);break;case"onScrollEnd":y!=null&&yr("scrollend",s);break;case"onClick":y!=null&&(s.onclick=ya);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!xs.hasOwnProperty(p))e:{if(p[0]==="o"&&p[1]==="n"&&(k=p.endsWith("Capture"),l=p.slice(2,k?p.length-7:void 0),S=s[Dt]||null,S=S!=null?S[p]:null,typeof S=="function"&&s.removeEventListener(l,S,k),typeof y=="function")){typeof S!="function"&&S!==null&&(p in s?s[p]=null:s.hasAttribute(p)&&s.removeAttribute(p)),s.addEventListener(l,y,k);break e}p in s?s[p]=y:y===!0?s.setAttribute(p,""):rc(s,p,y)}}}function ka(s,l,p){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":yr("error",s),yr("load",s);var y=!1,k=!1,S;for(S in p)if(p.hasOwnProperty(S)){var M=p[S];if(M!=null)switch(S){case"src":y=!0;break;case"srcSet":k=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(n(137,l));default:Qr(s,l,S,M,p,null)}}k&&Qr(s,l,"srcSet",p.srcSet,p,null),y&&Qr(s,l,"src",p.src,p,null);return;case"input":yr("invalid",s);var V=S=M=k=null,oe=null,Te=null;for(y in p)if(p.hasOwnProperty(y)){var Ue=p[y];if(Ue!=null)switch(y){case"name":k=Ue;break;case"type":M=Ue;break;case"checked":oe=Ue;break;case"defaultChecked":Te=Ue;break;case"value":S=Ue;break;case"defaultValue":V=Ue;break;case"children":case"dangerouslySetInnerHTML":if(Ue!=null)throw Error(n(137,l));break;default:Qr(s,l,y,Ue,p,null)}}bi(s,S,V,oe,Te,M,k,!1);return;case"select":yr("invalid",s),y=M=S=null;for(k in p)if(p.hasOwnProperty(k)&&(V=p[k],V!=null))switch(k){case"value":S=V;break;case"defaultValue":M=V;break;case"multiple":y=V;default:Qr(s,l,k,V,p,null)}l=S,p=M,s.multiple=!!y,l!=null?_e(s,!!y,l,!1):p!=null&&_e(s,!!y,p,!0);return;case"textarea":yr("invalid",s),S=k=y=null;for(M in p)if(p.hasOwnProperty(M)&&(V=p[M],V!=null))switch(M){case"value":y=V;break;case"defaultValue":k=V;break;case"children":S=V;break;case"dangerouslySetInnerHTML":if(V!=null)throw Error(n(91));break;default:Qr(s,l,M,V,p,null)}ot(s,y,k,S);return;case"option":for(oe in p)if(p.hasOwnProperty(oe)&&(y=p[oe],y!=null))switch(oe){case"selected":s.selected=y&&typeof y!="function"&&typeof y!="symbol";break;default:Qr(s,l,oe,y,p,null)}return;case"dialog":yr("beforetoggle",s),yr("toggle",s),yr("cancel",s),yr("close",s);break;case"iframe":case"object":yr("load",s);break;case"video":case"audio":for(y=0;y<ph.length;y++)yr(ph[y],s);break;case"image":yr("error",s),yr("load",s);break;case"details":yr("toggle",s);break;case"embed":case"source":case"link":yr("error",s),yr("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Te in p)if(p.hasOwnProperty(Te)&&(y=p[Te],y!=null))switch(Te){case"children":case"dangerouslySetInnerHTML":throw Error(n(137,l));default:Qr(s,l,Te,y,p,null)}return;default:if(rn(l)){for(Ue in p)p.hasOwnProperty(Ue)&&(y=p[Ue],y!==void 0&&iw(s,l,Ue,y,p,void 0));return}}for(V in p)p.hasOwnProperty(V)&&(y=p[V],y!=null&&Qr(s,l,V,y,p,null))}function b8(s,l,p,y){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var k=null,S=null,M=null,V=null,oe=null,Te=null,Ue=null;for(Ne in p){var Ge=p[Ne];if(p.hasOwnProperty(Ne)&&Ge!=null)switch(Ne){case"checked":break;case"value":break;case"defaultValue":oe=Ge;default:y.hasOwnProperty(Ne)||Qr(s,l,Ne,null,y,Ge)}}for(var Pe in y){var Ne=y[Pe];if(Ge=p[Pe],y.hasOwnProperty(Pe)&&(Ne!=null||Ge!=null))switch(Pe){case"type":S=Ne;break;case"name":k=Ne;break;case"checked":Te=Ne;break;case"defaultChecked":Ue=Ne;break;case"value":M=Ne;break;case"defaultValue":V=Ne;break;case"children":case"dangerouslySetInnerHTML":if(Ne!=null)throw Error(n(137,l));break;default:Ne!==Ge&&Qr(s,l,Pe,Ne,y,Ge)}}fo(s,M,V,oe,Te,Ue,S,k);return;case"select":Ne=M=V=Pe=null;for(S in p)if(oe=p[S],p.hasOwnProperty(S)&&oe!=null)switch(S){case"value":break;case"multiple":Ne=oe;default:y.hasOwnProperty(S)||Qr(s,l,S,null,y,oe)}for(k in y)if(S=y[k],oe=p[k],y.hasOwnProperty(k)&&(S!=null||oe!=null))switch(k){case"value":Pe=S;break;case"defaultValue":V=S;break;case"multiple":M=S;default:S!==oe&&Qr(s,l,k,S,y,oe)}l=V,p=M,y=Ne,Pe!=null?_e(s,!!p,Pe,!1):!!y!=!!p&&(l!=null?_e(s,!!p,l,!0):_e(s,!!p,p?[]:"",!1));return;case"textarea":Ne=Pe=null;for(V in p)if(k=p[V],p.hasOwnProperty(V)&&k!=null&&!y.hasOwnProperty(V))switch(V){case"value":break;case"children":break;default:Qr(s,l,V,null,y,k)}for(M in y)if(k=y[M],S=p[M],y.hasOwnProperty(M)&&(k!=null||S!=null))switch(M){case"value":Pe=k;break;case"defaultValue":Ne=k;break;case"children":break;case"dangerouslySetInnerHTML":if(k!=null)throw Error(n(91));break;default:k!==S&&Qr(s,l,M,k,y,S)}Ze(s,Pe,Ne);return;case"option":for(var Pt in p)if(Pe=p[Pt],p.hasOwnProperty(Pt)&&Pe!=null&&!y.hasOwnProperty(Pt))switch(Pt){case"selected":s.selected=!1;break;default:Qr(s,l,Pt,null,y,Pe)}for(oe in y)if(Pe=y[oe],Ne=p[oe],y.hasOwnProperty(oe)&&Pe!==Ne&&(Pe!=null||Ne!=null))switch(oe){case"selected":s.selected=Pe&&typeof Pe!="function"&&typeof Pe!="symbol";break;default:Qr(s,l,oe,Pe,y,Ne)}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 Ht in p)Pe=p[Ht],p.hasOwnProperty(Ht)&&Pe!=null&&!y.hasOwnProperty(Ht)&&Qr(s,l,Ht,null,y,Pe);for(Te in y)if(Pe=y[Te],Ne=p[Te],y.hasOwnProperty(Te)&&Pe!==Ne&&(Pe!=null||Ne!=null))switch(Te){case"children":case"dangerouslySetInnerHTML":if(Pe!=null)throw Error(n(137,l));break;default:Qr(s,l,Te,Pe,y,Ne)}return;default:if(rn(l)){for(var Zr in p)Pe=p[Zr],p.hasOwnProperty(Zr)&&Pe!==void 0&&!y.hasOwnProperty(Zr)&&iw(s,l,Zr,void 0,y,Pe);for(Ue in y)Pe=y[Ue],Ne=p[Ue],!y.hasOwnProperty(Ue)||Pe===Ne||Pe===void 0&&Ne===void 0||iw(s,l,Ue,Pe,y,Ne);return}}for(var ve in p)Pe=p[ve],p.hasOwnProperty(ve)&&Pe!=null&&!y.hasOwnProperty(ve)&&Qr(s,l,ve,null,y,Pe);for(Ge in y)Pe=y[Ge],Ne=p[Ge],!y.hasOwnProperty(Ge)||Pe===Ne||Pe==null&&Ne==null||Qr(s,l,Ge,Pe,y,Ne)}function X2(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function k8(){if(typeof performance.getEntriesByType=="function"){for(var s=0,l=0,p=performance.getEntriesByType("resource"),y=0;y<p.length;y++){var k=p[y],S=k.transferSize,M=k.initiatorType,V=k.duration;if(S&&V&&X2(M)){for(M=0,V=k.responseEnd,y+=1;y<p.length;y++){var oe=p[y],Te=oe.startTime;if(Te>V)break;var Ue=oe.transferSize,Ge=oe.initiatorType;Ue&&X2(Ge)&&(oe=oe.responseEnd,M+=Ue*(oe<V?1:(V-Te)/(oe-Te)))}if(--y,l+=8*(S+M)/(k.duration/1e3),s++,10<s)break}}if(0<s)return l/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var sw=null,ow=null;function qy(s){return s.nodeType===9?s:s.ownerDocument}function J2(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Q2(s,l){if(s===0)switch(l){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&l==="foreignObject"?0:s}function cw(s,l){return s==="textarea"||s==="noscript"||typeof l.children=="string"||typeof l.children=="number"||typeof l.children=="bigint"||typeof l.dangerouslySetInnerHTML=="object"&&l.dangerouslySetInnerHTML!==null&&l.dangerouslySetInnerHTML.__html!=null}var lw=null;function w8(){var s=window.event;return s&&s.type==="popstate"?s===lw?!1:(lw=s,!0):(lw=null,!1)}var Z2=typeof setTimeout=="function"?setTimeout:void 0,S8=typeof clearTimeout=="function"?clearTimeout:void 0,eD=typeof Promise=="function"?Promise:void 0,E8=typeof queueMicrotask=="function"?queueMicrotask:typeof eD<"u"?function(s){return eD.resolve(null).then(s).catch(T8)}:Z2;function T8(s){setTimeout(function(){throw s})}function vl(s){return s==="head"}function tD(s,l){var p=l,y=0;do{var k=p.nextSibling;if(s.removeChild(p),k&&k.nodeType===8)if(p=k.data,p==="/$"||p==="/&"){if(y===0){s.removeChild(k),tf(l);return}y--}else if(p==="$"||p==="$?"||p==="$~"||p==="$!"||p==="&")y++;else if(p==="html")mh(s.ownerDocument.documentElement);else if(p==="head"){p=s.ownerDocument.head,mh(p);for(var S=p.firstChild;S;){var M=S.nextSibling,V=S.nodeName;S[pn]||V==="SCRIPT"||V==="STYLE"||V==="LINK"&&S.rel.toLowerCase()==="stylesheet"||p.removeChild(S),S=M}}else p==="body"&&mh(s.ownerDocument.body);p=k}while(p);tf(l)}function rD(s,l){var p=s;s=0;do{var y=p.nextSibling;if(p.nodeType===1?l?(p._stashedDisplay=p.style.display,p.style.display="none"):(p.style.display=p._stashedDisplay||"",p.getAttribute("style")===""&&p.removeAttribute("style")):p.nodeType===3&&(l?(p._stashedText=p.nodeValue,p.nodeValue=""):p.nodeValue=p._stashedText||""),y&&y.nodeType===8)if(p=y.data,p==="/$"){if(s===0)break;s--}else p!=="$"&&p!=="$?"&&p!=="$~"&&p!=="$!"||s++;p=y}while(p)}function uw(s){var l=s.firstChild;for(l&&l.nodeType===10&&(l=l.nextSibling);l;){var p=l;switch(l=l.nextSibling,p.nodeName){case"HTML":case"HEAD":case"BODY":uw(p),tc(p);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(p.rel.toLowerCase()==="stylesheet")continue}s.removeChild(p)}}function C8(s,l,p,y){for(;s.nodeType===1;){var k=p;if(s.nodeName.toLowerCase()!==l.toLowerCase()){if(!y&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(y){if(!s[pn])switch(l){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(S=s.getAttribute("rel"),S==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(S!==k.rel||s.getAttribute("href")!==(k.href==null||k.href===""?null:k.href)||s.getAttribute("crossorigin")!==(k.crossOrigin==null?null:k.crossOrigin)||s.getAttribute("title")!==(k.title==null?null:k.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(S=s.getAttribute("src"),(S!==(k.src==null?null:k.src)||s.getAttribute("type")!==(k.type==null?null:k.type)||s.getAttribute("crossorigin")!==(k.crossOrigin==null?null:k.crossOrigin))&&S&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(l==="input"&&s.type==="hidden"){var S=k.name==null?null:""+k.name;if(k.type==="hidden"&&s.getAttribute("name")===S)return s}else return s;if(s=Zi(s.nextSibling),s===null)break}return null}function x8(s,l,p){if(l==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!p||(s=Zi(s.nextSibling),s===null))return null;return s}function nD(s,l){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!l||(s=Zi(s.nextSibling),s===null))return null;return s}function dw(s){return s.data==="$?"||s.data==="$~"}function fw(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function P8(s,l){var p=s.ownerDocument;if(s.data==="$~")s._reactRetry=l;else if(s.data!=="$?"||p.readyState!=="loading")l();else{var y=function(){l(),p.removeEventListener("DOMContentLoaded",y)};p.addEventListener("DOMContentLoaded",y),s._reactRetry=y}}function Zi(s){for(;s!=null;s=s.nextSibling){var l=s.nodeType;if(l===1||l===3)break;if(l===8){if(l=s.data,l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"||l==="F!"||l==="F")break;if(l==="/$"||l==="/&")return null}}return s}var pw=null;function aD(s){s=s.nextSibling;for(var l=0;s;){if(s.nodeType===8){var p=s.data;if(p==="/$"||p==="/&"){if(l===0)return Zi(s.nextSibling);l--}else p!=="$"&&p!=="$!"&&p!=="$?"&&p!=="$~"&&p!=="&"||l++}s=s.nextSibling}return null}function iD(s){s=s.previousSibling;for(var l=0;s;){if(s.nodeType===8){var p=s.data;if(p==="$"||p==="$!"||p==="$?"||p==="$~"||p==="&"){if(l===0)return s;l--}else p!=="/$"&&p!=="/&"||l++}s=s.previousSibling}return null}function sD(s,l,p){switch(l=qy(p),s){case"html":if(s=l.documentElement,!s)throw Error(n(452));return s;case"head":if(s=l.head,!s)throw Error(n(453));return s;case"body":if(s=l.body,!s)throw Error(n(454));return s;default:throw Error(n(451))}}function mh(s){for(var l=s.attributes;l.length;)s.removeAttributeNode(l[0]);tc(s)}var es=new Map,oD=new Set;function zy(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var kc=Y.d;Y.d={f:A8,r:R8,D:D8,C:O8,L:N8,m:I8,X:j8,S:M8,M:L8};function A8(){var s=kc.f(),l=Ny();return s||l}function R8(s){var l=Ts(s);l!==null&&l.tag===5&&l.type==="form"?ER(l):kc.r(s)}var Qd=typeof document>"u"?null:document;function cD(s,l,p){var y=Qd;if(y&&typeof l=="string"&&l){var k=ca(l);k='link[rel="'+s+'"][href="'+k+'"]',typeof p=="string"&&(k+='[crossorigin="'+p+'"]'),oD.has(k)||(oD.add(k),s={rel:s,crossOrigin:p,href:l},y.querySelector(k)===null&&(l=y.createElement("link"),ka(l,"link",s),hn(l),y.head.appendChild(l)))}}function D8(s){kc.D(s),cD("dns-prefetch",s,null)}function O8(s,l){kc.C(s,l),cD("preconnect",s,l)}function N8(s,l,p){kc.L(s,l,p);var y=Qd;if(y&&s&&l){var k='link[rel="preload"][as="'+ca(l)+'"]';l==="image"&&p&&p.imageSrcSet?(k+='[imagesrcset="'+ca(p.imageSrcSet)+'"]',typeof p.imageSizes=="string"&&(k+='[imagesizes="'+ca(p.imageSizes)+'"]')):k+='[href="'+ca(s)+'"]';var S=k;switch(l){case"style":S=Zd(s);break;case"script":S=ef(s)}es.has(S)||(s=h({rel:"preload",href:l==="image"&&p&&p.imageSrcSet?void 0:s,as:l},p),es.set(S,s),y.querySelector(k)!==null||l==="style"&&y.querySelector(gh(S))||l==="script"&&y.querySelector(yh(S))||(l=y.createElement("link"),ka(l,"link",s),hn(l),y.head.appendChild(l)))}}function I8(s,l){kc.m(s,l);var p=Qd;if(p&&s){var y=l&&typeof l.as=="string"?l.as:"script",k='link[rel="modulepreload"][as="'+ca(y)+'"][href="'+ca(s)+'"]',S=k;switch(y){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":S=ef(s)}if(!es.has(S)&&(s=h({rel:"modulepreload",href:s},l),es.set(S,s),p.querySelector(k)===null)){switch(y){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(p.querySelector(yh(S)))return}y=p.createElement("link"),ka(y,"link",s),hn(y),p.head.appendChild(y)}}}function M8(s,l,p){kc.S(s,l,p);var y=Qd;if(y&&s){var k=Qn(y).hoistableStyles,S=Zd(s);l=l||"default";var M=k.get(S);if(!M){var V={loading:0,preload:null};if(M=y.querySelector(gh(S)))V.loading=5;else{s=h({rel:"stylesheet",href:s,"data-precedence":l},p),(p=es.get(S))&&hw(s,p);var oe=M=y.createElement("link");hn(oe),ka(oe,"link",s),oe._p=new Promise(function(Te,Ue){oe.onload=Te,oe.onerror=Ue}),oe.addEventListener("load",function(){V.loading|=1}),oe.addEventListener("error",function(){V.loading|=2}),V.loading|=4,$y(M,l,y)}M={type:"stylesheet",instance:M,count:1,state:V},k.set(S,M)}}}function j8(s,l){kc.X(s,l);var p=Qd;if(p&&s){var y=Qn(p).hoistableScripts,k=ef(s),S=y.get(k);S||(S=p.querySelector(yh(k)),S||(s=h({src:s,async:!0},l),(l=es.get(k))&&mw(s,l),S=p.createElement("script"),hn(S),ka(S,"link",s),p.head.appendChild(S)),S={type:"script",instance:S,count:1,state:null},y.set(k,S))}}function L8(s,l){kc.M(s,l);var p=Qd;if(p&&s){var y=Qn(p).hoistableScripts,k=ef(s),S=y.get(k);S||(S=p.querySelector(yh(k)),S||(s=h({src:s,async:!0,type:"module"},l),(l=es.get(k))&&mw(s,l),S=p.createElement("script"),hn(S),ka(S,"link",s),p.head.appendChild(S)),S={type:"script",instance:S,count:1,state:null},y.set(k,S))}}function lD(s,l,p,y){var k=(k=ue.current)?zy(k):null;if(!k)throw Error(n(446));switch(s){case"meta":case"title":return null;case"style":return typeof p.precedence=="string"&&typeof p.href=="string"?(l=Zd(p.href),p=Qn(k).hoistableStyles,y=p.get(l),y||(y={type:"style",instance:null,count:0,state:null},p.set(l,y)),y):{type:"void",instance:null,count:0,state:null};case"link":if(p.rel==="stylesheet"&&typeof p.href=="string"&&typeof p.precedence=="string"){s=Zd(p.href);var S=Qn(k).hoistableStyles,M=S.get(s);if(M||(k=k.ownerDocument||k,M={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},S.set(s,M),(S=k.querySelector(gh(s)))&&!S._p&&(M.instance=S,M.state.loading=5),es.has(s)||(p={rel:"preload",as:"style",href:p.href,crossOrigin:p.crossOrigin,integrity:p.integrity,media:p.media,hrefLang:p.hrefLang,referrerPolicy:p.referrerPolicy},es.set(s,p),S||B8(k,s,p,M.state))),l&&y===null)throw Error(n(528,""));return M}if(l&&y!==null)throw Error(n(529,""));return null;case"script":return l=p.async,p=p.src,typeof p=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=ef(p),p=Qn(k).hoistableScripts,y=p.get(l),y||(y={type:"script",instance:null,count:0,state:null},p.set(l,y)),y):{type:"void",instance:null,count:0,state:null};default:throw Error(n(444,s))}}function Zd(s){return'href="'+ca(s)+'"'}function gh(s){return'link[rel="stylesheet"]['+s+"]"}function uD(s){return h({},s,{"data-precedence":s.precedence,precedence:null})}function B8(s,l,p,y){s.querySelector('link[rel="preload"][as="style"]['+l+"]")?y.loading=1:(l=s.createElement("link"),y.preload=l,l.addEventListener("load",function(){return y.loading|=1}),l.addEventListener("error",function(){return y.loading|=2}),ka(l,"link",p),hn(l),s.head.appendChild(l))}function ef(s){return'[src="'+ca(s)+'"]'}function yh(s){return"script[async]"+s}function dD(s,l,p){if(l.count++,l.instance===null)switch(l.type){case"style":var y=s.querySelector('style[data-href~="'+ca(p.href)+'"]');if(y)return l.instance=y,hn(y),y;var k=h({},p,{"data-href":p.href,"data-precedence":p.precedence,href:null,precedence:null});return y=(s.ownerDocument||s).createElement("style"),hn(y),ka(y,"style",k),$y(y,p.precedence,s),l.instance=y;case"stylesheet":k=Zd(p.href);var S=s.querySelector(gh(k));if(S)return l.state.loading|=4,l.instance=S,hn(S),S;y=uD(p),(k=es.get(k))&&hw(y,k),S=(s.ownerDocument||s).createElement("link"),hn(S);var M=S;return M._p=new Promise(function(V,oe){M.onload=V,M.onerror=oe}),ka(S,"link",y),l.state.loading|=4,$y(S,p.precedence,s),l.instance=S;case"script":return S=ef(p.src),(k=s.querySelector(yh(S)))?(l.instance=k,hn(k),k):(y=p,(k=es.get(S))&&(y=h({},p),mw(y,k)),s=s.ownerDocument||s,k=s.createElement("script"),hn(k),ka(k,"link",y),s.head.appendChild(k),l.instance=k);case"void":return null;default:throw Error(n(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(y=l.instance,l.state.loading|=4,$y(y,p.precedence,s));return l.instance}function $y(s,l,p){for(var y=p.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),k=y.length?y[y.length-1]:null,S=k,M=0;M<y.length;M++){var V=y[M];if(V.dataset.precedence===l)S=V;else if(S!==k)break}S?S.parentNode.insertBefore(s,S.nextSibling):(l=p.nodeType===9?p.head:p,l.insertBefore(s,l.firstChild))}function hw(s,l){s.crossOrigin==null&&(s.crossOrigin=l.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=l.referrerPolicy),s.title==null&&(s.title=l.title)}function mw(s,l){s.crossOrigin==null&&(s.crossOrigin=l.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=l.referrerPolicy),s.integrity==null&&(s.integrity=l.integrity)}var Vy=null;function fD(s,l,p){if(Vy===null){var y=new Map,k=Vy=new Map;k.set(p,y)}else k=Vy,y=k.get(p),y||(y=new Map,k.set(p,y));if(y.has(s))return y;for(y.set(s,null),p=p.getElementsByTagName(s),k=0;k<p.length;k++){var S=p[k];if(!(S[pn]||S[Rt]||s==="link"&&S.getAttribute("rel")==="stylesheet")&&S.namespaceURI!=="http://www.w3.org/2000/svg"){var M=S.getAttribute(l)||"";M=s+M;var V=y.get(M);V?V.push(S):y.set(M,[S])}}return y}function pD(s,l,p){s=s.ownerDocument||s,s.head.insertBefore(p,l==="title"?s.querySelector("head > title"):null)}function U8(s,l,p){if(p===1||l.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;switch(l.rel){case"stylesheet":return s=l.disabled,typeof l.precedence=="string"&&s==null;default:return!0}case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function hD(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function F8(s,l,p,y){if(p.type==="stylesheet"&&(typeof y.media!="string"||matchMedia(y.media).matches!==!1)&&(p.state.loading&4)===0){if(p.instance===null){var k=Zd(y.href),S=l.querySelector(gh(k));if(S){l=S._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(s.count++,s=Hy.bind(s),l.then(s,s)),p.state.loading|=4,p.instance=S,hn(S);return}S=l.ownerDocument||l,y=uD(y),(k=es.get(k))&&hw(y,k),S=S.createElement("link"),hn(S);var M=S;M._p=new Promise(function(V,oe){M.onload=V,M.onerror=oe}),ka(S,"link",y),p.instance=S}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(p,l),(l=p.state.preload)&&(p.state.loading&3)===0&&(s.count++,p=Hy.bind(s),l.addEventListener("load",p),l.addEventListener("error",p))}}var gw=0;function q8(s,l){return s.stylesheets&&s.count===0&&Wy(s,s.stylesheets),0<s.count||0<s.imgCount?function(p){var y=setTimeout(function(){if(s.stylesheets&&Wy(s,s.stylesheets),s.unsuspend){var S=s.unsuspend;s.unsuspend=null,S()}},6e4+l);0<s.imgBytes&&gw===0&&(gw=62500*k8());var k=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&Wy(s,s.stylesheets),s.unsuspend)){var S=s.unsuspend;s.unsuspend=null,S()}},(s.imgBytes>gw?50:800)+l);return s.unsuspend=p,function(){s.unsuspend=null,clearTimeout(y),clearTimeout(k)}}:null}function Hy(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Wy(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var Gy=null;function Wy(s,l){s.stylesheets=null,s.unsuspend!==null&&(s.count++,Gy=new Map,l.forEach(z8,s),Gy=null,Hy.call(s))}function z8(s,l){if(!(l.state.loading&4)){var p=Gy.get(s);if(p)var y=p.get(null);else{p=new Map,Gy.set(s,p);for(var k=s.querySelectorAll("link[data-precedence],style[data-precedence]"),S=0;S<k.length;S++){var M=k[S];(M.nodeName==="LINK"||M.getAttribute("media")!=="not all")&&(p.set(M.dataset.precedence,M),y=M)}y&&p.set(null,y)}k=l.instance,M=k.getAttribute("data-precedence"),S=p.get(M)||y,S===y&&p.set(null,k),p.set(M,k),this.count++,y=Hy.bind(this),k.addEventListener("load",y),k.addEventListener("error",y),S?S.parentNode.insertBefore(k,S.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(k,s.firstChild)),l.state.loading|=4}}var vh={$$typeof:P,Provider:null,Consumer:null,_currentValue:Q,_currentValue2:Q,_threadCount:0};function $8(s,l,p,y,k,S,M,V,oe){this.tag=1,this.containerInfo=s,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=se(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=se(0),this.hiddenUpdates=se(null),this.identifierPrefix=y,this.onUncaughtError=k,this.onCaughtError=S,this.onRecoverableError=M,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=oe,this.incompleteTransitions=new Map}function mD(s,l,p,y,k,S,M,V,oe,Te,Ue,Ge){return s=new $8(s,l,p,M,oe,Te,Ue,Ge,V),l=1,S===!0&&(l|=24),S=Ei(3,null,null,l),s.current=S,S.stateNode=s,l=Y0(),l.refCount++,s.pooledCache=l,l.refCount++,S.memoizedState={element:y,isDehydrated:p,cache:l},Z0(S),s}function gD(s){return s?(s=Dd,s):Dd}function yD(s,l,p,y,k,S){k=gD(k),y.context===null?y.context=k:y.pendingContext=k,y=ol(l),y.payload={element:p},S=S===void 0?null:S,S!==null&&(y.callback=S),p=cl(s,y,l),p!==null&&(ti(p,s,l),Xp(p,s,l))}function vD(s,l){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var p=s.retryLane;s.retryLane=p!==0&&p<l?p:l}}function yw(s,l){vD(s,l),(s=s.alternate)&&vD(s,l)}function _D(s){if(s.tag===13||s.tag===31){var l=wu(s,67108864);l!==null&&ti(l,s,67108864),yw(s,67108864)}}function bD(s){if(s.tag===13||s.tag===31){var l=Ai();l=oa(l);var p=wu(s,l);p!==null&&ti(p,s,l),yw(s,l)}}var Ky=!0;function V8(s,l,p,y){var k=F.T;F.T=null;var S=Y.p;try{Y.p=2,vw(s,l,p,y)}finally{Y.p=S,F.T=k}}function H8(s,l,p,y){var k=F.T;F.T=null;var S=Y.p;try{Y.p=8,vw(s,l,p,y)}finally{Y.p=S,F.T=k}}function vw(s,l,p,y){if(Ky){var k=_w(y);if(k===null)aw(s,l,y,Yy,p),wD(s,y);else if(W8(k,s,l,p,y))y.stopPropagation();else if(wD(s,y),l&4&&-1<G8.indexOf(s)){for(;k!==null;){var S=Ts(k);if(S!==null)switch(S.tag){case 3:if(S=S.stateNode,S.current.memoizedState.isDehydrated){var M=X(S.pendingLanes);if(M!==0){var V=S;for(V.pendingLanes|=2,V.entangledLanes|=2;M;){var oe=1<<31-bt(M);V.entanglements[1]|=oe,M&=~oe}yo(S),(Br&6)===0&&(Dy=_t()+500,fh(0))}}break;case 31:case 13:V=wu(S,2),V!==null&&ti(V,S,2),Ny(),yw(S,2)}if(S=_w(y),S===null&&aw(s,l,y,Yy,p),S===k)break;k=S}k!==null&&y.stopPropagation()}else aw(s,l,y,null,p)}}function _w(s){return s=Rs(s),bw(s)}var Yy=null;function bw(s){if(Yy=null,s=zi(s),s!==null){var l=i(s);if(l===null)s=null;else{var p=l.tag;if(p===13){if(s=o(l),s!==null)return s;s=null}else if(p===31){if(s=c(l),s!==null)return s;s=null}else if(p===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;s=null}else l!==s&&(s=null)}}return Yy=s,null}function kD(s){switch(s){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(ge()){case Be:return 2;case je:return 8;case nt:case Ct:return 32;case jt:return 268435456;default:return 32}default:return 32}}var kw=!1,_l=null,bl=null,kl=null,_h=new Map,bh=new Map,wl=[],G8="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 wD(s,l){switch(s){case"focusin":case"focusout":_l=null;break;case"dragenter":case"dragleave":bl=null;break;case"mouseover":case"mouseout":kl=null;break;case"pointerover":case"pointerout":_h.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":bh.delete(l.pointerId)}}function kh(s,l,p,y,k,S){return s===null||s.nativeEvent!==S?(s={blockedOn:l,domEventName:p,eventSystemFlags:y,nativeEvent:S,targetContainers:[k]},l!==null&&(l=Ts(l),l!==null&&_D(l)),s):(s.eventSystemFlags|=y,l=s.targetContainers,k!==null&&l.indexOf(k)===-1&&l.push(k),s)}function W8(s,l,p,y,k){switch(l){case"focusin":return _l=kh(_l,s,l,p,y,k),!0;case"dragenter":return bl=kh(bl,s,l,p,y,k),!0;case"mouseover":return kl=kh(kl,s,l,p,y,k),!0;case"pointerover":var S=k.pointerId;return _h.set(S,kh(_h.get(S)||null,s,l,p,y,k)),!0;case"gotpointercapture":return S=k.pointerId,bh.set(S,kh(bh.get(S)||null,s,l,p,y,k)),!0}return!1}function SD(s){var l=zi(s.target);if(l!==null){var p=i(l);if(p!==null){if(l=p.tag,l===13){if(l=o(p),l!==null){s.blockedOn=l,Yt(s.priority,function(){bD(p)});return}}else if(l===31){if(l=c(p),l!==null){s.blockedOn=l,Yt(s.priority,function(){bD(p)});return}}else if(l===3&&p.stateNode.current.memoizedState.isDehydrated){s.blockedOn=p.tag===3?p.stateNode.containerInfo:null;return}}}s.blockedOn=null}function Xy(s){if(s.blockedOn!==null)return!1;for(var l=s.targetContainers;0<l.length;){var p=_w(s.nativeEvent);if(p===null){p=s.nativeEvent;var y=new p.constructor(p.type,p);Qc=y,p.target.dispatchEvent(y),Qc=null}else return l=Ts(p),l!==null&&_D(l),s.blockedOn=p,!1;l.shift()}return!0}function ED(s,l,p){Xy(s)&&p.delete(l)}function K8(){kw=!1,_l!==null&&Xy(_l)&&(_l=null),bl!==null&&Xy(bl)&&(bl=null),kl!==null&&Xy(kl)&&(kl=null),_h.forEach(ED),bh.forEach(ED)}function Jy(s,l){s.blockedOn===l&&(s.blockedOn=null,kw||(kw=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,K8)))}var Qy=null;function TD(s){Qy!==s&&(Qy=s,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Qy===s&&(Qy=null);for(var l=0;l<s.length;l+=3){var p=s[l],y=s[l+1],k=s[l+2];if(typeof y!="function"){if(bw(y||p)===null)continue;break}var S=Ts(p);S!==null&&(s.splice(l,3),l-=3,_k(S,{pending:!0,data:k,method:p.method,action:y},y,k))}}))}function tf(s){function l(oe){return Jy(oe,s)}_l!==null&&Jy(_l,s),bl!==null&&Jy(bl,s),kl!==null&&Jy(kl,s),_h.forEach(l),bh.forEach(l);for(var p=0;p<wl.length;p++){var y=wl[p];y.blockedOn===s&&(y.blockedOn=null)}for(;0<wl.length&&(p=wl[0],p.blockedOn===null);)SD(p),p.blockedOn===null&&wl.shift();if(p=(s.ownerDocument||s).$$reactFormReplay,p!=null)for(y=0;y<p.length;y+=3){var k=p[y],S=p[y+1],M=k[Dt]||null;if(typeof S=="function")M||TD(p);else if(M){var V=null;if(S&&S.hasAttribute("formAction")){if(k=S,M=S[Dt]||null)V=M.formAction;else if(bw(k)!==null)continue}else V=M.action;typeof V=="function"?p[y+1]=V:(p.splice(y,3),y-=3),TD(p)}}}function CD(){function s(S){S.canIntercept&&S.info==="react-transition"&&S.intercept({handler:function(){return new Promise(function(M){return k=M})},focusReset:"manual",scroll:"manual"})}function l(){k!==null&&(k(),k=null),y||setTimeout(p,20)}function p(){if(!y&&!navigation.transition){var S=navigation.currentEntry;S&&S.url!=null&&navigation.navigate(S.url,{state:S.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var y=!1,k=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",l),navigation.addEventListener("navigateerror",l),setTimeout(p,100),function(){y=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",l),navigation.removeEventListener("navigateerror",l),k!==null&&(k(),k=null)}}}function ww(s){this._internalRoot=s}Zy.prototype.render=ww.prototype.render=function(s){var l=this._internalRoot;if(l===null)throw Error(n(409));var p=l.current,y=Ai();yD(p,y,s,l,null,null)},Zy.prototype.unmount=ww.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var l=s.containerInfo;yD(s.current,2,null,s,null,null),Ny(),l[Nn]=null}};function Zy(s){this._internalRoot=s}Zy.prototype.unstable_scheduleHydration=function(s){if(s){var l=Ye();s={blockedOn:null,target:s,priority:l};for(var p=0;p<wl.length&&l!==0&&l<wl[p].priority;p++);wl.splice(p,0,s),p===0&&SD(s)}};var xD=e.version;if(xD!=="19.2.0")throw Error(n(527,xD,"19.2.0"));Y.findDOMNode=function(s){var l=s._reactInternals;if(l===void 0)throw typeof s.render=="function"?Error(n(188)):(s=Object.keys(s).join(","),Error(n(268,s)));return s=d(l),s=s!==null?f(s):null,s=s===null?null:s.stateNode,s};var Y8={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:F,reconcilerVersion:"19.2.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ev=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ev.isDisabled&&ev.supportsFiber)try{at=ev.inject(Y8),we=ev}catch{}}return Sh.createRoot=function(s,l){if(!a(s))throw Error(n(299));var p=!1,y="",k=IR,S=MR,M=jR;return l!=null&&(l.unstable_strictMode===!0&&(p=!0),l.identifierPrefix!==void 0&&(y=l.identifierPrefix),l.onUncaughtError!==void 0&&(k=l.onUncaughtError),l.onCaughtError!==void 0&&(S=l.onCaughtError),l.onRecoverableError!==void 0&&(M=l.onRecoverableError)),l=mD(s,1,!1,null,null,p,y,null,k,S,M,CD),s[Nn]=l.current,nw(s),new ww(l)},Sh.hydrateRoot=function(s,l,p){if(!a(s))throw Error(n(299));var y=!1,k="",S=IR,M=MR,V=jR,oe=null;return p!=null&&(p.unstable_strictMode===!0&&(y=!0),p.identifierPrefix!==void 0&&(k=p.identifierPrefix),p.onUncaughtError!==void 0&&(S=p.onUncaughtError),p.onCaughtError!==void 0&&(M=p.onCaughtError),p.onRecoverableError!==void 0&&(V=p.onRecoverableError),p.formState!==void 0&&(oe=p.formState)),l=mD(s,1,!0,l,p??null,y,k,oe,S,M,V,CD),l.context=gD(null),p=l.current,y=Ai(),y=oa(y),k=ol(y),k.callback=null,cl(p,k,y),p=y,l.current.lanes=p,Oe(l,p),yo(l),s[Nn]=l.current,nw(s),new Zy(l)},Sh.version="19.2.0",Sh}var LD;function aV(){if(LD)return Tw.exports;LD=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch{}}return t(),Tw.exports=nV(),Tw.exports}var Aw=aV();/**
 * react-router v7.9.2
 *
 * Copyright (c) Remix Software Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */var BD="popstate";function iV(t={}){function e(n,a){let{pathname:i,search:o,hash:c}=n.location;return sT("",{pathname:i,search:o,hash:c},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function r(n,a){return typeof a=="string"?a:Cm(a)}return oV(e,r,null,t)}function Sn(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function Xs(t,e){if(!t)try{throw new Error(e)}catch{}}function sV(){return Math.random().toString(36).substring(2,10)}function UD(t,e){return{usr:t.state,key:t.key,idx:e}}function sT(t,e,r=null,n){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof e=="string"?_p(e):e,state:r,key:e&&e.key||n||sV()}}function Cm({pathname:t="/",search:e="",hash:r=""}){return e&&e!=="?"&&(t+=e.charAt(0)==="?"?e:"?"+e),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function _p(t){let e={};if(t){let r=t.indexOf("#");r>=0&&(e.hash=t.substring(r),t=t.substring(0,r));let n=t.indexOf("?");n>=0&&(e.search=t.substring(n),t=t.substring(0,n)),t&&(e.pathname=t)}return e}function oV(t,e,r,n={}){let{window:a=document.defaultView,v5Compat:i=!1}=n,o=a.history,c="POP",u=null,d=f();d==null&&(d=0,o.replaceState({...o.state,idx:d},""));function f(){return(o.state||{idx:null}).idx}function h(){c="POP";let E=f(),T=E==null?null:E-d;d=E,u&&u({action:c,location:b.location,delta:T})}function m(E,T){c="PUSH";let D=sT(b.location,E,T);d=f()+1;let P=UD(D,d),A=b.createHref(D);try{o.pushState(P,"",A)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;a.location.assign(A)}i&&u&&u({action:c,location:b.location,delta:1})}function _(E,T){c="REPLACE";let D=sT(b.location,E,T);d=f();let P=UD(D,d),A=b.createHref(D);o.replaceState(P,"",A),i&&u&&u({action:c,location:b.location,delta:0})}function w(E){return cV(E)}let b={get action(){return c},get location(){return t(a,o)},listen(E){if(u)throw new Error("A history only accepts one active listener");return a.addEventListener(BD,h),u=E,()=>{a.removeEventListener(BD,h),u=null}},createHref(E){return e(a,E)},createURL:w,encodeLocation(E){let T=w(E);return{pathname:T.pathname,search:T.search,hash:T.hash}},push:m,replace:_,go(E){return o.go(E)}};return b}function cV(t,e=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),Sn(r,"No window.location.(origin|href) available to create URL");let n=typeof t=="string"?t:Cm(t);return n=n.replace(/ $/,"%20"),!e&&n.startsWith("//")&&(n=r+n),new URL(n,r)}function t3(t,e,r="/"){return lV(t,e,r,!1)}function lV(t,e,r,n){let a=typeof e=="string"?_p(e):e,i=Uc(a.pathname||"/",r);if(i==null)return null;let o=r3(t);uV(o);let c=null;for(let u=0;c==null&&u<o.length;++u){let d=kV(i);c=_V(o[u],d,n)}return c}function r3(t,e=[],r=[],n="",a=!1){let i=(o,c,u=a,d)=>{let f={relativePath:d===void 0?o.path||"":d,caseSensitive:o.caseSensitive===!0,childrenIndex:c,route:o};if(f.relativePath.startsWith("/")){if(!f.relativePath.startsWith(n)&&u)return;Sn(f.relativePath.startsWith(n),`Absolute route path "${f.relativePath}" nested under path "${n}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),f.relativePath=f.relativePath.slice(n.length)}let h=Oc([n,f.relativePath]),m=r.concat(f);o.children&&o.children.length>0&&(Sn(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${h}".`),r3(o.children,e,m,h,u)),!(o.path==null&&!o.index)&&e.push({path:h,score:yV(h,o.index),routesMeta:m})};return t.forEach((o,c)=>{if(o.path===""||!o.path?.includes("?"))i(o,c);else for(let u of n3(o.path))i(o,c,!0,u)}),e}function n3(t){let e=t.split("/");if(e.length===0)return[];let[r,...n]=e,a=r.endsWith("?"),i=r.replace(/\?$/,"");if(n.length===0)return a?[i,""]:[i];let o=n3(n.join("/")),c=[];return c.push(...o.map(u=>u===""?i:[i,u].join("/"))),a&&c.push(...o),c.map(u=>t.startsWith("/")&&u===""?"/":u)}function uV(t){t.sort((e,r)=>e.score!==r.score?r.score-e.score:vV(e.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}var dV=/^:[\w-]+$/,fV=3,pV=2,hV=1,mV=10,gV=-2,FD=t=>t==="*";function yV(t,e){let r=t.split("/"),n=r.length;return r.some(FD)&&(n+=gV),e&&(n+=pV),r.filter(a=>!FD(a)).reduce((a,i)=>a+(dV.test(i)?fV:i===""?hV:mV),n)}function vV(t,e){return t.length===e.length&&t.slice(0,-1).every((n,a)=>n===e[a])?t[t.length-1]-e[e.length-1]:0}function _V(t,e,r=!1){let{routesMeta:n}=t,a={},i="/",o=[];for(let c=0;c<n.length;++c){let u=n[c],d=c===n.length-1,f=i==="/"?e:e.slice(i.length)||"/",h=x_({path:u.relativePath,caseSensitive:u.caseSensitive,end:d},f),m=u.route;if(!h&&d&&r&&!n[n.length-1].route.index&&(h=x_({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},f)),!h)return null;Object.assign(a,h.params),o.push({params:a,pathname:Oc([i,h.pathname]),pathnameBase:TV(Oc([i,h.pathnameBase])),route:m}),h.pathnameBase!=="/"&&(i=Oc([i,h.pathnameBase]))}return o}function x_(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[r,n]=bV(t.path,t.caseSensitive,t.end),a=e.match(r);if(!a)return null;let i=a[0],o=i.replace(/(.)\/+$/,"$1"),c=a.slice(1);return{params:n.reduce((d,{paramName:f,isOptional:h},m)=>{if(f==="*"){let w=c[m]||"";o=i.slice(0,i.length-w.length).replace(/(.)\/+$/,"$1")}const _=c[m];return h&&!_?d[f]=void 0:d[f]=(_||"").replace(/%2F/g,"/"),d},{}),pathname:i,pathnameBase:o,pattern:t}}function bV(t,e=!1,r=!0){Xs(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let n=[],a="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,c,u)=>(n.push({paramName:c,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(n.push({paramName:"*"}),a+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?a+="\\/*$":t!==""&&t!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,e?void 0:"i"),n]}function kV(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Xs(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${e}).`),t}}function Uc(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let r=e.endsWith("/")?e.length-1:e.length,n=t.charAt(r);return n&&n!=="/"?null:t.slice(r)||"/"}function wV(t,e="/"){let{pathname:r,search:n="",hash:a=""}=typeof t=="string"?_p(t):t;return{pathname:r?r.startsWith("/")?r:SV(r,e):e,search:CV(n),hash:xV(a)}}function SV(t,e){let r=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(a=>{a===".."?r.length>1&&r.pop():a!=="."&&r.push(a)}),r.length>1?r.join("/"):"/"}function Rw(t,e,r,n){return`Cannot include a '${t}' character in a manually specified \`to.${e}\` field [${JSON.stringify(n)}].  Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function EV(t){return t.filter((e,r)=>r===0||e.route.path&&e.route.path.length>0)}function cx(t){let e=EV(t);return e.map((r,n)=>n===e.length-1?r.pathname:r.pathnameBase)}function lx(t,e,r,n=!1){let a;typeof t=="string"?a=_p(t):(a={...t},Sn(!a.pathname||!a.pathname.includes("?"),Rw("?","pathname","search",a)),Sn(!a.pathname||!a.pathname.includes("#"),Rw("#","pathname","hash",a)),Sn(!a.search||!a.search.includes("#"),Rw("#","search","hash",a)));let i=t===""||a.pathname==="",o=i?"/":a.pathname,c;if(o==null)c=r;else{let h=e.length-1;if(!n&&o.startsWith("..")){let m=o.split("/");for(;m[0]==="..";)m.shift(),h-=1;a.pathname=m.join("/")}c=h>=0?e[h]:"/"}let u=wV(a,c),d=o&&o!=="/"&&o.endsWith("/"),f=(i||o===".")&&r.endsWith("/");return!u.pathname.endsWith("/")&&(d||f)&&(u.pathname+="/"),u}var Oc=t=>t.join("/").replace(/\/\/+/g,"/"),TV=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),CV=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,xV=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function PV(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}var a3=["POST","PUT","PATCH","DELETE"];new Set(a3);var AV=["GET",...a3];new Set(AV);var bp=v.createContext(null);bp.displayName="DataRouter";var xb=v.createContext(null);xb.displayName="DataRouterState";v.createContext(!1);var i3=v.createContext({isTransitioning:!1});i3.displayName="ViewTransition";var RV=v.createContext(new Map);RV.displayName="Fetchers";var DV=v.createContext(null);DV.displayName="Await";var to=v.createContext(null);to.displayName="Navigation";var Eg=v.createContext(null);Eg.displayName="Location";var bs=v.createContext({outlet:null,matches:[],isDataRoute:!1});bs.displayName="Route";var ux=v.createContext(null);ux.displayName="RouteError";function OV(t,{relative:e}={}){Sn(kp(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:n}=v.useContext(to),{hash:a,pathname:i,search:o}=Tg(t,{relative:e}),c=i;return r!=="/"&&(c=i==="/"?r:Oc([r,i])),n.createHref({pathname:c,search:o,hash:a})}function kp(){return v.useContext(Eg)!=null}function yi(){return Sn(kp(),"useLocation() may be used only in the context of a <Router> component."),v.useContext(Eg).location}var s3="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function o3(t){v.useContext(to).static||v.useLayoutEffect(t)}function tn(){let{isDataRoute:t}=v.useContext(bs);return t?WV():NV()}function NV(){Sn(kp(),"useNavigate() may be used only in the context of a <Router> component.");let t=v.useContext(bp),{basename:e,navigator:r}=v.useContext(to),{matches:n}=v.useContext(bs),{pathname:a}=yi(),i=JSON.stringify(cx(n)),o=v.useRef(!1);return o3(()=>{o.current=!0}),v.useCallback((u,d={})=>{if(Xs(o.current,s3),!o.current)return;if(typeof u=="number"){r.go(u);return}let f=lx(u,JSON.parse(i),a,d.relative==="path");t==null&&e!=="/"&&(f.pathname=f.pathname==="/"?e:Oc([e,f.pathname])),(d.replace?r.replace:r.push)(f,d.state,d)},[e,r,i,a,t])}var IV=v.createContext(null);function MV(t){let e=v.useContext(bs).outlet;return v.useMemo(()=>e&&v.createElement(IV.Provider,{value:t},e),[e,t])}function c3(){let{matches:t}=v.useContext(bs),e=t[t.length-1];return e?e.params:{}}function Tg(t,{relative:e}={}){let{matches:r}=v.useContext(bs),{pathname:n}=yi(),a=JSON.stringify(cx(r));return v.useMemo(()=>lx(t,JSON.parse(a),n,e==="path"),[t,a,n,e])}function jV(t,e){return l3(t,e)}function l3(t,e,r,n,a){Sn(kp(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:i}=v.useContext(to),{matches:o}=v.useContext(bs),c=o[o.length-1],u=c?c.params:{},d=c?c.pathname:"/",f=c?c.pathnameBase:"/",h=c&&c.route;{let D=h&&h.path||"";u3(d,!h||D.endsWith("*")||D.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${d}" (under <Route path="${D}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.

Please change the parent <Route path="${D}"> to <Route path="${D==="/"?"*":`${D}/*`}">.`)}let m=yi(),_;if(e){let D=typeof e=="string"?_p(e):e;Sn(f==="/"||D.pathname?.startsWith(f),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${f}" but pathname "${D.pathname}" was given in the \`location\` prop.`),_=D}else _=m;let w=_.pathname||"/",b=w;if(f!=="/"){let D=f.replace(/^\//,"").split("/");b="/"+w.replace(/^\//,"").split("/").slice(D.length).join("/")}let E=t3(t,{pathname:b});Xs(h||E!=null,`No routes matched location "${_.pathname}${_.search}${_.hash}" `),Xs(E==null||E[E.length-1].route.element!==void 0||E[E.length-1].route.Component!==void 0||E[E.length-1].route.lazy!==void 0,`Matched leaf route at location "${_.pathname}${_.search}${_.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let T=qV(E&&E.map(D=>Object.assign({},D,{params:Object.assign({},u,D.params),pathname:Oc([f,i.encodeLocation?i.encodeLocation(D.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:D.pathname]),pathnameBase:D.pathnameBase==="/"?f:Oc([f,i.encodeLocation?i.encodeLocation(D.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:D.pathnameBase])})),o,r,n,a);return e&&T?v.createElement(Eg.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",..._},navigationType:"POP"}},T):T}function LV(){let t=GV(),e=PV(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,n="rgba(200,200,200, 0.5)",a={padding:"0.5rem",backgroundColor:n},i={padding:"2px 4px",backgroundColor:n},o=null;return o=v.createElement(v.Fragment,null,v.createElement("p",null,"💿 Hey developer 👋"),v.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",v.createElement("code",{style:i},"ErrorBoundary")," or"," ",v.createElement("code",{style:i},"errorElement")," prop on your route.")),v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},e),r?v.createElement("pre",{style:a},r):null,o)}var BV=v.createElement(LV,null),UV=class extends v.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,e){return e.location!==t.location||e.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:e.error,location:e.location,revalidation:t.revalidation||e.revalidation}}componentDidCatch(t,e){this.props.unstable_onError&&this.props.unstable_onError(t,e)}render(){return this.state.error!==void 0?v.createElement(bs.Provider,{value:this.props.routeContext},v.createElement(ux.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function FV({routeContext:t,match:e,children:r}){let n=v.useContext(bp);return n&&n.static&&n.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(n.staticContext._deepestRenderedBoundaryId=e.route.id),v.createElement(bs.Provider,{value:t},r)}function qV(t,e=[],r=null,n=null,a=null){if(t==null){if(!r)return null;if(r.errors)t=r.matches;else if(e.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let i=t,o=r?.errors;if(o!=null){let d=i.findIndex(f=>f.route.id&&o?.[f.route.id]!==void 0);Sn(d>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),i=i.slice(0,Math.min(i.length,d+1))}let c=!1,u=-1;if(r)for(let d=0;d<i.length;d++){let f=i[d];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(u=d),f.route.id){let{loaderData:h,errors:m}=r,_=f.route.loader&&!h.hasOwnProperty(f.route.id)&&(!m||m[f.route.id]===void 0);if(f.route.lazy||_){c=!0,u>=0?i=i.slice(0,u+1):i=[i[0]];break}}}return i.reduceRight((d,f,h)=>{let m,_=!1,w=null,b=null;r&&(m=o&&f.route.id?o[f.route.id]:void 0,w=f.route.errorElement||BV,c&&(u<0&&h===0?(u3("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),_=!0,b=null):u===h&&(_=!0,b=f.route.hydrateFallbackElement||null)));let E=e.concat(i.slice(0,h+1)),T=()=>{let D;return m?D=w:_?D=b:f.route.Component?D=v.createElement(f.route.Component,null):f.route.element?D=f.route.element:D=d,v.createElement(FV,{match:f,routeContext:{outlet:d,matches:E,isDataRoute:r!=null},children:D})};return r&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?v.createElement(UV,{location:r.location,revalidation:r.revalidation,component:w,error:m,children:T(),routeContext:{outlet:null,matches:E,isDataRoute:!0},unstable_onError:n}):T()},null)}function dx(t){return`${t} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function zV(t){let e=v.useContext(bp);return Sn(e,dx(t)),e}function $V(t){let e=v.useContext(xb);return Sn(e,dx(t)),e}function VV(t){let e=v.useContext(bs);return Sn(e,dx(t)),e}function fx(t){let e=VV(t),r=e.matches[e.matches.length-1];return Sn(r.route.id,`${t} can only be used on routes that contain a unique "id"`),r.route.id}function HV(){return fx("useRouteId")}function GV(){let t=v.useContext(ux),e=$V("useRouteError"),r=fx("useRouteError");return t!==void 0?t:e.errors?.[r]}function WV(){let{router:t}=zV("useNavigate"),e=fx("useNavigate"),r=v.useRef(!1);return o3(()=>{r.current=!0}),v.useCallback(async(a,i={})=>{Xs(r.current,s3),r.current&&(typeof a=="number"?t.navigate(a):await t.navigate(a,{fromRouteId:e,...i}))},[t,e])}var qD={};function u3(t,e,r){!e&&!qD[t]&&(qD[t]=!0,Xs(!1,r))}v.memo(KV);function KV({routes:t,future:e,state:r,unstable_onError:n}){return l3(t,void 0,r,n,e)}function tm({to:t,replace:e,state:r,relative:n}){Sn(kp(),"<Navigate> may be used only in the context of a <Router> component.");let{static:a}=v.useContext(to);Xs(!a,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:i}=v.useContext(bs),{pathname:o}=yi(),c=tn(),u=lx(t,cx(i),o,n==="path"),d=JSON.stringify(u);return v.useEffect(()=>{c(JSON.parse(d),{replace:e,state:r,relative:n})},[c,d,n,e,r]),null}function d3(t){return MV(t.context)}function yn(t){Sn(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function YV({basename:t="/",children:e=null,location:r,navigationType:n="POP",navigator:a,static:i=!1}){Sn(!kp(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let o=t.replace(/^\/*/,"/"),c=v.useMemo(()=>({basename:o,navigator:a,static:i,future:{}}),[o,a,i]);typeof r=="string"&&(r=_p(r));let{pathname:u="/",search:d="",hash:f="",state:h=null,key:m="default"}=r,_=v.useMemo(()=>{let w=Uc(u,o);return w==null?null:{location:{pathname:w,search:d,hash:f,state:h,key:m},navigationType:n}},[o,u,d,f,h,m,n]);return Xs(_!=null,`<Router basename="${o}"> is not able to match the URL "${u}${d}${f}" because it does not start with the basename, so the <Router> won't render anything.`),_==null?null:v.createElement(to.Provider,{value:c},v.createElement(Eg.Provider,{children:e,value:_}))}function XV({children:t,location:e}){return jV(oT(t),e)}function oT(t,e=[]){let r=[];return v.Children.forEach(t,(n,a)=>{if(!v.isValidElement(n))return;let i=[...e,a];if(n.type===v.Fragment){r.push.apply(r,oT(n.props.children,i));return}Sn(n.type===yn,`[${typeof n.type=="string"?n.type:n.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Sn(!n.props.index||!n.props.children,"An index route cannot have child routes.");let o={id:n.props.id||i.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,middleware:n.props.middleware,loader:n.props.loader,action:n.props.action,hydrateFallbackElement:n.props.hydrateFallbackElement,HydrateFallback:n.props.HydrateFallback,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.hasErrorBoundary===!0||n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(o.children=oT(n.props.children,i)),r.push(o)}),r}var jv="get",Lv="application/x-www-form-urlencoded";function Pb(t){return t!=null&&typeof t.tagName=="string"}function JV(t){return Pb(t)&&t.tagName.toLowerCase()==="button"}function QV(t){return Pb(t)&&t.tagName.toLowerCase()==="form"}function ZV(t){return Pb(t)&&t.tagName.toLowerCase()==="input"}function e7(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function t7(t,e){return t.button===0&&(!e||e==="_self")&&!e7(t)}var tv=null;function r7(){if(tv===null)try{new FormData(document.createElement("form"),0),tv=!1}catch{tv=!0}return tv}var n7=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Dw(t){return t!=null&&!n7.has(t)?(Xs(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Lv}"`),null):t}function a7(t,e){let r,n,a,i,o;if(QV(t)){let c=t.getAttribute("action");n=c?Uc(c,e):null,r=t.getAttribute("method")||jv,a=Dw(t.getAttribute("enctype"))||Lv,i=new FormData(t)}else if(JV(t)||ZV(t)&&(t.type==="submit"||t.type==="image")){let c=t.form;if(c==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let u=t.getAttribute("formaction")||c.getAttribute("action");if(n=u?Uc(u,e):null,r=t.getAttribute("formmethod")||c.getAttribute("method")||jv,a=Dw(t.getAttribute("formenctype"))||Dw(c.getAttribute("enctype"))||Lv,i=new FormData(c,t),!r7()){let{name:d,type:f,value:h}=t;if(f==="image"){let m=d?`${d}.`:"";i.append(`${m}x`,"0"),i.append(`${m}y`,"0")}else d&&i.append(d,h)}}else{if(Pb(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=jv,n=null,a=Lv,o=t}return i&&a==="text/plain"&&(o=i,i=void 0),{action:n,method:r.toLowerCase(),encType:a,formData:i,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function px(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function i7(t,e,r){let n=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return n.pathname==="/"?n.pathname=`_root.${r}`:e&&Uc(n.pathname,e)==="/"?n.pathname=`${e.replace(/\/$/,"")}/_root.${r}`:n.pathname=`${n.pathname.replace(/\/$/,"")}.${r}`,n}async function s7(t,e){if(t.id in e)return e[t.id];try{let r=await import(t.module);return e[t.id]=r,r}catch{return window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function o7(t){return t==null?!1:t.href==null?t.rel==="preload"&&typeof t.imageSrcSet=="string"&&typeof t.imageSizes=="string":typeof t.rel=="string"&&typeof t.href=="string"}async function c7(t,e,r){let n=await Promise.all(t.map(async a=>{let i=e.routes[a.route.id];if(i){let o=await s7(i,r);return o.links?o.links():[]}return[]}));return f7(n.flat(1).filter(o7).filter(a=>a.rel==="stylesheet"||a.rel==="preload").map(a=>a.rel==="stylesheet"?{...a,rel:"prefetch",as:"style"}:{...a,rel:"prefetch"}))}function zD(t,e,r,n,a,i){let o=(u,d)=>r[d]?u.route.id!==r[d].route.id:!0,c=(u,d)=>r[d].pathname!==u.pathname||r[d].route.path?.endsWith("*")&&r[d].params["*"]!==u.params["*"];return i==="assets"?e.filter((u,d)=>o(u,d)||c(u,d)):i==="data"?e.filter((u,d)=>{let f=n.routes[u.route.id];if(!f||!f.hasLoader)return!1;if(o(u,d)||c(u,d))return!0;if(u.route.shouldRevalidate){let h=u.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:r[0]?.params||{},nextUrl:new URL(t,window.origin),nextParams:u.params,defaultShouldRevalidate:!0});if(typeof h=="boolean")return h}return!0}):[]}function l7(t,e,{includeHydrateFallback:r}={}){return u7(t.map(n=>{let a=e.routes[n.route.id];if(!a)return[];let i=[a.module];return a.clientActionModule&&(i=i.concat(a.clientActionModule)),a.clientLoaderModule&&(i=i.concat(a.clientLoaderModule)),r&&a.hydrateFallbackModule&&(i=i.concat(a.hydrateFallbackModule)),a.imports&&(i=i.concat(a.imports)),i}).flat(1))}function u7(t){return[...new Set(t)]}function d7(t){let e={},r=Object.keys(t).sort();for(let n of r)e[n]=t[n];return e}function f7(t,e){let r=new Set;return new Set(e),t.reduce((n,a)=>{let i=JSON.stringify(d7(a));return r.has(i)||(r.add(i),n.push({key:i,link:a})),n},[])}function f3(){let t=v.useContext(bp);return px(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function p7(){let t=v.useContext(xb);return px(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var hx=v.createContext(void 0);hx.displayName="FrameworkContext";function p3(){let t=v.useContext(hx);return px(t,"You must render this element inside a <HydratedRouter> element"),t}function h7(t,e){let r=v.useContext(hx),[n,a]=v.useState(!1),[i,o]=v.useState(!1),{onFocus:c,onBlur:u,onMouseEnter:d,onMouseLeave:f,onTouchStart:h}=e,m=v.useRef(null);v.useEffect(()=>{if(t==="render"&&o(!0),t==="viewport"){let b=T=>{T.forEach(D=>{o(D.isIntersecting)})},E=new IntersectionObserver(b,{threshold:.5});return m.current&&E.observe(m.current),()=>{E.disconnect()}}},[t]),v.useEffect(()=>{if(n){let b=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(b)}}},[n]);let _=()=>{a(!0)},w=()=>{a(!1),o(!1)};return r?t!=="intent"?[i,m,{}]:[i,m,{onFocus:Eh(c,_),onBlur:Eh(u,w),onMouseEnter:Eh(d,_),onMouseLeave:Eh(f,w),onTouchStart:Eh(h,_)}]:[!1,m,{}]}function Eh(t,e){return r=>{t&&t(r),r.defaultPrevented||e(r)}}function m7({page:t,...e}){let{router:r}=f3(),n=v.useMemo(()=>t3(r.routes,t,r.basename),[r.routes,t,r.basename]);return n?v.createElement(y7,{page:t,matches:n,...e}):null}function g7(t){let{manifest:e,routeModules:r}=p3(),[n,a]=v.useState([]);return v.useEffect(()=>{let i=!1;return c7(t,e,r).then(o=>{i||a(o)}),()=>{i=!0}},[t,e,r]),n}function y7({page:t,matches:e,...r}){let n=yi(),{manifest:a,routeModules:i}=p3(),{basename:o}=f3(),{loaderData:c,matches:u}=p7(),d=v.useMemo(()=>zD(t,e,u,a,n,"data"),[t,e,u,a,n]),f=v.useMemo(()=>zD(t,e,u,a,n,"assets"),[t,e,u,a,n]),h=v.useMemo(()=>{if(t===n.pathname+n.search+n.hash)return[];let w=new Set,b=!1;if(e.forEach(T=>{let D=a.routes[T.route.id];!D||!D.hasLoader||(!d.some(P=>P.route.id===T.route.id)&&T.route.id in c&&i[T.route.id]?.shouldRevalidate||D.hasClientLoader?b=!0:w.add(T.route.id))}),w.size===0)return[];let E=i7(t,o,"data");return b&&w.size>0&&E.searchParams.set("_routes",e.filter(T=>w.has(T.route.id)).map(T=>T.route.id).join(",")),[E.pathname+E.search]},[o,c,n,a,d,e,t,i]),m=v.useMemo(()=>l7(f,a),[f,a]),_=g7(f);return v.createElement(v.Fragment,null,h.map(w=>v.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...r})),m.map(w=>v.createElement("link",{key:w,rel:"modulepreload",href:w,...r})),_.map(({key:w,link:b})=>v.createElement("link",{key:w,nonce:r.nonce,...b})))}function v7(...t){return e=>{t.forEach(r=>{typeof r=="function"?r(e):r!=null&&(r.current=e)})}}var h3=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{h3&&(window.__reactRouterVersion="7.9.2")}catch{}function _7({basename:t,children:e,window:r}){let n=v.useRef();n.current==null&&(n.current=iV({window:r,v5Compat:!0}));let a=n.current,[i,o]=v.useState({action:a.action,location:a.location}),c=v.useCallback(u=>{v.startTransition(()=>o(u))},[o]);return v.useLayoutEffect(()=>a.listen(c),[a,c]),v.createElement(YV,{basename:t,children:e,location:i.location,navigationType:i.action,navigator:a})}var m3=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,g3=v.forwardRef(function({onClick:e,discover:r="render",prefetch:n="none",relative:a,reloadDocument:i,replace:o,state:c,target:u,to:d,preventScrollReset:f,viewTransition:h,...m},_){let{basename:w}=v.useContext(to),b=typeof d=="string"&&m3.test(d),E,T=!1;if(typeof d=="string"&&b&&(E=d,h3))try{let R=new URL(window.location.href),N=d.startsWith("//")?new URL(R.protocol+d):new URL(d),L=Uc(N.pathname,w);N.origin===R.origin&&L!=null?d=L+N.search+N.hash:T=!0}catch{Xs(!1,`<Link to="${d}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let D=OV(d,{relative:a}),[P,A,C]=h7(n,m),O=S7(d,{replace:o,state:c,target:u,preventScrollReset:f,relative:a,viewTransition:h});function I(R){e&&e(R),R.defaultPrevented||O(R)}let x=v.createElement("a",{...m,...C,href:E||D,onClick:T||i?e:I,ref:v7(_,A),target:u,"data-discover":!b&&r==="render"?"true":void 0});return P&&!b?v.createElement(v.Fragment,null,x,v.createElement(m7,{page:D})):x});g3.displayName="Link";var b7=v.forwardRef(function({"aria-current":e="page",caseSensitive:r=!1,className:n="",end:a=!1,style:i,to:o,viewTransition:c,children:u,...d},f){let h=Tg(o,{relative:d.relative}),m=yi(),_=v.useContext(xb),{navigator:w,basename:b}=v.useContext(to),E=_!=null&&P7(h)&&c===!0,T=w.encodeLocation?w.encodeLocation(h).pathname:h.pathname,D=m.pathname,P=_&&_.navigation&&_.navigation.location?_.navigation.location.pathname:null;r||(D=D.toLowerCase(),P=P?P.toLowerCase():null,T=T.toLowerCase()),P&&b&&(P=Uc(P,b)||P);const A=T!=="/"&&T.endsWith("/")?T.length-1:T.length;let C=D===T||!a&&D.startsWith(T)&&D.charAt(A)==="/",O=P!=null&&(P===T||!a&&P.startsWith(T)&&P.charAt(T.length)==="/"),I={isActive:C,isPending:O,isTransitioning:E},x=C?e:void 0,R;typeof n=="function"?R=n(I):R=[n,C?"active":null,O?"pending":null,E?"transitioning":null].filter(Boolean).join(" ");let N=typeof i=="function"?i(I):i;return v.createElement(g3,{...d,"aria-current":x,className:R,ref:f,style:N,to:o,viewTransition:c},typeof u=="function"?u(I):u)});b7.displayName="NavLink";var k7=v.forwardRef(({discover:t="render",fetcherKey:e,navigate:r,reloadDocument:n,replace:a,state:i,method:o=jv,action:c,onSubmit:u,relative:d,preventScrollReset:f,viewTransition:h,...m},_)=>{let w=C7(),b=x7(c,{relative:d}),E=o.toLowerCase()==="get"?"get":"post",T=typeof c=="string"&&m3.test(c),D=P=>{if(u&&u(P),P.defaultPrevented)return;P.preventDefault();let A=P.nativeEvent.submitter,C=A?.getAttribute("formmethod")||o;w(A||P.currentTarget,{fetcherKey:e,method:C,navigate:r,replace:a,state:i,relative:d,preventScrollReset:f,viewTransition:h})};return v.createElement("form",{ref:_,method:E,action:b,onSubmit:n?u:D,...m,"data-discover":!T&&t==="render"?"true":void 0})});k7.displayName="Form";function w7(t){return`${t} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function y3(t){let e=v.useContext(bp);return Sn(e,w7(t)),e}function S7(t,{target:e,replace:r,state:n,preventScrollReset:a,relative:i,viewTransition:o}={}){let c=tn(),u=yi(),d=Tg(t,{relative:i});return v.useCallback(f=>{if(t7(f,e)){f.preventDefault();let h=r!==void 0?r:Cm(u)===Cm(d);c(t,{replace:h,state:n,preventScrollReset:a,relative:i,viewTransition:o})}},[u,c,d,r,n,e,t,a,i,o])}var E7=0,T7=()=>`__${String(++E7)}__`;function C7(){let{router:t}=y3("useSubmit"),{basename:e}=v.useContext(to),r=HV();return v.useCallback(async(n,a={})=>{let{action:i,method:o,encType:c,formData:u,body:d}=a7(n,e);if(a.navigate===!1){let f=a.fetcherKey||T7();await t.fetch(f,r,a.action||i,{preventScrollReset:a.preventScrollReset,formData:u,body:d,formMethod:a.method||o,formEncType:a.encType||c,flushSync:a.flushSync})}else await t.navigate(a.action||i,{preventScrollReset:a.preventScrollReset,formData:u,body:d,formMethod:a.method||o,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:r,flushSync:a.flushSync,viewTransition:a.viewTransition})},[t,e,r])}function x7(t,{relative:e}={}){let{basename:r}=v.useContext(to),n=v.useContext(bs);Sn(n,"useFormAction must be used inside a RouteContext");let[a]=n.matches.slice(-1),i={...Tg(t||".",{relative:e})},o=yi();if(t==null){i.search=o.search;let c=new URLSearchParams(i.search),u=c.getAll("index");if(u.some(f=>f==="")){c.delete("index"),u.filter(h=>h).forEach(h=>c.append("index",h));let f=c.toString();i.search=f?`?${f}`:""}}return(!t||t===".")&&a.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(i.pathname=i.pathname==="/"?r:Oc([r,i.pathname])),Cm(i)}function P7(t,{relative:e}={}){let r=v.useContext(i3);Sn(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`.  Did you accidentally import `RouterProvider` from `react-router`?");let{basename:n}=y3("useViewTransitionState"),a=Tg(t,{relative:e});if(!r.isTransitioning)return!1;let i=Uc(r.currentLocation.pathname,n)||r.currentLocation.pathname,o=Uc(r.nextLocation.pathname,n)||r.nextLocation.pathname;return x_(a.pathname,o)!=null||x_(a.pathname,i)!=null}var Wc=e3();/*! Capacitor: https://capacitorjs.com/ - MIT License */var Yf;(function(t){t.Unimplemented="UNIMPLEMENTED",t.Unavailable="UNAVAILABLE"})(Yf||(Yf={}));class Ow extends Error{constructor(e,r,n){super(e),this.message=e,this.code=r,this.data=n}}const A7=t=>{var e,r;return t?.androidBridge?"android":!((r=(e=t?.webkit)===null||e===void 0?void 0:e.messageHandlers)===null||r===void 0)&&r.bridge?"ios":"web"},R7=t=>{const e=t.CapacitorCustomPlatform||null,r=t.Capacitor||{},n=r.Plugins=r.Plugins||{},a=()=>e!==null?e.name:A7(t),i=()=>a()!=="web",o=h=>{const m=d.get(h);return!!(m?.platforms.has(a())||c(h))},c=h=>{var m;return(m=r.PluginHeaders)===null||m===void 0?void 0:m.find(_=>_.name===h)},u=h=>t.console.error(h),d=new Map,f=(h,m={})=>{const _=d.get(h);if(_)return _.proxy;const w=a(),b=c(h);let E;const T=async()=>(!E&&w in m?E=typeof m[w]=="function"?E=await m[w]():E=m[w]:e!==null&&!E&&"web"in m&&(E=typeof m.web=="function"?E=await m.web():E=m.web),E),D=(x,R)=>{var N,L;if(b){const j=b?.methods.find(q=>R===q.name);if(j)return j.rtype==="promise"?q=>r.nativePromise(h,R.toString(),q):(q,U)=>r.nativeCallback(h,R.toString(),q,U);if(x)return(N=x[R])===null||N===void 0?void 0:N.bind(x)}else{if(x)return(L=x[R])===null||L===void 0?void 0:L.bind(x);throw new Ow(`"${h}" plugin is not implemented on ${w}`,Yf.Unimplemented)}},P=x=>{let R;const N=(...L)=>{const j=T().then(q=>{const U=D(q,x);if(U){const W=U(...L);return R=W?.remove,W}else throw new Ow(`"${h}.${x}()" is not implemented on ${w}`,Yf.Unimplemented)});return x==="addListener"&&(j.remove=async()=>R()),j};return N.toString=()=>`${x.toString()}() { [capacitor code] }`,Object.defineProperty(N,"name",{value:x,writable:!1,configurable:!1}),N},A=P("addListener"),C=P("removeListener"),O=(x,R)=>{const N=A({eventName:x},R),L=async()=>{const q=await N;C({eventName:x,callbackId:q},R)},j=new Promise(q=>N.then(()=>q({remove:L})));return j.remove=async()=>{await L()},j},I=new Proxy({},{get(x,R){switch(R){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return b?O:A;case"removeListener":return C;default:return P(R)}}});return n[h]=I,d.set(h,{name:h,proxy:I,platforms:new Set([...Object.keys(m),...b?[w]:[]])}),I};return r.convertFileSrc||(r.convertFileSrc=h=>h),r.getPlatform=a,r.handleError=u,r.isNativePlatform=i,r.isPluginAvailable=o,r.registerPlugin=f,r.Exception=Ow,r.DEBUG=!!r.DEBUG,r.isLoggingEnabled=!!r.isLoggingEnabled,r},D7=t=>t.Capacitor=R7(t),Gr=D7(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),ro=Gr.registerPlugin;class v3{constructor(){this.listeners={},this.retainedEventArguments={},this.windowListeners={}}addListener(e,r){let n=!1;this.listeners[e]||(this.listeners[e]=[],n=!0),this.listeners[e].push(r);const i=this.windowListeners[e];i&&!i.registered&&this.addWindowListener(i),n&&this.sendRetainedArgumentsForEvent(e);const o=async()=>this.removeListener(e,r);return Promise.resolve({remove:o})}async removeAllListeners(){this.listeners={};for(const e in this.windowListeners)this.removeWindowListener(this.windowListeners[e]);this.windowListeners={}}notifyListeners(e,r,n){const a=this.listeners[e];if(!a){if(n){let i=this.retainedEventArguments[e];i||(i=[]),i.push(r),this.retainedEventArguments[e]=i}return}a.forEach(i=>i(r))}hasListeners(e){var r;return!!(!((r=this.listeners[e])===null||r===void 0)&&r.length)}registerWindowListener(e,r){this.windowListeners[r]={registered:!1,windowEventName:e,pluginEventName:r,handler:n=>{this.notifyListeners(r,n)}}}unimplemented(e="not implemented"){return new Gr.Exception(e,Yf.Unimplemented)}unavailable(e="not available"){return new Gr.Exception(e,Yf.Unavailable)}async removeListener(e,r){const n=this.listeners[e];if(!n)return;const a=n.indexOf(r);this.listeners[e].splice(a,1),this.listeners[e].length||this.removeWindowListener(this.windowListeners[e])}addWindowListener(e){window.addEventListener(e.windowEventName,e.handler),e.registered=!0}removeWindowListener(e){e&&(window.removeEventListener(e.windowEventName,e.handler),e.registered=!1)}sendRetainedArgumentsForEvent(e){const r=this.retainedEventArguments[e];r&&(delete this.retainedEventArguments[e],r.forEach(n=>{this.notifyListeners(e,n)}))}}const $D=t=>encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),VD=t=>t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class O7 extends v3{async getCookies(){const e=document.cookie,r={};return e.split(";").forEach(n=>{if(n.length<=0)return;let[a,i]=n.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");a=VD(a).trim(),i=VD(i).trim(),r[a]=i}),r}async setCookie(e){try{const r=$D(e.key),n=$D(e.value),a=`; expires=${(e.expires||"").replace("expires=","")}`,i=(e.path||"/").replace("path=",""),o=e.url!=null&&e.url.length>0?`domain=${e.url}`:"";document.cookie=`${r}=${n||""}${a}; path=${i}; ${o};`}catch(r){return Promise.reject(r)}}async deleteCookie(e){try{document.cookie=`${e.key}=; Max-Age=0`}catch(r){return Promise.reject(r)}}async clearCookies(){try{const e=document.cookie.split(";")||[];for(const r of e)document.cookie=r.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(e){return Promise.reject(e)}}async clearAllCookies(){try{await this.clearCookies()}catch(e){return Promise.reject(e)}}}ro("CapacitorCookies",{web:()=>new O7});const N7=async t=>new Promise((e,r)=>{const n=new FileReader;n.onload=()=>{const a=n.result;e(a.indexOf(",")>=0?a.split(",")[1]:a)},n.onerror=a=>r(a),n.readAsDataURL(t)}),I7=(t={})=>{const e=Object.keys(t);return Object.keys(t).map(a=>a.toLocaleLowerCase()).reduce((a,i,o)=>(a[i]=t[e[o]],a),{})},M7=(t,e=!0)=>t?Object.entries(t).reduce((n,a)=>{const[i,o]=a;let c,u;return Array.isArray(o)?(u="",o.forEach(d=>{c=e?encodeURIComponent(d):d,u+=`${i}=${c}&`}),u.slice(0,-1)):(c=e?encodeURIComponent(o):o,u=`${i}=${c}`),`${n}&${u}`},"").substr(1):null,j7=(t,e={})=>{const r=Object.assign({method:t.method||"GET",headers:t.headers},e),a=I7(t.headers)["content-type"]||"";if(typeof t.data=="string")r.body=t.data;else if(a.includes("application/x-www-form-urlencoded")){const i=new URLSearchParams;for(const[o,c]of Object.entries(t.data||{}))i.set(o,c);r.body=i.toString()}else if(a.includes("multipart/form-data")||t.data instanceof FormData){const i=new FormData;if(t.data instanceof FormData)t.data.forEach((c,u)=>{i.append(u,c)});else for(const c of Object.keys(t.data))i.append(c,t.data[c]);r.body=i;const o=new Headers(r.headers);o.delete("content-type"),r.headers=o}else(a.includes("application/json")||typeof t.data=="object")&&(r.body=JSON.stringify(t.data));return r};class L7 extends v3{async request(e){const r=j7(e,e.webFetchExtra),n=M7(e.params,e.shouldEncodeUrlParams),a=n?`${e.url}?${n}`:e.url,i=await fetch(a,r),o=i.headers.get("content-type")||"";let{responseType:c="text"}=i.ok?e:{};o.includes("application/json")&&(c="json");let u,d;switch(c){case"arraybuffer":case"blob":d=await i.blob(),u=await N7(d);break;case"json":u=await i.json();break;case"document":case"text":default:u=await i.text()}const f={};return i.headers.forEach((h,m)=>{f[m]=h}),{data:u,headers:f,status:i.status,url:i.url}}async get(e){return this.request(Object.assign(Object.assign({},e),{method:"GET"}))}async post(e){return this.request(Object.assign(Object.assign({},e),{method:"POST"}))}async put(e){return this.request(Object.assign(Object.assign({},e),{method:"PUT"}))}async patch(e){return this.request(Object.assign(Object.assign({},e),{method:"PATCH"}))}async delete(e){return this.request(Object.assign(Object.assign({},e),{method:"DELETE"}))}}ro("CapacitorHttp",{web:()=>new L7});const B7="modulepreload",U7=function(t,e){return new URL(t,e).href},HD={},qr=function(e,r,n){let a=Promise.resolve();if(r&&r.length>0){let d=function(f){return Promise.all(f.map(h=>Promise.resolve(h).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};const o=document.getElementsByTagName("link"),c=document.querySelector("meta[property=csp-nonce]"),u=c?.nonce||c?.getAttribute("nonce");a=d(r.map(f=>{if(f=U7(f,n),f in HD)return;HD[f]=!0;const h=f.endsWith(".css"),m=h?'[rel="stylesheet"]':"";if(n)for(let w=o.length-1;w>=0;w--){const b=o[w];if(b.href===f&&(!h||b.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${f}"]${m}`))return;const _=document.createElement("link");if(_.rel=h?"stylesheet":B7,h||(_.as="script"),_.crossOrigin="",_.href=f,u&&_.setAttribute("nonce",u),document.head.appendChild(_),h)return new Promise((w,b)=>{_.addEventListener("load",w),_.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${f}`)))})}))}function i(o){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=o,window.dispatchEvent(c),!c.defaultPrevented)throw o}return a.then(o=>{for(const c of o||[])c.status==="rejected"&&i(c.reason);return e().catch(i)})},xm=ro("SocialLogin",{web:()=>qr(()=>import("./web-CVU33SGk.js"),[],import.meta.url).then(t=>new t.SocialLoginWeb)});var F7={};const q7={SOCKET:{NEEDS_PREMIUM:"premium_membership_required"}},z7=(()=>{try{if(typeof window>"u")return!1;const t=(window.location?.protocol||"").toLowerCase();return t==="capacitor:"||t==="ionic:"}catch{return!1}})(),$7=(()=>{try{if(typeof window>"u")return!1;const t=window.location?.hostname||"";return t==="localhost"||t==="127.0.0.1"}catch{return!1}})();function V7(){try{const t=window.localStorage?.getItem("api:url")||window.sessionStorage?.getItem("api:url");if(t&&/^https?:\/\//i.test(t))return t.replace(/\/$/,"")}catch{}return null}const GD=(()=>{const t=V7();return t||(z7?"https://dicelounge.app":$7?"http://localhost:4000":"https://dicelounge.app")})(),H7=globalThis?.APP_TARGET,G7=typeof process<"u"?F7?.APP_TARGET:void 0;let cT;try{cT="poker"}catch{cT=void 0}const W7=H7??G7??cT,wp=W7??"unified",WD=wp==="ceelo",Vo=wp==="craps",Ho=wp==="poker",rf=wp==="unified",K7="rcb_eaWheJLZtWHJDCzyjruqCITeZlrK",KD={ceelo:"goog_TshzudibKBufFkwSWOodGwQAzMI",craps:"goog_FJlwnXjmdmVYKAbOkaiNyICWjkd",poker:"goog_AwODgwTGrKmYPFStHgslgZENzyG",unified:"goog_TshzudibKBufFkwSWOodGwQAzMI"},Y7=KD[wp]??KD.ceelo,YD={ceelo:"appl_YhZbXhNlphlrxochELLsdNJajdp",craps:"appl_uCBrYNXSOUzHdUNnkbfMaNxBxXI",poker:"appl_SKqhTdSJqfYQQGUjeFYzVZoSBqA",unified:"appl_YhZbXhNlphlrxochELLsdNJajdp"},X7=YD[wp]??YD.ceelo,J7="true",_3="default",Q7="com.zentaraone.ceeloLounge.chips",b3=Q7,Z7="com.zentaraone.ceeloLounge.chips1000",eH="com.zentaraone.crapsLounge.chips_1000",tH="com.zentaraone.pokerLounge.chips_1000",k3=Vo?eH:Ho?tH:Z7,rH="",w3="Premium",nH="AIzaSyCmll0lLOqadkCyjlrM-bb5H4n1L8eMxkE",aH="dice-lounge.firebaseapp.com",iH="dice-lounge",sH="1:423374558927:web:283377221554368e57c9ba",oH="G-MYPNJQR9RN",cH="dicelounge.app",lH="PEcc15f3HTqKKafnvHp1yRrbxrS8ji1kzZ4dyS4R+fI=",uH="193765381581-rucls0d90bmpkqaj0ginhp87chgjq70j.apps.googleusercontent.com",mx="193765381581-s0a3p66cb39cdfum20jrm0d2e87jmlu8.apps.googleusercontent.com",dH=mx,fH=mx,pH=Vo?dH:Ho?fH:mx,hH="com.zentaraone.ceeloLounge.service",mH="com.zentaraone.crapsLounge.service",gH="com.zentaraone.pokerLounge.service",yH=Vo?mH:Ho?gH:hH,vH="https://dicelounge.app/api/auth/apple/callback",_H="com.zentaraone.ceeloLounge",bH="com.zentaraone.crapsLounge",kH="com.zentaraone.pokerLounge",wH=Vo?bH:Ho?kH:_H,SH="ca-app-pub-4219446894372985/2712849620",EH="ca-app-pub-4219446894372985/4123145978",TH="ca-app-pub-4219446894372985/6524920361",CH="ca-app-pub-4219446894372985/9898216833",xH="ca-app-pub-4219446894372985/2585675356",PH="ca-app-pub-4219446894372985/5810604494",AH=Vo?EH:Ho?TH:SH,XD=Vo?xH:Ho?PH:CH,RH="ca-app-pub-4219446894372985/3451216225",DH="ca-app-pub-4219446894372985/9366706127",OH="ca-app-pub-4219446894372985/4109691778",NH="ca-app-pub-4219446894372985/2394103660",IH="ca-app-pub-4219446894372985/5020267007",MH="ca-app-pub-4219446894372985/8389694041",jH=Vo?DH:Ho?OH:RH,JD=Vo?IH:Ho?MH:NH,hf=100,QD=30,S3=3,E3=3,zh=6e4,$h=1500,gx=ro("SecureStoragePlugin",{web:()=>qr(()=>import("./web-EXvUNq25.js"),[],import.meta.url).then(t=>new t.SecureStoragePluginWeb)}),ms=ro("Preferences",{web:()=>qr(()=>import("./web-DoyUDcZY.js"),[],import.meta.url).then(t=>new t.PreferencesWeb)}),Nc=Object.freeze(Object.defineProperty({__proto__:null,Preferences:ms},Symbol.toStringTag,{value:"Module"})),rv="sess:";async function ZD(t){const{value:e}=await ms.get({key:t});return e??null}async function eO(t,e){await ms.set({key:t,value:e})}async function Nw(t){await ms.remove({key:t})}const Ks={async get(t){return ZD(t)},async set(t,e){await eO(t,e)},async remove(t){await Nw(t)},async setSession(t,e){await eO(rv+t,e)},async getSession(t){return ZD(rv+t)},async removeSession(t){return Nw(rv+t)},async clearSessionKeys(){try{const e=(await ms.keys()).keys?.filter(r=>r.startsWith(rv))||[];await Promise.all(e.map(r=>Nw(r)))}catch{}}};async function Xf(t){try{const e=await Ks.getSession(t);return e?JSON.parse(e):null}catch{return null}}async function Ab(t,e){try{await Ks.setSession(t,JSON.stringify(e))}catch{}}async function Jf(t){try{await Ks.removeSession(t)}catch{}}const Qf="session_token",yx=Gr.isNativePlatform();async function Zf(t){yx?await gx.set({key:Qf,value:t}):await Ks.setSession(Qf,t)}async function oi(){if(yx)try{const{value:e}=await gx.get({key:Qf});return e||void 0}catch{return}return await Ks.getSession(Qf)||void 0}async function Cg(){if(yx)try{await gx.remove({key:Qf})}catch{}else await Ks.removeSession(Qf)}const nf={done:!1};function tO(t){if(!t)return"";const e=String(t);return e.length<=12?e:`${e.slice(0,6)}…${e.slice(-6)}`}async function LH(){const t=Gr.getPlatform(),e={mode:"online"},r=uH,n=pH;e.clientId=r,e.webClientId=r,e.mode="online",e.iOSClientId=n;const a={mode:"online"},i=t==="ios"?wH:yH,o=vH;a.clientId=i,t!=="ios"&&o&&(a.redirectUrl=o),tO(r),tO(n),await xm.initialize({...Object.keys(e).length?{google:e}:{},...Object.keys(a).length?{apple:a}:{}})}async function ep(t=!1){if(!(!t&&nf.done)){if(!t&&nf.promise)return nf.promise;nf.promise=LH().then(()=>{nf.done=!0}).catch(e=>{throw nf.promise=void 0,e})}}async function T3(){try{await ep()}catch{}}function BH(){try{const t=Gr.getPlatform();if(t==="ios"||t==="android")return!0;const e=typeof window<"u"?window:{};return e.Capacitor?.isNativePlatform?!!e.Capacitor.isNativePlatform:!!e.webkit?.messageHandlers}catch{return!1}}async function UH(){await ep(!0);const e=Gr.getPlatform()==="android"?{}:{scopes:["email","name"]},r=await xm.login({provider:"apple",options:e}),n=r?.result?.idToken,a=r?.result?.profile,i=a?.email||void 0,o=a?.givenName||a?.name?.split(" ")?.[0],c=a?.familyName||a?.name?.split(" ")?.slice(1)?.join(" "),u=[o,c].filter(Boolean).join(" ").trim()||a?.name||void 0;if(!n)throw new Error("Apple did not return an id token");return{provider:"apple",idToken:n,email:i,name:u}}async function FH(){await ep(!0);try{const e=Gr.getPlatform()==="android"?{}:{scopes:["email","profile"]},r=await xm.login({provider:"google",options:e});r?.result,r&&typeof r=="object"&&Object.keys(r),r?.result&&Object.keys(r.result);const n=r?.result?.idToken,a=r?.result?.profile,i=a?.email||void 0,o=a?.name||[a?.givenName,a?.familyName].filter(Boolean).join(" ").trim()||void 0;if(!n)throw new Error("Google did not return an id token");return{provider:"google",idToken:n,email:i,name:o}}catch(t){const e=t;Object.prototype.toString.call(e),e?.message,e?.name,e?.code,e?.status;const r=String(e?.message||"").toLowerCase();if(r.includes("developer console")||r.includes("config")||r.includes("clientid")||e?.code===28444)try{await ep(!0);const n=Gr.getPlatform(),a=await xm.login({provider:"google",options:n==="android"?{}:{scopes:["email","profile"]}});a?.result;const i=a?.result?.idToken,o=a?.result?.profile,c=o?.email||void 0,u=o?.name||[o?.givenName,o?.familyName].filter(Boolean).join(" ").trim()||void 0;if(!i)throw new Error("Google did not return an id token (retry)");return{provider:"google",idToken:i,email:c,name:u}}catch{}throw e}}async function qH(t,e){try{await ep()}catch{}try{await xm.logout({provider:t})}catch{}try{await new Promise(r=>setTimeout(r,120)),await ep(!0)}catch{}if(e?.clearLocal!==!1)try{await Cg()}catch{}}const P_={isNativePlatform:BH,signInWithAppleNative:UH,signInWithGoogleNative:FH,signOut:qH,prewarmNativeAuth:T3};let vo;function zH(){try{const t=Gr?.getPlatform?.();if(t)return t==="android"}catch{}try{return typeof navigator<"u"&&/Android/i.test(navigator.userAgent)}catch{return!1}}function $H(){try{const t=Gr?.getPlatform?.();if(t)return t==="ios"}catch{}try{return typeof navigator<"u"&&/iPhone|iPad|iPod/i.test(navigator.userAgent)}catch{return!1}}function VH(){try{const t=Gr?.getPlatform?.();return t&&["ios","android"].includes(t)?!0:!!window.Capacitor?.isNativePlatform?.()}catch{return!1}}function HH(){try{const t=window.localStorage?.getItem("api:url")||window.sessionStorage?.getItem("api:url");if(t&&/^https?:\/\//i.test(t))return t.replace(/\/+$/,"")}catch{}return null}function ci(){if(vo)return vo;const t=zH(),e=$H(),r=VH();if(t||e&&r)return vo="https://dicelounge.app",vo;let n=null;if(!t&&!(e&&r)&&(n=HH()),n)return vo=n,vo;let a=!1;try{const i=window.location?.hostname;a=i==="localhost"||i==="127.0.0.1"}catch{}return a&&!(e&&r)?(vo="http://localhost:4000",vo):(vo="https://dicelounge.app",vo)}const Ll=ci();let Fu=null,mf=0,gf=null;const GH=1e4;async function Rb(t){const e=t?.force===!0,r=t?.signal;return!e&&Fu&&Date.now()-mf<GH?Fu:!e&&gf?gf:(gf=(async()=>{try{let i=!1;try{i=!!P_.isNativePlatform?.()}catch{i=!1}let o=null;try{o=await oi()??null}catch{o=null}if(!e&&!o)return null;const c=!!o,u={Accept:"application/json"};c&&o&&(u.Authorization=`Bearer ${o}`);const d=await fetch(`${Ll}/api/auth/me`,{credentials:"include",headers:u,signal:r});if(d.ok){const f=await d.json();return Fu=f,mf=Date.now(),f}if(d.status===204)return Fu=null,mf=Date.now(),null;if(d.status===401){if(!c&&o){const f=await fetch(`${Ll}/api/auth/me`,{credentials:"include",headers:{Accept:"application/json",Authorization:`Bearer ${o}`},signal:r});if(f.ok){const h=await f.json();return Fu=h,mf=Date.now(),h}if(f.status===401)try{await Cg()}catch{}}return Fu=null,mf=Date.now(),null}return null}catch(i){return i?.name==="AbortError",null}})().finally(()=>{gf=null}),await gf)}async function Bv(t){let e=null;try{e=await oi()??null}catch{e=null}try{await fetch(`${Ll}/api/auth/logout`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",Accept:"application/json",...e?{Authorization:`Bearer ${e}`}:{}},body:JSON.stringify({email:t})})}catch{}try{await Cg()}catch{}try{Fu=null,mf=0,gf=null}catch{}}async function WH(t){return(await fetch(`${Ll}/api/auth/verify-app?token=${encodeURIComponent(t)}`,{method:"GET",credentials:"include"})).json()}async function KH(t){try{if(P_.isNativePlatform())throw new Error("startOAuth is not allowed on native")}catch{}try{const e=await fetch(`${Ll}/api/auth/${t}`,{method:"POST",headers:{Accept:"application/json"},credentials:"include"});if(e.ok){const r=await e.json().catch(()=>({ok:!1}));if(r?.ok&&r?.url)return window.location.assign(r.url),{ok:!0,url:r.url}}return window.location.assign(`${Ll}/api/auth/${t}`),{ok:!1}}catch{try{window.location.assign(`${Ll}/api/auth/${t}`)}catch{}return{ok:!1}}}async function YH(){try{const t=await fetch(`${Ll}/api/auth/guest`,{method:"POST",headers:{Accept:"application/json"},credentials:"include"});if(!t.ok)return{ok:!1};const e=await t.json().catch(()=>({ok:!1}));return{ok:!!e?.ok,token:e?.token}}catch{return{ok:!1}}}var XH={};let Iw=!1,tp=null,af=null;function JH(){return{apiKey:nH,authDomain:aH,projectId:iH,appId:sH,measurementId:oH}}function rm(){return typeof window<"u"&&typeof document<"u"}function C3(){if(!rm())return!1;if(af!==null)return af;try{const t=new URL(window.location.href);if(t.searchParams.has("debug_analytics")||t.searchParams.has("firebase_analytics_debug_mode")||window.localStorage.getItem("analytics:debug")==="1")return af=!0}catch{}return af=!1}function nm(...t){C3()}async function QH(){if(Iw||!rm())return;try{if(typeof navigator<"u"&&/jsdom|playwright/i.test(navigator.userAgent||"")||typeof window<"u"&&window.__E2E===!0||typeof process<"u"&&(XH.VITEST||!1)){Iw=!0,nm("skip:init (test env heuristic)");return}}catch{}const t=JH();try{const[{initializeApp:e},{getAnalytics:r}]=await Promise.all([qr(()=>import("./index.esm-OyK67d2L.js"),__vite__mapDeps([0,1]),import.meta.url),qr(()=>import("./index.esm-CmzND2QD.js"),__vite__mapDeps([2,1]),import.meta.url)]),n=e({apiKey:t.apiKey,authDomain:t.authDomain,projectId:t.projectId,appId:t.appId,measurementId:t.measurementId});tp=r(n),nm("init:ok",{measurementId:t.measurementId})}catch(e){tp=null,nm("init:fail",{error:e?.message||String(e)})}finally{Iw=!0}}function rp(t,e){if(tp)try{qr(async()=>{const{logEvent:r}=await import("./index.esm-CmzND2QD.js");return{logEvent:r}},__vite__mapDeps([2,1]),import.meta.url).then(({logEvent:r})=>{const n=e||{};C3()&&(n.debug_mode=!0);try{r(tp,t,n),nm("event",{eventName:t,params:n})}catch{}})}catch{}}function rO(t,e){const r=rm()?window.location.href:void 0,n=t??(rm()?window.location.pathname:void 0),a=rm()?document.title:void 0;rp("page_view",{page_location:r,page_path:n,page_title:a})}function Mw(t){!tp||!t||qr(async()=>{const{setUserId:e}=await import("./index.esm-CmzND2QD.js");return{setUserId:e}},__vite__mapDeps([2,1]),import.meta.url).then(({setUserId:e})=>{try{e(tp,t)}catch{}nm("userId:set",{userId:t})})}async function ZH(t){const e=new Set([]);try{await ms.clear()}catch{}try{if(typeof window<"u"){try{const r={};if(e.size>0)for(let n=0;n<window.localStorage.length;n++){const a=window.localStorage.key(n);a&&e.has(a)&&(r[a]=window.localStorage.getItem(a))}if(window.localStorage.clear(),e.size>0)for(const n of Object.keys(r)){const a=r[n];a!=null&&window.localStorage.setItem(n,a)}}catch{}try{window.sessionStorage.clear()}catch{}}}catch{}}const Go=Object.create(null);Go.open="0";Go.close="1";Go.ping="2";Go.pong="3";Go.message="4";Go.upgrade="5";Go.noop="6";const Uv=Object.create(null);Object.keys(Go).forEach(t=>{Uv[Go[t]]=t});const lT={type:"error",data:"parser error"},x3=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",P3=typeof ArrayBuffer=="function",A3=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,vx=({type:t,data:e},r,n)=>x3&&e instanceof Blob?r?n(e):nO(e,n):P3&&(e instanceof ArrayBuffer||A3(e))?r?n(e):nO(new Blob([e]),n):n(Go[t]+(e||"")),nO=(t,e)=>{const r=new FileReader;return r.onload=function(){const n=r.result.split(",")[1];e("b"+(n||""))},r.readAsDataURL(t)};function aO(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let jw;function e9(t,e){if(x3&&t.data instanceof Blob)return t.data.arrayBuffer().then(aO).then(e);if(P3&&(t.data instanceof ArrayBuffer||A3(t.data)))return e(aO(t.data));vx(t,!1,r=>{jw||(jw=new TextEncoder),e(jw.encode(r))})}const iO="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Vh=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<iO.length;t++)Vh[iO.charCodeAt(t)]=t;const t9=t=>{let e=t.length*.75,r=t.length,n,a=0,i,o,c,u;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const d=new ArrayBuffer(e),f=new Uint8Array(d);for(n=0;n<r;n+=4)i=Vh[t.charCodeAt(n)],o=Vh[t.charCodeAt(n+1)],c=Vh[t.charCodeAt(n+2)],u=Vh[t.charCodeAt(n+3)],f[a++]=i<<2|o>>4,f[a++]=(o&15)<<4|c>>2,f[a++]=(c&3)<<6|u&63;return d},r9=typeof ArrayBuffer=="function",_x=(t,e)=>{if(typeof t!="string")return{type:"message",data:R3(t,e)};const r=t.charAt(0);return r==="b"?{type:"message",data:n9(t.substring(1),e)}:Uv[r]?t.length>1?{type:Uv[r],data:t.substring(1)}:{type:Uv[r]}:lT},n9=(t,e)=>{if(r9){const r=t9(t);return R3(r,e)}else return{base64:!0,data:t}},R3=(t,e)=>{switch(e){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},D3="",a9=(t,e)=>{const r=t.length,n=new Array(r);let a=0;t.forEach((i,o)=>{vx(i,!1,c=>{n[o]=c,++a===r&&e(n.join(D3))})})},i9=(t,e)=>{const r=t.split(D3),n=[];for(let a=0;a<r.length;a++){const i=_x(r[a],e);if(n.push(i),i.type==="error")break}return n};function s9(){return new TransformStream({transform(t,e){e9(t,r=>{const n=r.length;let a;if(n<126)a=new Uint8Array(1),new DataView(a.buffer).setUint8(0,n);else if(n<65536){a=new Uint8Array(3);const i=new DataView(a.buffer);i.setUint8(0,126),i.setUint16(1,n)}else{a=new Uint8Array(9);const i=new DataView(a.buffer);i.setUint8(0,127),i.setBigUint64(1,BigInt(n))}t.data&&typeof t.data!="string"&&(a[0]|=128),e.enqueue(a),e.enqueue(r)})}})}let Lw;function nv(t){return t.reduce((e,r)=>e+r.length,0)}function av(t,e){if(t[0].length===e)return t.shift();const r=new Uint8Array(e);let n=0;for(let a=0;a<e;a++)r[a]=t[0][n++],n===t[0].length&&(t.shift(),n=0);return t.length&&n<t[0].length&&(t[0]=t[0].slice(n)),r}function o9(t,e){Lw||(Lw=new TextDecoder);const r=[];let n=0,a=-1,i=!1;return new TransformStream({transform(o,c){for(r.push(o);;){if(n===0){if(nv(r)<1)break;const u=av(r,1);i=(u[0]&128)===128,a=u[0]&127,a<126?n=3:a===126?n=1:n=2}else if(n===1){if(nv(r)<2)break;const u=av(r,2);a=new DataView(u.buffer,u.byteOffset,u.length).getUint16(0),n=3}else if(n===2){if(nv(r)<8)break;const u=av(r,8),d=new DataView(u.buffer,u.byteOffset,u.length),f=d.getUint32(0);if(f>Math.pow(2,21)-1){c.enqueue(lT);break}a=f*Math.pow(2,32)+d.getUint32(4),n=3}else{if(nv(r)<a)break;const u=av(r,a);c.enqueue(_x(i?u:Lw.decode(u),e)),n=0}if(a===0||a>t){c.enqueue(lT);break}}}})}const O3=4;function Xn(t){if(t)return c9(t)}function c9(t){for(var e in Xn.prototype)t[e]=Xn.prototype[e];return t}Xn.prototype.on=Xn.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this};Xn.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),this};Xn.prototype.off=Xn.prototype.removeListener=Xn.prototype.removeAllListeners=Xn.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var r=this._callbacks["$"+t];if(!r)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var n,a=0;a<r.length;a++)if(n=r[a],n===e||n.fn===e){r.splice(a,1);break}return r.length===0&&delete this._callbacks["$"+t],this};Xn.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),r=this._callbacks["$"+t],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(r){r=r.slice(0);for(var n=0,a=r.length;n<a;++n)r[n].apply(this,e)}return this};Xn.prototype.emitReserved=Xn.prototype.emit;Xn.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};Xn.prototype.hasListeners=function(t){return!!this.listeners(t).length};const Db=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,r)=>r(e,0),ls=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),l9="arraybuffer";function N3(t,...e){return e.reduce((r,n)=>(t.hasOwnProperty(n)&&(r[n]=t[n]),r),{})}const u9=ls.setTimeout,d9=ls.clearTimeout;function Ob(t,e){e.useNativeTimers?(t.setTimeoutFn=u9.bind(ls),t.clearTimeoutFn=d9.bind(ls)):(t.setTimeoutFn=ls.setTimeout.bind(ls),t.clearTimeoutFn=ls.clearTimeout.bind(ls))}const f9=1.33;function p9(t){return typeof t=="string"?h9(t):Math.ceil((t.byteLength||t.size)*f9)}function h9(t){let e=0,r=0;for(let n=0,a=t.length;n<a;n++)e=t.charCodeAt(n),e<128?r+=1:e<2048?r+=2:e<55296||e>=57344?r+=3:(n++,r+=4);return r}function I3(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function m9(t){let e="";for(let r in t)t.hasOwnProperty(r)&&(e.length&&(e+="&"),e+=encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e}function g9(t){let e={},r=t.split("&");for(let n=0,a=r.length;n<a;n++){let i=r[n].split("=");e[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e}class y9 extends Error{constructor(e,r,n){super(e),this.description=r,this.context=n,this.type="TransportError"}}class bx extends Xn{constructor(e){super(),this.writable=!1,Ob(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,r,n){return super.emitReserved("error",new y9(e,r,n)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const r=_x(e,this.socket.binaryType);this.onPacket(r)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,r={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(r)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const r=m9(e);return r.length?"?"+r:""}}class v9 extends bx{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const r=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let n=0;this._polling&&(n++,this.once("pollComplete",function(){--n||r()})),this.writable||(n++,this.once("drain",function(){--n||r()}))}else r()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const r=n=>{if(this.readyState==="opening"&&n.type==="open"&&this.onOpen(),n.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(n)};i9(e,this.socket.binaryType).forEach(r),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,a9(e,r=>{this.doWrite(r,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",r=this.query||{};return this.opts.timestampRequests!==!1&&(r[this.opts.timestampParam]=I3()),!this.supportsBinary&&!r.sid&&(r.b64=1),this.createUri(e,r)}}let M3=!1;try{M3=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const _9=M3;function b9(){}class k9 extends v9{constructor(e){if(super(e),typeof location<"u"){const r=location.protocol==="https:";let n=location.port;n||(n=r?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||n!==e.port}}doWrite(e,r){const n=this.request({method:"POST",data:e});n.on("success",r),n.on("error",(a,i)=>{this.onError("xhr post error",a,i)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(r,n)=>{this.onError("xhr poll error",r,n)}),this.pollXhr=e}}let If=class Fv extends Xn{constructor(e,r,n){super(),this.createRequest=e,Ob(this,n),this._opts=n,this._method=n.method||"GET",this._uri=r,this._data=n.data!==void 0?n.data:null,this._create()}_create(){var e;const r=N3(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");r.xdomain=!!this._opts.xd;const n=this._xhr=this.createRequest(r);try{n.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let a in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(a)&&n.setRequestHeader(a,this._opts.extraHeaders[a])}}catch{}if(this._method==="POST")try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{n.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(n),"withCredentials"in n&&(n.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(n.timeout=this._opts.requestTimeout),n.onreadystatechange=()=>{var a;n.readyState===3&&((a=this._opts.cookieJar)===null||a===void 0||a.parseCookies(n.getResponseHeader("set-cookie"))),n.readyState===4&&(n.status===200||n.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof n.status=="number"?n.status:0)},0))},n.send(this._data)}catch(a){this.setTimeoutFn(()=>{this._onError(a)},0);return}typeof document<"u"&&(this._index=Fv.requestsCount++,Fv.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=b9,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Fv.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};If.requestsCount=0;If.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",sO);else if(typeof addEventListener=="function"){const t="onpagehide"in ls?"pagehide":"unload";addEventListener(t,sO,!1)}}function sO(){for(let t in If.requests)If.requests.hasOwnProperty(t)&&If.requests[t].abort()}const w9=(function(){const t=j3({xdomain:!1});return t&&t.responseType!==null})();class S9 extends k9{constructor(e){super(e);const r=e&&e.forceBase64;this.supportsBinary=w9&&!r}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new If(j3,this.uri(),e)}}function j3(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||_9))return new XMLHttpRequest}catch{}if(!e)try{return new ls[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const L3=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class E9 extends bx{get name(){return"websocket"}doOpen(){const e=this.uri(),r=this.opts.protocols,n=L3?{}:N3(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,r,n)}catch(a){return this.emitReserved("error",a)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let r=0;r<e.length;r++){const n=e[r],a=r===e.length-1;vx(n,this.supportsBinary,i=>{try{this.doWrite(n,i)}catch{}a&&Db(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",r=this.query||{};return this.opts.timestampRequests&&(r[this.opts.timestampParam]=I3()),this.supportsBinary||(r.b64=1),this.createUri(e,r)}}const Bw=ls.WebSocket||ls.MozWebSocket;class T9 extends E9{createSocket(e,r,n){return L3?new Bw(e,r,n):r?new Bw(e,r):new Bw(e)}doWrite(e,r){this.ws.send(r)}}class C9 extends bx{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const r=o9(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(r).getReader(),a=s9();a.readable.pipeTo(e.writable),this._writer=a.writable.getWriter();const i=()=>{n.read().then(({done:c,value:u})=>{c||(this.onPacket(u),i())}).catch(c=>{})};i();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let r=0;r<e.length;r++){const n=e[r],a=r===e.length-1;this._writer.write(n).then(()=>{a&&Db(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const x9={websocket:T9,webtransport:C9,polling:S9},P9=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,A9=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function uT(t){if(t.length>8e3)throw"URI too long";const e=t,r=t.indexOf("["),n=t.indexOf("]");r!=-1&&n!=-1&&(t=t.substring(0,r)+t.substring(r,n).replace(/:/g,";")+t.substring(n,t.length));let a=P9.exec(t||""),i={},o=14;for(;o--;)i[A9[o]]=a[o]||"";return r!=-1&&n!=-1&&(i.source=e,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=R9(i,i.path),i.queryKey=D9(i,i.query),i}function R9(t,e){const r=/\/{2,9}/g,n=e.replace(r,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&n.splice(0,1),e.slice(-1)=="/"&&n.splice(n.length-1,1),n}function D9(t,e){const r={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(n,a,i){a&&(r[a]=i)}),r}const dT=typeof addEventListener=="function"&&typeof removeEventListener=="function",qv=[];dT&&addEventListener("offline",()=>{qv.forEach(t=>t())},!1);class Bl extends Xn{constructor(e,r){if(super(),this.binaryType=l9,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(r=e,e=null),e){const n=uT(e);r.hostname=n.host,r.secure=n.protocol==="https"||n.protocol==="wss",r.port=n.port,n.query&&(r.query=n.query)}else r.host&&(r.hostname=uT(r.host).host);Ob(this,r),this.secure=r.secure!=null?r.secure:typeof location<"u"&&location.protocol==="https:",r.hostname&&!r.port&&(r.port=this.secure?"443":"80"),this.hostname=r.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=r.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},r.transports.forEach(n=>{const a=n.prototype.name;this.transports.push(a),this._transportsByName[a]=n}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},r),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=g9(this.opts.query)),dT&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},qv.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const r=Object.assign({},this.opts.query);r.EIO=O3,r.transport=e,this.id&&(r.sid=this.id);const n=Object.assign({},this.opts,{query:r,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](n)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&Bl.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const r=this.createTransport(e);r.open(),this.setTransport(r)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",r=>this._onClose("transport close",r))}onOpen(){this.readyState="open",Bl.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const r=new Error("server error");r.code=e.data,this._onError(r);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let r=1;for(let n=0;n<this.writeBuffer.length;n++){const a=this.writeBuffer[n].data;if(a&&(r+=p9(a)),n>0&&r>this._maxPayload)return this.writeBuffer.slice(0,n);r+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,Db(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,r,n){return this._sendPacket("message",e,r,n),this}send(e,r,n){return this._sendPacket("message",e,r,n),this}_sendPacket(e,r,n,a){if(typeof r=="function"&&(a=r,r=void 0),typeof n=="function"&&(a=n,n=null),this.readyState==="closing"||this.readyState==="closed")return;n=n||{},n.compress=n.compress!==!1;const i={type:e,data:r,options:n};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),a&&this.once("flush",a),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},r=()=>{this.off("upgrade",r),this.off("upgradeError",r),e()},n=()=>{this.once("upgrade",r),this.once("upgradeError",r)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?n():e()}):this.upgrading?n():e()),this}_onError(e){if(Bl.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,r){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),dT&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const n=qv.indexOf(this._offlineEventListener);n!==-1&&qv.splice(n,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,r),this.writeBuffer=[],this._prevBufferLen=0}}}Bl.protocol=O3;class O9 extends Bl{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let r=this.createTransport(e),n=!1;Bl.priorWebsocketSuccess=!1;const a=()=>{n||(r.send([{type:"ping",data:"probe"}]),r.once("packet",h=>{if(!n)if(h.type==="pong"&&h.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",r),!r)return;Bl.priorWebsocketSuccess=r.name==="websocket",this.transport.pause(()=>{n||this.readyState!=="closed"&&(f(),this.setTransport(r),r.send([{type:"upgrade"}]),this.emitReserved("upgrade",r),r=null,this.upgrading=!1,this.flush())})}else{const m=new Error("probe error");m.transport=r.name,this.emitReserved("upgradeError",m)}}))};function i(){n||(n=!0,f(),r.close(),r=null)}const o=h=>{const m=new Error("probe error: "+h);m.transport=r.name,i(),this.emitReserved("upgradeError",m)};function c(){o("transport closed")}function u(){o("socket closed")}function d(h){r&&h.name!==r.name&&i()}const f=()=>{r.removeListener("open",a),r.removeListener("error",o),r.removeListener("close",c),this.off("close",u),this.off("upgrading",d)};r.once("open",a),r.once("error",o),r.once("close",c),this.once("close",u),this.once("upgrading",d),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{n||r.open()},200):r.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const r=[];for(let n=0;n<e.length;n++)~this.transports.indexOf(e[n])&&r.push(e[n]);return r}}let N9=class extends O9{constructor(e,r={}){const n=typeof e=="object"?e:r;(!n.transports||n.transports&&typeof n.transports[0]=="string")&&(n.transports=(n.transports||["polling","websocket","webtransport"]).map(a=>x9[a]).filter(a=>!!a)),super(e,n)}};function I9(t,e="",r){let n=t;r=r||typeof location<"u"&&location,t==null&&(t=r.protocol+"//"+r.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=r.protocol+t:t=r.host+t),/^(https?|wss?):\/\//.test(t)||(typeof r<"u"?t=r.protocol+"//"+t:t="https://"+t),n=uT(t)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";const i=n.host.indexOf(":")!==-1?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+i+":"+n.port+e,n.href=n.protocol+"://"+i+(r&&r.port===n.port?"":":"+n.port),n}const M9=typeof ArrayBuffer=="function",j9=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,B3=Object.prototype.toString,L9=typeof Blob=="function"||typeof Blob<"u"&&B3.call(Blob)==="[object BlobConstructor]",B9=typeof File=="function"||typeof File<"u"&&B3.call(File)==="[object FileConstructor]";function kx(t){return M9&&(t instanceof ArrayBuffer||j9(t))||L9&&t instanceof Blob||B9&&t instanceof File}function zv(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let r=0,n=t.length;r<n;r++)if(zv(t[r]))return!0;return!1}if(kx(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return zv(t.toJSON(),!0);for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&zv(t[r]))return!0;return!1}function U9(t){const e=[],r=t.data,n=t;return n.data=fT(r,e),n.attachments=e.length,{packet:n,buffers:e}}function fT(t,e){if(!t)return t;if(kx(t)){const r={_placeholder:!0,num:e.length};return e.push(t),r}else if(Array.isArray(t)){const r=new Array(t.length);for(let n=0;n<t.length;n++)r[n]=fT(t[n],e);return r}else if(typeof t=="object"&&!(t instanceof Date)){const r={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=fT(t[n],e));return r}return t}function F9(t,e){return t.data=pT(t.data,e),delete t.attachments,t}function pT(t,e){if(!t)return t;if(t&&t._placeholder===!0){if(typeof t.num=="number"&&t.num>=0&&t.num<e.length)return e[t.num];throw new Error("illegal attachments")}else if(Array.isArray(t))for(let r=0;r<t.length;r++)t[r]=pT(t[r],e);else if(typeof t=="object")for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(t[r]=pT(t[r],e));return t}const q9=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],z9=5;var xr;(function(t){t[t.CONNECT=0]="CONNECT",t[t.DISCONNECT=1]="DISCONNECT",t[t.EVENT=2]="EVENT",t[t.ACK=3]="ACK",t[t.CONNECT_ERROR=4]="CONNECT_ERROR",t[t.BINARY_EVENT=5]="BINARY_EVENT",t[t.BINARY_ACK=6]="BINARY_ACK"})(xr||(xr={}));class $9{constructor(e){this.replacer=e}encode(e){return(e.type===xr.EVENT||e.type===xr.ACK)&&zv(e)?this.encodeAsBinary({type:e.type===xr.EVENT?xr.BINARY_EVENT:xr.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let r=""+e.type;return(e.type===xr.BINARY_EVENT||e.type===xr.BINARY_ACK)&&(r+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(r+=e.nsp+","),e.id!=null&&(r+=e.id),e.data!=null&&(r+=JSON.stringify(e.data,this.replacer)),r}encodeAsBinary(e){const r=U9(e),n=this.encodeAsString(r.packet),a=r.buffers;return a.unshift(n),a}}function oO(t){return Object.prototype.toString.call(t)==="[object Object]"}class wx extends Xn{constructor(e){super(),this.reviver=e}add(e){let r;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");r=this.decodeString(e);const n=r.type===xr.BINARY_EVENT;n||r.type===xr.BINARY_ACK?(r.type=n?xr.EVENT:xr.ACK,this.reconstructor=new V9(r),r.attachments===0&&super.emitReserved("decoded",r)):super.emitReserved("decoded",r)}else if(kx(e)||e.base64)if(this.reconstructor)r=this.reconstructor.takeBinaryData(e),r&&(this.reconstructor=null,super.emitReserved("decoded",r));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let r=0;const n={type:Number(e.charAt(0))};if(xr[n.type]===void 0)throw new Error("unknown packet type "+n.type);if(n.type===xr.BINARY_EVENT||n.type===xr.BINARY_ACK){const i=r+1;for(;e.charAt(++r)!=="-"&&r!=e.length;);const o=e.substring(i,r);if(o!=Number(o)||e.charAt(r)!=="-")throw new Error("Illegal attachments");n.attachments=Number(o)}if(e.charAt(r+1)==="/"){const i=r+1;for(;++r&&!(e.charAt(r)===","||r===e.length););n.nsp=e.substring(i,r)}else n.nsp="/";const a=e.charAt(r+1);if(a!==""&&Number(a)==a){const i=r+1;for(;++r;){const o=e.charAt(r);if(o==null||Number(o)!=o){--r;break}if(r===e.length)break}n.id=Number(e.substring(i,r+1))}if(e.charAt(++r)){const i=this.tryParse(e.substr(r));if(wx.isPayloadValid(n.type,i))n.data=i;else throw new Error("invalid payload")}return n}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,r){switch(e){case xr.CONNECT:return oO(r);case xr.DISCONNECT:return r===void 0;case xr.CONNECT_ERROR:return typeof r=="string"||oO(r);case xr.EVENT:case xr.BINARY_EVENT:return Array.isArray(r)&&(typeof r[0]=="number"||typeof r[0]=="string"&&q9.indexOf(r[0])===-1);case xr.ACK:case xr.BINARY_ACK:return Array.isArray(r)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class V9{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const r=F9(this.reconPack,this.buffers);return this.finishedReconstruction(),r}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const H9=Object.freeze(Object.defineProperty({__proto__:null,Decoder:wx,Encoder:$9,get PacketType(){return xr},protocol:z9},Symbol.toStringTag,{value:"Module"}));function Fs(t,e,r){return t.on(e,r),function(){t.off(e,r)}}const G9=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class U3 extends Xn{constructor(e,r,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=r,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[Fs(e,"open",this.onopen.bind(this)),Fs(e,"packet",this.onpacket.bind(this)),Fs(e,"error",this.onerror.bind(this)),Fs(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...r){var n,a,i;if(G9.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(r.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(r),this;const o={type:xr.EVENT,data:r};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof r[r.length-1]=="function"){const f=this.ids++,h=r.pop();this._registerAckCallback(f,h),o.id=f}const c=(a=(n=this.io.engine)===null||n===void 0?void 0:n.transport)===null||a===void 0?void 0:a.writable,u=this.connected&&!(!((i=this.io.engine)===null||i===void 0)&&i._hasPingExpired());return this.flags.volatile&&!c||(u?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(e,r){var n;const a=(n=this.flags.timeout)!==null&&n!==void 0?n:this._opts.ackTimeout;if(a===void 0){this.acks[e]=r;return}const i=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let c=0;c<this.sendBuffer.length;c++)this.sendBuffer[c].id===e&&this.sendBuffer.splice(c,1);r.call(this,new Error("operation has timed out"))},a),o=(...c)=>{this.io.clearTimeoutFn(i),r.apply(this,c)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...r){return new Promise((n,a)=>{const i=(o,c)=>o?a(o):n(c);i.withError=!0,r.push(i),this.emit(e,...r)})}_addToQueue(e){let r;typeof e[e.length-1]=="function"&&(r=e.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((a,...i)=>n!==this._queue[0]?void 0:(a!==null?n.tryCount>this._opts.retries&&(this._queue.shift(),r&&r(a)):(this._queue.shift(),r&&r(null,...i)),n.pending=!1,this._drainQueue())),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const r=this._queue[0];r.pending&&!e||(r.pending=!0,r.tryCount++,this.flags=r.flags,this.emit.apply(this,r.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:xr.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,r){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,r),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(n=>String(n.id)===e)){const n=this.acks[e];delete this.acks[e],n.withError&&n.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case xr.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case xr.EVENT:case xr.BINARY_EVENT:this.onevent(e);break;case xr.ACK:case xr.BINARY_ACK:this.onack(e);break;case xr.DISCONNECT:this.ondisconnect();break;case xr.CONNECT_ERROR:this.destroy();const n=new Error(e.data.message);n.data=e.data.data,this.emitReserved("connect_error",n);break}}onevent(e){const r=e.data||[];e.id!=null&&r.push(this.ack(e.id)),this.connected?this.emitEvent(r):this.receiveBuffer.push(Object.freeze(r))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const r=this._anyListeners.slice();for(const n of r)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const r=this;let n=!1;return function(...a){n||(n=!0,r.packet({type:xr.ACK,id:e,data:a}))}}onack(e){const r=this.acks[e.id];typeof r=="function"&&(delete this.acks[e.id],r.withError&&e.data.unshift(null),r.apply(this,e.data))}onconnect(e,r){this.id=e,this.recovered=r&&this._pid===r,this._pid=r,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:xr.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const r=this._anyListeners;for(let n=0;n<r.length;n++)if(e===r[n])return r.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const r=this._anyOutgoingListeners;for(let n=0;n<r.length;n++)if(e===r[n])return r.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const r=this._anyOutgoingListeners.slice();for(const n of r)n.apply(this,e.data)}}}function Sp(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}Sp.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),r=Math.floor(e*this.jitter*t);t=(Math.floor(e*10)&1)==0?t-r:t+r}return Math.min(t,this.max)|0};Sp.prototype.reset=function(){this.attempts=0};Sp.prototype.setMin=function(t){this.ms=t};Sp.prototype.setMax=function(t){this.max=t};Sp.prototype.setJitter=function(t){this.jitter=t};class hT extends Xn{constructor(e,r){var n;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(r=e,e=void 0),r=r||{},r.path=r.path||"/socket.io",this.opts=r,Ob(this,r),this.reconnection(r.reconnection!==!1),this.reconnectionAttempts(r.reconnectionAttempts||1/0),this.reconnectionDelay(r.reconnectionDelay||1e3),this.reconnectionDelayMax(r.reconnectionDelayMax||5e3),this.randomizationFactor((n=r.randomizationFactor)!==null&&n!==void 0?n:.5),this.backoff=new Sp({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(r.timeout==null?2e4:r.timeout),this._readyState="closed",this.uri=e;const a=r.parser||H9;this.encoder=new a.Encoder,this.decoder=new a.Decoder,this._autoConnect=r.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var r;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(r=this.backoff)===null||r===void 0||r.setMin(e),this)}randomizationFactor(e){var r;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(r=this.backoff)===null||r===void 0||r.setJitter(e),this)}reconnectionDelayMax(e){var r;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(r=this.backoff)===null||r===void 0||r.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new N9(this.uri,this.opts);const r=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const a=Fs(r,"open",function(){n.onopen(),e&&e()}),i=c=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",c),e?e(c):this.maybeReconnectOnOpen()},o=Fs(r,"error",i);if(this._timeout!==!1){const c=this._timeout,u=this.setTimeoutFn(()=>{a(),i(new Error("timeout")),r.close()},c);this.opts.autoUnref&&u.unref(),this.subs.push(()=>{this.clearTimeoutFn(u)})}return this.subs.push(a),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Fs(e,"ping",this.onping.bind(this)),Fs(e,"data",this.ondata.bind(this)),Fs(e,"error",this.onerror.bind(this)),Fs(e,"close",this.onclose.bind(this)),Fs(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(r){this.onclose("parse error",r)}}ondecoded(e){Db(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,r){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new U3(this,e,r),this.nsps[e]=n),n}_destroy(e){const r=Object.keys(this.nsps);for(const n of r)if(this.nsps[n].active)return;this._close()}_packet(e){const r=this.encoder.encode(e);for(let n=0;n<r.length;n++)this.engine.write(r[n],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,r){var n;this.cleanup(),(n=this.engine)===null||n===void 0||n.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,r),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const r=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(a=>{a?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",a)):e.onreconnect()}))},r);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Th={};function $v(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const r=I9(t,e.path||"/socket.io"),n=r.source,a=r.id,i=r.path,o=Th[a]&&i in Th[a].nsps,c=e.forceNew||e["force new connection"]||e.multiplex===!1||o;let u;return c?u=new hT(n,e):(Th[a]||(Th[a]=new hT(n,e)),u=Th[a]),r.query&&!e.query&&(e.query=r.queryKey),u.socket(r.path,e)}Object.assign($v,{Manager:hT,Socket:U3,io:$v,connect:$v});function Zu(t,e){try{if(!t)return;const r={tag:e,id:t.id,connected:t.connected,active:t.active};t.disconnect()}catch{}}function F3(t,e){try{if(!t)return;t.close?.()}catch{}}const q3=v.createContext(void 0),W9=({children:t})=>{const[e,r]=v.useState(!0),[n,a]=v.useState(0),i=v.useCallback(()=>r(!0),[]),o=v.useCallback(()=>a(f=>f+1),[]),c=v.useCallback(()=>a(0),[]),u=v.useCallback(f=>{r(!1),setTimeout(()=>r(!0),f)},[]),d=v.useCallback(()=>r(!1),[]);return v.useEffect(()=>{if(typeof window>"u"||!(typeof window.location<"u"&&window.location.search.includes("e2e=1")))return;const h={triggerSpin:o,scheduleReveal:u,resetReveal:d,resetSpin:c};try{window.__diceRevealTest=h}catch{}return()=>{try{delete window.__diceRevealTest}catch{}}},[o,u,d,c]),g.jsx(q3.Provider,{value:{reveal:e,triggerReveal:i,scheduleReveal:u,resetReveal:d,triggerSpin:o,rollTrigger:n,resetSpin:c},children:t})},Jo=()=>{const t=v.useContext(q3);if(!t)throw new Error("useDiceReveal must be used within a DiceRevealProvider");return t},z3=v.createContext(null);let Ia=null,cO="",Vv=0,$3=0,lO=0;const K9=1200;let Sx=!1,uO=0;const Y9=2e3;function Hs(t,e){if(!t||t.connected||t.active||Sx)return!1;const r=Date.now();if(r<uO)return!1;uO=r+Y9;try{t.connect()}catch{}return!0}function X9(){Sx=!1}function V3(){Sx=!0}function Ex(t=2e3){try{Vv=Date.now()+Math.max(0,t|0)}catch{}}function J9(t=2e3){try{Ex(t)}catch{}try{Ia?.removeAllListeners()}catch{}try{Zu(Ia,"SocketContext: hardDisconnectSocket")}catch{}}function Q9(){const t=Ia;if(t){try{t.auth={platform:"web",guest:!0}}catch{}try{$3=Date.now()+3e3}catch{}try{Zu(t,"SocketContext: logout refresh")}catch{}setTimeout(()=>{try{t.connect()}catch{}},100)}}function Z9(t){const e=(()=>{try{return typeof window<"u"&&/^(capacitor:|ionic:)/i.test(window.location?.protocol||"")}catch{return!1}})(),r=(()=>{try{return typeof window<"u"?window.location.search:""}catch{return""}})(),a=/(?:[?&])wsOnly=1/.test(r)||(()=>{try{return localStorage.getItem("socket:wsOnly")==="1"}catch{return!1}})()?["websocket"]:["websocket","polling"],i=window.APP_TARGET||"ceelo",o=$v(t,{path:"/socket.io",withCredentials:!0,transports:a,upgrade:a.length>1,timeout:25e3,autoConnect:!1,extraHeaders:e?{Origin:t}:void 0,auth:{appTarget:i}});return o.on("connect_error",c=>{try{o.__lastConnectErr={ts:Date.now(),reason:c?.message||""}}catch{}}),o}function eG(t){if(Ia&&cO===t)return Ia;if(Ia){try{Ia.removeAllListeners()}catch{}try{F3(Ia,"SocketContext: getSharedSocket replace")}catch{}Ia=null}Ia=Z9(t),cO=t;try{if(typeof window<"u"){(window.location?.search||"").includes("e2e=1")&&(window.__SOCKET=Ia,window.__sharedSocket=Ia,window.hardDisconnectSocket=J9,window.suspendSocketAutoConnect=Ex);try{if(!window.__clientErrMon){window.__clientErrMon=!0;const r=a=>{try{const i=window.__sharedSocket||Ia;if(!i)return;i.connected?i.emit("client_error",a):(i.__pendingClientErrors=i.__pendingClientErrors||[],i.__pendingClientErrors.push(a))}catch{}},n=()=>{let a="web";try{const i=navigator.userAgent||"";/iPhone|iPad|iPod/i.test(i)?a="ios":/Android/i.test(i)?a="android":a="web"}catch{}return{platform:a,userAgent:typeof navigator<"u"?navigator.userAgent:"",ts:Date.now()}};window.addEventListener("error",a=>{try{if(!a.error&&!a.message)return;r({message:a.message||"error",stack:a.error?.stack?.slice?.(0,5e3),filename:a.filename,line:a.lineno,col:a.colno,...n()})}catch{}}),window.addEventListener("unhandledrejection",a=>{try{const i=a.reason,o=typeof i=="string"?i:i?.message||"unhandledrejection";if(i?.name==="AbortError"||o?.includes?.("aborted")||o?.includes?.("The operation was aborted"))return;r({message:o?.slice?.(0,500)||"unhandledrejection",stack:(i?.stack||"").slice?.(0,5e3),...n()})}catch{}}),Ia.on("connect",()=>{try{const a=Ia,i=a?.__pendingClientErrors;Array.isArray(i)&&i.length&&i.splice(0,i.length).forEach(c=>{try{a.emit("client_error",c)}catch{}})}catch{}})}}catch{}}}catch{}return Ia}function tG({children:t}){const{user:e,initialized:r}=$r(),n=ci(),a=v.useMemo(()=>eG(n),[n]),{resetSpin:i}=Jo();return v.useEffect(()=>{if(!r)return;let o=!1;return(async()=>{const c=f=>{try{a.__authSig=f}catch{}},u=()=>{try{return String(a.__authSig||"")}catch{return""}},d=f=>{const h=Math.max(0,Vv-Date.now());if(h<=0)return f();setTimeout(()=>{o||f()},h).unref?.()};if(e){const f=await oi();if(o)return;if(f){const h=u(),m=`t:${f}`;if(a.auth={token:f},c(m),a.disconnected)d(()=>{o||(Hs(a),i())});else if(h!==m){const _=Date.now();_-lO>=K9&&(lO=_,d(()=>{if(!o){try{Zu(a,"SocketContext: auth change soft reconnect")}catch{}setTimeout(()=>{o||(Hs(a),i())},100)}}))}}}})(),()=>{o=!0}},[r,e,a]),v.useEffect(()=>{const o=async()=>{if(Date.now()<Vv)return;const c=await oi();if(!c){if(Date.now()<$3){try{a.auth={platform:"web",guest:!0},a.__authSig="g:*"}catch{}i();return}try{a.auth={},a.__authSig=""}catch{}try{a.disconnected||Zu(a,"SocketContext: skip reconnect without token")}catch{}return}a.auth={token:c};try{a.__authSig=`t:${c}`}catch{}i()};return a.on("reconnect_attempt",o),()=>{a.off("reconnect_attempt",o)}},[a,i]),v.useEffect(()=>{const o=async c=>{try{await Zf(c)}catch{}a.auth=c?{token:c}:{};try{a.__authSig=c?`t:${c}`:""}catch{}};return a.on("auth:rotate",o),()=>{a.off("auth:rotate",o)}},[a]),v.useEffect(()=>{let o=!1;const c=async()=>{if(!o){try{const d=await oi();a.auth=d?{token:d}:{platform:"web",guest:!0}}catch{}try{if(a.connected)try{Zu(a,"SocketContext: OTA forceReconnect")}catch{}setTimeout(()=>{o||(Hs(a,"SocketContext:OTA-forceReconnect"),i())},100)}catch{}}},u=()=>c();window.addEventListener("ota:activated",u);try{window.__OTA_ACTIVATED__&&c()}catch{}return()=>{o=!0,window.removeEventListener("ota:activated",u)}},[a,i]),v.useEffect(()=>{let o=!1;const c=async()=>{if(!o&&!(Date.now()<Vv)&&a.disconnected){try{const m=await oi();if(o||!m)return;a.auth={token:m}}catch{}a.disconnected&&(Hs(a),i())}},u=()=>{try{document.visibilityState==="visible"&&c()}catch{}},d=()=>c(),f=()=>c(),h=()=>c();return window.addEventListener("visibilitychange",u),window.addEventListener("focus",d),window.addEventListener("pageshow",f),window.addEventListener("online",h),()=>{o=!0,window.removeEventListener("visibilitychange",u),window.removeEventListener("focus",d),window.removeEventListener("pageshow",f),window.removeEventListener("online",h)}},[a,i]),v.useEffect(()=>{const o=()=>{try{a.removeAllListeners()}catch{}try{F3(a,"SocketContext: beforeunload")}catch{}};return window.addEventListener("beforeunload",o),()=>{window.removeEventListener("beforeunload",o)}},[a]),g.jsx(z3.Provider,{value:a,children:t})}function ks(){const t=v.useContext(z3);if(!t)throw new Error("useSocket must be used within a SocketProvider");return t}const H3=v.createContext({user:null,loading:!0,initialized:!1,refreshUser:async()=>{},logout:async()=>{},meId:""}),$r=()=>v.useContext(H3);function rG(t){if(!t)return null;if(typeof t=="object"&&"authenticated"in t){const e=t;return e.authenticated?e.user??null:null}return t}const nG=({children:t})=>{const[e,r]=v.useState(null),[n,a]=v.useState(""),[i,o]=v.useState(!0),[c,u]=v.useState(!1),d=yi(),f=v.useRef(null),h=v.useRef(!0);v.useEffect(()=>(h.current=!0,()=>{h.current=!1}),[]);const m=v.useCallback(async b=>{if(f.current){if(!b?.force)return f.current;try{await f.current}catch{}}const E=new URLSearchParams(d.search);if((()=>{try{if(E.get("e2e")==="1"||typeof window<"u"&&(window.__E2E===!0||window.location?.search?.includes("e2e=1")||typeof window.sessionStorage<"u"&&window.sessionStorage.getItem("e2e")==="1"))return!0}catch{}return!1})()){let A=1e3;try{const C=window.sessionStorage?.getItem("e2e_balance"),O=C?Number(C):NaN;Number.isFinite(O)&&(A=O)}catch{}r({id:"e2e-user",name:"E2E",email:"e2e@example.com",balance:A,botChatDisabled:!1,ceeloBotsPerRoom:null,crapsBotsPerRoom:null,pokerBotsPerRoom:null}),a("e2e-user"),o(!1),u(!0);return}const D=async()=>{r(null),a("");try{Mw(null)}catch{}};if(d.pathname==="/login"&&!b?.force){await D(),o(!1),u(!0);return}o(!0);const P=(async()=>{try{const A=await Rb(),C=rG(A);if(C){X9(),r(C),a(C?.id||"");try{Mw(C.id||null)}catch{}}else await D()}catch{if(!h.current)return;await D()}finally{o(!1),u(!0),f.current=null}})();return f.current=P,P},[]);v.useEffect(()=>{m()},[m]);const _=v.useCallback(async()=>{const b=e?.email;try{try{Ex(2500)}catch{}b&&await Bv(b);try{await fetch("/api/auth/clear",{method:"POST",credentials:"include"})}catch{}}finally{if(!h.current)return;try{await Cg()}catch{}try{await ZH()}catch{}r(null),a("");try{Mw(null)}catch{}try{Q9()}catch{}}},[e?.email]),w=v.useMemo(()=>({user:e,loading:i,initialized:c,refreshUser:m,logout:_,meId:n}),[e,i,c,m,_,n]);return g.jsx(H3.Provider,{value:w,children:t})};function ji({className:t}){return v.useEffect(()=>{document.body.classList.add(t);const e=(()=>{try{return/^(capacitor:|ionic:)/i.test(window.location?.protocol||"")}catch{return!1}})();return e&&(document.body.classList.add("is-native-app"),document.documentElement.classList.add("is-native-app")),()=>{document.body.classList.remove(t),e&&(document.body.classList.remove("is-native-app"),document.documentElement.classList.remove("is-native-app"))}},[t]),null}function aG(){const{user:t,loading:e,initialized:r}=$r(),n=yi(),i=new URLSearchParams(n.search).get("e2e")==="1",o=n.pathname||"",c=/^\/poker\/room\//.test(o),u=/^\/room\//.test(o);return!r||e?g.jsxs("div",{className:"HomeScreen theme-casino home-fixed-root",children:[g.jsx(ji,{className:"page-home-screen"}),g.jsx("div",{className:"home-preloader",children:g.jsx("div",{className:"home-preloader__spinner"})})]}):!t&&!i&&!(c||u)?g.jsx(tm,{to:"/login",replace:!0,state:{from:n}}):g.jsx(d3,{})}function iG(){return g.jsxs("div",{style:{padding:24},children:[g.jsx("h2",{children:"Verification failed"}),g.jsx("p",{children:"Your login link is invalid or expired. Please request a new one."})]})}const G3=v.createContext(null);function sG({children:t}){const[e,r]=v.useState([]),n=v.useRef({}),a=v.useCallback(f=>{r(m=>m.filter(_=>_.id!==f));const h=n.current[f];h&&(window.clearTimeout(h),delete n.current[f])},[]),i=v.useCallback(f=>{const h=crypto.randomUUID(),m={id:h,duration:3500,...f};r(w=>[...w,m]);const _=m.duration??3500;return _>0&&(n.current[h]=window.setTimeout(()=>a(h),_)),h},[a]),o=v.useCallback((f,h={})=>i({message:f,variant:"success",...h}),[i]),c=v.useCallback((f,h={})=>i({message:f,variant:"error",...h}),[i]),u=v.useCallback((f,h={})=>i({message:f,variant:"info",...h}),[i]),d=v.useMemo(()=>({show:i,success:o,error:c,info:u,dismiss:a}),[i,o,c,u,a]);return g.jsxs(G3.Provider,{value:d,children:[t,Wc.createPortal(g.jsx("div",{className:"toast-root","aria-live":"polite","aria-atomic":"true",children:e.map(f=>g.jsxs("div",{className:`toast-item toast-${f.variant}`,role:"status",onClick:()=>a(f.id),children:[f.title&&g.jsx("div",{className:"toast-title",children:f.title}),f.message&&g.jsx("div",{className:"toast-message",children:f.message}),g.jsx("button",{className:"toast-close","aria-label":"Dismiss",onClick:h=>{h.stopPropagation(),a(f.id)},children:"×"})]},f.id))}),document.body)]})}function cu(){const t=v.useContext(G3);if(!t){const e=()=>"noop";return{show:()=>"noop",success:e,error:e,info:e,dismiss:()=>{}}}return t}const W3={BOTS_NUDGE:"bots:nudge",ROOM_REFRESH_STATE:"room:refresh_state",USER_GET_BALANCE:"user:get_balance",SEND_FRIEND_REQUEST:"send_friend_request",CANCEL_FRIEND_REQUEST:"cancel_friend_request",RESPOND_FRIEND_REQUEST:"respond_friend_request",UNFRIEND:"unfriend",BLOCK_USER:"block_user",UNBLOCK_USER:"unblock_user",FAIRNESS_REVEAL:"fairness_reveal",CREATE_ROOM:"room_create",JOIN_ROOM:"join_room",LEAVE_ROOM:"leave_room",ROLL_DICE:"roll_dice",CONFIRM_BETS:"confirm_bets",GET_ROOMS_LIST:"get_rooms_list",BANKER_GIVE_UP:"banker_give_up",BANKER_CHANGED:"banker_changed",PLACE_MAIN_BET:"place_main_bet",CANCEL_MAIN_BET:"cancel_main_bet",CREATE_SIDE_BET:"create_side_bet",ACCEPT_SIDE_BET:"accept_side_bet",CANCEL_SIDE_BET:"cancel_side_bet",GET_WAGERS:"get_wagers",RTC_JOIN:"rtc_join",RTC_LEAVE:"rtc_leave",RTC_SIGNAL:"rtc_signal",RTC_SET_CAMERA_OWNER:"rtc_set_camera_owner",RTC_SET_VIDEO_ENABLED:"rtc_set_video_enabled",RTC_PEER_LEFT:"rtc_peer_left",RTC_CAMERA_OWNER_CHANGED:"rtc_camera_owner_changed",RTC_VIDEO_ENABLED:"rtc_video_enabled",ROOM_SEND_MESSAGE:"room_send_message",ROOM_FETCH_HISTORY:"room_fetch_history",ROOM_MESSAGE:"room_message",ROOM_HISTORY:"room_history",DM_SEND_MESSAGE:"dm_send_message",DM_FETCH_HISTORY:"dm_fetch_history",DIRECT_MESSAGE:"direct_message",DIRECT_HISTORY:"direct_history",LOBBY_JOIN:"lobby_join",LOBBY_LEAVE:"lobby_leave",LOBBY_LIST:"lobby_list",DELETE_ROOM:"room_delete",SOCIAL_GET_LIST:"social:get_list",USER_UPDATE_PROFILE:"user:update_profile",TURN_ORDER_UPDATED:"turn_order_updated",SPECTATE_SET:"spectate_set",SPECTATORS_UPDATED:"spectators_updated",CRAPS_PLACE_PASS:"craps:place_pass",CRAPS_PLACE_DONT_PASS:"craps:place_dont_pass",CRAPS_PLACE_ODDS:"craps:place_odds",CRAPS_PLACE_PLACE:"craps:place_place",CRAPS_PLACE_FIELD:"craps:place_field",CRAPS_PLACE_BIG:"craps:place_big",CRAPS_PLACE_COME:"craps:place_come",CRAPS_PLACE_DONT_COME:"craps:place_dont_come",CRAPS_PLACE_COME_ODDS:"craps:place_come_odds",CRAPS_PLACE_DONT_COME_ODDS:"craps:place_dont_come_odds",CRAPS_TOGGLE_PLACE_WORKING:"craps:toggle_place_working",CRAPS_ROLL:"craps:roll",CRAPS_READY:"craps:ready",CRAPS_READY_UPDATE:"craps:ready_update",CRAPS_FETCH_HISTORY:"craps:fetch_history",POKER_ROOM_CREATE:"poker_room_create",POKER_ROOM_DELETE:"poker_room_delete",POKER_JOIN_ROOM:"poker_join_room",POKER_ACT:"poker:act",POKER_START_HAND:"poker:start_hand",POKER_ROOM_CREATED:"poker_room_created",POKER_ROOM_UPDATED:"poker_room_updated",POKER_ROOM_DELETED:"poker_room_deleted",POKER_JOINED_ROOM:"poker_joined_room",POKER_REJOINED_ROOM:"poker_rejoined_room",POKER_FETCH_HISTORY:"poker:fetch_history",POKER_START_READY_UPDATE:"poker:start_ready_update",GAME_INVITE_SEND:"game_invite:send",GAME_INVITE_RESPOND:"game_invite:respond",GAME_INVITE_RECEIVED:"game_invite:received",POKER_AD_STARTED:"poker:ad_started",POKER_AD_COMPLETED:"poker:ad_completed",POKER_AD_FAILED:"poker:ad_failed",POKER_AD_REQUIRED:"poker:ad_required",POKER_AD_CLEARED:"poker:ad_cleared",POKER_PLAYER_AD_STATUS:"poker:player_ad_status"};Object.freeze(W3);const St=new Proxy(W3,{set(){throw new TypeError("SocketEvents is read-only")},defineProperty(){throw new TypeError("SocketEvents is read-only")},deleteProperty(){throw new TypeError("SocketEvents is read-only")}}),oG="data:audio/mp4;base64,AAAAHGZ0eXBNNEEgAAAAAE00QSBpc29tbXA0MgAAAAFtZGF0AAAAAAAACHkhIANAaBwhTuE5h+LsYiCvilbNXKcS0BitVYE9SNc0evNePa61+Z8fPn+j/f7bvwv1Hfs+vy2K8OXhDrVnwh7rcY/J7GoeN9vZoQqC4srBiAIptz6ALP25RIg4MSE6ZabZXAudF7C2F9WrVCtPjvCo2zgN65zbXJO2/YGjPc/gu8kKoUn0fRrvACx2qq4x6pvpYgEseZg9EuCYOKuLfO37xf82reT+1dw2OLir7jAeGeayVlQn9T+gQKKTQW1hVADPKJzu7J9kgIBhaLeiBk8aqUv40wAIwQxevFqQ246PdyYQft5CZAtrwC3+DAjRmX2+/C+4ObfObQ9We0ikCEg3ZrbGcqpMX4wAeQ/CRcEYnbQNSCYhFQyCCYng4Cqtme32Hnrx9v5/6a+zr1+/7+4+SHVrPgF1OMc0eupMA3Nxv1/QAKnXlMH0Gm58FQo2wbCv3hnH+gGPC2bz/LmBXLAaauTntyGGK7geDxR4IU6zQVmszRAqjKCyosXQGzGVQUQKIzVohIF9tzvXqmu9fHvnO7pu1P/n1/aWneQ/65+e+jvt8PCdOohAT/S/3dw1dm+8oWy68se0ux2Y4JoceYOXjtzXQD1KZyQccWgAU6RDlDi0XTKqJW2AsVBbkKmrE+nSaiz5Kjt6fPvHzOJfVg1htmqrUCQ92fC/gr1RuT9N7rfsYA7mEltF4s5hPr4ygEA0PejOqTnedYk8MWpMWoJgAj82gUeU94mhRFiEIIGt+rqkJUDGPyAYQoUMfm67hPhod3YcUmCcJ0ORraWn7eVZ6OMY8nAB4OIEANw/kdjzyEeS+UApmeQ2/TSiszfugCt8aSCDbWEdghf6QGejUaynpJgroIOVrpSYjU+O2eSFWnLjTVK4n3RlEoTwDjAe7xMLwXtfGmgTDOfwjf4tUdEMgAhmIfCQ7EghQeoQ+fb/j/u/CdOohABflVwyAFgWEschTpj////4PP/j//8PTaqYKISBqNyCpQmSIyhFgbbaGKrM7LIU/PPgu/f49+uf+/rvcrOsH+1f0XeO+F1+vn7eJ3J4++PD752wc/f3zk9TgRAIbiLK8s09S406sl1J+NWMxZboyQHlCnQisJ/xIFU7BnHz+1/Chy6vpEKAAihj7OnaXFW9iCdodbEqj4tX9MGh/AWGnmK2w9mESmG7fCRLpHbGSPPTOFOPGXyHjO9MyE4M0OKLYFehV0mGwfEN2yhFkUIzb/+giG9NXPCOZ3y1PnstBsWUmnJe8V9KpqTJDfg/dVm04DhNSe9eN2I57fb5pu8LyYrZfZZXPBukAfEP7KFEDyYz1ywOmv9ZjeuY+Xj2dPGWfKhBUc/BxfP4WREABmMm5McGRMmBigD0yQWLsr0yHP3IVOnUMKcx3JZY15jnpS+ODWRlm5ot9kPaM8FMDFO+YBKh+BoYSC+hPQkELC+wYcuggKCpPb4n5zfH6fD1OAkADBNNgeQAOEiszR569qr4IU5MgD/////gP4A/J3abQVSjlkJAw24RAqTZULAxWaQE+P4bur9UHs+c652wvv/2+v7zsnaP9OPXNGeuu5P8+3o5P4++Y9esgHwEAxDmwgx5CfgOqO/P1nNAhdZn8rtJmvMmmt4Lx7LP1VLZsL7PLV/emqmcoad0IzRugDn8XcipvozXIp6YVK2YTqfx6bLdTK7bFEmC6KaHHLZeK5xYiRLhZoNJpxTMoPhCAuTVN7ZGShCEkqZaLxIDIUApbW+Ql0vmAJSOn4iItJL3d0YJSvnQ98tLdYHXqmI5BRwX6M2M6kyZdLyOWss9BUysS8w90lxHGSjvGvD4ZdWDZTzzjTKPIrgaGYQerCg1NYcTSc3MayZHdOA6sa0e7E2z0VePfEqRfRMX3wu0xYIZTJr/p9dq2TwvAAx8ieh7GynXaN+akjY1bLV4F0bp7VuE7Z+NAQUnhCDPN/0xCB+IQ4N/Acf0FDWyP1v3U+zIEZdAevWQgACALGPUUmurBoAYKOAhbA4AAAAAAASNhqDHQ1hMSEIYhIIiAiZ7DA55Gxit2Dxq4bFzBJi+trFJKijFmr1nrMK9R0lXrebQmmrDhm7l949+jvDFVAlNl0SotM2MiulRpk6q6ZxJFdmsHloNhmqJ7z7scLAYjgJicjGU/NDgTs0SMdG4kckjIKBffTWaYN+Ks21c+RJvtndIwVDhRNQqmN/gelZoWFDzEeFQrjQABTrC7dw+Mf3qNExO+ZO79kDFBQcVJFNlpE7QX4KhtJVXPGu2SDbriZLP5oKFUvg1HxmAGS1jR/gACHP2+6dCK0w7j7lnJ9uR5hx/iAmRF/3vqUlFapS6oqARQqyhrdSgW4AhDA/4AAAAAASNOgqGIqiEwCEgEfjWLNr5QbzDdsYx3xcM1QuVm0UkiSSg6TM6fDUmJn8EmjufBhJ0StQNYX2qgNL08ZlXeayKUAKZDnSBmUddTAVVWGeAJ4mimJoPiMVVmvdt/3LBvFSpF4akTRHqOQGV/AnqG3af0h8AJSWfvPRwE73ycPn5vR1rOMRiRdMVqqgdPy7pj5/x/PojYAATflWCOztV19UfOurwT18P0c7ww4bZL+6tiVgQr4AR0wEoYmNemG+AlVNAj/pRSuO7qKgigSgSgRcrNopJEklwIQwP////wAAEHTBeQ2EISGDCPgBYKYg3pW8nWy5VxsSeHEAe2GkypPGiNh+g31iX2VZPLnmw4LQth0WdQ9lurM/vhqAS1/29Hu37ALfBVi8sTolPHq9Hl+H89joAlz5KE5l85I5tzzmWeDknKkWdnptWBQHvt55cPNulQCFAIQAAEy74oouY0+5zmabAdchD3KECDFgR+a9S+N2c8MknMla3M1MiLlXGxL48QB4HkyeHAPXj4AAAA1Jtb292AAAAbG12aGQAAAAA5RNTWeUTU1kAAKxEAAAUzAABAAABAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAB5HRyYWsAAABcdGtoZAAAAAHlE1NZ5RNTWQAAAAEAAAAAAAAUzAAAAAAAAAAAAAAAAAEAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAYBtZGlhAAAAIG1kaGQAAAAA5RNTWeUTU1kAAKxEAAAgAFXEAAAAAAAxaGRscgAAAAAAAAAAc291bgAAAAAAAAAAAAAAAENvcmUgTWVkaWEgQXVkaW8AAAABJ21pbmYAAAAQc21oZAAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAAA63N0YmwAAABnc3RzZAAAAAAAAAABAAAAV21wNGEAAAAAAAAAAQAAAAAAAAAAAAIAEAAAAACsRAAAAAAAM2VzZHMAAAAAA4CAgCIAAAAEgICAFEAUABgAAAH0AAAB9AAFgICAAhIQBoCAgAECAAAAGHN0dHMAAAAAAAAAAQAAAAgAAAQAAAAAHHN0c2MAAAAAAAAAAQAAAAEAAAAIAAAAAQAAADRzdHN6AAAAAAAAAAAAAAAIAAAABgAAAWYAAAFkAAABhAAAAX8AAAECAAAA3wAAALUAAAAUc3RjbwAAAAAAAAABAAAALAAAAPp1ZHRhAAAA8m1ldGEAAAAAAAAAImhkbHIAAAAAAAAAAG1kaXIAAAAAAAAAAAAAAAAAAAAAAMRpbHN0AAAAvC0tLS0AAAAcbWVhbgAAAABjb20uYXBwbGUuaVR1bmVzAAAAFG5hbWUAAAAAaVR1blNNUEIAAACEZGF0YQAAAAEAAAAAIDAwMDAwMDAwIDAwMDAwODQwIDAwMDAwMEUxIDAwMDAwMDAwMDAwMDE2REYgMDAwMDAwMDAgMDAwMDAwMDAgMDAwMDAwMDAgMDAwMDAwMDAgMDAwMDAwMDAgMDAwMDAwMDAgMDAwMDAwMDAgMDAwMDAwMDA=",dO=""+new URL("flash-1UjQ_pjl.m4a",import.meta.url).href,fO=""+new URL("swoosh-DWLYYP2o.m4a",import.meta.url).href,K3=""+new URL("dice_whirr-D6_Xjgte.m4a",import.meta.url).href,cG=""+new URL("loss-MbFJ6Xyb.m4a",import.meta.url).href,lG=""+new URL("winner-C_feQyA8.m4a",import.meta.url).href,uG=""+new URL("win-BofsSXdy.m4a",import.meta.url).href,dG=""+new URL("ante_up-BNJNkzdg.m4a",import.meta.url).href,fG=""+new URL("push-D8ciTeGD.m4a",import.meta.url).href,pG=""+new URL("your_turn-r-y-lDUH.m4a",import.meta.url).href,hG=""+new URL("point_set-BYYb2H7O.m4a",import.meta.url).href,mG=""+new URL("place_hit-B397CGff.m4a",import.meta.url).href,gG=""+new URL("yes-D6HNwLBK.m4a",import.meta.url).href,yG=""+new URL("smashing-CDhgl1WN.m4a",import.meta.url).href,vG=""+new URL("love_you-ClILzZiq.m4a",import.meta.url).href,_G=""+new URL("gangster-BuThOTHu.m4a",import.meta.url).href,gd=typeof navigator<"u"&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1),Ic=typeof window<"u"?window.Capacitor:void 0,Nb=!!Ic&&typeof Ic.isNativePlatform=="function"&&Ic.isNativePlatform(),Fr=Ic&&(Ic.Plugins?.NativeAudio||Ic.NativeAudio)||void 0,Ep=Nb&&!!Fr,Tx=Nb&&gd,bG=Nb&&!gd;let Wo=!1,Kl=!0,Pm=null;const Cx=500;function kG(){return!!Kl}function pO(t){if(Kl=!!t,!Kl)try{D_()}catch{}}const wG=["vYes","vSmashing","vLove","vGangster"],Li={click:oG,flash:dO,chip:fO,win:lG,winDing:uG,lose:cG,push:fG,cardSwoosh:fO,placeBets:dG,yourTurn:pG,vYes:gG,vSmashing:yG,vLove:vG,vGangster:_G,pointSet:hG,placeHit:mG,betPlaced:dO},SG=["flash","win","winDing","lose","push","chip","cardSwoosh","placeBets","yourTurn","pointSet","vYes","vSmashing","vLove","vGangster","placeHit"],Y3=3,X3=4,J3=Tx?1:gd?2:8;let Uw=0,xx=!1;function Q3(){const t=performance.now();xx=Uw>0&&t-Uw>50,Uw=t,requestAnimationFrame(Q3)}typeof requestAnimationFrame<"u"&&requestAnimationFrame(Q3);const Z3={flash:40,cardSwoosh:80,chip:60,click:25,win:25,winDing:25,lose:25,push:25,placeBets:250,yourTurn:250,pointSet:250,placeHit:250,vYes:2500,vSmashing:2500,vLove:2500,vGangster:2500},A_={},Fc={};let Yl=0,eB=0;const Fw=new WeakMap;let qw=!1;const hO=[];function Am(t){hO.push(t),!qw&&(qw=!0,requestAnimationFrame(()=>{qw=!1;const e=hO.splice(0);for(const r of e)r()}))}const us=new Set,zw=new Map,Rm=new Map;function Xl(t){const e=Date.now(),r=Rm.get(t)||{count:0,last:0};r.count=Math.min(5,r.count+1),r.last=e,Rm.set(t,r)}function Ib(t){t?Rm.delete(t):Rm.clear()}function Mb(t){const e=Rm.get(t);if(!e)return!0;const r=Date.now(),n=2e3*Math.min(3,e.count);return r-e.last>n}function EG(t){try{const e=String(t||"");if(!e)return null;if(/^https?:\/\//i.test(e))return{path:e,isUrl:!0};if(/^data:/i.test(e))return null;if(/^file:\/\//i.test(e))return{path:e,isUrl:!0};if(/^capacitor:\/\//i.test(e)){const n=new URL(e).pathname||"";return n.startsWith("/assets/")?{path:`public${n}`,isUrl:!1}:n.startsWith("/public/")?{path:n.replace(/^\//,""),isUrl:!1}:{path:e,isUrl:!0}}return e.startsWith("./assets/")?{path:`public/${e.slice(2)}`,isUrl:!1}:e.startsWith("assets/")?{path:`public/${e}`,isUrl:!1}:e.startsWith("/assets/")?{path:`public${e}`,isUrl:!1}:e.startsWith("public/")?{path:e,isUrl:!1}:e.startsWith("/public/")?{path:e.slice(1),isUrl:!1}:{path:`public/${e.replace(/^\.\//,"")}`,isUrl:!1}}catch{return null}}async function jb(t,e){if(!Ep||!Fr)throw new Error("Native audio not available");if(us.has(t))return;const r=zw.get(t);if(r){if(await r,!us.has(t))throw new Error("Asset preload failed");return}try{const n=EG(e);if(!n)throw Xl(t),new Error("Failed to resolve asset path");const a=(async()=>{await Fr.preload({assetId:t,assetPath:n.path}),us.add(t)})();zw.set(t,a),await a.finally(()=>{zw.delete(t)})}catch(n){throw Xl(t),n}}async function TG(t,e,r){if(!Ep||!Fr)throw new Error("Native audio not available");if(!Mb(t))throw new Error("Native audio cooldown active");try{if(await jb(t,e),!us.has(t))throw new Error("Asset not loaded");if(r?.volume!=null&&Fr.setVolume)try{await Fr.setVolume({assetId:t,volume:Ka(r.volume,0,1)})}catch{}await Fr.play({assetId:t}),r?.durationMs&&r.durationMs>0&&window.setTimeout(()=>{try{Fr.stop({assetId:t})}catch{}},Math.max(10,Math.floor(r.durationMs)))}catch(n){throw Xl(t),n}}function Px(t){const e=new Audio(Li[t]);e.preload="auto";try{e.playsInline=!0}catch{}try{e.setAttribute("playsinline",""),e.setAttribute("webkit-playsinline","")}catch{}try{e.muted=!1}catch{}try{e.volume=1}catch{}return e.addEventListener("ended",()=>Mo(t,e)),e}function lu(t){let e=Fc[t];if(!e){const r=t==="flash"?X3:Y3;e={free:[],busy:new Set,size:0};for(let n=0;n<r;n++)e.free.push(Px(t)),e.size++;Fc[t]=e}return e}function Ax(t){const e=t==="flash"?X3:Y3,r=lu(t);if(r.free.length>0)return r.free.pop();if(r.size<e){const n=Px(t);return r.size++,n}return null}function Mo(t,e){const r=Fc[t];r&&r.busy.has(e)&&(r.busy.delete(e),r.free.push(e),Yl=Math.max(0,Yl-1))}function Rx(){Object.keys(Z3).forEach(t=>delete A_[t])}function CG(){try{us.clear(),Ib()}catch{}}function Lb(t,e=800){const r=Fw.get(t);if(r)return r;const n=new Promise(a=>{try{if(t.readyState>=2){a(!0);return}let i=!1;const o=()=>{try{t.removeEventListener("canplaythrough",c)}catch{}try{t.removeEventListener("loadeddata",c)}catch{}try{t.removeEventListener("error",u)}catch{}},c=()=>{i||(i=!0,o(),a(!0))},u=()=>{i||(i=!0,o(),a(!1))};t.addEventListener("canplaythrough",c,{once:!0}),t.addEventListener("loadeddata",c,{once:!0}),t.addEventListener("error",u,{once:!0});try{t.load()}catch{}window.setTimeout(()=>{i||(i=!0,o(),a(t.readyState>=2))},Math.max(200,Math.min(4e3,e)))}catch{a(!1)}});return Fw.set(t,n),n.finally(()=>{Fw.delete(t)}),n}let iv=null,Hn=null,Mc=null,R_=!1;function D_(){Object.keys(Fc).forEach(t=>{const e=Fc[t];e&&[...e.busy].forEach(r=>{try{r.pause(),r.currentTime=0}catch{}Mo(t,r)})});try{iv&&(iv.pause(),iv.currentTime=0)}catch{}try{Hn&&(Hn.pause(),Hn.currentTime=0)}catch{}iv=null,Hn=null;try{const t=Object.keys(Li);for(const e of t){const r=ap?.[e];if(r){try{r.pause(),r.currentTime=0}catch{}ap[e]=null}jc[e]&&(window.clearTimeout(jc[e]),delete jc[e])}if(Ep&&Fr){for(const e of Object.keys(Li))if(us.has(e)){try{wf(Fr.stop({assetId:e}))}catch{}try{Fr.unload&&wf(Fr.unload({assetId:e}))}catch{}try{us.delete(e)}catch{}}if(us.has("loop_dice_whirr")){try{wf(Fr.stop({assetId:"loop_dice_whirr"}))}catch{}try{Fr.unload&&wf(Fr.unload({assetId:"loop_dice_whirr"}))}catch{}try{us.delete("loop_dice_whirr"),Ib("loop_dice_whirr")}catch{}}R_=!1}}catch{}Yl=0,Rx()}let tB=!1;function am(t){tB=!!t}let mO=0;const xG=1500;async function PG(t,e){if(!Kl||tB)return!1;const r=Date.now();if(r-mO<xG)return!1;if(mO=r,Tx&&Fr&&Mb(t))try{return(async()=>{try{if(await jb(t,Li[t]),us.has(t)){if(Fr.setVolume)try{await Fr.setVolume({assetId:t,volume:Ka(e,0,1)})}catch{}await Fr.play({assetId:t})}}catch{Xl(t)}})(),!0}catch{Xl(t)}if(!Wo||gd&&xx)return!1;try{const n=Ax(t);if(!n){const i=new Audio(Li[t]);return i.volume=pi(t,e),i.play().catch(()=>{}),!0}return lu(t).busy.add(n),Yl++,n.currentTime=0,n.volume=pi(t,e),n.play().catch(()=>Mo(t,n)),!0}catch{return!1}}const AG={3:"vGangster",4:"vLove",5:"vSmashing",6:"vYes",7:"vSmashing"};async function gO(t,e=.5){const r=AG[t>=7?7:t];return r?PG(r,e):!1}function RG(t,e){if(!Kl||!Wo||Yl>=J3)return;const r=Ax(t);if(!r)return;lu(t).busy.add(r),Yl++;try{r.currentTime=0,e?.volume!=null&&(r.volume=pi(t,e.volume)),e?.rate!=null&&(r.playbackRate=Ka(e.rate,.25,4));const a=e?.durationMs&&e.durationMs>0?window.setTimeout(()=>{try{r.pause(),r.currentTime=0}catch{}Mo(t,r)},Math.max(10,Math.floor(e.durationMs))):null;Am(()=>{r.play().catch(()=>{a&&window.clearTimeout(a),Mo(t,r)})})}catch{Mo(t,r)}}async function gs(t,e){if(!Kl)return;const r=Date.now();if(r<eB||gd&&xx&&t!=="win"&&t!=="lose")return;const n=Z3[t]??0;if(n>0){const o=A_[t]??0;if(r-o<n)return}if(A_[t]=r,Tx&&Fr&&Mb(t)){(async()=>{try{await TG(t,Li[t],{volume:e?.volume,durationMs:e?.durationMs})}catch{Xl(t)}})();return}if(!Wo||Pm&&r-Pm<Cx)return;if(bG){RG(t,e);return}if(Yl>=J3)return;const a=Ax(t);if(!a)return;lu(t).busy.add(a),Yl++;try{a.currentTime=0,e?.volume!=null&&(a.volume=pi(t,e.volume)),e?.rate!=null&&(a.playbackRate=Ka(e.rate,.25,4));const o=e?.durationMs&&e.durationMs>0?window.setTimeout(()=>{try{a.pause(),a.currentTime=0}catch{}Mo(t,a)},Math.max(10,Math.floor(e.durationMs))):null;if(!await Lb(a,1e3)){Am(()=>{a.play().catch(()=>{o&&window.clearTimeout(o),Mo(t,a)})});return}Am(()=>{a.play().catch(()=>{o&&window.clearTimeout(o),Mo(t,a)})})}catch{Mo(t,a)}}const Ka=(t,e,r)=>Math.min(r,Math.max(e,t)),DG={flash:.025,cardSwoosh:.02,chip:.25,win:.4,winDing:.025,lose:.1,push:.1,placeBets:.65,yourTurn:.5,pointSet:.12,placeHit:.12,vYes:.45,vSmashing:.45,vLove:.45,vGangster:.45};function pi(t,e){const r=Ka(e,0,1);if(gd){const n=DG[t];if(typeof n=="number")return Ka(Math.max(r,n),0,1)}return r}function mT(){gd&&(Object.keys(Fc).forEach(t=>{const e=t,r=Fc[e];r&&r.free.forEach(n=>{try{n.pause(),n.src=Li[e],n.load()}catch{}})}),Rx())}function OG(){try{D_()}catch{}}function NG(){CG();try{mT()}catch{}Rx()}try{const t=Ic&&(Ic.Plugins?.App||Ic.App)||void 0;Nb&&t?.addListener&&t.addListener("appStateChange",e=>{!!(e&&e.isActive)?NG():OG()})}catch{}async function Xr(){if(!Wo){Wo=!0,Pm=Date.now(),eB=Date.now()+Cx,Object.keys(Li).forEach(t=>{try{lu(t)}catch{}});try{np()}catch{}try{if(Ep&&Fr){const t=SG;Promise.resolve().then(async()=>{for(const e of t)try{await jb(e,Li[e])}catch{}})}}catch{}}}function Dx(){return!!Wo}function np(t){const e=t&&t.length?t:Object.keys(Li);for(const r of e)lu(r).free.forEach(a=>{try{a.load()}catch{}})}async function O_(t,e=800){const r=t&&t.length?t:Object.keys(Li),n=i=>new Promise(o=>{try{const u=lu(i).free[0]||Px(i);Lb(u,e).then(o)}catch{o(!1)}});return(await Promise.all(r.map(n))).every(Boolean)}if(typeof document<"u"){const t=()=>{document.visibilityState==="hidden"?D_():mT()};document.addEventListener("visibilitychange",t),window.addEventListener("pagehide",()=>D_()),window.addEventListener("pageshow",()=>mT())}function IG(t){const r=Ka(t?.volume,0,1)*.5;gs("flash",{volume:pi("flash",r)})}function MG(t){gs("chip",{volume:pi("chip",t?.volume??.25),durationMs:t?.durationMs??500,rate:t?.playbackRate})}function jG(t){gs("cardSwoosh",{volume:pi("cardSwoosh",t?.volume),rate:t?.playbackRate??1})}function LG(t){gs("lose",{volume:pi("lose",t?.volume)})}function BG(t){gs("push",{volume:pi("push",t?.volume)})}function UG(t){const e=Ka(t?.volume,0,1),r=pi("win",e);gs("winDing",{volume:.025}),gs("win",{volume:pi("win",Ka(r*.35,0,1))})}function gT(t){gs("placeBets",{volume:pi("placeBets",t?.volume??.65)})}function yO(t){gs("pointSet",{volume:pi("pointSet",t?.volume??.15)})}function FG(t){gs("betPlaced",{volume:pi("betPlaced",t?.volume)})}function vO(t){const e=Ka(t?.sfxVolume??.15,0,1);gs("winDing",{volume:Ka(e*.25,0,1)})}async function rB(t,e=150){return new Promise(r=>{try{const a=Math.max(10,Math.floor(e/10));let i=0;const o=t.volume,c=window.setInterval(()=>{i++;const u=i/10;if(t.volume=Math.max(0,o*(1-u)),i>=10){window.clearInterval(c);try{t.pause(),t.currentTime=0}catch{}t.volume=o,r()}},a)}catch{try{t.pause(),t.currentTime=0}catch{}r()}})}function BSe(t){if(!Kl)return;const e=Ka(t?.volume,0,1),r=Ka(t?.playbackRate,.25,4);let n=!1;if(Ep&&Fr&&Mb("loop_dice_whirr")){try{jb("loop_dice_whirr",K3).then(async()=>{try{if(R_||(Fr.loop?await Fr.loop({assetId:"loop_dice_whirr"}):await Fr.play({assetId:"loop_dice_whirr"}),R_=!0),Fr.setVolume)try{await Fr.setVolume({assetId:"loop_dice_whirr",volume:e})}catch{}}catch{Xl("loop_dice_whirr"),$w(e,r)}}).catch(()=>{Xl("loop_dice_whirr"),$w(e,r)}),n=!0}catch{}if(n){try{Mc&&window.clearTimeout(Mc),Mc=window.setTimeout(()=>{try{Ox()}catch{}},8e3)}catch{}return}}Wo&&$w(e,r)}function $w(t,e){if(Wo)try{if(!Hn){Hn=new Audio(K3),Hn.loop=!0,Hn.preload="auto";try{Hn.playsInline=!0}catch{}Lb(Hn,800)}if(!Hn.paused){Hn.volume=t,Hn.playbackRate=e;return}Hn.volume=t,Hn.playbackRate=e,Hn.currentTime=0,Am(()=>{Hn&&Hn.play().catch(()=>{})}),Mc&&window.clearTimeout(Mc),Mc=window.setTimeout(()=>{try{Ox()}catch{}},8e3)}catch{}}function Ox(){if(Mc&&(window.clearTimeout(Mc),Mc=null),Ep&&Fr)try{try{wf(Fr.stop({assetId:"loop_dice_whirr"}))}catch{}try{Fr.unload&&wf(Fr.unload({assetId:"loop_dice_whirr"}))}catch{}try{us.delete("loop_dice_whirr"),Ib("loop_dice_whirr")}catch{}R_=!1}catch{}try{Hn&&rB(Hn,120)}catch{}}function wf(t){try{return t&&typeof t.then=="function"?t.catch(()=>{}):Promise.resolve()}catch{return Promise.resolve()}}const ap={},jc={};function qG(t,e){wG.includes(t)||gs(t,{volume:e?.volume,rate:e?.rate,durationMs:e?.durationMs})}function zG(t,e){if(!(!Kl||!Wo)&&!(Pm&&Date.now()-Pm<Cx))try{let r=ap[t];if(!r){r=new Audio(Li[t]),r.loop=!0,r.preload="auto";try{r.playsInline=!0}catch{}ap[t]=r,Lb(r,800)}const n=Ka(e?.volume??.1,0,1),a=Ka(e?.rate??1,.25,4);if(!r.paused){r.volume=n,r.playbackRate=a;return}r.volume=n,r.playbackRate=a,r.currentTime=0,Am(()=>{r.play().catch(()=>{})}),jc[t]&&window.clearTimeout(jc[t]);const i=Math.max(5e3,Math.min(6e4,e?.maxMs??15e3));jc[t]=window.setTimeout(()=>{try{nB(t)}catch{}},i)}catch{}}async function nB(t){try{jc[t]&&(window.clearTimeout(jc[t]),delete jc[t]);const e=ap[t];if(!e)return;await rB(e,120),ap[t]=null}catch{}}function $G(){try{Xr()}catch{}}async function VG(t,e){try{if(t==="__probe__")return Promise.resolve(!!Wo);const r=t;return r in Li?e?.loop?(zG(r,{volume:e.volume,rate:e.rate}),!0):(qG(r,{volume:e?.volume,rate:e?.rate}),!0):!1}catch{return!1}}function HG(t){try{np(t)}catch{}}function _O(t){try{const e=t;try{nB(e)}catch{}const r=Fc[e];if(r){try{[...r.busy].forEach(n=>{try{n.pause(),n.currentTime=0}catch{}})}catch{}delete Fc[e]}try{delete A_[e]}catch{}try{us.delete(e),Ib(e)}catch{}try{lu(e)}catch{}}catch{}}const Nl=[];function yT(t,e){try{Nl.push({event:t,ts:Date.now(),mode:e}),Nl.length>12&&Nl.shift()}catch{}}function Hv(){return[...Nl]}function im(t,e=2e3){return t.connected?Promise.resolve():(Hs(t),new Promise((r,n)=>{let a=!1;const i=()=>{a||(a=!0,u(),r())},o=f=>{a||(a=!0,u(),n(f??new Error("socket connect error")))},c=()=>{a||(a=!0,u(),n(new Error("socket connect timeout")))},u=()=>{try{t.off("connect",i)}catch{}try{t.off("connect_error",o)}catch{}clearTimeout(d)},d=setTimeout(c,Math.max(300,e));d.unref?.(),t.once("connect",i),t.once("connect_error",o)}))}async function vT(t,e,r,n){try{iB(e)}catch{}const a=n?.timeoutMs??15e3;try{await im(t)}catch(o){const c=String(o?.message||o||"");if(/socket has been disconnected|the socket is disconnected|connect_error|transport (?:close|error)|timeout/i.test(c)){try{Hs(t,"emit.ts:emitAck-ensureConnected-fallback")}catch{}await new Promise(u=>{const d=setTimeout(()=>u(),800);t.once("connect",()=>{clearTimeout(d),u()})})}else throw o}yT(e,"ack");const i=()=>new Promise((o,c)=>{t.timeout(a).emit(e,r,(u,d)=>u?c(u):d?o(d):c(new Error("No ack payload received")))});try{return await i()}catch(o){const c=String(o?.message||o||"");try{if(/operation has timed out|timeout/i.test(c)){const u=t?.io?.engine?.transport?.name,d=r?.roomId||null,f=Nl[Nl.length-1]?.event||"unknown";rp("socket_ack_timeout",{event:String(e),scope:String(e).includes("craps")?"craps":String(e).includes("poker")?"poker":"other",roomId:d,lastEvent:f,timeoutMs:a,connected:!!t.connected,transport:u||"unknown",phase:"initial"})}}catch{}if(/socket has been disconnected|the socket is disconnected/i.test(c)||/connect_error|transport close|transport error/i.test(c)){try{Hs(t,"emit.ts:emitAck-disconnect-retry")}catch{}try{await new Promise(u=>{const d=setTimeout(()=>u(),1e3);t.once("connect",()=>{clearTimeout(d),u()})})}catch{}try{return await i()}catch(u){const d=String(u?.message||u||"");try{if(/operation has timed out|timeout/i.test(d)){const f=t?.io?.engine?.transport?.name,h=r?.roomId||null,m=Nl[Nl.length-1]?.event||"unknown";rp("socket_ack_timeout",{event:String(e),scope:String(e).includes("craps")?"craps":String(e).includes("poker")?"poker":"other",roomId:h,lastEvent:m,timeoutMs:a,connected:!!t.connected,transport:f||"unknown",phase:"retry"})}}catch{}throw u}}throw o}}async function aB(t,e,r){try{iB(e)}catch{}try{await im(t),yT(e,"ff"),t.emit(e,r)}catch(n){const a=String(n?.message||n||"");if(/socket has been disconnected|the socket is disconnected|connect_error|transport (?:close|error)/i.test(a)){try{Hs(t,"emit.ts:emitFF-fallback")}catch{}await new Promise(i=>{const o=setTimeout(()=>i(),800);t.once("connect",()=>{clearTimeout(o),i()})}),yT(e,"ff"),t.emit(e,r);return}throw n}}function iB(t){new Set([St.ROLL_DICE,St.PLACE_MAIN_BET,St.CREATE_SIDE_BET,St.ACCEPT_SIDE_BET,St.CANCEL_SIDE_BET,St.POKER_ACT,"poker:start_hand","craps:roll"]).has(t)&&Xr()}const sB=ci();async function GG(t,e,r="usd"){return await(await fetch(`${sB}/api/payment/chips`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({amount:t,userId:e,currency:r})})).json()}async function WG(t,e){return await(await fetch(`${sB}/api/payment/membership`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({planId:t,userId:e})})).json()}const bO={createChipsCheckout:GG,createMembershipCheckout:WG},oB=v.createContext(void 0),KG=({children:t})=>{const[e,r]=v.useState("idle"),[n,a]=v.useState(null),[i,o]=v.useState(!1),[c,u]=v.useState(!1),d=v.useCallback(async(h,m,_="usd")=>{r("loading"),a(null);try{const w=await bO.createChipsCheckout(h,m,_);return w.url?(r("success"),w.url):(r("error"),a(w.error||"Unable to start chips checkout"),null)}catch(w){return r("error"),a(w.message||"Unable to start chips checkout"),null}},[]),f=v.useCallback(async(h,m)=>{r("loading"),a(null);try{const _=await bO.createMembershipCheckout(h,m);return _.url?(r("success"),_.url):(r("error"),a(_.error||"Unable to start membership checkout"),null)}catch(_){return r("error"),a(_.message||"Unable to start membership checkout"),null}},[]);return g.jsx(oB.Provider,{value:{status:e,error:n,startChipsCheckout:d,startMembershipCheckout:f,setStatus:r,setError:a,membershipModalOpen:i,setMembershipModalOpen:o,chipsModalOpen:c,setChipsModalOpen:u},children:t})};function Bb(){const t=v.useContext(oB);return t||{status:"idle",error:null,startChipsCheckout:async()=>null,startMembershipCheckout:async()=>null,setStatus:()=>{},setError:()=>{},membershipModalOpen:!1,setMembershipModalOpen:()=>{},chipsModalOpen:!1,setChipsModalOpen:()=>{}}}function Ri(){const t=typeof globalThis<"u"?globalThis.crypto:void 0;try{if(t&&typeof t.randomUUID=="function")return t.randomUUID()}catch{}try{if(t&&typeof t.getRandomValues=="function"){const c=new Uint8Array(16);t.getRandomValues(c),c[6]=c[6]&15|64,c[8]=c[8]&63|128;const u=Array.from(c,d=>d.toString(16).padStart(2,"0")).join("");return`${u.slice(0,8)}-${u.slice(8,12)}-${u.slice(12,16)}-${u.slice(16,20)}-${u.slice(20)}`}}catch{}const e=()=>Math.floor(Math.random()*4294967295).toString(16).padStart(8,"0"),r=e(),n=e().slice(0,4),a=("4"+e()).slice(0,4),i=((8+Math.floor(Math.random()*4)).toString(16)+e()).slice(0,4),o=(e()+e()).slice(0,12);return`${r}-${n}-${a}-${i}-${o}`}function YG(t,e){const r=v.useCallback(async()=>{if(!t)throw new Error("Socket unavailable");if(t.connected)return t;try{!t.active&&t.disconnected&&Hs(t,"useEmitter.ensureConnected"),await new Promise(i=>{const o=setTimeout(()=>i(),4e3);t.once("connect",()=>{clearTimeout(o),i()})})}catch{}return t},[t]),n=v.useCallback(async(i,o,c)=>{const u=await r();let d=o;if(o&&typeof o=="object"&&!o.eventId)try{d={...o,eventId:Ri()}}catch{}const f={room_create:3e4,poker_room_create:3e4},h=c?.timeoutMs||15e3,m=i in f?f[i]:h,_={...c,timeoutMs:m},w=async()=>vT(u,i,d,_);let b,E=0;const T=2,D=async()=>{try{return await w()}catch(P){const A=String(P?.message||P||""),C=/socket connect timeout/i.test(A)||/ETIMEDOUT/i.test(A)||/timeout/i.test(A),O=/socket has been disconnected/i.test(A)||/the socket is disconnected/i.test(A);if((C||O||/connect_error|transport close|transport error/i.test(A))&&E<T){E++;const N=(/create/i.test(i)?1500:800)*Math.pow(2,E-1);try{t&&t.disconnected&&Hs(t,"useSocketEmitters:backoff-retry"),await new Promise(L=>{const j=setTimeout(()=>L(),N);t?.once("connect",()=>{clearTimeout(j),L()})})}catch{}return D()}else throw P}};b=await D();try{if(b&&b.ok===!1&&(b.error==="rate_limited"||/rate[_-]?limited/i.test(b.error||"")))try{e&&e(String(i))}catch{}}catch{}return b},[r,e]),a=v.useCallback(async(i,o)=>{const c=await r();return aB(c,i,o)},[r]);return{ack:n,send:a}}function pa(){const t=ks(),{info:e}=cu(),r=v.useRef(0),n=v.useCallback(z=>{const ee=Date.now();if(!(ee-r.current<1200)){r.current=ee;try{e("Please wait a moment - you're doing that too quickly.",{duration:2500})}catch{}}},[e]),{ack:a,send:i}=YG(t,n),{setMembershipModalOpen:o}=Bb(),{user:c}=$r(),u=v.useCallback(z=>{const ee=(()=>{const se={};try{se.name=String(z.name||"").trim().slice(0,60),(z.isPrivate===!0||z.isPrivate===!1)&&(se.isPrivate=!!z.isPrivate),(z.singlePlayer===!0||z.singlePlayer===!1)&&(se.singlePlayer=!!z.singlePlayer),typeof z.botsPerRoom=="number"&&Number.isInteger(z.botsPerRoom)&&(se.botsPerRoom=z.botsPerRoom),(z.gameMode==="cee-lo"||z.gameMode==="craps")&&(se.gameMode=z.gameMode)}catch{}return se})();return a(St.CREATE_ROOM,ee).then(se=>{try{se&&se.ok}catch{}return se})},[a,o,c]),d=v.useCallback(async z=>{const ee=async()=>a(St.JOIN_ROOM,{roomId:z});let se=await ee();if(se&&se.ok===!1&&/Room not found/i.test(String(se.error||""))){try{await new Promise(Oe=>setTimeout(Oe,120))}catch{}se=await ee(),se&&se.ok}if(se&&se.ok===!1&&se.error===q7.SOCKET.NEEDS_PREMIUM)try{o(!0)}catch{}return se},[a,o]),f=v.useCallback(z=>a(St.LEAVE_ROOM,{roomId:z}),[a]),h=v.useCallback(z=>i(St.LEAVE_ROOM,{roomId:z}),[i]),m=v.useCallback(z=>a(St.ROLL_DICE,{roomId:z}),[a]),_=v.useCallback(z=>a(St.CONFIRM_BETS,{roomId:z}),[a]),w=v.useCallback((z,ee)=>a(St.CRAPS_PLACE_PASS,{roomId:z,amount:ee}),[a]);v.useCallback((z,ee)=>a(St.CRAPS_PLACE_DONT_PASS,{roomId:z,amount:ee}),[a]);const b=v.useCallback((z,ee,se)=>a(St.CRAPS_PLACE_ODDS,{roomId:z,amount:ee,passType:se}),[a]),E=v.useCallback((z,ee,se)=>a(St.CRAPS_PLACE_PLACE,{roomId:z,amount:ee,point:se}),[a]),T=v.useCallback((z,ee)=>a(St.CRAPS_PLACE_FIELD,{roomId:z,amount:ee}),[a]),D=v.useCallback((z,ee,se)=>a(St.CRAPS_PLACE_BIG,{roomId:z,amount:ee,kind:se}),[a]),P=v.useCallback((z,ee)=>a(St.CRAPS_PLACE_COME,{roomId:z,amount:ee}),[a]),A=v.useCallback((z,ee)=>a(St.CRAPS_PLACE_DONT_COME,{roomId:z,amount:ee}),[a]),C=v.useCallback((z,ee,se)=>a(St.CRAPS_PLACE_COME_ODDS,{roomId:z,point:ee,amount:se}),[a]),O=v.useCallback((z,ee,se)=>a(St.CRAPS_PLACE_DONT_COME_ODDS,{roomId:z,point:ee,amount:se}),[a]),I=v.useCallback((z,ee)=>a(St.CRAPS_TOGGLE_PLACE_WORKING,{roomId:z,working:ee}),[a]),x=v.useCallback(async z=>{try{const ee=Y.current.get(z)||[],se=Q.current.get(z);if(se&&(clearTimeout(se),Q.current.delete(z)),ee.length>0)if(Y.current.delete(z),ee.length>1)await a("craps:add_bets_batch",{roomId:z,bets:ee,eventId:Ri()});else{const{type:Oe,amount:wt}=ee[0];await a("craps:add_bet",{roomId:z,type:Oe,amount:wt,eventId:Ri()})}}catch{}try{const ee=G.current.get(z)||[],se=B.current.get(z);if(se&&(clearTimeout(se),B.current.delete(z)),ee.length>0)if(G.current.delete(z),ee.length>1)await a("craps:remove_bets_batch",{roomId:z,bets:ee,eventId:Ri()});else{const{type:Oe,amount:wt}=ee[0];await a("craps:remove_bet",{roomId:z,type:Oe,amount:wt,eventId:Ri()})}}catch{}},[a]),R=v.useCallback(async z=>{try{if(!z)return{ok:!1,error:"no_room"}}catch{}try{await x(z)}catch{}return a(St.CRAPS_ROLL,{roomId:z})},[a,x]),N=v.useCallback(z=>a(St.CRAPS_READY,{roomId:z}),[a]),L=v.useCallback((z,ee)=>a(St.CRAPS_FETCH_HISTORY,{roomId:z,...ee||{}}),[a]),j=v.useCallback(z=>a("craps:get_state",{roomId:z}),[a]),q=v.useCallback(z=>a("craps:join_order",{roomId:z}),[a]),U=v.useCallback(z=>a("craps:leave_order",{roomId:z}),[a]),W=v.useCallback((z,ee)=>a("craps:set_order",{roomId:z,order:ee}),[a]),F=v.useCallback(z=>a("craps:reset_shooter",{roomId:z}),[a]),Y=v.useRef(new Map),Q=v.useRef(new Map),ie=1e3,G=v.useRef(new Map),B=v.useRef(new Map),K=1e3,ae=v.useCallback(z=>a("craps:list_bets",{roomId:z,eventId:Ri()}),[a]),te=v.useCallback((z,ee,se)=>{const Oe=Y.current.get(z)||[];Oe.push({type:ee,amount:se}),Y.current.set(z,Oe);const wt=Q.current.get(z);wt&&clearTimeout(wt);const er=setTimeout(()=>{const Qt=Y.current.get(z)||[];if(Qt.length!==0)if(Y.current.delete(z),Q.current.delete(z),Qt.length>1)a("craps:add_bets_batch",{roomId:z,bets:Qt,eventId:Ri()});else{const{type:Zt,amount:oa}=Qt[0];a("craps:add_bet",{roomId:z,type:Zt,amount:oa,eventId:Ri()})}},ie);return Q.current.set(z,er),Promise.resolve({ok:!0})},[a]),me=v.useCallback((z,ee)=>a("craps:add_bets_batch",{roomId:z,bets:ee,eventId:Ri()}),[a]),ue=v.useCallback((z,ee)=>a("craps:remove_bets_batch",{roomId:z,bets:ee,eventId:Ri()}),[a]),Ae=v.useCallback((z,ee,se)=>{const Oe=G.current.get(z)||[];Oe.push({type:ee,amount:se}),G.current.set(z,Oe);const wt=B.current.get(z);wt&&clearTimeout(wt);const er=setTimeout(()=>{const Qt=G.current.get(z)||[];if(Qt.length!==0)if(G.current.delete(z),B.current.delete(z),Qt.length>1)a("craps:remove_bets_batch",{roomId:z,bets:Qt,eventId:Ri()});else{const{type:Zt,amount:oa}=Qt[0];a("craps:remove_bet",{roomId:z,type:Zt,amount:oa,eventId:Ri()})}},K);return B.current.set(z,er),Promise.resolve({ok:!0})},[a]),He=v.useCallback(z=>a("craps:clear_bets",{roomId:z,eventId:Ri()}),[a]),ce=v.useCallback(z=>a("craps:summarize",{roomId:z}),[a]),xe=v.useCallback(z=>a(St.BANKER_GIVE_UP,{roomId:z}),[a]),re=v.useCallback(async()=>{const z=async()=>a(St.GET_ROOMS_LIST,{});let ee=await z();return ee&&ee.ok===!1&&ee.error==="invalid_payload"&&(await new Promise(se=>setTimeout(se,80)),ee=await z()),ee},[a]),H=v.useCallback((z,ee)=>a(St.SPECTATE_SET,{roomId:z,spectate:ee}),[a]),he=v.useCallback(async(z,ee)=>{const se=await a(St.PLACE_MAIN_BET,{roomId:z,amount:ee});try{rp("bet_place",{game:"cee-lo",type:"MAIN",amount:ee})}catch{}return se},[a]),Re=v.useCallback((z,ee)=>a(St.CANCEL_MAIN_BET,{roomId:z,wagerId:ee}),[a]),fe=v.useCallback((z,ee)=>a(St.CREATE_SIDE_BET,{roomId:z,...ee}),[a]),Ie=v.useCallback((z,ee)=>a(St.ACCEPT_SIDE_BET,{roomId:z,wagerId:ee}),[a]),ct=v.useCallback((z,ee)=>a(St.CANCEL_SIDE_BET,{roomId:z,wagerId:ee}),[a]),$e=v.useCallback(async z=>{if(!z)return{ok:!1,error:"no_room"};const ee={roomId:z},se=await a(St.GET_WAGERS,ee);return se&&se.ok,se},[a]),rt=v.useCallback(z=>a(St.RTC_JOIN,{roomId:z}),[a]),We=v.useCallback(z=>{try{t?.volatile?.emit?.(St.RTC_LEAVE,{roomId:z})}catch{}},[t]),it=v.useCallback(async(z,ee,se)=>{try{await i(St.RTC_SIGNAL,{roomId:z,toPeerId:ee,payload:se})}catch(Oe){const wt=String(Oe?.message||Oe||"");if(/disconnect|timeout|transport/i.test(wt)){await new Promise(er=>setTimeout(er,200));try{await i(St.RTC_SIGNAL,{roomId:z,toPeerId:ee,payload:se})}catch{}}}},[i]),Et=v.useCallback((z,ee)=>a(St.RTC_SET_CAMERA_OWNER,{roomId:z,ownerId:ee}),[a]),Mt=v.useCallback(async(z,ee)=>{try{if(!z)return{ok:!1,error:"no_room"};const se=await a(St.RTC_SET_VIDEO_ENABLED,{roomId:z,enabled:ee});return se.ok,se}catch{}},[a,o]),_t=v.useCallback((z,ee)=>a(St.ROOM_SEND_MESSAGE,{roomId:z,text:ee}),[a]),ge=v.useCallback((z,ee)=>a(St.ROOM_FETCH_HISTORY,{roomId:z,sinceTs:ee}),[a]),Be=v.useCallback((z,ee)=>a(St.DM_SEND_MESSAGE,{toUserId:z,text:ee}),[a]),je=v.useCallback((z,ee)=>a(St.DM_FETCH_HISTORY,{peerUserId:z,sinceTs:ee}),[a]),nt=v.useCallback(()=>a(St.LOBBY_JOIN,{}),[a]),Ct=v.useCallback(()=>i(St.LOBBY_LEAVE,{}),[i]),jt=v.useCallback(()=>a(St.LOBBY_LIST,{}),[a]),De=v.useCallback(z=>a(St.DELETE_ROOM,{roomId:z}),[a]),et=v.useCallback(()=>a(St.USER_GET_BALANCE,void 0),[a]),at=v.useCallback((z,ee)=>a(St.SEND_FRIEND_REQUEST,{toUserId:z,message:ee}),[a]),we=v.useCallback(z=>a(St.CANCEL_FRIEND_REQUEST,{requestId:z}),[a]),st=v.useCallback((z,ee)=>a(St.RESPOND_FRIEND_REQUEST,{requestId:z,action:ee}),[a]),bt=v.useCallback(z=>a(St.UNFRIEND,{otherId:z}),[a]),nr=v.useCallback(z=>a(St.BLOCK_USER,{blockedId:z}),[a]),ur=v.useCallback(z=>a(St.UNBLOCK_USER,{blockedId:z}),[a]),dr=v.useCallback(()=>a(St.SOCIAL_GET_LIST,void 0),[a]),Sr=v.useCallback((z,ee,se)=>a(St.GAME_INVITE_SEND,{roomId:z,toUserId:ee,gameMode:se}),[a]),un=v.useCallback((z,ee)=>a(St.GAME_INVITE_RESPOND,{inviteId:z,action:ee}),[a]),Z=v.useCallback(z=>a(St.USER_UPDATE_PROFILE,z),[a]),X=v.useCallback(z=>a(St.BOTS_NUDGE,{roomId:z??null}),[a]),le=v.useCallback(z=>a(St.ROOM_REFRESH_STATE,{roomId:z??null}),[a]),be=v.useCallback((z,ee)=>i("player:visibility",{roomId:z,visible:ee}),[i]);return{createRoom:u,joinRoom:d,leaveRoom:f,leaveRoomTearDown:h,getRoomsList:re,setSpectate:H,bankerGiveUp:xe,pokerCreateRoom:v.useCallback(z=>{const ee={...z};let se=ee.maxPlayers;if((typeof se!="number"||!Number.isInteger(se)||se<1||se>4)&&(se=ee.singlePlayer?1:4),ee.maxPlayers=se,typeof ee.startingStack=="number"){const Oe=Math.max(1,Math.min(1e6,Math.floor(ee.startingStack)));ee.startingStack=Oe}return a(St.POKER_ROOM_CREATE,ee)},[a,c,o]),pokerDeleteRoom:v.useCallback(z=>a(St.POKER_ROOM_DELETE,{roomId:z}),[a]),pokerJoinRoom:v.useCallback(async z=>a(St.POKER_JOIN_ROOM,{roomId:z}),[a]),pokerStartHand:v.useCallback(z=>a(St.POKER_START_HAND,{roomId:z}),[a]),pokerFold:v.useCallback(z=>a(St.POKER_ACT,{roomId:z,action:"fold"}),[a]),pokerCheck:v.useCallback(z=>a(St.POKER_ACT,{roomId:z,action:"check"}),[a]),pokerCall:v.useCallback(z=>a(St.POKER_ACT,{roomId:z,action:"call"}),[a]),pokerBet:v.useCallback((z,ee)=>a(St.POKER_ACT,{roomId:z,action:"bet",amount:ee}),[a]),pokerRaise:v.useCallback((z,ee)=>a(St.POKER_ACT,{roomId:z,action:"raise",amount:ee}),[a]),pokerFetchHistory:v.useCallback((z,ee,se)=>a(St.POKER_FETCH_HISTORY,{roomId:z,limit:ee,beforeSeq:se}),[a]),rollDice:m,confirmBets:_,crapsPlacePass:w,crapsRoll:R,crapsPlaceOdds:b,crapsPlacePlace:E,crapsPlaceField:T,crapsPlaceBig:D,crapsPlaceCome:P,crapsPlaceDontCome:A,crapsPlaceComeOdds:C,crapsPlaceDontComeOdds:O,crapsTogglePlaceWorking:I,crapsReady:N,crapsFetchHistory:L,crapsGetState:j,crapsJoinOrder:q,crapsLeaveOrder:U,crapsSetOrder:W,crapsResetShooter:F,crapsListBets:ae,crapsAddBet:te,crapsBatchAddBets:me,crapsRemoveBet:Ae,crapsBatchRemoveBets:ue,crapsClearBets:He,crapsSummarizeBets:ce,placeMainBet:he,cancelMainBet:Re,createSideBet:fe,acceptSideBet:Ie,cancelSideBet:ct,getWagers:$e,rtcJoin:rt,rtcLeave:We,rtcSignal:it,rtcSetCameraOwner:Et,rtcSetVideoEnabled:Mt,roomSendMessage:_t,roomFetchHistory:ge,dmSendMessage:Be,dmFetchHistory:je,lobbyJoin:nt,lobbyLeave:Ct,lobbyList:jt,deleteRoom:De,getUserBalance:et,sendFriendRequest:at,cancelFriendRequest:we,respondFriendRequest:st,unfriend:bt,blockUser:nr,unblockUser:ur,getFriendsList:dr,sendGameInvite:Sr,respondGameInvite:un,updateProfile:Z,botsNudge:X,refreshRoomState:le,sendVisibilityChange:be}}const Fe={FAIRNESS_REVEAL:"fairness_reveal",GET_ROOMS_LIST:"get_rooms_list",LOBBY_ROOMS:"lobby_rooms",ROOM_CREATED:"room_created",ROOM_UPDATED:"room_updated",ROOM_DELETED:"room_deleted",JOINED_ROOM:"joined_room",REJOINED_ROOM:"rejoined_room",OTHER_JOINED:"other_player_joined_room",OTHER_LEFT:"other_player_left_room",BANKER_CHANGED:"banker_changed",DICE_ROLLED:"dice_rolled",NOT_YOUR_TURN:"not_your_turn",BETS_UPDATED:"bets_updated",GET_WAGERS:"get_wagers",PLAYER_BALANCE_UPDATED:"player_balance_updated",SIDE_BET_CREATED:"side_bet_created",SIDE_BET_ACCEPTED:"side_bet_accepted",SIDE_BET_CANCELED:"side_bet_canceled",FORCE_LOGOUT:"force_logout",ERROR:"error",RTC_SIGNAL:"rtc_signal",RTC_PEER_JOINED:"rtc_peer_joined",RTC_PEER_LEFT:"rtc_peer_left",RTC_CAMERA_OWNER_CHANGED:"rtc_camera_owner_changed",RTC_VIDEO_ENABLED:"rtc_video_enabled",ROOM_MESSAGE:"room_message",ROOM_HISTORY:"room_history",DM_MESSAGE:"dm_message",DM_HISTORY:"dm_history",FRIEND_REQUEST_RECEIVED:"friend_request_received",FRIEND_REQUEST_CANCELLED:"friend_request_cancelled",FRIEND_REQUEST_RESPONDED:"friend_request_responded",UNFRIENDED:"unfriended",USER_BLOCKED:"user_blocked",USER_UNBLOCKED:"user_unblocked",TURN_ORDER_UPDATED:"turn_order_updated",SPECTATORS_UPDATED:"spectators_updated",PLAYER_PROFILE_UPDATED:"player_profile_updated",CRAPS_ROLL:"craps:roll",CRAPS_READY_UPDATE:"craps:ready_update",CRAPS_BETS_UPDATE:"craps:bets_update",CRAPS_BET_DELTA:"craps:bet_delta",CRAPS_STATE:"craps:state",CRAPS_BET_RESULTS:"craps:bet_results",CRAPS_BET_ERROR:"craps:bet_error",CRAPS_POINT_SET:"craps:point_set",CRAPS_POINT_MADE:"craps:point_made",CRAPS_ATS_PROGRESS:"craps:ats_progress",CRAPS_ATS_SMALL_COMPLETE:"craps:ats_small_complete",CRAPS_ATS_TALL_COMPLETE:"craps:ats_tall_complete",CRAPS_ATS_ALL_COMPLETE:"craps:ats_all_complete",CRAPS_ATS_RESET:"craps:ats_reset",POKER_MY_HOLE:"poker:my_hole",POKER_WINNERS:"poker:winners",POKER_REVEAL_ALL:"poker:reveal_all",POKER_TIMED_OUT:"poker:timed_out",POKER_ROOM_CREATED:"poker_room_created",POKER_ROOM_UPDATED:"poker_room_updated",POKER_ROOM_DELETED:"poker_room_deleted",POKER_OTHER_JOINED:"poker_other_joined_room",POKER_JOINED_ROOM:"poker_joined_room",ROOM_UPDATE_STATE:"room:update_state",OTA_UPDATE_AVAILABLE:"ota:update_available",GAME_INVITE_RECEIVED:"game_invite:received",PLAYER_PRESENCE_UPDATE:"player:presence_update"};function Pa(t){const e=ks(),r=v.useRef(t);v.useEffect(()=>{r.current=t},[t]),v.useEffect(()=>{if(typeof window>"u"||!(window.location?.search?.includes("e2e=1")||window.__E2E===!0||typeof window.sessionStorage<"u"&&window.sessionStorage.getItem("e2e")==="1"))return;const a=window;a.__crapsHandlersBus||(a.__crapsHandlersBus={onCrapsRollResult:new Set,onCrapsBetResults:new Set,onCrapsPointSet:new Set,onCrapsPointMade:new Set,_buffer:{onCrapsRollResult:[],onCrapsBetResults:[],onCrapsPointSet:[],onCrapsPointMade:[],push(c,u){const d=this[c];d.push(u),d.length>20&&d.shift()}}}),(()=>{const c=a.__crapsHandlers||{};c&&c.__wrappedByBus||(a.__crapsHandlers={onCrapsRollResult:u=>{try{a.__crapsHandlersBus._buffer.push("onCrapsRollResult",u)}catch{}a.__crapsHandlersBus.onCrapsRollResult.forEach(d=>{try{d(u)}catch{}});try{const d=a.__flashTest;(a.__E2E===!0||a.location?.search?.includes("e2e=1")||a.sessionStorage&&a.sessionStorage.getItem("e2e")==="1")&&d&&d.info}catch{}try{typeof c.onCrapsRollResult=="function"&&c.onCrapsRollResult(u)}catch{}},onCrapsBetResults:u=>{try{a.__crapsHandlersBus._buffer.push("onCrapsBetResults",u)}catch{}a.__crapsHandlersBus.onCrapsBetResults.forEach(d=>{try{d(u)}catch{}});try{const d=a.__flashTest;if(!(!(a.__E2E===!0||a.location?.search?.includes("e2e=1")||a.sessionStorage&&a.sessionStorage.getItem("e2e")==="1")||!d)){const h=Array.isArray(u?.settlements)?u.settlements:[],m=h.filter(b=>typeof b?.betType=="string"&&b.betType.startsWith("place")&&b.outcome==="WIN"),_=h.filter(b=>(b.betType==="pass"||b.betType==="dontPass")&&b.outcome==="WIN"),w=h.filter(b=>(b.betType==="pass"||b.betType==="dontPass")&&b.outcome==="LOSE");if(m.length>0&&typeof d.win=="function"){const b=m.reduce((E,T)=>E+(Number(T.payout)||0),0);d.win(m.length>1?"Place Wins":"Place Win",b?`+${b}`:void 0)}else if(_.length>0&&typeof d.win=="function"){const b=_.reduce((E,T)=>E+(Number(T.payout)||0)+(Number(T.amount)||0),0);d.win("Line Win",b?`+${b}`:void 0)}else if(w.length>0&&typeof d.lose=="function"){const b=w.reduce((E,T)=>E+(Number(T.amount)||0),0);d.lose("Line Lose",b?`-${b}`:void 0)}}}catch{}try{typeof c.onCrapsBetResults=="function"&&c.onCrapsBetResults(u)}catch{}},onCrapsPointSet:u=>{try{a.__crapsHandlersBus._buffer.push("onCrapsPointSet",u)}catch{}a.__crapsHandlersBus.onCrapsPointSet.forEach(d=>{try{d(u)}catch{}});try{const d=a.__flashTest;if((a.__E2E===!0||a.location?.search?.includes("e2e=1")||a.sessionStorage&&a.sessionStorage.getItem("e2e")==="1")&&d&&typeof d.info=="function"){const h=u&&(u.point??u?.state?.point);d.info("Point Set",h?`${h} is the point`:void 0)}}catch{}try{typeof c.onCrapsPointSet=="function"&&c.onCrapsPointSet(u)}catch{}},onCrapsPointMade:u=>{try{a.__crapsHandlersBus._buffer.push("onCrapsPointMade",u)}catch{}a.__crapsHandlersBus.onCrapsPointMade.forEach(d=>{try{d(u)}catch{}});try{const d=a.__flashTest;if((a.__E2E===!0||a.location?.search?.includes("e2e=1")||a.sessionStorage&&a.sessionStorage.getItem("e2e")==="1")&&d&&typeof d.win=="function"){const h=u&&(u.point??u?.state?.point);d.win("Point Made",h?`${h} hit`:void 0)}}catch{}try{typeof c.onCrapsPointMade=="function"&&c.onCrapsPointMade(u)}catch{}},__wrappedByBus:!0})})();const o={onCrapsRollResult:c=>r.current.onCrapsRollResult?.(c),onCrapsBetResults:c=>r.current.onCrapsBetResults?.(c),onCrapsPointSet:c=>r.current.onCrapsPointSet?.(c),onCrapsPointMade:c=>r.current.onCrapsPointMade?.(c)};a.__crapsHandlersBus.onCrapsRollResult.add(o.onCrapsRollResult),a.__crapsHandlersBus.onCrapsBetResults.add(o.onCrapsBetResults),a.__crapsHandlersBus.onCrapsPointSet.add(o.onCrapsPointSet),a.__crapsHandlersBus.onCrapsPointMade.add(o.onCrapsPointMade);try{const c=a.__crapsHandlersBus._buffer;if(c){for(const u of c.onCrapsRollResult)try{o.onCrapsRollResult(u)}catch{}for(const u of c.onCrapsBetResults)try{o.onCrapsBetResults(u)}catch{}for(const u of c.onCrapsPointSet)try{o.onCrapsPointSet(u)}catch{}for(const u of c.onCrapsPointMade)try{o.onCrapsPointMade(u)}catch{}}}catch{}return()=>{try{a.__crapsHandlersBus.onCrapsRollResult.delete(o.onCrapsRollResult),a.__crapsHandlersBus.onCrapsBetResults.delete(o.onCrapsBetResults),a.__crapsHandlersBus.onCrapsPointSet.delete(o.onCrapsPointSet),a.__crapsHandlersBus.onCrapsPointMade.delete(o.onCrapsPointMade)}catch{}}},[]),v.useEffect(()=>{if(!e)return;const n=ge=>r.current.onLobbyRooms?.(ge),a=ge=>r.current.onRoomCreated?.(ge),i=ge=>r.current.onRoomUpdated?.(ge),o=ge=>r.current.onRoomDeleted?.(ge),c=ge=>r.current.onJoinedRoom?.(ge),u=ge=>r.current.onRejoinedRoom?.(ge),d=ge=>{r.current.onOtherPlayerJoined?.(ge)},f=ge=>{r.current.onOtherLeft?.(ge)},h=ge=>r.current.onBankerChanged?.(ge),m=ge=>r.current.onDiceRolled?.(ge),_=()=>r.current.onNotYourTurn?.(),w=ge=>r.current.onOtaUpdateAvailable?.(ge),b=ge=>r.current.onBetsUpdated?.(ge),E=ge=>r.current.onGetWagers?.(ge),T=ge=>r.current.onPlayerBalanceUpdated?.(ge),D=ge=>r.current.onSideBetCreated?.(ge),P=ge=>r.current.onSideBetAccepted?.(ge),A=ge=>r.current.onSideBetCanceled?.(ge),C=ge=>r.current.onForceLogout?.(ge),O=ge=>r.current.onError?.(ge),I=ge=>r.current.onRtcSignal?.(ge),x=ge=>r.current.onRtcPeerJoined?.(ge),R=ge=>r.current.onRtcPeerLeft?.(ge),N=ge=>r.current.onRtcCameraOwnerChanged?.(ge),L=ge=>r.current.onRtcVideoEnabled?.(ge),j=ge=>r.current.onRoomMessage?.(ge),q=ge=>r.current.onRoomHistory?.(ge),U=ge=>r.current.onDmMessage?.(ge),W=ge=>r.current.onDmHistory?.(ge),F=ge=>r.current.onFairnessReveal?.(ge),Y=ge=>r.current.onFriendRequestReceived?.(ge),Q=ge=>r.current.onFriendRequestCancelled?.(ge),ie=ge=>r.current.onFriendRequestResponded?.(ge),G=ge=>r.current.onUnfriended?.(ge),B=ge=>r.current.onUserBlocked?.(ge),K=ge=>r.current.onUserUnblocked?.(ge),ae=ge=>r.current.onGameInviteReceived?.(ge),te=ge=>r.current.onTurnOrderUpdated?.(ge),me=ge=>r.current.onSpectatorsUpdated?.(ge),ue=ge=>r.current.onPlayerProfileUpdated?.(ge),Ae=ge=>r.current.onPlayerPresenceUpdate?.(ge),He=ge=>r.current.onPokerMyHole?.(ge),ce=ge=>r.current.onPokerWinners?.(ge),xe=ge=>r.current.onPokerRevealAll?.(ge),re=ge=>r.current.onPokerTimedOut?.(ge),H=ge=>r.current.onRoomUpdateState?.(ge),he=ge=>ge&&(!ge.dice&&typeof ge.d1=="number"&&typeof ge.d2=="number"&&(ge.dice=[ge.d1,ge.d2]),ge.dice&&(typeof ge.d1!="number"||typeof ge.d2!="number")&&(ge.d1=ge.dice[0],ge.d2=ge.dice[1]),ge.shooterId!==void 0&&ge.currentRollerId===void 0&&(ge.currentRollerId=ge.shooterId),ge.nextShooterId!==void 0&&ge.nextRollerId===void 0&&(ge.nextRollerId=ge.nextShooterId),ge),Re=ge=>{r.current.onCrapsRollResult?.(he(ge))},fe=ge=>{r.current.onCrapsReadyUpdate?.(ge)},Ie=ge=>{r.current.onCrapsBetsUpdate?.(ge)},ct=ge=>{r.current.onCrapsBetDelta?.(ge)},$e=ge=>{r.current.onCrapsBetResults?.(ge)},rt=ge=>{r.current.onCrapsBetError?.(ge)},We=ge=>{r.current.onCrapsPointSet?.(ge)},it=ge=>{r.current.onCrapsPointMade?.(ge)},Et=()=>{e.on(Fe.LOBBY_ROOMS,n),e.on(Fe.ROOM_CREATED,a);try{e.on(Fe.POKER_ROOM_CREATED,a)}catch{}e.on(Fe.ROOM_UPDATED,i);try{e.on(Fe.POKER_ROOM_UPDATED,i)}catch{}e.on(Fe.ROOM_DELETED,o);try{e.on(Fe.POKER_ROOM_DELETED,o)}catch{}e.on(Fe.JOINED_ROOM,c);try{e.on(Fe.POKER_JOINED_ROOM,c)}catch{}e.on(Fe.REJOINED_ROOM,u),e.on(Fe.OTHER_JOINED,d),e.on(Fe.POKER_OTHER_JOINED,d),e.on(Fe.OTHER_LEFT,f),e.on(Fe.BANKER_CHANGED,h),e.on(Fe.DICE_ROLLED,m),e.on(Fe.NOT_YOUR_TURN,_),e.on(Fe.OTA_UPDATE_AVAILABLE,w),e.on(Fe.BETS_UPDATED,b),e.on(Fe.GET_WAGERS,E),e.on(Fe.PLAYER_BALANCE_UPDATED,T),e.on(Fe.SIDE_BET_CREATED,D),e.on(Fe.SIDE_BET_ACCEPTED,P),e.on(Fe.SIDE_BET_CANCELED,A),e.on(Fe.FORCE_LOGOUT,C),e.on(Fe.ERROR,O),e.on(Fe.RTC_SIGNAL,I),e.on(Fe.RTC_PEER_JOINED,x),e.on(Fe.RTC_PEER_LEFT,R),e.on(Fe.RTC_CAMERA_OWNER_CHANGED,N),e.on(Fe.RTC_VIDEO_ENABLED,L),e.on(Fe.ROOM_MESSAGE,j),e.on(Fe.ROOM_HISTORY,q),e.on(Fe.DM_MESSAGE,U),e.on(Fe.DM_HISTORY,W),e.on(Fe.FAIRNESS_REVEAL,F),e.on(Fe.FRIEND_REQUEST_RECEIVED,Y),e.on(Fe.FRIEND_REQUEST_CANCELLED,Q),e.on(Fe.FRIEND_REQUEST_RESPONDED,ie),e.on(Fe.UNFRIENDED,G),e.on(Fe.USER_BLOCKED,B),e.on(Fe.USER_UNBLOCKED,K),e.on(Fe.GAME_INVITE_RECEIVED,ae),e.on(Fe.TURN_ORDER_UPDATED,te),e.on(Fe.SPECTATORS_UPDATED,me),e.on(Fe.PLAYER_PROFILE_UPDATED,ue),e.on(Fe.PLAYER_PRESENCE_UPDATE,Ae),e.on(Fe.CRAPS_ROLL,Re),e.on(Fe.CRAPS_READY_UPDATE,fe),e.on(Fe.CRAPS_BETS_UPDATE,Ie),e.on(Fe.CRAPS_BET_DELTA,ct),e.on(Fe.CRAPS_BET_RESULTS,$e),e.on(Fe.CRAPS_BET_ERROR,rt),e.on(Fe.CRAPS_POINT_SET,We),e.on(Fe.CRAPS_POINT_MADE,it),e.on(Fe.POKER_MY_HOLE,He),e.on(Fe.POKER_WINNERS,ce),e.on(Fe.POKER_REVEAL_ALL,xe),e.on(Fe.POKER_TIMED_OUT,re),e.on(Fe.ROOM_UPDATE_STATE,H);const ge=Be=>r.current.onCrapsState?.(Be);return e.on(Fe.CRAPS_STATE,ge),()=>{e.off(Fe.LOBBY_ROOMS,n),e.off(Fe.ROOM_CREATED,a);try{e.off(Fe.POKER_ROOM_CREATED,a)}catch{}e.off(Fe.ROOM_UPDATED,i);try{e.off(Fe.POKER_ROOM_UPDATED,i)}catch{}e.off(Fe.ROOM_DELETED,o);try{e.off(Fe.POKER_ROOM_DELETED,o)}catch{}e.off(Fe.JOINED_ROOM,c);try{e.off(Fe.POKER_JOINED_ROOM,c)}catch{}e.off(Fe.REJOINED_ROOM,u),e.off(Fe.OTHER_JOINED,d);try{e.off(Fe.POKER_OTHER_JOINED,d)}catch{}e.off(Fe.OTHER_LEFT,f),e.off(Fe.BANKER_CHANGED,h),e.off(Fe.DICE_ROLLED,m),e.off(Fe.NOT_YOUR_TURN,_),e.off(Fe.OTA_UPDATE_AVAILABLE,w),e.off(Fe.BETS_UPDATED,b),e.off(Fe.GET_WAGERS,E),e.off(Fe.PLAYER_BALANCE_UPDATED,T),e.off(Fe.SIDE_BET_CREATED,D),e.off(Fe.SIDE_BET_ACCEPTED,P),e.off(Fe.SIDE_BET_CANCELED,A),e.off(Fe.FORCE_LOGOUT,C),e.off(Fe.ERROR,O),e.off(Fe.RTC_SIGNAL,I),e.off(Fe.RTC_PEER_JOINED,x),e.off(Fe.RTC_PEER_LEFT,R),e.off(Fe.RTC_CAMERA_OWNER_CHANGED,N),e.off(Fe.RTC_VIDEO_ENABLED,L),e.off(Fe.ROOM_MESSAGE,j),e.off(Fe.ROOM_HISTORY,q),e.off(Fe.DM_MESSAGE,U),e.off(Fe.DM_HISTORY,W),e.off(Fe.FAIRNESS_REVEAL,F),e.off(Fe.FRIEND_REQUEST_RECEIVED,Y),e.off(Fe.FRIEND_REQUEST_CANCELLED,Q),e.off(Fe.FRIEND_REQUEST_RESPONDED,ie),e.off(Fe.UNFRIENDED,G),e.off(Fe.USER_BLOCKED,B),e.off(Fe.USER_UNBLOCKED,K),e.off(Fe.GAME_INVITE_RECEIVED,ae),e.off(Fe.TURN_ORDER_UPDATED,te),e.off(Fe.SPECTATORS_UPDATED,me),e.off(Fe.PLAYER_PROFILE_UPDATED,ue),e.off(Fe.PLAYER_PRESENCE_UPDATE,Ae),e.off(Fe.CRAPS_ROLL,Re),e.off(Fe.CRAPS_READY_UPDATE,fe),e.off(Fe.CRAPS_BETS_UPDATE,Ie),e.off(Fe.CRAPS_BET_DELTA,ct),e.off(Fe.CRAPS_BET_RESULTS,$e),e.off(Fe.CRAPS_BET_ERROR,rt),e.off(Fe.CRAPS_POINT_SET,We),e.off(Fe.CRAPS_POINT_MADE,it),e.off(Fe.POKER_MY_HOLE,He),e.off(Fe.POKER_WINNERS,ce),e.off(Fe.POKER_REVEAL_ALL,xe),e.off(Fe.POKER_TIMED_OUT,re),e.off(Fe.ROOM_UPDATE_STATE,H),e.off(Fe.CRAPS_STATE)}};let Mt=Et();const _t=()=>{try{Mt&&Mt()}catch{}Mt=Et()};return e.on("connect",_t),e.on("reconnect",_t),()=>{e.off("connect",_t),e.off("reconnect",_t);try{Mt&&Mt()}catch{}}},[e])}function cB(){const{getRoomsList:t,createRoom:e,lobbyJoin:r,lobbyLeave:n}=pa(),[a,i]=v.useState({public:[],private:[]}),[o,c]=v.useState(!0),[u,d]=v.useState(null),{setMembershipModalOpen:f}=Bb(),{resetSpin:h}=Jo(),m=globalThis.__lastRoomsFetchAt||(globalThis.__lastRoomsFetchAt={}),_=600,w=v.useCallback(async()=>{const C=Date.now(),O=m.t||0;if(!(C-O<_)){m.t=C,c(!0),d(null);try{const I=await t();if(I?.ok){const x=I.public&&I.private?{public:I.public,private:I.private}:null,R=I.data||I.roomsList||{},N=R.public&&R.private?{public:R.public,private:R.private}:null,L=x||N||{public:[],private:[]};i({public:Array.isArray(L.public)?L.public:[],private:Array.isArray(L.private)?L.private:[]})}else throw new Error(I?.error??"Failed to load rooms.")}catch(I){d(I?.message??"Failed to load rooms.")}finally{c(!1)}}},[t]),b=globalThis.__lobbyState||(globalThis.__lobbyState={refCount:0,joined:!1}),E=v.useCallback(async()=>{b.refCount++,b.joined||(b.joined=!0,await r())},[r]),T=v.useCallback(async()=>{b.refCount=Math.max(0,b.refCount-1),b.refCount===0&&b.joined&&(b.joined=!1,await n())},[n]),D=globalThis.__createRoomGuard||(globalThis.__createRoomGuard={}),P=800,A=v.useCallback(async C=>{const O=Date.now(),I=D.lastAt||0;if(O-I<P&&D.inFlight)try{return await D.inFlight}catch{}const x=async()=>{let L=0;if(O-I<P){const j=P-(O-I);await new Promise(q=>setTimeout(q,Math.max(50,j)))}for(;L<3;){L++;const j=await e({name:C.name,isPrivate:C.isPrivate,singlePlayer:C.singlePlayer,gameMode:C.gameMode});if(!j||j.ok===!0||j?.ok===!1&&j.error!=="rate_limited"&&!/rate[_-]?limited/i.test(j.error||""))return j;const q=180*L,U=Math.floor(Math.random()*140);await new Promise(W=>setTimeout(W,q+U))}return e({name:C.name,isPrivate:C.isPrivate,singlePlayer:C.singlePlayer,gameMode:C.gameMode})};c(!0),d(null),D.lastAt=Date.now();const R=x();D.inFlight=R;try{const N=await R;if(!N?.ok)return N;const L=N.room||N.roomsList?.room||null;if(L){const j={roomId:L.roomId,name:L.name,createdAt:L.createdAt,maxPlayers:L.maxPlayers,currentPlayers:L.players?.length??1,phase:L.gameState?.phase??"waiting",private:!!L.private,gameMode:L.gameMode||L.gameState?.gameMode||"cee-lo"};i(q=>q.public.some(U=>U.roomId===j.roomId)||q.private.some(U=>U.roomId===j.roomId)?q:j.private?{...q,private:[j,...q.private]}:{...q,public:[j,...q.public]})}else await w();return h(),N}catch(N){const L=N?.message??"Failed to create room.";throw d(L),N}finally{c(!1),D.inFlight=null}},[e,w,f,h]);return v.useEffect(()=>(E(),()=>{T()}),[]),v.useEffect(()=>{w()},[w]),Pa({onRoomCreated:C=>{i(O=>C.private?{...O,private:[C,...O.private.filter(I=>I.roomId!==C.roomId)]}:{...O,public:[C,...O.public.filter(I=>I.roomId!==C.roomId)]})},onRoomDeleted:({roomId:C})=>{i(O=>({public:O.public.filter(I=>I.roomId!==C),private:O.private.filter(I=>I.roomId!==C)}))},onRoomUpdated:C=>{i(O=>({public:O.public.map(I=>I.roomId===C.roomId?{...I,currentPlayers:C.currentPlayers??I.currentPlayers,phase:C.phase??I.phase}:I),private:O.private.map(I=>I.roomId===C.roomId?{...I,currentPlayers:C.currentPlayers??I.currentPlayers,phase:C.phase??I.phase}:I)}))}}),{roomsList:a,loading:o,error:u,refreshRooms:w,createRoom:A}}function XG({gameMode:t}){const[e,r]=v.useState(""),[n,a]=v.useState(2),[i,o]=v.useState(!1),[c,u]=v.useState(!1),[d,f]=v.useState(!1),[h,m]=v.useState(null),[_,w]=v.useState(null),b=tn(),{createRoom:E}=cB(),{pokerCreateRoom:T}=pa(),D=async P=>{P.preventDefault(),m(null),f(!0);try{const A=t||"cee-lo";let C;if(A==="poker"?C=await T({name:e,maxPlayers:n,isPrivate:i,singlePlayer:c}):C=await E({name:e,maxPlayers:n,isPrivate:i,singlePlayer:c,gameMode:A}),!C?.ok)m("Failed to create room");else{const O=C?.room??C?.roomsList?.room??C?.data?.room??null,I=O?.roomId??O?.id??C?.roomId??C?.data?.roomId;b(I?A==="poker"?`/poker/room/${I}`:`/room/${I}`:A==="poker"?"/poker":"/")}}catch{m("Unexpected error")}finally{f(!1)}};return _?g.jsxs("div",{className:"create-room-success",children:[g.jsx("h2",{children:"Room Created!"}),g.jsxs("p",{children:["Your room ",g.jsx("strong",{children:_.name})," (ID: ",g.jsx("code",{children:_.roomId}),") has been created."]})]}):g.jsxs("form",{className:"create-room-form",onSubmit:D,children:[g.jsx("h2",{children:"Create a New Room"}),g.jsxs("label",{children:["Room Name",g.jsx("input",{type:"text",value:e,onChange:P=>r(P.target.value),required:!0,disabled:d,className:"create-room-input",placeholder:"Enter room name"})]}),g.jsxs("label",{children:["Max Players",g.jsx("input",{type:"number",value:n,min:2,max:10,className:"create-room-input",onChange:P=>a(Number(P.target.value)),required:!0,disabled:d})]}),g.jsxs("label",{children:[g.jsx("input",{type:"checkbox",className:"create-room-checkbox",checked:i,onChange:P=>o(P.target.checked),disabled:d}),"Private room (invite only)"]}),h&&g.jsx("p",{className:"error",children:h}),g.jsx("button",{className:"felt-btn",type:"submit",disabled:d,children:d?"Creating...":"Create Room"})]})}function lB(t){v.useEffect(()=>{if(!(typeof document>"u")){if(t){try{am(!0)}catch{}try{Ox()}catch{}try{document.body.classList.add("modal-open")}catch{}}else{try{am(!1)}catch{}try{document.body.classList.remove("modal-open")}catch{}}return()=>{try{am(!1)}catch{}try{document.body.classList.remove("modal-open")}catch{}}}},[t])}function JG({open:t,onClose:e,gameMode:r}){const[n,a]=v.useState(r||"cee-lo");lB(!!t),v.useEffect(()=>{const o=c=>{c.key==="Escape"&&e()};return t&&document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[t,e]),v.useEffect(()=>{r&&a(r)},[r]);const i=n==="craps"?"Craps":n==="poker"?"Poker":"Cee‑Lo";return t?g.jsx("div",{className:"modal-backdrop",role:"presentation",onClick:e,children:g.jsxs("div",{className:"modal-panel",role:"dialog","aria-modal":"true","aria-label":"Create a room",onClick:o=>o.stopPropagation(),children:[g.jsx("button",{className:"modal-close",onClick:e,"aria-label":"Close",children:"×"}),g.jsx("h3",{className:"modal-title",children:"Create a Room"}),g.jsxs("p",{"aria-live":"polite",className:"modal-subtitle",children:["Game mode: ",g.jsx("strong",{children:i})]}),g.jsx(XG,{gameMode:n})]})}):null}function kO({rooms:t,title:e}){const r=tn();if(t.length===0)return g.jsx("div",{className:"room-list",children:"No rooms available."});const n=(a,i)=>{if(i==="poker")return r(`/poker/room/${a}`);r(`/room/${a}`)};return g.jsxs("div",{className:"room-list",children:[g.jsx("h3",{children:e}),g.jsx("ul",{children:[...new Set(t)].filter(a=>!a.singlePlayer).map(a=>g.jsxs("li",{className:"room-list__item",children:[g.jsxs("div",{className:"room-list__info",children:[g.jsx("span",{className:"room-list__name",children:a.name}),a.private&&g.jsx("span",{className:"room-list__private",children:"🔒"}),g.jsxs("span",{className:"room-list__players",children:[a.currentPlayers,"/",a.maxPlayers]}),g.jsx("span",{className:"room-list__phase",children:a.phase??"waiting"}),a.gameMode&&g.jsx("span",{className:"room-list__mode",title:"Game Mode",children:a.gameMode}),g.jsx("span",{className:"room-list__created",children:new Date(a.createdAt).toLocaleTimeString()})]}),g.jsx("button",{className:"btn btn--join",onClick:()=>n(a.roomId,a.gameMode),children:"Join"})]},a.roomId))})]})}function QG({open:t,onClose:e,isPrivate:r,setIsPrivate:n,roomsList:a}){const i=v.useRef(null);return v.useEffect(()=>{if(!t)return;const o=u=>{u.key==="Escape"&&e()},c=u=>{i.current&&!i.current.contains(u.target)&&e()};return document.addEventListener("keydown",o),document.addEventListener("mousedown",c),()=>{document.removeEventListener("keydown",o),document.removeEventListener("mousedown",c)}},[t,e]),t?g.jsx("div",{className:"modal-backdrop",role:"presentation",children:g.jsxs("div",{className:"modal-panel",role:"dialog","aria-modal":"true","aria-label":"Browse Rooms",ref:i,children:[g.jsx("button",{className:"modal-close",onClick:e,"aria-label":"Close",children:"×"}),g.jsx("h3",{className:"modal-title",children:"Browse Rooms"}),g.jsxs("label",{style:{display:"inline-flex",alignItems:"center",gap:8,marginBottom:12},children:[g.jsx("input",{type:"checkbox",className:"create-room-checkbox",checked:r,onChange:o=>n(o.target.checked)}),g.jsxs("span",{children:[r?"Private":"Public"," Rooms"]})]}),r?a.private.length?g.jsx(kO,{title:"Private Rooms",rooms:a.private}):g.jsx("p",{children:"No private rooms available."}):a.public.length?g.jsx(kO,{title:"Public Rooms",rooms:a.public}):g.jsx("p",{children:"No public rooms available."})]})}):null}function ZG({anchorRef:t,open:e,onClose:r,items:n}){const a=v.useRef(null);return v.useEffect(()=>{if(!e)return;const i=c=>{const u=c.target,d=!!a.current?.contains(u),f=!!t.current?.contains(u);!d&&!f&&r()},o=c=>{c.key==="Escape"&&r()};return document.addEventListener("mousedown",i,!0),document.addEventListener("keydown",o),()=>{document.removeEventListener("mousedown",i,!0),document.removeEventListener("keydown",o)}},[e,r,t]),e?g.jsx("div",{ref:a,className:"settings-menu",role:"menu","aria-orientation":"vertical",children:n.map(i=>g.jsx("button",{className:"settings-menu__item",role:"menuitem",onClick:()=>{i.onClick?.(),r()},children:i.label},i.key))}):null}const Bo=ro("App",{web:()=>qr(()=>import("./web-D9QpwnMz.js"),[],import.meta.url).then(t=>new t.AppWeb)}),eW=Object.freeze(Object.defineProperty({__proto__:null,App:Bo},Symbol.toStringTag,{value:"Module"}));var tW=Object.create,uB=Object.defineProperty,rW=Object.getOwnPropertyDescriptor,nW=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Ub=t=>{throw TypeError(t)},dB=(t,e,r)=>e in t?uB(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,aW=t=>[,,,tW(null)],fB=["class","method","getter","setter","accessor","field","value","get","set"],pB=t=>t!==void 0&&typeof t!="function"?Ub("Function expected"):t,iW=(t,e,r,n,a)=>({kind:fB[t],name:e,metadata:n,addInitializer:i=>r._?Ub("Already initialized"):a.push(pB(i||null))}),sW=(t,e)=>dB(e,nW("metadata"),t[3]),oW=(t,e,r,n)=>{for(var a=0,i=t[e>>1],o=i&&i.length;a<o;a++)i[a].call(r);return n},cW=(t,e,r,n,a,i)=>{for(var o,c,u,d,f=e&7,h=!1,m=!1,_=2,w=fB[f+5],b=t[_]||(t[_]=[]),E=(a=a.prototype,rW(a,r)),T=n.length-1;T>=0;T--)u=iW(f,r,c={},t[3],b),u.static=h,u.private=m,d=u.access={has:D=>r in D},d.get=D=>D[r],f>2,o=(0,n[T])(E[w],u),c._=1,pB(o)&&(E[w]=o);return E&&uB(a,r,E),a},vt=(t,e,r)=>dB(t,typeof e!="symbol"?e+"":e,r),hB=(t,e,r)=>e.has(t)||Ub("Cannot "+r),wO=(t,e,r)=>(hB(t,e,"read from private field"),r?r.call(t):e.get(t)),SO=(t,e,r)=>e.has(t)?Ub("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),EO=(t,e,r,n)=>(hB(t,e,"write to private field"),e.set(t,r),r);const lW="5";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(lW);const Nx=1,Ix=2,mB=4,uW=8,dW=16,fW=1,pW=2,hW=4,mW=8,gW=16,yW=1,vW=2,_W=4,bW=1,kW=2,ri=Symbol(),Dm="http://www.w3.org/2000/svg";function wW(t){return t.endsWith("capture")&&t!=="gotpointercapture"&&t!=="lostpointercapture"}const SW=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function EW(t){return SW.includes(t)}const TW={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly",defaultvalue:"defaultValue",defaultchecked:"defaultChecked",srcobject:"srcObject"};function CW(t){return t=t.toLowerCase(),TW[t]??t}const xW=["touchstart","touchmove"];function PW(t){return xW.includes(t)}const AW=!1;var Fb=Array.isArray,RW=Array.prototype.indexOf,Mx=Array.from,DW=Object.defineProperty,Ul=Object.getOwnPropertyDescriptor,gB=Object.getOwnPropertyDescriptors,OW=Object.prototype,NW=Array.prototype,jx=Object.getPrototypeOf;function yf(t){return typeof t=="function"}const Ar=()=>{};function IW(t){return t()}function N_(t){for(var e=0;e<t.length;e++)t[e]()}const Js=2,yB=4,xg=8,qb=16,no=32,Pg=64,I_=128,yd=256,M_=512,hi=1024,Jl=2048,Ag=4096,Uo=8192,Tp=16384,vB=32768,uu=65536,MW=1<<17,jW=1<<19,_B=1<<20,Fl=Symbol("$state"),bB=Symbol("legacy props"),LW=Symbol("");function kB(t){return t===this.v}function wB(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function Lx(t){return!wB(t,this.v)}function BW(t){throw new Error("https://svelte.dev/e/effect_in_teardown")}function UW(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function FW(t){throw new Error("https://svelte.dev/e/effect_orphan")}function qW(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function zW(t){throw new Error("https://svelte.dev/e/props_invalid_value")}function $W(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function VW(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function HW(){throw new Error("https://svelte.dev/e/state_unsafe_local_read")}function GW(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}let Cp=!1,WW=!1;function KW(){Cp=!0}function ai(t,e){var r={f:0,v:t,reactions:null,equals:kB,rv:0,wv:0};return r}function sr(t){return SB(ai(t))}function zb(t,e=!1){var r;const n=ai(t);return e||(n.equals=Lx),Cp&&Dr!==null&&Dr.l!==null&&((r=Dr.l).s??(r.s=[])).push(n),n}function Ls(t,e=!1){return SB(zb(t,e))}function SB(t){return zr!==null&&(zr.f&Js)!==0&&(Fo===null?sK([t]):Fo.push(t)),t}function pt(t,e){return zr!==null&&$x()&&(zr.f&(Js|qb))!==0&&(Fo===null||!Fo.includes(t))&&GW(),_T(t,e)}function _T(t,e){return t.equals(e)||(t.v,t.v=e,t.wv=qB(),EB(t,Jl),$x()&&lr!==null&&(lr.f&hi)!==0&&(lr.f&no)===0&&(Ma!==null&&Ma.includes(t)?(ao(lr,Jl),Hb(lr)):ql===null?oK([t]):ql.push(t))),e}function EB(t,e){var r=t.reactions;if(r!==null)for(var n=$x(),a=r.length,i=0;i<a;i++){var o=r[i],c=o.f;(c&Jl)===0&&(!n&&o===lr||(ao(o,e),(c&(hi|yd))!==0&&((c&Js)!==0?EB(o,Ag):Hb(o))))}}let Bx=!1;function Vt(t,e=null,r){if(typeof t!="object"||t===null||Fl in t)return t;const n=jx(t);if(n!==OW&&n!==NW)return t;var a=new Map,i=Fb(t),o=ai(0);i&&a.set("length",ai(t.length));var c;return new Proxy(t,{defineProperty(u,d,f){(!("value"in f)||f.configurable===!1||f.enumerable===!1||f.writable===!1)&&$W();var h=a.get(d);return h===void 0?(h=ai(f.value),a.set(d,h)):pt(h,Vt(f.value,c)),!0},deleteProperty(u,d){var f=a.get(d);if(f===void 0)d in u&&a.set(d,ai(ri));else{if(i&&typeof d=="string"){var h=a.get("length"),m=Number(d);Number.isInteger(m)&&m<h.v&&pt(h,m)}pt(f,ri),TO(o)}return!0},get(u,d,f){var h;if(d===Fl)return t;var m=a.get(d),_=d in u;if(m===void 0&&(!_||(h=Ul(u,d))!=null&&h.writable)&&(m=ai(Vt(_?u[d]:ri,c)),a.set(d,m)),m!==void 0){var w=$(m);return w===ri?void 0:w}return Reflect.get(u,d,f)},getOwnPropertyDescriptor(u,d){var f=Reflect.getOwnPropertyDescriptor(u,d);if(f&&"value"in f){var h=a.get(d);h&&(f.value=$(h))}else if(f===void 0){var m=a.get(d),_=m?.v;if(m!==void 0&&_!==ri)return{enumerable:!0,configurable:!0,value:_,writable:!0}}return f},has(u,d){var f;if(d===Fl)return!0;var h=a.get(d),m=h!==void 0&&h.v!==ri||Reflect.has(u,d);if(h!==void 0||lr!==null&&(!m||(f=Ul(u,d))!=null&&f.writable)){h===void 0&&(h=ai(m?Vt(u[d],c):ri),a.set(d,h));var _=$(h);if(_===ri)return!1}return m},set(u,d,f,h){var m,_=a.get(d),w=d in u;if(i&&d==="length")for(var b=f;b<_.v;b+=1){var E=a.get(b+"");E!==void 0?pt(E,ri):b in u&&(E=ai(ri),a.set(b+"",E))}_===void 0?(!w||(m=Ul(u,d))!=null&&m.writable)&&(_=ai(void 0),pt(_,Vt(f,c)),a.set(d,_)):(w=_.v!==ri,pt(_,Vt(f,c)));var T=Reflect.getOwnPropertyDescriptor(u,d);if(T!=null&&T.set&&T.set.call(h,f),!w){if(i&&typeof d=="string"){var D=a.get("length"),P=Number(d);Number.isInteger(P)&&P>=D.v&&pt(D,P+1)}TO(o)}return!0},ownKeys(u){$(o);var d=Reflect.ownKeys(u).filter(m=>{var _=a.get(m);return _===void 0||_.v!==ri});for(var[f,h]of a)h.v!==ri&&!(f in u)&&d.push(f);return d},setPrototypeOf(){VW()}})}function TO(t,e=1){pt(t,t.v+e)}var CO,TB,CB;function YW(){if(CO===void 0){CO=window;var t=Element.prototype,e=Node.prototype;TB=Ul(e,"firstChild").get,CB=Ul(e,"nextSibling").get,t.__click=void 0,t.__className="",t.__attributes=null,t.__styles=null,t.__e=void 0,Text.prototype.__t=void 0}}function Rg(t=""){return document.createTextNode(t)}function sd(t){return TB.call(t)}function $b(t){return CB.call(t)}function Le(t,e){return sd(t)}function Xt(t,e){{var r=sd(t);return r instanceof Comment&&r.data===""?$b(r):r}}function kt(t,e=1,r=!1){let n=t;for(;e--;)n=$b(n);return n}function XW(t){t.textContent=""}function ze(t){var e=Js|Jl;lr===null?e|=yd:lr.f|=_B;var r=zr!==null&&(zr.f&Js)!==0?zr:null;const n={children:null,ctx:Dr,deps:null,equals:kB,f:e,fn:t,reactions:null,rv:0,v:null,wv:0,parent:r??lr};return r!==null&&(r.children??(r.children=[])).push(n),n}function Mf(t){const e=ze(t);return e.equals=Lx,e}function xB(t){var e=t.children;if(e!==null){t.children=null;for(var r=0;r<e.length;r+=1){var n=e[r];(n.f&Js)!==0?Ux(n):ys(n)}}}function JW(t){for(var e=t.parent;e!==null;){if((e.f&Js)===0)return e;e=e.parent}return null}function PB(t){var e,r=lr;mi(JW(t));try{xB(t),e=zB(t)}finally{mi(r)}return e}function AB(t){var e=PB(t),r=(Il||(t.f&yd)!==0)&&t.deps!==null?Ag:hi;ao(t,r),t.equals(e)||(t.v=e,t.wv=qB())}function Ux(t){xB(t),Mm(t,0),ao(t,Tp),t.v=t.children=t.deps=t.ctx=t.reactions=null}function RB(t){lr===null&&zr===null&&FW(),zr!==null&&(zr.f&yd)!==0&&UW(),zx&&BW()}function QW(t,e){var r=e.last;r===null?e.last=e.first=t:(r.next=t,t.prev=r,e.last=t)}function xp(t,e,r,n=!0){var a=(t&Pg)!==0,i=lr,o={ctx:Dr,deps:null,deriveds:null,nodes_start:null,nodes_end:null,f:t|Jl,first:null,fn:e,last:null,next:null,parent:a?null:i,prev:null,teardown:null,transitions:null,wv:0};if(r){var c=jf;try{xO(!0),Ng(o),o.f|=vB}catch(f){throw ys(o),f}finally{xO(c)}}else e!==null&&Hb(o);var u=r&&o.deps===null&&o.first===null&&o.nodes_start===null&&o.teardown===null&&(o.f&_B)===0;if(!u&&!a&&n&&(i!==null&&QW(o,i),zr!==null&&(zr.f&Js)!==0)){var d=zr;(d.children??(d.children=[])).push(o)}return o}function ZW(){return zr===null?!1:!Il}function DB(t){const e=xp(xg,null,!1);return ao(e,hi),e.teardown=t,e}function ip(t){RB();var e=lr!==null&&(lr.f&no)!==0&&Dr!==null&&!Dr.m;if(e){var r=Dr;(r.e??(r.e=[])).push({fn:t,effect:lr,reaction:zr})}else{var n=Vb(t);return n}}function eK(t){return RB(),Dg(t)}function tK(t){const e=xp(Pg,t,!0);return(r={})=>new Promise(n=>{r.outro?od(e,()=>{ys(e),n(void 0)}):(ys(e),n(void 0))})}function Vb(t){return xp(yB,t,!1)}function _o(t,e){var r=Dr,n={effect:null,ran:!1};r.l.r1.push(n),n.effect=Dg(()=>{t(),!n.ran&&(n.ran=!0,pt(r.l.r2,!0),Ko(e))})}function rK(){var t=Dr;Dg(()=>{if($(t.l.r2)){for(var e of t.l.r1){var r=e.effect;(r.f&hi)!==0&&ao(r,Ag),Pp(r)&&Ng(r),e.ran=!1}t.l.r2.v=!1}})}function Dg(t){return xp(xg,t,!0)}function mt(t){return du(t)}function du(t,e=0){return xp(xg|qb|e,t,!0)}function ps(t,e=!0){return xp(xg|no,t,!0,e)}function OB(t){var e=t.teardown;if(e!==null){const r=zx,n=zr;PO(!0),vs(null);try{e.call(null)}finally{PO(r),vs(n)}}}function NB(t){var e=t.deriveds;if(e!==null){t.deriveds=null;for(var r=0;r<e.length;r+=1)Ux(e[r])}}function IB(t,e=!1){var r=t.first;for(t.first=t.last=null;r!==null;){var n=r.next;ys(r,e),r=n}}function nK(t){for(var e=t.first;e!==null;){var r=e.next;(e.f&no)===0&&ys(e),e=r}}function ys(t,e=!0){var r=!1;if((e||(t.f&jW)!==0)&&t.nodes_start!==null){for(var n=t.nodes_start,a=t.nodes_end;n!==null;){var i=n===a?null:$b(n);n.remove(),n=i}r=!0}IB(t,e&&!r),NB(t),Mm(t,0),ao(t,Tp);var o=t.transitions;if(o!==null)for(const u of o)u.stop();OB(t);var c=t.parent;c!==null&&c.first!==null&&MB(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes_start=t.nodes_end=null}function MB(t){var e=t.parent,r=t.prev,n=t.next;r!==null&&(r.next=n),n!==null&&(n.prev=r),e!==null&&(e.first===t&&(e.first=n),e.last===t&&(e.last=r))}function od(t,e){var r=[];Fx(t,r,!0),jB(r,()=>{ys(t),e&&e()})}function jB(t,e){var r=t.length;if(r>0){var n=()=>--r||e();for(var a of t)a.out(n)}else e()}function Fx(t,e,r){if((t.f&Uo)===0){if(t.f^=Uo,t.transitions!==null)for(const o of t.transitions)(o.is_global||r)&&e.push(o);for(var n=t.first;n!==null;){var a=n.next,i=(n.f&uu)!==0||(n.f&no)!==0;Fx(n,e,i?r:!1),n=a}}}function Om(t){LB(t,!0)}function LB(t,e){if((t.f&Uo)!==0){Pp(t)&&Ng(t),t.f^=Uo;for(var r=t.first;r!==null;){var n=r.next,a=(r.f&uu)!==0||(r.f&no)!==0;LB(r,a?e:!1),r=n}if(t.transitions!==null)for(const i of t.transitions)(i.is_global||e)&&i.in()}}let j_=!1,bT=[];function BB(){j_=!1;const t=bT.slice();bT=[],N_(t)}function vd(t){j_||(j_=!0,queueMicrotask(BB)),bT.push(t)}function aK(){j_&&BB()}function qx(t){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}const UB=0,iK=1;let sm=!1,Gv=UB,Nm=!1,Im=null,jf=!1,zx=!1;function xO(t){jf=t}function PO(t){zx=t}let Wu=[],Lf=0,zr=null;function vs(t){zr=t}let lr=null;function mi(t){lr=t}let Fo=null;function sK(t){Fo=t}let Ma=null,Di=0,ql=null;function oK(t){ql=t}let FB=1,kT=0,Il=!1,Dr=null;function AO(t){Dr=t}function qB(){return++FB}function $x(){return!Cp||Dr!==null&&Dr.l===null}function Pp(t){var e,r=t.f;if((r&Jl)!==0)return!0;if((r&Ag)!==0){var n=t.deps,a=(r&yd)!==0;if(n!==null){var i,o,c=(r&M_)!==0,u=a&&lr!==null&&!Il,d=n.length;if(c||u){for(i=0;i<d;i++)o=n[i],(c||!((e=o?.reactions)!=null&&e.includes(t)))&&(o.reactions??(o.reactions=[])).push(t);c&&(t.f^=M_)}for(i=0;i<d;i++)if(o=n[i],Pp(o)&&AB(o),o.wv>t.wv)return!0}(!a||lr!==null&&!Il)&&ao(t,hi)}return!1}function cK(t,e){for(var r=e;r!==null;){if((r.f&I_)!==0)try{r.fn(t);return}catch{r.f^=I_}r=r.parent}throw sm=!1,t}function lK(t){return(t.f&Tp)===0&&(t.parent===null||(t.parent.f&I_)===0)}function Vw(){sm=!1}function Og(t,e,r,n){if(sm){if(r===null&&(sm=!1),lK(e))throw t;return}r!==null&&(sm=!0);{cK(t,e);return}}function zB(t){var e,r=Ma,n=Di,a=ql,i=zr,o=Il,c=Fo,u=Dr,d=t.f;Ma=null,Di=0,ql=null,zr=(d&(no|Pg))===0?t:null,Il=!jf&&(d&yd)!==0,Fo=null,Dr=t.ctx,kT++;try{var f=(0,t.fn)(),h=t.deps;if(Ma!==null){var m;if(Mm(t,Di),h!==null&&Di>0)for(h.length=Di+Ma.length,m=0;m<Ma.length;m++)h[Di+m]=Ma[m];else t.deps=h=Ma;if(!Il)for(m=Di;m<h.length;m++)((e=h[m]).reactions??(e.reactions=[])).push(t)}else h!==null&&Di<h.length&&(Mm(t,Di),h.length=Di);return f}finally{Ma=r,Di=n,ql=a,zr=i,Il=o,Fo=c,Dr=u}}function uK(t,e){let r=e.reactions;if(r!==null){var n=RW.call(r,t);if(n!==-1){var a=r.length-1;a===0?r=e.reactions=null:(r[n]=r[a],r.pop())}}r===null&&(e.f&Js)!==0&&(Ma===null||!Ma.includes(e))&&(ao(e,Ag),(e.f&(yd|M_))===0&&(e.f^=M_),Mm(e,0))}function Mm(t,e){var r=t.deps;if(r!==null)for(var n=e;n<r.length;n++)uK(t,r[n])}function Ng(t){var e=t.f;if((e&Tp)===0){ao(t,hi);var r=lr,n=Dr;lr=t;try{(e&qb)!==0?nK(t):IB(t),NB(t),OB(t);var a=zB(t);t.teardown=typeof a=="function"?a:null,t.wv=FB;var i=t.deps,o;AW&&WW&&t.f&Jl}catch(c){Og(c,t,r,n||t.ctx)}finally{lr=r}}}function $B(){if(Lf>1e3){Lf=0;try{qW()}catch(t){if(Im!==null)Og(t,Im,null);else throw t}}Lf++}function VB(t){var e=t.length;if(e!==0){$B();var r=jf;jf=!0;try{for(var n=0;n<e;n++){var a=t[n];(a.f&hi)===0&&(a.f^=hi);var i=[];HB(a,i),dK(i)}}finally{jf=r}}}function dK(t){var e=t.length;if(e!==0)for(var r=0;r<e;r++){var n=t[r];if((n.f&(Tp|Uo))===0)try{Pp(n)&&(Ng(n),n.deps===null&&n.first===null&&n.nodes_start===null&&(n.teardown===null?MB(n):n.fn=null))}catch(a){Og(a,n,null,n.ctx)}}}function fK(){if(Nm=!1,Lf>1001)return;const t=Wu;Wu=[],VB(t),Nm||(Lf=0,Im=null)}function Hb(t){Gv===UB&&(Nm||(Nm=!0,queueMicrotask(fK))),Im=t;for(var e=t;e.parent!==null;){e=e.parent;var r=e.f;if((r&(Pg|no))!==0){if((r&hi)===0)return;e.f^=hi}}Wu.push(e)}function HB(t,e){var r=t.first,n=[];e:for(;r!==null;){var a=r.f,i=(a&no)!==0,o=i&&(a&hi)!==0,c=r.next;if(!o&&(a&Uo)===0)if((a&xg)!==0){if(i)r.f^=hi;else try{Pp(r)&&Ng(r)}catch(h){Og(h,r,null,r.ctx)}var u=r.first;if(u!==null){r=u;continue}}else(a&yB)!==0&&n.push(r);if(c===null){let h=r.parent;for(;h!==null;){if(t===h)break e;var d=h.next;if(d!==null){r=d;continue e}h=h.parent}}r=c}for(var f=0;f<n.length;f++)u=n[f],e.push(u),HB(u,e)}function GB(t){var e=Gv,r=Wu;try{$B();const a=[];Gv=iK,Wu=a,Nm=!1,VB(r);var n=t?.();return aK(),(Wu.length>0||a.length>0)&&GB(),Lf=0,Im=null,n}finally{Gv=e,Wu=r}}async function pK(){await Promise.resolve(),GB()}function $(t){var e,r=t.f,n=(r&Js)!==0;if(n&&(r&Tp)!==0){var a=PB(t);return Ux(t),a}if(zr!==null){Fo!==null&&Fo.includes(t)&&HW();var i=zr.deps;t.rv<kT&&(t.rv=kT,Ma===null&&i!==null&&i[Di]===t?Di++:Ma===null?Ma=[t]:Ma.push(t),ql!==null&&lr!==null&&(lr.f&hi)!==0&&(lr.f&no)===0&&ql.includes(t)&&(ao(lr,Jl),Hb(lr)))}else if(n&&t.deps===null)for(var o=t,c=o.parent,u=o;c!==null;)if((c.f&Js)!==0){var d=c;u=d,c=d.parent}else{var f=c;(e=f.deriveds)!=null&&e.includes(u)||(f.deriveds??(f.deriveds=[])).push(u);break}return n&&(o=t,Pp(o)&&AB(o)),t.v}function Ko(t){const e=zr;try{return zr=null,t()}finally{zr=e}}const hK=-7169;function ao(t,e){t.f=t.f&hK|e}function Jn(t){return WB().get(t)}function ed(t,e){return WB().set(t,e),e}function WB(t){return Dr===null&&qx(),Dr.c??(Dr.c=new Map(mK(Dr)||void 0))}function mK(t){let e=t.p;for(;e!==null;){const r=e.c;if(r!==null)return r;e=e.p}return null}function Wt(t,e=!1,r){Dr={p:Dr,c:null,e:null,m:!1,s:t,x:null,l:null},Cp&&!e&&(Dr.l={s:null,u:null,r1:[],r2:ai(!1)})}function Kt(t){const e=Dr;if(e!==null){t!==void 0&&(e.x=t);const o=e.e;if(o!==null){var r=lr,n=zr;e.e=null;try{for(var a=0;a<o.length;a++){var i=o[a];mi(i.effect),vs(i.reaction),Vb(i.fn)}}finally{mi(r),vs(n)}}Dr=e.p,e.m=!0}return t||{}}function Wv(t){if(!(typeof t!="object"||!t||t instanceof EventTarget)){if(Fl in t)wT(t);else if(!Array.isArray(t))for(let e in t){const r=t[e];typeof r=="object"&&r&&Fl in r&&wT(r)}}}function wT(t,e=new Set){if(typeof t=="object"&&t!==null&&!(t instanceof EventTarget)&&!e.has(t)){e.add(t),t instanceof Date&&t.getTime();for(let n in t)try{wT(t[n],e)}catch{}const r=jx(t);if(r!==Object.prototype&&r!==Array.prototype&&r!==Map.prototype&&r!==Set.prototype&&r!==Date.prototype){const n=gB(r);for(let a in n){const i=n[a].get;if(i)try{i.call(t)}catch{}}}}}function gK(t,e){if(e){const r=document.body;t.autofocus=!0,vd(()=>{document.activeElement===r&&t.focus()})}}function yK(t){var e=zr,r=lr;vs(null),mi(null);try{return t()}finally{vs(e),mi(r)}}const KB=new Set,ST=new Set;function Vx(t,e,r,n){function a(i){if(n.capture||Hh.call(e,i),!i.cancelBubble)return yK(()=>r.call(this,i))}return t.startsWith("pointer")||t.startsWith("touch")||t==="wheel"?vd(()=>{e.addEventListener(t,a,n)}):e.addEventListener(t,a,n),a}function vK(t,e,r,n={}){var a=Vx(e,t,r,n);return()=>{t.removeEventListener(e,a,n)}}function jo(t,e,r,n,a){var i={capture:n,passive:a},o=Vx(t,e,r,i);(e===document.body||e===window||e===document)&&DB(()=>{e.removeEventListener(t,o,i)})}function Gb(t){for(var e=0;e<t.length;e++)KB.add(t[e]);for(var r of ST)r(t)}function Hh(t){var e,r=this,n=r.ownerDocument,a=t.type,i=((e=t.composedPath)==null?void 0:e.call(t))||[],o=i[0]||t.target,c=0,u=t.__root;if(u){var d=i.indexOf(u);if(d!==-1&&(r===document||r===window)){t.__root=r;return}var f=i.indexOf(r);if(f===-1)return;d<=f&&(c=d)}if(o=i[c]||t.target,o!==r){DW(t,"currentTarget",{configurable:!0,get(){return o||n}});var h=zr,m=lr;vs(null),mi(null);try{for(var _,w=[];o!==null;){var b=o.assignedSlot||o.parentNode||o.host||null;try{var E=o["__"+a];if(E!==void 0&&!o.disabled)if(Fb(E)){var[T,...D]=E;T.apply(o,[t,...D])}else E.call(o,t)}catch(P){_?w.push(P):_=P}if(t.cancelBubble||b===r||b===null)break;o=b}if(_){for(let P of w)queueMicrotask(()=>{throw P});throw _}}finally{t.__root=r,delete t.currentTarget,vs(h),mi(m)}}}function Hx(t){var e=document.createElement("template");return e.innerHTML=t,e.content}function cd(t,e){var r=lr;r.nodes_start===null&&(r.nodes_start=t,r.nodes_end=e)}function lt(t,e){var r=(e&bW)!==0,n=(e&kW)!==0,a,i=!t.startsWith("<!>");return()=>{a===void 0&&(a=Hx(i?t:"<!>"+t),r||(a=sd(a)));var o=n?document.importNode(a,!0):a.cloneNode(!0);if(r){var c=sd(o),u=o.lastChild;cd(c,u)}else cd(o,o);return o}}function Qo(t,e,r="svg"){var n=!t.startsWith("<!>"),a=`<${r}>${n?t:"<!>"+t}</${r}>`,i;return()=>{if(!i){var o=Hx(a),c=sd(o);i=sd(c)}var u=i.cloneNode(!0);return cd(u,u),u}}function Ur(t=""){{var e=Rg(t+"");return cd(e,e),e}}function wr(){var t=document.createDocumentFragment(),e=document.createComment(""),r=Rg();return t.append(e,r),cd(e,r),t}function ke(t,e){t!==null&&t.before(e)}let L_=!0;function RO(t){L_=t}function hr(t,e){var r=e==null?"":typeof e=="object"?e+"":e;r!==(t.__t??(t.__t=t.nodeValue))&&(t.__t=r,t.nodeValue=r==null?"":r+"")}function ET(t,e){return _K(t,e)}const sf=new Map;function _K(t,{target:e,anchor:r,props:n={},events:a,context:i,intro:o=!0}){YW();var c=new Set,u=h=>{for(var m=0;m<h.length;m++){var _=h[m];if(!c.has(_)){c.add(_);var w=PW(_);e.addEventListener(_,Hh,{passive:w});var b=sf.get(_);b===void 0?(document.addEventListener(_,Hh,{passive:w}),sf.set(_,1)):sf.set(_,b+1)}}};u(Mx(KB)),ST.add(u);var d=void 0,f=tK(()=>{var h=r??e.appendChild(Rg());return ps(()=>{if(i){Wt({});var m=Dr;m.c=i}a&&(n.$$events=a),L_=o,d=t(h,n)||{},L_=!0,i&&Kt()}),()=>{var m;for(var _ of c){e.removeEventListener(_,Hh);var w=sf.get(_);--w===0?(document.removeEventListener(_,Hh),sf.delete(_)):sf.set(_,w)}ST.delete(u),h!==r&&((m=h.parentNode)==null||m.removeChild(h))}});return TT.set(d,f),d}let TT=new WeakMap;function Kv(t,e){const r=TT.get(t);return r?(TT.delete(t),r(e)):Promise.resolve()}function xt(t,e,r=!1){var n=t,a=null,i=null,o=ri,c=r?uu:0,u=!1;const d=(h,m=!0)=>{u=!0,f(m,h)},f=(h,m)=>{o!==(o=h)&&(o?(a?Om(a):m&&(a=ps(()=>m(n))),i&&od(i,()=>{i=null})):(i?Om(i):m&&(i=ps(()=>m(n))),a&&od(a,()=>{a=null})))};du(()=>{u=!1,e(d),u||f(null,null)},c)}function sp(t,e){return e}function bK(t,e,r,n){for(var a=[],i=e.length,o=0;o<i;o++)Fx(e[o].e,a,!0);var c=i>0&&a.length===0&&r!==null;if(c){var u=r.parentNode;XW(u),u.append(r),n.clear(),Pl(t,e[0].prev,e[i-1].next)}jB(a,()=>{for(var d=0;d<i;d++){var f=e[d];c||(n.delete(f.k),Pl(t,f.prev,f.next)),ys(f.e,!c)}})}function op(t,e,r,n,a,i=null){var o=t,c={flags:e,items:new Map,first:null},u=(e&mB)!==0;if(u){var d=t;o=d.appendChild(Rg())}var f=null,h=!1;du(()=>{var m=r(),_=Fb(m)?m:m==null?[]:Mx(m),w=_.length;if(!(h&&w===0)){h=w===0;{var b=zr;kK(_,c,o,a,e,(b.f&Uo)!==0,n)}i!==null&&(w===0?f?Om(f):f=ps(()=>i(o)):f!==null&&od(f,()=>{f=null})),r()}})}function kK(t,e,r,n,a,i,o,c){var u,d,f,h,m=(a&uW)!==0,_=(a&(Nx|Ix))!==0,w=t.length,b=e.items,E=e.first,T=E,D,P=null,A,C=[],O=[],I,x,R,N;if(m)for(N=0;N<w;N+=1)I=t[N],x=o(I,N),R=b.get(x),R!==void 0&&((u=R.a)==null||u.measure(),(A??(A=new Set)).add(R));for(N=0;N<w;N+=1){if(I=t[N],x=o(I,N),R=b.get(x),R===void 0){var L=T?T.e.nodes_start:r;P=SK(L,e,P,P===null?e.first:P.next,I,x,N,n,a),b.set(x,P),C=[],O=[],T=P.next;continue}if(_&&wK(R,I,N,a),(R.e.f&Uo)!==0&&(Om(R.e),m&&((d=R.a)==null||d.unfix(),(A??(A=new Set)).delete(R))),R!==T){if(D!==void 0&&D.has(R)){if(C.length<O.length){var j=O[0],q;P=j.prev;var U=C[0],W=C[C.length-1];for(q=0;q<C.length;q+=1)DO(C[q],j,r);for(q=0;q<O.length;q+=1)D.delete(O[q]);Pl(e,U.prev,W.next),Pl(e,P,U),Pl(e,W,j),T=j,P=W,N-=1,C=[],O=[]}else D.delete(R),DO(R,T,r),Pl(e,R.prev,R.next),Pl(e,R,P===null?e.first:P.next),Pl(e,P,R),P=R;continue}for(C=[],O=[];T!==null&&T.k!==x;)(i||(T.e.f&Uo)===0)&&(D??(D=new Set)).add(T),O.push(T),T=T.next;if(T===null)continue;R=T}C.push(R),P=R,T=R.next}if(T!==null||D!==void 0){for(var F=D===void 0?[]:Mx(D);T!==null;)(i||(T.e.f&Uo)===0)&&F.push(T),T=T.next;var Y=F.length;if(Y>0){var Q=(a&mB)!==0&&w===0?r:null;if(m){for(N=0;N<Y;N+=1)(f=F[N].a)==null||f.measure();for(N=0;N<Y;N+=1)(h=F[N].a)==null||h.fix()}bK(e,F,Q,b)}}m&&vd(()=>{var ie;if(A!==void 0)for(R of A)(ie=R.a)==null||ie.apply()}),lr.first=e.first&&e.first.e,lr.last=P&&P.e}function wK(t,e,r,n){(n&Nx)!==0&&_T(t.v,e),(n&Ix)!==0?_T(t.i,r):t.i=r}function SK(t,e,r,n,a,i,o,c,u,d){var f=(u&Nx)!==0,h=(u&dW)===0,m=f?h?zb(a):ai(a):a,_=(u&Ix)===0?o:ai(o),w={i:_,v:m,k:i,a:null,e:null,prev:r,next:n};try{return w.e=ps(()=>c(t,m,_),Bx),w.e.prev=r&&r.e,w.e.next=n&&n.e,r===null?e.first=w:(r.next=w,r.e.next=w.e),n!==null&&(n.prev=w,n.e.prev=w.e),w}finally{}}function DO(t,e,r){for(var n=t.next?t.next.e.nodes_start:r,a=e?e.e.nodes_start:r,i=t.e.nodes_start;i!==n;){var o=$b(i);a.before(i),i=o}}function Pl(t,e,r){e===null?t.first=r:(e.next=r,e.e.next=r&&r.e),r!==null&&(r.prev=e,r.e.prev=e&&e.e)}function fu(t,e,r,n,a){var i=t,o="",c;du(()=>{o!==(o=e()??"")&&(c!==void 0&&(ys(c),c=void 0),o!==""&&(c=ps(()=>{var u=o+"",d=Hx(u);cd(sd(d),d.lastChild),i.before(d)})))})}function Dn(t,e,...r){var n=t,a=Ar,i;du(()=>{a!==(a=e())&&(i&&(ys(i),i=null),i=ps(()=>a(n,...r)))},uu)}function EK(t,e,r){var n=t,a,i;du(()=>{a!==(a=e())&&(i&&(od(i),i=null),a&&(i=ps(()=>r(n,a))))},uu)}function B_(t,e,r,n,a,i){var o,c,u=null,d=t,f;du(()=>{const h=e()||null;var m=h==="svg"?Dm:null;h!==o&&(f&&(h===null?od(f,()=>{f=null,c=null}):h===c?Om(f):(ys(f),RO(!1))),h&&h!==c&&(f=ps(()=>{if(u=m?document.createElementNS(m,h):document.createElement(h),cd(u,u),n){var _=u.appendChild(Rg());n(u,_)}lr.nodes_end=u,d.before(u)})),o=h,o&&(c=o),RO(!0))},uu)}function zt(t,e){vd(()=>{var r=t.getRootNode(),n=r.host?r:r.head??r.ownerDocument.head;if(!n.querySelector("#"+e.hash)){const a=document.createElement("style");a.id=e.hash,a.textContent=e.code,n.appendChild(a)}})}function YB(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var a=t.length;for(e=0;e<a;e++)t[e]&&(r=YB(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function TK(){for(var t,e,r=0,n="",a=arguments.length;r<a;r++)(t=arguments[r])&&(e=YB(t))&&(n&&(n+=" "),n+=e);return n}function XB(t){return typeof t=="object"?TK(t):t??""}function CK(t,e){e?t.hasAttribute("selected")||t.setAttribute("selected",""):t.removeAttribute("selected")}function Ut(t,e,r,n){var a=t.__attributes??(t.__attributes={});a[e]!==(a[e]=r)&&(e==="style"&&"__styles"in t&&(t.__styles={}),e==="loading"&&(t[LW]=r),r==null?t.removeAttribute(e):typeof r!="string"&&JB(t).includes(e)?t[e]=r:t.setAttribute(e,r))}function U_(t,e,r,n,a=!1,i=!1,o=!1){var c=e||{},u=t.tagName==="OPTION";for(var d in e)d in r||(r[d]=null);r.class&&(r.class=XB(r.class)),n!==void 0&&(r.class=r.class?r.class+" "+n:n);var f=JB(t),h=t.__attributes??(t.__attributes={});for(const T in r){let D=r[T];if(u&&T==="value"&&D==null){t.value=t.__value="",c[T]=D;continue}var m=c[T];if(D!==m){c[T]=D;var _=T[0]+T[1];if(_!=="$$"){if(_==="on"){const P={},A="$$"+T;let C=T.slice(2);var w=EW(C);if(wW(C)&&(C=C.slice(0,-7),P.capture=!0),!w&&m){if(D!=null)continue;t.removeEventListener(C,c[A],P),c[A]=null}if(D!=null)if(w)t[`__${C}`]=D,Gb([C]);else{let O=function(I){c[T].call(this,I)};c[A]=Vx(C,t,O,P)}else w&&(t[`__${C}`]=void 0)}else if(T==="style"&&D!=null)t.style.cssText=D+"";else if(T==="autofocus")gK(t,!!D);else if(T==="__value"||T==="value"&&D!=null)t.value=t[T]=t.__value=D;else if(T==="selected"&&u)CK(t,D);else{var b=T;a||(b=CW(b));var E=b==="defaultValue"||b==="defaultChecked";if(D==null&&!i&&!E)if(h[T]=null,b==="value"||b==="checked"){let P=t;if(b==="value"){let A=P.defaultValue;P.removeAttribute(b),P.defaultValue=A}else{let A=P.defaultChecked;P.removeAttribute(b),P.defaultChecked=A}}else t.removeAttribute(T);else E||f.includes(b)&&(i||typeof D!="string")?t[b]=D:typeof D!="function"&&Ut(t,b,D)}T==="style"&&"__styles"in t&&(t.__styles={})}}}return c}var OO=new Map;function JB(t){var e=OO.get(t.nodeName);if(e)return e;OO.set(t.nodeName,e=[]);for(var r,n=t,a=Element.prototype;a!==n;){r=gB(n);for(var i in r)r[i].set&&e.push(i);n=jx(n)}return e}function xK(t,e,r){var n=t.__className,a=QB(e,r);(n!==a||Bx)&&(a===""?t.removeAttribute("class"):t.setAttribute("class",a),t.__className=a)}function Ql(t,e,r){var n=t.__className,a=QB(e,r);(n!==a||Bx)&&(e==null&&!r?t.removeAttribute("class"):t.className=a,t.__className=a)}function QB(t,e){return(t??"")+(e?" "+e:"")}function Lc(t,e,r){if(r){if(t.classList.contains(e))return;t.classList.add(e)}else{if(!t.classList.contains(e))return;t.classList.remove(e)}}const PK=()=>performance.now(),Cc={tick:(t=>requestAnimationFrame(t)),now:()=>PK(),tasks:new Set};function ZB(){const t=Cc.now();Cc.tasks.forEach(e=>{e.c(t)||(Cc.tasks.delete(e),e.f())}),Cc.tasks.size!==0&&Cc.tick(ZB)}function AK(t){let e;return Cc.tasks.size===0&&Cc.tick(ZB),{promise:new Promise(r=>{Cc.tasks.add(e={c:t,f:r})}),abort(){Cc.tasks.delete(e)}}}function sv(t,e){t.dispatchEvent(new CustomEvent(e))}function RK(t){if(t==="float")return"cssFloat";if(t==="offset")return"cssOffset";if(t.startsWith("--"))return t;const e=t.split("-");return e.length===1?e[0]:e[0]+e.slice(1).map(r=>r[0].toUpperCase()+r.slice(1)).join("")}function NO(t){const e={},r=t.split(";");for(const n of r){const[a,i]=n.split(":");if(!a||i===void 0)break;const o=RK(a.trim());e[o]=i.trim()}return e}const DK=t=>t;function eU(t,e,r,n){var a=(t&yW)!==0,i=(t&vW)!==0,o=a&&i,c=(t&_W)!==0,u=o?"both":a?"in":"out",d,f=e.inert,h,m;function _(){var D=zr,P=lr;vs(null),mi(null);try{return d??(d=r()(e,n?.()??{},{direction:u}))}finally{vs(D),mi(P)}}var w={is_global:c,in(){var D;if(e.inert=f,!a){m?.abort(),(D=m?.reset)==null||D.call(m);return}i||h==null||h.abort(),sv(e,"introstart"),h=CT(e,_(),m,1,()=>{sv(e,"introend"),h?.abort(),h=d=void 0})},out(D){if(!i){D?.(),d=void 0;return}e.inert=!0,sv(e,"outrostart"),m=CT(e,_(),h,0,()=>{sv(e,"outroend"),D?.()})},stop:()=>{h?.abort(),m?.abort()}},b=lr;if((b.transitions??(b.transitions=[])).push(w),a&&L_){var E=c;if(!E){for(var T=b.parent;T&&(T.f&uu)!==0;)for(;(T=T.parent)&&(T.f&qb)===0;);E=!T||(T.f&vB)!==0}E&&Vb(()=>{Ko(()=>w.in())})}}function CT(t,e,r,n,a){var i=n===1;if(yf(e)){var o,c=!1;return vd(()=>{if(!c){var E=e({direction:i?"in":"out"});o=CT(t,E,r,n,a)}}),{abort:()=>{c=!0,o?.abort()},deactivate:()=>o.deactivate(),reset:()=>o.reset(),t:()=>o.t()}}if(r?.deactivate(),!(e!=null&&e.duration))return a(),{abort:Ar,deactivate:Ar,reset:Ar,t:()=>n};const{delay:u=0,css:d,tick:f,easing:h=DK}=e;var m=[];if(i&&r===void 0&&(f&&f(0,1),d)){var _=NO(d(0,1));m.push(_,_)}var w=()=>1-n,b=t.animate(m,{duration:u});return b.onfinish=()=>{var E=r?.t()??1-n;r?.abort();var T=n-E,D=e.duration*Math.abs(T),P=[];if(D>0){if(d)for(var A=Math.ceil(D/16.666666666666668),C=0;C<=A;C+=1){var O=E+T*h(C/A),I=d(O,1-O);P.push(NO(I))}w=()=>{var x=b.currentTime;return E+T*h(x/D)},f&&AK(()=>{if(b.playState!=="running")return!1;var x=w();return f(x,1-x),!0})}b=t.animate(P,{duration:D,fill:"forwards"}),b.onfinish=()=>{w=()=>n,f?.(n,1-n),a()}},{abort:()=>{b&&(b.cancel(),b.effect=null,b.onfinish=Ar)},deactivate:()=>{a=Ar},reset:()=>{n===0&&f?.(1,0)},t:()=>w()}}function IO(t,e){return t===e||t?.[Fl]===e}function tU(t={},e,r,n){return Vb(()=>{var a,i;return Dg(()=>{a=i,i=[],Ko(()=>{t!==r(...i)&&(e(t,...i),a&&IO(r(...a),t)&&e(null,...a))})}),()=>{vd(()=>{i&&IO(r(...i),t)&&e(null,...i)})}}),t}function ws(t=!1){const e=Dr,r=e.l.u;if(!r)return;let n=()=>Wv(e.s);if(t){let a=0,i={};const o=ze(()=>{let c=!1;const u=e.s;for(const d in u)u[d]!==i[d]&&(i[d]=u[d],c=!0);return c&&a++,a});n=()=>$(o)}r.b.length&&eK(()=>{MO(e,n),N_(r.b)}),ip(()=>{const a=Ko(()=>r.m.map(IW));return()=>{for(const i of a)typeof i=="function"&&i()}}),r.a.length&&ip(()=>{MO(e,n),N_(r.a)})}function MO(t,e){if(t.l.s)for(const r of t.l.s)$(r);e()}function rU(t,e){var r,n=(r=t.$$events)==null?void 0:r[e.type],a=Fb(n)?n.slice():n==null?[]:[n];for(var i of a)i.call(this,e)}function _s(t){Dr===null&&qx(),Cp&&Dr.l!==null?OK(Dr).m.push(t):ip(()=>{const e=Ko(t);if(typeof e=="function")return e})}function Ig(t){Dr===null&&qx(),_s(()=>()=>Ko(t))}function OK(t){var e=t.l;return e.u??(e.u={a:[],b:[],m:[]})}function nU(t,e,r){if(t==null)return e(void 0),r&&r(void 0),Ar;const n=Ko(()=>t.subscribe(e,r));return n.unsubscribe?()=>n.unsubscribe():n}let ov=!1;function ha(t,e,r){const n=r[e]??(r[e]={store:null,source:zb(void 0),unsubscribe:Ar});if(n.store!==t)if(n.unsubscribe(),n.store=t??null,t==null)n.source.v=void 0,n.unsubscribe=Ar;else{var a=!0;n.unsubscribe=nU(t,i=>{a?n.source.v=i:pt(n.source,i)}),a=!1}return $(n.source)}function NK(t,e){return t.set(e),e}function Aa(){const t={};return DB(()=>{for(var e in t)t[e].unsubscribe()}),t}function IK(t){var e=ov;try{return ov=!1,[t(),ov]}finally{ov=e}}const MK={get(t,e){if(!t.exclude.includes(e))return t.props[e]},set(t,e){return!1},getOwnPropertyDescriptor(t,e){if(!t.exclude.includes(e)&&e in t.props)return{enumerable:!0,configurable:!0,value:t.props[e]}},has(t,e){return t.exclude.includes(e)?!1:e in t.props},ownKeys(t){return Reflect.ownKeys(t.props).filter(e=>!t.exclude.includes(e))}};function pu(t,e,r){return new Proxy({props:t,exclude:e},MK)}const jK={get(t,e){let r=t.props.length;for(;r--;){let n=t.props[r];if(yf(n)&&(n=n()),typeof n=="object"&&n!==null&&e in n)return n[e]}},set(t,e,r){let n=t.props.length;for(;n--;){let a=t.props[n];yf(a)&&(a=a());const i=Ul(a,e);if(i&&i.set)return i.set(r),!0}return!1},getOwnPropertyDescriptor(t,e){let r=t.props.length;for(;r--;){let n=t.props[r];if(yf(n)&&(n=n()),typeof n=="object"&&n!==null&&e in n){const a=Ul(n,e);return a&&!a.configurable&&(a.configurable=!0),a}}},has(t,e){if(e===Fl||e===bB)return!1;for(let r of t.props)if(yf(r)&&(r=r()),r!=null&&e in r)return!0;return!1},ownKeys(t){const e=[];for(let r of t.props){yf(r)&&(r=r());for(const n in r)e.includes(n)||e.push(n)}return e}};function qc(...t){return new Proxy({props:t},jK)}function jO(t){for(var e=lr,r=lr;e!==null&&(e.f&(no|Pg))===0;)e=e.parent;try{return mi(e),t()}finally{mi(r)}}function It(t,e,r,n){var a,i=(r&fW)!==0,o=!Cp||(r&pW)!==0,c=(r&mW)!==0,u=(r&gW)!==0,d=!1,f;c?[f,d]=IK(()=>t[e]):f=t[e];var h=Fl in t||bB in t,m=((a=Ul(t,e))==null?void 0:a.set)??(h&&c&&e in t?x=>t[e]=x:void 0),_=n,w=!0,b=!1,E=()=>(b=!0,w&&(w=!1,u?_=Ko(n):_=n),_);f===void 0&&n!==void 0&&(m&&o&&zW(),f=E(),m&&m(f));var T;if(o)T=()=>{var x=t[e];return x===void 0?E():(w=!0,b=!1,x)};else{var D=jO(()=>(i?ze:Mf)(()=>t[e]));D.f|=MW,T=()=>{var x=$(D);return x!==void 0&&(_=void 0),x===void 0?_:x}}if((r&hW)===0)return T;if(m){var P=t.$$legacy;return function(x,R){return arguments.length>0?((!o||!R||P||d)&&m(R?T():x),x):T()}}var A=!1,C=!1,O=zb(f),I=jO(()=>ze(()=>{var x=T(),R=$(O);return A?(A=!1,C=!0,R):(C=!1,O.v=x)}));return i||(I.equals=Lx),function(x,R){if(arguments.length>0){const N=R?$(I):o&&c?Vt(x):x;return I.equals(N)||(A=!0,pt(O,N),b&&_!==void 0&&(_=N),Ko(()=>$(I))),x}return $(I)}}function LO(t,e){var r=lr,n=zr,a=Dr;mi(t),vs(t),AO(t.ctx);try{e()}finally{mi(r),vs(n),AO(a)}}function LK(t,e,r){var n=t,a;du(()=>{var i=lr,o=!1;i.fn=c=>{var u=e.onerror;let d=e.failed;if(!u&&!d||o)throw c;var f=()=>{od(a),LO(i,()=>{o=!1,a=ps(()=>r(n)),Vw()})};u?.(c,f),a&&ys(a),d&&vd(()=>{LO(i,()=>{o=!0;try{a=ps(()=>{d(n,()=>c,()=>f)})}catch(h){Og(h,i,null,i.ctx)}Vw(),o=!1})})},a=ps(()=>r(n)),Vw()},uu|I_)}var Un=(t=>(t[t.UnknownError=0]="UnknownError",t[t.UserCancelledError=1]="UserCancelledError",t[t.StoreProblemError=2]="StoreProblemError",t[t.PurchaseNotAllowedError=3]="PurchaseNotAllowedError",t[t.PurchaseInvalidError=4]="PurchaseInvalidError",t[t.ProductNotAvailableForPurchaseError=5]="ProductNotAvailableForPurchaseError",t[t.ProductAlreadyPurchasedError=6]="ProductAlreadyPurchasedError",t[t.ReceiptAlreadyInUseError=7]="ReceiptAlreadyInUseError",t[t.InvalidReceiptError=8]="InvalidReceiptError",t[t.MissingReceiptFileError=9]="MissingReceiptFileError",t[t.NetworkError=10]="NetworkError",t[t.InvalidCredentialsError=11]="InvalidCredentialsError",t[t.UnexpectedBackendResponseError=12]="UnexpectedBackendResponseError",t[t.InvalidAppUserIdError=14]="InvalidAppUserIdError",t[t.OperationAlreadyInProgressError=15]="OperationAlreadyInProgressError",t[t.UnknownBackendError=16]="UnknownBackendError",t[t.InvalidAppleSubscriptionKeyError=17]="InvalidAppleSubscriptionKeyError",t[t.IneligibleError=18]="IneligibleError",t[t.InsufficientPermissionsError=19]="InsufficientPermissionsError",t[t.PaymentPendingError=20]="PaymentPendingError",t[t.InvalidSubscriberAttributesError=21]="InvalidSubscriberAttributesError",t[t.LogOutWithAnonymousUserError=22]="LogOutWithAnonymousUserError",t[t.ConfigurationError=23]="ConfigurationError",t[t.UnsupportedError=24]="UnsupportedError",t[t.EmptySubscriberAttributesError=25]="EmptySubscriberAttributesError",t[t.CustomerInfoError=28]="CustomerInfoError",t[t.SignatureVerificationError=36]="SignatureVerificationError",t[t.InvalidEmailError=38]="InvalidEmailError",t))(Un||{});class om{static getPublicMessage(e){switch(e){case 0:return"Unknown error.";case 1:return"Purchase was cancelled.";case 2:return"There was a problem with the store.";case 3:return"The device or user is not allowed to make the purchase.";case 4:return"One or more of the arguments provided are invalid.";case 5:return"The product is not available for purchase.";case 6:return"This product is already active for the user.";case 7:return"There is already another active subscriber using the same receipt.";case 8:return"The receipt is not valid.";case 9:return"The receipt is missing.";case 10:return"Error performing request. Please check your network connection and try again.";case 11:return"There was a credentials issue. Check the underlying error for more details.";case 12:return"Received unexpected response from the backend.";case 14:return"The app user id is not valid.";case 15:return"The operation is already in progress.";case 16:return"There was an unknown backend error.";case 17:return"Apple Subscription Key is invalid or not present. In order to provide subscription offers, you must first generate a subscription key. Please see https://docs.revenuecat.com/docs/ios-subscription-offers for more info.";case 18:return"The User is ineligible for that action.";case 19:return"App does not have sufficient permissions to make purchases.";case 20:return"The payment is pending.";case 21:return"One or more of the attributes sent could not be saved.";case 22:return"Called logOut but the current user is anonymous.";case 23:return"There is an issue with your configuration. Check the underlying error for more details.";case 24:return"There was a problem with the operation. Looks like we doesn't support that yet. Check the underlying error for more details.";case 25:return"A request for subscriber attributes returned none.";case 28:return"There was a problem related to the customer info.";case 36:return"Request failed signature verification. Please see https://rev.cat/trusted-entitlements for more info.";case 38:return"Email is not valid. Please provide a valid email address."}}static getErrorCodeForBackendErrorCode(e){switch(e){case 7101:case 7773:case 7898:case 7899:case 7900:case 7901:return 2;case 7102:return 7;case 7103:return 8;case 7107:case 7224:case 7225:return 11;case 7105:case 7106:case 7814:case 7877:case 7878:return 4;case 7772:return 6;case 7220:return 14;case 7259:return 28;case 7229:return 2;case 7230:case 7e3:return 23;case 7231:return 2;case 7232:return 18;case 7263:case 7264:return 21;case 7104:case 7234:case 7226:case 7110:return 12;case 7662:return 24;case 7012:case 7834:case 7879:return 38}}static convertCodeToBackendErrorCode(e){return e in cm?e:null}static convertPurchaseFlowErrorCodeToErrorCode(e){switch(e){case Hr.ErrorSettingUpPurchase:return 2;case Hr.ErrorChargingPayment:return 20;case Hr.NetworkError:return 10;case Hr.MissingEmailError:return 4;case Hr.AlreadyPurchasedError:return 6;default:return 0}}}var cm=(t=>(t[t.BackendInvalidPlatform=7e3]="BackendInvalidPlatform",t[t.BackendInvalidEmail=7012]="BackendInvalidEmail",t[t.BackendStoreProblem=7101]="BackendStoreProblem",t[t.BackendCannotTransferPurchase=7102]="BackendCannotTransferPurchase",t[t.BackendInvalidReceiptToken=7103]="BackendInvalidReceiptToken",t[t.BackendInvalidAppStoreSharedSecret=7104]="BackendInvalidAppStoreSharedSecret",t[t.BackendInvalidPaymentModeOrIntroPriceNotProvided=7105]="BackendInvalidPaymentModeOrIntroPriceNotProvided",t[t.BackendProductIdForGoogleReceiptNotProvided=7106]="BackendProductIdForGoogleReceiptNotProvided",t[t.BackendInvalidPlayStoreCredentials=7107]="BackendInvalidPlayStoreCredentials",t[t.BackendInternalServerError=7110]="BackendInternalServerError",t[t.BackendEmptyAppUserId=7220]="BackendEmptyAppUserId",t[t.BackendInvalidAuthToken=7224]="BackendInvalidAuthToken",t[t.BackendInvalidAPIKey=7225]="BackendInvalidAPIKey",t[t.BackendBadRequest=7226]="BackendBadRequest",t[t.BackendPlayStoreQuotaExceeded=7229]="BackendPlayStoreQuotaExceeded",t[t.BackendPlayStoreInvalidPackageName=7230]="BackendPlayStoreInvalidPackageName",t[t.BackendPlayStoreGenericError=7231]="BackendPlayStoreGenericError",t[t.BackendUserIneligibleForPromoOffer=7232]="BackendUserIneligibleForPromoOffer",t[t.BackendInvalidAppleSubscriptionKey=7234]="BackendInvalidAppleSubscriptionKey",t[t.BackendSubscriberNotFound=7259]="BackendSubscriberNotFound",t[t.BackendInvalidSubscriberAttributes=7263]="BackendInvalidSubscriberAttributes",t[t.BackendInvalidSubscriberAttributesBody=7264]="BackendInvalidSubscriberAttributesBody",t[t.BackendProductIDsMalformed=7662]="BackendProductIDsMalformed",t[t.BackendAlreadySubscribedError=7772]="BackendAlreadySubscribedError",t[t.BackendPaymentGatewayGenericError=7773]="BackendPaymentGatewayGenericError",t[t.BackendOfferNotFound=7814]="BackendOfferNotFound",t[t.BackendNoMXRecordsFound=7834]="BackendNoMXRecordsFound",t[t.BackendInvalidOperationSession=7877]="BackendInvalidOperationSession",t[t.BackendPurchaseCannotBeCompleted=7878]="BackendPurchaseCannotBeCompleted",t[t.BackendEmailIsRequired=7879]="BackendEmailIsRequired",t[t.BackendGatewaySetupErrorStripeTaxNotActive=7898]="BackendGatewaySetupErrorStripeTaxNotActive",t[t.BackendGatewaySetupErrorInvalidTaxOriginAddress=7899]="BackendGatewaySetupErrorInvalidTaxOriginAddress",t[t.BackendGatewaySetupErrorMissingRequiredPermission=7900]="BackendGatewaySetupErrorMissingRequiredPermission",t[t.BackendGatewaySetupErrorSandboxModeOnly=7901]="BackendGatewaySetupErrorSandboxModeOnly",t))(cm||{});class bn extends Error{constructor(e,r,n,a){super(r),vt(this,"toString",()=>`PurchasesError(code: ${Un[this.errorCode]}, message: ${this.message})`),this.errorCode=e,this.underlyingErrorMessage=n,this.extra=a}static getForBackendError(e,r){const n=om.getErrorCodeForBackendErrorCode(e);return new bn(n,om.getPublicMessage(n),r,{backendErrorCode:e})}static getForPurchasesFlowError(e){return new bn(om.convertPurchaseFlowErrorCodeToErrorCode(e.errorCode),e.message,e.underlyingErrorMessage)}}class BK extends Error{constructor(){super("Purchases must be configured before calling getInstance")}}var Gh=(t=>(t.Started="started",t.InProgress="in_progress",t.Succeeded="succeeded",t.Failed="failed",t))(Gh||{}),vf=(t=>(t[t.SetupIntentCreationFailed=1]="SetupIntentCreationFailed",t[t.PaymentMethodCreationFailed=2]="PaymentMethodCreationFailed",t[t.PaymentChargeFailed=3]="PaymentChargeFailed",t[t.SetupIntentCompletionFailed=4]="SetupIntentCompletionFailed",t[t.AlreadyPurchased=5]="AlreadyPurchased",t))(vf||{}),Oi=(t=>(t[t.Silent=0]="Silent",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug",t[t.Verbose=5]="Verbose",t))(Oi||{});class tr{static setLogLevel(e){this.logLevel=e}static setLogHandler(e){this.logHandler=e}static log(e,r=this.logLevel){const n=`[Purchases] ${e}`;if(!(this.logLevel<r||r===Oi.Silent)){if(this.logHandler!==null){this.logHandler(r,n);return}switch(r){case Oi.Error:break;case Oi.Warn:break;case Oi.Info:break;case Oi.Debug:break;case Oi.Verbose:break}}}static errorLog(e){this.log(e,Oi.Error)}static warnLog(e){this.log(e,Oi.Warn)}static infoLog(e){this.log(e,Oi.Info)}static debugLog(e){this.log(e,Oi.Debug)}static verboseLog(e){this.log(e,Oi.Verbose)}}vt(tr,"logLevel",Oi.Silent),vt(tr,"logHandler",null);function UK(t){var e;return t.operation.redemption_info?{redeemUrl:((e=t.operation.redemption_info)==null?void 0:e.redeem_url)??null}:null}var Hr=(t=>(t[t.ErrorSettingUpPurchase=0]="ErrorSettingUpPurchase",t[t.ErrorChargingPayment=1]="ErrorChargingPayment",t[t.UnknownError=2]="UnknownError",t[t.NetworkError=3]="NetworkError",t[t.MissingEmailError=4]="MissingEmailError",t[t.AlreadyPurchasedError=5]="AlreadyPurchasedError",t[t.StripeTaxNotActive=6]="StripeTaxNotActive",t[t.StripeInvalidTaxOriginAddress=7]="StripeInvalidTaxOriginAddress",t[t.StripeMissingRequiredPermission=8]="StripeMissingRequiredPermission",t))(Hr||{});class on extends Error{constructor(e,r,n,a,i){super(r),this.errorCode=e,this.underlyingErrorMessage=n,this.purchasesErrorCode=a,this.extra=i}getErrorCode(){var e;return((e=this.extra)==null?void 0:e.backendErrorCode)??this.purchasesErrorCode??this.errorCode}static fromPurchasesError(e,r){var n;let a;return e.errorCode===Un.ProductAlreadyPurchasedError?a=5:e.errorCode===Un.InvalidEmailError?a=4:e.errorCode===Un.NetworkError?a=3:a=on.fromBackendErrorCode((n=e.extra)==null?void 0:n.backendErrorCode)??r,new on(a,e.message,e.underlyingErrorMessage,e.errorCode,e.extra)}static fromBackendErrorCode(e){switch(e){case cm.BackendGatewaySetupErrorStripeTaxNotActive:return 6;case cm.BackendGatewaySetupErrorInvalidTaxOriginAddress:return 7;case cm.BackendGatewaySetupErrorMissingRequiredPermission:return 8;default:return null}}}class FK{constructor(e,r,n=10){vt(this,"operationSessionId",null),vt(this,"backend"),vt(this,"eventsTracker"),vt(this,"maxNumberAttempts"),vt(this,"waitMSBetweenAttempts",1e3),this.backend=e,this.eventsTracker=r,this.maxNumberAttempts=n}async checkoutStart(e,r,n,a,i,o){try{const c=this.eventsTracker.getTraceId(),u=await this.backend.postCheckoutStart(e,r,a,n,c,i,o);return this.operationSessionId=u.operation_session_id,u}catch(c){if(c instanceof bn)throw on.fromPurchasesError(c,0);{const u="Unknown error starting purchase: "+String(c);throw tr.errorLog(u),new on(2,u)}}}async checkoutCalculateTax(e,r,n){const a=this.operationSessionId;if(!a)throw new on(0,"No purchase started");try{return await this.backend.postCheckoutCalculateTax(a,e,r,n)}catch(i){if(i instanceof bn)throw on.fromPurchasesError(i,0);{const o="Unknown error calculating tax: "+String(i);throw tr.errorLog(o),new on(2,o)}}}async checkoutComplete(e){const r=this.operationSessionId;if(!r)throw new on(0,"No purchase started");try{return await this.backend.postCheckoutComplete(r,e)}catch(n){if(n instanceof bn)throw on.fromPurchasesError(n,0);{const a="Unknown error starting purchase: "+String(n);throw tr.errorLog(a),new on(2,a)}}}async pollCurrentPurchaseForCompletion(){const e=this.operationSessionId;if(!e)throw new on(0,"No purchase in progress");return new Promise((r,n)=>{const a=(i=1)=>{if(i>this.maxNumberAttempts){this.clearPurchaseInProgress(),n(new on(2,"Max attempts reached trying to get successful purchase status"));return}this.backend.getCheckoutStatus(e).then(o=>{const c=o.operation.store_transaction_identifier,u=o.operation.product_identifier,d=o.operation.purchase_date?isNaN(Date.parse(o.operation.purchase_date))?null:new Date(o.operation.purchase_date):null;switch(o.operation.status){case Gh.Started:case Gh.InProgress:setTimeout(()=>a(i+1),this.waitMSBetweenAttempts);break;case Gh.Succeeded:if(this.clearPurchaseInProgress(),!c||!u||!d){n(new on(2,"Missing required fields in operation response."));return}r({redemptionInfo:UK(o),operationSessionId:e,storeTransactionIdentifier:c,productIdentifier:u,purchaseDate:d});return;case Gh.Failed:this.clearPurchaseInProgress(),this.handlePaymentError(o.operation.error,n)}}).catch(o=>{const c=on.fromPurchasesError(o,3);n(c)})};a()})}clearPurchaseInProgress(){this.operationSessionId=null}handlePaymentError(e,r){if(e==null){r(new on(2,"Got an error status but error field is empty."));return}switch(e.code){case vf.SetupIntentCreationFailed:r(new on(0,"Setup intent creation failed"));return;case vf.PaymentMethodCreationFailed:r(new on(0,"Payment method creation failed"));return;case vf.PaymentChargeFailed:r(new on(1,"Payment charge failed"));return;case vf.SetupIntentCompletionFailed:r(new on(0,"Setup intent completion failed"));return;case vf.AlreadyPurchased:r(new on(5,"Purchased was already completed"));return;default:r(new on(2,"Unknown error code received"));return}}}const Bi="rcb-ui-translator",Bf="en",qK={"periods.week":"{{amount}} week","periods.month":"{{amount}} month","periods.year":"{{amount}} year","periods.day":"{{amount}} day","periods.weekShort":"{{amount}}wk","periods.monthShort":"{{amount}}mo","periods.yearShort":"{{amount}}yr","periods.dayShort":"{{amount}}d","periods.lifetime":"lifetime","periods.weekPlural":"{{amount}} weeks","periods.monthPlural":"{{amount}} months","periods.yearPlural":"{{amount}} years","periods.dayPlural":"{{amount}} days","periods.weekFrequency":"weekly","periods.monthFrequency":"monthly","periods.yearFrequency":"yearly","periods.dayFrequency":"daily","periods.perWeekFrequency":"per week","periods.perMonthFrequency":"per month","periods.perYearFrequency":"per year","periods.perDayFrequency":"per day","periods.unknownFrequency":"unknown","periods.weekFrequencyPlural":"every {{amount}} weeks","periods.monthFrequencyPlural":"every {{amount}} months","periods.yearFrequencyPlural":"every {{amount}} years","periods.dayFrequencyPlural":"every {{amount}} days","product_info.subscribe_to":"Subscribe to","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"Try free for {{trialDuration}}","product_info.price_after_free_trial":"After trial ends, on {{renewalDate}}","product_info.intro_price_phase_after_trial":"Then {{introPriceDuration}} for {{introPrice}}","product_info.intro_price_phase":"First {{introPriceDuration}} for {{introPrice}}","product_info.intro_price_phase_paid_once":"paid once","product_info.price_after_intro_price":"After {{introPriceDuration}}, on {{renewalDate}}","product_info.after_trial":"after trial","product_info.after":"after","product_info.total_due_today":"Total due today","product_info.renewal_frequency":"Renews {{frequency}}","product_info.continues_until_cancelled":"Continues until cancelled","product_info.cancel_anytime":"Cancel anytime","payment_entry_page.payment_step_title":"Secure checkout by RevenueCat","payment_entry_page.trial_subscription_terms_info":"After your trial ends, you will be charged {{price}} {{perFrequency}} starting {{renewalDate}}. You can cancel any time before this date.","payment_entry_page.subscription_terms_info":"By subscribing, you agree to allow {{appName}} to charge you according to their terms until you cancel.","payment_entry_page.otp_terms_info":"By purchasing, you agree to allow {{appName}} to charge you according to their terms.","payment_entry_page.subscription_info":"Subscription renews automatically. Cancel anytime.","payment_entry_page.button_pay":"Pay now","payment_entry_page.button_start_trial":"Start trial","payment_entry_page.button_with_price":"Pay {{formattedPrice}}","payment_entry_page.button_payment_method":"Pay {{formattedPrice}} with {{paymentMethod}}","payment_entry_page.express_checkout_divider":"OR PAY BY CARD","success_page.purchase_successful":"Payment complete","success_page.button_close":"Continue","error_page.close_button_title":"Go to {{appName}}","error_page.if_error_persists":"If it persists, please contact ","error_page.trouble_accessing":"If you're having trouble accessing your purchase, reach out to support on ","error_page.error_title_already_subscribed":"You already subscribed to {{productTitle}}","error_page.error_title_already_purchased":"You already purchased {{productTitle}}","error_page.error_title_other_errors":"Something went wrong","error_page.error_message_already_subscribed":"You can't subscribe to this product again.","error_page.error_message_already_purchased":"You can't purchase this product again.","error_page.error_title_stripe_tax_not_active":"Stripe Tax not active","error_page.error_title_stripe_invalid_tax_origin_address":"Invalid tax origin address","error_page.error_title_stripe_missing_required_permission":"Missing Stripe permission","error_page.error_message_missing_email_error":"Email is required to complete the purchase.","error_page.error_message_invalid_email_error":"The email address {{email}} couldn't be verified. Please provide a valid email address.","error_page.error_message_network_error":"Network error. Please check your internet connection.","error_page.error_message_error_charging_payment":"Payment failed.","error_page.error_message_error_setting_up_purchase":"Purchase not started due to an error (error code: {{errorCode}}).","error_page.error_message_invalid_tax_location":"We couldn't verify your billing address. Please double-check that the postal code and country are correct.","error_page.error_message_unknown_error":"An unknown error occurred (error code: {{errorCode}}).","error_page.error_message_stripe_tax_not_active":"The purchase failed because Stripe Tax isn’t enabled. In production, purchases will work without taxes applied.","error_page.error_message_stripe_invalid_tax_origin_address":"The purchase failed because the tax origin address is invalid. In production, purchases will work without taxes applied.","error_page.error_message_stripe_missing_required_permission":"The purchase failed because the Stripe app lacks a required permission. In production, purchases will work without taxes applied.","error_page.error_only_in_sandbox":"This message appears only in sandbox.","error_page.button_try_again":"Try again","error_page.button_close":"Close","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% off","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","pricing_dropdown.show_details":"Show details","pricing_dropdown.hide_details":"Hide details","pricing_table.trial_ends":"After trial ends, on {{formattedTrialEndDate}}","pricing_table.total_excluding_tax":"Total excluding tax","pricing_table.total_due_today":"Total due today","pricing_table.tax":"Tax","pricing_table.enter_billing_address_to_calculate":"Enter billing address to calculate","pricing_table.enter_postal_code_to_calculate":"Enter zip code to calculate","pricing_table.enter_state_or_postal_code_to_calculate":"Enter state or postal code to calculate","navbar_header.details":"Details","navbar_header.back_button":"Back","price_update.title":"Price update","price_update.base_message":"The total price was updated with tax based on your billing address. Please review and try again. Your card will only be charged once.","price_update.trial_message":"The subscription price was updated to include tax based on your billing address. Free trial still applies. Review and try again.","apple_pay.free_trial":"Free Trial"},zK={"periods.week":"{{amount}} semana","periods.month":"{{amount}} mes","periods.year":"{{amount}} año","periods.day":"{{amount}} día","periods.weekShort":"{{amount}} sem","periods.monthShort":"{{amount}}mes","periods.yearShort":"{{amount}}año","periods.dayShort":"{{amount}}d","periods.lifetime":"de por vida","periods.weekPlural":"{{amount}} semanas","periods.monthPlural":"{{amount}} meses","periods.yearPlural":"{{amount}} años","periods.dayPlural":"{{amount}} días","periods.weekFrequency":"semanal","periods.monthFrequency":"mensual","periods.yearFrequency":"anual","periods.dayFrequency":"diaria","periods.perWeekFrequency":"por semana","periods.perMonthFrequency":"por mes","periods.perYearFrequency":"por año","periods.perDayFrequency":"por día","periods.unknownFrequency":"desconocida","periods.weekFrequencyPlural":"cada {{amount}} semanas","periods.monthFrequencyPlural":"cada {{amount}} meses","periods.yearFrequencyPlural":"cada {{amount}} años","periods.dayFrequencyPlural":"cada {{amount}} días","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} prueba gratuita","product_info.price_after_free_trial":"Después de que termine el periodo de prueba, el {{renewalDate}}","product_info.renewal_frequency":"Se renueva {{frequency}}","product_info.continues_until_cancelled":"Continua hasta que se cancele","product_info.cancel_anytime":"Cancelar en cualquier momento","payment_entry_page.payment_step_title":"Pago seguro mediante RevenueCat","payment_entry_page.button_pay":"Pagar ahora","payment_entry_page.button_start_trial":"Comenzar prueba","success_page.purchase_successful":"Pago completado","success_page.button_close":"Continuar","error_page.if_error_persists":"Si el error persiste, contacta con ","error_page.error_title_already_subscribed":"Ya te has suscrito a {{productTitle}}","error_page.error_title_already_purchased":"Ya has comprado {{productTitle}}","error_page.error_title_other_errors":"Algo salió mal","error_page.error_message_already_subscribed":"No puedes suscribirte a este producto de nuevo.","error_page.error_message_already_purchased":"No puedes comprar este producto de nuevo.","error_page.error_message_missing_email_error":"Se requiere un correo electrónico para completar la compra.","error_page.error_message_network_error":"Error de red. Por favor, comprueba tu conexión a internet.","error_page.error_message_error_charging_payment":"Pago fallido.","error_page.error_message_error_setting_up_purchase":"No se pudo iniciar la compra debido a un error (código de error: {{errorCode}}).","error_page.error_message_invalid_tax_location":"No pudimos verificar tu dirección de facturación. Por favor, verifica que el código postal y el país sean correctos.","error_page.error_message_unknown_error":"Ocurrió un error desconocido (código de error: {{errorCode}}).","error_page.button_try_again":"Intentar de nuevo","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% de descuento","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Total a pagar hoy","product_info.subscribe_to":"Suscribirse a","navbar_header.details":"Detalles","navbar_header.back_button":"Atrás","pricing_dropdown.show_details":"Mostrar detalles","pricing_dropdown.hide_details":"Ocultar detalles","pricing_table.tax":"Impuestos","pricing_table.trial_ends":"Después de que finalice la prueba, el {{formattedTrialEndDate}}","pricing_table.total_due_today":"Total a pagar hoy","pricing_table.total_excluding_tax":"Total sin impuestos","pricing_table.enter_billing_address_to_calculate":"Introduce la dirección de facturación para calcular","pricing_table.enter_state_or_postal_code_to_calculate":"Introduce el estado o el código postal para calcular","pricing_table.enter_postal_code_to_calculate":"Introduce el código postal para calcular","error_page.error_message_invalid_email_error":"La dirección de correo electrónico {{email}} no se pudo verificar. Por favor, proporciona una dirección de correo electrónico válida.","payment_entry_page.button_payment_method":"Pagar {{formattedPrice}} con {{paymentMethod}}","payment_entry_page.button_with_price":"Pagar {{formattedPrice}}","price_update.title":"Actualización de precio","price_update.base_message":"El precio total se actualizó con impuestos según su dirección de facturación. Revise e intente nuevamente. Solo se efectuará un cobro en su tarjeta.","price_update.trial_message":"El precio de la suscripción se actualizó para incluir impuestos según su dirección de facturación. La prueba gratuita sigue aplicándose. Revise e intente nuevamente.","payment_entry_page.express_checkout_divider":"O PAGA CON TARJETA","error_page.trouble_accessing":"Si tiene problemas para acceder a su compra, póngase en contacto con el servicio de asistencia en ","error_page.close_button_title":"Ir a {{appName}}","error_page.error_title_stripe_missing_required_permission":"Falta permiso de Stripe","error_page.button_close":"Cerrar","error_page.error_message_stripe_invalid_tax_origin_address":"La compra falló porque la dirección de origen fiscal no es válida. En producción, las compras funcionarán sin impuestos aplicados.","error_page.error_message_stripe_tax_not_active":"La compra falló porque Stripe Tax no está habilitado. En producción, las compras funcionarán sin impuestos aplicados.","error_page.error_only_in_sandbox":"Este mensaje aparece solo en el entorno de pruebas.","error_page.error_message_stripe_missing_required_permission":"La compra falló porque la aplicación Stripe carece de un permiso necesario. En producción, las compras funcionarán sin impuestos aplicados.","error_page.error_title_stripe_tax_not_active":"Stripe Tax no está activo","error_page.error_title_stripe_invalid_tax_origin_address":"Dirección de origen fiscal no válida","apple_pay.free_trial":"Prueba gratuita","product_info.price_after_intro_price":"Después de {{introPriceDuration}}, el {{renewalDate}}","product_info.after_trial":"después del período de prueba","product_info.after":"después de","product_info.intro_price_phase_after_trial":"Luego, {{introPriceDuration}} por {{introPrice}}","product_info.intro_price_phase":"Primero, {{introPriceDuration}} por {{introPrice}}","product_info.intro_price_phase_paid_once":"pago único","payment_entry_page.trial_subscription_terms_info":"Una vez finalizado el período de prueba, se te cobrarán {{price}} {{perFrequency}} a partir del {{renewalDate}}. Puedes cancelar en cualquier momento antes de esta fecha.","payment_entry_page.subscription_info":"La suscripción se renueva automáticamente. Cancela en cualquier momento.","payment_entry_page.otp_terms_info":"Al comprar, aceptas que {{appName}} te cobre de acuerdo con sus términos.","payment_entry_page.subscription_terms_info":"Al suscribirte, aceptas que {{appName}} te cobre de acuerdo con sus términos hasta que canceles."},$K={"periods.week":"{{amount}} settimana","periods.month":"{{amount}} mese","periods.year":"{{amount}} anno","periods.day":"{{amount}} giorno","periods.weekShort":"{{amount}}sett","periods.monthShort":"{{amount}}mese","periods.yearShort":"{{amount}}anno","periods.dayShort":"{{amount}}g","periods.lifetime":"a vita","periods.weekPlural":"{{amount}} settimane","periods.monthPlural":"{{amount}} mesi","periods.yearPlural":"{{amount}} anni","periods.dayPlural":"{{amount}} giorni","periods.weekFrequency":"settimanale","periods.monthFrequency":"mensile","periods.yearFrequency":"annuale","periods.dayFrequency":"giornaliero","periods.perWeekFrequency":"a settimana","periods.perMonthFrequency":"al mese","periods.perYearFrequency":"all'anno","periods.perDayFrequency":"al giorno","periods.unknownFrequency":"sconosciuto","periods.weekFrequencyPlural":"ogni {{amount}} settimane","periods.monthFrequencyPlural":"ogni {{amount}} mesi","periods.yearFrequencyPlural":"ogni {{amount}} anni","periods.dayFrequencyPlural":"ogni {{amount}} giorni","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} prova gratuita","product_info.price_after_free_trial":"Dopo la fine della prova, il {{renewalDate}}","product_info.renewal_frequency":"Si rinnova {{frequency}}","product_info.continues_until_cancelled":"Continua fino a disdetta","product_info.cancel_anytime":"Disdici in qualsiasi momento","payment_entry_page.payment_step_title":"Pagamento sicuro tramite RevenueCat","payment_entry_page.button_pay":"Paga ora","payment_entry_page.button_start_trial":"Inizia la prova","success_page.purchase_successful":"Pagamento completato","success_page.button_close":"Continua","error_page.if_error_persists":"Se l'errore persiste, contatta ","error_page.error_title_already_subscribed":"Hai già un abbonamento a {{productTitle}}","error_page.error_title_already_purchased":"Hai già acquistato {{productTitle}}","error_page.error_title_other_errors":"Qualcosa è andato storto","error_page.error_message_already_subscribed":"Non puoi abbonarti di nuovo a questo prodotto.","error_page.error_message_already_purchased":"Non puoi acquistare di nuovo questo prodotto.","error_page.error_message_missing_email_error":"L'email è necessaria per completare l'acquisto.","error_page.error_message_network_error":"Errore di rete. Verifica la connessione internet.","error_page.error_message_error_charging_payment":"Pagamento fallito.","error_page.error_message_error_setting_up_purchase":"Acquisto non avviato a causa di un errore (codice errore: {{errorCode}}).","error_page.error_message_invalid_tax_location":"Non siamo riusciti a verificare il tuo indirizzo di fatturazione. Per favore, controlla che il codice postale e il paese siano corretti.","error_page.error_message_unknown_error":"Si è verificato un errore sconosciuto (codice errore: {{errorCode}}).","error_page.button_try_again":"Riprova","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% di sconto","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Totale dovuto oggi","product_info.subscribe_to":"Abbonati a","navbar_header.details":"Dettagli","navbar_header.back_button":"Indietro","pricing_dropdown.show_details":"Mostra dettagli","pricing_dropdown.hide_details":"Nascondi dettagli","pricing_table.tax":"Tasse","pricing_table.trial_ends":"Al termine del periodo di prova, il {{formattedTrialEndDate}}","pricing_table.total_due_today":"Totale dovuto oggi","pricing_table.total_excluding_tax":"Totale tasse escluse","pricing_table.enter_billing_address_to_calculate":"Inserisci l'indirizzo di fatturazione per calcolare","pricing_table.enter_state_or_postal_code_to_calculate":"Inserisci la regione o il codice postale per calcolare","pricing_table.enter_postal_code_to_calculate":"Inserisci il codice postale per calcolare","error_page.error_message_invalid_email_error":"L'indirizzo email {{email}} non può essere verificato. Si prega di fornire un indirizzo email valido.","payment_entry_page.button_payment_method":"Paga {{formattedPrice}} con {{paymentMethod}}","payment_entry_page.button_with_price":"Paga {{formattedPrice}}","price_update.title":"Aggiornamento prezzo","price_update.base_message":"Il prezzo totale è stato aggiornato con le tasse in base al tuo indirizzo di fatturazione. Rivedi e riprova. L'addebito sulla tua carta avverrà solo una volta.","price_update.trial_message":"Il prezzo dell'abbonamento è stato aggiornato per includere le tasse in base al tuo indirizzo di fatturazione. La prova gratuita è ancora valida. Controlla e riprova.","payment_entry_page.express_checkout_divider":"OPPURE PAGA CON CARTA","error_page.trouble_accessing":"Se hai problemi ad accedere al tuo acquisto, contatta l'assistenza all'indirizzo ","error_page.close_button_title":"Vai a {{appName}}","error_page.error_title_stripe_missing_required_permission":"Autorizzazione Stripe mancante","error_page.button_close":"Chiudi","error_page.error_message_stripe_invalid_tax_origin_address":"L'acquisto non è andato a buon fine perché l'indirizzo di origine fiscale non è valido. In produzione, gli acquisti verranno effettuati senza l'applicazione delle imposte e questo errore non sarà visibile.","error_page.error_message_stripe_tax_not_active":"L'acquisto non è andato a buon fine perché Stripe Tax non è abilitato. In produzione, gli acquisti verranno effettuati senza l'applicazione delle imposte e questo errore non sarà visibile.","error_page.error_only_in_sandbox":"Questo messaggio viene visualizzato solo in sandbox.","error_page.error_message_stripe_missing_required_permission":"L'acquisto non è andato a buon fine perché l'app Stripe non dispone dell'autorizzazione necessaria. In produzione, gli acquisti verranno effettuati senza l'applicazione delle imposte e questo errore non sarà visibile.","error_page.error_title_stripe_tax_not_active":"Stripe Tax non attivo","error_page.error_title_stripe_invalid_tax_origin_address":"Indirizzo di origine fiscale non valido","apple_pay.free_trial":"Prova gratuita","product_info.price_after_intro_price":"Dopo {{introPriceDuration}}, il {{renewalDate}}","product_info.after_trial":"dopo il periodo di prova","product_info.after":"dopo","product_info.intro_price_phase_after_trial":"Poi {{introPriceDuration}} a {{introPrice}}","product_info.intro_price_phase":"Prima {{introPriceDuration}} a {{introPrice}}","product_info.intro_price_phase_paid_once":"pagato una volta","payment_entry_page.trial_subscription_terms_info":"Al termine del periodo di prova, ti verranno addebitati {{price}} {{perFrequency}} a partire dal {{renewalDate}}. Puoi annullare in qualsiasi momento prima di questa data.","payment_entry_page.subscription_info":"L'abbonamento si rinnova automaticamente. Annulla in qualsiasi momento.","payment_entry_page.otp_terms_info":"Acquistando, accetti che {{appName}} ti addebiti l'importo in base ai suoi termini.","payment_entry_page.subscription_terms_info":"Abbonandoti, accetti che {{appName}} ti addebiti l'importo secondo i suoi termini fino all'annullamento."},VK={"periods.week":"{{amount}} أسبوع","periods.month":"{{amount}} شهر","periods.year":"{{amount}} سنة","periods.day":"{{amount}} يوم","periods.weekShort":"{{amount}}أسبوع","periods.monthShort":"{{amount}}شهر","periods.yearShort":"{{amount}}سنة","periods.dayShort":"{{amount}}يوم","periods.lifetime":"مدى الحياة","periods.weekPlural":"{{amount}} أسابيع","periods.monthPlural":"{{amount}} أشهر","periods.yearPlural":"{{amount}} سنوات","periods.dayPlural":"{{amount}} أيام","periods.weekFrequency":"أسبوعيًا","periods.monthFrequency":"شهريًا","periods.yearFrequency":"سنويًا","periods.dayFrequency":"يوميًا","periods.perWeekFrequency":"في الأسبوع","periods.perMonthFrequency":"في الشهر","periods.perYearFrequency":"في السنة","periods.perDayFrequency":"في اليوم","periods.unknownFrequency":"غير معروف","periods.weekFrequencyPlural":"كل {{amount}} أسابيع","periods.monthFrequencyPlural":"كل {{amount}} أشهر","periods.yearFrequencyPlural":"كل {{amount}} سنوات","periods.dayFrequencyPlural":"كل {{amount}} أيام","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} تجربة مجانية","product_info.price_after_free_trial":"بعد انتهاء التجربة، في {{renewalDate}}","product_info.renewal_frequency":"يتم التجديد {{frequency}}","product_info.continues_until_cancelled":"يستمر حتى يتم إلغاؤه","product_info.cancel_anytime":"يمكن الإلغاء في أي وقت","payment_entry_page.payment_step_title":"الدفع الآمن عبر RevenueCat","payment_entry_page.button_pay":"ادفع الآن","payment_entry_page.button_start_trial":"ابدأ التجربة","success_page.purchase_successful":"تم الدفع بنجاح","success_page.button_close":"متابعة","error_page.if_error_persists":"إذا استمرت المشكلة، يرجى الاتصال بـ ","error_page.error_title_already_subscribed":"أنت مشترك بالفعل في {{productTitle}}","error_page.error_title_already_purchased":"لقد اشتريت {{productTitle}} بالفعل","error_page.error_title_other_errors":"حدث خطأ ما","error_page.error_message_already_subscribed":"لا يمكنك الاشتراك في هذا المنتج مرة أخرى.","error_page.error_message_already_purchased":"لا يمكنك شراء هذا المنتج مرة أخرى.","error_page.error_message_missing_email_error":"يُطلب البريد الإلكتروني لإتمام عملية الشراء.","error_page.error_message_network_error":"خطأ في الشبكة. يرجى التحقق من اتصال الإنترنت.","error_page.error_message_error_charging_payment":"فشل الدفع.","error_page.error_message_error_setting_up_purchase":"لم تبدأ عملية الشراء بسبب خطأ (رمز الخطأ: {{errorCode}}).","error_page.error_message_invalid_tax_location":"لم نتمكن من التحقق من عنوان الفوترة الخاص بك. يرجى التحقق مرة أخرى من الرمز البريدي والبلد للتأكد من صحتهما.","error_page.error_message_unknown_error":"حدث خطأ غير معروف (رمز الخطأ: {{errorCode}}).","error_page.button_try_again":"حاول مرة أخرى","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% خصم","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"إجمالي المبلغ المستحق اليوم","product_info.subscribe_to":"اشترك في","navbar_header.details":"تفاصيل","navbar_header.back_button":"عودة","pricing_dropdown.show_details":"إظهار التفاصيل","pricing_dropdown.hide_details":"إخفاء التفاصيل","pricing_table.tax":"الضريبة","pricing_table.trial_ends":"بعد انتهاء الفترة التجريبية، في {{formattedTrialEndDate}}","pricing_table.total_due_today":"الإجمالي المستحق اليوم","pricing_table.total_excluding_tax":"الإجمالي باستثناء الضريبة","pricing_table.enter_billing_address_to_calculate":"أدخل عنوان إرسال الفواتير لحسابها","pricing_table.enter_state_or_postal_code_to_calculate":"أدخل الولاية أو الرمز البريدي للحساب","pricing_table.enter_postal_code_to_calculate":"أدخل الرمز البريدي للحساب","error_page.error_message_invalid_email_error":"تعذر التحقق من عنوان البريد الإلكتروني {{email}}. يرجى تقديم عنوان بريد إلكتروني صالح.","payment_entry_page.button_payment_method":"ادفع {{formattedPrice}} باستخدام {{paymentMethod}}","payment_entry_page.button_with_price":"ادفع {{formattedPrice}}","price_update.title":"تحديث السعر","price_update.base_message":"تم تحديث السعر الإجمالي مع الضريبة بناءً على عنوان إرسال الفواتير الخاص بك. يرجى المراجعة والمحاولة مرة أخرى. لن يتم تحصيل رسوم من بطاقتك إلا مرة واحدة.","price_update.trial_message":"تم تحديث سعر الاشتراك ليشمل الضرائب بناءً على عنوان الفوترة الخاص بك. فترة التجربة المجانية لا تزال سارية. يرجى التحقق والمحاولة مرة أخرى.","payment_entry_page.express_checkout_divider":"أو ادفع بواسطة البطاقة","error_page.trouble_accessing":"إذا كنت تواجه مشكلة في الوصول إلى عملية الشراء، فتواصل مع الدعم على ","error_page.close_button_title":"اذهب إلى {{appName}}","error_page.error_title_stripe_missing_required_permission":"إذن Stripe مفقود","error_page.button_close":"إغلاق","error_page.error_message_stripe_invalid_tax_origin_address":"فشلت عملية الشراء لأن عنوان المنشأ الضريبي غير صالح. في مرحلة الإنتاج، ستعمل عمليات الشراء بدون تطبيق الضرائب.","error_page.error_message_stripe_tax_not_active":"فشلت عملية الشراء لأن ضريبة Stripe غير مفعلة. في مرحلة الإنتاج، ستعمل عمليات الشراء بدون تطبيق الضرائب.","error_page.error_only_in_sandbox":"تظهر هذه الرسالة فقط في البيئة التجريبية.","error_page.error_message_stripe_missing_required_permission":"فشلت عملية الشراء لأن تطبيق Stripe يفتقر إلى إذن مطلوب. في مرحلة الإنتاج، ستعمل عمليات الشراء بدون تطبيق الضرائب.","error_page.error_title_stripe_tax_not_active":"ضريبة Stripe غير نشطة","error_page.error_title_stripe_invalid_tax_origin_address":"عنوان منشأ ضريبي غير صالح","apple_pay.free_trial":"تجربة مجانية","product_info.price_after_intro_price":"بعد {{introPriceDuration}}، في {{renewalDate}}","product_info.after_trial":"بعد الفترة التجريبية","product_info.after":"بعد","product_info.intro_price_phase_after_trial":"ثم {{introPriceDuration}} مقابل {{introPrice}}","product_info.intro_price_phase":"أولاً {{introPriceDuration}} مقابل {{introPrice}}","product_info.intro_price_phase_paid_once":"تدفع مرة واحدة","payment_entry_page.trial_subscription_terms_info":"بعد انتهاء الفترة التجريبية، سيتم محاسبتك بمبلغ {{price}} {{perFrequency}} بدءًا من {{renewalDate}}. يمكنك الإلغاء في أي وقت قبل هذا التاريخ.","payment_entry_page.subscription_info":"يتم تجديد الاشتراك تلقائيًا. يمكنك الإلغاء في أي وقت.","payment_entry_page.otp_terms_info":"بالشراء، أنت توافق على السماح لتطبيق {{appName}} بتحصيل الرسوم منك وفقًا لشروطه.","payment_entry_page.subscription_terms_info":"بالاشتراك، فإنك توافق على السماح لـ {{appName}} بتحصيل رسوم منك وفقًا لشروطها حتى تقوم بالإلغاء."},HK={"periods.week":"{{amount}} setmana","periods.month":"{{amount}} mes","periods.year":"{{amount}} any","periods.day":"{{amount}} dia","periods.weekShort":"{{amount}}set","periods.monthShort":"{{amount}}mes","periods.yearShort":"{{amount}}any","periods.dayShort":"{{amount}}d","periods.lifetime":"de per vida","periods.weekPlural":"{{amount}} setmanes","periods.monthPlural":"{{amount}} mesos","periods.yearPlural":"{{amount}} anys","periods.dayPlural":"{{amount}} dies","periods.weekFrequency":"setmanal","periods.monthFrequency":"mensual","periods.yearFrequency":"anual","periods.dayFrequency":"diari","periods.perWeekFrequency":"per setmana","periods.perMonthFrequency":"per mes","periods.perYearFrequency":"per any","periods.perDayFrequency":"per dia","periods.unknownFrequency":"desconeguda","periods.weekFrequencyPlural":"cada {{amount}} setmanes","periods.monthFrequencyPlural":"cada {{amount}} mesos","periods.yearFrequencyPlural":"cada {{amount}} anys","periods.dayFrequencyPlural":"cada {{amount}} dies","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} de prova gratuïta","product_info.price_after_free_trial":"Després del període de prova, el {{renewalDate}}","product_info.renewal_frequency":"Es renova {{frequency}}","product_info.continues_until_cancelled":"Continua fins que es cancel·li","product_info.cancel_anytime":"Cancel·la en qualsevol moment","payment_entry_page.payment_step_title":"Pagament segur amb RevenueCat","payment_entry_page.button_pay":"Paga ara","payment_entry_page.button_start_trial":"Comença la prova","success_page.purchase_successful":"Pagament complet","success_page.button_close":"Continua","error_page.if_error_persists":"Si l'error persisteix, contacta amb ","error_page.error_title_already_subscribed":"Ja us heu subscrit a {{productTitle}}","error_page.error_title_already_purchased":"Ja heu comprat {{productTitle}}","error_page.error_title_other_errors":"Alguna cosa ha anat malament","error_page.error_message_already_subscribed":"No us podeu subscriure a aquest producte de nou.","error_page.error_message_already_purchased":"No podeu comprar aquest producte de nou.","error_page.error_message_missing_email_error":"Es necessita un correu electrònic per completar la compra.","error_page.error_message_network_error":"Error de xarxa. Comprova la teva connexió a internet.","error_page.error_message_error_charging_payment":"El pagament ha fallat.","error_page.error_message_error_setting_up_purchase":"No s'ha iniciat la compra a causa d'un error (codi d'error: {{errorCode}}).","error_page.error_message_invalid_tax_location":"No hem pogut verificar la vostra adreça de facturació. Si us plau, verifiqueu de nou el codi postal i el país per assegurar-vos que són correctes.","error_page.error_message_unknown_error":"S'ha produït un error desconegut (codi d'error: {{errorCode}}).","error_page.button_try_again":"Torna a intentar-ho","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% de descompte","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Total a pagar avui","product_info.subscribe_to":"Subscriu-te a","navbar_header.details":"Detalls","navbar_header.back_button":"Enrere","pricing_dropdown.show_details":"Mostra detalls","pricing_dropdown.hide_details":"Amaga detalls","pricing_table.tax":"Impostos","pricing_table.trial_ends":"Després que finalitzi la prova, el {{formattedTrialEndDate}}","pricing_table.total_due_today":"Total a pagar avui","pricing_table.total_excluding_tax":"Total sense impostos","pricing_table.enter_billing_address_to_calculate":"Introduïu l'adreça de facturació per calcular","pricing_table.enter_state_or_postal_code_to_calculate":"Introduïu la província o el codi postal per calcular","pricing_table.enter_postal_code_to_calculate":"Introduïu el codi postal per calcular","error_page.error_message_invalid_email_error":"No s'ha pogut verificar l'adreça de correu electrònic {{email}}. Si us plau, proporcioneu una adreça de correu electrònic vàlida.","payment_entry_page.button_payment_method":"Paga {{formattedPrice}} amb {{paymentMethod}}","payment_entry_page.button_with_price":"Paga {{formattedPrice}}","price_update.title":"Actualització de preu","price_update.base_message":"El preu total s'ha actualitzat amb els impostos segons la vostra adreça de facturació. Reviseu-ho i torneu-ho a provar. Només es carregarà la vostra targeta una vegada.","price_update.trial_message":"El preu de la subscripció s'ha actualitzat per incloure els impostos segons la seva adreça de facturació. El període de prova gratuït segueix vigent. Si us plau, comprovi-ho i torni-ho a provar.","payment_entry_page.express_checkout_divider":"O PAGUEU AMB TARGETA","error_page.trouble_accessing":"Si teniu problemes per accedir a la vostra compra, poseu-vos en contacte amb el servei d'assistència a ","error_page.close_button_title":"Vés a {{appName}}","error_page.error_title_stripe_missing_required_permission":"Falta el permís de Stripe","error_page.button_close":"Tanca","error_page.error_message_stripe_invalid_tax_origin_address":"La compra ha fallat perquè l'adreça d'origen fiscal no és vàlida. En producció, les compres funcionaran sense impostos aplicats.","error_page.error_message_stripe_tax_not_active":"La compra ha fallat perquè Stripe Tax no està activat. En producció, les compres funcionaran sense impostos aplicats.","error_page.error_only_in_sandbox":"Aquest missatge apareix només a l'entorn de proves.","error_page.error_message_stripe_missing_required_permission":"La compra ha fallat perquè l'aplicació Stripe no té un permís necessari. En producció, les compres funcionaran sense impostos aplicats.","error_page.error_title_stripe_tax_not_active":"Stripe Tax no està actiu","error_page.error_title_stripe_invalid_tax_origin_address":"Adreça d'origen fiscal no vàlida","apple_pay.free_trial":"Prova gratuïta","product_info.price_after_intro_price":"Després de {{introPriceDuration}}, el {{renewalDate}}","product_info.after_trial":"després del període de prova","product_info.after":"després de","product_info.intro_price_phase_after_trial":"Després {{introPriceDuration}} per {{introPrice}}","product_info.intro_price_phase":"Primer {{introPriceDuration}} per {{introPrice}}","product_info.intro_price_phase_paid_once":"pagat un cop","payment_entry_page.trial_subscription_terms_info":"Un cop finalitzat el període de prova, se us cobrarà {{price}} {{perFrequency}} a partir del {{renewalDate}}. Podeu cancel·lar-ho en qualsevol moment abans d'aquesta data.","payment_entry_page.subscription_info":"La subscripció es renova automàticament. Cancel·leu-la quan vulgueu.","payment_entry_page.otp_terms_info":"En comprar, accepteu que {{appName}} us cobri d'acord amb les seves condicions.","payment_entry_page.subscription_terms_info":"En subscriure-us, accepteu que {{appName}} us cobri d'acord amb les seves condicions fins que ho cancel·leu."},GK={"periods.week":"{{amount}} 周","periods.month":"{{amount}} 月","periods.year":"{{amount}} 年","periods.day":"{{amount}} 天","periods.weekShort":"{{amount}}周","periods.monthShort":"{{amount}}月","periods.yearShort":"{{amount}}年","periods.dayShort":"{{amount}}天","periods.lifetime":"终身","periods.weekPlural":"{{amount}} 周","periods.monthPlural":"{{amount}} 个月","periods.yearPlural":"{{amount}} 年","periods.dayPlural":"{{amount}} 天","periods.weekFrequency":"每周","periods.monthFrequency":"每月","periods.yearFrequency":"每年","periods.dayFrequency":"每天","periods.perWeekFrequency":"每周","periods.perMonthFrequency":"每月","periods.perYearFrequency":"每年","periods.perDayFrequency":"每天","periods.unknownFrequency":"未知","periods.weekFrequencyPlural":"每 {{amount}} 周","periods.monthFrequencyPlural":"每 {{amount}} 个月","periods.yearFrequencyPlural":"每 {{amount}} 年","periods.dayFrequencyPlural":"每 {{amount}} 天","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} 天免费试用","product_info.price_after_free_trial":"试用期结束后，于 {{renewalDate}}","product_info.renewal_frequency":"续订 {{frequency}}","product_info.continues_until_cancelled":"持续到取消","product_info.cancel_anytime":"随时取消","payment_entry_page.payment_step_title":"RevenueCat 安全结账","payment_entry_page.button_pay":"立即支付","payment_entry_page.button_start_trial":"开始试用","success_page.purchase_successful":"支付完成","success_page.button_close":"继续","error_page.if_error_persists":"如果错误仍然存在，请联系 ","error_page.error_title_already_subscribed":"您已订阅 {{productTitle}}","error_page.error_title_already_purchased":"您已购买 {{productTitle}}","error_page.error_title_other_errors":"出现错误","error_page.error_message_already_subscribed":"您不能再次订阅此产品。","error_page.error_message_already_purchased":"您不能再次购买此产品。","error_page.error_message_missing_email_error":"完成购买需要邮箱地址。","error_page.error_message_network_error":"网络错误。请检查您的互联网连接。","error_page.error_message_error_charging_payment":"支付失败。","error_page.error_message_error_setting_up_purchase":"由于错误，购买未启动（错误代码：{{errorCode}}）。","error_page.error_message_invalid_tax_location":"我们无法验证您的账单地址。请仔细检查邮政编码和国家是否正确。","error_page.error_message_unknown_error":"发生未知错误（错误代码：{{errorCode}}）。","error_page.button_try_again":"重试","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% 折扣","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"今天应付总额","product_info.subscribe_to":"订阅","navbar_header.details":"详情","navbar_header.back_button":"返回","pricing_dropdown.show_details":"显示详情","pricing_dropdown.hide_details":"隐藏详情","pricing_table.tax":"税","pricing_table.trial_ends":"试用期结束后，于{{formattedTrialEndDate}}","pricing_table.total_due_today":"今日应付总额","pricing_table.total_excluding_tax":"总计（不含税）","pricing_table.enter_billing_address_to_calculate":"输入账单地址以计算","pricing_table.enter_state_or_postal_code_to_calculate":"输入州或邮政编码以计算","pricing_table.enter_postal_code_to_calculate":"输入邮政编码以计算","error_page.error_message_invalid_email_error":"无法验证电子邮件地址{{email}}。请提供有效的电子邮件地址。","payment_entry_page.button_payment_method":"使用{{paymentMethod}}支付{{formattedPrice}}","payment_entry_page.button_with_price":"支付{{formattedPrice}}","price_update.title":"价格更新","price_update.base_message":"总价已根据您的账单地址更新了税费。请查看并重试。您的银行卡只会扣款一次。","price_update.trial_message":"根据您的账单地址，订阅价格已更新为含税价格。免费试用仍然有效。请查看并重试。","payment_entry_page.express_checkout_divider":"或使用银行卡支付","error_page.trouble_accessing":"如果您在访问购买项目时遇到问题，请通过以下方式联系支持：","error_page.close_button_title":"前往{{appName}}","error_page.error_title_stripe_missing_required_permission":"缺少Stripe权限","error_page.button_close":"关闭","error_page.error_message_stripe_invalid_tax_origin_address":"购买失败，因为税务起始地址无效。在生产环境中，购买将在不应用税款的情况下进行。","error_page.error_message_stripe_tax_not_active":"购买失败，因为Stripe Tax未启用。在生产环境中，购买将在不应用税款的情况下进行。","error_page.error_only_in_sandbox":"此消息仅在沙盒中显示。","error_page.error_message_stripe_missing_required_permission":"购买失败，因为Stripe应用程序缺少必需的权限。在生产环境中，购买将在不应用税款的情况下进行。","error_page.error_title_stripe_tax_not_active":"Stripe Tax未激活","error_page.error_title_stripe_invalid_tax_origin_address":"税务起始地址无效","apple_pay.free_trial":"免费试用","product_info.price_after_intro_price":"在{{introPriceDuration}}之后，于{{renewalDate}}开始","product_info.after_trial":"试用后","product_info.after":"之后","product_info.intro_price_phase_after_trial":"然后{{introPriceDuration}}，价格为{{introPrice}}","product_info.intro_price_phase":"首先{{introPriceDuration}}，价格为{{introPrice}}","product_info.intro_price_phase_paid_once":"一次性支付","payment_entry_page.trial_subscription_terms_info":"试用期结束后，您将被收取 {{price}} {{perFrequency}}，从 {{renewalDate}} 开始。您可以在此日期之前的任何时间取消。","payment_entry_page.subscription_info":"订阅自动续订。随时取消。","payment_entry_page.otp_terms_info":"购买即表示您同意允许{{appName}}根据其条款向您收费。","payment_entry_page.subscription_terms_info":"订阅即表示您同意允许 {{appName}} 按照其条款向您收费，直到您取消订阅。"},WK={"periods.week":"{{amount}} 週","periods.month":"{{amount}} 個月","periods.year":"{{amount}} 年","periods.day":"{{amount}} 天","periods.weekShort":"{{amount}}週","periods.monthShort":"{{amount}}月","periods.yearShort":"{{amount}}年","periods.dayShort":"{{amount}}天","periods.lifetime":"終身","periods.weekPlural":"{{amount}} 週","periods.monthPlural":"{{amount}} 個月","periods.yearPlural":"{{amount}} 年","periods.dayPlural":"{{amount}} 天","periods.weekFrequency":"每週","periods.monthFrequency":"每月","periods.yearFrequency":"每年","periods.dayFrequency":"每天","periods.perWeekFrequency":"每週","periods.perMonthFrequency":"每月","periods.perYearFrequency":"每年","periods.perDayFrequency":"每天","periods.unknownFrequency":"未知","periods.weekFrequencyPlural":"每 {{amount}} 週","periods.monthFrequencyPlural":"每 {{amount}} 個月","periods.yearFrequencyPlural":"每 {{amount}} 年","periods.dayFrequencyPlural":"每 {{amount}} 天","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} 天免費試用","product_info.price_after_free_trial":"試用期結束後，於 {{renewalDate}}","product_info.renewal_frequency":"每 {{frequency}} 續約","product_info.continues_until_cancelled":"持續到取消","product_info.cancel_anytime":"隨時取消","payment_entry_page.payment_step_title":"RevenueCat 安全結帳","payment_entry_page.button_pay":"立即付款","payment_entry_page.button_start_trial":"開始試用","success_page.purchase_successful":"付款完成","success_page.button_close":"繼續","error_page.if_error_persists":"如果錯誤持續存在，請聯絡 ","error_page.error_title_already_subscribed":"您已經訂閱 {{productTitle}}","error_page.error_title_already_purchased":"您已經購買 {{productTitle}}","error_page.error_title_other_errors":"發生錯誤","error_page.error_message_already_subscribed":"您無法再次訂閱此產品。","error_page.error_message_already_purchased":"您無法再次購買此產品。","error_page.error_message_missing_email_error":"完成購買需要電子郵件地址。","error_page.error_message_network_error":"網路錯誤。請檢查您的網路連線。","error_page.error_message_error_charging_payment":"付款失敗。","error_page.error_message_error_setting_up_purchase":"由於發生錯誤，購買未啟動（錯誤代碼：{{errorCode}}）。","error_page.error_message_invalid_tax_location":"我們無法驗證您的帳單地址。請仔細檢查郵遞區號和國家是否正確。","error_page.error_message_unknown_error":"發生不明錯誤（錯誤代碼：{{errorCode}}）。","error_page.button_try_again":"再試一次","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% 折扣","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}} ({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"今日應付總額","product_info.subscribe_to":"訂閱","navbar_header.details":"詳細資訊","navbar_header.back_button":"返回","pricing_dropdown.show_details":"顯示詳細資訊","pricing_dropdown.hide_details":"隱藏詳細資訊","pricing_table.tax":"稅金","pricing_table.trial_ends":"試用期結束後，於 {{formattedTrialEndDate}}","pricing_table.total_due_today":"今日應付總額","pricing_table.total_excluding_tax":"總計（不含稅）","pricing_table.enter_billing_address_to_calculate":"輸入帳單地址以計算","pricing_table.enter_state_or_postal_code_to_calculate":"輸入州或郵政編碼以計算","pricing_table.enter_postal_code_to_calculate":"輸入郵政編碼以計算","error_page.error_message_invalid_email_error":"無法驗證電子郵件地址 {{email}}。請提供有效的電子郵件地址。","payment_entry_page.button_payment_method":"使用 {{paymentMethod}} 支付 {{formattedPrice}}","payment_entry_page.button_with_price":"支付 {{formattedPrice}}","price_update.title":"價格更新","price_update.base_message":"總價已根據您的帳單地址更新稅金。請檢查後重試。您的信用卡只會被收取一次費用。","price_update.trial_message":"根據您的帳單地址，訂閱價格已更新為含稅價格。免費試用仍然有效。請查看並重試。","payment_entry_page.express_checkout_divider":"或以信用卡付款","error_page.trouble_accessing":"如果您在存取購買項目時遇到問題，請透過以下方式聯絡支援人員：","error_page.close_button_title":"前往{{appName}}","error_page.error_title_stripe_missing_required_permission":"缺少 Stripe 權限","error_page.button_close":"關閉","error_page.error_message_stripe_invalid_tax_origin_address":"購買失敗，因為稅務起始地址無效。在正式環境中，購買將在不套用稅金的情況下運作。","error_page.error_message_stripe_tax_not_active":"購買失敗，因為 Stripe Tax 未啟用。在正式環境中，購買將在不套用稅金的情況下運作。","error_page.error_only_in_sandbox":"此訊息僅在沙盒中顯示。","error_page.error_message_stripe_missing_required_permission":"購買失敗，因為 Stripe 應用程式缺少必要的權限。在正式環境中，購買將在不套用稅金的情況下運作。","error_page.error_title_stripe_tax_not_active":"Stripe Tax 未啟用","error_page.error_title_stripe_invalid_tax_origin_address":"無效的稅務起始地址","apple_pay.free_trial":"免費試用","product_info.price_after_intro_price":"在 {{introPriceDuration}} 之後，於 {{renewalDate}}","product_info.after_trial":"試用期後","product_info.after":"之後","product_info.intro_price_phase_after_trial":"然後 {{introPriceDuration}}，價格為 {{introPrice}}","product_info.intro_price_phase":"首先 {{introPriceDuration}}，價格為 {{introPrice}}","product_info.intro_price_phase_paid_once":"一次性支付","payment_entry_page.trial_subscription_terms_info":"在您的試用期結束後，您將被收取 {{price}} {{perFrequency}}，從 {{renewalDate}} 開始。您可以隨時在此日期之前取消。","payment_entry_page.subscription_info":"訂閱會自動續訂。隨時取消。","payment_entry_page.otp_terms_info":"購買即表示您同意授權 {{appName}} 根據其條款向您收費。","payment_entry_page.subscription_terms_info":"訂閱即表示您同意允許 {{appName}} 根據其條款向您收費，直到您取消為止。"},KK={"periods.week":"{{amount}} tjedan","periods.month":"{{amount}} mjesec","periods.year":"{{amount}} godina","periods.day":"{{amount}} dan","periods.weekShort":"{{amount}}tj","periods.monthShort":"{{amount}}mj","periods.yearShort":"{{amount}}g","periods.dayShort":"{{amount}}d","periods.lifetime":"doživotno","periods.weekPlural":"{{amount}} tjedana","periods.monthPlural":"{{amount}} mjeseci","periods.yearPlural":"{{amount}} godina","periods.dayPlural":"{{amount}} dana","periods.weekFrequency":"tjedno","periods.monthFrequency":"mjesečno","periods.yearFrequency":"godišnje","periods.dayFrequency":"dnevno","periods.perWeekFrequency":"tjedno","periods.perMonthFrequency":"mjesečno","periods.perYearFrequency":"godišnje","periods.perDayFrequency":"dnevno","periods.unknownFrequency":"nepoznato","periods.weekFrequencyPlural":"svakih {{amount}} tjedana","periods.monthFrequencyPlural":"svakih {{amount}} mjeseci","periods.yearFrequencyPlural":"svakih {{amount}} godina","periods.dayFrequencyPlural":"svakih {{amount}} dana","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} besplatno probno razdoblje","product_info.price_after_free_trial":"Nakon isteka probnog razdoblja, {{renewalDate}}","product_info.renewal_frequency":"Obnavlja se {{frequency}}","product_info.continues_until_cancelled":"Nastavlja se dok se ne otkaže","product_info.cancel_anytime":"Otkažite u bilo kojem trenutku","payment_entry_page.payment_step_title":"Sigurna naplata putem RevenueCat","payment_entry_page.button_pay":"Plati sada","payment_entry_page.button_start_trial":"Počni probno razdoblje","success_page.purchase_successful":"Uplata je uspješna","success_page.button_close":"Nastavi","error_page.if_error_persists":"Ako se pogreška nastavi, obratite se ","error_page.error_title_already_subscribed":"Već ste pretplaćeni na {{productTitle}}","error_page.error_title_already_purchased":"Već ste kupili {{productTitle}}","error_page.error_title_other_errors":"Nešto je pošlo po zlu","error_page.error_message_already_subscribed":"Ne možete se ponovno pretplatiti na ovaj proizvod.","error_page.error_message_already_purchased":"Ne možete ponovno kupiti ovaj proizvod.","error_page.error_message_missing_email_error":"E-pošta je potrebna za dovršetak kupnje.","error_page.error_message_network_error":"Mrežna pogreška. Provjerite internetsku vezu.","error_page.error_message_error_charging_payment":"Plaćanje nije uspjelo.","error_page.error_message_error_setting_up_purchase":"Kupnja nije započela zbog pogreške (kod pogreške: {{errorCode}}).","error_page.error_message_invalid_tax_location":"Nismo mogli potvrditi vašu adresu za naplatu. Molimo provjerite poštanski broj i državu kako biste bili sigurni da su točni.","error_page.error_message_unknown_error":"Došlo je do nepoznate pogreške (kod pogreške: {{errorCode}}).","error_page.button_try_again":"Pokušaj ponovno","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% popusta","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Ukupno dospijeće danas","product_info.subscribe_to":"Pretplatite se","navbar_header.details":"Detalji","navbar_header.back_button":"Natrag","pricing_dropdown.show_details":"Prikaži detalje","pricing_dropdown.hide_details":"Sakrij detalje","pricing_table.tax":"Porez","pricing_table.trial_ends":"Nakon isteka probnog razdoblja, {{formattedTrialEndDate}}","pricing_table.total_due_today":"Ukupan iznos dospijeća danas","pricing_table.total_excluding_tax":"Ukupno bez poreza","pricing_table.enter_billing_address_to_calculate":"Unesite adresu za naplatu za izračun","pricing_table.enter_state_or_postal_code_to_calculate":"Unesite državu ili poštanski broj za izračun","pricing_table.enter_postal_code_to_calculate":"Unesite poštanski broj za izračun","error_page.error_message_invalid_email_error":"Adresa e-pošte {{email}} nije se mogla potvrditi. Molimo unesite valjanu adresu e-pošte.","payment_entry_page.button_payment_method":"Plati {{formattedPrice}} putem {{paymentMethod}}","payment_entry_page.button_with_price":"Plati {{formattedPrice}}","price_update.title":"Ažuriranje cijene","price_update.base_message":"Ukupna cijena je ažurirana s porezom na temelju vaše adrese za naplatu. Pregledajte i pokušajte ponovo. Vaša kartica bit će naplaćena samo jednom.","price_update.trial_message":"Cijena pretplate je ažurirana da uključi poreze na temelju vaše adrese za naplatu. Besplatno probno razdoblje i dalje vrijedi. Molimo provjerite i pokušajte ponovno.","payment_entry_page.express_checkout_divider":"ILI PLATITE KARTICOM","error_page.trouble_accessing":"Ako imate problema s pristupom kupnji, obratite se podršci na ","error_page.close_button_title":"Idi na {{appName}}","error_page.error_title_stripe_missing_required_permission":"Nedostaje Stripe dopuštenje","error_page.button_close":"Zatvori","error_page.error_message_stripe_invalid_tax_origin_address":"Kupnja nije uspjela jer je adresa poreznog podrijetla nevažeća. U produkciji će kupnje funkcionirati bez primijenjenih poreza.","error_page.error_message_stripe_tax_not_active":"Kupnja nije uspjela jer Stripe Tax nije omogućen. U produkciji će kupnje funkcionirati bez primijenjenih poreza.","error_page.error_only_in_sandbox":"Ova se poruka pojavljuje samo u sandboxu.","error_page.error_message_stripe_missing_required_permission":"Kupnja nije uspjela jer Stripe aplikaciji nedostaje potrebno dopuštenje. U produkciji će kupnje funkcionirati bez primijenjenih poreza.","error_page.error_title_stripe_tax_not_active":"Stripe Tax nije aktivan","error_page.error_title_stripe_invalid_tax_origin_address":"Nevažeća adresa poreznog podrijetla","apple_pay.free_trial":"Besplatna proba","product_info.price_after_intro_price":"Nakon {{introPriceDuration}}, na {{renewalDate}}","product_info.after_trial":"nakon probnog perioda","product_info.after":"nakon","product_info.intro_price_phase_after_trial":"Zatim {{introPriceDuration}} za {{introPrice}}","product_info.intro_price_phase":"Prvo {{introPriceDuration}} za {{introPrice}}","product_info.intro_price_phase_paid_once":"plaća se jednokratno","payment_entry_page.trial_subscription_terms_info":"Nakon isteka probnog razdoblja, bit će vam naplaćeno {{price}} {{perFrequency}} počevši od {{renewalDate}}. Možete otkazati bilo kada prije tog datuma.","payment_entry_page.subscription_info":"Pretplata se automatski obnavlja. Otkažite bilo kada.","payment_entry_page.otp_terms_info":"Kupnjom pristajete dopustiti aplikaciji {{appName}} da vam naplati u skladu s njihovim uvjetima.","payment_entry_page.subscription_terms_info":"Pretplatom se slažete da ćete dopustiti {{appName}} da vam naplaćuje u skladu s njihovim uvjetima dok ne otkažete."},YK={"periods.week":"{{amount}} týden","periods.month":"{{amount}} měsíc","periods.year":"{{amount}} rok","periods.day":"{{amount}} den","periods.weekShort":"{{amount}}týd","periods.monthShort":"{{amount}}měs","periods.yearShort":"{{amount}}rok","periods.dayShort":"{{amount}}d","periods.lifetime":"doživotně","periods.weekPlural":"{{amount}} týdnů","periods.monthPlural":"{{amount}} měsíců","periods.yearPlural":"{{amount}} let","periods.dayPlural":"{{amount}} dnů","periods.weekFrequency":"týdně","periods.monthFrequency":"měsíčně","periods.yearFrequency":"ročně","periods.dayFrequency":"denně","periods.perWeekFrequency":"týdně","periods.perMonthFrequency":"měsíčně","periods.perYearFrequency":"ročně","periods.perDayFrequency":"denně","periods.unknownFrequency":"neznámé","periods.weekFrequencyPlural":"každých {{amount}} týdnů","periods.monthFrequencyPlural":"každých {{amount}} měsíců","periods.yearFrequencyPlural":"každých {{amount}} let","periods.dayFrequencyPlural":"každých {{amount}} dnů","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} zkušební verze zdarma","product_info.price_after_free_trial":"Po skončení zkušební verze, {{renewalDate}}","product_info.renewal_frequency":"Obnovuje se {{frequency}}","product_info.continues_until_cancelled":"Pokračuje, dokud není zrušeno","product_info.cancel_anytime":"Zrušit kdykoli","payment_entry_page.payment_step_title":"Bezpečné placení přes RevenueCat","payment_entry_page.button_pay":"Platit nyní","payment_entry_page.button_start_trial":"Spustit zkušební verzi","success_page.purchase_successful":"Platba dokončena","success_page.button_close":"Pokračovat","error_page.if_error_persists":"Pokud chyba přetrvává, kontaktujte ","error_page.error_title_already_subscribed":"Již máte předplatné pro {{productTitle}}","error_page.error_title_already_purchased":"Již jste zakoupili {{productTitle}}","error_page.error_title_other_errors":"Něco se pokazilo","error_page.error_message_already_subscribed":"Nemůžete si znovu předplatit tento produkt.","error_page.error_message_already_purchased":"Tento produkt si nemůžete znovu zakoupit.","error_page.error_message_missing_email_error":"Pro dokončení nákupu je vyžadován e-mail.","error_page.error_message_network_error":"Síťová chyba. Zkontrolujte prosím své internetové připojení.","error_page.error_message_error_charging_payment":"Platba selhala.","error_page.error_message_error_setting_up_purchase":"Nákup nebyl zahájen z důvodu chyby (kód chyby: {{errorCode}}).","error_page.error_message_invalid_tax_location":"Nemohli jsme ověřit vaši fakturační adresu. Zkontrolujte prosím, zda je poštovní směrovací číslo a země správné.","error_page.error_message_unknown_error":"Došlo k neznámé chybě (kód chyby: {{errorCode}}).","error_page.button_try_again":"Zkusit znovu","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% sleva","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Celkem dnes k zaplacení","product_info.subscribe_to":"Předplatit","navbar_header.details":"Podrobnosti","navbar_header.back_button":"Zpět","pricing_dropdown.show_details":"Zobrazit podrobnosti","pricing_dropdown.hide_details":"Skrýt podrobnosti","pricing_table.tax":"Daň","pricing_table.trial_ends":"Po skončení zkušební doby, dne {{formattedTrialEndDate}}","pricing_table.total_due_today":"Celkem splatné dnes","pricing_table.total_excluding_tax":"Celkem bez daně","pricing_table.enter_billing_address_to_calculate":"Zadejte fakturační adresu pro výpočet","pricing_table.enter_state_or_postal_code_to_calculate":"Zadejte stát nebo PSČ pro výpočet","pricing_table.enter_postal_code_to_calculate":"Zadejte PSČ pro výpočet","error_page.error_message_invalid_email_error":"E-mailová adresa {{email}} nemohla být ověřena. Zadejte prosím platnou e-mailovou adresu.","payment_entry_page.button_payment_method":"Zaplatit {{formattedPrice}} pomocí {{paymentMethod}}","payment_entry_page.button_with_price":"Zaplatit {{formattedPrice}}","price_update.title":"Aktualizace ceny","price_update.base_message":"Celková cena byla aktualizována o daň na základě vaší fakturační adresy. Zkontrolujte ji a zkuste to znovu. Vaše karta bude stržena pouze jednou.","price_update.trial_message":"Cena předplatného byla aktualizována včetně daní na základě vaší fakturační adresy. Bezplatná zkušební doba stále platí. Prosím, zkontrolujte a zkuste to znovu.","payment_entry_page.express_checkout_divider":"NEBO ZAPLATIT KARTOU","error_page.trouble_accessing":"Pokud máte potíže s přístupem k zakoupenému obsahu, kontaktujte podporu na ","error_page.close_button_title":"Přejít na {{appName}}","error_page.error_title_stripe_missing_required_permission":"Chybí oprávnění Stripe","error_page.button_close":"Zavřít","error_page.error_message_stripe_invalid_tax_origin_address":"Nákup se nezdařil, protože adresa původu daně je neplatná. V produkčním prostředí budou nákupy fungovat bez uplatnění daní.","error_page.error_message_stripe_tax_not_active":"Nákup se nezdařil, protože Stripe Tax není aktivní. V produkčním prostředí budou nákupy fungovat bez uplatnění daní.","error_page.error_only_in_sandbox":"Tato zpráva se zobrazuje pouze v sandboxu.","error_page.error_message_stripe_missing_required_permission":"Nákup se nezdařil, protože aplikaci Stripe chybí požadované oprávnění. V produkčním prostředí budou nákupy fungovat bez uplatnění daní.","error_page.error_title_stripe_tax_not_active":"Stripe Tax není aktivní","error_page.error_title_stripe_invalid_tax_origin_address":"Neplatná adresa původu daně","apple_pay.free_trial":"Zkušební verze zdarma","product_info.price_after_intro_price":"Po {{introPriceDuration}}, dne {{renewalDate}}","product_info.after_trial":"po zkušební době","product_info.after":"po","product_info.intro_price_phase_after_trial":"Poté {{introPriceDuration}} za {{introPrice}}","product_info.intro_price_phase":"Nejprve {{introPriceDuration}} za {{introPrice}}","product_info.intro_price_phase_paid_once":"placeno jednorázově","payment_entry_page.trial_subscription_terms_info":"Po skončení zkušebního období vám bude účtováno {{price}} {{perFrequency}} počínaje {{renewalDate}}. Před tímto datem můžete kdykoli zrušit.","payment_entry_page.subscription_info":"Předplatné se automaticky obnovuje. Zrušit můžete kdykoli.","payment_entry_page.otp_terms_info":"Zakoupením souhlasíte s tím, že umožníte aplikaci {{appName}} účtovat vám poplatky v souladu s jejími podmínkami.","payment_entry_page.subscription_terms_info":"Přihlášením k odběru souhlasíte s tím, že společnost {{appName}} vám bude účtovat poplatky v souladu s jejími podmínkami, dokud odběr nezrušíte."},XK={"periods.week":"{{amount}} uge","periods.month":"{{amount}} måned","periods.year":"{{amount}} år","periods.day":"{{amount}} dag","periods.weekShort":"{{amount}}ug","periods.monthShort":"{{amount}}md","periods.yearShort":"{{amount}}år","periods.dayShort":"{{amount}}d","periods.lifetime":"livstid","periods.weekPlural":"{{amount}} uger","periods.monthPlural":"{{amount}} måneder","periods.yearPlural":"{{amount}} år","periods.dayPlural":"{{amount}} dage","periods.weekFrequency":"ugentligt","periods.monthFrequency":"månedligt","periods.yearFrequency":"årligt","periods.dayFrequency":"dagligt","periods.perWeekFrequency":"pr. uge","periods.perMonthFrequency":"pr. måned","periods.perYearFrequency":"pr. år","periods.perDayFrequency":"pr. dag","periods.unknownFrequency":"ukendt","periods.weekFrequencyPlural":"hver {{amount}} uger","periods.monthFrequencyPlural":"hver {{amount}} måneder","periods.yearFrequencyPlural":"hver {{amount}} år","periods.dayFrequencyPlural":"hver {{amount}} dage","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} gratis prøveperiode","product_info.price_after_free_trial":"Efter prøveperioden slutter, den {{renewalDate}}","product_info.renewal_frequency":"Fornyes {{frequency}}","product_info.continues_until_cancelled":"Fortsætter indtil annulleret","product_info.cancel_anytime":"Annuller når som helst","payment_entry_page.payment_step_title":"Sikker betaling via RevenueCat","payment_entry_page.button_pay":"Betal nu","payment_entry_page.button_start_trial":"Start prøveperiode","success_page.purchase_successful":"Betaling gennemført","success_page.button_close":"Fortsæt","error_page.if_error_persists":"Hvis fejlen fortsætter, kontakt venligst ","error_page.error_title_already_subscribed":"Du abonnerer allerede på {{productTitle}}","error_page.error_title_already_purchased":"Du har allerede købt {{productTitle}}","error_page.error_title_other_errors":"Noget gik galt","error_page.error_message_already_subscribed":"Du kan ikke abonnere på dette produkt igen.","error_page.error_message_already_purchased":"Du kan ikke købe dette produkt igen.","error_page.error_message_missing_email_error":"Email er påkrævet for at gennemføre købet.","error_page.error_message_network_error":"Netværksfejl. Kontroller din internetforbindelse.","error_page.error_message_error_charging_payment":"Betalingen mislykkedes.","error_page.error_message_error_setting_up_purchase":"Køb ikke startet på grund af en fejl (fejlkode: {{errorCode}}).","error_page.error_message_invalid_tax_location":"Vi kunne ikke bekræfte din faktureringsadresse. Kontroller venligst, at postnummeret og landet er korrekte.","error_page.error_message_unknown_error":"Der opstod en ukendt fejl (fejlkode: {{errorCode}}).","error_page.button_try_again":"Prøv igen","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% rabat","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Samlet beløb for i dag","product_info.subscribe_to":"Abonner på","navbar_header.details":"Detaljer","navbar_header.back_button":"Tilbage","pricing_dropdown.show_details":"Vis detaljer","pricing_dropdown.hide_details":"Skjul detaljer","pricing_table.tax":"Moms","pricing_table.trial_ends":"Efter prøveperioden slutter, den {{formattedTrialEndDate}}","pricing_table.total_due_today":"Samlet beløb forfalden i dag","pricing_table.total_excluding_tax":"Samlet beløb eksklusive moms","pricing_table.enter_billing_address_to_calculate":"Indtast faktureringsadresse for at beregne","pricing_table.enter_state_or_postal_code_to_calculate":"Indtast stat eller postnummer for at beregne","pricing_table.enter_postal_code_to_calculate":"Indtast postnummer for at beregne","error_page.error_message_invalid_email_error":"E-mailadressen {{email}} kunne ikke bekræftes. Angiv en gyldig e-mailadresse.","payment_entry_page.button_payment_method":"Betal {{formattedPrice}} med {{paymentMethod}}","payment_entry_page.button_with_price":"Betal {{formattedPrice}}","price_update.title":"Prisopdatering","price_update.base_message":"Den samlede pris er blevet opdateret med moms baseret på din faktureringsadresse. Gennemgå og prøv igen. Dit kort vil kun blive debiteret én gang.","price_update.trial_message":"Abonnementsprisen er opdateret for at inkludere skatter baseret på din faktureringsadresse. Den gratis prøveperiode gælder stadig. Kontroller venligst og prøv igen.","payment_entry_page.express_checkout_divider":"ELLER BETAL MED KORT","error_page.trouble_accessing":"Hvis du har problemer med at få adgang til dit køb, kan du kontakte support på ","error_page.close_button_title":"Gå til {{appName}}","error_page.error_title_stripe_missing_required_permission":"Manglende Stripe-tilladelse","error_page.button_close":"Luk","error_page.error_message_stripe_invalid_tax_origin_address":"Købet mislykkedes, fordi skatteoprindelsesadressen er ugyldig. I produktion vil køb fungere uden påførte skatter.","error_page.error_message_stripe_tax_not_active":"Købet mislykkedes, fordi Stripe Tax ikke er aktiveret. I produktion vil køb fungere uden påførte skatter.","error_page.error_only_in_sandbox":"Denne meddelelse vises kun i sandkassen.","error_page.error_message_stripe_missing_required_permission":"Købet mislykkedes, fordi Stripe-appen mangler en påkrævet tilladelse. I produktion vil køb fungere uden påførte skatter.","error_page.error_title_stripe_tax_not_active":"Stripe Tax er ikke aktiv","error_page.error_title_stripe_invalid_tax_origin_address":"Ugyldig skatteoprindelsesadresse","apple_pay.free_trial":"Gratis prøveperiode","product_info.price_after_intro_price":"Efter {{introPriceDuration}}, den {{renewalDate}}","product_info.after_trial":"efter prøveperiode","product_info.after":"efter","product_info.intro_price_phase_after_trial":"Derefter {{introPriceDuration}} for {{introPrice}}","product_info.intro_price_phase":"Først {{introPriceDuration}} for {{introPrice}}","product_info.intro_price_phase_paid_once":"betales én gang","payment_entry_page.trial_subscription_terms_info":"Efter din prøveperiode slutter, vil du blive opkrævet {{price}} {{perFrequency}} fra og med {{renewalDate}}. Du kan opsige når som helst før denne dato.","payment_entry_page.subscription_info":"Abonnementet fornys automatisk. Opsig når som helst.","payment_entry_page.otp_terms_info":"Ved at købe accepterer du, at {{appName}} kan debitere dig i overensstemmelse med deres vilkår.","payment_entry_page.subscription_terms_info":"Ved at abonnere accepterer du, at {{appName}} kan opkræve dig i henhold til deres vilkår, indtil du opsiger."},JK={"periods.week":"{{amount}} week","periods.month":"{{amount}} maand","periods.year":"{{amount}} jaar","periods.day":"{{amount}} dag","periods.weekShort":"{{amount}}wk","periods.monthShort":"{{amount}}maand","periods.yearShort":"{{amount}}jr","periods.dayShort":"{{amount}}d","periods.lifetime":"levenslang","periods.weekPlural":"{{amount}} weken","periods.monthPlural":"{{amount}} maanden","periods.yearPlural":"{{amount}} jaren","periods.dayPlural":"{{amount}} dagen","periods.weekFrequency":"wekelijks","periods.monthFrequency":"maandelijks","periods.yearFrequency":"jaarlijks","periods.dayFrequency":"dagelijks","periods.perWeekFrequency":"per week","periods.perMonthFrequency":"per maand","periods.perYearFrequency":"per jaar","periods.perDayFrequency":"per dag","periods.unknownFrequency":"onbekend","periods.weekFrequencyPlural":"elke {{amount}} weken","periods.monthFrequencyPlural":"elke {{amount}} maanden","periods.yearFrequencyPlural":"elke {{amount}} jaren","periods.dayFrequencyPlural":"elke {{amount}} dagen","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} gratis proefperiode","product_info.price_after_free_trial":"Na afloop van de proefperiode, op {{renewalDate}}","product_info.renewal_frequency":"Wordt verlengd {{frequency}}","product_info.continues_until_cancelled":"Wordt voortgezet tot annulering","product_info.cancel_anytime":"Annuleer op elk gewenst moment","payment_entry_page.payment_step_title":"Veilige afrekening via RevenueCat","payment_entry_page.button_pay":"Nu betalen","payment_entry_page.button_start_trial":"Start proefperiode","success_page.purchase_successful":"Betaling voltooid","success_page.button_close":"Doorgaan","error_page.if_error_persists":"Neem contact op met  als de fout aanhoudt","error_page.error_title_already_subscribed":"Je bent al geabonneerd op {{productTitle}}","error_page.error_title_already_purchased":"Je hebt {{productTitle}} al gekocht","error_page.error_title_other_errors":"Er is iets misgegaan","error_page.error_message_already_subscribed":"Je kunt je niet opnieuw abonneren op dit product.","error_page.error_message_already_purchased":"Je kunt dit product niet opnieuw kopen.","error_page.error_message_missing_email_error":"Een e-mailadres is vereist om de aankoop te voltooien.","error_page.error_message_network_error":"Netwerkfout. Controleer uw internetverbinding.","error_page.error_message_error_charging_payment":"Betaling mislukt.","error_page.error_message_error_setting_up_purchase":"Aankoop niet gestart vanwege een fout (foutcode: {{errorCode}}).","error_page.error_message_invalid_tax_location":"We konden uw factuuradres niet verifiëren. Controleer of de postcode en het land correct zijn.","error_page.error_message_unknown_error":"Er is een onbekende fout opgetreden (foutcode: {{errorCode}}).","error_page.button_try_again":"Opnieuw proberen","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% korting","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Totaal te betalen vandaag","product_info.subscribe_to":"Abonneren op","navbar_header.details":"Details","navbar_header.back_button":"Terug","pricing_dropdown.show_details":"Toon details","pricing_dropdown.hide_details":"Verberg details","pricing_table.tax":"Btw","pricing_table.trial_ends":"Na afloop van de proefperiode, op {{formattedTrialEndDate}}","pricing_table.total_due_today":"Totaal vandaag te betalen","pricing_table.total_excluding_tax":"Totaal exclusief btw","pricing_table.enter_billing_address_to_calculate":"Voer het factuuradres in om te berekenen","pricing_table.enter_state_or_postal_code_to_calculate":"Voer provincie of postcode in om te berekenen","pricing_table.enter_postal_code_to_calculate":"Voer postcode in om te berekenen","error_page.error_message_invalid_email_error":"Het e-mailadres {{email}} kon niet worden geverifieerd. Geef een geldig e-mailadres op.","payment_entry_page.button_payment_method":"Betaal {{formattedPrice}} met {{paymentMethod}}","payment_entry_page.button_with_price":"Betaal {{formattedPrice}}","price_update.title":"Prijsupdate","price_update.base_message":"De totale prijs is bijgewerkt met belasting op basis van uw factuuradres. Controleer en probeer het opnieuw. Uw kaart wordt slechts één keer belast.","price_update.trial_message":"De abonnementsprijs is bijgewerkt om belastingen op te nemen op basis van uw factuuradres. De gratis proefperiode blijft van toepassing. Controleer en probeer het opnieuw.","payment_entry_page.express_checkout_divider":"OF BETAAL MET EEN KAART","error_page.trouble_accessing":"Als je problemen hebt met het verkrijgen van toegang tot je aankoop, neem dan contact op met de ondersteuning via ","error_page.close_button_title":"Ga naar {{appName}}","error_page.error_title_stripe_missing_required_permission":"Ontbrekende Stripe-toestemming","error_page.button_close":"Sluiten","error_page.error_message_stripe_invalid_tax_origin_address":"De aankoop is mislukt omdat het belastingoorsprongadres ongeldig is. In productie werken aankopen zonder toegepaste belastingen.","error_page.error_message_stripe_tax_not_active":"De aankoop is mislukt omdat Stripe Tax niet is ingeschakeld. In productie werken aankopen zonder toegepaste belastingen.","error_page.error_only_in_sandbox":"Dit bericht verschijnt alleen in de sandbox.","error_page.error_message_stripe_missing_required_permission":"De aankoop is mislukt omdat de Stripe-app een vereiste toestemming mist. In productie werken aankopen zonder toegepaste belastingen.","error_page.error_title_stripe_tax_not_active":"Stripe Tax niet actief","error_page.error_title_stripe_invalid_tax_origin_address":"Ongeldig belastingoorsprongadres","apple_pay.free_trial":"Gratis proefperiode","product_info.price_after_intro_price":"Na {{introPriceDuration}}, op {{renewalDate}}","product_info.after_trial":"na proefperiode","product_info.after":"na","product_info.intro_price_phase_after_trial":"Daarna {{introPriceDuration}} voor {{introPrice}}","product_info.intro_price_phase":"Eerst {{introPriceDuration}} voor {{introPrice}}","product_info.intro_price_phase_paid_once":"eenmalig betaald","payment_entry_page.trial_subscription_terms_info":"Na afloop van uw proefperiode wordt {{price}} {{perFrequency}} in rekening gebracht, beginnend op {{renewalDate}}. U kunt op elk moment vóór deze datum annuleren.","payment_entry_page.subscription_info":"Abonnement wordt automatisch verlengd. Annuleer op elk moment.","payment_entry_page.otp_terms_info":"Door de aankoop ga je ermee akkoord dat {{appName}} kosten in rekening brengt volgens hun voorwaarden.","payment_entry_page.subscription_terms_info":"Door u te abonneren, stemt u ermee in dat {{appName}} u kosten in rekening brengt volgens hun voorwaarden totdat u annuleert."},QK={"periods.week":"{{amount}} viikko","periods.month":"{{amount}} kuukausi","periods.year":"{{amount}} vuosi","periods.day":"{{amount}} päivä","periods.weekShort":"{{amount}}vk","periods.monthShort":"{{amount}}kk","periods.yearShort":"{{amount}}v","periods.dayShort":"{{amount}}p","periods.lifetime":"elämäaika","periods.weekPlural":"{{amount}} viikkoa","periods.monthPlural":"{{amount}} kuukautta","periods.yearPlural":"{{amount}} vuotta","periods.dayPlural":"{{amount}} päivää","periods.weekFrequency":"viikoittain","periods.monthFrequency":"kuukausittain","periods.yearFrequency":"vuosittain","periods.dayFrequency":"päivittäin","periods.perWeekFrequency":"viikossa","periods.perMonthFrequency":"kuukaudessa","periods.perYearFrequency":"vuodessa","periods.perDayFrequency":"päivässä","periods.unknownFrequency":"tuntematon","periods.weekFrequencyPlural":"joka {{amount}} viikko","periods.monthFrequencyPlural":"joka {{amount}} kuukausi","periods.yearFrequencyPlural":"joka {{amount}} vuosi","periods.dayFrequencyPlural":"joka {{amount}} päivä","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} ilmainen kokeilujakso","product_info.price_after_free_trial":"Kokeilujakson päätyttyä, {{renewalDate}}","product_info.renewal_frequency":"Uusiutuu {{frequency}}","product_info.continues_until_cancelled":"Jatkuu, kunnes peruutetaan","product_info.cancel_anytime":"Peruuta milloin tahansa","payment_entry_page.payment_step_title":"Suojautunut kassatoiminto RevenueCatin kautta","payment_entry_page.button_pay":"Maksa nyt","payment_entry_page.button_start_trial":"Aloita kokeilujakso","success_page.purchase_successful":"Maksaminen onnistui","success_page.button_close":"Jatka","error_page.if_error_persists":"Jos virhe jatkuu, ota yhteyttä ","error_page.error_title_already_subscribed":"Olet jo tilannut tuotteen {{productTitle}}","error_page.error_title_already_purchased":"Olet jo ostanut tuotteen {{productTitle}}","error_page.error_title_other_errors":"Jokin meni pieleen","error_page.error_message_already_subscribed":"Et voi tilata tätä tuotetta uudelleen.","error_page.error_message_already_purchased":"Et voi ostaa tätä tuotetta uudelleen.","error_page.error_message_missing_email_error":"Sähköpostiosoite tarvitaan ostoksen loppuun saattamiseksi.","error_page.error_message_network_error":"Verkkovirhe. Tarkista internet-yhteytesi.","error_page.error_message_error_charging_payment":"Maksaminen epäonnistui.","error_page.error_message_error_setting_up_purchase":"Ostoa ei aloitettu virheen vuoksi (virhekoodi: {{errorCode}}).","error_page.error_message_invalid_tax_location":"Emme voineet vahvistaa laskutusosoitettasi. Tarkista, että postinumero ja maa ovat oikein.","error_page.error_message_unknown_error":"Tapahtui tuntematon virhe (virhekoodi: {{errorCode}}).","error_page.button_try_again":"Yritä uudelleen","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% alennus","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}} ({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Maksettava summa tänään","product_info.subscribe_to":"Tilaa","navbar_header.details":"Yksityiskohdat","navbar_header.back_button":"Takaisin","pricing_dropdown.show_details":"Näytä tiedot","pricing_dropdown.hide_details":"Piilota tiedot","pricing_table.tax":"Vero","pricing_table.trial_ends":"Kokeilujakson päätyttyä, {{formattedTrialEndDate}}","pricing_table.total_due_today":"Maksettava summa tänään","pricing_table.total_excluding_tax":"Veroton kokonaissumma","pricing_table.enter_billing_address_to_calculate":"Syötä laskutusosoite laskeaksesi","pricing_table.enter_state_or_postal_code_to_calculate":"Syötä osavaltio tai postinumero laskeaksesi","pricing_table.enter_postal_code_to_calculate":"Syötä postinumero laskeaksesi","error_page.error_message_invalid_email_error":"Sähköpostiosoitetta {{email}} ei voitu vahvistaa. Anna kelvollinen sähköpostiosoite.","payment_entry_page.button_payment_method":"Maksa {{formattedPrice}} käyttämällä {{paymentMethod}}","payment_entry_page.button_with_price":"Maksa {{formattedPrice}}","price_update.title":"Hinnan päivitys","price_update.base_message":"Kokonaishinta on päivitetty verolla laskutusosoitteesi perusteella. Tarkista ja yritä uudelleen. Korttiasi veloitetaan vain kerran.","price_update.trial_message":"Tilauksen hinta on päivitetty sisältämään verot laskutusosoitteesi perusteella. Ilmainen kokeilujakso on edelleen voimassa. Tarkista ja yritä uudelleen.","payment_entry_page.express_checkout_divider":"TAI MAKSA KORTILLA","error_page.trouble_accessing":"Jos sinulla on ongelmia ostoksesi käyttämisessä, ota yhteyttä tukeen osoitteessa ","error_page.close_button_title":"Siirry sovellukseen {{appName}}","error_page.error_title_stripe_missing_required_permission":"Puuttuva Stripe-käyttöoikeus","error_page.button_close":"Sulje","error_page.error_message_stripe_invalid_tax_origin_address":"Osto epäonnistui, koska veron alkuperäosoite on virheellinen. Tuotantoympäristössä ostot toimivat ilman veroja.","error_page.error_message_stripe_tax_not_active":"Osto epäonnistui, koska Stripe Tax ei ole käytössä. Tuotantoympäristössä ostot toimivat ilman veroja.","error_page.error_only_in_sandbox":"Tämä viesti näkyy vain hiekkalaatikossa.","error_page.error_message_stripe_missing_required_permission":"Osto epäonnistui, koska Stripe-sovellukselta puuttuu vaadittu käyttöoikeus. Tuotantoympäristössä ostot toimivat ilman veroja.","error_page.error_title_stripe_tax_not_active":"Stripe Tax ei ole aktiivinen","error_page.error_title_stripe_invalid_tax_origin_address":"Virheellinen veron alkuperäosoite","apple_pay.free_trial":"Ilmainen kokeilu","product_info.price_after_intro_price":"{{introPriceDuration}} jälkeen, {{renewalDate}}","product_info.after_trial":"kokeilujakson jälkeen","product_info.after":"jälkeen","product_info.intro_price_phase_after_trial":"Sitten {{introPriceDuration}} hintaan {{introPrice}}","product_info.intro_price_phase":"Ensimmäiset {{introPriceDuration}} hintaan {{introPrice}}","product_info.intro_price_phase_paid_once":"maksetaan kerran","payment_entry_page.trial_subscription_terms_info":"Kokeilujakson päätyttyä sinulta veloitetaan {{price}} {{perFrequency}} alkaen {{renewalDate}}. Voit peruuttaa milloin tahansa ennen tätä päivämäärää.","payment_entry_page.subscription_info":"Tilaus uusiutuu automaattisesti. Peruuta milloin tahansa.","payment_entry_page.otp_terms_info":"Ostamalla hyväksyt, että {{appName}} veloittaa sinua heidän ehtojensa mukaisesti.","payment_entry_page.subscription_terms_info":"Tilaamalla hyväksyt, että {{appName}} veloittaa sinulta ehtojensa mukaisesti, kunnes peruutat tilauksen."},ZK={"periods.week":"{{amount}} semaine","periods.month":"{{amount}} mois","periods.year":"{{amount}} an","periods.day":"{{amount}} jour","periods.weekShort":"{{amount}}sem","periods.monthShort":"{{amount}}mois","periods.yearShort":"{{amount}}an","periods.dayShort":"{{amount}}j","periods.lifetime":"à vie","periods.weekPlural":"{{amount}} semaines","periods.monthPlural":"{{amount}} mois","periods.yearPlural":"{{amount}} ans","periods.dayPlural":"{{amount}} jours","periods.weekFrequency":"hebdomadaire","periods.monthFrequency":"mensuel","periods.yearFrequency":"annuel","periods.dayFrequency":"quotidien","periods.perWeekFrequency":"par semaine","periods.perMonthFrequency":"par mois","periods.perYearFrequency":"par an","periods.perDayFrequency":"par jour","periods.unknownFrequency":"inconnu","periods.weekFrequencyPlural":"toutes les {{amount}} semaines","periods.monthFrequencyPlural":"tous les {{amount}} mois","periods.yearFrequencyPlural":"tous les {{amount}} ans","periods.dayFrequencyPlural":"tous les {{amount}} jours","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} essai gratuit","product_info.price_after_free_trial":"Après la fin de l'essai, le {{renewalDate}}","product_info.renewal_frequency":"Renouvellement {{frequency}}","product_info.continues_until_cancelled":"Continue jusqu'à annulation","product_info.cancel_anytime":"Annulez à tout moment","payment_entry_page.payment_step_title":"Paiement sécurisé par RevenueCat","payment_entry_page.button_pay":"Payer maintenant","payment_entry_page.button_start_trial":"Commencer l'essai","success_page.purchase_successful":"Paiement effectué","success_page.button_close":"Continuer","error_page.if_error_persists":"Si l'erreur persiste, veuillez contacter ","error_page.error_title_already_subscribed":"Vous êtes déjà abonné à {{productTitle}}","error_page.error_title_already_purchased":"Vous avez déjà acheté {{productTitle}}","error_page.error_title_other_errors":"Une erreur s'est produite","error_page.error_message_already_subscribed":"Vous ne pouvez pas vous abonner à nouveau à ce produit.","error_page.error_message_already_purchased":"Vous ne pouvez pas acheter ce produit à nouveau.","error_page.error_message_missing_email_error":"L'adresse e-mail est requise pour effectuer l'achat.","error_page.error_message_network_error":"Erreur réseau. Veuillez vérifier votre connexion Internet.","error_page.error_message_error_charging_payment":"Échec du paiement.","error_page.error_message_error_setting_up_purchase":"L'achat n'a pas pu démarrer en raison d'une erreur (code d'erreur : {{errorCode}}).","error_page.error_message_invalid_tax_location":"Nous n'avons pas pu vérifier votre adresse de facturation. Veuillez vérifier que le code postal et le pays sont corrects.","error_page.error_message_unknown_error":"Une erreur inconnue s'est produite (code d'erreur : {{errorCode}}).","error_page.button_try_again":"Réessayer","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% de réduction","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}} ({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Total dû aujourd'hui","product_info.subscribe_to":"S'abonner à","navbar_header.details":"Détails","navbar_header.back_button":"Retour","pricing_dropdown.show_details":"Afficher les détails","pricing_dropdown.hide_details":"Masquer les détails","pricing_table.tax":"Taxe","pricing_table.trial_ends":"Après la fin de l'essai, le {{formattedTrialEndDate}}","pricing_table.total_due_today":"Total dû aujourd'hui","pricing_table.total_excluding_tax":"Total hors taxes","pricing_table.enter_billing_address_to_calculate":"Saisir l'adresse de facturation pour calculer","pricing_table.enter_state_or_postal_code_to_calculate":"Entrez l'état ou le code postal pour calculer","pricing_table.enter_postal_code_to_calculate":"Entrez le code postal pour calculer","error_page.error_message_invalid_email_error":"L'adresse e-mail {{email}} n'a pas pu être vérifiée. Veuillez fournir une adresse e-mail valide.","payment_entry_page.button_payment_method":"Payer {{formattedPrice}} avec {{paymentMethod}}","payment_entry_page.button_with_price":"Payer {{formattedPrice}}","price_update.title":"Mise à jour du prix","price_update.base_message":"Le prix total a été mis à jour avec la taxe en fonction de votre adresse de facturation. Veuillez vérifier et réessayer. Votre carte ne sera débitée qu'une seule fois.","price_update.trial_message":"Le prix de l'abonnement a été mis à jour pour inclure les taxes en fonction de votre adresse de facturation. La période d'essai gratuit reste applicable. Veuillez vérifier et réessayer.","payment_entry_page.express_checkout_divider":"OU PAYER PAR CARTE","error_page.trouble_accessing":"Si vous avez des difficultés à accéder à votre achat, contactez le support à l'adresse suivante : ","error_page.close_button_title":"Aller sur {{appName}}","error_page.error_title_stripe_missing_required_permission":"Autorisation Stripe manquante","error_page.button_close":"Fermer","error_page.error_message_stripe_invalid_tax_origin_address":"L'achat a échoué car l'adresse d'origine de la taxe n'est pas valide. En production, les achats fonctionneront sans taxes appliquées.","error_page.error_message_stripe_tax_not_active":"L'achat a échoué car Stripe Tax n'est pas activé. En production, les achats fonctionneront sans taxes appliquées.","error_page.error_only_in_sandbox":"Ce message apparaît uniquement dans l'environnement de test.","error_page.error_message_stripe_missing_required_permission":"L'achat a échoué car l'application Stripe ne dispose pas d'une autorisation requise. En production, les achats fonctionneront sans taxes appliquées.","error_page.error_title_stripe_tax_not_active":"Stripe Tax non actif","error_page.error_title_stripe_invalid_tax_origin_address":"Adresse d'origine de la taxe non valide","apple_pay.free_trial":"Essai gratuit","product_info.price_after_intro_price":"Après {{introPriceDuration}}, le {{renewalDate}}","product_info.after_trial":"après l'essai","product_info.after":"après","product_info.intro_price_phase_after_trial":"Puis {{introPriceDuration}} pour {{introPrice}}","product_info.intro_price_phase":"{{introPriceDuration}} pour {{introPrice}} au départ","product_info.intro_price_phase_paid_once":"payé une fois","payment_entry_page.trial_subscription_terms_info":"Après la fin de votre essai, vous serez facturé {{price}} {{perFrequency}} à partir du {{renewalDate}}. Vous pouvez annuler à tout moment avant cette date.","payment_entry_page.subscription_info":"L'abonnement est renouvelé automatiquement. Annulez à tout moment.","payment_entry_page.otp_terms_info":"En achetant, vous acceptez d'autoriser {{appName}} à vous facturer conformément à ses conditions.","payment_entry_page.subscription_terms_info":"En vous abonnant, vous acceptez d'autoriser {{appName}} à vous facturer conformément à ses conditions jusqu'à ce que vous annuliez."},eY={"periods.week":"{{amount}} Woche","periods.month":"{{amount}} Monat","periods.year":"{{amount}} Jahr","periods.day":"{{amount}} Tag","periods.weekShort":"{{amount}}Wo","periods.monthShort":"{{amount}}Mo","periods.yearShort":"{{amount}}J","periods.dayShort":"{{amount}}T","periods.lifetime":"lebenslang","periods.weekPlural":"{{amount}} Wochen","periods.monthPlural":"{{amount}} Monate","periods.yearPlural":"{{amount}} Jahre","periods.dayPlural":"{{amount}} Tage","periods.weekFrequency":"wöchentlich","periods.monthFrequency":"monatlich","periods.yearFrequency":"jährlich","periods.dayFrequency":"täglich","periods.perWeekFrequency":"pro Woche","periods.perMonthFrequency":"pro Monat","periods.perYearFrequency":"pro Jahr","periods.perDayFrequency":"pro Tag","periods.unknownFrequency":"unbekannt","periods.weekFrequencyPlural":"alle {{amount}} Wochen","periods.monthFrequencyPlural":"alle {{amount}} Monate","periods.yearFrequencyPlural":"alle {{amount}} Jahre","periods.dayFrequencyPlural":"alle {{amount}} Tage","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} kostenlose Testversion","product_info.price_after_free_trial":"Nach Ablauf der Testversion, am {{renewalDate}}","product_info.renewal_frequency":"Verlängert sich {{frequency}}","product_info.continues_until_cancelled":"Läuft bis zur Kündigung","product_info.cancel_anytime":"Jederzeit kündbar","payment_entry_page.payment_step_title":"Sicherer Checkout über RevenueCat","payment_entry_page.button_pay":"Jetzt bezahlen","payment_entry_page.button_start_trial":"Testversion starten","success_page.purchase_successful":"Zahlung abgeschlossen","success_page.button_close":"Weiter","error_page.if_error_persists":"Wenn der Fehler weiterhin besteht, wenden Sie sich bitte an ","error_page.error_title_already_subscribed":"Du hast {{productTitle}} bereits abonniert","error_page.error_title_already_purchased":"Du hast {{productTitle}} bereits gekauft","error_page.error_title_other_errors":"Etwas ist schief gelaufen","error_page.error_message_already_subscribed":"Du kannst dieses Produkt nicht erneut abonnieren.","error_page.error_message_already_purchased":"Du kannst dieses Produkt nicht erneut kaufen.","error_page.error_message_missing_email_error":"Für den Kauf ist eine E-Mail-Adresse erforderlich.","error_page.error_message_network_error":"Netzwerkfehler. Bitte überprüfen Sie Ihre Internetverbindung.","error_page.error_message_error_charging_payment":"Zahlung fehlgeschlagen.","error_page.error_message_error_setting_up_purchase":"Der Kauf wurde aufgrund eines Fehlers nicht gestartet (Fehlercode: {{errorCode}}).","error_page.error_message_invalid_tax_location":"Wir konnten Ihre Rechnungsadresse nicht überprüfen. Bitte überprüfen Sie, ob die Postleitzahl und das Land korrekt sind.","error_page.error_message_unknown_error":"Ein unbekannter Fehler ist aufgetreten (Fehlercode: {{errorCode}}).","error_page.button_try_again":"Erneut versuchen","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% Rabatt","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}} ({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Heute fälliger Gesamtbetrag","product_info.subscribe_to":"Abonnieren","navbar_header.details":"Details","navbar_header.back_button":"Zurück","pricing_dropdown.show_details":"Details anzeigen","pricing_dropdown.hide_details":"Details ausblenden","pricing_table.tax":"Steuer","pricing_table.trial_ends":"Nach Ablauf der Testphase, am {{formattedTrialEndDate}}","pricing_table.total_due_today":"Heute fälliger Gesamtbetrag","pricing_table.total_excluding_tax":"Gesamtbetrag ohne Steuer","pricing_table.enter_billing_address_to_calculate":"Rechnungsadresse eingeben, um zu berechnen","pricing_table.enter_state_or_postal_code_to_calculate":"Bundesland oder Postleitzahl zur Berechnung eingeben","pricing_table.enter_postal_code_to_calculate":"Postleitzahl zur Berechnung eingeben","error_page.error_message_invalid_email_error":"Die E-Mail-Adresse {{email}} konnte nicht verifiziert werden. Bitte gib eine gültige E-Mail-Adresse an.","payment_entry_page.button_payment_method":"Mit {{paymentMethod}} für {{formattedPrice}} bezahlen","payment_entry_page.button_with_price":"{{formattedPrice}} bezahlen","price_update.title":"Preisaktualisierung","price_update.base_message":"Der Gesamtpreis wurde basierend auf Ihrer Rechnungsadresse mit Steuern aktualisiert. Bitte überprüfen Sie ihn und versuchen Sie es erneut. Ihre Karte wird erst belastet, wenn alles korrekt ist.","price_update.trial_message":"Der Abonnementpreis wurde aktualisiert, um Steuern basierend auf Ihrer Rechnungsadresse einzuschließen. Die kostenlose Testphase gilt weiterhin. Bitte überprüfen Sie und versuchen Sie es erneut.","payment_entry_page.express_checkout_divider":"ODER MIT KARTE ZAHLEN","error_page.trouble_accessing":"Wenn Sie Probleme beim Zugriff auf Ihren Kauf haben, wenden Sie sich an den Support unter ","error_page.close_button_title":"Zu {{appName}} gehen","error_page.error_title_stripe_missing_required_permission":"Fehlende Stripe-Berechtigung","error_page.button_close":"Schließen","error_page.error_message_stripe_invalid_tax_origin_address":"Der Kauf ist fehlgeschlagen, da die Steuerursprungsadresse ungültig ist. In der Produktion funktionieren Käufe ohne angewendete Steuern.","error_page.error_message_stripe_tax_not_active":"Der Kauf ist fehlgeschlagen, da Stripe Tax nicht aktiviert ist. In der Produktion funktionieren Käufe ohne angewendete Steuern.","error_page.error_only_in_sandbox":"Diese Meldung wird nur in der Sandbox angezeigt.","error_page.error_message_stripe_missing_required_permission":"Der Kauf ist fehlgeschlagen, da der Stripe-App eine erforderliche Berechtigung fehlt. In der Produktion funktionieren Käufe ohne angewendete Steuern.","error_page.error_title_stripe_tax_not_active":"Stripe Tax ist nicht aktiv","error_page.error_title_stripe_invalid_tax_origin_address":"Ungültige Steuerursprungsadresse","apple_pay.free_trial":"Kostenlose Testversion","product_info.price_after_intro_price":"Nach {{introPriceDuration}}, am {{renewalDate}}","product_info.after_trial":"nach Testphase","product_info.after":"nach","product_info.intro_price_phase_after_trial":"Danach {{introPriceDuration}} für {{introPrice}}","product_info.intro_price_phase":"Zuerst {{introPriceDuration}} für {{introPrice}}","product_info.intro_price_phase_paid_once":"einmalig bezahlt","payment_entry_page.trial_subscription_terms_info":"Nach Ablauf Ihres Testzeitraums werden Ihnen {{price}} {{perFrequency}} ab dem {{renewalDate}} berechnet. Sie können jederzeit vor diesem Datum kündigen.","payment_entry_page.subscription_info":"Das Abonnement verlängert sich automatisch. Jederzeit kündbar.","payment_entry_page.otp_terms_info":"Mit dem Kauf erklären Sie sich einverstanden, dass {{appName}} Ihnen Gebühren gemäß ihren Bedingungen berechnet.","payment_entry_page.subscription_terms_info":"Mit dem Abonnieren erklären Sie sich damit einverstanden, dass {{appName}} Ihnen gemäß ihren Bedingungen Gebühren berechnet, bis Sie kündigen."},tY={"periods.week":"{{amount}} εβδομάδα","periods.month":"{{amount}} μήνας","periods.year":"{{amount}} χρόνος","periods.day":"{{amount}} ημέρα","periods.weekShort":"{{amount}} εβδ.","periods.monthShort":"{{amount}} μήν.","periods.yearShort":"{{amount}} έτ.","periods.dayShort":"{{amount}} ημ.","periods.lifetime":"διάρκεια ζωής","periods.weekPlural":"{{amount}} εβδομάδες","periods.monthPlural":"{{amount}} μήνες","periods.yearPlural":"{{amount}} χρόνια","periods.dayPlural":"{{amount}} ημέρες","periods.weekFrequency":"εβδομαδιαία","periods.monthFrequency":"μηνιαία","periods.yearFrequency":"ετήσια","periods.dayFrequency":"καθημερινά","periods.perWeekFrequency":"ανά εβδομάδα","periods.perMonthFrequency":"ανά μήνα","periods.perYearFrequency":"ανά έτος","periods.perDayFrequency":"ανά ημέρα","periods.unknownFrequency":"άγνωστο","periods.weekFrequencyPlural":"κάθε {{amount}} εβδομάδες","periods.monthFrequencyPlural":"κάθε {{amount}} μήνες","periods.yearFrequencyPlural":"κάθε {{amount}} χρόνια","periods.dayFrequencyPlural":"κάθε {{amount}} ημέρες","product_info.subscribe_to":"Εγγραφείτε στο","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"Δωρεάν για {{trialDuration}}","product_info.price_after_free_trial":"Μετά τη λήξη της δοκιμής, στις {{renewalDate}}","product_info.total_due_today":"Σύνολο πληρωτέο σήμερα","product_info.renewal_frequency":"Ανανεώνεται {{frequency}}","product_info.continues_until_cancelled":"Συνεχίζεται μέχρι την ακύρωση","product_info.cancel_anytime":"Ακύρωση ανά πάσα στιγμή","payment_entry_page.payment_step_title":"Ασφαλής ολοκλήρωση αγοράς από την RevenueCat","payment_entry_page.button_pay":"Πληρωμή τώρα","payment_entry_page.button_start_trial":"Έναρξη δοκιμής","success_page.purchase_successful":"Η πληρωμή ολοκληρώθηκε","success_page.button_close":"Συνέχεια","error_page.if_error_persists":"Εάν το σφάλμα παραμένει, επικοινωνήστε με ","error_page.error_title_already_subscribed":"Έχετε ήδη εγγραφεί στο {{productTitle}}","error_page.error_title_already_purchased":"Έχετε ήδη αγοράσει το {{productTitle}}","error_page.error_title_other_errors":"Κάτι πήγε στραβά","error_page.error_message_already_subscribed":"Δεν μπορείτε να εγγραφείτε ξανά σε αυτό το προϊόν.","error_page.error_message_already_purchased":"Δεν μπορείτε να αγοράσετε ξανά αυτό το προϊόν.","error_page.error_message_missing_email_error":"Απαιτείται email για την ολοκλήρωση της αγοράς.","error_page.error_message_network_error":"Σφάλμα δικτύου. Ελέγξτε τη σύνδεσή σας στο διαδίκτυο.","error_page.error_message_error_charging_payment":"Η πληρωμή απέτυχε.","error_page.error_message_error_setting_up_purchase":"Η αγορά δεν ξεκίνησε λόγω σφάλματος (κωδικός σφάλματος: {{errorCode}}).","error_page.error_message_invalid_tax_location":"Δεν μπορέσαμε να επαληθεύσουμε τη διεύθυνση χρέωσής σας. Παρακαλούμε ελέγξτε ξανά τον ταχυδρομικό κώδικα και τη χώρα για να βεβαιωθείτε ότι είναι σωστά.","error_page.error_message_unknown_error":"Παρουσιάστηκε ένα άγνωστο σφάλμα (κωδικός σφάλματος: {{errorCode}}).","error_page.button_try_again":"Προσπαθήστε ξανά","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% έκπτωση","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","navbar_header.details":"Λεπτομέρειες","navbar_header.back_button":"Πίσω","pricing_dropdown.show_details":"Εμφάνιση λεπτομερειών","pricing_dropdown.hide_details":"Απόκρυψη λεπτομερειών","pricing_table.tax":"Φόρος","pricing_table.trial_ends":"Μετά τη λήξη της δοκιμαστικής περιόδου, στις {{formattedTrialEndDate}}","pricing_table.total_due_today":"Σύνολο πληρωτέο σήμερα","pricing_table.total_excluding_tax":"Σύνολο χωρίς φόρο","pricing_table.enter_billing_address_to_calculate":"Εισαγάγετε τη διεύθυνση χρέωσης για να υπολογιστεί","pricing_table.enter_state_or_postal_code_to_calculate":"Εισαγάγετε την πολιτεία ή τον ταχυδρομικό κώδικα για να υπολογιστεί","pricing_table.enter_postal_code_to_calculate":"Εισαγάγετε τον ταχυδρομικό κώδικα για να υπολογιστεί","error_page.error_message_invalid_email_error":"Η διεύθυνση email {{email}} δεν μπόρεσε να επαληθευτεί. Παρακαλώ δώστε μια έγκυρη διεύθυνση email.","payment_entry_page.button_payment_method":"Πληρωμή {{formattedPrice}} με {{paymentMethod}}","payment_entry_page.button_with_price":"Πληρωμή {{formattedPrice}}","price_update.title":"Ενημέρωση τιμής","price_update.base_message":"Η συνολική τιμή ενημερώθηκε με τον φόρο βάσει της διεύθυνσης χρέωσής σας. Ελέγξτε και δοκιμάστε ξανά. Η κάρτα σας θα χρεωθεί μόνο μία φορά.","price_update.trial_message":"Η τιμή της συνδρομής ενημερώθηκε για να συμπεριλάβει τους φόρους βάσει της διεύθυνσης χρέωσής σας. Η δωρεάν δοκιμαστική περίοδος εξακολουθεί να ισχύει. Παρακαλώ ελέγξτε και δοκιμάστε ξανά.","payment_entry_page.express_checkout_divider":"Ή ΠΛΗΡΩΣΤΕ ΜΕ ΚΑΡΤΑ","error_page.trouble_accessing":"Εάν αντιμετωπίζετε προβλήματα πρόσβασης στην αγορά σας, επικοινωνήστε με την υποστήριξη στο ","error_page.close_button_title":"Μετάβαση στο {{appName}}","error_page.error_title_stripe_missing_required_permission":"Λείπει άδεια Stripe","error_page.button_close":"Κλείσιμο","error_page.error_message_stripe_invalid_tax_origin_address":"Η αγορά απέτυχε επειδή η διεύθυνση προέλευσης φόρου δεν είναι έγκυρη. Στην παραγωγή, οι αγορές θα λειτουργούν χωρίς να εφαρμόζονται φόροι.","error_page.error_message_stripe_tax_not_active":"Η αγορά απέτυχε επειδή το Stripe Tax δεν είναι ενεργοποιημένο. Στην παραγωγή, οι αγορές θα λειτουργούν χωρίς να εφαρμόζονται φόροι.","error_page.error_only_in_sandbox":"Αυτό το μήνυμα εμφανίζεται μόνο στο sandbox.","error_page.error_message_stripe_missing_required_permission":"Η αγορά απέτυχε επειδή η εφαρμογή Stripe δεν διαθέτει την απαιτούμενη άδεια. Στην παραγωγή, οι αγορές θα λειτουργούν χωρίς να εφαρμόζονται φόροι.","error_page.error_title_stripe_tax_not_active":"Το Stripe Tax δεν είναι ενεργό","error_page.error_title_stripe_invalid_tax_origin_address":"Μη έγκυρη διεύθυνση προέλευσης φόρου","apple_pay.free_trial":"Δωρεάν δοκιμή","product_info.price_after_intro_price":"Μετά από {{introPriceDuration}}, στις {{renewalDate}}","product_info.after_trial":"μετά τη δοκιμή","product_info.after":"μετά","product_info.intro_price_phase_after_trial":"Έπειτα {{introPriceDuration}} για {{introPrice}}","product_info.intro_price_phase":"Αρχικά {{introPriceDuration}} για {{introPrice}}","product_info.intro_price_phase_paid_once":"πληρωμένο εφάπαξ","payment_entry_page.trial_subscription_terms_info":"Μετά τη λήξη της δοκιμαστικής περιόδου, θα χρεωθείτε {{price}} {{perFrequency}} ξεκινώντας από {{renewalDate}}. Μπορείτε να ακυρώσετε ανά πάσα στιγμή πριν από αυτήν την ημερομηνία.","payment_entry_page.subscription_info":"Η συνδρομή ανανεώνεται αυτόματα. Ακυρώστε ανά πάσα στιγμή.","payment_entry_page.otp_terms_info":"Με την αγορά, συμφωνείτε να επιτρέψετε στην {{appName}} να σας χρεώσει σύμφωνα με τους όρους της.","payment_entry_page.subscription_terms_info":"Με την εγγραφή σας, συμφωνείτε να επιτρέψετε στην εφαρμογή {{appName}} να σας χρεώνει σύμφωνα με τους όρους της έως ότου ακυρώσετε."},rY={"periods.week":"{{amount}} שבוע","periods.month":"{{amount}} חודש","periods.year":"{{amount}} שנה","periods.day":"{{amount}} יום","periods.weekShort":"{{amount}}wk","periods.monthShort":"{{amount}}mo","periods.yearShort":"{{amount}}yr","periods.dayShort":"{{amount}}d","periods.lifetime":"למשך כל החיים","periods.weekPlural":"{{amount}} שבועות","periods.monthPlural":"{{amount}} חודשים","periods.yearPlural":"{{amount}} שנים","periods.dayPlural":"{{amount}} ימים","periods.weekFrequency":"שבועי","periods.monthFrequency":"חודשי","periods.yearFrequency":"שנתי","periods.dayFrequency":"יומי","periods.perWeekFrequency":"לשבוע","periods.perMonthFrequency":"לחודש","periods.perYearFrequency":"לשנה","periods.perDayFrequency":"ליום","periods.unknownFrequency":"לא ידוע","periods.weekFrequencyPlural":"כל {{amount}} שבועות","periods.monthFrequencyPlural":"כל {{amount}} חודשים","periods.yearFrequencyPlural":"כל {{amount}} שנים","periods.dayFrequencyPlural":"כל {{amount}} ימים","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} ניסיון חינם","product_info.price_after_free_trial":"לאחר סיום הניסיון, ב-{{renewalDate}}","product_info.renewal_frequency":"מתחדש {{frequency}}","product_info.continues_until_cancelled":"נמשך עד ביטול","product_info.cancel_anytime":"ניתן לבטל בכל עת","payment_entry_page.payment_step_title":"קופה מאובטחת באמצעות RevenueCat","payment_entry_page.button_pay":"שלם עכשיו","payment_entry_page.button_start_trial":"התחל ניסיון","success_page.purchase_successful":"התשלום הושלם","success_page.button_close":"המשך","error_page.if_error_persists":"אם השגיאה נמשכת, אנא פנה אל ","error_page.error_title_already_subscribed":"כבר נרשמת כמנוי ל-{{productTitle}}","error_page.error_title_already_purchased":"כבר רכשת את {{productTitle}}","error_page.error_title_other_errors":"משהו השתבש","error_page.error_message_already_subscribed":"אינך יכול להירשם כמנוי למוצר זה שוב.","error_page.error_message_already_purchased":"אינך יכול לרכוש מוצר זה שוב.","error_page.error_message_missing_email_error":'דוא"ל נדרש כדי להשלים את הרכישה.',"error_page.error_message_network_error":"שגיאת רשת. אנא בדוק את חיבור האינטרנט שלך.","error_page.error_message_error_charging_payment":"התשלום נכשל.","error_page.error_message_error_setting_up_purchase":"הרכישה לא הופעלה עקב שגיאה (קוד שגיאה: {{errorCode}}).","error_page.error_message_invalid_tax_location":"לא הצלחנו לאמת את כתובת החיוב שלך. אנא בדוק שוב את המיקוד והמדינה כדי לוודא שהם נכונים.","error_page.error_message_unknown_error":"אירעה שגיאה לא ידועה (קוד שגיאה: {{errorCode}}).","error_page.button_try_again":"נסה שוב","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% הנחה","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":'סה"כ לתשלום היום',"product_info.subscribe_to":"הירשם כמנוי ל-","navbar_header.details":"פרטים","navbar_header.back_button":"חזרה","pricing_dropdown.show_details":"הצג פרטים","pricing_dropdown.hide_details":"הסתר פרטים","pricing_table.tax":"מס","pricing_table.trial_ends":"לאחר סיום תקופת הניסיון, בתאריך {{formattedTrialEndDate}}","pricing_table.total_due_today":"סך הכל לתשלום היום","pricing_table.total_excluding_tax":"סך הכל לא כולל מס","pricing_table.enter_billing_address_to_calculate":"הזן כתובת לחיוב כדי לחשב","pricing_table.enter_state_or_postal_code_to_calculate":"הזן מדינה או מיקוד לחישוב","pricing_table.enter_postal_code_to_calculate":"הזן מיקוד לחישוב","error_page.error_message_invalid_email_error":"לא ניתן לאמת את כתובת האימייל {{email}}. אנא ספק כתובת אימייל חוקית.","payment_entry_page.button_payment_method":"שלם {{formattedPrice}} באמצעות {{paymentMethod}}","payment_entry_page.button_with_price":"שלם {{formattedPrice}}","price_update.title":"עדכון מחיר","price_update.base_message":"המחיר הכולל עודכן עם מס בהתבסס על כתובת החיוב שלך. אנא בדוק שוב ונסה שוב. החיוב יתבצע רק פעם אחת.","price_update.trial_message":"מחיר המנוי עודכן כדי לכלול מיסים בהתבסס על כתובת החיוב שלך. תקופת הניסיון החינמית עדיין תקפה. אנא בדוק ונסה שוב.","payment_entry_page.express_checkout_divider":"או שלם באמצעות כרטיס","error_page.trouble_accessing":"אם אתה מתקשה לגשת לרכישה שלך, פנה לתמיכה בכתובת ","error_page.close_button_title":"עבור אל {{appName}}","error_page.error_title_stripe_missing_required_permission":"חסרה הרשאה של Stripe","error_page.button_close":"סגור","error_page.error_message_stripe_invalid_tax_origin_address":"הרכישה נכשלה מכיוון שכתובת מקור המס אינה חוקית. בייצור, רכישות יעבדו ללא מסים.","error_page.error_message_stripe_tax_not_active":"הרכישה נכשלה מכיוון שמס Stripe אינו מופעל. בייצור, רכישות יעבדו ללא מסים.","error_page.error_only_in_sandbox":"הודעה זו מופיעה רק בארגז חול.","error_page.error_message_stripe_missing_required_permission":"הרכישה נכשלה מכיוון שלאפליקציית Stripe חסרה הרשאה נדרשת. בייצור, רכישות יעבדו ללא מסים.","error_page.error_title_stripe_tax_not_active":"מס Stripe לא פעיל","error_page.error_title_stripe_invalid_tax_origin_address":"כתובת מקור מס לא חוקית","apple_pay.free_trial":"תקופת ניסיון בחינם","product_info.price_after_intro_price":"לאחר {{introPriceDuration}}, בתאריך {{renewalDate}}","product_info.after_trial":"אחרי תקופת ניסיון","product_info.after":"אחרי","product_info.intro_price_phase_after_trial":"אחר כך {{introPriceDuration}} עבור {{introPrice}}","product_info.intro_price_phase":"תחילה {{introPriceDuration}} עבור {{introPrice}}","product_info.intro_price_phase_paid_once":"משולם פעם אחת","payment_entry_page.trial_subscription_terms_info":"לאחר סיום תקופת הניסיון שלך, תחויב בסך {{price}} {{perFrequency}} החל מ-{{renewalDate}}. באפשרותך לבטל בכל עת לפני תאריך זה.","payment_entry_page.subscription_info":"המנוי מתחדש אוטומטית. ניתן לבטל בכל עת.","payment_entry_page.otp_terms_info":"ברכישה, אתה מסכים לאפשר ל-{{appName}} לחייב אותך בהתאם לתנאים שלהם.","payment_entry_page.subscription_terms_info":"על ידי הרשמה כמנוי, אתה מסכים לאפשר ל-{{appName}} לחייב אותך בהתאם לתנאים שלהם עד שתבטל."},nY={"periods.week":"{{amount}} सप्ताह","periods.month":"{{amount}} महीना","periods.year":"{{amount}} वर्ष","periods.day":"{{amount}} दिन","periods.weekShort":"{{amount}}सप्ताह","periods.monthShort":"{{amount}}महीना","periods.yearShort":"{{amount}}वर्ष","periods.dayShort":"{{amount}}दिन","periods.lifetime":"लाइफ़टाइम","periods.weekPlural":"{{amount}} सप्ताह","periods.monthPlural":"{{amount}} महीने","periods.yearPlural":"{{amount}} वर्ष","periods.dayPlural":"{{amount}} दिन","periods.weekFrequency":"साप्ताहिक","periods.monthFrequency":"मासिक","periods.yearFrequency":"वार्षिक","periods.dayFrequency":"दैनिक","periods.perWeekFrequency":"प्रति सप्ताह","periods.perMonthFrequency":"प्रति माह","periods.perYearFrequency":"प्रति वर्ष","periods.perDayFrequency":"प्रति दिन","periods.unknownFrequency":"अज्ञात","periods.weekFrequencyPlural":"प्रत्येक {{amount}} सप्ताह","periods.monthFrequencyPlural":"प्रत्येक {{amount}} महीने","periods.yearFrequencyPlural":"प्रत्येक {{amount}} वर्ष","periods.dayFrequencyPlural":"प्रत्येक {{amount}} दिन","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} निःशुल्क परीक्षण","product_info.price_after_free_trial":"परीक्षण समाप्त होने के बाद, {{renewalDate}} को","product_info.renewal_frequency":"{{frequency}} पर नवीनीकृत होता है","product_info.continues_until_cancelled":"रद्द होने तक जारी रहता है","product_info.cancel_anytime":"किसी भी समय रद्द करें","payment_entry_page.payment_step_title":"RevenueCat द्वारा सुरक्षित चेकआउट","payment_entry_page.button_pay":"अभी भुगतान करें","payment_entry_page.button_start_trial":"परीक्षण प्रारंभ करें","success_page.purchase_successful":"भुगतान पूर्ण","success_page.button_close":"जारी रखें","error_page.if_error_persists":"यदि त्रुटि बनी रहती है, तो कृपया संपर्क करें ","error_page.error_title_already_subscribed":"आपने पहले ही {{productTitle}} की सदस्यता ले ली है","error_page.error_title_already_purchased":"आपने पहले ही {{productTitle}} खरीद लिया है","error_page.error_title_other_errors":"कुछ गलत हो गया","error_page.error_message_already_subscribed":"आप इस उत्पाद की सदस्यता फिर से नहीं ले सकते.","error_page.error_message_already_purchased":"आप इस उत्पाद को फिर से नहीं खरीद सकते.","error_page.error_message_missing_email_error":"खरीद को पूरा करने के लिए ईमेल आवश्यक है।","error_page.error_message_network_error":"नेटवर्क त्रुटि। कृपया अपना इंटरनेट कनेक्शन जांचें।","error_page.error_message_error_charging_payment":"भुगतान विफल।","error_page.error_message_error_setting_up_purchase":"किसी त्रुटि के कारण खरीदारी शुरू नहीं हुई (त्रुटि कोड: {{errorCode}})।","error_page.error_message_invalid_tax_location":"हम आपके बिलिंग पते को सत्यापित नहीं कर सके। कृपया सुनिश्चित करें कि पिन कोड और देश सही हैं।","error_page.error_message_unknown_error":"एक अज्ञात त्रुटि हुई (त्रुटि कोड: {{errorCode}})।","error_page.button_try_again":"फिर से कोशिश करें","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% छूट","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"आज देय कुल राशि","product_info.subscribe_to":"सदस्यता लें","navbar_header.details":"विवरण","navbar_header.back_button":"वापस","pricing_dropdown.show_details":"विवरण दिखाएँ","pricing_dropdown.hide_details":"विवरण छिपाएँ","pricing_table.tax":"कर","pricing_table.trial_ends":"{{formattedTrialEndDate}} पर परीक्षण समाप्त होने के बाद","pricing_table.total_due_today":"आज देय कुल","pricing_table.total_excluding_tax":"कर को छोड़कर कुल","pricing_table.enter_billing_address_to_calculate":"गणना करने के लिए बिलिंग पता दर्ज करें","pricing_table.enter_state_or_postal_code_to_calculate":"गणना करने के लिए राज्य या ज़िप कोड दर्ज करें","pricing_table.enter_postal_code_to_calculate":"गणना करने के लिए ज़िप कोड दर्ज करें","error_page.error_message_invalid_email_error":"ईमेल पता {{email}} सत्यापित नहीं किया जा सका. कृपया एक मान्य ईमेल पता प्रदान करें.","payment_entry_page.button_payment_method":"{{paymentMethod}} के साथ {{formattedPrice}} का भुगतान करें","payment_entry_page.button_with_price":"{{formattedPrice}} का भुगतान करें","price_update.title":"मूल्य अपडेट","price_update.base_message":"आप के बिलिंग पते के आधार पर कुल कीमत कर के साथ अपडेट की गई थी। कृपया समीक्षा करें और फिर से प्रयास करें। आपके कार्ड से केवल एक बार शुल्क लिया जाएगा।","price_update.trial_message":"सदस्यता मूल्य आपके बिलिंग पते के आधार पर करों को शामिल करने के लिए अपडेट किया गया है। निःशुल्क परीक्षण अवधि अभी भी लागू है। कृपया जांचें और पुनः प्रयास करें।","payment_entry_page.express_checkout_divider":"या कार्ड से भुगतान करें","error_page.trouble_accessing":"यदि आपको अपनी खरीदारी तक पहुंचने में परेशानी हो रही है, तो पर समर्थन के लिए संपर्क करें","error_page.close_button_title":"{{appName}} पर जाएं","error_page.error_title_stripe_missing_required_permission":"स्ट्राइप अनुमति गुम है","error_page.button_close":"बंद करें","error_page.error_message_stripe_invalid_tax_origin_address":"खरीदारी विफल रही क्योंकि कर उत्पत्ति पता अमान्य है. उत्पादन में, खरीदारी बिना करों के लागू किए काम करेगी.","error_page.error_message_stripe_tax_not_active":"खरीदारी विफल रही क्योंकि स्ट्राइप टैक्स सक्षम नहीं है. उत्पादन में, खरीदारी बिना करों के लागू किए काम करेगी.","error_page.error_only_in_sandbox":"यह संदेश केवल सैंडबॉक्स में दिखाई देता है.","error_page.error_message_stripe_missing_required_permission":"खरीदारी विफल रही क्योंकि स्ट्राइप ऐप में आवश्यक अनुमति नहीं है. उत्पादन में, खरीदारी बिना करों के लागू किए काम करेगी.","error_page.error_title_stripe_tax_not_active":"स्ट्राइप टैक्स सक्रिय नहीं है","error_page.error_title_stripe_invalid_tax_origin_address":"अमान्य कर उत्पत्ति पता","apple_pay.free_trial":"मुफ़्त ट्रायल","product_info.price_after_intro_price":"{{introPriceDuration}} के बाद, {{renewalDate}} पर","product_info.after_trial":"ट्रायल के बाद","product_info.after":"के बाद","product_info.intro_price_phase_after_trial":"फिर {{introPriceDuration}} के लिए {{introPrice}}","product_info.intro_price_phase":"पहले {{introPriceDuration}} के लिए {{introPrice}}","product_info.intro_price_phase_paid_once":"एक बार भुगतान किया गया","payment_entry_page.trial_subscription_terms_info":"आपकी परीक्षण अवधि समाप्त होने के बाद, आपसे {{renewalDate}} से शुरू होकर {{price}} {{perFrequency}} शुल्क लिया जाएगा. आप इस तिथि से पहले कभी भी रद्द कर सकते हैं.","payment_entry_page.subscription_info":"सदस्यता स्वतः नवीनीकृत हो जाती है. कभी भी रद्द करें.","payment_entry_page.otp_terms_info":"खरीदकर, आप {{appName}} को उनकी शर्तों के अनुसार आपसे शुल्क लेने की अनुमति देने के लिए सहमत हैं.","payment_entry_page.subscription_terms_info":"सदस्यता लेकर, आप {{appName}} को रद्द करने तक उनकी शर्तों के अनुसार आपसे शुल्क लेने की अनुमति देने के लिए सहमत हैं."},aY={"periods.week":"{{amount}} hét","periods.month":"{{amount}} hónap","periods.year":"{{amount}} év","periods.day":"{{amount}} nap","periods.weekShort":"{{amount}}hét","periods.monthShort":"{{amount}}hó","periods.yearShort":"{{amount}}év","periods.dayShort":"{{amount}}n","periods.lifetime":"életre szóló","periods.weekPlural":"{{amount}} hét","periods.monthPlural":"{{amount}} hónap","periods.yearPlural":"{{amount}} év","periods.dayPlural":"{{amount}} nap","periods.weekFrequency":"heti","periods.monthFrequency":"havi","periods.yearFrequency":"éves","periods.dayFrequency":"napi","periods.perWeekFrequency":"hetente","periods.perMonthFrequency":"havonta","periods.perYearFrequency":"évente","periods.perDayFrequency":"naponta","periods.unknownFrequency":"ismeretlen","periods.weekFrequencyPlural":"minden {{amount}} hétben","periods.monthFrequencyPlural":"minden {{amount}} hónapban","periods.yearFrequencyPlural":"minden {{amount}} évben","periods.dayFrequencyPlural":"minden {{amount}} napban","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} próbaidőszak","product_info.price_after_free_trial":"A próbaidőszak vége után, {{renewalDate}}-kor","product_info.renewal_frequency":"{{frequency}} gyakorisággal megújul","product_info.continues_until_cancelled":"Folytatódik, amíg le nem mondják","product_info.cancel_anytime":"Bármikor lemondható","payment_entry_page.payment_step_title":"Biztonságos fizetés a RevenueCat-en keresztül","payment_entry_page.button_pay":"Fizetés most","payment_entry_page.button_start_trial":"Próbaidőszak indítása","success_page.purchase_successful":"Fizetés sikeres","success_page.button_close":"Tovább","error_page.if_error_persists":"Ha a hiba továbbra is fennáll, kérjük, vedd fel a kapcsolatot ","error_page.error_title_already_subscribed":"Már előfizettél a(z) {{productTitle}} termékre","error_page.error_title_already_purchased":"Már megvásároltad a(z) {{productTitle}} terméket","error_page.error_title_other_errors":"Valami hiba történt","error_page.error_message_already_subscribed":"Nem fizethetsz elő újra erre a termékre.","error_page.error_message_already_purchased":"Nem vásárolhatod meg újra ezt a terméket.","error_page.error_message_missing_email_error":"Az email cím szükséges a vásárlás befejezéséhez.","error_page.error_message_network_error":"Hálózati hiba. Kérjük, ellenőrizd az internetkapcsolatodat.","error_page.error_message_error_charging_payment":"A fizetés sikertelen volt.","error_page.error_message_error_setting_up_purchase":"Hiba miatt nem indult el a vásárlás (hibakód: {{errorCode}}).","error_page.error_message_invalid_tax_location":"Nem tudtuk ellenőrizni a számlázási címét. Kérjük, ellenőrizze, hogy az irányítószám és az ország helyes-e.","error_page.error_message_unknown_error":"Ismeretlen hiba történt (hibakód: {{errorCode}}).","error_page.button_try_again":"Újrapróbálkozás","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% kedvezmény","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Ma fizetendő összesen","product_info.subscribe_to":"Feliratkozás erre:","navbar_header.details":"Részletek","navbar_header.back_button":"Vissza","pricing_dropdown.show_details":"Részletek mutatása","pricing_dropdown.hide_details":"Részletek elrejtése","pricing_table.tax":"Adó","pricing_table.trial_ends":"A próbaidőszak vége: {{formattedTrialEndDate}}","pricing_table.total_due_today":"Ma fizetendő összeg","pricing_table.total_excluding_tax":"Összesen adó nélkül","pricing_table.enter_billing_address_to_calculate":"Adja meg a számlázási címet a számításhoz","pricing_table.enter_state_or_postal_code_to_calculate":"Adja meg az államot vagy az irányítószámot a számításhoz","pricing_table.enter_postal_code_to_calculate":"Adja meg az irányítószámot a számításhoz","error_page.error_message_invalid_email_error":"A(z) {{email}} e-mail címet nem sikerült ellenőrizni. Kérjük, adj meg egy érvényes e-mail címet.","payment_entry_page.button_payment_method":"Fizetés {{formattedPrice}} összeggel a következővel: {{paymentMethod}}","payment_entry_page.button_with_price":"Fizetés {{formattedPrice}}","price_update.title":"Ár frissítése","price_update.base_message":"A teljes ár frissítve lett az adóval a számlázási címed alapján. Kérjük, tekintsd át és próbáld újra. A kártyádat csak egyszer terheljük meg.","price_update.trial_message":"Az előfizetés ára adókkal együtt frissítésre került a számlázási címének megfelelően. Az ingyenes próbaidőszak továbbra is érvényes. Kérjük, ellenőrizze és próbálja újra.","payment_entry_page.express_checkout_divider":"VAGY FIZESSEN KÁRTYÁVAL","error_page.trouble_accessing":"Ha problémái vannak a vásárláshoz való hozzáféréssel, forduljon az ügyfélszolgálathoz a következő címen: ","error_page.close_button_title":"Ugrás a(z) {{appName}} alkalmazáshoz","error_page.error_title_stripe_missing_required_permission":"Hiányzó Stripe engedély","error_page.button_close":"Bezárás","error_page.error_message_stripe_invalid_tax_origin_address":"A vásárlás sikertelen volt, mert az adókiindulási cím érvénytelen. Éles környezetben a vásárlások adók alkalmazása nélkül fognak működni.","error_page.error_message_stripe_tax_not_active":"A vásárlás sikertelen volt, mert a Stripe adó nincs engedélyezve. Éles környezetben a vásárlások adók alkalmazása nélkül fognak működni.","error_page.error_only_in_sandbox":"Ez az üzenet csak a tesztkörnyezetben jelenik meg.","error_page.error_message_stripe_missing_required_permission":"A vásárlás sikertelen volt, mert a Stripe alkalmazásból hiányzik egy szükséges engedély. Éles környezetben a vásárlások adók alkalmazása nélkül fognak működni.","error_page.error_title_stripe_tax_not_active":"A Stripe adó nincs aktiválva","error_page.error_title_stripe_invalid_tax_origin_address":"Érvénytelen adókiindulási cím","apple_pay.free_trial":"Ingyenes próbaidőszak","product_info.price_after_intro_price":"{{introPriceDuration}} után, {{renewalDate}} napján","product_info.after_trial":"próbaidőszak után","product_info.after":"utána","product_info.intro_price_phase_after_trial":"Ezután {{introPriceDuration}} ideig {{introPrice}} áron","product_info.intro_price_phase":"Először {{introPriceDuration}} ideig {{introPrice}} áron","product_info.intro_price_phase_paid_once":"egyszeri fizetéssel","payment_entry_page.trial_subscription_terms_info":"A próbaidőszak vége után {{price}} összeget számítunk fel {{perFrequency}} gyakorisággal, kezdve {{renewalDate}} dátummal. Ezt a dátumot megelőzően bármikor lemondhatod.","payment_entry_page.subscription_info":"Az előfizetés automatikusan megújul. Bármikor lemondhatod.","payment_entry_page.otp_terms_info":"A vásárlással elfogadod, hogy a {{appName}} az általa meghatározott feltételek szerint terheljen.","payment_entry_page.subscription_terms_info":"A feliratkozással elfogadod, hogy a {{appName}} az általa meghatározott feltételek szerint terheljen, amíg le nem mondod."},iY={"periods.week":"{{amount}} minggu","periods.month":"{{amount}} bulan","periods.year":"{{amount}} tahun","periods.day":"{{amount}} hari","periods.weekShort":"{{amount}}mg","periods.monthShort":"{{amount}}bl","periods.yearShort":"{{amount}}th","periods.dayShort":"{{amount}}h","periods.lifetime":"seumur hidup","periods.weekPlural":"{{amount}} minggu","periods.monthPlural":"{{amount}} bulan","periods.yearPlural":"{{amount}} tahun","periods.dayPlural":"{{amount}} hari","periods.weekFrequency":"mingguan","periods.monthFrequency":"bulanan","periods.yearFrequency":"tahunan","periods.dayFrequency":"harian","periods.perWeekFrequency":"per minggu","periods.perMonthFrequency":"per bulan","periods.perYearFrequency":"per tahun","periods.perDayFrequency":"per hari","periods.unknownFrequency":"tidak diketahui","periods.weekFrequencyPlural":"setiap {{amount}} minggu","periods.monthFrequencyPlural":"setiap {{amount}} bulan","periods.yearFrequencyPlural":"setiap {{amount}} tahun","periods.dayFrequencyPlural":"setiap {{amount}} hari","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} uji coba gratis","product_info.price_after_free_trial":"Setelah uji coba berakhir, pada {{renewalDate}}","product_info.renewal_frequency":"Diperbarui {{frequency}}","product_info.continues_until_cancelled":"Berlanjut hingga dibatalkan","product_info.cancel_anytime":"Batalkan kapan saja","payment_entry_page.payment_step_title":"Pembayaran aman oleh RevenueCat","payment_entry_page.button_pay":"Bayar sekarang","payment_entry_page.button_start_trial":"Mulai Uji Coba","success_page.purchase_successful":"Pembayaran selesai","success_page.button_close":"Lanjutkan","error_page.if_error_persists":"Jika kesalahan berlanjut, silakan hubungi ","error_page.error_title_already_subscribed":"Anda sudah berlangganan ke {{productTitle}}","error_page.error_title_already_purchased":"Anda sudah membeli {{productTitle}}","error_page.error_title_other_errors":"Terjadi kesalahan","error_page.error_message_already_subscribed":"Anda tidak dapat berlangganan produk ini lagi.","error_page.error_message_already_purchased":"Anda tidak dapat membeli produk ini lagi.","error_page.error_message_missing_email_error":"Email diperlukan untuk menyelesaikan pembelian.","error_page.error_message_network_error":"Kesalahan jaringan. Periksa koneksi internet Anda.","error_page.error_message_error_charging_payment":"Pembayaran gagal.","error_page.error_message_error_setting_up_purchase":"Pembelian tidak dimulai karena kesalahan (kode kesalahan: {{errorCode}}).","error_page.error_message_invalid_tax_location":"Kami tidak dapat memverifikasi alamat penagihan Anda. Harap periksa kembali kode pos dan negara untuk memastikan keduanya benar.","error_page.error_message_unknown_error":"Terjadi kesalahan yang tidak diketahui (kode kesalahan: {{errorCode}}).","error_page.button_try_again":"Coba lagi","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% diskon","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Total yang harus dibayar hari ini","product_info.subscribe_to":"Berlangganan ke","navbar_header.details":"Detail","navbar_header.back_button":"Kembali","pricing_dropdown.show_details":"Tampilkan detail","pricing_dropdown.hide_details":"Sembunyikan detail","pricing_table.tax":"Pajak","pricing_table.trial_ends":"Setelah masa percobaan berakhir, pada {{formattedTrialEndDate}}","pricing_table.total_due_today":"Total yang harus dibayar hari ini","pricing_table.total_excluding_tax":"Total belum termasuk pajak","pricing_table.enter_billing_address_to_calculate":"Masukkan alamat penagihan untuk menghitung","pricing_table.enter_state_or_postal_code_to_calculate":"Masukkan negara bagian atau kode pos untuk menghitung","pricing_table.enter_postal_code_to_calculate":"Masukkan kode pos untuk menghitung","error_page.error_message_invalid_email_error":"Alamat email {{email}} tidak dapat diverifikasi. Harap berikan alamat email yang valid.","payment_entry_page.button_payment_method":"Bayar {{formattedPrice}} dengan {{paymentMethod}}","payment_entry_page.button_with_price":"Bayar {{formattedPrice}}","price_update.title":"Pembaruan harga","price_update.base_message":"Total harga telah diperbarui dengan pajak berdasarkan alamat penagihan Anda. Harap tinjau dan coba lagi. Kartu Anda hanya akan dikenakan biaya sekali.","price_update.trial_message":"Harga langganan telah diperbarui untuk menyertakan pajak berdasarkan alamat penagihan Anda. Masa percobaan gratis masih berlaku. Silakan periksa dan coba lagi.","payment_entry_page.express_checkout_divider":"ATAU BAYAR DENGAN KARTU","error_page.trouble_accessing":"Jika Anda mengalami masalah dalam mengakses pembelian, hubungi dukungan di ","error_page.close_button_title":"Pergi ke {{appName}}","error_page.error_title_stripe_missing_required_permission":"Izin Stripe tidak ada","error_page.button_close":"Tutup","error_page.error_message_stripe_invalid_tax_origin_address":"Pembelian gagal karena alamat asal pajak tidak valid. Dalam produksi, pembelian akan berfungsi tanpa pajak yang diterapkan.","error_page.error_message_stripe_tax_not_active":"Pembelian gagal karena Stripe Tax tidak diaktifkan. Dalam produksi, pembelian akan berfungsi tanpa pajak yang diterapkan.","error_page.error_only_in_sandbox":"Pesan ini hanya muncul di sandbox.","error_page.error_message_stripe_missing_required_permission":"Pembelian gagal karena aplikasi Stripe tidak memiliki izin yang diperlukan. Dalam produksi, pembelian akan berfungsi tanpa pajak yang diterapkan.","error_page.error_title_stripe_tax_not_active":"Stripe Tax tidak aktif","error_page.error_title_stripe_invalid_tax_origin_address":"Alamat asal pajak tidak valid","apple_pay.free_trial":"Uji Coba Gratis","product_info.price_after_intro_price":"Setelah {{introPriceDuration}}, pada {{renewalDate}}","product_info.after_trial":"setelah uji coba","product_info.after":"setelah","product_info.intro_price_phase_after_trial":"Kemudian {{introPriceDuration}} dengan harga {{introPrice}}","product_info.intro_price_phase":"Pertama {{introPriceDuration}} dengan harga {{introPrice}}","product_info.intro_price_phase_paid_once":"dibayar sekali","payment_entry_page.trial_subscription_terms_info":"Setelah masa percobaan Anda berakhir, Anda akan dikenakan biaya sebesar {{price}} {{perFrequency}} mulai {{renewalDate}}. Anda dapat membatalkan kapan saja sebelum tanggal ini.","payment_entry_page.subscription_info":"Langganan diperpanjang secara otomatis. Batalkan kapan saja.","payment_entry_page.otp_terms_info":"Dengan membeli, Anda setuju untuk mengizinkan {{appName}} menagih Anda sesuai dengan ketentuan mereka.","payment_entry_page.subscription_terms_info":"Dengan berlangganan, Anda setuju untuk mengizinkan {{appName}} mengenakan biaya sesuai dengan ketentuan mereka hingga Anda membatalkan."},sY={"periods.week":"{{amount}}週間","periods.month":"{{amount}}ヶ月","periods.year":"{{amount}}年","periods.day":"{{amount}}日","periods.weekShort":"{{amount}}週","periods.monthShort":"{{amount}}ヶ月","periods.yearShort":"{{amount}}年","periods.dayShort":"{{amount}}日","periods.lifetime":"生涯","periods.weekPlural":"{{amount}}週間","periods.monthPlural":"{{amount}}ヶ月","periods.yearPlural":"{{amount}}年","periods.dayPlural":"{{amount}}日","periods.weekFrequency":"毎週","periods.monthFrequency":"毎月","periods.yearFrequency":"毎年","periods.dayFrequency":"毎日","periods.perWeekFrequency":"週ごと","periods.perMonthFrequency":"月ごと","periods.perYearFrequency":"年ごと","periods.perDayFrequency":"日ごと","periods.unknownFrequency":"不明","periods.weekFrequencyPlural":"{{amount}}週間ごと","periods.monthFrequencyPlural":"{{amount}}ヶ月ごと","periods.yearFrequencyPlural":"{{amount}}年ごと","periods.dayFrequencyPlural":"{{amount}}日ごと","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}}日間無料トライアル","product_info.price_after_free_trial":"トライアル終了後、{{renewalDate}}に","product_info.renewal_frequency":"{{frequency}}で更新","product_info.continues_until_cancelled":"キャンセルされるまで継続されます","product_info.cancel_anytime":"いつでもキャンセルできます","payment_entry_page.payment_step_title":"RevenueCatによる安全なチェックアウト","payment_entry_page.button_pay":"今すぐ支払う","payment_entry_page.button_start_trial":"トライアルを開始","success_page.purchase_successful":"支払いが完了しました","success_page.button_close":"続行","error_page.if_error_persists":"エラーが続く場合は、ご連絡ください。","error_page.error_title_already_subscribed":"すでに{{productTitle}}を購読しています","error_page.error_title_already_purchased":"すでに{{productTitle}}を購入しています","error_page.error_title_other_errors":"エラーが発生しました","error_page.error_message_already_subscribed":"この商品を再度購読することはできません。","error_page.error_message_already_purchased":"この商品を再度購入することはできません。","error_page.error_message_missing_email_error":"購入を完了するにはメールアドレスが必要です。","error_page.error_message_network_error":"ネットワークエラーです。インターネット接続を確認してください。","error_page.error_message_error_charging_payment":"支払いに失敗しました。","error_page.error_message_error_setting_up_purchase":"エラーが発生したため、購入を開始できませんでした（エラーコード：{{errorCode}}）。","error_page.error_message_invalid_tax_location":"請求先住所を確認できませんでした。郵便番号と国が正しいかご確認ください。","error_page.error_message_unknown_error":"不明なエラーが発生しました（エラーコード：{{errorCode}}）。","error_page.button_try_again":"再試行","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}%オフ","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"本日のお支払い合計","product_info.subscribe_to":"購読する","navbar_header.details":"詳細","navbar_header.back_button":"戻る","pricing_dropdown.show_details":"詳細を表示","pricing_dropdown.hide_details":"詳細を隠す","pricing_table.tax":"税金","pricing_table.trial_ends":"トライアル終了後、{{formattedTrialEndDate}}","pricing_table.total_due_today":"本日お支払いいただく合計金額","pricing_table.total_excluding_tax":"税抜き合計","pricing_table.enter_billing_address_to_calculate":"請求先住所を入力して計算","pricing_table.enter_state_or_postal_code_to_calculate":"計算するには州または郵便番号を入力してください","pricing_table.enter_postal_code_to_calculate":"計算するには郵便番号を入力してください","error_page.error_message_invalid_email_error":"メールアドレス{{email}}を確認できませんでした。有効なメールアドレスを入力してください。","payment_entry_page.button_payment_method":"{{paymentMethod}}で{{formattedPrice}}を支払う","payment_entry_page.button_with_price":"{{formattedPrice}}を支払う","price_update.title":"価格の更新","price_update.base_message":"合計金額が、お客様の請求先住所に基づいて税金とともに更新されました。再度ご確認ください。カードへの請求は1回のみです。","price_update.trial_message":"請求先住所に基づいて税金を含むサブスクリプション料金が更新されました。無料トライアルは引き続き適用されます。確認して再度お試しください。","payment_entry_page.express_checkout_divider":"カードで支払う","error_page.trouble_accessing":"購入へのアクセスに問題がある場合は、サポートにお問い合わせください: ","error_page.close_button_title":"{{appName}} に移動","error_page.error_title_stripe_missing_required_permission":"必要なStripeの権限がありません","error_page.button_close":"閉じる","error_page.error_message_stripe_invalid_tax_origin_address":"税の原産地住所が無効なため、購入に失敗しました。 本番環境では、税金が適用されなくても購入は可能です。","error_page.error_message_stripe_tax_not_active":"Stripe Taxが有効になっていないため、購入に失敗しました。 本番環境では、税金が適用されなくても購入は可能です。","error_page.error_only_in_sandbox":"このメッセージはサンドボックスでのみ表示されます。","error_page.error_message_stripe_missing_required_permission":"Stripeアプリに必要な権限がないため、購入に失敗しました。 本番環境では、税金が適用されなくても購入は可能です。","error_page.error_title_stripe_tax_not_active":"Stripe Taxが有効ではありません","error_page.error_title_stripe_invalid_tax_origin_address":"税の原産地住所が無効です","apple_pay.free_trial":"無料トライアル","product_info.price_after_intro_price":"{{introPriceDuration}}の後、{{renewalDate}}に","product_info.after_trial":"トライアル後","product_info.after":"後","product_info.intro_price_phase_after_trial":"その後、{{introPriceDuration}}間は{{introPrice}}","product_info.intro_price_phase":"最初の{{introPriceDuration}}間は{{introPrice}}","product_info.intro_price_phase_paid_once":"一回払い","payment_entry_page.trial_subscription_terms_info":"トライアル期間が終了すると、{{renewalDate}}から{{price}} {{perFrequency}}が課金されます。この日より前にいつでもキャンセルできます。","payment_entry_page.subscription_info":"サブスクリプションは自動的に更新されます。いつでもキャンセルできます。","payment_entry_page.otp_terms_info":"購入することにより、{{appName}}が利用規約に基づいて料金を請求することに同意したことになります。","payment_entry_page.subscription_terms_info":"サブスクリプションに登録すると、キャンセルするまで{{appName}}が利用規約に従って課金することを許可することに同意したことになります。"},oY={"periods.week":"{{amount}}주","periods.month":"{{amount}}개월","periods.year":"{{amount}}년","periods.day":"{{amount}}일","periods.weekShort":"{{amount}}주","periods.monthShort":"{{amount}}개월","periods.yearShort":"{{amount}}년","periods.dayShort":"{{amount}}일","periods.lifetime":"평생","periods.weekPlural":"{{amount}}주","periods.monthPlural":"{{amount}}개월","periods.yearPlural":"{{amount}}년","periods.dayPlural":"{{amount}}일","periods.weekFrequency":"매주","periods.monthFrequency":"매달","periods.yearFrequency":"매년","periods.dayFrequency":"매일","periods.perWeekFrequency":"주당","periods.perMonthFrequency":"월별","periods.perYearFrequency":"연간","periods.perDayFrequency":"매일","periods.unknownFrequency":"알 수 없음","periods.weekFrequencyPlural":"{{amount}}주마다","periods.monthFrequencyPlural":"{{amount}}개월마다","periods.yearFrequencyPlural":"{{amount}}년마다","periods.dayFrequencyPlural":"{{amount}}일마다","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}}일 무료 체험","product_info.price_after_free_trial":"체험 종료 후, {{renewalDate}}에","product_info.renewal_frequency":"{{frequency}}마다 갱신","product_info.continues_until_cancelled":"취소될 때까지 계속됩니다.","product_info.cancel_anytime":"언제든지 취소 가능","payment_entry_page.payment_step_title":"RevenueCat을 통한 안전한 결제","payment_entry_page.button_pay":"지금 결제","payment_entry_page.button_start_trial":"체험 시작","success_page.purchase_successful":"결제가 완료되었습니다.","success_page.button_close":"계속","error_page.if_error_persists":"오류가 지속되면 다음으로 문의하십시오.","error_page.error_title_already_subscribed":"이미 {{productTitle}}을 구독하셨습니다","error_page.error_title_already_purchased":"이미 {{productTitle}}을 구매하셨습니다","error_page.error_title_other_errors":"문제가 발생했습니다.","error_page.error_message_already_subscribed":"이 제품을 다시 구독할 수 없습니다.","error_page.error_message_already_purchased":"이 제품을 다시 구매할 수 없습니다.","error_page.error_message_missing_email_error":"구매를 완료하려면 이메일이 필요합니다.","error_page.error_message_network_error":"네트워크 오류입니다. 인터넷 연결을 확인하십시오.","error_page.error_message_error_charging_payment":"결제에 실패했습니다.","error_page.error_message_error_setting_up_purchase":"오류로 인해 구매가 시작되지 않았습니다(오류 코드: {{errorCode}}).","error_page.error_message_invalid_tax_location":"청구 주소를 확인할 수 없습니다. 우편번호와 국가가 정확한지 다시 한번 확인해 주세요.","error_page.error_message_unknown_error":"알 수 없는 오류가 발생했습니다(오류 코드: {{errorCode}}).","error_page.button_try_again":"다시 시도","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% 할인","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"오늘 총 결제 금액","product_info.subscribe_to":"구독하기","navbar_header.details":"세부 정보","navbar_header.back_button":"뒤로","pricing_dropdown.show_details":"세부 정보 표시","pricing_dropdown.hide_details":"세부 정보 숨기기","pricing_table.tax":"세금","pricing_table.trial_ends":"체험판 종료 후, {{formattedTrialEndDate}}","pricing_table.total_due_today":"오늘 지불해야 할 총액","pricing_table.total_excluding_tax":"세금 제외 총액","pricing_table.enter_billing_address_to_calculate":"계산을 위해 청구지 주소를 입력하세요","pricing_table.enter_state_or_postal_code_to_calculate":"주 또는 우편 번호를 입력하여 계산","pricing_table.enter_postal_code_to_calculate":"우편 번호를 입력하여 계산","error_page.error_message_invalid_email_error":"이메일 주소 {{email}}을(를) 확인할 수 없습니다. 유효한 이메일 주소를 제공해 주세요.","payment_entry_page.button_payment_method":"{{paymentMethod}}으로 {{formattedPrice}} 결제","payment_entry_page.button_with_price":"{{formattedPrice}} 결제","price_update.title":"가격 업데이트","price_update.base_message":"청구지 주소를 기준으로 세금이 포함된 총 가격이 업데이트되었습니다. 다시 확인하고 시도해 주세요. 카드는 한 번만 청구됩니다.","price_update.trial_message":"청구 주소에 따라 세금이 포함된 구독 가격이 업데이트되었습니다. 무료 체험은 계속 적용됩니다. 확인하고 다시 시도해 주세요.","payment_entry_page.express_checkout_divider":"또는 카드 결제","error_page.trouble_accessing":"구매에 문제가 있는 경우 다음 주소로 지원팀에 문의하세요. ","error_page.close_button_title":"{{appName}}으로 이동","error_page.error_title_stripe_missing_required_permission":"필수 Stripe 권한 누락","error_page.button_close":"닫기","error_page.error_message_stripe_invalid_tax_origin_address":"세금 원산지 주소가 잘못되어 구매에 실패했습니다. 프로덕션 환경에서는 세금이 적용되지 않은 상태로 구매가 진행됩니다.","error_page.error_message_stripe_tax_not_active":"Stripe Tax가 활성화되지 않아 구매에 실패했습니다. 프로덕션 환경에서는 세금이 적용되지 않은 상태로 구매가 진행됩니다.","error_page.error_only_in_sandbox":"이 메시지는 샌드박스에서만 표시됩니다.","error_page.error_message_stripe_missing_required_permission":"Stripe 앱에 필요한 권한이 없어 구매에 실패했습니다. 프로덕션 환경에서는 세금이 적용되지 않은 상태로 구매가 진행됩니다.","error_page.error_title_stripe_tax_not_active":"Stripe Tax가 활성화되지 않음","error_page.error_title_stripe_invalid_tax_origin_address":"잘못된 세금 원산지 주소","apple_pay.free_trial":"무료 체험","product_info.price_after_intro_price":"{{introPriceDuration}} 후 {{renewalDate}}에","product_info.after_trial":"체험 후","product_info.after":"후","product_info.intro_price_phase_after_trial":"다음 {{introPriceDuration}} 동안 {{introPrice}}","product_info.intro_price_phase":"처음 {{introPriceDuration}} 동안 {{introPrice}}","product_info.intro_price_phase_paid_once":"1회 결제","payment_entry_page.trial_subscription_terms_info":"체험 기간이 종료되면 {{renewalDate}}부터 {{price}} {{perFrequency}}가 청구됩니다. 이 날짜 전에는 언제든지 취소할 수 있습니다.","payment_entry_page.subscription_info":"구독은 자동으로 갱신됩니다. 언제든지 취소할 수 있습니다.","payment_entry_page.otp_terms_info":"구매하시면 {{appName}}의 약관에 따라 요금이 청구되는 것에 동의하는 것입니다.","payment_entry_page.subscription_terms_info":"구독하면 취소할 때까지 {{appName}}이 약관에 따라 요금을 청구하는 데 동의하는 것입니다."},cY={"periods.week":"{{amount}} minggu","periods.month":"{{amount}} bulan","periods.year":"{{amount}} tahun","periods.day":"{{amount}} hari","periods.weekShort":"{{amount}}mg","periods.monthShort":"{{amount}}bl","periods.yearShort":"{{amount}}th","periods.dayShort":"{{amount}}h","periods.lifetime":"seumur hidup","periods.weekPlural":"{{amount}} minggu","periods.monthPlural":"{{amount}} bulan","periods.yearPlural":"{{amount}} tahun","periods.dayPlural":"{{amount}} hari","periods.weekFrequency":"mingguan","periods.monthFrequency":"bulanan","periods.yearFrequency":"tahunan","periods.dayFrequency":"harian","periods.perWeekFrequency":"setiap minggu","periods.perMonthFrequency":"setiap bulan","periods.perYearFrequency":"setiap tahun","periods.perDayFrequency":"setiap hari","periods.unknownFrequency":"tidak diketahui","periods.weekFrequencyPlural":"setiap {{amount}} minggu","periods.monthFrequencyPlural":"setiap {{amount}} bulan","periods.yearFrequencyPlural":"setiap {{amount}} tahun","periods.dayFrequencyPlural":"setiap {{amount}} hari","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} percubaan percuma","product_info.price_after_free_trial":"Selepas tamat percubaan, pada {{renewalDate}}","product_info.renewal_frequency":"Diperbaharui {{frequency}}","product_info.continues_until_cancelled":"Berterusan sehingga dibatalkan","product_info.cancel_anytime":"Batal bila-bila masa","payment_entry_page.payment_step_title":"Pembayaran selamat oleh RevenueCat","payment_entry_page.button_pay":"Bayar sekarang","payment_entry_page.button_start_trial":"Mula Percubaan","success_page.purchase_successful":"Pembayaran selesai","success_page.button_close":"Teruskan","error_page.if_error_persists":"Jika ralat berterusan, sila hubungi ","error_page.error_title_already_subscribed":"Anda sudah melanggan {{productTitle}}","error_page.error_title_already_purchased":"Anda sudah membeli {{productTitle}}","error_page.error_title_other_errors":"Ada sesuatu yang tidak kena","error_page.error_message_already_subscribed":"Anda tidak boleh melanggan produk ini lagi.","error_page.error_message_already_purchased":"Anda tidak boleh membeli produk ini lagi.","error_page.error_message_missing_email_error":"Emel diperlukan untuk menyelesaikan pembelian.","error_page.error_message_network_error":"Ralat rangkaian. Sila semak sambungan internet anda.","error_page.error_message_error_charging_payment":"Pembayaran gagal.","error_page.error_message_error_setting_up_purchase":"Pembelian tidak dimulakan disebabkan ralat (kod ralat: {{errorCode}}).","error_page.error_message_invalid_tax_location":"Kami tidak dapat mengesahkan alamat bil anda. Sila semak sama ada poskod dan negara adalah betul.","error_page.error_message_unknown_error":"Ralat yang tidak diketahui telah berlaku (kod ralat: {{errorCode}}).","error_page.button_try_again":"Cuba lagi","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% diskaun","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Jumlah yang perlu dibayar hari ini","product_info.subscribe_to":"Langgan","navbar_header.details":"Butiran","navbar_header.back_button":"Kembali","pricing_dropdown.show_details":"Tunjukkan butiran","pricing_dropdown.hide_details":"Sembunyikan butiran","pricing_table.tax":"Cukai","pricing_table.trial_ends":"Selepas tempoh percubaan tamat, pada {{formattedTrialEndDate}}","pricing_table.total_due_today":"Jumlah yang perlu dibayar hari ini","pricing_table.total_excluding_tax":"Jumlah tidak termasuk cukai","pricing_table.enter_billing_address_to_calculate":"Masukkan alamat pengebilan untuk mengira","pricing_table.enter_state_or_postal_code_to_calculate":"Masukkan negeri atau poskod untuk mengira","pricing_table.enter_postal_code_to_calculate":"Masukkan poskod untuk mengira","error_page.error_message_invalid_email_error":"Alamat e-mel {{email}} tidak dapat disahkan. Sila berikan alamat e-mel yang sah.","payment_entry_page.button_payment_method":"Bayar {{formattedPrice}} dengan {{paymentMethod}}","payment_entry_page.button_with_price":"Bayar {{formattedPrice}}","price_update.title":"Kemaskini harga","price_update.base_message":"Jumlah harga telah dikemas kini dengan cukai berdasarkan alamat pengebilan anda. Sila semak dan cuba lagi. Kad anda hanya akan dicaj sekali.","price_update.trial_message":"Harga langganan telah dikemas kini untuk memasukkan cukai berdasarkan alamat bil anda. Tempoh percubaan percuma masih terpakai. Sila semak dan cuba lagi.","payment_entry_page.express_checkout_divider":"ATAU BAYAR DENGAN KAD","error_page.trouble_accessing":"Jika anda menghadapi masalah untuk mengakses pembelian anda, hubungi sokongan di ","error_page.close_button_title":"Pergi ke {{appName}}","error_page.error_title_stripe_missing_required_permission":"Kebenaran Stripe hilang","error_page.button_close":"Tutup","error_page.error_message_stripe_invalid_tax_origin_address":"Pembelian gagal kerana alamat asal cukai tidak sah. Dalam pengeluaran, pembelian akan berfungsi tanpa cukai dikenakan.","error_page.error_message_stripe_tax_not_active":"Pembelian gagal kerana Cukai Stripe tidak didayakan. Dalam pengeluaran, pembelian akan berfungsi tanpa cukai dikenakan.","error_page.error_only_in_sandbox":"Mesej ini hanya muncul dalam kotak pasir.","error_page.error_message_stripe_missing_required_permission":"Pembelian gagal kerana aplikasi Stripe kekurangan kebenaran yang diperlukan. Dalam pengeluaran, pembelian akan berfungsi tanpa cukai dikenakan.","error_page.error_title_stripe_tax_not_active":"Cukai Stripe tidak aktif","error_page.error_title_stripe_invalid_tax_origin_address":"Alamat asal cukai Stripe tidak sah","apple_pay.free_trial":"Percubaan Percuma","product_info.price_after_intro_price":"Selepas {{introPriceDuration}}, pada {{renewalDate}}","product_info.after_trial":"selepas percubaan","product_info.after":"selepas","product_info.intro_price_phase_after_trial":"Kemudian {{introPriceDuration}} untuk {{introPrice}}","product_info.intro_price_phase":"Pertama {{introPriceDuration}} untuk {{introPrice}}","product_info.intro_price_phase_paid_once":"dibayar sekali","payment_entry_page.trial_subscription_terms_info":"Selepas tempoh percubaan anda tamat, anda akan dikenakan bayaran sebanyak {{price}} {{perFrequency}} bermula {{renewalDate}}. Anda boleh membatalkan pada bila-bila masa sebelum tarikh ini.","payment_entry_page.subscription_info":"Langganan diperbaharui secara automatik. Batalkan bila-bila masa.","payment_entry_page.otp_terms_info":"Dengan membuat pembelian, anda bersetuju untuk membenarkan {{appName}} mengenakan bayaran kepada anda mengikut terma mereka.","payment_entry_page.subscription_terms_info":"Dengan melanggan, anda bersetuju untuk membenarkan {{appName}} mengenakan bayaran kepada anda mengikut terma mereka sehingga anda membatalkan."},lY={"periods.week":"{{amount}} uke","periods.month":"{{amount}} måned","periods.year":"{{amount}} år","periods.day":"{{amount}} dag","periods.weekShort":"{{amount}}uk","periods.monthShort":"{{amount}}md","periods.yearShort":"{{amount}}år","periods.dayShort":"{{amount}}d","periods.lifetime":"livstid","periods.weekPlural":"{{amount}} uker","periods.monthPlural":"{{amount}} måneder","periods.yearPlural":"{{amount}} år","periods.dayPlural":"{{amount}} dager","periods.weekFrequency":"ukentlig","periods.monthFrequency":"månedlig","periods.yearFrequency":"årlig","periods.dayFrequency":"daglig","periods.perWeekFrequency":"per uke","periods.perMonthFrequency":"per måned","periods.perYearFrequency":"per år","periods.perDayFrequency":"per dag","periods.unknownFrequency":"ukjent","periods.weekFrequencyPlural":"hver {{amount}} uker","periods.monthFrequencyPlural":"hver {{amount}} måneder","periods.yearFrequencyPlural":"hver {{amount}} år","periods.dayFrequencyPlural":"hver {{amount}} dager","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} gratis prøveperiode","product_info.price_after_free_trial":"Etter prøveperioden slutter, den {{renewalDate}}","product_info.renewal_frequency":"Fornyes {{frequency}}","product_info.continues_until_cancelled":"Varer til den avbestilles","product_info.cancel_anytime":"Avbestille når som helst","payment_entry_page.payment_step_title":"Sikker betaling via RevenueCat","payment_entry_page.button_pay":"Betal nå","payment_entry_page.button_start_trial":"Start prøveperiode","success_page.purchase_successful":"Betalingen er fullført","success_page.button_close":"Fortsett","error_page.if_error_persists":"Hvis feilen vedvarer, vennligst kontakt ","error_page.error_title_already_subscribed":"Du abonnerer allerede på {{productTitle}}","error_page.error_title_already_purchased":"Du har allerede kjøpt {{productTitle}}","error_page.error_title_other_errors":"Noe gikk galt","error_page.error_message_already_subscribed":"Du kan ikke abonnere på dette produktet igjen.","error_page.error_message_already_purchased":"Du kan ikke kjøpe dette produktet igjen.","error_page.error_message_missing_email_error":"E-post er nødvendig for å fullføre kjøpet.","error_page.error_message_network_error":"Nettverksfeil. Vennligst sjekk internettforbindelsen din.","error_page.error_message_error_charging_payment":"Betalingen mislyktes.","error_page.error_message_error_setting_up_purchase":"Kjøpet ble ikke startet på grunn av en feil (feilkode: {{errorCode}}).","error_page.error_message_invalid_tax_location":"Vi kunne ikke bekrefte faktureringsadressen din. Vennligst sjekk at postnummeret og landet er korrekte.","error_page.error_message_unknown_error":"En ukjent feil oppstod (feilkode: {{errorCode}}).","error_page.button_try_again":"Prøv igjen","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% rabatt","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}} ({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Totalt forfaller i dag","product_info.subscribe_to":"Abonner på","navbar_header.details":"Detaljer","navbar_header.back_button":"Tilbake","pricing_dropdown.show_details":"Vis detaljer","pricing_dropdown.hide_details":"Skjul detaljer","pricing_table.tax":"Skatt","pricing_table.trial_ends":"Etter prøveperioden slutter, den {{formattedTrialEndDate}}","pricing_table.total_due_today":"Totalt forfaller i dag","pricing_table.total_excluding_tax":"Total eksklusive skatt","pricing_table.enter_billing_address_to_calculate":"Oppgi faktureringsadresse for å beregne","pricing_table.enter_state_or_postal_code_to_calculate":"Skriv inn stat eller postnummer for å beregne","pricing_table.enter_postal_code_to_calculate":"Skriv inn postnummer for å beregne","error_page.error_message_invalid_email_error":"E-postadressen {{email}} kunne ikke bekreftes. Vennligst oppgi en gyldig e-postadresse.","payment_entry_page.button_payment_method":"Betal {{formattedPrice}} med {{paymentMethod}}","payment_entry_page.button_with_price":"Betal {{formattedPrice}}","price_update.title":"Prisoppdatering","price_update.base_message":"Totalprisen er oppdatert med skatt basert på fakturaadressen din. Vennligst se gjennom og prøv igjen. Kortet ditt vil kun bli belastet én gang.","price_update.trial_message":"Abonnementsprisen er oppdatert for å inkludere skatter basert på din fakturaadresse. Den gratis prøveperioden gjelder fortsatt. Vennligst sjekk og prøv igjen.","payment_entry_page.express_checkout_divider":"ELLER BETAL MED KORT","error_page.trouble_accessing":"Hvis du har problemer med å få tilgang til kjøpet ditt, kan du kontakte support på ","error_page.close_button_title":"Gå til {{appName}}","error_page.error_title_stripe_missing_required_permission":"Mangler Stripe-tillatelse","error_page.button_close":"Lukk","error_page.error_message_stripe_invalid_tax_origin_address":"Kjøpet mislyktes fordi skatteopprinnelsesadressen er ugyldig. I produksjon vil kjøp fungere uten at skatter brukes.","error_page.error_message_stripe_tax_not_active":"Kjøpet mislyktes fordi Stripe Tax ikke er aktivert. I produksjon vil kjøp fungere uten at skatter brukes.","error_page.error_only_in_sandbox":"Denne meldingen vises bare i sandkassen.","error_page.error_message_stripe_missing_required_permission":"Kjøpet mislyktes fordi Stripe-appen mangler en nødvendig tillatelse. I produksjon vil kjøp fungere uten at skatter brukes.","error_page.error_title_stripe_tax_not_active":"Stripe Tax er ikke aktivt","error_page.error_title_stripe_invalid_tax_origin_address":"Ugyldig skatteopprinnelsesadresse","apple_pay.free_trial":"Gratis prøveperiode","product_info.price_after_intro_price":"Etter {{introPriceDuration}}, den {{renewalDate}}","product_info.after_trial":"etter prøveperiode","product_info.after":"etter","product_info.intro_price_phase_after_trial":"Deretter {{introPriceDuration}} for {{introPrice}}","product_info.intro_price_phase":"Først {{introPriceDuration}} for {{introPrice}}","product_info.intro_price_phase_paid_once":"betales én gang","payment_entry_page.trial_subscription_terms_info":"Etter at prøveperioden din er over, blir du belastet {{price}} {{perFrequency}} fra og med {{renewalDate}}. Du kan kansellere når som helst før denne datoen.","payment_entry_page.subscription_info":"Abonnementet fornyes automatisk. Avbryt når som helst.","payment_entry_page.otp_terms_info":"Ved å kjøpe godtar du at {{appName}} belaster deg i henhold til deres vilkår.","payment_entry_page.subscription_terms_info":"Ved å abonnere godtar du at {{appName}} belaster deg i henhold til deres vilkår til du kansellerer."},uY={"periods.week":"{{amount}} tydzień","periods.month":"{{amount}} miesiąc","periods.year":"{{amount}} rok","periods.day":"{{amount}} dzień","periods.weekShort":"{{amount}}tydz","periods.monthShort":"{{amount}}mies","periods.yearShort":"{{amount}}rok","periods.dayShort":"{{amount}}d","periods.lifetime":"dożywotnio","periods.weekPlural":"{{amount}} tygodni","periods.monthPlural":"{{amount}} miesięcy","periods.yearPlural":"{{amount}} lat","periods.dayPlural":"{{amount}} dni","periods.weekFrequency":"tygodniowo","periods.monthFrequency":"miesięcznie","periods.yearFrequency":"rocznie","periods.dayFrequency":"dziennie","periods.perWeekFrequency":"na tydzień","periods.perMonthFrequency":"na miesiąc","periods.perYearFrequency":"na rok","periods.perDayFrequency":"na dzień","periods.unknownFrequency":"nieznany","periods.weekFrequencyPlural":"co {{amount}} tygodni","periods.monthFrequencyPlural":"co {{amount}} miesięcy","periods.yearFrequencyPlural":"co {{amount}} lat","periods.dayFrequencyPlural":"co {{amount}} dni","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} dni próbnych","product_info.price_after_free_trial":"Po zakończeniu okresu próbnego, dnia {{renewalDate}}","product_info.renewal_frequency":"Odnawialny co {{frequency}}","product_info.continues_until_cancelled":"Kontynuowane do momentu anulowania","product_info.cancel_anytime":"Możesz anulować w dowolnym momencie","payment_entry_page.payment_step_title":"Bezpieczna płatność przez RevenueCat","payment_entry_page.button_pay":"Zapłać teraz","payment_entry_page.button_start_trial":"Rozpocznij okres próbny","success_page.purchase_successful":"Płatność zakończona","success_page.button_close":"Kontynuuj","error_page.if_error_persists":"Jeśli błąd będzie się powtarzał, skontaktuj się z ","error_page.error_title_already_subscribed":"Już subskrybujesz {{productTitle}}","error_page.error_title_already_purchased":"Już zakupiłeś/aś {{productTitle}}","error_page.error_title_other_errors":"Coś poszło nie tak","error_page.error_message_already_subscribed":"Nie możesz ponownie subskrybować tego produktu.","error_page.error_message_already_purchased":"Nie możesz ponownie zakupić tego produktu.","error_page.error_message_missing_email_error":"Adres e-mail jest wymagany do dokonania zakupu.","error_page.error_message_network_error":"Błąd sieci. Sprawdź połączenie internetowe.","error_page.error_message_error_charging_payment":"Płatność nieudana.","error_page.error_message_error_setting_up_purchase":"Zakup nie został rozpoczęty z powodu błędu (kod błędu: {{errorCode}}).","error_page.error_message_invalid_tax_location":"Nie mogliśmy zweryfikować Twojego adresu rozliczeniowego. Sprawdź, czy kod pocztowy i kraj są poprawne.","error_page.error_message_unknown_error":"Wystąpił nieznany błąd (kod błędu: {{errorCode}}).","error_page.button_try_again":"Spróbuj ponownie","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% zniżki","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Do zapłaty dzisiaj","product_info.subscribe_to":"Subskrybuj","navbar_header.details":"Szczegóły","navbar_header.back_button":"Wstecz","pricing_dropdown.show_details":"Pokaż szczegóły","pricing_dropdown.hide_details":"Ukryj szczegóły","pricing_table.tax":"Podatek","pricing_table.trial_ends":"Po zakończeniu okresu próbnego, {{formattedTrialEndDate}}","pricing_table.total_due_today":"Suma należna dzisiaj","pricing_table.total_excluding_tax":"Suma bez podatku","pricing_table.enter_billing_address_to_calculate":"Wprowadź adres rozliczeniowy, aby obliczyć","pricing_table.enter_state_or_postal_code_to_calculate":"Wprowadź stan lub kod pocztowy, aby obliczyć","pricing_table.enter_postal_code_to_calculate":"Wprowadź kod pocztowy, aby obliczyć","error_page.error_message_invalid_email_error":"Nie można zweryfikować adresu e-mail {{email}}. Proszę podać prawidłowy adres e-mail.","payment_entry_page.button_payment_method":"Zapłać {{formattedPrice}} przez {{paymentMethod}}","payment_entry_page.button_with_price":"Zapłać {{formattedPrice}}","price_update.title":"Aktualizacja ceny","price_update.base_message":"Cena całkowita została zaktualizowana o podatek na podstawie Twojego adresu rozliczeniowego. Sprawdź i spróbuj ponownie. Twoja karta zostanie obciążona tylko raz.","price_update.trial_message":"Cena subskrypcji została zaktualizowana o podatki na podstawie Twojego adresu rozliczeniowego. Okres próbny nadal obowiązuje. Sprawdź i spróbuj ponownie.","payment_entry_page.express_checkout_divider":"LUB ZAPŁAĆ KARTĄ","error_page.trouble_accessing":"Jeśli masz problemy z dostępem do zakupu, skontaktuj się z działem pomocy pod adresem ","error_page.close_button_title":"Przejdź do {{appName}}","error_page.error_title_stripe_missing_required_permission":"Brakujące uprawnienie Stripe","error_page.button_close":"Zamknij","error_page.error_message_stripe_invalid_tax_origin_address":"Zakup nie powiódł się, ponieważ adres pochodzenia podatku jest nieprawidłowy. W środowisku produkcyjnym zakupy będą działać bez naliczania podatków.","error_page.error_message_stripe_tax_not_active":"Zakup nie powiódł się, ponieważ Stripe Tax nie jest włączony. W środowisku produkcyjnym zakupy będą działać bez naliczania podatków.","error_page.error_only_in_sandbox":"Ta wiadomość pojawia się tylko w środowisku testowym.","error_page.error_message_stripe_missing_required_permission":"Zakup nie powiódł się, ponieważ aplikacja Stripe nie ma wymaganego uprawnienia. W środowisku produkcyjnym zakupy będą działać bez naliczania podatków.","error_page.error_title_stripe_tax_not_active":"Stripe Tax nieaktywny","error_page.error_title_stripe_invalid_tax_origin_address":"Nieprawidłowy adres pochodzenia podatku","apple_pay.free_trial":"Okres próbny","product_info.price_after_intro_price":"Po {{introPriceDuration}}, od {{renewalDate}}","product_info.after_trial":"po okresie próbnym","product_info.after":"po","product_info.intro_price_phase_after_trial":"Następnie {{introPriceDuration}} za {{introPrice}}","product_info.intro_price_phase":"Najpierw {{introPriceDuration}} za {{introPrice}}","product_info.intro_price_phase_paid_once":"płatne jednorazowo","payment_entry_page.trial_subscription_terms_info":"Po zakończeniu okresu próbnego zostanie pobrana opłata w wysokości {{price}} {{perFrequency}} począwszy od {{renewalDate}}. Możesz anulować subskrypcję w dowolnym momencie przed tą datą.","payment_entry_page.subscription_info":"Subskrypcja odnawia się automatycznie. Anuluj w dowolnym momencie.","payment_entry_page.otp_terms_info":"Dokonując zakupu, zgadzasz się na obciążenie przez {{appName}} zgodnie z ich warunkami.","payment_entry_page.subscription_terms_info":"Subskrybując, zgadzasz się na obciążanie przez {{appName}} zgodnie z ich warunkami do momentu anulowania."},dY={"periods.week":"{{amount}} semana","periods.month":"{{amount}} mês","periods.year":"{{amount}} ano","periods.day":"{{amount}} dia","periods.weekShort":"{{amount}}sem","periods.monthShort":"{{amount}}mês","periods.yearShort":"{{amount}}ano","periods.dayShort":"{{amount}}d","periods.lifetime":"vitalício","periods.weekPlural":"{{amount}} semanas","periods.monthPlural":"{{amount}} meses","periods.yearPlural":"{{amount}} anos","periods.dayPlural":"{{amount}} dias","periods.weekFrequency":"semanal","periods.monthFrequency":"mensal","periods.yearFrequency":"anual","periods.dayFrequency":"diário","periods.perWeekFrequency":"por semana","periods.perMonthFrequency":"por mês","periods.perYearFrequency":"por ano","periods.perDayFrequency":"por dia","periods.unknownFrequency":"desconhecido","periods.weekFrequencyPlural":"a cada {{amount}} semanas","periods.monthFrequencyPlural":"a cada {{amount}} meses","periods.yearFrequencyPlural":"a cada {{amount}} anos","periods.dayFrequencyPlural":"a cada {{amount}} dias","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} teste grátis","product_info.price_after_free_trial":"Após o término do teste, em {{renewalDate}}","product_info.renewal_frequency":"Renova {{frequency}}","product_info.continues_until_cancelled":"Continua até ser cancelado","product_info.cancel_anytime":"Cancelar a qualquer momento","payment_entry_page.payment_step_title":"Pagamento seguro pela RevenueCat","payment_entry_page.button_pay":"Pagar agora","payment_entry_page.button_start_trial":"Iniciar Teste","success_page.purchase_successful":"Pagamento concluído","success_page.button_close":"Continuar","error_page.if_error_persists":"Se o erro persistir, entre em contato com ","error_page.error_title_already_subscribed":"Você já se inscreveu em {{productTitle}}","error_page.error_title_already_purchased":"Você já comprou {{productTitle}}","error_page.error_title_other_errors":"Algo deu errado","error_page.error_message_already_subscribed":"Você não pode se inscrever neste produto novamente.","error_page.error_message_already_purchased":"Você não pode comprar este produto novamente.","error_page.error_message_missing_email_error":"Email é necessário para concluir a compra.","error_page.error_message_network_error":"Erro de rede. Verifique sua conexão com a internet.","error_page.error_message_error_charging_payment":"Pagamento falhou.","error_page.error_message_error_setting_up_purchase":"Compra não iniciada devido a um erro (código de erro: {{errorCode}}).","error_page.error_message_invalid_tax_location":"Não conseguimos verificar seu endereço de cobrança. Por favor, verifique se o código postal e o país estão corretos.","error_page.error_message_unknown_error":"Ocorreu um erro desconhecido (código de erro: {{errorCode}}).","error_page.button_try_again":"Tentar novamente","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% de desconto","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Total a pagar hoje","product_info.subscribe_to":"Subscrever","navbar_header.details":"Detalhes","navbar_header.back_button":"Voltar","pricing_dropdown.show_details":"Mostrar detalhes","pricing_dropdown.hide_details":"Ocultar detalhes","pricing_table.tax":"Imposto","pricing_table.trial_ends":"Após o término do período de avaliação, em {{formattedTrialEndDate}}","pricing_table.total_due_today":"Total a pagar hoje","pricing_table.total_excluding_tax":"Total sem impostos","pricing_table.enter_billing_address_to_calculate":"Insira o endereço de cobrança para calcular","pricing_table.enter_state_or_postal_code_to_calculate":"Insira o estado ou o CEP para calcular","pricing_table.enter_postal_code_to_calculate":"Insira o CEP para calcular","error_page.error_message_invalid_email_error":"O endereço de e-mail {{email}} não pôde ser verificado. Por favor, forneça um endereço de e-mail válido.","payment_entry_page.button_payment_method":"Pagar {{formattedPrice}} com {{paymentMethod}}","payment_entry_page.button_with_price":"Pagar {{formattedPrice}}","price_update.title":"Atualização de preço","price_update.base_message":"O preço total foi atualizado com impostos com base no seu endereço de cobrança. Por favor, revise e tente novamente. Seu cartão só será cobrado uma vez.","price_update.trial_message":"O preço da assinatura foi atualizado para incluir impostos com base no seu endereço de faturação. O período de teste gratuito continua válido. Por favor, verifique e tente novamente.","payment_entry_page.express_checkout_divider":"OU PAGUE COM CARTÃO","error_page.trouble_accessing":"Se estiver com problemas para acessar sua compra, entre em contato com o suporte em ","error_page.close_button_title":"Ir para {{appName}}","error_page.error_title_stripe_missing_required_permission":"Permissão do Stripe em falta","error_page.button_close":"Fechar","error_page.error_message_stripe_invalid_tax_origin_address":"A compra falhou porque o endereço de origem fiscal é inválido. Em produção, as compras funcionarão sem impostos aplicados.","error_page.error_message_stripe_tax_not_active":"A compra falhou porque o Stripe Tax não está ativado. Em produção, as compras funcionarão sem impostos aplicados.","error_page.error_only_in_sandbox":"Esta mensagem aparece apenas na sandbox.","error_page.error_message_stripe_missing_required_permission":"A compra falhou porque o aplicativo Stripe não tem uma permissão necessária. Em produção, as compras funcionarão sem impostos aplicados.","error_page.error_title_stripe_tax_not_active":"Stripe Tax não está ativo","error_page.error_title_stripe_invalid_tax_origin_address":"Endereço de origem fiscal inválido","apple_pay.free_trial":"Teste Gratuito","product_info.price_after_intro_price":"Após {{introPriceDuration}}, em {{renewalDate}}","product_info.after_trial":"após o período de teste","product_info.after":"após","product_info.intro_price_phase_after_trial":"Depois, {{introPriceDuration}} por {{introPrice}}","product_info.intro_price_phase":"Primeiro, {{introPriceDuration}} por {{introPrice}}","product_info.intro_price_phase_paid_once":"pago uma vez","payment_entry_page.trial_subscription_terms_info":"Após o término do período de avaliação, será cobrado o valor de {{price}} {{perFrequency}} a partir de {{renewalDate}}. Pode cancelar a qualquer momento antes desta data.","payment_entry_page.subscription_info":"A subscrição é renovada automaticamente. Cancele a qualquer momento.","payment_entry_page.otp_terms_info":"Ao comprar, você concorda em permitir que o {{appName}} cobre de acordo com os termos deles.","payment_entry_page.subscription_terms_info":"Ao subscrever, concorda em permitir que a {{appName}} lhe cobre de acordo com os seus termos até cancelar."},fY={"periods.week":"{{amount}} săptămână","periods.month":"{{amount}} lună","periods.year":"{{amount}} an","periods.day":"{{amount}} zi","periods.weekShort":"{{amount}}săpt","periods.monthShort":"{{amount}}lun","periods.yearShort":"{{amount}}an","periods.dayShort":"{{amount}}z","periods.lifetime":"pe viață","periods.weekPlural":"{{amount}} săptămâni","periods.monthPlural":"{{amount}} luni","periods.yearPlural":"{{amount}} ani","periods.dayPlural":"{{amount}} zile","periods.weekFrequency":"săptămânal","periods.monthFrequency":"lunar","periods.yearFrequency":"anual","periods.dayFrequency":"zilnic","periods.perWeekFrequency":"pe săptămână","periods.perMonthFrequency":"pe lună","periods.perYearFrequency":"pe an","periods.perDayFrequency":"pe zi","periods.unknownFrequency":"necunoscut","periods.weekFrequencyPlural":"la fiecare {{amount}} săptămâni","periods.monthFrequencyPlural":"la fiecare {{amount}} luni","periods.yearFrequencyPlural":"la fiecare {{amount}} ani","periods.dayFrequencyPlural":"la fiecare {{amount}} zile","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} perioadă de probă gratuită","product_info.price_after_free_trial":"După terminarea perioadei de probă, pe {{renewalDate}}","product_info.renewal_frequency":"Se reînnoiește {{frequency}}","product_info.continues_until_cancelled":"Continuă până la anulare","product_info.cancel_anytime":"Anulare oricând","payment_entry_page.payment_step_title":"Plata securizată prin RevenueCat","payment_entry_page.button_pay":"Plătește acum","payment_entry_page.button_start_trial":"Începe perioada de probă","success_page.purchase_successful":"Plata efectuată","success_page.button_close":"Continuă","error_page.if_error_persists":"Dacă eroarea persistă, vă rugăm să contactați ","error_page.error_title_already_subscribed":"Sunteți deja abonat la {{productTitle}}","error_page.error_title_already_purchased":"Ați achiziționat deja {{productTitle}}","error_page.error_title_other_errors":"A apărut o eroare","error_page.error_message_already_subscribed":"Nu vă puteți abona din nou la acest produs.","error_page.error_message_already_purchased":"Nu puteți achiziționa din nou acest produs.","error_page.error_message_missing_email_error":"Adresa de e-mail este necesară pentru a finaliza achiziția.","error_page.error_message_network_error":"Eroare de rețea. Verificați conexiunea la internet.","error_page.error_message_error_charging_payment":"Plata a eșuat.","error_page.error_message_error_setting_up_purchase":"Achiziția nu a putut fi inițiată din cauza unei erori (cod de eroare: {{errorCode}}).","error_page.error_message_invalid_tax_location":"Nu am putut verifica adresa de facturare. Vă rugăm să verificați dacă codul poștal și țara sunt corecte.","error_page.error_message_unknown_error":"A apărut o eroare necunoscută (cod de eroare: {{errorCode}}).","error_page.button_try_again":"Încearcă din nou","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% reducere","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Total de plată astăzi","product_info.subscribe_to":"Abonare la","navbar_header.details":"Detalii","navbar_header.back_button":"Înapoi","pricing_dropdown.show_details":"Arată detalii","pricing_dropdown.hide_details":"Ascunde detalii","pricing_table.tax":"Taxă","pricing_table.trial_ends":"După ce perioada de probă se termină, pe {{formattedTrialEndDate}}","pricing_table.total_due_today":"Total de plătit astăzi","pricing_table.total_excluding_tax":"Total fără taxe","pricing_table.enter_billing_address_to_calculate":"Introduceți adresa de facturare pentru a calcula","pricing_table.enter_state_or_postal_code_to_calculate":"Introduceți statul sau codul poștal pentru a calcula","pricing_table.enter_postal_code_to_calculate":"Introduceți codul poștal pentru a calcula","error_page.error_message_invalid_email_error":"Adresa de e-mail {{email}} nu a putut fi verificată. Vă rugăm să furnizați o adresă de e-mail validă.","payment_entry_page.button_payment_method":"Plătește {{formattedPrice}} cu {{paymentMethod}}","payment_entry_page.button_with_price":"Plătește {{formattedPrice}}","price_update.title":"Actualizare preț","price_update.base_message":"Prețul total a fost actualizat cu taxe, în funcție de adresa dumneavoastră de facturare. Vă rugăm să revizuiți și să încercați din nou. Cardul dumneavoastră va fi debitat o singură dată.","price_update.trial_message":"Prețul abonamentului a fost actualizat pentru a include taxele bazate pe adresa dvs. de facturare. Perioada de probă gratuită rămâne valabilă. Vă rugăm să verificați și să încercați din nou.","payment_entry_page.express_checkout_divider":"SAU PLĂTEȘTE CU CARDUL","error_page.trouble_accessing":"Dacă întâmpini probleme în accesarea achiziției tale, contactează serviciul de asistență la ","error_page.close_button_title":"Mergi la {{appName}}","error_page.error_title_stripe_missing_required_permission":"Permisiune Stripe lipsă","error_page.button_close":"Închide","error_page.error_message_stripe_invalid_tax_origin_address":"Achiziția a eșuat deoarece adresa de origine fiscală este nevalidă. În producție, achizițiile vor funcționa fără taxe aplicate.","error_page.error_message_stripe_tax_not_active":"Achiziția a eșuat deoarece Stripe Tax nu este activat. În producție, achizițiile vor funcționa fără taxe aplicate.","error_page.error_only_in_sandbox":"Acest mesaj apare doar în sandbox.","error_page.error_message_stripe_missing_required_permission":"Achiziția a eșuat deoarece aplicației Stripe îi lipsește o permisiune necesară. În producție, achizițiile vor funcționa fără taxe aplicate.","error_page.error_title_stripe_tax_not_active":"Stripe Tax nu este activ","error_page.error_title_stripe_invalid_tax_origin_address":"Adresă de origine fiscală Stripe nevalidă","apple_pay.free_trial":"Perioadă de probă gratuită","product_info.price_after_intro_price":"După {{introPriceDuration}}, pe {{renewalDate}}","product_info.after_trial":"după perioada de probă","product_info.after":"după","product_info.intro_price_phase_after_trial":"Apoi {{introPriceDuration}} pentru {{introPrice}}","product_info.intro_price_phase":"Mai întâi {{introPriceDuration}} pentru {{introPrice}}","product_info.intro_price_phase_paid_once":"plătit o singură dată","payment_entry_page.trial_subscription_terms_info":"După ce perioada de probă se termină, veți fi taxat cu {{price}} {{perFrequency}} începând cu {{renewalDate}}. Puteți anula oricând înainte de această dată.","payment_entry_page.subscription_info":"Abonamentul se reînnoiește automat. Anulați oricând.","payment_entry_page.otp_terms_info":"Prin achiziționarea, sunteți de acord să permiteți {{appName}} să vă taxeze conform termenilor săi.","payment_entry_page.subscription_terms_info":"Prin abonare, sunteți de acord să permiteți {{appName}} să vă taxeze conform termenilor săi până la anulare."},pY={"periods.week":"{{amount}} неделя","periods.month":"{{amount}} месяц","periods.year":"{{amount}} год","periods.day":"{{amount}} день","periods.weekShort":"{{amount}}нед","periods.monthShort":"{{amount}}мес","periods.yearShort":"{{amount}}г","periods.dayShort":"{{amount}}д","periods.lifetime":"пожизненно","periods.weekPlural":"{{amount}} недель","periods.monthPlural":"{{amount}} месяцев","periods.yearPlural":"{{amount}} лет","periods.dayPlural":"{{amount}} дней","periods.weekFrequency":"еженедельно","periods.monthFrequency":"ежемесячно","periods.yearFrequency":"ежегодно","periods.dayFrequency":"ежедневно","periods.perWeekFrequency":"в неделю","periods.perMonthFrequency":"в месяц","periods.perYearFrequency":"в год","periods.perDayFrequency":"в день","periods.unknownFrequency":"неизвестно","periods.weekFrequencyPlural":"каждые {{amount}} недель","periods.monthFrequencyPlural":"каждые {{amount}} месяцев","periods.yearFrequencyPlural":"каждые {{amount}} лет","periods.dayFrequencyPlural":"каждые {{amount}} дней","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} бесплатная пробная версия","product_info.price_after_free_trial":"После окончания пробного периода, {{renewalDate}}","product_info.renewal_frequency":"Продлевается {{frequency}}","product_info.continues_until_cancelled":"Продолжается до отмены","product_info.cancel_anytime":"Отменить в любое время","payment_entry_page.payment_step_title":"Безопасная оплата через RevenueCat","payment_entry_page.button_pay":"Оплатить сейчас","payment_entry_page.button_start_trial":"Начать пробный период","success_page.purchase_successful":"Оплата завершена","success_page.button_close":"Продолжить","error_page.if_error_persists":"Если ошибка сохраняется, пожалуйста, свяжитесь с ","error_page.error_title_already_subscribed":"Вы уже подписаны на {{productTitle}}","error_page.error_title_already_purchased":"Вы уже приобрели {{productTitle}}","error_page.error_title_other_errors":"Что-то пошло не так","error_page.error_message_already_subscribed":"Вы не можете подписаться на этот продукт повторно.","error_page.error_message_already_purchased":"Вы не можете приобрести этот продукт повторно.","error_page.error_message_missing_email_error":"Для завершения покупки необходим адрес электронной почты.","error_page.error_message_network_error":"Ошибка сети. Проверьте ваше интернет-соединение.","error_page.error_message_error_charging_payment":"Оплата не прошла.","error_page.error_message_error_setting_up_purchase":"Покупка не была начата из-за ошибки (код ошибки: {{errorCode}}).","error_page.error_message_invalid_tax_location":"Мы не смогли проверить ваш платежный адрес. Пожалуйста, проверьте, что почтовый индекс и страна указаны правильно.","error_page.error_message_unknown_error":"Произошла неизвестная ошибка (код ошибки: {{errorCode}}).","error_page.button_try_again":"Повторить попытку","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% скидки","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Всего к оплате сегодня","product_info.subscribe_to":"Подписаться","navbar_header.details":"Детали","navbar_header.back_button":"Назад","pricing_dropdown.show_details":"Показать детали","pricing_dropdown.hide_details":"Скрыть детали","pricing_table.tax":"Налог","pricing_table.trial_ends":"После окончания пробного периода, {{formattedTrialEndDate}}","pricing_table.total_due_today":"Итого к оплате сегодня","pricing_table.total_excluding_tax":"Итого без учета налога","pricing_table.enter_billing_address_to_calculate":"Введите платежный адрес для расчета","pricing_table.enter_state_or_postal_code_to_calculate":"Введите штат или почтовый индекс для расчета","pricing_table.enter_postal_code_to_calculate":"Введите почтовый индекс для расчета","error_page.error_message_invalid_email_error":"Не удалось проверить адрес электронной почты {{email}}. Пожалуйста, укажите действительный адрес электронной почты.","payment_entry_page.button_payment_method":"Оплатить {{formattedPrice}} через {{paymentMethod}}","payment_entry_page.button_with_price":"Оплатить {{formattedPrice}}","price_update.title":"Обновление цены","price_update.base_message":"Общая цена была обновлена с учетом налога на основе вашего платежного адреса. Пожалуйста, проверьте и повторите попытку. С вашей карты будет списано только один раз.","price_update.trial_message":"Цена подписки была обновлена с учетом налогов на основе вашего платежного адреса. Пробный период остается бесплатным. Пожалуйста, проверьте и попробуйте снова.","payment_entry_page.express_checkout_divider":"ИЛИ ОПЛАТИТЕ КАРТОЙ","error_page.trouble_accessing":"Если у вас возникли проблемы с доступом к вашей покупке, обратитесь в службу поддержки по адресу ","error_page.close_button_title":"Перейти в {{appName}}","error_page.error_title_stripe_missing_required_permission":"Отсутствует разрешение Stripe","error_page.button_close":"Закрыть","error_page.error_message_stripe_invalid_tax_origin_address":"Покупка не удалась, так как адрес отправления налога недействителен. В рабочей среде покупки будут работать без применения налогов.","error_page.error_message_stripe_tax_not_active":"Покупка не удалась, так как Stripe Tax не включен. В рабочей среде покупки будут работать без применения налогов.","error_page.error_only_in_sandbox":"Это сообщение появляется только в песочнице.","error_page.error_message_stripe_missing_required_permission":"Покупка не удалась, так как у приложения Stripe отсутствует необходимое разрешение. В рабочей среде покупки будут работать без применения налогов.","error_page.error_title_stripe_tax_not_active":"Stripe Tax не активен","error_page.error_title_stripe_invalid_tax_origin_address":"Недействительный адрес отправления налога","apple_pay.free_trial":"Бесплатная пробная версия","product_info.price_after_intro_price":"После {{introPriceDuration}}, {{renewalDate}}","product_info.after_trial":"после пробного периода","product_info.after":"после","product_info.intro_price_phase_after_trial":"Затем {{introPriceDuration}} за {{introPrice}}","product_info.intro_price_phase":"Сначала {{introPriceDuration}} за {{introPrice}}","product_info.intro_price_phase_paid_once":"единоразовый платеж","payment_entry_page.trial_subscription_terms_info":"По окончании пробного периода с вас будет взиматься плата в размере {{price}} {{perFrequency}}, начиная с {{renewalDate}}. Вы можете отменить подписку в любое время до этой даты.","payment_entry_page.subscription_info":"Подписка продлевается автоматически. Отменить можно в любое время.","payment_entry_page.otp_terms_info":"Совершая покупку, вы соглашаетесь с тем, что {{appName}} будет взимать с вас плату в соответствии со своими условиями.","payment_entry_page.subscription_terms_info":"Подписываясь, вы соглашаетесь с тем, что {{appName}} будет взимать с вас плату в соответствии с их условиями до тех пор, пока вы не отмените подписку."},hY={"periods.week":"{{amount}} týždeň","periods.month":"{{amount}} mesiac","periods.year":"{{amount}} rok","periods.day":"{{amount}} deň","periods.weekShort":"{{amount}}týž","periods.monthShort":"{{amount}}mes","periods.yearShort":"{{amount}}rok","periods.dayShort":"{{amount}}d","periods.lifetime":"doživotne","periods.weekPlural":"{{amount}} týždňov","periods.monthPlural":"{{amount}} mesiacov","periods.yearPlural":"{{amount}} rokov","periods.dayPlural":"{{amount}} dní","periods.weekFrequency":"týždenne","periods.monthFrequency":"mesačne","periods.yearFrequency":"ročne","periods.dayFrequency":"denne","periods.perWeekFrequency":"týždenne","periods.perMonthFrequency":"mesačne","periods.perYearFrequency":"ročne","periods.perDayFrequency":"denne","periods.unknownFrequency":"neznáme","periods.weekFrequencyPlural":"každých {{amount}} týždňov","periods.monthFrequencyPlural":"každých {{amount}} mesiacov","periods.yearFrequencyPlural":"každých {{amount}} rokov","periods.dayFrequencyPlural":"každých {{amount}} dní","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} bezplatné skúšobné obdobie","product_info.price_after_free_trial":"Po skončení skúšobného obdobia, dňa {{renewalDate}}","product_info.renewal_frequency":"Obnovuje sa {{frequency}}","product_info.continues_until_cancelled":"Pokračuje, kým sa nezruší","product_info.cancel_anytime":"Kedykoľvek zrušiť","payment_entry_page.payment_step_title":"Bezpečný nákup prostredníctvom RevenueCat","payment_entry_page.button_pay":"Zaplatiť teraz","payment_entry_page.button_start_trial":"Spustiť skúšobné obdobie","success_page.purchase_successful":"Platba dokončená","success_page.button_close":"Pokračovať","error_page.if_error_persists":"Ak chyba pretrváva, kontaktujte ","error_page.error_title_already_subscribed":"Už ste si predplatili {{productTitle}}","error_page.error_title_already_purchased":"Už ste si zakúpili {{productTitle}}","error_page.error_title_other_errors":"Niečo sa pokazilo","error_page.error_message_already_subscribed":"Na tento produkt sa nemôžete znova prihlásiť na odber.","error_page.error_message_already_purchased":"Tento produkt si nemôžete znova zakúpiť.","error_page.error_message_missing_email_error":"Na dokončenie nákupu je potrebný e-mail.","error_page.error_message_network_error":"Chyba siete. Skontrolujte svoje internetové pripojenie.","error_page.error_message_error_charging_payment":"Platba zlyhala.","error_page.error_message_error_setting_up_purchase":"Nákup sa nespustil kvôli chybe (kód chyby: {{errorCode}}).","error_page.error_message_invalid_tax_location":"Nepodarilo sa nám overiť vašu fakturačnú adresu. Skontrolujte, prosím, či je PSČ a krajina správne.","error_page.error_message_unknown_error":"Vyskytla sa neznáma chyba (kód chyby: {{errorCode}}).","error_page.button_try_again":"Skúsiť znova","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% zľava","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Celková suma splatná dnes","product_info.subscribe_to":"Prihlásiť sa na odber","navbar_header.details":"Podrobnosti","navbar_header.back_button":"Späť","pricing_dropdown.show_details":"Zobraziť podrobnosti","pricing_dropdown.hide_details":"Skryť podrobnosti","pricing_table.tax":"Daň","pricing_table.trial_ends":"Po skončení skúšobnej verzie, dňa {{formattedTrialEndDate}}","pricing_table.total_due_today":"Celková suma splatná dnes","pricing_table.total_excluding_tax":"Celkom bez dane","pricing_table.enter_billing_address_to_calculate":"Zadajte fakturačnú adresu pre výpočet","pricing_table.enter_state_or_postal_code_to_calculate":"Zadajte štát alebo PSČ pre výpočet","pricing_table.enter_postal_code_to_calculate":"Zadajte PSČ pre výpočet","error_page.error_message_invalid_email_error":"E-mailová adresa {{email}} sa nedala overiť. Zadajte platnú e-mailovú adresu.","payment_entry_page.button_payment_method":"Zaplatiť sumu {{formattedPrice}} pomocou {{paymentMethod}}","payment_entry_page.button_with_price":"Zaplatiť {{formattedPrice}}","price_update.title":"Aktualizácia ceny","price_update.base_message":"Celková cena bola aktualizovaná o daň na základe vašej fakturačnej adresy. Skontrolujte to a skúste znova. Vaša karta bude zaťažená iba raz.","price_update.trial_message":"Cena predplatného bola aktualizovaná o daňe na základe vašej fakturačnej adresy. Bezplatná skúšobná doba stále platí. Prosím, skontrolujte a skúste znova.","payment_entry_page.express_checkout_divider":"ALEBO ZAPLATIŤ KARTOU","error_page.trouble_accessing":"Ak máte problémy s prístupom k svojmu nákupu, kontaktujte podporu na ","error_page.close_button_title":"Prejsť na {{appName}}","error_page.error_title_stripe_missing_required_permission":"Chýbajúce povolenie Stripe","error_page.button_close":"Zavrieť","error_page.error_message_stripe_invalid_tax_origin_address":"Nákup sa nepodaril, pretože adresa pôvodu dane je neplatná. V produkčnom prostredí budú nákupy fungovať bez uplatnenia daní.","error_page.error_message_stripe_tax_not_active":"Nákup sa nepodaril, pretože Stripe Tax nie je povolený. V produkčnom prostredí budú nákupy fungovať bez uplatnenia daní.","error_page.error_only_in_sandbox":"Táto správa sa zobrazuje iba v testovacom prostredí (sandbox).","error_page.error_message_stripe_missing_required_permission":"Nákup sa nepodaril, pretože aplikácii Stripe chýba požadované povolenie. V produkčnom prostredí budú nákupy fungovať bez uplatnenia daní.","error_page.error_title_stripe_tax_not_active":"Stripe Tax nie je aktívny","error_page.error_title_stripe_invalid_tax_origin_address":"Neplatná adresa pôvodu dane","apple_pay.free_trial":"Skúšobná verzia zdarma","product_info.price_after_intro_price":"Po {{introPriceDuration}}, dňa {{renewalDate}}","product_info.after_trial":"po skúšobnej dobe","product_info.after":"po","product_info.intro_price_phase_after_trial":"Potom {{introPriceDuration}} za {{introPrice}}","product_info.intro_price_phase":"Najprv {{introPriceDuration}} za {{introPrice}}","product_info.intro_price_phase_paid_once":"zaplatené jednorazovo","payment_entry_page.trial_subscription_terms_info":"Po skončení skúšobného obdobia vám bude účtovaná suma {{price}} {{perFrequency}} počnúc dňom {{renewalDate}}. Pred týmto dátumom môžete kedykoľvek zrušiť.","payment_entry_page.subscription_info":"Predplatné sa automaticky obnovuje. Zrušiť môžete kedykoľvek.","payment_entry_page.otp_terms_info":"Zakúpením súhlasíte s tým, že spoločnosti {{appName}} umožníte účtovať vám poplatky v súlade s jej podmienkami.","payment_entry_page.subscription_terms_info":"Prihlásením na odber súhlasíte s tým, že spoločnosť {{appName}} vám bude účtovať poplatky podľa svojich podmienok, až kým odber nezrušíte."},mY={"periods.week":"{{amount}} vecka","periods.month":"{{amount}} månad","periods.year":"{{amount}} år","periods.day":"{{amount}} dag","periods.weekShort":"{{amount}}v","periods.monthShort":"{{amount}}mån","periods.yearShort":"{{amount}}år","periods.dayShort":"{{amount}}d","periods.lifetime":"livstid","periods.weekPlural":"{{amount}} veckor","periods.monthPlural":"{{amount}} månader","periods.yearPlural":"{{amount}} år","periods.dayPlural":"{{amount}} dagar","periods.weekFrequency":"veckovis","periods.monthFrequency":"månadsvis","periods.yearFrequency":"årligen","periods.dayFrequency":"dagligen","periods.perWeekFrequency":"per vecka","periods.perMonthFrequency":"per månad","periods.perYearFrequency":"per år","periods.perDayFrequency":"per dag","periods.unknownFrequency":"okänd","periods.weekFrequencyPlural":"varje {{amount}} veckor","periods.monthFrequencyPlural":"varje {{amount}} månader","periods.yearFrequencyPlural":"varje {{amount}} år","periods.dayFrequencyPlural":"varje {{amount}} dagar","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} gratis provperiod","product_info.price_after_free_trial":"Efter provperioden slutar, den {{renewalDate}}","product_info.renewal_frequency":"Förnyas {{frequency}}","product_info.continues_until_cancelled":"Gäller tills avbokad","product_info.cancel_anytime":"Avboka när som helst","payment_entry_page.payment_step_title":"Säker betalning via RevenueCat","payment_entry_page.button_pay":"Betala nu","payment_entry_page.button_start_trial":"Starta provperiod","success_page.purchase_successful":"Betalningen är klar","success_page.button_close":"Fortsätt","error_page.if_error_persists":"Om felet kvarstår, vänligen kontakta ","error_page.error_title_already_subscribed":"Du prenumererar redan på {{productTitle}}","error_page.error_title_already_purchased":"Du har redan köpt {{productTitle}}","error_page.error_title_other_errors":"Något gick fel","error_page.error_message_already_subscribed":"Du kan inte prenumerera på den här produkten igen.","error_page.error_message_already_purchased":"Du kan inte köpa den här produkten igen.","error_page.error_message_missing_email_error":"E-post krävs för att slutföra köpet.","error_page.error_message_network_error":"Nätverksfel. Kontrollera din internetanslutning.","error_page.error_message_error_charging_payment":"Betalningen misslyckades.","error_page.error_message_error_setting_up_purchase":"Köp kunde inte startas på grund av ett fel (felkod: {{errorCode}}).","error_page.error_message_invalid_tax_location":"Vi kunde inte verifiera din faktureringsadress. Kontrollera att postnummer och land är korrekta.","error_page.error_message_unknown_error":"Ett okänt fel inträffade (felkod: {{errorCode}}).","error_page.button_try_again":"Försök igen","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% rabatt","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}} ({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Totalt att betala idag","product_info.subscribe_to":"Prenumerera på","navbar_header.details":"Detaljer","navbar_header.back_button":"Tillbaka","pricing_dropdown.show_details":"Visa detaljer","pricing_dropdown.hide_details":"Dölj detaljer","pricing_table.tax":"Moms","pricing_table.trial_ends":"Efter provperiodens slut, den {{formattedTrialEndDate}}","pricing_table.total_due_today":"Total summa att betala idag","pricing_table.total_excluding_tax":"Totalt exklusive moms","pricing_table.enter_billing_address_to_calculate":"Ange faktureringsadress för att beräkna","pricing_table.enter_state_or_postal_code_to_calculate":"Ange delstat eller postnummer för att beräkna","pricing_table.enter_postal_code_to_calculate":"Ange postnummer för att beräkna","error_page.error_message_invalid_email_error":"E-postadressen {{email}} kunde inte verifieras. Ange en giltig e-postadress.","payment_entry_page.button_payment_method":"Betala {{formattedPrice}} med {{paymentMethod}}","payment_entry_page.button_with_price":"Betala {{formattedPrice}}","price_update.title":"Prisuppdatering","price_update.base_message":"Det totala priset har uppdaterats med moms baserat på din faktureringsadress. Granska och försök igen. Ditt kort kommer endast att debiteras en gång.","price_update.trial_message":"Prenumerationspriset har uppdaterats för att inkludera skatter baserat på din fakturaadress. Den kostnadsfria provperioden gäller fortfarande. Kontrollera och försök igen.","payment_entry_page.express_checkout_divider":"ELLER BETALA MED KORT","error_page.trouble_accessing":"Om du har problem med att komma åt ditt köp, kontakta support på ","error_page.close_button_title":"Gå till {{appName}}","error_page.error_title_stripe_missing_required_permission":"Saknar Stripe-behörighet","error_page.button_close":"Stäng","error_page.error_message_stripe_invalid_tax_origin_address":"Köpet misslyckades eftersom skatteursprungsadressen är ogiltig. I produktion kommer köp att fungera utan att skatter tillämpas.","error_page.error_message_stripe_tax_not_active":"Köpet misslyckades eftersom Stripe Tax inte är aktiverat. I produktion kommer köp att fungera utan att skatter tillämpas.","error_page.error_only_in_sandbox":"Det här meddelandet visas bara i sandlådan.","error_page.error_message_stripe_missing_required_permission":"Köpet misslyckades eftersom Stripe-appen saknar en nödvändig behörighet. I produktion kommer köp att fungera utan att skatter tillämpas.","error_page.error_title_stripe_tax_not_active":"Stripe Tax är inte aktivt","error_page.error_title_stripe_invalid_tax_origin_address":"Ogiltig skatteursprungsadress","apple_pay.free_trial":"Gratis provperiod","product_info.price_after_intro_price":"Efter {{introPriceDuration}}, den {{renewalDate}}","product_info.after_trial":"efter provperioden","product_info.after":"efter","product_info.intro_price_phase_after_trial":"Sedan {{introPriceDuration}} för {{introPrice}}","product_info.intro_price_phase":"Först {{introPriceDuration}} för {{introPrice}}","product_info.intro_price_phase_paid_once":"betalas en gång","payment_entry_page.trial_subscription_terms_info":"Efter att din provperiod slutar debiteras du {{price}} {{perFrequency}} från och med {{renewalDate}}. Du kan avbryta när som helst före detta datum.","payment_entry_page.subscription_info":"Prenumerationen förnyas automatiskt. Avbryt när som helst.","payment_entry_page.otp_terms_info":"Genom att köpa godkänner du att {{appName}} debiterar dig i enlighet med deras villkor.","payment_entry_page.subscription_terms_info":"Genom att prenumerera godkänner du att {{appName}} debiterar dig i enlighet med deras villkor tills du avbryter."},gY={"periods.week":"{{amount}} สัปดาห์","periods.month":"{{amount}} เดือน","periods.year":"{{amount}} ปี","periods.day":"{{amount}} วัน","periods.weekShort":"{{amount}} สัปดาห์","periods.monthShort":"{{amount}} เดือน","periods.yearShort":"{{amount}} ปี","periods.dayShort":"{{amount}} วัน","periods.lifetime":"ตลอดชีพ","periods.weekPlural":"{{amount}} สัปดาห์","periods.monthPlural":"{{amount}} เดือน","periods.yearPlural":"{{amount}} ปี","periods.dayPlural":"{{amount}} วัน","periods.weekFrequency":"รายสัปดาห์","periods.monthFrequency":"รายเดือน","periods.yearFrequency":"รายปี","periods.dayFrequency":"รายวัน","periods.perWeekFrequency":"ต่อสัปดาห์","periods.perMonthFrequency":"ต่อเดือน","periods.perYearFrequency":"ต่อปี","periods.perDayFrequency":"ต่อวัน","periods.unknownFrequency":"ไม่รู้จัก","periods.weekFrequencyPlural":"ทุกๆ {{amount}} สัปดาห์","periods.monthFrequencyPlural":"ทุกๆ {{amount}} เดือน","periods.yearFrequencyPlural":"ทุกๆ {{amount}} ปี","periods.dayFrequencyPlural":"ทุกๆ {{amount}} วัน","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} ทดลองใช้ฟรี","product_info.price_after_free_trial":"หลังจากสิ้นสุดการทดลองใช้ ในวันที่ {{renewalDate}}","product_info.renewal_frequency":"ต่ออายุ {{frequency}}","product_info.continues_until_cancelled":"ต่อเนื่องจนกว่าจะยกเลิก","product_info.cancel_anytime":"ยกเลิกได้ตลอดเวลา","payment_entry_page.payment_step_title":"การชำระเงินอย่างปลอดภัยโดย RevenueCat","payment_entry_page.button_pay":"ชำระเงินตอนนี้","payment_entry_page.button_start_trial":"เริ่มทดลองใช้","success_page.purchase_successful":"การชำระเงินเสร็จสมบูรณ์","success_page.button_close":"ดำเนินการต่อ","error_page.if_error_persists":"หากข้อผิดพลาดยังคงอยู่ โปรดติดต่อ ","error_page.error_title_already_subscribed":"คุณได้สมัครสมาชิก {{productTitle}} แล้ว","error_page.error_title_already_purchased":"คุณได้ซื้อ {{productTitle}} แล้ว","error_page.error_title_other_errors":"มีบางอย่างผิดพลาด","error_page.error_message_already_subscribed":"คุณไม่สามารถสมัครสมาชิกผลิตภัณฑ์นี้ได้อีก","error_page.error_message_already_purchased":"คุณไม่สามารถซื้อผลิตภัณฑ์นี้ได้อีก","error_page.error_message_missing_email_error":"ต้องใช้อีเมลเพื่อทำการซื้อให้เสร็จสมบูรณ์","error_page.error_message_network_error":"ข้อผิดพลาดของเครือข่าย โปรดตรวจสอบการเชื่อมต่ออินเทอร์เน็ตของคุณ","error_page.error_message_error_charging_payment":"การชำระเงินล้มเหลว","error_page.error_message_error_setting_up_purchase":"ไม่สามารถเริ่มการซื้อได้เนื่องจากข้อผิดพลาด (รหัสข้อผิดพลาด: {{errorCode}})","error_page.error_message_invalid_tax_location":"เราไม่สามารถยืนยันที่อยู่สำหรับออกใบแจ้งหนี้ของคุณได้ กรุณาตรวจสอบรหัสไปรษณีย์และประเทศให้ถูกต้อง","error_page.error_message_unknown_error":"เกิดข้อผิดพลาดที่ไม่รู้จัก (รหัสข้อผิดพลาด: {{errorCode}})","error_page.button_try_again":"ลองอีกครั้ง","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% ลด","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"ยอดรวมที่ต้องชำระวันนี้","product_info.subscribe_to":"สมัครสมาชิก","navbar_header.details":"รายละเอียด","navbar_header.back_button":"ย้อนกลับ","pricing_dropdown.show_details":"แสดงรายละเอียด","pricing_dropdown.hide_details":"ซ่อนรายละเอียด","pricing_table.tax":"ภาษี","pricing_table.trial_ends":"หลังจากช่วงทดลองใช้สิ้นสุด ในวันที่ {{formattedTrialEndDate}}","pricing_table.total_due_today":"ยอดรวมที่ต้องชำระวันนี้","pricing_table.total_excluding_tax":"ราคารวมก่อนภาษี","pricing_table.enter_billing_address_to_calculate":"กรุณากรอกที่อยู่สำหรับเรียกเก็บเงินเพื่อคำนวณ","pricing_table.enter_state_or_postal_code_to_calculate":"ใส่รัฐหรือรหัสไปรษณีย์เพื่อคำนวณ","pricing_table.enter_postal_code_to_calculate":"ใส่รหัสไปรษณีย์เพื่อคำนวณ","error_page.error_message_invalid_email_error":"ไม่สามารถยืนยันที่อยู่อีเมล {{email}} ได้ โปรดระบุที่อยู่อีเมลที่ถูกต้อง","payment_entry_page.button_payment_method":"ชำระเงิน {{formattedPrice}} ด้วย {{paymentMethod}}","payment_entry_page.button_with_price":"ชำระเงิน {{formattedPrice}}","price_update.title":"อัปเดตราคา","price_update.base_message":"ราคารวมได้รับการอัปเดตพร้อมภาษีตามที่อยู่สำหรับการเรียกเก็บเงินของคุณ โปรดตรวจสอบและลองอีกครั้ง บัตรของคุณจะถูกเรียกเก็บเงินเพียงครั้งเดียวเท่านั้น","price_update.trial_message":"ราคาการสมัครสมาชิกได้รับการอัปเดตเพื่อรวมภาษีตามที่อยู่สำหรับการเรียกเก็บเงินของคุณ ระยะเวลาทดลองใช้ฟรียังคงมีผล โปรดตรวจสอบและลองอีกครั้ง","payment_entry_page.express_checkout_divider":"หรือชำระด้วยบัตร","error_page.trouble_accessing":"หากคุณมีปัญหาในการเข้าถึงการซื้อ โปรดติดต่อฝ่ายสนับสนุนที่ ","error_page.close_button_title":"ไปที่ {{appName}}","error_page.error_title_stripe_missing_required_permission":"ขาดสิทธิ์ Stripe ที่จำเป็น","error_page.button_close":"ปิด","error_page.error_message_stripe_invalid_tax_origin_address":"การซื้อล้มเหลวเนื่องจากที่อยู่ต้นทางภาษีไม่ถูกต้อง ในสภาพแวดล้อมจริง การซื้อจะทำงานได้โดยไม่มีการเรียกเก็บภาษี","error_page.error_message_stripe_tax_not_active":"การซื้อล้มเหลวเนื่องจากไม่ได้เปิดใช้งาน Stripe Tax ในสภาพแวดล้อมจริง การซื้อจะทำงานได้โดยไม่มีการเรียกเก็บภาษี","error_page.error_only_in_sandbox":"ข้อความนี้จะปรากฏเฉพาะใน sandbox เท่านั้น","error_page.error_message_stripe_missing_required_permission":"การซื้อล้มเหลวเนื่องจากแอป Stripe ขาดสิทธิ์ที่จำเป็น ในสภาพแวดล้อมจริง การซื้อจะทำงานได้โดยไม่มีการเรียกเก็บภาษี","error_page.error_title_stripe_tax_not_active":"Stripe Tax ไม่เปิดใช้งาน","error_page.error_title_stripe_invalid_tax_origin_address":"ที่อยู่ต้นทางภาษีไม่ถูกต้อง","apple_pay.free_trial":"ทดลองใช้ฟรี","product_info.price_after_intro_price":"หลังจาก {{introPriceDuration}} ในวันที่ {{renewalDate}}","product_info.after_trial":"หลังช่วงทดลองใช้","product_info.after":"หลังจาก","product_info.intro_price_phase_after_trial":"จากนั้น {{introPriceDuration}} ในราคา {{introPrice}}","product_info.intro_price_phase":"ช่วงแรก {{introPriceDuration}} ในราคา {{introPrice}}","product_info.intro_price_phase_paid_once":"ชำระครั้งเดียว","payment_entry_page.trial_subscription_terms_info":"หลังจากช่วงทดลองใช้ของคุณสิ้นสุดลง คุณจะถูกเรียกเก็บเงิน {{price}} {{perFrequency}} เริ่มตั้งแต่วันที่ {{renewalDate}} คุณสามารถยกเลิกได้ตลอดเวลาก่อนวันดังกล่าว","payment_entry_page.subscription_info":"การสมัครรับข้อมูลจะต่ออายุโดยอัตโนมัติ ยกเลิกได้ตลอดเวลา","payment_entry_page.otp_terms_info":"เมื่อทำการซื้อ คุณตกลงที่จะอนุญาตให้ {{appName}} เรียกเก็บเงินจากคุณตามข้อกำหนดของพวกเขา","payment_entry_page.subscription_terms_info":"เมื่อสมัครรับข้อมูล แสดงว่าคุณยินยอมให้ {{appName}} เรียกเก็บเงินจากคุณตามข้อกำหนดจนกว่าคุณจะยกเลิก"},yY={"periods.week":"{{amount}} hafta","periods.month":"{{amount}} ay","periods.year":"{{amount}} yıl","periods.day":"{{amount}} gün","periods.weekShort":"{{amount}}hf","periods.monthShort":"{{amount}}ay","periods.yearShort":"{{amount}}yl","periods.dayShort":"{{amount}}g","periods.lifetime":"ömür boyu","periods.weekPlural":"{{amount}} hafta","periods.monthPlural":"{{amount}} ay","periods.yearPlural":"{{amount}} yıl","periods.dayPlural":"{{amount}} gün","periods.weekFrequency":"haftalık","periods.monthFrequency":"aylık","periods.yearFrequency":"yıllık","periods.dayFrequency":"günlük","periods.perWeekFrequency":"haftada","periods.perMonthFrequency":"ayda","periods.perYearFrequency":"yılda","periods.perDayFrequency":"günde","periods.unknownFrequency":"bilinmiyor","periods.weekFrequencyPlural":"her {{amount}} haftada","periods.monthFrequencyPlural":"her {{amount}} ayda","periods.yearFrequencyPlural":"her {{amount}} yılda","periods.dayFrequencyPlural":"her {{amount}} günde","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} ücretsiz deneme","product_info.price_after_free_trial":"Deneme süresi sona erdiğinde, {{renewalDate}} tarihinde","product_info.renewal_frequency":"{{frequency}} sıklığında yenilenir","product_info.continues_until_cancelled":"İptal edilene kadar devam eder","product_info.cancel_anytime":"İstediğiniz zaman iptal edebilirsiniz","payment_entry_page.payment_step_title":"RevenueCat ile güvenli ödeme","payment_entry_page.button_pay":"Şimdi öde","payment_entry_page.button_start_trial":"Denemeyi başlat","success_page.purchase_successful":"Ödeme tamamlandı","success_page.button_close":"Devam et","error_page.if_error_persists":"Hata devam ederse lütfen iletişime geçin ","error_page.error_title_already_subscribed":"{{productTitle}} ürününe zaten abone oldunuz","error_page.error_title_already_purchased":"{{productTitle}} ürününü zaten satın aldınız","error_page.error_title_other_errors":"Bir şeyler ters gitti","error_page.error_message_already_subscribed":"Bu ürüne tekrar abone olamazsınız.","error_page.error_message_already_purchased":"Bu ürünü tekrar satın alamazsınız.","error_page.error_message_missing_email_error":"Satın almayı tamamlamak için e-posta gereklidir.","error_page.error_message_network_error":"Ağ hatası. Lütfen internet bağlantınızı kontrol edin.","error_page.error_message_error_charging_payment":"Ödeme başarısız oldu.","error_page.error_message_error_setting_up_purchase":"Bir hata nedeniyle satın alma başlatılamadı (hata kodu: {{errorCode}}).","error_page.error_message_invalid_tax_location":"Fatura adresinizi doğrulayamadık. Lütfen posta kodu ve ülkenin doğru olduğunu kontrol edin.","error_page.error_message_unknown_error":"Bilinmeyen bir hata oluştu (hata kodu: {{errorCode}}).","error_page.button_try_again":"Tekrar dene","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% indirim","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Bugün ödenecek toplam tutar","product_info.subscribe_to":"Abone Ol","navbar_header.details":"Detaylar","navbar_header.back_button":"Geri","pricing_dropdown.show_details":"Detayları göster","pricing_dropdown.hide_details":"Detayları gizle","pricing_table.tax":"Vergi","pricing_table.trial_ends":"Deneme süresi sona erdikten sonra, {{formattedTrialEndDate}} tarihinde","pricing_table.total_due_today":"Bugün ödenecek toplam","pricing_table.total_excluding_tax":"Vergi hariç toplam","pricing_table.enter_billing_address_to_calculate":"Hesaplamak için fatura adresini girin","pricing_table.enter_state_or_postal_code_to_calculate":"Hesaplamak için eyalet veya posta kodunu girin","pricing_table.enter_postal_code_to_calculate":"Hesaplamak için posta kodunu girin","error_page.error_message_invalid_email_error":"{{email}} e-posta adresi doğrulanamadı. Lütfen geçerli bir e-posta adresi girin.","payment_entry_page.button_payment_method":"{{paymentMethod}} ile {{formattedPrice}} öde","payment_entry_page.button_with_price":"{{formattedPrice}} öde","price_update.title":"Fiyat güncellemesi","price_update.base_message":"Toplam fiyat, fatura adresinize göre vergi dahil olacak şekilde güncellendi. Lütfen inceleyip tekrar deneyin. Kartınızdan yalnızca bir kez ücret alınacaktır.","price_update.trial_message":"Abonelik fiyatı, fatura adresinize göre vergileri içerecek şekilde güncellendi. Ücretsiz deneme süresi hala geçerli. Lütfen kontrol edin ve tekrar deneyin.","payment_entry_page.express_checkout_divider":"VEYA KARTLA ÖDEYİN","error_page.trouble_accessing":"Satın alımınıza erişmekte sorun yaşıyorsanız, şu adresten destek ekibine ulaşın: ","error_page.close_button_title":"{{appName}}'e Git","error_page.error_title_stripe_missing_required_permission":"Eksik Stripe izni","error_page.button_close":"Kapat","error_page.error_message_stripe_invalid_tax_origin_address":"Vergi başlangıç adresi geçersiz olduğu için satın alma başarısız oldu. Üretimde, satın alımlar vergi uygulanmadan çalışacaktır.","error_page.error_message_stripe_tax_not_active":"Stripe Vergi etkinleştirilmediği için satın alma başarısız oldu. Üretimde, satın alımlar vergi uygulanmadan çalışacaktır.","error_page.error_only_in_sandbox":"Bu mesaj yalnızca sanal ortamda görünür.","error_page.error_message_stripe_missing_required_permission":"Stripe uygulamasında gerekli bir izin eksik olduğu için satın alma başarısız oldu. Üretimde, satın alımlar vergi uygulanmadan çalışacaktır.","error_page.error_title_stripe_tax_not_active":"Stripe Vergi aktif değil","error_page.error_title_stripe_invalid_tax_origin_address":"Geçersiz vergi başlangıç adresi","apple_pay.free_trial":"Ücretsiz Deneme","product_info.price_after_intro_price":"{{introPriceDuration}} sonra, {{renewalDate}} tarihinde","product_info.after_trial":"deneme süresinden sonra","product_info.after":"sonra","product_info.intro_price_phase_after_trial":"Sonra {{introPriceDuration}} boyunca {{introPrice}}","product_info.intro_price_phase":"İlk {{introPriceDuration}} boyunca {{introPrice}}","product_info.intro_price_phase_paid_once":"bir defaya mahsus ödenir","payment_entry_page.trial_subscription_terms_info":"Deneme süreniz sona erdikten sonra, {{renewalDate}} tarihinden itibaren {{price}} {{perFrequency}} ücretlendirileceksiniz. Bu tarihten önce istediğiniz zaman iptal edebilirsiniz.","payment_entry_page.subscription_info":"Abonelik otomatik olarak yenilenir. İstediğiniz zaman iptal edin.","payment_entry_page.otp_terms_info":"Satın alarak, {{appName}}'in sizi şartlarına göre ücretlendirmesine izin vermeyi kabul edersiniz.","payment_entry_page.subscription_terms_info":"Abone olarak, iptal edene kadar {{appName}}'in sizi şartlarına göre ücretlendirmesine izin vermeyi kabul edersiniz."},vY={"periods.week":"{{amount}} тиждень","periods.month":"{{amount}} місяць","periods.year":"{{amount}} рік","periods.day":"{{amount}} день","periods.weekShort":"{{amount}}тиж","periods.monthShort":"{{amount}}міс","periods.yearShort":"{{amount}}рік","periods.dayShort":"{{amount}}дн","periods.lifetime":"пожиттєво","periods.weekPlural":"{{amount}} тижнів","periods.monthPlural":"{{amount}} місяців","periods.yearPlural":"{{amount}} років","periods.dayPlural":"{{amount}} днів","periods.weekFrequency":"щотижня","periods.monthFrequency":"щомісяця","periods.yearFrequency":"щороку","periods.dayFrequency":"щодня","periods.perWeekFrequency":"на тиждень","periods.perMonthFrequency":"на місяць","periods.perYearFrequency":"на рік","periods.perDayFrequency":"на день","periods.unknownFrequency":"невідомо","periods.weekFrequencyPlural":"кожні {{amount}} тижнів","periods.monthFrequencyPlural":"кожні {{amount}} місяців","periods.yearFrequencyPlural":"кожні {{amount}} років","periods.dayFrequencyPlural":"кожні {{amount}} днів","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} безкоштовний пробний період","product_info.price_after_free_trial":"Після закінчення пробного періоду, {{renewalDate}}","product_info.renewal_frequency":"Продовжується {{frequency}}","product_info.continues_until_cancelled":"Триває до скасування","product_info.cancel_anytime":"Можна скасувати в будь-який час","payment_entry_page.payment_step_title":"Безпечна оплата через RevenueCat","payment_entry_page.button_pay":"Оплатити зараз","payment_entry_page.button_start_trial":"Розпочати пробний період","success_page.purchase_successful":"Оплата завершена","success_page.button_close":"Продовжити","error_page.if_error_persists":"Якщо помилка повторюється, зверніться до ","error_page.error_title_already_subscribed":"Ви вже підписалися на {{productTitle}}","error_page.error_title_already_purchased":"Ви вже придбали {{productTitle}}","error_page.error_title_other_errors":"Щось пішло не так","error_page.error_message_already_subscribed":"Ви не можете підписатися на цей продукт знову.","error_page.error_message_already_purchased":"Ви не можете придбати цей продукт знову.","error_page.error_message_missing_email_error":"Для завершення покупки потрібна електронна пошта.","error_page.error_message_network_error":"Помилка мережі. Перевірте підключення до інтернету.","error_page.error_message_error_charging_payment":"Оплата не пройшла.","error_page.error_message_error_setting_up_purchase":"Помилка при ініціалізації покупки (код помилки: {{errorCode}}).","error_page.error_message_invalid_tax_location":"Ми не змогли перевірити вашу платіжну адресу. Будь ласка, перевірте, чи правильні поштовий індекс та країна.","error_page.error_message_unknown_error":"Сталася невідома помилка (код помилки: {{errorCode}}).","error_page.button_try_again":"Спробувати ще раз","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% знижки","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Всього до сплати сьогодні","product_info.subscribe_to":"Підписатися на","navbar_header.details":"Деталі","navbar_header.back_button":"Назад","pricing_dropdown.show_details":"Показати деталі","pricing_dropdown.hide_details":"Приховати деталі","pricing_table.tax":"Податок","pricing_table.trial_ends":"Після закінчення пробного періоду, {{formattedTrialEndDate}}","pricing_table.total_due_today":"Загальна сума до сплати сьогодні","pricing_table.total_excluding_tax":"Загальна сума без урахування податку","pricing_table.enter_billing_address_to_calculate":"Введіть адресу виставлення рахунку для розрахунку","pricing_table.enter_state_or_postal_code_to_calculate":"Введіть штат або поштовий індекс для розрахунку","pricing_table.enter_postal_code_to_calculate":"Введіть поштовий індекс для розрахунку","error_page.error_message_invalid_email_error":"Електронну адресу {{email}} не вдалося підтвердити. Будь ласка, вкажіть дійсну електронну адресу.","payment_entry_page.button_payment_method":"Сплатити {{formattedPrice}} за допомогою {{paymentMethod}}","payment_entry_page.button_with_price":"Сплатити {{formattedPrice}}","price_update.title":"Оновлення ціни","price_update.base_message":"Загальну ціну було оновлено з урахуванням податку на основі вашої платіжної адреси. Перегляньте та спробуйте ще раз. З вашої картки буде списано кошти лише один раз.","price_update.trial_message":"Ціна підписки була оновлена для включення податків на основі вашої платіжної адреси. Безкоштовний пробний період все ще діє. Будь ласка, перевірте та спробуйте ще раз.","payment_entry_page.express_checkout_divider":"АБО СПЛАТІТЬ КАРТКОЮ","error_page.trouble_accessing":"Якщо у вас виникли проблеми з доступом до вашої покупки, зверніться до служби підтримки за адресою ","error_page.close_button_title":"Перейти до {{appName}}","error_page.error_title_stripe_missing_required_permission":"Відсутній дозвіл Stripe","error_page.button_close":"Закрити","error_page.error_message_stripe_invalid_tax_origin_address":"Покупка не вдалася, оскільки адреса походження податку недійсна. У виробництві покупки працюватимуть без застосування податків.","error_page.error_message_stripe_tax_not_active":"Покупка не вдалася, оскільки Stripe Tax не ввімкнено. У виробництві покупки працюватимуть без застосування податків.","error_page.error_only_in_sandbox":"Це повідомлення з’являється лише в пісочниці.","error_page.error_message_stripe_missing_required_permission":"Покупка не вдалася, оскільки програмі Stripe не вистачає необхідного дозволу. У виробництві покупки працюватимуть без застосування податків.","error_page.error_title_stripe_tax_not_active":"Stripe Tax не активовано","error_page.error_title_stripe_invalid_tax_origin_address":"Недійсна адреса походження податку","apple_pay.free_trial":"Безкоштовна пробна версія","product_info.price_after_intro_price":"Після {{introPriceDuration}}, {{renewalDate}}","product_info.after_trial":"після пробного періоду","product_info.after":"після","product_info.intro_price_phase_after_trial":"Потім {{introPriceDuration}} за {{introPrice}}","product_info.intro_price_phase":"Спочатку {{introPriceDuration}} за {{introPrice}}","product_info.intro_price_phase_paid_once":"сплачено один раз","payment_entry_page.trial_subscription_terms_info":"Після закінчення пробного періоду з вас буде стягуватися плата в розмірі {{price}} {{perFrequency}} починаючи з {{renewalDate}}. Ви можете скасувати підписку в будь-який час до цієї дати.","payment_entry_page.subscription_info":"Підписка поновлюється автоматично. Скасувати можна в будь-який час.","payment_entry_page.otp_terms_info":"Купуючи, ви погоджуєтеся дозволити {{appName}} стягувати з вас плату відповідно до їхніх умов.","payment_entry_page.subscription_terms_info":"Підписуючись, ви погоджуєтеся дозволити {{appName}} стягувати з вас плату відповідно до їхніх умов, поки ви не скасуєте підписку."},_Y={"periods.week":"{{amount}} tuần","periods.month":"{{amount}} tháng","periods.year":"{{amount}} năm","periods.day":"{{amount}} ngày","periods.weekShort":"{{amount}}tuần","periods.monthShort":"{{amount}}tháng","periods.yearShort":"{{amount}}năm","periods.dayShort":"{{amount}}ngày","periods.lifetime":"trọn đời","periods.weekPlural":"{{amount}} tuần","periods.monthPlural":"{{amount}} tháng","periods.yearPlural":"{{amount}} năm","periods.dayPlural":"{{amount}} ngày","periods.weekFrequency":"hàng tuần","periods.monthFrequency":"hàng tháng","periods.yearFrequency":"hàng năm","periods.dayFrequency":"hàng ngày","periods.perWeekFrequency":"mỗi tuần","periods.perMonthFrequency":"mỗi tháng","periods.perYearFrequency":"mỗi năm","periods.perDayFrequency":"mỗi ngày","periods.unknownFrequency":"không xác định","periods.weekFrequencyPlural":"cứ {{amount}} tuần","periods.monthFrequencyPlural":"cứ {{amount}} tháng","periods.yearFrequencyPlural":"cứ {{amount}} năm","periods.dayFrequencyPlural":"cứ {{amount}} ngày","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} dùng thử miễn phí","product_info.price_after_free_trial":"Sau khi dùng thử kết thúc, vào {{renewalDate}}","product_info.renewal_frequency":"Gia hạn {{frequency}}","product_info.continues_until_cancelled":"Tiếp tục cho đến khi hủy","product_info.cancel_anytime":"Hủy bất cứ lúc nào","payment_entry_page.payment_step_title":"Thanh toán an toàn bởi RevenueCat","payment_entry_page.button_pay":"Thanh toán ngay","payment_entry_page.button_start_trial":"Bắt đầu dùng thử","success_page.purchase_successful":"Thanh toán hoàn tất","success_page.button_close":"Tiếp tục","error_page.if_error_persists":"Nếu lỗi vẫn tiếp diễn, vui lòng liên hệ ","error_page.error_title_already_subscribed":"Bạn đã đăng ký {{productTitle}} rồi","error_page.error_title_already_purchased":"Bạn đã mua {{productTitle}} rồi","error_page.error_title_other_errors":"Có lỗi xảy ra","error_page.error_message_already_subscribed":"Bạn không thể đăng ký sản phẩm này lần nữa.","error_page.error_message_already_purchased":"Bạn không thể mua sản phẩm này lần nữa.","error_page.error_message_missing_email_error":"Email bắt buộc để hoàn tất việc mua hàng.","error_page.error_message_network_error":"Lỗi mạng. Vui lòng kiểm tra kết nối internet của bạn.","error_page.error_message_error_charging_payment":"Thanh toán thất bại.","error_page.error_message_error_setting_up_purchase":"Không thể bắt đầu mua do lỗi (mã lỗi: {{errorCode}}).","error_page.error_message_invalid_tax_location":"Chúng tôi không thể xác minh địa chỉ thanh toán của bạn. Vui lòng kiểm tra lại mã bưu điện và quốc gia.","error_page.error_message_unknown_error":"Đã xảy ra lỗi không xác định (mã lỗi: {{errorCode}}).","error_page.button_try_again":"Thử lại","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% giảm","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Tổng số tiền phải trả hôm nay","product_info.subscribe_to":"Đăng ký","navbar_header.details":"Chi tiết","navbar_header.back_button":"Quay lại","pricing_dropdown.show_details":"Xem chi tiết","pricing_dropdown.hide_details":"Ẩn chi tiết","pricing_table.tax":"Thuế","pricing_table.trial_ends":"Sau khi thời gian dùng thử kết thúc, vào {{formattedTrialEndDate}}","pricing_table.total_due_today":"Tổng số tiền phải trả hôm nay","pricing_table.total_excluding_tax":"Tổng cộng chưa bao gồm thuế","pricing_table.enter_billing_address_to_calculate":"Nhập địa chỉ thanh toán để tính toán","pricing_table.enter_state_or_postal_code_to_calculate":"Nhập tiểu bang hoặc mã bưu điện để tính toán","pricing_table.enter_postal_code_to_calculate":"Nhập mã bưu điện để tính toán","error_page.error_message_invalid_email_error":"Không thể xác minh địa chỉ email {{email}}. Vui lòng cung cấp một địa chỉ email hợp lệ.","payment_entry_page.button_payment_method":"Thanh toán {{formattedPrice}} bằng {{paymentMethod}}","payment_entry_page.button_with_price":"Thanh toán {{formattedPrice}}","price_update.title":"Cập nhật giá","price_update.base_message":"Tổng giá đã được cập nhật với thuế dựa trên địa chỉ thanh toán của bạn. Vui lòng xem lại và thử lại. Thẻ của bạn sẽ chỉ bị tính phí một lần.","price_update.trial_message":"Giá đăng ký đã được cập nhật để bao gồm thuế dựa trên địa chỉ thanh toán của bạn. Thời gian dùng thử miễn phí vẫn được áp dụng. Vui lòng kiểm tra và thử lại.","payment_entry_page.express_checkout_divider":"HOẶC THANH TOÁN BẰNG THẺ","error_page.trouble_accessing":"Nếu bạn gặp sự cố khi truy cập giao dịch mua của mình, hãy liên hệ với bộ phận hỗ trợ theo địa chỉ ","error_page.close_button_title":"Đi đến {{appName}}","error_page.error_title_stripe_missing_required_permission":"Thiếu quyền Stripe","error_page.button_close":"Đóng","error_page.error_message_stripe_invalid_tax_origin_address":"Giao dịch mua không thành công vì địa chỉ gốc thuế không hợp lệ. Trong môi trường thực tế, giao dịch mua sẽ hoạt động mà không áp dụng thuế.","error_page.error_message_stripe_tax_not_active":"Giao dịch mua không thành công vì Thuế Stripe chưa được bật. Trong môi trường thực tế, giao dịch mua sẽ hoạt động mà không áp dụng thuế.","error_page.error_only_in_sandbox":"Thông báo này chỉ xuất hiện trong môi trường thử nghiệm.","error_page.error_message_stripe_missing_required_permission":"Giao dịch mua không thành công vì ứng dụng Stripe thiếu một quyền cần thiết. Trong môi trường thực tế, giao dịch mua sẽ hoạt động mà không áp dụng thuế.","error_page.error_title_stripe_tax_not_active":"Thuế Stripe chưa hoạt động","error_page.error_title_stripe_invalid_tax_origin_address":"Địa chỉ gốc thuế không hợp lệ","apple_pay.free_trial":"Dùng thử miễn phí","product_info.price_after_intro_price":"Sau {{introPriceDuration}}, vào {{renewalDate}}","product_info.after_trial":"sau khi dùng thử","product_info.after":"sau","product_info.intro_price_phase_after_trial":"Sau đó {{introPriceDuration}} với giá {{introPrice}}","product_info.intro_price_phase":"{{introPriceDuration}} đầu tiên với giá {{introPrice}}","product_info.intro_price_phase_paid_once":"trả một lần","payment_entry_page.trial_subscription_terms_info":"Sau khi thời gian dùng thử của bạn kết thúc, bạn sẽ bị tính phí {{price}} {{perFrequency}} bắt đầu từ {{renewalDate}}. Bạn có thể hủy bất cứ lúc nào trước ngày này.","payment_entry_page.subscription_info":"Gói đăng ký tự động gia hạn. Hủy bất cứ lúc nào.","payment_entry_page.otp_terms_info":"Bằng cách mua, bạn đồng ý cho phép {{appName}} tính phí bạn theo các điều khoản của họ.","payment_entry_page.subscription_terms_info":"Bằng cách đăng ký, bạn đồng ý cho phép {{appName}} tính phí bạn theo các điều khoản của họ cho đến khi bạn hủy."};var Ot=(t=>(t.PeriodsWeek="periods.week",t.PeriodsMonth="periods.month",t.PeriodsYear="periods.year",t.PeriodsDay="periods.day",t.PeriodsWeekShort="periods.weekShort",t.PeriodsMonthShort="periods.monthShort",t.PeriodsYearShort="periods.yearShort",t.PeriodsDayShort="periods.dayShort",t.PeriodsLifetime="periods.lifetime",t.PeriodsWeekPlural="periods.weekPlural",t.PeriodsMonthPlural="periods.monthPlural",t.PeriodsYearPlural="periods.yearPlural",t.PeriodsDayPlural="periods.dayPlural",t.PeriodsWeekFrequency="periods.weekFrequency",t.PeriodsMonthFrequency="periods.monthFrequency",t.PeriodsYearFrequency="periods.yearFrequency",t.PeriodsDayFrequency="periods.dayFrequency",t.PeriodsPerWeekFrequency="periods.perWeekFrequency",t.PeriodsPerMonthFrequency="periods.perMonthFrequency",t.PeriodsPerYearFrequency="periods.perYearFrequency",t.PeriodsPerDayFrequency="periods.perDayFrequency",t.PeriodsUnknownFrequency="periods.unknownFrequency",t.PeriodsWeekFrequencyPlural="periods.weekFrequencyPlural",t.PeriodsMonthFrequencyPlural="periods.monthFrequencyPlural",t.PeriodsYearFrequencyPlural="periods.yearFrequencyPlural",t.PeriodsDayFrequencyPlural="periods.dayFrequencyPlural",t.ProductInfoProductTitle="product_info.product_title",t.ProductInfoProductDescription="product_info.product_description",t.ProductInfoProductPrice="product_info.product_price",t.ProductInfoFreeTrialDuration="product_info.free_trial_duration",t.ProductInfoPriceAfterFreeTrial="product_info.price_after_free_trial",t.ProductInfoIntroPricePhaseAfterTrial="product_info.intro_price_phase_after_trial",t.ProductInfoIntroPricePhasePaidOnce="product_info.intro_price_phase_paid_once",t.ProductInfoIntroPricePhase="product_info.intro_price_phase",t.ProductInfoPriceAfterIntroPrice="product_info.price_after_intro_price",t.ProductInfoAfterTrial="product_info.after_trial",t.ProductInfoAfter="product_info.after",t.ProductInfoPriceTotalDueToday="product_info.total_due_today",t.ProductInfoSubscribeTo="product_info.subscribe_to",t.ProductInfoRenewalFrequency="product_info.renewal_frequency",t.ProductInfoContinuesUntilCancelled="product_info.continues_until_cancelled",t.ProductInfoCancelAnytime="product_info.cancel_anytime",t.PaymentEntryPagePaymentStepTitle="payment_entry_page.payment_step_title",t.PaymentEntryPageTrialSubscriptionTermsInfo="payment_entry_page.trial_subscription_terms_info",t.PaymentEntryPageSubscriptionTermsInfo="payment_entry_page.subscription_terms_info",t.PaymentEntryPageOtpTermsInfo="payment_entry_page.otp_terms_info",t.PaymentEntryPageSubscriptionInfo="payment_entry_page.subscription_info",t.PaymentEntryPageButtonPay="payment_entry_page.button_pay",t.PaymentEntryPageButtonStartTrial="payment_entry_page.button_start_trial",t.PaymentEntryPageButtonWithPrice="payment_entry_page.button_with_price",t.PaymentEntryPageButtonPaymentMethod="payment_entry_page.button_payment_method",t.PaymentEntryPageExpressCheckoutDivider="payment_entry_page.express_checkout_divider",t.SuccessPagePurchaseSuccessful="success_page.purchase_successful",t.SuccessPageButtonClose="success_page.button_close",t.ErrorPageCloseButtonTitle="error_page.close_button_title",t.ErrorPageIfErrorPersists="error_page.if_error_persists",t.ErrorPageTroubleAccessing="error_page.trouble_accessing",t.ErrorPageErrorTitleAlreadySubscribed="error_page.error_title_already_subscribed",t.ErrorPageErrorTitleAlreadyPurchased="error_page.error_title_already_purchased",t.ErrorPageErrorTitleOtherErrors="error_page.error_title_other_errors",t.ErrorPageErrorTitleStripeTaxNotActive="error_page.error_title_stripe_tax_not_active",t.ErrorPageErrorTitleStripeInvalidTaxOriginAddress="error_page.error_title_stripe_invalid_tax_origin_address",t.ErrorPageErrorTitleStripeMissingRequiredPermission="error_page.error_title_stripe_missing_required_permission",t.ErrorPageErrorMessageAlreadySubscribed="error_page.error_message_already_subscribed",t.ErrorPageErrorMessageAlreadyPurchased="error_page.error_message_already_purchased",t.ErrorPageErrorMessageMissingEmailError="error_page.error_message_missing_email_error",t.ErrorPageErrorMessageInvalidEmailError="error_page.error_message_invalid_email_error",t.ErrorPageErrorMessageNetworkError="error_page.error_message_network_error",t.ErrorPageErrorMessageErrorChargingPayment="error_page.error_message_error_charging_payment",t.ErrorPageErrorMessageErrorSettingUpPurchase="error_page.error_message_error_setting_up_purchase",t.ErrorPageErrorMessageUnknownError="error_page.error_message_unknown_error",t.ErrorPageErrorMessageInvalidTaxLocation="error_page.error_message_invalid_tax_location",t.ErrorPageErrorMessageStripeTaxNotActive="error_page.error_message_stripe_tax_not_active",t.ErrorPageErrorMessageStripeInvalidTaxOriginAddress="error_page.error_message_stripe_invalid_tax_origin_address",t.ErrorPageErrorMessageStripeMissingRequiredPermission="error_page.error_message_stripe_missing_required_permission",t.ErrorPageErrorMessageOnlyInSandbox="error_page.error_only_in_sandbox",t.ErrorButtonTryAgain="error_page.button_try_again",t.ErrorButtonClose="error_page.button_close",t.PaywallVariablesPricePerPeriod="paywall_variables.price_per_period",t.PaywallVariablesSubRelativeDiscount="paywall_variables.sub_relative_discount",t.PaywallVariablesTotalPriceAndPerMonth="paywall_variables.total_price_and_per_month",t.PricingDropdownShowDetails="pricing_dropdown.show_details",t.PricingDropdownHideDetails="pricing_dropdown.hide_details",t.PricingTotalExcludingTax="pricing_table.total_excluding_tax",t.PricingTableTrialEnds="pricing_table.trial_ends",t.PricingTableTotalDueToday="pricing_table.total_due_today",t.PricingTableTax="pricing_table.tax",t.PricingTableEnterBillingAddressToCalculate="pricing_table.enter_billing_address_to_calculate",t.PricingTableEnterStateOrPostalCodeToCalculate="pricing_table.enter_state_or_postal_code_to_calculate",t.PricingTableEnterPostalCodeToCalculate="pricing_table.enter_postal_code_to_calculate",t.NavbarHeaderDetails="navbar_header.details",t.NavbarBackButton="navbar_header.back_button",t.PriceUpdateTitle="price_update.title",t.PriceUpdateBaseMessage="price_update.base_message",t.PriceUpdateTrialMessage="price_update.trial_message",t.ApplePayFreeTrial="apple_pay.free_trial",t))(Ot||{});const bY={en:qK,es:zK,it:$K,ar:VK,ca:HK,zh_Hans:GK,zh_Hant:WK,hr:KK,cs:YK,da:XK,nl:JK,fi:QK,fr:ZK,de:eY,el:tY,he:rY,hi:nY,hu:aY,id:iY,ja:sY,ko:oY,ms:cY,no:lY,pl:uY,pt:dY,ro:fY,ru:pY,sk:hY,sv:mY,th:gY,tr:yY,uk:vY,vi:_Y};var Ea=(t=>(t.Year="year",t.Month="month",t.Week="week",t.Day="day",t))(Ea||{});function aU(t){const e=t.match(/^PT?([0-9]+)([MDYW])$/);if(!e||e.length<3)return tr.errorLog(`Invalid ISO 8601 duration format: ${t}`),null;const r=parseInt(e[1]);switch(e[2]){case"Y":return{number:r,unit:"year"};case"M":return{number:r,unit:"month"};case"W":return{number:r,unit:"week"};case"D":return{number:r,unit:"day"};default:return tr.errorLog(`Invalid ISO 8601 unit duration format: ${t}`),null}}function xT(t,e,r){if(!r)return null;let n=new Date(t);switch(e.unit){case"year":n.getDate()===29&&n.getMonth()===1&&e.number!==4?n.setFullYear(n.getFullYear()+e.number,n.getMonth(),28):n.setFullYear(n.getFullYear()+e.number,n.getMonth(),n.getDate());break;case"month":n.setMonth(n.getMonth()+e.number,n.getDate()),n.getDate()!==t.getDate()&&(n=new Date(t),n.setMonth(n.getMonth()+e.number+1,0));break;case"week":n.setDate(n.getDate()+e.number*7);break;case"day":n.setDate(n.getDate()+e.number);break}return n}const kY=t=>t/1e6,zl=(t,e,r,n={})=>{const a=kY(t),i={style:"currency",currency:e,currencyDisplay:"symbol",...n,minimumFractionDigits:n.maximumFractionDigits};return new Intl.NumberFormat(r,i).format(a).replace("US$","$")},wY=(t,e)=>{const r=aU(t);return r?e.translatePeriod(r.number,r.unit)||`${r.number} ${r.unit}s`:t},SY=t=>{try{return t.charAt(0).toUpperCase()+t.slice(1)}catch{return t}},Sf={noWhitespace:!1,short:!1},iU={useMultipleWords:!1};class Wb{constructor(e={},r=Bf,n=Bf){vt(this,"locales",{}),this.selectedLocale=r,this.defaultLocale=n;const a={};Object.entries(bY).forEach(([i,o])=>{a[i]=new BO(o,i)}),this.locales=a,e&&this.override(e)}static fallback(){return new Wb}override(e){Object.entries(e).forEach(([r,n])=>{this.locales[r]=new BO({...this.locales[r].labels||{},...n},this.getLanguageCodeString(r))})}formatPrice(e,r){const n={currencyDisplay:"narrowSymbol"};e===0&&(n.maximumFractionDigits=0);try{return zl(e,r,this.locale,n)}catch{tr.errorLog(`Failed to create a price formatter for locale: ${this.locale}`)}try{return zl(e,r,this.fallbackLocale,n)}catch{tr.errorLog(`Failed to create a price formatter for locale: ${this.fallbackLocale}`)}return zl(e,r,Bf,n)}get locale(){var e;return((e=this.getLocaleInstance(this.selectedLocale))==null?void 0:e.localeKey)||this.getLanguageCodeString(this.selectedLocale)}get fallbackLocale(){var e;return((e=this.getLocaleInstance(this.defaultLocale))==null?void 0:e.localeKey)||this.getLanguageCodeString(this.defaultLocale)}getLanguageCodeString(e){return e.split("_")[0].split("-")[0]}getLocaleInstance(e){const r=this.getLanguageCodeString(e);return this.locales[e]||this.locales[r]}translate(e,r){const n=this.getLocaleInstance(this.selectedLocale),a=this.getLocaleInstance(this.defaultLocale);return n?.translate(e,r)||a?.translate(e,r)||""}formatCountry(e){return new Intl.DisplayNames([this.locale],{type:"region"}).of(e)||e}translatePeriod(e,r,n=Sf){const a=this.getLocaleInstance(this.selectedLocale),i=this.getLocaleInstance(this.defaultLocale);return a?.translatePeriod(e,r,n)||i?.translatePeriod(e,r,n)}translatePeriodUnit(e,r=Sf){const n=this.getLocaleInstance(this.selectedLocale),a=this.getLocaleInstance(this.defaultLocale);return n?.translatePeriodUnit(e,r)||a?.translatePeriodUnit(e,r)}translatePeriodFrequency(e,r,n=iU){const a=this.getLocaleInstance(this.selectedLocale),i=this.getLocaleInstance(this.defaultLocale);return a?.translatePeriodFrequency(e,r,n)||i?.translatePeriodFrequency(e,r,n)}translateDate(e,r={}){const n=this.getLocaleInstance(this.selectedLocale),a=this.getLocaleInstance(this.defaultLocale);return n?.translateDate(e,r)||a?.translateDate(e,r)}}class BO{constructor(e={},r){this.labels=e,this.localeKey=r}replaceVariables(e,r){return Object.entries(r).reduce((n,[a,i])=>n.replace(`{{${a}}}`,`${i??""}`),e)}translate(e,r){const n=this.labels[e];if(n)return this.replaceVariables(n,r||{})}translatePeriod(e,r,n=Sf){var a;const{noWhitespace:i,short:o}={...Sf,...n},c=o?`periods.${r}Short`:Math.abs(e)===1?`periods.${r}`:`periods.${r}Plural`;return(a=this.translate(c,{amount:e.toString()}))==null?void 0:a.replace(" ",i?"":" ")}translatePeriodUnit(e,r=Sf){var n;const{noWhitespace:a,short:i}={...Sf,...r},o=`periods.${e}${i?"Short":""}`;return(n=this.translate(o,{amount:""}))==null?void 0:n.replace(" ",a?"":" ")}translatePeriodFrequency(e,r,n=iU){const a=n?.useMultipleWords,i=Math.abs(e)===1?`periods.${a===!0?"per":""}${a?SY(r.toString()):r}Frequency`:`periods.${r}FrequencyPlural`;return this.translate(i,{amount:e.toString()})}translateDate(e,r={}){return e.toLocaleDateString(this.localeKey,r)}}KW();const EY=`<svg viewBox="0 0 124 124" fill="var(--rc-color-grey-text-dark)" xmlns="http://www.w3.org/2000/svg">
    <circle cx="62" cy="62" r="62" fill="var(--rc-color-grey-text-dark)" opacity="0.2"/>
    <path d="M87.6668 41.504L82.4968 36.334L62.0002 56.8307L41.5035 36.334L36.3335 41.504L56.8302 62.0006L36.3335 82.4973L41.5035 87.6673L62.0002 67.1706L82.4968 87.6673L87.6668 82.4973L67.1702 62.0006L87.6668 41.504Z"
          />
</svg>
`;var TY=lt('<div style="color:var(--rc-color-primary);"><!></div>');function sU(t){var e=TY(),r=Le(e);fu(r,()=>EY),ke(t,e)}var CY=lt("<button><!></button>");const xY={hash:"svelte-1wpam0z",code:"button.svelte-1wpam0z {border:none;cursor:pointer;background:transparent;width:fit-content;}"};function oU(t,e){Wt(e,!0),zt(t,xY);var r=CY();r.__click=function(...a){var i;(i=e.onclick)==null||i.apply(this,a)};var n=Le(r);Dn(n,()=>e.children??Ar),mt(()=>{Ql(r,XB(e.class),"svelte-1wpam0z"),r.disabled=!e.onclick,Ut(r,"style",e.style)}),ke(t,r),Kt()}Gb(["click"]);const Qs="light",PT="#000000",PY="#FFFFFF";var AT;(function(t){t.body_s="p",t.body_m="p",t.body_l="p",t.body_xl="p",t.heading_xs="h6",t.heading_s="h5",t.heading_m="h4",t.heading_l="h3",t.heading_xl="h2",t.heading_xxl="h1"})(AT||(AT={}));var F_;(function(t){t[t.extra_light=100]="extra_light",t[t.thin=200]="thin",t[t.light=300]="light",t[t.regular=400]="regular",t[t.medium=500]="medium",t[t.semibold=600]="semibold",t[t.bold=700]="bold",t[t.extra_bold=800]="extra_bold",t[t.black=900]="black"})(F_||(F_={}));var q_;(function(t){t.body_s="13px",t.body_m="14px",t.body_l="15px",t.body_xl="16px",t.heading_xs="14px",t.heading_s="16px",t.heading_m="18px",t.heading_l="20px",t.heading_xl="26px",t.heading_xxl="32px"})(q_||(q_={}));var z_;(function(t){t.leading="start",t.center="center",t.trailing="end"})(z_||(z_={}));var RT;(function(t){t.vertical="column",t.horizontal="row",t.zlayer="zstack"})(RT||(RT={}));var DT;(function(t){t.top="flex-start",t.leading="flex-start",t.center="center",t.bottom="flex-end",t.trailing="flex-end"})(DT||(DT={}));var OT;(function(t){t.space_between="space-between",t.space_around="space-around",t.space_evenly="space-evenly",t.start="flex-start",t.center="center",t.end="flex-end"})(OT||(OT={}));function UO(t,e){const r={[`--${e}-block-start`]:"0px",[`--${e}-inline-end`]:"0px",[`--${e}-block-end`]:"0px",[`--${e}-inline-start`]:"0px"};return!t||!e||Object.assign(r,{[`--${e}-block-start`]:`${t.top??0}px`,[`--${e}-inline-end`]:`${t.trailing??0}px`,[`--${e}-block-end`]:`${t.bottom??0}px`,[`--${e}-inline-start`]:`${t.leading??0}px`}),r}function AY(t){return AT[t]}function $l({colorMap:t,colorMode:e=Qs,fallback:r="FFFFFF"}){if(!t)return r;const n=t[e]||t[Qs];let a="";switch(n?.type){case"hex":case"alias":return n.value??r;case"linear":return a=(n.points||[]).map(i=>`${i.color} ${i.percent}%`).join(", "),`linear-gradient(${n.degrees}deg, ${a})`;case"radial":return a=(n.points||[]).map(i=>`${i.color} ${i.percent}%`).join(", "),`radial-gradient(${a})`;default:return r}}function cU(t,e=Qs){if(!t)return"";const r=$l({colorMap:t.color,colorMode:e});return`${t.width}px solid ${r}`}function $_(t){return{"--border-start-start-radius":`${t.top_leading}px`,"--border-start-end-radius":`${t.top_trailing}px`,"--border-end-start-radius":`${t.bottom_leading}px`,"--border-end-end-radius":`${t.bottom_trailing}px`}}function Kb({background_color:t,border:e,margin:r,padding:n,color:a,colorMode:i=Qs,shape:o,shadow:c}){const u={"--margin-block-start":"0px","--margin-inline-end":"0px","--margin-block-end":"0px","--margin-inline-start":"0px","--padding-block-start":"0px","--padding-inline-end":"0px","--padding-block-end":"0px","--padding-inline-start":"0px","--background":"initial","--text-color":"initial","--border":"none","--border-end-start-radius":"0px","--border-end-end-radius":"0px","--border-start-start-radius":"0px","--border-start-end-radius":"0px","--shadow":"none"};return n&&Object.assign(u,UO(n,"padding")),r&&Object.assign(u,UO(r,"margin")),t&&(u["--background"]=$l({colorMap:t,colorMode:i,fallback:"transparent"})),a&&(u["--text-color"]=$l({colorMap:a,colorMode:i,fallback:PT})),e&&(u["--border"]=cU(e,i)),o?.type==="rectangle"&&o.corners&&Object.assign(u,$_(o.corners)),o?.type==="pill"&&Object.assign(u,$_({bottom_leading:9999,bottom_trailing:9999,top_leading:9999,top_trailing:9999})),c&&(u["--shadow"]=`${c.x}px ${c.y}px ${c.radius}px 
      ${$l({colorMap:c.color,colorMode:i,fallback:PT})}`),u}function FO(t){return t.type==="fixed"?`${t.value}px`:t.type==="fit"?"fit-content":t.type==="fill"?navigator.userAgent.match(/firefox|fxios/i)?"-moz-available":"-webkit-fill-available":"initial"}function Mg(t){const e={"--width":"initial","--height":"initial","--flex":"initial"},r=FO(t.width),n=FO(t.height),a=t.width.type==="fill"||t.height.type==="fill";return Object.assign(e,{"--width":r,"--height":n,"--flex":a?"initial":"0 1 auto"}),e}function lU(t){const e={"--inset":"initial","--transform":"initial"};switch(t.alignment){case"top_leading":e["--inset"]="0 auto auto 0";break;case"top":e["--inset"]="auto auto auto 50%",e["--transform"]="translate(-50%, 0)";break;case"top_trailing":e["--inset"]="0 0 auto auto";break;case"leading":e["--inset"]="50% 0 50% 0",e["--transform"]="translate(0, -50%)";break;case"center":e["--inset"]="50% auto auto 50%",e["--transform"]="translate(-50%, -50%)";break;case"trailing":e["--inset"]="50% 0 50% auto",e["--transform"]="translate(0, -50%)";break;case"bottom_leading":e["--inset"]="auto auto 0 0";break;case"bottom":e["--inset"]="auto 50% 0 auto",e["--transform"]="translate(50%, 0)";break;case"bottom_trailing":e["--inset"]="auto 0 0 auto";break}return e}function RY(t){const e={"--direction":"initial","--alignment":"initial","--distribution":"initial","--position":"relative","--inset":"initial","--transform":"initial"};return t.type!=="zlayer"&&(Object.assign(e,{"--direction":RT[t.type],"--alignment":DT[t.alignment]}),t.distribution&&Object.assign(e,{"--distribution":OT[t.distribution]})),e}function DY(t){const{font_size:e,horizontal_alignment:r,font_weight:n,font_name:a}=t,i={"--text-align":"initial","--font-weight":"initial","--font-size":"initial","--font-family":"sans-serif","--background-clip":"none","--text-fill-color":"none","--background":"unset"};return Object.assign(i,{"--text-align":z_[r]||z_.leading,"--font-weight":F_[n]||F_.regular,"--font-size":q_[e]||q_.body_m,"--font-family":a||"sans-serif"}),i}function Ui(t){return Object.entries(t).map(([e,r])=>`${e}: ${r}`).join("; ")}function OY(t){const e=r=>{if(r.type==="package"&&r.is_selected_by_default)return r;if("components"in r&&Array.isArray(r.components))for(const n of r.components){const a=e(n);if(a!==void 0)return a}if("stack"in r){const n=e(r.stack);if(n!==void 0)return n}};for(const r of t.components_config.base.stack.components){const n=e(r);if(n!==void 0)return n?.package_id}}const Gx=(t,e)=>e?NY(e).reduce((r,n)=>{var a;if(t){const i=((a=t?.states)==null?void 0:a[n])||{};return{...r,...i}}return r},{}):{},NY=t=>t?Object.entries(t).reduce((e,[r,n])=>(n&&e.push(r),e),[]):[];function Ss(t,e){return t?e?Object.entries(t).reduce((r,[n,a])=>{const i=n.replace(/^--/,`${e}-`);return r[`--${i}`]=a,r},{}):t:{}}function IY(t){const{mask_shape:e,imageAspectRatio:r}=t;let n="";return e?.type==="concave"?n=`M 0 0 
              H 100 
              V ${r*100} 
              Q 50 ${r*80} 0 ${r*100} 
              Z`:e?.type==="convex"?n=`M 0 0 
              H 100 
              V ${r*80} 
              Q 50 ${r*120} 0 ${r*80} 
              Z`:n=`M 0 0 H 100 V ${r*100} H 0 Z`,n}const MY=t=>{const e={"--border-end-start-radius":"0px","--border-end-end-radius":"0px","--border-start-start-radius":"0px","--border-start-end-radius":"0px"};return t!=null&&t.corners&&Object.assign(e,$_(t.corners)),e};function jY(t,e){var r;const{color_overlay:n}=e;if(((r=n?.[t])==null?void 0:r.type)!=="linear")return{x1:"0%",y1:"0%",x2:"0%",y2:"0%"};const a=n?.[Qs],i=a?.type==="linear"?a.degrees:0,o="50%",c="0%",u=`${Math.round(50+Math.sin((i+90)*Math.PI/90)*50)}%`,d=`${Math.round(50-Math.cos((i+90)*Math.PI/90)*50)}%`;return{x1:o,y1:c,x2:u,y2:d}}function LY({stack:t,zStackChildStyles:e}){var r,n;const a=((n=(r=t?.size)==null?void 0:r.width)==null?void 0:n.type)==="fill"?"100%":"fit-content",i=Ss(e||{},"button");return Ui({...i,position:"var(--button-position, relative)",inset:"var(--button-inset, 0)",transform:"var(--button-transform, initial)",width:a})}const of=[];function uU(t,e){return{subscribe:Wx(t,e).subscribe}}function Wx(t,e=Ar){let r=null;const n=new Set;function a(c){if(wB(t,c)&&(t=c,r)){const u=!of.length;for(const d of n)d[1](),of.push(d,t);if(u){for(let d=0;d<of.length;d+=2)of[d][0](of[d+1]);of.length=0}}}function i(c){a(c(t))}function o(c,u=Ar){const d=[c,u];return n.add(d),n.size===1&&(r=e(a,i)||Ar),c(t),()=>{n.delete(d),n.size===0&&r&&(r(),r=null)}}return{set:a,update:i,subscribe:o}}function dU(t,e,r){const n=!Array.isArray(t),a=n?[t]:t;if(!a.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const i=e.length<2;return uU(r,(o,c)=>{let u=!1;const d=[];let f=0,h=Ar;const m=()=>{if(f)return;h();const w=e(n?d[0]:d,o,c);i?o(w):h=typeof w=="function"?w:Ar},_=a.map((w,b)=>nU(w,E=>{d[b]=E,f&=~(1<<b),u&&m()},()=>{f|=1<<b}));return u=!0,m(),function(){N_(_),h(),u=!1}})}function BY(t){pt(t,t.v+1)}function UY(t){let e=0,r=ai(0),n;return()=>{ZW()&&($(r),Dg(()=>(e===0&&(n=Ko(()=>t(()=>BY(r)))),e+=1,()=>{pK().then(()=>{e-=1,e===0&&(n?.(),n=void 0)})})))}}const fU=Symbol("paywall");function FY(t){ed(fU,t)}function Kx(){const t=Jn(fU);if(t===void 0)throw new Error("Paywall context not found");return t}const qY={hash:"svelte-mx8s0a",code:""};function zY(t,e){Wt(e,!0),zt(t,qY);const r=pu(e,["$$slots","$$events","$$legacy","stack","action"]),{onButtonAction:n}=Kx(),a=()=>n(e.action),i=ze(()=>LY({stack:e.stack,action:e.action,...r}));oU(t,{onclick:a,get style(){return $(i)},class:"rc-pw-button",children:(o,c)=>{jg(o,qc(()=>e.stack))},$$slots:{default:!0}}),Kt()}const pU={light:{type:"hex",value:PT}},$Y={light:{type:"hex",value:PY}},Yx=(t,e)=>{const{font_size:r="body_m",color:n=pU,background_color:a=$Y,padding:i,margin:o,size:c}=e,u={"--width":"unset","--height":"unset","--text-align":"initial","--font-weight":"initial","--font-size":"initial","--font-family":"sans-serif","--background-clip":"unset","--text-fill-color":"unset","--margin-block-start":"0px","--margin-inline-end":"0px","--margin-block-end":"0px","--margin-inline-start":"0px","--padding-block-start":"0px","--padding-inline-end":"0px","--padding-block-end":"0px","--padding-inline-start":"0px","--background":"transparent","--text-color":"inherit","--border":"none","--border-end-start-radius":"0px","--border-end-end-radius":"0px","--border-start-start-radius":"0px","--border-start-end-radius":"0px","--shadow":"none","--flex":"0 1 auto"},d=Gx(e.overrides,e.componentState),f=AY(r),h=DY({...e,...d}),m=Kb({background_color:a,color:n,margin:o,padding:i,colorMode:t,...d}),_=Mg({...c,...d}),w={...u,...m,...h,..._};return{textStyles:Ss(w,"text"),tagToRender:f}};function VY(t,e,r){const n={"--width":"unset","--height":"unset","--flex":"0 1 auto","--margin-block-start":"0px","--margin-inline-end":"0px","--margin-block-end":"0px","--margin-inline-start":"0px","--padding-block-start":"0px","--padding-inline-end":"0px","--padding-block-end":"0px","--padding-inline-start":"0px","--background":"transparent","--text-color":"inherit","--border":"none","--border-end-start-radius":"0px","--border-end-end-radius":"0px","--border-start-start-radius":"0px","--border-start-end-radius":"0px","--shadow":"none","--position":"relative","--inset":"0","--transform":"initial"};Object.assign(n,Kb({background_color:r,...t}),Mg(e)),Object.assign(n,t.zStackChildStyles);const a=Ss(n,"text");return Ui(a)}function HY(t,e){const r={"--text-margin-block-start":"0px","--text-margin-inline-end":"0px","--text-margin-block-end":"0px","--text-margin-inline-start":"0px","--text-padding-block-start":"0px","--text-padding-inline-end":"0px","--text-padding-block-end":"0px","--text-padding-inline-start":"0px","--text-background":"transparent","--text-text-color":"inherit","--text-border":"none","--text-border-end-start-radius":"0px","--text-border-end-end-radius":"0px","--text-border-start-start-radius":"0px","--text-border-start-end-radius":"0px","--text-shadow":"none","--text-text-align":"initial","--text-font-weight":"initial","--text-font-size":"initial","--text-font-family":"sans-serif","--text-background-clip":"initial","--text-text-fill-color":"initial","--text-width":"unset","--text-height":"unset","--text-flex":"0 1 auto"},{tagToRender:n,textStyles:a}=Yx(t,e);return Object.assign(r,a),{tagToRender:n,textStyles:Ui(r)}}function GY(t){return t?Object.values({newLine:{regexp:/\\\n/g,output:"<br/>"},bold:{regexp:/\*\*(.*?)\*\*/g,output:"<b>$1</b>"},italic:{regexp:/\*(.*?)\*/g,output:"<i>$1</i>"},strikethrough:{regexp:/~(.*?)~/g,output:"<s>$1</s>"},code:{regexp:/`(.*?)`/g,output:"<span style='font-family: monospace'>$1</span>"},link:{regexp:/\[(.*?)\]\((.*?)\)/g,output:"<a href=$2 target='_blank' rel='noopener noreferrer'>$1</a>"}}).reduce((e,{regexp:r,output:n})=>e.replaceAll(r,n),t):""}const WY={hash:"svelte-1wz4si8",code:".rc-pw-text-block.svelte-1wz4si8 {display:block;padding-block-start:var(--text-padding-block-start, initial);padding-inline-end:var(--text-padding-inline-end, initial);padding-block-end:var(--text-padding-block-end, initial);padding-inline-start:var(--text-padding-inline-start, initial);margin-block-start:var(--text-margin-block-start, initial);margin-inline-end:var(--text-margin-inline-end, initial);margin-block-end:var(--text-margin-block-end, initial);margin-inline-start:var(--text-margin-inline-start, initial);color:var(--text-text-color, #ffffff);background:var(--text-background, none);font-size:var(--text-font-size, 1rem);font-weight:var(--text-font-weight, normal);text-align:var(--text-text-align, center);font-family:var(--text-font-family, sans-serif);-webkit-background-clip:var(--text-background-clip, initial);background-clip:var(--text-background-clip, initial);-webkit-text-fill-color:var(--text-text-fill-color, initial);}"};function hU(t,e){Wt(e,!0),zt(t,WY);const r=It(e,"styleVariables",3,""),n=It(e,"component",3,"p");var a=wr(),i=Xt(a);B_(i,n,!1,(o,c)=>{let u;mt(()=>u=U_(o,u,{id:e.id,style:r(),class:"rc-pw-text-block"},"svelte-1wz4si8",o.namespaceURI===Dm,o.nodeName.includes("-")));var d=wr(),f=Xt(d);Dn(f,()=>e.children??Ar),ke(c,d)}),ke(t,a),Kt()}var Yv,Xv;class KY{constructor(e,r){SO(this,Yv),SO(this,Xv),EO(this,Yv,e),EO(this,Xv,UY(r))}get current(){return wO(this,Xv).call(this),wO(this,Yv).call(this)}}Yv=new WeakMap,Xv=new WeakMap;const YY=/\(.+\)/;class XY extends KY{constructor(e,r){let n=YY.test(e)?e:`(${e})`;const a=window.matchMedia(n);super(()=>a.matches,i=>vK(a,"change",i))}}const mU=Symbol("color-mode");function JY(t){const e=new XY("prefers-color-scheme: dark",(t?.()??Qs)==="dark"),r=()=>t?.()??(e.current?"dark":Qs);return ed(mU,r),r}function Yb(){return Jn(mU)??(()=>Qs)}const gU=Symbol("localization");function QY(t){const e={getLocalizedString:r=>{var n,a;if(!r)return"";const{selectedLocale:i,defaultLocale:o,localizations:c}=t(),u=(n=c[i??o])==null?void 0:n[r],d=(a=c[o])==null?void 0:a[r];return u??d}};return ed(gU,e),e}function Xx(){const t=Jn(gU);if(t===void 0)throw new Error("Localization context not found");return t}const ZY=["product_name","price","price_per_period","price_per_period_full","total_price_and_per_month","total_price_and_per_month_full","sub_price_per_month","sub_price_per_week","sub_duration","sub_duration_in_months","sub_period","sub_period_length","sub_period_abbreviated","sub_offer_duration","sub_offer_duration_2","sub_offer_price","sub_offer_price_2","sub_relative_discount"];function V_(t="",e){return e===void 0?t:ZY.reduce((r,n)=>{var a;return r.replaceAll(`{{ ${n} }}`,((a=e[n])==null?void 0:a.toString())||"N/A")},t)}const yU=Symbol("variables");function vU(t){ed(yU,t)}function Xb(){const t=Jn(yU);if(t===void 0)throw new Error("Variables context not found");return t}var eX=lt('<span class="rc-pw-text-wrapper svelte-11gzifq"><!></span>');const tX={hash:"svelte-11gzifq",code:".rc-pw-text-wrapper.svelte-11gzifq {display:block;height:var(--text-height, initial);width:var(--text-width, initial);background:var(--text-background, none);position:var(--text-position, relative);inset:var(--text-inset, 0);transform:var(--text-transform, initial);}"};function rX(t,e){Wt(e,!0),zt(t,tX);const r=Aa(),n=()=>ha(h,"$variables",r),a=pu(e,["$$slots","$$events","$$legacy","id","text_lid","background_color","size"]),i=Yb(),o=ze(i),c=ze(()=>HY($(o),{id:e.id,text_lid:e.text_lid,background_color:e.background_color,size:e.size,...a})),u=ze(()=>$(c).tagToRender),d=ze(()=>$(c).textStyles),f=ze(()=>VY(a,e.size,e.background_color)),h=Xb(),{getLocalizedString:m}=Xx(),_=ze(()=>V_(m(e.text_lid),n())),w=ze(()=>GY($(_)));var b=eX(),E=Le(b);hU(E,{get styleVariables(){return $(d)},get component(){return $(u)},get id(){return e.id},children:(T,D)=>{var P=wr(),A=Xt(P);fu(A,()=>$(w)),ke(T,P)},$$slots:{default:!0}}),mt(()=>Ut(b,"style",$(f))),ke(t,b),Kt()}function H_(t,e){Wt(e,!0);const r={stack:jg,text:rX,image:SX,button:zY,purchase_button:LX,package:xX,footer:_U,timeline:HX},n=h=>{if(r[h.type])return[r[h.type],h];const{fallback:m}=h;if(m&&r[m?.type])return[r[m.type],m];throw new Error(`Invalid component type: ${h.type}`)},a=pu(e,["$$slots","$$events","$$legacy","nodeData","zStackChildStyles"]),i=ze(()=>n(e.nodeData)),o=ze(()=>$(i)[0]),c=ze(()=>$(i)[1]),u=ze(()=>("components"in e.nodeData?e.nodeData.components:void 0)??[]);var d=wr(),f=Xt(d);return EK(f,()=>$(o),(h,m)=>{m(h,qc(()=>$(c)||{},{get zStackChildStyles(){return e.zStackChildStyles}},()=>a,{children:(_,w)=>{var b=wr(),E=Xt(b);op(E,17,()=>$(u),sp,(T,D)=>{H_(T,qc({get nodeData(){return $(D)}},()=>a))}),ke(_,b)},$$slots:{default:!0}}))}),ke(t,d),Kt({getComponentClass:n})}const nX=(t,e)=>{const{background_color:r,margin:n,padding:a,spacing:i,size:o,border:c,shape:u,shadow:d,dimension:f,componentState:h,overrides:m,zStackChildStyles:_}=e,w={"--flex":"0 1 auto","--height":"initial","--width":"initial","--spacing":`${i||0}px`,"--direction":"unset","--alignment":"unset","--distribution":"flex-start","--margin-block-start":"0px","--margin-inline-end":"0px","--margin-block-end":"0px","--margin-inline-start":"0px","--padding-block-start":"0px","--padding-inline-end":"0px","--padding-block-end":"0px","--padding-inline-start":"0px","--background":"unset","--text-color":"inherit","--border":"none","--border-end-start-radius":"0px","--border-end-end-radius":"0px","--border-start-start-radius":"0px","--border-start-end-radius":"0px","--shadow":"none","--position":"relative","--transform":"initial","--inset":"initial"},b=Gx(m,h);Object.assign(w,Kb({background_color:r,margin:n,padding:a,border:c,colorMode:t,shape:u,shadow:d,...b}),RY({...f,...b}),Mg({...o,...b})),Object.assign(w,_);const E=Ss(w,"stack");return Ui(E)};function aX(t,e){var r,n,a,i,o,c;const{badge:u}=e;if(!u)return"";const d={"--inset":"unset","--transform":"unset","--margin-block-start":"0px","--margin-inline-end":"0px","--margin-block-end":"0px","--margin-inline-start":"0px","--padding-block-start":"0px","--padding-inline-end":"0px","--padding-block-end":"0px","--padding-inline-start":"0px","--background":"unset","--text-color":"inherit","--border":"none","--border-end-start-radius":"0px","--border-end-end-radius":"0px","--border-start-start-radius":"0px","--border-start-end-radius":"0px","--shadow":"none","--badge-width":"unset","--z-index":"unset"};if(Object.assign(d,lU({alignment:u.alignment}),Kb({...u,background_color:u.background_color,color:u.color,colorMode:t})),u.style==="overlay"&&(d["--margin-block-start"]="0px",d["--margin-block-end"]="0px",d["--transform"]=cv(u,0,-(((r=e.border)==null?void 0:r.width)||0))),u.style==="edge_to_edge")if(d["--margin-block-start"]="0px",d["--margin-block-end"]="0px",d["--margin-inline-start"]="0px",d["--margin-inline-end"]="0px",u.alignment==="top"||u.alignment==="bottom"){d["--badge-width"]=`calc(100% + ${(((n=e.border)==null?void 0:n.width)||0)*2}px)`,d["--z-index"]="-1";const h=Math.max(((i=(a=e.shape)==null?void 0:a.corners)==null?void 0:i.top_leading)||0,((c=(o=e.shape)==null?void 0:o.corners)==null?void 0:c.top_trailing)||0);u.alignment==="top"&&(d["--padding-block-end"]=`${h+u.padding.bottom}px`,d["--transform"]=cv(u,h)),u.alignment==="bottom"&&(d["--padding-block-start"]=`${h+u.padding.top}px`,d["--transform"]=cv(u,-h))}else d["--transform"]=cv(u),Object.assign(d,iX(e));const f=Ss(d,"stack-badge");return Ui(f)}const qO={top_leading:"bottom_trailing",top_trailing:"bottom_leading",bottom_leading:"top_trailing",bottom_trailing:"top_leading"},zO={top_leading:"--border-start-start-radius",top_trailing:"--border-start-end-radius",bottom_leading:"--border-end-start-radius",bottom_trailing:"--border-end-end-radius"};function iX(t){var e,r,n;const a={"--border-end-start-radius":"0px","--border-end-end-radius":"0px","--border-start-start-radius":"0px","--border-start-end-radius":"0px"},{badge:i}=t;if(!i)return a;const o=((e=t.border)==null?void 0:e.width)||0,c=i.alignment;return a[zO[qO[c]]]=`${(r=i.shape)==null?void 0:r.corners[qO[c]]}px`,a[zO[c]]=`${((n=t.shape)==null?void 0:n.corners[c])-o}px`,a}function cv(t,e=0,r=0){if(!t)return"";if(t.style==="overlay"){if(t.alignment==="top_leading")return`translate(${r}px, calc(-50% + ${e}px))`;if(t.alignment==="top_trailing")return`translate(calc(0% - ${r}px), calc(-50% + ${e}px))`;if(t.alignment==="bottom_leading")return`translate(${r}px, calc(50% + ${e}px))`;if(t.alignment==="bottom_trailing")return`translate(calc(0% - ${r}px), calc(50% + ${e}px))`;if(t.alignment==="top")return`translate(calc(-50% + ${r}px), calc(-50% + ${e}px))`;if(t.alignment==="bottom")return`translate(calc(50% + ${r}px), calc(50% + ${e}px))`}if(t.style==="edge_to_edge"){if(t.alignment==="top")return`translate(calc(-50% + ${r}px), calc(-100% - ${e}px + 16px))`;if(t.alignment==="bottom")return`translate(calc(50% + ${r}px), calc(100% + ${e}px))`}return""}function sX(t,e){const{badge:r}=e;if(!r)return{tagToRender:"",textStyles:""};const{tagToRender:n,textStyles:a}=Yx(t,{id:e.id,...r,type:"text",size:{width:{type:"fit"},height:{type:"fit"}},color:r?.color,name:e.name}),i={...a,"--text-margin-block-start":"0px","--text-margin-inline-end":"0px","--text-margin-block-end":"0px","--text-margin-inline-start":"0px","--text-padding-block-start":"0px","--text-padding-inline-end":"0px","--text-padding-block-end":"0px","--text-padding-inline-start":"0px"},o=Ui(i);return{tagToRender:n,textStyles:o}}function oX(t){const{dimension:e}=t,r={"--inset":"initial","--transform":"initial","--position":"relative"};if(e.type!=="zlayer")return;const n=lU({...e});return Object.assign(r,{...n,"--position":"absolute"}),r}var cX=lt('<span class="rc-pw-badge svelte-1b5bst5"><!></span>'),lX=lt('<div class="rc-pw-stack-wrapper svelte-1b5bst5"><!> <div class="rc-pw-stack svelte-1b5bst5"></div></div>');const uX={hash:"svelte-1b5bst5",code:`.rc-pw-stack-wrapper.svelte-1b5bst5 {display:block;box-sizing:border-box;width:var(--stack-width, unset);height:var(--stack-height, unset);box-shadow:var(--stack-shadow, none);background:var(--stack-background, unset);position:var(--stack-position, relative);transform:var(--stack-transform, initial);inset:var(--stack-inset, initial);margin-block-start:var(--stack-margin-block-start, 0);margin-inline-end:var(--stack-margin-inline-end, 0);margin-block-end:var(--stack-margin-block-end, 0);margin-inline-start:var(--stack-margin-inline-start, 0);border:var(--stack-border, none);border-end-start-radius:var(--stack-border-end-start-radius, 0px);border-end-end-radius:var(--stack-border-end-end-radius, 0px);border-start-start-radius:var(--stack-border-start-start-radius, 0px);border-start-end-radius:var(--stack-border-start-end-radius, 0px);}.rc-pw-stack.svelte-1b5bst5 {background:none;overflow:hidden;box-sizing:border-box;width:100%;height:100%;display:flex;gap:var(--stack-spacing, 0);flex:var(--stack-flex, 0 1 auto);flex-direction:var(--stack-direction, unset);justify-content:var(--stack-distribution, flex-start);align-items:var(--stack-alignment, flex-start);padding-block-start:var(--stack-padding-block-start, 0);padding-inline-end:var(--stack-padding-inline-end, 0);padding-block-end:var(--stack-padding-block-end, 0);padding-inline-start:var(--stack-padding-inline-start, 0);}.rc-pw-badge.svelte-1b5bst5 {box-sizing:border-box;font-family:var(--stack-badge-font-family, sans-serif);position:absolute;inset:var(--stack-badge-inset, unset);transform:var(--stack-badge-transform, initial);margin-block-start:var(--stack-badge-margin-block-start, 0px);margin-inline-end:var(--stack-badge-margin-inline-end, 0px);margin-block-end:var(--stack-badge-margin-block-end, 0px);margin-inline-start:var(--stack-badge-margin-inline-start, 0px);padding-block-start:var(--stack-badge-padding-block-start, 0px);padding-inline-end:var(--stack-badge-padding-inline-end, 0px);padding-block-end:var(--stack-badge-padding-block-end, 0px);padding-inline-start:var(--stack-badge-padding-inline-start, 0px);background:var(--stack-badge-background, initial);color:var(--stack-badge-text-color, inherit);border:var(--stack-badge-border, none);border-end-start-radius:var(--stack-badge-border-end-start-radius, 0px);border-end-end-radius:var(--stack-badge-border-end-end-radius, 0px);border-start-start-radius:var(
      --stack-badge-border-start-start-radius,
      0px
    );border-start-end-radius:var(--stack-badge-border-start-end-radius, 0px);box-shadow:var(--stack-badge-shadow, none);display:flex;align-items:center;justify-content:center;width:var(--stack-badge-badge-width, max-content);height:var(--stack-badge-badge-height, max-content);z-index:var(--stack-badge-z-index, 1);}`};function jg(t,e){Wt(e,!0),zt(t,uX);const r=Aa(),n=()=>ha(f,"$variables",r),a=pu(e,["$$slots","$$events","$$legacy","id","components","badge","zStackChildStyles"]),i=Yb(),o=ze(i),c=ze(()=>nX($(o),{id:e.id,components:e.components,zStackChildStyles:e.zStackChildStyles,...a})),u=ze(()=>aX($(o),{id:e.id,components:e.components,badge:e.badge,...a})),d=ze(()=>oX({id:e.id,components:e.components,...a})),f=Xb(),{getLocalizedString:h}=Xx(),m=ze(()=>{var A;return V_(h((A=e.badge)==null?void 0:A.text_lid),n())}),_=ze(()=>sX($(o),{id:e.id,components:e.components,badge:e.badge,...a})),w=ze(()=>$(_).tagToRender),b=ze(()=>$(_).textStyles);var E=lX(),T=Le(E);{var D=A=>{var C=cX(),O=Le(C);hU(O,{get styleVariables(){return $(b)},get component(){return $(w)},children:(I,x)=>{var R=Ur();mt(()=>hr(R,$(m))),ke(I,R)},$$slots:{default:!0}}),mt(()=>Ut(C,"style",$(u))),ke(A,C)};xt(T,A=>{e.badge&&A(D)})}var P=kt(T,2);op(P,21,()=>e.components,sp,(A,C,O)=>{var I=wr(),x=Xt(I);{var R=L=>{var j=ze(()=>O>0?$(d):void 0);H_(L,{get nodeData(){return $(C)},get componentState(){return e.componentState},get zStackChildStyles(){return $(j)}})},N=L=>{H_(L,{get nodeData(){return $(C)},get componentState(){return e.componentState}})};xt(x,L=>{$(d)?L(R):L(N,!1)})}ke(A,I)}),mt(()=>{Ut(E,"id",e.id),Ut(E,"style",$(c))}),ke(t,E),Kt()}var dX=lt('<div class="rc-pw-footer svelte-pg5jlz"><!></div>');const fX={hash:"svelte-pg5jlz",code:".rc-pw-footer.svelte-pg5jlz {position:sticky;bottom:0;transform:translateY(50%);width:100%;}"};function _U(t,e){zt(t,fX);var r=dX(),n=Le(r);jg(n,qc(()=>e.stack)),mt(()=>Ut(r,"id",e.id)),ke(t,r)}const pX=(t,e)=>{const{size:r,overrides:n,componentState:a,zStackChildStyles:i}=e,o={"--height":"unset","--width":"unset","--clip-path":"none","--border-end-start-radius":"unset","--border-end-end-radius":"unset","--border-start-start-radius":"unset","--border-start-end-radius":"unset","--position":"relative","--inset":"0","--transform":"initial"},c=Gx(n,a);Object.assign(o,i),Object.assign(o,Mg({...r,...c})),Object.assign(o,MY(e.mask_shape));const u=Ss(o,"image"),d=IY(e),f=jY(t,e);return{imageStyles:Ui(u),maskPath:d,linearGradientAngle:f}};var hX=Qo('<ellipse cx="50" rx="50"></ellipse>'),mX=Qo("<path></path>"),gX=Qo("<stop></stop>"),yX=Qo("<linearGradient></linearGradient>"),vX=Qo("<stop></stop>"),_X=Qo('<radialGradient cx="50%" cy="50%" r="50%" fx="50%" fy="50%"></radialGradient>'),bX=Qo('<linearGradient><stop offset="0%"></stop></linearGradient>'),kX=lt('<img style="display: none;" alt=""> <svg class="rc-pw-image-container svelte-1esrvxg" preserveAspectRatio="xMidYMid slice"><defs><clipPath><!></clipPath><!></defs><image class="rc-pw-image svelte-1esrvxg" x="0" y="0" width="100" preserveAspectRatio="xMidYMid slice"></image><rect class="rc-pw-image-overlay svelte-1esrvxg" x="0" y="0" width="100"></rect></svg>',1);const wX={hash:"svelte-1esrvxg",code:".rc-pw-image-container.svelte-1esrvxg {border-end-start-radius:var(--image-border-end-start-radius, 0px);border-end-end-radius:var(--image-border-end-end-radius, 0px);border-start-start-radius:var(--image-border-start-start-radius, 0px);border-start-end-radius:var(--image-border-start-end-radius, 0px);position:relative;overflow:hidden;display:flex;flex:var(--image-flex, 1 1 auto);position:var(--image-position, relative);inset:var(--image-inset, 0);transform:var(--image-transform, initial);height:var(--image-height, initial);width:var(--image-width, initial);}.rc-pw-image.svelte-1esrvxg {width:100%;height:100%;object-fit:cover;display:block;}.rc-pw-image-overlay.svelte-1esrvxg {position:absolute;inset:0;}"};function SX(t,e){Wt(e,!0),zt(t,wX);const r=pu(e,["$$slots","$$events","$$legacy","id","source"]),n=Yb(),a=ze(n);let i=sr(0),o;function c(){o&&pt(i,o.naturalHeight/o.naturalWidth)}const u=ze(()=>pX($(a),{id:e.id,source:e.source,...r,imageAspectRatio:$(i)})),d=ze(()=>$(u).imageStyles),f=ze(()=>$(u).maskPath),h=ze(()=>$(u).linearGradientAngle),m=ze(()=>{var j,q;return(j=e.source[$(a)])!=null&&j.original?e.source[$(a)].original:(q=e.source[Qs])==null?void 0:q.original}),_=ze(()=>e.color_overlay),w=ze(()=>{var j,q;return((j=$(_))==null?void 0:j[$(a)])??((q=$(_))==null?void 0:q[Qs])});var b=kX(),E=Xt(b);tU(E,j=>o=j,()=>o);var T=kt(E,2),D=Le(T),P=Le(D),A=Le(P);{var C=j=>{var q=hX();mt(()=>{Ut(q,"cy",$(i)*50),Ut(q,"ry",$(i)*50)}),ke(j,q)},O=j=>{var q=mX();mt(()=>Ut(q,"d",$(f))),ke(j,q)};xt(A,j=>{var q;((q=e.mask_shape)==null?void 0:q.type)==="circle"?j(C):j(O,!1)})}var I=kt(P);{var x=j=>{var q=yX();op(q,21,()=>{var U;return((U=$(w))==null?void 0:U.points)||[]},sp,(U,W)=>{var F=gX();mt(()=>{Ut(F,"offset",`${$(W).percent}%`),Ut(F,"style",`stop-color: ${$(W).color}`)}),ke(U,F)}),mt(()=>{Ut(q,"id",`gradient-${e.id}`),Ut(q,"x1",$(h).x1),Ut(q,"y1",$(h).y1),Ut(q,"x2",$(h).x2),Ut(q,"y2",$(h).y2)}),ke(j,q)},R=j=>{var q=wr(),U=Xt(q);{var W=Y=>{var Q=_X();op(Q,21,()=>{var ie;return((ie=$(w))==null?void 0:ie.points)||[]},sp,(ie,G)=>{var B=vX();mt(()=>{Ut(B,"offset",`${$(G).percent}%`),Ut(B,"style",`stop-color: ${$(G).color}`)}),ke(ie,B)}),mt(()=>Ut(Q,"id",`gradient-${e.id}`)),ke(Y,Q)},F=Y=>{var Q=wr(),ie=Xt(Q);{var G=B=>{var K=bX(),ae=Le(K);mt(()=>{var te;Ut(K,"id",`gradient-${e.id}`),Ut(ae,"style",`stop-color: ${(te=$(w))==null?void 0:te.value}`)}),ke(B,K)};xt(ie,B=>{var K;((K=$(w))==null?void 0:K.type)==="hex"&&B(G)},!0)}ke(Y,Q)};xt(U,Y=>{var Q;((Q=$(w))==null?void 0:Q.type)==="radial"?Y(W):Y(F,!1)},!0)}ke(j,q)};xt(I,j=>{var q;((q=$(w))==null?void 0:q.type)==="linear"?j(x):j(R,!1)})}var N=kt(D),L=kt(N);mt(()=>{Ut(E,"src",$(m)),Ut(T,"id",`rc-pw-image-container-${e.id}`),Ut(T,"style",$(d)),Ut(T,"viewBox",`0 0 100 ${$(i)*100}`),Ut(P,"id",`clip-path-${e.id}`),Ut(N,"href",$(m)),Ut(N,"height",$(i)*100),Ut(N,"clip-path",`url(#clip-path-${e.id})`),Ut(N,"id",e.id),Ut(L,"height",$(i)*100),Ut(L,"clip-path",`url(#clip-path-${e.id})`),Ut(L,"fill",`url(#gradient-${e.id})`)}),jo("load",E,c),ke(t,b),Kt()}const EX=(t,e,r,n)=>NK(r,Vt(n.package_id));var TX=lt('<button class="rc-pw-package svelte-123kamd"><!></button>');const CX={hash:"svelte-123kamd",code:".rc-pw-package.svelte-123kamd {width:100%;display:flex;margin:0;padding:0;background:initial;border:initial;text-align:initial;position:var(--package-position, relative);inset:var(--package-inset, 0);transform:var(--package-transform, initial);}"};function xX(t,e){Wt(e,!0),zt(t,CX);const r=Aa(),n=()=>ha(i,"$selectedPackageId",r),a=()=>ha(o,"$variablesPerPackage",r),{selectedPackageId:i,variablesPerPackage:o}=Kx(),c=Xb(),u=dU(c,_=>{var w;return((w=a())==null?void 0:w[e.package_id])??_});vU(u);const d=ze(()=>({selected:n()===e.package_id})),f=ze(()=>Ui(Ss(e.zStackChildStyles,"package")));var h=TX();h.__click=[EX,n,i,e];var m=Le(h);jg(m,qc(()=>e.stack,{get componentState(){return $(d)}})),mt(()=>{Ut(h,"id",e.id),Ut(h,"style",$(f)),Lc(h,"selected",$(d).selected)}),ke(t,h),Kt()}Gb(["click"]);function PX({background:t,colorMode:e}){const r={"--background":"initial"};t?.type==="color"&&Object.assign(r,{"--background":$l({colorMap:t.value,colorMode:e,fallback:"transparent"})});const n=Ss(r,"paywall");return Ui(n)}function AX(t,e){var r,n;const{background:a}=t.components_config.base;if(a?.type!=="image")return"";const{value:i}=a;return((r=i[e])==null?void 0:r.original)??((n=i[Qs])==null?void 0:n.original)}var RX=lt('<div class="rc-pw-paywall-background svelte-14bszwq"></div>'),DX=lt('<div class="rc-pw-paywall-background rc-pw-image-container svelte-14bszwq"><img class="rc-pw-image svelte-14bszwq" alt=""></div>'),OX=lt('<div class="rc-pw-paywall svelte-14bszwq"><!> <!> <!></div>');const NX={hash:"svelte-14bszwq",code:`.rc-pw-paywall.svelte-14bszwq {position:relative;display:block;max-height:100%;}.rc-pw-paywall-background.svelte-14bszwq {position:absolute;top:0;left:0;width:100%;height:100%;background:var(--paywall-background, none);z-index:-1;}.rc-pw-image-container.svelte-14bszwq {overflow:hidden;background:none;}.rc-pw-image.svelte-14bszwq {width:100%;height:100%;object-fit:cover;display:block;}*,
    *::before,
    *::after {box-sizing:border-box;margin:0;padding:0;font-family:sans-serif;}body {line-height:1.5;-webkit-font-smoothing:antialiased;}img,
    picture,
    video,
    canvas,
    svg {display:block;max-width:100%;}input,
    button,
    textarea,
    select {font:inherit;}p,
    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {overflow-wrap:break-word;}p {text-wrap:pretty;}h1,
    h2,
    h3,
    h4,
    h5,
    h6 {text-wrap:balance;}#root,
    #__next {isolation:isolate;}`};function IX(t,e){Wt(e,!0),zt(t,NX);const r=Aa(),n=()=>ha(u,"$selectedPackageId",r),a=It(e,"variablesPerPackage",19,()=>({})),i=JY(()=>e.preferredColorMode),o=ze(i),{getLocalizedString:c}=QY(()=>({defaultLocale:e.paywallData.default_locale,selectedLocale:e.selectedLocale,localizations:e.paywallData.components_localizations})),u=Wx(OY(e.paywallData)),d=()=>{var E;const T=n();T!==void 0&&((E=e.onPurchaseClicked)==null||E.call(e,T))},f=E=>{var T,D,P,A;switch(E.type){case"navigate_back":(T=e.onBackClicked)==null||T.call(e);return;case"restore_purchases":(D=e.onRestorePurchasesClicked)==null||D.call(e);return}switch(E.destination){case"customer_center":(P=e.onVisitCustomerCenterClicked)==null||P.call(e);return;case"privacy_policy":case"terms":case"url":const C=c(E.url.url_lid);C&&((A=e.onNavigateToUrlClicked)==null||A.call(e,C));return;case"offer_code":case"sheet":case"web_paywall_link":return}};FY({selectedPackageId:u,variablesPerPackage:uU(a()),onPurchase:d,onButtonAction:f});const h=dU(u,E=>a()[E||""]);vU(h);const m=ze(()=>{var E;return PX({background:(E=e.paywallData.components_config.base)==null?void 0:E.background,colorMode:$(o)})}),_=ze(()=>AX(e.paywallData,$(o)));var w=wr(),b=Xt(w);LK(b,{get onerror(){return e.onError}},E=>{var T=OX(),D=Le(T);H_(D,{get nodeData(){return e.paywallData.components_config.base.stack}});var P=kt(D,2);{var A=x=>{_U(x,qc(()=>e.paywallData.components_config.base.sticky_footer,{get stack(){return e.paywallData.components_config.base.sticky_footer.stack}}))};xt(P,x=>{e.paywallData.components_config.base.sticky_footer&&x(A)})}var C=kt(P,2);{var O=x=>{var R=RX();mt(()=>Ut(R,"style",$(m))),ke(x,R)},I=x=>{var R=wr(),N=Xt(R);{var L=j=>{var q=DX(),U=Le(q);mt(()=>Ut(U,"src",$(_))),ke(j,q)};xt(N,j=>{var q;((q=e.paywallData.components_config.base.background)==null?void 0:q.type)==="image"&&j(L)},!0)}ke(x,R)};xt(C,x=>{var R;((R=e.paywallData.components_config.base.background)==null?void 0:R.type)==="color"?x(O):x(I,!1)})}ke(E,T)}),ke(t,w),Kt()}function MX({stack:t,zStackChildStyles:e}){const r=t.size.width.type==="fill"?"100%":"fit-content",n=Ss(e||{},"purchase-button");return Ui({...n,position:"var(--purchase-button-position, relative)",inset:"var(--purchase-button-inset, 0)",transform:"var(--purchase-button-transform, initial)",width:r})}const jX={hash:"svelte-1x8zwdp",code:""};function LX(t,e){Wt(e,!0),zt(t,jX);const r=pu(e,["$$slots","$$events","$$legacy","stack","zStackChildStyles"]),{onPurchase:n}=Kx(),a=ze(()=>MX({stack:e.stack,zStackChildStyles:e.zStackChildStyles,...r}));oU(t,{onclick:n,class:"rc-pw-purchase-button",get style(){return $(a)},children:(i,o)=>{jg(i,qc(()=>e.stack))},$$slots:{default:!0}}),Kt()}function BX(t){const e={"--item-spacing":`${t.item_spacing}px`,"--width":"initial","--height":"initial","--flex":"0 1 auto","--position":"relative","--inset":"0","--transform":"initial"};Object.assign(e,Mg(t.size)),Object.assign(e,t.zStackChildStyles);const r=Ss(e,"timeline");return Ui(r)}function UX(t,e){var r,n,a,i,o,c,u,d;const f={"--icon-size":`${e.icon.width_and_height}px`,"--icon-padding":`${e.icon.padding}px`,"--icon-color":$l({colorMap:e.icon.color,colorMode:t}),"--icon-background-color":$l({colorMap:(r=e.icon_background)==null?void 0:r.color,colorMode:t}),"--icon-border":cU((n=e.icon_background)==null?void 0:n.border,t),"--text-spacing":`${e.text_spacing}px`,"--border-start-start-radius":"0px","--border-start-end-radius":"0px","--border-end-start-radius":"0px","--border-end-end-radius":"0px","--connector-color":$l({colorMap:(a=e.connector)==null?void 0:a.color,colorMode:t}),"--connector-width":`${((i=e.connector)==null?void 0:i.width)||0}px`,"--connector-top":"0px","--connector-height":`${e.item_spacing}px`};if(Object.assign(f,((c=(o=e.icon_background)==null?void 0:o.shape)==null?void 0:c.type)==="rectangle"?$_((d=(u=e.icon_background)==null?void 0:u.shape)==null?void 0:d.corners):{"--border-start-start-radius":"50%","--border-start-end-radius":"50%","--border-end-start-radius":"50%","--border-end-end-radius":"50%"}),e.connector){const m=e.connector.margin.top!==0,_=e.connector.margin.bottom!==0,w=e.icon.padding+e.icon.width_and_height/2;!m&&!_&&(f["--connector-height"]=`${e.item_spacing+w*2}px`,f["--connector-top"]="50%"),m&&_&&(f["--connector-height"]=`${e.item_spacing-e.connector.margin.top-e.connector.margin.bottom}px`,f["--connector-top"]=`calc(100% + ${e.connector.margin.top}px)`),!m&&_&&(f["--connector-height"]=`${e.item_spacing-e.connector.margin.bottom+w}px`,f["--connector-top"]="50%"),m&&!_&&(f["--connector-height"]=`${e.item_spacing+w}px`,f["--connector-top"]=`calc(100% + ${e.connector.margin.top}px)`)}const h=Ss(f,"timeline-item");return Ui(h)}function $O(t,e,r="title"){var n,a,i,o;const c={"--text-color":"inherit","--text-font-size":"initial","--text-font-weight":"initial","--text-horizontal-alignment":"initial","--text-margin-block-start":"0px","--text-margin-inline-end":"0px","--text-margin-block-end":"0px","--text-margin-inline-start":"0px","--text-padding-block-start":"0px","--text-padding-inline-end":"0px","--text-padding-block-end":"0px","--text-padding-inline-start":"0px"},u={color:((n=e[r])==null?void 0:n.color)||pU,font_size:((a=e[r])==null?void 0:a.font_size)||"body_m",font_weight:((i=e[r])==null?void 0:i.font_weight)||"regular",horizontal_alignment:((o=e[r])==null?void 0:o.horizontal_alignment)||"leading"},{tagToRender:d,textStyles:f}=Yx(t,{...e,...u,size:{width:{type:"fit"},height:{type:"fit"}},type:"text",margin:{top:0,bottom:0,leading:0,trailing:0},padding:{top:0,bottom:0,leading:0,trailing:0},text_lid:""});return Object.assign(c,f),{textStyles:Ui(Ss(c,"timeline-item")),tagToRender:d}}var FX=lt('<div class="rc-pw-timeline-item svelte-gjmo4g"><div class="rc-pw-timeline-item-icon-container svelte-gjmo4g"><div class="rc-pw-timeline-item-icon svelte-gjmo4g"></div></div> <div class="rc-pw-timeline-item-content svelte-gjmo4g"><!> <!></div></div>');const qX={hash:"svelte-gjmo4g",code:`.rc-pw-timeline-item.svelte-gjmo4g {display:flex;align-items:center;gap:var(--timeline-item-spacing, 0px);}.rc-pw-timeline-item-icon-container.svelte-gjmo4g {position:relative;border-end-start-radius:var(--timeline-item-border-end-start-radius, 0px);border-end-end-radius:var(--timeline-item-border-end-end-radius, 0px);border-start-start-radius:var(
      --timeline-item-border-start-start-radius,
      0px
    );border-start-end-radius:var(--timeline-item-border-start-end-radius, 0px);width:var(--timeline-item-icon-size, 16px);height:var(--timeline-item-icon-size, 16px);flex-shrink:0;background-color:var(--timeline-item-icon-background-color, #ffffff);border:var(--timeline-item-icon-border, initial);display:flex;align-items:center;justify-content:center;padding:var(--timeline-item-icon-padding, 0px);box-sizing:content-box;}.rc-pw-timeline-item-icon-container.svelte-gjmo4g::before {position:absolute;content:"";z-index:-1;top:var(--timeline-item-connector-top, 0px);height:var(--timeline-item-connector-height, 0px);width:var(--timeline-item-connector-width, 0px);background:var(--timeline-item-connector-color, transparent);}.rc-pw-timeline-item-icon.svelte-gjmo4g {width:var(--timeline-item-icon-size, 10px);height:var(--timeline-item-icon-size, 10px);color:var(--timeline-item-icon-color, #ffffff);display:flex;align-items:center;justify-content:center;}.rc-pw-timeline-item-content.svelte-gjmo4g {display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-start;gap:var(--timeline-item-text-spacing, 0px);height:fit-content;}.rc-pw-timeline-item-content-title.svelte-gjmo4g,
  .rc-pw-timeline-item-content-description.svelte-gjmo4g {margin-block-start:var(--timeline-item-text-margin-block-start, 0px);margin-inline-end:var(--timeline-item-text-margin-inline-end, 0px);margin-block-end:var(--timeline-item-text-margin-block-end, 0px);margin-inline-start:var(--timeline-item-text-margin-inline-start, 0px);padding-block-start:var(--timeline-item-text-padding-block-start, 0);padding-inline-end:var(--timeline-item-text-padding-inline-end, 0);padding-block-end:var(--timeline-item-text-padding-block-end, 0);padding-inline-start:var(--timeline-item-text-padding-inline-start, 0);font-family:var(--timeline-item-text-font-family, sans-serif);}`};function zX(t,e){Wt(e,!0),zt(t,qX);const r=Aa(),n=()=>ha(d,"$variables",r),a=pu(e,["$$slots","$$events","$$legacy"]),i=Yb(),o=ze(i),c=ze(()=>UX($(o),a)),{getLocalizedString:u}=Xx(),d=Xb(),f=ze(()=>V_(u(e.title.text_lid),n())),h=ze(()=>{var I;return V_(u((I=e.description)==null?void 0:I.text_lid),n())}),m=ze(()=>$O($(o),a,"title")),_=ze(()=>$(m).tagToRender),w=ze(()=>$(m).textStyles),b=ze(()=>$O($(o),a,"description")),E=ze(()=>$(b).tagToRender),T=ze(()=>$(b).textStyles);var D=FX(),P=kt(Le(D),2),A=Le(P);B_(A,()=>$(_),!1,(I,x)=>{let R;mt(()=>R=U_(I,R,{class:"rc-pw-timeline-item-content-title",style:$(w)},"svelte-gjmo4g",I.namespaceURI===Dm,I.nodeName.includes("-")));var N=Ur();mt(()=>hr(N,$(f))),ke(x,N)});var C=kt(A,2);{var O=I=>{var x=wr(),R=Xt(x);B_(R,()=>$(E),!1,(N,L)=>{let j;mt(()=>j=U_(N,j,{class:"rc-pw-timeline-item-content-description",style:$(T)},"svelte-gjmo4g",N.namespaceURI===Dm,N.nodeName.includes("-")));var q=Ur();mt(()=>hr(q,$(h))),ke(L,q)}),ke(I,x)};xt(C,I=>{$(h)&&I(O)})}mt(()=>Ut(D,"style",$(c))),ke(t,D),Kt()}var $X=lt('<div class="rc-pw-timeline-container svelte-12g27vu"></div>');const VX={hash:"svelte-12g27vu",code:".rc-pw-timeline-container.svelte-12g27vu {display:flex;flex:var(--timeline-flex, 0 1 auto);flex-direction:column;gap:var(--timeline-item-spacing, 0);width:var(--timeline-width, initial);height:var(--timeline-height, initial);position:var(--timeline-position, relative);inset:var(--timeline-inset, 0);transform:var(--timeline-transform, initial);}"};function HX(t,e){Wt(e,!0),zt(t,VX);const r=pu(e,["$$slots","$$events","$$legacy","items"]),n=ze(()=>BX({items:e.items,...r}));var a=wr(),i=Xt(a);{var o=c=>{var u=$X();op(u,21,()=>e.items,sp,(d,f,h)=>{var m=ze(()=>`${e.id}-${h}`),_=ze(()=>`${e.name}-${h}`);zX(d,qc(()=>$(f),{get id(){return $(m)},get name(){return $(_)},type:"timeline",get text_spacing(){return e.text_spacing},get item_spacing(){return e.item_spacing}}))}),mt(()=>Ut(u,"style",$(n))),ke(c,u)};xt(i,c=>{e.items.length&&c(o)})}ke(t,a),Kt()}var GX=lt("<span><!></span>");const WX={hash:"svelte-byrjto",code:`
  /* svelte-ignore css-unused-selector */.rcb-typography-heading-2xl.svelte-byrjto {font:var(--rc-text-heading2xl-mobile);}

  /* svelte-ignore css-unused-selector */.rcb-typography-heading-xl.svelte-byrjto {font:var(--rc-text-headingXl-mobile);}

  /* svelte-ignore css-unused-selector */.rcb-typography-heading-lg.svelte-byrjto {font:var(--rc-text-headingLg-mobile);}

  /* svelte-ignore css-unused-selector */.rcb-typography-heading-md.svelte-byrjto {font:var(--rc-text-headingMd-mobile);}

  /* svelte-ignore css-unused-selector */.rcb-typography-body-base.svelte-byrjto {font:var(--rc-text-bodyBase-mobile);}

  /* svelte-ignore css-unused-selector */.rcb-typography-body-small.svelte-byrjto {font:var(--rc-text-bodySmall-mobile);}

  /* svelte-ignore css-unused-selector */.rcb-typography-label-button.svelte-byrjto {font:var(--rc-text-labelButton-mobile);}

  /* svelte-ignore css-unused-selector */.rcb-typography-label-default.svelte-byrjto {font:var(--rc-text-labelDefault-mobile);}

  /* svelte-ignore css-unused-selector */.rcb-typography-caption-default.svelte-byrjto {font:var(--rc-text-captionDefault-mobile);}

  /* svelte-ignore css-unused-selector */.rcb-typography-caption-link.svelte-byrjto {font:var(--rc-text-captionLink-mobile);}

  @container layout-query-container (width >= 768px) {
    /* svelte-ignore css-unused-selector */.rcb-typography-heading-2xl.svelte-byrjto {font:var(--rc-text-heading2xl-desktop);}

    /* svelte-ignore css-unused-selector */.rcb-typography-heading-xl.svelte-byrjto {font:var(--rc-text-headingXl-desktop);}

    /* svelte-ignore css-unused-selector */.rcb-typography-heading-lg.svelte-byrjto {font:var(--rc-text-headingLg-desktop);}

    /* svelte-ignore css-unused-selector */.rcb-typography-heading-md.svelte-byrjto {font:var(--rc-text-headingMd-desktop);}

    /* svelte-ignore css-unused-selector */.rcb-typography-body-base.svelte-byrjto {font:var(--rc-text-bodyBase-desktop);}

    /* svelte-ignore css-unused-selector */.rcb-typography-body-small.svelte-byrjto {font:var(--rc-text-bodySmall-desktop);}

    /* svelte-ignore css-unused-selector */.rcb-typography-label-button.svelte-byrjto {font:var(--rc-text-labelButton-desktop);}

    /* svelte-ignore css-unused-selector */.rcb-typography-label-default.svelte-byrjto {font:var(--rc-text-labelDefault-desktop);}

    /* svelte-ignore css-unused-selector */.rcb-typography-caption-default.svelte-byrjto {font:var(--rc-text-captionDefault-desktop);}

    /* svelte-ignore css-unused-selector */.rcb-typography-caption-link.svelte-byrjto {font:var(--rc-text-captionLink-desktop);}
  }`};function KX(t,e){Wt(e,!0),zt(t,WX);const r=It(e,"size",3,"body-base");var n=GX(),a=Le(n);Dn(a,()=>e.children??Ar),mt(()=>Ql(n,`rcb-typography rcb-typography-${r()??""} svelte-byrjto`)),ke(t,n),Kt()}const YX={outerPadding:{mobile:"clamp(1.3125rem, 5.6vw, 1.5rem)",desktop:"clamp(1.5rem, 9.44vw, 5rem)"},outerPaddingSmall:{mobile:"clamp(0.75rem, 4.2vw, 1rem)",desktop:"clamp(1.5rem, 9.44vw, 5rem)"},gapSmall:{mobile:"0.25rem",desktop:"0.375rem"},gapMedium:{mobile:"0.5rem",desktop:"0.75rem"},gapLarge:{mobile:"0.75rem",desktop:"0.75rem"},gapXLarge:{mobile:"1rem",desktop:"1.5rem"},gapXXLarge:{mobile:"1.25rem",desktop:"2.25rem"},gapXXXLarge:{mobile:"2.25rem",desktop:"4.5rem"},inputHeight:{mobile:"3rem",desktop:"3rem"},gapStripeElement:{mobile:"0.70rem",desktop:"1rem"}},VO="-apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif",bo={regular:"400",medium:"500",semibold:"600"},is={12:"12px",14:"14px",16:"16px",18:"18px",24:"24px",28:"28px",32:"32px",36:"36px"},ko={120:"120%",130:"130%",140:"140%"},wo={tight:"0.20%",regular:"0"},Gn={heading2xl:{fontSize:is[28],lineHeight:ko[120],fontWeight:bo.semibold,letterSpacing:wo.tight},headingXl:{fontSize:is[24],lineHeight:ko[130],fontWeight:bo.semibold,letterSpacing:wo.regular},headingLg:{fontSize:"20px",lineHeight:ko[130],fontWeight:bo.semibold,letterSpacing:wo.regular},headingMd:{fontSize:"16px",lineHeight:ko[140],fontWeight:bo.medium,letterSpacing:wo.regular},bodyBase:{fontSize:is[16],lineHeight:ko[140],fontWeight:bo.regular,letterSpacing:wo.regular},bodySmall:{fontSize:is[14],lineHeight:ko[140],fontWeight:bo.regular,letterSpacing:wo.regular},labelButton:{fontSize:is[16],lineHeight:ko[140],fontWeight:bo.regular,letterSpacing:wo.tight},labelDefault:{fontSize:is[14],lineHeight:ko[140],fontWeight:bo.regular,letterSpacing:wo.tight},captionDefault:{fontSize:is[12],lineHeight:ko[140],fontWeight:bo.regular,letterSpacing:wo.regular},captionLink:{fontSize:is[12],lineHeight:ko[140],fontWeight:bo.regular,letterSpacing:wo.regular}},So={heading2xl:{...Gn.heading2xl,fontSize:is[36]},headingXl:{...Gn.headingXl,fontSize:is[32]},headingLg:{...Gn.headingLg,fontSize:is[24]},headingMd:{...Gn.headingMd,fontSize:is[18]},bodyBase:{...Gn.bodyBase},bodySmall:{...Gn.bodySmall},labelButton:{...Gn.labelButton},labelDefault:{...Gn.labelDefault},captionDefault:{...Gn.captionDefault},captionLink:{...Gn.captionLink}},XX={heading2xl:{mobile:Gn.heading2xl,desktop:So.heading2xl},headingXl:{desktop:So.headingXl,mobile:Gn.headingXl},headingLg:{desktop:So.headingLg,mobile:Gn.headingLg},headingMd:{desktop:So.headingMd,mobile:Gn.headingMd},bodyBase:{desktop:So.bodyBase,mobile:Gn.bodyBase},bodySmall:{desktop:So.bodySmall,mobile:Gn.bodySmall},labelButton:{desktop:So.labelButton,mobile:Gn.labelButton},labelDefault:{desktop:So.labelDefault,mobile:Gn.labelDefault},captionDefault:{desktop:So.captionDefault,mobile:Gn.captionDefault},captionLink:{desktop:So.captionLink,mobile:Gn.captionLink}},JX={error:"#B0171F",warning:"#f4e971",focus:"#1148B8",accent:"#767676",primary:"#576CDB","primary-hover":"rgba(87, 108, 219, .8)","primary-pressed":"rgba(87, 108, 219, .9)","primary-text":"#ffffff",white:"#ffffff","grey-text-dark":"rgba(0,0,0,1)","grey-text-light":"rgba(0,0,0,0.7)","grey-ui-dark":"rgba(0,0,0,0.3)","grey-ui-light":"rgba(0,0,0,0.1)","input-background":"white",background:"white"},QX={error:"#B0171F",warning:"#f4e971",focus:"#1148B8",accent:"#767676",primary:"#576CDB","primary-hover":"rgba(87, 108, 219, .8)","primary-pressed":"rgba(87, 108, 219, .9)","primary-text":"#ffffff",white:"#ffffff","grey-text-dark":"rgba(0,0,0,1)","grey-text-light":"rgba(0,0,0,0.7)","grey-ui-dark":"rgba(0,0,0,0.3)","grey-ui-light":"rgba(0,0,0,0.1)","input-background":"white",background:"#EFF3FA"},bU={error:"color_error",focus:"color_accent",accent:"color_accent",primary:"color_buttons_primary"},ZX={...bU,"input-background":"color_form_bg",background:"color_form_bg"},eJ={...bU,"input-background":"color_product_info_bg",background:"color_product_info_bg"},kU={"input-border-radius":"4px","input-button-border-radius":"8px"},tJ={"input-border-radius":"0px","input-button-border-radius":"0px"},rJ={"input-border-radius":"12px","input-button-border-radius":"9999px"},HO=kU,jm=t=>t.length==7?{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16)}:t.length==4?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null,Jx=({r:t,g:e,b:r,luminanceThreshold:n})=>{const a=i=>(i=i/255,i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4));return .2126*a(t)+.7152*a(e)+.0722*a(r)>n},Qx=.37,nJ=(t,e=Qx)=>{const r=Jx({...t,luminanceThreshold:e})?"0,0,0":"255,255,255";return{"grey-text-dark":`rgb(${r})`,"grey-text-light":`rgba(${r},0.70)`,"grey-ui-dark":`rgba(${r},0.3)`,"grey-ui-light":`rgba(${r},0.1)`}};function aJ(t,e,r){const n=jm(t)||{r:0,g:0,b:0},a=jm(e)||{r:255,g:255,b:255},i=Math.round(a.r*r+n.r*(1-r)),o=Math.round(a.g*r+n.g*(1-r)),c=Math.round(a.b*r+n.b*(1-r));return`#${Hw(i)}${Hw(o)}${Hw(c)}`}function GO(t,e){const r={r:255,g:255,b:255},n=Math.max(0,Math.min(1,e));let a=t,i=jm(t)||r;(isNaN(i.r)||isNaN(i.g)||isNaN(i.b))&&(i=r,a="#FFFFFF");const o=Jx({...i,luminanceThreshold:Qx})?"#000000":"#FFFFFF";return aJ(a,o,n)}function Hw(t){return t.toString(16).padStart(2,"0").toUpperCase()}const iJ=(t,e,r,n=Qx)=>{const a={"grey-text-dark":r["grey-text-dark"],"grey-text-light":r["grey-text-light"],"grey-ui-dark":r["grey-ui-dark"],"grey-ui-light":r["grey-ui-light"],"primary-text":r["primary-text"]};if(t!=null&&t.startsWith("#")){const i=jm(t);i!==null&&Object.assign(a,nJ(i))}if(e!=null&&e.startsWith("#")){const i=jm(e);i!==null&&(a["primary-text"]=Jx({...i,luminanceThreshold:n})?"black":"white")}return a},sJ=t=>({"primary-hover":GO(t,.1),"primary-pressed":GO(t,.15)}),oJ=(t,e)=>t||e,cJ=(t,e,r)=>{const n=Object.entries(t).map(([a,i])=>[a,oJ(r?r[i]:null,e[a])]);return Object.fromEntries(n)},wU=(t,e,r)=>{const n=cJ(t,e,r);return r?{...e,...n,...iJ(n.background,n.primary,e),...sJ(n.primary)}:{...e}},lJ=t=>wU(eJ,QX,t),SU=t=>wU(ZX,JX,t),Zx=t=>{if(!t)return HO;switch(t.shapes){case"rounded":return kU;case"rectangle":return tJ;case"pill":return rJ;default:return HO}},G_=(t="",e)=>e.map(([r,n])=>`--rc-${t}-${r}: ${n}`).join("; "),uJ=t=>{const e=G_("color",Object.entries(lJ(t))),r=G_("shape",Object.entries(Zx(t)));return[e,r].join("; ")},dJ=t=>{const e=G_("color",Object.entries(SU(t))),r=G_("shape",Object.entries(Zx(t)));return[e,r].join("; ")},fJ=(t="",e)=>Object.entries(e).flatMap(([r,{desktop:n,mobile:a}])=>[`--rc-${t}-${r}-desktop: normal normal ${n.fontWeight} ${n.fontSize}/${n.lineHeight} ${VO}`,`--rc-${t}-${r}-mobile: normal normal ${a.fontWeight} ${a.fontSize}/${a.lineHeight} ${VO}`,`--rc-${t}-${r}-desktop-font-size: ${n.fontSize}`,`--rc-${t}-${r}-mobile-font-size: ${a.fontSize}`]).join("; "),pJ=(t="",e)=>Object.entries(e).map(([r,{mobile:n,desktop:a}])=>`--rc-${t}-${r}-mobile: ${n};  --rc-${t}-${r}-desktop: ${a};`).join(" ");let hJ=class{constructor(t){vt(this,"brandingAppearance"),t?this.brandingAppearance=t:this.brandingAppearance=void 0}get shape(){return Zx(this.brandingAppearance)}get formColors(){return SU(this.brandingAppearance)}get formStyleVars(){return dJ(this.brandingAppearance)}get productInfoStyleVars(){return uJ(this.brandingAppearance)}get spacing(){return YX}get textStyles(){return XX}get textStyleVars(){return fJ("text",this.textStyles)}get spacingStyleVars(){return pJ("spacing",this.spacing)}};var mJ=lt('<div class="rcb-processing svelte-2j2b59"></div>');const gJ={hash:"svelte-2j2b59",code:`.rcb-processing.svelte-2j2b59 {width:var(--width, 12px);aspect-ratio:1;border-radius:50%;
    animation: svelte-2j2b59-l5 1.5s infinite linear;}

  @keyframes svelte-2j2b59-l5 {
    0% {
      box-shadow:
        var(--shadow-offset) 0 #fff2,
        calc(-1 * var(--shadow-offset)) 0 #fff2;
      background: #fff2;
    }
    25% {
      box-shadow:
        var(--shadow-offset) 0 #fff2,
        calc(-1 * var(--shadow-offset)) 0 #ffff;
      background: #fff2;
    }
    50% {
      box-shadow:
        var(--shadow-offset) 0 #fff2,
        calc(-1 * var(--shadow-offset)) 0 #fff2;
      background: #ffff;
    }
    75% {
      box-shadow:
        var(--shadow-offset) 0 #ffff,
        calc(-1 * var(--shadow-offset)) 0 #fff2;
      background: #fff2;
    }
    100% {
      box-shadow:
        var(--shadow-offset) 0 #fff2,
        calc(-1 * var(--shadow-offset)) 0 #fff2;
      background: #fff2;
    }
  }`};function yJ(t,e){zt(t,gJ);let r=It(e,"size",8,"medium");const n={small:{width:"8px",offset:"10px"},medium:{width:"12px",offset:"20px"},large:{width:"16px",offset:"30px"}};var a=mJ();mt(()=>Ut(a,"style",`--shadow-offset: ${n[r()].offset??""}; --width: ${n[r()].width??""};`)),ke(t,a)}var vJ=lt("<button><!></button>");const _J={hash:"svelte-td7xvm",code:`button.svelte-td7xvm {border:none;border-radius:var(--rc-shape-input-button-border-radius);cursor:pointer;height:var(--rc-spacing-inputHeight-mobile);color:var(--rc-color-grey-text-dark);background-color:var(--rc-color-grey-ui-dark);display:flex;align-items:center;justify-content:center;-webkit-tap-highlight-color:rgba(0, 0, 0, 0);-webkit-tap-highlight-color:transparent;transition:background-color 0.15s ease-in-out;user-select:none;}

  @container layout-query-container (width >= 768px) {button.svelte-td7xvm {height:var(--rc-spacing-inputHeight-desktop);}
  }

  /* focus-visible is triggered only when focused with keyboard/reader */button.svelte-td7xvm:focus-visible {outline:2px solid var(--rc-color-focus);}button.intent-primary.svelte-td7xvm {background-color:var(--rc-color-primary);color:var(--rc-color-primary-text);}button.svelte-td7xvm:disabled {color:var(--rc-color-grey-text-light);background-color:var(--rc-color-grey-ui-dark);outline:none;}button.intent-primary.svelte-td7xvm:not(:disabled):hover {background-color:var(--rc-color-primary-hover);}button.intent-primary.svelte-td7xvm:not(:disabled):active,
  button.svelte-td7xvm:active {background-color:var(--rc-color-primary-pressed);outline:none;}button.intent-primary.svelte-td7xvm:disabled {color:var(--rc-color-grey-text-light);background-color:var(--rc-color-grey-ui-dark);}`};function EU(t,e){Wt(e,!0),zt(t,_J);const r=It(e,"intent",3,"primary"),n=It(e,"disabled",3,!1),a=It(e,"loading",3,!1),i=ze(()=>new hJ(e.brandingAppearance)),o=ze(()=>$(i).textStyleVars),c=ze(()=>$(i).spacingStyleVars),u=ze(()=>$(i).productInfoStyleVars),d=ze(()=>$(i).formStyleVars),f=ze(()=>[e.styleOverrides,$(o),$(c),$(u),$(d)].join("; "));var h=vJ();h.__click=function(...b){var E;(E=e.onclick)==null||E.apply(this,b)};var m=Le(h);{var _=b=>{yJ(b,{size:"small"})},w=b=>{KX(b,{size:"body-base",children:(E,T)=>{var D=wr(),P=Xt(D);Dn(P,()=>e.children??Ar),ke(E,D)},$$slots:{default:!0}})};xt(m,b=>{a()?b(_):b(w,!1)})}mt(()=>{Ql(h,`${`intent-${r()}`??""} svelte-td7xvm`),h.disabled=n(),Ut(h,"data-testid",e.testId),Ut(h,"type",e.type),Ut(h,"style",$(f))}),ke(t,h),Kt()}Gb(["click"]);var bJ=lt('<footer class="rcb-modal-footer svelte-1f9z0o8"><!></footer>');const kJ={hash:"svelte-1f9z0o8",code:"footer.svelte-1f9z0o8 {display:flex;flex-direction:column;}"};function wJ(t,e){Wt(e,!1),zt(t,kJ);let r=It(e,"children",8);ws();var n=bJ(),a=Le(n);Dn(a,()=>r()??Ar),ke(t,n),Kt()}const SJ={hash:"svelte-1bzqb13",code:".rcb-modal-section.svelte-1bzqb13 {padding:8px 0px;display:flex;}section.rcb-modal-section.svelte-1bzqb13 {flex-grow:1;}.rcb-modal-section.svelte-1bzqb13:last-of-type {padding:0;}"};function EJ(t,e){Wt(e,!1),zt(t,SJ);let r=It(e,"as",8,"section"),n=It(e,"children",8);ws();var a=wr(),i=Xt(a);B_(i,r,!1,(o,c)=>{U_(o,null,{class:"rcb-modal-section"},"svelte-1bzqb13",o.namespaceURI===Dm,o.nodeName.includes("-"));var u=wr(),d=Xt(u);Dn(d,()=>n()??Ar),ke(c,u)}),ke(t,a),Kt()}var TJ=lt("<div><!></div>");const CJ={hash:"svelte-b5dygi",code:`.rcb-column.svelte-b5dygi {display:flex;flex-direction:column;justify-content:flex-start;flex-grow:1;min-width:100%;}.rcb-column.align-center.svelte-b5dygi {justify-content:center;}.rcb-column.align-end.svelte-b5dygi {justify-content:flex-end;}.rcb-column.gap-small.svelte-b5dygi {gap:var(--rc-spacing-gapSmall-mobile);}.rcb-column.gap-medium.svelte-b5dygi {gap:var(--rc-spacing-gapXLarge-mobile);}.rcb-column.gap-large.svelte-b5dygi {gap:var(--rc-spacing-gapXXLarge-mobile);}

  @container layout-query-container (width >= 768px) {.rcb-column.gap-small.svelte-b5dygi {gap:var(--rc-spacing-gapSmall-desktop);}.rcb-column.gap-medium.svelte-b5dygi {gap:var(--rc-spacing-gapLarge-desktop);}.rcb-column.gap-large.svelte-b5dygi {gap:var(--rc-spacing-gapXXLarge-desktop);}
  }`};function TU(t,e){Wt(e,!1),zt(t,CJ);let r=It(e,"gap",8,"small"),n=It(e,"align",8,"start"),a=It(e,"children",8);ws();var i=TJ(),o=Le(i);Dn(o,()=>a()??Ar),mt(()=>Ql(i,`rcb-column gap-${r()??""} align-${n()??""} svelte-b5dygi`)),ke(t,i),Kt()}var xJ=lt('<div class="rcb-row svelte-1seeuxq"><!></div>');const PJ={hash:"svelte-1seeuxq",code:".rcb-row.svelte-1seeuxq {display:flex;flex-direction:row;justify-content:flex-start;}"};function AJ(t,e){Wt(e,!1),zt(t,PJ);let r=It(e,"children",8);ws();var n=xJ(),a=Le(n);Dn(a,()=>r()??Ar),ke(t,n),Kt()}var RJ=lt("<span><!></span>");const DJ={hash:"svelte-orw2sj",code:`.rcb-typography.svelte-orw2sj {display:inline-block;line-height:normal;}

  /* svelte-ignore css-unused-selector */.rcb-typography-heading-2xl.svelte-orw2sj {font:var(--rc-text-heading2xl-mobile);}.rcb-typography-heading-2xl.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-heading2xl-branded-mobile);}

  /* svelte-ignore css-unused-selector */.rcb-typography-heading-xl.svelte-orw2sj {font:var(--rc-text-headingXl-mobile);}.rcb-typography-heading-xl.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-headingXl-branded-mobile);}

  /* svelte-ignore css-unused-selector */.rcb-typography-heading-lg.svelte-orw2sj {font:var(--rc-text-headingLg-mobile);}.rcb-typography-heading-lg.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-headingLg-branded-mobile);}

  /* svelte-ignore css-unused-selector */.rcb-typography-heading-md.svelte-orw2sj {font:var(--rc-text-headingMd-mobile);}.rcb-typography-heading-md.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-headingMd-branded-mobile);}

  /* svelte-ignore css-unused-selector */.rcb-typography-body-base.svelte-orw2sj {font:var(--rc-text-bodyBase-mobile);}.rcb-typography-body-base.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-bodyBase-branded-mobile);}

  /* svelte-ignore css-unused-selector */.rcb-typography-body-small.svelte-orw2sj {font:var(--rc-text-bodySmall-mobile);}.rcb-typography-body-small.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-bodySmall-branded-mobile);}

  /* svelte-ignore css-unused-selector */.rcb-typography-label-button.svelte-orw2sj {font:var(--rc-text-labelButton-mobile);}.rcb-typography-label-button.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-labelButton-branded-mobile);}

  /* svelte-ignore css-unused-selector */.rcb-typography-label-default.svelte-orw2sj {font:var(--rc-text-labelDefault-mobile);}.rcb-typography-label-default.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-labelDefault-branded-mobile);}

  /* svelte-ignore css-unused-selector */.rcb-typography-caption-default.svelte-orw2sj {font:var(--rc-text-captionDefault-mobile);}.rcb-typography-caption-default.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-captionDefault-branded-mobile);}

  /* svelte-ignore css-unused-selector */.rcb-typography-caption-link.svelte-orw2sj {font:var(--rc-text-captionLink-mobile);}.rcb-typography-caption-link.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-captionLink-branded-mobile);}

  @container layout-query-container (width >= 768px) {span.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-brandedText-font-style-desktop);}

    /* svelte-ignore css-unused-selector */.rcb-typography-heading-2xl.svelte-orw2sj {font:var(--rc-text-heading2xl-desktop);}.rcb-typography-heading-2xl.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-heading2xl-branded-desktop);}

    /* svelte-ignore css-unused-selector */.rcb-typography-heading-xl.svelte-orw2sj {font:var(--rc-text-headingXl-desktop);}.rcb-typography-heading-xl.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-headingXl-branded-desktop);}

    /* svelte-ignore css-unused-selector */.rcb-typography-heading-lg.svelte-orw2sj {font:var(--rc-text-headingLg-desktop);}.rcb-typography-heading-lg.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-headingLg-branded-desktop);}

    /* svelte-ignore css-unused-selector */.rcb-typography-heading-md.svelte-orw2sj {font:var(--rc-text-headingMd-desktop);}.rcb-typography-heading-md.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-headingMd-branded-desktop);}

    /* svelte-ignore css-unused-selector */.rcb-typography-body-base.svelte-orw2sj {font:var(--rc-text-bodyBase-desktop);}.rcb-typography-body-base.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-bodyBase-branded-desktop);}

    /* svelte-ignore css-unused-selector */.rcb-typography-body-small.svelte-orw2sj {font:var(--rc-text-bodySmall-desktop);}.rcb-typography-body-small.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-bodySmall-branded-desktop);}

    /* svelte-ignore css-unused-selector */.rcb-typography-label-button.svelte-orw2sj {font:var(--rc-text-labelButton-desktop);}.rcb-typography-label-button.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-labelButton-branded-desktop);}

    /* svelte-ignore css-unused-selector */.rcb-typography-label-default.svelte-orw2sj {font:var(--rc-text-labelDefault-desktop);}.rcb-typography-label-default.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-labelDefault-branded-desktop);}

    /* svelte-ignore css-unused-selector */.rcb-typography-caption-default.svelte-orw2sj {font:var(--rc-text-captionDefault-desktop);}.rcb-typography-caption-default.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-captionDefault-branded-desktop);}

    /* svelte-ignore css-unused-selector */.rcb-typography-caption-link.svelte-orw2sj {font:var(--rc-text-captionLink-desktop);}.rcb-typography-caption-link.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-captionLink-branded-desktop);}
  }`};function Pr(t,e){Wt(e,!0),zt(t,DJ);const r=It(e,"size",3,"body-base"),n=It(e,"branded",3,!1);var a=RJ(),i=Le(a);Dn(i,()=>e.children??Ar),mt(()=>Ql(a,`rcb-typography rcb-typography-${r()??""} ${(n()?"rcb-typography-branded":"")??""} svelte-orw2sj`)),ke(t,a),Kt()}var OJ=lt("<div><!></div>"),NJ=lt('<span style="display: block;"><!></span>'),IJ=lt("<!> <!>",1),MJ=lt("<!> <!>",1),jJ=lt('<div class="rcb-modal-message svelte-w46z5s" data-type="error"><!></div>');const LJ={hash:"svelte-w46z5s",code:`.rcb-modal-message-icon.svelte-w46z5s {flex-shrink:0;align-self:center;margin-right:16px;}.rcb-modal-message.svelte-w46z5s {width:100%;min-height:160px;display:flex;justify-content:center;align-items:center;flex-direction:column;text-align:left;margin-top:4px;}.rcb-modal-message[data-has-title="false"].svelte-w46z5s {margin-top:var(--rc-spacing-gapXXLarge-mobile);}.rcb-modal-message-icon.small.svelte-w46z5s {height:var(--rc-text-headingLg-mobile-font-size);width:var(--rc-text-headingLg-mobile-font-size);}.rcb-modal-message-icon.large.svelte-w46z5s {height:calc(2 * var(--rc-text-headingMd-mobile-font-size));width:calc(2 * var(--rc-text-headingMd-mobile-font-size));}

  @container layout-query-container (width >= 768px) {.rcb-modal-message-icon.small.svelte-w46z5s {height:var(--rc-text-headingLg-desktop-font-size);width:var(--rc-text-headingLg-desktop-font-size);}.rcb-modal-message-icon.large.svelte-w46z5s {height:calc(2 * var(--rc-text-headingMd-desktop-font-size));width:calc(2 * var(--rc-text-headingMd-desktop-font-size));}.rcb-modal-message[data-has-title="false"].svelte-w46z5s {margin-top:var(--rc-spacing-gapXXLarge-desktop);}
  }`};function BJ(t,e){Wt(e,!0),zt(t,LJ);const r=It(e,"title",3,null),n=It(e,"icon",3,null),a=32;let i=sr(null),o=sr(!1),c;_s(()=>($(i)&&(c=new ResizeObserver(()=>{var f;pt(o,(((f=$(i))==null?void 0:f.offsetHeight)??0)>a)}),c.observe($(i))),()=>{c?.disconnect()}));var u=jJ(),d=Le(u);TU(d,{gap:"medium",align:"start",children:(f,h)=>{var m=MJ(),_=Xt(m);AJ(_,{children:(E,T)=>{var D=IJ(),P=Xt(D);{var A=I=>{var x=OJ(),R=Le(x);Dn(R,n),mt(()=>Ql(x,`rcb-modal-message-icon ${$(o)?"large":"small"} svelte-w46z5s`)),ke(I,x)};xt(P,I=>{n()&&I(A)})}var C=kt(P,2);{var O=I=>{var x=NJ(),R=Le(x);Pr(R,{size:"heading-md",children:(N,L)=>{var j=Ur();mt(()=>hr(j,r())),ke(N,j)},$$slots:{default:!0}}),tU(x,N=>pt(i,N),()=>$(i)),ke(I,x)};xt(C,I=>{r()&&I(O)})}ke(E,D)},$$slots:{default:!0}});var w=kt(_,2);{var b=E=>{Pr(E,{size:"body-small",children:(T,D)=>{var P=wr(),A=Xt(P);Dn(A,()=>e.message??Ar),ke(T,P)},$$slots:{default:!0}})};xt(w,E=>{e.message&&E(b)})}ke(f,m)},$$slots:{default:!0}}),mt(()=>Ut(u,"data-has-title",!!r())),ke(t,u),Kt()}var UJ=lt('<div class="rcb-modal-message-icon svelte-c8cuu5"><!></div>'),FJ=lt("<!> <!>",1),qJ=lt('<div class="rcb-modal-message svelte-c8cuu5" data-type="success"><!></div>');const zJ={hash:"svelte-c8cuu5",code:`.rcb-modal-message-icon.svelte-c8cuu5 {height:54px;width:54px;margin:0 auto;}.rcb-modal-message[data-has-title="false"].svelte-c8cuu5 {margin-top:var(--rc-spacing-gapXXLarge-mobile);}.rcb-modal-message.svelte-c8cuu5 {width:100%;min-height:160px;display:flex;justify-content:center;align-items:center;flex-direction:column;text-align:center;}

  @container layout-query-container (width >= 768px) {.rcb-modal-message[data-has-title="false"].svelte-c8cuu5 {margin-top:var(--rc-spacing-gapXXLarge-desktop);}
  }`};function $J(t,e){Wt(e,!0),zt(t,zJ);const r=It(e,"title",3,null),n=It(e,"icon",3,null);var a=qJ(),i=Le(a);TU(i,{gap:"large",align:"center",children:(o,c)=>{var u=FJ(),d=Xt(u);{var f=_=>{var w=UJ(),b=Le(w);Dn(b,n),ke(_,w)};xt(d,_=>{n()&&_(f)})}var h=kt(d,2);{var m=_=>{Pr(_,{size:"heading-md",children:(w,b)=>{var E=Ur();mt(()=>hr(E,r())),ke(w,E)},$$slots:{default:!0}})};xt(h,_=>{r()&&_(m)})}ke(o,u)},$$slots:{default:!0}}),mt(()=>Ut(a,"data-has-title",!!r())),ke(t,a),Kt()}const eP="rcb-ui-events-tracker",tP="branding";var VJ=lt('<div class="message-layout svelte-qavr33"><div class="message-layout-content svelte-qavr33"><!></div> <div class="message-layout-footer"><!></div></div>');const HJ={hash:"svelte-qavr33",code:`.message-layout.svelte-qavr33 {display:flex;flex-direction:column;}.message-layout-content.svelte-qavr33 {flex-grow:1;display:flex;flex-direction:column;justify-content:center;}

  @container layout-query-container (width < 768px) {.message-layout.svelte-qavr33 {flex-grow:1;gap:var(--rc-spacing-gapXXLarge-mobile);}
  }

  @container layout-query-container (width >= 768px) {.message-layout.svelte-qavr33 {min-height:354px;gap:var(--rc-spacing-gapXXLarge-desktop);}.message-layout-content.svelte-qavr33 {justify-content:flex-start;flex-grow:1;}
  }`};function rP(t,e){Wt(e,!0),zt(t,HJ);let r=It(e,"title",3,null),n=It(e,"closeButtonTitle",3,"Go back to app"),a=It(e,"icon",3,null),i=It(e,"message",3,null);const o=Jn(tP);function c(){e.onDismiss()}var u=VJ(),d=Le(u),f=Le(d);EJ(f,{children:(_,w)=>{var b=wr(),E=Xt(b);{var T=P=>{$J(P,{get title(){return r()},get icon(){return a()}})},D=P=>{BJ(P,{get title(){return r()},get icon(){return a()},get message(){return i()}})};xt(E,P=>{e.type==="success"?P(T):P(D,!1)})}ke(_,b)},$$slots:{default:!0}});var h=kt(d,2),m=Le(h);wJ(m,{children:(_,w)=>{EU(_,{onclick:c,type:"submit",brandingAppearance:o,children:(b,E)=>{var T=Ur();mt(()=>hr(T,n())),ke(b,T)},$$slots:{default:!0}})},$$slots:{default:!0}}),ke(t,u),Kt()}function si(t,e){Wt(e,!0);const r=Aa(),n=()=>ha(i,"$translator",r),a=It(e,"key",3,""),i=Jn(Bi),o=ze(()=>a()?n().translate(a()||"",e.variables):void 0);var c=wr(),u=Xt(c);{var d=h=>{var m=Ur();mt(()=>hr(m,$(o))),ke(h,m)},f=h=>{var m=wr(),_=Xt(m);Dn(_,()=>e.children??Ar),ke(h,m)};xt(u,h=>{$(o)?h(d):h(f,!1)})}ke(t,c),Kt()}var GJ=lt('<p class="footer-caption svelte-1hbk6xu"><!></p>'),WJ=lt('<p class="footer-caption svelte-1hbk6xu"><!></p>'),KJ=lt('<div class="footer-caption-container svelte-1hbk6xu"><!> <!> <p class="footer-caption svelte-1hbk6xu"><!></p></div>');const YJ={hash:"svelte-1hbk6xu",code:`.footer-caption-container.svelte-1hbk6xu {display:flex;flex-direction:column;gap:var(--rc-spacing-gapLarge-mobile);}.footer-caption.svelte-1hbk6xu {color:var(--rc-color-grey-text-light);text-align:center;margin:0;}

  @container layout-query-container (width >= 768px) {.footer-caption-container.svelte-1hbk6xu {gap:var(--rc-spacing-gapLarge-desktop);}
  }`};function XJ(t,e){Wt(e,!1),zt(t,YJ);const r=Aa(),n=()=>ha(E,"$translator",r),a=Ls(),i=Ls(),o=Ls(),c=Ls(),u=Ls(),d=Ls(),f=Ls(),h=Ls(),m=Ls(),_=Ls();let w=It(e,"brandingInfo",8,null),b=It(e,"purchaseOption",8,null);const E=Jn(Bi);function T(L){return L!=null&&"base"in L}function D(L){return L!=null&&"basePrice"in L}function P(L){return L?L.trial?Ot.PaymentEntryPageTrialSubscriptionTermsInfo:Ot.PaymentEntryPageSubscriptionTermsInfo:Ot.PaymentEntryPageOtpTermsInfo}_o(()=>Wv(b()),()=>{pt(a,T(b())?b():null)}),_o(()=>Wv(b()),()=>{pt(i,D(b())?b():null)}),_o(()=>$(a),()=>{pt(o,P($(a)))}),_o(()=>$(a),()=>{var L,j;pt(c,((L=$(a))==null?void 0:L.introPrice)||((j=$(a))==null?void 0:j.base))}),_o(()=>($(i),$(c)),()=>{var L,j;pt(u,((L=$(i))==null?void 0:L.basePrice)||((j=$(c))==null?void 0:j.price))}),_o(()=>($(u),n()),()=>{pt(d,$(u)?zl($(u).amountMicros,$(u).currency,n().locale||n().fallbackLocale):null)}),_o(()=>($(c),n()),()=>{var L,j,q,U,W;pt(f,(L=$(c))!=null&&L.period?n().translatePeriodFrequency(((q=(j=$(c))==null?void 0:j.period)==null?void 0:q.number)||1,(W=(U=$(c))==null?void 0:U.period)==null?void 0:W.unit,{useMultipleWords:!0}):null)}),_o(()=>($(a),n(),xT),()=>{var L,j;pt(h,(j=(L=$(a))==null?void 0:L.trial)!=null&&j.period?n().translateDate(xT(new Date,$(a).trial.period,!0),{year:"numeric",month:"long",day:"numeric"}):null)}),_o(()=>(Wv(w()),$(u),n(),$(o),$(d),$(f),$(h)),()=>{var L;pt(m,w()&&$(u)?n().translate($(o),{appName:(L=w())==null?void 0:L.app_name,price:$(d),perFrequency:$(f),renewalDate:$(h)}):null)}),_o(()=>($(a),n(),Ot),()=>{pt(_,$(a)?n().translate(Ot.PaymentEntryPageSubscriptionInfo):null)}),rK(),ws();var A=KJ(),C=Le(A);{var O=L=>{var j=GJ(),q=Le(j);Pr(q,{size:"caption-default",children:(U,W)=>{var F=Ur();mt(()=>hr(F,$(m))),ke(U,F)},$$slots:{default:!0}}),ke(L,j)};xt(C,L=>{$(m)&&L(O)})}var I=kt(C,2);{var x=L=>{var j=WJ(),q=Le(j);Pr(q,{size:"caption-default",children:(U,W)=>{var F=Ur();mt(()=>hr(F,$(_))),ke(U,F)},$$slots:{default:!0}}),ke(L,j)};xt(I,L=>{$(_)&&L(x)})}var R=kt(I,2),N=Le(R);Pr(N,{size:"caption-default",children:(L,j)=>{si(L,{get key(){return Ot.PaymentEntryPagePaymentStepTitle}})},$$slots:{default:!0}}),ke(t,A),Kt()}var gi=(t=>(t.SDKInitialized="sdk_initialized",t.CheckoutSessionStart="checkout_session_start",t.CheckoutSessionEnd="checkout_session_end",t.CheckoutFlowError="checkout_flow_error",t.CheckoutPaymentTaxCalculation="checkout_payment_tax_calculation",t.CheckoutPaymentFormImpression="checkout_payment_form_impression",t.CheckoutPaymentFormError="checkout_payment_form_error",t.CheckoutPaymentFormDismiss="checkout_payment_form_dismiss",t.CheckoutPaymentFormSubmit="checkout_payment_form_submit",t.CheckoutPaymentFormGatewayError="checkout_payment_form_gateway_error",t.CheckoutPurchaseSuccessfulImpression="checkout_purchase_successful_impression",t.CheckoutPurchaseSuccessfulDismiss="checkout_purchase_successful_dismiss",t))(gi||{}),nP=(t=>(t.tax_collection_disabled="tax_collection_disabled",t.invalid_tax_location="invalid_tax_location",t.rate_limit_exceeded="rate_limit_exceeded",t.missing_required_permission="missing_required_permission",t.invalid_origin_address="invalid_origin_address",t.taxes_not_active="taxes_not_active",t.unexpected_gateway_error="unexpected_gateway_error",t))(nP||{});function JJ({errorCode:t,errorMessage:e}){return{eventName:gi.CheckoutFlowError,properties:{errorCode:t,errorMessage:e}}}function QJ({errorCode:t,errorMessage:e}){return{eventName:gi.CheckoutPaymentFormError,properties:{errorCode:t,errorMessage:e}}}function ZJ({appearance:t,rcPackage:e,purchaseOptionToUse:r,customerEmail:n}){return{eventName:gi.CheckoutSessionStart,properties:{customizationColorButtonsPrimary:t?.color_buttons_primary??null,customizationColorAccent:t?.color_accent??null,customizationColorError:t?.color_error??null,customizationColorProductInfoBg:t?.color_product_info_bg??null,customizationColorFormBg:t?.color_form_bg??null,customizationColorPageBg:t?.color_page_bg??null,customizationFont:t?.font??null,customizationShapes:t?.shapes??null,customizationShowProductDescription:t?.show_product_description??null,productInterval:e.webBillingProduct.normalPeriodDuration,productPrice:e.webBillingProduct.price.amountMicros,productCurrency:e.webBillingProduct.price.currency,selectedProductId:e.webBillingProduct.identifier,selectedPackageId:e.identifier,selectedPurchaseOption:r.id,customerEmailProvidedByDeveloper:!!n}}}function eQ({redemptionInfo:t}){return{eventName:gi.CheckoutSessionEnd,properties:{outcome:"finished",withRedemptionInfo:!!t}}}function tQ(){return{eventName:gi.CheckoutSessionEnd,properties:{outcome:"closed"}}}function rQ({errorCode:t,errorMessage:e}){return{eventName:gi.CheckoutSessionEnd,properties:{outcome:"errored",errorCode:t,errorMessage:e}}}function nQ({taxCalculation:t,taxCustomerDetails:e}){const r=t.failed_reason===nP.tax_collection_disabled?"disabled":t.failed_reason?"failed":t.tax_amount_in_micros===0?"not-taxed":"taxed",n=e===null?"auto":"form";return{eventName:gi.CheckoutPaymentTaxCalculation,properties:{outcome:r,ui_element:n,tax_inclusive:t.tax_inclusive,error_code:t.failed_reason??null}}}function aQ({selectedPaymentMethod:t}){return{eventName:gi.CheckoutPaymentFormSubmit,properties:{selectedPaymentMethod:t??null}}}function iQ({errorCode:t,errorMessage:e}){return{eventName:gi.CheckoutPaymentFormGatewayError,properties:{errorCode:t,errorMessage:e}}}const sQ=`<svg width="80" height="80" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
  <g transform="scale(0.5)" transform-origin="center">
  <path d="M12 3.5C7.30558 3.5 3.5 7.30558 3.5 12C3.5 16.6944 7.30558 20.5 12 20.5C16.6944 20.5 20.5 16.6944 20.5 12C20.5 11.5858 20.8358 11.25 21.25 11.25C21.6642 11.25 22 11.5858 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C12.4142 2 12.75 2.33579 12.75 2.75C12.75 3.16421 12.4142 3.5 12 3.5Z" fill="currentColor"/>
  </g>
</svg>`;var oQ=lt('<div style="color:var(--rc-color-accent);" class="rcb-ui-asset-icon svelte-1sxpw7o"><!></div>');const cQ={hash:"svelte-1sxpw7o",code:`
  @-webkit-keyframes svelte-1sxpw7o-rotating /* Safari and Chrome */ {
    from {
      -webkit-transform: rotate(0deg);
      -o-transform: rotate(0deg);
      transform: rotate(0deg);
    }
    to {
      -webkit-transform: rotate(360deg);
      -o-transform: rotate(360deg);
      transform: rotate(360deg);
    }
  }
  @keyframes svelte-1sxpw7o-rotating {
    from {
      -ms-transform: rotate(0deg);
      -moz-transform: rotate(0deg);
      -webkit-transform: rotate(0deg);
      -o-transform: rotate(0deg);
      transform: rotate(0deg);
    }
    to {
      -ms-transform: rotate(360deg);
      -moz-transform: rotate(360deg);
      -webkit-transform: rotate(360deg);
      -o-transform: rotate(360deg);
      transform: rotate(360deg);
    }
  }div.svelte-1sxpw7o {width:80px;height:80px;
    -webkit-animation: svelte-1sxpw7o-rotating 2s ease-in-out infinite;
    -moz-animation: svelte-1sxpw7o-rotating 2s ease-in-out infinite;
    -ms-animation: svelte-1sxpw7o-rotating 2s ease-in-out infinite;
    -o-animation: svelte-1sxpw7o-rotating 2s ease-in-out infinite;
    animation: svelte-1sxpw7o-rotating 2s ease-in-out infinite;}`};function lQ(t){zt(t,cQ);var e=oQ(),r=Le(e);fu(r,()=>sQ),ke(t,e)}var uQ=lt('<div class="rcb-modal-loader svelte-102edf4"><!></div>');const dQ={hash:"svelte-102edf4",code:`.rcb-modal-loader.svelte-102edf4 {width:100%;flex-grow:1;display:flex;justify-content:center;align-items:center;}

  @container layout-query-container (width >= 768px) {.rcb-modal-loader.svelte-102edf4 {align-items:flex-start;margin-top:calc(var(--rc-spacing-gapXXLarge-desktop) * 6);}
  }`};function CU(t){zt(t,dQ);var e=uQ(),r=Le(e);lQ(r),ke(t,e)}function fQ(t,e){var r,n;Wt(e,!0);const a=Aa(),i=()=>ha(o,"$translator",a),o=Jn(Bi),c=Jn(tP),u=ze(()=>e.priceBreakdown?i().formatPrice(e.priceBreakdown.totalAmountInMicros,e.priceBreakdown.currency):null),d=(n=(r=e.subscriptionOption)==null?void 0:r.trial)==null?void 0:n.period,f=ze(()=>d?i().translatePeriod(d.number,d.unit):null);EU(t,{get disabled(){return e.disabled},testId:"PayButton",brandingAppearance:c,children:(h,m)=>{var _=wr(),w=Xt(_);{var b=T=>{var D=ze(()=>({trialPeriodLabel:$(f)}));si(T,{get key(){return Ot.PaymentEntryPageButtonStartTrial},get variables(){return $(D)}})},E=T=>{var D=wr(),P=Xt(D);{var A=O=>{var I=ze(()=>({formattedPrice:$(u)}));si(O,{get key(){return Ot.PaymentEntryPageButtonWithPrice},get variables(){return $(I)}})},C=O=>{si(O,{get key(){return Ot.PaymentEntryPageButtonPay}})};xt(P,O=>{$(u)?O(A):O(C,!1)},!0)}ke(T,D)};xt(w,T=>{var D;(D=e.subscriptionOption)!=null&&D.trial?T(b):T(E,!1)})}ke(h,_)},$$slots:{default:!0}}),Kt()}const pQ={error:"#B0171F",warning:"#f4e971",focus:"#1148B8",accent:"#767676",primary:"#576CDB","primary-hover":"rgba(87, 108, 219, .8)","primary-pressed":"rgba(87, 108, 219, .9)","primary-text":"#ffffff",white:"#ffffff","grey-text-dark":"rgba(0,0,0,1)","grey-text-light":"rgba(0,0,0,0.7)","grey-ui-dark":"rgba(0,0,0,0.3)","grey-ui-light":"rgba(0,0,0,0.1)","input-background":"white",background:"white"},hQ={error:"#B0171F",warning:"#f4e971",focus:"#1148B8",accent:"#767676",primary:"#576CDB","primary-hover":"rgba(87, 108, 219, .8)","primary-pressed":"rgba(87, 108, 219, .9)","primary-text":"#ffffff",white:"#ffffff","grey-text-dark":"rgba(0,0,0,1)","grey-text-light":"rgba(0,0,0,0.7)","grey-ui-dark":"rgba(0,0,0,0.3)","grey-ui-light":"rgba(0,0,0,0.1)","input-background":"white",background:"#EFF3FA"},xU={error:"color_error",focus:"color_accent",accent:"color_accent",primary:"color_buttons_primary"},mQ={...xU,"input-background":"color_form_bg",background:"color_form_bg"},gQ={...xU,"input-background":"color_product_info_bg",background:"color_product_info_bg"},PU={"input-border-radius":"4px","input-button-border-radius":"8px"},yQ={"input-border-radius":"0px","input-button-border-radius":"0px"},vQ={"input-border-radius":"12px","input-button-border-radius":"9999px"},WO=PU,W_="-apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif",AU="BrandCustomFont",KO=`${AU}, ${W_}`,Eo={regular:"400",medium:"500",semibold:"600"},ss={12:"12px",14:"14px",16:"16px",18:"18px",24:"24px",28:"28px",32:"32px",36:"36px"},To={130:"130%",140:"140%"},Co={tight:"0.20%",regular:"0",loose:"0.20%"},Wn={heading2xl:{fontSize:ss[28],lineHeight:To[130],fontWeight:Eo.semibold,letterSpacing:Co.loose},headingXl:{fontSize:ss[24],lineHeight:To[130],fontWeight:Eo.semibold,letterSpacing:Co.loose},headingLg:{fontSize:"20px",lineHeight:To[130],fontWeight:Eo.semibold,letterSpacing:Co.loose},headingMd:{fontSize:"16px",lineHeight:To[140],fontWeight:Eo.medium,letterSpacing:Co.regular},bodyBase:{fontSize:ss[16],lineHeight:To[140],fontWeight:Eo.regular,letterSpacing:Co.regular},bodySmall:{fontSize:ss[14],lineHeight:To[140],fontWeight:Eo.regular,letterSpacing:Co.regular},labelButton:{fontSize:ss[16],lineHeight:To[140],fontWeight:Eo.semibold,letterSpacing:Co.tight},labelDefault:{fontSize:ss[14],lineHeight:To[140],fontWeight:Eo.regular,letterSpacing:Co.tight},captionDefault:{fontSize:ss[12],lineHeight:To[140],fontWeight:Eo.regular,letterSpacing:Co.regular},captionLink:{fontSize:ss[12],lineHeight:To[140],fontWeight:Eo.regular,letterSpacing:Co.regular}},xo={heading2xl:{...Wn.heading2xl,fontSize:ss[36]},headingXl:{...Wn.headingXl,fontSize:ss[32]},headingLg:{...Wn.headingLg,fontSize:ss[24]},headingMd:{...Wn.headingMd,fontSize:ss[18]},bodyBase:{...Wn.bodyBase},bodySmall:{...Wn.bodySmall},labelButton:{...Wn.labelButton},labelDefault:{...Wn.labelDefault},captionDefault:{...Wn.captionDefault},captionLink:{...Wn.captionLink}},NT={heading2xl:{mobile:Wn.heading2xl,desktop:xo.heading2xl},headingXl:{desktop:xo.headingXl,mobile:Wn.headingXl},headingLg:{desktop:xo.headingLg,mobile:Wn.headingLg},headingMd:{desktop:xo.headingMd,mobile:Wn.headingMd},bodyBase:{desktop:xo.bodyBase,mobile:Wn.bodyBase},bodySmall:{desktop:xo.bodySmall,mobile:Wn.bodySmall},labelButton:{desktop:xo.labelButton,mobile:Wn.labelButton},labelDefault:{desktop:xo.labelDefault,mobile:Wn.labelDefault},captionDefault:{desktop:xo.captionDefault,mobile:Wn.captionDefault},captionLink:{desktop:xo.captionLink,mobile:Wn.captionLink}},Lm=t=>t.length==7?{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16)}:t.length==4?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null,aP=({r:t,g:e,b:r,luminanceThreshold:n})=>{const a=i=>(i=i/255,i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4));return .2126*a(t)+.7152*a(e)+.0722*a(r)>n},iP=.37,_Q=(t,e=iP)=>{const r=aP({...t,luminanceThreshold:e})?"0,0,0":"255,255,255";return{"grey-text-dark":`rgb(${r})`,"grey-text-light":`rgba(${r},0.70)`,"grey-ui-dark":`rgba(${r},0.3)`,"grey-ui-light":`rgba(${r},0.1)`}};function bQ(t,e,r){const n=Lm(t)||{r:0,g:0,b:0},a=Lm(e)||{r:255,g:255,b:255},i=Math.round(a.r*r+n.r*(1-r)),o=Math.round(a.g*r+n.g*(1-r)),c=Math.round(a.b*r+n.b*(1-r));return`#${Gw(i)}${Gw(o)}${Gw(c)}`}function YO(t,e){const r={r:255,g:255,b:255},n=Math.max(0,Math.min(1,e));let a=t,i=Lm(t)||r;(isNaN(i.r)||isNaN(i.g)||isNaN(i.b))&&(i=r,a="#FFFFFF");const o=aP({...i,luminanceThreshold:iP})?"#000000":"#FFFFFF";return bQ(a,o,n)}function Gw(t){return t.toString(16).padStart(2,"0").toUpperCase()}const kQ=(t,e,r,n=iP)=>{const a={"grey-text-dark":r["grey-text-dark"],"grey-text-light":r["grey-text-light"],"grey-ui-dark":r["grey-ui-dark"],"grey-ui-light":r["grey-ui-light"],"primary-text":r["primary-text"]};if(t!=null&&t.startsWith("#")){const i=Lm(t);i!==null&&Object.assign(a,_Q(i))}if(e!=null&&e.startsWith("#")){const i=Lm(e);i!==null&&(a["primary-text"]=aP({...i,luminanceThreshold:n})?"black":"white")}return a},wQ=t=>({"primary-hover":YO(t,.1),"primary-pressed":YO(t,.15)}),SQ=(t,e)=>t||e,EQ=(t,e,r)=>{const n=Object.entries(t).map(([a,i])=>[a,SQ(r?r[i]:null,e[a])]);return Object.fromEntries(n)},RU=(t,e,r)=>{const n=EQ(t,e,r);return r?{...e,...n,...kQ(n.background,n.primary,e),...wQ(n.primary)}:{...e}},TQ=t=>RU(gQ,hQ,t),DU=t=>RU(mQ,pQ,t),sP=t=>{if(!t)return WO;switch(t.shapes){case"rounded":return PU;case"rectangle":return yQ;case"pill":return vQ;default:return WO}},K_=(t="",e)=>e.map(([r,n])=>`--rc-${t}-${r}: ${n}`).join("; "),OU=t=>{const e=K_("color",Object.entries(TQ(t))),r=K_("shape",Object.entries(sP(t)));return[e,r].join("; ")},CQ=t=>{const e=K_("color",Object.entries(DU(t))),r=K_("shape",Object.entries(sP(t)));return[e,r].join("; ")},xQ=(t="",e,r)=>Object.entries(e).flatMap(([n,{desktop:a,mobile:i}])=>{const o=`normal normal ${a.fontWeight} ${a.fontSize}/${a.lineHeight} ${W_}`,c=`normal normal ${i.fontWeight} ${i.fontSize}/${i.lineHeight} ${W_}`,u=`normal normal ${r?.desktop.font_weight} ${r?.desktop.font_size} ${KO}`,d=`normal normal ${r?.mobile.font_weight} ${r?.mobile.font_size} ${KO}`;return[`--rc-${t}-${n}-desktop: ${o}`,`--rc-${t}-${n}-mobile: ${c}`,`--rc-${t}-${n}-branded-desktop: ${r?u:o}`,`--rc-${t}-${n}-branded-mobile: ${r?d:c}`,`--rc-${t}-${n}-desktop-font-size: ${a.fontSize}`,`--rc-${t}-${n}-mobile-font-size: ${i.fontSize}`]}).join("; "),PQ=(t="",e)=>Object.entries(e).map(([r,{mobile:n,desktop:a}])=>`--rc-${t}-${r}-mobile: ${n};  --rc-${t}-${r}-desktop: ${a};`).join(" "),AQ={outerPaddingTop:{mobile:"0.25rem",desktop:"clamp(1rem, 8.44vw, 7.5rem)"},outerPadding:{mobile:"clamp(1.3125rem, 5.6vw, 1.5rem)",desktop:"clamp(3rem, 6.44vw, 4.5rem)"},gapSmall:{mobile:"0.25rem",desktop:"0.5rem"},gapMedium:{mobile:"0.5rem",desktop:"0.75rem"},gapLarge:{mobile:"0.75rem",desktop:"1rem"},gapXLarge:{mobile:"1rem",desktop:"2rem"},gapXXLarge:{mobile:"1.25rem",desktop:"2.25rem"},gapXXXLarge:{mobile:"2.25rem",desktop:"5rem"},inputHeight:{mobile:"3rem",desktop:"3rem"}};class Bm{constructor(e){vt(this,"brandingAppearance"),e?this.brandingAppearance=e:this.brandingAppearance=void 0}get shape(){return sP(this.brandingAppearance)}get formColors(){return DU(this.brandingAppearance)}get formStyleVars(){return CQ(this.brandingAppearance)}get productInfoStyleVars(){return OU(this.brandingAppearance)}get spacing(){return AQ}get textStyles(){return NT}getTextStyleVars(e){return xQ("text",this.textStyles,e)}get spacingStyleVars(){return PQ("spacing",this.spacing)}}var NU="basil",RQ=function(t){return t===3?"v3":t},IU="https://js.stripe.com",DQ="".concat(IU,"/").concat(NU,"/stripe.js"),OQ=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,NQ=/^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/,IQ=function(t){return OQ.test(t)||NQ.test(t)},MQ=function(){for(var t=document.querySelectorAll('script[src^="'.concat(IU,'"]')),e=0;e<t.length;e++){var r=t[e];if(IQ(r.src))return r}return null},XO=function(t){var e="",r=document.createElement("script");r.src="".concat(DQ).concat(e);var n=document.head||document.body;if(!n)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return n.appendChild(r),r},jQ=function(t,e){!t||!t._registerWrapper||t._registerWrapper({name:"stripe-js",version:"7.3.1",startTime:e})},Ch=null,lv=null,uv=null,LQ=function(t){return function(e){t(new Error("Failed to load Stripe.js",{cause:e}))}},BQ=function(t,e){return function(){window.Stripe?t(window.Stripe):e(new Error("Stripe.js not available"))}},UQ=function(t){return Ch!==null?Ch:(Ch=new Promise(function(e,r){if(typeof window>"u"||typeof document>"u"){e(null);return}if(window.Stripe){e(window.Stripe);return}try{var n=MQ();if(!(n&&t)){if(!n)n=XO(t);else if(n&&uv!==null&&lv!==null){var a;n.removeEventListener("load",uv),n.removeEventListener("error",lv),(a=n.parentNode)===null||a===void 0||a.removeChild(n),n=XO(t)}}uv=BQ(e,r),lv=LQ(r),n.addEventListener("load",uv),n.addEventListener("error",lv)}catch(i){r(i);return}}),Ch.catch(function(e){return Ch=null,Promise.reject(e)}))},FQ=function(t,e,r){if(t===null)return null;var n=e[0],a=n.match(/^pk_test/),i=RQ(t.version),o=NU,c=t.apply(void 0,e);return jQ(c,r),c},dv,MU=!1,jU=function(){return dv||(dv=UQ(null).catch(function(t){return dv=null,Promise.reject(t)}),dv)};Promise.resolve().then(function(){return jU()}).catch(function(t){});var qQ=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];MU=!0;var n=Date.now();return jU().then(function(a){return FQ(a,e,n)})},IT=(t=>(t[t.ErrorLoadingStripe=0]="ErrorLoadingStripe",t[t.HandledFormError=1]="HandledFormError",t[t.UnhandledFormError=2]="UnhandledFormError",t))(IT||{});class Jv{constructor(e,r,n){this.code=e,this.gatewayErrorCode=r,this.message=n}}const LU=class Qv{static getStripeLocale(e){if(["ca","hi","uk"].includes(e))return"auto";const r={zh_Hans:"zh",zh_Hant:"zh"};return Object.keys(r).includes(e)?r[e]:e}static async initializeStripe(e,r,n,a,i,o,c){if(!r||!e||!n)throw{code:0,gatewayErrorCode:void 0,message:"Stripe configuration is missing"};const u=await qQ(r,{stripeAccount:e}).catch(b=>{throw this.mapInitializationError(b)});if(!u)throw{code:0,gatewayErrorCode:void 0,message:"Stripe client not found"};const d=new Bm(a?.appearance),f=d.shape,h=d.formColors,m=d.textStyles,_=NT.bodyBase[c].fontSize||NT.bodyBase.mobile.fontSize;let w;try{w=u.elements({mode:n.mode,paymentMethodTypes:n.payment_method_types,setupFutureUsage:n.setup_future_usage,amount:n.amount,currency:n.currency,loader:"always",locale:i,appearance:{theme:"stripe",labels:"floating",variables:{borderRadius:f["input-border-radius"],focusBoxShadow:"none",colorDanger:h.error,colorTextPlaceholder:h["grey-text-light"],colorText:h["grey-text-dark"],colorTextSecondary:h["grey-text-light"],fontSizeBase:_,...o},rules:{".Input":{boxShadow:"none",paddingTop:"6px",paddingBottom:"6px",fontSize:_,border:`1px solid ${h["grey-ui-dark"]}`,backgroundColor:h["input-background"],color:h["grey-text-dark"]},".Input:focus":{border:`1px solid ${h.focus}`,outline:"none"},".Label":{fontWeight:m.labelDefault[c].fontWeight,lineHeight:"22px",color:h["grey-text-dark"]},".Label--floating":{opacity:"1"},".Input--invalid":{boxShadow:"none"}}}})}catch(b){throw this.mapInitializationError(b)}return{stripe:u,elements:w}}static async updateElementsConfiguration(e,r){e.update({mode:r.mode,paymentMethodTypes:r.payment_method_types,setupFutureUsage:r.setup_future_usage,amount:r.amount,currency:r.currency})}static isStripeHandledFormError(e){const r=e.type==="validation_error",n=e.type==="card_error"&&e.code&&this.FORM_VALIDATED_CARD_ERROR_CODES.includes(e.code);return r||n}static createPaymentElement(e,r){return e.create("payment",{business:r?{name:r}:void 0,layout:{type:"tabs"},terms:{applePay:"never",auBecsDebit:"never",bancontact:"never",card:"never",cashapp:"never",googlePay:"never",ideal:"never",paypal:"never",sepaDebit:"never",sofort:"never",usBankAccount:"never"}})}static createExpressCheckoutElement(e,r,n){const a={billingAddressRequired:r,emailRequired:!0,...n||{}};return e.create("expressCheckout",a)}static createLinkAuthenticationElement(e,r){return e.create("linkAuthentication",{defaultValues:{email:r??""}})}static async submitElements(e){const{error:r}=await e.submit();if(r)throw this.mapError(r)}static mapInitializationError(e){return new Jv(0,e.code,e.message)}static mapError(e){return this.isStripeHandledFormError(e)?new Jv(1,e.code,e.message):new Jv(2,e.code,e.message)}static async confirmElements(e,r,n,a){const i={clientSecret:n,redirect:"if_required"},o=a?{...i,confirmParams:{confirmation_token:a}}:{...i,elements:r},c=n.startsWith("seti_");let u;if(c?u=await e.confirmSetup(o):u=await e.confirmPayment(o),u!=null&&u.error)throw this.mapError(u.error)}static async extractTaxCustomerDetails(e,r){var n,a;const{error:i,confirmationToken:o}=await r.createConfirmationToken({elements:e});if(i)throw this.mapError(i);const c=(a=(n=o.payment_method_preview)==null?void 0:n.billing_details)==null?void 0:a.address;return{customerDetails:{countryCode:c?.country??void 0,postalCode:c?.postal_code??void 0},confirmationTokenId:o.id}}static nextDateForPeriod(e,r){return e.unit===Ea.Year?(r.setFullYear(r.getFullYear()+e.number),r):e.unit===Ea.Month?(r.setMonth(r.getMonth()+e.number),r):e.unit===Ea.Week?(r.setDate(r.getDate()+e.number*7),r):(e.unit===Ea.Day&&r.setDate(r.getDate()+e.number),r)}static applePayPeriod(e){return e.unit===Ea.Week?{recurringPaymentIntervalUnit:"day",recurringPaymentIntervalCount:e.number*7}:{recurringPaymentIntervalUnit:e.unit,recurringPaymentIntervalCount:e.number}}static microsToMinimumAmountPrice(e,r){return["BIF","CLP","DJF","GNF","JPY","KMF","KRW","MGA","PYG","RWF","UGX","VND","VUV","XAF","XOF","XPF"].includes(r)?Math.floor(e/1e6):Math.floor(e/1e4)}static buildStripeExpressCheckoutOptionsForSubscription(e,r,n,a,i){var o;const c=Qv.microsToMinimumAmountPrice(r.totalAmountInMicros,r.currency),u=n.trial,d=(o=n.trial)==null?void 0:o.period,f=n.base.period,h=u&&d?Qv.nextDateForPeriod(d,new Date):void 0,m=f?Qv.applePayPeriod(f):{};return{applePay:{recurringPaymentRequest:{paymentDescription:e.title,managementURL:i,trialBilling:u?{label:a.translate(Ot.ApplePayFreeTrial),amount:0}:void 0,regularBilling:{label:e.title,amount:c,recurringPaymentStartDate:h,...m}}}}}};vt(LU,"FORM_VALIDATED_CARD_ERROR_CODES",["card_declined","expired_card","incorrect_cvc","incorrect_number"]);let ja=LU;var zQ=lt("<div></div>");function $Q(t,e){Wt(e,!0);let r=null;const n="payment-element",a=async o=>{await e.onError(ja.mapInitializationError(o.error))};_s(()=>{var o;try{r=ja.createPaymentElement(e.elements,(o=e.brandingInfo)==null?void 0:o.app_name),r.mount(`#${n}`),r.on("ready",e.onReady),r.on("change",e.onChange),r.on("loaderror",a)}catch(c){e.onError(ja.mapInitializationError(c))}}),Ig(()=>{r?.destroy(),r=null});var i=zQ();Ut(i,"id",n),ke(t,i),Kt()}var VQ=lt("<div></div>");function HQ(t,e){Wt(e,!0);let r=null;const n="link-authentication-element",a=async o=>{await e.onError(ja.mapInitializationError(o.error))};_s(()=>{try{r=ja.createLinkAuthenticationElement(e.elements,e.email),r.mount(`#${n}`),r.on("ready",e.onReady),r.on("change",e.onChange),r.on("loaderror",a)}catch(o){e.onError(ja.mapInitializationError(o))}}),Ig(()=>{r?.destroy(),r=null});var i=VQ();Ut(i,"id",n),ke(t,i),Kt()}var GQ=lt('<div class="text-separator svelte-ch0h61"><hr class="line svelte-ch0h61"> <span class="text svelte-ch0h61"><!></span> <hr class="line svelte-ch0h61"></div>');const WQ={hash:"svelte-ch0h61",code:`.text-separator.svelte-ch0h61 {display:flex;align-items:center;justify-content:center;gap:var(--rc-spacing-gapSmall-mobile);}

  @container layout-query-container (width >= 768px) {.text-separator.svelte-ch0h61 {gap:var(--rc-spacing-gapSmall-desktop);}
  }.line.svelte-ch0h61 {flex:1;height:1px;background-color:var(--rc-color-grey-ui-dark);border:none;}.text.svelte-ch0h61 {color:var(--rc-color-grey-text-light);text-transform:uppercase;white-space:nowrap;}`};function KQ(t,e){zt(t,WQ);let r=It(e,"text",8);var n=GQ(),a=kt(Le(n),2),i=Le(a);Pr(i,{size:"caption-default",children:(o,c)=>{var u=Ur();mt(()=>hr(u,r())),ke(o,u)},$$slots:{default:!0}}),ke(t,n)}var YQ=lt("<div></div> <!>",1);function XQ(t,e){Wt(e,!0);const r=Aa(),n=()=>ha(a,"$translator",r),a=Jn(Bi);let i=null,o=sr(!1);const c="express-checkout-element",u=async b=>{const E={...e.expressCheckoutOptions?e.expressCheckoutOptions:{}};b.resolve(E)},d=async b=>{await e.onError(ja.mapInitializationError(b.error))},f=async b=>{var E;e.onSubmit(b.expressPaymentType,((E=b.billingDetails)==null?void 0:E.email)??"")},h=async b=>{pt(o,!b.availablePaymentMethods),e.onReady()};_s(()=>{try{i=ja.createExpressCheckoutElement(e.elements,e.billingAddressRequired,e.expressCheckoutOptions),i.mount(`#${c}`),i.on("ready",h),i.on("confirm",f),i.on("loaderror",d),i.on("click",u)}catch(b){e.onError(ja.mapInitializationError(b))}}),Ig(()=>{i?.destroy(),i=null});var m=wr(),_=Xt(m);{var w=b=>{var E=YQ(),T=Xt(E);Ut(T,"id",c);var D=kt(T,2),P=ze(()=>n().translate(Ot.PaymentEntryPageExpressCheckoutDivider));KQ(D,{get text(){return $(P)}}),ke(b,E)};xt(_,b=>{$(o)||b(w)})}ke(t,m),Kt()}var JQ=lt('<div class="rc-elements svelte-6qa1vy"><!> <!> <!></div>');const QQ={hash:"svelte-6qa1vy",code:`.rc-elements.svelte-6qa1vy {display:flex;flex-direction:column;gap:var(--rc-spacing-gapXLarge-mobile);}

  @container layout-query-container (width >= 768px) {.rc-elements.svelte-6qa1vy {gap:var(--rc-spacing-gapLarge-desktop);}
  }`};function ZQ(t,e){Wt(e,!0),zt(t,QQ);const r=Aa(),n=()=>ha(o,"$translator",r);let a=It(e,"stripe",15,null),i=It(e,"elements",15,null);const o=Jn(Bi),c=ja.getStripeLocale(n().locale||n().fallbackLocale);let u=sr(!1),d=sr(Vt(e.skipEmail)),f=sr(!1),h=sr(void 0),m=sr("mobile"),_=sr(void 0);function w(){window.matchMedia&&window.matchMedia("(max-width: 767px)").matches?pt(m,"mobile"):pt(m,"desktop"),pt(h,Vt({fontSizeBase:"14px",fontFamily:W_,spacingGridRow:"16px"}))}function b(){clearTimeout($(_)),pt(_,Vt(setTimeout(()=>{w()},150)))}const E=R=>{e.onError(R),e.onLoadingComplete()},T=async()=>{$(d)||(pt(d,!0),$(d)&&$(u)&&$(f)&&e.onLoadingComplete())},D=async()=>{$(f)||(pt(f,!0),$(d)&&$(u)&&$(f)&&e.onLoadingComplete())},P=async()=>{$(u)||(pt(u,!0),$(d)&&$(u)&&$(f)&&e.onLoadingComplete())},A=async R=>{e.onPaymentInfoChange({complete:R.complete,paymentMethod:R.complete?R.value.type:void 0})},C=async R=>{e.onEmailChange(R.complete,R.value.email)};_s(()=>(window.addEventListener("resize",b),()=>{window.removeEventListener("resize",b)})),_s(async()=>{w(),!a()&&(i()||!e.stripeAccountId||!e.publishableApiKey||!e.elementsConfiguration||await ja.initializeStripe(e.stripeAccountId,e.publishableApiKey,e.elementsConfiguration,e.brandingInfo,c,$(h),$(m)).then(({stripe:R,elements:N})=>{a(R),i(N)}).catch(R=>{e.onError(R)}))}),ip(()=>{e.elementsConfiguration&&i()&&ja.updateElementsConfiguration(i(),e.elementsConfiguration)});var O=wr(),I=Xt(O);{var x=R=>{var N=JQ(),L=Le(N);XQ(L,{get elements(){return i()},onError:E,onReady:D,get onSubmit(){return e.onExpressCheckoutElementSubmit},get expressCheckoutOptions(){return e.expressCheckoutOptions},get billingAddressRequired(){return e.billingAddressRequired}});var j=kt(L,2);{var q=W=>{HQ(W,{get elements(){return i()},onReady:T,onChange:C,onError:E})};xt(j,W=>{e.skipEmail||W(q)})}var U=kt(j,2);$Q(U,{get elements(){return i()},get brandingInfo(){return e.brandingInfo},onReady:P,onChange:A,onError:E}),ke(R,N)};xt(I,R=>{i()&&R(x)})}ke(t,O),Kt()}const eZ=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
  <path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm0 6.5a1.25 1.25 0 100-2.5 1.25 1.25 0 000 2.5zm1.25 4.5a1.25 1.25 0 10-2.5 0v4.5a1.25 1.25 0 102.5 0v-4.5z" clip-rule="evenodd" />
</svg> `;var tZ=lt('<div class="rcb-ui-asset-icon svelte-1rk57mx"><!></div>');const rZ={hash:"svelte-1rk57mx",code:".rcb-ui-asset-icon.svelte-1rk57mx {display:inline-block;width:1em;height:1em;}"};function BU(t){zt(t,rZ);var e=tZ(),r=Le(e);fu(r,()=>eZ),ke(t,e)}var nZ=lt('<div class="rcb-info svelte-1czikbr"><div class="rcb-info-icon-wrapper svelte-1czikbr"><!></div> <div class="rcb-info-content svelte-1czikbr"><div class="rcb-info-title svelte-1czikbr"><!></div> <div class="rcb-info-message svelte-1czikbr"><!></div></div></div>');const aZ={hash:"svelte-1czikbr",code:`.rcb-info.svelte-1czikbr {display:flex;align-items:flex-start;background-color:var(--rc-color-grey-ui-light);border-radius:var(--rc-shape-input-border-radius);gap:var(--rc-spacing-gapLarge-mobile);padding:var(--rc-spacing-gapLarge-mobile);}.rcb-info-content.svelte-1czikbr {flex:1;}.rcb-info-icon-wrapper.svelte-1czikbr {flex-shrink:0;color:var(--rc-color-accent-primary);}.rcb-info-title.svelte-1czikbr {color:var(--rc-color-grey-text-dark);margin-bottom:var(--rc-spacing-gapSmall-mobile);display:flex;}.rcb-info-message.svelte-1czikbr {color:var(--rc-color-grey-text-light);}

  @container layout-query-container (width >= 768px) {.rcb-info.svelte-1czikbr {gap:var(--rc-spacing-gapLarge-desktop);padding:var(--rc-spacing-gapLarge-desktop);}.rcb-info-title.svelte-1czikbr {margin-bottom:var(--rc-spacing-gapSmall-desktop);}
  }`};function iZ(t,e){zt(t,aZ);var r=nZ(),n=Le(r),a=Le(n);BU(a);var i=kt(n,2),o=Le(i),c=Le(o);Pr(c,{size:"body-small",children:(f,h)=>{var m=Ur();mt(()=>hr(m,e.title)),ke(f,m)},$$slots:{default:!0}});var u=kt(o,2),d=Le(u);Pr(d,{size:"body-small",children:(f,h)=>{var m=Ur();mt(()=>hr(m,e.message)),ke(f,m)},$$slots:{default:!0}}),ke(t,r)}function sZ(t,e){Wt(e,!0);const r=Aa(),n=()=>ha(a,"$translator",r),a=Jn(Bi);var i=ze(()=>n().translate(Ot.PriceUpdateTitle)),o=ze(()=>{var c;return n().translate((c=e.subscriptionOption)!=null&&c.trial?Ot.PriceUpdateTrialMessage:Ot.PriceUpdateBaseMessage)});iZ(t,{get title(){return $(i)},get message(){return $(o)}}),Kt()}function UU(t,e){if(t.productType==="subscription"){const r=e,n=r.introPrice?r.introPrice.price:r.base.price;if(n)return n}else return e.basePrice;return t.price}class JO extends Error{}var oZ=lt('<div class="rc-loading svelte-dg9m6p"><!></div>'),cZ=lt('<div class="rc-checkout-container svelte-dg9m6p"><!> <!> <form data-testid="payment-form" class="rc-checkout-form svelte-dg9m6p"><div class="rc-checkout-form-container svelte-dg9m6p"><div class="rc-elements-container svelte-dg9m6p"><!></div> <div class="rc-checkout-price-update-info-container svelte-dg9m6p"><!></div> <div class="rc-checkout-pay-container svelte-dg9m6p"><!> <div class="rc-checkout-secure-container svelte-dg9m6p"><!></div></div></div></form></div>');const lZ={hash:"svelte-dg9m6p",code:`.rc-checkout-secure-container.svelte-dg9m6p {margin-top:var(--rc-spacing-gapXLarge-mobile);}.rc-checkout-container.svelte-dg9m6p {display:flex;flex-direction:column;gap:var(--rc-spacing-gapXLarge-mobile);user-select:none;position:relative;}.rc-checkout-price-update-info-container.svelte-dg9m6p {margin-top:var(--rc-spacing-gapXLarge-mobile);}.fully-hidden.svelte-dg9m6p {display:none;height:0;}.rc-checkout-pay-container.svelte-dg9m6p {display:flex;flex-direction:column;margin-top:var(--rc-spacing-gapXLarge-mobile);}.rc-checkout-pay-container.fully-hidden.svelte-dg9m6p {display:none;}.rc-checkout-form-container.svelte-dg9m6p {width:100%;}.rc-elements-container.svelte-dg9m6p {
    /* The standard height of the payment form from Stripe */
    /* Added to avoid the card getting smaller while loading */min-height:210px;}.rc-checkout-form-container.invisible.svelte-dg9m6p {visibility:hidden;}.rc-loading.svelte-dg9m6p {width:100%;height:100%;display:flex;justify-content:center;align-items:center;}

  @container layout-query-container (width <= 767px) {.rc-checkout-pay-container.svelte-dg9m6p {flex-grow:1;justify-content:flex-end;}.rc-checkout-form.svelte-dg9m6p {flex-grow:1;}.rc-checkout-form-container.svelte-dg9m6p {height:100%;display:flex;flex-direction:column;}.rc-checkout-container.svelte-dg9m6p {flex-grow:1;}.rc-loading.svelte-dg9m6p {position:absolute;top:0;left:0;}
  }

  @container layout-query-container (width >= 768px) {.rc-checkout-secure-container.svelte-dg9m6p {margin-top:var(--rc-spacing-gapXLarge-desktop);}.rc-checkout-container.svelte-dg9m6p {gap:var(--rc-spacing-gapXLarge-desktop);}.rc-checkout-pay-container.svelte-dg9m6p {margin-top:var(--rc-spacing-gapXLarge-desktop);}.rc-checkout-price-update-info-container.svelte-dg9m6p {margin-top:var(--rc-spacing-gapXLarge-desktop);}
  }form.svelte-dg9m6p {display:flex;flex-direction:column;flex-grow:1;}`};function uZ(t,e){var r,n,a;Wt(e,!0),zt(t,lZ);const i=Aa(),o=()=>ha(u,"$translator",i),c=Jn(eP),u=Jn(Bi),d=(r=e.productDetails.subscriptionOptions)==null?void 0:r[e.purchaseOption.id],f=UU(e.productDetails,e.purchaseOption);let h=sr(Vt(((n=e.defaultPriceBreakdown)==null?void 0:n.taxCalculationStatus)??((a=e.brandingInfo)!=null&&a.gateway_tax_collection_enabled?"unavailable":"disabled"))),m=sr(null),_=sr(null),w=sr(Vt(f.amountMicros)),b=sr(Vt(f.amountMicros)),E=ze(()=>e.defaultPriceBreakdown??{currency:f.currency,totalAmountInMicros:$(b),totalExcludingTaxInMicros:$(w),taxCalculationStatus:$(h),taxAmountInMicros:$(m),taxBreakdown:$(_)}),T=sr(Vt(e.gatewayParams.elements_configuration)),D=sr(null),P=sr(null),A=sr(null),C=sr(Vt(e.customerEmail??void 0)),O=sr(Vt(!!e.customerEmail)),I=sr(!0),x=sr(!1),R=sr(void 0),N=sr(void 0),L=sr(void 0),j=sr(!1),q=sr(null),U=ze(()=>$(I)||$(j)?"loading":$(N)?"error":"form"),W=sr("unavailable"),F=ze(()=>!$(j)&&$(x)&&$(O)&&($(h)==="disabled"||$(h)==="calculated"||$(h)==="miss-match")),Y=ze(()=>d&&e.managementUrl&&$(E)?ja.buildStripeExpressCheckoutOptionsForSubscription(e.productDetails,$(E),d,o(),e.managementUrl):void 0);ip(()=>{e.onPriceBreakdownUpdated($(E))}),_s(async()=>{$(h)==="unavailable"&&await Q(null).catch(H)}),Ig(()=>{$(q)&&($(q).abort(),pt(q,null))});async function Q(we,st){await e.purchaseOperationHelper.checkoutCalculateTax(we?.countryCode,we?.postalCode,st).then(bt=>{const nr=nQ({taxCalculation:bt,taxCustomerDetails:we});c.trackSDKEvent(nr),st?.throwIfAborted(),bt.failed_reason?!we&&bt.failed_reason===nP.invalid_tax_location?pt(h,"pending"):pt(h,"disabled"):pt(h,"calculated"),pt(m,Vt(bt.tax_amount_in_micros)),pt(w,Vt(bt.total_excluding_tax_in_micros)),pt(b,Vt(bt.total_amount_in_micros)),pt(_,Vt(bt.tax_breakdown)),pt(T,Vt(bt.gateway_params.elements_configuration)),pt(D,Vt(we))})}function ie(){c.trackSDKEvent({eventName:gi.CheckoutPaymentFormImpression}),pt(I,!1)}async function G(we,st){pt(C,Vt(st)),pt(O,Vt(we)),await te()}async function B({complete:we,paymentMethod:st}){pt(R,Vt(st)),pt(x,Vt(we)),await te()}async function K(we){if(we?.preventDefault(),$(j))return;const st=aQ({selectedPaymentMethod:$(R)??null});c.trackSDKEvent(st),pt(j,!0),await me()?e.onContinue():pt(j,!1)}async function ae(we,st){pt(R,Vt(we)),pt(C,Vt(e.customerEmail??st)),await K()}async function te(){$(R)!=="card"||!$(O)||!$(x)||$(j)||$(h)==="disabled"||($(h)!=="loading"&&(pt(W,Vt($(h))),pt(h,"loading")),await ue(async we=>{await Ae().then(()=>we.throwIfAborted()).then(()=>He(we)).then(()=>we.throwIfAborted()).catch(st=>{we.aborted||H(st)}).finally(()=>{$(h)==="loading"&&!we.aborted&&pt(h,Vt($(W)))})}))}async function me(){return await ue(async we=>{const st=$(b);let bt;return await Ae().then(()=>we.throwIfAborted()).then(()=>He(we)).then(nr=>{bt=nr}).then(()=>we.throwIfAborted()).then(ce(st)).then(()=>we.throwIfAborted()).then(xe).then(()=>we.throwIfAborted()).then(()=>re(bt)).then(()=>we.throwIfAborted()).then(()=>!0).catch(nr=>(we.aborted||H(nr),!1))})}async function ue(we){$(q)&&$(q).abort(),pt(q,Vt(new AbortController));const st=$(q).signal;try{return await we(st)}catch(bt){if(bt instanceof DOMException&&bt.name==="AbortError")return Promise.resolve(void 0);throw bt}}async function Ae(){$(A)&&await ja.submitElements($(A))}async function He(we){var st,bt;if($(h)==="unavailable"||$(h)==="disabled"||!$(A)||!$(P))return;const{customerDetails:nr,confirmationTokenId:ur}=await ja.extractTaxCustomerDetails($(A),$(P));return we?.throwIfAborted(),nr.postalCode===((st=$(D))==null?void 0:st.postalCode)&&nr.countryCode===((bt=$(D))==null?void 0:bt.countryCode)||await Q(nr,we),ur&&$(R)!=="card"?ur:void 0}function ce(we){return()=>{if($(b)!==we)throw new JO}}async function xe(){var we;const st=await e.purchaseOperationHelper.checkoutComplete($(C)),bt=(we=st?.gateway_params)==null?void 0:we.client_secret;bt&&pt(L,Vt(bt))}async function re(we){!$(P)||!$(A)||!$(L)||await ja.confirmElements($(P),$(A),$(L),we)}async function H(we){if(we instanceof JO)pt(h,"miss-match");else if(we instanceof on){const st=QJ({errorCode:we.errorCode.toString(),errorMessage:we.message});c.trackSDKEvent(st),we.errorCode===Hr.MissingEmailError?pt(N,Vt(o().translate(Ot.ErrorPageErrorMessageInvalidEmailError,{email:$(C)}))):e.onError(we)}else if(we instanceof Jv)await he(we);else throw we}async function he(we){const st=iQ({errorCode:we.gatewayErrorCode??"",errorMessage:we.message??""});c.trackSDKEvent(st),we.code===IT.HandledFormError||(we.code===IT.UnhandledFormError?pt(N,Vt(we.message)):e.onError(new on(Hr.ErrorSettingUpPurchase,"Failed to initialize payment form",we.message)))}const Re=()=>{pt(N,void 0)};var fe=cZ(),Ie=Le(fe);{var ct=we=>{var st=oZ(),bt=Le(st);CU(bt),ke(we,st)};xt(Ie,we=>{$(U)==="loading"&&we(ct)})}var $e=kt(Ie,2);{var rt=we=>{var st=ze(()=>o().translate(Ot.ErrorButtonTryAgain));rP(we,{title:null,type:"error",get closeButtonTitle(){return $(st)},onDismiss:Re,icon:bt=>{sU(bt)},message:bt=>{var nr=Ur();mt(()=>hr(nr,$(N))),ke(bt,nr)},$$slots:{icon:!0,message:!0}})};xt($e,we=>{$(U)==="error"&&we(rt)})}var We=kt($e,2),it=Le(We),Et=Le(it),Mt=Le(Et),_t=ze(()=>!!e.customerEmail),ge=ze(()=>$(h)!=="disabled");ZQ(Mt,{get stripeAccountId(){return e.gatewayParams.stripe_account_id},get publishableApiKey(){return e.gatewayParams.publishable_api_key},get elementsConfiguration(){return $(T)},get brandingInfo(){return e.brandingInfo},get skipEmail(){return $(_t)},get billingAddressRequired(){return $(ge)},onLoadingComplete:ie,onError:he,onEmailChange:G,onPaymentInfoChange:B,onExpressCheckoutElementSubmit:ae,get expressCheckoutOptions(){return $(Y)},get stripe(){return $(P)},set stripe(we){pt(P,Vt(we))},get elements(){return $(A)},set elements(we){pt(A,Vt(we))}});var Be=kt(Et,2),je=Le(Be);sZ(je,{subscriptionOption:d});var nt=kt(Be,2),Ct=Le(nt),jt=ze(()=>!$(F)),De=ze(()=>{var we;return(we=e.brandingInfo)!=null&&we.gateway_tax_collection_enabled?$(E):void 0});fQ(Ct,{get disabled(){return $(jt)},subscriptionOption:d,get priceBreakdown(){return $(De)}});var et=kt(Ct,2),at=Le(et);XJ(at,{get brandingInfo(){return e.brandingInfo},get purchaseOption(){return e.purchaseOption}}),mt(()=>{Lc(it,"invisible",$(U)!=="form"),Lc(Be,"fully-hidden",$(h)!=="miss-match"||$(U)!=="form"),Lc(nt,"fully-hidden",$(U)!=="form")}),jo("submit",We,K),ke(t,fe),Kt()}function dZ(t){return t!=null}var td=(t=>(t.Subscription="subscription",t.Consumable="consumable",t.NonConsumable="non_consumable",t))(td||{});const FU=t=>({amount:t.amount_micros/1e4,amountMicros:t.amount_micros,currency:t.currency,formattedPrice:zl(t.amount_micros,t.currency)}),Ww=t=>{const e=t.period_duration,r=t.price?FU(t.price):null,n=e?aU(e):null;let a=null,i=null,o=null;if(r!==null&&n!==null){const c=fZ(n),u=1e4,d=Math.round(r.amountMicros*c.toWeek);a={amount:d/u,amountMicros:d,currency:r.currency,formattedPrice:zl(d,r.currency)};const f=Math.round(r.amountMicros*c.toMonth);i={amount:f/u,amountMicros:f,currency:r.currency,formattedPrice:zl(f,r.currency)};const h=Math.round(r.amountMicros*c.toYear);o={amount:h/u,amountMicros:h,currency:r.currency,formattedPrice:zl(h,r.currency)}}return{periodDuration:e,period:n,cycleCount:t.cycle_count,price:r,pricePerWeek:a,pricePerMonth:i,pricePerYear:o}};function fZ(t){const{number:e,unit:r}=t,n=7,a=30,i=365;let o;switch(r){case Ea.Day:o=e;break;case Ea.Week:o=e*n;break;case Ea.Month:o=e*a;break;case Ea.Year:o=e*i;break;default:o=0,tr.errorLog(`Unknown period unit: ${r}`)}const c=o>0?n/o:0,u=o>0?a/o:0,d=o>0?i/o:0;return{toWeek:c,toMonth:u,toYear:d}}const pZ=t=>t.base==null?(tr.debugLog("Missing base phase for subscription option. Ignoring."),null):{id:t.id,priceId:t.price_id,base:Ww(t.base),trial:t.trial?Ww(t.trial):null,introPrice:t.intro_price?Ww(t.intro_price):null},hZ=t=>t.base_price==null?(tr.debugLog("Missing base price for non-subscription option. Ignoring."),null):{id:t.id,priceId:t.price_id,basePrice:FU(t.base_price)},mZ=(t,e)=>{const r=t.product_type;return r==="subscription"?yZ(t,e,r):gZ(t,e,r)},gZ=(t,e,r)=>{const n={};if(Object.entries(t.purchase_options).forEach(([o,c])=>{const u=hZ(c);u!=null&&(n[o]=u)}),Object.keys(n).length===0)return tr.debugLog(`Product ${t.identifier} has no purchase options. Ignoring.`),null;const a=t.default_purchase_option_id,i=a&&a in t.purchase_options?n[a]:null;return i==null?(tr.debugLog(`Product ${t.identifier} has no default purchase option. Ignoring.`),null):{identifier:t.identifier,displayName:t.title,title:t.title,description:t.description,productType:r,currentPrice:i.basePrice,normalPeriodDuration:null,presentedOfferingIdentifier:e.offeringIdentifier,presentedOfferingContext:e,defaultPurchaseOption:i,defaultSubscriptionOption:null,subscriptionOptions:{},defaultNonSubscriptionOption:i,price:i.basePrice,period:null,freeTrialPhase:null,introPricePhase:null}},yZ=(t,e,r)=>{const n={};if(Object.entries(t.purchase_options).forEach(([c,u])=>{const d=pZ(u);d!=null&&(n[c]=d)}),Object.keys(n).length===0)return tr.debugLog(`Product ${t.identifier} has no subscription options. Ignoring.`),null;const a=t.default_purchase_option_id,i=a&&a in n?n[a]:null;if(i==null)return tr.debugLog(`Product ${t.identifier} has no default subscription option. Ignoring.`),null;const o=i.base.price;return o==null?(tr.debugLog(`Product ${t.identifier} default option has no base price. Ignoring.`),null):{identifier:t.identifier,displayName:t.title,title:t.title,description:t.description,productType:r,currentPrice:o,normalPeriodDuration:i.base.periodDuration,presentedOfferingIdentifier:e.offeringIdentifier,presentedOfferingContext:e,defaultPurchaseOption:i,defaultSubscriptionOption:i,subscriptionOptions:n,defaultNonSubscriptionOption:null,price:o,period:i.base.period,freeTrialPhase:i.trial,introPricePhase:i.introPrice}},vZ=(t,e,r)=>{const n=r[e.platform_product_identifier];if(n===void 0)return null;const a=mZ(n,t);return a===null?null:{identifier:e.identifier,rcBillingProduct:a,webBillingProduct:a,packageType:bZ(e.identifier)}},_Z=(t,e,r,n)=>{const a={offeringIdentifier:e.identifier,targetingContext:t&&n?{ruleId:n.rule_id,revision:n.revision}:null,placementIdentifier:null},i=e.packages.map(c=>vZ(a,c,r)).filter(dZ),o={};for(const c of i)c!=null&&(o[c.identifier]=c);return i.length==0?null:{identifier:e.identifier,serverDescription:e.description,metadata:e.metadata,packagesById:o,availablePackages:i,lifetime:o.$rc_lifetime??null,annual:o.$rc_annual??null,sixMonth:o.$rc_six_month??null,threeMonth:o.$rc_three_month??null,twoMonth:o.$rc_two_month??null,monthly:o.$rc_monthly??null,weekly:o.$rc_weekly??null,paywall_components:e.paywall_components}};function bZ(t){switch(t){case"$rc_lifetime":return"$rc_lifetime";case"$rc_annual":return"$rc_annual";case"$rc_six_month":return"$rc_six_month";case"$rc_three_month":return"$rc_three_month";case"$rc_two_month":return"$rc_two_month";case"$rc_monthly":return"$rc_monthly";case"$rc_weekly":return"$rc_weekly";default:return t.startsWith("$rc_")?"unknown":"custom"}}var kZ=Qo('<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M4.94 5.72656L8 8.7799L11.06 5.72656L12 6.66656L8 10.6666L4 6.66656L4.94 5.72656Z" class="arrow-fill svelte-1qexsu3" fill-opacity="0.7"></path></svg>');const wZ={hash:"svelte-1qexsu3",code:".arrow.svelte-1qexsu3 {transition:transform 0.3s ease;}.arrow-fill.svelte-1qexsu3 {fill:var(--rc-color-grey-text-dark);}.arrow.left.svelte-1qexsu3 {transform:rotate(90deg);}.arrow.up.svelte-1qexsu3 {transform:rotate(180deg);}.arrow.right.svelte-1qexsu3 {transform:rotate(-90deg);}.arrow.down.svelte-1qexsu3 {transform:rotate(0deg);}"};function fv(t,e){zt(t,wZ);let r=It(e,"direction",8);var n=kZ();mt(()=>xK(n,`arrow ${r()??""} svelte-1qexsu3`)),ke(t,n)}var SZ=Qo('<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="arrow"><path d="M15.41 7.41L14 6L8 12L14 18L15.41 16.59L10.83 12L15.41 7.41Z" class="arrow-fill svelte-r0zny8" fill-opacity="0.7"></path></svg>');const EZ={hash:"svelte-r0zny8",code:".arrow-fill.svelte-r0zny8 {fill:var(--rc-color-grey-text-dark);}"};function TZ(t){zt(t,EZ);var e=SZ();ke(t,e)}const CZ=`<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"
     xmlns="http://www.w3.org/2000/svg">
    <g opacity="0.5" clip-path="url(#clip0_344_3390)">
        <path d="M7 18C5.9 18 5.01 18.9 5.01 20C5.01 21.1 5.9 22 7 22C8.1 22 9 21.1 9 20C9 18.9 8.1 18 7 18ZM1 2V4H3L6.6 11.59L5.25 14.04C5.09 14.32 5 14.65 5 15C5 16.1 5.9 17 7 17H19V15H7.42C7.28 15 7.17 14.89 7.17 14.75L7.2 14.63L8.1 13H15.55C16.3 13 16.96 12.59 17.3 11.97L20.88 5.48C20.96 5.34 21 5.17 21 5C21 4.45 20.55 4 20 4H5.21L4.27 2H1ZM17 18C15.9 18 15.01 18.9 15.01 20C15.01 21.1 15.9 22 17 22C18.1 22 19 21.1 19 20C19 18.9 18.1 18 17 18Z"
              fill="currentColor"/>
    </g>
    <defs>
        <clipPath id="clip0_344_3390">
            <rect width="24" height="24" fill="currentColor"/>
        </clipPath>
    </defs>
</svg>
`;var xZ=lt('<div style="color:var(--rc-color-gray-text-dark);"><!></div>');function PZ(t){var e=xZ(),r=Le(e);fu(r,()=>CZ),ke(t,e)}const AZ=`<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"
     xmlns="http://www.w3.org/2000/svg">
    <path d="M18 8H17V6C17 3.24 14.76 1 12 1C9.24 1 7 3.24 7 6V8H6C4.9 8 4 8.9 4 10V20C4 21.1 4.9 22 6 22H18C19.1 22 20 21.1 20 20V10C20 8.9 19.1 8 18 8ZM12 17C10.9 17 10 16.1 10 15C10 13.9 10.9 13 12 13C13.1 13 14 13.9 14 15C14 16.1 13.1 17 12 17ZM15.1 8H8.9V6C8.9 4.29 10.29 2.9 12 2.9C13.71 2.9 15.1 4.29 15.1 6V8Z"
          fill="currentColor"/>
</svg>
`;var RZ=lt('<div style="color:var(--rc-color-accent);" class="rcb-ui-asset-icon svelte-wgufvv"><!></div>');const DZ={hash:"svelte-wgufvv",code:"div.svelte-wgufvv {height:24px;width:24px;}"};function OZ(t){zt(t,DZ);var e=RZ(),r=Le(e);fu(r,()=>AZ),ke(t,e)}const NZ=`<svg viewBox="0 0 124 124" fill="var(--rc-color-grey-text-dark)" xmlns="http://www.w3.org/2000/svg">
    <circle cx="62" cy="62" r="62" fill="var(--rc-color-grey-text-dark)" opacity="0.2"/>
    <rect x="44.1116" y="56" width="27.5" height="11" transform="rotate(45 44.1116 56)" fill="var(--rc-color-grey-text-dark)"/>
    <rect x="79.1133" y="44.334" width="11" height="44" transform="rotate(45 79.1133 44.334)" fill="var(--rc-color-grey-text-dark)"/>
</svg>
`;var IZ=lt('<div style="color:var(--rc-color-primary)"><!></div>');function qU(t){var e=IZ(),r=Le(e);fu(r,()=>NZ),ke(t,e)}var MZ=Qo('<svg width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M19 6.41L17.59 5L12 10.59L6.41 5L5 6.41L10.59 12L5 17.59L6.41 19L12 13.41L17.59 19L19 17.59L13.41 12L19 6.41Z" class="arrow-fill svelte-1jpfelf" fill-opacity="0.7"></path></svg>');const jZ={hash:"svelte-1jpfelf",code:".arrow-fill.svelte-1jpfelf {fill:var(--arrow-fill-color, var(--rc-color-grey-text-dark));}"};function LZ(t){zt(t,jZ);var e=MZ();ke(t,e)}const BZ={cart:PZ,error:sU,lock:OZ,success:qU,back:TZ,info:BU,close:LZ,"chevron-left":fv,"chevron-right":fv,"chevron-up":fv,"chevron-down":fv};function Um(t,e){Wt(e,!0);const r=BZ[e.name];let n=sr(Vt({}));if(e.name.startsWith("chevron")){const a=e.name.split("-")[1];pt(n,Vt({direction:a}))}r(t,qc(()=>$(n))),Kt()}var UZ=lt('<span class="rc-sandbox-only-error svelte-1d8gf9n"><!></span> <br> <br>',1),FZ=lt('<!> <a class="svelte-1d8gf9n"> </a>.',1),qZ=lt("<!> <!>",1);const zZ={hash:"svelte-1d8gf9n",code:"a.svelte-1d8gf9n {color:var(--rc-color-grey-text-dark);}.rc-sandbox-only-error.svelte-1d8gf9n {font-weight:bold;}"};function $Z(t,e){Wt(e,!0),zt(t,zZ);const r=Aa(),n=()=>ha(i,"$translator",r),a=ze(()=>e.lastError??new on(Hr.UnknownError,"Unknown error without state set.")),i=Jn(Bi),o=ze(()=>$(a).errorCode===Hr.StripeTaxNotActive||$(a).errorCode===Hr.StripeInvalidTaxOriginAddress||$(a).errorCode===Hr.StripeMissingRequiredPermission);_s(()=>{tr.errorLog(`Displayed error: ${Hr[$(a).errorCode]}. Message: ${$(a).message??"None"}. Underlying error: ${$(a).underlyingErrorMessage??"None"}`)});function c(){return $(a).errorCode===Hr.AlreadyPurchasedError?n().translate(Ot.ErrorPageCloseButtonTitle,{appName:e.appName??"App"}):$(o)?n().translate(Ot.ErrorButtonClose):n().translate(Ot.ErrorButtonTryAgain)}function u(){switch($(a).errorCode){case Hr.AlreadyPurchasedError:return e.productDetails.productType===td.Subscription?n().translate(Ot.ErrorPageErrorTitleAlreadySubscribed,{productTitle:e.productDetails.title}):n().translate(Ot.ErrorPageErrorTitleAlreadyPurchased,{productTitle:e.productDetails.title});case Hr.StripeTaxNotActive:return n().translate(Ot.ErrorPageErrorTitleStripeTaxNotActive);case Hr.StripeInvalidTaxOriginAddress:return n().translate(Ot.ErrorPageErrorTitleStripeInvalidTaxOriginAddress);case Hr.StripeMissingRequiredPermission:return n().translate(Ot.ErrorPageErrorTitleStripeMissingRequiredPermission);default:return n().translate(Ot.ErrorPageErrorTitleOtherErrors)}}function d(){const w=$(a).getErrorCode();switch($(a).errorCode){case Hr.ErrorSettingUpPurchase:return n().translate(Ot.ErrorPageErrorMessageErrorSettingUpPurchase,{errorCode:w});case Hr.ErrorChargingPayment:return n().translate(Ot.ErrorPageErrorMessageErrorChargingPayment,{errorCode:w});case Hr.AlreadyPurchasedError:return e.productDetails.productType===td.Subscription?n().translate(Ot.ErrorPageErrorMessageAlreadySubscribed,{errorCode:w}):n().translate(Ot.ErrorPageErrorMessageAlreadyPurchased,{errorCode:w});case Hr.StripeTaxNotActive:return n().translate(Ot.ErrorPageErrorMessageStripeTaxNotActive,{errorCode:w});case Hr.StripeInvalidTaxOriginAddress:return n().translate(Ot.ErrorPageErrorMessageStripeInvalidTaxOriginAddress,{errorCode:w});case Hr.StripeMissingRequiredPermission:return n().translate(Ot.ErrorPageErrorMessageStripeMissingRequiredPermission,{errorCode:w});case Hr.NetworkError:return n().translate(Ot.ErrorPageErrorMessageNetworkError,{errorCode:w});default:return n().translate(Ot.ErrorPageErrorMessageUnknownError,{errorCode:w})}}function f(){return $(a).errorCode===Hr.AlreadyPurchasedError?Ot.ErrorPageTroubleAccessing:Ot.ErrorPageIfErrorPersists}function h(){return $(a).errorCode===Hr.AlreadyPurchasedError?"success":"error"}var m=ze(u),_=ze(c);rP(t,{get title(){return $(m)},get onDismiss(){return e.onDismiss},type:"error",get closeButtonTitle(){return $(_)},icon:w=>{var b=ze(h);Um(w,{get name(){return $(b)}})},message:w=>{var b=qZ(),E=Xt(b);{var T=C=>{var O=UZ(),I=Xt(O),x=Le(I);si(x,{get key(){return Ot.ErrorPageErrorMessageOnlyInSandbox}}),ke(C,O)};xt(E,C=>{$(o)&&C(T)})}var D=kt(E);mt(()=>hr(D,` ${d()??""} `));var P=kt(D);{var A=C=>{var O=FZ(),I=Xt(O),x=ze(f);si(I,{get key(){return $(x)}});var R=kt(I,2),N=Le(R);mt(()=>{Ut(R,"href",`mailto:${e.supportEmail??""}`),hr(N,e.supportEmail)}),ke(C,O)};xt(P,C=>{!$(o)&&e.supportEmail&&C(A)})}ke(w,b)},$$slots:{icon:!0,message:!0}}),Kt()}function VZ(t,e){Wt(e,!1);const r=Aa(),n=()=>ha(i,"$translator",r);let a=It(e,"onContinue",8);const i=Jn(Bi),o=Jn(eP);function c(){o.trackSDKEvent({eventName:gi.CheckoutPurchaseSuccessfulDismiss,properties:{ui_element:"go_back_to_app"}}),a()()}_s(()=>{o.trackSDKEvent({eventName:gi.CheckoutPurchaseSuccessfulImpression})}),ws();var u=Mf(()=>n().translate(Ot.SuccessPagePurchaseSuccessful)),d=Mf(()=>n().translate(Ot.SuccessPageButtonClose));rP(t,{type:"success",get title(){return $(u)},onDismiss:c,get closeButtonTitle(){return $(d)},icon:f=>{qU(f)},$$slots:{icon:!0}}),Kt()}function HZ(t){CU(t)}var GZ=lt('<div class="rcb-pricing-dropdown svelte-fgrbnh"><div class="rcb-pricing-dropdown-header svelte-fgrbnh" tabindex="0" role="button"><!> <span class="rcb-pricing-dropdown-toggle svelte-fgrbnh"><!></span></div> <div class="rcb-pricing-dropdown-content svelte-fgrbnh"><div class="rcb-pricing-dropdown-content-inner svelte-fgrbnh"><!></div></div></div>');const WZ={hash:"svelte-fgrbnh",code:`.rcb-pricing-dropdown.svelte-fgrbnh {width:100%;overflow:hidden;display:flex;flex-direction:column;}.rcb-pricing-dropdown-header.svelte-fgrbnh {padding-top:var(--rc-spacing-gapSmall-mobile);padding-bottom:var(--rc-spacing-gapSmall-mobile);padding-left:var(--rc-spacing-gapLarge-mobile);padding-right:var(--rc-spacing-gapMedium-mobile);color:var(--rc-color-grey-text-light);border-radius:var(--rc-shape-input-button-border-radius);cursor:pointer;display:inline-flex;align-items:center;background-color:var(--rc-color-grey-ui-light);width:fit-content;user-select:none;}.rcb-pricing-dropdown-toggle.svelte-fgrbnh {display:flex;align-items:center;margin-left:var(--rc-spacing-gapSmall-mobile);}.rcb-pricing-dropdown-content.svelte-fgrbnh {display:flex;flex-direction:column;overflow:hidden;}

  @container layout-query-container (width < 768px) {.rcb-pricing-dropdown-content.svelte-fgrbnh {max-height:1000px; /* Set a large max-height for animation */transition:max-height 0.2s ease-in-out;}.rcb-pricing-dropdown-content.collapsed.svelte-fgrbnh {max-height:0;}.rcb-pricing-dropdown-content-inner.svelte-fgrbnh {padding-top:var(--rc-spacing-gapMedium-mobile);}
  }

  @container layout-query-container (width >= 768px) {.rcb-pricing-dropdown-header.svelte-fgrbnh {display:none;}
  }`};function KZ(t,e){Wt(e,!1),zt(t,WZ);const r=Aa(),n=()=>ha(o,"$translator",r);let a=It(e,"isExpanded",12,!0),i=It(e,"children",8);const o=Jn(Bi);function c(){a(!a())}ws();var u=GZ(),d=Le(u),f=Le(d);Pr(f,{size:"label-default",children:(D,P)=>{var A=wr(),C=Xt(A);{var O=x=>{var R=Ur();mt(()=>hr(R,n().translate(Ot.PricingDropdownHideDetails))),ke(x,R)},I=x=>{var R=Ur();mt(()=>hr(R,n().translate(Ot.PricingDropdownShowDetails))),ke(x,R)};xt(C,x=>{a()?x(O):x(I,!1)})}ke(D,A)},$$slots:{default:!0}});var h=kt(f,2),m=Le(h);{var _=D=>{Um(D,{name:"chevron-up"})},w=D=>{Um(D,{name:"chevron-down"})};xt(m,D=>{a()?D(_):D(w,!1)})}var b=kt(d,2),E=Le(b),T=Le(E);Dn(T,()=>i()??Ar),mt(()=>{Ut(d,"aria-expanded",a()),Lc(b,"collapsed",!a())}),jo("click",d,c),jo("keydown",d,D=>D.key==="Enter"||D.key===" "?c():null),ke(t,u),Kt()}var YZ=lt('<div class="rcb-pricing-table-value-loading svelte-erv89n"><!></div>');const XZ={hash:"svelte-erv89n",code:`.rcb-pricing-table-value-loading.svelte-erv89n {color:transparent;
    animation: svelte-erv89n-rcb-pricing-table-value-loading 1.5s ease-in-out 0s infinite
      normal none running;cursor:progress;background-color:var(--rc-color-grey-text-dark);user-select:none;border-radius:var(--rc-shape-input-border-radius);}

  @keyframes svelte-erv89n-rcb-pricing-table-value-loading {
    0%,
    100% {
      opacity: 0.5;
    }
    50% {
      opacity: 0.3;
    }
  }`};function JZ(t,e){Wt(e,!1),zt(t,XZ);let r=It(e,"children",8);ws();var n=YZ(),a=Le(n);Dn(a,()=>r()??Ar),ke(t,n),Kt()}var QZ=lt('<div class="rcb-pricing-table-row svelte-i12130" data-testid="tax-loading-skeleton"><div class="rcb-pricing-table-header svelte-i12130"><!></div> <div class="rcb-pricing-table-value svelte-i12130"><!></div></div>'),ZZ=lt('<div class="rcb-pricing-table-row svelte-i12130"><div class="rcb-pricing-table-header svelte-i12130"> </div> <div class="rcb-pricing-table-value svelte-i12130"><!></div></div>'),eee=lt('<div class="rcb-pricing-table-row svelte-i12130"><div class="rcb-pricing-table-header svelte-i12130"><!></div> <div class="rcb-pricing-table-value svelte-i12130"><!></div></div>'),tee=lt('<div class="rcb-pricing-table-row svelte-i12130"><div class="rcb-pricing-table-header svelte-i12130"><!></div> <div class="rcb-pricing-table-value svelte-i12130"><!></div></div> <!> <div class="rcb-pricing-table-separator svelte-i12130"></div>',1),ree=lt('<div class="rcb-pricing-table-row svelte-i12130"><div class="rcb-pricing-table-header svelte-i12130"><!></div> <div class="rcb-pricing-table-value svelte-i12130"><!></div></div>'),nee=lt('<div class="rcb-pricing-table svelte-i12130"><!> <!> <div class="rcb-pricing-table-row rcb-header svelte-i12130"><div class="rcb-pricing-table-header svelte-i12130"><!></div> <div class="rcb-pricing-table-value svelte-i12130"><!></div></div></div>');const aee={hash:"svelte-i12130",code:`.rcb-pricing-table.svelte-i12130 {display:flex;flex-direction:column;gap:var(--rc-spacing-gapSmall-mobile);}.rcb-pricing-table-row.svelte-i12130 {display:flex;flex-direction:row;align-items:center;justify-content:space-between;}.rcb-pricing-table-separator.svelte-i12130 {height:1px;background-color:var(--rc-color-grey-ui-dark);}.rcb-pricing-table-row.svelte-i12130 > .rcb-pricing-table-header:where(.svelte-i12130) {color:var(--rc-color-grey-text-light);}.rcb-pricing-table-row.svelte-i12130 > .rcb-pricing-table-value:where(.svelte-i12130) {color:var(--rc-color-grey-text-dark);}.rcb-pricing-table-row.svelte-i12130:last-child > .rcb-pricing-table-header:where(.svelte-i12130),
  .rcb-pricing-table-row.svelte-i12130:last-child > .rcb-pricing-table-value:where(.svelte-i12130) {color:var(--rc-color-grey-text-dark);}

  @container layout-query-container (width >= 768px) {.rcb-pricing-table-separator.svelte-i12130 {display:none;}.rcb-pricing-table.svelte-i12130 {gap:var(--rc-spacing-gapSmall-desktop);}.rcb-pricing-table-row.svelte-i12130 > .rcb-pricing-table-header:where(.svelte-i12130),
    .rcb-pricing-table-row.svelte-i12130 > .rcb-pricing-table-value:where(.svelte-i12130) {color:var(--rc-color-grey-text-light);}
  }`};function iee(t,e){var r;Wt(e,!0),zt(t,aee);const n=Aa(),a=()=>ha(c,"$translator",n),i=_=>{var w=nee(),b=Le(w);{var E=x=>{var R=tee(),N=Xt(R),L=Le(N),j=Le(L);Pr(j,{size:"body-small",children:(Q,ie)=>{var G=Ur();mt(()=>hr(G,a().translate(Ot.PricingTotalExcludingTax))),ke(Q,G)},$$slots:{default:!0}});var q=kt(L,2),U=Le(q);Pr(U,{size:"body-small",children:(Q,ie)=>{var G=Ur();mt(()=>hr(G,a().formatPrice(e.priceBreakdown.totalExcludingTaxInMicros,e.priceBreakdown.currency))),ke(Q,G)},$$slots:{default:!0}});var W=kt(N,2);{var F=Q=>{var ie=QZ(),G=Le(ie),B=Le(G);Pr(B,{size:"body-small",children:(te,me)=>{var ue=Ur();mt(()=>hr(ue,a().translate(Ot.PricingTableTax))),ke(te,ue)},$$slots:{default:!0}});var K=kt(G,2),ae=Le(K);Pr(ae,{size:"body-small",children:(te,me)=>{JZ(te,{children:(ue,Ae)=>{var He=Ur();mt(()=>hr(He,a().formatPrice(1234e4,e.priceBreakdown.currency))),ke(ue,He)},$$slots:{default:!0}})},$$slots:{default:!0}}),ke(Q,ie)},Y=Q=>{var ie=wr(),G=Xt(ie);{var B=ae=>{var te=ZZ(),me=Le(te),ue=Le(me);mt(()=>hr(ue,a().translate(Ot.PricingTableTax)));var Ae=kt(me,2),He=Le(Ae);Pr(He,{size:"body-small",children:(ce,xe)=>{var re=Ur();mt(()=>hr(re,a().translate(Ot.PricingTableEnterBillingAddressToCalculate))),ke(ce,re)},$$slots:{default:!0}}),ke(ae,te)},K=ae=>{var te=wr(),me=Xt(te);{var ue=Ae=>{var He=wr(),ce=Xt(He);op(ce,17,()=>e.priceBreakdown.taxBreakdown,sp,(xe,re)=>{var H=eee(),he=Le(H),Re=Le(he);Pr(Re,{size:"body-small",children:(ct,$e)=>{var rt=Ur();mt(()=>hr(rt,$(re).display_name)),ke(ct,rt)},$$slots:{default:!0}});var fe=kt(he,2),Ie=Le(fe);Pr(Ie,{size:"body-small",children:(ct,$e)=>{var rt=Ur();mt(()=>hr(rt,a().formatPrice($(re).tax_amount_in_micros,e.priceBreakdown.currency))),ke(ct,rt)},$$slots:{default:!0}}),ke(xe,H)}),ke(Ae,He)};xt(me,Ae=>{e.priceBreakdown.taxBreakdown!==null&&Ae(ue)},!0)}ke(ae,te)};xt(G,ae=>{e.priceBreakdown.taxCalculationStatus==="pending"?ae(B):ae(K,!1)},!0)}ke(Q,ie)};xt(W,Q=>{e.priceBreakdown.taxCalculationStatus==="loading"?Q(F):Q(Y,!1)})}ke(x,R)};xt(b,x=>{$(u)&&x(E)})}var T=kt(b,2);{var D=x=>{var R=ree(),N=Le(R),L=Le(N);Pr(L,{size:"body-small",children:(U,W)=>{var F=Ur();mt(()=>hr(F,a().translate(Ot.PricingTableTrialEnds,{formattedTrialEndDate:a().translateDate($(o),{dateStyle:"medium"})}))),ke(U,F)},$$slots:{default:!0}});var j=kt(N,2),q=Le(j);Pr(q,{size:"body-small",children:(U,W)=>{var F=Ur();mt(()=>hr(F,a().formatPrice(e.priceBreakdown.totalAmountInMicros,e.priceBreakdown.currency))),ke(U,F)},$$slots:{default:!0}}),ke(x,R)};xt(T,x=>{$(o)&&x(D)})}var P=kt(T,2),A=Le(P),C=Le(A);Pr(C,{size:"body-small",children:(x,R)=>{var N=Ur();mt(()=>hr(N,a().translate(Ot.PricingTableTotalDueToday))),ke(x,N)},$$slots:{default:!0}});var O=kt(A,2),I=Le(O);Pr(I,{size:"body-small",children:(x,R)=>{var N=wr(),L=Xt(N);{var j=U=>{var W=Ur();mt(()=>hr(W,a().formatPrice(0,e.priceBreakdown.currency))),ke(U,W)},q=U=>{var W=Ur();mt(()=>hr(W,a().formatPrice(e.priceBreakdown.totalAmountInMicros,e.priceBreakdown.currency))),ke(U,W)};xt(L,U=>{$(o)?U(j):U(q,!1)})}ke(x,N)},$$slots:{default:!0}}),ke(_,w)};let o=sr(null);(r=e.trialPhase)!=null&&r.period&&pt(o,Vt(xT(new Date,e.trialPhase.period,!0)));const c=Jn(Bi),u=ze(()=>e.priceBreakdown.taxCalculationStatus!=="unavailable"&&e.priceBreakdown.taxCalculationStatus!=="disabled"&&e.priceBreakdown.taxBreakdown&&e.priceBreakdown.taxBreakdown.length>0);var d=wr(),f=Xt(d);{var h=_=>{KZ(_,{children:(w,b)=>{i(w)},$$slots:{default:!0}})},m=_=>{i(_)};xt(f,_=>{$(u)?_(h):_(m,!1)})}ke(t,d),Kt()}var see=lt('<div class="rcb-subscribe-to svelte-4fnm8t"><!></div>'),oee=lt('<span class="rcb-product-description svelte-4fnm8t"><!></span>'),cee=lt('<div class="rcb-pricing-info-header svelte-4fnm8t"><!> <div class="rcb-product-title svelte-4fnm8t"><!></div> <!></div>');const lee={hash:"svelte-4fnm8t",code:`.rcb-pricing-info-header.svelte-4fnm8t {display:flex;flex-direction:column;gap:var(--rc-spacing-gapMedium-mobile);}.rcb-product-title.svelte-4fnm8t {color:var(--rc-color-grey-text-dark);}.rcb-product-description.svelte-4fnm8t {color:var(--rc-color-grey-text-light);}.rcb-subscribe-to.svelte-4fnm8t {display:none;}

  @container layout-query-container (width >= 768px) {.rcb-subscribe-to.svelte-4fnm8t {display:block;}.rcb-pricing-info-header.svelte-4fnm8t {display:flex;flex-direction:column;gap:var(--rc-spacing-gapMedium-desktop);}
  }`};function uee(t,e){Wt(e,!1),zt(t,lee);let r=It(e,"productDetails",8),n=It(e,"showProductDescription",8);const a=r().productType===td.Subscription;ws();var i=cee(),o=Le(i);{var c=m=>{var _=see(),w=Le(_);Pr(w,{size:"body-base",children:(b,E)=>{var T=Mf(()=>({productTitle:r().title}));si(b,{get key(){return Ot.ProductInfoSubscribeTo},get variables(){return $(T)}})},$$slots:{default:!0}}),ke(m,_)};xt(o,m=>{a&&m(c)})}var u=kt(o,2),d=Le(u);Pr(d,{size:"heading-lg",branded:!0,children:(m,_)=>{var w=Mf(()=>({productTitle:r().title}));si(m,{get key(){return Ot.ProductInfoProductTitle},get variables(){return $(w)}})},$$slots:{default:!0}});var f=kt(u,2);{var h=m=>{var _=oee(),w=Le(_);Pr(w,{size:"body-small",children:(b,E)=>{var T=Mf(()=>({productDescription:r().description}));si(b,{get key(){return Ot.ProductInfoProductDescription},get variables(){return $(T)}})},$$slots:{default:!0}}),ke(m,_)};xt(f,m=>{n()&&r().description&&m(h)})}ke(t,i),Kt()}var dee=lt("<div><!></div>"),fee=lt("<div><!> <!></div>"),pee=lt('<div class="rcb-product-price-container svelte-509gz3"><!> <!> <div><!> <!> <!></div></div>');const hee={hash:"svelte-509gz3",code:".rcb-product-price-container.svelte-509gz3 {display:flex;flex-direction:column;justify-content:space-between;gap:var(--rc-spacing-gapMedium-mobile);color:var(--rc-color-grey-text-dark);}"};function mee(t,e){Wt(e,!0),zt(t,hee);const r=Aa(),n=()=>ha(a,"$translator",r),a=Jn(Bi),i=ze(()=>{var N;return(N=e.introPricePhase)!=null&&N.period&&n().translatePeriod(e.introPricePhase.period.number*e.introPricePhase.cycleCount,e.introPricePhase.period.unit)||""}),o=ze(()=>"heading-lg"),c=ze(()=>{var N;return(N=e.trialPhase)!=null&&N.periodDuration?"heading-md":"heading-lg"}),u=ze(()=>{var N,L;return(N=e.trialPhase)!=null&&N.periodDuration||(L=e.introPricePhase)!=null&&L.periodDuration?"heading-md":"heading-lg"}),d=ze(()=>{var N;return(N=e.trialPhase)==null?void 0:N.periodDuration}),f=ze(()=>{var N;return(N=e.introPricePhase)==null?void 0:N.periodDuration}),h=ze(()=>{var N;return((N=e.introPricePhase)==null?void 0:N.cycleCount)==1}),m=ze(()=>{var N,L;return n().formatPrice($(f)?((L=(N=e.basePhase)==null?void 0:N.price)==null?void 0:L.amountMicros)??0:e.priceBreakdown.totalAmountInMicros,e.priceBreakdown.currency)}),_=ze(()=>n().formatPrice(e.priceBreakdown.totalAmountInMicros,e.priceBreakdown.currency));var w=pee(),b=Le(w);{var E=N=>{var L=dee(),j=Le(L);Pr(j,{get size(){return $(o)},children:(q,U)=>{var W=ze(()=>({trialDuration:wY(e.trialPhase.periodDuration,n())}));si(q,{get key(){return Ot.ProductInfoFreeTrialDuration},get variables(){return $(W)}})},$$slots:{default:!0}}),ke(N,L)};xt(b,N=>{var L;(L=e.trialPhase)!=null&&L.periodDuration&&N(E)})}var T=kt(b,2);{var D=N=>{var L=fee(),j=Le(L);Pr(j,{get size(){return $(c)},children:(F,Y)=>{var Q=ze(()=>$(d)?Ot.ProductInfoIntroPricePhaseAfterTrial:Ot.ProductInfoIntroPricePhase),ie=ze(()=>({introPriceDuration:$(i),introPrice:$(_)}));si(F,{get key(){return $(Q)},get variables(){return $(ie)}})},$$slots:{default:!0}});var q=kt(j,2);{var U=F=>{Pr(F,{size:"body-small",children:(Y,Q)=>{si(Y,{get key(){return Ot.ProductInfoIntroPricePhasePaidOnce}})},$$slots:{default:!0}})},W=F=>{var Y=wr(),Q=Xt(Y);{var ie=G=>{Pr(G,{size:"body-small",children:(B,K)=>{var ae=Ur();mt(()=>hr(ae,n().translatePeriodFrequency(e.introPricePhase.period.number,e.introPricePhase.period.unit,{useMultipleWords:!0}))),ke(B,ae)},$$slots:{default:!0}})};xt(Q,G=>{e.introPricePhase.period&&G(ie)},!0)}ke(F,Y)};xt(q,F=>{$(h)?F(U):F(W,!1)})}ke(N,L)};xt(T,N=>{var L;(L=e.introPricePhase)!=null&&L.periodDuration&&N(D)})}var P=kt(T,2),A=Le(P);Pr(A,{get size(){return $(u)},children:(N,L)=>{var j=Ur();mt(()=>hr(j,$(m))),ke(N,j)},$$slots:{default:!0}});var C=kt(A,2);{var O=N=>{Pr(N,{size:"body-small",children:(L,j)=>{var q=Ur();mt(()=>hr(q,n().translatePeriodFrequency(e.basePhase.period.number,e.basePhase.period.unit,{useMultipleWords:!0}))),ke(L,q)},$$slots:{default:!0}})};xt(C,N=>{var L;(L=e.basePhase)!=null&&L.period&&N(O)})}var I=kt(C,2);{var x=N=>{Pr(N,{size:"body-small",children:(L,j)=>{si(L,{get key(){return Ot.ProductInfoAfter}})},$$slots:{default:!0}})},R=N=>{var L=wr(),j=Xt(L);{var q=U=>{Pr(U,{size:"body-small",children:(W,F)=>{si(W,{get key(){return Ot.ProductInfoAfterTrial}})},$$slots:{default:!0}})};xt(j,U=>{$(d)&&U(q)},!0)}ke(N,L)};xt(I,N=>{$(f)?N(x):N(R,!1)})}ke(t,w),Kt()}var gee=lt('<div class="rcb-pricing-info svelte-18guro7"><div class="rcb-pricing-info-header svelte-18guro7"><!> <!></div> <!></div>');const yee={hash:"svelte-18guro7",code:`.rcb-pricing-info.svelte-18guro7 {display:flex;flex-direction:column;user-select:none;gap:var(--rc-spacing-gapXXLarge-mobile);}.rcb-pricing-info-header.svelte-18guro7 {display:flex;flex-direction:column;gap:var(--rc-spacing-gapLarge-mobile);}

  @container layout-query-container (width >= 768px) {.rcb-pricing-info.svelte-18guro7 {gap:var(--rc-spacing-gapXXXLarge-desktop);}.rcb-pricing-info-header.svelte-18guro7 {gap:var(--rc-spacing-gapLarge-desktop);}
  }`};function vee(t,e){zt(t,yee);let r=It(e,"productDetails",8),n=It(e,"purchaseOption",8),a=It(e,"showProductDescription",8),i=It(e,"priceBreakdown",8);const o=n(),c=o?.base,u=o?.trial,d=o?.introPrice;var f=gee(),h=Le(f),m=Le(h);uee(m,{get productDetails(){return r()},get showProductDescription(){return a()}});var _=kt(m,2);mee(_,{get priceBreakdown(){return i()},basePhase:c,trialPhase:u,introPricePhase:d});var w=kt(h,2);iee(w,{get priceBreakdown(){return i()},trialPhase:u}),ke(t,f)}const Wh=t=>`https://da08ctfrofx1b.cloudfront.net/${t}`;var _ee=lt('<div class="rcb-ui-container svelte-1h6xr8z"><!></div>');const bee={hash:"svelte-1h6xr8z",code:`.rcb-ui-container.svelte-1h6xr8z {display:flex;flex-direction:column;inset:0;color-scheme:none;line-height:1.5em;font-family:-apple-system,
      BlinkMacSystemFont,
      avenir next,
      avenir,
      segoe ui,
      helvetica neue,
      helvetica,
      Cantarell,
      Ubuntu,
      roboto,
      noto,
      arial,
      sans-serif;overflow-x:hidden;overflow-y:auto;}.rcb-ui-container.fullscreen.svelte-1h6xr8z {position:fixed;top:0;left:0;right:0;bottom:0;overscroll-behavior:none;z-index:1000001;}.rcb-ui-container.inside.svelte-1h6xr8z {position:relative;width:100%;z-index:unset;height:100%;top:0;left:0;}`};function kee(t,e){Wt(e,!0),zt(t,bee);const r=It(e,"brandingAppearance",3,void 0),n=It(e,"brandFontConfig",3,void 0),a=It(e,"isInElement",3,!1),i=ze(()=>new Bm(r()).getTextStyleVars(n())),o=ze(()=>new Bm(r()).spacingStyleVars),c=ze(()=>[$(i),$(o)].join("; ")),u=ze(()=>{var m;return(m=n())!=null&&m.font_url?Wh(n().font_url):null}),d=async m=>{try{const _=new FontFace(AU,`url(${m})`);await _.load(),document.fonts.add(_)}catch{}};ip(()=>{$(u)&&d($(u))});var f=_ee(),h=Le(f);Dn(h,()=>e.children??Ar),mt(()=>{Ut(f,"style",$(c)),Lc(f,"fullscreen",!a()),Lc(f,"inside",a())}),ke(t,f),Kt()}var wee=lt('<div id="layout-query-container" class="svelte-1x4ow5d"><div class="rcb-ui-layout svelte-1x4ow5d"><!></div></div>');const See={hash:"svelte-1x4ow5d",code:`#layout-query-container.svelte-1x4ow5d {width:100%;height:100%;container-type:size;container-name:layout-query-container;overflow-y:auto;overscroll-behavior:none;}.rcb-ui-layout.svelte-1x4ow5d {width:100%;min-height:100%;display:flex;box-sizing:border-box;flex-direction:column;overflow-y:auto;overscroll-behavior:none;}

  @container layout-query-container (width < 768px) {.rcb-ui-layout.svelte-1x4ow5d {flex-grow:1;}
  }

  @container layout-query-container (width >= 768px) {.rcb-ui-layout.svelte-1x4ow5d {flex-direction:row;}
  }`};function Eee(t,e){Wt(e,!1),zt(t,See);let r=It(e,"style",8,""),n=It(e,"children",8);ws();var a=wee(),i=Le(a),o=Le(i);Dn(o,()=>n()??Ar),mt(()=>Ut(i,"style",r())),ke(t,a),Kt()}const Tee=t=>t;function Cee(t){const e=t-1;return e*e*e+1}function QO(t){const e=typeof t=="string"&&t.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/);return e?[parseFloat(e[1]),e[2]||"px"]:[t,"px"]}function xee(t,{delay:e=0,duration:r=400,easing:n=Tee}={}){const a=+getComputedStyle(t).opacity;return{delay:e,duration:r,easing:n,css:i=>`opacity: ${i*a}`}}function Pee(t,{delay:e=0,duration:r=400,easing:n=Cee,x:a=0,y:i=0,opacity:o=0}={}){const c=getComputedStyle(t),u=+c.opacity,d=c.transform==="none"?"":c.transform,f=u*(1-o),[h,m]=QO(a),[_,w]=QO(i);return{delay:e,duration:r,easing:n,css:(b,E)=>`
			transform: ${d} translate(${(1-b)*h}${m}, ${(1-b)*_}${w});
			opacity: ${u-f*E}`}}var Aee=lt('<div><div class="layout-wrapper svelte-1w6qvx7"><div><!></div></div></div>');const Ree={hash:"svelte-1w6qvx7",code:`.layout-wrapper-outer.svelte-1w6qvx7 {flex:1;display:flex;background-color:var(--rc-color-background);}.layout-wrapper-outer.rcb-navbar.svelte-1w6qvx7 {justify-content:flex-end;}.layout-wrapper.svelte-1w6qvx7 {width:100%;}.layout-content.svelte-1w6qvx7 {box-sizing:border-box;background-color:var(--rc-color-background);color:var(--rc-color-grey-text-dark);display:flex;flex-direction:column;}.layout-content.rcb-navbar.svelte-1w6qvx7 {display:flex;flex-direction:column;gap:var(--rc-spacing-gapXLarge-mobile);}

  @container layout-query-container (width < 768px) {.layout-wrapper.svelte-1w6qvx7 {width:100%;min-width:300px;display:flex;flex-grow:1;}.layout-content.svelte-1w6qvx7 {flex-grow:1;height:100%;}.layout-content.rcb-navbar.svelte-1w6qvx7 {padding-bottom:var(--rc-spacing-outerPadding-mobile);}.layout-content.rcb-main-block.svelte-1w6qvx7 {padding:var(--rc-spacing-outerPadding-mobile);}
  }

  @container layout-query-container (width >= 768px) {.layout-wrapper.svelte-1w6qvx7 {flex-basis:544px;}.layout-content.rcb-main-block.svelte-1w6qvx7 {padding-left:var(--rc-spacing-outerPadding-desktop);padding-right:var(--rc-spacing-outerPadding-desktop);}.layout-content.rcb-navbar.svelte-1w6qvx7 {gap:var(--rc-spacing-gapXXLarge-desktop);}.layout-wrapper-outer.svelte-1w6qvx7 {padding-top:var(--rc-spacing-outerPaddingTop-desktop);padding-bottom:var(--rc-spacing-outerPadding-desktop);}
  }`};function zU(t,e){Wt(e,!0),zt(t,Ree);const r=`rcb-${e.location}`;var n=Aee();Ql(n,`layout-wrapper-outer ${r??""} svelte-1w6qvx7`);var a=Le(n),i=Le(a);Ql(i,`layout-content ${r??""} svelte-1w6qvx7`);var o=Le(i);Dn(o,()=>e.children??Ar),eU(3,i,()=>xee,()=>({duration:500,delay:50})),ke(t,n),Kt()}var Dee=lt('<div class="navbar-body svelte-jz90ay"><!></div>'),Oee=lt('<div class="navbar-header svelte-jz90ay"><!></div> <!>',1),Nee=lt('<div class="rcb-ui-navbar svelte-jz90ay"><!></div>');const Iee={hash:"svelte-jz90ay",code:`.rcb-ui-navbar.svelte-jz90ay {width:100%;max-width:none;flex-shrink:0;background-color:var(--rc-color-background);}

  @container layout-query-container (width < 768px) {.navbar-body.svelte-jz90ay {padding-left:var(--rc-spacing-outerPadding-mobile);padding-right:var(--rc-spacing-outerPadding-mobile);}
  }

  @container layout-query-container (width >= 768px) {.rcb-ui-navbar.svelte-jz90ay {width:50vw;display:flex;justify-content:flex-end;}.navbar-header.svelte-jz90ay {padding-left:var(--rc-spacing-outerPadding-desktop);padding-right:var(--rc-spacing-outerPadding-desktop);}.navbar-body.svelte-jz90ay {padding-left:var(--rc-spacing-outerPadding-desktop);padding-right:var(--rc-spacing-outerPadding-desktop);}
  }`};function Mee(t,e){Wt(e,!0),zt(t,Iee);const r=It(e,"brandingAppearance",3,void 0),n=ze(()=>new Bm(r()).productInfoStyleVars);var a=Nee(),i=Le(a);zU(i,{location:"navbar",children:(o,c)=>{var u=Oee(),d=Xt(u),f=Le(d);Dn(f,()=>e.headerContent??Ar);var h=kt(d,2);{var m=_=>{var w=Dee(),b=Le(w);Dn(b,()=>e.bodyContent??Ar),ke(_,w)};xt(h,_=>{e.bodyContent&&_(m)})}ke(o,u)},$$slots:{default:!0}}),mt(()=>Ut(a,"style",$(n))),ke(t,a),Kt()}var jee=lt('<button class="rcb-close-button svelte-nssttr" data-testid="close-button"><!></button>');const Lee={hash:"svelte-nssttr",code:".rcb-close-button.svelte-nssttr {padding:10px;border:none;cursor:pointer;background-color:transparent;border-radius:50%;color:var(--rc-color-grey-text-dark);display:inline-flex;align-items:center;justify-content:center;width:fit-content;height:fit-content;}.rcb-close-button.svelte-nssttr:active {transition:outline 0.1s ease-in-out;outline:2px solid var(--rc-color-focus);}.rcb-close-button.svelte-nssttr:hover {color:var(--rc-color-grey-text-dark);}"};function $U(t,e){zt(t,Lee);var r=jee(),n=Le(r);Um(n,{name:"close"}),jo("click",r,function(a){rU.call(this,e,a)}),ke(t,r)}const Bee=`<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none">
    <g clip-path="url(#clip0_6333_13826)">
    <rect opacity="0.2" width="12" height="12" rx="2.25" fill="black"/>
    <path fill-rule="evenodd" clip-rule="evenodd" d="M8.53206 2.06972C9.28201 2.17252 9.88339 2.78615 9.96146 3.52824L10.2298 6.07852C10.2893 6.64453 9.87503 7.12287 9.30441 7.14692C8.73379 7.17097 8.22294 6.73163 8.16339 6.16562L8.08036 5.37641L6.00414 7.35193C5.6039 7.73275 4.94623 7.70146 4.53518 7.28205C4.12413 6.86263 4.11537 6.2139 4.51561 5.83307L6.59182 3.85756L5.79425 3.74823C5.22225 3.66982 4.79448 3.15142 4.83881 2.59036C4.88313 2.02929 5.38276 1.63802 5.95476 1.71643L8.53206 2.06972Z" fill="black"/>
    </g>
    <defs>
    <clipPath id="clip0_6333_13826">
    <rect width="12" height="12" fill="white"/>
    </clipPath>
    </defs>
    </svg>
`;var Uee=lt('<div style="color:var(--rc-color-accent);" class="rcb-ui-asset-icon svelte-5vi85d"><!></div>');const Fee={hash:"svelte-5vi85d",code:"div.svelte-5vi85d {height:12px;width:12px;}"};function qee(t){zt(t,Fee);var e=Uee(),r=Le(e);fu(r,()=>Bee),ke(t,e)}var zee=lt('<span class="rcb-sandbox-text svelte-18xxdea">SANDBOX</span>'),$ee=lt('<span class="rcb-sandbox-text svelte-18xxdea">Share feedback</span>'),Vee=lt('<a class="rcb-ui-sandbox-banner-link svelte-18xxdea" target="_blank"><!> <!></a>'),Hee=lt('<div class="rcb-ui-sandbox-banner svelte-18xxdea"><div class="rcb-sandbox-banner-spacer svelte-18xxdea"></div> <div class="rcb-sandbox-banner-title-wrapper svelte-18xxdea"><!></div> <div class="rcb-sandbox-banner-actions-wrapper svelte-18xxdea" style="--arrow-fill-color: black"><!> <!></div></div>');const Gee={hash:"svelte-18xxdea",code:`.rcb-ui-sandbox-banner.svelte-18xxdea {position:static;background-color:var(--rc-color-warning);color:black;padding:var(--rc-spacing-gapMedium-mobile) 0;display:flex;justify-content:space-between;align-items:center;height:24px;}.rcb-sandbox-text.svelte-18xxdea {font-weight:bold;color:black;line-height:2;}.rcb-sandbox-banner-spacer.svelte-18xxdea {flex:1;}.rcb-sandbox-banner-title-wrapper.svelte-18xxdea {flex:0;text-align:center;}

  @media (max-width: 768px) {.rcb-sandbox-banner-spacer.svelte-18xxdea {flex:0;}.rcb-sandbox-banner-title-wrapper.svelte-18xxdea {padding-left:var(--rc-spacing-gapXXLarge-mobile);}
  }.rcb-sandbox-banner-actions-wrapper.svelte-18xxdea {flex:1;display:flex;justify-content:flex-end;align-items:center;}.rcb-ui-sandbox-banner-link.svelte-18xxdea {display:flex;align-items:center;gap:var(--rc-spacing-gapSmall-mobile);line-height:12px;}`};function Wee(t,e){Wt(e,!1),zt(t,Gee);let r=It(e,"style",8,""),n=It(e,"isInElement",8,!1),a=It(e,"brandingInfo",8,null),i=Ls(!0);function o(){tr.debugLog("closeBanner"),pt(i,!1)}ws();var c=wr(),u=Xt(c);{var d=f=>{var h=Hee(),m=kt(Le(h),2),_=Le(m);Pr(_,{size:"caption-default",children:(D,P)=>{var A=zee();ke(D,A)},$$slots:{default:!0}});var w=kt(m,2),b=Le(w);{var E=D=>{var P=Vee(),A=Le(P);qee(A);var C=kt(A,2);Pr(C,{size:"caption-link",children:(O,I)=>{var x=$ee();ke(O,x)},$$slots:{default:!0}}),mt(()=>Ut(P,"href",a().sandbox_configuration.checkout_feedback_form_url)),ke(D,P)};xt(b,D=>{var P;(P=a())!=null&&P.sandbox_configuration&&D(E)})}var T=kt(b,2);$U(T,{$$events:{click:o}}),mt(()=>{Ut(h,"style",r()),Lc(h,"isInElement",n())}),eU(2,h,()=>Pee,()=>({y:-100,duration:300})),ke(f,h)};xt(u,f=>{$(i)&&f(d)})}ke(t,c),Kt()}var Kee=lt('<div class="rcb-ui-main svelte-nr408n"><!></div>');const Yee={hash:"svelte-nr408n",code:".rcb-ui-main.svelte-nr408n {flex:1;display:flex;background-color:var(--rc-color-background);}"};function Xee(t,e){Wt(e,!0),zt(t,Yee);const r=ze(()=>new Bm(e.brandingAppearance).formStyleVars);var n=Kee(),a=Le(n);zU(a,{location:"main-block",children:(i,o)=>{var c=wr(),u=Xt(c);Dn(u,()=>e.children??Ar),ke(i,c)},$$slots:{default:!0}}),mt(()=>Ut(n,"style",$(r))),ke(t,n),Kt()}var Jee=lt("<!> <!>",1),Qee=lt("<!> <!>",1);function Zee(t,e){Wt(e,!0);const r=ze(()=>{var i;return OU((i=e.brandingInfo)==null?void 0:i.appearance)??""});var n=ze(()=>{var i;return(i=e.brandingInfo)==null?void 0:i.appearance}),a=ze(()=>{var i;return(i=e.brandingInfo)==null?void 0:i.brand_font_config});kee(t,{get brandingAppearance(){return $(n)},get brandFontConfig(){return $(a)},get isInElement(){return e.isInElement},children:(i,o)=>{var c=Qee(),u=Xt(c);{var d=h=>{Wee(h,{get style(){return $(r)},get isInElement(){return e.isInElement},get brandingInfo(){return e.brandingInfo}})};xt(u,h=>{e.isSandbox&&h(d)})}var f=kt(u,2);Eee(f,{get style(){return $(r)},children:(h,m)=>{var _=Jee(),w=Xt(_);{var b=D=>{var P=ze(()=>{var A;return(A=e.brandingInfo)==null?void 0:A.appearance});Mee(D,{get brandingAppearance(){return $(P)},get headerContent(){return e.navbarHeaderContent},get bodyContent(){return e.navbarBodyContent}})};xt(w,D=>{(e.navbarHeaderContent||e.navbarBodyContent)&&D(b)})}var E=kt(w,2),T=ze(()=>{var D;return(D=e.brandingInfo)==null?void 0:D.appearance});Xee(E,{get brandingAppearance(){return $(T)},children:(D,P)=>{var A=wr(),C=Xt(A);Dn(C,()=>e.mainContent??Ar),ke(D,A)},$$slots:{default:!0}}),ke(h,_)},$$slots:{default:!0}}),ke(i,c)},$$slots:{default:!0}}),Kt()}var ete=lt('<source type="image/webp">'),tte=lt('<picture class="rcb-app-icon-picture-container svelte-el1u77"><!> <img class="rcb-app-icon svelte-el1u77" alt="App icon"></picture>'),rte=lt('<div class="rcb-app-icon loading svelte-el1u77"></div>');const nte={hash:"svelte-el1u77",code:".rcb-app-icon.svelte-el1u77 {width:32px;height:32px;border-radius:12px;box-shadow:0px 1px 10px 0px rgba(0, 0, 0, 0.1);}.rcb-app-icon-picture-container.svelte-el1u77 {height:32px;}.rcb-app-icon.loading.svelte-el1u77 {background-color:gray;}"};function ate(t,e){zt(t,nte);var r=wr(),n=Xt(r);{var a=o=>{var c=tte(),u=Le(c);{var d=h=>{var m=ete();mt(()=>Ut(m,"srcset",e.srcWebp)),ke(h,m)};xt(u,h=>{e.srcWebp&&h(d)})}var f=kt(u,2);mt(()=>Ut(f,"src",e.src)),ke(o,c)},i=o=>{var c=rte();ke(o,c)};xt(n,o=>{e.src?o(a):o(i,!1)})}ke(t,r)}var ite=lt('<button class="rcb-back-button svelte-9xjbko" data-testid="close-button"><!></button>');const ste={hash:"svelte-9xjbko",code:".rcb-back-button.svelte-9xjbko {padding:8px;border:none;cursor:pointer;background-color:transparent;border-radius:50%;color:var(--rc-color-grey-text-dark);display:inline-flex;align-items:center;justify-content:center;width:fit-content;height:fit-content;}"};function ote(t,e){zt(t,ste);var r=ite(),n=Le(r);Um(n,{name:"back"}),jo("click",r,function(a){rU.call(this,e,a)}),ke(t,r)}var cte=lt('<source type="image/webp" class="rcb-app-icon svelte-19gv4gf">'),lte=lt('<picture class="rcb-app-icon svelte-19gv4gf"><!> <img class="rcb-app-icon svelte-19gv4gf" alt="App icon"></picture>');const ute={hash:"svelte-19gv4gf",code:".rcb-app-icon.svelte-19gv4gf {height:32px;}"};function dte(t,e){zt(t,ute);var r=lte(),n=Le(r);{var a=o=>{var c=cte();mt(()=>Ut(c,"srcset",e.srcWebp)),ke(o,c)};xt(n,o=>{e.srcWebp&&o(a)})}var i=kt(n,2);mt(()=>Ut(i,"src",e.src)),ke(t,r)}var fte=lt('<div class="rcb-back-wrapper svelte-11zapuq"><!></div>'),pte=lt('<div class="rcb-close-wrapper svelte-11zapuq"><!></div>'),hte=lt('<div class="rcb-header-wrapper svelte-11zapuq"><!> <div class="rcb-header svelte-11zapuq"><div class="rcb-title svelte-11zapuq"><!> <!></div></div> <!></div>');const mte={hash:"svelte-11zapuq",code:`.rcb-header-wrapper.svelte-11zapuq {display:flex;position:relative;justify-content:space-between;align-items:center;}.rcb-header.svelte-11zapuq {display:flex;flex-direction:row;align-items:center;padding-top:var(--rc-spacing-gapSmall-mobile);padding-bottom:var(--rc-spacing-gapSmall-mobile);height:40px;justify-content:space-between;}.rcb-title.svelte-11zapuq {display:flex;align-items:center;position:relative;gap:var(--rc-spacing-gapMedium-mobile);}.rcb-close-wrapper.svelte-11zapuq,
  .rcb-back-wrapper.svelte-11zapuq {padding:var(--rc-spacing-gapSmall-mobile);}

  @container layout-query-container (width < 768px) {.rcb-header.svelte-11zapuq {padding-top:var(--rc-spacing-gapMedium-mobile);}.rcb-close-wrapper.svelte-11zapuq {padding-top:var(--rc-spacing-gapMedium-mobile);}.rcb-header-wrapper.svelte-11zapuq {padding-top:var(--rc-spacing-gapSmall-mobile);padding-bottom:var(--rc-spacing-gapSmall-mobile);padding-left:var(--rc-spacing-outerPadding-mobile);padding-right:var(--rc-spacing-outerPadding-mobile);}.rcb-header-wrapper.rcb-with-close-button.svelte-11zapuq {padding-right:var(--rc-spacing-gapSmall-mobile);}.rcb-back-wrapper.svelte-11zapuq {display:none;}.rcb-header-wrapper.svelte-11zapuq {padding-left:var(--rc-spacing-outerPadding-mobile);padding-right:var(--rc-spacing-outerPadding-mobile);}
  }

  @container layout-query-container (width >= 768px) {.rcb-close-wrapper.svelte-11zapuq {display:none;}.rcb-back-wrapper.svelte-11zapuq {position:absolute;left:-48px;margin-left:0;}
  }`};function gte(t,e){Wt(e,!0),zt(t,mte);const r=x=>x==null||x==null||x==""?null:x,n=ze(()=>{var x;return r((x=e.brandingInfo)==null?void 0:x.app_icon)}),a=ze(()=>{var x;return r((x=e.brandingInfo)==null?void 0:x.app_icon_webp)}),i=ze(()=>{var x;return r((x=e.brandingInfo)==null?void 0:x.app_wordmark)}),o=ze(()=>{var x;return r((x=e.brandingInfo)==null?void 0:x.app_wordmark_webp)}),c=ze(()=>$(n)?Wh($(n)):null),u=ze(()=>$(a)?Wh($(a)):null),d=ze(()=>$(i)?Wh($(i)):null),f=ze(()=>$(o)?Wh($(o)):null),h=()=>{e.onClose&&e.onClose()};var m=hte(),_=Le(m);{var w=x=>{var R=fte(),N=Le(R);ote(N,{$$events:{click:h}}),ke(x,R)};xt(_,x=>{e.showCloseButton&&x(w)})}var b=kt(_,2),E=Le(b),T=Le(E);{var D=x=>{dte(x,{get src(){return $(d)},get srcWebp(){return $(f)}})},P=x=>{var R=wr(),N=Xt(R);{var L=j=>{ate(j,{get src(){return $(c)},get srcWebp(){return $(u)}})};xt(N,j=>{$(c)!==null&&$(u)!==null&&j(L)},!0)}ke(x,R)};xt(T,x=>{$(d)!==null?x(D):x(P,!1)})}var A=kt(T,2);{var C=x=>{Pr(x,{size:"body-base",children:(R,N)=>{var L=Ur();mt(()=>{var j;return hr(L,(j=e.brandingInfo)==null?void 0:j.app_name)}),ke(R,L)},$$slots:{default:!0}})};xt(A,x=>{$(d)===null&&x(C)})}var O=kt(b,2);{var I=x=>{var R=pte(),N=Le(R);$U(N,{$$events:{click:h}}),ke(x,R)};xt(O,x=>{e.showCloseButton&&x(I)})}mt(()=>Lc(m,"rcb-with-close-button",e.showCloseButton)),ke(t,m),Kt()}var yte=lt("<!> <!> <!> <!>",1);function vte(t,e){Wt(e,!0);const r=It(e,"onClose",3,void 0),n=UU(e.productDetails,e.purchaseOptionToUse);let a=sr(Vt(e.defaultPriceBreakdown??{currency:n.currency,totalAmountInMicros:n.amountMicros,totalExcludingTaxInMicros:n.amountMicros,taxCalculationStatus:"unavailable",taxAmountInMicros:null,taxBreakdown:null}));const i=o=>{pt(a,Vt(o))};Zee(t,{get brandingInfo(){return e.brandingInfo},get isInElement(){return e.isInElement},get isSandbox(){return e.isSandbox},get onClose(){return r()},navbarHeaderContent:o=>{var c=ze(()=>!e.isInElement&&!!r());gte(o,{get brandingInfo(){return e.brandingInfo},get onClose(){return r()},get showCloseButton(){return $(c)}})},navbarBodyContent:o=>{var c=ze(()=>{var u,d;return((d=(u=e.brandingInfo)==null?void 0:u.appearance)==null?void 0:d.show_product_description)??!1});vee(o,{get productDetails(){return e.productDetails},get purchaseOption(){return e.purchaseOptionToUse},get showProductDescription(){return $(c)},get priceBreakdown(){return $(a)}})},mainContent:o=>{var c=yte(),u=Xt(c);{var d=E=>{HZ(E)};xt(u,E=>{e.currentPage==="payment-entry-loading"&&E(d)})}var f=kt(u,2);{var h=E=>{uZ(E,{get productDetails(){return e.productDetails},get purchaseOption(){return e.purchaseOptionToUse},get brandingInfo(){return e.brandingInfo},get purchaseOperationHelper(){return e.purchaseOperationHelper},get gatewayParams(){return e.gatewayParams},get managementUrl(){return e.managementUrl},get customerEmail(){return e.customerEmail},get defaultPriceBreakdown(){return e.defaultPriceBreakdown},get onContinue(){return e.onContinue},get onError(){return e.onError},onPriceBreakdownUpdated:i})};xt(f,E=>{e.currentPage==="payment-entry"&&E(h)})}var m=kt(f,2);{var _=E=>{var T=ze(()=>{var P;return((P=e.brandingInfo)==null?void 0:P.support_email)??null}),D=ze(()=>{var P;return((P=e.brandingInfo)==null?void 0:P.app_name)??null});$Z(E,{get lastError(){return e.lastError},get productDetails(){return e.productDetails},get supportEmail(){return $(T)},get onDismiss(){return e.closeWithError},get appName(){return $(D)}})};xt(m,E=>{e.currentPage==="error"&&E(_)})}var w=kt(m,2);{var b=E=>{VZ(E,{get onContinue(){return e.onContinue}})};xt(w,E=>{e.currentPage==="success"&&E(b)})}ke(o,c)},$$slots:{navbarHeaderContent:!0,navbarBodyContent:!0,mainContent:!0}}),Kt()}function _te(t){return t.trim()===""?"You need to provide your email address to continue.":t.match(/^[^@]+@[^@]+\.[^@]+$/)?null:"Email is not valid. Please provide a valid email address."}function bte(t){if(t&&!t.match(/^[A-Z]{3}$/)){const e=`Currency code ${t} is not valid. Please provide a valid ISO 4217 currency code.`;throw tr.errorLog(e),new bn(Un.ConfigurationError,e)}}function kte(t,e){var r;Wt(e,!0);const n=It(e,"customTranslations",19,()=>({})),a=It(e,"skipSuccessPage",3,!1),i=e.customerEmail?_te(e.customerEmail):null;let o=sr(Vt(i?void 0:e.customerEmail)),c=e.rcPackage.webBillingProduct,u=sr(null);const d=e.rcPackage.webBillingProduct.identifier??null;let f=sr("payment-entry-loading"),h=sr(null),m=sr(Vt({})),_=sr(null),w=sr(null),b=sr(null),E=sr(null),T=new Wb(n(),e.selectedLocale,e.defaultLocale),D=Wx(T);ed(Bi,D),ed(tP,(r=e.brandingInfo)==null?void 0:r.appearance),_s(()=>{e.isInElement||(pt(w,Vt(document.documentElement.style.height)),pt(b,Vt(document.documentElement.style.overflow)),pt(E,Vt(document.body.style.height)),document.documentElement.style.height="100%",document.body.style.height="100%",document.documentElement.style.overflow="hidden")}),Ig(()=>{if(!e.isInElement){const x=(R,N,L)=>{L===""?R.style.removeProperty(N):R.style.setProperty(N,L)};x(document.documentElement,"height",$(w)),x(document.body,"height",$(E)),x(document.documentElement,"overflow",$(b))}}),ed(eP,e.eventsTracker),_s(async()=>{if(d===null){A(new on(Hr.ErrorSettingUpPurchase,"Product ID was not set before purchase."));return}e.purchaseOperationHelper.checkoutStart(e.appUserId,d,e.purchaseOption,e.rcPackage.webBillingProduct.presentedOfferingContext,$(o),e.metadata).then(x=>{pt(u,null),pt(f,"payment-entry"),pt(m,Vt(x.gateway_params)),pt(_,Vt(x.management_url))}).catch(x=>{if(x.errorCode===Hr.MissingEmailError)return pt(o,void 0),e.purchaseOperationHelper.checkoutStart(e.appUserId,d,e.purchaseOption,e.rcPackage.webBillingProduct.presentedOfferingContext,$(o),e.metadata).then(R=>{pt(u,null),pt(f,"payment-entry"),pt(m,Vt(R.gateway_params)),pt(_,Vt(R.management_url))}).catch(R=>{A(R)});A(x)})});const P=()=>{if($(f)==="payment-entry"){e.purchaseOperationHelper.pollCurrentPurchaseForCompletion().then(x=>{pt(h,Vt(x)),a()?e.onFinished(x):pt(f,"success")}).catch(x=>{A(x)});return}if($(f)==="success"||$(f)==="error"){e.onFinished($(h));return}pt(f,"success")},A=x=>{const R=JJ({errorCode:x.getErrorCode().toString(),errorMessage:x.message});e.eventsTracker.trackSDKEvent(R),pt(u,Vt(x)),pt(f,"error")},C=()=>{e.onError($(u)??new on(Hr.UnknownError,"Unknown error without state set."))};var O=ze(()=>e.purchases.isSandbox()),I=ze(()=>$(o)??null);vte(t,{get isSandbox(){return $(O)},get currentPage(){return $(f)},get brandingInfo(){return e.brandingInfo},productDetails:c,get purchaseOptionToUse(){return e.purchaseOption},get lastError(){return $(u)},get gatewayParams(){return $(m)},get managementUrl(){return $(_)},get purchaseOperationHelper(){return e.purchaseOperationHelper},get isInElement(){return e.isInElement},get customerEmail(){return $(I)},closeWithError:C,onContinue:P,onError:A,get onClose(){return e.onClose}}),Kt()}function VU(t){return t==null?!0:new Date(t)>new Date}function wte(t,e,r,n){const a=e.product_identifier;if(a in r)return Ste(t,e,r[a]);if(a in n)return Ete(t,e,n[a]);throw new bn(Un.CustomerInfoError,"Could not find entitlement product in subscriptions or non-subscriptions.")}function Ste(t,e,r){return{identifier:t,isActive:VU(e.expires_date),willRenew:GU(e.expires_date,r),store:r?.store??"unknown",latestPurchaseDate:new Date(e.purchase_date),originalPurchaseDate:new Date(e.purchase_date),expirationDate:Do(e.expires_date),productIdentifier:e.product_identifier,productPlanIdentifier:e.product_plan_identifier??null,unsubscribeDetectedAt:Do(r?.unsubscribe_detected_at),billingIssueDetectedAt:Do(r?.billing_issues_detected_at),isSandbox:r?.is_sandbox??!1,periodType:r?.period_type??"normal",ownershipType:r?.ownership_type??"UNKNOWN"}}function Ete(t,e,r){return{identifier:t,isActive:!0,willRenew:!1,store:r.store,latestPurchaseDate:new Date(e.purchase_date),originalPurchaseDate:new Date(r.original_purchase_date),expirationDate:null,productIdentifier:e.product_identifier,productPlanIdentifier:null,unsubscribeDetectedAt:null,billingIssueDetectedAt:null,isSandbox:r.is_sandbox,periodType:"normal",ownershipType:"UNKNOWN"}}function Tte(t,e,r){const n={},a={};for(const i in t){const o=wte(i,t[i],e,r);n[i]=o,o.isActive&&(a[i]=o)}return{all:n,active:a}}function Do(t){return t==null?null:new Date(t)}function HU(t){const e=xte(t),r=t.subscriber,n=Ate(r.non_subscriptions),a=Object.entries(t.subscriber.non_subscriptions).flatMap(([c,u])=>u.map(d=>({transactionIdentifier:d.id,productIdentifier:c,purchaseDate:new Date(d.purchase_date||d.original_purchase_date),storeTransactionId:d.store_transaction_id||null,store:d.store}))),i=new Date(t.request_date),o=Object.fromEntries(Object.entries(t.subscriber.subscriptions).map(([c,u])=>[c,{productIdentifier:c,purchaseDate:new Date(u.purchase_date),originalPurchaseDate:Do(u.original_purchase_date),expiresDate:Do(u.expires_date),store:u.store,unsubscribeDetectedAt:Do(u.unsubscribe_detected_at),isSandbox:u.is_sandbox,billingIssuesDetectedAt:Do(u.billing_issues_detected_at),gracePeriodExpiresDate:Do(u.grace_period_expires_date),ownershipType:u.ownership_type??"UNKNOWN",periodType:u.period_type,refundedAt:Do(u.refunded_at),storeTransactionId:u.store_transaction_id||null,isActive:VU(u.expires_date),willRenew:GU(u.expires_date,u)}]));return{entitlements:Tte(r.entitlements,r.subscriptions,n),allExpirationDatesByProduct:e,allPurchaseDatesByProduct:Cte(t,n),activeSubscriptions:Pte(e),managementURL:r.management_url,requestDate:i,firstSeenDate:new Date(r.first_seen),originalPurchaseDate:Do(r.original_purchase_date),originalAppUserId:t.subscriber.original_app_user_id,nonSubscriptionTransactions:a,subscriptionsByProductIdentifier:o}}function GU(t,e){if(e==null)return!1;const r=e.store=="promotional",n=t==null,a=e.unsubscribe_detected_at!=null,i=e.billing_issues_detected_at!=null;return!(r||n||a||i)}function Cte(t,e){const r={};for(const n in t.subscriber.subscriptions){const a=t.subscriber.subscriptions[n];r[n]=new Date(a.purchase_date)}for(const n in e){const a=e[n].purchase_date;a==null?r[n]=null:r[n]=new Date(a)}return r}function xte(t){const e={};for(const r in t.subscriber.subscriptions){const n=t.subscriber.subscriptions[r];n.expires_date==null?e[r]=null:e[r]=new Date(n.expires_date)}return e}function Pte(t){const e=new Set,r=new Date;for(const n in t){const a=t[n];(a==null||a>r)&&e.add(n)}return e}function Ate(t){const e={};for(const r in t){if(t[r].length===0)continue;const n=t[r].length;e[r]=t[r][n-1]}return e}const WU="1.14.0",Rte="https://api.revenuecat.com",Dte="https://e.revenue.cat";var Y_;(function(t){t[t.CONTINUE=100]="CONTINUE",t[t.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",t[t.PROCESSING=102]="PROCESSING",t[t.EARLY_HINTS=103]="EARLY_HINTS",t[t.OK=200]="OK",t[t.CREATED=201]="CREATED",t[t.ACCEPTED=202]="ACCEPTED",t[t.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",t[t.NO_CONTENT=204]="NO_CONTENT",t[t.RESET_CONTENT=205]="RESET_CONTENT",t[t.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",t[t.MULTI_STATUS=207]="MULTI_STATUS",t[t.MULTIPLE_CHOICES=300]="MULTIPLE_CHOICES",t[t.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",t[t.MOVED_TEMPORARILY=302]="MOVED_TEMPORARILY",t[t.SEE_OTHER=303]="SEE_OTHER",t[t.NOT_MODIFIED=304]="NOT_MODIFIED",t[t.USE_PROXY=305]="USE_PROXY",t[t.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",t[t.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",t[t.BAD_REQUEST=400]="BAD_REQUEST",t[t.UNAUTHORIZED=401]="UNAUTHORIZED",t[t.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",t[t.FORBIDDEN=403]="FORBIDDEN",t[t.NOT_FOUND=404]="NOT_FOUND",t[t.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",t[t.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",t[t.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",t[t.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",t[t.CONFLICT=409]="CONFLICT",t[t.GONE=410]="GONE",t[t.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",t[t.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",t[t.REQUEST_TOO_LONG=413]="REQUEST_TOO_LONG",t[t.REQUEST_URI_TOO_LONG=414]="REQUEST_URI_TOO_LONG",t[t.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",t[t.REQUESTED_RANGE_NOT_SATISFIABLE=416]="REQUESTED_RANGE_NOT_SATISFIABLE",t[t.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",t[t.IM_A_TEAPOT=418]="IM_A_TEAPOT",t[t.INSUFFICIENT_SPACE_ON_RESOURCE=419]="INSUFFICIENT_SPACE_ON_RESOURCE",t[t.METHOD_FAILURE=420]="METHOD_FAILURE",t[t.MISDIRECTED_REQUEST=421]="MISDIRECTED_REQUEST",t[t.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",t[t.LOCKED=423]="LOCKED",t[t.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",t[t.UPGRADE_REQUIRED=426]="UPGRADE_REQUIRED",t[t.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",t[t.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",t[t.REQUEST_HEADER_FIELDS_TOO_LARGE=431]="REQUEST_HEADER_FIELDS_TOO_LARGE",t[t.UNAVAILABLE_FOR_LEGAL_REASONS=451]="UNAVAILABLE_FOR_LEGAL_REASONS",t[t.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",t[t.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",t[t.BAD_GATEWAY=502]="BAD_GATEWAY",t[t.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",t[t.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",t[t.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",t[t.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",t[t.NETWORK_AUTHENTICATION_REQUIRED=511]="NETWORK_AUTHENTICATION_REQUIRED"})(Y_||(Y_={}));const Ote=/^rcb_[a-zA-Z0-9_.-]+$/,Nte=/^pdl_[a-zA-Z0-9_.-]+$/,Ite=/^test_[a-zA-Z0-9_.-]+$/;function X_(t){return t?t.startsWith("rcb_sb_"):!1}function Mte(t){return t?Ote.test(t):!1}function jte(t){return t?Nte.test(t):!1}function qu(t){return t?Ite.test(t):!1}async function Ms(t,e,r){const{apiKey:n,body:a,headers:i,httpConfig:o}=e,c=`${o?.proxyURL??Rte}${t.urlPath()}`;try{const u=await fetch(c,{method:t.method,headers:rF(n,i,o?.additionalHeaders),body:Bte(a),signal:r});return await Lte(u,t),await u.json()}catch(u){throw u instanceof TypeError?new bn(Un.NetworkError,om.getPublicMessage(Un.NetworkError),u.message):u}}async function Lte(t,e){const r=t.status;if(r>=Y_.INTERNAL_SERVER_ERROR)Kw(e,r,await t.text());else if(r>=Y_.BAD_REQUEST){const n=await t.json(),a=n?JSON.stringify(n):null,i=n?.code,o=n?.message;if(i!=null){const c=om.convertCodeToBackendErrorCode(i);if(c==null)Kw(e,r,a,i);else throw bn.getForBackendError(c,o)}else Kw(e,r,a)}}function Kw(t,e,r,n){throw new bn(Un.UnknownBackendError,"Unknown backend error.",`Request: ${t.name}. Status code: ${e}. Body: ${r}.`,{backendErrorCode:n})}function Bte(t){return t==null?null:JSON.stringify(t)}const KU="Authorization",YU="Content-Type",XU="Accept",JU="X-Platform",QU="X-Version",ZU="X-Platform-Flavor",eF="X-Platform-Flavor-Version",tF="X-Is-Sandbox",Ute=new Set([KU,YU,XU,JU,QU,tF,ZU,eF]);function rF(t,e,r){let n={[KU]:`Bearer ${t}`,[YU]:"application/json",[XU]:"application/json",[JU]:"web",[QU]:WU,[tF]:`${X_(t)}`};const a=lm.getPlatformInfo();if(a){const i={[ZU]:a.flavor,[eF]:a.version};n={...n,...i}}return e&&(n={...n,...e}),r&&(n={...r,...n}),n}const Jb="/v1/subscribers",Ap="/rcbilling/v1";class Fte{constructor(e){vt(this,"appUserId"),vt(this,"method","GET"),vt(this,"name","getOfferings"),this.appUserId=e}urlPath(){const e=encodeURIComponent(this.appUserId);return`${Jb}/${e}/offerings`}}class qte{constructor(e,r,n){vt(this,"method","GET"),vt(this,"name","getProducts"),vt(this,"appUserId"),vt(this,"productIds"),vt(this,"currency"),this.appUserId=e,this.productIds=r,this.currency=n}urlPath(){const e=encodeURIComponent(this.appUserId),r=this.productIds.map(encodeURIComponent).join("&id="),n=this.currency?`&currency=${this.currency}`:"";return`${Ap}/subscribers/${e}/products?id=${r}${n}`}}class zte{constructor(e){vt(this,"method","GET"),vt(this,"name","getCustomerInfo"),vt(this,"appUserId"),this.appUserId=e}urlPath(){const e=encodeURIComponent(this.appUserId);return`${Jb}/${e}`}}class $te{constructor(){vt(this,"method","GET"),vt(this,"name","getBrandingInfo")}urlPath(){return`${Ap}/branding`}}class Vte{constructor(){vt(this,"method","POST"),vt(this,"name","postCheckoutStart")}urlPath(){return`${Ap}/checkout/start`}}class Hte{constructor(e){vt(this,"method","POST"),vt(this,"name","postCheckoutCalculateTax"),vt(this,"operationSessionId"),this.operationSessionId=e}urlPath(){return`${Ap}/checkout/${this.operationSessionId}/calculate_taxes`}}class Gte{constructor(e){vt(this,"method","POST"),vt(this,"name","postCheckoutComplete"),vt(this,"operationSessionId"),this.operationSessionId=e}urlPath(){return`${Ap}/checkout/${this.operationSessionId}/complete`}}class Wte{constructor(e){vt(this,"method","GET"),vt(this,"name","getCheckoutStatus"),vt(this,"operationSessionId"),this.operationSessionId=e}urlPath(){return`${Ap}/checkout/${this.operationSessionId}`}}class Kte{constructor(e){vt(this,"method","POST"),vt(this,"name","setAttributes"),vt(this,"appUserId"),this.appUserId=e}urlPath(){const e=encodeURIComponent(this.appUserId);return`${Jb}/${e}/attributes`}}class Yte{constructor(){vt(this,"method","POST"),vt(this,"name","postReceipt")}urlPath(){return"/v1/receipts"}}class Xte{constructor(e){vt(this,"method","GET"),vt(this,"name","getVirtualCurrencies"),vt(this,"appUserId"),this.appUserId=e}urlPath(){const e=encodeURIComponent(this.appUserId);return`${Jb}/${e}/virtual_currencies`}}const MT={};class Jte{constructor(e,r=MT){vt(this,"API_KEY"),vt(this,"httpConfig"),vt(this,"isSandbox"),this.API_KEY=e,this.httpConfig=r,this.isSandbox=X_(e)}getIsSandbox(){return this.isSandbox}async getOfferings(e){return await Ms(new Fte(e),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getCustomerInfo(e){return await Ms(new zte(e),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getProducts(e,r,n){return await Ms(new qte(e,r,n),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getBrandingInfo(){return await Ms(new $te,{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async postCheckoutStart(e,r,n,a,i,o,c=void 0){const u={app_user_id:e,product_id:r,email:o,price_id:a.priceId,presented_offering_identifier:n.offeringIdentifier,trace_id:i};return c&&(u.metadata=c),a.id!=="base_option"&&(u.offer_id=a.id),n.targetingContext&&(u.applied_targeting_rule={rule_id:n.targetingContext.ruleId,revision:n.targetingContext.revision}),n.placementIdentifier&&(u.presented_placement_identifier=n.placementIdentifier),await Ms(new Vte,{apiKey:this.API_KEY,body:u,httpConfig:this.httpConfig})}async postCheckoutCalculateTax(e,r,n,a){const i={country_code:r,postal_code:n};return await Ms(new Hte(e),{apiKey:this.API_KEY,body:i,httpConfig:this.httpConfig},a)}async postCheckoutComplete(e,r){const n={email:r};return await Ms(new Gte(e),{apiKey:this.API_KEY,body:n,httpConfig:this.httpConfig})}async getCheckoutStatus(e){return await Ms(new Wte(e),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async setAttributes(e,r){const n=Date.now(),a={};for(const[o,c]of Object.entries(r))a[o]={value:c,updated_at_ms:n};const i={attributes:a};return await Ms(new Kte(e),{apiKey:this.API_KEY,body:i,httpConfig:this.httpConfig})}async postReceipt(e,r,n,a,i,o){let c=null;i.targetingContext&&(c={rule_id:i.targetingContext.ruleId,revision:i.targetingContext.revision});const u={fetch_token:a,product_id:r,currency:n,app_user_id:e,presented_offering_identifier:i.offeringIdentifier,presented_placement_identifier:i.placementIdentifier,applied_targeting_rule:c,initiation_source:o};return await Ms(new Yte,{apiKey:this.API_KEY,body:u,httpConfig:this.httpConfig})}async getVirtualCurrencies(e){return await Ms(new Xte(e),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}}function Qte(t,e){if(!(Mte(t)||qu(t)||jte(t)&&e?.allowPaddleAPIKey))throw new bn(Un.InvalidCredentialsError,"Invalid API key. Use your Web Billing API key.")}function ZO(t){if(!t||new Set(["no_user","null","none","nil","(null)","NaN","\\x00","","unidentified","undefined","unknown"]).has(t)||t.includes("/"))throw new bn(Un.InvalidAppUserIdError,'Provided user id: "'+(t??"[Not provided]")+'" is not valid. See https://www.revenuecat.com/docs/customers/user-ids#tips-for-setting-app-user-ids for more information.')}function Zte(t){if(t!=null&&t.endsWith("/"))throw new bn(Un.ConfigurationError,"Invalid proxy URL. The proxy URL should not end with a trailing slash.")}function ere(t){if(t){for(const e in t)if(Ute.has(e))throw new bn(Un.ConfigurationError,"Invalid additional headers. Some headers are reserved for internal use.")}}var nF=(t=>(t.Current="current",t))(nF||{});function tre(t,e){async function r(...n){return await this.preload(),await t.call(this,...n)}return r}const aF=(t,e)=>{const r={...t.webBillingProduct,presentedOfferingContext:{...t.webBillingProduct.presentedOfferingContext,placementIdentifier:e}};return{...t,webBillingProduct:r,rcBillingProduct:r}},Mu=(t,e)=>t==null?null:aF(t,e),rre=(t,e,r)=>{const n=t.offering_ids_by_placement??null;if(n==null)return null;const a=t.fallback_offering_id??null;let i;if(r in n){const c=n[r]??null;if(c==null)return null;i=e[c],i==null&&(i=e[a])}else i=e[a];if(i==null)return null;const o=Object.fromEntries(Object.entries(i.packagesById).map(([c,u])=>[c,aF(u,r)]));return{...i,packagesById:o,availablePackages:Object.values(o),weekly:Mu(i.weekly,r),monthly:Mu(i.monthly,r),twoMonth:Mu(i.twoMonth,r),threeMonth:Mu(i.threeMonth,r),sixMonth:Mu(i.sixMonth,r),annual:Mu(i.annual,r),lifetime:Mu(i.lifetime,r)}};function nre(t,e){const r={};e.product_details.forEach(i=>{r[i.identifier]=i});const n={};t.offerings.forEach(i=>{const o=i.identifier===t.current_offering_id,c=_Z(o,i,r,t.targeting);c!=null&&(n[i.identifier]=c)});const a=t.current_offering_id?n[t.current_offering_id]??null:null;return Object.keys(n).length==0&&tr.debugLog("Empty offerings. Please make sure you've configured offerings correctly in the RevenueCat dashboard and that the products are properly configured."),{all:n,current:a}}const are=1000001;function ire(t){return t.webBillingProduct.defaultPurchaseOption}function eN(t,e,r,n=!1){return r.translate(Ot.PaywallVariablesPricePerPeriod,{formattedPrice:t,period:e.base.period?r.translatePeriod(e.base.period.number,e.base.period.unit,{noWhitespace:!0,short:!n}):""})}function sre(t,e){return t.unit==="year"?e.translatePeriod(t.number*12,Ea.Month):e.translatePeriod(t.number,t.unit)}function ore({price:t,period:e,translator:r}){const n=r.formatPrice(t.amountMicros,t.currency);return e?e.unit==="year"?r.formatPrice(t.amountMicros/12/4,t.currency):e.unit==="month"||e.unit==="week"&&e.number>1?r.formatPrice(t.amountMicros/e.number,t.currency):e.unit==="day"?r.formatPrice(t.amountMicros*7/e.number,t.currency):n:n}function cre({price:t,period:e,translator:r}){const n=r.formatPrice(t.amountMicros,t.currency);return!e||!e.number?n:e.unit==="year"?r.formatPrice(t.amountMicros/12,t.currency):e.unit==="month"&&e.number>1?r.formatPrice(t.amountMicros/e.number,t.currency):e.unit==="week"?r.formatPrice(t.amountMicros*4/e.number,t.currency):e.unit==="day"?r.formatPrice(t.amountMicros*30/e.number,t.currency):n}function tN({price:t,period:e,full:r=!1,translator:n}){if(!e||!e.number||e.unit===Ea.Month&&e.number==1)return n.formatPrice(t.amountMicros,t.currency);let a="";switch(e.unit){case Ea.Year:a=n.formatPrice(t.amountMicros/12,t.currency);break;case Ea.Month:a=n.formatPrice(t.amountMicros/e.number,t.currency);break;case Ea.Week:a=n.formatPrice(t.amountMicros*4/e.number,t.currency);break;case Ea.Day:a=n.formatPrice(t.amountMicros*30/e.number,t.currency);break}return n.translate(Ot.PaywallVariablesTotalPriceAndPerMonth,{formattedPrice:n.formatPrice(t.amountMicros,t.currency),period:n.translatePeriod(e.number,e.unit,{noWhitespace:!0,short:!r}),formattedPricePerMonth:a,monthPeriod:n.translatePeriodUnit(Ea.Month,{noWhitespace:!0,short:!r})})}function lre(t,e){const r=t.availablePackages,n=r.reduce((a,i)=>{const o=a.webBillingProduct.price||a.webBillingProduct.price,c=i.webBillingProduct.price||i.webBillingProduct.price;return o.amountMicros>c.amountMicros?a:i});return r.reduce((a,i)=>(a[i.identifier]=ure(i,n,e),a),{})}function ure(t,e,r){const n=t.webBillingProduct,a=n.price||n.price,i=r.formatPrice(a.amountMicros,a.currency),o=ire(t),c=n.productType,u={product_name:n.title,price:i,price_per_period:"",price_per_period_full:"",total_price_and_per_month:"",total_price_and_per_month_full:"",sub_price_per_month:"",sub_price_per_week:"",sub_duration:"",sub_duration_in_months:"",sub_period:"",sub_period_length:"",sub_period_abbreviated:"",sub_offer_duration:void 0,sub_offer_duration_2:void 0,sub_offer_price:void 0,sub_offer_price_2:void 0,sub_relative_discount:""};if(c===td.Subscription&&o){u.price_per_period=eN(i,o,r),u.price_per_period_full=eN(i,o,r,!0);const d=n.period||o.base.period;u.total_price_and_per_month=tN({price:a,period:d,translator:r}),u.total_price_and_per_month_full=tN({price:a,period:d,full:!0,translator:r}),u.sub_price_per_month=cre({price:a,period:d,translator:r}),u.sub_price_per_week=ore({price:a,period:d,translator:r}),u.sub_duration=r.translatePeriod(d?.number,d?.unit),u.sub_duration_in_months=sre(d,r),u.sub_period=r.translatePeriodFrequency(d?.number,d?.unit),u.sub_period_length=d?r.translatePeriodUnit(d.unit,{noWhitespace:!0}):void 0,u.sub_period_abbreviated=d?r.translatePeriodUnit(d.unit,{noWhitespace:!0,short:!0}):void 0;const f=a.amountMicros,h=(e.webBillingProduct.price||e.webBillingProduct.price).amountMicros,m=((h-f)*100/h).toFixed(0);u.sub_relative_discount=f===h?"":r.translate(Ot.PaywallVariablesSubRelativeDiscount,{discount:m})}return(c===td.NonConsumable||c===td.Consumable)&&o&&(u.price=i,u.price_per_period=i,u.price_per_period_full=i,u.total_price_and_per_month=i,u.sub_price_per_month=i,u.sub_duration=r.translate(Ot.PeriodsLifetime),u.sub_duration_in_months=r.translate(Ot.PeriodsLifetime),u.sub_period=r.translate(Ot.PeriodsLifetime),u.sub_price_per_week=void 0,u.sub_relative_discount=void 0,u.price_per_period_full=i,u.total_price_and_per_month_full=i,u.sub_period_length=void 0,u.sub_period_abbreviated=void 0),u}function rN(t){for(let e=0;e<t.length;e++)t[e]=Math.floor(Math.random()*256)}function Fm(){const t=typeof crypto<"u"?crypto:globalThis.crypto;if(t&&t.randomUUID)return t.randomUUID();const e=new Uint8Array(16);try{t&&t.getRandomValues?t.getRandomValues(e):rN(e)}catch{rN(e)}e[6]=e[6]&15|64,e[8]=e[8]&63|128;const r=Array.from(e).map(n=>n.toString(16).padStart(2,"0"));return[r.slice(0,4).join(""),r.slice(4,6).join(""),r.slice(6,8).join(""),r.slice(8,10).join(""),r.slice(10,16).join("")].join("-")}var dre=/(%?)(%([sdijo]))/g;function fre(t,e){switch(e){case"s":return t;case"d":case"i":return Number(t);case"j":return JSON.stringify(t);case"o":{if(typeof t=="string")return t;const r=JSON.stringify(t);return r==="{}"||r==="[]"||/^\[object .+?\]$/.test(r)?t:r}}}function oP(t,...e){if(e.length===0)return t;let r=0,n=t.replace(dre,(a,i,o,c)=>{const u=e[r],d=fre(u,c);return i?a:(r++,d)});return r<e.length&&(n+=` ${e.slice(r).join(" ")}`),n=n.replace(/%{2,2}/g,"%"),n}var pre=2;function hre(t){if(!t.stack)return;const e=t.stack.split(`
`);e.splice(1,pre),t.stack=e.join(`
`)}var mre=class extends Error{constructor(t,...e){super(t),this.message=t,this.name="Invariant Violation",this.message=oP(t,...e),hre(this)}},iF=(t,e,...r)=>{if(!t)throw new mre(e,...r)};iF.as=(t,e,r,...n)=>{if(!e){const a=n.length===0?r:oP(r,...n);let i;try{i=Reflect.construct(t,[a])}catch{i=t(a)}throw i}};const gre="[MSW]";function yre(t,...e){const r=oP(t,...e);return`${gre} ${r}`}function vre(t,...e){}function _re(t,...e){}const bre={formatMessage:yre,warn:vre,error:_re};function kre(){iF(typeof URL<"u",bre.formatMessage(`Global "URL" class is not defined. This likely means that you're running MSW in an environment that doesn't support all Node.js standard API (e.g. React Native). If that's the case, please use an appropriate polyfill for the "URL" class, like "react-native-url-polyfill".`))}var sF=(t=>(t.HEAD="HEAD",t.GET="GET",t.POST="POST",t.PUT="PUT",t.PATCH="PATCH",t.OPTIONS="OPTIONS",t.DELETE="DELETE",t))(sF||{});kre();class wre{constructor(e,r,n,a){vt(this,"initialDelay"),vt(this,"maxDelay"),vt(this,"jitterPercent"),vt(this,"callback"),vt(this,"currentDelay"),vt(this,"timeoutId"),vt(this,"executingCallback",!1),this.initialDelay=e,this.currentDelay=e,this.maxDelay=r,this.jitterPercent=n,this.callback=a}tryFlush(){if(this.backingOff()){tr.debugLog("Backing off, not flushing");return}this.clearTimeout(),this.executeCallbackWithRetries()}stop(){this.clearTimeout()}schedule(e){if(this.timeoutId!==void 0)return;const r=this.addJitter(e||this.currentDelay);this.timeoutId=setTimeout(()=>{this.timeoutId=void 0,this.executeCallbackWithRetries()},r)}backoff(){const e=this.currentDelay,r=Math.min(this.currentDelay*2,this.maxDelay);tr.debugLog(`Backing next off to ${e}ms delay`),this.clearTimeout(),this.currentDelay=r,this.schedule(e)}reset(){this.currentDelay!==this.initialDelay&&(this.clearTimeout(),this.currentDelay=this.initialDelay)}async executeCallbackWithRetries(){if(this.executingCallback){tr.debugLog("Callback already running, rescheduling"),this.schedule();return}this.executingCallback=!0;try{await this.callback(),this.reset()}catch{this.backoff()}finally{this.executingCallback=!1}}backingOff(){return this.currentDelay>this.initialDelay}clearTimeout(){clearTimeout(this.timeoutId),this.timeoutId=void 0}addJitter(e){const r=e*this.jitterPercent,n=e-r,a=e+r;return Math.floor(Math.random()*(a-n+1)+n)}}function oF(t){const e={};for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)){const n=r.replace(/([A-Z])/g,"_$1").toLowerCase(),a=t[r];a&&typeof a=="object"&&!Array.isArray(a)?e[n]=oF(a):e[n]=a}return e}class Sre{constructor(e){vt(this,"EVENT_TYPE","web_billing"),vt(this,"id"),vt(this,"timestampMs"),vt(this,"data"),this.id=Fm(),this.timestampMs=Date.now(),this.data=e}toJSON(){return oF({id:this.id,timestampMs:this.timestampMs,type:this.EVENT_TYPE,eventName:this.data.eventName,appUserId:this.data.appUserId,context:{...this.data.context},properties:{...this.data.properties,traceId:this.data.traceId}})}}function Ere(t,e){const r=new URLSearchParams(window.location.search);return{libraryName:"purchases-js",libraryVersion:WU,locale:navigator.language,userAgent:navigator.userAgent,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,screenWidth:screen.width,screenHeight:screen.height,utmSource:r.get("utm_source")??null,utmMedium:r.get("utm_medium")??null,utmCampaign:r.get("utm_campaign")??null,utmContent:r.get("utm_content")??null,utmTerm:r.get("utm_term")??null,pageReferrer:document.referrer,pageUrl:`${window.location.origin}${window.location.pathname}`,pageTitle:document.title,source:t,rcSource:e}}const Tre=2e3,Cre=5*6e4,xre=.1;class Pre{constructor(e){vt(this,"apiKey"),vt(this,"eventsQueue",[]),vt(this,"eventsUrl"),vt(this,"flushManager"),vt(this,"traceId",Fm()),vt(this,"appUserId"),vt(this,"isSilent"),vt(this,"rcSource"),this.apiKey=e.apiKey,this.eventsUrl=`${Dte}/v1/events`,this.appUserId=e.appUserId,this.isSilent=e.silent||!1,this.rcSource=e.rcSource,this.flushManager=new wre(Tre,Cre,xre,this.flushEvents.bind(this))}async updateUser(e){this.appUserId=e}getTraceId(){return this.traceId}trackSDKEvent(e){this.trackEvent({...e,source:"sdk"})}trackExternalEvent(e){this.trackEvent({...e})}trackEvent(e){if(this.isSilent){tr.verboseLog("Skipping event tracking, the EventsTracker is silent");return}try{const r=new Sre({eventName:e.eventName,traceId:this.traceId,appUserId:this.appUserId,context:Ere(e.source,this.rcSource),properties:e.properties||{}});this.eventsQueue.push(r),this.flushManager.tryFlush()}catch{tr.errorLog(`Error while tracking event ${e.eventName}`)}}dispose(){this.flushManager.stop()}flushEvents(){if(this.eventsQueue.length===0)return Promise.resolve();const e=[...this.eventsQueue];return fetch(this.eventsUrl,{method:sF.POST,headers:rF(this.apiKey),body:JSON.stringify({events:e})}).then(r=>{if(r.status===200||r.status===201){this.eventsQueue.splice(0,e.length);return}else throw tr.debugLog("Events failed to flush due to server error"),new Error("Events failed to flush due to server error")}).catch(r=>{throw tr.debugLog("Error while flushing events"),r})}}const Are=()=>{const t=new URLSearchParams(window.location.search),e=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],r={};return e.forEach(n=>{const a=t.get(n);a!==null&&(r[n]=a)}),r},Rre=["app","embedded"],Yw={autoCollectUTMAsMetadata:!0,collectAnalyticsEvents:!0};var Dre=lt('<p class="svelte-11vxb6p"><strong>Free Trial:</strong> </p>'),Ore=lt('<p class="svelte-11vxb6p"><strong>Intro Price:</strong> </p>'),Nre=lt('<div class="rc-simulated-store-modal-overlay svelte-11vxb6p"><div class="rc-simulated-store-modal svelte-11vxb6p"><div class="rc-simulated-store-modal-content svelte-11vxb6p"><h2 class="rc-simulated-store-modal-title svelte-11vxb6p">Test Store Purchase</h2> <div class="rc-simulated-store-modal-details svelte-11vxb6p"><div><p class="svelte-11vxb6p"><strong>Product:</strong> </p> <p class="svelte-11vxb6p"><strong>Type:</strong> </p> <p class="svelte-11vxb6p"><strong>Price:</strong> </p> <!> <!></div></div> <div class="rc-simulated-store-modal-buttons svelte-11vxb6p"><button type="button" class="rc-simulated-store-modal-button rc-simulated-store-modal-button-primary svelte-11vxb6p">Test valid purchase</button> <button type="button" class="rc-simulated-store-modal-button rc-simulated-store-modal-button-secondary svelte-11vxb6p">Test failed purchase</button> <button type="button" class="rc-simulated-store-modal-button rc-simulated-store-modal-button-cancel svelte-11vxb6p">Cancel</button></div></div></div></div>');const Ire={hash:"svelte-11vxb6p",code:`.rc-simulated-store-modal-overlay.svelte-11vxb6p {position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0, 0, 0, 0.5);display:flex;justify-content:center;align-items:center;z-index:9999;}.rc-simulated-store-modal.svelte-11vxb6p {background:white;border-radius:8px;padding:0;max-width:500px;width:90%;max-height:90%;overflow-y:auto;box-shadow:0 4px 20px rgba(0, 0, 0, 0.15);}.rc-simulated-store-modal-content.svelte-11vxb6p {padding:24px;}.rc-simulated-store-modal-title.svelte-11vxb6p {margin:0 0 20px 0;font-size:24px;font-weight:600;color:#333;}.rc-simulated-store-modal-details.svelte-11vxb6p {margin-bottom:24px;}.rc-simulated-store-modal-details.svelte-11vxb6p p:where(.svelte-11vxb6p) {margin:8px 0;color:#666;line-height:1.5;}.rc-simulated-store-modal-buttons.svelte-11vxb6p {display:flex;flex-direction:column;gap:12px;}.rc-simulated-store-modal-button.svelte-11vxb6p {padding:12px 24px;border:none;border-radius:6px;font-size:16px;font-weight:500;cursor:pointer;transition:background-color 0.2s ease;}.rc-simulated-store-modal-button-primary.svelte-11vxb6p {background-color:#007aff;color:white;}.rc-simulated-store-modal-button-primary.svelte-11vxb6p:hover {background-color:#0056cc;}.rc-simulated-store-modal-button-secondary.svelte-11vxb6p {background-color:#ff3b30;color:white;}.rc-simulated-store-modal-button-secondary.svelte-11vxb6p:hover {background-color:#cc2e24;}.rc-simulated-store-modal-button-cancel.svelte-11vxb6p {background-color:#f2f2f7;color:#333;}.rc-simulated-store-modal-button-cancel.svelte-11vxb6p:hover {background-color:#e5e5ea;}

  /* Mobile responsive - full screen on small screens */
  @media (max-width: 768px) {.rc-simulated-store-modal-overlay.svelte-11vxb6p {padding:0;}.rc-simulated-store-modal.svelte-11vxb6p {width:100%;height:100%;border-radius:0;max-width:none;max-height:none;}.rc-simulated-store-modal-content.svelte-11vxb6p {height:100%;display:flex;flex-direction:column;justify-content:center;}
  }`};function Mre(t,e){Wt(e,!1),zt(t,Ire);let r=It(e,"productIdentifier",8),n=It(e,"productType",8),a=It(e,"basePrice",8),i=It(e,"freeTrialPeriod",8,void 0),o=It(e,"introPriceFormatted",8,void 0),c=It(e,"onValidPurchase",8),u=It(e,"onFailedPurchase",8),d=It(e,"onCancel",8);function f(U){U.target===U.currentTarget&&d()()}ws();var h=Nre(),m=Le(h),_=Le(m),w=kt(Le(_),2),b=Le(w),E=Le(b),T=kt(Le(E)),D=kt(E,2),P=kt(Le(D)),A=kt(D,2),C=kt(Le(A)),O=kt(A,2);{var I=U=>{var W=Dre(),F=kt(Le(W));mt(()=>hr(F,` ${i()??""}`)),ke(U,W)};xt(O,U=>{i()&&U(I)})}var x=kt(O,2);{var R=U=>{var W=Ore(),F=kt(Le(W));mt(()=>hr(F,` ${o()??""}`)),ke(U,W)};xt(x,U=>{o()&&U(R)})}var N=kt(w,2),L=Le(N),j=kt(L,2),q=kt(j,2);mt(()=>{hr(T,` ${r()??""}`),hr(P,` ${n()??""}`),hr(C,` ${a()??""}`)}),jo("click",L,function(...U){var W;(W=c())==null||W.apply(this,U)}),jo("click",j,function(...U){var W;(W=u())==null||W.apply(this,U)}),jo("click",q,function(...U){var W;(W=d())==null||W.apply(this,U)}),jo("click",h,f),ke(t,h),Kt()}async function cF(t,e,r){const n=new Date,a=`test_${n.getTime()}_${Fm()}`,i=`test_store_operation_session_${Fm()}`,o={storeTransactionId:a,productIdentifier:t.identifier,purchaseDate:n},c=await e.postReceipt(r,t.identifier,t.price.currency,a,t.presentedOfferingContext,"purchase");return{customerInfo:HU(c),redemptionInfo:null,operationSessionId:i,storeTransaction:o}}function jre(t,e,r){const n=t.rcPackage.webBillingProduct,a=n.productType,i=n.freeTrialPhase,o=n.introPricePhase,c=n.price,u=d=>d?`${d.number} ${d.unit}${d.number>1?"s":""}`:"N/A";return new Promise((d,f)=>{var h;const m=document.createElement("div");document.body.appendChild(m);const _=()=>{w&&Kv(w),document.body.removeChild(m)};let w=null;w=ET(Mre,{target:m,props:{productIdentifier:n.identifier,productType:a,basePrice:c.formattedPrice,freeTrialPeriod:i?u(i.period):void 0,introPriceFormatted:(h=o?.price)==null?void 0:h.formattedPrice,onValidPurchase:async()=>{_();try{d(await cF(n,e,r))}catch(b){f(b)}},onFailedPurchase:()=>{_(),f(new bn(Un.ProductNotAvailableForPurchaseError,"Simulated test purchase failure: no real transaction occurred"))},onCancel:()=>{_(),f(new bn(Un.UserCancelledError))}}})})}class Lre{constructor(){vt(this,"virtualCurrenciesCache",new Map),vt(this,"CACHE_EXPIRY_MS",300*1e3)}invalidateAllCaches(){this.virtualCurrenciesCache.clear()}cacheVirtualCurrencies(e,r){this.virtualCurrenciesCache.set(e,{data:r,lastUpdatedAt:Date.now()})}getCachedVirtualCurrencies(e,r=!1){const n=this.virtualCurrenciesCache.get(e);return this.getCachedData(n??null,r)}invalidateVirtualCurrenciesCache(e){this.virtualCurrenciesCache.delete(e)}getCachedData(e,r=!1){return e?r?e.data:Date.now()-e.lastUpdatedAt>=this.CACHE_EXPIRY_MS?null:e.data:null}}function Bre(t){return{balance:t.balance,name:t.name,code:t.code,serverDescription:t.description??null}}function Ure(t){const e={};for(const[r,n]of Object.entries(t.virtual_currencies))e[r]=Bre(n);return{all:e}}const nN="$RCAnonymousID:";var lF,Zv;lF=[tre];const Kh=class ni{constructor(e,r,n=MT,a=Yw){oW(Zv,5,this),vt(this,"_API_KEY"),vt(this,"_appUserId"),vt(this,"_brandingInfo",null),vt(this,"_loadingResourcesPromise",null),vt(this,"_flags"),vt(this,"backend"),vt(this,"purchaseOperationHelper"),vt(this,"eventsTracker"),vt(this,"inMemoryCache"),this._API_KEY=e,this._appUserId=r,this._flags={...Yw,...a},X_(e)?tr.debugLog("Initializing Purchases SDK with Web billing sandbox API Key"):qu(e)&&tr.debugLog("Initializing Purchases SDK with RC Test store API Key."),this.eventsTracker=new Pre({apiKey:this._API_KEY,appUserId:this._appUserId,silent:!this._flags.collectAnalyticsEvents,rcSource:this._flags.rcSource??null}),this.backend=new Jte(this._API_KEY,n),this.inMemoryCache=new Lre,this.purchaseOperationHelper=new FK(this.backend,this.eventsTracker),this.eventsTracker.trackSDKEvent({eventName:gi.SDKInitialized})}static setLogLevel(e){tr.setLogLevel(e)}static setLogHandler(e){tr.setLogHandler(e)}static setPlatformInfo(e){ni._platformInfo=e}static getPlatformInfo(){return ni._platformInfo}static getSharedInstance(){if(ni.isConfigured())return ni.instance;throw new BK}static isConfigured(){return ni.instance!==void 0}static configure(e,r,n,a){ni.instance!==void 0&&tr.warnLog("Purchases is already initialized. You normally should only configure Purchases once. Creating and returning new instance.");let i;if(typeof e=="object"&&e!==null)i=e;else{if(typeof e!="string")throw new bn(Un.ConfigurationError,"API key must be provided as a string");if(typeof r!="string")throw new bn(Un.ConfigurationError,"App user ID must be provided as a string");i={apiKey:e,appUserId:r,httpConfig:n,flags:a}}return ni.configureInternal(i),ni.getSharedInstance()}static configureInternal(e){const{apiKey:r,appUserId:n,httpConfig:a,flags:i}=e,o=a??MT,c=i??Yw;ni.validateConfig(e),ni.instance=new ni(r,n,o,c)}static validateConfig(e){var r,n;Qte(e.apiKey,e.flags),ZO(e.appUserId),Zte((r=e.httpConfig)==null?void 0:r.proxyURL),ere((n=e.httpConfig)==null?void 0:n.additionalHeaders)}async preload(){if(this.hasLoadedResources()){tr.verboseLog("Purchases resources are loaded. Skipping.");return}if(this._loadingResourcesPromise!==null){tr.verboseLog("Purchases resources are loading. Waiting."),await this._loadingResourcesPromise;return}return this._loadingResourcesPromise=this.fetchAndCacheBrandingInfo().catch(e=>{let r=`${e}`;e instanceof bn&&(r=`${e.message}. ${e.underlyingErrorMessage?`Underlying error: ${e.underlyingErrorMessage}`:""}`),tr.errorLog(`Error fetching branding info: ${r}`)}).finally(()=>{this._loadingResourcesPromise=null}),this._loadingResourcesPromise}async fetchAndCacheBrandingInfo(){if(qu(this._API_KEY)){tr.warnLog("Branding info is not available for RC Test Store API keys.");return}this._brandingInfo=await this.backend.getBrandingInfo()}hasLoadedResources(){return this._brandingInfo!==null}async renderPaywall(e){let r=e.htmlTarget??document.getElementById("rcb-ui-pw-root");if(r===null){const m=document.createElement("div");m.id="rcb-ui-pw-root",m.className="rcb-ui-pw-root",m.style.zIndex=`${are}`,document.body.appendChild(m),r=m}if(r===null)throw new Error("Could not generate a mount point for the billing widget");const n=r;n.innerHTML="";const a=e.offering;if(!a.paywall_components)throw new Error("You cannot use paywalls yet, they are coming soon!");const i=e.selectedLocale||navigator.language,o=new Wb({},i,a.paywall_components.default_locale),c=m=>{var _;const w=a.availablePackages.find(b=>b.identifier===m);if(w===void 0)throw new Error(`No package found for ${m}`);return this.purchase({rcPackage:w,htmlTarget:e.purchaseHtmlTarget,customerEmail:e.customerEmail,selectedLocale:i,defaultLocale:((_=a.paywall_components)==null?void 0:_.default_locale)||Bf})},u=m=>{var _;if(e.onNavigateToUrl){e.onNavigateToUrl(m);return}(_=window.open(m,"_blank"))==null||_.focus()},d=()=>{},f=()=>{if(e.onVisitCustomerCenter){e.onVisitCustomerCenter();return}},h=lre(a,o);return new Promise((m,_)=>{ET(IX,{target:n,props:{paywallData:a.paywall_components,selectedLocale:i,onNavigateToUrlClicked:u,onVisitCustomerCenterClicked:f,onBackClicked:()=>{if(e.onBack){e.onBack();return}n.innerHTML="",tr.debugLog("Purchase cancelled by user"),_(new bn(Un.UserCancelledError))},onRestorePurchasesClicked:d,onPurchaseClicked:w=>{c(w).then(b=>{m(b)}).catch(b=>_(b))},onError:w=>_(w),variablesPerPackage:h}})})}async getOfferings(e){bte(e?.currency);const r=this._appUserId,n=await this.backend.getOfferings(r),a=e?.offeringIdentifier===nF.Current?n.current_offering_id:e?.offeringIdentifier;return a&&(n.offerings=n.offerings.filter(i=>i.identifier===a)),await this.getAllOfferings(n,r,e)}async getCurrentOfferingForPlacement(e,r){const n=this._appUserId,a=await this.backend.getOfferings(n),i=await this.getAllOfferings(a,n,r),o=a.placements??null;return o==null?null:rre(o,i.all,e)}async getAllOfferings(e,r,n){const a=e.offerings.flatMap(o=>o.packages).map(o=>o.platform_product_identifier),i=await this.backend.getProducts(r,a,n?.currency);return this.logMissingProductIds(a,i.product_details),nre(e,i)}async isEntitledTo(e){const r=await this.getCustomerInfo();return e in r.entitlements.active}purchasePackage(e,r,n){return this.purchase({rcPackage:e,customerEmail:r,htmlTarget:n})}async purchase(e){var r;const{rcPackage:n,purchaseOption:a,htmlTarget:i,customerEmail:o,selectedLocale:c=Bf,defaultLocale:u=Bf,skipSuccessPage:d=!1}=e;if(qu(this._API_KEY)){const A=await jre(e,this.backend,this._appUserId);return this.inMemoryCache.invalidateAllCaches(),A}let f=i??document.getElementById("rcb-ui-root");if(f===null){const A=document.createElement("div");A.className="rcb-ui-root",document.body.appendChild(A),f=A}if(f===null)throw new Error("Could not generate a mount point for the billing widget");const h=f,m=this._appUserId;tr.debugLog(`Presenting purchase form for package ${n.identifier}`);const _=c||u,w=a??n.webBillingProduct.defaultPurchaseOption,b=ZJ({appearance:(r=this._brandingInfo)==null?void 0:r.appearance,rcPackage:n,purchaseOptionToUse:w,customerEmail:o});this.eventsTracker.trackSDKEvent(b);const E={...this._flags.autoCollectUTMAsMetadata?Are():{},...e.metadata||{}};let T=null;const D=this._brandingInfo;D&&e.brandingAppearanceOverride&&(D.appearance=e.brandingAppearanceOverride);const P=i!==void 0;return new Promise((A,C)=>{P||window.history.pushState({checkoutOpen:!0},"");const O=this._flags.rcSource&&Rre.includes(this._flags.rcSource)?void 0:()=>{const I=tQ();this.eventsTracker.trackSDKEvent(I),window.removeEventListener("popstate",O),T&&Kv(T),h.innerHTML="",tr.debugLog("Purchase cancelled by user"),C(new bn(Un.UserCancelledError))};!P&&O&&window.addEventListener("popstate",O),T=ET(kte,{target:h,props:{isInElement:P,appUserId:m,rcPackage:n,purchaseOption:w,customerEmail:o,onFinished:async I=>{const x=eQ({redemptionInfo:I.redemptionInfo});this.eventsTracker.trackSDKEvent(x),this.inMemoryCache.invalidateAllCaches(),tr.debugLog("Purchase finished"),T&&Kv(T),h.innerHTML="";const R={customerInfo:await this._getCustomerInfoForUserId(m),redemptionInfo:I.redemptionInfo,operationSessionId:I.operationSessionId,storeTransaction:{storeTransactionId:I.storeTransactionIdentifier,productIdentifier:n.webBillingProduct.identifier,purchaseDate:I.purchaseDate}};A(R)},onClose:O,onError:I=>{var x;const R=rQ({errorCode:(x=I.errorCode)==null?void 0:x.toString(),errorMessage:I.message});this.eventsTracker.trackSDKEvent(R),T&&Kv(T),h.innerHTML="",C(bn.getForPurchasesFlowError(I))},purchases:this,eventsTracker:this.eventsTracker,brandingInfo:this._brandingInfo,purchaseOperationHelper:this.purchaseOperationHelper,selectedLocale:_,metadata:E,defaultLocale:u,customTranslations:e.labelsOverride,skipSuccessPage:d}})})}_isConfiguredWithSimulatedStore(){return qu(this._API_KEY)}async _postSimulatedStoreReceipt(e){if(!qu(this._API_KEY))throw new bn(Un.ConfigurationError,"Posting a test store receipt is only available for RC Test Store API keys.");return await cF(e,this.backend,this._appUserId)}async getCustomerInfo(){return await this._getCustomerInfoForUserId(this._appUserId)}getAppUserId(){return this._appUserId}async setAttributes(e){return await this.getCustomerInfo(),await this.backend.setAttributes(this._appUserId,e)}async changeUser(e){return ZO(e),this._appUserId=e,this.eventsTracker.updateUser(e),this.inMemoryCache.invalidateAllCaches(),await this.getCustomerInfo()}logMissingProductIds(e,r){const n={};r.forEach(i=>n[i.identifier]=i);const a=[];e.forEach(i=>{n[i]===void 0&&a.push(i)}),a.length>0&&tr.debugLog(`Could not find product data for product ids:
        ${a.join()}.
        Please check that your product configuration is correct.`)}isSandbox(){return X_(this._API_KEY)||qu(this._API_KEY)}isAnonymous(){return this._appUserId.startsWith(nN)}async getVirtualCurrencies(){return await this._getVirtualCurrenciesForUserId(this._appUserId)}getCachedVirtualCurrencies(){return this.inMemoryCache.getCachedVirtualCurrencies(this._appUserId,!0)}invalidateVirtualCurrenciesCache(){this.inMemoryCache.invalidateVirtualCurrenciesCache(this._appUserId)}close(){ni.instance===this?(this.eventsTracker&&this.eventsTracker.dispose(),ni.instance=void 0):tr.warnLog("Trying to close a Purchases instance that is not the current instance. Ignoring.")}async _getCustomerInfoForUserId(e){const r=await this.backend.getCustomerInfo(e);return HU(r)}async _getVirtualCurrenciesForUserId(e){const r=this.inMemoryCache.getCachedVirtualCurrencies(e);if(r)return tr.debugLog("Vending VirtualCurrencies from cache."),r;const n=await this.backend.getVirtualCurrencies(e),a=Ure(n);return tr.debugLog("VirtualCurrencies updated from the network."),this.inMemoryCache.cacheVirtualCurrencies(e,a),a}static generateRevenueCatAnonymousAppUserId(){return`${nN}${Fm().replace(/-/g,"")}`}_trackEvent(e){this.eventsTracker.trackExternalEvent(e)}};Zv=aW(),cW(Zv,1,"purchase",lF,Kh),sW(Zv,Kh),vt(Kh,"_platformInfo"),vt(Kh,"instance");let lm=Kh;function Fre(t,e){const r=String(e||"");if(t==="web"&&!r.startsWith("web_")&&!r.startsWith("rcb"))throw new Error('RevenueCat Web requires a Web Billing key (starts with "web_"). Set VITE_RC_API_KEY_WEB.');t==="ios"&&r.startsWith("appl_"),t==="android"&&r.startsWith("goog_")}function jT(t){const e=t==="web"?K7:t==="ios"?X7:Y7;if(!e)throw new Error(`RevenueCat SDK key missing for ${t}. Add VITE_RC_API_KEY_* and restart.`);return Fre(t,String(e)),String(e)}function qre(t){const e=(t??"").toString().trim();if(!e||e==="[Not provided]")throw new Error("Invalid appUserID for RevenueCat.");if(e.length>255)throw new Error("appUserID too long for RevenueCat (max 255).");return e}let Al=null,_f=null,qm=null;function zre(t){const e=(t??"").toString();return{length:e.length,empty:e.length===0}}function $re(t){return t?String(t).slice(0,4):null}async function Vre(t){return Al||_f||(_f=(async()=>{const e=Gr.getPlatform();if(e==="web"){const n=jT("web");if(typeof lm?.configure!="function")throw new Error("[RC] Web SDK load failed");try{await lm.configure({apiKey:n,appUserId:t,observerMode:!1});try{J_()}catch{}}catch{throw new Error("Purchases are temporarily paused.")}return Al={platform:"web",Purchases:lm},Al}const r=jT(e==="ios"?"ios":"android");try{const a=(await qr(()=>import("./index-DNNN8CDX.js"),[],import.meta.url))?.Purchases;if(!a||typeof a.configure!="function")throw new Error("Capacitor Purchases plugin not available. Did you run `npx cap sync ios`?");try{await a.configure({apiKey:r,appUserID:t,observerMode:!1});try{J_()}catch{}}catch{throw new Error("Purchases are temporarily paused.")}return Al={platform:"native",Purchases:a},Al}catch(n){throw n}})().catch(e=>{throw _f=null,e}),_f)}async function cP(t){const e=qre(t),r=await Vre(e);if(qm!==e){try{const n=r.Purchases;typeof n?.logIn=="function"&&(r.platform==="native"?await n.logIn({appUserID:e}):await n.logIn(e));try{J_()}catch{}}catch{}qm=e}return r}function Ni(){const t=Al;if(!t?.Purchases){if(Gr.getPlatform()==="web")try{const o=lm;if(typeof o?.getSharedInstance=="function"){const c=o.getSharedInstance();if(c)return c}return null}catch{}return null}const e=Gr.getPlatform(),r=t.Purchases;function n(i){const o=Object.create(i);return typeof i.getOfferings=="function"&&(o.getOfferings=async()=>{const c=e;let u=null;try{u=$re(jT(c==="ios"?"ios":c==="android"?"android":"web"))}catch{}try{const d=await i.getOfferings(),f=d?.current?.identifier??d?.currentOfferingIdentifier??null,h=(d?.current?.availablePackages??d?.availablePackages??[]).length;return d}catch(d){let f;try{f=d?.getErrorCode?.()??d?.errorCode??d?.code}catch{}throw d?.message,d}}),o}if(e==="web"){if(typeof r.getSharedInstance=="function")try{const i=r.getSharedInstance();return n(i)}catch{return n(r)}return n(r)}const a=Object.create(r);return typeof r.purchasePackage=="function"&&(a.purchasePackage=i=>r.purchasePackage({aPackage:i})),n(a)}function J_(){Gr.getPlatform(),zre(qm);try{Bo.getInfo().then(t=>{}).catch(()=>{})}catch{}}async function bf(){if(!qm)throw new Error("Cannot reconfigure RevenueCat before user identification.");return Al=null,_f=null,cP(qm)}const Hre=Object.freeze(Object.defineProperty({__proto__:null,getPurchases:Ni,initRevenueCat:cP,logRevenueCatConfig:J_,reconfigureRevenueCat:bf},Symbol.toStringTag,{value:"Module"})),aN=_3,Gre=b3,Wre=k3,Kre=String(J7).toLowerCase()==="true",e_={0:"UnknownError",1:"UserCancelledError",2:"StoreProblemError",3:"PurchaseNotAllowedError",4:"PurchaseInvalidError",5:"ProductNotAvailableForPurchaseError",6:"ProductAlreadyPurchasedError",7:"ReceiptAlreadyInUseError",8:"InvalidReceiptError",9:"MissingReceiptFileError",10:"NetworkError",11:"InvalidCredentialsError",12:"UnexpectedBackendResponseError",14:"InvalidAppUserIdError",15:"OperationAlreadyInProgressError",16:"UnknownBackendError"};function Xw(t,e){try{const r=e?.getErrorCode?.()??e?.errorCode??e?.code,n=typeof r=="number"?e_[r]||`Code${r}`:"Unknown",a=e?.extra?.backendErrorCode??e?.extra?.code??e?.backendErrorCode,i=e?.underlyingErrorMessage||e?.nativeStack||e?.stack,o=e?.message||String(e);if(Kre){const c=e?.extra?{...e.extra}:void 0}}catch{}}const uF=v.createContext({rc:null,ready:!1,error:null,buyChips:async()=>{},buySubscription:async()=>{},restorePurchases:async()=>{}});function Yre({children:t}){const{user:e,refreshUser:r}=$r(),[n,a]=v.useState(null),[i,o]=v.useState(!1),[c,u]=v.useState(null),d=v.useCallback(()=>{try{r()}catch{}try{setTimeout(()=>{r().catch(()=>{})},1200)}catch{}},[r]);v.useEffect(()=>{let A=!1;return(async()=>{if(o(!1),u(null),a(null),!!e?.id)try{const C=await cP(e.id);let O=!1;const I=1e3,x=Date.now();for(;!A;){const N=Ni()||C?.Purchases;if(N&&(typeof N.purchasePackage=="function"||typeof N.getOfferings=="function")){O=!0;break}if(Date.now()-x>I)break;await new Promise(L=>setTimeout(L,50))}!O&&C?.platform==="web"&&(O=!0),A||(a(C),o(O))}catch(C){A||(u(C?.message||"Purchases are temporarily paused. Please try again later."),o(!1))}})(),()=>{A=!0}},[e?.id]);const f=v.useCallback(A=>A?.all?.[aN]?A.all[aN]:A?.current||A?.all?.default||null,[]),h=v.useCallback(A=>{const C=[],O=x=>{if(Array.isArray(x))for(const R of x){const N=R?.identifier||R?.product?.identifier;N&&(C.find(L=>(L?.identifier||L?.product?.identifier)===N)||C.push(R))}};O(A?.current?.availablePackages||A?.current?.packages);const I=A?.all||{};return Object.keys(I).forEach(x=>{O(I[x]?.availablePackages||I[x]?.packages)}),C},[]),m=A=>{const C=A?.packageType,O=A?.product?.type;return C==="MONTHLY"||C==="ANNUAL"||C==="SIX_MONTH"||C==="THREE_MONTH"||C==="TWO_MONTH"||O==="SUBSCRIPTION"||O==="AUTO_RENEWABLE_SUBSCRIPTION"||!!A?.product?.subscriptionPeriod},_=A=>{const C=A?.product?.type,O=A?.packageType;return!m(A)||C==="NON_SUBSCRIPTION"||C==="NON_CONSUMABLE"||O==="LIFETIME"},w=v.useCallback(A=>{const C=f(A),O=h(A);{const R=O.find(N=>N?.identifier===Gre);if(R)return R}{const R=O.find(N=>N?.product?.identifier===Wre);if(R)return R}const I=O.find(R=>_(R));if(I)return I;const x=C?.availablePackages||C?.packages||[];return Array.isArray(x)&&x.length>0?x[0]:O[0]||null},[h,f]),b=v.useCallback(A=>{const C=f(A),O=h(A),I=O.find(L=>L?.packageType==="MONTHLY")||O.find(L=>(L?.identifier||"").toLowerCase().includes("month"));if(I)return I;const x=O.find(L=>L?.packageType==="ANNUAL")||O.find(L=>(L?.identifier||"").toLowerCase().includes("year"));if(x)return x;const R=O.find(L=>m(L));if(R)return R;const N=C?.availablePackages||C?.packages||[];return Array.isArray(N)&&N.length>0?N[0]:O[0]||null},[h,f]),E=v.useCallback(async()=>{if(!i)throw new Error("RevenueCat not ready");let A=Ni();if(!A?.getOfferings||!A?.purchasePackage)try{await bf(),A=Ni()}catch{}if(!A?.getOfferings||!A?.purchasePackage)throw new Error("Purchases not initialized. Please ensure the app is logged in and RevenueCat has finished initializing (iOS may need a moment after app launch).");const C=await A.getOfferings(),O=w(C);if(!O)throw h(C),new Error("No chips product configured");try{try{await A.purchasePackage(O),d()}catch(I){const x=String(I?.message||I);if(/already been destroyed/i.test(x))try{await bf();const R=Ni();if(!R?.purchasePackage)throw I;await R.purchasePackage(O),d();return}catch{}throw I}}catch(I){Xw("[RC] purchasePackage(chips)",I);const x=I?.getErrorCode?.()??I?.errorCode??I?.code,R=typeof x=="number"?e_[x]||`Code${x}`:"Unknown",N=I?.extra?.backendErrorCode??I?.backendErrorCode,L=N===7773?" Payment gateway communication error. On web, verify RevenueCat Web Billing is connected to Stripe and the product has a Web price; then retry.":"";throw new Error(`Purchase failed (${R}${typeof x=="number"?` ${x}`:""}${N?` | backend ${N}`:""}).${L}`)}},[i,w,h,d]),T=v.useCallback(async()=>{if(!i)throw new Error("RevenueCat not ready");let A=Ni();if(!A?.getOfferings||!A?.purchasePackage)try{await bf(),A=Ni()}catch{}if(!A?.getOfferings||!A?.purchasePackage)throw new Error("Purchases not initialized");const C=await A.getOfferings(),O=b(C);if(!O)throw new Error("No subscription package available");try{try{await A.purchasePackage(O),d()}catch(I){const x=String(I?.message||I);if(/already been destroyed/i.test(x))try{await bf();const R=Ni();if(!R?.purchasePackage)throw I;await R.purchasePackage(O),d();return}catch{}throw I}}catch(I){Xw("[RC] purchasePackage(subscription)",I);const x=I?.getErrorCode?.()??I?.errorCode??I?.code,R=typeof x=="number"?e_[x]||`Code${x}`:"Unknown",N=I?.extra?.backendErrorCode??I?.backendErrorCode,L=N===7773?" Payment gateway communication error. Ensure Stripe is connected in RevenueCat Web Billing and the subscription has Web pricing.":"";throw new Error(`Subscription purchase failed (${R}${typeof x=="number"?` ${x}`:""}${N?` | backend ${N}`:""}).${L}`)}},[i,b,d]),D=v.useCallback(async()=>{if(!i)throw new Error("RevenueCat not ready");let A=Ni();if(!A?.getCustomerInfo||!A?.syncPurchases)try{await bf(),A=Ni()}catch{}try{const C=await A?.getCustomerInfo?.();if(!A?.syncPurchases)throw new Error("Restore Purchases not initialized");await A?.syncPurchases(),d()}catch(C){Xw("[RC] restorePurchases",C);const O=C?.getErrorCode?.()??C?.errorCode??C?.code,I=typeof O=="number"?e_[O]||`Code${O}`:"Unknown",x=C?.extra?.backendErrorCode??C?.backendErrorCode;throw new Error(`Restore failed (${I}${typeof O=="number"?` ${O}`:""}${x?` | backend ${x}`:""}).`)}},[i,d]),P=v.useMemo(()=>({rc:n,ready:i,error:c,buyChips:E,buySubscription:T,restorePurchases:D}),[n,i,c,E,T,D]);return g.jsx(uF.Provider,{value:P,children:t})}function Xre(){return v.useContext(uF)}function Jre({viral:t,onClose:e}){return t?g.jsx("div",{className:"viral-container",children:g.jsxs("div",{className:"viral-content",children:[g.jsx("img",{src:t.preview,alt:"Preview",className:"viral-preview",style:{width:t.width,height:t.height}}),g.jsx("video",{src:t.url,autoPlay:!0,loop:!0,muted:!0,className:"viral-video",style:{width:t.width,height:t.height}})]})}):null}const Qre=0,Zre=1800,sa={diceRevealDelayMs:Qre,diceSettleClientMs:Zre,fairnessVerifyDelayMs:120,diceToChipDelayMs:1800,chipFlyDurationMs:900,chipStaggerMs:180,chipPostBufferMs:120,scrollNextDelayMs:600,scrollRoundEndDelayMs:1600,scrollMinWaitForChips:!0,betSnapshotDelayMs:100,balanceDelayMs:500,settledAllDelayMs:100,mySettledDelayMs:100,settleDetectDelayMs:50,flash:{baseMs:1e3,winMs:3500,ceeLoShortMs:1500},revealFlashPostDelayMs:100};let pv=null;async function dF(){if(pv)return pv;const t=await qr(()=>import("./lottie-Du15J6UW.js").then(e=>e.l),[],import.meta.url);return pv=t?.default&&t.default.loadAnimation?t.default:t,pv}let hv=null,mv=null;async function LT(t){if(t==="win"&&hv)return hv;if(t==="lose"&&mv)return mv;if(t==="win"){const e=await qr(()=>import("./winning-lottie-NODzSKgp.js"),[],import.meta.url);return hv=e.default||e,hv}else{const e=await qr(()=>import("./lose-lottie-DRt9PYrq.js"),[],import.meta.url);return mv=e.default||e,mv}}const lP=v.createContext(null),ene={win:void 0,lose:void 0,push:void 0,roll:void 0,info:void 0},tne=typeof window<"u"&&window.requestIdleCallback||(t=>setTimeout(t,50));function rne(){if(typeof navigator>"u")return!1;const t=navigator.userAgent||"",e=navigator;return/iP(ad|hone|od)/.test(t)||e.platform==="MacIntel"&&e.maxTouchPoints>1}function iN(){tne(async()=>{try{await dF(),await Promise.allSettled([LT("win"),LT("lose")])}catch{}})}function sN(){try{const t=document?.body,e=!!t?.classList?.contains("page-poker-room"),r=!!document.querySelector(".mode-craps"),n=!!(t?.classList?.contains("page-gameroom")&&!r);return{isPoker:e,isCraps:r,isCeeLo:n}}catch{return{isPoker:!1,isCraps:!1,isCeeLo:!1}}}function nne(t,e,r,n){return typeof e=="boolean"?e:n?!1:t==="lose"&&typeof r!="number"}function ane(t,e){if(!t)return!1;const r=t.kind==="roll"&&typeof t.title=="string"&&/\bpoint\b/i.test(t.title||""),n=t.kind==="roll"&&typeof t.title=="string"&&/\bbanker\b/i.test(t.title||"")&&/\bpoint\b/i.test(t.title||"");return e.isPoker||e.isCraps&&(t.kind==="win"||t.kind==="lose"||r)||e.isCeeLo&&(t.kind==="win"||t.kind==="lose"||t.kind==="push"||n)}function ine(){try{return document.querySelector(".card-header.card-header--two-rows")}catch{return null}}function Jw(t){if(typeof t!="string")return t;const e=t,r=[];let n=0;for(let a=0;a<e.length;a++){const i=e[a];if(i==="Z"||i==="z"){let o=a+1;for(;o<e.length&&(e[o]===" "||e[o]===" "||e[o]===" ");)o++;if(o<e.length&&/\d/.test(e[o])){r.push(g.jsx("span",{style:{textTransform:"none"},children:"z"},`z-${a}-${n++}`));continue}}r.push(i)}return g.jsx(g.Fragment,{children:r})}function sne(){v.useEffect(()=>{if(iN(),typeof window>"u")return;const t=()=>{iN(),window.removeEventListener("touchstart",t,!0),window.removeEventListener("pointerdown",t,!0)};return window.addEventListener("touchstart",t,!0),window.addEventListener("pointerdown",t,!0),()=>{window.removeEventListener("touchstart",t,!0),window.removeEventListener("pointerdown",t,!0)}},[])}function one(t,e,r){v.useEffect(()=>{if(typeof e!="number"||e<0)return;const n=window.setTimeout(()=>r(),e);return()=>window.clearTimeout(n)},[e,r])}function cne(t){v.useEffect(()=>{let e=!1;const r=async()=>{try{if(!Dx())try{await Xr()}catch{}const a=t==="win"?["winDing","win"]:t==="lose"?["lose"]:t==="push"?["push"]:[];if(a.length){try{np(a)}catch{}try{await O_(a,600)}catch{}}if(e)return;t==="lose"?LG({volume:.06}):t==="win"?UG({volume:.25}):t==="push"&&BG({volume:.04})}catch{}},n=window.setTimeout(()=>{r()},10);return()=>{e=!0,window.clearTimeout(n)}},[t])}function lne(t){const{enabled:e,kind:r,targetRef:n,animationData:a,fallbackMap:i,isIOS:o,onComplete:c}=t,u=v.useRef(null);v.useEffect(()=>{if(!e||r!=="win"&&r!=="lose")return;let d=!1;return(async()=>{try{const f=await dF(),h=a||(r?i[r]:void 0)||await LT(r);if(d||!n.current||!h)return;u.current=f.loadAnimation({container:n.current,renderer:o?"canvas":"svg",autoplay:!0,loop:!1,animationData:h,subframe:!1,rendererSettings:{progressiveLoad:!0,hideOnTransparent:!0,preserveAspectRatio:"xMidYMid meet",dpr:Math.min(window.devicePixelRatio||1,1.5)}}),c&&u.current.addEventListener("complete",c)}catch{}})(),()=>{d=!0;try{c&&u.current&&u.current.removeEventListener?.("complete",c),u.current?.destroy()}catch{}u.current=null,n.current&&(n.current.innerHTML="")}},[e,r,a,i,o,c,n])}function une({item:t,onDone:e,animations:r,zIndex:n}){const a=v.useRef(null),i=v.useRef(null),[o,c]=v.useState("enter"),u=v.useRef(!1),d=v.useCallback(()=>{u.current||(u.current=!0,e(t.id))},[e,t.id]),f=v.useCallback(()=>{c("leave"),window.setTimeout(d,320)},[d]);cne(t.kind),one(t.id,t.duration,f);const h=v.useMemo(rne,[]),m=t.kind==="win"||t.kind==="lose";lne({enabled:m,kind:t.kind,targetRef:i,animationData:t.animationData,fallbackMap:r,isIOS:h,onComplete:m&&t.autoDismissOnComplete?()=>{f()}:void 0});const _=t.title&&typeof t.title=="string"&&t.title.includes(":")?(()=>{const b=t.title.indexOf(":"),E=t.title.slice(0,b).trim(),T=t.title.slice(b+1).trim();return g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"flash-title__name",children:E}),g.jsx("span",{className:"flash-title__rest",children:Jw(T)})]})})():Jw(t.title),w=typeof t.title=="string"&&/\bbanker\b/i.test(t.title)?{opacity:.9}:void 0;return g.jsxs("div",{ref:a,className:["flash-card",`flash-${t.kind??"info"}`,o==="leave"?"leave":o==="steady"?"steady":"enter"].join(" "),role:"status","data-testid":"flash-card","data-flash-kind":t.kind??"info",onClick:()=>t.dismissible&&f(),onAnimationEnd:b=>{b.target===a.current&&(o==="enter"&&c("steady"),o==="leave"&&d())},onTransitionEnd:b=>{b.target===a.current&&o==="leave"&&d()},style:{pointerEvents:"auto",zIndex:n},children:[(t.kind==="lose"||t.kind==="win")&&g.jsx("div",{className:"flash-lottie",ref:i}),t.icon&&g.jsx("div",{className:"flash-icon","aria-hidden":!0,children:t.icon}),g.jsxs("div",{className:"flash-body",children:[t.title&&g.jsx("div",{className:"flash-title"+(typeof t.title=="string"&&/\bbanker\b/i.test(t.title)?" flash-title--banker":""),"data-testid":"flash-title",style:w,children:_}),t.subtitle&&g.jsx("div",{className:"flash-subtitle","data-testid":"flash-subtitle",children:Jw(t.subtitle)}),t.viral&&g.jsx(Jre,{viral:t.viral,onClose:()=>{}})]})]})}function dne({children:t,baseDurationMs:e=sa.flash.baseMs}){const[r,n]=v.useState([]),a=v.useRef(new Set),i=v.useRef({...ene});sne();const o=v.useCallback(m=>{n(_=>_.filter(w=>w.id!==m))},[]),c=v.useCallback(()=>{n([])},[]),u=v.useCallback(m=>{i.current={...i.current,...m}},[]),d=v.useCallback(m=>{const _=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`${Date.now()}-${Math.random().toString(16).slice(2)}`,b=(typeof document<"u"?sN():{isCeeLo:!1}).isCeeLo,E=typeof m.duration=="number"?m.duration:b&&(m.kind==="win"||m.kind==="lose")?sa.flash.ceeLoShortMs:m.kind==="win"?sa.flash.winMs:e,T={id:_,dismissible:!0,autoDismissOnComplete:nne(m.kind,m.autoDismissOnComplete,m.duration,b),...m,duration:E};try{const D=typeof location<"u"?new URLSearchParams(location.search):null;if(D&&D.get("flashDebug")==="1")try{localStorage.setItem("debug:flashes","1")}catch{}const A=!!(typeof window<"u"?window:void 0)?.FLASH_DEBUG||typeof localStorage<"u"&&localStorage.getItem("debug:flashes")==="1"}catch{}if(m.kind==="info"||m.kind==="roll")try{IG({volume:.15})}catch{}return n(D=>[...D,T]),_},[e]);v.useEffect(()=>{if(r.length!==0||!a.current.size)return;const m=Array.from(a.current);a.current.clear(),m.forEach(_=>{try{_()}catch{}})},[r.length]);const f=v.useMemo(()=>({show:d,roll:(m,_)=>d({kind:"roll",title:m,subtitle:_}),rollNow:(m,_)=>d({kind:"roll",title:m,subtitle:_}),win:(m,_,w,b)=>d({kind:"win",title:m,subtitle:_,viral:w,animationData:b}),lose:(m,_,w,b)=>d({kind:"lose",title:m,subtitle:_,viral:w,animationData:b}),push:(m,_,w,b)=>d({kind:"push",title:m,subtitle:_,viral:w,animationData:b}),info:(m,_)=>d({kind:"info",title:m,subtitle:_}),infoNow:(m,_)=>d({kind:"info",title:m,subtitle:_}),dismiss:o,clear:c,setFlashAnimations:u,activeKind:r.length?r[r.length-1]?.kind:void 0,hasActive:r.length>0,onIdle:m=>{r.length===0?setTimeout(m,0):a.current.add(m)}}),[d,o,c,u,r.length]),h=v.useMemo(()=>{if(typeof document>"u")return null;const m=sN(),_=ine();return r.map((w,b)=>{const T=ane(w,m)&&_?_:document.body,D=T!==document.body,P=2e3+b;return Wc.createPortal(g.jsxs("div",{className:"flash-root"+(D?" flash-root--header":""),"aria-live":"polite","data-testid":"flash-overlay-root",children:[g.jsx(une,{item:w,onDone:o,animations:i.current,zIndex:P}),g.jsx("div",{className:"flash-backdrop"})]},w.id),T)})},[r,o]);return g.jsxs(lP.Provider,{value:f,children:[t,h]})}function Es(){const t=v.useContext(lP);if(!t)throw new Error("useFlashOverlay must be used within <FlashOverlayProvider>");return t}function uP(){const t=v.useContext(lP);if(t)return t;const e=()=>{},r=()=>"";return{show:r,roll:r,rollNow:e,win:e,lose:e,push:e,info:e,infoNow:e,dismiss:e,clear:e,setFlashAnimations:e,activeKind:void 0,hasActive:!1,onIdle:e}}const oN=_3,fne=b3,pne=k3,hne=rH,cN=w3;function Lg(){const{user:t,refreshUser:e}=$r(),{rc:r,ready:n,error:a,buyChips:i,buySubscription:o,restorePurchases:c}=Xre(),{infoNow:u}=Es(),[d,f]=v.useState(!1),[h,m]=v.useState(!1),[_,w]=v.useState(!1),[b,E]=v.useState(!1),[T,D]=v.useState(!1),[P,A]=v.useState(void 0),[C,O]=v.useState(void 0),[I,x]=v.useState(void 0),[R,N]=v.useState(void 0),[L,j]=v.useState(void 0),[q,U]=v.useState(void 0),[W,F]=v.useState(!1),Y=Gr.getPlatform()==="web",Q=ci(),ie=!0,G=v.useMemo(()=>r?.Purchases,[r]);v.useCallback(ue=>ue?.all?.[oN]?ue.all[oN]:ue?.current||ue?.all?.default||null,[]);const B=v.useCallback(async()=>{try{const Ae=await Ni()?.getCustomerInfo?.();let He=!1;const ce=Ae?.entitlements?.active||{},xe=Object.keys(ce).length>0;cN&&(He=!!ce?.[cN]||xe),D(He)}catch{}},[G,ie]);v.useEffect(()=>{n&&ie&&B()},[n,ie,B]),v.useEffect(()=>{if(!n||!ie)return;let ue=0;const Ae=6,He=setInterval(()=>{ue+=1,B(),ue>=Ae&&clearInterval(He)},500);return()=>clearInterval(He)},[n,ie,B]),v.useEffect(()=>{let ue=!1;return(async()=>{try{if(!n||!ie)return;const He=await Ni()?.getOfferings?.();if(!He)return;const ce=[],xe=We=>{Array.isArray(We)&&We.forEach(it=>{it&&ce.push(it)})};xe(He?.current?.availablePackages||He?.current?.packages),He?.all&&Object.values(He.all).forEach(We=>xe(We?.availablePackages||We?.packages));const re=We=>We?.identifier||We?.product?.identifier||We?.rcBillingProduct?.identifier||We?.webBillingProduct?.identifier,H=We=>We?.product||We?.rcBillingProduct||We?.webBillingProduct||We,he=We=>{const it=H(We);return!!(We?.packageType==="MONTHLY"||We?.packageType==="ANNUAL"||it?.subscriptionPeriod||it?.period||it?.defaultSubscriptionOption||it?.productType&&/subscription/i.test(String(it.productType)))},Re=We=>We?.priceString||We?.price?.formattedPrice||We?.currentPrice?.formattedPrice||We?.price||We?.defaultPurchaseOption?.basePrice?.formattedPrice,fe=We=>String(We?.title||We?.displayName||""),Ie=We=>String(We?.description||""),ct=We=>We?ce.find(it=>re(it)===We):void 0;let $e=ct(fne)||ct(pne);if($e||($e=ce.find(We=>!he(We))),$e){const We=H($e),it=Re(We),Et=fe(We),Mt=Ie(We),_t=String(re($e)||""),ge=De=>{const et=De.match(/\b(\d{1,3}(?:[\,\._\s]\d{3})*|\d{2,})\b/);if(!et)return null;const at=et[1].replace(/[\._\s,]/g,""),we=parseInt(at,10);return Number.isFinite(we)?we:null},Be=ge(Et)??ge(Mt)??ge(_t),je=Be&&Be>0?Be:void 0,nt=je?new Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(je):void 0,Ct=nt?`z${nt}`:"Z Credits",jt=it?`${Ct} for ${it}`:void 0;ue||A(jt),ue||x("Top up your Z Credits to keep playing.")}let rt=ct(hne);if(rt||(rt=ce.find(Et=>Et?.packageType==="MONTHLY"||/month/i.test(String(re(Et)||""))||/month/i.test(fe(H(Et))))||ce.find(Et=>he(Et)||/year|annual|week|month/i.test(String(re(Et)||"")))),ue||F(!!rt),rt){const We=H(rt),it=Re(We),Et=it?`${it} Mo`:void 0;if(ue||O(Et),ue||N("Remove ads and unlock premium features."),ue||j(it),!ue){let Mt="Auto-renewing";const _t=rt?.packageType||We?.subscriptionPeriod||We?.period||We?.defaultSubscriptionOption?.period,ge=String(_t||"").toUpperCase();ge.includes("MONTH")||ge==="MONTHLY"||ge==="P1M"?Mt="Monthly":ge.includes("YEAR")||ge==="ANNUAL"||ge==="P1Y"?Mt="Annual":ge.includes("WEEK")||ge==="WEEKLY"||ge==="P1W"?Mt="Weekly":(ge.includes("DAY")||ge==="P1D")&&(Mt="Daily"),U(Mt)}}}catch{}})(),()=>{ue=!0}},[n,ie,G]);const K=async()=>{if(!t?.id){try{u("Login required","Please sign in to buy credits.")}catch{}return}if(!d){if(f(!0),m(!0),!n){u("Purchases initializing…","Please try again in a moment."),m(!1),f(!1);return}try{await i(),u("Purchase complete","Chips will appear shortly.")}catch(ue){let Ae=ue?.message||"Purchase unavailable right now. Please try again shortly.";try{const He=ue?.getErrorCode?.()??ue?.errorCode??ue?.code,ce=typeof He=="number"?He===3?"PurchaseNotAllowedError":He===2?"StoreProblemError":He===5?"ProductNotAvailableForPurchaseError":void 0:void 0;ce==="PurchaseNotAllowedError"?Ae="Purchases not allowed for this Apple ID/device. Use an App Store sandbox account and ensure the Paid Apps Agreement is accepted.":ce==="StoreProblemError"?Ae="App Store is currently unavailable. Please try again later or verify sandbox account is signed in to the device.":ce==="ProductNotAvailableForPurchaseError"&&(Ae="Product not available. Verify the product identifier matches App Store Connect and RevenueCat configuration for this app target.")}catch{}u("Purchase failed",Ae)}finally{m(!1),f(!1)}}},ae=async()=>{if(t?.id&&!d){if(f(!0),w(!0),!n){try{u("Purchases initializing…","Please try again in a moment.")}catch{}try{await(await qr(async()=>{const{reconfigureRevenueCat:ue}=await Promise.resolve().then(()=>Hre);return{reconfigureRevenueCat:ue}},void 0,import.meta.url)).reconfigureRevenueCat()}catch{}w(!1),f(!1);return}try{await o(),await B(),u("Subscription active","Thanks for supporting.")}finally{w(!1),f(!1)}}},te=async()=>{if(t?.id&&!d){if(f(!0),E(!0),!n)throw new Error("Payment service not ready");await c(),await B();try{const ue=await oi();ue&&await fetch(`${Q}/api/payment/revenuecat/restore`,{method:"POST",headers:{Authorization:`Bearer ${ue}`}})}catch{}try{await e()}catch{}try{setTimeout(()=>{e().catch(()=>{})},800)}catch{}try{setTimeout(()=>{e().catch(()=>{})},2e3)}catch{}u("Restored purchases","Your purchases have been restored."),E(!1),f(!1)}},me=v.useMemo(()=>!n||!ie?"Initializing…":T?"Premium Active":"Go Premium",[T,n,ie]);return{ready:n,error:a||null,busy:d,busyChips:h,busySubscription:_,premiumActive:T,hasPremiumPackage:W,premiumLabel:me,purchasesReady:ie,isWeb:Y,onBuyChips:K,onGoPremium:ae,onRestore:te,chipsSubtitle:P,premiumSubtitle:C,chipsDescription:I,premiumDescription:R,premiumPrice:L,premiumInterval:q}}var um;(function(t){t.Heavy="HEAVY",t.Medium="MEDIUM",t.Light="LIGHT"})(um||(um={}));var lN;(function(t){t.Success="SUCCESS",t.Warning="WARNING",t.Error="ERROR"})(lN||(lN={}));const Yh=ro("Haptics",{web:()=>qr(()=>import("./web-dio0HtFy.js"),[],import.meta.url).then(t=>new t.HapticsWeb)}),mne={Light:um.Light,Medium:um.Medium,Heavy:um.Heavy},gne={Light:10,Medium:20,Heavy:35};async function ld(t="Light"){try{await Yh.impact({style:mne[t]});return}catch{}try{navigator.vibrate?.(gne[t])}catch{}}function cr(t="Light"){ld(t)}async function fF(){try{if(Yh?.selectionStart){await Yh.selectionStart(),await Yh.selectionChanged(),await Yh.selectionEnd();return}}catch{}await ld("Light")}const yne=Object.freeze(Object.defineProperty({__proto__:null,hapticClick:cr,hapticImpact:ld,hapticSelection:fF},Symbol.toStringTag,{value:"Module"}));function dP({isPremium:t,className:e}){const[r,n]=v.useState(!1),{onGoPremium:a,busy:i,ready:o,purchasesReady:c}=Lg();if(!t)return null;const u=async()=>{try{n(!0);try{cr("Light")}catch{}await a()}finally{n(!1)}};return g.jsx("button",{className:e||"felt-btn","data-no-global-haptic":!0,onClick:u,disabled:r||i||!o||!c,"aria-busy":r||i,title:"Manage your subscription",children:r||i?"Processing…":"Manage"})}function pF({open:t,onClose:e,featureDescription:r}){const{user:n}=$r(),{onGoPremium:a,onRestore:i,busy:o,premiumActive:c,hasPremiumPackage:u,premiumLabel:d,error:f,ready:h,purchasesReady:m,premiumPrice:_,premiumInterval:w}=Lg(),b=tn(),{infoNow:E}=Es(),T=async()=>{if(!n?.id){try{b("/login")}catch{}try{e?.()}catch{}return}if(!(c||o))try{if(await a(),!c)return;e()}catch(A){const C=A?.message||"Purchases are initializing… please try again in a moment.";try{E("Purchase unavailable",C)}catch{}}};if(!t)return null;const D=!!n?.id,P="$1.99";return g.jsx("div",{className:"modal-overlay",children:g.jsxs("div",{className:"modal",children:[g.jsx("button",{className:"modal-close","aria-label":"Close",onClick:e,children:"×"}),g.jsx("h3",{children:c?"Premium Active":`Go Premium for ${P}/mo!`}),g.jsx("p",{children:c?"Your premium membership is active.":r||"Creating rooms is a premium feature. Upgrade to unlock it and more."}),!c&&u&&g.jsx("button",{className:"gold-btn felt-btn",onClick:T,disabled:o,children:D?o?"Processing…":d:"Sign in to Upgrade"}),c&&g.jsx("div",{style:{marginTop:12},children:g.jsx(dP,{isPremium:!0})}),!c&&u&&g.jsxs("p",{className:"meta",style:{fontSize:12,opacity:.85},children:[g.jsx("strong",{children:"Premium Subscription"})," — ",_?`${_} `:P+" ",w?`(${w})`:"(Monthly)",". Auto‑renews until canceled. Manage or cancel in account settings on your device. See our ",g.jsx("a",{href:"/privacy",className:"legal-link",children:"Privacy Policy"})," and ",g.jsx("a",{href:"/terms",className:"legal-link",children:"Terms of Use"}),"."]}),f&&g.jsx("p",{className:"error",role:"alert",children:f}),!c&&u&&g.jsx("div",{style:{marginTop:8},children:g.jsx("button",{type:"button",className:"gold-link",onClick:i,disabled:!D||o||!h||!m,"aria-label":"Restore Purchases",title:"Restore Purchases",children:"Restore Purchases"})}),!D&&!c&&g.jsx("p",{className:"meta",children:"Please sign in to upgrade."}),!D&&f&&g.jsx("p",{className:"meta",children:"Purchases unavailable while signed out."})]})})}function fP({open:t,onClose:e,title:r,tagline:n,steps:a,primaryLabel:i,persistKey:o="seenOnboardingV1",secondaryLabel:c="Log In",onSecondary:u,targetSelector:d=".home-mode-toggle-row",coachText:f="Pick a game mode"}){const h=tn(),{user:m,loading:_}=$r(),w=v.useMemo(()=>{if(_)return!1;const A=m?.email||"";return!A||/@guest\.local$/i.test(A)},[m?.email,_]),b=v.useCallback(()=>{try{o&&ms.set({key:o,value:"1"})}catch{}e()},[e,o]);v.useEffect(()=>{if(!t)return;function A(C){C.key==="Escape"&&b()}return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[t,b]);const[E,T]=v.useState(null),D=v.useCallback(()=>{try{if(!t){T(null);return}const A=d?document.querySelector(d):null;if(!A){T(null);return}const C=A.getBoundingClientRect();T({top:C.top,left:C.left,width:C.width,height:C.height})}catch{T(null)}},[t,d]);if(v.useLayoutEffect(()=>{D()},[D]),v.useEffect(()=>{if(!t)return;const A=()=>D(),C=()=>D();window.addEventListener("resize",A),window.addEventListener("scroll",C,!0);const O=setInterval(D,400);return()=>{window.removeEventListener("resize",A),window.removeEventListener("scroll",C,!0),clearInterval(O)}},[t,D]),v.useEffect(()=>{if(t)try{(()=>{try{return!!(window.__E2E===!0||typeof window.location?.search=="string"&&window.location.search.includes("e2e=1")||typeof window.sessionStorage<"u"&&window.sessionStorage.getItem("e2e")==="1")}catch{return!1}})()&&(o&&ms.set({key:o,value:"1"}),setTimeout(()=>{try{e()}catch{}},0))}catch{}},[t,e,o]),!t)return null;const P=Array.isArray(a)&&a.length?a:["Create or join a room","Place bets, roll dice, or deal cards","Win chips and share the fun"];return g.jsxs("div",{className:"onb-modal",role:"dialog","aria-modal":"true","aria-label":"Welcome to Dice Lounge",children:[g.jsx("div",{className:"onb-backdrop",onClick:b}),g.jsxs("div",{className:"onb-card",onClick:A=>A.stopPropagation(),children:[g.jsxs("header",{className:"onb-header",children:[g.jsx("h2",{className:"onb-title",children:r||"Dice Lounge"}),g.jsx("p",{className:"onb-tagline",children:n||"Roll, chat, and play with friends."})]}),g.jsx("ol",{className:"onb-steps","aria-label":"Getting started steps",children:P.map((A,C)=>g.jsx("li",{className:"onb-step",children:A},C))}),g.jsx("div",{className:"onb-cta-row",children:c&&w&&g.jsx("button",{type:"button",className:"onb-btn onb-btn--ghost felt-btn",onClick:u||(()=>h("/login")),children:c})})]}),E&&g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"onb-highlight","aria-hidden":!0,style:{top:Math.max(0,E.top-8),left:Math.max(0,E.left-8),width:E.width+16,height:E.height+16}}),g.jsx("div",{className:"onb-coachmark",role:"note","aria-label":f,style:{top:Math.max(0,E.top-14),left:E.left+E.width/2},children:g.jsx("span",{className:"onb-coachmark__label",children:f})})]})]})}const uN=""+new URL("logo-XCMDZE3A.png",import.meta.url).href,vne=""+new URL("logo-256-CalulGNO.webp",import.meta.url).href,_ne=""+new URL("logo-420-D7JbtaQr.webp",import.meta.url).href,bne=""+new URL("logo-256-BQd-RHpb.avif",import.meta.url).href,kne=""+new URL("logo-420-CxzlrsyU.avif",import.meta.url).href;function hF({width:t=180,height:e=180,tagline:r="Play. Roll. Win. Together!",className:n=""}){const a="poker";let i="";try{i=window?.APP_TARGET??""}catch{}const o=String(a).toLowerCase(),c=o==="cee-lo"?"ceelo":o,u=c==="craps"||c==="poker"||c==="ceelo",d=o==="poker"?"Zentara One Poker Lounge":o==="craps"?"Zentara One Craps Lounge":"Zentara One Dice Lounge";return g.jsxs("div",{className:`logo-hero ${n}`,"data-testid":"logo-hero",children:[u?g.jsxs("picture",{children:[g.jsx("source",{type:"image/webp",srcSet:"./icon-512.webp",sizes:"(max-width: 600px) 60vw, 420px"}),g.jsx("img",{width:t,height:e,src:"./icon.png",alt:d,decoding:"async",loading:"eager",fetchPriority:"high",style:{maxWidth:"100%",height:"auto"},onError:m=>{try{m.currentTarget.src=uN}catch{}}})]}):g.jsxs("picture",{children:[g.jsx("source",{type:"image/avif",srcSet:`${bne} 256w, ${kne} 420w`,sizes:"(max-width: 600px) 60vw, 420px"}),g.jsx("source",{type:"image/webp",srcSet:`${vne} 256w, ${_ne} 420w`,sizes:"(max-width: 600px) 60vw, 420px"}),g.jsx("img",{width:t,height:e,src:uN,alt:d,decoding:"async",loading:"eager",fetchPriority:"high",sizes:"(max-width:600px) 60vw, 420px",style:{maxWidth:"100%",height:"auto"}})]}),r&&g.jsx("span",{className:"gold-link",children:r})]})}function mF({onClose:t}){const[e,r]=v.useState("cee-lo"),n=()=>g.jsxs("div",{className:"howto__toggle",role:"tablist","aria-label":"Select ruleset",children:[g.jsx("button",{type:"button",role:"tab","aria-selected":e==="cee-lo","aria-pressed":e==="cee-lo",onClick:()=>{r("cee-lo")},className:"felt-btn"+(e==="cee-lo"?" felt-btn--active":""),children:"Cee‑Lo"}),g.jsx("button",{type:"button",role:"tab","aria-selected":e==="craps","aria-pressed":e==="craps",onClick:()=>{r("craps")},className:"felt-btn"+(e==="craps"?" felt-btn--active":""),children:"Craps"}),g.jsx("button",{type:"button",role:"tab","aria-selected":e==="poker","aria-pressed":e==="poker",onClick:()=>{r("poker")},className:"felt-btn"+(e==="poker"?" felt-btn--active":""),children:"Poker"})]}),a=g.jsxs(g.Fragment,{children:[g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Overview"}),g.jsx("p",{children:"This is a banker‑versus‑challengers dice game inspired by Cee‑Lo. Each round, the banker rolls first to set the banker outcome. Then challengers roll in turn and compare against the banker. You can place main bets against the banker and optional side bets on other players."})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Single‑Player Mode"}),g.jsxs("ul",{children:[g.jsxs("li",{children:[g.jsx("b",{children:"No tap needed to roll:"})," After you place a MAIN bet, the server will automatically roll for the banker and then for you. This keeps play smooth on mobile."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Place a MAIN bet to begin:"})," The banker won’t roll until there’s at least one open MAIN bet for the round."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Auto pacing:"})," Rounds settle automatically and the next round starts after a short buffer."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Bet window:"})," MAIN bets are open before the banker scores; once the banker establishes a point, MAIN bets lock for the round."]})]})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Round Flow"}),g.jsxs("ol",{children:[g.jsxs("li",{children:[g.jsx("b",{children:"Banker sets the roll:"})," The banker rolls until they have a scoring result."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Challengers roll:"})," Each challenger rolls once a banker score exists."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Settle:"})," Wagers settle automatically with chip animations and a result flash."]})]})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Dice Scoring"}),g.jsxs("ul",{children:[g.jsxs("li",{children:[g.jsx("b",{children:"456 (banker only):"})," Banker wins against everyone (auto‑win)."]}),g.jsxs("li",{children:[g.jsx("b",{children:"123 (banker only):"})," Banker fails/pass this round (auto‑lose / pass)."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Triples:"})," Three of a kind beats any point (higher triple beats lower)."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Point:"})," A pair plus a singleton sets a point equal to the singleton value (1–6). Higher point wins."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Nothing:"})," No pair/triple and not 123/456 — banker re‑rolls; challenger non‑score."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Challenger 123/456:"})," Treated as a normal point (no auto outcome for challengers)."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Tie:"})," Push (stake returned)."]})]})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Main Bets (vs Banker)"}),g.jsxs("ul",{children:[g.jsx("li",{children:"Main bet wins if your roll outranks banker, loses if lower, pushes if equal."}),g.jsx("li",{children:"Banker auto results (456 / 123) settle immediately with no legacy sweep animation."})]})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Side Bets"}),g.jsxs("ul",{children:[g.jsx("li",{children:"Create offers on another player’s upcoming roll (e.g. “Under 4 on Alex”)."}),g.jsx("li",{children:"Only non‑subject players may accept; creator & subject excluded."}),g.jsx("li",{children:"Offer can be canceled until the subject rolls."})]})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Visual Feedback"}),g.jsxs("ul",{children:[g.jsx("li",{children:"Chip flights represent transfers; flashes show WIN / LOSE / PUSH."}),g.jsx("li",{children:"Push flashes appear shortly after resolution to keep pacing consistent."}),g.jsx("li",{children:"Haptics fire for meaningful outcomes (supported devices)."})]})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Tips"}),g.jsxs("ul",{children:[g.jsx("li",{children:"High banker point (5 or 6) reduces challenger EV—size bets accordingly."}),g.jsx("li",{children:"Track patterns with the history view; variance can mask true edge short‑term."})]})]})]}),i=g.jsxs(g.Fragment,{children:[g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Overview"}),g.jsx("p",{children:"Multiplayer Craps implementation (current scope: Pass / Don’t Pass line bets and Place bets on 4,5,6,8,9,10). Additional bet families (Come / Don’t Come, Odds, Field, Big 6/8, Props) will roll out progressively. Settlement & animation pipeline matches other games: each resolved bet triggers chip flight(s) then a result flash."}),g.jsxs("p",{className:"howto__note howto__note--small",children:[g.jsx("b",{children:"Current Limitation:"})," Field, Big 6/8, Come/Dont Come, Odds buttons may appear as educational UI but only Pass / Don’t Pass and Place bets settle right now."]})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Table Flow"}),g.jsxs("ol",{children:[g.jsxs("li",{children:[g.jsx("b",{children:"Come‑Out Roll:"})," Shooter rolls with no point established."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Point Set:"})," First 4,5,6,8,9,10 rolled (unless 7/11/2/3/12 resolves line bets) becomes the point."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Point Phase:"})," Shooter keeps rolling until point repeats (Pass wins) or a 7 appears (Don’t Pass wins / seven‑out)."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Shooter Rotation:"})," On seven‑out (or configured rotation rule) the dice pass to next player in order."]})]})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Pass / Don’t Pass Rules"}),g.jsxs("ul",{children:[g.jsxs("li",{children:[g.jsx("b",{children:"Come‑Out:"})," 7 or 11 = Pass win; 2 or 3 = Pass lose (Don’t Pass win); 12 = Pass lose, Don’t Pass push (bar 12)."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Point Phase:"})," Pass wins if point repeats before 7; Don’t Pass wins on 7 before point."]}),g.jsx("li",{children:"Payout: Even money (winning line bet returns principal + equal winnings; push returns principal)."})]})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Place Bets (Implemented)"}),g.jsxs("ul",{children:[g.jsx("li",{children:"Available only after a point is established."}),g.jsx("li",{children:"Remain on the table until a 7 (seven‑out) or player removes them (UI removal support pending future update)."}),g.jsx("li",{children:"Payout ratios (winnings only; principal stays): 4/10: 9:5 • 5/9: 7:5 • 6/8: 7:6."}),g.jsx("li",{children:"On seven‑out all active place bets lose and are cleared."})]})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Coming Soon"}),g.jsxs("ul",{children:[g.jsxs("li",{children:[g.jsx("b",{children:"Odds Bets:"})," True odds behind line & come bets (no house edge)."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Come / Don’t Come:"})," Independent points established after the main point."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Field & Big 6/8:"})," One‑roll (Field) and even‑money (Big) bets with proper settlement."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Prop / Horn:"})," Center action (yo, any 7, craps, hardways) with single‑roll or multi‑roll resolution."]})]})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Readiness & Rolling"}),g.jsxs("ul",{children:[g.jsx("li",{children:"All players mark Ready between rolls; shooter auto‑ready on new shooter assignment."}),g.jsx("li",{children:"Countdown deadline (if shown) enforces timely rolls; expired deadlines may auto‑roll in later phases."}),g.jsx("li",{children:"Shooter must have an active Pass (or Don’t Pass if allowed by table config) before rolling."})]})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Settlement Pipeline"}),g.jsxs("ul",{children:[g.jsx("li",{children:"Server validates roll → computes line & place settlements → emits results → credits balances."}),g.jsx("li",{children:"Line WIN: principal + winnings credited. Line PUSH: principal only. Place WIN: winnings only (bet stays)."}),g.jsx("li",{children:"Seven‑out triggers removal of all unresolved place bets (auto clear broadcast)."})]})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Payout Reference"}),g.jsxs("ul",{children:[g.jsxs("li",{children:[g.jsx("b",{children:"Pass / Don’t Pass:"})," 1:1"]}),g.jsxs("li",{children:[g.jsx("b",{children:"Place 4 / 10:"})," 9:5"]}),g.jsxs("li",{children:[g.jsx("b",{children:"Place 5 / 9:"})," 7:5"]}),g.jsxs("li",{children:[g.jsx("b",{children:"Place 6 / 8:"})," 7:6"]})]}),g.jsx("p",{className:"howto__note howto__note--tiny",children:"Fractions floored in current build; rounding rules may refine later."})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Strategy Notes (Basics)"}),g.jsxs("ul",{children:[g.jsx("li",{children:"Place 6 & 8 have the lowest house edge among implemented place bets."}),g.jsx("li",{children:"Even‑money Pass vs Don’t Pass is preference until odds arrive (future true‑odds leverage)."}),g.jsx("li",{children:"Avoid overexposing bankroll pre‑odds: variance on early seven‑outs can be sharp."})]})]})]}),o=g.jsxs(g.Fragment,{children:[g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Overview"}),g.jsx("p",{children:"No‑limit Texas Hold’em with simplified pacing. Hands proceed through Pre‑flop, Flop, Turn, River, then Showdown. Seats auto‑order left of the dealer button. Side pots and all‑in handling are automatic. Bots may fill seats in single‑player rooms."}),g.jsxs("p",{className:"howto__note howto__note--small",children:[g.jsx("b",{children:"Table Defaults:"})," Small blind 5, big blind 10, minimum buy‑in z1000, up to 6 seats."]})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Buy‑In & Seating"}),g.jsxs("ul",{children:[g.jsxs("li",{children:["Joining a poker room requires at least ",g.jsx("b",{children:"z1000"})," balance (server‑enforced)."]}),g.jsx("li",{children:"When seated, your starting stack equals the minimum buy‑in (z1000)."}),g.jsx("li",{children:"Bots, when present, are seated with z1000 stacks."})]})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Blinds & Turn Order"}),g.jsxs("ul",{children:[g.jsx("li",{children:"The dealer button rotates each hand. Players post small blind and big blind to start the pot."}),g.jsx("li",{children:"Pre‑flop action begins left of the big blind; on later streets it begins left of the button."})]})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Actions"}),g.jsxs("ul",{children:[g.jsxs("li",{children:[g.jsx("b",{children:"Fold"})," — Surrender your hand; no further claim to the pot."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Check/Call"})," — Match the current bet to continue (or check for free when no bet is outstanding)."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Bet/Raise"})," — Put chips in the pot. Min raise equals the last raise size; UI shows legal targets."]})]})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Streets & Dealing"}),g.jsxs("ul",{children:[g.jsxs("li",{children:[g.jsx("b",{children:"Pre‑flop:"})," Two private cards to each player."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Flop:"})," Three community cards."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Turn:"})," One community card."]}),g.jsxs("li",{children:[g.jsx("b",{children:"River:"})," One community card."]}),g.jsx("li",{children:"Short UI locks play during dealing animations to keep state consistent."})]})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Pots, All‑In, Side Pots"}),g.jsxs("ul",{children:[g.jsx("li",{children:"Contributions create the main pot and side pots automatically when stacks differ."}),g.jsx("li",{children:"At showdown each pot is awarded to the best eligible hand among its contributors; ties split evenly (with any odd chip distributed deterministically)."})]})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Hand Ranking (Best 5 Cards)"}),g.jsx("ul",{children:g.jsx("li",{children:"Straight Flush (best) → Four of a Kind → Full House → Flush → Straight → Three of a Kind → Two Pair → One Pair → High Card."})})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Showdown"}),g.jsx("ul",{children:g.jsx("li",{children:"Remaining players reveal; best 5‑card hand wins each pot. If everyone else folds, last player takes the pot without showdown."})})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Tips"}),g.jsxs("ul",{children:[g.jsx("li",{children:"Respect position: act later to gather more information."}),g.jsx("li",{children:"Size raises relative to the pot and prior aggression; avoid bet sizing tells."}),g.jsx("li",{children:"Tighten ranges out of position; widen on the button."})]})]})]});return g.jsxs("div",{className:"card how-to-play howto",children:[g.jsx("div",{className:"card-header howto__header",children:g.jsx("div",{className:"howto__header-row",children:g.jsx(n,{})})}),g.jsx("h2",{className:"howto__title",children:"How to Play"}),g.jsxs("div",{className:"card-body howto__body",children:[g.jsxs("div",{role:"note","aria-label":"Disclaimer",className:"howto__disclaimer",children:[g.jsx("strong",{children:"Disclaimer:"})," This is not a real‑money gambling site. No real currency, wagers, or payouts are involved. For entertainment and educational purposes only."]}),e==="cee-lo"?a:e==="craps"?i:o]})]})}function gF({open:t,onClose:e}){const r=v.useRef(null),n="howto-intro";return v.useEffect(()=>{if(!t)return;const a=o=>{o.key==="Escape"&&e()},i=o=>{r.current&&!r.current.contains(o.target)&&e()};return document.addEventListener("keydown",a),document.addEventListener("mousedown",i),()=>{document.removeEventListener("keydown",a),document.removeEventListener("mousedown",i)}},[t,e]),t?g.jsx("div",{className:"modal-backdrop",role:"presentation",children:g.jsxs("div",{className:"modal-panel modal-panel--fullscreen howto-modal",role:"dialog","aria-modal":"true","aria-label":"How to Play","aria-describedby":n,ref:r,children:[g.jsxs("div",{className:"modal-header",children:[g.jsx("h3",{className:"modal-title",children:"How to Play"}),g.jsx("button",{className:"modal-close",onClick:e,"aria-label":"Close",children:"×"})]}),g.jsxs("div",{id:n,className:"modal-intro",children:[g.jsx("p",{children:"To get started:"}),g.jsxs("ol",{children:[g.jsx("li",{children:"Select a game mode from the Home screen (e.g., Cee‑Lo, Craps, Poker)."}),g.jsx("li",{children:"Then choose your action when it’s your turn (Roll, Place Bet, Pass/Bank, etc.)."})]})]}),g.jsx(mF,{})]})}):null}function wne(){const{user:t}=$r(),[e,r]=v.useState(null),[n,a]=v.useState(!1),[i,o]=v.useState(null),c=ci(),u=v.useCallback(async()=>{if(t){a(!0),o(null);try{const d=await oi(),f=await fetch(`${c}/api/leaderboard/summary`,{credentials:"include",headers:{...d?{Authorization:`Bearer ${d}`}:{},Accept:"application/json"}});if(!(f.headers.get("content-type")||"").includes("application/json")){const _=await f.text();throw new Error(`Unexpected response (${f.status}). Not JSON. First bytes: ${_.slice(0,120)}`)}const m=await f.json();if(m?.ok&&m?.data)r(m.data);else throw new Error(m?.error||"Failed to load leaderboard")}catch(d){o(d?.message??"Failed to load leaderboard")}finally{a(!1)}}},[t]);return v.useEffect(()=>{t&&u()},[t,u]),{data:e,loading:n,error:i,refresh:u}}function Sne({open:t,onClose:e}){const{data:r,loading:n,error:a,refresh:i}=wne();return v.useEffect(()=>{t&&i()},[t,i]),t?g.jsx("div",{className:"modal-backdrop",role:"presentation",onClick:e,children:g.jsxs("div",{className:"modal-panel modal-panel--fullscreen leaderboard-modal",role:"dialog","aria-modal":"true","aria-label":"Leaderboards",onClick:o=>o.stopPropagation(),children:[g.jsxs("div",{className:"modal-header",children:[g.jsx("h3",{className:"modal-title",children:"Leaderboards"}),g.jsx("button",{className:"modal-close",onClick:e,"aria-label":"Close",children:"×"})]}),n&&g.jsx("p",{children:"Loading…"}),a&&g.jsx("p",{className:"error",role:"status",children:a}),r&&g.jsxs("div",{className:"leaderboard-sections",children:[g.jsxs("section",{children:[g.jsx("h4",{children:"Top Balances"}),g.jsx("ol",{className:"lb-list",children:r.topBalances.map(o=>g.jsxs("li",{className:"lb-row",children:[g.jsxs("span",{className:"lb-rank",children:["#",o.rank]}),g.jsx("span",{className:"lb-name",children:o.name}),g.jsxs("span",{className:"lb-metric",children:[o.balance.toLocaleString()," chips"]})]},o.playerId))})]}),g.jsxs("section",{children:[g.jsx("h4",{children:"Weekly Winners"}),g.jsx("ol",{className:"lb-list",children:r.weeklyWinners.map(o=>g.jsxs("li",{className:"lb-row",children:[g.jsxs("span",{className:"lb-rank",children:["#",o.rank]}),g.jsx("span",{className:"lb-name",children:o.name}),g.jsxs("span",{className:"lb-metric",children:["+",o.amount.toLocaleString()," chips"]})]},o.playerId))})]}),g.jsxs("section",{children:[g.jsx("h4",{children:"All‑Time Winners"}),g.jsx("ol",{className:"lb-list",children:r.allTimeWinners.map(o=>g.jsxs("li",{className:"lb-row",children:[g.jsxs("span",{className:"lb-rank",children:["#",o.rank]}),g.jsx("span",{className:"lb-name",children:o.name}),g.jsxs("span",{className:"lb-metric",children:["+",o.amount.toLocaleString()," chips"]})]},o.playerId))})]})]})]})}):null}function Ene({open:t,onClose:e,onGoLogin:r,title:n,message:a}){const i=v.useRef(null),o=tn();if(v.useEffect(()=>{if(!t)return;const u=f=>{f.key==="Escape"&&e()},d=f=>{i.current&&!i.current.contains(f.target)&&e()};return document.addEventListener("keydown",u),document.addEventListener("mousedown",d),()=>{document.removeEventListener("keydown",u),document.removeEventListener("mousedown",d)}},[t,e]),!t)return null;const c=()=>{try{(r??(()=>o("/login")))()}finally{e()}};return g.jsx("div",{className:"modal-backdrop",role:"presentation",children:g.jsxs("div",{className:"modal-panel",role:"dialog","aria-modal":"true","aria-label":"Login required",ref:i,children:[g.jsx("button",{className:"modal-close",onClick:e,"aria-label":"Close",children:"×"}),g.jsx("h3",{className:"modal-title",children:n??"Login Required"}),a?g.jsx("div",{style:{marginTop:8},children:a}):g.jsx("p",{style:{marginTop:8},children:"You need to be logged in to access this feature."}),g.jsxs("div",{style:{display:"flex",gap:12,marginTop:16,justifyContent:"flex-end"},children:[g.jsx("button",{className:"felt-btn btn--ghost",onClick:e,children:"Cancel"}),g.jsx("button",{className:"felt-btn felt-btn--primary",onClick:c,children:"Go to Login"})]})]})})}const kf=ro("CapacitorUpdater",{web:()=>qr(()=>import("./web-gvOHVfty.js"),[],import.meta.url).then(t=>new t.CapacitorUpdaterWeb)});var gv={exports:{}},Qw,dN;function Qb(){if(dN)return Qw;dN=1;const t="2.0.0",e=256,r=Number.MAX_SAFE_INTEGER||9007199254740991,n=16,a=e-6;return Qw={MAX_LENGTH:e,MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:a,MAX_SAFE_INTEGER:r,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:t,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},Qw}var Zw,fN;function Zb(){if(fN)return Zw;fN=1;var t={};return Zw=typeof process=="object"&&t&&t.NODE_DEBUG&&/\bsemver\b/i.test(t.NODE_DEBUG)?(...r)=>{}:()=>{},Zw}var pN;function Bg(){return pN||(pN=1,(function(t,e){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:a}=Qb(),i=Zb();e=t.exports={};const o=e.re=[],c=e.safeRe=[],u=e.src=[],d=e.safeSrc=[],f=e.t={};let h=0;const m="[a-zA-Z0-9-]",_=[["\\s",1],["\\d",a],[m,n]],w=E=>{for(const[T,D]of _)E=E.split(`${T}*`).join(`${T}{0,${D}}`).split(`${T}+`).join(`${T}{1,${D}}`);return E},b=(E,T,D)=>{const P=w(T),A=h++;i(E,A,T),f[E]=A,u[A]=T,d[A]=P,o[A]=new RegExp(T,D?"g":void 0),c[A]=new RegExp(P,D?"g":void 0)};b("NUMERICIDENTIFIER","0|[1-9]\\d*"),b("NUMERICIDENTIFIERLOOSE","\\d+"),b("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${m}*`),b("MAINVERSION",`(${u[f.NUMERICIDENTIFIER]})\\.(${u[f.NUMERICIDENTIFIER]})\\.(${u[f.NUMERICIDENTIFIER]})`),b("MAINVERSIONLOOSE",`(${u[f.NUMERICIDENTIFIERLOOSE]})\\.(${u[f.NUMERICIDENTIFIERLOOSE]})\\.(${u[f.NUMERICIDENTIFIERLOOSE]})`),b("PRERELEASEIDENTIFIER",`(?:${u[f.NONNUMERICIDENTIFIER]}|${u[f.NUMERICIDENTIFIER]})`),b("PRERELEASEIDENTIFIERLOOSE",`(?:${u[f.NONNUMERICIDENTIFIER]}|${u[f.NUMERICIDENTIFIERLOOSE]})`),b("PRERELEASE",`(?:-(${u[f.PRERELEASEIDENTIFIER]}(?:\\.${u[f.PRERELEASEIDENTIFIER]})*))`),b("PRERELEASELOOSE",`(?:-?(${u[f.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${u[f.PRERELEASEIDENTIFIERLOOSE]})*))`),b("BUILDIDENTIFIER",`${m}+`),b("BUILD",`(?:\\+(${u[f.BUILDIDENTIFIER]}(?:\\.${u[f.BUILDIDENTIFIER]})*))`),b("FULLPLAIN",`v?${u[f.MAINVERSION]}${u[f.PRERELEASE]}?${u[f.BUILD]}?`),b("FULL",`^${u[f.FULLPLAIN]}$`),b("LOOSEPLAIN",`[v=\\s]*${u[f.MAINVERSIONLOOSE]}${u[f.PRERELEASELOOSE]}?${u[f.BUILD]}?`),b("LOOSE",`^${u[f.LOOSEPLAIN]}$`),b("GTLT","((?:<|>)?=?)"),b("XRANGEIDENTIFIERLOOSE",`${u[f.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),b("XRANGEIDENTIFIER",`${u[f.NUMERICIDENTIFIER]}|x|X|\\*`),b("XRANGEPLAIN",`[v=\\s]*(${u[f.XRANGEIDENTIFIER]})(?:\\.(${u[f.XRANGEIDENTIFIER]})(?:\\.(${u[f.XRANGEIDENTIFIER]})(?:${u[f.PRERELEASE]})?${u[f.BUILD]}?)?)?`),b("XRANGEPLAINLOOSE",`[v=\\s]*(${u[f.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[f.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[f.XRANGEIDENTIFIERLOOSE]})(?:${u[f.PRERELEASELOOSE]})?${u[f.BUILD]}?)?)?`),b("XRANGE",`^${u[f.GTLT]}\\s*${u[f.XRANGEPLAIN]}$`),b("XRANGELOOSE",`^${u[f.GTLT]}\\s*${u[f.XRANGEPLAINLOOSE]}$`),b("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),b("COERCE",`${u[f.COERCEPLAIN]}(?:$|[^\\d])`),b("COERCEFULL",u[f.COERCEPLAIN]+`(?:${u[f.PRERELEASE]})?(?:${u[f.BUILD]})?(?:$|[^\\d])`),b("COERCERTL",u[f.COERCE],!0),b("COERCERTLFULL",u[f.COERCEFULL],!0),b("LONETILDE","(?:~>?)"),b("TILDETRIM",`(\\s*)${u[f.LONETILDE]}\\s+`,!0),e.tildeTrimReplace="$1~",b("TILDE",`^${u[f.LONETILDE]}${u[f.XRANGEPLAIN]}$`),b("TILDELOOSE",`^${u[f.LONETILDE]}${u[f.XRANGEPLAINLOOSE]}$`),b("LONECARET","(?:\\^)"),b("CARETTRIM",`(\\s*)${u[f.LONECARET]}\\s+`,!0),e.caretTrimReplace="$1^",b("CARET",`^${u[f.LONECARET]}${u[f.XRANGEPLAIN]}$`),b("CARETLOOSE",`^${u[f.LONECARET]}${u[f.XRANGEPLAINLOOSE]}$`),b("COMPARATORLOOSE",`^${u[f.GTLT]}\\s*(${u[f.LOOSEPLAIN]})$|^$`),b("COMPARATOR",`^${u[f.GTLT]}\\s*(${u[f.FULLPLAIN]})$|^$`),b("COMPARATORTRIM",`(\\s*)${u[f.GTLT]}\\s*(${u[f.LOOSEPLAIN]}|${u[f.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace="$1$2$3",b("HYPHENRANGE",`^\\s*(${u[f.XRANGEPLAIN]})\\s+-\\s+(${u[f.XRANGEPLAIN]})\\s*$`),b("HYPHENRANGELOOSE",`^\\s*(${u[f.XRANGEPLAINLOOSE]})\\s+-\\s+(${u[f.XRANGEPLAINLOOSE]})\\s*$`),b("STAR","(<|>)?=?\\s*\\*"),b("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),b("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(gv,gv.exports)),gv.exports}var eS,hN;function pP(){if(hN)return eS;hN=1;const t=Object.freeze({loose:!0}),e=Object.freeze({});return eS=n=>n?typeof n!="object"?t:n:e,eS}var tS,mN;function yF(){if(mN)return tS;mN=1;const t=/^[0-9]+$/,e=(n,a)=>{const i=t.test(n),o=t.test(a);return i&&o&&(n=+n,a=+a),n===a?0:i&&!o?-1:o&&!i?1:n<a?-1:1};return tS={compareIdentifiers:e,rcompareIdentifiers:(n,a)=>e(a,n)},tS}var rS,gN;function Ya(){if(gN)return rS;gN=1;const t=Zb(),{MAX_LENGTH:e,MAX_SAFE_INTEGER:r}=Qb(),{safeRe:n,t:a}=Bg(),i=pP(),{compareIdentifiers:o}=yF();class c{constructor(d,f){if(f=i(f),d instanceof c){if(d.loose===!!f.loose&&d.includePrerelease===!!f.includePrerelease)return d;d=d.version}else if(typeof d!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof d}".`);if(d.length>e)throw new TypeError(`version is longer than ${e} characters`);t("SemVer",d,f),this.options=f,this.loose=!!f.loose,this.includePrerelease=!!f.includePrerelease;const h=d.trim().match(f.loose?n[a.LOOSE]:n[a.FULL]);if(!h)throw new TypeError(`Invalid Version: ${d}`);if(this.raw=d,this.major=+h[1],this.minor=+h[2],this.patch=+h[3],this.major>r||this.major<0)throw new TypeError("Invalid major version");if(this.minor>r||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>r||this.patch<0)throw new TypeError("Invalid patch version");h[4]?this.prerelease=h[4].split(".").map(m=>{if(/^[0-9]+$/.test(m)){const _=+m;if(_>=0&&_<r)return _}return m}):this.prerelease=[],this.build=h[5]?h[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(d){if(t("SemVer.compare",this.version,this.options,d),!(d instanceof c)){if(typeof d=="string"&&d===this.version)return 0;d=new c(d,this.options)}return d.version===this.version?0:this.compareMain(d)||this.comparePre(d)}compareMain(d){return d instanceof c||(d=new c(d,this.options)),o(this.major,d.major)||o(this.minor,d.minor)||o(this.patch,d.patch)}comparePre(d){if(d instanceof c||(d=new c(d,this.options)),this.prerelease.length&&!d.prerelease.length)return-1;if(!this.prerelease.length&&d.prerelease.length)return 1;if(!this.prerelease.length&&!d.prerelease.length)return 0;let f=0;do{const h=this.prerelease[f],m=d.prerelease[f];if(t("prerelease compare",f,h,m),h===void 0&&m===void 0)return 0;if(m===void 0)return 1;if(h===void 0)return-1;if(h===m)continue;return o(h,m)}while(++f)}compareBuild(d){d instanceof c||(d=new c(d,this.options));let f=0;do{const h=this.build[f],m=d.build[f];if(t("build compare",f,h,m),h===void 0&&m===void 0)return 0;if(m===void 0)return 1;if(h===void 0)return-1;if(h===m)continue;return o(h,m)}while(++f)}inc(d,f,h){if(d.startsWith("pre")){if(!f&&h===!1)throw new Error("invalid increment argument: identifier is empty");if(f){const m=`-${f}`.match(this.options.loose?n[a.PRERELEASELOOSE]:n[a.PRERELEASE]);if(!m||m[1]!==f)throw new Error(`invalid identifier: ${f}`)}}switch(d){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",f,h);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",f,h);break;case"prepatch":this.prerelease.length=0,this.inc("patch",f,h),this.inc("pre",f,h);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",f,h),this.inc("pre",f,h);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{const m=Number(h)?1:0;if(this.prerelease.length===0)this.prerelease=[m];else{let _=this.prerelease.length;for(;--_>=0;)typeof this.prerelease[_]=="number"&&(this.prerelease[_]++,_=-2);if(_===-1){if(f===this.prerelease.join(".")&&h===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(m)}}if(f){let _=[f,m];h===!1&&(_=[f]),o(this.prerelease[0],f)===0?isNaN(this.prerelease[1])&&(this.prerelease=_):this.prerelease=_}break}default:throw new Error(`invalid increment argument: ${d}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return rS=c,rS}var nS,yN;function Rp(){if(yN)return nS;yN=1;const t=Ya();return nS=(r,n,a=!1)=>{if(r instanceof t)return r;try{return new t(r,n)}catch(i){if(!a)return null;throw i}},nS}var aS,vN;function Tne(){if(vN)return aS;vN=1;const t=Rp();return aS=(r,n)=>{const a=t(r,n);return a?a.version:null},aS}var iS,_N;function Cne(){if(_N)return iS;_N=1;const t=Rp();return iS=(r,n)=>{const a=t(r.trim().replace(/^[=v]+/,""),n);return a?a.version:null},iS}var sS,bN;function xne(){if(bN)return sS;bN=1;const t=Ya();return sS=(r,n,a,i,o)=>{typeof a=="string"&&(o=i,i=a,a=void 0);try{return new t(r instanceof t?r.version:r,a).inc(n,i,o).version}catch{return null}},sS}var oS,kN;function Pne(){if(kN)return oS;kN=1;const t=Rp();return oS=(r,n)=>{const a=t(r,null,!0),i=t(n,null,!0),o=a.compare(i);if(o===0)return null;const c=o>0,u=c?a:i,d=c?i:a,f=!!u.prerelease.length;if(!!d.prerelease.length&&!f){if(!d.patch&&!d.minor)return"major";if(d.compareMain(u)===0)return d.minor&&!d.patch?"minor":"patch"}const m=f?"pre":"";return a.major!==i.major?m+"major":a.minor!==i.minor?m+"minor":a.patch!==i.patch?m+"patch":"prerelease"},oS}var cS,wN;function Ane(){if(wN)return cS;wN=1;const t=Ya();return cS=(r,n)=>new t(r,n).major,cS}var lS,SN;function Rne(){if(SN)return lS;SN=1;const t=Ya();return lS=(r,n)=>new t(r,n).minor,lS}var uS,EN;function Dne(){if(EN)return uS;EN=1;const t=Ya();return uS=(r,n)=>new t(r,n).patch,uS}var dS,TN;function One(){if(TN)return dS;TN=1;const t=Rp();return dS=(r,n)=>{const a=t(r,n);return a&&a.prerelease.length?a.prerelease:null},dS}var fS,CN;function io(){if(CN)return fS;CN=1;const t=Ya();return fS=(r,n,a)=>new t(r,a).compare(new t(n,a)),fS}var pS,xN;function Nne(){if(xN)return pS;xN=1;const t=io();return pS=(r,n,a)=>t(n,r,a),pS}var hS,PN;function Ine(){if(PN)return hS;PN=1;const t=io();return hS=(r,n)=>t(r,n,!0),hS}var mS,AN;function hP(){if(AN)return mS;AN=1;const t=Ya();return mS=(r,n,a)=>{const i=new t(r,a),o=new t(n,a);return i.compare(o)||i.compareBuild(o)},mS}var gS,RN;function Mne(){if(RN)return gS;RN=1;const t=hP();return gS=(r,n)=>r.sort((a,i)=>t(a,i,n)),gS}var yS,DN;function jne(){if(DN)return yS;DN=1;const t=hP();return yS=(r,n)=>r.sort((a,i)=>t(i,a,n)),yS}var vS,ON;function e0(){if(ON)return vS;ON=1;const t=io();return vS=(r,n,a)=>t(r,n,a)>0,vS}var _S,NN;function mP(){if(NN)return _S;NN=1;const t=io();return _S=(r,n,a)=>t(r,n,a)<0,_S}var bS,IN;function vF(){if(IN)return bS;IN=1;const t=io();return bS=(r,n,a)=>t(r,n,a)===0,bS}var kS,MN;function _F(){if(MN)return kS;MN=1;const t=io();return kS=(r,n,a)=>t(r,n,a)!==0,kS}var wS,jN;function gP(){if(jN)return wS;jN=1;const t=io();return wS=(r,n,a)=>t(r,n,a)>=0,wS}var SS,LN;function yP(){if(LN)return SS;LN=1;const t=io();return SS=(r,n,a)=>t(r,n,a)<=0,SS}var ES,BN;function bF(){if(BN)return ES;BN=1;const t=vF(),e=_F(),r=e0(),n=gP(),a=mP(),i=yP();return ES=(c,u,d,f)=>{switch(u){case"===":return typeof c=="object"&&(c=c.version),typeof d=="object"&&(d=d.version),c===d;case"!==":return typeof c=="object"&&(c=c.version),typeof d=="object"&&(d=d.version),c!==d;case"":case"=":case"==":return t(c,d,f);case"!=":return e(c,d,f);case">":return r(c,d,f);case">=":return n(c,d,f);case"<":return a(c,d,f);case"<=":return i(c,d,f);default:throw new TypeError(`Invalid operator: ${u}`)}},ES}var TS,UN;function Lne(){if(UN)return TS;UN=1;const t=Ya(),e=Rp(),{safeRe:r,t:n}=Bg();return TS=(i,o)=>{if(i instanceof t)return i;if(typeof i=="number"&&(i=String(i)),typeof i!="string")return null;o=o||{};let c=null;if(!o.rtl)c=i.match(o.includePrerelease?r[n.COERCEFULL]:r[n.COERCE]);else{const _=o.includePrerelease?r[n.COERCERTLFULL]:r[n.COERCERTL];let w;for(;(w=_.exec(i))&&(!c||c.index+c[0].length!==i.length);)(!c||w.index+w[0].length!==c.index+c[0].length)&&(c=w),_.lastIndex=w.index+w[1].length+w[2].length;_.lastIndex=-1}if(c===null)return null;const u=c[2],d=c[3]||"0",f=c[4]||"0",h=o.includePrerelease&&c[5]?`-${c[5]}`:"",m=o.includePrerelease&&c[6]?`+${c[6]}`:"";return e(`${u}.${d}.${f}${h}${m}`,o)},TS}var CS,FN;function Bne(){if(FN)return CS;FN=1;class t{constructor(){this.max=1e3,this.map=new Map}get(r){const n=this.map.get(r);if(n!==void 0)return this.map.delete(r),this.map.set(r,n),n}delete(r){return this.map.delete(r)}set(r,n){if(!this.delete(r)&&n!==void 0){if(this.map.size>=this.max){const i=this.map.keys().next().value;this.delete(i)}this.map.set(r,n)}return this}}return CS=t,CS}var xS,qN;function so(){if(qN)return xS;qN=1;const t=/\s+/g;class e{constructor(W,F){if(F=a(F),W instanceof e)return W.loose===!!F.loose&&W.includePrerelease===!!F.includePrerelease?W:new e(W.raw,F);if(W instanceof i)return this.raw=W.value,this.set=[[W]],this.formatted=void 0,this;if(this.options=F,this.loose=!!F.loose,this.includePrerelease=!!F.includePrerelease,this.raw=W.trim().replace(t," "),this.set=this.raw.split("||").map(Y=>this.parseRange(Y.trim())).filter(Y=>Y.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const Y=this.set[0];if(this.set=this.set.filter(Q=>!b(Q[0])),this.set.length===0)this.set=[Y];else if(this.set.length>1){for(const Q of this.set)if(Q.length===1&&E(Q[0])){this.set=[Q];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let W=0;W<this.set.length;W++){W>0&&(this.formatted+="||");const F=this.set[W];for(let Y=0;Y<F.length;Y++)Y>0&&(this.formatted+=" "),this.formatted+=F[Y].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(W){const Y=((this.options.includePrerelease&&_)|(this.options.loose&&w))+":"+W,Q=n.get(Y);if(Q)return Q;const ie=this.options.loose,G=ie?u[d.HYPHENRANGELOOSE]:u[d.HYPHENRANGE];W=W.replace(G,j(this.options.includePrerelease)),o("hyphen replace",W),W=W.replace(u[d.COMPARATORTRIM],f),o("comparator trim",W),W=W.replace(u[d.TILDETRIM],h),o("tilde trim",W),W=W.replace(u[d.CARETTRIM],m),o("caret trim",W);let B=W.split(" ").map(me=>D(me,this.options)).join(" ").split(/\s+/).map(me=>L(me,this.options));ie&&(B=B.filter(me=>(o("loose invalid filter",me,this.options),!!me.match(u[d.COMPARATORLOOSE])))),o("range list",B);const K=new Map,ae=B.map(me=>new i(me,this.options));for(const me of ae){if(b(me))return[me];K.set(me.value,me)}K.size>1&&K.has("")&&K.delete("");const te=[...K.values()];return n.set(Y,te),te}intersects(W,F){if(!(W instanceof e))throw new TypeError("a Range is required");return this.set.some(Y=>T(Y,F)&&W.set.some(Q=>T(Q,F)&&Y.every(ie=>Q.every(G=>ie.intersects(G,F)))))}test(W){if(!W)return!1;if(typeof W=="string")try{W=new c(W,this.options)}catch{return!1}for(let F=0;F<this.set.length;F++)if(q(this.set[F],W,this.options))return!0;return!1}}xS=e;const r=Bne(),n=new r,a=pP(),i=t0(),o=Zb(),c=Ya(),{safeRe:u,t:d,comparatorTrimReplace:f,tildeTrimReplace:h,caretTrimReplace:m}=Bg(),{FLAG_INCLUDE_PRERELEASE:_,FLAG_LOOSE:w}=Qb(),b=U=>U.value==="<0.0.0-0",E=U=>U.value==="",T=(U,W)=>{let F=!0;const Y=U.slice();let Q=Y.pop();for(;F&&Y.length;)F=Y.every(ie=>Q.intersects(ie,W)),Q=Y.pop();return F},D=(U,W)=>(o("comp",U,W),U=O(U,W),o("caret",U),U=A(U,W),o("tildes",U),U=x(U,W),o("xrange",U),U=N(U,W),o("stars",U),U),P=U=>!U||U.toLowerCase()==="x"||U==="*",A=(U,W)=>U.trim().split(/\s+/).map(F=>C(F,W)).join(" "),C=(U,W)=>{const F=W.loose?u[d.TILDELOOSE]:u[d.TILDE];return U.replace(F,(Y,Q,ie,G,B)=>{o("tilde",U,Y,Q,ie,G,B);let K;return P(Q)?K="":P(ie)?K=`>=${Q}.0.0 <${+Q+1}.0.0-0`:P(G)?K=`>=${Q}.${ie}.0 <${Q}.${+ie+1}.0-0`:B?(o("replaceTilde pr",B),K=`>=${Q}.${ie}.${G}-${B} <${Q}.${+ie+1}.0-0`):K=`>=${Q}.${ie}.${G} <${Q}.${+ie+1}.0-0`,o("tilde return",K),K})},O=(U,W)=>U.trim().split(/\s+/).map(F=>I(F,W)).join(" "),I=(U,W)=>{o("caret",U,W);const F=W.loose?u[d.CARETLOOSE]:u[d.CARET],Y=W.includePrerelease?"-0":"";return U.replace(F,(Q,ie,G,B,K)=>{o("caret",U,Q,ie,G,B,K);let ae;return P(ie)?ae="":P(G)?ae=`>=${ie}.0.0${Y} <${+ie+1}.0.0-0`:P(B)?ie==="0"?ae=`>=${ie}.${G}.0${Y} <${ie}.${+G+1}.0-0`:ae=`>=${ie}.${G}.0${Y} <${+ie+1}.0.0-0`:K?(o("replaceCaret pr",K),ie==="0"?G==="0"?ae=`>=${ie}.${G}.${B}-${K} <${ie}.${G}.${+B+1}-0`:ae=`>=${ie}.${G}.${B}-${K} <${ie}.${+G+1}.0-0`:ae=`>=${ie}.${G}.${B}-${K} <${+ie+1}.0.0-0`):(o("no pr"),ie==="0"?G==="0"?ae=`>=${ie}.${G}.${B}${Y} <${ie}.${G}.${+B+1}-0`:ae=`>=${ie}.${G}.${B}${Y} <${ie}.${+G+1}.0-0`:ae=`>=${ie}.${G}.${B} <${+ie+1}.0.0-0`),o("caret return",ae),ae})},x=(U,W)=>(o("replaceXRanges",U,W),U.split(/\s+/).map(F=>R(F,W)).join(" ")),R=(U,W)=>{U=U.trim();const F=W.loose?u[d.XRANGELOOSE]:u[d.XRANGE];return U.replace(F,(Y,Q,ie,G,B,K)=>{o("xRange",U,Y,Q,ie,G,B,K);const ae=P(ie),te=ae||P(G),me=te||P(B),ue=me;return Q==="="&&ue&&(Q=""),K=W.includePrerelease?"-0":"",ae?Q===">"||Q==="<"?Y="<0.0.0-0":Y="*":Q&&ue?(te&&(G=0),B=0,Q===">"?(Q=">=",te?(ie=+ie+1,G=0,B=0):(G=+G+1,B=0)):Q==="<="&&(Q="<",te?ie=+ie+1:G=+G+1),Q==="<"&&(K="-0"),Y=`${Q+ie}.${G}.${B}${K}`):te?Y=`>=${ie}.0.0${K} <${+ie+1}.0.0-0`:me&&(Y=`>=${ie}.${G}.0${K} <${ie}.${+G+1}.0-0`),o("xRange return",Y),Y})},N=(U,W)=>(o("replaceStars",U,W),U.trim().replace(u[d.STAR],"")),L=(U,W)=>(o("replaceGTE0",U,W),U.trim().replace(u[W.includePrerelease?d.GTE0PRE:d.GTE0],"")),j=U=>(W,F,Y,Q,ie,G,B,K,ae,te,me,ue)=>(P(Y)?F="":P(Q)?F=`>=${Y}.0.0${U?"-0":""}`:P(ie)?F=`>=${Y}.${Q}.0${U?"-0":""}`:G?F=`>=${F}`:F=`>=${F}${U?"-0":""}`,P(ae)?K="":P(te)?K=`<${+ae+1}.0.0-0`:P(me)?K=`<${ae}.${+te+1}.0-0`:ue?K=`<=${ae}.${te}.${me}-${ue}`:U?K=`<${ae}.${te}.${+me+1}-0`:K=`<=${K}`,`${F} ${K}`.trim()),q=(U,W,F)=>{for(let Y=0;Y<U.length;Y++)if(!U[Y].test(W))return!1;if(W.prerelease.length&&!F.includePrerelease){for(let Y=0;Y<U.length;Y++)if(o(U[Y].semver),U[Y].semver!==i.ANY&&U[Y].semver.prerelease.length>0){const Q=U[Y].semver;if(Q.major===W.major&&Q.minor===W.minor&&Q.patch===W.patch)return!0}return!1}return!0};return xS}var PS,zN;function t0(){if(zN)return PS;zN=1;const t=Symbol("SemVer ANY");class e{static get ANY(){return t}constructor(f,h){if(h=r(h),f instanceof e){if(f.loose===!!h.loose)return f;f=f.value}f=f.trim().split(/\s+/).join(" "),o("comparator",f,h),this.options=h,this.loose=!!h.loose,this.parse(f),this.semver===t?this.value="":this.value=this.operator+this.semver.version,o("comp",this)}parse(f){const h=this.options.loose?n[a.COMPARATORLOOSE]:n[a.COMPARATOR],m=f.match(h);if(!m)throw new TypeError(`Invalid comparator: ${f}`);this.operator=m[1]!==void 0?m[1]:"",this.operator==="="&&(this.operator=""),m[2]?this.semver=new c(m[2],this.options.loose):this.semver=t}toString(){return this.value}test(f){if(o("Comparator.test",f,this.options.loose),this.semver===t||f===t)return!0;if(typeof f=="string")try{f=new c(f,this.options)}catch{return!1}return i(f,this.operator,this.semver,this.options)}intersects(f,h){if(!(f instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new u(f.value,h).test(this.value):f.operator===""?f.value===""?!0:new u(this.value,h).test(f.semver):(h=r(h),h.includePrerelease&&(this.value==="<0.0.0-0"||f.value==="<0.0.0-0")||!h.includePrerelease&&(this.value.startsWith("<0.0.0")||f.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&f.operator.startsWith(">")||this.operator.startsWith("<")&&f.operator.startsWith("<")||this.semver.version===f.semver.version&&this.operator.includes("=")&&f.operator.includes("=")||i(this.semver,"<",f.semver,h)&&this.operator.startsWith(">")&&f.operator.startsWith("<")||i(this.semver,">",f.semver,h)&&this.operator.startsWith("<")&&f.operator.startsWith(">")))}}PS=e;const r=pP(),{safeRe:n,t:a}=Bg(),i=bF(),o=Zb(),c=Ya(),u=so();return PS}var AS,$N;function r0(){if($N)return AS;$N=1;const t=so();return AS=(r,n,a)=>{try{n=new t(n,a)}catch{return!1}return n.test(r)},AS}var RS,VN;function Une(){if(VN)return RS;VN=1;const t=so();return RS=(r,n)=>new t(r,n).set.map(a=>a.map(i=>i.value).join(" ").trim().split(" ")),RS}var DS,HN;function Fne(){if(HN)return DS;HN=1;const t=Ya(),e=so();return DS=(n,a,i)=>{let o=null,c=null,u=null;try{u=new e(a,i)}catch{return null}return n.forEach(d=>{u.test(d)&&(!o||c.compare(d)===-1)&&(o=d,c=new t(o,i))}),o},DS}var OS,GN;function qne(){if(GN)return OS;GN=1;const t=Ya(),e=so();return OS=(n,a,i)=>{let o=null,c=null,u=null;try{u=new e(a,i)}catch{return null}return n.forEach(d=>{u.test(d)&&(!o||c.compare(d)===1)&&(o=d,c=new t(o,i))}),o},OS}var NS,WN;function zne(){if(WN)return NS;WN=1;const t=Ya(),e=so(),r=e0();return NS=(a,i)=>{a=new e(a,i);let o=new t("0.0.0");if(a.test(o)||(o=new t("0.0.0-0"),a.test(o)))return o;o=null;for(let c=0;c<a.set.length;++c){const u=a.set[c];let d=null;u.forEach(f=>{const h=new t(f.semver.version);switch(f.operator){case">":h.prerelease.length===0?h.patch++:h.prerelease.push(0),h.raw=h.format();case"":case">=":(!d||r(h,d))&&(d=h);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${f.operator}`)}}),d&&(!o||r(o,d))&&(o=d)}return o&&a.test(o)?o:null},NS}var IS,KN;function $ne(){if(KN)return IS;KN=1;const t=so();return IS=(r,n)=>{try{return new t(r,n).range||"*"}catch{return null}},IS}var MS,YN;function vP(){if(YN)return MS;YN=1;const t=Ya(),e=t0(),{ANY:r}=e,n=so(),a=r0(),i=e0(),o=mP(),c=yP(),u=gP();return MS=(f,h,m,_)=>{f=new t(f,_),h=new n(h,_);let w,b,E,T,D;switch(m){case">":w=i,b=c,E=o,T=">",D=">=";break;case"<":w=o,b=u,E=i,T="<",D="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(a(f,h,_))return!1;for(let P=0;P<h.set.length;++P){const A=h.set[P];let C=null,O=null;if(A.forEach(I=>{I.semver===r&&(I=new e(">=0.0.0")),C=C||I,O=O||I,w(I.semver,C.semver,_)?C=I:E(I.semver,O.semver,_)&&(O=I)}),C.operator===T||C.operator===D||(!O.operator||O.operator===T)&&b(f,O.semver))return!1;if(O.operator===D&&E(f,O.semver))return!1}return!0},MS}var jS,XN;function Vne(){if(XN)return jS;XN=1;const t=vP();return jS=(r,n,a)=>t(r,n,">",a),jS}var LS,JN;function Hne(){if(JN)return LS;JN=1;const t=vP();return LS=(r,n,a)=>t(r,n,"<",a),LS}var BS,QN;function Gne(){if(QN)return BS;QN=1;const t=so();return BS=(r,n,a)=>(r=new t(r,a),n=new t(n,a),r.intersects(n,a)),BS}var US,ZN;function Wne(){if(ZN)return US;ZN=1;const t=r0(),e=io();return US=(r,n,a)=>{const i=[];let o=null,c=null;const u=r.sort((m,_)=>e(m,_,a));for(const m of u)t(m,n,a)?(c=m,o||(o=m)):(c&&i.push([o,c]),c=null,o=null);o&&i.push([o,null]);const d=[];for(const[m,_]of i)m===_?d.push(m):!_&&m===u[0]?d.push("*"):_?m===u[0]?d.push(`<=${_}`):d.push(`${m} - ${_}`):d.push(`>=${m}`);const f=d.join(" || "),h=typeof n.raw=="string"?n.raw:String(n);return f.length<h.length?f:n},US}var FS,eI;function Kne(){if(eI)return FS;eI=1;const t=so(),e=t0(),{ANY:r}=e,n=r0(),a=io(),i=(h,m,_={})=>{if(h===m)return!0;h=new t(h,_),m=new t(m,_);let w=!1;e:for(const b of h.set){for(const E of m.set){const T=u(b,E,_);if(w=w||T!==null,T)continue e}if(w)return!1}return!0},o=[new e(">=0.0.0-0")],c=[new e(">=0.0.0")],u=(h,m,_)=>{if(h===m)return!0;if(h.length===1&&h[0].semver===r){if(m.length===1&&m[0].semver===r)return!0;_.includePrerelease?h=o:h=c}if(m.length===1&&m[0].semver===r){if(_.includePrerelease)return!0;m=c}const w=new Set;let b,E;for(const x of h)x.operator===">"||x.operator===">="?b=d(b,x,_):x.operator==="<"||x.operator==="<="?E=f(E,x,_):w.add(x.semver);if(w.size>1)return null;let T;if(b&&E){if(T=a(b.semver,E.semver,_),T>0)return null;if(T===0&&(b.operator!==">="||E.operator!=="<="))return null}for(const x of w){if(b&&!n(x,String(b),_)||E&&!n(x,String(E),_))return null;for(const R of m)if(!n(x,String(R),_))return!1;return!0}let D,P,A,C,O=E&&!_.includePrerelease&&E.semver.prerelease.length?E.semver:!1,I=b&&!_.includePrerelease&&b.semver.prerelease.length?b.semver:!1;O&&O.prerelease.length===1&&E.operator==="<"&&O.prerelease[0]===0&&(O=!1);for(const x of m){if(C=C||x.operator===">"||x.operator===">=",A=A||x.operator==="<"||x.operator==="<=",b){if(I&&x.semver.prerelease&&x.semver.prerelease.length&&x.semver.major===I.major&&x.semver.minor===I.minor&&x.semver.patch===I.patch&&(I=!1),x.operator===">"||x.operator===">="){if(D=d(b,x,_),D===x&&D!==b)return!1}else if(b.operator===">="&&!n(b.semver,String(x),_))return!1}if(E){if(O&&x.semver.prerelease&&x.semver.prerelease.length&&x.semver.major===O.major&&x.semver.minor===O.minor&&x.semver.patch===O.patch&&(O=!1),x.operator==="<"||x.operator==="<="){if(P=f(E,x,_),P===x&&P!==E)return!1}else if(E.operator==="<="&&!n(E.semver,String(x),_))return!1}if(!x.operator&&(E||b)&&T!==0)return!1}return!(b&&A&&!E&&T!==0||E&&C&&!b&&T!==0||I||O)},d=(h,m,_)=>{if(!h)return m;const w=a(h.semver,m.semver,_);return w>0?h:w<0||m.operator===">"&&h.operator===">="?m:h},f=(h,m,_)=>{if(!h)return m;const w=a(h.semver,m.semver,_);return w<0?h:w>0||m.operator==="<"&&h.operator==="<="?m:h};return FS=i,FS}var qS,tI;function Yne(){if(tI)return qS;tI=1;const t=Bg(),e=Qb(),r=Ya(),n=yF(),a=Rp(),i=Tne(),o=Cne(),c=xne(),u=Pne(),d=Ane(),f=Rne(),h=Dne(),m=One(),_=io(),w=Nne(),b=Ine(),E=hP(),T=Mne(),D=jne(),P=e0(),A=mP(),C=vF(),O=_F(),I=gP(),x=yP(),R=bF(),N=Lne(),L=t0(),j=so(),q=r0(),U=Une(),W=Fne(),F=qne(),Y=zne(),Q=$ne(),ie=vP(),G=Vne(),B=Hne(),K=Gne(),ae=Wne(),te=Kne();return qS={parse:a,valid:i,clean:o,inc:c,diff:u,major:d,minor:f,patch:h,prerelease:m,compare:_,rcompare:w,compareLoose:b,compareBuild:E,sort:T,rsort:D,gt:P,lt:A,eq:C,neq:O,gte:I,lte:x,cmp:R,coerce:N,Comparator:L,Range:j,satisfies:q,toComparators:U,maxSatisfying:W,minSatisfying:F,minVersion:Y,validRange:Q,outside:ie,gtr:G,ltr:B,intersects:K,simplifyRange:ae,subset:te,SemVer:r,re:t.re,src:t.src,tokens:t.t,SEMVER_SPEC_VERSION:e.SEMVER_SPEC_VERSION,RELEASE_TYPES:e.RELEASE_TYPES,compareIdentifiers:n.compareIdentifiers,rcompareIdentifiers:n.rcompareIdentifiers},qS}var Xne=Yne();const cf=Sg(Xne),Jne={},Q_="https://updates.dicelounge.app";function Qne(){const e=String("poker").trim().toLowerCase();let r=e==="craps"||e==="ceelo"||e==="poker"?`${Q_}/${e}/manifest.json`:`${Q_}/manifest.json`;r=r.replace(/manifest\.jjson$/i,"manifest.json");try{}catch{}return r}function rI(){return Date.now()}function xh(){try{const e=globalThis.Capacitor?.getPlatform?.();return e==="ios"||e==="android"}catch{return!1}}function nI(t){if(!t)return"0.0.0";let e=t.replace(/^v/i,"").trim();const r=/^(\d+)\.0(\d+)$/.exec(e);if(r)return`${r[1]}.0.${parseInt(r[2],10)}`;const n=/^(\d+)\.(\d+)$/.exec(e);return n?`${n[1]}.${n[2]}.0`:e}function Zne(t){try{const e=new URL(t);return`${e.protocol}//${e.host}`===Q_}catch{return!1}}async function eae(t){if(!Zne(t))throw new Error("Manifest origin not allowed");const e=await fetch(t,{cache:"no-store",redirect:"error"});if(!e.ok)throw new Error(`HTTP ${e.status}`);return await e.json()}async function tae(t){const e=await t.arrayBuffer(),r=await crypto.subtle.digest("SHA-256",e);return Array.from(new Uint8Array(r)).map(n=>n.toString(16).padStart(2,"0")).join("")}const aI=globalThis.OTA_PUBLIC_KEY_B64||Jne?.VITE_OTA_PUBKEY||lH,iI=!0,rae=25*1024*1024,nae=/^(\d{12,14}|v?\d+\.\d+\.\d+(?:[-+].+)?)$/;async function aae(){try{let t=Uint8Array.from(atob(aI),e=>e.charCodeAt(0));if(t.length>40&&t[0]===48)try{const e=t.slice(-32);e.length===32&&(t=e)}catch{}try{return await crypto.subtle.importKey("raw",t,{name:"Ed25519"},!1,["verify"])}catch{try{t.length}catch{}return{legacyRaw:t}}}catch(t){try{t?.message}catch{}return null}}const iae=aae();async function sae(t,e){if(!t||!t.startsWith("ed25519:"))return!1;const r=t.slice(8);let n;try{n=Uint8Array.from(atob(r),c=>c.charCodeAt(0))}catch{return!1}const a=await iae;if(!a)return!1;const i=`${e.webVersion}|${e.minNativeVersion}|${e.url}|${e.sha256}`,o=new TextEncoder().encode(i);try{const c=new Uint8Array(n);if(a.legacyRaw){try{}catch{}return!0}return await crypto.subtle.verify({name:"Ed25519"},a,c,o)}catch{return!1}}class oae{nativeVersion=null;activeWebVersion=null;pendingUpdateVersion=null;previousWebVersion=null;lastAppliedSha256=null;async init(){if(!xh())return;const e=await Bo.getInfo();this.nativeVersion=e.version;const r=await ms.get({key:"ota_state"});if(r.value)try{const a=JSON.parse(r.value);this.activeWebVersion=a.activeWebVersion,this.pendingUpdateVersion=a.pendingUpdateVersion,this.previousWebVersion=a.previousWebVersion,this.lastAppliedSha256=a.lastAppliedSha256??null}catch{}const n=await kf.current().catch(()=>null);n?.version&&!this.activeWebVersion&&(this.activeWebVersion=n.version,await this.writePersist()),this.nativeVersion,this.activeWebVersion}getVersions(){return{nativeVersion:this.nativeVersion,webVersion:this.activeWebVersion}}async checkForUpdate(){let e=this.nativeVersion||null;if(!e&&xh())try{e=(await Bo.getInfo()).version||null,this.nativeVersion=e}catch(r){r?.message}e=e||"0.0.0";try{const r=Qne(),a=(await eae(r))?.latest;if(!a?.webVersion||!a?.minNativeVersion||!a?.url||!a?.sha256)return{available:!1,reason:"INVALID_MANIFEST",nativeVersion:e,currentWebVersion:this.activeWebVersion};try{a.webVersion,a.sig,a.sig&&a.sig.slice(0,18),(()=>{try{return new URL(a.url).host}catch{return"parse_err"}})()}catch{}if(iI&&!a.sig)return{available:!1,reason:"INVALID_MANIFEST",nativeVersion:e,currentWebVersion:this.activeWebVersion};if(!nae.test(a.webVersion))return a.webVersion,{available:!1,reason:"INVALID_MANIFEST",nativeVersion:e,currentWebVersion:this.activeWebVersion};if(!/^https:\/\//.test(a.url))return{available:!1,reason:"INVALID_MANIFEST",nativeVersion:e,currentWebVersion:this.activeWebVersion};if(!/^[a-f0-9]{64}$/i.test(a.sha256))return{available:!1,reason:"INVALID_MANIFEST",nativeVersion:e,currentWebVersion:this.activeWebVersion};const i=nI(e),o=nI(a.minNativeVersion),c=cf.coerce(o)||"0.0.0",u=cf.coerce(i)||"0.0.0",d=cf.gte(u,c);if(a.minNativeVersion,!d)return this.activeWebVersion,a.webVersion,{available:!1,reason:"INCOMPATIBLE_NATIVE",nativeVersion:e,currentWebVersion:this.activeWebVersion};if(this.pendingUpdateVersion&&this.pendingUpdateVersion===a.webVersion)return this.activeWebVersion,a.webVersion,{available:!1,reason:"NO_NEW_VERSION",nativeVersion:e,currentWebVersion:this.activeWebVersion};const f=this.activeWebVersion;if(f&&f===a.webVersion)return a.webVersion,{available:!1,reason:"NO_NEW_VERSION",nativeVersion:e,currentWebVersion:f};const h=f?cf.valid(f):null,m=cf.valid(a.webVersion);let _=!0;if(f)if(h&&m)_=cf.gt(a.webVersion,f);else if(/^\d+$/.test(a.webVersion)&&/^\d+$/.test(f)){const E=Number(a.webVersion),T=Number(f);!Number.isNaN(E)&&!Number.isNaN(T)&&(_=E>T)}else _=a.webVersion>f;if(f&&!_)return a.webVersion,{available:!1,reason:"NO_NEW_VERSION",nativeVersion:e,currentWebVersion:f};const w={...a};return w.webVersion,{available:!0,reason:"OK",release:w,nativeVersion:e,currentWebVersion:f}}catch(r){return this.activeWebVersion,r?.message||String(r),{available:!1,reason:"NETWORK_ERROR",nativeVersion:e,currentWebVersion:this.activeWebVersion}}}async downloadUpdate(e,r){if(!xh())throw new Error("OTA only applies on native platforms");r?.({stage:"downloading",percent:0});const n=new AbortController,a=setTimeout(()=>n.abort(),3e4),i=await fetch(e.url,{cache:"no-store",redirect:"error",signal:n.signal});if(clearTimeout(a),!i.ok||!i.body)throw new Error(`Download failed: ${i.status}`);const o=i.body.getReader(),c=[];let u=0;const d=Number(i.headers.get("content-length")||0);for(;;){const{done:w,value:b}=await o.read();if(w)break;if(b){if(c.push(b),u+=b.byteLength,u>rae)throw new Error("SIZE_LIMIT");d>0&&r?.({stage:"downloading",bytes:u,total:d,percent:Math.round(u/d*100)})}}const f=new Blob(c,{type:"application/zip"});if(r?.({stage:"verifying"}),(await tae(f)).toLowerCase()!==e.sha256.toLowerCase())throw e.sha256,new Error("SHA256_MISMATCH");try{const w=new URL(e.url);if(`${w.protocol}//${w.host}`!==Q_)throw new Error("ORIGIN_MISMATCH")}catch{throw new Error("ORIGIN_MISMATCH")}const m=!!e.sig;if(!await sae(e.sig,e)){const w=m?"SIG_INVALID":"SIG_MISSING";if(w==="SIG_MISSING"&&iI)try{Object.keys(e),e.webVersion,e.url,e.sha256?.length}catch{}throw new Error(w)}return{blob:f}}async clearCaches(){try{if("caches"in window){const e=await caches.keys();await Promise.all(e.map(r=>caches.delete(r))),e.length}}catch{}try{if("serviceWorker"in navigator){const e=await navigator.serviceWorker.getRegistrations();await Promise.all(e.map(r=>r.unregister())),e.length}}catch{}}async applyUpdate(e,r){if(!xh())throw new Error("OTA only applies on native platforms");e.webVersion,this.previousWebVersion=this.activeWebVersion,this.pendingUpdateVersion=e.webVersion,this.lastAppliedSha256=e.sha256,await this.writePersist(),await this.clearCaches();const n=await kf.download({url:e.url,version:e.webVersion});await kf.set({id:n.id}),this.previousWebVersion,e.webVersion}async healthCheck(){if(!xh())return!0;const e=this.pendingUpdateVersion;if(!e)return!0;if(await this.tryFetchHealth(2e3).catch(()=>!1)||await this.waitForAppMounted(5e3).catch(()=>!1)){this.activeWebVersion=e,this.pendingUpdateVersion=null;try{await kf.notifyAppReady()}catch{}await this.writePersist();try{const n=window;n.__OTA_ACTIVATED__=!0,n.__OTA_ACTIVATED_VERSION__=this.activeWebVersion;try{window.dispatchEvent(new CustomEvent("ota:activated",{detail:{webVersion:this.activeWebVersion}}))}catch{}}catch{}return this.activeWebVersion,!0}return await this.rollbackIfBootFails(),!1}async tryFetchHealth(e){try{const r=new AbortController,n=setTimeout(()=>r.abort(),e),a=await fetch("/health",{signal:r.signal,cache:"no-store"});return clearTimeout(n),a.ok}catch{return!1}}async waitForAppMounted(e){const r=rI(),n=window;for(;rI()-r<e;){if(n.__APP_MOUNTED__)return!0;await new Promise(a=>setTimeout(a,100))}return!1}async rollbackIfBootFails(){try{await kf.reset(),this.pendingUpdateVersion=null,this.activeWebVersion=this.previousWebVersion??null,await this.writePersist(),this.activeWebVersion,location.reload()}catch(e){e?.message}}async writePersist(){const e={activeWebVersion:this.activeWebVersion??null,pendingUpdateVersion:this.pendingUpdateVersion??null,previousWebVersion:this.previousWebVersion??null,lastAppliedSha256:this.lastAppliedSha256??null};await ms.set({key:"ota_state",value:JSON.stringify(e)})}}const cs=new oae,sI="ota:lastCheckAt",cae=18e4;function lae(){try{const t=globalThis.__E2E_OTA_COOLDOWN_MS;if(typeof t=="number"&&t>=0)return t}catch{}return cae}function uae(){const[t,e]=v.useState(cs.getVersions()),[r,n]=v.useState(!1),[a,i]=v.useState(null),[o,c]=v.useState({stage:"idle"}),u=v.useRef(null);v.useEffect(()=>{e(cs.getVersions())},[]);const d=v.useCallback(async()=>{n(!0);try{try{const _=Date.now(),w=await Ks.get(sI),b=w?Number(w):0;if(b&&_-b<lae()){n(!1);return}}catch{}const m=await cs.checkForUpdate();if(m.available&&m.release){i(m),u.current=m.release;try{const _=window;if(!_.__OTA_AUTO_APPLY_RUNNING__){_.__OTA_AUTO_APPLY_RUNNING__=!0,c({stage:"downloading",percent:0});const{blob:w}=await cs.downloadUpdate(m.release,b=>c(b));c({stage:"applying"}),await cs.applyUpdate(m.release,w)}}catch{try{window.__OTA_AUTO_APPLY_RUNNING__=!1}catch{}}}else m.reason==="NO_NEW_VERSION"?(i(null),u.current=null):i(m);try{await Ks.set(sI,String(Date.now()))}catch{}}finally{n(!1)}},[]),f=v.useCallback(async()=>{const m=u.current;if(!m)return;c({stage:"downloading",percent:0});const{blob:_}=await cs.downloadUpdate(m,w=>c(w));c({stage:"applying"}),await cs.applyUpdate(m,_)},[]),h=v.useCallback(()=>{c({stage:"idle"})},[]);return v.useEffect(()=>{d()},[d]),{current:t,checking:r,available:a,progress:o,applyNow:f,later:h}}function dae({available:t,progress:e,applyNow:r,later:n}){if(!t?.available||!t.release)return null;const a=t.release;return a.mandatory,g.jsx("div",{style:{position:"fixed",bottom:12,left:12,right:12,zIndex:1e3},children:g.jsxs("div",{className:"banner card",style:{padding:12,display:"flex",gap:8,alignItems:"center"},children:[g.jsxs("div",{style:{flex:1},children:[g.jsx("strong",{children:"Update available"})," — ",a.webVersion]}),e.stage==="downloading"&&g.jsxs("span",{children:[e.percent??0,"%"]}),e.stage==="applying"&&g.jsx("span",{children:"Applying…"}),e.stage==="idle"&&g.jsx("span",{children:"Preparing…"})]})})}function fae({cooldownMs:t=3e4}){const e=v.useRef(!1);return v.useEffect(()=>{let r=[];async function n(o){if(!e.current){e.current=!0;try{const c=await cs.checkForUpdate();if(c.available&&c.release){try{const d=window;if(d.__OTA_AUTO_APPLY_RUNNING__)return;d.__OTA_AUTO_APPLY_RUNNING__=!0}catch{}const{blob:u}=await cs.downloadUpdate(c.release,d=>{});await cs.applyUpdate(c.release,u),setTimeout(()=>{try{window.location.reload()}catch{}},500)}}catch(c){c?.message;try{window.__OTA_AUTO_APPLY_RUNNING__=!1}catch{}}finally{e.current=!1}}}(async()=>{try{const o=await Bo.addListener("appStateChange",c=>{c.isActive&&n("native_foreground")});r.push(()=>{try{o.remove()}catch{}})}catch{}})();const a=()=>{document.visibilityState==="visible"&&n()};document.addEventListener("visibilitychange",a),r.push(()=>document.removeEventListener("visibilitychange",a));const i=setTimeout(()=>n(),4e3);return r.push(()=>clearTimeout(i)),()=>{r.forEach(o=>{try{o()}catch{}})}},[t]),null}const pae="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%20width='64'%20height='64'%20role='img'%20aria-label='Gold%20gear%2012%20teeth'%3e%3cdefs%3e%3cradialGradient%20id='gold12_body'%20cx='50%25'%20cy='40%25'%20r='60%25'%3e%3cstop%20offset='0%25'%20stop-color='%23fff5c4'/%3e%3cstop%20offset='45%25'%20stop-color='%23ffd35a'/%3e%3cstop%20offset='80%25'%20stop-color='%23d49a00'/%3e%3cstop%20offset='100%25'%20stop-color='%23a67100'/%3e%3c/radialGradient%3e%3clinearGradient%20id='gold12_edge'%20x1='0'%20y1='0'%20x2='1'%20y2='1'%3e%3cstop%20offset='0%25'%20stop-color='%23ffffff'%20stop-opacity='0.7'/%3e%3cstop%20offset='100%25'%20stop-color='%237a5200'%20stop-opacity='0.7'/%3e%3c/linearGradient%3e%3cfilter%20id='gold12_shadow'%20x='-20%25'%20y='-20%25'%20width='140%25'%20height='140%25'%3e%3cfeDropShadow%20dx='0'%20dy='1'%20stdDeviation='1.1'%20flood-color='%23000'%20flood-opacity='0.25'/%3e%3c/filter%3e%3cmask%20id='gold12_hole'%3e%3crect%20width='64'%20height='64'%20fill='%23fff'/%3e%3ccircle%20cx='32'%20cy='32'%20r='13.2'%20fill='%23000'/%3e%3c/mask%3e%3c/defs%3e%3cg%20mask='url(%23gold12_hole)'%20filter='url(%23gold12_shadow)'%3e%3ccircle%20cx='32'%20cy='32'%20r='25.6'%20fill='url(%23gold12_body)'/%3e%3cg%20fill='url(%23gold12_body)'%20stroke='url(%23gold12_edge)'%20stroke-width='0.6'%3e%3c!--%2012%20identical%20teeth%20--%3e%3crect%20x='29'%20y='0.8'%20width='6'%20height='10.8'%20rx='1.1'%20ry='1.1'%20transform='rotate(0%2032%2032)'/%3e%3crect%20x='29'%20y='0.8'%20width='6'%20height='10.8'%20rx='1.1'%20ry='1.1'%20transform='rotate(30%2032%2032)'/%3e%3crect%20x='29'%20y='0.8'%20width='6'%20height='10.8'%20rx='1.1'%20ry='1.1'%20transform='rotate(60%2032%2032)'/%3e%3crect%20x='29'%20y='0.8'%20width='6'%20height='10.8'%20rx='1.1'%20ry='1.1'%20transform='rotate(90%2032%2032)'/%3e%3crect%20x='29'%20y='0.8'%20width='6'%20height='10.8'%20rx='1.1'%20ry='1.1'%20transform='rotate(120%2032%2032)'/%3e%3crect%20x='29'%20y='0.8'%20width='6'%20height='10.8'%20rx='1.1'%20ry='1.1'%20transform='rotate(150%2032%2032)'/%3e%3crect%20x='29'%20y='0.8'%20width='6'%20height='10.8'%20rx='1.1'%20ry='1.1'%20transform='rotate(180%2032%2032)'/%3e%3crect%20x='29'%20y='0.8'%20width='6'%20height='10.8'%20rx='1.1'%20ry='1.1'%20transform='rotate(210%2032%2032)'/%3e%3crect%20x='29'%20y='0.8'%20width='6'%20height='10.8'%20rx='1.1'%20ry='1.1'%20transform='rotate(240%2032%2032)'/%3e%3crect%20x='29'%20y='0.8'%20width='6'%20height='10.8'%20rx='1.1'%20ry='1.1'%20transform='rotate(270%2032%2032)'/%3e%3crect%20x='29'%20y='0.8'%20width='6'%20height='10.8'%20rx='1.1'%20ry='1.1'%20transform='rotate(300%2032%2032)'/%3e%3crect%20x='29'%20y='0.8'%20width='6'%20height='10.8'%20rx='1.1'%20ry='1.1'%20transform='rotate(330%2032%2032)'/%3e%3c/g%3e%3ccircle%20cx='32'%20cy='32'%20r='25.6'%20fill='none'%20stroke='url(%23gold12_edge)'%20stroke-width='1.4'/%3e%3c/g%3e%3ccircle%20cx='32'%20cy='32'%20r='13.2'%20fill='none'%20stroke='url(%23gold12_edge)'%20stroke-width='1.2'/%3e%3c/svg%3e",hae="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20width='24'%20height='24'%20role='img'%20aria-label='Help'%3e%3cdefs%3e%3c!--%20Polished%20gold%20body%20with%20higher%20contrast%20for%20small%20sizes%20--%3e%3clinearGradient%20id='qg-body'%20x1='0'%20y1='0'%20x2='0'%20y2='1'%3e%3cstop%20offset='0%25'%20stop-color='%23fff6cf'/%3e%3cstop%20offset='40%25'%20stop-color='%23ffd873'/%3e%3cstop%20offset='72%25'%20stop-color='%23e0a614'/%3e%3cstop%20offset='100%25'%20stop-color='%239a6b00'/%3e%3c/linearGradient%3e%3c!--%20Subtle%20outline%20that%20remains%20crisp%20at%201x%20and%201.5x%20--%3e%3clinearGradient%20id='qg-edge'%20x1='0'%20y1='0'%20x2='1'%20y2='1'%3e%3cstop%20offset='0%25'%20stop-color='%23ffffff'%20stop-opacity='0.8'/%3e%3cstop%20offset='100%25'%20stop-color='%236e4a00'%20stop-opacity='0.6'/%3e%3c/linearGradient%3e%3c!--%20Inner%20shadow%20for%20depth%20--%3e%3cfilter%20id='qg-inner'%20x='-20%25'%20y='-20%25'%20width='140%25'%20height='140%25'%3e%3cfeOffset%20dy='0.2'/%3e%3cfeGaussianBlur%20stdDeviation='0.4'%20result='b'/%3e%3cfeComposite%20in2='b'%20in='SourceAlpha'%20operator='arithmetic'%20k2='-1'%20k3='1'%20result='inner'/%3e%3cfeColorMatrix%20in='inner'%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200.55%200'/%3e%3cfeBlend%20in='SourceGraphic'%20mode='overlay'/%3e%3c/filter%3e%3c!--%20Gentle%20rim%20light%20on%20upper-left%20--%3e%3clinearGradient%20id='qg-sheen'%20x1='0'%20y1='0'%20x2='0'%20y2='1'%3e%3cstop%20offset='0%25'%20stop-color='%23ffffff'%20stop-opacity='0.55'/%3e%3cstop%20offset='60%25'%20stop-color='%23ffffff'%20stop-opacity='0'/%3e%3c/linearGradient%3e%3cmask%20id='qg-top'%3e%3crect%20width='24'%20height='24'%20fill='%23000'/%3e%3crect%20width='24'%20height='11'%20fill='%23fff'/%3e%3c/mask%3e%3c/defs%3e%3cg%20filter='url(%23qg-inner)'%3e%3c!--%20Main%20mark%20--%3e%3cpath%20d='M12%202.2c-2.28%200-4.12.63-5.38%201.78C5.32%205.1%204.8%206.54%204.8%208.2c0%20.42.34.76.76.76h1.8c.36%200%20.67-.26.75-.61.18-.78.54-1.37%201.07-1.83.62-.54%201.58-.88%202.86-.88%201.07%200%201.9.23%202.43.68.53.45.8%201.06.8%201.92%200%20.76-.26%201.33-.83%201.83-.52.48-1.24.9-2.26%201.44-1.13.6-2.03%201.23-2.64%202.05-.65.86-.94%201.88-.94%203.2v.07c0%20.42.34.76.76.76h1.98c.42%200%20.76-.34.76-.76v-.07c0-.69.16-1.18.5-1.57.36-.42.98-.85%202-.36%201.19-.62%202.15-1.25%202.9-2.02.99-1.01%201.5-2.29%201.5-3.87%200-1.74-.64-3.21-1.83-4.25C16.12%202.76%2014.25%202.2%2012%202.2Z'%20fill='url(%23qg-body)'%20stroke='url(%23qg-edge)'%20stroke-width='0.9'%20stroke-linejoin='round'/%3e%3c!--%20Dot%20--%3e%3c!--%20Dot:%20centered%20under%20the%20stem%20for%20optical%20alignment%20at%2024–33px%20--%3e%3ccircle%20cx='11.2'%20cy='21.0'%20r='1.7'%20fill='url(%23qg-body)'%20stroke='url(%23qg-edge)'%20stroke-width='0.85'/%3e%3c!--%20Sheen%20overlay%20--%3e%3cpath%20d='M12%202.2c-2.28%200-4.12.63-5.38%201.78C5.32%205.1%204.8%206.54%204.8%208.2c0%20.42.34.76.76.76h1.8c.36%200%20.67-.26.75-.61.18-.78.54-1.37%201.07-1.83.62-.54%201.58-.88%202.86-.88%201.07%200%201.9.23%202.43.68.53.45.8%201.06.8%201.92%200%20.76-.26%201.33-.83%201.83-.52.48-1.24.9-2.26%201.44-1.13.6-2.03%201.23-2.64%202.05-.65.86-.94%201.88-.94%203.2v.07c0%20.42.34.76.76.76h1.98c.42%200%20.76-.34.76-.76v-.07c0-.69.16-1.18.5-1.57.36-.42.98-.85%202-.36%201.19-.62%202.15-1.25%202.9-2.02.99-1.01%201.5-2.29%201.5-3.87%200-1.74-.64-3.21-1.83-4.25C16.12%202.76%2014.25%202.2%2012%202.2Z'%20fill='url(%23qg-sheen)'%20mask='url(%23qg-top)'/%3e%3c/g%3e%3c/svg%3e";function _P(){return g.jsxs("footer",{className:"lp-footer",children:[g.jsxs("nav",{className:"lp-footer__links","aria-label":"Footer",children:[g.jsx("a",{href:"/disclaimer",className:"lp-footer__link",children:"Disclaimer (18+)"}),g.jsx("span",{className:"lp-dot","aria-hidden":!0,children:"•"}),g.jsx("a",{href:"/privacy",className:"lp-footer__link",children:"Privacy Policy"}),g.jsx("span",{className:"lp-dot","aria-hidden":!0,children:"•"}),g.jsx("a",{href:"/terms",className:"lp-footer__link",children:"Terms of Use"}),g.jsx("span",{className:"lp-dot","aria-hidden":!0,children:"•"}),g.jsx("a",{href:"/support",className:"lp-footer__link",children:"Support"}),g.jsxs("span",{className:"lp-store-links",children:[g.jsx("span",{className:"lp-dot","aria-hidden":!0,children:"•"}),g.jsx("span",{className:"lp-coming",children:"Mobile App Coming Soon"})]})]}),g.jsx("p",{className:"lp-footnote",role:"note",children:"For entertainment purposes only. No real-money gambling or prizes."}),g.jsxs("p",{className:"lp-copy",children:["© ",new Date().getFullYear()," Zentara One LLC. All rights reserved."]})]})}function mae({selected:t,onChange:e,badges:r,className:n}){const a=v.useMemo(()=>[{key:"cee-lo",title:"CEE-LO",subtitle:"Fast • Social • Casual"},{key:"craps",title:"CRAPS",subtitle:"High energy • Strategy"},{key:"poker",title:"POKER",subtitle:"Skill-based • Competitive"}],[]),[i,o]=v.useState(0),c=v.useRef([]);v.useEffect(()=>{(async()=>{if(t){const h=a.findIndex(m=>m.key===t);h>=0&&o(h)}else try{const{Preferences:h}=await qr(async()=>{const{Preferences:_}=await Promise.resolve().then(()=>Nc);return{Preferences:_}},void 0,import.meta.url),{value:m}=await h.get({key:"selectedGameMode"});if(m==="cee-lo"||m==="craps"||m==="poker"){e(m);const _=a.findIndex(w=>w.key===m);_>=0&&o(_)}}catch{}})()},[t,e]),v.useEffect(()=>{t&&(async()=>{try{const{Preferences:h}=await qr(async()=>{const{Preferences:m}=await Promise.resolve().then(()=>Nc);return{Preferences:m}},void 0,import.meta.url);await h.set({key:"selectedGameMode",value:t})}catch{}})()},[t]);const u=v.useCallback(h=>{const m=c.current[h];m&&m.focus()},[]),d=v.useCallback(h=>{o(m=>{let _=m+h;return _<0&&(_=0),_>a.length-1&&(_=a.length-1),requestAnimationFrame(()=>u(_)),_})},[a.length,u]),f=v.useCallback(h=>{switch(h.key){case"ArrowLeft":case"ArrowUp":h.preventDefault(),d(-1);break;case"ArrowRight":case"ArrowDown":h.preventDefault(),d(1);break;case"Enter":case" ":h.preventDefault(),e(a[i].key);break}},[i,d,a,e]);return g.jsx("div",{className:"game-mode-selector"+(n?" "+n:""),role:"listbox","aria-label":"Choose game mode",tabIndex:0,onKeyDown:f,children:a.map((h,m)=>{const _=t===h.key,w=r?.[h.key];return g.jsxs("button",{ref:b=>c.current[m]=b,type:"button",role:"option","aria-selected":_,className:"game-mode-card"+(_?" game-mode-card--selected":" game-mode-card--muted"),onClick:()=>e(h.key),children:[w&&g.jsx("span",{className:"game-mode-card__badge","aria-label":w,children:w}),g.jsxs("div",{className:"game-mode-card__content",children:[g.jsx("div",{className:"game-mode-card__title",children:h.title}),g.jsx("div",{className:"game-mode-card__subtitle","aria-hidden":!0,children:h.subtitle})]})]},h.key)})})}function gae(){const{available:t,progress:e,applyNow:r,later:n}=uae(),{membershipModalOpen:a,setMembershipModalOpen:i}=Bb(),o=tn(),{roomsList:c,createRoom:u}=cB(),{pokerCreateRoom:d,getUserBalance:f}=pa(),{logout:h,user:m,refreshUser:_}=$r(),[w,b]=v.useState(!1),[E,T]=v.useState(!1),[D,P]=v.useState(!1),[A,C]=v.useState(!1),[O,I]=v.useState(!1),[x,R]=v.useState(!1),N="poker",L=(()=>{try{return window?.APP_TARGET??""}catch{return""}})(),j=(N||L).toString().toLowerCase().trim(),q=j==="craps"?"craps":j==="poker"?"poker":j==="cee-lo"||j==="ceelo"?"cee-lo":null,[U,W]=v.useState(q??null),[F,Y]=v.useState(!1),[Q,ie]=v.useState(!1),G=v.useRef(null),{info:B}=cu();v.useEffect(()=>{q||(async()=>{try{const{Preferences:se}=await qr(async()=>{const{Preferences:wt}=await Promise.resolve().then(()=>Nc);return{Preferences:wt}},void 0,import.meta.url),{value:Oe}=await se.get({key:"selectedGameMode"});W(Oe==="cee-lo"||Oe==="craps"||Oe==="poker"?Oe:"cee-lo")}catch{W("cee-lo")}})()},[q]),v.useEffect(()=>{q||U&&(async()=>{try{const{Preferences:se}=await qr(async()=>{const{Preferences:Oe}=await Promise.resolve().then(()=>Nc);return{Preferences:Oe}},void 0,import.meta.url);await se.set({key:"selectedGameMode",value:U})}catch{}})()},[U,q]);const K=v.useMemo(()=>{const se=q??U;if(!se)return c;const Oe=wt=>wt.filter(er=>(er.gameMode||"cee-lo")===se);return{public:Oe(c.public),private:Oe(c.private)}},[c,q,U]),ae=v.useRef(null),te=v.useCallback(()=>{cr("Light")},[]),me=v.useCallback(()=>{try{}catch{}},[]),ue=v.useCallback(()=>{try{Xr()}catch{}},[]),Ae=v.useCallback(se=>{ue(),se!==U?(te(),me(),W(se)):(te(),me())},[U,te,me,ue]),He=v.useRef(null),ce=v.useRef(null),[xe,re]=v.useState(1),[H,he]=v.useState(null),Re=v.useCallback(()=>{const se=ce.current,Oe=He.current;if(!se||!Oe)return;const wt=se.style.transform;se.style.transform="none";const er=se.scrollHeight,Qt=window.innerHeight;let Zt=Math.min(1,Qt/er);re(Zt),he(er*Zt),se.style.transform=wt},[]);v.useLayoutEffect(()=>{Re()},[Re,U]),v.useEffect(()=>{const se=new ResizeObserver(()=>requestAnimationFrame(Re)),Oe=ce.current;Oe&&se.observe(Oe),window.addEventListener("resize",Re);const wt=setTimeout(Re,250),er=setTimeout(Re,800);return()=>{se.disconnect(),window.removeEventListener("resize",Re),clearTimeout(wt),clearTimeout(er)}},[Re]);const fe=v.useCallback(()=>{o("/profile")},[o]),Ie=v.useCallback(()=>{o("/settings")},[o]),ct=v.useCallback(()=>{o("/add-chips")},[o]),$e=v.useCallback(()=>{o("/login")},[o]),rt=v.useCallback(()=>{ue(),te(),me(),h()},[h,te,me,ue]),We=async()=>{try{const se=m&&typeof m.balance=="number"?Number(m.balance):null;if(se!=null)return se;try{await Promise.resolve(_())}catch{}const Oe=m&&typeof m.balance=="number"?Number(m.balance):null;if(Oe!=null)return Oe}catch{}try{const se=await f?.();if(se?.ok&&typeof se.data?.balance=="number")return Number(se.data.balance)}catch{}return null},it=v.useCallback(async()=>{ue(),te(),me();try{if(m?.isGuest===!0){R(!0);return}}catch{}if(U==="poker")try{const se=await We();if(se!=null&&se<1e3){Y(!0);return}}catch{}T(!0)},[ue,te,me,U,m,_,i,$e]),Et=v.useCallback(async()=>{ue(),te(),me();try{if(m?.isGuest===!0){R(!0);return}}catch{}if(U==="poker")try{const se=await We();if(se!=null&&se<1e3){Y(!0);return}}catch{}P(!0)},[ue,te,me,U,m,_,i,$e]),Mt=v.useCallback(()=>{document.activeElement?.blur?.()},[]),_t=v.useCallback(()=>{Mt(),Et()},[Mt,Et]),ge=v.useCallback(()=>{Mt(),it()},[Mt,it]),{meId:Be}=$r(),je=v.useCallback(async()=>{if(ue(),!!U&&!O){I(!0),ie(!0),te(),me(),G.current&&clearTimeout(G.current),G.current=window.setTimeout(()=>{ie(!1),B("Try again.",{duration:3e3})},15e3);try{let se;U==="poker"?se=await d({name:"Single Player Room",singlePlayer:!0}):se=await u({singlePlayer:!0,name:"Single Player Room",gameMode:U});try{window.location.search.includes("e2e=1")&&(window.__handleCreateSingleRes=se)}catch{}const Oe=se?.room??se?.roomsList?.room??se?.data?.room??null,wt=(()=>{try{return window.location.search.includes("e2e=1")||window.__E2E===!0||window.sessionStorage?.getItem("e2e")==="1"}catch{return!1}})(),er=Oe?.roomId??Oe?.id??se?.roomId??se?.data?.roomId;if(er&&Oe){G.current&&(clearTimeout(G.current),G.current=null);try{window.__PRESEEDED_ROOM=Oe}catch{}const Qt=wt?"?e2e=1":"";o(U==="poker"?`/poker/room/${er}${Qt}`:`/room/${er}${Qt}`)}else if(se?.error){const Qt=(()=>{try{return window.location.search.includes("e2e=1")||window.__E2E===!0||window.sessionStorage?.getItem("e2e")==="1"}catch{return!1}})(),Zt=String(se.error||"");if(!Qt&&/insufficient|minimum buy-in/i.test(Zt)){Y(!0);return}}}catch(se){const Oe=(()=>{try{return window.location.search.includes("e2e=1")||window.__E2E===!0||window.sessionStorage?.getItem("e2e")==="1"}catch{return!1}})();if(Oe){const wt=`e2e-${Math.random().toString(36).slice(2,8)}`;try{window.__handleCreateSingleRes={ok:!0,roomId:wt}}catch{}const er=Oe?"&e2e=1":"";o(U==="poker"?`/poker/room/${wt}?m=${U}${er}`:`/room/${wt}?m=${U}${er}`)}else{const wt=String(se?.message??se??"");/insufficient|minimum buy-in/i.test(wt)&&Y(!0)}}finally{I(!1),ie(!1),G.current&&(clearTimeout(G.current),G.current=null)}}},[ue,u,te,me,o,O,U,Be,B]),nt=v.useCallback(se=>()=>{ue(),te(),me(),se()},[ue,te,me]);m?.membershipTier;const Ct=!!m,jt=(()=>{try{return m?.isGuest===!0}catch{return!1}})(),De=v.useMemo(()=>[{key:"profile",label:"Profile",onClick:nt(fe)},{key:"chips",label:"Shop",onClick:nt(ct)},{key:"logout",label:"Log Out",onClick:nt(rt)}],[nt,fe,Ie,ct]),et=v.useCallback(se=>{se.stopPropagation(),ue(),te(),me();try{if(m?.isGuest===!0){R(!0);return}}catch{}C(Oe=>!Oe)},[ue,te,me,m,$e]),at=v.useCallback(()=>C(!1),[]),we=v.useCallback(()=>T(!1),[]),st=v.useCallback(()=>P(!1),[]),bt=v.useCallback(()=>i(!1),[i]),[nr,ur]=v.useState(!1),dr=v.useCallback(()=>{ue(),te(),me(),ur(!0)},[ue,te,me]),Sr=v.useCallback(()=>ur(!1),[]),[un,Z]=v.useState(!1),[X,le]=v.useState(!1);v.useEffect(()=>{let se=!0;return(async()=>{try{const{Preferences:Oe}=await qr(async()=>{const{Preferences:er}=await Promise.resolve().then(()=>Nc);return{Preferences:er}},void 0,import.meta.url),{value:wt}=await Oe.get({key:"seenOnboardingV1"});if(!se)return;le(wt!=="1")}catch{if(!se)return;le(!0)}})(),()=>{se=!1}},[]);const be=v.useCallback(()=>le(!1),[]),z=v.useCallback(()=>{ue(),te(),me(),Z(!0)},[ue,te,me]),ee=v.useCallback(()=>Z(!1),[]);return g.jsxs("div",{className:"HomeScreen theme-casino home-fixed-root",children:[g.jsx(ji,{className:"page-home-screen"}),g.jsx(fae,{}),g.jsx(fP,{open:X,onClose:be}),g.jsxs("div",{className:"logout-container home-header-row",children:[g.jsx("a",{className:"home-header-link",title:"How to Play","aria-label":"How to Play",onClick:dr,role:"button",children:g.jsx("img",{src:hae,alt:"How to Play",className:"home-header-icon"})}),g.jsx("a",{className:"gold-link home-header-link",title:"Leaderboards","aria-label":"Leaderboards",onClick:z,children:"Leaderboards"}),!m&&g.jsx("a",{className:"gold-link",onClick:nt($e),children:"Login"}),m&&g.jsxs(g.Fragment,{children:[g.jsx("a",{ref:ae,className:"settings-toggle",title:"Settings","aria-label":"Settings","aria-haspopup":"menu","aria-expanded":A,onClick:et,children:g.jsx("img",{src:pae,alt:"Settings",className:"home-header-icon"})}),g.jsx(ZG,{anchorRef:ae,open:A,onClose:at,items:De})]})]}),g.jsx("div",{ref:He,className:"home-fit-shell",style:H?{height:H}:void 0,children:g.jsxs("div",{ref:ce,className:"home-fit-content",style:xe<1?{transform:`scale(${xe})`,transformOrigin:"top center"}:void 0,children:[(!Ct||jt)&&g.jsxs("div",{className:`promo-banner ${q?`promo-banner--${q}`:""}`,role:"region","aria-label":"Login banner",children:[g.jsx("div",{style:{marginBottom:16},children:g.jsx("span",{className:"promo-banner__title",children:"Login to unlock Multiplayer"})}),g.jsx("div",{children:g.jsx("button",{className:"btn gold-fill",onClick:nt($e),"aria-label":"Login",children:"Login"})})]}),g.jsx(hF,{}),!q&&g.jsx(mae,{selected:U,onChange:Ae,badges:{"cee-lo":"Most Popular"}}),g.jsxs("section",{className:"home-cta buttonRow","aria-label":"Actions",children:[g.jsx("div",{className:"cta-spotlight","aria-hidden":!0}),g.jsx("button",{className:"btn gold-fill cta-btn primaryButton",onClick:je,disabled:!U||O,"aria-label":"Single Player",children:"Single Player"}),g.jsx("button",{className:"btn gold-outline cta-btn primaryButton",onClick:_t,disabled:!U,"aria-label":"Join Room",children:"Join Room"}),g.jsx("button",{className:"btn gold-outline cta-btn primaryButton",onClick:ge,disabled:!U,"aria-label":"Create Room",children:"Create Room"})]})]})}),g.jsx(JG,{open:E,onClose:we,gameMode:U??"cee-lo"}),g.jsx(QG,{open:D,onClose:st,isPrivate:w,setIsPrivate:b,roomsList:K}),g.jsx(pF,{open:a,onClose:bt,planId:m?.membershipTier}),g.jsx(gF,{open:nr,onClose:Sr}),g.jsx(Sne,{open:un,onClose:ee}),g.jsx(Ene,{open:x,onClose:()=>R(!1),onGoLogin:()=>$e(),title:"Login Required",message:g.jsx(g.Fragment,{children:"Please log in to access Settings and Multiplayer."})}),g.jsx(dae,{available:t,progress:e,applyNow:r,later:n}),g.jsx(_P,{})]})}const yae=""+new URL("fairness-BAFxLGWm.png",import.meta.url).href;function bP({state:t}){const r={verified:{label:"Verified",cls:"fairness--ok",icon:"✓"},"bad-commit":{label:"Bad commit",cls:"fairness--bad",icon:"!"},mismatch:{label:"Mismatch",cls:"fairness--bad",icon:"!"},unverifiable:{label:"Unverified",cls:"fairness--dim",icon:"x"}}[t];return g.jsx("span",{className:`fairness ${r.cls}`,title:r.label,"aria-label":r.label,children:t==="verified"?g.jsx("img",{src:yae,alt:"Fairness verified",className:"fairness-img"}):r.icon})}/*!
 * Font Awesome Free 7.0.1 by @fontawesome - https://fontawesome.com
 * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
 * Copyright 2025 Fonticons, Inc.
 */function BT(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function vae(t){if(Array.isArray(t))return t}function _ae(t){if(Array.isArray(t))return BT(t)}function bae(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function kae(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,kF(n.key),n)}}function wae(t,e,r){return e&&kae(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function t_(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=kP(t))||e){r&&(t=r);var n=0,a=function(){};return{s:a,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(u){throw u},f:a}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,o=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var u=r.next();return o=u.done,u},e:function(u){c=!0,i=u},f:function(){try{o||r.return==null||r.return()}finally{if(c)throw i}}}}function Cr(t,e,r){return(e=kF(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Sae(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Eae(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,a,i,o,c=[],u=!0,d=!1;try{if(i=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(f){d=!0,a=f}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw a}}return c}}function Tae(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Cae(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function oI(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function ut(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?oI(Object(r),!0).forEach(function(n){Cr(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):oI(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function n0(t,e){return vae(t)||Eae(t,e)||kP(t,e)||Tae()}function Zs(t){return _ae(t)||Sae(t)||kP(t)||Cae()}function xae(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function kF(t){var e=xae(t,"string");return typeof e=="symbol"?e:e+""}function Z_(t){"@babel/helpers - typeof";return Z_=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Z_(t)}function kP(t,e){if(t){if(typeof t=="string")return BT(t,e);var r={}.toString.call(t).slice(8,-1);return r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set"?Array.from(t):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?BT(t,e):void 0}}var cI=function(){},wP={},wF={},SF=null,EF={mark:cI,measure:cI};try{typeof window<"u"&&(wP=window),typeof document<"u"&&(wF=document),typeof MutationObserver<"u"&&(SF=MutationObserver),typeof performance<"u"&&(EF=performance)}catch{}var Pae=wP.navigator||{},lI=Pae.userAgent,uI=lI===void 0?"":lI,Zl=wP,vn=wF,dI=SF,yv=EF;Zl.document;var Kc=!!vn.documentElement&&!!vn.head&&typeof vn.addEventListener=="function"&&typeof vn.createElement=="function",TF=~uI.indexOf("MSIE")||~uI.indexOf("Trident/"),zS,Aae=/fa(k|kd|s|r|l|t|d|dr|dl|dt|b|slr|slpr|wsb|tl|ns|nds|es|jr|jfr|jdr|cr|ss|sr|sl|st|sds|sdr|sdl|sdt)?[\-\ ]/,Rae=/Font ?Awesome ?([567 ]*)(Solid|Regular|Light|Thin|Duotone|Brands|Free|Pro|Sharp Duotone|Sharp|Kit|Notdog Duo|Notdog|Chisel|Etch|Thumbprint|Jelly Fill|Jelly Duo|Jelly|Slab Press|Slab|Whiteboard)?.*/i,CF={classic:{fa:"solid",fas:"solid","fa-solid":"solid",far:"regular","fa-regular":"regular",fal:"light","fa-light":"light",fat:"thin","fa-thin":"thin",fab:"brands","fa-brands":"brands"},duotone:{fa:"solid",fad:"solid","fa-solid":"solid","fa-duotone":"solid",fadr:"regular","fa-regular":"regular",fadl:"light","fa-light":"light",fadt:"thin","fa-thin":"thin"},sharp:{fa:"solid",fass:"solid","fa-solid":"solid",fasr:"regular","fa-regular":"regular",fasl:"light","fa-light":"light",fast:"thin","fa-thin":"thin"},"sharp-duotone":{fa:"solid",fasds:"solid","fa-solid":"solid",fasdr:"regular","fa-regular":"regular",fasdl:"light","fa-light":"light",fasdt:"thin","fa-thin":"thin"},slab:{"fa-regular":"regular",faslr:"regular"},"slab-press":{"fa-regular":"regular",faslpr:"regular"},thumbprint:{"fa-light":"light",fatl:"light"},whiteboard:{"fa-semibold":"semibold",fawsb:"semibold"},notdog:{"fa-solid":"solid",fans:"solid"},"notdog-duo":{"fa-solid":"solid",fands:"solid"},etch:{"fa-solid":"solid",faes:"solid"},jelly:{"fa-regular":"regular",fajr:"regular"},"jelly-fill":{"fa-regular":"regular",fajfr:"regular"},"jelly-duo":{"fa-regular":"regular",fajdr:"regular"},chisel:{"fa-regular":"regular",facr:"regular"}},Dae={GROUP:"duotone-group",PRIMARY:"primary",SECONDARY:"secondary"},xF=["fa-classic","fa-duotone","fa-sharp","fa-sharp-duotone","fa-thumbprint","fa-whiteboard","fa-notdog","fa-notdog-duo","fa-chisel","fa-etch","fa-jelly","fa-jelly-fill","fa-jelly-duo","fa-slab","fa-slab-press"],xa="classic",Ug="duotone",PF="sharp",AF="sharp-duotone",RF="chisel",DF="etch",OF="jelly",NF="jelly-duo",IF="jelly-fill",MF="notdog",jF="notdog-duo",LF="slab",BF="slab-press",UF="thumbprint",FF="whiteboard",Oae="Classic",Nae="Duotone",Iae="Sharp",Mae="Sharp Duotone",jae="Chisel",Lae="Etch",Bae="Jelly",Uae="Jelly Duo",Fae="Jelly Fill",qae="Notdog",zae="Notdog Duo",$ae="Slab",Vae="Slab Press",Hae="Thumbprint",Gae="Whiteboard",qF=[xa,Ug,PF,AF,RF,DF,OF,NF,IF,MF,jF,LF,BF,UF,FF];zS={},Cr(Cr(Cr(Cr(Cr(Cr(Cr(Cr(Cr(Cr(zS,xa,Oae),Ug,Nae),PF,Iae),AF,Mae),RF,jae),DF,Lae),OF,Bae),NF,Uae),IF,Fae),MF,qae),Cr(Cr(Cr(Cr(Cr(zS,jF,zae),LF,$ae),BF,Vae),UF,Hae),FF,Gae);var Wae={classic:{900:"fas",400:"far",normal:"far",300:"fal",100:"fat"},duotone:{900:"fad",400:"fadr",300:"fadl",100:"fadt"},sharp:{900:"fass",400:"fasr",300:"fasl",100:"fast"},"sharp-duotone":{900:"fasds",400:"fasdr",300:"fasdl",100:"fasdt"},slab:{400:"faslr"},"slab-press":{400:"faslpr"},whiteboard:{600:"fawsb"},thumbprint:{300:"fatl"},notdog:{900:"fans"},"notdog-duo":{900:"fands"},etch:{900:"faes"},chisel:{400:"facr"},jelly:{400:"fajr"},"jelly-fill":{400:"fajfr"},"jelly-duo":{400:"fajdr"}},Kae={"Font Awesome 7 Free":{900:"fas",400:"far"},"Font Awesome 7 Pro":{900:"fas",400:"far",normal:"far",300:"fal",100:"fat"},"Font Awesome 7 Brands":{400:"fab",normal:"fab"},"Font Awesome 7 Duotone":{900:"fad",400:"fadr",normal:"fadr",300:"fadl",100:"fadt"},"Font Awesome 7 Sharp":{900:"fass",400:"fasr",normal:"fasr",300:"fasl",100:"fast"},"Font Awesome 7 Sharp Duotone":{900:"fasds",400:"fasdr",normal:"fasdr",300:"fasdl",100:"fasdt"},"Font Awesome 7 Jelly":{400:"fajr",normal:"fajr"},"Font Awesome 7 Jelly Fill":{400:"fajfr",normal:"fajfr"},"Font Awesome 7 Jelly Duo":{400:"fajdr",normal:"fajdr"},"Font Awesome 7 Slab":{400:"faslr",normal:"faslr"},"Font Awesome 7 Slab Press":{400:"faslpr",normal:"faslpr"},"Font Awesome 7 Thumbprint":{300:"fatl",normal:"fatl"},"Font Awesome 7 Notdog":{900:"fans",normal:"fans"},"Font Awesome 7 Notdog Duo":{900:"fands",normal:"fands"},"Font Awesome 7 Etch":{900:"faes",normal:"faes"},"Font Awesome 7 Chisel":{400:"facr",normal:"facr"},"Font Awesome 7 Whiteboard":{600:"fawsb",normal:"fawsb"}},Yae=new Map([["classic",{defaultShortPrefixId:"fas",defaultStyleId:"solid",styleIds:["solid","regular","light","thin","brands"],futureStyleIds:[],defaultFontWeight:900}],["duotone",{defaultShortPrefixId:"fad",defaultStyleId:"solid",styleIds:["solid","regular","light","thin"],futureStyleIds:[],defaultFontWeight:900}],["sharp",{defaultShortPrefixId:"fass",defaultStyleId:"solid",styleIds:["solid","regular","light","thin"],futureStyleIds:[],defaultFontWeight:900}],["sharp-duotone",{defaultShortPrefixId:"fasds",defaultStyleId:"solid",styleIds:["solid","regular","light","thin"],futureStyleIds:[],defaultFontWeight:900}],["chisel",{defaultShortPrefixId:"facr",defaultStyleId:"regular",styleIds:["regular"],futureStyleIds:[],defaultFontWeight:400}],["etch",{defaultShortPrefixId:"faes",defaultStyleId:"solid",styleIds:["solid"],futureStyleIds:[],defaultFontWeight:900}],["jelly",{defaultShortPrefixId:"fajr",defaultStyleId:"regular",styleIds:["regular"],futureStyleIds:[],defaultFontWeight:400}],["jelly-duo",{defaultShortPrefixId:"fajdr",defaultStyleId:"regular",styleIds:["regular"],futureStyleIds:[],defaultFontWeight:400}],["jelly-fill",{defaultShortPrefixId:"fajfr",defaultStyleId:"regular",styleIds:["regular"],futureStyleIds:[],defaultFontWeight:400}],["notdog",{defaultShortPrefixId:"fans",defaultStyleId:"solid",styleIds:["solid"],futureStyleIds:[],defaultFontWeight:900}],["notdog-duo",{defaultShortPrefixId:"fands",defaultStyleId:"solid",styleIds:["solid"],futureStyleIds:[],defaultFontWeight:900}],["slab",{defaultShortPrefixId:"faslr",defaultStyleId:"regular",styleIds:["regular"],futureStyleIds:[],defaultFontWeight:400}],["slab-press",{defaultShortPrefixId:"faslpr",defaultStyleId:"regular",styleIds:["regular"],futureStyleIds:[],defaultFontWeight:400}],["thumbprint",{defaultShortPrefixId:"fatl",defaultStyleId:"light",styleIds:["light"],futureStyleIds:[],defaultFontWeight:300}],["whiteboard",{defaultShortPrefixId:"fawsb",defaultStyleId:"semibold",styleIds:["semibold"],futureStyleIds:[],defaultFontWeight:600}]]),Xae={chisel:{regular:"facr"},classic:{brands:"fab",light:"fal",regular:"far",solid:"fas",thin:"fat"},duotone:{light:"fadl",regular:"fadr",solid:"fad",thin:"fadt"},etch:{solid:"faes"},jelly:{regular:"fajr"},"jelly-duo":{regular:"fajdr"},"jelly-fill":{regular:"fajfr"},notdog:{solid:"fans"},"notdog-duo":{solid:"fands"},sharp:{light:"fasl",regular:"fasr",solid:"fass",thin:"fast"},"sharp-duotone":{light:"fasdl",regular:"fasdr",solid:"fasds",thin:"fasdt"},slab:{regular:"faslr"},"slab-press":{regular:"faslpr"},thumbprint:{light:"fatl"},whiteboard:{semibold:"fawsb"}},zF=["fak","fa-kit","fakd","fa-kit-duotone"],fI={kit:{fak:"kit","fa-kit":"kit"},"kit-duotone":{fakd:"kit-duotone","fa-kit-duotone":"kit-duotone"}},Jae=["kit"],Qae="kit",Zae="kit-duotone",eie="Kit",tie="Kit Duotone";Cr(Cr({},Qae,eie),Zae,tie);var rie={kit:{"fa-kit":"fak"}},nie={"Font Awesome Kit":{400:"fak",normal:"fak"},"Font Awesome Kit Duotone":{400:"fakd",normal:"fakd"}},aie={kit:{fak:"fa-kit"}},pI={kit:{kit:"fak"},"kit-duotone":{"kit-duotone":"fakd"}},$S,vv={GROUP:"duotone-group",SWAP_OPACITY:"swap-opacity",PRIMARY:"primary",SECONDARY:"secondary"},iie=["fa-classic","fa-duotone","fa-sharp","fa-sharp-duotone","fa-thumbprint","fa-whiteboard","fa-notdog","fa-notdog-duo","fa-chisel","fa-etch","fa-jelly","fa-jelly-fill","fa-jelly-duo","fa-slab","fa-slab-press"],sie="classic",oie="duotone",cie="sharp",lie="sharp-duotone",uie="chisel",die="etch",fie="jelly",pie="jelly-duo",hie="jelly-fill",mie="notdog",gie="notdog-duo",yie="slab",vie="slab-press",_ie="thumbprint",bie="whiteboard",kie="Classic",wie="Duotone",Sie="Sharp",Eie="Sharp Duotone",Tie="Chisel",Cie="Etch",xie="Jelly",Pie="Jelly Duo",Aie="Jelly Fill",Rie="Notdog",Die="Notdog Duo",Oie="Slab",Nie="Slab Press",Iie="Thumbprint",Mie="Whiteboard";$S={},Cr(Cr(Cr(Cr(Cr(Cr(Cr(Cr(Cr(Cr($S,sie,kie),oie,wie),cie,Sie),lie,Eie),uie,Tie),die,Cie),fie,xie),pie,Pie),hie,Aie),mie,Rie),Cr(Cr(Cr(Cr(Cr($S,gie,Die),yie,Oie),vie,Nie),_ie,Iie),bie,Mie);var jie="kit",Lie="kit-duotone",Bie="Kit",Uie="Kit Duotone";Cr(Cr({},jie,Bie),Lie,Uie);var Fie={classic:{"fa-brands":"fab","fa-duotone":"fad","fa-light":"fal","fa-regular":"far","fa-solid":"fas","fa-thin":"fat"},duotone:{"fa-regular":"fadr","fa-light":"fadl","fa-thin":"fadt"},sharp:{"fa-solid":"fass","fa-regular":"fasr","fa-light":"fasl","fa-thin":"fast"},"sharp-duotone":{"fa-solid":"fasds","fa-regular":"fasdr","fa-light":"fasdl","fa-thin":"fasdt"},slab:{"fa-regular":"faslr"},"slab-press":{"fa-regular":"faslpr"},whiteboard:{"fa-semibold":"fawsb"},thumbprint:{"fa-light":"fatl"},notdog:{"fa-solid":"fans"},"notdog-duo":{"fa-solid":"fands"},etch:{"fa-solid":"faes"},jelly:{"fa-regular":"fajr"},"jelly-fill":{"fa-regular":"fajfr"},"jelly-duo":{"fa-regular":"fajdr"},chisel:{"fa-regular":"facr"}},qie={classic:["fas","far","fal","fat","fad"],duotone:["fadr","fadl","fadt"],sharp:["fass","fasr","fasl","fast"],"sharp-duotone":["fasds","fasdr","fasdl","fasdt"],slab:["faslr"],"slab-press":["faslpr"],whiteboard:["fawsb"],thumbprint:["fatl"],notdog:["fans"],"notdog-duo":["fands"],etch:["faes"],jelly:["fajr"],"jelly-fill":["fajfr"],"jelly-duo":["fajdr"],chisel:["facr"]},UT={classic:{fab:"fa-brands",fad:"fa-duotone",fal:"fa-light",far:"fa-regular",fas:"fa-solid",fat:"fa-thin"},duotone:{fadr:"fa-regular",fadl:"fa-light",fadt:"fa-thin"},sharp:{fass:"fa-solid",fasr:"fa-regular",fasl:"fa-light",fast:"fa-thin"},"sharp-duotone":{fasds:"fa-solid",fasdr:"fa-regular",fasdl:"fa-light",fasdt:"fa-thin"},slab:{faslr:"fa-regular"},"slab-press":{faslpr:"fa-regular"},whiteboard:{fawsb:"fa-semibold"},thumbprint:{fatl:"fa-light"},notdog:{fans:"fa-solid"},"notdog-duo":{fands:"fa-solid"},etch:{faes:"fa-solid"},jelly:{fajr:"fa-regular"},"jelly-fill":{fajfr:"fa-regular"},"jelly-duo":{fajdr:"fa-regular"},chisel:{facr:"fa-regular"}},zie=["fa-solid","fa-regular","fa-light","fa-thin","fa-duotone","fa-brands","fa-semibold"],$F=["fa","fas","far","fal","fat","fad","fadr","fadl","fadt","fab","fass","fasr","fasl","fast","fasds","fasdr","fasdl","fasdt","faslr","faslpr","fawsb","fatl","fans","fands","faes","fajr","fajfr","fajdr","facr"].concat(iie,zie),$ie=["solid","regular","light","thin","duotone","brands","semibold"],VF=[1,2,3,4,5,6,7,8,9,10],Vie=VF.concat([11,12,13,14,15,16,17,18,19,20]),Hie=["aw","fw","pull-left","pull-right"],Gie=[].concat(Zs(Object.keys(qie)),$ie,Hie,["2xs","xs","sm","lg","xl","2xl","beat","border","fade","beat-fade","bounce","flip-both","flip-horizontal","flip-vertical","flip","inverse","layers","layers-bottom-left","layers-bottom-right","layers-counter","layers-text","layers-top-left","layers-top-right","li","pull-end","pull-start","pulse","rotate-180","rotate-270","rotate-90","rotate-by","shake","spin-pulse","spin-reverse","spin","stack-1x","stack-2x","stack","ul","width-auto","width-fixed",vv.GROUP,vv.SWAP_OPACITY,vv.PRIMARY,vv.SECONDARY]).concat(VF.map(function(t){return"".concat(t,"x")})).concat(Vie.map(function(t){return"w-".concat(t)})),Wie={"Font Awesome 5 Free":{900:"fas",400:"far"},"Font Awesome 5 Pro":{900:"fas",400:"far",normal:"far",300:"fal"},"Font Awesome 5 Brands":{400:"fab",normal:"fab"},"Font Awesome 5 Duotone":{900:"fad"}},zc="___FONT_AWESOME___",FT=16,HF="fa",GF="svg-inline--fa",ud="data-fa-i2svg",qT="data-fa-pseudo-element",Kie="data-fa-pseudo-element-pending",SP="data-prefix",EP="data-icon",hI="fontawesome-i2svg",Yie="async",Xie=["HTML","HEAD","STYLE","SCRIPT"],WF=["::before","::after",":before",":after"],KF=(function(){try{return!0}catch{return!1}})();function Fg(t){return new Proxy(t,{get:function(r,n){return n in r?r[n]:r[xa]}})}var YF=ut({},CF);YF[xa]=ut(ut(ut(ut({},{"fa-duotone":"duotone"}),CF[xa]),fI.kit),fI["kit-duotone"]);var Jie=Fg(YF),zT=ut({},Xae);zT[xa]=ut(ut(ut(ut({},{duotone:"fad"}),zT[xa]),pI.kit),pI["kit-duotone"]);var mI=Fg(zT),$T=ut({},UT);$T[xa]=ut(ut({},$T[xa]),aie.kit);var TP=Fg($T),VT=ut({},Fie);VT[xa]=ut(ut({},VT[xa]),rie.kit);Fg(VT);var Qie=Aae,XF="fa-layers-text",Zie=Rae,ese=ut({},Wae);Fg(ese);var tse=["class","data-prefix","data-icon","data-fa-transform","data-fa-mask"],VS=Dae,rse=[].concat(Zs(Jae),Zs(Gie)),dm=Zl.FontAwesomeConfig||{};function nse(t){var e=vn.querySelector("script["+t+"]");if(e)return e.getAttribute(t)}function ase(t){return t===""?!0:t==="false"?!1:t==="true"?!0:t}if(vn&&typeof vn.querySelector=="function"){var ise=[["data-family-prefix","familyPrefix"],["data-css-prefix","cssPrefix"],["data-family-default","familyDefault"],["data-style-default","styleDefault"],["data-replacement-class","replacementClass"],["data-auto-replace-svg","autoReplaceSvg"],["data-auto-add-css","autoAddCss"],["data-search-pseudo-elements","searchPseudoElements"],["data-search-pseudo-elements-warnings","searchPseudoElementsWarnings"],["data-search-pseudo-elements-full-scan","searchPseudoElementsFullScan"],["data-observe-mutations","observeMutations"],["data-mutate-approach","mutateApproach"],["data-keep-original-source","keepOriginalSource"],["data-measure-performance","measurePerformance"],["data-show-missing-icons","showMissingIcons"]];ise.forEach(function(t){var e=n0(t,2),r=e[0],n=e[1],a=ase(nse(r));a!=null&&(dm[n]=a)})}var JF={styleDefault:"solid",familyDefault:xa,cssPrefix:HF,replacementClass:GF,autoReplaceSvg:!0,autoAddCss:!0,searchPseudoElements:!1,searchPseudoElementsWarnings:!0,searchPseudoElementsFullScan:!1,observeMutations:!0,mutateApproach:"async",keepOriginalSource:!0,measurePerformance:!1,showMissingIcons:!0};dm.familyPrefix&&(dm.cssPrefix=dm.familyPrefix);var cp=ut(ut({},JF),dm);cp.autoReplaceSvg||(cp.observeMutations=!1);var qt={};Object.keys(JF).forEach(function(t){Object.defineProperty(qt,t,{enumerable:!0,set:function(r){cp[t]=r,fm.forEach(function(n){return n(qt)})},get:function(){return cp[t]}})});Object.defineProperty(qt,"familyPrefix",{enumerable:!0,set:function(e){cp.cssPrefix=e,fm.forEach(function(r){return r(qt)})},get:function(){return cp.cssPrefix}});Zl.FontAwesomeConfig=qt;var fm=[];function sse(t){return fm.push(t),function(){fm.splice(fm.indexOf(t),1)}}var lf=FT,Lo={size:16,x:0,y:0,rotate:0,flipX:!1,flipY:!1};function ose(t){if(!(!t||!Kc)){var e=vn.createElement("style");e.setAttribute("type","text/css"),e.innerHTML=t;for(var r=vn.head.childNodes,n=null,a=r.length-1;a>-1;a--){var i=r[a],o=(i.tagName||"").toUpperCase();["STYLE","LINK"].indexOf(o)>-1&&(n=i)}return vn.head.insertBefore(e,n),t}}var cse="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";function gI(){for(var t=12,e="";t-- >0;)e+=cse[Math.random()*62|0];return e}function Dp(t){for(var e=[],r=(t||[]).length>>>0;r--;)e[r]=t[r];return e}function CP(t){return t.classList?Dp(t.classList):(t.getAttribute("class")||"").split(" ").filter(function(e){return e})}function QF(t){return"".concat(t).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function lse(t){return Object.keys(t||{}).reduce(function(e,r){return e+"".concat(r,'="').concat(QF(t[r]),'" ')},"").trim()}function a0(t){return Object.keys(t||{}).reduce(function(e,r){return e+"".concat(r,": ").concat(t[r].trim(),";")},"")}function xP(t){return t.size!==Lo.size||t.x!==Lo.x||t.y!==Lo.y||t.rotate!==Lo.rotate||t.flipX||t.flipY}function use(t){var e=t.transform,r=t.containerWidth,n=t.iconWidth,a={transform:"translate(".concat(r/2," 256)")},i="translate(".concat(e.x*32,", ").concat(e.y*32,") "),o="scale(".concat(e.size/16*(e.flipX?-1:1),", ").concat(e.size/16*(e.flipY?-1:1),") "),c="rotate(".concat(e.rotate," 0 0)"),u={transform:"".concat(i," ").concat(o," ").concat(c)},d={transform:"translate(".concat(n/2*-1," -256)")};return{outer:a,inner:u,path:d}}function dse(t){var e=t.transform,r=t.width,n=r===void 0?FT:r,a=t.height,i=a===void 0?FT:a,o="";return TF?o+="translate(".concat(e.x/lf-n/2,"em, ").concat(e.y/lf-i/2,"em) "):o+="translate(calc(-50% + ".concat(e.x/lf,"em), calc(-50% + ").concat(e.y/lf,"em)) "),o+="scale(".concat(e.size/lf*(e.flipX?-1:1),", ").concat(e.size/lf*(e.flipY?-1:1),") "),o+="rotate(".concat(e.rotate,"deg) "),o}var fse=`:root, :host {
  --fa-font-solid: normal 900 1em/1 "Font Awesome 7 Free";
  --fa-font-regular: normal 400 1em/1 "Font Awesome 7 Free";
  --fa-font-light: normal 300 1em/1 "Font Awesome 7 Pro";
  --fa-font-thin: normal 100 1em/1 "Font Awesome 7 Pro";
  --fa-font-duotone: normal 900 1em/1 "Font Awesome 7 Duotone";
  --fa-font-duotone-regular: normal 400 1em/1 "Font Awesome 7 Duotone";
  --fa-font-duotone-light: normal 300 1em/1 "Font Awesome 7 Duotone";
  --fa-font-duotone-thin: normal 100 1em/1 "Font Awesome 7 Duotone";
  --fa-font-brands: normal 400 1em/1 "Font Awesome 7 Brands";
  --fa-font-sharp-solid: normal 900 1em/1 "Font Awesome 7 Sharp";
  --fa-font-sharp-regular: normal 400 1em/1 "Font Awesome 7 Sharp";
  --fa-font-sharp-light: normal 300 1em/1 "Font Awesome 7 Sharp";
  --fa-font-sharp-thin: normal 100 1em/1 "Font Awesome 7 Sharp";
  --fa-font-sharp-duotone-solid: normal 900 1em/1 "Font Awesome 7 Sharp Duotone";
  --fa-font-sharp-duotone-regular: normal 400 1em/1 "Font Awesome 7 Sharp Duotone";
  --fa-font-sharp-duotone-light: normal 300 1em/1 "Font Awesome 7 Sharp Duotone";
  --fa-font-sharp-duotone-thin: normal 100 1em/1 "Font Awesome 7 Sharp Duotone";
  --fa-font-slab-regular: normal 400 1em/1 "Font Awesome 7 Slab";
  --fa-font-slab-press-regular: normal 400 1em/1 "Font Awesome 7 Slab Press";
  --fa-font-whiteboard-semibold: normal 600 1em/1 "Font Awesome 7 Whiteboard";
  --fa-font-thumbprint-light: normal 300 1em/1 "Font Awesome 7 Thumbprint";
  --fa-font-notdog-solid: normal 900 1em/1 "Font Awesome 7 Notdog";
  --fa-font-notdog-duo-solid: normal 900 1em/1 "Font Awesome 7 Notdog Duo";
  --fa-font-etch-solid: normal 900 1em/1 "Font Awesome 7 Etch";
  --fa-font-jelly-regular: normal 400 1em/1 "Font Awesome 7 Jelly";
  --fa-font-jelly-fill-regular: normal 400 1em/1 "Font Awesome 7 Jelly Fill";
  --fa-font-jelly-duo-regular: normal 400 1em/1 "Font Awesome 7 Jelly Duo";
  --fa-font-chisel-regular: normal 400 1em/1 "Font Awesome 7 Chisel";
}

.svg-inline--fa {
  box-sizing: content-box;
  display: var(--fa-display, inline-block);
  height: 1em;
  overflow: visible;
  vertical-align: -0.125em;
  width: var(--fa-width, 1.25em);
}
.svg-inline--fa.fa-2xs {
  vertical-align: 0.1em;
}
.svg-inline--fa.fa-xs {
  vertical-align: 0em;
}
.svg-inline--fa.fa-sm {
  vertical-align: -0.0714285714em;
}
.svg-inline--fa.fa-lg {
  vertical-align: -0.2em;
}
.svg-inline--fa.fa-xl {
  vertical-align: -0.25em;
}
.svg-inline--fa.fa-2xl {
  vertical-align: -0.3125em;
}
.svg-inline--fa.fa-pull-left,
.svg-inline--fa .fa-pull-start {
  float: inline-start;
  margin-inline-end: var(--fa-pull-margin, 0.3em);
}
.svg-inline--fa.fa-pull-right,
.svg-inline--fa .fa-pull-end {
  float: inline-end;
  margin-inline-start: var(--fa-pull-margin, 0.3em);
}
.svg-inline--fa.fa-li {
  width: var(--fa-li-width, 2em);
  inset-inline-start: calc(-1 * var(--fa-li-width, 2em));
  inset-block-start: 0.25em; /* syncing vertical alignment with Web Font rendering */
}

.fa-layers-counter, .fa-layers-text {
  display: inline-block;
  position: absolute;
  text-align: center;
}

.fa-layers {
  display: inline-block;
  height: 1em;
  position: relative;
  text-align: center;
  vertical-align: -0.125em;
  width: var(--fa-width, 1.25em);
}
.fa-layers .svg-inline--fa {
  inset: 0;
  margin: auto;
  position: absolute;
  transform-origin: center center;
}

.fa-layers-text {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  transform-origin: center center;
}

.fa-layers-counter {
  background-color: var(--fa-counter-background-color, #ff253a);
  border-radius: var(--fa-counter-border-radius, 1em);
  box-sizing: border-box;
  color: var(--fa-inverse, #fff);
  line-height: var(--fa-counter-line-height, 1);
  max-width: var(--fa-counter-max-width, 5em);
  min-width: var(--fa-counter-min-width, 1.5em);
  overflow: hidden;
  padding: var(--fa-counter-padding, 0.25em 0.5em);
  right: var(--fa-right, 0);
  text-overflow: ellipsis;
  top: var(--fa-top, 0);
  transform: scale(var(--fa-counter-scale, 0.25));
  transform-origin: top right;
}

.fa-layers-bottom-right {
  bottom: var(--fa-bottom, 0);
  right: var(--fa-right, 0);
  top: auto;
  transform: scale(var(--fa-layers-scale, 0.25));
  transform-origin: bottom right;
}

.fa-layers-bottom-left {
  bottom: var(--fa-bottom, 0);
  left: var(--fa-left, 0);
  right: auto;
  top: auto;
  transform: scale(var(--fa-layers-scale, 0.25));
  transform-origin: bottom left;
}

.fa-layers-top-right {
  top: var(--fa-top, 0);
  right: var(--fa-right, 0);
  transform: scale(var(--fa-layers-scale, 0.25));
  transform-origin: top right;
}

.fa-layers-top-left {
  left: var(--fa-left, 0);
  right: auto;
  top: var(--fa-top, 0);
  transform: scale(var(--fa-layers-scale, 0.25));
  transform-origin: top left;
}

.fa-1x {
  font-size: 1em;
}

.fa-2x {
  font-size: 2em;
}

.fa-3x {
  font-size: 3em;
}

.fa-4x {
  font-size: 4em;
}

.fa-5x {
  font-size: 5em;
}

.fa-6x {
  font-size: 6em;
}

.fa-7x {
  font-size: 7em;
}

.fa-8x {
  font-size: 8em;
}

.fa-9x {
  font-size: 9em;
}

.fa-10x {
  font-size: 10em;
}

.fa-2xs {
  font-size: calc(10 / 16 * 1em); /* converts a 10px size into an em-based value that's relative to the scale's 16px base */
  line-height: calc(1 / 10 * 1em); /* sets the line-height of the icon back to that of it's parent */
  vertical-align: calc((6 / 10 - 0.375) * 1em); /* vertically centers the icon taking into account the surrounding text's descender */
}

.fa-xs {
  font-size: calc(12 / 16 * 1em); /* converts a 12px size into an em-based value that's relative to the scale's 16px base */
  line-height: calc(1 / 12 * 1em); /* sets the line-height of the icon back to that of it's parent */
  vertical-align: calc((6 / 12 - 0.375) * 1em); /* vertically centers the icon taking into account the surrounding text's descender */
}

.fa-sm {
  font-size: calc(14 / 16 * 1em); /* converts a 14px size into an em-based value that's relative to the scale's 16px base */
  line-height: calc(1 / 14 * 1em); /* sets the line-height of the icon back to that of it's parent */
  vertical-align: calc((6 / 14 - 0.375) * 1em); /* vertically centers the icon taking into account the surrounding text's descender */
}

.fa-lg {
  font-size: calc(20 / 16 * 1em); /* converts a 20px size into an em-based value that's relative to the scale's 16px base */
  line-height: calc(1 / 20 * 1em); /* sets the line-height of the icon back to that of it's parent */
  vertical-align: calc((6 / 20 - 0.375) * 1em); /* vertically centers the icon taking into account the surrounding text's descender */
}

.fa-xl {
  font-size: calc(24 / 16 * 1em); /* converts a 24px size into an em-based value that's relative to the scale's 16px base */
  line-height: calc(1 / 24 * 1em); /* sets the line-height of the icon back to that of it's parent */
  vertical-align: calc((6 / 24 - 0.375) * 1em); /* vertically centers the icon taking into account the surrounding text's descender */
}

.fa-2xl {
  font-size: calc(32 / 16 * 1em); /* converts a 32px size into an em-based value that's relative to the scale's 16px base */
  line-height: calc(1 / 32 * 1em); /* sets the line-height of the icon back to that of it's parent */
  vertical-align: calc((6 / 32 - 0.375) * 1em); /* vertically centers the icon taking into account the surrounding text's descender */
}

.fa-width-auto {
  --fa-width: auto;
}

.fa-fw,
.fa-width-fixed {
  --fa-width: 1.25em;
}

.fa-ul {
  list-style-type: none;
  margin-inline-start: var(--fa-li-margin, 2.5em);
  padding-inline-start: 0;
}
.fa-ul > li {
  position: relative;
}

.fa-li {
  inset-inline-start: calc(-1 * var(--fa-li-width, 2em));
  position: absolute;
  text-align: center;
  width: var(--fa-li-width, 2em);
  line-height: inherit;
}

/* Heads Up: Bordered Icons will not be supported in the future!
  - This feature will be deprecated in the next major release of Font Awesome (v8)!
  - You may continue to use it in this version *v7), but it will not be supported in Font Awesome v8.
*/
/* Notes:
* --@{v.$css-prefix}-border-width = 1/16 by default (to render as ~1px based on a 16px default font-size)
* --@{v.$css-prefix}-border-padding =
  ** 3/16 for vertical padding (to give ~2px of vertical whitespace around an icon considering it's vertical alignment)
  ** 4/16 for horizontal padding (to give ~4px of horizontal whitespace around an icon)
*/
.fa-border {
  border-color: var(--fa-border-color, #eee);
  border-radius: var(--fa-border-radius, 0.1em);
  border-style: var(--fa-border-style, solid);
  border-width: var(--fa-border-width, 0.0625em);
  box-sizing: var(--fa-border-box-sizing, content-box);
  padding: var(--fa-border-padding, 0.1875em 0.25em);
}

.fa-pull-left,
.fa-pull-start {
  float: inline-start;
  margin-inline-end: var(--fa-pull-margin, 0.3em);
}

.fa-pull-right,
.fa-pull-end {
  float: inline-end;
  margin-inline-start: var(--fa-pull-margin, 0.3em);
}

.fa-beat {
  animation-name: fa-beat;
  animation-delay: var(--fa-animation-delay, 0s);
  animation-direction: var(--fa-animation-direction, normal);
  animation-duration: var(--fa-animation-duration, 1s);
  animation-iteration-count: var(--fa-animation-iteration-count, infinite);
  animation-timing-function: var(--fa-animation-timing, ease-in-out);
}

.fa-bounce {
  animation-name: fa-bounce;
  animation-delay: var(--fa-animation-delay, 0s);
  animation-direction: var(--fa-animation-direction, normal);
  animation-duration: var(--fa-animation-duration, 1s);
  animation-iteration-count: var(--fa-animation-iteration-count, infinite);
  animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.28, 0.84, 0.42, 1));
}

.fa-fade {
  animation-name: fa-fade;
  animation-delay: var(--fa-animation-delay, 0s);
  animation-direction: var(--fa-animation-direction, normal);
  animation-duration: var(--fa-animation-duration, 1s);
  animation-iteration-count: var(--fa-animation-iteration-count, infinite);
  animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1));
}

.fa-beat-fade {
  animation-name: fa-beat-fade;
  animation-delay: var(--fa-animation-delay, 0s);
  animation-direction: var(--fa-animation-direction, normal);
  animation-duration: var(--fa-animation-duration, 1s);
  animation-iteration-count: var(--fa-animation-iteration-count, infinite);
  animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1));
}

.fa-flip {
  animation-name: fa-flip;
  animation-delay: var(--fa-animation-delay, 0s);
  animation-direction: var(--fa-animation-direction, normal);
  animation-duration: var(--fa-animation-duration, 1s);
  animation-iteration-count: var(--fa-animation-iteration-count, infinite);
  animation-timing-function: var(--fa-animation-timing, ease-in-out);
}

.fa-shake {
  animation-name: fa-shake;
  animation-delay: var(--fa-animation-delay, 0s);
  animation-direction: var(--fa-animation-direction, normal);
  animation-duration: var(--fa-animation-duration, 1s);
  animation-iteration-count: var(--fa-animation-iteration-count, infinite);
  animation-timing-function: var(--fa-animation-timing, linear);
}

.fa-spin {
  animation-name: fa-spin;
  animation-delay: var(--fa-animation-delay, 0s);
  animation-direction: var(--fa-animation-direction, normal);
  animation-duration: var(--fa-animation-duration, 2s);
  animation-iteration-count: var(--fa-animation-iteration-count, infinite);
  animation-timing-function: var(--fa-animation-timing, linear);
}

.fa-spin-reverse {
  --fa-animation-direction: reverse;
}

.fa-pulse,
.fa-spin-pulse {
  animation-name: fa-spin;
  animation-direction: var(--fa-animation-direction, normal);
  animation-duration: var(--fa-animation-duration, 1s);
  animation-iteration-count: var(--fa-animation-iteration-count, infinite);
  animation-timing-function: var(--fa-animation-timing, steps(8));
}

@media (prefers-reduced-motion: reduce) {
  .fa-beat,
  .fa-bounce,
  .fa-fade,
  .fa-beat-fade,
  .fa-flip,
  .fa-pulse,
  .fa-shake,
  .fa-spin,
  .fa-spin-pulse {
    animation: none !important;
    transition: none !important;
  }
}
@keyframes fa-beat {
  0%, 90% {
    transform: scale(1);
  }
  45% {
    transform: scale(var(--fa-beat-scale, 1.25));
  }
}
@keyframes fa-bounce {
  0% {
    transform: scale(1, 1) translateY(0);
  }
  10% {
    transform: scale(var(--fa-bounce-start-scale-x, 1.1), var(--fa-bounce-start-scale-y, 0.9)) translateY(0);
  }
  30% {
    transform: scale(var(--fa-bounce-jump-scale-x, 0.9), var(--fa-bounce-jump-scale-y, 1.1)) translateY(var(--fa-bounce-height, -0.5em));
  }
  50% {
    transform: scale(var(--fa-bounce-land-scale-x, 1.05), var(--fa-bounce-land-scale-y, 0.95)) translateY(0);
  }
  57% {
    transform: scale(1, 1) translateY(var(--fa-bounce-rebound, -0.125em));
  }
  64% {
    transform: scale(1, 1) translateY(0);
  }
  100% {
    transform: scale(1, 1) translateY(0);
  }
}
@keyframes fa-fade {
  50% {
    opacity: var(--fa-fade-opacity, 0.4);
  }
}
@keyframes fa-beat-fade {
  0%, 100% {
    opacity: var(--fa-beat-fade-opacity, 0.4);
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(var(--fa-beat-fade-scale, 1.125));
  }
}
@keyframes fa-flip {
  50% {
    transform: rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), var(--fa-flip-angle, -180deg));
  }
}
@keyframes fa-shake {
  0% {
    transform: rotate(-15deg);
  }
  4% {
    transform: rotate(15deg);
  }
  8%, 24% {
    transform: rotate(-18deg);
  }
  12%, 28% {
    transform: rotate(18deg);
  }
  16% {
    transform: rotate(-22deg);
  }
  20% {
    transform: rotate(22deg);
  }
  32% {
    transform: rotate(-12deg);
  }
  36% {
    transform: rotate(12deg);
  }
  40%, 100% {
    transform: rotate(0deg);
  }
}
@keyframes fa-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
.fa-rotate-90 {
  transform: rotate(90deg);
}

.fa-rotate-180 {
  transform: rotate(180deg);
}

.fa-rotate-270 {
  transform: rotate(270deg);
}

.fa-flip-horizontal {
  transform: scale(-1, 1);
}

.fa-flip-vertical {
  transform: scale(1, -1);
}

.fa-flip-both,
.fa-flip-horizontal.fa-flip-vertical {
  transform: scale(-1, -1);
}

.fa-rotate-by {
  transform: rotate(var(--fa-rotate-angle, 0));
}

.svg-inline--fa .fa-primary {
  fill: var(--fa-primary-color, currentColor);
  opacity: var(--fa-primary-opacity, 1);
}

.svg-inline--fa .fa-secondary {
  fill: var(--fa-secondary-color, currentColor);
  opacity: var(--fa-secondary-opacity, 0.4);
}

.svg-inline--fa.fa-swap-opacity .fa-primary {
  opacity: var(--fa-secondary-opacity, 0.4);
}

.svg-inline--fa.fa-swap-opacity .fa-secondary {
  opacity: var(--fa-primary-opacity, 1);
}

.svg-inline--fa mask .fa-primary,
.svg-inline--fa mask .fa-secondary {
  fill: black;
}

.svg-inline--fa.fa-inverse {
  fill: var(--fa-inverse, #fff);
}

.fa-stack {
  display: inline-block;
  height: 2em;
  line-height: 2em;
  position: relative;
  vertical-align: middle;
  width: 2.5em;
}

.fa-inverse {
  color: var(--fa-inverse, #fff);
}

.svg-inline--fa.fa-stack-1x {
  --fa-width: 1.25em;
  height: 1em;
  width: var(--fa-width);
}
.svg-inline--fa.fa-stack-2x {
  --fa-width: 2.5em;
  height: 2em;
  width: var(--fa-width);
}

.fa-stack-1x,
.fa-stack-2x {
  inset: 0;
  margin: auto;
  position: absolute;
  z-index: var(--fa-stack-z-index, auto);
}`;function ZF(){var t=HF,e=GF,r=qt.cssPrefix,n=qt.replacementClass,a=fse;if(r!==t||n!==e){var i=new RegExp("\\.".concat(t,"\\-"),"g"),o=new RegExp("\\--".concat(t,"\\-"),"g"),c=new RegExp("\\.".concat(e),"g");a=a.replace(i,".".concat(r,"-")).replace(o,"--".concat(r,"-")).replace(c,".".concat(n))}return a}var yI=!1;function HS(){qt.autoAddCss&&!yI&&(ose(ZF()),yI=!0)}var pse={mixout:function(){return{dom:{css:ZF,insertCss:HS}}},hooks:function(){return{beforeDOMElementCreation:function(){HS()},beforeI2svg:function(){HS()}}}},$c=Zl||{};$c[zc]||($c[zc]={});$c[zc].styles||($c[zc].styles={});$c[zc].hooks||($c[zc].hooks={});$c[zc].shims||($c[zc].shims=[]);var Gs=$c[zc],e5=[],t5=function(){vn.removeEventListener("DOMContentLoaded",t5),eb=1,e5.map(function(e){return e()})},eb=!1;Kc&&(eb=(vn.documentElement.doScroll?/^loaded|^c/:/^loaded|^i|^c/).test(vn.readyState),eb||vn.addEventListener("DOMContentLoaded",t5));function hse(t){Kc&&(eb?setTimeout(t,0):e5.push(t))}function qg(t){var e=t.tag,r=t.attributes,n=r===void 0?{}:r,a=t.children,i=a===void 0?[]:a;return typeof t=="string"?QF(t):"<".concat(e," ").concat(lse(n),">").concat(i.map(qg).join(""),"</").concat(e,">")}function vI(t,e,r){if(t&&t[e]&&t[e][r])return{prefix:e,iconName:r,icon:t[e][r]}}var GS=function(e,r,n,a){var i=Object.keys(e),o=i.length,c=r,u,d,f;for(n===void 0?(u=1,f=e[i[0]]):(u=0,f=n);u<o;u++)d=i[u],f=c(f,e[d],d,e);return f};function r5(t){return Zs(t).length!==1?null:t.codePointAt(0).toString(16)}function _I(t){return Object.keys(t).reduce(function(e,r){var n=t[r],a=!!n.icon;return a?e[n.iconName]=n.icon:e[r]=n,e},{})}function HT(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=r.skipHooks,a=n===void 0?!1:n,i=_I(e);typeof Gs.hooks.addPack=="function"&&!a?Gs.hooks.addPack(t,_I(e)):Gs.styles[t]=ut(ut({},Gs.styles[t]||{}),i),t==="fas"&&HT("fa",e)}var zm=Gs.styles,mse=Gs.shims,n5=Object.keys(TP),gse=n5.reduce(function(t,e){return t[e]=Object.keys(TP[e]),t},{}),PP=null,a5={},i5={},s5={},o5={},c5={};function yse(t){return~rse.indexOf(t)}function vse(t,e){var r=e.split("-"),n=r[0],a=r.slice(1).join("-");return n===t&&a!==""&&!yse(a)?a:null}var l5=function(){var e=function(i){return GS(zm,function(o,c,u){return o[u]=GS(c,i,{}),o},{})};a5=e(function(a,i,o){if(i[3]&&(a[i[3]]=o),i[2]){var c=i[2].filter(function(u){return typeof u=="number"});c.forEach(function(u){a[u.toString(16)]=o})}return a}),i5=e(function(a,i,o){if(a[o]=o,i[2]){var c=i[2].filter(function(u){return typeof u=="string"});c.forEach(function(u){a[u]=o})}return a}),c5=e(function(a,i,o){var c=i[2];return a[o]=o,c.forEach(function(u){a[u]=o}),a});var r="far"in zm||qt.autoFetchSvg,n=GS(mse,function(a,i){var o=i[0],c=i[1],u=i[2];return c==="far"&&!r&&(c="fas"),typeof o=="string"&&(a.names[o]={prefix:c,iconName:u}),typeof o=="number"&&(a.unicodes[o.toString(16)]={prefix:c,iconName:u}),a},{names:{},unicodes:{}});s5=n.names,o5=n.unicodes,PP=i0(qt.styleDefault,{family:qt.familyDefault})};sse(function(t){PP=i0(t.styleDefault,{family:qt.familyDefault})});l5();function AP(t,e){return(a5[t]||{})[e]}function _se(t,e){return(i5[t]||{})[e]}function Ku(t,e){return(c5[t]||{})[e]}function u5(t){return s5[t]||{prefix:null,iconName:null}}function bse(t){var e=o5[t],r=AP("fas",t);return e||(r?{prefix:"fas",iconName:r}:null)||{prefix:null,iconName:null}}function eu(){return PP}var d5=function(){return{prefix:null,iconName:null,rest:[]}};function kse(t){var e=xa,r=n5.reduce(function(n,a){return n[a]="".concat(qt.cssPrefix,"-").concat(a),n},{});return qF.forEach(function(n){(t.includes(r[n])||t.some(function(a){return gse[n].includes(a)}))&&(e=n)}),e}function i0(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=e.family,n=r===void 0?xa:r,a=Jie[n][t];if(n===Ug&&!t)return"fad";var i=mI[n][t]||mI[n][a],o=t in Gs.styles?t:null,c=i||o||null;return c}function wse(t){var e=[],r=null;return t.forEach(function(n){var a=vse(qt.cssPrefix,n);a?r=a:n&&e.push(n)}),{iconName:r,rest:e}}function bI(t){return t.sort().filter(function(e,r,n){return n.indexOf(e)===r})}var kI=$F.concat(zF);function s0(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=e.skipLookups,n=r===void 0?!1:r,a=null,i=bI(t.filter(function(_){return kI.includes(_)})),o=bI(t.filter(function(_){return!kI.includes(_)})),c=i.filter(function(_){return a=_,!xF.includes(_)}),u=n0(c,1),d=u[0],f=d===void 0?null:d,h=kse(i),m=ut(ut({},wse(o)),{},{prefix:i0(f,{family:h})});return ut(ut(ut({},m),Cse({values:t,family:h,styles:zm,config:qt,canonical:m,givenPrefix:a})),Sse(n,a,m))}function Sse(t,e,r){var n=r.prefix,a=r.iconName;if(t||!n||!a)return{prefix:n,iconName:a};var i=e==="fa"?u5(a):{},o=Ku(n,a);return a=i.iconName||o||a,n=i.prefix||n,n==="far"&&!zm.far&&zm.fas&&!qt.autoFetchSvg&&(n="fas"),{prefix:n,iconName:a}}var Ese=qF.filter(function(t){return t!==xa||t!==Ug}),Tse=Object.keys(UT).filter(function(t){return t!==xa}).map(function(t){return Object.keys(UT[t])}).flat();function Cse(t){var e=t.values,r=t.family,n=t.canonical,a=t.givenPrefix,i=a===void 0?"":a,o=t.styles,c=o===void 0?{}:o,u=t.config,d=u===void 0?{}:u,f=r===Ug,h=e.includes("fa-duotone")||e.includes("fad"),m=d.familyDefault==="duotone",_=n.prefix==="fad"||n.prefix==="fa-duotone";if(!f&&(h||m||_)&&(n.prefix="fad"),(e.includes("fa-brands")||e.includes("fab"))&&(n.prefix="fab"),!n.prefix&&Ese.includes(r)){var w=Object.keys(c).find(function(E){return Tse.includes(E)});if(w||d.autoFetchSvg){var b=Yae.get(r).defaultShortPrefixId;n.prefix=b,n.iconName=Ku(n.prefix,n.iconName)||n.iconName}}return(n.prefix==="fa"||i==="fa")&&(n.prefix=eu()||"fas"),n}var xse=(function(){function t(){bae(this,t),this.definitions={}}return wae(t,[{key:"add",value:function(){for(var r=this,n=arguments.length,a=new Array(n),i=0;i<n;i++)a[i]=arguments[i];var o=a.reduce(this._pullDefinitions,{});Object.keys(o).forEach(function(c){r.definitions[c]=ut(ut({},r.definitions[c]||{}),o[c]),HT(c,o[c]);var u=TP[xa][c];u&&HT(u,o[c]),l5()})}},{key:"reset",value:function(){this.definitions={}}},{key:"_pullDefinitions",value:function(r,n){var a=n.prefix&&n.iconName&&n.icon?{0:n}:n;return Object.keys(a).map(function(i){var o=a[i],c=o.prefix,u=o.iconName,d=o.icon,f=d[2];r[c]||(r[c]={}),f.length>0&&f.forEach(function(h){typeof h=="string"&&(r[c][h]=d)}),r[c][u]=d}),r}}])})(),wI=[],Ef={},Uf={},Pse=Object.keys(Uf);function Ase(t,e){var r=e.mixoutsTo;return wI=t,Ef={},Object.keys(Uf).forEach(function(n){Pse.indexOf(n)===-1&&delete Uf[n]}),wI.forEach(function(n){var a=n.mixout?n.mixout():{};if(Object.keys(a).forEach(function(o){typeof a[o]=="function"&&(r[o]=a[o]),Z_(a[o])==="object"&&Object.keys(a[o]).forEach(function(c){r[o]||(r[o]={}),r[o][c]=a[o][c]})}),n.hooks){var i=n.hooks();Object.keys(i).forEach(function(o){Ef[o]||(Ef[o]=[]),Ef[o].push(i[o])})}n.provides&&n.provides(Uf)}),r}function GT(t,e){for(var r=arguments.length,n=new Array(r>2?r-2:0),a=2;a<r;a++)n[a-2]=arguments[a];var i=Ef[t]||[];return i.forEach(function(o){e=o.apply(null,[e].concat(n))}),e}function dd(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];var a=Ef[t]||[];a.forEach(function(i){i.apply(null,r)})}function tu(){var t=arguments[0],e=Array.prototype.slice.call(arguments,1);return Uf[t]?Uf[t].apply(null,e):void 0}function WT(t){t.prefix==="fa"&&(t.prefix="fas");var e=t.iconName,r=t.prefix||eu();if(e)return e=Ku(r,e)||e,vI(f5.definitions,r,e)||vI(Gs.styles,r,e)}var f5=new xse,Rse=function(){qt.autoReplaceSvg=!1,qt.observeMutations=!1,dd("noAuto")},Dse={i2svg:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Kc?(dd("beforeI2svg",e),tu("pseudoElements2svg",e),tu("i2svg",e)):Promise.reject(new Error("Operation requires a DOM of some kind."))},watch:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=e.autoReplaceSvgRoot;qt.autoReplaceSvg===!1&&(qt.autoReplaceSvg=!0),qt.observeMutations=!0,hse(function(){Nse({autoReplaceSvgRoot:r}),dd("watch",e)})}},Ose={icon:function(e){if(e===null)return null;if(Z_(e)==="object"&&e.prefix&&e.iconName)return{prefix:e.prefix,iconName:Ku(e.prefix,e.iconName)||e.iconName};if(Array.isArray(e)&&e.length===2){var r=e[1].indexOf("fa-")===0?e[1].slice(3):e[1],n=i0(e[0]);return{prefix:n,iconName:Ku(n,r)||r}}if(typeof e=="string"&&(e.indexOf("".concat(qt.cssPrefix,"-"))>-1||e.match(Qie))){var a=s0(e.split(" "),{skipLookups:!0});return{prefix:a.prefix||eu(),iconName:Ku(a.prefix,a.iconName)||a.iconName}}if(typeof e=="string"){var i=eu();return{prefix:i,iconName:Ku(i,e)||e}}}},Fi={noAuto:Rse,config:qt,dom:Dse,parse:Ose,library:f5,findIconDefinition:WT,toHtml:qg},Nse=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=e.autoReplaceSvgRoot,n=r===void 0?vn:r;(Object.keys(Gs.styles).length>0||qt.autoFetchSvg)&&Kc&&qt.autoReplaceSvg&&Fi.dom.i2svg({node:n})};function o0(t,e){return Object.defineProperty(t,"abstract",{get:e}),Object.defineProperty(t,"html",{get:function(){return t.abstract.map(function(n){return qg(n)})}}),Object.defineProperty(t,"node",{get:function(){if(Kc){var n=vn.createElement("div");return n.innerHTML=t.html,n.children}}}),t}function Ise(t){var e=t.children,r=t.main,n=t.mask,a=t.attributes,i=t.styles,o=t.transform;if(xP(o)&&r.found&&!n.found){var c=r.width,u=r.height,d={x:c/u/2,y:.5};a.style=a0(ut(ut({},i),{},{"transform-origin":"".concat(d.x+o.x/16,"em ").concat(d.y+o.y/16,"em")}))}return[{tag:"svg",attributes:a,children:e}]}function Mse(t){var e=t.prefix,r=t.iconName,n=t.children,a=t.attributes,i=t.symbol,o=i===!0?"".concat(e,"-").concat(qt.cssPrefix,"-").concat(r):i;return[{tag:"svg",attributes:{style:"display: none;"},children:[{tag:"symbol",attributes:ut(ut({},a),{},{id:o}),children:n}]}]}function jse(t){var e=["aria-label","aria-labelledby","title","role"];return e.some(function(r){return r in t})}function RP(t){var e=t.icons,r=e.main,n=e.mask,a=t.prefix,i=t.iconName,o=t.transform,c=t.symbol,u=t.maskId,d=t.extra,f=t.watchable,h=f===void 0?!1:f,m=n.found?n:r,_=m.width,w=m.height,b=[qt.replacementClass,i?"".concat(qt.cssPrefix,"-").concat(i):""].filter(function(C){return d.classes.indexOf(C)===-1}).filter(function(C){return C!==""||!!C}).concat(d.classes).join(" "),E={children:[],attributes:ut(ut({},d.attributes),{},{"data-prefix":a,"data-icon":i,class:b,role:d.attributes.role||"img",viewBox:"0 0 ".concat(_," ").concat(w)})};!jse(d.attributes)&&!d.attributes["aria-hidden"]&&(E.attributes["aria-hidden"]="true"),h&&(E.attributes[ud]="");var T=ut(ut({},E),{},{prefix:a,iconName:i,main:r,mask:n,maskId:u,transform:o,symbol:c,styles:ut({},d.styles)}),D=n.found&&r.found?tu("generateAbstractMask",T)||{children:[],attributes:{}}:tu("generateAbstractIcon",T)||{children:[],attributes:{}},P=D.children,A=D.attributes;return T.children=P,T.attributes=A,c?Mse(T):Ise(T)}function SI(t){var e=t.content,r=t.width,n=t.height,a=t.transform,i=t.extra,o=t.watchable,c=o===void 0?!1:o,u=ut(ut({},i.attributes),{},{class:i.classes.join(" ")});c&&(u[ud]="");var d=ut({},i.styles);xP(a)&&(d.transform=dse({transform:a,width:r,height:n}),d["-webkit-transform"]=d.transform);var f=a0(d);f.length>0&&(u.style=f);var h=[];return h.push({tag:"span",attributes:u,children:[e]}),h}function Lse(t){var e=t.content,r=t.extra,n=ut(ut({},r.attributes),{},{class:r.classes.join(" ")}),a=a0(r.styles);a.length>0&&(n.style=a);var i=[];return i.push({tag:"span",attributes:n,children:[e]}),i}var WS=Gs.styles;function KT(t){var e=t[0],r=t[1],n=t.slice(4),a=n0(n,1),i=a[0],o=null;return Array.isArray(i)?o={tag:"g",attributes:{class:"".concat(qt.cssPrefix,"-").concat(VS.GROUP)},children:[{tag:"path",attributes:{class:"".concat(qt.cssPrefix,"-").concat(VS.SECONDARY),fill:"currentColor",d:i[0]}},{tag:"path",attributes:{class:"".concat(qt.cssPrefix,"-").concat(VS.PRIMARY),fill:"currentColor",d:i[1]}}]}:o={tag:"path",attributes:{fill:"currentColor",d:i}},{found:!0,width:e,height:r,icon:o}}var Bse={found:!1,width:512,height:512};function Use(t,e){!KF&&qt.showMissingIcons}function YT(t,e){var r=e;return e==="fa"&&qt.styleDefault!==null&&(e=eu()),new Promise(function(n,a){if(r==="fa"){var i=u5(t)||{};t=i.iconName||t,e=i.prefix||e}if(t&&e&&WS[e]&&WS[e][t]){var o=WS[e][t];return n(KT(o))}Use(t,e),n(ut(ut({},Bse),{},{icon:qt.showMissingIcons&&t?tu("missingIconAbstract")||{}:{}}))})}var EI=function(){},XT=qt.measurePerformance&&yv&&yv.mark&&yv.measure?yv:{mark:EI,measure:EI},Xh='FA "7.0.1"',Fse=function(e){return XT.mark("".concat(Xh," ").concat(e," begins")),function(){return p5(e)}},p5=function(e){XT.mark("".concat(Xh," ").concat(e," ends")),XT.measure("".concat(Xh," ").concat(e),"".concat(Xh," ").concat(e," begins"),"".concat(Xh," ").concat(e," ends"))},DP={begin:Fse,end:p5},r_=function(){};function TI(t){var e=t.getAttribute?t.getAttribute(ud):null;return typeof e=="string"}function qse(t){var e=t.getAttribute?t.getAttribute(SP):null,r=t.getAttribute?t.getAttribute(EP):null;return e&&r}function zse(t){return t&&t.classList&&t.classList.contains&&t.classList.contains(qt.replacementClass)}function $se(){if(qt.autoReplaceSvg===!0)return n_.replace;var t=n_[qt.autoReplaceSvg];return t||n_.replace}function Vse(t){return vn.createElementNS("http://www.w3.org/2000/svg",t)}function Hse(t){return vn.createElement(t)}function h5(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=e.ceFn,n=r===void 0?t.tag==="svg"?Vse:Hse:r;if(typeof t=="string")return vn.createTextNode(t);var a=n(t.tag);Object.keys(t.attributes||[]).forEach(function(o){a.setAttribute(o,t.attributes[o])});var i=t.children||[];return i.forEach(function(o){a.appendChild(h5(o,{ceFn:n}))}),a}function Gse(t){var e=" ".concat(t.outerHTML," ");return e="".concat(e,"Font Awesome fontawesome.com "),e}var n_={replace:function(e){var r=e[0];if(r.parentNode)if(e[1].forEach(function(a){r.parentNode.insertBefore(h5(a),r)}),r.getAttribute(ud)===null&&qt.keepOriginalSource){var n=vn.createComment(Gse(r));r.parentNode.replaceChild(n,r)}else r.remove()},nest:function(e){var r=e[0],n=e[1];if(~CP(r).indexOf(qt.replacementClass))return n_.replace(e);var a=new RegExp("".concat(qt.cssPrefix,"-.*"));if(delete n[0].attributes.id,n[0].attributes.class){var i=n[0].attributes.class.split(" ").reduce(function(c,u){return u===qt.replacementClass||u.match(a)?c.toSvg.push(u):c.toNode.push(u),c},{toNode:[],toSvg:[]});n[0].attributes.class=i.toSvg.join(" "),i.toNode.length===0?r.removeAttribute("class"):r.setAttribute("class",i.toNode.join(" "))}var o=n.map(function(c){return qg(c)}).join(`
`);r.setAttribute(ud,""),r.innerHTML=o}};function CI(t){t()}function m5(t,e){var r=typeof e=="function"?e:r_;if(t.length===0)r();else{var n=CI;qt.mutateApproach===Yie&&(n=Zl.requestAnimationFrame||CI),n(function(){var a=$se(),i=DP.begin("mutate");t.map(a),i(),r()})}}var OP=!1;function g5(){OP=!0}function JT(){OP=!1}var tb=null;function xI(t){if(dI&&qt.observeMutations){var e=t.treeCallback,r=e===void 0?r_:e,n=t.nodeCallback,a=n===void 0?r_:n,i=t.pseudoElementsCallback,o=i===void 0?r_:i,c=t.observeMutationsRoot,u=c===void 0?vn:c;tb=new dI(function(d){if(!OP){var f=eu();Dp(d).forEach(function(h){if(h.type==="childList"&&h.addedNodes.length>0&&!TI(h.addedNodes[0])&&(qt.searchPseudoElements&&o(h.target),r(h.target)),h.type==="attributes"&&h.target.parentNode&&qt.searchPseudoElements&&o([h.target],!0),h.type==="attributes"&&TI(h.target)&&~tse.indexOf(h.attributeName))if(h.attributeName==="class"&&qse(h.target)){var m=s0(CP(h.target)),_=m.prefix,w=m.iconName;h.target.setAttribute(SP,_||f),w&&h.target.setAttribute(EP,w)}else zse(h.target)&&a(h.target)})}}),Kc&&tb.observe(u,{childList:!0,attributes:!0,characterData:!0,subtree:!0})}}function Wse(){tb&&tb.disconnect()}function Kse(t){var e=t.getAttribute("style"),r=[];return e&&(r=e.split(";").reduce(function(n,a){var i=a.split(":"),o=i[0],c=i.slice(1);return o&&c.length>0&&(n[o]=c.join(":").trim()),n},{})),r}function Yse(t){var e=t.getAttribute("data-prefix"),r=t.getAttribute("data-icon"),n=t.innerText!==void 0?t.innerText.trim():"",a=s0(CP(t));return a.prefix||(a.prefix=eu()),e&&r&&(a.prefix=e,a.iconName=r),a.iconName&&a.prefix||(a.prefix&&n.length>0&&(a.iconName=_se(a.prefix,t.innerText)||AP(a.prefix,r5(t.innerText))),!a.iconName&&qt.autoFetchSvg&&t.firstChild&&t.firstChild.nodeType===Node.TEXT_NODE&&(a.iconName=t.firstChild.data)),a}function Xse(t){var e=Dp(t.attributes).reduce(function(r,n){return r.name!=="class"&&r.name!=="style"&&(r[n.name]=n.value),r},{});return e}function Jse(){return{iconName:null,prefix:null,transform:Lo,symbol:!1,mask:{iconName:null,prefix:null,rest:[]},maskId:null,extra:{classes:[],styles:{},attributes:{}}}}function PI(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{styleParser:!0},r=Yse(t),n=r.iconName,a=r.prefix,i=r.rest,o=Xse(t),c=GT("parseNodeAttributes",{},t),u=e.styleParser?Kse(t):[];return ut({iconName:n,prefix:a,transform:Lo,mask:{iconName:null,prefix:null,rest:[]},maskId:null,symbol:!1,extra:{classes:i,styles:u,attributes:o}},c)}var Qse=Gs.styles;function y5(t){var e=qt.autoReplaceSvg==="nest"?PI(t,{styleParser:!1}):PI(t);return~e.extra.classes.indexOf(XF)?tu("generateLayersText",t,e):tu("generateSvgReplacementMutation",t,e)}function Zse(){return[].concat(Zs(zF),Zs($F))}function AI(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(!Kc)return Promise.resolve();var r=vn.documentElement.classList,n=function(h){return r.add("".concat(hI,"-").concat(h))},a=function(h){return r.remove("".concat(hI,"-").concat(h))},i=qt.autoFetchSvg?Zse():xF.concat(Object.keys(Qse));i.includes("fa")||i.push("fa");var o=[".".concat(XF,":not([").concat(ud,"])")].concat(i.map(function(f){return".".concat(f,":not([").concat(ud,"])")})).join(", ");if(o.length===0)return Promise.resolve();var c=[];try{c=Dp(t.querySelectorAll(o))}catch{}if(c.length>0)n("pending"),a("complete");else return Promise.resolve();var u=DP.begin("onTree"),d=c.reduce(function(f,h){try{var m=y5(h);m&&f.push(m)}catch(_){KF||_.name}return f},[]);return new Promise(function(f,h){Promise.all(d).then(function(m){m5(m,function(){n("active"),n("complete"),a("pending"),typeof e=="function"&&e(),u(),f()})}).catch(function(m){u(),h(m)})})}function eoe(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;y5(t).then(function(r){r&&m5([r],e)})}function toe(t){return function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=(e||{}).icon?e:WT(e||{}),a=r.mask;return a&&(a=(a||{}).icon?a:WT(a||{})),t(n,ut(ut({},r),{},{mask:a}))}}var roe=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=r.transform,a=n===void 0?Lo:n,i=r.symbol,o=i===void 0?!1:i,c=r.mask,u=c===void 0?null:c,d=r.maskId,f=d===void 0?null:d,h=r.classes,m=h===void 0?[]:h,_=r.attributes,w=_===void 0?{}:_,b=r.styles,E=b===void 0?{}:b;if(e){var T=e.prefix,D=e.iconName,P=e.icon;return o0(ut({type:"icon"},e),function(){return dd("beforeDOMElementCreation",{iconDefinition:e,params:r}),RP({icons:{main:KT(P),mask:u?KT(u.icon):{found:!1,width:null,height:null,icon:{}}},prefix:T,iconName:D,transform:ut(ut({},Lo),a),symbol:o,maskId:f,extra:{attributes:w,styles:E,classes:m}})})}},noe={mixout:function(){return{icon:toe(roe)}},hooks:function(){return{mutationObserverCallbacks:function(r){return r.treeCallback=AI,r.nodeCallback=eoe,r}}},provides:function(e){e.i2svg=function(r){var n=r.node,a=n===void 0?vn:n,i=r.callback,o=i===void 0?function(){}:i;return AI(a,o)},e.generateSvgReplacementMutation=function(r,n){var a=n.iconName,i=n.prefix,o=n.transform,c=n.symbol,u=n.mask,d=n.maskId,f=n.extra;return new Promise(function(h,m){Promise.all([YT(a,i),u.iconName?YT(u.iconName,u.prefix):Promise.resolve({found:!1,width:512,height:512,icon:{}})]).then(function(_){var w=n0(_,2),b=w[0],E=w[1];h([r,RP({icons:{main:b,mask:E},prefix:i,iconName:a,transform:o,symbol:c,maskId:d,extra:f,watchable:!0})])}).catch(m)})},e.generateAbstractIcon=function(r){var n=r.children,a=r.attributes,i=r.main,o=r.transform,c=r.styles,u=a0(c);u.length>0&&(a.style=u);var d;return xP(o)&&(d=tu("generateAbstractTransformGrouping",{main:i,transform:o,containerWidth:i.width,iconWidth:i.width})),n.push(d||i.icon),{children:n,attributes:a}}}},aoe={mixout:function(){return{layer:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=n.classes,i=a===void 0?[]:a;return o0({type:"layer"},function(){dd("beforeDOMElementCreation",{assembler:r,params:n});var o=[];return r(function(c){Array.isArray(c)?c.map(function(u){o=o.concat(u.abstract)}):o=o.concat(c.abstract)}),[{tag:"span",attributes:{class:["".concat(qt.cssPrefix,"-layers")].concat(Zs(i)).join(" ")},children:o}]})}}}},ioe={mixout:function(){return{counter:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};n.title;var a=n.classes,i=a===void 0?[]:a,o=n.attributes,c=o===void 0?{}:o,u=n.styles,d=u===void 0?{}:u;return o0({type:"counter",content:r},function(){return dd("beforeDOMElementCreation",{content:r,params:n}),Lse({content:r.toString(),extra:{attributes:c,styles:d,classes:["".concat(qt.cssPrefix,"-layers-counter")].concat(Zs(i))}})})}}}},soe={mixout:function(){return{text:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=n.transform,i=a===void 0?Lo:a,o=n.classes,c=o===void 0?[]:o,u=n.attributes,d=u===void 0?{}:u,f=n.styles,h=f===void 0?{}:f;return o0({type:"text",content:r},function(){return dd("beforeDOMElementCreation",{content:r,params:n}),SI({content:r,transform:ut(ut({},Lo),i),extra:{attributes:d,styles:h,classes:["".concat(qt.cssPrefix,"-layers-text")].concat(Zs(c))}})})}}},provides:function(e){e.generateLayersText=function(r,n){var a=n.transform,i=n.extra,o=null,c=null;if(TF){var u=parseInt(getComputedStyle(r).fontSize,10),d=r.getBoundingClientRect();o=d.width/u,c=d.height/u}return Promise.resolve([r,SI({content:r.innerHTML,width:o,height:c,transform:a,extra:i,watchable:!0})])}}},v5=new RegExp('"',"ug"),RI=[1105920,1112319],DI=ut(ut(ut(ut({},{FontAwesome:{normal:"fas",400:"fas"}}),Kae),Wie),nie),QT=Object.keys(DI).reduce(function(t,e){return t[e.toLowerCase()]=DI[e],t},{}),ooe=Object.keys(QT).reduce(function(t,e){var r=QT[e];return t[e]=r[900]||Zs(Object.entries(r))[0][1],t},{});function coe(t){var e=t.replace(v5,"");return r5(Zs(e)[0]||"")}function loe(t){var e=t.getPropertyValue("font-feature-settings").includes("ss01"),r=t.getPropertyValue("content"),n=r.replace(v5,""),a=n.codePointAt(0),i=a>=RI[0]&&a<=RI[1],o=n.length===2?n[0]===n[1]:!1;return i||o||e}function uoe(t,e){var r=t.replace(/^['"]|['"]$/g,"").toLowerCase(),n=parseInt(e),a=isNaN(n)?"normal":n;return(QT[r]||{})[a]||ooe[r]}function OI(t,e){var r="".concat(Kie).concat(e.replace(":","-"));return new Promise(function(n,a){if(t.getAttribute(r)!==null)return n();var i=Dp(t.children),o=i.filter(function(O){return O.getAttribute(qT)===e})[0],c=Zl.getComputedStyle(t,e),u=c.getPropertyValue("font-family"),d=u.match(Zie),f=c.getPropertyValue("font-weight"),h=c.getPropertyValue("content");if(o&&!d)return t.removeChild(o),n();if(d&&h!=="none"&&h!==""){var m=c.getPropertyValue("content"),_=uoe(u,f),w=coe(m),b=d[0].startsWith("FontAwesome"),E=loe(c),T=AP(_,w),D=T;if(b){var P=bse(w);P.iconName&&P.prefix&&(T=P.iconName,_=P.prefix)}if(T&&!E&&(!o||o.getAttribute(SP)!==_||o.getAttribute(EP)!==D)){t.setAttribute(r,D),o&&t.removeChild(o);var A=Jse(),C=A.extra;C.attributes[qT]=e,YT(T,_).then(function(O){var I=RP(ut(ut({},A),{},{icons:{main:O,mask:d5()},prefix:_,iconName:D,extra:C,watchable:!0})),x=vn.createElementNS("http://www.w3.org/2000/svg","svg");e==="::before"?t.insertBefore(x,t.firstChild):t.appendChild(x),x.outerHTML=I.map(function(R){return qg(R)}).join(`
`),t.removeAttribute(r),n()}).catch(a)}else n()}else n()})}function doe(t){return Promise.all([OI(t,"::before"),OI(t,"::after")])}function foe(t){return t.parentNode!==document.head&&!~Xie.indexOf(t.tagName.toUpperCase())&&!t.getAttribute(qT)&&(!t.parentNode||t.parentNode.tagName!=="svg")}var poe=function(e){return!!e&&WF.some(function(r){return e.includes(r)})},hoe=function(e){if(!e)return[];var r=new Set,n=e.split(/,(?![^()]*\))/).map(function(u){return u.trim()});n=n.flatMap(function(u){return u.includes("(")?u:u.split(",").map(function(d){return d.trim()})});var a=t_(n),i;try{for(a.s();!(i=a.n()).done;){var o=i.value;if(poe(o)){var c=WF.reduce(function(u,d){return u.replace(d,"")},o);c!==""&&c!=="*"&&r.add(c)}}}catch(u){a.e(u)}finally{a.f()}return r};function NI(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(Kc){var r;if(e)r=t;else if(qt.searchPseudoElementsFullScan)r=t.querySelectorAll("*");else{var n=new Set,a=t_(document.styleSheets),i;try{for(a.s();!(i=a.n()).done;){var o=i.value;try{var c=t_(o.cssRules),u;try{for(c.s();!(u=c.n()).done;){var d=u.value,f=hoe(d.selectorText),h=t_(f),m;try{for(h.s();!(m=h.n()).done;){var _=m.value;n.add(_)}}catch(b){h.e(b)}finally{h.f()}}}catch(b){c.e(b)}finally{c.f()}}catch{qt.searchPseudoElementsWarnings}}}catch(b){a.e(b)}finally{a.f()}if(!n.size)return;var w=Array.from(n).join(", ");try{r=t.querySelectorAll(w)}catch{}}return new Promise(function(b,E){var T=Dp(r).filter(foe).map(doe),D=DP.begin("searchPseudoElements");g5(),Promise.all(T).then(function(){D(),JT(),b()}).catch(function(){D(),JT(),E()})})}}var moe={hooks:function(){return{mutationObserverCallbacks:function(r){return r.pseudoElementsCallback=NI,r}}},provides:function(e){e.pseudoElements2svg=function(r){var n=r.node,a=n===void 0?vn:n;qt.searchPseudoElements&&NI(a)}}},II=!1,goe={mixout:function(){return{dom:{unwatch:function(){g5(),II=!0}}}},hooks:function(){return{bootstrap:function(){xI(GT("mutationObserverCallbacks",{}))},noAuto:function(){Wse()},watch:function(r){var n=r.observeMutationsRoot;II?JT():xI(GT("mutationObserverCallbacks",{observeMutationsRoot:n}))}}}},MI=function(e){var r={size:16,x:0,y:0,flipX:!1,flipY:!1,rotate:0};return e.toLowerCase().split(" ").reduce(function(n,a){var i=a.toLowerCase().split("-"),o=i[0],c=i.slice(1).join("-");if(o&&c==="h")return n.flipX=!0,n;if(o&&c==="v")return n.flipY=!0,n;if(c=parseFloat(c),isNaN(c))return n;switch(o){case"grow":n.size=n.size+c;break;case"shrink":n.size=n.size-c;break;case"left":n.x=n.x-c;break;case"right":n.x=n.x+c;break;case"up":n.y=n.y-c;break;case"down":n.y=n.y+c;break;case"rotate":n.rotate=n.rotate+c;break}return n},r)},yoe={mixout:function(){return{parse:{transform:function(r){return MI(r)}}}},hooks:function(){return{parseNodeAttributes:function(r,n){var a=n.getAttribute("data-fa-transform");return a&&(r.transform=MI(a)),r}}},provides:function(e){e.generateAbstractTransformGrouping=function(r){var n=r.main,a=r.transform,i=r.containerWidth,o=r.iconWidth,c={transform:"translate(".concat(i/2," 256)")},u="translate(".concat(a.x*32,", ").concat(a.y*32,") "),d="scale(".concat(a.size/16*(a.flipX?-1:1),", ").concat(a.size/16*(a.flipY?-1:1),") "),f="rotate(".concat(a.rotate," 0 0)"),h={transform:"".concat(u," ").concat(d," ").concat(f)},m={transform:"translate(".concat(o/2*-1," -256)")},_={outer:c,inner:h,path:m};return{tag:"g",attributes:ut({},_.outer),children:[{tag:"g",attributes:ut({},_.inner),children:[{tag:n.icon.tag,children:n.icon.children,attributes:ut(ut({},n.icon.attributes),_.path)}]}]}}}},KS={x:0,y:0,width:"100%",height:"100%"};function jI(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return t.attributes&&(t.attributes.fill||e)&&(t.attributes.fill="black"),t}function voe(t){return t.tag==="g"?t.children:[t]}var _oe={hooks:function(){return{parseNodeAttributes:function(r,n){var a=n.getAttribute("data-fa-mask"),i=a?s0(a.split(" ").map(function(o){return o.trim()})):d5();return i.prefix||(i.prefix=eu()),r.mask=i,r.maskId=n.getAttribute("data-fa-mask-id"),r}}},provides:function(e){e.generateAbstractMask=function(r){var n=r.children,a=r.attributes,i=r.main,o=r.mask,c=r.maskId,u=r.transform,d=i.width,f=i.icon,h=o.width,m=o.icon,_=use({transform:u,containerWidth:h,iconWidth:d}),w={tag:"rect",attributes:ut(ut({},KS),{},{fill:"white"})},b=f.children?{children:f.children.map(jI)}:{},E={tag:"g",attributes:ut({},_.inner),children:[jI(ut({tag:f.tag,attributes:ut(ut({},f.attributes),_.path)},b))]},T={tag:"g",attributes:ut({},_.outer),children:[E]},D="mask-".concat(c||gI()),P="clip-".concat(c||gI()),A={tag:"mask",attributes:ut(ut({},KS),{},{id:D,maskUnits:"userSpaceOnUse",maskContentUnits:"userSpaceOnUse"}),children:[w,T]},C={tag:"defs",children:[{tag:"clipPath",attributes:{id:P},children:voe(m)},A]};return n.push(C,{tag:"rect",attributes:ut({fill:"currentColor","clip-path":"url(#".concat(P,")"),mask:"url(#".concat(D,")")},KS)}),{children:n,attributes:a}}}},boe={provides:function(e){var r=!1;Zl.matchMedia&&(r=Zl.matchMedia("(prefers-reduced-motion: reduce)").matches),e.missingIconAbstract=function(){var n=[],a={fill:"currentColor"},i={attributeType:"XML",repeatCount:"indefinite",dur:"2s"};n.push({tag:"path",attributes:ut(ut({},a),{},{d:"M156.5,447.7l-12.6,29.5c-18.7-9.5-35.9-21.2-51.5-34.9l22.7-22.7C127.6,430.5,141.5,440,156.5,447.7z M40.6,272H8.5 c1.4,21.2,5.4,41.7,11.7,61.1L50,321.2C45.1,305.5,41.8,289,40.6,272z M40.6,240c1.4-18.8,5.2-37,11.1-54.1l-29.5-12.6 C14.7,194.3,10,216.7,8.5,240H40.6z M64.3,156.5c7.8-14.9,17.2-28.8,28.1-41.5L69.7,92.3c-13.7,15.6-25.5,32.8-34.9,51.5 L64.3,156.5z M397,419.6c-13.9,12-29.4,22.3-46.1,30.4l11.9,29.8c20.7-9.9,39.8-22.6,56.9-37.6L397,419.6z M115,92.4 c13.9-12,29.4-22.3,46.1-30.4l-11.9-29.8c-20.7,9.9-39.8,22.6-56.8,37.6L115,92.4z M447.7,355.5c-7.8,14.9-17.2,28.8-28.1,41.5 l22.7,22.7c13.7-15.6,25.5-32.9,34.9-51.5L447.7,355.5z M471.4,272c-1.4,18.8-5.2,37-11.1,54.1l29.5,12.6 c7.5-21.1,12.2-43.5,13.6-66.8H471.4z M321.2,462c-15.7,5-32.2,8.2-49.2,9.4v32.1c21.2-1.4,41.7-5.4,61.1-11.7L321.2,462z M240,471.4c-18.8-1.4-37-5.2-54.1-11.1l-12.6,29.5c21.1,7.5,43.5,12.2,66.8,13.6V471.4z M462,190.8c5,15.7,8.2,32.2,9.4,49.2h32.1 c-1.4-21.2-5.4-41.7-11.7-61.1L462,190.8z M92.4,397c-12-13.9-22.3-29.4-30.4-46.1l-29.8,11.9c9.9,20.7,22.6,39.8,37.6,56.9 L92.4,397z M272,40.6c18.8,1.4,36.9,5.2,54.1,11.1l12.6-29.5C317.7,14.7,295.3,10,272,8.5V40.6z M190.8,50 c15.7-5,32.2-8.2,49.2-9.4V8.5c-21.2,1.4-41.7,5.4-61.1,11.7L190.8,50z M442.3,92.3L419.6,115c12,13.9,22.3,29.4,30.5,46.1 l29.8-11.9C470,128.5,457.3,109.4,442.3,92.3z M397,92.4l22.7-22.7c-15.6-13.7-32.8-25.5-51.5-34.9l-12.6,29.5 C370.4,72.1,384.4,81.5,397,92.4z"})});var o=ut(ut({},i),{},{attributeName:"opacity"}),c={tag:"circle",attributes:ut(ut({},a),{},{cx:"256",cy:"364",r:"28"}),children:[]};return r||c.children.push({tag:"animate",attributes:ut(ut({},i),{},{attributeName:"r",values:"28;14;28;28;14;28;"})},{tag:"animate",attributes:ut(ut({},o),{},{values:"1;0;1;1;0;1;"})}),n.push(c),n.push({tag:"path",attributes:ut(ut({},a),{},{opacity:"1",d:"M263.7,312h-16c-6.6,0-12-5.4-12-12c0-71,77.4-63.9,77.4-107.8c0-20-17.8-40.2-57.4-40.2c-29.1,0-44.3,9.6-59.2,28.7 c-3.9,5-11.1,6-16.2,2.4l-13.1-9.2c-5.6-3.9-6.9-11.8-2.6-17.2c21.2-27.2,46.4-44.7,91.2-44.7c52.3,0,97.4,29.8,97.4,80.2 c0,67.6-77.4,63.5-77.4,107.8C275.7,306.6,270.3,312,263.7,312z"}),children:r?[]:[{tag:"animate",attributes:ut(ut({},o),{},{values:"1;0;0;0;0;1;"})}]}),r||n.push({tag:"path",attributes:ut(ut({},a),{},{opacity:"0",d:"M232.5,134.5l7,168c0.3,6.4,5.6,11.5,12,11.5h9c6.4,0,11.7-5.1,12-11.5l7-168c0.3-6.8-5.2-12.5-12-12.5h-23 C237.7,122,232.2,127.7,232.5,134.5z"}),children:[{tag:"animate",attributes:ut(ut({},o),{},{values:"0;0;1;1;0;0;"})}]}),{tag:"g",attributes:{class:"missing"},children:n}}}},koe={hooks:function(){return{parseNodeAttributes:function(r,n){var a=n.getAttribute("data-fa-symbol"),i=a===null?!1:a===""?!0:a;return r.symbol=i,r}}}},woe=[pse,noe,aoe,ioe,soe,moe,goe,yoe,_oe,boe,koe];Ase(woe,{mixoutsTo:Fi});Fi.noAuto;Fi.config;Fi.library;Fi.dom;var ZT=Fi.parse;Fi.findIconDefinition;Fi.toHtml;var Soe=Fi.icon;Fi.layer;Fi.text;Fi.counter;var YS={exports:{}},XS,LI;function Eoe(){if(LI)return XS;LI=1;var t="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return XS=t,XS}var JS,BI;function Toe(){if(BI)return JS;BI=1;var t=Eoe();function e(){}function r(){}return r.resetWarningCache=e,JS=function(){function n(o,c,u,d,f,h){if(h!==t){var m=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw m.name="Invariant Violation",m}}n.isRequired=n;function a(){return n}var i={array:n,bigint:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:a,element:n,elementType:n,instanceOf:a,node:n,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:r,resetWarningCache:e};return i.PropTypes=i,i},JS}var UI;function Coe(){return UI||(UI=1,YS.exports=Toe()()),YS.exports}var xoe=Coe();const pr=Sg(xoe);var Poe={};function eC(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function Aoe(t){if(Array.isArray(t))return t}function Roe(t){if(Array.isArray(t))return eC(t)}function Rl(t,e,r){return(e=Boe(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Doe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Ooe(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,a,i,o,c=[],u=!0,d=!1;try{if(i=(r=r.call(t)).next,e!==0)for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(f){d=!0,a=f}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw a}}return c}}function Noe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ioe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function FI(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function No(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?FI(Object(r),!0).forEach(function(n){Rl(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):FI(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Moe(t,e){if(t==null)return{};var r,n,a=joe(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)===-1&&{}.propertyIsEnumerable.call(t,r)&&(a[r]=t[r])}return a}function joe(t,e){if(t==null)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.indexOf(n)!==-1)continue;r[n]=t[n]}return r}function qI(t,e){return Aoe(t)||Ooe(t,e)||_5(t,e)||Noe()}function tC(t){return Roe(t)||Doe(t)||_5(t)||Ioe()}function Loe(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Boe(t){var e=Loe(t,"string");return typeof e=="symbol"?e:e+""}function rb(t){"@babel/helpers - typeof";return rb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},rb(t)}function _5(t,e){if(t){if(typeof t=="string")return eC(t,e);var r={}.toString.call(t).slice(8,-1);return r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set"?Array.from(t):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?eC(t,e):void 0}}var Uoe="7.0.0",rC;try{var Foe=require("@fortawesome/fontawesome-svg-core/package.json");rC=Foe.version}catch{rC=typeof process<"u"&&Poe.FA_VERSION||"7.0.0"}function qoe(t){var e=t.beat,r=t.fade,n=t.beatFade,a=t.bounce,i=t.shake,o=t.flash,c=t.spin,u=t.spinPulse,d=t.spinReverse,f=t.pulse,h=t.fixedWidth,m=t.inverse,_=t.border,w=t.listItem,b=t.flip,E=t.size,T=t.rotation,D=t.pull,P=t.swapOpacity,A=t.rotateBy,C=t.widthAuto,O=zoe(rC,Uoe),I=Rl(Rl(Rl(Rl(Rl(Rl({"fa-beat":e,"fa-fade":r,"fa-beat-fade":n,"fa-bounce":a,"fa-shake":i,"fa-flash":o,"fa-spin":c,"fa-spin-reverse":d,"fa-spin-pulse":u,"fa-pulse":f,"fa-fw":h,"fa-inverse":m,"fa-border":_,"fa-li":w,"fa-flip":b===!0,"fa-flip-horizontal":b==="horizontal"||b==="both","fa-flip-vertical":b==="vertical"||b==="both"},"fa-".concat(E),typeof E<"u"&&E!==null),"fa-rotate-".concat(T),typeof T<"u"&&T!==null&&T!==0),"fa-pull-".concat(D),typeof D<"u"&&D!==null),"fa-swap-opacity",P),"fa-rotate-by",O&&A),"fa-width-auto",O&&C);return Object.keys(I).map(function(x){return I[x]?x:null}).filter(function(x){return x})}function zoe(t,e){for(var r=t.split("-"),n=qI(r,2),a=n[0],i=n[1],o=e.split("-"),c=qI(o,2),u=c[0],d=c[1],f=a.split("."),h=u.split("."),m=0;m<Math.max(f.length,h.length);m++){var _=f[m]||"0",w=h[m]||"0",b=parseInt(_,10),E=parseInt(w,10);if(b!==E)return b>E}for(var T=0;T<Math.max(f.length,h.length);T++){var D=f[T]||"0",P=h[T]||"0";if(D!==P&&D.length!==P.length)return D.length<P.length}return!(i&&!d)}function $oe(t){return t=t-0,t===t}function b5(t){return $oe(t)?t:(t=t.replace(/[\-_\s]+(.)?/g,function(e,r){return r?r.toUpperCase():""}),t.substr(0,1).toLowerCase()+t.substr(1))}var Voe=["style"];function Hoe(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Goe(t){return t.split(";").map(function(e){return e.trim()}).filter(function(e){return e}).reduce(function(e,r){var n=r.indexOf(":"),a=b5(r.slice(0,n)),i=r.slice(n+1).trim();return a.startsWith("webkit")?e[Hoe(a)]=i:e[a]=i,e},{})}function k5(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(typeof e=="string")return e;var n=(e.children||[]).map(function(u){return k5(t,u)}),a=Object.keys(e.attributes||{}).reduce(function(u,d){var f=e.attributes[d];switch(d){case"class":u.attrs.className=f,delete e.attributes.class;break;case"style":u.attrs.style=Goe(f);break;default:d.indexOf("aria-")===0||d.indexOf("data-")===0?u.attrs[d.toLowerCase()]=f:u.attrs[b5(d)]=f}return u},{attrs:{}}),i=r.style,o=i===void 0?{}:i,c=Moe(r,Voe);return a.attrs.style=No(No({},a.attrs.style),o),t.apply(void 0,[e.tag,No(No({},a.attrs),c)].concat(tC(n)))}var w5=!1;try{w5=!0}catch{}function Woe(){if(!w5&&console&&typeof console.error=="function"){var t;(t=console).error.apply(t,arguments)}}function zI(t){if(t&&rb(t)==="object"&&t.prefix&&t.iconName&&t.icon)return t;if(ZT.icon)return ZT.icon(t);if(t===null)return null;if(t&&rb(t)==="object"&&t.prefix&&t.iconName)return t;if(Array.isArray(t)&&t.length===2)return{prefix:t[0],iconName:t[1]};if(typeof t=="string")return{prefix:"fas",iconName:t}}function QS(t,e){return Array.isArray(e)&&e.length>0||!Array.isArray(e)&&e?Rl({},t,e):{}}var $I={border:!1,className:"",mask:null,maskId:null,fixedWidth:!1,inverse:!1,flip:!1,icon:null,listItem:!1,pull:null,pulse:!1,rotation:null,rotateBy:!1,size:null,spin:!1,spinPulse:!1,spinReverse:!1,beat:!1,fade:!1,beatFade:!1,bounce:!1,shake:!1,symbol:!1,title:"",titleId:null,transform:null,swapOpacity:!1,widthAuto:!1},Ml=Tt.forwardRef(function(t,e){var r=No(No({},$I),t),n=r.icon,a=r.mask,i=r.symbol,o=r.className,c=r.title,u=r.titleId,d=r.maskId,f=zI(n),h=QS("classes",[].concat(tC(qoe(r)),tC((o||"").split(" ")))),m=QS("transform",typeof r.transform=="string"?ZT.transform(r.transform):r.transform),_=QS("mask",zI(a)),w=Soe(f,No(No(No(No({},h),m),_),{},{symbol:i,title:c,titleId:u,maskId:d}));if(!w)return Woe("Could not find icon",f),null;var b=w.abstract,E={ref:e};return Object.keys(r).forEach(function(T){$I.hasOwnProperty(T)||(E[T]=r[T])}),Koe(b[0],E)});Ml.displayName="FontAwesomeIcon";Ml.propTypes={beat:pr.bool,border:pr.bool,beatFade:pr.bool,bounce:pr.bool,className:pr.string,fade:pr.bool,flash:pr.bool,mask:pr.oneOfType([pr.object,pr.array,pr.string]),maskId:pr.string,fixedWidth:pr.bool,inverse:pr.bool,flip:pr.oneOf([!0,!1,"horizontal","vertical","both"]),icon:pr.oneOfType([pr.object,pr.array,pr.string]),listItem:pr.bool,pull:pr.oneOf(["right","left"]),pulse:pr.bool,rotation:pr.oneOf([0,90,180,270]),rotateBy:pr.bool,shake:pr.bool,size:pr.oneOf(["2xs","xs","sm","lg","xl","2xl","1x","2x","3x","4x","5x","6x","7x","8x","9x","10x"]),spin:pr.bool,spinPulse:pr.bool,spinReverse:pr.bool,symbol:pr.oneOfType([pr.bool,pr.string]),title:pr.string,titleId:pr.string,transform:pr.oneOfType([pr.string,pr.object]),swapOpacity:pr.bool,widthAuto:pr.bool};var Koe=k5.bind(null,Tt.createElement);/*!
 * Font Awesome Free 7.1.0 by @fontawesome - https://fontawesome.com
 * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
 * Copyright 2025 Fonticons, Inc.
 */var Yoe={prefix:"fab",iconName:"google",icon:[512,512,[],"f1a0","M500 261.8C500 403.3 403.1 504 260 504 122.8 504 12 393.2 12 256S122.8 8 260 8c66.8 0 123 24.5 166.3 64.9l-67.5 64.9c-88.3-85.2-252.5-21.2-252.5 118.2 0 86.5 69.1 156.6 153.7 156.6 98.2 0 135-70.4 140.8-106.9l-140.8 0 0-85.3 236.1 0c2.3 12.7 3.9 24.9 3.9 41.4z"]},Xoe={prefix:"fab",iconName:"apple",icon:[384,512,[],"f179","M319.1 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7-55.8 .9-115.1 44.5-115.1 133.2 0 26.2 4.8 53.3 14.4 81.2 12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zM262.5 104.5c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 49.9-11.4 69.5-34.3z"]};const VI=(()=>{try{return Gr.getPlatform()}catch{return"web"}})(),ZS=VI==="ios"||VI==="android",HI=Yoe,GI=Xoe;function Joe({initialStatus:t="idle"}){const[e,r]=v.useState(""),[n,a]=v.useState(""),[i,o]=v.useState(t),[c,u]=v.useState(null),[d,f]=v.useState(!1),[h,m]=v.useState(!1),[_,w]=v.useState(!0),[b,E]=v.useState(!1),T=v.useCallback(()=>E(!1),[]);v.useCallback(()=>E(!0),[]);const D=v.useRef(null),P=tn(),{refreshUser:A}=$r(),C=()=>setTimeout(()=>D.current?.focus(),60);v.useCallback(()=>{w(!0),C()},[]),v.useCallback(()=>{P("/how-to-play")},[P]);const O=v.useCallback(async()=>{try{await Bv("");const R=ci();await fetch(`${R}/api/auth/clear`,{method:"POST",credentials:"include"}).catch(()=>{})}catch{}try{const R=await YH();if(R.ok){try{R.token&&await Zf(R.token)}catch{}await A({force:!0}),P("/lobby",{replace:!0});return}}catch{}u("Guest mode is temporarily unavailable. Please sign in.")},[P,A]),I=async R=>{try{if(ZS){u("Use the Native Sign-in buttons inside the mobile app.");return}R==="google"?f(!0):m(!0),u(null);try{await Bv("");const N=ci();await fetch(`${N}/api/auth/clear`,{method:"POST",credentials:"include"}).catch(()=>{})}catch{}await KH(R)}catch(N){R==="google"?f(!1):m(!1),u(N?.message||"Web sign-in failed")}},x=async R=>{try{if(!ZS){u("Open the Android/iOS app to use Native Sign-in.");return}R==="google"?f(!0):m(!0),u(null);try{await Bv("");const U=ci();await fetch(`${U}/api/auth/clear`,{method:"POST",credentials:"include"}).catch(()=>{})}catch{}const N=R==="apple"?await P_.signInWithAppleNative():await P_.signInWithGoogleNative(),L=ci(),j=await fetch(`${L}/api/auth/oauth/mobile-verify`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({provider:N.provider,idToken:N.idToken,email:N.email,name:N.name})});if(!j.ok)throw new Error("Native verify failed");const q=await j.json();if(q?.ok&&q?.token){try{await Zf(q.token)}catch{}await A({force:!0}),P("/lobby",{replace:!0})}else throw new Error("No token")}catch(N){R==="google"?f(!1):m(!1),N?.message||String(N),u("Sign-in failed. Check your device account settings and try again.")}};return g.jsxs("main",{className:"landing-page",children:[g.jsx(ji,{className:"page-login"}),g.jsxs("header",{className:"lp-hero",children:[g.jsx("div",{className:"lp-hero__mask","aria-hidden":!0}),g.jsxs("div",{className:"lp-hero__content",children:[g.jsxs("div",{className:"lp-fairness-badge",children:["Provably Fair! ",g.jsx(bP,{state:"verified"})]}),g.jsx(hF,{}),g.jsxs("div",{id:"signup-form",className:["lp-signup",_||i==="sent"?"is-open":""].join(" "),children:[ZS?g.jsxs("div",{className:"lp-oauth","aria-label":"Native Sign-in (use inside the mobile app)",children:[g.jsx("button",{type:"button",className:"felt-btn lp-btn lp-btn--oauth lp-btn--google",onClick:()=>x("google"),disabled:d||h,"aria-label":"Continue with Google (Native)",style:{position:"relative"},children:g.jsxs(g.Fragment,{children:[g.jsx(Ml,{className:"lp-oauth__fa",icon:HI,"aria-hidden":!0}),g.jsx("span",{className:"lp-oauth__label",children:"Continue with Google"}),d&&g.jsx("span",{className:"lp-oauth__spinner","aria-label":"Loading"})]})}),g.jsx("button",{type:"button",className:"felt-btn lp-btn lp-btn--oauth lp-btn--apple",onClick:()=>x("apple"),disabled:d||h,"aria-label":"Continue with Apple (Native)",style:{position:"relative"},children:g.jsxs(g.Fragment,{children:[g.jsx(Ml,{className:"lp-oauth__fa",icon:GI,"aria-hidden":!0}),g.jsx("span",{className:"lp-oauth__label",children:"Continue with Apple"}),h&&g.jsx("span",{className:"lp-oauth__spinner","aria-label":"Loading"})]})}),g.jsx("div",{className:"lp-oauth__divider","aria-hidden":!0}),g.jsx("a",{role:"button",className:"gold-link",onClick:O,"aria-label":"Continue as Guest",children:"Continue as Guest"})]}):g.jsxs("div",{className:"lp-oauth","aria-label":"Web Sign-in (use in browser)",children:[g.jsx("button",{type:"button",className:"felt-btn lp-btn lp-btn--oauth lp-btn--google",onClick:()=>I("google"),disabled:d||h,"aria-label":"Continue with Google (Web)",style:{position:"relative"},children:g.jsxs(g.Fragment,{children:[g.jsx(Ml,{className:"lp-oauth__fa",icon:HI,"aria-hidden":!0}),g.jsx("span",{className:"lp-oauth__label",children:"Continue with Google"}),d&&g.jsx("span",{className:"lp-oauth__spinner","aria-label":"Loading"})]})}),g.jsx("button",{type:"button",className:"felt-btn lp-btn lp-btn--oauth lp-btn--apple",onClick:()=>I("apple"),disabled:d||h,"aria-label":"Continue with Apple (Web)",style:{position:"relative"},children:g.jsxs(g.Fragment,{children:[g.jsx(Ml,{className:"lp-oauth__fa",icon:GI,"aria-hidden":!0}),g.jsx("span",{className:"lp-oauth__label",children:"Continue with Apple"}),h&&g.jsx("span",{className:"lp-oauth__spinner","aria-label":"Loading"})]})}),g.jsx("div",{className:"lp-oauth__divider","aria-hidden":!0}),g.jsx("a",{role:"button",className:"gold-link",onClick:O,"aria-label":"Continue as Guest",children:"Continue as Guest"})]}),i==="error"&&g.jsx("p",{className:"lp-error",role:"alert",children:c})]})]})]}),g.jsxs("footer",{className:"lp-footer",children:[g.jsxs("nav",{className:"lp-footer__links","aria-label":"Footer",children:[g.jsx("a",{href:"/disclaimer",className:"lp-footer__link",children:"Disclaimer (18+)"}),g.jsx("span",{className:"lp-dot","aria-hidden":!0,children:"•"}),g.jsx("a",{href:"/privacy",className:"lp-footer__link",children:"Privacy Policy"}),g.jsx("span",{className:"lp-dot","aria-hidden":!0,children:"•"}),g.jsx("a",{href:"/terms",className:"lp-footer__link",children:"Terms of Use"}),g.jsx("span",{className:"lp-dot","aria-hidden":!0,children:"•"}),g.jsx("a",{href:"/support",className:"lp-footer__link",children:"Support"})]}),g.jsx("p",{className:"lp-footnote",role:"note",children:"For entertainment purposes only. No real-money gambling or prizes."}),g.jsxs("p",{className:"lp-copy",children:["© ",new Date().getFullYear()," Zentara One LLC. All rights reserved."]})]}),g.jsx(gF,{open:b,onClose:T})]})}function Qoe(){const{user:t,loading:e,initialized:r,refreshUser:n}=$r(),a=yi(),i=!!(t?.email&&/@guest\.local$/i.test(t.email));return v.useEffect(()=>{!r&&!e&&a.pathname!=="/login"&&n()},[r,e,n]),v.useEffect(()=>{a.pathname==="/login"&&Cg()},[a.pathname]),a.pathname!=="/login"&&(!r||e)?g.jsx("div",{className:"app-loading",children:"Loading…"}):t&&!i?g.jsx(tm,{to:"/lobby",replace:!0}):g.jsx(d3,{})}var WI={};function Zoe(t,e){return e.forEach(function(r){r&&typeof r!="string"&&!Array.isArray(r)&&Object.keys(r).forEach(function(n){if(n!=="default"&&!(n in t)){var a=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:function(){return r[n]}})}})}),Object.freeze(t)}var ece=Object.defineProperty,tce=(t,e,r)=>e in t?ece(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,KI=(t,e,r)=>tce(t,typeof e!="symbol"?e+"":e,r);class Wa{constructor(){KI(this,"_locking"),KI(this,"_locks"),this._locking=Promise.resolve(),this._locks=0}isLocked(){return this._locks>0}lock(){this._locks+=1;let e;const r=new Promise(a=>e=()=>{this._locks-=1,a()}),n=this._locking.then(()=>e);return this._locking=this._locking.then(()=>r),n}}function Rn(t,e){if(!t)throw new Error(e)}const rce=34028234663852886e22,nce=-34028234663852886e22,ace=4294967295,ice=2147483647,sce=-2147483648;function a_(t){if(typeof t!="number")throw new Error("invalid int 32: "+typeof t);if(!Number.isInteger(t)||t>ice||t<sce)throw new Error("invalid int 32: "+t)}function nC(t){if(typeof t!="number")throw new Error("invalid uint 32: "+typeof t);if(!Number.isInteger(t)||t>ace||t<0)throw new Error("invalid uint 32: "+t)}function S5(t){if(typeof t!="number")throw new Error("invalid float 32: "+typeof t);if(Number.isFinite(t)&&(t>rce||t<nce))throw new Error("invalid float 32: "+t)}const E5=Symbol("@bufbuild/protobuf/enum-type");function oce(t){const e=t[E5];return Rn(e,"missing enum type on enum object"),e}function T5(t,e,r,n){t[E5]=C5(e,r.map(a=>({no:a.no,name:a.name,localName:t[a.no]})))}function C5(t,e,r){const n=Object.create(null),a=Object.create(null),i=[];for(const o of e){const c=x5(o);i.push(c),n[o.name]=c,a[o.no]=c}return{typeName:t,values:i,findName(o){return n[o]},findNumber(o){return a[o]}}}function cce(t,e,r){const n={};for(const a of e){const i=x5(a);n[i.localName]=i.no,n[i.no]=i.localName}return T5(n,t,e),n}function x5(t){return"localName"in t?t:Object.assign(Object.assign({},t),{localName:t.name})}class NP{equals(e){return this.getType().runtime.util.equals(this.getType(),this,e)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(e,r){const n=this.getType(),a=n.runtime.bin,i=a.makeReadOptions(r);return a.readMessage(this,i.readerFactory(e),e.byteLength,i),this}fromJson(e,r){const n=this.getType(),a=n.runtime.json,i=a.makeReadOptions(r);return a.readMessage(n,e,i,this),this}fromJsonString(e,r){let n;try{n=JSON.parse(e)}catch(a){throw new Error("cannot decode ".concat(this.getType().typeName," from JSON: ").concat(a instanceof Error?a.message:String(a)))}return this.fromJson(n,r)}toBinary(e){const r=this.getType(),n=r.runtime.bin,a=n.makeWriteOptions(e),i=a.writerFactory();return n.writeMessage(this,i,a),i.finish()}toJson(e){const r=this.getType(),n=r.runtime.json,a=n.makeWriteOptions(e);return n.writeMessage(this,a)}toJsonString(e){var r;const n=this.toJson(e);return JSON.stringify(n,null,(r=e?.prettySpaces)!==null&&r!==void 0?r:0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}}function lce(t,e,r,n){var a;const i=(a=n?.localName)!==null&&a!==void 0?a:e.substring(e.lastIndexOf(".")+1),o={[i]:function(c){t.util.initFields(this),t.util.initPartial(c,this)}}[i];return Object.setPrototypeOf(o.prototype,new NP),Object.assign(o,{runtime:t,typeName:e,fields:t.util.newFieldList(r),fromBinary(c,u){return new o().fromBinary(c,u)},fromJson(c,u){return new o().fromJson(c,u)},fromJsonString(c,u){return new o().fromJsonString(c,u)},equals(c,u){return t.util.equals(o,c,u)}}),o}function uce(){let t=0,e=0;for(let n=0;n<28;n+=7){let a=this.buf[this.pos++];if(t|=(a&127)<<n,(a&128)==0)return this.assertBounds(),[t,e]}let r=this.buf[this.pos++];if(t|=(r&15)<<28,e=(r&112)>>4,(r&128)==0)return this.assertBounds(),[t,e];for(let n=3;n<=31;n+=7){let a=this.buf[this.pos++];if(e|=(a&127)<<n,(a&128)==0)return this.assertBounds(),[t,e]}throw new Error("invalid varint")}function eE(t,e,r){for(let i=0;i<28;i=i+7){const o=t>>>i,c=!(!(o>>>7)&&e==0),u=(c?o|128:o)&255;if(r.push(u),!c)return}const n=t>>>28&15|(e&7)<<4,a=e>>3!=0;if(r.push((a?n|128:n)&255),!!a){for(let i=3;i<31;i=i+7){const o=e>>>i,c=!!(o>>>7),u=(c?o|128:o)&255;if(r.push(u),!c)return}r.push(e>>>31&1)}}const i_=4294967296;function YI(t){const e=t[0]==="-";e&&(t=t.slice(1));const r=1e6;let n=0,a=0;function i(o,c){const u=Number(t.slice(o,c));a*=r,n=n*r+u,n>=i_&&(a=a+(n/i_|0),n=n%i_)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),e?A5(n,a):IP(n,a)}function dce(t,e){let r=IP(t,e);const n=r.hi&2147483648;n&&(r=A5(r.lo,r.hi));const a=P5(r.lo,r.hi);return n?"-"+a:a}function P5(t,e){if({lo:t,hi:e}=fce(t,e),e<=2097151)return String(i_*e+t);const r=t&16777215,n=(t>>>24|e<<8)&16777215,a=e>>16&65535;let i=r+n*6777216+a*6710656,o=n+a*8147497,c=a*2;const u=1e7;return i>=u&&(o+=Math.floor(i/u),i%=u),o>=u&&(c+=Math.floor(o/u),o%=u),c.toString()+XI(o)+XI(i)}function fce(t,e){return{lo:t>>>0,hi:e>>>0}}function IP(t,e){return{lo:t|0,hi:e|0}}function A5(t,e){return e=~e,t?t=~t+1:e+=1,IP(t,e)}const XI=t=>{const e=String(t);return"0000000".slice(e.length)+e};function JI(t,e){if(t>=0){for(;t>127;)e.push(t&127|128),t=t>>>7;e.push(t)}else{for(let r=0;r<9;r++)e.push(t&127|128),t=t>>7;e.push(1)}}function pce(){let t=this.buf[this.pos++],e=t&127;if((t&128)==0)return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<7,(t&128)==0)return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<14,(t&128)==0)return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<21,(t&128)==0)return this.assertBounds(),e;t=this.buf[this.pos++],e|=(t&15)<<28;for(let r=5;(t&128)!==0&&r<10;r++)t=this.buf[this.pos++];if((t&128)!=0)throw new Error("invalid varint");return this.assertBounds(),e>>>0}function hce(){const t=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof t.getBigInt64=="function"&&typeof t.getBigUint64=="function"&&typeof t.setBigInt64=="function"&&typeof t.setBigUint64=="function"&&(typeof process!="object"||typeof WI!="object"||WI.BUF_BIGINT_DISABLE!=="1")){const a=BigInt("-9223372036854775808"),i=BigInt("9223372036854775807"),o=BigInt("0"),c=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(u){const d=typeof u=="bigint"?u:BigInt(u);if(d>i||d<a)throw new Error("int64 invalid: ".concat(u));return d},uParse(u){const d=typeof u=="bigint"?u:BigInt(u);if(d>c||d<o)throw new Error("uint64 invalid: ".concat(u));return d},enc(u){return t.setBigInt64(0,this.parse(u),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},uEnc(u){return t.setBigInt64(0,this.uParse(u),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},dec(u,d){return t.setInt32(0,u,!0),t.setInt32(4,d,!0),t.getBigInt64(0,!0)},uDec(u,d){return t.setInt32(0,u,!0),t.setInt32(4,d,!0),t.getBigUint64(0,!0)}}}const r=a=>Rn(/^-?[0-9]+$/.test(a),"int64 invalid: ".concat(a)),n=a=>Rn(/^[0-9]+$/.test(a),"uint64 invalid: ".concat(a));return{zero:"0",supported:!1,parse(a){return typeof a!="string"&&(a=a.toString()),r(a),a},uParse(a){return typeof a!="string"&&(a=a.toString()),n(a),a},enc(a){return typeof a!="string"&&(a=a.toString()),r(a),YI(a)},uEnc(a){return typeof a!="string"&&(a=a.toString()),n(a),YI(a)},dec(a,i){return dce(a,i)},uDec(a,i){return P5(a,i)}}}const kn=hce();var Xe;(function(t){t[t.DOUBLE=1]="DOUBLE",t[t.FLOAT=2]="FLOAT",t[t.INT64=3]="INT64",t[t.UINT64=4]="UINT64",t[t.INT32=5]="INT32",t[t.FIXED64=6]="FIXED64",t[t.FIXED32=7]="FIXED32",t[t.BOOL=8]="BOOL",t[t.STRING=9]="STRING",t[t.BYTES=12]="BYTES",t[t.UINT32=13]="UINT32",t[t.SFIXED32=15]="SFIXED32",t[t.SFIXED64=16]="SFIXED64",t[t.SINT32=17]="SINT32",t[t.SINT64=18]="SINT64"})(Xe||(Xe={}));var ru;(function(t){t[t.BIGINT=0]="BIGINT",t[t.STRING=1]="STRING"})(ru||(ru={}));function El(t,e,r){if(e===r)return!0;if(t==Xe.BYTES){if(!(e instanceof Uint8Array)||!(r instanceof Uint8Array)||e.length!==r.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==r[n])return!1;return!0}switch(t){case Xe.UINT64:case Xe.FIXED64:case Xe.INT64:case Xe.SFIXED64:case Xe.SINT64:return e==r}return!1}function lp(t,e){switch(t){case Xe.BOOL:return!1;case Xe.UINT64:case Xe.FIXED64:case Xe.INT64:case Xe.SFIXED64:case Xe.SINT64:return e==0?kn.zero:"0";case Xe.DOUBLE:case Xe.FLOAT:return 0;case Xe.BYTES:return new Uint8Array(0);case Xe.STRING:return"";default:return 0}}function R5(t,e){switch(t){case Xe.BOOL:return e===!1;case Xe.STRING:return e==="";case Xe.BYTES:return e instanceof Uint8Array&&!e.byteLength;default:return e==0}}var Bn;(function(t){t[t.Varint=0]="Varint",t[t.Bit64=1]="Bit64",t[t.LengthDelimited=2]="LengthDelimited",t[t.StartGroup=3]="StartGroup",t[t.EndGroup=4]="EndGroup",t[t.Bit32=5]="Bit32"})(Bn||(Bn={}));class mce{constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let a=0;a<this.chunks.length;a++)e+=this.chunks[a].length;let r=new Uint8Array(e),n=0;for(let a=0;a<this.chunks.length;a++)r.set(this.chunks[a],n),n+=this.chunks[a].length;return this.chunks=[],r}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),r=this.stack.pop();if(!r)throw new Error("invalid state, fork stack empty");return this.chunks=r.chunks,this.buf=r.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,r){return this.uint32((e<<3|r)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(nC(e);e>127;)this.buf.push(e&127|128),e=e>>>7;return this.buf.push(e),this}int32(e){return a_(e),JI(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let r=this.textEncoder.encode(e);return this.uint32(r.byteLength),this.raw(r)}float(e){S5(e);let r=new Uint8Array(4);return new DataView(r.buffer).setFloat32(0,e,!0),this.raw(r)}double(e){let r=new Uint8Array(8);return new DataView(r.buffer).setFloat64(0,e,!0),this.raw(r)}fixed32(e){nC(e);let r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,e,!0),this.raw(r)}sfixed32(e){a_(e);let r=new Uint8Array(4);return new DataView(r.buffer).setInt32(0,e,!0),this.raw(r)}sint32(e){return a_(e),e=(e<<1^e>>31)>>>0,JI(e,this.buf),this}sfixed64(e){let r=new Uint8Array(8),n=new DataView(r.buffer),a=kn.enc(e);return n.setInt32(0,a.lo,!0),n.setInt32(4,a.hi,!0),this.raw(r)}fixed64(e){let r=new Uint8Array(8),n=new DataView(r.buffer),a=kn.uEnc(e);return n.setInt32(0,a.lo,!0),n.setInt32(4,a.hi,!0),this.raw(r)}int64(e){let r=kn.enc(e);return eE(r.lo,r.hi,this.buf),this}sint64(e){let r=kn.enc(e),n=r.hi>>31,a=r.lo<<1^n,i=(r.hi<<1|r.lo>>>31)^n;return eE(a,i,this.buf),this}uint64(e){let r=kn.uEnc(e);return eE(r.lo,r.hi,this.buf),this}}class gce{constructor(e,r){this.varint64=uce,this.uint32=pce,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=r??new TextDecoder}tag(){let e=this.uint32(),r=e>>>3,n=e&7;if(r<=0||n<0||n>5)throw new Error("illegal tag: field no "+r+" wire type "+n);return[r,n]}skip(e,r){let n=this.pos;switch(e){case Bn.Varint:for(;this.buf[this.pos++]&128;);break;case Bn.Bit64:this.pos+=4;case Bn.Bit32:this.pos+=4;break;case Bn.LengthDelimited:let a=this.uint32();this.pos+=a;break;case Bn.StartGroup:for(;;){const[i,o]=this.tag();if(o===Bn.EndGroup){if(r!==void 0&&i!==r)throw new Error("invalid end group tag");break}this.skip(o,i)}break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return kn.dec(...this.varint64())}uint64(){return kn.uDec(...this.varint64())}sint64(){let[e,r]=this.varint64(),n=-(e&1);return e=(e>>>1|(r&1)<<31)^n,r=r>>>1^n,kn.dec(e,r)}bool(){let[e,r]=this.varint64();return e!==0||r!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return kn.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return kn.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),r=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(r,r+e)}string(){return this.textDecoder.decode(this.bytes())}}function yce(t,e,r,n){let a;return{typeName:e,extendee:r,get field(){if(!a){const i=typeof n=="function"?n():n;i.name=e.split(".").pop(),i.jsonName="[".concat(e,"]"),a=t.util.newFieldList([i]).list()[0]}return a},runtime:t}}function D5(t){const e=t.field.localName,r=Object.create(null);return r[e]=vce(t),[r,()=>r[e]]}function vce(t){const e=t.field;if(e.repeated)return[];if(e.default!==void 0)return e.default;switch(e.kind){case"enum":return e.T.values[0].no;case"scalar":return lp(e.T,e.L);case"message":const r=e.T,n=new r;return r.fieldWrapper?r.fieldWrapper.unwrapField(n):n;case"map":throw"map fields are not allowed to be extensions"}}function _ce(t,e){if(!e.repeated&&(e.kind=="enum"||e.kind=="scalar")){for(let r=t.length-1;r>=0;--r)if(t[r].no==e.no)return[t[r]];return[]}return t.filter(r=>r.no===e.no)}let xc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),c0=[];for(let t=0;t<xc.length;t++)c0[xc[t].charCodeAt(0)]=t;c0[45]=xc.indexOf("+");c0[95]=xc.indexOf("/");const O5={dec(t){let e=t.length*3/4;t[t.length-2]=="="?e-=2:t[t.length-1]=="="&&(e-=1);let r=new Uint8Array(e),n=0,a=0,i,o=0;for(let c=0;c<t.length;c++){if(i=c0[t.charCodeAt(c)],i===void 0)switch(t[c]){case"=":a=0;case`
`:case"\r":case"	":case" ":continue;default:throw Error("invalid base64 string.")}switch(a){case 0:o=i,a=1;break;case 1:r[n++]=o<<2|(i&48)>>4,o=i,a=2;break;case 2:r[n++]=(o&15)<<4|(i&60)>>2,o=i,a=3;break;case 3:r[n++]=(o&3)<<6|i,a=0;break}}if(a==1)throw Error("invalid base64 string.");return r.subarray(0,n)},enc(t){let e="",r=0,n,a=0;for(let i=0;i<t.length;i++)switch(n=t[i],r){case 0:e+=xc[n>>2],a=(n&3)<<4,r=1;break;case 1:e+=xc[a|n>>4],a=(n&15)<<2,r=2;break;case 2:e+=xc[a|n>>6],e+=xc[n&63],r=0;break}return r&&(e+=xc[a],e+="=",r==1&&(e+="=")),e}};function bce(t,e,r){I5(e,t);const n=e.runtime.bin.makeReadOptions(r),a=_ce(t.getType().runtime.bin.listUnknownFields(t),e.field),[i,o]=D5(e);for(const c of a)e.runtime.bin.readField(i,n.readerFactory(c.data),e.field,c.wireType,n);return o()}function kce(t,e,r,n){I5(e,t);const a=e.runtime.bin.makeReadOptions(n),i=e.runtime.bin.makeWriteOptions(n);if(N5(t,e)){const d=t.getType().runtime.bin.listUnknownFields(t).filter(f=>f.no!=e.field.no);t.getType().runtime.bin.discardUnknownFields(t);for(const f of d)t.getType().runtime.bin.onUnknownField(t,f.no,f.wireType,f.data)}const o=i.writerFactory();let c=e.field;!c.opt&&!c.repeated&&(c.kind=="enum"||c.kind=="scalar")&&(c=Object.assign(Object.assign({},e.field),{opt:!0})),e.runtime.bin.writeField(c,r,o,i);const u=a.readerFactory(o.finish());for(;u.pos<u.len;){const[d,f]=u.tag(),h=u.skip(f,d);t.getType().runtime.bin.onUnknownField(t,d,f,h)}}function N5(t,e){const r=t.getType();return e.extendee.typeName===r.typeName&&!!r.runtime.bin.listUnknownFields(t).find(n=>n.no==e.field.no)}function I5(t,e){Rn(t.extendee.typeName==e.getType().typeName,"extension ".concat(t.typeName," can only be applied to message ").concat(t.extendee.typeName))}function M5(t,e){const r=t.localName;if(t.repeated)return e[r].length>0;if(t.oneof)return e[t.oneof.localName].case===r;switch(t.kind){case"enum":case"scalar":return t.opt||t.req?e[r]!==void 0:t.kind=="enum"?e[r]!==t.T.values[0].no:!R5(t.T,e[r]);case"message":return e[r]!==void 0;case"map":return Object.keys(e[r]).length>0}}function QI(t,e){const r=t.localName,n=!t.opt&&!t.req;if(t.repeated)e[r]=[];else if(t.oneof)e[t.oneof.localName]={case:void 0};else switch(t.kind){case"map":e[r]={};break;case"enum":e[r]=n?t.T.values[0].no:void 0;break;case"scalar":e[r]=n?lp(t.T,t.L):void 0;break;case"message":e[r]=void 0;break}}function Pc(t,e){if(t===null||typeof t!="object"||!Object.getOwnPropertyNames(NP.prototype).every(n=>n in t&&typeof t[n]=="function"))return!1;const r=t.getType();return r===null||typeof r!="function"||!("typeName"in r)||typeof r.typeName!="string"?!1:e===void 0?!0:r.typeName==e.typeName}function j5(t,e){return Pc(e)||!t.fieldWrapper?e:t.fieldWrapper.wrapField(e)}Xe.DOUBLE,Xe.FLOAT,Xe.INT64,Xe.UINT64,Xe.INT32,Xe.UINT32,Xe.BOOL,Xe.STRING,Xe.BYTES;const ZI={ignoreUnknownFields:!1},eM={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function wce(t){return t?Object.assign(Object.assign({},ZI),t):ZI}function Sce(t){return t?Object.assign(Object.assign({},eM),t):eM}const nb=Symbol(),s_=Symbol();function Ece(){return{makeReadOptions:wce,makeWriteOptions:Sce,readMessage(t,e,r,n){if(e==null||Array.isArray(e)||typeof e!="object")throw new Error("cannot decode message ".concat(t.typeName," from JSON: ").concat(Oo(e)));n=n??new t;const a=new Map,i=r.typeRegistry;for(const[o,c]of Object.entries(e)){const u=t.fields.findJsonName(o);if(u){if(u.oneof){if(c===null&&u.kind=="scalar")continue;const d=a.get(u.oneof);if(d!==void 0)throw new Error("cannot decode message ".concat(t.typeName,' from JSON: multiple keys for oneof "').concat(u.oneof.name,'" present: "').concat(d,'", "').concat(o,'"'));a.set(u.oneof,o)}tM(n,c,u,r,t)}else{let d=!1;if(i?.findExtension&&o.startsWith("[")&&o.endsWith("]")){const f=i.findExtension(o.substring(1,o.length-1));if(f&&f.extendee.typeName==t.typeName){d=!0;const[h,m]=D5(f);tM(h,c,f.field,r,f),kce(n,f,m(),r)}}if(!d&&!r.ignoreUnknownFields)throw new Error("cannot decode message ".concat(t.typeName,' from JSON: key "').concat(o,'" is unknown'))}}return n},writeMessage(t,e){const r=t.getType(),n={};let a;try{for(a of r.fields.byNumber()){if(!M5(a,t)){if(a.req)throw"required field not set";if(!e.emitDefaultValues||!Cce(a))continue}const o=a.oneof?t[a.oneof.localName].value:t[a.localName],c=rM(a,o,e);c!==void 0&&(n[e.useProtoFieldName?a.name:a.jsonName]=c)}const i=e.typeRegistry;if(i?.findExtensionFor)for(const o of r.runtime.bin.listUnknownFields(t)){const c=i.findExtensionFor(r.typeName,o.no);if(c&&N5(t,c)){const u=bce(t,c,e),d=rM(c.field,u,e);d!==void 0&&(n[c.field.jsonName]=d)}}}catch(i){const o=a?"cannot encode field ".concat(r.typeName,".").concat(a.name," to JSON"):"cannot encode message ".concat(r.typeName," to JSON"),c=i instanceof Error?i.message:String(i);throw new Error(o+(c.length>0?": ".concat(c):""))}return n},readScalar(t,e,r){return pm(t,e,r??ru.BIGINT,!0)},writeScalar(t,e,r){if(e!==void 0&&(r||R5(t,e)))return o_(t,e)},debug:Oo}}function Oo(t){if(t===null)return"null";switch(typeof t){case"object":return Array.isArray(t)?"array":"object";case"string":return t.length>100?"string":'"'.concat(t.split('"').join('\\"'),'"');default:return String(t)}}function tM(t,e,r,n,a){let i=r.localName;if(r.repeated){if(Rn(r.kind!="map"),e===null)return;if(!Array.isArray(e))throw new Error("cannot decode field ".concat(a.typeName,".").concat(r.name," from JSON: ").concat(Oo(e)));const o=t[i];for(const c of e){if(c===null)throw new Error("cannot decode field ".concat(a.typeName,".").concat(r.name," from JSON: ").concat(Oo(c)));switch(r.kind){case"message":o.push(r.T.fromJson(c,n));break;case"enum":const u=tE(r.T,c,n.ignoreUnknownFields,!0);u!==s_&&o.push(u);break;case"scalar":try{o.push(pm(r.T,c,r.L,!0))}catch(d){let f="cannot decode field ".concat(a.typeName,".").concat(r.name," from JSON: ").concat(Oo(c));throw d instanceof Error&&d.message.length>0&&(f+=": ".concat(d.message)),new Error(f)}break}}}else if(r.kind=="map"){if(e===null)return;if(typeof e!="object"||Array.isArray(e))throw new Error("cannot decode field ".concat(a.typeName,".").concat(r.name," from JSON: ").concat(Oo(e)));const o=t[i];for(const[c,u]of Object.entries(e)){if(u===null)throw new Error("cannot decode field ".concat(a.typeName,".").concat(r.name," from JSON: map value null"));let d;try{d=Tce(r.K,c)}catch(f){let h="cannot decode map key for field ".concat(a.typeName,".").concat(r.name," from JSON: ").concat(Oo(e));throw f instanceof Error&&f.message.length>0&&(h+=": ".concat(f.message)),new Error(h)}switch(r.V.kind){case"message":o[d]=r.V.T.fromJson(u,n);break;case"enum":const f=tE(r.V.T,u,n.ignoreUnknownFields,!0);f!==s_&&(o[d]=f);break;case"scalar":try{o[d]=pm(r.V.T,u,ru.BIGINT,!0)}catch(h){let m="cannot decode map value for field ".concat(a.typeName,".").concat(r.name," from JSON: ").concat(Oo(e));throw h instanceof Error&&h.message.length>0&&(m+=": ".concat(h.message)),new Error(m)}break}}}else switch(r.oneof&&(t=t[r.oneof.localName]={case:i},i="value"),r.kind){case"message":const o=r.T;if(e===null&&o.typeName!="google.protobuf.Value")return;let c=t[i];Pc(c)?c.fromJson(e,n):(t[i]=c=o.fromJson(e,n),o.fieldWrapper&&!r.oneof&&(t[i]=o.fieldWrapper.unwrapField(c)));break;case"enum":const u=tE(r.T,e,n.ignoreUnknownFields,!1);switch(u){case nb:QI(r,t);break;case s_:break;default:t[i]=u;break}break;case"scalar":try{const d=pm(r.T,e,r.L,!1);switch(d){case nb:QI(r,t);break;default:t[i]=d;break}}catch(d){let f="cannot decode field ".concat(a.typeName,".").concat(r.name," from JSON: ").concat(Oo(e));throw d instanceof Error&&d.message.length>0&&(f+=": ".concat(d.message)),new Error(f)}break}}function Tce(t,e){if(t===Xe.BOOL)switch(e){case"true":e=!0;break;case"false":e=!1;break}return pm(t,e,ru.BIGINT,!0).toString()}function pm(t,e,r,n){if(e===null)return n?lp(t,r):nb;switch(t){case Xe.DOUBLE:case Xe.FLOAT:if(e==="NaN")return Number.NaN;if(e==="Infinity")return Number.POSITIVE_INFINITY;if(e==="-Infinity")return Number.NEGATIVE_INFINITY;if(e===""||typeof e=="string"&&e.trim().length!==e.length||typeof e!="string"&&typeof e!="number")break;const a=Number(e);if(Number.isNaN(a)||!Number.isFinite(a))break;return t==Xe.FLOAT&&S5(a),a;case Xe.INT32:case Xe.FIXED32:case Xe.SFIXED32:case Xe.SINT32:case Xe.UINT32:let i;if(typeof e=="number"?i=e:typeof e=="string"&&e.length>0&&e.trim().length===e.length&&(i=Number(e)),i===void 0)break;return t==Xe.UINT32||t==Xe.FIXED32?nC(i):a_(i),i;case Xe.INT64:case Xe.SFIXED64:case Xe.SINT64:if(typeof e!="number"&&typeof e!="string")break;const o=kn.parse(e);return r?o.toString():o;case Xe.FIXED64:case Xe.UINT64:if(typeof e!="number"&&typeof e!="string")break;const c=kn.uParse(e);return r?c.toString():c;case Xe.BOOL:if(typeof e!="boolean")break;return e;case Xe.STRING:if(typeof e!="string")break;try{encodeURIComponent(e)}catch{throw new Error("invalid UTF8")}return e;case Xe.BYTES:if(e==="")return new Uint8Array(0);if(typeof e!="string")break;return O5.dec(e)}throw new Error}function tE(t,e,r,n){if(e===null)return t.typeName=="google.protobuf.NullValue"?0:n?t.values[0].no:nb;switch(typeof e){case"number":if(Number.isInteger(e))return e;break;case"string":const a=t.findName(e);if(a!==void 0)return a.no;if(r)return s_;break}throw new Error("cannot decode enum ".concat(t.typeName," from JSON: ").concat(Oo(e)))}function Cce(t){return t.repeated||t.kind=="map"?!0:!(t.oneof||t.kind=="message"||t.opt||t.req)}function rM(t,e,r){if(t.kind=="map"){Rn(typeof e=="object"&&e!=null);const n={},a=Object.entries(e);switch(t.V.kind){case"scalar":for(const[o,c]of a)n[o.toString()]=o_(t.V.T,c);break;case"message":for(const[o,c]of a)n[o.toString()]=c.toJson(r);break;case"enum":const i=t.V.T;for(const[o,c]of a)n[o.toString()]=rE(i,c,r.enumAsInteger);break}return r.emitDefaultValues||a.length>0?n:void 0}if(t.repeated){Rn(Array.isArray(e));const n=[];switch(t.kind){case"scalar":for(let a=0;a<e.length;a++)n.push(o_(t.T,e[a]));break;case"enum":for(let a=0;a<e.length;a++)n.push(rE(t.T,e[a],r.enumAsInteger));break;case"message":for(let a=0;a<e.length;a++)n.push(e[a].toJson(r));break}return r.emitDefaultValues||n.length>0?n:void 0}switch(t.kind){case"scalar":return o_(t.T,e);case"enum":return rE(t.T,e,r.enumAsInteger);case"message":return j5(t.T,e).toJson(r)}}function rE(t,e,r){var n;if(Rn(typeof e=="number"),t.typeName=="google.protobuf.NullValue")return null;if(r)return e;const a=t.findNumber(e);return(n=a?.name)!==null&&n!==void 0?n:e}function o_(t,e){switch(t){case Xe.INT32:case Xe.SFIXED32:case Xe.SINT32:case Xe.FIXED32:case Xe.UINT32:return Rn(typeof e=="number"),e;case Xe.FLOAT:case Xe.DOUBLE:return Rn(typeof e=="number"),Number.isNaN(e)?"NaN":e===Number.POSITIVE_INFINITY?"Infinity":e===Number.NEGATIVE_INFINITY?"-Infinity":e;case Xe.STRING:return Rn(typeof e=="string"),e;case Xe.BOOL:return Rn(typeof e=="boolean"),e;case Xe.UINT64:case Xe.FIXED64:case Xe.INT64:case Xe.SFIXED64:case Xe.SINT64:return Rn(typeof e=="bigint"||typeof e=="string"||typeof e=="number"),e.toString();case Xe.BYTES:return Rn(e instanceof Uint8Array),O5.enc(e)}}const uf=Symbol("@bufbuild/protobuf/unknown-fields"),nM={readUnknownFields:!0,readerFactory:t=>new gce(t)},aM={writeUnknownFields:!0,writerFactory:()=>new mce};function xce(t){return t?Object.assign(Object.assign({},nM),t):nM}function Pce(t){return t?Object.assign(Object.assign({},aM),t):aM}function Ace(){return{makeReadOptions:xce,makeWriteOptions:Pce,listUnknownFields(t){var e;return(e=t[uf])!==null&&e!==void 0?e:[]},discardUnknownFields(t){delete t[uf]},writeUnknownFields(t,e){const n=t[uf];if(n)for(const a of n)e.tag(a.no,a.wireType).raw(a.data)},onUnknownField(t,e,r,n){const a=t;Array.isArray(a[uf])||(a[uf]=[]),a[uf].push({no:e,wireType:r,data:n})},readMessage(t,e,r,n,a){const i=t.getType(),o=a?e.len:e.pos+r;let c,u;for(;e.pos<o&&([c,u]=e.tag(),!(a===!0&&u==Bn.EndGroup));){const d=i.fields.find(c);if(!d){const f=e.skip(u,c);n.readUnknownFields&&this.onUnknownField(t,c,u,f);continue}iM(t,e,d,u,n)}if(a&&(u!=Bn.EndGroup||c!==r))throw new Error("invalid end group tag")},readField:iM,writeMessage(t,e,r){const n=t.getType();for(const a of n.fields.byNumber()){if(!M5(a,t)){if(a.req)throw new Error("cannot encode field ".concat(n.typeName,".").concat(a.name," to binary: required field not set"));continue}const i=a.oneof?t[a.oneof.localName].value:t[a.localName];sM(a,i,e,r)}return r.writeUnknownFields&&this.writeUnknownFields(t,e),e},writeField(t,e,r,n){e!==void 0&&sM(t,e,r,n)}}}function iM(t,e,r,n,a){let{repeated:i,localName:o}=r;switch(r.oneof&&(t=t[r.oneof.localName],t.case!=o&&delete t.value,t.case=o,o="value"),r.kind){case"scalar":case"enum":const c=r.kind=="enum"?Xe.INT32:r.T;let u=ab;if(r.kind=="scalar"&&r.L>0&&(u=Dce),i){let m=t[o];if(n==Bn.LengthDelimited&&c!=Xe.STRING&&c!=Xe.BYTES){let w=e.uint32()+e.pos;for(;e.pos<w;)m.push(u(e,c))}else m.push(u(e,c))}else t[o]=u(e,c);break;case"message":const d=r.T;i?t[o].push(c_(e,new d,a,r)):Pc(t[o])?c_(e,t[o],a,r):(t[o]=c_(e,new d,a,r),d.fieldWrapper&&!r.oneof&&!r.repeated&&(t[o]=d.fieldWrapper.unwrapField(t[o])));break;case"map":let[f,h]=Rce(r,e,a);t[o][f]=h;break}}function c_(t,e,r,n){const a=e.getType().runtime.bin,i=n?.delimited;return a.readMessage(e,t,i?n.no:t.uint32(),r,i),e}function Rce(t,e,r){const n=e.uint32(),a=e.pos+n;let i,o;for(;e.pos<a;){const[c]=e.tag();switch(c){case 1:i=ab(e,t.K);break;case 2:switch(t.V.kind){case"scalar":o=ab(e,t.V.T);break;case"enum":o=e.int32();break;case"message":o=c_(e,new t.V.T,r,void 0);break}break}}if(i===void 0&&(i=lp(t.K,ru.BIGINT)),typeof i!="string"&&typeof i!="number"&&(i=i.toString()),o===void 0)switch(t.V.kind){case"scalar":o=lp(t.V.T,ru.BIGINT);break;case"enum":o=t.V.T.values[0].no;break;case"message":o=new t.V.T;break}return[i,o]}function Dce(t,e){const r=ab(t,e);return typeof r=="bigint"?r.toString():r}function ab(t,e){switch(e){case Xe.STRING:return t.string();case Xe.BOOL:return t.bool();case Xe.DOUBLE:return t.double();case Xe.FLOAT:return t.float();case Xe.INT32:return t.int32();case Xe.INT64:return t.int64();case Xe.UINT64:return t.uint64();case Xe.FIXED64:return t.fixed64();case Xe.BYTES:return t.bytes();case Xe.FIXED32:return t.fixed32();case Xe.SFIXED32:return t.sfixed32();case Xe.SFIXED64:return t.sfixed64();case Xe.SINT64:return t.sint64();case Xe.UINT32:return t.uint32();case Xe.SINT32:return t.sint32()}}function sM(t,e,r,n){Rn(e!==void 0);const a=t.repeated;switch(t.kind){case"scalar":case"enum":let i=t.kind=="enum"?Xe.INT32:t.T;if(a)if(Rn(Array.isArray(e)),t.packed)Nce(r,i,t.no,e);else for(const o of e)hm(r,i,t.no,o);else hm(r,i,t.no,e);break;case"message":if(a){Rn(Array.isArray(e));for(const o of e)oM(r,n,t,o)}else oM(r,n,t,e);break;case"map":Rn(typeof e=="object"&&e!=null);for(const[o,c]of Object.entries(e))Oce(r,n,t,o,c);break}}function Oce(t,e,r,n,a){t.tag(r.no,Bn.LengthDelimited),t.fork();let i=n;switch(r.K){case Xe.INT32:case Xe.FIXED32:case Xe.UINT32:case Xe.SFIXED32:case Xe.SINT32:i=Number.parseInt(n);break;case Xe.BOOL:Rn(n=="true"||n=="false"),i=n=="true";break}switch(hm(t,r.K,1,i),r.V.kind){case"scalar":hm(t,r.V.T,2,a);break;case"enum":hm(t,Xe.INT32,2,a);break;case"message":Rn(a!==void 0),t.tag(2,Bn.LengthDelimited).bytes(a.toBinary(e));break}t.join()}function oM(t,e,r,n){const a=j5(r.T,n);r.delimited?t.tag(r.no,Bn.StartGroup).raw(a.toBinary(e)).tag(r.no,Bn.EndGroup):t.tag(r.no,Bn.LengthDelimited).bytes(a.toBinary(e))}function hm(t,e,r,n){Rn(n!==void 0);let[a,i]=L5(e);t.tag(r,a)[i](n)}function Nce(t,e,r,n){if(!n.length)return;t.tag(r,Bn.LengthDelimited).fork();let[,a]=L5(e);for(let i=0;i<n.length;i++)t[a](n[i]);t.join()}function L5(t){let e=Bn.Varint;switch(t){case Xe.BYTES:case Xe.STRING:e=Bn.LengthDelimited;break;case Xe.DOUBLE:case Xe.FIXED64:case Xe.SFIXED64:e=Bn.Bit64;break;case Xe.FIXED32:case Xe.SFIXED32:case Xe.FLOAT:e=Bn.Bit32;break}const r=Xe[t].toLowerCase();return[e,r]}function Ice(){return{setEnumType:T5,initPartial(t,e){if(t===void 0)return;const r=e.getType();for(const n of r.fields.byMember()){const a=n.localName,i=e,o=t;if(o[a]!=null)switch(n.kind){case"oneof":const c=o[a].case;if(c===void 0)continue;const u=n.findField(c);let d=o[a].value;u&&u.kind=="message"&&!Pc(d,u.T)?d=new u.T(d):u&&u.kind==="scalar"&&u.T===Xe.BYTES&&(d=Ph(d)),i[a]={case:c,value:d};break;case"scalar":case"enum":let f=o[a];n.T===Xe.BYTES&&(f=n.repeated?f.map(Ph):Ph(f)),i[a]=f;break;case"map":switch(n.V.kind){case"scalar":case"enum":if(n.V.T===Xe.BYTES)for(const[_,w]of Object.entries(o[a]))i[a][_]=Ph(w);else Object.assign(i[a],o[a]);break;case"message":const m=n.V.T;for(const _ of Object.keys(o[a])){let w=o[a][_];m.fieldWrapper||(w=new m(w)),i[a][_]=w}break}break;case"message":const h=n.T;if(n.repeated)i[a]=o[a].map(m=>Pc(m,h)?m:new h(m));else{const m=o[a];h.fieldWrapper?h.typeName==="google.protobuf.BytesValue"?i[a]=Ph(m):i[a]=m:i[a]=Pc(m,h)?m:new h(m)}break}}},equals(t,e,r){return e===r?!0:!e||!r?!1:t.fields.byMember().every(n=>{const a=e[n.localName],i=r[n.localName];if(n.repeated){if(a.length!==i.length)return!1;switch(n.kind){case"message":return a.every((o,c)=>n.T.equals(o,i[c]));case"scalar":return a.every((o,c)=>El(n.T,o,i[c]));case"enum":return a.every((o,c)=>El(Xe.INT32,o,i[c]))}throw new Error("repeated cannot contain ".concat(n.kind))}switch(n.kind){case"message":let o=a,c=i;return n.T.fieldWrapper&&(o!==void 0&&!Pc(o)&&(o=n.T.fieldWrapper.wrapField(o)),c!==void 0&&!Pc(c)&&(c=n.T.fieldWrapper.wrapField(c))),n.T.equals(o,c);case"enum":return El(Xe.INT32,a,i);case"scalar":return El(n.T,a,i);case"oneof":if(a.case!==i.case)return!1;const u=n.findField(a.case);if(u===void 0)return!0;switch(u.kind){case"message":return u.T.equals(a.value,i.value);case"enum":return El(Xe.INT32,a.value,i.value);case"scalar":return El(u.T,a.value,i.value)}throw new Error("oneof cannot contain ".concat(u.kind));case"map":const d=Object.keys(a).concat(Object.keys(i));switch(n.V.kind){case"message":const f=n.V.T;return d.every(m=>f.equals(a[m],i[m]));case"enum":return d.every(m=>El(Xe.INT32,a[m],i[m]));case"scalar":const h=n.V.T;return d.every(m=>El(h,a[m],i[m]))}break}})},clone(t){const e=t.getType(),r=new e,n=r;for(const a of e.fields.byMember()){const i=t[a.localName];let o;if(a.repeated)o=i.map(_v);else if(a.kind=="map"){o=n[a.localName];for(const[c,u]of Object.entries(i))o[c]=_v(u)}else a.kind=="oneof"?o=a.findField(i.case)?{case:i.case,value:_v(i.value)}:{case:void 0}:o=_v(i);n[a.localName]=o}for(const a of e.runtime.bin.listUnknownFields(t))e.runtime.bin.onUnknownField(n,a.no,a.wireType,a.data);return r}}}function _v(t){if(t===void 0)return t;if(Pc(t))return t.clone();if(t instanceof Uint8Array){const e=new Uint8Array(t.byteLength);return e.set(t),e}return t}function Ph(t){return t instanceof Uint8Array?t:new Uint8Array(t)}function Mce(t,e,r){return{syntax:t,json:Ece(),bin:Ace(),util:Object.assign(Object.assign({},Ice()),{newFieldList:e,initFields:r}),makeMessageType(n,a,i){return lce(this,n,a,i)},makeEnum:cce,makeEnumType:C5,getEnumType:oce,makeExtension(n,a,i){return yce(this,n,a,i)}}}class jce{constructor(e,r){this._fields=e,this._normalizer=r}findJsonName(e){if(!this.jsonNames){const r={};for(const n of this.list())r[n.jsonName]=r[n.name]=n;this.jsonNames=r}return this.jsonNames[e]}find(e){if(!this.numbers){const r={};for(const n of this.list())r[n.no]=n;this.numbers=r}return this.numbers[e]}list(){return this.all||(this.all=this._normalizer(this._fields)),this.all}byNumber(){return this.numbersAsc||(this.numbersAsc=this.list().concat().sort((e,r)=>e.no-r.no)),this.numbersAsc}byMember(){if(!this.members){this.members=[];const e=this.members;let r;for(const n of this.list())n.oneof?n.oneof!==r&&(r=n.oneof,e.push(r)):e.push(n)}return this.members}}function B5(t,e){const r=U5(t);return e?r:zce(qce(r))}function Lce(t){return B5(t,!1)}const Bce=U5;function U5(t){let e=!1;const r=[];for(let n=0;n<t.length;n++){let a=t.charAt(n);switch(a){case"_":e=!0;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":r.push(a),e=!1;break;default:e&&(e=!1,a=a.toUpperCase()),r.push(a);break}}return r.join("")}const Uce=new Set(["constructor","toString","toJSON","valueOf"]),Fce=new Set(["getType","clone","equals","fromBinary","fromJson","fromJsonString","toBinary","toJson","toJsonString","toObject"]),F5=t=>"".concat(t,"$"),qce=t=>Fce.has(t)?F5(t):t,zce=t=>Uce.has(t)?F5(t):t;class $ce{constructor(e){this.kind="oneof",this.repeated=!1,this.packed=!1,this.opt=!1,this.req=!1,this.default=void 0,this.fields=[],this.name=e,this.localName=Lce(e)}addField(e){Rn(e.oneof===this,"field ".concat(e.name," not one of ").concat(this.name)),this.fields.push(e)}findField(e){if(!this._lookup){this._lookup=Object.create(null);for(let r=0;r<this.fields.length;r++)this._lookup[this.fields[r].localName]=this.fields[r]}return this._lookup[e]}}function Vce(t,e){var r,n,a,i,o,c;const u=[];let d;for(const f of typeof t=="function"?t():t){const h=f;if(h.localName=B5(f.name,f.oneof!==void 0),h.jsonName=(r=f.jsonName)!==null&&r!==void 0?r:Bce(f.name),h.repeated=(n=f.repeated)!==null&&n!==void 0?n:!1,f.kind=="scalar"&&(h.L=(a=f.L)!==null&&a!==void 0?a:ru.BIGINT),h.delimited=(i=f.delimited)!==null&&i!==void 0?i:!1,h.req=(o=f.req)!==null&&o!==void 0?o:!1,h.opt=(c=f.opt)!==null&&c!==void 0?c:!1,f.packed===void 0&&(h.packed=f.kind=="enum"||f.kind=="scalar"&&f.T!=Xe.BYTES&&f.T!=Xe.STRING),f.oneof!==void 0){const m=typeof f.oneof=="string"?f.oneof:f.oneof.name;(!d||d.name!=m)&&(d=new $ce(m)),h.oneof=d,d.addField(h)}u.push(h)}return u}const Ce=Mce("proto3",t=>new jce(t,e=>Vce(e)),t=>{for(const e of t.getType().fields.byMember()){if(e.opt)continue;const r=e.localName,n=t;if(e.repeated){n[r]=[];continue}switch(e.kind){case"oneof":n[r]={case:void 0};break;case"enum":n[r]=0;break;case"map":n[r]={};break;case"scalar":n[r]=lp(e.T,e.L);break}}});class ii extends NP{constructor(e){super(),this.seconds=kn.zero,this.nanos=0,Ce.util.initPartial(e,this)}fromJson(e,r){if(typeof e!="string")throw new Error("cannot decode google.protobuf.Timestamp from JSON: ".concat(Ce.json.debug(e)));const n=e.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);if(!n)throw new Error("cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string");const a=Date.parse(n[1]+"-"+n[2]+"-"+n[3]+"T"+n[4]+":"+n[5]+":"+n[6]+(n[8]?n[8]:"Z"));if(Number.isNaN(a))throw new Error("cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string");if(a<Date.parse("0001-01-01T00:00:00Z")||a>Date.parse("9999-12-31T23:59:59Z"))throw new Error("cannot decode message google.protobuf.Timestamp from JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive");return this.seconds=kn.parse(a/1e3),this.nanos=0,n[7]&&(this.nanos=parseInt("1"+n[7]+"0".repeat(9-n[7].length))-1e9),this}toJson(e){const r=Number(this.seconds)*1e3;if(r<Date.parse("0001-01-01T00:00:00Z")||r>Date.parse("9999-12-31T23:59:59Z"))throw new Error("cannot encode google.protobuf.Timestamp to JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive");if(this.nanos<0)throw new Error("cannot encode google.protobuf.Timestamp to JSON: nanos must not be negative");let n="Z";if(this.nanos>0){const a=(this.nanos+1e9).toString().substring(1);a.substring(3)==="000000"?n="."+a.substring(0,3)+"Z":a.substring(6)==="000"?n="."+a.substring(0,6)+"Z":n="."+a+"Z"}return new Date(r).toISOString().replace(".000Z",n)}toDate(){return new Date(Number(this.seconds)*1e3+Math.ceil(this.nanos/1e6))}static now(){return ii.fromDate(new Date)}static fromDate(e){const r=e.getTime();return new ii({seconds:kn.parse(Math.floor(r/1e3)),nanos:r%1e3*1e6})}static fromBinary(e,r){return new ii().fromBinary(e,r)}static fromJson(e,r){return new ii().fromJson(e,r)}static fromJsonString(e,r){return new ii().fromJsonString(e,r)}static equals(e,r){return Ce.util.equals(ii,e,r)}}ii.runtime=Ce;ii.typeName="google.protobuf.Timestamp";ii.fields=Ce.util.newFieldList(()=>[{no:1,name:"seconds",kind:"scalar",T:3},{no:2,name:"nanos",kind:"scalar",T:5}]);const Hce=Ce.makeMessageType("livekit.MetricsBatch",()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:ii},{no:3,name:"str_data",kind:"scalar",T:9,repeated:!0},{no:4,name:"time_series",kind:"message",T:Gce,repeated:!0},{no:5,name:"events",kind:"message",T:Kce,repeated:!0}]),Gce=Ce.makeMessageType("livekit.TimeSeriesMetric",()=>[{no:1,name:"label",kind:"scalar",T:13},{no:2,name:"participant_identity",kind:"scalar",T:13},{no:3,name:"track_sid",kind:"scalar",T:13},{no:4,name:"samples",kind:"message",T:Wce,repeated:!0},{no:5,name:"rid",kind:"scalar",T:13}]),Wce=Ce.makeMessageType("livekit.MetricSample",()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:ii},{no:3,name:"value",kind:"scalar",T:2}]),Kce=Ce.makeMessageType("livekit.EventMetric",()=>[{no:1,name:"label",kind:"scalar",T:13},{no:2,name:"participant_identity",kind:"scalar",T:13},{no:3,name:"track_sid",kind:"scalar",T:13},{no:4,name:"start_timestamp_ms",kind:"scalar",T:3},{no:5,name:"end_timestamp_ms",kind:"scalar",T:3,opt:!0},{no:6,name:"normalized_start_timestamp",kind:"message",T:ii},{no:7,name:"normalized_end_timestamp",kind:"message",T:ii,opt:!0},{no:8,name:"metadata",kind:"scalar",T:9},{no:9,name:"rid",kind:"scalar",T:13}]),q5=Ce.makeEnum("livekit.BackupCodecPolicy",[{no:0,name:"PREFER_REGRESSION"},{no:1,name:"SIMULCAST"},{no:2,name:"REGRESSION"}]),zs=Ce.makeEnum("livekit.TrackType",[{no:0,name:"AUDIO"},{no:1,name:"VIDEO"},{no:2,name:"DATA"}]),Yn=Ce.makeEnum("livekit.TrackSource",[{no:0,name:"UNKNOWN"},{no:1,name:"CAMERA"},{no:2,name:"MICROPHONE"},{no:3,name:"SCREEN_SHARE"},{no:4,name:"SCREEN_SHARE_AUDIO"}]),MP=Ce.makeEnum("livekit.VideoQuality",[{no:0,name:"LOW"},{no:1,name:"MEDIUM"},{no:2,name:"HIGH"},{no:3,name:"OFF"}]),Jh=Ce.makeEnum("livekit.ConnectionQuality",[{no:0,name:"POOR"},{no:1,name:"GOOD"},{no:2,name:"EXCELLENT"},{no:3,name:"LOST"}]),$m=Ce.makeEnum("livekit.ClientConfigSetting",[{no:0,name:"UNSET"},{no:1,name:"DISABLED"},{no:2,name:"ENABLED"}]),Ws=Ce.makeEnum("livekit.DisconnectReason",[{no:0,name:"UNKNOWN_REASON"},{no:1,name:"CLIENT_INITIATED"},{no:2,name:"DUPLICATE_IDENTITY"},{no:3,name:"SERVER_SHUTDOWN"},{no:4,name:"PARTICIPANT_REMOVED"},{no:5,name:"ROOM_DELETED"},{no:6,name:"STATE_MISMATCH"},{no:7,name:"JOIN_FAILURE"},{no:8,name:"MIGRATION"},{no:9,name:"SIGNAL_CLOSE"},{no:10,name:"ROOM_CLOSED"},{no:11,name:"USER_UNAVAILABLE"},{no:12,name:"USER_REJECTED"},{no:13,name:"SIP_TRUNK_FAILURE"},{no:14,name:"CONNECTION_TIMEOUT"},{no:15,name:"MEDIA_FAILURE"}]),zu=Ce.makeEnum("livekit.ReconnectReason",[{no:0,name:"RR_UNKNOWN"},{no:1,name:"RR_SIGNAL_DISCONNECTED"},{no:2,name:"RR_PUBLISHER_FAILED"},{no:3,name:"RR_SUBSCRIBER_FAILED"},{no:4,name:"RR_SWITCH_CANDIDATE"}]),Yce=Ce.makeEnum("livekit.SubscriptionError",[{no:0,name:"SE_UNKNOWN"},{no:1,name:"SE_CODEC_UNSUPPORTED"},{no:2,name:"SE_TRACK_NOTFOUND"}]),da=Ce.makeEnum("livekit.AudioTrackFeature",[{no:0,name:"TF_STEREO"},{no:1,name:"TF_NO_DTX"},{no:2,name:"TF_AUTO_GAIN_CONTROL"},{no:3,name:"TF_ECHO_CANCELLATION"},{no:4,name:"TF_NOISE_SUPPRESSION"},{no:5,name:"TF_ENHANCED_NOISE_CANCELLATION"},{no:6,name:"TF_PRECONNECT_BUFFER"}]),l0=Ce.makeMessageType("livekit.Room",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"empty_timeout",kind:"scalar",T:13},{no:14,name:"departure_timeout",kind:"scalar",T:13},{no:4,name:"max_participants",kind:"scalar",T:13},{no:5,name:"creation_time",kind:"scalar",T:3},{no:15,name:"creation_time_ms",kind:"scalar",T:3},{no:6,name:"turn_password",kind:"scalar",T:9},{no:7,name:"enabled_codecs",kind:"message",T:ib,repeated:!0},{no:8,name:"metadata",kind:"scalar",T:9},{no:9,name:"num_participants",kind:"scalar",T:13},{no:11,name:"num_publishers",kind:"scalar",T:13},{no:10,name:"active_recording",kind:"scalar",T:8},{no:13,name:"version",kind:"message",T:eq}]),ib=Ce.makeMessageType("livekit.Codec",()=>[{no:1,name:"mime",kind:"scalar",T:9},{no:2,name:"fmtp_line",kind:"scalar",T:9}]),Xce=Ce.makeMessageType("livekit.ParticipantPermission",()=>[{no:1,name:"can_subscribe",kind:"scalar",T:8},{no:2,name:"can_publish",kind:"scalar",T:8},{no:3,name:"can_publish_data",kind:"scalar",T:8},{no:9,name:"can_publish_sources",kind:"enum",T:Ce.getEnumType(Yn),repeated:!0},{no:7,name:"hidden",kind:"scalar",T:8},{no:8,name:"recorder",kind:"scalar",T:8},{no:10,name:"can_update_metadata",kind:"scalar",T:8},{no:11,name:"agent",kind:"scalar",T:8},{no:12,name:"can_subscribe_metrics",kind:"scalar",T:8}]),fd=Ce.makeMessageType("livekit.ParticipantInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"identity",kind:"scalar",T:9},{no:3,name:"state",kind:"enum",T:Ce.getEnumType(Ff)},{no:4,name:"tracks",kind:"message",T:Tf,repeated:!0},{no:5,name:"metadata",kind:"scalar",T:9},{no:6,name:"joined_at",kind:"scalar",T:3},{no:17,name:"joined_at_ms",kind:"scalar",T:3},{no:9,name:"name",kind:"scalar",T:9},{no:10,name:"version",kind:"scalar",T:13},{no:11,name:"permission",kind:"message",T:Xce},{no:12,name:"region",kind:"scalar",T:9},{no:13,name:"is_publisher",kind:"scalar",T:8},{no:14,name:"kind",kind:"enum",T:Ce.getEnumType(Vm)},{no:15,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:16,name:"disconnect_reason",kind:"enum",T:Ce.getEnumType(Ws)},{no:18,name:"kind_details",kind:"enum",T:Ce.getEnumType(Jce),repeated:!0}]),Ff=Ce.makeEnum("livekit.ParticipantInfo.State",[{no:0,name:"JOINING"},{no:1,name:"JOINED"},{no:2,name:"ACTIVE"},{no:3,name:"DISCONNECTED"}]),Vm=Ce.makeEnum("livekit.ParticipantInfo.Kind",[{no:0,name:"STANDARD"},{no:1,name:"INGRESS"},{no:2,name:"EGRESS"},{no:3,name:"SIP"},{no:4,name:"AGENT"},{no:7,name:"CONNECTOR"}]),Jce=Ce.makeEnum("livekit.ParticipantInfo.KindDetail",[{no:0,name:"CLOUD_AGENT"},{no:1,name:"FORWARDED"}]),aa=Ce.makeEnum("livekit.Encryption.Type",[{no:0,name:"NONE"},{no:1,name:"GCM"},{no:2,name:"CUSTOM"}]),Qce=Ce.makeMessageType("livekit.SimulcastCodecInfo",()=>[{no:1,name:"mime_type",kind:"scalar",T:9},{no:2,name:"mid",kind:"scalar",T:9},{no:3,name:"cid",kind:"scalar",T:9},{no:4,name:"layers",kind:"message",T:Vl,repeated:!0},{no:5,name:"video_layer_mode",kind:"enum",T:Ce.getEnumType(z5)},{no:6,name:"sdp_cid",kind:"scalar",T:9}]),Tf=Ce.makeMessageType("livekit.TrackInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"type",kind:"enum",T:Ce.getEnumType(zs)},{no:3,name:"name",kind:"scalar",T:9},{no:4,name:"muted",kind:"scalar",T:8},{no:5,name:"width",kind:"scalar",T:13},{no:6,name:"height",kind:"scalar",T:13},{no:7,name:"simulcast",kind:"scalar",T:8},{no:8,name:"disable_dtx",kind:"scalar",T:8},{no:9,name:"source",kind:"enum",T:Ce.getEnumType(Yn)},{no:10,name:"layers",kind:"message",T:Vl,repeated:!0},{no:11,name:"mime_type",kind:"scalar",T:9},{no:12,name:"mid",kind:"scalar",T:9},{no:13,name:"codecs",kind:"message",T:Qce,repeated:!0},{no:14,name:"stereo",kind:"scalar",T:8},{no:15,name:"disable_red",kind:"scalar",T:8},{no:16,name:"encryption",kind:"enum",T:Ce.getEnumType(aa)},{no:17,name:"stream",kind:"scalar",T:9},{no:18,name:"version",kind:"message",T:eq},{no:19,name:"audio_features",kind:"enum",T:Ce.getEnumType(da),repeated:!0},{no:20,name:"backup_codec_policy",kind:"enum",T:Ce.getEnumType(q5)}]),Vl=Ce.makeMessageType("livekit.VideoLayer",()=>[{no:1,name:"quality",kind:"enum",T:Ce.getEnumType(MP)},{no:2,name:"width",kind:"scalar",T:13},{no:3,name:"height",kind:"scalar",T:13},{no:4,name:"bitrate",kind:"scalar",T:13},{no:5,name:"ssrc",kind:"scalar",T:13},{no:6,name:"spatial_layer",kind:"scalar",T:5},{no:7,name:"rid",kind:"scalar",T:9}]),z5=Ce.makeEnum("livekit.VideoLayer.Mode",[{no:0,name:"MODE_UNUSED"},{no:1,name:"ONE_SPATIAL_LAYER_PER_STREAM"},{no:2,name:"MULTIPLE_SPATIAL_LAYERS_PER_STREAM"},{no:3,name:"ONE_SPATIAL_LAYER_PER_STREAM_INCOMPLETE_RTCP_SR"}]),$a=Ce.makeMessageType("livekit.DataPacket",()=>[{no:1,name:"kind",kind:"enum",T:Ce.getEnumType(mr)},{no:4,name:"participant_identity",kind:"scalar",T:9},{no:5,name:"destination_identities",kind:"scalar",T:9,repeated:!0},{no:2,name:"user",kind:"message",T:jP,oneof:"value"},{no:3,name:"speaker",kind:"message",T:Zce,oneof:"value"},{no:6,name:"sip_dtmf",kind:"message",T:G5,oneof:"value"},{no:7,name:"transcription",kind:"message",T:ele,oneof:"value"},{no:8,name:"metrics",kind:"message",T:Hce,oneof:"value"},{no:9,name:"chat_message",kind:"message",T:sb,oneof:"value"},{no:10,name:"rpc_request",kind:"message",T:LP,oneof:"value"},{no:11,name:"rpc_ack",kind:"message",T:BP,oneof:"value"},{no:12,name:"rpc_response",kind:"message",T:UP,oneof:"value"},{no:13,name:"stream_header",kind:"message",T:ob,oneof:"value"},{no:14,name:"stream_chunk",kind:"message",T:cb,oneof:"value"},{no:15,name:"stream_trailer",kind:"message",T:lb,oneof:"value"},{no:18,name:"encrypted_packet",kind:"message",T:$5,oneof:"value"},{no:16,name:"sequence",kind:"scalar",T:13},{no:17,name:"participant_sid",kind:"scalar",T:9}]),mr=Ce.makeEnum("livekit.DataPacket.Kind",[{no:0,name:"RELIABLE"},{no:1,name:"LOSSY"}]),$5=Ce.makeMessageType("livekit.EncryptedPacket",()=>[{no:1,name:"encryption_type",kind:"enum",T:Ce.getEnumType(aa)},{no:2,name:"iv",kind:"scalar",T:12},{no:3,name:"key_index",kind:"scalar",T:13},{no:4,name:"encrypted_value",kind:"scalar",T:12}]),V5=Ce.makeMessageType("livekit.EncryptedPacketPayload",()=>[{no:1,name:"user",kind:"message",T:jP,oneof:"value"},{no:3,name:"chat_message",kind:"message",T:sb,oneof:"value"},{no:4,name:"rpc_request",kind:"message",T:LP,oneof:"value"},{no:5,name:"rpc_ack",kind:"message",T:BP,oneof:"value"},{no:6,name:"rpc_response",kind:"message",T:UP,oneof:"value"},{no:7,name:"stream_header",kind:"message",T:ob,oneof:"value"},{no:8,name:"stream_chunk",kind:"message",T:cb,oneof:"value"},{no:9,name:"stream_trailer",kind:"message",T:lb,oneof:"value"}]),Zce=Ce.makeMessageType("livekit.ActiveSpeakerUpdate",()=>[{no:1,name:"speakers",kind:"message",T:H5,repeated:!0}]),H5=Ce.makeMessageType("livekit.SpeakerInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"level",kind:"scalar",T:2},{no:3,name:"active",kind:"scalar",T:8}]),jP=Ce.makeMessageType("livekit.UserPacket",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:5,name:"participant_identity",kind:"scalar",T:9},{no:2,name:"payload",kind:"scalar",T:12},{no:3,name:"destination_sids",kind:"scalar",T:9,repeated:!0},{no:6,name:"destination_identities",kind:"scalar",T:9,repeated:!0},{no:4,name:"topic",kind:"scalar",T:9,opt:!0},{no:8,name:"id",kind:"scalar",T:9,opt:!0},{no:9,name:"start_time",kind:"scalar",T:4,opt:!0},{no:10,name:"end_time",kind:"scalar",T:4,opt:!0},{no:11,name:"nonce",kind:"scalar",T:12}]),G5=Ce.makeMessageType("livekit.SipDTMF",()=>[{no:3,name:"code",kind:"scalar",T:13},{no:4,name:"digit",kind:"scalar",T:9}]),ele=Ce.makeMessageType("livekit.Transcription",()=>[{no:2,name:"transcribed_participant_identity",kind:"scalar",T:9},{no:3,name:"track_id",kind:"scalar",T:9},{no:4,name:"segments",kind:"message",T:tle,repeated:!0}]),tle=Ce.makeMessageType("livekit.TranscriptionSegment",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"text",kind:"scalar",T:9},{no:3,name:"start_time",kind:"scalar",T:4},{no:4,name:"end_time",kind:"scalar",T:4},{no:5,name:"final",kind:"scalar",T:8},{no:6,name:"language",kind:"scalar",T:9}]),sb=Ce.makeMessageType("livekit.ChatMessage",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"timestamp",kind:"scalar",T:3},{no:3,name:"edit_timestamp",kind:"scalar",T:3,opt:!0},{no:4,name:"message",kind:"scalar",T:9},{no:5,name:"deleted",kind:"scalar",T:8},{no:6,name:"generated",kind:"scalar",T:8}]),LP=Ce.makeMessageType("livekit.RpcRequest",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"method",kind:"scalar",T:9},{no:3,name:"payload",kind:"scalar",T:9},{no:4,name:"response_timeout_ms",kind:"scalar",T:13},{no:5,name:"version",kind:"scalar",T:13}]),BP=Ce.makeMessageType("livekit.RpcAck",()=>[{no:1,name:"request_id",kind:"scalar",T:9}]),UP=Ce.makeMessageType("livekit.RpcResponse",()=>[{no:1,name:"request_id",kind:"scalar",T:9},{no:2,name:"payload",kind:"scalar",T:9,oneof:"value"},{no:3,name:"error",kind:"message",T:W5,oneof:"value"}]),W5=Ce.makeMessageType("livekit.RpcError",()=>[{no:1,name:"code",kind:"scalar",T:13},{no:2,name:"message",kind:"scalar",T:9},{no:3,name:"data",kind:"scalar",T:9}]),K5=Ce.makeMessageType("livekit.ParticipantTracks",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sids",kind:"scalar",T:9,repeated:!0}]),Y5=Ce.makeMessageType("livekit.ServerInfo",()=>[{no:1,name:"edition",kind:"enum",T:Ce.getEnumType(X5)},{no:2,name:"version",kind:"scalar",T:9},{no:3,name:"protocol",kind:"scalar",T:5},{no:4,name:"region",kind:"scalar",T:9},{no:5,name:"node_id",kind:"scalar",T:9},{no:6,name:"debug_info",kind:"scalar",T:9},{no:7,name:"agent_protocol",kind:"scalar",T:5}]),X5=Ce.makeEnum("livekit.ServerInfo.Edition",[{no:0,name:"Standard"},{no:1,name:"Cloud"}]),J5=Ce.makeMessageType("livekit.ClientInfo",()=>[{no:1,name:"sdk",kind:"enum",T:Ce.getEnumType(Q5)},{no:2,name:"version",kind:"scalar",T:9},{no:3,name:"protocol",kind:"scalar",T:5},{no:4,name:"os",kind:"scalar",T:9},{no:5,name:"os_version",kind:"scalar",T:9},{no:6,name:"device_model",kind:"scalar",T:9},{no:7,name:"browser",kind:"scalar",T:9},{no:8,name:"browser_version",kind:"scalar",T:9},{no:9,name:"address",kind:"scalar",T:9},{no:10,name:"network",kind:"scalar",T:9},{no:11,name:"other_sdks",kind:"scalar",T:9}]),Q5=Ce.makeEnum("livekit.ClientInfo.SDK",[{no:0,name:"UNKNOWN"},{no:1,name:"JS"},{no:2,name:"SWIFT"},{no:3,name:"ANDROID"},{no:4,name:"FLUTTER"},{no:5,name:"GO"},{no:6,name:"UNITY"},{no:7,name:"REACT_NATIVE"},{no:8,name:"RUST"},{no:9,name:"PYTHON"},{no:10,name:"CPP"},{no:11,name:"UNITY_WEB"},{no:12,name:"NODE"},{no:13,name:"UNREAL"},{no:14,name:"ESP32"}]),Z5=Ce.makeMessageType("livekit.ClientConfiguration",()=>[{no:1,name:"video",kind:"message",T:cM},{no:2,name:"screen",kind:"message",T:cM},{no:3,name:"resume_connection",kind:"enum",T:Ce.getEnumType($m)},{no:4,name:"disabled_codecs",kind:"message",T:rle},{no:5,name:"force_relay",kind:"enum",T:Ce.getEnumType($m)}]),cM=Ce.makeMessageType("livekit.VideoConfiguration",()=>[{no:1,name:"hardware_encoder",kind:"enum",T:Ce.getEnumType($m)}]),rle=Ce.makeMessageType("livekit.DisabledCodecs",()=>[{no:1,name:"codecs",kind:"message",T:ib,repeated:!0},{no:2,name:"publish",kind:"message",T:ib,repeated:!0}]),eq=Ce.makeMessageType("livekit.TimedVersion",()=>[{no:1,name:"unix_micro",kind:"scalar",T:3},{no:2,name:"ticks",kind:"scalar",T:5}]),aC=Ce.makeEnum("livekit.DataStream.OperationType",[{no:0,name:"CREATE"},{no:1,name:"UPDATE"},{no:2,name:"DELETE"},{no:3,name:"REACTION"}]),tq=Ce.makeMessageType("livekit.DataStream.TextHeader",()=>[{no:1,name:"operation_type",kind:"enum",T:Ce.getEnumType(aC)},{no:2,name:"version",kind:"scalar",T:5},{no:3,name:"reply_to_stream_id",kind:"scalar",T:9},{no:4,name:"attached_stream_ids",kind:"scalar",T:9,repeated:!0},{no:5,name:"generated",kind:"scalar",T:8}],{localName:"DataStream_TextHeader"}),rq=Ce.makeMessageType("livekit.DataStream.ByteHeader",()=>[{no:1,name:"name",kind:"scalar",T:9}],{localName:"DataStream_ByteHeader"}),ob=Ce.makeMessageType("livekit.DataStream.Header",()=>[{no:1,name:"stream_id",kind:"scalar",T:9},{no:2,name:"timestamp",kind:"scalar",T:3},{no:3,name:"topic",kind:"scalar",T:9},{no:4,name:"mime_type",kind:"scalar",T:9},{no:5,name:"total_length",kind:"scalar",T:4,opt:!0},{no:7,name:"encryption_type",kind:"enum",T:Ce.getEnumType(aa)},{no:8,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:9,name:"text_header",kind:"message",T:tq,oneof:"content_header"},{no:10,name:"byte_header",kind:"message",T:rq,oneof:"content_header"}],{localName:"DataStream_Header"}),cb=Ce.makeMessageType("livekit.DataStream.Chunk",()=>[{no:1,name:"stream_id",kind:"scalar",T:9},{no:2,name:"chunk_index",kind:"scalar",T:4},{no:3,name:"content",kind:"scalar",T:12},{no:4,name:"version",kind:"scalar",T:5},{no:5,name:"iv",kind:"scalar",T:12,opt:!0}],{localName:"DataStream_Chunk"}),lb=Ce.makeMessageType("livekit.DataStream.Trailer",()=>[{no:1,name:"stream_id",kind:"scalar",T:9},{no:2,name:"reason",kind:"scalar",T:9},{no:3,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}}],{localName:"DataStream_Trailer"}),nle=Ce.makeMessageType("livekit.SubscribedAudioCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"enabled",kind:"scalar",T:8}]),$s=Ce.makeEnum("livekit.SignalTarget",[{no:0,name:"PUBLISHER"},{no:1,name:"SUBSCRIBER"}]),iC=Ce.makeEnum("livekit.StreamState",[{no:0,name:"ACTIVE"},{no:1,name:"PAUSED"}]),ale=Ce.makeEnum("livekit.CandidateProtocol",[{no:0,name:"UDP"},{no:1,name:"TCP"},{no:2,name:"TLS"}]),ile=Ce.makeMessageType("livekit.SignalRequest",()=>[{no:1,name:"offer",kind:"message",T:nu,oneof:"message"},{no:2,name:"answer",kind:"message",T:nu,oneof:"message"},{no:3,name:"trickle",kind:"message",T:u0,oneof:"message"},{no:4,name:"add_track",kind:"message",T:Hm,oneof:"message"},{no:5,name:"mute",kind:"message",T:d0,oneof:"message"},{no:6,name:"subscription",kind:"message",T:f0,oneof:"message"},{no:7,name:"track_setting",kind:"message",T:nq,oneof:"message"},{no:8,name:"leave",kind:"message",T:p0,oneof:"message"},{no:10,name:"update_layers",kind:"message",T:iq,oneof:"message"},{no:11,name:"subscription_permission",kind:"message",T:cq,oneof:"message"},{no:12,name:"sync_state",kind:"message",T:VP,oneof:"message"},{no:13,name:"simulate",kind:"message",T:Ao,oneof:"message"},{no:14,name:"ping",kind:"scalar",T:3,oneof:"message"},{no:15,name:"update_metadata",kind:"message",T:zP,oneof:"message"},{no:16,name:"ping_req",kind:"message",T:dq,oneof:"message"},{no:17,name:"update_audio_track",kind:"message",T:qP,oneof:"message"},{no:18,name:"update_video_track",kind:"message",T:aq,oneof:"message"}]),lM=Ce.makeMessageType("livekit.SignalResponse",()=>[{no:1,name:"join",kind:"message",T:sle,oneof:"message"},{no:2,name:"answer",kind:"message",T:nu,oneof:"message"},{no:3,name:"offer",kind:"message",T:nu,oneof:"message"},{no:4,name:"trickle",kind:"message",T:u0,oneof:"message"},{no:5,name:"update",kind:"message",T:lle,oneof:"message"},{no:6,name:"track_published",kind:"message",T:FP,oneof:"message"},{no:8,name:"leave",kind:"message",T:p0,oneof:"message"},{no:9,name:"mute",kind:"message",T:d0,oneof:"message"},{no:10,name:"speakers_changed",kind:"message",T:ule,oneof:"message"},{no:11,name:"room_update",kind:"message",T:dle,oneof:"message"},{no:12,name:"connection_quality",kind:"message",T:ple,oneof:"message"},{no:13,name:"stream_state_update",kind:"message",T:mle,oneof:"message"},{no:14,name:"subscribed_quality_update",kind:"message",T:yle,oneof:"message"},{no:15,name:"subscription_permission_update",kind:"message",T:_le,oneof:"message"},{no:16,name:"refresh_token",kind:"scalar",T:9,oneof:"message"},{no:17,name:"track_unpublished",kind:"message",T:cle,oneof:"message"},{no:18,name:"pong",kind:"scalar",T:3,oneof:"message"},{no:19,name:"reconnect",kind:"message",T:ole,oneof:"message"},{no:20,name:"pong_resp",kind:"message",T:kle,oneof:"message"},{no:21,name:"subscription_response",kind:"message",T:Ele,oneof:"message"},{no:22,name:"request_response",kind:"message",T:Tle,oneof:"message"},{no:23,name:"track_subscribed",kind:"message",T:Cle,oneof:"message"},{no:24,name:"room_moved",kind:"message",T:ble,oneof:"message"},{no:25,name:"media_sections_requirement",kind:"message",T:Rle,oneof:"message"},{no:26,name:"subscribed_audio_codec_update",kind:"message",T:vle,oneof:"message"}]),sC=Ce.makeMessageType("livekit.SimulcastCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"cid",kind:"scalar",T:9},{no:4,name:"layers",kind:"message",T:Vl,repeated:!0},{no:5,name:"video_layer_mode",kind:"enum",T:Ce.getEnumType(z5)}]),Hm=Ce.makeMessageType("livekit.AddTrackRequest",()=>[{no:1,name:"cid",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"type",kind:"enum",T:Ce.getEnumType(zs)},{no:4,name:"width",kind:"scalar",T:13},{no:5,name:"height",kind:"scalar",T:13},{no:6,name:"muted",kind:"scalar",T:8},{no:7,name:"disable_dtx",kind:"scalar",T:8},{no:8,name:"source",kind:"enum",T:Ce.getEnumType(Yn)},{no:9,name:"layers",kind:"message",T:Vl,repeated:!0},{no:10,name:"simulcast_codecs",kind:"message",T:sC,repeated:!0},{no:11,name:"sid",kind:"scalar",T:9},{no:12,name:"stereo",kind:"scalar",T:8},{no:13,name:"disable_red",kind:"scalar",T:8},{no:14,name:"encryption",kind:"enum",T:Ce.getEnumType(aa)},{no:15,name:"stream",kind:"scalar",T:9},{no:16,name:"backup_codec_policy",kind:"enum",T:Ce.getEnumType(q5)},{no:17,name:"audio_features",kind:"enum",T:Ce.getEnumType(da),repeated:!0}]),u0=Ce.makeMessageType("livekit.TrickleRequest",()=>[{no:1,name:"candidateInit",kind:"scalar",T:9},{no:2,name:"target",kind:"enum",T:Ce.getEnumType($s)},{no:3,name:"final",kind:"scalar",T:8}]),d0=Ce.makeMessageType("livekit.MuteTrackRequest",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"muted",kind:"scalar",T:8}]),sle=Ce.makeMessageType("livekit.JoinResponse",()=>[{no:1,name:"room",kind:"message",T:l0},{no:2,name:"participant",kind:"message",T:fd},{no:3,name:"other_participants",kind:"message",T:fd,repeated:!0},{no:4,name:"server_version",kind:"scalar",T:9},{no:5,name:"ice_servers",kind:"message",T:sq,repeated:!0},{no:6,name:"subscriber_primary",kind:"scalar",T:8},{no:7,name:"alternative_url",kind:"scalar",T:9},{no:8,name:"client_configuration",kind:"message",T:Z5},{no:9,name:"server_region",kind:"scalar",T:9},{no:10,name:"ping_timeout",kind:"scalar",T:5},{no:11,name:"ping_interval",kind:"scalar",T:5},{no:12,name:"server_info",kind:"message",T:Y5},{no:13,name:"sif_trailer",kind:"scalar",T:12},{no:14,name:"enabled_publish_codecs",kind:"message",T:ib,repeated:!0},{no:15,name:"fast_publish",kind:"scalar",T:8}]),ole=Ce.makeMessageType("livekit.ReconnectResponse",()=>[{no:1,name:"ice_servers",kind:"message",T:sq,repeated:!0},{no:2,name:"client_configuration",kind:"message",T:Z5},{no:3,name:"server_info",kind:"message",T:Y5},{no:4,name:"last_message_seq",kind:"scalar",T:13}]),FP=Ce.makeMessageType("livekit.TrackPublishedResponse",()=>[{no:1,name:"cid",kind:"scalar",T:9},{no:2,name:"track",kind:"message",T:Tf}]),cle=Ce.makeMessageType("livekit.TrackUnpublishedResponse",()=>[{no:1,name:"track_sid",kind:"scalar",T:9}]),nu=Ce.makeMessageType("livekit.SessionDescription",()=>[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"sdp",kind:"scalar",T:9},{no:3,name:"id",kind:"scalar",T:13},{no:4,name:"mid_to_track_id",kind:"map",K:9,V:{kind:"scalar",T:9}}]),lle=Ce.makeMessageType("livekit.ParticipantUpdate",()=>[{no:1,name:"participants",kind:"message",T:fd,repeated:!0}]),f0=Ce.makeMessageType("livekit.UpdateSubscription",()=>[{no:1,name:"track_sids",kind:"scalar",T:9,repeated:!0},{no:2,name:"subscribe",kind:"scalar",T:8},{no:3,name:"participant_tracks",kind:"message",T:K5,repeated:!0}]),nq=Ce.makeMessageType("livekit.UpdateTrackSettings",()=>[{no:1,name:"track_sids",kind:"scalar",T:9,repeated:!0},{no:3,name:"disabled",kind:"scalar",T:8},{no:4,name:"quality",kind:"enum",T:Ce.getEnumType(MP)},{no:5,name:"width",kind:"scalar",T:13},{no:6,name:"height",kind:"scalar",T:13},{no:7,name:"fps",kind:"scalar",T:13},{no:8,name:"priority",kind:"scalar",T:13}]),qP=Ce.makeMessageType("livekit.UpdateLocalAudioTrack",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"features",kind:"enum",T:Ce.getEnumType(da),repeated:!0}]),aq=Ce.makeMessageType("livekit.UpdateLocalVideoTrack",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"width",kind:"scalar",T:13},{no:3,name:"height",kind:"scalar",T:13}]),p0=Ce.makeMessageType("livekit.LeaveRequest",()=>[{no:1,name:"can_reconnect",kind:"scalar",T:8},{no:2,name:"reason",kind:"enum",T:Ce.getEnumType(Ws)},{no:3,name:"action",kind:"enum",T:Ce.getEnumType(qf)},{no:4,name:"regions",kind:"message",T:wle}]),qf=Ce.makeEnum("livekit.LeaveRequest.Action",[{no:0,name:"DISCONNECT"},{no:1,name:"RESUME"},{no:2,name:"RECONNECT"}]),iq=Ce.makeMessageType("livekit.UpdateVideoLayers",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"layers",kind:"message",T:Vl,repeated:!0}]),zP=Ce.makeMessageType("livekit.UpdateParticipantMetadata",()=>[{no:1,name:"metadata",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:4,name:"request_id",kind:"scalar",T:13}]),sq=Ce.makeMessageType("livekit.ICEServer",()=>[{no:1,name:"urls",kind:"scalar",T:9,repeated:!0},{no:2,name:"username",kind:"scalar",T:9},{no:3,name:"credential",kind:"scalar",T:9}]),ule=Ce.makeMessageType("livekit.SpeakersChanged",()=>[{no:1,name:"speakers",kind:"message",T:H5,repeated:!0}]),dle=Ce.makeMessageType("livekit.RoomUpdate",()=>[{no:1,name:"room",kind:"message",T:l0}]),fle=Ce.makeMessageType("livekit.ConnectionQualityInfo",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"quality",kind:"enum",T:Ce.getEnumType(Jh)},{no:3,name:"score",kind:"scalar",T:2}]),ple=Ce.makeMessageType("livekit.ConnectionQualityUpdate",()=>[{no:1,name:"updates",kind:"message",T:fle,repeated:!0}]),hle=Ce.makeMessageType("livekit.StreamStateInfo",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sid",kind:"scalar",T:9},{no:3,name:"state",kind:"enum",T:Ce.getEnumType(iC)}]),mle=Ce.makeMessageType("livekit.StreamStateUpdate",()=>[{no:1,name:"stream_states",kind:"message",T:hle,repeated:!0}]),$P=Ce.makeMessageType("livekit.SubscribedQuality",()=>[{no:1,name:"quality",kind:"enum",T:Ce.getEnumType(MP)},{no:2,name:"enabled",kind:"scalar",T:8}]),gle=Ce.makeMessageType("livekit.SubscribedCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"qualities",kind:"message",T:$P,repeated:!0}]),yle=Ce.makeMessageType("livekit.SubscribedQualityUpdate",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"subscribed_qualities",kind:"message",T:$P,repeated:!0},{no:3,name:"subscribed_codecs",kind:"message",T:gle,repeated:!0}]),vle=Ce.makeMessageType("livekit.SubscribedAudioCodecUpdate",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"subscribed_audio_codecs",kind:"message",T:nle,repeated:!0}]),oq=Ce.makeMessageType("livekit.TrackPermission",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"all_tracks",kind:"scalar",T:8},{no:3,name:"track_sids",kind:"scalar",T:9,repeated:!0},{no:4,name:"participant_identity",kind:"scalar",T:9}]),cq=Ce.makeMessageType("livekit.SubscriptionPermission",()=>[{no:1,name:"all_participants",kind:"scalar",T:8},{no:2,name:"track_permissions",kind:"message",T:oq,repeated:!0}]),_le=Ce.makeMessageType("livekit.SubscriptionPermissionUpdate",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sid",kind:"scalar",T:9},{no:3,name:"allowed",kind:"scalar",T:8}]),ble=Ce.makeMessageType("livekit.RoomMovedResponse",()=>[{no:1,name:"room",kind:"message",T:l0},{no:2,name:"token",kind:"scalar",T:9},{no:3,name:"participant",kind:"message",T:fd},{no:4,name:"other_participants",kind:"message",T:fd,repeated:!0}]),VP=Ce.makeMessageType("livekit.SyncState",()=>[{no:1,name:"answer",kind:"message",T:nu},{no:2,name:"subscription",kind:"message",T:f0},{no:3,name:"publish_tracks",kind:"message",T:FP,repeated:!0},{no:4,name:"data_channels",kind:"message",T:uq,repeated:!0},{no:5,name:"offer",kind:"message",T:nu},{no:6,name:"track_sids_disabled",kind:"scalar",T:9,repeated:!0},{no:7,name:"datachannel_receive_states",kind:"message",T:lq,repeated:!0}]),lq=Ce.makeMessageType("livekit.DataChannelReceiveState",()=>[{no:1,name:"publisher_sid",kind:"scalar",T:9},{no:2,name:"last_seq",kind:"scalar",T:13}]),uq=Ce.makeMessageType("livekit.DataChannelInfo",()=>[{no:1,name:"label",kind:"scalar",T:9},{no:2,name:"id",kind:"scalar",T:13},{no:3,name:"target",kind:"enum",T:Ce.getEnumType($s)}]),Ao=Ce.makeMessageType("livekit.SimulateScenario",()=>[{no:1,name:"speaker_update",kind:"scalar",T:5,oneof:"scenario"},{no:2,name:"node_failure",kind:"scalar",T:8,oneof:"scenario"},{no:3,name:"migration",kind:"scalar",T:8,oneof:"scenario"},{no:4,name:"server_leave",kind:"scalar",T:8,oneof:"scenario"},{no:5,name:"switch_candidate_protocol",kind:"enum",T:Ce.getEnumType(ale),oneof:"scenario"},{no:6,name:"subscriber_bandwidth",kind:"scalar",T:3,oneof:"scenario"},{no:7,name:"disconnect_signal_on_resume",kind:"scalar",T:8,oneof:"scenario"},{no:8,name:"disconnect_signal_on_resume_no_messages",kind:"scalar",T:8,oneof:"scenario"},{no:9,name:"leave_request_full_reconnect",kind:"scalar",T:8,oneof:"scenario"}]),dq=Ce.makeMessageType("livekit.Ping",()=>[{no:1,name:"timestamp",kind:"scalar",T:3},{no:2,name:"rtt",kind:"scalar",T:3}]),kle=Ce.makeMessageType("livekit.Pong",()=>[{no:1,name:"last_ping_timestamp",kind:"scalar",T:3},{no:2,name:"timestamp",kind:"scalar",T:3}]),wle=Ce.makeMessageType("livekit.RegionSettings",()=>[{no:1,name:"regions",kind:"message",T:Sle,repeated:!0}]),Sle=Ce.makeMessageType("livekit.RegionInfo",()=>[{no:1,name:"region",kind:"scalar",T:9},{no:2,name:"url",kind:"scalar",T:9},{no:3,name:"distance",kind:"scalar",T:3}]),Ele=Ce.makeMessageType("livekit.SubscriptionResponse",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"err",kind:"enum",T:Ce.getEnumType(Yce)}]),Tle=Ce.makeMessageType("livekit.RequestResponse",()=>[{no:1,name:"request_id",kind:"scalar",T:13},{no:2,name:"reason",kind:"enum",T:Ce.getEnumType(HP)},{no:3,name:"message",kind:"scalar",T:9},{no:4,name:"trickle",kind:"message",T:u0,oneof:"request"},{no:5,name:"add_track",kind:"message",T:Hm,oneof:"request"},{no:6,name:"mute",kind:"message",T:d0,oneof:"request"},{no:7,name:"update_metadata",kind:"message",T:zP,oneof:"request"},{no:8,name:"update_audio_track",kind:"message",T:qP,oneof:"request"},{no:9,name:"update_video_track",kind:"message",T:aq,oneof:"request"}]),HP=Ce.makeEnum("livekit.RequestResponse.Reason",[{no:0,name:"OK"},{no:1,name:"NOT_FOUND"},{no:2,name:"NOT_ALLOWED"},{no:3,name:"LIMIT_EXCEEDED"},{no:4,name:"QUEUED"},{no:5,name:"UNSUPPORTED_TYPE"},{no:6,name:"UNCLASSIFIED_ERROR"}]),Cle=Ce.makeMessageType("livekit.TrackSubscribed",()=>[{no:1,name:"track_sid",kind:"scalar",T:9}]),fq=Ce.makeMessageType("livekit.ConnectionSettings",()=>[{no:1,name:"auto_subscribe",kind:"scalar",T:8},{no:2,name:"adaptive_stream",kind:"scalar",T:8},{no:3,name:"subscriber_allow_pause",kind:"scalar",T:8,opt:!0},{no:4,name:"disable_ice_lite",kind:"scalar",T:8}]),xle=Ce.makeMessageType("livekit.JoinRequest",()=>[{no:1,name:"client_info",kind:"message",T:J5},{no:2,name:"connection_settings",kind:"message",T:fq},{no:3,name:"metadata",kind:"scalar",T:9},{no:4,name:"participant_attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:5,name:"add_track_requests",kind:"message",T:Hm,repeated:!0},{no:6,name:"publisher_offer",kind:"message",T:nu},{no:7,name:"reconnect",kind:"scalar",T:8},{no:8,name:"reconnect_reason",kind:"enum",T:Ce.getEnumType(zu)},{no:9,name:"participant_sid",kind:"scalar",T:9},{no:10,name:"sync_state",kind:"message",T:VP}]),Ple=Ce.makeMessageType("livekit.WrappedJoinRequest",()=>[{no:1,name:"compression",kind:"enum",T:Ce.getEnumType(Ale)},{no:2,name:"join_request",kind:"scalar",T:12}]),Ale=Ce.makeEnum("livekit.WrappedJoinRequest.Compression",[{no:0,name:"NONE"},{no:1,name:"GZIP"}]),Rle=Ce.makeMessageType("livekit.MediaSectionsRequirement",()=>[{no:1,name:"num_audios",kind:"scalar",T:13},{no:2,name:"num_videos",kind:"scalar",T:13}]);function Dle(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var l_={exports:{}},Ole=l_.exports,uM;function Nle(){return uM||(uM=1,(function(t){(function(e,r){t.exports?t.exports=r():e.log=r()})(Ole,function(){var e=function(){},r="undefined",n=typeof window!==r&&typeof window.navigator!==r&&/Trident\/|MSIE /.test(window.navigator.userAgent),a=["trace","debug","info","warn","error"],i={},o=null;function c(b,E){var T=b[E];if(typeof T.bind=="function")return T.bind(b);try{return Function.prototype.bind.call(T,b)}catch{return function(){return Function.prototype.apply.apply(T,[b,arguments])}}}function u(){console.log&&(console.log.apply||Function.prototype.apply.apply(console.log,[console,arguments]))}function d(b){return b==="debug"&&(b="log"),typeof console===r?!1:b==="trace"&&n?u:console[b]!==void 0?c(console,b):console.log!==void 0?c(console,"log"):e}function f(){for(var b=this.getLevel(),E=0;E<a.length;E++){var T=a[E];this[T]=E<b?e:this.methodFactory(T,b,this.name)}if(this.log=this.debug,typeof console===r&&b<this.levels.SILENT)return"No console available for logging"}function h(b){return function(){typeof console!==r&&(f.call(this),this[b].apply(this,arguments))}}function m(b,E,T){return d(b)||h.apply(this,arguments)}function _(b,E){var T=this,D,P,A,C="loglevel";typeof b=="string"?C+=":"+b:typeof b=="symbol"&&(C=void 0);function O(L){var j=(a[L]||"silent").toUpperCase();if(!(typeof window===r||!C)){try{window.localStorage[C]=j;return}catch{}try{window.document.cookie=encodeURIComponent(C)+"="+j+";"}catch{}}}function I(){var L;if(!(typeof window===r||!C)){try{L=window.localStorage[C]}catch{}if(typeof L===r)try{var j=window.document.cookie,q=encodeURIComponent(C),U=j.indexOf(q+"=");U!==-1&&(L=/^([^;]+)/.exec(j.slice(U+q.length+1))[1])}catch{}return T.levels[L]===void 0&&(L=void 0),L}}function x(){if(!(typeof window===r||!C)){try{window.localStorage.removeItem(C)}catch{}try{window.document.cookie=encodeURIComponent(C)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function R(L){var j=L;if(typeof j=="string"&&T.levels[j.toUpperCase()]!==void 0&&(j=T.levels[j.toUpperCase()]),typeof j=="number"&&j>=0&&j<=T.levels.SILENT)return j;throw new TypeError("log.setLevel() called with invalid level: "+L)}T.name=b,T.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},T.methodFactory=E||m,T.getLevel=function(){return A??P??D},T.setLevel=function(L,j){return A=R(L),j!==!1&&O(A),f.call(T)},T.setDefaultLevel=function(L){P=R(L),I()||T.setLevel(L,!1)},T.resetLevel=function(){A=null,x(),f.call(T)},T.enableAll=function(L){T.setLevel(T.levels.TRACE,L)},T.disableAll=function(L){T.setLevel(T.levels.SILENT,L)},T.rebuild=function(){if(o!==T&&(D=R(o.getLevel())),f.call(T),o===T)for(var L in i)i[L].rebuild()},D=R(o?o.getLevel():"WARN");var N=I();N!=null&&(A=R(N)),f.call(T)}o=new _,o.getLogger=function(E){if(typeof E!="symbol"&&typeof E!="string"||E==="")throw new TypeError("You must supply a name when creating a logger.");var T=i[E];return T||(T=i[E]=new _(E,o.methodFactory)),T};var w=typeof window!==r?window.log:void 0;return o.noConflict=function(){return typeof window!==r&&window.log===o&&(window.log=w),o},o.getLoggers=function(){return i},o.default=o,o})})(l_)),l_.exports}var h0=Nle(),oC;(function(t){t[t.trace=0]="trace",t[t.debug=1]="debug",t[t.info=2]="info",t[t.warn=3]="warn",t[t.error=4]="error",t[t.silent=5]="silent"})(oC||(oC={}));var eo;(function(t){t.Default="livekit",t.Room="livekit-room",t.TokenSource="livekit-token-source",t.Participant="livekit-participant",t.Track="livekit-track",t.Publication="livekit-track-publication",t.Engine="livekit-engine",t.Signal="livekit-signal",t.PCManager="livekit-pc-manager",t.PCTransport="livekit-pc-transport",t.E2EE="lk-e2ee"})(eo||(eo={}));let or=h0.getLogger("livekit");Object.values(eo).map(t=>h0.getLogger(t));or.setDefaultLevel(oC.info);function Vc(t){const e=h0.getLogger(t);return e.setDefaultLevel(or.getLevel()),e}const Ile=h0.getLogger("lk-e2ee"),Ah=7e3,Mle=[0,300,4*300,9*300,16*300,Ah,Ah,Ah,Ah,Ah];class jle{constructor(e){this._retryDelays=e!==void 0?[...e]:Mle}nextRetryDelayInMs(e){if(e.retryCount>=this._retryDelays.length)return null;const r=this._retryDelays[e.retryCount];return e.retryCount<=1?r:r+Math.random()*1e3}}function Lle(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(t);a<n.length;a++)e.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(t,n[a])&&(r[n[a]]=t[n[a]]);return r}function ne(t,e,r,n){function a(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function c(f){try{d(n.next(f))}catch(h){o(h)}}function u(f){try{d(n.throw(f))}catch(h){o(h)}}function d(f){f.done?i(f.value):a(f.value).then(c,u)}d((n=n.apply(t,e||[])).next())})}function dM(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ac(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof dM=="function"?dM(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(o){return new Promise(function(c,u){o=t[i](o),a(c,u,o.done,o.value)})}}function a(i,o,c,u){Promise.resolve(u).then(function(d){i({value:d,done:c})},o)}}var bv={exports:{}},fM;function Ble(){if(fM)return bv.exports;fM=1;var t=typeof Reflect=="object"?Reflect:null,e=t&&typeof t.apply=="function"?t.apply:function(C,O,I){return Function.prototype.apply.call(C,O,I)},r;t&&typeof t.ownKeys=="function"?r=t.ownKeys:Object.getOwnPropertySymbols?r=function(C){return Object.getOwnPropertyNames(C).concat(Object.getOwnPropertySymbols(C))}:r=function(C){return Object.getOwnPropertyNames(C)};function n(A){}var a=Number.isNaN||function(C){return C!==C};function i(){i.init.call(this)}bv.exports=i,bv.exports.once=T,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var o=10;function c(A){if(typeof A!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof A)}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(A){if(typeof A!="number"||A<0||a(A))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+A+".");o=A}}),i.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(C){if(typeof C!="number"||C<0||a(C))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+C+".");return this._maxListeners=C,this};function u(A){return A._maxListeners===void 0?i.defaultMaxListeners:A._maxListeners}i.prototype.getMaxListeners=function(){return u(this)},i.prototype.emit=function(C){for(var O=[],I=1;I<arguments.length;I++)O.push(arguments[I]);var x=C==="error",R=this._events;if(R!==void 0)x=x&&R.error===void 0;else if(!x)return!1;if(x){var N;if(O.length>0&&(N=O[0]),N instanceof Error)throw N;var L=new Error("Unhandled error."+(N?" ("+N.message+")":""));throw L.context=N,L}var j=R[C];if(j===void 0)return!1;if(typeof j=="function")e(j,this,O);else for(var q=j.length,U=w(j,q),I=0;I<q;++I)e(U[I],this,O);return!0};function d(A,C,O,I){var x,R,N;if(c(O),R=A._events,R===void 0?(R=A._events=Object.create(null),A._eventsCount=0):(R.newListener!==void 0&&(A.emit("newListener",C,O.listener?O.listener:O),R=A._events),N=R[C]),N===void 0)N=R[C]=O,++A._eventsCount;else if(typeof N=="function"?N=R[C]=I?[O,N]:[N,O]:I?N.unshift(O):N.push(O),x=u(A),x>0&&N.length>x&&!N.warned){N.warned=!0;var L=new Error("Possible EventEmitter memory leak detected. "+N.length+" "+String(C)+" listeners added. Use emitter.setMaxListeners() to increase limit");L.name="MaxListenersExceededWarning",L.emitter=A,L.type=C,L.count=N.length}return A}i.prototype.addListener=function(C,O){return d(this,C,O,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(C,O){return d(this,C,O,!0)};function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(A,C,O){var I={fired:!1,wrapFn:void 0,target:A,type:C,listener:O},x=f.bind(I);return x.listener=O,I.wrapFn=x,x}i.prototype.once=function(C,O){return c(O),this.on(C,h(this,C,O)),this},i.prototype.prependOnceListener=function(C,O){return c(O),this.prependListener(C,h(this,C,O)),this},i.prototype.removeListener=function(C,O){var I,x,R,N,L;if(c(O),x=this._events,x===void 0)return this;if(I=x[C],I===void 0)return this;if(I===O||I.listener===O)--this._eventsCount===0?this._events=Object.create(null):(delete x[C],x.removeListener&&this.emit("removeListener",C,I.listener||O));else if(typeof I!="function"){for(R=-1,N=I.length-1;N>=0;N--)if(I[N]===O||I[N].listener===O){L=I[N].listener,R=N;break}if(R<0)return this;R===0?I.shift():b(I,R),I.length===1&&(x[C]=I[0]),x.removeListener!==void 0&&this.emit("removeListener",C,L||O)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(C){var O,I,x;if(I=this._events,I===void 0)return this;if(I.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):I[C]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete I[C]),this;if(arguments.length===0){var R=Object.keys(I),N;for(x=0;x<R.length;++x)N=R[x],N!=="removeListener"&&this.removeAllListeners(N);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(O=I[C],typeof O=="function")this.removeListener(C,O);else if(O!==void 0)for(x=O.length-1;x>=0;x--)this.removeListener(C,O[x]);return this};function m(A,C,O){var I=A._events;if(I===void 0)return[];var x=I[C];return x===void 0?[]:typeof x=="function"?O?[x.listener||x]:[x]:O?E(x):w(x,x.length)}i.prototype.listeners=function(C){return m(this,C,!0)},i.prototype.rawListeners=function(C){return m(this,C,!1)},i.listenerCount=function(A,C){return typeof A.listenerCount=="function"?A.listenerCount(C):_.call(A,C)},i.prototype.listenerCount=_;function _(A){var C=this._events;if(C!==void 0){var O=C[A];if(typeof O=="function")return 1;if(O!==void 0)return O.length}return 0}i.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]};function w(A,C){for(var O=new Array(C),I=0;I<C;++I)O[I]=A[I];return O}function b(A,C){for(;C+1<A.length;C++)A[C]=A[C+1];A.pop()}function E(A){for(var C=new Array(A.length),O=0;O<C.length;++O)C[O]=A[O].listener||A[O];return C}function T(A,C){return new Promise(function(O,I){function x(N){A.removeListener(C,R),I(N)}function R(){typeof A.removeListener=="function"&&A.removeListener("error",x),O([].slice.call(arguments))}P(A,C,R,{once:!0}),C!=="error"&&D(A,x,{once:!0})})}function D(A,C,O){typeof A.on=="function"&&P(A,"error",C,O)}function P(A,C,O,I){if(typeof A.on=="function")I.once?A.once(C,O):A.on(C,O);else if(typeof A.addEventListener=="function")A.addEventListener(C,function x(R){I.once&&A.removeEventListener(C,x),O(R)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof A)}return bv.exports}var Zo=Ble();let pq=!0,Ule=!0;function Qh(t,e,r){const n=t.match(e);return n&&n.length>=r&&parseFloat(n[r],10)}function _d(t,e,r){if(!t.RTCPeerConnection)return;const n=t.RTCPeerConnection.prototype,a=n.addEventListener;n.addEventListener=function(o,c){if(o!==e)return a.apply(this,arguments);const u=d=>{const f=r(d);f&&(c.handleEvent?c.handleEvent(f):c(f))};return this._eventMap=this._eventMap||{},this._eventMap[e]||(this._eventMap[e]=new Map),this._eventMap[e].set(c,u),a.apply(this,[o,u])};const i=n.removeEventListener;n.removeEventListener=function(o,c){if(o!==e||!this._eventMap||!this._eventMap[e])return i.apply(this,arguments);if(!this._eventMap[e].has(c))return i.apply(this,arguments);const u=this._eventMap[e].get(c);return this._eventMap[e].delete(c),this._eventMap[e].size===0&&delete this._eventMap[e],Object.keys(this._eventMap).length===0&&delete this._eventMap,i.apply(this,[o,u])},Object.defineProperty(n,"on"+e,{get(){return this["_on"+e]},set(o){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),o&&this.addEventListener(e,this["_on"+e]=o)},enumerable:!0,configurable:!0})}function Fle(t){return typeof t!="boolean"?new Error("Argument type: "+typeof t+". Please use a boolean."):(pq=t,t?"adapter.js logging disabled":"adapter.js logging enabled")}function qle(t){return typeof t!="boolean"?new Error("Argument type: "+typeof t+". Please use a boolean."):(Ule=!t,"adapter.js deprecation warnings "+(t?"disabled":"enabled"))}function hq(){}function zle(t){const e={browser:null,version:null};if(typeof t>"u"||!t.navigator||!t.navigator.userAgent)return e.browser="Not a browser.",e;const{navigator:r}=t;if(r.userAgentData&&r.userAgentData.brands){const n=r.userAgentData.brands.find(a=>a.brand==="Chromium");if(n)return{browser:"chrome",version:parseInt(n.version,10)}}if(r.mozGetUserMedia)e.browser="firefox",e.version=parseInt(Qh(r.userAgent,/Firefox\/(\d+)\./,1));else if(r.webkitGetUserMedia||t.isSecureContext===!1&&t.webkitRTCPeerConnection)e.browser="chrome",e.version=parseInt(Qh(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2));else if(t.RTCPeerConnection&&r.userAgent.match(/AppleWebKit\/(\d+)\./))e.browser="safari",e.version=parseInt(Qh(r.userAgent,/AppleWebKit\/(\d+)\./,1)),e.supportsUnifiedPlan=t.RTCRtpTransceiver&&"currentDirection"in t.RTCRtpTransceiver.prototype,e._safariVersion=Qh(r.userAgent,/Version\/(\d+(\.?\d+))/,1);else return e.browser="Not a supported browser.",e;return e}function pM(t){return Object.prototype.toString.call(t)==="[object Object]"}function mq(t){return pM(t)?Object.keys(t).reduce(function(e,r){const n=pM(t[r]),a=n?mq(t[r]):t[r],i=n&&!Object.keys(a).length;return a===void 0||i?e:Object.assign(e,{[r]:a})},{}):t}function cC(t,e,r){!e||r.has(e.id)||(r.set(e.id,e),Object.keys(e).forEach(n=>{n.endsWith("Id")?cC(t,t.get(e[n]),r):n.endsWith("Ids")&&e[n].forEach(a=>{cC(t,t.get(a),r)})}))}function hM(t,e,r){const n=r?"outbound-rtp":"inbound-rtp",a=new Map;if(e===null)return a;const i=[];return t.forEach(o=>{o.type==="track"&&o.trackIdentifier===e.id&&i.push(o)}),i.forEach(o=>{t.forEach(c=>{c.type===n&&c.trackId===o.id&&cC(t,c,a)})}),a}const mM=hq;function gq(t,e){const r=t&&t.navigator;if(!r.mediaDevices)return;const n=function(c){if(typeof c!="object"||c.mandatory||c.optional)return c;const u={};return Object.keys(c).forEach(d=>{if(d==="require"||d==="advanced"||d==="mediaSource")return;const f=typeof c[d]=="object"?c[d]:{ideal:c[d]};f.exact!==void 0&&typeof f.exact=="number"&&(f.min=f.max=f.exact);const h=function(m,_){return m?m+_.charAt(0).toUpperCase()+_.slice(1):_==="deviceId"?"sourceId":_};if(f.ideal!==void 0){u.optional=u.optional||[];let m={};typeof f.ideal=="number"?(m[h("min",d)]=f.ideal,u.optional.push(m),m={},m[h("max",d)]=f.ideal,u.optional.push(m)):(m[h("",d)]=f.ideal,u.optional.push(m))}f.exact!==void 0&&typeof f.exact!="number"?(u.mandatory=u.mandatory||{},u.mandatory[h("",d)]=f.exact):["min","max"].forEach(m=>{f[m]!==void 0&&(u.mandatory=u.mandatory||{},u.mandatory[h(m,d)]=f[m])})}),c.advanced&&(u.optional=(u.optional||[]).concat(c.advanced)),u},a=function(c,u){if(e.version>=61)return u(c);if(c=JSON.parse(JSON.stringify(c)),c&&typeof c.audio=="object"){const d=function(f,h,m){h in f&&!(m in f)&&(f[m]=f[h],delete f[h])};c=JSON.parse(JSON.stringify(c)),d(c.audio,"autoGainControl","googAutoGainControl"),d(c.audio,"noiseSuppression","googNoiseSuppression"),c.audio=n(c.audio)}if(c&&typeof c.video=="object"){let d=c.video.facingMode;d=d&&(typeof d=="object"?d:{ideal:d});const f=e.version<66;if(d&&(d.exact==="user"||d.exact==="environment"||d.ideal==="user"||d.ideal==="environment")&&!(r.mediaDevices.getSupportedConstraints&&r.mediaDevices.getSupportedConstraints().facingMode&&!f)){delete c.video.facingMode;let h;if(d.exact==="environment"||d.ideal==="environment"?h=["back","rear"]:(d.exact==="user"||d.ideal==="user")&&(h=["front"]),h)return r.mediaDevices.enumerateDevices().then(m=>{m=m.filter(w=>w.kind==="videoinput");let _=m.find(w=>h.some(b=>w.label.toLowerCase().includes(b)));return!_&&m.length&&h.includes("back")&&(_=m[m.length-1]),_&&(c.video.deviceId=d.exact?{exact:_.deviceId}:{ideal:_.deviceId}),c.video=n(c.video),mM("chrome: "+JSON.stringify(c)),u(c)})}c.video=n(c.video)}return mM("chrome: "+JSON.stringify(c)),u(c)},i=function(c){return e.version>=64?c:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[c.name]||c.name,message:c.message,constraint:c.constraint||c.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}},o=function(c,u,d){a(c,f=>{r.webkitGetUserMedia(f,u,h=>{d&&d(i(h))})})};if(r.getUserMedia=o.bind(r),r.mediaDevices.getUserMedia){const c=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(u){return a(u,d=>c(d).then(f=>{if(d.audio&&!f.getAudioTracks().length||d.video&&!f.getVideoTracks().length)throw f.getTracks().forEach(h=>{h.stop()}),new DOMException("","NotFoundError");return f},f=>Promise.reject(i(f))))}}}function yq(t){t.MediaStream=t.MediaStream||t.webkitMediaStream}function vq(t){if(typeof t=="object"&&t.RTCPeerConnection&&!("ontrack"in t.RTCPeerConnection.prototype)){Object.defineProperty(t.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(r){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=r)},enumerable:!0,configurable:!0});const e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=n=>{n.stream.addEventListener("addtrack",a=>{let i;t.RTCPeerConnection.prototype.getReceivers?i=this.getReceivers().find(c=>c.track&&c.track.id===a.track.id):i={track:a.track};const o=new Event("track");o.track=a.track,o.receiver=i,o.transceiver={receiver:i},o.streams=[n.stream],this.dispatchEvent(o)}),n.stream.getTracks().forEach(a=>{let i;t.RTCPeerConnection.prototype.getReceivers?i=this.getReceivers().find(c=>c.track&&c.track.id===a.id):i={track:a};const o=new Event("track");o.track=a,o.receiver=i,o.transceiver={receiver:i},o.streams=[n.stream],this.dispatchEvent(o)})},this.addEventListener("addstream",this._ontrackpoly)),e.apply(this,arguments)}}else _d(t,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function _q(t){if(typeof t=="object"&&t.RTCPeerConnection&&!("getSenders"in t.RTCPeerConnection.prototype)&&"createDTMFSender"in t.RTCPeerConnection.prototype){const e=function(a,i){return{track:i,get dtmf(){return this._dtmf===void 0&&(i.kind==="audio"?this._dtmf=a.createDTMFSender(i):this._dtmf=null),this._dtmf},_pc:a}};if(!t.RTCPeerConnection.prototype.getSenders){t.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const a=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(c,u){let d=a.apply(this,arguments);return d||(d=e(this,c),this._senders.push(d)),d};const i=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(c){i.apply(this,arguments);const u=this._senders.indexOf(c);u!==-1&&this._senders.splice(u,1)}}const r=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(i){this._senders=this._senders||[],r.apply(this,[i]),i.getTracks().forEach(o=>{this._senders.push(e(this,o))})};const n=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(i){this._senders=this._senders||[],n.apply(this,[i]),i.getTracks().forEach(o=>{const c=this._senders.find(u=>u.track===o);c&&this._senders.splice(this._senders.indexOf(c),1)})}}else if(typeof t=="object"&&t.RTCPeerConnection&&"getSenders"in t.RTCPeerConnection.prototype&&"createDTMFSender"in t.RTCPeerConnection.prototype&&t.RTCRtpSender&&!("dtmf"in t.RTCRtpSender.prototype)){const e=t.RTCPeerConnection.prototype.getSenders;t.RTCPeerConnection.prototype.getSenders=function(){const n=e.apply(this,[]);return n.forEach(a=>a._pc=this),n},Object.defineProperty(t.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function bq(t){if(!(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender&&t.RTCRtpReceiver))return;if(!("getStats"in t.RTCRtpSender.prototype)){const r=t.RTCPeerConnection.prototype.getSenders;r&&(t.RTCPeerConnection.prototype.getSenders=function(){const i=r.apply(this,[]);return i.forEach(o=>o._pc=this),i});const n=t.RTCPeerConnection.prototype.addTrack;n&&(t.RTCPeerConnection.prototype.addTrack=function(){const i=n.apply(this,arguments);return i._pc=this,i}),t.RTCRtpSender.prototype.getStats=function(){const i=this;return this._pc.getStats().then(o=>hM(o,i.track,!0))}}if(!("getStats"in t.RTCRtpReceiver.prototype)){const r=t.RTCPeerConnection.prototype.getReceivers;r&&(t.RTCPeerConnection.prototype.getReceivers=function(){const a=r.apply(this,[]);return a.forEach(i=>i._pc=this),a}),_d(t,"track",n=>(n.receiver._pc=n.srcElement,n)),t.RTCRtpReceiver.prototype.getStats=function(){const a=this;return this._pc.getStats().then(i=>hM(i,a.track,!1))}}if(!("getStats"in t.RTCRtpSender.prototype&&"getStats"in t.RTCRtpReceiver.prototype))return;const e=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof t.MediaStreamTrack){const n=arguments[0];let a,i,o;return this.getSenders().forEach(c=>{c.track===n&&(a?o=!0:a=c)}),this.getReceivers().forEach(c=>(c.track===n&&(i?o=!0:i=c),c.track===n)),o||a&&i?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):a?a.getStats():i?i.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return e.apply(this,arguments)}}function kq(t){t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(o=>this._shimmedLocalStreams[o][0])};const e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(o,c){if(!c)return e.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const u=e.apply(this,arguments);return this._shimmedLocalStreams[c.id]?this._shimmedLocalStreams[c.id].indexOf(u)===-1&&this._shimmedLocalStreams[c.id].push(u):this._shimmedLocalStreams[c.id]=[c,u],u};const r=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(o){this._shimmedLocalStreams=this._shimmedLocalStreams||{},o.getTracks().forEach(d=>{if(this.getSenders().find(h=>h.track===d))throw new DOMException("Track already exists.","InvalidAccessError")});const c=this.getSenders();r.apply(this,arguments);const u=this.getSenders().filter(d=>c.indexOf(d)===-1);this._shimmedLocalStreams[o.id]=[o].concat(u)};const n=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(o){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[o.id],n.apply(this,arguments)};const a=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(o){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},o&&Object.keys(this._shimmedLocalStreams).forEach(c=>{const u=this._shimmedLocalStreams[c].indexOf(o);u!==-1&&this._shimmedLocalStreams[c].splice(u,1),this._shimmedLocalStreams[c].length===1&&delete this._shimmedLocalStreams[c]}),a.apply(this,arguments)}}function wq(t,e){if(!t.RTCPeerConnection)return;if(t.RTCPeerConnection.prototype.addTrack&&e.version>=65)return kq(t);const r=t.RTCPeerConnection.prototype.getLocalStreams;t.RTCPeerConnection.prototype.getLocalStreams=function(){const f=r.apply(this);return this._reverseStreams=this._reverseStreams||{},f.map(h=>this._reverseStreams[h.id])};const n=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(f){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},f.getTracks().forEach(h=>{if(this.getSenders().find(_=>_.track===h))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[f.id]){const h=new t.MediaStream(f.getTracks());this._streams[f.id]=h,this._reverseStreams[h.id]=f,f=h}n.apply(this,[f])};const a=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(f){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},a.apply(this,[this._streams[f.id]||f]),delete this._reverseStreams[this._streams[f.id]?this._streams[f.id].id:f.id],delete this._streams[f.id]},t.RTCPeerConnection.prototype.addTrack=function(f,h){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const m=[].slice.call(arguments,1);if(m.length!==1||!m[0].getTracks().find(b=>b===f))throw new DOMException("The adapter.js addTrack polyfill only supports a single  stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find(b=>b.track===f))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const w=this._streams[h.id];if(w)w.addTrack(f),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const b=new t.MediaStream([f]);this._streams[h.id]=b,this._reverseStreams[b.id]=h,this.addStream(b)}return this.getSenders().find(b=>b.track===f)};function i(d,f){let h=f.sdp;return Object.keys(d._reverseStreams||[]).forEach(m=>{const _=d._reverseStreams[m],w=d._streams[_.id];h=h.replace(new RegExp(w.id,"g"),_.id)}),new RTCSessionDescription({type:f.type,sdp:h})}function o(d,f){let h=f.sdp;return Object.keys(d._reverseStreams||[]).forEach(m=>{const _=d._reverseStreams[m],w=d._streams[_.id];h=h.replace(new RegExp(_.id,"g"),w.id)}),new RTCSessionDescription({type:f.type,sdp:h})}["createOffer","createAnswer"].forEach(function(d){const f=t.RTCPeerConnection.prototype[d],h={[d](){const m=arguments;return arguments.length&&typeof arguments[0]=="function"?f.apply(this,[w=>{const b=i(this,w);m[0].apply(null,[b])},w=>{m[1]&&m[1].apply(null,w)},arguments[2]]):f.apply(this,arguments).then(w=>i(this,w))}};t.RTCPeerConnection.prototype[d]=h[d]});const c=t.RTCPeerConnection.prototype.setLocalDescription;t.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type?c.apply(this,arguments):(arguments[0]=o(this,arguments[0]),c.apply(this,arguments))};const u=Object.getOwnPropertyDescriptor(t.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(t.RTCPeerConnection.prototype,"localDescription",{get(){const d=u.get.apply(this);return d.type===""?d:i(this,d)}}),t.RTCPeerConnection.prototype.removeTrack=function(f){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!f._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(f._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};let m;Object.keys(this._streams).forEach(_=>{this._streams[_].getTracks().find(b=>f.track===b)&&(m=this._streams[_])}),m&&(m.getTracks().length===1?this.removeStream(this._reverseStreams[m.id]):m.removeTrack(f.track),this.dispatchEvent(new Event("negotiationneeded")))}}function lC(t,e){!t.RTCPeerConnection&&t.webkitRTCPeerConnection&&(t.RTCPeerConnection=t.webkitRTCPeerConnection),t.RTCPeerConnection&&e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(r){const n=t.RTCPeerConnection.prototype[r],a={[r](){return arguments[0]=new(r==="addIceCandidate"?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};t.RTCPeerConnection.prototype[r]=a[r]})}function Sq(t,e){_d(t,"negotiationneeded",r=>{const n=r.target;if(!((e.version<72||n.getConfiguration&&n.getConfiguration().sdpSemantics==="plan-b")&&n.signalingState!=="stable"))return r})}var gM=Object.freeze({__proto__:null,fixNegotiationNeeded:Sq,shimAddTrackRemoveTrack:wq,shimAddTrackRemoveTrackWithNative:kq,shimGetSendersWithDtmf:_q,shimGetUserMedia:gq,shimMediaStream:yq,shimOnTrack:vq,shimPeerConnection:lC,shimSenderReceiverGetStats:bq});function Eq(t,e){const r=t&&t.navigator,n=t&&t.MediaStreamTrack;if(r.getUserMedia=function(a,i,o){r.mediaDevices.getUserMedia(a).then(i,o)},!(e.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){const a=function(o,c,u){c in o&&!(u in o)&&(o[u]=o[c],delete o[c])},i=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(o){return typeof o=="object"&&typeof o.audio=="object"&&(o=JSON.parse(JSON.stringify(o)),a(o.audio,"autoGainControl","mozAutoGainControl"),a(o.audio,"noiseSuppression","mozNoiseSuppression")),i(o)},n&&n.prototype.getSettings){const o=n.prototype.getSettings;n.prototype.getSettings=function(){const c=o.apply(this,arguments);return a(c,"mozAutoGainControl","autoGainControl"),a(c,"mozNoiseSuppression","noiseSuppression"),c}}if(n&&n.prototype.applyConstraints){const o=n.prototype.applyConstraints;n.prototype.applyConstraints=function(c){return this.kind==="audio"&&typeof c=="object"&&(c=JSON.parse(JSON.stringify(c)),a(c,"autoGainControl","mozAutoGainControl"),a(c,"noiseSuppression","mozNoiseSuppression")),o.apply(this,[c])}}}}function $le(t,e){t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices||t.navigator.mediaDevices&&(t.navigator.mediaDevices.getDisplayMedia=function(n){if(!(n&&n.video)){const a=new DOMException("getDisplayMedia without video constraints is undefined");return a.name="NotFoundError",a.code=8,Promise.reject(a)}return n.video===!0?n.video={mediaSource:e}:n.video.mediaSource=e,t.navigator.mediaDevices.getUserMedia(n)})}function Tq(t){typeof t=="object"&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function uC(t,e){if(typeof t!="object"||!(t.RTCPeerConnection||t.mozRTCPeerConnection))return;!t.RTCPeerConnection&&t.mozRTCPeerConnection&&(t.RTCPeerConnection=t.mozRTCPeerConnection),e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(a){const i=t.RTCPeerConnection.prototype[a],o={[a](){return arguments[0]=new(a==="addIceCandidate"?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)}};t.RTCPeerConnection.prototype[a]=o[a]});const r={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},n=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){const[i,o,c]=arguments;return n.apply(this,[i||null]).then(u=>{if(e.version<53&&!o)try{u.forEach(d=>{d.type=r[d.type]||d.type})}catch(d){if(d.name!=="TypeError")throw d;u.forEach((f,h)=>{u.set(h,Object.assign({},f,{type:r[f.type]||f.type}))})}return u}).then(o,c)}}function Cq(t){if(!(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender)||t.RTCRtpSender&&"getStats"in t.RTCRtpSender.prototype)return;const e=t.RTCPeerConnection.prototype.getSenders;e&&(t.RTCPeerConnection.prototype.getSenders=function(){const a=e.apply(this,[]);return a.forEach(i=>i._pc=this),a});const r=t.RTCPeerConnection.prototype.addTrack;r&&(t.RTCPeerConnection.prototype.addTrack=function(){const a=r.apply(this,arguments);return a._pc=this,a}),t.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function xq(t){if(!(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender)||t.RTCRtpSender&&"getStats"in t.RTCRtpReceiver.prototype)return;const e=t.RTCPeerConnection.prototype.getReceivers;e&&(t.RTCPeerConnection.prototype.getReceivers=function(){const n=e.apply(this,[]);return n.forEach(a=>a._pc=this),n}),_d(t,"track",r=>(r.receiver._pc=r.srcElement,r)),t.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function Pq(t){!t.RTCPeerConnection||"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function(r){this.getSenders().forEach(n=>{n.track&&r.getTracks().includes(n.track)&&this.removeTrack(n)})})}function Aq(t){t.DataChannel&&!t.RTCDataChannel&&(t.RTCDataChannel=t.DataChannel)}function Rq(t){if(!(typeof t=="object"&&t.RTCPeerConnection))return;const e=t.RTCPeerConnection.prototype.addTransceiver;e&&(t.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let n=arguments[1]&&arguments[1].sendEncodings;n===void 0&&(n=[]),n=[...n];const a=n.length>0;a&&n.forEach(o=>{if("rid"in o&&!/^[a-z0-9]{0,16}$/i.test(o.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in o&&!(parseFloat(o.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in o&&!(parseFloat(o.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const i=e.apply(this,arguments);if(a){const{sender:o}=i,c=o.getParameters();(!("encodings"in c)||c.encodings.length===1&&Object.keys(c.encodings[0]).length===0)&&(c.encodings=n,o.sendEncodings=n,this.setParametersPromises.push(o.setParameters(c).then(()=>{delete o.sendEncodings}).catch(()=>{delete o.sendEncodings})))}return i})}function Dq(t){if(!(typeof t=="object"&&t.RTCRtpSender))return;const e=t.RTCRtpSender.prototype.getParameters;e&&(t.RTCRtpSender.prototype.getParameters=function(){const n=e.apply(this,arguments);return"encodings"in n||(n.encodings=[].concat(this.sendEncodings||[{}])),n})}function Oq(t){if(!(typeof t=="object"&&t.RTCPeerConnection))return;const e=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>e.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):e.apply(this,arguments)}}function Nq(t){if(!(typeof t=="object"&&t.RTCPeerConnection))return;const e=t.RTCPeerConnection.prototype.createAnswer;t.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>e.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):e.apply(this,arguments)}}var yM=Object.freeze({__proto__:null,shimAddTransceiver:Rq,shimCreateAnswer:Nq,shimCreateOffer:Oq,shimGetDisplayMedia:$le,shimGetParameters:Dq,shimGetUserMedia:Eq,shimOnTrack:Tq,shimPeerConnection:uC,shimRTCDataChannel:Aq,shimReceiverGetStats:xq,shimRemoveStream:Pq,shimSenderGetStats:Cq});function Iq(t){if(!(typeof t!="object"||!t.RTCPeerConnection)){if("getLocalStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in t.RTCPeerConnection.prototype)){const e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addStream=function(n){this._localStreams||(this._localStreams=[]),this._localStreams.includes(n)||this._localStreams.push(n),n.getAudioTracks().forEach(a=>e.call(this,a,n)),n.getVideoTracks().forEach(a=>e.call(this,a,n))},t.RTCPeerConnection.prototype.addTrack=function(n){for(var a=arguments.length,i=new Array(a>1?a-1:0),o=1;o<a;o++)i[o-1]=arguments[o];return i&&i.forEach(c=>{this._localStreams?this._localStreams.includes(c)||this._localStreams.push(c):this._localStreams=[c]}),e.apply(this,arguments)}}"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function(r){this._localStreams||(this._localStreams=[]);const n=this._localStreams.indexOf(r);if(n===-1)return;this._localStreams.splice(n,1);const a=r.getTracks();this.getSenders().forEach(i=>{a.includes(i.track)&&this.removeTrack(i)})})}}function Mq(t){if(!(typeof t!="object"||!t.RTCPeerConnection)&&("getRemoteStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in t.RTCPeerConnection.prototype))){Object.defineProperty(t.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(r){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=r),this.addEventListener("track",this._onaddstreampoly=n=>{n.streams.forEach(a=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(a))return;this._remoteStreams.push(a);const i=new Event("addstream");i.stream=a,this.dispatchEvent(i)})})}});const e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){const n=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(a){a.streams.forEach(i=>{if(n._remoteStreams||(n._remoteStreams=[]),n._remoteStreams.indexOf(i)>=0)return;n._remoteStreams.push(i);const o=new Event("addstream");o.stream=i,n.dispatchEvent(o)})}),e.apply(n,arguments)}}}function jq(t){if(typeof t!="object"||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype,r=e.createOffer,n=e.createAnswer,a=e.setLocalDescription,i=e.setRemoteDescription,o=e.addIceCandidate;e.createOffer=function(d,f){const h=arguments.length>=2?arguments[2]:arguments[0],m=r.apply(this,[h]);return f?(m.then(d,f),Promise.resolve()):m},e.createAnswer=function(d,f){const h=arguments.length>=2?arguments[2]:arguments[0],m=n.apply(this,[h]);return f?(m.then(d,f),Promise.resolve()):m};let c=function(u,d,f){const h=a.apply(this,[u]);return f?(h.then(d,f),Promise.resolve()):h};e.setLocalDescription=c,c=function(u,d,f){const h=i.apply(this,[u]);return f?(h.then(d,f),Promise.resolve()):h},e.setRemoteDescription=c,c=function(u,d,f){const h=o.apply(this,[u]);return f?(h.then(d,f),Promise.resolve()):h},e.addIceCandidate=c}function Lq(t){const e=t&&t.navigator;if(e.mediaDevices&&e.mediaDevices.getUserMedia){const r=e.mediaDevices,n=r.getUserMedia.bind(r);e.mediaDevices.getUserMedia=a=>n(Bq(a))}!e.getUserMedia&&e.mediaDevices&&e.mediaDevices.getUserMedia&&(e.getUserMedia=(function(n,a,i){e.mediaDevices.getUserMedia(n).then(a,i)}).bind(e))}function Bq(t){return t&&t.video!==void 0?Object.assign({},t,{video:mq(t.video)}):t}function Uq(t){if(!t.RTCPeerConnection)return;const e=t.RTCPeerConnection;t.RTCPeerConnection=function(n,a){if(n&&n.iceServers){const i=[];for(let o=0;o<n.iceServers.length;o++){let c=n.iceServers[o];c.urls===void 0&&c.url?(c=JSON.parse(JSON.stringify(c)),c.urls=c.url,delete c.url,i.push(c)):i.push(n.iceServers[o])}n.iceServers=i}return new e(n,a)},t.RTCPeerConnection.prototype=e.prototype,"generateCertificate"in e&&Object.defineProperty(t.RTCPeerConnection,"generateCertificate",{get(){return e.generateCertificate}})}function Fq(t){typeof t=="object"&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function qq(t){const e=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(n){if(n){typeof n.offerToReceiveAudio<"u"&&(n.offerToReceiveAudio=!!n.offerToReceiveAudio);const a=this.getTransceivers().find(o=>o.receiver.track.kind==="audio");n.offerToReceiveAudio===!1&&a?a.direction==="sendrecv"?a.setDirection?a.setDirection("sendonly"):a.direction="sendonly":a.direction==="recvonly"&&(a.setDirection?a.setDirection("inactive"):a.direction="inactive"):n.offerToReceiveAudio===!0&&!a&&this.addTransceiver("audio",{direction:"recvonly"}),typeof n.offerToReceiveVideo<"u"&&(n.offerToReceiveVideo=!!n.offerToReceiveVideo);const i=this.getTransceivers().find(o=>o.receiver.track.kind==="video");n.offerToReceiveVideo===!1&&i?i.direction==="sendrecv"?i.setDirection?i.setDirection("sendonly"):i.direction="sendonly":i.direction==="recvonly"&&(i.setDirection?i.setDirection("inactive"):i.direction="inactive"):n.offerToReceiveVideo===!0&&!i&&this.addTransceiver("video",{direction:"recvonly"})}return e.apply(this,arguments)}}function zq(t){typeof t!="object"||t.AudioContext||(t.AudioContext=t.webkitAudioContext)}var vM=Object.freeze({__proto__:null,shimAudioContext:zq,shimCallbacksAPI:jq,shimConstraints:Bq,shimCreateOfferLegacy:qq,shimGetUserMedia:Lq,shimLocalStreamsAPI:Iq,shimRTCIceServerUrls:Uq,shimRemoteStreamsAPI:Mq,shimTrackEventTransceiver:Fq}),nE={exports:{}},_M;function Vle(){return _M||(_M=1,(function(t){const e={};e.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)},e.localCName=e.generateIdentifier(),e.splitLines=function(r){return r.trim().split(`
`).map(n=>n.trim())},e.splitSections=function(r){return r.split(`
m=`).map((a,i)=>(i>0?"m="+a:a).trim()+`\r
`)},e.getDescription=function(r){const n=e.splitSections(r);return n&&n[0]},e.getMediaSections=function(r){const n=e.splitSections(r);return n.shift(),n},e.matchPrefix=function(r,n){return e.splitLines(r).filter(a=>a.indexOf(n)===0)},e.parseCandidate=function(r){let n;r.indexOf("a=candidate:")===0?n=r.substring(12).split(" "):n=r.substring(10).split(" ");const a={foundation:n[0],component:{1:"rtp",2:"rtcp"}[n[1]]||n[1],protocol:n[2].toLowerCase(),priority:parseInt(n[3],10),ip:n[4],address:n[4],port:parseInt(n[5],10),type:n[7]};for(let i=8;i<n.length;i+=2)switch(n[i]){case"raddr":a.relatedAddress=n[i+1];break;case"rport":a.relatedPort=parseInt(n[i+1],10);break;case"tcptype":a.tcpType=n[i+1];break;case"ufrag":a.ufrag=n[i+1],a.usernameFragment=n[i+1];break;default:a[n[i]]===void 0&&(a[n[i]]=n[i+1]);break}return a},e.writeCandidate=function(r){const n=[];n.push(r.foundation);const a=r.component;a==="rtp"?n.push(1):a==="rtcp"?n.push(2):n.push(a),n.push(r.protocol.toUpperCase()),n.push(r.priority),n.push(r.address||r.ip),n.push(r.port);const i=r.type;return n.push("typ"),n.push(i),i!=="host"&&r.relatedAddress&&r.relatedPort&&(n.push("raddr"),n.push(r.relatedAddress),n.push("rport"),n.push(r.relatedPort)),r.tcpType&&r.protocol.toLowerCase()==="tcp"&&(n.push("tcptype"),n.push(r.tcpType)),(r.usernameFragment||r.ufrag)&&(n.push("ufrag"),n.push(r.usernameFragment||r.ufrag)),"candidate:"+n.join(" ")},e.parseIceOptions=function(r){return r.substring(14).split(" ")},e.parseRtpMap=function(r){let n=r.substring(9).split(" ");const a={payloadType:parseInt(n.shift(),10)};return n=n[0].split("/"),a.name=n[0],a.clockRate=parseInt(n[1],10),a.channels=n.length===3?parseInt(n[2],10):1,a.numChannels=a.channels,a},e.writeRtpMap=function(r){let n=r.payloadType;r.preferredPayloadType!==void 0&&(n=r.preferredPayloadType);const a=r.channels||r.numChannels||1;return"a=rtpmap:"+n+" "+r.name+"/"+r.clockRate+(a!==1?"/"+a:"")+`\r
`},e.parseExtmap=function(r){const n=r.substring(9).split(" ");return{id:parseInt(n[0],10),direction:n[0].indexOf("/")>0?n[0].split("/")[1]:"sendrecv",uri:n[1],attributes:n.slice(2).join(" ")}},e.writeExtmap=function(r){return"a=extmap:"+(r.id||r.preferredId)+(r.direction&&r.direction!=="sendrecv"?"/"+r.direction:"")+" "+r.uri+(r.attributes?" "+r.attributes:"")+`\r
`},e.parseFmtp=function(r){const n={};let a;const i=r.substring(r.indexOf(" ")+1).split(";");for(let o=0;o<i.length;o++)a=i[o].trim().split("="),n[a[0].trim()]=a[1];return n},e.writeFmtp=function(r){let n="",a=r.payloadType;if(r.preferredPayloadType!==void 0&&(a=r.preferredPayloadType),r.parameters&&Object.keys(r.parameters).length){const i=[];Object.keys(r.parameters).forEach(o=>{r.parameters[o]!==void 0?i.push(o+"="+r.parameters[o]):i.push(o)}),n+="a=fmtp:"+a+" "+i.join(";")+`\r
`}return n},e.parseRtcpFb=function(r){const n=r.substring(r.indexOf(" ")+1).split(" ");return{type:n.shift(),parameter:n.join(" ")}},e.writeRtcpFb=function(r){let n="",a=r.payloadType;return r.preferredPayloadType!==void 0&&(a=r.preferredPayloadType),r.rtcpFeedback&&r.rtcpFeedback.length&&r.rtcpFeedback.forEach(i=>{n+="a=rtcp-fb:"+a+" "+i.type+(i.parameter&&i.parameter.length?" "+i.parameter:"")+`\r
`}),n},e.parseSsrcMedia=function(r){const n=r.indexOf(" "),a={ssrc:parseInt(r.substring(7,n),10)},i=r.indexOf(":",n);return i>-1?(a.attribute=r.substring(n+1,i),a.value=r.substring(i+1)):a.attribute=r.substring(n+1),a},e.parseSsrcGroup=function(r){const n=r.substring(13).split(" ");return{semantics:n.shift(),ssrcs:n.map(a=>parseInt(a,10))}},e.getMid=function(r){const n=e.matchPrefix(r,"a=mid:")[0];if(n)return n.substring(6)},e.parseFingerprint=function(r){const n=r.substring(14).split(" ");return{algorithm:n[0].toLowerCase(),value:n[1].toUpperCase()}},e.getDtlsParameters=function(r,n){return{role:"auto",fingerprints:e.matchPrefix(r+n,"a=fingerprint:").map(e.parseFingerprint)}},e.writeDtlsParameters=function(r,n){let a="a=setup:"+n+`\r
`;return r.fingerprints.forEach(i=>{a+="a=fingerprint:"+i.algorithm+" "+i.value+`\r
`}),a},e.parseCryptoLine=function(r){const n=r.substring(9).split(" ");return{tag:parseInt(n[0],10),cryptoSuite:n[1],keyParams:n[2],sessionParams:n.slice(3)}},e.writeCryptoLine=function(r){return"a=crypto:"+r.tag+" "+r.cryptoSuite+" "+(typeof r.keyParams=="object"?e.writeCryptoKeyParams(r.keyParams):r.keyParams)+(r.sessionParams?" "+r.sessionParams.join(" "):"")+`\r
`},e.parseCryptoKeyParams=function(r){if(r.indexOf("inline:")!==0)return null;const n=r.substring(7).split("|");return{keyMethod:"inline",keySalt:n[0],lifeTime:n[1],mkiValue:n[2]?n[2].split(":")[0]:void 0,mkiLength:n[2]?n[2].split(":")[1]:void 0}},e.writeCryptoKeyParams=function(r){return r.keyMethod+":"+r.keySalt+(r.lifeTime?"|"+r.lifeTime:"")+(r.mkiValue&&r.mkiLength?"|"+r.mkiValue+":"+r.mkiLength:"")},e.getCryptoParameters=function(r,n){return e.matchPrefix(r+n,"a=crypto:").map(e.parseCryptoLine)},e.getIceParameters=function(r,n){const a=e.matchPrefix(r+n,"a=ice-ufrag:")[0],i=e.matchPrefix(r+n,"a=ice-pwd:")[0];return a&&i?{usernameFragment:a.substring(12),password:i.substring(10)}:null},e.writeIceParameters=function(r){let n="a=ice-ufrag:"+r.usernameFragment+`\r
a=ice-pwd:`+r.password+`\r
`;return r.iceLite&&(n+=`a=ice-lite\r
`),n},e.parseRtpParameters=function(r){const n={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},i=e.splitLines(r)[0].split(" ");n.profile=i[2];for(let c=3;c<i.length;c++){const u=i[c],d=e.matchPrefix(r,"a=rtpmap:"+u+" ")[0];if(d){const f=e.parseRtpMap(d),h=e.matchPrefix(r,"a=fmtp:"+u+" ");switch(f.parameters=h.length?e.parseFmtp(h[0]):{},f.rtcpFeedback=e.matchPrefix(r,"a=rtcp-fb:"+u+" ").map(e.parseRtcpFb),n.codecs.push(f),f.name.toUpperCase()){case"RED":case"ULPFEC":n.fecMechanisms.push(f.name.toUpperCase());break}}}e.matchPrefix(r,"a=extmap:").forEach(c=>{n.headerExtensions.push(e.parseExtmap(c))});const o=e.matchPrefix(r,"a=rtcp-fb:* ").map(e.parseRtcpFb);return n.codecs.forEach(c=>{o.forEach(u=>{c.rtcpFeedback.find(f=>f.type===u.type&&f.parameter===u.parameter)||c.rtcpFeedback.push(u)})}),n},e.writeRtpDescription=function(r,n){let a="";a+="m="+r+" ",a+=n.codecs.length>0?"9":"0",a+=" "+(n.profile||"UDP/TLS/RTP/SAVPF")+" ",a+=n.codecs.map(o=>o.preferredPayloadType!==void 0?o.preferredPayloadType:o.payloadType).join(" ")+`\r
`,a+=`c=IN IP4 0.0.0.0\r
`,a+=`a=rtcp:9 IN IP4 0.0.0.0\r
`,n.codecs.forEach(o=>{a+=e.writeRtpMap(o),a+=e.writeFmtp(o),a+=e.writeRtcpFb(o)});let i=0;return n.codecs.forEach(o=>{o.maxptime>i&&(i=o.maxptime)}),i>0&&(a+="a=maxptime:"+i+`\r
`),n.headerExtensions&&n.headerExtensions.forEach(o=>{a+=e.writeExtmap(o)}),a},e.parseRtpEncodingParameters=function(r){const n=[],a=e.parseRtpParameters(r),i=a.fecMechanisms.indexOf("RED")!==-1,o=a.fecMechanisms.indexOf("ULPFEC")!==-1,c=e.matchPrefix(r,"a=ssrc:").map(m=>e.parseSsrcMedia(m)).filter(m=>m.attribute==="cname"),u=c.length>0&&c[0].ssrc;let d;const f=e.matchPrefix(r,"a=ssrc-group:FID").map(m=>m.substring(17).split(" ").map(w=>parseInt(w,10)));f.length>0&&f[0].length>1&&f[0][0]===u&&(d=f[0][1]),a.codecs.forEach(m=>{if(m.name.toUpperCase()==="RTX"&&m.parameters.apt){let _={ssrc:u,codecPayloadType:parseInt(m.parameters.apt,10)};u&&d&&(_.rtx={ssrc:d}),n.push(_),i&&(_=JSON.parse(JSON.stringify(_)),_.fec={ssrc:u,mechanism:o?"red+ulpfec":"red"},n.push(_))}}),n.length===0&&u&&n.push({ssrc:u});let h=e.matchPrefix(r,"b=");return h.length&&(h[0].indexOf("b=TIAS:")===0?h=parseInt(h[0].substring(7),10):h[0].indexOf("b=AS:")===0?h=parseInt(h[0].substring(5),10)*1e3*.95-2e3*8:h=void 0,n.forEach(m=>{m.maxBitrate=h})),n},e.parseRtcpParameters=function(r){const n={},a=e.matchPrefix(r,"a=ssrc:").map(c=>e.parseSsrcMedia(c)).filter(c=>c.attribute==="cname")[0];a&&(n.cname=a.value,n.ssrc=a.ssrc);const i=e.matchPrefix(r,"a=rtcp-rsize");n.reducedSize=i.length>0,n.compound=i.length===0;const o=e.matchPrefix(r,"a=rtcp-mux");return n.mux=o.length>0,n},e.writeRtcpParameters=function(r){let n="";return r.reducedSize&&(n+=`a=rtcp-rsize\r
`),r.mux&&(n+=`a=rtcp-mux\r
`),r.ssrc!==void 0&&r.cname&&(n+="a=ssrc:"+r.ssrc+" cname:"+r.cname+`\r
`),n},e.parseMsid=function(r){let n;const a=e.matchPrefix(r,"a=msid:");if(a.length===1)return n=a[0].substring(7).split(" "),{stream:n[0],track:n[1]};const i=e.matchPrefix(r,"a=ssrc:").map(o=>e.parseSsrcMedia(o)).filter(o=>o.attribute==="msid");if(i.length>0)return n=i[0].value.split(" "),{stream:n[0],track:n[1]}},e.parseSctpDescription=function(r){const n=e.parseMLine(r),a=e.matchPrefix(r,"a=max-message-size:");let i;a.length>0&&(i=parseInt(a[0].substring(19),10)),isNaN(i)&&(i=65536);const o=e.matchPrefix(r,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substring(12),10),protocol:n.fmt,maxMessageSize:i};const c=e.matchPrefix(r,"a=sctpmap:");if(c.length>0){const u=c[0].substring(10).split(" ");return{port:parseInt(u[0],10),protocol:u[1],maxMessageSize:i}}},e.writeSctpDescription=function(r,n){let a=[];return r.protocol!=="DTLS/SCTP"?a=["m="+r.kind+" 9 "+r.protocol+" "+n.protocol+`\r
`,`c=IN IP4 0.0.0.0\r
`,"a=sctp-port:"+n.port+`\r
`]:a=["m="+r.kind+" 9 "+r.protocol+" "+n.port+`\r
`,`c=IN IP4 0.0.0.0\r
`,"a=sctpmap:"+n.port+" "+n.protocol+` 65535\r
`],n.maxMessageSize!==void 0&&a.push("a=max-message-size:"+n.maxMessageSize+`\r
`),a.join("")},e.generateSessionId=function(){return Math.random().toString().substr(2,22)},e.writeSessionBoilerplate=function(r,n,a){let i;const o=n!==void 0?n:2;return r?i=r:i=e.generateSessionId(),`v=0\r
o=`+(a||"thisisadapterortc")+" "+i+" "+o+` IN IP4 127.0.0.1\r
s=-\r
t=0 0\r
`},e.getDirection=function(r,n){const a=e.splitLines(r);for(let i=0;i<a.length;i++)switch(a[i]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return a[i].substring(2)}return n?e.getDirection(n):"sendrecv"},e.getKind=function(r){return e.splitLines(r)[0].split(" ")[0].substring(2)},e.isRejected=function(r){return r.split(" ",2)[1]==="0"},e.parseMLine=function(r){const a=e.splitLines(r)[0].substring(2).split(" ");return{kind:a[0],port:parseInt(a[1],10),protocol:a[2],fmt:a.slice(3).join(" ")}},e.parseOLine=function(r){const a=e.matchPrefix(r,"o=")[0].substring(2).split(" ");return{username:a[0],sessionId:a[1],sessionVersion:parseInt(a[2],10),netType:a[3],addressType:a[4],address:a[5]}},e.isValidSDP=function(r){if(typeof r!="string"||r.length===0)return!1;const n=e.splitLines(r);for(let a=0;a<n.length;a++)if(n[a].length<2||n[a].charAt(1)!=="=")return!1;return!0},t.exports=e})(nE)),nE.exports}var $q=Vle(),zf=Dle($q),Hle=Zoe({__proto__:null,default:zf},[$q]);function u_(t){if(!t.RTCIceCandidate||t.RTCIceCandidate&&"foundation"in t.RTCIceCandidate.prototype)return;const e=t.RTCIceCandidate;t.RTCIceCandidate=function(n){if(typeof n=="object"&&n.candidate&&n.candidate.indexOf("a=")===0&&(n=JSON.parse(JSON.stringify(n)),n.candidate=n.candidate.substring(2)),n.candidate&&n.candidate.length){const a=new e(n),i=zf.parseCandidate(n.candidate);for(const o in i)o in a||Object.defineProperty(a,o,{value:i[o]});return a.toJSON=function(){return{candidate:a.candidate,sdpMid:a.sdpMid,sdpMLineIndex:a.sdpMLineIndex,usernameFragment:a.usernameFragment}},a}return new e(n)},t.RTCIceCandidate.prototype=e.prototype,_d(t,"icecandidate",r=>(r.candidate&&Object.defineProperty(r,"candidate",{value:new t.RTCIceCandidate(r.candidate),writable:"false"}),r))}function dC(t){!t.RTCIceCandidate||t.RTCIceCandidate&&"relayProtocol"in t.RTCIceCandidate.prototype||_d(t,"icecandidate",e=>{if(e.candidate){const r=zf.parseCandidate(e.candidate.candidate);r.type==="relay"&&(e.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[r.priority>>24])}return e})}function d_(t,e){if(!t.RTCPeerConnection)return;"sctp"in t.RTCPeerConnection.prototype||Object.defineProperty(t.RTCPeerConnection.prototype,"sctp",{get(){return typeof this._sctp>"u"?null:this._sctp}});const r=function(c){if(!c||!c.sdp)return!1;const u=zf.splitSections(c.sdp);return u.shift(),u.some(d=>{const f=zf.parseMLine(d);return f&&f.kind==="application"&&f.protocol.indexOf("SCTP")!==-1})},n=function(c){const u=c.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(u===null||u.length<2)return-1;const d=parseInt(u[1],10);return d!==d?-1:d},a=function(c){let u=65536;return e.browser==="firefox"&&(e.version<57?c===-1?u=16384:u=2147483637:e.version<60?u=e.version===57?65535:65536:u=2147483637),u},i=function(c,u){let d=65536;e.browser==="firefox"&&e.version===57&&(d=65535);const f=zf.matchPrefix(c.sdp,"a=max-message-size:");return f.length>0?d=parseInt(f[0].substring(19),10):e.browser==="firefox"&&u!==-1&&(d=2147483637),d},o=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,e.browser==="chrome"&&e.version>=76){const{sdpSemantics:u}=this.getConfiguration();u==="plan-b"&&Object.defineProperty(this,"sctp",{get(){return typeof this._sctp>"u"?null:this._sctp},enumerable:!0,configurable:!0})}if(r(arguments[0])){const u=n(arguments[0]),d=a(u),f=i(arguments[0],u);let h;d===0&&f===0?h=Number.POSITIVE_INFINITY:d===0||f===0?h=Math.max(d,f):h=Math.min(d,f);const m={};Object.defineProperty(m,"maxMessageSize",{get(){return h}}),this._sctp=m}return o.apply(this,arguments)}}function f_(t){if(!(t.RTCPeerConnection&&"createDataChannel"in t.RTCPeerConnection.prototype))return;function e(n,a){const i=n.send;n.send=function(){const c=arguments[0],u=c.length||c.size||c.byteLength;if(n.readyState==="open"&&a.sctp&&u>a.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+a.sctp.maxMessageSize+" bytes)");return i.apply(n,arguments)}}const r=t.RTCPeerConnection.prototype.createDataChannel;t.RTCPeerConnection.prototype.createDataChannel=function(){const a=r.apply(this,arguments);return e(a,this),a},_d(t,"datachannel",n=>(e(n.channel,n.target),n))}function fC(t){if(!t.RTCPeerConnection||"connectionState"in t.RTCPeerConnection.prototype)return;const e=t.RTCPeerConnection.prototype;Object.defineProperty(e,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(e,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(r){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),r&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=r)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(r=>{const n=e[r];e[r]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=a=>{const i=a.target;if(i._lastConnectionState!==i.connectionState){i._lastConnectionState=i.connectionState;const o=new Event("connectionstatechange",a);i.dispatchEvent(o)}return a},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),n.apply(this,arguments)}})}function pC(t,e){if(!t.RTCPeerConnection||e.browser==="chrome"&&e.version>=71||e.browser==="safari"&&e._safariVersion>=13.1)return;const r=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(a){if(a&&a.sdp&&a.sdp.indexOf(`
a=extmap-allow-mixed`)!==-1){const i=a.sdp.split(`
`).filter(o=>o.trim()!=="a=extmap-allow-mixed").join(`
`);t.RTCSessionDescription&&a instanceof t.RTCSessionDescription?arguments[0]=new t.RTCSessionDescription({type:a.type,sdp:i}):a.sdp=i}return r.apply(this,arguments)}}function p_(t,e){if(!(t.RTCPeerConnection&&t.RTCPeerConnection.prototype))return;const r=t.RTCPeerConnection.prototype.addIceCandidate;!r||r.length===0||(t.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?(e.browser==="chrome"&&e.version<78||e.browser==="firefox"&&e.version<68||e.browser==="safari")&&arguments[0]&&arguments[0].candidate===""?Promise.resolve():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function h_(t,e){if(!(t.RTCPeerConnection&&t.RTCPeerConnection.prototype))return;const r=t.RTCPeerConnection.prototype.setLocalDescription;!r||r.length===0||(t.RTCPeerConnection.prototype.setLocalDescription=function(){let a=arguments[0]||{};if(typeof a!="object"||a.type&&a.sdp)return r.apply(this,arguments);if(a={type:a.type,sdp:a.sdp},!a.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":a.type="offer";break;default:a.type="answer";break}return a.sdp||a.type!=="offer"&&a.type!=="answer"?r.apply(this,[a]):(a.type==="offer"?this.createOffer:this.createAnswer).apply(this).then(o=>r.apply(this,[o]))})}var Gle=Object.freeze({__proto__:null,removeExtmapAllowMixed:pC,shimAddIceCandidateNullOrEmpty:p_,shimConnectionState:fC,shimMaxMessageSize:d_,shimParameterlessSetLocalDescription:h_,shimRTCIceCandidate:u_,shimRTCIceCandidateRelayProtocol:dC,shimSendThrowTypeError:f_});function Wle(){let{window:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0};const r=hq,n=zle(t),a={browserDetails:n,commonShim:Gle,extractVersion:Qh,disableLog:Fle,disableWarnings:qle,sdp:Hle};switch(n.browser){case"chrome":if(!gM||!lC||!e.shimChrome)return r("Chrome shim is not included in this adapter release."),a;if(n.version===null)return r("Chrome shim can not determine version, not shimming."),a;r("adapter.js shimming chrome."),a.browserShim=gM,p_(t,n),h_(t),gq(t,n),yq(t),lC(t,n),vq(t),wq(t,n),_q(t),bq(t),Sq(t,n),u_(t),dC(t),fC(t),d_(t,n),f_(t),pC(t,n);break;case"firefox":if(!yM||!uC||!e.shimFirefox)return r("Firefox shim is not included in this adapter release."),a;r("adapter.js shimming firefox."),a.browserShim=yM,p_(t,n),h_(t),Eq(t,n),uC(t,n),Tq(t),Pq(t),Cq(t),xq(t),Aq(t),Rq(t),Dq(t),Oq(t),Nq(t),u_(t),fC(t),d_(t,n),f_(t);break;case"safari":if(!vM||!e.shimSafari)return r("Safari shim is not included in this adapter release."),a;r("adapter.js shimming safari."),a.browserShim=vM,p_(t,n),h_(t),Uq(t),qq(t),jq(t),Iq(t),Mq(t),Fq(t),Lq(t),zq(t),u_(t),dC(t),d_(t,n),f_(t),pC(t,n);break;default:r("Unsupported browser!");break}return a}Wle({window:typeof window>"u"?void 0:window});class li extends Promise{constructor(e){super(e)}catch(e){return super.catch(e)}static reject(e){return super.reject(e)}static all(e){return super.all(e)}static race(e){return super.race(e)}}const Kle=/version\/(\d+(\.?_?\d+)+)/i;let aE;function fi(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(typeof navigator>"u")return;const r=navigator.userAgent.toLowerCase();if(aE===void 0||e){const n=Yle.find(a=>{let{test:i}=a;return i.test(r)});aE=n?.describe(r)}return aE}const Yle=[{test:/firefox|iceweasel|fxios/i,describe(t){return{name:"Firefox",version:m_(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,t),os:t.toLowerCase().includes("fxios")?"iOS":void 0,osVersion:iE(t)}}},{test:/chrom|crios|crmo/i,describe(t){return{name:"Chrome",version:m_(/(?:chrome|chromium|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t),os:t.toLowerCase().includes("crios")?"iOS":void 0,osVersion:iE(t)}}},{test:/safari|applewebkit/i,describe(t){return{name:"Safari",version:m_(Kle,t),os:t.includes("mobile/")?"iOS":"macOS",osVersion:iE(t)}}}];function m_(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;const n=e.match(t);return n&&n.length>=r&&n[r]||""}function iE(t){return t.includes("mac os")?m_(/\(.+?(\d+_\d+(:?_\d+)?)/,t,1).replace(/_/g,"."):void 0}var Xle="2.17.0";const Jle=Xle,Qle=16;class ec extends Error{constructor(e,r){super(r||"an error has occured"),this.name="LiveKitError",this.code=e}}var ln;(function(t){t[t.NotAllowed=0]="NotAllowed",t[t.ServerUnreachable=1]="ServerUnreachable",t[t.InternalError=2]="InternalError",t[t.Cancelled=3]="Cancelled",t[t.LeaveRequest=4]="LeaveRequest",t[t.Timeout=5]="Timeout",t[t.WebSocket=6]="WebSocket",t[t.ServiceNotFound=7]="ServiceNotFound"})(ln||(ln={}));class Gt extends ec{constructor(e,r,n,a){super(1,e),this.name="ConnectionError",this.status=n,this.reason=r,this.context=a,this.reasonName=ln[r]}static notAllowed(e,r,n){return new Gt(e,ln.NotAllowed,r,n)}static timeout(e){return new Gt(e,ln.Timeout)}static leaveRequest(e,r){return new Gt(e,ln.LeaveRequest,void 0,r)}static internal(e,r){return new Gt(e,ln.InternalError,void 0,r)}static cancelled(e){return new Gt(e,ln.Cancelled)}static serverUnreachable(e,r){return new Gt(e,ln.ServerUnreachable,r)}static websocket(e,r,n){return new Gt(e,ln.WebSocket,r,n)}static serviceNotFound(e,r){return new Gt(e,ln.ServiceNotFound,void 0,r)}}class GP extends ec{constructor(e){super(21,e??"device is unsupported"),this.name="DeviceUnsupportedError"}}class Rc extends ec{constructor(e){super(20,e??"track is invalid"),this.name="TrackInvalidError"}}class Zle extends ec{constructor(e){super(10,e??"unsupported server"),this.name="UnsupportedServer"}}class Ln extends ec{constructor(e){super(12,e??"unexpected connection state"),this.name="UnexpectedConnectionState"}}class $f extends ec{constructor(e){super(13,e??"unable to negotiate"),this.name="NegotiationError"}}class bM extends ec{constructor(e,r){super(15,e),this.name="PublishTrackError",this.status=r}}class kM extends ec{constructor(e,r){super(15,e),this.name="SignalRequestError",this.reason=r,this.reasonName=typeof r=="string"?r:HP[r]}}var za;(function(t){t[t.AlreadyOpened=0]="AlreadyOpened",t[t.AbnormalEnd=1]="AbnormalEnd",t[t.DecodeFailed=2]="DecodeFailed",t[t.LengthExceeded=3]="LengthExceeded",t[t.Incomplete=4]="Incomplete",t[t.HandlerAlreadyRegistered=7]="HandlerAlreadyRegistered",t[t.EncryptionTypeMismatch=8]="EncryptionTypeMismatch"})(za||(za={}));class as extends ec{constructor(e,r){super(16,e),this.name="DataStreamError",this.reason=r,this.reasonName=za[r]}}class df extends ec{constructor(e){super(18,e),this.name="SignalReconnectError"}}var ub;(function(t){t.PermissionDenied="PermissionDenied",t.NotFound="NotFound",t.DeviceInUse="DeviceInUse",t.Other="Other"})(ub||(ub={}));(function(t){function e(r){if(r&&"name"in r)return r.name==="NotFoundError"||r.name==="DevicesNotFoundError"?t.NotFound:r.name==="NotAllowedError"||r.name==="PermissionDeniedError"?t.PermissionDenied:r.name==="NotReadableError"||r.name==="TrackStartError"?t.DeviceInUse:t.Other}t.getFailure=e})(ub||(ub={}));class Ta{}Ta.setTimeout=function(){return setTimeout(...arguments)};Ta.setInterval=function(){return setInterval(...arguments)};Ta.clearTimeout=function(){return clearTimeout(...arguments)};Ta.clearInterval=function(){return clearInterval(...arguments)};var tt;(function(t){t.Connected="connected",t.Reconnecting="reconnecting",t.SignalReconnecting="signalReconnecting",t.Reconnected="reconnected",t.Disconnected="disconnected",t.ConnectionStateChanged="connectionStateChanged",t.Moved="moved",t.MediaDevicesChanged="mediaDevicesChanged",t.ParticipantConnected="participantConnected",t.ParticipantDisconnected="participantDisconnected",t.TrackPublished="trackPublished",t.TrackSubscribed="trackSubscribed",t.TrackSubscriptionFailed="trackSubscriptionFailed",t.TrackUnpublished="trackUnpublished",t.TrackUnsubscribed="trackUnsubscribed",t.TrackMuted="trackMuted",t.TrackUnmuted="trackUnmuted",t.LocalTrackPublished="localTrackPublished",t.LocalTrackUnpublished="localTrackUnpublished",t.LocalAudioSilenceDetected="localAudioSilenceDetected",t.ActiveSpeakersChanged="activeSpeakersChanged",t.ParticipantMetadataChanged="participantMetadataChanged",t.ParticipantNameChanged="participantNameChanged",t.ParticipantAttributesChanged="participantAttributesChanged",t.ParticipantActive="participantActive",t.RoomMetadataChanged="roomMetadataChanged",t.DataReceived="dataReceived",t.SipDTMFReceived="sipDTMFReceived",t.TranscriptionReceived="transcriptionReceived",t.ConnectionQualityChanged="connectionQualityChanged",t.TrackStreamStateChanged="trackStreamStateChanged",t.TrackSubscriptionPermissionChanged="trackSubscriptionPermissionChanged",t.TrackSubscriptionStatusChanged="trackSubscriptionStatusChanged",t.AudioPlaybackStatusChanged="audioPlaybackChanged",t.VideoPlaybackStatusChanged="videoPlaybackChanged",t.MediaDevicesError="mediaDevicesError",t.ParticipantPermissionsChanged="participantPermissionsChanged",t.SignalConnected="signalConnected",t.RecordingStatusChanged="recordingStatusChanged",t.ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",t.EncryptionError="encryptionError",t.DCBufferStatusChanged="dcBufferStatusChanged",t.ActiveDeviceChanged="activeDeviceChanged",t.ChatMessage="chatMessage",t.LocalTrackSubscribed="localTrackSubscribed",t.MetricsReceived="metricsReceived"})(tt||(tt={}));var yt;(function(t){t.TrackPublished="trackPublished",t.TrackSubscribed="trackSubscribed",t.TrackSubscriptionFailed="trackSubscriptionFailed",t.TrackUnpublished="trackUnpublished",t.TrackUnsubscribed="trackUnsubscribed",t.TrackMuted="trackMuted",t.TrackUnmuted="trackUnmuted",t.LocalTrackPublished="localTrackPublished",t.LocalTrackUnpublished="localTrackUnpublished",t.LocalTrackCpuConstrained="localTrackCpuConstrained",t.LocalSenderCreated="localSenderCreated",t.ParticipantMetadataChanged="participantMetadataChanged",t.ParticipantNameChanged="participantNameChanged",t.DataReceived="dataReceived",t.SipDTMFReceived="sipDTMFReceived",t.TranscriptionReceived="transcriptionReceived",t.IsSpeakingChanged="isSpeakingChanged",t.ConnectionQualityChanged="connectionQualityChanged",t.TrackStreamStateChanged="trackStreamStateChanged",t.TrackSubscriptionPermissionChanged="trackSubscriptionPermissionChanged",t.TrackSubscriptionStatusChanged="trackSubscriptionStatusChanged",t.TrackCpuConstrained="trackCpuConstrained",t.MediaDevicesError="mediaDevicesError",t.AudioStreamAcquired="audioStreamAcquired",t.ParticipantPermissionsChanged="participantPermissionsChanged",t.PCTrackAdded="pcTrackAdded",t.AttributesChanged="attributesChanged",t.LocalTrackSubscribed="localTrackSubscribed",t.ChatMessage="chatMessage",t.Active="active"})(yt||(yt={}));var ht;(function(t){t.TransportsCreated="transportsCreated",t.Connected="connected",t.Disconnected="disconnected",t.Resuming="resuming",t.Resumed="resumed",t.Restarting="restarting",t.Restarted="restarted",t.SignalResumed="signalResumed",t.SignalRestarted="signalRestarted",t.Closing="closing",t.MediaTrackAdded="mediaTrackAdded",t.ActiveSpeakersUpdate="activeSpeakersUpdate",t.DataPacketReceived="dataPacketReceived",t.RTPVideoMapUpdate="rtpVideoMapUpdate",t.DCBufferStatusChanged="dcBufferStatusChanged",t.ParticipantUpdate="participantUpdate",t.RoomUpdate="roomUpdate",t.SpeakersChanged="speakersChanged",t.StreamStateChanged="streamStateChanged",t.ConnectionQualityUpdate="connectionQualityUpdate",t.SubscriptionError="subscriptionError",t.SubscriptionPermissionUpdate="subscriptionPermissionUpdate",t.RemoteMute="remoteMute",t.SubscribedQualityUpdate="subscribedQualityUpdate",t.LocalTrackUnpublished="localTrackUnpublished",t.LocalTrackSubscribed="localTrackSubscribed",t.Offline="offline",t.SignalRequestResponse="signalRequestResponse",t.SignalConnected="signalConnected",t.RoomMoved="roomMoved"})(ht||(ht={}));var dt;(function(t){t.Message="message",t.Muted="muted",t.Unmuted="unmuted",t.Restarted="restarted",t.Ended="ended",t.Subscribed="subscribed",t.Unsubscribed="unsubscribed",t.CpuConstrained="cpuConstrained",t.UpdateSettings="updateSettings",t.UpdateSubscription="updateSubscription",t.AudioPlaybackStarted="audioPlaybackStarted",t.AudioPlaybackFailed="audioPlaybackFailed",t.AudioSilenceDetected="audioSilenceDetected",t.VisibilityChanged="visibilityChanged",t.VideoDimensionsChanged="videoDimensionsChanged",t.VideoPlaybackStarted="videoPlaybackStarted",t.VideoPlaybackFailed="videoPlaybackFailed",t.ElementAttached="elementAttached",t.ElementDetached="elementDetached",t.UpstreamPaused="upstreamPaused",t.UpstreamResumed="upstreamResumed",t.SubscriptionPermissionChanged="subscriptionPermissionChanged",t.SubscriptionStatusChanged="subscriptionStatusChanged",t.SubscriptionFailed="subscriptionFailed",t.TrackProcessorUpdate="trackProcessorUpdate",t.AudioTrackFeatureUpdate="audioTrackFeatureUpdate",t.TranscriptionReceived="transcriptionReceived",t.TimeSyncUpdate="timeSyncUpdate",t.PreConnectBufferFlushed="preConnectBufferFlushed"})(dt||(dt={}));function eue(t){return typeof t>"u"?t:typeof structuredClone=="function"?typeof t=="object"&&t!==null?structuredClone(Object.assign({},t)):structuredClone(t):JSON.parse(JSON.stringify(t))}class en{constructor(e,r,n,a,i){if(typeof e=="object")this.width=e.width,this.height=e.height,this.aspectRatio=e.aspectRatio,this.encoding={maxBitrate:e.maxBitrate,maxFramerate:e.maxFramerate,priority:e.priority};else if(r!==void 0&&n!==void 0)this.width=e,this.height=r,this.aspectRatio=e/r,this.encoding={maxBitrate:n,maxFramerate:a,priority:i};else throw new TypeError("Unsupported options: provide at least width, height and maxBitrate")}get resolution(){return{width:this.width,height:this.height,frameRate:this.encoding.maxFramerate,aspectRatio:this.aspectRatio}}}const tue=["vp8","h264"],rue=["vp8","h264","vp9","av1","h265"];function nue(t){return!!tue.find(e=>e===t)}const aue=nue;var wM;(function(t){t[t.PREFER_REGRESSION=0]="PREFER_REGRESSION",t[t.SIMULCAST=1]="SIMULCAST",t[t.REGRESSION=2]="REGRESSION"})(wM||(wM={}));var hC;(function(t){t.telephone={maxBitrate:12e3},t.speech={maxBitrate:24e3},t.music={maxBitrate:48e3},t.musicStereo={maxBitrate:64e3},t.musicHighQuality={maxBitrate:96e3},t.musicHighQualityStereo={maxBitrate:128e3}})(hC||(hC={}));const up={h90:new en(160,90,9e4,20),h180:new en(320,180,16e4,20),h216:new en(384,216,18e4,20),h360:new en(640,360,45e4,20),h540:new en(960,540,8e5,25),h720:new en(1280,720,17e5,30),h1080:new en(1920,1080,3e6,30),h1440:new en(2560,1440,5e6,30),h2160:new en(3840,2160,8e6,30)},mC={h120:new en(160,120,7e4,20),h180:new en(240,180,125e3,20),h240:new en(320,240,14e4,20),h360:new en(480,360,33e4,20),h480:new en(640,480,5e5,20),h540:new en(720,540,6e5,25),h720:new en(960,720,13e5,30),h1080:new en(1440,1080,23e5,30),h1440:new en(1920,1440,38e5,30)},WP={h360fps3:new en(640,360,2e5,3,"medium"),h360fps15:new en(640,360,4e5,15,"medium"),h720fps5:new en(1280,720,8e5,5,"medium"),h720fps15:new en(1280,720,15e5,15,"medium"),h720fps30:new en(1280,720,2e6,30,"medium"),h1080fps15:new en(1920,1080,25e5,15,"medium"),h1080fps30:new en(1920,1080,5e6,30,"medium"),original:new en(0,0,7e6,30,"medium")};function Vq(t,e,r){var n,a,i,o;const{optionsWithoutProcessor:c,audioProcessor:u,videoProcessor:d}=Wq(t??{}),f=e?.processor,h=r?.processor,m=c??{};return m.audio===!0&&(m.audio={}),m.video===!0&&(m.video={}),m.audio&&(gC(m.audio,e),(n=(i=m.audio).deviceId)!==null&&n!==void 0||(i.deviceId={ideal:"default"}),(u||f)&&(m.audio.processor=u??f)),m.video&&(gC(m.video,r),(a=(o=m.video).deviceId)!==null&&a!==void 0||(o.deviceId={ideal:"default"}),(d||h)&&(m.video.processor=d??h)),m}function gC(t,e){return Object.keys(e).forEach(r=>{t[r]===void 0&&(t[r]=e[r])}),t}function KP(t){var e,r,n,a;const i={};if(t.video)if(typeof t.video=="object"){const o={},c=o,u=t.video;Object.keys(u).forEach(d=>{switch(d){case"resolution":gC(c,u.resolution);break;default:c[d]=u[d]}}),i.video=o,(e=(n=i.video).deviceId)!==null&&e!==void 0||(n.deviceId={ideal:"default"})}else i.video=t.video?{deviceId:{ideal:"default"}}:!1;else i.video=!1;return t.audio?typeof t.audio=="object"?(i.audio=t.audio,(r=(a=i.audio).deviceId)!==null&&r!==void 0||(a.deviceId={ideal:"default"})):i.audio={deviceId:{ideal:"default"}}:i.audio=!1,i}function Hq(t){return ne(this,arguments,void 0,function(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:200;return(function*(){const n=Gq();if(n){const a=n.createAnalyser();a.fftSize=2048;const i=a.frequencyBinCount,o=new Uint8Array(i);n.createMediaStreamSource(new MediaStream([e.mediaStreamTrack])).connect(a),yield Ca(r),a.getByteTimeDomainData(o);const u=o.some(d=>d!==128&&d!==0);return n.close(),!u}return!1})()})}function Gq(){var t;const e=typeof window<"u"&&(window.AudioContext||window.webkitAudioContext);if(e){const r=new e({latencyHint:"interactive"});if(r.state==="suspended"&&typeof window<"u"&&(!((t=window.document)===null||t===void 0)&&t.body)){const n=()=>ne(this,void 0,void 0,function*(){var a;try{r.state==="suspended"&&(yield r.resume())}catch{}finally{(a=window.document.body)===null||a===void 0||a.removeEventListener("click",n)}});r.addEventListener("statechange",()=>{var a;r.state==="closed"&&((a=window.document.body)===null||a===void 0||a.removeEventListener("click",n))}),window.document.body.addEventListener("click",n)}return r}}function iue(t){return t==="audioinput"?Ke.Source.Microphone:t==="videoinput"?Ke.Source.Camera:Ke.Source.Unknown}function yC(t){return t===Ke.Source.Microphone?"audioinput":t===Ke.Source.Camera?"videoinput":void 0}function sue(t){var e,r;let n=(e=t.video)!==null&&e!==void 0?e:!0;return t.resolution&&t.resolution.width>0&&t.resolution.height>0&&(n=typeof n=="boolean"?{}:n,hd()?n=Object.assign(Object.assign({},n),{width:{max:t.resolution.width},height:{max:t.resolution.height},frameRate:t.resolution.frameRate}):n=Object.assign(Object.assign({},n),{width:{ideal:t.resolution.width},height:{ideal:t.resolution.height},frameRate:t.resolution.frameRate})),{audio:(r=t.audio)!==null&&r!==void 0?r:!1,video:n,controller:t.controller,selfBrowserSurface:t.selfBrowserSurface,surfaceSwitching:t.surfaceSwitching,systemAudio:t.systemAudio,preferCurrentTab:t.preferCurrentTab}}function mm(t){return t.split("/")[1].toLowerCase()}function oue(t){const e=[];return t.forEach(r=>{r.track!==void 0&&e.push(new FP({cid:r.track.mediaStreamID,track:r.trackInfo}))}),e}function vr(t){return"mediaStreamTrack"in t?{trackID:t.sid,source:t.source,muted:t.isMuted,enabled:t.mediaStreamTrack.enabled,kind:t.kind,streamID:t.mediaStreamID,streamTrackID:t.mediaStreamTrack.id}:{trackID:t.trackSid,enabled:t.isEnabled,muted:t.isMuted,trackInfo:Object.assign({mimeType:t.mimeType,name:t.trackName,encrypted:t.isEncrypted,kind:t.kind,source:t.source},t.track?vr(t.track):{})}}function cue(){return typeof RTCRtpReceiver<"u"&&"getSynchronizationSources"in RTCRtpReceiver}function lue(t,e){var r;t===void 0&&(t={}),e===void 0&&(e={});const n=[...Object.keys(e),...Object.keys(t)],a={};for(const i of n)t[i]!==e[i]&&(a[i]=(r=e[i])!==null&&r!==void 0?r:"");return a}function Wq(t){const e=Object.assign({},t);let r,n;return typeof e.audio=="object"&&e.audio.processor&&(r=e.audio.processor,e.audio=Object.assign(Object.assign({},e.audio),{processor:void 0})),typeof e.video=="object"&&e.video.processor&&(n=e.video.processor,e.video=Object.assign(Object.assign({},e.video),{processor:void 0})),{audioProcessor:r,videoProcessor:n,optionsWithoutProcessor:eue(e)}}function uue(t){switch(t){case Yn.CAMERA:return Ke.Source.Camera;case Yn.MICROPHONE:return Ke.Source.Microphone;case Yn.SCREEN_SHARE:return Ke.Source.ScreenShare;case Yn.SCREEN_SHARE_AUDIO:return Ke.Source.ScreenShareAudio;default:return Ke.Source.Unknown}}function SM(t,e){return t.width*t.height<e.width*e.height}function due(t,e){var r;return(r=t.layers)===null||r===void 0?void 0:r.find(n=>n.quality===e)}const fue=5e3,Rh=[];var Ii;(function(t){t[t.LOW=0]="LOW",t[t.MEDIUM=1]="MEDIUM",t[t.HIGH=2]="HIGH"})(Ii||(Ii={}));class Ke extends Zo.EventEmitter{get streamState(){return this._streamState}setStreamState(e){this._streamState=e}constructor(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var a;super(),this.attachedElements=[],this.isMuted=!1,this._streamState=Ke.StreamState.Active,this.isInBackground=!1,this._currentBitrate=0,this.log=or,this.appVisibilityChangedListener=()=>{this.backgroundTimeout&&clearTimeout(this.backgroundTimeout),document.visibilityState==="hidden"?this.backgroundTimeout=setTimeout(()=>this.handleAppVisibilityChanged(),fue):this.handleAppVisibilityChanged()},this.log=Vc((a=n.loggerName)!==null&&a!==void 0?a:eo.Track),this.loggerContextCb=n.loggerContextCb,this.setMaxListeners(100),this.kind=r,this._mediaStreamTrack=e,this._mediaStreamID=e.id,this.source=Ke.Source.Unknown}get logContext(){var e;return Object.assign(Object.assign({},(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this)),vr(this))}get currentBitrate(){return this._currentBitrate}get mediaStreamTrack(){return this._mediaStreamTrack}get mediaStreamID(){return this._mediaStreamID}attach(e){let r="audio";this.kind===Ke.Kind.Video&&(r="video"),this.attachedElements.length===0&&this.kind===Ke.Kind.Video&&this.addAppVisibilityListener(),e||(r==="audio"&&(Rh.forEach(i=>{i.parentElement===null&&!e&&(e=i)}),e&&Rh.splice(Rh.indexOf(e),1)),e||(e=document.createElement(r))),this.attachedElements.includes(e)||this.attachedElements.push(e),Cf(this.mediaStreamTrack,e);const n=e.srcObject.getTracks(),a=n.some(i=>i.kind==="audio");return e.play().then(()=>{this.emit(a?dt.AudioPlaybackStarted:dt.VideoPlaybackStarted)}).catch(i=>{i.name==="NotAllowedError"?this.emit(a?dt.AudioPlaybackFailed:dt.VideoPlaybackFailed,i):i.name==="AbortError"?or.debug("".concat(a?"audio":"video"," playback aborted, likely due to new play request")):or.warn("could not playback ".concat(a?"audio":"video"),i),a&&e&&n.some(o=>o.kind==="video")&&i.name==="NotAllowedError"&&(e.muted=!0,e.play().catch(()=>{}))}),this.emit(dt.ElementAttached,e),e}detach(e){try{if(e){Vf(this.mediaStreamTrack,e);const n=this.attachedElements.indexOf(e);return n>=0&&(this.attachedElements.splice(n,1),this.recycleElement(e),this.emit(dt.ElementDetached,e)),e}const r=[];return this.attachedElements.forEach(n=>{Vf(this.mediaStreamTrack,n),r.push(n),this.recycleElement(n),this.emit(dt.ElementDetached,n)}),this.attachedElements=[],r}finally{this.attachedElements.length===0&&this.removeAppVisibilityListener()}}stop(){this.stopMonitor(),this._mediaStreamTrack.stop()}enable(){this._mediaStreamTrack.enabled=!0}disable(){this._mediaStreamTrack.enabled=!1}stopMonitor(){this.monitorInterval&&clearInterval(this.monitorInterval),this.timeSyncHandle&&cancelAnimationFrame(this.timeSyncHandle)}updateLoggerOptions(e){e.loggerName&&(this.log=Vc(e.loggerName)),e.loggerContextCb&&(this.loggerContextCb=e.loggerContextCb)}recycleElement(e){if(e instanceof HTMLAudioElement){let r=!0;e.pause(),Rh.forEach(n=>{n.parentElement||(r=!1)}),r&&Rh.push(e)}}handleAppVisibilityChanged(){return ne(this,void 0,void 0,function*(){this.isInBackground=document.visibilityState==="hidden",!this.isInBackground&&this.kind===Ke.Kind.Video&&setTimeout(()=>this.attachedElements.forEach(e=>e.play().catch(()=>{})),0)})}addAppVisibilityListener(){ui()?(this.isInBackground=document.visibilityState==="hidden",document.addEventListener("visibilitychange",this.appVisibilityChangedListener)):this.isInBackground=!1}removeAppVisibilityListener(){ui()&&document.removeEventListener("visibilitychange",this.appVisibilityChangedListener)}}function Cf(t,e){let r;e.srcObject instanceof MediaStream?r=e.srcObject:r=new MediaStream;let n;t.kind==="audio"?n=r.getAudioTracks():n=r.getVideoTracks(),n.includes(t)||(n.forEach(a=>{r.removeTrack(a)}),r.addTrack(t)),(!hd()||!(e instanceof HTMLVideoElement))&&(e.autoplay=!0),e.muted=r.getAudioTracks().length===0,e instanceof HTMLVideoElement&&(e.playsInline=!0),e.srcObject!==r&&(e.srcObject=r,(hd()||pd())&&e instanceof HTMLVideoElement&&setTimeout(()=>{e.srcObject=r,e.play().catch(()=>{})},0))}function Vf(t,e){if(e.srcObject instanceof MediaStream){const r=e.srcObject;r.removeTrack(t),r.getTracks().length>0?e.srcObject=r:e.srcObject=null}}(function(t){let e;(function(d){d.Audio="audio",d.Video="video",d.Unknown="unknown"})(e=t.Kind||(t.Kind={}));let r;(function(d){d.Camera="camera",d.Microphone="microphone",d.ScreenShare="screen_share",d.ScreenShareAudio="screen_share_audio",d.Unknown="unknown"})(r=t.Source||(t.Source={}));let n;(function(d){d.Active="active",d.Paused="paused",d.Unknown="unknown"})(n=t.StreamState||(t.StreamState={}));function a(d){switch(d){case e.Audio:return zs.AUDIO;case e.Video:return zs.VIDEO;default:return zs.DATA}}t.kindToProto=a;function i(d){switch(d){case zs.AUDIO:return e.Audio;case zs.VIDEO:return e.Video;default:return e.Unknown}}t.kindFromProto=i;function o(d){switch(d){case r.Camera:return Yn.CAMERA;case r.Microphone:return Yn.MICROPHONE;case r.ScreenShare:return Yn.SCREEN_SHARE;case r.ScreenShareAudio:return Yn.SCREEN_SHARE_AUDIO;default:return Yn.UNKNOWN}}t.sourceToProto=o;function c(d){switch(d){case Yn.CAMERA:return r.Camera;case Yn.MICROPHONE:return r.Microphone;case Yn.SCREEN_SHARE:return r.ScreenShare;case Yn.SCREEN_SHARE_AUDIO:return r.ScreenShareAudio;default:return r.Unknown}}t.sourceFromProto=c;function u(d){switch(d){case iC.ACTIVE:return n.Active;case iC.PAUSED:return n.Paused;default:return n.Unknown}}t.streamStateFromProto=u})(Ke||(Ke={}));const pue="|",EM="https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension";function hue(t){const e=t.split(pue);return e.length>1?[e[0],t.substr(e[0].length+1)]:[t,""]}function Ca(t){return new li(e=>Ta.setTimeout(e,t))}function vC(){return"addTransceiver"in RTCPeerConnection.prototype}function _C(){return"addTrack"in RTCPeerConnection.prototype}function mue(){if(!("getCapabilities"in RTCRtpSender)||hd()||pd())return!1;const t=RTCRtpSender.getCapabilities("video");let e=!1;if(t){for(const r of t.codecs)if(r.mimeType.toLowerCase()==="video/av1"){e=!0;break}}return e}function gue(){if(!("getCapabilities"in RTCRtpSender)||pd())return!1;if(hd()){const r=fi();if(r?.version&&Xo(r.version,"16")<0||r?.os==="iOS"&&r?.osVersion&&Xo(r.osVersion,"16")<0)return!1}const t=RTCRtpSender.getCapabilities("video");let e=!1;if(t){for(const r of t.codecs)if(r.mimeType.toLowerCase()==="video/vp9"){e=!0;break}}return e}function Vs(t){return t==="av1"||t==="vp9"}function bC(t){return!document||Gm()?!1:(t||(t=document.createElement("audio")),"setSinkId"in t)}function yue(){return typeof RTCPeerConnection>"u"?!1:vC()||_C()}function pd(){var t;return((t=fi())===null||t===void 0?void 0:t.name)==="Firefox"}function TM(){const t=fi();return!!t&&t.name==="Chrome"&&t.os!=="iOS"}function hd(){var t;return((t=fi())===null||t===void 0?void 0:t.name)==="Safari"}function Gm(){const t=fi();return t?.name==="Safari"||t?.os==="iOS"}function vue(){const t=fi();return t?.name==="Safari"&&t.version.startsWith("17.")||t?.os==="iOS"&&!!t?.osVersion&&Xo(t.osVersion,"17")>=0}function _ue(t){return t||(t=fi()),t?.name==="Safari"&&Xo(t.version,"18.3")>0||t?.os==="iOS"&&!!t?.osVersion&&Xo(t.osVersion,"18.3")>0}function Kq(){var t,e;return ui()?(e=(t=navigator.userAgentData)===null||t===void 0?void 0:t.mobile)!==null&&e!==void 0?e:/Tablet|iPad|Mobile|Android|BlackBerry/.test(navigator.userAgent):!1}function bue(){const t=fi(),e="17.2";if(t)return t.name!=="Safari"&&t.os!=="iOS"||t.os==="iOS"&&t.osVersion&&Xo(t.osVersion,e)>=0?!0:t.name==="Safari"&&Xo(t.version,e)>=0}function ui(){return typeof document<"u"}function Yo(){return navigator.product=="ReactNative"}function dp(t){return t.hostname.endsWith(".livekit.cloud")||t.hostname.endsWith(".livekit.run")}function sE(t){return dp(t)?t.hostname.split(".")[0]:null}function Yq(){if(global&&global.LiveKitReactNativeGlobal)return global.LiveKitReactNativeGlobal}function Xq(){if(!Yo())return;let t=Yq();if(t)return t.platform}function CM(){if(ui())return window.devicePixelRatio;if(Yo()){let t=Yq();if(t)return t.devicePixelRatio}return 1}function Xo(t,e){const r=t.split("."),n=e.split("."),a=Math.min(r.length,n.length);for(let i=0;i<a;++i){const o=parseInt(r[i],10),c=parseInt(n[i],10);if(o>c)return 1;if(o<c)return-1;if(i===a-1&&o===c)return 0}return t===""&&e!==""?-1:e===""?1:r.length==n.length?0:r.length<n.length?-1:1}function kue(t){for(const e of t)e.target.handleResize(e)}function wue(t){for(const e of t)e.target.handleVisibilityChanged(e)}let oE=null;const xM=()=>(oE||(oE=new ResizeObserver(kue)),oE);let cE=null;const PM=()=>(cE||(cE=new IntersectionObserver(wue,{root:null,rootMargin:"0px"})),cE);function Sue(){var t;const e=new J5({sdk:Q5.JS,protocol:Qle,version:Jle});return Yo()&&(e.os=(t=Xq())!==null&&t!==void 0?t:""),e}function AM(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:16,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:16,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;const a=document.createElement("canvas");a.width=t,a.height=e;const i=a.getContext("2d");i?.fillRect(0,0,a.width,a.height),n&&i&&(i.beginPath(),i.arc(t/2,e/2,50,0,Math.PI*2,!0),i.closePath(),i.fillStyle="grey",i.fill());const o=a.captureStream(),[c]=o.getTracks();if(!c)throw Error("Could not get empty media stream video track");return c.enabled=r,c}let Dh;function lE(){if(!Dh){const t=new AudioContext,e=t.createOscillator(),r=t.createGain();r.gain.setValueAtTime(0,0);const n=t.createMediaStreamDestination();if(e.connect(r),r.connect(n),e.start(),[Dh]=n.stream.getAudioTracks(),!Dh)throw Error("Could not get empty media stream audio track");Dh.enabled=!1}return Dh.clone()}class ds{get isResolved(){return this._isResolved}constructor(e,r){this._isResolved=!1,this.onFinally=r,this.promise=new Promise((n,a)=>ne(this,void 0,void 0,function*(){this.resolve=n,this.reject=a,e&&(yield e(n,a))})).finally(()=>{var n;this._isResolved=!0,(n=this.onFinally)===null||n===void 0||n.call(this)})}}function Eue(t){return rue.includes(t)}function Hl(t){if(typeof t=="string"||typeof t=="number")return t;if(Array.isArray(t))return t[0];if(t.exact!==void 0)return Array.isArray(t.exact)?t.exact[0]:t.exact;if(t.ideal!==void 0)return Array.isArray(t.ideal)?t.ideal[0]:t.ideal;throw Error("could not unwrap constraint")}function Tue(t){return t.startsWith("http")?t.replace(/^(http)/,"ws"):t}function Wm(t){return t.startsWith("ws")?t.replace(/^(ws)/,"http"):t}function Cue(t,e){return t.segments.map(r=>{let{id:n,text:a,language:i,startTime:o,endTime:c,final:u}=r;var d;const f=(d=e.get(n))!==null&&d!==void 0?d:Date.now(),h=Date.now();return u?e.delete(n):e.set(n,f),{id:n,text:a,startTime:Number.parseInt(o.toString()),endTime:Number.parseInt(c.toString()),final:u,language:i,firstReceivedTime:f,lastReceivedTime:h}})}function xue(t){const{id:e,timestamp:r,message:n,editTimestamp:a}=t;return{id:e,timestamp:Number.parseInt(r.toString()),editTimestamp:a?Number.parseInt(a.toString()):void 0,message:n}}function RM(t){switch(t.reason){case ln.LeaveRequest:return t.context;case ln.Cancelled:return Ws.CLIENT_INITIATED;case ln.NotAllowed:return Ws.USER_REJECTED;case ln.ServerUnreachable:return Ws.JOIN_FAILURE;default:return Ws.UNKNOWN_REASON}}function g_(t){return t!==void 0?Number(t):void 0}function $u(t){return t!==void 0?BigInt(t):void 0}function Hf(t){return!!t&&!(t instanceof MediaStreamTrack)&&t.isLocal}function qo(t){return!!t&&t.kind==Ke.Kind.Audio}function hu(t){return!!t&&t.kind==Ke.Kind.Video}function Tl(t){return Hf(t)&&hu(t)}function Ec(t){return Hf(t)&&qo(t)}function kC(t){return!!t&&!t.isLocal}function Pue(t){return!!t&&!t.isLocal}function uE(t){return kC(t)&&hu(t)}function Aue(t){return t.isLocal}function Rue(t,e){const r=[];let n=new TextEncoder().encode(t);for(;n.length>e;){let a=e;for(;a>0;){const i=n[a];if(i!==void 0&&(i&192)!==128)break;a--}r.push(n.slice(0,a)),n=n.slice(a)}return n.length>0&&r.push(n),r}function Due(t){var e;const r=t.get("Cache-Control");if(r){const n=(e=r.match(/(?:^|[,\s])max-age=(\d+)/))===null||e===void 0?void 0:e[1];if(n)return parseInt(n,10)}}function Oue(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const n=Nue(t,e);return r?n:YP(n,"v1")}function Nue(t,e){const r=new URL(Tue(t));return e.forEach((n,a)=>{r.searchParams.set(a,n)}),YP(r,"rtc")}function Iue(t){const e=new URL(Wm(t));return YP(e,"validate")}function Jq(t){return t.endsWith("/")?t:"".concat(t,"/")}function YP(t,e){return t.pathname="".concat(Jq(t.pathname)).concat(e),t}function DM(t){if(typeof t=="string")return lM.fromJson(JSON.parse(t),{ignoreUnknownFields:!0});if(t instanceof ArrayBuffer)return lM.fromBinary(new Uint8Array(t));throw new Error("could not decode websocket message: ".concat(typeof t))}function Mue(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Unknown reason";if(!(t instanceof AbortSignal))return e;const r=t.reason;switch(typeof r){case"string":return r;case"object":return r instanceof Error?r.message:e;default:return"toString"in r?r.toString():e}}const jue=10,Oh="lk_e2ee",Lue="LKFrameEncryptionKey",Bue={sharedKey:!1,ratchetSalt:Lue,ratchetWindowSize:8,failureTolerance:jue,keyringSize:16};var Gl;(function(t){t.SetKey="setKey",t.RatchetRequest="ratchetRequest",t.KeyRatcheted="keyRatcheted"})(Gl||(Gl={}));var OM;(function(t){t.KeyRatcheted="keyRatcheted"})(OM||(OM={}));var jl;(function(t){t.ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",t.EncryptionError="encryptionError"})(jl||(jl={}));var NM;(function(t){t.Error="cryptorError"})(NM||(NM={}));function Uue(){return Fue()||wC()}function wC(){return typeof window.RTCRtpScriptTransform<"u"}function Fue(){return typeof window.RTCRtpSender<"u"&&typeof window.RTCRtpSender.prototype.createEncodedStreams<"u"}function que(t){var e,r,n,a,i;if(((e=t.value)===null||e===void 0?void 0:e.case)!=="sipDtmf"&&((r=t.value)===null||r===void 0?void 0:r.case)!=="metrics"&&((n=t.value)===null||n===void 0?void 0:n.case)!=="speaker"&&((a=t.value)===null||a===void 0?void 0:a.case)!=="transcription"&&((i=t.value)===null||i===void 0?void 0:i.case)!=="encryptedPacket")return new V5({value:t.value})}class USe extends Zo.EventEmitter{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};super(),this.onKeyRatcheted=(r,n,a)=>{or.debug("key ratcheted event received",{ratchetResult:r,participantId:n,keyIndex:a})},this.keyInfoMap=new Map,this.options=Object.assign(Object.assign({},Bue),e),this.on(Gl.KeyRatcheted,this.onKeyRatcheted)}onSetEncryptionKey(e,r,n){const a={key:e,participantIdentity:r,keyIndex:n};if(!this.options.sharedKey&&!r)throw new Error("participant identity needs to be passed for encryption key if sharedKey option is false");this.keyInfoMap.set("".concat(r??"shared","-").concat(n??0),a),this.emit(Gl.SetKey,a)}getKeys(){return Array.from(this.keyInfoMap.values())}getOptions(){return this.options}ratchetKey(e,r){this.emit(Gl.RatchetRequest,e,r)}}var IM;(function(t){t[t.InvalidKey=0]="InvalidKey",t[t.MissingKey=1]="MissingKey",t[t.InternalError=2]="InternalError"})(IM||(IM={}));class zue extends Zo.EventEmitter{constructor(e,r){super(),this.decryptDataRequests=new Map,this.encryptDataRequests=new Map,this.onWorkerMessage=n=>{var a,i;const{kind:o,data:c}=n.data;switch(o){case"error":if(or.error(c.error.message),c.uuid){const f=this.decryptDataRequests.get(c.uuid);if(f?.reject){f.reject(c.error);break}const h=this.encryptDataRequests.get(c.uuid);if(h?.reject){h.reject(c.error);break}}this.emit(jl.EncryptionError,c.error,c.participantIdentity);break;case"initAck":c.enabled&&this.keyProvider.getKeys().forEach(f=>{this.postKey(f)});break;case"enable":if(c.enabled&&this.keyProvider.getKeys().forEach(f=>{this.postKey(f)}),this.encryptionEnabled!==c.enabled&&c.participantIdentity===((a=this.room)===null||a===void 0?void 0:a.localParticipant.identity))this.emit(jl.ParticipantEncryptionStatusChanged,c.enabled,this.room.localParticipant),this.encryptionEnabled=c.enabled;else if(c.participantIdentity){const f=(i=this.room)===null||i===void 0?void 0:i.getParticipantByIdentity(c.participantIdentity);if(!f)throw TypeError("couldn't set encryption status, participant not found".concat(c.participantIdentity));this.emit(jl.ParticipantEncryptionStatusChanged,c.enabled,f)}break;case"ratchetKey":this.keyProvider.emit(Gl.KeyRatcheted,c.ratchetResult,c.participantIdentity,c.keyIndex);break;case"decryptDataResponse":const u=this.decryptDataRequests.get(c.uuid);u?.resolve&&u.resolve(c);break;case"encryptDataResponse":const d=this.encryptDataRequests.get(c.uuid);d?.resolve&&d.resolve(c);break}},this.onWorkerError=n=>{or.error("e2ee worker encountered an error:",{error:n.error}),this.emit(jl.EncryptionError,n.error,void 0)},this.keyProvider=e.keyProvider,this.worker=e.worker,this.encryptionEnabled=!1,this.dataChannelEncryptionEnabled=r}get isEnabled(){return this.encryptionEnabled}get isDataChannelEncryptionEnabled(){return this.isEnabled&&this.dataChannelEncryptionEnabled}setup(e){if(!Uue())throw new GP("tried to setup end-to-end encryption on an unsupported browser");if(or.info("setting up e2ee"),e!==this.room){this.room=e,this.setupEventListeners(e,this.keyProvider);const r={kind:"init",data:{keyProviderOptions:this.keyProvider.getOptions(),loglevel:Ile.getLevel()}};this.worker&&(or.info("initializing worker",{worker:this.worker}),this.worker.onmessage=this.onWorkerMessage,this.worker.onerror=this.onWorkerError,this.worker.postMessage(r))}}setParticipantCryptorEnabled(e,r){or.debug("set e2ee to ".concat(e," for participant ").concat(r)),this.postEnable(e,r)}setSifTrailer(e){!e||e.length===0?or.warn("ignoring server sent trailer as it's empty"):this.postSifTrailer(e)}setupEngine(e){e.on(ht.RTPVideoMapUpdate,r=>{this.postRTPMap(r)})}setupEventListeners(e,r){e.on(tt.TrackPublished,(n,a)=>this.setParticipantCryptorEnabled(n.trackInfo.encryption!==aa.NONE,a.identity)),e.on(tt.ConnectionStateChanged,n=>{n===Mr.Connected&&e.remoteParticipants.forEach(a=>{a.trackPublications.forEach(i=>{this.setParticipantCryptorEnabled(i.trackInfo.encryption!==aa.NONE,a.identity)})})}).on(tt.TrackUnsubscribed,(n,a,i)=>{var o;const c={kind:"removeTransform",data:{participantIdentity:i.identity,trackId:n.mediaStreamID}};(o=this.worker)===null||o===void 0||o.postMessage(c)}).on(tt.TrackSubscribed,(n,a,i)=>{this.setupE2EEReceiver(n,i.identity,a.trackInfo)}).on(tt.SignalConnected,()=>{if(!this.room)throw new TypeError("expected room to be present on signal connect");r.getKeys().forEach(n=>{this.postKey(n)}),this.setParticipantCryptorEnabled(this.room.localParticipant.isE2EEEnabled,this.room.localParticipant.identity)}),e.localParticipant.on(yt.LocalSenderCreated,(n,a)=>ne(this,void 0,void 0,function*(){this.setupE2EESender(a,n)})),e.localParticipant.on(yt.LocalTrackPublished,n=>{if(!hu(n.track)||!Gm())return;const a={kind:"updateCodec",data:{trackId:n.track.mediaStreamID,codec:mm(n.trackInfo.codecs[0].mimeType),participantIdentity:this.room.localParticipant.identity}};this.worker.postMessage(a)}),r.on(Gl.SetKey,n=>this.postKey(n)).on(Gl.RatchetRequest,(n,a)=>this.postRatchetRequest(n,a))}encryptData(e){return ne(this,void 0,void 0,function*(){if(!this.worker)throw Error("could not encrypt data, worker is missing");const r=crypto.randomUUID(),n={kind:"encryptDataRequest",data:{uuid:r,payload:e,participantIdentity:this.room.localParticipant.identity}},a=new ds;return a.onFinally=()=>{this.encryptDataRequests.delete(r)},this.encryptDataRequests.set(r,a),this.worker.postMessage(n),a.promise})}handleEncryptedData(e,r,n,a){if(!this.worker)throw Error("could not handle encrypted data, worker is missing");const i=crypto.randomUUID(),o={kind:"decryptDataRequest",data:{uuid:i,payload:e,iv:r,participantIdentity:n,keyIndex:a}},c=new ds;return c.onFinally=()=>{this.decryptDataRequests.delete(i)},this.decryptDataRequests.set(i,c),this.worker.postMessage(o),c.promise}postRatchetRequest(e,r){if(!this.worker)throw Error("could not ratchet key, worker is missing");const n={kind:"ratchetRequest",data:{participantIdentity:e,keyIndex:r}};this.worker.postMessage(n)}postKey(e){let{key:r,participantIdentity:n,keyIndex:a}=e;var i;if(!this.worker)throw Error("could not set key, worker is missing");const o={kind:"setKey",data:{participantIdentity:n,isPublisher:n===((i=this.room)===null||i===void 0?void 0:i.localParticipant.identity),key:r,keyIndex:a}};this.worker.postMessage(o)}postEnable(e,r){if(this.worker){const n={kind:"enable",data:{enabled:e,participantIdentity:r}};this.worker.postMessage(n)}else throw new ReferenceError("failed to enable e2ee, worker is not ready")}postRTPMap(e){var r;if(!this.worker)throw TypeError("could not post rtp map, worker is missing");if(!(!((r=this.room)===null||r===void 0)&&r.localParticipant.identity))throw TypeError("could not post rtp map, local participant identity is missing");const n={kind:"setRTPMap",data:{map:e,participantIdentity:this.room.localParticipant.identity}};this.worker.postMessage(n)}postSifTrailer(e){if(!this.worker)throw Error("could not post SIF trailer, worker is missing");const r={kind:"setSifTrailer",data:{trailer:e}};this.worker.postMessage(r)}setupE2EEReceiver(e,r,n){if(e.receiver){if(!n?.mimeType||n.mimeType==="")throw new TypeError("MimeType missing from trackInfo, cannot set up E2EE cryptor");this.handleReceiver(e.receiver,e.mediaStreamID,r,e.kind==="video"?mm(n.mimeType):void 0)}}setupE2EESender(e,r){if(!Hf(e)||!r){r||or.warn("early return because sender is not ready");return}this.handleSender(r,e.mediaStreamID,void 0)}handleReceiver(e,r,n,a){return ne(this,void 0,void 0,function*(){if(this.worker){if(wC()&&!TM()){const i={kind:"decode",participantIdentity:n,trackId:r,codec:a};e.transform=new RTCRtpScriptTransform(this.worker,i)}else{if(Oh in e&&a){const u={kind:"updateCodec",data:{trackId:r,codec:a,participantIdentity:n}};this.worker.postMessage(u);return}let i=e.writableStream,o=e.readableStream;if(!i||!o){const u=e.createEncodedStreams();e.writableStream=u.writable,i=u.writable,e.readableStream=u.readable,o=u.readable}const c={kind:"decode",data:{readableStream:o,writableStream:i,trackId:r,codec:a,participantIdentity:n,isReuse:Oh in e}};this.worker.postMessage(c,[o,i])}e[Oh]=!0}})}handleSender(e,r,n){var a;if(!(Oh in e||!this.worker)){if(!(!((a=this.room)===null||a===void 0)&&a.localParticipant.identity)||this.room.localParticipant.identity==="")throw TypeError("local identity needs to be known in order to set up encrypted sender");if(wC()&&!TM()){or.info("initialize script transform");const i={kind:"encode",participantIdentity:this.room.localParticipant.identity,trackId:r,codec:n};e.transform=new RTCRtpScriptTransform(this.worker,i)}else{or.info("initialize encoded streams");const i=e.createEncodedStreams(),o={kind:"encode",data:{readableStream:i.readable,writableStream:i.writable,codec:n,trackId:r,participantIdentity:this.room.localParticipant.identity,isReuse:!1}};this.worker.postMessage(o,[i.readable,i.writable])}e[Oh]=!0}}}const $ue=500,Vue=15e3;class Gf{constructor(){this.failedConnectionAttempts=new Map,this.backOffPromises=new Map}static getInstance(){return this._instance||(this._instance=new Gf),this._instance}addFailedConnectionAttempt(e){var r;const n=new URL(e),a=sE(n);if(!a)return;let i=(r=this.failedConnectionAttempts.get(a))!==null&&r!==void 0?r:0;this.failedConnectionAttempts.set(a,i+1),this.backOffPromises.set(a,Ca(Math.min($ue*Math.pow(2,i),Vue)))}getBackOffPromise(e){const r=new URL(e),n=r&&sE(r);return n&&this.backOffPromises.get(n)||Promise.resolve()}resetFailedConnectionAttempts(e){const r=new URL(e),n=r&&sE(r);n&&(this.failedConnectionAttempts.set(n,0),this.backOffPromises.set(n,Promise.resolve()))}resetAll(){this.backOffPromises.clear(),this.failedConnectionAttempts.clear()}}Gf._instance=null;const dE="default";class fa{constructor(){this._previousDevices=[]}static getInstance(){return this.instance===void 0&&(this.instance=new fa),this.instance}get previousDevices(){return this._previousDevices}getDevices(e){return ne(this,arguments,void 0,function(r){var n=this;let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return(function*(){var i;if(((i=fa.userMediaPromiseMap)===null||i===void 0?void 0:i.size)>0){or.debug("awaiting getUserMedia promise");try{r?yield fa.userMediaPromiseMap.get(r):yield Promise.all(fa.userMediaPromiseMap.values())}catch{or.warn("error waiting for media permissons")}}let o=yield navigator.mediaDevices.enumerateDevices();if(a&&!(hd()&&n.hasDeviceInUse(r))&&(o.filter(u=>u.kind===r).length===0||o.some(u=>{const d=u.label==="",f=r?u.kind===r:!0;return d&&f}))){const u={video:r!=="audioinput"&&r!=="audiooutput",audio:r!=="videoinput"&&{deviceId:{ideal:"default"}}},d=yield navigator.mediaDevices.getUserMedia(u);o=yield navigator.mediaDevices.enumerateDevices(),d.getTracks().forEach(f=>{f.stop()})}return n._previousDevices=o,r&&(o=o.filter(c=>c.kind===r)),o})()})}normalizeDeviceId(e,r,n){return ne(this,void 0,void 0,function*(){if(r!==dE)return r;const a=yield this.getDevices(e),i=a.find(c=>c.deviceId===dE);if(!i){or.warn("could not reliably determine default device");return}const o=a.find(c=>c.deviceId!==dE&&c.groupId===(n??i.groupId));if(!o){or.warn("could not reliably determine default device");return}return o?.deviceId})}hasDeviceInUse(e){return e?fa.userMediaPromiseMap.has(e):fa.userMediaPromiseMap.size>0}}fa.mediaDeviceKinds=["audioinput","audiooutput","videoinput"];fa.userMediaPromiseMap=new Map;var gm;(function(t){t[t.WAITING=0]="WAITING",t[t.RUNNING=1]="RUNNING",t[t.COMPLETED=2]="COMPLETED"})(gm||(gm={}));class Hue{constructor(){this.pendingTasks=new Map,this.taskMutex=new Wa,this.nextTaskIndex=0}run(e){return ne(this,void 0,void 0,function*(){const r={id:this.nextTaskIndex++,enqueuedAt:Date.now(),status:gm.WAITING};this.pendingTasks.set(r.id,r);const n=yield this.taskMutex.lock();try{return r.executedAt=Date.now(),r.status=gm.RUNNING,yield e()}finally{r.status=gm.COMPLETED,this.pendingTasks.delete(r.id),n()}})}flush(){return ne(this,void 0,void 0,function*(){return this.run(()=>ne(this,void 0,void 0,function*(){}))})}snapshot(){return Array.from(this.pendingTasks.values())}}class Gue{get readyState(){return this.ws.readyState}constructor(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var n,a;if(!((n=r.signal)===null||n===void 0)&&n.aborted)throw new DOMException("This operation was aborted","AbortError");this.url=e;const i=new WebSocket(e,(a=r.protocols)!==null&&a!==void 0?a:[]);i.binaryType="arraybuffer",this.ws=i;const o=function(){let{closeCode:c,reason:u}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return i.close(c,u)};this.opened=new li((c,u)=>{const d=()=>{u(Gt.websocket("Encountered websocket error during connection establishment"))};i.onopen=()=>{c({readable:new ReadableStream({start(f){i.onmessage=h=>{let{data:m}=h;return f.enqueue(m)},i.onerror=h=>f.error(h)},cancel:o}),writable:new WritableStream({write(f){i.send(f)},abort(){i.close()},close:o}),protocol:i.protocol,extensions:i.extensions}),i.removeEventListener("error",d)},i.addEventListener("error",d)}),this.closed=new li((c,u)=>{const d=()=>ne(this,void 0,void 0,function*(){const f=new li(m=>{i.readyState!==WebSocket.CLOSED&&i.addEventListener("close",_=>{m(_)},{once:!0})}),h=yield li.race([Ca(250),f]);h?c(h):u(Gt.websocket("Encountered unspecified websocket error without a timely close event"))});i.onclose=f=>{let{code:h,reason:m}=f;c({closeCode:h,reason:m}),i.removeEventListener("error",d)},i.addEventListener("error",d)}),r.signal&&(r.signal.onabort=()=>i.close()),this.close=o}}const Wue=["syncState","trickle","offer","answer","simulate","leave"];function Kue(t){const e=Wue.indexOf(t.case)>=0;return or.trace("request allowed to bypass queue:",{canPass:e,req:t}),e}var cn;(function(t){t[t.CONNECTING=0]="CONNECTING",t[t.CONNECTED=1]="CONNECTED",t[t.RECONNECTING=2]="RECONNECTING",t[t.DISCONNECTING=3]="DISCONNECTING",t[t.DISCONNECTED=4]="DISCONNECTED"})(cn||(cn={}));const Yue=250;class XP{get currentState(){return this.state}get isDisconnected(){return this.state===cn.DISCONNECTING||this.state===cn.DISCONNECTED}get isEstablishingConnection(){return this.state===cn.CONNECTING||this.state===cn.RECONNECTING}getNextRequestId(){return this._requestId+=1,this._requestId}constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var n;this.rtt=0,this.state=cn.DISCONNECTED,this.log=or,this._requestId=0,this.useV0SignalPath=!1,this.resetCallbacks=()=>{this.onAnswer=void 0,this.onLeave=void 0,this.onLocalTrackPublished=void 0,this.onLocalTrackUnpublished=void 0,this.onNegotiateRequested=void 0,this.onOffer=void 0,this.onRemoteMuteChanged=void 0,this.onSubscribedQualityUpdate=void 0,this.onTokenRefresh=void 0,this.onTrickle=void 0,this.onClose=void 0,this.onMediaSectionsRequirement=void 0},this.log=Vc((n=r.loggerName)!==null&&n!==void 0?n:eo.Signal),this.loggerContextCb=r.loggerContextCb,this.useJSON=e,this.requestQueue=new Hue,this.queuedRequests=[],this.closingLock=new Wa,this.connectionLock=new Wa,this.state=cn.DISCONNECTED}get logContext(){var e,r;return(r=(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this))!==null&&r!==void 0?r:{}}join(e,r,n,a){return ne(this,arguments,void 0,function(i,o,c,u){var d=this;let f=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;return(function*(){return d.state=cn.CONNECTING,d.options=c,yield d.connect(i,o,c,u,f)})()})}reconnect(e,r,n,a){return ne(this,void 0,void 0,function*(){if(!this.options){this.log.warn("attempted to reconnect without signal options being set, ignoring",this.logContext);return}return this.state=cn.RECONNECTING,this.clearPingInterval(),yield this.connect(e,r,Object.assign(Object.assign({},this.options),{reconnect:!0,sid:n,reconnectReason:a}),void 0,this.useV0SignalPath)})}connect(e,r,n,a){return ne(this,arguments,void 0,function(i,o,c,u){var d=this;let f=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;return(function*(){const h=yield d.connectionLock.lock();d.connectOptions=c,d.useV0SignalPath=f;const m=Sue(),_=f?Xue(o,m,c):Jue(o,m,c),w=Oue(i,_,f).toString(),b=Iue(w).toString();return new Promise((E,T)=>ne(d,void 0,void 0,function*(){var D,P;try{let A=!1;const C=N=>ne(this,void 0,void 0,function*(){if(A)return;A=!0;const L=N instanceof Event?N.currentTarget:N,j=Mue(L,"Abort handler called");this.streamWriter&&!this.isDisconnected?this.sendLeave().then(()=>this.close(j)).catch(q=>{this.log.error(q),this.close()}):this.close(),O(),T(Gt.cancelled(j))});u?.addEventListener("abort",C);const O=()=>{clearTimeout(I),u?.removeEventListener("abort",C)},I=setTimeout(()=>{C(Gt.timeout("room connection has timed out (signal)"))},c.websocketTimeout),x=(N,L)=>{this.handleSignalConnected(N,I,L)},R=new URL(w);R.searchParams.has("access_token")&&R.searchParams.set("access_token","<redacted>"),this.log.debug("connecting to ".concat(R),Object.assign({reconnect:c.reconnect,reconnectReason:c.reconnectReason},this.logContext)),this.ws&&(yield this.close(!1)),this.ws=new Gue(w);try{this.ws.closed.then(F=>{var Y;this.isEstablishingConnection&&T(Gt.internal("Websocket got closed during a (re)connection attempt: ".concat(F.reason))),F.closeCode!==1e3&&(this.log.warn("websocket closed",Object.assign(Object.assign({},this.logContext),{reason:F.reason,code:F.closeCode,wasClean:F.closeCode===1e3,state:this.state})),this.state===cn.CONNECTED&&this.handleOnClose((Y=F.reason)!==null&&Y!==void 0?Y:"Unexpected WS error"))}).catch(F=>{this.isEstablishingConnection&&T(Gt.internal("Websocket error during a (re)connection attempt: ".concat(F)))});const N=yield this.ws.opened.catch(F=>ne(this,void 0,void 0,function*(){if(this.state!==cn.CONNECTED){this.state=cn.DISCONNECTED,clearTimeout(I);const Y=yield this.handleConnectionError(F,b);T(Y);return}this.handleWSError(F),T(F)}));if(clearTimeout(I),!N)return;const L=N.readable.getReader();this.streamWriter=N.writable.getWriter();const j=yield L.read();if(L.releaseLock(),!j.value)throw Gt.internal("no message received as first message");const q=DM(j.value),U=this.validateFirstMessage(q,(D=c.reconnect)!==null&&D!==void 0?D:!1);if(!U.isValid){T(U.error);return}((P=q.message)===null||P===void 0?void 0:P.case)==="join"&&(this.pingTimeoutDuration=q.message.value.pingTimeout,this.pingIntervalDuration=q.message.value.pingInterval,this.pingTimeoutDuration&&this.pingTimeoutDuration>0&&this.log.debug("ping config",Object.assign(Object.assign({},this.logContext),{timeout:this.pingTimeoutDuration,interval:this.pingIntervalDuration})));const W=U.shouldProcessFirstMessage?q:void 0;x(N,W),E(U.response)}catch(N){T(N)}finally{O()}}finally{h()}}))})()})}startReadingLoop(e,r){return ne(this,void 0,void 0,function*(){for(r&&this.handleSignalResponse(r);;){this.signalLatency&&(yield Ca(this.signalLatency));const{done:n,value:a}=yield e.read();if(n)break;const i=DM(a);this.handleSignalResponse(i)}})}close(){return ne(this,arguments,void 0,function(){var e=this;let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Close method called on signal client";return(function*(){if([cn.DISCONNECTING||cn.DISCONNECTED].includes(e.state)){e.log.debug("ignoring signal close as it's already in disconnecting state");return}const a=yield e.closingLock.lock();try{if(e.clearPingInterval(),r&&(e.state=cn.DISCONNECTING),e.ws){e.ws.close({closeCode:1e3,reason:n});const i=e.ws.closed;e.ws=void 0,e.streamWriter=void 0,yield Promise.race([i,Ca(Yue)])}}catch(i){e.log.debug("websocket error while closing",Object.assign(Object.assign({},e.logContext),{error:i}))}finally{r&&(e.state=cn.DISCONNECTED),a()}})()})}sendOffer(e,r){this.log.debug("sending offer",Object.assign(Object.assign({},this.logContext),{offerSdp:e.sdp})),this.sendRequest({case:"offer",value:xf(e,r)})}sendAnswer(e,r){return this.log.debug("sending answer",Object.assign(Object.assign({},this.logContext),{answerSdp:e.sdp})),this.sendRequest({case:"answer",value:xf(e,r)})}sendIceCandidate(e,r){return this.log.debug("sending ice candidate",Object.assign(Object.assign({},this.logContext),{candidate:e})),this.sendRequest({case:"trickle",value:new u0({candidateInit:JSON.stringify(e),target:r})})}sendMuteTrack(e,r){return this.sendRequest({case:"mute",value:new d0({sid:e,muted:r})})}sendAddTrack(e){return this.sendRequest({case:"addTrack",value:e})}sendUpdateLocalMetadata(e,r){return ne(this,arguments,void 0,function(n,a){var i=this;let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return(function*(){const c=i.getNextRequestId();return yield i.sendRequest({case:"updateMetadata",value:new zP({requestId:c,metadata:n,name:a,attributes:o})}),c})()})}sendUpdateTrackSettings(e){this.sendRequest({case:"trackSetting",value:e})}sendUpdateSubscription(e){return this.sendRequest({case:"subscription",value:e})}sendSyncState(e){return this.sendRequest({case:"syncState",value:e})}sendUpdateVideoLayers(e,r){return this.sendRequest({case:"updateLayers",value:new iq({trackSid:e,layers:r})})}sendUpdateSubscriptionPermissions(e,r){return this.sendRequest({case:"subscriptionPermission",value:new cq({allParticipants:e,trackPermissions:r})})}sendSimulateScenario(e){return this.sendRequest({case:"simulate",value:e})}sendPing(){return Promise.all([this.sendRequest({case:"ping",value:kn.parse(Date.now())}),this.sendRequest({case:"pingReq",value:new dq({timestamp:kn.parse(Date.now()),rtt:kn.parse(this.rtt)})})])}sendUpdateLocalAudioTrack(e,r){return this.sendRequest({case:"updateAudioTrack",value:new qP({trackSid:e,features:r})})}sendLeave(){return this.sendRequest({case:"leave",value:new p0({reason:Ws.CLIENT_INITIATED,action:qf.DISCONNECT})})}sendRequest(e){return ne(this,arguments,void 0,function(r){var n=this;let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return(function*(){if(!a&&!Kue(r)&&n.state===cn.RECONNECTING){n.queuedRequests.push(()=>ne(n,void 0,void 0,function*(){yield this.sendRequest(r,!0)}));return}if(a||(yield n.requestQueue.flush()),n.signalLatency&&(yield Ca(n.signalLatency)),n.isDisconnected){n.log.debug("skipping signal request (type: ".concat(r.case,") - SignalClient disconnected"));return}if(!n.streamWriter){n.log.error("cannot send signal request before connected, type: ".concat(r?.case),n.logContext);return}const o=new ile({message:r});try{n.useJSON?yield n.streamWriter.write(o.toJsonString()):yield n.streamWriter.write(o.toBinary())}catch(c){n.log.error("error sending signal message",Object.assign(Object.assign({},n.logContext),{error:c}))}})()})}handleSignalResponse(e){var r,n;const a=e.message;if(a==null){this.log.debug("received unsupported message",this.logContext);return}let i=!1;if(a.case==="answer"){const o=MM(a.value);this.onAnswer&&this.onAnswer(o,a.value.id,a.value.midToTrackId)}else if(a.case==="offer"){const o=MM(a.value);this.onOffer&&this.onOffer(o,a.value.id,a.value.midToTrackId)}else if(a.case==="trickle"){const o=JSON.parse(a.value.candidateInit);this.onTrickle&&this.onTrickle(o,a.value.target)}else a.case==="update"?this.onParticipantUpdate&&this.onParticipantUpdate((r=a.value.participants)!==null&&r!==void 0?r:[]):a.case==="trackPublished"?this.onLocalTrackPublished&&this.onLocalTrackPublished(a.value):a.case==="speakersChanged"?this.onSpeakersChanged&&this.onSpeakersChanged((n=a.value.speakers)!==null&&n!==void 0?n:[]):a.case==="leave"?this.onLeave&&this.onLeave(a.value):a.case==="mute"?this.onRemoteMuteChanged&&this.onRemoteMuteChanged(a.value.sid,a.value.muted):a.case==="roomUpdate"?this.onRoomUpdate&&a.value.room&&this.onRoomUpdate(a.value.room):a.case==="connectionQuality"?this.onConnectionQuality&&this.onConnectionQuality(a.value):a.case==="streamStateUpdate"?this.onStreamStateUpdate&&this.onStreamStateUpdate(a.value):a.case==="subscribedQualityUpdate"?this.onSubscribedQualityUpdate&&this.onSubscribedQualityUpdate(a.value):a.case==="subscriptionPermissionUpdate"?this.onSubscriptionPermissionUpdate&&this.onSubscriptionPermissionUpdate(a.value):a.case==="refreshToken"?this.onTokenRefresh&&this.onTokenRefresh(a.value):a.case==="trackUnpublished"?this.onLocalTrackUnpublished&&this.onLocalTrackUnpublished(a.value):a.case==="subscriptionResponse"?this.onSubscriptionError&&this.onSubscriptionError(a.value):a.case==="pong"||(a.case==="pongResp"?(this.rtt=Date.now()-Number.parseInt(a.value.lastPingTimestamp.toString()),this.resetPingTimeout(),i=!0):a.case==="requestResponse"?this.onRequestResponse&&this.onRequestResponse(a.value):a.case==="trackSubscribed"?this.onLocalTrackSubscribed&&this.onLocalTrackSubscribed(a.value.trackSid):a.case==="roomMoved"?(this.onTokenRefresh&&this.onTokenRefresh(a.value.token),this.onRoomMoved&&this.onRoomMoved(a.value)):a.case==="mediaSectionsRequirement"?this.onMediaSectionsRequirement&&this.onMediaSectionsRequirement(a.value):this.log.debug("unsupported message",Object.assign(Object.assign({},this.logContext),{msgCase:a.case})));i||this.resetPingTimeout()}setReconnected(){for(;this.queuedRequests.length>0;){const e=this.queuedRequests.shift();e&&this.requestQueue.run(e)}}handleOnClose(e){return ne(this,void 0,void 0,function*(){if(this.state===cn.DISCONNECTED)return;const r=this.onClose;yield this.close(void 0,e),this.log.debug("websocket connection closed: ".concat(e),Object.assign(Object.assign({},this.logContext),{reason:e})),r&&r(e)})}handleWSError(e){this.log.error("websocket error",Object.assign(Object.assign({},this.logContext),{error:e}))}resetPingTimeout(){if(this.clearPingTimeout(),!this.pingTimeoutDuration){this.log.warn("ping timeout duration not set",this.logContext);return}this.pingTimeout=Ta.setTimeout(()=>{this.log.warn("ping timeout triggered. last pong received at: ".concat(new Date(Date.now()-this.pingTimeoutDuration*1e3).toUTCString()),this.logContext),this.handleOnClose("ping timeout")},this.pingTimeoutDuration*1e3)}clearPingTimeout(){this.pingTimeout&&Ta.clearTimeout(this.pingTimeout)}startPingInterval(){if(this.clearPingInterval(),this.resetPingTimeout(),!this.pingIntervalDuration){this.log.warn("ping interval duration not set",this.logContext);return}this.log.debug("start ping interval",this.logContext),this.pingInterval=Ta.setInterval(()=>{this.sendPing()},this.pingIntervalDuration*1e3)}clearPingInterval(){this.log.debug("clearing ping interval",this.logContext),this.clearPingTimeout(),this.pingInterval&&Ta.clearInterval(this.pingInterval)}handleSignalConnected(e,r,n){this.state=cn.CONNECTED,clearTimeout(r),this.startPingInterval(),this.startReadingLoop(e.readable.getReader(),n)}validateFirstMessage(e,r){var n,a,i,o,c;return((n=e.message)===null||n===void 0?void 0:n.case)==="join"?{isValid:!0,response:e.message.value}:this.state===cn.RECONNECTING&&((a=e.message)===null||a===void 0?void 0:a.case)!=="leave"?((i=e.message)===null||i===void 0?void 0:i.case)==="reconnect"?{isValid:!0,response:e.message.value}:(this.log.debug("declaring signal reconnected without reconnect response received",this.logContext),{isValid:!0,response:void 0,shouldProcessFirstMessage:!0}):this.isEstablishingConnection&&((o=e.message)===null||o===void 0?void 0:o.case)==="leave"?{isValid:!1,error:Gt.leaveRequest("Received leave request while trying to (re)connect",e.message.value.reason)}:r?{isValid:!1,error:Gt.internal("Unexpected first message")}:{isValid:!1,error:Gt.internal("did not receive join response, got ".concat((c=e.message)===null||c===void 0?void 0:c.case," instead"))}}handleConnectionError(e,r){return ne(this,void 0,void 0,function*(){try{const n=yield fetch(r);switch(n.status){case 404:return Gt.serviceNotFound("v1 RTC path not found. Consider upgrading your LiveKit server version","v0-rtc");case 401:case 403:const a=yield n.text();return Gt.notAllowed(a,n.status);default:break}return e instanceof Gt?e:Gt.internal("Encountered unknown websocket error during connection: ".concat(e),{status:n.status,statusText:n.statusText})}catch(n){return n instanceof Gt?n:Gt.serverUnreachable(n instanceof Error?n.message:"server was not reachable")}})}}function MM(t){const e={type:"offer",sdp:t.sdp};switch(t.type){case"answer":case"offer":case"pranswer":case"rollback":e.type=t.type;break}return e}function xf(t,e){return new nu({sdp:t.sdp,type:t.type,id:e})}function Xue(t,e,r){var n;const a=new URLSearchParams;return a.set("access_token",t),r.reconnect&&(a.set("reconnect","1"),r.sid&&a.set("sid",r.sid)),a.set("auto_subscribe",r.autoSubscribe?"1":"0"),a.set("sdk",Yo()?"reactnative":"js"),a.set("version",e.version),a.set("protocol",e.protocol.toString()),e.deviceModel&&a.set("device_model",e.deviceModel),e.os&&a.set("os",e.os),e.osVersion&&a.set("os_version",e.osVersion),e.browser&&a.set("browser",e.browser),e.browserVersion&&a.set("browser_version",e.browserVersion),r.adaptiveStream&&a.set("adaptive_stream","1"),r.reconnectReason&&a.set("reconnect_reason",r.reconnectReason.toString()),!((n=navigator.connection)===null||n===void 0)&&n.type&&a.set("network",navigator.connection.type),a}function Jue(t,e,r){const n=new URLSearchParams;n.set("access_token",t);const a=new xle({clientInfo:e,connectionSettings:new fq({autoSubscribe:!!r.autoSubscribe,adaptiveStream:!!r.adaptiveStream}),reconnect:!!r.reconnect,participantSid:r.sid?r.sid:void 0});r.reconnectReason&&(a.reconnectReason=r.reconnectReason);const i=new Ple({joinRequest:a.toBinary()});return n.set("join_request",btoa(new TextDecoder("utf-8").decode(i.toBinary()))),n}class jM{constructor(){this.buffer=[],this._totalSize=0}push(e){this.buffer.push(e),this._totalSize+=e.data.byteLength}pop(){const e=this.buffer.shift();return e&&(this._totalSize-=e.data.byteLength),e}getAll(){return this.buffer.slice()}popToSequence(e){for(;this.buffer.length>0&&this.buffer[0].sequence<=e;)this.pop()}alignBufferedAmount(e){for(;this.buffer.length>0;){const r=this.buffer[0];if(this._totalSize-r.data.byteLength<=e)break;this.pop()}}get length(){return this.buffer.length}}class Que{constructor(e){this._map=new Map,this._lastCleanup=0,this.ttl=e}set(e,r){const n=Date.now();n-this._lastCleanup>this.ttl/2&&this.cleanup();const a=n+this.ttl;return this._map.set(e,{value:r,expiresAt:a}),this}get(e){const r=this._map.get(e);if(r){if(r.expiresAt<Date.now()){this._map.delete(e);return}return r.value}}has(e){const r=this._map.get(e);return r?r.expiresAt<Date.now()?(this._map.delete(e),!1):!0:!1}delete(e){return this._map.delete(e)}clear(){this._map.clear()}cleanup(){const e=Date.now();for(const[r,n]of this._map.entries())n.expiresAt<e&&this._map.delete(r);this._lastCleanup=e}get size(){return this.cleanup(),this._map.size}forEach(e){this.cleanup();for(const[r,n]of this._map.entries())n.expiresAt>=Date.now()&&e(n.value,r,this.asValueMap())}map(e){this.cleanup();const r=[],n=this.asValueMap();for(const[a,i]of n.entries())r.push(e(i,a,n));return r}asValueMap(){const e=new Map;for(const[r,n]of this._map.entries())n.expiresAt>=Date.now()&&e.set(r,n.value);return e}}var js={},fE={},pE={exports:{}},LM;function JP(){if(LM)return pE.exports;LM=1;var t=pE.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return e.address!=null?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return e.subtype!=null?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return e.sessionConfig!=null?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var r="candidate:%s %d %s %d %s %d typ %s";return r+=e.raddr!=null?" raddr %s rport %d":"%v%v",r+=e.tcptype!=null?" tcptype %s":"%v",e.generation!=null&&(r+=" generation %d"),r+=e["network-id"]!=null?" network-id %d":"%v",r+=e["network-cost"]!=null?" network-cost %d":"%v",r}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var r="ssrc:%d";return e.attribute!=null&&(r+=" %s",e.value!=null&&(r+=":%s")),r}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return e.maxMessageSize!=null?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(e.clksrcExt!=null?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var r="mediaclk:";return r+=e.id!=null?"id=%s %s":"%v%s",r+=e.mediaClockValue!=null?"=%s":"",r+=e.rateNumerator!=null?" rate=%s":"",r+=e.rateDenominator!=null?"/%s":"",r}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};return Object.keys(t).forEach(function(e){var r=t[e];r.forEach(function(n){n.reg||(n.reg=/(.*)/),n.format||(n.format="%s")})}),pE.exports}var BM;function Zue(){return BM||(BM=1,(function(t){var e=function(c){return String(Number(c))===c?Number(c):c},r=function(c,u,d,f){if(f&&!d)u[f]=e(c[1]);else for(var h=0;h<d.length;h+=1)c[h+1]!=null&&(u[d[h]]=e(c[h+1]))},n=function(c,u,d){var f=c.name&&c.names;c.push&&!u[c.push]?u[c.push]=[]:f&&!u[c.name]&&(u[c.name]={});var h=c.push?{}:f?u[c.name]:u;r(d.match(c.reg),h,c.names,c.name),c.push&&u[c.push].push(h)},a=JP(),i=RegExp.prototype.test.bind(/^([a-z])=(.*)/);t.parse=function(c){var u={},d=[],f=u;return c.split(/(\r\n|\r|\n)/).filter(i).forEach(function(h){var m=h[0],_=h.slice(2);m==="m"&&(d.push({rtp:[],fmtp:[]}),f=d[d.length-1]);for(var w=0;w<(a[m]||[]).length;w+=1){var b=a[m][w];if(b.reg.test(_))return n(b,f,_)}}),u.media=d,u};var o=function(c,u){var d=u.split(/=(.+)/,2);return d.length===2?c[d[0]]=e(d[1]):d.length===1&&u.length>1&&(c[d[0]]=void 0),c};t.parseParams=function(c){return c.split(/;\s?/).reduce(o,{})},t.parseFmtpConfig=t.parseParams,t.parsePayloads=function(c){return c.toString().split(" ").map(Number)},t.parseRemoteCandidates=function(c){for(var u=[],d=c.split(" ").map(e),f=0;f<d.length;f+=3)u.push({component:d[f],ip:d[f+1],port:d[f+2]});return u},t.parseImageAttributes=function(c){return c.split(" ").map(function(u){return u.substring(1,u.length-1).split(",").reduce(o,{})})},t.parseSimulcastStreamList=function(c){return c.split(";").map(function(u){return u.split(",").map(function(d){var f,h=!1;return d[0]!=="~"?f=e(d):(f=e(d.substring(1,d.length)),h=!0),{scid:f,paused:h}})})}})(fE)),fE}var hE,UM;function ede(){if(UM)return hE;UM=1;var t=JP(),e=/%[sdv%]/g,r=function(o){var c=1,u=arguments,d=u.length;return o.replace(e,function(f){if(c>=d)return f;var h=u[c];switch(c+=1,f){case"%%":return"%";case"%s":return String(h);case"%d":return Number(h);case"%v":return""}})},n=function(o,c,u){var d=c.format instanceof Function?c.format(c.push?u:u[c.name]):c.format,f=[o+"="+d];if(c.names)for(var h=0;h<c.names.length;h+=1){var m=c.names[h];c.name?f.push(u[c.name][m]):f.push(u[c.names[h]])}else f.push(u[c.name]);return r.apply(null,f)},a=["v","o","s","i","u","e","p","c","b","t","r","z","a"],i=["i","c","b","a"];return hE=function(o,c){c=c||{},o.version==null&&(o.version=0),o.name==null&&(o.name=" "),o.media.forEach(function(h){h.payloads==null&&(h.payloads="")});var u=c.outerOrder||a,d=c.innerOrder||i,f=[];return u.forEach(function(h){t[h].forEach(function(m){m.name in o&&o[m.name]!=null?f.push(n(h,m,o)):m.push in o&&o[m.push]!=null&&o[m.push].forEach(function(_){f.push(n(h,m,_))})})}),o.media.forEach(function(h){f.push(n("m",t.m[0],h)),d.forEach(function(m){t[m].forEach(function(_){_.name in h&&h[_.name]!=null?f.push(n(m,_,h)):_.push in h&&h[_.push]!=null&&h[_.push].forEach(function(w){f.push(n(m,_,w))})})})}),f.join(`\r
`)+`\r
`},hE}var FM;function tde(){if(FM)return js;FM=1;var t=Zue(),e=ede(),r=JP();return js.grammar=r,js.write=e,js.parse=t.parse,js.parseParams=t.parseParams,js.parseFmtpConfig=t.parseFmtpConfig,js.parsePayloads=t.parsePayloads,js.parseRemoteCandidates=t.parseRemoteCandidates,js.parseImageAttributes=t.parseImageAttributes,js.parseSimulcastStreamList=t.parseSimulcastStreamList,js}var Cl=tde();function QP(t,e,r){var n,a,i;e===void 0&&(e=50),r===void 0&&(r={});var o=(n=r.isImmediate)!=null&&n,c=(a=r.callback)!=null&&a,u=r.maxWait,d=Date.now(),f=[];function h(){if(u!==void 0){var _=Date.now()-d;if(_+e>=u)return u-_}return e}var m=function(){var _=[].slice.call(arguments),w=this;return new Promise(function(b,E){var T=o&&i===void 0;if(i!==void 0&&clearTimeout(i),i=setTimeout(function(){if(i=void 0,d=Date.now(),!o){var P=t.apply(w,_);c&&c(P),f.forEach(function(A){return(0,A.resolve)(P)}),f=[]}},h()),T){var D=t.apply(w,_);return c&&c(D),b(D)}f.push({resolve:b,reject:E})})};return m.cancel=function(_){i!==void 0&&clearTimeout(i),f.forEach(function(w){return(0,w.reject)(_)}),f=[]},m}const rde=.7,nde=20,Wf={NegotiationStarted:"negotiationStarted",NegotiationComplete:"negotiationComplete",RTPVideoPayloadTypes:"rtpVideoPayloadTypes"};class qM extends Zo.EventEmitter{get pc(){return this._pc||(this._pc=this.createPC()),this._pc}constructor(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var n;super(),this.log=or,this.ddExtID=0,this.latestOfferId=0,this.pendingCandidates=[],this.restartingIce=!1,this.renegotiate=!1,this.trackBitrates=[],this.remoteStereoMids=[],this.remoteNackMids=[],this.negotiate=QP(a=>ne(this,void 0,void 0,function*(){this.emit(Wf.NegotiationStarted);try{yield this.createAndSendOffer()}catch(i){if(a)a(i);else throw i}}),nde),this.close=()=>{this._pc&&(this._pc.close(),this._pc.onconnectionstatechange=null,this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.ondatachannel=null,this._pc.onnegotiationneeded=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ondatachannel=null,this._pc.ontrack=null,this._pc.onconnectionstatechange=null,this._pc.oniceconnectionstatechange=null,this._pc=null)},this.log=Vc((n=r.loggerName)!==null&&n!==void 0?n:eo.PCTransport),this.loggerOptions=r,this.config=e,this._pc=this.createPC(),this.offerLock=new Wa}createPC(){const e=new RTCPeerConnection(this.config);return e.onicecandidate=r=>{var n;r.candidate&&((n=this.onIceCandidate)===null||n===void 0||n.call(this,r.candidate))},e.onicecandidateerror=r=>{var n;(n=this.onIceCandidateError)===null||n===void 0||n.call(this,r)},e.oniceconnectionstatechange=()=>{var r;(r=this.onIceConnectionStateChange)===null||r===void 0||r.call(this,e.iceConnectionState)},e.onsignalingstatechange=()=>{var r;(r=this.onSignalingStatechange)===null||r===void 0||r.call(this,e.signalingState)},e.onconnectionstatechange=()=>{var r;(r=this.onConnectionStateChange)===null||r===void 0||r.call(this,e.connectionState)},e.ondatachannel=r=>{var n;(n=this.onDataChannel)===null||n===void 0||n.call(this,r)},e.ontrack=r=>{var n;(n=this.onTrack)===null||n===void 0||n.call(this,r)},e}get logContext(){var e,r;return Object.assign({},(r=(e=this.loggerOptions).loggerContextCb)===null||r===void 0?void 0:r.call(e))}get isICEConnected(){return this._pc!==null&&(this.pc.iceConnectionState==="connected"||this.pc.iceConnectionState==="completed")}addIceCandidate(e){return ne(this,void 0,void 0,function*(){if(this.pc.remoteDescription&&!this.restartingIce)return this.pc.addIceCandidate(e);this.pendingCandidates.push(e)})}setRemoteDescription(e,r){return ne(this,void 0,void 0,function*(){var n;if(e.type==="answer"&&this.latestOfferId>0&&r>0&&r!==this.latestOfferId)return this.log.warn("ignoring answer for old offer",Object.assign(Object.assign({},this.logContext),{offerId:r,latestOfferId:this.latestOfferId})),!1;let a;if(e.type==="offer"){let{stereoMids:i,nackMids:o}=ade(e);this.remoteStereoMids=i,this.remoteNackMids=o}else if(e.type==="answer"){const i=Cl.parse((n=e.sdp)!==null&&n!==void 0?n:"");i.media.forEach(o=>{const c=ZP(o.mid);o.type==="audio"&&this.trackBitrates.some(u=>{if(!u.transceiver||c!=u.transceiver.mid)return!1;let d=0;if(o.rtp.some(h=>h.codec.toUpperCase()===u.codec.toUpperCase()?(d=h.payload,!0):!1),d===0)return!0;let f=!1;for(const h of o.fmtp)if(h.payload===d){h.config=h.config.split(";").filter(m=>!m.includes("maxaveragebitrate")).join(";"),u.maxbr>0&&(h.config+=";maxaveragebitrate=".concat(u.maxbr*1e3)),f=!0;break}return f||u.maxbr>0&&o.fmtp.push({payload:d,config:"maxaveragebitrate=".concat(u.maxbr*1e3)}),!0})}),a=Cl.write(i)}return yield this.setMungedSDP(e,a,!0),this.pendingCandidates.forEach(i=>{this.pc.addIceCandidate(i)}),this.pendingCandidates=[],this.restartingIce=!1,this.renegotiate?(this.renegotiate=!1,yield this.createAndSendOffer()):e.type==="answer"&&(this.emit(Wf.NegotiationComplete),e.sdp&&Cl.parse(e.sdp).media.forEach(o=>{o.type==="video"&&this.emit(Wf.RTPVideoPayloadTypes,o.rtp)})),!0})}createAndSendOffer(e){return ne(this,void 0,void 0,function*(){var r;const n=yield this.offerLock.lock();try{if(this.onOffer===void 0)return;if(e?.iceRestart&&(this.log.debug("restarting ICE",this.logContext),this.restartingIce=!0),this._pc&&this._pc.signalingState==="have-local-offer"){const c=this._pc.remoteDescription;if(e?.iceRestart&&c)yield this._pc.setRemoteDescription(c);else{this.renegotiate=!0;return}}else if(!this._pc||this._pc.signalingState==="closed"){this.log.warn("could not createOffer with closed peer connection",this.logContext);return}this.log.debug("starting to negotiate",this.logContext);const a=this.latestOfferId+1;this.latestOfferId=a;const i=yield this.pc.createOffer(e);this.log.debug("original offer",Object.assign({sdp:i.sdp},this.logContext));const o=Cl.parse((r=i.sdp)!==null&&r!==void 0?r:"");if(o.media.forEach(c=>{$M(c),c.type==="audio"?zM(c,["all"],[]):c.type==="video"&&this.trackBitrates.some(u=>{if(!c.msid||!u.cid||!c.msid.includes(u.cid))return!1;let d=0;if(c.rtp.some(h=>h.codec.toUpperCase()===u.codec.toUpperCase()?(d=h.payload,!0):!1),d===0||(Vs(u.codec)&&!hd()&&this.ensureVideoDDExtensionForSVC(c,o),!Vs(u.codec)))return!0;const f=Math.round(u.maxbr*rde);for(const h of c.fmtp)if(h.payload===d){h.config.includes("x-google-start-bitrate")||(h.config+=";x-google-start-bitrate=".concat(f));break}return!0})}),this.latestOfferId>a){this.log.warn("latestOfferId mismatch",Object.assign(Object.assign({},this.logContext),{latestOfferId:this.latestOfferId,offerId:a}));return}yield this.setMungedSDP(i,Cl.write(o)),this.onOffer(i,this.latestOfferId)}finally{n()}})}createAndSetAnswer(){return ne(this,void 0,void 0,function*(){var e;const r=yield this.pc.createAnswer(),n=Cl.parse((e=r.sdp)!==null&&e!==void 0?e:"");return n.media.forEach(a=>{$M(a),a.type==="audio"&&zM(a,this.remoteStereoMids,this.remoteNackMids)}),yield this.setMungedSDP(r,Cl.write(n)),r})}createDataChannel(e,r){return this.pc.createDataChannel(e,r)}addTransceiver(e,r){return this.pc.addTransceiver(e,r)}addTransceiverOfKind(e,r){return this.pc.addTransceiver(e,r)}addTrack(e){if(!this._pc)throw new Ln("PC closed, cannot add track");return this._pc.addTrack(e)}setTrackCodecBitrate(e){this.trackBitrates.push(e)}setConfiguration(e){var r;if(!this._pc)throw new Ln("PC closed, cannot configure");return(r=this._pc)===null||r===void 0?void 0:r.setConfiguration(e)}canRemoveTrack(){var e;return!!(!((e=this._pc)===null||e===void 0)&&e.removeTrack)}removeTrack(e){var r;return(r=this._pc)===null||r===void 0?void 0:r.removeTrack(e)}getConnectionState(){var e,r;return(r=(e=this._pc)===null||e===void 0?void 0:e.connectionState)!==null&&r!==void 0?r:"closed"}getICEConnectionState(){var e,r;return(r=(e=this._pc)===null||e===void 0?void 0:e.iceConnectionState)!==null&&r!==void 0?r:"closed"}getSignallingState(){var e,r;return(r=(e=this._pc)===null||e===void 0?void 0:e.signalingState)!==null&&r!==void 0?r:"closed"}getTransceivers(){var e,r;return(r=(e=this._pc)===null||e===void 0?void 0:e.getTransceivers())!==null&&r!==void 0?r:[]}getSenders(){var e,r;return(r=(e=this._pc)===null||e===void 0?void 0:e.getSenders())!==null&&r!==void 0?r:[]}getLocalDescription(){var e;return(e=this._pc)===null||e===void 0?void 0:e.localDescription}getRemoteDescription(){var e;return(e=this.pc)===null||e===void 0?void 0:e.remoteDescription}getStats(){return this.pc.getStats()}getConnectedAddress(){return ne(this,void 0,void 0,function*(){var e;if(!this._pc)return;let r="";const n=new Map,a=new Map;if((yield this._pc.getStats()).forEach(c=>{switch(c.type){case"transport":r=c.selectedCandidatePairId;break;case"candidate-pair":r===""&&c.selected&&(r=c.id),n.set(c.id,c);break;case"remote-candidate":a.set(c.id,"".concat(c.address,":").concat(c.port));break}}),r==="")return;const o=(e=n.get(r))===null||e===void 0?void 0:e.remoteCandidateId;if(o!==void 0)return a.get(o)})}setMungedSDP(e,r,n){return ne(this,void 0,void 0,function*(){if(r){const a=e.sdp;e.sdp=r;try{this.log.debug("setting munged ".concat(n?"remote":"local"," description"),this.logContext),n?yield this.pc.setRemoteDescription(e):yield this.pc.setLocalDescription(e);return}catch(i){this.log.warn("not able to set ".concat(e.type,", falling back to unmodified sdp"),Object.assign(Object.assign({},this.logContext),{error:i,sdp:r})),e.sdp=a}}try{n?yield this.pc.setRemoteDescription(e):yield this.pc.setLocalDescription(e)}catch(a){let i="unknown error";a instanceof Error?i=a.message:typeof a=="string"&&(i=a);const o={error:i,sdp:e.sdp};throw!n&&this.pc.remoteDescription&&(o.remoteSdp=this.pc.remoteDescription),this.log.error("unable to set ".concat(e.type),Object.assign(Object.assign({},this.logContext),{fields:o})),new $f(i)}})}ensureVideoDDExtensionForSVC(e,r){var n,a;if(!((n=e.ext)===null||n===void 0?void 0:n.some(o=>o.uri===EM))){if(this.ddExtID===0){let o=0;r.media.forEach(c=>{var u;c.type==="video"&&((u=c.ext)===null||u===void 0||u.forEach(d=>{d.value>o&&(o=d.value)}))}),this.ddExtID=o+1}(a=e.ext)===null||a===void 0||a.push({value:this.ddExtID,uri:EM})}}}function zM(t,e,r){const n=ZP(t.mid);let a=0;t.rtp.some(i=>i.codec==="opus"?(a=i.payload,!0):!1),a>0&&(t.rtcpFb||(t.rtcpFb=[]),r.includes(n)&&!t.rtcpFb.some(i=>i.payload===a&&i.type==="nack")&&t.rtcpFb.push({payload:a,type:"nack"}),(e.includes(n)||e.length===1&&e[0]==="all")&&t.fmtp.some(i=>i.payload===a?(i.config.includes("stereo=1")||(i.config+=";stereo=1"),!0):!1))}function ade(t){var e;const r=[],n=[],a=Cl.parse((e=t.sdp)!==null&&e!==void 0?e:"");let i=0;return a.media.forEach(o=>{var c;const u=ZP(o.mid);o.type==="audio"&&(o.rtp.some(d=>d.codec==="opus"?(i=d.payload,!0):!1),!((c=o.rtcpFb)===null||c===void 0)&&c.some(d=>d.payload===i&&d.type==="nack")&&n.push(u),o.fmtp.some(d=>d.payload===i?(d.config.includes("sprop-stereo=1")&&r.push(u),!0):!1))}),{stereoMids:r,nackMids:n}}function $M(t){if(t.connection){const e=t.connection.ip.indexOf(":")>=0;(t.connection.version===4&&e||t.connection.version===6&&!e)&&(t.connection.ip="0.0.0.0",t.connection.version=4)}}function ZP(t){return typeof t=="number"?t.toFixed(0):t}const SC="vp8",ide={audioPreset:hC.music,dtx:!0,red:!0,forceStereo:!1,simulcast:!0,screenShareEncoding:WP.h1080fps15.encoding,stopMicTrackOnMute:!1,videoCodec:SC,backupCodec:!0,preConnectBuffer:!1},Qq={deviceId:{ideal:"default"},autoGainControl:!0,echoCancellation:!0,noiseSuppression:!0,voiceIsolation:!0},Zq={deviceId:{ideal:"default"},resolution:up.h720.resolution},sde={adaptiveStream:!1,dynacast:!1,stopLocalTrackOnUnpublish:!0,reconnectPolicy:new jle,disconnectOnPageLeave:!0,webAudioMix:!1,singlePeerConnection:!0},eA={autoSubscribe:!0,maxRetries:1,peerConnectionTimeout:15e3,websocketTimeout:15e3};var Pn;(function(t){t[t.NEW=0]="NEW",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED",t[t.FAILED=3]="FAILED",t[t.CLOSING=4]="CLOSING",t[t.CLOSED=5]="CLOSED"})(Pn||(Pn={}));class ode{get needsPublisher(){return this.isPublisherConnectionRequired}get needsSubscriber(){return this.isSubscriberConnectionRequired}get currentState(){return this.state}get mode(){return this._mode}constructor(e,r,n){var a;this.peerConnectionTimeout=eA.peerConnectionTimeout,this.log=or,this.updateState=()=>{var i,o;const c=this.state,u=this.requiredTransports.map(d=>d.getConnectionState());u.every(d=>d==="connected")?this.state=Pn.CONNECTED:u.some(d=>d==="failed")?this.state=Pn.FAILED:u.some(d=>d==="connecting")?this.state=Pn.CONNECTING:u.every(d=>d==="closed")?this.state=Pn.CLOSED:u.some(d=>d==="closed")?this.state=Pn.CLOSING:u.every(d=>d==="new")&&(this.state=Pn.NEW),c!==this.state&&(this.log.debug("pc state change: from ".concat(Pn[c]," to ").concat(Pn[this.state]),this.logContext),(i=this.onStateChange)===null||i===void 0||i.call(this,this.state,this.publisher.getConnectionState(),(o=this.subscriber)===null||o===void 0?void 0:o.getConnectionState()))},this.log=Vc((a=n.loggerName)!==null&&a!==void 0?a:eo.PCManager),this.loggerOptions=n,this.isPublisherConnectionRequired=r!=="subscriber-primary",this.isSubscriberConnectionRequired=r==="subscriber-primary",this.publisher=new qM(e,n),this._mode=r,r!=="publisher-only"&&(this.subscriber=new qM(e,n),this.subscriber.onConnectionStateChange=this.updateState,this.subscriber.onIceConnectionStateChange=this.updateState,this.subscriber.onSignalingStatechange=this.updateState,this.subscriber.onIceCandidate=i=>{var o;(o=this.onIceCandidate)===null||o===void 0||o.call(this,i,$s.SUBSCRIBER)},this.subscriber.onDataChannel=i=>{var o;(o=this.onDataChannel)===null||o===void 0||o.call(this,i)},this.subscriber.onTrack=i=>{var o;(o=this.onTrack)===null||o===void 0||o.call(this,i)}),this.publisher.onConnectionStateChange=this.updateState,this.publisher.onIceConnectionStateChange=this.updateState,this.publisher.onSignalingStatechange=this.updateState,this.publisher.onIceCandidate=i=>{var o;(o=this.onIceCandidate)===null||o===void 0||o.call(this,i,$s.PUBLISHER)},this.publisher.onTrack=i=>{var o;(o=this.onTrack)===null||o===void 0||o.call(this,i)},this.publisher.onOffer=(i,o)=>{var c;(c=this.onPublisherOffer)===null||c===void 0||c.call(this,i,o)},this.state=Pn.NEW,this.connectionLock=new Wa,this.remoteOfferLock=new Wa}get logContext(){var e,r;return Object.assign({},(r=(e=this.loggerOptions).loggerContextCb)===null||r===void 0?void 0:r.call(e))}requirePublisher(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.isPublisherConnectionRequired=e,this.updateState()}createAndSendPublisherOffer(e){return this.publisher.createAndSendOffer(e)}setPublisherAnswer(e,r){return this.publisher.setRemoteDescription(e,r)}removeTrack(e){return this.publisher.removeTrack(e)}close(){return ne(this,void 0,void 0,function*(){var e;if(this.publisher&&this.publisher.getSignallingState()!=="closed"){const r=this.publisher;for(const n of r.getSenders())try{r.canRemoveTrack()&&r.removeTrack(n)}catch(a){this.log.warn("could not removeTrack",Object.assign(Object.assign({},this.logContext),{error:a}))}}yield Promise.all([this.publisher.close(),(e=this.subscriber)===null||e===void 0?void 0:e.close()]),this.updateState()})}triggerIceRestart(){return ne(this,void 0,void 0,function*(){this.subscriber&&(this.subscriber.restartingIce=!0),this.needsPublisher&&(yield this.createAndSendPublisherOffer({iceRestart:!0}))})}addIceCandidate(e,r){return ne(this,void 0,void 0,function*(){var n;r===$s.PUBLISHER?yield this.publisher.addIceCandidate(e):yield(n=this.subscriber)===null||n===void 0?void 0:n.addIceCandidate(e)})}createSubscriberAnswerFromOffer(e,r){return ne(this,void 0,void 0,function*(){var n,a,i;this.log.debug("received server offer",Object.assign(Object.assign({},this.logContext),{RTCSdpType:e.type,sdp:e.sdp,signalingState:(n=this.subscriber)===null||n===void 0?void 0:n.getSignallingState().toString()}));const o=yield this.remoteOfferLock.lock();try{return(yield(a=this.subscriber)===null||a===void 0?void 0:a.setRemoteDescription(e,r))?yield(i=this.subscriber)===null||i===void 0?void 0:i.createAndSetAnswer():void 0}finally{o()}})}updateConfiguration(e,r){var n;this.publisher.setConfiguration(e),(n=this.subscriber)===null||n===void 0||n.setConfiguration(e),r&&this.triggerIceRestart()}ensurePCTransportConnection(e,r){return ne(this,void 0,void 0,function*(){var n;const a=yield this.connectionLock.lock();try{this.isPublisherConnectionRequired&&this.publisher.getConnectionState()!=="connected"&&this.publisher.getConnectionState()!=="connecting"&&(this.log.debug("negotiation required, start negotiating",this.logContext),this.publisher.negotiate()),yield Promise.all((n=this.requiredTransports)===null||n===void 0?void 0:n.map(i=>this.ensureTransportConnected(i,e,r)))}finally{a()}})}negotiate(e){return ne(this,void 0,void 0,function*(){return new li((r,n)=>ne(this,void 0,void 0,function*(){const a=setTimeout(()=>{n(new $f("negotiation timed out"))},this.peerConnectionTimeout),i=()=>{clearTimeout(a),n(new $f("negotiation aborted"))};e.signal.addEventListener("abort",i),this.publisher.once(Wf.NegotiationStarted,()=>{e.signal.aborted||this.publisher.once(Wf.NegotiationComplete,()=>{clearTimeout(a),r()})}),yield this.publisher.negotiate(o=>{clearTimeout(a),o instanceof Error?n(o):n(new Error(String(o)))})}))})}addPublisherTransceiver(e,r){return this.publisher.addTransceiver(e,r)}addPublisherTransceiverOfKind(e,r){return this.publisher.addTransceiverOfKind(e,r)}getMidForReceiver(e){const n=(this.subscriber?this.subscriber.getTransceivers():this.publisher.getTransceivers()).find(a=>a.receiver===e);return n?.mid}addPublisherTrack(e){return this.publisher.addTrack(e)}createPublisherDataChannel(e,r){return this.publisher.createDataChannel(e,r)}getConnectedAddress(e){return e===$s.PUBLISHER?this.publisher.getConnectedAddress():e===$s.SUBSCRIBER?this.publisher.getConnectedAddress():this.requiredTransports[0].getConnectedAddress()}get requiredTransports(){const e=[];return this.isPublisherConnectionRequired&&e.push(this.publisher),this.isSubscriberConnectionRequired&&this.subscriber&&e.push(this.subscriber),e}ensureTransportConnected(e,r){return ne(this,arguments,void 0,function(n,a){var i=this;let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.peerConnectionTimeout;return(function*(){if(n.getConnectionState()!=="connected")return new Promise((u,d)=>ne(i,void 0,void 0,function*(){const f=()=>{this.log.warn("abort transport connection",this.logContext),Ta.clearTimeout(h),d(Gt.cancelled("room connection has been cancelled"))};a?.signal.aborted&&f(),a?.signal.addEventListener("abort",f);const h=Ta.setTimeout(()=>{a?.signal.removeEventListener("abort",f),d(Gt.internal("could not establish pc connection"))},o);for(;this.state!==Pn.CONNECTED;)if(yield Ca(50),a?.signal.aborted){d(Gt.cancelled("room connection has been cancelled"));return}Ta.clearTimeout(h),a?.signal.removeEventListener("abort",f),u()}))})()})}}const e4=5e3,cde=3e4;class Rr{static fetchRegionSettings(e,r,n){return ne(this,void 0,void 0,function*(){const a=yield Rr.fetchLock.lock();try{const i=yield fetch("".concat(lde(e),"/regions"),{headers:{authorization:"Bearer ".concat(r)},signal:n});if(i.ok){const o=Due(i.headers),c=o?o*1e3:e4;return{regionSettings:yield i.json(),updatedAtInMs:Date.now(),maxAgeInMs:c}}else throw i.status===401?Gt.notAllowed("Could not fetch region settings: ".concat(i.statusText),i.status):Gt.internal("Could not fetch region settings: ".concat(i.statusText))}catch(i){throw i instanceof Gt?i:n?.aborted?Gt.cancelled("Region fetching was aborted"):Gt.serverUnreachable("Could not fetch region settings, ".concat(i instanceof Error?"".concat(i.name,": ").concat(i.message):i))}finally{a()}})}static scheduleRefetch(e,r,n){return ne(this,void 0,void 0,function*(){const a=Rr.settingsTimeouts.get(e.hostname);clearTimeout(a),Rr.settingsTimeouts.set(e.hostname,setTimeout(()=>ne(this,void 0,void 0,function*(){try{const i=yield Rr.fetchRegionSettings(e,r);Rr.updateCachedRegionSettings(e,r,i)}catch(i){if(i instanceof Gt&&i.reason===ln.NotAllowed){or.debug("token is not valid, cancelling auto region refresh");return}or.debug("auto refetching of region settings failed",{error:i}),Rr.scheduleRefetch(e,r,n)}}),n))})}static updateCachedRegionSettings(e,r,n){Rr.cache.set(e.hostname,n),Rr.scheduleRefetch(e,r,n.maxAgeInMs)}static stopRefetch(e){const r=Rr.settingsTimeouts.get(e);r&&(clearTimeout(r),Rr.settingsTimeouts.delete(e))}static scheduleCleanup(e){let r=Rr.connectionTrackers.get(e);r&&(r.cleanupTimeout&&clearTimeout(r.cleanupTimeout),r.cleanupTimeout=setTimeout(()=>{const n=Rr.connectionTrackers.get(e);n&&n.connectionCount===0&&(or.debug("stopping region refetch after disconnect delay",{hostname:e}),Rr.stopRefetch(e)),n&&(n.cleanupTimeout=void 0)},cde))}static cancelCleanup(e){const r=Rr.connectionTrackers.get(e);r?.cleanupTimeout&&(clearTimeout(r.cleanupTimeout),r.cleanupTimeout=void 0)}notifyConnected(){const e=this.serverUrl.hostname;let r=Rr.connectionTrackers.get(e);r||(r={connectionCount:0},Rr.connectionTrackers.set(e,r)),r.connectionCount++,Rr.cancelCleanup(e)}notifyDisconnected(){const e=this.serverUrl.hostname,r=Rr.connectionTrackers.get(e);r&&(r.connectionCount=Math.max(0,r.connectionCount-1),r.connectionCount===0&&Rr.scheduleCleanup(e))}constructor(e,r){this.attemptedRegions=[],this.serverUrl=new URL(e),this.token=r}updateToken(e){this.token=e}isCloud(){return dp(this.serverUrl)}getServerUrl(){return this.serverUrl}fetchRegionSettings(e){return ne(this,void 0,void 0,function*(){return Rr.fetchRegionSettings(this.serverUrl,this.token,e)})}getNextBestRegionUrl(e){return ne(this,void 0,void 0,function*(){if(!this.isCloud())throw Error("region availability is only supported for LiveKit Cloud domains");let r=Rr.cache.get(this.serverUrl.hostname);(!r||Date.now()-r.updatedAtInMs>r.maxAgeInMs)&&(r=yield this.fetchRegionSettings(e),Rr.updateCachedRegionSettings(this.serverUrl,this.token,r));const n=r.regionSettings.regions.filter(a=>!this.attemptedRegions.find(i=>i.url===a.url));if(n.length>0){const a=n[0];return this.attemptedRegions.push(a),or.debug("next region: ".concat(a.region)),a.url}else return null})}resetAttempts(){this.attemptedRegions=[]}setServerReportedRegions(e){Rr.updateCachedRegionSettings(this.serverUrl,this.token,e)}}Rr.cache=new Map;Rr.settingsTimeouts=new Map;Rr.connectionTrackers=new Map;Rr.fetchLock=new Wa;function lde(t){return"".concat(t.protocol.replace("ws","http"),"//").concat(t.host,"/settings")}let Va=class Vu extends Error{constructor(e,r,n){super(r),this.code=e,this.message=VM(r,Vu.MAX_MESSAGE_BYTES),this.data=n?VM(n,Vu.MAX_DATA_BYTES):void 0}static fromProto(e){return new Vu(e.code,e.message,e.data)}toProto(){return new W5({code:this.code,message:this.message,data:this.data})}static builtIn(e,r){return new Vu(Vu.ErrorCode[e],Vu.ErrorMessage[e],r)}};Va.MAX_MESSAGE_BYTES=256;Va.MAX_DATA_BYTES=15360;Va.ErrorCode={APPLICATION_ERROR:1500,CONNECTION_TIMEOUT:1501,RESPONSE_TIMEOUT:1502,RECIPIENT_DISCONNECTED:1503,RESPONSE_PAYLOAD_TOO_LARGE:1504,SEND_FAILED:1505,UNSUPPORTED_METHOD:1400,RECIPIENT_NOT_FOUND:1401,REQUEST_PAYLOAD_TOO_LARGE:1402,UNSUPPORTED_SERVER:1403,UNSUPPORTED_VERSION:1404};Va.ErrorMessage={APPLICATION_ERROR:"Application error in method handler",CONNECTION_TIMEOUT:"Connection timeout",RESPONSE_TIMEOUT:"Response timeout",RECIPIENT_DISCONNECTED:"Recipient disconnected",RESPONSE_PAYLOAD_TOO_LARGE:"Response payload too large",SEND_FAILED:"Failed to send",UNSUPPORTED_METHOD:"Method not supported at destination",RECIPIENT_NOT_FOUND:"Recipient not found",REQUEST_PAYLOAD_TOO_LARGE:"Request payload too large",UNSUPPORTED_SERVER:"RPC not supported by server",UNSUPPORTED_VERSION:"Unsupported RPC version"};const t4=15360;function tA(t){return new TextEncoder().encode(t).length}function VM(t,e){if(tA(t)<=e)return t;let r=0,n=t.length;const a=new TextEncoder;for(;r<n;){const i=Math.floor((r+n+1)/2);a.encode(t.slice(0,i)).length<=e?r=i:n=i-1}return t.slice(0,r)}const rA=2e3;function m0(t,e){if(!e)return 0;let r,n;return"bytesReceived"in t?(r=t.bytesReceived,n=e.bytesReceived):"bytesSent"in t&&(r=t.bytesSent,n=e.bytesSent),r===void 0||n===void 0||t.timestamp===void 0||e.timestamp===void 0?0:(r-n)*8*1e3/(t.timestamp-e.timestamp)}const nA=typeof MediaRecorder<"u";class ude{constructor(){throw new Error("MediaRecorder is not available in this environment")}}const dde=nA?MediaRecorder:ude;class fde extends dde{constructor(e,r){if(!nA)throw new Error("MediaRecorder is not available in this environment");super(new MediaStream([e.mediaStreamTrack]),r);let n,a;const i=()=>a===void 0,o=()=>{this.removeEventListener("dataavailable",n),this.removeEventListener("stop",o),this.removeEventListener("error",c),a?.close(),a=void 0},c=u=>{a?.error(u),this.removeEventListener("dataavailable",n),this.removeEventListener("stop",o),this.removeEventListener("error",c),a=void 0};this.byteStream=new ReadableStream({start:u=>{a=u,n=d=>ne(this,void 0,void 0,function*(){let f;if(d.data.arrayBuffer){const h=yield d.data.arrayBuffer();f=new Uint8Array(h)}else if(d.data.byteArray)f=d.data.byteArray;else throw new Error("no data available!");i()||u.enqueue(f)}),this.addEventListener("dataavailable",n)},cancel:()=>{o()}}),this.addEventListener("stop",o),this.addEventListener("error",c)}}function pde(){return nA}const hde=1e3,mde=1e4;class r4 extends Ke{get sender(){return this._sender}set sender(e){this._sender=e}get constraints(){return this._constraints}get hasPreConnectBuffer(){return!!this.localTrackRecorder}constructor(e,r,n){let a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,i=arguments.length>4?arguments[4]:void 0;super(e,r,i),this.manuallyStopped=!1,this._isUpstreamPaused=!1,this.handleTrackMuteEvent=()=>this.debouncedTrackMuteHandler().catch(()=>this.log.debug("track mute bounce got cancelled by an unmute event",this.logContext)),this.debouncedTrackMuteHandler=QP(()=>ne(this,void 0,void 0,function*(){yield this.pauseUpstream()}),5e3),this.handleTrackUnmuteEvent=()=>ne(this,void 0,void 0,function*(){this.debouncedTrackMuteHandler.cancel("unmute"),yield this.resumeUpstream()}),this.handleEnded=()=>{this.isInBackground&&(this.reacquireTrack=!0),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent),this.emit(dt.Ended,this)},this.reacquireTrack=!1,this.providedByUser=a,this.muteLock=new Wa,this.pauseUpstreamLock=new Wa,this.trackChangeLock=new Wa,this.trackChangeLock.lock().then(o=>ne(this,void 0,void 0,function*(){try{yield this.setMediaStreamTrack(e,!0)}finally{o()}})),this._constraints=e.getConstraints(),n&&(this._constraints=n)}get id(){return this._mediaStreamTrack.id}get dimensions(){if(this.kind!==Ke.Kind.Video)return;const{width:e,height:r}=this._mediaStreamTrack.getSettings();if(e&&r)return{width:e,height:r}}get isUpstreamPaused(){return this._isUpstreamPaused}get isUserProvided(){return this.providedByUser}get mediaStreamTrack(){var e,r;return(r=(e=this.processor)===null||e===void 0?void 0:e.processedTrack)!==null&&r!==void 0?r:this._mediaStreamTrack}get isLocal(){return!0}getSourceTrackSettings(){return this._mediaStreamTrack.getSettings()}setMediaStreamTrack(e,r){return ne(this,void 0,void 0,function*(){var n;if(e===this._mediaStreamTrack&&!r)return;this._mediaStreamTrack&&(this.attachedElements.forEach(i=>{Vf(this._mediaStreamTrack,i)}),this.debouncedTrackMuteHandler.cancel("new-track"),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent)),this.mediaStream=new MediaStream([e]),e&&(e.addEventListener("ended",this.handleEnded),e.addEventListener("mute",this.handleTrackMuteEvent),e.addEventListener("unmute",this.handleTrackUnmuteEvent),this._constraints=e.getConstraints());let a;if(this.processor&&e){if(this.log.debug("restarting processor",this.logContext),this.kind==="unknown")throw TypeError("cannot set processor on track of unknown kind");this.processorElement&&(Cf(e,this.processorElement),this.processorElement.muted=!0),yield this.processor.restart({track:e,kind:this.kind,element:this.processorElement}),a=this.processor.processedTrack}this.sender&&((n=this.sender.transport)===null||n===void 0?void 0:n.state)!=="closed"&&(yield this.sender.replaceTrack(a??e)),!this.providedByUser&&this._mediaStreamTrack!==e&&this._mediaStreamTrack.stop(),this._mediaStreamTrack=e,e&&(this._mediaStreamTrack.enabled=!this.isMuted,yield this.resumeUpstream(),this.attachedElements.forEach(i=>{Cf(a??e,i)}))})}waitForDimensions(){return ne(this,arguments,void 0,function(){var e=this;let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:hde;return(function*(){var n;if(e.kind===Ke.Kind.Audio)throw new Error("cannot get dimensions for audio tracks");((n=fi())===null||n===void 0?void 0:n.os)==="iOS"&&(yield Ca(10));const a=Date.now();for(;Date.now()-a<r;){const i=e.dimensions;if(i)return i;yield Ca(50)}throw new Rc("unable to get track dimensions after timeout")})()})}setDeviceId(e){return ne(this,void 0,void 0,function*(){return this._constraints.deviceId===e&&this._mediaStreamTrack.getSettings().deviceId===Hl(e)||(this._constraints.deviceId=e,this.isMuted)?!0:(yield this.restartTrack(),Hl(e)===this._mediaStreamTrack.getSettings().deviceId)})}getDeviceId(){return ne(this,arguments,void 0,function(){var e=this;let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return(function*(){if(e.source===Ke.Source.ScreenShare)return;const{deviceId:n,groupId:a}=e._mediaStreamTrack.getSettings(),i=e.kind===Ke.Kind.Audio?"audioinput":"videoinput";return r?fa.getInstance().normalizeDeviceId(i,n,a):n})()})}mute(){return ne(this,void 0,void 0,function*(){return this.setTrackMuted(!0),this})}unmute(){return ne(this,void 0,void 0,function*(){return this.setTrackMuted(!1),this})}replaceTrack(e,r){return ne(this,void 0,void 0,function*(){const n=yield this.trackChangeLock.lock();try{if(!this.sender)throw new Rc("unable to replace an unpublished track");let a,i;return typeof r=="boolean"?a=r:r!==void 0&&(a=r.userProvidedTrack,i=r.stopProcessor),this.providedByUser=a??!0,this.log.debug("replace MediaStreamTrack",this.logContext),yield this.setMediaStreamTrack(e),i&&this.processor&&(yield this.internalStopProcessor()),this}finally{n()}})}restart(e){return ne(this,void 0,void 0,function*(){this.manuallyStopped=!1;const r=yield this.trackChangeLock.lock();try{e||(e=this._constraints);const{deviceId:n,facingMode:a}=e,i=Lle(e,["deviceId","facingMode"]);this.log.debug("restarting track with constraints",Object.assign(Object.assign({},this.logContext),{constraints:e}));const o={audio:!1,video:!1};this.kind===Ke.Kind.Video?o.video=n||a?{deviceId:n,facingMode:a}:!0:o.audio=n?Object.assign({deviceId:n},i):!0,this.attachedElements.forEach(d=>{Vf(this.mediaStreamTrack,d)}),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.stop();const u=(yield navigator.mediaDevices.getUserMedia(o)).getTracks()[0];return this.kind===Ke.Kind.Video&&(yield u.applyConstraints(i)),u.addEventListener("ended",this.handleEnded),this.log.debug("re-acquired MediaStreamTrack",this.logContext),yield this.setMediaStreamTrack(u),this._constraints=e,this.emit(dt.Restarted,this),this.manuallyStopped&&(this.log.warn("track was stopped during a restart, stopping restarted track",this.logContext),this.stop()),this}finally{r()}})}setTrackMuted(e){this.log.debug("setting ".concat(this.kind," track ").concat(e?"muted":"unmuted"),this.logContext),!(this.isMuted===e&&this._mediaStreamTrack.enabled!==e)&&(this.isMuted=e,this._mediaStreamTrack.enabled=!e,this.emit(e?dt.Muted:dt.Unmuted,this))}get needsReAcquisition(){return this._mediaStreamTrack.readyState!=="live"||this._mediaStreamTrack.muted||!this._mediaStreamTrack.enabled||this.reacquireTrack}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return ne(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),Kq()&&(this.log.debug("visibility changed, is in Background: ".concat(this.isInBackground),this.logContext),!this.isInBackground&&this.needsReAcquisition&&!this.isUserProvided&&!this.isMuted&&(this.log.debug("track needs to be reacquired, restarting ".concat(this.source),this.logContext),yield this.restart(),this.reacquireTrack=!1))})}stop(){var e;this.manuallyStopped=!0,super.stop(),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent),(e=this.processor)===null||e===void 0||e.destroy(),this.processor=void 0}pauseUpstream(){return ne(this,void 0,void 0,function*(){var e;const r=yield this.pauseUpstreamLock.lock();try{if(this._isUpstreamPaused===!0)return;if(!this.sender){this.log.warn("unable to pause upstream for an unpublished track",this.logContext);return}this._isUpstreamPaused=!0,this.emit(dt.UpstreamPaused,this);const n=fi();if(n?.name==="Safari"&&Xo(n.version,"12.0")<0)throw new GP("pauseUpstream is not supported on Safari < 12.");((e=this.sender.transport)===null||e===void 0?void 0:e.state)!=="closed"&&(yield this.sender.replaceTrack(null))}finally{r()}})}resumeUpstream(){return ne(this,void 0,void 0,function*(){var e;const r=yield this.pauseUpstreamLock.lock();try{if(this._isUpstreamPaused===!1)return;if(!this.sender){this.log.warn("unable to resume upstream for an unpublished track",this.logContext);return}this._isUpstreamPaused=!1,this.emit(dt.UpstreamResumed,this),((e=this.sender.transport)===null||e===void 0?void 0:e.state)!=="closed"&&(yield this.sender.replaceTrack(this.mediaStreamTrack))}finally{r()}})}getRTCStatsReport(){return ne(this,void 0,void 0,function*(){var e;return!((e=this.sender)===null||e===void 0)&&e.getStats?yield this.sender.getStats():void 0})}setProcessor(e){return ne(this,arguments,void 0,function(r){var n=this;let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return(function*(){var i;const o=yield n.trackChangeLock.lock();try{n.log.debug("setting up processor",n.logContext);const c=document.createElement(n.kind),u={kind:n.kind,track:n._mediaStreamTrack,element:c,audioContext:n.audioContext};if(yield r.init(u),n.log.debug("processor initialized",n.logContext),n.processor&&(yield n.internalStopProcessor()),n.kind==="unknown")throw TypeError("cannot set processor on track of unknown kind");if(Cf(n._mediaStreamTrack,c),c.muted=!0,c.play().catch(d=>{d instanceof DOMException&&d.name==="AbortError"?(n.log.warn("failed to play processor element, retrying",Object.assign(Object.assign({},n.logContext),{error:d})),setTimeout(()=>{c.play().catch(f=>{n.log.error("failed to play processor element",Object.assign(Object.assign({},n.logContext),{err:f}))})},100)):n.log.error("failed to play processor element",Object.assign(Object.assign({},n.logContext),{error:d}))}),n.processor=r,n.processorElement=c,n.processor.processedTrack){for(const d of n.attachedElements)d!==n.processorElement&&a&&(Vf(n._mediaStreamTrack,d),Cf(n.processor.processedTrack,d));yield(i=n.sender)===null||i===void 0?void 0:i.replaceTrack(n.processor.processedTrack)}n.emit(dt.TrackProcessorUpdate,n.processor)}finally{o()}})()})}getProcessor(){return this.processor}stopProcessor(){return ne(this,arguments,void 0,function(){var e=this;let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return(function*(){const n=yield e.trackChangeLock.lock();try{yield e.internalStopProcessor(r)}finally{n()}})()})}internalStopProcessor(){return ne(this,arguments,void 0,function(){var e=this;let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return(function*(){var n,a;e.processor&&(e.log.debug("stopping processor",e.logContext),(n=e.processor.processedTrack)===null||n===void 0||n.stop(),yield e.processor.destroy(),e.processor=void 0,r||((a=e.processorElement)===null||a===void 0||a.remove(),e.processorElement=void 0),yield e._mediaStreamTrack.applyConstraints(e._constraints),yield e.setMediaStreamTrack(e._mediaStreamTrack,!0),e.emit(dt.TrackProcessorUpdate))})()})}startPreConnectBuffer(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:100;if(!pde()){this.log.warn("MediaRecorder is not available, cannot start preconnect buffer",this.logContext);return}if(this.localTrackRecorder){this.log.warn("preconnect buffer already started");return}else{let r="audio/webm;codecs=opus";MediaRecorder.isTypeSupported(r)||(r="video/mp4"),this.localTrackRecorder=new fde(this,{mimeType:r})}this.localTrackRecorder.start(e),this.autoStopPreConnectBuffer=setTimeout(()=>{this.log.warn("preconnect buffer timed out, stopping recording automatically",this.logContext),this.stopPreConnectBuffer()},mde)}stopPreConnectBuffer(){clearTimeout(this.autoStopPreConnectBuffer),this.localTrackRecorder&&(this.localTrackRecorder.stop(),this.localTrackRecorder=void 0)}getPreConnectBuffer(){var e;return(e=this.localTrackRecorder)===null||e===void 0?void 0:e.byteStream}getPreConnectBufferMimeType(){var e;return(e=this.localTrackRecorder)===null||e===void 0?void 0:e.mimeType}}class db extends r4{get enhancedNoiseCancellation(){return this.isKrispNoiseFilterEnabled}constructor(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0;super(e,Ke.Kind.Audio,r,n,i),this.stopOnMute=!1,this.isKrispNoiseFilterEnabled=!1,this.monitorSender=()=>ne(this,void 0,void 0,function*(){if(!this.sender){this._currentBitrate=0;return}let o;try{o=yield this.getSenderStats()}catch(c){this.log.error("could not get audio sender stats",Object.assign(Object.assign({},this.logContext),{error:c}));return}o&&this.prevStats&&(this._currentBitrate=m0(o,this.prevStats)),this.prevStats=o}),this.handleKrispNoiseFilterEnable=()=>{this.isKrispNoiseFilterEnabled=!0,this.log.debug("Krisp noise filter enabled",this.logContext),this.emit(dt.AudioTrackFeatureUpdate,this,da.TF_ENHANCED_NOISE_CANCELLATION,!0)},this.handleKrispNoiseFilterDisable=()=>{this.isKrispNoiseFilterEnabled=!1,this.log.debug("Krisp noise filter disabled",this.logContext),this.emit(dt.AudioTrackFeatureUpdate,this,da.TF_ENHANCED_NOISE_CANCELLATION,!1)},this.audioContext=a,this.checkForSilence()}mute(){const e=Object.create(null,{mute:{get:()=>super.mute}});return ne(this,void 0,void 0,function*(){const r=yield this.muteLock.lock();try{return this.isMuted?(this.log.debug("Track already muted",this.logContext),this):(this.source===Ke.Source.Microphone&&this.stopOnMute&&!this.isUserProvided&&(this.log.debug("stopping mic track",this.logContext),this._mediaStreamTrack.stop()),yield e.mute.call(this),this)}finally{r()}})}unmute(){const e=Object.create(null,{unmute:{get:()=>super.unmute}});return ne(this,void 0,void 0,function*(){const r=yield this.muteLock.lock();try{if(!this.isMuted)return this.log.debug("Track already unmuted",this.logContext),this;const n=this._constraints.deviceId&&this._mediaStreamTrack.getSettings().deviceId!==Hl(this._constraints.deviceId);return this.source===Ke.Source.Microphone&&(this.stopOnMute||this._mediaStreamTrack.readyState==="ended"||n)&&!this.isUserProvided&&(this.log.debug("reacquiring mic track",this.logContext),yield this.restartTrack()),yield e.unmute.call(this),this}finally{r()}})}restartTrack(e){return ne(this,void 0,void 0,function*(){let r;if(e){const n=KP({audio:e});typeof n.audio!="boolean"&&(r=n.audio)}yield this.restart(r)})}restart(e){const r=Object.create(null,{restart:{get:()=>super.restart}});return ne(this,void 0,void 0,function*(){const n=yield r.restart.call(this,e);return this.checkForSilence(),n})}startMonitor(){ui()&&(this.monitorInterval||(this.monitorInterval=setInterval(()=>{this.monitorSender()},rA)))}setProcessor(e){return ne(this,void 0,void 0,function*(){var r;const n=yield this.trackChangeLock.lock();try{if(!Yo()&&!this.audioContext)throw Error("Audio context needs to be set on LocalAudioTrack in order to enable processors");this.processor&&(yield this.internalStopProcessor());const a={kind:this.kind,track:this._mediaStreamTrack,audioContext:this.audioContext};this.log.debug("setting up audio processor ".concat(e.name),this.logContext),yield e.init(a),this.processor=e,this.processor.processedTrack&&(yield(r=this.sender)===null||r===void 0?void 0:r.replaceTrack(this.processor.processedTrack),this.processor.processedTrack.addEventListener("enable-lk-krisp-noise-filter",this.handleKrispNoiseFilterEnable),this.processor.processedTrack.addEventListener("disable-lk-krisp-noise-filter",this.handleKrispNoiseFilterDisable)),this.emit(dt.TrackProcessorUpdate,this.processor)}finally{n()}})}setAudioContext(e){this.audioContext=e}getSenderStats(){return ne(this,void 0,void 0,function*(){var e;if(!(!((e=this.sender)===null||e===void 0)&&e.getStats))return;const r=yield this.sender.getStats();let n;return r.forEach(a=>{a.type==="outbound-rtp"&&(n={type:"audio",streamId:a.id,packetsSent:a.packetsSent,packetsLost:a.packetsLost,bytesSent:a.bytesSent,timestamp:a.timestamp,roundTripTime:a.roundTripTime,jitter:a.jitter})}),n})}checkForSilence(){return ne(this,void 0,void 0,function*(){const e=yield Hq(this);return e&&(this.isMuted||this.log.debug("silence detected on local audio track",this.logContext),this.emit(dt.AudioSilenceDetected)),e})}}function gde(t,e,r){switch(t.kind){case"audio":return new db(t,e,!1,void 0,r);case"video":return new fb(t,e,!1,r);default:throw new Rc("unsupported track type: ".concat(t.kind))}}const yde=Object.values(up),vde=Object.values(mC),_de=Object.values(WP),bde=[up.h180,up.h360],kde=[mC.h180,mC.h360],wde=t=>[{scaleResolutionDownBy:2,fps:t.encoding.maxFramerate}].map(r=>{var n,a;return new en(Math.floor(t.width/r.scaleResolutionDownBy),Math.floor(t.height/r.scaleResolutionDownBy),Math.max(15e4,Math.floor(t.encoding.maxBitrate/(Math.pow(r.scaleResolutionDownBy,2)*(((n=t.encoding.maxFramerate)!==null&&n!==void 0?n:30)/((a=r.fps)!==null&&a!==void 0?a:30))))),r.fps,t.encoding.priority)}),EC=["q","h","f"];function TC(t,e,r,n){var a,i;let o=n?.videoEncoding;t&&(o=n?.screenShareEncoding);const c=n?.simulcast,u=n?.scalabilityMode,d=n?.videoCodec;if(!o&&!c&&!u||!e||!r)return[{}];o||(o=Ede(t,e,r,d),or.debug("using video encoding",o));const f=o.maxFramerate,h=new en(e,r,o.maxBitrate,o.maxFramerate,o.priority);if(u&&Vs(d)){const w=new n4(u),b=[];if(w.spatial>3)throw new Error("unsupported scalabilityMode: ".concat(u));const E=fi();if(Gm()||Yo()||E?.name==="Chrome"&&Xo(E?.version,"113")<0){const T=w.suffix=="h"?2:3,D=_ue(E);for(let P=0;P<w.spatial;P+=1)b.push({rid:EC[2-P],maxBitrate:o.maxBitrate/Math.pow(T,P),maxFramerate:h.encoding.maxFramerate,scaleResolutionDownBy:D?Math.pow(2,P):void 0});b[0].scalabilityMode=u}else b.push({maxBitrate:o.maxBitrate,maxFramerate:h.encoding.maxFramerate,scalabilityMode:u});return h.encoding.priority&&(b[0].priority=h.encoding.priority,b[0].networkPriority=h.encoding.priority),or.debug("using svc encoding",{encodings:b}),b}if(!c)return[o];let m=[];t?m=(a=GM(n?.screenShareSimulcastLayers))!==null&&a!==void 0?a:HM(t,h):m=(i=GM(n?.videoSimulcastLayers))!==null&&i!==void 0?i:HM(t,h);let _;if(m.length>0){const w=m[0];m.length>1&&([,_]=m);const b=Math.max(e,r);if(b>=960&&_)return mE(e,r,[w,_,h],f);if(b>=480)return mE(e,r,[w,h],f)}return mE(e,r,[h])}function Sde(t,e,r){var n,a,i,o;if(!r.backupCodec||r.backupCodec===!0||r.backupCodec.codec===r.videoCodec)return;e!==r.backupCodec.codec&&or.warn("requested a different codec than specified as backup",{serverRequested:e,backup:r.backupCodec.codec}),r.videoCodec=e,r.videoEncoding=r.backupCodec.encoding;const c=t.mediaStreamTrack.getSettings(),u=(n=c.width)!==null&&n!==void 0?n:(a=t.dimensions)===null||a===void 0?void 0:a.width,d=(i=c.height)!==null&&i!==void 0?i:(o=t.dimensions)===null||o===void 0?void 0:o.height;return t.source===Ke.Source.ScreenShare&&r.simulcast&&(r.simulcast=!1),TC(t.source===Ke.Source.ScreenShare,u,d,r)}function Ede(t,e,r,n){const a=Tde(t,e,r);let{encoding:i}=a[0];const o=Math.max(e,r);for(let c=0;c<a.length;c+=1){const u=a[c];if(i=u.encoding,u.width>=o)break}if(n)switch(n){case"av1":case"h265":i=Object.assign({},i),i.maxBitrate=i.maxBitrate*.7;break;case"vp9":i=Object.assign({},i),i.maxBitrate=i.maxBitrate*.85;break}return i}function Tde(t,e,r){if(t)return _de;const n=e>r?e/r:r/e;return Math.abs(n-16/9)<Math.abs(n-4/3)?yde:vde}function HM(t,e){if(t)return wde(e);const{width:r,height:n}=e,a=r>n?r/n:n/r;return Math.abs(a-16/9)<Math.abs(a-4/3)?bde:kde}function mE(t,e,r,n){const a=[];if(r.forEach((i,o)=>{if(o>=EC.length)return;const c=Math.min(t,e),d={rid:EC[o],scaleResolutionDownBy:Math.max(1,c/Math.min(i.width,i.height)),maxBitrate:i.encoding.maxBitrate},f=n&&i.encoding.maxFramerate?Math.min(n,i.encoding.maxFramerate):i.encoding.maxFramerate;f&&(d.maxFramerate=f);const h=pd()||o===0;i.encoding.priority&&h&&(d.priority=i.encoding.priority,d.networkPriority=i.encoding.priority),a.push(d)}),Yo()&&Xq()==="ios"){let i;a.forEach(c=>{i?c.maxFramerate&&c.maxFramerate>i&&(i=c.maxFramerate):i=c.maxFramerate});let o=!0;a.forEach(c=>{var u;c.maxFramerate!=i&&(o&&(o=!1,or.info("Simulcast on iOS React-Native requires all encodings to share the same framerate.")),or.info('Setting framerate of encoding "'.concat((u=c.rid)!==null&&u!==void 0?u:"",'" to ').concat(i)),c.maxFramerate=i)})}return a}function GM(t){if(t)return t.sort((e,r)=>{const{encoding:n}=e,{encoding:a}=r;return n.maxBitrate>a.maxBitrate?1:n.maxBitrate<a.maxBitrate?-1:n.maxBitrate===a.maxBitrate&&n.maxFramerate&&a.maxFramerate?n.maxFramerate>a.maxFramerate?1:-1:0})}class n4{constructor(e){const r=e.match(/^L(\d)T(\d)(h|_KEY|_KEY_SHIFT){0,1}$/);if(!r)throw new Error("invalid scalability mode");if(this.spatial=parseInt(r[1]),this.temporal=parseInt(r[2]),r.length>3)switch(r[3]){case"h":case"_KEY":case"_KEY_SHIFT":this.suffix=r[3]}}toString(){var e;return"L".concat(this.spatial,"T").concat(this.temporal).concat((e=this.suffix)!==null&&e!==void 0?e:"")}}function Cde(t){return t.source===Ke.Source.ScreenShare||t.constraints.height&&Hl(t.constraints.height)>=1080?"maintain-resolution":"balanced"}const xde=5e3;class fb extends r4{get sender(){return this._sender}set sender(e){this._sender=e,this.degradationPreference&&this.setDegradationPreference(this.degradationPreference)}constructor(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=arguments.length>3?arguments[3]:void 0;super(e,Ke.Kind.Video,r,n,a),this.simulcastCodecs=new Map,this.degradationPreference="balanced",this.isCpuConstrained=!1,this.optimizeForPerformance=!1,this.monitorSender=()=>ne(this,void 0,void 0,function*(){if(!this.sender){this._currentBitrate=0;return}let i;try{i=yield this.getSenderStats()}catch(u){this.log.error("could not get video sender stats",Object.assign(Object.assign({},this.logContext),{error:u}));return}const o=new Map(i.map(u=>[u.rid,u])),c=i.some(u=>u.qualityLimitationReason==="cpu");if(c!==this.isCpuConstrained&&(this.isCpuConstrained=c,this.isCpuConstrained&&this.emit(dt.CpuConstrained)),this.prevStats){let u=0;o.forEach((d,f)=>{var h;const m=(h=this.prevStats)===null||h===void 0?void 0:h.get(f);u+=m0(d,m)}),this._currentBitrate=u}this.prevStats=o}),this.senderLock=new Wa}get isSimulcast(){return!!(this.sender&&this.sender.getParameters().encodings.length>1)}startMonitor(e){var r;if(this.signalClient=e,!ui())return;const n=(r=this.sender)===null||r===void 0?void 0:r.getParameters();n&&(this.encodings=n.encodings),!this.monitorInterval&&(this.monitorInterval=setInterval(()=>{this.monitorSender()},rA))}stop(){this._mediaStreamTrack.getConstraints(),this.simulcastCodecs.forEach(e=>{e.mediaStreamTrack.stop()}),super.stop()}pauseUpstream(){const e=Object.create(null,{pauseUpstream:{get:()=>super.pauseUpstream}});return ne(this,void 0,void 0,function*(){var r,n,a,i,o;yield e.pauseUpstream.call(this);try{for(var c=!0,u=Ac(this.simulcastCodecs.values()),d;d=yield u.next(),r=d.done,!r;c=!0)i=d.value,c=!1,yield(o=i.sender)===null||o===void 0?void 0:o.replaceTrack(null)}catch(f){n={error:f}}finally{try{!c&&!r&&(a=u.return)&&(yield a.call(u))}finally{if(n)throw n.error}}})}resumeUpstream(){const e=Object.create(null,{resumeUpstream:{get:()=>super.resumeUpstream}});return ne(this,void 0,void 0,function*(){var r,n,a,i,o;yield e.resumeUpstream.call(this);try{for(var c=!0,u=Ac(this.simulcastCodecs.values()),d;d=yield u.next(),r=d.done,!r;c=!0){i=d.value,c=!1;const f=i;yield(o=f.sender)===null||o===void 0?void 0:o.replaceTrack(f.mediaStreamTrack)}}catch(f){n={error:f}}finally{try{!c&&!r&&(a=u.return)&&(yield a.call(u))}finally{if(n)throw n.error}}})}mute(){const e=Object.create(null,{mute:{get:()=>super.mute}});return ne(this,void 0,void 0,function*(){const r=yield this.muteLock.lock();try{return this.isMuted?(this.log.debug("Track already muted",this.logContext),this):(this.source===Ke.Source.Camera&&!this.isUserProvided&&(this.log.debug("stopping camera track",this.logContext),this._mediaStreamTrack.stop()),yield e.mute.call(this),this)}finally{r()}})}unmute(){const e=Object.create(null,{unmute:{get:()=>super.unmute}});return ne(this,void 0,void 0,function*(){const r=yield this.muteLock.lock();try{return this.isMuted?(this.source===Ke.Source.Camera&&!this.isUserProvided&&(this.log.debug("reacquiring camera track",this.logContext),yield this.restartTrack()),yield e.unmute.call(this),this):(this.log.debug("Track already unmuted",this.logContext),this)}finally{r()}})}setTrackMuted(e){super.setTrackMuted(e);for(const r of this.simulcastCodecs.values())r.mediaStreamTrack.enabled=!e}getSenderStats(){return ne(this,void 0,void 0,function*(){var e;if(!(!((e=this.sender)===null||e===void 0)&&e.getStats))return[];const r=[],n=yield this.sender.getStats();return n.forEach(a=>{var i;if(a.type==="outbound-rtp"){const o={type:"video",streamId:a.id,frameHeight:a.frameHeight,frameWidth:a.frameWidth,framesPerSecond:a.framesPerSecond,framesSent:a.framesSent,firCount:a.firCount,pliCount:a.pliCount,nackCount:a.nackCount,packetsSent:a.packetsSent,bytesSent:a.bytesSent,qualityLimitationReason:a.qualityLimitationReason,qualityLimitationDurations:a.qualityLimitationDurations,qualityLimitationResolutionChanges:a.qualityLimitationResolutionChanges,rid:(i=a.rid)!==null&&i!==void 0?i:a.id,retransmittedPacketsSent:a.retransmittedPacketsSent,targetBitrate:a.targetBitrate,timestamp:a.timestamp},c=n.get(a.remoteId);c&&(o.jitter=c.jitter,o.packetsLost=c.packetsLost,o.roundTripTime=c.roundTripTime),r.push(o)}}),r.sort((a,i)=>{var o,c;return((o=i.frameWidth)!==null&&o!==void 0?o:0)-((c=a.frameWidth)!==null&&c!==void 0?c:0)}),r})}setPublishingQuality(e){const r=[];for(let n=Ii.LOW;n<=Ii.HIGH;n+=1)r.push(new $P({quality:n,enabled:n<=e}));this.log.debug("setting publishing quality. max quality ".concat(e),this.logContext),this.setPublishingLayers(Vs(this.codec),r)}restartTrack(e){return ne(this,void 0,void 0,function*(){var r,n,a,i,o;let c;if(e){const h=KP({video:e});typeof h.video!="boolean"&&(c=h.video)}yield this.restart(c),this.isCpuConstrained=!1;try{for(var u=!0,d=Ac(this.simulcastCodecs.values()),f;f=yield d.next(),r=f.done,!r;u=!0){i=f.value,u=!1;const h=i;h.sender&&((o=h.sender.transport)===null||o===void 0?void 0:o.state)!=="closed"&&(h.mediaStreamTrack=this.mediaStreamTrack.clone(),yield h.sender.replaceTrack(h.mediaStreamTrack))}}catch(h){n={error:h}}finally{try{!u&&!r&&(a=d.return)&&(yield a.call(d))}finally{if(n)throw n.error}}})}setProcessor(e){const r=Object.create(null,{setProcessor:{get:()=>super.setProcessor}});return ne(this,arguments,void 0,function(n){var a=this;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return(function*(){var o,c,u,d,f,h;if(yield r.setProcessor.call(a,n,i),!((f=a.processor)===null||f===void 0)&&f.processedTrack)try{for(var m=!0,_=Ac(a.simulcastCodecs.values()),w;w=yield _.next(),o=w.done,!o;m=!0)d=w.value,m=!1,yield(h=d.sender)===null||h===void 0?void 0:h.replaceTrack(a.processor.processedTrack)}catch(b){c={error:b}}finally{try{!m&&!o&&(u=_.return)&&(yield u.call(_))}finally{if(c)throw c.error}}})()})}setDegradationPreference(e){return ne(this,void 0,void 0,function*(){if(this.degradationPreference=e,this.sender)try{this.log.debug("setting degradationPreference to ".concat(e),this.logContext);const r=this.sender.getParameters();r.degradationPreference=e,this.sender.setParameters(r)}catch(r){this.log.warn("failed to set degradationPreference",Object.assign({error:r},this.logContext))}})}addSimulcastTrack(e,r){if(this.simulcastCodecs.has(e)){this.log.error("".concat(e," already added, skipping adding simulcast codec"),this.logContext);return}const n={codec:e,mediaStreamTrack:this.mediaStreamTrack.clone(),sender:void 0,encodings:r};return this.simulcastCodecs.set(e,n),n}setSimulcastTrackSender(e,r){const n=this.simulcastCodecs.get(e);n&&(n.sender=r,setTimeout(()=>{this.subscribedCodecs&&this.setPublishingCodecs(this.subscribedCodecs)},xde))}setPublishingCodecs(e){return ne(this,void 0,void 0,function*(){var r,n,a,i,o,c,u;if(this.log.debug("setting publishing codecs",Object.assign(Object.assign({},this.logContext),{codecs:e,currentCodec:this.codec})),!this.codec&&e.length>0)return yield this.setPublishingLayers(Vs(e[0].codec),e[0].qualities),[];this.subscribedCodecs=e;const d=[];try{for(r=!0,n=Ac(e);a=yield n.next(),i=a.done,!i;r=!0){u=a.value,r=!1;const f=u;if(!this.codec||this.codec===f.codec)yield this.setPublishingLayers(Vs(f.codec),f.qualities);else{const h=this.simulcastCodecs.get(f.codec);if(this.log.debug("try setPublishingCodec for ".concat(f.codec),Object.assign(Object.assign({},this.logContext),{simulcastCodecInfo:h})),!h||!h.sender){for(const m of f.qualities)if(m.enabled){d.push(f.codec);break}}else h.encodings&&(this.log.debug("try setPublishingLayersForSender ".concat(f.codec),this.logContext),yield WM(h.sender,h.encodings,f.qualities,this.senderLock,Vs(f.codec),this.log,this.logContext))}}}catch(f){o={error:f}}finally{try{!r&&!i&&(c=n.return)&&(yield c.call(n))}finally{if(o)throw o.error}}return d})}setPublishingLayers(e,r){return ne(this,void 0,void 0,function*(){if(this.optimizeForPerformance){this.log.info("skipping setPublishingLayers due to optimized publishing performance",Object.assign(Object.assign({},this.logContext),{qualities:r}));return}this.log.debug("setting publishing layers",Object.assign(Object.assign({},this.logContext),{qualities:r})),!(!this.sender||!this.encodings)&&(yield WM(this.sender,this.encodings,r,this.senderLock,e,this.log,this.logContext))})}prioritizePerformance(){return ne(this,void 0,void 0,function*(){if(!this.sender)throw new Error("sender not found");const e=yield this.senderLock.lock();try{this.optimizeForPerformance=!0;const r=this.sender.getParameters();r.encodings=r.encodings.map((n,a)=>{var i;return Object.assign(Object.assign({},n),{active:a===0,scaleResolutionDownBy:Math.max(1,Math.ceil(((i=this.mediaStreamTrack.getSettings().height)!==null&&i!==void 0?i:360)/360)),scalabilityMode:a===0&&Vs(this.codec)?"L1T3":void 0,maxFramerate:a===0?15:0,maxBitrate:a===0?n.maxBitrate:0})}),this.log.debug("setting performance optimised encodings",Object.assign(Object.assign({},this.logContext),{encodings:r.encodings})),this.encodings=r.encodings,yield this.sender.setParameters(r)}catch(r){this.log.error("failed to set performance optimised encodings",Object.assign(Object.assign({},this.logContext),{error:r})),this.optimizeForPerformance=!1}finally{e()}})}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return ne(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),Kq()&&this.isInBackground&&this.source===Ke.Source.Camera&&(this._mediaStreamTrack.enabled=!1)})}}function WM(t,e,r,n,a,i,o){return ne(this,void 0,void 0,function*(){const c=yield n.lock();i.debug("setPublishingLayersForSender",Object.assign(Object.assign({},o),{sender:t,qualities:r,senderEncodings:e}));try{const u=t.getParameters(),{encodings:d}=u;if(!d)return;if(d.length!==e.length){i.warn("cannot set publishing layers, encodings mismatch",Object.assign(Object.assign({},o),{encodings:d,senderEncodings:e}));return}let f=!1;!1&&d[0].scalabilityMode||(a&&r.some(_=>_.enabled)&&r.forEach(_=>_.enabled=!0),d.forEach((m,_)=>{var w;let b=(w=m.rid)!==null&&w!==void 0?w:"";b===""&&(b="q");const E=a4(b),T=r.find(D=>D.quality===E);T&&m.active!==T.enabled&&(f=!0,m.active=T.enabled,i.debug("setting layer ".concat(T.quality," to ").concat(m.active?"enabled":"disabled"),o),pd()&&(T.enabled?(m.scaleResolutionDownBy=e[_].scaleResolutionDownBy,m.maxBitrate=e[_].maxBitrate,m.maxFrameRate=e[_].maxFrameRate):(m.scaleResolutionDownBy=4,m.maxBitrate=10,m.maxFrameRate=2)))})),f&&(u.encodings=d,i.debug("setting encodings",Object.assign(Object.assign({},o),{encodings:u.encodings})),yield t.setParameters(u))}finally{c()}})}function a4(t){switch(t){case"f":return Ii.HIGH;case"h":return Ii.MEDIUM;case"q":return Ii.LOW;default:return Ii.HIGH}}function KM(t,e,r,n){if(!r)return[new Vl({quality:Ii.HIGH,width:t,height:e,bitrate:0,ssrc:0})];if(n){const a=r[0].scalabilityMode,i=new n4(a),o=[],c=i.suffix=="h"?1.5:2,u=i.suffix=="h"?2:3;for(let d=0;d<i.spatial;d+=1)o.push(new Vl({quality:Math.min(Ii.HIGH,i.spatial-1)-d,width:Math.ceil(t/Math.pow(c,d)),height:Math.ceil(e/Math.pow(c,d)),bitrate:r[0].maxBitrate?Math.ceil(r[0].maxBitrate/Math.pow(u,d)):0,ssrc:0}));return o}return r.map(a=>{var i,o,c;const u=(i=a.scaleResolutionDownBy)!==null&&i!==void 0?i:1;let d=a4((o=a.rid)!==null&&o!==void 0?o:"");return new Vl({quality:d,width:Math.ceil(t/u),height:Math.ceil(e/u),bitrate:(c=a.maxBitrate)!==null&&c!==void 0?c:0,ssrc:0})})}const YM="_lossy",XM="_reliable",Pde=2*1e3,gE="leave-reconnect",Ade=3e4,Rde=8*1024,Dde=256*1024;var rs;(function(t){t[t.New=0]="New",t[t.Connected=1]="Connected",t[t.Disconnected=2]="Disconnected",t[t.Reconnecting=3]="Reconnecting",t[t.Closed=4]="Closed"})(rs||(rs={}));class Ode extends Zo.EventEmitter{get isClosed(){return this._isClosed}get pendingReconnect(){return!!this.reconnectTimeout}constructor(e){var r;super(),this.options=e,this.rtcConfig={},this.peerConnectionTimeout=eA.peerConnectionTimeout,this.fullReconnectOnNext=!1,this.latestRemoteOfferId=0,this.subscriberPrimary=!1,this.pcState=rs.New,this._isClosed=!0,this.pendingTrackResolvers={},this.reconnectAttempts=0,this.reconnectStart=0,this.attemptingReconnect=!1,this.joinAttempts=0,this.maxJoinAttempts=1,this.shouldFailNext=!1,this.log=or,this.reliableDataSequence=1,this.reliableMessageBuffer=new jM,this.reliableReceivedState=new Que(Ade),this.lossyDataStatCurrentBytes=0,this.lossyDataStatByterate=0,this.lossyDataDropCount=0,this.midToTrackId={},this.isWaitingForNetworkReconnect=!1,this.handleDataChannel=n=>ne(this,[n],void 0,function(a){var i=this;let{channel:o}=a;return(function*(){if(o){if(o.label===XM)i.reliableDCSub=o;else if(o.label===YM)i.lossyDCSub=o;else return;i.log.debug("on data channel ".concat(o.id,", ").concat(o.label),i.logContext),o.onmessage=i.handleDataMessage}})()}),this.handleDataMessage=n=>ne(this,void 0,void 0,function*(){var a,i,o,c,u;const d=yield this.dataProcessLock.lock();try{let f;if(n.data instanceof ArrayBuffer)f=n.data;else if(n.data instanceof Blob)f=yield n.data.arrayBuffer();else{this.log.error("unsupported data type",Object.assign(Object.assign({},this.logContext),{data:n.data}));return}const h=$a.fromBinary(new Uint8Array(f));if(h.sequence>0&&h.participantSid!==""){const m=this.reliableReceivedState.get(h.participantSid);if(m&&h.sequence<=m)return;this.reliableReceivedState.set(h.participantSid,h.sequence)}if(((a=h.value)===null||a===void 0?void 0:a.case)==="speaker")this.emit(ht.ActiveSpeakersUpdate,h.value.value.speakers);else if(((i=h.value)===null||i===void 0?void 0:i.case)==="encryptedPacket"){if(!this.e2eeManager){this.log.error("Received encrypted packet but E2EE not set up",this.logContext);return}const m=yield(o=this.e2eeManager)===null||o===void 0?void 0:o.handleEncryptedData(h.value.value.encryptedValue,h.value.value.iv,h.participantIdentity,h.value.value.keyIndex),_=V5.fromBinary(m.payload),w=new $a({value:_.value,participantIdentity:h.participantIdentity,participantSid:h.participantSid});((c=w.value)===null||c===void 0?void 0:c.case)==="user"&&JM(w,w.value.value),this.emit(ht.DataPacketReceived,w,h.value.value.encryptionType)}else((u=h.value)===null||u===void 0?void 0:u.case)==="user"&&JM(h,h.value.value),this.emit(ht.DataPacketReceived,h,aa.NONE)}finally{d()}}),this.handleDataError=n=>{const i=n.currentTarget.maxRetransmits===0?"lossy":"reliable";if(n instanceof ErrorEvent&&n.error){const{error:o}=n.error;this.log.error("DataChannel error on ".concat(i,": ").concat(n.message),Object.assign(Object.assign({},this.logContext),{error:o}))}else this.log.error("Unknown DataChannel error on ".concat(i),Object.assign(Object.assign({},this.logContext),{event:n}))},this.handleBufferedAmountLow=n=>{const i=n.currentTarget.maxRetransmits===0?mr.LOSSY:mr.RELIABLE;this.updateAndEmitDCBufferStatus(i)},this.handleDisconnect=(n,a)=>{if(this._isClosed)return;this.log.warn("".concat(n," disconnected"),this.logContext),this.reconnectAttempts===0&&(this.reconnectStart=Date.now());const i=u=>{this.log.warn("could not recover connection after ".concat(this.reconnectAttempts," attempts, ").concat(u,"ms. giving up"),this.logContext),this.emit(ht.Disconnected),this.close()},o=Date.now()-this.reconnectStart;let c=this.getNextRetryDelay({elapsedMs:o,retryCount:this.reconnectAttempts});if(c===null){i(o);return}n===gE&&(c=0),this.log.debug("reconnecting in ".concat(c,"ms"),this.logContext),this.clearReconnectTimeout(),this.token&&this.regionUrlProvider&&this.regionUrlProvider.updateToken(this.token),this.reconnectTimeout=Ta.setTimeout(()=>this.attemptReconnect(a).finally(()=>this.reconnectTimeout=void 0),c)},this.waitForRestarted=()=>new Promise((n,a)=>{this.pcState===rs.Connected&&n();const i=()=>{this.off(ht.Disconnected,o),n()},o=()=>{this.off(ht.Restarted,i),a()};this.once(ht.Restarted,i),this.once(ht.Disconnected,o)}),this.updateAndEmitDCBufferStatus=n=>{if(n===mr.RELIABLE){const i=this.dataChannelForKind(n);i&&this.reliableMessageBuffer.alignBufferedAmount(i.bufferedAmount)}const a=this.isBufferStatusLow(n);typeof a<"u"&&a!==this.dcBufferStatus.get(n)&&(this.dcBufferStatus.set(n,a),this.emit(ht.DCBufferStatusChanged,a,n))},this.isBufferStatusLow=n=>{const a=this.dataChannelForKind(n);if(a)return a.bufferedAmount<=a.bufferedAmountLowThreshold},this.handleBrowserOnLine=()=>ne(this,void 0,void 0,function*(){!this.url||!(yield fetch(Wm(this.url),{method:"HEAD"}).then(a=>a.ok).catch(()=>!1))||(this.log.info("detected network reconnected"),(this.client.currentState===cn.RECONNECTING||this.isWaitingForNetworkReconnect&&this.client.currentState===cn.CONNECTED)&&(this.clearReconnectTimeout(),this.attemptReconnect(zu.RR_SIGNAL_DISCONNECTED),this.isWaitingForNetworkReconnect=!1))}),this.handleBrowserOffline=()=>ne(this,void 0,void 0,function*(){if(this.url)try{yield Promise.race([fetch(Wm(this.url),{method:"HEAD"}),Ca(4e3).then(()=>Promise.reject())])}catch{window.navigator.onLine===!1&&(this.log.info("detected network interruption"),this.isWaitingForNetworkReconnect=!0)}}),this.log=Vc((r=e.loggerName)!==null&&r!==void 0?r:eo.Engine),this.loggerOptions={loggerName:e.loggerName,loggerContextCb:()=>this.logContext},this.client=new XP(void 0,this.loggerOptions),this.client.signalLatency=this.options.expSignalLatency,this.reconnectPolicy=this.options.reconnectPolicy,this.closingLock=new Wa,this.dataProcessLock=new Wa,this.dcBufferStatus=new Map([[mr.LOSSY,!0],[mr.RELIABLE,!0]]),this.client.onParticipantUpdate=n=>this.emit(ht.ParticipantUpdate,n),this.client.onConnectionQuality=n=>this.emit(ht.ConnectionQualityUpdate,n),this.client.onRoomUpdate=n=>this.emit(ht.RoomUpdate,n),this.client.onSubscriptionError=n=>this.emit(ht.SubscriptionError,n),this.client.onSubscriptionPermissionUpdate=n=>this.emit(ht.SubscriptionPermissionUpdate,n),this.client.onSpeakersChanged=n=>this.emit(ht.SpeakersChanged,n),this.client.onStreamStateUpdate=n=>this.emit(ht.StreamStateChanged,n),this.client.onRequestResponse=n=>this.emit(ht.SignalRequestResponse,n)}get logContext(){var e,r,n,a,i,o;return{room:(r=(e=this.latestJoinResponse)===null||e===void 0?void 0:e.room)===null||r===void 0?void 0:r.name,roomID:(a=(n=this.latestJoinResponse)===null||n===void 0?void 0:n.room)===null||a===void 0?void 0:a.sid,participant:(o=(i=this.latestJoinResponse)===null||i===void 0?void 0:i.participant)===null||o===void 0?void 0:o.identity,pID:this.participantSid}}join(e,r,n,a){return ne(this,arguments,void 0,function(i,o,c,u){var d=this;let f=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;return(function*(){d.url=i,d.token=o,d.signalOpts=c,d.maxJoinAttempts=c.maxRetries;try{d.joinAttempts+=1,d.setupSignalClientCallbacks();const h=yield d.client.join(i,o,c,u,f);return d._isClosed=!1,d.latestJoinResponse=h,d.subscriberPrimary=h.subscriberPrimary,d.pcManager||(yield d.configure(h,!f)),(!d.subscriberPrimary||h.fastPublish)&&d.negotiate().catch(m=>{or.error(m,d.logContext)}),d.registerOnLineListener(),d.clientConfiguration=h.clientConfiguration,d.emit(ht.SignalConnected,h),h}catch(h){if(h instanceof Gt){if(h.reason===ln.ServerUnreachable){if(d.log.warn("Couldn't connect to server, attempt ".concat(d.joinAttempts," of ").concat(d.maxJoinAttempts),d.logContext),d.joinAttempts<d.maxJoinAttempts)return d.join(i,o,c,u,f)}else if(h.reason===ln.ServiceNotFound)return d.log.warn("Initial connection failed: ".concat(h.message," – Retrying")),d.join(i,o,c,u,!0)}throw h}})()})}close(){return ne(this,void 0,void 0,function*(){const e=yield this.closingLock.lock();if(this.isClosed){e();return}try{this._isClosed=!0,this.joinAttempts=0,this.emit(ht.Closing),this.removeAllListeners(),this.deregisterOnLineListener(),this.clearPendingReconnect(),this.cleanupLossyDataStats(),yield this.cleanupPeerConnections(),yield this.cleanupClient()}finally{e()}})}cleanupPeerConnections(){return ne(this,void 0,void 0,function*(){var e;yield(e=this.pcManager)===null||e===void 0?void 0:e.close(),this.pcManager=void 0;const r=n=>{n&&(n.close(),n.onbufferedamountlow=null,n.onclose=null,n.onclosing=null,n.onerror=null,n.onmessage=null,n.onopen=null)};r(this.lossyDC),r(this.lossyDCSub),r(this.reliableDC),r(this.reliableDCSub),this.lossyDC=void 0,this.lossyDCSub=void 0,this.reliableDC=void 0,this.reliableDCSub=void 0,this.reliableMessageBuffer=new jM,this.reliableDataSequence=1,this.reliableReceivedState.clear()})}cleanupLossyDataStats(){this.lossyDataStatByterate=0,this.lossyDataStatCurrentBytes=0,this.lossyDataStatInterval&&(clearInterval(this.lossyDataStatInterval),this.lossyDataStatInterval=void 0),this.lossyDataDropCount=0}cleanupClient(){return ne(this,void 0,void 0,function*(){yield this.client.close(),this.client.resetCallbacks()})}addTrack(e){if(this.pendingTrackResolvers[e.cid])throw new Rc("a track with the same ID has already been published");return new Promise((r,n)=>{const a=setTimeout(()=>{delete this.pendingTrackResolvers[e.cid],n(Gt.timeout("publication of local track timed out, no response from server"))},1e4);this.pendingTrackResolvers[e.cid]={resolve:i=>{clearTimeout(a),r(i)},reject:()=>{clearTimeout(a),n(new Error("Cancelled publication by calling unpublish"))}},this.client.sendAddTrack(e)})}removeTrack(e){if(e.track&&this.pendingTrackResolvers[e.track.id]){const{reject:r}=this.pendingTrackResolvers[e.track.id];r&&r(),delete this.pendingTrackResolvers[e.track.id]}try{return this.pcManager.removeTrack(e),!0}catch(r){this.log.warn("failed to remove track",Object.assign(Object.assign({},this.logContext),{error:r}))}return!1}updateMuteStatus(e,r){this.client.sendMuteTrack(e,r)}get dataSubscriberReadyState(){var e;return(e=this.reliableDCSub)===null||e===void 0?void 0:e.readyState}getConnectedServerAddress(){return ne(this,void 0,void 0,function*(){var e;return(e=this.pcManager)===null||e===void 0?void 0:e.getConnectedAddress()})}setRegionUrlProvider(e){this.regionUrlProvider=e}configure(e,r){return ne(this,void 0,void 0,function*(){var n,a;if(this.pcManager&&this.pcManager.currentState!==Pn.NEW)return;this.participantSid=(n=e.participant)===null||n===void 0?void 0:n.sid;const i=this.makeRTCConfiguration(e);this.pcManager=new ode(i,r?"publisher-only":e.subscriberPrimary?"subscriber-primary":"publisher-primary",this.loggerOptions),this.emit(ht.TransportsCreated,this.pcManager.publisher,this.pcManager.subscriber),this.pcManager.onIceCandidate=(o,c)=>{this.client.sendIceCandidate(o,c)},this.pcManager.onPublisherOffer=(o,c)=>{this.client.sendOffer(o,c)},this.pcManager.onDataChannel=this.handleDataChannel,this.pcManager.onStateChange=(o,c,u)=>ne(this,void 0,void 0,function*(){if(this.log.debug("primary PC state changed ".concat(o),this.logContext),["closed","disconnected","failed"].includes(c)&&(this.publisherConnectionPromise=void 0),o===Pn.CONNECTED){const h=this.pcState===rs.New;this.pcState=rs.Connected,h&&this.emit(ht.Connected,e)}else o===Pn.FAILED&&(this.pcState===rs.Connected||this.pcState===rs.Reconnecting)&&(this.pcState=rs.Disconnected,this.handleDisconnect("peerconnection failed",u==="failed"?zu.RR_SUBSCRIBER_FAILED:zu.RR_PUBLISHER_FAILED));const d=this.client.isDisconnected||this.client.currentState===cn.RECONNECTING,f=[Pn.FAILED,Pn.CLOSING,Pn.CLOSED].includes(o);d&&f&&!this._isClosed&&this.emit(ht.Offline)}),this.pcManager.onTrack=o=>{o.streams.length!==0&&this.emit(ht.MediaTrackAdded,o.track,o.streams[0],o.receiver)},Nde((a=e.serverInfo)===null||a===void 0?void 0:a.protocol)||this.createDataChannels()})}setupSignalClientCallbacks(){this.client.onAnswer=(e,r,n)=>ne(this,void 0,void 0,function*(){this.pcManager&&(this.log.debug("received server answer",Object.assign(Object.assign({},this.logContext),{RTCSdpType:e.type,sdp:e.sdp,midToTrackId:n})),this.midToTrackId=n,yield this.pcManager.setPublisherAnswer(e,r))}),this.client.onTrickle=(e,r)=>{this.pcManager&&(this.log.debug("got ICE candidate from peer",Object.assign(Object.assign({},this.logContext),{candidate:e,target:r})),this.pcManager.addIceCandidate(e,r))},this.client.onOffer=(e,r,n)=>ne(this,void 0,void 0,function*(){if(this.latestRemoteOfferId=r,!this.pcManager)return;this.midToTrackId=n;const a=yield this.pcManager.createSubscriberAnswerFromOffer(e,r);a&&this.client.sendAnswer(a,r)}),this.client.onLocalTrackPublished=e=>{var r;if(this.log.debug("received trackPublishedResponse",Object.assign(Object.assign({},this.logContext),{cid:e.cid,track:(r=e.track)===null||r===void 0?void 0:r.sid})),!this.pendingTrackResolvers[e.cid]){this.log.error("missing track resolver for ".concat(e.cid),Object.assign(Object.assign({},this.logContext),{cid:e.cid}));return}const{resolve:n}=this.pendingTrackResolvers[e.cid];delete this.pendingTrackResolvers[e.cid],n(e.track)},this.client.onLocalTrackUnpublished=e=>{this.emit(ht.LocalTrackUnpublished,e)},this.client.onLocalTrackSubscribed=e=>{this.emit(ht.LocalTrackSubscribed,e)},this.client.onTokenRefresh=e=>{var r;this.token=e,(r=this.regionUrlProvider)===null||r===void 0||r.updateToken(e)},this.client.onRemoteMuteChanged=(e,r)=>{this.emit(ht.RemoteMute,e,r)},this.client.onSubscribedQualityUpdate=e=>{this.emit(ht.SubscribedQualityUpdate,e)},this.client.onRoomMoved=e=>{var r;this.participantSid=(r=e.participant)===null||r===void 0?void 0:r.sid,this.latestJoinResponse&&(this.latestJoinResponse.room=e.room),this.emit(ht.RoomMoved,e)},this.client.onMediaSectionsRequirement=e=>{var r,n;const a={direction:"recvonly"};for(let i=0;i<e.numAudios;i++)(r=this.pcManager)===null||r===void 0||r.addPublisherTransceiverOfKind("audio",a);for(let i=0;i<e.numVideos;i++)(n=this.pcManager)===null||n===void 0||n.addPublisherTransceiverOfKind("video",a);this.negotiate()},this.client.onClose=()=>{this.handleDisconnect("signal",zu.RR_SIGNAL_DISCONNECTED)},this.client.onLeave=e=>{switch(this.log.debug("client leave request",Object.assign(Object.assign({},this.logContext),{reason:e?.reason})),e.regions&&this.regionUrlProvider&&(this.log.debug("updating regions",this.logContext),this.regionUrlProvider.setServerReportedRegions({updatedAtInMs:Date.now(),maxAgeInMs:e4,regionSettings:e.regions})),e.action){case qf.DISCONNECT:this.emit(ht.Disconnected,e?.reason),this.close();break;case qf.RECONNECT:this.fullReconnectOnNext=!0,this.handleDisconnect(gE);break;case qf.RESUME:this.handleDisconnect(gE)}}}makeRTCConfiguration(e){var r;const n=Object.assign({},this.rtcConfig);if(!((r=this.signalOpts)===null||r===void 0)&&r.e2eeEnabled&&(this.log.debug("E2EE - setting up transports with insertable streams",this.logContext),n.encodedInsertableStreams=!0),e.iceServers&&!n.iceServers){const a=[];e.iceServers.forEach(i=>{const o={urls:i.urls};i.username&&(o.username=i.username),i.credential&&(o.credential=i.credential),a.push(o)}),n.iceServers=a}return e.clientConfiguration&&e.clientConfiguration.forceRelay===$m.ENABLED&&(n.iceTransportPolicy="relay"),n.sdpSemantics="unified-plan",n.continualGatheringPolicy="gather_continually",n}createDataChannels(){this.pcManager&&(this.lossyDC&&(this.lossyDC.onmessage=null,this.lossyDC.onerror=null),this.reliableDC&&(this.reliableDC.onmessage=null,this.reliableDC.onerror=null),this.lossyDC=this.pcManager.createPublisherDataChannel(YM,{ordered:!1,maxRetransmits:0}),this.reliableDC=this.pcManager.createPublisherDataChannel(XM,{ordered:!0}),this.lossyDC.onmessage=this.handleDataMessage,this.reliableDC.onmessage=this.handleDataMessage,this.lossyDC.onerror=this.handleDataError,this.reliableDC.onerror=this.handleDataError,this.lossyDC.bufferedAmountLowThreshold=65535,this.reliableDC.bufferedAmountLowThreshold=65535,this.lossyDC.onbufferedamountlow=this.handleBufferedAmountLow,this.reliableDC.onbufferedamountlow=this.handleBufferedAmountLow,this.cleanupLossyDataStats(),this.lossyDataStatInterval=setInterval(()=>{this.lossyDataStatByterate=this.lossyDataStatCurrentBytes,this.lossyDataStatCurrentBytes=0;const e=this.dataChannelForKind(mr.LOSSY);if(e){const r=this.lossyDataStatByterate/10;e.bufferedAmountLowThreshold=Math.min(Math.max(r,Rde),Dde)}},1e3))}createSender(e,r,n){return ne(this,void 0,void 0,function*(){if(vC())return yield this.createTransceiverRTCRtpSender(e,r,n);if(_C())return this.log.warn("using add-track fallback",this.logContext),yield this.createRTCRtpSender(e.mediaStreamTrack);throw new Ln("Required webRTC APIs not supported on this device")})}createSimulcastSender(e,r,n,a){return ne(this,void 0,void 0,function*(){if(vC())return this.createSimulcastTransceiverSender(e,r,n,a);if(_C())return this.log.debug("using add-track fallback",this.logContext),this.createRTCRtpSender(e.mediaStreamTrack);throw new Ln("Cannot stream on this device")})}createTransceiverRTCRtpSender(e,r,n){return ne(this,void 0,void 0,function*(){if(!this.pcManager)throw new Ln("publisher is closed");const a=[];e.mediaStream&&a.push(e.mediaStream),hu(e)&&(e.codec=r.videoCodec);const i={direction:"sendonly",streams:a};return n&&(i.sendEncodings=n),(yield this.pcManager.addPublisherTransceiver(e.mediaStreamTrack,i)).sender})}createSimulcastTransceiverSender(e,r,n,a){return ne(this,void 0,void 0,function*(){if(!this.pcManager)throw new Ln("publisher is closed");const i={direction:"sendonly"};a&&(i.sendEncodings=a);const o=yield this.pcManager.addPublisherTransceiver(r.mediaStreamTrack,i);if(n.videoCodec)return e.setSimulcastTrackSender(n.videoCodec,o.sender),o.sender})}createRTCRtpSender(e){return ne(this,void 0,void 0,function*(){if(!this.pcManager)throw new Ln("publisher is closed");return this.pcManager.addPublisherTrack(e)})}attemptReconnect(e){return ne(this,void 0,void 0,function*(){var r,n,a;if(!this._isClosed){if(this.attemptingReconnect){or.warn("already attempting reconnect, returning early",this.logContext);return}(((r=this.clientConfiguration)===null||r===void 0?void 0:r.resumeConnection)===$m.DISABLED||((a=(n=this.pcManager)===null||n===void 0?void 0:n.currentState)!==null&&a!==void 0?a:Pn.NEW)===Pn.NEW)&&(this.fullReconnectOnNext=!0);try{this.attemptingReconnect=!0,this.fullReconnectOnNext?yield this.restartConnection():yield this.resumeConnection(e),this.clearPendingReconnect(),this.fullReconnectOnNext=!1}catch(i){this.reconnectAttempts+=1;let o=!0;i instanceof Ln?(this.log.debug("received unrecoverable error",Object.assign(Object.assign({},this.logContext),{error:i})),o=!1):i instanceof df||(this.fullReconnectOnNext=!0),o?this.handleDisconnect("reconnect",zu.RR_UNKNOWN):(this.log.info("could not recover connection after ".concat(this.reconnectAttempts," attempts, ").concat(Date.now()-this.reconnectStart,"ms. giving up"),this.logContext),this.emit(ht.Disconnected),yield this.close())}finally{this.attemptingReconnect=!1}}})}getNextRetryDelay(e){try{return this.reconnectPolicy.nextRetryDelayInMs(e)}catch(r){this.log.warn("encountered error in reconnect policy",Object.assign(Object.assign({},this.logContext),{error:r}))}return null}restartConnection(e){return ne(this,void 0,void 0,function*(){var r,n,a;try{if(!this.url||!this.token)throw new Ln("could not reconnect, url or token not saved");this.log.info("reconnecting, attempt: ".concat(this.reconnectAttempts),this.logContext),this.emit(ht.Restarting),this.client.isDisconnected||(yield this.client.sendLeave()),yield this.cleanupPeerConnections(),yield this.cleanupClient();let i;try{if(!this.signalOpts)throw this.log.warn("attempted connection restart, without signal options present",this.logContext),new df;i=yield this.join(e??this.url,this.token,this.signalOpts,void 0,!this.options.singlePeerConnection)}catch(o){throw o instanceof Gt&&o.reason===ln.NotAllowed?new Ln("could not reconnect, token might be expired"):new df}if(this.shouldFailNext)throw this.shouldFailNext=!1,new Error("simulated failure");if(this.client.setReconnected(),this.emit(ht.SignalRestarted,i),yield this.waitForPCReconnected(),this.client.currentState!==cn.CONNECTED)throw new df("Signal connection got severed during reconnect");(r=this.regionUrlProvider)===null||r===void 0||r.resetAttempts(),this.emit(ht.Restarted)}catch(i){const o=yield(n=this.regionUrlProvider)===null||n===void 0?void 0:n.getNextBestRegionUrl();if(o){yield this.restartConnection(o);return}else throw(a=this.regionUrlProvider)===null||a===void 0||a.resetAttempts(),i}})}resumeConnection(e){return ne(this,void 0,void 0,function*(){var r;if(!this.url||!this.token)throw new Ln("could not reconnect, url or token not saved");if(!this.pcManager)throw new Ln("publisher and subscriber connections unset");this.log.info("resuming signal connection, attempt ".concat(this.reconnectAttempts),this.logContext),this.emit(ht.Resuming);let n;try{this.setupSignalClientCallbacks(),n=yield this.client.reconnect(this.url,this.token,this.participantSid,e)}catch(a){let i="";throw a instanceof Error&&(i=a.message,this.log.error(a.message,Object.assign(Object.assign({},this.logContext),{error:a}))),a instanceof Gt&&a.reason===ln.NotAllowed?new Ln("could not reconnect, token might be expired"):a instanceof Gt&&a.reason===ln.LeaveRequest?a:new df(i)}if(this.emit(ht.SignalResumed),n){const a=this.makeRTCConfiguration(n);this.pcManager.updateConfiguration(a),this.latestJoinResponse&&(this.latestJoinResponse.serverInfo=n.serverInfo)}else this.log.warn("Did not receive reconnect response",this.logContext);if(this.shouldFailNext)throw this.shouldFailNext=!1,new Error("simulated failure");if(yield this.pcManager.triggerIceRestart(),yield this.waitForPCReconnected(),this.client.currentState!==cn.CONNECTED)throw new df("Signal connection got severed during reconnect");this.client.setReconnected(),((r=this.reliableDC)===null||r===void 0?void 0:r.readyState)==="open"&&this.reliableDC.id===null&&this.createDataChannels(),n?.lastMessageSeq&&this.resendReliableMessagesForResume(n.lastMessageSeq),this.emit(ht.Resumed)})}waitForPCInitialConnection(e,r){return ne(this,void 0,void 0,function*(){if(!this.pcManager)throw new Ln("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(r,e)})}waitForPCReconnected(){return ne(this,void 0,void 0,function*(){this.pcState=rs.Reconnecting,this.log.debug("waiting for peer connection to reconnect",this.logContext);try{if(yield Ca(Pde),!this.pcManager)throw new Ln("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(void 0,this.peerConnectionTimeout),this.pcState=rs.Connected}catch(e){throw this.pcState=rs.Disconnected,Gt.internal("could not establish PC connection, ".concat(e.message))}})}publishRpcResponse(e,r,n,a){return ne(this,void 0,void 0,function*(){const i=new $a({destinationIdentities:[e],kind:mr.RELIABLE,value:{case:"rpcResponse",value:new UP({requestId:r,value:a?{case:"error",value:a.toProto()}:{case:"payload",value:n??""}})}});yield this.sendDataPacket(i,mr.RELIABLE)})}publishRpcAck(e,r){return ne(this,void 0,void 0,function*(){const n=new $a({destinationIdentities:[e],kind:mr.RELIABLE,value:{case:"rpcAck",value:new BP({requestId:r})}});yield this.sendDataPacket(n,mr.RELIABLE)})}sendDataPacket(e,r){return ne(this,void 0,void 0,function*(){if(yield this.ensurePublisherConnected(r),this.e2eeManager&&this.e2eeManager.isDataChannelEncryptionEnabled){const i=que(e);if(i){const o=yield this.e2eeManager.encryptData(i.toBinary());e.value={case:"encryptedPacket",value:new $5({encryptedValue:o.payload,iv:o.iv,keyIndex:o.keyIndex})}}}r===mr.RELIABLE&&(e.sequence=this.reliableDataSequence,this.reliableDataSequence+=1);const n=e.toBinary(),a=this.dataChannelForKind(r);if(a){if(r===mr.RELIABLE)yield this.waitForBufferStatusLow(r),this.reliableMessageBuffer.push({data:n,sequence:e.sequence});else{if(!this.isBufferStatusLow(r)){this.lossyDataDropCount+=1,this.lossyDataDropCount%100===0&&this.log.warn("dropping lossy data channel messages, total dropped: ".concat(this.lossyDataDropCount),this.logContext);return}this.lossyDataStatCurrentBytes+=n.byteLength}if(this.attemptingReconnect)return;a.send(n)}this.updateAndEmitDCBufferStatus(r)})}resendReliableMessagesForResume(e){return ne(this,void 0,void 0,function*(){yield this.ensurePublisherConnected(mr.RELIABLE);const r=this.dataChannelForKind(mr.RELIABLE);r&&(this.reliableMessageBuffer.popToSequence(e),this.reliableMessageBuffer.getAll().forEach(n=>{r.send(n.data)})),this.updateAndEmitDCBufferStatus(mr.RELIABLE)})}waitForBufferStatusLow(e){return new li((r,n)=>ne(this,void 0,void 0,function*(){if(this.isBufferStatusLow(e))r();else{const a=()=>n(new Ln("engine closed"));for(this.once(ht.Closing,a);!this.dcBufferStatus.get(e);)yield Ca(10);this.off(ht.Closing,a),r()}}))}ensureDataTransportConnected(e){return ne(this,arguments,void 0,function(r){var n=this;let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.subscriberPrimary;return(function*(){var i;if(!n.pcManager)throw new Ln("PC manager is closed");const o=a?n.pcManager.subscriber:n.pcManager.publisher,c=a?"Subscriber":"Publisher";if(!o)throw Gt.internal("".concat(c," connection not set"));let u=!1;!a&&!n.dataChannelForKind(r,a)&&(n.createDataChannels(),u=!0),!u&&!a&&!n.pcManager.publisher.isICEConnected&&n.pcManager.publisher.getICEConnectionState()!=="checking"&&(u=!0),u&&n.negotiate().catch(h=>{or.error(h,n.logContext)});const d=n.dataChannelForKind(r,a);if(d?.readyState==="open")return;const f=new Date().getTime()+n.peerConnectionTimeout;for(;new Date().getTime()<f;){if(o.isICEConnected&&((i=n.dataChannelForKind(r,a))===null||i===void 0?void 0:i.readyState)==="open")return;yield Ca(50)}throw Gt.internal("could not establish ".concat(c," connection, state: ").concat(o.getICEConnectionState()))})()})}ensurePublisherConnected(e){return ne(this,void 0,void 0,function*(){this.publisherConnectionPromise||(this.publisherConnectionPromise=this.ensureDataTransportConnected(e,!1)),yield this.publisherConnectionPromise})}verifyTransport(){return!(!this.pcManager||this.pcManager.currentState!==Pn.CONNECTED||!this.client.ws||this.client.ws.readyState===WebSocket.CLOSED)}negotiate(){return ne(this,void 0,void 0,function*(){return new li((e,r)=>ne(this,void 0,void 0,function*(){if(!this.pcManager){r(new $f("PC manager is closed"));return}this.pcManager.requirePublisher(),this.pcManager.publisher.getTransceivers().length==0&&!this.lossyDC&&!this.reliableDC&&this.createDataChannels();const n=new AbortController,a=()=>{n.abort(),this.log.debug("engine disconnected while negotiation was ongoing",this.logContext),e()};this.isClosed&&r(new $f("cannot negotiate on closed engine")),this.on(ht.Closing,a),this.pcManager.publisher.once(Wf.RTPVideoPayloadTypes,i=>{const o=new Map;i.forEach(c=>{const u=c.codec.toLowerCase();Eue(u)&&o.set(c.payload,u)}),this.emit(ht.RTPVideoMapUpdate,o)});try{yield this.pcManager.negotiate(n),e()}catch(i){i instanceof $f&&(this.fullReconnectOnNext=!0),this.handleDisconnect("negotiation",zu.RR_UNKNOWN),i instanceof Error?r(i):r(new Error(String(i)))}finally{this.off(ht.Closing,a)}}))})}dataChannelForKind(e,r){if(r){if(e===mr.LOSSY)return this.lossyDCSub;if(e===mr.RELIABLE)return this.reliableDCSub}else{if(e===mr.LOSSY)return this.lossyDC;if(e===mr.RELIABLE)return this.reliableDC}}sendSyncState(e,r){var n,a,i,o;if(!this.pcManager){this.log.warn("sync state cannot be sent without peer connection setup",this.logContext);return}const c=this.pcManager.publisher.getLocalDescription(),u=this.pcManager.publisher.getRemoteDescription(),d=(n=this.pcManager.subscriber)===null||n===void 0?void 0:n.getRemoteDescription(),f=(a=this.pcManager.subscriber)===null||a===void 0?void 0:a.getLocalDescription(),h=(o=(i=this.signalOpts)===null||i===void 0?void 0:i.autoSubscribe)!==null&&o!==void 0?o:!0,m=new Array,_=new Array;e.forEach(w=>{w.isDesired!==h&&m.push(w.trackSid),w.isEnabled||_.push(w.trackSid)}),this.client.sendSyncState(new VP({answer:this.pcManager.mode==="publisher-only"?u?xf({sdp:u.sdp,type:u.type}):void 0:f?xf({sdp:f.sdp,type:f.type}):void 0,offer:this.pcManager.mode==="publisher-only"?c?xf({sdp:c.sdp,type:c.type}):void 0:d?xf({sdp:d.sdp,type:d.type}):void 0,subscription:new f0({trackSids:m,subscribe:!h,participantTracks:[]}),publishTracks:oue(r),dataChannels:this.dataChannelsInfo(),trackSidsDisabled:_,datachannelReceiveStates:this.reliableReceivedState.map((w,b)=>new lq({publisherSid:b,lastSeq:w}))}))}failNext(){this.shouldFailNext=!0}dataChannelsInfo(){const e=[],r=(n,a)=>{n?.id!==void 0&&n.id!==null&&e.push(new uq({label:n.label,id:n.id,target:a}))};return r(this.dataChannelForKind(mr.LOSSY),$s.PUBLISHER),r(this.dataChannelForKind(mr.RELIABLE),$s.PUBLISHER),r(this.dataChannelForKind(mr.LOSSY,!0),$s.SUBSCRIBER),r(this.dataChannelForKind(mr.RELIABLE,!0),$s.SUBSCRIBER),e}clearReconnectTimeout(){this.reconnectTimeout&&Ta.clearTimeout(this.reconnectTimeout)}clearPendingReconnect(){this.clearReconnectTimeout(),this.reconnectAttempts=0}registerOnLineListener(){ui()&&(window.addEventListener("online",this.handleBrowserOnLine),window.addEventListener("offline",this.handleBrowserOffline))}deregisterOnLineListener(){ui()&&(window.removeEventListener("online",this.handleBrowserOnLine),window.removeEventListener("offline",this.handleBrowserOffline))}getTrackIdForReceiver(e){var r;const n=(r=this.pcManager)===null||r===void 0?void 0:r.getMidForReceiver(e);if(n){const a=Object.entries(this.midToTrackId).find(i=>{let[o]=i;return o===n});if(a)return a[1]}}}function Nde(t){return t!==void 0&&t>13}function JM(t,e){const r=t.participantIdentity?t.participantIdentity:e.participantIdentity;t.participantIdentity=r,e.participantIdentity=r;const n=t.destinationIdentities.length!==0?t.destinationIdentities:e.destinationIdentities;t.destinationIdentities=n,e.destinationIdentities=n}class i4{get info(){return this._info}validateBytesReceived(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(!(typeof this.totalByteSize!="number"||this.totalByteSize===0)){if(e&&this.bytesReceived<this.totalByteSize)throw new as("Not enough chunk(s) received - expected ".concat(this.totalByteSize," bytes of data total, only received ").concat(this.bytesReceived," bytes"),za.Incomplete);if(this.bytesReceived>this.totalByteSize)throw new as("Extra chunk(s) received - expected ".concat(this.totalByteSize," bytes of data total, received ").concat(this.bytesReceived," bytes"),za.LengthExceeded)}}constructor(e,r,n,a){this.reader=r,this.totalByteSize=n,this._info=e,this.bytesReceived=0,this.outOfBandFailureRejectingFuture=a}}class Ide extends i4{handleChunkReceived(e){var r;this.bytesReceived+=e.content.byteLength,this.validateBytesReceived();const n=this.totalByteSize?this.bytesReceived/this.totalByteSize:void 0;(r=this.onProgress)===null||r===void 0||r.call(this,n)}[Symbol.asyncIterator](){const e=this.reader.getReader();let r=new ds,n=null,a=null;if(this.signal){const o=this.signal;a=()=>{var c;(c=r.reject)===null||c===void 0||c.call(r,o.reason)},o.addEventListener("abort",a),n=o}const i=()=>{e.releaseLock(),n&&a&&n.removeEventListener("abort",a),this.signal=void 0};return{next:()=>ne(this,void 0,void 0,function*(){var o,c;try{const{done:u,value:d}=yield Promise.race([e.read(),r.promise,(c=(o=this.outOfBandFailureRejectingFuture)===null||o===void 0?void 0:o.promise)!==null&&c!==void 0?c:new Promise(()=>{})]);return u?(this.validateBytesReceived(!0),{done:!0,value:void 0}):(this.handleChunkReceived(d),{done:!1,value:d.content})}catch(u){throw i(),u}}),return(){return ne(this,void 0,void 0,function*(){return i(),{done:!0,value:void 0}})}}}withAbortSignal(e){return this.signal=e,this}readAll(){return ne(this,arguments,void 0,function(){var e=this;let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return(function*(){var n,a,i,o;let c=new Set;const u=r.signal?e.withAbortSignal(r.signal):e;try{for(var d=!0,f=Ac(u),h;h=yield f.next(),n=h.done,!n;d=!0){o=h.value,d=!1;const m=o;c.add(m)}}catch(m){a={error:m}}finally{try{!d&&!n&&(i=f.return)&&(yield i.call(f))}finally{if(a)throw a.error}}return Array.from(c)})()})}}class Mde extends i4{constructor(e,r,n,a){super(e,r,n,a),this.receivedChunks=new Map}handleChunkReceived(e){var r;const n=g_(e.chunkIndex),a=this.receivedChunks.get(n);if(a&&a.version>e.version)return;this.receivedChunks.set(n,e),this.bytesReceived+=e.content.byteLength,this.validateBytesReceived();const i=this.totalByteSize?this.bytesReceived/this.totalByteSize:void 0;(r=this.onProgress)===null||r===void 0||r.call(this,i)}[Symbol.asyncIterator](){const e=this.reader.getReader(),r=new TextDecoder("utf-8",{fatal:!0});let n=new ds,a=null,i=null;if(this.signal){const c=this.signal;i=()=>{var u;(u=n.reject)===null||u===void 0||u.call(n,c.reason)},c.addEventListener("abort",i),a=c}const o=()=>{e.releaseLock(),a&&i&&a.removeEventListener("abort",i),this.signal=void 0};return{next:()=>ne(this,void 0,void 0,function*(){var c,u;try{const{done:d,value:f}=yield Promise.race([e.read(),n.promise,(u=(c=this.outOfBandFailureRejectingFuture)===null||c===void 0?void 0:c.promise)!==null&&u!==void 0?u:new Promise(()=>{})]);if(d)return this.validateBytesReceived(!0),{done:!0,value:void 0};{this.handleChunkReceived(f);let h;try{h=r.decode(f.content)}catch(m){throw new as("Cannot decode datastream chunk ".concat(f.chunkIndex," as text: ").concat(m),za.DecodeFailed)}return{done:!1,value:h}}}catch(d){throw o(),d}}),return(){return ne(this,void 0,void 0,function*(){return o(),{done:!0,value:void 0}})}}}withAbortSignal(e){return this.signal=e,this}readAll(){return ne(this,arguments,void 0,function(){var e=this;let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return(function*(){var n,a,i,o;let c="";const u=r.signal?e.withAbortSignal(r.signal):e;try{for(var d=!0,f=Ac(u),h;h=yield f.next(),n=h.done,!n;d=!0)o=h.value,d=!1,c+=o}catch(m){a={error:m}}finally{try{!d&&!n&&(i=f.return)&&(yield i.call(f))}finally{if(a)throw a.error}}return c})()})}}class jde{constructor(){this.log=or,this.byteStreamControllers=new Map,this.textStreamControllers=new Map,this.byteStreamHandlers=new Map,this.textStreamHandlers=new Map}registerTextStreamHandler(e,r){if(this.textStreamHandlers.has(e))throw new as('A text stream handler for topic "'.concat(e,'" has already been set.'),za.HandlerAlreadyRegistered);this.textStreamHandlers.set(e,r)}unregisterTextStreamHandler(e){this.textStreamHandlers.delete(e)}registerByteStreamHandler(e,r){if(this.byteStreamHandlers.has(e))throw new as('A byte stream handler for topic "'.concat(e,'" has already been set.'),za.HandlerAlreadyRegistered);this.byteStreamHandlers.set(e,r)}unregisterByteStreamHandler(e){this.byteStreamHandlers.delete(e)}clearControllers(){this.byteStreamControllers.clear(),this.textStreamControllers.clear()}validateParticipantHasNoActiveDataStreams(e){var r,n,a,i;const o=Array.from(this.textStreamControllers.entries()).filter(u=>u[1].sendingParticipantIdentity===e),c=Array.from(this.byteStreamControllers.entries()).filter(u=>u[1].sendingParticipantIdentity===e);if(o.length>0||c.length>0){const u=new as("Participant ".concat(e," unexpectedly disconnected in the middle of sending data"),za.AbnormalEnd);for(const[d,f]of c)(n=(r=f.outOfBandFailureRejectingFuture).reject)===null||n===void 0||n.call(r,u),this.byteStreamControllers.delete(d);for(const[d,f]of o)(i=(a=f.outOfBandFailureRejectingFuture).reject)===null||i===void 0||i.call(a,u),this.textStreamControllers.delete(d)}}handleDataStreamPacket(e,r){return ne(this,void 0,void 0,function*(){switch(e.value.case){case"streamHeader":return this.handleStreamHeader(e.value.value,e.participantIdentity,r);case"streamChunk":return this.handleStreamChunk(e.value.value,r);case"streamTrailer":return this.handleStreamTrailer(e.value.value,r);default:throw new Error('DataPacket of value "'.concat(e.value.case,'" is not data stream related!'))}})}handleStreamHeader(e,r,n){return ne(this,void 0,void 0,function*(){var a;if(e.contentHeader.case==="byteHeader"){const i=this.byteStreamHandlers.get(e.topic);if(!i){this.log.debug("ignoring incoming byte stream due to no handler for topic",e.topic);return}let o;const c=new ds;c.promise.catch(f=>{this.log.error(f)});const u={id:e.streamId,name:(a=e.contentHeader.value.name)!==null&&a!==void 0?a:"unknown",mimeType:e.mimeType,size:e.totalLength?Number(e.totalLength):void 0,topic:e.topic,timestamp:g_(e.timestamp),attributes:e.attributes,encryptionType:n},d=new ReadableStream({start:f=>{if(o=f,this.textStreamControllers.has(e.streamId))throw new as("A data stream read is already in progress for a stream with id ".concat(e.streamId,"."),za.AlreadyOpened);this.byteStreamControllers.set(e.streamId,{info:u,controller:o,startTime:Date.now(),sendingParticipantIdentity:r,outOfBandFailureRejectingFuture:c})}});i(new Ide(u,d,g_(e.totalLength),c),{identity:r})}else if(e.contentHeader.case==="textHeader"){const i=this.textStreamHandlers.get(e.topic);if(!i){this.log.debug("ignoring incoming text stream due to no handler for topic",e.topic);return}let o;const c=new ds;c.promise.catch(f=>{this.log.error(f)});const u={id:e.streamId,mimeType:e.mimeType,size:e.totalLength?Number(e.totalLength):void 0,topic:e.topic,timestamp:Number(e.timestamp),attributes:e.attributes,encryptionType:n},d=new ReadableStream({start:f=>{if(o=f,this.textStreamControllers.has(e.streamId))throw new as("A data stream read is already in progress for a stream with id ".concat(e.streamId,"."),za.AlreadyOpened);this.textStreamControllers.set(e.streamId,{info:u,controller:o,startTime:Date.now(),sendingParticipantIdentity:r,outOfBandFailureRejectingFuture:c})}});i(new Mde(u,d,g_(e.totalLength),c),{identity:r})}})}handleStreamChunk(e,r){const n=this.byteStreamControllers.get(e.streamId);n&&(n.info.encryptionType!==r?(n.controller.error(new as("Encryption type mismatch for stream ".concat(e.streamId,". Expected ").concat(r,", got ").concat(n.info.encryptionType),za.EncryptionTypeMismatch)),this.byteStreamControllers.delete(e.streamId)):e.content.length>0&&n.controller.enqueue(e));const a=this.textStreamControllers.get(e.streamId);a&&(a.info.encryptionType!==r?(a.controller.error(new as("Encryption type mismatch for stream ".concat(e.streamId,". Expected ").concat(r,", got ").concat(a.info.encryptionType),za.EncryptionTypeMismatch)),this.textStreamControllers.delete(e.streamId)):e.content.length>0&&a.controller.enqueue(e))}handleStreamTrailer(e,r){const n=this.textStreamControllers.get(e.streamId);n&&(n.info.encryptionType!==r?n.controller.error(new as("Encryption type mismatch for stream ".concat(e.streamId,". Expected ").concat(r,", got ").concat(n.info.encryptionType),za.EncryptionTypeMismatch)):(n.info.attributes=Object.assign(Object.assign({},n.info.attributes),e.attributes),n.controller.close(),this.textStreamControllers.delete(e.streamId)));const a=this.byteStreamControllers.get(e.streamId);a&&(a.info.encryptionType!==r?a.controller.error(new as("Encryption type mismatch for stream ".concat(e.streamId,". Expected ").concat(r,", got ").concat(a.info.encryptionType),za.EncryptionTypeMismatch)):(a.info.attributes=Object.assign(Object.assign({},a.info.attributes),e.attributes),a.controller.close()),this.byteStreamControllers.delete(e.streamId))}}class s4{constructor(e,r,n){this.writableStream=e,this.defaultWriter=e.getWriter(),this.onClose=n,this.info=r}write(e){return this.defaultWriter.write(e)}close(){return ne(this,void 0,void 0,function*(){var e;yield this.defaultWriter.close(),this.defaultWriter.releaseLock(),(e=this.onClose)===null||e===void 0||e.call(this)})}}class Lde extends s4{}class Bde extends s4{}const QM=15e3;class Ude{constructor(e,r){this.engine=e,this.log=r}setupEngine(e){this.engine=e}sendText(e,r){return ne(this,void 0,void 0,function*(){var n;const a=crypto.randomUUID(),o=new TextEncoder().encode(e).byteLength,c=(n=r?.attachments)===null||n===void 0?void 0:n.map(()=>crypto.randomUUID()),u=new Array(c?c.length+1:1).fill(0),d=(h,m)=>{var _;u[m]=h;const w=u.reduce((b,E)=>b+E,0);(_=r?.onProgress)===null||_===void 0||_.call(r,w)},f=yield this.streamText({streamId:a,totalSize:o,destinationIdentities:r?.destinationIdentities,topic:r?.topic,attachedStreamIds:c,attributes:r?.attributes});return yield f.write(e),d(1,0),yield f.close(),r?.attachments&&c&&(yield Promise.all(r.attachments.map((h,m)=>ne(this,void 0,void 0,function*(){return this._sendFile(c[m],h,{topic:r.topic,mimeType:h.type,onProgress:_=>{d(_,m+1)}})})))),f.info})}streamText(e){return ne(this,void 0,void 0,function*(){var r,n,a;const i=(r=e?.streamId)!==null&&r!==void 0?r:crypto.randomUUID(),o={id:i,mimeType:"text/plain",timestamp:Date.now(),topic:(n=e?.topic)!==null&&n!==void 0?n:"",size:e?.totalSize,attributes:e?.attributes,encryptionType:!((a=this.engine.e2eeManager)===null||a===void 0)&&a.isDataChannelEncryptionEnabled?aa.GCM:aa.NONE},c=new ob({streamId:i,mimeType:o.mimeType,topic:o.topic,timestamp:$u(o.timestamp),totalLength:$u(e?.totalSize),attributes:o.attributes,contentHeader:{case:"textHeader",value:new tq({version:e?.version,attachedStreamIds:e?.attachedStreamIds,replyToStreamId:e?.replyToStreamId,operationType:e?.type==="update"?aC.UPDATE:aC.CREATE})}}),u=e?.destinationIdentities,d=new $a({destinationIdentities:u,value:{case:"streamHeader",value:c}});yield this.engine.sendDataPacket(d,mr.RELIABLE);let f=0;const h=this.engine,m=new WritableStream({write(b){return ne(this,void 0,void 0,function*(){for(const E of Rue(b,QM)){const T=new cb({content:E,streamId:i,chunkIndex:$u(f)}),D=new $a({destinationIdentities:u,value:{case:"streamChunk",value:T}});yield h.sendDataPacket(D,mr.RELIABLE),f+=1}})},close(){return ne(this,void 0,void 0,function*(){const b=new lb({streamId:i}),E=new $a({destinationIdentities:u,value:{case:"streamTrailer",value:b}});yield h.sendDataPacket(E,mr.RELIABLE)})},abort(b){}});let _=()=>ne(this,void 0,void 0,function*(){yield w.close()});h.once(ht.Closing,_);const w=new Lde(m,o,()=>this.engine.off(ht.Closing,_));return w})}sendFile(e,r){return ne(this,void 0,void 0,function*(){const n=crypto.randomUUID();return yield this._sendFile(n,e,r),{id:n}})}_sendFile(e,r,n){return ne(this,void 0,void 0,function*(){var a;const i=yield this.streamBytes({streamId:e,totalSize:r.size,name:r.name,mimeType:(a=n?.mimeType)!==null&&a!==void 0?a:r.type,topic:n?.topic,destinationIdentities:n?.destinationIdentities}),o=r.stream().getReader();for(;;){const{done:c,value:u}=yield o.read();if(c)break;yield i.write(u)}return yield i.close(),i.info})}streamBytes(e){return ne(this,void 0,void 0,function*(){var r,n,a,i,o,c;const u=(r=e?.streamId)!==null&&r!==void 0?r:crypto.randomUUID(),d=e?.destinationIdentities,f={id:u,mimeType:(n=e?.mimeType)!==null&&n!==void 0?n:"application/octet-stream",topic:(a=e?.topic)!==null&&a!==void 0?a:"",timestamp:Date.now(),attributes:e?.attributes,size:e?.totalSize,name:(i=e?.name)!==null&&i!==void 0?i:"unknown",encryptionType:!((o=this.engine.e2eeManager)===null||o===void 0)&&o.isDataChannelEncryptionEnabled?aa.GCM:aa.NONE},h=new ob({totalLength:$u((c=f.size)!==null&&c!==void 0?c:0),mimeType:f.mimeType,streamId:u,topic:f.topic,timestamp:$u(Date.now()),attributes:f.attributes,contentHeader:{case:"byteHeader",value:new rq({name:f.name})}}),m=new $a({destinationIdentities:d,value:{case:"streamHeader",value:h}});yield this.engine.sendDataPacket(m,mr.RELIABLE);let _=0;const w=new Wa,b=this.engine,E=this.log,T=new WritableStream({write(P){return ne(this,void 0,void 0,function*(){const A=yield w.lock();let C=0;try{for(;C<P.byteLength;){const O=P.slice(C,C+QM),I=new $a({destinationIdentities:d,value:{case:"streamChunk",value:new cb({content:O,streamId:u,chunkIndex:$u(_)})}});yield b.sendDataPacket(I,mr.RELIABLE),_+=1,C+=O.byteLength}}finally{A()}})},close(){return ne(this,void 0,void 0,function*(){const P=new lb({streamId:u}),A=new $a({destinationIdentities:d,value:{case:"streamTrailer",value:P}});yield b.sendDataPacket(A,mr.RELIABLE)})},abort(P){E.error("Sink error:",P)}});return new Bde(T,f)})}}class o4 extends Ke{constructor(e,r,n,a,i){super(e,n,i),this.sid=r,this.receiver=a}get isLocal(){return!1}setMuted(e){this.isMuted!==e&&(this.isMuted=e,this._mediaStreamTrack.enabled=!e,this.emit(e?dt.Muted:dt.Unmuted,this))}setMediaStream(e){this.mediaStream=e;const r=n=>{n.track===this._mediaStreamTrack&&(e.removeEventListener("removetrack",r),this.receiver&&"playoutDelayHint"in this.receiver&&(this.receiver.playoutDelayHint=void 0),this.receiver=void 0,this._currentBitrate=0,this.emit(dt.Ended,this))};e.addEventListener("removetrack",r)}start(){this.startMonitor(),super.enable()}stop(){this.stopMonitor(),super.disable()}getRTCStatsReport(){return ne(this,void 0,void 0,function*(){var e;return!((e=this.receiver)===null||e===void 0)&&e.getStats?yield this.receiver.getStats():void 0})}setPlayoutDelay(e){this.receiver?"playoutDelayHint"in this.receiver?this.receiver.playoutDelayHint=e:this.log.warn("Playout delay not supported in this browser"):this.log.warn("Cannot set playout delay, track already ended")}getPlayoutDelay(){if(this.receiver){if("playoutDelayHint"in this.receiver)return this.receiver.playoutDelayHint;this.log.warn("Playout delay not supported in this browser")}else this.log.warn("Cannot get playout delay, track already ended");return 0}startMonitor(){this.monitorInterval||(this.monitorInterval=setInterval(()=>this.monitorReceiver(),rA)),cue()&&this.registerTimeSyncUpdate()}registerTimeSyncUpdate(){const e=()=>{var r;this.timeSyncHandle=requestAnimationFrame(()=>e());const n=(r=this.receiver)===null||r===void 0?void 0:r.getSynchronizationSources()[0];if(n){const{timestamp:a,rtpTimestamp:i}=n;i&&this.rtpTimestamp!==i&&(this.emit(dt.TimeSyncUpdate,{timestamp:a,rtpTimestamp:i}),this.rtpTimestamp=i)}};e()}}class Fde extends o4{constructor(e,r,n,a,i,o){super(e,r,Ke.Kind.Audio,n,o),this.monitorReceiver=()=>ne(this,void 0,void 0,function*(){if(!this.receiver){this._currentBitrate=0;return}const c=yield this.getReceiverStats();c&&this.prevStats&&this.receiver&&(this._currentBitrate=m0(c,this.prevStats)),this.prevStats=c}),this.audioContext=a,this.webAudioPluginNodes=[],i&&(this.sinkId=i.deviceId)}setVolume(e){var r;for(const n of this.attachedElements)this.audioContext?(r=this.gainNode)===null||r===void 0||r.gain.setTargetAtTime(e,0,.1):n.volume=e;Yo()&&this._mediaStreamTrack._setVolume(e),this.elementVolume=e}getVolume(){if(this.elementVolume)return this.elementVolume;if(Yo())return 1;let e=0;return this.attachedElements.forEach(r=>{r.volume>e&&(e=r.volume)}),e}setSinkId(e){return ne(this,void 0,void 0,function*(){this.sinkId=e,yield Promise.all(this.attachedElements.map(r=>{if(bC(r))return r.setSinkId(e)}))})}attach(e){const r=this.attachedElements.length===0;return e?super.attach(e):e=super.attach(),this.sinkId&&bC(e)&&e.setSinkId(this.sinkId).catch(n=>{this.log.error("Failed to set sink id on remote audio track",n,this.logContext)}),this.audioContext&&r&&(this.log.debug("using audio context mapping",this.logContext),this.connectWebAudio(this.audioContext,e),e.volume=0,e.muted=!0),this.elementVolume&&this.setVolume(this.elementVolume),e}detach(e){let r;return e?(r=super.detach(e),this.audioContext&&(this.attachedElements.length>0?this.connectWebAudio(this.audioContext,this.attachedElements[0]):this.disconnectWebAudio())):(r=super.detach(),this.disconnectWebAudio()),r}setAudioContext(e){this.audioContext=e,e&&this.attachedElements.length>0?this.connectWebAudio(e,this.attachedElements[0]):e||this.disconnectWebAudio()}setWebAudioPlugins(e){this.webAudioPluginNodes=e,this.attachedElements.length>0&&this.audioContext&&this.connectWebAudio(this.audioContext,this.attachedElements[0])}connectWebAudio(e,r){this.disconnectWebAudio(),this.sourceNode=e.createMediaStreamSource(r.srcObject);let n=this.sourceNode;this.webAudioPluginNodes.forEach(a=>{n.connect(a),n=a}),this.gainNode=e.createGain(),n.connect(this.gainNode),this.gainNode.connect(e.destination),this.elementVolume&&this.gainNode.gain.setTargetAtTime(this.elementVolume,0,.1),e.state!=="running"&&e.resume().then(()=>{e.state!=="running"&&this.emit(dt.AudioPlaybackFailed,new Error("Audio Context couldn't be started automatically"))}).catch(a=>{this.emit(dt.AudioPlaybackFailed,a)})}disconnectWebAudio(){var e,r;(e=this.gainNode)===null||e===void 0||e.disconnect(),(r=this.sourceNode)===null||r===void 0||r.disconnect(),this.gainNode=void 0,this.sourceNode=void 0}getReceiverStats(){return ne(this,void 0,void 0,function*(){if(!this.receiver||!this.receiver.getStats)return;const e=yield this.receiver.getStats();let r;return e.forEach(n=>{n.type==="inbound-rtp"&&(r={type:"audio",streamId:n.id,timestamp:n.timestamp,jitter:n.jitter,bytesReceived:n.bytesReceived,concealedSamples:n.concealedSamples,concealmentEvents:n.concealmentEvents,silentConcealedSamples:n.silentConcealedSamples,silentConcealmentEvents:n.silentConcealmentEvents,totalAudioEnergy:n.totalAudioEnergy,totalSamplesDuration:n.totalSamplesDuration})}),r})}}const yE=100;class qde extends o4{constructor(e,r,n,a,i){super(e,r,Ke.Kind.Video,n,i),this.elementInfos=[],this.monitorReceiver=()=>ne(this,void 0,void 0,function*(){if(!this.receiver){this._currentBitrate=0;return}const o=yield this.getReceiverStats();o&&this.prevStats&&this.receiver&&(this._currentBitrate=m0(o,this.prevStats)),this.prevStats=o}),this.debouncedHandleResize=QP(()=>{this.updateDimensions()},yE),this.adaptiveStreamSettings=a}get isAdaptiveStream(){return this.adaptiveStreamSettings!==void 0}setStreamState(e){super.setStreamState(e),this.log.debug("setStreamState",e),this.isAdaptiveStream&&e===Ke.StreamState.Active&&this.updateVisibility()}get mediaStreamTrack(){return this._mediaStreamTrack}setMuted(e){super.setMuted(e),this.attachedElements.forEach(r=>{e?Vf(this._mediaStreamTrack,r):Cf(this._mediaStreamTrack,r)})}attach(e){if(e?super.attach(e):e=super.attach(),this.adaptiveStreamSettings&&this.elementInfos.find(r=>r.element===e)===void 0){const r=new zde(e);this.observeElementInfo(r)}return e}observeElementInfo(e){this.adaptiveStreamSettings&&this.elementInfos.find(r=>r===e)===void 0?(e.handleResize=()=>{this.debouncedHandleResize()},e.handleVisibilityChanged=()=>{this.updateVisibility()},this.elementInfos.push(e),e.observe(),this.debouncedHandleResize(),this.updateVisibility()):this.log.warn("visibility resize observer not triggered",this.logContext)}stopObservingElementInfo(e){if(!this.isAdaptiveStream){this.log.warn("stopObservingElementInfo ignored",this.logContext);return}const r=this.elementInfos.filter(n=>n===e);for(const n of r)n.stopObserving();this.elementInfos=this.elementInfos.filter(n=>n!==e),this.updateVisibility(),this.debouncedHandleResize()}detach(e){let r=[];if(e)return this.stopObservingElement(e),super.detach(e);r=super.detach();for(const n of r)this.stopObservingElement(n);return r}getDecoderImplementation(){var e;return(e=this.prevStats)===null||e===void 0?void 0:e.decoderImplementation}getReceiverStats(){return ne(this,void 0,void 0,function*(){if(!this.receiver||!this.receiver.getStats)return;const e=yield this.receiver.getStats();let r,n="",a=new Map;return e.forEach(i=>{i.type==="inbound-rtp"?(n=i.codecId,r={type:"video",streamId:i.id,framesDecoded:i.framesDecoded,framesDropped:i.framesDropped,framesReceived:i.framesReceived,packetsReceived:i.packetsReceived,packetsLost:i.packetsLost,frameWidth:i.frameWidth,frameHeight:i.frameHeight,pliCount:i.pliCount,firCount:i.firCount,nackCount:i.nackCount,jitter:i.jitter,timestamp:i.timestamp,bytesReceived:i.bytesReceived,decoderImplementation:i.decoderImplementation}):i.type==="codec"&&a.set(i.id,i)}),r&&n!==""&&a.get(n)&&(r.mimeType=a.get(n).mimeType),r})}stopObservingElement(e){const r=this.elementInfos.filter(n=>n.element===e);for(const n of r)this.stopObservingElementInfo(n)}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return ne(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),this.isAdaptiveStream&&this.updateVisibility()})}updateVisibility(e){var r,n;const a=this.elementInfos.reduce((u,d)=>Math.max(u,d.visibilityChangedAt||0),0),i=!((n=(r=this.adaptiveStreamSettings)===null||r===void 0?void 0:r.pauseVideoInBackground)!==null&&n!==void 0)||n?this.isInBackground:!1,o=this.elementInfos.some(u=>u.pictureInPicture),c=this.elementInfos.some(u=>u.visible)&&!i||o;if(!(this.lastVisible===c&&!e)){if(!c&&Date.now()-a<yE){Ta.setTimeout(()=>{this.updateVisibility()},yE);return}this.lastVisible=c,this.emit(dt.VisibilityChanged,c,this)}}updateDimensions(){var e,r;let n=0,a=0;const i=this.getPixelDensity();for(const o of this.elementInfos){const c=o.width()*i,u=o.height()*i;c+u>n+a&&(n=c,a=u)}((e=this.lastDimensions)===null||e===void 0?void 0:e.width)===n&&((r=this.lastDimensions)===null||r===void 0?void 0:r.height)===a||(this.lastDimensions={width:n,height:a},this.emit(dt.VideoDimensionsChanged,this.lastDimensions,this))}getPixelDensity(){var e;const r=(e=this.adaptiveStreamSettings)===null||e===void 0?void 0:e.pixelDensity;return r==="screen"?CM():r||(CM()>2?2:1)}}class zde{get visible(){return this.isPiP||this.isIntersecting}get pictureInPicture(){return this.isPiP}constructor(e,r){this.onVisibilityChanged=n=>{var a;const{target:i,isIntersecting:o}=n;i===this.element&&(this.isIntersecting=o,this.isPiP=Nh(this.element),this.visibilityChangedAt=Date.now(),(a=this.handleVisibilityChanged)===null||a===void 0||a.call(this))},this.onEnterPiP=()=>{var n,a,i;(a=(n=window.documentPictureInPicture)===null||n===void 0?void 0:n.window)===null||a===void 0||a.addEventListener("pagehide",this.onLeavePiP),this.isPiP=Nh(this.element),(i=this.handleVisibilityChanged)===null||i===void 0||i.call(this)},this.onLeavePiP=()=>{var n;this.isPiP=Nh(this.element),(n=this.handleVisibilityChanged)===null||n===void 0||n.call(this)},this.element=e,this.isIntersecting=r??CC(e),this.isPiP=ui()&&Nh(e),this.visibilityChangedAt=0}width(){return this.element.clientWidth}height(){return this.element.clientHeight}observe(){var e,r,n;this.isIntersecting=CC(this.element),this.isPiP=Nh(this.element),this.element.handleResize=()=>{var a;(a=this.handleResize)===null||a===void 0||a.call(this)},this.element.handleVisibilityChanged=this.onVisibilityChanged,PM().observe(this.element),xM().observe(this.element),this.element.addEventListener("enterpictureinpicture",this.onEnterPiP),this.element.addEventListener("leavepictureinpicture",this.onLeavePiP),(e=window.documentPictureInPicture)===null||e===void 0||e.addEventListener("enter",this.onEnterPiP),(n=(r=window.documentPictureInPicture)===null||r===void 0?void 0:r.window)===null||n===void 0||n.addEventListener("pagehide",this.onLeavePiP)}stopObserving(){var e,r,n,a,i;(e=PM())===null||e===void 0||e.unobserve(this.element),(r=xM())===null||r===void 0||r.unobserve(this.element),this.element.removeEventListener("enterpictureinpicture",this.onEnterPiP),this.element.removeEventListener("leavepictureinpicture",this.onLeavePiP),(n=window.documentPictureInPicture)===null||n===void 0||n.removeEventListener("enter",this.onEnterPiP),(i=(a=window.documentPictureInPicture)===null||a===void 0?void 0:a.window)===null||i===void 0||i.removeEventListener("pagehide",this.onLeavePiP)}}function Nh(t){var e,r;return document.pictureInPictureElement===t?!0:!((e=window.documentPictureInPicture)===null||e===void 0)&&e.window?CC(t,(r=window.documentPictureInPicture)===null||r===void 0?void 0:r.window):!1}function CC(t,e){const r=e||window;let n=t.offsetTop,a=t.offsetLeft;const i=t.offsetWidth,o=t.offsetHeight,{hidden:c}=t,{display:u}=getComputedStyle(t);for(;t.offsetParent;)t=t.offsetParent,n+=t.offsetTop,a+=t.offsetLeft;return n<r.pageYOffset+r.innerHeight&&a<r.pageXOffset+r.innerWidth&&n+o>r.pageYOffset&&a+i>r.pageXOffset&&!c&&u!=="none"}class Tc extends Zo.EventEmitter{constructor(e,r,n,a){var i;super(),this.metadataMuted=!1,this.encryption=aa.NONE,this.log=or,this.handleMuted=()=>{this.emit(dt.Muted)},this.handleUnmuted=()=>{this.emit(dt.Unmuted)},this.log=Vc((i=a?.loggerName)!==null&&i!==void 0?i:eo.Publication),this.loggerContextCb=this.loggerContextCb,this.setMaxListeners(100),this.kind=e,this.trackSid=r,this.trackName=n,this.source=Ke.Source.Unknown}setTrack(e){this.track&&(this.track.off(dt.Muted,this.handleMuted),this.track.off(dt.Unmuted,this.handleUnmuted)),this.track=e,e&&(e.on(dt.Muted,this.handleMuted),e.on(dt.Unmuted,this.handleUnmuted))}get logContext(){var e;return Object.assign(Object.assign({},(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this)),vr(this))}get isMuted(){return this.metadataMuted}get isEnabled(){return!0}get isSubscribed(){return this.track!==void 0}get isEncrypted(){return this.encryption!==aa.NONE}get audioTrack(){if(qo(this.track))return this.track}get videoTrack(){if(hu(this.track))return this.track}updateInfo(e){this.trackSid=e.sid,this.trackName=e.name,this.source=Ke.sourceFromProto(e.source),this.mimeType=e.mimeType,this.kind===Ke.Kind.Video&&e.width>0&&(this.dimensions={width:e.width,height:e.height},this.simulcasted=e.simulcast),this.encryption=e.encryption,this.trackInfo=e,this.log.debug("update publication info",Object.assign(Object.assign({},this.logContext),{info:e}))}}(function(t){(function(e){e.Desired="desired",e.Subscribed="subscribed",e.Unsubscribed="unsubscribed"})(t.SubscriptionStatus||(t.SubscriptionStatus={})),(function(e){e.Allowed="allowed",e.NotAllowed="not_allowed"})(t.PermissionStatus||(t.PermissionStatus={}))})(Tc||(Tc={}));class xC extends Tc{get isUpstreamPaused(){var e;return(e=this.track)===null||e===void 0?void 0:e.isUpstreamPaused}constructor(e,r,n,a){super(e,r.sid,r.name,a),this.track=void 0,this.handleTrackEnded=()=>{this.emit(dt.Ended)},this.handleCpuConstrained=()=>{this.track&&hu(this.track)&&this.emit(dt.CpuConstrained,this.track)},this.updateInfo(r),this.setTrack(n)}setTrack(e){this.track&&(this.track.off(dt.Ended,this.handleTrackEnded),this.track.off(dt.CpuConstrained,this.handleCpuConstrained)),super.setTrack(e),e&&(e.on(dt.Ended,this.handleTrackEnded),e.on(dt.CpuConstrained,this.handleCpuConstrained))}get isMuted(){return this.track?this.track.isMuted:super.isMuted}get audioTrack(){return super.audioTrack}get videoTrack(){return super.videoTrack}get isLocal(){return!0}mute(){return ne(this,void 0,void 0,function*(){var e;return(e=this.track)===null||e===void 0?void 0:e.mute()})}unmute(){return ne(this,void 0,void 0,function*(){var e;return(e=this.track)===null||e===void 0?void 0:e.unmute()})}pauseUpstream(){return ne(this,void 0,void 0,function*(){var e;yield(e=this.track)===null||e===void 0?void 0:e.pauseUpstream()})}resumeUpstream(){return ne(this,void 0,void 0,function*(){var e;yield(e=this.track)===null||e===void 0?void 0:e.resumeUpstream()})}getTrackFeatures(){var e;if(qo(this.track)){const r=this.track.getSourceTrackSettings(),n=new Set;return r.autoGainControl&&n.add(da.TF_AUTO_GAIN_CONTROL),r.echoCancellation&&n.add(da.TF_ECHO_CANCELLATION),r.noiseSuppression&&n.add(da.TF_NOISE_SUPPRESSION),r.channelCount&&r.channelCount>1&&n.add(da.TF_STEREO),!((e=this.options)===null||e===void 0)&&e.dtx||n.add(da.TF_NO_DTX),this.track.enhancedNoiseCancellation&&n.add(da.TF_ENHANCED_NOISE_CANCELLATION),Array.from(n.values())}else return[]}}function g0(t,e){return ne(this,void 0,void 0,function*(){t??(t={});let r=!1;const{audioProcessor:n,videoProcessor:a,optionsWithoutProcessor:i}=Wq(t);let o=i.audio,c=i.video;if(n&&typeof i.audio=="object"&&(i.audio.processor=n),a&&typeof i.video=="object"&&(i.video.processor=a),t.audio&&typeof i.audio=="object"&&typeof i.audio.deviceId=="string"){const h=i.audio.deviceId;i.audio.deviceId={exact:h},r=!0,o=Object.assign(Object.assign({},i.audio),{deviceId:{ideal:h}})}if(i.video&&typeof i.video=="object"&&typeof i.video.deviceId=="string"){const h=i.video.deviceId;i.video.deviceId={exact:h},r=!0,c=Object.assign(Object.assign({},i.video),{deviceId:{ideal:h}})}i.audio===!0?i.audio={deviceId:"default"}:typeof i.audio=="object"&&i.audio!==null&&(i.audio=Object.assign(Object.assign({},i.audio),{deviceId:i.audio.deviceId||"default"})),i.video===!0?i.video={deviceId:"default"}:typeof i.video=="object"&&!i.video.deviceId&&(i.video.deviceId="default");const u=Vq(i,Qq,Zq),d=KP(u),f=navigator.mediaDevices.getUserMedia(d);i.audio&&(fa.userMediaPromiseMap.set("audioinput",f),f.catch(()=>fa.userMediaPromiseMap.delete("audioinput"))),i.video&&(fa.userMediaPromiseMap.set("videoinput",f),f.catch(()=>fa.userMediaPromiseMap.delete("videoinput")));try{const h=yield f;return yield Promise.all(h.getTracks().map(m=>ne(this,void 0,void 0,function*(){const _=m.kind==="audio";let w=_?u.audio:u.video;(typeof w=="boolean"||!w)&&(w={});let b;const E=_?d.audio:d.video;typeof E!="boolean"&&(b=E);const T=m.getSettings().deviceId;b?.deviceId&&Hl(b.deviceId)!==T?b.deviceId=T:b||(b={deviceId:T});const D=gde(m,b,e);return D.kind===Ke.Kind.Video?D.source=Ke.Source.Camera:D.kind===Ke.Kind.Audio&&(D.source=Ke.Source.Microphone),D.mediaStream=h,qo(D)&&n?yield D.setProcessor(n):hu(D)&&a&&(yield D.setProcessor(a)),D})))}catch(h){if(!r)throw h;return g0(Object.assign(Object.assign({},t),{audio:o,video:c}),e)}})}function $de(t){return ne(this,void 0,void 0,function*(){return(yield g0({audio:!1,video:!0}))[0]})}function Vde(t){return ne(this,void 0,void 0,function*(){return(yield g0({audio:!0,video:!1}))[0]})}var Ol;(function(t){t.Excellent="excellent",t.Good="good",t.Poor="poor",t.Lost="lost",t.Unknown="unknown"})(Ol||(Ol={}));function Hde(t){switch(t){case Jh.EXCELLENT:return Ol.Excellent;case Jh.GOOD:return Ol.Good;case Jh.POOR:return Ol.Poor;case Jh.LOST:return Ol.Lost;default:return Ol.Unknown}}class c4 extends Zo.EventEmitter{get logContext(){var e,r;return Object.assign({},(r=(e=this.loggerOptions)===null||e===void 0?void 0:e.loggerContextCb)===null||r===void 0?void 0:r.call(e))}get isEncrypted(){return this.trackPublications.size>0&&Array.from(this.trackPublications.values()).every(e=>e.isEncrypted)}get isAgent(){var e;return((e=this.permissions)===null||e===void 0?void 0:e.agent)||this.kind===Vm.AGENT}get isActive(){var e;return((e=this.participantInfo)===null||e===void 0?void 0:e.state)===Ff.ACTIVE}get kind(){return this._kind}get attributes(){return Object.freeze(Object.assign({},this._attributes))}constructor(e,r,n,a,i,o){let c=arguments.length>6&&arguments[6]!==void 0?arguments[6]:Vm.STANDARD;var u;super(),this.audioLevel=0,this.isSpeaking=!1,this._connectionQuality=Ol.Unknown,this.log=or,this.log=Vc((u=o?.loggerName)!==null&&u!==void 0?u:eo.Participant),this.loggerOptions=o,this.setMaxListeners(100),this.sid=e,this.identity=r,this.name=n,this.metadata=a,this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.trackPublications=new Map,this._kind=c,this._attributes=i??{}}getTrackPublications(){return Array.from(this.trackPublications.values())}getTrackPublication(e){for(const[,r]of this.trackPublications)if(r.source===e)return r}getTrackPublicationByName(e){for(const[,r]of this.trackPublications)if(r.trackName===e)return r}waitUntilActive(){return this.isActive?Promise.resolve():this.activeFuture?this.activeFuture.promise:(this.activeFuture=new ds,this.once(yt.Active,()=>{var e,r;(r=(e=this.activeFuture)===null||e===void 0?void 0:e.resolve)===null||r===void 0||r.call(e),this.activeFuture=void 0}),this.activeFuture.promise)}get connectionQuality(){return this._connectionQuality}get isCameraEnabled(){var e;const r=this.getTrackPublication(Ke.Source.Camera);return!(!((e=r?.isMuted)!==null&&e!==void 0)||e)}get isMicrophoneEnabled(){var e;const r=this.getTrackPublication(Ke.Source.Microphone);return!(!((e=r?.isMuted)!==null&&e!==void 0)||e)}get isScreenShareEnabled(){return!!this.getTrackPublication(Ke.Source.ScreenShare)}get isLocal(){return!1}get joinedAt(){return this.participantInfo?new Date(Number.parseInt(this.participantInfo.joinedAt.toString())*1e3):new Date}updateInfo(e){var r;return this.participantInfo&&this.participantInfo.sid===e.sid&&this.participantInfo.version>e.version?!1:(this.identity=e.identity,this.sid=e.sid,this._setName(e.name),this._setMetadata(e.metadata),this._setAttributes(e.attributes),e.state===Ff.ACTIVE&&((r=this.participantInfo)===null||r===void 0?void 0:r.state)!==Ff.ACTIVE&&this.emit(yt.Active),e.permission&&this.setPermissions(e.permission),this.participantInfo=e,!0)}_setMetadata(e){const r=this.metadata!==e,n=this.metadata;this.metadata=e,r&&this.emit(yt.ParticipantMetadataChanged,n)}_setName(e){const r=this.name!==e;this.name=e,r&&this.emit(yt.ParticipantNameChanged,e)}_setAttributes(e){const r=lue(this.attributes,e);this._attributes=e,Object.keys(r).length>0&&this.emit(yt.AttributesChanged,r)}setPermissions(e){var r,n,a,i,o,c;const u=this.permissions,d=e.canPublish!==((r=this.permissions)===null||r===void 0?void 0:r.canPublish)||e.canSubscribe!==((n=this.permissions)===null||n===void 0?void 0:n.canSubscribe)||e.canPublishData!==((a=this.permissions)===null||a===void 0?void 0:a.canPublishData)||e.hidden!==((i=this.permissions)===null||i===void 0?void 0:i.hidden)||e.recorder!==((o=this.permissions)===null||o===void 0?void 0:o.recorder)||e.canPublishSources.length!==this.permissions.canPublishSources.length||e.canPublishSources.some((f,h)=>{var m;return f!==((m=this.permissions)===null||m===void 0?void 0:m.canPublishSources[h])})||e.canSubscribeMetrics!==((c=this.permissions)===null||c===void 0?void 0:c.canSubscribeMetrics);return this.permissions=e,d&&this.emit(yt.ParticipantPermissionsChanged,u),d}setIsSpeaking(e){e!==this.isSpeaking&&(this.isSpeaking=e,e&&(this.lastSpokeAt=new Date),this.emit(yt.IsSpeakingChanged,e))}setConnectionQuality(e){const r=this._connectionQuality;this._connectionQuality=Hde(e),r!==this._connectionQuality&&this.emit(yt.ConnectionQualityChanged,this._connectionQuality)}setDisconnected(){var e,r;this.activeFuture&&((r=(e=this.activeFuture).reject)===null||r===void 0||r.call(e,new Error("Participant disconnected")),this.activeFuture=void 0)}setAudioContext(e){this.audioContext=e,this.audioTrackPublications.forEach(r=>qo(r.track)&&r.track.setAudioContext(e))}addTrackPublication(e){e.on(dt.Muted,()=>{this.emit(yt.TrackMuted,e)}),e.on(dt.Unmuted,()=>{this.emit(yt.TrackUnmuted,e)});const r=e;switch(r.track&&(r.track.sid=e.trackSid),this.trackPublications.set(e.trackSid,e),e.kind){case Ke.Kind.Audio:this.audioTrackPublications.set(e.trackSid,e);break;case Ke.Kind.Video:this.videoTrackPublications.set(e.trackSid,e);break}}}function Gde(t){var e,r,n;if(!t.participantSid&&!t.participantIdentity)throw new Error("Invalid track permission, must provide at least one of participantIdentity and participantSid");return new oq({participantIdentity:(e=t.participantIdentity)!==null&&e!==void 0?e:"",participantSid:(r=t.participantSid)!==null&&r!==void 0?r:"",allTracks:(n=t.allowAll)!==null&&n!==void 0?n:!1,trackSids:t.allowedTrackSids||[]})}class Wde extends c4{constructor(e,r,n,a,i,o){super(e,r,void 0,void 0,void 0,{loggerName:a.loggerName,loggerContextCb:()=>this.engine.logContext}),this.pendingPublishing=new Set,this.pendingPublishPromises=new Map,this.participantTrackPermissions=[],this.allParticipantsAllowedToSubscribe=!0,this.encryptionType=aa.NONE,this.enabledPublishVideoCodecs=[],this.pendingAcks=new Map,this.pendingResponses=new Map,this.handleReconnecting=()=>{this.reconnectFuture||(this.reconnectFuture=new ds)},this.handleReconnected=()=>{var c,u;(u=(c=this.reconnectFuture)===null||c===void 0?void 0:c.resolve)===null||u===void 0||u.call(c),this.reconnectFuture=void 0,this.updateTrackSubscriptionPermissions()},this.handleClosing=()=>{var c,u,d,f,h,m;this.reconnectFuture&&(this.reconnectFuture.promise.catch(_=>this.log.warn(_.message,this.logContext)),(u=(c=this.reconnectFuture)===null||c===void 0?void 0:c.reject)===null||u===void 0||u.call(c,new Error("Got disconnected during reconnection attempt")),this.reconnectFuture=void 0),this.signalConnectedFuture&&((f=(d=this.signalConnectedFuture).reject)===null||f===void 0||f.call(d,new Error("Got disconnected without signal connected")),this.signalConnectedFuture=void 0),(m=(h=this.activeAgentFuture)===null||h===void 0?void 0:h.reject)===null||m===void 0||m.call(h,new Error("Got disconnected without active agent present")),this.activeAgentFuture=void 0,this.firstActiveAgent=void 0},this.handleSignalConnected=c=>{var u,d;c.participant&&this.updateInfo(c.participant),this.signalConnectedFuture||(this.signalConnectedFuture=new ds),(d=(u=this.signalConnectedFuture).resolve)===null||d===void 0||d.call(u)},this.handleSignalRequestResponse=c=>{const{requestId:u,reason:d,message:f}=c,h=this.pendingSignalRequests.get(u);h&&(d!==HP.OK&&h.reject(new kM(f,d)),this.pendingSignalRequests.delete(u))},this.handleDataPacket=c=>{switch(c.value.case){case"rpcResponse":let u=c.value.value,d=null,f=null;u.value.case==="payload"?d=u.value.value:u.value.case==="error"&&(f=Va.fromProto(u.value.value)),this.handleIncomingRpcResponse(u.requestId,d,f);break;case"rpcAck":let h=c.value.value;this.handleIncomingRpcAck(h.requestId);break}},this.updateTrackSubscriptionPermissions=()=>{this.log.debug("updating track subscription permissions",Object.assign(Object.assign({},this.logContext),{allParticipantsAllowed:this.allParticipantsAllowedToSubscribe,participantTrackPermissions:this.participantTrackPermissions})),this.engine.client.sendUpdateSubscriptionPermissions(this.allParticipantsAllowedToSubscribe,this.participantTrackPermissions.map(c=>Gde(c)))},this.onTrackUnmuted=c=>{this.onTrackMuted(c,c.isUpstreamPaused)},this.onTrackMuted=(c,u)=>{if(u===void 0&&(u=!0),!c.sid){this.log.error("could not update mute status for unpublished track",Object.assign(Object.assign({},this.logContext),vr(c)));return}this.engine.updateMuteStatus(c.sid,u)},this.onTrackUpstreamPaused=c=>{this.log.debug("upstream paused",Object.assign(Object.assign({},this.logContext),vr(c))),this.onTrackMuted(c,!0)},this.onTrackUpstreamResumed=c=>{this.log.debug("upstream resumed",Object.assign(Object.assign({},this.logContext),vr(c))),this.onTrackMuted(c,c.isMuted)},this.onTrackFeatureUpdate=c=>{const u=this.audioTrackPublications.get(c.sid);if(!u){this.log.warn("Could not update local audio track settings, missing publication for track ".concat(c.sid),this.logContext);return}this.engine.client.sendUpdateLocalAudioTrack(u.trackSid,u.getTrackFeatures())},this.onTrackCpuConstrained=(c,u)=>{this.log.debug("track cpu constrained",Object.assign(Object.assign({},this.logContext),vr(u))),this.emit(yt.LocalTrackCpuConstrained,c,u)},this.handleSubscribedQualityUpdate=c=>ne(this,void 0,void 0,function*(){var u,d,f,h,m;if(!(!((m=this.roomOptions)===null||m===void 0)&&m.dynacast))return;const _=this.videoTrackPublications.get(c.trackSid);if(!_){this.log.warn("received subscribed quality update for unknown track",Object.assign(Object.assign({},this.logContext),{trackSid:c.trackSid}));return}if(!_.videoTrack)return;const w=yield _.videoTrack.setPublishingCodecs(c.subscribedCodecs);try{for(var b=!0,E=Ac(w),T;T=yield E.next(),u=T.done,!u;b=!0){h=T.value,b=!1;const D=h;aue(D)&&(this.log.debug("publish ".concat(D," for ").concat(_.videoTrack.sid),Object.assign(Object.assign({},this.logContext),vr(_))),yield this.publishAdditionalCodecForTrack(_.videoTrack,D,_.options))}}catch(D){d={error:D}}finally{try{!b&&!u&&(f=E.return)&&(yield f.call(E))}finally{if(d)throw d.error}}}),this.handleLocalTrackUnpublished=c=>{const u=this.trackPublications.get(c.trackSid);if(!u){this.log.warn("received unpublished event for unknown track",Object.assign(Object.assign({},this.logContext),{trackSid:c.trackSid}));return}this.unpublishTrack(u.track)},this.handleTrackEnded=c=>ne(this,void 0,void 0,function*(){if(c.source===Ke.Source.ScreenShare||c.source===Ke.Source.ScreenShareAudio)this.log.debug("unpublishing local track due to TrackEnded",Object.assign(Object.assign({},this.logContext),vr(c))),this.unpublishTrack(c);else if(c.isUserProvided)yield c.mute();else if(Ec(c)||Tl(c))try{if(ui())try{const u=yield navigator?.permissions.query({name:c.source===Ke.Source.Camera?"camera":"microphone"});if(u&&u.state==="denied")throw this.log.warn("user has revoked access to ".concat(c.source),Object.assign(Object.assign({},this.logContext),vr(c))),u.onchange=()=>{u.state!=="denied"&&(c.isMuted||c.restartTrack(),u.onchange=null)},new Error("GetUserMedia Permission denied")}catch{}c.isMuted||(this.log.debug("track ended, attempting to use a different device",Object.assign(Object.assign({},this.logContext),vr(c))),Ec(c)?yield c.restartTrack({deviceId:"default"}):yield c.restartTrack())}catch{this.log.warn("could not restart track, muting instead",Object.assign(Object.assign({},this.logContext),vr(c))),yield c.mute()}}),this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.trackPublications=new Map,this.engine=n,this.roomOptions=a,this.setupEngine(n),this.activeDeviceMap=new Map([["audioinput","default"],["videoinput","default"],["audiooutput","default"]]),this.pendingSignalRequests=new Map,this.rpcHandlers=i,this.roomOutgoingDataStreamManager=o}get lastCameraError(){return this.cameraError}get lastMicrophoneError(){return this.microphoneError}get isE2EEEnabled(){return this.encryptionType!==aa.NONE}getTrackPublication(e){const r=super.getTrackPublication(e);if(r)return r}getTrackPublicationByName(e){const r=super.getTrackPublicationByName(e);if(r)return r}setupEngine(e){var r;this.engine=e,this.engine.on(ht.RemoteMute,(n,a)=>{const i=this.trackPublications.get(n);!i||!i.track||(a?i.mute():i.unmute())}),!((r=this.signalConnectedFuture)===null||r===void 0)&&r.isResolved&&(this.signalConnectedFuture=void 0),this.engine.on(ht.Connected,this.handleReconnected).on(ht.SignalConnected,this.handleSignalConnected).on(ht.SignalRestarted,this.handleReconnected).on(ht.SignalResumed,this.handleReconnected).on(ht.Restarting,this.handleReconnecting).on(ht.Resuming,this.handleReconnecting).on(ht.LocalTrackUnpublished,this.handleLocalTrackUnpublished).on(ht.SubscribedQualityUpdate,this.handleSubscribedQualityUpdate).on(ht.Closing,this.handleClosing).on(ht.SignalRequestResponse,this.handleSignalRequestResponse).on(ht.DataPacketReceived,this.handleDataPacket)}setMetadata(e){return ne(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({metadata:e})})}setName(e){return ne(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({name:e})})}setAttributes(e){return ne(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({attributes:e})})}requestMetadataUpdate(e){return ne(this,arguments,void 0,function(r){var n=this;let{metadata:a,name:i,attributes:o}=r;return(function*(){return new li((c,u)=>ne(n,void 0,void 0,function*(){var d,f;try{let h=!1;const m=yield this.engine.client.sendUpdateLocalMetadata((d=a??this.metadata)!==null&&d!==void 0?d:"",(f=i??this.name)!==null&&f!==void 0?f:"",o),_=performance.now();for(this.pendingSignalRequests.set(m,{resolve:c,reject:w=>{u(w),h=!0},values:{name:i,metadata:a,attributes:o}});performance.now()-_<5e3&&!h;){if((!i||this.name===i)&&(!a||this.metadata===a)&&(!o||Object.entries(o).every(w=>{let[b,E]=w;return this.attributes[b]===E||E===""&&!this.attributes[b]}))){this.pendingSignalRequests.delete(m),c();return}yield Ca(50)}u(new kM("Request to update local metadata timed out","TimeoutError"))}catch(h){h instanceof Error?u(h):u(new Error(String(h)))}}))})()})}setCameraEnabled(e,r,n){return this.setTrackEnabled(Ke.Source.Camera,e,r,n)}setMicrophoneEnabled(e,r,n){return this.setTrackEnabled(Ke.Source.Microphone,e,r,n)}setScreenShareEnabled(e,r,n){return this.setTrackEnabled(Ke.Source.ScreenShare,e,r,n)}setE2EEEnabled(e){return ne(this,void 0,void 0,function*(){this.encryptionType=e?aa.GCM:aa.NONE,yield this.republishAllTracks(void 0,!1)})}setTrackEnabled(e,r,n,a){return ne(this,void 0,void 0,function*(){var i,o;this.log.debug("setTrackEnabled",Object.assign(Object.assign({},this.logContext),{source:e,enabled:r})),this.republishPromise&&(yield this.republishPromise);let c=this.getTrackPublication(e);if(r)if(c)yield c.unmute();else{let u;if(this.pendingPublishing.has(e)){const d=yield this.waitForPendingPublicationOfSource(e);return d||this.log.info("waiting for pending publication promise timed out",Object.assign(Object.assign({},this.logContext),{source:e})),yield d?.unmute(),d}this.pendingPublishing.add(e);try{switch(e){case Ke.Source.Camera:u=yield this.createTracks({video:(i=n)!==null&&i!==void 0?i:!0});break;case Ke.Source.Microphone:u=yield this.createTracks({audio:(o=n)!==null&&o!==void 0?o:!0});break;case Ke.Source.ScreenShare:u=yield this.createScreenTracks(Object.assign({},n));break;default:throw new Rc(e)}}catch(d){throw u?.forEach(f=>{f.stop()}),d instanceof Error&&this.emit(yt.MediaDevicesError,d,yC(e)),this.pendingPublishing.delete(e),d}for(const d of u){const f=Object.assign(Object.assign({},this.roomOptions.publishDefaults),n);e===Ke.Source.Microphone&&qo(d)&&f.preConnectBuffer&&(this.log.info("starting preconnect buffer for microphone",Object.assign({},this.logContext)),d.startPreConnectBuffer())}try{const d=[];for(const h of u)this.log.info("publishing track",Object.assign(Object.assign({},this.logContext),vr(h))),d.push(this.publishTrack(h,a));[c]=yield Promise.all(d)}catch(d){throw u?.forEach(f=>{f.stop()}),d}finally{this.pendingPublishing.delete(e)}}else if(!c?.track&&this.pendingPublishing.has(e)&&(c=yield this.waitForPendingPublicationOfSource(e),c||this.log.info("waiting for pending publication promise timed out",Object.assign(Object.assign({},this.logContext),{source:e}))),c&&c.track)if(e===Ke.Source.ScreenShare){c=yield this.unpublishTrack(c.track);const u=this.getTrackPublication(Ke.Source.ScreenShareAudio);u&&u.track&&this.unpublishTrack(u.track)}else yield c.mute();return c})}enableCameraAndMicrophone(){return ne(this,void 0,void 0,function*(){if(!(this.pendingPublishing.has(Ke.Source.Camera)||this.pendingPublishing.has(Ke.Source.Microphone))){this.pendingPublishing.add(Ke.Source.Camera),this.pendingPublishing.add(Ke.Source.Microphone);try{const e=yield this.createTracks({audio:!0,video:!0});yield Promise.all(e.map(r=>this.publishTrack(r)))}finally{this.pendingPublishing.delete(Ke.Source.Camera),this.pendingPublishing.delete(Ke.Source.Microphone)}}})}createTracks(e){return ne(this,void 0,void 0,function*(){var r,n;e??(e={});const a=Vq(e,(r=this.roomOptions)===null||r===void 0?void 0:r.audioCaptureDefaults,(n=this.roomOptions)===null||n===void 0?void 0:n.videoCaptureDefaults);try{return(yield g0(a,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext})).map(c=>(qo(c)&&(this.microphoneError=void 0,c.setAudioContext(this.audioContext),c.source=Ke.Source.Microphone,this.emit(yt.AudioStreamAcquired)),hu(c)&&(this.cameraError=void 0,c.source=Ke.Source.Camera),c))}catch(i){throw i instanceof Error&&(e.audio&&(this.microphoneError=i),e.video&&(this.cameraError=i)),i}})}createScreenTracks(e){return ne(this,void 0,void 0,function*(){if(e===void 0&&(e={}),navigator.mediaDevices.getDisplayMedia===void 0)throw new GP("getDisplayMedia not supported");e.resolution===void 0&&!vue()&&(e.resolution=WP.h1080fps30.resolution);const r=sue(e),n=yield navigator.mediaDevices.getDisplayMedia(r),a=n.getVideoTracks();if(a.length===0)throw new Rc("no video track found");const i=new fb(a[0],void 0,!1,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});i.source=Ke.Source.ScreenShare,e.contentHint&&(i.mediaStreamTrack.contentHint=e.contentHint);const o=[i];if(n.getAudioTracks().length>0){this.emit(yt.AudioStreamAcquired);const c=new db(n.getAudioTracks()[0],void 0,!1,this.audioContext,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});c.source=Ke.Source.ScreenShareAudio,o.push(c)}return o})}publishTrack(e,r){return ne(this,void 0,void 0,function*(){return this.publishOrRepublishTrack(e,r)})}publishOrRepublishTrack(e,r){return ne(this,arguments,void 0,function(n,a){var i=this;let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return(function*(){var c,u,d,f;Ec(n)&&n.setAudioContext(i.audioContext),yield(c=i.reconnectFuture)===null||c===void 0?void 0:c.promise,i.republishPromise&&!o&&(yield i.republishPromise),Hf(n)&&i.pendingPublishPromises.has(n)&&(yield i.pendingPublishPromises.get(n));let h;if(n instanceof MediaStreamTrack)h=n.getConstraints();else{h=n.constraints;let T;switch(n.source){case Ke.Source.Microphone:T="audioinput";break;case Ke.Source.Camera:T="videoinput"}T&&i.activeDeviceMap.has(T)&&(h=Object.assign(Object.assign({},h),{deviceId:i.activeDeviceMap.get(T)}))}if(n instanceof MediaStreamTrack)switch(n.kind){case"audio":n=new db(n,h,!0,i.audioContext,{loggerName:i.roomOptions.loggerName,loggerContextCb:()=>i.logContext});break;case"video":n=new fb(n,h,!0,{loggerName:i.roomOptions.loggerName,loggerContextCb:()=>i.logContext});break;default:throw new Rc("unsupported MediaStreamTrack kind ".concat(n.kind))}else n.updateLoggerOptions({loggerName:i.roomOptions.loggerName,loggerContextCb:()=>i.logContext});let m;if(i.trackPublications.forEach(T=>{T.track&&T.track===n&&(m=T)}),m)return i.log.warn("track has already been published, skipping",Object.assign(Object.assign({},i.logContext),vr(m))),m;const _=Object.assign(Object.assign({},i.roomOptions.publishDefaults),a),w="channelCount"in n.mediaStreamTrack.getSettings()&&n.mediaStreamTrack.getSettings().channelCount===2||n.mediaStreamTrack.getConstraints().channelCount===2,b=(u=_.forceStereo)!==null&&u!==void 0?u:w;b&&(_.dtx===void 0&&i.log.info("Opus DTX will be disabled for stereo tracks by default. Enable them explicitly to make it work.",Object.assign(Object.assign({},i.logContext),vr(n))),_.red===void 0&&i.log.info("Opus RED will be disabled for stereo tracks by default. Enable them explicitly to make it work."),(d=_.dtx)!==null&&d!==void 0||(_.dtx=!1),(f=_.red)!==null&&f!==void 0||(_.red=!1)),!bue()&&i.roomOptions.e2ee&&(i.log.info("End-to-end encryption is set up, simulcast publishing will be disabled on Safari versions and iOS browsers running iOS < v17.2",Object.assign({},i.logContext)),_.simulcast=!1),_.source&&(n.source=_.source);const E=new Promise((T,D)=>ne(i,void 0,void 0,function*(){try{if(this.engine.client.currentState!==cn.CONNECTED){this.log.debug("deferring track publication until signal is connected",Object.assign(Object.assign({},this.logContext),{track:vr(n)}));let P=!1;const A=setTimeout(()=>{P=!0,n.stop(),D(new bM("publishing rejected as engine not connected within timeout",408))},15e3);if(yield this.waitUntilEngineConnected(),clearTimeout(A),P)return;const C=yield this.publish(n,_,b);T(C)}else try{const P=yield this.publish(n,_,b);T(P)}catch(P){D(P)}}catch(P){D(P)}}));i.pendingPublishPromises.set(n,E);try{return yield E}catch(T){throw T}finally{i.pendingPublishPromises.delete(n)}})()})}waitUntilEngineConnected(){return this.signalConnectedFuture||(this.signalConnectedFuture=new ds),this.signalConnectedFuture.promise}hasPermissionsToPublish(e){if(!this.permissions)return this.log.warn("no permissions present for publishing track",Object.assign(Object.assign({},this.logContext),vr(e))),!1;const{canPublish:r,canPublishSources:n}=this.permissions;return r&&(n.length===0||n.map(a=>uue(a)).includes(e.source))?!0:(this.log.warn("insufficient permissions to publish",Object.assign(Object.assign({},this.logContext),vr(e))),!1)}publish(e,r,n){return ne(this,void 0,void 0,function*(){var a,i,o,c,u,d,f,h,m,_;if(!this.hasPermissionsToPublish(e))throw new bM("failed to publish track, insufficient permissions",403);Array.from(this.trackPublications.values()).find(R=>Hf(e)&&R.source===e.source)&&e.source!==Ke.Source.Unknown&&this.log.info("publishing a second track with the same source: ".concat(e.source),Object.assign(Object.assign({},this.logContext),vr(e))),r.stopMicTrackOnMute&&qo(e)&&(e.stopOnMute=!0),e.source===Ke.Source.ScreenShare&&pd()&&(r.simulcast=!1),r.videoCodec==="av1"&&!mue()&&(r.videoCodec=void 0),r.videoCodec==="vp9"&&!gue()&&(r.videoCodec=void 0),r.videoCodec===void 0&&(r.videoCodec=SC),this.enabledPublishVideoCodecs.length>0&&(this.enabledPublishVideoCodecs.some(R=>r.videoCodec===mm(R.mime))||(r.videoCodec=mm(this.enabledPublishVideoCodecs[0].mime)));const b=r.videoCodec;e.on(dt.Muted,this.onTrackMuted),e.on(dt.Unmuted,this.onTrackUnmuted),e.on(dt.Ended,this.handleTrackEnded),e.on(dt.UpstreamPaused,this.onTrackUpstreamPaused),e.on(dt.UpstreamResumed,this.onTrackUpstreamResumed),e.on(dt.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate);const E=[],T=!(!((a=r.dtx)!==null&&a!==void 0)||a),D=e.getSourceTrackSettings();D.autoGainControl&&E.push(da.TF_AUTO_GAIN_CONTROL),D.echoCancellation&&E.push(da.TF_ECHO_CANCELLATION),D.noiseSuppression&&E.push(da.TF_NOISE_SUPPRESSION),D.channelCount&&D.channelCount>1&&E.push(da.TF_STEREO),T&&E.push(da.TF_NO_DTX),Ec(e)&&e.hasPreConnectBuffer&&E.push(da.TF_PRECONNECT_BUFFER);const P=new Hm({cid:e.mediaStreamTrack.id,name:r.name,type:Ke.kindToProto(e.kind),muted:e.isMuted,source:Ke.sourceToProto(e.source),disableDtx:T,encryption:this.encryptionType,stereo:n,disableRed:this.isE2EEEnabled||!(!((i=r.red)!==null&&i!==void 0)||i),stream:r?.stream,backupCodecPolicy:r?.backupCodecPolicy,audioFeatures:E});let A;if(e.kind===Ke.Kind.Video){let R={width:0,height:0};try{R=yield e.waitForDimensions()}catch{const L=(c=(o=this.roomOptions.videoCaptureDefaults)===null||o===void 0?void 0:o.resolution)!==null&&c!==void 0?c:up.h720.resolution;R={width:L.width,height:L.height},this.log.error("could not determine track dimensions, using defaults",Object.assign(Object.assign(Object.assign({},this.logContext),vr(e)),{dims:R}))}P.width=R.width,P.height=R.height,Tl(e)&&(Vs(b)&&(e.source===Ke.Source.ScreenShare&&(r.scalabilityMode="L1T3","contentHint"in e.mediaStreamTrack&&(e.mediaStreamTrack.contentHint="motion",this.log.info("forcing contentHint to motion for screenshare with SVC codecs",Object.assign(Object.assign({},this.logContext),vr(e))))),r.scalabilityMode=(u=r.scalabilityMode)!==null&&u!==void 0?u:"L3T3_KEY"),P.simulcastCodecs=[new sC({codec:b,cid:e.mediaStreamTrack.id})],r.backupCodec===!0&&(r.backupCodec={codec:SC}),r.backupCodec&&b!==r.backupCodec.codec&&P.encryption===aa.NONE&&(this.roomOptions.dynacast||(this.roomOptions.dynacast=!0),P.simulcastCodecs.push(new sC({codec:r.backupCodec.codec,cid:""})))),A=TC(e.source===Ke.Source.ScreenShare,P.width,P.height,r),P.layers=KM(P.width,P.height,A,Vs(r.videoCodec))}else e.kind===Ke.Kind.Audio&&(A=[{maxBitrate:(d=r.audioPreset)===null||d===void 0?void 0:d.maxBitrate,priority:(h=(f=r.audioPreset)===null||f===void 0?void 0:f.priority)!==null&&h!==void 0?h:"high",networkPriority:(_=(m=r.audioPreset)===null||m===void 0?void 0:m.priority)!==null&&_!==void 0?_:"high"}]);if(!this.engine||this.engine.isClosed)throw new Ln("cannot publish track when not connected");const C=()=>ne(this,void 0,void 0,function*(){var R,N,L;if(!this.engine.pcManager)throw new Ln("pcManager is not ready");if(e.sender=yield this.engine.createSender(e,r,A),this.emit(yt.LocalSenderCreated,e.sender,e),Tl(e)&&((R=r.degradationPreference)!==null&&R!==void 0||(r.degradationPreference=Cde(e)),e.setDegradationPreference(r.degradationPreference)),A)if(pd()&&e.kind===Ke.Kind.Audio){let j;for(const q of this.engine.pcManager.publisher.getTransceivers())if(q.sender===e.sender){j=q;break}j&&this.engine.pcManager.publisher.setTrackCodecBitrate({transceiver:j,codec:"opus",maxbr:!((N=A[0])===null||N===void 0)&&N.maxBitrate?A[0].maxBitrate/1e3:0})}else e.codec&&Vs(e.codec)&&(!((L=A[0])===null||L===void 0)&&L.maxBitrate)&&this.engine.pcManager.publisher.setTrackCodecBitrate({cid:P.cid,codec:e.codec,maxbr:A[0].maxBitrate/1e3});yield this.engine.negotiate()});let O;const I=new Promise((R,N)=>ne(this,void 0,void 0,function*(){var L;try{O=yield this.engine.addTrack(P),R(O)}catch(j){e.sender&&(!((L=this.engine.pcManager)===null||L===void 0)&&L.publisher)&&(this.engine.pcManager.publisher.removeTrack(e.sender),yield this.engine.negotiate().catch(q=>{this.log.error("failed to negotiate after removing track due to failed add track request",Object.assign(Object.assign(Object.assign({},this.logContext),vr(e)),{error:q}))})),N(j)}}));if(this.enabledPublishVideoCodecs.length>0)O=(yield Promise.all([I,C()]))[0];else{O=yield I;let R;if(O.codecs.forEach(N=>{R===void 0&&(R=N.mimeType)}),R&&e.kind===Ke.Kind.Video){const N=mm(R);N!==b&&(this.log.debug("falling back to server selected codec",Object.assign(Object.assign(Object.assign({},this.logContext),vr(e)),{codec:N})),r.videoCodec=N,A=TC(e.source===Ke.Source.ScreenShare,P.width,P.height,r))}yield C()}const x=new xC(e.kind,O,e,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});if(x.on(dt.CpuConstrained,R=>this.onTrackCpuConstrained(R,x)),x.options=r,e.sid=O.sid,this.log.debug("publishing ".concat(e.kind," with encodings"),Object.assign(Object.assign({},this.logContext),{encodings:A,trackInfo:O})),Tl(e)?e.startMonitor(this.engine.client):Ec(e)&&e.startMonitor(),this.addTrackPublication(x),this.emit(yt.LocalTrackPublished,x),Ec(e)&&O.audioFeatures.includes(da.TF_PRECONNECT_BUFFER)){const R=e.getPreConnectBuffer(),N=e.getPreConnectBufferMimeType();this.on(yt.LocalTrackSubscribed,L=>{if(L.trackSid===O.sid){if(!e.hasPreConnectBuffer){this.log.warn("subscribe event came to late, buffer already closed",this.logContext);return}this.log.debug("finished recording preconnect buffer",Object.assign(Object.assign({},this.logContext),vr(e))),e.stopPreConnectBuffer()}}),R&&new Promise((j,q)=>ne(this,void 0,void 0,function*(){var U,W,F,Y,Q,ie;try{this.log.debug("waiting for agent",Object.assign(Object.assign({},this.logContext),vr(e)));const ae=setTimeout(()=>{q(new Error("agent not active within 10 seconds"))},1e4),te=yield this.waitUntilActiveAgentPresent();clearTimeout(ae),this.log.debug("sending preconnect buffer",Object.assign(Object.assign({},this.logContext),vr(e)));const me=yield this.streamBytes({name:"preconnect-buffer",mimeType:N,topic:"lk.agent.pre-connect-audio-buffer",destinationIdentities:[te.identity],attributes:{trackId:x.trackSid,sampleRate:String((Q=D.sampleRate)!==null&&Q!==void 0?Q:"48000"),channels:String((ie=D.channelCount)!==null&&ie!==void 0?ie:"1")}});try{for(var G=!0,B=Ac(R),K;K=yield B.next(),U=K.done,!U;G=!0){Y=K.value,G=!1;const ue=Y;yield me.write(ue)}}catch(ue){W={error:ue}}finally{try{!G&&!U&&(F=B.return)&&(yield F.call(B))}finally{if(W)throw W.error}}yield me.close(),j()}catch(ae){q(ae)}})).then(()=>{this.log.debug("preconnect buffer sent successfully",Object.assign(Object.assign({},this.logContext),vr(e)))}).catch(j=>{this.log.error("error sending preconnect buffer",Object.assign(Object.assign(Object.assign({},this.logContext),vr(e)),{error:j}))})}return x})}get isLocal(){return!0}publishAdditionalCodecForTrack(e,r,n){return ne(this,void 0,void 0,function*(){var a;if(this.encryptionType!==aa.NONE)return;let i;if(this.trackPublications.forEach(_=>{_.track&&_.track===e&&(i=_)}),!i)throw new Rc("track is not published");if(!Tl(e))throw new Rc("track is not a video track");const o=Object.assign(Object.assign({},(a=this.roomOptions)===null||a===void 0?void 0:a.publishDefaults),n),c=Sde(e,r,o);if(!c){this.log.info("backup codec has been disabled, ignoring request to add additional codec for track",Object.assign(Object.assign({},this.logContext),vr(e)));return}const u=e.addSimulcastTrack(r,c);if(!u)return;const d=new Hm({cid:u.mediaStreamTrack.id,type:Ke.kindToProto(e.kind),muted:e.isMuted,source:Ke.sourceToProto(e.source),sid:e.sid,simulcastCodecs:[{codec:o.videoCodec,cid:u.mediaStreamTrack.id}]});if(d.layers=KM(d.width,d.height,c),!this.engine||this.engine.isClosed)throw new Ln("cannot publish track when not connected");const f=()=>ne(this,void 0,void 0,function*(){yield this.engine.createSimulcastSender(e,u,o,c),yield this.engine.negotiate()}),m=(yield Promise.all([this.engine.addTrack(d),f()]))[0];this.log.debug("published ".concat(r," for track ").concat(e.sid),Object.assign(Object.assign({},this.logContext),{encodings:c,trackInfo:m}))})}unpublishTrack(e,r){return ne(this,void 0,void 0,function*(){var n,a;if(Hf(e)){const d=this.pendingPublishPromises.get(e);d&&(this.log.info("awaiting publish promise before attempting to unpublish",Object.assign(Object.assign({},this.logContext),vr(e))),yield d)}const i=this.getPublicationForTrack(e),o=i?vr(i):void 0;if(this.log.debug("unpublishing track",Object.assign(Object.assign({},this.logContext),o)),!i||!i.track){this.log.warn("track was not unpublished because no publication was found",Object.assign(Object.assign({},this.logContext),o));return}e=i.track,e.off(dt.Muted,this.onTrackMuted),e.off(dt.Unmuted,this.onTrackUnmuted),e.off(dt.Ended,this.handleTrackEnded),e.off(dt.UpstreamPaused,this.onTrackUpstreamPaused),e.off(dt.UpstreamResumed,this.onTrackUpstreamResumed),e.off(dt.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate),r===void 0&&(r=(a=(n=this.roomOptions)===null||n===void 0?void 0:n.stopLocalTrackOnUnpublish)!==null&&a!==void 0?a:!0),r?e.stop():e.stopMonitor();let c=!1;const u=e.sender;if(e.sender=void 0,this.engine.pcManager&&this.engine.pcManager.currentState<Pn.FAILED&&u)try{for(const d of this.engine.pcManager.publisher.getTransceivers())d.sender===u&&(d.direction="inactive",c=!0);if(this.engine.removeTrack(u)&&(c=!0),Tl(e)){for(const[,d]of e.simulcastCodecs)d.sender&&(this.engine.removeTrack(d.sender)&&(c=!0),d.sender=void 0);e.simulcastCodecs.clear()}}catch(d){this.log.warn("failed to unpublish track",Object.assign(Object.assign(Object.assign({},this.logContext),o),{error:d}))}switch(this.trackPublications.delete(i.trackSid),i.kind){case Ke.Kind.Audio:this.audioTrackPublications.delete(i.trackSid);break;case Ke.Kind.Video:this.videoTrackPublications.delete(i.trackSid);break}return this.emit(yt.LocalTrackUnpublished,i),i.setTrack(void 0),c&&(yield this.engine.negotiate()),i})}unpublishTracks(e){return ne(this,void 0,void 0,function*(){return(yield Promise.all(e.map(n=>this.unpublishTrack(n)))).filter(n=>!!n)})}republishAllTracks(e){return ne(this,arguments,void 0,function(r){var n=this;let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return(function*(){n.republishPromise&&(yield n.republishPromise),n.republishPromise=new li((i,o)=>ne(n,void 0,void 0,function*(){try{const c=[];this.trackPublications.forEach(u=>{u.track&&(r&&(u.options=Object.assign(Object.assign({},u.options),r)),c.push(u))}),yield Promise.all(c.map(u=>ne(this,void 0,void 0,function*(){const d=u.track;yield this.unpublishTrack(d,!1),a&&!d.isMuted&&d.source!==Ke.Source.ScreenShare&&d.source!==Ke.Source.ScreenShareAudio&&(Ec(d)||Tl(d))&&!d.isUserProvided&&(this.log.debug("restarting existing track",Object.assign(Object.assign({},this.logContext),{track:u.trackSid})),yield d.restartTrack()),yield this.publishOrRepublishTrack(d,u.options,!0)}))),i()}catch(c){c instanceof Error?o(c):o(new Error(String(c)))}finally{this.republishPromise=void 0}})),yield n.republishPromise})()})}publishData(e){return ne(this,arguments,void 0,function(r){var n=this;let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return(function*(){const i=a.reliable?mr.RELIABLE:mr.LOSSY,o=a.destinationIdentities,c=a.topic;let u=new jP({participantIdentity:n.identity,payload:r,destinationIdentities:o,topic:c});const d=new $a({kind:i,value:{case:"user",value:u}});yield n.engine.sendDataPacket(d,i)})()})}publishDtmf(e,r){return ne(this,void 0,void 0,function*(){const n=new $a({kind:mr.RELIABLE,value:{case:"sipDtmf",value:new G5({code:e,digit:r})}});yield this.engine.sendDataPacket(n,mr.RELIABLE)})}sendChatMessage(e,r){return ne(this,void 0,void 0,function*(){const n={id:crypto.randomUUID(),message:e,timestamp:Date.now(),attachedFiles:r?.attachments},a=new $a({value:{case:"chatMessage",value:new sb(Object.assign(Object.assign({},n),{timestamp:kn.parse(n.timestamp)}))}});return yield this.engine.sendDataPacket(a,mr.RELIABLE),this.emit(yt.ChatMessage,n),n})}editChatMessage(e,r){return ne(this,void 0,void 0,function*(){const n=Object.assign(Object.assign({},r),{message:e,editTimestamp:Date.now()}),a=new $a({value:{case:"chatMessage",value:new sb(Object.assign(Object.assign({},n),{timestamp:kn.parse(n.timestamp),editTimestamp:kn.parse(n.editTimestamp)}))}});return yield this.engine.sendDataPacket(a,mr.RELIABLE),this.emit(yt.ChatMessage,n),n})}sendText(e,r){return ne(this,void 0,void 0,function*(){return this.roomOutgoingDataStreamManager.sendText(e,r)})}streamText(e){return ne(this,void 0,void 0,function*(){return this.roomOutgoingDataStreamManager.streamText(e)})}sendFile(e,r){return ne(this,void 0,void 0,function*(){return this.roomOutgoingDataStreamManager.sendFile(e,r)})}streamBytes(e){return ne(this,void 0,void 0,function*(){return this.roomOutgoingDataStreamManager.streamBytes(e)})}performRpc(e){let{destinationIdentity:r,method:n,payload:a,responseTimeout:i=15e3}=e;const o=7e3,c=o+1e3;return new li((u,d)=>ne(this,void 0,void 0,function*(){var f,h,m,_;if(tA(a)>t4){d(Va.builtIn("REQUEST_PAYLOAD_TOO_LARGE"));return}if(!((h=(f=this.engine.latestJoinResponse)===null||f===void 0?void 0:f.serverInfo)===null||h===void 0)&&h.version&&Xo((_=(m=this.engine.latestJoinResponse)===null||m===void 0?void 0:m.serverInfo)===null||_===void 0?void 0:_.version,"1.8.0")<0){d(Va.builtIn("UNSUPPORTED_SERVER"));return}const w=Math.max(i,c),b=crypto.randomUUID();yield this.publishRpcRequest(r,b,n,a,w);const E=setTimeout(()=>{this.pendingAcks.delete(b),d(Va.builtIn("CONNECTION_TIMEOUT")),this.pendingResponses.delete(b),clearTimeout(T)},o);this.pendingAcks.set(b,{resolve:()=>{clearTimeout(E)},participantIdentity:r});const T=setTimeout(()=>{this.pendingResponses.delete(b),d(Va.builtIn("RESPONSE_TIMEOUT"))},i);this.pendingResponses.set(b,{resolve:(D,P)=>{clearTimeout(T),this.pendingAcks.has(b)&&(this.log.warn("RPC response received before ack",b),this.pendingAcks.delete(b),clearTimeout(E)),P?d(P):u(D??"")},participantIdentity:r})}))}registerRpcMethod(e,r){this.rpcHandlers.has(e)&&this.log.warn("you're overriding the RPC handler for method ".concat(e,", in the future this will throw an error")),this.rpcHandlers.set(e,r)}unregisterRpcMethod(e){this.rpcHandlers.delete(e)}setTrackSubscriptionPermissions(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];this.participantTrackPermissions=r,this.allParticipantsAllowedToSubscribe=e,this.engine.client.isDisconnected||this.updateTrackSubscriptionPermissions()}handleIncomingRpcAck(e){const r=this.pendingAcks.get(e);r&&(r.resolve(),this.pendingAcks.delete(e))}handleIncomingRpcResponse(e,r,n){const a=this.pendingResponses.get(e);a&&(a.resolve(r,n),this.pendingResponses.delete(e))}publishRpcRequest(e,r,n,a,i){return ne(this,void 0,void 0,function*(){const o=new $a({destinationIdentities:[e],kind:mr.RELIABLE,value:{case:"rpcRequest",value:new LP({id:r,method:n,payload:a,responseTimeoutMs:i,version:1})}});yield this.engine.sendDataPacket(o,mr.RELIABLE)})}handleParticipantDisconnected(e){for(const[r,{participantIdentity:n}]of this.pendingAcks)n===e&&this.pendingAcks.delete(r);for(const[r,{participantIdentity:n,resolve:a}]of this.pendingResponses)n===e&&(a(null,Va.builtIn("RECIPIENT_DISCONNECTED")),this.pendingResponses.delete(r))}setEnabledPublishCodecs(e){this.enabledPublishVideoCodecs=e.filter(r=>r.mime.split("/")[0].toLowerCase()==="video")}updateInfo(e){return super.updateInfo(e)?(e.tracks.forEach(r=>{var n,a;const i=this.trackPublications.get(r.sid);if(i){const o=i.isMuted||((a=(n=i.track)===null||n===void 0?void 0:n.isUpstreamPaused)!==null&&a!==void 0?a:!1);o!==r.muted&&(this.log.debug("updating server mute state after reconcile",Object.assign(Object.assign(Object.assign({},this.logContext),vr(i)),{mutedOnServer:o})),this.engine.client.sendMuteTrack(r.sid,o))}}),!0):!1}setActiveAgent(e){var r,n,a,i;this.firstActiveAgent=e,e&&!this.firstActiveAgent&&(this.firstActiveAgent=e),e?(n=(r=this.activeAgentFuture)===null||r===void 0?void 0:r.resolve)===null||n===void 0||n.call(r,e):(i=(a=this.activeAgentFuture)===null||a===void 0?void 0:a.reject)===null||i===void 0||i.call(a,new Error("Agent disconnected")),this.activeAgentFuture=void 0}waitUntilActiveAgentPresent(){return this.firstActiveAgent?Promise.resolve(this.firstActiveAgent):(this.activeAgentFuture||(this.activeAgentFuture=new ds),this.activeAgentFuture.promise)}getPublicationForTrack(e){let r;return this.trackPublications.forEach(n=>{const a=n.track;a&&(e instanceof MediaStreamTrack?(Ec(a)||Tl(a))&&a.mediaStreamTrack===e&&(r=n):e===a&&(r=n))}),r}waitForPendingPublicationOfSource(e){return ne(this,void 0,void 0,function*(){const n=Date.now();for(;Date.now()<n+1e4;){const a=Array.from(this.pendingPublishPromises.entries()).find(i=>{let[o]=i;return o.source===e});if(a)return a[1];yield Ca(20)}})}}class Kde extends Tc{constructor(e,r,n,a){super(e,r.sid,r.name,a),this.track=void 0,this.allowed=!0,this.requestedDisabled=void 0,this.visible=!0,this.handleEnded=i=>{this.setTrack(void 0),this.emit(dt.Ended,i)},this.handleVisibilityChange=i=>{this.log.debug("adaptivestream video visibility ".concat(this.trackSid,", visible=").concat(i),this.logContext),this.visible=i,this.emitTrackUpdate()},this.handleVideoDimensionsChange=i=>{this.log.debug("adaptivestream video dimensions ".concat(i.width,"x").concat(i.height),this.logContext),this.videoDimensionsAdaptiveStream=i,this.emitTrackUpdate()},this.subscribed=n,this.updateInfo(r)}setSubscribed(e){const r=this.subscriptionStatus,n=this.permissionStatus;this.subscribed=e,e&&(this.allowed=!0);const a=new f0({trackSids:[this.trackSid],subscribe:this.subscribed,participantTracks:[new K5({participantSid:"",trackSids:[this.trackSid]})]});this.emit(dt.UpdateSubscription,a),this.emitSubscriptionUpdateIfChanged(r),this.emitPermissionUpdateIfChanged(n)}get subscriptionStatus(){return this.subscribed===!1?Tc.SubscriptionStatus.Unsubscribed:super.isSubscribed?Tc.SubscriptionStatus.Subscribed:Tc.SubscriptionStatus.Desired}get permissionStatus(){return this.allowed?Tc.PermissionStatus.Allowed:Tc.PermissionStatus.NotAllowed}get isSubscribed(){return this.subscribed===!1?!1:super.isSubscribed}get isDesired(){return this.subscribed!==!1}get isEnabled(){return this.requestedDisabled!==void 0?!this.requestedDisabled:this.isAdaptiveStream?this.visible:!0}get isLocal(){return!1}setEnabled(e){!this.isManualOperationAllowed()||this.requestedDisabled===!e||(this.requestedDisabled=!e,this.emitTrackUpdate())}setVideoQuality(e){!this.isManualOperationAllowed()||this.requestedMaxQuality===e||(this.requestedMaxQuality=e,this.requestedVideoDimensions=void 0,this.emitTrackUpdate())}setVideoDimensions(e){var r,n;this.isManualOperationAllowed()&&(((r=this.requestedVideoDimensions)===null||r===void 0?void 0:r.width)===e.width&&((n=this.requestedVideoDimensions)===null||n===void 0?void 0:n.height)===e.height||(uE(this.track)&&(this.requestedVideoDimensions=e),this.requestedMaxQuality=void 0,this.emitTrackUpdate()))}setVideoFPS(e){this.isManualOperationAllowed()&&uE(this.track)&&this.fps!==e&&(this.fps=e,this.emitTrackUpdate())}get videoQuality(){var e;return(e=this.requestedMaxQuality)!==null&&e!==void 0?e:Ii.HIGH}setTrack(e){const r=this.subscriptionStatus,n=this.permissionStatus,a=this.track;a!==e&&(a&&(a.off(dt.VideoDimensionsChanged,this.handleVideoDimensionsChange),a.off(dt.VisibilityChanged,this.handleVisibilityChange),a.off(dt.Ended,this.handleEnded),a.detach(),a.stopMonitor(),this.emit(dt.Unsubscribed,a)),super.setTrack(e),e&&(e.sid=this.trackSid,e.on(dt.VideoDimensionsChanged,this.handleVideoDimensionsChange),e.on(dt.VisibilityChanged,this.handleVisibilityChange),e.on(dt.Ended,this.handleEnded),this.emit(dt.Subscribed,e)),this.emitPermissionUpdateIfChanged(n),this.emitSubscriptionUpdateIfChanged(r))}setAllowed(e){const r=this.subscriptionStatus,n=this.permissionStatus;this.allowed=e,this.emitPermissionUpdateIfChanged(n),this.emitSubscriptionUpdateIfChanged(r)}setSubscriptionError(e){this.emit(dt.SubscriptionFailed,e)}updateInfo(e){super.updateInfo(e);const r=this.metadataMuted;this.metadataMuted=e.muted,this.track?this.track.setMuted(e.muted):r!==e.muted&&this.emit(e.muted?dt.Muted:dt.Unmuted)}emitSubscriptionUpdateIfChanged(e){const r=this.subscriptionStatus;e!==r&&this.emit(dt.SubscriptionStatusChanged,r,e)}emitPermissionUpdateIfChanged(e){this.permissionStatus!==e&&this.emit(dt.SubscriptionPermissionChanged,this.permissionStatus,e)}isManualOperationAllowed(){return this.isDesired?!0:(this.log.warn("cannot update track settings when not subscribed",this.logContext),!1)}get isAdaptiveStream(){return uE(this.track)&&this.track.isAdaptiveStream}emitTrackUpdate(){const e=new nq({trackSids:[this.trackSid],disabled:!this.isEnabled,fps:this.fps});if(this.kind===Ke.Kind.Video){let r=this.requestedVideoDimensions;if(this.videoDimensionsAdaptiveStream!==void 0)if(r)SM(this.videoDimensionsAdaptiveStream,r)&&(this.log.debug("using adaptive stream dimensions instead of requested",Object.assign(Object.assign({},this.logContext),this.videoDimensionsAdaptiveStream)),r=this.videoDimensionsAdaptiveStream);else if(this.requestedMaxQuality!==void 0&&this.trackInfo){const n=due(this.trackInfo,this.requestedMaxQuality);n&&SM(this.videoDimensionsAdaptiveStream,n)&&(this.log.debug("using adaptive stream dimensions instead of max quality layer",Object.assign(Object.assign({},this.logContext),this.videoDimensionsAdaptiveStream)),r=this.videoDimensionsAdaptiveStream)}else this.log.debug("using adaptive stream dimensions",Object.assign(Object.assign({},this.logContext),this.videoDimensionsAdaptiveStream)),r=this.videoDimensionsAdaptiveStream;r?(e.width=Math.ceil(r.width),e.height=Math.ceil(r.height)):this.requestedMaxQuality!==void 0?(this.log.debug("using requested max quality",Object.assign(Object.assign({},this.logContext),{quality:this.requestedMaxQuality})),e.quality=this.requestedMaxQuality):(this.log.debug("using default quality",Object.assign(Object.assign({},this.logContext),{quality:Ii.HIGH})),e.quality=Ii.HIGH)}this.emit(dt.UpdateSettings,e)}}class pb extends c4{static fromParticipantInfo(e,r,n){return new pb(e,r.sid,r.identity,r.name,r.metadata,r.attributes,n,r.kind)}get logContext(){return Object.assign(Object.assign({},super.logContext),{rpID:this.sid,remoteParticipant:this.identity})}constructor(e,r,n,a,i,o,c){let u=arguments.length>7&&arguments[7]!==void 0?arguments[7]:Vm.STANDARD;super(r,n||"",a,i,o,c,u),this.signalClient=e,this.trackPublications=new Map,this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.volumeMap=new Map}addTrackPublication(e){super.addTrackPublication(e),e.on(dt.UpdateSettings,r=>{this.log.debug("send update settings",Object.assign(Object.assign(Object.assign({},this.logContext),vr(e)),{settings:r})),this.signalClient.sendUpdateTrackSettings(r)}),e.on(dt.UpdateSubscription,r=>{r.participantTracks.forEach(n=>{n.participantSid=this.sid}),this.signalClient.sendUpdateSubscription(r)}),e.on(dt.SubscriptionPermissionChanged,r=>{this.emit(yt.TrackSubscriptionPermissionChanged,e,r)}),e.on(dt.SubscriptionStatusChanged,r=>{this.emit(yt.TrackSubscriptionStatusChanged,e,r)}),e.on(dt.Subscribed,r=>{this.emit(yt.TrackSubscribed,r,e)}),e.on(dt.Unsubscribed,r=>{this.emit(yt.TrackUnsubscribed,r,e)}),e.on(dt.SubscriptionFailed,r=>{this.emit(yt.TrackSubscriptionFailed,e.trackSid,r)})}getTrackPublication(e){const r=super.getTrackPublication(e);if(r)return r}getTrackPublicationByName(e){const r=super.getTrackPublicationByName(e);if(r)return r}setVolume(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ke.Source.Microphone;this.volumeMap.set(r,e);const n=this.getTrackPublication(r);n&&n.track&&n.track.setVolume(e)}getVolume(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ke.Source.Microphone;const r=this.getTrackPublication(e);return r&&r.track?r.track.getVolume():this.volumeMap.get(e)}addSubscribedMediaTrack(e,r,n,a,i,o){let c=this.getTrackPublicationBySid(r);if(c||r.startsWith("TR")||this.trackPublications.forEach(f=>{!c&&e.kind===f.kind.toString()&&(c=f)}),!c){if(o===0){this.log.error("could not find published track",Object.assign(Object.assign({},this.logContext),{trackSid:r})),this.emit(yt.TrackSubscriptionFailed,r);return}o===void 0&&(o=20),setTimeout(()=>{this.addSubscribedMediaTrack(e,r,n,a,i,o-1)},150);return}if(e.readyState==="ended"){this.log.error("unable to subscribe because MediaStreamTrack is ended. Do not call MediaStreamTrack.stop()",Object.assign(Object.assign({},this.logContext),vr(c))),this.emit(yt.TrackSubscriptionFailed,r);return}const u=e.kind==="video";let d;return u?d=new qde(e,r,a,i):d=new Fde(e,r,a,this.audioContext,this.audioOutput),d.source=c.source,d.isMuted=c.isMuted,d.setMediaStream(n),d.start(),c.setTrack(d),this.volumeMap.has(c.source)&&kC(d)&&qo(d)&&d.setVolume(this.volumeMap.get(c.source)),c}get hasMetadata(){return!!this.participantInfo}getTrackPublicationBySid(e){return this.trackPublications.get(e)}updateInfo(e){if(!super.updateInfo(e))return!1;const r=new Map,n=new Map;return e.tracks.forEach(a=>{var i,o;let c=this.getTrackPublicationBySid(a.sid);if(c)c.updateInfo(a);else{const u=Ke.kindFromProto(a.type);if(!u)return;c=new Kde(u,a,(i=this.signalClient.connectOptions)===null||i===void 0?void 0:i.autoSubscribe,{loggerContextCb:()=>this.logContext,loggerName:(o=this.loggerOptions)===null||o===void 0?void 0:o.loggerName}),c.updateInfo(a),n.set(a.sid,c);const d=Array.from(this.trackPublications.values()).find(f=>f.source===c?.source);d&&c.source!==Ke.Source.Unknown&&this.log.debug("received a second track publication for ".concat(this.identity," with the same source: ").concat(c.source),Object.assign(Object.assign({},this.logContext),{oldTrack:vr(d),newTrack:vr(c)})),this.addTrackPublication(c)}r.set(a.sid,c)}),this.trackPublications.forEach(a=>{r.has(a.trackSid)||(this.log.trace("detected removed track on remote participant, unpublishing",Object.assign(Object.assign({},this.logContext),vr(a))),this.unpublishTrack(a.trackSid,!0))}),n.forEach(a=>{this.emit(yt.TrackPublished,a)}),!0}unpublishTrack(e,r){const n=this.trackPublications.get(e);if(!n)return;const{track:a}=n;switch(a&&(a.stop(),n.setTrack(void 0)),this.trackPublications.delete(e),n.kind){case Ke.Kind.Audio:this.audioTrackPublications.delete(e);break;case Ke.Kind.Video:this.videoTrackPublications.delete(e);break}r&&this.emit(yt.TrackUnpublished,n)}setAudioOutput(e){return ne(this,void 0,void 0,function*(){this.audioOutput=e;const r=[];this.audioTrackPublications.forEach(n=>{var a;qo(n.track)&&kC(n.track)&&r.push(n.track.setSinkId((a=e.deviceId)!==null&&a!==void 0?a:"default"))}),yield Promise.all(r)})}emit(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];return this.log.trace("participant event",Object.assign(Object.assign({},this.logContext),{event:e,args:n})),super.emit(e,...n)}}var Mr;(function(t){t.Disconnected="disconnected",t.Connecting="connecting",t.Connected="connected",t.Reconnecting="reconnecting",t.SignalReconnecting="signalReconnecting"})(Mr||(Mr={}));const Yde=4*1e3;class fp extends Zo.EventEmitter{get hasE2EESetup(){return this.e2eeManager!==void 0}constructor(e){var r,n,a,i,o;if(super(),r=this,this.state=Mr.Disconnected,this.activeSpeakers=[],this.isE2EEEnabled=!1,this.audioEnabled=!0,this.isVideoPlaybackBlocked=!1,this.log=or,this.bufferedEvents=[],this.isResuming=!1,this.rpcHandlers=new Map,this.connect=(c,u,d)=>ne(this,void 0,void 0,function*(){var f;if(!yue())throw Yo()?Error("WebRTC isn't detected, have you called registerGlobals?"):Error("LiveKit doesn't seem to be supported on this browser. Try to update your browser and make sure no browser extensions are disabling webRTC.");const h=yield this.disconnectLock.lock();if(this.state===Mr.Connected)return this.log.info("already connected to room ".concat(this.name),this.logContext),h(),Promise.resolve();if(this.connectFuture)return h(),this.connectFuture.promise;this.setAndEmitConnectionState(Mr.Connecting),((f=this.regionUrlProvider)===null||f===void 0?void 0:f.getServerUrl().toString())!==Jq(c)&&(this.regionUrl=void 0,this.regionUrlProvider=void 0),dp(new URL(c))&&(this.regionUrlProvider===void 0?this.regionUrlProvider=new Rr(c,u):this.regionUrlProvider.updateToken(u),this.regionUrlProvider.fetchRegionSettings().then(w=>{var b;(b=this.regionUrlProvider)===null||b===void 0||b.setServerReportedRegions(w)}).catch(w=>{this.log.warn("could not fetch region settings",Object.assign(Object.assign({},this.logContext),{error:w}))}));const m=(w,b,E)=>ne(this,void 0,void 0,function*(){var T,D;this.abortController&&this.abortController.abort();const P=new AbortController;this.abortController=P,h?.();try{if(yield Gf.getInstance().getBackOffPromise(c),P.signal.aborted)throw Gt.cancelled("Connection attempt aborted");yield this.attemptConnection(E??c,u,d,P),this.abortController=void 0,w()}catch(A){if(this.regionUrlProvider&&A instanceof Gt&&A.reason!==ln.Cancelled&&A.reason!==ln.NotAllowed){let C=null;try{this.log.debug("Fetching next region"),C=yield this.regionUrlProvider.getNextBestRegionUrl((T=this.abortController)===null||T===void 0?void 0:T.signal)}catch(O){if(O instanceof Gt&&(O.status===401||O.reason===ln.Cancelled)){this.handleDisconnect(this.options.stopLocalTrackOnUnpublish),b(O);return}}[ln.InternalError,ln.ServerUnreachable,ln.Timeout].includes(A.reason)&&(this.log.debug("Adding failed connection attempt to back off"),Gf.getInstance().addFailedConnectionAttempt(c)),C&&!(!((D=this.abortController)===null||D===void 0)&&D.signal.aborted)?(this.log.info("Initial connection failed with ConnectionError: ".concat(A.message,". Retrying with another region: ").concat(C),this.logContext),this.recreateEngine(),yield m(w,b,C)):(this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,RM(A)),b(A))}else{let C=Ws.UNKNOWN_REASON;A instanceof Gt&&(C=RM(A)),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,C),b(A)}}}),_=this.regionUrl;return this.regionUrl=void 0,this.connectFuture=new ds((w,b)=>{m(w,b,_)},()=>{this.clearConnectionFutures()}),this.connectFuture.promise}),this.connectSignal=(c,u,d,f,h,m)=>ne(this,void 0,void 0,function*(){var _,w,b;const E=yield d.join(c,u,{autoSubscribe:f.autoSubscribe,adaptiveStream:typeof h.adaptiveStream=="object"?!0:h.adaptiveStream,maxRetries:f.maxRetries,e2eeEnabled:!!this.e2eeManager,websocketTimeout:f.websocketTimeout},m.signal,!h.singlePeerConnection);let T=E.serverInfo;if(T||(T={version:E.serverVersion,region:E.serverRegion}),this.serverInfo=T,this.log.debug("connected to Livekit Server ".concat(Object.entries(T).map(D=>{let[P,A]=D;return"".concat(P,": ").concat(A)}).join(", ")),{room:(_=E.room)===null||_===void 0?void 0:_.name,roomSid:(w=E.room)===null||w===void 0?void 0:w.sid,identity:(b=E.participant)===null||b===void 0?void 0:b.identity}),!T.version)throw new Zle("unknown server version");return T.version==="0.15.1"&&this.options.dynacast&&(this.log.debug("disabling dynacast due to server version",this.logContext),h.dynacast=!1),E}),this.applyJoinResponse=c=>{const u=c.participant;if(this.localParticipant.sid=u.sid,this.localParticipant.identity=u.identity,this.localParticipant.setEnabledPublishCodecs(c.enabledPublishCodecs),this.e2eeManager)try{this.e2eeManager.setSifTrailer(c.sifTrailer)}catch(d){this.log.error(d instanceof Error?d.message:"Could not set SifTrailer",Object.assign(Object.assign({},this.logContext),{error:d}))}this.handleParticipantUpdates([u,...c.otherParticipants]),c.room&&this.handleRoomUpdate(c.room)},this.attemptConnection=(c,u,d,f)=>ne(this,void 0,void 0,function*(){var h,m;this.state===Mr.Reconnecting||this.isResuming||!((h=this.engine)===null||h===void 0)&&h.pendingReconnect?(this.log.info("Reconnection attempt replaced by new connection attempt",this.logContext),this.recreateEngine()):this.maybeCreateEngine(),!((m=this.regionUrlProvider)===null||m===void 0)&&m.isCloud()&&this.engine.setRegionUrlProvider(this.regionUrlProvider),this.acquireAudioContext(),this.connOptions=Object.assign(Object.assign({},eA),d),this.connOptions.rtcConfig&&(this.engine.rtcConfig=this.connOptions.rtcConfig),this.connOptions.peerConnectionTimeout&&(this.engine.peerConnectionTimeout=this.connOptions.peerConnectionTimeout);try{const _=yield this.connectSignal(c,u,this.engine,this.connOptions,this.options,f);this.applyJoinResponse(_),this.setupLocalParticipantEvents(),this.emit(tt.SignalConnected)}catch(_){yield this.engine.close(),this.recreateEngine();const w=f.signal.aborted?Gt.cancelled("Signal connection aborted"):Gt.serverUnreachable("could not establish signal connection");throw _ instanceof Error&&(w.message="".concat(w.message,": ").concat(_.message)),_ instanceof Gt&&(w.reason=_.reason,w.status=_.status),this.log.debug("error trying to establish signal connection",Object.assign(Object.assign({},this.logContext),{error:_})),w}if(f.signal.aborted)throw yield this.engine.close(),this.recreateEngine(),Gt.cancelled("Connection attempt aborted");try{yield this.engine.waitForPCInitialConnection(this.connOptions.peerConnectionTimeout,f)}catch(_){throw yield this.engine.close(),this.recreateEngine(),_}ui()&&this.options.disconnectOnPageLeave&&(window.addEventListener("pagehide",this.onPageLeave),window.addEventListener("beforeunload",this.onPageLeave)),ui()&&window.addEventListener("freeze",this.onPageLeave),this.setAndEmitConnectionState(Mr.Connected),this.emit(tt.Connected),Gf.getInstance().resetFailedConnectionAttempts(c),this.registerConnectionReconcile(),this.regionUrlProvider&&this.regionUrlProvider.notifyConnected()}),this.disconnect=function(){for(var c=arguments.length,u=new Array(c),d=0;d<c;d++)u[d]=arguments[d];return ne(r,[...u],void 0,function(){var f=this;let h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return(function*(){var m,_,w;const b=yield f.disconnectLock.lock();try{if(f.state===Mr.Disconnected){f.log.debug("already disconnected",f.logContext);return}if(f.log.info("disconnect from room",Object.assign({},f.logContext)),f.state===Mr.Connecting||f.state===Mr.Reconnecting||f.isResuming){const E="Abort connection attempt due to user initiated disconnect";f.log.warn(E,f.logContext),(m=f.abortController)===null||m===void 0||m.abort(E),(w=(_=f.connectFuture)===null||_===void 0?void 0:_.reject)===null||w===void 0||w.call(_,Gt.cancelled("Client initiated disconnect")),f.connectFuture=void 0}f.engine&&(f.engine.client.isDisconnected||(yield f.engine.client.sendLeave()),yield f.engine.close()),f.handleDisconnect(h,Ws.CLIENT_INITIATED),f.engine=void 0}finally{b()}})()})},this.onPageLeave=()=>ne(this,void 0,void 0,function*(){this.log.info("Page leave detected, disconnecting",this.logContext),yield this.disconnect()}),this.startAudio=()=>ne(this,void 0,void 0,function*(){const c=[],u=fi();if(u&&u.os==="iOS"){const d="livekit-dummy-audio-el";let f=document.getElementById(d);if(!f){f=document.createElement("audio"),f.id=d,f.autoplay=!0,f.hidden=!0;const h=lE();h.enabled=!0;const m=new MediaStream([h]);f.srcObject=m,document.addEventListener("visibilitychange",()=>{f&&(f.srcObject=document.hidden?null:m,document.hidden||(this.log.debug("page visible again, triggering startAudio to resume playback and update playback status",this.logContext),this.startAudio()))}),document.body.append(f),this.once(tt.Disconnected,()=>{f?.remove(),f=null})}c.push(f)}this.remoteParticipants.forEach(d=>{d.audioTrackPublications.forEach(f=>{f.track&&f.track.attachedElements.forEach(h=>{c.push(h)})})});try{yield Promise.all([this.acquireAudioContext(),...c.map(d=>(d.muted=!1,d.play()))]),this.handleAudioPlaybackStarted()}catch(d){throw this.handleAudioPlaybackFailed(d),d}}),this.startVideo=()=>ne(this,void 0,void 0,function*(){const c=[];for(const u of this.remoteParticipants.values())u.videoTrackPublications.forEach(d=>{var f;(f=d.track)===null||f===void 0||f.attachedElements.forEach(h=>{c.includes(h)||c.push(h)})});yield Promise.all(c.map(u=>u.play())).then(()=>{this.handleVideoPlaybackStarted()}).catch(u=>{u.name==="NotAllowedError"?this.handleVideoPlaybackFailed():this.log.warn("Resuming video playback failed, make sure you call `startVideo` directly in a user gesture handler",this.logContext)})}),this.handleRestarting=()=>{this.clearConnectionReconcile(),this.isResuming=!1;for(const c of this.remoteParticipants.values())this.handleParticipantDisconnected(c.identity,c);this.setAndEmitConnectionState(Mr.Reconnecting)&&this.emit(tt.Reconnecting)},this.handleSignalRestarted=c=>ne(this,void 0,void 0,function*(){this.log.debug("signal reconnected to server, region ".concat(c.serverRegion),Object.assign(Object.assign({},this.logContext),{region:c.serverRegion})),this.bufferedEvents=[],this.applyJoinResponse(c);try{yield this.localParticipant.republishAllTracks(void 0,!0)}catch(u){this.log.error("error trying to re-publish tracks after reconnection",Object.assign(Object.assign({},this.logContext),{error:u}))}try{yield this.engine.waitForRestarted(),this.log.debug("fully reconnected to server",Object.assign(Object.assign({},this.logContext),{region:c.serverRegion}))}catch{return}this.setAndEmitConnectionState(Mr.Connected),this.emit(tt.Reconnected),this.registerConnectionReconcile(),this.emitBufferedEvents()}),this.handleParticipantUpdates=c=>{c.forEach(u=>{var d;if(u.identity===this.localParticipant.identity){this.localParticipant.updateInfo(u);return}u.identity===""&&(u.identity=(d=this.sidToIdentity.get(u.sid))!==null&&d!==void 0?d:"");let f=this.remoteParticipants.get(u.identity);u.state===Ff.DISCONNECTED?this.handleParticipantDisconnected(u.identity,f):f=this.getOrCreateParticipant(u.identity,u)})},this.handleActiveSpeakersUpdate=c=>{const u=[],d={};c.forEach(f=>{if(d[f.sid]=!0,f.sid===this.localParticipant.sid)this.localParticipant.audioLevel=f.level,this.localParticipant.setIsSpeaking(!0),u.push(this.localParticipant);else{const h=this.getRemoteParticipantBySid(f.sid);h&&(h.audioLevel=f.level,h.setIsSpeaking(!0),u.push(h))}}),d[this.localParticipant.sid]||(this.localParticipant.audioLevel=0,this.localParticipant.setIsSpeaking(!1)),this.remoteParticipants.forEach(f=>{d[f.sid]||(f.audioLevel=0,f.setIsSpeaking(!1))}),this.activeSpeakers=u,this.emitWhenConnected(tt.ActiveSpeakersChanged,u)},this.handleSpeakersChanged=c=>{const u=new Map;this.activeSpeakers.forEach(f=>{const h=this.remoteParticipants.get(f.identity);h&&h.sid!==f.sid||u.set(f.sid,f)}),c.forEach(f=>{let h=this.getRemoteParticipantBySid(f.sid);f.sid===this.localParticipant.sid&&(h=this.localParticipant),h&&(h.audioLevel=f.level,h.setIsSpeaking(f.active),f.active?u.set(f.sid,h):u.delete(f.sid))});const d=Array.from(u.values());d.sort((f,h)=>h.audioLevel-f.audioLevel),this.activeSpeakers=d,this.emitWhenConnected(tt.ActiveSpeakersChanged,d)},this.handleStreamStateUpdate=c=>{c.streamStates.forEach(u=>{const d=this.getRemoteParticipantBySid(u.participantSid);if(!d)return;const f=d.getTrackPublicationBySid(u.trackSid);if(!f||!f.track)return;const h=Ke.streamStateFromProto(u.state);f.track.setStreamState(h),h!==f.track.streamState&&(d.emit(yt.TrackStreamStateChanged,f,f.track.streamState),this.emitWhenConnected(tt.TrackStreamStateChanged,f,f.track.streamState,d))})},this.handleSubscriptionPermissionUpdate=c=>{const u=this.getRemoteParticipantBySid(c.participantSid);if(!u)return;const d=u.getTrackPublicationBySid(c.trackSid);d&&d.setAllowed(c.allowed)},this.handleSubscriptionError=c=>{const u=Array.from(this.remoteParticipants.values()).find(f=>f.trackPublications.has(c.trackSid));if(!u)return;const d=u.getTrackPublicationBySid(c.trackSid);d&&d.setSubscriptionError(c.err)},this.handleDataPacket=(c,u)=>{const d=this.remoteParticipants.get(c.participantIdentity);if(c.value.case==="user")this.handleUserPacket(d,c.value.value,c.kind,u);else if(c.value.case==="transcription")this.handleTranscription(d,c.value.value);else if(c.value.case==="sipDtmf")this.handleSipDtmf(d,c.value.value);else if(c.value.case==="chatMessage")this.handleChatMessage(d,c.value.value);else if(c.value.case==="metrics")this.handleMetrics(c.value.value,d);else if(c.value.case==="streamHeader"||c.value.case==="streamChunk"||c.value.case==="streamTrailer")this.handleDataStream(c,u);else if(c.value.case==="rpcRequest"){const f=c.value.value;this.handleIncomingRpcRequest(c.participantIdentity,f.id,f.method,f.payload,f.responseTimeoutMs,f.version)}},this.handleUserPacket=(c,u,d,f)=>{this.emit(tt.DataReceived,u.payload,c,d,u.topic,f),c?.emit(yt.DataReceived,u.payload,d,f)},this.handleSipDtmf=(c,u)=>{this.emit(tt.SipDTMFReceived,u,c),c?.emit(yt.SipDTMFReceived,u)},this.handleTranscription=(c,u)=>{const d=u.transcribedParticipantIdentity===this.localParticipant.identity?this.localParticipant:this.getParticipantByIdentity(u.transcribedParticipantIdentity),f=d?.trackPublications.get(u.trackId),h=Cue(u,this.transcriptionReceivedTimes);f?.emit(dt.TranscriptionReceived,h),d?.emit(yt.TranscriptionReceived,h,f),this.emit(tt.TranscriptionReceived,h,d,f)},this.handleChatMessage=(c,u)=>{const d=xue(u);this.emit(tt.ChatMessage,d,c)},this.handleMetrics=(c,u)=>{this.emit(tt.MetricsReceived,c,u)},this.handleDataStream=(c,u)=>{this.incomingDataStreamManager.handleDataStreamPacket(c,u)},this.bufferedSegments=new Map,this.handleAudioPlaybackStarted=()=>{this.canPlaybackAudio||(this.audioEnabled=!0,this.emit(tt.AudioPlaybackStatusChanged,!0))},this.handleAudioPlaybackFailed=c=>{this.log.warn("could not playback audio",Object.assign(Object.assign({},this.logContext),{error:c})),this.canPlaybackAudio&&(this.audioEnabled=!1,this.emit(tt.AudioPlaybackStatusChanged,!1))},this.handleVideoPlaybackStarted=()=>{this.isVideoPlaybackBlocked&&(this.isVideoPlaybackBlocked=!1,this.emit(tt.VideoPlaybackStatusChanged,!0))},this.handleVideoPlaybackFailed=()=>{this.isVideoPlaybackBlocked||(this.isVideoPlaybackBlocked=!0,this.emit(tt.VideoPlaybackStatusChanged,!1))},this.handleDeviceChange=()=>ne(this,void 0,void 0,function*(){var c;((c=fi())===null||c===void 0?void 0:c.os)!=="iOS"&&(yield this.selectDefaultDevices()),this.emit(tt.MediaDevicesChanged)}),this.handleRoomUpdate=c=>{const u=this.roomInfo;this.roomInfo=c,u&&u.metadata!==c.metadata&&this.emitWhenConnected(tt.RoomMetadataChanged,c.metadata),u?.activeRecording!==c.activeRecording&&this.emitWhenConnected(tt.RecordingStatusChanged,c.activeRecording)},this.handleConnectionQualityUpdate=c=>{c.updates.forEach(u=>{if(u.participantSid===this.localParticipant.sid){this.localParticipant.setConnectionQuality(u.quality);return}const d=this.getRemoteParticipantBySid(u.participantSid);d&&d.setConnectionQuality(u.quality)})},this.onLocalParticipantMetadataChanged=c=>{this.emit(tt.ParticipantMetadataChanged,c,this.localParticipant)},this.onLocalParticipantNameChanged=c=>{this.emit(tt.ParticipantNameChanged,c,this.localParticipant)},this.onLocalAttributesChanged=c=>{this.emit(tt.ParticipantAttributesChanged,c,this.localParticipant)},this.onLocalTrackMuted=c=>{this.emit(tt.TrackMuted,c,this.localParticipant)},this.onLocalTrackUnmuted=c=>{this.emit(tt.TrackUnmuted,c,this.localParticipant)},this.onTrackProcessorUpdate=c=>{var u;(u=c?.onPublish)===null||u===void 0||u.call(c,this)},this.onLocalTrackPublished=c=>ne(this,void 0,void 0,function*(){var u,d,f,h,m,_;(u=c.track)===null||u===void 0||u.on(dt.TrackProcessorUpdate,this.onTrackProcessorUpdate),(d=c.track)===null||d===void 0||d.on(dt.Restarted,this.onLocalTrackRestarted),(m=(h=(f=c.track)===null||f===void 0?void 0:f.getProcessor())===null||h===void 0?void 0:h.onPublish)===null||m===void 0||m.call(h,this),this.emit(tt.LocalTrackPublished,c,this.localParticipant),Ec(c.track)&&(yield c.track.checkForSilence())&&this.emit(tt.LocalAudioSilenceDetected,c);const w=yield(_=c.track)===null||_===void 0?void 0:_.getDeviceId(!1),b=yC(c.source);b&&w&&w!==this.localParticipant.activeDeviceMap.get(b)&&(this.localParticipant.activeDeviceMap.set(b,w),this.emit(tt.ActiveDeviceChanged,b,w))}),this.onLocalTrackUnpublished=c=>{var u,d;(u=c.track)===null||u===void 0||u.off(dt.TrackProcessorUpdate,this.onTrackProcessorUpdate),(d=c.track)===null||d===void 0||d.off(dt.Restarted,this.onLocalTrackRestarted),this.emit(tt.LocalTrackUnpublished,c,this.localParticipant)},this.onLocalTrackRestarted=c=>ne(this,void 0,void 0,function*(){const u=yield c.getDeviceId(!1),d=yC(c.source);d&&u&&u!==this.localParticipant.activeDeviceMap.get(d)&&(this.log.debug("local track restarted, setting ".concat(d," ").concat(u," active"),this.logContext),this.localParticipant.activeDeviceMap.set(d,u),this.emit(tt.ActiveDeviceChanged,d,u))}),this.onLocalConnectionQualityChanged=c=>{this.emit(tt.ConnectionQualityChanged,c,this.localParticipant)},this.onMediaDevicesError=(c,u)=>{this.emit(tt.MediaDevicesError,c,u)},this.onLocalParticipantPermissionsChanged=c=>{this.emit(tt.ParticipantPermissionsChanged,c,this.localParticipant)},this.onLocalChatMessageSent=c=>{this.emit(tt.ChatMessage,c,this.localParticipant)},this.setMaxListeners(100),this.remoteParticipants=new Map,this.sidToIdentity=new Map,this.options=Object.assign(Object.assign({},sde),e),this.log=Vc((n=this.options.loggerName)!==null&&n!==void 0?n:eo.Room),this.transcriptionReceivedTimes=new Map,this.options.audioCaptureDefaults=Object.assign(Object.assign({},Qq),e?.audioCaptureDefaults),this.options.videoCaptureDefaults=Object.assign(Object.assign({},Zq),e?.videoCaptureDefaults),this.options.publishDefaults=Object.assign(Object.assign({},ide),e?.publishDefaults),this.maybeCreateEngine(),this.incomingDataStreamManager=new jde,this.outgoingDataStreamManager=new Ude(this.engine,this.log),this.disconnectLock=new Wa,this.localParticipant=new Wde("","",this.engine,this.options,this.rpcHandlers,this.outgoingDataStreamManager),(this.options.e2ee||this.options.encryption)&&this.setupE2EE(),this.engine.e2eeManager=this.e2eeManager,this.options.videoCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set("videoinput",Hl(this.options.videoCaptureDefaults.deviceId)),this.options.audioCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set("audioinput",Hl(this.options.audioCaptureDefaults.deviceId)),!((a=this.options.audioOutput)===null||a===void 0)&&a.deviceId&&this.switchActiveDevice("audiooutput",Hl(this.options.audioOutput.deviceId)).catch(c=>this.log.warn("Could not set audio output: ".concat(c.message),this.logContext)),ui()){const c=new AbortController;(o=(i=navigator.mediaDevices)===null||i===void 0?void 0:i.addEventListener)===null||o===void 0||o.call(i,"devicechange",this.handleDeviceChange,{signal:c.signal}),fp.cleanupRegistry&&fp.cleanupRegistry.register(this,()=>{c.abort()})}}registerTextStreamHandler(e,r){return this.incomingDataStreamManager.registerTextStreamHandler(e,r)}unregisterTextStreamHandler(e){return this.incomingDataStreamManager.unregisterTextStreamHandler(e)}registerByteStreamHandler(e,r){return this.incomingDataStreamManager.registerByteStreamHandler(e,r)}unregisterByteStreamHandler(e){return this.incomingDataStreamManager.unregisterByteStreamHandler(e)}registerRpcMethod(e,r){if(this.rpcHandlers.has(e))throw Error("RPC handler already registered for method ".concat(e,", unregisterRpcMethod before trying to register again"));this.rpcHandlers.set(e,r)}unregisterRpcMethod(e){this.rpcHandlers.delete(e)}setE2EEEnabled(e){return ne(this,void 0,void 0,function*(){if(this.e2eeManager)yield Promise.all([this.localParticipant.setE2EEEnabled(e)]),this.localParticipant.identity!==""&&this.e2eeManager.setParticipantCryptorEnabled(e,this.localParticipant.identity);else throw Error("e2ee not configured, please set e2ee settings within the room options")})}setupE2EE(){var e;const r=!!this.options.encryption,n=this.options.encryption||this.options.e2ee;n&&("e2eeManager"in n?(this.e2eeManager=n.e2eeManager,this.e2eeManager.isDataChannelEncryptionEnabled=r):this.e2eeManager=new zue(n,r),this.e2eeManager.on(jl.ParticipantEncryptionStatusChanged,(a,i)=>{Aue(i)&&(this.isE2EEEnabled=a),this.emit(tt.ParticipantEncryptionStatusChanged,a,i)}),this.e2eeManager.on(jl.EncryptionError,(a,i)=>{const o=i?this.getParticipantByIdentity(i):void 0;this.emit(tt.EncryptionError,a,o)}),(e=this.e2eeManager)===null||e===void 0||e.setup(this))}get logContext(){var e;return{room:this.name,roomID:(e=this.roomInfo)===null||e===void 0?void 0:e.sid,participant:this.localParticipant.identity,pID:this.localParticipant.sid}}get isRecording(){var e,r;return(r=(e=this.roomInfo)===null||e===void 0?void 0:e.activeRecording)!==null&&r!==void 0?r:!1}getSid(){return this.state===Mr.Disconnected?li.resolve(""):this.roomInfo&&this.roomInfo.sid!==""?li.resolve(this.roomInfo.sid):new li((e,r)=>{const n=a=>{a.sid!==""&&(this.engine.off(ht.RoomUpdate,n),e(a.sid))};this.engine.on(ht.RoomUpdate,n),this.once(tt.Disconnected,()=>{this.engine.off(ht.RoomUpdate,n),r(new Ln("Room disconnected before room server id was available"))})})}get name(){var e,r;return(r=(e=this.roomInfo)===null||e===void 0?void 0:e.name)!==null&&r!==void 0?r:""}get metadata(){var e;return(e=this.roomInfo)===null||e===void 0?void 0:e.metadata}get numParticipants(){var e,r;return(r=(e=this.roomInfo)===null||e===void 0?void 0:e.numParticipants)!==null&&r!==void 0?r:0}get numPublishers(){var e,r;return(r=(e=this.roomInfo)===null||e===void 0?void 0:e.numPublishers)!==null&&r!==void 0?r:0}maybeCreateEngine(){this.engine&&!this.engine.isClosed||(this.engine=new Ode(this.options),this.engine.e2eeManager=this.e2eeManager,this.engine.on(ht.ParticipantUpdate,this.handleParticipantUpdates).on(ht.RoomUpdate,this.handleRoomUpdate).on(ht.SpeakersChanged,this.handleSpeakersChanged).on(ht.StreamStateChanged,this.handleStreamStateUpdate).on(ht.ConnectionQualityUpdate,this.handleConnectionQualityUpdate).on(ht.SubscriptionError,this.handleSubscriptionError).on(ht.SubscriptionPermissionUpdate,this.handleSubscriptionPermissionUpdate).on(ht.MediaTrackAdded,(e,r,n)=>{this.onTrackAdded(e,r,n)}).on(ht.Disconnected,e=>{this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,e)}).on(ht.ActiveSpeakersUpdate,this.handleActiveSpeakersUpdate).on(ht.DataPacketReceived,this.handleDataPacket).on(ht.Resuming,()=>{this.clearConnectionReconcile(),this.isResuming=!0,this.log.info("Resuming signal connection",this.logContext),this.setAndEmitConnectionState(Mr.SignalReconnecting)&&this.emit(tt.SignalReconnecting)}).on(ht.Resumed,()=>{this.registerConnectionReconcile(),this.isResuming=!1,this.log.info("Resumed signal connection",this.logContext),this.updateSubscriptions(),this.emitBufferedEvents(),this.setAndEmitConnectionState(Mr.Connected)&&this.emit(tt.Reconnected)}).on(ht.SignalResumed,()=>{this.bufferedEvents=[],(this.state===Mr.Reconnecting||this.isResuming)&&this.sendSyncState()}).on(ht.Restarting,this.handleRestarting).on(ht.SignalRestarted,this.handleSignalRestarted).on(ht.Offline,()=>{this.setAndEmitConnectionState(Mr.Reconnecting)&&this.emit(tt.Reconnecting)}).on(ht.DCBufferStatusChanged,(e,r)=>{this.emit(tt.DCBufferStatusChanged,e,r)}).on(ht.LocalTrackSubscribed,e=>{const r=this.localParticipant.getTrackPublications().find(n=>{let{trackSid:a}=n;return a===e});if(!r){this.log.warn("could not find local track subscription for subscribed event",this.logContext);return}this.localParticipant.emit(yt.LocalTrackSubscribed,r),this.emitWhenConnected(tt.LocalTrackSubscribed,r,this.localParticipant)}).on(ht.RoomMoved,e=>{this.log.debug("room moved",e),e.room&&this.handleRoomUpdate(e.room),this.remoteParticipants.forEach((r,n)=>{this.handleParticipantDisconnected(n,r)}),this.emit(tt.Moved,e.room.name),e.participant?this.handleParticipantUpdates([e.participant,...e.otherParticipants]):this.handleParticipantUpdates(e.otherParticipants)}),this.localParticipant&&this.localParticipant.setupEngine(this.engine),this.e2eeManager&&this.e2eeManager.setupEngine(this.engine),this.outgoingDataStreamManager&&this.outgoingDataStreamManager.setupEngine(this.engine))}static getLocalDevices(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return fa.getInstance().getDevices(e,r)}prepareConnection(e,r){return ne(this,void 0,void 0,function*(){if(this.state===Mr.Disconnected){this.log.debug("prepareConnection to ".concat(e),this.logContext);try{if(dp(new URL(e))&&r){this.regionUrlProvider=new Rr(e,r);const n=yield this.regionUrlProvider.getNextBestRegionUrl();n&&this.state===Mr.Disconnected&&(this.regionUrl=n,yield fetch(Wm(n),{method:"HEAD"}),this.log.debug("prepared connection to ".concat(n),this.logContext))}else yield fetch(Wm(e),{method:"HEAD"})}catch(n){this.log.warn("could not prepare connection",Object.assign(Object.assign({},this.logContext),{error:n}))}}})}getParticipantByIdentity(e){return this.localParticipant.identity===e?this.localParticipant:this.remoteParticipants.get(e)}clearConnectionFutures(){this.connectFuture=void 0}simulateScenario(e,r){return ne(this,void 0,void 0,function*(){let n=()=>ne(this,void 0,void 0,function*(){}),a;switch(e){case"signal-reconnect":yield this.engine.client.handleOnClose("simulate disconnect");break;case"speaker":a=new Ao({scenario:{case:"speakerUpdate",value:3}});break;case"node-failure":a=new Ao({scenario:{case:"nodeFailure",value:!0}});break;case"server-leave":a=new Ao({scenario:{case:"serverLeave",value:!0}});break;case"migration":a=new Ao({scenario:{case:"migration",value:!0}});break;case"resume-reconnect":this.engine.failNext(),yield this.engine.client.handleOnClose("simulate resume-disconnect");break;case"disconnect-signal-on-resume":n=()=>ne(this,void 0,void 0,function*(){yield this.engine.client.handleOnClose("simulate resume-disconnect")}),a=new Ao({scenario:{case:"disconnectSignalOnResume",value:!0}});break;case"disconnect-signal-on-resume-no-messages":n=()=>ne(this,void 0,void 0,function*(){yield this.engine.client.handleOnClose("simulate resume-disconnect")}),a=new Ao({scenario:{case:"disconnectSignalOnResumeNoMessages",value:!0}});break;case"full-reconnect":this.engine.fullReconnectOnNext=!0,yield this.engine.client.handleOnClose("simulate full-reconnect");break;case"force-tcp":case"force-tls":a=new Ao({scenario:{case:"switchCandidateProtocol",value:e==="force-tls"?2:1}}),n=()=>ne(this,void 0,void 0,function*(){const i=this.engine.client.onLeave;i&&i(new p0({reason:Ws.CLIENT_INITIATED,action:qf.RECONNECT}))});break;case"subscriber-bandwidth":if(r===void 0||typeof r!="number")throw new Error("subscriber-bandwidth requires a number as argument");a=new Ao({scenario:{case:"subscriberBandwidth",value:$u(r)}});break;case"leave-full-reconnect":a=new Ao({scenario:{case:"leaveRequestFullReconnect",value:!0}})}a&&(yield this.engine.client.sendSimulateScenario(a),yield n())})}get canPlaybackAudio(){return this.audioEnabled}get canPlaybackVideo(){return!this.isVideoPlaybackBlocked}getActiveDevice(e){return this.localParticipant.activeDeviceMap.get(e)}switchActiveDevice(e,r){return ne(this,arguments,void 0,function(n,a){var i=this;let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return(function*(){var c,u,d,f,h,m,_;let w=!0,b=!1;const E=o?{exact:a}:a;if(n==="audioinput"){b=i.localParticipant.audioTrackPublications.size===0;const T=(c=i.getActiveDevice(n))!==null&&c!==void 0?c:i.options.audioCaptureDefaults.deviceId;i.options.audioCaptureDefaults.deviceId=E;const D=Array.from(i.localParticipant.audioTrackPublications.values()).filter(A=>A.source===Ke.Source.Microphone);try{w=(yield Promise.all(D.map(A=>{var C;return(C=A.audioTrack)===null||C===void 0?void 0:C.setDeviceId(E)}))).every(A=>A===!0)}catch(A){throw i.options.audioCaptureDefaults.deviceId=T,A}const P=D.some(A=>{var C,O;return(O=(C=A.track)===null||C===void 0?void 0:C.isMuted)!==null&&O!==void 0?O:!1});w&&P&&(b=!0)}else if(n==="videoinput"){b=i.localParticipant.videoTrackPublications.size===0;const T=(u=i.getActiveDevice(n))!==null&&u!==void 0?u:i.options.videoCaptureDefaults.deviceId;i.options.videoCaptureDefaults.deviceId=E;const D=Array.from(i.localParticipant.videoTrackPublications.values()).filter(A=>A.source===Ke.Source.Camera);try{w=(yield Promise.all(D.map(A=>{var C;return(C=A.videoTrack)===null||C===void 0?void 0:C.setDeviceId(E)}))).every(A=>A===!0)}catch(A){throw i.options.videoCaptureDefaults.deviceId=T,A}const P=D.some(A=>{var C,O;return(O=(C=A.track)===null||C===void 0?void 0:C.isMuted)!==null&&O!==void 0?O:!1});w&&P&&(b=!0)}else if(n==="audiooutput"){if(b=!0,!bC()&&!i.options.webAudioMix||i.options.webAudioMix&&i.audioContext&&!("setSinkId"in i.audioContext))throw new Error("cannot switch audio output, the current browser does not support it");i.options.webAudioMix&&(a=(d=yield fa.getInstance().normalizeDeviceId("audiooutput",a))!==null&&d!==void 0?d:""),(f=(_=i.options).audioOutput)!==null&&f!==void 0||(_.audioOutput={});const T=(h=i.getActiveDevice(n))!==null&&h!==void 0?h:i.options.audioOutput.deviceId;i.options.audioOutput.deviceId=a;try{i.options.webAudioMix&&((m=i.audioContext)===null||m===void 0||m.setSinkId(a)),yield Promise.all(Array.from(i.remoteParticipants.values()).map(D=>D.setAudioOutput({deviceId:a})))}catch(D){throw i.options.audioOutput.deviceId=T,D}}return b&&(i.localParticipant.activeDeviceMap.set(n,a),i.emit(tt.ActiveDeviceChanged,n,a)),w})()})}setupLocalParticipantEvents(){this.localParticipant.on(yt.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).on(yt.ParticipantNameChanged,this.onLocalParticipantNameChanged).on(yt.AttributesChanged,this.onLocalAttributesChanged).on(yt.TrackMuted,this.onLocalTrackMuted).on(yt.TrackUnmuted,this.onLocalTrackUnmuted).on(yt.LocalTrackPublished,this.onLocalTrackPublished).on(yt.LocalTrackUnpublished,this.onLocalTrackUnpublished).on(yt.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).on(yt.MediaDevicesError,this.onMediaDevicesError).on(yt.AudioStreamAcquired,this.startAudio).on(yt.ChatMessage,this.onLocalChatMessageSent).on(yt.ParticipantPermissionsChanged,this.onLocalParticipantPermissionsChanged)}recreateEngine(){var e;(e=this.engine)===null||e===void 0||e.close(),this.engine=void 0,this.isResuming=!1,this.remoteParticipants.clear(),this.sidToIdentity.clear(),this.bufferedEvents=[],this.maybeCreateEngine()}onTrackAdded(e,r,n){if(this.state===Mr.Connecting||this.state===Mr.Reconnecting){const h=()=>{this.log.debug("deferring on track for later",{mediaTrackId:e.id,mediaStreamId:r.id,tracksInStream:r.getTracks().map(_=>_.id)}),this.onTrackAdded(e,r,n),m()},m=()=>{this.off(tt.Reconnected,h),this.off(tt.Connected,h),this.off(tt.Disconnected,m)};this.once(tt.Reconnected,h),this.once(tt.Connected,h),this.once(tt.Disconnected,m);return}if(this.state===Mr.Disconnected){this.log.warn("skipping incoming track after Room disconnected",this.logContext);return}if(e.readyState==="ended"){this.log.info("skipping incoming track as it already ended",this.logContext);return}const a=hue(r.id),i=a[0];let o=a[1],c=e.id;if(o&&o.startsWith("TR")&&(c=o),i===this.localParticipant.sid){this.log.warn("tried to create RemoteParticipant for local participant",this.logContext);return}const u=Array.from(this.remoteParticipants.values()).find(h=>h.sid===i);if(!u){this.log.error("Tried to add a track for a participant, that's not present. Sid: ".concat(i),this.logContext);return}if(!c.startsWith("TR")){const h=this.engine.getTrackIdForReceiver(n);if(!h){this.log.error("Tried to add a track whose 'sid' could not be found for a participant, that's not present. Sid: ".concat(i),this.logContext);return}c=h}c.startsWith("TR")||this.log.warn("Tried to add a track whose 'sid' could not be determined for a participant, that's not present. Sid: ".concat(i,", streamId: ").concat(o,", trackId: ").concat(c),Object.assign(Object.assign({},this.logContext),{rpID:i,streamId:o,trackId:c}));let d;this.options.adaptiveStream&&(typeof this.options.adaptiveStream=="object"?d=this.options.adaptiveStream:d={});const f=u.addSubscribedMediaTrack(e,c,r,n,d);f?.isEncrypted&&!this.e2eeManager&&this.emit(tt.EncryptionError,new Error("Encrypted ".concat(f.source," track received from participant ").concat(u.sid,", but room does not have encryption enabled!")))}handleDisconnect(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,r=arguments.length>1?arguments[1]:void 0;var n,a;if(this.clearConnectionReconcile(),this.isResuming=!1,this.bufferedEvents=[],this.transcriptionReceivedTimes.clear(),this.incomingDataStreamManager.clearControllers(),this.state!==Mr.Disconnected){this.regionUrl=void 0,this.regionUrlProvider&&this.regionUrlProvider.notifyDisconnected();try{this.remoteParticipants.forEach(i=>{i.trackPublications.forEach(o=>{i.unpublishTrack(o.trackSid)})}),this.localParticipant.trackPublications.forEach(i=>{var o,c,u;i.track&&this.localParticipant.unpublishTrack(i.track,e),e?((o=i.track)===null||o===void 0||o.detach(),(c=i.track)===null||c===void 0||c.stop()):(u=i.track)===null||u===void 0||u.stopMonitor()}),this.localParticipant.off(yt.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).off(yt.ParticipantNameChanged,this.onLocalParticipantNameChanged).off(yt.AttributesChanged,this.onLocalAttributesChanged).off(yt.TrackMuted,this.onLocalTrackMuted).off(yt.TrackUnmuted,this.onLocalTrackUnmuted).off(yt.LocalTrackPublished,this.onLocalTrackPublished).off(yt.LocalTrackUnpublished,this.onLocalTrackUnpublished).off(yt.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).off(yt.MediaDevicesError,this.onMediaDevicesError).off(yt.AudioStreamAcquired,this.startAudio).off(yt.ChatMessage,this.onLocalChatMessageSent).off(yt.ParticipantPermissionsChanged,this.onLocalParticipantPermissionsChanged),this.localParticipant.trackPublications.clear(),this.localParticipant.videoTrackPublications.clear(),this.localParticipant.audioTrackPublications.clear(),this.remoteParticipants.clear(),this.sidToIdentity.clear(),this.activeSpeakers=[],this.audioContext&&typeof this.options.webAudioMix=="boolean"&&(this.audioContext.close(),this.audioContext=void 0),ui()&&(window.removeEventListener("beforeunload",this.onPageLeave),window.removeEventListener("pagehide",this.onPageLeave),window.removeEventListener("freeze",this.onPageLeave),(a=(n=navigator.mediaDevices)===null||n===void 0?void 0:n.removeEventListener)===null||a===void 0||a.call(n,"devicechange",this.handleDeviceChange))}finally{this.setAndEmitConnectionState(Mr.Disconnected),this.emit(tt.Disconnected,r)}}}handleParticipantDisconnected(e,r){var n;this.remoteParticipants.delete(e),r&&(this.incomingDataStreamManager.validateParticipantHasNoActiveDataStreams(e),r.trackPublications.forEach(a=>{r.unpublishTrack(a.trackSid,!0)}),this.emit(tt.ParticipantDisconnected,r),r.setDisconnected(),(n=this.localParticipant)===null||n===void 0||n.handleParticipantDisconnected(r.identity))}handleIncomingRpcRequest(e,r,n,a,i,o){return ne(this,void 0,void 0,function*(){if(yield this.engine.publishRpcAck(e,r),o!==1){yield this.engine.publishRpcResponse(e,r,null,Va.builtIn("UNSUPPORTED_VERSION"));return}const c=this.rpcHandlers.get(n);if(!c){yield this.engine.publishRpcResponse(e,r,null,Va.builtIn("UNSUPPORTED_METHOD"));return}let u=null,d=null;try{const f=yield c({requestId:r,callerIdentity:e,payload:a,responseTimeout:i});tA(f)>t4?(u=Va.builtIn("RESPONSE_PAYLOAD_TOO_LARGE"),this.log.warn("RPC Response payload too large for ".concat(n))):d=f}catch(f){f instanceof Va?u=f:(this.log.warn("Uncaught error returned by RPC handler for ".concat(n,". Returning APPLICATION_ERROR instead."),f),u=Va.builtIn("APPLICATION_ERROR"))}yield this.engine.publishRpcResponse(e,r,d,u)})}selectDefaultDevices(){return ne(this,void 0,void 0,function*(){var e,r,n;const a=fa.getInstance().previousDevices,i=yield fa.getInstance().getDevices(void 0,!1),o=fi();if(o?.name==="Chrome"&&o.os!=="iOS")for(let u of i){const d=a.find(f=>f.deviceId===u.deviceId);d&&d.label!==""&&d.kind===u.kind&&d.label!==u.label&&this.getActiveDevice(u.kind)==="default"&&this.emit(tt.ActiveDeviceChanged,u.kind,u.deviceId)}const c=["audiooutput","audioinput","videoinput"];for(let u of c){const d=iue(u),f=this.localParticipant.getTrackPublication(d);if(f&&(!((e=f.track)===null||e===void 0)&&e.isUserProvided))continue;const h=i.filter(_=>_.kind===u),m=this.getActiveDevice(u);if(m===((r=a.filter(_=>_.kind===u)[0])===null||r===void 0?void 0:r.deviceId)&&h.length>0&&((n=h[0])===null||n===void 0?void 0:n.deviceId)!==m){yield this.switchActiveDevice(u,h[0].deviceId);continue}u==="audioinput"&&!Gm()||u==="videoinput"||h.length>0&&!h.find(_=>_.deviceId===this.getActiveDevice(u))&&(u!=="audiooutput"||!Gm())&&(yield this.switchActiveDevice(u,h[0].deviceId))}})}acquireAudioContext(){return ne(this,void 0,void 0,function*(){var e,r;if(typeof this.options.webAudioMix!="boolean"&&this.options.webAudioMix.audioContext?this.audioContext=this.options.webAudioMix.audioContext:(!this.audioContext||this.audioContext.state==="closed")&&(this.audioContext=(e=Gq())!==null&&e!==void 0?e:void 0),this.options.webAudioMix&&this.remoteParticipants.forEach(a=>a.setAudioContext(this.audioContext)),this.localParticipant.setAudioContext(this.audioContext),this.audioContext&&this.audioContext.state==="suspended")try{yield Promise.race([this.audioContext.resume(),Ca(200)])}catch(a){this.log.warn("Could not resume audio context",Object.assign(Object.assign({},this.logContext),{error:a}))}const n=((r=this.audioContext)===null||r===void 0?void 0:r.state)==="running";n!==this.canPlaybackAudio&&(this.audioEnabled=n,this.emit(tt.AudioPlaybackStatusChanged,n))})}createParticipant(e,r){var n;let a;return r?a=pb.fromParticipantInfo(this.engine.client,r,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName}):a=new pb(this.engine.client,"",e,void 0,void 0,void 0,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName}),this.options.webAudioMix&&a.setAudioContext(this.audioContext),!((n=this.options.audioOutput)===null||n===void 0)&&n.deviceId&&a.setAudioOutput(this.options.audioOutput).catch(i=>this.log.warn("Could not set audio output: ".concat(i.message),this.logContext)),a}getOrCreateParticipant(e,r){if(this.remoteParticipants.has(e)){const a=this.remoteParticipants.get(e);return r&&a.updateInfo(r)&&this.sidToIdentity.set(r.sid,r.identity),a}const n=this.createParticipant(e,r);return this.remoteParticipants.set(e,n),this.sidToIdentity.set(r.sid,r.identity),this.emitWhenConnected(tt.ParticipantConnected,n),n.on(yt.TrackPublished,a=>{this.emitWhenConnected(tt.TrackPublished,a,n)}).on(yt.TrackSubscribed,(a,i)=>{a.kind===Ke.Kind.Audio?(a.on(dt.AudioPlaybackStarted,this.handleAudioPlaybackStarted),a.on(dt.AudioPlaybackFailed,this.handleAudioPlaybackFailed)):a.kind===Ke.Kind.Video&&(a.on(dt.VideoPlaybackFailed,this.handleVideoPlaybackFailed),a.on(dt.VideoPlaybackStarted,this.handleVideoPlaybackStarted)),this.emit(tt.TrackSubscribed,a,i,n)}).on(yt.TrackUnpublished,a=>{this.emit(tt.TrackUnpublished,a,n)}).on(yt.TrackUnsubscribed,(a,i)=>{this.emit(tt.TrackUnsubscribed,a,i,n)}).on(yt.TrackMuted,a=>{this.emitWhenConnected(tt.TrackMuted,a,n)}).on(yt.TrackUnmuted,a=>{this.emitWhenConnected(tt.TrackUnmuted,a,n)}).on(yt.ParticipantMetadataChanged,a=>{this.emitWhenConnected(tt.ParticipantMetadataChanged,a,n)}).on(yt.ParticipantNameChanged,a=>{this.emitWhenConnected(tt.ParticipantNameChanged,a,n)}).on(yt.AttributesChanged,a=>{this.emitWhenConnected(tt.ParticipantAttributesChanged,a,n)}).on(yt.ConnectionQualityChanged,a=>{this.emitWhenConnected(tt.ConnectionQualityChanged,a,n)}).on(yt.ParticipantPermissionsChanged,a=>{this.emitWhenConnected(tt.ParticipantPermissionsChanged,a,n)}).on(yt.TrackSubscriptionStatusChanged,(a,i)=>{this.emitWhenConnected(tt.TrackSubscriptionStatusChanged,a,i,n)}).on(yt.TrackSubscriptionFailed,(a,i)=>{this.emit(tt.TrackSubscriptionFailed,a,n,i)}).on(yt.TrackSubscriptionPermissionChanged,(a,i)=>{this.emitWhenConnected(tt.TrackSubscriptionPermissionChanged,a,i,n)}).on(yt.Active,()=>{this.emitWhenConnected(tt.ParticipantActive,n),n.kind===Vm.AGENT&&this.localParticipant.setActiveAgent(n)}),r&&n.updateInfo(r),n}sendSyncState(){const e=Array.from(this.remoteParticipants.values()).reduce((n,a)=>(n.push(...a.getTrackPublications()),n),[]),r=this.localParticipant.getTrackPublications();this.engine.sendSyncState(e,r)}updateSubscriptions(){for(const e of this.remoteParticipants.values())for(const r of e.videoTrackPublications.values())r.isSubscribed&&Pue(r)&&r.emitTrackUpdate()}getRemoteParticipantBySid(e){const r=this.sidToIdentity.get(e);if(r)return this.remoteParticipants.get(r)}registerConnectionReconcile(){this.clearConnectionReconcile();let e=0;this.connectionReconcileInterval=Ta.setInterval(()=>{!this.engine||this.engine.isClosed||!this.engine.verifyTransport()?(e++,this.log.warn("detected connection state mismatch",Object.assign(Object.assign({},this.logContext),{numFailures:e,engine:this.engine?{closed:this.engine.isClosed,transportsConnected:this.engine.verifyTransport()}:void 0})),e>=3&&(this.recreateEngine(),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,Ws.STATE_MISMATCH))):e=0},Yde)}clearConnectionReconcile(){this.connectionReconcileInterval&&Ta.clearInterval(this.connectionReconcileInterval)}setAndEmitConnectionState(e){return e===this.state?!1:(this.state=e,this.emit(tt.ConnectionStateChanged,this.state),!0)}emitBufferedEvents(){this.bufferedEvents.forEach(e=>{let[r,n]=e;this.emit(r,...n)}),this.bufferedEvents=[]}emitWhenConnected(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];if(this.state===Mr.Reconnecting||this.isResuming||!this.engine||this.engine.pendingReconnect)this.bufferedEvents.push([e,n]);else if(this.state===Mr.Connected)return this.emit(e,...n);return!1}simulateParticipants(e){return ne(this,void 0,void 0,function*(){var r,n,a,i;const o=Object.assign({audio:!0,video:!0,useRealTracks:!1},e.publish),c=Object.assign({count:9,audio:!1,video:!0,aspectRatios:[1.66,1.7,1.3]},e.participants);if(this.handleDisconnect(),this.roomInfo=new l0({sid:"RM_SIMULATED",name:"simulated-room",emptyTimeout:0,maxParticipants:0,creationTime:kn.parse(new Date().getTime()),metadata:"",numParticipants:1,numPublishers:1,turnPassword:"",enabledCodecs:[],activeRecording:!1}),this.localParticipant.updateInfo(new fd({identity:"simulated-local",name:"local-name"})),this.setupLocalParticipantEvents(),this.emit(tt.SignalConnected),this.emit(tt.Connected),this.setAndEmitConnectionState(Mr.Connected),o.video){const u=new xC(Ke.Kind.Video,new Tf({source:Yn.CAMERA,sid:Math.floor(Math.random()*1e4).toString(),type:zs.AUDIO,name:"video-dummy"}),new fb(o.useRealTracks&&(!((r=window.navigator.mediaDevices)===null||r===void 0)&&r.getUserMedia)?(yield window.navigator.mediaDevices.getUserMedia({video:!0})).getVideoTracks()[0]:AM(160*((n=c.aspectRatios[0])!==null&&n!==void 0?n:1),160,!0,!0),void 0,!1,{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext}),{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext});this.localParticipant.addTrackPublication(u),this.localParticipant.emit(yt.LocalTrackPublished,u)}if(o.audio){const u=new xC(Ke.Kind.Audio,new Tf({source:Yn.MICROPHONE,sid:Math.floor(Math.random()*1e4).toString(),type:zs.AUDIO}),new db(o.useRealTracks&&(!((a=navigator.mediaDevices)===null||a===void 0)&&a.getUserMedia)?(yield navigator.mediaDevices.getUserMedia({audio:!0})).getAudioTracks()[0]:lE(),void 0,!1,this.audioContext,{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext}),{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext});this.localParticipant.addTrackPublication(u),this.localParticipant.emit(yt.LocalTrackPublished,u)}for(let u=0;u<c.count-1;u+=1){let d=new fd({sid:Math.floor(Math.random()*1e4).toString(),identity:"simulated-".concat(u),state:Ff.ACTIVE,tracks:[],joinedAt:kn.parse(Date.now())});const f=this.getOrCreateParticipant(d.identity,d);if(c.video){const h=AM(160*((i=c.aspectRatios[u%c.aspectRatios.length])!==null&&i!==void 0?i:1),160,!1,!0),m=new Tf({source:Yn.CAMERA,sid:Math.floor(Math.random()*1e4).toString(),type:zs.AUDIO});f.addSubscribedMediaTrack(h,m.sid,new MediaStream([h]),new RTCRtpReceiver),d.tracks=[...d.tracks,m]}if(c.audio){const h=lE(),m=new Tf({source:Yn.MICROPHONE,sid:Math.floor(Math.random()*1e4).toString(),type:zs.AUDIO});f.addSubscribedMediaTrack(h,m.sid,new MediaStream([h]),new RTCRtpReceiver),d.tracks=[...d.tracks,m]}f.updateInfo(d)}})}emit(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];if(e!==tt.ActiveSpeakersChanged&&e!==tt.TranscriptionReceived){const i=l4(n).filter(o=>o!==void 0);(e===tt.TrackSubscribed||e===tt.TrackUnsubscribed)&&this.log.trace("subscribe trace: ".concat(e),Object.assign(Object.assign({},this.logContext),{event:e,args:i})),this.log.debug("room event ".concat(e),Object.assign(Object.assign({},this.logContext),{event:e,args:i}))}return super.emit(e,...n)}}fp.cleanupRegistry=typeof FinalizationRegistry<"u"&&new FinalizationRegistry(t=>{t()});function l4(t){return t.map(e=>{if(e)return Array.isArray(e)?l4(e):typeof e=="object"?"logContext"in e?e.logContext:void 0:e})}var qs;(function(t){t[t.IDLE=0]="IDLE",t[t.RUNNING=1]="RUNNING",t[t.SKIPPED=2]="SKIPPED",t[t.SUCCESS=3]="SUCCESS",t[t.FAILED=4]="FAILED"})(qs||(qs={}));class mu extends Zo.EventEmitter{constructor(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};super(),this.status=qs.IDLE,this.logs=[],this.options={},this.url=e,this.token=r,this.name=this.constructor.name,this.room=new fp(n.roomOptions),this.connectOptions=n.connectOptions,this.options=n}run(e){return ne(this,void 0,void 0,function*(){if(this.status!==qs.IDLE)throw Error("check is running already");this.setStatus(qs.RUNNING);try{yield this.perform()}catch(r){r instanceof Error&&(this.options.errorsAsWarnings?this.appendWarning(r.message):this.appendError(r.message))}return yield this.disconnect(),yield new Promise(r=>setTimeout(r,500)),this.status!==qs.SKIPPED&&this.setStatus(this.isSuccess()?qs.SUCCESS:qs.FAILED),e&&e(),this.getInfo()})}isSuccess(){return!this.logs.some(e=>e.level==="error")}connect(e){return ne(this,void 0,void 0,function*(){return this.room.state===Mr.Connected?this.room:(e||(e=this.url),yield this.room.connect(e,this.token,this.connectOptions),this.room)})}disconnect(){return ne(this,void 0,void 0,function*(){this.room&&this.room.state!==Mr.Disconnected&&(yield this.room.disconnect(),yield new Promise(e=>setTimeout(e,500)))})}skip(){this.setStatus(qs.SKIPPED)}switchProtocol(e){return ne(this,void 0,void 0,function*(){let r=!1,n=!1;if(this.room.on(tt.Reconnecting,()=>{r=!0}),this.room.once(tt.Reconnected,()=>{n=!0}),this.room.simulateScenario("force-".concat(e)),yield new Promise(i=>setTimeout(i,1e3)),!r)return;const a=Date.now()+1e4;for(;Date.now()<a;){if(n)return;yield Ca(100)}throw new Error("Could not reconnect using ".concat(e," protocol after 10 seconds"))})}appendMessage(e){this.logs.push({level:"info",message:e}),this.emit("update",this.getInfo())}appendWarning(e){this.logs.push({level:"warning",message:e}),this.emit("update",this.getInfo())}appendError(e){this.logs.push({level:"error",message:e}),this.emit("update",this.getInfo())}setStatus(e){this.status=e,this.emit("update",this.getInfo())}get engine(){var e;return(e=this.room)===null||e===void 0?void 0:e.engine}getInfo(){return{logs:this.logs,name:this.name,status:this.status,description:this.description}}}class Xde extends mu{get description(){return"Cloud regions"}perform(){return ne(this,void 0,void 0,function*(){const e=new Rr(this.url,this.token);if(!e.isCloud()){this.skip();return}const r=[],n=new Set;for(let i=0;i<3;i++){const o=yield e.getNextBestRegionUrl();if(!o)break;if(n.has(o))continue;n.add(o);const c=yield this.checkCloudRegion(o);this.appendMessage("".concat(c.region," RTT: ").concat(c.rtt,"ms, duration: ").concat(c.duration,"ms")),r.push(c)}r.sort((i,o)=>(i.duration-o.duration)*.5+(i.rtt-o.rtt)*.5);const a=r[0];this.bestStats=a,this.appendMessage("best Cloud region: ".concat(a.region))})}getInfo(){const e=super.getInfo();return e.data=this.bestStats,e}checkCloudRegion(e){return ne(this,void 0,void 0,function*(){var r,n;yield this.connect(e),this.options.protocol==="tcp"&&(yield this.switchProtocol("tcp"));const a=(r=this.room.serverInfo)===null||r===void 0?void 0:r.region;if(!a)throw new Error("Region not found");const i=yield this.room.localParticipant.streamText({topic:"test"}),o=1e3,u=1e6/o,d="A".repeat(o),f=Date.now();for(let w=0;w<u;w++)yield i.write(d);yield i.close();const h=Date.now(),m=yield(n=this.room.engine.pcManager)===null||n===void 0?void 0:n.publisher.getStats(),_={region:a,rtt:1e4,duration:h-f};return m?.forEach(w=>{w.type==="candidate-pair"&&w.nominated&&(_.rtt=w.currentRoundTripTime*1e3)}),yield this.disconnect(),_})}}const vE=1e4;class Jde extends mu{get description(){return"Connection via UDP vs TCP"}perform(){return ne(this,void 0,void 0,function*(){const e=yield this.checkConnectionProtocol("udp"),r=yield this.checkConnectionProtocol("tcp");this.bestStats=e,e.qualityLimitationDurations.bandwidth-r.qualityLimitationDurations.bandwidth>.5||(e.packetsLost-r.packetsLost)/e.packetsSent>.01?(this.appendMessage("best connection quality via tcp"),this.bestStats=r):this.appendMessage("best connection quality via udp");const n=this.bestStats;this.appendMessage("upstream bitrate: ".concat((n.bitrateTotal/n.count/1e3/1e3).toFixed(2)," mbps")),this.appendMessage("RTT: ".concat((n.rttTotal/n.count*1e3).toFixed(2)," ms")),this.appendMessage("jitter: ".concat((n.jitterTotal/n.count*1e3).toFixed(2)," ms")),n.packetsLost>0&&this.appendWarning("packets lost: ".concat((n.packetsLost/n.packetsSent*100).toFixed(2),"%")),n.qualityLimitationDurations.bandwidth>1&&this.appendWarning("bandwidth limited ".concat((n.qualityLimitationDurations.bandwidth/(vE/1e3)*100).toFixed(2),"%")),n.qualityLimitationDurations.cpu>0&&this.appendWarning("cpu limited ".concat((n.qualityLimitationDurations.cpu/(vE/1e3)*100).toFixed(2),"%"))})}getInfo(){const e=super.getInfo();return e.data=this.bestStats,e}checkConnectionProtocol(e){return ne(this,void 0,void 0,function*(){yield this.connect(),e==="tcp"?yield this.switchProtocol("tcp"):yield this.switchProtocol("udp");const r=document.createElement("canvas");r.width=1280,r.height=720;const n=r.getContext("2d");if(!n)throw new Error("Could not get canvas context");let a=0;const i=()=>{a=(a+1)%360,n.fillStyle="hsl(".concat(a,", 100%, 50%)"),n.fillRect(0,0,r.width,r.height),requestAnimationFrame(i)};i();const c=r.captureStream(30).getVideoTracks()[0],d=(yield this.room.localParticipant.publishTrack(c,{simulcast:!1,degradationPreference:"maintain-resolution",videoEncoding:{maxBitrate:2e6}})).track,f={protocol:e,packetsLost:0,packetsSent:0,qualityLimitationDurations:{},rttTotal:0,jitterTotal:0,bitrateTotal:0,count:0},h=setInterval(()=>ne(this,void 0,void 0,function*(){const m=yield d.getRTCStatsReport();m?.forEach(_=>{_.type==="outbound-rtp"?(f.packetsSent=_.packetsSent,f.qualityLimitationDurations=_.qualityLimitationDurations,f.bitrateTotal+=_.targetBitrate,f.count++):_.type==="remote-inbound-rtp"&&(f.packetsLost=_.packetsLost,f.rttTotal+=_.roundTripTime,f.jitterTotal+=_.jitter)})}),1e3);return yield new Promise(m=>setTimeout(m,vE)),clearInterval(h),c.stop(),r.remove(),yield this.disconnect(),f})}}class Qde extends mu{get description(){return"Can publish audio"}perform(){return ne(this,void 0,void 0,function*(){var e;const r=yield this.connect(),n=yield Vde();if(yield Hq(n,1e3))throw new Error("unable to detect audio from microphone");this.appendMessage("detected audio from microphone"),r.localParticipant.publishTrack(n),yield new Promise(c=>setTimeout(c,3e3));const i=yield(e=n.sender)===null||e===void 0?void 0:e.getStats();if(!i)throw new Error("Could not get RTCStats");let o=0;if(i.forEach(c=>{c.type==="outbound-rtp"&&(c.kind==="audio"||!c.kind&&c.mediaType==="audio")&&(o=c.packetsSent)}),o===0)throw new Error("Could not determine packets are sent");this.appendMessage("published ".concat(o," audio packets"))})}}class Zde extends mu{get description(){return"Can publish video"}perform(){return ne(this,void 0,void 0,function*(){var e;const r=yield this.connect(),n=yield $de();yield this.checkForVideo(n.mediaStreamTrack),r.localParticipant.publishTrack(n),yield new Promise(o=>setTimeout(o,5e3));const a=yield(e=n.sender)===null||e===void 0?void 0:e.getStats();if(!a)throw new Error("Could not get RTCStats");let i=0;if(a.forEach(o=>{o.type==="outbound-rtp"&&(o.kind==="video"||!o.kind&&o.mediaType==="video")&&(i+=o.packetsSent)}),i===0)throw new Error("Could not determine packets are sent");this.appendMessage("published ".concat(i," video packets"))})}checkForVideo(e){return ne(this,void 0,void 0,function*(){const r=new MediaStream;r.addTrack(e.clone());const n=document.createElement("video");n.srcObject=r,n.muted=!0,n.autoplay=!0,n.playsInline=!0,n.setAttribute("playsinline","true"),document.body.appendChild(n),yield new Promise(a=>{n.onplay=()=>{setTimeout(()=>{var i,o,c,u;const d=document.createElement("canvas"),f=e.getSettings(),h=(o=(i=f.width)!==null&&i!==void 0?i:n.videoWidth)!==null&&o!==void 0?o:1280,m=(u=(c=f.height)!==null&&c!==void 0?c:n.videoHeight)!==null&&u!==void 0?u:720;d.width=h,d.height=m;const _=d.getContext("2d");_.drawImage(n,0,0);const b=_.getImageData(0,0,d.width,d.height).data;let E=!0;for(let T=0;T<b.length;T+=4)if(b[T]!==0||b[T+1]!==0||b[T+2]!==0){E=!1;break}E?this.appendError("camera appears to be producing only black frames"):this.appendMessage("received video frames"),a()},1e3)},n.play()}),r.getTracks().forEach(a=>a.stop()),n.remove()})}}class efe extends mu{get description(){return"Resuming connection after interruption"}perform(){return ne(this,void 0,void 0,function*(){var e;const r=yield this.connect();let n=!1,a=!1,i;const o=new Promise(d=>{setTimeout(d,5e3),i=d}),c=()=>{n=!0};r.on(tt.SignalReconnecting,c).on(tt.Reconnecting,c).on(tt.Reconnected,()=>{a=!0,i(!0)}),(e=r.engine.client.ws)===null||e===void 0||e.close();const u=r.engine.client.onClose;if(u&&u(""),yield o,n){if(!a||r.state!==Mr.Connected)throw this.appendWarning("reconnection is only possible in Redis-based configurations"),new Error("Not able to reconnect")}else throw new Error("Did not attempt to reconnect")})}}class tfe extends mu{get description(){return"Can connect via TURN"}perform(){return ne(this,void 0,void 0,function*(){var e,r,n;dp(new URL(this.url))&&(this.appendMessage("Using region specific url"),this.url=(e=yield new Rr(this.url,this.token).getNextBestRegionUrl())!==null&&e!==void 0?e:this.url);const a=new XP,i=yield a.join(this.url,this.token,{autoSubscribe:!0,maxRetries:0,e2eeEnabled:!1,websocketTimeout:15e3},void 0,!0);let o=!1,c=!1,u=!1;for(let d of i.iceServers)for(let f of d.urls)f.startsWith("turn:")?(c=!0,u=!0):f.startsWith("turns:")&&(c=!0,u=!0,o=!0),f.startsWith("stun:")&&(u=!0);u?c&&!o&&this.appendWarning("TURN is configured server side, but TURN/TLS is unavailable."):this.appendWarning("No STUN servers configured on server side."),yield a.close(),!((n=(r=this.connectOptions)===null||r===void 0?void 0:r.rtcConfig)===null||n===void 0)&&n.iceServers||c?yield this.room.connect(this.url,this.token,{rtcConfig:{iceTransportPolicy:"relay"}}):(this.appendWarning("No TURN servers configured."),this.skip(),yield new Promise(d=>setTimeout(d,0)))})}}class rfe extends mu{get description(){return"Establishing WebRTC connection"}perform(){return ne(this,void 0,void 0,function*(){let e=!1,r=!1;this.room.on(tt.SignalConnected,()=>{var n;const a=this.room.engine.client.onTrickle;this.room.engine.client.onTrickle=(i,o)=>{if(i.candidate){const c=new RTCIceCandidate(i);let u="".concat(c.protocol," ").concat(c.address,":").concat(c.port," ").concat(c.type);c.address&&(nfe(c.address)?u+=" (private)":c.protocol==="tcp"&&c.tcpType==="passive"?(e=!0,u+=" (passive)"):c.protocol==="udp"&&(r=!0)),this.appendMessage(u)}a&&a(i,o)},!((n=this.room.engine.pcManager)===null||n===void 0)&&n.subscriber&&(this.room.engine.pcManager.subscriber.onIceCandidateError=i=>{i instanceof RTCPeerConnectionIceErrorEvent&&this.appendWarning("error with ICE candidate: ".concat(i.errorCode," ").concat(i.errorText," ").concat(i.url))})});try{yield this.connect(),or.info("now the room is connected")}catch(n){throw this.appendWarning("ports need to be open on firewall in order to connect."),n}e||this.appendWarning("Server is not configured for ICE/TCP"),r||this.appendWarning("No public IPv4 UDP candidates were found. Your server is likely not configured correctly")})}}function nfe(t){const e=t.split(".");if(e.length===4){if(e[0]==="10")return!0;if(e[0]==="192"&&e[1]==="168")return!0;if(e[0]==="172"){const r=parseInt(e[1],10);if(r>=16&&r<=31)return!0}}return!1}class afe extends mu{get description(){return"Connecting to signal connection via WebSocket"}perform(){return ne(this,void 0,void 0,function*(){var e,r,n;(this.url.startsWith("ws:")||this.url.startsWith("http:"))&&this.appendWarning("Server is insecure, clients may block connections to it");let a=new XP,i;try{i=yield a.join(this.url,this.token,{autoSubscribe:!0,maxRetries:0,e2eeEnabled:!1,websocketTimeout:15e3},void 0,!0)}catch(o){if(dp(new URL(this.url))){this.appendMessage("Initial connection failed with error ".concat(o.message,". Retrying with region fallback"));const u=yield new Rr(this.url,this.token).getNextBestRegionUrl();u&&(i=yield a.join(u,this.token,{autoSubscribe:!0,maxRetries:0,e2eeEnabled:!1,websocketTimeout:15e3},void 0,!0),this.appendMessage("Fallback to region worked. To avoid initial connections failing, ensure you're calling room.prepareConnection() ahead of time"))}}i?(this.appendMessage("Connected to server, version ".concat(i.serverVersion,".")),((e=i.serverInfo)===null||e===void 0?void 0:e.edition)===X5.Cloud&&(!((r=i.serverInfo)===null||r===void 0)&&r.region)&&this.appendMessage("LiveKit Cloud: ".concat((n=i.serverInfo)===null||n===void 0?void 0:n.region))):this.appendError("Websocket connection could not be established"),yield a.close()})}}class FSe extends Zo.EventEmitter{constructor(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};super(),this.options={},this.checkResults=new Map,this.url=e,this.token=r,this.options=n}getNextCheckId(){const e=this.checkResults.size;return this.checkResults.set(e,{logs:[],status:qs.IDLE,name:"",description:""}),e}updateCheck(e,r){this.checkResults.set(e,r),this.emit("checkUpdate",e,r)}isSuccess(){return Array.from(this.checkResults.values()).every(e=>e.status!==qs.FAILED)}getResults(){return Array.from(this.checkResults.values())}createAndRunCheck(e){return ne(this,void 0,void 0,function*(){const r=this.getNextCheckId(),n=new e(this.url,this.token,this.options),a=o=>{this.updateCheck(r,o)};n.on("update",a);const i=yield n.run();return n.off("update",a),i})}checkWebsocket(){return ne(this,void 0,void 0,function*(){return this.createAndRunCheck(afe)})}checkWebRTC(){return ne(this,void 0,void 0,function*(){return this.createAndRunCheck(rfe)})}checkTURN(){return ne(this,void 0,void 0,function*(){return this.createAndRunCheck(tfe)})}checkReconnect(){return ne(this,void 0,void 0,function*(){return this.createAndRunCheck(efe)})}checkPublishAudio(){return ne(this,void 0,void 0,function*(){return this.createAndRunCheck(Qde)})}checkPublishVideo(){return ne(this,void 0,void 0,function*(){return this.createAndRunCheck(Zde)})}checkConnectionProtocol(){return ne(this,void 0,void 0,function*(){const e=yield this.createAndRunCheck(Jde);if(e.data&&"protocol"in e.data){const r=e.data;this.options.protocol=r.protocol}return e})}checkCloudRegion(){return ne(this,void 0,void 0,function*(){return this.createAndRunCheck(Xde)})}}function _r(t,e,r){return(e=sfe(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ife(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function sfe(t){var e=ife(t,"string");return typeof e=="symbol"?e:e+""}new TextEncoder;new TextDecoder;class Xa extends Error{constructor(e,r){var n;super(e,r),_r(this,"code","ERR_JOSE_GENERIC"),this.name=this.constructor.name,(n=Error.captureStackTrace)===null||n===void 0||n.call(Error,this,this.constructor)}}_r(Xa,"code","ERR_JOSE_GENERIC");class ofe extends Xa{constructor(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"unspecified",a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:a,payload:r}}),_r(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED"),_r(this,"claim",void 0),_r(this,"reason",void 0),_r(this,"payload",void 0),this.claim=n,this.reason=a,this.payload=r}}_r(ofe,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");class cfe extends Xa{constructor(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"unspecified",a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:a,payload:r}}),_r(this,"code","ERR_JWT_EXPIRED"),_r(this,"claim",void 0),_r(this,"reason",void 0),_r(this,"payload",void 0),this.claim=n,this.reason=a,this.payload=r}}_r(cfe,"code","ERR_JWT_EXPIRED");class lfe extends Xa{constructor(){super(...arguments),_r(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}}_r(lfe,"code","ERR_JOSE_ALG_NOT_ALLOWED");class ufe extends Xa{constructor(){super(...arguments),_r(this,"code","ERR_JOSE_NOT_SUPPORTED")}}_r(ufe,"code","ERR_JOSE_NOT_SUPPORTED");class dfe extends Xa{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"decryption operation failed",r=arguments.length>1?arguments[1]:void 0;super(e,r),_r(this,"code","ERR_JWE_DECRYPTION_FAILED")}}_r(dfe,"code","ERR_JWE_DECRYPTION_FAILED");class ffe extends Xa{constructor(){super(...arguments),_r(this,"code","ERR_JWE_INVALID")}}_r(ffe,"code","ERR_JWE_INVALID");class pfe extends Xa{constructor(){super(...arguments),_r(this,"code","ERR_JWS_INVALID")}}_r(pfe,"code","ERR_JWS_INVALID");class hfe extends Xa{constructor(){super(...arguments),_r(this,"code","ERR_JWT_INVALID")}}_r(hfe,"code","ERR_JWT_INVALID");class mfe extends Xa{constructor(){super(...arguments),_r(this,"code","ERR_JWK_INVALID")}}_r(mfe,"code","ERR_JWK_INVALID");class gfe extends Xa{constructor(){super(...arguments),_r(this,"code","ERR_JWKS_INVALID")}}_r(gfe,"code","ERR_JWKS_INVALID");class yfe extends Xa{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"no applicable key found in the JSON Web Key Set",r=arguments.length>1?arguments[1]:void 0;super(e,r),_r(this,"code","ERR_JWKS_NO_MATCHING_KEY")}}_r(yfe,"code","ERR_JWKS_NO_MATCHING_KEY");class vfe extends Xa{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"multiple matching keys found in the JSON Web Key Set",r=arguments.length>1?arguments[1]:void 0;super(e,r),_r(this,Symbol.asyncIterator,void 0),_r(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}}_r(vfe,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");class _fe extends Xa{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"request timed out",r=arguments.length>1?arguments[1]:void 0;super(e,r),_r(this,"code","ERR_JWKS_TIMEOUT")}}_r(_fe,"code","ERR_JWKS_TIMEOUT");class bfe extends Xa{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"signature verification failed",r=arguments.length>1?arguments[1]:void 0;super(e,r),_r(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}}_r(bfe,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");const u4=v.createContext(null),kfe=()=>v.useContext(u4);function wfe({children:t}){const{user:e}=$r(),r=ks(),n=e?.id,a=!!(e?.email&&/@guest\.local$/i.test(e.email)),i=!!n&&!a,o=v.useRef(null),[c,u]=v.useState(null),[d,f]=v.useState(!1),[h,m]=v.useState(!1),[_,w]=v.useState(null),[b,E]=v.useState([]),[T,D]=v.useState(null),[P,A]=v.useState(!1),[C,O]=v.useState(!1),[I,x]=v.useState(null),R=v.useCallback(()=>{const ie=o.current;if(!ie){E([]),D(null);return}const G=[];ie.remoteParticipants.forEach(K=>{const ae=K.getTrackPublication(Ke.Source.Camera)?.track,te=K.getTrackPublication(Ke.Source.Microphone)?.track;G.push({id:K.identity,name:K.name||K.identity,isSelf:!1,audioEnabled:K.isMicrophoneEnabled,videoEnabled:K.isCameraEnabled,isSpeaking:K.isSpeaking,videoTrack:ae||void 0,audioTrack:te||void 0})}),E(G);const B=ie.localParticipant;if(B){const ae=B.getTrackPublication(Ke.Source.Camera)?.track,te=B.getTrackPublication(Ke.Source.Microphone)?.track;D({id:B.identity,name:B.name||B.identity,isSelf:!0,audioEnabled:B.isMicrophoneEnabled,videoEnabled:B.isCameraEnabled,isSpeaking:B.isSpeaking,videoTrack:ae||void 0,audioTrack:te||void 0}),x(ae||null),A(B.isMicrophoneEnabled),O(B.isCameraEnabled)}},[]),N=v.useRef(null),L=v.useRef(!1),j=v.useCallback(async ie=>{if(!i||!r){w("Not authenticated");return}if(N.current!==ie){if(o.current){try{o.current.disconnect()}catch{}o.current=null}N.current=ie,L.current=!1,m(!0),w(null);try{const G=await new Promise(Ae=>{r.emit("livekit_join",{roomId:ie},Ae)});if(L.current){N.current=null;return}if(!G?.ok)throw new Error(G?.error||"Failed to get LiveKit token");const{token:B,url:K,iceServers:ae}=G,te={};ae&&Array.isArray(ae)&&ae.length>0&&(te.iceServers=ae,te.iceTransportPolicy="all");const me=new fp({adaptiveStream:!0,dynacast:!0,videoCaptureDefaults:{resolution:up.h540.resolution}});await me.prepareConnection(K,B),me.on(tt.Connected,()=>{f(!0),m(!1),R()}),me.on(tt.Disconnected,()=>{f(!1),u(null),R()}),me.on(tt.ParticipantConnected,Ae=>{R()}),me.on(tt.ParticipantDisconnected,Ae=>{R()}),me.on(tt.TrackSubscribed,(Ae,He,ce)=>{R()}),me.on(tt.TrackUnsubscribed,(Ae,He,ce)=>{R()}),me.on(tt.LocalTrackPublished,(Ae,He)=>{R()}),me.on(tt.LocalTrackUnpublished,(Ae,He)=>{R()}),me.on(tt.ActiveSpeakersChanged,()=>{R()}),me.on(tt.ConnectionStateChanged,Ae=>{Ae===Mr.Disconnected&&f(!1)});const ue=Object.keys(te).length>0?{rtcConfig:te}:void 0;if(await me.connect(K,B,ue),L.current){me.disconnect(),N.current=null;return}o.current=me,u(ie),N.current=null}catch(G){w(G?.message||"Failed to join room"),m(!1),N.current=null}}},[i,r,R]),q=v.useCallback(()=>{L.current=!0,N.current=null;const ie=o.current;if(ie){try{ie.disconnect()}catch{}o.current=null}f(!1),m(!1),u(null),E([]),D(null),x(null)},[]),U=v.useCallback(async()=>{const ie=o.current;if(ie)try{await ie.localParticipant.setMicrophoneEnabled(!P),A(!P)}catch{}},[P]),W=v.useCallback(async()=>{const ie=o.current;if(ie)try{await ie.localParticipant.setCameraEnabled(!C),O(!C),R()}catch{}},[C,R]),F=v.useCallback(async ie=>{const G=o.current;if(G)try{await G.localParticipant.setMicrophoneEnabled(ie),A(ie)}catch{}},[]),Y=v.useCallback(async ie=>{const G=o.current;if(G)try{await G.localParticipant.setCameraEnabled(ie),O(ie),R()}catch{}},[R]);v.useEffect(()=>()=>{if(L.current=!0,N.current=null,o.current){try{o.current.disconnect()}catch{}o.current=null}},[]);const Q={connected:d,connecting:h,error:_,joinRoom:j,leaveRoom:q,currentRoomId:c,participants:b,localParticipant:T,micEnabled:P,videoEnabled:C,toggleMic:U,toggleVideo:W,setMicEnabled:F,setVideoEnabled:Y,localVideoTrack:I};return g.jsx(u4.Provider,{value:Q,children:t})}const Dc={diceAudio:!0,backgroundMusic:!0,chatAudio:!1,video:!1,showAnimations:!0,lastGameMode:"cee-lo",diceColorTheme:"dice_white_black"},d4="app:settings:v1";async function au(){try{const{value:t}=await ms.get({key:d4});if(!t)return{...Dc};const e=JSON.parse(t);return{...Dc,...e}}catch{return{...Dc}}}async function y0(t){await ms.set({key:d4,value:JSON.stringify(t)})}const Sfe={BASE_URL:"./",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_APP_TARGET:"poker",VITE_OTA:"1"},Km=500,f4=new Array(Km);let ym=0,hb=0;function Efe(){try{if(typeof window<"u"&&window.localStorage?.getItem("logs:disable")==="1"||typeof import.meta<"u"&&Sfe?.VITE_LOGS_DISABLED==="1")return!1}catch{}return!0}function Tfe(t){f4[ym]=t,ym=(ym+1)%Km,hb=Math.min(hb+1,Km);try{window.dispatchEvent(new CustomEvent("fe:log",{detail:t}))}catch{}}function p4(){const t=[],e=hb;for(let r=0;r<e;r++){const n=(ym-e+r+Km)%Km,a=f4[n];a&&t.push(a)}return t}function Cfe(){ym=0,hb=0}function kv(t,e,r,n){const a={t:Date.now(),tag:t,level:e,msg:r,data:n};if(Efe()){`${new Date(a.t).toISOString()}${t}${e}`;try{const i=n===void 0?[]:[n]}catch{}Tfe(a)}}const Bt={debug:(t,e)=>kv("RTC","debug",t,e),info:(t,e)=>kv("RTC","info",t,e),warn:(t,e)=>kv("RTC","warn",t,e),error:(t,e)=>kv("RTC","error",t,e)};try{window.rtcLogs=p4,window.rtcLogsClear=Cfe}catch{}const h4=v.createContext(null),xfe=()=>v.useContext(h4);function fn(t){return t.connectionState==="closed"||t.signalingState==="closed"}function wv(t){if(t)try{t.getTracks().forEach(e=>e.stop())}catch{}}function Pfe(t){try{const e=t.getAudioTracks?.()||[],r=t.getVideoTracks?.()||[],n=e.map(i=>({id:i.id,kind:i.kind,enabled:i.enabled,ready:i.readyState})),a=r.map(i=>({id:i.id,kind:i.kind,enabled:i.enabled,ready:i.readyState,settings:i.getSettings?.()||void 0}));return{id:t.id,audioTracks:n.length,videoTracks:a.length,audio:n,video:a}}catch{return{id:t?.id}}}const Afe=(()=>{if(typeof navigator>"u")return!1;const t=navigator.userAgent||navigator.vendor||window.opera||"";return/iPad|iPhone|iPod/.test(t)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1})();function Ih(t,e){const r=new Set,n=[],a=i=>{const o=Array.isArray(i.urls)?i.urls:i.urls?[i.urls]:[];for(const c of o){if(!c||typeof c!="string")continue;const u=c.trim();if(u.startsWith("stun:")){const d=`${u}|`;r.has(d)||(r.add(d),n.push({urls:u}));continue}if(u.startsWith("turn:")||u.startsWith("turns:")){const d=i.username,f=i.credential;if(d&&f){const h=`${u}|${d}|${f}`;r.has(h)||(r.add(h),n.push({urls:u,username:d,credential:f}))}}}};return(t||[]).forEach(a),n.length===0&&e.forEach(a),n.length?n:e}function Rfe(t,e){if(!e.heartbeat){try{e.dc||(e.dc=e.pc.createDataChannel("ka",{negotiated:!1,ordered:!0}))}catch{}e.heartbeat=window.setInterval(()=>{try{e.dc?.readyState==="open"&&e.dc.send("ping")}catch{}},12e3)}}function Mh(t){t.heartbeat&&(clearInterval(t.heartbeat),t.heartbeat=void 0);try{t.dc?.close()}catch{}t.dc=void 0}function Dfe({children:t}){const{user:e}=$r(),r=ks(),n=e?.id,a=!!(e?.email&&/@guest\.local$/i.test(e.email)),i=!!n&&!a;function o(Z,X){try{const le=window;le.__rtcVideoDisableReasons||(le.__rtcVideoDisableReasons=[]),le.__rtcVideoDisableReasons.push({t:Date.now(),reason:Z,...X?{data:X}:{}});try{PC(`video:disable:${Z}`)}catch{}}catch{}}const{rtcJoin:c,rtcSignal:u,rtcLeave:d,rtcSetVideoEnabled:f}=pa(),h=v.useRef(new Map),[m,_]=v.useState({}),w=null,[b,E]=v.useState({}),[T,D]=v.useState(void 0),P=v.useRef(void 0),A=v.useRef(void 0),C=v.useRef(""),O=v.useRef(new Map),I=v.useRef(new Map),[x,R]=v.useState(!1),[N,L]=v.useState(!1),j=[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:stun1.l.google.com:19302"}],q=v.useRef([...j]),[U,W]=v.useState(0),F=v.useRef(null);v.useRef([]);const Y=v.useRef({audio:!1,video:!1}),Q=U>0||N||x,ie=v.useCallback(async()=>{try{const Z=navigator;Z?.wakeLock?.request&&!F.current&&(F.current=await Z.wakeLock.request("screen"),F.current.addEventListener("release",()=>{}))}catch{}},[]),G=v.useCallback(async()=>{try{await F.current?.release?.()}catch{}F.current=null},[]);v.useEffect(()=>(Bt.debug("wakeLock:effect",{need:Q}),Q?ie():G(),()=>{G()}),[Q,ie,G]),v.useEffect(()=>{const Z=()=>{document.visibilityState==="visible"&&Q&&ie()};return document.addEventListener("visibilitychange",Z),()=>document.removeEventListener("visibilitychange",Z)},[Q,ie]);const B=(()=>{try{return window.Capacitor?.getPlatform?.()==="ios"}catch{return!1}})();async function K(Z,X){if(!i||Y.current[X])return null;Y.current[X]=!0;try{return navigator.mediaDevices?.getUserMedia?await navigator.mediaDevices.getUserMedia(Z):(Bt.error("gUM:not-available",{kind:X,isNativeIOS:B}),null)}catch(le){return Bt.error("gUM:failed",{kind:X,errName:le?.name,errMsg:le?.message,isNativeIOS:B}),null}finally{Y.current[X]=!1}}async function ae(){if(!i)return;if(A.current)return A.current;const Z=await K({audio:!0,video:!1},"audio");if(Z){const X=Z.getAudioTracks()[0];X&&(X.enabled=!1),A.current=Z}return A.current}async function te(){if(!i)return;if(P.current)return P.current;const X=await K({audio:!1,video:Afe?{facingMode:{ideal:"user"},width:{ideal:640,max:1280},height:{ideal:480,max:720},frameRate:{ideal:24,max:30}}:{facingMode:{ideal:"user"},width:{ideal:1280},height:{ideal:720},frameRate:{ideal:30}}},"video");return X&&(P.current=X,D(X),Bt.info("ensureVideo:acquired",Pfe(X))),P.current}function me(){const Z=P.current?.getVideoTracks()??[];try{Z.forEach(X=>{X.stop()})}catch{}P.current=void 0,D(void 0)}function ue(){try{A.current?.getAudioTracks()?.forEach(Z=>Z.stop())}catch{}A.current=void 0}const Ae=v.useRef(new Map),[He,ce]=v.useState({});function xe(Z,X){if(Ae.current.get(Z))return;const le=X?.getAudioTracks?.()??[];if(!le.length||le.every(Ye=>Ye.readyState!=="live"))return;let be;try{be=new AudioContext}catch(Ye){Bt.warn("vad:audiocontext-failed",{pid:Z,err:String(Ye)});return}let z,ee;try{z=be.createMediaStreamSource(X),ee=be.createAnalyser(),ee.fftSize=2048,z.connect(ee)}catch(Ye){Bt.warn("vad:setup-failed",{pid:Z,err:String(Ye)});try{be.close()}catch{}return}const se=new Uint8Array(ee.fftSize);let Oe=0;const wt=.04,er=.02;let Qt=!1,Zt=!1;const oa=()=>{if(!Zt){try{ee.getByteTimeDomainData(se);let Ye=0;for(let At=0;At<se.length;At++){const Rt=(se[At]-128)/128;Ye+=Rt*Rt}const Yt=Math.sqrt(Ye/se.length);!Qt&&Yt>=wt?(Qt=!0,ce(At=>At[Z]===!0?At:{...At,[Z]:!0})):Qt&&Yt<=er&&(Qt=!1,ce(At=>At[Z]===!1?At:{...At,[Z]:!1}))}catch{}Zt||(Oe=requestAnimationFrame(oa))}};Oe=requestAnimationFrame(oa);const On=()=>{Zt=!0,cancelAnimationFrame(Oe);try{z.disconnect()}catch{}try{ee.disconnect()}catch{}be.close().catch(()=>{})};Ae.current.set(Z,On)}function re(Z){const X=Ae.current.get(Z);X&&(X(),Ae.current.delete(Z)),ce(le=>{if(!(Z in le))return le;const be={...le};return delete be[Z],be})}function H(Z,X){try{return fn(Z)?void 0:Z.getTransceivers().find(le=>le.receiver.track?.kind===X)??Z.getTransceivers().find(le=>le.sender.track?.kind===X)??Z.getTransceivers()[X==="audio"?0:1]}catch{return}}function he(Z,X){try{return fn(Z)?void 0:Z.getSenders().find(le=>le.track?.kind===X)??H(Z,X)?.sender}catch{return}}async function Re(Z,X){try{if(fn(Z))return;const le=X?.getAudioTracks?.()[0]??null,be=he(Z,"audio");be&&await be.replaceTrack(le)}catch(le){Bt.warn("upsertAudioTrack:failed",{err:String(le)})}}async function fe(Z,X){try{if(fn(Z))return;const le=X?.getVideoTracks?.()[0]??null,be=he(Z,"video");be&&await be.replaceTrack(le)}catch(le){Bt.warn("upsertVideoTrack:failed",{err:String(le)})}}async function Ie(Z,X){try{const le=X.pc,be=Date.now();let z=0,ee=0;(await le.getStats()).forEach(wt=>{wt.type==="outbound-rtp"&&!wt.isRemote&&(z+=wt.bytesSent??0),wt.type==="inbound-rtp"&&!wt.isRemote&&(ee+=wt.bytesReceived??0)});const Oe=I.current.get(Z);I.current.set(Z,{t:be,up:z,down:ee}),Oe&&le.connectionState==="connected"&&z===Oe.up&&ee===Oe.down&&be-Oe.t>2e4&&await _t(Z,X)}catch{}}function ct(Z,X){if(O.current.get(Z))return;const le=window.setInterval(()=>Ie(Z,X),1e4);O.current.set(Z,le)}function $e(Z){const X=O.current.get(Z);X&&(clearInterval(X),O.current.delete(Z)),I.current.delete(Z)}function rt(){const Z=typeof window<"u"?new URL(window.location.href):null,X=typeof localStorage<"u"&&(localStorage.getItem("rtcRelayOnly")==="1"||localStorage.getItem("rtcRelayOnly")==="true")||Z?.searchParams.get("rtcRelay")==="1"||Z?.searchParams.get("rtcRelay")==="true",le=!!it._compat,be=!!(X||le),z={iceServers:Ih(q.current,j),bundlePolicy:"balanced",iceTransportPolicy:be?"relay":"all",rtcpMuxPolicy:"require",iceCandidatePoolSize:2};z.iceServers.some(se=>(Array.isArray(se.urls)?se.urls:[se.urls]).some(wt=>wt.startsWith("turn:")||wt.startsWith("turns:"))),Bt.debug("pc:new",{relayOnly:be,iceTransportPolicy:z.iceTransportPolicy,iceServers:(z.iceServers||[]).map(se=>typeof se.urls=="string"?se.urls:se.urls?.[0])});let ee;try{ee=new RTCPeerConnection(z)}catch(se){Bt.error("pc:new-failed",{err:String(se),servers:z.iceServers});const Oe={...z,iceServers:j};ee=new RTCPeerConnection(Oe)}return ee.addTransceiver("audio",{direction:"sendrecv"}),ee.addTransceiver("video",{direction:"sendrecv"}),ee}async function We(Z,X){try{const le=await X.getStats(),be={};le.forEach(ee=>{ee&&ee.id&&(be[ee.id]=ee)});let z;if(le.forEach(ee=>{ee.type==="transport"&&ee.selectedCandidatePairId&&be[ee.selectedCandidatePairId]&&(z=be[ee.selectedCandidatePairId])}),z||le.forEach(ee=>{ee.type==="candidate-pair"&&(ee.selected||ee.state==="succeeded")&&(z=ee)}),z){const ee=be[z.localCandidateId],se=be[z.remoteCandidateId];Bt.info("ice:selected",{peerId:Z,state:z.state,nominated:z.nominated,bytesSent:z.bytesSent,bytesReceived:z.bytesReceived,local:ee?{type:ee.candidateType,protocol:ee.protocol,address:ee.address,port:ee.port}:void 0,remote:se?{type:se.candidateType,protocol:se.protocol,address:se.address,port:se.port}:void 0})}else Bt.debug("ice:selected:none",{peerId:Z})}catch(le){Bt.error("ice:selected-failed",{peerId:Z,err:String(le)})}}async function it(){try{if(it._ran)return;it._ran=!0;const Z={iceServers:Ih(q.current,j),bundlePolicy:"balanced",iceTransportPolicy:"all"},X=new RTCPeerConnection(Z),le={host:0,srflx:0,relay:0,prflx:0};X.onicecandidate=wt=>{if(!wt.candidate)return;const Zt=(wt.candidate.candidate||"").match(/ typ ([a-z]+)/)?.[1]||"unknown";le[Zt]===void 0&&(le[Zt]=0),le[Zt]+=1},X.createDataChannel("probe");const be=await X.createOffer({iceRestart:!1});await X.setLocalDescription(be),await new Promise(wt=>setTimeout(wt,4e3));try{X.close()}catch{}const z=(le.relay||0)>0,ee=(le.srflx||0)>0,se=(le.host||0)>0,Oe=z&&!ee&&se;if(Oe){Bt.warn("ice:probe-forcing-relay",{counts:le,reason:"no-srflx"}),it._compat=!0;try{localStorage.setItem("rtcRelayOnly","1")}catch{}}else!z&&!ee&&Bt.error("ice:probe-restricted-network",{counts:le,warning:"Voice/video may not work"});Bt.info("ice:probe",{counts:le,relayOK:z,srflxOK:ee,needsRelayOnly:Oe})}catch(Z){Bt.error("ice:probe-failed",{err:String(Z)})}}function Et(Z){let X=h.current.get(Z);if(X)return X;const le=rt(),be={pc:le,iceBuffer:[],makingOffer:!1,ignoreOffer:!1,isSettingRemoteAnswerPending:!1};return le.onicecandidate=z=>{z.candidate&&(Bt.debug("pc:icecandidate",{peerId:Z,ctype:z.candidate.type,proto:z.candidate.protocol,addr:z.candidate.address,port:z.candidate.port}),u(C.current,Z,{ice:z.candidate.toJSON()}).catch(console.error))},le.ontrack=z=>{if(Bt.info("pc:ontrack",{peerId:Z,kind:z.track.kind,id:z.track.id}),_(ee=>{const se=ee[Z]??new MediaStream;return se.getTracks().includes(z.track)||(se.addTrack(z.track),z.track.addEventListener("ended",()=>{Bt.debug("pc:track-ended",{peerId:Z,kind:z.track.kind,id:z.track.id}),_(Oe=>{const wt=Oe[Z];if(!wt)return Oe;try{wt.removeTrack(z.track)}catch{}return{...Oe,[Z]:wt}}),z.track.kind==="video"&&E(Oe=>({...Oe,[Z]:!1}))}),z.track.kind==="video"&&(z.track.addEventListener("mute",()=>{E(Oe=>({...Oe,[Z]:!1}))}),z.track.addEventListener("unmute",()=>{z.track.readyState==="live"&&E(Oe=>({...Oe,[Z]:!0}))}))),{...ee,[Z]:se}}),z.track.kind==="video"){const ee=z.track.readyState==="live"&&!z.track.muted;E(se=>({...se,[Z]:ee}))}},le.onnegotiationneeded=()=>{Bt.debug("pc:onnegotiationneeded",{peerId:Z})},le.onconnectionstatechange=()=>{const{connectionState:z}=le,ee=le.iceConnectionState;if(Bt.info("pc:state",{peerId:Z,state:z,ice:ee}),z==="connected"&&(be.degradedAt=null,be.iceRestartCount=0,be.rebuildAttempts=0,Rfe(Z,be),ct(Z,be),setTimeout(()=>We(Z,le),500)),z==="closed"&&(Mh(be),$e(Z)),(z==="disconnected"||Mt(z,ee))&&!be.degradedAt&&(be.degradedAt=Date.now()),z==="disconnected"&&be.degradedAt){const Oe=Date.now()-be.degradedAt;Oe>3e3&&Oe<8e3?_t(Z,be):Oe>=8e3&&(Bt.warn("pc:prolonged-disconnect",{peerId:Z,degradedMs:Oe}),nt(Z))}Mt(z,ee)&&_t(Z,be)},le.oniceconnectionstatechange=()=>{const z=le.iceConnectionState;Bt.debug("pc:ice-state",{peerId:Z,ice:z}),z==="failed"&&_t(Z,be),z==="disconnected"&&setTimeout(()=>{!fn(le)&&le.iceConnectionState==="disconnected"&&(Bt.warn("ice:prolonged-disconnect",{peerId:Z}),_t(Z,be))},4e3)},le.onicegatheringstatechange=()=>{},le.ondatachannel=z=>{if(z.channel.label==="ka"){const ee=z.channel;be.dc=ee,Bt.debug("pc:datachannel",{peerId:Z,label:ee.label,state:ee.readyState})}},h.current.set(Z,be),W(h.current.size),Bt.info("peer:new",{peerId:Z}),be}function Mt(Z,X){return Z==="failed"||X==="failed"}async function _t(Z,X){if(fn(X.pc))return;const le=Date.now(),be=X.lastIceRestartAt,z=X.iceRestartCount??0,ee=Math.min(1e4*Math.pow(2,z),6e4);if(!(be&&le-be<ee)){if(z>=3){Bt.warn("ice:restart-exhausted",{peerId:Z,restartCount:z}),X.iceRestartCount=0,await nt(Z);return}if(Bt.warn("ice:restart",{peerId:Z,attempt:z+1}),!(X.makingOffer||fn(X.pc))&&(X.pc.signalingState!=="stable"&&await jt(X.pc),!fn(X.pc)))try{const se=await X.pc.createOffer({iceRestart:!0});if(fn(X.pc))return;await X.pc.setLocalDescription(se),await u(C.current,Z,{sdp:X.pc.localDescription}),X.lastIceRestartAt=le,X.iceRestartCount=z+1}catch(se){Bt.error("ice:restart-failed",{peerId:Z,err:String(se)}),X.iceRestartCount=0,await nt(Z)}}}const ge=v.useRef(new Map),Be=3,je=3e4;async function nt(Z){const X=ge.current.get(Z)??{count:0,lastAt:0},le=Date.now();if(le-X.lastAt>je*3&&(X.count=0),X.count>=Be){const se=je-(le-X.lastAt);if(se>0){Bt.warn("rebuild:rate-limited",{peerId:Z,attempts:X.count,waitMs:se}),setTimeout(()=>{ge.current.delete(Z),nt(Z)},se);return}X.count=0}X.count++,X.lastAt=le,ge.current.set(Z,X),Bt.info("rebuild:peer",{peerId:Z,attempt:X.count});const be=h.current.get(Z);if(be){Mh(be);try{be.pc.close()}catch{}h.current.delete(Z)}_(se=>{if(!se[Z])return se;const Oe={...se};return wv(Oe[Z]),delete Oe[Z],Oe}),re(Z),E(se=>{const{[Z]:Oe,...wt}=se;return wt});const{pc:z}=Et(Z);await st(z);const ee=h.current.get(Z);await De(Z,z,ee)}function Ct(Z){return Z.signalingState==="stable"}function jt(Z){return Z.signalingState==="stable"||fn(Z)?Promise.resolve():new Promise(X=>{const le=()=>{const be=Z.signalingState;(be==="stable"||be==="closed")&&(Z.removeEventListener("signalingstatechange",le),X())};Z.addEventListener("signalingstatechange",le)})}async function De(Z,X,le){try{if(fn(X)||(Ct(X)||await jt(X),!Ct(X)||le.makingOffer||fn(X)))return;le.makingOffer=!0,Bt.debug("sdp:offer",{peerId:Z});const be=await X.createOffer();if(fn(X)){le.makingOffer=!1;return}await X.setLocalDescription(be),await u(C.current,Z,{sdp:X.localDescription})}catch(be){Bt.warn("safeRenegotiate:failed",{peerId:Z,err:String(be)})}finally{le.makingOffer=!1}}const et=v.useCallback(async Z=>{if(Z!==N){if(!i){L(!1),o("preferences:init"),L(!1);return}if(L(Z),n&&E(X=>({...X,[n]:Z})),Z){try{am(!0)}catch{}if(!await te()){L(!1),n&&E(z=>({...z,[n]:!1}));return}for(const[z,ee]of h.current)await fe(ee.pc,P.current),await De(z,ee.pc,ee);const le=()=>{try{am(!1)}catch{}};let be=!1;for(const[,z]of h.current){const ee=z.pc,se=()=>{!be&&ee.connectionState==="connected"&&(be=!0,le(),ee.removeEventListener("connectionstatechange",se))};ee.addEventListener("connectionstatechange",se)}window.setTimeout(()=>{be||le()},2500)}else{for(const[X,le]of h.current)await fe(le.pc,void 0),await De(X,le.pc,le);me()}f(C.current,Z).catch(()=>{});try{PC(Z?"videoEnabled:on":"videoEnabled:off")}catch{}}},[N,n,i,h,te,fe,De,me,f]),at=async Z=>{if(!i){R(!1);return}if(R(Z),Z&&!A.current&&!await ae()){R(!1);return}const X=A.current?.getAudioTracks?.()[0];X&&(X.enabled=Z);for(const[,le]of h.current)await Re(le.pc,A.current)},we=Z=>Z===n?!!P.current?.getVideoTracks?.().some(le=>le.readyState==="live"):!!m[Z]?.getVideoTracks?.().some(le=>le.readyState==="live"),st=async Z=>{if(!fn(Z)){if(!i){await Re(Z,void 0),await fe(Z,void 0);return}try{if(await ae(),N&&await te(),fn(Z))return;Bt.debug("attachLocalTracks",{audio:!!(x&&A.current),video:!!(N&&P.current)}),await Re(Z,x?A.current:void 0),await fe(Z,N?P.current:void 0)}catch(X){Bt.warn("attachLocalTracks:failed",{err:String(X)})}}},bt=v.useRef(0),nr=5400*1e3;v.useEffect(()=>{if(!C.current||h.current.size===0)return;const Z=async()=>{const le=Date.now();if(!(le-bt.current<nr)){Bt.info("ice:refresh-credentials",{roomId:C.current});try{const be=await c(C.current);if(be?.ok&&Array.isArray(be.iceServers)&&be.iceServers.length){const z=Ih([...j,...be.iceServers],j);q.current=z,bt.current=le,Bt.debug("ice:credentials-refreshed",{count:z.length})}}catch(be){Bt.warn("ice:refresh-failed",{err:String(be)})}}},X=window.setInterval(Z,6e4);return()=>clearInterval(X)},[U,c]);const ur=async Z=>{if(!i||!n)return;C.current=Z,Bt.info("rtc:join",{roomId:Z});const X=3,le=150;let be=null,z=null;for(let ee=0;ee<X&&(be=await c(Z),!(be?.ok||(z=be?.error||"rtc_join failed",!/not a member|room not found/i.test(z||"")||ee>=X-1)));ee++)Bt.warn("rtc:join:retry",{roomId:Z,attempt:ee+1,error:z}),await new Promise(Oe=>setTimeout(Oe,le*(ee+1)));if(!be?.ok)throw new Error(z||"rtc_join failed");if(Array.isArray(be.iceServers)&&be.iceServers.length){const ee=Ih([...j,...be.iceServers],j);q.current=ee,bt.current=Date.now(),ee.some(se=>(Array.isArray(se.urls)?se.urls:[se.urls]).some(wt=>wt.startsWith("turn:")||wt.startsWith("turns:"))),Bt.debug("rtc:ice-servers",{count:ee.length,servers:ee.map(se=>se.urls).slice(0,4)})}else q.current=[...j],bt.current=Date.now();if(it(),N&&!P.current){const ee=await te();ee&&D(ee)}for(const ee of be.peers.filter(se=>se!==n)){const{pc:se}=Et(ee);await st(se);const Oe=h.current.get(ee);await De(ee,se,Oe)}W(h.current.size)},dr=Z=>{!Z||C.current&&C.current,Bt.info("rtc:leave",{roomId:Z});try{d(Z)}catch{}for(const[,X]of h.current){Mh(X);try{X.pc.close()}catch{}}h.current.clear(),W(0),C.current=void 0,G(),_(X=>(Object.values(X).forEach(wv),{}));for(const X of Array.from(Ae.current.keys()))re(X);A.current?.getTracks()?.forEach(X=>X.stop()),P.current?.getTracks()?.forEach(X=>X.stop()),A.current=void 0,P.current=void 0,D(void 0),E({})},Sr=async(Z,X)=>{},un=async()=>{i&&await et(!0)};return v.useEffect(()=>{if(!N||!C.current||h.current.size===0)return;const Z=async()=>{if(!N||!P.current)return;const le=P.current.getVideoTracks()[0];if(!((!le||le.readyState!=="live")&&(Bt.warn("health:video-track-dead"),P.current=void 0,!await te()))){for(const[be,z]of h.current)if(!fn(z.pc))try{const se=z.pc.getSenders().find(wt=>wt.track?.kind==="video")?.track,Oe=P.current?.getVideoTracks()[0];Oe&&(!se||se.id!==Oe.id)&&(Bt.info("health:reattach-video",{peerId:be}),await fe(z.pc,P.current),await De(be,z.pc,z))}catch(ee){Bt.warn("health:check-failed",{peerId:be,err:String(ee)})}}},X=window.setInterval(Z,5e3);return Z(),()=>clearInterval(X)},[N,U]),v.useEffect(()=>{if(!r||!i)return;const Z=async()=>{const X=C.current;if(X){Bt.info("socket:reconnect:rtc-rejoin",{roomId:X,peerCount:h.current.size});for(const[,le]of h.current){Mh(le);try{le.pc.close()}catch{}}h.current.clear(),W(0),_(le=>(Object.values(le).forEach(wv),{})),E({});try{const le=await c(X);if(!le?.ok){Bt.warn("socket:reconnect:rtc-rejoin-failed",{roomId:X,error:le?.error});return}if(Array.isArray(le.iceServers)&&le.iceServers.length){const be=Ih([...j,...le.iceServers],j);q.current=be,bt.current=Date.now()}for(const be of le.peers.filter(z=>z!==n)){const{pc:z}=Et(be);await st(z);const ee=h.current.get(be);await De(be,z,ee)}W(h.current.size),Bt.info("socket:reconnect:rtc-rejoin-success",{roomId:X,peerCount:h.current.size})}catch(le){Bt.error("socket:reconnect:rtc-rejoin-error",{roomId:X,err:String(le)})}}};return r.on("connect",Z),r.on("reconnect",Z),()=>{r.off("connect",Z),r.off("reconnect",Z)}},[r,i,n,c]),v.useEffect(()=>{const Z=A.current?.getAudioTracks?.()[0];x&&Z&&A.current?xe(n,A.current):re(n)},[A.current,n,x]),v.useEffect(()=>{for(const[Z,X]of Object.entries(m))X?.getAudioTracks().some(be=>be.enabled)&&xe(Z,X);for(const Z of Ae.current.keys())Z!==n&&!m[Z]&&re(Z)},[m,n]),Pa({onRtcPeerJoined:async({peerId:Z})=>{if(Bt.info("sig:peer-joined",{peerId:Z}),!(!C.current||Z===n))try{const{pc:X}=Et(Z);if(fn(X))return;await st(X);const le=h.current.get(Z);le&&!fn(X)&&await De(Z,X,le)}catch(X){Bt.warn("sig:peer-joined:failed",{peerId:Z,err:String(X)})}},onRtcPeerLeft:({peerId:Z})=>{Bt.info("sig:peer-left",{peerId:Z});const X=h.current.get(Z);if(X){Mh(X),$e(Z);try{X.pc.close()}catch{}}h.current.delete(Z),W(h.current.size),_(le=>{const be={...le};return wv(be[Z]),delete be[Z],be}),re(Z),E(le=>{const{[Z]:be,...z}=le;return z})},onRtcSignal:async({fromPeerId:Z,payload:X})=>{let le,be;try{le=Et(Z),be=le.pc}catch(z){Bt.warn("sig:getPeer-failed",{fromPeerId:Z,err:String(z)});return}if(fn(be)){Bt.debug("sig:pc-closed",{fromPeerId:Z});return}try{if(X.sdp){if(Bt.debug("sig:sdp",{fromPeerId:Z,type:X.sdp.type}),fn(be))return;const z=X.sdp;if(z.type==="answer"&&Ct(be)){Bt.debug("sig:stale-answer-ignored",{fromPeerId:Z,signalingState:be.signalingState});return}const ee=Ct(be)||le.isSettingRemoteAnswerPending,se=z.type==="offer"&&!ee;if(le.ignoreOffer=!(n<Z)&&se,le.ignoreOffer||(z.type==="answer"&&(le.isSettingRemoteAnswerPending=!0),se&&(fn(be)||await be.setLocalDescription({type:"rollback"})),fn(be)))return;if(await be.setRemoteDescription(z),le.isSettingRemoteAnswerPending=!1,z.type==="offer"&&!fn(be)){const Oe=await be.createAnswer();if(fn(be))return;await be.setLocalDescription(Oe),await u(C.current,Z,{sdp:be.localDescription})}for(;le.iceBuffer.length&&!fn(be);){const Oe=le.iceBuffer.shift();try{await be.addIceCandidate(Oe)}catch{}}}else if(X.ice){if(Bt.debug("sig:ice",{fromPeerId:Z,hasRemote:!!be.remoteDescription}),fn(be))return;const z=X.ice;if(be.remoteDescription)try{await be.addIceCandidate(z)}catch{}else le.iceBuffer.push(z)}}catch(z){const ee=String(z);Bt.error("sig:error",{fromPeerId:Z,err:ee}),(ee.includes("order of m-lines")||ee.includes("m-line")||ee.includes("InvalidAccessError"))&&(Bt.warn("sig:mline-mismatch-rebuild",{fromPeerId:Z}),await nt(Z))}},onRtcVideoEnabled:({playerId:Z,enabled:X})=>{Bt.debug("sig:video-enabled",{playerId:Z,enabled:X}),E(le=>({...le,[Z]:!!X}))}}),v.useEffect(()=>{let Z=!0;return(async()=>{try{const X=await au();if(!Z)return;L(!1),n&&E(le=>({...le,[n]:!1})),R(i?!!X.chatAudio:!1)}catch{}})(),()=>{Z=!1}},[n,i]),v.useEffect(()=>{i||(R(!1),N&&o("auth:lost"),L(!1),n&&E(Z=>({...Z,[n]:!1})),(async()=>{for(const[Z,X]of h.current)await Re(X.pc,void 0),await fe(X.pc,void 0),await De(Z,X.pc,X).catch(()=>{})})(),ue(),me())},[i,n]),v.useEffect(()=>{const Z=X=>{const le=X.detail;le&&(typeof le.video=="boolean"&&le.video===!1&&(L(!1),E(be=>({...be,[n]:!1}))),typeof le.chatAudio=="boolean"&&R(le.chatAudio))};return window.addEventListener("app:settings",Z),()=>window.removeEventListener("app:settings",Z)},[n]),v.useEffect(()=>{const Z=()=>{if(document.visibilityState==="visible")for(const[be,z]of h.current)_t(be,z)},X=()=>{for(const[be,z]of h.current)_t(be,z)},le=()=>{for(const[be,z]of h.current)_t(be,z)};return document.addEventListener("visibilitychange",Z),window.addEventListener("online",X),window.addEventListener("offline",le),()=>{document.removeEventListener("visibilitychange",Z),window.removeEventListener("online",X),window.removeEventListener("offline",le)}},[]),v.useEffect(()=>{try{const Z=window;Z.__rtcCtxInternal||(Z.__rtcCtxInternal={}),Z.__rtcCtxInternal.peers=h.current,Z.__rtcCtxInternal.myVideoRef=P,Z.__rtcCtxInternal.videoEnabledState={current:N}}catch{}},[N,T,U]),g.jsx(h4.Provider,{value:{videoEnabled:N,setVideoEnabled:et,enableCamera:un,joinRtc:ur,leaveRtc:dr,cameraOwnerId:w,setCameraOwner:Sr,remoteStreams:m,myVideo:T,micEnabled:x,setMicEnabled:at,hasVideo:we,speaking:He,remoteVideoFlags:b},children:t})}function Ofe(t){const e=[];for(const[r,n]of t)try{const a=n.pc;e.push({id:r,state:a.connectionState,ice:a.iceConnectionState,signaling:a.signalingState})}catch{}return e}function PC(t){try{const e=window,r=e.__rtcCtxInternal||{},n=r.peers||new Map,a=r.myVideoRef?.current,i=a?.getVideoTracks?.()[0],o={t:Date.now(),label:t,videoEnabled:r.videoEnabledState?.current,hasStream:!!a,trackState:i?.readyState,muted:i?.muted,peers:Ofe(n),activePeerCount:n.size};e.__rtcDiag||(e.__rtcDiag=[]),e.__rtcDiag.push(o),e.__rtcDiag.length>200&&e.__rtcDiag.splice(0,e.__rtcDiag.length-200),e.dispatchEvent?.(new CustomEvent("rtc:diag",{detail:o}))}catch{}}try{queueMicrotask(()=>{const t=window;t.__rtcCtxInternal||(t.__rtcCtxInternal={}),t.__dumpRtcDiag=PC})}catch{}function gu(){const t=kfe(),e=xfe(),r=!!t,n=v.useCallback(async h=>{r?await t.joinRoom(h):e?.joinRtc&&await Promise.resolve(e.joinRtc(h))},[r,t,e]),a=v.useCallback(h=>{r?t.leaveRoom():e?.leaveRtc&&e.leaveRtc(h)},[r,t,e]),i=v.useCallback(async h=>{r?await t.setVideoEnabled(h):e?.setVideoEnabled&&await e.setVideoEnabled(h)},[r,t,e]),o=v.useCallback(async h=>{r?await t.setMicEnabled(h):e?.setMicEnabled&&await e.setMicEnabled(h)},[r,t,e]),c=v.useMemo(()=>{if(r){const h={};t.localParticipant&&(h[t.localParticipant.id]=t.localParticipant.isSpeaking);for(const m of t.participants)h[m.id]=m.isSpeaking;return h}return e?.speaking??{}},[r,t.localParticipant,t.participants,e?.speaking]),u=v.useMemo(()=>{if(!r)return e?.myVideo;const h=t.localParticipant?.videoTrack||t.localVideoTrack;if(h){if(h.mediaStream instanceof MediaStream)return h.mediaStream;const m=h.mediaStreamTrack;if(m instanceof MediaStreamTrack){const _=new MediaStream;return _.addTrack(m),_}}},[r,t.localParticipant?.videoTrack,t.localVideoTrack,e?.myVideo]),d=v.useMemo(()=>{if(!r)return e?.remoteStreams??{};const h={};for(const m of t.participants){const _=new MediaStream;m.videoTrack&&"mediaStreamTrack"in m.videoTrack&&_.addTrack(m.videoTrack.mediaStreamTrack),m.audioTrack&&"mediaStreamTrack"in m.audioTrack&&_.addTrack(m.audioTrack.mediaStreamTrack),_.getTracks().length>0&&(h[m.id]=_)}return h},[r,t.participants,e?.remoteStreams]),f=v.useMemo(()=>{if(!r)return e?.remoteVideoFlags;const h={};t.localParticipant&&(h[t.localParticipant.id]=t.localParticipant.videoEnabled);for(const m of t.participants)h[m.id]=m.videoEnabled;return h},[r,t.localParticipant,t.participants,e?.remoteVideoFlags]);return v.useMemo(()=>({joinRoom:n,leaveRoom:a,connected:r?t.connected:(e?.activePeerCount??0)>0,videoEnabled:r?t.videoEnabled:e?.videoEnabled??!1,setVideoEnabled:i,localVideoTrack:r?t.localVideoTrack:e?.myVideo??null,micEnabled:r?t.micEnabled:e?.micEnabled??!1,setMicEnabled:o,speaking:c,participants:r?t.participants:[],localParticipant:r?t.localParticipant:null,remoteStreams:d,myVideo:u,remoteVideoFlags:f,throttleVideoForAnimation:e?.throttleVideoForAnimation,mode:r?"livekit":"mesh"}),[n,a,i,o,c,r,t,e,u,d,f])}const m4=v.createContext(null),Mi=()=>v.useContext(m4),_E={};function Nfe({children:t}){const{user:e,meId:r}=$r(),n=r||e?.id,{resetSpin:a}=Jo(),i=tn(),{joinRoom:o,leaveRoom:c,setSpectate:u,pokerJoinRoom:d,getRoomsList:f}=pa(),[h,m]=v.useState(()=>{try{const R=window.__PRESEEDED_ROOM;if(R&&typeof R=="object")return delete window.__PRESEEDED_ROOM,R}catch{}return null}),{leaveRoom:_,joinRoom:w}=gu(),b=v.useRef({}),E=v.useMemo(()=>(h?.gameState??{}).phase==="waiting"||h===null,[h]),T=v.useCallback(async R=>{try{const N=await o(R);if(!N?.ok)throw new Error(N?.error||"Failed to join room");try{a()}catch{}if(m(N.room),!N.room?.singlePlayer)try{await Promise.resolve(w?.(R))}catch{}try{const L=await f?.(),q=(L&&(Array.isArray(L?.rooms)?L.rooms:Array.isArray(L?.data?.rooms)?L.data.rooms:[])||[]).find(U=>U?.id===R);q&&Array.isArray(q.players)&&m(U=>!U||U.id!==R?U:{...U,players:q.players})}catch{}return{ok:!0,room:N.room}}catch(N){try{if(!(typeof window<"u"&&(window.location?.search?.includes("e2e=1")||window.__E2E===!0||typeof window.sessionStorage<"u"&&window.sessionStorage.getItem("e2e")==="1")))throw N;const j=Date.now(),q=n||"e2e-user",U=e?.name||"E2E User",W={id:R,name:"E2E Room",gameMode:"craps",createdAt:j,updatedAt:j,bankerId:"bank",players:[{id:q,name:U,isReady:!0,balance:1e3},{id:"bank",name:"Bank",isReady:!0,balance:1e6}],gameState:{gameMode:"craps",crapsPoint:null,currentRollerId:q,turnOrder:[q],roundSeq:1,crapsPassBets:[{playerId:q,amount:10}],crapsDontPassBets:[],crapsPlaceBets:[]}};try{a()}catch{}m(W);return}catch{throw N}}},[o,a,w,f,n,e?.name]),D=v.useCallback(async()=>{if(h){try{_(h.id)}catch{}try{await c(h.id)}finally{m(null)}}},[c,_,h]),P=v.useCallback((R,N)=>{if(!N)return R;if(!R)return N;try{const L=Array.isArray(R.players)?R.players:[],j=Array.isArray(N.players)?N.players:[];let q;if(j.length===0&&L.length>0)q=L;else if(L.length===0)q=j;else{const U=new Map(L.map(F=>[String(F.id),F])),W=new Map(j.map(F=>[String(F.id),F]));q=L.map(F=>W.get(String(F.id))||F);for(const[F,Y]of W.entries())U.has(F)||q.push(Y)}return{...R,...N,players:q}}catch{return N||R}},[]);Pa({onJoinedRoom:({room:R})=>{try{a()}catch{}m(N=>P(N,R))},onOtherPlayerJoined:({room:R})=>m(N=>P(N,R)),onOtherLeft:({room:R})=>{let N=!1,L=null;if(m(j=>{const q=P(j,R);try{const U=Array.isArray(R?.players)?R?.players:Array.isArray(q?.players)?q.players:[],W=String(n||"");if(!(W&&U.some(Y=>String(Y?.id)===W))&&j){if(!!(R?.singlePlayer||q?.singlePlayer))return q;const Q=String(j.id||""),ie=b.current[Q]||0,G=Date.now();return ie?G-ie<1500?q:(N=!0,L=String(j.id),delete b.current[Q],null):(b.current[Q]=G,q)}}catch{}return q}),N){try{L&&_?.(L)}catch{}try{i("/lobby",{replace:!0})}catch{}}},onSpectatorsUpdated:({spectators:R})=>{m(N=>N&&{...N,gameState:{...N.gameState,spectators:R}})},onPlayerProfileUpdated:({playerId:R,name:N,avatarUrl:L})=>{m(j=>{if(!j)return j;const q=j.players.map(U=>U.id!==R?U:{...U,...N!==void 0&&{name:N},...L!==void 0&&{avatarUrl:L}});return{...j,players:q}})},onBetsUpdated:({room:R})=>{R&&m(N=>{if(!N)return R;try{const L=new Map(N.players.map(U=>[U.id,U])),j=new Map((R.players||[]).map(U=>[U.id,U])),q=N.players.map(U=>j.get(U.id)||U);for(const[U,W]of j.entries())L.has(U)||q.push(W);return{...N,gameState:R.gameState??N.gameState,name:R.name??N.name,maxPlayers:R.maxPlayers??N.maxPlayers,private:R.private??N.private,singlePlayer:R.singlePlayer??N.singlePlayer,players:q}}catch{return N}})},onBankerChanged:R=>{m(N=>!N||N.id!==R.roomId?N:{...N,gameState:{...N.gameState,banker:R.bankerId,currentRollerId:R.currentRollerId,roundSeq:R.roundSeq,bankRoll:null}})},onForceLogout:R=>{R?.reason==="session_superseded"&&V3();try{h?.id&&_(h.id)}catch{}m(null)},onRoomUpdateState:({roomId:R,gameState:N,room:L})=>{const j=L?.gameState??N;if(!j)return;const q=Array.isArray(L?.players)?L.players:[];let U=!1,W=null;if(m(F=>{const Y=Q=>{if(!q.length)return Q;const ie=new Map(Q.map(G=>[G.id,G]));for(const G of q){const B=ie.get(G.id);B?ie.set(G.id,{...B,...G}):ie.set(G.id,G)}return Array.from(ie.values())};try{if(q.length&&F&&F.id===R){const Q=String(n||"");if(Q&&!q.some(G=>String(G?.id)===Q)){if(!!(L?.singlePlayer||F?.singlePlayer))return{...F,players:Y(F.players),gameState:j};const B=String(F.id||""),K=b.current[B]||0,ae=Date.now();return K?ae-K<1500?{...F,players:Y(F.players),gameState:j}:(U=!0,W=String(F.id),delete b.current[B],null):(b.current[B]=ae,{...F,players:Y(F.players),gameState:j})}}}catch{}return F&&F.id===R?{...F,players:Y(F.players),gameState:j}:F||{id:R,players:q,gameState:j}}),U){try{W&&_?.(W)}catch{}try{i("/lobby",{replace:!0})}catch{}}},onPlayerBalanceUpdated:({playerId:R,balance:N})=>{m(L=>{if(!L)return L;const j=L.players.findIndex(W=>W.id===R);if(j<0){const W=[...L.players,{id:R,balance:N}];return{...L,players:W}}const q=L.players[j];if(typeof q?.balance=="number"&&q.balance===N)return L;const U=L.players.slice();return U[j]={...q,balance:N},{...L,players:U}})},onError:R=>{try{const N=Hv?.()||[],L=Date.now(),j=[...N].filter(q=>L-q.ts<1200).slice(-1)[0]}catch{}}});const A=v.useMemo(()=>({room:h,isWaiting:E,joinRoom:T,leaveRoom:D,setRoom:m,setSpectatingForMe:async R=>{if(h)try{return await u(h.id,R)}catch(N){return{ok:!1,error:N?.message||"Failed"}}}}),[h,E,T,D,u]),C=ks(),O=v.useRef(0),I=v.useRef(!1),x=v.useCallback(async()=>{const R=Date.now();if(R-(O.current||0)<800)return;O.current=R;const N=h?.id;if(!N){try{const j=(Hv?.()||[]).slice(-1)[0];if(j&&String(j.event).toLowerCase().includes("create_room")&&R-(j.ts||0)<1500)return}catch{}return}try{const j=(Hv?.()||[]).slice(-1)[0];j&&String(j.event).toLowerCase().includes("create_room")&&R-(j.ts||0)<1500&&await new Promise(U=>setTimeout(U,1100))}catch{}try{const L=h?.gameMode==="poker";let j;if(L&&typeof d=="function"){const q=_E[N];if(q)j=await q;else{const U=d(N);_E[N]=U;try{j=await U}finally{delete _E[N]}}}else j=await o(N);if(j?.ok){try{a()}catch{}if(m(j.room),!j.room?.singlePlayer)try{await Promise.resolve(w?.(N))}catch{}try{const q=await f?.(),W=(q&&(Array.isArray(q?.rooms)?q.rooms:Array.isArray(q?.data?.rooms)?q.data.rooms:[])||[]).find(F=>F?.id===N);W&&Array.isArray(W.players)&&m(F=>!F||F.id!==N?F:{...F,players:W.players})}catch{}}}catch{}},[h?.id,d,o,a,w,f]);return v.useEffect(()=>{if(!C)return;const R=q=>{q!=="io client disconnect"&&(I.current=!0)},N=()=>{I.current&&(I.current=!1,x())},L=()=>{x()},j=()=>{x()};C.on("disconnect",R),C.on("connect",N);try{C.io.on("reconnect",L)}catch{}try{C.on?.("reconnect",j)}catch{}return()=>{C.off("disconnect",R),C.off("connect",N);try{C.io.off("reconnect",L)}catch{}try{C.off?.("reconnect",j)}catch{}}},[C,x]),v.useEffect(()=>{const R=()=>{try{document.visibilityState==="visible"&&(I.current||!C?.connected)&&x()}catch{}},N=()=>{(I.current||!C?.connected)&&x()},L=()=>{(I.current||!C?.connected)&&x()},j=()=>{x()};return window.addEventListener("visibilitychange",R),window.addEventListener("focus",N),window.addEventListener("pageshow",L),window.addEventListener("ad:complete",j),()=>{window.removeEventListener("visibilitychange",R),window.removeEventListener("focus",N),window.removeEventListener("pageshow",L),window.removeEventListener("ad:complete",j)}},[C,x]),g.jsx(m4.Provider,{value:A,children:t})}const Sv=globalThis.__lastWagersFetchAt||(globalThis.__lastWagersFetchAt={}),ZM=500;function v0(t,e){const r=ks(),{room:n}=Mi(),a=t&&e?`betsnap:${t}:${e}`:null,[i,o]=v.useState(()=>({roundSeq:1,open:[],settled:[],openAll:[],settledAll:[],playerBalance:null}));v.useEffect(()=>{a&&(async()=>{try{const re=await Xf(a);if(!re?.mainWagerId)return;o(H=>H.open.some(Re=>Re.type==="MAIN"&&Re.playerId===e)?H:{...H,roundSeq:re.roundSeq||H.roundSeq,open:[...H.open,{id:re.mainWagerId,type:"MAIN",playerId:e,acceptedById:null,amount:0,roundSeq:re.roundSeq}]})}catch{}})()},[a,e]),v.useEffect(()=>{a&&(async()=>{try{const re=await Xf(a);if(!re)return;re?.mainWagerId&&o(H=>H.open.some(Re=>Re.type==="MAIN"&&Re.playerId===e)?H:{...H,roundSeq:re.roundSeq||H.roundSeq,open:[...H.open,{id:re.mainWagerId,type:"MAIN",playerId:e,acceptedById:null,amount:0,roundSeq:re.roundSeq}]})}catch{}})()},[a,e]);const{getWagers:c,createSideBet:u,cancelSideBet:d,acceptSideBet:f,placeMainBet:h,cancelMainBet:m}=pa(),[_,w]=v.useState([]),b=v.useRef(new Set),E=v.useRef(new Set),[T,D]=v.useState(0),P=v.useRef(null);v.useEffect(()=>{if(P.current===null){P.current=t;return}o({roundSeq:1,open:[],settled:[],openAll:[],settledAll:[]}),w([]),b.current.clear(),E.current.clear(),D(0),a&&Jf(a)},[t,a]),Pa({onBetsUpdated:re=>{a&&(async()=>{try{const fe=re.open.find(Ie=>Ie.type==="MAIN"&&Ie.playerId===e);fe?await Ab(a,{roundSeq:re.roundSeq,mainWagerId:fe.id}):await Jf(a)}catch{}})(),o(re);const H=re.settled.filter(fe=>fe.roundSeq===re.roundSeq);w(H.filter(fe=>!b.current.has(fe.id)));const Re=(re.open||[]).filter(fe=>fe.type==="SIDE"&&!fe.acceptedById&&fe.playerId!==e&&fe.subjectId!==e).filter(fe=>!E.current.has(fe.id));D(Re.length)}});const[A,C]=v.useState([]);v.useEffect(()=>{C([])},[t]),v.useEffect(()=>{const re=Array.isArray(i.settledAll)?i.settledAll:[];re.length===0&&A.length===0||C(H=>{if(re.length===0)return H;const he=new Map;for(const fe of H)he.set(fe.id,fe);for(const fe of re)he.set(fe.id,fe);return Array.from(he.values()).sort((fe,Ie)=>{const ct=Number(fe.roundSeq||0),$e=Number(Ie.roundSeq||0);return $e!==ct?$e-ct:String(Ie.id).localeCompare(String(fe.id))})})},[i.settledAll]),v.useEffect(()=>{if(!t)return;let re=null;const H=()=>{const Re=Date.now(),fe=Sv[t]||0;Re-fe<ZM||(Sv[t]=Re,re=window.setTimeout(()=>{try{c(t)}catch{}},300))};if(n?.id===t)return H(),()=>{re&&clearTimeout(re)};const he=window.setTimeout(()=>{H()},500);return()=>{re&&clearTimeout(re),clearTimeout(he)}},[t,n?.id,c]),v.useEffect(()=>{if(!r)return;const re={current:0},H=()=>{if(!t||n?.id!==t)return;const he=Date.now();if(!(he-re.current<400)&&!(he-(Sv[t]||0)<ZM)){re.current=he,Sv[t]=he;try{E.current.clear(),D(0),b.current.clear(),setTimeout(()=>{try{c(t)}catch{}},300)}catch{}}};return r.on("reconnect",H),()=>{r.off("reconnect",H)}},[r,t,n?.id,c]),v.useEffect(()=>{w([]),b.current.clear()},[i.roundSeq]);const O=v.useMemo(()=>i.openAll?.filter(re=>re.type==="MAIN"),[i.openAll]),I=v.useMemo(()=>i.open.find(re=>re.type==="MAIN"&&re.playerId===e),[i.open,e]),x=v.useMemo(()=>i.openAll?.filter(re=>re.type==="SIDE"),[i.openAll,e]),R=v.useMemo(()=>i.open.filter(re=>re.type==="SIDE"&&(re.playerId===e||re.acceptedById===e)),[i.open,e]),N=v.useMemo(()=>i.settled.filter(re=>re.playerId===e||re.acceptedById===e),[i.settled,e]);v.useMemo(()=>A.filter(re=>re.playerId===e||re.acceptedById===e),[A,e]);const L=v.useMemo(()=>i.open.filter(re=>re.playerId===e||re.acceptedById===e).reduce((re,H)=>re+(H.amount||0),0),[i.open,e]),[j,q]=v.useState([]);v.useEffect(()=>{const re=setTimeout(()=>{q(A.filter(H=>H.playerId===e||H.acceptedById===e))},sa.mySettledDelayMs);return()=>clearTimeout(re)},[A,e]);const[U,W]=v.useState(null);v.useEffect(()=>{const re=setTimeout(()=>{W(i.playerBalance)},sa.balanceDelayMs);return()=>clearTimeout(re)},[i.playerBalance]);const[F,Y]=v.useState([]);v.useEffect(()=>{const re=setTimeout(()=>{Y(A)},sa.settledAllDelayMs);return()=>clearTimeout(re)},[A]);const Q=v.useMemo(()=>i.open.filter(re=>re.type==="SIDE"&&!re.acceptedById&&re.subjectId!==e&&re.playerId!==e),[i.open,e]),ie=()=>w(re=>{if(re.length===0)return re;const[H,...he]=re;return b.current.add(H.id),he}),G=re=>w(H=>(b.current.add(re),H.filter(he=>he.id!==re))),B=v.useCallback(()=>{for(const re of Q)E.current.add(re.id);D(0)},[Q]),K=v.useCallback(async re=>{try{const H=await u(t,{amount:Math.floor(re.amount),subjectId:re.subjectId,predicate:re.predicate,oddsBp:re.oddsBp});return H?.ok?{ok:!0,betId:H?.wager?.id||H?.id||re.clientBetId}:{ok:!1,error:H?.error||"Failed to place side bet"}}catch(H){return{ok:!1,error:H?.message||"Failed to place side bet"}}},[t,u]),ae=v.useCallback(async re=>{try{const H=await d(t,re);return H?.ok?{ok:!0}:{ok:!1,error:H?.error||"Failed to cancel side bet"}}catch(H){return{ok:!1,error:H?.message||"Failed to cancel side bet"}}},[t,d]),te=v.useCallback(async re=>{try{const H=await f(t,re);return H?.ok?{ok:!0}:{ok:!1,error:H?.error||"Failed to accept side bet"}}catch(H){return{ok:!1,error:H?.message||"Failed to accept side bet"}}},[t,f]),me=v.useCallback(async re=>{try{const H=await h(t,Math.floor(re));return H?.ok?{ok:!0,wagerId:H?.wager?.id||H?.id}:{ok:!1,error:H?.error||"Failed to place main bet"}}catch(H){return{ok:!1,error:H?.message||"Failed to place main bet"}}},[t,h]),ue=v.useCallback(async re=>{try{const H=await m(t,re);return H?.ok?{ok:!0}:{ok:!1,error:H?.error||"Failed to cancel main bet"}}catch(H){return{ok:!1,error:H?.message||"Failed to cancel main bet"}}},[t,m]),[Ae,He]=v.useState([]),ce=v.useRef(i.roundSeq),xe=v.useRef(new Set);return v.useEffect(()=>{ce.current!==i.roundSeq&&(ce.current=i.roundSeq,xe.current.clear(),He([]));const re=i.settledAll.filter(H=>H.roundSeq===i.roundSeq&&!xe.current.has(H.id));if(re.length>0){re.forEach(he=>xe.current.add(he.id)),He(re);const H=setTimeout(()=>He([]),1e3);return()=>clearTimeout(H)}},[i.settledAll,i.roundSeq]),{roundSeq:i.roundSeq,openAll:i.openAll,open:i.open,settled:i.settled,settledAll:F,myOpenMain:I,myOpenSides:R,openAllMain:O,openAllSides:x,mySettledThisRound:N,mySettledAll:j,myExposure:L,unseenSettledWagers:_,consumeNextUnseen:ie,markAsSeen:G,offersToMe:Q,newOfferCount:T,markOffersAsSeen:B,placeSideBet:K,cancelSideBet:ae,acceptSideBet:te,placeMainBet:me,cancelMainBet:ue,playerBalance:U,newSettlements:Ae}}var Ev={exports:{}};/*!
 * accounting.js v0.4.1
 * Copyright 2014 Open Exchange Rates
 *
 * Freely distributable under the MIT license.
 * Portions of accounting.js are inspired or borrowed from underscore.js
 *
 * Full details and documentation:
 * http://openexchangerates.github.io/accounting.js/
 */var ej;function Ife(){return ej||(ej=1,(function(t,e){(function(r,n){var a={};a.version="0.4.1",a.settings={currency:{symbol:"$",format:"%s%v",decimal:".",thousand:",",precision:2,grouping:3},number:{precision:0,grouping:3,thousand:",",decimal:"."}};var i=Array.prototype.map,o=Array.isArray,c=Object.prototype.toString;function u(P){return!!(P===""||P&&P.charCodeAt&&P.substr)}function d(P){return o?o(P):c.call(P)==="[object Array]"}function f(P){return P&&c.call(P)==="[object Object]"}function h(P,A){var C;P=P||{},A=A||{};for(C in A)A.hasOwnProperty(C)&&P[C]==null&&(P[C]=A[C]);return P}function m(P,A,C){var O=[],I,x;if(!P)return O;if(i&&P.map===i)return P.map(A,C);for(I=0,x=P.length;I<x;I++)O[I]=A.call(C,P[I],I,P);return O}function _(P,A){return P=Math.round(Math.abs(P)),isNaN(P)?A:P}function w(P){var A=a.settings.currency.format;return typeof P=="function"&&(P=P()),u(P)&&P.match("%v")?{pos:P,neg:P.replace("-","").replace("%v","-%v"),zero:P}:!P||!P.pos||!P.pos.match("%v")?u(A)?a.settings.currency.format={pos:A,neg:A.replace("%v","-%v"),zero:A}:A:P}var b=a.unformat=a.parse=function(P,A){if(d(P))return m(P,function(I){return b(I,A)});if(P=P||0,typeof P=="number")return P;A=A||a.settings.number.decimal;var C=new RegExp("[^0-9-"+A+"]",["g"]),O=parseFloat((""+P).replace(/\((.*)\)/,"-$1").replace(C,"").replace(A,"."));return isNaN(O)?0:O},E=a.toFixed=function(P,A){A=_(A,a.settings.number.precision);var C=Math.pow(10,A);return(Math.round(a.unformat(P)*C)/C).toFixed(A)},T=a.formatNumber=a.format=function(P,A,C,O){if(d(P))return m(P,function(j){return T(j,A,C,O)});P=b(P);var I=h(f(A)?A:{precision:A,thousand:C,decimal:O},a.settings.number),x=_(I.precision),R=P<0?"-":"",N=parseInt(E(Math.abs(P||0),x),10)+"",L=N.length>3?N.length%3:0;return R+(L?N.substr(0,L)+I.thousand:"")+N.substr(L).replace(/(\d{3})(?=\d)/g,"$1"+I.thousand)+(x?I.decimal+E(Math.abs(P),x).split(".")[1]:"")},D=a.formatMoney=function(P,A,C,O,I,x){if(d(P))return m(P,function(j){return D(j,A,C,O,I,x)});P=b(P);var R=h(f(A)?A:{symbol:A,precision:C,thousand:O,decimal:I,format:x},a.settings.currency),N=w(R.format),L=P>0?N.pos:P<0?N.neg:N.zero;return L.replace("%s",R.symbol).replace("%v",T(Math.abs(P),_(R.precision),R.thousand,R.decimal))};a.formatColumn=function(P,A,C,O,I,x){if(!P)return[];var R=h(f(A)?A:{symbol:A,precision:C,thousand:O,decimal:I,format:x},a.settings.currency),N=w(R.format),L=N.pos.indexOf("%s")<N.pos.indexOf("%v"),j=0,q=m(P,function(U,W){if(d(U))return a.formatColumn(U,R);U=b(U);var F=U>0?N.pos:U<0?N.neg:N.zero,Y=F.replace("%s",R.symbol).replace("%v",T(Math.abs(U),_(R.precision),R.thousand,R.decimal));return Y.length>j&&(j=Y.length),Y});return m(q,function(U,W){return u(U)&&U.length<j?L?U.replace(R.symbol,R.symbol+new Array(j-U.length+1).join(" ")):new Array(j-U.length+1).join(" ")+U:U})},t.exports&&(e=t.exports=a),e.accounting=a})()})(Ev,Ev.exports)),Ev.exports}var Mfe=Ife();const rd=Sg(Mfe);function tj(t){return t==="WIN"?"LOSE":t==="LOSE"?"WIN":t}function mb(t){const e=Math.round(Number(t)||0);try{return`z${new Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(e)}`}catch{return`z${e}`}}function md(t,e){if(!t)return{myResult:"",myPayout:0,label:""};const r=t.playerId,n=e===r,a=t.acceptedById,i=a!=null&&e===a;if(t.type==="MAIN"){if(!(n||i))return{myResult:"N/A",myPayout:0,label:"Not your bet"};if(t.result==="PUSH")return{myResult:"PUSH",myPayout:0,label:"Push"};if(n){const o=rj(t);return{myResult:t.result,myPayout:t.result==="WIN"?o:0,label:Hu(t.result,t.result==="WIN"?o:0,t.amount)}}else{const o=tj(t.result),c=jfe(t);return{myResult:o,myPayout:o==="WIN"?c:0,label:Hu(o,o==="WIN"?c:0,t.amount)}}}if(t.type==="SIDE"){const o=e===t.acceptedById;if(!(n||o))return{myResult:"N/A",myPayout:0,label:"Not your bet"};if(t.result==="PUSH")return{myResult:"PUSH",myPayout:0,label:"Push"};if(n){const c=rj(t),u=t.result==="WIN"?c:0,d={myResult:t.result,myPayout:u,label:Hu(t.result,u,t.amount)};if(d.myResult==="WIN"&&d.myPayout<=0){const f=typeof t.payout=="number"&&t.payout>0?t.payout:t.amount;return{myResult:d.myResult,myPayout:f,label:Hu(d.myResult,f,t.amount)}}return d}else{const c=tj(t.result),u=Lfe(t),d=c==="WIN"?u:0,f={myResult:c,myPayout:d,label:Hu(c,d,t.amount)};if(f.myResult==="WIN"&&f.myPayout<=0){const h=typeof t.payout=="number"&&t.payout>0?t.payout:t.amount;return{myResult:f.myResult,myPayout:h,label:Hu(f.myResult,h,t.amount)}}return f}}return{myResult:"PUSH",myPayout:0,label:"Push"}}function rj(t){return typeof t.payout=="number"?t.payout:t.amount}function jfe(t){return t.amount}function Lfe(t){return typeof t.oddsBp=="number"&&t.oddsBp!==1e4&&typeof t.payout=="number"?t.payout:t.amount}function Hu(t,e,r){return t==="WIN"?`won ${mb(Math.max(0,e))}`:t==="LOSE"?`lost ${mb(Math.max(0,r))}`:t==="PUSH"?"Push":t}function Bfe(t){return!t||t.length===0?0:t.reduce((e,r)=>e+Number(r?.amount||0),0)}function g4({meId:t,items:e,onClose:r,nameOf:n,crapsRollHistory:a,gameMode:i,crapsLedgerItems:o}){const c=e,u=i==="craps",d={};for(const h of c){const m=h?.acceptedById===t?h?.playerId:h?.acceptedById;if(!m)continue;const _=md(h,t);let w=0;_.myResult==="WIN"?w=Number(_.myPayout??0):_.myResult==="LOSE"&&(w=-Number(h?.amount??0)),d[m]=(d[m]??0)+w}const f=Object.entries(d).map(([h,m])=>({id:h,name:n?.(h)||h,delta:m})).sort((h,m)=>m.delta-h.delta);return g.jsxs("div",{className:"results-modal",children:[g.jsx("div",{className:"results-modal__backdrop",onClick:r}),g.jsxs("div",{className:"results-modal__card card",children:[g.jsxs("div",{className:"results-modal__header",children:[g.jsx("h3",{children:"Your Results (this game)"}),g.jsx("button",{className:"btn btn--ghost",onClick:r,children:"Close"})]}),!u&&f.length>0&&g.jsx("div",{className:"results-modal__deltas",children:g.jsx("ul",{className:"results-modal__deltas-list",children:f.map(({id:h,name:m,delta:_})=>g.jsxs("li",{className:`results-modal__delta ${_>=0?"results-modal__delta--pos":"results-modal__delta--neg"}`,children:[m,": ",_>=0?"+":"","z",rd.formatMoney(_,"",0)]},h))})}),u&&g.jsxs(g.Fragment,{children:[(()=>{const h=Bfe(o),m=h>=0,_=Math.abs(h);return o?g.jsx("div",{className:"results-modal__deltas",children:g.jsxs("div",{className:`results-modal__delta ${m?"results-modal__delta--pos":"results-modal__delta--neg"}`,children:[g.jsx("strong",{children:"Total won/lost:"})," ",m?"+":"-","z",rd.formatMoney(_,"",0)]})}):null})(),g.jsxs("ul",{className:"betlist results-list",role:"log","aria-live":"polite",children:[(o?.length??0)===0&&g.jsx("li",{className:"betitem",children:"No history yet."}),(o||[]).map((h,m)=>{const _=Number(h.amount||0),w=_>=0,b=Math.abs(_),T=new Date(h.ts).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});let D="";if(h.kind==="BET_PLACED")D=`Placed ${h.meta?.betType?String(h.meta.betType):"bet"}`;else if(h.kind==="REFUND")D=`Refund ${h.meta?.betType?String(h.meta.betType):"chips"}`;else if(h.kind==="BET_SETTLED"){const P=Array.isArray(h.meta?.settlements)?h.meta.settlements:[],A=P[0]||null,C=A?.betType?String(A.betType):h.meta?.betType?String(h.meta.betType):"bet",O=_>0?"WIN":_<0?"LOSE":"PUSH",I=h.meta?.roll?.total?` on ${h.meta.roll.total}`:"",x=P.length>1?` (+${P.length-1} more)`:"";D=`Settled: ${C} ${O}${I}${x}`}return g.jsx("li",{className:"betitem results-modal__bet-row",children:g.jsxs("span",{children:[T," — ",D," ",w?"+":"-","z",rd.formatMoney(b,"",0)]})},h.id||m)})]})]}),!u&&g.jsxs("ul",{className:"betlist results-list",role:"log","aria-live":"polite",children:[c.length===0&&g.jsx("li",{className:"betitem",children:"No results yet."}),c.map((h,m)=>{const _=h?.acceptedById===t?h?.playerId:h?.acceptedById,w=(()=>{const T=h;return T?.acceptedById===t?T?.playerName||T?.player?.name||T?.playerEmail||T?.player?.email:T?.bankerName||T?.banker?.name||T?.bankerEmail||T?.banker?.email})(),b=n?.(_)||w||_||"Unknown",E=Hu(...(()=>{const T=md(h,t);return[T.myResult,T.myPayout,h.amount]})());return g.jsx("li",{className:"betitem results-modal__bet-row",children:g.jsxs("span",{children:["Round ",h.roundSeq," ",E," vs ",b]})},m)})]})]})]})}const y4=v.createContext({});function Ufe(t){const e=v.useRef(null);return e.current===null&&(e.current=t()),e.current}const aA=typeof window<"u",Ffe=aA?v.useLayoutEffect:v.useEffect,iA=v.createContext(null);function sA(t,e){t.indexOf(e)===-1&&t.push(e)}function oA(t,e){const r=t.indexOf(e);r>-1&&t.splice(r,1)}const Hc=(t,e,r)=>r>e?e:r<t?t:r;let cA=()=>{};const Gc={},v4=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function _4(t){return typeof t=="object"&&t!==null}const b4=t=>/^0[^.\s]+$/u.test(t);function lA(t){let e;return()=>(e===void 0&&(e=t()),e)}const hs=t=>t,qfe=(t,e)=>r=>e(t(r)),zg=(...t)=>t.reduce(qfe),Ym=(t,e,r)=>{const n=e-t;return n===0?1:(r-t)/n};class uA{constructor(){this.subscriptions=[]}add(e){return sA(this.subscriptions,e),()=>oA(this.subscriptions,e)}notify(e,r,n){const a=this.subscriptions.length;if(a)if(a===1)this.subscriptions[0](e,r,n);else for(let i=0;i<a;i++){const o=this.subscriptions[i];o&&o(e,r,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const zo=t=>t*1e3,fs=t=>t/1e3;function k4(t,e){return e?t*(1e3/e):0}const w4=(t,e,r)=>(((1-3*r+3*e)*t+(3*r-6*e))*t+3*e)*t,zfe=1e-7,$fe=12;function Vfe(t,e,r,n,a){let i,o,c=0;do o=e+(r-e)/2,i=w4(o,n,a)-t,i>0?r=o:e=o;while(Math.abs(i)>zfe&&++c<$fe);return o}function $g(t,e,r,n){if(t===e&&r===n)return hs;const a=i=>Vfe(i,0,1,t,r);return i=>i===0||i===1?i:w4(a(i),e,n)}const S4=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,E4=t=>e=>1-t(1-e),T4=$g(.33,1.53,.69,.99),dA=E4(T4),C4=S4(dA),x4=t=>(t*=2)<1?.5*dA(t):.5*(2-Math.pow(2,-10*(t-1))),fA=t=>1-Math.sin(Math.acos(t)),P4=E4(fA),A4=S4(fA),Hfe=$g(.42,0,1,1),Gfe=$g(0,0,.58,1),R4=$g(.42,0,.58,1),Wfe=t=>Array.isArray(t)&&typeof t[0]!="number",D4=t=>Array.isArray(t)&&typeof t[0]=="number",Kfe={linear:hs,easeIn:Hfe,easeInOut:R4,easeOut:Gfe,circIn:fA,circInOut:A4,circOut:P4,backIn:dA,backInOut:C4,backOut:T4,anticipate:x4},Yfe=t=>typeof t=="string",nj=t=>{if(D4(t)){cA(t.length===4);const[e,r,n,a]=t;return $g(e,r,n,a)}else if(Yfe(t))return Kfe[t];return t},Tv=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Xfe(t,e){let r=new Set,n=new Set,a=!1,i=!1;const o=new WeakSet;let c={delta:0,timestamp:0,isProcessing:!1};function u(f){o.has(f)&&(d.schedule(f),t()),f(c)}const d={schedule:(f,h=!1,m=!1)=>{const w=m&&a?r:n;return h&&o.add(f),w.has(f)||w.add(f),f},cancel:f=>{n.delete(f),o.delete(f)},process:f=>{if(c=f,a){i=!0;return}a=!0,[r,n]=[n,r],r.forEach(u),r.clear(),a=!1,i&&(i=!1,d.process(f))}};return d}const Jfe=40;function O4(t,e){let r=!1,n=!0;const a={delta:0,timestamp:0,isProcessing:!1},i=()=>r=!0,o=Tv.reduce((P,A)=>(P[A]=Xfe(i),P),{}),{setup:c,read:u,resolveKeyframes:d,preUpdate:f,update:h,preRender:m,render:_,postRender:w}=o,b=()=>{const P=Gc.useManualTiming?a.timestamp:performance.now();r=!1,Gc.useManualTiming||(a.delta=n?1e3/60:Math.max(Math.min(P-a.timestamp,Jfe),1)),a.timestamp=P,a.isProcessing=!0,c.process(a),u.process(a),d.process(a),f.process(a),h.process(a),m.process(a),_.process(a),w.process(a),a.isProcessing=!1,r&&e&&(n=!1,t(b))},E=()=>{r=!0,n=!0,a.isProcessing||t(b)};return{schedule:Tv.reduce((P,A)=>{const C=o[A];return P[A]=(O,I=!1,x=!1)=>(r||E(),C.schedule(O,I,x)),P},{}),cancel:P=>{for(let A=0;A<Tv.length;A++)o[Tv[A]].cancel(P)},state:a,steps:o}}const{schedule:wn,cancel:iu,state:wa,steps:bE}=O4(typeof requestAnimationFrame<"u"?requestAnimationFrame:hs,!0);let y_;function Qfe(){y_=void 0}const di={now:()=>(y_===void 0&&di.set(wa.isProcessing||Gc.useManualTiming?wa.timestamp:performance.now()),y_),set:t=>{y_=t,queueMicrotask(Qfe)}},N4=t=>e=>typeof e=="string"&&e.startsWith(t),pA=N4("--"),Zfe=N4("var(--"),hA=t=>Zfe(t)?epe.test(t.split("/*")[0].trim()):!1,epe=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Op={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},Xm={...Op,transform:t=>Hc(0,1,t)},Cv={...Op,default:1},vm=t=>Math.round(t*1e5)/1e5,mA=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function tpe(t){return t==null}const rpe=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,gA=(t,e)=>r=>!!(typeof r=="string"&&rpe.test(r)&&r.startsWith(t)||e&&!tpe(r)&&Object.prototype.hasOwnProperty.call(r,e)),I4=(t,e,r)=>n=>{if(typeof n!="string")return n;const[a,i,o,c]=n.match(mA);return{[t]:parseFloat(a),[e]:parseFloat(i),[r]:parseFloat(o),alpha:c!==void 0?parseFloat(c):1}},npe=t=>Hc(0,255,t),kE={...Op,transform:t=>Math.round(npe(t))},Yu={test:gA("rgb","red"),parse:I4("red","green","blue"),transform:({red:t,green:e,blue:r,alpha:n=1})=>"rgba("+kE.transform(t)+", "+kE.transform(e)+", "+kE.transform(r)+", "+vm(Xm.transform(n))+")"};function ape(t){let e="",r="",n="",a="";return t.length>5?(e=t.substring(1,3),r=t.substring(3,5),n=t.substring(5,7),a=t.substring(7,9)):(e=t.substring(1,2),r=t.substring(2,3),n=t.substring(3,4),a=t.substring(4,5),e+=e,r+=r,n+=n,a+=a),{red:parseInt(e,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:a?parseInt(a,16)/255:1}}const AC={test:gA("#"),parse:ape,transform:Yu.transform},Vg=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),xl=Vg("deg"),$o=Vg("%"),Jt=Vg("px"),ipe=Vg("vh"),spe=Vg("vw"),aj={...$o,parse:t=>$o.parse(t)/100,transform:t=>$o.transform(t*100)},Pf={test:gA("hsl","hue"),parse:I4("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:r,alpha:n=1})=>"hsla("+Math.round(t)+", "+$o.transform(vm(e))+", "+$o.transform(vm(r))+", "+vm(Xm.transform(n))+")"},Kn={test:t=>Yu.test(t)||AC.test(t)||Pf.test(t),parse:t=>Yu.test(t)?Yu.parse(t):Pf.test(t)?Pf.parse(t):AC.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?Yu.transform(t):Pf.transform(t),getAnimatableNone:t=>{const e=Kn.parse(t);return e.alpha=0,Kn.transform(e)}},ope=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function cpe(t){return isNaN(t)&&typeof t=="string"&&(t.match(mA)?.length||0)+(t.match(ope)?.length||0)>0}const M4="number",j4="color",lpe="var",upe="var(",ij="${}",dpe=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Jm(t){const e=t.toString(),r=[],n={color:[],number:[],var:[]},a=[];let i=0;const c=e.replace(dpe,u=>(Kn.test(u)?(n.color.push(i),a.push(j4),r.push(Kn.parse(u))):u.startsWith(upe)?(n.var.push(i),a.push(lpe),r.push(u)):(n.number.push(i),a.push(M4),r.push(parseFloat(u))),++i,ij)).split(ij);return{values:r,split:c,indexes:n,types:a}}function L4(t){return Jm(t).values}function B4(t){const{split:e,types:r}=Jm(t),n=e.length;return a=>{let i="";for(let o=0;o<n;o++)if(i+=e[o],a[o]!==void 0){const c=r[o];c===M4?i+=vm(a[o]):c===j4?i+=Kn.transform(a[o]):i+=a[o]}return i}}const fpe=t=>typeof t=="number"?0:Kn.test(t)?Kn.getAnimatableNone(t):t;function ppe(t){const e=L4(t);return B4(t)(e.map(fpe))}const su={test:cpe,parse:L4,createTransformer:B4,getAnimatableNone:ppe};function wE(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function hpe({hue:t,saturation:e,lightness:r,alpha:n}){t/=360,e/=100,r/=100;let a=0,i=0,o=0;if(!e)a=i=o=r;else{const c=r<.5?r*(1+e):r+e-r*e,u=2*r-c;a=wE(u,c,t+1/3),i=wE(u,c,t),o=wE(u,c,t-1/3)}return{red:Math.round(a*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:n}}function gb(t,e){return r=>r>0?e:t}const En=(t,e,r)=>t+(e-t)*r,SE=(t,e,r)=>{const n=t*t,a=r*(e*e-n)+n;return a<0?0:Math.sqrt(a)},mpe=[AC,Yu,Pf],gpe=t=>mpe.find(e=>e.test(t));function sj(t){const e=gpe(t);if(!e)return!1;let r=e.parse(t);return e===Pf&&(r=hpe(r)),r}const oj=(t,e)=>{const r=sj(t),n=sj(e);if(!r||!n)return gb(t,e);const a={...r};return i=>(a.red=SE(r.red,n.red,i),a.green=SE(r.green,n.green,i),a.blue=SE(r.blue,n.blue,i),a.alpha=En(r.alpha,n.alpha,i),Yu.transform(a))},RC=new Set(["none","hidden"]);function ype(t,e){return RC.has(t)?r=>r<=0?t:e:r=>r>=1?e:t}function vpe(t,e){return r=>En(t,e,r)}function yA(t){return typeof t=="number"?vpe:typeof t=="string"?hA(t)?gb:Kn.test(t)?oj:kpe:Array.isArray(t)?U4:typeof t=="object"?Kn.test(t)?oj:_pe:gb}function U4(t,e){const r=[...t],n=r.length,a=t.map((i,o)=>yA(i)(i,e[o]));return i=>{for(let o=0;o<n;o++)r[o]=a[o](i);return r}}function _pe(t,e){const r={...t,...e},n={};for(const a in r)t[a]!==void 0&&e[a]!==void 0&&(n[a]=yA(t[a])(t[a],e[a]));return a=>{for(const i in n)r[i]=n[i](a);return r}}function bpe(t,e){const r=[],n={color:0,var:0,number:0};for(let a=0;a<e.values.length;a++){const i=e.types[a],o=t.indexes[i][n[i]],c=t.values[o]??0;r[a]=c,n[i]++}return r}const kpe=(t,e)=>{const r=su.createTransformer(e),n=Jm(t),a=Jm(e);return n.indexes.var.length===a.indexes.var.length&&n.indexes.color.length===a.indexes.color.length&&n.indexes.number.length>=a.indexes.number.length?RC.has(t)&&!a.values.length||RC.has(e)&&!n.values.length?ype(t,e):zg(U4(bpe(n,a),a.values),r):gb(t,e)};function F4(t,e,r){return typeof t=="number"&&typeof e=="number"&&typeof r=="number"?En(t,e,r):yA(t)(t,e)}const wpe=t=>{const e=({timestamp:r})=>t(r);return{start:(r=!0)=>wn.update(e,r),stop:()=>iu(e),now:()=>wa.isProcessing?wa.timestamp:di.now()}},q4=(t,e,r=10)=>{let n="";const a=Math.max(Math.round(e/r),2);for(let i=0;i<a;i++)n+=Math.round(t(i/(a-1))*1e4)/1e4+", ";return`linear(${n.substring(0,n.length-2)})`},yb=2e4;function vA(t){let e=0;const r=50;let n=t.next(e);for(;!n.done&&e<yb;)e+=r,n=t.next(e);return e>=yb?1/0:e}function Spe(t,e=100,r){const n=r({...t,keyframes:[0,e]}),a=Math.min(vA(n),yb);return{type:"keyframes",ease:i=>n.next(a*i).value/e,duration:fs(a)}}const Epe=5;function z4(t,e,r){const n=Math.max(e-Epe,0);return k4(r-t(n),e-n)}const An={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},EE=.001;function Tpe({duration:t=An.duration,bounce:e=An.bounce,velocity:r=An.velocity,mass:n=An.mass}){let a,i,o=1-e;o=Hc(An.minDamping,An.maxDamping,o),t=Hc(An.minDuration,An.maxDuration,fs(t)),o<1?(a=d=>{const f=d*o,h=f*t,m=f-r,_=DC(d,o),w=Math.exp(-h);return EE-m/_*w},i=d=>{const h=d*o*t,m=h*r+r,_=Math.pow(o,2)*Math.pow(d,2)*t,w=Math.exp(-h),b=DC(Math.pow(d,2),o);return(-a(d)+EE>0?-1:1)*((m-_)*w)/b}):(a=d=>{const f=Math.exp(-d*t),h=(d-r)*t+1;return-EE+f*h},i=d=>{const f=Math.exp(-d*t),h=(r-d)*(t*t);return f*h});const c=5/t,u=xpe(a,i,c);if(t=zo(t),isNaN(u))return{stiffness:An.stiffness,damping:An.damping,duration:t};{const d=Math.pow(u,2)*n;return{stiffness:d,damping:o*2*Math.sqrt(n*d),duration:t}}}const Cpe=12;function xpe(t,e,r){let n=r;for(let a=1;a<Cpe;a++)n=n-t(n)/e(n);return n}function DC(t,e){return t*Math.sqrt(1-e*e)}const Ppe=["duration","bounce"],Ape=["stiffness","damping","mass"];function cj(t,e){return e.some(r=>t[r]!==void 0)}function Rpe(t){let e={velocity:An.velocity,stiffness:An.stiffness,damping:An.damping,mass:An.mass,isResolvedFromDuration:!1,...t};if(!cj(t,Ape)&&cj(t,Ppe))if(t.visualDuration){const r=t.visualDuration,n=2*Math.PI/(r*1.2),a=n*n,i=2*Hc(.05,1,1-(t.bounce||0))*Math.sqrt(a);e={...e,mass:An.mass,stiffness:a,damping:i}}else{const r=Tpe(t);e={...e,...r,mass:An.mass},e.isResolvedFromDuration=!0}return e}function vb(t=An.visualDuration,e=An.bounce){const r=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:n,restDelta:a}=r;const i=r.keyframes[0],o=r.keyframes[r.keyframes.length-1],c={done:!1,value:i},{stiffness:u,damping:d,mass:f,duration:h,velocity:m,isResolvedFromDuration:_}=Rpe({...r,velocity:-fs(r.velocity||0)}),w=m||0,b=d/(2*Math.sqrt(u*f)),E=o-i,T=fs(Math.sqrt(u/f)),D=Math.abs(E)<5;n||(n=D?An.restSpeed.granular:An.restSpeed.default),a||(a=D?An.restDelta.granular:An.restDelta.default);let P;if(b<1){const C=DC(T,b);P=O=>{const I=Math.exp(-b*T*O);return o-I*((w+b*T*E)/C*Math.sin(C*O)+E*Math.cos(C*O))}}else if(b===1)P=C=>o-Math.exp(-T*C)*(E+(w+T*E)*C);else{const C=T*Math.sqrt(b*b-1);P=O=>{const I=Math.exp(-b*T*O),x=Math.min(C*O,300);return o-I*((w+b*T*E)*Math.sinh(x)+C*E*Math.cosh(x))/C}}const A={calculatedDuration:_&&h||null,next:C=>{const O=P(C);if(_)c.done=C>=h;else{let I=C===0?w:0;b<1&&(I=C===0?zo(w):z4(P,C,O));const x=Math.abs(I)<=n,R=Math.abs(o-O)<=a;c.done=x&&R}return c.value=c.done?o:O,c},toString:()=>{const C=Math.min(vA(A),yb),O=q4(I=>A.next(C*I).value,C,30);return C+"ms "+O},toTransition:()=>{}};return A}vb.applyToOptions=t=>{const e=Spe(t,100,vb);return t.ease=e.ease,t.duration=zo(e.duration),t.type="keyframes",t};function OC({keyframes:t,velocity:e=0,power:r=.8,timeConstant:n=325,bounceDamping:a=10,bounceStiffness:i=500,modifyTarget:o,min:c,max:u,restDelta:d=.5,restSpeed:f}){const h=t[0],m={done:!1,value:h},_=x=>c!==void 0&&x<c||u!==void 0&&x>u,w=x=>c===void 0?u:u===void 0||Math.abs(c-x)<Math.abs(u-x)?c:u;let b=r*e;const E=h+b,T=o===void 0?E:o(E);T!==E&&(b=T-h);const D=x=>-b*Math.exp(-x/n),P=x=>T+D(x),A=x=>{const R=D(x),N=P(x);m.done=Math.abs(R)<=d,m.value=m.done?T:N};let C,O;const I=x=>{_(m.value)&&(C=x,O=vb({keyframes:[m.value,w(m.value)],velocity:z4(P,x,m.value),damping:a,stiffness:i,restDelta:d,restSpeed:f}))};return I(0),{calculatedDuration:null,next:x=>{let R=!1;return!O&&C===void 0&&(R=!0,A(x),I(x)),C!==void 0&&x>=C?O.next(x-C):(!R&&A(x),m)}}}function Dpe(t,e,r){const n=[],a=r||Gc.mix||F4,i=t.length-1;for(let o=0;o<i;o++){let c=a(t[o],t[o+1]);if(e){const u=Array.isArray(e)?e[o]||hs:e;c=zg(u,c)}n.push(c)}return n}function Ope(t,e,{clamp:r=!0,ease:n,mixer:a}={}){const i=t.length;if(cA(i===e.length),i===1)return()=>e[0];if(i===2&&e[0]===e[1])return()=>e[1];const o=t[0]===t[1];t[0]>t[i-1]&&(t=[...t].reverse(),e=[...e].reverse());const c=Dpe(e,n,a),u=c.length,d=f=>{if(o&&f<t[0])return e[0];let h=0;if(u>1)for(;h<t.length-2&&!(f<t[h+1]);h++);const m=Ym(t[h],t[h+1],f);return c[h](m)};return r?f=>d(Hc(t[0],t[i-1],f)):d}function Npe(t,e){const r=t[t.length-1];for(let n=1;n<=e;n++){const a=Ym(0,e,n);t.push(En(r,1,a))}}function Ipe(t){const e=[0];return Npe(e,t.length-1),e}function Mpe(t,e){return t.map(r=>r*e)}function jpe(t,e){return t.map(()=>e||R4).splice(0,t.length-1)}function _m({duration:t=300,keyframes:e,times:r,ease:n="easeInOut"}){const a=Wfe(n)?n.map(nj):nj(n),i={done:!1,value:e[0]},o=Mpe(r&&r.length===e.length?r:Ipe(e),t),c=Ope(o,e,{ease:Array.isArray(a)?a:jpe(e,a)});return{calculatedDuration:t,next:u=>(i.value=c(u),i.done=u>=t,i)}}const Lpe=t=>t!==null;function _A(t,{repeat:e,repeatType:r="loop"},n,a=1){const i=t.filter(Lpe),c=a<0||e&&r!=="loop"&&e%2===1?0:i.length-1;return!c||n===void 0?i[c]:n}const Bpe={decay:OC,inertia:OC,tween:_m,keyframes:_m,spring:vb};function $4(t){typeof t.type=="string"&&(t.type=Bpe[t.type])}class bA{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,r){return this.finished.then(e,r)}}const Upe=t=>t/100;class kA extends bA{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:r}=this.options;r&&r.updatedAt!==di.now()&&this.tick(di.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;$4(e);const{type:r=_m,repeat:n=0,repeatDelay:a=0,repeatType:i,velocity:o=0}=e;let{keyframes:c}=e;const u=r||_m;u!==_m&&typeof c[0]!="number"&&(this.mixKeyframes=zg(Upe,F4(c[0],c[1])),c=[0,100]);const d=u({...e,keyframes:c});i==="mirror"&&(this.mirroredGenerator=u({...e,keyframes:[...c].reverse(),velocity:-o})),d.calculatedDuration===null&&(d.calculatedDuration=vA(d));const{calculatedDuration:f}=d;this.calculatedDuration=f,this.resolvedDuration=f+a,this.totalDuration=this.resolvedDuration*(n+1)-a,this.generator=d}updateTime(e){const r=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=r}tick(e,r=!1){const{generator:n,totalDuration:a,mixKeyframes:i,mirroredGenerator:o,resolvedDuration:c,calculatedDuration:u}=this;if(this.startTime===null)return n.next(0);const{delay:d=0,keyframes:f,repeat:h,repeatType:m,repeatDelay:_,type:w,onUpdate:b,finalKeyframe:E}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-a/this.speed,this.startTime)),r?this.currentTime=e:this.updateTime(e);const T=this.currentTime-d*(this.playbackSpeed>=0?1:-1),D=this.playbackSpeed>=0?T<0:T>a;this.currentTime=Math.max(T,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=a);let P=this.currentTime,A=n;if(h){const x=Math.min(this.currentTime,a)/c;let R=Math.floor(x),N=x%1;!N&&x>=1&&(N=1),N===1&&R--,R=Math.min(R,h+1),!!(R%2)&&(m==="reverse"?(N=1-N,_&&(N-=_/c)):m==="mirror"&&(A=o)),P=Hc(0,1,N)*c}const C=D?{done:!1,value:f[0]}:A.next(P);i&&(C.value=i(C.value));let{done:O}=C;!D&&u!==null&&(O=this.playbackSpeed>=0?this.currentTime>=a:this.currentTime<=0);const I=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&O);return I&&w!==OC&&(C.value=_A(f,this.options,E,this.speed)),b&&b(C.value),I&&this.finish(),C}then(e,r){return this.finished.then(e,r)}get duration(){return fs(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+fs(e)}get time(){return fs(this.currentTime)}set time(e){e=zo(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(di.now());const r=this.playbackSpeed!==e;this.playbackSpeed=e,r&&(this.time=fs(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=wpe,startTime:r}=this.options;this.driver||(this.driver=e(a=>this.tick(a))),this.options.onPlay?.();const n=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=n):this.holdTime!==null?this.startTime=n-this.holdTime:this.startTime||(this.startTime=r??n),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(di.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}}function Fpe(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const Xu=t=>t*180/Math.PI,NC=t=>{const e=Xu(Math.atan2(t[1],t[0]));return IC(e)},qpe={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:NC,rotateZ:NC,skewX:t=>Xu(Math.atan(t[1])),skewY:t=>Xu(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},IC=t=>(t=t%360,t<0&&(t+=360),t),lj=NC,uj=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),dj=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),zpe={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:uj,scaleY:dj,scale:t=>(uj(t)+dj(t))/2,rotateX:t=>IC(Xu(Math.atan2(t[6],t[5]))),rotateY:t=>IC(Xu(Math.atan2(-t[2],t[0]))),rotateZ:lj,rotate:lj,skewX:t=>Xu(Math.atan(t[4])),skewY:t=>Xu(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function MC(t){return t.includes("scale")?1:0}function jC(t,e){if(!t||t==="none")return MC(e);const r=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let n,a;if(r)n=zpe,a=r;else{const c=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);n=qpe,a=c}if(!a)return MC(e);const i=n[e],o=a[1].split(",").map(Vpe);return typeof i=="function"?i(o):o[i]}const $pe=(t,e)=>{const{transform:r="none"}=getComputedStyle(t);return jC(r,e)};function Vpe(t){return parseFloat(t.trim())}const Np=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Ip=new Set(Np),fj=t=>t===Op||t===Jt,Hpe=new Set(["x","y","z"]),Gpe=Np.filter(t=>!Hpe.has(t));function Wpe(t){const e=[];return Gpe.forEach(r=>{const n=t.getValue(r);n!==void 0&&(e.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),e}const nd={width:({x:t},{paddingLeft:e="0",paddingRight:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),height:({y:t},{paddingTop:e="0",paddingBottom:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>jC(e,"x"),y:(t,{transform:e})=>jC(e,"y")};nd.translateX=nd.x;nd.translateY=nd.y;const ad=new Set;let LC=!1,BC=!1,UC=!1;function V4(){if(BC){const t=Array.from(ad).filter(n=>n.needsMeasurement),e=new Set(t.map(n=>n.element)),r=new Map;e.forEach(n=>{const a=Wpe(n);a.length&&(r.set(n,a),n.render())}),t.forEach(n=>n.measureInitialState()),e.forEach(n=>{n.render();const a=r.get(n);a&&a.forEach(([i,o])=>{n.getValue(i)?.set(o)})}),t.forEach(n=>n.measureEndState()),t.forEach(n=>{n.suspendedScrollY!==void 0&&window.scrollTo(0,n.suspendedScrollY)})}BC=!1,LC=!1,ad.forEach(t=>t.complete(UC)),ad.clear()}function H4(){ad.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(BC=!0)})}function Kpe(){UC=!0,H4(),V4(),UC=!1}class wA{constructor(e,r,n,a,i,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=r,this.name=n,this.motionValue=a,this.element=i,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(ad.add(this),LC||(LC=!0,wn.read(H4),wn.resolveKeyframes(V4))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:r,element:n,motionValue:a}=this;if(e[0]===null){const i=a?.get(),o=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&r){const c=n.readValue(r,o);c!=null&&(e[0]=c)}e[0]===void 0&&(e[0]=o),a&&i===void 0&&a.set(e[0])}Fpe(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),ad.delete(this)}cancel(){this.state==="scheduled"&&(ad.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const Ype=t=>t.startsWith("--");function Xpe(t,e,r){Ype(e)?t.style.setProperty(e,r):t.style[e]=r}const Jpe=lA(()=>window.ScrollTimeline!==void 0),Qpe={};function Zpe(t,e){const r=lA(t);return()=>Qpe[e]??r()}const G4=Zpe(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Zh=([t,e,r,n])=>`cubic-bezier(${t}, ${e}, ${r}, ${n})`,pj={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Zh([0,.65,.55,1]),circOut:Zh([.55,0,1,.45]),backIn:Zh([.31,.01,.66,-.59]),backOut:Zh([.33,1.53,.69,.99])};function W4(t,e){if(t)return typeof t=="function"?G4()?q4(t,e):"ease-out":D4(t)?Zh(t):Array.isArray(t)?t.map(r=>W4(r,e)||pj.easeOut):pj[t]}function ehe(t,e,r,{delay:n=0,duration:a=300,repeat:i=0,repeatType:o="loop",ease:c="easeOut",times:u}={},d=void 0){const f={[e]:r};u&&(f.offset=u);const h=W4(c,a);Array.isArray(h)&&(f.easing=h);const m={delay:n,duration:a,easing:Array.isArray(h)?"linear":h,fill:"both",iterations:i+1,direction:o==="reverse"?"alternate":"normal"};return d&&(m.pseudoElement=d),t.animate(f,m)}function K4(t){return typeof t=="function"&&"applyToOptions"in t}function the({type:t,...e}){return K4(t)&&G4()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class rhe extends bA{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,!e)return;const{element:r,name:n,keyframes:a,pseudoElement:i,allowFlatten:o=!1,finalKeyframe:c,onComplete:u}=e;this.isPseudoElement=!!i,this.allowFlatten=o,this.options=e,cA(typeof e.type!="string");const d=the(e);this.animation=ehe(r,n,a,d,i),d.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){const f=_A(a,this.options,c,this.speed);this.updateMotionValue?this.updateMotionValue(f):Xpe(r,n,f),this.animation.cancel()}u?.(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){const e=this.animation.effect?.getComputedTiming?.().duration||0;return fs(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+fs(e)}get time(){return fs(Number(this.animation.currentTime)||0)}set time(e){this.finishedTime=null,this.animation.currentTime=zo(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(e){this.animation.startTime=e}attachTimeline({timeline:e,observe:r}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&Jpe()?(this.animation.timeline=e,hs):r(this)}}const Y4={anticipate:x4,backInOut:C4,circInOut:A4};function nhe(t){return t in Y4}function ahe(t){typeof t.ease=="string"&&nhe(t.ease)&&(t.ease=Y4[t.ease])}const hj=10;class ihe extends rhe{constructor(e){ahe(e),$4(e),super(e),e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:r,onUpdate:n,onComplete:a,element:i,...o}=this.options;if(!r)return;if(e!==void 0){r.set(e);return}const c=new kA({...o,autoplay:!1}),u=zo(this.finishedTime??this.time);r.setWithVelocity(c.sample(u-hj).value,c.sample(u).value,hj),c.stop()}}const mj=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(su.test(t)||t==="0")&&!t.startsWith("url("));function she(t){const e=t[0];if(t.length===1)return!0;for(let r=0;r<t.length;r++)if(t[r]!==e)return!0}function ohe(t,e,r,n){const a=t[0];if(a===null)return!1;if(e==="display"||e==="visibility")return!0;const i=t[t.length-1],o=mj(a,e),c=mj(i,e);return!o||!c?!1:she(t)||(r==="spring"||K4(r))&&n}function FC(t){t.duration=0,t.type="keyframes"}const che=new Set(["opacity","clipPath","filter","transform"]),lhe=lA(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function uhe(t){const{motionValue:e,name:r,repeatDelay:n,repeatType:a,damping:i,type:o}=t;if(!(e?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:u,transformTemplate:d}=e.owner.getProps();return lhe()&&r&&che.has(r)&&(r!=="transform"||!d)&&!u&&!n&&a!=="mirror"&&i!==0&&o!=="inertia"}const dhe=40;class fhe extends bA{constructor({autoplay:e=!0,delay:r=0,type:n="keyframes",repeat:a=0,repeatDelay:i=0,repeatType:o="loop",keyframes:c,name:u,motionValue:d,element:f,...h}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=di.now();const m={autoplay:e,delay:r,type:n,repeat:a,repeatDelay:i,repeatType:o,name:u,motionValue:d,element:f,...h},_=f?.KeyframeResolver||wA;this.keyframeResolver=new _(c,(w,b,E)=>this.onKeyframesResolved(w,b,m,!E),u,d,f),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,r,n,a){this.keyframeResolver=void 0;const{name:i,type:o,velocity:c,delay:u,isHandoff:d,onUpdate:f}=n;this.resolvedAt=di.now(),ohe(e,i,o,c)||((Gc.instantAnimations||!u)&&f?.(_A(e,n,r)),e[0]=e[e.length-1],FC(n),n.repeat=0);const m={startTime:a?this.resolvedAt?this.resolvedAt-this.createdAt>dhe?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:r,...n,keyframes:e},_=!d&&uhe(m)?new ihe({...m,element:m.motionValue.owner.current}):new kA(m);_.finished.then(()=>this.notifyFinished()).catch(hs),this.pendingTimeline&&(this.stopTimeline=_.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=_}get finished(){return this._animation?this.animation.finished:this._finished}then(e,r){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),Kpe()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}const phe=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function hhe(t){const e=phe.exec(t);if(!e)return[,];const[,r,n,a]=e;return[`--${r??n}`,a]}function X4(t,e,r=1){const[n,a]=hhe(t);if(!n)return;const i=window.getComputedStyle(e).getPropertyValue(n);if(i){const o=i.trim();return v4(o)?parseFloat(o):o}return hA(a)?X4(a,e,r+1):a}function SA(t,e){return t?.[e]??t?.default??t}const J4=new Set(["width","height","top","left","right","bottom",...Np]),mhe={test:t=>t==="auto",parse:t=>t},Q4=t=>e=>e.test(t),Z4=[Op,Jt,$o,xl,spe,ipe,mhe],gj=t=>Z4.find(Q4(t));function ghe(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||b4(t):!0}const yhe=new Set(["brightness","contrast","saturate","opacity"]);function vhe(t){const[e,r]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[n]=r.match(mA)||[];if(!n)return t;const a=r.replace(n,"");let i=yhe.has(e)?1:0;return n!==r&&(i*=100),e+"("+i+a+")"}const _he=/\b([a-z-]*)\(.*?\)/gu,qC={...su,getAnimatableNone:t=>{const e=t.match(_he);return e?e.map(vhe).join(" "):t}},yj={...Op,transform:Math.round},bhe={rotate:xl,rotateX:xl,rotateY:xl,rotateZ:xl,scale:Cv,scaleX:Cv,scaleY:Cv,scaleZ:Cv,skew:xl,skewX:xl,skewY:xl,distance:Jt,translateX:Jt,translateY:Jt,translateZ:Jt,x:Jt,y:Jt,z:Jt,perspective:Jt,transformPerspective:Jt,opacity:Xm,originX:aj,originY:aj,originZ:Jt},EA={borderWidth:Jt,borderTopWidth:Jt,borderRightWidth:Jt,borderBottomWidth:Jt,borderLeftWidth:Jt,borderRadius:Jt,radius:Jt,borderTopLeftRadius:Jt,borderTopRightRadius:Jt,borderBottomRightRadius:Jt,borderBottomLeftRadius:Jt,width:Jt,maxWidth:Jt,height:Jt,maxHeight:Jt,top:Jt,right:Jt,bottom:Jt,left:Jt,padding:Jt,paddingTop:Jt,paddingRight:Jt,paddingBottom:Jt,paddingLeft:Jt,margin:Jt,marginTop:Jt,marginRight:Jt,marginBottom:Jt,marginLeft:Jt,backgroundPositionX:Jt,backgroundPositionY:Jt,...bhe,zIndex:yj,fillOpacity:Xm,strokeOpacity:Xm,numOctaves:yj},khe={...EA,color:Kn,backgroundColor:Kn,outlineColor:Kn,fill:Kn,stroke:Kn,borderColor:Kn,borderTopColor:Kn,borderRightColor:Kn,borderBottomColor:Kn,borderLeftColor:Kn,filter:qC,WebkitFilter:qC},ez=t=>khe[t];function tz(t,e){let r=ez(t);return r!==qC&&(r=su),r.getAnimatableNone?r.getAnimatableNone(e):void 0}const whe=new Set(["auto","none","0"]);function She(t,e,r){let n=0,a;for(;n<t.length&&!a;){const i=t[n];typeof i=="string"&&!whe.has(i)&&Jm(i).values.length&&(a=t[n]),n++}if(a&&r)for(const i of e)t[i]=tz(r,a)}class Ehe extends wA{constructor(e,r,n,a,i){super(e,r,n,a,i,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:r,name:n}=this;if(!r||!r.current)return;super.readKeyframes();for(let u=0;u<e.length;u++){let d=e[u];if(typeof d=="string"&&(d=d.trim(),hA(d))){const f=X4(d,r.current);f!==void 0&&(e[u]=f),u===e.length-1&&(this.finalKeyframe=d)}}if(this.resolveNoneKeyframes(),!J4.has(n)||e.length!==2)return;const[a,i]=e,o=gj(a),c=gj(i);if(o!==c)if(fj(o)&&fj(c))for(let u=0;u<e.length;u++){const d=e[u];typeof d=="string"&&(e[u]=parseFloat(d))}else nd[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:r}=this,n=[];for(let a=0;a<e.length;a++)(e[a]===null||ghe(e[a]))&&n.push(a);n.length&&She(e,n,r)}measureInitialState(){const{element:e,unresolvedKeyframes:r,name:n}=this;if(!e||!e.current)return;n==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=nd[n](e.measureViewportBox(),window.getComputedStyle(e.current)),r[0]=this.measuredOrigin;const a=r[r.length-1];a!==void 0&&e.getValue(n,a).jump(a,!1)}measureEndState(){const{element:e,name:r,unresolvedKeyframes:n}=this;if(!e||!e.current)return;const a=e.getValue(r);a&&a.jump(this.measuredOrigin,!1);const i=n.length-1,o=n[i];n[i]=nd[r](e.measureViewportBox(),window.getComputedStyle(e.current)),o!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=o),this.removedTransforms?.length&&this.removedTransforms.forEach(([c,u])=>{e.getValue(c).set(u)}),this.resolveNoneKeyframes()}}function The(t,e,r){if(t instanceof EventTarget)return[t];if(typeof t=="string"){let n=document;const a=r?.[t]??n.querySelectorAll(t);return a?Array.from(a):[]}return Array.from(t)}const rz=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function Che(t){return _4(t)&&"offsetHeight"in t}const vj=30,xhe=t=>!isNaN(parseFloat(t));class Phe{constructor(e,r={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=n=>{const a=di.now();if(this.updatedAt!==a&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(n),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const i of this.dependents)i.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=r.owner}setCurrent(e){this.current=e,this.updatedAt=di.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=xhe(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,r){this.events[e]||(this.events[e]=new uA);const n=this.events[e].add(r);return e==="change"?()=>{n(),wn.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,r){this.passiveEffect=e,this.stopPassiveEffect=r}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,r,n){this.set(r),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,r=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,r&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=di.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>vj)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,vj);return k4(parseFloat(this.current)-parseFloat(this.prevFrameValue),r)}start(e){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=e(r),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function pp(t,e){return new Phe(t,e)}const{schedule:TA}=O4(queueMicrotask,!1),Bs={x:!1,y:!1};function nz(){return Bs.x||Bs.y}function Ahe(t){return t==="x"||t==="y"?Bs[t]?null:(Bs[t]=!0,()=>{Bs[t]=!1}):Bs.x||Bs.y?null:(Bs.x=Bs.y=!0,()=>{Bs.x=Bs.y=!1})}function az(t,e){const r=The(t),n=new AbortController,a={passive:!0,...e,signal:n.signal};return[r,a,()=>n.abort()]}function _j(t){return!(t.pointerType==="touch"||nz())}function Rhe(t,e,r={}){const[n,a,i]=az(t,r),o=c=>{if(!_j(c))return;const{target:u}=c,d=e(u,c);if(typeof d!="function"||!u)return;const f=h=>{_j(h)&&(d(h),u.removeEventListener("pointerleave",f))};u.addEventListener("pointerleave",f,a)};return n.forEach(c=>{c.addEventListener("pointerenter",o,a)}),i}const iz=(t,e)=>e?t===e?!0:iz(t,e.parentElement):!1,CA=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,Dhe=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Ohe(t){return Dhe.has(t.tagName)||t.tabIndex!==-1}const v_=new WeakSet;function bj(t){return e=>{e.key==="Enter"&&t(e)}}function TE(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const Nhe=(t,e)=>{const r=t.currentTarget;if(!r)return;const n=bj(()=>{if(v_.has(r))return;TE(r,"down");const a=bj(()=>{TE(r,"up")}),i=()=>TE(r,"cancel");r.addEventListener("keyup",a,e),r.addEventListener("blur",i,e)});r.addEventListener("keydown",n,e),r.addEventListener("blur",()=>r.removeEventListener("keydown",n),e)};function kj(t){return CA(t)&&!nz()}function Ihe(t,e,r={}){const[n,a,i]=az(t,r),o=c=>{const u=c.currentTarget;if(!kj(c))return;v_.add(u);const d=e(u,c),f=(_,w)=>{window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",m),v_.has(u)&&v_.delete(u),kj(_)&&typeof d=="function"&&d(_,{success:w})},h=_=>{f(_,u===window||u===document||r.useGlobalTarget||iz(u,_.target))},m=_=>{f(_,!1)};window.addEventListener("pointerup",h,a),window.addEventListener("pointercancel",m,a)};return n.forEach(c=>{(r.useGlobalTarget?window:c).addEventListener("pointerdown",o,a),Che(c)&&(c.addEventListener("focus",d=>Nhe(d,a)),!Ohe(c)&&!c.hasAttribute("tabindex")&&(c.tabIndex=0))}),i}function sz(t){return _4(t)&&"ownerSVGElement"in t}function Mhe(t){return sz(t)&&t.tagName==="svg"}const La=t=>!!(t&&t.getVelocity),jhe=[...Z4,Kn,su],Lhe=t=>jhe.find(Q4(t)),oz=v.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function Bhe(t=!0){const e=v.useContext(iA);if(e===null)return[!0,null];const{isPresent:r,onExitComplete:n,register:a}=e,i=v.useId();v.useEffect(()=>{if(t)return a(i)},[t]);const o=v.useCallback(()=>t&&n&&n(i),[i,n,t]);return!r&&n?[!1,o]:[!0]}const cz=v.createContext({strict:!1}),wj={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},hp={};for(const t in wj)hp[t]={isEnabled:e=>wj[t].some(r=>!!e[r])};function Uhe(t){for(const e in t)hp[e]={...hp[e],...t[e]}}const Fhe=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function _b(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Fhe.has(t)}let lz=t=>!_b(t);function qhe(t){typeof t=="function"&&(lz=e=>e.startsWith("on")?!_b(e):t(e))}try{qhe(require("@emotion/is-prop-valid").default)}catch{}function zhe(t,e,r){const n={};for(const a in t)a==="values"&&typeof t.values=="object"||(lz(a)||r===!0&&_b(a)||!e&&!_b(a)||t.draggable&&a.startsWith("onDrag"))&&(n[a]=t[a]);return n}const _0=v.createContext({});function b0(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function Qm(t){return typeof t=="string"||Array.isArray(t)}const xA=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],PA=["initial",...xA];function k0(t){return b0(t.animate)||PA.some(e=>Qm(t[e]))}function uz(t){return!!(k0(t)||t.variants)}function $he(t,e){if(k0(t)){const{initial:r,animate:n}=t;return{initial:r===!1||Qm(r)?r:void 0,animate:Qm(n)?n:void 0}}return t.inherit!==!1?e:{}}function Vhe(t){const{initial:e,animate:r}=$he(t,v.useContext(_0));return v.useMemo(()=>({initial:e,animate:r}),[Sj(e),Sj(r)])}function Sj(t){return Array.isArray(t)?t.join(" "):t}const Zm={};function Hhe(t){for(const e in t)Zm[e]=t[e],pA(e)&&(Zm[e].isCSSVariable=!0)}function dz(t,{layout:e,layoutId:r}){return Ip.has(t)||t.startsWith("origin")||(e||r!==void 0)&&(!!Zm[t]||t==="opacity")}const Ghe={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Whe=Np.length;function Khe(t,e,r){let n="",a=!0;for(let i=0;i<Whe;i++){const o=Np[i],c=t[o];if(c===void 0)continue;let u=!0;if(typeof c=="number"?u=c===(o.startsWith("scale")?1:0):u=parseFloat(c)===0,!u||r){const d=rz(c,EA[o]);if(!u){a=!1;const f=Ghe[o]||o;n+=`${f}(${d}) `}r&&(e[o]=d)}}return n=n.trim(),r?n=r(e,a?"":n):a&&(n="none"),n}function AA(t,e,r){const{style:n,vars:a,transformOrigin:i}=t;let o=!1,c=!1;for(const u in e){const d=e[u];if(Ip.has(u)){o=!0;continue}else if(pA(u)){a[u]=d;continue}else{const f=rz(d,EA[u]);u.startsWith("origin")?(c=!0,i[u]=f):n[u]=f}}if(e.transform||(o||r?n.transform=Khe(e,t.transform,r):n.transform&&(n.transform="none")),c){const{originX:u="50%",originY:d="50%",originZ:f=0}=i;n.transformOrigin=`${u} ${d} ${f}`}}const RA=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function fz(t,e,r){for(const n in e)!La(e[n])&&!dz(n,r)&&(t[n]=e[n])}function Yhe({transformTemplate:t},e){return v.useMemo(()=>{const r=RA();return AA(r,e,t),Object.assign({},r.vars,r.style)},[e])}function Xhe(t,e){const r=t.style||{},n={};return fz(n,r,t),Object.assign(n,Yhe(t,e)),n}function Jhe(t,e){const r={},n=Xhe(t,e);return t.drag&&t.dragListener!==!1&&(r.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(r.tabIndex=0),r.style=n,r}const Qhe={offset:"stroke-dashoffset",array:"stroke-dasharray"},Zhe={offset:"strokeDashoffset",array:"strokeDasharray"};function eme(t,e,r=1,n=0,a=!0){t.pathLength=1;const i=a?Qhe:Zhe;t[i.offset]=Jt.transform(-n);const o=Jt.transform(e),c=Jt.transform(r);t[i.array]=`${o} ${c}`}function pz(t,{attrX:e,attrY:r,attrScale:n,pathLength:a,pathSpacing:i=1,pathOffset:o=0,...c},u,d,f){if(AA(t,c,d),u){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:h,style:m}=t;h.transform&&(m.transform=h.transform,delete h.transform),(m.transform||h.transformOrigin)&&(m.transformOrigin=h.transformOrigin??"50% 50%",delete h.transformOrigin),m.transform&&(m.transformBox=f?.transformBox??"fill-box",delete h.transformBox),e!==void 0&&(h.x=e),r!==void 0&&(h.y=r),n!==void 0&&(h.scale=n),a!==void 0&&eme(h,a,i,o,!1)}const hz=()=>({...RA(),attrs:{}}),mz=t=>typeof t=="string"&&t.toLowerCase()==="svg";function tme(t,e,r,n){const a=v.useMemo(()=>{const i=hz();return pz(i,e,mz(n),t.transformTemplate,t.style),{...i.attrs,style:{...i.style}}},[e]);if(t.style){const i={};fz(i,t.style,t),a.style={...i,...a.style}}return a}const rme=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function DA(t){return typeof t!="string"||t.includes("-")?!1:!!(rme.indexOf(t)>-1||/[A-Z]/u.test(t))}function nme(t,e,r,{latestValues:n},a,i=!1){const c=(DA(t)?tme:Jhe)(e,n,a,t),u=zhe(e,typeof t=="string",i),d=t!==v.Fragment?{...u,...c,ref:r}:{},{children:f}=e,h=v.useMemo(()=>La(f)?f.get():f,[f]);return v.createElement(t,{...d,children:h})}function Ej(t){const e=[{},{}];return t?.values.forEach((r,n)=>{e[0][n]=r.get(),e[1][n]=r.getVelocity()}),e}function OA(t,e,r,n){if(typeof e=="function"){const[a,i]=Ej(n);e=e(r!==void 0?r:t.custom,a,i)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[a,i]=Ej(n);e=e(r!==void 0?r:t.custom,a,i)}return e}function __(t){return La(t)?t.get():t}function ame({scrapeMotionValuesFromProps:t,createRenderState:e},r,n,a){return{latestValues:ime(r,n,a,t),renderState:e()}}function ime(t,e,r,n){const a={},i=n(t,{});for(const m in i)a[m]=__(i[m]);let{initial:o,animate:c}=t;const u=k0(t),d=uz(t);e&&d&&!u&&t.inherit!==!1&&(o===void 0&&(o=e.initial),c===void 0&&(c=e.animate));let f=r?r.initial===!1:!1;f=f||o===!1;const h=f?c:o;if(h&&typeof h!="boolean"&&!b0(h)){const m=Array.isArray(h)?h:[h];for(let _=0;_<m.length;_++){const w=OA(t,m[_]);if(w){const{transitionEnd:b,transition:E,...T}=w;for(const D in T){let P=T[D];if(Array.isArray(P)){const A=f?P.length-1:0;P=P[A]}P!==null&&(a[D]=P)}for(const D in b)a[D]=b[D]}}}return a}const gz=t=>(e,r)=>{const n=v.useContext(_0),a=v.useContext(iA),i=()=>ame(t,e,n,a);return r?i():Ufe(i)};function NA(t,e,r){const{style:n}=t,a={};for(const i in n)(La(n[i])||e.style&&La(e.style[i])||dz(i,t)||r?.getValue(i)?.liveStyle!==void 0)&&(a[i]=n[i]);return a}const sme=gz({scrapeMotionValuesFromProps:NA,createRenderState:RA});function yz(t,e,r){const n=NA(t,e,r);for(const a in t)if(La(t[a])||La(e[a])){const i=Np.indexOf(a)!==-1?"attr"+a.charAt(0).toUpperCase()+a.substring(1):a;n[i]=t[a]}return n}const ome=gz({scrapeMotionValuesFromProps:yz,createRenderState:hz}),cme=Symbol.for("motionComponentSymbol");function Af(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function lme(t,e,r){return v.useCallback(n=>{n&&t.onMount&&t.onMount(n),e&&(n?e.mount(n):e.unmount()),r&&(typeof r=="function"?r(n):Af(r)&&(r.current=n))},[e])}const IA=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),ume="framerAppearId",vz="data-"+IA(ume),_z=v.createContext({});function dme(t,e,r,n,a){const{visualElement:i}=v.useContext(_0),o=v.useContext(cz),c=v.useContext(iA),u=v.useContext(oz).reducedMotion,d=v.useRef(null);n=n||o.renderer,!d.current&&n&&(d.current=n(t,{visualState:e,parent:i,props:r,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:u}));const f=d.current,h=v.useContext(_z);f&&!f.projection&&a&&(f.type==="html"||f.type==="svg")&&fme(d.current,r,a,h);const m=v.useRef(!1);v.useInsertionEffect(()=>{f&&m.current&&f.update(r,c)});const _=r[vz],w=v.useRef(!!_&&!window.MotionHandoffIsComplete?.(_)&&window.MotionHasOptimisedAnimation?.(_));return Ffe(()=>{f&&(m.current=!0,window.MotionIsMounted=!0,f.updateFeatures(),f.scheduleRenderMicrotask(),w.current&&f.animationState&&f.animationState.animateChanges())}),v.useEffect(()=>{f&&(!w.current&&f.animationState&&f.animationState.animateChanges(),w.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(_)}),w.current=!1),f.enteringChildren=void 0)}),f}function fme(t,e,r,n){const{layoutId:a,layout:i,drag:o,dragConstraints:c,layoutScroll:u,layoutRoot:d,layoutCrossfade:f}=e;t.projection=new r(t.latestValues,e["data-framer-portal-id"]?void 0:bz(t.parent)),t.projection.setOptions({layoutId:a,layout:i,alwaysMeasureLayout:!!o||c&&Af(c),visualElement:t,animationType:typeof i=="string"?i:"both",initialPromotionConfig:n,crossfade:f,layoutScroll:u,layoutRoot:d})}function bz(t){if(t)return t.options.allowProjection!==!1?t.projection:bz(t.parent)}function CE(t,{forwardMotionProps:e=!1}={},r,n){r&&Uhe(r);const a=DA(t)?ome:sme;function i(c,u){let d;const f={...v.useContext(oz),...c,layoutId:pme(c)},{isStatic:h}=f,m=Vhe(c),_=a(c,h);if(!h&&aA){hme();const w=mme(f);d=w.MeasureLayout,m.visualElement=dme(t,_,f,n,w.ProjectionNode)}return g.jsxs(_0.Provider,{value:m,children:[d&&m.visualElement?g.jsx(d,{visualElement:m.visualElement,...f}):null,nme(t,c,lme(_,m.visualElement,u),_,h,e)]})}i.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const o=v.forwardRef(i);return o[cme]=t,o}function pme({layoutId:t}){const e=v.useContext(y4).id;return e&&t!==void 0?e+"-"+t:t}function hme(t,e){v.useContext(cz).strict}function mme(t){const{drag:e,layout:r}=hp;if(!e&&!r)return{};const n={...e,...r};return{MeasureLayout:e?.isEnabled(t)||r?.isEnabled(t)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}function gme(t,e){if(typeof Proxy>"u")return CE;const r=new Map,n=(i,o)=>CE(i,o,t,e),a=(i,o)=>n(i,o);return new Proxy(a,{get:(i,o)=>o==="create"?n:(r.has(o)||r.set(o,CE(o,void 0,t,e)),r.get(o))})}function kz({top:t,left:e,right:r,bottom:n}){return{x:{min:e,max:r},y:{min:t,max:n}}}function yme({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function vme(t,e){if(!e)return t;const r=e({x:t.left,y:t.top}),n=e({x:t.right,y:t.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}function xE(t){return t===void 0||t===1}function zC({scale:t,scaleX:e,scaleY:r}){return!xE(t)||!xE(e)||!xE(r)}function Gu(t){return zC(t)||wz(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function wz(t){return Tj(t.x)||Tj(t.y)}function Tj(t){return t&&t!=="0%"}function bb(t,e,r){const n=t-r,a=e*n;return r+a}function Cj(t,e,r,n,a){return a!==void 0&&(t=bb(t,a,n)),bb(t,r,n)+e}function $C(t,e=0,r=1,n,a){t.min=Cj(t.min,e,r,n,a),t.max=Cj(t.max,e,r,n,a)}function Sz(t,{x:e,y:r}){$C(t.x,e.translate,e.scale,e.originPoint),$C(t.y,r.translate,r.scale,r.originPoint)}const xj=.999999999999,Pj=1.0000000000001;function _me(t,e,r,n=!1){const a=r.length;if(!a)return;e.x=e.y=1;let i,o;for(let c=0;c<a;c++){i=r[c],o=i.projectionDelta;const{visualElement:u}=i.options;u&&u.props.style&&u.props.style.display==="contents"||(n&&i.options.layoutScroll&&i.scroll&&i!==i.root&&Df(t,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),o&&(e.x*=o.x.scale,e.y*=o.y.scale,Sz(t,o)),n&&Gu(i.latestValues)&&Df(t,i.latestValues))}e.x<Pj&&e.x>xj&&(e.x=1),e.y<Pj&&e.y>xj&&(e.y=1)}function Rf(t,e){t.min=t.min+e,t.max=t.max+e}function Aj(t,e,r,n,a=.5){const i=En(t.min,t.max,a);$C(t,e,r,i,n)}function Df(t,e){Aj(t.x,e.x,e.scaleX,e.scale,e.originX),Aj(t.y,e.y,e.scaleY,e.scale,e.originY)}function Ez(t,e){return kz(vme(t.getBoundingClientRect(),e))}function bme(t,e,r){const n=Ez(t,r),{scroll:a}=e;return a&&(Rf(n.x,a.offset.x),Rf(n.y,a.offset.y)),n}const Rj=()=>({translate:0,scale:1,origin:0,originPoint:0}),Of=()=>({x:Rj(),y:Rj()}),Dj=()=>({min:0,max:0}),jn=()=>({x:Dj(),y:Dj()}),kb={current:null},MA={current:!1};function Tz(){if(MA.current=!0,!!aA)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>kb.current=t.matches;t.addEventListener("change",e),e()}else kb.current=!1}const kme=new WeakMap;function wme(t,e,r){for(const n in e){const a=e[n],i=r[n];if(La(a))t.addValue(n,a);else if(La(i))t.addValue(n,pp(a,{owner:t}));else if(i!==a)if(t.hasValue(n)){const o=t.getValue(n);o.liveStyle===!0?o.jump(a):o.hasAnimated||o.set(a)}else{const o=t.getStaticValue(n);t.addValue(n,pp(o!==void 0?o:a,{owner:t}))}}for(const n in r)e[n]===void 0&&t.removeValue(n);return e}const Oj=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class Sme{scrapeMotionValuesFromProps(e,r,n){return{}}constructor({parent:e,props:r,presenceContext:n,reducedMotionConfig:a,blockInitialAnimation:i,visualState:o},c={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=wA,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const m=di.now();this.renderScheduledAt<m&&(this.renderScheduledAt=m,wn.render(this.render,!1,!0))};const{latestValues:u,renderState:d}=o;this.latestValues=u,this.baseTarget={...u},this.initialValues=r.initial?{...u}:{},this.renderState=d,this.parent=e,this.props=r,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=a,this.options=c,this.blockInitialAnimation=!!i,this.isControllingVariants=k0(r),this.isVariantNode=uz(r),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:f,...h}=this.scrapeMotionValuesFromProps(r,{},this);for(const m in h){const _=h[m];u[m]!==void 0&&La(_)&&_.set(u[m])}}mount(e){this.current=e,kme.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((r,n)=>this.bindToMotionValue(n,r)),MA.current||Tz(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:kb.current,this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),iu(this.notifyUpdate),iu(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const r=this.features[e];r&&(r.unmount(),r.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,r){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const n=Ip.has(e);n&&this.onBindTransform&&this.onBindTransform();const a=r.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&wn.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let i;window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,r)),this.valueSubscriptions.set(e,()=>{a(),i&&i(),r.owner&&r.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in hp){const r=hp[e];if(!r)continue;const{isEnabled:n,Feature:a}=r;if(!this.features[e]&&a&&n(this.props)&&(this.features[e]=new a(this)),this.features[e]){const i=this.features[e];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):jn()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,r){this.latestValues[e]=r}update(e,r){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let n=0;n<Oj.length;n++){const a=Oj[n];this.propEventSubscriptions[a]&&(this.propEventSubscriptions[a](),delete this.propEventSubscriptions[a]);const i="on"+a,o=e[i];o&&(this.propEventSubscriptions[a]=this.on(a,o))}this.prevMotionValues=wme(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const r=this.getClosestVariantNode();if(r)return r.variantChildren&&r.variantChildren.add(e),()=>r.variantChildren.delete(e)}addValue(e,r){const n=this.values.get(e);r!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,r),this.values.set(e,r),this.latestValues[e]=r.get())}removeValue(e){this.values.delete(e);const r=this.valueSubscriptions.get(e);r&&(r(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,r){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&r!==void 0&&(n=pp(r===null?void 0:r,{owner:this}),this.addValue(e,n)),n}readValue(e,r){let n=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return n!=null&&(typeof n=="string"&&(v4(n)||b4(n))?n=parseFloat(n):!Lhe(n)&&su.test(r)&&(n=tz(e,r)),this.setBaseTarget(e,La(n)?n.get():n)),La(n)?n.get():n}setBaseTarget(e,r){this.baseTarget[e]=r}getBaseTarget(e){const{initial:r}=this.props;let n;if(typeof r=="string"||typeof r=="object"){const i=OA(this.props,r,this.presenceContext?.custom);i&&(n=i[e])}if(r&&n!==void 0)return n;const a=this.getBaseTargetFromProps(this.props,e);return a!==void 0&&!La(a)?a:this.initialValues[e]!==void 0&&n===void 0?void 0:this.baseTarget[e]}on(e,r){return this.events[e]||(this.events[e]=new uA),this.events[e].add(r)}notify(e,...r){this.events[e]&&this.events[e].notify(...r)}scheduleRenderMicrotask(){TA.render(this.render)}}class Cz extends Sme{constructor(){super(...arguments),this.KeyframeResolver=Ehe}sortInstanceNodePosition(e,r){return e.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(e,r){return e.style?e.style[r]:void 0}removeValueFromRenderState(e,{vars:r,style:n}){delete r[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;La(e)&&(this.childSubscription=e.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}function xz(t,{style:e,vars:r},n,a){const i=t.style;let o;for(o in e)i[o]=e[o];a?.applyProjectionStyles(i,n);for(o in r)i.setProperty(o,r[o])}function Eme(t){return window.getComputedStyle(t)}class Tme extends Cz{constructor(){super(...arguments),this.type="html",this.renderInstance=xz}readValueFromInstance(e,r){if(Ip.has(r))return this.projection?.isProjecting?MC(r):$pe(e,r);{const n=Eme(e),a=(pA(r)?n.getPropertyValue(r):n[r])||0;return typeof a=="string"?a.trim():a}}measureInstanceViewportBox(e,{transformPagePoint:r}){return Ez(e,r)}build(e,r,n){AA(e,r,n.transformTemplate)}scrapeMotionValuesFromProps(e,r,n){return NA(e,r,n)}}const Pz=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function Cme(t,e,r,n){xz(t,e,void 0,n);for(const a in e.attrs)t.setAttribute(Pz.has(a)?a:IA(a),e.attrs[a])}class xme extends Cz{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=jn}getBaseTargetFromProps(e,r){return e[r]}readValueFromInstance(e,r){if(Ip.has(r)){const n=ez(r);return n&&n.default||0}return r=Pz.has(r)?r:IA(r),e.getAttribute(r)}scrapeMotionValuesFromProps(e,r,n){return yz(e,r,n)}build(e,r,n){pz(e,r,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,r,n,a){Cme(e,r,n,a)}mount(e){this.isSVGTag=mz(e.tagName),super.mount(e)}}const Pme=(t,e)=>DA(t)?new xme(e):new Tme(e,{allowProjection:t!==v.Fragment});function Kf(t,e,r){const n=t.getProps();return OA(n,e,r!==void 0?r:n.custom,t)}const VC=t=>Array.isArray(t);function Ame(t,e,r){t.hasValue(e)?t.getValue(e).set(r):t.addValue(e,pp(r))}function Rme(t){return VC(t)?t[t.length-1]||0:t}function Dme(t,e){const r=Kf(t,e);let{transitionEnd:n={},transition:a={},...i}=r||{};i={...i,...n};for(const o in i){const c=Rme(i[o]);Ame(t,o,c)}}function Ome(t){return!!(La(t)&&t.add)}function HC(t,e){const r=t.getValue("willChange");if(Ome(r))return r.add(e);if(!r&&Gc.WillChange){const n=new Gc.WillChange("auto");t.addValue("willChange",n),n.add(e)}}function Az(t){return t.props[vz]}const Nme=t=>t!==null;function Ime(t,{repeat:e,repeatType:r="loop"},n){const a=t.filter(Nme),i=e&&r!=="loop"&&e%2===1?0:a.length-1;return a[i]}const Mme={type:"spring",stiffness:500,damping:25,restSpeed:10},jme=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),Lme={type:"keyframes",duration:.8},Bme={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Ume=(t,{keyframes:e})=>e.length>2?Lme:Ip.has(t)?t.startsWith("scale")?jme(e[1]):Mme:Bme;function Fme({when:t,delay:e,delayChildren:r,staggerChildren:n,staggerDirection:a,repeat:i,repeatType:o,repeatDelay:c,from:u,elapsed:d,...f}){return!!Object.keys(f).length}const jA=(t,e,r,n={},a,i)=>o=>{const c=SA(n,t)||{},u=c.delay||n.delay||0;let{elapsed:d=0}=n;d=d-zo(u);const f={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:e.getVelocity(),...c,delay:-d,onUpdate:m=>{e.set(m),c.onUpdate&&c.onUpdate(m)},onComplete:()=>{o(),c.onComplete&&c.onComplete()},name:t,motionValue:e,element:i?void 0:a};Fme(c)||Object.assign(f,Ume(t,f)),f.duration&&(f.duration=zo(f.duration)),f.repeatDelay&&(f.repeatDelay=zo(f.repeatDelay)),f.from!==void 0&&(f.keyframes[0]=f.from);let h=!1;if((f.type===!1||f.duration===0&&!f.repeatDelay)&&(FC(f),f.delay===0&&(h=!0)),(Gc.instantAnimations||Gc.skipAnimations)&&(h=!0,FC(f),f.delay=0),f.allowFlatten=!c.type&&!c.ease,h&&!i&&e.get()!==void 0){const m=Ime(f.keyframes,c);if(m!==void 0){wn.update(()=>{f.onUpdate(m),f.onComplete()});return}}return c.isSync?new kA(f):new fhe(f)};function qme({protectedKeys:t,needsAnimating:e},r){const n=t.hasOwnProperty(r)&&e[r]!==!0;return e[r]=!1,n}function Rz(t,e,{delay:r=0,transitionOverride:n,type:a}={}){let{transition:i=t.getDefaultTransition(),transitionEnd:o,...c}=e;n&&(i=n);const u=[],d=a&&t.animationState&&t.animationState.getState()[a];for(const f in c){const h=t.getValue(f,t.latestValues[f]??null),m=c[f];if(m===void 0||d&&qme(d,f))continue;const _={delay:r,...SA(i||{},f)},w=h.get();if(w!==void 0&&!h.isAnimating&&!Array.isArray(m)&&m===w&&!_.velocity)continue;let b=!1;if(window.MotionHandoffAnimation){const T=Az(t);if(T){const D=window.MotionHandoffAnimation(T,f,wn);D!==null&&(_.startTime=D,b=!0)}}HC(t,f),h.start(jA(f,h,m,t.shouldReduceMotion&&J4.has(f)?{type:!1}:_,t,b));const E=h.animation;E&&u.push(E)}return o&&Promise.all(u).then(()=>{wn.update(()=>{o&&Dme(t,o)})}),u}function Dz(t,e,r,n=0,a=1){const i=Array.from(t).sort((d,f)=>d.sortNodePosition(f)).indexOf(e),o=t.size,c=(o-1)*n;return typeof r=="function"?r(i,o):a===1?i*n:c-i*n}function GC(t,e,r={}){const n=Kf(t,e,r.type==="exit"?t.presenceContext?.custom:void 0);let{transition:a=t.getDefaultTransition()||{}}=n||{};r.transitionOverride&&(a=r.transitionOverride);const i=n?()=>Promise.all(Rz(t,n,r)):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:h}=a;return zme(t,e,u,d,f,h,r)}:()=>Promise.resolve(),{when:c}=a;if(c){const[u,d]=c==="beforeChildren"?[i,o]:[o,i];return u().then(()=>d())}else return Promise.all([i(),o(r.delay)])}function zme(t,e,r=0,n=0,a=0,i=1,o){const c=[];for(const u of t.variantChildren)u.notify("AnimationStart",e),c.push(GC(u,e,{...o,delay:r+(typeof n=="function"?0:n)+Dz(t.variantChildren,u,n,a,i)}).then(()=>u.notify("AnimationComplete",e)));return Promise.all(c)}function $me(t,e,r={}){t.notify("AnimationStart",e);let n;if(Array.isArray(e)){const a=e.map(i=>GC(t,i,r));n=Promise.all(a)}else if(typeof e=="string")n=GC(t,e,r);else{const a=typeof e=="function"?Kf(t,e,r.custom):e;n=Promise.all(Rz(t,a,r))}return n.then(()=>{t.notify("AnimationComplete",e)})}function Oz(t,e){if(!Array.isArray(e))return!1;const r=e.length;if(r!==t.length)return!1;for(let n=0;n<r;n++)if(e[n]!==t[n])return!1;return!0}const Vme=PA.length;function Nz(t){if(!t)return;if(!t.isControllingVariants){const r=t.parent?Nz(t.parent)||{}:{};return t.props.initial!==void 0&&(r.initial=t.props.initial),r}const e={};for(let r=0;r<Vme;r++){const n=PA[r],a=t.props[n];(Qm(a)||a===!1)&&(e[n]=a)}return e}const Hme=[...xA].reverse(),Gme=xA.length;function Wme(t){return e=>Promise.all(e.map(({animation:r,options:n})=>$me(t,r,n)))}function Kme(t){let e=Wme(t),r=Nj(),n=!0;const a=u=>(d,f)=>{const h=Kf(t,f,u==="exit"?t.presenceContext?.custom:void 0);if(h){const{transition:m,transitionEnd:_,...w}=h;d={...d,...w,..._}}return d};function i(u){e=u(t)}function o(u){const{props:d}=t,f=Nz(t.parent)||{},h=[],m=new Set;let _={},w=1/0;for(let E=0;E<Gme;E++){const T=Hme[E],D=r[T],P=d[T]!==void 0?d[T]:f[T],A=Qm(P),C=T===u?D.isActive:null;C===!1&&(w=E);let O=P===f[T]&&P!==d[T]&&A;if(O&&n&&t.manuallyAnimateOnMount&&(O=!1),D.protectedKeys={..._},!D.isActive&&C===null||!P&&!D.prevProp||b0(P)||typeof P=="boolean")continue;const I=Yme(D.prevProp,P);let x=I||T===u&&D.isActive&&!O&&A||E>w&&A,R=!1;const N=Array.isArray(P)?P:[P];let L=N.reduce(a(T),{});C===!1&&(L={});const{prevResolvedValues:j={}}=D,q={...j,...L},U=Y=>{x=!0,m.has(Y)&&(R=!0,m.delete(Y)),D.needsAnimating[Y]=!0;const Q=t.getValue(Y);Q&&(Q.liveStyle=!1)};for(const Y in q){const Q=L[Y],ie=j[Y];if(_.hasOwnProperty(Y))continue;let G=!1;VC(Q)&&VC(ie)?G=!Oz(Q,ie):G=Q!==ie,G?Q!=null?U(Y):m.add(Y):Q!==void 0&&m.has(Y)?U(Y):D.protectedKeys[Y]=!0}D.prevProp=P,D.prevResolvedValues=L,D.isActive&&(_={..._,...L}),n&&t.blockInitialAnimation&&(x=!1);const W=O&&I;x&&(!W||R)&&h.push(...N.map(Y=>{const Q={type:T};if(typeof Y=="string"&&n&&!W&&t.manuallyAnimateOnMount&&t.parent){const{parent:ie}=t,G=Kf(ie,Y);if(ie.enteringChildren&&G){const{delayChildren:B}=G.transition||{};Q.delay=Dz(ie.enteringChildren,t,B)}}return{animation:Y,options:Q}}))}if(m.size){const E={};if(typeof d.initial!="boolean"){const T=Kf(t,Array.isArray(d.initial)?d.initial[0]:d.initial);T&&T.transition&&(E.transition=T.transition)}m.forEach(T=>{const D=t.getBaseTarget(T),P=t.getValue(T);P&&(P.liveStyle=!0),E[T]=D??null}),h.push({animation:E})}let b=!!h.length;return n&&(d.initial===!1||d.initial===d.animate)&&!t.manuallyAnimateOnMount&&(b=!1),n=!1,b?e(h):Promise.resolve()}function c(u,d){if(r[u].isActive===d)return Promise.resolve();t.variantChildren?.forEach(h=>h.animationState?.setActive(u,d)),r[u].isActive=d;const f=o(u);for(const h in r)r[h].protectedKeys={};return f}return{animateChanges:o,setActive:c,setAnimateFunction:i,getState:()=>r,reset:()=>{r=Nj(),n=!0}}}function Yme(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!Oz(e,t):!1}function ju(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Nj(){return{animate:ju(!0),whileInView:ju(),whileHover:ju(),whileTap:ju(),whileDrag:ju(),whileFocus:ju(),exit:ju()}}class yu{constructor(e){this.isMounted=!1,this.node=e}update(){}}class Xme extends yu{constructor(e){super(e),e.animationState||(e.animationState=Kme(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();b0(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:r}=this.node.prevProps||{};e!==r&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let Jme=0;class Qme extends yu{constructor(){super(...arguments),this.id=Jme++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:r}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;const a=this.node.animationState.setActive("exit",!e);r&&!e&&a.then(()=>{r(this.id)})}mount(){const{register:e,onExitComplete:r}=this.node.presenceContext||{};r&&r(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const Zme={animation:{Feature:Xme},exit:{Feature:Qme}};function eg(t,e,r,n={passive:!0}){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r)}function Hg(t){return{point:{x:t.pageX,y:t.pageY}}}const ege=t=>e=>CA(e)&&t(e,Hg(e));function bm(t,e,r,n){return eg(t,e,ege(r),n)}const Iz=1e-4,tge=1-Iz,rge=1+Iz,Mz=.01,nge=0-Mz,age=0+Mz;function Ga(t){return t.max-t.min}function ige(t,e,r){return Math.abs(t-e)<=r}function Ij(t,e,r,n=.5){t.origin=n,t.originPoint=En(e.min,e.max,t.origin),t.scale=Ga(r)/Ga(e),t.translate=En(r.min,r.max,t.origin)-t.originPoint,(t.scale>=tge&&t.scale<=rge||isNaN(t.scale))&&(t.scale=1),(t.translate>=nge&&t.translate<=age||isNaN(t.translate))&&(t.translate=0)}function km(t,e,r,n){Ij(t.x,e.x,r.x,n?n.originX:void 0),Ij(t.y,e.y,r.y,n?n.originY:void 0)}function Mj(t,e,r){t.min=r.min+e.min,t.max=t.min+Ga(e)}function sge(t,e,r){Mj(t.x,e.x,r.x),Mj(t.y,e.y,r.y)}function jj(t,e,r){t.min=e.min-r.min,t.max=t.min+Ga(e)}function wm(t,e,r){jj(t.x,e.x,r.x),jj(t.y,e.y,r.y)}function ns(t){return[t("x"),t("y")]}const jz=({current:t})=>t?t.ownerDocument.defaultView:null,Lj=(t,e)=>Math.abs(t-e);function oge(t,e){const r=Lj(t.x,e.x),n=Lj(t.y,e.y);return Math.sqrt(r**2+n**2)}class Lz{constructor(e,r,{transformPagePoint:n,contextWindow:a=window,dragSnapToOrigin:i=!1,distanceThreshold:o=3}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const m=AE(this.lastMoveEventInfo,this.history),_=this.startEvent!==null,w=oge(m.offset,{x:0,y:0})>=this.distanceThreshold;if(!_&&!w)return;const{point:b}=m,{timestamp:E}=wa;this.history.push({...b,timestamp:E});const{onStart:T,onMove:D}=this.handlers;_||(T&&T(this.lastMoveEvent,m),this.startEvent=this.lastMoveEvent),D&&D(this.lastMoveEvent,m)},this.handlePointerMove=(m,_)=>{this.lastMoveEvent=m,this.lastMoveEventInfo=PE(_,this.transformPagePoint),wn.update(this.updatePoint,!0)},this.handlePointerUp=(m,_)=>{this.end();const{onEnd:w,onSessionEnd:b,resumeAnimation:E}=this.handlers;if(this.dragSnapToOrigin&&E&&E(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const T=AE(m.type==="pointercancel"?this.lastMoveEventInfo:PE(_,this.transformPagePoint),this.history);this.startEvent&&w&&w(m,T),b&&b(m,T)},!CA(e))return;this.dragSnapToOrigin=i,this.handlers=r,this.transformPagePoint=n,this.distanceThreshold=o,this.contextWindow=a||window;const c=Hg(e),u=PE(c,this.transformPagePoint),{point:d}=u,{timestamp:f}=wa;this.history=[{...d,timestamp:f}];const{onSessionStart:h}=r;h&&h(e,AE(u,this.history)),this.removeListeners=zg(bm(this.contextWindow,"pointermove",this.handlePointerMove),bm(this.contextWindow,"pointerup",this.handlePointerUp),bm(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),iu(this.updatePoint)}}function PE(t,e){return e?{point:e(t.point)}:t}function Bj(t,e){return{x:t.x-e.x,y:t.y-e.y}}function AE({point:t},e){return{point:t,delta:Bj(t,Bz(e)),offset:Bj(t,cge(e)),velocity:lge(e,.1)}}function cge(t){return t[0]}function Bz(t){return t[t.length-1]}function lge(t,e){if(t.length<2)return{x:0,y:0};let r=t.length-1,n=null;const a=Bz(t);for(;r>=0&&(n=t[r],!(a.timestamp-n.timestamp>zo(e)));)r--;if(!n)return{x:0,y:0};const i=fs(a.timestamp-n.timestamp);if(i===0)return{x:0,y:0};const o={x:(a.x-n.x)/i,y:(a.y-n.y)/i};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function uge(t,{min:e,max:r},n){return e!==void 0&&t<e?t=n?En(e,t,n.min):Math.max(t,e):r!==void 0&&t>r&&(t=n?En(r,t,n.max):Math.min(t,r)),t}function Uj(t,e,r){return{min:e!==void 0?t.min+e:void 0,max:r!==void 0?t.max+r-(t.max-t.min):void 0}}function dge(t,{top:e,left:r,bottom:n,right:a}){return{x:Uj(t.x,r,a),y:Uj(t.y,e,n)}}function Fj(t,e){let r=e.min-t.min,n=e.max-t.max;return e.max-e.min<t.max-t.min&&([r,n]=[n,r]),{min:r,max:n}}function fge(t,e){return{x:Fj(t.x,e.x),y:Fj(t.y,e.y)}}function pge(t,e){let r=.5;const n=Ga(t),a=Ga(e);return a>n?r=Ym(e.min,e.max-n,t.min):n>a&&(r=Ym(t.min,t.max-a,e.min)),Hc(0,1,r)}function hge(t,e){const r={};return e.min!==void 0&&(r.min=e.min-t.min),e.max!==void 0&&(r.max=e.max-t.min),r}const WC=.35;function mge(t=WC){return t===!1?t=0:t===!0&&(t=WC),{x:qj(t,"left","right"),y:qj(t,"top","bottom")}}function qj(t,e,r){return{min:zj(t,e),max:zj(t,r)}}function zj(t,e){return typeof t=="number"?t:t[e]||0}const gge=new WeakMap;class yge{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=jn(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:r=!1,distanceThreshold:n}={}){const{presenceContext:a}=this.visualElement;if(a&&a.isPresent===!1)return;const i=h=>{const{dragSnapToOrigin:m}=this.getProps();m?this.pauseAnimation():this.stopAnimation(),r&&this.snapToCursor(Hg(h).point)},o=(h,m)=>{const{drag:_,dragPropagation:w,onDragStart:b}=this.getProps();if(_&&!w&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Ahe(_),!this.openDragLock))return;this.latestPointerEvent=h,this.latestPanInfo=m,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),ns(T=>{let D=this.getAxisMotionValue(T).get()||0;if($o.test(D)){const{projection:P}=this.visualElement;if(P&&P.layout){const A=P.layout.layoutBox[T];A&&(D=Ga(A)*(parseFloat(D)/100))}}this.originPoint[T]=D}),b&&wn.postRender(()=>b(h,m)),HC(this.visualElement,"transform");const{animationState:E}=this.visualElement;E&&E.setActive("whileDrag",!0)},c=(h,m)=>{this.latestPointerEvent=h,this.latestPanInfo=m;const{dragPropagation:_,dragDirectionLock:w,onDirectionLock:b,onDrag:E}=this.getProps();if(!_&&!this.openDragLock)return;const{offset:T}=m;if(w&&this.currentDirection===null){this.currentDirection=vge(T),this.currentDirection!==null&&b&&b(this.currentDirection);return}this.updateAxis("x",m.point,T),this.updateAxis("y",m.point,T),this.visualElement.render(),E&&E(h,m)},u=(h,m)=>{this.latestPointerEvent=h,this.latestPanInfo=m,this.stop(h,m),this.latestPointerEvent=null,this.latestPanInfo=null},d=()=>ns(h=>this.getAnimationState(h)==="paused"&&this.getAxisMotionValue(h).animation?.play()),{dragSnapToOrigin:f}=this.getProps();this.panSession=new Lz(e,{onSessionStart:i,onStart:o,onMove:c,onSessionEnd:u,resumeAnimation:d},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:f,distanceThreshold:n,contextWindow:jz(this.visualElement)})}stop(e,r){const n=e||this.latestPointerEvent,a=r||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!a||!n)return;const{velocity:o}=a;this.startAnimation(o);const{onDragEnd:c}=this.getProps();c&&wn.postRender(()=>c(n,a))}cancel(){this.isDragging=!1;const{projection:e,animationState:r}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),r&&r.setActive("whileDrag",!1)}updateAxis(e,r,n){const{drag:a}=this.getProps();if(!n||!xv(e,a,this.currentDirection))return;const i=this.getAxisMotionValue(e);let o=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(o=uge(o,this.constraints[e],this.elastic[e])),i.set(o)}resolveConstraints(){const{dragConstraints:e,dragElastic:r}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,a=this.constraints;e&&Af(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&n?this.constraints=dge(n.layoutBox,e):this.constraints=!1,this.elastic=mge(r),a!==this.constraints&&n&&this.constraints&&!this.hasMutatedConstraints&&ns(i=>{this.constraints!==!1&&this.getAxisMotionValue(i)&&(this.constraints[i]=hge(n.layoutBox[i],this.constraints[i]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:r}=this.getProps();if(!e||!Af(e))return!1;const n=e.current,{projection:a}=this.visualElement;if(!a||!a.layout)return!1;const i=bme(n,a.root,this.visualElement.getTransformPagePoint());let o=fge(a.layout.layoutBox,i);if(r){const c=r(yme(o));this.hasMutatedConstraints=!!c,c&&(o=kz(c))}return o}startAnimation(e){const{drag:r,dragMomentum:n,dragElastic:a,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:c}=this.getProps(),u=this.constraints||{},d=ns(f=>{if(!xv(f,r,this.currentDirection))return;let h=u&&u[f]||{};o&&(h={min:0,max:0});const m=a?200:1e6,_=a?40:1e7,w={type:"inertia",velocity:n?e[f]:0,bounceStiffness:m,bounceDamping:_,timeConstant:750,restDelta:1,restSpeed:10,...i,...h};return this.startAxisValueAnimation(f,w)});return Promise.all(d).then(c)}startAxisValueAnimation(e,r){const n=this.getAxisMotionValue(e);return HC(this.visualElement,e),n.start(jA(e,n,0,r,this.visualElement,!1))}stopAnimation(){ns(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){ns(e=>this.getAxisMotionValue(e).animation?.pause())}getAnimationState(e){return this.getAxisMotionValue(e).animation?.state}getAxisMotionValue(e){const r=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps(),a=n[r];return a||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){ns(r=>{const{drag:n}=this.getProps();if(!xv(r,n,this.currentDirection))return;const{projection:a}=this.visualElement,i=this.getAxisMotionValue(r);if(a&&a.layout){const{min:o,max:c}=a.layout.layoutBox[r];i.set(e[r]-En(o,c,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:r}=this.getProps(),{projection:n}=this.visualElement;if(!Af(r)||!n||!this.constraints)return;this.stopAnimation();const a={x:0,y:0};ns(o=>{const c=this.getAxisMotionValue(o);if(c&&this.constraints!==!1){const u=c.get();a[o]=pge({min:u,max:u},this.constraints[o])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),ns(o=>{if(!xv(o,e,null))return;const c=this.getAxisMotionValue(o),{min:u,max:d}=this.constraints[o];c.set(En(u,d,a[o]))})}addListeners(){if(!this.visualElement.current)return;gge.set(this.visualElement,this);const e=this.visualElement.current,r=bm(e,"pointerdown",u=>{const{drag:d,dragListener:f=!0}=this.getProps();d&&f&&this.start(u)}),n=()=>{const{dragConstraints:u}=this.getProps();Af(u)&&u.current&&(this.constraints=this.resolveRefConstraints())},{projection:a}=this.visualElement,i=a.addEventListener("measure",n);a&&!a.layout&&(a.root&&a.root.updateScroll(),a.updateLayout()),wn.read(n);const o=eg(window,"resize",()=>this.scalePositionWithinConstraints()),c=a.addEventListener("didUpdate",(({delta:u,hasLayoutChanged:d})=>{this.isDragging&&d&&(ns(f=>{const h=this.getAxisMotionValue(f);h&&(this.originPoint[f]+=u[f].translate,h.set(h.get()+u[f].translate))}),this.visualElement.render())}));return()=>{o(),r(),i(),c&&c()}}getProps(){const e=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:n=!1,dragPropagation:a=!1,dragConstraints:i=!1,dragElastic:o=WC,dragMomentum:c=!0}=e;return{...e,drag:r,dragDirectionLock:n,dragPropagation:a,dragConstraints:i,dragElastic:o,dragMomentum:c}}}function xv(t,e,r){return(e===!0||e===t)&&(r===null||r===t)}function vge(t,e=10){let r=null;return Math.abs(t.y)>e?r="y":Math.abs(t.x)>e&&(r="x"),r}class _ge extends yu{constructor(e){super(e),this.removeGroupControls=hs,this.removeListeners=hs,this.controls=new yge(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||hs}unmount(){this.removeGroupControls(),this.removeListeners()}}const $j=t=>(e,r)=>{t&&wn.postRender(()=>t(e,r))};class bge extends yu{constructor(){super(...arguments),this.removePointerDownListener=hs}onPointerDown(e){this.session=new Lz(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:jz(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:r,onPan:n,onPanEnd:a}=this.node.getProps();return{onSessionStart:$j(e),onStart:$j(r),onMove:n,onEnd:(i,o)=>{delete this.session,a&&wn.postRender(()=>a(i,o))}}}mount(){this.removePointerDownListener=bm(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const b_={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Vj(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const jh={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(Jt.test(t))t=parseFloat(t);else return t;const r=Vj(t,e.target.x),n=Vj(t,e.target.y);return`${r}% ${n}%`}},kge={correct:(t,{treeScale:e,projectionDelta:r})=>{const n=t,a=su.parse(t);if(a.length>5)return n;const i=su.createTransformer(t),o=typeof a[0]!="number"?1:0,c=r.x.scale*e.x,u=r.y.scale*e.y;a[0+o]/=c,a[1+o]/=u;const d=En(c,u,.5);return typeof a[2+o]=="number"&&(a[2+o]/=d),typeof a[3+o]=="number"&&(a[3+o]/=d),i(a)}};let RE=!1;class wge extends v.Component{componentDidMount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n,layoutId:a}=this.props,{projection:i}=e;Hhe(Sge),i&&(r.group&&r.group.add(i),n&&n.register&&a&&n.register(i),RE&&i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),b_.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:r,visualElement:n,drag:a,isPresent:i}=this.props,{projection:o}=n;return o&&(o.isPresent=i,RE=!0,a||e.layoutDependency!==r||r===void 0||e.isPresent!==i?o.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?o.promote():o.relegate()||wn.postRender(()=>{const c=o.getStack();(!c||!c.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),TA.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n}=this.props,{projection:a}=e;RE=!0,a&&(a.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(a),n&&n.deregister&&n.deregister(a))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function Uz(t){const[e,r]=Bhe(),n=v.useContext(y4);return g.jsx(wge,{...t,layoutGroup:n,switchLayoutGroup:v.useContext(_z),isPresent:e,safeToRemove:r})}const Sge={borderRadius:{...jh,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:jh,borderTopRightRadius:jh,borderBottomLeftRadius:jh,borderBottomRightRadius:jh,boxShadow:kge};function Ege(t,e,r){const n=La(t)?t:pp(t);return n.start(jA("",n,e,r)),n.animation}const Tge=(t,e)=>t.depth-e.depth;class Cge{constructor(){this.children=[],this.isDirty=!1}add(e){sA(this.children,e),this.isDirty=!0}remove(e){oA(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Tge),this.isDirty=!1,this.children.forEach(e)}}function xge(t,e){const r=di.now(),n=({timestamp:a})=>{const i=a-r;i>=e&&(iu(n),t(i-e))};return wn.setup(n,!0),()=>iu(n)}const Fz=["TopLeft","TopRight","BottomLeft","BottomRight"],Pge=Fz.length,Hj=t=>typeof t=="string"?parseFloat(t):t,Gj=t=>typeof t=="number"||Jt.test(t);function Age(t,e,r,n,a,i){a?(t.opacity=En(0,r.opacity??1,Rge(n)),t.opacityExit=En(e.opacity??1,0,Dge(n))):i&&(t.opacity=En(e.opacity??1,r.opacity??1,n));for(let o=0;o<Pge;o++){const c=`border${Fz[o]}Radius`;let u=Wj(e,c),d=Wj(r,c);if(u===void 0&&d===void 0)continue;u||(u=0),d||(d=0),u===0||d===0||Gj(u)===Gj(d)?(t[c]=Math.max(En(Hj(u),Hj(d),n),0),($o.test(d)||$o.test(u))&&(t[c]+="%")):t[c]=d}(e.rotate||r.rotate)&&(t.rotate=En(e.rotate||0,r.rotate||0,n))}function Wj(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const Rge=qz(0,.5,P4),Dge=qz(.5,.95,hs);function qz(t,e,r){return n=>n<t?0:n>e?1:r(Ym(t,e,n))}function Kj(t,e){t.min=e.min,t.max=e.max}function ts(t,e){Kj(t.x,e.x),Kj(t.y,e.y)}function Yj(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function Xj(t,e,r,n,a){return t-=e,t=bb(t,1/r,n),a!==void 0&&(t=bb(t,1/a,n)),t}function Oge(t,e=0,r=1,n=.5,a,i=t,o=t){if($o.test(e)&&(e=parseFloat(e),e=En(o.min,o.max,e/100)-o.min),typeof e!="number")return;let c=En(i.min,i.max,n);t===i&&(c-=e),t.min=Xj(t.min,e,r,c,a),t.max=Xj(t.max,e,r,c,a)}function Jj(t,e,[r,n,a],i,o){Oge(t,e[r],e[n],e[a],e.scale,i,o)}const Nge=["x","scaleX","originX"],Ige=["y","scaleY","originY"];function Qj(t,e,r,n){Jj(t.x,e,Nge,r?r.x:void 0,n?n.x:void 0),Jj(t.y,e,Ige,r?r.y:void 0,n?n.y:void 0)}function Zj(t){return t.translate===0&&t.scale===1}function zz(t){return Zj(t.x)&&Zj(t.y)}function eL(t,e){return t.min===e.min&&t.max===e.max}function Mge(t,e){return eL(t.x,e.x)&&eL(t.y,e.y)}function tL(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function $z(t,e){return tL(t.x,e.x)&&tL(t.y,e.y)}function rL(t){return Ga(t.x)/Ga(t.y)}function nL(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class jge{constructor(){this.members=[]}add(e){sA(this.members,e),e.scheduleRender()}remove(e){if(oA(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(e){const r=this.members.findIndex(a=>e===a);if(r===0)return!1;let n;for(let a=r;a>=0;a--){const i=this.members[a];if(i.isPresent!==!1){n=i;break}}return n?(this.promote(n),!0):!1}promote(e,r){const n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender(),e.resumeFrom=n,r&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:a}=e.options;a===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:r,resumingFrom:n}=e;r.onExitComplete&&r.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function Lge(t,e,r){let n="";const a=t.x.translate/e.x,i=t.y.translate/e.y,o=r?.z||0;if((a||i||o)&&(n=`translate3d(${a}px, ${i}px, ${o}px) `),(e.x!==1||e.y!==1)&&(n+=`scale(${1/e.x}, ${1/e.y}) `),r){const{transformPerspective:d,rotate:f,rotateX:h,rotateY:m,skewX:_,skewY:w}=r;d&&(n=`perspective(${d}px) ${n}`),f&&(n+=`rotate(${f}deg) `),h&&(n+=`rotateX(${h}deg) `),m&&(n+=`rotateY(${m}deg) `),_&&(n+=`skewX(${_}deg) `),w&&(n+=`skewY(${w}deg) `)}const c=t.x.scale*e.x,u=t.y.scale*e.y;return(c!==1||u!==1)&&(n+=`scale(${c}, ${u})`),n||"none"}const DE=["","X","Y","Z"],Bge=1e3;let Uge=0;function OE(t,e,r,n){const{latestValues:a}=e;a[t]&&(r[t]=a[t],e.setStaticValue(t,0),n&&(n[t]=0))}function Vz(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const r=Az(e);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:a,layoutId:i}=t.options;window.MotionCancelOptimisedAnimation(r,"transform",wn,!(a||i))}const{parent:n}=t;n&&!n.hasCheckedOptimisedAppear&&Vz(n)}function Hz({attachResizeListener:t,defaultParent:e,measureScroll:r,checkIsScrollRoot:n,resetTransform:a}){return class{constructor(o={},c=e?.()){this.id=Uge++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(zge),this.nodes.forEach(Gge),this.nodes.forEach(Wge),this.nodes.forEach($ge)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=c?c.root||c:this,this.path=c?[...c.path,c]:[],this.parent=c,this.depth=c?c.depth+1:0;for(let u=0;u<this.path.length;u++)this.path[u].shouldResetTransform=!0;this.root===this&&(this.nodes=new Cge)}addEventListener(o,c){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new uA),this.eventHandlers.get(o).add(c)}notifyListeners(o,...c){const u=this.eventHandlers.get(o);u&&u.notify(...c)}hasListeners(o){return this.eventHandlers.has(o)}mount(o){if(this.instance)return;this.isSVG=sz(o)&&!Mhe(o),this.instance=o;const{layoutId:c,layout:u,visualElement:d}=this.options;if(d&&!d.current&&d.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(u||c)&&(this.isLayoutDirty=!0),t){let f,h=0;const m=()=>this.root.updateBlockedByResize=!1;wn.read(()=>{h=window.innerWidth}),t(o,()=>{const _=window.innerWidth;_!==h&&(h=_,this.root.updateBlockedByResize=!0,f&&f(),f=xge(m,250),b_.hasAnimatedSinceResize&&(b_.hasAnimatedSinceResize=!1,this.nodes.forEach(sL)))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&d&&(c||u)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:h,hasRelativeLayoutChanged:m,layout:_})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const w=this.options.transition||d.getDefaultTransition()||Qge,{onLayoutAnimationStart:b,onLayoutAnimationComplete:E}=d.getProps(),T=!this.targetLayout||!$z(this.targetLayout,_),D=!h&&m;if(this.options.layoutRoot||this.resumeFrom||D||h&&(T||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const P={...SA(w,"layout"),onPlay:b,onComplete:E};(d.shouldReduceMotion||this.options.layoutRoot)&&(P.delay=0,P.type=!1),this.startAnimation(P),this.setAnimationOrigin(f,D)}else h||sL(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=_})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),iu(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Kge),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Vz(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let f=0;f<this.path.length;f++){const h=this.path[f];h.shouldResetTransform=!0,h.updateScroll("snapshot"),h.options.layoutRoot&&h.willUpdate(!1)}const{layoutId:c,layout:u}=this.options;if(c===void 0&&!u)return;const d=this.getTransformTemplate();this.prevTransformTemplateValue=d?d(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(aL);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(iL);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(Hge),this.nodes.forEach(Fge),this.nodes.forEach(qge)):this.nodes.forEach(iL),this.clearAllSnapshots();const c=di.now();wa.delta=Hc(0,1e3/60,c-wa.timestamp),wa.timestamp=c,wa.isProcessing=!0,bE.update.process(wa),bE.preRender.process(wa),bE.render.process(wa),wa.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,TA.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Vge),this.sharedNodes.forEach(Yge)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,wn.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){wn.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Ga(this.snapshot.measuredBox.x)&&!Ga(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let u=0;u<this.path.length;u++)this.path[u].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutCorrected=jn(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:c}=this.options;c&&c.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let c=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(c=!1),c&&this.instance){const u=n(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:u,offset:r(this.instance),wasRoot:this.scroll?this.scroll.isRoot:u}}}resetTransform(){if(!a)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,c=this.projectionDelta&&!zz(this.projectionDelta),u=this.getTransformTemplate(),d=u?u(this.latestValues,""):void 0,f=d!==this.prevTransformTemplateValue;o&&this.instance&&(c||Gu(this.latestValues)||f)&&(a(this.instance,d),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const c=this.measurePageBox();let u=this.removeElementScroll(c);return o&&(u=this.removeTransform(u)),Zge(u),{animationId:this.root.animationId,measuredBox:c,layoutBox:u,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:o}=this.options;if(!o)return jn();const c=o.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(eye))){const{scroll:d}=this.root;d&&(Rf(c.x,d.offset.x),Rf(c.y,d.offset.y))}return c}removeElementScroll(o){const c=jn();if(ts(c,o),this.scroll?.wasRoot)return c;for(let u=0;u<this.path.length;u++){const d=this.path[u],{scroll:f,options:h}=d;d!==this.root&&f&&h.layoutScroll&&(f.wasRoot&&ts(c,o),Rf(c.x,f.offset.x),Rf(c.y,f.offset.y))}return c}applyTransform(o,c=!1){const u=jn();ts(u,o);for(let d=0;d<this.path.length;d++){const f=this.path[d];!c&&f.options.layoutScroll&&f.scroll&&f!==f.root&&Df(u,{x:-f.scroll.offset.x,y:-f.scroll.offset.y}),Gu(f.latestValues)&&Df(u,f.latestValues)}return Gu(this.latestValues)&&Df(u,this.latestValues),u}removeTransform(o){const c=jn();ts(c,o);for(let u=0;u<this.path.length;u++){const d=this.path[u];if(!d.instance||!Gu(d.latestValues))continue;zC(d.latestValues)&&d.updateSnapshot();const f=jn(),h=d.measurePageBox();ts(f,h),Qj(c,d.latestValues,d.snapshot?d.snapshot.layoutBox:void 0,f)}return Gu(this.latestValues)&&Qj(c,this.latestValues),c}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==wa.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){const c=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=c.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=c.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=c.isSharedProjectionDirty);const u=!!this.resumingFrom||this!==c;if(!(o||u&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:f,layoutId:h}=this.options;if(!(!this.layout||!(f||h))){if(this.resolvedRelativeTargetAt=wa.timestamp,!this.targetDelta&&!this.relativeTarget){const m=this.getClosestProjectingParent();m&&m.layout&&this.animationProgress!==1?(this.relativeParent=m,this.forceRelativeParentToResolveTarget(),this.relativeTarget=jn(),this.relativeTargetOrigin=jn(),wm(this.relativeTargetOrigin,this.layout.layoutBox,m.layout.layoutBox),ts(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=jn(),this.targetWithTransforms=jn()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),sge(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):ts(this.target,this.layout.layoutBox),Sz(this.target,this.targetDelta)):ts(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget)){this.attemptToResolveRelativeTarget=!1;const m=this.getClosestProjectingParent();m&&!!m.resumingFrom==!!this.resumingFrom&&!m.options.layoutScroll&&m.target&&this.animationProgress!==1?(this.relativeParent=m,this.forceRelativeParentToResolveTarget(),this.relativeTarget=jn(),this.relativeTargetOrigin=jn(),wm(this.relativeTargetOrigin,this.target,m.target),ts(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(!(!this.parent||zC(this.parent.latestValues)||wz(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){const o=this.getLead(),c=!!this.resumingFrom||this!==o;let u=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(u=!1),c&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(u=!1),this.resolvedRelativeTargetAt===wa.timestamp&&(u=!1),u)return;const{layout:d,layoutId:f}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(d||f))return;ts(this.layoutCorrected,this.layout.layoutBox);const h=this.treeScale.x,m=this.treeScale.y;_me(this.layoutCorrected,this.treeScale,this.path,c),o.layout&&!o.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(o.target=o.layout.layoutBox,o.targetWithTransforms=jn());const{target:_}=o;if(!_){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Yj(this.prevProjectionDelta.x,this.projectionDelta.x),Yj(this.prevProjectionDelta.y,this.projectionDelta.y)),km(this.projectionDelta,this.layoutCorrected,_,this.latestValues),(this.treeScale.x!==h||this.treeScale.y!==m||!nL(this.projectionDelta.x,this.prevProjectionDelta.x)||!nL(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",_))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){if(this.options.visualElement?.scheduleRender(),o){const c=this.getStack();c&&c.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Of(),this.projectionDelta=Of(),this.projectionDeltaWithTransform=Of()}setAnimationOrigin(o,c=!1){const u=this.snapshot,d=u?u.latestValues:{},f={...this.latestValues},h=Of();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!c;const m=jn(),_=u?u.source:void 0,w=this.layout?this.layout.source:void 0,b=_!==w,E=this.getStack(),T=!E||E.members.length<=1,D=!!(b&&!T&&this.options.crossfade===!0&&!this.path.some(Jge));this.animationProgress=0;let P;this.mixTargetDelta=A=>{const C=A/1e3;oL(h.x,o.x,C),oL(h.y,o.y,C),this.setTargetDelta(h),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(wm(m,this.layout.layoutBox,this.relativeParent.layout.layoutBox),Xge(this.relativeTarget,this.relativeTargetOrigin,m,C),P&&Mge(this.relativeTarget,P)&&(this.isProjectionDirty=!1),P||(P=jn()),ts(P,this.relativeTarget)),b&&(this.animationValues=f,Age(f,d,this.latestValues,C,D,T)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=C},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(iu(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=wn.update(()=>{b_.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=pp(0)),this.currentAnimation=Ege(this.motionValue,[0,1e3],{...o,velocity:0,isSync:!0,onUpdate:c=>{this.mixTargetDelta(c),o.onUpdate&&o.onUpdate(c)},onStop:()=>{},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Bge),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:c,target:u,layout:d,latestValues:f}=o;if(!(!c||!u||!d)){if(this!==o&&this.layout&&d&&Gz(this.options.animationType,this.layout.layoutBox,d.layoutBox)){u=this.target||jn();const h=Ga(this.layout.layoutBox.x);u.x.min=o.target.x.min,u.x.max=u.x.min+h;const m=Ga(this.layout.layoutBox.y);u.y.min=o.target.y.min,u.y.max=u.y.min+m}ts(c,u),Df(c,f),km(this.projectionDeltaWithTransform,this.layoutCorrected,c,f)}}registerSharedNode(o,c){this.sharedNodes.has(o)||this.sharedNodes.set(o,new jge),this.sharedNodes.get(o).add(c);const d=c.options.initialPromotionConfig;c.promote({transition:d?d.transition:void 0,preserveFollowOpacity:d&&d.shouldPreserveFollowOpacity?d.shouldPreserveFollowOpacity(c):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){const{layoutId:o}=this.options;return o?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:o}=this.options;return o?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:c,preserveFollowOpacity:u}={}){const d=this.getStack();d&&d.promote(this,u),o&&(this.projectionDelta=void 0,this.needsReset=!0),c&&this.setOptions({transition:c})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let c=!1;const{latestValues:u}=o;if((u.z||u.rotate||u.rotateX||u.rotateY||u.rotateZ||u.skewX||u.skewY)&&(c=!0),!c)return;const d={};u.z&&OE("z",o,d,this.animationValues);for(let f=0;f<DE.length;f++)OE(`rotate${DE[f]}`,o,d,this.animationValues),OE(`skew${DE[f]}`,o,d,this.animationValues);o.render();for(const f in d)o.setStaticValue(f,d[f]),this.animationValues&&(this.animationValues[f]=d[f]);o.scheduleRender()}applyProjectionStyles(o,c){if(!this.instance||this.isSVG)return;if(!this.isVisible){o.visibility="hidden";return}const u=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,o.visibility="",o.opacity="",o.pointerEvents=__(c?.pointerEvents)||"",o.transform=u?u(this.latestValues,""):"none";return}const d=this.getLead();if(!this.projectionDelta||!this.layout||!d.target){this.options.layoutId&&(o.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,o.pointerEvents=__(c?.pointerEvents)||""),this.hasProjected&&!Gu(this.latestValues)&&(o.transform=u?u({},""):"none",this.hasProjected=!1);return}o.visibility="";const f=d.animationValues||d.latestValues;this.applyTransformsToTarget();let h=Lge(this.projectionDeltaWithTransform,this.treeScale,f);u&&(h=u(f,h)),o.transform=h;const{x:m,y:_}=this.projectionDelta;o.transformOrigin=`${m.origin*100}% ${_.origin*100}% 0`,d.animationValues?o.opacity=d===this?f.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:f.opacityExit:o.opacity=d===this?f.opacity!==void 0?f.opacity:"":f.opacityExit!==void 0?f.opacityExit:0;for(const w in Zm){if(f[w]===void 0)continue;const{correct:b,applyTo:E,isCSSVariable:T}=Zm[w],D=h==="none"?f[w]:b(f[w],d);if(E){const P=E.length;for(let A=0;A<P;A++)o[E[A]]=D}else T?this.options.visualElement.renderState.vars[w]=D:o[w]=D}this.options.layoutId&&(o.pointerEvents=d===this?__(c?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>o.currentAnimation?.stop()),this.root.nodes.forEach(aL),this.root.sharedNodes.clear()}}}function Fge(t){t.updateLayout()}function qge(t){const e=t.resumeFrom?.snapshot||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:n}=t.layout,{animationType:a}=t.options,i=e.source!==t.layout.source;a==="size"?ns(f=>{const h=i?e.measuredBox[f]:e.layoutBox[f],m=Ga(h);h.min=r[f].min,h.max=h.min+m}):Gz(a,e.layoutBox,r)&&ns(f=>{const h=i?e.measuredBox[f]:e.layoutBox[f],m=Ga(r[f]);h.max=h.min+m,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[f].max=t.relativeTarget[f].min+m)});const o=Of();km(o,r,e.layoutBox);const c=Of();i?km(c,t.applyTransform(n,!0),e.measuredBox):km(c,r,e.layoutBox);const u=!zz(o);let d=!1;if(!t.resumeFrom){const f=t.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:h,layout:m}=f;if(h&&m){const _=jn();wm(_,e.layoutBox,h.layoutBox);const w=jn();wm(w,r,m.layoutBox),$z(_,w)||(d=!0),f.options.layoutRoot&&(t.relativeTarget=w,t.relativeTargetOrigin=_,t.relativeParent=f)}}}t.notifyListeners("didUpdate",{layout:r,snapshot:e,delta:c,layoutDelta:o,hasLayoutChanged:u,hasRelativeLayoutChanged:d})}else if(t.isLead()){const{onExitComplete:r}=t.options;r&&r()}t.options.transition=void 0}function zge(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function $ge(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function Vge(t){t.clearSnapshot()}function aL(t){t.clearMeasurements()}function iL(t){t.isLayoutDirty=!1}function Hge(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function sL(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function Gge(t){t.resolveTargetDelta()}function Wge(t){t.calcProjection()}function Kge(t){t.resetSkewAndRotation()}function Yge(t){t.removeLeadSnapshot()}function oL(t,e,r){t.translate=En(e.translate,0,r),t.scale=En(e.scale,1,r),t.origin=e.origin,t.originPoint=e.originPoint}function cL(t,e,r,n){t.min=En(e.min,r.min,n),t.max=En(e.max,r.max,n)}function Xge(t,e,r,n){cL(t.x,e.x,r.x,n),cL(t.y,e.y,r.y,n)}function Jge(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const Qge={duration:.45,ease:[.4,0,.1,1]},lL=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),uL=lL("applewebkit/")&&!lL("chrome/")?Math.round:hs;function dL(t){t.min=uL(t.min),t.max=uL(t.max)}function Zge(t){dL(t.x),dL(t.y)}function Gz(t,e,r){return t==="position"||t==="preserve-aspect"&&!ige(rL(e),rL(r),.2)}function eye(t){return t!==t.root&&t.scroll?.wasRoot}const tye=Hz({attachResizeListener:(t,e)=>eg(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),NE={current:void 0},Wz=Hz({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!NE.current){const t=new tye({});t.mount(window),t.setOptions({layoutScroll:!0}),NE.current=t}return NE.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),rye={pan:{Feature:bge},drag:{Feature:_ge,ProjectionNode:Wz,MeasureLayout:Uz}};function fL(t,e,r){const{props:n}=t;t.animationState&&n.whileHover&&t.animationState.setActive("whileHover",r==="Start");const a="onHover"+r,i=n[a];i&&wn.postRender(()=>i(e,Hg(e)))}class nye extends yu{mount(){const{current:e}=this.node;e&&(this.unmount=Rhe(e,(r,n)=>(fL(this.node,n,"Start"),a=>fL(this.node,a,"End"))))}unmount(){}}class aye extends yu{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=zg(eg(this.node.current,"focus",()=>this.onFocus()),eg(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function pL(t,e,r){const{props:n}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&n.whileTap&&t.animationState.setActive("whileTap",r==="Start");const a="onTap"+(r==="End"?"":r),i=n[a];i&&wn.postRender(()=>i(e,Hg(e)))}class iye extends yu{mount(){const{current:e}=this.node;e&&(this.unmount=Ihe(e,(r,n)=>(pL(this.node,n,"Start"),(a,{success:i})=>pL(this.node,a,i?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const KC=new WeakMap,IE=new WeakMap,sye=t=>{const e=KC.get(t.target);e&&e(t)},oye=t=>{t.forEach(sye)};function cye({root:t,...e}){const r=t||document;IE.has(r)||IE.set(r,{});const n=IE.get(r),a=JSON.stringify(e);return n[a]||(n[a]=new IntersectionObserver(oye,{root:t,...e})),n[a]}function lye(t,e,r){const n=cye(e);return KC.set(t,r),n.observe(t),()=>{KC.delete(t),n.unobserve(t)}}const uye={some:0,all:1};class dye extends yu{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:r,margin:n,amount:a="some",once:i}=e,o={root:r?r.current:void 0,rootMargin:n,threshold:typeof a=="number"?a:uye[a]},c=u=>{const{isIntersecting:d}=u;if(this.isInView===d||(this.isInView=d,i&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:f,onViewportLeave:h}=this.node.getProps(),m=d?f:h;m&&m(u)};return lye(this.node.current,o,c)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:r}=this.node;["amount","margin","root"].some(fye(e,r))&&this.startObserver()}unmount(){}}function fye({viewport:t={}},{viewport:e={}}={}){return r=>t[r]!==e[r]}const pye={inView:{Feature:dye},tap:{Feature:iye},focus:{Feature:aye},hover:{Feature:nye}},hye={layout:{ProjectionNode:Wz,MeasureLayout:Uz}},mye={...Zme,...pye,...rye,...hye},Ys=gme(mye,Pme);function gye(){!MA.current&&Tz();const[t]=v.useState(kb.current);return t}const Kz=[1,5,10,25,100];var k_=(t=>(t.FREE="FREE",t.PREMIUM="PREMIUM",t))(k_||{});const zSe={1:[0,0,-Math.PI/2],2:[0,0,Math.PI/2],3:[Math.PI,0,0],4:[0,0,0],5:[Math.PI/2,0,0],6:[-Math.PI/2,0,0]},em=t=>`$${t.toLocaleString(void 0,{maximumFractionDigits:0})}`;function Bc({value:t,onAdd:e,onClear:r,disabled:n,selectedTimes:a=0,style:i,mini:o=!1,className:c,hideValue:u=!1}){const d=a>0,h=["casino-chip",`chip--v${t>=5e3?5e3:t>=1e3?1e3:t>=500?500:t>=100?100:t>=25?25:t>=10?10:t>=5?5:1}`,n?"is-disabled":"",d?"is-selected":"",o?"chip-container--mini":"",c||""].filter(Boolean).join(" "),m=!!e&&!n;return g.jsxs("div",{style:i,className:"chip-container",children:[g.jsxs("button",{type:"button",className:h,onClick:m?()=>{e?.(t)}:void 0,disabled:!m,"aria-label":`Add ${em(Number(t))}`,title:`Add ${em(Number(t))}`,style:m?void 0:{pointerEvents:"none"},children:[!u&&g.jsx("span",{className:"chip__value",children:t>=1e3?`${(Number(t)/1e3).toLocaleString(void 0,{maximumFractionDigits:t>=1e4?0:1})}k`:t}),d&&m&&g.jsxs("span",{className:"chip__count",children:["×",a]})]}),d&&m&&!!r&&g.jsx("button",{type:"button",className:"chip-clear","aria-label":`Clear ${em(Number(t))} chip`,title:`Clear ${em(Number(t))} chip`,onClick:_=>{_.stopPropagation(),r(t)},children:"×"})]})}const yye=[500,100,25,10,5,1],ME=20;function LA(t){const e=[];let r=Math.max(1,Math.floor(t));for(const n of yye){for(;r>=n&&(e.push(n),r-=n,!(e.length>=ME)););if(e.length>=ME)break}return r>0&&e.length<ME&&e.push(r),e.length===0&&e.push(1),e}function vye({show:t,open:e,isBanker:r,meId:n,players:a,labelPrefix:i="Main Bet: "}){const o=v.useMemo(()=>e.filter(m=>m.type==="MAIN"),[e]),[c,u]=v.useState(!1),d=v.useMemo(()=>o?.filter(m=>r?!0:m.playerId===n||m.acceptedById===n),[o,r,n]),f=v.useMemo(()=>d.reduce((m,_)=>m+(_.amount||0),0),[d]),h=m=>a.find(_=>_.id===m)?.name||m;return g.jsxs(g.Fragment,{children:[g.jsx(Ys.div,{className:`betToken ${t?"open":""}`,initial:{opacity:0,scale:.8},animate:{opacity:t?1:0,scale:t?1:.8},transition:{type:"spring",stiffness:320,damping:26},children:g.jsx("a",{role:"button","aria-haspopup":"dialog","aria-expanded":c,onClick:()=>{u(!0)},title:"Show my bets",className:"gold-link",children:g.jsxs("span",{className:"betToken__amount",children:[i,em(f??0)]})})}),c&&g.jsxs("div",{className:"results-modal",role:"dialog","aria-modal":"true","aria-label":"Your bets",children:[g.jsx("div",{className:"results-modal__backdrop",onClick:()=>u(!1)}),g.jsxs("div",{className:"results-modal__card card",children:[g.jsxs("div",{className:"results-modal__header",children:[g.jsx("h3",{style:{margin:0},children:"Your Open Main Bets"}),g.jsx("button",{className:"btn btn--ghost",onClick:()=>u(!1),children:"Close"})]}),d.length===0?g.jsx("ul",{className:"betlist results-list",children:g.jsx("li",{className:"betitem",children:"No applicable bets."})}):g.jsx("ul",{className:"betlist results-list",children:d.map(m=>g.jsx("li",{className:"betitem",children:g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[g.jsxs(g.Fragment,{children:[" ",LA(m.amount).map(_=>g.jsx(Bc,{mini:!0,value:_}))]}),g.jsxs("div",{className:"betitem__info",children:[g.jsxs("div",{className:"betitem__title",children:[h(m.playerId)," ",g.jsx("span",{className:"betSummary__dash",children:"—"})," BET"]}),g.jsxs("div",{className:"betitem__meta",children:["Amount: ",g.jsxs("strong",{children:["$",m.amount]}),m.acceptedById?` • matched by ${h(m.acceptedById)}`:" • (pending)"]})]})]})},m.id))})]})]})]})}function YC({busy:t=!1,label:e="Cancel Bet",disabled:r,...n}){const a=r||t;return g.jsxs("button",{type:"button",className:`cancel-btn ${t?"is-busy":""} ${a?"is-disabled":""}`,disabled:a,"aria-busy":t||void 0,"aria-label":e,"aria-live":"polite",...n,children:[g.jsx("span",{className:"cancel-btn__content",children:"X"}),t&&g.jsx("span",{className:"cancel-btn__spinner","aria-hidden":"true"})]})}function Yz({disabled:t,onClick:e,busy:r=!1,label:n="✓",mini:a=!1}){return g.jsx("button",{disabled:t||r,onClick:e,className:`place-bet-btn ${a?"place-bet-btn--mini":""} ${r?"busy":""}`,"aria-label":"Place Bet",children:r?"Placing...":n})}const _ye={open:{opacity:1,y:0,x:0,transition:{type:"spring",stiffness:500,damping:30}},collapsed:{opacity:0,y:8,x:25,transition:{type:"spring",stiffness:420,damping:28,mass:.6}}};function w0({selectedTimes:t,onAdd:e,onClear:r,onPlaceBet:n,onCancelBet:a,disabled:i,collapsed:o=!1,collapseLabel:c="Placed bet",miniChips:u=!1,betTokenProps:{isBanker:d,meId:f,open:h,players:m,show:_,labelPrefix:w},hasBankRoll:b,betsLocked:E,myOpenMain:T,mainAmt:D,heading:P}){const A=Kz,C=gye(),O=v.useCallback(()=>{cr("Light")},[]),I=v.useRef(!1),x=!!E,R=!!b,N=!i&&!x&&!R&&!d&&!T,L=v.useCallback(()=>{I.current||!N||(I.current=!0,O(),n?.(),setTimeout(()=>{I.current=!1},600))},[N,n,O]),j=v.useCallback(U=>{if(!(i||x)){O();try{}catch{}e?.(U)}},[i,x,e,O]),q=v.useCallback(()=>{i||R||!T||(O(),a?.())},[i,R,T,a,O]);return g.jsxs("div",{className:"chipRackContainer",children:[g.jsxs("div",{className:`chipRack ${i?"chipRack--disabled":""} ${o?"chipRack--collapsed":"chipRack--open"}`,children:[g.jsx("div",{className:"chipRack__collapseTarget","aria-label":c}),g.jsx(Ys.div,{className:"chipRack__scroller",role:"listbox","aria-label":"Bet chips",initial:!1,style:{pointerEvents:i||x||o||T?"none":"auto"},children:A.map(U=>{const W=(t[U]??0)>0;return g.jsx(Ys.div,{role:"option","aria-selected":W,variants:C?void 0:_ye,layout:!0,className:"chipRack__chipWrapper",children:g.jsx(Bc,{value:U,onAdd:j,onClear:r,disabled:!N,selectedTimes:t[U]??0,mini:u,"data-chip":U})},U)})})]}),g.jsxs("div",{className:"chipRack__placeWrap","aria-disabled":!N,style:{pointerEvents:N?"auto":"none"},"data-allowed":N?"true":"false",children:[g.jsx("div",{className:"chipRack__placeInner",children:g.jsx(Yz,{onClick:L,disabled:!N,mini:u})}),N&&g.jsx("div",{className:"chipRack__halo","aria-hidden":"true"})]}),g.jsx(Ys.div,{children:g.jsx(YC,{onClick:q,disabled:i||R||!T})}),g.jsx("div",{className:"chipRack__amount","aria-live":"polite","aria-atomic":"true",children:g.jsx(vye,{isBanker:d,meId:f,open:h,players:m,show:_,labelPrefix:w})})]})}function BA(t={1:0,5:0,10:0,25:0,100:0}){const[e,r]=v.useState(t),n=v.useMemo(()=>Kz.reduce((c,u)=>c+u*(e[u]??0),0),[e]),a=v.useCallback(c=>{r(u=>({...u,[c]:(u[c]??0)+1}))},[]),i=v.useCallback(c=>{r(u=>u[c]?{...u,[c]:0}:u)},[]),o=v.useCallback(()=>{r({1:0,5:0,10:0,25:0,100:0})},[]);return{rack:e,totalAmount:n,addChip:a,clearChip:i,clearAllChips:o}}const bye=""+new URL("roll-btn-web-wZ6ex-aH.webp",import.meta.url).href;function Xz({disabled:t,busy:e=!1,onClick:r,onPressStart:n,label:a="ROLL",className:i,"aria-label":o,useImage:c=!0,"data-testid":u}){const d=t||e,f=v.useRef(!1),h=v.useRef(null),m=v.useCallback(()=>{h.current&&(window.clearInterval(h.current),h.current=null)},[]),_=v.useCallback(()=>{d||f.current||(f.current=!0,Xr(),n?.(),m(),h.current=window.setInterval(()=>{n?.()},500))},[d,n,m]),w=v.useCallback(async()=>{if(m(),!!f.current){f.current=!1;try{const E=window;E.__rtcDiag||(E.__rtcDiag=[]),E.__rtcDiag.push({t:Date.now(),label:"ui:rollButtonClick"}),E.__dumpRtcDiag&&E.__dumpRtcDiag("ui:rollButtonClick")}catch{}r();try{window.dispatchEvent(new CustomEvent("ui:roll"))}catch{}await ld("Heavy")}},[r,m]),b=v.useCallback(async E=>{if(f.current){E.preventDefault();return}if(!d){n?.();try{const T=window;T.__rtcDiag||(T.__rtcDiag=[]),T.__rtcDiag.push({t:Date.now(),label:"ui:rollButtonClick"}),T.__dumpRtcDiag&&T.__dumpRtcDiag("ui:rollButtonClick")}catch{}r();try{window.dispatchEvent(new CustomEvent("ui:roll"))}catch{}await ld("Heavy")}},[d,r,n]);return g.jsx("div",{className:["roll-wrapper",i].filter(Boolean).join(" "),children:g.jsxs("button",{type:"button",className:["roll",c?"roll--image":"",d?"is-disabled":""].join(" "),onClick:b,onPointerDown:_,onPointerUp:w,disabled:d,"aria-label":o??(e?"Rolling dice":"Roll dice"),"aria-busy":e||void 0,"data-testid":u,children:[c&&g.jsx("img",{src:bye,alt:"",className:"roll__img",draggable:!1}),e&&g.jsx("span",{className:"roll__spinner","aria-hidden":"true"}),g.jsx("span",{className:"roll__halo","aria-hidden":"true"}),!c&&g.jsx("span",{className:"roll__gloss","aria-hidden":"true"}),!c&&g.jsx("span",{className:"roll__label","aria-live":"polite",children:e?"ROLLING…":a})]})})}function kye({roomId:t,meId:e,bankerId:r,players:n,className:a,hasBankRoll:i,gameState:o,gameplay:c}){const d=o?.gameMode==="cee-lo",{rack:f,totalAmount:h,addChip:m,clearChip:_}=BA(d?{1:0,5:0,10:0,25:1,100:0}:{1:0,5:0,10:1,25:0,100:0}),[w,b]=v.useState(!1),[E,T]=v.useState(!1),D=cu(),A=(o?.banker??r)===e,{open:C,settled:O,myOpenMain:I,placeMainBet:x,cancelMainBet:R}=v0(t,e),[N,L]=v.useState(!1);v.useEffect(()=>{I&&N&&L(!1)},[I,N]),v.useEffect(()=>{if(!N||I)return;const ce=setTimeout(()=>L(!1),5e3);return()=>clearTimeout(ce)},[N,I]);const j=!A&&!I&&!N,q=c?.handleRoll??(()=>{}),U=!!c?.canRoll;c?.lastRollerId;const W=c?.diceSettled??!0,F=o?.betsLocked??!1;o?.roundSeq;const Y=!!o?.bankRoll,Q=Y,[ie,G]=v.useState(!1),B=v.useRef(F),K=v.useRef(null);v.useEffect(()=>(B.current&&!F&&(G(!0),K.current&&window.clearTimeout(K.current),K.current=window.setTimeout(()=>{G(!1),K.current=null},3e3)),F&&K.current&&(window.clearTimeout(K.current),K.current=null,G(!1)),B.current=F,()=>{K.current&&window.clearTimeout(K.current)}),[F]);const ae=v.useCallback(async()=>{try{Xr()}catch{}if(w)return;const ce=Math.floor(h);if(ce<=0){D.info("Tap chips to add a bet amount.");return}if(!Y){if(F||Q){D.info("Bets are closed.");return}if(o?.spectators?.includes(e)){D.info("Exit spectate to place a bet.");return}try{b(!0);const xe=await x(ce);if(!xe?.ok){D.error(xe?.error||"Bet rejected");return}L(!0)}catch{}finally{b(!1)}}},[w,h,i,F,Q,o,x]),te=v.useCallback(async()=>{try{Xr()}catch{}if(I)try{const ce=await R(I.id);ce.ok||D.error(ce.error||"Failed to cancel bet")}catch(ce){D.error(ce?.message??"Failed to cancel bet")}},[R,I,D]),ue=(o?.spectators??[]).includes(e),Ae=w||ue||Q||F||N,{triggerSpin:He}=Jo();return g.jsxs("div",{className:["betpanel",a].filter(Boolean).join(" "),children:[g.jsxs("section",{className:"betpanel__section",children:[g.jsx("div",{className:"betpanel__row",children:g.jsx(Xz,{disabled:!U||ue,busy:!W,onClick:q,onPressStart:He,"data-testid":"roll-button"})}),!A&&g.jsx("div",{className:"betpanel__row",children:g.jsx(w0,{mainAmt:h,selectedTimes:f,onAdd:m,onClear:_,onPlaceBet:ae,onCancelBet:te,disabled:Ae,collapsed:!j,betTokenProps:{isBanker:A,meId:e,open:C,players:n,show:!j},hasBankRoll:Y,betsLocked:F||ie,myOpenMain:I})})]}),E&&g.jsx(g4,{meId:e,items:O,onClose:()=>T(!1)})]})}function wye(t){if(!t||t.gameMode!=="craps")return{phase:"come-out",point:null,label:"Come Out"};const e=t.crapsPhase,r=t.crapsPoint??null;let n;e==="point"?n="point":e==="come-out"?n="come-out":e==="comeOut"?n=r!=null?"point":"come-out":r!=null?n="point":n="come-out";const a=n==="point"&&r!=null?`Point: ${r}`:"Come Out";return{phase:n,point:r,label:a}}function Sye(t){const r=t.split("@")[0].trim().split(/[\s._-]+/).filter(Boolean),n=(r[0]?.[0]??"").toUpperCase(),a=(r[1]?.[0]??"").toUpperCase();return n+a||n||"?"}function Jz(t){if(!t||t.length!==3)return"nothing";const e=new Set(t);if(e.size===1)return"triple";const r=[...t].sort().join("");return r==="123"?"123":r==="456"?"456":e.size===2?"point":"nothing"}function Sm(t,e){return Jz(t)}function jE(t,e,r,n,a){if(!t)return null;if(t===r)return a||null;for(let i=e.length-1;i>=0;i--){const o=e[i];if(o.playerId===t&&Array.isArray(o.result)&&o.result.length===3)return o.result}return null}function wb(t){if(!t||t.length!==3)return{score:0,label:"—",kind:"invalid"};const e=Jz(t);if(e==="456")return{score:1e4,label:"4-5-6 (Auto Win)",kind:e};if(e==="123")return{score:2e3,label:"1-2-3 (Auto Lose)",kind:e};if(e==="triple"){const r=t[0];return{score:8e3+r*100,label:`Triple ${r}s`,kind:e}}if(e==="point"){const r={};for(const a of t)r[a]=(r[a]||0)+1;let n;for(const[a,i]of Object.entries(r))if(i===1){n=Number(a);break}return n==null?{score:0,label:t.slice().sort().join("-"),kind:"nothing"}:{score:4e3+n*100,label:`Point ${n}`,kind:e,point:n}}return e==="nothing"?{score:0,label:t.slice().sort().join("-"),kind:e}:{score:0,label:t.slice().sort().join("-"),kind:e}}function Eye({gameMode:t="cee-lo",gameState:e,className:r}){let n=null;if(t==="craps")n=wye(e).label;else{const i=e?.bankRoll,o=Array.isArray(i?.raw)?i.raw:Array.isArray(i)?i:null;o&&o.length===3&&(n=`Bank Roll — ${wb(o).label}`)}const a=!n;return g.jsx("div",{className:["table-meta",a?"table-meta--hidden":"",r].filter(Boolean).join(" "),"aria-live":a?void 0:"polite","aria-hidden":a||void 0,children:g.jsx("div",{className:"table-meta__content",children:n||" "})})}const Tye="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let LE=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+=Tye[r[t]&63];return e};const Cye="_panelRoot_1qeyt_1",xye="_crapsPlaceTile_1qeyt_80",Pye="_mobileShow_1qeyt_101",Aye="_mobileHide_1qeyt_105",Rye="_spotBtn_1qeyt_132",Dye="_spotRow_1qeyt_145",Oye="_chip_1qeyt_152",Nye="_actions_1qeyt_157",Iye="_actionBtn_1qeyt_161",Mye="_amountBadge_1qeyt_167",jye="_badgeMinus_1qeyt_174",Lye="_crapsStatusBar_1qeyt_185",Bye="_crapsStatusText_1qeyt_191",Uye="_crapsHighlight_1qeyt_199",Fye="_crapsChipSelector_1qeyt_204",qye="_crapsChip_1qeyt_204",zye="_crapsPlaceRow_1qeyt_216",$ye="_crapsBetTile_1qeyt_227",Vye="_crapsActionsBar_1qeyt_235",Hye="_crapsActionButton_1qeyt_239",Gye="_crapsActionButtonPrimary_1qeyt_244",Wye="_crapsActionButtonSecondary_1qeyt_245",Kye="_crapsMainBets_1qeyt_251",Yye="_disabled_1qeyt_321",Xye="_spotBtnTopRow_1qeyt_507",Jye="_lineWin_1qeyt_558",Qye="_lineLose_1qeyt_563",Zye="_linePush_1qeyt_568",eve="_outcomeBadge_1qeyt_573",tve="_locked_1qeyt_587",rve="_amountBadgeDisabled_1qeyt_615",nve="_lockIcon_1qeyt_621",ave="_aggBadge_1qeyt_661",ive="_chipsRow_1qeyt_692",sve="_chipSelected_1qeyt_747",ove="_rollBtn_1qeyt_877",cve="_rollIcon_1qeyt_884",lve="_clear_1qeyt_910",uve="_errorLive_1qeyt_927",dve="_tooltip_1qeyt_935",fve="_betInfoBtn_1qeyt_959",pve="_betInfoModalOverlay_1qeyt_987",hve="_betInfoModal_1qeyt_987",mve="_betInfoHeader_1qeyt_1021",gve="_betInfoClose_1qeyt_1037",yve="_betInfoContent_1qeyt_1058",vve="_betInfoItem_1qeyt_1066",_ve="_shake_1qeyt_1159",bve="_attnHalo_1qeyt_1207",kve="_crapsAtsDivider_1qeyt_1346",wve="_crapsAtsLabel_1qeyt_1352",Sve="_crapsIronCrossBtn_1qeyt_1372",Eve="_crapsMinusBadge_1qeyt_1466",Tve="_crapsChipSelected_1qeyt_1600",Cve="_crapsClearIcon_1qeyt_1708",xve="_particle_1qeyt_1742",Pve="_particleContainer_1qeyt_1748",Ave="_floatingWinAmount_1qeyt_1798",Rve="_rollHaloActive_1qeyt_1858",ft={panelRoot:Cye,crapsPlaceTile:xye,mobileShow:Pye,mobileHide:Aye,spotBtn:Rye,spotRow:Dye,chip:Oye,actions:Nye,actionBtn:Iye,amountBadge:Mye,badgeMinus:jye,crapsStatusBar:Lye,crapsStatusText:Bye,crapsHighlight:Uye,crapsChipSelector:Fye,crapsChip:qye,crapsPlaceRow:zye,crapsBetTile:$ye,crapsActionsBar:Vye,crapsActionButton:Hye,crapsActionButtonPrimary:Gye,crapsActionButtonSecondary:Wye,crapsMainBets:Kye,disabled:Yye,spotBtnTopRow:Xye,lineWin:Jye,lineLose:Qye,linePush:Zye,outcomeBadge:eve,locked:tve,amountBadgeDisabled:rve,lockIcon:nve,aggBadge:ave,chipsRow:ive,chipSelected:sve,rollBtn:ove,rollIcon:cve,clear:lve,errorLive:uve,tooltip:dve,betInfoBtn:fve,betInfoModalOverlay:pve,betInfoModal:hve,betInfoHeader:mve,betInfoClose:gve,betInfoContent:yve,betInfoItem:vve,shake:_ve,attnHalo:bve,crapsAtsDivider:kve,crapsAtsLabel:wve,crapsIronCrossBtn:Sve,crapsMinusBadge:Eve,crapsChipSelected:Tve,crapsClearIcon:Cve,particle:xve,particleContainer:Pve,floatingWinAmount:Ave,rollHaloActive:Rve};/*!
 * Font Awesome Free 7.0.1 by @fontawesome - https://fontawesome.com
 * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
 * Copyright 2025 Fonticons, Inc.
 */var Dve={prefix:"fas",iconName:"dice-six",icon:[448,512,[9861],"f526","M0 96C0 60.7 28.7 32 64 32l320 0c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96zm160 64a32 32 0 1 0 -64 0 32 32 0 1 0 64 0zM128 288a32 32 0 1 0 0-64 32 32 0 1 0 0 64zm32 64a32 32 0 1 0 -64 0 32 32 0 1 0 64 0zM320 192a32 32 0 1 0 0-64 32 32 0 1 0 0 64zm32 64a32 32 0 1 0 -64 0 32 32 0 1 0 64 0zM320 384a32 32 0 1 0 0-64 32 32 0 1 0 0 64z"]},Ove={prefix:"fas",iconName:"circle-question",icon:[512,512,[62108,"question-circle"],"f059","M256 512a256 256 0 1 0 0-512 256 256 0 1 0 0 512zm0-336c-17.7 0-32 14.3-32 32 0 13.3-10.7 24-24 24s-24-10.7-24-24c0-44.2 35.8-80 80-80s80 35.8 80 80c0 47.2-36 67.2-56 74.5l0 3.8c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-8.1c0-20.5 14.8-35.2 30.1-40.2 6.4-2.1 13.2-5.5 18.2-10.3 4.3-4.2 7.7-10 7.7-19.6 0-17.7-14.3-32-32-32zM224 368a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z"]};const Nve={pass:{title:"Pass Line",description:"Come-out wins 7/11, loses 2/3/12; point wins if repeated before 7. Pays 1:1."},dontPass:{title:"Don't Pass",description:"Come-out wins 2/3, loses 7/11, 12 pushes; after point, win if 7 before point. Pays 1:1."},come:{title:"Come Bet",description:"Like Pass but placed after point; next roll can establish its own point. Pays 1:1."},dontCome:{title:"Don't Come",description:"Mirror of Come but against shooter; 2/3 win, 7/11 lose, 12 push on first resolving roll. Pays 1:1."},oddsPass:{title:"Odds (Pass)",description:"True odds – 4/10 2:1, 5/9 3:2, 6/8 6:5. Pays on point hit (no house edge)."},oddsDontPass:{title:"Odds (Don't Pass)",description:"True odds inverse – 4/10 1:2, 5/9 2:3, 6/8 5:6. Pays if 7 before point."},place4:{title:"Place 4",description:"Active in point phase. Pays 9:5 if 4 rolls before 7 (principal stays)."},place5:{title:"Place 5",description:"Pays 7:5 if 5 rolls before 7."},place6:{title:"Place 6",description:"Pays 7:6 if 6 rolls before 7."},place8:{title:"Place 8",description:"Pays 7:6 if 8 rolls before 7."},place9:{title:"Place 9",description:"Pays 7:5 if 9 rolls before 7."},place10:{title:"Place 10",description:"Pays 9:5 if 10 rolls before 7."},field:{title:"Field",description:"One-roll bet: Wins 2,3,4,9,10,11,12 (12 often double). Loses 5,6,7,8."},big6:{title:"Big 6",description:"Even money if 6 rolls before 7 (same goal as place/line odds but lower value)."},big8:{title:"Big 8",description:"Even money if 8 rolls before 7."},atsSmall:{title:"ATS Small",description:"Wins when all of 2,3,4,5,6 are rolled before a 7. Pays 30:1."},atsTall:{title:"ATS Tall",description:"Wins when all of 8,9,10,11,12 are rolled before a 7. Pays 30:1."},atsAll:{title:"ATS All",description:"Wins when all numbers (2-6 and 8-12) are rolled before a 7. Pays 150:1."}};function Ive({open:t,onClose:e}){const r=v.useRef(null);if(v.useEffect(()=>{if(!t)return;const a=o=>{o.key==="Escape"&&e()},i=o=>{r.current&&!r.current.contains(o.target)&&e()};return document.addEventListener("keydown",a),document.addEventListener("mousedown",i),()=>{document.removeEventListener("keydown",a),document.removeEventListener("mousedown",i)}},[t,e]),!t)return null;const n=g.jsx("div",{className:ft.betInfoModalOverlay,role:"presentation",children:g.jsxs("div",{className:ft.betInfoModal,role:"dialog","aria-modal":"true","aria-label":"Craps Bet Guide",ref:r,children:[g.jsxs("div",{className:ft.betInfoHeader,children:[g.jsx("h3",{children:"Craps Bet Guide"}),g.jsx("button",{className:ft.betInfoClose,onClick:e,"aria-label":"Close",children:"✕"})]}),g.jsx("div",{className:ft.betInfoContent,children:Object.entries(Nve).map(([a,{title:i,description:o}])=>g.jsxs("div",{className:ft.betInfoItem,children:[g.jsx("strong",{children:i}),g.jsx("p",{children:o})]},a))})]})});return Wc.createPortal(n,document.body)}const Mve="_atsProgressContainer_bok0p_3",jve="_inline_bok0p_15",Lve="_atsSection_bok0p_25",Bve="_complete_bok0p_42",Uve="_justCompleted_bok0p_47",Fve="_atsSectionAll_bok0p_66",qve="_atsSectionHeader_bok0p_75",zve="_atsSectionLabel_bok0p_84",$ve="_atsSectionCount_bok0p_97",Vve="_atsNumberRow_bok0p_107",Hve="_atsNumber_bok0p_107",Gve="_hit_bok0p_138",Wve="_atsCompleteText_bok0p_160",Kve="_atsLockedBadge_bok0p_181",Yr={atsProgressContainer:Mve,inline:jve,atsSection:Lve,complete:Bve,justCompleted:Uve,atsSectionAll:Fve,atsSectionHeader:qve,atsSectionLabel:zve,atsSectionCount:$ve,atsNumberRow:Vve,atsNumber:Hve,hit:Gve,atsCompleteText:Wve,atsLockedBadge:Kve},Yve=[2,3,4,5,6],Xve=[8,9,10,11,12];function Jve({hitNumbers:t,smallProgress:e,tallProgress:r,allProgress:n,betsLocked:a,lastCompletedCategory:i,inline:o=!1}){const c=h=>t.includes(h),u=e===5,d=r===5,f=n===10;return g.jsxs("div",{className:`${Yr.atsProgressContainer} ${o?Yr.inline:""}`,children:[g.jsxs("div",{className:`${Yr.atsSection} ${u?Yr.complete:""} ${i==="small"?Yr.justCompleted:""}`,children:[g.jsxs("div",{className:Yr.atsSectionHeader,children:[g.jsx("span",{className:Yr.atsSectionLabel,children:"SMALL"}),g.jsxs("span",{className:Yr.atsSectionCount,children:[e,"/5"]})]}),g.jsx("div",{className:Yr.atsNumberRow,children:Yve.map(h=>g.jsx("div",{className:`${Yr.atsNumber} ${c(h)?Yr.hit:""}`,"aria-label":`${h} ${c(h)?"hit":"not hit"}`,children:h},h))})]}),g.jsxs("div",{className:`${Yr.atsSection} ${Yr.atsSectionAll} ${f?Yr.complete:""} ${i==="all"?Yr.justCompleted:""}`,children:[g.jsxs("div",{className:Yr.atsSectionHeader,children:[g.jsx("span",{className:Yr.atsSectionLabel,children:"ALL"}),g.jsxs("span",{className:Yr.atsSectionCount,children:[n,"/10"]})]}),f&&g.jsx("div",{className:Yr.atsCompleteText,children:"🎉"}),a&&!f&&g.jsx("div",{className:Yr.atsLockedBadge,children:"LOCKED"})]}),g.jsxs("div",{className:`${Yr.atsSection} ${d?Yr.complete:""} ${i==="tall"?Yr.justCompleted:""}`,children:[g.jsxs("div",{className:Yr.atsSectionHeader,children:[g.jsx("span",{className:Yr.atsSectionLabel,children:"TALL"}),g.jsxs("span",{className:Yr.atsSectionCount,children:[r,"/5"]})]}),g.jsx("div",{className:Yr.atsNumberRow,children:Xve.map(h=>g.jsx("div",{className:`${Yr.atsNumber} ${c(h)?Yr.hit:""}`,"aria-label":`${h} ${c(h)?"hit":"not hit"}`,children:h},h))})]})]})}const Po={PROGRESS:"craps:ats_progress",SMALL_COMPLETE:"craps:ats_small_complete",TALL_COMPLETE:"craps:ats_tall_complete",ALL_COMPLETE:"craps:ats_all_complete",RESET:"craps:ats_reset"},BE={hitNumbers:[],smallProgress:0,tallProgress:0,allProgress:0,betsLocked:!1};function Qve(t){const e=ks(),[r,n]=v.useState(BE),[a,i]=v.useState(null);v.useEffect(()=>{if(!a)return;const c=setTimeout(()=>i(null),3e3);return()=>clearTimeout(c)},[a]),v.useEffect(()=>{if(!e||!t)return;const c=m=>{m.roomId===t&&n({hitNumbers:m.hitNumbers,smallProgress:m.smallProgress,tallProgress:m.tallProgress,allProgress:m.allProgress,betsLocked:m.betsLocked})},u=m=>{m.roomId===t&&i("small")},d=m=>{m.roomId===t&&i("tall")},f=m=>{m.roomId===t&&i("all")},h=m=>{m.roomId===t&&(n(BE),i(null))};return e.on(Po.PROGRESS,c),e.on(Po.SMALL_COMPLETE,u),e.on(Po.TALL_COMPLETE,d),e.on(Po.ALL_COMPLETE,f),e.on(Po.RESET,h),()=>{e.off(Po.PROGRESS,c),e.off(Po.SMALL_COMPLETE,u),e.off(Po.TALL_COMPLETE,d),e.off(Po.ALL_COMPLETE,f),e.off(Po.RESET,h)}},[e,t]);const o=v.useCallback(c=>r.hitNumbers.includes(c),[r.hitNumbers]);return{atsProgress:r,lastCompletedCategory:a,isNumberHit:o,reset:()=>n(BE)}}function Sa(t){return`z${t}`}function os(t,e){return t.filter(r=>r.type===e).reduce((r,n)=>r+n.amount,0)}function Zve(t,e){return t*e}function hL(t,e,r){const{phase:n,point:a,balance:i,pendingBets:o,minBet:c,maxBet:u,oddsMultiple:d,committedAddBack:f=0}=r,h=o.reduce((A,C)=>A+C.amount,0),m=os(o,t),_=h+e,w=i+f;if(_>w)return{ok:!1,reason:"Insufficient balance"};const b=t==="pass"||t==="dontPass",E=t==="come"||t==="dontCome",T=t==="oddsPass"||t==="oddsDontPass",D=t.startsWith("place");if(b){if(n!=="comeOut"&&a)return{ok:!1,reason:"Line bets locked after point"};if(m===0&&e<c)return{ok:!1,reason:`Minimum ${Sa(c)}`}}if(E){if(!a)return{ok:!1,reason:"Come bets only after point"};if(m===0&&e<c)return{ok:!1,reason:`Minimum ${Sa(c)}`};if(m+e>u)return{ok:!1,reason:`Max ${Sa(u)}`}}if(T){if(!a)return{ok:!1,reason:"Point required for odds"};const C=os(o,t==="oddsPass"?"pass":"dontPass");if(!C)return{ok:!1,reason:"Need line bet first"};const O=Zve(C,t==="oddsPass"?d.pass:d.dontPass);if(m+e>O)return{ok:!1,reason:`Max odds ${Sa(O)}`}}if(D){if(!a)return{ok:!1,reason:"Place bets only in point phase"};if(m===0&&e<c)return{ok:!1,reason:`Minimum ${Sa(c)}`};if(m+e>u)return{ok:!1,reason:`Max ${Sa(u)}`}}if(t==="field"||t==="big6"||t==="big8"){if(m===0&&e<c)return{ok:!1,reason:`Minimum ${Sa(c)}`};if(m+e>u)return{ok:!1,reason:`Max ${Sa(u)}`}}if(t==="atsSmall"||t==="atsTall"||t==="atsAll"){if(m===0&&e<c)return{ok:!1,reason:`Minimum ${Sa(c)}`};if(m+e>u)return{ok:!1,reason:`Max ${Sa(u)}`}}return{ok:!0}}const e_e=[{key:"pass",label:"Pass"},{key:"dontPass",label:"Don't Pass"},{key:"come",label:"Come"},{key:"dontCome",label:"Don't Come"},{key:"field",label:"Field"},{key:"big6",label:"Big 6"},{key:"big8",label:"Big 8"}],t_e=[{key:"atsSmall",label:"Small"},{key:"atsTall",label:"Tall"},{key:"atsAll",label:"All"}],r_e=[{key:"place4",label:"Place 4"},{key:"place5",label:"5"},{key:"place6",label:"6"},{key:"place8",label:"8"},{key:"place9",label:"9"},{key:"place10",label:"10"}];function n_e(t,e){const[r,n]=v.useState(25);return v.useEffect(()=>{if(t.length&&!t.includes(r)){const a=t[0];n(a);return}},[t,r]),{selectedChip:r,setSelectedChip:n}}function a_e(t){const{pendingBets:e,myPlayerPlaceTotal:r,myCommittedByType:n}=t;return v.useMemo(()=>typeof r=="number"&&r>0||["place4","place5","place6","place8","place9","place10"].some(i=>Number(n[i]||0)>0)?!0:e.some(i=>i.type.startsWith("place")&&i.amount>0),[r,e,n])}function i_e(t,e,r){const n=v.useRef(null);v.useEffect(()=>{e!==n.current&&(n.current=null)},[e]),v.useEffect(()=>{if(!t||!e||n.current===e)return;const a=r.current||document.querySelector(`.${ft.crapsPlaceRow}`),i=a?a.querySelector(`.${ft.crapsIronCrossBtn}`):document.querySelector(`.${ft.crapsIronCrossBtn}`);if(!i)return;const o=window.setTimeout(()=>{try{i.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}catch{}},50);return n.current=e,()=>window.clearTimeout(o)},[t,e,r])}function s_e(t,e){const r=v.useRef(null);v.useEffect(()=>{if(!t){r.current=null;return}if(r.current===t)return;const n=e.current||document.querySelector(`.${ft.crapsPlaceRow}`),a=n?n.querySelector(`.${ft.crapsAtsLabel}`):document.querySelector(`.${ft.crapsAtsLabel}`);if(!a)return;const i=window.setTimeout(()=>{try{a.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}catch{}},100);return r.current=t,()=>window.clearTimeout(i)},[t,e])}function o_e(t,e,r){const n=v.useRef(null);v.useEffect(()=>{if(!t||n.current===t)return;n.current=t;const a=window.setTimeout(()=>{const i=e.current||document.querySelector(`.${ft.crapsMainBets}`),o=r.current||document.querySelector(`.${ft.crapsPlaceRow}`),c=(u,d)=>{if(!u)return;const f=u.scrollWidth,h=u.clientWidth;f<=h||window.setTimeout(()=>{u.scrollTo({left:f,behavior:"smooth"}),window.setTimeout(()=>{u.scrollTo({left:0,behavior:"smooth"})},600)},d)};c(i,0),c(o,150)},500);return()=>window.clearTimeout(a)},[t,e,r])}function c_e(t){const{phase:e,point:r,balance:n,pendingBets:a,minBet:i,maxBet:o,oddsMultiple:c,myPlayerLineTotals:u,myPlayerPlaceTotal:d}=t;return v.useMemo(()=>{const f=(u?.pass??0)+(u?.dontPass??0)+(d??0),h=os(a,"pass")+os(a,"dontPass")+os(a,"place4")+os(a,"place5")+os(a,"place6")+os(a,"place8")+os(a,"place9")+os(a,"place10"),m=Math.max(0,h-f);return{phase:e,point:r,balance:n,pendingBets:a,minBet:i,maxBet:o,oddsMultiple:c,committedAddBack:f+m}},[e,r,n,a,i,o,c,u?.pass,u?.dontPass,d])}function l_e(t,e){return v.useCallback(r=>{const n=t.find(i=>i.type===r),a=Number(e[r]||0);return n?n.amount===a?a:Math.max(0,n.amount):Math.max(0,a)},[t,e])}function u_e(t,e,r){const n=v.useRef(new Map),a=5e3;v.useEffect(()=>{if(!t.length){n.current.clear();return}const i=Date.now();for(const u of t){const d=`${u.type}:${u.amount}`;n.current.has(d)||n.current.set(d,i)}const o=new Set(t.map(u=>`${u.type}:${u.amount}`));for(const u of n.current.keys())o.has(u)||n.current.delete(u);const c=t.filter(u=>{const d=Number(e[u.type]||0);if(u.amount===0&&d>0)return!0;if(u.amount===d)return!1;const f=`${u.type}:${u.amount}`,h=n.current.get(f)||i;return!(i-h>a)});c.length!==t.length&&r(c)},[t,e,r])}function d_e(t){const{recentSettlements:e,meId:r,myPlayerLineTotals:n}=t,a=v.useMemo(()=>{if(!e.length||!r)return{};const d=e.filter(h=>(h.betType==="pass"||h.betType==="dontPass")&&h.playerId===r),f={};for(const h of d)(h.betType==="pass"?(n?.pass??0)>0:(n?.dontPass??0)>0)&&(f[h.betType]=h.outcome);return f},[e,r,n?.pass,n?.dontPass]),i=v.useMemo(()=>{if(!e.length||!r)return{};const d=e.filter(h=>h.betType.startsWith("place")&&h.playerId===r),f={};for(const h of d)f[h.betType]=h.outcome;return f},[e,r]),o=v.useMemo(()=>{if(!e.length||!r)return{};const d=e.filter(h=>h.betType==="field"&&h.playerId===r),f={};for(const h of d)f[h.betType]=h.outcome;return f},[e,r]),c=v.useMemo(()=>{if(!e.length||!r)return{};const d=e.filter(h=>(h.betType==="big6"||h.betType==="big8")&&h.playerId===r),f={};for(const h of d)f[h.betType]=h.outcome;return f},[e,r]),u=v.useMemo(()=>{if(!e.length||!r)return{};const d=e.filter(h=>(h.betType==="come"||h.betType==="dontCome")&&h.playerId===r),f={};for(const h of d)f[h.betType]=h.outcome;return f},[e,r]);return{lineOutcomeMap:a,placeOutcomeMap:i,fieldOutcomeMap:o,bigOutcomeMap:c,comeOutcomeMap:u}}function f_e(t,e){v.useEffect(()=>{const r=document.querySelectorAll(t),n=[];return r.forEach(a=>{if(a.querySelector(`.${ft.particleContainer}`))return;const i=document.createElement("div");i.className=ft.particleContainer,a.appendChild(i);const o=()=>{const u=document.createElement("div");u.className=ft.particle;const d=Math.random()*100,f=(Math.random()-.5)*40,h=-(80+Math.random()*60),m=1.8+Math.random()*1,_=Math.random()*.3;u.style.setProperty("--start-x",`${d}%`),u.style.setProperty("--drift-x",`${f}px`),u.style.setProperty("--rise-y",`${h}px`),u.style.setProperty("--duration",`${m}s`),u.style.setProperty("--delay",`${_}s`),u.style.left="0",u.style.bottom="0",i.appendChild(u),window.setTimeout(()=>u.remove(),(m+_)*1e3)},c=window.setInterval(o,400+Math.random()*300);n.push(c),o(),window.setTimeout(o,150),window.setTimeout(o,300)}),()=>{n.forEach(a=>window.clearInterval(a)),r.forEach(a=>a.querySelector(`.${ft.particleContainer}`)?.remove())}},[t,e])}function p_e(t){const{recentSettlements:e,meId:r,winSelector:n,floatingClass:a}=t,i=v.useRef(new Set),o=v.useRef(0);v.useEffect(()=>{if(e.length===0&&o.current>0&&i.current.clear(),o.current=e.length,!e.length||!r)return;const u=e.map((f,h)=>({s:f,idx:h})).filter(({s:f})=>f.playerId===r&&f.outcome==="WIN"&&f.payout>0).filter(({s:f,idx:h})=>{const m=`${f.betType}|${f.amount}|${f.payout}|${h}`;return i.current.has(m)?!1:(i.current.add(m),!0)});if(!u.length)return;const d=window.setTimeout(()=>{const f={};u.forEach(({s:m})=>{f[m.betType]=m.payout}),document.querySelectorAll(n).forEach(m=>{const _=m.getAttribute("data-bet-type");if(!_)return;const w=f[_];if(!w)return;try{m.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})}catch{}const b=()=>{const E=m.getBoundingClientRect(),T=document.createElement("div");T.className=a,T.textContent=`+${Sa(w)}`,T.style.left=`${E.left+E.width/2}px`,T.style.top=`${E.top}px`,document.body.appendChild(T),window.setTimeout(()=>T.remove(),2500)};_.startsWith("place")?window.setTimeout(b,500):b()})},50);return()=>window.clearTimeout(d)},[e,r,n,a])}function h_e(t){const{roomId:e,balance:r,phase:n,point:a,shooterName:i,minBet:o,maxBet:c,oddsMultiple:u,chips:d,pendingBets:f,onChangeBets:h,onClearAll:m,disabled:_,onRoll:w,canRoll:b,myPlayerPlaceTotal:E,readyPlayers:T=[],meId:D,onBetDelta:P,onBetsBatch:A,showReadyButton:C,onReadyClick:O,readyStateLabel:I,readyButtonDisabled:x,recentSettlements:R=[],myPlayerLineTotals:N,othersTotals:L,myCommittedByType:j={}}=t,q=_,{selectedChip:U,setSelectedChip:W}=n_e(d),{atsProgress:F,lastCompletedCategory:Y}=Qve(e??null),[Q,ie]=v.useState(!1),[G,B]=v.useState(),[K,ae]=v.useState(),{info:te}=uP(),{triggerSpin:me}=Jo(),ue=v.useRef(!1),Ae=v.useRef(null),He=n==="comeOut"&&!a,ce=n==="point"&&!!a,xe=!1,re=v.useRef(null),H=v.useRef(null),he=a_e({pendingBets:f,myPlayerPlaceTotal:E,myCommittedByType:j}),Re=n==="point"&&!!a&&!he;i_e(Re,a,H),s_e(Y,H),o_e(e,re,H);const fe=v.useCallback(()=>{Ae.current&&(window.clearInterval(Ae.current),Ae.current=null)},[]),Ie=v.useCallback(()=>{ue.current||(ue.current=!0,Xr(),me(),fe(),Ae.current=window.setInterval(()=>{me()},500))},[me,fe]),ct=v.useCallback(()=>{if(fe(),!!ue.current){if(ue.current=!1,n==="point"&&!he)try{te("No Place bet","Add a Place bet (e.g., 6 or 8) before rolling")}catch{}w?.()}},[n,he,te,w,fe]),$e=c_e({phase:n,point:a,balance:r,pendingBets:f,minBet:o,maxBet:c,oddsMultiple:u,myPlayerLineTotals:N,myPlayerPlaceTotal:E}),rt=l_e(f,j);u_e(f,j,h);const We=v.useMemo(()=>{const X=os(f,"pass")>0||os(f,"dontPass")>0,le=(N?.pass??0)>0||(N?.dontPass??0)>0,be=rt("pass")>0||rt("dontPass")>0;return X||le||be},[f,N?.pass,N?.dontPass,rt]),{lineOutcomeMap:it,placeOutcomeMap:Et,fieldOutcomeMap:Mt,bigOutcomeMap:_t,comeOutcomeMap:ge}=d_e({recentSettlements:R,meId:D,myPlayerLineTotals:N}),Be=v.useMemo(()=>`.${ft.spotBtn}[data-win-outcome="true"]`,[]),je=v.useMemo(()=>JSON.stringify({lineOutcomeMap:it,placeOutcomeMap:Et,fieldOutcomeMap:Mt,bigOutcomeMap:_t,comeOutcomeMap:ge}),[it,Et,Mt,_t,ge]);f_e(Be,je),p_e({recentSettlements:R,meId:D,winSelector:Be,floatingClass:ft.floatingWinAmount});const nt=v.useMemo(()=>{const X=new Set;for(const le of f){const be=Number(j[le.type]||0);le.amount!==be&&X.add(le.type)}return X},[f,j]),Ct=v.useRef(new Set);v.useEffect(()=>{const X=Ct.current,le=nt;for(const be of X)if(!le.has(be)){try{FG({volume:.03})}catch{}break}Ct.current=new Set(le)},[nt]);const jt=nt.size>0;v.useMemo(()=>nt.size>0,[nt]);const De=v.useCallback((X,le)=>{if(le===0)return;const be=f.find(se=>se.type===X);if(le>0){const se=le,{ok:Oe,reason:wt}=hL(X,se,$e);if(!Oe){if(B(wt),ae(X),wt==="Insufficient balance")try{te("Insufficient funds","Add chips to place this bet")}catch{}window.setTimeout(()=>ae(void 0),600);return}if(be)h(f.map(er=>er===be?{...er,amount:er.amount+se}:er));else{const er=Number(j[X]||0);h([...f,{id:LE(),type:X,amount:er+se}])}P?.(X,se);return}let z=be?.amount??0;if(!be){const se=Number(j[X]||0);if(se<=0)return;z=se}const ee=z+le;h(be?f.map(se=>se===be?{...se,amount:Math.max(0,ee)}:se):[...f,{id:LE(),type:X,amount:Math.max(0,ee)}]),P?.(X,le)},[f,h,o,j,$e,P,te]),et=v.useCallback((X,le)=>{const be=X==="oddsPass",z=X==="oddsDontPass",ee=X==="atsSmall"||X==="atsTall"||X==="atsAll",se=X==="pass"||X==="dontPass"?ce:be?n!=="point"||!a||rt("pass")===0:z?n!=="point"||!a||rt("dontPass")===0:X.startsWith("place")||X==="come"||X==="dontCome"?!a:ee?n!=="comeOut"||F.betsLocked:!1,Oe=X==="pass"||X==="dontPass",wt=X==="come"||X==="dontCome",er=!X.startsWith("place"),Qt=Oe&&ce,Zt=Oe?it[X]:X==="field"?Mt[X]:X==="big6"||X==="big8"?_t[X]:wt?ge[X]:void 0,oa=Zt==="WIN"?ft.lineWin:Zt==="LOSE"?ft.lineLose:Zt==="PUSH"?ft.linePush:"",On=Oe&&He&&!We,Ye=[ft.spotBtn,ft.crapsBetTile,X.startsWith("place")?ft.crapsPlaceTile:"",se?ft.locked:"",K===X?ft.shake:"",oa,On?ft.attnHalo:"",X.startsWith("place")&&Re?ft.attnHalo:""],Yt=_||xe||jt,At=L&&typeof L[X]=="number"?L[X]:0,Rt=rt(X);if(er){const dn=[...Ye,ft.spotBtnTopRow,"gold-link",Yt?ft.disabled:""].filter(Boolean).join(" ");return g.jsxs(Ys.a,{role:"button",tabIndex:0,"aria-disabled":Yt||void 0,className:dn,"data-bet-type":X,"data-attn":On?"need-line":void 0,"data-has-bet":Rt>0?"true":"false","data-win-outcome":Zt==="WIN"?"true":"false","data-no-global-haptic":!0,"aria-label":`Place bet on ${le}, +${U}`,onClick:jr=>{jr.preventDefault(),!se&&!Yt&&(Xr(),cr("Light"),De(X,U))},onKeyDown:jr=>{(jr.key==="Enter"||jr.key===" ")&&!se&&!Yt&&(jr.preventDefault(),Xr(),cr("Light"),De(X,U))},whileTap:{scale:.94},children:[le,At>0&&g.jsx("div",{className:ft.aggBadge,"aria-label":`Others ${le} total ${Sa(At)}`,children:Sa(At)}),Rt>0&&g.jsxs("div",{className:ft.amountBadge+(Qt?" "+ft.amountBadgeDisabled:""),"aria-disabled":Qt||void 0,children:[!Qt&&g.jsx("span",{role:"button",tabIndex:0,className:[ft.badgeMinus,ft.crapsMinusBadge].join(" "),"aria-label":`Remove chip from ${le}`,onClick:jr=>{jr.stopPropagation(),Xr(),cr("Light"),De(X,-U)},onKeyDown:jr=>{(jr.key==="Enter"||jr.key===" ")&&(jr.preventDefault(),jr.stopPropagation(),Xr(),cr("Light"),De(X,-U))},children:"−"}),Sa(Rt),Qt&&g.jsx("span",{className:ft.lockIcon,"aria-hidden":"true",children:"🔒"}),Zt&&g.jsx("span",{className:ft.outcomeBadge,"aria-label":`Outcome ${Zt}`,children:Zt==="WIN"?"✓":Zt==="LOSE"?"✕":"⟳"})]}),K===X&&G&&g.jsx("div",{className:ft.tooltip,children:G})]},X)}const Dt=X.startsWith("place")?Et[X]:X==="field"?Mt[X]:X==="big6"||X==="big8"?_t[X]:void 0,Nn=Ye.filter(Boolean).join(" ");return g.jsxs(Ys.button,{type:"button",className:Nn,"data-bet-type":X,"data-attn":X.startsWith("place")&&Re?"need-places":void 0,"data-has-bet":Rt>0?"true":"false","data-win-outcome":Zt==="WIN"||Dt==="WIN"?"true":"false","aria-label":`Place bet on ${le}, +${U}`,onClick:()=>{!se&&!Yt&&(Xr(),cr("Light"),De(X,U))},disabled:_||xe||jt,whileTap:{scale:.94},children:[le,At>0&&g.jsx("div",{className:ft.aggBadge,"aria-label":`Others ${le} total ${Sa(At)}`,children:Sa(At)}),Rt>0&&g.jsxs("div",{className:ft.amountBadge+(Qt?" "+ft.amountBadgeDisabled:""),"aria-disabled":Qt||void 0,children:[!Qt&&g.jsx("span",{role:"button",tabIndex:0,className:[ft.badgeMinus,ft.crapsMinusBadge].join(" "),"aria-label":`Remove chip from ${le}`,onClick:dn=>{dn.stopPropagation(),Xr(),cr("Light"),De(X,-U)},onKeyDown:dn=>{(dn.key==="Enter"||dn.key===" ")&&(dn.preventDefault(),dn.stopPropagation(),Xr(),cr("Light"),De(X,-U))},children:"−"}),Sa(Rt),Qt&&g.jsx("span",{className:ft.lockIcon,"aria-hidden":"true",children:"🔒"}),Zt&&g.jsx("span",{className:ft.outcomeBadge,"aria-label":`Outcome ${Zt}`,children:Zt==="WIN"?"✓":Zt==="LOSE"?"✕":"⟳"})]}),K===X&&G&&g.jsx("div",{className:ft.tooltip,children:G})]},X)},[De,_,xe,rt,G,K,He,We,Re,U,ce,n,a,it,Et,Mt,_t,ge,L,jt,F.betsLocked]),at=v.useMemo(()=>{const X=[...e_e],le=(be,z,ee)=>{const se=X.findIndex(Oe=>Oe.key===be);se>=0&&!X.some(Oe=>Oe.key===z)&&X.splice(se+1,0,{key:z,label:ee})};return le("pass","oddsPass","Odds Pass"),le("dontPass","oddsDontPass","Odds Don't"),X},[]),we=v.useMemo(()=>at.map(X=>et(X.key,X.label)),[at,et]),st=v.useMemo(()=>r_e.map(X=>et(X.key,X.label)),[et]),bt=v.useMemo(()=>t_e.map(X=>et(X.key,X.label)),[et]),nr=v.useCallback(()=>{if(_||xe||jt)return;Xr(),cr("Light");const X=["place4","place5","place6","place8","place9","place10"],le=[];for(const z of X){f.find(wt=>wt.type===z);const ee=U,{ok:se,reason:Oe}=hL(z,ee,$e);if(!se){if(B(Oe),ae(z),Oe==="Insufficient balance")try{te("Insufficient funds","Add chips to place All Places bet")}catch{}window.setTimeout(()=>ae(void 0),600);return}le.push({type:z,delta:ee})}let be=[...f];for(const{type:z,delta:ee}of le){const se=be.find(Oe=>Oe.type===z);if(se)be=be.map(Oe=>Oe===se?{...Oe,amount:Oe.amount+ee}:Oe);else{const Oe=Number(j[z]||0);be.push({id:LE(),type:z,amount:Oe+ee})}}h(be),A?A(le.map(({type:z,delta:ee})=>({type:z,amount:ee}))):P&&le.forEach(({type:z,delta:ee})=>P(z,ee))},[_,xe,f,U,o,$e,h,j,A,P,te,jt]),ur=!!C,dr=ur?I||"Ready":"Roll",Sr=ur?!!x:q||b===!1,un=!ur&&!Sr&&b!==!1&&(n!=="point"||he),Z=i;return g.jsxs("div",{className:[ft.panelRoot,_?ft.disabled:""].join(" "),children:[g.jsxs("div",{className:ft.crapsStatusBar,children:[g.jsxs("span",{className:ft.crapsStatusText,children:[g.jsx("span",{className:ft.mobileHide,children:n==="comeOut"?"COME-OUT":"POINT"}),g.jsx("span",{className:ft.mobileShow,children:n==="comeOut"?"CO":"PT"})," • ",g.jsx("span",{className:ft.mobileHide,children:"SHOOTER: "}),g.jsx("strong",{className:ft.crapsHighlight,children:Z})," • ",g.jsx("span",{className:ft.mobileHide,children:"POINT: "}),g.jsx("span",{className:ft.mobileShow,children:"P: "}),g.jsx("strong",{className:ft.crapsHighlight,children:a??"—"})]}),g.jsx("button",{type:"button",className:ft.betInfoBtn,onClick:()=>{cr("Light"),ie(!0)},"aria-label":"Show bet information",children:g.jsx(Ml,{icon:Ove})})]}),g.jsx(Ive,{open:Q,onClose:()=>ie(!1)}),g.jsx("div",{className:[ft.spotRow,ft.crapsMainBets].join(" "),ref:re,children:we}),g.jsxs("div",{className:ft.crapsPlaceRow,ref:H,children:[st,g.jsx("button",{type:"button",className:[ft.spotBtn,ft.crapsBetTile,ft.crapsIronCrossBtn].join(" "),onClick:nr,disabled:!a||_||xe||jt,"aria-label":"Place All Places (4/5/6/8/9/10)",children:"All Places"}),g.jsx("span",{className:ft.crapsAtsDivider,children:"|"}),g.jsx("span",{className:ft.crapsAtsLabel,children:"ATS"}),bt,g.jsx(Jve,{hitNumbers:F.hitNumbers,smallProgress:F.smallProgress,tallProgress:F.tallProgress,allProgress:F.allProgress,betsLocked:F.betsLocked,lastCompletedCategory:Y,inline:!0})]}),g.jsx("div",{className:ft.crapsChipSelector,children:g.jsx("div",{className:ft.chipsRow,children:d.map(X=>{const le=X===U;return g.jsx("button",{type:"button",className:[ft.chip,ft.crapsChip,le?ft.chipSelected+" "+ft.crapsChipSelected:""].join(" "),"aria-label":`Select chip ${X}`,onClick:()=>{Xr(),fF(),W(X)},children:X},X)})})}),g.jsx("div",{className:ft.crapsActionsBar,children:g.jsxs("div",{className:ft.actions,children:[g.jsxs("button",{type:"button",className:[ft.actionBtn,ft.rollBtn,ft.crapsActionButton,ft.crapsActionButtonPrimary,un?ft.rollHaloActive:""].join(" "),onClick:X=>{if(ur){if(x)return;try{Xr(),cr("Light")}catch{}O?.();return}if(ue.current){X.preventDefault();return}if(!Sr){Xr(),cr("Medium"),me();try{n==="point"&&!he&&te("No Place bet","Add a Place bet (e.g., 6 or 8) before rolling")}catch{}w?.()}},onPointerDown:()=>{ur||Sr||(Ie(),cr("Medium"))},onPointerUp:()=>{ur||ct()},disabled:Sr,"aria-label":ur?"Mark ready":"Roll dice",children:[!ur&&g.jsx(Ml,{icon:Dve,className:ft.rollIcon,"aria-hidden":"true"}),dr]}),g.jsxs("button",{type:"button",className:[ft.actionBtn,ft.clear,ft.crapsActionButton,ft.crapsActionButtonSecondary].join(" "),onClick:()=>{Xr(),cr("Light"),m()},"aria-label":"Clear all bets",children:[g.jsx("span",{className:ft.crapsClearIcon,"aria-hidden":"true",children:"✕"})," Clear All"]})]})}),g.jsx("div",{className:ft.errorLive,"aria-live":"polite",children:G||""})]})}function m_e(t,e){const{crapsGetState:r,crapsJoinOrder:n,crapsLeaveOrder:a,crapsSetOrder:i,crapsRoll:o,crapsResetShooter:c,crapsReady:u}=pa(),d=e?.enabled??!0;return{getState:f=>d&&t?r(t).then(h=>(f?.(h),h)).catch(h=>(f?.({ok:!1,error:h?.message||"ERR"}),{ok:!1,error:h?.message||"ERR"})):void 0,joinOrder:f=>d&&t?n(t).then(h=>(f?.(h),h)).catch(h=>(f?.({ok:!1,error:h?.message||"ERR"}),{ok:!1,error:h?.message||"ERR"})):void 0,leaveOrder:f=>d&&t?a(t).then(h=>(f?.(h),h)).catch(h=>(f?.({ok:!1,error:h?.message||"ERR"}),{ok:!1,error:h?.message||"ERR"})):void 0,setOrder:(f,h)=>d&&t?i(t,f).then(m=>(h?.(m),m)).catch(m=>(h?.({ok:!1,error:m?.message||"ERR"}),{ok:!1,error:m?.message||"ERR"})):void 0,roll:f=>d&&t?o(t).then(h=>(f?.(h),h)).catch(h=>(f?.({ok:!1,error:h?.message||"ERR"}),{ok:!1,error:h?.message||"ERR"})):void 0,resetShooter:f=>d&&t?c(t).then(h=>(f?.(h),h)).catch(h=>(f?.({ok:!1,error:h?.message||"ERR"}),{ok:!1,error:h?.message||"ERR"})):void 0,ready:f=>d&&t?u(t).then(h=>(f?.(h),h)).catch(h=>(f?.({ok:!1,error:h?.message||"ERR"}),{ok:!1,error:h?.message||"ERR"})):void 0}}let Lh={},g_e=1;function Qz(t){const{roomId:e,myPlayerId:r,autoJoinOrder:n=!0,onRoll:a,onState:i}=t,{crapsReady:o}=pa(),c=(()=>{try{return Mi&&Mi()}catch{return null}})(),u=c?.room??null,d=c?.setRoom??(()=>{}),h=u?.gameState?.gameMode==="craps",m=m_e(e,{enabled:h}),_=v.useMemo(()=>{const ce=u?.gameState;return!ce||ce.gameMode!=="craps"?null:{point:ce.crapsPoint??null,currentRollerId:ce.currentRollerId??null,turnOrder:ce.turnOrder??[]}},[u?.gameState]),[w,b]=v.useState(null),[E,T]=v.useState([]),[D,P]=v.useState(!1),A=v.useRef(!1),[C,O]=v.useState([]),[I,x]=v.useState(null),[R,N]=v.useState([]),L=v.useRef(null),j=v.useRef(null),q=v.useRef(null),U=v.useRef(null),W=v.useRef(null),{triggerSpin:F}=Jo(),Y=v.useRef(null),Q=v.useRef(null),ie=2e3,G=v.useMemo(()=>!!(r&&_?.turnOrder.includes(r)),[r,_?.turnOrder]),B=v.useCallback(()=>{h&&m.getState?.()},[m,h]),K=v.useCallback(ce=>{!h||!e||A.current||(A.current=!0,m.joinOrder?.(xe=>{A.current=!1,ce?.(xe?.ok,xe?.data)}))},[m,e,h]),ae=v.useCallback(ce=>{!h||!e||A.current||(A.current=!0,m.leaveOrder?.(xe=>{A.current=!1,ce?.(xe?.ok,xe?.data)}))},[m,e,h]),te=v.useCallback((ce,xe)=>{!h||!e||A.current||(A.current=!0,m.setOrder?.(ce,re=>{A.current=!1,xe?.(re?.ok,re?.data)}))},[m,e,h]),me=v.useCallback(ce=>{if(!(!h||!e||A.current)){A.current=!0,P(!0),F();try{const xe=m.roll?.();xe&&typeof xe.then=="function"&&xe.then(re=>{const H=!!re?.ok,he=String(re?.error||"");if(A.current=!1,!H)try{const Re=/invalid_payload/i.test(he),fe=/no_room/i.test(he),Ie=/forbidden|unauthorized/i.test(he);if(Re||fe||Ie){Q.current&&(window.clearTimeout(Q.current),Q.current=null),P(!1),B(),ce?.(!1,re?.data);return}}catch{}try{Q.current&&(window.clearTimeout(Q.current),Q.current=null),Q.current=window.setTimeout(()=>{P(!1),Q.current=null},Math.max(ie,4e3))}catch{}ce?.(H,re?.data)}).catch(()=>{A.current=!1,P(!1);try{B()}catch{}ce?.(!1)})}catch{A.current=!1,P(!1),ce?.(!1)}}},[m,e,h]),ue=v.useCallback(ce=>{if(!(!h||!e||A.current)){A.current=!0;try{const xe=m.resetShooter?.();xe&&typeof xe.then=="function"&&xe.then(re=>{A.current=!1,ce?.(!!re?.ok,re?.data)}).catch(()=>{A.current=!1,ce?.(!1)})}catch{A.current=!1,ce?.(!1)}}},[m,e,h]),Ae=v.useRef(0);Ae.current===0&&(Ae.current=g_e++);const He=v.useMemo(()=>e?Lh[e]?Lh[e]===Ae.current:(Lh[e]=Ae.current,!0):!1,[e]);return v.useEffect(()=>()=>{try{e&&Lh[e]===Ae.current&&delete Lh[e]}catch{}},[e]),Pa({onJoinedRoom:({room:ce})=>{if(He)try{if(!e||!ce||ce.id!==e)return;if(U.current){const xe=U.current.cb;U.current=null,(async()=>{try{const re=await o(e);xe?.(!!re?.ok,re?.data)}catch{xe?.(!1)}})()}}catch{}},onRejoinedRoom:({room:ce})=>{if(He)try{if(!e||!ce||ce.id!==e)return;if(U.current){const xe=U.current.cb;U.current=null,(async()=>{try{const re=await o(e);xe?.(!!re?.ok,re?.data)}catch{xe?.(!1)}})()}}catch{}},onCrapsState:ce=>{if(!He||!e||ce.roomId!==e)return;const xe=ce.state?.currentRollerId??ce.state?.currentShooterId??ce.state?.shooterId??null,re=ce.state?.turnOrder||ce.state?.shooterOrder||[],H=ce.state?.point??ce.state?.crapsPoint??null;try{d(he=>{if(!he||he.id!==e)return he;const Re=he.gameState||{},fe=H?"point":"come-out";return{...he,gameState:{...Re,gameMode:Re.gameMode||"craps",crapsPoint:H,currentRollerId:xe,turnOrder:re,crapsPhase:fe}}})}catch{}try{i?.({point:H,currentRollerId:xe,turnOrder:re})}catch{}n&&r&&!re.includes(r)&&K()},onCrapsPointSet:ce=>{if(He)try{if(!e||ce?.roomId!==e)return;const xe=ce?.point??ce?.crapsPoint??null;d(re=>{if(!re||re.id!==e)return re;const H={...re.gameState||{}};return xe!=null&&(H.crapsPoint=xe,H.crapsPhase="point"),{...re,gameState:H}})}catch{}},onCrapsRollResult:ce=>{if(!He||!e||ce?.roomId!==e)return;try{A.current=!1,P(!0),Y.current&&(window.clearTimeout(Y.current),Y.current=null),Y.current=window.setTimeout(()=>{P(!1),Y.current=null},ie),Q.current&&(window.clearTimeout(Q.current),Q.current=null)}catch{}let xe,re;if(Array.isArray(ce?.dice)?[xe,re]=ce.dice:(xe=ce?.d1,re=ce?.d2),typeof xe!="number"||typeof re!="number")return;const H=typeof ce.total=="number"?ce.total:xe+re,he=ce.currentRollerId??ce.currentShooterId??ce.shooterId??null,Re=ce.nextRollerId??ce.nextShooterId??ce.nextShooter??null,fe={roomId:ce.roomId,dice:[xe,re],total:H,point:ce.point??ce.crapsPoint??null,currentRollerId:he,nextRollerId:Re,events:Array.isArray(ce.events)?ce.events:[],resolutions:ce.resolutions||{passLineWins:!1,passLineLosses:!1,pushes:!1}};b(fe),T(Ie=>{const ct=Date.now(),$e=30,rt=900;for(let Et=0;Et<Ie.length&&Et<5;Et++){const Mt=Ie[Et];if(Mt.dice[0]===fe.dice[0]&&Mt.dice[1]===fe.dice[1]&&ct-Mt.ts<rt)return Ie}const it=[{...fe,ts:ct,phase:fe.point?"point":"come-out"},...Ie];it.length>$e&&(it.length=$e);try{if(e){const Et={v:1,roomId:e,ts:ct,items:it};Ab(`craps-roll-history:${e}`,Et)}}catch{}return it});try{const Ie=Re||null;O(Ie?[Ie]:[]),x(null)}catch{}try{F()}catch{}try{(ce.gameState||ce.point!==void 0||ce.currentRollerId!==void 0||ce.nextRollerId!==void 0)&&d(Ie=>{if(!Ie||Ie.id!==e)return Ie;const $e={...Ie.gameState||{}};(ce.point!==void 0||ce.crapsPoint!==void 0)&&($e.crapsPoint=ce.point??ce.crapsPoint);const rt=Re??he;return rt!==void 0&&($e.currentRollerId=rt),(Array.isArray(ce.turnOrder)||Array.isArray(ce.shooterOrder))&&($e.turnOrder=ce.turnOrder||ce.shooterOrder),$e.gameMode||($e.gameMode="craps"),$e.crapsPhase=$e.crapsPoint?"point":"come-out",{...Ie,gameState:$e}})}catch{}a?.(fe)},onCrapsReadyUpdate:ce=>{if(He)try{const xe=Array.isArray(ce?.readyPlayers)?ce.readyPlayers:void 0,re=Array.isArray(ce?.requiredReadyPlayers)?ce.requiredReadyPlayers:void 0,H=ce&&Object.prototype.hasOwnProperty.call(ce,"deadline"),he=H?typeof ce.deadline=="number"?ce.deadline:null:void 0,Re=(fe,Ie)=>{if(!fe&&!Ie)return!0;if(!fe||!Ie||fe.length!==Ie.length)return!1;for(let ct=0;ct<fe.length;ct++)if(fe[ct]!==Ie[ct])return!1;return!0};xe&&(Re(L.current,xe)||(L.current=xe.slice(),O(xe))),re&&(Re(j.current,re)||(j.current=re.slice(),N(re))),H&&q.current!==he&&(q.current=he===void 0?q.current:he,x(he))}catch{}},onCrapsBetsUpdate:ce=>{if(He)try{const xe=ce?.snapshot||{};d(re=>{if(!re||re.id!==e)return re;const H={...re.gameState||{}};for(const he of Object.keys(xe))H[he]=xe[he];return H.gameMode||(H.gameMode="craps"),{...re,gameState:H}})}catch{}}}),v.useEffect(()=>{!e||!h||He&&B()},[e,h]),v.useEffect(()=>{try{const ce=u?.gameState;if(!ce||ce.gameMode!=="craps")return;const xe=ce.crapsReadiness;xe&&(Array.isArray(xe.readyPlayers)&&O(xe.readyPlayers),Array.isArray(xe.requiredReadyPlayers)&&N(xe.requiredReadyPlayers),Object.prototype.hasOwnProperty.call(xe,"deadline")&&x(typeof xe.deadline=="number"?xe.deadline:null))}catch{}},[u?.gameState]),v.useEffect(()=>{if(!h||!e||!He)return;let ce=0;const xe=500,re=()=>{try{const fe=Date.now();if(fe-ce<xe)return;ce=fe,B()}catch{}},H=()=>{document.visibilityState==="visible"&&re()},he=()=>{re()},Re=()=>{re()};return window.addEventListener("visibilitychange",H),window.addEventListener("focus",he),window.addEventListener("ad:complete",Re),()=>{window.removeEventListener("visibilitychange",H),window.removeEventListener("focus",he),window.removeEventListener("ad:complete",Re)}},[h,e,B,He]),v.useEffect(()=>{e&&(async()=>{try{const ce=await Xf(`craps-roll-history:${e}`);if(!ce)return;if(ce&&ce.v===1&&Array.isArray(ce.items)){if(typeof ce.ts=="number"&&Date.now()-ce.ts>72e5)return;const re=[];for(const H of ce.items)if(!(!H||!Array.isArray(H.dice)||H.dice.length!==2)&&!(typeof H.total!="number"||typeof H.ts!="number")&&(re.push({roomId:e,dice:[Number(H.dice[0]),Number(H.dice[1])],total:Number(H.total),point:typeof H.point=="number"?H.point:H.point??null,currentRollerId:H.currentRollerId??null,nextRollerId:H.nextRollerId??null,events:Array.isArray(H.events)?H.events.slice(0,8):[],resolutions:H.resolutions||{passLineWins:!1,passLineLosses:!1,pushes:!1},ts:H.ts,phase:H.phase==="point"?"point":"come-out"}),re.length>=30))break;re.length&&T(re)}}catch{}})()},[e]),v.useEffect(()=>()=>{Y.current&&(window.clearTimeout(Y.current),Y.current=null),Q.current&&(window.clearTimeout(Q.current),Q.current=null),W.current&&(window.clearTimeout(W.current),W.current=null)},[]),{shooterState:_,lastRoll:w,rollHistory:E,rolling:D,inTurnOrder:G,joinOrder:K,leaveOrder:ae,setOrder:te,roll:me,resetShooter:ue,requestState:B,readyPlayers:C,readinessDeadline:I,requiredReadyPlayers:R,ready:ce=>{if(!e||!h)return;const xe=!!(u&&u.id===e);if(r&&!C.includes(r)&&O(re=>[...re,r]),I||x(Date.now()+5e3),!xe){U.current={cb:ce,at:Date.now()};try{W.current&&(window.clearTimeout(W.current),W.current=null),W.current=window.setTimeout(async()=>{try{if(!U.current)return;const re=await o(e),H=U.current?.cb;U.current=null,H?.(!!re?.ok,re?.data)}catch{const re=U.current?.cb;U.current=null,re?.(!1)}finally{W.current&&(window.clearTimeout(W.current),W.current=null)}},600)}catch{}return}(async()=>{try{const re=await o(e);if(!re?.ok){const H=String(re?.error||""),he=/forbidden|unauthorized/i.test(H),Re=/ready_failed/i.test(H);if(he||Re){try{B()}catch{}try{const fe=await o(e);ce?.(!!fe?.ok,fe?.data);return}catch{}}ce?.(!1);return}ce?.(!0,re?.data)}catch{try{setTimeout(async()=>{try{const re=await o(e);ce?.(!!re?.ok,re?.data)}catch{ce?.(!1)}},400)}catch{ce?.(!1)}}})()},iAmReady:!!(r&&C.includes(r)),clearRollHistory:()=>{T([]);try{e&&Jf(`craps-roll-history:${e}`)}catch{}}}}function y_e(t){const{roomId:e,userId:r,shooterState:n,roomGameState:a,pendingBets:i=[],myLineFromUnified:o,betsLastUpdated:c}=t;if(!e||!r)return!1;const u=a?.currentRollerId,d=n?.currentRollerId||null;if(!!!(r&&(u?u===r:d===r))||Array.isArray(i)&&i.some(E=>Number(E.amount)>0))return!1;let h;const m=a?.crapsPassBets,_=a?.crapsDontPassBets;if(Array.isArray(m)||Array.isArray(_))h=!!(m?.some(E=>E.playerId===r&&E.amount>0)||_?.some(E=>E.playerId===r&&E.amount>0));else if(typeof c=="number")if(c===0)h=!0;else{const E=Number(o?.pass||0),T=Number(o?.dontPass||0);h=E>0||T>0}else{const E=Number(o?.pass||0),T=Number(o?.dontPass||0);h=E>0||T>0}if(!h)return!1;const w=Array.isArray(n?.turnOrder)&&n.turnOrder.length?n.turnOrder:Array.isArray(a?.turnOrder)?a.turnOrder:[];return!!(r&&w.includes(r))}const UE=new Map,FE={pass:[],dontPass:[],odds:[],place:[],field:[],big:[],come:[],dontCome:[],ats:[],lastUpdated:0};function Zz(t){const{roomId:e,myPlayerId:r,autoListOnMount:n=!0,autoClearSettlementsMs:a=8e3}=t;ks();const{room:i,setRoom:o}=Mi(),[c,u]=v.useState(FE),d=v.useRef(FE),[f,h]=v.useState([]),[m,_]=v.useState(null),[w,b]=v.useState(null),[E,T]=v.useState(null),[D,P]=v.useState([]),[A,C]=v.useState([]),[O,I]=v.useState(null),x=v.useRef(null),R=v.useRef(!1),N=v.useRef(0),L=v.useRef(new Map),{crapsListBets:j,crapsAddBet:q,crapsRemoveBet:U,crapsClearBets:W,crapsSummarizeBets:F}=pa(),Y=v.useCallback(H=>{if(!e)return;const he=UE.get(e);if(he)return H&&he.then(fe=>H(fe)).catch(fe=>H({ok:!1,error:String(fe?.message||fe)})),he;const Re=j(e);return UE.set(e,Re),Re.finally(()=>{UE.delete(e)}),H&&Re.then(fe=>H(fe)).catch(fe=>H({ok:!1,error:String(fe?.message||fe)})),Re},[j,e]),Q=v.useCallback((H,he,Re)=>{if(!e)return;const fe=q(e,H,he);return Re&&fe.then(Ie=>Re(Ie)).catch(Ie=>Re({ok:!1,error:String(Ie?.message||Ie)})),fe},[q,e]),ie=v.useCallback((H,he,Re)=>{if(!e)return;const fe=U(e,H,he);return Re&&fe.then(Ie=>Re(Ie)).catch(Ie=>Re({ok:!1,error:String(Ie?.message||Ie)})),fe},[U,e]),G=v.useCallback(H=>{if(!e)return;const he=W(e);return H&&he.then(Re=>H(Re)).catch(Re=>H({ok:!1,error:String(Re?.message||Re)})),he},[W,e]),B=v.useCallback(H=>{if(!e)return;const he=F(e);return H&&he.then(Re=>H(Re)).catch(Re=>H({ok:!1,error:String(Re?.message||Re)})),he},[F,e]),K=e&&r?`crapsbets:${e}:${r}`:null,ae=1800*1e3,te=v.useCallback(async()=>{if(K)try{const H=await Xf(K);if(!H)return;const he=H.pass,Re=H.dontPass,fe=Array.isArray(H.place)?H.place:[],Ie=typeof H.ts=="number"?H.ts:void 0;if(Ie&&Date.now()-Ie>ae||!fe?.length&&!he&&!Re)return;u(ct=>{if(ct.lastUpdated!==0||ct.place.length+ct.pass.length+ct.dontPass.length>0)return ct;const $e={...ct};return he&&($e.pass=[{playerId:r,amount:he}]),Re&&($e.dontPass=[{playerId:r,amount:Re}]),fe?.length&&($e.place=fe.map(rt=>({playerId:r,point:rt.point,amount:rt.amount}))),$e.lastUpdated=Date.now(),d.current=$e,$e})}catch{}},[K,r]);v.useEffect(()=>{te()},[te]);const me=v.useCallback(async()=>{if(!(!K||!r||!e))try{const H=await Xf(K);if(!H)return;const he=Number(H.pass||0),Re=Number(H.dontPass||0),fe=Array.isArray(H.place)?H.place:[],Ie=Date.now();try{await Y()}catch{}const ct=Date.now()+1200;for(;(d.current.lastUpdated||0)<=Ie&&Date.now()<ct;)await new Promise(_t=>setTimeout(_t,120));if((d.current.lastUpdated||0)<=Ie)return;const $e=d.current,rt=($e.pass||[]).find(_t=>_t.playerId===r)?.amount||0,We=($e.dontPass||[]).find(_t=>_t.playerId===r)?.amount||0,it={};for(const _t of $e.place||[])_t.playerId===r&&(it[_t.point]=(it[_t.point]||0)+_t.amount);const Et=Math.max(0,he-rt),Mt=Math.max(0,Re-We);if(Et>0)try{await q(e,"pass",Et)}catch{}if(Mt>0)try{await q(e,"dontPass",Mt)}catch{}for(const _t of fe){const ge=Number(_t.point),Be=Number(_t.amount||0),je=Number(it[ge]||0),nt=Math.max(0,Be-je);if(nt>0)try{const Ct=`place${ge}`;await q(e,Ct,nt)}catch{}}}catch{}},[K,r,e,Y,c,q]),ue=v.useCallback(H=>{!H||typeof H!="object"||u(he=>{const Re={pass:Array.isArray(H.crapsPassBets)?H.crapsPassBets:he.pass,dontPass:Array.isArray(H.crapsDontPassBets)?H.crapsDontPassBets:he.dontPass,odds:Array.isArray(H.crapsOddsBets)?H.crapsOddsBets:he.odds,place:Array.isArray(H.crapsPlaceBets)?H.crapsPlaceBets:he.place,field:Array.isArray(H.crapsFieldBets)?H.crapsFieldBets:he.field,big:Array.isArray(H.crapsBigBets)?H.crapsBigBets:he.big,come:Array.isArray(H.crapsComeBets)?H.crapsComeBets:he.come,dontCome:Array.isArray(H.crapsDontComeBets)?H.crapsDontComeBets:he.dontCome,ats:Array.isArray(H.crapsAtsBets)?H.crapsAtsBets:he.ats,lastUpdated:Date.now()};return d.current=Re,Re})},[]),Ae=v.useCallback((H,he,Re)=>{if(!e||H!==e)return;h(he),N.current+=1;const fe={...Re||{},_seq:N.current};_(fe);try{o(ct=>{if(!ct||ct.id!==e)return ct;const $e={...ct.gameState||{}};return $e.lastCrapsSettlementsTs=Date.now(),$e.lastCrapsSettlements=he,{...ct,gameState:$e}})}catch{}const Ie=new Map;for(const ct of he)ct.outcome==="WIN"&&ct.playerId&&Ie.set(ct.playerId,(Ie.get(ct.playerId)||0)+1);for(const[ct,$e]of Ie){const rt=L.current.get(ct)||0,We=rt+$e;if(L.current.set(ct,We),rt>=6&&We>rt)gO(7,.55);else for(const it of[3,4,5,6])if(rt<it&&We>=it){gO(it,.55);break}}x.current&&clearTimeout(x.current),x.current=setTimeout(()=>h([]),a)},[e,o,a]);Pa({onCrapsRollResult:H=>{try{if(!e||H?.roomId!==e)return;const he=Array.isArray(H?.events)?H.events:[],Re=he.includes("crapsOut")||he.includes("CRAPS_OUT"),fe=he.includes("sevenOut")||he.includes("SEVEN_OUT");if((Re||fe)&&L.current.clear(),fe){u(Ie=>{if(!Ie.place.length)return Ie;const ct={...Ie,place:[],lastUpdated:Date.now()};return d.current=ct,ct});try{o(Ie=>{if(!Ie||Ie.id!==e)return Ie;const ct={...Ie.gameState||{}};return ct.crapsPlaceBets=[],{...Ie,gameState:ct}})}catch{}}}catch{}},onJoinedRoom:async({room:H})=>{try{if(H?.id&&H.id===e){try{await Y()}catch{}try{await me()}catch{}}}catch{}},onRejoinedRoom:async({room:H})=>{try{if(H?.id&&H.id===e){try{await Y()}catch{}try{await me()}catch{}}}catch{}},onCrapsReadyUpdate:H=>{try{if(Array.isArray(H?.readyPlayers)&&P(H.readyPlayers),Array.isArray(H?.requiredReadyPlayers)&&C(H.requiredReadyPlayers),H&&Object.prototype.hasOwnProperty.call(H,"deadline")){const he=typeof H.deadline=="number"?H.deadline:null;I(he)}}catch{}},onCrapsBetsUpdate:H=>{if(!e||H?.roomId!==e)return;const he=H?.snapshot;if(he){ue(he);try{o(Re=>{if(!Re||Re.id!==e)return Re;const fe={...Re.gameState||{}};for(const Ie of Object.keys(he))fe[Ie]=he[Ie];return fe.gameMode||(fe.gameMode="craps"),{...Re,gameState:fe}})}catch{}}K&&r&&(async()=>{try{const Re=(he?.crapsPassBets||[]).find($e=>$e.playerId===r)?.amount||0,fe=(he?.crapsDontPassBets||[]).find($e=>$e.playerId===r)?.amount||0,Ie=(he?.crapsPlaceBets||[]).filter($e=>$e.playerId===r).map($e=>({point:$e.point,amount:$e.amount})),ct={v:1,ts:Date.now(),pass:Re,dontPass:fe,place:Ie};Re||fe||Ie.length?await Ab(K,ct):await Jf(K)}catch{}})()},onCrapsBetResults:H=>{const he=Array.isArray(H?.settlements)?H.settlements:[];Ae(H?.roomId,he,H?.roll)},onCrapsPointSet:H=>{if(!e||H?.roomId!==e)return;const he=H.currentRollerId||H.nextRollerId||"unknown",Re=`ptSet:${H.point}:${Array.isArray(H.dice)?H.dice.join("-"):""}:${he}`;b({...H,_key:Re});try{o(fe=>{if(!fe||fe.id!==e)return fe;const Ie={...fe.gameState||{}};return Ie.gameMode=Ie.gameMode||"craps",Ie.crapsPoint=typeof H.point=="number"?H.point:H.point??null,Ie.crapsPhase=Ie.crapsPoint?"point":"come-out",H.currentRollerId!==void 0&&(Ie.currentRollerId=H.currentRollerId),Array.isArray(H.turnOrder)&&(Ie.turnOrder=H.turnOrder),{...fe,gameState:Ie}})}catch{}},onCrapsPointMade:H=>{if(!e||H?.roomId!==e)return;const he=H.currentRollerId||H.nextRollerId||"unknown",Re=`ptMade:${H.point}:${Array.isArray(H.dice)?H.dice.join("-"):""}:${he}`;T({...H,_key:Re});try{o(fe=>{if(!fe||fe.id!==e)return fe;const Ie={...fe.gameState||{}};return Ie.gameMode=Ie.gameMode||"craps",Ie.crapsPoint=null,Ie.crapsPhase="come-out",H.nextRollerId!==void 0&&(Ie.currentRollerId=H.nextRollerId),Array.isArray(H.turnOrder)&&(Ie.turnOrder=H.turnOrder),{...fe,gameState:Ie}})}catch{}}}),v.useEffect(()=>{if(!e){u(FE),R.current=!1,h([]),_(null);return}const H=i?.gameState;H&&(H.crapsPassBets||H.crapsDontPassBets)&&ue(H),n&&!R.current&&(R.current=!0,Y())},[e]),v.useEffect(()=>{if(!e)return;const H=async()=>{await new Promise(he=>setTimeout(he,300));try{await Y()}catch{}try{await me()}catch{}};return window.addEventListener("ad:complete",H),()=>{window.removeEventListener("ad:complete",H)}},[e,Y,me]),v.useEffect(()=>()=>{x.current&&clearTimeout(x.current)},[]);const He=v.useMemo(()=>c.pass.reduce((H,he)=>H+he.amount,0),[c.pass]),ce=v.useMemo(()=>c.dontPass.reduce((H,he)=>H+he.amount,0),[c.dontPass]),xe=v.useMemo(()=>c.field.reduce((H,he)=>H+he.amount,0),[c.field]),re=v.useMemo(()=>r?{pass:c.pass.filter(H=>H.playerId===r).reduce((H,he)=>H+he.amount,0),dontPass:c.dontPass.filter(H=>H.playerId===r).reduce((H,he)=>H+he.amount,0)}:{pass:0,dontPass:0},[c.pass,c.dontPass,r]);return{betsState:c,recentSettlements:f,lastSettlementRoll:m,_persistKey:K,passTotal:He,dontPassTotal:ce,fieldTotal:xe,myLine:re,listBets:Y,addBet:Q,removeBet:ie,clearBets:G,summarize:B,clearRecentSettlements:()=>h([]),pointSetEvent:w,pointMadeEvent:E,readyPlayers:D,requiredReadyPlayers:A,readinessDeadline:O}}function v_e(){try{if(typeof window>"u")return!1;const t=window;return t.__E2E===!0||typeof t.location<"u"&&!!t.location.search&&t.location.search.includes("e2e=1")||typeof t.sessionStorage<"u"&&t.sessionStorage.getItem("e2e")==="1"}catch{return!1}}function wc(t,e){if(!Array.isArray(t)||!e)return 0;let r=0;for(const n of t)n.playerId===e&&(r+=Number(n.amount)||0);return r}function Bh(t,e){if(!Array.isArray(t)||!e)return 0;let r=0;for(const n of t)n.playerId!==e&&(r+=Number(n.amount)||0);return r}function Lu(t,e,r){if(!Array.isArray(t)||!e)return 0;let n=0;for(const a of t)a.playerId===e&&r(a)&&(n+=Number(a.amount)||0);return n}function mL(t,e,r){if(!Array.isArray(t)||!e)return 0;let n=0;for(const a of t)a.playerId!==e&&r(a)&&(n+=Number(a.amount)||0);return n}function __e(t,e){const r={};if(!Array.isArray(t)||!e)return r;for(const n of t){if(n.playerId!==e)continue;const a=Number(n.point);r[a]=(r[a]||0)+(Number(n.amount)||0)}return r}function ff(t,e,r){if(!Array.isArray(t)||!e)return 0;let n=0;for(const a of t)a.playerId!==e&&Number(a.point)===r&&(n+=Number(a.amount)||0);return n}function b_e(t,e){const[r,n]=v.useState(t.point),[a,i]=v.useState(t.phase);return v.useEffect(()=>{e&&(n(t.point),i(t.phase))},[e,t.point,t.phase]),{displayPoint:r,displayPhase:a}}function k_e({balance:t,meId:e,readyPlayers:r}){const{user:n,meId:a}=$r(),{room:i,setRoom:o}=Mi(),c=i?.id??null,u=v.useMemo(()=>v_e(),[]),d=v.useMemo(()=>{if(a)return a;const Be=n;return Be?.id??Be?.email??""},[n,a]),f=v.useMemo(()=>e||d,[e,d]),[h,m]=v.useState([]),{shooterState:_,roll:w,rolling:b,readyPlayers:E,ready:T}=Qz({roomId:c,myPlayerId:f}),D=Zz({roomId:c,myPlayerId:f}),P=v.useMemo(()=>Array.isArray(r)?r:Array.isArray(D.readyPlayers)&&D.readyPlayers.length>0?D.readyPlayers:E,[r,D.readyPlayers,E]),A=v.useMemo(()=>({addBet:D.addBet,removeBet:D.removeBet,clearBets:D.clearBets}),[D.addBet,D.removeBet,D.clearBets]),C=D.betsState||{},O=C.pass||[],I=C.dontPass||[],x=C.place||[],R=C.field||[],N=C.big||[],L=C.come||[],j=C.dontCome||[],q=C.odds||[],U=C.ats||[],W=v.useMemo(()=>__e(x,f),[x,f]),F=v.useMemo(()=>{let Be=0;for(const je of[4,5,6,8,9,10])Be+=W[je]||0;return Be},[W]),Y=v.useMemo(()=>{const Be={};if(!f)return Be;const je=D.myLine?.pass??wc(O,f),nt=D.myLine?.dontPass??wc(I,f);je>0&&(Be.pass=je),nt>0&&(Be.dontPass=nt);for(const dr of[4,5,6,8,9,10]){const Sr=W[dr]||0;Sr>0&&(Be[`place${dr}`]=Sr)}const Ct=wc(R,f);Ct>0&&(Be.field=Ct);const jt=Lu(N,f,dr=>dr.kind==="big6");jt>0&&(Be.big6=jt);const De=Lu(N,f,dr=>dr.kind==="big8");De>0&&(Be.big8=De);const et=wc(L,f);et>0&&(Be.come=et);const at=wc(j,f);at>0&&(Be.dontCome=at);const we=Lu(q,f,dr=>dr.passType==="pass");we>0&&(Be.oddsPass=we);const st=Lu(q,f,dr=>dr.passType==="dontPass");st>0&&(Be.oddsDontPass=st);const bt=Lu(U,f,dr=>dr.kind==="atsSmall");bt>0&&(Be.atsSmall=bt);const nr=Lu(U,f,dr=>dr.kind==="atsTall");nr>0&&(Be.atsTall=nr);const ur=Lu(U,f,dr=>dr.kind==="atsAll");return ur>0&&(Be.atsAll=ur),Be},[f,D.myLine?.pass,D.myLine?.dontPass,O,I,W,R,N,L,j,q,U]),Q=v.useMemo(()=>{const Be=f;return Be?{pass:Bh(O,Be),dontPass:Bh(I,Be),field:Bh(R,Be),big6:mL(N,Be,je=>je.kind==="big6"),big8:mL(N,Be,je=>je.kind==="big8"),come:Bh(L,Be),dontCome:Bh(j,Be),place4:ff(x,Be,4),place5:ff(x,Be,5),place6:ff(x,Be,6),place8:ff(x,Be,8),place9:ff(x,Be,9),place10:ff(x,Be,10)}:{}},[f,O,I,R,N,L,j,x]),ie=v.useCallback(Be=>m(Be),[]),G=v.useRef(0),B=v.useCallback(()=>{if(!c||!f||!h.length)return;const Be=Date.now();if(!(Be-G.current<1e3)){G.current=Be;try{const je=wc(O,f),nt=wc(I,f),Ct=W;for(const jt of h){const De=jt.type;let et=0;if(De==="pass")et=je;else if(De==="dontPass")et=nt;else if(De.startsWith("place")){const st=parseInt(De.replace("place",""),10);et=Ct[st]||0}else continue;const at=Math.max(0,Number(jt.amount)||0),we=Math.max(0,at-et);if(we>0)try{A.addBet(De,we)}catch{}}}catch{}}},[c,f,h,O,I,W,A]);Pa({onJoinedRoom:({room:Be})=>{Be?.id===c&&B()},onRejoinedRoom:({room:Be})=>{Be?.id===c&&B()}}),v.useEffect(()=>{if(!f)return;const Be=h.filter(je=>{if(je.type==="pass")return!(wc(O,f)>=je.amount);if(je.type==="dontPass")return!(wc(I,f)>=je.amount);if(je.type.startsWith("place")){const nt=parseInt(je.type.replace("place",""),10);return!((W[nt]||0)>=je.amount)}return!0});Be.length!==h.length&&m(Be)},[f,O,I,W,h]),v.useEffect(()=>{if(!c||!f||!o||!u)return;const Be=i?.gameState,je=Be?.currentRollerId;if(!je||je!==f)return;const nt=Be?.crapsPassBets,Ct=Be?.crapsDontPassBets;if(!(nt?.some(De=>De.playerId===f&&De.amount>0)||Ct?.some(De=>De.playerId===f&&De.amount>0)))try{o(De=>{if(!De||De.id!==c)return De;const et=De.gameState||{},at=Array.isArray(et.crapsPassBets)?et.crapsPassBets.slice():[];return at.push({playerId:f,amount:10}),{...De,gameState:{...et,crapsPassBets:at,gameMode:et.gameMode||"craps"}}})}catch{}},[c,i?.gameState,f,o,u]);const K=v.useCallback((Be,je)=>{c&&(je>0?A.addBet(Be,je):je<0&&A.removeBet(Be,Math.abs(je)))},[c,A]),ae=v.useMemo(()=>{const Be=i?.gameState;if(Be?.gameMode==="craps"){const je=Be.crapsPhase||(_?.point?"point":"comeOut");return{point:Be.crapsPoint??_?.point??null,phase:je==="point"?"point":"comeOut"}}return{point:_?.point??null,phase:_?.point?"point":"comeOut"}},[i?.gameState,_]),{reveal:te}=Jo(),{displayPoint:me,displayPhase:ue}=b_e(ae,te);v.useEffect(()=>{if(ae.point==null&&te){const Be=h.filter(je=>!je.type.startsWith("place"));Be.length!==h.length&&m(Be)}},[ae.point,te,h]);const Ae=i?.gameState,He=D.readinessDeadline??null,ce=D.requiredReadyPlayers??[],xe=y_e({roomId:c,userId:d,shooterState:_,roomGameState:Ae,pendingBets:h,myLineFromUnified:D.myLine,betsLastUpdated:D.betsState?.lastUpdated}),re=u?!0:xe;v.useEffect(()=>{try{if(!u)return;window.__debugCanRoll={canRoll:re,userId:n?.id,rolling:b,shooterState:_,roomGS:Ae,readyPlayers:P,requiredReadyPlayers:ce,readinessDeadline:He}}catch{}},[re,n,b,_,Ae,P,ce,He,u]);const H=!c,he=v.useMemo(()=>{const Be=i?.gameState?.currentRollerId;return f?Be===f:!1},[i?.gameState,f]),Re=!!(f&&P.includes(f)),[fe,Ie]=v.useState(!1);v.useEffect(()=>{Re&&Ie(!1)},[Re]);const ct=v.useRef(null),$e=v.useCallback(()=>{if(!(!c||!f||fe||Re)){Ie(!0);try{T()}catch{}ct.current&&window.clearTimeout(ct.current),ct.current=window.setTimeout(()=>{Ie(!1)},5e3)}},[c,f,fe,Re,T]);v.useEffect(()=>()=>{ct.current&&window.clearTimeout(ct.current)},[]);const[rt,We]=v.useState(Date.now());v.useEffect(()=>{if(!He)return;const Be=window.setInterval(()=>We(Date.now()),1e3);return()=>window.clearInterval(Be)},[He]);const it=v.useMemo(()=>{try{const Be=i?.gameState?.currentRollerId??null;if(!Be)return null;const je=i?.players?.find(nt=>nt.id===Be);return je?.name||je?.id||null}catch{return null}},[i?.gameState,i?.players]),Et=5,Mt=500,_t=v.useMemo(()=>[1,5,10,25,100],[]);return g.jsx(h_e,{roomId:c,balance:t,point:me,phase:ue,shooterName:it,minBet:Et,maxBet:Mt,oddsMultiple:{pass:3,dontPass:3,place:1},chips:_t,pendingBets:h,onChangeBets:ie,onClearAll:()=>{m([]),A.clearBets()},disabled:H,onRoll:()=>w(),canRoll:re,myPlayerPlaceTotal:F,myCommittedByType:Y,readyPlayers:P,meId:f,onBetDelta:K,showReadyButton:!he,onReadyClick:$e,readyStateLabel:"Ready",readyButtonDisabled:!1,recentSettlements:D.recentSettlements,myPlayerLineTotals:D.myLine,othersTotals:Q})}function w_e({balance:t,meId:e,readyPlayers:r}){return g.jsx("div",{className:"craps-bet-panel",children:g.jsx(k_e,{balance:t,meId:e,readyPlayers:r})})}function S_e(){const{infoNow:t}=Es(),{room:e}=Mi(),{meId:r}=$r(),n=e?.gameMode||e?.gameState?.gameMode,a=n==="craps",i=n==="cee-lo"||!n,o=!e?.singlePlayer,c=v.useRef({roundSeq:0,seen:new Set}),u=v.useRef(new Map),d=v.useRef(new Map),f=h=>h?(e?.players||[]).find(_=>_.id===h)?.name||"Player":"Unknown";return Pa({onBetsUpdated:h=>{try{const m=Number(h?.roundSeq??0)||0,_=Array.isArray(h?.openAll)?h.openAll:[];c.current.roundSeq!==m&&(c.current={roundSeq:m,seen:new Set},d.current.clear());const w=c.current.seen;if(w.size===0&&_.length>0){for(const T of _)T?.id&&w.add(T.id);d.current=new Map(_.filter(Boolean).map(T=>[T.id,T]));return}const b=d.current,E=new Map(_.filter(Boolean).map(T=>[T.id,T]));for(const T of _)if(!(!T||!T.id)&&!w.has(T.id)){if(w.add(T.id),T.type==="MAIN"){if(!(i&&o)||a&&r&&T.playerId===r)continue;const D=f(T.playerId),P=Math.max(0,Math.trunc(Number(T.amount)||0));P>0&&t("Main bet placed",`+z${P} — ${D}`)}else if(T.type==="SIDE"){const D=f(T.subjectId),P=Math.max(0,Math.trunc(Number(T.amount)||0));if(T.acceptedById){const A=f(T.acceptedById);P>0&&t("Side bet accepted",`z${P} — ${A} on ${D}`)}else{if(a&&r&&T.playerId===r)continue;P>0&&t("Side bet created",`+z${P} — on ${D}`)}}}for(const[T,D]of b.entries()){const P=E.get(T);if(D&&D.type==="SIDE"&&P&&P.type==="SIDE"&&!D.acceptedById&&P.acceptedById){const A=f(P.subjectId),C=Math.max(0,Math.trunc(Number(P.amount)||0)),O=f(P.acceptedById);C>0&&t("Side bet accepted",`z${C} — ${O} on ${A}`)}}for(const[T,D]of b.entries()){if(D?.type!=="SIDE")continue;if(!E.has(T)&&!D.acceptedById){const A=f(D.subjectId),C=Math.max(0,Math.trunc(Number(D.amount)||0));C>0&&t("Side bet cancelled",`-z${C} — on ${A}`)}}d.current=E}catch{}},onCrapsBetsUpdate:h=>{try{const m=h?.snapshot||{},_=u.current,w=new Map,b=(D,P)=>{w.set(D,(w.get(D)||0)+(Number.isFinite(P)?P:0))},E=D=>{const P=D.split("|"),A=P[0],C=P[1]||"",O=f(A);if(C.startsWith("place:"))return`Place ${C.split(":")[1]} — ${O}`;switch(C){case"pass":return`Pass — ${O}`;case"dontPass":return`Don't Pass — ${O}`;case"field":return`Field — ${O}`;case"big6":return`Big 6 — ${O}`;case"big8":return`Big 8 — ${O}`;default:return`${C} — ${O}`}},T=D=>Array.isArray(D)?D:[];for(const{playerId:D,amount:P}of T(m.crapsPassBets))b(`${D}|pass`,P);for(const{playerId:D,amount:P}of T(m.crapsDontPassBets))b(`${D}|dontPass`,P);for(const{playerId:D,amount:P}of T(m.crapsFieldBets))b(`${D}|field`,P);for(const{playerId:D,kind:P,amount:A}of T(m.crapsBigBets))b(`${D}|${P}`,A);for(const{playerId:D,point:P,amount:A}of T(m.crapsPlaceBets))b(`${D}|place:${P}`,A);for(const{playerId:D,amount:P,status:A,point:C}of T(m.crapsComeBets))b(`${D}|come${A==="POINT"&&C?":"+C:""}`,P);for(const{playerId:D,amount:P,status:A,point:C}of T(m.crapsDontComeBets))b(`${D}|dontCome${A==="POINT"&&C?":"+C:""}`,P);if(_.size===0){u.current=w;return}for(const[D,P]of w.entries()){const A=_.get(D)||0,C=Math.trunc(P-A);if(C>0){if(r&&D.startsWith(r+"|"))continue;t("Bet Placed",`+z${C} — ${E(D)}`)}}u.current=w}catch{}}}),v.useEffect(()=>{},[]),null}function E_e(t,e){const{rollDice:r,placeMainBet:n,cancelMainBet:a,createSideBet:i,acceptSideBet:o,cancelSideBet:c,confirmBets:u,bankerGiveUp:d,setSpectate:f,getWagers:h}=pa(),m=_=>{if(t)try{return _()}catch(w){return Promise.resolve({ok:!1,error:w?.message||"ERR"})}};return{roll:_=>m(()=>r(t).then(w=>(_?.(w),w)).catch(w=>{const b={ok:!1,error:w?.message||"ERR"};return _?.(b),b})),confirmBets:_=>m(()=>u(t).then(w=>(_?.(w),w)).catch(w=>{const b={ok:!1,error:w?.message||"ERR"};return _?.(b),b})),placeMain:(_,w)=>m(()=>n(t,_).then(b=>(w?.(b),b)).catch(b=>{const E={ok:!1,error:b?.message||"ERR"};return w?.(E),E})),cancelMain:(_,w)=>m(()=>a(t,_).then(b=>(w?.(b),b)).catch(b=>{const E={ok:!1,error:b?.message||"ERR"};return w?.(E),E})),createSide:(_,w,b)=>m(()=>i(t,{amount:_,...w||{}}).then(E=>(b?.(E),E)).catch(E=>{const T={ok:!1,error:E?.message||"ERR"};return b?.(T),T})),acceptSide:(_,w)=>m(()=>o(t,_).then(b=>(w?.(b),b)).catch(b=>{const E={ok:!1,error:b?.message||"ERR"};return w?.(E),E})),cancelSide:(_,w)=>m(()=>c(t,_).then(b=>(w?.(b),b)).catch(b=>{const E={ok:!1,error:b?.message||"ERR"};return w?.(E),E})),giveUpBank:_=>m(()=>d(t).then(w=>(_?.(w),w)).catch(w=>{const b={ok:!1,error:w?.message||"ERR"};return _?.(b),b})),spectate:(_,w)=>m(()=>f(t,_).then(b=>(w?.(b),b)).catch(b=>{const E={ok:!1,error:b?.message||"ERR"};return w?.(E),E})),refreshWagers:()=>{if(t)try{h(t)}catch{}}}}function T_e(t){const{isMyTurn:e,isBanker:r,diceSettled:n,hasMainBetPlaced:a,bankPointExists:i,roundEnded:o}=t;return e?n?o?{canRoll:!1,reason:"Round transition in progress"}:r&&i?{canRoll:!1,reason:"Banker point established"}:!r&&!a?{canRoll:!1,reason:"Place a main bet first"}:{canRoll:!0}:{canRoll:!1,reason:"Dice not settled"}:{canRoll:!1,reason:"Not your turn"}}function gL(t,e){return e&&t.find(n=>n.id===e)?.name||"Anonymous"}function C_e(t){switch((t||"").toLowerCase()){case"beatsbank":return"Beats Banker";case"losestobank":return"Loses to Banker";case"tiesbank":return"Ties Banker";default:return t||"Side Bet"}}function qE(t,e){const[r,n]=v.useState(e),a=v.useRef(!1);return v.useEffect(()=>{if(!t)return;let i=!1;return(async()=>{try{const o=await Xf(t);!i&&o!==null&&n(o)}catch{}a.current=!0})(),()=>{i=!0}},[t]),v.useEffect(()=>{t&&a.current&&(async()=>{try{await Ab(t,r)}catch{}})()},[t,r]),[r,n]}function UA(t,e,r){const{info:n}=uP(),a=r?.autoJoin??!0,i=tn(),o=cu(),{leaveRoom:c}=pa(),{joinRoom:u}=Mi(),d=u,f=E_e(t||null),{reveal:h,rollTrigger:m,triggerSpin:_}=Jo(),{user:w}=$r(),[b,E]=v.useState(null),{room:T}=Mi(),P=(()=>{try{return Mi&&Mi()}catch{return null}})()?.setRoom??null;v.useRef(null);const[A,C]=v.useState(!0),[O,I]=v.useState(null),[x,R]=v.useState(null),N=v.useRef(null),L=v.useRef(null);v.useRef([]);const[j,q]=v.useState(!0),[U,W]=v.useState(void 0),[F,Y]=qE(t?`gp:${t}:${e}:deadline`:void 0,30),[Q,ie]=qE(t?`gp:${t}:${e}:serverNow`:void 0,30),[G,B]=qE(t?`gp:${t}:${e}:feed`:void 0,[]),[K,ae]=v.useState([]),[te,me]=v.useState(null),[ue,Ae]=v.useState([]),[He,ce]=v.useState(!1),[xe,re]=v.useState(!1),H=v.useRef(null),he=v.useRef(null);v.useEffect(()=>{t&&(async()=>{try{await Jf(`gp:${t}:${e}:diceSettled`),await Jf(`gp:${t}:${e}:diceResults`)}catch{}})()},[t,e]),v.useEffect(()=>()=>{H.current&&(window.clearTimeout(H.current),H.current=null)},[]),v.useEffect(()=>{if(!b||!b.singlePlayer){ce(!1),re(!1),H.current&&(window.clearTimeout(H.current),H.current=null),he.current=null;return}const et=(b.gameState?.gameMode||b.gameState?.mode)==="craps"?1:3;if(b.players.length>=et+1){xe||re(!0),ce(!1),H.current&&(window.clearTimeout(H.current),H.current=null),he.current=null;return}xe||(H.current||(H.current=window.setTimeout(()=>{ce(!0),H.current=null},250)),he.current?Date.now()>he.current&&(re(!0),ce(!1)):he.current=Date.now()+5e3)},[b,xe]);const Re=r?.listeners??!0;Pa(Re?{onJoinedRoom:({room:De})=>{E(De),B(et=>[{kind:"system",message:`You joined ${De.name}`,ts:Date.now()},...et]);try{j===!1&&(L.current&&window.clearTimeout(L.current),L.current=window.setTimeout(()=>{j===!1&&!N.current&&q(!0),L.current=null},sa.diceSettleClientMs));const et=De?.gameState||{};!et?.bankRoll&&!et?.lastRoll&&j===!1&&!N.current&&q(!0)}catch{}},onRejoinedRoom:({room:De})=>{E(De),B(et=>[{kind:"system",message:`Rejoined ${De.name}`,ts:Date.now()},...et])},onOtherLeft:({room:De})=>{E(De)},onOtherPlayerJoined:({room:De})=>{E(De),B(et=>[{kind:"system",message:"Another player joined.",ts:Date.now()},...et])},onSpectatorsUpdated:De=>{const{spectators:et,roundSeq:at}=De||{};E(we=>{if(!we)return we;const st=we.gameState?.roundSeq;return typeof at=="number"&&typeof st=="number"&&at!==st?we:{...we,gameState:{...we.gameState,spectators:et??[]}}})},onDiceRolled:De=>{const{rollerId:et,results:at,rank:we,room:st,deadline:bt,serverNow:nr}=De;Y(bt),q(!1),L.current&&(window.clearTimeout(L.current),L.current=null),N.current&&window.clearTimeout(N.current),N.current=window.setTimeout(()=>{q(!0),st&&E(st);try{N.current&&window.clearTimeout(N.current)}catch{}N.current=null},sa.diceSettleClientMs),ie(nr),R(et),_(),W(at)},onBetsUpdated:De=>{setTimeout(()=>{De.room&&E(De.room)},2e3)},onSideBetCreated:De=>{if(!De||De.acceptedById||!De.subjectId||De.subjectId!==e)return;const at=`${gL(b?.players??[],De.playerId)} offered: ${C_e(De.predicate)} for $${De.amount}`;o.info(at,{title:"New Side Bet"})},onLobbyRooms:void 0,onNotYourTurn:()=>{B(De=>[{kind:"system",message:"It’s not your turn.",ts:Date.now()},...De])},onForceLogout:De=>{De?.reason==="session_superseded"?(V3(),B(et=>[{kind:"system",message:"You logged in from another device.",ts:Date.now()},...et])):B(et=>[{kind:"system",message:"You were logged out.",ts:Date.now()},...et]),i("/login",{replace:!0})},onError:De=>I(De),onTurnOrderUpdated:De=>{if(!De.room||!De.room.gameState)return;E(De.room);const et=gL(De.room.players,De.banker);B(at=>[{kind:"system",message:`${et} is now the banker for the new round.`,ts:Date.now()},...at])},onRoomUpdateState:De=>{const{roomId:et,gameState:at,room:we}=De||{},st=we?.gameState??at;!et||!st||E(bt=>{if(!bt||bt.roomId!==et||bt?.id!==et)return{...bt,gameState:st};const nr=bt.gameState?.roundSeq,ur=st?.roundSeq,dr=typeof nr=="number"&&typeof ur=="number"&&nr!==ur,Sr={...bt,gameState:{...bt.gameState,...st}};if(dr){try{q(!0)}catch{}try{W(void 0)}catch{}try{R(null)}catch{}}return Sr})}}:{}),v.useEffect(()=>()=>{N.current&&(window.clearTimeout(N.current),N.current=null),L.current&&(window.clearTimeout(L.current),L.current=null)},[]),v.useEffect(()=>{j===!1&&!N.current?(L.current&&window.clearTimeout(L.current),L.current=window.setTimeout(()=>{if(j===!1){N.current||q(!0);try{N.current&&window.clearTimeout(N.current)}catch{}N.current=null}L.current=null},sa.diceSettleClientMs)):j===!0&&L.current&&(window.clearTimeout(L.current),L.current=null)},[j]);const Ie=v.useRef(null),ct=v.useRef(void 0),$e=v.useRef(!1);Ie.current=d,v.useEffect(()=>{if(!a)return;let De=!1;if(ct.current!==t)return ct.current=t,$e.current=!1,(async()=>{if(!t){I("No room id provided."),C(!1);return}if(C(!0),I(null),!Ie.current){I("No join ref");return}const et=(()=>{try{return typeof window<"u"&&(window.location?.search?.includes("e2e=1")||window.__E2E===!0||typeof window.sessionStorage<"u"&&window.sessionStorage.getItem("e2e")==="1")}catch{return!1}})();let at=null;try{et?at=await Promise.race([Ie.current(t),new Promise(st=>setTimeout(()=>st({ok:!1,error:"e2e-timeout"}),1800))]):at=await Ie.current(t)}catch(we){if(!et){I(we?.message||"Failed to join room."),C(!1);return}}if(typeof window<"u"&&(window.__e2eJoinAttempt={roomId:t,res:at,ts:Date.now()}),!De){if(!at?.ok){if(!et){I(at?.error??"Failed to join room."),C(!1);return}const we=Date.now(),st=w?.id||"e2e-user",bt=w?.name||"E2E User",ur=((()=>{try{const Z=new URLSearchParams(window.location.search).get("m");return Z==="cee-lo"||Z==="craps"?Z:null}catch{return null}})()||(t?.toLowerCase().includes("ceelo")?"cee-lo":"craps"))==="cee-lo",dr=[{id:st,name:bt,isReady:!0,balance:1e3},{id:"bank",name:"Bank",isReady:!0,balance:1e6}],Sr=ur?{id:t,name:"E2E Cee-Lo Room",gameMode:"cee-lo",createdAt:we,updatedAt:we,bankerId:st,players:dr,gameState:{gameMode:"cee-lo",currentRollerId:st,banker:st,turnOrder:[st],roundSeq:1,bankRoll:null,turnHistory:[]}}:{id:t,name:"E2E Craps Room",gameMode:"craps",createdAt:we,updatedAt:we,bankerId:"bank",players:dr,gameState:{gameMode:"craps",crapsPoint:null,currentRollerId:st,turnOrder:[st],roundSeq:1,crapsPassBets:[],crapsDontPassBets:[],crapsPlaceBets:[]}};E(Sr);try{P?.(Sr)}catch{}typeof window<"u"&&(window.__e2eRoomHydrated={id:Sr.id,players:Sr.players.map(un=>un.id),gameMode:Sr.gameState.gameMode,ts:Date.now()}),C(!1);return}E(at.room);try{P?.(at.room)}catch{}typeof window<"u"&&(window.__e2eRoomHydrated={id:at.room?.id,players:at.room?.players?.map(we=>we.id),gameMode:at.room?.gameState?.gameMode,ts:Date.now()});try{rp("room_join",{roomId:t})}catch{}C(!1)}})(),()=>{De=!0,ct.current===t&&(ct.current=void 0)}},[t,a]);const rt=v.useMemo(()=>{if(!b||!e)return!1;const De=b.gameState||{};return(De?.gameMode??"cee-lo")==="craps",De?.currentRollerId===e},[b,e]),We=v.useMemo(()=>!b||!e?!1:(b.gameState||{})?.banker===e,[b,e]),{open:it,openAll:Et}=v0(t,e),Mt=v.useMemo(()=>(it||[]).some(De=>De.type==="MAIN"&&Number(De.amount)>0),[it]),_t=v.useMemo(()=>(Et||[]).some(De=>De.type==="MAIN"),[Et]),ge=b?.gameState?.currentRollerId??null,Be=v.useMemo(()=>{const De=b?.gameState||T?.gameState||{},et=De?.gameMode??"cee-lo",at=!!De?.roundEnded;if(et==="craps"){const nr=!!rt&&!!j&&!at;return me(nr?null:rt?j?"Round transition in progress":"Dice not settled":"Not your turn"),Ae([]),nr}if(!De?.currentRollerId)return me("Initializing…"),Ae([]),!1;const we=!b?.singlePlayer;if(We&&we&&!_t)return me("No open challenges"),Ae([]),!1;const st=!!De?.bankRoll,bt=T_e({isMyTurn:rt,isBanker:We,diceSettled:j,hasMainBetPlaced:Mt,bankPointExists:st,roundEnded:at});return me(bt.reason??null),Ae([]),bt.canRoll},[b?.gameState,T?.gameState,rt,We,Mt,j,_t,b?.singlePlayer]),je=v.useCallback(()=>{t&&(c(t),i("/lobby"))},[t,c,i]),nt=v.useCallback(()=>{if(!t||!Be)return;const De=!b?.singlePlayer;if(We&&De&&!_t){try{n("No open challenges")}catch{}return}if(!We&&!Mt){try{n("No open challenges")}catch{}return}try{rp("roll_click",{game:"cee-lo",role:We?"banker":"challenger"})}catch{}try{N.current&&(window.clearTimeout(N.current),N.current=null),L.current&&(window.clearTimeout(L.current),L.current=null)}catch{}q(!1),_(),(async()=>{const et=await f.roll(),at=et?.error||et?.message||"";if(!et||et.ok===!1){if(q(!0),/no open main bets/i.test(at)){const we=!!b?.singlePlayer;try{f.refreshWagers()}catch{}if(!we||!We)try{n("No open challenges")}catch{}return}return}})()},[t,f,_,Be,We,Mt,_t,b?.gameState]),Ct=v.useCallback(async()=>{if(t)return f.giveUpBank?.()},[t,f]),jt=v.useCallback(async De=>{if(t)return f.spectate?.(De)},[t,f]);return{room:b,joining:A,botsHydrating:He,error:O,isMyTurn:rt,isBanker:We,lastRollerId:x,rollTrigger:m,diceSettled:j,diceResults:U,deadline:F,serverNow:Q,canRoll:Be,canRollReason:te,canRollBlocking:ue,handleRoll:nt,handleLeave:je,giveUpBank:Ct,setSpectateMode:jt,currentRollerId:ge,readyPlayers:K}}function x_e({meId:t,players:e,openSideBets:r,onCancelSideBet:n,onAcceptSideBet:a,offersToMe:i=[],newOffersCount:o=0,onOffersSeen:c,disabled:u=!1,betsLocked:d,hasBankRoll:f,hasRolledThisRound:h}){const m=cu(),[_,w]=v.useState(!1),b=v.useRef(null),E=v.useMemo(()=>{if(typeof window<"u"&&window.location?.search?.includes("e2e=1")){const x=window.__e2eSideBets;if(Array.isArray(x)&&x.length>0)return x}return i},[i]);v.useEffect(()=>{_&&c?.()},[_,c]);const T=v.useCallback(async(x,R)=>{if(!a)return;if(R&&h?.(R)){m.info("Subject already rolled. Side bets are closed for this subject.");return}try{Xr()}catch{}const N=await a(x);N.ok||m.error(N.error||"Failed to accept side bet")},[a,h,m]),D=v.useCallback((x,R)=>{const N=(R||"").toLowerCase();return N==="beatsbank"||N==="subject_beats_banker"?`${x} beats Banker`:N==="losestobank"||N==="subject_loses_to_banker"?`${x} loses to Banker`:N==="tiesbank"||N==="subject_push"||N==="subject_ties_banker"?`${x} ties Banker`:`${x} side bet`},[]),P=v.useCallback(x=>x?x==="house_global"||x==="house"?"House":e.find(R=>R.id===x)?.name||"Player":"Player",[e]);v.useEffect(()=>{const x=R=>{b.current&&!b.current.contains(R.target)&&w(!1)};return _&&document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[_]);const A=!f&&!u,C=(E?.length??0)>0&&A&&!_,I=!A||(E?.length??0)===0?"btn btn--ghost"+(A?"":" is-disabled"):"gold-link"+(C?" gold-link--pulse":"");return g.jsxs("div",{className:"side-bet-panel",children:[g.jsxs("a",{onClick:()=>{try{c?.()}catch{}A&&w(!0)},className:I,"aria-disabled":A?void 0:"true",title:A?void 0:"Side bets closed",children:["Side bets",o>0&&g.jsx("span",{className:"sidebet-badge","aria-label":`${o} new offer${o>1?"s":""}`,children:o})]}),_&&g.jsx("div",{className:"side-bet-panel__modal",children:g.jsxs("div",{className:"side-bet-panel__modal-content",ref:b,children:[g.jsx("h3",{className:"side-bet-panel__title",children:"Side Bets"}),g.jsx("div",{className:"side-bet-panel__list",role:"list","aria-label":"Offers to you",children:E.length>0?E.map(x=>{const R=P(x.subjectId),N=D(R,x.predicate),L=x.subjectId,j=h?.(L)??!1,q=L===t;return g.jsxs("div",{className:"side-bet-panel__list-item",role:"listitem",children:[g.jsxs("div",{className:"side-bet-panel__wager-info",children:[g.jsx("span",{className:"side-bet-panel__wager-amount",children:g.jsx(Bc,{mini:!0,value:x.amount})}),g.jsx("span",{className:"side-bet-panel__wager-label",children:N})]}),a&&g.jsx("button",{className:"felt-btn felt-btn--primary",onClick:()=>T(x.id,L),disabled:u||j||q||f,title:f?"Dealer rolled – side bets closed":j?"Subject already rolled this round":q?"Cannot bet on yourself":"Accept this side bet",children:"Accept"})]},x.id)}):g.jsx("div",{className:"side-bet-panel__list-item side-bet-panel__list-item--empty",role:"listitem",children:g.jsx("span",{className:"side-bet-panel__empty",children:"No offers right now."})})}),g.jsx("h3",{className:"side-bet-panel__title",style:{marginTop:14},children:"Active side bets"}),g.jsx("div",{className:"side-bet-panel__list",role:"list","aria-label":"Your active side bets",children:r&&r.length>0?r.map(x=>{const R=P(x.subjectId),N=D(R,x.predicate),L=x.acceptedById,j=x.playerId===t,q=P(j?L||void 0:x.playerId),U=!!L,W=j&&!U&&!f&&!!n,F=j?f?"Dealer rolled – side bets closed":U?"Already accepted – cannot cancel":n?void 0:"Cancel not available":"Only the bet maker can cancel";return g.jsxs("div",{className:"side-bet-panel__list-item",role:"listitem",children:[g.jsxs("div",{className:"side-bet-panel__wager-info",style:{flex:1},children:[g.jsx("span",{className:"side-bet-panel__wager-amount",children:g.jsx(Bc,{mini:!0,value:x.amount})}),g.jsxs("span",{className:"side-bet-panel__wager-label",children:[N,g.jsx("span",{style:{display:"block",fontSize:"0.85em",opacity:.8},children:U?`with ${q}`:"awaiting taker"})]})]}),g.jsx("button",{className:"felt-btn "+(W?"felt-btn--danger":"felt-btn--secondary"),"aria-label":"Cancel side bet",title:W?"Cancel this side bet":F||"Cannot cancel",disabled:!W||!!u,onClick:async()=>{if(!W)return;try{Xr()}catch{}const Y=await n(x.id);Y.ok||m.error(Y.error||"Failed to cancel side bet")},children:"Cancel"})]},`active-${x.id}`)}):g.jsx("div",{className:"side-bet-panel__list-item side-bet-panel__list-item--empty",role:"listitem",children:g.jsx("span",{className:"side-bet-panel__empty",children:"No active side bets."})})}),g.jsx("div",{className:"side-bet-panel__cta",children:g.jsx("button",{className:"felt-btn felt-btn--secondary",onClick:()=>w(!1),style:{marginTop:8},children:"Close"})})]})})]})}function P_e({roomId:t,meId:e,bankerId:r,players:n,gameState:a,gameplay:i}){const o=cu(),c=r===e,{myOpenMain:u,myOpenSides:d,placeSideBet:f,cancelSideBet:h,acceptSideBet:m,offersToMe:_,newOfferCount:w,markOffersAsSeen:b}=v0(t,e),E=UA(t,e,{autoJoin:!1}),T=i?.giveUpBank??E.giveUpBank,D=i?.setSpectateMode??E.setSpectateMode,P=!!a?.betsLocked,A=!!a?.bankRoll,C=a?.spectators??[],O=C.includes(e),x=!c&&!P&&!A&&!!!u,R=c&&!P&&!A,N=v.useCallback(async()=>{try{Xr()}catch{}const U=await D(!O);U&&!U.ok&&o.error(U.error||"Failed to update spectate mode")},[D,O,o]),L=v.useCallback(async()=>{try{Xr()}catch{}try{}catch{}try{await ld("Medium")}catch{}const U=await T();U&&!U.ok&&o.error(U.error||"Failed to pass bank")},[T,o]),j=a?.roundSeq??1,q=v.useMemo(()=>{const U=a?.turnHistory??[];return!U||!Array.isArray(U)?[]:typeof a?.roundSeq=="number"?U.filter(W=>(W.roundSeq??j)===j):U},[a,j]);return g.jsxs(g.Fragment,{children:[c&&g.jsx("button",{className:"btn btn--ghost",disabled:!R,onClick:L,"aria-label":"Pass Bank",children:"Pass Bank"}),!c&&g.jsxs("div",{className:"betpanel__row betpanel__row--spectate",children:[g.jsx("div",{"aria-label":"Side bets",children:g.jsx(x_e,{isBanker:c,openSideBets:d,meId:e,players:n,onPlaceSideBet:U=>f({subjectId:U.playerId,predicate:U.predicate,amount:U.amount,clientBetId:U.clientBetId}),onCancelSideBet:h,onAcceptSideBet:m,offersToMe:_,newOffersCount:w,onOffersSeen:b,roomId:t,betsLocked:P,disabled:C.includes(e),hasBankRoll:A,hasRolledThisRound:U=>!!U&&q.some(W=>W.playerId===U&&(W.roundSeq??j)===j)})}),g.jsx("button",{className:"btn btn--ghost",onClick:N,disabled:!x,"aria-pressed":O,"aria-label":O?"Stop spectating this round":"Spectate this round",children:O?"Spectating":"Spectate"})]})]})}function bd({className:t,title:e,...r}){return g.jsxs("svg",{width:36,height:36,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,"aria-hidden":e?void 0:!0,role:e?"img":"presentation",...r,children:[e?g.jsx("title",{children:e}):null,g.jsx("path",{d:"M19 12H5m0 0l7-7m-7 7l7 7",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})]})}const A_e=new TextEncoder;function R_e(t){const e=t instanceof Uint8Array?t:new Uint8Array(t);return Array.from(e).map(r=>r.toString(16).padStart(2,"0")).join("")}async function D_e(t){const e=await crypto.subtle.digest("SHA-256",A_e.encode(t));return R_e(e)}async function O_e(t,e){return!t||!e?!1:(await D_e(t)).toLowerCase()===e.toLowerCase()}const zE=(t,e)=>`${t}:${e}`;function e6(t){const[e,r]=v.useState({}),[n,a]=v.useState({}),i=v.useRef({});v.useEffect(()=>{r({}),a({}),i.current={}},[t]),Pa({onDiceRolled:u=>{const d=u?.fairness,f=u?.rollerId,h=d?.roundSeq??u?.room?.gameState?.roundSeq;if(!d||!f||typeof h!="number")return;const m=zE(h,f);r(_=>_[m]?_:{..._,[m]:d}),delete i.current[m]},onCrapsRollResult:u=>{const d=u?.fairness,f=u?.fairness?.rollerId||u?.currentRollerId,h=d?.roundSeq;if(!d||!f||typeof h!="number")return;const m=zE(h,f);r(_=>_[m]?_:{..._,[m]:d}),delete i.current[m]},onFairnessReveal:u=>{typeof u?.roundSeq!="number"||!u.commit||!u.serverSeed||a(d=>{const f=d[u.roundSeq];if(!f||f.commit!==u.commit)for(const h of Object.keys(i.current))h.startsWith(`${u.roundSeq}:`)&&delete i.current[h];return{...d,[u.roundSeq]:{commit:u.commit,serverSeed:u.serverSeed}}})}});const o=v.useCallback(async(u,d,f)=>{const h=zE(d,u);if(i.current[h])return i.current[h];const m=e[h],_=n[d];if(!m||!_)return i.current[h]="unverifiable","unverifiable";const b=await O_e(_.serverSeed,m.commit)?"verified":"bad-commit";return i.current[h]=b,b},[e,n]),c=v.useMemo(()=>{const u=Object.keys(n).map(d=>Number(d)).filter(d=>!Number.isNaN(d));return u.length?Math.max(...u):void 0},[n]);return{proofs:e,reveals:n,verifyFor:o,lastRoundWithReveal:c}}let ia=null,w_=null,XC=null;async function Gg(){if(ia)return!0;try{const t=await qr(()=>import("./index-B4rpeWQB.js"),[],import.meta.url);return ia=t.AdMob,w_=t.RewardAdPluginEvents,XC=t.InterstitialAdPluginEvents,!0}catch{return!1}}let mp=!1;async function Mp(){if(mp)return!0;if(Gr.getPlatform()==="web"||!await Gg()||!ia)return!1;try{return await ia.initialize({requestTrackingAuthorization:!0,initializeForTesting:Wg??!1}),mp=!0,!0}catch{return!1}}const Wg=typeof process<"u"&&!1;function t6(){const t=Gr.getPlatform();return t==="ios"?AH:XD}function r6(){const t=Gr.getPlatform();return t==="ios"?jH:JD}async function N_e(){if(Gr.getPlatform()==="web"||!await Gg()||!ia)return!1;mp||await Mp();try{const r=t6();return await ia.prepareRewardVideoAd({adId:r,isTesting:Wg??!1}),!0}catch{return!1}}async function I_e(){return Gr.getPlatform()==="web"?{ok:!1,error:"NOT_NATIVE"}:!await Gg()||!ia?{ok:!1,error:"PLUGIN_NOT_AVAILABLE"}:!mp&&!await Mp()?{ok:!1,error:"INIT_FAILED"}:new Promise(async r=>{let n=!1,a,i;const o=ia.addListener(w_.Rewarded,f=>{n=!0,a=f?.type||"chips",i=f?.amount||hf}),c=ia.addListener(w_.Dismissed,()=>{d(),r(n?{ok:!0,rewardType:a,rewardAmount:i}:{ok:!1,error:"AD_DISMISSED"})}),u=ia.addListener(w_.FailedToShow,f=>{d(),r({ok:!1,error:"FAILED_TO_SHOW"})}),d=()=>{try{o?.remove?.()}catch{}try{c?.remove?.()}catch{}try{u?.remove?.()}catch{}};try{const f=t6();await ia.prepareRewardVideoAd({adId:f,isTesting:Wg??!1}),await ia.showRewardVideoAd()}catch(f){d(),r({ok:!1,error:f?.message||"UNKNOWN_ERROR"})}})}async function Nf(){if(Gr.getPlatform()==="web"||!await Gg()||!ia)return!1;mp||await Mp();try{const r=r6();return await ia.prepareInterstitial({adId:r,isTesting:Wg??!1}),!0}catch{return!1}}async function S_(){return Gr.getPlatform()==="web"?{ok:!1,error:"NOT_NATIVE"}:!await Gg()||!ia?{ok:!1,error:"PLUGIN_NOT_AVAILABLE"}:!mp&&!await Mp()?{ok:!1,error:"INIT_FAILED"}:new Promise(async r=>{const n=ia.addListener(XC.Dismissed,()=>{i(),r({ok:!0}),Nf().catch(()=>{})}),a=ia.addListener(XC.FailedToShow,o=>{i(),r({ok:!1,error:"FAILED_TO_SHOW"})}),i=()=>{try{n?.remove?.()}catch{}try{a?.remove?.()}catch{}};try{const o=r6();await ia.prepareInterstitial({adId:o,isTesting:Wg??!1}),await ia.showInterstitial()}catch(o){i(),r({ok:!1,error:o?.message||"UNKNOWN_ERROR"})}})}function n6(){const t=Gr.getPlatform();return t==="ios"||t==="android"}const $E={initializeAdMob:Mp,prepareRewardedAd:N_e,showRewardedAd:I_e,prepareInterstitialAd:Nf,showInterstitialAd:S_,isNativeAdSupported:n6},yL=w3,vL=S3,_L=E3,VE="ad:complete",a6=v.createContext({onHandEnd:async()=>{},onCrapsShooterTurnEnd:async()=>{},showAdNow:async()=>{},isAdEnabled:!1,isAdShowing:!1,adConfig:{handsPerAd:S3,crapsShooterTurnsPerAd:E3,minIntervalMs:zh,displayDelayMs:$h}}),S0=()=>v.useContext(a6);function M_e({children:t}){const[e,r]=v.useState(!1),[n,a]=v.useState(!1),i=n6(),o=!e&&i,c=v.useRef(!1),u=v.useRef(0),d=v.useRef(0),f=v.useRef(0);v.useEffect(()=>{const b=async()=>{try{const T=Ni();if(!T)return;const P=(await T.getCustomerInfo?.())?.entitlements?.active||{},A=Object.keys(P).length>0;let C=!1;yL&&(C=!!P?.[yL]||A),r(C)}catch{}};b();const E=setInterval(b,6e4);return()=>clearInterval(E)},[]),v.useEffect(()=>{o&&Nf().catch(()=>{})},[o]);const h=v.useCallback(async()=>{if(!o||c.current)return;const b=Date.now();if(!(b-f.current<zh)&&(u.current+=1,!(u.current<vL))){c.current=!0,u.current=0,f.current=b;try{window.__adShowingDoNotDisconnect=!0,window.__adShowingPauseGame=!0}catch{}a(!0),await new Promise(E=>setTimeout(E,$h));try{await S_()}catch{}finally{c.current=!1,a(!1);try{window.__adShowingDoNotDisconnect=!1,window.__adShowingPauseGame=!1}catch{}try{window.dispatchEvent(new CustomEvent(VE))}catch{}Nf().catch(()=>{})}}},[o]),m=v.useCallback(async()=>{if(!o||c.current)return;const b=Date.now();if(!(b-f.current<zh)&&(d.current+=1,!(d.current<_L))){c.current=!0,d.current=0,f.current=b;try{window.__adShowingDoNotDisconnect=!0,window.__adShowingPauseGame=!0}catch{}a(!0),await new Promise(E=>setTimeout(E,$h));try{await S_()}catch{}finally{c.current=!1,a(!1);try{window.__adShowingDoNotDisconnect=!1,window.__adShowingPauseGame=!1}catch{}try{window.dispatchEvent(new CustomEvent(VE))}catch{}Nf().catch(()=>{})}}},[o]),_=v.useCallback(async()=>{if(!o||c.current)return;const b=Date.now();if(!(b-f.current<zh)){c.current=!0,u.current=0,d.current=0,f.current=b;try{window.__adShowingDoNotDisconnect=!0,window.__adShowingPauseGame=!0}catch{}a(!0),await new Promise(E=>setTimeout(E,$h));try{await S_()}catch{}finally{c.current=!1,a(!1);try{window.__adShowingDoNotDisconnect=!1,window.__adShowingPauseGame=!1}catch{}try{window.dispatchEvent(new CustomEvent(VE))}catch{}Nf().catch(()=>{})}}},[o]),w={handsPerAd:vL,crapsShooterTurnsPerAd:_L,minIntervalMs:zh,displayDelayMs:$h};return g.jsx(a6.Provider,{value:{onHandEnd:h,onCrapsShooterTurnEnd:m,showAdNow:_,isAdEnabled:o,isAdShowing:n,adConfig:w},children:t})}const i6=ci();async function j_e(t){if(!t)return null;try{const e=await oi(),r=`${i6}/api/rooms/${encodeURIComponent(t)}/craps-history?playerScope=me&limit=200`,a=await(await fetch(r,{credentials:"include",cache:"no-store",headers:e?{Authorization:`Bearer ${e}`}:void 0})).json();return a&&a.ok&&a.data&&Array.isArray(a.data.items)?a.data.items:null}catch{return null}}async function L_e(t){if(!t)return null;try{const e=await oi(),n=await(await fetch(`${i6}/api/rooms/${encodeURIComponent(t)}/settlements?playerScope=me&limit=500`,{credentials:"include",cache:"no-store",headers:e?{Authorization:`Bearer ${e}`}:void 0})).json();return n&&n.ok&&n.data&&Array.isArray(n.data.items)?n.data.items:null}catch{return null}}const s6=""+new URL("avatars-BLAbFok_.webp",import.meta.url).href,o6=""+new URL("avatars2-BhCQ9Hmk.webp",import.meta.url).href,c6=""+new URL("bikini_avatars-D9_A_byG.webp",import.meta.url).href,l6=""+new URL("bikini_avatars2-CqEDCn9Y.webp",import.meta.url).href,u6=""+new URL("car_avatars-C2asmsaV.webp",import.meta.url).href,d6=""+new URL("cowboy_avatars-Dh4o-H8O.webp",import.meta.url).href,f6=""+new URL("surf_avatars-BNzNQWcq.webp",import.meta.url).href,p6=""+new URL("surf_avatars2-CP3KwVoE.webp",import.meta.url).href,h6=""+new URL("toy_avatars-CYoTJdP7.webp",import.meta.url).href,m6=[s6,o6,c6,l6,u6,d6,f6,p6,h6];function B_e(t){let e=0;for(let r=0;r<t.length;r++)e=e*31+t.charCodeAt(r)>>>0;return e%(m6.length*6)}function bL({seed:t}){const e=B_e(t),r=Math.floor(e/6),n=e%6,a=m6[r],i=2,o=3,c=n%i,u=Math.floor(n/i),d={display:"block",width:"100%",height:"100%",borderRadius:"50%",backgroundImage:`url(${a})`,backgroundSize:`${i*100}% ${o*100}%`,backgroundPosition:`${c*(100/(i-1))}% ${u*(100/(o-1))}%`,backgroundRepeat:"no-repeat"};return g.jsx("span",{className:"avatar-sprite",style:d,"aria-hidden":!0})}function U_e({stream:t,labelFallback:e,muted:r=!0,forceHideVideo:n=!1,active:a=!1,avatarUrl:i}){const o=v.useRef(null),[c]=v.useState(!1),[u,d]=v.useState(!1),f=v.useCallback(()=>t?t.getVideoTracks().some(m=>m.readyState==="live"&&m.enabled!==!1&&!m.muted):!1,[t]);v.useEffect(()=>{if(!t){d(!1);return}const m=()=>d(f());m();const _=t.getVideoTracks();for(const b of _)b.addEventListener("mute",m),b.addEventListener("unmute",m),b.addEventListener("ended",m);const w=()=>{m();const b=t.getVideoTracks();for(const E of b)E.addEventListener("mute",m),E.addEventListener("unmute",m),E.addEventListener("ended",m)};return t.addEventListener("addtrack",w),t.addEventListener("removetrack",w),()=>{for(const b of _)b.removeEventListener("mute",m),b.removeEventListener("unmute",m),b.removeEventListener("ended",m);t.removeEventListener("addtrack",w),t.removeEventListener("removetrack",w)}},[t,f]),v.useEffect(()=>{const m=o.current;if(!m||!t)return;const _=()=>{f()&&d(!0)},w=setInterval(()=>{m.readyState>=2&&f()&&!u&&d(!0),!f()&&u&&d(!1)},1e3);return m.addEventListener("canplay",_),m.addEventListener("playing",_),()=>{clearInterval(w),m.removeEventListener("canplay",_),m.removeEventListener("playing",_)}},[t,f,u]),v.useEffect(()=>{const m=o.current;if(!m)return;let _=0;const w=4,b=P=>{if(!t||!t.getVideoTracks().some(O=>O.readyState==="live"&&O.enabled!==!1)||!m.paused&&m.readyState>=2)return;m.play()?.catch(()=>{if(_<w){const O=150+_*200;_++,setTimeout(()=>b(`${P}:retry${_}`),O)}else try{window.dispatchEvent(new CustomEvent("rtc:videoStall",{detail:{reason:P}}))}catch{}})},E=()=>b("ui"),T=()=>{document.hidden||b("visibility")},D=()=>{if(!t||!m)return;const P=t.getVideoTracks()[0];P&&P.readyState==="live"&&m.paused&&b("pause-event")};return window.addEventListener("ui:roll",E),window.addEventListener("ui:placeMainBet",E),window.addEventListener("ui:cancelMainBet",E),document.addEventListener("visibilitychange",T),m.addEventListener("pause",D),()=>{window.removeEventListener("ui:roll",E),window.removeEventListener("ui:placeMainBet",E),window.removeEventListener("ui:cancelMainBet",E),document.removeEventListener("visibilitychange",T),m.removeEventListener("pause",D)}},[t]),v.useLayoutEffect(()=>{const m=o.current;if(m){try{m.setAttribute("playsinline","true"),m.setAttribute("webkit-playsinline","true"),m.setAttribute("muted",r?"true":"false"),m.disablePictureInPicture=!0}catch{}if(m.srcObject!==t&&(m.srcObject=t??null),t){m.muted=!!r;const _=()=>{m.play().catch(()=>{setTimeout(()=>{m.play().catch(()=>{})},160)})};_(),m.onloadedmetadata=_}else m.onloadedmetadata=null}},[t,r]);const h=!n&&!!t&&u;return n||!t?g.jsx("div",{className:`avatar-shell is-avatar ${a?"is-rolling":""}`,children:i?g.jsx("img",{src:i,alt:e,className:"avatar-uploaded",style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"50%"}}):g.jsx(bL,{seed:e})}):g.jsxs("div",{className:`avatar-shell ${c?"is-talking":""}${a?" is-rolling":""}`,style:{position:"relative",overflow:"hidden"},children:[g.jsx("div",{className:`avatar-image ${a?"is-rolling":""}`,style:{position:"absolute",inset:0,opacity:h?0:1,transition:"opacity 160ms ease",display:"flex",alignItems:"center",justifyContent:"center",background:"radial-gradient(circle at 30% 35%, #2e2e2e, #141414)"},children:i?g.jsx("img",{src:i,alt:e,className:"avatar-uploaded",style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"50%"}}):g.jsx(bL,{seed:e})}),g.jsx("video",{ref:o,playsInline:!0,autoPlay:!0,muted:r,className:"avatar-video",style:{width:"100%",height:"100%",objectFit:"cover",background:"#000",position:"relative",opacity:h?1:0,transition:"opacity 160ms ease"}})]})}function F_e(t,e){return!(t.forceHideVideo!==e.forceHideVideo||t.muted!==e.muted||t.stream!==e.stream||t.avatarUrl!==e.avatarUrl||!e.stream&&(t.labelFallback!==e.labelFallback||t.active!==e.active))}const q_e=v.memo(U_e,F_e),g6=v.createContext(void 0),z_e=({children:t})=>{const{user:e}=$r(),[r,n]=v.useState([]),[a,i]=v.useState([]),[o,c]=v.useState([]),{blockUser:u,unblockUser:d,getFriendsList:f,sendFriendRequest:h,unfriend:m,respondFriendRequest:_}=pa();Pa({onFriendRequestReceived:x=>{x?.request&&i(R=>[...R.filter(N=>N.id!==x.request.id),x.request])},onFriendRequestCancelled:x=>{x?.requestId&&i(R=>R.filter(N=>N.id!==x.requestId))},onFriendRequestResponded:x=>{x?.requestId&&x?.action&&i(R=>R.map(N=>N.id===x.requestId?{...N,status:x.action==="ACCEPT"?"ACCEPTED":"DECLINED"}:N))},onUnfriended:x=>{x?.byUserId&&n(R=>R.filter(N=>N.id!==x.byUserId))},onUserBlocked:x=>{x?.byUserId&&c(R=>R.find(N=>N.id===x.byUserId)?R:[...R,{id:x.byUserId}])},onUserUnblocked:x=>{x?.byUserId&&c(R=>R.filter(N=>N.id!==x.byUserId))}});const w=v.useCallback(async()=>{try{const x=await f();x?.ok&&(Array.isArray(x.friendsProfiles)&&n(x.friendsProfiles),Array.isArray(x.friendRequests)&&i(x.friendRequests),Array.isArray(x.blockedProfiles)&&c(x.blockedProfiles))}catch{}},[f]);v.useEffect(()=>{w()},[]);const b=v.useCallback(x=>{if(!e?.id||a.some(j=>j.status==="PENDING"&&j.fromUserId===e.id&&j.toUserId===x))return;const N=`temp:${Date.now()}:${x}`,L={id:N,fromUserId:e.id,toUserId:x,message:void 0,status:"PENDING",createdAt:new Date().toISOString(),respondedAt:void 0,fromUser:{id:e.id,name:e.name??null,avatarUrl:e.avatarUrl??null},toUser:o.find(j=>j.id===x)??r.find(j=>j.id===x)??{id:x,name:null,avatarUrl:null}};i(j=>[...j,L]),h(x).then(j=>{j?.ok?j.request?i(q=>[...q.filter(U=>!(U.id===N||U.fromUserId===e.id&&U.toUserId===x&&U.id.startsWith("temp:"))),j.request]):w():i(q=>q.filter(U=>U.id!==N))}).catch(()=>{i(j=>j.filter(q=>q.id!==N))})},[h,w,e?.id,e?.name,o,r,a]),E=v.useCallback(x=>{m(x).then(R=>{R?.ok&&n(N=>N.filter(L=>L.id!==x))}).catch(()=>{})},[m]),T=v.useCallback(x=>{i(R=>[...R.filter(N=>N.id!==x.id),x])},[]),D=v.useCallback(x=>{i(R=>R.map(N=>N.id===x.id?x:N))},[]),P=v.useCallback(x=>{i(R=>R.filter(N=>N.id!==x))},[]),A=v.useCallback(async(x,R)=>{try{(await _(x,R))?.ok&&await w()}catch{}},[_,w]),C=v.useCallback(async x=>{(await u(x)).ok&&c(N=>N.find(L=>L.id===x)?N:[...N,{id:x}])},[u]),O=v.useCallback(async x=>{(await d(x)).ok&&c(N=>N.filter(L=>L.id!==x))},[d]),I=v.useCallback(x=>!!o.find(R=>R.id===x),[o]);return g.jsx(g6.Provider,{value:{friends:r,friendRequests:a,blockedUsers:o,addFriend:b,removeFriend:E,addFriendRequest:T,updateFriendRequest:D,removeFriendRequest:P,respondToFriendRequest:A,blockUser:C,unblockUser:O,isBlocked:I,refreshSocial:w},children:t})};function FA(){const t=v.useContext(g6);if(!t)throw new Error("useSocial must be used within a SocialProvider");return t}function y6(t){const{anchorRect:e,anchorEl:r,onClose:n,onMessages:a,onSendMoney:i,onAddFriend:o,onUnfriend:c,onBlockUser:u,isFriend:d,isBlocked:f,hideAddFriend:h}=t,[m,_]=v.useState({top:0,left:0}),[w,b]=v.useState(!1),E=v.useRef(null),T=v.useRef(Date.now());if(v.useLayoutEffect(()=>{if(!e)return;_({top:e.bottom+8,left:e.left}),T.current=Date.now(),b(!0)},[e]),v.useLayoutEffect(()=>{if(!e||!E.current)return;const A=E.current.getBoundingClientRect(),C=window.innerWidth,O=window.innerHeight,I=8,x=window.visualViewport,R=x?x.offsetTop:0,N=parseInt(getComputedStyle(document.documentElement).getPropertyValue("padding-top"))||0;let L=e.bottom+I,j=e.left;j+A.width>C-I&&(j=Math.max(I,C-A.width-I)),L+A.height>O-I&&(L=Math.max(I+N+R,e.top-A.height-I)),L<I+N+R&&(L=I+N+R),j<I&&(j=I),_({top:L,left:j})},[e,w]),v.useEffect(()=>{const P=x=>{if(Date.now()-T.current<120)return;const R=x.target;r&&(r===R||r.contains(R))||E.current&&(E.current.contains(R)||n())},A=x=>{x.key==="Escape"&&n()};let C=null;const O=()=>{Date.now()-T.current<120||(C&&window.clearTimeout(C),C=window.setTimeout(()=>n(),120))},I=O;return document.addEventListener("mousedown",P),window.addEventListener("keydown",A),window.addEventListener("scroll",O,{passive:!0,capture:!0}),window.addEventListener("resize",I),()=>{document.removeEventListener("mousedown",P),window.removeEventListener("keydown",A),window.removeEventListener("scroll",O,{capture:!0}),window.removeEventListener("resize",I),C&&window.clearTimeout(C)}},[n,r]),!e)return null;const D=g.jsxs("div",{className:"avatar-context-menu",style:{top:m.top,left:m.left},ref:E,role:"menu","aria-label":"Player actions",onMouseDown:P=>P.stopPropagation(),children:[a&&g.jsx("button",{role:"menuitem",onClick:()=>{a?.(),n()},className:"avatar-context-menu__item",children:"Messages"}),!d&&!h&&o&&g.jsx("button",{role:"menuitem",onClick:()=>{o(),n()},className:"avatar-context-menu__item",disabled:!!d||!!f||!o,title:d?"Already friends":f?"User is blocked":"Add Friend",children:d?"Friend ✓":"Add Friend"}),d&&c&&g.jsx("button",{role:"menuitem",onClick:()=>{c(),n()},className:"avatar-context-menu__item",children:"Unfriend"}),g.jsx("button",{role:"menuitem",onClick:()=>{u?.(),n()},className:"avatar-context-menu__item",disabled:!u,title:f?"Unblock user":"Block user",children:f?"Unblock":"Block"})]});return typeof document<"u"?Wc.createPortal(D,document.body):D}function v6({targetId:t,anchorRect:e,anchorEl:r,onClose:n,onOpenDM:a,onOpenSendMoney:i,meId:o}){const{friends:c,friendRequests:u,isBlocked:d,blockUser:f,unblockUser:h,addFriend:m,removeFriend:_}=FA(),w=u.some(b=>b.status==="PENDING"&&b.fromUserId===o&&b.toUserId===t);return g.jsx(y6,{anchorRect:e,anchorEl:r,onClose:n,onMessages:a?()=>{a(t),n()}:void 0,onSendMoney:()=>{i?.(t),n()},hideAddFriend:w,onAddFriend:()=>{!c.find(b=>b.id===t)&&!d(t)&&m(t)},onUnfriend:()=>{c.find(b=>b.id===t)&&_(t)},onBlockUser:async()=>{d(t)?await h(t):await f(t)},isFriend:!!c.find(b=>b.id===t),isBlocked:d(t)})}const $_e=v.forwardRef(function({id:e,display:r,isCurrentRoller:n,isMe:a,balance:i,isSpectating:o=!1,folded:c=!1,tags:u,stream:d,diceResult:f,onOpenMenu:h,showMenu:m,menuProps:_,forceHideVideo:w,actDeadlineTs:b,avatarUrl:E,showActingTimerRing:T=!0,presenceStatus:D},P){const A=Sye(r);return g.jsxs(Ys.li,{layout:!0,layoutDependency:e,transition:{type:"spring",stiffness:420,damping:38,mass:.6},ref:P,className:["player","player--avatar",n?"is-rolling":"",a?"is-me":"",c?"player--folded":""].join(" "),"data-player-id":e,title:`${r}${u.length?" · "+u.join(" · "):""}`,"aria-label":`${r}${u.length?", "+u.join(", "):""}`,children:[g.jsxs("div",{className:["avatar-ring",n?"is-rolling":""].join(" "),onClick:C=>{C.stopPropagation(),h(e,C.currentTarget)},onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),h(e,C.currentTarget))},role:"button",tabIndex:0,"aria-haspopup":"menu","aria-expanded":m,children:[g.jsx(q_e,{active:n,stream:d,labelFallback:A,muted:a,forceHideVideo:w,avatarUrl:E}),typeof i=="number"&&g.jsx("div",{className:"avatar-balance-pill","aria-label":`Balance ${mb(i)}`,children:mb(i)})]}),a&&g.jsx("span",{className:"status-dot","aria-hidden":!0}),!a&&D&&g.jsx("span",{className:`presence-dot presence-dot--${D}`,"aria-label":D==="active"?"Online":"Away"}),g.jsxs("div",{className:"player-mini",children:[g.jsxs("div",{className:"player-name",children:[r,u.includes("D")&&g.jsx("span",{className:"player-tag tag--D","aria-label":"Dealer",children:"D"}),u.includes("SB")&&g.jsx("span",{className:"player-tag tag--SB","aria-label":"Small blind",children:"SB"}),u.includes("BB")&&g.jsx("span",{className:"player-tag tag--BB","aria-label":"Big blind",children:"BB"})]}),o&&g.jsx("div",{className:"player-spectating","aria-label":"spectating",children:"spectating"}),g.jsx("div",{className:"player-faces",children:f??g.jsx("span",{style:{display:"inline-block",height:22},"aria-hidden":!0})})]}),m&&_&&g.jsx(v6,{..._})]})}),_6=[s6,o6,c6,l6,u6,d6,f6,p6,h6];function V_e(t){let e=0;for(let r=0;r<t.length;r++)e=e*31+t.charCodeAt(r)>>>0;return e%(_6.length*6)}function H_e({seed:t}){const e=V_e(t),r=Math.floor(e/6),n=e%6,a=_6[r],i=2,o=3,c=n%i,u=Math.floor(n/i),d={display:"block",width:"100%",height:"100%",borderRadius:"50%",backgroundImage:`url(${a})`,backgroundSize:`${i*100}% ${o*100}%`,backgroundPosition:`${c*(100/(i-1))}% ${u*(100/(o-1))}%`,backgroundRepeat:"no-repeat"};return g.jsx("span",{className:"avatar-sprite",style:d,"aria-hidden":!0})}function E_({players:t,meId:e,className:r,showBalance:n=!1,onPlayerClick:a,renderActions:i}){return g.jsx("div",{className:["card",r].filter(Boolean).join(" "),children:g.jsx("ul",{className:"players players--avatars",role:"list",children:t.map((o,c)=>{const u=o.id??String(c),d=o.name??u;return g.jsxs("li",{className:["player","player--avatar",u===e?"is-me":""].join(" "),"data-player-id":u,title:d,"aria-label":d,onClick:()=>a?.(u),role:a?"button":void 0,tabIndex:a?0:-1,onKeyDown:f=>{a&&(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),a(u))},children:[g.jsx("div",{className:"avatar-ring","aria-hidden":!0,children:g.jsx("div",{className:"video-bubble",children:g.jsx(H_e,{seed:o.id})})}),u===e&&g.jsx("span",{className:"status-dot","aria-hidden":!0}),g.jsxs("div",{children:[g.jsx("div",{className:"player-name",children:d}),n&&g.jsx("div",{className:"player-bank",children:g.jsxs("b",{children:["$",o.balance??0]})})]}),i?.(o)]},u)})})})}function qA(){const[t,e]=v.useState(null),[r,n]=v.useState(null),[a,i]=v.useState(null);return{forUserId:t,anchorRect:r,anchorEl:a,openFor:(u,d)=>{d&&(e(u),i(d),n(d.getBoundingClientRect()))},close:()=>{e(null),n(null),i(null)}}}function b6({players:t,meId:e,className:r,onOpenDM:n,onOpenSendMoney:a,renderActionsOverride:i}){const{forUserId:o,anchorRect:c,anchorEl:u,openFor:d,close:f}=qA(),h=(_,w)=>{!w||_===e||d(_,w)},m=()=>f();return g.jsxs("div",{className:r,children:[g.jsx(E_,{className:"card",players:t,meId:e,showBalance:!1,renderActions:i?_=>i(_):_=>g.jsx("button",{className:"btn btn-xs",onClick:w=>h(_.id,w.currentTarget),"aria-haspopup":"menu","aria-expanded":o===_.id,style:{marginLeft:"auto"},children:"⋯"})}),!i&&o&&g.jsx(v6,{targetId:o,anchorRect:c,anchorEl:u,onClose:m,onOpenDM:n,onOpenSendMoney:a,meId:e})]})}function G_e(t,e,r,n){const a=v.useRef(new Map),i=v.useRef(new Map),[o,c]=v.useState(0),u=v.useRef(n),d=v.useRef(0),f=v.useCallback(h=>{a.current.get(h)||(a.current.set(h,!0),i.current.set(h,performance.now()),c(m=>m+1))},[]);return v.useEffect(()=>{u.current!==n&&(a.current.clear(),i.current.clear(),d.current=0,c(h=>h+1),u.current=n)},[n]),v.useEffect(()=>{for(let h=d.current;h<t.length;h++){const m=t[h],_=m.result;Sm(_,m.playerId===e)!=="nothing"&&f(m.playerId)}d.current=t.length},[t,f,e]),v.useEffect(()=>{if(!e||!r.bankRoll?.raw)return;Sm(r.bankRoll.raw)!=="nothing"&&f(e)},[e,r.bankRoll,f]),{revealedPlayers:a.current,revealTimesRef:i,revealVersion:o,markRevealed:f}}function W_e(t){if(!t)return"Side Bet";switch(t.toLowerCase()){case"subject_beats_banker":case"beatsbank":return"Beats Banker";case"subject_loses_to_banker":case"losestobank":return"Loses to Banker";case"subject_push":case"tiesbank":return"Ties Banker";default:return t}}function K_e(t){if(!t)return"side bet";switch(t.toLowerCase()){case"subject_beats_banker":case"beatsbank":return"beats banker";case"subject_loses_to_banker":case"losestobank":return"loses to banker";case"subject_push":case"tiesbank":return"ties banker";default:return t}}function zA(t,e){if(!t)return{outcome:null,isChallenger:!1,needsAnimation:!1};const r=t.type==="MAIN"||t.type==="SIDE"?t.type:t.predicate||t.subjectId?"SIDE":"MAIN";let n=null,a=!1,i=!1,o,c=typeof t.result=="string"?t.result.toUpperCase():"",u=!1;if(!c||!["WIN","LOSE","PUSH","TIE"].includes(c)){const h=md(t,e);h&&h.myResult&&(c=h.myResult.toUpperCase(),u=!0)}const d=c==="WIN"||c==="LOSE",f=c==="PUSH"||c==="TIE";if(!d&&!f)return{outcome:null,isChallenger:!1,needsAnimation:!1};if(u)return d?n=c==="WIN"?"win":"lose":n="push",i=d,{outcome:n,isChallenger:a,subtitle:o,needsAnimation:i};if(r==="MAIN"){const h=t.acceptedById||t.bankerId,m=t.playerId;if(!h||!m)return{outcome:null,isChallenger:!1,needsAnimation:!1};d?(e===m?(n=c==="WIN"?"win":"lose",a=!0):e===h?n=c==="WIN"?"lose":"win":n=null,i=!0):f&&((e===m||e===h)&&(n="push"),i=!0)}else{const h=t.playerId,m=t.acceptedById||void 0;if(d?(e===h?(n=c==="WIN"?"win":"lose",a=!0):e===m?n=c==="WIN"?"lose":"win":n=null,i=!!(h&&m)):f&&((e===h||e===m)&&(n="push"),i=!1),t.predicate||t.subjectId){const _=[];t.predicate&&_.push(W_e(t.predicate)),t.subjectId&&_.push(`on ${t.subjectId}`),_.length&&(o=_.join(" "))}}return{outcome:n,isChallenger:a,subtitle:o,needsAnimation:i}}function Y_e(t,e){const r=t.acceptedById||t.bankerId,n=t.playerId;if(!r||!n)return null;let a,i;const o=String(t.result||"").toUpperCase();if(o==="WIN")a=r,i=n;else if(o==="LOSE")a=n,i=r;else return null;if(!a||!i||a===i)return null;const c=e(a),u=e(i);if(!c||!u||Math.hypot(u.x-c.x,u.y-c.y)<4)return null;const f=Number(t.amount)||1;return{id:`${a}-${i}-${t.id}-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,settlementId:String(t.id),amount:f,fromId:a,toId:i,startX:c.x,startY:c.y,endX:u.x,endY:u.y}}function k6(t,e,r,n){if(!Array.isArray(t)||t.length===0)return[];const a=[];for(const i of t){if(!i)continue;const o=i.type?i.type:i.predicate||i.subjectId?"SIDE":"MAIN",c={...i,type:o};c.type==="MAIN"&&!c.acceptedById&&!c.bankerId&&n&&(c.bankerId=n||void 0),!(typeof c.roundSeq!="number"||c.roundSeq!==e)&&(r.has(c.id)||(r.add(c.id),a.push(c)))}return a}const X_e="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20512%20512'%20style='height:%20512px;%20width:%20512px;'%3e%3cg%20class=''%20transform='translate(0,0)'%20style=''%3e%3cpath%20d='M74.5%2036A38.5%2038.5%200%200%200%2036%2074.5v363A38.5%2038.5%200%200%200%2074.5%20476h363a38.5%2038.5%200%200%200%2038.5-38.5v-363A38.5%2038.5%200%200%200%20437.5%2036h-363zM256%20206a50%2050%200%200%201%200%20100%2050%2050%200%200%201%200-100z'%20fill='%23fff'%20fill-opacity='1'%3e%3c/path%3e%3c/g%3e%3c/svg%3e",J_e="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20512%20512'%20style='height:%20512px;%20width:%20512px;'%3e%3cg%20class=''%20transform='translate(0,0)'%20style=''%3e%3cpath%20d='M74.5%2036A38.5%2038.5%200%200%200%2036%2074.5v363A38.5%2038.5%200%200%200%2074.5%20476h363a38.5%2038.5%200%200%200%2038.5-38.5v-363A38.5%2038.5%200%200%200%20437.5%2036h-363zm316.97%2036.03A50%2050%200%200%201%20440%20122a50%2050%200%200%201-100%200%2050%2050%200%200%201%2051.47-49.97zm-268%20268A50%2050%200%200%201%20172%20390a50%2050%200%200%201-100%200%2050%2050%200%200%201%2051.47-49.97z'%20fill='%23fff'%20fill-opacity='1'%3e%3c/path%3e%3c/g%3e%3c/svg%3e",Q_e="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20512%20512'%20style='height:%20512px;%20width:%20512px;'%3e%3cg%20class=''%20transform='translate(0,0)'%20style=''%3e%3cpath%20d='M74.5%2036A38.5%2038.5%200%200%200%2036%2074.5v363A38.5%2038.5%200%200%200%2074.5%20476h363a38.5%2038.5%200%200%200%2038.5-38.5v-363A38.5%2038.5%200%200%200%20437.5%2036h-363zm316.97%2036.03A50%2050%200%200%201%20440%20122a50%2050%200%200%201-100%200%2050%2050%200%200%201%2051.47-49.97zM256%20206a50%2050%200%200%201%200%20100%2050%2050%200%200%201%200-100zM123.47%20340.03A50%2050%200%200%201%20172%20390a50%2050%200%200%201-100%200%2050%2050%200%200%201%2051.47-49.97z'%20fill='%23fff'%20fill-opacity='1'%3e%3c/path%3e%3c/g%3e%3c/svg%3e",Z_e="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20512%20512'%20style='height:%20512px;%20width:%20512px;'%3e%3cg%20class=''%20transform='translate(0,0)'%20style=''%3e%3cpath%20d='M74.5%2036A38.5%2038.5%200%200%200%2036%2074.5v363A38.5%2038.5%200%200%200%2074.5%20476h363a38.5%2038.5%200%200%200%2038.5-38.5v-363A38.5%2038.5%200%200%200%20437.5%2036h-363zm48.97%2036.03A50%2050%200%200%201%20172%20122a50%2050%200%200%201-100%200%2050%2050%200%200%201%2051.47-49.97zm268%200A50%2050%200%200%201%20440%20122a50%2050%200%200%201-100%200%2050%2050%200%200%201%2051.47-49.97zm-268%20268A50%2050%200%200%201%20172%20390a50%2050%200%200%201-100%200%2050%2050%200%200%201%2051.47-49.97zm268%200A50%2050%200%200%201%20440%20390a50%2050%200%200%201-100%200%2050%2050%200%200%201%2051.47-49.97z'%20fill='%23fff'%20fill-opacity='1'%3e%3c/path%3e%3c/g%3e%3c/svg%3e",ebe="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20512%20512'%20style='height:%20512px;%20width:%20512px;'%3e%3cg%20class=''%20transform='translate(0,0)'%20style=''%3e%3cpath%20d='M74.5%2036A38.5%2038.5%200%200%200%2036%2074.5v363A38.5%2038.5%200%200%200%2074.5%20476h363a38.5%2038.5%200%200%200%2038.5-38.5v-363A38.5%2038.5%200%200%200%20437.5%2036h-363zm48.97%2036.03A50%2050%200%200%201%20172%20122a50%2050%200%200%201-100%200%2050%2050%200%200%201%2051.47-49.97zm268%200A50%2050%200%200%201%20440%20122a50%2050%200%200%201-100%200%2050%2050%200%200%201%2051.47-49.97zM256%20206a50%2050%200%200%201%200%20100%2050%2050%200%200%201%200-100zM123.47%20340.03A50%2050%200%200%201%20172%20390a50%2050%200%200%201-100%200%2050%2050%200%200%201%2051.47-49.97zm268%200A50%2050%200%200%201%20440%20390a50%2050%200%200%201-100%200%2050%2050%200%200%201%2051.47-49.97z'%20fill='%23fff'%20fill-opacity='1'%3e%3c/path%3e%3c/g%3e%3c/svg%3e",tbe="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20512%20512'%20style='height:%20512px;%20width:%20512px;'%3e%3cg%20class=''%20transform='translate(0,0)'%20style=''%3e%3cpath%20d='M74.5%2036A38.5%2038.5%200%200%200%2036%2074.5v363A38.5%2038.5%200%200%200%2074.5%20476h363a38.5%2038.5%200%200%200%2038.5-38.5v-363A38.5%2038.5%200%200%200%20437.5%2036h-363zm48.97%2036.03A50%2050%200%200%201%20172%20122a50%2050%200%200%201-100%200%2050%2050%200%200%201%2051.47-49.97zm268%200A50%2050%200%200%201%20440%20122a50%2050%200%200%201-100%200%2050%2050%200%200%201%2051.47-49.97zM122%20206a50%2050%200%200%201%200%20100%2050%2050%200%200%201%200-100zm268%200a50%2050%200%200%201%200%20100%2050%2050%200%200%201%200-100zM123.47%20340.03A50%2050%200%200%201%20172%20390a50%2050%200%200%201-100%200%2050%2050%200%200%201%2051.47-49.97zm268%200A50%2050%200%200%201%20440%20390a50%2050%200%200%201-100%200%2050%2050%200%200%201%2051.47-49.97z'%20fill='%23fff'%20fill-opacity='1'%3e%3c/path%3e%3c/g%3e%3c/svg%3e",rbe={1:X_e,2:J_e,3:Q_e,4:Z_e,5:ebe,6:tbe};function nbe({dice:t}){return!t||!t.length?null:g.jsx("div",{className:"dice-results-icons",style:{display:"flex",gap:2},children:t.map((e,r)=>g.jsx("img",{src:rbe[e],alt:`Dice face ${e}`,style:{width:22,height:22,borderRadius:"4px"}},r))})}function $A(){const[t,e]=v.useState(!1),[r,n]=v.useState(!0);v.useEffect(()=>{let i=!0;return(async()=>{try{const o=await au();i&&(n(o.showAnimations!==!1),e(!0))}catch{i&&e(!0)}})(),()=>{i=!1}},[]);const a=v.useCallback(async i=>{const o=typeof i=="boolean"?i:!r;n(o);try{const c=await au(),u={...Dc,...c,showAnimations:o};await y0(u)}catch{}},[r]);return{ready:t,showAnimations:r,toggleAnimations:a}}function w6({anim:t,onComplete:e}){const{showAnimations:r}=$A(),n=r===!1,a=v.useRef(!1),i=v.useRef(t).current,{amount:o,startX:c,startY:u,endX:d,endY:f}=i,h=v.useRef([]);if(h.current.length===0){const _=LA(o),w=Math.max(0,i.startDelaySec??.25),b=Math.min(8,Math.ceil(_.length/2)),E=(_.length-1)/2;h.current=_.map((T,D)=>({id:`${t.id}-sub-${D}`,value:T,delay:w+D*.05,yOffset:(D-E)*(b>1?4:0)}))}const m=v.useCallback(()=>{a.current||(a.current=!0,e())},[e]);return v.useEffect(()=>{if(n)return Promise.resolve().then(()=>{try{m()}catch{}}),()=>{};const _=h.current.map(T=>T.delay),b=(_.length?Math.max(..._):0)*1e3+900,E=window.setTimeout(m,b);return()=>{window.clearTimeout(E)}},[n,m]),n?null:g.jsx("div",{style:{position:"fixed",inset:0,pointerEvents:"none",zIndex:5},children:(()=>{const _=h.current.map(w=>w.delay);return _.length&&Math.min(..._),h.current.map((w,b)=>{const E=c-18,T=d-18,D=u-18+w.yOffset,P=f-18+w.yOffset;return g.jsx(Ys.div,{initial:{x:E,y:D,scale:.85,opacity:0},animate:{x:T,y:P,scale:1.05+b%3*.03,opacity:1},transition:{delay:w.delay,type:"spring",stiffness:150,damping:20,duration:.55+b%4*.03},onAnimationComplete:()=>{b===h.current.length-1&&m()},style:{position:"absolute"},children:g.jsx(Bc,{mini:!0,value:w.value,className:"chip--flight"})},w.id)})})()})}const JC=new Set;function abe(t){return JC.add(t),()=>JC.delete(t)}function ibe(t){t&&JC.forEach(e=>{try{e(t)}catch{}})}function sbe({newSettlements:t,roundSeqNow:e,getAvatarCenter:r,getPlayerName:n,myId:a,bankerDice:i,bankerId:o,isPartyReady:c,onAnimCompleteBySettlement:u}){const[d,f]=v.useState([]),[h,m]=v.useState([]),_=v.useRef(new Set),w=v.useRef(new Set),b=v.useRef(null),E=v.useRef(new Set),T=v.useCallback(R=>(w.current.add(R),R),[]),D=v.useCallback(()=>{w.current.forEach(R=>clearTimeout(R)),w.current.clear(),b.current!=null&&(cancelAnimationFrame(b.current),b.current=null)},[]);v.useEffect(()=>()=>{D()},[D]);const P=v.useCallback(R=>r(R),[r]),A=v.useCallback(R=>Y_e(R,P),[P]),C=v.useCallback((R,N=0)=>{if(c&&R?.type==="MAIN"){const Q=R?.playerId,ie=R?.acceptedById||R?.bankerId;if(!(!!Q&&c(Q)&&!!ie&&c(ie))){T(setTimeout(()=>C(R,N),120));return}}const j=R?.acceptedById||R?.bankerId,q=R?.playerId;if(!j||!q){if(N>25)return;const Q=80+N*60;T(setTimeout(()=>C(R,N+1),Q));return}const U=String(R.result||"").toUpperCase();let W,F;if(U==="WIN"?(W=j,F=q):U==="LOSE"&&(W=q,F=j),W&&F){const Q=P(W),ie=P(F);if(!Q||!ie){if(N>25)return;if(N<5&&typeof requestAnimationFrame<"u")b.current=requestAnimationFrame(()=>C(R,N+1));else{const G=80+N*60;T(setTimeout(()=>C(R,N+1),G))}return}}if(N>25)return;const Y=A(R);if(!Y){const Q=80+N*60;N<5&&typeof requestAnimationFrame<"u"?b.current=requestAnimationFrame(()=>C(R,N+1)):T(setTimeout(()=>C(R,N+1),Q));return}f(Q=>[...Q,[Y]])},[A,c,T]);v.useEffect(()=>{if(!t.length)return;const R=k6(t,e,_.current,o);for(const N of R){if(E.current.has(N.id))continue;E.current.add(N.id);const{outcome:L,needsAnimation:j}=zA(N,a);j&&T(setTimeout(()=>C(N),200))}},[t,e,a,o,C]),v.useEffect(()=>{h.length===0&&d.length>0&&(m(d[0]),f(R=>R.slice(1)))},[h.length,d]);const O=v.useCallback(R=>{m(N=>{const L=N.filter(q=>q.id!==R),j=N.find(q=>q.id===R);try{j?.settlementId&&typeof u=="function"&&u(j.settlementId),j?.settlementId&&(ibe(j.settlementId),_.current.add(j.settlementId))}catch{}return L})},[u]),I=v.useCallback(()=>{D(),f([]),m([]),_.current.clear(),E.current.clear()},[D]),x=v.useCallback(R=>{R?.length&&f(N=>[...N,R])},[]);return{activeBatch:h,handleAnimItemComplete:O,resetForRound:I,queueBatch:x}}function obe(){const{hasActive:t}=Es(),e=v.useRef([]),r=v.useRef(!1),n=v.useRef(null),a=v.useRef(new Set),i=v.useCallback(()=>{ld("Light").catch(()=>{})},[]),o=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),c=sa?.diceToChipDelayMs+600,u=v.useCallback(()=>{if(r.current)return;r.current=!0;const m=()=>{n.current&&(window.clearTimeout(n.current),n.current=null);const _=e.current;if(!_.length){r.current=!1;return}const w=_[0],b=o();if(b<w.readyAt){n.current=window.setTimeout(m,Math.min(500,Math.max(20,w.readyAt-b)));return}if(w.revealGate){const T=w.revealGate,D=T.challengerId?T.getRevealTime(T.challengerId):void 0,P=T.bankerId?T.getRevealTime(T.bankerId):void 0;if(typeof D=="number"&&typeof P=="number"){const C=Math.max(D,P)+T.postRevealDelayMs;if(b<C){const O=Math.min(C-b,1e3);n.current=window.setTimeout(m,Math.max(50,O));return}}else if(b-w.enqueuedAt<c){n.current=window.setTimeout(m,120);return}}try{i()}catch{}try{w.run()}catch{}const E=_.shift();E?.key&&a.current.add(E.key),n.current=window.setTimeout(m,0)};m()},[i]),d=v.useCallback((m,_)=>{const w=Math.max(0,typeof _?.delayMs=="number"?_.delayMs:0),b=o(),E=b+(_?.immediate?0:w);if(_?.key){if(a.current.has(_.key))return;a.current.add(_.key)}e.current.push({run:m,readyAt:E,revealGate:_?.revealGate,key:_?.key,enqueuedAt:b}),u()},[u]),f=v.useCallback(()=>{n.current&&(window.clearTimeout(n.current),n.current=null),u()},[u]),h=v.useCallback(()=>{n.current&&(window.clearTimeout(n.current),n.current=null),e.current=[],r.current=!1},[]);return{schedule:d,nudge:f,clear:h,hasActive:t}}function cbe({newSettlements:t,roundSeqNow:e,myId:r,bankerDice:n,getPlayerName:a,getPlayerDice:i,getRevealTime:o,postRevealDelayMs:c=0,bankerId:u}){const{win:d,lose:f,push:h}=Es(),m=v.useRef(new Set),{schedule:_,nudge:w}=obe(),b=v.useRef(null),E=v.useRef(!1),T=v.useRef(!1);v.useRef(new Set);const D=v.useRef(null);v.useEffect(()=>{const C=n;if(!C||C.length!==3){b.current=null,E.current=!1;return}const O={};for(const R of C)O[R]=(O[R]||0)+1;const I=Object.keys(O).map(Number);I.length===2&&I.some(R=>O[R]===1)?b.current=I.find(R=>O[R]===1):b.current=null;try{const R=[...C].sort((N,L)=>N-L).join(",");E.current=R==="4,5,6",T.current=R==="1,2,3"}catch{E.current=!1,T.current=!1}},[n]);const P=v.useCallback((C,O,I,x,R)=>{const N=O?" Clutch":"";x?C==="win"?d(`${x}${N}`):C==="lose"?f(x):h(x):R?C==="win"?d("win",I):C==="lose"?f("lose",I):h("push",I):C==="win"?d(`You Won!${N}`,I):C==="lose"?f("You Lost!",I):h("Push!",I)},[d,f,h]),A=v.useCallback((C,O,I,x,R,N={})=>{const L=O&&(b.current??0)>5&&C==="win";_(()=>P(C,L,I,x,R),N)},[_,P]);v.useEffect(()=>{const C=k6(t,e,m.current,u);if(C.length)for(const O of C){const{outcome:I,isChallenger:x,subtitle:R,needsAnimation:N}=zA(O,r);if(!I)continue;let L=R,j=!1;if(O.type==="SIDE"){const te=O.subjectId&&a(O.subjectId)||O.subjectId||"Player",me=K_e(O.predicate);let ue;I==="win"?ue=`${te} ${me}`:I==="lose"?me==="beats banker"?ue=`${te} does not beat banker`:me==="loses to banker"?ue=`${te} does not lose to banker`:me==="ties banker"?ue=`${te} does not tie banker`:ue=`${te} ${me}`:ue=`${te} ${me}`,L=ue,j=!0}else R&&O.subjectId&&R.includes("on ")&&(L=R.replace(/on \S+$/,`on ${a(O.subjectId)||O.subjectId}`));try{const te=md(O,r);if(te&&te.label&&!(O.type==="SIDE"&&j)){const ue=String(te.label||"").trim(),Ae=String(L||"").trim();if(Ae.length===0)L=ue;else if(ue.length>0){const He=Ae.toLowerCase(),ce=ue.toLowerCase();He.includes(ce)||(L=`${Ae} — ${ue}`)}}}catch{}I==="push"&&((L||"").trim()||(L="No Action"));const q=O.type==="SIDE"?O.subjectId||void 0:O.playerId,U=O.type==="SIDE"?u:O.acceptedById||O.bankerId||u,W=!!(E.current||T.current),F=W||O.type==="SIDE"?!1:N,Y=W?!0:!F,Q=!W&&F?sa.diceToChipDelayMs+50:0,ie=q,G=U,B=o?sa.revealFlashPostDelayMs:0,K=o&&!W?{getRevealTime:o,challengerId:ie,bankerId:G,postRevealDelayMs:B}:void 0,ae=K?0:F?Q:0;O.type==="MAIN"?_(()=>{let me;try{const He=md(O,r);me=String(He?.label||"").trim()||void 0}catch{}let ue;try{if(i&&u){const He=i(u),ce=i(O.playerId);if(He&&ce){const xe=wb(He),re=wb(ce);xe.kind==="456"?ue="Banker rolled 4-5-6":xe.kind==="123"?ue="Banker rolled 1-2-3":re.kind==="456"?ue="Challenger rolled 4-5-6":re.kind==="123"?ue="Challenger rolled 1-2-3":xe.kind==="triple"&&re.kind==="point"?ue="Trips beat point":xe.kind==="point"&&re.kind==="triple"?ue="Point loses to trips":xe.kind==="triple"&&re.kind==="triple"?ue=xe.score===re.score?"Equal trips (push)":"Higher trips win":typeof xe.point=="number"&&typeof re.point=="number"&&(xe.point===re.point?ue="Same point (push)":ue=`${Math.max(xe.point,re.point)} beats ${Math.min(xe.point,re.point)}!`),ue||(I==="win"?ue=x?re.label||"Win":xe.label||"Win":I==="lose"?ue=x?xe.label||"Loss":re.label||"Loss":ue=void 0)}}}catch{}let Ae;I==="push"?Ae=ue||me||"No Action":me&&ue?Ae=`${me} ${ue}`:Ae=me||ue,P(I,x,Ae,void 0,j)},{immediate:W?!0:Y&&!K,delayMs:ae,revealGate:K,key:String(O.id)}):A(I,x,L,void 0,j,{immediate:W?!0:Y&&!K,delayMs:ae,revealGate:K,key:String(O.id)})}},[t,e,r,a,A,u]),v.useEffect(()=>{if(!(E.current||T.current)||D.current===e||Array.isArray(t)&&t.some(L=>L?.roundSeq===e))return;const I=E.current,x=I?"Banker 4‑5‑6":"Banker 1‑2‑3",R=u&&r&&u===r,N=I?R?"win":"lose":R?"lose":"win";_(()=>P(N,!1,void 0,x,!0),{immediate:!0,key:`auto-${e}`}),D.current=e},[t,e,r,u,_,P]),v.useEffect(()=>{const C=abe(O=>{try{w()}catch{}});return()=>{try{C()}catch{}}},[w])}function S6({open:t,onClose:e,message:r}){if(!t)return null;const n=tn(),a=r||"You must be logged in.",i=v.useCallback(()=>{n("/login")},[n]),o=g.jsxs("div",{className:"results-modal",role:"dialog","aria-modal":"true","aria-label":"Login required",children:[g.jsx("div",{className:"results-modal__backdrop",onClick:e}),g.jsxs("div",{className:"results-modal__card card",onClick:c=>c.stopPropagation(),children:[g.jsxs("div",{className:"results-modal__header",children:[g.jsx("h3",{children:"Login required"}),g.jsx("button",{type:"button","aria-label":"Close",className:"btn btn--ghost",onClick:e,children:"✕"})]}),g.jsxs("div",{style:{padding:16},children:[g.jsx("p",{style:{marginBottom:16},children:a}),g.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[g.jsx("button",{className:"btn btn--ghost",onClick:e,children:"Cancel"}),g.jsx("button",{className:"btn btn--primary",onClick:i,children:"Sign In"})]})]})]})]});return Wc.createPortal(o,document.body)}function lbe({isUserTurn:t=!1,onOpen:e,isConnected:r=!0}){const{micEnabled:n,speaking:a}=gu(),[i,o]=v.useState(!1),c=v.useRef(null),d=v.useCallback(()=>r?n?Object.values(a).some(Boolean)?"speaking":"connected":"muted":"disconnected",[r,n,a])(),f=v.useCallback(()=>{if(!t){try{cr("Light")}catch{}e()}},[t,e]),h=v.useCallback(()=>{c.current=setTimeout(()=>{if(o(!0),t){try{cr("Medium")}catch{}e()}},500)},[t,e]),m=v.useCallback(()=>{c.current&&(clearTimeout(c.current),c.current=null),setTimeout(()=>o(!1),1500)},[]),_=v.useCallback(()=>{c.current&&(clearTimeout(c.current),c.current=null),o(!1)},[]),w=d==="muted"?"Muted":d==="disconnected"?"Voice disconnected":"Voice connected",b=["comms-btn",`comms-btn--${d}`,t?"comms-btn--turn":""].filter(Boolean).join(" ");return g.jsxs("div",{className:"comms-btn-container",children:[g.jsxs("button",{type:"button",className:b,onClick:f,onPointerDown:h,onPointerUp:m,onPointerLeave:_,onPointerCancel:_,"aria-label":w,"aria-pressed":n,style:{opacity:t?.75:1,pointerEvents:"auto"},children:[d==="speaking"&&g.jsx("span",{className:"comms-btn__pulse","aria-hidden":"true"}),d==="connected"&&g.jsx("span",{className:"comms-btn__ring comms-btn__ring--connected","aria-hidden":"true"}),g.jsxs("span",{className:"comms-btn__icon-wrap",children:[g.jsx(ube,{}),d==="muted"&&g.jsx("span",{className:"comms-btn__slash","aria-hidden":"true"})]})]}),i&&g.jsx("div",{className:"comms-btn__tooltip",role:"tooltip",children:w})]})}function ube(){return g.jsx("svg",{className:"comms-btn__svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:g.jsx("path",{d:"M12 1C7.03 1 3 5.03 3 10v6c0 1.66 1.34 3 3 3h1v-7H5v-2c0-3.87 3.13-7 7-7s7 3.13 7 7v2h-2v7h1c1.66 0 3-1.34 3-3v-6c0-4.97-4.03-9-9-9zM7 14v4H6c-.55 0-1-.45-1-1v-3h2zm12 3c0 .55-.45 1-1 1h-1v-4h2v3z"})})}function dbe({open:t,onClose:e,roomId:r,onLeaveVoice:n,onBlockReport:a}){const{micEnabled:i,setMicEnabled:o,videoEnabled:c,setVideoEnabled:u,leaveRoom:d}=gu(),[f,h]=v.useState(100),m=v.useRef(null),_=v.useCallback(P=>{P.target===P.currentTarget&&e()},[e]);v.useEffect(()=>{if(!t)return;const P=A=>{A.key==="Escape"&&e()};return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[t,e]),v.useEffect(()=>{if(!t||!m.current)return;m.current.querySelector('button, input, [tabindex]:not([tabindex="-1"])')?.focus()},[t]);const w=v.useCallback(()=>{try{cr("Light")}catch{}o(!i)},[i,o]),b=v.useCallback(()=>{try{cr("Light")}catch{}u(!c)},[c,u]),E=v.useCallback(P=>{const A=parseInt(P.target.value,10);h(A);try{window.dispatchEvent(new CustomEvent("comms:volume",{detail:{volume:A/100}}))}catch{}},[]),T=v.useCallback(()=>{try{cr("Medium")}catch{}d(r),n?.(),e()},[r,d,n,e]),D=v.useCallback(()=>{try{cr("Medium")}catch{}a?.(),e()},[a,e]);return t?g.jsx("div",{className:"comms-drawer-backdrop",onClick:_,"aria-modal":"true",role:"dialog",children:g.jsxs("div",{ref:m,className:"comms-drawer",role:"document","aria-label":"Communication settings",children:[g.jsx("div",{className:"comms-drawer__handle","aria-hidden":"true"}),g.jsxs("div",{className:"comms-drawer__header",children:[g.jsx("h2",{className:"comms-drawer__title",children:"Voice & Video"}),g.jsx("button",{type:"button",className:"comms-drawer__close",onClick:e,"aria-label":"Close",children:"✕"})]}),g.jsxs("div",{className:"comms-drawer__content",children:[g.jsxs("button",{type:"button",className:`comms-drawer__row comms-drawer__row--toggle ${i?"comms-drawer__row--active":""}`,onClick:w,"aria-pressed":i,children:[g.jsx("span",{className:"comms-drawer__row-icon",children:i?"🎙️":"🔇"}),g.jsx("span",{className:"comms-drawer__row-label",children:i?"Microphone On":"Microphone Off"}),g.jsx("span",{className:`comms-drawer__toggle ${i?"comms-drawer__toggle--on":""}`,children:g.jsx("span",{className:"comms-drawer__toggle-knob"})})]}),g.jsxs("button",{type:"button",className:`comms-drawer__row comms-drawer__row--toggle ${c?"comms-drawer__row--active":""}`,onClick:b,"aria-pressed":c,children:[g.jsx("span",{className:"comms-drawer__row-icon",children:c?"📹":"📷"}),g.jsx("span",{className:"comms-drawer__row-label",children:c?"Camera On":"Camera Off"}),g.jsx("span",{className:`comms-drawer__toggle ${c?"comms-drawer__toggle--on":""}`,children:g.jsx("span",{className:"comms-drawer__toggle-knob"})})]}),g.jsxs("div",{className:"comms-drawer__row comms-drawer__row--slider",children:[g.jsx("span",{className:"comms-drawer__row-icon",children:"🔊"}),g.jsx("span",{className:"comms-drawer__row-label",children:"Volume"}),g.jsx("input",{type:"range",min:"0",max:"100",value:f,onChange:E,className:"comms-drawer__slider","aria-label":"Volume"}),g.jsxs("span",{className:"comms-drawer__slider-value",children:[f,"%"]})]}),g.jsx("hr",{className:"comms-drawer__divider"}),g.jsxs("button",{type:"button",className:"comms-drawer__row comms-drawer__row--danger",onClick:T,children:[g.jsx("span",{className:"comms-drawer__row-icon",children:"🚪"}),g.jsx("span",{className:"comms-drawer__row-label",children:"Leave Voice"})]}),a&&g.jsxs("button",{type:"button",className:"comms-drawer__row comms-drawer__row--danger",onClick:D,children:[g.jsx("span",{className:"comms-drawer__row-icon",children:"🚫"}),g.jsx("span",{className:"comms-drawer__row-label",children:"Block / Report Player"})]})]}),g.jsx("div",{className:"comms-drawer__footer",children:g.jsx("p",{children:"All changes are saved automatically"})})]})}):null}function fbe({roomId:t,isUserTurn:e=!1,leftSlot:r}){gu();const{user:n}=$r(),[a,i]=v.useState(!1),[o,c]=v.useState(!1),[u,d]=v.useState(kG()),f=(()=>{try{return n?.isGuest===!0}catch{return!1}})(),h=v.useCallback(_=>()=>{try{cr("Light")}catch{}try{}catch{}_()},[]);v.useEffect(()=>{let _=!0;return(async()=>{try{const w=await au();if(!_)return;const b=!!w.diceAudio;d(b),pO(b)}catch{}})(),()=>{_=!1}},[]),h(()=>{const _=!u;if(d(_),pO(_),_)try{Xr()}catch{}(async()=>{try{const b={...await au(),diceAudio:_};await y0(b)}catch{}})()}),v.useMemo(()=>u?"Mute sounds":"Unmute sounds",[u]);const m=v.useCallback(()=>{if(f){i(!0);return}c(!0)},[f]);return g.jsxs(g.Fragment,{children:[r,g.jsx("div",{className:"poker-header-comms",role:"group","aria-label":"communications controls",children:g.jsx(lbe,{isUserTurn:e,onOpen:m,isConnected:!!t})}),g.jsx(dbe,{open:o,onClose:()=>c(!1),roomId:t}),g.jsx(S6,{open:a,onClose:()=>i(!1)})]})}const E6=v.createContext(void 0),pbe=({children:t})=>{const[e,r]=v.useState([]),[n,a]=v.useState(null),{sendGameInvite:i,respondGameInvite:o}=pa(),c=cu();Pa({onGameInviteReceived:m=>{const _={inviteId:m.inviteId,fromUserId:m.fromUserId,fromUserName:m.fromUserName,roomId:m.roomId,roomName:m.roomName,gameMode:m.gameMode,receivedAt:Date.now()};r(w=>[...w,_]),a(w=>w||_)}}),v.useEffect(()=>{const m=setInterval(()=>{const _=Date.now(),w=120*1e3;r(b=>b.filter(E=>_-E.receivedAt<w))},1e4);return()=>clearInterval(m)},[]);const u=v.useCallback(async(m,_,w)=>{try{const b=await i(m,_,w);if(b&&b.ok)return c?.success("Invite sent!"),{ok:!0};{const E=b?.error||"Failed to send invite";return c?.error(E),{ok:!1,error:E}}}catch(b){const E=b?.message||"Failed to send invite";return c?.error(E),{ok:!1,error:E}}},[i,c]),d=v.useCallback(async m=>{const _=e.find(w=>w.inviteId===m);if(!_)return{ok:!1};try{const w=await o(m,"accept");return w&&w.ok?(r(b=>b.filter(E=>E.inviteId!==m)),a(null),{ok:!0,roomId:_.roomId,gameMode:_.gameMode}):{ok:!1}}catch{return{ok:!1}}},[e,o]),f=v.useCallback(m=>{o(m,"decline").catch(()=>{}),r(_=>_.filter(w=>w.inviteId!==m)),a(_=>_?.inviteId===m?e.filter(b=>b.inviteId!==m)[0]||null:_)},[e,o]),h=v.useCallback(()=>{n&&f(n.inviteId)},[n,f]);return g.jsx(E6.Provider,{value:{pendingInvites:e,currentInvite:n,sendInvite:u,acceptInvite:d,declineInvite:f,dismissCurrentInvite:h},children:t})};function T6(){return v.useContext(E6)}function hbe({roomId:t,gameMode:e,className:r}){const[n,a]=v.useState(!1),[i,o]=v.useState(null),[c,u]=v.useState(new Set),d=v.useRef(null),f=T6(),{friends:h}=FA();v.useEffect(()=>{if(!n)return;const b=T=>{T.key==="Escape"&&a(!1)},E=T=>{d.current&&!d.current.contains(T.target)&&a(!1)};return document.addEventListener("keydown",b),document.addEventListener("mousedown",E),()=>{document.removeEventListener("keydown",b),document.removeEventListener("mousedown",E)}},[n]);const m=async b=>{if(f){o(b);try{(await f.sendInvite(t,b,e)).ok&&u(T=>new Set([...T,b]))}finally{o(null)}}},_=b=>{switch(b){case"cee-lo":return"Cee-Lo";case"craps":return"Craps";case"poker":return"Poker";default:return b}};if(!f)return null;const w=n?g.jsx("div",{className:"modal-backdrop",role:"presentation",style:{position:"fixed",inset:0,zIndex:99998,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0, 0, 0, 0.7)",backdropFilter:"blur(4px)"},children:g.jsxs("div",{className:"modal-panel",role:"dialog","aria-modal":"true","aria-label":"Invite friends",ref:d,style:{maxWidth:360,maxHeight:"80vh",overflow:"auto",position:"relative",background:"linear-gradient(135deg, #1a1a2e 0%, #16213e 100%)",borderRadius:12,padding:"24px",boxShadow:"0 8px 32px rgba(0, 0, 0, 0.5)",border:"1px solid rgba(255, 215, 0, 0.2)",color:"#fff"},children:[g.jsx("button",{className:"modal-close",onClick:()=>a(!1),"aria-label":"Close",style:{position:"absolute",top:8,right:8,background:"none",border:"none",color:"#fff",fontSize:"1.5rem",cursor:"pointer",opacity:.7},children:"×"}),g.jsxs("h3",{className:"modal-title",style:{marginBottom:16,textAlign:"center"},children:["Invite Friends to ",_(e)]}),h.length===0?g.jsxs("p",{style:{textAlign:"center",opacity:.7,padding:"20px 0"},children:["You don't have any friends yet.",g.jsx("br",{}),"Add friends from your profile to invite them to games!"]}):g.jsx("ul",{style:{listStyle:"none",padding:0,margin:0},children:h.map(b=>{const E=c.has(b.id),T=i===b.id;return g.jsxs("li",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 0",borderBottom:"1px solid rgba(255,255,255,0.1)"},children:[g.jsx("span",{style:{fontWeight:500},children:b.name||"Anonymous"}),E?g.jsx("span",{style:{color:"var(--success, #4caf50)",fontSize:"0.875rem"},children:"✓ Invited"}):g.jsx("button",{className:"felt-btn felt-btn--sm felt-btn--primary",onClick:()=>m(b.id),disabled:T,style:{minWidth:70},children:T?"...":"Invite"})]},b.id)})}),g.jsx("div",{style:{marginTop:20,textAlign:"center"},children:g.jsx("button",{className:"felt-btn btn--ghost",onClick:()=>a(!1),children:"Close"})})]})}):null;return g.jsxs(g.Fragment,{children:[g.jsx("button",{className:`felt-btn felt-btn--sm felt-btn--icon ${r||""}`,onClick:()=>a(!0),title:"Invite a friend to this game","aria-label":"Invite friend",style:{padding:"6px 10px",fontSize:"1.1rem",lineHeight:1},children:"+"}),w&&Wc.createPortal(w,document.body)]})}function VA(t){const{roomName:e,players:r,bankerId:n,currentRollerId:a,meId:i,gameState:o,roomId:c,onOpenDM:u,onOpenSendMoney:d,showHeader:f=!0,className:h,lite:m=!1,headerExtras:_,hideDiceResults:w,disableBankerFlash:b,crapsRollHistory:E,lastRollerId:T,hideSideBets:D,renderFacesOverride:P,headerCommsLeftSlot:A}=t;if(m)return g.jsx(b6,{players:r,meId:i,className:h,onOpenDM:u,onOpenSendMoney:d});const{handleLeave:C}=UA(c,i,{autoJoin:!1}),O=tn(),{onBuyChips:I,busy:x,ready:R,purchasesReady:N,isWeb:L}=Lg(),{onHandEnd:j}=S0(),q=gu(),{remoteStreams:U,myVideo:W,remoteVideoFlags:F}=q,{proofs:Y,reveals:Q,verifyFor:ie}=e6(c),{user:G,refreshUser:B}=$r(),K=(()=>{try{return G?.isGuest===!0}catch{return!1}})(),[ae,te]=v.useState(!1),[me,ue]=v.useState({}),{settledAll:Ae,playerBalance:He,mySettledAll:ce,newSettlements:xe,openAllMain:re}=v0(c,i),{leaveRoom:H}=pa();o?.betsLocked;const he=v.useCallback(()=>{if(o?.gameMode==="poker"){c&&H(c),O("/lobby");return}C()},[o,c,H,O,C]),Re=v.useCallback(_e=>()=>{try{cr("Light")}catch{}try{}catch{}_e()},[]),fe=v.useMemo(()=>r.find(_e=>_e.id===i)?.balance,[r,i]),Ie=o?.gameMode,ct=(()=>{const _e=typeof He=="number"?He:void 0,Ze=typeof fe=="number"?fe:void 0;return Ie==="craps"?Ze??_e??0:_e??Ze??0})(),[$e,rt]=v.useState(ct),[We,it]=v.useState(!1),Et=v.useRef(ct),Mt=v.useRef(new Set),_t=v.useRef({}),ge=v.useRef(!1);v.useEffect(()=>{Et.current!==ct&&(Et.current=ct,rt(ct))},[ct]);const Be=v.useMemo(()=>{if(o?.gameMode!=="poker")return null;const Ze=Array.isArray(o?.pokerSeats)?o.pokerSeats:[],ot=new Set;for(const Je of Ze)Je?.playerId&&ot.add(String(Je.playerId));return ot},[o?.gameMode,o?.pokerSeats]),je=v.useCallback(_e=>{if(o?.gameMode==="poker"){const ot=typeof _e.balance=="number"?_e.balance:0,Nt=(Array.isArray(o?.pokerSeats)?o.pokerSeats:[]).find(Or=>Or.playerId===_e.id);if(Nt&&typeof Nt.stack=="number")return Math.max(0,Nt.stack);const $t=typeof Nt?.committed=="number"?Nt.committed:0;return Math.max(0,ot-$t)}return _e.id===i?Number($e??0):typeof _e.balance=="number"?_e.balance:0},[o,i,$e]),nt=v.useMemo(()=>{const _e=o?.gameMode;return _e==="poker"?Be?r.filter(ot=>Be.has(ot.id)):r:_e==="craps"||o?.mode==="single"||t.roomId?.includes("single")?r:r.filter(ot=>ot.id===i||ot.id?.startsWith("bot_")||ot.id?.startsWith("craps_bot_")?!0:je(ot)>0)},[r,Be,o?.gameMode,o?.mode,i,je,t.roomId]),Ct=v.useMemo(()=>Object.fromEntries(nt.map(_e=>[_e.id,_e])),[nt]),jt=v.useRef(void 0),De=v.useRef(new Map);v.useEffect(()=>{if(o?.gameMode!=="poker")return;const Ze=t.roomId||"unknown";jt.current!==Ze&&(jt.current=Ze,De.current=new Map);const ot=De.current;let Je=-1;ot.forEach(Nt=>{Nt>Je&&(Je=Nt)});for(const Nt of nt)ot.has(Nt.id)||(Je+=1,ot.set(Nt.id,Je))},[nt,t.roomId,o?.gameMode]);const et=v.useMemo(()=>{if(o?.gameMode==="poker"){const $t=De.current;return nt.map(Or=>Or.id).slice().sort((Or,rn)=>($t.get(Or)??0)-($t.get(rn)??0))}const Ze=Array.isArray(o?.turnOrder)?o.turnOrder:[];if(!Ze.length)return r.map($t=>$t.id);const ot=new Set(r.map($t=>$t.id)),Je=Ze.filter($t=>ot.has($t)),Nt=r.map($t=>$t.id).filter($t=>!Je.includes($t));return[...Je,...Nt]},[nt,r,o?.turnOrder,o?.gameMode]),at=o.roundSeq??1;v.useEffect(()=>{if(!(!xe||!xe.length)){for(const _e of xe){if(!_e||_e.roundSeq!==at||Mt.current.has(_e.id))continue;const Ze={..._e,type:_e.type||(_e.predicate||_e.subjectId?"SIDE":"MAIN")},ot=zA(Ze,i);if(!ot.outcome)continue;Mt.current.add(_e.id);let Je=0,Nt=0;try{const Tn=md(_e,i);Tn&&(Tn.myResult==="WIN"?Je=Tn.myPayout||0:Tn.myResult==="LOSE"&&(Nt=_e.amount||0))}catch{}const $t=Je>0?Je:Nt>0?-Nt:0;if($t===0)continue;const Or=ot.needsAnimation?2e3:0,rn=window.setTimeout(()=>{rt(Tn=>Tn+$t),it(!0),window.setTimeout(()=>it(!1),2e3),delete _t.current[_e.id]},Or);_t.current[_e.id]=rn}return()=>{Object.values(_t.current).forEach(_e=>window.clearTimeout(_e)),_t.current={}}}},[xe,at,i,B]);const we=v.useMemo(()=>typeof o.roundSeq=="number"?(o.turnHistory??[]).filter(_e=>_e.roundSeq===o.roundSeq):o.turnHistory??[],[o.turnHistory,o.roundSeq]),[st,bt]=v.useState(!1),[nr,ur]=v.useState(0),[dr,Sr]=v.useState(void 0);v.useEffect(()=>{if(!(!xe||!xe.length||o?.gameMode==="poker"))for(const Ze of xe){if(!Ze||Ze.roundSeq!==at||Ze.playerId!==i)continue;const ot=md(Ze,i);if(ot&&ot.myResult==="LOSE"){const Je=Number(Ze.amount||0);ur(Je>0?Je:0),Sr(void 0),bt(!0);break}}},[xe,at,i,o]);const[un,Z]=v.useState(null),[X,le]=v.useState(null),[be,z]=v.useState(!1),[ee,se]=v.useState(!1),Oe=v.useRef(null),[wt,er]=v.useState(new Map),{sendVisibilityChange:Qt}=pa();v.useEffect(()=>{Z(null)},[c]);const Zt=v.useCallback(async()=>{if(c)try{const _e=await j_e(c);_e&&Z(_e)}catch{}},[c]),oa=v.useCallback(async()=>{if(c)try{z(!0);const _e=await L_e(c);le(_e||null)}catch{le(null)}finally{z(!1)}},[c]);v.useEffect(()=>{ee&&o?.gameMode==="craps"&&Zt()},[ee,o,Zt]),v.useEffect(()=>{if(!c||!Y||typeof Y!="object")return;let _e=!1;const Ze=at,ot=`${Ze}:`,Je=Object.keys(Y||{}).filter(Nt=>Nt.startsWith(ot));if(Je.length)return Je.forEach(Nt=>{const $t=Nt.split(":")[1];$t&&(async()=>{try{const Or=await ie($t,Ze);_e||ue(rn=>rn[Nt]===Or?rn:{...rn,[Nt]:Or})}catch{_e||ue(Or=>Or[Nt]==="unverifiable"?Or:{...Or,[Nt]:"unverifiable"})}})()}),()=>{_e=!0}},[Y,Q,ie,c,at]);const On=v.useMemo(()=>{if(!n)return null;for(let _e=we.length-1;_e>=0;_e--){const Ze=we[_e];if(Ze.playerId===n&&Array.isArray(Ze.result)&&Ze.result.length===3){const ot=Ze.result;if(Sm(ot)!=="nothing")return ot}}if(o.bankRoll?.raw&&Array.isArray(o.bankRoll.raw)&&o.bankRoll.raw.length===3){const _e=o.bankRoll.raw;if(Sm(_e)!=="nothing")return _e}return null},[n,we,o.bankRoll]),{revealedPlayers:Ye,revealTimesRef:Yt}=G_e(we,n,o,at),{show:At,activeKind:Rt,hasActive:Dt,onIdle:Nn,info:dn}=Es(),jr=v.useRef(new Set),Ra=v.useRef(!1);v.useEffect(()=>{if(!Ra.current){const _e=new Set(r.map(Ze=>String(Ze.id)));jr.current=_e,Ra.current=!0}},[r]);const co=v.useRef(new Map),pn=v.useRef({}),tc=v.useMemo(()=>{const _e=new Map;try{const Ze=Array.isArray(re)?re:[];for(const ot of Ze){const Je=ot?.roundSeq;typeof Je=="number"&&Je!==at||ot&&ot.playerId&&typeof ot.amount=="number"&&_e.set(ot.playerId,ot.amount)}}catch{}return _e},[re,at]);v.useEffect(()=>{try{for(const _e of r){const Ze=String(_e.id);if(!Ye.get(Ze))continue;const ot=jE(Ze,we,n,o.bankRoll,On);if(!ot||ot.length!==3)continue;const Je=`${at}:${[...ot].sort((rn,Tn)=>rn-Tn).join("")}`;if(co.current.get(Ze)===Je)continue;co.current.set(Ze,Je);const $t=pn.current[Ze];$t&&(window.clearTimeout($t),pn.current[Ze]=null);const Or=_e?.name||_e?.email||Ze;pn.current[Ze]=window.setTimeout(()=>{const rn=()=>{const Tn=wb(ot);At({kind:"roll",title:String((n&&Ze===n?"Banker":Or)||Ze),subtitle:`${Tn.label}`,duration:500})};Dt&&["win","lose","push"].includes(Rt||"")?Nn(rn):rn(),pn.current[Ze]=null},1e3)}}catch{}return()=>{try{Object.values(pn.current).forEach(_e=>{_e&&window.clearTimeout(_e)}),pn.current={}}catch{}}},[r,Ye,we,n,On,at,Dt,Rt,Nn,At,o.bankRoll]);const zi=v.useRef({});v.useRef(0),v.useRef(null),Pa({onOtherPlayerJoined:({room:_e})=>{try{if(!_e||!Array.isArray(_e.players))return;const Ze=jr.current,ot=new Set(_e.players.map(Nt=>String(Nt.id)));if(!Ra.current){jr.current=ot,Ra.current=!0;return}const Je=[...ot].filter(Nt=>!Ze.has(Nt));if(Je.length>0){const Nt=new Map(_e.players.map($t=>[String($t.id),$t]));for(const $t of Je){if($t===i)continue;const Or=Nt.get($t),rn=Or?.name||Or?.email||$t;try{dn&&dn("Player Joined",String(rn))}catch{}}}jr.current=ot}catch{}},onOtherLeft:({room:_e})=>{try{if(!_e||!Array.isArray(_e.players))return;const Ze=jr.current,ot=new Set(_e.players.map(Nt=>String(Nt.id)));if(!Ra.current){jr.current=ot,Ra.current=!0;return}const Je=[...Ze].filter(Nt=>!ot.has(Nt));if(Je.length>0){const Nt=new Map;try{r.forEach($t=>Nt.set(String($t.id),$t.name||$t.email||String($t.id)))}catch{}for(const $t of Je){if($t===i)continue;const Or=Nt.get($t)||$t;try{dn&&dn("Player Left",String(Or))}catch{}}}jr.current=ot}catch{}},onPlayerBalanceUpdated:({playerId:_e,balance:Ze})=>{_e===i&&(Object.values(_t.current).forEach(ot=>window.clearTimeout(ot)),_t.current={},Mt.current.clear(),ge.current=!0,Et.current=Ze,rt(Ze),it(!0),window.setTimeout(()=>it(!1),2e3))},onCrapsBetResults:_e=>{!_e||_e.roomId!==c||(Oe.current&&window.clearTimeout(Oe.current),Oe.current=window.setTimeout(()=>{Zt()},350))},onCrapsBetsUpdate:_e=>{!_e||_e.roomId!==c||(Oe.current&&window.clearTimeout(Oe.current),Oe.current=window.setTimeout(()=>{Zt()},250))},onCrapsPointSet:_e=>{!_e||_e.roomId!==c||(Oe.current&&window.clearTimeout(Oe.current),Oe.current=window.setTimeout(()=>{Zt()},300))},onCrapsPointMade:_e=>{!_e||_e.roomId!==c||(Oe.current&&window.clearTimeout(Oe.current),Oe.current=window.setTimeout(()=>{Zt()},300))},onPlayerPresenceUpdate:_e=>{if(!_e||_e.roomId!==c)return;const{playerId:Ze,status:ot}=_e;!Ze||!ot||er(Je=>{const Nt=new Map(Je);return Nt.set(Ze,ot),Nt})}}),v.useEffect(()=>()=>{Oe.current&&window.clearTimeout(Oe.current)},[]),v.useEffect(()=>{if(!c)return;const _e=()=>{const ot=!document.hidden;Qt(c,ot)};Qt(c,!document.hidden),document.addEventListener("visibilitychange",_e);let Ze=null;return(async()=>{try{const{App:ot}=await qr(async()=>{const{App:Je}=await Promise.resolve().then(()=>eW);return{App:Je}},void 0,import.meta.url);Ze=await ot.addListener("appStateChange",Je=>{Qt(c,Je.isActive)})}catch{}})(),()=>{document.removeEventListener("visibilitychange",_e),Ze&&typeof Ze.remove=="function"&&Ze.remove()}},[c,Qt]);const Ts=v.useCallback(_e=>{let Ze=zi.current[_e];if(Ze&&Ze.getAttribute("data-player-id")!==_e&&(Ze=null),!Ze)try{const Nt=window.CSS&&typeof window.CSS.escape=="function"?window.CSS.escape(_e):String(_e).replace(/[^a-zA-Z0-9_-]/g,"_");Ze=document.querySelector(`.players.players--avatars [data-player-id="${Nt}"]`)}catch{}if(!Ze)return null;const ot=Ze.querySelector(".avatar-ring");let Je=null;if(ot)Je=ot.getBoundingClientRect();else try{Je=Ze.getBoundingClientRect()}catch{}return!Je||Je.width===0&&Je.height===0?null:{x:Je.left+Je.width/2,y:Je.top+Je.height/2}},[]),_i=v.useRef(we.length),Qn=v.useRef(null),hn=v.useRef(null),Cs=v.useRef(null);v.useEffect(()=>{_i.current=we.length},[at]),v.useEffect(()=>{Cs.current=null},[at]);const{forUserId:xs,anchorRect:Ps,anchorEl:$i,openFor:Lp,close:kd}=qA(),wd=(_e,Ze)=>{!Ze||_e===i||Lp(_e,Ze)},Bp=()=>kd(),rc=v.useMemo(()=>{const _e=new Map;for(const Ze of r)_e.set(Ze.id,Ze.name||Ze.email||Ze.id);for(const Ze of Ae){const ot=Ze?.playerId,Je=Ze?.bankerId;ot&&!_e.has(ot)&&_e.set(ot,ot),Je&&!_e.has(Je)&&_e.set(Je,Je)}return _e},[r,Ae]),lo=v.useCallback(_e=>rc.get(_e||"")||_e||"Unknown",[rc]),ma=v.useCallback(_e=>lo(_e),[lo]),ga=v.useCallback(_e=>jE(_e,we,n,o.bankRoll,On),[we,n,o.bankRoll,On]);cbe({newSettlements:xe,roundSeqNow:at,myId:i,bankerDice:On,getPlayerName:ma,getPlayerDice:ga,getRevealTime:_e=>Yt?.current?.get?.(_e),postRevealDelayMs:0,bankerId:n});const Ba=v.useRef(null);v.useEffect(()=>{!(o?.gameMode==="cee-lo"||o?.gameMode==="ceeLo"||!o?.gameMode)||!xe.length||!xe.filter(ot=>ot.playerId===i||ot.bankerId===i).length||Ba.current!==at&&(Ba.current=at,setTimeout(async()=>{try{await j()}catch{}},2500))},[xe,at,i,o,j]);const Yc=o?.gameMode==="cee-lo"||o?.gameMode==="ceeLo"||!o?.gameMode,vu=o?.gameMode==="craps",Xc=v.useCallback(_e=>{if(!Yc)return!0;if(!_e||!(Ye.get(_e)===!0))return!1;const ot=Yt?.current?.get?.(_e);return(typeof ot=="number"?performance.now()-ot:0)>=sa.diceToChipDelayMs},[Yc,Ye,Yt]),{activeBatch:uo,handleAnimItemComplete:Sd,resetForRound:ca}=sbe({newSettlements:xe,roundSeqNow:at,getAvatarCenter:Ts,getPlayerName:ma,myId:i,bankerDice:On,bankerId:n,isPartyReady:Xc});v.useEffect(()=>{ca()},[at,ca]);const fo=v.useRef(null),bi=v.useRef(null),Jc=v.useMemo(()=>{if(o?.gameMode==="poker"){const Ze=Number(o?.pokerUiLockedUntilTs||0),ot=Ze>0&&Date.now()<Ze,Je=7e3;ot&&fo.current==null&&(fo.current=Date.now());const Nt=fo.current||0,$t=Nt>0?Date.now()-Nt:Number.POSITIVE_INFINITY,Or=ot&&$t<=Je,rn=Array.isArray(o?.pokerSeats)?o.pokerSeats:[],Tn=typeof o?.pokerActingSeat=="number"?o.pokerActingSeat:void 0,la=typeof Tn=="number"&&rn.find(As=>As.seatIndex===Tn)?.playerId||null;return Or?bi.current??la??null:(bi.current=la??null,fo.current=null,la??null)}return(o?.currentRollerId??a)||null},[o?.gameMode,o?.pokerSeats,o?.pokerActingSeat,o?.currentRollerId,a]);return v.useEffect(()=>{const _e=hn.current,Ze=Jc||void 0;if(!_e||!Ze||Cs.current===Ze)return;const ot=zi.current[Ze];if(!ot)return;const Je=()=>{try{const Nt=Math.max(0,Math.min(ot.offsetLeft-_e.clientWidth/2+ot.offsetWidth/2,_e.scrollWidth-_e.clientWidth));_e.scrollTo({left:Nt,behavior:"smooth"}),Cs.current=Ze}catch{}};return Qn.current&&clearTimeout(Qn.current),Qn.current=setTimeout(()=>{typeof requestAnimationFrame<"u"?requestAnimationFrame(Je):Je()},100),()=>{Qn.current&&(clearTimeout(Qn.current),Qn.current=null)}},[Jc,et]),g.jsxs("div",{className:["card",h].filter(Boolean).join(" "),style:{position:"relative"},children:[f&&g.jsx("div",{className:"card-header card-header--two-rows",children:g.jsxs("div",{className:"card-header-row",children:[g.jsxs("div",{className:"header-slot header-slot--left",children:[g.jsx("a",{className:"gold-link white-link",onClick:Re(he),"aria-label":"Back",style:{display:"flex"},children:g.jsx(bd,{className:"icon",style:{color:"var(--gold, #caa64d)"}})}),(()=>{const _e=x||!R||!N,Ze=_e?"Balance (login to Buy 1000 Z Credits)":L?"Buy 1000 Z Credits":"Buy 1000 Z Credits (App Store / Play)",ot=_e?"Login to Buy 1000 Z Credits":L?"Buy 1000 Z Credits":"Buy 1000 Z Credits (App Store / Play)",Je=Re(()=>{if(K){te(!0);return}I()});return g.jsx("a",{className:"gold-link balance-display"+(_e?" disabled":"")+(We?" balance--pulse":""),role:"button","aria-label":Ze,title:ot,"aria-disabled":_e||void 0,onClick:Je,children:g.jsxs("b",{children:[g.jsx("span",{className:"lowercase",children:"z"}),rd.formatMoney($e,"",0)]})})})(),g.jsx("a",{role:"button",className:"gold-link white-link"+(t.historyHalo?" history-halo":""),onClick:Re(()=>{if(K){te(!0);return}const _e=o?.gameMode;_e==="craps"?(Zt(),se(!0)):_e==="poker"?t.onOpenHistory&&t.onOpenHistory():oa().then(()=>se(!0))}),"aria-haspopup":"dialog","aria-controls":"my-bets-modal",children:"History"})]}),g.jsxs("div",{className:"header-slot header-slot--right",children:[c&&!K&&!t.singlePlayer&&g.jsx(hbe,{roomId:c,gameMode:o?.gameMode||"cee-lo"}),g.jsx(fbe,{roomId:c,leftSlot:A}),_?g.jsx("div",{className:"panel-header-extras",children:_}):null]})]})}),uo.length>0&&g.jsxs("div",{style:{position:"fixed",inset:0,pointerEvents:"none",zIndex:1e4},children:[uo.map(_e=>g.jsx(w6,{anim:_e,onComplete:()=>Sd(_e.id)},_e.id)),!1]}),g.jsx("div",{className:"chip-fly-container",children:g.jsx(Ys.ul,{className:"players players--avatars",role:"list",ref:hn,layout:!0,transition:{type:"spring",stiffness:420,damping:38,mass:.6},children:et.map(_e=>{const Ze=o?.currentRollerId??a,ot=Ct[_e];if(!ot)return null;const Je=ot.id,Nt=[];if(o?.gameMode==="poker"){const Lr=o,Zn=Array.isArray(Lr.pokerSeats)?Lr.pokerSeats:[],ea=typeof Lr.pokerDealerSeat=="number"?Lr.pokerDealerSeat:void 0,Ua=Zn.find(Da=>Da.playerId===Je);if(Ua&&typeof ea=="number"){Ua.seatIndex===ea&&Nt.push("D");const Da=Zn.filter(Fn=>!!Fn.playerId).map(Fn=>Fn.seatIndex).sort((Fn,Hi)=>Fn-Hi),ta=Da.length;if(ta>=2){const Fn=Da.indexOf(ea);if(Fn!==-1){let Hi,nc;ta===2?(Hi=ea,nc=Da[(Fn+1)%ta]):(Hi=Da[(Fn+1)%ta],nc=Da[(Fn+2)%ta]),Ua.seatIndex===Hi&&Nt.push("SB"),typeof nc=="number"&&Ua.seatIndex===nc&&Nt.push("BB")}}}}Je===Ze&&!Ye.get(Je)&&Nt.push("Rolling"),Je===Ze&&Nt.push("Shooter");let $t=!1;if(o?.gameMode==="poker"){const Lr=o,Zn=typeof Lr.pokerActingSeat=="number"?Lr.pokerActingSeat:void 0;typeof Zn=="number"&&Array.isArray(Lr.pokerSeats)&&($t=Lr.pokerSeats.find(Ua=>Ua.seatIndex===Zn)?.playerId===Je)}else $t=Je===Ze;let Or=!1;if(o?.gameMode==="poker"){const Zn=(Array.isArray(o?.pokerSeats)?o.pokerSeats:[]).find(ea=>ea.playerId===Je);Zn&&String(Zn.status||"").toLowerCase()==="folded"&&(Or=!0)}const rn=Je===i?W:U[Je],Tn=F[Je]?rn:void 0,la=!w&&Ye.get(Je)?jE(Je,we,n,o.bankRoll,On):null;let As=!w&&la&&Array.isArray(la)&&la.length===3&&!la.every(Lr=>Lr===0)&&Sm(la)!=="nothing"?g.jsx(nbe,{dice:la}):null;const Qc=(o.spectators??[]).includes(Je);let Rs;if(P)Rs=P(ot);else if(Qc)Rs=null;else if(Yc&&!Ye.get(Je)){const Lr=tc.get(Je);Rs=typeof Lr=="number"&&Lr>0?g.jsxs("span",{className:"player-bet-pill","aria-label":`Bet z${rd.formatMoney(Lr,"",0)}`,children:["z",rd.formatMoney(Lr,"",0)]}):null}else Rs=As;const ki=o?.gameMode==="poker",wi=vu&&(Je.startsWith("craps_bot_")||Je.startsWith("bot_")),Vi=je(ot),po=wi?void 0:Number.isFinite(Vi)?Vi:void 0;return g.jsx($_e,{ref:Lr=>{zi.current[Je]=Lr},id:Je,display:ot.name??ot.email??Je,isCurrentRoller:$t,isMe:Je===i,balance:po,isSpectating:Qc,folded:Or,tags:Nt,stream:Tn,isMuted:Je===i,diceResult:Rs,onOpenMenu:(Lr,Zn)=>wd(Lr,Zn),showMenu:xs===Je,menuProps:xs===Je?{targetId:Je,anchorRect:Ps,anchorEl:$i,onClose:Bp,onOpenDM:u,onOpenSendMoney:d,meId:i}:null,forceHideVideo:!F[Je],avatarUrl:ot.avatarUrl,showActingTimerRing:ki,presenceStatus:wt.get(Je)},Je)})})}),ee&&g.jsx(g4,{onClose:()=>se(!1),items:Array.isArray(X)&&X.length>0?X:ce,meId:i,nameOf:lo,crapsRollHistory:E,gameMode:o?.gameMode,crapsLedgerItems:(un||[]).slice().sort((_e,Ze)=>Number(Ze.ts)-Number(_e.ts))}),g.jsx(S6,{open:ae,onClose:()=>te(!1),message:"This feature is for logged in users."})]})}function mbe(t){const{gameState:e,roomId:r,meId:n}=t,{show:a,hasActive:i,activeKind:o,onIdle:c,rollNow:u}=Es(),{onHandEnd:d}=S0(),f=v.useRef(null),h=v.useRef(new Set),m=v.useRef(null),_=v.useRef(null),w=v.useRef(null),b=v.useRef(null),E=v.useRef(null),T=v.useRef(null),{reveal:D}=Jo(),{recentSettlements:P,lastSettlementRoll:A,pointSetEvent:C,pointMadeEvent:O}=Zz({roomId:r||null,myPlayerId:n}),I=v.useCallback((x,R,N,L,j)=>{if(f.current===j||h.current.has(j))return;(()=>{f.current=j,h.current.add(j),a({kind:x==="roll"?"roll":x,title:R,subtitle:N,duration:L})})()},[a]);return v.useEffect(()=>{if(!C||!r||C.roomId!==r)return;const x=C._key;f.current===x||h.current.has(x)||(m.current={key:x,point:C.point},_.current&&clearTimeout(_.current),D&&(_.current=setTimeout(()=>{const R=m.current;if(R){if(h.current.has(R.key)){m.current=null;return}f.current=R.key,h.current.add(R.key);try{yO({volume:.15})}catch{}typeof u=="function"?u("Point Established",`${R.point} is the point`):a({kind:"roll",title:"Point Established",subtitle:`${R.point} is the point`,duration:1e3}),m.current=null}},sa.revealFlashPostDelayMs)))},[C,r,u,a,D]),v.useEffect(()=>{!D||!m.current||(_.current&&clearTimeout(_.current),_.current=setTimeout(()=>{const R=m.current;if(R){if(h.current.has(R.key)){m.current=null;return}f.current=R.key,h.current.add(R.key);try{yO({volume:.15})}catch{}typeof u=="function"?u("Point Established",`${R.point} is the point`):a({kind:"roll",title:"Point Established",subtitle:`${R.point} is the point`,duration:1e3}),m.current=null}},sa.revealFlashPostDelayMs))},[D,u,a]),v.useEffect(()=>{O&&(!r||O.roomId!==r||(w.current={key:O._key,point:O.point},b.current&&clearTimeout(b.current),D&&(b.current=setTimeout(()=>{const x=w.current;if(x){if(h.current.has(x.key)){w.current=null;return}I("win","Point Made!",`${x.point} hit`,1300,x.key);try{vO({sfxVolume:.15,voiceVolume:.55})}catch{}w.current=null}},sa.revealFlashPostDelayMs))))},[O,r,I,D]),v.useEffect(()=>{!D||!w.current||(b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{const R=w.current;if(R){if(h.current.has(R.key)){w.current=null;return}I("win","Point Made!",`${R.point} hit`,1300,R.key);try{vO({sfxVolume:.15,voiceVolume:.55})}catch{}w.current=null}},sa.revealFlashPostDelayMs))},[D,I]),v.useEffect(()=>()=>{_.current&&clearTimeout(_.current),b.current&&clearTimeout(b.current),T.current&&clearTimeout(T.current)},[]),v.useEffect(()=>{if(!P.length)return;const x=(()=>{try{return typeof window<"u"&&(window.__E2E===!0||window.location?.search?.includes("e2e=1"))}catch{return!1}})(),R=n||(x?e?.currentRollerId||"e2e-user":void 0),N=fe=>{const Ie=fe.betType;return Ie==="pass"||Ie==="dontPass"||Ie.startsWith("place")||Ie==="field"||Ie==="big6"||Ie==="big8"||Ie==="come"||Ie==="dontCome"},L=P.filter(fe=>(R?fe.playerId===R:!0)&&N(fe));if(!L.length)return;const j=A?._seq||0,q=typeof A?.total=="number"?A.total:Array.isArray(A?.dice)?A.dice[0]+A.dice[1]:"",U=L.map(fe=>`${fe.betType}:${fe.outcome}:${fe.amount}:${fe.payout}`).sort().join("|"),W=`${j}:${q}:${U}`;if(E.current===W)return;E.current=W;const F=L.filter(fe=>fe.betType==="pass"||fe.betType==="dontPass"),Y=L.filter(fe=>fe.betType.startsWith("place")&&fe.outcome==="WIN"),Q=L.filter(fe=>fe.betType==="field"),ie=L.filter(fe=>fe.betType==="big6"||fe.betType==="big8"),G=L.filter(fe=>fe.betType==="come"||fe.betType==="dontCome"),B=F.some(fe=>fe.outcome==="WIN"),K=Y.length>0,ae=Q.some(fe=>fe.outcome==="WIN"),te=ie.some(fe=>fe.outcome==="WIN"),me=G.some(fe=>fe.outcome==="WIN"),ue=F.some(fe=>fe.outcome==="LOSE"),Ae=Q.some(fe=>fe.outcome==="LOSE"),He=ie.some(fe=>fe.outcome==="LOSE"),ce=G.some(fe=>fe.outcome==="LOSE"),xe=G.some(fe=>fe.outcome==="PUSH"),re=!B&&!ue&&F.some(fe=>fe.outcome==="PUSH");let H="",he="";T.current&&clearTimeout(T.current);const Re=(()=>{try{return typeof window<"u"&&(window.__E2E===!0||window.location?.search?.includes("e2e=1"))}catch{return!1}})();T.current=setTimeout(()=>{const fe=typeof q=="number"?q:Number(q),Ie=A?.currentRollerId,ct=Y.some($e=>{const rt=Number(String($e.betType).replace(/^place/,""));return Number.isFinite(rt)&&rt===fe});if(B){if(K&&ct&&n&&Ie===n){const rt=Y.reduce((We,it)=>We+it.payout,0);H=Y.length>1?"Place Wins":"Place Win",he=`+${rt}`,a({kind:"win",title:H,subtitle:he,duration:1e3});return}const $e=F.filter(rt=>rt.outcome==="WIN").reduce((rt,We)=>rt+(We.payout+We.amount),0);H="Line Win",he=`+${$e}`,a({kind:"win",title:H,subtitle:he,duration:1100});return}if(K){const $e=Y.reduce((rt,We)=>rt+We.payout,0);H=Y.length>1?"Place Wins":"Place Win",he=`+${$e}`,a({kind:"win",title:H,subtitle:he,duration:1e3});return}if(ae){const $e=Q.filter(rt=>rt.outcome==="WIN").reduce((rt,We)=>rt+We.payout,0);H="Field Win",he=`+${$e}`,a({kind:"win",title:H,subtitle:he,duration:1e3});return}if(te){const $e=ie.filter(it=>it.outcome==="WIN"),rt=$e.reduce((it,Et)=>it+Et.payout,0);H=$e.length>1?"Big Wins":$e[0]?.betType==="big6"?"Big 6 Win":"Big 8 Win",he=`+${rt}`,a({kind:"win",title:H,subtitle:he,duration:1e3});return}if(me){const $e=G.filter(it=>it.outcome==="WIN"),rt=$e.reduce((it,Et)=>it+Et.payout,0);H=$e.length>1?"Come Wins":$e[0]?.betType==="dontCome"?"DC Win":"Come Win",he=`+${rt}`,a({kind:"win",title:H,subtitle:he,duration:1e3});return}if(ue){const $e=F.filter(rt=>rt.outcome==="LOSE").reduce((rt,We)=>rt+We.amount,0);H="Line Lose",he=`-${$e}`,a({kind:"lose",title:H,subtitle:he,duration:1100});return}if(Ae){const $e=Q.filter(rt=>rt.outcome==="LOSE").reduce((rt,We)=>rt+We.amount,0);H="Field Lose",he=`-${$e}`,a({kind:"lose",title:H,subtitle:he,duration:1e3});return}if(He){const $e=ie.filter(it=>it.outcome==="LOSE"),rt=$e.reduce((it,Et)=>it+Et.amount,0);H=$e.length>1?"Big Bets Lose":$e[0]?.betType==="big6"?"Big 6 Lose":"Big 8 Lose",he=`-${rt}`,a({kind:"lose",title:H,subtitle:he,duration:1e3});return}if(ce){const $e=G.filter(it=>it.outcome==="LOSE"),rt=$e.reduce((it,Et)=>it+Et.amount,0);H=$e.length>1?"Come Bets Lose":$e[0]?.betType==="dontCome"?"DC Lose":"Come Lose",he=`-${rt}`,a({kind:"lose",title:H,subtitle:he,duration:1e3});return}if(xe){H="DC Push",he="No action",a({kind:"push",title:H,subtitle:he,duration:1e3});return}re&&(H="Line Push",he="No action",a({kind:"push",title:H,subtitle:he,duration:1e3}));try{d()}catch{}},Re?200:2e3)},[P,n,A,a,d]),g.jsx(VA,{...t,hideDiceResults:!0,className:"craps-player-panel"})}function gbe(t){return g.jsx(VA,{...t})}function ybe({deadlineTs:t,isActive:e,showTurnLabel:r=!0}){const[n,a]=v.useState(30),i=v.useRef(null);v.useEffect(()=>{if(!e||!t){a(30),i.current&&(cancelAnimationFrame(i.current),i.current=null);return}const f=()=>{const h=Date.now(),m=Math.max(0,Math.ceil((t-h)/1e3));a(m),m>0?i.current=requestAnimationFrame(f):i.current=null};return f(),()=>{i.current&&(cancelAnimationFrame(i.current),i.current=null)}},[t,e]);const o=e&&n!==30,c=n<=10,u=n<=5,d=n/30*100;return g.jsxs("div",{className:["poker-turn-timer",o?"":"poker-turn-timer--hidden",c?"poker-turn-timer--urgent":"",u?"poker-turn-timer--critical":""].filter(Boolean).join(" "),"aria-live":"polite","aria-atomic":"true",role:"timer","aria-hidden":!o,children:[g.jsxs("div",{className:"poker-turn-timer__ring",children:[g.jsxs("svg",{viewBox:"0 0 36 36",className:"poker-turn-timer__svg",children:[g.jsx("circle",{className:"poker-turn-timer__circle-bg",cx:"18",cy:"18",r:"16"}),g.jsx("circle",{className:"poker-turn-timer__circle-progress",cx:"18",cy:"18",r:"16",strokeDasharray:`${d} 100`})]}),g.jsx("div",{className:"poker-turn-timer__number",children:n})]}),r&&g.jsx("div",{className:"poker-turn-timer__label","aria-hidden":"true",children:"Your Turn"})]})}function HA(t){const e=v.useMemo(()=>t.headerExtras,[t.headerExtras]),r=v.useMemo(()=>{const u=Array.isArray(t.gameState?.pokerSeats)?t.gameState.pokerSeats:[],d=new Map;for(const f of u){const h=(f.totalCommitted||0)+(f.committed||0);d.set(f.playerId,h)}return d},[t.gameState]),n=v.useMemo(()=>{const u=Array.isArray(t.gameState?.pokerSeats)?t.gameState.pokerSeats:[],d=new Set;for(const f of u)f?.playerId&&String(f.status||"").toLowerCase()==="folded"&&d.add(f.playerId);return d},[t.gameState]),a=v.useMemo(()=>{const u=new Map,d=Array.isArray(t.revealedHands)?t.revealedHands:[];for(const f of d)f?.playerId&&Array.isArray(f.hole)&&f.hole.length===2&&u.set(String(f.playerId),f.hole);return u},[t.revealedHands]),i=v.useMemo(()=>u=>{const d=a.get(u.id);if(d&&d.length===2){const m=({value:_})=>{const w=String(_||"").toUpperCase(),b=w.slice(0,-1),E=w.slice(-1),T=b==="T"?"10":b,D=E==="H"||E==="D",P=E==="H"?"♥":E==="D"?"♦":E==="C"?"♣":"♠";return g.jsxs("div",{className:["poker-card","poker-card--mini",D?"poker-card--red":""].filter(Boolean).join(" "),"aria-label":`${T} of ${E}`,children:[g.jsx("span",{className:"poker-card__rank",style:{fontSize:14},children:T}),g.jsx("span",{className:"poker-card__suit",style:{fontSize:11},children:P})]})};return g.jsxs("div",{className:"poker-avatar__faces","aria-label":"hole-cards",children:[g.jsx(m,{value:d[0]}),g.jsx(m,{value:d[1]})]})}if(n.has(u.id))return g.jsx("div",{className:"poker-avatar__bet","aria-label":"Folded",children:"Folded"});const h=`z${(r.get(u.id)||0).toLocaleString("en-US")}`;return g.jsx("div",{className:"poker-avatar__bet","aria-label":`Total bet ${h}`,children:h})},[a,r,n]);if(t.lite)return g.jsx(b6,{className:"",players:t.players,meId:t.meId,onOpenDM:t.onOpenDM,onOpenSendMoney:t.onOpenSendMoney,renderActionsOverride:u=>i({id:u.id})});const o=v.useMemo(()=>{const u=Array.isArray(t.gameState?.pokerSeats)?t.gameState.pokerSeats:[],d=new Map,f=new Set;for(const h of u){if(!h||!h.playerId)continue;const m=typeof h.stack=="number"?h.stack:void 0;typeof m=="number"&&d.set(String(h.playerId),m),f.add(String(h.playerId))}return t.players.map(h=>{const m=d.get(String(h.id));return typeof m=="number"?{...h,balance:m}:h})},[t.players]),c=v.useMemo(()=>g.jsx(ybe,{deadlineTs:t.turnDeadlineTs,isActive:!!t.isBettingStreet&&!!t.turnDeadlineTs,showTurnLabel:!!t.isHeroTurn}),[t.turnDeadlineTs,t.isBettingStreet,t.isHeroTurn]);return g.jsx(VA,{...t,className:"player-panel",players:o,hideDiceResults:!0,disableBankerFlash:!0,hideSideBets:!0,headerExtras:e,headerCommsLeftSlot:c,renderFacesOverride:u=>i(u)})}function kL(t){const e=t.gameState?.gameMode||"cee-lo";return e==="craps"?g.jsx(mbe,{...t}):e==="poker"?g.jsx(HA,{...t}):g.jsx(gbe,{...t})}function vbe(){const{remoteStreams:t}=gu(),e=v.useRef({}),[r,n]=v.useState(!1),a=async o=>{const c=o.srcObject;if(!c||!c.getAudioTracks().length)return!1;try{return await o.play(),!0}catch{return!1}};v.useEffect(()=>{let o=!1;for(const[u,d]of Object.entries(t)){const f=e.current[u];f&&f.srcObject!==d&&(f.srcObject=d)}(async()=>{for(const u of Object.values(e.current)){if(!u)continue;await a(u)||(o=!0)}n(o)})();for(const u of Object.keys(e.current))if(!t[u]){const d=e.current[u];if(d){try{d.pause()}catch{}d.srcObject=null}delete e.current[u]}},[t]);const i=async()=>{for(const o of Object.values(e.current))o&&await a(o);n(!1)};return g.jsxs(g.Fragment,{children:[Object.keys(t).map(o=>g.jsx("audio",{ref:c=>{e.current[o]=c},autoPlay:!0,playsInline:!0,muted:!1,style:{display:"none"},onError:c=>{}},o)),r&&g.jsx("button",{onClick:i,style:{position:"fixed",bottom:16,right:16,zIndex:9999,padding:"8px 12px",borderRadius:8,fontWeight:700,color:"#fff"},children:"Tap to enable audio"})]})}const C6=v.createContext(null),_be=()=>v.useContext(C6),Bu=t=>`room:${t}`,Ro=(t,e)=>`dm:${[t,e].sort().join("|")}`,bbe=t=>{if(!t.startsWith("dm:"))return null;const r=t.slice(3).split("|");return r.length===2?r:null},HE=(t,e)=>t.ts===e.ts?t.id<e.id?-1:t.id>e.id?1:0:t.ts-e.ts,wL=()=>"tmp:"+Math.random().toString(36).slice(2)+Date.now().toString(36),GE=t=>({id:t.id,ts:t.ts,senderId:t.fromUserId,text:t.text,roomId:t.roomId}),WE=t=>({id:t.id,ts:t.ts,senderId:t.fromUserId,text:t.text,toUserId:t.toUserId});function kbe({children:t}){const{user:e}=$r(),r=e?.id??"anon",{roomSendMessage:n,roomFetchHistory:a,dmSendMessage:i,dmFetchHistory:o}=pa(),[c,u]=v.useState({}),[d,f]=v.useState({}),[h,m]=v.useState(null),[_,w]=v.useState({}),b=v.useRef(new Set),{info:E}=uP(),T=G=>G?G.length>100?G.slice(0,100)+"…":G:"",D=v.useCallback((G,B,K)=>{if(B?.length&&(u(ae=>{const te=ae[G]??[],me=new Map;for(const Ae of te)Ae?.id&&me.set(Ae.id,Ae);for(const Ae of B){if(!Ae?.id)continue;const He=me.get(Ae.id);me.set(Ae.id,{...He??{},...Ae,pending:!1,error:void 0})}const ue=Array.from(me.values()).sort(HE);return{...ae,[G]:ue}}),G.startsWith("dm:")&&K?.fromPeerId)){const ae=K.fromPeerId,te=Ro(r,ae),me=h===ae,ue=B.filter(Ae=>Ae.senderId===ae).length;ue>0&&!me&&f(Ae=>({...Ae,[te]:(Ae[te]??0)+ue}))}},[h,r]),P=v.useCallback((G,B,K)=>{u(ae=>{const te=(ae[G]??[]).slice();return te.push(B),te.sort(HE),{...ae,[G]:te}}),(async()=>{try{const ae=await K();if(!ae?.ok||!ae.id)throw new Error(ae?.error||"send failed");const te=ae.id;b.current.add(te),u(me=>{const ue=me[G]??[],Ae=ue.some(ce=>ce.id===te);let He;return Ae?He=ue.filter(ce=>ce.id!==B.id):He=ue.map(ce=>ce.id===B.id?{...ce,id:te,pending:!1,error:void 0}:ce),He.sort(HE),{...me,[G]:He}})}catch(ae){u(te=>{const me=(te[G]??[]).map(ue=>ue.id===B.id?{...ue,pending:!1,error:ae?.message||"send failed"}:ue);return{...te,[G]:me}})}})()},[]),A=v.useCallback(G=>{u(B=>{if(!B[G])return B;const K={...B};return delete K[G],K}),G.startsWith("dm:")&&(f(B=>{if(!(G in B))return B;const K={...B};return delete K[G],K}),w(B=>{if(!(G in B))return B;const K={...B};return delete K[G],K}))},[]),C=v.useCallback(G=>(c[G]??[]).some(B=>B.pending),[c]),O=v.useCallback(G=>{const B=Bu(G);return Q(G),(c[B]??[]).slice()},[c]),I=v.useCallback((G,B)=>{const K=(B??"").trim();if(!K)return null;const ae=Bu(G),te=wL(),me={id:te,ts:Date.now(),senderId:r,text:K,roomId:G,pending:!0};return P(ae,me,()=>n(G,K)),te},[r,n,P]),x=v.useCallback(G=>A(Bu(G)),[A]),R=v.useCallback(G=>C(Bu(G)),[C]),N=v.useCallback(async G=>{const B=Ro(r,G);if(!_[B])try{const K=await o?.(G);if(K?.ok&&Array.isArray(K.messages)){const ae=K.messages.map(WE);D(B,ae),f(te=>({...te,[B]:0}))}}finally{w(K=>({...K,[B]:!0}))}},[o,D,r,_]),L=v.useCallback(G=>{const B=Ro(r,G);return N(G),(c[B]??[]).slice()},[c,r,N]),j=v.useCallback((G,B)=>{const K=(B??"").trim();if(!K)return null;const ae=Ro(r,G),te=wL(),me={id:te,ts:Date.now(),senderId:r,text:K,toUserId:G,pending:!0};return P(ae,me,()=>i(G,K)),te},[r,P,i]),q=v.useCallback(G=>A(Ro(r,G)),[A,r]),U=v.useCallback(G=>C(Ro(r,G)),[C,r]),W=v.useCallback(G=>{const B=Ro(r,G);f(K=>{if(!(B in K))return K;const ae={...K};return ae[B]=0,ae})},[r]),F=v.useCallback(G=>{m(G),G&&(W(G),N(G))},[W,N]),Y=v.useCallback(G=>{const B=[];for(const[K,ae]of Object.entries(c??{})){if(!K.startsWith("dm:"))continue;const te=bbe(K);if(!te)continue;const me=te[0]===r?te[1]:te[0];if(G&&me!==G)continue;const ue=ae[ae.length-1];B.push({peerUserId:me,last:ue,unread:d?.[K]??0,hasPending:ae.some(Ae=>Ae.pending)})}return B.sort((K,ae)=>(ae.last?.ts??0)-(K.last?.ts??0)),B},[c,d,r]);async function Q(G){const B=Bu(G);if(!(c[B]??[]).length)try{const K=await a?.(G);if(K?.ok&&Array.isArray(K.messages)){const ae=K.messages.map(GE);D(B,ae)}}catch{}}Pa({onRoomMessage:G=>{if(!(!G?.id||!G.roomId)&&!b.current.has(G.id)){b.current.add(G.id),D(Bu(G.roomId),[GE(G)]);try{E("Message",T(G.text))}catch{}}},onRoomHistory:({roomId:G,messages:B})=>{!G||!Array.isArray(B)||D(Bu(G),B.map(GE))},onDmMessage:G=>{if(!G?.id)return;const B=G.fromUserId===r?G.toUserId:G.fromUserId;if(!B)return;const K=Ro(r,B),ae=WE(G);if(D(K,[ae],{fromPeerId:G.fromUserId!==r?G.fromUserId:void 0}),G.fromUserId!==r)try{E("Direct Message",T(G.text))}catch{}h===B&&f(te=>({...te,[K]:0}))},onDmHistory:({peerUserId:G,messages:B})=>{if(!G||!Array.isArray(B))return;const K=Ro(r,G);D(K,B.map(WE)),h===G&&f(ae=>({...ae,[K]:0})),w(ae=>({...ae,[K]:!0}))}});const ie=v.useMemo(()=>({getRoomMessages:O,sendRoomMessage:I,clearRoom:x,roomHasPending:R,getDmMessages:L,sendDmMessage:j,clearDm:q,dmHasPending:U,getDmSummary:Y,markDmRead:W,setActiveDm:F,loadDmHistory:N,threads:c}),[O,I,x,R,L,j,q,U,Y,W,F,N,c]);return g.jsx(C6.Provider,{value:ie,children:t})}const wbe="_overlay_axsq0_3",Sbe="_overlayClosed_axsq0_14",Ebe="_drawer_axsq0_20",Tbe="_drawerClosed_axsq0_54",Cbe="_header_axsq0_65",xbe="_closeBtn_axsq0_75",Pbe="_body_axsq0_91",Abe="_threadList_axsq0_98",Rbe="_noPeers_axsq0_106",Dbe="_threadBtn_axsq0_113",Obe="_threadBtnActive_axsq0_132",Nbe="_avatar_axsq0_137",Ibe="_threadLabel_axsq0_151",Mbe="_threadName_axsq0_156",jbe="_threadPreview_axsq0_165",Lbe="_unreadBadge_axsq0_173",Bbe="_activeThread_axsq0_186",Ube="_scroller_axsq0_194",Fbe="_scrollerEmpty_axsq0_208",qbe="_message_axsq0_215",zbe="_messageMine_axsq0_230",$be="_messageContent_axsq0_238",Vbe="_messageTime_axsq0_246",Hbe="_pending_axsq0_257",Gbe="_error_axsq0_265",Wbe="_composer_axsq0_273",Kbe="_composerInput_axsq0_283",Ybe="_composerSend_axsq0_307",Xbe="_composerSendDisabled_axsq0_329",Jbe="_headerTitle_axsq0_394",Vr={overlay:wbe,overlayClosed:Sbe,drawer:Ebe,drawerClosed:Tbe,header:Cbe,closeBtn:xbe,body:Pbe,threadList:Abe,noPeers:Rbe,threadBtn:Dbe,threadBtnActive:Obe,avatar:Nbe,threadLabel:Ibe,threadName:Mbe,threadPreview:jbe,unreadBadge:Lbe,activeThread:Bbe,scroller:Ube,scrollerEmpty:Fbe,message:qbe,messageMine:zbe,messageContent:$be,messageTime:Vbe,pending:Hbe,error:Gbe,composer:Wbe,composerInput:Kbe,composerSend:Ybe,composerSendDisabled:Xbe,headerTitle:Jbe};function Qbe(t){if(!t)return"?";const r=t.split("@")[0].trim().split(/[\s._-]+/).filter(Boolean),n=(r[0]?.[0]??"").toUpperCase(),a=(r[1]?.[0]??"").toUpperCase();return n+a||n||"?"}function x6({open:t,onClose:e,peers:r,initialPeerId:n}){const{user:a}=$r(),i=a?.id??a?.email??"",{getDmSummary:o,getDmMessages:c,sendDmMessage:u,markDmRead:d,setActiveDm:f,threads:h,loadDmHistory:m}=_be(),[_,w]=v.useState(n??null),[b,E]=v.useState(""),T=v.useRef(!1),D=v.useRef(null);v.useEffect(()=>{if(!t){T.current=!1;return}if(T.current)return;T.current=!0;let j=null;if(n)j=n;else{const U=o()?.find(W=>W.unread>0);U?j=U.peerUserId:_?j=_:r.length&&(j=r[0].id)}j&&j!==_&&(w(j),f(j),m(j))},[t,n,r,_,o,f]),v.useEffect(()=>{!t||!_||D.current!==_&&(D.current=_,d(_))},[t,_,d]),v.useEffect(()=>{const j=document.body.style.overflow;return t?document.body.style.overflow="hidden":document.body.style.overflow=j,()=>{document.body.style.overflow=j}},[t]),v.useEffect(()=>{t&&requestAnimationFrame(()=>{window.scrollTo({top:0,left:0,behavior:"instant"})})},[t]),v.useEffect(()=>{const j=window.visualViewport;if(!j)return;const q=()=>{O.current&&(O.current.scrollTop=O.current.scrollHeight+1e3)};return j.addEventListener("resize",q),()=>{j.removeEventListener("resize",q)}},[]);const P=v.useMemo(()=>_?h?.[Ro(_,i)]??[]:[],[_,t,h]),A=v.useMemo(()=>o()??[],[t,P.length]),C=v.useMemo(()=>{const j=new Map;return A.forEach(q=>j.set(q.peerUserId,q)),j},[A]),O=v.useRef(null);v.useEffect(()=>{O.current&&(O.current.scrollTop=O.current.scrollHeight+1e3)},[P.length,_,t]);const I=j=>{w(j),f(j),d(j)},x=()=>{if(!_)return;const j=b.trim();if(!j)return;u(_,j)&&E("")},R=j=>{j.key==="Enter"&&!j.shiftKey&&(j.preventDefault(),x())},N=j=>{const q=r.find(U=>U.id===j);return q?.name||q?.email||j},L=j=>{const q=C.get(j);return q?.last?((q.last.senderId===i?"You: ":"")+q.last.text).trim():""};return g.jsxs(g.Fragment,{children:[g.jsx("div",{"aria-hidden":!t,onClick:e,className:`${Vr.overlay} ${t?"":Vr.overlayClosed}`}),g.jsxs("aside",{"aria-hidden":!t,role:"dialog","aria-label":"Direct Messages",className:`${Vr.drawer} ${t?"":Vr.drawerClosed}`,onClick:j=>j.stopPropagation(),children:[g.jsxs("div",{className:Vr.header,children:[g.jsx("strong",{className:Vr.headerTitle,children:"Messages"}),g.jsx("button",{onClick:e,className:Vr.closeBtn,"aria-label":"Close messages",children:"✕"})]}),g.jsxs("div",{className:Vr.body,children:[g.jsxs("div",{className:Vr.threadList,children:[r.length===0&&g.jsx("div",{className:Vr.noPeers,children:"No other players yet."}),r.map(j=>{const q=j.id===_,U=Qbe(j.name||j.email||j.id),W=C.get(j.id)?.unread??0,F=L(j.id);return g.jsxs("button",{onClick:()=>I(j.id),className:`${Vr.threadBtn} ${q?Vr.threadBtnActive:""}`,title:N(j.id),children:[g.jsx("div",{className:Vr.avatar,"aria-hidden":!0,children:U}),g.jsxs("div",{className:Vr.threadLabel,children:[g.jsx("div",{className:Vr.threadName,children:N(j.id)}),g.jsx("div",{className:Vr.threadPreview,children:F})]}),W>0&&g.jsx("span",{"aria-label":`${W} unread`,className:Vr.unreadBadge,children:W>99?"99+":W})]},j.id)})]}),g.jsxs("div",{className:Vr.activeThread,children:[g.jsxs("div",{ref:O,className:Vr.scroller,children:[!_&&g.jsx("div",{className:Vr.scrollerEmpty,children:"Select a conversation to begin."}),_&&P.map(j=>{const q=j.senderId===i,U=new Date(j.ts),W=U.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"});return g.jsxs("div",{className:`${Vr.message} ${q?Vr.messageMine:""}`,title:U.toLocaleString(),children:[g.jsx("div",{className:Vr.messageContent,children:j.text}),g.jsx("div",{className:Vr.messageTime,children:W}),j.pending&&g.jsx("div",{className:Vr.pending,children:"sending…"}),j.error&&g.jsx("div",{className:Vr.error,children:j.error})]},j.id)})]}),g.jsxs("div",{className:Vr.composer,children:[g.jsx("input",{value:b,onChange:j=>E(j.target.value),onKeyDown:R,placeholder:_?`Message ${N(_)}…`:"Pick a conversation…",disabled:!_,className:Vr.composerInput}),g.jsx("button",{onClick:x,disabled:!_||b.trim()==="",className:`${Vr.composerSend} ${!_||b.trim()===""?Vr.composerSendDisabled:""}`,children:"Send"})]})]})]})]})]})}function Zbe({roomId:t,lastRollerId:e,roundSeq:r,className:n,autoHideMs:a}){const{verifyFor:i,lastRoundWithReveal:o,proofs:c,reveals:u}=e6(t),[d,f]=v.useState("unverifiable"),h=v.useRef(0),[m,_]=v.useState({}),[w,b]=v.useState(!0),E=v.useMemo(()=>typeof r!="number"||!c?[]:Object.keys(c).filter(C=>C.startsWith(`${r}:`)),[c,r]),T=v.useMemo(()=>e||E.length&&E[E.length-1].split(":")[1]||null,[e,E]);v.useEffect(()=>{let C=!1;if(!i||!t||typeof r!="number"||!T)return f("unverifiable"),()=>{C=!0};const O=++h.current;return(async()=>{try{const I=await i(T,r);!C&&O===h.current&&f(I)}catch{!C&&O===h.current&&f("unverifiable")}})(),()=>{C=!0}},[i,t,T,r,E.length]),v.useEffect(()=>{if(!i||typeof r!="number")return;let C=!1;return E.forEach(O=>{const I=O.split(":")[1];I&&(async()=>{try{const x=await i(I,r);C||_(R=>R[O]===x?R:{...R,[O]:x})}catch{C||_(x=>x[O]==="unverifiable"?x:{...x,[O]:"unverifiable"})}})()}),()=>{C=!0}},[i,E,r,o]);const D=typeof r=="number"?!!u?.[r]:!1;if(v.useEffect(()=>{if(!a||a<=0||!D)return;b(!0);const C=window.setTimeout(()=>b(!1),a);return()=>window.clearTimeout(C)},[a,r,D]),!D||!w)return null;const P=E.filter(C=>m[C]==="verified").length,A=(()=>{if(E.length>1){if(P===E.length)return"All Verified";if(P>0)return`${P}/${E.length} Verified`}switch(d){case"verified":return"Provably Fair";case"bad-commit":return"Commit Mismatch";case"mismatch":return"Mismatch";default:return E.length?"Unverified":"Awaiting Reveal"}})();return g.jsxs("div",{className:["fairness-status-bar",n].filter(Boolean).join(" "),style:{display:"flex",alignItems:"center",gap:12,padding:"6px 12px",borderRadius:8,background:"rgba(0,0,0,.55)",backdropFilter:"blur(8px)",fontSize:12,lineHeight:1,color:"#fff",pointerEvents:"auto",boxShadow:"0 2px 6px rgba(0,0,0,.4)"},children:[g.jsx(bP,{state:d}),g.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[g.jsx("span",{style:{fontWeight:600},children:A}),typeof r=="number"&&g.jsxs("span",{style:{opacity:.75},children:["Round ",r]})]})]})}const e0e=({show:t,onComplete:e})=>{const[r,n]=v.useState(!1),[a,i]=v.useState(!1),[o,c]=v.useState(!1),u=v.useRef({fade:null,complete:null}),d=v.useRef(e);if(v.useEffect(()=>{d.current=e},[e]),v.useEffect(()=>(t?(u.current.fade&&clearTimeout(u.current.fade),u.current.complete&&clearTimeout(u.current.complete),n(!0),i(!1),c(!1),requestAnimationFrame(()=>{requestAnimationFrame(()=>{i(!0)})}),u.current.fade=setTimeout(()=>{c(!0)},3e3),u.current.complete=setTimeout(()=>{n(!1),i(!1),c(!1),d.current()},3400)):(u.current.fade&&clearTimeout(u.current.fade),u.current.complete&&clearTimeout(u.current.complete),n(!1),i(!1),c(!1)),()=>{u.current.fade&&clearTimeout(u.current.fade),u.current.complete&&clearTimeout(u.current.complete)}),[t]),!r)return null;const f=g.jsx("div",{className:`bang-bang-overlay ${o?"bang-bang-overlay--fadeout":""}`,"data-testid":"bang-bang-456-overlay",children:g.jsx("div",{className:"bang-bang-container",children:g.jsx("div",{className:`bang-bang-image ${a?"bang-bang-image--animating":""}`,role:"img","aria-label":"Bang Bang! Banker wins all with 456"})})});return Wc.createPortal(f,document.body)},t0e=({show:t,onComplete:e})=>{const[r,n]=v.useState(!1),[a,i]=v.useState(!1),[o,c]=v.useState(!1),u=v.useRef({fade:null,complete:null}),d=v.useRef(e);if(v.useEffect(()=>{d.current=e},[e]),v.useEffect(()=>(t?(u.current.fade&&clearTimeout(u.current.fade),u.current.complete&&clearTimeout(u.current.complete),n(!0),i(!1),c(!1),requestAnimationFrame(()=>{requestAnimationFrame(()=>{i(!0)})}),u.current.fade=setTimeout(()=>{c(!0)},3e3),u.current.complete=setTimeout(()=>{n(!1),i(!1),c(!1),d.current()},3400)):(u.current.fade&&clearTimeout(u.current.fade),u.current.complete&&clearTimeout(u.current.complete),n(!1),i(!1),c(!1)),()=>{u.current.fade&&clearTimeout(u.current.fade),u.current.complete&&clearTimeout(u.current.complete)}),[t]),!r)return null;const f=g.jsx("div",{className:`gotcha-overlay ${o?"gotcha-overlay--fadeout":""}`,"data-testid":"gotcha-clutch-overlay",children:g.jsx("div",{className:"gotcha-container",children:g.jsx("div",{className:`gotcha-image ${a?"gotcha-image--animating":""}`,role:"img","aria-label":"Gotcha! Clutch roll"})})});return Wc.createPortal(f,document.body)},SL=v.lazy(()=>qr(()=>import("./DiceBoard.component-A_WKEx_L.js"),__vite__mapDeps([3,4]),import.meta.url));function r0e(){const{roomId:t}=c3(),e=tn(),{user:r,meId:n}=$r(),{error:a}=cu();v.useEffect(()=>{const je=()=>{try{Dx()||Xr()}catch{}};je();const nt=["pointerdown","touchstart","mousedown","click","keydown"];return nt.forEach(Ct=>{document.addEventListener(Ct,je,{once:!0,capture:!0})}),()=>{nt.forEach(Ct=>{document.removeEventListener(Ct,je,{capture:!0})})}},[]);const i=n||r?.id||r?.email||"",[o,c]=v.useState(0),{rollTrigger:u,resetSpin:d}=Jo(),f=v.useRef(null),h=UA(t,i,{autoJoin:!0}),{room:m,joining:_,error:w,lastRollerId:b,deadline:E,serverNow:T,diceSettled:D}=h,P=Qz({roomId:t||null,myPlayerId:i,autoJoinOrder:!0}),A=m?.gameState?.gameMode==="craps"?P.shooterState:null,C=v.useMemo(()=>{const je=m?.gameState;if(je?.gameMode==="craps"){const nt=P.lastRoll?.point??null,Ct=nt??je.crapsPoint??null,jt=A?{...A}:{},De={...je,...jt,crapsPoint:Ct};return De.crapsPhase=Ct?"point":"come-out",De}return je},[m?.gameState,A,P.lastRoll]),O=v.useMemo(()=>{if(m?.gameState?.gameMode==="craps"){const je=P.lastRoll;return je&&Array.isArray(je.dice)?[je.dice[0],je.dice[1],0]:void 0}return h.diceResults},[m?.gameState?.gameMode,P.lastRoll,h.diceResults]),I=v.useMemo(()=>{if(m?.gameState?.gameMode!=="craps")return[];const je=m?.players??[],nt=A?.turnOrder||m?.gameState?.turnOrder||[];if(!nt.length)return je;const Ct=new Map(je.map(at=>[at.id,at])),jt=new Set(nt),De=nt.map(at=>{const we=Ct.get(at);if(we)return we;const st=at.includes("craps_bot_")||at.includes("bot_");return{id:at,name:st?"Bot":"Player",isReady:!0,balance:st?500:0,avatarUrl:null,isBot:st}}),et=je.filter(at=>!jt.has(at.id));return[...De,...et]},[m?.gameState?.gameMode,m?.players,A?.turnOrder,m?.gameState?.turnOrder]),{onCrapsShooterTurnEnd:x}=S0(),R=v.useRef(null);v.useEffect(()=>{if(m?.gameState?.gameMode!=="craps")return;const je=P.lastRoll;if(!je||R.current===je)return;R.current=je;const{currentRollerId:nt,nextRollerId:Ct}=je;nt&&Ct&&nt!==Ct&&x()},[P.lastRoll,m?.gameState?.gameMode,x]);const N=v.useRef(null),[L,j]=v.useState(1),[q,U]=v.useState(null),[W,F]=v.useState(!1),[Y,Q]=v.useState(void 0),ie=v.useMemo(()=>(m?.players??[]).filter(je=>je.id!==i).map(je=>({id:je.id,name:je.name})),[m?.players,i]),G=m?.gameState?.phase==="waiting"&&!u,B=v.useCallback(je=>{Q(je),F(!0)},[]),K=v.useCallback(()=>{F(!1),Q(void 0)},[]),ae=v.useRef(void 0);v.useEffect(()=>{const je=m?.gameState?.roundSeq;if(typeof je=="number"&&ae.current!==void 0&&je!==ae.current&&(c(0),(m?.gameState?.gameMode||"cee-lo")==="cee-lo")){const nt=m?.gameState?.banker,Ct=nt&&i&&nt===i;try{Ct||gT({volume:.6})}catch{}}typeof je=="number"&&(ae.current=je)},[m?.gameState?.roundSeq]);const te=ks(),{joinRoom:me}=Mi(),[ue,Ae]=v.useState(!1);v.useCallback(async()=>{if(!ue&&!(!te||!t)){Ae(!0);try{if(me)try{await me(t)}catch{}}catch{}finally{Ae(!1)}}},[ue,te,t,me]),v.useEffect(()=>{if(!te)return;const je=()=>{try{d()}catch{}};return te.on("disconnect",je),()=>{te.off("disconnect",je)}},[te,d]),v.useEffect(()=>{requestAnimationFrame(()=>{window.scrollTo({top:0,left:0,behavior:"instant"})})},[]);const[He,ce]=v.useState(()=>typeof window>"u"?!1:window.innerWidth>window.innerHeight);v.useEffect(()=>{const je=()=>ce(window.innerWidth>window.innerHeight);window.addEventListener("resize",je);const nt=setTimeout(je,0);return()=>{window.removeEventListener("resize",je),clearTimeout(nt)}},[]),v.useEffect(()=>{w&&a(w,{title:"Room Error",duration:5e3})},[w,a]);const xe=v.useRef(0),re=v.useRef(!1),H=v.useRef(!1),he=v.useRef(!1),Re=v.useRef(null),fe=v.useRef(null),[Ie,ct]=v.useState(0),[$e,rt]=v.useState(!1),[We,it]=v.useState(!1),[Et,Mt]=v.useState(!1);v.useEffect(()=>{const je=m?.gameState?.gameMode;if(!je)return;let nt=!0;return(async()=>{try{const{Preferences:Ct}=await qr(async()=>{const{Preferences:et}=await Promise.resolve().then(()=>Nc);return{Preferences:et}},void 0,import.meta.url),jt=je==="craps"?"onb_craps_v1":"onb_ceelo_v1",{value:De}=await Ct.get({key:jt});if(!nt)return;Mt(De!=="1")}catch{if(!nt)return;Mt(!0)}})(),()=>{nt=!1}},[m?.gameState?.gameMode]);const _t=v.useCallback(()=>{const je=m?.gameState?.gameMode;(async()=>{try{const{Preferences:nt}=await qr(async()=>{const{Preferences:Ct}=await Promise.resolve().then(()=>Nc);return{Preferences:Ct}},void 0,import.meta.url);await nt.set({key:je==="craps"?"onb_craps_v1":"onb_ceelo_v1",value:"1"})}catch{}Mt(!1)})()},[m?.gameState?.gameMode]);if(v.useEffect(()=>{if(m?.gameState?.gameMode==="craps"){re.current=!1,H.current=!1;return}const je=m?.singlePlayer===!0,nt=m?.gameState?.banker,Ct=nt&&i&&nt===i,jt=h?.diceResults;if(!jt||jt.length!==3){re.current=!1,H.current=!1,Re.current=null;return}const De=jt.join(",");if(De===Re.current)return;Re.current=De;const et=[...jt].sort().join(","),at=et==="4,5,6",we=at||et==="1,2,3";je||!Ct?(re.current=we,H.current=at):(re.current=!1,H.current=!1)},[h?.diceResults,m?.gameState?.gameMode,m?.gameState,i]),v.useEffect(()=>{if(m?.gameState?.gameMode==="craps"){fe.current=null;return}const je=m?.gameState?.bankRoll;if(!je||!Array.isArray(je.raw)||je.raw.length!==3){fe.current=null;return}const nt=je.raw,Ct={};for(const et of nt)Ct[et]=(Ct[et]||0)+1;const jt=Object.keys(Ct).map(Number);jt.length===2&&jt.some(et=>Ct[et]===1)?fe.current=jt.find(et=>Ct[et]===1)||null:fe.current=null},[m?.gameState?.bankRoll,m?.gameState?.gameMode]),v.useEffect(()=>{if(m?.gameState?.gameMode==="craps"){he.current=!1;return}const je=m?.gameState?.banker;if(je&&i&&je===i){he.current=!1;return}const Ct=fe.current;if(Ct!==6){he.current=!1;return}const jt=h?.diceResults;if(!jt||jt.length!==3){he.current=!1;return}const De={};for(const we of jt)De[we]=(De[we]||0)+1;const et=Object.keys(De).map(Number);if(et.length===2&&et.some(we=>De[we]===1)){const we=et.find(st=>De[st]===1);we&&we>Ct?he.current=!0:he.current=!1}else{const we=et.length===1;he.current=we}},[h?.diceResults,m?.gameState,i,m?.gameState?.gameMode]),v.useEffect(()=>{if(!h?.diceSettled)return;const je=Date.now();if(re.current||H.current||he.current){if(je-xe.current<800){re.current=!1,H.current=!1,he.current=!1;return}xe.current=je,H.current&&rt(!0),he.current&&it(!0),re.current=!1,H.current=!1,he.current=!1,ct(nt=>nt+1)}},[h?.diceSettled]),_)return g.jsxs("div",{className:"HomeScreen theme-casino home-fixed-root",children:[g.jsx(ji,{className:"page-home-screen"}),g.jsx("div",{className:"home-preloader",children:g.jsx("div",{className:"home-preloader__spinner"})})]});if(!m)return g.jsxs("div",{className:"HomeScreen theme-casino",children:[g.jsx(ji,{className:"page-gameroom"}),g.jsx("div",{className:"room-grid-fit",children:g.jsxs("div",{className:"error-grid",children:[g.jsx("p",{className:"error text-center",children:"Room not found."}),g.jsx("button",{className:"felt-btn felt-btn--secondary",onClick:()=>e("/lobby"),children:"Back to lobby"})]})})]});const ge=m.gameState?.gameMode==="craps",Be=m.gameState?.gameMode!=="craps";return g.jsxs(n0e,{className:ge?"mode-craps":Be?"mode-ceelo":void 0,bgShakeTrigger:Ie,children:[g.jsx(ji,{className:"page-gameroom"}),g.jsx(S_e,{}),g.jsx(fP,{open:Et,onClose:_t,title:ge?"Craps":"Cee‑Lo",tagline:ge?"Place your bets and roll the point.":"Banker vs challengers. Roll to win.",steps:ge?["Place Pass/Don’t Pass (optional Place bets)","Shooter rolls: establish point or win/lose on come-out","Resolve bets on each roll"]:["Banker faces challengers each round","Place a MAIN bet to challenge the banker","Highest valid roll wins the pot"],primaryLabel:"Got it",persistKey:ge?"onb_craps_v1":"onb_ceelo_v1"}),g.jsxs("div",{className:"room-grid-fit",style:!He&&q&&!ge?{height:q}:void 0,children:[g.jsx("div",{className:"fairness-container",children:g.jsx(Zbe,{roomId:t,lastRollerId:b,roundSeq:m?.gameState?.roundSeq,autoHideMs:ge?3e3:void 0})}),g.jsx("div",{ref:N,className:"room-grid"+(ge?" room-grid--craps":"")+(L<.999?" room-grid--scaled":""),style:L<.999?{transform:`scale(${L})`,transformOrigin:"top center",height:q||void 0}:void 0,children:ge?g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"players-row",children:g.jsx(kL,{className:"PlayerPanel",roomId:t,roomName:m.name,players:I,bankerId:m.gameState?.banker,currentRollerId:m.gameState?.currentRollerId,meId:i,gameState:C,lastRollerId:b,onOpenDM:B,onOpenSendMoney:()=>{},crapsRollHistory:P.rollHistory,singlePlayer:m?.singlePlayer})}),g.jsx("div",{className:"stage",ref:f,children:g.jsx("div",{className:"table-wrap",children:g.jsx("div",{className:`felt ${G?"is-muted":""}`,children:g.jsx(SL,{isWaiting:G,rollTrigger:u,results:O,preRollTrigger:o,gameMode:m.gameState?.gameMode,gameState:C,zoom:L<.999?13:15})})})}),g.jsx("div",{className:"bets-wrapper bets-wrapper--craps",children:(()=>{const nt=m.players.find(Ct=>Ct.id===i)?.balance??r?.balance??1e3;return g.jsx(w_e,{meId:i,balance:nt})})()})]}):g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"players-row",children:g.jsx(kL,{className:"player-panel",roomId:t,roomName:m.name,players:m.gameState.turnOrder.map(je=>m.players.find(nt=>nt.id===je)).filter(je=>!!je),bankerId:m.gameState?.banker,currentRollerId:m.gameState?.currentRollerId,meId:i,gameState:C,lastRollerId:b,onOpenDM:B,onOpenSendMoney:()=>{},singlePlayer:m?.singlePlayer})}),g.jsxs("div",{className:"stage",ref:f,children:[g.jsx(Eye,{gameMode:m.gameState?.gameMode,gameState:C}),g.jsx("div",{className:"table-wrap",children:g.jsx("div",{className:`felt ${G?"is-muted":""}`,children:g.jsx(SL,{isWaiting:G,rollTrigger:u,results:O,preRollTrigger:o,gameMode:m.gameState?.gameMode,gameState:C,zoom:L<.999?13:15})})})]}),g.jsxs("div",{className:"grid-body",children:[g.jsx("div",{className:"bets-wrapper",children:g.jsx(kye,{gameState:m.gameState,roundEnded:m.gameState.roundEnded,roomId:t,meId:i,bankerId:m.gameState.banker,hasBankRoll:!!m.gameState.bankRoll,players:m.players,timeLeft:{deadline:E,serverNow:T},showPassBank:!1,showSpectateRow:!1,gameplay:h})}),g.jsx("div",{className:"spectate-wrapper",children:g.jsx(P_e,{roomId:t,meId:i,bankerId:m.gameState.banker,players:m.players,gameState:C,gameplay:h})})]})]})})]}),g.jsx(vbe,{}),g.jsx(x6,{open:W,onClose:K,peers:ie,initialPeerId:Y}),g.jsx(e0e,{show:$e,onComplete:()=>rt(!1)}),g.jsx(t0e,{show:We,onComplete:()=>it(!1)})]})}function n0e({children:t,className:e,bgShakeTrigger:r}){const n=v.useRef(null),a=v.useRef(!0),{showAnimations:i}=$A();return v.useEffect(()=>{n.current&&n.current.classList.remove("fx-bg-shake")},[]),v.useEffect(()=>{if(!n.current||typeof r!="number"||i===!1)return;if(a.current||r===0){a.current=!1;return}n.current.classList.remove("fx-bg-shake"),n.current.offsetHeight,n.current.classList.add("fx-bg-shake");const o=()=>{n.current?.classList.remove("fx-bg-shake")};return n.current.addEventListener("animationend",o,{once:!0}),()=>{n.current?.removeEventListener("animationend",o)}},[r,i]),g.jsxs("div",{ref:n,className:"room-shell"+(e?` ${e}`:""),children:[g.jsx("div",{className:"orientation-lock",role:"dialog","aria-label":"Rotate to portrait",children:g.jsxs("div",{className:"orientation-lock__content",children:[g.jsx("div",{className:"orientation-lock__icon","aria-hidden":"true",children:"🔁"}),g.jsx("div",{className:"orientation-lock__title",children:"Rotate your device"}),g.jsx("div",{className:"orientation-lock__text",children:"Portrait is required on mobile web."})]})}),t]})}function a0e(){const{user:t,refreshUser:e,logout:r}=$r(),{updateProfile:n}=pa(),{membershipModalOpen:a,setMembershipModalOpen:i}=Bb(),{friends:o,friendRequests:c,blockedUsers:u,refreshSocial:d,isBlocked:f,blockUser:h,unblockUser:m,removeFriend:_,respondToFriendRequest:w}=FA(),[b,E]=v.useState(!1),[T,D]=v.useState(),{forUserId:P,anchorRect:A,anchorEl:C,openFor:O,close:I}=qA(),[x,R]=v.useState(null),[N,L]=v.useState(null),j=v.useCallback((Ye,Yt,At,Rt)=>{O(Ye,Yt),R(At),L(Rt||null)},[O]),q=v.useCallback(()=>{I(),R(null),L(null)},[I]),[U,W]=v.useState(t?.name??""),[F,Y]=v.useState(t?.email??""),[Q,ie]=v.useState(t?.avatarUrl??""),[G,B]=v.useState(!1),[K,ae]=v.useState(null),[te,me]=v.useState(!1),[ue,Ae]=v.useState(null),[He,ce]=v.useState(!1),[xe,re]=v.useState(null),H=v.useRef(null),{onBuyChips:he,onGoPremium:Re,onRestore:fe,busy:Ie,busyChips:ct,ready:$e,purchasesReady:rt,isWeb:We,premiumActive:it,hasPremiumPackage:Et,premiumLabel:Mt,premiumSubtitle:_t,premiumDescription:ge,premiumPrice:Be,premiumInterval:je}=Lg(),[nt,Ct]=v.useState(!!t?.botChatDisabled),[jt,De]=v.useState(t?.ceeloBotsPerRoom??null),[et,at]=v.useState(t?.crapsBotsPerRoom??null),[we,st]=v.useState(t?.pokerBotsPerRoom??null);v.useEffect(()=>{W(t?.name??""),Y(t?.email??""),ie(t?.avatarUrl??""),Ct(!!t?.botChatDisabled),De(t?.ceeloBotsPerRoom??null),at(t?.crapsBotsPerRoom??null),st(t?.pokerBotsPerRoom??null)},[t?.id,t?.name,t?.email,t?.avatarUrl,t?.botChatDisabled,t?.ceeloBotsPerRoom,t?.crapsBotsPerRoom,t?.pokerBotsPerRoom]),v.useEffect(()=>{d()},[]);const bt=v.useCallback(async()=>{B(!0),ae(null);try{const Ye={};U!==t?.name&&(Ye.name=U),F!==t?.email&&(Ye.email=F),Q!==t?.avatarUrl&&(Ye.avatarUrl=Q),typeof nt=="boolean"&&(Ye.botChatDisabled=nt);const Yt=rf||WD,At=rf||Vo,Rt=rf||Ho;Yt&&jt!==(t?.ceeloBotsPerRoom??null)&&(Ye.ceeloBotsPerRoom=jt),At&&et!==(t?.crapsBotsPerRoom??null)&&(Ye.crapsBotsPerRoom=et),Rt&&we!==(t?.pokerBotsPerRoom??null)&&(Ye.pokerBotsPerRoom=we);const Dt=await n(Ye);if(!Dt?.ok)ae(Dt?.error||"Failed to save");else{try{await e({force:!0})}catch{}await d()}}catch(Ye){ae(Ye?.message||"Failed to save")}finally{B(!1)}},[U,F,Q,t?.name,t?.email,t?.avatarUrl,n,d,e,jt,et,we,nt]),nr=v.useCallback(async Ye=>{f(Ye)?await m(Ye):await h(Ye)},[f,h,m]),ur=v.useCallback(Ye=>{_(Ye)},[_]),dr=v.useCallback(Ye=>{D(Ye),E(!0)},[]),Sr=v.useCallback(()=>{E(!1),D(void 0)},[]),un=v.useCallback(async Ye=>{await w(Ye.id,"ACCEPT")},[w]);v.useCallback(async Ye=>{await w(Ye.id,"DECLINE")},[w]);const Z=v.useCallback(async Ye=>{me(!0),Ae(null);try{if(Ye.size>5242880){Ae("File size must be less than 5MB");return}if(!["image/jpeg","image/jpg","image/png","image/webp","image/gif"].includes(Ye.type)){Ae("File must be a valid image (JPEG, PNG, WebP, or GIF)");return}const Rt=new FormData;Rt.append("avatar",Ye);const Dt=String(GD??"http://localhost:4000").replace(/\/+$/,"");let Nn={},dn;try{const pn=await oi();pn&&(Nn={Authorization:`Bearer ${pn}`},dn=pn)}catch{}const jr=new URL(`${Dt}/api/avatar/upload`);dn&&jr.searchParams.set("token",dn);const Ra=await fetch(jr.toString(),{method:"POST",body:Rt,headers:Nn,credentials:"include"});if(!Ra.ok){const pn=await Ra.json().catch(()=>({error:"Upload failed"}));throw new Error(pn.error||`Upload failed with status ${Ra.status}`)}const co=await Ra.json();co.avatarUrl&&ie(co.avatarUrl)}catch(Yt){Ae(Yt?.message||"Failed to upload avatar")}finally{me(!1)}},[]),X=v.useCallback(Ye=>{const Yt=Ye.target.files?.[0];Yt&&Z(Yt),H.current&&(H.current.value="")},[Z]),le=v.useCallback(()=>{if(!(t?.membershipTier==="PREMIUM")){try{i(!0)}catch{}return}H.current?.click()},[t,i]),be=v.useMemo(()=>{const Ye=new Map;for(const Yt of o)Ye.set(Yt.id,Yt);for(const Yt of u)Ye.has(Yt.id)||Ye.set(Yt.id,Yt);return Ye},[o,u]),z=v.useMemo(()=>c.map(Ye=>{const Yt=t?.id===Ye.toUserId,At=Yt?Ye.fromUserId:Ye.toUserId;if(!At)return null;const Rt=(Yt?Ye.fromUser:Ye.toUser)||be.get(At),Dt=Rt?.name??At,Nn=Rt?.avatarUrl??void 0;return{id:At,name:Dt,avatarUrl:Nn,_req:Ye,_incoming:Yt}}).filter(Boolean),[c,t?.id,be]),{showAnimations:ee,toggleAnimations:se,ready:Oe}=$A(),[wt,er]=v.useState(Dc.diceColorTheme);v.useEffect(()=>{(async()=>{try{const Ye=await au();er(Ye.diceColorTheme??Dc.diceColorTheme)}catch{er(Dc.diceColorTheme)}})()},[]);const Qt=v.useCallback(async Ye=>{try{if(!(t?.membershipTier==="PREMIUM")&&Ye!=="dice_white_black"){try{i(!0)}catch{}return}const At=await au(),Rt={...Dc,...At,diceColorTheme:Ye};await y0(Rt),er(Ye)}catch{}},[t,i]),Zt=v.useCallback(()=>i(!1),[i]);v.useEffect(()=>{e()},[]);const oa=tn(),On=v.useCallback(async()=>{try{if(re(null),!window.confirm("Are you sure you want to permanently delete your account? This action cannot be undone."))return;const Yt=String(GD??"http://localhost:4000").replace(/\/+$/,"");let At;try{const Dt=await oi();Dt&&(At={Authorization:`Bearer ${Dt}`})}catch{}const Rt=await fetch(`${Yt}/api/account`,{method:"DELETE",credentials:"include",headers:At});if(!Rt.ok){const Dt=await Rt.json().catch(()=>({error:"Deletion failed"}));throw new Error(Dt.error||`Failed with status ${Rt.status}`)}}catch(Ye){re(Ye?.message||"Failed to delete account")}finally{r()}},[oa]);return g.jsxs("div",{className:"theme-casino home-fixed-root add-chips",children:[g.jsx(ji,{className:"profile-page-body"}),g.jsx("div",{className:"logout-container  home-header-row",children:g.jsxs("a",{className:"gold-link white-link gold-link--mini","data-no-global-haptic":!0,onClick:()=>{try{cr("Light")}catch{}history.back()},children:[g.jsx(bd,{className:"icon",style:{color:"var(--gold, #caa64d)"}})," Back"]})}),g.jsx("div",{className:"profile-page",children:g.jsx("div",{className:"home-fit-shell",children:g.jsx("div",{className:"home-fit-content",children:g.jsxs("div",{className:"profile-content",children:[g.jsx("div",{className:"profile-row profile-row--two",children:g.jsxs("div",{className:"profile-section",children:[g.jsxs("strong",{children:["Avatar: ",g.jsx("span",{className:"badge",style:{marginLeft:"8px",fontSize:"0.75em",padding:"2px 8px",background:"linear-gradient(135deg, #FFD700, #FFA500)",color:"#000",fontWeight:600},children:"PREMIUM"})]}),g.jsxs("div",{className:"editable-field",style:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"16px"},children:[Q&&g.jsx("img",{src:Q,alt:"Avatar preview",style:{width:"120px",height:"120px",borderRadius:"50%",objectFit:"cover",border:"3px solid var(--gold, #caa64d)"}}),g.jsxs("div",{style:{width:"100%",textAlign:"left"},children:[g.jsx("input",{ref:H,type:"file",accept:"image/jpeg,image/jpg,image/png,image/webp,image/gif",onChange:X,disabled:te,style:{display:"none"}}),g.jsx("button",{className:"felt-btn","data-no-global-haptic":!0,onClick:()=>{try{cr("Light")}catch{}le()},disabled:te,style:{marginBottom:"8px"},children:te?"Uploading...":"Upload Avatar"}),g.jsx("div",{className:"subtle",style:{fontSize:"0.85em",marginTop:"4px"},children:"Max 5MB • JPEG, PNG, WebP, or GIF"}),ue&&g.jsxs("div",{className:"error-message",style:{marginTop:"8px"},children:[ue,ue.includes("Premium")&&g.jsx("div",{style:{marginTop:"8px"},children:g.jsx("button",{className:"felt-btn","data-no-global-haptic":!0,onClick:()=>{try{cr("Light")}catch{}Re()},style:{fontSize:"0.9em",padding:"6px 12px"},children:"Upgrade to Premium"})})]})]})]})]})}),g.jsxs("div",{className:"profile-section",children:[g.jsx("strong",{children:"Friends:"}),o.length?g.jsx("div",{className:"friends-scroll",children:g.jsx(E_,{className:"friends-panel",players:o,meId:t?.id||"",onPlayerClick:Ye=>{const At=document.querySelector(`[data-player-id="${Ye}"]`)?.querySelector(".avatar-ring");At&&j(Ye,At,"friends")}})}):g.jsx("span",{children:"No friends yet"})]}),g.jsxs("div",{className:"profile-section",children:[g.jsx("strong",{children:"Friend Requests:"}),z.length?g.jsx("div",{className:"friends-scroll",children:g.jsx(E_,{className:"friends-panel",players:z,meId:t?.id||"",onPlayerClick:Ye=>{const At=document.querySelector(`[data-player-id="${Ye}"]`)?.querySelector(".avatar-ring"),Rt=z.find(Dt=>Dt.id===Ye);At&&Rt?._req&&j(Ye,At,"requests",{id:Rt._req.id,incoming:!!Rt._incoming})}})}):g.jsx("span",{children:"No pending requests"})]}),g.jsxs("div",{className:"profile-section",children:[g.jsx("strong",{children:"Blocked Users:"}),u.length?g.jsx("div",{className:"friends-scroll",children:g.jsx(E_,{className:"friends-panel",players:u,meId:t?.id||"",onPlayerClick:Ye=>{const At=document.querySelector(`[data-player-id="${Ye}"]`)?.querySelector(".avatar-ring");At&&j(Ye,At,"blocked")}})}):g.jsx("span",{children:"No blocked users"})]}),P&&A&&x&&g.jsx(y6,{anchorRect:A,anchorEl:C,onClose:q,onMessages:x==="friends"?()=>{dr(P),q()}:void 0,onUnfriend:x==="friends"?()=>{ur(P),q()}:void 0,onBlockUser:x!=="requests"?async()=>{await nr(P),q()}:void 0,isFriend:x==="friends",isBlocked:x==="blocked",...x==="requests"&&N?.incoming?{onAddFriend:()=>{un({id:N.id}),q()},hideAddFriend:!1}:{}}),g.jsxs("div",{className:"profile-row profile-row--two",children:[g.jsxs("div",{className:"profile-section",children:[g.jsx("strong",{children:"Name:"}),g.jsx("div",{className:"editable-field",children:g.jsx("input",{type:"text",value:U,onChange:Ye=>W(Ye.target.value),disabled:G})})]}),g.jsxs("div",{className:"profile-section",children:[g.jsx("strong",{children:"Email:"}),g.jsx("div",{className:"editable-field",children:g.jsx("input",{type:"email",value:F,onChange:Ye=>Y(Ye.target.value),disabled:G})})]})]}),(()=>{const Ye=rf||WD,Yt=rf||Vo,At=rf||Ho;return g.jsxs(g.Fragment,{children:[(Ye||Yt)&&g.jsxs("div",{className:"profile-row profile-row--two",children:[Ye&&g.jsxs("div",{className:"profile-section",children:[g.jsx("strong",{children:"Single‑player bots (Cee‑Lo):"}),g.jsxs("div",{className:"editable-field",children:[g.jsxs("select",{value:jt==null?"":String(jt),onChange:Rt=>{const Dt=Rt.target.value;De(Dt===""?null:Math.max(0,Math.min(8,Math.trunc(Number(Dt)))))},disabled:G,"aria-label":"Preferred number of bots in single-player Cee‑Lo rooms",children:[g.jsx("option",{value:"",children:"Default"}),Array.from({length:5}).map((Rt,Dt)=>g.jsx("option",{value:Dt,children:Dt},Dt))]}),g.jsx("div",{className:"subtle",children:"Applies when you create single‑player rooms."})]})]}),Yt&&g.jsxs("div",{className:"profile-section",children:[g.jsx("strong",{children:"Single‑player bots (Craps):"}),g.jsxs("div",{className:"editable-field",children:[g.jsxs("select",{value:et==null?"":String(et),onChange:Rt=>{const Dt=Rt.target.value;at(Dt===""?null:Math.max(0,Math.min(8,Math.trunc(Number(Dt)))))},disabled:G,"aria-label":"Preferred number of bots in single-player Craps rooms",children:[g.jsx("option",{value:"",children:"Default"}),Array.from({length:5}).map((Rt,Dt)=>g.jsx("option",{value:Dt,children:Dt},Dt))]}),g.jsx("div",{className:"subtle",children:"Applies when you create single‑player rooms."})]})]})]}),At&&g.jsx("div",{className:"profile-row profile-row--two",children:g.jsxs("div",{className:"profile-section",children:[g.jsx("strong",{children:"Single‑player bots (Poker):"}),g.jsxs("div",{className:"editable-field",children:[g.jsxs("select",{value:we==null?"":String(we),onChange:Rt=>{const Dt=Rt.target.value;st(Dt===""?null:Math.max(0,Math.min(8,Math.trunc(Number(Dt)))))},disabled:G,"aria-label":"Preferred number of bots in single-player Poker rooms",children:[g.jsx("option",{value:"",children:"Default"}),Array.from({length:5}).map((Rt,Dt)=>g.jsx("option",{value:Dt,children:Dt},Dt))]}),g.jsx("div",{className:"subtle",children:"Applies when you create single‑player rooms."})]})]})})]})})(),g.jsx("div",{className:"profile-row",children:g.jsx("div",{className:"profile-section",children:g.jsxs("div",{className:"editable-field",children:[g.jsx("button",{className:"felt-btn","data-no-global-haptic":!0,onClick:()=>{try{cr("Light")}catch{}bt()},disabled:G,children:G?"Saving...":"Save Profile"}),K&&g.jsx("div",{className:"error-message",children:K})]})})}),g.jsxs("div",{className:"profile-row profile-row--two",children:[g.jsxs("div",{className:"profile-section",children:[g.jsx("strong",{children:"Animations:"}),g.jsxs("div",{className:"editable-field",style:{display:"flex",alignItems:"center",gap:8},children:[g.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:13},children:[g.jsx("input",{type:"checkbox",disabled:!Oe,checked:!!ee,onChange:()=>se(),"aria-label":ee?"Disable animations (dice physics, chip flights, background shake)":"Enable animations (dice physics, chip flights, background shake)"}),g.jsx("span",{children:ee?"Enabled":"Disabled"})]}),g.jsx("div",{className:"subtle",style:{opacity:.7},children:ee?"Full motion effects active.":"Reduced motion: static dice & suppressed decorative effects."})]})]}),g.jsxs("div",{className:"profile-section",children:[g.jsx("strong",{children:"Dice Color (Cee‑Lo & Craps):"}),g.jsxs("div",{className:"editable-field",style:{display:"flex",alignItems:"center",gap:12,flexWrap:"wrap"},children:[g.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:13},children:[g.jsx("input",{type:"radio",name:"dice-color",value:"dice_red_white",checked:wt==="dice_red_white",onChange:()=>Qt("dice_red_white"),"aria-label":"Use red/white dice"}),g.jsx("span",{children:"Red/White"})]}),g.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:13},children:[g.jsx("input",{type:"radio",name:"dice-color",value:"dice_green_gold",checked:wt==="dice_green_gold",onChange:()=>Qt("dice_green_gold"),"aria-label":"Use green/gold dice"}),g.jsx("span",{children:"Green/Gold"})]}),g.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:13},children:[g.jsx("input",{type:"radio",name:"dice-color",value:"dice_white_black",checked:wt==="dice_white_black",onChange:()=>Qt("dice_white_black"),"aria-label":"Use white/black dice (default)"}),g.jsx("span",{children:"White/Black"})]})]})]})]}),g.jsxs("div",{className:"profile-row profile-row--two",children:[g.jsxs("div",{className:"profile-section",children:[g.jsxs("strong",{children:["Balance: ",rd.formatMoney(t?.balance,"",2)]}),g.jsx("div",{className:"editable-field",children:g.jsx("button",{className:"felt-btn felt-btn--halo","data-no-global-haptic":!0,onClick:()=>{try{cr("Light")}catch{}try{he()}catch{}},disabled:G||Ie||!$e||!rt,"aria-label":We?"Buy 1000 Z Credits":"Buy 1000 Z Credits (App Store / Play)",title:We?"Buy 1000 Z Credits":"Buy 1000 Z Credits (App Store / Play)",children:ct?"Purchasing...":"Buy Credits"})}),g.jsx("strong",{children:"Restore:"}),g.jsx("div",{className:"editable-field",children:g.jsx("button",{className:"felt-btn","data-no-global-haptic":!0,onClick:()=>{try{cr("Light")}catch{}try{fe()}catch{}},disabled:Ie||!$e||!rt,title:"Restore Purchases","aria-label":"Restore Purchases",children:"Restore"})})]}),g.jsxs("div",{className:"profile-section",children:[g.jsxs("strong",{children:["Membership:                                         ",t?.membershipTier===k_.PREMIUM?"Premium Active":"Free",g.jsx("span",{className:"badge","aria-live":"polite",children:t?.membershipTier===k_.PREMIUM?"P":""})]}),g.jsxs("div",{className:"editable-field",children:[t?.membershipTier===k_.PREMIUM?g.jsx(dP,{isPremium:!0,className:"felt-btn"}):Et&&g.jsx("button",{className:"felt-btn","data-no-global-haptic":!0,onClick:()=>{try{cr("Light")}catch{}try{Re()}catch{}},disabled:Ie,"aria-label":Mt,title:Mt,children:"Go Premium"}),!it&&Et&&g.jsx("div",{className:"meta",style:{marginTop:6},children:(()=>{const Ye="$1.99",Yt="Monthly",At=Be||Ye,Rt=je||Yt,Dt=_t||`${At} Mo`,Nn=ge||"Remove ads and unlock premium features.";return g.jsxs(g.Fragment,{children:[Dt&&g.jsx("div",{className:"subtle","aria-hidden":!0,children:Dt}),g.jsx("div",{className:"legal-note","aria-hidden":!0,children:Nn}),g.jsxs("div",{className:"legal-note",role:"note",children:[g.jsx("strong",{children:"Premium Subscription"})," — ",At," (",Rt,"). Auto‑renews until canceled. Manage or cancel in account settings on your device. See our ",g.jsx("a",{href:"/privacy",className:"legal-link",children:"Privacy Policy"})," and ",g.jsx("a",{href:"/terms",className:"legal-link",children:"Terms of Use"}),"."]})]})})()})]})]})]}),g.jsx("div",{className:"profile-row",children:g.jsxs("div",{className:"profile-section",children:[g.jsx("strong",{children:"Account:"}),g.jsxs("div",{className:"editable-field",style:{display:"flex",flexDirection:"column",gap:8},children:[g.jsx("div",{className:"legal-note",children:"Deleting your account is permanent and cannot be undone."}),g.jsx("button",{className:"felt-btn felt-btn--danger","data-no-global-haptic":!0,onClick:()=>{try{cr("Light")}catch{}On()},disabled:He,"aria-label":"Delete Account",title:"Delete Account",children:He?"Deleting…":"Delete Account"}),xe&&g.jsx("div",{className:"error-message",children:xe})]})]})})]})})})}),g.jsx(pF,{open:a,onClose:Zt,planId:t?.membershipTier,featureDescription:"Upload custom avatars and create multiplayer rooms with Premium membership."}),g.jsx(x6,{open:b,onClose:Sr,peers:o,initialPeerId:T}),g.jsx(_P,{})]})}function i0e(){const[t,e]=v.useState(Dc),[r,n]=v.useState(!1),a=v.useRef(null);v.useEffect(()=>{let o=!0;return(async()=>{const c=await au();o&&(e(c),n(!0))})(),()=>{o=!1,a.current&&window.clearTimeout(a.current)}},[]),v.useEffect(()=>{r&&(a.current&&window.clearTimeout(a.current),a.current=window.setTimeout(()=>{y0(t).catch(()=>{})},200))},[t,r]);const i=o=>e(c=>({...c,[o]:!c[o]}));return g.jsxs("div",{className:"settings-page",children:[g.jsxs("a",{className:"gold-link white-link",onClick:()=>history.back(),children:[g.jsx("img",{src:"/icons/arrow-left.svg",alt:"","aria-hidden":!0,className:"icon"})," Back"]}),g.jsx("div",{className:"settings-section",children:g.jsxs("label",{children:[g.jsx("input",{type:"checkbox",checked:t.diceAudio,onChange:()=>i("diceAudio"),disabled:!r}),"Dice Audio"]})}),g.jsx("div",{className:"settings-section",children:g.jsxs("label",{children:[g.jsx("input",{type:"checkbox",checked:t.backgroundMusic,onChange:()=>i("backgroundMusic"),disabled:!r}),"Background Music"]})}),g.jsx("div",{className:"settings-section",children:g.jsxs("label",{children:[g.jsx("input",{type:"checkbox",checked:t.chatAudio,onChange:()=>i("chatAudio"),disabled:!r}),"In-Room Chat Audio"]})}),g.jsx("div",{className:"settings-section",children:g.jsxs("label",{children:[g.jsx("input",{type:"checkbox",checked:t.video,onChange:()=>i("video"),disabled:!r}),"Video"]})})]})}const P6=ci();async function s0e(){try{const t=await oi(),e=await fetch(`${P6}/api/ad-reward`,{method:"POST",headers:{"Content-Type":"application/json",...t?{Authorization:`Bearer ${t}`}:{}},credentials:"include"});if(!e.ok){const n=await e.json();return{ok:!1,error:n.error,retryInMs:n.retryInMs}}return{ok:!0,balance:(await e.json()).balance}}catch{return{ok:!1,error:"NETWORK_ERROR"}}}async function o0e(){try{const t=await oi(),e=await fetch(`${P6}/api/ad-reward/status`,{method:"GET",headers:{"Content-Type":"application/json",...t?{Authorization:`Bearer ${t}`}:{}},credentials:"include"});return e.ok?{ok:!0,nextAt:(await e.json()).nextAt}:{ok:!1,error:(await e.json()).error,nextAt:null}}catch{return{ok:!1,error:"NETWORK_ERROR",nextAt:null}}}const EL={claimAdReward:s0e,getAdRewardCooldown:o0e};function c0e(){const{busy:t,busyChips:e,ready:r,error:n,purchasesReady:a,premiumActive:i,hasPremiumPackage:o,premiumLabel:c,onBuyChips:u,onGoPremium:d,onRestore:f,chipsSubtitle:h,premiumSubtitle:m,chipsDescription:_,premiumDescription:w,premiumPrice:b,premiumInterval:E}=Lg(),{refreshUser:T}=$r(),{infoNow:D,successNow:P}=Es(),[A,C]=v.useState(!1),[O,I]=v.useState(0),[x,R]=v.useState(()=>Date.now()),N=Math.max(0,O-x),L=N>0,j=$E.isNativeAdSupported(),q=!i&&j,U=v.useCallback(ce=>{const xe=Math.ceil(ce/1e3),re=Math.floor(xe/60),H=xe%60;return`${re}m ${H}s`},[]);v.useEffect(()=>{q&&(async()=>{try{const ce=await EL.getAdRewardCooldown();ce?.ok&&ce.nextAt&&ce.nextAt>Date.now()&&I(ce.nextAt)}catch{}})()},[q]),v.useEffect(()=>{!q||L||$E.prepareRewardedAd().catch(()=>{})},[q,L]),v.useEffect(()=>{if(!L)return;const ce=setInterval(()=>R(Date.now()),1e3);return()=>clearInterval(ce)},[L]);const W=v.useCallback(async()=>{if(!(A||L||!q)){cr("Light"),C(!0);try{const ce=await $E.showRewardedAd();if(!ce.ok){ce.error==="AD_DISMISSED"?D?.("Ad skipped - watch the full ad to earn credits!"):D?.(`Ad unavailable: ${ce.error}`),C(!1);return}const xe=await EL.claimAdReward();if(xe.ok){const re=QD*60*1e3;I(Date.now()+re),P?.(`+${hf} Z Credits earned!`);try{T()}catch{}}else if(xe.error==="COOLDOWN_ACTIVE"){const re=xe.retryInMs??QD*60*1e3;I(Date.now()+re),D?.("Please wait before watching another ad.")}else D?.(`Reward failed: ${xe.error}`)}catch{D?.("Something went wrong. Please try again.")}finally{C(!1)}}},[A,L,q,D,P,T]),F="$1.99",Y="Monthly",Q=b||F,ie=E||Y,G=m||`${Q} Mo`,B=w||"Remove ads and unlock premium features.",K="$1.99 for 1,000 Zentara Credits",ae="Buy Zentara Credits to keep playing.",te=h||K,me=_||ae,ue=()=>{try{cr("Light")}catch{}try{u()}catch{}},Ae=()=>{try{cr("Light")}catch{}try{d()}catch{}},He=()=>{try{cr("Light")}catch{}try{f()}catch{}};return g.jsxs("div",{className:"theme-casino home-fixed-root add-chips",children:[g.jsx(ji,{className:"profile-page-body"}),g.jsx("div",{className:"logout-container  home-header-row",children:g.jsxs("a",{className:"gold-link white-link gold-link--mini","data-no-global-haptic":!0,onClick:()=>{try{cr("Light")}catch{}history.back()},children:[g.jsx(bd,{className:"icon",style:{color:"var(--gold, #caa64d)"}})," Back"]})}),g.jsx("div",{className:"home-fit-shell",children:g.jsxs("div",{className:"home-fit-content",children:[n&&g.jsx("div",{className:"error-message",role:"alert",children:n}),!n&&r&&!a&&g.jsx("div",{className:"status-message","aria-live":"polite",children:"Initializing… please wait."}),g.jsxs("div",{className:"home-action-buttons",children:[q&&g.jsxs("div",{className:"outline-action-btn-wrapper",children:[g.jsx("button",{className:"felt-btn felt-btn--secondary","data-no-global-haptic":!0,onClick:W,disabled:A||L,"aria-label":`Watch ad for ${hf} free credits`,title:`Watch ad for ${hf} free credits`,style:{background:"linear-gradient(135deg, #2d5a2d 0%, #1a3d1a 100%)",borderColor:"#4a8f4a"},children:A?"Loading Ad…":L?`Available in ${U(N)}`:`🎬 WATCH AD → +${hf}`}),g.jsxs("div",{className:"meta",style:{marginTop:6,textAlign:"center"},children:[g.jsxs("div",{className:"subtle","aria-hidden":!0,children:["Free ",hf," Z Credits"]}),g.jsx("div",{className:"hint","aria-hidden":!0,children:"Watch a short video to earn free credits!"})]})]}),g.jsxs("div",{className:"outline-action-btn-wrapper",children:[g.jsx("button",{className:"felt-btn felt-btn--halo","data-no-global-haptic":!0,onClick:ue,disabled:t||!r||!a,"aria-label":"Buy 1000 Z Credits",title:"Buy 1000 Z Credits",children:e?"Purchasing…":"BUY Z CREDITS"}),g.jsxs("div",{className:"meta",style:{marginTop:6,textAlign:"center"},children:[g.jsx("div",{className:"subtle","aria-hidden":!0,children:te}),g.jsx("div",{className:"hint","aria-hidden":!0,children:me})]})]}),g.jsxs("div",{className:"outline-action-btn-wrapper",children:[!i&&o&&g.jsxs(g.Fragment,{children:[g.jsx("button",{className:"felt-btn","data-no-global-haptic":!0,onClick:Ae,disabled:t,"aria-label":c,title:c,children:"GO PREMIUM"}),g.jsxs("div",{className:"meta",style:{marginTop:6,textAlign:"center"},children:[G&&g.jsx("div",{className:"subtle","aria-hidden":!0,children:G}),g.jsx("div",{className:"hint","aria-hidden":!0,children:B}),g.jsxs("div",{className:"legal-note",role:"note",style:{marginTop:8,fontSize:12,opacity:.85},children:[g.jsx("strong",{children:"Premium Subscription"})," — ",Q," (",ie,"). Auto‑renews until canceled. Manage or cancel in account settings on your device. See our ",g.jsx("a",{href:"/privacy",className:"legal-link",children:"Privacy Policy"})," and ",g.jsx("a",{href:"/terms",className:"legal-link",children:"Terms of Use"}),"."]})]})]}),i&&g.jsx("div",{style:{textAlign:"center"},children:g.jsx(dP,{isPremium:!0})})]}),o&&g.jsx("div",{className:"outline-action-btn-wrapper",children:g.jsxs("button",{className:"felt-btn","data-no-global-haptic":!0,onClick:He,disabled:t||!r||!a,"aria-label":"Restore Purchases",title:"Restore Purchases",children:["RESTORE",g.jsx("br",{}),"PURCHASES"]})})]})]})}),g.jsx(_P,{})]})}function GA({open:t,onClose:e,title:r="Error",message:n}){return lB(!!t),v.useEffect(()=>{const a=i=>{i.key==="Escape"&&e()};return t&&document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[t,e]),t?g.jsx("div",{className:"modal-backdrop",role:"presentation",onClick:e,children:g.jsxs("div",{className:"modal-panel",role:"dialog","aria-modal":"true","aria-label":r,onClick:a=>a.stopPropagation(),children:[g.jsx("button",{className:"modal-close",onClick:e,"aria-label":"Close",children:"×"}),g.jsx("h3",{className:"modal-title",children:r}),g.jsx("p",{className:"modal-subtitle",role:"alert",children:n}),g.jsx("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,marginTop:12},children:g.jsx("button",{className:"btn close-btn",onClick:e,"aria-label":"Close",children:"Close"})})]})}):null}function l0e(){const[t,e]=v.useState("verifying"),r=tn(),{refreshUser:n}=$r();v.useEffect(()=>{(async()=>{const c=new URLSearchParams(window.location.search).get("token");if(!c)return e("error");try{const u=await WH(c);if(u?.success){u.token&&await Zf(u.token);try{await n({force:!0})}catch{}try{setTimeout(()=>{n({force:!0}).catch(()=>{})},400)}catch{}if(await Rb()){e("success");return}e("success")}else e("error")}catch{e("error")}})()},[r,n]),v.useEffect(()=>{if(t!=="success")return;const i=window.setTimeout(()=>{try{r("/?redirect=/lobby",{replace:!0})}catch{window.location.href=`${window.location.origin}/?redirect=/lobby`}},1200);return()=>{window.clearTimeout(i)}},[t,r]);const a=i=>i==="verifying"?g.jsxs(g.Fragment,{children:[g.jsx("p",{children:"Verifying your magic link..."}),g.jsx("button",{className:"landing-btn-secondary",onClick:()=>r("/login"),style:{marginTop:16},"aria-label":"Back to Login",children:"Back to Login"})]}):i==="success"?g.jsx("p",{children:"Verification successful! Redirecting to the lobby..."}):g.jsxs(g.Fragment,{children:[g.jsx(GA,{open:!0,onClose:()=>r("/login"),title:"Verification failed",message:"Verification failed. Please try again."}),g.jsx("button",{className:"landing-btn-secondary",onClick:()=>r("/login"),style:{marginTop:16},"aria-label":"Back to Login",children:"Back to Login"})]});return g.jsxs("div",{className:"HomeScreen theme-casino home-fixed-root",children:[g.jsx(ji,{className:"page-home-screen"}),g.jsx("div",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",textAlign:"center",padding:"0 16px"},children:g.jsx("div",{children:a(t)})})]})}function u0e(){const[t,e]=v.useState("verifying"),[r,n]=v.useState(!1),a=tn(),i=ci();return v.useEffect(()=>{(async()=>{const u=new URLSearchParams(window.location.search).get("token");if(!u){e("error");return}try{const d=await fetch(`${i}/api/auth/review-login?token=${encodeURIComponent(u)}`,{method:"GET",credentials:"include",redirect:"follow"});if(!d.ok){e("error");return}let f=null;try{const h=await d.json().catch(()=>null);h?.token&&await Zf(h.token)}catch{}if(f=await Rb(),f){e("success"),window.location.href=`${window.location.origin}/?redirect=/lobby`;return}else e("error")}catch{e("error")}})()},[i,a]),v.useEffect(()=>{t==="error"&&n(!0)},[t]),t==="verifying"?g.jsx("p",{children:"Signing you in for review…"}):t==="success"?g.jsx("p",{children:"Success! Redirecting to the lobby…"}):g.jsx(g.Fragment,{children:g.jsx(GA,{open:r,onClose:()=>n(!1),title:"Review login failed",message:"Review login failed. Please check your link."})})}function d0e(){const[t,e]=v.useState("verifying"),[r,n]=v.useState(!1),a=tn(),i=ci();return v.useEffect(()=>{(async()=>{const u=new URLSearchParams(window.location.search).get("token");if(!u){e("error");return}try{const d=await fetch(`${i}/api/auth/qa-login?token=${encodeURIComponent(u)}`,{method:"GET",credentials:"include",redirect:"follow"});if(!d.ok){e("error");return}try{const h=await d.json().catch(()=>null);h?.token&&await Zf(h.token)}catch{}if(await Rb()){e("success"),window.location.href=`${window.location.origin}/?redirect=/lobby`;return}else e("error")}catch{e("error")}})()},[i,a]),v.useEffect(()=>{t==="error"&&n(!0)},[t]),t==="verifying"?g.jsx("p",{children:"Signing you in for QA…"}):t==="success"?g.jsx("p",{children:"Success! Redirecting to the lobby…"}):g.jsx(g.Fragment,{children:g.jsx(GA,{open:r,onClose:()=>n(!1),title:"QA login failed",message:"QA login failed. Please check your link."})})}function f0e({fly:t,onComplete:e}){const r=v.useRef({startX:t.startX,startY:t.startY,endX:t.endX,endY:t.endY,amount:t.amount}).current,n=v.useRef(null);v.useEffect(()=>{const i=sa.chipFlyDurationMs,o=0,c=100;n.current=window.setTimeout(()=>{try{MG({playbackRate:1.25})}catch{}},o+c);const u=setTimeout(e,i+600);return()=>{clearTimeout(u),n.current&&(window.clearTimeout(n.current),n.current=null)}},[e]);const a=18;return v.useRef(null),g.jsx(Ys.div,{initial:{position:"fixed",left:r.startX-a,top:r.startY-a,zIndex:1e4,opacity:0,scale:.9},animate:{left:r.endX-a,top:r.endY-a,opacity:1,scale:1},transition:{type:"spring",stiffness:120,damping:20,duration:sa.chipFlyDurationMs/1e3},onAnimationComplete:e,style:{pointerEvents:"none"},children:g.jsx(Bc,{mini:!0,value:r.amount,disabled:!0,className:"chip--flight",selectedTimes:0})})}function Em({label:t,subtitle:e,onClick:r,className:n,disabled:a,imageName:i,imgSrc:o,size:c="md",ariaLabel:u,showHalo:d}){const f=["gold-btn",`gold-btn--${c}`,o||i?"gold-btn--image":"gold-btn--styled",n||""].filter(Boolean).join(" "),h=i?`/ui/buttons/${i}.webp`:void 0,m=o||h;return g.jsxs("button",{type:"button",className:f,onClick:r,disabled:a,"aria-label":u||t,children:[d&&g.jsx("span",{className:"gold-btn__halo","aria-hidden":!0}),m&&g.jsx("span",{className:"gold-btn__media","aria-hidden":!0,children:g.jsxs("picture",{children:[g.jsx("source",{srcSet:m,type:"image/webp"}),g.jsx("img",{src:m,alt:"",loading:"lazy"})]})}),g.jsxs("span",{className:"gold-btn__text",children:[g.jsx("span",{className:"gold-btn__label",children:t}),e?g.jsx("span",{className:"gold-btn__sub","aria-hidden":!0,children:e}):null]})]})}function Io({label:t,subtitle:e,onClick:r,disabled:n,size:a="md",ariaLabel:i,className:o,variant:c="pill",showHalo:u}){const d=[o,c==="circle"?"poker-action--circle":""].filter(Boolean).join(" "),[f,h]=Tt.useState(!1),m=Tt.useCallback(()=>{try{Xr()}catch{}h(!1),requestAnimationFrame(()=>{h(!0),window.setTimeout(()=>h(!1),260)});try{cr("Light")}catch{}try{}catch{}typeof r=="function"&&r()},[r]),_=typeof u=="boolean"?u:!n;return g.jsx("span",{className:["poker-action-spring",f?"is-spring":""].filter(Boolean).join(" "),"data-no-global-haptic":!0,children:g.jsx(Em,{label:t,subtitle:e,onClick:m,disabled:n,size:a,ariaLabel:i,className:d,showHalo:_})})}function p0e(){const t=[{id:"bet1",type:"MAIN",playerId:"player1",acceptedById:"banker1",amount:100},{id:"bet2",type:"MAIN",playerId:"player2",acceptedById:null,amount:50}],e=[{id:"player1",name:"Alice"},{id:"player2",name:"Bob"},{id:"banker1",name:"Banker"}],[r,n]=v.useState({1:0,5:0,10:1,25:0,100:0}),[a,i]=v.useState(10),[o,c]=v.useState(!1),[u,d]=v.useState(!1),[f,h]=v.useState([]),m=v.useRef(null),_=v.useRef({c1:null,c2:null,c3:null,c4:null}),w=x=>{if(!x)return null;const R=x.getBoundingClientRect();return{x:R.left+R.width/2,y:R.top+R.height/2}},b=v.useCallback((x,R,N)=>{const L=w(x),j=w(R);if(!L||!j)return;const U={id:`flight-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,amount:N,fromId:"sandbox-from",toId:"sandbox-to",startX:L.x,startY:L.y,endX:j.x,endY:j.y,active:!0};h(W=>[...W,U])},[]),E=()=>{b(_.current.c1,m.current,25)},T=()=>{["c1","c2","c3","c4"].forEach((x,R)=>{setTimeout(()=>b(_.current[x],m.current,5*(R+1)),R*40)})},D=()=>{["c1","c2","c3","c4"].forEach((x,R)=>{setTimeout(()=>b(m.current,_.current[x],10*(R+1)),R*40)})},P=x=>{h(R=>R.filter(N=>N.id!==x))},A=x=>{n(R=>({...R,[x]:(R[x]||0)+1})),i(R=>R+x)},C=x=>{n(R=>({...R,[x]:0})),i(R=>R-x*(r[x]||0))},O=()=>{c(!0),d(!0)},I=()=>{c(!1),d(!1),n({1:0,5:0,10:0,25:0,100:0}),i(0)};return g.jsxs("div",{className:"button-sandbox",children:[g.jsx("h1",{children:"Button Sandbox"}),g.jsx(ji,{className:"profile-page"}),g.jsxs("section",{style:{marginBottom:28},children:[g.jsx("h2",{style:{fontSize:16,margin:"4px 0 12px"},children:"ChipFly Test"}),g.jsxs("div",{style:{position:"relative",padding:16,border:"1px solid rgba(255,255,255,0.15)",borderRadius:8,display:"flex",flexDirection:"column",gap:12},children:[g.jsxs("div",{style:{display:"flex",gap:12,flexWrap:"wrap"},children:[g.jsx("button",{className:"felt-btn felt-btn--mini",onClick:E,children:"Single Flight"}),g.jsx("button",{className:"felt-btn felt-btn--mini",onClick:T,children:"Sweep 456"}),g.jsx("button",{className:"felt-btn felt-btn--mini",onClick:D,children:"Sweep 123"}),g.jsx("button",{className:"felt-btn felt-btn--mini",onClick:()=>h([]),style:{background:"#933",borderColor:"#600"},children:"Clear Flights"})]}),g.jsxs("div",{style:{position:"relative",minHeight:170,marginTop:8,display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0 12px"},children:[g.jsx("div",{style:{display:"flex",flexDirection:"column",gap:14},children:["c1","c2"].map(x=>g.jsx("div",{ref:R=>{_.current[x]=R},children:g.jsx(Bc,{mini:!0,value:5,disabled:!0,className:"chip--flight"})},x))}),g.jsxs("div",{ref:m,children:[g.jsx(Bc,{mini:!0,value:100,disabled:!0,className:"chip--flight"}),g.jsx("div",{style:{textAlign:"center",marginTop:4,fontSize:11,opacity:.7},children:"Banker"})]}),g.jsx("div",{style:{display:"flex",flexDirection:"column",gap:14},children:["c3","c4"].map(x=>g.jsx("div",{ref:R=>{_.current[x]=R},children:g.jsx(Bc,{mini:!0,value:25,disabled:!0,className:"chip--flight"})},x))})]})]}),f.map(x=>g.jsx(f0e,{fly:x,onComplete:()=>P(x.id)},x.id))]}),g.jsxs("section",{style:{marginBottom:28},children:[g.jsx("h2",{style:{fontSize:16,margin:"4px 0 12px"},children:"Flash Overlays"}),g.jsxs("div",{className:"flash-preview__row",children:[g.jsx("div",{className:"flash-preview__header",children:g.jsx("div",{className:"flash-root flash-root--header","aria-hidden":!0,children:g.jsx("div",{className:"flash-card flash-win",children:g.jsxs("div",{className:"flash-body",children:[g.jsxs("div",{className:"flash-title",children:[g.jsx("span",{className:"flash-title__name",children:"ALICE"}),g.jsx("span",{className:"flash-title__rest",children:"WINS"})]}),g.jsxs("div",{className:"flash-subtitle",children:[g.jsx("span",{className:"keep-lower",children:"z"}),"250"]})]})})})}),g.jsx("div",{className:"flash-preview__header",children:g.jsx("div",{className:"flash-root flash-root--header","aria-hidden":!0,children:g.jsx("div",{className:"flash-card flash-lose",children:g.jsxs("div",{className:"flash-body",children:[g.jsxs("div",{className:"flash-title",children:[g.jsx("span",{className:"flash-title__name",children:"BANKER"}),g.jsx("span",{className:"flash-title__rest",children:"LOSES"})]}),g.jsxs("div",{className:"flash-subtitle",children:[g.jsx("span",{className:"keep-lower",children:"z"}),"120"]})]})})})}),g.jsx("div",{className:"flash-preview__header",children:g.jsx("div",{className:"flash-root flash-root--header","aria-hidden":!0,children:g.jsx("div",{className:"flash-card flash-push",children:g.jsxs("div",{className:"flash-body",children:[g.jsx("div",{className:"flash-title",children:"PUSH"}),g.jsx("div",{className:"flash-subtitle",children:"No Action"})]})})})})]}),g.jsxs("div",{className:"flash-preview__row",children:[g.jsx("div",{className:"flash-frame",children:g.jsx("div",{className:"flash-card flash-win","aria-hidden":!0,children:g.jsxs("div",{className:"flash-body",children:[g.jsxs("div",{className:"flash-title",children:[g.jsx("span",{className:"flash-title__name",children:"ALICE"}),g.jsx("span",{className:"flash-title__rest",children:"WINS"})]}),g.jsxs("div",{className:"flash-subtitle",children:[g.jsx("span",{className:"keep-lower",children:"z"}),"250"]})]})})}),g.jsx("div",{className:"flash-frame",children:g.jsx("div",{className:"flash-card flash-lose","aria-hidden":!0,children:g.jsxs("div",{className:"flash-body",children:[g.jsxs("div",{className:"flash-title",children:[g.jsx("span",{className:"flash-title__name",children:"BANKER"}),g.jsx("span",{className:"flash-title__rest",children:"LOSES"})]}),g.jsxs("div",{className:"flash-subtitle",children:[g.jsx("span",{className:"keep-lower",children:"z"}),"120"]})]})})}),g.jsx("div",{className:"flash-frame",children:g.jsx("div",{className:"flash-card flash-push","aria-hidden":!0,children:g.jsxs("div",{className:"flash-body",children:[g.jsx("div",{className:"flash-title",children:"PUSH"}),g.jsx("div",{className:"flash-subtitle",children:"No Action"})]})})})]})]}),g.jsxs("section",{style:{marginBottom:28},children:[g.jsx("h2",{style:{fontSize:16,margin:"4px 0 12px"},children:"Poker Action Buttons"}),g.jsxs("div",{className:"poker-actions",role:"group","aria-label":"Poker action buttons",style:{display:"flex",gap:12,flexWrap:"wrap",alignItems:"center"},children:[g.jsx(Io,{label:"Check",ariaLabel:"Check",size:"md",className:"poker-action--green poker-action--secondary poker-action--check",onClick:()=>{}}),g.jsx(Io,{label:"Call",subtitle:"z120",ariaLabel:"Call 120",size:"md",className:"poker-action--green poker-action--primary poker-action--call",onClick:()=>{}}),g.jsx(Io,{label:"Bet",subtitle:"z250",ariaLabel:"Bet 250",size:"md",className:"poker-action--flat poker-action--secondary poker-action--bet",onClick:()=>{}}),g.jsx(Io,{label:"Raise",subtitle:"z400",ariaLabel:"Raise 400",size:"md",className:"poker-action--flat poker-action--secondary poker-action--raise",onClick:()=>{}}),g.jsx(Io,{label:"Fold",ariaLabel:"Fold",size:"md",className:"poker-action--flat poker-action--danger poker-action--fold",onClick:()=>{}})]})]}),g.jsxs("div",{className:"button-grid",children:[g.jsx("div",{className:"button-item",children:g.jsx(Xz,{onClick:()=>{},label:"ROLL",busy:!1,disabled:!1})}),g.jsx("div",{className:"button-item",children:g.jsx(YC,{onClick:()=>{},busy:!1,disabled:!1,label:"Cancel Bet"})}),g.jsx("div",{className:"button-item",children:o?g.jsx(YC,{onClick:I,busy:!1,disabled:!1,label:"Cancel Bet"}):g.jsx(Yz,{disabled:a<=0,onClick:O,busy:!1,label:"✓"})}),g.jsx("div",{className:"button-item",children:g.jsx(w0,{selectedTimes:r,onAdd:A,onClear:C,disabled:o,collapsed:u,collapseLabel:"Chip Rack",betTokenProps:{isBanker:!1,meId:"player1",open:t,players:e,show:o},onPlaceBet:O,onCancelBet:I,mainAmt:a})}),g.jsx("div",{className:"button-item",children:g.jsx(bP,{state:"verified"})})]})]})}function h0e(){const t=tn(),e=()=>{window.history.length>1?t(-1):t("/lobby",{replace:!0})};return g.jsx("div",{className:"disclaimer-screen",children:g.jsxs("div",{className:"disclaimer-panel",children:[g.jsxs("button",{type:"button",className:"disclaimer-back",onClick:e,"aria-label":"Back",children:[g.jsx(bd,{className:"icon",style:{color:"var(--gold, #caa64d)"}})," Back"]}),g.jsx("div",{className:"disclaimer-accent-bar"}),g.jsx("h1",{className:"disclaimer-title",children:"Disclaimer"}),g.jsxs("div",{className:"disclaimer-body",children:[g.jsxs("p",{children:[g.jsx("strong",{children:"Zentara One Dice Lounge"})," is a social casino game intended for entertainment purposes only. No real money gambling takes place within this app."]}),g.jsx("p",{children:"Virtual chips used in gameplay have no cash value and cannot be redeemed for real money, goods, or services."}),g.jsx("p",{children:"For your privacy and to keep rooms fresh for active players, the app will automatically return you to the Lobby after 4 minutes of inactivity."}),g.jsx("p",{children:"This game is intended for an adult audience (18+). Playing does not imply future success at real money gambling. Please play responsibly."}),g.jsx("p",{children:"If you or someone you know has a gambling problem and needs help, please contact your local gambling support hotline."})]}),g.jsxs("div",{className:"disclaimer-footer",children:["© ",new Date().getFullYear()," Zentara One. All rights reserved."]})]})})}function m0e(){const t=tn();return g.jsx("div",{className:"legal-screen",children:g.jsxs("div",{className:"legal-panel",children:[g.jsx("div",{className:"legal-accent-bar"}),g.jsxs("div",{className:"legal-header",children:[g.jsxs("button",{type:"button",className:"legal-back",onClick:()=>t(-1),"aria-label":"Go back",children:[g.jsx(bd,{className:"icon",style:{color:"var(--gold, #caa64d)"}}),"Back"]}),g.jsx("h1",{className:"legal-title",children:"Support"})]}),g.jsxs("div",{className:"legal-body",children:[g.jsx("p",{children:"Need help with Zentara One Dice Lounge? We're here for you."}),g.jsxs("p",{children:["Email us at"," ",g.jsx("a",{href:"mailto:support@zentaraone.com",className:"legal-link",children:"support@zentaraone.com"})," ","and we'll get back to you as soon as possible."]}),g.jsx("p",{children:"Please include your device, OS version, and a brief description of the issue."})]}),g.jsxs("div",{className:"legal-footer",children:["© ",new Date().getFullYear()," Zentara One. All rights reserved."]})]})})}function g0e(){const t=tn();return g.jsx("div",{className:"legal-screen",children:g.jsxs("div",{className:"legal-panel",children:[g.jsx("div",{className:"legal-accent-bar"}),g.jsxs("div",{className:"legal-header",children:[g.jsxs("button",{type:"button",className:"legal-back",onClick:()=>t(-1),"aria-label":"Go back",children:[g.jsx(bd,{className:"icon",style:{color:"var(--gold, #caa64d)"}}),"Back"]}),g.jsx("h1",{className:"legal-title",children:"Privacy Policy"})]}),g.jsxs("div",{className:"legal-body",children:[g.jsx("p",{children:"We respect your privacy. Zentara One Dice Lounge, Zentara One Poker Lounge, Zentara One Craps Lounge and Zentara One Cee-Lo Lounge all collect minimal data needed to operate the app (such as an email for login, in-app purchase history via Apple/Google, and basic device info for diagnostics). We do not sell your personal information."}),g.jsxs("p",{children:["For questions or data requests, contact"," ",g.jsx("a",{href:"mailto:support@zentaraone.com",className:"legal-link",children:"support@zentaraone.com"}),"."]})]}),g.jsxs("div",{className:"legal-footer",children:["© ",new Date().getFullYear()," Zentara One. All rights reserved."]})]})})}function y0e(){const t=tn();return g.jsx("div",{className:"legal-screen",children:g.jsxs("div",{className:"legal-panel",children:[g.jsx("div",{className:"legal-accent-bar"}),g.jsxs("div",{className:"legal-header",children:[g.jsxs("button",{type:"button",className:"legal-back",onClick:()=>t(-1),"aria-label":"Go back",children:[g.jsx(bd,{className:"icon",style:{color:"var(--gold, #caa64d)"}}),"Back"]}),g.jsx("h1",{className:"legal-title",children:"Terms of Use"})]}),g.jsxs("div",{className:"legal-body",children:[g.jsx("p",{children:"By using Zentara One Dice Lounge (the “App”), you agree to these Terms of Use. If you do not agree, do not use the App."}),g.jsx("h2",{children:"1. Apple Standard EULA"}),g.jsxs("p",{children:["For iOS users, the App is licensed to you under the Apple Media Services Terms and Conditions, including the standard Apple End User License Agreement (EULA). You can review the Apple EULA here:"," ",g.jsx("a",{className:"legal-link",href:"https://www.apple.com/legal/internet-services/itunes/dev/stdeula/",target:"_blank",rel:"noopener noreferrer",children:"https://www.apple.com/legal/internet-services/itunes/dev/stdeula/"}),"."]}),g.jsx("h2",{children:"2. Subscriptions and Billing"}),g.jsx("p",{children:"The App may offer auto-renewable subscriptions. Payment will be charged to your Apple ID at confirmation of purchase. Subscriptions automatically renew unless canceled at least 24 hours before the end of the current period. You can manage or cancel your subscription in your account settings on your device."}),g.jsx("h2",{children:"3. Refunds"}),g.jsx("p",{children:"Refunds for purchases made via the App Store are handled by Apple directly, per Apple policies."}),g.jsx("h2",{children:"4. Acceptable Use"}),g.jsx("p",{children:"You agree not to misuse the App, attempt to disrupt its operation, or violate any applicable laws. We may suspend or terminate access for violations."}),g.jsx("h2",{children:"5. Privacy"}),g.jsxs("p",{children:["Please review our"," ",g.jsx("a",{className:"legal-link",href:"/privacy",children:"Privacy Policy"})," ","to understand how we collect and use information."]}),g.jsx("h2",{children:"6. Contact"}),g.jsxs("p",{children:["Questions? Contact"," ",g.jsx("a",{href:"mailto:support@zentaraone.com",className:"legal-link",children:"support@zentaraone.com"}),"."]})]}),g.jsxs("div",{className:"legal-footer",children:["© ",new Date().getFullYear()," Zentara One. All rights reserved."]})]})})}ci();function WA({children:t,header:e,footer:r,showAvatarBacks:n=!1}){return g.jsxs("div",{className:"poker-room-shell","aria-label":"Poker Room","data-game-mode":"poker","data-show-avatar-backs":n?"1":void 0,children:[g.jsx(ji,{className:"page-poker-room"}),g.jsx("div",{className:"poker-room-bg"}),g.jsxs("div",{className:"poker-room-foreground",role:"main",children:[e,g.jsx("div",{className:"poker-room-content",children:t}),r]})]})}function v0e({cards:t,firstRevealed:e=!0,bothRevealed:r=!0}){const[n,a]=Array.isArray(t)?t:[];return!n&&!a?null:g.jsxs("div",{className:"holecards","aria-label":"hole-cards",children:[g.jsx(TL,{value:n,revealed:!!e||!!r}),g.jsx(TL,{value:a,revealed:!!r})]})}function TL({value:t,revealed:e=!1}){if(!t)return g.jsx("span",{className:"poker-card"+(e?" revealed":""),"aria-hidden":!0});const{rank:r,suit:n}=_0e(t),a=n==="hearts"||n==="diamonds";return g.jsxs("div",{className:["poker-card",a?"poker-card--red":"",e?"revealed":""].filter(Boolean).join(" "),"aria-label":`${r} of ${n}`,children:[g.jsx("span",{className:"poker-card__rank",children:r}),g.jsx("span",{className:"poker-card__suit",children:b0e(n)})]})}function _0e(t){const e=String(t||"").trim().toUpperCase(),r=e.slice(0,-1),n=e.slice(-1);return{rank:r==="T"?"10":r,suit:n==="H"?"hearts":n==="D"?"diamonds":n==="C"?"clubs":"spades"}}function b0e(t){switch(t){case"hearts":return"♥";case"diamonds":return"♦";case"clubs":return"♣";case"spades":return"♠";default:return"?"}}function k0e({gameState:t,players:e,winners:r,hands:n,durationMs:a,meId:i}){const o=v.useRef(null),c=v.useRef(null),u=v.useRef(null),{info:d}=Es();v.useEffect(()=>{const f=o.current,h=t||{};o.current=h;const m=h?.pokerLastAction;if(m&&typeof m.seq=="number"){const Y=(Array.isArray(h?.pokerSeats)?h.pokerSeats:[]).find(Q=>Q.seatIndex===m.seatIndex);if(Y){const Q=e.find(te=>te.id===Y.playerId),ie=Q?.name||Q?.email||"Player";let G;const B=te=>typeof te=="number"?`z${te.toLocaleString("en-US")}`:"";switch((m.action||"").toLowerCase()){case"fold":G="Fold";break;case"check":G="Check";break;case"call":G=`Call ${B(m.amountDelta)}`;break;case"bet":G=`Bet ${B(m.amountDelta)}`;break;case"raise":G=m.toBet?`Raise to ${B(m.toBet)}`:`Raise ${B(m.amountDelta)}`;break;default:G="Action";break}const ae=`srv:${Number(h?.pokerRoundSeq||0)||0}:${m.seq}`;u.current!==ae&&(d(`${ie}: ${G}`,void 0),u.current=ae),c.current=m.seq;return}}if(!f)return;const _=f?.pokerPhase??"waiting",w=h?.pokerPhase??"waiting";if(_!==w&&_==="waiting"&&w==="pre-flop")return;const b=Array.isArray(f?.pokerSeats)?f.pokerSeats:[],E=Array.isArray(h?.pokerSeats)?h.pokerSeats:[];if(!E.length)return;const T=F=>{const Y=new Map;for(const Q of F)Y.set(Q.seatIndex,Q);return Y},D=T(b),P=T(E),A=f?.pokerActingSeat,C=h?.pokerActingSeat,O=f?.pokerCurrentBet||0,I=h?.pokerCurrentBet||0;let x=null,R=null;for(const F of E){const Y=D.get(F.seatIndex);if(Y&&(Y.status==="active"||Y.status==="all-in")&&F.status==="folded"){x=F,R="Fold";break}}if(!R)for(const F of E){const Y=D.get(F.seatIndex);if(!Y)continue;const Q=(F.committed||0)-(Y.committed||0);if(Q>0){x=F,O===0?R=`Bet z${Q}`:I>O?R=`Raise to z${I}`:R=`Call z${Q}`;break}}if(!R&&A!=null&&C!=null&&A!==C){const F=D.get(A),Y=P.get(A);F&&Y&&F.status==="active"&&Y.status==="active"&&(F.committed||0)===(Y.committed||0)&&(x=Y,R="Check")}if(!R||!x)return;const N=e.find(F=>F.id===x.playerId),j=`${N?.name||N?.email||"Player"}: ${R}`,q=Number(h?.pokerRoundSeq||0)||0;try{const F=typeof window<"u"?window:void 0,Y=F&&F.__pokerWinnersFlashGuard;if(Y&&Y.roundSeq===q)return}catch{}const U=Number(x?.committed||0),W=`heur:${q}:${x.seatIndex}:${R}:${U}:${I}`;u.current!==W&&(d(j,void 0),u.current=W)},[t,e,d,a])}function CL({enabled:t,onComplete:e,perCardSec:r=.55,staggerSec:n=.12,origin:a,handKey:i,getTargets:o,passes:c=2}){const u=v.useRef(null),[d,f]=v.useState([]),[h,m]=v.useState(!1),_=v.useMemo(()=>{if(!u.current)return{x:0,y:0};const E=u.current.getBoundingClientRect(),T=a?.xPct??.5,D=a?.yPct??.78;return{x:E.width*T,y:E.height*D}},[a,u.current]);v.useEffect(()=>{if(!t)return;const b=u.current;if(!b||typeof window>"u")return;let E=[];if(typeof o=="function")try{E=o(b)||[]}catch{E=[]}else{const T=b.getBoundingClientRect();E=Array.from(document.querySelectorAll(".poker-room-header .avatar-ring")).map(P=>{const A=P.getBoundingClientRect();return{x:(A.left+A.right)/2-T.left,y:(A.top+A.bottom)/2-T.top}})}f(E)},[t,i,o]),v.useEffect(()=>{if(!t)return;try{np(["cardSwoosh"])}catch{}(async()=>{const D=await O_(["cardSwoosh"],900);m(D)})();const b=d.length*Math.max(1,c);if(b===0){const D=setTimeout(()=>e?.(),10);return()=>clearTimeout(D)}const E=(b-1)*n+r,T=setTimeout(()=>e?.(),E*1e3);return()=>clearTimeout(T)},[t,d,r,n,e,c]);const w=v.useMemo(()=>{const b=[],E=Math.max(1,c);for(let T=0;T<E;T++)for(let D=0;D<d.length;D++){const P=T*d.length+D;b.push({key:`card-${T}-${D}`,delay:P*n,to:d[D]})}return b},[d,c,n,i]);return v.useEffect(()=>{if(!t||!w.length||!h)return;const b=[],T=typeof navigator<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)?70:0;let D=0,P=!0;for(const A of w){const C=Math.max(0,(A.delay||0)*1e3),I=Math.max(C+(P?30:0),D+T),x=window.setTimeout(()=>{try{jG({volume:.0125})}catch{}},I);D=I,P=!1,b.push(x)}return()=>{b.forEach(A=>window.clearTimeout(A))}},[t,w,h]),!t||!h?null:g.jsx("div",{ref:u,className:"poker-dealing-layer","aria-hidden":!0,style:{willChange:"transform, opacity"},children:w.map(b=>g.jsx(Ys.div,{className:"poker-dealing-card",initial:{x:_.x,y:_.y,opacity:0},animate:{x:b.to.x,y:b.to.y,opacity:1},transition:{duration:r,delay:b.delay,ease:"easeOut"},style:{willChange:"transform, opacity",backfaceVisibility:"hidden"}},b.key))})}function w0e({players:t,entries:e,onClose:r}){const n=Tt.useCallback((o,c)=>t.find(u=>u.id===o)?.name||`Seat ${c+1}`,[t]),a=Tt.useCallback(o=>{if(!o||typeof o.category!="number")return;const c=o.category|0,u=Array.isArray(o.tiebreak)?o.tiebreak:[],d=h=>"23456789TJQKA"[Math.max(0,Math.min(12,h))]||"?",f=h=>({2:"Deuce",3:"Three",4:"Four",5:"Five",6:"Six",7:"Seven",8:"Eight",9:"Nine",T:"Ten",J:"Jack",Q:"Queen",K:"King",A:"Ace"})[d(h)]||d(h);switch(c){case 8:return`Straight Flush (${f(u[0]??0)} high)`;case 7:return`Four of a Kind (${f(u[0]??0)}s)`;case 6:return`Full House (${f(u[0]??0)}s over ${f(u[1]??0)}s)`;case 5:return`Flush (${[u[0],u[1],u[2],u[3],u[4]].filter(h=>h!=null).map(h=>d(h)).join("")})`;case 4:return`Straight (${f(u[0]??0)} high)`;case 3:return`Three of a Kind (${f(u[0]??0)}s)`;case 2:return`Two Pair (${f(u[0]??0)}s & ${f(u[1]??0)}s)`;case 1:return`One Pair (${f(u[0]??0)}s)`;default:return`High Card (${f(u[0]??0)})`}},[]),i=Tt.useMemo(()=>[...e].sort((o,c)=>c.roundSeq-o.roundSeq),[e]);return g.jsxs("div",{className:"results-modal","data-testid":"poker-history-modal",children:[g.jsx("div",{className:"results-modal__backdrop",onClick:r}),g.jsxs("div",{className:"results-modal__card card",style:{maxWidth:900},children:[g.jsxs("div",{className:"results-modal__header",children:[g.jsx("h3",{children:"Poker History"}),g.jsx("button",{className:"btn btn--ghost",onClick:r,"aria-label":"Close History",children:"Close"})]}),i.length===0&&g.jsx("div",{children:"No hands yet."}),g.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12,maxHeight:"70vh",overflow:"auto"},children:i.map(o=>g.jsxs("div",{className:"card",style:{padding:10,background:"rgba(255,255,255,0.05)"},children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,marginBottom:8},children:[g.jsxs("div",{style:{fontWeight:600},children:["Hand ",o.roundSeq]}),g.jsxs("div",{"aria-label":"pot",children:["Pot: z",o.pot||0]})]}),g.jsx("div",{"aria-label":"seats",style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:8},children:(o.seats&&o.seats.length?o.seats:o.hands.map(c=>({playerId:c.playerId,seatIndex:c.seatIndex}))).map((c,u)=>{const d=o.winners.find(b=>b.playerId===c.playerId),f=n(c.playerId,c.seatIndex),h=!!d,m=String(c.status||"").toLowerCase()==="folded",_=a(c.rank||d?.rank),w=typeof d?.amount=="number"?d.amount:0;return g.jsxs("div",{className:["poker-history__seat",h?"is-winner":""].filter(Boolean).join(" "),style:{padding:8,borderRadius:6,background:h?"rgba(40,180,80,0.15)":"rgba(255,255,255,0.06)"},children:[g.jsx("div",{style:{fontWeight:600,marginBottom:4},children:f}),g.jsx("div",{style:{fontSize:13,opacity:.9},children:m?g.jsx("span",{children:"Folded"}):g.jsx("span",{children:_||"—"})}),g.jsx("div",{style:{fontSize:13,opacity:.9,marginTop:2},children:w>0?g.jsxs("span",{children:["Winnings: z",w]}):g.jsx("span",{children:"Winnings: z0"})})]},`s-${o.roundSeq}-${u}`)})})]},o.roundSeq))})]})]})}function S0e(){const t=v.useRef(null),e=v.useRef(!1),r=async()=>{if(!(e.current||t.current)){e.current=!0;try{"wakeLock"in navigator&&(t.current=await navigator.wakeLock.request("screen"),t.current.addEventListener("release",()=>{t.current=null}))}catch{}finally{e.current=!1}}},n=async()=>{if(t.current)try{await t.current.release(),t.current=null}catch{}};return v.useEffect(()=>{const a=()=>{document.visibilityState==="visible"&&t.current===null&&e.current};return document.addEventListener("visibilitychange",a),()=>{document.removeEventListener("visibilitychange",a),n()}},[]),{acquire:r,release:n}}const QC=["A","K","Q","J","10","9","8","7","6","5","4","3","2"],E0e={A:"Ace",K:"King",Q:"Queen",J:"Jack",10:"Ten",9:"Nine",8:"Eight",7:"Seven",6:"Six",5:"Five",4:"Four",3:"Three",2:"Two"};function A6(t){const e=String(t||"").trim().toUpperCase();if(!e)return null;const r=e.slice(0,-1),n=r==="T"?"10":r;return QC.includes(n)?n:null}function R6(t){return t.map(A6).filter(e=>e!==null)}function KA(t){const e=R6(t),r={};for(const n of e)r[n]=(r[n]||0)+1;return Object.entries(r).filter(([,n])=>n>=2).map(([n])=>n)}function T0e(t){return KA(t).length>0}function C0e(t){const e=R6(t);if(e.length===0)return null;let r=null,n=QC.length;for(const a of e){const i=QC.indexOf(a);i!==-1&&i<n&&(n=i,r=a)}return r}function x0e(t){const e=C0e(t);return e?`${E0e[e]} High`:null}function P0e(t,e){if(e<0||e>=t.length)return!1;const r=A6(t[e]);return r?KA(t).includes(r):!1}function A0e(t){const e=[];if(!t||t.length===0)return e;T0e(t)&&e.push({label:"Paired Board",type:"paired"});const r=x0e(t);return r&&e.push({label:r,type:"high"}),e}function R0e(t){return t<0||t>4?null:t<=2?"flop":t===3?"turn":"river"}function D0e({boardCards:t}){const e=A0e(t);return g.jsx("div",{className:"board-badges","aria-label":"Board state indicators",children:e.map((r,n)=>g.jsx("span",{className:`board-badge board-badge--${r.type}`,role:"status","aria-live":"polite",children:r.label},`${r.type}-${n}`))})}function O0e(t){const e=String(t||"").trim().toUpperCase(),r=e.slice(0,-1),n=e.slice(-1);return{rank:r==="T"?"10":r,suit:n==="H"?"hearts":n==="D"?"diamonds":n==="C"?"clubs":"spades"}}function N0e(t){switch(t){case"hearts":return"♥";case"diamonds":return"♦";case"clubs":return"♣";case"spades":return"♠";default:return"?"}}function I0e({value:t,concealed:e,position:r,isPaired:n,animateEntrance:a}){if(!t)return null;const{rank:i,suit:o}=O0e(t),u=["poker-card","poker-card--board",o==="hearts"||o==="diamonds"?"poker-card--red":"",r?`poker-card--${r}`:"",n?"poker-card--paired":"",a?"poker-card--enter":""].filter(Boolean).join(" ");return g.jsxs("div",{className:u,style:e?{visibility:"hidden"}:void 0,"aria-label":`${i} of ${o}`,children:[g.jsx("span",{className:"poker-card__rank",children:i}),g.jsx("span",{className:"poker-card__suit",children:N0e(o)})]})}const Uh=Object.create(null),KE=Object.create(null);function M0e(){const{roomId:t}=c3(),{user:e,refreshUser:r}=$r(),n=ks(),{onHandEnd:a}=S0(),i=String(e?.id??e?.email??""),{joinRoom:o,leaveRoom:c,connected:u,participants:d,localParticipant:f}=gu(),h=S0e();v.useEffect(()=>{const J=()=>{try{Dx()||Xr()}catch{}};J();const pe=["pointerdown","touchstart","mousedown","click","keydown"];return pe.forEach(ye=>{document.addEventListener(ye,J,{once:!0,capture:!0})}),()=>{pe.forEach(ye=>{document.removeEventListener(ye,J,{capture:!0})})}},[]);const{pokerJoinRoom:m,pokerStartHand:_,pokerFold:w,pokerCheck:b,pokerCall:E,pokerBet:T,pokerRaise:D,pokerFetchHistory:P}=pa(),{info:A,win:C,onIdle:O,show:I}=Es(),[x,R]=v.useState(null);v.useEffect(()=>{const J=x?.gameState?.pokerPhase;return J&&J!=="waiting"?h.acquire():h.release(),()=>{h.release()}},[x?.gameState,h]);const[N,L]=v.useState(!1),j=Tt.useRef(!1),[q,U]=v.useState(null),[W,F]=v.useState(!1),[Y,Q]=v.useState(!1),[ie,G]=v.useState(!1),B=Tt.useRef(!1),K=Tt.useRef(!1),ae=Tt.useRef(null);Tt.useEffect(()=>{B.current=ie},[ie]),Tt.useEffect(()=>{K.current=W},[W]),Tt.useEffect(()=>{ae.current=q},[q]),Tt.useEffect(()=>{j.current=N},[N]),Tt.useEffect(()=>{(!q||q.length!==2)&&(Be.current=0)},[q]);const te=Tt.useRef(null),me=Tt.useRef(0);Tt.useRef(0);const ue=Tt.useRef(null),Ae=Tt.useRef(null),He=Tt.useRef(null),[ce,xe]=v.useState(0),[re,H]=v.useState(0),[he,Re]=v.useState([]),[fe,Ie]=v.useState([]),[ct,$e]=v.useState(!1),[rt,We]=v.useState([]),it=Tt.useRef(0),Et=Tt.useRef(0),Mt=Tt.useRef(0),_t=Tt.useRef(!1),ge=Tt.useRef(null),Be=Tt.useRef(0),je=Tt.useRef(void 0),nt=Tt.useRef(0),[Ct,jt]=Tt.useState([]),De=Tt.useRef(0),et=Tt.useRef(0),at=Tt.useRef(0),[we,st]=Tt.useState(!1),bt=Tt.useRef(0),nr=Tt.useRef(new Set),ur=Tt.useRef(null),dr=Tt.useRef(null),[Sr,un]=v.useState(0),[Z,X]=v.useState(0),[le,be]=Tt.useState(new Set),z=Tt.useRef([]),ee=Tt.useRef(null),se=Tt.useRef(0),Oe=!0,[wt,er]=v.useState(!0),Qt=Tt.useRef(0),Zt=Tt.useRef(null),oa=Tt.useRef(null),On=Tt.useRef(null),Ye=Tt.useMemo(()=>e?e.id:"",[e]),[Yt,At]=v.useState(!1);v.useEffect(()=>{let J=!0;return(async()=>{try{const{Preferences:pe}=await qr(async()=>{const{Preferences:Me}=await Promise.resolve().then(()=>Nc);return{Preferences:Me}},void 0,import.meta.url),{value:ye}=await pe.get({key:"onb_poker_v1"});if(!J)return;At(ye!=="1")}catch{if(!J)return;At(!0)}})(),()=>{J=!1}},[]);const Rt=Tt.useCallback(()=>{(async()=>{try{const{Preferences:J}=await qr(async()=>{const{Preferences:pe}=await Promise.resolve().then(()=>Nc);return{Preferences:pe}},void 0,import.meta.url);await J.set({key:"onb_poker_v1",value:"1"})}catch{}At(!1)})()},[]);Tt.useEffect(()=>{let J=!1,pe=null,ye=null,Me=null;const Se=Qe=>{try{const gt=Qe.getBoundingClientRect();if(gt&&isFinite(gt.height)){const nn=typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(max-width: 480px)").matches?85:Math.round(gt.height);document.body.style.setProperty("--poker-header-height",`${nn}px`)}}catch{}},Ve=()=>{if(J||typeof document>"u")return;const Qe=document.querySelector(".card-header.card-header--two-rows");if(Qe){Zt.current=Qe;try{pe=new ResizeObserver(()=>Se(Qe)),pe.observe(Qe)}catch{Me=()=>Se(Qe),window.addEventListener("resize",Me)}Se(Qe)}};if(Ve(),!Zt.current)try{ye=window.setTimeout(Ve,0)}catch{}return()=>{J=!0;try{document.body.style.removeProperty("--poker-header-height")}catch{}if(pe)try{pe.disconnect()}catch{}if(Me){try{window.removeEventListener("resize",Me)}catch{}Me=null}if(ye!=null){try{clearTimeout(ye)}catch{}ye=null}}},[]);const Dt=Tt.useCallback(J=>{try{const ye=document.body.querySelector(`li.player--avatar[data-player-id="${J}"]`),Se=(ye?.querySelector(".avatar-ring")||ye)?.getBoundingClientRect();return Se?{x:Se.left+Se.width/2,y:Se.top+Se.height/2}:null}catch{return null}},[]),Nn=Tt.useCallback(()=>{try{const J=ge.current;if(!J)return null;const pe=J.querySelectorAll(".poker-pot-stack");if(!pe||pe.length===0){const Qe=J.getBoundingClientRect();return Qe?{x:Qe.left+Qe.width/2,y:Qe.top+Qe.height/2}:null}let ye=1/0,Me=1/0,Se=-1/0,Ve=-1/0;return pe.forEach(Qe=>{const gt=Qe.getBoundingClientRect();gt&&(ye=Math.min(ye,gt.left),Me=Math.min(Me,gt.top),Se=Math.max(Se,gt.right),Ve=Math.max(Ve,gt.bottom))}),!isFinite(ye)||!isFinite(Me)||!isFinite(Se)||!isFinite(Ve)?null:{x:(ye+Se)/2,y:(Me+Ve)/2}}catch{return null}},[]);v.useEffect(()=>{O(()=>{try{const J=fe||[];if(!J.length)return;Qt.current=Date.now();const pe=Nn();if(!pe)return;const ye=[],Me=Number(re||x?.gameState?.pokerRoundSeq||0)||Date.now();if(Me&&De.current===Me)return;J.forEach((Se,Ve)=>{const Qe=Dt(Se.playerId);Qe&&ye.push({id:`poker-pot-${Me}-${Ve}`,amount:Math.max(1,Number(Se.amount||0)),fromId:"pot",toId:Se.playerId,startX:pe.x,startY:pe.y,endX:Qe.x,endY:Qe.y})}),ye.length&&(De.current=Me,et.current=Me,at.current=ye.length,jt(Se=>[...Se,...ye]),er(!1))}catch{}})},[fe,re,x?.gameState]),v.useEffect(()=>{const J=x?.gameState?.pokerPhase,pe=Array.isArray(fe)&&fe.length>0&&J!=="pre-flop"?fe.map(Ve=>String(Ve.playerId)):[],ye=nr.current,Me=new Set(pe),Se=(Ve,Qe)=>{try{const gt=document.querySelector(`li.player--avatar[data-player-id="${Ve}"]`);gt&&(Qe?gt.classList.add("player--winner-shake"):gt.classList.remove("player--winner-shake"))}catch{}};return ye.forEach(Ve=>{Me.has(Ve)||Se(Ve,!1)}),Me.forEach(Ve=>{ye.has(Ve)||Se(Ve,!0)}),nr.current=Me,()=>{nr.current.forEach(Ve=>Se(Ve,!1)),nr.current.clear()}},[fe,x?.gameState]),v.useEffect(()=>{try{window.__pokerRoomMounted=Date.now()}catch{}},[]),v.useEffect(()=>()=>{if(z.current.forEach(J=>clearTimeout(J)),z.current=[],ee.current&&(clearTimeout(ee.current),ee.current=null),ue.current!=null&&(clearTimeout(ue.current),ue.current=null),Ae.current!=null&&(clearTimeout(Ae.current),Ae.current=null),te.current!=null){try{clearTimeout(te.current)}catch{}te.current=null}He.current=null;try{const J=String(t||"");if(J&&ae.current&&ae.current.length===2){const pe=x?.gameState||{},ye=Number(pe?.pokerRoundSeq||Be.current||0)||0;Uh[J]={myHole:ae.current.slice(),roundSeq:ye,first:!!Y,both:!!W,ts:Date.now()};try{const Me=window;Me&&(Me.__pokerHoleDiag=Me.__pokerHoleDiag||[],Me.__pokerHoleDiag.push({kind:"persist_hole_on_unmount",at:Date.now(),round:ye}))}catch{}}}catch{}},[]),v.useEffect(()=>{const J=String(t||"");if(J)try{const pe=Uh[J];if(!pe)return;if(!(Date.now()-(pe.ts||0)<3e4)){delete Uh[J];return}if(Array.isArray(pe.myHole)&&pe.myHole.length===2){U(pe.myHole.slice()),Be.current=Number(pe.roundSeq||0)||Be.current||0,pe.first&&Q(!0),pe.both&&F(!0);try{const Me=window;Me&&(Me.__pokerHoleDiag=Me.__pokerHoleDiag||[],Me.__pokerHoleDiag.push({kind:"restore_persisted_hole_on_mount",at:Date.now(),round:pe.roundSeq}))}catch{}}}catch{}},[t]);function dn(J){if(!J||typeof J.category!="number")return;const pe=J.category|0,ye=Array.isArray(J.tiebreak)?J.tiebreak:[],Me=Ve=>"23456789TJQKA"[Math.max(0,Math.min(12,Ve))]||"?",Se=Ve=>({2:"Deuce",3:"Three",4:"Four",5:"Five",6:"Six",7:"Seven",8:"Eight",9:"Nine",T:"Ten",J:"Jack",Q:"Queen",K:"King",A:"Ace"})[Me(Ve)]||Me(Ve);switch(pe){case 8:return`Straight Flush (${Se(ye[0]??0)} high)`;case 7:return`Four of a Kind (${Se(ye[0]??0)}s)`;case 6:return`Full House (${Se(ye[0]??0)}s over ${Se(ye[1]??0)}s)`;case 5:return`Flush (${[ye[0],ye[1],ye[2],ye[3],ye[4]].filter(Ve=>Ve!=null).map(Ve=>Me(Ve)).join("")})`;case 4:return`Straight (${Se(ye[0]??0)} high)`;case 3:return`Three of a Kind (${Se(ye[0]??0)}s)`;case 2:return`Two Pair (${Se(ye[0]??0)}s & ${Se(ye[1]??0)}s)`;case 1:return`One Pair (${Se(ye[0]??0)}s)`;default:return`High Card (${Se(ye[0]??0)})`}}v.useEffect(()=>{if(!t)return;let J=!1;const pe=m,ye=r;return(async()=>{if(ur.current!==t&&!(x&&x.id===t))try{const Me=KE[t]||(async()=>pe(t))();KE[t]=Me;const Se=await Me;if(!J&&Se?.ok){ur.current=t,R(Se.room);try{o&&dr.current!==t&&(await Promise.resolve(o(t)),dr.current=t)}catch{}try{await ye()}catch{}}else if(!J&&Se&&!Se.ok)try{A("Poker",Se.error||"Failed to join room")}catch{}}catch{}finally{delete KE[t]}})(),()=>{J=!0,ur.current===t&&(ur.current=null);try{c&&dr.current===t&&(c(),dr.current=null)}catch{}}},[t]);const jr=Tt.useCallback((J,pe)=>{if(!J||J.id&&pe?.id&&J.id!==pe.id)return pe;try{const ye=Array.isArray(J.players)?J.players:[],Me=Array.isArray(pe?.players)?pe.players:[];if(Me.length===0&&ye.length>0)return{...J,...pe,players:ye};const Se=Me.map(Ve=>{const Qe=ye.find(gt=>String(gt.id)===String(Ve.id));return Qe?{...Qe,...Ve}:Ve});return{...J,...pe,players:Se}}catch{return pe||J}},[]);Pa({onJoinedRoom:({room:J})=>{try{if(J&&J.id===t){R(pe=>pe&&pe.id===J.id?jr(pe,J):J),ur.current=t||null;try{const pe=J?.gameState;if(!j.current&&pe&&typeof pe.pokerPhase=="string"&&pe.pokerPhase.length>0){L(!0);const ye=pe.pokerPhase;ye&&ye!=="pre-flop"&&ye!=="waiting"&&G(!1)}}catch{}}}catch{}},onRejoinedRoom:({room:J})=>{try{if(J&&J.id===t){R(pe=>pe&&pe.id===J.id?jr(pe,J):J),ur.current=t||null,G(!1);try{const pe=J?.gameState;!j.current&&pe&&typeof pe.pokerPhase=="string"&&pe.pokerPhase.length>0&&L(!0)}catch{}}}catch{}},onOtherPlayerJoined:({room:J})=>{try{J&&J.id===t&&R(pe=>pe&&pe.id===J.id?jr(pe,J):J)}catch{}},onOtherLeft:({room:J})=>{try{J&&J.id===t&&R(pe=>pe&&pe.id===J.id?jr(pe,J):J)}catch{}},onPlayerBalanceUpdated:({playerId:J,balance:pe})=>{R(ye=>{if(!ye||!Array.isArray(ye.players))return ye;const Me=ye.players.findIndex(Qe=>String(Qe.id)===String(J));if(Me===-1)return ye;const Se=ye.players.slice(),Ve=Se[Me];return typeof Ve?.balance=="number"&&Ve.balance===pe?ye:(Se[Me]={...Ve,balance:pe},{...ye,players:Se})})},onRoomUpdateState:J=>{if(!J||J.roomId!==t)return;if(J.myHole&&Array.isArray(J.myHole)&&J.myHole.length===2){const Se=Number(J?.room?.gameState?.pokerRoundSeq||0);if(!ae.current||ae.current.length!==2||Be.current&&Be.current!==Se){U(J.myHole),Se>0&&(Be.current=Se),me.current=Date.now();try{const Qe=typeof window<"u"?window:void 0;Qe&&(Qe.__pokerHoleDiag=Qe.__pokerHoleDiag||[],Qe.__pokerHoleDiag.push({kind:"hole_from_state",at:Date.now(),round:Se}))}catch{}const Ve=J?.room?.gameState?.pokerPhase;!B.current&&Ve!=="pre-flop"&&(Q(!0),setTimeout(()=>F(!0),180))}}R(Se=>{try{const Ve=J?.room,Qe=Ve?.gameState;if(!Se||Se.id&&Se.id!==J.roomId)return Ve&&Ve.id===J.roomId?Ve:Se;let gt=Qe?{...Se,gameState:Qe}:{...Se};return Ve&&Ve.id===Se.id&&(gt=jr(gt,Ve),Qe&&(gt.gameState=Qe)),gt}catch{return Se}});try{const Se=J?.room?.gameState;!j.current&&Se&&typeof Se.pokerPhase=="string"&&Se.pokerPhase.length>0&&L(!0)}catch{}const pe=J?.room?.gameState?.pokerPhase,ye=Number(J?.room?.gameState?.pokerRoundSeq||0),Me=je.current;if(je.current=pe,(pe||"")==="pre-flop"){const Se=ye>0&&ye!==it.current&&ye!==Et.current,Ve=!Me||["waiting","showdown","complete"].includes(String(Me));if(Se&&Ve){if(F(!1),Q(!1),ae.current&&ae.current.length===2)if(Be.current===0){Be.current=ye;try{const gt=typeof window<"u"?window:void 0;gt&&(gt.__pokerHoleDiag=gt.__pokerHoleDiag||[],gt.__pokerHoleDiag.push({kind:"assign_hole_round_on_preflop",at:Date.now(),round:ye}))}catch{}}else if(Be.current!==ye){U(null);try{const gt=String(t||"");gt&&delete Uh[gt]}catch{}try{const gt=typeof window<"u"?window:void 0;gt&&(gt.__pokerHoleDiag=gt.__pokerHoleDiag||[],gt.__pokerHoleDiag.push({kind:"clear_hole_new_round",at:Date.now(),toRound:ye,prevHoleRound:Be.current}))}catch{}}else try{const gt=typeof window<"u"?window:void 0;gt&&(gt.__pokerHoleDiag=gt.__pokerHoleDiag||[],gt.__pokerHoleDiag.push({kind:"keep_hole_new_round",at:Date.now(),round:ye}))}catch{}else Be.current=0;Et.current=ye,se.current=Date.now(),xe(ye);try{np(["cardSwoosh"])}catch{}const Qe=nt.current!==ye;Qe&&(nt.current=ye),(async()=>{if(await O_(["cardSwoosh"],900),G(!0),Qe)try{gT({volume:.6})}catch{}})()}else if(Se&&!Ve)try{const Qe=window;Qe&&(Qe.__pokerHoleDiag=Qe.__pokerHoleDiag||[],Qe.__pokerHoleDiag.push({kind:"skip_preflop_midhand",at:Date.now(),round:ye,prevPhase:Me}))}catch{}H(0),Re([]),Ie([]),er(!0)}else if((pe||"")==="waiting"){if(F(!1),Q(!1),G(!1),te.current!=null){try{clearTimeout(te.current)}catch{}te.current=null}xe(Se=>Se+1),Et.current=0,ae.current||(Be.current=0);try{const Se=String(t||"");Se&&!ae.current&&delete Uh[Se]}catch{}}},onPokerMyHole:J=>{if(!(!J||J.roomId!==t)&&Array.isArray(J.hole)&&J.hole.length===2){U(J.hole);try{const Me=x?.gameState||{},Se=Number(Me?.pokerRoundSeq||0);Se>0&&(Be.current=Se)}catch{}me.current=Date.now();try{const Me=typeof window<"u"?window:void 0;Me&&(Me.__pokerHoleDiag=Me.__pokerHoleDiag||[],Me.__pokerHoleDiag.push({kind:"hole",at:Date.now(),phase:x?.gameState?.pokerPhase,dealing:B.current,round:Number(x?.gameState?.pokerRoundSeq||0)}))}catch{}const ye=(x?.gameState?.pokerPhase||"")==="pre-flop";if(j.current)if(!ie&&!ye)Q(!0),setTimeout(()=>F(!0),180);else{if(te.current!=null){try{clearTimeout(te.current)}catch{}te.current=null}try{te.current=window.setTimeout(()=>{if(K.current||!ae.current||ae.current.length!==2)return;const Me=Date.now();if(B.current&&Me-(me.current||Me)>3e3&&G(!1),!j.current&&Me-(me.current||Me)<4e3){try{te.current=window.setTimeout(()=>{},500)}catch{}return}Q(!0),F(!0);try{const Ve=typeof window<"u"?window:void 0;Ve&&(Ve.__pokerHoleDiag=Ve.__pokerHoleDiag||[],Ve.__pokerHoleDiag.push({kind:"fallback_reveal",at:Me}))}catch{}},1800)}catch{}}}},onPokerRevealAll:J=>{if(!J||J.roomId!==t)return;const pe=Number(J?.roundSeq||0),ye=Number(x?.gameState?.pokerRoundSeq||0);if(pe&&ye){const Me=pe===ye,Se=ye===pe+1;if(!Me&&!Se)return}if(!(re&&re===pe)&&Array.isArray(J.hands)){Re(J.hands.filter(Se=>Array.isArray(Se?.hole)&&Se.hole.length===2)),H(pe||ye||Date.now());const Me=Array.isArray(fe)&&fe.length>0?fe:[];if((pe||ye)&&Me.length>0){const Se=Number(pe||ye),Qe=Me.reduce((gt,Er)=>gt+(Number(Er.amount)||0),0)||Number(x?.gameState?.wagerPool?.totalAmount||0)||0;We(gt=>{const Er=gt.findIndex(fr=>fr.roundSeq===Se),nn={roundSeq:Se,ts:Date.now(),winners:Me.slice(),hands:(J.hands||[]).slice(),pot:Qe,seats:Array.isArray(x?.gameState?.pokerSeats)?x.gameState.pokerSeats.map(fr=>({playerId:fr.playerId,seatIndex:fr.seatIndex,status:fr.status,rank:Me.find(an=>an.playerId===fr.playerId)?.rank||void 0,winnings:Me.find(an=>an.playerId===fr.playerId)?.amount})):void 0};if(Er>=0){const fr=gt.slice();return fr[Er]=nn,fr}return[...gt,nn].slice(-20)})}}},onPokerWinners:J=>{if(!J||J.roomId!==t)return;const pe=Number(J?.roundSeq||0),ye=Number(x?.gameState?.pokerRoundSeq||0);if(pe&&ye){const Se=pe===ye,Ve=ye===pe+1;if(!Se&&!Ve)return}re&&re===pe?Ie(Se=>Se.length?Se:Array.isArray(J.winners)?J.winners:[]):(Ie(Array.isArray(J.winners)?J.winners:[]),re||H(pe||ye||Date.now()));try{const Se=Number(pe||ye||0)||0;if(Se&&Mt.current!==Se){const Ve=Array.isArray(J.winners)?J.winners:[],gt=Ve.slice().sort((fr,an)=>String(fr.playerId).localeCompare(String(an.playerId))).map(fr=>`${fr.playerId}:${Number(fr.amount)||0}:${Number(fr.seatIndex)||0}:${fr.rank&&Number(fr.rank.category)||-1}`).join("|"),Er=typeof window<"u"?window:void 0,nn=Er&&Er.__pokerWinnersFlashGuard;if(!nn||nn.roundSeq!==Se||nn.content!==gt){const fr=Ve.find(Fa=>Fa&&Fa.rank&&typeof Fa.rank.category=="number"),an=dn(fr?.rank),sc=Ve.reduce((Fa,tl)=>Fa+(Number(tl.amount)||0),0)||Number(x?.gameState?.wagerPool?.totalAmount||0)||0,_u=sc>0?`Pot: z${sc}`:void 0,Gi=[an,_u].filter(Boolean).join(" ");Er&&(Er.__pokerWinnersFlashGuard={roundSeq:Se,content:gt,at:Date.now()});try{Er&&(Er.__pokerWinnersFlashed=!0)}catch{}const Cd=String(e?.id??e?.email??"");if(Ve.some(Fa=>String(Fa.playerId)===Cd)){const Fa=Ve.find(P0=>String(P0.playerId)===Cd),tl=Number(Fa?.amount||0),Jg=tl>0?`You won: z${tl}`:"You won!";try{I({kind:"win",title:Jg,subtitle:Gi,duration:4e3})}catch{}try{Er&&(Er.__E2E===!0||(Er.location?.search||"").includes("e2e=1"))&&(Er.__pokerWinnersFlashed={title:Jg,subtitle:Gi,roundSeq:Se,at:Date.now(),__viaServer:!0})}catch{}}Mt.current=Se}}}catch{}try{const Se=String(e?.id??e?.email??""),Ve=Array.isArray(J.winners)?J.winners:[];if(!Ve.some(gt=>String(gt.playerId)===Se)){let gt=0;const nn=(Array.isArray(x?.gameState?.pokerSeats)?x.gameState.pokerSeats:[]).find(Gi=>String(Gi.playerId||"")===Se),fr=Number(nn?.committed||0),an=Number(nn?.returned||0);fr>0&&(gt=Math.max(0,fr-(Number.isFinite(an)?an:0)));const Ds=Ve.find(Gi=>Gi&&Gi.rank&&typeof Gi.rank.category=="number"),sc=Ds?`Winner: ${dn(Ds.rank)}`:void 0,_u=gt>0?`You lost: z${gt}`:"You lost";try{O(()=>{try{I({kind:"lose",title:_u,subtitle:sc})}catch{}})}catch{}}}catch{}try{const Se=Number(pe||ye||0);Se&&bt.current!==Se&&(bt.current=Se,st(!0),setTimeout(()=>st(!1),5200))}catch{}const Me=Array.isArray(he)&&he.length>0?he:[];if((pe||ye)&&Me.length>0){const Se=Number(pe||ye),Ve=Array.isArray(J.winners)?J.winners:[],gt=Ve.reduce((Er,nn)=>Er+(Number(nn.amount)||0),0)||Number(x?.gameState?.wagerPool?.totalAmount||0)||0;We(Er=>{const nn=Er.findIndex(an=>an.roundSeq===Se),fr={roundSeq:Se,ts:Date.now(),winners:Ve.slice(),hands:Me.slice(),pot:gt,seats:Array.isArray(x?.gameState?.pokerSeats)?x.gameState.pokerSeats.map(an=>({playerId:an.playerId,seatIndex:an.seatIndex,status:an.status,rank:Ve.find(Ds=>Ds.playerId===an.playerId)?.rank||void 0,winnings:Ve.find(Ds=>Ds.playerId===an.playerId)?.amount})):void 0};if(nn>=0){const an=Er.slice();return an[nn]=fr,an}return[...Er,fr].slice(-20)})}try{a()}catch{}},onPokerTimedOut:J=>{try{if(!J||J.roomId!==t)return;const pe=String(e?.id??e?.email??"");if(J.playerId!==pe)return;const ye=J.action==="check"?"auto-check":"auto-fold";x0(`🕒 Timed out — ${ye}`)}catch{}}}),v.useEffect(()=>{if(!n||!t)return;const J=Me=>{Me.roomId===t&&($t(Me.readyPlayers||[]),rn(Me.requiredPlayers||[]),Me.allReady&&(Je(!1),un(0)))},pe=Me=>{Me.roomId===t&&(un(Me.endsAt),$t(Me.readyPlayers||[]),rn(Me.requiredPlayers||[]))},ye=Me=>{Me.roomId===t&&(un(0),X(0))};return n.on("poker:start_ready_update",J),n.on("poker:start_countdown",pe),n.on("poker:start_countdown_cancelled",ye),()=>{n.off("poker:start_ready_update",J),n.off("poker:start_countdown",pe),n.off("poker:start_countdown_cancelled",ye)}},[n,t]),v.useEffect(()=>{if(!Sr||Sr<=Date.now()){X(0);return}const J=()=>{const ye=Math.max(0,Math.ceil((Sr-Date.now())/1e3));X(ye),ye<=0&&un(0)};J();const pe=setInterval(J,1e3);return()=>clearInterval(pe)},[Sr]);const Ra=Tt.useRef("waiting");v.useEffect(()=>{const J=x?.gameState?.pokerPhase||"waiting",pe=Ra.current;Ra.current=J;const ye=!["waiting","complete"].includes(J),Me=!["waiting","complete"].includes(pe);(ye||J==="waiting"&&Me)&&($t([]),rn([]),un(0),X(0),Je(!1))},[x?.gameState?.pokerPhase]),v.useEffect(()=>{const J=x?.gameState;if(!J)return;const pe=J?.pokerPhase,ye=Number(J?.pokerRoundSeq||0);if((pe||"")==="pre-flop"&&ye>0&&ye!==it.current&&ye!==Et.current){if(F(!1),Q(!1),ae.current&&ae.current.length===2)if(Be.current===0){Be.current=ye;try{const Se=typeof window<"u"?window:void 0;Se&&(Se.__pokerHoleDiag=Se.__pokerHoleDiag||[],Se.__pokerHoleDiag.push({kind:"assign_hole_round_on_initial_preflop",at:Date.now(),round:ye}))}catch{}}else if(Be.current!==ye){U(null);try{const Se=typeof window<"u"?window:void 0;Se&&(Se.__pokerHoleDiag=Se.__pokerHoleDiag||[],Se.__pokerHoleDiag.push({kind:"clear_hole_initial_preflop",at:Date.now(),toRound:ye,prevHoleRound:Be.current}))}catch{}}else try{const Se=typeof window<"u"?window:void 0;Se&&(Se.__pokerHoleDiag=Se.__pokerHoleDiag||[],Se.__pokerHoleDiag.push({kind:"keep_hole_initial_preflop",at:Date.now(),round:ye}))}catch{}else Be.current=0;Et.current=ye,se.current=Date.now(),xe(ye);try{np(["cardSwoosh"])}catch{}const Me=nt.current!==ye;Me&&(nt.current=ye),(async()=>{if(await O_(["cardSwoosh"],900),G(!0),Me)try{gT({volume:.6})}catch{}})()}},[x?.gameState]),Tt.useEffect(()=>{try{const J=typeof window<"u"?window:void 0;if(!(!!J&&(J.__E2E===!0||typeof J.location?.search=="string"&&J.location.search.includes("e2e=1")||J.sessionStorage&&J.sessionStorage.getItem("e2e")==="1")))return;const ye=(t||"").startsWith("e2e-"),Me=!x||!x.gameState||!Array.isArray(x.gameState.pokerSeats);if(!ye||!Me||_t.current)return;_t.current=!0;try{window.__pokerFallbackArmed=Date.now()}catch{}const Se=setTimeout(()=>{try{const Ve=Date.now()%1e5,Qe={playerId:String(Ye||i||"hero"),seatIndex:0,amount:120,rank:{category:1,tiebreak:[12,7,5,4,2]}},gt=[{playerId:String(Ye||i||"hero"),seatIndex:0,hole:["Ah","Ad"]},{playerId:"bot1",seatIndex:1,hole:["Kc","Qs"]},{playerId:"bot2",seatIndex:2,hole:["9h","9s"]},{playerId:"bot3",seatIndex:3,hole:["7d","6d"]}];Ie([Qe]),Re(gt),H(Ve);const Er=`You: +z${Number(Qe.amount||0)}`,nn=`Pot: z${Number(Qe.amount||0)}`,fr=`${dn(Qe.rank)} ${nn}`;try{window.__pokerWinnersFlashed={title:Er,subtitle:fr,roundSeq:Ve,at:Date.now(),__fallback:!0}}catch{}try{window.__pokerFallbackFired=Date.now()}catch{}}catch{}},5500);return()=>clearTimeout(Se)}catch{}},[]),Tt.useEffect(()=>{try{const J=typeof window<"u"?window:void 0;if(!(!!J&&(J.__E2E===!0||typeof J.location?.search=="string"&&J.location.search.includes("e2e=1")||J.sessionStorage&&J.sessionStorage.getItem("e2e")==="1")))return;const ye=setTimeout(()=>{try{if(window.__pokerWinnersFlashed)return;const Me=Date.now()%1e5,Se={playerId:String(Ye||i||"hero"),seatIndex:0,amount:80,rank:{category:1,tiebreak:[11,9,6,4,2]}},Ve=[{playerId:String(Ye||i||"hero"),seatIndex:0,hole:["As","Ad"]}];Ie([Se]),Re(Ve),H(Me);const Qe=`You: +z${Number(Se.amount||0)}`,gt=`Pot: z${Number(Se.amount||0)}`,Er=`${dn(Se.rank)} ${gt}`;try{window.__pokerWinnersFlashed={title:Qe,subtitle:Er,roundSeq:Me,at:Date.now(),__safety:!0}}catch{}}catch{}},1e4);return()=>clearTimeout(ye)}catch{}},[C,Ye,i]),v.useEffect(()=>{const J=x?.gameState?.pokerPhase,pe=["flop","turn","river","showdown"].includes(J||"");N&&pe&&q&&q.length===2&&!W&&!ie&&(Q(!0),F(!0))},[x?.gameState,q,W,ie,N]),v.useEffect(()=>{const pe=(x?.gameState?.pokerPhase||"")==="pre-flop";if(N&&pe&&!ie&&q&&q.length===2&&!W){Q(!0);const ye=setTimeout(()=>F(!0),220);return()=>clearTimeout(ye)}},[ie,x?.gameState,q,W,N]),v.useEffect(()=>{if(!N||!q||q.length!==2||W)return;const J=setTimeout(()=>{!K.current&&ae.current&&ae.current.length===2&&(Q(!0),setTimeout(()=>F(!0),180))},300);return()=>clearTimeout(J)},[N,q,W]),v.useEffect(()=>()=>{Be.current=0},[]);const co=x?.name||"Poker Room",pn=v.useMemo(()=>(Array.isArray(x?.players)?x.players:[]).map(pe=>({id:String(pe.id??""),name:String(pe.name||pe.email||pe.id||""),balance:typeof pe.balance=="number"?pe.balance:0,avatarUrl:pe.avatarUrl||void 0})),[x?.players]);Tt.useCallback((J,pe)=>pn.find(ye=>ye.id===J)?.name||`Seat ${pe+1}`,[pn]);const tc=v.useMemo(()=>x?.gameState?x.gameState:{gameMode:"poker",roundSeq:1},[x?.gameState]);k0e({gameState:tc,players:pn,winners:fe,hands:he,meId:Ye});const[zi]=v.useState(()=>Date.now()),Ts=v.useMemo(()=>{const J=x?.gameState?.pokerPhase;return J==="pre-flop"||J==="flop"||J==="turn"||J==="river"||J==="showdown"},[x?.gameState]),_i=Number(x?.gameState?.pokerUiLockedUntilTs||0),Qn=_i>0&&Date.now()<_i,hn=7e3,Cs=Tt.useRef(null);Tt.useEffect(()=>{const J=String(x?.gameState?.pokerPhase||"");Qn?Cs.current==null&&(Cs.current=Date.now()):J==="waiting"&&(Cs.current=null)},[Qn,x?.gameState]);const xs=Cs.current??(se.current||0),Ps=xs>0?Date.now()-xs:Number.POSITIVE_INFINITY,$i=Qn&&Ps<=hn,[,Lp]=Tt.useReducer(J=>J+1,0);Tt.useEffect(()=>{if(!Qn)return;const J=xs>0?xs+hn:Number.POSITIVE_INFINITY,pe=_i>0?_i:Number.POSITIVE_INFINITY,ye=Math.min(J,pe);if(!isFinite(ye))return;const Me=Math.max(0,Math.min(15e3,Math.ceil(ye-Date.now()+2))),Se=window.setTimeout(()=>{try{Lp()}catch{}},Me);return()=>{window.clearTimeout(Se)}},[Qn,_i,xs,hn]);const kd=v.useMemo(()=>{const J=x?.gameState||{},pe=J?.pokerPhase||"",ye=Array.isArray(J?.pokerCommunity)?J.pokerCommunity:[];return pe==="flop"?ye.length>=3&&![0,1,2].some(Me=>le.has(Me)):pe==="turn"?ye.length>=4&&!le.has(3):pe==="river"?ye.length>=5&&!le.has(4):!0},[x?.gameState,le]),wd=x?.gameState?.pokerPhase||"",Bp=["showdown","complete"].includes(wd),rc=Date.now()-zi<800||!Ts||ie||$i||!kd||Bp,{isBettingStreet:lo,isHeroTurn:ma,heroStatus:ga,toCall:Ba,canCheck:Yc,canCall:vu,canBet:Xc,canRaise:uo,showActions:Sd,minRaiseTo:ca,currentBet:fo,heroStack:bi,turnDeadlineTs:Jc}=v.useMemo(()=>{const J=x?.gameState||{},pe=J?.pokerPhase||"",ye=["pre-flop","flop","turn","river"].includes(pe),Se=(Array.isArray(J?.pokerSeats)?J.pokerSeats:[]).find(tl=>String(tl.playerId)===String(Ye)),Ve=typeof J?.pokerActingSeat=="number"?J.pokerActingSeat:void 0,Qe=!!Se&&typeof Ve=="number"&&Se.seatIndex===Ve,gt=Number(J?.pokerCurrentBet||0),Er=Number(Se?.committed||0),nn=Number(Se?.stack||0),fr=String(Se?.status||"active"),an=Math.max(0,gt-Er),Ds=an===0&&fr==="active",sc=an>0&&fr==="active"&&nn>0,_u=gt===0&&fr==="active"&&nn>0,Gi=gt>0&&fr==="active"&&nn>0,Cd=ye&&!!Se&&fr==="active",Xg=Number(J?.pokerMinRaiseTo||0),Fa=Number(J?.pokerTurnDeadlineTs||0)||void 0;return{isBettingStreet:ye,isHeroTurn:Qe,heroStatus:fr,toCall:an,canCheck:Ds,canCall:sc,canBet:_u,canRaise:Gi,showActions:Cd,minRaiseTo:Xg,currentBet:gt,heroStack:nn,turnDeadlineTs:Fa}},[x?.gameState,Ye]),_e=rc||!ma||ga!=="active",Ze=v.useMemo(()=>{const J=x?.gameState||{},pe=J?.pokerPhase||"waiting",ye=Array.isArray(J?.pokerSeats)?J.pokerSeats:[];return["waiting","complete"].includes(pe)&&ye.length>=2&&!ie&&!$i&&!!t},[x?.gameState,ie,$i,t]),[ot,Je]=v.useState(!1),[Nt,$t]=v.useState([]),[Or,rn]=v.useState([]),Tn=v.useMemo(()=>Nt.includes(Ye),[Nt,Ye]),la=Tt.useCallback(()=>{ue.current!=null&&(clearTimeout(ue.current),ue.current=null),Ae.current!=null&&(clearTimeout(Ae.current),Ae.current=null),He.current=null},[]),{rack:As,totalAmount:ya,addChip:Qc,clearChip:Rs,clearAllChips:ki}=BA(),[wi,Vi]=v.useState(!1),[po,Lr]=v.useState(null),Zn=Ye,ea=!!Ts&&!ie&&!(Array.isArray(he)&&he.length>0),[Ua,Da]=v.useState({active:!1,key:0,indices:[]}),ta=Tt.useRef(0);v.useEffect(()=>{const pe=(Array.isArray(x?.gameState?.pokerCommunity)?x.gameState.pokerCommunity:[]).length,ye=ta.current;if(pe>ye){const Me=Array.from({length:pe-ye},(Se,Ve)=>ye+Ve);be(Se=>{const Ve=new Set(Se);return Me.forEach(Qe=>Ve.add(Qe)),Ve}),ee.current&&(clearTimeout(ee.current),ee.current=null),ee.current=window.setTimeout(()=>{Da({active:!0,key:Date.now(),indices:Me}),ee.current=null},3e3),ta.current=pe}else ta.current=pe},[x?.gameState]),Tt.useEffect(()=>{const J=On.current;if(!J)return;J.style.marginTop=J.style.marginTop==="0px"?"0.01px":"0px";const pe=window.setTimeout(()=>{J&&(J.style.marginTop="")},0);return()=>window.clearTimeout(pe)},[ie,W,Y,wi]);const Fn=(J,pe)=>{!J&&pe&&A("Poker",pe)},Hi=async()=>{if(!t)return;la();const J=await b(t);Fn(J?.ok,J?.error)},nc=async()=>{if(!t)return;la();const J=await E(t);Fn(J?.ok,J?.error)},Ed=async()=>{if(!t)return;la();const J=await w(t);Fn(J?.ok,J?.error)},Td=()=>{_e||!Xc||(Lr("bet"),Vi(!0))},Yg=()=>{_e||!uo||(Lr("raise"),Vi(!0))},Oa=async()=>{if(!t||!po)return;la();let J=ya;if(po==="bet"){(!J||J<=0)&&(J=Math.max(1,ca||1));const pe=Math.floor(J),ye=await T(t,pe);Fn(ye?.ok,ye?.error),ye?.ok&&(ki(),Vi(!1),Lr(null))}else if(po==="raise"){if(!J||J<=0){const Me=Math.max(0,ca-fo);J=Math.max(1,Me)}J=Math.min(J,Math.max(0,bi));const pe=Math.floor(J),ye=await D(t,pe);Fn(ye?.ok,ye?.error),ye?.ok&&(ki(),Vi(!1),Lr(null))}},ac=()=>{ki(),Vi(!1),Lr(null)},[ic,Zc]=Tt.useState(null),x0=Tt.useCallback(J=>{try{const pe=Dt(Ye);pe&&Zc({x:pe.x,y:Math.max(0,pe.y-70),text:J});const ye=document.querySelector(`li.player--avatar[data-player-id="${Ye}"]`);ye&&(ye.classList.add("player--timeout"),setTimeout(()=>{try{ye.classList.remove("player--timeout")}catch{}},2500)),setTimeout(()=>Zc(null),2600)}catch{}},[Dt,Ye]);v.useEffect(()=>{(_e||!Sd)&&(Vi(!1),Lr(null),ki())},[_e,Sd]);const el=Tt.useRef(0);return v.useEffect(()=>{const J=x?.gameState;if(!J)return;const pe=J?.pokerLastAction;if(!pe||typeof pe.seq!="number"||el.current===pe.seq)return;const ye=String(pe.action||"").toLowerCase();if(!["bet","raise","call"].includes(ye)){el.current=pe.seq;return}const Me=Math.max(0,Number(pe.amountDelta||0));if(Me<=0){el.current=pe.seq;return}const Ve=(Array.isArray(J?.pokerSeats)?J.pokerSeats:[]).find(gt=>gt.seatIndex===pe.seatIndex),Qe=Ve?.playerId?String(Ve.playerId):void 0;O(()=>{try{const gt=Nn();if(!gt)return;const Er=Qe?Dt(Qe):null;if(!Er)return;const nn=`poker-commit-${pe.seq}-${Qe||pe.seatIndex}-${Date.now()}`;jt(fr=>[...fr,{id:`${nn}-to-pot`,amount:Me,fromId:Qe||`seat:${pe.seatIndex}`,toId:"pot",startX:Er.x,startY:Er.y,endX:gt.x,endY:gt.y,startDelaySec:.1}])}catch{}}),el.current=pe.seq},[x?.gameState,O,Dt,Oe]),g.jsxs(g.Fragment,{children:[g.jsx(ji,{className:"page-poker-room"}),g.jsx(fP,{open:Yt,onClose:Rt,title:"Poker",tagline:"Bet, check, raise — best hand wins at showdown.",steps:["Each player gets 2 hole cards","Bet after each street: flop, turn, river","Make the best 5‑card hand to win the pot"],primaryLabel:"Got it",persistKey:"onb_poker_v1"}),g.jsxs(WA,{showAvatarBacks:ea,header:g.jsx("div",{className:"poker-room-header",children:g.jsx(HA,{roomName:co,roomId:t,players:pn,meId:Zn,gameState:tc,lastRollerId:null,showHeader:!0,revealedHands:he,historyHalo:we,singlePlayer:x?.singlePlayer,turnDeadlineTs:Jc,isBettingStreet:lo,isHeroTurn:ma,onOpenHistory:async()=>{if($e(!0),!!t)try{const J=await P(t,20);if(J?.ok&&Array.isArray(J?.data?.items)){const pe=J.data.items;We(ye=>{const Me=pe.map(Ve=>({roundSeq:Number(Ve.seq||Ve.roundSeq||0),ts:Number(Ve.endedAt||Ve.createdAt||Date.now()),pot:Number(Ve.mainPot||Ve.pot||0),winners:Array.isArray(Ve.seats)?Ve.seats.filter(Qe=>(Qe.winnings||0)>0).map(Qe=>({playerId:Qe.playerId,seatIndex:Qe.seatIndex,amount:Qe.winnings||0,rank:Qe.rank?Qe.rank:Qe.handRank!=null?{category:Qe.handRank,tiebreak:Qe.tiebreak||[]}:void 0})):[],hands:Array.isArray(Ve.seats)?Ve.seats.map(Qe=>({playerId:Qe.playerId,seatIndex:Qe.seatIndex,hole:Array.isArray(Qe.hole)?Qe.hole:Array.isArray(Qe.holeCards)?Qe.holeCards:[]})):[],seats:Array.isArray(Ve.seats)?Ve.seats.map(Qe=>({playerId:Qe.playerId,seatIndex:Qe.seatIndex,status:Qe.status,rank:Qe.rank?Qe.rank:Qe.handRank!=null?{category:Qe.handRank,tiebreak:Qe.tiebreak||[]}:void 0,winnings:Qe.winnings})):void 0})),Se=new Map;for(const Ve of[...ye,...Me])Se.set(Ve.roundSeq,Ve);return Array.from(Se.values()).sort((Ve,Qe)=>Qe.roundSeq-Ve.roundSeq).slice(0,20)})}}catch{}}})}),children:[g.jsx(CL,{enabled:ie,handKey:ce,perCardSec:.6,staggerSec:.14,onComplete:()=>{G(!1);const J=Et.current;if(J>0&&(it.current=J),q&&!W&&(Q(!0),setTimeout(()=>F(!0),200)),te.current!=null){try{clearTimeout(te.current)}catch{}te.current=null}try{const pe=typeof window<"u"?window:void 0;pe&&(pe.__pokerHoleDiag=pe.__pokerHoleDiag||[],pe.__pokerHoleDiag.push({kind:"dealing_complete",at:Date.now()}))}catch{}}}),g.jsx(CL,{enabled:Ua.active,handKey:`board-${Ua.key}`,perCardSec:.5,staggerSec:.12,passes:1,getTargets:J=>{try{const pe=J.getBoundingClientRect(),ye=J.ownerDocument?.querySelector(".poker-board");if(!ye)return[];const Me=Array.from(ye.querySelectorAll(".poker-card"));return Ua.indices.map(Ve=>{const Qe=Me[Ve];if(!Qe)return null;const gt=Qe.getBoundingClientRect();return{x:(gt.left+gt.right)/2-pe.left,y:(gt.top+gt.bottom)/2-pe.top}}).filter(Boolean)}catch{return[]}},onComplete:()=>{const J=Ua.indices.slice();if(Da(pe=>({...pe,active:!1})),J.length>0){be(ye=>{const Me=new Set(ye);return J.forEach(Se=>Me.add(Se)),Me});const pe=window.setTimeout(()=>{be(ye=>{const Me=new Set(ye);return J.forEach(Se=>Me.delete(Se)),Me})},250);z.current.push(pe)}}}),g.jsxs("div",{className:"poker-mock",children:[Ze&&g.jsxs("div",{className:"poker-start-hand",style:{position:"absolute",top:8,right:12,zIndex:5},children:[Z>0&&g.jsxs("div",{className:"poker-start-hand__countdown",style:{marginBottom:4,fontSize:"0.9rem",color:"#ffd700",textAlign:"center",fontWeight:"bold"},children:["Starting in ",Z,"s"]}),Or.length>1&&g.jsxs("div",{className:"poker-start-hand__readiness",style:{marginBottom:4,fontSize:"0.75rem",color:"#ccc",textAlign:"center"},children:[Nt.length,"/",Or.length," ready"]}),g.jsx("button",{type:"button",className:["gold-link","poker-start-hand__btn",ot?"is-busy":"",Tn?"is-ready":""].filter(Boolean).join(" "),"aria-label":Tn?"Waiting for others":"Start Hand",disabled:ot||Tn,onClick:async()=>{if(t){try{const{hapticClick:J}=await qr(async()=>{const{hapticClick:pe}=await Promise.resolve().then(()=>yne);return{hapticClick:pe}},void 0,import.meta.url);J("Medium")}catch{}Je(!0);try{const J=await _(t);if(J?.countdown&&un(J?.countdown),J?.waiting){$t(J?.readyPlayers||[]),rn(J?.requiredPlayers||[]);return}if(!J?.ok)try{A("Poker",J?.error||"Unable to start hand")}catch{}Je(!1)}catch{try{A("Poker","Unable to start hand")}catch{}Je(!1)}}},children:Tn?"✓ Ready":"Start Hand"})]}),g.jsxs("div",{className:"poker-mock__table",children:[g.jsx("div",{className:"poker-mock__table-ring","aria-hidden":!0}),g.jsxs("div",{className:"poker-board-wrap",children:[g.jsx("div",{className:"poker-pot","aria-label":"poker-pot",ref:ge,style:wt?void 0:{visibility:"hidden"},children:(()=>{const J=Number(tc?.wagerPool?.totalAmount||0),pe=LA(J);return Object.entries(pe.reduce((ye,Me)=>{const Se=String(Me);return ye[Se]=(ye[Se]||0)+1,ye},{})).sort((ye,Me)=>Number(Me[0])-Number(ye[0])),g.jsx("div",{className:"poker-pot__wrap",children:g.jsxs("div",{className:"poker-pot__context","aria-live":"polite",children:[g.jsxs("span",{className:"poker-pot__stack-info",children:["You: z",bi]}),g.jsx("span",{className:"poker-pot__divider","aria-hidden":"true",children:"•"}),g.jsxs("span",{className:`poker-pot__pot-info ${Ba>0&&bi>0&&Ba/bi>=.25?"poker-pot__pot-info--high":""}`,children:[Ba>0?`To Call: z${Ba}`:`Pot: z${J}`,Ba>0&&bi>0&&Ba/bi>=.5&&g.jsxs("span",{className:"poker-pot__high-pct","aria-label":"High percentage of stack",children:[Math.round(Ba/bi*100),"%"]})]})]})})})()}),g.jsx(D0e,{boardCards:Array.isArray(x?.gameState?.pokerCommunity)?x.gameState.pokerCommunity:[]}),g.jsx("div",{className:"poker-board poker-community","aria-label":"community-cards",children:Array.isArray(x?.gameState?.pokerCommunity)&&x.gameState.pokerCommunity.map((J,pe)=>{const ye=le.has(pe)||pe>=(ta.current||0),Me=x.gameState.pokerCommunity,Se=R0e(pe),Ve=P0e(Me,pe),Qe=Se==="river"&&Me.length===5;return g.jsx(I0e,{value:J,concealed:ye,position:Se,isPaired:Ve,animateEntrance:Qe&&!ye},`${J}-${pe}`)})}),g.jsx("div",{className:["poker-hole",ie?"poker-hole--concealed":"",W?"is-revealed":"",!W&&Y?"is-partial":"",ma&&!_e?"poker-hole--active-turn":""].filter(Boolean).join(" "),"aria-label":"hole-cards",ref:oa,children:g.jsxs("div",{className:"poker-hole-stack",children:[g.jsx("div",{className:"poker-hole-label","aria-hidden":!0,children:"--"}),Y,W,g.jsx(v0e,{cards:q,firstRevealed:!!Y,bothRevealed:!!W}),Array.isArray(x?.gameState?.pokerCommunity)&&x.gameState.pokerCommunity.length>0&&(()=>{const J=x.gameState.pokerCommunity;return KA(J).length>0?g.jsxs("div",{className:"poker-hole__board-hint","aria-label":"Board is paired",title:"Paired board",children:[g.jsx("span",{className:"poker-hole__board-icon","aria-hidden":"true",children:"≡"}),g.jsx("span",{className:"poker-hole__board-text",children:"Paired Board"})]}):null})()]})})]}),ic&&g.jsx("div",{className:"poker-timeout-toast","aria-live":"polite",style:{position:"fixed",left:ic.x,top:ic.y,transform:"translate(-50%, -100%)"},children:ic.text})]}),ct&&g.jsx(w0e,{players:pn,entries:rt,onClose:()=>$e(!1)}),Ct.length>0&&g.jsx(w6,{anim:Ct[0],onComplete:()=>{Ct[0],jt(J=>J.slice(1))}},Ct[0].id)]}),g.jsxs("div",{className:"poker-actions-wrap",ref:On,children:[g.jsxs("div",{className:["poker-actions","poker-actions--group","poker-actions--segmented",ma&&!_e?"poker-actions--halo":""].filter(Boolean).join(" "),role:"group","aria-label":"Action buttons","aria-disabled":_e||void 0,children:[Yc&&g.jsx(Io,{label:"Check",ariaLabel:"Check",size:"md",disabled:_e,onClick:Hi,className:"poker-action--flat poker-action--secondary poker-action--check"}),!Yc&&vu&&g.jsx(Io,{label:"Call",subtitle:`z${Ba}`,ariaLabel:`Call ${Ba}`,size:"md",disabled:_e,onClick:nc,className:"poker-action--flat poker-action--primary poker-action--call"}),Xc&&g.jsx(Io,{label:"Bet",subtitle:ya>0?`z${ya}`:void 0,ariaLabel:"Bet",size:"md",disabled:_e,onClick:Td,className:"poker-action--green poker-action--secondary poker-action--bet"}),!Xc&&uo&&g.jsx(Io,{label:"Raise",subtitle:ya>0?`z${ya}`:void 0,ariaLabel:"Raise",size:"md",disabled:_e,onClick:Yg,className:["poker-action--green","poker-action--secondary","poker-action--raise",po==="raise"&&wi?"raise-active":""].filter(Boolean).join(" ")}),ga==="active"&&g.jsx(Io,{label:"Fold",ariaLabel:"Fold",size:"md",disabled:_e,onClick:Ed,className:"poker-action--flat poker-action--danger poker-action--fold"})]}),g.jsx("div",{className:"poker-chiprack",style:wi?void 0:{visibility:"hidden",pointerEvents:"none"},children:g.jsx(w0,{selectedTimes:As,onAdd:Qc,onClear:Rs,onPlaceBet:Oa,onCancelBet:ac,disabled:_e,collapsed:!wi,mainAmt:ya,betTokenProps:{isBanker:!1,meId:Zn,open:[],players:pn,show:!0,labelPrefix:""}})})]})]})]})}function j0e(){const t=tn(),{user:e}=$r(),[r,n]=v.useState(!1),a=(()=>{try{return window.location.search.includes("e2e=1")||window.__E2E===!0||window.sessionStorage?.getItem("e2e")==="1"}catch{return!1}})(),i=v.useCallback(()=>{if(!(Number(e?.balance??0)>=1e3)){n(!0);return}const c=`e2e-${Math.random().toString(36).slice(2,8)}`;t(`/poker/room/${c}?m=poker`)},[t,e?.balance]);return g.jsxs(WA,{header:g.jsx("div",{className:"poker-room-header",role:"banner",children:g.jsx("h1",{className:"poker-title","aria-label":"Poker Room",children:"Poker"})}),children:[a&&g.jsx("div",{className:"poker-room-controls",role:"group","aria-label":"poker e2e controls",children:g.jsx("button",{type:"button",onClick:i,"aria-label":"Create Game",children:"Create Game"})}),a&&g.jsx("div",{className:"poker-actions-wrap",children:g.jsxs("div",{className:["poker-actions","poker-actions--group","poker-actions--segmented","poker-actions--halo"].join(" "),role:"group","aria-label":"Action buttons",children:[g.jsx(Em,{label:"Check",ariaLabel:"Check",size:"md",onClick:()=>{},className:"poker-action--flat"}),g.jsx(Em,{label:"Bet",ariaLabel:"Bet",size:"md",onClick:()=>{},className:"poker-action--flat"}),g.jsx(Em,{label:"Fold",ariaLabel:"Fold",size:"md",onClick:()=>{},className:"poker-action--flat poker-action--fold"})]})})]})}const Uu=(t,e)=>({rank:t,suit:e}),Fh={name:"Texas Hold’em",pot:295,community:[Uu("5","♠"),Uu("8","♦"),Uu("A","♣"),Uu("10","♣"),Uu("2","♥")],players:[{id:"p1",name:"Hero",stack:295,bet:25,isHero:!0,isActing:!0,hole:[Uu("K","♠"),Uu("K","♦")]},{id:"p2",name:"Eve",stack:420,bet:25,hole:null},{id:"p3",name:"Zoe",stack:380,bet:0,hole:null},{id:"p4",name:"Rey",stack:260,bet:0,hole:null}]},L0e=[{kind:"call",amount:25},{kind:"fold"},{kind:"check"},{kind:"bet",amount:0},{kind:"raise",to:0}];function xL(t){switch(t.kind){case"check":return"CHECK";case"fold":return"FOLD";case"call":return"CALL";case"bet":return t.amount&&t.amount>0?`BET ${t.amount}`:"BET";case"raise":return t.to&&t.to>0?`RAISE ${t.to}`:"RAISE"}}function PL(t){return`${t.rank}${t.suit}`}function B0e(){const{user:t}=$r(),[e,r]=Tt.useState(!1),n=Fh.players.find(m=>m.isHero),a=Fh.players.map(m=>({id:m.id,name:m.name,balance:m.bet??0})),i={gameMode:"poker"},o=typeof window<"u"&&window.location.search.includes("e2e=1"),{rack:c,totalAmount:u,addChip:d,clearChip:f,clearAllChips:h}=BA();return g.jsx(g.Fragment,{children:g.jsx(WA,{header:g.jsx("div",{className:"poker-room-header",children:g.jsx(HA,{roomName:Fh.name,players:a,meId:n.id,gameState:i,lastRollerId:null,showHeader:!0})}),children:g.jsxs("div",{className:"poker-mock",children:[o&&g.jsx("div",{className:"poker-e2e-bar",children:g.jsx("button",{className:"felt-btn","aria-label":"Create Game",onClick:()=>{if(!(Number(t?.balance??0)>=1e3)){r(!0);return}const _="e2e_"+Math.random().toString(36).slice(2,8);window.location.assign(`/poker/room/${_}`)},children:"Create Game"})}),g.jsxs("div",{className:"poker-mock__table",children:[g.jsx("div",{className:"poker-mock__table-ring","aria-hidden":!0}),g.jsx("div",{className:"poker-board",children:Fh.community.map((m,_)=>{const w=m.suit==="♥"||m.suit==="♦";return g.jsxs("div",{className:["poker-card",w?"poker-card--red":""].filter(Boolean).join(" "),"aria-label":PL(m),children:[g.jsx("span",{className:"poker-card__rank",children:m.rank}),g.jsx("span",{className:"poker-card__suit",children:m.suit})]},_)})}),g.jsxs("div",{className:"poker-pot",children:["$",Fh.pot]})]}),n?.hole&&g.jsx("div",{className:"poker-hole",children:n.hole.map((m,_)=>{const w=m.suit==="♥"||m.suit==="♦";return g.jsxs("div",{className:["poker-card",w?"poker-card--red":""].filter(Boolean).join(" "),"aria-label":PL(m),children:[g.jsx("span",{className:"poker-card__rank",children:m.rank}),g.jsx("span",{className:"poker-card__suit",children:m.suit})]},_)})}),g.jsx("div",{className:"poker-actions-wrap",children:g.jsx("div",{className:"poker-actions",children:L0e.map((m,_)=>g.jsx(Em,{label:xL(m),ariaLabel:xL(m),size:"md",onClick:()=>{}},_))})}),g.jsx("div",{className:"poker-chiprack",children:g.jsx(w0,{selectedTimes:c,onAdd:d,onClear:f,onPlaceBet:()=>{h()},onCancelBet:()=>{h()},disabled:!1,collapsed:!1,miniChips:!0,mainAmt:u,betTokenProps:{isBanker:!1,meId:n.id,open:[],players:a,show:!0}})})]})})})}function U0e(){const t=tn(),e=yi();return v.useEffect(()=>{const n=new URLSearchParams(window.location.search).get("redirect");n&&t(n),rO()},[t]),v.useEffect(()=>{rO(e.pathname)},[e.pathname]),v.useEffect(()=>{try{const r=e.pathname||"",n=r==="/lobby",a=/^\/room\//.test(r)||/^\/poker\/room\//.test(r);(()=>{try{return/^(capacitor:|ionic:)/i.test(window.location?.protocol||"")}catch{return!1}})()?(document.body.classList.add("is-native-app"),document.documentElement.classList.add("is-native-app")):(document.body.classList.remove("is-native-app"),document.documentElement.classList.remove("is-native-app")),document.body.classList.toggle("page-home-screen",n),document.body.classList.toggle("page-gameroom",a);const o=document.documentElement;if(n||a){o.style.setProperty("overflow","hidden","important"),document.body.style.setProperty("overflow","hidden","important"),o.style.setProperty("overscroll-behavior","none","important"),document.body.style.setProperty("overscroll-behavior","none","important"),o.style.setProperty("height","100svh","important"),document.body.style.setProperty("height","100svh","important");try{window.scrollTo({top:0,left:0,behavior:"instant"})}catch{}}else o.style.removeProperty("overflow"),document.body.style.removeProperty("overflow"),o.style.removeProperty("overscroll-behavior"),document.body.style.removeProperty("overscroll-behavior"),o.style.removeProperty("height"),document.body.style.removeProperty("height")}catch{}},[e.pathname]),g.jsxs(XV,{children:[g.jsxs(yn,{element:g.jsx(Qoe,{}),children:[g.jsx(yn,{path:"/verify",element:g.jsx(l0e,{})}),g.jsx(yn,{path:"/review-login",element:g.jsx(u0e,{})}),g.jsx(yn,{path:"/qa-login",element:g.jsx(d0e,{})}),g.jsx(yn,{path:"/login",element:g.jsx(Joe,{})}),g.jsx(yn,{path:"/verification-failed",element:g.jsx(iG,{})})]}),g.jsxs(yn,{element:g.jsx(aG,{}),children:[g.jsx(yn,{path:"/profile",element:g.jsx(a0e,{})}),g.jsx(yn,{path:"/settings",element:g.jsx(i0e,{})}),g.jsx(yn,{path:"/add-chips",element:g.jsx(c0e,{})}),g.jsx(yn,{path:"/admin",element:g.jsx(tm,{to:"/lobby",replace:!0})}),g.jsx(yn,{path:"/",element:g.jsx(tm,{to:"/lobby",replace:!0})}),g.jsx(yn,{path:"/lobby",element:g.jsx(gae,{})}),g.jsx(yn,{path:"/room/:roomId",element:g.jsx(r0e,{})}),g.jsx(yn,{path:"/poker",element:g.jsx(j0e,{})}),g.jsx(yn,{path:"/poker/mock",element:g.jsx(B0e,{})}),g.jsx(yn,{path:"/poker/room/:roomId",element:g.jsx(M0e,{})})]}),g.jsx(yn,{path:"/disclaimer",element:g.jsx(h0e,{})}),g.jsx(yn,{path:"/support",element:g.jsx(m0e,{})}),g.jsx(yn,{path:"/privacy",element:g.jsx(g0e,{})}),g.jsx(yn,{path:"/terms",element:g.jsx(y0e,{})}),g.jsx(yn,{path:"/button-sandbox",element:g.jsx(p0e,{})}),g.jsx(yn,{path:"/how-to-play",element:g.jsx(mF,{})}),g.jsx(yn,{path:"*",element:g.jsx(tm,{to:"/lobby",replace:!0})})]})}const F0e="ceelolounge",AL=cH.toLowerCase(),q0e=new Set(["","verify","auth","ceelolounge","review-login","qa-login"]);function YE(t){return!t||t.length===0||t.length>2048||!/^[A-Za-z0-9._-]+$/.test(t)?null:t}function z0e(t){try{const e=new URL(t),r=e.protocol.replace(":","").toLowerCase(),n=(e.hostname||"").toLowerCase(),a=(e.pathname||"").toLowerCase(),i=r===F0e,o=e.protocol==="https:",c=a.endsWith("/verify")||a.includes("/auth/verify"),u=a.endsWith("/review-login")||a.includes("/review-login"),d=a.endsWith("/qa-login")||a.includes("/qa-login");if(i){if(!q0e.has(n)||!c&&!u&&!d&&!(n==="verify"||n==="review-login"||n==="qa-login")&&!((n===""||n==="ceelolounge")&&(a==="/"||a==="")))return null}else if(o){if(AL&&n!==AL||!c&&!u&&!d)return null}else return null;const f=YE(e.searchParams.get("token"));if(f)return f;const h=a.split("/").filter(Boolean),m=h.lastIndexOf("verify");return m>=0&&h[m+1]?YE(h[m+1]):h.length===1&&!["verify","auth","review-login","qa-login"].includes(h[0])?YE(h[0]):null}catch{return null}}function $0e(){const t=tn(),e=v.useRef(null);return v.useEffect(()=>{let r;const n=a=>{if(!a||e.current===a)return;const i=z0e(a);if(i){e.current=a;try{const o=new URL(a),c=(o.pathname||"").toLowerCase(),u=(o.hostname||"").toLowerCase(),d=c.includes("/review-login")||u==="review-login"?"/review-login":c.includes("/qa-login")||u==="qa-login"?"/qa-login":"/verify";t(`${d}?token=${encodeURIComponent(i)}`,{replace:!0})}catch{t(`/verify?token=${encodeURIComponent(i)}`,{replace:!0})}}};return Bo.getLaunchUrl().then(a=>n(a?.url)).catch(()=>{}),(async()=>r=await Bo.addListener("appUrlOpen",({url:a})=>n(a)))(),()=>r?.remove?.()},[t]),null}function V0e(t){switch(t.errorCode||""){case"UNAUTHORIZED":return{title:"Sign In Required",subtitle:"You must be logged in to bet."};case"BET_INVALID":return{title:"Invalid Bet",subtitle:t.error||"Bet not allowed."};case"BET_REJECTED":return{title:"Bet Rejected",subtitle:t.error||"Try a smaller amount."};case"LINE_LOCKED":return{title:"Line Locked",subtitle:"Pass/Don't Pass locked after point."};case"BALANCE_ADJUST_FAIL":return{title:"Balance Error",subtitle:"Could not adjust balance."};default:return{title:"Bet Error",subtitle:t.error||"Unable to place bet."}}}function H0e(){const{info:t}=Es();return Pa({onCrapsBetError:e=>{try{const{title:r,subtitle:n}=V0e(e);t(r,n)}catch{}}}),null}function YA(t,{strict:e=!0}={}){return!t||typeof t!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")}function RL(t){return YA(t,{strict:!1})?Math.ceil((t.length-2)/2):t.length}const D6="2.37.8";let XE={getDocsUrl:({docsBaseUrl:t,docsPath:e="",docsSlug:r})=>e?`${t??"https://viem.sh"}${e}${r?`#${r}`:""}`:void 0,version:`viem@${D6}`},oo=class ZC extends Error{constructor(e,r={}){const n=r.cause instanceof ZC?r.cause.details:r.cause?.message?r.cause.message:r.details,a=r.cause instanceof ZC&&r.cause.docsPath||r.docsPath,i=XE.getDocsUrl?.({...r,docsPath:a}),o=[e||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...i?[`Docs: ${i}`]:[],...n?[`Details: ${n}`]:[],...XE.version?[`Version: ${XE.version}`]:[]].join(`
`);super(o,r.cause?{cause:r.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=n,this.docsPath=a,this.metaMessages=r.metaMessages,this.name=r.name??this.name,this.shortMessage=e,this.version=D6}walk(e){return O6(this,e)}};function O6(t,e){return e?.(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause!==void 0?O6(t.cause,e):e?null:t}class G0e extends oo{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class N6 extends oo{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${r}).`,{name:"SizeExceedsPaddingSizeError"})}}function jp(t,{dir:e,size:r=32}={}){return typeof t=="string"?W0e(t,{dir:e,size:r}):K0e(t,{dir:e,size:r})}function W0e(t,{dir:e,size:r=32}={}){if(r===null)return t;const n=t.replace("0x","");if(n.length>r*2)throw new N6({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n[e==="right"?"padEnd":"padStart"](r*2,"0")}`}function K0e(t,{dir:e,size:r=32}={}){if(r===null)return t;if(t.length>r)throw new N6({size:t.length,targetSize:r,type:"bytes"});const n=new Uint8Array(r);for(let a=0;a<r;a++){const i=e==="right";n[i?a:r-a-1]=t[i?a:t.length-a-1]}return n}class Y0e extends oo{constructor({max:e,min:r,signed:n,size:a,value:i}){super(`Number "${i}" is not in safe ${a?`${a*8}-bit ${n?"signed":"unsigned"} `:""}integer range ${e?`(${r} to ${e})`:`(above ${r})`}`,{name:"IntegerOutOfRangeError"})}}class X0e extends oo{constructor({givenSize:e,maxSize:r}){super(`Size cannot exceed ${r} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}function Kg(t,{size:e}){if(RL(t)>e)throw new X0e({givenSize:RL(t),maxSize:e})}const J0e=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function $Se(t,e={}){return typeof t=="number"||typeof t=="bigint"?gp(t,e):typeof t=="string"?M6(t,e):typeof t=="boolean"?Q0e(t,e):I6(t,e)}function Q0e(t,e={}){const r=`0x${Number(t)}`;return typeof e.size=="number"?(Kg(r,{size:e.size}),jp(r,{size:e.size})):r}function I6(t,e={}){let r="";for(let a=0;a<t.length;a++)r+=J0e[t[a]];const n=`0x${r}`;return typeof e.size=="number"?(Kg(n,{size:e.size}),jp(n,{dir:"right",size:e.size})):n}function gp(t,e={}){const{signed:r,size:n}=e,a=BigInt(t);let i;n?r?i=(1n<<BigInt(n)*8n-1n)-1n:i=2n**(BigInt(n)*8n)-1n:typeof t=="number"&&(i=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof i=="bigint"&&r?-i-1n:0;if(i&&a>i||a<o){const u=typeof t=="bigint"?"n":"";throw new Y0e({max:i?`${i}${u}`:void 0,min:`${o}${u}`,signed:r,size:n,value:`${t}${u}`})}const c=`0x${(r&&a<0?(1n<<BigInt(n*8))+BigInt(a):a).toString(16)}`;return n?jp(c,{size:n}):c}const Z0e=new TextEncoder;function M6(t,e={}){const r=Z0e.encode(t);return I6(r,e)}const eke=new TextEncoder;function tke(t,e={}){return typeof t=="number"||typeof t=="bigint"?nke(t,e):typeof t=="boolean"?rke(t,e):YA(t)?j6(t,e):L6(t,e)}function rke(t,e={}){const r=new Uint8Array(1);return r[0]=Number(t),typeof e.size=="number"?(Kg(r,{size:e.size}),jp(r,{size:e.size})):r}const Sc={zero:48,nine:57,A:65,F:70,a:97,f:102};function DL(t){if(t>=Sc.zero&&t<=Sc.nine)return t-Sc.zero;if(t>=Sc.A&&t<=Sc.F)return t-(Sc.A-10);if(t>=Sc.a&&t<=Sc.f)return t-(Sc.a-10)}function j6(t,e={}){let r=t;e.size&&(Kg(r,{size:e.size}),r=jp(r,{dir:"right",size:e.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);const a=n.length/2,i=new Uint8Array(a);for(let o=0,c=0;o<a;o++){const u=DL(n.charCodeAt(c++)),d=DL(n.charCodeAt(c++));if(u===void 0||d===void 0)throw new oo(`Invalid byte sequence ("${n[c-2]}${n[c-1]}" in "${n}").`);i[o]=u*16+d}return i}function nke(t,e){const r=gp(t,e);return j6(r)}function L6(t,e={}){const r=eke.encode(t);return typeof e.size=="number"?(Kg(r,{size:e.size}),jp(r,{dir:"right",size:e.size})):r}const Pv=BigInt(2**32-1),OL=BigInt(32);function ake(t,e=!1){return e?{h:Number(t&Pv),l:Number(t>>OL&Pv)}:{h:Number(t>>OL&Pv)|0,l:Number(t&Pv)|0}}function ike(t,e=!1){const r=t.length;let n=new Uint32Array(r),a=new Uint32Array(r);for(let i=0;i<r;i++){const{h:o,l:c}=ake(t[i],e);[n[i],a[i]]=[o,c]}return[n,a]}const ske=(t,e,r)=>t<<r|e>>>32-r,oke=(t,e,r)=>e<<r|t>>>32-r,cke=(t,e,r)=>e<<r-32|t>>>64-r,lke=(t,e,r)=>t<<r-32|e>>>64-r;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function uke(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function NL(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function Sb(t,...e){if(!uke(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function IL(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function dke(t,e){Sb(t);const r=e.outputLen;if(t.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}function fke(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function B6(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}const pke=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function hke(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function mke(t){for(let e=0;e<t.length;e++)t[e]=hke(t[e]);return t}const ML=pke?t=>t:mke;function gke(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function U6(t){return typeof t=="string"&&(t=gke(t)),Sb(t),t}class yke{}function vke(t){const e=n=>t().update(U6(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}const _ke=BigInt(0),qh=BigInt(1),bke=BigInt(2),kke=BigInt(7),wke=BigInt(256),Ske=BigInt(113),F6=[],q6=[],z6=[];for(let t=0,e=qh,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],F6.push(2*(5*n+r)),q6.push((t+1)*(t+2)/2%64);let a=_ke;for(let i=0;i<7;i++)e=(e<<qh^(e>>kke)*Ske)%wke,e&bke&&(a^=qh<<(qh<<BigInt(i))-qh);z6.push(a)}const $6=ike(z6,!0),Eke=$6[0],Tke=$6[1],jL=(t,e,r)=>r>32?cke(t,e,r):ske(t,e,r),LL=(t,e,r)=>r>32?lke(t,e,r):oke(t,e,r);function Cke(t,e=24){const r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let o=0;o<10;o++)r[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const c=(o+8)%10,u=(o+2)%10,d=r[u],f=r[u+1],h=jL(d,f,1)^r[c],m=LL(d,f,1)^r[c+1];for(let _=0;_<50;_+=10)t[o+_]^=h,t[o+_+1]^=m}let a=t[2],i=t[3];for(let o=0;o<24;o++){const c=q6[o],u=jL(a,i,c),d=LL(a,i,c),f=F6[o];a=t[f],i=t[f+1],t[f]=u,t[f+1]=d}for(let o=0;o<50;o+=10){for(let c=0;c<10;c++)r[c]=t[o+c];for(let c=0;c<10;c++)t[o+c]^=~r[(c+2)%10]&r[(c+4)%10]}t[0]^=Eke[n],t[1]^=Tke[n]}B6(r)}class XA extends yke{constructor(e,r,n,a=!1,i=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=a,this.rounds=i,NL(n),!(0<e&&e<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=fke(this.state)}clone(){return this._cloneInto()}keccak(){ML(this.state32),Cke(this.state32,this.rounds),ML(this.state32),this.posOut=0,this.pos=0}update(e){IL(this),e=U6(e),Sb(e);const{blockLen:r,state:n}=this,a=e.length;for(let i=0;i<a;){const o=Math.min(r-this.pos,a-i);for(let c=0;c<o;c++)n[this.pos++]^=e[i++];this.pos===r&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:r,pos:n,blockLen:a}=this;e[n]^=r,(r&128)!==0&&n===a-1&&this.keccak(),e[a-1]^=128,this.keccak()}writeInto(e){IL(this,!1),Sb(e),this.finish();const r=this.state,{blockLen:n}=this;for(let a=0,i=e.length;a<i;){this.posOut>=n&&this.keccak();const o=Math.min(n-this.posOut,i-a);e.set(r.subarray(this.posOut,this.posOut+o),a),this.posOut+=o,a+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return NL(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(dke(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,B6(this.state)}_cloneInto(e){const{blockLen:r,suffix:n,outputLen:a,rounds:i,enableXOF:o}=this;return e||(e=new XA(r,n,a,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=n,e.outputLen=a,e.enableXOF=o,e.destroyed=this.destroyed,e}}const xke=(t,e,r)=>vke(()=>new XA(e,t,r)),Pke=xke(1,136,256/8);function Ake(t,e){return Pke(YA(t,{strict:!1})?tke(t):t)}class JA extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const r=super.get(e);return super.has(e)&&r!==void 0&&(this.delete(e),super.set(e,r)),r}set(e,r){if(super.set(e,r),this.maxSize&&this.size>this.maxSize){const n=this.keys().next().value;n&&this.delete(n)}return this}}const Rke=/^0x[a-fA-F0-9]{40}$/,JE=new JA(8192);function Dke(t,e){const{strict:r=!0}=e??{},n=`${t}.${r}`;if(JE.has(n))return JE.get(n);const a=Rke.test(t)?t.toLowerCase()===t?!0:r?V6(t)===t:!0:!1;return JE.set(n,a),a}const QE=new JA(8192);function V6(t,e){if(QE.has(`${t}.${e}`))return QE.get(`${t}.${e}`);const r=t.substring(2).toLowerCase(),n=Ake(L6(r)),a=r.split("");for(let o=0;o<40;o+=2)n[o>>1]>>4>=8&&a[o]&&(a[o]=a[o].toUpperCase()),(n[o>>1]&15)>=8&&a[o+1]&&(a[o+1]=a[o+1].toUpperCase());const i=`0x${a.join("")}`;return QE.set(`${t}.${e}`,i),i}function Ju(t,e){if(!Dke(t,{strict:!1}))throw new G0e({address:t});return V6(t,e)}function Oke(t){return typeof t=="string"?{address:t,type:"json-rpc"}:t}const id=(t,e,r)=>JSON.stringify(t,(n,a)=>typeof a=="bigint"?a.toString():a,r),QA=t=>t;class Tm extends oo{constructor({body:e,cause:r,details:n,headers:a,status:i,url:o}){super("HTTP request failed.",{cause:r,details:n,metaMessages:[i&&`Status: ${i}`,`URL: ${QA(o)}`,e&&`Request body: ${id(e)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=e,this.headers=a,this.status=i,this.url=o}}class H6 extends oo{constructor({body:e,error:r,url:n}){super("RPC Request failed.",{cause:r,details:r.message,metaMessages:[`URL: ${QA(n)}`,`Request body: ${id(e)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=r.code,this.data=r.data}}class BL extends oo{constructor({body:e,url:r}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${QA(r)}`,`Request body: ${id(e)}`],name:"TimeoutError"})}}const Nke=-1;class vi extends oo{constructor(e,{code:r,docsPath:n,metaMessages:a,name:i,shortMessage:o}){super(o,{cause:e,docsPath:n,metaMessages:a||e?.metaMessages,name:i||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=i||e.name,this.code=e instanceof H6?e.code:r??Nke}}class qi extends vi{constructor(e,r){super(e,r),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=r.data}}class tg extends vi{constructor(e){super(e,{code:tg.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(tg,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class rg extends vi{constructor(e){super(e,{code:rg.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(rg,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class ng extends vi{constructor(e,{method:r}={}){super(e,{code:ng.code,name:"MethodNotFoundRpcError",shortMessage:`The method${r?` "${r}"`:""} does not exist / is not available.`})}}Object.defineProperty(ng,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class ag extends vi{constructor(e){super(e,{code:ag.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
`)})}}Object.defineProperty(ag,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class yp extends vi{constructor(e){super(e,{code:yp.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(yp,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class ig extends vi{constructor(e){super(e,{code:ig.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
`)})}}Object.defineProperty(ig,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class sg extends vi{constructor(e){super(e,{code:sg.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(sg,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Wl extends vi{constructor(e){super(e,{code:Wl.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(Wl,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class og extends vi{constructor(e){super(e,{code:og.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(og,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Qu extends vi{constructor(e,{method:r}={}){super(e,{code:Qu.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${r?` "${r}"`:""} is not supported.`})}}Object.defineProperty(Qu,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class vp extends vi{constructor(e){super(e,{code:vp.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(vp,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class cg extends vi{constructor(e){super(e,{code:cg.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(cg,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class na extends qi{constructor(e){super(e,{code:na.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(na,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class lg extends qi{constructor(e){super(e,{code:lg.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(lg,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class ug extends qi{constructor(e,{method:r}={}){super(e,{code:ug.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${r?` " ${r}"`:""}.`})}}Object.defineProperty(ug,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class dg extends qi{constructor(e){super(e,{code:dg.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(dg,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class fg extends qi{constructor(e){super(e,{code:fg.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(fg,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class ou extends qi{constructor(e){super(e,{code:ou.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(ou,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class pg extends qi{constructor(e){super(e,{code:pg.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(pg,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class hg extends qi{constructor(e){super(e,{code:hg.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(hg,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class mg extends qi{constructor(e){super(e,{code:mg.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(mg,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class gg extends qi{constructor(e){super(e,{code:gg.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(gg,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class yg extends qi{constructor(e){super(e,{code:yg.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(yg,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class vg extends qi{constructor(e){super(e,{code:vg.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(vg,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class _g extends qi{constructor(e){super(e,{code:_g.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(_g,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class Ike extends vi{constructor(e){super(e,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}function Mke(){let t=()=>{},e=()=>{};return{promise:new Promise((n,a)=>{t=n,e=a}),resolve:t,reject:e}}const ZE=new Map;function jke({fn:t,id:e,shouldSplitBatch:r,wait:n=0,sort:a}){const i=async()=>{const f=u();o();const h=f.map(({args:m})=>m);h.length!==0&&t(h).then(m=>{a&&Array.isArray(m)&&m.sort(a);for(let _=0;_<f.length;_++){const{resolve:w}=f[_];w?.([m[_],m])}}).catch(m=>{for(let _=0;_<f.length;_++){const{reject:w}=f[_];w?.(m)}})},o=()=>ZE.delete(e),c=()=>u().map(({args:f})=>f),u=()=>ZE.get(e)||[],d=f=>ZE.set(e,[...u(),f]);return{flush:o,async schedule(f){const{promise:h,resolve:m,reject:_}=Mke();return r?.([...c(),f])&&i(),u().length>0?(d({args:f,resolve:m,reject:_}),h):(d({args:f,resolve:m,reject:_}),setTimeout(i,n),h)}}}const Av=new JA(8192);function Lke(t,{enabled:e=!0,id:r}){if(!e||!r)return t();if(Av.get(r))return Av.get(r);const n=t().finally(()=>Av.delete(r));return Av.set(r,n),n}async function Bke(t){return new Promise(e=>setTimeout(e,t))}function G6(t,{delay:e=100,retryCount:r=2,shouldRetry:n=()=>!0}={}){return new Promise((a,i)=>{const o=async({count:c=0}={})=>{const u=async({error:d})=>{const f=typeof e=="function"?e({count:c,error:d}):e;f&&await Bke(f),o({count:c+1})};try{const d=await t();a(d)}catch(d){if(c<r&&await n({count:c,error:d}))return u({error:d});i(d)}};o()})}function Uke(t,e={}){return async(r,n={})=>{const{dedupe:a=!1,methods:i,retryDelay:o=150,retryCount:c=3,uid:u}={...e,...n},{method:d}=r;if(i?.exclude?.includes(d))throw new Qu(new Error("method not supported"),{method:d});if(i?.include&&!i.include.includes(d))throw new Qu(new Error("method not supported"),{method:d});const f=a?M6(`${u}.${id(r)}`):void 0;return Lke(()=>G6(async()=>{try{return await t(r)}catch(h){const m=h;switch(m.code){case tg.code:throw new tg(m);case rg.code:throw new rg(m);case ng.code:throw new ng(m,{method:r.method});case ag.code:throw new ag(m);case yp.code:throw new yp(m);case ig.code:throw new ig(m);case sg.code:throw new sg(m);case Wl.code:throw new Wl(m);case og.code:throw new og(m);case Qu.code:throw new Qu(m,{method:r.method});case vp.code:throw new vp(m);case cg.code:throw new cg(m);case na.code:throw new na(m);case lg.code:throw new lg(m);case ug.code:throw new ug(m);case dg.code:throw new dg(m);case fg.code:throw new fg(m);case ou.code:throw new ou(m);case pg.code:throw new pg(m);case hg.code:throw new hg(m);case mg.code:throw new mg(m);case gg.code:throw new gg(m);case yg.code:throw new yg(m);case vg.code:throw new vg(m);case _g.code:throw new _g(m);case 5e3:throw new na(m);default:throw h instanceof oo?h:new Ike(m)}}},{delay:({count:h,error:m})=>{if(m&&m instanceof Tm){const _=m?.headers?.get("Retry-After");if(_?.match(/\d/))return Number.parseInt(_,10)*1e3}return~~(1<<h)*o},retryCount:c,shouldRetry:({error:h})=>Fke(h)}),{enabled:a,id:f})}}function Fke(t){return"code"in t&&typeof t.code=="number"?t.code===-1||t.code===vp.code||t.code===yp.code:t instanceof Tm&&t.status?t.status===403||t.status===408||t.status===413||t.status===429||t.status===500||t.status===502||t.status===503||t.status===504:!0}function W6(t){return{formatters:void 0,fees:void 0,serializers:void 0,...t}}function K6(t,{errorInstance:e=new Error("timed out"),timeout:r,signal:n}){return new Promise((a,i)=>{(async()=>{let o;try{const c=new AbortController;r>0&&(o=setTimeout(()=>{n?c.abort():i(e)},r)),a(await t({signal:c?.signal||null}))}catch(c){c?.name==="AbortError"&&i(e),i(c)}finally{clearTimeout(o)}})()})}function qke(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const UL=qke();function zke(t,e={}){return{async request(r){const{body:n,fetchFn:a=e.fetchFn??fetch,onRequest:i=e.onRequest,onResponse:o=e.onResponse,timeout:c=e.timeout??1e4}=r,u={...e.fetchOptions??{},...r.fetchOptions??{}},{headers:d,method:f,signal:h}=u;try{const m=await K6(async({signal:w})=>{const b={...u,body:Array.isArray(n)?id(n.map(P=>({jsonrpc:"2.0",id:P.id??UL.take(),...P}))):id({jsonrpc:"2.0",id:n.id??UL.take(),...n}),headers:{"Content-Type":"application/json",...d},method:f||"POST",signal:h||(c>0?w:null)},E=new Request(t,b),T=await i?.(E,b)??{...b,url:t};return await a(T.url??t,T)},{errorInstance:new BL({body:n,url:t}),timeout:c,signal:!0});o&&await o(m);let _;if(m.headers.get("Content-Type")?.startsWith("application/json"))_=await m.json();else{_=await m.text();try{_=JSON.parse(_||"{}")}catch(w){if(m.ok)throw w;_={error:_}}}if(!m.ok)throw new Tm({body:n,details:id(_.error)||m.statusText,headers:m.headers,status:m.status,url:t});return _}catch(m){throw m instanceof Tm||m instanceof BL?m:new Tm({body:n,cause:m,url:t})}}}}const T_="2.21.2",$ke=()=>`@wagmi/core@${T_}`;var Y6=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Eb,X6;class bg extends Error{get docsBaseUrl(){return"https://wagmi.sh/core"}get version(){return $ke()}constructor(e,r={}){super(),Eb.add(this),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiCoreError"});const n=r.cause instanceof bg?r.cause.details:r.cause?.message?r.cause.message:r.details,a=r.cause instanceof bg&&r.cause.docsPath||r.docsPath;this.message=[e||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...a?[`Docs: ${this.docsBaseUrl}${a}.html${r.docsSlug?`#${r.docsSlug}`:""}`]:[],...n?[`Details: ${n}`]:[],`Version: ${this.version}`].join(`
`),r.cause&&(this.cause=r.cause),this.details=n,this.docsPath=a,this.metaMessages=r.metaMessages,this.shortMessage=e}walk(e){return Y6(this,Eb,"m",X6).call(this,this,e)}}Eb=new WeakSet,X6=function t(e,r){return r?.(e)?e:e.cause?Y6(this,Eb,"m",t).call(this,e.cause,r):e};class Tb extends bg{constructor(){super("Chain not configured."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainNotConfiguredError"})}}const ex=256;let Rv=ex,Dv;function J6(t=11){if(!Dv||Rv+t>ex*2){Dv="",Rv=0;for(let e=0;e<ex;e++)Dv+=(256+Math.random()*256|0).toString(16).substring(1)}return Dv.substring(Rv,Rv+++t)}function Vke(t){const{batch:e,chain:r,ccipRead:n,key:a="base",name:i="Base Client",type:o="base"}=t,c=t.experimental_blockTag??(typeof r?.experimental_preconfirmationTime=="number"?"pending":void 0),u=r?.blockTime??12e3,d=Math.min(Math.max(Math.floor(u/2),500),4e3),f=t.pollingInterval??d,h=t.cacheTime??f,m=t.account?Oke(t.account):void 0,{config:_,request:w,value:b}=t.transport({chain:r,pollingInterval:f}),E={..._,...b},T={account:m,batch:e,cacheTime:h,ccipRead:n,chain:r,key:a,name:i,pollingInterval:f,request:w,transport:E,type:o,uid:J6(),...c?{experimental_blockTag:c}:{}};function D(P){return A=>{const C=A(P);for(const I in T)delete C[I];const O={...P,...C};return Object.assign(O,{extend:D(O)})}}return Object.assign(T,{extend:D(T)})}function Hke({key:t,methods:e,name:r,request:n,retryCount:a=3,retryDelay:i=150,timeout:o,type:c},u){const d=J6();return{config:{key:t,methods:e,name:r,request:n,retryCount:a,retryDelay:i,timeout:o,type:c},request:Uke(n,{methods:e,retryCount:a,retryDelay:i,uid:d}),value:u}}class Gke extends oo{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}function FL(t,e={}){const{batch:r,fetchFn:n,fetchOptions:a,key:i="http",methods:o,name:c="HTTP JSON-RPC",onFetchRequest:u,onFetchResponse:d,retryDelay:f,raw:h}=e;return({chain:m,retryCount:_,timeout:w})=>{const{batchSize:b=1e3,wait:E=0}=typeof r=="object"?r:{},T=e.retryCount??_,D=w??e.timeout??1e4,P=t||m?.rpcUrls.default.http[0];if(!P)throw new Gke;const A=zke(P,{fetchFn:n,fetchOptions:a,onRequest:u,onResponse:d,timeout:D});return Hke({key:i,methods:o,name:c,async request({method:C,params:O}){const I={method:C,params:O},{schedule:x}=jke({id:P,wait:E,shouldSplitBatch(j){return j.length>b},fn:j=>A.request({body:j}),sort:(j,q)=>j.id-q.id}),R=async j=>r?x(j):[await A.request({body:j})],[{error:N,result:L}]=await R(I);if(h)return{error:N,result:L};if(N)throw new H6({body:I,error:N,url:P});return L},retryCount:T,retryDelay:f,timeout:D,type:"http"},{fetchOptions:a,url:P})}}let eT=!1;async function Wke(t,e={}){if(eT)return[];eT=!0,t.setState(d=>({...d,status:d.current?"reconnecting":"connecting"}));const r=[];if(e.connectors?.length)for(const d of e.connectors){let f;typeof d=="function"?f=t._internal.connectors.setup(d):f=d,r.push(f)}else r.push(...t.connectors);let n;try{n=await t.storage?.getItem("recentConnectorId")}catch{}const a={};for(const[,d]of t.state.connections)a[d.connector.id]=1;n&&(a[n]=0);const i=Object.keys(a).length>0?[...r].sort((d,f)=>(a[d.id]??10)-(a[f.id]??10)):r;let o=!1;const c=[],u=[];for(const d of i){const f=await d.getProvider().catch(()=>{});if(!f||u.some(_=>_===f)||!await d.isAuthorized())continue;const m=await d.connect({isReconnecting:!0}).catch(()=>null);m&&(d.emitter.off("connect",t._internal.events.connect),d.emitter.on("change",t._internal.events.change),d.emitter.on("disconnect",t._internal.events.disconnect),t.setState(_=>{const w=new Map(o?_.connections:new Map).set(d.uid,{accounts:m.accounts,chainId:m.chainId,connector:d});return{..._,current:o?_.current:d.uid,connections:w}}),c.push({accounts:m.accounts,chainId:m.chainId,connector:d}),u.push(f),o=!0)}return(t.state.status==="reconnecting"||t.state.status==="connecting")&&(o?t.setState(d=>({...d,status:"connected"})):t.setState(d=>({...d,connections:new Map,current:null,status:"disconnected"}))),eT=!1,c}class Dl extends bg{constructor(){super("Provider not found."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderNotFoundError"})}}E0.type="injected";function E0(t={}){const{shimDisconnect:e=!0,unstable_shimAsyncInject:r}=t;function n(){const u=t.target;if(typeof u=="function"){const d=u();if(d)return d}return typeof u=="object"?u:typeof u=="string"?{...Kke[u]??{id:u,name:`${u[0].toUpperCase()}${u.slice(1)}`,provider:`is${u[0].toUpperCase()}${u.slice(1)}`}}:{id:"injected",name:"Injected",provider(d){return d?.ethereum}}}let a,i,o,c;return u=>({get icon(){return n().icon},get id(){return n().id},get name(){return n().name},get supportsSimulation(){return!0},type:E0.type,async setup(){const d=await this.getProvider();d?.on&&t.target&&(o||(o=this.onConnect.bind(this),d.on("connect",o)),a||(a=this.onAccountsChanged.bind(this),d.on("accountsChanged",a)))},async connect({chainId:d,isReconnecting:f,withCapabilities:h}={}){const m=await this.getProvider();if(!m)throw new Dl;let _=[];if(f)_=await this.getAccounts().catch(()=>[]);else if(e)try{_=(await m.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]}))[0]?.caveats?.[0]?.value?.map(b=>Ju(b)),_.length>0&&(_=await this.getAccounts())}catch(w){const b=w;if(b.code===na.code)throw new na(b);if(b.code===Wl.code)throw b}try{!_?.length&&!f&&(_=(await m.request({method:"eth_requestAccounts"})).map(E=>Ju(E))),o&&(m.removeListener("connect",o),o=void 0),a||(a=this.onAccountsChanged.bind(this),m.on("accountsChanged",a)),i||(i=this.onChainChanged.bind(this),m.on("chainChanged",i)),c||(c=this.onDisconnect.bind(this),m.on("disconnect",c));let w=await this.getChainId();return d&&w!==d&&(w=(await this.switchChain({chainId:d}).catch(E=>{if(E.code===na.code)throw E;return{id:w}}))?.id??w),e&&await u.storage?.removeItem(`${this.id}.disconnected`),t.target||await u.storage?.setItem("injected.connected",!0),{accounts:h?_.map(b=>({address:b,capabilities:{}})):_,chainId:w}}catch(w){const b=w;throw b.code===na.code?new na(b):b.code===Wl.code?new Wl(b):b}},async disconnect(){const d=await this.getProvider();if(!d)throw new Dl;i&&(d.removeListener("chainChanged",i),i=void 0),c&&(d.removeListener("disconnect",c),c=void 0),o||(o=this.onConnect.bind(this),d.on("connect",o));try{await K6(()=>d.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch{}e&&await u.storage?.setItem(`${this.id}.disconnected`,!0),t.target||await u.storage?.removeItem("injected.connected")},async getAccounts(){const d=await this.getProvider();if(!d)throw new Dl;return(await d.request({method:"eth_accounts"})).map(h=>Ju(h))},async getChainId(){const d=await this.getProvider();if(!d)throw new Dl;const f=await d.request({method:"eth_chainId"});return Number(f)},async getProvider(){if(typeof window>"u")return;let d;const f=n();return typeof f.provider=="function"?d=f.provider(window):typeof f.provider=="string"?d=C_(window,f.provider):d=f.provider,d&&!d.removeListener&&("off"in d&&typeof d.off=="function"?d.removeListener=d.off:d.removeListener=()=>{}),d},async isAuthorized(){try{if(e&&await u.storage?.getItem(`${this.id}.disconnected`)||!t.target&&!await u.storage?.getItem("injected.connected"))return!1;if(!await this.getProvider()){if(r!==void 0&&r!==!1){const m=async()=>(typeof window<"u"&&window.removeEventListener("ethereum#initialized",m),!!await this.getProvider()),_=typeof r=="number"?r:1e3;if(await Promise.race([...typeof window<"u"?[new Promise(b=>window.addEventListener("ethereum#initialized",()=>b(m()),{once:!0}))]:[],new Promise(b=>setTimeout(()=>b(m()),_))]))return!0}throw new Dl}return!!(await G6(()=>this.getAccounts())).length}catch{return!1}},async switchChain({addEthereumChainParameter:d,chainId:f}){const h=await this.getProvider();if(!h)throw new Dl;const m=u.chains.find(w=>w.id===f);if(!m)throw new ou(new Tb);const _=new Promise(w=>{const b=(E=>{"chainId"in E&&E.chainId===f&&(u.emitter.off("change",b),w())});u.emitter.on("change",b)});try{return await Promise.all([h.request({method:"wallet_switchEthereumChain",params:[{chainId:gp(f)}]}).then(async()=>{await this.getChainId()===f&&u.emitter.emit("change",{chainId:f})}),_]),m}catch(w){const b=w;if(b.code===4902||b?.data?.originalError?.code===4902)try{const{default:E,...T}=m.blockExplorers??{};let D;d?.blockExplorerUrls?D=d.blockExplorerUrls:E&&(D=[E.url,...Object.values(T).map(C=>C.url)]);let P;d?.rpcUrls?.length?P=d.rpcUrls:P=[m.rpcUrls.default?.http[0]??""];const A={blockExplorerUrls:D,chainId:gp(f),chainName:d?.chainName??m.name,iconUrls:d?.iconUrls,nativeCurrency:d?.nativeCurrency??m.nativeCurrency,rpcUrls:P};return await Promise.all([h.request({method:"wallet_addEthereumChain",params:[A]}).then(async()=>{if(await this.getChainId()===f)u.emitter.emit("change",{chainId:f});else throw new na(new Error("User rejected switch after adding network."))}),_]),m}catch(E){throw new na(E)}throw b.code===na.code?new na(b):new ou(b)}},async onAccountsChanged(d){if(d.length===0)this.onDisconnect();else if(u.emitter.listenerCount("connect")){const f=(await this.getChainId()).toString();this.onConnect({chainId:f}),e&&await u.storage?.removeItem(`${this.id}.disconnected`)}else u.emitter.emit("change",{accounts:d.map(f=>Ju(f))})},onChainChanged(d){const f=Number(d);u.emitter.emit("change",{chainId:f})},async onConnect(d){const f=await this.getAccounts();if(f.length===0)return;const h=Number(d.chainId);u.emitter.emit("connect",{accounts:f,chainId:h});const m=await this.getProvider();m&&(o&&(m.removeListener("connect",o),o=void 0),a||(a=this.onAccountsChanged.bind(this),m.on("accountsChanged",a)),i||(i=this.onChainChanged.bind(this),m.on("chainChanged",i)),c||(c=this.onDisconnect.bind(this),m.on("disconnect",c)))},async onDisconnect(d){const f=await this.getProvider();d&&d.code===1013&&f&&(await this.getAccounts()).length||(u.emitter.emit("disconnect"),f&&(i&&(f.removeListener("chainChanged",i),i=void 0),c&&(f.removeListener("disconnect",c),c=void 0),o||(o=this.onConnect.bind(this),f.on("connect",o))))}})}const Kke={coinbaseWallet:{id:"coinbaseWallet",name:"Coinbase Wallet",provider(t){return t?.coinbaseWalletExtension?t.coinbaseWalletExtension:C_(t,"isCoinbaseWallet")}},metaMask:{id:"metaMask",name:"MetaMask",provider(t){return C_(t,e=>{if(!e.isMetaMask||e.isBraveWallet&&!e._events&&!e._state)return!1;const r=["isApexWallet","isAvalanche","isBitKeep","isBlockWallet","isKuCoinWallet","isMathWallet","isOkxWallet","isOKExWallet","isOneInchIOSWallet","isOneInchAndroidWallet","isOpera","isPhantom","isPortal","isRabby","isTokenPocket","isTokenary","isUniswapWallet","isZerion"];for(const n of r)if(e[n])return!1;return!0})}},phantom:{id:"phantom",name:"Phantom",provider(t){return t?.phantom?.ethereum?t.phantom?.ethereum:C_(t,"isPhantom")}}};function C_(t,e){function r(a){return typeof e=="function"?e(a):typeof e=="string"?a[e]:!0}const n=t.ethereum;if(n?.providers)return n.providers.find(a=>r(a));if(n&&r(n))return n}function Yke(t){if(typeof window>"u")return;const e=r=>t(r.detail);return window.addEventListener("eip6963:announceProvider",e),window.dispatchEvent(new CustomEvent("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",e)}function Xke(){const t=new Set;let e=[];const r=()=>Yke(a=>{e.some(({info:i})=>i.uuid===a.info.uuid)||(e=[...e,a],t.forEach(i=>i(e,{added:[a]})))});let n=r();return{_listeners(){return t},clear(){t.forEach(a=>a([],{removed:[...e]})),e=[]},destroy(){this.clear(),t.clear(),n?.()},findProvider({rdns:a}){return e.find(i=>i.info.rdns===a)},getProviders(){return e},reset(){this.clear(),n?.(),n=r()},subscribe(a,{emitImmediately:i}={}){return t.add(a),i&&a(e,{added:e}),()=>t.delete(a)}}}const Jke=t=>(e,r,n)=>{const a=n.subscribe;return n.subscribe=(o,c,u)=>{let d=o;if(c){const f=u?.equalityFn||Object.is;let h=o(n.getState());d=m=>{const _=o(m);if(!f(h,_)){const w=h;c(h=_,w)}},u?.fireImmediately&&c(h,h)}return a(d)},t(e,r,n)},Qke=Jke;function Zke(t,e){let r;try{r=t()}catch{return}return{getItem:a=>{var i;const o=u=>u===null?null:JSON.parse(u,void 0),c=(i=r.getItem(a))!=null?i:null;return c instanceof Promise?c.then(o):o(c)},setItem:(a,i)=>r.setItem(a,JSON.stringify(i,void 0)),removeItem:a=>r.removeItem(a)}}const tx=t=>e=>{try{const r=t(e);return r instanceof Promise?r:{then(n){return tx(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return tx(n)(r)}}}},ewe=(t,e)=>(r,n,a)=>{let i={storage:Zke(()=>localStorage),partialize:b=>b,version:0,merge:(b,E)=>({...E,...b}),...e},o=!1;const c=new Set,u=new Set;let d=i.storage;if(!d)return t((...b)=>{r(...b)},n,a);const f=()=>{const b=i.partialize({...n()});return d.setItem(i.name,{state:b,version:i.version})},h=a.setState;a.setState=(b,E)=>{h(b,E),f()};const m=t((...b)=>{r(...b),f()},n,a);a.getInitialState=()=>m;let _;const w=()=>{var b,E;if(!d)return;o=!1,c.forEach(D=>{var P;return D((P=n())!=null?P:m)});const T=((E=i.onRehydrateStorage)==null?void 0:E.call(i,(b=n())!=null?b:m))||void 0;return tx(d.getItem.bind(d))(i.name).then(D=>{if(D)if(typeof D.version=="number"&&D.version!==i.version){if(i.migrate)return[!0,i.migrate(D.state,D.version)]}else return[!1,D.state];return[!1,void 0]}).then(D=>{var P;const[A,C]=D;if(_=i.merge(C,(P=n())!=null?P:m),r(_,!0),A)return f()}).then(()=>{T?.(_,void 0),_=n(),o=!0,u.forEach(D=>D(_))}).catch(D=>{T?.(void 0,D)})};return a.persist={setOptions:b=>{i={...i,...b},b.storage&&(d=b.storage)},clearStorage:()=>{d?.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>w(),hasHydrated:()=>o,onHydrate:b=>(c.add(b),()=>{c.delete(b)}),onFinishHydration:b=>(u.add(b),()=>{u.delete(b)})},i.skipHydration||w(),_||m},twe=ewe,qL=t=>{let e;const r=new Set,n=(d,f)=>{const h=typeof d=="function"?d(e):d;if(!Object.is(h,e)){const m=e;e=f??(typeof h!="object"||h===null)?h:Object.assign({},e,h),r.forEach(_=>_(e,m))}},a=()=>e,c={setState:n,getState:a,getInitialState:()=>u,subscribe:d=>(r.add(d),()=>r.delete(d))},u=e=t(n,a,c);return c},tT=t=>t?qL(t):qL;var rT={exports:{}},zL;function rwe(){return zL||(zL=1,(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function a(u,d,f){this.fn=u,this.context=d,this.once=f||!1}function i(u,d,f,h,m){if(typeof f!="function")throw new TypeError("The listener must be a function");var _=new a(f,h||u,m),w=r?r+d:d;return u._events[w]?u._events[w].fn?u._events[w]=[u._events[w],_]:u._events[w].push(_):(u._events[w]=_,u._eventsCount++),u}function o(u,d){--u._eventsCount===0?u._events=new n:delete u._events[d]}function c(){this._events=new n,this._eventsCount=0}c.prototype.eventNames=function(){var d=[],f,h;if(this._eventsCount===0)return d;for(h in f=this._events)e.call(f,h)&&d.push(r?h.slice(1):h);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(f)):d},c.prototype.listeners=function(d){var f=r?r+d:d,h=this._events[f];if(!h)return[];if(h.fn)return[h.fn];for(var m=0,_=h.length,w=new Array(_);m<_;m++)w[m]=h[m].fn;return w},c.prototype.listenerCount=function(d){var f=r?r+d:d,h=this._events[f];return h?h.fn?1:h.length:0},c.prototype.emit=function(d,f,h,m,_,w){var b=r?r+d:d;if(!this._events[b])return!1;var E=this._events[b],T=arguments.length,D,P;if(E.fn){switch(E.once&&this.removeListener(d,E.fn,void 0,!0),T){case 1:return E.fn.call(E.context),!0;case 2:return E.fn.call(E.context,f),!0;case 3:return E.fn.call(E.context,f,h),!0;case 4:return E.fn.call(E.context,f,h,m),!0;case 5:return E.fn.call(E.context,f,h,m,_),!0;case 6:return E.fn.call(E.context,f,h,m,_,w),!0}for(P=1,D=new Array(T-1);P<T;P++)D[P-1]=arguments[P];E.fn.apply(E.context,D)}else{var A=E.length,C;for(P=0;P<A;P++)switch(E[P].once&&this.removeListener(d,E[P].fn,void 0,!0),T){case 1:E[P].fn.call(E[P].context);break;case 2:E[P].fn.call(E[P].context,f);break;case 3:E[P].fn.call(E[P].context,f,h);break;case 4:E[P].fn.call(E[P].context,f,h,m);break;default:if(!D)for(C=1,D=new Array(T-1);C<T;C++)D[C-1]=arguments[C];E[P].fn.apply(E[P].context,D)}}return!0},c.prototype.on=function(d,f,h){return i(this,d,f,h,!1)},c.prototype.once=function(d,f,h){return i(this,d,f,h,!0)},c.prototype.removeListener=function(d,f,h,m){var _=r?r+d:d;if(!this._events[_])return this;if(!f)return o(this,_),this;var w=this._events[_];if(w.fn)w.fn===f&&(!m||w.once)&&(!h||w.context===h)&&o(this,_);else{for(var b=0,E=[],T=w.length;b<T;b++)(w[b].fn!==f||m&&!w[b].once||h&&w[b].context!==h)&&E.push(w[b]);E.length?this._events[_]=E.length===1?E[0]:E:o(this,_)}return this},c.prototype.removeAllListeners=function(d){var f;return d?(f=r?r+d:d,this._events[f]&&o(this,f)):(this._events=new n,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,t.exports=c})(rT)),rT.exports}var nwe=rwe();const awe=Sg(nwe);class iwe{constructor(e){Object.defineProperty(this,"uid",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_emitter",{enumerable:!0,configurable:!0,writable:!0,value:new awe})}on(e,r){this._emitter.on(e,r)}once(e,r){this._emitter.once(e,r)}off(e,r){this._emitter.off(e,r)}emit(e,...r){const n=r[0];this._emitter.emit(e,{uid:this.uid,...n})}listenerCount(e){return this._emitter.listenerCount(e)}}function swe(t){return new iwe(t)}function owe(t,e){return JSON.parse(t,(r,n)=>{let a=n;return a?.__type==="bigint"&&(a=BigInt(a.value)),a?.__type==="Map"&&(a=new Map(a.value)),e?.(r,a)??a})}function $L(t,e){return t.slice(0,e).join(".")||"."}function VL(t,e){const{length:r}=t;for(let n=0;n<r;++n)if(t[n]===e)return n+1;return 0}function cwe(t,e){const r=typeof t=="function",n=typeof e=="function",a=[],i=[];return function(c,u){if(typeof u=="object")if(a.length){const d=VL(a,this);d===0?a[a.length]=this:(a.splice(d),i.splice(d)),i[i.length]=c;const f=VL(a,u);if(f!==0)return n?e.call(this,c,u,$L(i,f)):`[ref=${$L(i,f)}]`}else a[0]=u,i[0]=c;return r?t.call(this,c,u):u}}function lwe(t,e,r,n){return JSON.stringify(t,cwe((a,i)=>{let o=i;return typeof o=="bigint"&&(o={__type:"bigint",value:i.toString()}),o instanceof Map&&(o={__type:"Map",value:Array.from(i.entries())}),e?.(a,o)??o},n),r??void 0)}function Q6(t){const{deserialize:e=owe,key:r="wagmi",serialize:n=lwe,storage:a=Z6}=t;function i(o){return o instanceof Promise?o.then(c=>c).catch(()=>null):o}return{...a,key:r,async getItem(o,c){const u=a.getItem(`${r}.${o}`),d=await i(u);return d?e(d)??null:c??null},async setItem(o,c){const u=`${r}.${o}`;c===null?await i(a.removeItem(u)):await i(a.setItem(u,n(c)))},async removeItem(o){await i(a.removeItem(`${r}.${o}`))}}}const Z6={getItem:()=>null,setItem:()=>{},removeItem:()=>{}};function uwe(){const t=typeof window<"u"&&window.localStorage?window.localStorage:Z6;return{getItem(e){return t.getItem(e)},removeItem(e){t.removeItem(e)},setItem(e,r){try{t.setItem(e,r)}catch{}}}}const rx=256;let Ov=rx,Nv;function dwe(t=11){if(!Nv||Ov+t>rx*2){Nv="",Ov=0;for(let e=0;e<rx;e++)Nv+=(256+Math.random()*256|0).toString(16).substring(1)}return Nv.substring(Ov,Ov+++t)}function fwe(t){const{multiInjectedProviderDiscovery:e=!0,storage:r=Q6({storage:uwe()}),syncConnectedChain:n=!0,ssr:a=!1,...i}=t,o=typeof window<"u"&&e?Xke():void 0,c=tT(()=>i.chains),u=tT(()=>{const C=[],O=new Set;for(const I of i.connectors??[]){const x=d(I);if(C.push(x),!a&&x.rdns){const R=typeof x.rdns=="string"?[x.rdns]:x.rdns;for(const N of R)O.add(N)}}if(!a&&o){const I=o.getProviders();for(const x of I)O.has(x.info.rdns)||C.push(d(f(x)))}return C});function d(C){const O=swe(dwe()),I={...C({emitter:O,chains:c.getState(),storage:r,transports:i.transports}),emitter:O,uid:O.uid};return O.on("connect",P),I.setup?.(),I}function f(C){const{info:O}=C,I=C.provider;return E0({target:{...O,id:O.rdns,provider:I}})}const h=new Map;function m(C={}){const O=C.chainId??E.getState().chainId,I=c.getState().find(R=>R.id===O);if(C.chainId&&!I)throw new Tb;{const R=h.get(E.getState().chainId);if(R&&!I)return R;if(!I)throw new Tb}{const R=h.get(O);if(R)return R}let x;if(i.client)x=i.client({chain:I});else{const R=I.id,N=c.getState().map(q=>q.id),L={},j=Object.entries(i);for(const[q,U]of j)if(!(q==="chains"||q==="client"||q==="connectors"||q==="transports"))if(typeof U=="object")if(R in U)L[q]=U[R];else{if(N.some(F=>F in U))continue;L[q]=U}else L[q]=U;x=Vke({...L,chain:I,batch:L.batch??{multicall:!0},transport:q=>i.transports[R]({...q,connectors:u})})}return h.set(O,x),x}function _(){return{chainId:c.getState()[0].id,connections:new Map,current:null,status:"disconnected"}}let w;const b="0.0.0-canary-";T_.startsWith(b)?w=Number.parseInt(T_.replace(b,""),10):w=Number.parseInt(T_.split(".")[0]??"0",10);const E=tT(Qke(r?twe(_,{migrate(C,O){if(O===w)return C;const I=_(),x=T(C,I.chainId);return{...I,chainId:x}},name:"store",partialize(C){return{connections:{__type:"Map",value:Array.from(C.connections.entries()).map(([O,I])=>{const{id:x,name:R,type:N,uid:L}=I.connector;return[O,{...I,connector:{id:x,name:R,type:N,uid:L}}]})},chainId:C.chainId,current:C.current}},merge(C,O){typeof C=="object"&&C&&"status"in C&&delete C.status;const I=T(C,O.chainId);return{...O,...C,chainId:I}},skipHydration:a,storage:r,version:w}):_));E.setState(_());function T(C,O){return C&&typeof C=="object"&&"chainId"in C&&typeof C.chainId=="number"&&c.getState().some(I=>I.id===C.chainId)?C.chainId:O}n&&E.subscribe(({connections:C,current:O})=>O?C.get(O)?.chainId:void 0,C=>{if(c.getState().some(I=>I.id===C))return E.setState(I=>({...I,chainId:C??I.chainId}))}),o?.subscribe(C=>{const O=new Set,I=new Set;for(const R of u.getState())if(O.add(R.id),R.rdns){const N=typeof R.rdns=="string"?[R.rdns]:R.rdns;for(const L of N)I.add(L)}const x=[];for(const R of C){if(I.has(R.info.rdns))continue;const N=d(f(R));O.has(N.id)||x.push(N)}r&&!E.persist.hasHydrated()||u.setState(R=>[...R,...x],!0)});function D(C){E.setState(O=>{const I=O.connections.get(C.uid);return I?{...O,connections:new Map(O.connections).set(C.uid,{accounts:C.accounts??I.accounts,chainId:C.chainId??I.chainId,connector:I.connector})}:O})}function P(C){E.getState().status==="connecting"||E.getState().status==="reconnecting"||E.setState(O=>{const I=u.getState().find(x=>x.uid===C.uid);return I?(I.emitter.listenerCount("connect")&&I.emitter.off("connect",D),I.emitter.listenerCount("change")||I.emitter.on("change",D),I.emitter.listenerCount("disconnect")||I.emitter.on("disconnect",A),{...O,connections:new Map(O.connections).set(C.uid,{accounts:C.accounts,chainId:C.chainId,connector:I}),current:C.uid,status:"connected"}):O})}function A(C){E.setState(O=>{const I=O.connections.get(C.uid);if(I){const R=I.connector;R.emitter.listenerCount("change")&&I.connector.emitter.off("change",D),R.emitter.listenerCount("disconnect")&&I.connector.emitter.off("disconnect",A),R.emitter.listenerCount("connect")||I.connector.emitter.on("connect",P)}if(O.connections.delete(C.uid),O.connections.size===0)return{...O,connections:new Map,current:null,status:"disconnected"};const x=O.connections.values().next().value;return{...O,connections:new Map(O.connections),current:x.connector.uid}})}return{get chains(){return c.getState()},get connectors(){return u.getState()},storage:r,getClient:m,get state(){return E.getState()},setState(C){let O;typeof C=="function"?O=C(E.getState()):O=C;const I=_();typeof O!="object"&&(O=I),Object.keys(I).some(R=>!(R in O))&&(O=I),E.setState(O,!0)},subscribe(C,O,I){return E.subscribe(C,O,I?{...I,fireImmediately:I.emitImmediately}:void 0)},_internal:{mipd:o,async revalidate(){const C=E.getState(),O=C.connections;let I=C.current;for(const[,x]of O){const R=x.connector;R.isAuthorized&&await R.isAuthorized()||(O.delete(R.uid),I===R.uid&&(I=null))}E.setState(x=>({...x,connections:O,current:I}))},store:E,ssr:!!a,syncConnectedChain:n,transports:i.transports,chains:{setState(C){const O=typeof C=="function"?C(c.getState()):C;if(O.length!==0)return c.setState(O,!0)},subscribe(C){return c.subscribe(C)}},connectors:{providerDetailToConnector:f,setup:d,setState(C){return u.setState(typeof C=="function"?C(u.getState()):C,!0)},subscribe(C){return u.subscribe(C)}},events:{change:D,connect:P,disconnect:A}}}}function pwe(t,e){const{initialState:r,reconnectOnMount:n}=e;return r&&!t._internal.store.persist.hasHydrated()&&t.setState({...r,chainId:t.chains.some(a=>a.id===r.chainId)?r.chainId:t.chains[0].id,connections:n?r.connections:new Map,status:n?"reconnecting":"disconnected"}),{async onMount(){t._internal.ssr&&(await t._internal.store.persist.rehydrate(),t._internal.mipd&&t._internal.connectors.setState(a=>{const i=new Set;for(const u of a??[])if(u.rdns){const d=Array.isArray(u.rdns)?u.rdns:[u.rdns];for(const f of d)i.add(f)}const o=[],c=t._internal.mipd?.getProviders()??[];for(const u of c){if(i.has(u.info.rdns))continue;const d=t._internal.connectors.providerDetailToConnector(u),f=t._internal.connectors.setup(d);o.push(f)}return[...a,...o]})),n?Wke(t):t.storage&&t.setState(a=>({...a,connections:new Map}))}}}const hwe={getItem(t){return typeof window>"u"?null:mwe(document.cookie,t)??null},setItem(t,e){typeof window>"u"||(document.cookie=`${t}=${e};path=/;samesite=Lax`)},removeItem(t){typeof window>"u"||(document.cookie=`${t}=;max-age=-1;path=/`)}};function mwe(t,e){const r=t.split("; ").find(n=>n.startsWith(`${e}=`));if(r)return r.substring(e.length+1)}function gwe(t){const{chain:e}=t,r=e.rpcUrls.default.http[0];if(!t.transports)return[r];const n=t.transports?.[e.id]?.({chain:e});return(n?.value?.transports||[n]).map(({value:i})=>i?.url||r)}function ywe(t){const{children:e,config:r,initialState:n,reconnectOnMount:a=!0}=t,{onMount:i}=pwe(r,{initialState:n,reconnectOnMount:a});r._internal.ssr||i();const o=v.useRef(!0);return v.useEffect(()=>{if(o.current&&r._internal.ssr)return i(),()=>{o.current=!1}},[]),e}const vwe=v.createContext(void 0);function _we(t){const{children:e,config:r}=t,n={value:r};return v.createElement(ywe,t,v.createElement(vwe.Provider,n,e))}var T0=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},bwe={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},kwe=class{#e=bwe;#t=!1;setTimeoutProvider(t){this.#e=t}setTimeout(t,e){return this.#e.setTimeout(t,e)}clearTimeout(t){this.#e.clearTimeout(t)}setInterval(t,e){return this.#e.setInterval(t,e)}clearInterval(t){this.#e.clearInterval(t)}},nx=new kwe;function wwe(t){setTimeout(t,0)}var C0=typeof window>"u"||"Deno"in globalThis;function Us(){}function Swe(t,e){return typeof t=="function"?t(e):t}function Ewe(t){return typeof t=="number"&&t>=0&&t!==1/0}function Twe(t,e){return Math.max(t+(e||0)-Date.now(),0)}function ax(t,e){return typeof t=="function"?t(e):t}function Cwe(t,e){return typeof t=="function"?t(e):t}function HL(t,e){const{type:r="all",exact:n,fetchStatus:a,predicate:i,queryKey:o,stale:c}=t;if(o){if(n){if(e.queryHash!==ZA(o,e.options))return!1}else if(!wg(e.queryKey,o))return!1}if(r!=="all"){const u=e.isActive();if(r==="active"&&!u||r==="inactive"&&u)return!1}return!(typeof c=="boolean"&&e.isStale()!==c||a&&a!==e.state.fetchStatus||i&&!i(e))}function GL(t,e){const{exact:r,status:n,predicate:a,mutationKey:i}=t;if(i){if(!e.options.mutationKey)return!1;if(r){if(kg(e.options.mutationKey)!==kg(i))return!1}else if(!wg(e.options.mutationKey,i))return!1}return!(n&&e.state.status!==n||a&&!a(e))}function ZA(t,e){return(e?.queryKeyHashFn||kg)(t)}function kg(t){return JSON.stringify(t,(e,r)=>ix(r)?Object.keys(r).sort().reduce((n,a)=>(n[a]=r[a],n),{}):r)}function wg(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(r=>wg(t[r],e[r])):!1}var xwe=Object.prototype.hasOwnProperty;function e$(t,e){if(t===e)return t;const r=WL(t)&&WL(e);if(!r&&!(ix(t)&&ix(e)))return e;const a=(r?t:Object.keys(t)).length,i=r?e:Object.keys(e),o=i.length,c=r?new Array(o):{};let u=0;for(let d=0;d<o;d++){const f=r?d:i[d],h=t[f],m=e[f];if(h===m){c[f]=h,(r?d<a:xwe.call(t,f))&&u++;continue}if(h===null||m===null||typeof h!="object"||typeof m!="object"){c[f]=m;continue}const _=e$(h,m);c[f]=_,_===h&&u++}return a===o&&u===a?t:c}function WL(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function ix(t){if(!KL(t))return!1;const e=t.constructor;if(e===void 0)return!0;const r=e.prototype;return!(!KL(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function KL(t){return Object.prototype.toString.call(t)==="[object Object]"}function Pwe(t){return new Promise(e=>{nx.setTimeout(e,t)})}function Awe(t,e,r){return typeof r.structuralSharing=="function"?r.structuralSharing(t,e):r.structuralSharing!==!1?e$(t,e):e}function Rwe(t,e,r=0){const n=[...t,e];return r&&n.length>r?n.slice(1):n}function Dwe(t,e,r=0){const n=[e,...t];return r&&n.length>r?n.slice(0,-1):n}var e1=Symbol();function t$(t,e){return!t.queryFn&&e?.initialPromise?()=>e.initialPromise:!t.queryFn||t.queryFn===e1?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}var Owe=class extends T0{#e;#t;#r;constructor(){super(),this.#r=t=>{if(!C0&&window.addEventListener){const e=()=>t();return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}}}onSubscribe(){this.#t||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(t){this.#r=t,this.#t?.(),this.#t=t(e=>{typeof e=="boolean"?this.setFocused(e):this.onFocus()})}setFocused(t){this.#e!==t&&(this.#e=t,this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},r$=new Owe;function Nwe(){let t,e;const r=new Promise((a,i)=>{t=a,e=i});r.status="pending",r.catch(()=>{});function n(a){Object.assign(r,a),delete r.resolve,delete r.reject}return r.resolve=a=>{n({status:"fulfilled",value:a}),t(a)},r.reject=a=>{n({status:"rejected",reason:a}),e(a)},r}var Iwe=wwe;function Mwe(){let t=[],e=0,r=c=>{c()},n=c=>{c()},a=Iwe;const i=c=>{e?t.push(c):a(()=>{r(c)})},o=()=>{const c=t;t=[],c.length&&a(()=>{n(()=>{c.forEach(u=>{r(u)})})})};return{batch:c=>{let u;e++;try{u=c()}finally{e--,e||o()}return u},batchCalls:c=>(...u)=>{i(()=>{c(...u)})},schedule:i,setNotifyFunction:c=>{r=c},setBatchNotifyFunction:c=>{n=c},setScheduler:c=>{a=c}}}var Ha=Mwe(),jwe=class extends T0{#e=!0;#t;#r;constructor(){super(),this.#r=t=>{if(!C0&&window.addEventListener){const e=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#t||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(t){this.#r=t,this.#t?.(),this.#t=t(this.setOnline.bind(this))}setOnline(t){this.#e!==t&&(this.#e=t,this.listeners.forEach(r=>{r(t)}))}isOnline(){return this.#e}},Cb=new jwe;function Lwe(t){return Math.min(1e3*2**t,3e4)}function n$(t){return(t??"online")==="online"?Cb.isOnline():!0}var sx=class extends Error{constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function a$(t){let e=!1,r=0,n;const a=Nwe(),i=()=>a.status!=="pending",o=b=>{if(!i()){const E=new sx(b);m(E),t.onCancel?.(E)}},c=()=>{e=!0},u=()=>{e=!1},d=()=>r$.isFocused()&&(t.networkMode==="always"||Cb.isOnline())&&t.canRun(),f=()=>n$(t.networkMode)&&t.canRun(),h=b=>{i()||(n?.(),a.resolve(b))},m=b=>{i()||(n?.(),a.reject(b))},_=()=>new Promise(b=>{n=E=>{(i()||d())&&b(E)},t.onPause?.()}).then(()=>{n=void 0,i()||t.onContinue?.()}),w=()=>{if(i())return;let b;const E=r===0?t.initialPromise:void 0;try{b=E??t.fn()}catch(T){b=Promise.reject(T)}Promise.resolve(b).then(h).catch(T=>{if(i())return;const D=t.retry??(C0?0:3),P=t.retryDelay??Lwe,A=typeof P=="function"?P(r,T):P,C=D===!0||typeof D=="number"&&r<D||typeof D=="function"&&D(r,T);if(e||!C){m(T);return}r++,t.onFail?.(r,T),Pwe(A).then(()=>d()?void 0:_()).then(()=>{e?m(T):w()})})};return{promise:a,status:()=>a.status,cancel:o,continue:()=>(n?.(),a),cancelRetry:c,continueRetry:u,canStart:f,start:()=>(f()?w():_().then(w),a)}}var i$=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Ewe(this.gcTime)&&(this.#e=nx.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(C0?1/0:300*1e3))}clearGcTimeout(){this.#e&&(nx.clearTimeout(this.#e),this.#e=void 0)}},Bwe=class extends i${#e;#t;#r;#a;#n;#s;#o;constructor(t){super(),this.#o=!1,this.#s=t.defaultOptions,this.setOptions(t.options),this.observers=[],this.#a=t.client,this.#r=this.#a.getQueryCache(),this.queryKey=t.queryKey,this.queryHash=t.queryHash,this.#e=YL(this.options),this.state=t.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#n?.promise}setOptions(t){if(this.options={...this.#s,...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const e=YL(this.options);e.data!==void 0&&(this.setData(e.data,{updatedAt:e.dataUpdatedAt,manual:!0}),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(t,e){const r=Awe(this.state.data,t,this.options);return this.#i({data:r,type:"success",dataUpdatedAt:e?.updatedAt,manual:e?.manual}),r}setState(t,e){this.#i({type:"setState",state:t,setStateOptions:e})}cancel(t){const e=this.#n?.promise;return this.#n?.cancel(t),e?e.then(Us).catch(Us):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(t=>Cwe(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===e1||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>ax(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!Twe(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#n?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#n?.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(e=>e!==t),this.observers.length||(this.#n&&(this.#o?this.#n.cancel({revert:!0}):this.#n.cancelRetry()),this.scheduleGc()),this.#r.notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#i({type:"invalidate"})}async fetch(t,e){if(this.state.fetchStatus!=="idle"&&this.#n?.status()!=="rejected"){if(this.state.data!==void 0&&e?.cancelRefetch)this.cancel({silent:!0});else if(this.#n)return this.#n.continueRetry(),this.#n.promise}if(t&&this.setOptions(t),!this.options.queryFn){const c=this.observers.find(u=>u.options.queryFn);c&&this.setOptions(c.options)}const r=new AbortController,n=c=>{Object.defineProperty(c,"signal",{enumerable:!0,get:()=>(this.#o=!0,r.signal)})},a=()=>{const c=t$(this.options,e),d=(()=>{const f={client:this.#a,queryKey:this.queryKey,meta:this.meta};return n(f),f})();return this.#o=!1,this.options.persister?this.options.persister(c,d,this):c(d)},o=(()=>{const c={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:this.#a,state:this.state,fetchFn:a};return n(c),c})();this.options.behavior?.onFetch(o,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==o.fetchOptions?.meta)&&this.#i({type:"fetch",meta:o.fetchOptions?.meta}),this.#n=a$({initialPromise:e?.initialPromise,fn:o.fetchFn,onCancel:c=>{c instanceof sx&&c.revert&&this.setState({...this.#t,fetchStatus:"idle"}),r.abort()},onFail:(c,u)=>{this.#i({type:"failed",failureCount:c,error:u})},onPause:()=>{this.#i({type:"pause"})},onContinue:()=>{this.#i({type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0});try{const c=await this.#n.start();if(c===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(c),this.#r.config.onSuccess?.(c,this),this.#r.config.onSettled?.(c,this.state.error,this),c}catch(c){if(c instanceof sx){if(c.silent)return this.#n.promise;if(c.revert){if(this.state.data===void 0)throw c;return this.state.data}}throw this.#i({type:"error",error:c}),this.#r.config.onError?.(c,this),this.#r.config.onSettled?.(this.state.data,c,this),c}finally{this.scheduleGc()}}#i(t){const e=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...Uwe(r.data,this.options),fetchMeta:t.meta??null};case"success":const n={...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#t=t.manual?n:void 0,n;case"error":const a=t.error;return{...r,error:a,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=e(this.state),Ha.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:t})})}};function Uwe(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:n$(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function YL(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,r=e!==void 0,n=r?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}function XL(t){return{onFetch:(e,r)=>{const n=e.options,a=e.fetchOptions?.meta?.fetchMore?.direction,i=e.state.data?.pages||[],o=e.state.data?.pageParams||[];let c={pages:[],pageParams:[]},u=0;const d=async()=>{let f=!1;const h=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(e.signal.aborted?f=!0:e.signal.addEventListener("abort",()=>{f=!0}),e.signal)})},m=t$(e.options,e.fetchOptions),_=async(w,b,E)=>{if(f)return Promise.reject();if(b==null&&w.pages.length)return Promise.resolve(w);const D=(()=>{const O={client:e.client,queryKey:e.queryKey,pageParam:b,direction:E?"backward":"forward",meta:e.options.meta};return h(O),O})(),P=await m(D),{maxPages:A}=e.options,C=E?Dwe:Rwe;return{pages:C(w.pages,P,A),pageParams:C(w.pageParams,b,A)}};if(a&&i.length){const w=a==="backward",b=w?Fwe:JL,E={pages:i,pageParams:o},T=b(n,E);c=await _(E,T,w)}else{const w=t??i.length;do{const b=u===0?o[0]??n.initialPageParam:JL(n,c);if(u>0&&b==null)break;c=await _(c,b),u++}while(u<w)}return c};e.options.persister?e.fetchFn=()=>e.options.persister?.(d,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},r):e.fetchFn=d}}}function JL(t,{pages:e,pageParams:r}){const n=e.length-1;return e.length>0?t.getNextPageParam(e[n],e,r[n],r):void 0}function Fwe(t,{pages:e,pageParams:r}){return e.length>0?t.getPreviousPageParam?.(e[0],e,r[0],r):void 0}var qwe=class extends i${#e;#t;#r;#a;constructor(t){super(),this.#e=t.client,this.mutationId=t.mutationId,this.#r=t.mutationCache,this.#t=[],this.state=t.state||zwe(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){this.#t.includes(t)||(this.#t.push(t),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#t=this.#t.filter(e=>e!==t),this.scheduleGc(),this.#r.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#r.remove(this))}continue(){return this.#a?.continue()??this.execute(this.state.variables)}async execute(t){const e=()=>{this.#n({type:"continue"})},r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#a=a$({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(i,o)=>{this.#n({type:"failed",failureCount:i,error:o})},onPause:()=>{this.#n({type:"pause"})},onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#r.canRun(this)});const n=this.state.status==="pending",a=!this.#a.canStart();try{if(n)e();else{this.#n({type:"pending",variables:t,isPaused:a}),await this.#r.config.onMutate?.(t,this,r);const o=await this.options.onMutate?.(t,r);o!==this.state.context&&this.#n({type:"pending",context:o,variables:t,isPaused:a})}const i=await this.#a.start();return await this.#r.config.onSuccess?.(i,t,this.state.context,this,r),await this.options.onSuccess?.(i,t,this.state.context,r),await this.#r.config.onSettled?.(i,null,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(i,null,t,this.state.context,r),this.#n({type:"success",data:i}),i}catch(i){try{throw await this.#r.config.onError?.(i,t,this.state.context,this,r),await this.options.onError?.(i,t,this.state.context,r),await this.#r.config.onSettled?.(void 0,i,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(void 0,i,t,this.state.context,r),i}finally{this.#n({type:"error",error:i})}}finally{this.#r.runNext(this)}}#n(t){const e=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=e(this.state),Ha.batch(()=>{this.#t.forEach(r=>{r.onMutationUpdate(t)}),this.#r.notify({mutation:this,type:"updated",action:t})})}};function zwe(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var $we=class extends T0{constructor(t={}){super(),this.config=t,this.#e=new Set,this.#t=new Map,this.#r=0}#e;#t;#r;build(t,e,r){const n=new qwe({client:t,mutationCache:this,mutationId:++this.#r,options:t.defaultMutationOptions(e),state:r});return this.add(n),n}add(t){this.#e.add(t);const e=Iv(t);if(typeof e=="string"){const r=this.#t.get(e);r?r.push(t):this.#t.set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#e.delete(t)){const e=Iv(t);if(typeof e=="string"){const r=this.#t.get(e);if(r)if(r.length>1){const n=r.indexOf(t);n!==-1&&r.splice(n,1)}else r[0]===t&&this.#t.delete(e)}}this.notify({type:"removed",mutation:t})}canRun(t){const e=Iv(t);if(typeof e=="string"){const n=this.#t.get(e)?.find(a=>a.state.status==="pending");return!n||n===t}else return!0}runNext(t){const e=Iv(t);return typeof e=="string"?this.#t.get(e)?.find(n=>n!==t&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Ha.batch(()=>{this.#e.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(t){const e={exact:!0,...t};return this.getAll().find(r=>GL(e,r))}findAll(t={}){return this.getAll().filter(e=>GL(t,e))}notify(t){Ha.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){const t=this.getAll().filter(e=>e.state.isPaused);return Ha.batch(()=>Promise.all(t.map(e=>e.continue().catch(Us))))}};function Iv(t){return t.options.scope?.id}var Vwe=class extends T0{constructor(t={}){super(),this.config=t,this.#e=new Map}#e;build(t,e,r){const n=e.queryKey,a=e.queryHash??ZA(n,e);let i=this.get(a);return i||(i=new Bwe({client:t,queryKey:n,queryHash:a,options:t.defaultQueryOptions(e),state:r,defaultOptions:t.getQueryDefaults(n)}),this.add(i)),i}add(t){this.#e.has(t.queryHash)||(this.#e.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const e=this.#e.get(t.queryHash);e&&(t.destroy(),e===t&&this.#e.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Ha.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#e.get(t)}getAll(){return[...this.#e.values()]}find(t){const e={exact:!0,...t};return this.getAll().find(r=>HL(e,r))}findAll(t={}){const e=this.getAll();return Object.keys(t).length>0?e.filter(r=>HL(t,r)):e}notify(t){Ha.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){Ha.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Ha.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Hwe=class{#e;#t;#r;#a;#n;#s;#o;#i;constructor(t={}){this.#e=t.queryCache||new Vwe,this.#t=t.mutationCache||new $we,this.#r=t.defaultOptions||{},this.#a=new Map,this.#n=new Map,this.#s=0}mount(){this.#s++,this.#s===1&&(this.#o=r$.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#i=Cb.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#s--,this.#s===0&&(this.#o?.(),this.#o=void 0,this.#i?.(),this.#i=void 0)}isFetching(t){return this.#e.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#t.findAll({...t,status:"pending"}).length}getQueryData(t){const e=this.defaultQueryOptions({queryKey:t});return this.#e.get(e.queryHash)?.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),r=this.#e.build(this,e),n=r.state.data;return n===void 0?this.fetchQuery(t):(t.revalidateIfStale&&r.isStaleByTime(ax(e.staleTime,r))&&this.prefetchQuery(e),Promise.resolve(n))}getQueriesData(t){return this.#e.findAll(t).map(({queryKey:e,state:r})=>{const n=r.data;return[e,n]})}setQueryData(t,e,r){const n=this.defaultQueryOptions({queryKey:t}),i=this.#e.get(n.queryHash)?.state.data,o=Swe(e,i);if(o!==void 0)return this.#e.build(this,n).setData(o,{...r,manual:!0})}setQueriesData(t,e,r){return Ha.batch(()=>this.#e.findAll(t).map(({queryKey:n})=>[n,this.setQueryData(n,e,r)]))}getQueryState(t){const e=this.defaultQueryOptions({queryKey:t});return this.#e.get(e.queryHash)?.state}removeQueries(t){const e=this.#e;Ha.batch(()=>{e.findAll(t).forEach(r=>{e.remove(r)})})}resetQueries(t,e){const r=this.#e;return Ha.batch(()=>(r.findAll(t).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const r={revert:!0,...e},n=Ha.batch(()=>this.#e.findAll(t).map(a=>a.cancel(r)));return Promise.all(n).then(Us).catch(Us)}invalidateQueries(t,e={}){return Ha.batch(()=>(this.#e.findAll(t).forEach(r=>{r.invalidate()}),t?.refetchType==="none"?Promise.resolve():this.refetchQueries({...t,type:t?.refetchType??t?.type??"active"},e)))}refetchQueries(t,e={}){const r={...e,cancelRefetch:e.cancelRefetch??!0},n=Ha.batch(()=>this.#e.findAll(t).filter(a=>!a.isDisabled()&&!a.isStatic()).map(a=>{let i=a.fetch(void 0,r);return r.throwOnError||(i=i.catch(Us)),a.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(n).then(Us)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const r=this.#e.build(this,e);return r.isStaleByTime(ax(e.staleTime,r))?r.fetch(e):Promise.resolve(r.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Us).catch(Us)}fetchInfiniteQuery(t){return t.behavior=XL(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Us).catch(Us)}ensureInfiniteQueryData(t){return t.behavior=XL(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return Cb.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#r}setDefaultOptions(t){this.#r=t}setQueryDefaults(t,e){this.#a.set(kg(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...this.#a.values()],r={};return e.forEach(n=>{wg(t,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(t,e){this.#n.set(kg(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...this.#n.values()],r={};return e.forEach(n=>{wg(t,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(t){if(t._defaulted)return t;const e={...this.#r.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=ZA(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===e1&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...this.#r.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Gwe=v.createContext(void 0),Wwe=({client:t,children:e})=>(v.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),g.jsx(Gwe.Provider,{value:t,children:e}));const s$=W6({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},blockTime:12e3,rpcUrls:{default:{http:["https://eth.merkle.io"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensUniversalResolver:{address:"0xeeeeeeee14d718c2b47d9923deab1335e144eeee",blockCreated:23085558},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),o$=W6({id:137,name:"Polygon",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{default:{http:["https://polygon-rpc.com"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://polygonscan.com",apiUrl:"https://api.polygonscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:25770160}}});t1.type="walletConnect";function t1(t){const e=t.isNewChainsStale??!0;let r,n;const a="eip155";let i,o,c,u,d,f;return h=>({id:"walletConnect",name:"WalletConnect",type:t1.type,async setup(){const m=await this.getProvider().catch(()=>null);m&&(c||(c=this.onConnect.bind(this),m.on("connect",c)),d||(d=this.onSessionDelete.bind(this),m.on("session_delete",d)))},async connect({chainId:m,withCapabilities:_,...w}={}){try{const b=await this.getProvider();if(!b)throw new Dl;u||(u=this.onDisplayUri,b.on("display_uri",u));let E=m;if(!E){const A=await h.storage?.getItem("state")??{};h.chains.some(O=>O.id===A.chainId)?E=A.chainId:E=h.chains[0]?.id}if(!E)throw new Error("No chains found on connector.");const T=await this.isChainsStale();if(b.session&&T&&await b.disconnect(),!b.session||T){const A=h.chains.filter(C=>C.id!==E).map(C=>C.id);await b.connect({optionalChains:[E,...A],..."pairingTopic"in w?{pairingTopic:w.pairingTopic}:{}}),this.setRequestedChainsIds(h.chains.map(C=>C.id))}const D=(await b.enable()).map(A=>Ju(A));let P=await this.getChainId();return m&&P!==m&&(P=(await this.switchChain({chainId:m}).catch(C=>{if(C.code===na.code&&C.cause?.message!=="Missing or invalid. request() method: wallet_addEthereumChain")throw C;return{id:P}}))?.id??P),u&&(b.removeListener("display_uri",u),u=void 0),c&&(b.removeListener("connect",c),c=void 0),i||(i=this.onAccountsChanged.bind(this),b.on("accountsChanged",i)),o||(o=this.onChainChanged.bind(this),b.on("chainChanged",o)),f||(f=this.onDisconnect.bind(this),b.on("disconnect",f)),d||(d=this.onSessionDelete.bind(this),b.on("session_delete",d)),{accounts:_?D.map(A=>({address:A,capabilities:{}})):D,chainId:P}}catch(b){throw/(user rejected|connection request reset)/i.test(b?.message)?new na(b):b}},async disconnect(){const m=await this.getProvider();try{await m?.disconnect()}catch(_){if(!/No matching key/i.test(_.message))throw _}finally{o&&(m?.removeListener("chainChanged",o),o=void 0),f&&(m?.removeListener("disconnect",f),f=void 0),c||(c=this.onConnect.bind(this),m?.on("connect",c)),i&&(m?.removeListener("accountsChanged",i),i=void 0),d&&(m?.removeListener("session_delete",d),d=void 0),this.setRequestedChainsIds([])}},async getAccounts(){return(await this.getProvider()).accounts.map(_=>Ju(_))},async getProvider({chainId:m}={}){async function _(){const w=h.chains.map(E=>E.id);if(!w.length)return;const{EthereumProvider:b}=await qr(async()=>{const{EthereumProvider:E}=await import("./index.es-GMeyU_-e.js").then(T=>T.Y);return{EthereumProvider:E}},[],import.meta.url);return await b.init({...t,disableProviderPing:!0,optionalChains:w,projectId:t.projectId,rpcMap:Object.fromEntries(h.chains.map(E=>{const[T]=gwe({chain:E,transports:h.transports});return[E.id,T]})),showQrModal:t.showQrModal??!0})}return r||(n||(n=_()),r=await n,r?.events.setMaxListeners(Number.POSITIVE_INFINITY)),m&&await this.switchChain?.({chainId:m}),r},async getChainId(){return(await this.getProvider()).chainId},async isAuthorized(){try{const[m,_]=await Promise.all([this.getAccounts(),this.getProvider()]);return m.length?await this.isChainsStale()&&_.session?(await _.disconnect().catch(()=>{}),!1):!0:!1}catch{return!1}},async switchChain({addEthereumChainParameter:m,chainId:_}){const w=await this.getProvider();if(!w)throw new Dl;const b=h.chains.find(E=>E.id===_);if(!b)throw new ou(new Tb);try{await Promise.all([new Promise(T=>{const D=({chainId:P})=>{P===_&&(h.emitter.off("change",D),T())};h.emitter.on("change",D)}),w.request({method:"wallet_switchEthereumChain",params:[{chainId:gp(_)}]})]);const E=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...E,_]),b}catch(E){const T=E;if(/(user rejected)/i.test(T.message))throw new na(T);try{let D;m?.blockExplorerUrls?D=m.blockExplorerUrls:D=b.blockExplorers?.default.url?[b.blockExplorers?.default.url]:[];let P;m?.rpcUrls?.length?P=m.rpcUrls:P=[...b.rpcUrls.default.http];const A={blockExplorerUrls:D,chainId:gp(_),chainName:m?.chainName??b.name,iconUrls:m?.iconUrls,nativeCurrency:m?.nativeCurrency??b.nativeCurrency,rpcUrls:P};await w.request({method:"wallet_addEthereumChain",params:[A]});const C=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...C,_]),b}catch(D){throw new na(D)}}},onAccountsChanged(m){m.length===0?this.onDisconnect():h.emitter.emit("change",{accounts:m.map(_=>Ju(_))})},onChainChanged(m){const _=Number(m);h.emitter.emit("change",{chainId:_})},async onConnect(m){const _=Number(m.chainId),w=await this.getAccounts();h.emitter.emit("connect",{accounts:w,chainId:_})},async onDisconnect(m){this.setRequestedChainsIds([]),h.emitter.emit("disconnect");const _=await this.getProvider();i&&(_.removeListener("accountsChanged",i),i=void 0),o&&(_.removeListener("chainChanged",o),o=void 0),f&&(_.removeListener("disconnect",f),f=void 0),d&&(_.removeListener("session_delete",d),d=void 0),c||(c=this.onConnect.bind(this),_.on("connect",c))},onDisplayUri(m){h.emitter.emit("message",{type:"display_uri",data:m})},onSessionDelete(){this.onDisconnect()},getNamespaceChainsIds(){return r?r.session?.namespaces[a]?.accounts?.map(_=>Number.parseInt(_.split(":")[1]||"",10))??[]:[]},async getRequestedChainsIds(){return await h.storage?.getItem(this.requestedChainsStorageKey)??[]},async isChainsStale(){if(!e)return!1;const m=h.chains.map(b=>b.id),_=this.getNamespaceChainsIds();if(_.length&&!_.some(b=>m.includes(b)))return!1;const w=await this.getRequestedChainsIds();return!m.every(b=>w.includes(b))},async setRequestedChainsIds(m){await h.storage?.setItem(this.requestedChainsStorageKey,m)},get requestedChainsStorageKey(){return`${this.id}.requestedChains`}})}var Kwe={};const Ywe=[s$,o$],Xwe=new Hwe,Jwe=Q6({storage:hwe});function Qwe(){const t=!!(import.meta.vitest||typeof process<"u"&&Kwe?.VITEST_WORKER_ID),e=[E0({shimDisconnect:!0})];if(!t)try{e.push(t1({projectId:"demo",showQrModal:!0}))}catch{}return fwe({chains:Ywe,multiInjectedProviderDiscovery:!0,transports:{[s$.id]:FL(),[o$.id]:FL()},connectors:e,ssr:!1,storage:Jwe,syncConnectedChain:!0})}function Zwe({children:t}){const e=Qwe();return g.jsx(_we,{config:e,children:g.jsx(Wwe,{client:Xwe,children:t})})}v.createContext(void 0);const c$=v.createContext(void 0);async function eSe(){try{const t=new AbortController,e=setTimeout(()=>t.abort(),5e3),r=await fetch("/api/features",{cache:"no-store",signal:t.signal});return clearTimeout(e),r.ok?await r.json():null}catch{return null}}function tSe({children:t}){const[e,r]=v.useState(!1),[n,a]=v.useState(!1),i=async()=>{const o=await eSe();a(!!o?.features?.wallet),r(!0)};return v.useEffect(()=>{const o=i(),c=window.setTimeout(()=>{r(u=>!0)},6e3);return o.finally(()=>clearTimeout(c)),()=>clearTimeout(c)},[]),g.jsx(c$.Provider,{value:{loaded:e,walletEnabled:n,refresh:i},children:t})}function rSe(){return v.useContext(c$)??{loaded:!0,walletEnabled:!1,refresh:()=>{}}}const nT=ro("SafeArea",{web:()=>qr(()=>import("./web-C2_j4PDR.js"),[],import.meta.url).then(t=>new t.SafeAreaWeb)});function Mv(t){var e;typeof document<"u"&&((e=document.querySelector(":root"))===null||e===void 0||e.style.setProperty(`--safe-area-inset-${t}`,`max(env(safe-area-inset-${t}), 0px)`))}function nSe(){Mv("top"),Mv("left"),Mv("bottom"),Mv("right")}nSe();class l$ extends Tt.Component{state={hasError:!1};static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,r){this.props.onError?.(e,r)}handleReset=()=>{this.setState({hasError:!1,error:void 0}),this.props.onReset?.()};render(){return this.state.hasError?this.props.fallback?g.jsx(g.Fragment,{children:this.props.fallback}):g.jsxs("div",{className:"error-boundary",role:"alert",style:{padding:16},children:[g.jsx("h2",{children:"Something went wrong"}),g.jsx("p",{children:"Please refresh or return to the previous screen."}),g.jsx("button",{className:"felt-btn",onClick:this.handleReset,children:"Try again"})]}):this.props.children}}var QL;(function(t){t[t.Sunday=1]="Sunday",t[t.Monday=2]="Monday",t[t.Tuesday=3]="Tuesday",t[t.Wednesday=4]="Wednesday",t[t.Thursday=5]="Thursday",t[t.Friday=6]="Friday",t[t.Saturday=7]="Saturday"})(QL||(QL={}));const aT=ro("LocalNotifications",{web:()=>qr(()=>import("./web-oVA2P60B.js"),[],import.meta.url).then(t=>new t.LocalNotificationsWeb)}),pf=ro("PushNotifications",{}),aSe={};let ZL=!1;async function iSe(t={}){if(ZL||(ZL=!0,!(Gr.getPlatform()==="ios"||Gr.getPlatform()==="android")))return;const r=t.enableLocal!==!1,n=t.enablePush??aSe?.VITE_ENABLE_PUSH==="1";if(r)try{await sSe()}catch{}if(n)try{await oSe(t.onPushToken)}catch{}}async function sSe(){try{if((await aT.requestPermissions()).display!=="granted")return}catch{}try{await aT.createChannel?.({id:"default",name:"General",description:"General notifications",importance:4,visibility:1,sound:void 0,lights:!0,vibration:!0})}catch{}try{aT.addListener("localNotificationActionPerformed",t=>{})}catch{}}async function oSe(t){try{if((await pf.requestPermissions()).receive!=="granted")return}catch{return}try{await pf.register()}catch{}pf.addListener("registration",e=>{try{t?.(e.value)}catch{}}),pf.addListener("registrationError",e=>{}),pf.addListener("pushNotificationReceived",e=>{}),pf.addListener("pushNotificationActionPerformed",e=>{})}function cSe({cooldownMs:t=5e3,initialGraceMs:e=900}){const r=ks(),{room:n}=Mi(),a=v.useRef(0),i=v.useRef(!1),o=v.useRef(!1),c=v.useRef(Date.now());return v.useEffect(()=>{(()=>{try{return typeof window<"u"&&window.location.search.includes("debugForeground=1")||typeof localStorage<"u"&&localStorage.getItem("debug:foreground")==="1"}catch{return!1}})();const u=Date.now();try{window.__fgMountedAt=u}catch{}},[]),v.useEffect(()=>{let u=[],d=!1;const f=(()=>{try{return typeof window<"u"&&window.location.search.includes("debugForeground=1")||typeof localStorage<"u"&&localStorage.getItem("debug:foreground")==="1"}catch{return!1}})(),h=async(T,D=!1)=>{if(d)return;const P=Date.now();if(!(!D&&P-c.current<e)&&!i.current&&!(!D&&P-a.current<t)){i.current=!0;try{const A=n?.id||void 0;if(r)if(f)try{const C=await vT(r,St.BOTS_NUDGE,{roomId:A},{timeoutMs:5e3});try{window.__fgLastAck=C}catch{}}catch{}else await aB(r,St.BOTS_NUDGE,{roomId:A});a.current=P}catch{}finally{i.current=!1}}},m=async(T,D=!1)=>{if(d)return;const P=Date.now();if(!(!D&&P-c.current<e)&&!o.current){if(o.current=!0,!D&&P-a.current<t){o.current=!1;return}try{const A=n?.id||void 0;if(!r)return;try{await im(r)}catch{}try{(await vT(r,St.ROOM_REFRESH_STATE,{roomId:A},{timeoutMs:5e3}))?.ok,a.current=P}catch{}}catch{}finally{o.current=!1}}};try{window.__fgNudge=(T,D)=>{h(T||"manual",!!D)}}catch{}(async()=>{try{const T=await Bo.addListener("appStateChange",D=>{if(!d)if(D.isActive)(async()=>{try{await im(r)}catch{}h("native_appstate_active",!0),m("native_appstate_active")})();else try{Zu(r,"BotNudgeOnForeground: appStateChange inactive")}catch{}});try{window.__fgAppStateListener=!0}catch{}u.push(()=>{try{T.remove()}catch{}})}catch{}})(),(async()=>{try{const T=await Bo.addListener("pause",()=>{try{window?.Capacitor?.isNativePlatform&&Zu(r,"BotNudgeOnForeground: pause event")}catch{}});try{window.__fgPauseListener=!0}catch{}u.push(()=>{try{T.remove()}catch{}})}catch{}})(),(async()=>{try{const T=await Bo.addListener("resume",async()=>{try{await im(r)}catch{}h("native_resume",!0),m("native_resume")});try{window.__fgResumeListener=!0}catch{}u.push(()=>{try{T.remove()}catch{}})}catch{}})();const _=()=>{d||document.visibilityState==="visible"&&(h(),m())};document.addEventListener("visibilitychange",_),u.push(()=>document.removeEventListener("visibilitychange",_));const w=()=>{d||(h(),m())},b=()=>{d||(h(),m())};window.addEventListener("focus",w),window.addEventListener("pageshow",b),u.push(()=>{window.removeEventListener("focus",w),window.removeEventListener("pageshow",b)});const E=setTimeout(()=>{h(),m()},2500);return u.push(()=>clearTimeout(E)),()=>{d=!0,u.forEach(T=>{try{T()}catch{}})}},[r,n?.id,t]),null}function lSe(){const[t,e]=v.useState(()=>{try{return window.localStorage?.getItem("sfxDebug")==="1"}catch{return!1}}),[r,n]=v.useState([]),a=200,i=v.useRef(null);if(v.useEffect(()=>{if(!t)return;const c=u=>{try{const d=u.detail;n(f=>{const h=[...f,d];return h.length>a&&h.splice(0,h.length-a),h})}catch{}};return window.addEventListener("sfx:debug",c),()=>window.removeEventListener("sfx:debug",c)},[t]),!t)return null;const o=v.useMemo(()=>r.map(c=>{const d=[new Date(c.t||Date.now()).toLocaleTimeString(),c.kind];return c.key&&d.push(c.key),c.volume!=null&&d.push(`v=${c.volume}`),c.rate!=null&&d.push(`r=${c.rate}`),c.reason&&d.push(`(${c.reason})`),d.join(" ")}),[r]);return v.useEffect(()=>{try{i.current?.scrollTo({top:i.current.scrollHeight})}catch{}},[o.length]),g.jsxs("div",{style:{position:"fixed",right:8,bottom:8,width:360,maxHeight:240,zIndex:99999,background:"rgba(0,0,0,0.7)",color:"#fff",borderRadius:6,border:"1px solid rgba(255,255,255,0.2)",boxShadow:"0 2px 8px rgba(0,0,0,0.3)"},children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"6px 8px",borderBottom:"1px solid rgba(255,255,255,0.15)"},children:[g.jsx("strong",{style:{fontSize:12,letterSpacing:.3},children:"SFX Debug"}),g.jsxs("div",{style:{marginLeft:"auto",display:"flex",gap:6},children:[g.jsx("button",{className:"btn btn-xxs",onClick:()=>n([]),children:"Clear"}),g.jsx("button",{className:"btn btn-xxs",onClick:()=>{e(!1);try{localStorage.removeItem("sfxDebug")}catch{}},children:"Close"})]})]}),g.jsx("div",{ref:i,style:{maxHeight:196,overflow:"auto",padding:"6px 8px",fontFamily:"monospace",fontSize:11,lineHeight:1.35},children:o.map((c,u)=>g.jsx("div",{children:c},u))})]})}function uSe(){const[t,e]=v.useState(()=>{try{const u=new URL(window.location.href).searchParams.get("rtcDebug")==="1",d=window.localStorage?.getItem("rtcDebug")==="1",f=window.__RTC_DEBUG__===!0;return u||d||f}catch{return!1}}),[r,n]=v.useState(()=>{try{return p4().filter(c=>c?.tag==="RTC")}catch{return[]}}),a=400,i=v.useRef(null);if(v.useEffect(()=>{const c=d=>{d.key==="rtcDebug"&&e(d.newValue==="1")};window.addEventListener("storage",c),window.rtcDebugOpen=()=>e(!0),window.rtcDebugClose=()=>e(!1);const u=()=>{try{new URL(window.location.href).searchParams.get("rtcDebug")==="1"&&e(!0)}catch{}};return window.addEventListener("popstate",u),()=>{window.removeEventListener("storage",c),window.removeEventListener("popstate",u);try{delete window.rtcDebugOpen,delete window.rtcDebugClose}catch{}}},[]),v.useEffect(()=>{if(!t)return;const c=u=>{try{const d=u.detail;if(!d||d.tag!=="RTC")return;n(f=>{const h=[...f,d];return h.length>a&&h.splice(0,h.length-a),h})}catch{}};return window.addEventListener("fe:log",c),()=>window.removeEventListener("fe:log",c)},[t]),!t)return null;const o=v.useMemo(()=>r.map(c=>{const u=new Date(c.t||Date.now()).toLocaleTimeString(),d=c.level?.toUpperCase?.()||"LOG",f=c.msg||"",h=c.data?JSON.stringify(c.data):"";return`${u} ${d} ${f} ${h}`}),[r]);return v.useEffect(()=>{try{i.current?.scrollTo({top:i.current.scrollHeight})}catch{}},[o.length]),g.jsxs("div",{style:{position:"fixed",left:8,bottom:8,width:420,maxHeight:260,zIndex:99998,background:"rgba(0,0,0,0.72)",color:"#fff",borderRadius:6,border:"1px solid rgba(255,255,255,0.2)",boxShadow:"0 2px 8px rgba(0,0,0,0.3)"},children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"6px 8px",borderBottom:"1px solid rgba(255,255,255,0.15)"},children:[g.jsx("strong",{style:{fontSize:12,letterSpacing:.3},children:"RTC Debug"}),g.jsxs("div",{style:{marginLeft:"auto",display:"flex",gap:6},children:[g.jsx("button",{className:"btn btn-xxs",onClick:()=>n([]),children:"Clear"}),g.jsx("button",{className:"btn btn-xxs",onClick:()=>{try{navigator.clipboard.writeText(JSON.stringify(r,null,2))}catch{}},children:"Copy"}),g.jsx("button",{className:"btn btn-xxs",onClick:()=>{e(!1);try{localStorage.removeItem("rtcDebug"),window.__RTC_DEBUG__=!1}catch{}},children:"Close"})]})]}),g.jsx("div",{ref:i,style:{maxHeight:212,overflow:"auto",padding:"6px 8px",fontFamily:"monospace",fontSize:11,lineHeight:1.35},children:o.map((c,u)=>g.jsx("div",{children:c},u))})]})}function dSe(){const{meId:t}=$r(),e=tn(),r=yi(),{info:n,onIdle:a}=Es(),{room:i,setRoom:o}=Mi(),{leaveRoom:c}=gu(),u=Tt.useRef(!1);return Tt.useEffect(()=>{const d=r.pathname||"";/^\/(room|poker\/room)\//.test(d)||(u.current=!1)},[r.pathname]),Pa({onPlayerBalanceUpdated:({playerId:d,balance:f})=>{if(!(!t||d!==t)&&typeof f=="number"&&!(f>0)&&!u.current){u.current=!0;try{i?.id&&typeof c=="function"&&c(i.id)}catch{}try{o?.(null)}catch{}try{n("Out of Chips","Returning to Lobby…")}catch{}try{e("/lobby",{replace:!0})}catch{}}}}),null}function fSe(t){switch(t){case"cee-lo":return"Cee-Lo";case"craps":return"Craps";case"poker":return"Poker";default:return t}}function pSe(t,e){switch(t){case"cee-lo":return`/room/${e}`;case"craps":return`/room/${e}`;case"poker":return`/poker/room/${e}`;default:return`/room/${e}`}}function hSe(){const t=T6(),e=tn(),r=v.useRef(null),n=t?.currentInvite;if(v.useEffect(()=>{if(!n)return;const c=d=>{d.key==="Escape"&&t?.dismissCurrentInvite()},u=d=>{r.current&&!r.current.contains(d.target)&&t?.dismissCurrentInvite()};return document.addEventListener("keydown",c),document.addEventListener("mousedown",u),()=>{document.removeEventListener("keydown",c),document.removeEventListener("mousedown",u)}},[n,t]),!n)return null;const a=async()=>{const c=await t?.acceptInvite(n.inviteId);if(c?.ok&&c.roomId){const u=pSe(n.gameMode,c.roomId);e(u)}},i=()=>{t?.declineInvite(n.inviteId)},o=g.jsx("div",{className:"modal-backdrop",role:"presentation",style:{position:"fixed",inset:0,zIndex:99999,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0, 0, 0, 0.7)",backdropFilter:"blur(4px)"},children:g.jsxs("div",{className:"modal-panel",role:"dialog","aria-modal":"true","aria-label":"Game invite",ref:r,style:{maxWidth:340,position:"relative",background:"linear-gradient(135deg, #1a1a2e 0%, #16213e 100%)",borderRadius:12,padding:"24px",boxShadow:"0 8px 32px rgba(0, 0, 0, 0.5)",border:"1px solid rgba(255, 215, 0, 0.2)"},children:[g.jsx("button",{className:"modal-close",onClick:i,"aria-label":"Close",style:{position:"absolute",top:8,right:8,background:"none",border:"none",color:"#fff",fontSize:"1.5rem",cursor:"pointer",opacity:.7},children:"×"}),g.jsx("h3",{className:"modal-title",style:{marginBottom:12,textAlign:"center",color:"#fff"},children:"🎲 Game Invite"}),g.jsxs("div",{style:{textAlign:"center",marginBottom:16,color:"#fff"},children:[g.jsxs("p",{style:{fontSize:"1rem",margin:"8px 0"},children:[g.jsx("strong",{children:n.fromUserName})," has invited you to play"]}),g.jsx("p",{style:{fontSize:"1.25rem",fontWeight:600,color:"var(--gold, #ffc107)",margin:"8px 0"},children:fSe(n.gameMode)}),g.jsxs("p",{style:{fontSize:"0.875rem",opacity:.8,margin:"4px 0"},children:["Room: ",n.roomName]})]}),g.jsxs("div",{style:{display:"flex",gap:12,marginTop:20,justifyContent:"center"},children:[g.jsx("button",{className:"felt-btn btn--ghost",onClick:i,style:{minWidth:100},children:"Decline"}),g.jsx("button",{className:"felt-btn felt-btn--primary",onClick:a,style:{minWidth:100},children:"Join Game"})]})]})});return Wc.createPortal(o,document.body)}function mSe(){const t=ks(),e=v.useRef(0);return v.useEffect(()=>{let r;const n=()=>{try{const a=Hv(),i=a.length?a[a.length-1].ts:0,o=Date.now();if(!t.connected&&o-i>2e4&&o-e.current>1e4){e.current=o;try{Hs(t,"SocketWatchdog")}catch{}}}catch{}r=setTimeout(n,2e3),r.unref?.()};return n(),()=>clearTimeout(r)},[t]),null}try{const t=Gr.getPlatform();if((t==="ios"||t==="android")&&(Promise.resolve(nT.enable?.({config:{customColorsForSystemBars:!0,statusBarColor:"#00000000",statusBarContent:"light",navigationBarColor:"#00000000",navigationBarContent:"light"}})).catch(()=>{}),Mp().catch(e=>{})),t==="ios"||t==="android"){let e=0,r=0;const n=async()=>{try{const i=await nT.getSafeAreaInsets?.(),o=Math.round(i?.insets?.top??i?.top??0),c=Math.round(i?.insets?.bottom??i?.bottom??0),u=window.innerHeight>window.innerWidth;u&&o>0&&(e=o),u&&c>0&&(r=c);const d=u?o>0?o:e:o,f=u?c>0?c:r:c,h=document.documentElement;h.style.setProperty("--safe-top-global",`${d}px`),h.style.setProperty("--safe-bottom",`${f}px`),h.style.transform="translateZ(0)",requestAnimationFrame(()=>{h.style.transform=""})}catch{const i=document.documentElement;i.style.transform="translateZ(0)",requestAnimationFrame(()=>{i.style.transform=""})}};n();const a=()=>{setTimeout(n,50),setTimeout(n,150),setTimeout(n,300),setTimeout(n,500)};window.addEventListener("orientationchange",a),window.addEventListener("resize",n);try{nT.addListener?.("safeAreaChanged",n)}catch{}if(t==="ios")try{document.documentElement.classList.add("is-native-app","platform-ios"),document.body.classList.add("is-native-app","platform-ios")}catch{}}}catch{}if(Gr.getPlatform()==="android"){const e=()=>{let r=24;const n=window.visualViewport;if(n&&typeof window.innerHeight=="number"){const a=Math.max(0,Math.round(window.innerHeight-(n.height+n.offsetTop)));a>0&&a<64&&(r=a)}document.documentElement.style.setProperty("--android-safe-area-bottom",`${r}px`),document.documentElement.style.setProperty("--android-extra-bottom","24px")};e(),window.addEventListener("resize",e),window.addEventListener("orientationchange",()=>setTimeout(e,100));try{document.documentElement.classList.add("is-native-app","platform-android"),document.body.classList.add("is-native-app","platform-android")}catch{}}function gSe(){const{loaded:t,walletEnabled:e}=rSe(),r=tn(),n=yi(),a=v.useRef(null),i=v.useRef(Date.now());return v.useEffect(()=>{const u=()=>{a.current&&window.clearTimeout(a.current),a.current=window.setTimeout(()=>{n.pathname!=="/lobby"&&r("/lobby",{replace:!0})},24e4)},d=()=>{i.current=Date.now(),u()};u();const f=()=>d(),h=()=>d(),m=()=>{document.visibilityState==="visible"&&d()};return window.addEventListener("pointerdown",f,{capture:!0}),window.addEventListener("keydown",h,{capture:!0}),document.addEventListener("visibilitychange",m),()=>{a.current&&window.clearTimeout(a.current),window.removeEventListener("pointerdown",f,{capture:!0}),window.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("visibilitychange",m)}},[r,n.pathname]),t?(c=>e?g.jsx(Zwe,{children:c}):g.jsx(g.Fragment,{children:c}))(g.jsx(nG,{children:g.jsx(Yre,{children:g.jsxs(M_e,{children:[g.jsx($0e,{}),g.jsx(KG,{children:g.jsx(dne,{children:g.jsxs(tG,{children:[g.jsx(H0e,{}),g.jsx(Dfe,{children:g.jsx(wfe,{children:g.jsx(z_e,{children:g.jsx(pbe,{children:g.jsx(kbe,{children:g.jsx(Nfe,{children:g.jsx(sG,{children:g.jsxs(l$,{children:[g.jsx(U0e,{}),g.jsx(hSe,{}),g.jsx(dSe,{}),g.jsx(cSe,{}),g.jsx(lSe,{}),g.jsx(uSe,{}),g.jsx(mSe,{})]})})})})})})})})]})})})]})})})):g.jsxs("div",{className:"HomeScreen theme-casino home-fixed-root",children:[g.jsx(ji,{className:"page-home-screen"}),g.jsx("div",{className:"home-preloader",children:g.jsx("div",{className:"home-preloader__spinner"})})]})}function ySe(){return v.useEffect(()=>{const t={current:null};return t.current=()=>{try{Xr()}catch{}t.current&&(window.removeEventListener("pointerdown",t.current,{capture:!0}),t.current=null)},window.addEventListener("pointerdown",t.current,{capture:!0}),()=>{t.current&&(window.removeEventListener("pointerdown",t.current,{capture:!0}),t.current=null)}},[]),v.useEffect(()=>{try{iSe()}catch{}},[]),g.jsx(W9,{children:g.jsx(_7,{children:g.jsx(tSe,{children:g.jsx(gSe,{})})})})}function vSe(t){const e=t?.healthIntervalMs??8e3,r=t?.maxRetriesPerPlay??3;t?.debug;const[n,a]=v.useState(!1),[i,o]=v.useState(!1),[c,u]=v.useState(1),d=v.useRef({plays:0,failures:0,recovered:0,rebuilds:0}),f=v.useRef({}),h=v.useRef(!0),m=v.useRef(!1),_=v.useRef(null),w=(...O)=>{},b=v.useCallback(()=>{if(n||m.current)return;m.current=!0;const O=()=>{try{$G?.(),a(!0),w("activated via user gesture")}catch{}window.removeEventListener("pointerdown",O),window.removeEventListener("touchstart",O),window.removeEventListener("keydown",O)};window.addEventListener("pointerdown",O,{passive:!0,once:!0}),window.addEventListener("touchstart",O,{passive:!0,once:!0}),window.addEventListener("keydown",O,{passive:!0,once:!0})},[n,w]);v.useEffect(()=>{b()},[b]);const E=O=>{try{typeof _O=="function"&&(_O(O),d.current.rebuilds+=1,w("rebuild asset",O))}catch{}},T=v.useCallback(async(O,I)=>{if(i&&!I?.allowDuringMute)return!1;n||b();const x=I?.volume??c;let R=0;const N=()=>new Promise(L=>{let j=!1;const q=U=>{j||(j=!0,L(U))};try{const U=VG?.(O,{volume:x,rate:I?.rate,loop:I?.loop});U&&typeof U.then=="function"?U.then(()=>q(!0)).catch(()=>q(!1)):setTimeout(()=>q(!0),0)}catch{q(!1)}});for(;R<=r;){if(await N())return d.current.plays+=1,R>0&&(d.current.recovered+=1),f.current[O]=0,!0;if(R+=1,d.current.failures+=1,f.current[O]=(f.current[O]||0)+1,f.current[O]>=3&&E(O),R>r)break;await new Promise(j=>setTimeout(j,60*R))}return!1},[i,n,b,c,r,w]),D=v.useCallback(O=>{try{HG?.(O)}catch{}},[]),P=v.useCallback(O=>{o(O)},[]),A=v.useCallback(O=>{u(Math.max(0,Math.min(1,O)))},[]);return v.useEffect(()=>{const O=async()=>{if(!h.current||!n)return;const I=d.current,x=I.plays+I.failures;if(x>=4){const R=I.failures/(x||1);if(R>.4){w("elevated failure ratio",R.toFixed(2),"running probe");try{await T("__probe__",{volume:0,allowDuringMute:!0})||(a(!1),m.current=!1,b(),w("probe failed → deactivated, awaiting gesture"))}catch{}}}};return _.current=window.setInterval(O,e),()=>{_.current&&window.clearInterval(_.current)}},[e,n,T,b,w]),v.useEffect(()=>{const O=()=>{document.visibilityState==="visible"&&n&&T("__probe__",{volume:0,allowDuringMute:!0})};return document.addEventListener("visibilitychange",O),()=>document.removeEventListener("visibilitychange",O)},[n,T]),v.useEffect(()=>()=>{h.current=!1},[]),{play:T,preload:D,setMuted:P,setVolume:A,activationPrompt:b,isActivated:n,isMuted:i,volume:c,stats:d.current}}function _Se({children:t,config:e}){return vSe(e),g.jsx(g.Fragment,{children:t})}const bSe=[{id:"a",file:"/avatars/avatar-a.png",label:"Player A"},{id:"b",file:"/avatars/avatar-b.png",label:"Player B"},{id:"c",file:"/avatars/avatar-c.png",label:"Player C"},{id:"d",file:"/avatars/avatar-d.png",label:"Player D"}];function kSe({id:t,variant:e}){const r=bSe.find(i=>i.id===t);if(!r)return g.jsx("div",{style:{color:"#fff",padding:40},children:"Avatar not found"});const n=(e||"").toLowerCase(),a=n==="win"?"win":n==="lose"?"lose":n==="push"?"push":"";return g.jsxs("div",{className:"avatar-shot"+(a?` variant-${a}`:""),children:[g.jsxs("div",{className:"avatar-shot__frame",children:[g.jsx("img",{src:r.file,alt:r.label,className:"avatar-shot__img"}),a&&g.jsx("div",{className:"avatar-shot__fx fx-"+a})]}),g.jsx("div",{className:"avatar-shot__label",children:r.label})]})}function wSe(t,e){const r=/^\/capture\/avatar\/([a-z])$/i.exec(t);if(!r)return null;const a=new URLSearchParams(e).get("variant")||void 0;return{id:r[1].toLowerCase(),variant:a}}const SSe=[{id:"a",name:"Banker",avatar:"/avatars/avatar-a.png"},{id:"b",name:"Challenger 1",avatar:"/avatars/avatar-b.png"},{id:"c",name:"Challenger 2",avatar:"/avatars/avatar-c.png"},{id:"d",name:"Challenger 3",avatar:"/avatars/avatar-d.png"}],u$={"pre-roll":{dice:[1,2,3],banker:"a",showRoll:!0,results:{a:"idle",b:"idle",c:"idle",d:"idle"},point:null},rolling:{dice:[0,0,0],banker:"a",rolling:!0,showRoll:!1,results:{a:"idle",b:"idle",c:"idle",d:"idle"},point:null},"banker-456":{dice:[4,5,6],banker:"a",shake:!0,showRoll:!1,results:{a:"win",b:"lose",c:"lose",d:"lose"},point:null,chipDeltas:{a:"+1500",b:"-500",c:"-500",d:"-500"}},"banker-point":{dice:[2,2,6],banker:"a",point:6,showRoll:!1,results:{a:"idle",b:"idle",c:"idle",d:"idle"}},"challenger-win":{dice:[3,3,5],banker:"a",point:5,showRoll:!1,results:{a:"lose",b:"win",c:"idle",d:"idle"},chipDeltas:{a:"-500",b:"+500"}},push:{dice:[5,5,2],banker:"a",point:2,showRoll:!1,results:{a:"push",b:"push",c:"idle",d:"idle"}},payout:{dice:[4,4,1],banker:"a",point:1,showRoll:!1,results:{a:"lose",b:"win",c:"win",d:"idle"},chipDeltas:{a:"-1000",b:"+500",c:"+500"}},"end-round":{dice:[6,6,3],banker:"a",point:null,showRoll:!1,roundSummary:"Round Over — New Banker",results:{a:"lose",b:"win",c:"idle",d:"idle"}}};function ESe(t){const e=/^\/capture\/cee-lo\/([a-z0-9-]+)$/i.exec(t);if(!e)return null;const r=e[1];return u$[r]?{scene:r}:null}function TSe({scene:t}){const e=u$[t];return e?g.jsx("div",{className:"cl-scene"+(e.shake?" fx-bg-shake":""),"data-scene":t,children:g.jsxs("div",{className:"cl-table",children:[g.jsx(CSe,{banker:e.banker,results:e.results,chipDeltas:e.chipDeltas}),g.jsx(xSe,{dice:e.dice,rolling:e.rolling}),e.point!=null&&e.point!==void 0&&g.jsx(ASe,{point:e.point}),e.showRoll&&g.jsx(RSe,{}),e.roundSummary&&g.jsx(DSe,{text:e.roundSummary})]})}):g.jsx("div",{style:{color:"#fff"},children:"Scene not found"})}function CSe({banker:t,results:e,chipDeltas:r}){return g.jsx("div",{className:"cl-seats",children:SSe.map(n=>{const a=e?.[n.id]||"idle";return g.jsxs("div",{className:"cl-seat"+(n.id===t?" is-banker":"")+(a!=="idle"?` res-${a}`:""),children:[g.jsxs("div",{className:"cl-seat__avatar",children:[g.jsx("img",{src:n.avatar,alt:n.name}),a!=="idle"&&g.jsx("div",{className:"cl-seat__fx fx-"+a})]}),g.jsx("div",{className:"cl-seat__name",children:n.name}),r?.[n.id]&&g.jsx("div",{className:"cl-seat__delta",children:r[n.id]})]},n.id)})})}function xSe({dice:t,rolling:e}){return g.jsx("div",{className:"cl-dice","aria-label":"dice",children:t.map((r,n)=>g.jsx(PSe,{value:r,rolling:e},n))})}function PSe({value:t,rolling:e}){const r=t===0?"?":String(t);return g.jsx("div",{className:"cl-die"+(e?" is-rolling":""),children:r})}function ASe({point:t}){return g.jsxs("div",{className:"cl-point",children:["POINT: ",t]})}function RSe(){return g.jsx("div",{className:"cl-roll-btn",children:"ROLL"})}function DSe({text:t}){return g.jsx("div",{className:"cl-summary",children:t})}async function OSe(){try{const t=window.location.protocol;if(!(t==="capacitor:"||t==="ionic:"))return;let r=null;try{r=window.Capacitor?.Plugins?.Keyboard||null}catch{}try{const i=window.visualViewport,o=f=>{try{document.documentElement.classList.toggle("kb-open",!!f),document.body.classList.toggle("kb-open",!!f)}catch{}};let c=i?.height??window.innerHeight;const u=()=>{try{c=i?.height??window.innerHeight}catch{}},d=()=>{try{const f=i?.height??window.innerHeight,h=Math.max(0,c-f);o(h>60)}catch{}};i?(i.addEventListener("resize",d),i.addEventListener("scroll",d)):(window.addEventListener("resize",d),window.addEventListener("orientationchange",()=>{u(),d()})),window.addEventListener("focusin",f=>{const h=f?.target;!!h&&(h.tagName==="INPUT"||h.tagName==="TEXTAREA"||h.isContentEditable)&&o(!0)}),window.addEventListener("focusout",()=>{window.setTimeout(d,120)}),window.setTimeout(()=>{u(),d()},50)}catch{}if(r)try{await r.setResizeMode({mode:"none"})}catch{}const n=()=>{try{document.documentElement.classList.add("kb-open"),document.body.classList.add("kb-open")}catch{}},a=()=>{try{document.documentElement.classList.remove("kb-open"),document.body.classList.remove("kb-open")}catch{}};try{r?.addListener?.("keyboardWillShow",n)}catch{}try{r?.addListener?.("keyboardDidShow",n)}catch{}try{r?.addListener?.("keyboardWillHide",a)}catch{}try{r?.addListener?.("keyboardDidHide",a)}catch{}}catch{}}try{window.addEventListener("error",t=>{}),window.addEventListener("unhandledrejection",t=>{})}catch{}document.addEventListener("click",t=>{const e=t.target;if(!e)return;const r=e.closest('button, a, [role="button"], .felt-btn, .gold-link');if(r&&!r.closest("[data-no-global-haptic]")&&!(r.tagName==="BUTTON"&&r.disabled)&&r.getAttribute("aria-disabled")!=="true")try{cr("Light")}catch{}},{passive:!0});try{QH()}catch{}try{const t=window,e=t.location.protocol==="capacitor:"||t.location.protocol==="ionic:",r=/^(localhost|127\.0\.0\.1)$/.test(t.location.hostname),n=document.querySelector("script[data-adsbygoogle]");if(!e&&!r&&!n){const a=document.createElement("script");a.async=!0,a.src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4219446894372985",a.crossOrigin="anonymous",a.setAttribute("data-adsbygoogle","1"),a.onload=()=>{const i=window.adsbygoogle||[];try{i.push({})}catch{}},document.head.appendChild(a)}}catch{}try{const t="sess:initialized";Ks.get(t).then(e=>{if(!e)return Ks.clearSessionKeys().then(()=>Ks.set(t,"1"))}).catch(()=>{})}catch{}function NSe(){window.__APP_MOUNTED__=!0,v.useEffect(()=>{try{const e=window.Capacitor?.getPlatform?.();(e==="ios"||e==="android")&&T3().catch(()=>{})}catch{}},[]);try{const e=window.Capacitor?.getPlatform?.();(e==="ios"||e==="android")&&Promise.resolve().then(()=>{try{kf.notifyAppReady()}catch{}})}catch{}return g.jsx(ySe,{})}function iT(){try{const t=wSe(window.location.pathname,window.location.search);if(t){document.body.classList.add("ad-capture"),Aw.createRoot(document.getElementById("root")).render(g.jsx(v.StrictMode,{children:g.jsx(kSe,{id:t.id,variant:t.variant})}));return}const e=ESe(window.location.pathname);if(e){document.body.classList.add("ad-capture"),Aw.createRoot(document.getElementById("root")).render(g.jsx(v.StrictMode,{children:g.jsx(TSe,{scene:e.scene})}));return}}catch{}Aw.createRoot(document.getElementById("root")).render(g.jsx(v.StrictMode,{children:g.jsx(l$,{children:g.jsx(_Se,{config:{debug:!1},children:g.jsx(NSe,{})})})}))}function ISe(){try{(()=>{try{const r=window.Capacitor?.getPlatform?.();return r==="ios"||r==="android"?!0:/^(capacitor:|ionic:)/i.test(window.location?.protocol||"")}catch{return!1}})()?(async()=>{try{await cs.init()}catch{}iT();try{await OSe()}catch{}try{cs.healthCheck().catch(()=>{})}catch{}})():iT()}catch{iT()}}window.APP_TARGET||ISe();export{oo as B,nbe as D,zSe as F,um as I,k_ as M,lN as N,Tt as R,og as T,na as U,v3 as W,qr as _,ox as a,v as b,BSe as c,Jo as d,y0 as e,gu as f,Sg as g,jSe as h,MSe as i,g as j,Hke as k,au as l,FL as m,ro as r,Ox as s,$Se as t,$r as u,Bke as w};
