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-D4C30s2K.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 LSe=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 BSe(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:{}},tr={};/**
 * @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 tr;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 _(F){return F===null||typeof F!="object"?null:(F=m&&F[m]||F["@@iterator"],typeof F=="function"?F:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,E={};function T(F,K,ne){this.props=F,this.context=K,this.refs=E,this.updater=ne||w}T.prototype.isReactComponent={},T.prototype.setState=function(F,K){if(typeof F!="object"&&typeof F!="function"&&F!=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,F,K,"setState")},T.prototype.forceUpdate=function(F){this.updater.enqueueForceUpdate(this,F,"forceUpdate")};function D(){}D.prototype=T.prototype;function P(F,K,ne){this.props=F,this.context=K,this.refs=E,this.updater=ne||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(F,K,ne){var ee=ne.ref;return{$$typeof:t,type:F,key:K,ref:ee!==void 0?ee:null,props:ne}}function N(F,K){return R(F.type,K,F.props)}function L(F){return typeof F=="object"&&F!==null&&F.$$typeof===t}function j(F){var K={"=":"=0",":":"=2"};return"$"+F.replace(/[=:]/g,function(ne){return K[ne]})}var z=/\/+/g;function U(F,K){return typeof F=="object"&&F!==null&&F.key!=null?j(""+F.key):K.toString(36)}function W(F){switch(F.status){case"fulfilled":return F.value;case"rejected":throw F.reason;default:switch(typeof F.status=="string"?F.then(O,O):(F.status="pending",F.then(function(K){F.status==="pending"&&(F.status="fulfilled",F.value=K)},function(K){F.status==="pending"&&(F.status="rejected",F.reason=K)})),F.status){case"fulfilled":return F.value;case"rejected":throw F.reason}}throw F}function q(F,K,ne,ee,he){var ce=typeof F;(ce==="undefined"||ce==="boolean")&&(F=null);var Pe=!1;if(F===null)Pe=!0;else switch(ce){case"bigint":case"string":case"number":Pe=!0;break;case"object":switch(F.$$typeof){case t:case e:Pe=!0;break;case f:return Pe=F._init,q(Pe(F._payload),K,ne,ee,he)}}if(Pe)return he=he(F),Pe=ee===""?"."+U(F,0):ee,C(he)?(ne="",Pe!=null&&(ne=Pe.replace(z,"$&/")+"/"),q(he,K,ne,"",function(Ce){return Ce})):he!=null&&(L(he)&&(he=N(he,ne+(he.key==null||F&&F.key===he.key?"":(""+he.key).replace(z,"$&/")+"/")+Pe)),K.push(he)),1;Pe=0;var Ge=ee===""?".":ee+":";if(C(F))for(var se=0;se<F.length;se++)ee=F[se],ce=Ge+U(ee,se),Pe+=q(ee,K,ne,ce,he);else if(se=_(F),typeof se=="function")for(F=se.call(F),se=0;!(ee=F.next()).done;)ee=ee.value,ce=Ge+U(ee,se++),Pe+=q(ee,K,ne,ce,he);else if(ce==="object"){if(typeof F.then=="function")return q(W(F),K,ne,ee,he);throw K=String(F),Error("Objects are not valid as a React child (found: "+(K==="[object Object]"?"object with keys {"+Object.keys(F).join(", ")+"}":K)+"). If you meant to render a collection of children, use an array instead.")}return Pe}function Y(F,K,ne){if(F==null)return F;var ee=[],he=0;return q(F,ee,"","",function(ce){return K.call(ne,ce,he++)}),ee}function Z(F){if(F._status===-1){var K=F._result;K=K(),K.then(function(ne){(F._status===0||F._status===-1)&&(F._status=1,F._result=ne)},function(ne){(F._status===0||F._status===-1)&&(F._status=2,F._result=ne)}),F._status===-1&&(F._status=0,F._result=K)}if(F._status===1)return F._result.default;throw F._result}var ae=typeof reportError=="function"?reportError:function(F){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var K=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof F=="object"&&F!==null&&typeof F.message=="string"?String(F.message):String(F),error:F});if(!window.dispatchEvent(K))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",F);return}},G={map:Y,forEach:function(F,K,ne){Y(F,function(){K.apply(this,arguments)},ne)},count:function(F){var K=0;return Y(F,function(){K++}),K},toArray:function(F){return Y(F,function(K){return K})||[]},only:function(F){if(!L(F))throw Error("React.Children.only expected to receive a single React element child.");return F}};return tr.Activity=h,tr.Children=G,tr.Component=T,tr.Fragment=r,tr.Profiler=a,tr.PureComponent=P,tr.StrictMode=n,tr.Suspense=u,tr.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=I,tr.__COMPILER_RUNTIME={__proto__:null,c:function(F){return I.H.useMemoCache(F)}},tr.cache=function(F){return function(){return F.apply(null,arguments)}},tr.cacheSignal=function(){return null},tr.cloneElement=function(F,K,ne){if(F==null)throw Error("The argument must be a React element, but you passed "+F+".");var ee=b({},F.props),he=F.key;if(K!=null)for(ce in K.key!==void 0&&(he=""+K.key),K)!x.call(K,ce)||ce==="key"||ce==="__self"||ce==="__source"||ce==="ref"&&K.ref===void 0||(ee[ce]=K[ce]);var ce=arguments.length-2;if(ce===1)ee.children=ne;else if(1<ce){for(var Pe=Array(ce),Ge=0;Ge<ce;Ge++)Pe[Ge]=arguments[Ge+2];ee.children=Pe}return R(F.type,he,ee)},tr.createContext=function(F){return F={$$typeof:o,_currentValue:F,_currentValue2:F,_threadCount:0,Provider:null,Consumer:null},F.Provider=F,F.Consumer={$$typeof:i,_context:F},F},tr.createElement=function(F,K,ne){var ee,he={},ce=null;if(K!=null)for(ee in K.key!==void 0&&(ce=""+K.key),K)x.call(K,ee)&&ee!=="key"&&ee!=="__self"&&ee!=="__source"&&(he[ee]=K[ee]);var Pe=arguments.length-2;if(Pe===1)he.children=ne;else if(1<Pe){for(var Ge=Array(Pe),se=0;se<Pe;se++)Ge[se]=arguments[se+2];he.children=Ge}if(F&&F.defaultProps)for(ee in Pe=F.defaultProps,Pe)he[ee]===void 0&&(he[ee]=Pe[ee]);return R(F,ce,he)},tr.createRef=function(){return{current:null}},tr.forwardRef=function(F){return{$$typeof:c,render:F}},tr.isValidElement=L,tr.lazy=function(F){return{$$typeof:f,_payload:{_status:-1,_result:F},_init:Z}},tr.memo=function(F,K){return{$$typeof:d,type:F,compare:K===void 0?null:K}},tr.startTransition=function(F){var K=I.T,ne={};I.T=ne;try{var ee=F(),he=I.S;he!==null&&he(ne,ee),typeof ee=="object"&&ee!==null&&typeof ee.then=="function"&&ee.then(O,ae)}catch(ce){ae(ce)}finally{K!==null&&ne.types!==null&&(K.types=ne.types),I.T=K}},tr.unstable_useCacheRefresh=function(){return I.H.useCacheRefresh()},tr.use=function(F){return I.H.use(F)},tr.useActionState=function(F,K,ne){return I.H.useActionState(F,K,ne)},tr.useCallback=function(F,K){return I.H.useCallback(F,K)},tr.useContext=function(F){return I.H.useContext(F)},tr.useDebugValue=function(){},tr.useDeferredValue=function(F,K){return I.H.useDeferredValue(F,K)},tr.useEffect=function(F,K){return I.H.useEffect(F,K)},tr.useEffectEvent=function(F){return I.H.useEffectEvent(F)},tr.useId=function(){return I.H.useId()},tr.useImperativeHandle=function(F,K,ne){return I.H.useImperativeHandle(F,K,ne)},tr.useInsertionEffect=function(F,K){return I.H.useInsertionEffect(F,K)},tr.useLayoutEffect=function(F,K){return I.H.useLayoutEffect(F,K)},tr.useMemo=function(F,K){return I.H.useMemo(F,K)},tr.useOptimistic=function(F,K){return I.H.useOptimistic(F,K)},tr.useReducer=function(F,K,ne){return I.H.useReducer(F,K,ne)},tr.useRef=function(F){return I.H.useRef(F)},tr.useState=function(F){return I.H.useState(F)},tr.useSyncExternalStore=function(F,K,ne){return I.H.useSyncExternalStore(F,K,ne)},tr.useTransition=function(){return I.H.useTransition()},tr.version="19.2.0",tr}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(q,Y){var Z=q.length;q.push(Y);e:for(;0<Z;){var ae=Z-1>>>1,G=q[ae];if(0<a(G,Y))q[ae]=Y,q[Z]=G,Z=ae;else break e}}function r(q){return q.length===0?null:q[0]}function n(q){if(q.length===0)return null;var Y=q[0],Z=q.pop();if(Z!==Y){q[0]=Z;e:for(var ae=0,G=q.length,F=G>>>1;ae<F;){var K=2*(ae+1)-1,ne=q[K],ee=K+1,he=q[ee];if(0>a(ne,Z))ee<G&&0>a(he,ne)?(q[ae]=he,q[ee]=Z,ae=ee):(q[ae]=ne,q[K]=Z,ae=K);else if(ee<G&&0>a(he,Z))q[ae]=he,q[ee]=Z,ae=ee;else break e}}return Y}function a(q,Y){var Z=q.sortIndex-Y.sortIndex;return Z!==0?Z:q.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(q){for(var Y=r(d);Y!==null;){if(Y.callback===null)n(d);else if(Y.startTime<=q)n(d),Y.sortIndex=Y.expirationTime,e(u,Y);else break;Y=r(d)}}function C(q){if(b=!1,A(q),!w)if(r(u)!==null)w=!0,O||(O=!0,j());else{var Y=r(d);Y!==null&&W(C,Y.startTime-q)}}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 q=t.unstable_now();R=q;var Y=!0;try{e:{w=!1,b&&(b=!1,D(I),I=-1),_=!0;var Z=m;try{t:{for(A(q),h=r(u);h!==null&&!(h.expirationTime>q&&N());){var ae=h.callback;if(typeof ae=="function"){h.callback=null,m=h.priorityLevel;var G=ae(h.expirationTime<=q);if(q=t.unstable_now(),typeof G=="function"){h.callback=G,A(q),Y=!0;break t}h===r(u)&&n(u),A(q)}else n(u);h=r(u)}if(h!==null)Y=!0;else{var F=r(d);F!==null&&W(C,F.startTime-q),Y=!1}}break e}finally{h=null,m=Z,_=!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 z=new MessageChannel,U=z.port2;z.port1.onmessage=L,j=function(){U.postMessage(null)}}else j=function(){T(L,0)};function W(q,Y){I=T(function(){q(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(q){q.callback=null},t.unstable_forceFrameRate=function(q){0>q||125<q||(x=0<q?Math.floor(1e3/q):5)},t.unstable_getCurrentPriorityLevel=function(){return m},t.unstable_next=function(q){switch(m){case 1:case 2:case 3:var Y=3;break;default:Y=m}var Z=m;m=Y;try{return q()}finally{m=Z}},t.unstable_requestPaint=function(){E=!0},t.unstable_runWithPriority=function(q,Y){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var Z=m;m=q;try{return Y()}finally{m=Z}},t.unstable_scheduleCallback=function(q,Y,Z){var ae=t.unstable_now();switch(typeof Z=="object"&&Z!==null?(Z=Z.delay,Z=typeof Z=="number"&&0<Z?ae+Z:ae):Z=ae,q){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=Z+G,q={id:f++,callback:Y,priorityLevel:q,startTime:Z,expirationTime:G,sortIndex:-1},Z>ae?(q.sortIndex=Z,e(d,q),r(u)===null&&q===r(d)&&(b?(D(I),I=-1):b=!0,W(C,Z-ae))):(q.sortIndex=G,e(u,q),w||_||(w=!0,O||(O=!0,j()))),q},t.unstable_shouldYield=N,t.unstable_wrapCallback=function(q){var Y=m;return function(){var Z=m;m=Y;try{return q.apply(this,arguments)}finally{m=Z}}}})(xw)),xw}var ND;function tV(){return ND||(ND=1,Cw.exports=eV()),Cw.exports}var Pw={exports:{}},Ia={};/**
 * @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 Ia;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 Ia.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,Ia.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)},Ia.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()}},Ia.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))},Ia.prefetchDNS=function(u){typeof u=="string"&&n.d.D(u)},Ia.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})}},Ia.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)},Ia.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})}},Ia.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)},Ia.requestFormReset=function(u){n.d.r(u)},Ia.unstable_batchedUpdates=function(u,d){return u(d)},Ia.useFormState=function(u,d,f){return o.H.useFormState(u,d,f)},Ia.useFormStatus=function(){return o.H.useHostTransitionStatus()},Ia.version="19.2.0",Ia}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 z=Symbol.for("react.client.reference");function U(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===z?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,q=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,Z={pending:!1,data:null,method:null,action:null},ae=[],G=-1;function F(s){return{current:s}}function K(s){0>G||(s.current=ae[G],ae[G]=null,G--)}function ne(s,l){G++,ae[G]=s.current,s.current=l}var ee=F(null),he=F(null),ce=F(null),Pe=F(null);function Ge(s,l){switch(ne(ce,l),ne(he,s),ne(ee,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(ee),ne(ee,s)}function se(){K(ee),K(he),K(ce)}function Ce(s){s.memoizedState!==null&&ne(Pe,s);var l=ee.current,p=Q2(l,s.type);l!==p&&(ne(he,s),ne(ee,p))}function te(s){he.current===s&&(K(ee),K(he)),Pe.current===s&&(K(Pe),vh._currentValue=Z)}var H,pe;function Re(s){if(H===void 0)try{throw Error()}catch(p){var l=p.stack.trim().match(/\n( *(at )?)/);H=l&&l[1]||"",pe=-1<p.stack.indexOf(`
    at`)?" (<anonymous>)":-1<p.stack.indexOf("@")?"@unknown:0:0":""}return`
`+H+s+pe}var de=!1;function Ie(s,l){if(!s||de)return"";de=!0;var p=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var y={DetermineComponentFrameRoot:function(){try{if(l){var We=function(){throw Error()};if(Object.defineProperty(We.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(We,[])}catch(Oe){var xe=Oe}Reflect.construct(s,[],We)}else{try{We.call()}catch(Oe){xe=Oe}s.call(We.prototype)}}else{try{throw Error()}catch(Oe){xe=Oe}(We=s())&&typeof We.catch=="function"&&We.catch(function(){})}}catch(Oe){if(Oe&&xe&&typeof Oe.stack=="string")return[Oe.stack,xe.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 ie=M.split(`
`),Ee=V.split(`
`);for(k=y=0;y<ie.length&&!ie[y].includes("DetermineComponentFrameRoot");)y++;for(;k<Ee.length&&!Ee[k].includes("DetermineComponentFrameRoot");)k++;if(y===ie.length||k===Ee.length)for(y=ie.length-1,k=Ee.length-1;1<=y&&0<=k&&ie[y]!==Ee[k];)k--;for(;1<=y&&0<=k;y--,k--)if(ie[y]!==Ee[k]){if(y!==1||k!==1)do if(y--,k--,0>k||ie[y]!==Ee[k]){var Ue=`
`+ie[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{de=!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 Ve(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,Ke=t.unstable_scheduleCallback,it=t.unstable_cancelCallback,Et=t.unstable_shouldYield,It=t.unstable_requestPaint,bt=t.unstable_now,me=t.unstable_getCurrentPriorityLevel,Be=t.unstable_ImmediatePriority,je=t.unstable_UserBlockingPriority,nt=t.unstable_NormalPriority,Ct=t.unstable_LowPriority,Mt=t.unstable_IdlePriority,De=t.log,et=t.unstable_setDisableYieldValue,at=null,ke=null;function st(s){if(typeof De=="function"&&et(s),ke&&typeof ke.setStrictMode=="function")try{ke.setStrictMode(at,s)}catch{}}var kt=Math.clz32?Math.clz32:ur,nr=Math.log,lr=Math.LN2;function ur(s){return s>>>=0,s===0?32:31-(nr(s)/lr|0)|0}var Er=256,dn=262144,J=4194304;function ue(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 ve(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=ue(y):(M&=V,M!==0?k=ue(M):p||(p=V&~s,p!==0&&(k=ue(p))))):(V=y&~S,V!==0?k=ue(V):M!==0?k=ue(M):p||(p=y&~s,p!==0&&(k=ue(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 Ae(s,l){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&l)===0}function B(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 Q(){var s=J;return J<<=1,(J&62914560)===0&&(J=4194304),s}function oe(s){for(var l=[],p=0;31>p;p++)l.push(s);return l}function Ne(s,l){s.pendingLanes|=l,l!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function pt(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,ie=s.expirationTimes,Ee=s.hiddenUpdates;for(p=M&~p;0<p;){var Ue=31-kt(p),We=1<<Ue;V[Ue]=0,ie[Ue]=-1;var xe=Ee[Ue];if(xe!==null)for(Ee[Ue]=null,Ue=0;Ue<xe.length;Ue++){var Oe=xe[Ue];Oe!==null&&(Oe.lane&=-536870913)}p&=~We}y!==0&&Rt(s,y,0),S!==0&&k===0&&s.tag!==0&&(s.suspendedLanes|=S&~(M&~l))}function Rt(s,l,p){s.pendingLanes|=l,s.suspendedLanes&=~l;var y=31-kt(l);s.entangledLanes|=l,s.entanglements[y]=s.entanglements[y]|1073741824|p&261930}function Ut(s,l){var p=s.entangledLanes|=l;for(s=s.entanglements;p;){var y=31-kt(p),k=1<<y;k&l|s[y]&l&&(s[y]|=l),p&=~k}}function dr(s,l){var p=l&-l;return p=(p&42)!==0?1:hn(p),(p&(s.suspendedLanes|l))!==0?0:p}function hn(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 rn(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function Fe(){var s=Y.p;return s!==0?s:(s=window.event,s===void 0?32:kD(s.type))}function Zt(s,l){var p=Y.p;try{return Y.p=s,l()}finally{Y.p=p}}var Ft=Math.random().toString(36).slice(2),qt="__reactFiber$"+Ft,xt="__reactProps$"+Ft,fn="__reactContainer$"+Ft,bn="__reactEvents$"+Ft,Fn="__reactListeners$"+Ft,la="__reactHandles$"+Ft,Zn="__reactResources$"+Ft,mr="__reactMarker$"+Ft;function rc(s){delete s[qt],delete s[xt],delete s[bn],delete s[Fn],delete s[la]}function $i(s){var l=s[qt];if(l)return l;for(var p=s.parentNode;p;){if(l=p[fn]||p[qt]){if(p=l.alternate,l.child!==null||p!==null&&p.child!==null)for(s=iD(s);s!==null;){if(p=s[qt])return p;s=iD(s)}return l}s=p,p=s.parentNode}return null}function Cs(s){if(s=s[qt]||s[fn]){var l=s.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return s}return null}function bi(s){var l=s.tag;if(l===5||l===26||l===27||l===6)return s.stateNode;throw Error(n(33))}function ea(s){var l=s[Zn];return l||(l=s[Zn]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function mn(s){s[mr]=!0}var xs=new Set,Ps={};function As(s,l){Vi(s,l),Vi(s+"Capture",l)}function Vi(s,l){for(Ps[s]=l,s=0;s<l.length;s++)xs.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 nc(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 uo(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 ya(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 va(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function Ua(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=Ua(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=Ua(s)?s.checked?"true":"false":s.value),s=y,s!==p?(l.setValue(s),!0):!1}function fo(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 ua(s){return s.replace(Sd,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function po(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=""+va(l)):s.value!==""+va(l)&&(s.value=""+va(l)):M!=="submit"&&M!=="reset"||s.removeAttribute("value"),l!=null?Jc(s,M,va(l)):p!=null?Jc(s,M,va(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=""+va(V):s.removeAttribute("name")}function ki(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?""+va(p):"",l=l!=null?""+va(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"&&fo(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=""+va(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=""+va(l),l!==s.value&&(s.value=l),p==null)){s.defaultValue!==l&&(s.defaultValue=l);return}s.defaultValue=p!=null?""+va(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=va(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 Ot=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 Ht(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||Ot.has(l)?l==="float"?s.cssFloat=p:s[l]=(""+p).trim():s[l]=p+"px"}function Nr(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&&Ht(s,k,y)}else for(var S in l)l.hasOwnProperty(S)&&Ht(s,S,l[S])}function nn(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 xn=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"]]),da=/^[\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 Rs(s){return da.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function _a(){}var Qc=null;function Ds(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var wi=null,Si=null;function Hi(s){var l=Cs(s);if(l&&(s=l.stateNode)){var p=s[xt]||null;e:switch(s=l.stateNode,l.type){case"input":if(po(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="'+ua(""+l)+'"][type="radio"]'),l=0;l<p.length;l++){var y=p[l];if(y!==s&&y.form===s.form){var k=y[xt]||null;if(!k)throw Error(n(90));po(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 ho=!1;function Br(s,l,p){if(ho)return s(l,p);ho=!0;try{var y=s(l);return y}finally{if(ho=!1,(wi!==null||Si!==null)&&(Ny(),wi&&(l=wi,s=Si,Si=wi=null,Hi(l),s)))for(l=0;l<s.length;l++)Hi(s[l])}}function ta(s,l){var p=s.stateNode;if(p===null)return null;var y=p[xt]||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 ra=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Fa=!1;if(ra)try{var Oa={};Object.defineProperty(Oa,"passive",{get:function(){Fa=!0}}),window.addEventListener("test",Oa,Oa),window.removeEventListener("test",Oa,Oa)}catch{Fa=!1}var na=null,qn=null,Gi=null;function ac(){if(Gi)return Gi;var s,l=qn,p=l.length,y,k="value"in na?na.value:na.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 Gi=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 Na(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 ic={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},sc=Na(ic),Zc=h({},ic,{view:0,detail:0}),x0=Na(Zc),el,X,fe,ge=h({},Zc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:qa,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!==fe&&(fe&&s.type==="mousemove"?(el=s.screenX-fe.screenX,X=s.screenY-fe.screenY):X=el=0,fe=s),el)},movementY:function(s){return"movementY"in s?s.movementY:X}}),Me=Na(ge),we=h({},ge,{dataTransfer:0}),He=Na(we),Qe=h({},Zc,{relatedTarget:0}),yt=Na(Qe),Tr=h({},ic,{animationName:0,elapsedTime:0,pseudoElement:0}),an=Na(Tr),fr=h({},ic,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),sn=Na(fr),Os=h({},ic,{data:0}),oc=Na(Os),_u={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Wi={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 qa(){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"?Wi[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:qa,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=Na(tl),P0=h({},ge,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),r1=Na(P0),d$=h({},Zc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:qa}),f$=Na(d$),p$=h({},ic,{propertyName:0,elapsedTime:0,pseudoElement:0}),h$=Na(p$),m$=h({},ge,{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$=Na(m$),y$=h({},ic,{newState:0,oldState:0}),v$=Na(y$),_$=[9,13,27,32],A0=ra&&"CompositionEvent"in window,Up=null;ra&&"documentMode"in document&&(Up=document.documentMode);var b$=ra&&"TextEvent"in window&&!Up,n1=ra&&(!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=ac(),Gi=qn=na=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){wi?Si?Si.push(y):Si=[y]:wi=y,l=Fy(l,"onChange"),0<l.length&&(p=new sc("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=bi(s);if(Xc(l))return s}function u1(s,l){if(s==="change")return l}var d1=!1;if(ra){var R0;if(ra){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,Ds(s)),Br(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 Ei=typeof Object.is=="function"?Object.is:A$;function zp(s,l){if(Ei(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)||!Ei(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=fo(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=fo(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$=ra&&"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!==fo(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 sc("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={};ra&&(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 Ns(s,l){T1.set(s,l),As(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}},Ki=[],Rd=0,L0=0;function ey(){for(var s=Rd,l=L0=Rd=0;l<s;){var p=Ki[l];Ki[l++]=null;var y=Ki[l];Ki[l++]=null;var k=Ki[l];Ki[l++]=null;var S=Ki[l];if(Ki[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){Ki[Rd++]=s,Ki[Rd++]=l,Ki[Rd++]=p,Ki[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-kt(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 Ti(s,l,p,y){return new I$(s,l,p,y)}function U0(s){return s=s.prototype,!(!s||!s.isReactComponent)}function cc(s,l){var p=s.alternate;return p===null?(p=Ti(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,ee.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case R:return s=Ti(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=Ti(12,p,l,k|2),s.elementType=T,s.lanes=S,s;case C:return s=Ti(13,p,l,k),s.elementType=C,s.lanes=S,s;case O:return s=Ti(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=Ti(M,p,l,k),l.elementType=s,l.type=y,l.lanes=S,l}function Su(s,l,p,y){return s=Ti(7,s,y,l),s.lanes=p,s}function F0(s,l,p){return s=Ti(6,s,null,l),s.lanes=p,s}function P1(s){var l=Ti(18,null,null,0);return l.stateNode=s,l}function q0(s,l,p){return l=Ti(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 Yi(s,l){if(typeof s=="object"&&s!==null){var p=A1.get(s);return p!==void 0?p:(l={value:s,source:l,stack:Ve(l)},A1.set(s,l),l)}return{value:s,source:l,stack:Ve(l)}}var Od=[],Nd=0,ay=null,Vp=0,Xi=[],Ji=0,rl=null,mo=1,go="";function lc(s,l){Od[Nd++]=Vp,Od[Nd++]=ay,ay=s,Vp=l}function R1(s,l,p){Xi[Ji++]=mo,Xi[Ji++]=go,Xi[Ji++]=rl,rl=s;var y=mo;s=go;var k=32-kt(y)-1;y&=~(1<<k),p+=1;var S=32-kt(l)+k;if(30<S){var M=k-k%5;S=(y&(1<<M)-1).toString(32),y>>=M,k-=M,mo=1<<32-kt(l)+k|p<<k|y,go=S+s}else mo=1<<S|p<<k|y,go=s}function z0(s){s.return!==null&&(lc(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=Xi[--Ji],Xi[Ji]=null,go=Xi[--Ji],Xi[Ji]=null,mo=Xi[--Ji],Xi[Ji]=null}function D1(s,l){Xi[Ji++]=mo,Xi[Ji++]=go,Xi[Ji++]=rl,mo=l.id,go=l.overflow,rl=s}var ba=null,gn=null,Cr=!1,nl=null,Qi=!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(Yi(l,s)),V0}function O1(s){var l=s.stateNode,p=s.type,y=s.memoizedProps;switch(l[qt]=s,l[xt]=y,p){case"dialog":vr("cancel",l),vr("close",l);break;case"iframe":case"object":case"embed":vr("load",l);break;case"video":case"audio":for(p=0;p<ph.length;p++)vr(ph[p],l);break;case"source":vr("error",l);break;case"img":case"image":case"link":vr("error",l),vr("load",l);break;case"details":vr("toggle",l);break;case"input":vr("invalid",l),ki(l,y.value,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name,!0);break;case"select":vr("invalid",l);break;case"textarea":vr("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&&(vr("beforetoggle",l),vr("toggle",l)),y.onScroll!=null&&vr("scroll",l),y.onScrollEnd!=null&&vr("scrollend",l),y.onClick!=null&&(l.onclick=_a),l=!0):l=!1,l||al(s,!0)}function N1(s){for(ba=s.return;ba;)switch(ba.tag){case 5:case 31:case 13:Qi=!1;return;case 27:case 3:Qi=!0;return;default:ba=ba.return}}function Id(s){if(s!==ba)return!1;if(!Cr)return N1(s),Cr=!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&&gn&&al(s),N1(s),l===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(317));gn=aD(s)}else if(l===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(317));gn=aD(s)}else l===27?(l=gn,vl(s.type)?(s=pw,pw=null,gn=s):gn=l):gn=ba?es(s.stateNode.nextSibling):null;return!0}function Eu(){gn=ba=null,Cr=!1}function H0(){var s=nl;return s!==null&&(ti===null?ti=s:ti.push.apply(ti,s),nl=null),s}function Hp(s){nl===null?nl=[s]:nl.push(s)}var G0=F(null),Tu=null,uc=null;function il(s,l,p){ne(G0,l._currentValue),l._currentValue=p}function dc(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 ie=0;ie<l.length;ie++)if(V.context===l[ie]){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;Ei(k.pendingProps.value,M.value)||(s!==null?s.push(V):s=[V])}}else if(k===Pe.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(!Ei(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function Cu(s){Tu=s,uc=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function ka(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},uc===null){if(s===null)throw Error(n(308));uc=l,s.dependencies={lanes:0,firstContext:l},s.flags|=524288}else uc=uc.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,zn={$$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=q.S;q.S=function(s,l){_2=bt(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&B$(s,l),j1!==null&&j1(s,l)};var xu=F(null);function J0(){var s=xu.current;return s!==null?s:on.pooledCache}function oy(s,l){l===null?ne(xu,xu.current):ne(xu,l.pool)}function L1(){var s=J0();return s===null?null:{parent:zn._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(_a,_a),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(_a,_a);else{if(s=on,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(ye,le){if(s){var Se=ye.deletions;Se===null?(ye.deletions=[le],ye.flags|=16):Se.push(le)}}function p(ye,le){if(!s)return null;for(;le!==null;)l(ye,le),le=le.sibling;return null}function y(ye){for(var le=new Map;ye!==null;)ye.key!==null?le.set(ye.key,ye):le.set(ye.index,ye),ye=ye.sibling;return le}function k(ye,le){return ye=cc(ye,le),ye.index=0,ye.sibling=null,ye}function S(ye,le,Se){return ye.index=Se,s?(Se=ye.alternate,Se!==null?(Se=Se.index,Se<le?(ye.flags|=67108866,le):Se):(ye.flags|=67108866,le)):(ye.flags|=1048576,le)}function M(ye){return s&&ye.alternate===null&&(ye.flags|=67108866),ye}function V(ye,le,Se,ze){return le===null||le.tag!==6?(le=F0(Se,ye.mode,ze),le.return=ye,le):(le=k(le,Se),le.return=ye,le)}function ie(ye,le,Se,ze){var zt=Se.type;return zt===b?Ue(ye,le,Se.props.children,ze,Se.key):le!==null&&(le.elementType===zt||typeof zt=="object"&&zt!==null&&zt.$$typeof===x&&Pu(zt)===le.type)?(le=k(le,Se.props),Yp(le,Se),le.return=ye,le):(le=ny(Se.type,Se.key,Se.props,null,ye.mode,ze),Yp(le,Se),le.return=ye,le)}function Ee(ye,le,Se,ze){return le===null||le.tag!==4||le.stateNode.containerInfo!==Se.containerInfo||le.stateNode.implementation!==Se.implementation?(le=q0(Se,ye.mode,ze),le.return=ye,le):(le=k(le,Se.children||[]),le.return=ye,le)}function Ue(ye,le,Se,ze,zt){return le===null||le.tag!==7?(le=Su(Se,ye.mode,ze,zt),le.return=ye,le):(le=k(le,Se),le.return=ye,le)}function We(ye,le,Se){if(typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint")return le=F0(""+le,ye.mode,Se),le.return=ye,le;if(typeof le=="object"&&le!==null){switch(le.$$typeof){case _:return Se=ny(le.type,le.key,le.props,null,ye.mode,Se),Yp(Se,le),Se.return=ye,Se;case w:return le=q0(le,ye.mode,Se),le.return=ye,le;case x:return le=Pu(le),We(ye,le,Se)}if(W(le)||j(le))return le=Su(le,ye.mode,Se,null),le.return=ye,le;if(typeof le.then=="function")return We(ye,uy(le),Se);if(le.$$typeof===P)return We(ye,sy(ye,le),Se);dy(ye,le)}return null}function xe(ye,le,Se,ze){var zt=le!==null?le.key:null;if(typeof Se=="string"&&Se!==""||typeof Se=="number"||typeof Se=="bigint")return zt!==null?null:V(ye,le,""+Se,ze);if(typeof Se=="object"&&Se!==null){switch(Se.$$typeof){case _:return Se.key===zt?ie(ye,le,Se,ze):null;case w:return Se.key===zt?Ee(ye,le,Se,ze):null;case x:return Se=Pu(Se),xe(ye,le,Se,ze)}if(W(Se)||j(Se))return zt!==null?null:Ue(ye,le,Se,ze,null);if(typeof Se.then=="function")return xe(ye,le,uy(Se),ze);if(Se.$$typeof===P)return xe(ye,le,sy(ye,Se),ze);dy(ye,Se)}return null}function Oe(ye,le,Se,ze,zt){if(typeof ze=="string"&&ze!==""||typeof ze=="number"||typeof ze=="bigint")return ye=ye.get(Se)||null,V(le,ye,""+ze,zt);if(typeof ze=="object"&&ze!==null){switch(ze.$$typeof){case _:return ye=ye.get(ze.key===null?Se:ze.key)||null,ie(le,ye,ze,zt);case w:return ye=ye.get(ze.key===null?Se:ze.key)||null,Ee(le,ye,ze,zt);case x:return ze=Pu(ze),Oe(ye,le,Se,ze,zt)}if(W(ze)||j(ze))return ye=ye.get(Se)||null,Ue(le,ye,ze,zt,null);if(typeof ze.then=="function")return Oe(ye,le,Se,uy(ze),zt);if(ze.$$typeof===P)return Oe(ye,le,Se,sy(le,ze),zt);dy(le,ze)}return null}function At(ye,le,Se,ze){for(var zt=null,Ir=null,jt=le,ir=le=0,wr=null;jt!==null&&ir<Se.length;ir++){jt.index>ir?(wr=jt,jt=null):wr=jt.sibling;var Mr=xe(ye,jt,Se[ir],ze);if(Mr===null){jt===null&&(jt=wr);break}s&&jt&&Mr.alternate===null&&l(ye,jt),le=S(Mr,le,ir),Ir===null?zt=Mr:Ir.sibling=Mr,Ir=Mr,jt=wr}if(ir===Se.length)return p(ye,jt),Cr&&lc(ye,ir),zt;if(jt===null){for(;ir<Se.length;ir++)jt=We(ye,Se[ir],ze),jt!==null&&(le=S(jt,le,ir),Ir===null?zt=jt:Ir.sibling=jt,Ir=jt);return Cr&&lc(ye,ir),zt}for(jt=y(jt);ir<Se.length;ir++)wr=Oe(jt,ye,ir,Se[ir],ze),wr!==null&&(s&&wr.alternate!==null&&jt.delete(wr.key===null?ir:wr.key),le=S(wr,le,ir),Ir===null?zt=wr:Ir.sibling=wr,Ir=wr);return s&&jt.forEach(function(Sl){return l(ye,Sl)}),Cr&&lc(ye,ir),zt}function Wt(ye,le,Se,ze){if(Se==null)throw Error(n(151));for(var zt=null,Ir=null,jt=le,ir=le=0,wr=null,Mr=Se.next();jt!==null&&!Mr.done;ir++,Mr=Se.next()){jt.index>ir?(wr=jt,jt=null):wr=jt.sibling;var Sl=xe(ye,jt,Mr.value,ze);if(Sl===null){jt===null&&(jt=wr);break}s&&jt&&Sl.alternate===null&&l(ye,jt),le=S(Sl,le,ir),Ir===null?zt=Sl:Ir.sibling=Sl,Ir=Sl,jt=wr}if(Mr.done)return p(ye,jt),Cr&&lc(ye,ir),zt;if(jt===null){for(;!Mr.done;ir++,Mr=Se.next())Mr=We(ye,Mr.value,ze),Mr!==null&&(le=S(Mr,le,ir),Ir===null?zt=Mr:Ir.sibling=Mr,Ir=Mr);return Cr&&lc(ye,ir),zt}for(jt=y(jt);!Mr.done;ir++,Mr=Se.next())Mr=Oe(jt,ye,ir,Mr.value,ze),Mr!==null&&(s&&Mr.alternate!==null&&jt.delete(Mr.key===null?ir:Mr.key),le=S(Mr,le,ir),Ir===null?zt=Mr:Ir.sibling=Mr,Ir=Mr);return s&&jt.forEach(function(X8){return l(ye,X8)}),Cr&&lc(ye,ir),zt}function Zr(ye,le,Se,ze){if(typeof Se=="object"&&Se!==null&&Se.type===b&&Se.key===null&&(Se=Se.props.children),typeof Se=="object"&&Se!==null){switch(Se.$$typeof){case _:e:{for(var zt=Se.key;le!==null;){if(le.key===zt){if(zt=Se.type,zt===b){if(le.tag===7){p(ye,le.sibling),ze=k(le,Se.props.children),ze.return=ye,ye=ze;break e}}else if(le.elementType===zt||typeof zt=="object"&&zt!==null&&zt.$$typeof===x&&Pu(zt)===le.type){p(ye,le.sibling),ze=k(le,Se.props),Yp(ze,Se),ze.return=ye,ye=ze;break e}p(ye,le);break}else l(ye,le);le=le.sibling}Se.type===b?(ze=Su(Se.props.children,ye.mode,ze,Se.key),ze.return=ye,ye=ze):(ze=ny(Se.type,Se.key,Se.props,null,ye.mode,ze),Yp(ze,Se),ze.return=ye,ye=ze)}return M(ye);case w:e:{for(zt=Se.key;le!==null;){if(le.key===zt)if(le.tag===4&&le.stateNode.containerInfo===Se.containerInfo&&le.stateNode.implementation===Se.implementation){p(ye,le.sibling),ze=k(le,Se.children||[]),ze.return=ye,ye=ze;break e}else{p(ye,le);break}else l(ye,le);le=le.sibling}ze=q0(Se,ye.mode,ze),ze.return=ye,ye=ze}return M(ye);case x:return Se=Pu(Se),Zr(ye,le,Se,ze)}if(W(Se))return At(ye,le,Se,ze);if(j(Se)){if(zt=j(Se),typeof zt!="function")throw Error(n(150));return Se=zt.call(Se),Wt(ye,le,Se,ze)}if(typeof Se.then=="function")return Zr(ye,le,uy(Se),ze);if(Se.$$typeof===P)return Zr(ye,le,sy(ye,Se),ze);dy(ye,Se)}return typeof Se=="string"&&Se!==""||typeof Se=="number"||typeof Se=="bigint"?(Se=""+Se,le!==null&&le.tag===6?(p(ye,le.sibling),ze=k(le,Se),ze.return=ye,ye=ze):(p(ye,le),ze=F0(Se,ye.mode,ze),ze.return=ye,ye=ze),M(ye)):p(ye,le)}return function(ye,le,Se,ze){try{Kp=0;var zt=Zr(ye,le,Se,ze);return Ud=null,zt}catch(jt){if(jt===Bd||jt===cy)throw jt;var Ir=Ti(29,jt,null,ye.mode);return Ir.lanes=ze,Ir.return=ye,Ir}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,(Ur&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,Ut(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 ie=V,Ee=ie.next;ie.next=null,M===null?S=Ee:M.next=Ee,M=ie;var Ue=s.alternate;Ue!==null&&(Ue=Ue.updateQueue,V=Ue.lastBaseUpdate,V!==M&&(V===null?Ue.firstBaseUpdate=Ee:V.next=Ee,Ue.lastBaseUpdate=ie))}if(S!==null){var We=k.baseState;M=0,Ue=Ee=ie=null,V=S;do{var xe=V.lane&-536870913,Oe=xe!==V.lane;if(Oe?(kr&xe)===xe:(y&xe)===xe){xe!==0&&xe===jd&&(rk=!0),Ue!==null&&(Ue=Ue.next={lane:0,tag:V.tag,payload:V.payload,callback:null,next:null});e:{var At=s,Wt=V;xe=l;var Zr=p;switch(Wt.tag){case 1:if(At=Wt.payload,typeof At=="function"){We=At.call(Zr,We,xe);break e}We=At;break e;case 3:At.flags=At.flags&-65537|128;case 0:if(At=Wt.payload,xe=typeof At=="function"?At.call(Zr,We,xe):At,xe==null)break e;We=h({},We,xe);break e;case 2:sl=!0}}xe=V.callback,xe!==null&&(s.flags|=64,Oe&&(s.flags|=8192),Oe=k.callbacks,Oe===null?k.callbacks=[xe]:Oe.push(xe))}else Oe={lane:xe,tag:V.tag,payload:V.payload,callback:V.callback,next:null},Ue===null?(Ee=Ue=Oe,ie=We):Ue=Ue.next=Oe,M|=xe;if(V=V.next,V===null){if(V=k.shared.pending,V===null)break;Oe=V,V=Oe.next,Oe.next=null,k.lastBaseUpdate=Oe,k.shared.pending=null}}while(!0);Ue===null&&(ie=We),k.baseState=ie,k.firstBaseUpdate=Ee,k.lastBaseUpdate=Ue,S===null&&(k.shared.lanes=0),pl|=M,s.lanes=M,s.memoizedState=We}}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=F(null),fy=F(0);function G1(s,l){s=bc,ne(fy,s),ne(Fd,l),bc=s|l.baseLanes}function nk(){ne(fy,bc),ne(Fd,Fd.current)}function ak(){bc=fy.current,K(Fd),K(fy)}var Ci=F(null),Zi=null;function ll(s){var l=s.alternate;ne(In,In.current&1),ne(Ci,s),Zi===null&&(l===null||Fd.current!==null||l.memoizedState!==null)&&(Zi=s)}function ik(s){ne(In,In.current),ne(Ci,s),Zi===null&&(Zi=s)}function W1(s){s.tag===22?(ne(In,In.current),ne(Ci,s),Zi===null&&(Zi=s)):ul()}function ul(){ne(In,In.current),ne(Ci,Ci.current)}function xi(s){K(Ci),Zi===s&&(Zi=null),K(In)}var In=F(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 fc=0,ar=null,Jr=null,$n=null,hy=!1,qd=!1,Du=!1,my=0,Zp=0,zd=null,F$=0;function Pn(){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(!Ei(s[p],l[p]))return!1;return!0}function ok(s,l,p,y,k,S){return fc=S,ar=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,q.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){q.H=rh;var l=Jr!==null&&Jr.next!==null;if(fc=0,$n=Jr=ar=null,hy=!1,Zp=0,zd=null,l)throw Error(n(300));s===null||Vn||(s=s.dependencies,s!==null&&iy(s)&&(Vn=!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,$n=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)}q.H=DR,S=l(p,y)}while(qd);return S}function q$(){var s=q.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}fc=0,$n=Jr=ar=null,qd=!1,Zp=my=0,zd=null}function za(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return $n===null?ar.memoizedState=$n=s:$n=$n.next=s,$n}function Mn(){if(Jr===null){var s=ar.alternate;s=s!==null?s.memoizedState:null}else s=Jr.next;var l=$n===null?ar.memoizedState:$n.next;if(l!==null)$n=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},$n===null?ar.memoizedState=$n=s:$n=$n.next=s}return $n}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,($n===null?l.memoizedState:$n.next)===null&&(l=l.alternate,q.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 ka(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 pc(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,ie=null,Ee=l,Ue=!1;do{var We=Ee.lane&-536870913;if(We!==Ee.lane?(kr&We)===We:(fc&We)===We){var xe=Ee.revertLane;if(xe===0)ie!==null&&(ie=ie.next={lane:0,revertLane:0,gesture:null,action:Ee.action,hasEagerState:Ee.hasEagerState,eagerState:Ee.eagerState,next:null}),We===jd&&(Ue=!0);else if((fc&xe)===xe){Ee=Ee.next,xe===jd&&(Ue=!0);continue}else We={lane:0,revertLane:Ee.revertLane,gesture:null,action:Ee.action,hasEagerState:Ee.hasEagerState,eagerState:Ee.eagerState,next:null},ie===null?(V=ie=We,M=S):ie=ie.next=We,ar.lanes|=xe,pl|=xe;We=Ee.action,Du&&p(S,We),S=Ee.hasEagerState?Ee.eagerState:p(S,We)}else xe={lane:We,revertLane:Ee.revertLane,gesture:Ee.gesture,action:Ee.action,hasEagerState:Ee.hasEagerState,eagerState:Ee.eagerState,next:null},ie===null?(V=ie=xe,M=S):ie=ie.next=xe,ar.lanes|=We,pl|=We;Ee=Ee.next}while(Ee!==null&&Ee!==l);if(ie===null?M=S:ie.next=V,!Ei(S,s.memoizedState)&&(Vn=!0,Ue&&(p=Ld,p!==null)))throw p;s.memoizedState=S,s.baseState=M,s.baseQueue=ie,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);Ei(S,l.memoizedState)||(Vn=!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=Cr;if(S){if(p===void 0)throw Error(n(407));p=p()}else p=l();var M=!Ei((Jr||k).memoizedState,p);if(M&&(k.memoizedState=p,Vn=!0),k=k.queue,gk(Z1.bind(null,y,k,s),[s]),k.getSnapshot!==l||M||$n!==null&&$n.memoizedState.tag&1){if(y.flags|=2048,$d(9,{destroy:void 0},Q1.bind(null,y,k,p,l),null),on===null)throw Error(n(349));S||(fc&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!Ei(s,p)}catch{return!0}}function tR(s){var l=wu(s,2);l!==null&&ri(l,s,2)}function hk(s){var l=za();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:pc,lastRenderedState:s},l}function rR(s,l,p,y){return s.baseState=p,fk(s,Jr,typeof y=="function"?y:pc)}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)}};q.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=q.T,M={};q.T=M;try{var V=p(k,y),ie=q.S;ie!==null&&ie(M,V),aR(s,l,V)}catch(Ee){mk(s,l,Ee)}finally{S!==null&&M.types!==null&&(S.types=M.types),q.T=S}}else try{S=p(k,y),aR(s,l,S)}catch(Ee){mk(s,l,Ee)}}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(Cr){var p=on.formState;if(p!==null){e:{var y=ar;if(Cr){if(gn){t:{for(var k=gn,S=Qi;k.nodeType!==8;){if(!S){k=null;break t}if(k=es(k.nextSibling),k===null){k=null;break t}}S=k.data,k=S==="F!"||S==="F"?k:null}if(k){gn=es(k.nextSibling),y=k.data==="F!";break e}}al(y)}y=!1}y&&(l=p[0])}}return p=za(),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=za(),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(pc)[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=za();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((Ur&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||(fc&1073741824)!==0&&(kr&261930)===0?s.memoizedState=l:(s.memoizedState=p,s=k2(),ar.lanes|=s,pl|=s,p)}function kR(s,l,p,y){return Ei(p,l)?p:Fd.current!==null?(s=vk(s,p,y),Ei(s,l)||(Vn=!0),s):(fc&42)===0||(fc&1073741824)!==0&&(kr&261930)===0?(Vn=!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=q.T,V={};q.T=V,kk(s,!1,l,p);try{var ie=k(),Ee=q.S;if(Ee!==null&&Ee(V,ie),ie!==null&&typeof ie=="object"&&typeof ie.then=="function"){var Ue=U$(ie,y);th(s,l,Ue,Ri(s))}else th(s,l,y,Ri(s))}catch(We){th(s,l,{then:function(){},status:"rejected",reason:We},Ri())}finally{Y.p=S,M!==null&&V.types!==null&&(M.types=V.types),q.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,Z,p===null?H$:function(){return ER(s),p(y)})}function SR(s){var l=s.memoizedState;if(l!==null)return l;l={memoizedState:Z,baseState:Z,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:pc,lastRenderedState:Z},next:null};var p={};return l.next={memoizedState:p,baseState:p,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:pc,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,{},Ri())}function bk(){return ka(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=Ri();s=ol(p);var y=cl(l,s,p);y!==null&&(ri(y,l,p),Xp(y,l,p)),l={cache:Y0()},s.payload=l;return}l=l.return}}function W$(s,l,p){var y=Ri();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&&(ri(p,s,y),AR(p,l,y)))}function xR(s,l,p){var y=Ri();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,Ei(V,M))return ty(s,l,k,0),on===null&&ey(),!1}catch{}finally{}if(p=B0(s,l,k,y),p!==null)return ri(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&&ri(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,Ut(s,p)}}var rh={readContext:ka,use:yy,useCallback:Pn,useContext:Pn,useEffect:Pn,useImperativeHandle:Pn,useLayoutEffect:Pn,useInsertionEffect:Pn,useMemo:Pn,useReducer:Pn,useRef:Pn,useState:Pn,useDebugValue:Pn,useDeferredValue:Pn,useTransition:Pn,useSyncExternalStore:Pn,useId:Pn,useHostTransitionStatus:Pn,useFormState:Pn,useActionState:Pn,useOptimistic:Pn,useMemoCache:Pn,useCacheRefresh:Pn};rh.useEffectEvent=Pn;var RR={readContext:ka,use:yy,useCallback:function(s,l){return za().memoizedState=[s,l===void 0?null:l],s},useContext:ka,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=za();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=za();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=za();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=za();return vk(p,s,l)},useTransition:function(){var s=hk(!1);return s=wR.bind(null,ar,s.queue,!0,!1),za().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,l,p){var y=ar,k=za();if(Cr){if(p===void 0)throw Error(n(407));p=p()}else{if(p=l(),on===null)throw Error(n(349));(kr&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=za(),l=on.identifierPrefix;if(Cr){var p=go,y=mo;p=(y&~(1<<32-kt(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=za();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 za().memoizedState=G$.bind(null,ar)},useEffectEvent:function(s){var l=za(),p={impl:s};return l.memoizedState=p,function(){if((Ur&2)!==0)throw Error(n(440));return p.impl.apply(void 0,arguments)}}},wk={readContext:ka,use:yy,useCallback:_R,useContext:ka,useEffect:gk,useImperativeHandle:vR,useInsertionEffect:mR,useLayoutEffect:gR,useMemo:bR,useReducer:vy,useRef:fR,useState:function(){return vy(pc)},useDebugValue:yk,useDeferredValue:function(s,l){var p=Mn();return kR(p,Jr.memoizedState,s,l)},useTransition:function(){var s=vy(pc)[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:ka,use:yy,useCallback:_R,useContext:ka,useEffect:gk,useImperativeHandle:vR,useInsertionEffect:mR,useLayoutEffect:gR,useMemo:bR,useReducer:pk,useRef:fR,useState:function(){return pk(pc)},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(pc)[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=Ri(),k=ol(y);k.payload=l,p!=null&&(k.callback=p),l=cl(s,k,y),l!==null&&(ri(l,s,y),Xp(l,s,y))},enqueueReplaceState:function(s,l,p){s=s._reactInternals;var y=Ri(),k=ol(y);k.tag=1,k.payload=l,p!=null&&(k.callback=p),l=cl(s,k,y),l!==null&&(ri(l,s,y),Xp(l,s,y))},enqueueForceUpdate:function(s,l){s=s._reactInternals;var p=Ri(),y=ol(p);y.tag=2,l!=null&&(y.callback=l),l=cl(s,y,p),l!==null&&(ri(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=Ci.current,p!==null){switch(p.tag){case 31:case 13:return Zi===null?Iy():p.alternate===null&&An===0&&(An=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(Cr)return l=Ci.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(Yi(s,p)))):(y!==V0&&(l=Error(n(423),{cause:y}),Hp(Yi(l,p))),s=s.current.alternate,s.flags|=65536,k&=-k,s.lanes|=k,y=Yi(y,p),k=Tk(s.stateNode,y,k),tk(s,k),An!==4&&(An=2)),!1;var S=Error(n(520),{cause:y});if(S=Yi(S,p),uh===null?uh=[S]:uh.push(S),An!==4&&(An=2),l===null)return!0;y=Yi(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)),Vn=!1;function wa(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&&!Vn?(lk(s,l,k),hc(s,l,k)):(Cr&&V&&z0(l),l.flags|=1,wa(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 hc(s,l,k)}return l.flags|=1,s=cc(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(Vn=!1,l.pendingProps=y=S,Ik(s,k))(s.flags&131072)!==0&&(Vn=!0);else return l.lanes=s.lanes,hc(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 wa(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:zn._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,xi(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(Cr){if(y.mode==="hidden")return s=Sy(l,y),l.lanes=536870912,nh(null,s);if(ik(l),(s=gn)?(s=nD(s,Qi),s=s!==null&&s.data==="&"?s:null,s!==null&&(l.memoizedState={dehydrated:s,treeContext:rl!==null?{id:mo,overflow:go}:null,retryLane:536870912,hydrationErrors:null},p=P1(s),p.return=l,l.child=p,ba=l,gn=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(Vn||Md(s,l,p,!1),k=(p&s.childLanes)!==0,Vn||k){if(y=on,y!==null&&(M=dr(y,p),M!==0&&M!==S.retryLane))throw S.retryLane=M,wu(s,M),ri(y,s,M),Ck;Iy(),l=HR(s,l,p)}else s=S.treeContext,gn=es(M.nextSibling),ba=l,Cr=!0,nl=null,Qi=!1,s!==null&&D1(l,s),l=Sy(l,y),l.flags|=4096;return l}return s=cc(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&&!Vn?(lk(s,l,k),hc(s,l,k)):(Cr&&y&&z0(l),l.flags|=1,wa(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&&!Vn?(lk(s,l,S),hc(s,l,S)):(Cr&&y&&z0(l),l.flags|=1,wa(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=ka(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?ka(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,ie=Ou(p,V);S.props=ie;var Ee=S.context,Ue=p.contextType;M=Dd,typeof Ue=="object"&&Ue!==null&&(M=ka(Ue));var We=p.getDerivedStateFromProps;Ue=typeof We=="function"||typeof S.getSnapshotBeforeUpdate=="function",V=l.pendingProps!==V,Ue||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(V||Ee!==M)&&NR(l,S,y,M),sl=!1;var xe=l.memoizedState;S.state=xe,Qp(l,y,S,k),Jp(),Ee=l.memoizedState,V||xe!==Ee||sl?(typeof We=="function"&&(Sk(l,p,We,y),Ee=l.memoizedState),(ie=sl||OR(l,p,ie,y,xe,Ee,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=Ee),S.props=y,S.state=Ee,S.context=M,y=ie):(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,We=l.pendingProps,xe=S.context,Ee=p.contextType,ie=Dd,typeof Ee=="object"&&Ee!==null&&(ie=ka(Ee)),V=p.getDerivedStateFromProps,(Ee=typeof V=="function"||typeof S.getSnapshotBeforeUpdate=="function")||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(M!==We||xe!==ie)&&NR(l,S,y,ie),sl=!1,xe=l.memoizedState,S.state=xe,Qp(l,y,S,k),Jp();var Oe=l.memoizedState;M!==We||xe!==Oe||sl||s!==null&&s.dependencies!==null&&iy(s.dependencies)?(typeof V=="function"&&(Sk(l,p,V,y),Oe=l.memoizedState),(Ue=sl||OR(l,p,Ue,y,xe,Oe,ie)||s!==null&&s.dependencies!==null&&iy(s.dependencies))?(Ee||typeof S.UNSAFE_componentWillUpdate!="function"&&typeof S.componentWillUpdate!="function"||(typeof S.componentWillUpdate=="function"&&S.componentWillUpdate(y,Oe,ie),typeof S.UNSAFE_componentWillUpdate=="function"&&S.UNSAFE_componentWillUpdate(y,Oe,ie)),typeof S.componentDidUpdate=="function"&&(l.flags|=4),typeof S.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof S.componentDidUpdate!="function"||M===s.memoizedProps&&xe===s.memoizedState||(l.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||M===s.memoizedProps&&xe===s.memoizedState||(l.flags|=1024),l.memoizedProps=y,l.memoizedState=Oe),S.props=y,S.state=Oe,S.context=ie,y=Ue):(typeof S.componentDidUpdate!="function"||M===s.memoizedProps&&xe===s.memoizedState||(l.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||M===s.memoizedProps&&xe===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)):wa(s,l,p,k),l.memoizedState=S.state,s=l.child):s=hc(s,l,k),s}function KR(s,l,p,y){return Eu(),l.flags|=256,wa(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|=Ai),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(Cr){if(k?ll(l):ul(),(s=gn)?(s=nD(s,Qi),s=s!==null&&s.data!=="&"?s:null,s!==null&&(l.memoizedState={dehydrated:s,treeContext:rl!==null?{id:mo,overflow:go}:null,retryLane:536870912,hydrationErrors:null},p=P1(s),p.return=l,l.child=p,ba=l,gn=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 ie=s.memoizedState;if(ie!==null&&(V=ie.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 Ee=M.dgst;M=Ee,y=Error(n(419)),y.stack="",y.digest=M,Hp({value:y,source:null,stack:null}),l=Ok(s,l,p)}else if(Vn||Md(s,l,p,!1),M=(p&s.childLanes)!==0,Vn||M){if(M=on,M!==null&&(y=dr(M,p),y!==0&&y!==ie.retryLane))throw ie.retryLane=y,wu(s,y),ri(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=ie.treeContext,gn=es(V.nextSibling),ba=l,Cr=!0,nl=null,Qi=!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,ie=s.child,Ee=ie.sibling,y=cc(ie,{mode:"hidden",children:y.children}),y.subtreeFlags=ie.subtreeFlags&65011712,Ee!==null?V=cc(Ee,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?(ie=zn._currentValue,k=k.parent!==ie?{parent:ie,pool:ie}: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=cc(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=Ti(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,ne(In,M),wa(s,l,y,p),y=Cr?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 hc(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=cc(s,s.pendingProps),l.child=p,p.return=l;s.sibling!==null;)s=s.sibling,p=p.sibling=cc(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:Ge(l,l.stateNode.containerInfo),il(l,zn,s.memoizedState.cache),Eu();break;case 27:case 5:Ce(l);break;case 4:Ge(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=hc(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),ne(In,In.current),y)break;return null;case 22:return l.lanes=0,$R(s,l,p,l.pendingProps);case 24:il(l,zn,s.memoizedState.cache)}return hc(s,l,p)}function QR(s,l,p){if(s!==null)if(s.memoizedProps!==l.pendingProps)Vn=!0;else{if(!Ik(s,p)&&(l.flags&128)===0)return Vn=!1,X$(s,l,p);Vn=(s.flags&131072)!==0}else Vn=!1,Cr&&(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(Ge(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,zn,y),y!==S.cache&&K0(l,[zn],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=Yi(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(gn=es(s.firstChild),ba=l,Cr=!0,nl=null,Qi=!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=hc(s,l,p);break e}wa(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:Cr||(p=l.type,s=l.pendingProps,y=qy(ce.current).createElement(p),y[qt]=l,y[xt]=s,Sa(y,p,s),mn(y),l.stateNode=y):l.memoizedState=lD(l.type,s.memoizedProps,l.pendingProps,s.memoizedState),null;case 27:return Ce(l),s===null&&Cr&&(y=l.stateNode=sD(l.type,l.pendingProps,ce.current),ba=l,Qi=!0,k=gn,vl(l.type)?(pw=k,gn=es(y.firstChild)):gn=k),wa(s,l,l.pendingProps.children,p),Ey(s,l),s===null&&(l.flags|=4194304),l.child;case 5:return s===null&&Cr&&((k=y=gn)&&(y=C8(y,l.type,l.pendingProps,Qi),y!==null?(l.stateNode=y,ba=l,gn=es(y.firstChild),Qi=!1,k=!0):k=!1),k||al(l)),Ce(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),wa(s,l,y,p),l.child;case 6:return s===null&&Cr&&((s=p=gn)&&(p=x8(p,l.pendingProps,Qi),p!==null?(l.stateNode=p,ba=l,gn=null,s=!0):s=!1),s||al(l)),null;case 13:return YR(s,l,p);case 4:return Ge(l,l.stateNode.containerInfo),y=l.pendingProps,s===null?l.child=Ru(l,null,y,p):wa(s,l,y,p),l.child;case 11:return FR(s,l,l.type,l.pendingProps,p);case 7:return wa(s,l,l.pendingProps,p),l.child;case 8:return wa(s,l,l.pendingProps.children,p),l.child;case 12:return wa(s,l,l.pendingProps.children,p),l.child;case 10:return y=l.pendingProps,il(l,l.type,y.value),wa(s,l,y.children,p),l.child;case 9:return k=l.type._context,y=l.pendingProps.children,Cu(l),k=ka(k),y=y(k),l.flags|=1,wa(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=ka(zn),s===null?(k=J0(),k===null&&(k=on,S=Y0(),k.pooledCache=S,S.refCount++,S!==null&&(k.pooledCacheLanes|=p),k=S),l.memoizedState={parent:y,cache:k},Z0(l),il(l,zn,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,zn,y)):(y=S.cache,il(l,zn,y),y!==k.cache&&K0(l,[zn],p,!0))),wa(s,l,l.pendingProps.children,p),l.child;case 29:throw l.pendingProps}throw Error(n(156,l.tag))}function mc(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?Q():536870912,s.lanes|=l,Wd|=l)}function ah(s,l){if(!Cr)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 yn(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 yn(l),null;case 1:return yn(l),null;case 3:return p=l.stateNode,y=null,s!==null&&(y=s.memoizedState.cache),l.memoizedState.cache!==y&&(l.flags|=2048),dc(zn),se(),p.pendingContext&&(p.context=p.pendingContext,p.pendingContext=null),(s===null||s.child===null)&&(Id(l)?mc(l):s===null||s.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,H0())),yn(l),null;case 26:var k=l.type,S=l.memoizedState;return s===null?(mc(l),S!==null?(yn(l),ZR(l,S)):(yn(l),Mk(l,k,null,y,p))):S?S!==s.memoizedState?(mc(l),yn(l),ZR(l,S)):(yn(l),l.flags&=-16777217):(s=s.memoizedProps,s!==y&&mc(l),yn(l),Mk(l,k,s,y,p)),null;case 27:if(te(l),p=ce.current,k=l.type,s!==null&&l.stateNode!=null)s.memoizedProps!==y&&mc(l);else{if(!y){if(l.stateNode===null)throw Error(n(166));return yn(l),null}s=ee.current,Id(l)?O1(l):(s=sD(k,y,p),l.stateNode=s,mc(l))}return yn(l),null;case 5:if(te(l),k=l.type,s!==null&&l.stateNode!=null)s.memoizedProps!==y&&mc(l);else{if(!y){if(l.stateNode===null)throw Error(n(166));return yn(l),null}if(S=ee.current,Id(l))O1(l);else{var M=qy(ce.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[qt]=l,S[xt]=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(Sa(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&&mc(l)}}return yn(l),Mk(l,l.type,s===null?null:s.memoizedProps,l.pendingProps,p),null;case 6:if(s&&l.stateNode!=null)s.memoizedProps!==y&&mc(l);else{if(typeof y!="string"&&l.stateNode===null)throw Error(n(166));if(s=ce.current,Id(l)){if(s=l.stateNode,p=l.memoizedProps,y=null,k=ba,k!==null)switch(k.tag){case 27:case 5:y=k.memoizedProps}s[qt]=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[qt]=l,l.stateNode=s}return yn(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[qt]=l}else Eu(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;yn(l),s=!1}else p=H0(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=p),s=!0;if(!s)return l.flags&256?(xi(l),l):(xi(l),null);if((l.flags&128)!==0)throw Error(n(558))}return yn(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[qt]=l}else Eu(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;yn(l),k=!1}else k=H0(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=k),k=!0;if(!k)return l.flags&256?(xi(l),l):(xi(l),null)}return xi(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),yn(l),null);case 4:return se(),s===null&&nw(l.stateNode.containerInfo),yn(l),null;case 10:return dc(l.type),yn(l),null;case 19:if(K(In),y=l.memoizedState,y===null)return yn(l),null;if(k=(l.flags&128)!==0,S=y.rendering,S===null)if(k)ah(y,!1);else{if(An!==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 ne(In,In.current&1|2),Cr&&lc(l,y.treeForkCount),l.child}s=s.sibling}y.tail!==null&&bt()>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&&!Cr)return yn(l),null}else 2*bt()-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=bt(),s.sibling=null,p=In.current,ne(In,k?p&1|2:p&1),Cr&&lc(l,y.treeForkCount),s):(yn(l),null);case 22:case 23:return xi(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&&(yn(l),l.subtreeFlags&6&&(l.flags|=8192)):yn(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),dc(zn),yn(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 dc(zn),se(),s=l.flags,(s&65536)!==0&&(s&128)===0?(l.flags=s&-65537|128,l):null;case 26:case 27:case 5:return te(l),null;case 31:if(l.memoizedState!==null){if(xi(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(xi(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 se(),null;case 10:return dc(l.type),null;case 22:case 23:return xi(l),ak(),s!==null&&K(xu),s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 24:return dc(zn),null;case 25:return null;default:return null}}function e2(s,l){switch($0(l),l.tag){case 3:dc(zn),se();break;case 26:case 27:case 5:te(l);break;case 4:se();break;case 31:l.memoizedState!==null&&xi(l);break;case 13:xi(l);break;case 19:K(In);break;case 10:dc(l.type);break;case 22:case 23:xi(l),ak(),s!==null&&K(xu);break;case 24:dc(zn)}}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){Yr(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 ie=p,Ee=V;try{Ee()}catch(Ue){Yr(k,ie,Ue)}}}y=y.next}while(y!==S)}}catch(Ue){Yr(l,l.return,Ue)}}function t2(s){var l=s.updateQueue;if(l!==null){var p=s.stateNode;try{H1(l,p)}catch(y){Yr(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){Yr(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){Yr(s,l,k)}}function yo(s,l){var p=s.ref,y=s.refCleanup;if(p!==null)if(typeof y=="function")try{y()}catch(k){Yr(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){Yr(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){Yr(s,s.return,k)}}function jk(s,l,p){try{var y=s.stateNode;b8(y,s.type,p,l),y[xt]=l}catch(k){Yr(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=_a));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]);Sa(l,y,p),l[qt]=s,l[xt]=p}catch(S){Yr(s,s.return,S)}}var gc=!1,Hn=!1,Uk=!1,s2=typeof WeakSet=="function"?WeakSet:Set,fa=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,ie=-1,Ee=0,Ue=0,We=s,xe=null;t:for(;;){for(var Oe;We!==p||k!==0&&We.nodeType!==3||(V=M+k),We!==S||y!==0&&We.nodeType!==3||(ie=M+y),We.nodeType===3&&(M+=We.nodeValue.length),(Oe=We.firstChild)!==null;)xe=We,We=Oe;for(;;){if(We===s)break t;if(xe===p&&++Ee===k&&(V=M),xe===S&&++Ue===y&&(ie=M),(Oe=We.nextSibling)!==null)break;We=xe,xe=We.parentNode}We=Oe}p=V===-1||ie===-1?null:{start:V,end:ie}}else p=null}p=p||{start:0,end:0}}else p=null;for(ow={focusedElem:s,selectionRange:p},Ky=!1,fa=l;fa!==null;)if(l=fa,s=l.child,(l.subtreeFlags&1028)!==0&&s!==null)s.return=l,fa=s;else for(;fa!==null;){switch(l=fa,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 At=Ou(p.type,k);s=y.getSnapshotBeforeUpdate(At,S),y.__reactInternalSnapshotBeforeUpdate=s}catch(Wt){Yr(p,p.return,Wt)}}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,fa=s;break}fa=l.return}}function o2(s,l,p){var y=p.flags;switch(p.tag){case 0:case 11:case 15:vc(s,p),y&4&&ih(5,p);break;case 1:if(vc(s,p),y&4)if(s=p.stateNode,l===null)try{s.componentDidMount()}catch(M){Yr(p,p.return,M)}else{var k=Ou(p.type,l.memoizedProps);l=l.memoizedState;try{s.componentDidUpdate(k,l,s.__reactInternalSnapshotBeforeUpdate)}catch(M){Yr(p,p.return,M)}}y&64&&t2(p),y&512&&sh(p,p.return);break;case 3:if(vc(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){Yr(p,p.return,M)}}break;case 27:l===null&&y&4&&i2(p);case 26:case 5:vc(s,p),l===null&&y&4&&n2(p),y&512&&sh(p,p.return);break;case 12:vc(s,p);break;case 31:vc(s,p),y&4&&u2(s,p);break;case 13:vc(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||gc,!y){l=l!==null&&l.memoizedState!==null||Hn,k=gc;var S=Hn;gc=y,(Hn=l)&&!S?_c(s,p,(p.subtreeFlags&8772)!==0):vc(s,p),gc=k,Hn=S}break;case 30:break;default:vc(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&&rc(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 kn=null,Qa=!1;function yc(s,l,p){for(p=p.child;p!==null;)l2(s,l,p),p=p.sibling}function l2(s,l,p){if(ke&&typeof ke.onCommitFiberUnmount=="function")try{ke.onCommitFiberUnmount(at,p)}catch{}switch(p.tag){case 26:Hn||yo(p,l),yc(s,l,p),p.memoizedState?p.memoizedState.count--:p.stateNode&&(p=p.stateNode,p.parentNode.removeChild(p));break;case 27:Hn||yo(p,l);var y=kn,k=Qa;vl(p.type)&&(kn=p.stateNode,Qa=!1),yc(s,l,p),mh(p.stateNode),kn=y,Qa=k;break;case 5:Hn||yo(p,l);case 6:if(y=kn,k=Qa,kn=null,yc(s,l,p),kn=y,Qa=k,kn!==null)if(Qa)try{(kn.nodeType===9?kn.body:kn.nodeName==="HTML"?kn.ownerDocument.body:kn).removeChild(p.stateNode)}catch(S){Yr(p,l,S)}else try{kn.removeChild(p.stateNode)}catch(S){Yr(p,l,S)}break;case 18:kn!==null&&(Qa?(s=kn,tD(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,p.stateNode),tf(s)):tD(kn,p.stateNode));break;case 4:y=kn,k=Qa,kn=p.stateNode.containerInfo,Qa=!0,yc(s,l,p),kn=y,Qa=k;break;case 0:case 11:case 14:case 15:dl(2,p,l),Hn||dl(4,p,l),yc(s,l,p);break;case 1:Hn||(yo(p,l),y=p.stateNode,typeof y.componentWillUnmount=="function"&&r2(p,l,y)),yc(s,l,p);break;case 21:yc(s,l,p);break;case 22:Hn=(y=Hn)||p.memoizedState!==null,yc(s,l,p),Hn=y;break;default:yc(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){Yr(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){Yr(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 Za(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)){kn=V.stateNode,Qa=!1;break e}break;case 5:kn=V.stateNode,Qa=!1;break e;case 3:case 4:kn=V.stateNode.containerInfo,Qa=!0;break e}V=V.return}if(kn===null)throw Error(n(160));l2(S,M,k),kn=null,Qa=!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 Is=null;function f2(s,l){var p=s.alternate,y=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:Za(l,s),ei(s),y&4&&(dl(3,s,s.return),ih(3,s),dl(5,s,s.return));break;case 1:Za(l,s),ei(s),y&512&&(Hn||p===null||yo(p,p.return)),y&64&&gc&&(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=Is;if(Za(l,s),ei(s),y&512&&(Hn||p===null||yo(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[mr]||S[qt]||S.namespaceURI==="http://www.w3.org/2000/svg"||S.hasAttribute("itemprop"))&&(S=k.createElement(y),k.head.insertBefore(S,k.querySelector("head > title"))),Sa(S,y,p),S[qt]=s,mn(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),Sa(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),Sa(S,y,p),k.head.appendChild(S);break;default:throw Error(n(468,y))}S[qt]=s,mn(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:Za(l,s),ei(s),y&512&&(Hn||p===null||yo(p,p.return)),p!==null&&y&4&&jk(s,s.memoizedProps,p.memoizedProps);break;case 5:if(Za(l,s),ei(s),y&512&&(Hn||p===null||yo(p,p.return)),s.flags&32){k=s.stateNode;try{Je(k,"")}catch(At){Yr(s,s.return,At)}}y&4&&s.stateNode!=null&&(k=s.memoizedProps,jk(s,k,p!==null?p.memoizedProps:k)),y&1024&&(Uk=!0);break;case 6:if(Za(l,s),ei(s),y&4){if(s.stateNode===null)throw Error(n(162));y=s.memoizedProps,p=s.stateNode;try{p.nodeValue=y}catch(At){Yr(s,s.return,At)}}break;case 3:if(Vy=null,k=Is,Is=zy(l.containerInfo),Za(l,s),Is=k,ei(s),y&4&&p!==null&&p.memoizedState.isDehydrated)try{tf(l.containerInfo)}catch(At){Yr(s,s.return,At)}Uk&&(Uk=!1,p2(s));break;case 4:y=Is,Is=zy(s.stateNode.containerInfo),Za(l,s),ei(s),Is=y;break;case 12:Za(l,s),ei(s);break;case 31:Za(l,s),ei(s),y&4&&(y=s.updateQueue,y!==null&&(s.updateQueue=null,Py(s,y)));break;case 13:Za(l,s),ei(s),s.child.flags&8192&&s.memoizedState!==null!=(p!==null&&p.memoizedState!==null)&&(Ry=bt()),y&4&&(y=s.updateQueue,y!==null&&(s.updateQueue=null,Py(s,y)));break;case 22:k=s.memoizedState!==null;var ie=p!==null&&p.memoizedState!==null,Ee=gc,Ue=Hn;if(gc=Ee||k,Hn=Ue||ie,Za(l,s),Hn=Ue,gc=Ee,ei(s),y&8192)e:for(l=s.stateNode,l._visibility=k?l._visibility&-2:l._visibility|1,k&&(p===null||ie||gc||Hn||Nu(s)),p=null,l=s;;){if(l.tag===5||l.tag===26){if(p===null){ie=p=l;try{if(S=ie.stateNode,k)M=S.style,typeof M.setProperty=="function"?M.setProperty("display","none","important"):M.display="none";else{V=ie.stateNode;var We=ie.memoizedProps.style,xe=We!=null&&We.hasOwnProperty("display")?We.display:null;V.style.display=xe==null||typeof xe=="boolean"?"":(""+xe).trim()}}catch(At){Yr(ie,ie.return,At)}}}else if(l.tag===6){if(p===null){ie=l;try{ie.stateNode.nodeValue=k?"":ie.memoizedProps}catch(At){Yr(ie,ie.return,At)}}}else if(l.tag===18){if(p===null){ie=l;try{var Oe=ie.stateNode;k?rD(Oe,!0):rD(ie.stateNode,!1)}catch(At){Yr(ie,ie.return,At)}}}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:Za(l,s),ei(s),y&4&&(y=s.updateQueue,y!==null&&(s.updateQueue=null,Py(s,y)));break;case 30:break;case 21:break;default:Za(l,s),ei(s)}}function ei(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 ie=p.stateNode.containerInfo,Ee=Lk(s);Bk(s,Ee,ie);break;default:throw Error(n(161))}}catch(Ue){Yr(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 vc(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:yo(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:yo(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 _c(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:_c(k,S,p),ih(4,S);break;case 1:if(_c(k,S,p),y=S,k=y.stateNode,typeof k.componentDidMount=="function")try{k.componentDidMount()}catch(Ee){Yr(y,y.return,Ee)}if(y=S,k=y.updateQueue,k!==null){var V=y.stateNode;try{var ie=k.shared.hiddenCallbacks;if(ie!==null)for(k.shared.hiddenCallbacks=null,k=0;k<ie.length;k++)V1(ie[k],V)}catch(Ee){Yr(y,y.return,Ee)}}p&&M&64&&t2(S),sh(S,S.return);break;case 27:i2(S);case 26:case 5:_c(k,S,p),p&&y===null&&M&4&&n2(S),sh(S,S.return);break;case 12:_c(k,S,p);break;case 31:_c(k,S,p),p&&M&4&&u2(k,S);break;case 13:_c(k,S,p),p&&M&4&&d2(k,S);break;case 22:S.memoizedState===null&&_c(k,S,p),sh(S,S.return);break;case 30:break;default:_c(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 Ms(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:Ms(s,l,p,y),k&2048&&ih(9,l);break;case 1:Ms(s,l,p,y);break;case 3:Ms(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){Ms(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(ie){Yr(l,l.return,ie)}}else Ms(s,l,p,y);break;case 31:Ms(s,l,p,y);break;case 13:Ms(s,l,p,y);break;case 23:break;case 22:S=l.stateNode,M=l.alternate,l.memoizedState!==null?S._visibility&2?Ms(s,l,p,y):oh(s,l):S._visibility&2?Ms(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:Ms(s,l,p,y),k&2048&&qk(l.alternate,l);break;default:Ms(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,ie=y,Ee=M.flags;switch(M.tag){case 0:case 11:case 15:Vd(S,M,V,ie,k),ih(8,M);break;case 23:break;case 22:var Ue=M.stateNode;M.memoizedState!==null?Ue._visibility&2?Vd(S,M,V,ie,k):oh(S,M):(Ue._visibility|=2,Vd(S,M,V,ie,k)),k&&Ee&2048&&Fk(M.alternate,M);break;case 24:Vd(S,M,V,ie,k),k&&Ee&2048&&qk(M.alternate,M);break;default:Vd(S,M,V,ie,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,Is,s.memoizedState,s.memoizedProps);break;case 5:Hd(s,l,p);break;case 3:case 4:var y=Is;Is=zy(s.stateNode.containerInfo),Hd(s,l,p),Is=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];fa=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];fa=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(;fa!==null;){var p=fa;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,fa=y;else e:for(p=s;fa!==null;){y=fa;var k=y.sibling,S=y.return;if(c2(y),y===p){fa=null;break e}if(k!==null){k.return=S,fa=k;break e}fa=S}}}var t8={getCacheForType:function(s){var l=ka(zn),p=l.data.get(s);return p===void 0&&(p=s(),l.data.set(s,p)),p},cacheSignal:function(){return ka(zn).controller.signal}},r8=typeof WeakMap=="function"?WeakMap:Map,Ur=0,on=null,yr=null,kr=0,Kr=0,Pi=null,fl=!1,Gd=!1,zk=!1,bc=0,An=0,pl=0,Iu=0,$k=0,Ai=0,Wd=0,uh=null,ti=null,Vk=!1,Ry=0,_2=0,Dy=1/0,Oy=null,hl=null,aa=0,ml=null,Kd=null,kc=0,Hk=0,Gk=null,b2=null,dh=0,Wk=null;function Ri(){return(Ur&2)!==0&&kr!==0?kr&-kr:q.T!==null?Zk():Fe()}function k2(){if(Ai===0)if((kr&536870912)===0||Cr){var s=dn;dn<<=1,(dn&3932160)===0&&(dn=262144),Ai=s}else Ai=536870912;return s=Ci.current,s!==null&&(s.flags|=32),Ai}function ri(s,l,p){(s===on&&(Kr===2||Kr===9)||s.cancelPendingCommit!==null)&&(Yd(s,0),gl(s,kr,Ai,!1)),Ne(s,p),((Ur&2)===0||s!==on)&&(s===on&&((Ur&2)===0&&(Iu|=p),An===4&&gl(s,kr,Ai,!1)),vo(s))}function w2(s,l,p){if((Ur&6)!==0)throw Error(n(327));var y=!p&&(l&127)===0&&(l&s.expiredLanes)===0||Ae(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 ie=V.current.memoizedState.isDehydrated;if(ie&&(Yd(V,M).flags|=256),M=Yk(V,M,!1),M!==2){if(zk&&!ie){V.errorRecoveryDisabledLanes|=S,Iu|=S,k=4;break e}S=ti,ti=k,S!==null&&(ti===null?ti=S:ti.push.apply(ti,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,Ai,!fl);break e;case 2:ti=null;break;case 3:case 5:break;default:throw Error(n(329))}if((l&62914560)===l&&(k=Ry+300-bt(),10<k)){if(gl(y,l,Ai,!fl),ve(y,0,!0)!==0)break e;kc=l,y.timeoutHandle=Z2(S2.bind(null,y,p,ti,Oy,Vk,l,Ai,Iu,Wd,fl,S,"Throttled",-0,0),k);break e}S2(y,p,ti,Oy,Vk,l,Ai,Iu,Wd,fl,S,null,-0,0)}}break}while(!0);vo(s)}function S2(s,l,p,y,k,S,M,V,ie,Ee,Ue,We,xe,Oe){if(s.timeoutHandle=-1,We=l.subtreeFlags,We&8192||(We&16785408)===16785408){We={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:_a},m2(l,S,We);var At=(S&62914560)===S?Ry-bt():(S&4194048)===S?_2-bt():0;if(At=q8(We,At),At!==null){kc=S,s.cancelPendingCommit=At(D2.bind(null,s,l,S,p,y,k,M,V,ie,Ue,We,null,xe,Oe)),gl(s,S,M,!Ee);return}}D2(s,l,S,p,y,k,M,V,ie)}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(!Ei(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-kt(k),M=1<<S;y[S]=-1,k&=~M}p!==0&&Rt(s,p,l)}function Ny(){return(Ur&6)===0?(fh(0),!1):!0}function Kk(){if(yr!==null){if(Kr===0)var s=yr.return;else s=yr,uc=Tu=null,uk(s),Ud=null,Kp=0,s=yr;for(;s!==null;)e2(s.alternate,s),s=s.return;yr=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()),kc=0,Kk(),on=s,yr=p=cc(s.current,null),kr=l,Kr=0,Pi=null,fl=!1,Gd=Ae(s,l),zk=!1,Wd=Ai=$k=Iu=pl=An=0,ti=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-kt(y),S=1<<k;l|=s[k],y&=~S}return bc=l,ey(),p}function E2(s,l){ar=null,q.H=rh,l===Bd||l===cy?(l=F1(),Kr=3):l===Q0?(l=F1(),Kr=4):Kr=l===Ck?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,Pi=l,yr===null&&(An=1,wy(s,Yi(l,s.current)))}function T2(){var s=Ci.current;return s===null?!0:(kr&4194048)===kr?Zi===null:(kr&62914560)===kr||(kr&536870912)!==0?s===Zi:!1}function C2(){var s=q.H;return q.H=rh,s===null?rh:s}function x2(){var s=q.A;return q.A=t8,s}function Iy(){An=4,fl||(kr&4194048)!==kr&&Ci.current!==null||(Gd=!0),(pl&134217727)===0&&(Iu&134217727)===0||on===null||gl(on,kr,Ai,!1)}function Yk(s,l,p){var y=Ur;Ur|=2;var k=C2(),S=x2();(on!==s||kr!==l)&&(Oy=null,Yd(s,l)),l=!1;var M=An;e:do try{if(Kr!==0&&yr!==null){var V=yr,ie=Pi;switch(Kr){case 8:Kk(),M=6;break e;case 3:case 2:case 9:case 6:Ci.current===null&&(l=!0);var Ee=Kr;if(Kr=0,Pi=null,Xd(s,V,ie,Ee),p&&Gd){M=0;break e}break;default:Ee=Kr,Kr=0,Pi=null,Xd(s,V,ie,Ee)}}a8(),M=An;break}catch(Ue){E2(s,Ue)}while(!0);return l&&s.shellSuspendCounter++,uc=Tu=null,Ur=y,q.H=k,q.A=S,yr===null&&(on=null,kr=0,ey()),M}function a8(){for(;yr!==null;)P2(yr)}function i8(s,l){var p=Ur;Ur|=2;var y=C2(),k=x2();on!==s||kr!==l?(Oy=null,Dy=bt()+500,Yd(s,l)):Gd=Ae(s,l);e:do try{if(Kr!==0&&yr!==null){l=yr;var S=Pi;t:switch(Kr){case 1:Kr=0,Pi=null,Xd(s,l,S,1);break;case 2:case 9:if(B1(S)){Kr=0,Pi=null,A2(l);break}l=function(){Kr!==2&&Kr!==9||on!==s||(Kr=7),vo(s)},S.then(l,l);break e;case 3:Kr=7;break e;case 4:Kr=5;break e;case 7:B1(S)?(Kr=0,Pi=null,A2(l)):(Kr=0,Pi=null,Xd(s,l,S,7));break;case 5:var M=null;switch(yr.tag){case 26:M=yr.memoizedState;case 5:case 27:var V=yr;if(M?hD(M):V.stateNode.complete){Kr=0,Pi=null;var ie=V.sibling;if(ie!==null)yr=ie;else{var Ee=V.return;Ee!==null?(yr=Ee,My(Ee)):yr=null}break t}}Kr=0,Pi=null,Xd(s,l,S,5);break;case 6:Kr=0,Pi=null,Xd(s,l,S,6);break;case 8:Kk(),An=6;break e;default:throw Error(n(462))}}s8();break}catch(Ue){E2(s,Ue)}while(!0);return uc=Tu=null,q.H=y,q.A=k,Ur=p,yr!==null?0:(on=null,kr=0,ey(),An)}function s8(){for(;yr!==null&&!Et();)P2(yr)}function P2(s){var l=QR(s.alternate,s,bc);s.memoizedProps=s.pendingProps,l===null?My(s):yr=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,kr);break;case 11:l=GR(p,l,l.pendingProps,l.type.render,l.ref,kr);break;case 5:uk(l);default:e2(p,l),l=yr=x1(l,bc),l=QR(p,l,bc)}s.memoizedProps=s.pendingProps,l===null?My(s):yr=l}function Xd(s,l,p,y){uc=Tu=null,uk(l),Ud=null,Kp=0;var k=l.return;try{if(K$(s,k,l,p,kr)){An=1,wy(s,Yi(p,s.current)),yr=null;return}}catch(S){if(k!==null)throw yr=k,S;An=1,wy(s,Yi(p,s.current)),yr=null;return}l.flags&32768?(Cr||y===1?s=!0:Gd||(kr&536870912)!==0?s=!1:(fl=s=!0,(y===2||y===9||y===3||y===6)&&(y=Ci.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,bc);if(p!==null){yr=p;return}if(l=l.sibling,l!==null){yr=l;return}yr=l=s}while(l!==null);An===0&&(An=5)}function R2(s,l){do{var p=Q$(s.alternate,s);if(p!==null){p.flags&=32767,yr=p;return}if(p=s.return,p!==null&&(p.flags|=32768,p.subtreeFlags=0,p.deletions=null),!l&&(s=s.sibling,s!==null)){yr=s;return}yr=s=p}while(s!==null);An=6,yr=null}function D2(s,l,p,y,k,S,M,V,ie){s.cancelPendingCommit=null;do jy();while(aa!==0);if((Ur&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,pt(s,p,S,M,V,ie),s===on&&(yr=on=null,kr=0),Kd=l,ml=s,kc=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=q.T,q.T=null,k=Y.p,Y.p=2,M=Ur,Ur|=4;try{Z$(s,l,p)}finally{Ur=M,Y.p=k,q.T=y}}aa=1,O2(),N2(),I2()}}function O2(){if(aa===1){aa=0;var s=ml,l=Kd,p=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||p){p=q.T,q.T=null;var y=Y.p;Y.p=2;var k=Ur;Ur|=4;try{f2(l,s);var S=ow,M=v1(s.containerInfo),V=S.focusedElem,ie=S.selectionRange;if(M!==V&&V&&V.ownerDocument&&y1(V.ownerDocument.documentElement,V)){if(ie!==null&&O0(V)){var Ee=ie.start,Ue=ie.end;if(Ue===void 0&&(Ue=Ee),"selectionStart"in V)V.selectionStart=Ee,V.selectionEnd=Math.min(Ue,V.value.length);else{var We=V.ownerDocument||document,xe=We&&We.defaultView||window;if(xe.getSelection){var Oe=xe.getSelection(),At=V.textContent.length,Wt=Math.min(ie.start,At),Zr=ie.end===void 0?Wt:Math.min(ie.end,At);!Oe.extend&&Wt>Zr&&(M=Zr,Zr=Wt,Wt=M);var ye=g1(V,Wt),le=g1(V,Zr);if(ye&&le&&(Oe.rangeCount!==1||Oe.anchorNode!==ye.node||Oe.anchorOffset!==ye.offset||Oe.focusNode!==le.node||Oe.focusOffset!==le.offset)){var Se=We.createRange();Se.setStart(ye.node,ye.offset),Oe.removeAllRanges(),Wt>Zr?(Oe.addRange(Se),Oe.extend(le.node,le.offset)):(Se.setEnd(le.node,le.offset),Oe.addRange(Se))}}}}for(We=[],Oe=V;Oe=Oe.parentNode;)Oe.nodeType===1&&We.push({element:Oe,left:Oe.scrollLeft,top:Oe.scrollTop});for(typeof V.focus=="function"&&V.focus(),V=0;V<We.length;V++){var ze=We[V];ze.element.scrollLeft=ze.left,ze.element.scrollTop=ze.top}}Ky=!!sw,ow=sw=null}finally{Ur=k,Y.p=y,q.T=p}}s.current=l,aa=2}}function N2(){if(aa===2){aa=0;var s=ml,l=Kd,p=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||p){p=q.T,q.T=null;var y=Y.p;Y.p=2;var k=Ur;Ur|=4;try{o2(s,l.alternate,l)}finally{Ur=k,Y.p=y,q.T=p}}aa=3}}function I2(){if(aa===4||aa===3){aa=0,It();var s=ml,l=Kd,p=kc,y=b2;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?aa=5:(aa=0,Kd=ml=null,M2(s,s.pendingLanes));var k=s.pendingLanes;if(k===0&&(hl=null),rn(p),l=l.stateNode,ke&&typeof ke.onCommitFiberRoot=="function")try{ke.onCommitFiberRoot(at,l,void 0,(l.current.flags&128)===128)}catch{}if(y!==null){l=q.T,k=Y.p,Y.p=2,q.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{q.T=l,Y.p=k}}(kc&3)!==0&&jy(),vo(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(aa!==5)return!1;var s=ml,l=Hk;Hk=0;var p=rn(kc),y=q.T,k=Y.p;try{Y.p=32>p?32:p,q.T=null,p=Gk,Gk=null;var S=ml,M=kc;if(aa=0,Kd=ml=null,kc=0,(Ur&6)!==0)throw Error(n(331));var V=Ur;if(Ur|=4,y2(S.current),h2(S,S.current,M,p),Ur=V,fh(0,!1),ke&&typeof ke.onPostCommitFiberRoot=="function")try{ke.onPostCommitFiberRoot(at,S)}catch{}return!0}finally{Y.p=k,q.T=y,M2(s,l)}}function L2(s,l,p){l=Yi(p,l),l=Tk(s.stateNode,l,2),s=cl(s,l,2),s!==null&&(Ne(s,2),vo(s))}function Yr(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=Yi(p,s),p=BR(2),y=cl(l,p,2),y!==null&&(UR(p,y,l,s),Ne(y,2),vo(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,on===s&&(kr&p)===p&&(An===4||An===3&&(kr&62914560)===kr&&300>bt()-Ry?(Ur&2)===0&&Yd(s,0):$k|=p,Wd===kr&&(Wd=0)),vo(s)}function B2(s,l){l===0&&(l=Q()),s=wu(s,l),s!==null&&(Ne(s,l),vo(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 Ke(s,l)}var Ly=null,Jd=null,Jk=!1,By=!1,Qk=!1,yl=0;function vo(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-kt(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=kr,S=ve(y,y===on?S:0,y.cancelPendingCommit!==null||y.timeoutHandle!==-1),(S&3)===0||Ae(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=bt(),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}aa!==0&&aa!==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-kt(S),V=1<<M,ie=k[M];ie===-1?((V&p)===0||(V&y)!==0)&&(k[M]=B(V,l)):ie<=l&&(s.expiredLanes|=V),S&=~V}if(l=on,p=kr,p=ve(s,s===l?p:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),y=s.callbackNode,p===0||s===l&&(Kr===2||Kr===9)||s.cancelPendingCommit!==null)return y!==null&&y!==null&&it(y),s.callbackNode=null,s.callbackPriority=0;if((p&3)===0||Ae(s,p)){if(l=p&-p,l===s.callbackPriority)return l;switch(y!==null&&it(y),rn(p)){case 2:case 8:p=je;break;case 32:p=nt;break;case 268435456:p=Mt;break;default:p=nt}return y=q2.bind(null,s),p=Ke(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(aa!==0&&aa!==5)return s.callbackNode=null,s.callbackPriority=0,null;var p=s.callbackNode;if(jy()&&s.callbackNode!==p)return null;var y=kr;return y=ve(s,s===on?y:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),y===0?null:(w2(s,y,l),F2(s,bt()),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(){(Ur&6)!==0?Ke(Be,d8):U2()})}function Zk(){if(yl===0){var s=jd;s===0&&(s=Er,Er<<=1,(Er&261888)===0&&(Er=256)),yl=s}return yl}function $2(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:Rs(""+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[xt]||null).action),M=y.submitter;M&&(l=(l=M[xt]||null)?$2(l.formAction):M.getAttribute("formAction"),l!==null&&(S=l,M=null));var V=new sc("action","action",null,y,k);s.push({event:V,listeners:[{instance:null,listener:function(){if(y.defaultPrevented){if(yl!==0){var ie=M?V2(k,M):new FormData(k);_k(p,{pending:!0,data:ie,method:k.method,action:S},null,ie)}}else typeof S=="function"&&(V.preventDefault(),ie=M?V2(k,M):new FormData(k),_k(p,{pending:!0,data:ie,method:k.method,action:S},S,ie))},currentTarget:k}]})}}for(var ew=0;ew<j0.length;ew++){var tw=j0[ew],h8=tw.toLowerCase(),m8=tw[0].toUpperCase()+tw.slice(1);Ns(h8,"on"+m8)}Ns(k1,"onAnimationEnd"),Ns(w1,"onAnimationIteration"),Ns(S1,"onAnimationStart"),Ns("dblclick","onDoubleClick"),Ns("focusin","onFocus"),Ns("focusout","onBlur"),Ns(D$,"onTransitionRun"),Ns(O$,"onTransitionStart"),Ns(N$,"onTransitionCancel"),Ns(E1,"onTransitionEnd"),Vi("onMouseEnter",["mouseout","mouseover"]),Vi("onMouseLeave",["mouseout","mouseover"]),Vi("onPointerEnter",["pointerout","pointerover"]),Vi("onPointerLeave",["pointerout","pointerover"]),As("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),As("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),As("onBeforeInput",["compositionend","keypress","textInput","paste"]),As("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),As("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),As("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],ie=V.instance,Ee=V.currentTarget;if(V=V.listener,ie!==S&&k.isPropagationStopped())break e;S=V,k.currentTarget=Ee;try{S(k)}catch(Ue){Zg(Ue)}k.currentTarget=null,S=ie}else for(M=0;M<y.length;M++){if(V=y[M],ie=V.instance,Ee=V.currentTarget,V=V.listener,ie!==S&&k.isPropagationStopped())break e;S=V,k.currentTarget=Ee;try{S(k)}catch(Ue){Zg(Ue)}k.currentTarget=null,S=ie}}}}function vr(s,l){var p=l[bn];p===void 0&&(p=l[bn]=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,xs.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,!Fa||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 ie=M.tag;if((ie===3||ie===4)&&M.stateNode.containerInfo===k)return;M=M.return}for(;V!==null;){if(M=$i(V),M===null)return;if(ie=M.tag,ie===5||ie===6||ie===26||ie===27){y=S=M;continue e}V=V.parentNode}}y=y.return}Br(function(){var Ee=S,Ue=Ds(p),We=[];e:{var xe=T1.get(s);if(xe!==void 0){var Oe=sc,At=s;switch(s){case"keypress":if(Ed(p)===0)break e;case"keydown":case"keyup":Oe=Jg;break;case"focusin":At="focus",Oe=yt;break;case"focusout":At="blur",Oe=yt;break;case"beforeblur":case"afterblur":Oe=yt;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":Oe=Me;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Oe=He;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Oe=f$;break;case k1:case w1:case S1:Oe=an;break;case E1:Oe=h$;break;case"scroll":case"scrollend":Oe=x0;break;case"wheel":Oe=g$;break;case"copy":case"cut":case"paste":Oe=sn;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Oe=r1;break;case"toggle":case"beforetoggle":Oe=v$}var Wt=(l&4)!==0,Zr=!Wt&&(s==="scroll"||s==="scrollend"),ye=Wt?xe!==null?xe+"Capture":null:xe;Wt=[];for(var le=Ee,Se;le!==null;){var ze=le;if(Se=ze.stateNode,ze=ze.tag,ze!==5&&ze!==26&&ze!==27||Se===null||ye===null||(ze=ta(le,ye),ze!=null&&Wt.push(hh(le,ze,Se))),Zr)break;le=le.return}0<Wt.length&&(xe=new Oe(xe,At,null,p,Ue),We.push({event:xe,listeners:Wt}))}}if((l&7)===0){e:{if(xe=s==="mouseover"||s==="pointerover",Oe=s==="mouseout"||s==="pointerout",xe&&p!==Qc&&(At=p.relatedTarget||p.fromElement)&&($i(At)||At[fn]))break e;if((Oe||xe)&&(xe=Ue.window===Ue?Ue:(xe=Ue.ownerDocument)?xe.defaultView||xe.parentWindow:window,Oe?(At=p.relatedTarget||p.toElement,Oe=Ee,At=At?$i(At):null,At!==null&&(Zr=i(At),Wt=At.tag,At!==Zr||Wt!==5&&Wt!==27&&Wt!==6)&&(At=null)):(Oe=null,At=Ee),Oe!==At)){if(Wt=Me,ze="onMouseLeave",ye="onMouseEnter",le="mouse",(s==="pointerout"||s==="pointerover")&&(Wt=r1,ze="onPointerLeave",ye="onPointerEnter",le="pointer"),Zr=Oe==null?xe:bi(Oe),Se=At==null?xe:bi(At),xe=new Wt(ze,le+"leave",Oe,p,Ue),xe.target=Zr,xe.relatedTarget=Se,ze=null,$i(Ue)===Ee&&(Wt=new Wt(ye,le+"enter",At,p,Ue),Wt.target=Se,Wt.relatedTarget=Zr,ze=Wt),Zr=ze,Oe&&At)t:{for(Wt=y8,ye=Oe,le=At,Se=0,ze=ye;ze;ze=Wt(ze))Se++;ze=0;for(var zt=le;zt;zt=Wt(zt))ze++;for(;0<Se-ze;)ye=Wt(ye),Se--;for(;0<ze-Se;)le=Wt(le),ze--;for(;Se--;){if(ye===le||le!==null&&ye===le.alternate){Wt=ye;break t}ye=Wt(ye),le=Wt(le)}Wt=null}else Wt=null;Oe!==null&&W2(We,xe,Oe,Wt,!1),At!==null&&Zr!==null&&W2(We,Zr,At,Wt,!0)}}e:{if(xe=Ee?bi(Ee):window,Oe=xe.nodeName&&xe.nodeName.toLowerCase(),Oe==="select"||Oe==="input"&&xe.type==="file")var Ir=u1;else if(c1(xe))if(d1)Ir=P$;else{Ir=C$;var jt=T$}else Oe=xe.nodeName,!Oe||Oe.toLowerCase()!=="input"||xe.type!=="checkbox"&&xe.type!=="radio"?Ee&&nn(Ee.elementType)&&(Ir=u1):Ir=x$;if(Ir&&(Ir=Ir(s,Ee))){l1(We,Ir,p,Ue);break e}jt&&jt(s,xe,Ee),s==="focusout"&&Ee&&xe.type==="number"&&Ee.memoizedProps.value!=null&&Jc(xe,"number",xe.value)}switch(jt=Ee?bi(Ee):window,s){case"focusin":(c1(jt)||jt.contentEditable==="true")&&(Pd=jt,N0=Ee,$p=null);break;case"focusout":$p=N0=Pd=null;break;case"mousedown":I0=!0;break;case"contextmenu":case"mouseup":case"dragend":I0=!1,_1(We,p,Ue);break;case"selectionchange":if(R$)break;case"keydown":case"keyup":_1(We,p,Ue)}var ir;if(A0)e:{switch(s){case"compositionstart":var wr="onCompositionStart";break e;case"compositionend":wr="onCompositionEnd";break e;case"compositionupdate":wr="onCompositionUpdate";break e}wr=void 0}else xd?s1(s,p)&&(wr="onCompositionEnd"):s==="keydown"&&p.keyCode===229&&(wr="onCompositionStart");wr&&(n1&&p.locale!=="ko"&&(xd||wr!=="onCompositionStart"?wr==="onCompositionEnd"&&xd&&(ir=ac()):(na=Ue,qn="value"in na?na.value:na.textContent,xd=!0)),jt=Fy(Ee,wr),0<jt.length&&(wr=new oc(wr,s,null,p,Ue),We.push({event:wr,listeners:jt}),ir?wr.data=ir:(ir=o1(p),ir!==null&&(wr.data=ir)))),(ir=b$?k$(s,p):w$(s,p))&&(wr=Fy(Ee,"onBeforeInput"),0<wr.length&&(jt=new oc("onBeforeInput","beforeinput",null,p,Ue),We.push({event:jt,listeners:wr}),jt.data=ir)),p8(We,s,Ee,p,Ue)}H2(We,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=ta(s,p),k!=null&&y.unshift(hh(s,k,S)),k=ta(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,ie=V.alternate,Ee=V.stateNode;if(V=V.tag,ie!==null&&ie===y)break;V!==5&&V!==26&&V!==27||Ee===null||(ie=Ee,k?(Ee=ta(p,S),Ee!=null&&M.unshift(hh(p,Ee,ie))):k||(Ee=ta(p,S),Ee!=null&&M.push(hh(p,Ee,ie)))),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":uo(s,"class",y);break;case"tabIndex":uo(s,"tabindex",y);break;case"dir":case"role":case"viewBox":case"width":case"height":uo(s,p,y);break;case"style":Nr(s,y,S);break;case"data":if(l!=="object"){uo(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=Rs(""+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=Rs(""+y),s.setAttribute(p,y);break;case"onClick":y!=null&&(s.onclick=_a);break;case"onScroll":y!=null&&vr("scroll",s);break;case"onScrollEnd":y!=null&&vr("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=Rs(""+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":vr("beforetoggle",s),vr("toggle",s),nc(s,"popover",y);break;case"xlinkActuate":ya(s,"http://www.w3.org/1999/xlink","xlink:actuate",y);break;case"xlinkArcrole":ya(s,"http://www.w3.org/1999/xlink","xlink:arcrole",y);break;case"xlinkRole":ya(s,"http://www.w3.org/1999/xlink","xlink:role",y);break;case"xlinkShow":ya(s,"http://www.w3.org/1999/xlink","xlink:show",y);break;case"xlinkTitle":ya(s,"http://www.w3.org/1999/xlink","xlink:title",y);break;case"xlinkType":ya(s,"http://www.w3.org/1999/xlink","xlink:type",y);break;case"xmlBase":ya(s,"http://www.w3.org/XML/1998/namespace","xml:base",y);break;case"xmlLang":ya(s,"http://www.w3.org/XML/1998/namespace","xml:lang",y);break;case"xmlSpace":ya(s,"http://www.w3.org/XML/1998/namespace","xml:space",y);break;case"is":nc(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=xn.get(p)||p,nc(s,p,y))}}function iw(s,l,p,y,k,S){switch(p){case"style":Nr(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&&vr("scroll",s);break;case"onScrollEnd":y!=null&&vr("scrollend",s);break;case"onClick":y!=null&&(s.onclick=_a);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ps.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[xt]||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,""):nc(s,p,y)}}}function Sa(s,l,p){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":vr("error",s),vr("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":vr("invalid",s);var V=S=M=k=null,ie=null,Ee=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":ie=Ue;break;case"defaultChecked":Ee=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)}}ki(s,S,V,ie,Ee,M,k,!1);return;case"select":vr("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":vr("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(ie in p)if(p.hasOwnProperty(ie)&&(y=p[ie],y!=null))switch(ie){case"selected":s.selected=y&&typeof y!="function"&&typeof y!="symbol";break;default:Qr(s,l,ie,y,p,null)}return;case"dialog":vr("beforetoggle",s),vr("toggle",s),vr("cancel",s),vr("close",s);break;case"iframe":case"object":vr("load",s);break;case"video":case"audio":for(y=0;y<ph.length;y++)vr(ph[y],s);break;case"image":vr("error",s),vr("load",s);break;case"details":vr("toggle",s);break;case"embed":case"source":case"link":vr("error",s),vr("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(Ee in p)if(p.hasOwnProperty(Ee)&&(y=p[Ee],y!=null))switch(Ee){case"children":case"dangerouslySetInnerHTML":throw Error(n(137,l));default:Qr(s,l,Ee,y,p,null)}return;default:if(nn(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,ie=null,Ee=null,Ue=null;for(Oe in p){var We=p[Oe];if(p.hasOwnProperty(Oe)&&We!=null)switch(Oe){case"checked":break;case"value":break;case"defaultValue":ie=We;default:y.hasOwnProperty(Oe)||Qr(s,l,Oe,null,y,We)}}for(var xe in y){var Oe=y[xe];if(We=p[xe],y.hasOwnProperty(xe)&&(Oe!=null||We!=null))switch(xe){case"type":S=Oe;break;case"name":k=Oe;break;case"checked":Ee=Oe;break;case"defaultChecked":Ue=Oe;break;case"value":M=Oe;break;case"defaultValue":V=Oe;break;case"children":case"dangerouslySetInnerHTML":if(Oe!=null)throw Error(n(137,l));break;default:Oe!==We&&Qr(s,l,xe,Oe,y,We)}}po(s,M,V,ie,Ee,Ue,S,k);return;case"select":Oe=M=V=xe=null;for(S in p)if(ie=p[S],p.hasOwnProperty(S)&&ie!=null)switch(S){case"value":break;case"multiple":Oe=ie;default:y.hasOwnProperty(S)||Qr(s,l,S,null,y,ie)}for(k in y)if(S=y[k],ie=p[k],y.hasOwnProperty(k)&&(S!=null||ie!=null))switch(k){case"value":xe=S;break;case"defaultValue":V=S;break;case"multiple":M=S;default:S!==ie&&Qr(s,l,k,S,y,ie)}l=V,p=M,y=Oe,xe!=null?_e(s,!!p,xe,!1):!!y!=!!p&&(l!=null?_e(s,!!p,l,!0):_e(s,!!p,p?[]:"",!1));return;case"textarea":Oe=xe=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":xe=k;break;case"defaultValue":Oe=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,xe,Oe);return;case"option":for(var At in p)if(xe=p[At],p.hasOwnProperty(At)&&xe!=null&&!y.hasOwnProperty(At))switch(At){case"selected":s.selected=!1;break;default:Qr(s,l,At,null,y,xe)}for(ie in y)if(xe=y[ie],Oe=p[ie],y.hasOwnProperty(ie)&&xe!==Oe&&(xe!=null||Oe!=null))switch(ie){case"selected":s.selected=xe&&typeof xe!="function"&&typeof xe!="symbol";break;default:Qr(s,l,ie,xe,y,Oe)}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 Wt in p)xe=p[Wt],p.hasOwnProperty(Wt)&&xe!=null&&!y.hasOwnProperty(Wt)&&Qr(s,l,Wt,null,y,xe);for(Ee in y)if(xe=y[Ee],Oe=p[Ee],y.hasOwnProperty(Ee)&&xe!==Oe&&(xe!=null||Oe!=null))switch(Ee){case"children":case"dangerouslySetInnerHTML":if(xe!=null)throw Error(n(137,l));break;default:Qr(s,l,Ee,xe,y,Oe)}return;default:if(nn(l)){for(var Zr in p)xe=p[Zr],p.hasOwnProperty(Zr)&&xe!==void 0&&!y.hasOwnProperty(Zr)&&iw(s,l,Zr,void 0,y,xe);for(Ue in y)xe=y[Ue],Oe=p[Ue],!y.hasOwnProperty(Ue)||xe===Oe||xe===void 0&&Oe===void 0||iw(s,l,Ue,xe,y,Oe);return}}for(var ye in p)xe=p[ye],p.hasOwnProperty(ye)&&xe!=null&&!y.hasOwnProperty(ye)&&Qr(s,l,ye,null,y,xe);for(We in y)xe=y[We],Oe=p[We],!y.hasOwnProperty(We)||xe===Oe||xe==null&&Oe==null||Qr(s,l,We,xe,y,Oe)}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 ie=p[y],Ee=ie.startTime;if(Ee>V)break;var Ue=ie.transferSize,We=ie.initiatorType;Ue&&X2(We)&&(ie=ie.responseEnd,M+=Ue*(ie<V?1:(V-Ee)/(ie-Ee)))}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[mr]||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),rc(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[mr])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=es(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=es(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=es(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 es(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 es(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]);rc(s)}var ts=new Map,oD=new Set;function zy(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var wc=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=wc.f(),l=Ny();return s||l}function R8(s){var l=Cs(s);l!==null&&l.tag===5&&l.type==="form"?ER(l):wc.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=ua(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"),Sa(l,"link",s),mn(l),y.head.appendChild(l)))}}function D8(s){wc.D(s),cD("dns-prefetch",s,null)}function O8(s,l){wc.C(s,l),cD("preconnect",s,l)}function N8(s,l,p){wc.L(s,l,p);var y=Qd;if(y&&s&&l){var k='link[rel="preload"][as="'+ua(l)+'"]';l==="image"&&p&&p.imageSrcSet?(k+='[imagesrcset="'+ua(p.imageSrcSet)+'"]',typeof p.imageSizes=="string"&&(k+='[imagesizes="'+ua(p.imageSizes)+'"]')):k+='[href="'+ua(s)+'"]';var S=k;switch(l){case"style":S=Zd(s);break;case"script":S=ef(s)}ts.has(S)||(s=h({rel:"preload",href:l==="image"&&p&&p.imageSrcSet?void 0:s,as:l},p),ts.set(S,s),y.querySelector(k)!==null||l==="style"&&y.querySelector(gh(S))||l==="script"&&y.querySelector(yh(S))||(l=y.createElement("link"),Sa(l,"link",s),mn(l),y.head.appendChild(l)))}}function I8(s,l){wc.m(s,l);var p=Qd;if(p&&s){var y=l&&typeof l.as=="string"?l.as:"script",k='link[rel="modulepreload"][as="'+ua(y)+'"][href="'+ua(s)+'"]',S=k;switch(y){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":S=ef(s)}if(!ts.has(S)&&(s=h({rel:"modulepreload",href:s},l),ts.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"),Sa(y,"link",s),mn(y),p.head.appendChild(y)}}}function M8(s,l,p){wc.S(s,l,p);var y=Qd;if(y&&s){var k=ea(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=ts.get(S))&&hw(s,p);var ie=M=y.createElement("link");mn(ie),Sa(ie,"link",s),ie._p=new Promise(function(Ee,Ue){ie.onload=Ee,ie.onerror=Ue}),ie.addEventListener("load",function(){V.loading|=1}),ie.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){wc.X(s,l);var p=Qd;if(p&&s){var y=ea(p).hoistableScripts,k=ef(s),S=y.get(k);S||(S=p.querySelector(yh(k)),S||(s=h({src:s,async:!0},l),(l=ts.get(k))&&mw(s,l),S=p.createElement("script"),mn(S),Sa(S,"link",s),p.head.appendChild(S)),S={type:"script",instance:S,count:1,state:null},y.set(k,S))}}function L8(s,l){wc.M(s,l);var p=Qd;if(p&&s){var y=ea(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=ts.get(k))&&mw(s,l),S=p.createElement("script"),mn(S),Sa(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=ce.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=ea(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=ea(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),ts.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},ts.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=ea(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="'+ua(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}),Sa(l,"link",p),mn(l),s.head.appendChild(l))}function ef(s){return'[src="'+ua(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~="'+ua(p.href)+'"]');if(y)return l.instance=y,mn(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"),mn(y),Sa(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,mn(S),S;y=uD(p),(k=ts.get(k))&&hw(y,k),S=(s.ownerDocument||s).createElement("link"),mn(S);var M=S;return M._p=new Promise(function(V,ie){M.onload=V,M.onerror=ie}),Sa(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,mn(k),k):(y=p,(k=ts.get(S))&&(y=h({},p),mw(y,k)),s=s.ownerDocument||s,k=s.createElement("script"),mn(k),Sa(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[mr]||S[qt]||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,mn(S);return}S=l.ownerDocument||l,y=uD(y),(k=ts.get(k))&&hw(y,k),S=S.createElement("link"),mn(S);var M=S;M._p=new Promise(function(V,ie){M.onload=V,M.onerror=ie}),Sa(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:Z,_currentValue2:Z,_threadCount:0};function $8(s,l,p,y,k,S,M,V,ie){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=oe(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=oe(0),this.hiddenUpdates=oe(null),this.identifierPrefix=y,this.onUncaughtError=k,this.onCaughtError=S,this.onRecoverableError=M,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ie,this.incompleteTransitions=new Map}function mD(s,l,p,y,k,S,M,V,ie,Ee,Ue,We){return s=new $8(s,l,p,M,ie,Ee,Ue,We,V),l=1,S===!0&&(l|=24),S=Ti(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&&(ri(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&&ri(l,s,67108864),yw(s,67108864)}}function bD(s){if(s.tag===13||s.tag===31){var l=Ri();l=hn(l);var p=wu(s,l);p!==null&&ri(p,s,l),yw(s,l)}}var Ky=!0;function V8(s,l,p,y){var k=q.T;q.T=null;var S=Y.p;try{Y.p=2,vw(s,l,p,y)}finally{Y.p=S,q.T=k}}function H8(s,l,p,y){var k=q.T;q.T=null;var S=Y.p;try{Y.p=8,vw(s,l,p,y)}finally{Y.p=S,q.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=Cs(k);if(S!==null)switch(S.tag){case 3:if(S=S.stateNode,S.current.memoizedState.isDehydrated){var M=ue(S.pendingLanes);if(M!==0){var V=S;for(V.pendingLanes|=2,V.entangledLanes|=2;M;){var ie=1<<31-kt(M);V.entanglements[1]|=ie,M&=~ie}vo(S),(Ur&6)===0&&(Dy=bt()+500,fh(0))}}break;case 31:case 13:V=wu(S,2),V!==null&&ri(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=Ds(s),bw(s)}var Yy=null;function bw(s){if(Yy=null,s=$i(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(me()){case Be:return 2;case je:return 8;case nt:case Ct:return 32;case Mt: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=Cs(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=$i(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,Zt(s.priority,function(){bD(p)});return}}else if(l===31){if(l=c(p),l!==null){s.blockedOn=l,Zt(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=Cs(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=Cs(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(ie){return Jy(ie,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[xt]||null;if(typeof S=="function")M||TD(p);else if(M){var V=null;if(S&&S.hasAttribute("formAction")){if(k=S,M=S[xt]||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=Ri();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[fn]=null}};function Zy(s){this._internalRoot=s}Zy.prototype.unstable_scheduleHydration=function(s){if(s){var l=Fe();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:q,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),ke=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[fn]=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,ie=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&&(ie=p.formState)),l=mD(s,1,!0,l,p??null,y,k,ie,S,M,V,CD),l.context=gD(null),p=l.current,y=Ri(),y=hn(y),k=ol(y),k.callback=null,cl(p,k,y),p=y,l.current.lanes=p,Ne(l,p),vo(l),s[fn]=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 Tn(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function Qs(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),Tn(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;Tn(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=Nc([n,f.relativePath]),m=r.concat(f);o.children&&o.children.length>0&&(Tn(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:Nc([i,h.pathname]),pathnameBase:TV(Nc([i,h.pathnameBase])),route:m}),h.pathnameBase!=="/"&&(i=Nc([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){Qs(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 Qs(!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},Tn(!a.pathname||!a.pathname.includes("?"),Rw("?","pathname","search",a)),Tn(!a.pathname||!a.pathname.includes("#"),Rw("#","pathname","hash",a)),Tn(!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 Nc=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 no=v.createContext(null);no.displayName="Navigation";var Eg=v.createContext(null);Eg.displayName="Location";var ks=v.createContext({outlet:null,matches:[],isDataRoute:!1});ks.displayName="Route";var ux=v.createContext(null);ux.displayName="RouteError";function OV(t,{relative:e}={}){Tn(kp(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:n}=v.useContext(no),{hash:a,pathname:i,search:o}=Tg(t,{relative:e}),c=i;return r!=="/"&&(c=i==="/"?r:Nc([r,i])),n.createHref({pathname:c,search:o,hash:a})}function kp(){return v.useContext(Eg)!=null}function vi(){return Tn(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(no).static||v.useLayoutEffect(t)}function tn(){let{isDataRoute:t}=v.useContext(ks);return t?WV():NV()}function NV(){Tn(kp(),"useNavigate() may be used only in the context of a <Router> component.");let t=v.useContext(bp),{basename:e,navigator:r}=v.useContext(no),{matches:n}=v.useContext(ks),{pathname:a}=vi(),i=JSON.stringify(cx(n)),o=v.useRef(!1);return o3(()=>{o.current=!0}),v.useCallback((u,d={})=>{if(Qs(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:Nc([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(ks).outlet;return v.useMemo(()=>e&&v.createElement(IV.Provider,{value:t},e),[e,t])}function c3(){let{matches:t}=v.useContext(ks),e=t[t.length-1];return e?e.params:{}}function Tg(t,{relative:e}={}){let{matches:r}=v.useContext(ks),{pathname:n}=vi(),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){Tn(kp(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:i}=v.useContext(no),{matches:o}=v.useContext(ks),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=vi(),_;if(e){let D=typeof e=="string"?_p(e):e;Tn(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});Qs(h||E!=null,`No routes matched location "${_.pathname}${_.search}${_.hash}" `),Qs(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:Nc([f,i.encodeLocation?i.encodeLocation(D.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:D.pathname]),pathnameBase:D.pathnameBase==="/"?f:Nc([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(ks.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(ks.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);Tn(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 Tn(e,dx(t)),e}function $V(t){let e=v.useContext(xb);return Tn(e,dx(t)),e}function VV(t){let e=v.useContext(ks);return Tn(e,dx(t)),e}function fx(t){let e=VV(t),r=e.matches[e.matches.length-1];return Tn(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={})=>{Qs(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,Qs(!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}){Tn(kp(),"<Navigate> may be used only in the context of a <Router> component.");let{static:a}=v.useContext(no);Qs(!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(ks),{pathname:o}=vi(),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 vn(t){Tn(!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}){Tn(!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 Qs(_!=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(no.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}Tn(n.type===vn,`[${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>`),Tn(!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)?(Qs(!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=vi(),{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(no),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{Qs(!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=vi(),_=v.useContext(xb),{navigator:w,basename:b}=v.useContext(no),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 Tn(e,w7(t)),e}function S7(t,{target:e,replace:r,state:n,preventScrollReset:a,relative:i,viewTransition:o}={}){let c=tn(),u=vi(),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(no),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(no),n=v.useContext(ks);Tn(n,"useFormAction must be used inside a RouteContext");let[a]=n.matches.slice(-1),i={...Tg(t||".",{relative:e})},o=vi();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:Nc([r,i.pathname])),Cm(i)}function P7(t,{relative:e}={}){let r=v.useContext(i3);Tn(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(z=>R===z.name);if(j)return j.rtype==="promise"?z=>r.nativePromise(h,R.toString(),z):(z,U)=>r.nativeCallback(h,R.toString(),z,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(z=>{const U=D(z,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 z=await N;C({eventName:x,callbackId:z},R)},j=new Promise(z=>N.then(()=>z({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),Wr=D7(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),ao=Wr.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 Wr.Exception(e,Yf.Unimplemented)}unavailable(e="not available"){return new Wr.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)}}}ao("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"}))}}ao("CapacitorHttp",{web:()=>new L7});const B7="modulepreload",U7=function(t,e){return new URL(t,e).href},HD={},zr=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=ao("SocialLogin",{web:()=>zr(()=>import("./web-1wCjjZx1.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="craps"}catch{cT=void 0}const W7=H7??G7??cT,wp=W7??"unified",WD=wp==="ceelo",Ho=wp==="craps",Go=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",e9="com.zentaraone.crapsLounge.chips_1000",t9="com.zentaraone.pokerLounge.chips_1000",k3=Ho?e9:Go?t9:Z7,r9="",w3="Premium",n9="AIzaSyCmll0lLOqadkCyjlrM-bb5H4n1L8eMxkE",a9="dice-lounge.firebaseapp.com",i9="dice-lounge",s9="1:423374558927:web:283377221554368e57c9ba",o9="G-MYPNJQR9RN",c9="dicelounge.app",l9="PEcc15f3HTqKKafnvHp1yRrbxrS8ji1kzZ4dyS4R+fI=",u9="193765381581-rucls0d90bmpkqaj0ginhp87chgjq70j.apps.googleusercontent.com",mx="193765381581-s0a3p66cb39cdfum20jrm0d2e87jmlu8.apps.googleusercontent.com",d9=mx,f9=mx,p9=Ho?d9:Go?f9:mx,h9="com.zentaraone.ceeloLounge.service",m9="com.zentaraone.crapsLounge.service",g9="com.zentaraone.pokerLounge.service",y9=Ho?m9:Go?g9:h9,v9="https://dicelounge.app/api/auth/apple/callback",_9="com.zentaraone.ceeloLounge",b9="com.zentaraone.crapsLounge",k9="com.zentaraone.pokerLounge",w9=Ho?b9:Go?k9:_9,S9="ca-app-pub-4219446894372985/2712849620",E9="ca-app-pub-4219446894372985/4123145978",T9="ca-app-pub-4219446894372985/6524920361",C9="ca-app-pub-4219446894372985/9898216833",x9="ca-app-pub-4219446894372985/2585675356",P9="ca-app-pub-4219446894372985/5810604494",A9=Ho?E9:Go?T9:S9,XD=Ho?x9:Go?P9:C9,R9="ca-app-pub-4219446894372985/3451216225",D9="ca-app-pub-4219446894372985/9366706127",O9="ca-app-pub-4219446894372985/4109691778",N9="ca-app-pub-4219446894372985/2394103660",I9="ca-app-pub-4219446894372985/5020267007",M9="ca-app-pub-4219446894372985/8389694041",j9=Ho?D9:Go?O9:R9,JD=Ho?I9:Go?M9:N9,hf=100,QD=30,S3=3,E3=3,zh=6e4,$h=1500,gx=ao("SecureStoragePlugin",{web:()=>zr(()=>import("./web-DG1sMkzb.js"),[],import.meta.url).then(t=>new t.SecureStoragePluginWeb)}),gs=ao("Preferences",{web:()=>zr(()=>import("./web-BySaQxOf.js"),[],import.meta.url).then(t=>new t.PreferencesWeb)}),Ic=Object.freeze(Object.defineProperty({__proto__:null,Preferences:gs},Symbol.toStringTag,{value:"Module"})),rv="sess:";async function ZD(t){const{value:e}=await gs.get({key:t});return e??null}async function eO(t,e){await gs.set({key:t,value:e})}async function Nw(t){await gs.remove({key:t})}const Ys={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 gs.keys()).keys?.filter(r=>r.startsWith(rv))||[];await Promise.all(e.map(r=>Nw(r)))}catch{}}};async function Xf(t){try{const e=await Ys.getSession(t);return e?JSON.parse(e):null}catch{return null}}async function Ab(t,e){try{await Ys.setSession(t,JSON.stringify(e))}catch{}}async function Jf(t){try{await Ys.removeSession(t)}catch{}}const Qf="session_token",yx=Wr.isNativePlatform();async function Zf(t){yx?await gx.set({key:Qf,value:t}):await Ys.setSession(Qf,t)}async function ci(){if(yx)try{const{value:e}=await gx.get({key:Qf});return e||void 0}catch{return}return await Ys.getSession(Qf)||void 0}async function Cg(){if(yx)try{await gx.remove({key:Qf})}catch{}else await Ys.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 L9(){const t=Wr.getPlatform(),e={mode:"online"},r=u9,n=p9;e.clientId=r,e.webClientId=r,e.mode="online",e.iOSClientId=n;const a={mode:"online"},i=t==="ios"?w9:y9,o=v9;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=L9().then(()=>{nf.done=!0}).catch(e=>{throw nf.promise=void 0,e})}}async function T3(){try{await ep()}catch{}}function B9(){try{const t=Wr.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 U9(){await ep(!0);const e=Wr.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 F9(){await ep(!0);try{const e=Wr.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=Wr.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 q9(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:B9,signInWithAppleNative:U9,signInWithGoogleNative:F9,signOut:q9,prewarmNativeAuth:T3};let _o;function z9(){try{const t=Wr?.getPlatform?.();if(t)return t==="android"}catch{}try{return typeof navigator<"u"&&/Android/i.test(navigator.userAgent)}catch{return!1}}function $9(){try{const t=Wr?.getPlatform?.();if(t)return t==="ios"}catch{}try{return typeof navigator<"u"&&/iPhone|iPad|iPod/i.test(navigator.userAgent)}catch{return!1}}function V9(){try{const t=Wr?.getPlatform?.();return t&&["ios","android"].includes(t)?!0:!!window.Capacitor?.isNativePlatform?.()}catch{return!1}}function H9(){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 li(){if(_o)return _o;const t=z9(),e=$9(),r=V9();if(t||e&&r)return _o="https://dicelounge.app",_o;let n=null;if(!t&&!(e&&r)&&(n=H9()),n)return _o=n,_o;let a=!1;try{const i=window.location?.hostname;a=i==="localhost"||i==="127.0.0.1"}catch{}return a&&!(e&&r)?(_o="http://localhost:4000",_o):(_o="https://dicelounge.app",_o)}const Ll=li();let Fu=null,mf=0,gf=null;const G9=1e4;async function Rb(t){const e=t?.force===!0,r=t?.signal;return!e&&Fu&&Date.now()-mf<G9?Fu:!e&&gf?gf:(gf=(async()=>{try{let i=!1;try{i=!!P_.isNativePlatform?.()}catch{i=!1}let o=null;try{o=await ci()??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 ci()??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 W9(t){return(await fetch(`${Ll}/api/auth/verify-app?token=${encodeURIComponent(t)}`,{method:"GET",credentials:"include"})).json()}async function K9(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 Y9(){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 X9={};let Iw=!1,tp=null,af=null;function J9(){return{apiKey:n9,authDomain:a9,projectId:i9,appId:s9,measurementId:o9}}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 Q9(){if(Iw||!rm())return;try{if(typeof navigator<"u"&&/jsdom|playwright/i.test(navigator.userAgent||"")||typeof window<"u"&&window.__E2E===!0||typeof process<"u"&&(X9.VITEST||!1)){Iw=!0,nm("skip:init (test env heuristic)");return}}catch{}const t=J9();try{const[{initializeApp:e},{getAnalytics:r}]=await Promise.all([zr(()=>import("./index.esm-OyK67d2L.js"),__vite__mapDeps([0,1]),import.meta.url),zr(()=>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{zr(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||zr(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 Z9(t){const e=new Set([]);try{await gs.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 Wo=Object.create(null);Wo.open="0";Wo.close="1";Wo.ping="2";Wo.pong="3";Wo.message="4";Wo.upgrade="5";Wo.noop="6";const Uv=Object.create(null);Object.keys(Wo).forEach(t=>{Uv[Wo[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(Wo[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 eH(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 tH=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},rH=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:nH(t.substring(1),e)}:Uv[r]?t.length>1?{type:Uv[r],data:t.substring(1)}:{type:Uv[r]}:lT},nH=(t,e)=>{if(rH){const r=tH(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="",aH=(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))})})},iH=(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 sH(){return new TransformStream({transform(t,e){eH(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 oH(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 Jn(t){if(t)return cH(t)}function cH(t){for(var e in Jn.prototype)t[e]=Jn.prototype[e];return t}Jn.prototype.on=Jn.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this};Jn.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),this};Jn.prototype.off=Jn.prototype.removeListener=Jn.prototype.removeAllListeners=Jn.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};Jn.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};Jn.prototype.emitReserved=Jn.prototype.emit;Jn.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};Jn.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),us=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),lH="arraybuffer";function N3(t,...e){return e.reduce((r,n)=>(t.hasOwnProperty(n)&&(r[n]=t[n]),r),{})}const uH=us.setTimeout,dH=us.clearTimeout;function Ob(t,e){e.useNativeTimers?(t.setTimeoutFn=uH.bind(us),t.clearTimeoutFn=dH.bind(us)):(t.setTimeoutFn=us.setTimeout.bind(us),t.clearTimeoutFn=us.clearTimeout.bind(us))}const fH=1.33;function pH(t){return typeof t=="string"?hH(t):Math.ceil((t.byteLength||t.size)*fH)}function hH(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 mH(t){let e="";for(let r in t)t.hasOwnProperty(r)&&(e.length&&(e+="&"),e+=encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e}function gH(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 yH extends Error{constructor(e,r,n){super(e),this.description=r,this.context=n,this.type="TransportError"}}class bx extends Jn{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 yH(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=mH(e);return r.length?"?"+r:""}}class vH 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)};iH(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,aH(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 _H=M3;function bH(){}class kH extends vH{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 Jn{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=bH,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 us?"pagehide":"unload";addEventListener(t,sO,!1)}}function sO(){for(let t in If.requests)If.requests.hasOwnProperty(t)&&If.requests[t].abort()}const wH=(function(){const t=j3({xdomain:!1});return t&&t.responseType!==null})();class SH extends kH{constructor(e){super(e);const r=e&&e.forceBase64;this.supportsBinary=wH&&!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||_H))return new XMLHttpRequest}catch{}if(!e)try{return new us[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const L3=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class EH 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=us.WebSocket||us.MozWebSocket;class TH extends EH{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 CH 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=oH(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(r).getReader(),a=sH();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 xH={websocket:TH,webtransport:CH,polling:SH},PH=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,AH=["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=PH.exec(t||""),i={},o=14;for(;o--;)i[AH[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=RH(i,i.path),i.queryKey=DH(i,i.query),i}function RH(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 DH(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 Jn{constructor(e,r){if(super(),this.binaryType=lH,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=gH(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+=pH(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 OH 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 NH=class extends OH{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=>xH[a]).filter(a=>!!a)),super(e,n)}};function IH(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 MH=typeof ArrayBuffer=="function",jH=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,B3=Object.prototype.toString,LH=typeof Blob=="function"||typeof Blob<"u"&&B3.call(Blob)==="[object BlobConstructor]",BH=typeof File=="function"||typeof File<"u"&&B3.call(File)==="[object FileConstructor]";function kx(t){return MH&&(t instanceof ArrayBuffer||jH(t))||LH&&t instanceof Blob||BH&&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 UH(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 FH(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 qH=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],zH=5;var Pr;(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"})(Pr||(Pr={}));class $H{constructor(e){this.replacer=e}encode(e){return(e.type===Pr.EVENT||e.type===Pr.ACK)&&zv(e)?this.encodeAsBinary({type:e.type===Pr.EVENT?Pr.BINARY_EVENT:Pr.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let r=""+e.type;return(e.type===Pr.BINARY_EVENT||e.type===Pr.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=UH(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 Jn{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===Pr.BINARY_EVENT;n||r.type===Pr.BINARY_ACK?(r.type=n?Pr.EVENT:Pr.ACK,this.reconstructor=new VH(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(Pr[n.type]===void 0)throw new Error("unknown packet type "+n.type);if(n.type===Pr.BINARY_EVENT||n.type===Pr.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 Pr.CONNECT:return oO(r);case Pr.DISCONNECT:return r===void 0;case Pr.CONNECT_ERROR:return typeof r=="string"||oO(r);case Pr.EVENT:case Pr.BINARY_EVENT:return Array.isArray(r)&&(typeof r[0]=="number"||typeof r[0]=="string"&&qH.indexOf(r[0])===-1);case Pr.ACK:case Pr.BINARY_ACK:return Array.isArray(r)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class VH{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=FH(this.reconPack,this.buffers);return this.finishedReconstruction(),r}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const HH=Object.freeze(Object.defineProperty({__proto__:null,Decoder:wx,Encoder:$H,get PacketType(){return Pr},protocol:zH},Symbol.toStringTag,{value:"Module"}));function qs(t,e,r){return t.on(e,r),function(){t.off(e,r)}}const GH=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class U3 extends Jn{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=[qs(e,"open",this.onopen.bind(this)),qs(e,"packet",this.onpacket.bind(this)),qs(e,"error",this.onerror.bind(this)),qs(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(GH.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:Pr.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:Pr.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 Pr.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 Pr.EVENT:case Pr.BINARY_EVENT:this.onevent(e);break;case Pr.ACK:case Pr.BINARY_ACK:this.onack(e);break;case Pr.DISCONNECT:this.ondisconnect();break;case Pr.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:Pr.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:Pr.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 Jn{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||HH;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 NH(this.uri,this.opts);const r=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const a=qs(r,"open",function(){n.onopen(),e&&e()}),i=c=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",c),e?e(c):this.maybeReconnectOnOpen()},o=qs(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(qs(e,"ping",this.onping.bind(this)),qs(e,"data",this.ondata.bind(this)),qs(e,"error",this.onerror.bind(this)),qs(e,"close",this.onclose.bind(this)),qs(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=IH(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),WH=({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})},Qo=()=>{const t=v.useContext(q3);if(!t)throw new Error("useDiceReveal must be used within a DiceRevealProvider");return t},z3=v.createContext(null);let Ma=null,cO="",Vv=0,$3=0,lO=0;const KH=1200;let Sx=!1,uO=0;const YH=2e3;function Gs(t,e){if(!t||t.connected||t.active||Sx)return!1;const r=Date.now();if(r<uO)return!1;uO=r+YH;try{t.connect()}catch{}return!0}function XH(){Sx=!1}function V3(){Sx=!0}function Ex(t=2e3){try{Vv=Date.now()+Math.max(0,t|0)}catch{}}function JH(t=2e3){try{Ex(t)}catch{}try{Ma?.removeAllListeners()}catch{}try{Zu(Ma,"SocketContext: hardDisconnectSocket")}catch{}}function QH(){const t=Ma;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 ZH(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(Ma&&cO===t)return Ma;if(Ma){try{Ma.removeAllListeners()}catch{}try{F3(Ma,"SocketContext: getSharedSocket replace")}catch{}Ma=null}Ma=ZH(t),cO=t;try{if(typeof window<"u"){(window.location?.search||"").includes("e2e=1")&&(window.__SOCKET=Ma,window.__sharedSocket=Ma,window.hardDisconnectSocket=JH,window.suspendSocketAutoConnect=Ex);try{if(!window.__clientErrMon){window.__clientErrMon=!0;const r=a=>{try{const i=window.__sharedSocket||Ma;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{}}),Ma.on("connect",()=>{try{const a=Ma,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 Ma}function tG({children:t}){const{user:e,initialized:r}=Vr(),n=li(),a=v.useMemo(()=>eG(n),[n]),{resetSpin:i}=Qo();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 ci();if(o)return;if(f){const h=u(),m=`t:${f}`;if(a.auth={token:f},c(m),a.disconnected)d(()=>{o||(Gs(a),i())});else if(h!==m){const _=Date.now();_-lO>=KH&&(lO=_,d(()=>{if(!o){try{Zu(a,"SocketContext: auth change soft reconnect")}catch{}setTimeout(()=>{o||(Gs(a),i())},100)}}))}}}})(),()=>{o=!0}},[r,e,a]),v.useEffect(()=>{const o=async()=>{if(Date.now()<Vv)return;const c=await ci();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 ci();a.auth=d?{token:d}:{platform:"web",guest:!0}}catch{}try{if(a.connected)try{Zu(a,"SocketContext: OTA forceReconnect")}catch{}setTimeout(()=>{o||(Gs(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 ci();if(o||!m)return;a.auth={token:m}}catch{}a.disconnected&&(Gs(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 ws(){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:""}),Vr=()=>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=vi(),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){XH(),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 Z9()}catch{}r(null),a("");try{Mw(null)}catch{}try{QH()}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 Li({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}=Vr(),n=vi(),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(Li,{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),Mc=typeof window<"u"?window.Capacitor:void 0,Nb=!!Mc&&typeof Mc.isNativePlatform=="function"&&Mc.isNativePlatform(),qr=Mc&&(Mc.Plugins?.NativeAudio||Mc.NativeAudio)||void 0,Ep=Nb&&!!qr,Tx=Nb&&gd,bG=Nb&&!gd;let Ko=!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"],Bi={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 ds=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||!qr)throw new Error("Native audio not available");if(ds.has(t))return;const r=zw.get(t);if(r){if(await r,!ds.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 qr.preload({assetId:t,assetPath:n.path}),ds.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||!qr)throw new Error("Native audio not available");if(!Mb(t))throw new Error("Native audio cooldown active");try{if(await jb(t,e),!ds.has(t))throw new Error("Asset not loaded");if(r?.volume!=null&&qr.setVolume)try{await qr.setVolume({assetId:t,volume:Ya(r.volume,0,1)})}catch{}await qr.play({assetId:t}),r?.durationMs&&r.durationMs>0&&window.setTimeout(()=>{try{qr.stop({assetId:t})}catch{}},Math.max(10,Math.floor(r.durationMs)))}catch(n){throw Xl(t),n}}function Px(t){const e=new Audio(Bi[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",()=>jo(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 jo(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{ds.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,Gn=null,jc=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{}jo(t,r)})});try{iv&&(iv.pause(),iv.currentTime=0)}catch{}try{Gn&&(Gn.pause(),Gn.currentTime=0)}catch{}iv=null,Gn=null;try{const t=Object.keys(Bi);for(const e of t){const r=ap?.[e];if(r){try{r.pause(),r.currentTime=0}catch{}ap[e]=null}Lc[e]&&(window.clearTimeout(Lc[e]),delete Lc[e])}if(Ep&&qr){for(const e of Object.keys(Bi))if(ds.has(e)){try{wf(qr.stop({assetId:e}))}catch{}try{qr.unload&&wf(qr.unload({assetId:e}))}catch{}try{ds.delete(e)}catch{}}if(ds.has("loop_dice_whirr")){try{wf(qr.stop({assetId:"loop_dice_whirr"}))}catch{}try{qr.unload&&wf(qr.unload({assetId:"loop_dice_whirr"}))}catch{}try{ds.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&&qr&&Mb(t))try{return(async()=>{try{if(await jb(t,Bi[t]),ds.has(t)){if(qr.setVolume)try{await qr.setVolume({assetId:t,volume:Ya(e,0,1)})}catch{}await qr.play({assetId:t})}}catch{Xl(t)}})(),!0}catch{Xl(t)}if(!Ko||gd&&xx)return!1;try{const n=Ax(t);if(!n){const i=new Audio(Bi[t]);return i.volume=hi(t,e),i.play().catch(()=>{}),!0}return lu(t).busy.add(n),Yl++,n.currentTime=0,n.volume=hi(t,e),n.play().catch(()=>jo(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||!Ko||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=hi(t,e.volume)),e?.rate!=null&&(r.playbackRate=Ya(e.rate,.25,4));const a=e?.durationMs&&e.durationMs>0?window.setTimeout(()=>{try{r.pause(),r.currentTime=0}catch{}jo(t,r)},Math.max(10,Math.floor(e.durationMs))):null;Am(()=>{r.play().catch(()=>{a&&window.clearTimeout(a),jo(t,r)})})}catch{jo(t,r)}}async function ys(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&&qr&&Mb(t)){(async()=>{try{await TG(t,Bi[t],{volume:e?.volume,durationMs:e?.durationMs})}catch{Xl(t)}})();return}if(!Ko||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=hi(t,e.volume)),e?.rate!=null&&(a.playbackRate=Ya(e.rate,.25,4));const o=e?.durationMs&&e.durationMs>0?window.setTimeout(()=>{try{a.pause(),a.currentTime=0}catch{}jo(t,a)},Math.max(10,Math.floor(e.durationMs))):null;if(!await Lb(a,1e3)){Am(()=>{a.play().catch(()=>{o&&window.clearTimeout(o),jo(t,a)})});return}Am(()=>{a.play().catch(()=>{o&&window.clearTimeout(o),jo(t,a)})})}catch{jo(t,a)}}const Ya=(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 hi(t,e){const r=Ya(e,0,1);if(gd){const n=DG[t];if(typeof n=="number")return Ya(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=Bi[e],n.load()}catch{}})}),Rx())}function OG(){try{D_()}catch{}}function NG(){CG();try{mT()}catch{}Rx()}try{const t=Mc&&(Mc.Plugins?.App||Mc.App)||void 0;Nb&&t?.addListener&&t.addListener("appStateChange",e=>{!!(e&&e.isActive)?NG():OG()})}catch{}async function Lr(){if(!Ko){Ko=!0,Pm=Date.now(),eB=Date.now()+Cx,Object.keys(Bi).forEach(t=>{try{lu(t)}catch{}});try{np()}catch{}try{if(Ep&&qr){const t=SG;Promise.resolve().then(async()=>{for(const e of t)try{await jb(e,Bi[e])}catch{}})}}catch{}}}function Dx(){return!!Ko}function np(t){const e=t&&t.length?t:Object.keys(Bi);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(Bi),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=Ya(t?.volume,0,1)*.5;ys("flash",{volume:hi("flash",r)})}function MG(t){ys("chip",{volume:hi("chip",t?.volume??.25),durationMs:t?.durationMs??500,rate:t?.playbackRate})}function jG(t){ys("cardSwoosh",{volume:hi("cardSwoosh",t?.volume),rate:t?.playbackRate??1})}function LG(t){ys("lose",{volume:hi("lose",t?.volume)})}function BG(t){ys("push",{volume:hi("push",t?.volume)})}function UG(t){const e=Ya(t?.volume,0,1),r=hi("win",e);ys("winDing",{volume:.025}),ys("win",{volume:hi("win",Ya(r*.35,0,1))})}function gT(t){ys("placeBets",{volume:hi("placeBets",t?.volume??.65)})}function yO(t){ys("pointSet",{volume:hi("pointSet",t?.volume??.15)})}function FG(t){ys("betPlaced",{volume:hi("betPlaced",t?.volume)})}function vO(t){const e=Ya(t?.sfxVolume??.15,0,1);ys("winDing",{volume:Ya(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 FSe(t){if(!Kl)return;const e=Ya(t?.volume,0,1),r=Ya(t?.playbackRate,.25,4);let n=!1;if(Ep&&qr&&Mb("loop_dice_whirr")){try{jb("loop_dice_whirr",K3).then(async()=>{try{if(R_||(qr.loop?await qr.loop({assetId:"loop_dice_whirr"}):await qr.play({assetId:"loop_dice_whirr"}),R_=!0),qr.setVolume)try{await qr.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{jc&&window.clearTimeout(jc),jc=window.setTimeout(()=>{try{Ox()}catch{}},8e3)}catch{}return}}Ko&&$w(e,r)}function $w(t,e){if(Ko)try{if(!Gn){Gn=new Audio(K3),Gn.loop=!0,Gn.preload="auto";try{Gn.playsInline=!0}catch{}Lb(Gn,800)}if(!Gn.paused){Gn.volume=t,Gn.playbackRate=e;return}Gn.volume=t,Gn.playbackRate=e,Gn.currentTime=0,Am(()=>{Gn&&Gn.play().catch(()=>{})}),jc&&window.clearTimeout(jc),jc=window.setTimeout(()=>{try{Ox()}catch{}},8e3)}catch{}}function Ox(){if(jc&&(window.clearTimeout(jc),jc=null),Ep&&qr)try{try{wf(qr.stop({assetId:"loop_dice_whirr"}))}catch{}try{qr.unload&&wf(qr.unload({assetId:"loop_dice_whirr"}))}catch{}try{ds.delete("loop_dice_whirr"),Ib("loop_dice_whirr")}catch{}R_=!1}catch{}try{Gn&&rB(Gn,120)}catch{}}function wf(t){try{return t&&typeof t.then=="function"?t.catch(()=>{}):Promise.resolve()}catch{return Promise.resolve()}}const ap={},Lc={};function qG(t,e){wG.includes(t)||ys(t,{volume:e?.volume,rate:e?.rate,durationMs:e?.durationMs})}function zG(t,e){if(!(!Kl||!Ko)&&!(Pm&&Date.now()-Pm<Cx))try{let r=ap[t];if(!r){r=new Audio(Bi[t]),r.loop=!0,r.preload="auto";try{r.playsInline=!0}catch{}ap[t]=r,Lb(r,800)}const n=Ya(e?.volume??.1,0,1),a=Ya(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(()=>{})}),Lc[t]&&window.clearTimeout(Lc[t]);const i=Math.max(5e3,Math.min(6e4,e?.maxMs??15e3));Lc[t]=window.setTimeout(()=>{try{nB(t)}catch{}},i)}catch{}}async function nB(t){try{Lc[t]&&(window.clearTimeout(Lc[t]),delete Lc[t]);const e=ap[t];if(!e)return;await rB(e,120),ap[t]=null}catch{}}function $G(){try{Lr()}catch{}}async function VG(t,e){try{if(t==="__probe__")return Promise.resolve(!!Ko);const r=t;return r in Bi?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{ds.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():(Gs(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{Gs(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{Gs(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{Gs(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)&&Lr()}const sB=li();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 Di(){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&&Gs(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:Di()}}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&&Gs(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 ma(){const t=ws(),{info:e}=cu(),r=v.useRef(0),n=v.useCallback(B=>{const Q=Date.now();if(!(Q-r.current<1200)){r.current=Q;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}=Vr(),u=v.useCallback(B=>{const Q=(()=>{const oe={};try{oe.name=String(B.name||"").trim().slice(0,60),(B.isPrivate===!0||B.isPrivate===!1)&&(oe.isPrivate=!!B.isPrivate),(B.singlePlayer===!0||B.singlePlayer===!1)&&(oe.singlePlayer=!!B.singlePlayer),typeof B.botsPerRoom=="number"&&Number.isInteger(B.botsPerRoom)&&(oe.botsPerRoom=B.botsPerRoom),(B.gameMode==="cee-lo"||B.gameMode==="craps")&&(oe.gameMode=B.gameMode)}catch{}return oe})();return a(St.CREATE_ROOM,Q).then(oe=>{try{oe&&oe.ok}catch{}return oe})},[a,o,c]),d=v.useCallback(async B=>{const Q=async()=>a(St.JOIN_ROOM,{roomId:B});let oe=await Q();if(oe&&oe.ok===!1&&/Room not found/i.test(String(oe.error||""))){try{await new Promise(Ne=>setTimeout(Ne,120))}catch{}oe=await Q(),oe&&oe.ok}if(oe&&oe.ok===!1&&oe.error===q7.SOCKET.NEEDS_PREMIUM)try{o(!0)}catch{}return oe},[a,o]),f=v.useCallback(B=>a(St.LEAVE_ROOM,{roomId:B}),[a]),h=v.useCallback(B=>i(St.LEAVE_ROOM,{roomId:B}),[i]),m=v.useCallback(B=>a(St.ROLL_DICE,{roomId:B}),[a]),_=v.useCallback(B=>a(St.CONFIRM_BETS,{roomId:B}),[a]),w=v.useCallback((B,Q)=>a(St.CRAPS_PLACE_PASS,{roomId:B,amount:Q}),[a]);v.useCallback((B,Q)=>a(St.CRAPS_PLACE_DONT_PASS,{roomId:B,amount:Q}),[a]);const b=v.useCallback((B,Q,oe)=>a(St.CRAPS_PLACE_ODDS,{roomId:B,amount:Q,passType:oe}),[a]),E=v.useCallback((B,Q,oe)=>a(St.CRAPS_PLACE_PLACE,{roomId:B,amount:Q,point:oe}),[a]),T=v.useCallback((B,Q)=>a(St.CRAPS_PLACE_FIELD,{roomId:B,amount:Q}),[a]),D=v.useCallback((B,Q,oe)=>a(St.CRAPS_PLACE_BIG,{roomId:B,amount:Q,kind:oe}),[a]),P=v.useCallback((B,Q)=>a(St.CRAPS_PLACE_COME,{roomId:B,amount:Q}),[a]),A=v.useCallback((B,Q)=>a(St.CRAPS_PLACE_DONT_COME,{roomId:B,amount:Q}),[a]),C=v.useCallback((B,Q,oe)=>a(St.CRAPS_PLACE_COME_ODDS,{roomId:B,point:Q,amount:oe}),[a]),O=v.useCallback((B,Q,oe)=>a(St.CRAPS_PLACE_DONT_COME_ODDS,{roomId:B,point:Q,amount:oe}),[a]),I=v.useCallback((B,Q)=>a(St.CRAPS_TOGGLE_PLACE_WORKING,{roomId:B,working:Q}),[a]),x=v.useCallback(async B=>{try{const Q=Y.current.get(B)||[],oe=Z.current.get(B);if(oe&&(clearTimeout(oe),Z.current.delete(B)),Q.length>0)if(Y.current.delete(B),Q.length>1)await a("craps:add_bets_batch",{roomId:B,bets:Q,eventId:Di()});else{const{type:Ne,amount:pt}=Q[0];await a("craps:add_bet",{roomId:B,type:Ne,amount:pt,eventId:Di()})}}catch{}try{const Q=G.current.get(B)||[],oe=F.current.get(B);if(oe&&(clearTimeout(oe),F.current.delete(B)),Q.length>0)if(G.current.delete(B),Q.length>1)await a("craps:remove_bets_batch",{roomId:B,bets:Q,eventId:Di()});else{const{type:Ne,amount:pt}=Q[0];await a("craps:remove_bet",{roomId:B,type:Ne,amount:pt,eventId:Di()})}}catch{}},[a]),R=v.useCallback(async B=>{try{if(!B)return{ok:!1,error:"no_room"}}catch{}try{await x(B)}catch{}return a(St.CRAPS_ROLL,{roomId:B})},[a,x]),N=v.useCallback(B=>a(St.CRAPS_READY,{roomId:B}),[a]),L=v.useCallback((B,Q)=>a(St.CRAPS_FETCH_HISTORY,{roomId:B,...Q||{}}),[a]),j=v.useCallback(B=>a("craps:get_state",{roomId:B}),[a]),z=v.useCallback(B=>a("craps:join_order",{roomId:B}),[a]),U=v.useCallback(B=>a("craps:leave_order",{roomId:B}),[a]),W=v.useCallback((B,Q)=>a("craps:set_order",{roomId:B,order:Q}),[a]),q=v.useCallback(B=>a("craps:reset_shooter",{roomId:B}),[a]),Y=v.useRef(new Map),Z=v.useRef(new Map),ae=1e3,G=v.useRef(new Map),F=v.useRef(new Map),K=1e3,ne=v.useCallback(B=>a("craps:list_bets",{roomId:B,eventId:Di()}),[a]),ee=v.useCallback((B,Q,oe)=>{const Ne=Y.current.get(B)||[];Ne.push({type:Q,amount:oe}),Y.current.set(B,Ne);const pt=Z.current.get(B);pt&&clearTimeout(pt);const Rt=setTimeout(()=>{const Ut=Y.current.get(B)||[];if(Ut.length!==0)if(Y.current.delete(B),Z.current.delete(B),Ut.length>1)a("craps:add_bets_batch",{roomId:B,bets:Ut,eventId:Di()});else{const{type:dr,amount:hn}=Ut[0];a("craps:add_bet",{roomId:B,type:dr,amount:hn,eventId:Di()})}},ae);return Z.current.set(B,Rt),Promise.resolve({ok:!0})},[a]),he=v.useCallback((B,Q)=>a("craps:add_bets_batch",{roomId:B,bets:Q,eventId:Di()}),[a]),ce=v.useCallback((B,Q)=>a("craps:remove_bets_batch",{roomId:B,bets:Q,eventId:Di()}),[a]),Pe=v.useCallback((B,Q,oe)=>{const Ne=G.current.get(B)||[];Ne.push({type:Q,amount:oe}),G.current.set(B,Ne);const pt=F.current.get(B);pt&&clearTimeout(pt);const Rt=setTimeout(()=>{const Ut=G.current.get(B)||[];if(Ut.length!==0)if(G.current.delete(B),F.current.delete(B),Ut.length>1)a("craps:remove_bets_batch",{roomId:B,bets:Ut,eventId:Di()});else{const{type:dr,amount:hn}=Ut[0];a("craps:remove_bet",{roomId:B,type:dr,amount:hn,eventId:Di()})}},K);return F.current.set(B,Rt),Promise.resolve({ok:!0})},[a]),Ge=v.useCallback(B=>a("craps:clear_bets",{roomId:B,eventId:Di()}),[a]),se=v.useCallback(B=>a("craps:summarize",{roomId:B}),[a]),Ce=v.useCallback(B=>a(St.BANKER_GIVE_UP,{roomId:B}),[a]),te=v.useCallback(async()=>{const B=async()=>a(St.GET_ROOMS_LIST,{});let Q=await B();return Q&&Q.ok===!1&&Q.error==="invalid_payload"&&(await new Promise(oe=>setTimeout(oe,80)),Q=await B()),Q},[a]),H=v.useCallback((B,Q)=>a(St.SPECTATE_SET,{roomId:B,spectate:Q}),[a]),pe=v.useCallback(async(B,Q)=>{const oe=await a(St.PLACE_MAIN_BET,{roomId:B,amount:Q});try{rp("bet_place",{game:"cee-lo",type:"MAIN",amount:Q})}catch{}return oe},[a]),Re=v.useCallback((B,Q)=>a(St.CANCEL_MAIN_BET,{roomId:B,wagerId:Q}),[a]),de=v.useCallback((B,Q)=>a(St.CREATE_SIDE_BET,{roomId:B,...Q}),[a]),Ie=v.useCallback((B,Q)=>a(St.ACCEPT_SIDE_BET,{roomId:B,wagerId:Q}),[a]),ct=v.useCallback((B,Q)=>a(St.CANCEL_SIDE_BET,{roomId:B,wagerId:Q}),[a]),Ve=v.useCallback(async B=>{if(!B)return{ok:!1,error:"no_room"};const Q={roomId:B},oe=await a(St.GET_WAGERS,Q);return oe&&oe.ok,oe},[a]),rt=v.useCallback(B=>a(St.RTC_JOIN,{roomId:B}),[a]),Ke=v.useCallback(B=>{try{t?.volatile?.emit?.(St.RTC_LEAVE,{roomId:B})}catch{}},[t]),it=v.useCallback(async(B,Q,oe)=>{try{await i(St.RTC_SIGNAL,{roomId:B,toPeerId:Q,payload:oe})}catch(Ne){const pt=String(Ne?.message||Ne||"");if(/disconnect|timeout|transport/i.test(pt)){await new Promise(Rt=>setTimeout(Rt,200));try{await i(St.RTC_SIGNAL,{roomId:B,toPeerId:Q,payload:oe})}catch{}}}},[i]),Et=v.useCallback((B,Q)=>a(St.RTC_SET_CAMERA_OWNER,{roomId:B,ownerId:Q}),[a]),It=v.useCallback(async(B,Q)=>{try{if(!B)return{ok:!1,error:"no_room"};const oe=await a(St.RTC_SET_VIDEO_ENABLED,{roomId:B,enabled:Q});return oe.ok,oe}catch{}},[a,o]),bt=v.useCallback((B,Q)=>a(St.ROOM_SEND_MESSAGE,{roomId:B,text:Q}),[a]),me=v.useCallback((B,Q)=>a(St.ROOM_FETCH_HISTORY,{roomId:B,sinceTs:Q}),[a]),Be=v.useCallback((B,Q)=>a(St.DM_SEND_MESSAGE,{toUserId:B,text:Q}),[a]),je=v.useCallback((B,Q)=>a(St.DM_FETCH_HISTORY,{peerUserId:B,sinceTs:Q}),[a]),nt=v.useCallback(()=>a(St.LOBBY_JOIN,{}),[a]),Ct=v.useCallback(()=>i(St.LOBBY_LEAVE,{}),[i]),Mt=v.useCallback(()=>a(St.LOBBY_LIST,{}),[a]),De=v.useCallback(B=>a(St.DELETE_ROOM,{roomId:B}),[a]),et=v.useCallback(()=>a(St.USER_GET_BALANCE,void 0),[a]),at=v.useCallback((B,Q)=>a(St.SEND_FRIEND_REQUEST,{toUserId:B,message:Q}),[a]),ke=v.useCallback(B=>a(St.CANCEL_FRIEND_REQUEST,{requestId:B}),[a]),st=v.useCallback((B,Q)=>a(St.RESPOND_FRIEND_REQUEST,{requestId:B,action:Q}),[a]),kt=v.useCallback(B=>a(St.UNFRIEND,{otherId:B}),[a]),nr=v.useCallback(B=>a(St.BLOCK_USER,{blockedId:B}),[a]),lr=v.useCallback(B=>a(St.UNBLOCK_USER,{blockedId:B}),[a]),ur=v.useCallback(()=>a(St.SOCIAL_GET_LIST,void 0),[a]),Er=v.useCallback((B,Q,oe)=>a(St.GAME_INVITE_SEND,{roomId:B,toUserId:Q,gameMode:oe}),[a]),dn=v.useCallback((B,Q)=>a(St.GAME_INVITE_RESPOND,{inviteId:B,action:Q}),[a]),J=v.useCallback(B=>a(St.USER_UPDATE_PROFILE,B),[a]),ue=v.useCallback(B=>a(St.BOTS_NUDGE,{roomId:B??null}),[a]),ve=v.useCallback(B=>a(St.ROOM_REFRESH_STATE,{roomId:B??null}),[a]),Ae=v.useCallback((B,Q)=>i("player:visibility",{roomId:B,visible:Q}),[i]);return{createRoom:u,joinRoom:d,leaveRoom:f,leaveRoomTearDown:h,getRoomsList:te,setSpectate:H,bankerGiveUp:Ce,pokerCreateRoom:v.useCallback(B=>{const Q={...B};let oe=Q.maxPlayers;if((typeof oe!="number"||!Number.isInteger(oe)||oe<1||oe>4)&&(oe=Q.singlePlayer?1:4),Q.maxPlayers=oe,typeof Q.startingStack=="number"){const Ne=Math.max(1,Math.min(1e6,Math.floor(Q.startingStack)));Q.startingStack=Ne}return a(St.POKER_ROOM_CREATE,Q)},[a,c,o]),pokerDeleteRoom:v.useCallback(B=>a(St.POKER_ROOM_DELETE,{roomId:B}),[a]),pokerJoinRoom:v.useCallback(async B=>a(St.POKER_JOIN_ROOM,{roomId:B}),[a]),pokerStartHand:v.useCallback(B=>a(St.POKER_START_HAND,{roomId:B}),[a]),pokerFold:v.useCallback(B=>a(St.POKER_ACT,{roomId:B,action:"fold"}),[a]),pokerCheck:v.useCallback(B=>a(St.POKER_ACT,{roomId:B,action:"check"}),[a]),pokerCall:v.useCallback(B=>a(St.POKER_ACT,{roomId:B,action:"call"}),[a]),pokerBet:v.useCallback((B,Q)=>a(St.POKER_ACT,{roomId:B,action:"bet",amount:Q}),[a]),pokerRaise:v.useCallback((B,Q)=>a(St.POKER_ACT,{roomId:B,action:"raise",amount:Q}),[a]),pokerFetchHistory:v.useCallback((B,Q,oe)=>a(St.POKER_FETCH_HISTORY,{roomId:B,limit:Q,beforeSeq:oe}),[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:z,crapsLeaveOrder:U,crapsSetOrder:W,crapsResetShooter:q,crapsListBets:ne,crapsAddBet:ee,crapsBatchAddBets:he,crapsRemoveBet:Pe,crapsBatchRemoveBets:ce,crapsClearBets:Ge,crapsSummarizeBets:se,placeMainBet:pe,cancelMainBet:Re,createSideBet:de,acceptSideBet:Ie,cancelSideBet:ct,getWagers:Ve,rtcJoin:rt,rtcLeave:Ke,rtcSignal:it,rtcSetCameraOwner:Et,rtcSetVideoEnabled:It,roomSendMessage:bt,roomFetchHistory:me,dmSendMessage:Be,dmFetchHistory:je,lobbyJoin:nt,lobbyLeave:Ct,lobbyList:Mt,deleteRoom:De,getUserBalance:et,sendFriendRequest:at,cancelFriendRequest:ke,respondFriendRequest:st,unfriend:kt,blockUser:nr,unblockUser:lr,getFriendsList:ur,sendGameInvite:Er,respondGameInvite:dn,updateProfile:J,botsNudge:ue,refreshRoomState:ve,sendVisibilityChange:Ae}}const qe={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 Ra(t){const e=ws(),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=me=>r.current.onLobbyRooms?.(me),a=me=>r.current.onRoomCreated?.(me),i=me=>r.current.onRoomUpdated?.(me),o=me=>r.current.onRoomDeleted?.(me),c=me=>r.current.onJoinedRoom?.(me),u=me=>r.current.onRejoinedRoom?.(me),d=me=>{r.current.onOtherPlayerJoined?.(me)},f=me=>{r.current.onOtherLeft?.(me)},h=me=>r.current.onBankerChanged?.(me),m=me=>r.current.onDiceRolled?.(me),_=()=>r.current.onNotYourTurn?.(),w=me=>r.current.onOtaUpdateAvailable?.(me),b=me=>r.current.onBetsUpdated?.(me),E=me=>r.current.onGetWagers?.(me),T=me=>r.current.onPlayerBalanceUpdated?.(me),D=me=>r.current.onSideBetCreated?.(me),P=me=>r.current.onSideBetAccepted?.(me),A=me=>r.current.onSideBetCanceled?.(me),C=me=>r.current.onForceLogout?.(me),O=me=>r.current.onError?.(me),I=me=>r.current.onRtcSignal?.(me),x=me=>r.current.onRtcPeerJoined?.(me),R=me=>r.current.onRtcPeerLeft?.(me),N=me=>r.current.onRtcCameraOwnerChanged?.(me),L=me=>r.current.onRtcVideoEnabled?.(me),j=me=>r.current.onRoomMessage?.(me),z=me=>r.current.onRoomHistory?.(me),U=me=>r.current.onDmMessage?.(me),W=me=>r.current.onDmHistory?.(me),q=me=>r.current.onFairnessReveal?.(me),Y=me=>r.current.onFriendRequestReceived?.(me),Z=me=>r.current.onFriendRequestCancelled?.(me),ae=me=>r.current.onFriendRequestResponded?.(me),G=me=>r.current.onUnfriended?.(me),F=me=>r.current.onUserBlocked?.(me),K=me=>r.current.onUserUnblocked?.(me),ne=me=>r.current.onGameInviteReceived?.(me),ee=me=>r.current.onTurnOrderUpdated?.(me),he=me=>r.current.onSpectatorsUpdated?.(me),ce=me=>r.current.onPlayerProfileUpdated?.(me),Pe=me=>r.current.onPlayerPresenceUpdate?.(me),Ge=me=>r.current.onPokerMyHole?.(me),se=me=>r.current.onPokerWinners?.(me),Ce=me=>r.current.onPokerRevealAll?.(me),te=me=>r.current.onPokerTimedOut?.(me),H=me=>r.current.onRoomUpdateState?.(me),pe=me=>me&&(!me.dice&&typeof me.d1=="number"&&typeof me.d2=="number"&&(me.dice=[me.d1,me.d2]),me.dice&&(typeof me.d1!="number"||typeof me.d2!="number")&&(me.d1=me.dice[0],me.d2=me.dice[1]),me.shooterId!==void 0&&me.currentRollerId===void 0&&(me.currentRollerId=me.shooterId),me.nextShooterId!==void 0&&me.nextRollerId===void 0&&(me.nextRollerId=me.nextShooterId),me),Re=me=>{r.current.onCrapsRollResult?.(pe(me))},de=me=>{r.current.onCrapsReadyUpdate?.(me)},Ie=me=>{r.current.onCrapsBetsUpdate?.(me)},ct=me=>{r.current.onCrapsBetDelta?.(me)},Ve=me=>{r.current.onCrapsBetResults?.(me)},rt=me=>{r.current.onCrapsBetError?.(me)},Ke=me=>{r.current.onCrapsPointSet?.(me)},it=me=>{r.current.onCrapsPointMade?.(me)},Et=()=>{e.on(qe.LOBBY_ROOMS,n),e.on(qe.ROOM_CREATED,a);try{e.on(qe.POKER_ROOM_CREATED,a)}catch{}e.on(qe.ROOM_UPDATED,i);try{e.on(qe.POKER_ROOM_UPDATED,i)}catch{}e.on(qe.ROOM_DELETED,o);try{e.on(qe.POKER_ROOM_DELETED,o)}catch{}e.on(qe.JOINED_ROOM,c);try{e.on(qe.POKER_JOINED_ROOM,c)}catch{}e.on(qe.REJOINED_ROOM,u),e.on(qe.OTHER_JOINED,d),e.on(qe.POKER_OTHER_JOINED,d),e.on(qe.OTHER_LEFT,f),e.on(qe.BANKER_CHANGED,h),e.on(qe.DICE_ROLLED,m),e.on(qe.NOT_YOUR_TURN,_),e.on(qe.OTA_UPDATE_AVAILABLE,w),e.on(qe.BETS_UPDATED,b),e.on(qe.GET_WAGERS,E),e.on(qe.PLAYER_BALANCE_UPDATED,T),e.on(qe.SIDE_BET_CREATED,D),e.on(qe.SIDE_BET_ACCEPTED,P),e.on(qe.SIDE_BET_CANCELED,A),e.on(qe.FORCE_LOGOUT,C),e.on(qe.ERROR,O),e.on(qe.RTC_SIGNAL,I),e.on(qe.RTC_PEER_JOINED,x),e.on(qe.RTC_PEER_LEFT,R),e.on(qe.RTC_CAMERA_OWNER_CHANGED,N),e.on(qe.RTC_VIDEO_ENABLED,L),e.on(qe.ROOM_MESSAGE,j),e.on(qe.ROOM_HISTORY,z),e.on(qe.DM_MESSAGE,U),e.on(qe.DM_HISTORY,W),e.on(qe.FAIRNESS_REVEAL,q),e.on(qe.FRIEND_REQUEST_RECEIVED,Y),e.on(qe.FRIEND_REQUEST_CANCELLED,Z),e.on(qe.FRIEND_REQUEST_RESPONDED,ae),e.on(qe.UNFRIENDED,G),e.on(qe.USER_BLOCKED,F),e.on(qe.USER_UNBLOCKED,K),e.on(qe.GAME_INVITE_RECEIVED,ne),e.on(qe.TURN_ORDER_UPDATED,ee),e.on(qe.SPECTATORS_UPDATED,he),e.on(qe.PLAYER_PROFILE_UPDATED,ce),e.on(qe.PLAYER_PRESENCE_UPDATE,Pe),e.on(qe.CRAPS_ROLL,Re),e.on(qe.CRAPS_READY_UPDATE,de),e.on(qe.CRAPS_BETS_UPDATE,Ie),e.on(qe.CRAPS_BET_DELTA,ct),e.on(qe.CRAPS_BET_RESULTS,Ve),e.on(qe.CRAPS_BET_ERROR,rt),e.on(qe.CRAPS_POINT_SET,Ke),e.on(qe.CRAPS_POINT_MADE,it),e.on(qe.POKER_MY_HOLE,Ge),e.on(qe.POKER_WINNERS,se),e.on(qe.POKER_REVEAL_ALL,Ce),e.on(qe.POKER_TIMED_OUT,te),e.on(qe.ROOM_UPDATE_STATE,H);const me=Be=>r.current.onCrapsState?.(Be);return e.on(qe.CRAPS_STATE,me),()=>{e.off(qe.LOBBY_ROOMS,n),e.off(qe.ROOM_CREATED,a);try{e.off(qe.POKER_ROOM_CREATED,a)}catch{}e.off(qe.ROOM_UPDATED,i);try{e.off(qe.POKER_ROOM_UPDATED,i)}catch{}e.off(qe.ROOM_DELETED,o);try{e.off(qe.POKER_ROOM_DELETED,o)}catch{}e.off(qe.JOINED_ROOM,c);try{e.off(qe.POKER_JOINED_ROOM,c)}catch{}e.off(qe.REJOINED_ROOM,u),e.off(qe.OTHER_JOINED,d);try{e.off(qe.POKER_OTHER_JOINED,d)}catch{}e.off(qe.OTHER_LEFT,f),e.off(qe.BANKER_CHANGED,h),e.off(qe.DICE_ROLLED,m),e.off(qe.NOT_YOUR_TURN,_),e.off(qe.OTA_UPDATE_AVAILABLE,w),e.off(qe.BETS_UPDATED,b),e.off(qe.GET_WAGERS,E),e.off(qe.PLAYER_BALANCE_UPDATED,T),e.off(qe.SIDE_BET_CREATED,D),e.off(qe.SIDE_BET_ACCEPTED,P),e.off(qe.SIDE_BET_CANCELED,A),e.off(qe.FORCE_LOGOUT,C),e.off(qe.ERROR,O),e.off(qe.RTC_SIGNAL,I),e.off(qe.RTC_PEER_JOINED,x),e.off(qe.RTC_PEER_LEFT,R),e.off(qe.RTC_CAMERA_OWNER_CHANGED,N),e.off(qe.RTC_VIDEO_ENABLED,L),e.off(qe.ROOM_MESSAGE,j),e.off(qe.ROOM_HISTORY,z),e.off(qe.DM_MESSAGE,U),e.off(qe.DM_HISTORY,W),e.off(qe.FAIRNESS_REVEAL,q),e.off(qe.FRIEND_REQUEST_RECEIVED,Y),e.off(qe.FRIEND_REQUEST_CANCELLED,Z),e.off(qe.FRIEND_REQUEST_RESPONDED,ae),e.off(qe.UNFRIENDED,G),e.off(qe.USER_BLOCKED,F),e.off(qe.USER_UNBLOCKED,K),e.off(qe.GAME_INVITE_RECEIVED,ne),e.off(qe.TURN_ORDER_UPDATED,ee),e.off(qe.SPECTATORS_UPDATED,he),e.off(qe.PLAYER_PROFILE_UPDATED,ce),e.off(qe.PLAYER_PRESENCE_UPDATE,Pe),e.off(qe.CRAPS_ROLL,Re),e.off(qe.CRAPS_READY_UPDATE,de),e.off(qe.CRAPS_BETS_UPDATE,Ie),e.off(qe.CRAPS_BET_DELTA,ct),e.off(qe.CRAPS_BET_RESULTS,Ve),e.off(qe.CRAPS_BET_ERROR,rt),e.off(qe.CRAPS_POINT_SET,Ke),e.off(qe.CRAPS_POINT_MADE,it),e.off(qe.POKER_MY_HOLE,Ge),e.off(qe.POKER_WINNERS,se),e.off(qe.POKER_REVEAL_ALL,Ce),e.off(qe.POKER_TIMED_OUT,te),e.off(qe.ROOM_UPDATE_STATE,H),e.off(qe.CRAPS_STATE)}};let It=Et();const bt=()=>{try{It&&It()}catch{}It=Et()};return e.on("connect",bt),e.on("reconnect",bt),()=>{e.off("connect",bt),e.off("reconnect",bt);try{It&&It()}catch{}}},[e])}function cB(){const{getRoomsList:t,createRoom:e,lobbyJoin:r,lobbyLeave:n}=ma(),[a,i]=v.useState({public:[],private:[]}),[o,c]=v.useState(!0),[u,d]=v.useState(null),{setMembershipModalOpen:f}=Bb(),{resetSpin:h}=Qo(),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(z=>setTimeout(z,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 z=180*L,U=Math.floor(Math.random()*140);await new Promise(W=>setTimeout(W,z+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(z=>z.public.some(U=>U.roomId===j.roomId)||z.private.some(U=>U.roomId===j.roomId)?z:j.private?{...z,private:[j,...z.private]}:{...z,public:[j,...z.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]),Ra({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}=ma(),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 Uo=ao("App",{web:()=>zr(()=>import("./web-A-JK9KbG.js"),[],import.meta.url).then(t=>new t.AppWeb)}),eW=Object.freeze(Object.defineProperty({__proto__:null,App:Uo},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},_t=(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,ni=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 Rr=()=>{};function IW(t){return t()}function N_(t){for(var e=0;e<t.length;e++)t[e]()}const Zs=2,yB=4,xg=8,qb=16,io=32,Pg=64,I_=128,yd=256,M_=512,mi=1024,Jl=2048,Ag=4096,Fo=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 ii(t,e){var r={f:0,v:t,reactions:null,equals:kB,rv:0,wv:0};return r}function sr(t){return SB(ii(t))}function zb(t,e=!1){var r;const n=ii(t);return e||(n.equals=Lx),Cp&&Or!==null&&Or.l!==null&&((r=Or.l).s??(r.s=[])).push(n),n}function Bs(t,e=!1){return SB(zb(t,e))}function SB(t){return $r!==null&&($r.f&Zs)!==0&&(qo===null?sK([t]):qo.push(t)),t}function ht(t,e){return $r!==null&&$x()&&($r.f&(Zs|qb))!==0&&(qo===null||!qo.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()&&cr!==null&&(cr.f&mi)!==0&&(cr.f&io)===0&&(ja!==null&&ja.includes(t)?(so(cr,Jl),Hb(cr)):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===cr||(so(o,e),(c&(mi|yd))!==0&&((c&Zs)!==0?EB(o,Ag):Hb(o))))}}let Bx=!1;function Gt(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=ii(0);i&&a.set("length",ii(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=ii(f.value),a.set(d,h)):ht(h,Gt(f.value,c)),!0},deleteProperty(u,d){var f=a.get(d);if(f===void 0)d in u&&a.set(d,ii(ni));else{if(i&&typeof d=="string"){var h=a.get("length"),m=Number(d);Number.isInteger(m)&&m<h.v&&ht(h,m)}ht(f,ni),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=ii(Gt(_?u[d]:ni,c)),a.set(d,m)),m!==void 0){var w=$(m);return w===ni?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&&_!==ni)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!==ni||Reflect.has(u,d);if(h!==void 0||cr!==null&&(!m||(f=Ul(u,d))!=null&&f.writable)){h===void 0&&(h=ii(m?Gt(u[d],c):ni),a.set(d,h));var _=$(h);if(_===ni)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?ht(E,ni):b in u&&(E=ii(ni),a.set(b+"",E))}_===void 0?(!w||(m=Ul(u,d))!=null&&m.writable)&&(_=ii(void 0),ht(_,Gt(f,c)),a.set(d,_)):(w=_.v!==ni,ht(_,Gt(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&&ht(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!==ni});for(var[f,h]of a)h.v!==ni&&!(f in u)&&d.push(f);return d},setPrototypeOf(){VW()}})}function TO(t,e=1){ht(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 Jt(t,e){{var r=sd(t);return r instanceof Comment&&r.data===""?$b(r):r}}function wt(t,e=1,r=!1){let n=t;for(;e--;)n=$b(n);return n}function XW(t){t.textContent=""}function $e(t){var e=Zs|Jl;cr===null?e|=yd:cr.f|=_B;var r=$r!==null&&($r.f&Zs)!==0?$r:null;const n={children:null,ctx:Or,deps:null,equals:kB,f:e,fn:t,reactions:null,rv:0,v:null,wv:0,parent:r??cr};return r!==null&&(r.children??(r.children=[])).push(n),n}function Mf(t){const e=$e(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&Zs)!==0?Ux(n):vs(n)}}}function JW(t){for(var e=t.parent;e!==null;){if((e.f&Zs)===0)return e;e=e.parent}return null}function PB(t){var e,r=cr;gi(JW(t));try{xB(t),e=zB(t)}finally{gi(r)}return e}function AB(t){var e=PB(t),r=(Il||(t.f&yd)!==0)&&t.deps!==null?Ag:mi;so(t,r),t.equals(e)||(t.v=e,t.wv=qB())}function Ux(t){xB(t),Mm(t,0),so(t,Tp),t.v=t.children=t.deps=t.ctx=t.reactions=null}function RB(t){cr===null&&$r===null&&FW(),$r!==null&&($r.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=cr,o={ctx:Or,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 vs(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),$r!==null&&($r.f&Zs)!==0)){var d=$r;(d.children??(d.children=[])).push(o)}return o}function ZW(){return $r===null?!1:!Il}function DB(t){const e=xp(xg,null,!1);return so(e,mi),e.teardown=t,e}function ip(t){RB();var e=cr!==null&&(cr.f&io)!==0&&Or!==null&&!Or.m;if(e){var r=Or;(r.e??(r.e=[])).push({fn:t,effect:cr,reaction:$r})}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,()=>{vs(e),n(void 0)}):(vs(e),n(void 0))})}function Vb(t){return xp(yB,t,!1)}function bo(t,e){var r=Or,n={effect:null,ran:!1};r.l.r1.push(n),n.effect=Dg(()=>{t(),!n.ran&&(n.ran=!0,ht(r.l.r2,!0),Yo(e))})}function rK(){var t=Or;Dg(()=>{if($(t.l.r2)){for(var e of t.l.r1){var r=e.effect;(r.f&mi)!==0&&so(r,Ag),Pp(r)&&Ng(r),e.ran=!1}t.l.r2.v=!1}})}function Dg(t){return xp(xg,t,!0)}function gt(t){return du(t)}function du(t,e=0){return xp(xg|qb|e,t,!0)}function hs(t,e=!0){return xp(xg|io,t,!0,e)}function OB(t){var e=t.teardown;if(e!==null){const r=zx,n=$r;PO(!0),_s(null);try{e.call(null)}finally{PO(r),_s(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;vs(r,e),r=n}}function nK(t){for(var e=t.first;e!==null;){var r=e.next;(e.f&io)===0&&vs(e),e=r}}function vs(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),so(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,()=>{vs(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&Fo)===0){if(t.f^=Fo,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&io)!==0;Fx(n,e,i?r:!1),n=a}}}function Om(t){LB(t,!0)}function LB(t,e){if((t.f&Fo)!==0){Pp(t)&&Ng(t),t.f^=Fo;for(var r=t.first;r!==null;){var n=r.next,a=(r.f&uu)!==0||(r.f&io)!==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,$r=null;function _s(t){$r=t}let cr=null;function gi(t){cr=t}let qo=null;function sK(t){qo=t}let ja=null,Oi=0,ql=null;function oK(t){ql=t}let FB=1,kT=0,Il=!1,Or=null;function AO(t){Or=t}function qB(){return++FB}function $x(){return!Cp||Or!==null&&Or.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&&cr!==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||cr!==null&&!Il)&&so(t,mi)}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=ja,n=Oi,a=ql,i=$r,o=Il,c=qo,u=Or,d=t.f;ja=null,Oi=0,ql=null,$r=(d&(io|Pg))===0?t:null,Il=!jf&&(d&yd)!==0,qo=null,Or=t.ctx,kT++;try{var f=(0,t.fn)(),h=t.deps;if(ja!==null){var m;if(Mm(t,Oi),h!==null&&Oi>0)for(h.length=Oi+ja.length,m=0;m<ja.length;m++)h[Oi+m]=ja[m];else t.deps=h=ja;if(!Il)for(m=Oi;m<h.length;m++)((e=h[m]).reactions??(e.reactions=[])).push(t)}else h!==null&&Oi<h.length&&(Mm(t,Oi),h.length=Oi);return f}finally{ja=r,Oi=n,ql=a,$r=i,Il=o,qo=c,Or=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&Zs)!==0&&(ja===null||!ja.includes(e))&&(so(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){so(t,mi);var r=cr,n=Or;cr=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{cr=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&mi)===0&&(a.f^=mi);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|Fo))===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|io))!==0){if((r&mi)===0)return;e.f^=mi}}Wu.push(e)}function HB(t,e){var r=t.first,n=[];e:for(;r!==null;){var a=r.f,i=(a&io)!==0,o=i&&(a&mi)!==0,c=r.next;if(!o&&(a&Fo)===0)if((a&xg)!==0){if(i)r.f^=mi;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&Zs)!==0;if(n&&(r&Tp)!==0){var a=PB(t);return Ux(t),a}if($r!==null){qo!==null&&qo.includes(t)&&HW();var i=$r.deps;t.rv<kT&&(t.rv=kT,ja===null&&i!==null&&i[Oi]===t?Oi++:ja===null?ja=[t]:ja.push(t),ql!==null&&cr!==null&&(cr.f&mi)!==0&&(cr.f&io)===0&&ql.includes(t)&&(so(cr,Jl),Hb(cr)))}else if(n&&t.deps===null)for(var o=t,c=o.parent,u=o;c!==null;)if((c.f&Zs)!==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 Yo(t){const e=$r;try{return $r=null,t()}finally{$r=e}}const hK=-7169;function so(t,e){t.f=t.f&hK|e}function Qn(t){return WB().get(t)}function ed(t,e){return WB().set(t,e),e}function WB(t){return Or===null&&qx(),Or.c??(Or.c=new Map(mK(Or)||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 Yt(t,e=!1,r){Or={p:Or,c:null,e:null,m:!1,s:t,x:null,l:null},Cp&&!e&&(Or.l={s:null,u:null,r1:[],r2:ii(!1)})}function Xt(t){const e=Or;if(e!==null){t!==void 0&&(e.x=t);const o=e.e;if(o!==null){var r=cr,n=$r;e.e=null;try{for(var a=0;a<o.length;a++){var i=o[a];gi(i.effect),_s(i.reaction),Vb(i.fn)}}finally{gi(r),_s(n)}}Or=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=$r,r=cr;_s(null),gi(null);try{return t()}finally{_s(e),gi(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 Lo(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=$r,m=cr;_s(null),gi(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,_s(h),gi(m)}}}function Hx(t){var e=document.createElement("template");return e.innerHTML=t,e.content}function cd(t,e){var r=cr;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 Zo(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 Fr(t=""){{var e=Rg(t+"");return cd(e,e),e}}function Sr(){var t=document.createDocumentFragment(),e=document.createComment(""),r=Rg();return t.append(e,r),cd(e,r),t}function be(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 hs(()=>{if(i){Yt({});var m=Or;m.c=i}a&&(n.$$events=a),L_=o,d=t(h,n)||{},L_=!0,i&&Xt()}),()=>{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 Pt(t,e,r=!1){var n=t,a=null,i=null,o=ni,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=hs(()=>m(n))),i&&od(i,()=>{i=null})):(i?Om(i):m&&(i=hs(()=>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)),vs(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=$r;kK(_,c,o,a,e,(b.f&Fo)!==0,n)}i!==null&&(w===0?f?Om(f):f=hs(()=>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&Fo)!==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],z;P=j.prev;var U=C[0],W=C[C.length-1];for(z=0;z<C.length;z+=1)DO(C[z],j,r);for(z=0;z<O.length;z+=1)D.delete(O[z]);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&Fo)===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 q=D===void 0?[]:Mx(D);T!==null;)(i||(T.e.f&Fo)===0)&&q.push(T),T=T.next;var Y=q.length;if(Y>0){var Z=(a&mB)!==0&&w===0?r:null;if(m){for(N=0;N<Y;N+=1)(f=q[N].a)==null||f.measure();for(N=0;N<Y;N+=1)(h=q[N].a)==null||h.fix()}bK(e,q,Z,b)}}m&&vd(()=>{var ae;if(A!==void 0)for(R of A)(ae=R.a)==null||ae.apply()}),cr.first=e.first&&e.first.e,cr.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):ii(a):a,_=(u&Ix)===0?o:ii(o),w={i:_,v:m,k:i,a:null,e:null,prev:r,next:n};try{return w.e=hs(()=>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&&(vs(c),c=void 0),o!==""&&(c=hs(()=>{var u=o+"",d=Hx(u);cd(sd(d),d.lastChild),i.before(d)})))})}function Nn(t,e,...r){var n=t,a=Rr,i;du(()=>{a!==(a=e())&&(i&&(vs(i),i=null),i=hs(()=>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=hs(()=>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):(vs(f),RO(!1))),h&&h!==c&&(f=hs(()=>{if(u=m?document.createElementNS(m,h):document.createElement(h),cd(u,u),n){var _=u.appendChild(Rg());n(u,_)}cr.nodes_end=u,d.before(u)})),o=h,o&&(c=o),RO(!0))},uu)}function Vt(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 Bt(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"&&Bt(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 Bc(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(),xc={tick:(t=>requestAnimationFrame(t)),now:()=>PK(),tasks:new Set};function ZB(){const t=xc.now();xc.tasks.forEach(e=>{e.c(t)||(xc.tasks.delete(e),e.f())}),xc.tasks.size!==0&&xc.tick(ZB)}function AK(t){let e;return xc.tasks.size===0&&xc.tick(ZB),{promise:new Promise(r=>{xc.tasks.add(e={c:t,f:r})}),abort(){xc.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=$r,P=cr;_s(null),gi(null);try{return d??(d=r()(e,n?.()??{},{direction:u}))}finally{_s(D),gi(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=cr;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(()=>{Yo(()=>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:Rr,deactivate:Rr,reset:Rr,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=Rr)},deactivate:()=>{a=Rr},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=[],Yo(()=>{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 Ss(t=!1){const e=Or,r=e.l.u;if(!r)return;let n=()=>Wv(e.s);if(t){let a=0,i={};const o=$e(()=>{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=Yo(()=>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 bs(t){Or===null&&qx(),Cp&&Or.l!==null?OK(Or).m.push(t):ip(()=>{const e=Yo(t);if(typeof e=="function")return e})}function Ig(t){Or===null&&qx(),bs(()=>()=>Yo(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),Rr;const n=Yo(()=>t.subscribe(e,r));return n.unsubscribe?()=>n.unsubscribe():n}let ov=!1;function ga(t,e,r){const n=r[e]??(r[e]={store:null,source:zb(void 0),unsubscribe:Rr});if(n.store!==t)if(n.unsubscribe(),n.store=t??null,t==null)n.source.v=void 0,n.unsubscribe=Rr;else{var a=!0;n.unsubscribe=nU(t,i=>{a?n.source.v=i:ht(n.source,i)}),a=!1}return $(n.source)}function NK(t,e){return t.set(e),e}function Da(){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=cr,r=cr;e!==null&&(e.f&(io|Pg))===0;)e=e.parent;try{return gi(e),t()}finally{gi(r)}}function Nt(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?_=Yo(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?$e: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(()=>$e(()=>{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?Gt(x):x;return I.equals(N)||(A=!0,ht(O,N),b&&_!==void 0&&(_=N),Yo(()=>$(I))),x}return $(I)}}function LO(t,e){var r=cr,n=$r,a=Or;gi(t),_s(t),AO(t.ctx);try{e()}finally{gi(r),_s(n),AO(a)}}function LK(t,e,r){var n=t,a;du(()=>{var i=cr,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=hs(()=>r(n)),Vw()})};u?.(c,f),a&&vs(a),d&&vd(()=>{LO(i,()=>{o=!0;try{a=hs(()=>{d(n,()=>c,()=>f)})}catch(h){Og(h,i,null,i.ctx)}Vw(),o=!1})})},a=hs(()=>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 Gr.ErrorSettingUpPurchase:return 2;case Gr.ErrorChargingPayment:return 20;case Gr.NetworkError:return 10;case Gr.MissingEmailError:return 4;case Gr.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 wn extends Error{constructor(e,r,n,a){super(r),_t(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 wn(n,om.getPublicMessage(n),r,{backendErrorCode:e})}static getForPurchasesFlowError(e){return new wn(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||{}),Ni=(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))(Ni||{});class er{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===Ni.Silent)){if(this.logHandler!==null){this.logHandler(r,n);return}switch(r){case Ni.Error:break;case Ni.Warn:break;case Ni.Info:break;case Ni.Debug:break;case Ni.Verbose:break}}}static errorLog(e){this.log(e,Ni.Error)}static warnLog(e){this.log(e,Ni.Warn)}static infoLog(e){this.log(e,Ni.Info)}static debugLog(e){this.log(e,Ni.Debug)}static verboseLog(e){this.log(e,Ni.Verbose)}}_t(er,"logLevel",Ni.Silent),_t(er,"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 Gr=(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))(Gr||{});class cn 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=cn.fromBackendErrorCode((n=e.extra)==null?void 0:n.backendErrorCode)??r,new cn(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){_t(this,"operationSessionId",null),_t(this,"backend"),_t(this,"eventsTracker"),_t(this,"maxNumberAttempts"),_t(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 wn)throw cn.fromPurchasesError(c,0);{const u="Unknown error starting purchase: "+String(c);throw er.errorLog(u),new cn(2,u)}}}async checkoutCalculateTax(e,r,n){const a=this.operationSessionId;if(!a)throw new cn(0,"No purchase started");try{return await this.backend.postCheckoutCalculateTax(a,e,r,n)}catch(i){if(i instanceof wn)throw cn.fromPurchasesError(i,0);{const o="Unknown error calculating tax: "+String(i);throw er.errorLog(o),new cn(2,o)}}}async checkoutComplete(e){const r=this.operationSessionId;if(!r)throw new cn(0,"No purchase started");try{return await this.backend.postCheckoutComplete(r,e)}catch(n){if(n instanceof wn)throw cn.fromPurchasesError(n,0);{const a="Unknown error starting purchase: "+String(n);throw er.errorLog(a),new cn(2,a)}}}async pollCurrentPurchaseForCompletion(){const e=this.operationSessionId;if(!e)throw new cn(0,"No purchase in progress");return new Promise((r,n)=>{const a=(i=1)=>{if(i>this.maxNumberAttempts){this.clearPurchaseInProgress(),n(new cn(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 cn(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=cn.fromPurchasesError(o,3);n(c)})};a()})}clearPurchaseInProgress(){this.operationSessionId=null}handlePaymentError(e,r){if(e==null){r(new cn(2,"Got an error status but error field is empty."));return}switch(e.code){case vf.SetupIntentCreationFailed:r(new cn(0,"Setup intent creation failed"));return;case vf.PaymentMethodCreationFailed:r(new cn(0,"Payment method creation failed"));return;case vf.PaymentChargeFailed:r(new cn(1,"Payment charge failed"));return;case vf.SetupIntentCompletionFailed:r(new cn(0,"Setup intent completion failed"));return;case vf.AlreadyPurchased:r(new cn(5,"Purchased was already completed"));return;default:r(new cn(2,"Unknown error code received"));return}}}const Ui="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 Dt=(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))(Dt||{});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 Ca=(t=>(t.Year="year",t.Month="month",t.Week="week",t.Day="day",t))(Ca||{});function aU(t){const e=t.match(/^PT?([0-9]+)([MDYW])$/);if(!e||e.length<3)return er.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 er.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){_t(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{er.errorLog(`Failed to create a price formatter for locale: ${this.locale}`)}try{return zl(e,r,this.fallbackLocale,n)}catch{er.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),be(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){Yt(e,!0),Vt(t,xY);var r=CY();r.__click=function(...a){var i;(i=e.onclick)==null||i.apply(this,a)};var n=Le(r);Nn(n,()=>e.children??Rr),gt(()=>{Ql(r,XB(e.class),"svelte-1wpam0z"),r.disabled=!e.onclick,Bt(r,"style",e.style)}),be(t,r),Xt()}Gb(["click"]);const eo="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=eo,fallback:r="FFFFFF"}){if(!t)return r;const n=t[e]||t[eo];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=eo){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=eo,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 Fi(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 Es(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?.[eo],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=Es(e||{},"button");return Fi({...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=Rr){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=Rr){const d=[c,u];return n.add(d),n.size===1&&(r=e(a,i)||Rr),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=Rr;const m=()=>{if(f)return;h();const w=e(n?d[0]:d,o,c);i?o(w):h=typeof w=="function"?w:Rr},_=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){ht(t,t.v+1)}function UY(t){let e=0,r=ii(0),n;return()=>{ZW()&&($(r),Dg(()=>(e===0&&(n=Yo(()=>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=Qn(fU);if(t===void 0)throw new Error("Paywall context not found");return t}const qY={hash:"svelte-mx8s0a",code:""};function zY(t,e){Yt(e,!0),Vt(t,qY);const r=pu(e,["$$slots","$$events","$$legacy","stack","action"]),{onButtonAction:n}=Kx(),a=()=>n(e.action),i=$e(()=>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}}),Xt()}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:Es(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=Es(n,"text");return Fi(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:Fi(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){Yt(e,!0),Vt(t,WY);const r=Nt(e,"styleVariables",3,""),n=Nt(e,"component",3,"p");var a=Sr(),i=Jt(a);B_(i,n,!1,(o,c)=>{let u;gt(()=>u=U_(o,u,{id:e.id,style:r(),class:"rc-pw-text-block"},"svelte-1wz4si8",o.namespaceURI===Dm,o.nodeName.includes("-")));var d=Sr(),f=Jt(d);Nn(f,()=>e.children??Rr),be(c,d)}),be(t,a),Xt()}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?.()??eo)==="dark"),r=()=>t?.()??(e.current?"dark":eo);return ed(mU,r),r}function Yb(){return Qn(mU)??(()=>eo)}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=Qn(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=Qn(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){Yt(e,!0),Vt(t,tX);const r=Da(),n=()=>ga(h,"$variables",r),a=pu(e,["$$slots","$$events","$$legacy","id","text_lid","background_color","size"]),i=Yb(),o=$e(i),c=$e(()=>HY($(o),{id:e.id,text_lid:e.text_lid,background_color:e.background_color,size:e.size,...a})),u=$e(()=>$(c).tagToRender),d=$e(()=>$(c).textStyles),f=$e(()=>VY(a,e.size,e.background_color)),h=Xb(),{getLocalizedString:m}=Xx(),_=$e(()=>V_(m(e.text_lid),n())),w=$e(()=>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=Sr(),A=Jt(P);fu(A,()=>$(w)),be(T,P)},$$slots:{default:!0}}),gt(()=>Bt(b,"style",$(f))),be(t,b),Xt()}function H_(t,e){Yt(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=$e(()=>n(e.nodeData)),o=$e(()=>$(i)[0]),c=$e(()=>$(i)[1]),u=$e(()=>("components"in e.nodeData?e.nodeData.components:void 0)??[]);var d=Sr(),f=Jt(d);return EK(f,()=>$(o),(h,m)=>{m(h,qc(()=>$(c)||{},{get zStackChildStyles(){return e.zStackChildStyles}},()=>a,{children:(_,w)=>{var b=Sr(),E=Jt(b);op(E,17,()=>$(u),sp,(T,D)=>{H_(T,qc({get nodeData(){return $(D)}},()=>a))}),be(_,b)},$$slots:{default:!0}}))}),be(t,d),Xt({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=Es(w,"stack");return Fi(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=Es(d,"stack-badge");return Fi(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=Fi(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){Yt(e,!0),Vt(t,uX);const r=Da(),n=()=>ga(f,"$variables",r),a=pu(e,["$$slots","$$events","$$legacy","id","components","badge","zStackChildStyles"]),i=Yb(),o=$e(i),c=$e(()=>nX($(o),{id:e.id,components:e.components,zStackChildStyles:e.zStackChildStyles,...a})),u=$e(()=>aX($(o),{id:e.id,components:e.components,badge:e.badge,...a})),d=$e(()=>oX({id:e.id,components:e.components,...a})),f=Xb(),{getLocalizedString:h}=Xx(),m=$e(()=>{var A;return V_(h((A=e.badge)==null?void 0:A.text_lid),n())}),_=$e(()=>sX($(o),{id:e.id,components:e.components,badge:e.badge,...a})),w=$e(()=>$(_).tagToRender),b=$e(()=>$(_).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=Fr();gt(()=>hr(R,$(m))),be(I,R)},$$slots:{default:!0}}),gt(()=>Bt(C,"style",$(u))),be(A,C)};Pt(T,A=>{e.badge&&A(D)})}var P=wt(T,2);op(P,21,()=>e.components,sp,(A,C,O)=>{var I=Sr(),x=Jt(I);{var R=L=>{var j=$e(()=>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}})};Pt(x,L=>{$(d)?L(R):L(N,!1)})}be(A,I)}),gt(()=>{Bt(E,"id",e.id),Bt(E,"style",$(c))}),be(t,E),Xt()}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){Vt(t,fX);var r=dX(),n=Le(r);jg(n,qc(()=>e.stack)),gt(()=>Bt(r,"id",e.id)),be(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=Es(o,"image"),d=IY(e),f=jY(t,e);return{imageStyles:Fi(u),maskPath:d,linearGradientAngle:f}};var hX=Zo('<ellipse cx="50" rx="50"></ellipse>'),mX=Zo("<path></path>"),gX=Zo("<stop></stop>"),yX=Zo("<linearGradient></linearGradient>"),vX=Zo("<stop></stop>"),_X=Zo('<radialGradient cx="50%" cy="50%" r="50%" fx="50%" fy="50%"></radialGradient>'),bX=Zo('<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){Yt(e,!0),Vt(t,wX);const r=pu(e,["$$slots","$$events","$$legacy","id","source"]),n=Yb(),a=$e(n);let i=sr(0),o;function c(){o&&ht(i,o.naturalHeight/o.naturalWidth)}const u=$e(()=>pX($(a),{id:e.id,source:e.source,...r,imageAspectRatio:$(i)})),d=$e(()=>$(u).imageStyles),f=$e(()=>$(u).maskPath),h=$e(()=>$(u).linearGradientAngle),m=$e(()=>{var j,z;return(j=e.source[$(a)])!=null&&j.original?e.source[$(a)].original:(z=e.source[eo])==null?void 0:z.original}),_=$e(()=>e.color_overlay),w=$e(()=>{var j,z;return((j=$(_))==null?void 0:j[$(a)])??((z=$(_))==null?void 0:z[eo])});var b=kX(),E=Jt(b);tU(E,j=>o=j,()=>o);var T=wt(E,2),D=Le(T),P=Le(D),A=Le(P);{var C=j=>{var z=hX();gt(()=>{Bt(z,"cy",$(i)*50),Bt(z,"ry",$(i)*50)}),be(j,z)},O=j=>{var z=mX();gt(()=>Bt(z,"d",$(f))),be(j,z)};Pt(A,j=>{var z;((z=e.mask_shape)==null?void 0:z.type)==="circle"?j(C):j(O,!1)})}var I=wt(P);{var x=j=>{var z=yX();op(z,21,()=>{var U;return((U=$(w))==null?void 0:U.points)||[]},sp,(U,W)=>{var q=gX();gt(()=>{Bt(q,"offset",`${$(W).percent}%`),Bt(q,"style",`stop-color: ${$(W).color}`)}),be(U,q)}),gt(()=>{Bt(z,"id",`gradient-${e.id}`),Bt(z,"x1",$(h).x1),Bt(z,"y1",$(h).y1),Bt(z,"x2",$(h).x2),Bt(z,"y2",$(h).y2)}),be(j,z)},R=j=>{var z=Sr(),U=Jt(z);{var W=Y=>{var Z=_X();op(Z,21,()=>{var ae;return((ae=$(w))==null?void 0:ae.points)||[]},sp,(ae,G)=>{var F=vX();gt(()=>{Bt(F,"offset",`${$(G).percent}%`),Bt(F,"style",`stop-color: ${$(G).color}`)}),be(ae,F)}),gt(()=>Bt(Z,"id",`gradient-${e.id}`)),be(Y,Z)},q=Y=>{var Z=Sr(),ae=Jt(Z);{var G=F=>{var K=bX(),ne=Le(K);gt(()=>{var ee;Bt(K,"id",`gradient-${e.id}`),Bt(ne,"style",`stop-color: ${(ee=$(w))==null?void 0:ee.value}`)}),be(F,K)};Pt(ae,F=>{var K;((K=$(w))==null?void 0:K.type)==="hex"&&F(G)},!0)}be(Y,Z)};Pt(U,Y=>{var Z;((Z=$(w))==null?void 0:Z.type)==="radial"?Y(W):Y(q,!1)},!0)}be(j,z)};Pt(I,j=>{var z;((z=$(w))==null?void 0:z.type)==="linear"?j(x):j(R,!1)})}var N=wt(D),L=wt(N);gt(()=>{Bt(E,"src",$(m)),Bt(T,"id",`rc-pw-image-container-${e.id}`),Bt(T,"style",$(d)),Bt(T,"viewBox",`0 0 100 ${$(i)*100}`),Bt(P,"id",`clip-path-${e.id}`),Bt(N,"href",$(m)),Bt(N,"height",$(i)*100),Bt(N,"clip-path",`url(#clip-path-${e.id})`),Bt(N,"id",e.id),Bt(L,"height",$(i)*100),Bt(L,"clip-path",`url(#clip-path-${e.id})`),Bt(L,"fill",`url(#gradient-${e.id})`)}),Lo("load",E,c),be(t,b),Xt()}const EX=(t,e,r,n)=>NK(r,Gt(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){Yt(e,!0),Vt(t,CX);const r=Da(),n=()=>ga(i,"$selectedPackageId",r),a=()=>ga(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=$e(()=>({selected:n()===e.package_id})),f=$e(()=>Fi(Es(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)}})),gt(()=>{Bt(h,"id",e.id),Bt(h,"style",$(f)),Bc(h,"selected",$(d).selected)}),be(t,h),Xt()}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=Es(r,"paywall");return Fi(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[eo])==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){Yt(e,!0),Vt(t,NX);const r=Da(),n=()=>ga(u,"$selectedPackageId",r),a=Nt(e,"variablesPerPackage",19,()=>({})),i=JY(()=>e.preferredColorMode),o=$e(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=$e(()=>{var E;return PX({background:(E=e.paywallData.components_config.base)==null?void 0:E.background,colorMode:$(o)})}),_=$e(()=>AX(e.paywallData,$(o)));var w=Sr(),b=Jt(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=wt(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}}))};Pt(P,x=>{e.paywallData.components_config.base.sticky_footer&&x(A)})}var C=wt(P,2);{var O=x=>{var R=RX();gt(()=>Bt(R,"style",$(m))),be(x,R)},I=x=>{var R=Sr(),N=Jt(R);{var L=j=>{var z=DX(),U=Le(z);gt(()=>Bt(U,"src",$(_))),be(j,z)};Pt(N,j=>{var z;((z=e.paywallData.components_config.base.background)==null?void 0:z.type)==="image"&&j(L)},!0)}be(x,R)};Pt(C,x=>{var R;((R=e.paywallData.components_config.base.background)==null?void 0:R.type)==="color"?x(O):x(I,!1)})}be(E,T)}),be(t,w),Xt()}function MX({stack:t,zStackChildStyles:e}){const r=t.size.width.type==="fill"?"100%":"fit-content",n=Es(e||{},"purchase-button");return Fi({...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){Yt(e,!0),Vt(t,jX);const r=pu(e,["$$slots","$$events","$$legacy","stack","zStackChildStyles"]),{onPurchase:n}=Kx(),a=$e(()=>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}}),Xt()}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=Es(e,"timeline");return Fi(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=Es(f,"timeline-item");return Fi(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:Fi(Es(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){Yt(e,!0),Vt(t,qX);const r=Da(),n=()=>ga(d,"$variables",r),a=pu(e,["$$slots","$$events","$$legacy"]),i=Yb(),o=$e(i),c=$e(()=>UX($(o),a)),{getLocalizedString:u}=Xx(),d=Xb(),f=$e(()=>V_(u(e.title.text_lid),n())),h=$e(()=>{var I;return V_(u((I=e.description)==null?void 0:I.text_lid),n())}),m=$e(()=>$O($(o),a,"title")),_=$e(()=>$(m).tagToRender),w=$e(()=>$(m).textStyles),b=$e(()=>$O($(o),a,"description")),E=$e(()=>$(b).tagToRender),T=$e(()=>$(b).textStyles);var D=FX(),P=wt(Le(D),2),A=Le(P);B_(A,()=>$(_),!1,(I,x)=>{let R;gt(()=>R=U_(I,R,{class:"rc-pw-timeline-item-content-title",style:$(w)},"svelte-gjmo4g",I.namespaceURI===Dm,I.nodeName.includes("-")));var N=Fr();gt(()=>hr(N,$(f))),be(x,N)});var C=wt(A,2);{var O=I=>{var x=Sr(),R=Jt(x);B_(R,()=>$(E),!1,(N,L)=>{let j;gt(()=>j=U_(N,j,{class:"rc-pw-timeline-item-content-description",style:$(T)},"svelte-gjmo4g",N.namespaceURI===Dm,N.nodeName.includes("-")));var z=Fr();gt(()=>hr(z,$(h))),be(L,z)}),be(I,x)};Pt(C,I=>{$(h)&&I(O)})}gt(()=>Bt(D,"style",$(c))),be(t,D),Xt()}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){Yt(e,!0),Vt(t,VX);const r=pu(e,["$$slots","$$events","$$legacy","items"]),n=$e(()=>BX({items:e.items,...r}));var a=Sr(),i=Jt(a);{var o=c=>{var u=$X();op(u,21,()=>e.items,sp,(d,f,h)=>{var m=$e(()=>`${e.id}-${h}`),_=$e(()=>`${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}}))}),gt(()=>Bt(u,"style",$(n))),be(c,u)};Pt(i,c=>{e.items.length&&c(o)})}be(t,a),Xt()}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){Yt(e,!0),Vt(t,WX);const r=Nt(e,"size",3,"body-base");var n=GX(),a=Le(n);Nn(a,()=>e.children??Rr),gt(()=>Ql(n,`rcb-typography rcb-typography-${r()??""} svelte-byrjto`)),be(t,n),Xt()}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",ko={regular:"400",medium:"500",semibold:"600"},ss={12:"12px",14:"14px",16:"16px",18:"18px",24:"24px",28:"28px",32:"32px",36:"36px"},wo={120:"120%",130:"130%",140:"140%"},So={tight:"0.20%",regular:"0"},Wn={heading2xl:{fontSize:ss[28],lineHeight:wo[120],fontWeight:ko.semibold,letterSpacing:So.tight},headingXl:{fontSize:ss[24],lineHeight:wo[130],fontWeight:ko.semibold,letterSpacing:So.regular},headingLg:{fontSize:"20px",lineHeight:wo[130],fontWeight:ko.semibold,letterSpacing:So.regular},headingMd:{fontSize:"16px",lineHeight:wo[140],fontWeight:ko.medium,letterSpacing:So.regular},bodyBase:{fontSize:ss[16],lineHeight:wo[140],fontWeight:ko.regular,letterSpacing:So.regular},bodySmall:{fontSize:ss[14],lineHeight:wo[140],fontWeight:ko.regular,letterSpacing:So.regular},labelButton:{fontSize:ss[16],lineHeight:wo[140],fontWeight:ko.regular,letterSpacing:So.tight},labelDefault:{fontSize:ss[14],lineHeight:wo[140],fontWeight:ko.regular,letterSpacing:So.tight},captionDefault:{fontSize:ss[12],lineHeight:wo[140],fontWeight:ko.regular,letterSpacing:So.regular},captionLink:{fontSize:ss[12],lineHeight:wo[140],fontWeight:ko.regular,letterSpacing:So.regular}},Eo={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}},XX={heading2xl:{mobile:Wn.heading2xl,desktop:Eo.heading2xl},headingXl:{desktop:Eo.headingXl,mobile:Wn.headingXl},headingLg:{desktop:Eo.headingLg,mobile:Wn.headingLg},headingMd:{desktop:Eo.headingMd,mobile:Wn.headingMd},bodyBase:{desktop:Eo.bodyBase,mobile:Wn.bodyBase},bodySmall:{desktop:Eo.bodySmall,mobile:Wn.bodySmall},labelButton:{desktop:Eo.labelButton,mobile:Wn.labelButton},labelDefault:{desktop:Eo.labelDefault,mobile:Wn.labelDefault},captionDefault:{desktop:Eo.captionDefault,mobile:Wn.captionDefault},captionLink:{desktop:Eo.captionLink,mobile:Wn.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){_t(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){Vt(t,gJ);let r=Nt(e,"size",8,"medium");const n={small:{width:"8px",offset:"10px"},medium:{width:"12px",offset:"20px"},large:{width:"16px",offset:"30px"}};var a=mJ();gt(()=>Bt(a,"style",`--shadow-offset: ${n[r()].offset??""}; --width: ${n[r()].width??""};`)),be(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){Yt(e,!0),Vt(t,_J);const r=Nt(e,"intent",3,"primary"),n=Nt(e,"disabled",3,!1),a=Nt(e,"loading",3,!1),i=$e(()=>new hJ(e.brandingAppearance)),o=$e(()=>$(i).textStyleVars),c=$e(()=>$(i).spacingStyleVars),u=$e(()=>$(i).productInfoStyleVars),d=$e(()=>$(i).formStyleVars),f=$e(()=>[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=Sr(),P=Jt(D);Nn(P,()=>e.children??Rr),be(E,D)},$$slots:{default:!0}})};Pt(m,b=>{a()?b(_):b(w,!1)})}gt(()=>{Ql(h,`${`intent-${r()}`??""} svelte-td7xvm`),h.disabled=n(),Bt(h,"data-testid",e.testId),Bt(h,"type",e.type),Bt(h,"style",$(f))}),be(t,h),Xt()}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){Yt(e,!1),Vt(t,kJ);let r=Nt(e,"children",8);Ss();var n=bJ(),a=Le(n);Nn(a,()=>r()??Rr),be(t,n),Xt()}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){Yt(e,!1),Vt(t,SJ);let r=Nt(e,"as",8,"section"),n=Nt(e,"children",8);Ss();var a=Sr(),i=Jt(a);B_(i,r,!1,(o,c)=>{U_(o,null,{class:"rcb-modal-section"},"svelte-1bzqb13",o.namespaceURI===Dm,o.nodeName.includes("-"));var u=Sr(),d=Jt(u);Nn(d,()=>n()??Rr),be(c,u)}),be(t,a),Xt()}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){Yt(e,!1),Vt(t,CJ);let r=Nt(e,"gap",8,"small"),n=Nt(e,"align",8,"start"),a=Nt(e,"children",8);Ss();var i=TJ(),o=Le(i);Nn(o,()=>a()??Rr),gt(()=>Ql(i,`rcb-column gap-${r()??""} align-${n()??""} svelte-b5dygi`)),be(t,i),Xt()}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){Yt(e,!1),Vt(t,PJ);let r=Nt(e,"children",8);Ss();var n=xJ(),a=Le(n);Nn(a,()=>r()??Rr),be(t,n),Xt()}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 Ar(t,e){Yt(e,!0),Vt(t,DJ);const r=Nt(e,"size",3,"body-base"),n=Nt(e,"branded",3,!1);var a=RJ(),i=Le(a);Nn(i,()=>e.children??Rr),gt(()=>Ql(a,`rcb-typography rcb-typography-${r()??""} ${(n()?"rcb-typography-branded":"")??""} svelte-orw2sj`)),be(t,a),Xt()}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){Yt(e,!0),Vt(t,LJ);const r=Nt(e,"title",3,null),n=Nt(e,"icon",3,null),a=32;let i=sr(null),o=sr(!1),c;bs(()=>($(i)&&(c=new ResizeObserver(()=>{var f;ht(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(),_=Jt(m);AJ(_,{children:(E,T)=>{var D=IJ(),P=Jt(D);{var A=I=>{var x=OJ(),R=Le(x);Nn(R,n),gt(()=>Ql(x,`rcb-modal-message-icon ${$(o)?"large":"small"} svelte-w46z5s`)),be(I,x)};Pt(P,I=>{n()&&I(A)})}var C=wt(P,2);{var O=I=>{var x=NJ(),R=Le(x);Ar(R,{size:"heading-md",children:(N,L)=>{var j=Fr();gt(()=>hr(j,r())),be(N,j)},$$slots:{default:!0}}),tU(x,N=>ht(i,N),()=>$(i)),be(I,x)};Pt(C,I=>{r()&&I(O)})}be(E,D)},$$slots:{default:!0}});var w=wt(_,2);{var b=E=>{Ar(E,{size:"body-small",children:(T,D)=>{var P=Sr(),A=Jt(P);Nn(A,()=>e.message??Rr),be(T,P)},$$slots:{default:!0}})};Pt(w,E=>{e.message&&E(b)})}be(f,m)},$$slots:{default:!0}}),gt(()=>Bt(u,"data-has-title",!!r())),be(t,u),Xt()}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){Yt(e,!0),Vt(t,zJ);const r=Nt(e,"title",3,null),n=Nt(e,"icon",3,null);var a=qJ(),i=Le(a);TU(i,{gap:"large",align:"center",children:(o,c)=>{var u=FJ(),d=Jt(u);{var f=_=>{var w=UJ(),b=Le(w);Nn(b,n),be(_,w)};Pt(d,_=>{n()&&_(f)})}var h=wt(d,2);{var m=_=>{Ar(_,{size:"heading-md",children:(w,b)=>{var E=Fr();gt(()=>hr(E,r())),be(w,E)},$$slots:{default:!0}})};Pt(h,_=>{r()&&_(m)})}be(o,u)},$$slots:{default:!0}}),gt(()=>Bt(a,"data-has-title",!!r())),be(t,a),Xt()}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){Yt(e,!0),Vt(t,HJ);let r=Nt(e,"title",3,null),n=Nt(e,"closeButtonTitle",3,"Go back to app"),a=Nt(e,"icon",3,null),i=Nt(e,"message",3,null);const o=Qn(tP);function c(){e.onDismiss()}var u=VJ(),d=Le(u),f=Le(d);EJ(f,{children:(_,w)=>{var b=Sr(),E=Jt(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()}})};Pt(E,P=>{e.type==="success"?P(T):P(D,!1)})}be(_,b)},$$slots:{default:!0}});var h=wt(d,2),m=Le(h);wJ(m,{children:(_,w)=>{EU(_,{onclick:c,type:"submit",brandingAppearance:o,children:(b,E)=>{var T=Fr();gt(()=>hr(T,n())),be(b,T)},$$slots:{default:!0}})},$$slots:{default:!0}}),be(t,u),Xt()}function oi(t,e){Yt(e,!0);const r=Da(),n=()=>ga(i,"$translator",r),a=Nt(e,"key",3,""),i=Qn(Ui),o=$e(()=>a()?n().translate(a()||"",e.variables):void 0);var c=Sr(),u=Jt(c);{var d=h=>{var m=Fr();gt(()=>hr(m,$(o))),be(h,m)},f=h=>{var m=Sr(),_=Jt(m);Nn(_,()=>e.children??Rr),be(h,m)};Pt(u,h=>{$(o)?h(d):h(f,!1)})}be(t,c),Xt()}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){Yt(e,!1),Vt(t,YJ);const r=Da(),n=()=>ga(E,"$translator",r),a=Bs(),i=Bs(),o=Bs(),c=Bs(),u=Bs(),d=Bs(),f=Bs(),h=Bs(),m=Bs(),_=Bs();let w=Nt(e,"brandingInfo",8,null),b=Nt(e,"purchaseOption",8,null);const E=Qn(Ui);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?Dt.PaymentEntryPageTrialSubscriptionTermsInfo:Dt.PaymentEntryPageSubscriptionTermsInfo:Dt.PaymentEntryPageOtpTermsInfo}bo(()=>Wv(b()),()=>{ht(a,T(b())?b():null)}),bo(()=>Wv(b()),()=>{ht(i,D(b())?b():null)}),bo(()=>$(a),()=>{ht(o,P($(a)))}),bo(()=>$(a),()=>{var L,j;ht(c,((L=$(a))==null?void 0:L.introPrice)||((j=$(a))==null?void 0:j.base))}),bo(()=>($(i),$(c)),()=>{var L,j;ht(u,((L=$(i))==null?void 0:L.basePrice)||((j=$(c))==null?void 0:j.price))}),bo(()=>($(u),n()),()=>{ht(d,$(u)?zl($(u).amountMicros,$(u).currency,n().locale||n().fallbackLocale):null)}),bo(()=>($(c),n()),()=>{var L,j,z,U,W;ht(f,(L=$(c))!=null&&L.period?n().translatePeriodFrequency(((z=(j=$(c))==null?void 0:j.period)==null?void 0:z.number)||1,(W=(U=$(c))==null?void 0:U.period)==null?void 0:W.unit,{useMultipleWords:!0}):null)}),bo(()=>($(a),n(),xT),()=>{var L,j;ht(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)}),bo(()=>(Wv(w()),$(u),n(),$(o),$(d),$(f),$(h)),()=>{var L;ht(m,w()&&$(u)?n().translate($(o),{appName:(L=w())==null?void 0:L.app_name,price:$(d),perFrequency:$(f),renewalDate:$(h)}):null)}),bo(()=>($(a),n(),Dt),()=>{ht(_,$(a)?n().translate(Dt.PaymentEntryPageSubscriptionInfo):null)}),rK(),Ss();var A=KJ(),C=Le(A);{var O=L=>{var j=GJ(),z=Le(j);Ar(z,{size:"caption-default",children:(U,W)=>{var q=Fr();gt(()=>hr(q,$(m))),be(U,q)},$$slots:{default:!0}}),be(L,j)};Pt(C,L=>{$(m)&&L(O)})}var I=wt(C,2);{var x=L=>{var j=WJ(),z=Le(j);Ar(z,{size:"caption-default",children:(U,W)=>{var q=Fr();gt(()=>hr(q,$(_))),be(U,q)},$$slots:{default:!0}}),be(L,j)};Pt(I,L=>{$(_)&&L(x)})}var R=wt(I,2),N=Le(R);Ar(N,{size:"caption-default",children:(L,j)=>{oi(L,{get key(){return Dt.PaymentEntryPagePaymentStepTitle}})},$$slots:{default:!0}}),be(t,A),Xt()}var yi=(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))(yi||{}),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:yi.CheckoutFlowError,properties:{errorCode:t,errorMessage:e}}}function QJ({errorCode:t,errorMessage:e}){return{eventName:yi.CheckoutPaymentFormError,properties:{errorCode:t,errorMessage:e}}}function ZJ({appearance:t,rcPackage:e,purchaseOptionToUse:r,customerEmail:n}){return{eventName:yi.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:yi.CheckoutSessionEnd,properties:{outcome:"finished",withRedemptionInfo:!!t}}}function tQ(){return{eventName:yi.CheckoutSessionEnd,properties:{outcome:"closed"}}}function rQ({errorCode:t,errorMessage:e}){return{eventName:yi.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:yi.CheckoutPaymentTaxCalculation,properties:{outcome:r,ui_element:n,tax_inclusive:t.tax_inclusive,error_code:t.failed_reason??null}}}function aQ({selectedPaymentMethod:t}){return{eventName:yi.CheckoutPaymentFormSubmit,properties:{selectedPaymentMethod:t??null}}}function iQ({errorCode:t,errorMessage:e}){return{eventName:yi.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){Vt(t,cQ);var e=oQ(),r=Le(e);fu(r,()=>sQ),be(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){Vt(t,dQ);var e=uQ(),r=Le(e);lQ(r),be(t,e)}function fQ(t,e){var r,n;Yt(e,!0);const a=Da(),i=()=>ga(o,"$translator",a),o=Qn(Ui),c=Qn(tP),u=$e(()=>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=$e(()=>d?i().translatePeriod(d.number,d.unit):null);EU(t,{get disabled(){return e.disabled},testId:"PayButton",brandingAppearance:c,children:(h,m)=>{var _=Sr(),w=Jt(_);{var b=T=>{var D=$e(()=>({trialPeriodLabel:$(f)}));oi(T,{get key(){return Dt.PaymentEntryPageButtonStartTrial},get variables(){return $(D)}})},E=T=>{var D=Sr(),P=Jt(D);{var A=O=>{var I=$e(()=>({formattedPrice:$(u)}));oi(O,{get key(){return Dt.PaymentEntryPageButtonWithPrice},get variables(){return $(I)}})},C=O=>{oi(O,{get key(){return Dt.PaymentEntryPageButtonPay}})};Pt(P,O=>{$(u)?O(A):O(C,!1)},!0)}be(T,D)};Pt(w,T=>{var D;(D=e.subscriptionOption)!=null&&D.trial?T(b):T(E,!1)})}be(h,_)},$$slots:{default:!0}}),Xt()}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_}`,To={regular:"400",medium:"500",semibold:"600"},os={12:"12px",14:"14px",16:"16px",18:"18px",24:"24px",28:"28px",32:"32px",36:"36px"},Co={130:"130%",140:"140%"},xo={tight:"0.20%",regular:"0",loose:"0.20%"},Kn={heading2xl:{fontSize:os[28],lineHeight:Co[130],fontWeight:To.semibold,letterSpacing:xo.loose},headingXl:{fontSize:os[24],lineHeight:Co[130],fontWeight:To.semibold,letterSpacing:xo.loose},headingLg:{fontSize:"20px",lineHeight:Co[130],fontWeight:To.semibold,letterSpacing:xo.loose},headingMd:{fontSize:"16px",lineHeight:Co[140],fontWeight:To.medium,letterSpacing:xo.regular},bodyBase:{fontSize:os[16],lineHeight:Co[140],fontWeight:To.regular,letterSpacing:xo.regular},bodySmall:{fontSize:os[14],lineHeight:Co[140],fontWeight:To.regular,letterSpacing:xo.regular},labelButton:{fontSize:os[16],lineHeight:Co[140],fontWeight:To.semibold,letterSpacing:xo.tight},labelDefault:{fontSize:os[14],lineHeight:Co[140],fontWeight:To.regular,letterSpacing:xo.tight},captionDefault:{fontSize:os[12],lineHeight:Co[140],fontWeight:To.regular,letterSpacing:xo.regular},captionLink:{fontSize:os[12],lineHeight:Co[140],fontWeight:To.regular,letterSpacing:xo.regular}},Po={heading2xl:{...Kn.heading2xl,fontSize:os[36]},headingXl:{...Kn.headingXl,fontSize:os[32]},headingLg:{...Kn.headingLg,fontSize:os[24]},headingMd:{...Kn.headingMd,fontSize:os[18]},bodyBase:{...Kn.bodyBase},bodySmall:{...Kn.bodySmall},labelButton:{...Kn.labelButton},labelDefault:{...Kn.labelDefault},captionDefault:{...Kn.captionDefault},captionLink:{...Kn.captionLink}},NT={heading2xl:{mobile:Kn.heading2xl,desktop:Po.heading2xl},headingXl:{desktop:Po.headingXl,mobile:Kn.headingXl},headingLg:{desktop:Po.headingLg,mobile:Kn.headingLg},headingMd:{desktop:Po.headingMd,mobile:Kn.headingMd},bodyBase:{desktop:Po.bodyBase,mobile:Kn.bodyBase},bodySmall:{desktop:Po.bodySmall,mobile:Kn.bodySmall},labelButton:{desktop:Po.labelButton,mobile:Kn.labelButton},labelDefault:{desktop:Po.labelDefault,mobile:Kn.labelDefault},captionDefault:{desktop:Po.captionDefault,mobile:Kn.captionDefault},captionLink:{desktop:Po.captionLink,mobile:Kn.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){_t(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===Ca.Year?(r.setFullYear(r.getFullYear()+e.number),r):e.unit===Ca.Month?(r.setMonth(r.getMonth()+e.number),r):e.unit===Ca.Week?(r.setDate(r.getDate()+e.number*7),r):(e.unit===Ca.Day&&r.setDate(r.getDate()+e.number),r)}static applePayPeriod(e){return e.unit===Ca.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(Dt.ApplePayFreeTrial),amount:0}:void 0,regularBilling:{label:e.title,amount:c,recurringPaymentStartDate:h,...m}}}}}};_t(LU,"FORM_VALIDATED_CARD_ERROR_CODES",["card_declined","expired_card","incorrect_cvc","incorrect_number"]);let La=LU;var zQ=lt("<div></div>");function $Q(t,e){Yt(e,!0);let r=null;const n="payment-element",a=async o=>{await e.onError(La.mapInitializationError(o.error))};bs(()=>{var o;try{r=La.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(La.mapInitializationError(c))}}),Ig(()=>{r?.destroy(),r=null});var i=zQ();Bt(i,"id",n),be(t,i),Xt()}var VQ=lt("<div></div>");function HQ(t,e){Yt(e,!0);let r=null;const n="link-authentication-element",a=async o=>{await e.onError(La.mapInitializationError(o.error))};bs(()=>{try{r=La.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(La.mapInitializationError(o))}}),Ig(()=>{r?.destroy(),r=null});var i=VQ();Bt(i,"id",n),be(t,i),Xt()}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){Vt(t,WQ);let r=Nt(e,"text",8);var n=GQ(),a=wt(Le(n),2),i=Le(a);Ar(i,{size:"caption-default",children:(o,c)=>{var u=Fr();gt(()=>hr(u,r())),be(o,u)},$$slots:{default:!0}}),be(t,n)}var YQ=lt("<div></div> <!>",1);function XQ(t,e){Yt(e,!0);const r=Da(),n=()=>ga(a,"$translator",r),a=Qn(Ui);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(La.mapInitializationError(b.error))},f=async b=>{var E;e.onSubmit(b.expressPaymentType,((E=b.billingDetails)==null?void 0:E.email)??"")},h=async b=>{ht(o,!b.availablePaymentMethods),e.onReady()};bs(()=>{try{i=La.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(La.mapInitializationError(b))}}),Ig(()=>{i?.destroy(),i=null});var m=Sr(),_=Jt(m);{var w=b=>{var E=YQ(),T=Jt(E);Bt(T,"id",c);var D=wt(T,2),P=$e(()=>n().translate(Dt.PaymentEntryPageExpressCheckoutDivider));KQ(D,{get text(){return $(P)}}),be(b,E)};Pt(_,b=>{$(o)||b(w)})}be(t,m),Xt()}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){Yt(e,!0),Vt(t,QQ);const r=Da(),n=()=>ga(o,"$translator",r);let a=Nt(e,"stripe",15,null),i=Nt(e,"elements",15,null);const o=Qn(Ui),c=La.getStripeLocale(n().locale||n().fallbackLocale);let u=sr(!1),d=sr(Gt(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?ht(m,"mobile"):ht(m,"desktop"),ht(h,Gt({fontSizeBase:"14px",fontFamily:W_,spacingGridRow:"16px"}))}function b(){clearTimeout($(_)),ht(_,Gt(setTimeout(()=>{w()},150)))}const E=R=>{e.onError(R),e.onLoadingComplete()},T=async()=>{$(d)||(ht(d,!0),$(d)&&$(u)&&$(f)&&e.onLoadingComplete())},D=async()=>{$(f)||(ht(f,!0),$(d)&&$(u)&&$(f)&&e.onLoadingComplete())},P=async()=>{$(u)||(ht(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)};bs(()=>(window.addEventListener("resize",b),()=>{window.removeEventListener("resize",b)})),bs(async()=>{w(),!a()&&(i()||!e.stripeAccountId||!e.publishableApiKey||!e.elementsConfiguration||await La.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()&&La.updateElementsConfiguration(i(),e.elementsConfiguration)});var O=Sr(),I=Jt(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=wt(L,2);{var z=W=>{HQ(W,{get elements(){return i()},onReady:T,onChange:C,onError:E})};Pt(j,W=>{e.skipEmail||W(z)})}var U=wt(j,2);$Q(U,{get elements(){return i()},get brandingInfo(){return e.brandingInfo},onReady:P,onChange:A,onError:E}),be(R,N)};Pt(I,R=>{i()&&R(x)})}be(t,O),Xt()}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){Vt(t,rZ);var e=tZ(),r=Le(e);fu(r,()=>eZ),be(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){Vt(t,aZ);var r=nZ(),n=Le(r),a=Le(n);BU(a);var i=wt(n,2),o=Le(i),c=Le(o);Ar(c,{size:"body-small",children:(f,h)=>{var m=Fr();gt(()=>hr(m,e.title)),be(f,m)},$$slots:{default:!0}});var u=wt(o,2),d=Le(u);Ar(d,{size:"body-small",children:(f,h)=>{var m=Fr();gt(()=>hr(m,e.message)),be(f,m)},$$slots:{default:!0}}),be(t,r)}function sZ(t,e){Yt(e,!0);const r=Da(),n=()=>ga(a,"$translator",r),a=Qn(Ui);var i=$e(()=>n().translate(Dt.PriceUpdateTitle)),o=$e(()=>{var c;return n().translate((c=e.subscriptionOption)!=null&&c.trial?Dt.PriceUpdateTrialMessage:Dt.PriceUpdateBaseMessage)});iZ(t,{get title(){return $(i)},get message(){return $(o)}}),Xt()}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;Yt(e,!0),Vt(t,lZ);const i=Da(),o=()=>ga(u,"$translator",i),c=Qn(eP),u=Qn(Ui),d=(r=e.productDetails.subscriptionOptions)==null?void 0:r[e.purchaseOption.id],f=UU(e.productDetails,e.purchaseOption);let h=sr(Gt(((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(Gt(f.amountMicros)),b=sr(Gt(f.amountMicros)),E=$e(()=>e.defaultPriceBreakdown??{currency:f.currency,totalAmountInMicros:$(b),totalExcludingTaxInMicros:$(w),taxCalculationStatus:$(h),taxAmountInMicros:$(m),taxBreakdown:$(_)}),T=sr(Gt(e.gatewayParams.elements_configuration)),D=sr(null),P=sr(null),A=sr(null),C=sr(Gt(e.customerEmail??void 0)),O=sr(Gt(!!e.customerEmail)),I=sr(!0),x=sr(!1),R=sr(void 0),N=sr(void 0),L=sr(void 0),j=sr(!1),z=sr(null),U=$e(()=>$(I)||$(j)?"loading":$(N)?"error":"form"),W=sr("unavailable"),q=$e(()=>!$(j)&&$(x)&&$(O)&&($(h)==="disabled"||$(h)==="calculated"||$(h)==="miss-match")),Y=$e(()=>d&&e.managementUrl&&$(E)?La.buildStripeExpressCheckoutOptionsForSubscription(e.productDetails,$(E),d,o(),e.managementUrl):void 0);ip(()=>{e.onPriceBreakdownUpdated($(E))}),bs(async()=>{$(h)==="unavailable"&&await Z(null).catch(H)}),Ig(()=>{$(z)&&($(z).abort(),ht(z,null))});async function Z(ke,st){await e.purchaseOperationHelper.checkoutCalculateTax(ke?.countryCode,ke?.postalCode,st).then(kt=>{const nr=nQ({taxCalculation:kt,taxCustomerDetails:ke});c.trackSDKEvent(nr),st?.throwIfAborted(),kt.failed_reason?!ke&&kt.failed_reason===nP.invalid_tax_location?ht(h,"pending"):ht(h,"disabled"):ht(h,"calculated"),ht(m,Gt(kt.tax_amount_in_micros)),ht(w,Gt(kt.total_excluding_tax_in_micros)),ht(b,Gt(kt.total_amount_in_micros)),ht(_,Gt(kt.tax_breakdown)),ht(T,Gt(kt.gateway_params.elements_configuration)),ht(D,Gt(ke))})}function ae(){c.trackSDKEvent({eventName:yi.CheckoutPaymentFormImpression}),ht(I,!1)}async function G(ke,st){ht(C,Gt(st)),ht(O,Gt(ke)),await ee()}async function F({complete:ke,paymentMethod:st}){ht(R,Gt(st)),ht(x,Gt(ke)),await ee()}async function K(ke){if(ke?.preventDefault(),$(j))return;const st=aQ({selectedPaymentMethod:$(R)??null});c.trackSDKEvent(st),ht(j,!0),await he()?e.onContinue():ht(j,!1)}async function ne(ke,st){ht(R,Gt(ke)),ht(C,Gt(e.customerEmail??st)),await K()}async function ee(){$(R)!=="card"||!$(O)||!$(x)||$(j)||$(h)==="disabled"||($(h)!=="loading"&&(ht(W,Gt($(h))),ht(h,"loading")),await ce(async ke=>{await Pe().then(()=>ke.throwIfAborted()).then(()=>Ge(ke)).then(()=>ke.throwIfAborted()).catch(st=>{ke.aborted||H(st)}).finally(()=>{$(h)==="loading"&&!ke.aborted&&ht(h,Gt($(W)))})}))}async function he(){return await ce(async ke=>{const st=$(b);let kt;return await Pe().then(()=>ke.throwIfAborted()).then(()=>Ge(ke)).then(nr=>{kt=nr}).then(()=>ke.throwIfAborted()).then(se(st)).then(()=>ke.throwIfAborted()).then(Ce).then(()=>ke.throwIfAborted()).then(()=>te(kt)).then(()=>ke.throwIfAborted()).then(()=>!0).catch(nr=>(ke.aborted||H(nr),!1))})}async function ce(ke){$(z)&&$(z).abort(),ht(z,Gt(new AbortController));const st=$(z).signal;try{return await ke(st)}catch(kt){if(kt instanceof DOMException&&kt.name==="AbortError")return Promise.resolve(void 0);throw kt}}async function Pe(){$(A)&&await La.submitElements($(A))}async function Ge(ke){var st,kt;if($(h)==="unavailable"||$(h)==="disabled"||!$(A)||!$(P))return;const{customerDetails:nr,confirmationTokenId:lr}=await La.extractTaxCustomerDetails($(A),$(P));return ke?.throwIfAborted(),nr.postalCode===((st=$(D))==null?void 0:st.postalCode)&&nr.countryCode===((kt=$(D))==null?void 0:kt.countryCode)||await Z(nr,ke),lr&&$(R)!=="card"?lr:void 0}function se(ke){return()=>{if($(b)!==ke)throw new JO}}async function Ce(){var ke;const st=await e.purchaseOperationHelper.checkoutComplete($(C)),kt=(ke=st?.gateway_params)==null?void 0:ke.client_secret;kt&&ht(L,Gt(kt))}async function te(ke){!$(P)||!$(A)||!$(L)||await La.confirmElements($(P),$(A),$(L),ke)}async function H(ke){if(ke instanceof JO)ht(h,"miss-match");else if(ke instanceof cn){const st=QJ({errorCode:ke.errorCode.toString(),errorMessage:ke.message});c.trackSDKEvent(st),ke.errorCode===Gr.MissingEmailError?ht(N,Gt(o().translate(Dt.ErrorPageErrorMessageInvalidEmailError,{email:$(C)}))):e.onError(ke)}else if(ke instanceof Jv)await pe(ke);else throw ke}async function pe(ke){const st=iQ({errorCode:ke.gatewayErrorCode??"",errorMessage:ke.message??""});c.trackSDKEvent(st),ke.code===IT.HandledFormError||(ke.code===IT.UnhandledFormError?ht(N,Gt(ke.message)):e.onError(new cn(Gr.ErrorSettingUpPurchase,"Failed to initialize payment form",ke.message)))}const Re=()=>{ht(N,void 0)};var de=cZ(),Ie=Le(de);{var ct=ke=>{var st=oZ(),kt=Le(st);CU(kt),be(ke,st)};Pt(Ie,ke=>{$(U)==="loading"&&ke(ct)})}var Ve=wt(Ie,2);{var rt=ke=>{var st=$e(()=>o().translate(Dt.ErrorButtonTryAgain));rP(ke,{title:null,type:"error",get closeButtonTitle(){return $(st)},onDismiss:Re,icon:kt=>{sU(kt)},message:kt=>{var nr=Fr();gt(()=>hr(nr,$(N))),be(kt,nr)},$$slots:{icon:!0,message:!0}})};Pt(Ve,ke=>{$(U)==="error"&&ke(rt)})}var Ke=wt(Ve,2),it=Le(Ke),Et=Le(it),It=Le(Et),bt=$e(()=>!!e.customerEmail),me=$e(()=>$(h)!=="disabled");ZQ(It,{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 $(bt)},get billingAddressRequired(){return $(me)},onLoadingComplete:ae,onError:pe,onEmailChange:G,onPaymentInfoChange:F,onExpressCheckoutElementSubmit:ne,get expressCheckoutOptions(){return $(Y)},get stripe(){return $(P)},set stripe(ke){ht(P,Gt(ke))},get elements(){return $(A)},set elements(ke){ht(A,Gt(ke))}});var Be=wt(Et,2),je=Le(Be);sZ(je,{subscriptionOption:d});var nt=wt(Be,2),Ct=Le(nt),Mt=$e(()=>!$(q)),De=$e(()=>{var ke;return(ke=e.brandingInfo)!=null&&ke.gateway_tax_collection_enabled?$(E):void 0});fQ(Ct,{get disabled(){return $(Mt)},subscriptionOption:d,get priceBreakdown(){return $(De)}});var et=wt(Ct,2),at=Le(et);XJ(at,{get brandingInfo(){return e.brandingInfo},get purchaseOption(){return e.purchaseOption}}),gt(()=>{Bc(it,"invisible",$(U)!=="form"),Bc(Be,"fully-hidden",$(h)!=="miss-match"||$(U)!=="form"),Bc(nt,"fully-hidden",$(U)!=="form")}),Lo("submit",Ke,K),be(t,de),Xt()}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 Ca.Day:o=e;break;case Ca.Week:o=e*n;break;case Ca.Month:o=e*a;break;case Ca.Year:o=e*i;break;default:o=0,er.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?(er.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?(er.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 er.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?(er.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 er.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 er.debugLog(`Product ${t.identifier} has no default subscription option. Ignoring.`),null;const o=i.base.price;return o==null?(er.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=Zo('<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){Vt(t,wZ);let r=Nt(e,"direction",8);var n=kZ();gt(()=>xK(n,`arrow ${r()??""} svelte-1qexsu3`)),be(t,n)}var SZ=Zo('<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){Vt(t,EZ);var e=SZ();be(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),be(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){Vt(t,DZ);var e=RZ(),r=Le(e);fu(r,()=>AZ),be(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),be(t,e)}var MZ=Zo('<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){Vt(t,jZ);var e=MZ();be(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){Yt(e,!0);const r=BZ[e.name];let n=sr(Gt({}));if(e.name.startsWith("chevron")){const a=e.name.split("-")[1];ht(n,Gt({direction:a}))}r(t,qc(()=>$(n))),Xt()}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){Yt(e,!0),Vt(t,zZ);const r=Da(),n=()=>ga(i,"$translator",r),a=$e(()=>e.lastError??new cn(Gr.UnknownError,"Unknown error without state set.")),i=Qn(Ui),o=$e(()=>$(a).errorCode===Gr.StripeTaxNotActive||$(a).errorCode===Gr.StripeInvalidTaxOriginAddress||$(a).errorCode===Gr.StripeMissingRequiredPermission);bs(()=>{er.errorLog(`Displayed error: ${Gr[$(a).errorCode]}. Message: ${$(a).message??"None"}. Underlying error: ${$(a).underlyingErrorMessage??"None"}`)});function c(){return $(a).errorCode===Gr.AlreadyPurchasedError?n().translate(Dt.ErrorPageCloseButtonTitle,{appName:e.appName??"App"}):$(o)?n().translate(Dt.ErrorButtonClose):n().translate(Dt.ErrorButtonTryAgain)}function u(){switch($(a).errorCode){case Gr.AlreadyPurchasedError:return e.productDetails.productType===td.Subscription?n().translate(Dt.ErrorPageErrorTitleAlreadySubscribed,{productTitle:e.productDetails.title}):n().translate(Dt.ErrorPageErrorTitleAlreadyPurchased,{productTitle:e.productDetails.title});case Gr.StripeTaxNotActive:return n().translate(Dt.ErrorPageErrorTitleStripeTaxNotActive);case Gr.StripeInvalidTaxOriginAddress:return n().translate(Dt.ErrorPageErrorTitleStripeInvalidTaxOriginAddress);case Gr.StripeMissingRequiredPermission:return n().translate(Dt.ErrorPageErrorTitleStripeMissingRequiredPermission);default:return n().translate(Dt.ErrorPageErrorTitleOtherErrors)}}function d(){const w=$(a).getErrorCode();switch($(a).errorCode){case Gr.ErrorSettingUpPurchase:return n().translate(Dt.ErrorPageErrorMessageErrorSettingUpPurchase,{errorCode:w});case Gr.ErrorChargingPayment:return n().translate(Dt.ErrorPageErrorMessageErrorChargingPayment,{errorCode:w});case Gr.AlreadyPurchasedError:return e.productDetails.productType===td.Subscription?n().translate(Dt.ErrorPageErrorMessageAlreadySubscribed,{errorCode:w}):n().translate(Dt.ErrorPageErrorMessageAlreadyPurchased,{errorCode:w});case Gr.StripeTaxNotActive:return n().translate(Dt.ErrorPageErrorMessageStripeTaxNotActive,{errorCode:w});case Gr.StripeInvalidTaxOriginAddress:return n().translate(Dt.ErrorPageErrorMessageStripeInvalidTaxOriginAddress,{errorCode:w});case Gr.StripeMissingRequiredPermission:return n().translate(Dt.ErrorPageErrorMessageStripeMissingRequiredPermission,{errorCode:w});case Gr.NetworkError:return n().translate(Dt.ErrorPageErrorMessageNetworkError,{errorCode:w});default:return n().translate(Dt.ErrorPageErrorMessageUnknownError,{errorCode:w})}}function f(){return $(a).errorCode===Gr.AlreadyPurchasedError?Dt.ErrorPageTroubleAccessing:Dt.ErrorPageIfErrorPersists}function h(){return $(a).errorCode===Gr.AlreadyPurchasedError?"success":"error"}var m=$e(u),_=$e(c);rP(t,{get title(){return $(m)},get onDismiss(){return e.onDismiss},type:"error",get closeButtonTitle(){return $(_)},icon:w=>{var b=$e(h);Um(w,{get name(){return $(b)}})},message:w=>{var b=qZ(),E=Jt(b);{var T=C=>{var O=UZ(),I=Jt(O),x=Le(I);oi(x,{get key(){return Dt.ErrorPageErrorMessageOnlyInSandbox}}),be(C,O)};Pt(E,C=>{$(o)&&C(T)})}var D=wt(E);gt(()=>hr(D,` ${d()??""} `));var P=wt(D);{var A=C=>{var O=FZ(),I=Jt(O),x=$e(f);oi(I,{get key(){return $(x)}});var R=wt(I,2),N=Le(R);gt(()=>{Bt(R,"href",`mailto:${e.supportEmail??""}`),hr(N,e.supportEmail)}),be(C,O)};Pt(P,C=>{!$(o)&&e.supportEmail&&C(A)})}be(w,b)},$$slots:{icon:!0,message:!0}}),Xt()}function VZ(t,e){Yt(e,!1);const r=Da(),n=()=>ga(i,"$translator",r);let a=Nt(e,"onContinue",8);const i=Qn(Ui),o=Qn(eP);function c(){o.trackSDKEvent({eventName:yi.CheckoutPurchaseSuccessfulDismiss,properties:{ui_element:"go_back_to_app"}}),a()()}bs(()=>{o.trackSDKEvent({eventName:yi.CheckoutPurchaseSuccessfulImpression})}),Ss();var u=Mf(()=>n().translate(Dt.SuccessPagePurchaseSuccessful)),d=Mf(()=>n().translate(Dt.SuccessPageButtonClose));rP(t,{type:"success",get title(){return $(u)},onDismiss:c,get closeButtonTitle(){return $(d)},icon:f=>{qU(f)},$$slots:{icon:!0}}),Xt()}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){Yt(e,!1),Vt(t,WZ);const r=Da(),n=()=>ga(o,"$translator",r);let a=Nt(e,"isExpanded",12,!0),i=Nt(e,"children",8);const o=Qn(Ui);function c(){a(!a())}Ss();var u=GZ(),d=Le(u),f=Le(d);Ar(f,{size:"label-default",children:(D,P)=>{var A=Sr(),C=Jt(A);{var O=x=>{var R=Fr();gt(()=>hr(R,n().translate(Dt.PricingDropdownHideDetails))),be(x,R)},I=x=>{var R=Fr();gt(()=>hr(R,n().translate(Dt.PricingDropdownShowDetails))),be(x,R)};Pt(C,x=>{a()?x(O):x(I,!1)})}be(D,A)},$$slots:{default:!0}});var h=wt(f,2),m=Le(h);{var _=D=>{Um(D,{name:"chevron-up"})},w=D=>{Um(D,{name:"chevron-down"})};Pt(m,D=>{a()?D(_):D(w,!1)})}var b=wt(d,2),E=Le(b),T=Le(E);Nn(T,()=>i()??Rr),gt(()=>{Bt(d,"aria-expanded",a()),Bc(b,"collapsed",!a())}),Lo("click",d,c),Lo("keydown",d,D=>D.key==="Enter"||D.key===" "?c():null),be(t,u),Xt()}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){Yt(e,!1),Vt(t,XZ);let r=Nt(e,"children",8);Ss();var n=YZ(),a=Le(n);Nn(a,()=>r()??Rr),be(t,n),Xt()}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;Yt(e,!0),Vt(t,aee);const n=Da(),a=()=>ga(c,"$translator",n),i=_=>{var w=nee(),b=Le(w);{var E=x=>{var R=tee(),N=Jt(R),L=Le(N),j=Le(L);Ar(j,{size:"body-small",children:(Z,ae)=>{var G=Fr();gt(()=>hr(G,a().translate(Dt.PricingTotalExcludingTax))),be(Z,G)},$$slots:{default:!0}});var z=wt(L,2),U=Le(z);Ar(U,{size:"body-small",children:(Z,ae)=>{var G=Fr();gt(()=>hr(G,a().formatPrice(e.priceBreakdown.totalExcludingTaxInMicros,e.priceBreakdown.currency))),be(Z,G)},$$slots:{default:!0}});var W=wt(N,2);{var q=Z=>{var ae=QZ(),G=Le(ae),F=Le(G);Ar(F,{size:"body-small",children:(ee,he)=>{var ce=Fr();gt(()=>hr(ce,a().translate(Dt.PricingTableTax))),be(ee,ce)},$$slots:{default:!0}});var K=wt(G,2),ne=Le(K);Ar(ne,{size:"body-small",children:(ee,he)=>{JZ(ee,{children:(ce,Pe)=>{var Ge=Fr();gt(()=>hr(Ge,a().formatPrice(1234e4,e.priceBreakdown.currency))),be(ce,Ge)},$$slots:{default:!0}})},$$slots:{default:!0}}),be(Z,ae)},Y=Z=>{var ae=Sr(),G=Jt(ae);{var F=ne=>{var ee=ZZ(),he=Le(ee),ce=Le(he);gt(()=>hr(ce,a().translate(Dt.PricingTableTax)));var Pe=wt(he,2),Ge=Le(Pe);Ar(Ge,{size:"body-small",children:(se,Ce)=>{var te=Fr();gt(()=>hr(te,a().translate(Dt.PricingTableEnterBillingAddressToCalculate))),be(se,te)},$$slots:{default:!0}}),be(ne,ee)},K=ne=>{var ee=Sr(),he=Jt(ee);{var ce=Pe=>{var Ge=Sr(),se=Jt(Ge);op(se,17,()=>e.priceBreakdown.taxBreakdown,sp,(Ce,te)=>{var H=eee(),pe=Le(H),Re=Le(pe);Ar(Re,{size:"body-small",children:(ct,Ve)=>{var rt=Fr();gt(()=>hr(rt,$(te).display_name)),be(ct,rt)},$$slots:{default:!0}});var de=wt(pe,2),Ie=Le(de);Ar(Ie,{size:"body-small",children:(ct,Ve)=>{var rt=Fr();gt(()=>hr(rt,a().formatPrice($(te).tax_amount_in_micros,e.priceBreakdown.currency))),be(ct,rt)},$$slots:{default:!0}}),be(Ce,H)}),be(Pe,Ge)};Pt(he,Pe=>{e.priceBreakdown.taxBreakdown!==null&&Pe(ce)},!0)}be(ne,ee)};Pt(G,ne=>{e.priceBreakdown.taxCalculationStatus==="pending"?ne(F):ne(K,!1)},!0)}be(Z,ae)};Pt(W,Z=>{e.priceBreakdown.taxCalculationStatus==="loading"?Z(q):Z(Y,!1)})}be(x,R)};Pt(b,x=>{$(u)&&x(E)})}var T=wt(b,2);{var D=x=>{var R=ree(),N=Le(R),L=Le(N);Ar(L,{size:"body-small",children:(U,W)=>{var q=Fr();gt(()=>hr(q,a().translate(Dt.PricingTableTrialEnds,{formattedTrialEndDate:a().translateDate($(o),{dateStyle:"medium"})}))),be(U,q)},$$slots:{default:!0}});var j=wt(N,2),z=Le(j);Ar(z,{size:"body-small",children:(U,W)=>{var q=Fr();gt(()=>hr(q,a().formatPrice(e.priceBreakdown.totalAmountInMicros,e.priceBreakdown.currency))),be(U,q)},$$slots:{default:!0}}),be(x,R)};Pt(T,x=>{$(o)&&x(D)})}var P=wt(T,2),A=Le(P),C=Le(A);Ar(C,{size:"body-small",children:(x,R)=>{var N=Fr();gt(()=>hr(N,a().translate(Dt.PricingTableTotalDueToday))),be(x,N)},$$slots:{default:!0}});var O=wt(A,2),I=Le(O);Ar(I,{size:"body-small",children:(x,R)=>{var N=Sr(),L=Jt(N);{var j=U=>{var W=Fr();gt(()=>hr(W,a().formatPrice(0,e.priceBreakdown.currency))),be(U,W)},z=U=>{var W=Fr();gt(()=>hr(W,a().formatPrice(e.priceBreakdown.totalAmountInMicros,e.priceBreakdown.currency))),be(U,W)};Pt(L,U=>{$(o)?U(j):U(z,!1)})}be(x,N)},$$slots:{default:!0}}),be(_,w)};let o=sr(null);(r=e.trialPhase)!=null&&r.period&&ht(o,Gt(xT(new Date,e.trialPhase.period,!0)));const c=Qn(Ui),u=$e(()=>e.priceBreakdown.taxCalculationStatus!=="unavailable"&&e.priceBreakdown.taxCalculationStatus!=="disabled"&&e.priceBreakdown.taxBreakdown&&e.priceBreakdown.taxBreakdown.length>0);var d=Sr(),f=Jt(d);{var h=_=>{KZ(_,{children:(w,b)=>{i(w)},$$slots:{default:!0}})},m=_=>{i(_)};Pt(f,_=>{$(u)?_(h):_(m,!1)})}be(t,d),Xt()}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){Yt(e,!1),Vt(t,lee);let r=Nt(e,"productDetails",8),n=Nt(e,"showProductDescription",8);const a=r().productType===td.Subscription;Ss();var i=cee(),o=Le(i);{var c=m=>{var _=see(),w=Le(_);Ar(w,{size:"body-base",children:(b,E)=>{var T=Mf(()=>({productTitle:r().title}));oi(b,{get key(){return Dt.ProductInfoSubscribeTo},get variables(){return $(T)}})},$$slots:{default:!0}}),be(m,_)};Pt(o,m=>{a&&m(c)})}var u=wt(o,2),d=Le(u);Ar(d,{size:"heading-lg",branded:!0,children:(m,_)=>{var w=Mf(()=>({productTitle:r().title}));oi(m,{get key(){return Dt.ProductInfoProductTitle},get variables(){return $(w)}})},$$slots:{default:!0}});var f=wt(u,2);{var h=m=>{var _=oee(),w=Le(_);Ar(w,{size:"body-small",children:(b,E)=>{var T=Mf(()=>({productDescription:r().description}));oi(b,{get key(){return Dt.ProductInfoProductDescription},get variables(){return $(T)}})},$$slots:{default:!0}}),be(m,_)};Pt(f,m=>{n()&&r().description&&m(h)})}be(t,i),Xt()}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){Yt(e,!0),Vt(t,hee);const r=Da(),n=()=>ga(a,"$translator",r),a=Qn(Ui),i=$e(()=>{var N;return(N=e.introPricePhase)!=null&&N.period&&n().translatePeriod(e.introPricePhase.period.number*e.introPricePhase.cycleCount,e.introPricePhase.period.unit)||""}),o=$e(()=>"heading-lg"),c=$e(()=>{var N;return(N=e.trialPhase)!=null&&N.periodDuration?"heading-md":"heading-lg"}),u=$e(()=>{var N,L;return(N=e.trialPhase)!=null&&N.periodDuration||(L=e.introPricePhase)!=null&&L.periodDuration?"heading-md":"heading-lg"}),d=$e(()=>{var N;return(N=e.trialPhase)==null?void 0:N.periodDuration}),f=$e(()=>{var N;return(N=e.introPricePhase)==null?void 0:N.periodDuration}),h=$e(()=>{var N;return((N=e.introPricePhase)==null?void 0:N.cycleCount)==1}),m=$e(()=>{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)}),_=$e(()=>n().formatPrice(e.priceBreakdown.totalAmountInMicros,e.priceBreakdown.currency));var w=pee(),b=Le(w);{var E=N=>{var L=dee(),j=Le(L);Ar(j,{get size(){return $(o)},children:(z,U)=>{var W=$e(()=>({trialDuration:wY(e.trialPhase.periodDuration,n())}));oi(z,{get key(){return Dt.ProductInfoFreeTrialDuration},get variables(){return $(W)}})},$$slots:{default:!0}}),be(N,L)};Pt(b,N=>{var L;(L=e.trialPhase)!=null&&L.periodDuration&&N(E)})}var T=wt(b,2);{var D=N=>{var L=fee(),j=Le(L);Ar(j,{get size(){return $(c)},children:(q,Y)=>{var Z=$e(()=>$(d)?Dt.ProductInfoIntroPricePhaseAfterTrial:Dt.ProductInfoIntroPricePhase),ae=$e(()=>({introPriceDuration:$(i),introPrice:$(_)}));oi(q,{get key(){return $(Z)},get variables(){return $(ae)}})},$$slots:{default:!0}});var z=wt(j,2);{var U=q=>{Ar(q,{size:"body-small",children:(Y,Z)=>{oi(Y,{get key(){return Dt.ProductInfoIntroPricePhasePaidOnce}})},$$slots:{default:!0}})},W=q=>{var Y=Sr(),Z=Jt(Y);{var ae=G=>{Ar(G,{size:"body-small",children:(F,K)=>{var ne=Fr();gt(()=>hr(ne,n().translatePeriodFrequency(e.introPricePhase.period.number,e.introPricePhase.period.unit,{useMultipleWords:!0}))),be(F,ne)},$$slots:{default:!0}})};Pt(Z,G=>{e.introPricePhase.period&&G(ae)},!0)}be(q,Y)};Pt(z,q=>{$(h)?q(U):q(W,!1)})}be(N,L)};Pt(T,N=>{var L;(L=e.introPricePhase)!=null&&L.periodDuration&&N(D)})}var P=wt(T,2),A=Le(P);Ar(A,{get size(){return $(u)},children:(N,L)=>{var j=Fr();gt(()=>hr(j,$(m))),be(N,j)},$$slots:{default:!0}});var C=wt(A,2);{var O=N=>{Ar(N,{size:"body-small",children:(L,j)=>{var z=Fr();gt(()=>hr(z,n().translatePeriodFrequency(e.basePhase.period.number,e.basePhase.period.unit,{useMultipleWords:!0}))),be(L,z)},$$slots:{default:!0}})};Pt(C,N=>{var L;(L=e.basePhase)!=null&&L.period&&N(O)})}var I=wt(C,2);{var x=N=>{Ar(N,{size:"body-small",children:(L,j)=>{oi(L,{get key(){return Dt.ProductInfoAfter}})},$$slots:{default:!0}})},R=N=>{var L=Sr(),j=Jt(L);{var z=U=>{Ar(U,{size:"body-small",children:(W,q)=>{oi(W,{get key(){return Dt.ProductInfoAfterTrial}})},$$slots:{default:!0}})};Pt(j,U=>{$(d)&&U(z)},!0)}be(N,L)};Pt(I,N=>{$(f)?N(x):N(R,!1)})}be(t,w),Xt()}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){Vt(t,yee);let r=Nt(e,"productDetails",8),n=Nt(e,"purchaseOption",8),a=Nt(e,"showProductDescription",8),i=Nt(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 _=wt(m,2);mee(_,{get priceBreakdown(){return i()},basePhase:c,trialPhase:u,introPricePhase:d});var w=wt(h,2);iee(w,{get priceBreakdown(){return i()},trialPhase:u}),be(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){Yt(e,!0),Vt(t,bee);const r=Nt(e,"brandingAppearance",3,void 0),n=Nt(e,"brandFontConfig",3,void 0),a=Nt(e,"isInElement",3,!1),i=$e(()=>new Bm(r()).getTextStyleVars(n())),o=$e(()=>new Bm(r()).spacingStyleVars),c=$e(()=>[$(i),$(o)].join("; ")),u=$e(()=>{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);Nn(h,()=>e.children??Rr),gt(()=>{Bt(f,"style",$(c)),Bc(f,"fullscreen",!a()),Bc(f,"inside",a())}),be(t,f),Xt()}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){Yt(e,!1),Vt(t,See);let r=Nt(e,"style",8,""),n=Nt(e,"children",8);Ss();var a=wee(),i=Le(a),o=Le(i);Nn(o,()=>n()??Rr),gt(()=>Bt(i,"style",r())),be(t,a),Xt()}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){Yt(e,!0),Vt(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);Nn(o,()=>e.children??Rr),eU(3,i,()=>xee,()=>({duration:500,delay:50})),be(t,n),Xt()}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){Yt(e,!0),Vt(t,Iee);const r=Nt(e,"brandingAppearance",3,void 0),n=$e(()=>new Bm(r()).productInfoStyleVars);var a=Nee(),i=Le(a);zU(i,{location:"navbar",children:(o,c)=>{var u=Oee(),d=Jt(u),f=Le(d);Nn(f,()=>e.headerContent??Rr);var h=wt(d,2);{var m=_=>{var w=Dee(),b=Le(w);Nn(b,()=>e.bodyContent??Rr),be(_,w)};Pt(h,_=>{e.bodyContent&&_(m)})}be(o,u)},$$slots:{default:!0}}),gt(()=>Bt(a,"style",$(n))),be(t,a),Xt()}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){Vt(t,Lee);var r=jee(),n=Le(r);Um(n,{name:"close"}),Lo("click",r,function(a){rU.call(this,e,a)}),be(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){Vt(t,Fee);var e=Uee(),r=Le(e);fu(r,()=>Bee),be(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){Yt(e,!1),Vt(t,Gee);let r=Nt(e,"style",8,""),n=Nt(e,"isInElement",8,!1),a=Nt(e,"brandingInfo",8,null),i=Bs(!0);function o(){er.debugLog("closeBanner"),ht(i,!1)}Ss();var c=Sr(),u=Jt(c);{var d=f=>{var h=Hee(),m=wt(Le(h),2),_=Le(m);Ar(_,{size:"caption-default",children:(D,P)=>{var A=zee();be(D,A)},$$slots:{default:!0}});var w=wt(m,2),b=Le(w);{var E=D=>{var P=Vee(),A=Le(P);qee(A);var C=wt(A,2);Ar(C,{size:"caption-link",children:(O,I)=>{var x=$ee();be(O,x)},$$slots:{default:!0}}),gt(()=>Bt(P,"href",a().sandbox_configuration.checkout_feedback_form_url)),be(D,P)};Pt(b,D=>{var P;(P=a())!=null&&P.sandbox_configuration&&D(E)})}var T=wt(b,2);$U(T,{$$events:{click:o}}),gt(()=>{Bt(h,"style",r()),Bc(h,"isInElement",n())}),eU(2,h,()=>Pee,()=>({y:-100,duration:300})),be(f,h)};Pt(u,f=>{$(i)&&f(d)})}be(t,c),Xt()}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){Yt(e,!0),Vt(t,Yee);const r=$e(()=>new Bm(e.brandingAppearance).formStyleVars);var n=Kee(),a=Le(n);zU(a,{location:"main-block",children:(i,o)=>{var c=Sr(),u=Jt(c);Nn(u,()=>e.children??Rr),be(i,c)},$$slots:{default:!0}}),gt(()=>Bt(n,"style",$(r))),be(t,n),Xt()}var Jee=lt("<!> <!>",1),Qee=lt("<!> <!>",1);function Zee(t,e){Yt(e,!0);const r=$e(()=>{var i;return OU((i=e.brandingInfo)==null?void 0:i.appearance)??""});var n=$e(()=>{var i;return(i=e.brandingInfo)==null?void 0:i.appearance}),a=$e(()=>{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=Jt(c);{var d=h=>{Wee(h,{get style(){return $(r)},get isInElement(){return e.isInElement},get brandingInfo(){return e.brandingInfo}})};Pt(u,h=>{e.isSandbox&&h(d)})}var f=wt(u,2);Eee(f,{get style(){return $(r)},children:(h,m)=>{var _=Jee(),w=Jt(_);{var b=D=>{var P=$e(()=>{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}})};Pt(w,D=>{(e.navbarHeaderContent||e.navbarBodyContent)&&D(b)})}var E=wt(w,2),T=$e(()=>{var D;return(D=e.brandingInfo)==null?void 0:D.appearance});Xee(E,{get brandingAppearance(){return $(T)},children:(D,P)=>{var A=Sr(),C=Jt(A);Nn(C,()=>e.mainContent??Rr),be(D,A)},$$slots:{default:!0}}),be(h,_)},$$slots:{default:!0}}),be(i,c)},$$slots:{default:!0}}),Xt()}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){Vt(t,nte);var r=Sr(),n=Jt(r);{var a=o=>{var c=tte(),u=Le(c);{var d=h=>{var m=ete();gt(()=>Bt(m,"srcset",e.srcWebp)),be(h,m)};Pt(u,h=>{e.srcWebp&&h(d)})}var f=wt(u,2);gt(()=>Bt(f,"src",e.src)),be(o,c)},i=o=>{var c=rte();be(o,c)};Pt(n,o=>{e.src?o(a):o(i,!1)})}be(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){Vt(t,ste);var r=ite(),n=Le(r);Um(n,{name:"back"}),Lo("click",r,function(a){rU.call(this,e,a)}),be(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){Vt(t,ute);var r=lte(),n=Le(r);{var a=o=>{var c=cte();gt(()=>Bt(c,"srcset",e.srcWebp)),be(o,c)};Pt(n,o=>{e.srcWebp&&o(a)})}var i=wt(n,2);gt(()=>Bt(i,"src",e.src)),be(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){Yt(e,!0),Vt(t,mte);const r=x=>x==null||x==null||x==""?null:x,n=$e(()=>{var x;return r((x=e.brandingInfo)==null?void 0:x.app_icon)}),a=$e(()=>{var x;return r((x=e.brandingInfo)==null?void 0:x.app_icon_webp)}),i=$e(()=>{var x;return r((x=e.brandingInfo)==null?void 0:x.app_wordmark)}),o=$e(()=>{var x;return r((x=e.brandingInfo)==null?void 0:x.app_wordmark_webp)}),c=$e(()=>$(n)?Wh($(n)):null),u=$e(()=>$(a)?Wh($(a)):null),d=$e(()=>$(i)?Wh($(i)):null),f=$e(()=>$(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}}),be(x,R)};Pt(_,x=>{e.showCloseButton&&x(w)})}var b=wt(_,2),E=Le(b),T=Le(E);{var D=x=>{dte(x,{get src(){return $(d)},get srcWebp(){return $(f)}})},P=x=>{var R=Sr(),N=Jt(R);{var L=j=>{ate(j,{get src(){return $(c)},get srcWebp(){return $(u)}})};Pt(N,j=>{$(c)!==null&&$(u)!==null&&j(L)},!0)}be(x,R)};Pt(T,x=>{$(d)!==null?x(D):x(P,!1)})}var A=wt(T,2);{var C=x=>{Ar(x,{size:"body-base",children:(R,N)=>{var L=Fr();gt(()=>{var j;return hr(L,(j=e.brandingInfo)==null?void 0:j.app_name)}),be(R,L)},$$slots:{default:!0}})};Pt(A,x=>{$(d)===null&&x(C)})}var O=wt(b,2);{var I=x=>{var R=pte(),N=Le(R);$U(N,{$$events:{click:h}}),be(x,R)};Pt(O,x=>{e.showCloseButton&&x(I)})}gt(()=>Bc(m,"rcb-with-close-button",e.showCloseButton)),be(t,m),Xt()}var yte=lt("<!> <!> <!> <!>",1);function vte(t,e){Yt(e,!0);const r=Nt(e,"onClose",3,void 0),n=UU(e.productDetails,e.purchaseOptionToUse);let a=sr(Gt(e.defaultPriceBreakdown??{currency:n.currency,totalAmountInMicros:n.amountMicros,totalExcludingTaxInMicros:n.amountMicros,taxCalculationStatus:"unavailable",taxAmountInMicros:null,taxBreakdown:null}));const i=o=>{ht(a,Gt(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=$e(()=>!e.isInElement&&!!r());gte(o,{get brandingInfo(){return e.brandingInfo},get onClose(){return r()},get showCloseButton(){return $(c)}})},navbarBodyContent:o=>{var c=$e(()=>{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=Jt(c);{var d=E=>{HZ(E)};Pt(u,E=>{e.currentPage==="payment-entry-loading"&&E(d)})}var f=wt(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})};Pt(f,E=>{e.currentPage==="payment-entry"&&E(h)})}var m=wt(f,2);{var _=E=>{var T=$e(()=>{var P;return((P=e.brandingInfo)==null?void 0:P.support_email)??null}),D=$e(()=>{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)}})};Pt(m,E=>{e.currentPage==="error"&&E(_)})}var w=wt(m,2);{var b=E=>{VZ(E,{get onContinue(){return e.onContinue}})};Pt(w,E=>{e.currentPage==="success"&&E(b)})}be(o,c)},$$slots:{navbarHeaderContent:!0,navbarBodyContent:!0,mainContent:!0}}),Xt()}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 er.errorLog(e),new wn(Un.ConfigurationError,e)}}function kte(t,e){var r;Yt(e,!0);const n=Nt(e,"customTranslations",19,()=>({})),a=Nt(e,"skipSuccessPage",3,!1),i=e.customerEmail?_te(e.customerEmail):null;let o=sr(Gt(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(Gt({})),_=sr(null),w=sr(null),b=sr(null),E=sr(null),T=new Wb(n(),e.selectedLocale,e.defaultLocale),D=Wx(T);ed(Ui,D),ed(tP,(r=e.brandingInfo)==null?void 0:r.appearance),bs(()=>{e.isInElement||(ht(w,Gt(document.documentElement.style.height)),ht(b,Gt(document.documentElement.style.overflow)),ht(E,Gt(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),bs(async()=>{if(d===null){A(new cn(Gr.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=>{ht(u,null),ht(f,"payment-entry"),ht(m,Gt(x.gateway_params)),ht(_,Gt(x.management_url))}).catch(x=>{if(x.errorCode===Gr.MissingEmailError)return ht(o,void 0),e.purchaseOperationHelper.checkoutStart(e.appUserId,d,e.purchaseOption,e.rcPackage.webBillingProduct.presentedOfferingContext,$(o),e.metadata).then(R=>{ht(u,null),ht(f,"payment-entry"),ht(m,Gt(R.gateway_params)),ht(_,Gt(R.management_url))}).catch(R=>{A(R)});A(x)})});const P=()=>{if($(f)==="payment-entry"){e.purchaseOperationHelper.pollCurrentPurchaseForCompletion().then(x=>{ht(h,Gt(x)),a()?e.onFinished(x):ht(f,"success")}).catch(x=>{A(x)});return}if($(f)==="success"||$(f)==="error"){e.onFinished($(h));return}ht(f,"success")},A=x=>{const R=JJ({errorCode:x.getErrorCode().toString(),errorMessage:x.message});e.eventsTracker.trackSDKEvent(R),ht(u,Gt(x)),ht(f,"error")},C=()=>{e.onError($(u)??new cn(Gr.UnknownError,"Unknown error without state set."))};var O=$e(()=>e.purchases.isSandbox()),I=$e(()=>$(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}}),Xt()}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 wn(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:Oo(e.expires_date),productIdentifier:e.product_identifier,productPlanIdentifier:e.product_plan_identifier??null,unsubscribeDetectedAt:Oo(r?.unsubscribe_detected_at),billingIssueDetectedAt:Oo(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 Oo(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:Oo(u.original_purchase_date),expiresDate:Oo(u.expires_date),store:u.store,unsubscribeDetectedAt:Oo(u.unsubscribe_detected_at),isSandbox:u.is_sandbox,billingIssuesDetectedAt:Oo(u.billing_issues_detected_at),gracePeriodExpiresDate:Oo(u.grace_period_expires_date),ownershipType:u.ownership_type??"UNKNOWN",periodType:u.period_type,refundedAt:Oo(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:Oo(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 js(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 wn(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 wn.getForBackendError(c,o)}else Kw(e,r,a)}}function Kw(t,e,r,n){throw new wn(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){_t(this,"appUserId"),_t(this,"method","GET"),_t(this,"name","getOfferings"),this.appUserId=e}urlPath(){const e=encodeURIComponent(this.appUserId);return`${Jb}/${e}/offerings`}}class qte{constructor(e,r,n){_t(this,"method","GET"),_t(this,"name","getProducts"),_t(this,"appUserId"),_t(this,"productIds"),_t(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){_t(this,"method","GET"),_t(this,"name","getCustomerInfo"),_t(this,"appUserId"),this.appUserId=e}urlPath(){const e=encodeURIComponent(this.appUserId);return`${Jb}/${e}`}}class $te{constructor(){_t(this,"method","GET"),_t(this,"name","getBrandingInfo")}urlPath(){return`${Ap}/branding`}}class Vte{constructor(){_t(this,"method","POST"),_t(this,"name","postCheckoutStart")}urlPath(){return`${Ap}/checkout/start`}}class Hte{constructor(e){_t(this,"method","POST"),_t(this,"name","postCheckoutCalculateTax"),_t(this,"operationSessionId"),this.operationSessionId=e}urlPath(){return`${Ap}/checkout/${this.operationSessionId}/calculate_taxes`}}class Gte{constructor(e){_t(this,"method","POST"),_t(this,"name","postCheckoutComplete"),_t(this,"operationSessionId"),this.operationSessionId=e}urlPath(){return`${Ap}/checkout/${this.operationSessionId}/complete`}}class Wte{constructor(e){_t(this,"method","GET"),_t(this,"name","getCheckoutStatus"),_t(this,"operationSessionId"),this.operationSessionId=e}urlPath(){return`${Ap}/checkout/${this.operationSessionId}`}}class Kte{constructor(e){_t(this,"method","POST"),_t(this,"name","setAttributes"),_t(this,"appUserId"),this.appUserId=e}urlPath(){const e=encodeURIComponent(this.appUserId);return`${Jb}/${e}/attributes`}}class Yte{constructor(){_t(this,"method","POST"),_t(this,"name","postReceipt")}urlPath(){return"/v1/receipts"}}class Xte{constructor(e){_t(this,"method","GET"),_t(this,"name","getVirtualCurrencies"),_t(this,"appUserId"),this.appUserId=e}urlPath(){const e=encodeURIComponent(this.appUserId);return`${Jb}/${e}/virtual_currencies`}}const MT={};class Jte{constructor(e,r=MT){_t(this,"API_KEY"),_t(this,"httpConfig"),_t(this,"isSandbox"),this.API_KEY=e,this.httpConfig=r,this.isSandbox=X_(e)}getIsSandbox(){return this.isSandbox}async getOfferings(e){return await js(new Fte(e),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getCustomerInfo(e){return await js(new zte(e),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getProducts(e,r,n){return await js(new qte(e,r,n),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getBrandingInfo(){return await js(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 js(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 js(new Hte(e),{apiKey:this.API_KEY,body:i,httpConfig:this.httpConfig},a)}async postCheckoutComplete(e,r){const n={email:r};return await js(new Gte(e),{apiKey:this.API_KEY,body:n,httpConfig:this.httpConfig})}async getCheckoutStatus(e){return await js(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 js(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 js(new Yte,{apiKey:this.API_KEY,body:u,httpConfig:this.httpConfig})}async getVirtualCurrencies(e){return await js(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 wn(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 wn(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 wn(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 wn(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&&er.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(Dt.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,Ca.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===Ca.Month&&e.number==1)return n.formatPrice(t.amountMicros,t.currency);let a="";switch(e.unit){case Ca.Year:a=n.formatPrice(t.amountMicros/12,t.currency);break;case Ca.Month:a=n.formatPrice(t.amountMicros/e.number,t.currency);break;case Ca.Week:a=n.formatPrice(t.amountMicros*4/e.number,t.currency);break;case Ca.Day:a=n.formatPrice(t.amountMicros*30/e.number,t.currency);break}return n.translate(Dt.PaywallVariablesTotalPriceAndPerMonth,{formattedPrice:n.formatPrice(t.amountMicros,t.currency),period:n.translatePeriod(e.number,e.unit,{noWhitespace:!0,short:!r}),formattedPricePerMonth:a,monthPeriod:n.translatePeriodUnit(Ca.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(Dt.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(Dt.PeriodsLifetime),u.sub_duration_in_months=r.translate(Dt.PeriodsLifetime),u.sub_period=r.translate(Dt.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){_t(this,"initialDelay"),_t(this,"maxDelay"),_t(this,"jitterPercent"),_t(this,"callback"),_t(this,"currentDelay"),_t(this,"timeoutId"),_t(this,"executingCallback",!1),this.initialDelay=e,this.currentDelay=e,this.maxDelay=r,this.jitterPercent=n,this.callback=a}tryFlush(){if(this.backingOff()){er.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);er.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){er.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){_t(this,"EVENT_TYPE","web_billing"),_t(this,"id"),_t(this,"timestampMs"),_t(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){_t(this,"apiKey"),_t(this,"eventsQueue",[]),_t(this,"eventsUrl"),_t(this,"flushManager"),_t(this,"traceId",Fm()),_t(this,"appUserId"),_t(this,"isSilent"),_t(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){er.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{er.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 er.debugLog("Events failed to flush due to server error"),new Error("Events failed to flush due to server error")}).catch(r=>{throw er.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){Yt(e,!1),Vt(t,Ire);let r=Nt(e,"productIdentifier",8),n=Nt(e,"productType",8),a=Nt(e,"basePrice",8),i=Nt(e,"freeTrialPeriod",8,void 0),o=Nt(e,"introPriceFormatted",8,void 0),c=Nt(e,"onValidPurchase",8),u=Nt(e,"onFailedPurchase",8),d=Nt(e,"onCancel",8);function f(U){U.target===U.currentTarget&&d()()}Ss();var h=Nre(),m=Le(h),_=Le(m),w=wt(Le(_),2),b=Le(w),E=Le(b),T=wt(Le(E)),D=wt(E,2),P=wt(Le(D)),A=wt(D,2),C=wt(Le(A)),O=wt(A,2);{var I=U=>{var W=Dre(),q=wt(Le(W));gt(()=>hr(q,` ${i()??""}`)),be(U,W)};Pt(O,U=>{i()&&U(I)})}var x=wt(O,2);{var R=U=>{var W=Ore(),q=wt(Le(W));gt(()=>hr(q,` ${o()??""}`)),be(U,W)};Pt(x,U=>{o()&&U(R)})}var N=wt(w,2),L=Le(N),j=wt(L,2),z=wt(j,2);gt(()=>{hr(T,` ${r()??""}`),hr(P,` ${n()??""}`),hr(C,` ${a()??""}`)}),Lo("click",L,function(...U){var W;(W=c())==null||W.apply(this,U)}),Lo("click",j,function(...U){var W;(W=u())==null||W.apply(this,U)}),Lo("click",z,function(...U){var W;(W=d())==null||W.apply(this,U)}),Lo("click",h,f),be(t,h),Xt()}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 wn(Un.ProductNotAvailableForPurchaseError,"Simulated test purchase failure: no real transaction occurred"))},onCancel:()=>{_(),f(new wn(Un.UserCancelledError))}}})})}class Lre{constructor(){_t(this,"virtualCurrenciesCache",new Map),_t(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 ai{constructor(e,r,n=MT,a=Yw){oW(Zv,5,this),_t(this,"_API_KEY"),_t(this,"_appUserId"),_t(this,"_brandingInfo",null),_t(this,"_loadingResourcesPromise",null),_t(this,"_flags"),_t(this,"backend"),_t(this,"purchaseOperationHelper"),_t(this,"eventsTracker"),_t(this,"inMemoryCache"),this._API_KEY=e,this._appUserId=r,this._flags={...Yw,...a},X_(e)?er.debugLog("Initializing Purchases SDK with Web billing sandbox API Key"):qu(e)&&er.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:yi.SDKInitialized})}static setLogLevel(e){er.setLogLevel(e)}static setLogHandler(e){er.setLogHandler(e)}static setPlatformInfo(e){ai._platformInfo=e}static getPlatformInfo(){return ai._platformInfo}static getSharedInstance(){if(ai.isConfigured())return ai.instance;throw new BK}static isConfigured(){return ai.instance!==void 0}static configure(e,r,n,a){ai.instance!==void 0&&er.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 wn(Un.ConfigurationError,"API key must be provided as a string");if(typeof r!="string")throw new wn(Un.ConfigurationError,"App user ID must be provided as a string");i={apiKey:e,appUserId:r,httpConfig:n,flags:a}}return ai.configureInternal(i),ai.getSharedInstance()}static configureInternal(e){const{apiKey:r,appUserId:n,httpConfig:a,flags:i}=e,o=a??MT,c=i??Yw;ai.validateConfig(e),ai.instance=new ai(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()){er.verboseLog("Purchases resources are loaded. Skipping.");return}if(this._loadingResourcesPromise!==null){er.verboseLog("Purchases resources are loading. Waiting."),await this._loadingResourcesPromise;return}return this._loadingResourcesPromise=this.fetchAndCacheBrandingInfo().catch(e=>{let r=`${e}`;e instanceof wn&&(r=`${e.message}. ${e.underlyingErrorMessage?`Underlying error: ${e.underlyingErrorMessage}`:""}`),er.errorLog(`Error fetching branding info: ${r}`)}).finally(()=>{this._loadingResourcesPromise=null}),this._loadingResourcesPromise}async fetchAndCacheBrandingInfo(){if(qu(this._API_KEY)){er.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="",er.debugLog("Purchase cancelled by user"),_(new wn(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;er.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="",er.debugLog("Purchase cancelled by user"),C(new wn(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(),er.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(wn.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 wn(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&&er.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(){ai.instance===this?(this.eventsTracker&&this.eventsTracker.dispose(),ai.instance=void 0):er.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 er.debugLog("Vending VirtualCurrencies from cache."),r;const n=await this.backend.getVirtualCurrencies(e),a=Ure(n);return er.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),_t(Kh,"_platformInfo"),_t(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=Wr.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 zr(()=>import("./index-Da3zxd8Y.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 Ii(){const t=Al;if(!t?.Purchases){if(Wr.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=Wr.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_(){Wr.getPlatform(),zre(qm);try{Uo.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:Ii,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}=Vr(),[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=Ii()||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=Ii();if(!A?.getOfferings||!A?.purchasePackage)try{await bf(),A=Ii()}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=Ii();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=Ii();if(!A?.getOfferings||!A?.purchasePackage)try{await bf(),A=Ii()}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=Ii();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=Ii();if(!A?.getCustomerInfo||!A?.syncPurchases)try{await bf(),A=Ii()}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,ca={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 zr(()=>import("./lottie-DWmka5ZO.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 zr(()=>import("./winning-lottie-NODzSKgp.js"),[],import.meta.url);return hv=e.default||e,hv}else{const e=await zr(()=>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 Lr()}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=ca.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")?ca.flash.ceeLoShortMs:m.kind==="win"?ca.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 Ts(){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=r9,cN=w3;function Lg(){const{user:t,refreshUser:e}=Vr(),{rc:r,ready:n,error:a,buyChips:i,buySubscription:o,restorePurchases:c}=Xre(),{infoNow:u}=Ts(),[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),[z,U]=v.useState(void 0),[W,q]=v.useState(!1),Y=Wr.getPlatform()==="web",Z=li(),ae=!0,G=v.useMemo(()=>r?.Purchases,[r]);v.useCallback(ce=>ce?.all?.[oN]?ce.all[oN]:ce?.current||ce?.all?.default||null,[]);const F=v.useCallback(async()=>{try{const Pe=await Ii()?.getCustomerInfo?.();let Ge=!1;const se=Pe?.entitlements?.active||{},Ce=Object.keys(se).length>0;cN&&(Ge=!!se?.[cN]||Ce),D(Ge)}catch{}},[G,ae]);v.useEffect(()=>{n&&ae&&F()},[n,ae,F]),v.useEffect(()=>{if(!n||!ae)return;let ce=0;const Pe=6,Ge=setInterval(()=>{ce+=1,F(),ce>=Pe&&clearInterval(Ge)},500);return()=>clearInterval(Ge)},[n,ae,F]),v.useEffect(()=>{let ce=!1;return(async()=>{try{if(!n||!ae)return;const Ge=await Ii()?.getOfferings?.();if(!Ge)return;const se=[],Ce=Ke=>{Array.isArray(Ke)&&Ke.forEach(it=>{it&&se.push(it)})};Ce(Ge?.current?.availablePackages||Ge?.current?.packages),Ge?.all&&Object.values(Ge.all).forEach(Ke=>Ce(Ke?.availablePackages||Ke?.packages));const te=Ke=>Ke?.identifier||Ke?.product?.identifier||Ke?.rcBillingProduct?.identifier||Ke?.webBillingProduct?.identifier,H=Ke=>Ke?.product||Ke?.rcBillingProduct||Ke?.webBillingProduct||Ke,pe=Ke=>{const it=H(Ke);return!!(Ke?.packageType==="MONTHLY"||Ke?.packageType==="ANNUAL"||it?.subscriptionPeriod||it?.period||it?.defaultSubscriptionOption||it?.productType&&/subscription/i.test(String(it.productType)))},Re=Ke=>Ke?.priceString||Ke?.price?.formattedPrice||Ke?.currentPrice?.formattedPrice||Ke?.price||Ke?.defaultPurchaseOption?.basePrice?.formattedPrice,de=Ke=>String(Ke?.title||Ke?.displayName||""),Ie=Ke=>String(Ke?.description||""),ct=Ke=>Ke?se.find(it=>te(it)===Ke):void 0;let Ve=ct(fne)||ct(pne);if(Ve||(Ve=se.find(Ke=>!pe(Ke))),Ve){const Ke=H(Ve),it=Re(Ke),Et=de(Ke),It=Ie(Ke),bt=String(te(Ve)||""),me=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,""),ke=parseInt(at,10);return Number.isFinite(ke)?ke:null},Be=me(Et)??me(It)??me(bt),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",Mt=it?`${Ct} for ${it}`:void 0;ce||A(Mt),ce||x("Top up your Z Credits to keep playing.")}let rt=ct(hne);if(rt||(rt=se.find(Et=>Et?.packageType==="MONTHLY"||/month/i.test(String(te(Et)||""))||/month/i.test(de(H(Et))))||se.find(Et=>pe(Et)||/year|annual|week|month/i.test(String(te(Et)||"")))),ce||q(!!rt),rt){const Ke=H(rt),it=Re(Ke),Et=it?`${it} Mo`:void 0;if(ce||O(Et),ce||N("Remove ads and unlock premium features."),ce||j(it),!ce){let It="Auto-renewing";const bt=rt?.packageType||Ke?.subscriptionPeriod||Ke?.period||Ke?.defaultSubscriptionOption?.period,me=String(bt||"").toUpperCase();me.includes("MONTH")||me==="MONTHLY"||me==="P1M"?It="Monthly":me.includes("YEAR")||me==="ANNUAL"||me==="P1Y"?It="Annual":me.includes("WEEK")||me==="WEEKLY"||me==="P1W"?It="Weekly":(me.includes("DAY")||me==="P1D")&&(It="Daily"),U(It)}}}catch{}})(),()=>{ce=!0}},[n,ae,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(ce){let Pe=ce?.message||"Purchase unavailable right now. Please try again shortly.";try{const Ge=ce?.getErrorCode?.()??ce?.errorCode??ce?.code,se=typeof Ge=="number"?Ge===3?"PurchaseNotAllowedError":Ge===2?"StoreProblemError":Ge===5?"ProductNotAvailableForPurchaseError":void 0:void 0;se==="PurchaseNotAllowedError"?Pe="Purchases not allowed for this Apple ID/device. Use an App Store sandbox account and ensure the Paid Apps Agreement is accepted.":se==="StoreProblemError"?Pe="App Store is currently unavailable. Please try again later or verify sandbox account is signed in to the device.":se==="ProductNotAvailableForPurchaseError"&&(Pe="Product not available. Verify the product identifier matches App Store Connect and RevenueCat configuration for this app target.")}catch{}u("Purchase failed",Pe)}finally{m(!1),f(!1)}}},ne=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 zr(async()=>{const{reconfigureRevenueCat:ce}=await Promise.resolve().then(()=>Hre);return{reconfigureRevenueCat:ce}},void 0,import.meta.url)).reconfigureRevenueCat()}catch{}w(!1),f(!1);return}try{await o(),await F(),u("Subscription active","Thanks for supporting.")}finally{w(!1),f(!1)}}},ee=async()=>{if(t?.id&&!d){if(f(!0),E(!0),!n)throw new Error("Payment service not ready");await c(),await F();try{const ce=await ci();ce&&await fetch(`${Z}/api/payment/revenuecat/restore`,{method:"POST",headers:{Authorization:`Bearer ${ce}`}})}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)}},he=v.useMemo(()=>!n||!ae?"Initializing…":T?"Premium Active":"Go Premium",[T,n,ae]);return{ready:n,error:a||null,busy:d,busyChips:h,busySubscription:_,premiumActive:T,hasPremiumPackage:W,premiumLabel:he,purchasesReady:ae,isWeb:Y,onBuyChips:K,onGoPremium:ne,onRestore:ee,chipsSubtitle:P,premiumSubtitle:C,chipsDescription:I,premiumDescription:R,premiumPrice:L,premiumInterval:z}}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=ao("Haptics",{web:()=>zr(()=>import("./web-o0KWHNuW.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 rr(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:rr,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{rr("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}=Vr(),{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}=Ts(),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:_}=Vr(),w=v.useMemo(()=>{if(_)return!1;const A=m?.email||"";return!A||/@guest\.local$/i.test(A)},[m?.email,_]),b=v.useCallback(()=>{try{o&&gs.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&&gs.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="craps";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}=Vr(),[e,r]=v.useState(null),[n,a]=v.useState(!1),[i,o]=v.useState(null),c=li(),u=v.useCallback(async()=>{if(t){a(!0),o(null);try{const d=await ci(),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=ao("CapacitorUpdater",{web:()=>zr(()=>import("./web-C0yQtqzp.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 Xa(){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=Xa();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=Xa();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=Xa();return cS=(r,n)=>new t(r,n).major,cS}var lS,SN;function Rne(){if(SN)return lS;SN=1;const t=Xa();return lS=(r,n)=>new t(r,n).minor,lS}var uS,EN;function Dne(){if(EN)return uS;EN=1;const t=Xa();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 oo(){if(CN)return fS;CN=1;const t=Xa();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=oo();return pS=(r,n,a)=>t(n,r,a),pS}var hS,PN;function Ine(){if(PN)return hS;PN=1;const t=oo();return hS=(r,n)=>t(r,n,!0),hS}var mS,AN;function hP(){if(AN)return mS;AN=1;const t=Xa();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=oo();return vS=(r,n,a)=>t(r,n,a)>0,vS}var _S,NN;function mP(){if(NN)return _S;NN=1;const t=oo();return _S=(r,n,a)=>t(r,n,a)<0,_S}var bS,IN;function vF(){if(IN)return bS;IN=1;const t=oo();return bS=(r,n,a)=>t(r,n,a)===0,bS}var kS,MN;function _F(){if(MN)return kS;MN=1;const t=oo();return kS=(r,n,a)=>t(r,n,a)!==0,kS}var wS,jN;function gP(){if(jN)return wS;jN=1;const t=oo();return wS=(r,n,a)=>t(r,n,a)>=0,wS}var SS,LN;function yP(){if(LN)return SS;LN=1;const t=oo();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=Xa(),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 co(){if(qN)return xS;qN=1;const t=/\s+/g;class e{constructor(W,q){if(q=a(q),W instanceof e)return W.loose===!!q.loose&&W.includePrerelease===!!q.includePrerelease?W:new e(W.raw,q);if(W instanceof i)return this.raw=W.value,this.set=[[W]],this.formatted=void 0,this;if(this.options=q,this.loose=!!q.loose,this.includePrerelease=!!q.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(Z=>!b(Z[0])),this.set.length===0)this.set=[Y];else if(this.set.length>1){for(const Z of this.set)if(Z.length===1&&E(Z[0])){this.set=[Z];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 q=this.set[W];for(let Y=0;Y<q.length;Y++)Y>0&&(this.formatted+=" "),this.formatted+=q[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,Z=n.get(Y);if(Z)return Z;const ae=this.options.loose,G=ae?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 F=W.split(" ").map(he=>D(he,this.options)).join(" ").split(/\s+/).map(he=>L(he,this.options));ae&&(F=F.filter(he=>(o("loose invalid filter",he,this.options),!!he.match(u[d.COMPARATORLOOSE])))),o("range list",F);const K=new Map,ne=F.map(he=>new i(he,this.options));for(const he of ne){if(b(he))return[he];K.set(he.value,he)}K.size>1&&K.has("")&&K.delete("");const ee=[...K.values()];return n.set(Y,ee),ee}intersects(W,q){if(!(W instanceof e))throw new TypeError("a Range is required");return this.set.some(Y=>T(Y,q)&&W.set.some(Z=>T(Z,q)&&Y.every(ae=>Z.every(G=>ae.intersects(G,q)))))}test(W){if(!W)return!1;if(typeof W=="string")try{W=new c(W,this.options)}catch{return!1}for(let q=0;q<this.set.length;q++)if(z(this.set[q],W,this.options))return!0;return!1}}xS=e;const r=Bne(),n=new r,a=pP(),i=t0(),o=Zb(),c=Xa(),{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 q=!0;const Y=U.slice();let Z=Y.pop();for(;q&&Y.length;)q=Y.every(ae=>Z.intersects(ae,W)),Z=Y.pop();return q},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(q=>C(q,W)).join(" "),C=(U,W)=>{const q=W.loose?u[d.TILDELOOSE]:u[d.TILDE];return U.replace(q,(Y,Z,ae,G,F)=>{o("tilde",U,Y,Z,ae,G,F);let K;return P(Z)?K="":P(ae)?K=`>=${Z}.0.0 <${+Z+1}.0.0-0`:P(G)?K=`>=${Z}.${ae}.0 <${Z}.${+ae+1}.0-0`:F?(o("replaceTilde pr",F),K=`>=${Z}.${ae}.${G}-${F} <${Z}.${+ae+1}.0-0`):K=`>=${Z}.${ae}.${G} <${Z}.${+ae+1}.0-0`,o("tilde return",K),K})},O=(U,W)=>U.trim().split(/\s+/).map(q=>I(q,W)).join(" "),I=(U,W)=>{o("caret",U,W);const q=W.loose?u[d.CARETLOOSE]:u[d.CARET],Y=W.includePrerelease?"-0":"";return U.replace(q,(Z,ae,G,F,K)=>{o("caret",U,Z,ae,G,F,K);let ne;return P(ae)?ne="":P(G)?ne=`>=${ae}.0.0${Y} <${+ae+1}.0.0-0`:P(F)?ae==="0"?ne=`>=${ae}.${G}.0${Y} <${ae}.${+G+1}.0-0`:ne=`>=${ae}.${G}.0${Y} <${+ae+1}.0.0-0`:K?(o("replaceCaret pr",K),ae==="0"?G==="0"?ne=`>=${ae}.${G}.${F}-${K} <${ae}.${G}.${+F+1}-0`:ne=`>=${ae}.${G}.${F}-${K} <${ae}.${+G+1}.0-0`:ne=`>=${ae}.${G}.${F}-${K} <${+ae+1}.0.0-0`):(o("no pr"),ae==="0"?G==="0"?ne=`>=${ae}.${G}.${F}${Y} <${ae}.${G}.${+F+1}-0`:ne=`>=${ae}.${G}.${F}${Y} <${ae}.${+G+1}.0-0`:ne=`>=${ae}.${G}.${F} <${+ae+1}.0.0-0`),o("caret return",ne),ne})},x=(U,W)=>(o("replaceXRanges",U,W),U.split(/\s+/).map(q=>R(q,W)).join(" ")),R=(U,W)=>{U=U.trim();const q=W.loose?u[d.XRANGELOOSE]:u[d.XRANGE];return U.replace(q,(Y,Z,ae,G,F,K)=>{o("xRange",U,Y,Z,ae,G,F,K);const ne=P(ae),ee=ne||P(G),he=ee||P(F),ce=he;return Z==="="&&ce&&(Z=""),K=W.includePrerelease?"-0":"",ne?Z===">"||Z==="<"?Y="<0.0.0-0":Y="*":Z&&ce?(ee&&(G=0),F=0,Z===">"?(Z=">=",ee?(ae=+ae+1,G=0,F=0):(G=+G+1,F=0)):Z==="<="&&(Z="<",ee?ae=+ae+1:G=+G+1),Z==="<"&&(K="-0"),Y=`${Z+ae}.${G}.${F}${K}`):ee?Y=`>=${ae}.0.0${K} <${+ae+1}.0.0-0`:he&&(Y=`>=${ae}.${G}.0${K} <${ae}.${+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,q,Y,Z,ae,G,F,K,ne,ee,he,ce)=>(P(Y)?q="":P(Z)?q=`>=${Y}.0.0${U?"-0":""}`:P(ae)?q=`>=${Y}.${Z}.0${U?"-0":""}`:G?q=`>=${q}`:q=`>=${q}${U?"-0":""}`,P(ne)?K="":P(ee)?K=`<${+ne+1}.0.0-0`:P(he)?K=`<${ne}.${+ee+1}.0-0`:ce?K=`<=${ne}.${ee}.${he}-${ce}`:U?K=`<${ne}.${ee}.${+he+1}-0`:K=`<=${K}`,`${q} ${K}`.trim()),z=(U,W,q)=>{for(let Y=0;Y<U.length;Y++)if(!U[Y].test(W))return!1;if(W.prerelease.length&&!q.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 Z=U[Y].semver;if(Z.major===W.major&&Z.minor===W.minor&&Z.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=Xa(),u=co();return PS}var AS,$N;function r0(){if($N)return AS;$N=1;const t=co();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=co();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=Xa(),e=co();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=Xa(),e=co();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=Xa(),e=co(),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=co();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=Xa(),e=t0(),{ANY:r}=e,n=co(),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=co();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=oo();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=co(),e=t0(),{ANY:r}=e,n=r0(),a=oo(),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=Xa(),n=yF(),a=Rp(),i=Tne(),o=Cne(),c=xne(),u=Pne(),d=Ane(),f=Rne(),h=Dne(),m=One(),_=oo(),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=co(),z=r0(),U=Une(),W=Fne(),q=qne(),Y=zne(),Z=$ne(),ae=vP(),G=Vne(),F=Hne(),K=Gne(),ne=Wne(),ee=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:z,toComparators:U,maxSatisfying:W,minSatisfying:q,minVersion:Y,validRange:Z,outside:ae,gtr:G,ltr:F,intersects:K,simplifyRange:ne,subset:ee,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("craps").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||l9,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 Uo.getInfo();this.nativeVersion=e.version;const r=await gs.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 Uo.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 gs.set({key:"ota_state",value:JSON.stringify(e)})}}const ls=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(ls.getVersions()),[r,n]=v.useState(!1),[a,i]=v.useState(null),[o,c]=v.useState({stage:"idle"}),u=v.useRef(null);v.useEffect(()=>{e(ls.getVersions())},[]);const d=v.useCallback(async()=>{n(!0);try{try{const _=Date.now(),w=await Ys.get(sI),b=w?Number(w):0;if(b&&_-b<lae()){n(!1);return}}catch{}const m=await ls.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 ls.downloadUpdate(m.release,b=>c(b));c({stage:"applying"}),await ls.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 Ys.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 ls.downloadUpdate(m,w=>c(w));c({stage:"applying"}),await ls.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 ls.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 ls.downloadUpdate(c.release,d=>{});await ls.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 Uo.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 zr(async()=>{const{Preferences:_}=await Promise.resolve().then(()=>Ic);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 zr(async()=>{const{Preferences:m}=await Promise.resolve().then(()=>Ic);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}=ma(),{logout:h,user:m,refreshUser:_}=Vr(),[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="craps",L=(()=>{try{return window?.APP_TARGET??""}catch{return""}})(),j=(N||L).toString().toLowerCase().trim(),z=j==="craps"?"craps":j==="poker"?"poker":j==="cee-lo"||j==="ceelo"?"cee-lo":null,[U,W]=v.useState(z??null),[q,Y]=v.useState(!1),[Z,ae]=v.useState(!1),G=v.useRef(null),{info:F}=cu();v.useEffect(()=>{z||(async()=>{try{const{Preferences:oe}=await zr(async()=>{const{Preferences:pt}=await Promise.resolve().then(()=>Ic);return{Preferences:pt}},void 0,import.meta.url),{value:Ne}=await oe.get({key:"selectedGameMode"});W(Ne==="cee-lo"||Ne==="craps"||Ne==="poker"?Ne:"cee-lo")}catch{W("cee-lo")}})()},[z]),v.useEffect(()=>{z||U&&(async()=>{try{const{Preferences:oe}=await zr(async()=>{const{Preferences:Ne}=await Promise.resolve().then(()=>Ic);return{Preferences:Ne}},void 0,import.meta.url);await oe.set({key:"selectedGameMode",value:U})}catch{}})()},[U,z]);const K=v.useMemo(()=>{const oe=z??U;if(!oe)return c;const Ne=pt=>pt.filter(Rt=>(Rt.gameMode||"cee-lo")===oe);return{public:Ne(c.public),private:Ne(c.private)}},[c,z,U]),ne=v.useRef(null),ee=v.useCallback(()=>{rr("Light")},[]),he=v.useCallback(()=>{try{}catch{}},[]),ce=v.useCallback(()=>{try{Lr()}catch{}},[]),Pe=v.useCallback(oe=>{ce(),oe!==U?(ee(),he(),W(oe)):(ee(),he())},[U,ee,he,ce]),Ge=v.useRef(null),se=v.useRef(null),[Ce,te]=v.useState(1),[H,pe]=v.useState(null),Re=v.useCallback(()=>{const oe=se.current,Ne=Ge.current;if(!oe||!Ne)return;const pt=oe.style.transform;oe.style.transform="none";const Rt=oe.scrollHeight,Ut=window.innerHeight;let dr=Math.min(1,Ut/Rt);te(dr),pe(Rt*dr),oe.style.transform=pt},[]);v.useLayoutEffect(()=>{Re()},[Re,U]),v.useEffect(()=>{const oe=new ResizeObserver(()=>requestAnimationFrame(Re)),Ne=se.current;Ne&&oe.observe(Ne),window.addEventListener("resize",Re);const pt=setTimeout(Re,250),Rt=setTimeout(Re,800);return()=>{oe.disconnect(),window.removeEventListener("resize",Re),clearTimeout(pt),clearTimeout(Rt)}},[Re]);const de=v.useCallback(()=>{o("/profile")},[o]),Ie=v.useCallback(()=>{o("/settings")},[o]),ct=v.useCallback(()=>{o("/add-chips")},[o]),Ve=v.useCallback(()=>{o("/login")},[o]),rt=v.useCallback(()=>{ce(),ee(),he(),h()},[h,ee,he,ce]),Ke=async()=>{try{const oe=m&&typeof m.balance=="number"?Number(m.balance):null;if(oe!=null)return oe;try{await Promise.resolve(_())}catch{}const Ne=m&&typeof m.balance=="number"?Number(m.balance):null;if(Ne!=null)return Ne}catch{}try{const oe=await f?.();if(oe?.ok&&typeof oe.data?.balance=="number")return Number(oe.data.balance)}catch{}return null},it=v.useCallback(async()=>{ce(),ee(),he();try{if(m?.isGuest===!0){R(!0);return}}catch{}if(U==="poker")try{const oe=await Ke();if(oe!=null&&oe<1e3){Y(!0);return}}catch{}T(!0)},[ce,ee,he,U,m,_,i,Ve]),Et=v.useCallback(async()=>{ce(),ee(),he();try{if(m?.isGuest===!0){R(!0);return}}catch{}if(U==="poker")try{const oe=await Ke();if(oe!=null&&oe<1e3){Y(!0);return}}catch{}P(!0)},[ce,ee,he,U,m,_,i,Ve]),It=v.useCallback(()=>{document.activeElement?.blur?.()},[]),bt=v.useCallback(()=>{It(),Et()},[It,Et]),me=v.useCallback(()=>{It(),it()},[It,it]),{meId:Be}=Vr(),je=v.useCallback(async()=>{if(ce(),!!U&&!O){I(!0),ae(!0),ee(),he(),G.current&&clearTimeout(G.current),G.current=window.setTimeout(()=>{ae(!1),F("Try again.",{duration:3e3})},15e3);try{let oe;U==="poker"?oe=await d({name:"Single Player Room",singlePlayer:!0}):oe=await u({singlePlayer:!0,name:"Single Player Room",gameMode:U});try{window.location.search.includes("e2e=1")&&(window.__handleCreateSingleRes=oe)}catch{}const Ne=oe?.room??oe?.roomsList?.room??oe?.data?.room??null,pt=(()=>{try{return window.location.search.includes("e2e=1")||window.__E2E===!0||window.sessionStorage?.getItem("e2e")==="1"}catch{return!1}})(),Rt=Ne?.roomId??Ne?.id??oe?.roomId??oe?.data?.roomId;if(Rt&&Ne){G.current&&(clearTimeout(G.current),G.current=null);try{window.__PRESEEDED_ROOM=Ne}catch{}const Ut=pt?"?e2e=1":"";o(U==="poker"?`/poker/room/${Rt}${Ut}`:`/room/${Rt}${Ut}`)}else if(oe?.error){const Ut=(()=>{try{return window.location.search.includes("e2e=1")||window.__E2E===!0||window.sessionStorage?.getItem("e2e")==="1"}catch{return!1}})(),dr=String(oe.error||"");if(!Ut&&/insufficient|minimum buy-in/i.test(dr)){Y(!0);return}}}catch(oe){const Ne=(()=>{try{return window.location.search.includes("e2e=1")||window.__E2E===!0||window.sessionStorage?.getItem("e2e")==="1"}catch{return!1}})();if(Ne){const pt=`e2e-${Math.random().toString(36).slice(2,8)}`;try{window.__handleCreateSingleRes={ok:!0,roomId:pt}}catch{}const Rt=Ne?"&e2e=1":"";o(U==="poker"?`/poker/room/${pt}?m=${U}${Rt}`:`/room/${pt}?m=${U}${Rt}`)}else{const pt=String(oe?.message??oe??"");/insufficient|minimum buy-in/i.test(pt)&&Y(!0)}}finally{I(!1),ae(!1),G.current&&(clearTimeout(G.current),G.current=null)}}},[ce,u,ee,he,o,O,U,Be,F]),nt=v.useCallback(oe=>()=>{ce(),ee(),he(),oe()},[ce,ee,he]);m?.membershipTier;const Ct=!!m,Mt=(()=>{try{return m?.isGuest===!0}catch{return!1}})(),De=v.useMemo(()=>[{key:"profile",label:"Profile",onClick:nt(de)},{key:"chips",label:"Shop",onClick:nt(ct)},{key:"logout",label:"Log Out",onClick:nt(rt)}],[nt,de,Ie,ct]),et=v.useCallback(oe=>{oe.stopPropagation(),ce(),ee(),he();try{if(m?.isGuest===!0){R(!0);return}}catch{}C(Ne=>!Ne)},[ce,ee,he,m,Ve]),at=v.useCallback(()=>C(!1),[]),ke=v.useCallback(()=>T(!1),[]),st=v.useCallback(()=>P(!1),[]),kt=v.useCallback(()=>i(!1),[i]),[nr,lr]=v.useState(!1),ur=v.useCallback(()=>{ce(),ee(),he(),lr(!0)},[ce,ee,he]),Er=v.useCallback(()=>lr(!1),[]),[dn,J]=v.useState(!1),[ue,ve]=v.useState(!1);v.useEffect(()=>{let oe=!0;return(async()=>{try{const{Preferences:Ne}=await zr(async()=>{const{Preferences:Rt}=await Promise.resolve().then(()=>Ic);return{Preferences:Rt}},void 0,import.meta.url),{value:pt}=await Ne.get({key:"seenOnboardingV1"});if(!oe)return;ve(pt!=="1")}catch{if(!oe)return;ve(!0)}})(),()=>{oe=!1}},[]);const Ae=v.useCallback(()=>ve(!1),[]),B=v.useCallback(()=>{ce(),ee(),he(),J(!0)},[ce,ee,he]),Q=v.useCallback(()=>J(!1),[]);return g.jsxs("div",{className:"HomeScreen theme-casino home-fixed-root",children:[g.jsx(Li,{className:"page-home-screen"}),g.jsx(fae,{}),g.jsx(fP,{open:ue,onClose:Ae}),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:ur,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:B,children:"Leaderboards"}),!m&&g.jsx("a",{className:"gold-link",onClick:nt(Ve),children:"Login"}),m&&g.jsxs(g.Fragment,{children:[g.jsx("a",{ref:ne,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:ne,open:A,onClose:at,items:De})]})]}),g.jsx("div",{ref:Ge,className:"home-fit-shell",style:H?{height:H}:void 0,children:g.jsxs("div",{ref:se,className:"home-fit-content",style:Ce<1?{transform:`scale(${Ce})`,transformOrigin:"top center"}:void 0,children:[(!Ct||Mt)&&g.jsxs("div",{className:`promo-banner ${z?`promo-banner--${z}`:""}`,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(Ve),"aria-label":"Login",children:"Login"})})]}),g.jsx(hF,{}),!z&&g.jsx(mae,{selected:U,onChange:Pe,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:bt,disabled:!U,"aria-label":"Join Room",children:"Join Room"}),g.jsx("button",{className:"btn gold-outline cta-btn primaryButton",onClick:me,disabled:!U,"aria-label":"Create Room",children:"Create Room"})]})]})}),g.jsx(JG,{open:E,onClose:ke,gameMode:U??"cee-lo"}),g.jsx(QG,{open:D,onClose:st,isPrivate:w,setIsPrivate:b,roomsList:K}),g.jsx(pF,{open:a,onClose:kt,planId:m?.membershipTier}),g.jsx(gF,{open:nr,onClose:Er}),g.jsx(Sne,{open:dn,onClose:Q}),g.jsx(Ene,{open:x,onClose:()=>R(!1),onGoLogin:()=>Ve(),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 xr(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 dt(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){xr(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 to(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,_n=wF,dI=SF,yv=EF;Zl.document;var Kc=!!_n.documentElement&&!!_n.head&&typeof _n.addEventListener=="function"&&typeof _n.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"],Aa="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=[Aa,Ug,PF,AF,RF,DF,OF,NF,IF,MF,jF,LF,BF,UF,FF];zS={},xr(xr(xr(xr(xr(xr(xr(xr(xr(xr(zS,Aa,Oae),Ug,Nae),PF,Iae),AF,Mae),RF,jae),DF,Lae),OF,Bae),NF,Uae),IF,Fae),MF,qae),xr(xr(xr(xr(xr(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";xr(xr({},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={},xr(xr(xr(xr(xr(xr(xr(xr(xr(xr($S,sie,kie),oie,wie),cie,Sie),lie,Eie),uie,Tie),die,Cie),fie,xie),pie,Pie),hie,Aie),mie,Rie),xr(xr(xr(xr(xr($S,gie,Die),yie,Oie),vie,Nie),_ie,Iie),bie,Mie);var jie="kit",Lie="kit-duotone",Bie="Kit",Uie="Kit Duotone";xr(xr({},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(to(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[Aa]}})}var YF=dt({},CF);YF[Aa]=dt(dt(dt(dt({},{"fa-duotone":"duotone"}),CF[Aa]),fI.kit),fI["kit-duotone"]);var Jie=Fg(YF),zT=dt({},Xae);zT[Aa]=dt(dt(dt(dt({},{duotone:"fad"}),zT[Aa]),pI.kit),pI["kit-duotone"]);var mI=Fg(zT),$T=dt({},UT);$T[Aa]=dt(dt({},$T[Aa]),aie.kit);var TP=Fg($T),VT=dt({},Fie);VT[Aa]=dt(dt({},VT[Aa]),rie.kit);Fg(VT);var Qie=Aae,XF="fa-layers-text",Zie=Rae,ese=dt({},Wae);Fg(ese);var tse=["class","data-prefix","data-icon","data-fa-transform","data-fa-mask"],VS=Dae,rse=[].concat(to(Jae),to(Gie)),dm=Zl.FontAwesomeConfig||{};function nse(t){var e=_n.querySelector("script["+t+"]");if(e)return e.getAttribute(t)}function ase(t){return t===""?!0:t==="false"?!1:t==="true"?!0:t}if(_n&&typeof _n.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:Aa,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=dt(dt({},JF),dm);cp.autoReplaceSvg||(cp.observeMutations=!1);var $t={};Object.keys(JF).forEach(function(t){Object.defineProperty($t,t,{enumerable:!0,set:function(r){cp[t]=r,fm.forEach(function(n){return n($t)})},get:function(){return cp[t]}})});Object.defineProperty($t,"familyPrefix",{enumerable:!0,set:function(e){cp.cssPrefix=e,fm.forEach(function(r){return r($t)})},get:function(){return cp.cssPrefix}});Zl.FontAwesomeConfig=$t;var fm=[];function sse(t){return fm.push(t),function(){fm.splice(fm.indexOf(t),1)}}var lf=FT,Bo={size:16,x:0,y:0,rotate:0,flipX:!1,flipY:!1};function ose(t){if(!(!t||!Kc)){var e=_n.createElement("style");e.setAttribute("type","text/css"),e.innerHTML=t;for(var r=_n.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 _n.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!==Bo.size||t.x!==Bo.x||t.y!==Bo.y||t.rotate!==Bo.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=$t.cssPrefix,n=$t.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(){$t.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 Ws=$c[zc],e5=[],t5=function(){_n.removeEventListener("DOMContentLoaded",t5),eb=1,e5.map(function(e){return e()})},eb=!1;Kc&&(eb=(_n.documentElement.doScroll?/^loaded|^c/:/^loaded|^i|^c/).test(_n.readyState),eb||_n.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 to(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 Ws.hooks.addPack=="function"&&!a?Ws.hooks.addPack(t,_I(e)):Ws.styles[t]=dt(dt({},Ws.styles[t]||{}),i),t==="fas"&&HT("fa",e)}var zm=Ws.styles,mse=Ws.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||$t.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($t.styleDefault,{family:$t.familyDefault})};sse(function(t){PP=i0(t.styleDefault,{family:$t.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=Aa,r=n5.reduce(function(n,a){return n[a]="".concat($t.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?Aa:r,a=Jie[n][t];if(n===Ug&&!t)return"fad";var i=mI[n][t]||mI[n][a],o=t in Ws.styles?t:null,c=i||o||null;return c}function wse(t){var e=[],r=null;return t.forEach(function(n){var a=vse($t.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=dt(dt({},wse(o)),{},{prefix:i0(f,{family:h})});return dt(dt(dt({},m),Cse({values:t,family:h,styles:zm,config:$t,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&&!$t.autoFetchSvg&&(n="fas"),{prefix:n,iconName:a}}var Ese=qF.filter(function(t){return t!==Aa||t!==Ug}),Tse=Object.keys(UT).filter(function(t){return t!==Aa}).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]=dt(dt({},r.definitions[c]||{}),o[c]),HT(c,o[c]);var u=TP[Aa][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(Ws.styles,r,e)}var f5=new xse,Rse=function(){$t.autoReplaceSvg=!1,$t.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;$t.autoReplaceSvg===!1&&($t.autoReplaceSvg=!0),$t.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($t.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}}}},qi={noAuto:Rse,config:$t,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?_n:r;(Object.keys(Ws.styles).length>0||$t.autoFetchSvg)&&Kc&&$t.autoReplaceSvg&&qi.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=_n.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(dt(dt({},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($t.cssPrefix,"-").concat(r):i;return[{tag:"svg",attributes:{style:"display: none;"},children:[{tag:"symbol",attributes:dt(dt({},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=[$t.replacementClass,i?"".concat($t.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:dt(dt({},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=dt(dt({},E),{},{prefix:a,iconName:i,main:r,mask:n,maskId:u,transform:o,symbol:c,styles:dt({},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=dt(dt({},i.attributes),{},{class:i.classes.join(" ")});c&&(u[ud]="");var d=dt({},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=dt(dt({},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=Ws.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($t.cssPrefix,"-").concat(VS.GROUP)},children:[{tag:"path",attributes:{class:"".concat($t.cssPrefix,"-").concat(VS.SECONDARY),fill:"currentColor",d:i[0]}},{tag:"path",attributes:{class:"".concat($t.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&&$t.showMissingIcons}function YT(t,e){var r=e;return e==="fa"&&$t.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(dt(dt({},Bse),{},{icon:$t.showMissingIcons&&t?tu("missingIconAbstract")||{}:{}}))})}var EI=function(){},XT=$t.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($t.replacementClass)}function $se(){if($t.autoReplaceSvg===!0)return n_.replace;var t=n_[$t.autoReplaceSvg];return t||n_.replace}function Vse(t){return _n.createElementNS("http://www.w3.org/2000/svg",t)}function Hse(t){return _n.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 _n.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&&$t.keepOriginalSource){var n=_n.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($t.replacementClass))return n_.replace(e);var a=new RegExp("".concat($t.cssPrefix,"-.*"));if(delete n[0].attributes.id,n[0].attributes.class){var i=n[0].attributes.class.split(" ").reduce(function(c,u){return u===$t.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;$t.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&&$t.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?_n: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])&&($t.searchPseudoElements&&o(h.target),r(h.target)),h.type==="attributes"&&h.target.parentNode&&$t.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&&$t.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:Bo,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 dt({iconName:n,prefix:a,transform:Bo,mask:{iconName:null,prefix:null,rest:[]},maskId:null,symbol:!1,extra:{classes:i,styles:u,attributes:o}},c)}var Qse=Ws.styles;function y5(t){var e=$t.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(to(zF),to($F))}function AI(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(!Kc)return Promise.resolve();var r=_n.documentElement.classList,n=function(h){return r.add("".concat(hI,"-").concat(h))},a=function(h){return r.remove("".concat(hI,"-").concat(h))},i=$t.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,dt(dt({},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?Bo: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(dt({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:dt(dt({},Bo),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?_n: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($t.cssPrefix,"-layers")].concat(to(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($t.cssPrefix,"-layers-counter")].concat(to(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?Bo: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:dt(dt({},Bo),i),extra:{attributes:d,styles:h,classes:["".concat($t.cssPrefix,"-layers-text")].concat(to(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=dt(dt(dt(dt({},{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]||to(Object.entries(r))[0][1],t},{});function coe(t){var e=t.replace(v5,"");return r5(to(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(dt(dt({},A),{},{icons:{main:O,mask:d5()},prefix:_,iconName:D,extra:C,watchable:!0})),x=_n.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($t.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{$t.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?_n:n;$t.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:dt({},_.outer),children:[{tag:"g",attributes:dt({},_.inner),children:[{tag:n.icon.tag,children:n.icon.children,attributes:dt(dt({},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:dt(dt({},KS),{},{fill:"white"})},b=f.children?{children:f.children.map(jI)}:{},E={tag:"g",attributes:dt({},_.inner),children:[jI(dt({tag:f.tag,attributes:dt(dt({},f.attributes),_.path)},b))]},T={tag:"g",attributes:dt({},_.outer),children:[E]},D="mask-".concat(c||gI()),P="clip-".concat(c||gI()),A={tag:"mask",attributes:dt(dt({},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:dt({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:dt(dt({},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=dt(dt({},i),{},{attributeName:"opacity"}),c={tag:"circle",attributes:dt(dt({},a),{},{cx:"256",cy:"364",r:"28"}),children:[]};return r||c.children.push({tag:"animate",attributes:dt(dt({},i),{},{attributeName:"r",values:"28;14;28;28;14;28;"})},{tag:"animate",attributes:dt(dt({},o),{},{values:"1;0;1;1;0;1;"})}),n.push(c),n.push({tag:"path",attributes:dt(dt({},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:dt(dt({},o),{},{values:"1;0;0;0;0;1;"})}]}),r||n.push({tag:"path",attributes:dt(dt({},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:dt(dt({},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:qi});qi.noAuto;qi.config;qi.library;qi.dom;var ZT=qi.parse;qi.findIconDefinition;qi.toHtml;var Soe=qi.icon;qi.layer;qi.text;qi.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 Io(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=Io(Io({},a.attrs.style),o),t.apply(void 0,[e.tag,Io(Io({},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=Io(Io({},$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,Io(Io(Io(Io({},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 Wr.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}=Vr(),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=li();await fetch(`${R}/api/auth/clear`,{method:"POST",credentials:"include"}).catch(()=>{})}catch{}try{const R=await Y9();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=li();await fetch(`${N}/api/auth/clear`,{method:"POST",credentials:"include"}).catch(()=>{})}catch{}await K9(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=li();await fetch(`${U}/api/auth/clear`,{method:"POST",credentials:"include"}).catch(()=>{})}catch{}const N=R==="apple"?await P_.signInWithAppleNative():await P_.signInWithGoogleNative(),L=li(),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 z=await j.json();if(z?.ok&&z?.token){try{await Zf(z.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(Li,{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}=Vr(),a=vi(),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 Ka{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 On(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 On(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=>On(/^-?[0-9]+$/.test(a),"int64 invalid: ".concat(a)),n=a=>On(/^[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 Sn=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?Sn.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=Sn.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=Sn.uEnc(e);return n.setInt32(0,a.lo,!0),n.setInt32(4,a.hi,!0),this.raw(r)}int64(e){let r=Sn.enc(e);return eE(r.lo,r.hi,this.buf),this}sint64(e){let r=Sn.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=Sn.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 Sn.dec(...this.varint64())}uint64(){return Sn.uDec(...this.varint64())}sint64(){let[e,r]=this.varint64(),n=-(e&1);return e=(e>>>1|(r&1)<<31)^n,r=r>>>1^n,Sn.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 Sn.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Sn.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 Pc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),c0=[];for(let t=0;t<Pc.length;t++)c0[Pc[t].charCodeAt(0)]=t;c0[45]=Pc.indexOf("+");c0[95]=Pc.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+=Pc[n>>2],a=(n&3)<<4,r=1;break;case 1:e+=Pc[a|n>>4],a=(n&15)<<2,r=2;break;case 2:e+=Pc[a|n>>6],e+=Pc[n&63],r=0;break}return r&&(e+=Pc[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){On(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 Ac(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 Ac(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(No(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:No}}function No(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(On(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(No(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(No(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(No(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(No(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(No(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(No(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];Ac(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(No(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=Sn.parse(e);return r?o.toString():o;case Xe.FIXED64:case Xe.UINT64:if(typeof e!="number"&&typeof e!="string")break;const c=Sn.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(No(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"){On(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){On(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(On(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 On(typeof e=="number"),e;case Xe.FLOAT:case Xe.DOUBLE:return On(typeof e=="number"),Number.isNaN(e)?"NaN":e===Number.POSITIVE_INFINITY?"Infinity":e===Number.NEGATIVE_INFINITY?"-Infinity":e;case Xe.STRING:return On(typeof e=="string"),e;case Xe.BOOL:return On(typeof e=="boolean"),e;case Xe.UINT64:case Xe.FIXED64:case Xe.INT64:case Xe.SFIXED64:case Xe.SINT64:return On(typeof e=="bigint"||typeof e=="string"||typeof e=="number"),e.toString();case Xe.BYTES:return On(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)):Ac(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){On(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(On(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){On(Array.isArray(e));for(const o of e)oM(r,n,t,o)}else oM(r,n,t,e);break;case"map":On(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:On(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":On(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){On(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"&&!Ac(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=>Ac(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]=Ac(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&&!Ac(o)&&(o=n.T.fieldWrapper.wrapField(o)),c!==void 0&&!Ac(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(Ac(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){On(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 Te=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 si extends NP{constructor(e){super(),this.seconds=Sn.zero,this.nanos=0,Te.util.initPartial(e,this)}fromJson(e,r){if(typeof e!="string")throw new Error("cannot decode google.protobuf.Timestamp from JSON: ".concat(Te.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=Sn.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 si.fromDate(new Date)}static fromDate(e){const r=e.getTime();return new si({seconds:Sn.parse(Math.floor(r/1e3)),nanos:r%1e3*1e6})}static fromBinary(e,r){return new si().fromBinary(e,r)}static fromJson(e,r){return new si().fromJson(e,r)}static fromJsonString(e,r){return new si().fromJsonString(e,r)}static equals(e,r){return Te.util.equals(si,e,r)}}si.runtime=Te;si.typeName="google.protobuf.Timestamp";si.fields=Te.util.newFieldList(()=>[{no:1,name:"seconds",kind:"scalar",T:3},{no:2,name:"nanos",kind:"scalar",T:5}]);const Hce=Te.makeMessageType("livekit.MetricsBatch",()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:si},{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=Te.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=Te.makeMessageType("livekit.MetricSample",()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:si},{no:3,name:"value",kind:"scalar",T:2}]),Kce=Te.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:si},{no:7,name:"normalized_end_timestamp",kind:"message",T:si,opt:!0},{no:8,name:"metadata",kind:"scalar",T:9},{no:9,name:"rid",kind:"scalar",T:13}]),q5=Te.makeEnum("livekit.BackupCodecPolicy",[{no:0,name:"PREFER_REGRESSION"},{no:1,name:"SIMULCAST"},{no:2,name:"REGRESSION"}]),$s=Te.makeEnum("livekit.TrackType",[{no:0,name:"AUDIO"},{no:1,name:"VIDEO"},{no:2,name:"DATA"}]),Xn=Te.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=Te.makeEnum("livekit.VideoQuality",[{no:0,name:"LOW"},{no:1,name:"MEDIUM"},{no:2,name:"HIGH"},{no:3,name:"OFF"}]),Jh=Te.makeEnum("livekit.ConnectionQuality",[{no:0,name:"POOR"},{no:1,name:"GOOD"},{no:2,name:"EXCELLENT"},{no:3,name:"LOST"}]),$m=Te.makeEnum("livekit.ClientConfigSetting",[{no:0,name:"UNSET"},{no:1,name:"DISABLED"},{no:2,name:"ENABLED"}]),Ks=Te.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=Te.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=Te.makeEnum("livekit.SubscriptionError",[{no:0,name:"SE_UNKNOWN"},{no:1,name:"SE_CODEC_UNSUPPORTED"},{no:2,name:"SE_TRACK_NOTFOUND"}]),pa=Te.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=Te.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:e4}]),ib=Te.makeMessageType("livekit.Codec",()=>[{no:1,name:"mime",kind:"scalar",T:9},{no:2,name:"fmtp_line",kind:"scalar",T:9}]),Xce=Te.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:Te.getEnumType(Xn),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=Te.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:Te.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:Te.getEnumType(Vm)},{no:15,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:16,name:"disconnect_reason",kind:"enum",T:Te.getEnumType(Ks)},{no:18,name:"kind_details",kind:"enum",T:Te.getEnumType(Jce),repeated:!0}]),Ff=Te.makeEnum("livekit.ParticipantInfo.State",[{no:0,name:"JOINING"},{no:1,name:"JOINED"},{no:2,name:"ACTIVE"},{no:3,name:"DISCONNECTED"}]),Vm=Te.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=Te.makeEnum("livekit.ParticipantInfo.KindDetail",[{no:0,name:"CLOUD_AGENT"},{no:1,name:"FORWARDED"}]),sa=Te.makeEnum("livekit.Encryption.Type",[{no:0,name:"NONE"},{no:1,name:"GCM"},{no:2,name:"CUSTOM"}]),Qce=Te.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:Te.getEnumType(z5)},{no:6,name:"sdp_cid",kind:"scalar",T:9}]),Tf=Te.makeMessageType("livekit.TrackInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"type",kind:"enum",T:Te.getEnumType($s)},{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:Te.getEnumType(Xn)},{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:Te.getEnumType(sa)},{no:17,name:"stream",kind:"scalar",T:9},{no:18,name:"version",kind:"message",T:e4},{no:19,name:"audio_features",kind:"enum",T:Te.getEnumType(pa),repeated:!0},{no:20,name:"backup_codec_policy",kind:"enum",T:Te.getEnumType(q5)}]),Vl=Te.makeMessageType("livekit.VideoLayer",()=>[{no:1,name:"quality",kind:"enum",T:Te.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=Te.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"}]),Va=Te.makeMessageType("livekit.DataPacket",()=>[{no:1,name:"kind",kind:"enum",T:Te.getEnumType(gr)},{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}]),gr=Te.makeEnum("livekit.DataPacket.Kind",[{no:0,name:"RELIABLE"},{no:1,name:"LOSSY"}]),$5=Te.makeMessageType("livekit.EncryptedPacket",()=>[{no:1,name:"encryption_type",kind:"enum",T:Te.getEnumType(sa)},{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=Te.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=Te.makeMessageType("livekit.ActiveSpeakerUpdate",()=>[{no:1,name:"speakers",kind:"message",T:H5,repeated:!0}]),H5=Te.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=Te.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=Te.makeMessageType("livekit.SipDTMF",()=>[{no:3,name:"code",kind:"scalar",T:13},{no:4,name:"digit",kind:"scalar",T:9}]),ele=Te.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=Te.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=Te.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=Te.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=Te.makeMessageType("livekit.RpcAck",()=>[{no:1,name:"request_id",kind:"scalar",T:9}]),UP=Te.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=Te.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=Te.makeMessageType("livekit.ParticipantTracks",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sids",kind:"scalar",T:9,repeated:!0}]),Y5=Te.makeMessageType("livekit.ServerInfo",()=>[{no:1,name:"edition",kind:"enum",T:Te.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=Te.makeEnum("livekit.ServerInfo.Edition",[{no:0,name:"Standard"},{no:1,name:"Cloud"}]),J5=Te.makeMessageType("livekit.ClientInfo",()=>[{no:1,name:"sdk",kind:"enum",T:Te.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=Te.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=Te.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:Te.getEnumType($m)},{no:4,name:"disabled_codecs",kind:"message",T:rle},{no:5,name:"force_relay",kind:"enum",T:Te.getEnumType($m)}]),cM=Te.makeMessageType("livekit.VideoConfiguration",()=>[{no:1,name:"hardware_encoder",kind:"enum",T:Te.getEnumType($m)}]),rle=Te.makeMessageType("livekit.DisabledCodecs",()=>[{no:1,name:"codecs",kind:"message",T:ib,repeated:!0},{no:2,name:"publish",kind:"message",T:ib,repeated:!0}]),e4=Te.makeMessageType("livekit.TimedVersion",()=>[{no:1,name:"unix_micro",kind:"scalar",T:3},{no:2,name:"ticks",kind:"scalar",T:5}]),aC=Te.makeEnum("livekit.DataStream.OperationType",[{no:0,name:"CREATE"},{no:1,name:"UPDATE"},{no:2,name:"DELETE"},{no:3,name:"REACTION"}]),t4=Te.makeMessageType("livekit.DataStream.TextHeader",()=>[{no:1,name:"operation_type",kind:"enum",T:Te.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"}),r4=Te.makeMessageType("livekit.DataStream.ByteHeader",()=>[{no:1,name:"name",kind:"scalar",T:9}],{localName:"DataStream_ByteHeader"}),ob=Te.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:Te.getEnumType(sa)},{no:8,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:9,name:"text_header",kind:"message",T:t4,oneof:"content_header"},{no:10,name:"byte_header",kind:"message",T:r4,oneof:"content_header"}],{localName:"DataStream_Header"}),cb=Te.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=Te.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=Te.makeMessageType("livekit.SubscribedAudioCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"enabled",kind:"scalar",T:8}]),Vs=Te.makeEnum("livekit.SignalTarget",[{no:0,name:"PUBLISHER"},{no:1,name:"SUBSCRIBER"}]),iC=Te.makeEnum("livekit.StreamState",[{no:0,name:"ACTIVE"},{no:1,name:"PAUSED"}]),ale=Te.makeEnum("livekit.CandidateProtocol",[{no:0,name:"UDP"},{no:1,name:"TCP"},{no:2,name:"TLS"}]),ile=Te.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:n4,oneof:"message"},{no:8,name:"leave",kind:"message",T:p0,oneof:"message"},{no:10,name:"update_layers",kind:"message",T:i4,oneof:"message"},{no:11,name:"subscription_permission",kind:"message",T:c4,oneof:"message"},{no:12,name:"sync_state",kind:"message",T:VP,oneof:"message"},{no:13,name:"simulate",kind:"message",T:Ro,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:d4,oneof:"message"},{no:17,name:"update_audio_track",kind:"message",T:qP,oneof:"message"},{no:18,name:"update_video_track",kind:"message",T:a4,oneof:"message"}]),lM=Te.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=Te.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:Te.getEnumType(z5)}]),Hm=Te.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:Te.getEnumType($s)},{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:Te.getEnumType(Xn)},{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:Te.getEnumType(sa)},{no:15,name:"stream",kind:"scalar",T:9},{no:16,name:"backup_codec_policy",kind:"enum",T:Te.getEnumType(q5)},{no:17,name:"audio_features",kind:"enum",T:Te.getEnumType(pa),repeated:!0}]),u0=Te.makeMessageType("livekit.TrickleRequest",()=>[{no:1,name:"candidateInit",kind:"scalar",T:9},{no:2,name:"target",kind:"enum",T:Te.getEnumType(Vs)},{no:3,name:"final",kind:"scalar",T:8}]),d0=Te.makeMessageType("livekit.MuteTrackRequest",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"muted",kind:"scalar",T:8}]),sle=Te.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:s4,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=Te.makeMessageType("livekit.ReconnectResponse",()=>[{no:1,name:"ice_servers",kind:"message",T:s4,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=Te.makeMessageType("livekit.TrackPublishedResponse",()=>[{no:1,name:"cid",kind:"scalar",T:9},{no:2,name:"track",kind:"message",T:Tf}]),cle=Te.makeMessageType("livekit.TrackUnpublishedResponse",()=>[{no:1,name:"track_sid",kind:"scalar",T:9}]),nu=Te.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=Te.makeMessageType("livekit.ParticipantUpdate",()=>[{no:1,name:"participants",kind:"message",T:fd,repeated:!0}]),f0=Te.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}]),n4=Te.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:Te.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=Te.makeMessageType("livekit.UpdateLocalAudioTrack",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"features",kind:"enum",T:Te.getEnumType(pa),repeated:!0}]),a4=Te.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=Te.makeMessageType("livekit.LeaveRequest",()=>[{no:1,name:"can_reconnect",kind:"scalar",T:8},{no:2,name:"reason",kind:"enum",T:Te.getEnumType(Ks)},{no:3,name:"action",kind:"enum",T:Te.getEnumType(qf)},{no:4,name:"regions",kind:"message",T:wle}]),qf=Te.makeEnum("livekit.LeaveRequest.Action",[{no:0,name:"DISCONNECT"},{no:1,name:"RESUME"},{no:2,name:"RECONNECT"}]),i4=Te.makeMessageType("livekit.UpdateVideoLayers",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"layers",kind:"message",T:Vl,repeated:!0}]),zP=Te.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}]),s4=Te.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=Te.makeMessageType("livekit.SpeakersChanged",()=>[{no:1,name:"speakers",kind:"message",T:H5,repeated:!0}]),dle=Te.makeMessageType("livekit.RoomUpdate",()=>[{no:1,name:"room",kind:"message",T:l0}]),fle=Te.makeMessageType("livekit.ConnectionQualityInfo",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"quality",kind:"enum",T:Te.getEnumType(Jh)},{no:3,name:"score",kind:"scalar",T:2}]),ple=Te.makeMessageType("livekit.ConnectionQualityUpdate",()=>[{no:1,name:"updates",kind:"message",T:fle,repeated:!0}]),hle=Te.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:Te.getEnumType(iC)}]),mle=Te.makeMessageType("livekit.StreamStateUpdate",()=>[{no:1,name:"stream_states",kind:"message",T:hle,repeated:!0}]),$P=Te.makeMessageType("livekit.SubscribedQuality",()=>[{no:1,name:"quality",kind:"enum",T:Te.getEnumType(MP)},{no:2,name:"enabled",kind:"scalar",T:8}]),gle=Te.makeMessageType("livekit.SubscribedCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"qualities",kind:"message",T:$P,repeated:!0}]),yle=Te.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=Te.makeMessageType("livekit.SubscribedAudioCodecUpdate",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"subscribed_audio_codecs",kind:"message",T:nle,repeated:!0}]),o4=Te.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}]),c4=Te.makeMessageType("livekit.SubscriptionPermission",()=>[{no:1,name:"all_participants",kind:"scalar",T:8},{no:2,name:"track_permissions",kind:"message",T:o4,repeated:!0}]),_le=Te.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=Te.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=Te.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:u4,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:l4,repeated:!0}]),l4=Te.makeMessageType("livekit.DataChannelReceiveState",()=>[{no:1,name:"publisher_sid",kind:"scalar",T:9},{no:2,name:"last_seq",kind:"scalar",T:13}]),u4=Te.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:Te.getEnumType(Vs)}]),Ro=Te.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:Te.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"}]),d4=Te.makeMessageType("livekit.Ping",()=>[{no:1,name:"timestamp",kind:"scalar",T:3},{no:2,name:"rtt",kind:"scalar",T:3}]),kle=Te.makeMessageType("livekit.Pong",()=>[{no:1,name:"last_ping_timestamp",kind:"scalar",T:3},{no:2,name:"timestamp",kind:"scalar",T:3}]),wle=Te.makeMessageType("livekit.RegionSettings",()=>[{no:1,name:"regions",kind:"message",T:Sle,repeated:!0}]),Sle=Te.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=Te.makeMessageType("livekit.SubscriptionResponse",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"err",kind:"enum",T:Te.getEnumType(Yce)}]),Tle=Te.makeMessageType("livekit.RequestResponse",()=>[{no:1,name:"request_id",kind:"scalar",T:13},{no:2,name:"reason",kind:"enum",T:Te.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:a4,oneof:"request"}]),HP=Te.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=Te.makeMessageType("livekit.TrackSubscribed",()=>[{no:1,name:"track_sid",kind:"scalar",T:9}]),f4=Te.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=Te.makeMessageType("livekit.JoinRequest",()=>[{no:1,name:"client_info",kind:"message",T:J5},{no:2,name:"connection_settings",kind:"message",T:f4},{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:Te.getEnumType(zu)},{no:9,name:"participant_sid",kind:"scalar",T:9},{no:10,name:"sync_state",kind:"message",T:VP}]),Ple=Te.makeMessageType("livekit.WrappedJoinRequest",()=>[{no:1,name:"compression",kind:"enum",T:Te.getEnumType(Ale)},{no:2,name:"join_request",kind:"scalar",T:12}]),Ale=Te.makeEnum("livekit.WrappedJoinRequest.Compression",[{no:0,name:"NONE"},{no:1,name:"GZIP"}]),Rle=Te.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,z=encodeURIComponent(C),U=j.indexOf(z+"=");U!==-1&&(L=/^([^;]+)/.exec(j.slice(U+z.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 ro;(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"})(ro||(ro={}));let or=h0.getLogger("livekit");Object.values(ro).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 re(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 Rc(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 z=j.length,U=w(j,z),I=0;I<z;++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 ec=Ble();let p4=!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."):(p4=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 h4(){}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 m4(t){return pM(t)?Object.keys(t).reduce(function(e,r){const n=pM(t[r]),a=n?m4(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=h4;function g4(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 y4(t){t.MediaStream=t.MediaStream||t.webkitMediaStream}function v4(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 _4(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 b4(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 k4(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 w4(t,e){if(!t.RTCPeerConnection)return;if(t.RTCPeerConnection.prototype.addTrack&&e.version>=65)return k4(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 S4(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:S4,shimAddTrackRemoveTrack:w4,shimAddTrackRemoveTrackWithNative:k4,shimGetSendersWithDtmf:_4,shimGetUserMedia:g4,shimMediaStream:y4,shimOnTrack:v4,shimPeerConnection:lC,shimSenderReceiverGetStats:b4});function E4(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 T4(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 C4(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 x4(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 P4(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 A4(t){t.DataChannel&&!t.RTCDataChannel&&(t.RTCDataChannel=t.DataChannel)}function R4(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 D4(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 O4(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 N4(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:R4,shimCreateAnswer:N4,shimCreateOffer:O4,shimGetDisplayMedia:$le,shimGetParameters:D4,shimGetUserMedia:E4,shimOnTrack:T4,shimPeerConnection:uC,shimRTCDataChannel:A4,shimReceiverGetStats:x4,shimRemoveStream:P4,shimSenderGetStats:C4});function I4(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 M4(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 j4(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 L4(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(B4(a))}!e.getUserMedia&&e.mediaDevices&&e.mediaDevices.getUserMedia&&(e.getUserMedia=(function(n,a,i){e.mediaDevices.getUserMedia(n).then(a,i)}).bind(e))}function B4(t){return t&&t.video!==void 0?Object.assign({},t,{video:m4(t.video)}):t}function U4(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 F4(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 q4(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 z4(t){typeof t!="object"||t.AudioContext||(t.AudioContext=t.webkitAudioContext)}var vM=Object.freeze({__proto__:null,shimAudioContext:z4,shimCallbacksAPI:j4,shimConstraints:B4,shimCreateOfferLegacy:q4,shimGetUserMedia:L4,shimLocalStreamsAPI:I4,shimRTCIceServerUrls:U4,shimRemoteStreamsAPI:M4,shimTrackEventTransceiver:F4}),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 $4=Vle(),zf=Dle($4),Hle=Zoe({__proto__:null,default:zf},[$4]);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=h4,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),g4(t,n),y4(t),lC(t,n),v4(t),w4(t,n),_4(t),b4(t),S4(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),E4(t,n),uC(t,n),T4(t),P4(t),C4(t),x4(t),A4(t),R4(t),D4(t),O4(t),N4(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),U4(t),q4(t),j4(t),I4(t),M4(t),F4(t),L4(t),z4(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 ui 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 pi(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 tc extends Error{constructor(e,r){super(r||"an error has occured"),this.name="LiveKitError",this.code=e}}var un;(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"})(un||(un={}));class Kt extends tc{constructor(e,r,n,a){super(1,e),this.name="ConnectionError",this.status=n,this.reason=r,this.context=a,this.reasonName=un[r]}static notAllowed(e,r,n){return new Kt(e,un.NotAllowed,r,n)}static timeout(e){return new Kt(e,un.Timeout)}static leaveRequest(e,r){return new Kt(e,un.LeaveRequest,void 0,r)}static internal(e,r){return new Kt(e,un.InternalError,void 0,r)}static cancelled(e){return new Kt(e,un.Cancelled)}static serverUnreachable(e,r){return new Kt(e,un.ServerUnreachable,r)}static websocket(e,r,n){return new Kt(e,un.WebSocket,r,n)}static serviceNotFound(e,r){return new Kt(e,un.ServiceNotFound,void 0,r)}}class GP extends tc{constructor(e){super(21,e??"device is unsupported"),this.name="DeviceUnsupportedError"}}class Dc extends tc{constructor(e){super(20,e??"track is invalid"),this.name="TrackInvalidError"}}class Zle extends tc{constructor(e){super(10,e??"unsupported server"),this.name="UnsupportedServer"}}class Ln extends tc{constructor(e){super(12,e??"unexpected connection state"),this.name="UnexpectedConnectionState"}}class $f extends tc{constructor(e){super(13,e??"unable to negotiate"),this.name="NegotiationError"}}class bM extends tc{constructor(e,r){super(15,e),this.name="PublishTrackError",this.status=r}}class kM extends tc{constructor(e,r){super(15,e),this.name="SignalRequestError",this.reason=r,this.reasonName=typeof r=="string"?r:HP[r]}}var $a;(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"})($a||($a={}));class is extends tc{constructor(e,r){super(16,e),this.name="DataStreamError",this.reason=r,this.reasonName=$a[r]}}class df extends tc{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 xa{}xa.setTimeout=function(){return setTimeout(...arguments)};xa.setInterval=function(){return setInterval(...arguments)};xa.clearTimeout=function(){return clearTimeout(...arguments)};xa.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 vt;(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"})(vt||(vt={}));var mt;(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"})(mt||(mt={}));var ft;(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"})(ft||(ft={}));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 V4(t,e,r){var n,a,i,o;const{optionsWithoutProcessor:c,audioProcessor:u,videoProcessor:d}=W4(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 H4(t){return re(this,arguments,void 0,function(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:200;return(function*(){const n=G4();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 Pa(r),a.getByteTimeDomainData(o);const u=o.some(d=>d!==128&&d!==0);return n.close(),!u}return!1})()})}function G4(){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=()=>re(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"?Ye.Source.Microphone:t==="videoinput"?Ye.Source.Camera:Ye.Source.Unknown}function yC(t){return t===Ye.Source.Microphone?"audioinput":t===Ye.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 _r(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?_r(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 W4(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 Xn.CAMERA:return Ye.Source.Camera;case Xn.MICROPHONE:return Ye.Source.Microphone;case Xn.SCREEN_SHARE:return Ye.Source.ScreenShare;case Xn.SCREEN_SHARE_AUDIO:return Ye.Source.ScreenShareAudio;default:return Ye.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 Mi;(function(t){t[t.LOW=0]="LOW",t[t.MEDIUM=1]="MEDIUM",t[t.HIGH=2]="HIGH"})(Mi||(Mi={}));class Ye extends ec.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=Ye.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:ro.Track),this.loggerContextCb=n.loggerContextCb,this.setMaxListeners(100),this.kind=r,this._mediaStreamTrack=e,this._mediaStreamID=e.id,this.source=Ye.Source.Unknown}get logContext(){var e;return Object.assign(Object.assign({},(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this)),_r(this))}get currentBitrate(){return this._currentBitrate}get mediaStreamTrack(){return this._mediaStreamTrack}get mediaStreamID(){return this._mediaStreamID}attach(e){let r="audio";this.kind===Ye.Kind.Video&&(r="video"),this.attachedElements.length===0&&this.kind===Ye.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?ft.AudioPlaybackStarted:ft.VideoPlaybackStarted)}).catch(i=>{i.name==="NotAllowedError"?this.emit(a?ft.AudioPlaybackFailed:ft.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(ft.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(ft.ElementDetached,e)),e}const r=[];return this.attachedElements.forEach(n=>{Vf(this.mediaStreamTrack,n),r.push(n),this.recycleElement(n),this.emit(ft.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 re(this,void 0,void 0,function*(){this.isInBackground=document.visibilityState==="hidden",!this.isInBackground&&this.kind===Ye.Kind.Video&&setTimeout(()=>this.attachedElements.forEach(e=>e.play().catch(()=>{})),0)})}addAppVisibilityListener(){di()?(this.isInBackground=document.visibilityState==="hidden",document.addEventListener("visibilitychange",this.appVisibilityChangedListener)):this.isInBackground=!1}removeAppVisibilityListener(){di()&&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 $s.AUDIO;case e.Video:return $s.VIDEO;default:return $s.DATA}}t.kindToProto=a;function i(d){switch(d){case $s.AUDIO:return e.Audio;case $s.VIDEO:return e.Video;default:return e.Unknown}}t.kindFromProto=i;function o(d){switch(d){case r.Camera:return Xn.CAMERA;case r.Microphone:return Xn.MICROPHONE;case r.ScreenShare:return Xn.SCREEN_SHARE;case r.ScreenShareAudio:return Xn.SCREEN_SHARE_AUDIO;default:return Xn.UNKNOWN}}t.sourceToProto=o;function c(d){switch(d){case Xn.CAMERA:return r.Camera;case Xn.MICROPHONE:return r.Microphone;case Xn.SCREEN_SHARE:return r.ScreenShare;case Xn.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})(Ye||(Ye={}));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 Pa(t){return new ui(e=>xa.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=pi();if(r?.version&&Jo(r.version,"16")<0||r?.os==="iOS"&&r?.osVersion&&Jo(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 Hs(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=pi())===null||t===void 0?void 0:t.name)==="Firefox"}function TM(){const t=pi();return!!t&&t.name==="Chrome"&&t.os!=="iOS"}function hd(){var t;return((t=pi())===null||t===void 0?void 0:t.name)==="Safari"}function Gm(){const t=pi();return t?.name==="Safari"||t?.os==="iOS"}function vue(){const t=pi();return t?.name==="Safari"&&t.version.startsWith("17.")||t?.os==="iOS"&&!!t?.osVersion&&Jo(t.osVersion,"17")>=0}function _ue(t){return t||(t=pi()),t?.name==="Safari"&&Jo(t.version,"18.3")>0||t?.os==="iOS"&&!!t?.osVersion&&Jo(t.osVersion,"18.3")>0}function K4(){var t,e;return di()?(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=pi(),e="17.2";if(t)return t.name!=="Safari"&&t.os!=="iOS"||t.os==="iOS"&&t.osVersion&&Jo(t.osVersion,e)>=0?!0:t.name==="Safari"&&Jo(t.version,e)>=0}function di(){return typeof document<"u"}function Xo(){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 Y4(){if(global&&global.LiveKitReactNativeGlobal)return global.LiveKitReactNativeGlobal}function X4(){if(!Xo())return;let t=Y4();if(t)return t.platform}function CM(){if(di())return window.devicePixelRatio;if(Xo()){let t=Y4();if(t)return t.devicePixelRatio}return 1}function Jo(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 Xo()&&(e.os=(t=X4())!==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 fs{get isResolved(){return this._isResolved}constructor(e,r){this._isResolved=!1,this.onFinally=r,this.promise=new Promise((n,a)=>re(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 un.LeaveRequest:return t.context;case un.Cancelled:return Ks.CLIENT_INITIATED;case un.NotAllowed:return Ks.USER_REJECTED;case un.ServerUnreachable:return Ks.JOIN_FAILURE;default:return Ks.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 zo(t){return!!t&&t.kind==Ye.Kind.Audio}function hu(t){return!!t&&t.kind==Ye.Kind.Video}function Tl(t){return Hf(t)&&hu(t)}function Tc(t){return Hf(t)&&zo(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 J4(t){return t.endsWith("/")?t:"".concat(t,"/")}function YP(t,e){return t.pathname="".concat(J4(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 qSe extends ec.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 ec.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(mt.RTPVideoMapUpdate,r=>{this.postRTPMap(r)})}setupEventListeners(e,r){e.on(tt.TrackPublished,(n,a)=>this.setParticipantCryptorEnabled(n.trackInfo.encryption!==sa.NONE,a.identity)),e.on(tt.ConnectionStateChanged,n=>{n===jr.Connected&&e.remoteParticipants.forEach(a=>{a.trackPublications.forEach(i=>{this.setParticipantCryptorEnabled(i.trackInfo.encryption!==sa.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(vt.LocalSenderCreated,(n,a)=>re(this,void 0,void 0,function*(){this.setupE2EESender(a,n)})),e.localParticipant.on(vt.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 re(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 fs;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 fs;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 re(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,Pa(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 ha{constructor(){this._previousDevices=[]}static getInstance(){return this.instance===void 0&&(this.instance=new ha),this.instance}get previousDevices(){return this._previousDevices}getDevices(e){return re(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=ha.userMediaPromiseMap)===null||i===void 0?void 0:i.size)>0){or.debug("awaiting getUserMedia promise");try{r?yield ha.userMediaPromiseMap.get(r):yield Promise.all(ha.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 re(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?ha.userMediaPromiseMap.has(e):ha.userMediaPromiseMap.size>0}}ha.mediaDeviceKinds=["audioinput","audiooutput","videoinput"];ha.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 Ka,this.nextTaskIndex=0}run(e){return re(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 re(this,void 0,void 0,function*(){return this.run(()=>re(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 ui((c,u)=>{const d=()=>{u(Kt.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 ui((c,u)=>{const d=()=>re(this,void 0,void 0,function*(){const f=new ui(m=>{i.readyState!==WebSocket.CLOSED&&i.addEventListener("close",_=>{m(_)},{once:!0})}),h=yield ui.race([Pa(250),f]);h?c(h):u(Kt.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 ln;(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"})(ln||(ln={}));const Yue=250;class XP{get currentState(){return this.state}get isDisconnected(){return this.state===ln.DISCONNECTING||this.state===ln.DISCONNECTED}get isEstablishingConnection(){return this.state===ln.CONNECTING||this.state===ln.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=ln.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:ro.Signal),this.loggerContextCb=r.loggerContextCb,this.useJSON=e,this.requestQueue=new Hue,this.queuedRequests=[],this.closingLock=new Ka,this.connectionLock=new Ka,this.state=ln.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 re(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=ln.CONNECTING,d.options=c,yield d.connect(i,o,c,u,f)})()})}reconnect(e,r,n,a){return re(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=ln.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 re(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)=>re(d,void 0,void 0,function*(){var D,P;try{let A=!1;const C=N=>re(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(z=>{this.log.error(z),this.close()}):this.close(),O(),T(Kt.cancelled(j))});u?.addEventListener("abort",C);const O=()=>{clearTimeout(I),u?.removeEventListener("abort",C)},I=setTimeout(()=>{C(Kt.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(q=>{var Y;this.isEstablishingConnection&&T(Kt.internal("Websocket got closed during a (re)connection attempt: ".concat(q.reason))),q.closeCode!==1e3&&(this.log.warn("websocket closed",Object.assign(Object.assign({},this.logContext),{reason:q.reason,code:q.closeCode,wasClean:q.closeCode===1e3,state:this.state})),this.state===ln.CONNECTED&&this.handleOnClose((Y=q.reason)!==null&&Y!==void 0?Y:"Unexpected WS error"))}).catch(q=>{this.isEstablishingConnection&&T(Kt.internal("Websocket error during a (re)connection attempt: ".concat(q)))});const N=yield this.ws.opened.catch(q=>re(this,void 0,void 0,function*(){if(this.state!==ln.CONNECTED){this.state=ln.DISCONNECTED,clearTimeout(I);const Y=yield this.handleConnectionError(q,b);T(Y);return}this.handleWSError(q),T(q)}));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 Kt.internal("no message received as first message");const z=DM(j.value),U=this.validateFirstMessage(z,(D=c.reconnect)!==null&&D!==void 0?D:!1);if(!U.isValid){T(U.error);return}((P=z.message)===null||P===void 0?void 0:P.case)==="join"&&(this.pingTimeoutDuration=z.message.value.pingTimeout,this.pingIntervalDuration=z.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?z:void 0;x(N,W),E(U.response)}catch(N){T(N)}finally{O()}}finally{h()}}))})()})}startReadingLoop(e,r){return re(this,void 0,void 0,function*(){for(r&&this.handleSignalResponse(r);;){this.signalLatency&&(yield Pa(this.signalLatency));const{done:n,value:a}=yield e.read();if(n)break;const i=DM(a);this.handleSignalResponse(i)}})}close(){return re(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([ln.DISCONNECTING||ln.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=ln.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,Pa(Yue)])}}catch(i){e.log.debug("websocket error while closing",Object.assign(Object.assign({},e.logContext),{error:i}))}finally{r&&(e.state=ln.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 re(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 i4({trackSid:e,layers:r})})}sendUpdateSubscriptionPermissions(e,r){return this.sendRequest({case:"subscriptionPermission",value:new c4({allParticipants:e,trackPermissions:r})})}sendSimulateScenario(e){return this.sendRequest({case:"simulate",value:e})}sendPing(){return Promise.all([this.sendRequest({case:"ping",value:Sn.parse(Date.now())}),this.sendRequest({case:"pingReq",value:new d4({timestamp:Sn.parse(Date.now()),rtt:Sn.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:Ks.CLIENT_INITIATED,action:qf.DISCONNECT})})}sendRequest(e){return re(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===ln.RECONNECTING){n.queuedRequests.push(()=>re(n,void 0,void 0,function*(){yield this.sendRequest(r,!0)}));return}if(a||(yield n.requestQueue.flush()),n.signalLatency&&(yield Pa(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 re(this,void 0,void 0,function*(){if(this.state===ln.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=xa.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&&xa.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=xa.setInterval(()=>{this.sendPing()},this.pingIntervalDuration*1e3)}clearPingInterval(){this.log.debug("clearing ping interval",this.logContext),this.clearPingTimeout(),this.pingInterval&&xa.clearInterval(this.pingInterval)}handleSignalConnected(e,r,n){this.state=ln.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===ln.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:Kt.leaveRequest("Received leave request while trying to (re)connect",e.message.value.reason)}:r?{isValid:!1,error:Kt.internal("Unexpected first message")}:{isValid:!1,error:Kt.internal("did not receive join response, got ".concat((c=e.message)===null||c===void 0?void 0:c.case," instead"))}}handleConnectionError(e,r){return re(this,void 0,void 0,function*(){try{const n=yield fetch(r);switch(n.status){case 404:return Kt.serviceNotFound("v1 RTC path not found. Consider upgrading your LiveKit server version","v0-rtc");case 401:case 403:const a=yield n.text();return Kt.notAllowed(a,n.status);default:break}return e instanceof Kt?e:Kt.internal("Encountered unknown websocket error during connection: ".concat(e),{status:n.status,statusText:n.statusText})}catch(n){return n instanceof Kt?n:Kt.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",Xo()?"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 f4({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 Ls={},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 Ls;FM=1;var t=Zue(),e=ede(),r=JP();return Ls.grammar=r,Ls.write=e,Ls.parse=t.parse,Ls.parseParams=t.parseParams,Ls.parseFmtpConfig=t.parseFmtpConfig,Ls.parsePayloads=t.parsePayloads,Ls.parseRemoteCandidates=t.parseRemoteCandidates,Ls.parseImageAttributes=t.parseImageAttributes,Ls.parseSimulcastStreamList=t.parseSimulcastStreamList,Ls}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 ec.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=>re(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:ro.PCTransport),this.loggerOptions=r,this.config=e,this._pc=this.createPC(),this.offerLock=new Ka}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 re(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 re(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 re(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||(Hs(u.codec)&&!hd()&&this.ensureVideoDDExtensionForSVC(c,o),!Hs(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 re(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 re(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 re(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},Q4={deviceId:{ideal:"default"},autoGainControl:!0,echoCancellation:!0,noiseSuppression:!0,voiceIsolation:!0},Z4={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 Rn;(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"})(Rn||(Rn={}));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=Rn.CONNECTED:u.some(d=>d==="failed")?this.state=Rn.FAILED:u.some(d=>d==="connecting")?this.state=Rn.CONNECTING:u.every(d=>d==="closed")?this.state=Rn.CLOSED:u.some(d=>d==="closed")?this.state=Rn.CLOSING:u.every(d=>d==="new")&&(this.state=Rn.NEW),c!==this.state&&(this.log.debug("pc state change: from ".concat(Rn[c]," to ").concat(Rn[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:ro.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,Vs.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,Vs.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=Rn.NEW,this.connectionLock=new Ka,this.remoteOfferLock=new Ka}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 re(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 re(this,void 0,void 0,function*(){this.subscriber&&(this.subscriber.restartingIce=!0),this.needsPublisher&&(yield this.createAndSendPublisherOffer({iceRestart:!0}))})}addIceCandidate(e,r){return re(this,void 0,void 0,function*(){var n;r===Vs.PUBLISHER?yield this.publisher.addIceCandidate(e):yield(n=this.subscriber)===null||n===void 0?void 0:n.addIceCandidate(e)})}createSubscriberAnswerFromOffer(e,r){return re(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 re(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 re(this,void 0,void 0,function*(){return new ui((r,n)=>re(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===Vs.PUBLISHER?this.publisher.getConnectedAddress():e===Vs.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 re(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)=>re(i,void 0,void 0,function*(){const f=()=>{this.log.warn("abort transport connection",this.logContext),xa.clearTimeout(h),d(Kt.cancelled("room connection has been cancelled"))};a?.signal.aborted&&f(),a?.signal.addEventListener("abort",f);const h=xa.setTimeout(()=>{a?.signal.removeEventListener("abort",f),d(Kt.internal("could not establish pc connection"))},o);for(;this.state!==Rn.CONNECTED;)if(yield Pa(50),a?.signal.aborted){d(Kt.cancelled("room connection has been cancelled"));return}xa.clearTimeout(h),a?.signal.removeEventListener("abort",f),u()}))})()})}}const eq=5e3,cde=3e4;class Dr{static fetchRegionSettings(e,r,n){return re(this,void 0,void 0,function*(){const a=yield Dr.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:eq;return{regionSettings:yield i.json(),updatedAtInMs:Date.now(),maxAgeInMs:c}}else throw i.status===401?Kt.notAllowed("Could not fetch region settings: ".concat(i.statusText),i.status):Kt.internal("Could not fetch region settings: ".concat(i.statusText))}catch(i){throw i instanceof Kt?i:n?.aborted?Kt.cancelled("Region fetching was aborted"):Kt.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 re(this,void 0,void 0,function*(){const a=Dr.settingsTimeouts.get(e.hostname);clearTimeout(a),Dr.settingsTimeouts.set(e.hostname,setTimeout(()=>re(this,void 0,void 0,function*(){try{const i=yield Dr.fetchRegionSettings(e,r);Dr.updateCachedRegionSettings(e,r,i)}catch(i){if(i instanceof Kt&&i.reason===un.NotAllowed){or.debug("token is not valid, cancelling auto region refresh");return}or.debug("auto refetching of region settings failed",{error:i}),Dr.scheduleRefetch(e,r,n)}}),n))})}static updateCachedRegionSettings(e,r,n){Dr.cache.set(e.hostname,n),Dr.scheduleRefetch(e,r,n.maxAgeInMs)}static stopRefetch(e){const r=Dr.settingsTimeouts.get(e);r&&(clearTimeout(r),Dr.settingsTimeouts.delete(e))}static scheduleCleanup(e){let r=Dr.connectionTrackers.get(e);r&&(r.cleanupTimeout&&clearTimeout(r.cleanupTimeout),r.cleanupTimeout=setTimeout(()=>{const n=Dr.connectionTrackers.get(e);n&&n.connectionCount===0&&(or.debug("stopping region refetch after disconnect delay",{hostname:e}),Dr.stopRefetch(e)),n&&(n.cleanupTimeout=void 0)},cde))}static cancelCleanup(e){const r=Dr.connectionTrackers.get(e);r?.cleanupTimeout&&(clearTimeout(r.cleanupTimeout),r.cleanupTimeout=void 0)}notifyConnected(){const e=this.serverUrl.hostname;let r=Dr.connectionTrackers.get(e);r||(r={connectionCount:0},Dr.connectionTrackers.set(e,r)),r.connectionCount++,Dr.cancelCleanup(e)}notifyDisconnected(){const e=this.serverUrl.hostname,r=Dr.connectionTrackers.get(e);r&&(r.connectionCount=Math.max(0,r.connectionCount-1),r.connectionCount===0&&Dr.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 re(this,void 0,void 0,function*(){return Dr.fetchRegionSettings(this.serverUrl,this.token,e)})}getNextBestRegionUrl(e){return re(this,void 0,void 0,function*(){if(!this.isCloud())throw Error("region availability is only supported for LiveKit Cloud domains");let r=Dr.cache.get(this.serverUrl.hostname);(!r||Date.now()-r.updatedAtInMs>r.maxAgeInMs)&&(r=yield this.fetchRegionSettings(e),Dr.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){Dr.updateCachedRegionSettings(this.serverUrl,this.token,e)}}Dr.cache=new Map;Dr.settingsTimeouts=new Map;Dr.connectionTrackers=new Map;Dr.fetchLock=new Ka;function lde(t){return"".concat(t.protocol.replace("ws","http"),"//").concat(t.host,"/settings")}let Ha=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)}};Ha.MAX_MESSAGE_BYTES=256;Ha.MAX_DATA_BYTES=15360;Ha.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};Ha.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 tq=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=>re(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 rq extends Ye{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(()=>re(this,void 0,void 0,function*(){yield this.pauseUpstream()}),5e3),this.handleTrackUnmuteEvent=()=>re(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(ft.Ended,this)},this.reacquireTrack=!1,this.providedByUser=a,this.muteLock=new Ka,this.pauseUpstreamLock=new Ka,this.trackChangeLock=new Ka,this.trackChangeLock.lock().then(o=>re(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!==Ye.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 re(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 re(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===Ye.Kind.Audio)throw new Error("cannot get dimensions for audio tracks");((n=pi())===null||n===void 0?void 0:n.os)==="iOS"&&(yield Pa(10));const a=Date.now();for(;Date.now()-a<r;){const i=e.dimensions;if(i)return i;yield Pa(50)}throw new Dc("unable to get track dimensions after timeout")})()})}setDeviceId(e){return re(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 re(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===Ye.Source.ScreenShare)return;const{deviceId:n,groupId:a}=e._mediaStreamTrack.getSettings(),i=e.kind===Ye.Kind.Audio?"audioinput":"videoinput";return r?ha.getInstance().normalizeDeviceId(i,n,a):n})()})}mute(){return re(this,void 0,void 0,function*(){return this.setTrackMuted(!0),this})}unmute(){return re(this,void 0,void 0,function*(){return this.setTrackMuted(!1),this})}replaceTrack(e,r){return re(this,void 0,void 0,function*(){const n=yield this.trackChangeLock.lock();try{if(!this.sender)throw new Dc("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 re(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===Ye.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===Ye.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(ft.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?ft.Muted:ft.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 re(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),K4()&&(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 re(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(ft.UpstreamPaused,this);const n=pi();if(n?.name==="Safari"&&Jo(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 re(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(ft.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 re(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 re(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(ft.TrackProcessorUpdate,n.processor)}finally{o()}})()})}getProcessor(){return this.processor}stopProcessor(){return re(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 re(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(ft.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 rq{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,Ye.Kind.Audio,r,n,i),this.stopOnMute=!1,this.isKrispNoiseFilterEnabled=!1,this.monitorSender=()=>re(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(ft.AudioTrackFeatureUpdate,this,pa.TF_ENHANCED_NOISE_CANCELLATION,!0)},this.handleKrispNoiseFilterDisable=()=>{this.isKrispNoiseFilterEnabled=!1,this.log.debug("Krisp noise filter disabled",this.logContext),this.emit(ft.AudioTrackFeatureUpdate,this,pa.TF_ENHANCED_NOISE_CANCELLATION,!1)},this.audioContext=a,this.checkForSilence()}mute(){const e=Object.create(null,{mute:{get:()=>super.mute}});return re(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===Ye.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 re(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===Ye.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 re(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 re(this,void 0,void 0,function*(){const n=yield r.restart.call(this,e);return this.checkForSilence(),n})}startMonitor(){di()&&(this.monitorInterval||(this.monitorInterval=setInterval(()=>{this.monitorSender()},rA)))}setProcessor(e){return re(this,void 0,void 0,function*(){var r;const n=yield this.trackChangeLock.lock();try{if(!Xo()&&!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(ft.TrackProcessorUpdate,this.processor)}finally{n()}})}setAudioContext(e){this.audioContext=e}getSenderStats(){return re(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 re(this,void 0,void 0,function*(){const e=yield H4(this);return e&&(this.isMuted||this.log.debug("silence detected on local audio track",this.logContext),this.emit(ft.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 Dc("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&&Hs(d)){const w=new nq(u),b=[];if(w.spatial>3)throw new Error("unsupported scalabilityMode: ".concat(u));const E=pi();if(Gm()||Xo()||E?.name==="Chrome"&&Jo(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===Ye.Source.ScreenShare&&r.simulcast&&(r.simulcast=!1),TC(t.source===Ye.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)}),Xo()&&X4()==="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 nq{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===Ye.Source.ScreenShare||t.constraints.height&&Hl(t.constraints.height)>=1080?"maintain-resolution":"balanced"}const xde=5e3;class fb extends rq{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,Ye.Kind.Video,r,n,a),this.simulcastCodecs=new Map,this.degradationPreference="balanced",this.isCpuConstrained=!1,this.optimizeForPerformance=!1,this.monitorSender=()=>re(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(ft.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 Ka}get isSimulcast(){return!!(this.sender&&this.sender.getParameters().encodings.length>1)}startMonitor(e){var r;if(this.signalClient=e,!di())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 re(this,void 0,void 0,function*(){var r,n,a,i,o;yield e.pauseUpstream.call(this);try{for(var c=!0,u=Rc(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 re(this,void 0,void 0,function*(){var r,n,a,i,o;yield e.resumeUpstream.call(this);try{for(var c=!0,u=Rc(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 re(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===Ye.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 re(this,void 0,void 0,function*(){const r=yield this.muteLock.lock();try{return this.isMuted?(this.source===Ye.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 re(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=Mi.LOW;n<=Mi.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(Hs(this.codec),r)}restartTrack(e){return re(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=Rc(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 re(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,_=Rc(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 re(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 re(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(Hs(e[0].codec),e[0].qualities),[];this.subscribedCodecs=e;const d=[];try{for(r=!0,n=Rc(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(Hs(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,Hs(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 re(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 re(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&&Hs(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 re(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),K4()&&this.isInBackground&&this.source===Ye.Source.Camera&&(this._mediaStreamTrack.enabled=!1)})}}function WM(t,e,r,n,a,i,o){return re(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=aq(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 aq(t){switch(t){case"f":return Mi.HIGH;case"h":return Mi.MEDIUM;case"q":return Mi.LOW;default:return Mi.HIGH}}function KM(t,e,r,n){if(!r)return[new Vl({quality:Mi.HIGH,width:t,height:e,bitrate:0,ssrc:0})];if(n){const a=r[0].scalabilityMode,i=new nq(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(Mi.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=aq((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 ns;(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"})(ns||(ns={}));class Ode extends ec.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=ns.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=>re(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=>re(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=Va.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(mt.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 Va({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(mt.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(mt.DataPacketReceived,h,sa.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?gr.LOSSY:gr.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(mt.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=xa.setTimeout(()=>this.attemptReconnect(a).finally(()=>this.reconnectTimeout=void 0),c)},this.waitForRestarted=()=>new Promise((n,a)=>{this.pcState===ns.Connected&&n();const i=()=>{this.off(mt.Disconnected,o),n()},o=()=>{this.off(mt.Restarted,i),a()};this.once(mt.Restarted,i),this.once(mt.Disconnected,o)}),this.updateAndEmitDCBufferStatus=n=>{if(n===gr.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(mt.DCBufferStatusChanged,a,n))},this.isBufferStatusLow=n=>{const a=this.dataChannelForKind(n);if(a)return a.bufferedAmount<=a.bufferedAmountLowThreshold},this.handleBrowserOnLine=()=>re(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===ln.RECONNECTING||this.isWaitingForNetworkReconnect&&this.client.currentState===ln.CONNECTED)&&(this.clearReconnectTimeout(),this.attemptReconnect(zu.RR_SIGNAL_DISCONNECTED),this.isWaitingForNetworkReconnect=!1))}),this.handleBrowserOffline=()=>re(this,void 0,void 0,function*(){if(this.url)try{yield Promise.race([fetch(Wm(this.url),{method:"HEAD"}),Pa(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:ro.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 Ka,this.dataProcessLock=new Ka,this.dcBufferStatus=new Map([[gr.LOSSY,!0],[gr.RELIABLE,!0]]),this.client.onParticipantUpdate=n=>this.emit(mt.ParticipantUpdate,n),this.client.onConnectionQuality=n=>this.emit(mt.ConnectionQualityUpdate,n),this.client.onRoomUpdate=n=>this.emit(mt.RoomUpdate,n),this.client.onSubscriptionError=n=>this.emit(mt.SubscriptionError,n),this.client.onSubscriptionPermissionUpdate=n=>this.emit(mt.SubscriptionPermissionUpdate,n),this.client.onSpeakersChanged=n=>this.emit(mt.SpeakersChanged,n),this.client.onStreamStateUpdate=n=>this.emit(mt.StreamStateChanged,n),this.client.onRequestResponse=n=>this.emit(mt.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 re(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(mt.SignalConnected,h),h}catch(h){if(h instanceof Kt){if(h.reason===un.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===un.ServiceNotFound)return d.log.warn("Initial connection failed: ".concat(h.message," – Retrying")),d.join(i,o,c,u,!0)}throw h}})()})}close(){return re(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(mt.Closing),this.removeAllListeners(),this.deregisterOnLineListener(),this.clearPendingReconnect(),this.cleanupLossyDataStats(),yield this.cleanupPeerConnections(),yield this.cleanupClient()}finally{e()}})}cleanupPeerConnections(){return re(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 re(this,void 0,void 0,function*(){yield this.client.close(),this.client.resetCallbacks()})}addTrack(e){if(this.pendingTrackResolvers[e.cid])throw new Dc("a track with the same ID has already been published");return new Promise((r,n)=>{const a=setTimeout(()=>{delete this.pendingTrackResolvers[e.cid],n(Kt.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 re(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 re(this,void 0,void 0,function*(){var n,a;if(this.pcManager&&this.pcManager.currentState!==Rn.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(mt.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)=>re(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===Rn.CONNECTED){const h=this.pcState===ns.New;this.pcState=ns.Connected,h&&this.emit(mt.Connected,e)}else o===Rn.FAILED&&(this.pcState===ns.Connected||this.pcState===ns.Reconnecting)&&(this.pcState=ns.Disconnected,this.handleDisconnect("peerconnection failed",u==="failed"?zu.RR_SUBSCRIBER_FAILED:zu.RR_PUBLISHER_FAILED));const d=this.client.isDisconnected||this.client.currentState===ln.RECONNECTING,f=[Rn.FAILED,Rn.CLOSING,Rn.CLOSED].includes(o);d&&f&&!this._isClosed&&this.emit(mt.Offline)}),this.pcManager.onTrack=o=>{o.streams.length!==0&&this.emit(mt.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)=>re(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)=>re(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(mt.LocalTrackUnpublished,e)},this.client.onLocalTrackSubscribed=e=>{this.emit(mt.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(mt.RemoteMute,e,r)},this.client.onSubscribedQualityUpdate=e=>{this.emit(mt.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(mt.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:eq,regionSettings:e.regions})),e.action){case qf.DISCONNECT:this.emit(mt.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(gr.LOSSY);if(e){const r=this.lossyDataStatByterate/10;e.bufferedAmountLowThreshold=Math.min(Math.max(r,Rde),Dde)}},1e3))}createSender(e,r,n){return re(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 re(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 re(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 re(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 re(this,void 0,void 0,function*(){if(!this.pcManager)throw new Ln("publisher is closed");return this.pcManager.addPublisherTrack(e)})}attemptReconnect(e){return re(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:Rn.NEW)===Rn.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(mt.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 re(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(mt.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 Kt&&o.reason===un.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(mt.SignalRestarted,i),yield this.waitForPCReconnected(),this.client.currentState!==ln.CONNECTED)throw new df("Signal connection got severed during reconnect");(r=this.regionUrlProvider)===null||r===void 0||r.resetAttempts(),this.emit(mt.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 re(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(mt.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 Kt&&a.reason===un.NotAllowed?new Ln("could not reconnect, token might be expired"):a instanceof Kt&&a.reason===un.LeaveRequest?a:new df(i)}if(this.emit(mt.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!==ln.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(mt.Resumed)})}waitForPCInitialConnection(e,r){return re(this,void 0,void 0,function*(){if(!this.pcManager)throw new Ln("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(r,e)})}waitForPCReconnected(){return re(this,void 0,void 0,function*(){this.pcState=ns.Reconnecting,this.log.debug("waiting for peer connection to reconnect",this.logContext);try{if(yield Pa(Pde),!this.pcManager)throw new Ln("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(void 0,this.peerConnectionTimeout),this.pcState=ns.Connected}catch(e){throw this.pcState=ns.Disconnected,Kt.internal("could not establish PC connection, ".concat(e.message))}})}publishRpcResponse(e,r,n,a){return re(this,void 0,void 0,function*(){const i=new Va({destinationIdentities:[e],kind:gr.RELIABLE,value:{case:"rpcResponse",value:new UP({requestId:r,value:a?{case:"error",value:a.toProto()}:{case:"payload",value:n??""}})}});yield this.sendDataPacket(i,gr.RELIABLE)})}publishRpcAck(e,r){return re(this,void 0,void 0,function*(){const n=new Va({destinationIdentities:[e],kind:gr.RELIABLE,value:{case:"rpcAck",value:new BP({requestId:r})}});yield this.sendDataPacket(n,gr.RELIABLE)})}sendDataPacket(e,r){return re(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===gr.RELIABLE&&(e.sequence=this.reliableDataSequence,this.reliableDataSequence+=1);const n=e.toBinary(),a=this.dataChannelForKind(r);if(a){if(r===gr.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 re(this,void 0,void 0,function*(){yield this.ensurePublisherConnected(gr.RELIABLE);const r=this.dataChannelForKind(gr.RELIABLE);r&&(this.reliableMessageBuffer.popToSequence(e),this.reliableMessageBuffer.getAll().forEach(n=>{r.send(n.data)})),this.updateAndEmitDCBufferStatus(gr.RELIABLE)})}waitForBufferStatusLow(e){return new ui((r,n)=>re(this,void 0,void 0,function*(){if(this.isBufferStatusLow(e))r();else{const a=()=>n(new Ln("engine closed"));for(this.once(mt.Closing,a);!this.dcBufferStatus.get(e);)yield Pa(10);this.off(mt.Closing,a),r()}}))}ensureDataTransportConnected(e){return re(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 Kt.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 Pa(50)}throw Kt.internal("could not establish ".concat(c," connection, state: ").concat(o.getICEConnectionState()))})()})}ensurePublisherConnected(e){return re(this,void 0,void 0,function*(){this.publisherConnectionPromise||(this.publisherConnectionPromise=this.ensureDataTransportConnected(e,!1)),yield this.publisherConnectionPromise})}verifyTransport(){return!(!this.pcManager||this.pcManager.currentState!==Rn.CONNECTED||!this.client.ws||this.client.ws.readyState===WebSocket.CLOSED)}negotiate(){return re(this,void 0,void 0,function*(){return new ui((e,r)=>re(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(mt.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(mt.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(mt.Closing,a)}}))})}dataChannelForKind(e,r){if(r){if(e===gr.LOSSY)return this.lossyDCSub;if(e===gr.RELIABLE)return this.reliableDCSub}else{if(e===gr.LOSSY)return this.lossyDC;if(e===gr.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 l4({publisherSid:b,lastSeq:w}))}))}failNext(){this.shouldFailNext=!0}dataChannelsInfo(){const e=[],r=(n,a)=>{n?.id!==void 0&&n.id!==null&&e.push(new u4({label:n.label,id:n.id,target:a}))};return r(this.dataChannelForKind(gr.LOSSY),Vs.PUBLISHER),r(this.dataChannelForKind(gr.RELIABLE),Vs.PUBLISHER),r(this.dataChannelForKind(gr.LOSSY,!0),Vs.SUBSCRIBER),r(this.dataChannelForKind(gr.RELIABLE,!0),Vs.SUBSCRIBER),e}clearReconnectTimeout(){this.reconnectTimeout&&xa.clearTimeout(this.reconnectTimeout)}clearPendingReconnect(){this.clearReconnectTimeout(),this.reconnectAttempts=0}registerOnLineListener(){di()&&(window.addEventListener("online",this.handleBrowserOnLine),window.addEventListener("offline",this.handleBrowserOffline))}deregisterOnLineListener(){di()&&(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 iq{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 is("Not enough chunk(s) received - expected ".concat(this.totalByteSize," bytes of data total, only received ").concat(this.bytesReceived," bytes"),$a.Incomplete);if(this.bytesReceived>this.totalByteSize)throw new is("Extra chunk(s) received - expected ".concat(this.totalByteSize," bytes of data total, received ").concat(this.bytesReceived," bytes"),$a.LengthExceeded)}}constructor(e,r,n,a){this.reader=r,this.totalByteSize=n,this._info=e,this.bytesReceived=0,this.outOfBandFailureRejectingFuture=a}}class Ide extends iq{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 fs,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:()=>re(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 re(this,void 0,void 0,function*(){return i(),{done:!0,value:void 0}})}}}withAbortSignal(e){return this.signal=e,this}readAll(){return re(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=Rc(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 iq{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 fs,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:()=>re(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 is("Cannot decode datastream chunk ".concat(f.chunkIndex," as text: ").concat(m),$a.DecodeFailed)}return{done:!1,value:h}}}catch(d){throw o(),d}}),return(){return re(this,void 0,void 0,function*(){return o(),{done:!0,value:void 0}})}}}withAbortSignal(e){return this.signal=e,this}readAll(){return re(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=Rc(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 is('A text stream handler for topic "'.concat(e,'" has already been set.'),$a.HandlerAlreadyRegistered);this.textStreamHandlers.set(e,r)}unregisterTextStreamHandler(e){this.textStreamHandlers.delete(e)}registerByteStreamHandler(e,r){if(this.byteStreamHandlers.has(e))throw new is('A byte stream handler for topic "'.concat(e,'" has already been set.'),$a.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 is("Participant ".concat(e," unexpectedly disconnected in the middle of sending data"),$a.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 re(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 re(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 fs;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 is("A data stream read is already in progress for a stream with id ".concat(e.streamId,"."),$a.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 fs;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 is("A data stream read is already in progress for a stream with id ".concat(e.streamId,"."),$a.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 is("Encryption type mismatch for stream ".concat(e.streamId,". Expected ").concat(r,", got ").concat(n.info.encryptionType),$a.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 is("Encryption type mismatch for stream ".concat(e.streamId,". Expected ").concat(r,", got ").concat(a.info.encryptionType),$a.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 is("Encryption type mismatch for stream ".concat(e.streamId,". Expected ").concat(r,", got ").concat(n.info.encryptionType),$a.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 is("Encryption type mismatch for stream ".concat(e.streamId,". Expected ").concat(r,", got ").concat(a.info.encryptionType),$a.EncryptionTypeMismatch)):(a.info.attributes=Object.assign(Object.assign({},a.info.attributes),e.attributes),a.controller.close()),this.byteStreamControllers.delete(e.streamId))}}class sq{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 re(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 sq{}class Bde extends sq{}const QM=15e3;class Ude{constructor(e,r){this.engine=e,this.log=r}setupEngine(e){this.engine=e}sendText(e,r){return re(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)=>re(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 re(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?sa.GCM:sa.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 t4({version:e?.version,attachedStreamIds:e?.attachedStreamIds,replyToStreamId:e?.replyToStreamId,operationType:e?.type==="update"?aC.UPDATE:aC.CREATE})}}),u=e?.destinationIdentities,d=new Va({destinationIdentities:u,value:{case:"streamHeader",value:c}});yield this.engine.sendDataPacket(d,gr.RELIABLE);let f=0;const h=this.engine,m=new WritableStream({write(b){return re(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 Va({destinationIdentities:u,value:{case:"streamChunk",value:T}});yield h.sendDataPacket(D,gr.RELIABLE),f+=1}})},close(){return re(this,void 0,void 0,function*(){const b=new lb({streamId:i}),E=new Va({destinationIdentities:u,value:{case:"streamTrailer",value:b}});yield h.sendDataPacket(E,gr.RELIABLE)})},abort(b){}});let _=()=>re(this,void 0,void 0,function*(){yield w.close()});h.once(mt.Closing,_);const w=new Lde(m,o,()=>this.engine.off(mt.Closing,_));return w})}sendFile(e,r){return re(this,void 0,void 0,function*(){const n=crypto.randomUUID();return yield this._sendFile(n,e,r),{id:n}})}_sendFile(e,r,n){return re(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 re(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?sa.GCM:sa.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 r4({name:f.name})}}),m=new Va({destinationIdentities:d,value:{case:"streamHeader",value:h}});yield this.engine.sendDataPacket(m,gr.RELIABLE);let _=0;const w=new Ka,b=this.engine,E=this.log,T=new WritableStream({write(P){return re(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 Va({destinationIdentities:d,value:{case:"streamChunk",value:new cb({content:O,streamId:u,chunkIndex:$u(_)})}});yield b.sendDataPacket(I,gr.RELIABLE),_+=1,C+=O.byteLength}}finally{A()}})},close(){return re(this,void 0,void 0,function*(){const P=new lb({streamId:u}),A=new Va({destinationIdentities:d,value:{case:"streamTrailer",value:P}});yield b.sendDataPacket(A,gr.RELIABLE)})},abort(P){E.error("Sink error:",P)}});return new Bde(T,f)})}}class oq extends Ye{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?ft.Muted:ft.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(ft.Ended,this))};e.addEventListener("removetrack",r)}start(){this.startMonitor(),super.enable()}stop(){this.stopMonitor(),super.disable()}getRTCStatsReport(){return re(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(ft.TimeSyncUpdate,{timestamp:a,rtpTimestamp:i}),this.rtpTimestamp=i)}};e()}}class Fde extends oq{constructor(e,r,n,a,i,o){super(e,r,Ye.Kind.Audio,n,o),this.monitorReceiver=()=>re(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;Xo()&&this._mediaStreamTrack._setVolume(e),this.elementVolume=e}getVolume(){if(this.elementVolume)return this.elementVolume;if(Xo())return 1;let e=0;return this.attachedElements.forEach(r=>{r.volume>e&&(e=r.volume)}),e}setSinkId(e){return re(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(ft.AudioPlaybackFailed,new Error("Audio Context couldn't be started automatically"))}).catch(a=>{this.emit(ft.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 re(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 oq{constructor(e,r,n,a,i){super(e,r,Ye.Kind.Video,n,i),this.elementInfos=[],this.monitorReceiver=()=>re(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===Ye.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 re(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 re(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){xa.setTimeout(()=>{this.updateVisibility()},yE);return}this.lastVisible=c,this.emit(ft.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(ft.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=di()&&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 Cc extends ec.EventEmitter{constructor(e,r,n,a){var i;super(),this.metadataMuted=!1,this.encryption=sa.NONE,this.log=or,this.handleMuted=()=>{this.emit(ft.Muted)},this.handleUnmuted=()=>{this.emit(ft.Unmuted)},this.log=Vc((i=a?.loggerName)!==null&&i!==void 0?i:ro.Publication),this.loggerContextCb=this.loggerContextCb,this.setMaxListeners(100),this.kind=e,this.trackSid=r,this.trackName=n,this.source=Ye.Source.Unknown}setTrack(e){this.track&&(this.track.off(ft.Muted,this.handleMuted),this.track.off(ft.Unmuted,this.handleUnmuted)),this.track=e,e&&(e.on(ft.Muted,this.handleMuted),e.on(ft.Unmuted,this.handleUnmuted))}get logContext(){var e;return Object.assign(Object.assign({},(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this)),_r(this))}get isMuted(){return this.metadataMuted}get isEnabled(){return!0}get isSubscribed(){return this.track!==void 0}get isEncrypted(){return this.encryption!==sa.NONE}get audioTrack(){if(zo(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=Ye.sourceFromProto(e.source),this.mimeType=e.mimeType,this.kind===Ye.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={}))})(Cc||(Cc={}));class xC extends Cc{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(ft.Ended)},this.handleCpuConstrained=()=>{this.track&&hu(this.track)&&this.emit(ft.CpuConstrained,this.track)},this.updateInfo(r),this.setTrack(n)}setTrack(e){this.track&&(this.track.off(ft.Ended,this.handleTrackEnded),this.track.off(ft.CpuConstrained,this.handleCpuConstrained)),super.setTrack(e),e&&(e.on(ft.Ended,this.handleTrackEnded),e.on(ft.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 re(this,void 0,void 0,function*(){var e;return(e=this.track)===null||e===void 0?void 0:e.mute()})}unmute(){return re(this,void 0,void 0,function*(){var e;return(e=this.track)===null||e===void 0?void 0:e.unmute()})}pauseUpstream(){return re(this,void 0,void 0,function*(){var e;yield(e=this.track)===null||e===void 0?void 0:e.pauseUpstream()})}resumeUpstream(){return re(this,void 0,void 0,function*(){var e;yield(e=this.track)===null||e===void 0?void 0:e.resumeUpstream()})}getTrackFeatures(){var e;if(zo(this.track)){const r=this.track.getSourceTrackSettings(),n=new Set;return r.autoGainControl&&n.add(pa.TF_AUTO_GAIN_CONTROL),r.echoCancellation&&n.add(pa.TF_ECHO_CANCELLATION),r.noiseSuppression&&n.add(pa.TF_NOISE_SUPPRESSION),r.channelCount&&r.channelCount>1&&n.add(pa.TF_STEREO),!((e=this.options)===null||e===void 0)&&e.dtx||n.add(pa.TF_NO_DTX),this.track.enhancedNoiseCancellation&&n.add(pa.TF_ENHANCED_NOISE_CANCELLATION),Array.from(n.values())}else return[]}}function g0(t,e){return re(this,void 0,void 0,function*(){t??(t={});let r=!1;const{audioProcessor:n,videoProcessor:a,optionsWithoutProcessor:i}=W4(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=V4(i,Q4,Z4),d=KP(u),f=navigator.mediaDevices.getUserMedia(d);i.audio&&(ha.userMediaPromiseMap.set("audioinput",f),f.catch(()=>ha.userMediaPromiseMap.delete("audioinput"))),i.video&&(ha.userMediaPromiseMap.set("videoinput",f),f.catch(()=>ha.userMediaPromiseMap.delete("videoinput")));try{const h=yield f;return yield Promise.all(h.getTracks().map(m=>re(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===Ye.Kind.Video?D.source=Ye.Source.Camera:D.kind===Ye.Kind.Audio&&(D.source=Ye.Source.Microphone),D.mediaStream=h,zo(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 re(this,void 0,void 0,function*(){return(yield g0({audio:!1,video:!0}))[0]})}function Vde(t){return re(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 cq extends ec.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:ro.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 fs,this.once(vt.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(Ye.Source.Camera);return!(!((e=r?.isMuted)!==null&&e!==void 0)||e)}get isMicrophoneEnabled(){var e;const r=this.getTrackPublication(Ye.Source.Microphone);return!(!((e=r?.isMuted)!==null&&e!==void 0)||e)}get isScreenShareEnabled(){return!!this.getTrackPublication(Ye.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(vt.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(vt.ParticipantMetadataChanged,n)}_setName(e){const r=this.name!==e;this.name=e,r&&this.emit(vt.ParticipantNameChanged,e)}_setAttributes(e){const r=lue(this.attributes,e);this._attributes=e,Object.keys(r).length>0&&this.emit(vt.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(vt.ParticipantPermissionsChanged,u),d}setIsSpeaking(e){e!==this.isSpeaking&&(this.isSpeaking=e,e&&(this.lastSpokeAt=new Date),this.emit(vt.IsSpeakingChanged,e))}setConnectionQuality(e){const r=this._connectionQuality;this._connectionQuality=Hde(e),r!==this._connectionQuality&&this.emit(vt.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=>zo(r.track)&&r.track.setAudioContext(e))}addTrackPublication(e){e.on(ft.Muted,()=>{this.emit(vt.TrackMuted,e)}),e.on(ft.Unmuted,()=>{this.emit(vt.TrackUnmuted,e)});const r=e;switch(r.track&&(r.track.sid=e.trackSid),this.trackPublications.set(e.trackSid,e),e.kind){case Ye.Kind.Audio:this.audioTrackPublications.set(e.trackSid,e);break;case Ye.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 o4({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 cq{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=sa.NONE,this.enabledPublishVideoCodecs=[],this.pendingAcks=new Map,this.pendingResponses=new Map,this.handleReconnecting=()=>{this.reconnectFuture||(this.reconnectFuture=new fs)},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 fs),(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=Ha.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),_r(c)));return}this.engine.updateMuteStatus(c.sid,u)},this.onTrackUpstreamPaused=c=>{this.log.debug("upstream paused",Object.assign(Object.assign({},this.logContext),_r(c))),this.onTrackMuted(c,!0)},this.onTrackUpstreamResumed=c=>{this.log.debug("upstream resumed",Object.assign(Object.assign({},this.logContext),_r(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),_r(u))),this.emit(vt.LocalTrackCpuConstrained,c,u)},this.handleSubscribedQualityUpdate=c=>re(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=Rc(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),_r(_))),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=>re(this,void 0,void 0,function*(){if(c.source===Ye.Source.ScreenShare||c.source===Ye.Source.ScreenShareAudio)this.log.debug("unpublishing local track due to TrackEnded",Object.assign(Object.assign({},this.logContext),_r(c))),this.unpublishTrack(c);else if(c.isUserProvided)yield c.mute();else if(Tc(c)||Tl(c))try{if(di())try{const u=yield navigator?.permissions.query({name:c.source===Ye.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),_r(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),_r(c))),Tc(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),_r(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!==sa.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(mt.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(mt.Connected,this.handleReconnected).on(mt.SignalConnected,this.handleSignalConnected).on(mt.SignalRestarted,this.handleReconnected).on(mt.SignalResumed,this.handleReconnected).on(mt.Restarting,this.handleReconnecting).on(mt.Resuming,this.handleReconnecting).on(mt.LocalTrackUnpublished,this.handleLocalTrackUnpublished).on(mt.SubscribedQualityUpdate,this.handleSubscribedQualityUpdate).on(mt.Closing,this.handleClosing).on(mt.SignalRequestResponse,this.handleSignalRequestResponse).on(mt.DataPacketReceived,this.handleDataPacket)}setMetadata(e){return re(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({metadata:e})})}setName(e){return re(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({name:e})})}setAttributes(e){return re(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({attributes:e})})}requestMetadataUpdate(e){return re(this,arguments,void 0,function(r){var n=this;let{metadata:a,name:i,attributes:o}=r;return(function*(){return new ui((c,u)=>re(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 Pa(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(Ye.Source.Camera,e,r,n)}setMicrophoneEnabled(e,r,n){return this.setTrackEnabled(Ye.Source.Microphone,e,r,n)}setScreenShareEnabled(e,r,n){return this.setTrackEnabled(Ye.Source.ScreenShare,e,r,n)}setE2EEEnabled(e){return re(this,void 0,void 0,function*(){this.encryptionType=e?sa.GCM:sa.NONE,yield this.republishAllTracks(void 0,!1)})}setTrackEnabled(e,r,n,a){return re(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 Ye.Source.Camera:u=yield this.createTracks({video:(i=n)!==null&&i!==void 0?i:!0});break;case Ye.Source.Microphone:u=yield this.createTracks({audio:(o=n)!==null&&o!==void 0?o:!0});break;case Ye.Source.ScreenShare:u=yield this.createScreenTracks(Object.assign({},n));break;default:throw new Dc(e)}}catch(d){throw u?.forEach(f=>{f.stop()}),d instanceof Error&&this.emit(vt.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===Ye.Source.Microphone&&zo(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),_r(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===Ye.Source.ScreenShare){c=yield this.unpublishTrack(c.track);const u=this.getTrackPublication(Ye.Source.ScreenShareAudio);u&&u.track&&this.unpublishTrack(u.track)}else yield c.mute();return c})}enableCameraAndMicrophone(){return re(this,void 0,void 0,function*(){if(!(this.pendingPublishing.has(Ye.Source.Camera)||this.pendingPublishing.has(Ye.Source.Microphone))){this.pendingPublishing.add(Ye.Source.Camera),this.pendingPublishing.add(Ye.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(Ye.Source.Camera),this.pendingPublishing.delete(Ye.Source.Microphone)}}})}createTracks(e){return re(this,void 0,void 0,function*(){var r,n;e??(e={});const a=V4(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=>(zo(c)&&(this.microphoneError=void 0,c.setAudioContext(this.audioContext),c.source=Ye.Source.Microphone,this.emit(vt.AudioStreamAcquired)),hu(c)&&(this.cameraError=void 0,c.source=Ye.Source.Camera),c))}catch(i){throw i instanceof Error&&(e.audio&&(this.microphoneError=i),e.video&&(this.cameraError=i)),i}})}createScreenTracks(e){return re(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 Dc("no video track found");const i=new fb(a[0],void 0,!1,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});i.source=Ye.Source.ScreenShare,e.contentHint&&(i.mediaStreamTrack.contentHint=e.contentHint);const o=[i];if(n.getAudioTracks().length>0){this.emit(vt.AudioStreamAcquired);const c=new db(n.getAudioTracks()[0],void 0,!1,this.audioContext,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});c.source=Ye.Source.ScreenShareAudio,o.push(c)}return o})}publishTrack(e,r){return re(this,void 0,void 0,function*(){return this.publishOrRepublishTrack(e,r)})}publishOrRepublishTrack(e,r){return re(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;Tc(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 Ye.Source.Microphone:T="audioinput";break;case Ye.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 Dc("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),_r(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),_r(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)=>re(i,void 0,void 0,function*(){try{if(this.engine.client.currentState!==ln.CONNECTED){this.log.debug("deferring track publication until signal is connected",Object.assign(Object.assign({},this.logContext),{track:_r(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 fs),this.signalConnectedFuture.promise}hasPermissionsToPublish(e){if(!this.permissions)return this.log.warn("no permissions present for publishing track",Object.assign(Object.assign({},this.logContext),_r(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),_r(e))),!1)}publish(e,r,n){return re(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!==Ye.Source.Unknown&&this.log.info("publishing a second track with the same source: ".concat(e.source),Object.assign(Object.assign({},this.logContext),_r(e))),r.stopMicTrackOnMute&&zo(e)&&(e.stopOnMute=!0),e.source===Ye.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(ft.Muted,this.onTrackMuted),e.on(ft.Unmuted,this.onTrackUnmuted),e.on(ft.Ended,this.handleTrackEnded),e.on(ft.UpstreamPaused,this.onTrackUpstreamPaused),e.on(ft.UpstreamResumed,this.onTrackUpstreamResumed),e.on(ft.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate);const E=[],T=!(!((a=r.dtx)!==null&&a!==void 0)||a),D=e.getSourceTrackSettings();D.autoGainControl&&E.push(pa.TF_AUTO_GAIN_CONTROL),D.echoCancellation&&E.push(pa.TF_ECHO_CANCELLATION),D.noiseSuppression&&E.push(pa.TF_NOISE_SUPPRESSION),D.channelCount&&D.channelCount>1&&E.push(pa.TF_STEREO),T&&E.push(pa.TF_NO_DTX),Tc(e)&&e.hasPreConnectBuffer&&E.push(pa.TF_PRECONNECT_BUFFER);const P=new Hm({cid:e.mediaStreamTrack.id,name:r.name,type:Ye.kindToProto(e.kind),muted:e.isMuted,source:Ye.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===Ye.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),_r(e)),{dims:R}))}P.width=R.width,P.height=R.height,Tl(e)&&(Hs(b)&&(e.source===Ye.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),_r(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===sa.NONE&&(this.roomOptions.dynacast||(this.roomOptions.dynacast=!0),P.simulcastCodecs.push(new sC({codec:r.backupCodec.codec,cid:""})))),A=TC(e.source===Ye.Source.ScreenShare,P.width,P.height,r),P.layers=KM(P.width,P.height,A,Hs(r.videoCodec))}else e.kind===Ye.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=()=>re(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(vt.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===Ye.Kind.Audio){let j;for(const z of this.engine.pcManager.publisher.getTransceivers())if(z.sender===e.sender){j=z;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&&Hs(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)=>re(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(z=>{this.log.error("failed to negotiate after removing track due to failed add track request",Object.assign(Object.assign(Object.assign({},this.logContext),_r(e)),{error:z}))})),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===Ye.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),_r(e)),{codec:N})),r.videoCodec=N,A=TC(e.source===Ye.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(ft.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):Tc(e)&&e.startMonitor(),this.addTrackPublication(x),this.emit(vt.LocalTrackPublished,x),Tc(e)&&O.audioFeatures.includes(pa.TF_PRECONNECT_BUFFER)){const R=e.getPreConnectBuffer(),N=e.getPreConnectBufferMimeType();this.on(vt.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),_r(e))),e.stopPreConnectBuffer()}}),R&&new Promise((j,z)=>re(this,void 0,void 0,function*(){var U,W,q,Y,Z,ae;try{this.log.debug("waiting for agent",Object.assign(Object.assign({},this.logContext),_r(e)));const ne=setTimeout(()=>{z(new Error("agent not active within 10 seconds"))},1e4),ee=yield this.waitUntilActiveAgentPresent();clearTimeout(ne),this.log.debug("sending preconnect buffer",Object.assign(Object.assign({},this.logContext),_r(e)));const he=yield this.streamBytes({name:"preconnect-buffer",mimeType:N,topic:"lk.agent.pre-connect-audio-buffer",destinationIdentities:[ee.identity],attributes:{trackId:x.trackSid,sampleRate:String((Z=D.sampleRate)!==null&&Z!==void 0?Z:"48000"),channels:String((ae=D.channelCount)!==null&&ae!==void 0?ae:"1")}});try{for(var G=!0,F=Rc(R),K;K=yield F.next(),U=K.done,!U;G=!0){Y=K.value,G=!1;const ce=Y;yield he.write(ce)}}catch(ce){W={error:ce}}finally{try{!G&&!U&&(q=F.return)&&(yield q.call(F))}finally{if(W)throw W.error}}yield he.close(),j()}catch(ne){z(ne)}})).then(()=>{this.log.debug("preconnect buffer sent successfully",Object.assign(Object.assign({},this.logContext),_r(e)))}).catch(j=>{this.log.error("error sending preconnect buffer",Object.assign(Object.assign(Object.assign({},this.logContext),_r(e)),{error:j}))})}return x})}get isLocal(){return!0}publishAdditionalCodecForTrack(e,r,n){return re(this,void 0,void 0,function*(){var a;if(this.encryptionType!==sa.NONE)return;let i;if(this.trackPublications.forEach(_=>{_.track&&_.track===e&&(i=_)}),!i)throw new Dc("track is not published");if(!Tl(e))throw new Dc("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),_r(e)));return}const u=e.addSimulcastTrack(r,c);if(!u)return;const d=new Hm({cid:u.mediaStreamTrack.id,type:Ye.kindToProto(e.kind),muted:e.isMuted,source:Ye.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=()=>re(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 re(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),_r(e))),yield d)}const i=this.getPublicationForTrack(e),o=i?_r(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(ft.Muted,this.onTrackMuted),e.off(ft.Unmuted,this.onTrackUnmuted),e.off(ft.Ended,this.handleTrackEnded),e.off(ft.UpstreamPaused,this.onTrackUpstreamPaused),e.off(ft.UpstreamResumed,this.onTrackUpstreamResumed),e.off(ft.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<Rn.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 Ye.Kind.Audio:this.audioTrackPublications.delete(i.trackSid);break;case Ye.Kind.Video:this.videoTrackPublications.delete(i.trackSid);break}return this.emit(vt.LocalTrackUnpublished,i),i.setTrack(void 0),c&&(yield this.engine.negotiate()),i})}unpublishTracks(e){return re(this,void 0,void 0,function*(){return(yield Promise.all(e.map(n=>this.unpublishTrack(n)))).filter(n=>!!n)})}republishAllTracks(e){return re(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 ui((i,o)=>re(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=>re(this,void 0,void 0,function*(){const d=u.track;yield this.unpublishTrack(d,!1),a&&!d.isMuted&&d.source!==Ye.Source.ScreenShare&&d.source!==Ye.Source.ScreenShareAudio&&(Tc(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 re(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?gr.RELIABLE:gr.LOSSY,o=a.destinationIdentities,c=a.topic;let u=new jP({participantIdentity:n.identity,payload:r,destinationIdentities:o,topic:c});const d=new Va({kind:i,value:{case:"user",value:u}});yield n.engine.sendDataPacket(d,i)})()})}publishDtmf(e,r){return re(this,void 0,void 0,function*(){const n=new Va({kind:gr.RELIABLE,value:{case:"sipDtmf",value:new G5({code:e,digit:r})}});yield this.engine.sendDataPacket(n,gr.RELIABLE)})}sendChatMessage(e,r){return re(this,void 0,void 0,function*(){const n={id:crypto.randomUUID(),message:e,timestamp:Date.now(),attachedFiles:r?.attachments},a=new Va({value:{case:"chatMessage",value:new sb(Object.assign(Object.assign({},n),{timestamp:Sn.parse(n.timestamp)}))}});return yield this.engine.sendDataPacket(a,gr.RELIABLE),this.emit(vt.ChatMessage,n),n})}editChatMessage(e,r){return re(this,void 0,void 0,function*(){const n=Object.assign(Object.assign({},r),{message:e,editTimestamp:Date.now()}),a=new Va({value:{case:"chatMessage",value:new sb(Object.assign(Object.assign({},n),{timestamp:Sn.parse(n.timestamp),editTimestamp:Sn.parse(n.editTimestamp)}))}});return yield this.engine.sendDataPacket(a,gr.RELIABLE),this.emit(vt.ChatMessage,n),n})}sendText(e,r){return re(this,void 0,void 0,function*(){return this.roomOutgoingDataStreamManager.sendText(e,r)})}streamText(e){return re(this,void 0,void 0,function*(){return this.roomOutgoingDataStreamManager.streamText(e)})}sendFile(e,r){return re(this,void 0,void 0,function*(){return this.roomOutgoingDataStreamManager.sendFile(e,r)})}streamBytes(e){return re(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 ui((u,d)=>re(this,void 0,void 0,function*(){var f,h,m,_;if(tA(a)>tq){d(Ha.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&&Jo((_=(m=this.engine.latestJoinResponse)===null||m===void 0?void 0:m.serverInfo)===null||_===void 0?void 0:_.version,"1.8.0")<0){d(Ha.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(Ha.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(Ha.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 re(this,void 0,void 0,function*(){const o=new Va({destinationIdentities:[e],kind:gr.RELIABLE,value:{case:"rpcRequest",value:new LP({id:r,method:n,payload:a,responseTimeoutMs:i,version:1})}});yield this.engine.sendDataPacket(o,gr.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,Ha.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),_r(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 fs),this.activeAgentFuture.promise)}getPublicationForTrack(e){let r;return this.trackPublications.forEach(n=>{const a=n.track;a&&(e instanceof MediaStreamTrack?(Tc(a)||Tl(a))&&a.mediaStreamTrack===e&&(r=n):e===a&&(r=n))}),r}waitForPendingPublicationOfSource(e){return re(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 Pa(20)}})}}class Kde extends Cc{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(ft.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(ft.UpdateSubscription,a),this.emitSubscriptionUpdateIfChanged(r),this.emitPermissionUpdateIfChanged(n)}get subscriptionStatus(){return this.subscribed===!1?Cc.SubscriptionStatus.Unsubscribed:super.isSubscribed?Cc.SubscriptionStatus.Subscribed:Cc.SubscriptionStatus.Desired}get permissionStatus(){return this.allowed?Cc.PermissionStatus.Allowed:Cc.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:Mi.HIGH}setTrack(e){const r=this.subscriptionStatus,n=this.permissionStatus,a=this.track;a!==e&&(a&&(a.off(ft.VideoDimensionsChanged,this.handleVideoDimensionsChange),a.off(ft.VisibilityChanged,this.handleVisibilityChange),a.off(ft.Ended,this.handleEnded),a.detach(),a.stopMonitor(),this.emit(ft.Unsubscribed,a)),super.setTrack(e),e&&(e.sid=this.trackSid,e.on(ft.VideoDimensionsChanged,this.handleVideoDimensionsChange),e.on(ft.VisibilityChanged,this.handleVisibilityChange),e.on(ft.Ended,this.handleEnded),this.emit(ft.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(ft.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?ft.Muted:ft.Unmuted)}emitSubscriptionUpdateIfChanged(e){const r=this.subscriptionStatus;e!==r&&this.emit(ft.SubscriptionStatusChanged,r,e)}emitPermissionUpdateIfChanged(e){this.permissionStatus!==e&&this.emit(ft.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 n4({trackSids:[this.trackSid],disabled:!this.isEnabled,fps:this.fps});if(this.kind===Ye.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:Mi.HIGH})),e.quality=Mi.HIGH)}this.emit(ft.UpdateSettings,e)}}class pb extends cq{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(ft.UpdateSettings,r=>{this.log.debug("send update settings",Object.assign(Object.assign(Object.assign({},this.logContext),_r(e)),{settings:r})),this.signalClient.sendUpdateTrackSettings(r)}),e.on(ft.UpdateSubscription,r=>{r.participantTracks.forEach(n=>{n.participantSid=this.sid}),this.signalClient.sendUpdateSubscription(r)}),e.on(ft.SubscriptionPermissionChanged,r=>{this.emit(vt.TrackSubscriptionPermissionChanged,e,r)}),e.on(ft.SubscriptionStatusChanged,r=>{this.emit(vt.TrackSubscriptionStatusChanged,e,r)}),e.on(ft.Subscribed,r=>{this.emit(vt.TrackSubscribed,r,e)}),e.on(ft.Unsubscribed,r=>{this.emit(vt.TrackUnsubscribed,r,e)}),e.on(ft.SubscriptionFailed,r=>{this.emit(vt.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]:Ye.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]:Ye.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(vt.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),_r(c))),this.emit(vt.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)&&zo(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=Ye.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!==Ye.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:_r(d),newTrack:_r(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),_r(a))),this.unpublishTrack(a.trackSid,!0))}),n.forEach(a=>{this.emit(vt.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 Ye.Kind.Audio:this.audioTrackPublications.delete(e);break;case Ye.Kind.Video:this.videoTrackPublications.delete(e);break}r&&this.emit(vt.TrackUnpublished,n)}setAudioOutput(e){return re(this,void 0,void 0,function*(){this.audioOutput=e;const r=[];this.audioTrackPublications.forEach(n=>{var a;zo(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 jr;(function(t){t.Disconnected="disconnected",t.Connecting="connecting",t.Connected="connected",t.Reconnecting="reconnecting",t.SignalReconnecting="signalReconnecting"})(jr||(jr={}));const Yde=4*1e3;class fp extends ec.EventEmitter{get hasE2EESetup(){return this.e2eeManager!==void 0}constructor(e){var r,n,a,i,o;if(super(),r=this,this.state=jr.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)=>re(this,void 0,void 0,function*(){var f;if(!yue())throw Xo()?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===jr.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(jr.Connecting),((f=this.regionUrlProvider)===null||f===void 0?void 0:f.getServerUrl().toString())!==J4(c)&&(this.regionUrl=void 0,this.regionUrlProvider=void 0),dp(new URL(c))&&(this.regionUrlProvider===void 0?this.regionUrlProvider=new Dr(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)=>re(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 Kt.cancelled("Connection attempt aborted");yield this.attemptConnection(E??c,u,d,P),this.abortController=void 0,w()}catch(A){if(this.regionUrlProvider&&A instanceof Kt&&A.reason!==un.Cancelled&&A.reason!==un.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 Kt&&(O.status===401||O.reason===un.Cancelled)){this.handleDisconnect(this.options.stopLocalTrackOnUnpublish),b(O);return}}[un.InternalError,un.ServerUnreachable,un.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=Ks.UNKNOWN_REASON;A instanceof Kt&&(C=RM(A)),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,C),b(A)}}}),_=this.regionUrl;return this.regionUrl=void 0,this.connectFuture=new fs((w,b)=>{m(w,b,_)},()=>{this.clearConnectionFutures()}),this.connectFuture.promise}),this.connectSignal=(c,u,d,f,h,m)=>re(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)=>re(this,void 0,void 0,function*(){var h,m;this.state===jr.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?Kt.cancelled("Signal connection aborted"):Kt.serverUnreachable("could not establish signal connection");throw _ instanceof Error&&(w.message="".concat(w.message,": ").concat(_.message)),_ instanceof Kt&&(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(),Kt.cancelled("Connection attempt aborted");try{yield this.engine.waitForPCInitialConnection(this.connOptions.peerConnectionTimeout,f)}catch(_){throw yield this.engine.close(),this.recreateEngine(),_}di()&&this.options.disconnectOnPageLeave&&(window.addEventListener("pagehide",this.onPageLeave),window.addEventListener("beforeunload",this.onPageLeave)),di()&&window.addEventListener("freeze",this.onPageLeave),this.setAndEmitConnectionState(jr.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 re(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===jr.Disconnected){f.log.debug("already disconnected",f.logContext);return}if(f.log.info("disconnect from room",Object.assign({},f.logContext)),f.state===jr.Connecting||f.state===jr.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(_,Kt.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,Ks.CLIENT_INITIATED),f.engine=void 0}finally{b()}})()})},this.onPageLeave=()=>re(this,void 0,void 0,function*(){this.log.info("Page leave detected, disconnecting",this.logContext),yield this.disconnect()}),this.startAudio=()=>re(this,void 0,void 0,function*(){const c=[],u=pi();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=()=>re(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(jr.Reconnecting)&&this.emit(tt.Reconnecting)},this.handleSignalRestarted=c=>re(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(jr.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=Ye.streamStateFromProto(u.state);f.track.setStreamState(h),h!==f.track.streamState&&(d.emit(vt.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(vt.DataReceived,u.payload,d,f)},this.handleSipDtmf=(c,u)=>{this.emit(tt.SipDTMFReceived,u,c),c?.emit(vt.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(ft.TranscriptionReceived,h),d?.emit(vt.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=()=>re(this,void 0,void 0,function*(){var c;((c=pi())===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=>re(this,void 0,void 0,function*(){var u,d,f,h,m,_;(u=c.track)===null||u===void 0||u.on(ft.TrackProcessorUpdate,this.onTrackProcessorUpdate),(d=c.track)===null||d===void 0||d.on(ft.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),Tc(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(ft.TrackProcessorUpdate,this.onTrackProcessorUpdate),(d=c.track)===null||d===void 0||d.off(ft.Restarted,this.onLocalTrackRestarted),this.emit(tt.LocalTrackUnpublished,c,this.localParticipant)},this.onLocalTrackRestarted=c=>re(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:ro.Room),this.transcriptionReceivedTimes=new Map,this.options.audioCaptureDefaults=Object.assign(Object.assign({},Q4),e?.audioCaptureDefaults),this.options.videoCaptureDefaults=Object.assign(Object.assign({},Z4),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 Ka,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)),di()){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 re(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===jr.Disconnected?ui.resolve(""):this.roomInfo&&this.roomInfo.sid!==""?ui.resolve(this.roomInfo.sid):new ui((e,r)=>{const n=a=>{a.sid!==""&&(this.engine.off(mt.RoomUpdate,n),e(a.sid))};this.engine.on(mt.RoomUpdate,n),this.once(tt.Disconnected,()=>{this.engine.off(mt.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(mt.ParticipantUpdate,this.handleParticipantUpdates).on(mt.RoomUpdate,this.handleRoomUpdate).on(mt.SpeakersChanged,this.handleSpeakersChanged).on(mt.StreamStateChanged,this.handleStreamStateUpdate).on(mt.ConnectionQualityUpdate,this.handleConnectionQualityUpdate).on(mt.SubscriptionError,this.handleSubscriptionError).on(mt.SubscriptionPermissionUpdate,this.handleSubscriptionPermissionUpdate).on(mt.MediaTrackAdded,(e,r,n)=>{this.onTrackAdded(e,r,n)}).on(mt.Disconnected,e=>{this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,e)}).on(mt.ActiveSpeakersUpdate,this.handleActiveSpeakersUpdate).on(mt.DataPacketReceived,this.handleDataPacket).on(mt.Resuming,()=>{this.clearConnectionReconcile(),this.isResuming=!0,this.log.info("Resuming signal connection",this.logContext),this.setAndEmitConnectionState(jr.SignalReconnecting)&&this.emit(tt.SignalReconnecting)}).on(mt.Resumed,()=>{this.registerConnectionReconcile(),this.isResuming=!1,this.log.info("Resumed signal connection",this.logContext),this.updateSubscriptions(),this.emitBufferedEvents(),this.setAndEmitConnectionState(jr.Connected)&&this.emit(tt.Reconnected)}).on(mt.SignalResumed,()=>{this.bufferedEvents=[],(this.state===jr.Reconnecting||this.isResuming)&&this.sendSyncState()}).on(mt.Restarting,this.handleRestarting).on(mt.SignalRestarted,this.handleSignalRestarted).on(mt.Offline,()=>{this.setAndEmitConnectionState(jr.Reconnecting)&&this.emit(tt.Reconnecting)}).on(mt.DCBufferStatusChanged,(e,r)=>{this.emit(tt.DCBufferStatusChanged,e,r)}).on(mt.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(vt.LocalTrackSubscribed,r),this.emitWhenConnected(tt.LocalTrackSubscribed,r,this.localParticipant)}).on(mt.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 ha.getInstance().getDevices(e,r)}prepareConnection(e,r){return re(this,void 0,void 0,function*(){if(this.state===jr.Disconnected){this.log.debug("prepareConnection to ".concat(e),this.logContext);try{if(dp(new URL(e))&&r){this.regionUrlProvider=new Dr(e,r);const n=yield this.regionUrlProvider.getNextBestRegionUrl();n&&this.state===jr.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 re(this,void 0,void 0,function*(){let n=()=>re(this,void 0,void 0,function*(){}),a;switch(e){case"signal-reconnect":yield this.engine.client.handleOnClose("simulate disconnect");break;case"speaker":a=new Ro({scenario:{case:"speakerUpdate",value:3}});break;case"node-failure":a=new Ro({scenario:{case:"nodeFailure",value:!0}});break;case"server-leave":a=new Ro({scenario:{case:"serverLeave",value:!0}});break;case"migration":a=new Ro({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=()=>re(this,void 0,void 0,function*(){yield this.engine.client.handleOnClose("simulate resume-disconnect")}),a=new Ro({scenario:{case:"disconnectSignalOnResume",value:!0}});break;case"disconnect-signal-on-resume-no-messages":n=()=>re(this,void 0,void 0,function*(){yield this.engine.client.handleOnClose("simulate resume-disconnect")}),a=new Ro({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 Ro({scenario:{case:"switchCandidateProtocol",value:e==="force-tls"?2:1}}),n=()=>re(this,void 0,void 0,function*(){const i=this.engine.client.onLeave;i&&i(new p0({reason:Ks.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 Ro({scenario:{case:"subscriberBandwidth",value:$u(r)}});break;case"leave-full-reconnect":a=new Ro({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 re(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===Ye.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===Ye.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 ha.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(vt.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).on(vt.ParticipantNameChanged,this.onLocalParticipantNameChanged).on(vt.AttributesChanged,this.onLocalAttributesChanged).on(vt.TrackMuted,this.onLocalTrackMuted).on(vt.TrackUnmuted,this.onLocalTrackUnmuted).on(vt.LocalTrackPublished,this.onLocalTrackPublished).on(vt.LocalTrackUnpublished,this.onLocalTrackUnpublished).on(vt.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).on(vt.MediaDevicesError,this.onMediaDevicesError).on(vt.AudioStreamAcquired,this.startAudio).on(vt.ChatMessage,this.onLocalChatMessageSent).on(vt.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===jr.Connecting||this.state===jr.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===jr.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!==jr.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(vt.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).off(vt.ParticipantNameChanged,this.onLocalParticipantNameChanged).off(vt.AttributesChanged,this.onLocalAttributesChanged).off(vt.TrackMuted,this.onLocalTrackMuted).off(vt.TrackUnmuted,this.onLocalTrackUnmuted).off(vt.LocalTrackPublished,this.onLocalTrackPublished).off(vt.LocalTrackUnpublished,this.onLocalTrackUnpublished).off(vt.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).off(vt.MediaDevicesError,this.onMediaDevicesError).off(vt.AudioStreamAcquired,this.startAudio).off(vt.ChatMessage,this.onLocalChatMessageSent).off(vt.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),di()&&(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(jr.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 re(this,void 0,void 0,function*(){if(yield this.engine.publishRpcAck(e,r),o!==1){yield this.engine.publishRpcResponse(e,r,null,Ha.builtIn("UNSUPPORTED_VERSION"));return}const c=this.rpcHandlers.get(n);if(!c){yield this.engine.publishRpcResponse(e,r,null,Ha.builtIn("UNSUPPORTED_METHOD"));return}let u=null,d=null;try{const f=yield c({requestId:r,callerIdentity:e,payload:a,responseTimeout:i});tA(f)>tq?(u=Ha.builtIn("RESPONSE_PAYLOAD_TOO_LARGE"),this.log.warn("RPC Response payload too large for ".concat(n))):d=f}catch(f){f instanceof Ha?u=f:(this.log.warn("Uncaught error returned by RPC handler for ".concat(n,". Returning APPLICATION_ERROR instead."),f),u=Ha.builtIn("APPLICATION_ERROR"))}yield this.engine.publishRpcResponse(e,r,d,u)})}selectDefaultDevices(){return re(this,void 0,void 0,function*(){var e,r,n;const a=ha.getInstance().previousDevices,i=yield ha.getInstance().getDevices(void 0,!1),o=pi();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 re(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=G4())!==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(),Pa(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(vt.TrackPublished,a=>{this.emitWhenConnected(tt.TrackPublished,a,n)}).on(vt.TrackSubscribed,(a,i)=>{a.kind===Ye.Kind.Audio?(a.on(ft.AudioPlaybackStarted,this.handleAudioPlaybackStarted),a.on(ft.AudioPlaybackFailed,this.handleAudioPlaybackFailed)):a.kind===Ye.Kind.Video&&(a.on(ft.VideoPlaybackFailed,this.handleVideoPlaybackFailed),a.on(ft.VideoPlaybackStarted,this.handleVideoPlaybackStarted)),this.emit(tt.TrackSubscribed,a,i,n)}).on(vt.TrackUnpublished,a=>{this.emit(tt.TrackUnpublished,a,n)}).on(vt.TrackUnsubscribed,(a,i)=>{this.emit(tt.TrackUnsubscribed,a,i,n)}).on(vt.TrackMuted,a=>{this.emitWhenConnected(tt.TrackMuted,a,n)}).on(vt.TrackUnmuted,a=>{this.emitWhenConnected(tt.TrackUnmuted,a,n)}).on(vt.ParticipantMetadataChanged,a=>{this.emitWhenConnected(tt.ParticipantMetadataChanged,a,n)}).on(vt.ParticipantNameChanged,a=>{this.emitWhenConnected(tt.ParticipantNameChanged,a,n)}).on(vt.AttributesChanged,a=>{this.emitWhenConnected(tt.ParticipantAttributesChanged,a,n)}).on(vt.ConnectionQualityChanged,a=>{this.emitWhenConnected(tt.ConnectionQualityChanged,a,n)}).on(vt.ParticipantPermissionsChanged,a=>{this.emitWhenConnected(tt.ParticipantPermissionsChanged,a,n)}).on(vt.TrackSubscriptionStatusChanged,(a,i)=>{this.emitWhenConnected(tt.TrackSubscriptionStatusChanged,a,i,n)}).on(vt.TrackSubscriptionFailed,(a,i)=>{this.emit(tt.TrackSubscriptionFailed,a,n,i)}).on(vt.TrackSubscriptionPermissionChanged,(a,i)=>{this.emitWhenConnected(tt.TrackSubscriptionPermissionChanged,a,i,n)}).on(vt.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=xa.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,Ks.STATE_MISMATCH))):e=0},Yde)}clearConnectionReconcile(){this.connectionReconcileInterval&&xa.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===jr.Reconnecting||this.isResuming||!this.engine||this.engine.pendingReconnect)this.bufferedEvents.push([e,n]);else if(this.state===jr.Connected)return this.emit(e,...n);return!1}simulateParticipants(e){return re(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:Sn.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(jr.Connected),o.video){const u=new xC(Ye.Kind.Video,new Tf({source:Xn.CAMERA,sid:Math.floor(Math.random()*1e4).toString(),type:$s.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(vt.LocalTrackPublished,u)}if(o.audio){const u=new xC(Ye.Kind.Audio,new Tf({source:Xn.MICROPHONE,sid:Math.floor(Math.random()*1e4).toString(),type:$s.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(vt.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:Sn.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:Xn.CAMERA,sid:Math.floor(Math.random()*1e4).toString(),type:$s.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:Xn.MICROPHONE,sid:Math.floor(Math.random()*1e4).toString(),type:$s.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=lq(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 lq(t){return t.map(e=>{if(e)return Array.isArray(e)?lq(e):typeof e=="object"?"logContext"in e?e.logContext:void 0:e})}var zs;(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"})(zs||(zs={}));class mu extends ec.EventEmitter{constructor(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};super(),this.status=zs.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 re(this,void 0,void 0,function*(){if(this.status!==zs.IDLE)throw Error("check is running already");this.setStatus(zs.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!==zs.SKIPPED&&this.setStatus(this.isSuccess()?zs.SUCCESS:zs.FAILED),e&&e(),this.getInfo()})}isSuccess(){return!this.logs.some(e=>e.level==="error")}connect(e){return re(this,void 0,void 0,function*(){return this.room.state===jr.Connected?this.room:(e||(e=this.url),yield this.room.connect(e,this.token,this.connectOptions),this.room)})}disconnect(){return re(this,void 0,void 0,function*(){this.room&&this.room.state!==jr.Disconnected&&(yield this.room.disconnect(),yield new Promise(e=>setTimeout(e,500)))})}skip(){this.setStatus(zs.SKIPPED)}switchProtocol(e){return re(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 Pa(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 re(this,void 0,void 0,function*(){const e=new Dr(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 re(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 re(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 re(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(()=>re(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 re(this,void 0,void 0,function*(){var e;const r=yield this.connect(),n=yield Vde();if(yield H4(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 re(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 re(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 re(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!==jr.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 re(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 Dr(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 re(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 re(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 Dr(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 zSe extends ec.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:zs.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!==zs.FAILED)}getResults(){return Array.from(this.checkResults.values())}createAndRunCheck(e){return re(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 re(this,void 0,void 0,function*(){return this.createAndRunCheck(afe)})}checkWebRTC(){return re(this,void 0,void 0,function*(){return this.createAndRunCheck(rfe)})}checkTURN(){return re(this,void 0,void 0,function*(){return this.createAndRunCheck(tfe)})}checkReconnect(){return re(this,void 0,void 0,function*(){return this.createAndRunCheck(efe)})}checkPublishAudio(){return re(this,void 0,void 0,function*(){return this.createAndRunCheck(Qde)})}checkPublishVideo(){return re(this,void 0,void 0,function*(){return this.createAndRunCheck(Zde)})}checkConnectionProtocol(){return re(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 re(this,void 0,void 0,function*(){return this.createAndRunCheck(Xde)})}}function br(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 Ja extends Error{constructor(e,r){var n;super(e,r),br(this,"code","ERR_JOSE_GENERIC"),this.name=this.constructor.name,(n=Error.captureStackTrace)===null||n===void 0||n.call(Error,this,this.constructor)}}br(Ja,"code","ERR_JOSE_GENERIC");class ofe extends Ja{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}}),br(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED"),br(this,"claim",void 0),br(this,"reason",void 0),br(this,"payload",void 0),this.claim=n,this.reason=a,this.payload=r}}br(ofe,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");class cfe extends Ja{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}}),br(this,"code","ERR_JWT_EXPIRED"),br(this,"claim",void 0),br(this,"reason",void 0),br(this,"payload",void 0),this.claim=n,this.reason=a,this.payload=r}}br(cfe,"code","ERR_JWT_EXPIRED");class lfe extends Ja{constructor(){super(...arguments),br(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}}br(lfe,"code","ERR_JOSE_ALG_NOT_ALLOWED");class ufe extends Ja{constructor(){super(...arguments),br(this,"code","ERR_JOSE_NOT_SUPPORTED")}}br(ufe,"code","ERR_JOSE_NOT_SUPPORTED");class dfe extends Ja{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),br(this,"code","ERR_JWE_DECRYPTION_FAILED")}}br(dfe,"code","ERR_JWE_DECRYPTION_FAILED");class ffe extends Ja{constructor(){super(...arguments),br(this,"code","ERR_JWE_INVALID")}}br(ffe,"code","ERR_JWE_INVALID");class pfe extends Ja{constructor(){super(...arguments),br(this,"code","ERR_JWS_INVALID")}}br(pfe,"code","ERR_JWS_INVALID");class hfe extends Ja{constructor(){super(...arguments),br(this,"code","ERR_JWT_INVALID")}}br(hfe,"code","ERR_JWT_INVALID");class mfe extends Ja{constructor(){super(...arguments),br(this,"code","ERR_JWK_INVALID")}}br(mfe,"code","ERR_JWK_INVALID");class gfe extends Ja{constructor(){super(...arguments),br(this,"code","ERR_JWKS_INVALID")}}br(gfe,"code","ERR_JWKS_INVALID");class yfe extends Ja{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),br(this,"code","ERR_JWKS_NO_MATCHING_KEY")}}br(yfe,"code","ERR_JWKS_NO_MATCHING_KEY");class vfe extends Ja{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),br(this,Symbol.asyncIterator,void 0),br(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}}br(vfe,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");class _fe extends Ja{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),br(this,"code","ERR_JWKS_TIMEOUT")}}br(_fe,"code","ERR_JWKS_TIMEOUT");class bfe extends Ja{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),br(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}}br(bfe,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");const uq=v.createContext(null),kfe=()=>v.useContext(uq);function wfe({children:t}){const{user:e}=Vr(),r=ws(),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 ae=o.current;if(!ae){E([]),D(null);return}const G=[];ae.remoteParticipants.forEach(K=>{const ne=K.getTrackPublication(Ye.Source.Camera)?.track,ee=K.getTrackPublication(Ye.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:ne||void 0,audioTrack:ee||void 0})}),E(G);const F=ae.localParticipant;if(F){const ne=F.getTrackPublication(Ye.Source.Camera)?.track,ee=F.getTrackPublication(Ye.Source.Microphone)?.track;D({id:F.identity,name:F.name||F.identity,isSelf:!0,audioEnabled:F.isMicrophoneEnabled,videoEnabled:F.isCameraEnabled,isSpeaking:F.isSpeaking,videoTrack:ne||void 0,audioTrack:ee||void 0}),x(ne||null),A(F.isMicrophoneEnabled),O(F.isCameraEnabled)}},[]),N=v.useRef(null),L=v.useRef(!1),j=v.useCallback(async ae=>{if(!i||!r){w("Not authenticated");return}if(N.current!==ae){if(o.current){try{o.current.disconnect()}catch{}o.current=null}N.current=ae,L.current=!1,m(!0),w(null);try{const G=await new Promise(Pe=>{r.emit("livekit_join",{roomId:ae},Pe)});if(L.current){N.current=null;return}if(!G?.ok)throw new Error(G?.error||"Failed to get LiveKit token");const{token:F,url:K,iceServers:ne}=G,ee={};ne&&Array.isArray(ne)&&ne.length>0&&(ee.iceServers=ne,ee.iceTransportPolicy="all");const he=new fp({adaptiveStream:!0,dynacast:!0,videoCaptureDefaults:{resolution:up.h540.resolution}});await he.prepareConnection(K,F),he.on(tt.Connected,()=>{f(!0),m(!1),R()}),he.on(tt.Disconnected,()=>{f(!1),u(null),R()}),he.on(tt.ParticipantConnected,Pe=>{R()}),he.on(tt.ParticipantDisconnected,Pe=>{R()}),he.on(tt.TrackSubscribed,(Pe,Ge,se)=>{R()}),he.on(tt.TrackUnsubscribed,(Pe,Ge,se)=>{R()}),he.on(tt.LocalTrackPublished,(Pe,Ge)=>{R()}),he.on(tt.LocalTrackUnpublished,(Pe,Ge)=>{R()}),he.on(tt.ActiveSpeakersChanged,()=>{R()}),he.on(tt.ConnectionStateChanged,Pe=>{Pe===jr.Disconnected&&f(!1)});const ce=Object.keys(ee).length>0?{rtcConfig:ee}:void 0;if(await he.connect(K,F,ce),L.current){he.disconnect(),N.current=null;return}o.current=he,u(ae),N.current=null}catch(G){w(G?.message||"Failed to join room"),m(!1),N.current=null}}},[i,r,R]),z=v.useCallback(()=>{L.current=!0,N.current=null;const ae=o.current;if(ae){try{ae.disconnect()}catch{}o.current=null}f(!1),m(!1),u(null),E([]),D(null),x(null)},[]),U=v.useCallback(async()=>{const ae=o.current;if(ae)try{await ae.localParticipant.setMicrophoneEnabled(!P),A(!P)}catch{}},[P]),W=v.useCallback(async()=>{const ae=o.current;if(ae)try{await ae.localParticipant.setCameraEnabled(!C),O(!C),R()}catch{}},[C,R]),q=v.useCallback(async ae=>{const G=o.current;if(G)try{await G.localParticipant.setMicrophoneEnabled(ae),A(ae)}catch{}},[]),Y=v.useCallback(async ae=>{const G=o.current;if(G)try{await G.localParticipant.setCameraEnabled(ae),O(ae),R()}catch{}},[R]);v.useEffect(()=>()=>{if(L.current=!0,N.current=null,o.current){try{o.current.disconnect()}catch{}o.current=null}},[]);const Z={connected:d,connecting:h,error:_,joinRoom:j,leaveRoom:z,currentRoomId:c,participants:b,localParticipant:T,micEnabled:P,videoEnabled:C,toggleMic:U,toggleVideo:W,setMicEnabled:q,setVideoEnabled:Y,localVideoTrack:I};return g.jsx(uq.Provider,{value:Z,children:t})}const Oc={diceAudio:!0,backgroundMusic:!0,chatAudio:!1,video:!1,showAnimations:!0,lastGameMode:"cee-lo",diceColorTheme:"dice_white_black"},dq="app:settings:v1";async function au(){try{const{value:t}=await gs.get({key:dq});if(!t)return{...Oc};const e=JSON.parse(t);return{...Oc,...e}}catch{return{...Oc}}}async function y0(t){await gs.set({key:dq,value:JSON.stringify(t)})}const Sfe={BASE_URL:"./",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_APP_TARGET:"craps",VITE_OTA:"1"},Km=500,fq=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){fq[ym]=t,ym=(ym+1)%Km,hb=Math.min(hb+1,Km);try{window.dispatchEvent(new CustomEvent("fe:log",{detail:t}))}catch{}}function pq(){const t=[],e=hb;for(let r=0;r<e;r++){const n=(ym-e+r+Km)%Km,a=fq[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 Lt={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=pq,window.rtcLogsClear=Cfe}catch{}const hq=v.createContext(null),xfe=()=>v.useContext(hq);function pn(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}=Vr(),r=ws(),n=e?.id,a=!!(e?.email&&/@guest\.local$/i.test(e.email)),i=!!n&&!a;function o(J,ue){try{const ve=window;ve.__rtcVideoDisableReasons||(ve.__rtcVideoDisableReasons=[]),ve.__rtcVideoDisableReasons.push({t:Date.now(),reason:J,...ue?{data:ue}:{}});try{PC(`video:disable:${J}`)}catch{}}catch{}}const{rtcJoin:c,rtcSignal:u,rtcLeave:d,rtcSetVideoEnabled:f}=ma(),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"}],z=v.useRef([...j]),[U,W]=v.useState(0),q=v.useRef(null);v.useRef([]);const Y=v.useRef({audio:!1,video:!1}),Z=U>0||N||x,ae=v.useCallback(async()=>{try{const J=navigator;J?.wakeLock?.request&&!q.current&&(q.current=await J.wakeLock.request("screen"),q.current.addEventListener("release",()=>{}))}catch{}},[]),G=v.useCallback(async()=>{try{await q.current?.release?.()}catch{}q.current=null},[]);v.useEffect(()=>(Lt.debug("wakeLock:effect",{need:Z}),Z?ae():G(),()=>{G()}),[Z,ae,G]),v.useEffect(()=>{const J=()=>{document.visibilityState==="visible"&&Z&&ae()};return document.addEventListener("visibilitychange",J),()=>document.removeEventListener("visibilitychange",J)},[Z,ae]);const F=(()=>{try{return window.Capacitor?.getPlatform?.()==="ios"}catch{return!1}})();async function K(J,ue){if(!i||Y.current[ue])return null;Y.current[ue]=!0;try{return navigator.mediaDevices?.getUserMedia?await navigator.mediaDevices.getUserMedia(J):(Lt.error("gUM:not-available",{kind:ue,isNativeIOS:F}),null)}catch(ve){return Lt.error("gUM:failed",{kind:ue,errName:ve?.name,errMsg:ve?.message,isNativeIOS:F}),null}finally{Y.current[ue]=!1}}async function ne(){if(!i)return;if(A.current)return A.current;const J=await K({audio:!0,video:!1},"audio");if(J){const ue=J.getAudioTracks()[0];ue&&(ue.enabled=!1),A.current=J}return A.current}async function ee(){if(!i)return;if(P.current)return P.current;const ue=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 ue&&(P.current=ue,D(ue),Lt.info("ensureVideo:acquired",Pfe(ue))),P.current}function he(){const J=P.current?.getVideoTracks()??[];try{J.forEach(ue=>{ue.stop()})}catch{}P.current=void 0,D(void 0)}function ce(){try{A.current?.getAudioTracks()?.forEach(J=>J.stop())}catch{}A.current=void 0}const Pe=v.useRef(new Map),[Ge,se]=v.useState({});function Ce(J,ue){if(Pe.current.get(J))return;const ve=ue?.getAudioTracks?.()??[];if(!ve.length||ve.every(Fe=>Fe.readyState!=="live"))return;let Ae;try{Ae=new AudioContext}catch(Fe){Lt.warn("vad:audiocontext-failed",{pid:J,err:String(Fe)});return}let B,Q;try{B=Ae.createMediaStreamSource(ue),Q=Ae.createAnalyser(),Q.fftSize=2048,B.connect(Q)}catch(Fe){Lt.warn("vad:setup-failed",{pid:J,err:String(Fe)});try{Ae.close()}catch{}return}const oe=new Uint8Array(Q.fftSize);let Ne=0;const pt=.04,Rt=.02;let Ut=!1,dr=!1;const hn=()=>{if(!dr){try{Q.getByteTimeDomainData(oe);let Fe=0;for(let Ft=0;Ft<oe.length;Ft++){const qt=(oe[Ft]-128)/128;Fe+=qt*qt}const Zt=Math.sqrt(Fe/oe.length);!Ut&&Zt>=pt?(Ut=!0,se(Ft=>Ft[J]===!0?Ft:{...Ft,[J]:!0})):Ut&&Zt<=Rt&&(Ut=!1,se(Ft=>Ft[J]===!1?Ft:{...Ft,[J]:!1}))}catch{}dr||(Ne=requestAnimationFrame(hn))}};Ne=requestAnimationFrame(hn);const rn=()=>{dr=!0,cancelAnimationFrame(Ne);try{B.disconnect()}catch{}try{Q.disconnect()}catch{}Ae.close().catch(()=>{})};Pe.current.set(J,rn)}function te(J){const ue=Pe.current.get(J);ue&&(ue(),Pe.current.delete(J)),se(ve=>{if(!(J in ve))return ve;const Ae={...ve};return delete Ae[J],Ae})}function H(J,ue){try{return pn(J)?void 0:J.getTransceivers().find(ve=>ve.receiver.track?.kind===ue)??J.getTransceivers().find(ve=>ve.sender.track?.kind===ue)??J.getTransceivers()[ue==="audio"?0:1]}catch{return}}function pe(J,ue){try{return pn(J)?void 0:J.getSenders().find(ve=>ve.track?.kind===ue)??H(J,ue)?.sender}catch{return}}async function Re(J,ue){try{if(pn(J))return;const ve=ue?.getAudioTracks?.()[0]??null,Ae=pe(J,"audio");Ae&&await Ae.replaceTrack(ve)}catch(ve){Lt.warn("upsertAudioTrack:failed",{err:String(ve)})}}async function de(J,ue){try{if(pn(J))return;const ve=ue?.getVideoTracks?.()[0]??null,Ae=pe(J,"video");Ae&&await Ae.replaceTrack(ve)}catch(ve){Lt.warn("upsertVideoTrack:failed",{err:String(ve)})}}async function Ie(J,ue){try{const ve=ue.pc,Ae=Date.now();let B=0,Q=0;(await ve.getStats()).forEach(pt=>{pt.type==="outbound-rtp"&&!pt.isRemote&&(B+=pt.bytesSent??0),pt.type==="inbound-rtp"&&!pt.isRemote&&(Q+=pt.bytesReceived??0)});const Ne=I.current.get(J);I.current.set(J,{t:Ae,up:B,down:Q}),Ne&&ve.connectionState==="connected"&&B===Ne.up&&Q===Ne.down&&Ae-Ne.t>2e4&&await bt(J,ue)}catch{}}function ct(J,ue){if(O.current.get(J))return;const ve=window.setInterval(()=>Ie(J,ue),1e4);O.current.set(J,ve)}function Ve(J){const ue=O.current.get(J);ue&&(clearInterval(ue),O.current.delete(J)),I.current.delete(J)}function rt(){const J=typeof window<"u"?new URL(window.location.href):null,ue=typeof localStorage<"u"&&(localStorage.getItem("rtcRelayOnly")==="1"||localStorage.getItem("rtcRelayOnly")==="true")||J?.searchParams.get("rtcRelay")==="1"||J?.searchParams.get("rtcRelay")==="true",ve=!!it._compat,Ae=!!(ue||ve),B={iceServers:Ih(z.current,j),bundlePolicy:"balanced",iceTransportPolicy:Ae?"relay":"all",rtcpMuxPolicy:"require",iceCandidatePoolSize:2};B.iceServers.some(oe=>(Array.isArray(oe.urls)?oe.urls:[oe.urls]).some(pt=>pt.startsWith("turn:")||pt.startsWith("turns:"))),Lt.debug("pc:new",{relayOnly:Ae,iceTransportPolicy:B.iceTransportPolicy,iceServers:(B.iceServers||[]).map(oe=>typeof oe.urls=="string"?oe.urls:oe.urls?.[0])});let Q;try{Q=new RTCPeerConnection(B)}catch(oe){Lt.error("pc:new-failed",{err:String(oe),servers:B.iceServers});const Ne={...B,iceServers:j};Q=new RTCPeerConnection(Ne)}return Q.addTransceiver("audio",{direction:"sendrecv"}),Q.addTransceiver("video",{direction:"sendrecv"}),Q}async function Ke(J,ue){try{const ve=await ue.getStats(),Ae={};ve.forEach(Q=>{Q&&Q.id&&(Ae[Q.id]=Q)});let B;if(ve.forEach(Q=>{Q.type==="transport"&&Q.selectedCandidatePairId&&Ae[Q.selectedCandidatePairId]&&(B=Ae[Q.selectedCandidatePairId])}),B||ve.forEach(Q=>{Q.type==="candidate-pair"&&(Q.selected||Q.state==="succeeded")&&(B=Q)}),B){const Q=Ae[B.localCandidateId],oe=Ae[B.remoteCandidateId];Lt.info("ice:selected",{peerId:J,state:B.state,nominated:B.nominated,bytesSent:B.bytesSent,bytesReceived:B.bytesReceived,local:Q?{type:Q.candidateType,protocol:Q.protocol,address:Q.address,port:Q.port}:void 0,remote:oe?{type:oe.candidateType,protocol:oe.protocol,address:oe.address,port:oe.port}:void 0})}else Lt.debug("ice:selected:none",{peerId:J})}catch(ve){Lt.error("ice:selected-failed",{peerId:J,err:String(ve)})}}async function it(){try{if(it._ran)return;it._ran=!0;const J={iceServers:Ih(z.current,j),bundlePolicy:"balanced",iceTransportPolicy:"all"},ue=new RTCPeerConnection(J),ve={host:0,srflx:0,relay:0,prflx:0};ue.onicecandidate=pt=>{if(!pt.candidate)return;const dr=(pt.candidate.candidate||"").match(/ typ ([a-z]+)/)?.[1]||"unknown";ve[dr]===void 0&&(ve[dr]=0),ve[dr]+=1},ue.createDataChannel("probe");const Ae=await ue.createOffer({iceRestart:!1});await ue.setLocalDescription(Ae),await new Promise(pt=>setTimeout(pt,4e3));try{ue.close()}catch{}const B=(ve.relay||0)>0,Q=(ve.srflx||0)>0,oe=(ve.host||0)>0,Ne=B&&!Q&&oe;if(Ne){Lt.warn("ice:probe-forcing-relay",{counts:ve,reason:"no-srflx"}),it._compat=!0;try{localStorage.setItem("rtcRelayOnly","1")}catch{}}else!B&&!Q&&Lt.error("ice:probe-restricted-network",{counts:ve,warning:"Voice/video may not work"});Lt.info("ice:probe",{counts:ve,relayOK:B,srflxOK:Q,needsRelayOnly:Ne})}catch(J){Lt.error("ice:probe-failed",{err:String(J)})}}function Et(J){let ue=h.current.get(J);if(ue)return ue;const ve=rt(),Ae={pc:ve,iceBuffer:[],makingOffer:!1,ignoreOffer:!1,isSettingRemoteAnswerPending:!1};return ve.onicecandidate=B=>{B.candidate&&(Lt.debug("pc:icecandidate",{peerId:J,ctype:B.candidate.type,proto:B.candidate.protocol,addr:B.candidate.address,port:B.candidate.port}),u(C.current,J,{ice:B.candidate.toJSON()}).catch(console.error))},ve.ontrack=B=>{if(Lt.info("pc:ontrack",{peerId:J,kind:B.track.kind,id:B.track.id}),_(Q=>{const oe=Q[J]??new MediaStream;return oe.getTracks().includes(B.track)||(oe.addTrack(B.track),B.track.addEventListener("ended",()=>{Lt.debug("pc:track-ended",{peerId:J,kind:B.track.kind,id:B.track.id}),_(Ne=>{const pt=Ne[J];if(!pt)return Ne;try{pt.removeTrack(B.track)}catch{}return{...Ne,[J]:pt}}),B.track.kind==="video"&&E(Ne=>({...Ne,[J]:!1}))}),B.track.kind==="video"&&(B.track.addEventListener("mute",()=>{E(Ne=>({...Ne,[J]:!1}))}),B.track.addEventListener("unmute",()=>{B.track.readyState==="live"&&E(Ne=>({...Ne,[J]:!0}))}))),{...Q,[J]:oe}}),B.track.kind==="video"){const Q=B.track.readyState==="live"&&!B.track.muted;E(oe=>({...oe,[J]:Q}))}},ve.onnegotiationneeded=()=>{Lt.debug("pc:onnegotiationneeded",{peerId:J})},ve.onconnectionstatechange=()=>{const{connectionState:B}=ve,Q=ve.iceConnectionState;if(Lt.info("pc:state",{peerId:J,state:B,ice:Q}),B==="connected"&&(Ae.degradedAt=null,Ae.iceRestartCount=0,Ae.rebuildAttempts=0,Rfe(J,Ae),ct(J,Ae),setTimeout(()=>Ke(J,ve),500)),B==="closed"&&(Mh(Ae),Ve(J)),(B==="disconnected"||It(B,Q))&&!Ae.degradedAt&&(Ae.degradedAt=Date.now()),B==="disconnected"&&Ae.degradedAt){const Ne=Date.now()-Ae.degradedAt;Ne>3e3&&Ne<8e3?bt(J,Ae):Ne>=8e3&&(Lt.warn("pc:prolonged-disconnect",{peerId:J,degradedMs:Ne}),nt(J))}It(B,Q)&&bt(J,Ae)},ve.oniceconnectionstatechange=()=>{const B=ve.iceConnectionState;Lt.debug("pc:ice-state",{peerId:J,ice:B}),B==="failed"&&bt(J,Ae),B==="disconnected"&&setTimeout(()=>{!pn(ve)&&ve.iceConnectionState==="disconnected"&&(Lt.warn("ice:prolonged-disconnect",{peerId:J}),bt(J,Ae))},4e3)},ve.onicegatheringstatechange=()=>{},ve.ondatachannel=B=>{if(B.channel.label==="ka"){const Q=B.channel;Ae.dc=Q,Lt.debug("pc:datachannel",{peerId:J,label:Q.label,state:Q.readyState})}},h.current.set(J,Ae),W(h.current.size),Lt.info("peer:new",{peerId:J}),Ae}function It(J,ue){return J==="failed"||ue==="failed"}async function bt(J,ue){if(pn(ue.pc))return;const ve=Date.now(),Ae=ue.lastIceRestartAt,B=ue.iceRestartCount??0,Q=Math.min(1e4*Math.pow(2,B),6e4);if(!(Ae&&ve-Ae<Q)){if(B>=3){Lt.warn("ice:restart-exhausted",{peerId:J,restartCount:B}),ue.iceRestartCount=0,await nt(J);return}if(Lt.warn("ice:restart",{peerId:J,attempt:B+1}),!(ue.makingOffer||pn(ue.pc))&&(ue.pc.signalingState!=="stable"&&await Mt(ue.pc),!pn(ue.pc)))try{const oe=await ue.pc.createOffer({iceRestart:!0});if(pn(ue.pc))return;await ue.pc.setLocalDescription(oe),await u(C.current,J,{sdp:ue.pc.localDescription}),ue.lastIceRestartAt=ve,ue.iceRestartCount=B+1}catch(oe){Lt.error("ice:restart-failed",{peerId:J,err:String(oe)}),ue.iceRestartCount=0,await nt(J)}}}const me=v.useRef(new Map),Be=3,je=3e4;async function nt(J){const ue=me.current.get(J)??{count:0,lastAt:0},ve=Date.now();if(ve-ue.lastAt>je*3&&(ue.count=0),ue.count>=Be){const oe=je-(ve-ue.lastAt);if(oe>0){Lt.warn("rebuild:rate-limited",{peerId:J,attempts:ue.count,waitMs:oe}),setTimeout(()=>{me.current.delete(J),nt(J)},oe);return}ue.count=0}ue.count++,ue.lastAt=ve,me.current.set(J,ue),Lt.info("rebuild:peer",{peerId:J,attempt:ue.count});const Ae=h.current.get(J);if(Ae){Mh(Ae);try{Ae.pc.close()}catch{}h.current.delete(J)}_(oe=>{if(!oe[J])return oe;const Ne={...oe};return wv(Ne[J]),delete Ne[J],Ne}),te(J),E(oe=>{const{[J]:Ne,...pt}=oe;return pt});const{pc:B}=Et(J);await st(B);const Q=h.current.get(J);await De(J,B,Q)}function Ct(J){return J.signalingState==="stable"}function Mt(J){return J.signalingState==="stable"||pn(J)?Promise.resolve():new Promise(ue=>{const ve=()=>{const Ae=J.signalingState;(Ae==="stable"||Ae==="closed")&&(J.removeEventListener("signalingstatechange",ve),ue())};J.addEventListener("signalingstatechange",ve)})}async function De(J,ue,ve){try{if(pn(ue)||(Ct(ue)||await Mt(ue),!Ct(ue)||ve.makingOffer||pn(ue)))return;ve.makingOffer=!0,Lt.debug("sdp:offer",{peerId:J});const Ae=await ue.createOffer();if(pn(ue)){ve.makingOffer=!1;return}await ue.setLocalDescription(Ae),await u(C.current,J,{sdp:ue.localDescription})}catch(Ae){Lt.warn("safeRenegotiate:failed",{peerId:J,err:String(Ae)})}finally{ve.makingOffer=!1}}const et=v.useCallback(async J=>{if(J!==N){if(!i){L(!1),o("preferences:init"),L(!1);return}if(L(J),n&&E(ue=>({...ue,[n]:J})),J){try{am(!0)}catch{}if(!await ee()){L(!1),n&&E(B=>({...B,[n]:!1}));return}for(const[B,Q]of h.current)await de(Q.pc,P.current),await De(B,Q.pc,Q);const ve=()=>{try{am(!1)}catch{}};let Ae=!1;for(const[,B]of h.current){const Q=B.pc,oe=()=>{!Ae&&Q.connectionState==="connected"&&(Ae=!0,ve(),Q.removeEventListener("connectionstatechange",oe))};Q.addEventListener("connectionstatechange",oe)}window.setTimeout(()=>{Ae||ve()},2500)}else{for(const[ue,ve]of h.current)await de(ve.pc,void 0),await De(ue,ve.pc,ve);he()}f(C.current,J).catch(()=>{});try{PC(J?"videoEnabled:on":"videoEnabled:off")}catch{}}},[N,n,i,h,ee,de,De,he,f]),at=async J=>{if(!i){R(!1);return}if(R(J),J&&!A.current&&!await ne()){R(!1);return}const ue=A.current?.getAudioTracks?.()[0];ue&&(ue.enabled=J);for(const[,ve]of h.current)await Re(ve.pc,A.current)},ke=J=>J===n?!!P.current?.getVideoTracks?.().some(ve=>ve.readyState==="live"):!!m[J]?.getVideoTracks?.().some(ve=>ve.readyState==="live"),st=async J=>{if(!pn(J)){if(!i){await Re(J,void 0),await de(J,void 0);return}try{if(await ne(),N&&await ee(),pn(J))return;Lt.debug("attachLocalTracks",{audio:!!(x&&A.current),video:!!(N&&P.current)}),await Re(J,x?A.current:void 0),await de(J,N?P.current:void 0)}catch(ue){Lt.warn("attachLocalTracks:failed",{err:String(ue)})}}},kt=v.useRef(0),nr=5400*1e3;v.useEffect(()=>{if(!C.current||h.current.size===0)return;const J=async()=>{const ve=Date.now();if(!(ve-kt.current<nr)){Lt.info("ice:refresh-credentials",{roomId:C.current});try{const Ae=await c(C.current);if(Ae?.ok&&Array.isArray(Ae.iceServers)&&Ae.iceServers.length){const B=Ih([...j,...Ae.iceServers],j);z.current=B,kt.current=ve,Lt.debug("ice:credentials-refreshed",{count:B.length})}}catch(Ae){Lt.warn("ice:refresh-failed",{err:String(Ae)})}}},ue=window.setInterval(J,6e4);return()=>clearInterval(ue)},[U,c]);const lr=async J=>{if(!i||!n)return;C.current=J,Lt.info("rtc:join",{roomId:J});const ue=3,ve=150;let Ae=null,B=null;for(let Q=0;Q<ue&&(Ae=await c(J),!(Ae?.ok||(B=Ae?.error||"rtc_join failed",!/not a member|room not found/i.test(B||"")||Q>=ue-1)));Q++)Lt.warn("rtc:join:retry",{roomId:J,attempt:Q+1,error:B}),await new Promise(Ne=>setTimeout(Ne,ve*(Q+1)));if(!Ae?.ok)throw new Error(B||"rtc_join failed");if(Array.isArray(Ae.iceServers)&&Ae.iceServers.length){const Q=Ih([...j,...Ae.iceServers],j);z.current=Q,kt.current=Date.now(),Q.some(oe=>(Array.isArray(oe.urls)?oe.urls:[oe.urls]).some(pt=>pt.startsWith("turn:")||pt.startsWith("turns:"))),Lt.debug("rtc:ice-servers",{count:Q.length,servers:Q.map(oe=>oe.urls).slice(0,4)})}else z.current=[...j],kt.current=Date.now();if(it(),N&&!P.current){const Q=await ee();Q&&D(Q)}for(const Q of Ae.peers.filter(oe=>oe!==n)){const{pc:oe}=Et(Q);await st(oe);const Ne=h.current.get(Q);await De(Q,oe,Ne)}W(h.current.size)},ur=J=>{!J||C.current&&C.current,Lt.info("rtc:leave",{roomId:J});try{d(J)}catch{}for(const[,ue]of h.current){Mh(ue);try{ue.pc.close()}catch{}}h.current.clear(),W(0),C.current=void 0,G(),_(ue=>(Object.values(ue).forEach(wv),{}));for(const ue of Array.from(Pe.current.keys()))te(ue);A.current?.getTracks()?.forEach(ue=>ue.stop()),P.current?.getTracks()?.forEach(ue=>ue.stop()),A.current=void 0,P.current=void 0,D(void 0),E({})},Er=async(J,ue)=>{},dn=async()=>{i&&await et(!0)};return v.useEffect(()=>{if(!N||!C.current||h.current.size===0)return;const J=async()=>{if(!N||!P.current)return;const ve=P.current.getVideoTracks()[0];if(!((!ve||ve.readyState!=="live")&&(Lt.warn("health:video-track-dead"),P.current=void 0,!await ee()))){for(const[Ae,B]of h.current)if(!pn(B.pc))try{const oe=B.pc.getSenders().find(pt=>pt.track?.kind==="video")?.track,Ne=P.current?.getVideoTracks()[0];Ne&&(!oe||oe.id!==Ne.id)&&(Lt.info("health:reattach-video",{peerId:Ae}),await de(B.pc,P.current),await De(Ae,B.pc,B))}catch(Q){Lt.warn("health:check-failed",{peerId:Ae,err:String(Q)})}}},ue=window.setInterval(J,5e3);return J(),()=>clearInterval(ue)},[N,U]),v.useEffect(()=>{if(!r||!i)return;const J=async()=>{const ue=C.current;if(ue){Lt.info("socket:reconnect:rtc-rejoin",{roomId:ue,peerCount:h.current.size});for(const[,ve]of h.current){Mh(ve);try{ve.pc.close()}catch{}}h.current.clear(),W(0),_(ve=>(Object.values(ve).forEach(wv),{})),E({});try{const ve=await c(ue);if(!ve?.ok){Lt.warn("socket:reconnect:rtc-rejoin-failed",{roomId:ue,error:ve?.error});return}if(Array.isArray(ve.iceServers)&&ve.iceServers.length){const Ae=Ih([...j,...ve.iceServers],j);z.current=Ae,kt.current=Date.now()}for(const Ae of ve.peers.filter(B=>B!==n)){const{pc:B}=Et(Ae);await st(B);const Q=h.current.get(Ae);await De(Ae,B,Q)}W(h.current.size),Lt.info("socket:reconnect:rtc-rejoin-success",{roomId:ue,peerCount:h.current.size})}catch(ve){Lt.error("socket:reconnect:rtc-rejoin-error",{roomId:ue,err:String(ve)})}}};return r.on("connect",J),r.on("reconnect",J),()=>{r.off("connect",J),r.off("reconnect",J)}},[r,i,n,c]),v.useEffect(()=>{const J=A.current?.getAudioTracks?.()[0];x&&J&&A.current?Ce(n,A.current):te(n)},[A.current,n,x]),v.useEffect(()=>{for(const[J,ue]of Object.entries(m))ue?.getAudioTracks().some(Ae=>Ae.enabled)&&Ce(J,ue);for(const J of Pe.current.keys())J!==n&&!m[J]&&te(J)},[m,n]),Ra({onRtcPeerJoined:async({peerId:J})=>{if(Lt.info("sig:peer-joined",{peerId:J}),!(!C.current||J===n))try{const{pc:ue}=Et(J);if(pn(ue))return;await st(ue);const ve=h.current.get(J);ve&&!pn(ue)&&await De(J,ue,ve)}catch(ue){Lt.warn("sig:peer-joined:failed",{peerId:J,err:String(ue)})}},onRtcPeerLeft:({peerId:J})=>{Lt.info("sig:peer-left",{peerId:J});const ue=h.current.get(J);if(ue){Mh(ue),Ve(J);try{ue.pc.close()}catch{}}h.current.delete(J),W(h.current.size),_(ve=>{const Ae={...ve};return wv(Ae[J]),delete Ae[J],Ae}),te(J),E(ve=>{const{[J]:Ae,...B}=ve;return B})},onRtcSignal:async({fromPeerId:J,payload:ue})=>{let ve,Ae;try{ve=Et(J),Ae=ve.pc}catch(B){Lt.warn("sig:getPeer-failed",{fromPeerId:J,err:String(B)});return}if(pn(Ae)){Lt.debug("sig:pc-closed",{fromPeerId:J});return}try{if(ue.sdp){if(Lt.debug("sig:sdp",{fromPeerId:J,type:ue.sdp.type}),pn(Ae))return;const B=ue.sdp;if(B.type==="answer"&&Ct(Ae)){Lt.debug("sig:stale-answer-ignored",{fromPeerId:J,signalingState:Ae.signalingState});return}const Q=Ct(Ae)||ve.isSettingRemoteAnswerPending,oe=B.type==="offer"&&!Q;if(ve.ignoreOffer=!(n<J)&&oe,ve.ignoreOffer||(B.type==="answer"&&(ve.isSettingRemoteAnswerPending=!0),oe&&(pn(Ae)||await Ae.setLocalDescription({type:"rollback"})),pn(Ae)))return;if(await Ae.setRemoteDescription(B),ve.isSettingRemoteAnswerPending=!1,B.type==="offer"&&!pn(Ae)){const Ne=await Ae.createAnswer();if(pn(Ae))return;await Ae.setLocalDescription(Ne),await u(C.current,J,{sdp:Ae.localDescription})}for(;ve.iceBuffer.length&&!pn(Ae);){const Ne=ve.iceBuffer.shift();try{await Ae.addIceCandidate(Ne)}catch{}}}else if(ue.ice){if(Lt.debug("sig:ice",{fromPeerId:J,hasRemote:!!Ae.remoteDescription}),pn(Ae))return;const B=ue.ice;if(Ae.remoteDescription)try{await Ae.addIceCandidate(B)}catch{}else ve.iceBuffer.push(B)}}catch(B){const Q=String(B);Lt.error("sig:error",{fromPeerId:J,err:Q}),(Q.includes("order of m-lines")||Q.includes("m-line")||Q.includes("InvalidAccessError"))&&(Lt.warn("sig:mline-mismatch-rebuild",{fromPeerId:J}),await nt(J))}},onRtcVideoEnabled:({playerId:J,enabled:ue})=>{Lt.debug("sig:video-enabled",{playerId:J,enabled:ue}),E(ve=>({...ve,[J]:!!ue}))}}),v.useEffect(()=>{let J=!0;return(async()=>{try{const ue=await au();if(!J)return;L(!1),n&&E(ve=>({...ve,[n]:!1})),R(i?!!ue.chatAudio:!1)}catch{}})(),()=>{J=!1}},[n,i]),v.useEffect(()=>{i||(R(!1),N&&o("auth:lost"),L(!1),n&&E(J=>({...J,[n]:!1})),(async()=>{for(const[J,ue]of h.current)await Re(ue.pc,void 0),await de(ue.pc,void 0),await De(J,ue.pc,ue).catch(()=>{})})(),ce(),he())},[i,n]),v.useEffect(()=>{const J=ue=>{const ve=ue.detail;ve&&(typeof ve.video=="boolean"&&ve.video===!1&&(L(!1),E(Ae=>({...Ae,[n]:!1}))),typeof ve.chatAudio=="boolean"&&R(ve.chatAudio))};return window.addEventListener("app:settings",J),()=>window.removeEventListener("app:settings",J)},[n]),v.useEffect(()=>{const J=()=>{if(document.visibilityState==="visible")for(const[Ae,B]of h.current)bt(Ae,B)},ue=()=>{for(const[Ae,B]of h.current)bt(Ae,B)},ve=()=>{for(const[Ae,B]of h.current)bt(Ae,B)};return document.addEventListener("visibilitychange",J),window.addEventListener("online",ue),window.addEventListener("offline",ve),()=>{document.removeEventListener("visibilitychange",J),window.removeEventListener("online",ue),window.removeEventListener("offline",ve)}},[]),v.useEffect(()=>{try{const J=window;J.__rtcCtxInternal||(J.__rtcCtxInternal={}),J.__rtcCtxInternal.peers=h.current,J.__rtcCtxInternal.myVideoRef=P,J.__rtcCtxInternal.videoEnabledState={current:N}}catch{}},[N,T,U]),g.jsx(hq.Provider,{value:{videoEnabled:N,setVideoEnabled:et,enableCamera:dn,joinRtc:lr,leaveRtc:ur,cameraOwnerId:w,setCameraOwner:Er,remoteStreams:m,myVideo:T,micEnabled:x,setMicEnabled:at,hasVideo:ke,speaking:Ge,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 mq=v.createContext(null),ji=()=>v.useContext(mq),_E={};function Nfe({children:t}){const{user:e,meId:r}=Vr(),n=r||e?.id,{resetSpin:a}=Qo(),i=tn(),{joinRoom:o,leaveRoom:c,setSpectate:u,pokerJoinRoom:d,getRoomsList:f}=ma(),[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?.(),z=(L&&(Array.isArray(L?.rooms)?L.rooms:Array.isArray(L?.data?.rooms)?L.data.rooms:[])||[]).find(U=>U?.id===R);z&&Array.isArray(z.players)&&m(U=>!U||U.id!==R?U:{...U,players:z.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(),z=n||"e2e-user",U=e?.name||"E2E User",W={id:R,name:"E2E Room",gameMode:"craps",createdAt:j,updatedAt:j,bankerId:"bank",players:[{id:z,name:U,isReady:!0,balance:1e3},{id:"bank",name:"Bank",isReady:!0,balance:1e6}],gameState:{gameMode:"craps",crapsPoint:null,currentRollerId:z,turnOrder:[z],roundSeq:1,crapsPassBets:[{playerId:z,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 z;if(j.length===0&&L.length>0)z=L;else if(L.length===0)z=j;else{const U=new Map(L.map(q=>[String(q.id),q])),W=new Map(j.map(q=>[String(q.id),q]));z=L.map(q=>W.get(String(q.id))||q);for(const[q,Y]of W.entries())U.has(q)||z.push(Y)}return{...R,...N,players:z}}catch{return N||R}},[]);Ra({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 z=P(j,R);try{const U=Array.isArray(R?.players)?R?.players:Array.isArray(z?.players)?z.players:[],W=String(n||"");if(!(W&&U.some(Y=>String(Y?.id)===W))&&j){if(!!(R?.singlePlayer||z?.singlePlayer))return z;const Z=String(j.id||""),ae=b.current[Z]||0,G=Date.now();return ae?G-ae<1500?z:(N=!0,L=String(j.id),delete b.current[Z],null):(b.current[Z]=G,z)}}catch{}return z}),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 z=j.players.map(U=>U.id!==R?U:{...U,...N!==void 0&&{name:N},...L!==void 0&&{avatarUrl:L}});return{...j,players:z}})},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])),z=N.players.map(U=>j.get(U.id)||U);for(const[U,W]of j.entries())L.has(U)||z.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:z}}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 z=Array.isArray(L?.players)?L.players:[];let U=!1,W=null;if(m(q=>{const Y=Z=>{if(!z.length)return Z;const ae=new Map(Z.map(G=>[G.id,G]));for(const G of z){const F=ae.get(G.id);F?ae.set(G.id,{...F,...G}):ae.set(G.id,G)}return Array.from(ae.values())};try{if(z.length&&q&&q.id===R){const Z=String(n||"");if(Z&&!z.some(G=>String(G?.id)===Z)){if(!!(L?.singlePlayer||q?.singlePlayer))return{...q,players:Y(q.players),gameState:j};const F=String(q.id||""),K=b.current[F]||0,ne=Date.now();return K?ne-K<1500?{...q,players:Y(q.players),gameState:j}:(U=!0,W=String(q.id),delete b.current[F],null):(b.current[F]=ne,{...q,players:Y(q.players),gameState:j})}}}catch{}return q&&q.id===R?{...q,players:Y(q.players),gameState:j}:q||{id:R,players:z,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 z=L.players[j];if(typeof z?.balance=="number"&&z.balance===N)return L;const U=L.players.slice();return U[j]={...z,balance:N},{...L,players:U}})},onError:R=>{try{const N=Hv?.()||[],L=Date.now(),j=[...N].filter(z=>L-z.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=ws(),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 z=_E[N];if(z)j=await z;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 z=await f?.(),W=(z&&(Array.isArray(z?.rooms)?z.rooms:Array.isArray(z?.data?.rooms)?z.data.rooms:[])||[]).find(q=>q?.id===N);W&&Array.isArray(W.players)&&m(q=>!q||q.id!==N?q:{...q,players:W.players})}catch{}}}catch{}},[h?.id,d,o,a,w,f]);return v.useEffect(()=>{if(!C)return;const R=z=>{z!=="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(mq.Provider,{value:A,children:t})}const Sv=globalThis.__lastWagersFetchAt||(globalThis.__lastWagersFetchAt={}),ZM=500;function v0(t,e){const r=ws(),{room:n}=ji(),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 te=await Xf(a);if(!te?.mainWagerId)return;o(H=>H.open.some(Re=>Re.type==="MAIN"&&Re.playerId===e)?H:{...H,roundSeq:te.roundSeq||H.roundSeq,open:[...H.open,{id:te.mainWagerId,type:"MAIN",playerId:e,acceptedById:null,amount:0,roundSeq:te.roundSeq}]})}catch{}})()},[a,e]),v.useEffect(()=>{a&&(async()=>{try{const te=await Xf(a);if(!te)return;te?.mainWagerId&&o(H=>H.open.some(Re=>Re.type==="MAIN"&&Re.playerId===e)?H:{...H,roundSeq:te.roundSeq||H.roundSeq,open:[...H.open,{id:te.mainWagerId,type:"MAIN",playerId:e,acceptedById:null,amount:0,roundSeq:te.roundSeq}]})}catch{}})()},[a,e]);const{getWagers:c,createSideBet:u,cancelSideBet:d,acceptSideBet:f,placeMainBet:h,cancelMainBet:m}=ma(),[_,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]),Ra({onBetsUpdated:te=>{a&&(async()=>{try{const de=te.open.find(Ie=>Ie.type==="MAIN"&&Ie.playerId===e);de?await Ab(a,{roundSeq:te.roundSeq,mainWagerId:de.id}):await Jf(a)}catch{}})(),o(te);const H=te.settled.filter(de=>de.roundSeq===te.roundSeq);w(H.filter(de=>!b.current.has(de.id)));const Re=(te.open||[]).filter(de=>de.type==="SIDE"&&!de.acceptedById&&de.playerId!==e&&de.subjectId!==e).filter(de=>!E.current.has(de.id));D(Re.length)}});const[A,C]=v.useState([]);v.useEffect(()=>{C([])},[t]),v.useEffect(()=>{const te=Array.isArray(i.settledAll)?i.settledAll:[];te.length===0&&A.length===0||C(H=>{if(te.length===0)return H;const pe=new Map;for(const de of H)pe.set(de.id,de);for(const de of te)pe.set(de.id,de);return Array.from(pe.values()).sort((de,Ie)=>{const ct=Number(de.roundSeq||0),Ve=Number(Ie.roundSeq||0);return Ve!==ct?Ve-ct:String(Ie.id).localeCompare(String(de.id))})})},[i.settledAll]),v.useEffect(()=>{if(!t)return;let te=null;const H=()=>{const Re=Date.now(),de=Sv[t]||0;Re-de<ZM||(Sv[t]=Re,te=window.setTimeout(()=>{try{c(t)}catch{}},300))};if(n?.id===t)return H(),()=>{te&&clearTimeout(te)};const pe=window.setTimeout(()=>{H()},500);return()=>{te&&clearTimeout(te),clearTimeout(pe)}},[t,n?.id,c]),v.useEffect(()=>{if(!r)return;const te={current:0},H=()=>{if(!t||n?.id!==t)return;const pe=Date.now();if(!(pe-te.current<400)&&!(pe-(Sv[t]||0)<ZM)){te.current=pe,Sv[t]=pe;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(te=>te.type==="MAIN"),[i.openAll]),I=v.useMemo(()=>i.open.find(te=>te.type==="MAIN"&&te.playerId===e),[i.open,e]),x=v.useMemo(()=>i.openAll?.filter(te=>te.type==="SIDE"),[i.openAll,e]),R=v.useMemo(()=>i.open.filter(te=>te.type==="SIDE"&&(te.playerId===e||te.acceptedById===e)),[i.open,e]),N=v.useMemo(()=>i.settled.filter(te=>te.playerId===e||te.acceptedById===e),[i.settled,e]);v.useMemo(()=>A.filter(te=>te.playerId===e||te.acceptedById===e),[A,e]);const L=v.useMemo(()=>i.open.filter(te=>te.playerId===e||te.acceptedById===e).reduce((te,H)=>te+(H.amount||0),0),[i.open,e]),[j,z]=v.useState([]);v.useEffect(()=>{const te=setTimeout(()=>{z(A.filter(H=>H.playerId===e||H.acceptedById===e))},ca.mySettledDelayMs);return()=>clearTimeout(te)},[A,e]);const[U,W]=v.useState(null);v.useEffect(()=>{const te=setTimeout(()=>{W(i.playerBalance)},ca.balanceDelayMs);return()=>clearTimeout(te)},[i.playerBalance]);const[q,Y]=v.useState([]);v.useEffect(()=>{const te=setTimeout(()=>{Y(A)},ca.settledAllDelayMs);return()=>clearTimeout(te)},[A]);const Z=v.useMemo(()=>i.open.filter(te=>te.type==="SIDE"&&!te.acceptedById&&te.subjectId!==e&&te.playerId!==e),[i.open,e]),ae=()=>w(te=>{if(te.length===0)return te;const[H,...pe]=te;return b.current.add(H.id),pe}),G=te=>w(H=>(b.current.add(te),H.filter(pe=>pe.id!==te))),F=v.useCallback(()=>{for(const te of Z)E.current.add(te.id);D(0)},[Z]),K=v.useCallback(async te=>{try{const H=await u(t,{amount:Math.floor(te.amount),subjectId:te.subjectId,predicate:te.predicate,oddsBp:te.oddsBp});return H?.ok?{ok:!0,betId:H?.wager?.id||H?.id||te.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]),ne=v.useCallback(async te=>{try{const H=await d(t,te);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]),ee=v.useCallback(async te=>{try{const H=await f(t,te);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]),he=v.useCallback(async te=>{try{const H=await h(t,Math.floor(te));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]),ce=v.useCallback(async te=>{try{const H=await m(t,te);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]),[Pe,Ge]=v.useState([]),se=v.useRef(i.roundSeq),Ce=v.useRef(new Set);return v.useEffect(()=>{se.current!==i.roundSeq&&(se.current=i.roundSeq,Ce.current.clear(),Ge([]));const te=i.settledAll.filter(H=>H.roundSeq===i.roundSeq&&!Ce.current.has(H.id));if(te.length>0){te.forEach(pe=>Ce.current.add(pe.id)),Ge(te);const H=setTimeout(()=>Ge([]),1e3);return()=>clearTimeout(H)}},[i.settledAll,i.roundSeq]),{roundSeq:i.roundSeq,openAll:i.openAll,open:i.open,settled:i.settled,settledAll:q,myOpenMain:I,myOpenSides:R,openAllMain:O,openAllSides:x,mySettledThisRound:N,mySettledAll:j,myExposure:L,unseenSettledWagers:_,consumeNextUnseen:ae,markAsSeen:G,offersToMe:Z,newOfferCount:T,markOffersAsSeen:F,placeSideBet:K,cancelSideBet:ne,acceptSideBet:ee,placeMainBet:he,cancelMainBet:ce,playerBalance:U,newSettlements:Pe}}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,z=m(P,function(U,W){if(d(U))return a.formatColumn(U,R);U=b(U);var q=U>0?N.pos:U<0?N.neg:N.zero,Y=q.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(z,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 gq({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 yq=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={},vq=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function _q(t){return typeof t=="object"&&t!==null}const bq=t=>/^0[^.\s]+$/u.test(t);function lA(t){let e;return()=>(e===void 0&&(e=t()),e)}const ms=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 $o=t=>t*1e3,ps=t=>t/1e3;function kq(t,e){return e?t*(1e3/e):0}const wq=(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=wq(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 ms;const a=i=>Vfe(i,0,1,t,r);return i=>i===0||i===1?i:wq(a(i),e,n)}const Sq=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Eq=t=>e=>1-t(1-e),Tq=$g(.33,1.53,.69,.99),dA=Eq(Tq),Cq=Sq(dA),xq=t=>(t*=2)<1?.5*dA(t):.5*(2-Math.pow(2,-10*(t-1))),fA=t=>1-Math.sin(Math.acos(t)),Pq=Eq(fA),Aq=Sq(fA),Hfe=$g(.42,0,1,1),Gfe=$g(0,0,.58,1),Rq=$g(.42,0,.58,1),Wfe=t=>Array.isArray(t)&&typeof t[0]!="number",Dq=t=>Array.isArray(t)&&typeof t[0]=="number",Kfe={linear:ms,easeIn:Hfe,easeInOut:Rq,easeOut:Gfe,circIn:fA,circInOut:Aq,circOut:Pq,backIn:dA,backInOut:Cq,backOut:Tq,anticipate:xq},Yfe=t=>typeof t=="string",nj=t=>{if(Dq(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 Oq(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:En,cancel:iu,state:Ea,steps:bE}=Oq(typeof requestAnimationFrame<"u"?requestAnimationFrame:ms,!0);let y_;function Qfe(){y_=void 0}const fi={now:()=>(y_===void 0&&fi.set(Ea.isProcessing||Gc.useManualTiming?Ea.timestamp:performance.now()),y_),set:t=>{y_=t,queueMicrotask(Qfe)}},Nq=t=>e=>typeof e=="string"&&e.startsWith(t),pA=Nq("--"),Zfe=Nq("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)),Iq=(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:Iq("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"),Vo=Vg("%"),Qt=Vg("px"),ipe=Vg("vh"),spe=Vg("vw"),aj={...Vo,parse:t=>Vo.parse(t)/100,transform:t=>Vo.transform(t*100)},Pf={test:gA("hsl","hue"),parse:Iq("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:r,alpha:n=1})=>"hsla("+Math.round(t)+", "+Vo.transform(vm(e))+", "+Vo.transform(vm(r))+", "+vm(Xm.transform(n))+")"},Yn={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=Yn.parse(t);return e.alpha=0,Yn.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 Mq="number",jq="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=>(Yn.test(u)?(n.color.push(i),a.push(jq),r.push(Yn.parse(u))):u.startsWith(upe)?(n.var.push(i),a.push(lpe),r.push(u)):(n.number.push(i),a.push(Mq),r.push(parseFloat(u))),++i,ij)).split(ij);return{values:r,split:c,indexes:n,types:a}}function Lq(t){return Jm(t).values}function Bq(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===Mq?i+=vm(a[o]):c===jq?i+=Yn.transform(a[o]):i+=a[o]}return i}}const fpe=t=>typeof t=="number"?0:Yn.test(t)?Yn.getAnimatableNone(t):t;function ppe(t){const e=Lq(t);return Bq(t)(e.map(fpe))}const su={test:cpe,parse:Lq,createTransformer:Bq,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 Cn=(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=Cn(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=>Cn(t,e,r)}function yA(t){return typeof t=="number"?vpe:typeof t=="string"?hA(t)?gb:Yn.test(t)?oj:kpe:Array.isArray(t)?Uq:typeof t=="object"?Yn.test(t)?oj:_pe:gb}function Uq(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(Uq(bpe(n,a),a.values),r):gb(t,e)};function Fq(t,e,r){return typeof t=="number"&&typeof e=="number"&&typeof r=="number"?Cn(t,e,r):yA(t)(t,e)}const wpe=t=>{const e=({timestamp:r})=>t(r);return{start:(r=!0)=>En.update(e,r),stop:()=>iu(e),now:()=>Ea.isProcessing?Ea.timestamp:fi.now()}},qq=(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:ps(a)}}const Epe=5;function zq(t,e,r){const n=Math.max(e-Epe,0);return kq(r-t(n),e-n)}const Dn={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=Dn.duration,bounce:e=Dn.bounce,velocity:r=Dn.velocity,mass:n=Dn.mass}){let a,i,o=1-e;o=Hc(Dn.minDamping,Dn.maxDamping,o),t=Hc(Dn.minDuration,Dn.maxDuration,ps(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=$o(t),isNaN(u))return{stiffness:Dn.stiffness,damping:Dn.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:Dn.velocity,stiffness:Dn.stiffness,damping:Dn.damping,mass:Dn.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:Dn.mass,stiffness:a,damping:i}}else{const r=Tpe(t);e={...e,...r,mass:Dn.mass},e.isResolvedFromDuration=!0}return e}function vb(t=Dn.visualDuration,e=Dn.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:-ps(r.velocity||0)}),w=m||0,b=d/(2*Math.sqrt(u*f)),E=o-i,T=ps(Math.sqrt(u/f)),D=Math.abs(E)<5;n||(n=D?Dn.restSpeed.granular:Dn.restSpeed.default),a||(a=D?Dn.restDelta.granular:Dn.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?$o(w):zq(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=qq(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=$o(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:zq(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||Fq,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]||ms: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(Cn(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||Rq).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 $q(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!==fi.now()&&this.tick(fi.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;$q(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,Fq(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 ps(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+ps(e)}get time(){return ps(this.currentTime)}set time(e){e=$o(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(fi.now());const r=this.playbackSpeed!==e;this.playbackSpeed=e,r&&(this.time=ps(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(fi.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===Qt,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 Vq(){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 Hq(){ad.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(BC=!0)})}function Kpe(){UC=!0,Hq(),Vq(),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,En.read(Hq),En.resolveKeyframes(Vq))):(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 Gq=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 Wq(t,e){if(t)return typeof t=="function"?Gq()?qq(t,e):"ease-out":Dq(t)?Zh(t):Array.isArray(t)?t.map(r=>Wq(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=Wq(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 Kq(t){return typeof t=="function"&&"applyToOptions"in t}function the({type:t,...e}){return Kq(t)&&Gq()?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 ps(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+ps(e)}get time(){return ps(Number(this.animation.currentTime)||0)}set time(e){this.finishedTime=null,this.animation.currentTime=$o(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,ms):r(this)}}const Yq={anticipate:xq,backInOut:Cq,circInOut:Aq};function nhe(t){return t in Yq}function ahe(t){typeof t.ease=="string"&&nhe(t.ease)&&(t.ease=Yq[t.ease])}const hj=10;class ihe extends rhe{constructor(e){ahe(e),$q(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=$o(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"||Kq(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=fi.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=fi.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(ms),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 Xq(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 vq(o)?parseFloat(o):o}return hA(a)?Xq(a,e,r+1):a}function SA(t,e){return t?.[e]??t?.default??t}const Jq=new Set(["width","height","top","left","right","bottom",...Np]),mhe={test:t=>t==="auto",parse:t=>t},Qq=t=>e=>e.test(t),Zq=[Op,Qt,Vo,xl,spe,ipe,mhe],gj=t=>Zq.find(Qq(t));function ghe(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||bq(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:Qt,translateX:Qt,translateY:Qt,translateZ:Qt,x:Qt,y:Qt,z:Qt,perspective:Qt,transformPerspective:Qt,opacity:Xm,originX:aj,originY:aj,originZ:Qt},EA={borderWidth:Qt,borderTopWidth:Qt,borderRightWidth:Qt,borderBottomWidth:Qt,borderLeftWidth:Qt,borderRadius:Qt,radius:Qt,borderTopLeftRadius:Qt,borderTopRightRadius:Qt,borderBottomRightRadius:Qt,borderBottomLeftRadius:Qt,width:Qt,maxWidth:Qt,height:Qt,maxHeight:Qt,top:Qt,right:Qt,bottom:Qt,left:Qt,padding:Qt,paddingTop:Qt,paddingRight:Qt,paddingBottom:Qt,paddingLeft:Qt,margin:Qt,marginTop:Qt,marginRight:Qt,marginBottom:Qt,marginLeft:Qt,backgroundPositionX:Qt,backgroundPositionY:Qt,...bhe,zIndex:yj,fillOpacity:Xm,strokeOpacity:Xm,numOctaves:yj},khe={...EA,color:Yn,backgroundColor:Yn,outlineColor:Yn,fill:Yn,stroke:Yn,borderColor:Yn,borderTopColor:Yn,borderRightColor:Yn,borderBottomColor:Yn,borderLeftColor:Yn,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=Xq(d,r.current);f!==void 0&&(e[u]=f),u===e.length-1&&(this.finalKeyframe=d)}}if(this.resolveNoneKeyframes(),!Jq.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 _q(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=fi.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=fi.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(),En.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=fi.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>vj)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,vj);return kq(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}=Oq(queueMicrotask,!1),Us={x:!1,y:!1};function nz(){return Us.x||Us.y}function Ahe(t){return t==="x"||t==="y"?Us[t]?null:(Us[t]=!0,()=>{Us[t]=!1}):Us.x||Us.y?null:(Us.x=Us.y=!0,()=>{Us.x=Us.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 _q(t)&&"ownerSVGElement"in t}function Mhe(t){return sz(t)&&t.tagName==="svg"}const Ba=t=>!!(t&&t.getVelocity),jhe=[...Zq,Yn,su],Lhe=t=>jhe.find(Qq(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)!Ba(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]=Qt.transform(-n);const o=Qt.transform(e),c=Qt.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(()=>Ba(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 Ba(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)(Ba(n[i])||e.style&&Ba(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(Ba(t[a])||Ba(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(yq).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=Cn(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(Ba(a))t.addValue(n,a);else if(Ba(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=fi.now();this.renderScheduledAt<m&&(this.renderScheduledAt=m,En.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&&Ba(_)&&_.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&&En.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"&&(vq(n)||bq(n))?n=parseFloat(n):!Lhe(n)&&su.test(r)&&(n=tz(e,r)),this.setBaseTarget(e,Ba(n)?n.get():n)),Ba(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&&!Ba(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;Ba(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!!(Ba(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-$o(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=$o(f.duration)),f.repeatDelay&&(f.repeatDelay=$o(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){En.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,En);D!==null&&(_.startTime=D,b=!0)}}HC(t,f),h.start(jA(f,h,m,t.shouldReduceMotion&&Jq.has(f)?{type:!1}:_,t,b));const E=h.animation;E&&u.push(E)}return o&&Promise.all(u).then(()=>{En.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,z={...j,...L},U=Y=>{x=!0,m.has(Y)&&(R=!0,m.delete(Y)),D.needsAnimating[Y]=!0;const Z=t.getValue(Y);Z&&(Z.liveStyle=!1)};for(const Y in z){const Z=L[Y],ae=j[Y];if(_.hasOwnProperty(Y))continue;let G=!1;VC(Z)&&VC(ae)?G=!Oz(Z,ae):G=Z!==ae,G?Z!=null?U(Y):m.add(Y):Z!==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 Z={type:T};if(typeof Y=="string"&&n&&!W&&t.manuallyAnimateOnMount&&t.parent){const{parent:ae}=t,G=Kf(ae,Y);if(ae.enteringChildren&&G){const{delayChildren:F}=G.transition||{};Z.delay=Dz(ae.enteringChildren,t,F)}}return{animation:Y,options:Z}}))}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 Wa(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=Cn(e.min,e.max,t.origin),t.scale=Wa(r)/Wa(e),t.translate=Cn(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+Wa(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+Wa(e)}function wm(t,e,r){jj(t.x,e.x,r.x),jj(t.y,e.y,r.y)}function as(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}=Ea;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),En.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}=Ea;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>$o(e)));)r--;if(!n)return{x:0,y:0};const i=ps(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?Cn(e,t,n.min):Math.max(t,e):r!==void 0&&t>r&&(t=n?Cn(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=Wa(t),a=Wa(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),as(T=>{let D=this.getAxisMotionValue(T).get()||0;if(Vo.test(D)){const{projection:P}=this.visualElement;if(P&&P.layout){const A=P.layout.layoutBox[T];A&&(D=Wa(A)*(parseFloat(D)/100))}}this.originPoint[T]=D}),b&&En.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=()=>as(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&&En.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&&as(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=as(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(){as(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){as(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){as(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]-Cn(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};as(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(),as(o=>{if(!xv(o,e,null))return;const c=this.getAxisMotionValue(o),{min:u,max:d}=this.constraints[o];c.set(Cn(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()),En.read(n);const o=eg(window,"resize",()=>this.scalePositionWithinConstraints()),c=a.addEventListener("didUpdate",(({delta:u,hasLayoutChanged:d})=>{this.isDragging&&d&&(as(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=ms,this.removeListeners=ms,this.controls=new yge(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||ms}unmount(){this.removeGroupControls(),this.removeListeners()}}const $j=t=>(e,r)=>{t&&En.postRender(()=>t(e,r))};class bge extends yu{constructor(){super(...arguments),this.removePointerDownListener=ms}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&&En.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(Qt.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=Cn(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()||En.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(yq);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=Ba(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=fi.now(),n=({timestamp:a})=>{const i=a-r;i>=e&&(iu(n),t(i-e))};return En.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"||Qt.test(t);function Age(t,e,r,n,a,i){a?(t.opacity=Cn(0,r.opacity??1,Rge(n)),t.opacityExit=Cn(e.opacity??1,0,Dge(n))):i&&(t.opacity=Cn(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(Cn(Hj(u),Hj(d),n),0),(Vo.test(d)||Vo.test(u))&&(t[c]+="%")):t[c]=d}(e.rotate||r.rotate)&&(t.rotate=Cn(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,Pq),Dge=qz(.5,.95,ms);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 rs(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(Vo.test(e)&&(e=parseFloat(e),e=Cn(o.min,o.max,e/100)-o.min),typeof e!="number")return;let c=Cn(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 Wa(t.x)/Wa(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",En,!(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;En.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=fi.now();Ea.delta=Hc(0,1e3/60,c-Ea.timestamp),Ea.timestamp=c,Ea.isProcessing=!0,bE.update.process(Ea),bE.preRender.process(Ea),bE.render.process(Ea),Ea.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,En.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){En.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Wa(this.snapshot.measuredBox.x)&&!Wa(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(rs(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&&rs(c,o),Rf(c.x,f.offset.x),Rf(c.y,f.offset.y))}return c}applyTransform(o,c=!1){const u=jn();rs(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();rs(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();rs(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!==Ea.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=Ea.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),rs(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):rs(this.target,this.layout.layoutBox),Sz(this.target,this.targetDelta)):rs(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),rs(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===Ea.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;rs(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()),rs(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=En.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=Wa(this.layout.layoutBox.x);u.x.min=o.target.x.min,u.x.max=u.x.min+h;const m=Wa(this.layout.layoutBox.y);u.y.min=o.target.y.min,u.y.max=u.y.min+m}rs(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"?as(f=>{const h=i?e.measuredBox[f]:e.layoutBox[f],m=Wa(h);h.min=r[f].min,h.max=h.min+m}):Gz(a,e.layoutBox,r)&&as(f=>{const h=i?e.measuredBox[f]:e.layoutBox[f],m=Wa(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=Cn(e.translate,0,r),t.scale=Cn(e.scale,1,r),t.origin=e.origin,t.originPoint=e.originPoint}function cL(t,e,r,n){t.min=Cn(e.min,r.min,n),t.max=Cn(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:ms;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&&En.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&&En.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},Xs=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 VSe={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 Js({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(Xs.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(Js,{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(()=>{rr("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]),z=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(Xs.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(Xs.div,{role:"option","aria-selected":W,variants:C?void 0:_ye,layout:!0,className:"chipRack__chipWrapper",children:g.jsx(Js,{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(Xs.div,{children:g.jsx(YC,{onClick:z,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,Lr(),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 se=setTimeout(()=>L(!1),5e3);return()=>clearTimeout(se)},[N,I]);const j=!A&&!I&&!N,z=c?.handleRoll??(()=>{}),U=!!c?.canRoll;c?.lastRollerId;const W=c?.diceSettled??!0,q=o?.betsLocked??!1;o?.roundSeq;const Y=!!o?.bankRoll,Z=Y,[ae,G]=v.useState(!1),F=v.useRef(q),K=v.useRef(null);v.useEffect(()=>(F.current&&!q&&(G(!0),K.current&&window.clearTimeout(K.current),K.current=window.setTimeout(()=>{G(!1),K.current=null},3e3)),q&&K.current&&(window.clearTimeout(K.current),K.current=null,G(!1)),F.current=q,()=>{K.current&&window.clearTimeout(K.current)}),[q]);const ne=v.useCallback(async()=>{try{Lr()}catch{}if(w)return;const se=Math.floor(h);if(se<=0){D.info("Tap chips to add a bet amount.");return}if(!Y){if(q||Z){D.info("Bets are closed.");return}if(o?.spectators?.includes(e)){D.info("Exit spectate to place a bet.");return}try{b(!0);const Ce=await x(se);if(!Ce?.ok){D.error(Ce?.error||"Bet rejected");return}L(!0)}catch{}finally{b(!1)}}},[w,h,i,q,Z,o,x]),ee=v.useCallback(async()=>{try{Lr()}catch{}if(I)try{const se=await R(I.id);se.ok||D.error(se.error||"Failed to cancel bet")}catch(se){D.error(se?.message??"Failed to cancel bet")}},[R,I,D]),ce=(o?.spectators??[]).includes(e),Pe=w||ce||Z||q||N,{triggerSpin:Ge}=Qo();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||ce,busy:!W,onClick:z,onPressStart:Ge,"data-testid":"roll-button"})}),!A&&g.jsx("div",{className:"betpanel__row",children:g.jsx(w0,{mainAmt:h,selectedTimes:f,onAdd:m,onClear:_,onPlaceBet:ne,onCancelBet:ee,disabled:Pe,collapsed:!j,betTokenProps:{isBanker:A,meId:e,open:C,players:n,show:!j},hasBankRoll:Y,betsLocked:q||ae,myOpenMain:I})})]}),E&&g.jsx(gq,{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_4v8i4_1",xye="_crapsPlaceTile_4v8i4_80",Pye="_mobileShow_4v8i4_101",Aye="_mobileHide_4v8i4_105",Rye="_spotBtn_4v8i4_132",Dye="_spotRow_4v8i4_145",Oye="_actions_4v8i4_157",Nye="_actionBtn_4v8i4_161",Iye="_amountBadge_4v8i4_167",Mye="_badgeMinus_4v8i4_174",jye="_crapsStatusBar_4v8i4_185",Lye="_crapsStatusText_4v8i4_191",Bye="_crapsHighlight_4v8i4_199",Uye="_crapsPlaceRow_4v8i4_216",Fye="_crapsBetTile_4v8i4_227",qye="_crapsActionsBar_4v8i4_235",zye="_crapsActionButton_4v8i4_239",$ye="_crapsActionButtonPrimary_4v8i4_244",Vye="_crapsActionButtonSecondary_4v8i4_245",Hye="_crapsMainBets_4v8i4_251",Gye="_disabled_4v8i4_321",Wye="_spotBtnTopRow_4v8i4_507",Kye="_lineWin_4v8i4_558",Yye="_lineLose_4v8i4_563",Xye="_linePush_4v8i4_568",Jye="_outcomeBadge_4v8i4_573",Qye="_locked_4v8i4_587",Zye="_amountBadgeDisabled_4v8i4_615",eve="_lockIcon_4v8i4_621",tve="_aggBadge_4v8i4_661",rve="_rollBtn_4v8i4_877",nve="_rollIcon_4v8i4_884",ave="_clear_4v8i4_910",ive="_errorLive_4v8i4_927",sve="_tooltip_4v8i4_935",ove="_betInfoBtn_4v8i4_959",cve="_betInfoModalOverlay_4v8i4_987",lve="_betInfoModal_4v8i4_987",uve="_betInfoHeader_4v8i4_1021",dve="_betInfoClose_4v8i4_1037",fve="_betInfoContent_4v8i4_1058",pve="_betInfoItem_4v8i4_1066",hve="_shake_4v8i4_1152",mve="_attnHalo_4v8i4_1200",gve="_crapsAtsLabel_4v8i4_1345",yve="_crapsIronCrossBtn_4v8i4_1365",vve="_crapsMinusBadge_4v8i4_1459",_ve="_crapsClearIcon_4v8i4_1701",bve="_particle_4v8i4_1735",kve="_particleContainer_4v8i4_1741",wve="_floatingWinAmount_4v8i4_1791",Sve="_rollHaloActive_4v8i4_1851",Eve="_chipPickerWrapper_4v8i4_2200",Tve="_chipPickerToggle_4v8i4_2205",Cve="_chipPickerToggleOpen_4v8i4_2245",xve="_chipPickerChip_4v8i4_2255",Pve="_chipPickerDropdown_4v8i4_2259",Ave="_chipPickerOption_4v8i4_2281",Rve="_chipPickerOptionSelected_4v8i4_2290",Dve="_chipPickerChipSelected_4v8i4_2294",Ove="_crapsAtsSection_4v8i4_2314",ut={panelRoot:Cye,crapsPlaceTile:xye,mobileShow:Pye,mobileHide:Aye,spotBtn:Rye,spotRow:Dye,actions:Oye,actionBtn:Nye,amountBadge:Iye,badgeMinus:Mye,crapsStatusBar:jye,crapsStatusText:Lye,crapsHighlight:Bye,crapsPlaceRow:Uye,crapsBetTile:Fye,crapsActionsBar:qye,crapsActionButton:zye,crapsActionButtonPrimary:$ye,crapsActionButtonSecondary:Vye,crapsMainBets:Hye,disabled:Gye,spotBtnTopRow:Wye,lineWin:Kye,lineLose:Yye,linePush:Xye,outcomeBadge:Jye,locked:Qye,amountBadgeDisabled:Zye,lockIcon:eve,aggBadge:tve,rollBtn:rve,rollIcon:nve,clear:ave,errorLive:ive,tooltip:sve,betInfoBtn:ove,betInfoModalOverlay:cve,betInfoModal:lve,betInfoHeader:uve,betInfoClose:dve,betInfoContent:fve,betInfoItem:pve,shake:hve,attnHalo:mve,crapsAtsLabel:gve,crapsIronCrossBtn:yve,crapsMinusBadge:vve,crapsClearIcon:_ve,particle:bve,particleContainer:kve,floatingWinAmount:wve,rollHaloActive:Sve,chipPickerWrapper:Eve,chipPickerToggle:Tve,chipPickerToggleOpen:Cve,chipPickerChip:xve,chipPickerDropdown:Pve,chipPickerOption:Ave,chipPickerOptionSelected:Rve,chipPickerChipSelected:Dve,crapsAtsSection:Ove};/*!
 * 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 Nve={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"]},Ive={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 Mve={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 jve({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:ut.betInfoModalOverlay,role:"presentation",children:g.jsxs("div",{className:ut.betInfoModal,role:"dialog","aria-modal":"true","aria-label":"Craps Bet Guide",ref:r,children:[g.jsxs("div",{className:ut.betInfoHeader,children:[g.jsx("h3",{children:"Craps Bet Guide"}),g.jsx("button",{className:ut.betInfoClose,onClick:e,"aria-label":"Close",children:"✕"})]}),g.jsx("div",{className:ut.betInfoContent,children:Object.entries(Mve).map(([a,{title:i,description:o}])=>g.jsxs("div",{className:ut.betInfoItem,children:[g.jsx("strong",{children:i}),g.jsx("p",{children:o})]},a))})]})});return Wc.createPortal(n,document.body)}const Lve="_atsProgressContainer_bok0p_3",Bve="_inline_bok0p_15",Uve="_atsSection_bok0p_25",Fve="_complete_bok0p_42",qve="_justCompleted_bok0p_47",zve="_atsSectionAll_bok0p_66",$ve="_atsSectionHeader_bok0p_75",Vve="_atsSectionLabel_bok0p_84",Hve="_atsSectionCount_bok0p_97",Gve="_atsNumberRow_bok0p_107",Wve="_atsNumber_bok0p_107",Kve="_hit_bok0p_138",Yve="_atsCompleteText_bok0p_160",Xve="_atsLockedBadge_bok0p_181",Xr={atsProgressContainer:Lve,inline:Bve,atsSection:Uve,complete:Fve,justCompleted:qve,atsSectionAll:zve,atsSectionHeader:$ve,atsSectionLabel:Vve,atsSectionCount:Hve,atsNumberRow:Gve,atsNumber:Wve,hit:Kve,atsCompleteText:Yve,atsLockedBadge:Xve},Jve=[2,3,4,5,6],Qve=[8,9,10,11,12];function Zve({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:`${Xr.atsProgressContainer} ${o?Xr.inline:""}`,children:[g.jsxs("div",{className:`${Xr.atsSection} ${u?Xr.complete:""} ${i==="small"?Xr.justCompleted:""}`,children:[g.jsxs("div",{className:Xr.atsSectionHeader,children:[g.jsx("span",{className:Xr.atsSectionLabel,children:"SMALL"}),g.jsxs("span",{className:Xr.atsSectionCount,children:[e,"/5"]})]}),g.jsx("div",{className:Xr.atsNumberRow,children:Jve.map(h=>g.jsx("div",{className:`${Xr.atsNumber} ${c(h)?Xr.hit:""}`,"aria-label":`${h} ${c(h)?"hit":"not hit"}`,children:h},h))})]}),g.jsxs("div",{className:`${Xr.atsSection} ${Xr.atsSectionAll} ${f?Xr.complete:""} ${i==="all"?Xr.justCompleted:""}`,children:[g.jsxs("div",{className:Xr.atsSectionHeader,children:[g.jsx("span",{className:Xr.atsSectionLabel,children:"ALL"}),g.jsxs("span",{className:Xr.atsSectionCount,children:[n,"/10"]})]}),f&&g.jsx("div",{className:Xr.atsCompleteText,children:"🎉"}),a&&!f&&g.jsx("div",{className:Xr.atsLockedBadge,children:"LOCKED"})]}),g.jsxs("div",{className:`${Xr.atsSection} ${d?Xr.complete:""} ${i==="tall"?Xr.justCompleted:""}`,children:[g.jsxs("div",{className:Xr.atsSectionHeader,children:[g.jsx("span",{className:Xr.atsSectionLabel,children:"TALL"}),g.jsxs("span",{className:Xr.atsSectionCount,children:[r,"/5"]})]}),g.jsx("div",{className:Xr.atsNumberRow,children:Qve.map(h=>g.jsx("div",{className:`${Xr.atsNumber} ${c(h)?Xr.hit:""}`,"aria-label":`${h} ${c(h)?"hit":"not hit"}`,children:h},h))})]})]})}const Ao={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 e_e(t){const e=ws(),[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(Ao.PROGRESS,c),e.on(Ao.SMALL_COMPLETE,u),e.on(Ao.TALL_COMPLETE,d),e.on(Ao.ALL_COMPLETE,f),e.on(Ao.RESET,h),()=>{e.off(Ao.PROGRESS,c),e.off(Ao.SMALL_COMPLETE,u),e.off(Ao.TALL_COMPLETE,d),e.off(Ao.ALL_COMPLETE,f),e.off(Ao.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 Ta(t){return`z${t}`}function cs(t,e){return t.filter(r=>r.type===e).reduce((r,n)=>r+n.amount,0)}function t_e(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=cs(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 ${Ta(c)}`}}if(E){if(!a)return{ok:!1,reason:"Come bets only after point"};if(m===0&&e<c)return{ok:!1,reason:`Minimum ${Ta(c)}`};if(m+e>u)return{ok:!1,reason:`Max ${Ta(u)}`}}if(T){if(!a)return{ok:!1,reason:"Point required for odds"};const C=cs(o,t==="oddsPass"?"pass":"dontPass");if(!C)return{ok:!1,reason:"Need line bet first"};const O=t_e(C,t==="oddsPass"?d.pass:d.dontPass);if(m+e>O)return{ok:!1,reason:`Max odds ${Ta(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 ${Ta(c)}`};if(m+e>u)return{ok:!1,reason:`Max ${Ta(u)}`}}if(t==="field"||t==="big6"||t==="big8"){if(m===0&&e<c)return{ok:!1,reason:`Minimum ${Ta(c)}`};if(m+e>u)return{ok:!1,reason:`Max ${Ta(u)}`}}if(t==="atsSmall"||t==="atsTall"||t==="atsAll"){if(m===0&&e<c)return{ok:!1,reason:`Minimum ${Ta(c)}`};if(m+e>u)return{ok:!1,reason:`Max ${Ta(u)}`}}return{ok:!0}}const r_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"}],n_e=[{key:"atsSmall",label:"Small"},{key:"atsTall",label:"Tall"},{key:"atsAll",label:"All"}],a_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 i_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 s_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 o_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(`.${ut.crapsPlaceRow}`),i=a?a.querySelector(`.${ut.crapsIronCrossBtn}`):document.querySelector(`.${ut.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 c_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(`.${ut.crapsPlaceRow}`),a=n?n.querySelector(`.${ut.crapsAtsLabel}`):document.querySelector(`.${ut.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 l_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(`.${ut.crapsMainBets}`),o=r.current||document.querySelector(`.${ut.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 u_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=cs(a,"pass")+cs(a,"dontPass")+cs(a,"place4")+cs(a,"place5")+cs(a,"place6")+cs(a,"place8")+cs(a,"place9")+cs(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 d_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 f_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 p_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 h_e(t,e){v.useEffect(()=>{const r=document.querySelectorAll(t),n=[];return r.forEach(a=>{if(a.querySelector(`.${ut.particleContainer}`))return;const i=document.createElement("div");i.className=ut.particleContainer,a.appendChild(i);const o=()=>{const u=document.createElement("div");u.className=ut.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(`.${ut.particleContainer}`)?.remove())}},[t,e])}function m_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=`+${Ta(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 g_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,z=_,{selectedChip:U,setSelectedChip:W}=i_e(d),{atsProgress:q,lastCompletedCategory:Y}=e_e(e??null),[Z,ae]=v.useState(!1),[G,F]=v.useState(),[K,ne]=v.useState(),{info:ee}=uP(),{triggerSpin:he}=Qo(),ce=v.useRef(!1),Pe=v.useRef(null),Ge=n==="comeOut"&&!a,se=n==="point"&&!!a,Ce=!1,te=v.useRef(null),H=v.useRef(null),pe=s_e({pendingBets:f,myPlayerPlaceTotal:E,myCommittedByType:j}),Re=n==="point"&&!!a&&!pe;o_e(Re,a,H),c_e(Y,H),l_e(e,te,H);const de=v.useCallback(()=>{Pe.current&&(window.clearInterval(Pe.current),Pe.current=null)},[]),Ie=v.useCallback(()=>{ce.current||(ce.current=!0,Lr(),he(),de(),Pe.current=window.setInterval(()=>{he()},500))},[he,de]),ct=v.useCallback(()=>{if(de(),!!ce.current){if(ce.current=!1,n==="point"&&!pe)try{ee("No Place bet","Add a Place bet (e.g., 6 or 8) before rolling")}catch{}w?.()}},[n,pe,ee,w,de]),Ve=u_e({phase:n,point:a,balance:r,pendingBets:f,minBet:o,maxBet:c,oddsMultiple:u,myPlayerLineTotals:N,myPlayerPlaceTotal:E}),rt=d_e(f,j);f_e(f,j,h);const Ke=v.useMemo(()=>{const B=cs(f,"pass")>0||cs(f,"dontPass")>0,Q=(N?.pass??0)>0||(N?.dontPass??0)>0,oe=rt("pass")>0||rt("dontPass")>0;return B||Q||oe},[f,N?.pass,N?.dontPass,rt]),{lineOutcomeMap:it,placeOutcomeMap:Et,fieldOutcomeMap:It,bigOutcomeMap:bt,comeOutcomeMap:me}=p_e({recentSettlements:R,meId:D,myPlayerLineTotals:N}),Be=v.useMemo(()=>`.${ut.spotBtn}[data-win-outcome="true"]`,[]),je=v.useMemo(()=>JSON.stringify({lineOutcomeMap:it,placeOutcomeMap:Et,fieldOutcomeMap:It,bigOutcomeMap:bt,comeOutcomeMap:me}),[it,Et,It,bt,me]);h_e(Be,je),m_e({recentSettlements:R,meId:D,winSelector:Be,floatingClass:ut.floatingWinAmount});const nt=v.useMemo(()=>{const B=new Set;for(const Q of f){const oe=Number(j[Q.type]||0);Q.amount!==oe&&B.add(Q.type)}return B},[f,j]),Ct=v.useRef(new Set);v.useEffect(()=>{const B=Ct.current,Q=nt;for(const oe of B)if(!Q.has(oe)){try{FG({volume:.03})}catch{}break}Ct.current=new Set(Q)},[nt]);const Mt=nt.size>0;v.useMemo(()=>nt.size>0,[nt]);const De=v.useCallback((B,Q)=>{if(Q===0)return;const oe=f.find(Rt=>Rt.type===B);if(Q>0){const Rt=Q,{ok:Ut,reason:dr}=hL(B,Rt,Ve);if(!Ut){if(F(dr),ne(B),dr==="Insufficient balance")try{ee("Insufficient funds","Add chips to place this bet")}catch{}window.setTimeout(()=>ne(void 0),600);return}if(oe)h(f.map(hn=>hn===oe?{...hn,amount:hn.amount+Rt}:hn));else{const hn=Number(j[B]||0);h([...f,{id:LE(),type:B,amount:hn+Rt}])}P?.(B,Rt);return}let Ne=oe?.amount??0;if(!oe){const Rt=Number(j[B]||0);if(Rt<=0)return;Ne=Rt}const pt=Ne+Q;h(oe?f.map(Rt=>Rt===oe?{...Rt,amount:Math.max(0,pt)}:Rt):[...f,{id:LE(),type:B,amount:Math.max(0,pt)}]),P?.(B,Q)},[f,h,o,j,Ve,P,ee]),et=v.useCallback((B,Q)=>{const oe=B==="oddsPass",Ne=B==="oddsDontPass",pt=B==="atsSmall"||B==="atsTall"||B==="atsAll",Rt=B==="pass"||B==="dontPass"?se:oe?n!=="point"||!a||rt("pass")===0:Ne?n!=="point"||!a||rt("dontPass")===0:B.startsWith("place")||B==="come"||B==="dontCome"?!a:pt?n!=="comeOut"||q.betsLocked:!1,Ut=B==="pass"||B==="dontPass",dr=B==="come"||B==="dontCome",hn=!B.startsWith("place"),rn=Ut&&se,Fe=Ut?it[B]:B==="field"?It[B]:B==="big6"||B==="big8"?bt[B]:dr?me[B]:void 0,Zt=Fe==="WIN"?ut.lineWin:Fe==="LOSE"?ut.lineLose:Fe==="PUSH"?ut.linePush:"",Ft=Ut&&Ge&&!Ke,qt=[ut.spotBtn,ut.crapsBetTile,B.startsWith("place")?ut.crapsPlaceTile:"",Rt?ut.locked:"",K===B?ut.shake:"",Zt,Ft?ut.attnHalo:"",B.startsWith("place")&&Re?ut.attnHalo:""],xt=_||Ce||Mt,fn=L&&typeof L[B]=="number"?L[B]:0,bn=rt(B);if(hn){const Zn=[...qt,ut.spotBtnTopRow,"gold-link",xt?ut.disabled:""].filter(Boolean).join(" ");return g.jsxs(Xs.a,{role:"button",tabIndex:0,"aria-disabled":xt||void 0,className:Zn,"data-bet-type":B,"data-attn":Ft?"need-line":void 0,"data-has-bet":bn>0?"true":"false","data-win-outcome":Fe==="WIN"?"true":"false","data-no-global-haptic":!0,"aria-label":`Place bet on ${Q}, +${U}`,onClick:mr=>{mr.preventDefault(),!Rt&&!xt&&(Lr(),rr("Light"),De(B,U))},onKeyDown:mr=>{(mr.key==="Enter"||mr.key===" ")&&!Rt&&!xt&&(mr.preventDefault(),Lr(),rr("Light"),De(B,U))},whileTap:{scale:.94},children:[Q,fn>0&&g.jsx("div",{className:ut.aggBadge,"aria-label":`Others ${Q} total ${Ta(fn)}`,children:Ta(fn)}),bn>0&&g.jsxs("div",{className:ut.amountBadge+(rn?" "+ut.amountBadgeDisabled:""),"aria-disabled":rn||void 0,children:[!rn&&g.jsx("span",{role:"button",tabIndex:0,className:[ut.badgeMinus,ut.crapsMinusBadge].join(" "),"aria-label":`Remove chip from ${Q}`,onClick:mr=>{mr.stopPropagation(),Lr(),rr("Light"),De(B,-U)},onKeyDown:mr=>{(mr.key==="Enter"||mr.key===" ")&&(mr.preventDefault(),mr.stopPropagation(),Lr(),rr("Light"),De(B,-U))},children:"−"}),Ta(bn),rn&&g.jsx("span",{className:ut.lockIcon,"aria-hidden":"true",children:"🔒"}),Fe&&g.jsx("span",{className:ut.outcomeBadge,"aria-label":`Outcome ${Fe}`,children:Fe==="WIN"?"✓":Fe==="LOSE"?"✕":"⟳"})]}),K===B&&G&&g.jsx("div",{className:ut.tooltip,children:G})]},B)}const Fn=B.startsWith("place")?Et[B]:B==="field"?It[B]:B==="big6"||B==="big8"?bt[B]:void 0,la=qt.filter(Boolean).join(" ");return g.jsxs(Xs.button,{type:"button",className:la,"data-bet-type":B,"data-attn":B.startsWith("place")&&Re?"need-places":void 0,"data-has-bet":bn>0?"true":"false","data-win-outcome":Fe==="WIN"||Fn==="WIN"?"true":"false","aria-label":`Place bet on ${Q}, +${U}`,onClick:()=>{!Rt&&!xt&&(Lr(),rr("Light"),De(B,U))},disabled:_||Ce||Mt,whileTap:{scale:.94},children:[Q,fn>0&&g.jsx("div",{className:ut.aggBadge,"aria-label":`Others ${Q} total ${Ta(fn)}`,children:Ta(fn)}),bn>0&&g.jsxs("div",{className:ut.amountBadge+(rn?" "+ut.amountBadgeDisabled:""),"aria-disabled":rn||void 0,children:[!rn&&g.jsx("span",{role:"button",tabIndex:0,className:[ut.badgeMinus,ut.crapsMinusBadge].join(" "),"aria-label":`Remove chip from ${Q}`,onClick:Zn=>{Zn.stopPropagation(),Lr(),rr("Light"),De(B,-U)},onKeyDown:Zn=>{(Zn.key==="Enter"||Zn.key===" ")&&(Zn.preventDefault(),Zn.stopPropagation(),Lr(),rr("Light"),De(B,-U))},children:"−"}),Ta(bn),rn&&g.jsx("span",{className:ut.lockIcon,"aria-hidden":"true",children:"🔒"}),Fe&&g.jsx("span",{className:ut.outcomeBadge,"aria-label":`Outcome ${Fe}`,children:Fe==="WIN"?"✓":Fe==="LOSE"?"✕":"⟳"})]}),K===B&&G&&g.jsx("div",{className:ut.tooltip,children:G})]},B)},[De,_,Ce,rt,G,K,Ge,Ke,Re,U,se,n,a,it,Et,It,bt,me,L,Mt,q.betsLocked]),at=v.useMemo(()=>{const B=[...r_e],Q=(oe,Ne,pt)=>{const Rt=B.findIndex(Ut=>Ut.key===oe);Rt>=0&&!B.some(Ut=>Ut.key===Ne)&&B.splice(Rt+1,0,{key:Ne,label:pt})};return Q("pass","oddsPass","Odds Pass"),Q("dontPass","oddsDontPass","Odds Don't"),B},[]),ke=v.useMemo(()=>at.map(B=>et(B.key,B.label)),[at,et]),st=v.useMemo(()=>a_e.map(B=>et(B.key,B.label)),[et]),kt=v.useMemo(()=>n_e.map(B=>et(B.key,B.label)),[et]),nr=v.useCallback(()=>{if(_||Ce||Mt)return;Lr(),rr("Light");const B=["place4","place5","place6","place8","place9","place10"],Q=[];for(const Ne of B){f.find(dr=>dr.type===Ne);const pt=U,{ok:Rt,reason:Ut}=hL(Ne,pt,Ve);if(!Rt){if(F(Ut),ne(Ne),Ut==="Insufficient balance")try{ee("Insufficient funds","Add chips to place All Places bet")}catch{}window.setTimeout(()=>ne(void 0),600);return}Q.push({type:Ne,delta:pt})}let oe=[...f];for(const{type:Ne,delta:pt}of Q){const Rt=oe.find(Ut=>Ut.type===Ne);if(Rt)oe=oe.map(Ut=>Ut===Rt?{...Ut,amount:Ut.amount+pt}:Ut);else{const Ut=Number(j[Ne]||0);oe.push({id:LE(),type:Ne,amount:Ut+pt})}}h(oe),A?A(Q.map(({type:Ne,delta:pt})=>({type:Ne,amount:pt}))):P&&Q.forEach(({type:Ne,delta:pt})=>P(Ne,pt))},[_,Ce,f,U,o,Ve,h,j,A,P,ee,Mt]),lr=!!C,ur=lr?I||"Ready":"Roll",Er=lr?!!x:z||b===!1,dn=!lr&&!Er&&b!==!1&&(n!=="point"||pe),[J,ue]=v.useState(!1),ve=v.useRef(null);v.useEffect(()=>{if(!J)return;const B=Q=>{ve.current&&!ve.current.contains(Q.target)&&ue(!1)};return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[J]);const Ae=i;return g.jsxs("div",{className:[ut.panelRoot,_?ut.disabled:""].join(" "),children:[g.jsxs("div",{className:ut.crapsStatusBar,children:[g.jsxs("div",{className:ut.chipPickerWrapper,ref:ve,children:[g.jsx("div",{className:[ut.chipPickerToggle,J?ut.chipPickerToggleOpen:""].join(" "),onClick:()=>{Lr(),rr("Light"),ue(B=>!B)},role:"button",tabIndex:0,"aria-label":`Selected chip ${U}, click to change`,"aria-expanded":J,onKeyDown:B=>{(B.key==="Enter"||B.key===" ")&&(B.preventDefault(),Lr(),rr("Light"),ue(Q=>!Q))},children:g.jsx(Js,{value:U,mini:!0,className:ut.chipPickerChip,onAdd:()=>{Lr(),rr("Light"),ue(B=>!B)}})}),J&&g.jsx("div",{className:ut.chipPickerDropdown,children:d.map(B=>g.jsx("div",{className:[ut.chipPickerOption,B===U?ut.chipPickerOptionSelected:""].join(" "),children:g.jsx(Js,{value:B,mini:!0,className:B===U?ut.chipPickerChipSelected:"",onAdd:()=>{Lr(),fF(),W(B),ue(!1)}})},B))})]}),g.jsxs("span",{className:ut.crapsStatusText,children:[g.jsx("span",{className:ut.mobileHide,children:n==="comeOut"?"COME-OUT":"POINT"}),g.jsx("span",{className:ut.mobileShow,children:n==="comeOut"?"CO":"PT"})," • ",g.jsx("span",{className:ut.mobileHide,children:"SHOOTER: "}),g.jsx("strong",{className:ut.crapsHighlight,children:Ae})," • ",g.jsx("span",{className:ut.mobileHide,children:"POINT: "}),g.jsx("span",{className:ut.mobileShow,children:"P: "}),g.jsx("strong",{className:ut.crapsHighlight,children:a??"—"})]}),g.jsx("button",{type:"button",className:ut.betInfoBtn,onClick:()=>{rr("Light"),ae(!0)},"aria-label":"Show bet information",children:g.jsx(Ml,{icon:Ive})})]}),g.jsx(jve,{open:Z,onClose:()=>ae(!1)}),g.jsx("div",{className:[ut.spotRow,ut.crapsMainBets].join(" "),ref:te,children:ke}),g.jsxs("div",{className:ut.crapsPlaceRow,ref:H,children:[st,g.jsx("button",{type:"button",className:[ut.spotBtn,ut.crapsBetTile,ut.crapsIronCrossBtn].join(" "),onClick:nr,disabled:!a||_||Ce||Mt,"aria-label":"Place All Places (4/5/6/8/9/10)",children:"All Places"})]}),g.jsxs("div",{className:ut.crapsAtsSection,children:[g.jsx("span",{className:ut.crapsAtsLabel,children:"ATS"}),kt,g.jsx(Zve,{hitNumbers:q.hitNumbers,smallProgress:q.smallProgress,tallProgress:q.tallProgress,allProgress:q.allProgress,betsLocked:q.betsLocked,lastCompletedCategory:Y,inline:!0})]}),g.jsx("div",{className:ut.crapsActionsBar,children:g.jsxs("div",{className:ut.actions,children:[g.jsxs("button",{type:"button",className:[ut.actionBtn,ut.rollBtn,ut.crapsActionButton,ut.crapsActionButtonPrimary,dn?ut.rollHaloActive:""].join(" "),onClick:B=>{if(lr){if(x)return;try{Lr(),rr("Light")}catch{}O?.();return}if(ce.current){B.preventDefault();return}if(!Er){Lr(),rr("Medium"),he();try{n==="point"&&!pe&&ee("No Place bet","Add a Place bet (e.g., 6 or 8) before rolling")}catch{}w?.()}},onPointerDown:()=>{lr||Er||(Ie(),rr("Medium"))},onPointerUp:()=>{lr||ct()},disabled:Er,"aria-label":lr?"Mark ready":"Roll dice",children:[!lr&&g.jsx(Ml,{icon:Nve,className:ut.rollIcon,"aria-hidden":"true"}),ur]}),g.jsxs("button",{type:"button",className:[ut.actionBtn,ut.clear,ut.crapsActionButton,ut.crapsActionButtonSecondary].join(" "),onClick:()=>{Lr(),rr("Light"),m()},"aria-label":"Clear all bets",children:[g.jsx("span",{className:ut.crapsClearIcon,"aria-hidden":"true",children:"✕"})," Clear All"]})]})}),g.jsx("div",{className:ut.errorLive,"aria-live":"polite",children:G||""})]})}function y_e(t,e){const{crapsGetState:r,crapsJoinOrder:n,crapsLeaveOrder:a,crapsSetOrder:i,crapsRoll:o,crapsResetShooter:c,crapsReady:u}=ma(),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={},v_e=1;function Qz(t){const{roomId:e,myPlayerId:r,autoJoinOrder:n=!0,onRoll:a,onState:i}=t,{crapsReady:o}=ma(),c=(()=>{try{return ji&&ji()}catch{return null}})(),u=c?.room??null,d=c?.setRoom??(()=>{}),h=u?.gameState?.gameMode==="craps",m=y_e(e,{enabled:h}),_=v.useMemo(()=>{const se=u?.gameState;return!se||se.gameMode!=="craps"?null:{point:se.crapsPoint??null,currentRollerId:se.currentRollerId??null,turnOrder:se.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),z=v.useRef(null),U=v.useRef(null),W=v.useRef(null),{triggerSpin:q}=Qo(),Y=v.useRef(null),Z=v.useRef(null),ae=2e3,G=v.useMemo(()=>!!(r&&_?.turnOrder.includes(r)),[r,_?.turnOrder]),F=v.useCallback(()=>{h&&m.getState?.()},[m,h]),K=v.useCallback(se=>{!h||!e||A.current||(A.current=!0,m.joinOrder?.(Ce=>{A.current=!1,se?.(Ce?.ok,Ce?.data)}))},[m,e,h]),ne=v.useCallback(se=>{!h||!e||A.current||(A.current=!0,m.leaveOrder?.(Ce=>{A.current=!1,se?.(Ce?.ok,Ce?.data)}))},[m,e,h]),ee=v.useCallback((se,Ce)=>{!h||!e||A.current||(A.current=!0,m.setOrder?.(se,te=>{A.current=!1,Ce?.(te?.ok,te?.data)}))},[m,e,h]),he=v.useCallback(se=>{if(!(!h||!e||A.current)){A.current=!0,P(!0),q();try{const Ce=m.roll?.();Ce&&typeof Ce.then=="function"&&Ce.then(te=>{const H=!!te?.ok,pe=String(te?.error||"");if(A.current=!1,!H)try{const Re=/invalid_payload/i.test(pe),de=/no_room/i.test(pe),Ie=/forbidden|unauthorized/i.test(pe);if(Re||de||Ie){Z.current&&(window.clearTimeout(Z.current),Z.current=null),P(!1),F(),se?.(!1,te?.data);return}}catch{}try{Z.current&&(window.clearTimeout(Z.current),Z.current=null),Z.current=window.setTimeout(()=>{P(!1),Z.current=null},Math.max(ae,4e3))}catch{}se?.(H,te?.data)}).catch(()=>{A.current=!1,P(!1);try{F()}catch{}se?.(!1)})}catch{A.current=!1,P(!1),se?.(!1)}}},[m,e,h]),ce=v.useCallback(se=>{if(!(!h||!e||A.current)){A.current=!0;try{const Ce=m.resetShooter?.();Ce&&typeof Ce.then=="function"&&Ce.then(te=>{A.current=!1,se?.(!!te?.ok,te?.data)}).catch(()=>{A.current=!1,se?.(!1)})}catch{A.current=!1,se?.(!1)}}},[m,e,h]),Pe=v.useRef(0);Pe.current===0&&(Pe.current=v_e++);const Ge=v.useMemo(()=>e?Lh[e]?Lh[e]===Pe.current:(Lh[e]=Pe.current,!0):!1,[e]);return v.useEffect(()=>()=>{try{e&&Lh[e]===Pe.current&&delete Lh[e]}catch{}},[e]),Ra({onJoinedRoom:({room:se})=>{if(Ge)try{if(!e||!se||se.id!==e)return;if(U.current){const Ce=U.current.cb;U.current=null,(async()=>{try{const te=await o(e);Ce?.(!!te?.ok,te?.data)}catch{Ce?.(!1)}})()}}catch{}},onRejoinedRoom:({room:se})=>{if(Ge)try{if(!e||!se||se.id!==e)return;if(U.current){const Ce=U.current.cb;U.current=null,(async()=>{try{const te=await o(e);Ce?.(!!te?.ok,te?.data)}catch{Ce?.(!1)}})()}}catch{}},onCrapsState:se=>{if(!Ge||!e||se.roomId!==e)return;const Ce=se.state?.currentRollerId??se.state?.currentShooterId??se.state?.shooterId??null,te=se.state?.turnOrder||se.state?.shooterOrder||[],H=se.state?.point??se.state?.crapsPoint??null;try{d(pe=>{if(!pe||pe.id!==e)return pe;const Re=pe.gameState||{},de=H?"point":"come-out";return{...pe,gameState:{...Re,gameMode:Re.gameMode||"craps",crapsPoint:H,currentRollerId:Ce,turnOrder:te,crapsPhase:de}}})}catch{}try{i?.({point:H,currentRollerId:Ce,turnOrder:te})}catch{}n&&r&&!te.includes(r)&&K()},onCrapsPointSet:se=>{if(Ge)try{if(!e||se?.roomId!==e)return;const Ce=se?.point??se?.crapsPoint??null;d(te=>{if(!te||te.id!==e)return te;const H={...te.gameState||{}};return Ce!=null&&(H.crapsPoint=Ce,H.crapsPhase="point"),{...te,gameState:H}})}catch{}},onCrapsRollResult:se=>{if(!Ge||!e||se?.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},ae),Z.current&&(window.clearTimeout(Z.current),Z.current=null)}catch{}let Ce,te;if(Array.isArray(se?.dice)?[Ce,te]=se.dice:(Ce=se?.d1,te=se?.d2),typeof Ce!="number"||typeof te!="number")return;const H=typeof se.total=="number"?se.total:Ce+te,pe=se.currentRollerId??se.currentShooterId??se.shooterId??null,Re=se.nextRollerId??se.nextShooterId??se.nextShooter??null,de={roomId:se.roomId,dice:[Ce,te],total:H,point:se.point??se.crapsPoint??null,currentRollerId:pe,nextRollerId:Re,events:Array.isArray(se.events)?se.events:[],resolutions:se.resolutions||{passLineWins:!1,passLineLosses:!1,pushes:!1}};b(de),T(Ie=>{const ct=Date.now(),Ve=30,rt=900;for(let Et=0;Et<Ie.length&&Et<5;Et++){const It=Ie[Et];if(It.dice[0]===de.dice[0]&&It.dice[1]===de.dice[1]&&ct-It.ts<rt)return Ie}const it=[{...de,ts:ct,phase:de.point?"point":"come-out"},...Ie];it.length>Ve&&(it.length=Ve);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{q()}catch{}try{(se.gameState||se.point!==void 0||se.currentRollerId!==void 0||se.nextRollerId!==void 0)&&d(Ie=>{if(!Ie||Ie.id!==e)return Ie;const Ve={...Ie.gameState||{}};(se.point!==void 0||se.crapsPoint!==void 0)&&(Ve.crapsPoint=se.point??se.crapsPoint);const rt=Re??pe;return rt!==void 0&&(Ve.currentRollerId=rt),(Array.isArray(se.turnOrder)||Array.isArray(se.shooterOrder))&&(Ve.turnOrder=se.turnOrder||se.shooterOrder),Ve.gameMode||(Ve.gameMode="craps"),Ve.crapsPhase=Ve.crapsPoint?"point":"come-out",{...Ie,gameState:Ve}})}catch{}a?.(de)},onCrapsReadyUpdate:se=>{if(Ge)try{const Ce=Array.isArray(se?.readyPlayers)?se.readyPlayers:void 0,te=Array.isArray(se?.requiredReadyPlayers)?se.requiredReadyPlayers:void 0,H=se&&Object.prototype.hasOwnProperty.call(se,"deadline"),pe=H?typeof se.deadline=="number"?se.deadline:null:void 0,Re=(de,Ie)=>{if(!de&&!Ie)return!0;if(!de||!Ie||de.length!==Ie.length)return!1;for(let ct=0;ct<de.length;ct++)if(de[ct]!==Ie[ct])return!1;return!0};Ce&&(Re(L.current,Ce)||(L.current=Ce.slice(),O(Ce))),te&&(Re(j.current,te)||(j.current=te.slice(),N(te))),H&&z.current!==pe&&(z.current=pe===void 0?z.current:pe,x(pe))}catch{}},onCrapsBetsUpdate:se=>{if(Ge)try{const Ce=se?.snapshot||{};d(te=>{if(!te||te.id!==e)return te;const H={...te.gameState||{}};for(const pe of Object.keys(Ce))H[pe]=Ce[pe];return H.gameMode||(H.gameMode="craps"),{...te,gameState:H}})}catch{}}}),v.useEffect(()=>{!e||!h||Ge&&F()},[e,h]),v.useEffect(()=>{try{const se=u?.gameState;if(!se||se.gameMode!=="craps")return;const Ce=se.crapsReadiness;Ce&&(Array.isArray(Ce.readyPlayers)&&O(Ce.readyPlayers),Array.isArray(Ce.requiredReadyPlayers)&&N(Ce.requiredReadyPlayers),Object.prototype.hasOwnProperty.call(Ce,"deadline")&&x(typeof Ce.deadline=="number"?Ce.deadline:null))}catch{}},[u?.gameState]),v.useEffect(()=>{if(!h||!e||!Ge)return;let se=0;const Ce=500,te=()=>{try{const de=Date.now();if(de-se<Ce)return;se=de,F()}catch{}},H=()=>{document.visibilityState==="visible"&&te()},pe=()=>{te()},Re=()=>{te()};return window.addEventListener("visibilitychange",H),window.addEventListener("focus",pe),window.addEventListener("ad:complete",Re),()=>{window.removeEventListener("visibilitychange",H),window.removeEventListener("focus",pe),window.removeEventListener("ad:complete",Re)}},[h,e,F,Ge]),v.useEffect(()=>{e&&(async()=>{try{const se=await Xf(`craps-roll-history:${e}`);if(!se)return;if(se&&se.v===1&&Array.isArray(se.items)){if(typeof se.ts=="number"&&Date.now()-se.ts>72e5)return;const te=[];for(const H of se.items)if(!(!H||!Array.isArray(H.dice)||H.dice.length!==2)&&!(typeof H.total!="number"||typeof H.ts!="number")&&(te.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"}),te.length>=30))break;te.length&&T(te)}}catch{}})()},[e]),v.useEffect(()=>()=>{Y.current&&(window.clearTimeout(Y.current),Y.current=null),Z.current&&(window.clearTimeout(Z.current),Z.current=null),W.current&&(window.clearTimeout(W.current),W.current=null)},[]),{shooterState:_,lastRoll:w,rollHistory:E,rolling:D,inTurnOrder:G,joinOrder:K,leaveOrder:ne,setOrder:ee,roll:he,resetShooter:ce,requestState:F,readyPlayers:C,readinessDeadline:I,requiredReadyPlayers:R,ready:se=>{if(!e||!h)return;const Ce=!!(u&&u.id===e);if(r&&!C.includes(r)&&O(te=>[...te,r]),I||x(Date.now()+5e3),!Ce){U.current={cb:se,at:Date.now()};try{W.current&&(window.clearTimeout(W.current),W.current=null),W.current=window.setTimeout(async()=>{try{if(!U.current)return;const te=await o(e),H=U.current?.cb;U.current=null,H?.(!!te?.ok,te?.data)}catch{const te=U.current?.cb;U.current=null,te?.(!1)}finally{W.current&&(window.clearTimeout(W.current),W.current=null)}},600)}catch{}return}(async()=>{try{const te=await o(e);if(!te?.ok){const H=String(te?.error||""),pe=/forbidden|unauthorized/i.test(H),Re=/ready_failed/i.test(H);if(pe||Re){try{F()}catch{}try{const de=await o(e);se?.(!!de?.ok,de?.data);return}catch{}}se?.(!1);return}se?.(!0,te?.data)}catch{try{setTimeout(async()=>{try{const te=await o(e);se?.(!!te?.ok,te?.data)}catch{se?.(!1)}},400)}catch{se?.(!1)}}})()},iAmReady:!!(r&&C.includes(r)),clearRollHistory:()=>{T([]);try{e&&Jf(`craps-roll-history:${e}`)}catch{}}}}function __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;ws();const{room:i,setRoom:o}=ji(),[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:z,crapsRemoveBet:U,crapsClearBets:W,crapsSummarizeBets:q}=ma(),Y=v.useCallback(H=>{if(!e)return;const pe=UE.get(e);if(pe)return H&&pe.then(de=>H(de)).catch(de=>H({ok:!1,error:String(de?.message||de)})),pe;const Re=j(e);return UE.set(e,Re),Re.finally(()=>{UE.delete(e)}),H&&Re.then(de=>H(de)).catch(de=>H({ok:!1,error:String(de?.message||de)})),Re},[j,e]),Z=v.useCallback((H,pe,Re)=>{if(!e)return;const de=z(e,H,pe);return Re&&de.then(Ie=>Re(Ie)).catch(Ie=>Re({ok:!1,error:String(Ie?.message||Ie)})),de},[z,e]),ae=v.useCallback((H,pe,Re)=>{if(!e)return;const de=U(e,H,pe);return Re&&de.then(Ie=>Re(Ie)).catch(Ie=>Re({ok:!1,error:String(Ie?.message||Ie)})),de},[U,e]),G=v.useCallback(H=>{if(!e)return;const pe=W(e);return H&&pe.then(Re=>H(Re)).catch(Re=>H({ok:!1,error:String(Re?.message||Re)})),pe},[W,e]),F=v.useCallback(H=>{if(!e)return;const pe=q(e);return H&&pe.then(Re=>H(Re)).catch(Re=>H({ok:!1,error:String(Re?.message||Re)})),pe},[q,e]),K=e&&r?`crapsbets:${e}:${r}`:null,ne=1800*1e3,ee=v.useCallback(async()=>{if(K)try{const H=await Xf(K);if(!H)return;const pe=H.pass,Re=H.dontPass,de=Array.isArray(H.place)?H.place:[],Ie=typeof H.ts=="number"?H.ts:void 0;if(Ie&&Date.now()-Ie>ne||!de?.length&&!pe&&!Re)return;u(ct=>{if(ct.lastUpdated!==0||ct.place.length+ct.pass.length+ct.dontPass.length>0)return ct;const Ve={...ct};return pe&&(Ve.pass=[{playerId:r,amount:pe}]),Re&&(Ve.dontPass=[{playerId:r,amount:Re}]),de?.length&&(Ve.place=de.map(rt=>({playerId:r,point:rt.point,amount:rt.amount}))),Ve.lastUpdated=Date.now(),d.current=Ve,Ve})}catch{}},[K,r]);v.useEffect(()=>{ee()},[ee]);const he=v.useCallback(async()=>{if(!(!K||!r||!e))try{const H=await Xf(K);if(!H)return;const pe=Number(H.pass||0),Re=Number(H.dontPass||0),de=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(bt=>setTimeout(bt,120));if((d.current.lastUpdated||0)<=Ie)return;const Ve=d.current,rt=(Ve.pass||[]).find(bt=>bt.playerId===r)?.amount||0,Ke=(Ve.dontPass||[]).find(bt=>bt.playerId===r)?.amount||0,it={};for(const bt of Ve.place||[])bt.playerId===r&&(it[bt.point]=(it[bt.point]||0)+bt.amount);const Et=Math.max(0,pe-rt),It=Math.max(0,Re-Ke);if(Et>0)try{await z(e,"pass",Et)}catch{}if(It>0)try{await z(e,"dontPass",It)}catch{}for(const bt of de){const me=Number(bt.point),Be=Number(bt.amount||0),je=Number(it[me]||0),nt=Math.max(0,Be-je);if(nt>0)try{const Ct=`place${me}`;await z(e,Ct,nt)}catch{}}}catch{}},[K,r,e,Y,c,z]),ce=v.useCallback(H=>{!H||typeof H!="object"||u(pe=>{const Re={pass:Array.isArray(H.crapsPassBets)?H.crapsPassBets:pe.pass,dontPass:Array.isArray(H.crapsDontPassBets)?H.crapsDontPassBets:pe.dontPass,odds:Array.isArray(H.crapsOddsBets)?H.crapsOddsBets:pe.odds,place:Array.isArray(H.crapsPlaceBets)?H.crapsPlaceBets:pe.place,field:Array.isArray(H.crapsFieldBets)?H.crapsFieldBets:pe.field,big:Array.isArray(H.crapsBigBets)?H.crapsBigBets:pe.big,come:Array.isArray(H.crapsComeBets)?H.crapsComeBets:pe.come,dontCome:Array.isArray(H.crapsDontComeBets)?H.crapsDontComeBets:pe.dontCome,ats:Array.isArray(H.crapsAtsBets)?H.crapsAtsBets:pe.ats,lastUpdated:Date.now()};return d.current=Re,Re})},[]),Pe=v.useCallback((H,pe,Re)=>{if(!e||H!==e)return;h(pe),N.current+=1;const de={...Re||{},_seq:N.current};_(de);try{o(ct=>{if(!ct||ct.id!==e)return ct;const Ve={...ct.gameState||{}};return Ve.lastCrapsSettlementsTs=Date.now(),Ve.lastCrapsSettlements=pe,{...ct,gameState:Ve}})}catch{}const Ie=new Map;for(const ct of pe)ct.outcome==="WIN"&&ct.playerId&&Ie.set(ct.playerId,(Ie.get(ct.playerId)||0)+1);for(const[ct,Ve]of Ie){const rt=L.current.get(ct)||0,Ke=rt+Ve;if(L.current.set(ct,Ke),rt>=6&&Ke>rt)gO(7,.55);else for(const it of[3,4,5,6])if(rt<it&&Ke>=it){gO(it,.55);break}}x.current&&clearTimeout(x.current),x.current=setTimeout(()=>h([]),a)},[e,o,a]);Ra({onCrapsRollResult:H=>{try{if(!e||H?.roomId!==e)return;const pe=Array.isArray(H?.events)?H.events:[],Re=pe.includes("crapsOut")||pe.includes("CRAPS_OUT"),de=pe.includes("sevenOut")||pe.includes("SEVEN_OUT");if((Re||de)&&L.current.clear(),de){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 he()}catch{}}}catch{}},onRejoinedRoom:async({room:H})=>{try{if(H?.id&&H.id===e){try{await Y()}catch{}try{await he()}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 pe=typeof H.deadline=="number"?H.deadline:null;I(pe)}}catch{}},onCrapsBetsUpdate:H=>{if(!e||H?.roomId!==e)return;const pe=H?.snapshot;if(pe){ce(pe);try{o(Re=>{if(!Re||Re.id!==e)return Re;const de={...Re.gameState||{}};for(const Ie of Object.keys(pe))de[Ie]=pe[Ie];return de.gameMode||(de.gameMode="craps"),{...Re,gameState:de}})}catch{}}K&&r&&(async()=>{try{const Re=(pe?.crapsPassBets||[]).find(Ve=>Ve.playerId===r)?.amount||0,de=(pe?.crapsDontPassBets||[]).find(Ve=>Ve.playerId===r)?.amount||0,Ie=(pe?.crapsPlaceBets||[]).filter(Ve=>Ve.playerId===r).map(Ve=>({point:Ve.point,amount:Ve.amount})),ct={v:1,ts:Date.now(),pass:Re,dontPass:de,place:Ie};Re||de||Ie.length?await Ab(K,ct):await Jf(K)}catch{}})()},onCrapsBetResults:H=>{const pe=Array.isArray(H?.settlements)?H.settlements:[];Pe(H?.roomId,pe,H?.roll)},onCrapsPointSet:H=>{if(!e||H?.roomId!==e)return;const pe=H.currentRollerId||H.nextRollerId||"unknown",Re=`ptSet:${H.point}:${Array.isArray(H.dice)?H.dice.join("-"):""}:${pe}`;b({...H,_key:Re});try{o(de=>{if(!de||de.id!==e)return de;const Ie={...de.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),{...de,gameState:Ie}})}catch{}},onCrapsPointMade:H=>{if(!e||H?.roomId!==e)return;const pe=H.currentRollerId||H.nextRollerId||"unknown",Re=`ptMade:${H.point}:${Array.isArray(H.dice)?H.dice.join("-"):""}:${pe}`;T({...H,_key:Re});try{o(de=>{if(!de||de.id!==e)return de;const Ie={...de.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),{...de,gameState:Ie}})}catch{}}}),v.useEffect(()=>{if(!e){u(FE),R.current=!1,h([]),_(null);return}const H=i?.gameState;H&&(H.crapsPassBets||H.crapsDontPassBets)&&ce(H),n&&!R.current&&(R.current=!0,Y())},[e]),v.useEffect(()=>{if(!e)return;const H=async()=>{await new Promise(pe=>setTimeout(pe,300));try{await Y()}catch{}try{await he()}catch{}};return window.addEventListener("ad:complete",H),()=>{window.removeEventListener("ad:complete",H)}},[e,Y,he]),v.useEffect(()=>()=>{x.current&&clearTimeout(x.current)},[]);const Ge=v.useMemo(()=>c.pass.reduce((H,pe)=>H+pe.amount,0),[c.pass]),se=v.useMemo(()=>c.dontPass.reduce((H,pe)=>H+pe.amount,0),[c.dontPass]),Ce=v.useMemo(()=>c.field.reduce((H,pe)=>H+pe.amount,0),[c.field]),te=v.useMemo(()=>r?{pass:c.pass.filter(H=>H.playerId===r).reduce((H,pe)=>H+pe.amount,0),dontPass:c.dontPass.filter(H=>H.playerId===r).reduce((H,pe)=>H+pe.amount,0)}:{pass:0,dontPass:0},[c.pass,c.dontPass,r]);return{betsState:c,recentSettlements:f,lastSettlementRoll:m,_persistKey:K,passTotal:Ge,dontPassTotal:se,fieldTotal:Ce,myLine:te,listBets:Y,addBet:Z,removeBet:ae,clearBets:G,summarize:F,clearRecentSettlements:()=>h([]),pointSetEvent:w,pointMadeEvent:E,readyPlayers:D,requiredReadyPlayers:A,readinessDeadline:O}}function b_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 Sc(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 k_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 w_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 S_e({balance:t,meId:e,readyPlayers:r}){const{user:n,meId:a}=Vr(),{room:i,setRoom:o}=ji(),c=i?.id??null,u=v.useMemo(()=>b_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||[],z=C.odds||[],U=C.ats||[],W=v.useMemo(()=>k_e(x,f),[x,f]),q=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??Sc(O,f),nt=D.myLine?.dontPass??Sc(I,f);je>0&&(Be.pass=je),nt>0&&(Be.dontPass=nt);for(const ur of[4,5,6,8,9,10]){const Er=W[ur]||0;Er>0&&(Be[`place${ur}`]=Er)}const Ct=Sc(R,f);Ct>0&&(Be.field=Ct);const Mt=Lu(N,f,ur=>ur.kind==="big6");Mt>0&&(Be.big6=Mt);const De=Lu(N,f,ur=>ur.kind==="big8");De>0&&(Be.big8=De);const et=Sc(L,f);et>0&&(Be.come=et);const at=Sc(j,f);at>0&&(Be.dontCome=at);const ke=Lu(z,f,ur=>ur.passType==="pass");ke>0&&(Be.oddsPass=ke);const st=Lu(z,f,ur=>ur.passType==="dontPass");st>0&&(Be.oddsDontPass=st);const kt=Lu(U,f,ur=>ur.kind==="atsSmall");kt>0&&(Be.atsSmall=kt);const nr=Lu(U,f,ur=>ur.kind==="atsTall");nr>0&&(Be.atsTall=nr);const lr=Lu(U,f,ur=>ur.kind==="atsAll");return lr>0&&(Be.atsAll=lr),Be},[f,D.myLine?.pass,D.myLine?.dontPass,O,I,W,R,N,L,j,z,U]),Z=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]),ae=v.useCallback(Be=>m(Be),[]),G=v.useRef(0),F=v.useCallback(()=>{if(!c||!f||!h.length)return;const Be=Date.now();if(!(Be-G.current<1e3)){G.current=Be;try{const je=Sc(O,f),nt=Sc(I,f),Ct=W;for(const Mt of h){const De=Mt.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(Mt.amount)||0),ke=Math.max(0,at-et);if(ke>0)try{A.addBet(De,ke)}catch{}}}catch{}}},[c,f,h,O,I,W,A]);Ra({onJoinedRoom:({room:Be})=>{Be?.id===c&&F()},onRejoinedRoom:({room:Be})=>{Be?.id===c&&F()}}),v.useEffect(()=>{if(!f)return;const Be=h.filter(je=>{if(je.type==="pass")return!(Sc(O,f)>=je.amount);if(je.type==="dontPass")return!(Sc(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]),ne=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:ee}=Qo(),{displayPoint:he,displayPhase:ce}=w_e(ne,ee);v.useEffect(()=>{if(ne.point==null&&ee){const Be=h.filter(je=>!je.type.startsWith("place"));Be.length!==h.length&&m(Be)}},[ne.point,ee,h]);const Pe=i?.gameState,Ge=D.readinessDeadline??null,se=D.requiredReadyPlayers??[],Ce=__e({roomId:c,userId:d,shooterState:_,roomGameState:Pe,pendingBets:h,myLineFromUnified:D.myLine,betsLastUpdated:D.betsState?.lastUpdated}),te=u?!0:Ce;v.useEffect(()=>{try{if(!u)return;window.__debugCanRoll={canRoll:te,userId:n?.id,rolling:b,shooterState:_,roomGS:Pe,readyPlayers:P,requiredReadyPlayers:se,readinessDeadline:Ge}}catch{}},[te,n,b,_,Pe,P,se,Ge,u]);const H=!c,pe=v.useMemo(()=>{const Be=i?.gameState?.currentRollerId;return f?Be===f:!1},[i?.gameState,f]),Re=!!(f&&P.includes(f)),[de,Ie]=v.useState(!1);v.useEffect(()=>{Re&&Ie(!1)},[Re]);const ct=v.useRef(null),Ve=v.useCallback(()=>{if(!(!c||!f||de||Re)){Ie(!0);try{T()}catch{}ct.current&&window.clearTimeout(ct.current),ct.current=window.setTimeout(()=>{Ie(!1)},5e3)}},[c,f,de,Re,T]);v.useEffect(()=>()=>{ct.current&&window.clearTimeout(ct.current)},[]);const[rt,Ke]=v.useState(Date.now());v.useEffect(()=>{if(!Ge)return;const Be=window.setInterval(()=>Ke(Date.now()),1e3);return()=>window.clearInterval(Be)},[Ge]);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,It=500,bt=v.useMemo(()=>[1,5,10,25,100],[]);return g.jsx(g_e,{roomId:c,balance:t,point:he,phase:ce,shooterName:it,minBet:Et,maxBet:It,oddsMultiple:{pass:3,dontPass:3,place:1},chips:bt,pendingBets:h,onChangeBets:ae,onClearAll:()=>{m([]),A.clearBets()},disabled:H,onRoll:()=>w(),canRoll:te,myPlayerPlaceTotal:q,myCommittedByType:Y,readyPlayers:P,meId:f,onBetDelta:K,showReadyButton:!pe,onReadyClick:Ve,readyStateLabel:"Ready",readyButtonDisabled:!1,recentSettlements:D.recentSettlements,myPlayerLineTotals:D.myLine,othersTotals:Z})}function E_e({balance:t,meId:e,readyPlayers:r}){return g.jsx("div",{className:"craps-bet-panel",children:g.jsx(S_e,{balance:t,meId:e,readyPlayers:r})})}function T_e(){const{infoNow:t}=Ts(),{room:e}=ji(),{meId:r}=Vr(),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 Ra({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 C_e(t,e){const{rollDice:r,placeMainBet:n,cancelMainBet:a,createSideBet:i,acceptSideBet:o,cancelSideBet:c,confirmBets:u,bankerGiveUp:d,setSpectate:f,getWagers:h}=ma(),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 x_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 P_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}=ma(),{joinRoom:u}=ji(),d=u,f=C_e(t||null),{reveal:h,rollTrigger:m,triggerSpin:_}=Qo(),{user:w}=Vr(),[b,E]=v.useState(null),{room:T}=ji(),P=(()=>{try{return ji&&ji()}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,z]=v.useState(!0),[U,W]=v.useState(void 0),[q,Y]=qE(t?`gp:${t}:${e}:deadline`:void 0,30),[Z,ae]=qE(t?`gp:${t}:${e}:serverNow`:void 0,30),[G,F]=qE(t?`gp:${t}:${e}:feed`:void 0,[]),[K,ne]=v.useState([]),[ee,he]=v.useState(null),[ce,Pe]=v.useState([]),[Ge,se]=v.useState(!1),[Ce,te]=v.useState(!1),H=v.useRef(null),pe=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){se(!1),te(!1),H.current&&(window.clearTimeout(H.current),H.current=null),pe.current=null;return}const et=(b.gameState?.gameMode||b.gameState?.mode)==="craps"?1:3;if(b.players.length>=et+1){Ce||te(!0),se(!1),H.current&&(window.clearTimeout(H.current),H.current=null),pe.current=null;return}Ce||(H.current||(H.current=window.setTimeout(()=>{se(!0),H.current=null},250)),pe.current?Date.now()>pe.current&&(te(!0),se(!1)):pe.current=Date.now()+5e3)},[b,Ce]);const Re=r?.listeners??!0;Ra(Re?{onJoinedRoom:({room:De})=>{E(De),F(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&&z(!0),L.current=null},ca.diceSettleClientMs));const et=De?.gameState||{};!et?.bankRoll&&!et?.lastRoll&&j===!1&&!N.current&&z(!0)}catch{}},onRejoinedRoom:({room:De})=>{E(De),F(et=>[{kind:"system",message:`Rejoined ${De.name}`,ts:Date.now()},...et])},onOtherLeft:({room:De})=>{E(De)},onOtherPlayerJoined:({room:De})=>{E(De),F(et=>[{kind:"system",message:"Another player joined.",ts:Date.now()},...et])},onSpectatorsUpdated:De=>{const{spectators:et,roundSeq:at}=De||{};E(ke=>{if(!ke)return ke;const st=ke.gameState?.roundSeq;return typeof at=="number"&&typeof st=="number"&&at!==st?ke:{...ke,gameState:{...ke.gameState,spectators:et??[]}}})},onDiceRolled:De=>{const{rollerId:et,results:at,rank:ke,room:st,deadline:kt,serverNow:nr}=De;Y(kt),z(!1),L.current&&(window.clearTimeout(L.current),L.current=null),N.current&&window.clearTimeout(N.current),N.current=window.setTimeout(()=>{z(!0),st&&E(st);try{N.current&&window.clearTimeout(N.current)}catch{}N.current=null},ca.diceSettleClientMs),ae(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: ${P_e(De.predicate)} for $${De.amount}`;o.info(at,{title:"New Side Bet"})},onLobbyRooms:void 0,onNotYourTurn:()=>{F(De=>[{kind:"system",message:"It’s not your turn.",ts:Date.now()},...De])},onForceLogout:De=>{De?.reason==="session_superseded"?(V3(),F(et=>[{kind:"system",message:"You logged in from another device.",ts:Date.now()},...et])):F(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);F(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:ke}=De||{},st=ke?.gameState??at;!et||!st||E(kt=>{if(!kt||kt.roomId!==et||kt?.id!==et)return{...kt,gameState:st};const nr=kt.gameState?.roundSeq,lr=st?.roundSeq,ur=typeof nr=="number"&&typeof lr=="number"&&nr!==lr,Er={...kt,gameState:{...kt.gameState,...st}};if(ur){try{z(!0)}catch{}try{W(void 0)}catch{}try{R(null)}catch{}}return Er})}}:{}),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||z(!0);try{N.current&&window.clearTimeout(N.current)}catch{}N.current=null}L.current=null},ca.diceSettleClientMs)):j===!0&&L.current&&(window.clearTimeout(L.current),L.current=null)},[j]);const Ie=v.useRef(null),ct=v.useRef(void 0),Ve=v.useRef(!1);Ie.current=d,v.useEffect(()=>{if(!a)return;let De=!1;if(ct.current!==t)return ct.current=t,Ve.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(ke){if(!et){I(ke?.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 ke=Date.now(),st=w?.id||"e2e-user",kt=w?.name||"E2E User",lr=((()=>{try{const J=new URLSearchParams(window.location.search).get("m");return J==="cee-lo"||J==="craps"?J:null}catch{return null}})()||(t?.toLowerCase().includes("ceelo")?"cee-lo":"craps"))==="cee-lo",ur=[{id:st,name:kt,isReady:!0,balance:1e3},{id:"bank",name:"Bank",isReady:!0,balance:1e6}],Er=lr?{id:t,name:"E2E Cee-Lo Room",gameMode:"cee-lo",createdAt:ke,updatedAt:ke,bankerId:st,players:ur,gameState:{gameMode:"cee-lo",currentRollerId:st,banker:st,turnOrder:[st],roundSeq:1,bankRoll:null,turnHistory:[]}}:{id:t,name:"E2E Craps Room",gameMode:"craps",createdAt:ke,updatedAt:ke,bankerId:"bank",players:ur,gameState:{gameMode:"craps",crapsPoint:null,currentRollerId:st,turnOrder:[st],roundSeq:1,crapsPassBets:[],crapsDontPassBets:[],crapsPlaceBets:[]}};E(Er);try{P?.(Er)}catch{}typeof window<"u"&&(window.__e2eRoomHydrated={id:Er.id,players:Er.players.map(dn=>dn.id),gameMode:Er.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(ke=>ke.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]),Ke=v.useMemo(()=>!b||!e?!1:(b.gameState||{})?.banker===e,[b,e]),{open:it,openAll:Et}=v0(t,e),It=v.useMemo(()=>(it||[]).some(De=>De.type==="MAIN"&&Number(De.amount)>0),[it]),bt=v.useMemo(()=>(Et||[]).some(De=>De.type==="MAIN"),[Et]),me=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 he(nr?null:rt?j?"Round transition in progress":"Dice not settled":"Not your turn"),Pe([]),nr}if(!De?.currentRollerId)return he("Initializing…"),Pe([]),!1;const ke=!b?.singlePlayer;if(Ke&&ke&&!bt)return he("No open challenges"),Pe([]),!1;const st=!!De?.bankRoll,kt=x_e({isMyTurn:rt,isBanker:Ke,diceSettled:j,hasMainBetPlaced:It,bankPointExists:st,roundEnded:at});return he(kt.reason??null),Pe([]),kt.canRoll},[b?.gameState,T?.gameState,rt,Ke,It,j,bt,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(Ke&&De&&!bt){try{n("No open challenges")}catch{}return}if(!Ke&&!It){try{n("No open challenges")}catch{}return}try{rp("roll_click",{game:"cee-lo",role:Ke?"banker":"challenger"})}catch{}try{N.current&&(window.clearTimeout(N.current),N.current=null),L.current&&(window.clearTimeout(L.current),L.current=null)}catch{}z(!1),_(),(async()=>{const et=await f.roll(),at=et?.error||et?.message||"";if(!et||et.ok===!1){if(z(!0),/no open main bets/i.test(at)){const ke=!!b?.singlePlayer;try{f.refreshWagers()}catch{}if(!ke||!Ke)try{n("No open challenges")}catch{}return}return}})()},[t,f,_,Be,Ke,It,bt,b?.gameState]),Ct=v.useCallback(async()=>{if(t)return f.giveUpBank?.()},[t,f]),Mt=v.useCallback(async De=>{if(t)return f.spectate?.(De)},[t,f]);return{room:b,joining:A,botsHydrating:Ge,error:O,isMyTurn:rt,isBanker:Ke,lastRollerId:x,rollTrigger:m,diceSettled:j,diceResults:U,deadline:q,serverNow:Z,canRoll:Be,canRollReason:ee,canRollBlocking:ce,handleRoll:nt,handleLeave:je,giveUpBank:Ct,setSpectateMode:Mt,currentRollerId:me,readyPlayers:K}}function A_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{Lr()}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,z=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(Js,{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||z||f,title:f?"Dealer rolled – side bets closed":j?"Subject already rolled this round":z?"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,z=P(j?L||void 0:x.playerId),U=!!L,W=j&&!U&&!f&&!!n,q=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(Js,{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 ${z}`:"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":q||"Cannot cancel",disabled:!W||!!u,onClick:async()=>{if(!W)return;try{Lr()}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 R_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{Lr()}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{Lr()}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,z=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(A_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&&z.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 D_e=new TextEncoder;function O_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 N_e(t){const e=await crypto.subtle.digest("SHA-256",D_e.encode(t));return O_e(e)}async function I_e(t,e){return!t||!e?!1:(await N_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]),Ra({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 I_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 oa=null,w_=null,XC=null;async function Gg(){if(oa)return!0;try{const t=await zr(()=>import("./index-D3SeAFCy.js"),[],import.meta.url);return oa=t.AdMob,w_=t.RewardAdPluginEvents,XC=t.InterstitialAdPluginEvents,!0}catch{return!1}}let mp=!1;async function Mp(){if(mp)return!0;if(Wr.getPlatform()==="web"||!await Gg()||!oa)return!1;try{return await oa.initialize({requestTrackingAuthorization:!0,initializeForTesting:Wg??!1}),mp=!0,!0}catch{return!1}}const Wg=typeof process<"u"&&!1;function t6(){const t=Wr.getPlatform();return t==="ios"?A9:XD}function r6(){const t=Wr.getPlatform();return t==="ios"?j9:JD}async function M_e(){if(Wr.getPlatform()==="web"||!await Gg()||!oa)return!1;mp||await Mp();try{const r=t6();return await oa.prepareRewardVideoAd({adId:r,isTesting:Wg??!1}),!0}catch{return!1}}async function j_e(){return Wr.getPlatform()==="web"?{ok:!1,error:"NOT_NATIVE"}:!await Gg()||!oa?{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=oa.addListener(w_.Rewarded,f=>{n=!0,a=f?.type||"chips",i=f?.amount||hf}),c=oa.addListener(w_.Dismissed,()=>{d(),r(n?{ok:!0,rewardType:a,rewardAmount:i}:{ok:!1,error:"AD_DISMISSED"})}),u=oa.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 oa.prepareRewardVideoAd({adId:f,isTesting:Wg??!1}),await oa.showRewardVideoAd()}catch(f){d(),r({ok:!1,error:f?.message||"UNKNOWN_ERROR"})}})}async function Nf(){if(Wr.getPlatform()==="web"||!await Gg()||!oa)return!1;mp||await Mp();try{const r=r6();return await oa.prepareInterstitial({adId:r,isTesting:Wg??!1}),!0}catch{return!1}}async function S_(){return Wr.getPlatform()==="web"?{ok:!1,error:"NOT_NATIVE"}:!await Gg()||!oa?{ok:!1,error:"PLUGIN_NOT_AVAILABLE"}:!mp&&!await Mp()?{ok:!1,error:"INIT_FAILED"}:new Promise(async r=>{const n=oa.addListener(XC.Dismissed,()=>{i(),r({ok:!0}),Nf().catch(()=>{})}),a=oa.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 oa.prepareInterstitial({adId:o,isTesting:Wg??!1}),await oa.showInterstitial()}catch(o){i(),r({ok:!1,error:o?.message||"UNKNOWN_ERROR"})}})}function n6(){const t=Wr.getPlatform();return t==="ios"||t==="android"}const $E={initializeAdMob:Mp,prepareRewardedAd:M_e,showRewardedAd:j_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 L_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=Ii();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=li();async function B_e(t){if(!t)return null;try{const e=await ci(),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 U_e(t){if(!t)return null;try{const e=await ci(),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 F_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=F_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 q_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 z_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 $_e=v.memo(q_e,z_e),g6=v.createContext(void 0),V_e=({children:t})=>{const{user:e}=Vr(),[r,n]=v.useState([]),[a,i]=v.useState([]),[o,c]=v.useState([]),{blockUser:u,unblockUser:d,getFriendsList:f,sendFriendRequest:h,unfriend:m,respondFriendRequest:_}=ma();Ra({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(z=>[...z.filter(U=>!(U.id===N||U.fromUserId===e.id&&U.toUserId===x&&U.id.startsWith("temp:"))),j.request]):w():i(z=>z.filter(U=>U.id!==N))}).catch(()=>{i(j=>j.filter(z=>z.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 H_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(Xs.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($_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 G_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 W_e({seed:t}){const e=G_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(W_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 K_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 Y_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 X_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(Y_e(t.predicate)),t.subjectId&&_.push(`on ${t.subjectId}`),_.length&&(o=_.join(" "))}}return{outcome:n,isChallenger:a,subtitle:o,needsAnimation:i}}function J_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 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-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",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-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",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-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",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.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",rbe="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",nbe="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",abe={1:Q_e,2:Z_e,3:ebe,4:tbe,5:rbe,6:nbe};function ibe({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:abe[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={...Oc,...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(Xs.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(Js,{mini:!0,value:w.value,className:"chip--flight"})},w.id)})})()})}const JC=new Set;function sbe(t){return JC.add(t),()=>JC.delete(t)}function obe(t){t&&JC.forEach(e=>{try{e(t)}catch{}})}function cbe({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=>J_e(R,P),[P]),C=v.useCallback((R,N=0)=>{if(c&&R?.type==="MAIN"){const Z=R?.playerId,ae=R?.acceptedById||R?.bankerId;if(!(!!Z&&c(Z)&&!!ae&&c(ae))){T(setTimeout(()=>C(R,N),120));return}}const j=R?.acceptedById||R?.bankerId,z=R?.playerId;if(!j||!z){if(N>25)return;const Z=80+N*60;T(setTimeout(()=>C(R,N+1),Z));return}const U=String(R.result||"").toUpperCase();let W,q;if(U==="WIN"?(W=j,q=z):U==="LOSE"&&(W=z,q=j),W&&q){const Z=P(W),ae=P(q);if(!Z||!ae){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 Z=80+N*60;N<5&&typeof requestAnimationFrame<"u"?b.current=requestAnimationFrame(()=>C(R,N+1)):T(setTimeout(()=>C(R,N+1),Z));return}f(Z=>[...Z,[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(z=>z.id!==R),j=N.find(z=>z.id===R);try{j?.settlementId&&typeof u=="function"&&u(j.settlementId),j?.settlementId&&(obe(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 lbe(){const{hasActive:t}=Ts(),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=ca?.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 ube({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}=Ts(),m=v.useRef(new Set),{schedule:_,nudge:w}=lbe(),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 ee=O.subjectId&&a(O.subjectId)||O.subjectId||"Player",he=X_e(O.predicate);let ce;I==="win"?ce=`${ee} ${he}`:I==="lose"?he==="beats banker"?ce=`${ee} does not beat banker`:he==="loses to banker"?ce=`${ee} does not lose to banker`:he==="ties banker"?ce=`${ee} does not tie banker`:ce=`${ee} ${he}`:ce=`${ee} ${he}`,L=ce,j=!0}else R&&O.subjectId&&R.includes("on ")&&(L=R.replace(/on \S+$/,`on ${a(O.subjectId)||O.subjectId}`));try{const ee=md(O,r);if(ee&&ee.label&&!(O.type==="SIDE"&&j)){const ce=String(ee.label||"").trim(),Pe=String(L||"").trim();if(Pe.length===0)L=ce;else if(ce.length>0){const Ge=Pe.toLowerCase(),se=ce.toLowerCase();Ge.includes(se)||(L=`${Pe} — ${ce}`)}}}catch{}I==="push"&&((L||"").trim()||(L="No Action"));const z=O.type==="SIDE"?O.subjectId||void 0:O.playerId,U=O.type==="SIDE"?u:O.acceptedById||O.bankerId||u,W=!!(E.current||T.current),q=W||O.type==="SIDE"?!1:N,Y=W?!0:!q,Z=!W&&q?ca.diceToChipDelayMs+50:0,ae=z,G=U,F=o?ca.revealFlashPostDelayMs:0,K=o&&!W?{getRevealTime:o,challengerId:ae,bankerId:G,postRevealDelayMs:F}:void 0,ne=K?0:q?Z:0;O.type==="MAIN"?_(()=>{let he;try{const Ge=md(O,r);he=String(Ge?.label||"").trim()||void 0}catch{}let ce;try{if(i&&u){const Ge=i(u),se=i(O.playerId);if(Ge&&se){const Ce=wb(Ge),te=wb(se);Ce.kind==="456"?ce="Banker rolled 4-5-6":Ce.kind==="123"?ce="Banker rolled 1-2-3":te.kind==="456"?ce="Challenger rolled 4-5-6":te.kind==="123"?ce="Challenger rolled 1-2-3":Ce.kind==="triple"&&te.kind==="point"?ce="Trips beat point":Ce.kind==="point"&&te.kind==="triple"?ce="Point loses to trips":Ce.kind==="triple"&&te.kind==="triple"?ce=Ce.score===te.score?"Equal trips (push)":"Higher trips win":typeof Ce.point=="number"&&typeof te.point=="number"&&(Ce.point===te.point?ce="Same point (push)":ce=`${Math.max(Ce.point,te.point)} beats ${Math.min(Ce.point,te.point)}!`),ce||(I==="win"?ce=x?te.label||"Win":Ce.label||"Win":I==="lose"?ce=x?Ce.label||"Loss":te.label||"Loss":ce=void 0)}}}catch{}let Pe;I==="push"?Pe=ce||he||"No Action":he&&ce?Pe=`${he} ${ce}`:Pe=he||ce,P(I,x,Pe,void 0,j)},{immediate:W?!0:Y&&!K,delayMs:ne,revealGate:K,key:String(O.id)}):A(I,x,L,void 0,j,{immediate:W?!0:Y&&!K,delayMs:ne,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=sbe(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 dbe({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{rr("Light")}catch{}e()}},[t,e]),h=v.useCallback(()=>{c.current=setTimeout(()=>{if(o(!0),t){try{rr("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(fbe,{}),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 fbe(){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 pbe({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{rr("Light")}catch{}o(!i)},[i,o]),b=v.useCallback(()=>{try{rr("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{rr("Medium")}catch{}d(r),n?.(),e()},[r,d,n,e]),D=v.useCallback(()=>{try{rr("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 hbe({roomId:t,isUserTurn:e=!1,leftSlot:r}){gu();const{user:n}=Vr(),[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{rr("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{Lr()}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(dbe,{isUserTurn:e,onOpen:m,isConnected:!!t})}),g.jsx(pbe,{open:o,onClose:()=>c(!1),roomId:t}),g.jsx(S6,{open:a,onClose:()=>i(!1)})]})}const E6=v.createContext(void 0),mbe=({children:t})=>{const[e,r]=v.useState([]),[n,a]=v.useState(null),{sendGameInvite:i,respondGameInvite:o}=ma(),c=cu();Ra({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 gbe({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(),z=gu(),{remoteStreams:U,myVideo:W,remoteVideoFlags:q}=z,{proofs:Y,reveals:Z,verifyFor:ae}=e6(c),{user:G,refreshUser:F}=Vr(),K=(()=>{try{return G?.isGuest===!0}catch{return!1}})(),[ne,ee]=v.useState(!1),[he,ce]=v.useState({}),{settledAll:Pe,playerBalance:Ge,mySettledAll:se,newSettlements:Ce,openAllMain:te}=v0(c,i),{leaveRoom:H}=ma();o?.betsLocked;const pe=v.useCallback(()=>{if(o?.gameMode==="poker"){c&&H(c),O("/lobby");return}C()},[o,c,H,O,C]),Re=v.useCallback(_e=>()=>{try{rr("Light")}catch{}try{}catch{}_e()},[]),de=v.useMemo(()=>r.find(_e=>_e.id===i)?.balance,[r,i]),Ie=o?.gameMode,ct=(()=>{const _e=typeof Ge=="number"?Ge:void 0,Ze=typeof de=="number"?de:void 0;return Ie==="craps"?Ze??_e??0:_e??Ze??0})(),[Ve,rt]=v.useState(ct),[Ke,it]=v.useState(!1),Et=v.useRef(ct),It=v.useRef(new Set),bt=v.useRef({}),me=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,Ot=(Array.isArray(o?.pokerSeats)?o.pokerSeats:[]).find(Nr=>Nr.playerId===_e.id);if(Ot&&typeof Ot.stack=="number")return Math.max(0,Ot.stack);const Ht=typeof Ot?.committed=="number"?Ot.committed:0;return Math.max(0,ot-Ht)}return _e.id===i?Number(Ve??0):typeof _e.balance=="number"?_e.balance:0},[o,i,Ve]),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]),Mt=v.useRef(void 0),De=v.useRef(new Map);v.useEffect(()=>{if(o?.gameMode!=="poker")return;const Ze=t.roomId||"unknown";Mt.current!==Ze&&(Mt.current=Ze,De.current=new Map);const ot=De.current;let Je=-1;ot.forEach(Ot=>{Ot>Je&&(Je=Ot)});for(const Ot of nt)ot.has(Ot.id)||(Je+=1,ot.set(Ot.id,Je))},[nt,t.roomId,o?.gameMode]);const et=v.useMemo(()=>{if(o?.gameMode==="poker"){const Ht=De.current;return nt.map(Nr=>Nr.id).slice().sort((Nr,nn)=>(Ht.get(Nr)??0)-(Ht.get(nn)??0))}const Ze=Array.isArray(o?.turnOrder)?o.turnOrder:[];if(!Ze.length)return r.map(Ht=>Ht.id);const ot=new Set(r.map(Ht=>Ht.id)),Je=Ze.filter(Ht=>ot.has(Ht)),Ot=r.map(Ht=>Ht.id).filter(Ht=>!Je.includes(Ht));return[...Je,...Ot]},[nt,r,o?.turnOrder,o?.gameMode]),at=o.roundSeq??1;v.useEffect(()=>{if(!(!Ce||!Ce.length)){for(const _e of Ce){if(!_e||_e.roundSeq!==at||It.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;It.current.add(_e.id);let Je=0,Ot=0;try{const xn=md(_e,i);xn&&(xn.myResult==="WIN"?Je=xn.myPayout||0:xn.myResult==="LOSE"&&(Ot=_e.amount||0))}catch{}const Ht=Je>0?Je:Ot>0?-Ot:0;if(Ht===0)continue;const Nr=ot.needsAnimation?2e3:0,nn=window.setTimeout(()=>{rt(xn=>xn+Ht),it(!0),window.setTimeout(()=>it(!1),2e3),delete bt.current[_e.id]},Nr);bt.current[_e.id]=nn}return()=>{Object.values(bt.current).forEach(_e=>window.clearTimeout(_e)),bt.current={}}}},[Ce,at,i,F]);const ke=v.useMemo(()=>typeof o.roundSeq=="number"?(o.turnHistory??[]).filter(_e=>_e.roundSeq===o.roundSeq):o.turnHistory??[],[o.turnHistory,o.roundSeq]),[st,kt]=v.useState(!1),[nr,lr]=v.useState(0),[ur,Er]=v.useState(void 0);v.useEffect(()=>{if(!(!Ce||!Ce.length||o?.gameMode==="poker"))for(const Ze of Ce){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);lr(Je>0?Je:0),Er(void 0),kt(!0);break}}},[Ce,at,i,o]);const[dn,J]=v.useState(null),[ue,ve]=v.useState(null),[Ae,B]=v.useState(!1),[Q,oe]=v.useState(!1),Ne=v.useRef(null),[pt,Rt]=v.useState(new Map),{sendVisibilityChange:Ut}=ma();v.useEffect(()=>{J(null)},[c]);const dr=v.useCallback(async()=>{if(c)try{const _e=await B_e(c);_e&&J(_e)}catch{}},[c]),hn=v.useCallback(async()=>{if(c)try{B(!0);const _e=await U_e(c);ve(_e||null)}catch{ve(null)}finally{B(!1)}},[c]);v.useEffect(()=>{Q&&o?.gameMode==="craps"&&dr()},[Q,o,dr]),v.useEffect(()=>{if(!c||!Y||typeof Y!="object")return;let _e=!1;const Ze=at,ot=`${Ze}:`,Je=Object.keys(Y||{}).filter(Ot=>Ot.startsWith(ot));if(Je.length)return Je.forEach(Ot=>{const Ht=Ot.split(":")[1];Ht&&(async()=>{try{const Nr=await ae(Ht,Ze);_e||ce(nn=>nn[Ot]===Nr?nn:{...nn,[Ot]:Nr})}catch{_e||ce(Nr=>Nr[Ot]==="unverifiable"?Nr:{...Nr,[Ot]:"unverifiable"})}})()}),()=>{_e=!0}},[Y,Z,ae,c,at]);const rn=v.useMemo(()=>{if(!n)return null;for(let _e=ke.length-1;_e>=0;_e--){const Ze=ke[_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,ke,o.bankRoll]),{revealedPlayers:Fe,revealTimesRef:Zt}=K_e(ke,n,o,at),{show:Ft,activeKind:qt,hasActive:xt,onIdle:fn,info:bn}=Ts(),Fn=v.useRef(new Set),la=v.useRef(!1);v.useEffect(()=>{if(!la.current){const _e=new Set(r.map(Ze=>String(Ze.id)));Fn.current=_e,la.current=!0}},[r]);const Zn=v.useRef(new Map),mr=v.useRef({}),rc=v.useMemo(()=>{const _e=new Map;try{const Ze=Array.isArray(te)?te:[];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},[te,at]);v.useEffect(()=>{try{for(const _e of r){const Ze=String(_e.id);if(!Fe.get(Ze))continue;const ot=jE(Ze,ke,n,o.bankRoll,rn);if(!ot||ot.length!==3)continue;const Je=`${at}:${[...ot].sort((nn,xn)=>nn-xn).join("")}`;if(Zn.current.get(Ze)===Je)continue;Zn.current.set(Ze,Je);const Ht=mr.current[Ze];Ht&&(window.clearTimeout(Ht),mr.current[Ze]=null);const Nr=_e?.name||_e?.email||Ze;mr.current[Ze]=window.setTimeout(()=>{const nn=()=>{const xn=wb(ot);Ft({kind:"roll",title:String((n&&Ze===n?"Banker":Nr)||Ze),subtitle:`${xn.label}`,duration:500})};xt&&["win","lose","push"].includes(qt||"")?fn(nn):nn(),mr.current[Ze]=null},1e3)}}catch{}return()=>{try{Object.values(mr.current).forEach(_e=>{_e&&window.clearTimeout(_e)}),mr.current={}}catch{}}},[r,Fe,ke,n,rn,at,xt,qt,fn,Ft,o.bankRoll]);const $i=v.useRef({});v.useRef(0),v.useRef(null),Ra({onOtherPlayerJoined:({room:_e})=>{try{if(!_e||!Array.isArray(_e.players))return;const Ze=Fn.current,ot=new Set(_e.players.map(Ot=>String(Ot.id)));if(!la.current){Fn.current=ot,la.current=!0;return}const Je=[...ot].filter(Ot=>!Ze.has(Ot));if(Je.length>0){const Ot=new Map(_e.players.map(Ht=>[String(Ht.id),Ht]));for(const Ht of Je){if(Ht===i)continue;const Nr=Ot.get(Ht),nn=Nr?.name||Nr?.email||Ht;try{bn&&bn("Player Joined",String(nn))}catch{}}}Fn.current=ot}catch{}},onOtherLeft:({room:_e})=>{try{if(!_e||!Array.isArray(_e.players))return;const Ze=Fn.current,ot=new Set(_e.players.map(Ot=>String(Ot.id)));if(!la.current){Fn.current=ot,la.current=!0;return}const Je=[...Ze].filter(Ot=>!ot.has(Ot));if(Je.length>0){const Ot=new Map;try{r.forEach(Ht=>Ot.set(String(Ht.id),Ht.name||Ht.email||String(Ht.id)))}catch{}for(const Ht of Je){if(Ht===i)continue;const Nr=Ot.get(Ht)||Ht;try{bn&&bn("Player Left",String(Nr))}catch{}}}Fn.current=ot}catch{}},onPlayerBalanceUpdated:({playerId:_e,balance:Ze})=>{_e===i&&(Object.values(bt.current).forEach(ot=>window.clearTimeout(ot)),bt.current={},It.current.clear(),me.current=!0,Et.current=Ze,rt(Ze),it(!0),window.setTimeout(()=>it(!1),2e3))},onCrapsBetResults:_e=>{!_e||_e.roomId!==c||(Ne.current&&window.clearTimeout(Ne.current),Ne.current=window.setTimeout(()=>{dr()},350))},onCrapsBetsUpdate:_e=>{!_e||_e.roomId!==c||(Ne.current&&window.clearTimeout(Ne.current),Ne.current=window.setTimeout(()=>{dr()},250))},onCrapsPointSet:_e=>{!_e||_e.roomId!==c||(Ne.current&&window.clearTimeout(Ne.current),Ne.current=window.setTimeout(()=>{dr()},300))},onCrapsPointMade:_e=>{!_e||_e.roomId!==c||(Ne.current&&window.clearTimeout(Ne.current),Ne.current=window.setTimeout(()=>{dr()},300))},onPlayerPresenceUpdate:_e=>{if(!_e||_e.roomId!==c)return;const{playerId:Ze,status:ot}=_e;!Ze||!ot||Rt(Je=>{const Ot=new Map(Je);return Ot.set(Ze,ot),Ot})}}),v.useEffect(()=>()=>{Ne.current&&window.clearTimeout(Ne.current)},[]),v.useEffect(()=>{if(!c)return;const _e=()=>{const ot=!document.hidden;Ut(c,ot)};Ut(c,!document.hidden),document.addEventListener("visibilitychange",_e);let Ze=null;return(async()=>{try{const{App:ot}=await zr(async()=>{const{App:Je}=await Promise.resolve().then(()=>eW);return{App:Je}},void 0,import.meta.url);Ze=await ot.addListener("appStateChange",Je=>{Ut(c,Je.isActive)})}catch{}})(),()=>{document.removeEventListener("visibilitychange",_e),Ze&&typeof Ze.remove=="function"&&Ze.remove()}},[c,Ut]);const Cs=v.useCallback(_e=>{let Ze=$i.current[_e];if(Ze&&Ze.getAttribute("data-player-id")!==_e&&(Ze=null),!Ze)try{const Ot=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="${Ot}"]`)}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}},[]),bi=v.useRef(ke.length),ea=v.useRef(null),mn=v.useRef(null),xs=v.useRef(null);v.useEffect(()=>{bi.current=ke.length},[at]),v.useEffect(()=>{xs.current=null},[at]);const{forUserId:Ps,anchorRect:As,anchorEl:Vi,openFor:Lp,close:kd}=qA(),wd=(_e,Ze)=>{!Ze||_e===i||Lp(_e,Ze)},Bp=()=>kd(),nc=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 Pe){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,Pe]),uo=v.useCallback(_e=>nc.get(_e||"")||_e||"Unknown",[nc]),ya=v.useCallback(_e=>uo(_e),[uo]),va=v.useCallback(_e=>jE(_e,ke,n,o.bankRoll,rn),[ke,n,o.bankRoll,rn]);ube({newSettlements:Ce,roundSeqNow:at,myId:i,bankerDice:rn,getPlayerName:ya,getPlayerDice:va,getRevealTime:_e=>Zt?.current?.get?.(_e),postRevealDelayMs:0,bankerId:n});const Ua=v.useRef(null);v.useEffect(()=>{!(o?.gameMode==="cee-lo"||o?.gameMode==="ceeLo"||!o?.gameMode)||!Ce.length||!Ce.filter(ot=>ot.playerId===i||ot.bankerId===i).length||Ua.current!==at&&(Ua.current=at,setTimeout(async()=>{try{await j()}catch{}},2500))},[Ce,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||!(Fe.get(_e)===!0))return!1;const ot=Zt?.current?.get?.(_e);return(typeof ot=="number"?performance.now()-ot:0)>=ca.diceToChipDelayMs},[Yc,Fe,Zt]),{activeBatch:fo,handleAnimItemComplete:Sd,resetForRound:ua}=cbe({newSettlements:Ce,roundSeqNow:at,getAvatarCenter:Cs,getPlayerName:ya,myId:i,bankerDice:rn,bankerId:n,isPartyReady:Xc});v.useEffect(()=>{ua()},[at,ua]);const po=v.useRef(null),ki=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&&po.current==null&&(po.current=Date.now());const Ot=po.current||0,Ht=Ot>0?Date.now()-Ot:Number.POSITIVE_INFINITY,Nr=ot&&Ht<=Je,nn=Array.isArray(o?.pokerSeats)?o.pokerSeats:[],xn=typeof o?.pokerActingSeat=="number"?o.pokerActingSeat:void 0,da=typeof xn=="number"&&nn.find(Rs=>Rs.seatIndex===xn)?.playerId||null;return Nr?ki.current??da??null:(ki.current=da??null,po.current=null,da??null)}return(o?.currentRollerId??a)||null},[o?.gameMode,o?.pokerSeats,o?.pokerActingSeat,o?.currentRollerId,a]);return v.useEffect(()=>{const _e=mn.current,Ze=Jc||void 0;if(!_e||!Ze||xs.current===Ze)return;const ot=$i.current[Ze];if(!ot)return;const Je=()=>{try{const Ot=Math.max(0,Math.min(ot.offsetLeft-_e.clientWidth/2+ot.offsetWidth/2,_e.scrollWidth-_e.clientWidth));_e.scrollTo({left:Ot,behavior:"smooth"}),xs.current=Ze}catch{}};return ea.current&&clearTimeout(ea.current),ea.current=setTimeout(()=>{typeof requestAnimationFrame<"u"?requestAnimationFrame(Je):Je()},100),()=>{ea.current&&(clearTimeout(ea.current),ea.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(pe),"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){ee(!0);return}I()});return g.jsx("a",{className:"gold-link balance-display"+(_e?" disabled":"")+(Ke?" 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(Ve,"",0)]})})})(),g.jsx("a",{role:"button",className:"gold-link white-link"+(t.historyHalo?" history-halo":""),onClick:Re(()=>{if(K){ee(!0);return}const _e=o?.gameMode;_e==="craps"?(dr(),oe(!0)):_e==="poker"?t.onOpenHistory&&t.onOpenHistory():hn().then(()=>oe(!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(gbe,{roomId:c,gameMode:o?.gameMode||"cee-lo"}),g.jsx(hbe,{roomId:c,leftSlot:A}),_?g.jsx("div",{className:"panel-header-extras",children:_}):null]})]})}),fo.length>0&&g.jsxs("div",{style:{position:"fixed",inset:0,pointerEvents:"none",zIndex:1e4},children:[fo.map(_e=>g.jsx(w6,{anim:_e,onComplete:()=>Sd(_e.id)},_e.id)),!1]}),g.jsx("div",{className:"chip-fly-container",children:g.jsx(Xs.ul,{className:"players players--avatars",role:"list",ref:mn,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,Ot=[];if(o?.gameMode==="poker"){const Br=o,ta=Array.isArray(Br.pokerSeats)?Br.pokerSeats:[],ra=typeof Br.pokerDealerSeat=="number"?Br.pokerDealerSeat:void 0,Fa=ta.find(Oa=>Oa.playerId===Je);if(Fa&&typeof ra=="number"){Fa.seatIndex===ra&&Ot.push("D");const Oa=ta.filter(qn=>!!qn.playerId).map(qn=>qn.seatIndex).sort((qn,Gi)=>qn-Gi),na=Oa.length;if(na>=2){const qn=Oa.indexOf(ra);if(qn!==-1){let Gi,ac;na===2?(Gi=ra,ac=Oa[(qn+1)%na]):(Gi=Oa[(qn+1)%na],ac=Oa[(qn+2)%na]),Fa.seatIndex===Gi&&Ot.push("SB"),typeof ac=="number"&&Fa.seatIndex===ac&&Ot.push("BB")}}}}Je===Ze&&!Fe.get(Je)&&Ot.push("Rolling"),Je===Ze&&Ot.push("Shooter");let Ht=!1;if(o?.gameMode==="poker"){const Br=o,ta=typeof Br.pokerActingSeat=="number"?Br.pokerActingSeat:void 0;typeof ta=="number"&&Array.isArray(Br.pokerSeats)&&(Ht=Br.pokerSeats.find(Fa=>Fa.seatIndex===ta)?.playerId===Je)}else Ht=Je===Ze;let Nr=!1;if(o?.gameMode==="poker"){const ta=(Array.isArray(o?.pokerSeats)?o.pokerSeats:[]).find(ra=>ra.playerId===Je);ta&&String(ta.status||"").toLowerCase()==="folded"&&(Nr=!0)}const nn=Je===i?W:U[Je],xn=q[Je]?nn:void 0,da=!w&&Fe.get(Je)?jE(Je,ke,n,o.bankRoll,rn):null;let Rs=!w&&da&&Array.isArray(da)&&da.length===3&&!da.every(Br=>Br===0)&&Sm(da)!=="nothing"?g.jsx(ibe,{dice:da}):null;const Qc=(o.spectators??[]).includes(Je);let Ds;if(P)Ds=P(ot);else if(Qc)Ds=null;else if(Yc&&!Fe.get(Je)){const Br=rc.get(Je);Ds=typeof Br=="number"&&Br>0?g.jsxs("span",{className:"player-bet-pill","aria-label":`Bet z${rd.formatMoney(Br,"",0)}`,children:["z",rd.formatMoney(Br,"",0)]}):null}else Ds=Rs;const wi=o?.gameMode==="poker",Si=vu&&(Je.startsWith("craps_bot_")||Je.startsWith("bot_")),Hi=je(ot),ho=Si?void 0:Number.isFinite(Hi)?Hi:void 0;return g.jsx(H_e,{ref:Br=>{$i.current[Je]=Br},id:Je,display:ot.name??ot.email??Je,isCurrentRoller:Ht,isMe:Je===i,balance:ho,isSpectating:Qc,folded:Nr,tags:Ot,stream:xn,isMuted:Je===i,diceResult:Ds,onOpenMenu:(Br,ta)=>wd(Br,ta),showMenu:Ps===Je,menuProps:Ps===Je?{targetId:Je,anchorRect:As,anchorEl:Vi,onClose:Bp,onOpenDM:u,onOpenSendMoney:d,meId:i}:null,forceHideVideo:!q[Je],avatarUrl:ot.avatarUrl,showActingTimerRing:wi,presenceStatus:pt.get(Je)},Je)})})}),Q&&g.jsx(gq,{onClose:()=>oe(!1),items:Array.isArray(ue)&&ue.length>0?ue:se,meId:i,nameOf:uo,crapsRollHistory:E,gameMode:o?.gameMode,crapsLedgerItems:(dn||[]).slice().sort((_e,Ze)=>Number(Ze.ts)-Number(_e.ts))}),g.jsx(S6,{open:ne,onClose:()=>ee(!1),message:"This feature is for logged in users."})]})}function ybe(t){const{gameState:e,roomId:r,meId:n}=t,{show:a,hasActive:i,activeKind:o,onIdle:c,rollNow:u}=Ts(),{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}=Qo(),{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}},ca.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}},ca.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}},ca.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}},ca.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=de=>{const Ie=de.betType;return Ie==="pass"||Ie==="dontPass"||Ie.startsWith("place")||Ie==="field"||Ie==="big6"||Ie==="big8"||Ie==="come"||Ie==="dontCome"},L=P.filter(de=>(R?de.playerId===R:!0)&&N(de));if(!L.length)return;const j=A?._seq||0,z=typeof A?.total=="number"?A.total:Array.isArray(A?.dice)?A.dice[0]+A.dice[1]:"",U=L.map(de=>`${de.betType}:${de.outcome}:${de.amount}:${de.payout}`).sort().join("|"),W=`${j}:${z}:${U}`;if(E.current===W)return;E.current=W;const q=L.filter(de=>de.betType==="pass"||de.betType==="dontPass"),Y=L.filter(de=>de.betType.startsWith("place")&&de.outcome==="WIN"),Z=L.filter(de=>de.betType==="field"),ae=L.filter(de=>de.betType==="big6"||de.betType==="big8"),G=L.filter(de=>de.betType==="come"||de.betType==="dontCome"),F=q.some(de=>de.outcome==="WIN"),K=Y.length>0,ne=Z.some(de=>de.outcome==="WIN"),ee=ae.some(de=>de.outcome==="WIN"),he=G.some(de=>de.outcome==="WIN"),ce=q.some(de=>de.outcome==="LOSE"),Pe=Z.some(de=>de.outcome==="LOSE"),Ge=ae.some(de=>de.outcome==="LOSE"),se=G.some(de=>de.outcome==="LOSE"),Ce=G.some(de=>de.outcome==="PUSH"),te=!F&&!ce&&q.some(de=>de.outcome==="PUSH");let H="",pe="";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 de=typeof z=="number"?z:Number(z),Ie=A?.currentRollerId,ct=Y.some(Ve=>{const rt=Number(String(Ve.betType).replace(/^place/,""));return Number.isFinite(rt)&&rt===de});if(F){if(K&&ct&&n&&Ie===n){const rt=Y.reduce((Ke,it)=>Ke+it.payout,0);H=Y.length>1?"Place Wins":"Place Win",pe=`+${rt}`,a({kind:"win",title:H,subtitle:pe,duration:1e3});return}const Ve=q.filter(rt=>rt.outcome==="WIN").reduce((rt,Ke)=>rt+(Ke.payout+Ke.amount),0);H="Line Win",pe=`+${Ve}`,a({kind:"win",title:H,subtitle:pe,duration:1100});return}if(K){const Ve=Y.reduce((rt,Ke)=>rt+Ke.payout,0);H=Y.length>1?"Place Wins":"Place Win",pe=`+${Ve}`,a({kind:"win",title:H,subtitle:pe,duration:1e3});return}if(ne){const Ve=Z.filter(rt=>rt.outcome==="WIN").reduce((rt,Ke)=>rt+Ke.payout,0);H="Field Win",pe=`+${Ve}`,a({kind:"win",title:H,subtitle:pe,duration:1e3});return}if(ee){const Ve=ae.filter(it=>it.outcome==="WIN"),rt=Ve.reduce((it,Et)=>it+Et.payout,0);H=Ve.length>1?"Big Wins":Ve[0]?.betType==="big6"?"Big 6 Win":"Big 8 Win",pe=`+${rt}`,a({kind:"win",title:H,subtitle:pe,duration:1e3});return}if(he){const Ve=G.filter(it=>it.outcome==="WIN"),rt=Ve.reduce((it,Et)=>it+Et.payout,0);H=Ve.length>1?"Come Wins":Ve[0]?.betType==="dontCome"?"DC Win":"Come Win",pe=`+${rt}`,a({kind:"win",title:H,subtitle:pe,duration:1e3});return}if(ce){const Ve=q.filter(rt=>rt.outcome==="LOSE").reduce((rt,Ke)=>rt+Ke.amount,0);H="Line Lose",pe=`-${Ve}`,a({kind:"lose",title:H,subtitle:pe,duration:1100});return}if(Pe){const Ve=Z.filter(rt=>rt.outcome==="LOSE").reduce((rt,Ke)=>rt+Ke.amount,0);H="Field Lose",pe=`-${Ve}`,a({kind:"lose",title:H,subtitle:pe,duration:1e3});return}if(Ge){const Ve=ae.filter(it=>it.outcome==="LOSE"),rt=Ve.reduce((it,Et)=>it+Et.amount,0);H=Ve.length>1?"Big Bets Lose":Ve[0]?.betType==="big6"?"Big 6 Lose":"Big 8 Lose",pe=`-${rt}`,a({kind:"lose",title:H,subtitle:pe,duration:1e3});return}if(se){const Ve=G.filter(it=>it.outcome==="LOSE"),rt=Ve.reduce((it,Et)=>it+Et.amount,0);H=Ve.length>1?"Come Bets Lose":Ve[0]?.betType==="dontCome"?"DC Lose":"Come Lose",pe=`-${rt}`,a({kind:"lose",title:H,subtitle:pe,duration:1e3});return}if(Ce){H="DC Push",pe="No action",a({kind:"push",title:H,subtitle:pe,duration:1e3});return}te&&(H="Line Push",pe="No action",a({kind:"push",title:H,subtitle:pe,duration:1e3}));try{d()}catch{}},Re?200:2e3)},[P,n,A,a,d]),g.jsx(VA,{...t,hideDiceResults:!0,className:"craps-player-panel"})}function vbe(t){return g.jsx(VA,{...t})}function _be({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(_be,{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(ybe,{...t}):e==="poker"?g.jsx(HA,{...t}):g.jsx(vbe,{...t})}function bbe(){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),kbe=()=>v.useContext(C6),Bu=t=>`room:${t}`,Do=(t,e)=>`dm:${[t,e].sort().join("|")}`,wbe=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 Sbe({children:t}){const{user:e}=Vr(),r=e?.id??"anon",{roomSendMessage:n,roomFetchHistory:a,dmSendMessage:i,dmFetchHistory:o}=ma(),[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,F,K)=>{if(F?.length&&(u(ne=>{const ee=ne[G]??[],he=new Map;for(const Pe of ee)Pe?.id&&he.set(Pe.id,Pe);for(const Pe of F){if(!Pe?.id)continue;const Ge=he.get(Pe.id);he.set(Pe.id,{...Ge??{},...Pe,pending:!1,error:void 0})}const ce=Array.from(he.values()).sort(HE);return{...ne,[G]:ce}}),G.startsWith("dm:")&&K?.fromPeerId)){const ne=K.fromPeerId,ee=Do(r,ne),he=h===ne,ce=F.filter(Pe=>Pe.senderId===ne).length;ce>0&&!he&&f(Pe=>({...Pe,[ee]:(Pe[ee]??0)+ce}))}},[h,r]),P=v.useCallback((G,F,K)=>{u(ne=>{const ee=(ne[G]??[]).slice();return ee.push(F),ee.sort(HE),{...ne,[G]:ee}}),(async()=>{try{const ne=await K();if(!ne?.ok||!ne.id)throw new Error(ne?.error||"send failed");const ee=ne.id;b.current.add(ee),u(he=>{const ce=he[G]??[],Pe=ce.some(se=>se.id===ee);let Ge;return Pe?Ge=ce.filter(se=>se.id!==F.id):Ge=ce.map(se=>se.id===F.id?{...se,id:ee,pending:!1,error:void 0}:se),Ge.sort(HE),{...he,[G]:Ge}})}catch(ne){u(ee=>{const he=(ee[G]??[]).map(ce=>ce.id===F.id?{...ce,pending:!1,error:ne?.message||"send failed"}:ce);return{...ee,[G]:he}})}})()},[]),A=v.useCallback(G=>{u(F=>{if(!F[G])return F;const K={...F};return delete K[G],K}),G.startsWith("dm:")&&(f(F=>{if(!(G in F))return F;const K={...F};return delete K[G],K}),w(F=>{if(!(G in F))return F;const K={...F};return delete K[G],K}))},[]),C=v.useCallback(G=>(c[G]??[]).some(F=>F.pending),[c]),O=v.useCallback(G=>{const F=Bu(G);return Z(G),(c[F]??[]).slice()},[c]),I=v.useCallback((G,F)=>{const K=(F??"").trim();if(!K)return null;const ne=Bu(G),ee=wL(),he={id:ee,ts:Date.now(),senderId:r,text:K,roomId:G,pending:!0};return P(ne,he,()=>n(G,K)),ee},[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 F=Do(r,G);if(!_[F])try{const K=await o?.(G);if(K?.ok&&Array.isArray(K.messages)){const ne=K.messages.map(WE);D(F,ne),f(ee=>({...ee,[F]:0}))}}finally{w(K=>({...K,[F]:!0}))}},[o,D,r,_]),L=v.useCallback(G=>{const F=Do(r,G);return N(G),(c[F]??[]).slice()},[c,r,N]),j=v.useCallback((G,F)=>{const K=(F??"").trim();if(!K)return null;const ne=Do(r,G),ee=wL(),he={id:ee,ts:Date.now(),senderId:r,text:K,toUserId:G,pending:!0};return P(ne,he,()=>i(G,K)),ee},[r,P,i]),z=v.useCallback(G=>A(Do(r,G)),[A,r]),U=v.useCallback(G=>C(Do(r,G)),[C,r]),W=v.useCallback(G=>{const F=Do(r,G);f(K=>{if(!(F in K))return K;const ne={...K};return ne[F]=0,ne})},[r]),q=v.useCallback(G=>{m(G),G&&(W(G),N(G))},[W,N]),Y=v.useCallback(G=>{const F=[];for(const[K,ne]of Object.entries(c??{})){if(!K.startsWith("dm:"))continue;const ee=wbe(K);if(!ee)continue;const he=ee[0]===r?ee[1]:ee[0];if(G&&he!==G)continue;const ce=ne[ne.length-1];F.push({peerUserId:he,last:ce,unread:d?.[K]??0,hasPending:ne.some(Pe=>Pe.pending)})}return F.sort((K,ne)=>(ne.last?.ts??0)-(K.last?.ts??0)),F},[c,d,r]);async function Z(G){const F=Bu(G);if(!(c[F]??[]).length)try{const K=await a?.(G);if(K?.ok&&Array.isArray(K.messages)){const ne=K.messages.map(GE);D(F,ne)}}catch{}}Ra({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:F})=>{!G||!Array.isArray(F)||D(Bu(G),F.map(GE))},onDmMessage:G=>{if(!G?.id)return;const F=G.fromUserId===r?G.toUserId:G.fromUserId;if(!F)return;const K=Do(r,F),ne=WE(G);if(D(K,[ne],{fromPeerId:G.fromUserId!==r?G.fromUserId:void 0}),G.fromUserId!==r)try{E("Direct Message",T(G.text))}catch{}h===F&&f(ee=>({...ee,[K]:0}))},onDmHistory:({peerUserId:G,messages:F})=>{if(!G||!Array.isArray(F))return;const K=Do(r,G);D(K,F.map(WE)),h===G&&f(ne=>({...ne,[K]:0})),w(ne=>({...ne,[K]:!0}))}});const ae=v.useMemo(()=>({getRoomMessages:O,sendRoomMessage:I,clearRoom:x,roomHasPending:R,getDmMessages:L,sendDmMessage:j,clearDm:z,dmHasPending:U,getDmSummary:Y,markDmRead:W,setActiveDm:q,loadDmHistory:N,threads:c}),[O,I,x,R,L,j,z,U,Y,W,q,N,c]);return g.jsx(C6.Provider,{value:ae,children:t})}const Ebe="_overlay_axsq0_3",Tbe="_overlayClosed_axsq0_14",Cbe="_drawer_axsq0_20",xbe="_drawerClosed_axsq0_54",Pbe="_header_axsq0_65",Abe="_closeBtn_axsq0_75",Rbe="_body_axsq0_91",Dbe="_threadList_axsq0_98",Obe="_noPeers_axsq0_106",Nbe="_threadBtn_axsq0_113",Ibe="_threadBtnActive_axsq0_132",Mbe="_avatar_axsq0_137",jbe="_threadLabel_axsq0_151",Lbe="_threadName_axsq0_156",Bbe="_threadPreview_axsq0_165",Ube="_unreadBadge_axsq0_173",Fbe="_activeThread_axsq0_186",qbe="_scroller_axsq0_194",zbe="_scrollerEmpty_axsq0_208",$be="_message_axsq0_215",Vbe="_messageMine_axsq0_230",Hbe="_messageContent_axsq0_238",Gbe="_messageTime_axsq0_246",Wbe="_pending_axsq0_257",Kbe="_error_axsq0_265",Ybe="_composer_axsq0_273",Xbe="_composerInput_axsq0_283",Jbe="_composerSend_axsq0_307",Qbe="_composerSendDisabled_axsq0_329",Zbe="_headerTitle_axsq0_394",Hr={overlay:Ebe,overlayClosed:Tbe,drawer:Cbe,drawerClosed:xbe,header:Pbe,closeBtn:Abe,body:Rbe,threadList:Dbe,noPeers:Obe,threadBtn:Nbe,threadBtnActive:Ibe,avatar:Mbe,threadLabel:jbe,threadName:Lbe,threadPreview:Bbe,unreadBadge:Ube,activeThread:Fbe,scroller:qbe,scrollerEmpty:zbe,message:$be,messageMine:Vbe,messageContent:Hbe,messageTime:Gbe,pending:Wbe,error:Kbe,composer:Ybe,composerInput:Xbe,composerSend:Jbe,composerSendDisabled:Qbe,headerTitle:Zbe};function e0e(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}=Vr(),i=a?.id??a?.email??"",{getDmSummary:o,getDmMessages:c,sendDmMessage:u,markDmRead:d,setActiveDm:f,threads:h,loadDmHistory:m}=kbe(),[_,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 z=()=>{O.current&&(O.current.scrollTop=O.current.scrollHeight+1e3)};return j.addEventListener("resize",z),()=>{j.removeEventListener("resize",z)}},[]);const P=v.useMemo(()=>_?h?.[Do(_,i)]??[]:[],[_,t,h]),A=v.useMemo(()=>o()??[],[t,P.length]),C=v.useMemo(()=>{const j=new Map;return A.forEach(z=>j.set(z.peerUserId,z)),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 z=r.find(U=>U.id===j);return z?.name||z?.email||j},L=j=>{const z=C.get(j);return z?.last?((z.last.senderId===i?"You: ":"")+z.last.text).trim():""};return g.jsxs(g.Fragment,{children:[g.jsx("div",{"aria-hidden":!t,onClick:e,className:`${Hr.overlay} ${t?"":Hr.overlayClosed}`}),g.jsxs("aside",{"aria-hidden":!t,role:"dialog","aria-label":"Direct Messages",className:`${Hr.drawer} ${t?"":Hr.drawerClosed}`,onClick:j=>j.stopPropagation(),children:[g.jsxs("div",{className:Hr.header,children:[g.jsx("strong",{className:Hr.headerTitle,children:"Messages"}),g.jsx("button",{onClick:e,className:Hr.closeBtn,"aria-label":"Close messages",children:"✕"})]}),g.jsxs("div",{className:Hr.body,children:[g.jsxs("div",{className:Hr.threadList,children:[r.length===0&&g.jsx("div",{className:Hr.noPeers,children:"No other players yet."}),r.map(j=>{const z=j.id===_,U=e0e(j.name||j.email||j.id),W=C.get(j.id)?.unread??0,q=L(j.id);return g.jsxs("button",{onClick:()=>I(j.id),className:`${Hr.threadBtn} ${z?Hr.threadBtnActive:""}`,title:N(j.id),children:[g.jsx("div",{className:Hr.avatar,"aria-hidden":!0,children:U}),g.jsxs("div",{className:Hr.threadLabel,children:[g.jsx("div",{className:Hr.threadName,children:N(j.id)}),g.jsx("div",{className:Hr.threadPreview,children:q})]}),W>0&&g.jsx("span",{"aria-label":`${W} unread`,className:Hr.unreadBadge,children:W>99?"99+":W})]},j.id)})]}),g.jsxs("div",{className:Hr.activeThread,children:[g.jsxs("div",{ref:O,className:Hr.scroller,children:[!_&&g.jsx("div",{className:Hr.scrollerEmpty,children:"Select a conversation to begin."}),_&&P.map(j=>{const z=j.senderId===i,U=new Date(j.ts),W=U.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"});return g.jsxs("div",{className:`${Hr.message} ${z?Hr.messageMine:""}`,title:U.toLocaleString(),children:[g.jsx("div",{className:Hr.messageContent,children:j.text}),g.jsx("div",{className:Hr.messageTime,children:W}),j.pending&&g.jsx("div",{className:Hr.pending,children:"sending…"}),j.error&&g.jsx("div",{className:Hr.error,children:j.error})]},j.id)})]}),g.jsxs("div",{className:Hr.composer,children:[g.jsx("input",{value:b,onChange:j=>E(j.target.value),onKeyDown:R,placeholder:_?`Message ${N(_)}…`:"Pick a conversation…",disabled:!_,className:Hr.composerInput}),g.jsx("button",{onClick:x,disabled:!_||b.trim()==="",className:`${Hr.composerSend} ${!_||b.trim()===""?Hr.composerSendDisabled:""}`,children:"Send"})]})]})]})]})]})}function t0e({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 r0e=({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)},n0e=({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(()=>zr(()=>import("./DiceBoard.component-D4C30s2K.js"),__vite__mapDeps([3,4]),import.meta.url));function a0e(){const{roomId:t}=c3(),e=tn(),{user:r,meId:n}=Vr(),{error:a}=cu();v.useEffect(()=>{const je=()=>{try{Dx()||Lr()}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}=Qo(),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,Mt=A?{...A}:{},De={...je,...Mt,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])),Mt=new Set(nt),De=nt.map(at=>{const ke=Ct.get(at);if(ke)return ke;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=>!Mt.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),[z,U]=v.useState(null),[W,q]=v.useState(!1),[Y,Z]=v.useState(void 0),ae=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,F=v.useCallback(je=>{Z(je),q(!0)},[]),K=v.useCallback(()=>{q(!1),Z(void 0)},[]),ne=v.useRef(void 0);v.useEffect(()=>{const je=m?.gameState?.roundSeq;if(typeof je=="number"&&ne.current!==void 0&&je!==ne.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"&&(ne.current=je)},[m?.gameState?.roundSeq]);const ee=ws(),{joinRoom:he}=ji(),[ce,Pe]=v.useState(!1);v.useCallback(async()=>{if(!ce&&!(!ee||!t)){Pe(!0);try{if(he)try{await he(t)}catch{}}catch{}finally{Pe(!1)}}},[ce,ee,t,he]),v.useEffect(()=>{if(!ee)return;const je=()=>{try{d()}catch{}};return ee.on("disconnect",je),()=>{ee.off("disconnect",je)}},[ee,d]),v.useEffect(()=>{requestAnimationFrame(()=>{window.scrollTo({top:0,left:0,behavior:"instant"})})},[]);const[Ge,se]=v.useState(()=>typeof window>"u"?!1:window.innerWidth>window.innerHeight);v.useEffect(()=>{const je=()=>se(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 Ce=v.useRef(0),te=v.useRef(!1),H=v.useRef(!1),pe=v.useRef(!1),Re=v.useRef(null),de=v.useRef(null),[Ie,ct]=v.useState(0),[Ve,rt]=v.useState(!1),[Ke,it]=v.useState(!1),[Et,It]=v.useState(!1);v.useEffect(()=>{const je=m?.gameState?.gameMode;if(!je)return;let nt=!0;return(async()=>{try{const{Preferences:Ct}=await zr(async()=>{const{Preferences:et}=await Promise.resolve().then(()=>Ic);return{Preferences:et}},void 0,import.meta.url),Mt=je==="craps"?"onb_craps_v1":"onb_ceelo_v1",{value:De}=await Ct.get({key:Mt});if(!nt)return;It(De!=="1")}catch{if(!nt)return;It(!0)}})(),()=>{nt=!1}},[m?.gameState?.gameMode]);const bt=v.useCallback(()=>{const je=m?.gameState?.gameMode;(async()=>{try{const{Preferences:nt}=await zr(async()=>{const{Preferences:Ct}=await Promise.resolve().then(()=>Ic);return{Preferences:Ct}},void 0,import.meta.url);await nt.set({key:je==="craps"?"onb_craps_v1":"onb_ceelo_v1",value:"1"})}catch{}It(!1)})()},[m?.gameState?.gameMode]);if(v.useEffect(()=>{if(m?.gameState?.gameMode==="craps"){te.current=!1,H.current=!1;return}const je=m?.singlePlayer===!0,nt=m?.gameState?.banker,Ct=nt&&i&&nt===i,Mt=h?.diceResults;if(!Mt||Mt.length!==3){te.current=!1,H.current=!1,Re.current=null;return}const De=Mt.join(",");if(De===Re.current)return;Re.current=De;const et=[...Mt].sort().join(","),at=et==="4,5,6",ke=at||et==="1,2,3";je||!Ct?(te.current=ke,H.current=at):(te.current=!1,H.current=!1)},[h?.diceResults,m?.gameState?.gameMode,m?.gameState,i]),v.useEffect(()=>{if(m?.gameState?.gameMode==="craps"){de.current=null;return}const je=m?.gameState?.bankRoll;if(!je||!Array.isArray(je.raw)||je.raw.length!==3){de.current=null;return}const nt=je.raw,Ct={};for(const et of nt)Ct[et]=(Ct[et]||0)+1;const Mt=Object.keys(Ct).map(Number);Mt.length===2&&Mt.some(et=>Ct[et]===1)?de.current=Mt.find(et=>Ct[et]===1)||null:de.current=null},[m?.gameState?.bankRoll,m?.gameState?.gameMode]),v.useEffect(()=>{if(m?.gameState?.gameMode==="craps"){pe.current=!1;return}const je=m?.gameState?.banker;if(je&&i&&je===i){pe.current=!1;return}const Ct=de.current;if(Ct!==6){pe.current=!1;return}const Mt=h?.diceResults;if(!Mt||Mt.length!==3){pe.current=!1;return}const De={};for(const ke of Mt)De[ke]=(De[ke]||0)+1;const et=Object.keys(De).map(Number);if(et.length===2&&et.some(ke=>De[ke]===1)){const ke=et.find(st=>De[st]===1);ke&&ke>Ct?pe.current=!0:pe.current=!1}else{const ke=et.length===1;pe.current=ke}},[h?.diceResults,m?.gameState,i,m?.gameState?.gameMode]),v.useEffect(()=>{if(!h?.diceSettled)return;const je=Date.now();if(te.current||H.current||pe.current){if(je-Ce.current<800){te.current=!1,H.current=!1,pe.current=!1;return}Ce.current=je,H.current&&rt(!0),pe.current&&it(!0),te.current=!1,H.current=!1,pe.current=!1,ct(nt=>nt+1)}},[h?.diceSettled]),_)return g.jsxs("div",{className:"HomeScreen theme-casino home-fixed-root",children:[g.jsx(Li,{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(Li,{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 me=m.gameState?.gameMode==="craps",Be=m.gameState?.gameMode!=="craps";return g.jsxs(i0e,{className:me?"mode-craps":Be?"mode-ceelo":void 0,bgShakeTrigger:Ie,children:[g.jsx(Li,{className:"page-gameroom"}),g.jsx(T_e,{}),g.jsx(fP,{open:Et,onClose:bt,title:me?"Craps":"Cee‑Lo",tagline:me?"Place your bets and roll the point.":"Banker vs challengers. Roll to win.",steps:me?["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:me?"onb_craps_v1":"onb_ceelo_v1"}),g.jsxs("div",{className:"room-grid-fit",style:!Ge&&z&&!me?{height:z}:void 0,children:[g.jsx("div",{className:"fairness-container",children:g.jsx(t0e,{roomId:t,lastRollerId:b,roundSeq:m?.gameState?.roundSeq,autoHideMs:me?3e3:void 0})}),g.jsx("div",{ref:N,className:"room-grid"+(me?" room-grid--craps":"")+(L<.999?" room-grid--scaled":""),style:L<.999?{transform:`scale(${L})`,transformOrigin:"top center",height:z||void 0}:void 0,children:me?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:F,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(E_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:F,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(R_e,{roomId:t,meId:i,bankerId:m.gameState.banker,players:m.players,gameState:C,gameplay:h})})]})]})})]}),g.jsx(bbe,{}),g.jsx(x6,{open:W,onClose:K,peers:ae,initialPeerId:Y}),g.jsx(r0e,{show:Ve,onComplete:()=>rt(!1)}),g.jsx(n0e,{show:Ke,onComplete:()=>it(!1)})]})}function i0e({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 s0e(){const{user:t,refreshUser:e,logout:r}=Vr(),{updateProfile:n}=ma(),{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((Fe,Zt,Ft,qt)=>{O(Fe,Zt),R(Ft),L(qt||null)},[O]),z=v.useCallback(()=>{I(),R(null),L(null)},[I]),[U,W]=v.useState(t?.name??""),[q,Y]=v.useState(t?.email??""),[Z,ae]=v.useState(t?.avatarUrl??""),[G,F]=v.useState(!1),[K,ne]=v.useState(null),[ee,he]=v.useState(!1),[ce,Pe]=v.useState(null),[Ge,se]=v.useState(!1),[Ce,te]=v.useState(null),H=v.useRef(null),{onBuyChips:pe,onGoPremium:Re,onRestore:de,busy:Ie,busyChips:ct,ready:Ve,purchasesReady:rt,isWeb:Ke,premiumActive:it,hasPremiumPackage:Et,premiumLabel:It,premiumSubtitle:bt,premiumDescription:me,premiumPrice:Be,premiumInterval:je}=Lg(),[nt,Ct]=v.useState(!!t?.botChatDisabled),[Mt,De]=v.useState(t?.ceeloBotsPerRoom??null),[et,at]=v.useState(t?.crapsBotsPerRoom??null),[ke,st]=v.useState(t?.pokerBotsPerRoom??null);v.useEffect(()=>{W(t?.name??""),Y(t?.email??""),ae(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 kt=v.useCallback(async()=>{F(!0),ne(null);try{const Fe={};U!==t?.name&&(Fe.name=U),q!==t?.email&&(Fe.email=q),Z!==t?.avatarUrl&&(Fe.avatarUrl=Z),typeof nt=="boolean"&&(Fe.botChatDisabled=nt);const Zt=rf||WD,Ft=rf||Ho,qt=rf||Go;Zt&&Mt!==(t?.ceeloBotsPerRoom??null)&&(Fe.ceeloBotsPerRoom=Mt),Ft&&et!==(t?.crapsBotsPerRoom??null)&&(Fe.crapsBotsPerRoom=et),qt&&ke!==(t?.pokerBotsPerRoom??null)&&(Fe.pokerBotsPerRoom=ke);const xt=await n(Fe);if(!xt?.ok)ne(xt?.error||"Failed to save");else{try{await e({force:!0})}catch{}await d()}}catch(Fe){ne(Fe?.message||"Failed to save")}finally{F(!1)}},[U,q,Z,t?.name,t?.email,t?.avatarUrl,n,d,e,Mt,et,ke,nt]),nr=v.useCallback(async Fe=>{f(Fe)?await m(Fe):await h(Fe)},[f,h,m]),lr=v.useCallback(Fe=>{_(Fe)},[_]),ur=v.useCallback(Fe=>{D(Fe),E(!0)},[]),Er=v.useCallback(()=>{E(!1),D(void 0)},[]),dn=v.useCallback(async Fe=>{await w(Fe.id,"ACCEPT")},[w]);v.useCallback(async Fe=>{await w(Fe.id,"DECLINE")},[w]);const J=v.useCallback(async Fe=>{he(!0),Pe(null);try{if(Fe.size>5242880){Pe("File size must be less than 5MB");return}if(!["image/jpeg","image/jpg","image/png","image/webp","image/gif"].includes(Fe.type)){Pe("File must be a valid image (JPEG, PNG, WebP, or GIF)");return}const qt=new FormData;qt.append("avatar",Fe);const xt=String(GD??"http://localhost:4000").replace(/\/+$/,"");let fn={},bn;try{const mr=await ci();mr&&(fn={Authorization:`Bearer ${mr}`},bn=mr)}catch{}const Fn=new URL(`${xt}/api/avatar/upload`);bn&&Fn.searchParams.set("token",bn);const la=await fetch(Fn.toString(),{method:"POST",body:qt,headers:fn,credentials:"include"});if(!la.ok){const mr=await la.json().catch(()=>({error:"Upload failed"}));throw new Error(mr.error||`Upload failed with status ${la.status}`)}const Zn=await la.json();Zn.avatarUrl&&ae(Zn.avatarUrl)}catch(Zt){Pe(Zt?.message||"Failed to upload avatar")}finally{he(!1)}},[]),ue=v.useCallback(Fe=>{const Zt=Fe.target.files?.[0];Zt&&J(Zt),H.current&&(H.current.value="")},[J]),ve=v.useCallback(()=>{if(!(t?.membershipTier==="PREMIUM")){try{i(!0)}catch{}return}H.current?.click()},[t,i]),Ae=v.useMemo(()=>{const Fe=new Map;for(const Zt of o)Fe.set(Zt.id,Zt);for(const Zt of u)Fe.has(Zt.id)||Fe.set(Zt.id,Zt);return Fe},[o,u]),B=v.useMemo(()=>c.map(Fe=>{const Zt=t?.id===Fe.toUserId,Ft=Zt?Fe.fromUserId:Fe.toUserId;if(!Ft)return null;const qt=(Zt?Fe.fromUser:Fe.toUser)||Ae.get(Ft),xt=qt?.name??Ft,fn=qt?.avatarUrl??void 0;return{id:Ft,name:xt,avatarUrl:fn,_req:Fe,_incoming:Zt}}).filter(Boolean),[c,t?.id,Ae]),{showAnimations:Q,toggleAnimations:oe,ready:Ne}=$A(),[pt,Rt]=v.useState(Oc.diceColorTheme);v.useEffect(()=>{(async()=>{try{const Fe=await au();Rt(Fe.diceColorTheme??Oc.diceColorTheme)}catch{Rt(Oc.diceColorTheme)}})()},[]);const Ut=v.useCallback(async Fe=>{try{if(!(t?.membershipTier==="PREMIUM")&&Fe!=="dice_white_black"){try{i(!0)}catch{}return}const Ft=await au(),qt={...Oc,...Ft,diceColorTheme:Fe};await y0(qt),Rt(Fe)}catch{}},[t,i]),dr=v.useCallback(()=>i(!1),[i]);v.useEffect(()=>{e()},[]);const hn=tn(),rn=v.useCallback(async()=>{try{if(te(null),!window.confirm("Are you sure you want to permanently delete your account? This action cannot be undone."))return;const Zt=String(GD??"http://localhost:4000").replace(/\/+$/,"");let Ft;try{const xt=await ci();xt&&(Ft={Authorization:`Bearer ${xt}`})}catch{}const qt=await fetch(`${Zt}/api/account`,{method:"DELETE",credentials:"include",headers:Ft});if(!qt.ok){const xt=await qt.json().catch(()=>({error:"Deletion failed"}));throw new Error(xt.error||`Failed with status ${qt.status}`)}}catch(Fe){te(Fe?.message||"Failed to delete account")}finally{r()}},[hn]);return g.jsxs("div",{className:"theme-casino home-fixed-root add-chips",children:[g.jsx(Li,{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{rr("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:[Z&&g.jsx("img",{src:Z,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:ue,disabled:ee,style:{display:"none"}}),g.jsx("button",{className:"felt-btn","data-no-global-haptic":!0,onClick:()=>{try{rr("Light")}catch{}ve()},disabled:ee,style:{marginBottom:"8px"},children:ee?"Uploading...":"Upload Avatar"}),g.jsx("div",{className:"subtle",style:{fontSize:"0.85em",marginTop:"4px"},children:"Max 5MB • JPEG, PNG, WebP, or GIF"}),ce&&g.jsxs("div",{className:"error-message",style:{marginTop:"8px"},children:[ce,ce.includes("Premium")&&g.jsx("div",{style:{marginTop:"8px"},children:g.jsx("button",{className:"felt-btn","data-no-global-haptic":!0,onClick:()=>{try{rr("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:Fe=>{const Ft=document.querySelector(`[data-player-id="${Fe}"]`)?.querySelector(".avatar-ring");Ft&&j(Fe,Ft,"friends")}})}):g.jsx("span",{children:"No friends yet"})]}),g.jsxs("div",{className:"profile-section",children:[g.jsx("strong",{children:"Friend Requests:"}),B.length?g.jsx("div",{className:"friends-scroll",children:g.jsx(E_,{className:"friends-panel",players:B,meId:t?.id||"",onPlayerClick:Fe=>{const Ft=document.querySelector(`[data-player-id="${Fe}"]`)?.querySelector(".avatar-ring"),qt=B.find(xt=>xt.id===Fe);Ft&&qt?._req&&j(Fe,Ft,"requests",{id:qt._req.id,incoming:!!qt._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:Fe=>{const Ft=document.querySelector(`[data-player-id="${Fe}"]`)?.querySelector(".avatar-ring");Ft&&j(Fe,Ft,"blocked")}})}):g.jsx("span",{children:"No blocked users"})]}),P&&A&&x&&g.jsx(y6,{anchorRect:A,anchorEl:C,onClose:z,onMessages:x==="friends"?()=>{ur(P),z()}:void 0,onUnfriend:x==="friends"?()=>{lr(P),z()}:void 0,onBlockUser:x!=="requests"?async()=>{await nr(P),z()}:void 0,isFriend:x==="friends",isBlocked:x==="blocked",...x==="requests"&&N?.incoming?{onAddFriend:()=>{dn({id:N.id}),z()},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:Fe=>W(Fe.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:q,onChange:Fe=>Y(Fe.target.value),disabled:G})})]})]}),(()=>{const Fe=rf||WD,Zt=rf||Ho,Ft=rf||Go;return g.jsxs(g.Fragment,{children:[(Fe||Zt)&&g.jsxs("div",{className:"profile-row profile-row--two",children:[Fe&&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:Mt==null?"":String(Mt),onChange:qt=>{const xt=qt.target.value;De(xt===""?null:Math.max(0,Math.min(8,Math.trunc(Number(xt)))))},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((qt,xt)=>g.jsx("option",{value:xt,children:xt},xt))]}),g.jsx("div",{className:"subtle",children:"Applies when you create single‑player rooms."})]})]}),Zt&&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:qt=>{const xt=qt.target.value;at(xt===""?null:Math.max(0,Math.min(8,Math.trunc(Number(xt)))))},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((qt,xt)=>g.jsx("option",{value:xt,children:xt},xt))]}),g.jsx("div",{className:"subtle",children:"Applies when you create single‑player rooms."})]})]})]}),Ft&&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:ke==null?"":String(ke),onChange:qt=>{const xt=qt.target.value;st(xt===""?null:Math.max(0,Math.min(8,Math.trunc(Number(xt)))))},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((qt,xt)=>g.jsx("option",{value:xt,children:xt},xt))]}),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{rr("Light")}catch{}kt()},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:!Ne,checked:!!Q,onChange:()=>oe(),"aria-label":Q?"Disable animations (dice physics, chip flights, background shake)":"Enable animations (dice physics, chip flights, background shake)"}),g.jsx("span",{children:Q?"Enabled":"Disabled"})]}),g.jsx("div",{className:"subtle",style:{opacity:.7},children:Q?"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:pt==="dice_red_white",onChange:()=>Ut("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:pt==="dice_green_gold",onChange:()=>Ut("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:pt==="dice_white_black",onChange:()=>Ut("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{rr("Light")}catch{}try{pe()}catch{}},disabled:G||Ie||!Ve||!rt,"aria-label":Ke?"Buy 1000 Z Credits":"Buy 1000 Z Credits (App Store / Play)",title:Ke?"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{rr("Light")}catch{}try{de()}catch{}},disabled:Ie||!Ve||!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{rr("Light")}catch{}try{Re()}catch{}},disabled:Ie,"aria-label":It,title:It,children:"Go Premium"}),!it&&Et&&g.jsx("div",{className:"meta",style:{marginTop:6},children:(()=>{const Fe="$1.99",Zt="Monthly",Ft=Be||Fe,qt=je||Zt,xt=bt||`${Ft} Mo`,fn=me||"Remove ads and unlock premium features.";return g.jsxs(g.Fragment,{children:[xt&&g.jsx("div",{className:"subtle","aria-hidden":!0,children:xt}),g.jsx("div",{className:"legal-note","aria-hidden":!0,children:fn}),g.jsxs("div",{className:"legal-note",role:"note",children:[g.jsx("strong",{children:"Premium Subscription"})," — ",Ft," (",qt,"). 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{rr("Light")}catch{}rn()},disabled:Ge,"aria-label":"Delete Account",title:"Delete Account",children:Ge?"Deleting…":"Delete Account"}),Ce&&g.jsx("div",{className:"error-message",children:Ce})]})]})})]})})})}),g.jsx(pF,{open:a,onClose:dr,planId:t?.membershipTier,featureDescription:"Upload custom avatars and create multiplayer rooms with Premium membership."}),g.jsx(x6,{open:b,onClose:Er,peers:o,initialPeerId:T}),g.jsx(_P,{})]})}function o0e(){const[t,e]=v.useState(Oc),[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=li();async function c0e(){try{const t=await ci(),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 l0e(){try{const t=await ci(),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:c0e,getAdRewardCooldown:l0e};function u0e(){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}=Vr(),{infoNow:D,successNow:P}=Ts(),[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(),z=!i&&j,U=v.useCallback(se=>{const Ce=Math.ceil(se/1e3),te=Math.floor(Ce/60),H=Ce%60;return`${te}m ${H}s`},[]);v.useEffect(()=>{z&&(async()=>{try{const se=await EL.getAdRewardCooldown();se?.ok&&se.nextAt&&se.nextAt>Date.now()&&I(se.nextAt)}catch{}})()},[z]),v.useEffect(()=>{!z||L||$E.prepareRewardedAd().catch(()=>{})},[z,L]),v.useEffect(()=>{if(!L)return;const se=setInterval(()=>R(Date.now()),1e3);return()=>clearInterval(se)},[L]);const W=v.useCallback(async()=>{if(!(A||L||!z)){rr("Light"),C(!0);try{const se=await $E.showRewardedAd();if(!se.ok){se.error==="AD_DISMISSED"?D?.("Ad skipped - watch the full ad to earn credits!"):D?.(`Ad unavailable: ${se.error}`),C(!1);return}const Ce=await EL.claimAdReward();if(Ce.ok){const te=QD*60*1e3;I(Date.now()+te),P?.(`+${hf} Z Credits earned!`);try{T()}catch{}}else if(Ce.error==="COOLDOWN_ACTIVE"){const te=Ce.retryInMs??QD*60*1e3;I(Date.now()+te),D?.("Please wait before watching another ad.")}else D?.(`Reward failed: ${Ce.error}`)}catch{D?.("Something went wrong. Please try again.")}finally{C(!1)}}},[A,L,z,D,P,T]),q="$1.99",Y="Monthly",Z=b||q,ae=E||Y,G=m||`${Z} Mo`,F=w||"Remove ads and unlock premium features.",K="$1.99 for 1,000 Zentara Credits",ne="Buy Zentara Credits to keep playing.",ee=h||K,he=_||ne,ce=()=>{try{rr("Light")}catch{}try{u()}catch{}},Pe=()=>{try{rr("Light")}catch{}try{d()}catch{}},Ge=()=>{try{rr("Light")}catch{}try{f()}catch{}};return g.jsxs("div",{className:"theme-casino home-fixed-root add-chips",children:[g.jsx(Li,{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{rr("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:[z&&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:ce,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:ee}),g.jsx("div",{className:"hint","aria-hidden":!0,children:he})]})]}),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:Pe,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:F}),g.jsxs("div",{className:"legal-note",role:"note",style:{marginTop:8,fontSize:12,opacity:.85},children:[g.jsx("strong",{children:"Premium Subscription"})," — ",Z," (",ae,"). 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:Ge,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 d0e(){const[t,e]=v.useState("verifying"),r=tn(),{refreshUser:n}=Vr();v.useEffect(()=>{(async()=>{const c=new URLSearchParams(window.location.search).get("token");if(!c)return e("error");try{const u=await W9(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(Li,{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 f0e(){const[t,e]=v.useState("verifying"),[r,n]=v.useState(!1),a=tn(),i=li();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 p0e(){const[t,e]=v.useState("verifying"),[r,n]=v.useState(!1),a=tn(),i=li();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 h0e({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=ca.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(Xs.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:ca.chipFlyDurationMs/1e3},onAnimationComplete:e,style:{pointerEvents:"none"},children:g.jsx(Js,{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 Mo({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{Lr()}catch{}h(!1),requestAnimationFrame(()=>{h(!0),window.setTimeout(()=>h(!1),260)});try{rr("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 m0e(){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(Li,{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(Js,{mini:!0,value:5,disabled:!0,className:"chip--flight"})},x))}),g.jsxs("div",{ref:m,children:[g.jsx(Js,{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(Js,{mini:!0,value:25,disabled:!0,className:"chip--flight"})},x))})]})]}),f.map(x=>g.jsx(h0e,{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(Mo,{label:"Check",ariaLabel:"Check",size:"md",className:"poker-action--green poker-action--secondary poker-action--check",onClick:()=>{}}),g.jsx(Mo,{label:"Call",subtitle:"z120",ariaLabel:"Call 120",size:"md",className:"poker-action--green poker-action--primary poker-action--call",onClick:()=>{}}),g.jsx(Mo,{label:"Bet",subtitle:"z250",ariaLabel:"Bet 250",size:"md",className:"poker-action--flat poker-action--secondary poker-action--bet",onClick:()=>{}}),g.jsx(Mo,{label:"Raise",subtitle:"z400",ariaLabel:"Raise 400",size:"md",className:"poker-action--flat poker-action--secondary poker-action--raise",onClick:()=>{}}),g.jsx(Mo,{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 g0e(){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 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:"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 v0e(){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 _0e(){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."]})]})})}li();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(Li,{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 b0e({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}=k0e(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:w0e(n)})]})}function k0e(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 w0e(t){switch(t){case"hearts":return"♥";case"diamonds":return"♦";case"clubs":return"♣";case"spades":return"♠";default:return"?"}}function S0e({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}=Ts();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(Z=>Z.seatIndex===m.seatIndex);if(Y){const Z=e.find(ee=>ee.id===Y.playerId),ae=Z?.name||Z?.email||"Player";let G;const F=ee=>typeof ee=="number"?`z${ee.toLocaleString("en-US")}`:"";switch((m.action||"").toLowerCase()){case"fold":G="Fold";break;case"check":G="Check";break;case"call":G=`Call ${F(m.amountDelta)}`;break;case"bet":G=`Bet ${F(m.amountDelta)}`;break;case"raise":G=m.toBet?`Raise to ${F(m.toBet)}`:`Raise ${F(m.amountDelta)}`;break;default:G="Action";break}const ne=`srv:${Number(h?.pokerRoundSeq||0)||0}:${m.seq}`;u.current!==ne&&(d(`${ae}: ${G}`,void 0),u.current=ne),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=q=>{const Y=new Map;for(const Z of q)Y.set(Z.seatIndex,Z);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 q of E){const Y=D.get(q.seatIndex);if(Y&&(Y.status==="active"||Y.status==="all-in")&&q.status==="folded"){x=q,R="Fold";break}}if(!R)for(const q of E){const Y=D.get(q.seatIndex);if(!Y)continue;const Z=(q.committed||0)-(Y.committed||0);if(Z>0){x=q,O===0?R=`Bet z${Z}`:I>O?R=`Raise to z${I}`:R=`Call z${Z}`;break}}if(!R&&A!=null&&C!=null&&A!==C){const q=D.get(A),Y=P.get(A);q&&Y&&q.status==="active"&&Y.status==="active"&&(q.committed||0)===(Y.committed||0)&&(x=Y,R="Check")}if(!R||!x)return;const N=e.find(q=>q.id===x.playerId),j=`${N?.name||N?.email||"Player"}: ${R}`,z=Number(h?.pokerRoundSeq||0)||0;try{const q=typeof window<"u"?window:void 0,Y=q&&q.__pokerWinnersFlashGuard;if(Y&&Y.roundSeq===z)return}catch{}const U=Number(x?.committed||0),W=`heur:${z}:${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(Xs.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 E0e({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 T0e(){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"],C0e={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 x0e(t){return KA(t).length>0}function P0e(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 A0e(t){const e=P0e(t);return e?`${C0e[e]} High`:null}function R0e(t,e){if(e<0||e>=t.length)return!1;const r=A6(t[e]);return r?KA(t).includes(r):!1}function D0e(t){const e=[];if(!t||t.length===0)return e;x0e(t)&&e.push({label:"Paired Board",type:"paired"});const r=A0e(t);return r&&e.push({label:r,type:"high"}),e}function O0e(t){return t<0||t>4?null:t<=2?"flop":t===3?"turn":"river"}function N0e({boardCards:t}){const e=D0e(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 I0e(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 M0e(t){switch(t){case"hearts":return"♥";case"diamonds":return"♦";case"clubs":return"♣";case"spades":return"♠";default:return"?"}}function j0e({value:t,concealed:e,position:r,isPaired:n,animateEntrance:a}){if(!t)return null;const{rank:i,suit:o}=I0e(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:M0e(o)})]})}const Uh=Object.create(null),KE=Object.create(null);function L0e(){const{roomId:t}=c3(),{user:e,refreshUser:r}=Vr(),n=ws(),{onHandEnd:a}=S0(),i=String(e?.id??e?.email??""),{joinRoom:o,leaveRoom:c,connected:u,participants:d,localParticipant:f}=gu(),h=T0e();v.useEffect(()=>{const X=()=>{try{Dx()||Lr()}catch{}};X();const fe=["pointerdown","touchstart","mousedown","click","keydown"];return fe.forEach(ge=>{document.addEventListener(ge,X,{once:!0,capture:!0})}),()=>{fe.forEach(ge=>{document.removeEventListener(ge,X,{capture:!0})})}},[]);const{pokerJoinRoom:m,pokerStartHand:_,pokerFold:w,pokerCheck:b,pokerCall:E,pokerBet:T,pokerRaise:D,pokerFetchHistory:P}=ma(),{info:A,win:C,onIdle:O,show:I}=Ts(),[x,R]=v.useState(null);v.useEffect(()=>{const X=x?.gameState?.pokerPhase;return X&&X!=="waiting"?h.acquire():h.release(),()=>{h.release()}},[x?.gameState,h]);const[N,L]=v.useState(!1),j=Tt.useRef(!1),[z,U]=v.useState(null),[W,q]=v.useState(!1),[Y,Z]=v.useState(!1),[ae,G]=v.useState(!1),F=Tt.useRef(!1),K=Tt.useRef(!1),ne=Tt.useRef(null);Tt.useEffect(()=>{F.current=ae},[ae]),Tt.useEffect(()=>{K.current=W},[W]),Tt.useEffect(()=>{ne.current=z},[z]),Tt.useEffect(()=>{j.current=N},[N]),Tt.useEffect(()=>{(!z||z.length!==2)&&(Be.current=0)},[z]);const ee=Tt.useRef(null),he=Tt.useRef(0);Tt.useRef(0);const ce=Tt.useRef(null),Pe=Tt.useRef(null),Ge=Tt.useRef(null),[se,Ce]=v.useState(0),[te,H]=v.useState(0),[pe,Re]=v.useState([]),[de,Ie]=v.useState([]),[ct,Ve]=v.useState(!1),[rt,Ke]=v.useState([]),it=Tt.useRef(0),Et=Tt.useRef(0),It=Tt.useRef(0),bt=Tt.useRef(!1),me=Tt.useRef(null),Be=Tt.useRef(0),je=Tt.useRef(void 0),nt=Tt.useRef(0),[Ct,Mt]=Tt.useState([]),De=Tt.useRef(0),et=Tt.useRef(0),at=Tt.useRef(0),[ke,st]=Tt.useState(!1),kt=Tt.useRef(0),nr=Tt.useRef(new Set),lr=Tt.useRef(null),ur=Tt.useRef(null),[Er,dn]=v.useState(0),[J,ue]=v.useState(0),[ve,Ae]=Tt.useState(new Set),B=Tt.useRef([]),Q=Tt.useRef(null),oe=Tt.useRef(0),Ne=!0,[pt,Rt]=v.useState(!0),Ut=Tt.useRef(0),dr=Tt.useRef(null),hn=Tt.useRef(null),rn=Tt.useRef(null),Fe=Tt.useMemo(()=>e?e.id:"",[e]),[Zt,Ft]=v.useState(!1);v.useEffect(()=>{let X=!0;return(async()=>{try{const{Preferences:fe}=await zr(async()=>{const{Preferences:Me}=await Promise.resolve().then(()=>Ic);return{Preferences:Me}},void 0,import.meta.url),{value:ge}=await fe.get({key:"onb_poker_v1"});if(!X)return;Ft(ge!=="1")}catch{if(!X)return;Ft(!0)}})(),()=>{X=!1}},[]);const qt=Tt.useCallback(()=>{(async()=>{try{const{Preferences:X}=await zr(async()=>{const{Preferences:fe}=await Promise.resolve().then(()=>Ic);return{Preferences:fe}},void 0,import.meta.url);await X.set({key:"onb_poker_v1",value:"1"})}catch{}Ft(!1)})()},[]);Tt.useEffect(()=>{let X=!1,fe=null,ge=null,Me=null;const we=Qe=>{try{const yt=Qe.getBoundingClientRect();if(yt&&isFinite(yt.height)){const an=typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(max-width: 480px)").matches?85:Math.round(yt.height);document.body.style.setProperty("--poker-header-height",`${an}px`)}}catch{}},He=()=>{if(X||typeof document>"u")return;const Qe=document.querySelector(".card-header.card-header--two-rows");if(Qe){dr.current=Qe;try{fe=new ResizeObserver(()=>we(Qe)),fe.observe(Qe)}catch{Me=()=>we(Qe),window.addEventListener("resize",Me)}we(Qe)}};if(He(),!dr.current)try{ge=window.setTimeout(He,0)}catch{}return()=>{X=!0;try{document.body.style.removeProperty("--poker-header-height")}catch{}if(fe)try{fe.disconnect()}catch{}if(Me){try{window.removeEventListener("resize",Me)}catch{}Me=null}if(ge!=null){try{clearTimeout(ge)}catch{}ge=null}}},[]);const xt=Tt.useCallback(X=>{try{const ge=document.body.querySelector(`li.player--avatar[data-player-id="${X}"]`),we=(ge?.querySelector(".avatar-ring")||ge)?.getBoundingClientRect();return we?{x:we.left+we.width/2,y:we.top+we.height/2}:null}catch{return null}},[]),fn=Tt.useCallback(()=>{try{const X=me.current;if(!X)return null;const fe=X.querySelectorAll(".poker-pot-stack");if(!fe||fe.length===0){const Qe=X.getBoundingClientRect();return Qe?{x:Qe.left+Qe.width/2,y:Qe.top+Qe.height/2}:null}let ge=1/0,Me=1/0,we=-1/0,He=-1/0;return fe.forEach(Qe=>{const yt=Qe.getBoundingClientRect();yt&&(ge=Math.min(ge,yt.left),Me=Math.min(Me,yt.top),we=Math.max(we,yt.right),He=Math.max(He,yt.bottom))}),!isFinite(ge)||!isFinite(Me)||!isFinite(we)||!isFinite(He)?null:{x:(ge+we)/2,y:(Me+He)/2}}catch{return null}},[]);v.useEffect(()=>{O(()=>{try{const X=de||[];if(!X.length)return;Ut.current=Date.now();const fe=fn();if(!fe)return;const ge=[],Me=Number(te||x?.gameState?.pokerRoundSeq||0)||Date.now();if(Me&&De.current===Me)return;X.forEach((we,He)=>{const Qe=xt(we.playerId);Qe&&ge.push({id:`poker-pot-${Me}-${He}`,amount:Math.max(1,Number(we.amount||0)),fromId:"pot",toId:we.playerId,startX:fe.x,startY:fe.y,endX:Qe.x,endY:Qe.y})}),ge.length&&(De.current=Me,et.current=Me,at.current=ge.length,Mt(we=>[...we,...ge]),Rt(!1))}catch{}})},[de,te,x?.gameState]),v.useEffect(()=>{const X=x?.gameState?.pokerPhase,fe=Array.isArray(de)&&de.length>0&&X!=="pre-flop"?de.map(He=>String(He.playerId)):[],ge=nr.current,Me=new Set(fe),we=(He,Qe)=>{try{const yt=document.querySelector(`li.player--avatar[data-player-id="${He}"]`);yt&&(Qe?yt.classList.add("player--winner-shake"):yt.classList.remove("player--winner-shake"))}catch{}};return ge.forEach(He=>{Me.has(He)||we(He,!1)}),Me.forEach(He=>{ge.has(He)||we(He,!0)}),nr.current=Me,()=>{nr.current.forEach(He=>we(He,!1)),nr.current.clear()}},[de,x?.gameState]),v.useEffect(()=>{try{window.__pokerRoomMounted=Date.now()}catch{}},[]),v.useEffect(()=>()=>{if(B.current.forEach(X=>clearTimeout(X)),B.current=[],Q.current&&(clearTimeout(Q.current),Q.current=null),ce.current!=null&&(clearTimeout(ce.current),ce.current=null),Pe.current!=null&&(clearTimeout(Pe.current),Pe.current=null),ee.current!=null){try{clearTimeout(ee.current)}catch{}ee.current=null}Ge.current=null;try{const X=String(t||"");if(X&&ne.current&&ne.current.length===2){const fe=x?.gameState||{},ge=Number(fe?.pokerRoundSeq||Be.current||0)||0;Uh[X]={myHole:ne.current.slice(),roundSeq:ge,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:ge}))}catch{}}}catch{}},[]),v.useEffect(()=>{const X=String(t||"");if(X)try{const fe=Uh[X];if(!fe)return;if(!(Date.now()-(fe.ts||0)<3e4)){delete Uh[X];return}if(Array.isArray(fe.myHole)&&fe.myHole.length===2){U(fe.myHole.slice()),Be.current=Number(fe.roundSeq||0)||Be.current||0,fe.first&&Z(!0),fe.both&&q(!0);try{const Me=window;Me&&(Me.__pokerHoleDiag=Me.__pokerHoleDiag||[],Me.__pokerHoleDiag.push({kind:"restore_persisted_hole_on_mount",at:Date.now(),round:fe.roundSeq}))}catch{}}}catch{}},[t]);function bn(X){if(!X||typeof X.category!="number")return;const fe=X.category|0,ge=Array.isArray(X.tiebreak)?X.tiebreak:[],Me=He=>"23456789TJQKA"[Math.max(0,Math.min(12,He))]||"?",we=He=>({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(He)]||Me(He);switch(fe){case 8:return`Straight Flush (${we(ge[0]??0)} high)`;case 7:return`Four of a Kind (${we(ge[0]??0)}s)`;case 6:return`Full House (${we(ge[0]??0)}s over ${we(ge[1]??0)}s)`;case 5:return`Flush (${[ge[0],ge[1],ge[2],ge[3],ge[4]].filter(He=>He!=null).map(He=>Me(He)).join("")})`;case 4:return`Straight (${we(ge[0]??0)} high)`;case 3:return`Three of a Kind (${we(ge[0]??0)}s)`;case 2:return`Two Pair (${we(ge[0]??0)}s & ${we(ge[1]??0)}s)`;case 1:return`One Pair (${we(ge[0]??0)}s)`;default:return`High Card (${we(ge[0]??0)})`}}v.useEffect(()=>{if(!t)return;let X=!1;const fe=m,ge=r;return(async()=>{if(lr.current!==t&&!(x&&x.id===t))try{const Me=KE[t]||(async()=>fe(t))();KE[t]=Me;const we=await Me;if(!X&&we?.ok){lr.current=t,R(we.room);try{o&&ur.current!==t&&(await Promise.resolve(o(t)),ur.current=t)}catch{}try{await ge()}catch{}}else if(!X&&we&&!we.ok)try{A("Poker",we.error||"Failed to join room")}catch{}}catch{}finally{delete KE[t]}})(),()=>{X=!0,lr.current===t&&(lr.current=null);try{c&&ur.current===t&&(c(),ur.current=null)}catch{}}},[t]);const Fn=Tt.useCallback((X,fe)=>{if(!X||X.id&&fe?.id&&X.id!==fe.id)return fe;try{const ge=Array.isArray(X.players)?X.players:[],Me=Array.isArray(fe?.players)?fe.players:[];if(Me.length===0&&ge.length>0)return{...X,...fe,players:ge};const we=Me.map(He=>{const Qe=ge.find(yt=>String(yt.id)===String(He.id));return Qe?{...Qe,...He}:He});return{...X,...fe,players:we}}catch{return fe||X}},[]);Ra({onJoinedRoom:({room:X})=>{try{if(X&&X.id===t){R(fe=>fe&&fe.id===X.id?Fn(fe,X):X),lr.current=t||null;try{const fe=X?.gameState;if(!j.current&&fe&&typeof fe.pokerPhase=="string"&&fe.pokerPhase.length>0){L(!0);const ge=fe.pokerPhase;ge&&ge!=="pre-flop"&&ge!=="waiting"&&G(!1)}}catch{}}}catch{}},onRejoinedRoom:({room:X})=>{try{if(X&&X.id===t){R(fe=>fe&&fe.id===X.id?Fn(fe,X):X),lr.current=t||null,G(!1);try{const fe=X?.gameState;!j.current&&fe&&typeof fe.pokerPhase=="string"&&fe.pokerPhase.length>0&&L(!0)}catch{}}}catch{}},onOtherPlayerJoined:({room:X})=>{try{X&&X.id===t&&R(fe=>fe&&fe.id===X.id?Fn(fe,X):X)}catch{}},onOtherLeft:({room:X})=>{try{X&&X.id===t&&R(fe=>fe&&fe.id===X.id?Fn(fe,X):X)}catch{}},onPlayerBalanceUpdated:({playerId:X,balance:fe})=>{R(ge=>{if(!ge||!Array.isArray(ge.players))return ge;const Me=ge.players.findIndex(Qe=>String(Qe.id)===String(X));if(Me===-1)return ge;const we=ge.players.slice(),He=we[Me];return typeof He?.balance=="number"&&He.balance===fe?ge:(we[Me]={...He,balance:fe},{...ge,players:we})})},onRoomUpdateState:X=>{if(!X||X.roomId!==t)return;if(X.myHole&&Array.isArray(X.myHole)&&X.myHole.length===2){const we=Number(X?.room?.gameState?.pokerRoundSeq||0);if(!ne.current||ne.current.length!==2||Be.current&&Be.current!==we){U(X.myHole),we>0&&(Be.current=we),he.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:we}))}catch{}const He=X?.room?.gameState?.pokerPhase;!F.current&&He!=="pre-flop"&&(Z(!0),setTimeout(()=>q(!0),180))}}R(we=>{try{const He=X?.room,Qe=He?.gameState;if(!we||we.id&&we.id!==X.roomId)return He&&He.id===X.roomId?He:we;let yt=Qe?{...we,gameState:Qe}:{...we};return He&&He.id===we.id&&(yt=Fn(yt,He),Qe&&(yt.gameState=Qe)),yt}catch{return we}});try{const we=X?.room?.gameState;!j.current&&we&&typeof we.pokerPhase=="string"&&we.pokerPhase.length>0&&L(!0)}catch{}const fe=X?.room?.gameState?.pokerPhase,ge=Number(X?.room?.gameState?.pokerRoundSeq||0),Me=je.current;if(je.current=fe,(fe||"")==="pre-flop"){const we=ge>0&&ge!==it.current&&ge!==Et.current,He=!Me||["waiting","showdown","complete"].includes(String(Me));if(we&&He){if(q(!1),Z(!1),ne.current&&ne.current.length===2)if(Be.current===0){Be.current=ge;try{const yt=typeof window<"u"?window:void 0;yt&&(yt.__pokerHoleDiag=yt.__pokerHoleDiag||[],yt.__pokerHoleDiag.push({kind:"assign_hole_round_on_preflop",at:Date.now(),round:ge}))}catch{}}else if(Be.current!==ge){U(null);try{const yt=String(t||"");yt&&delete Uh[yt]}catch{}try{const yt=typeof window<"u"?window:void 0;yt&&(yt.__pokerHoleDiag=yt.__pokerHoleDiag||[],yt.__pokerHoleDiag.push({kind:"clear_hole_new_round",at:Date.now(),toRound:ge,prevHoleRound:Be.current}))}catch{}}else try{const yt=typeof window<"u"?window:void 0;yt&&(yt.__pokerHoleDiag=yt.__pokerHoleDiag||[],yt.__pokerHoleDiag.push({kind:"keep_hole_new_round",at:Date.now(),round:ge}))}catch{}else Be.current=0;Et.current=ge,oe.current=Date.now(),Ce(ge);try{np(["cardSwoosh"])}catch{}const Qe=nt.current!==ge;Qe&&(nt.current=ge),(async()=>{if(await O_(["cardSwoosh"],900),G(!0),Qe)try{gT({volume:.6})}catch{}})()}else if(we&&!He)try{const Qe=window;Qe&&(Qe.__pokerHoleDiag=Qe.__pokerHoleDiag||[],Qe.__pokerHoleDiag.push({kind:"skip_preflop_midhand",at:Date.now(),round:ge,prevPhase:Me}))}catch{}H(0),Re([]),Ie([]),Rt(!0)}else if((fe||"")==="waiting"){if(q(!1),Z(!1),G(!1),ee.current!=null){try{clearTimeout(ee.current)}catch{}ee.current=null}Ce(we=>we+1),Et.current=0,ne.current||(Be.current=0);try{const we=String(t||"");we&&!ne.current&&delete Uh[we]}catch{}}},onPokerMyHole:X=>{if(!(!X||X.roomId!==t)&&Array.isArray(X.hole)&&X.hole.length===2){U(X.hole);try{const Me=x?.gameState||{},we=Number(Me?.pokerRoundSeq||0);we>0&&(Be.current=we)}catch{}he.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:F.current,round:Number(x?.gameState?.pokerRoundSeq||0)}))}catch{}const ge=(x?.gameState?.pokerPhase||"")==="pre-flop";if(j.current)if(!ae&&!ge)Z(!0),setTimeout(()=>q(!0),180);else{if(ee.current!=null){try{clearTimeout(ee.current)}catch{}ee.current=null}try{ee.current=window.setTimeout(()=>{if(K.current||!ne.current||ne.current.length!==2)return;const Me=Date.now();if(F.current&&Me-(he.current||Me)>3e3&&G(!1),!j.current&&Me-(he.current||Me)<4e3){try{ee.current=window.setTimeout(()=>{},500)}catch{}return}Z(!0),q(!0);try{const He=typeof window<"u"?window:void 0;He&&(He.__pokerHoleDiag=He.__pokerHoleDiag||[],He.__pokerHoleDiag.push({kind:"fallback_reveal",at:Me}))}catch{}},1800)}catch{}}}},onPokerRevealAll:X=>{if(!X||X.roomId!==t)return;const fe=Number(X?.roundSeq||0),ge=Number(x?.gameState?.pokerRoundSeq||0);if(fe&&ge){const Me=fe===ge,we=ge===fe+1;if(!Me&&!we)return}if(!(te&&te===fe)&&Array.isArray(X.hands)){Re(X.hands.filter(we=>Array.isArray(we?.hole)&&we.hole.length===2)),H(fe||ge||Date.now());const Me=Array.isArray(de)&&de.length>0?de:[];if((fe||ge)&&Me.length>0){const we=Number(fe||ge),Qe=Me.reduce((yt,Tr)=>yt+(Number(Tr.amount)||0),0)||Number(x?.gameState?.wagerPool?.totalAmount||0)||0;Ke(yt=>{const Tr=yt.findIndex(fr=>fr.roundSeq===we),an={roundSeq:we,ts:Date.now(),winners:Me.slice(),hands:(X.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(sn=>sn.playerId===fr.playerId)?.rank||void 0,winnings:Me.find(sn=>sn.playerId===fr.playerId)?.amount})):void 0};if(Tr>=0){const fr=yt.slice();return fr[Tr]=an,fr}return[...yt,an].slice(-20)})}}},onPokerWinners:X=>{if(!X||X.roomId!==t)return;const fe=Number(X?.roundSeq||0),ge=Number(x?.gameState?.pokerRoundSeq||0);if(fe&&ge){const we=fe===ge,He=ge===fe+1;if(!we&&!He)return}te&&te===fe?Ie(we=>we.length?we:Array.isArray(X.winners)?X.winners:[]):(Ie(Array.isArray(X.winners)?X.winners:[]),te||H(fe||ge||Date.now()));try{const we=Number(fe||ge||0)||0;if(we&&It.current!==we){const He=Array.isArray(X.winners)?X.winners:[],yt=He.slice().sort((fr,sn)=>String(fr.playerId).localeCompare(String(sn.playerId))).map(fr=>`${fr.playerId}:${Number(fr.amount)||0}:${Number(fr.seatIndex)||0}:${fr.rank&&Number(fr.rank.category)||-1}`).join("|"),Tr=typeof window<"u"?window:void 0,an=Tr&&Tr.__pokerWinnersFlashGuard;if(!an||an.roundSeq!==we||an.content!==yt){const fr=He.find(qa=>qa&&qa.rank&&typeof qa.rank.category=="number"),sn=bn(fr?.rank),oc=He.reduce((qa,tl)=>qa+(Number(tl.amount)||0),0)||Number(x?.gameState?.wagerPool?.totalAmount||0)||0,_u=oc>0?`Pot: z${oc}`:void 0,Wi=[sn,_u].filter(Boolean).join(" ");Tr&&(Tr.__pokerWinnersFlashGuard={roundSeq:we,content:yt,at:Date.now()});try{Tr&&(Tr.__pokerWinnersFlashed=!0)}catch{}const Cd=String(e?.id??e?.email??"");if(He.some(qa=>String(qa.playerId)===Cd)){const qa=He.find(P0=>String(P0.playerId)===Cd),tl=Number(qa?.amount||0),Jg=tl>0?`You won: z${tl}`:"You won!";try{I({kind:"win",title:Jg,subtitle:Wi,duration:4e3})}catch{}try{Tr&&(Tr.__E2E===!0||(Tr.location?.search||"").includes("e2e=1"))&&(Tr.__pokerWinnersFlashed={title:Jg,subtitle:Wi,roundSeq:we,at:Date.now(),__viaServer:!0})}catch{}}It.current=we}}}catch{}try{const we=String(e?.id??e?.email??""),He=Array.isArray(X.winners)?X.winners:[];if(!He.some(yt=>String(yt.playerId)===we)){let yt=0;const an=(Array.isArray(x?.gameState?.pokerSeats)?x.gameState.pokerSeats:[]).find(Wi=>String(Wi.playerId||"")===we),fr=Number(an?.committed||0),sn=Number(an?.returned||0);fr>0&&(yt=Math.max(0,fr-(Number.isFinite(sn)?sn:0)));const Os=He.find(Wi=>Wi&&Wi.rank&&typeof Wi.rank.category=="number"),oc=Os?`Winner: ${bn(Os.rank)}`:void 0,_u=yt>0?`You lost: z${yt}`:"You lost";try{O(()=>{try{I({kind:"lose",title:_u,subtitle:oc})}catch{}})}catch{}}}catch{}try{const we=Number(fe||ge||0);we&&kt.current!==we&&(kt.current=we,st(!0),setTimeout(()=>st(!1),5200))}catch{}const Me=Array.isArray(pe)&&pe.length>0?pe:[];if((fe||ge)&&Me.length>0){const we=Number(fe||ge),He=Array.isArray(X.winners)?X.winners:[],yt=He.reduce((Tr,an)=>Tr+(Number(an.amount)||0),0)||Number(x?.gameState?.wagerPool?.totalAmount||0)||0;Ke(Tr=>{const an=Tr.findIndex(sn=>sn.roundSeq===we),fr={roundSeq:we,ts:Date.now(),winners:He.slice(),hands:Me.slice(),pot:yt,seats:Array.isArray(x?.gameState?.pokerSeats)?x.gameState.pokerSeats.map(sn=>({playerId:sn.playerId,seatIndex:sn.seatIndex,status:sn.status,rank:He.find(Os=>Os.playerId===sn.playerId)?.rank||void 0,winnings:He.find(Os=>Os.playerId===sn.playerId)?.amount})):void 0};if(an>=0){const sn=Tr.slice();return sn[an]=fr,sn}return[...Tr,fr].slice(-20)})}try{a()}catch{}},onPokerTimedOut:X=>{try{if(!X||X.roomId!==t)return;const fe=String(e?.id??e?.email??"");if(X.playerId!==fe)return;const ge=X.action==="check"?"auto-check":"auto-fold";x0(`🕒 Timed out — ${ge}`)}catch{}}}),v.useEffect(()=>{if(!n||!t)return;const X=Me=>{Me.roomId===t&&(Ht(Me.readyPlayers||[]),nn(Me.requiredPlayers||[]),Me.allReady&&(Je(!1),dn(0)))},fe=Me=>{Me.roomId===t&&(dn(Me.endsAt),Ht(Me.readyPlayers||[]),nn(Me.requiredPlayers||[]))},ge=Me=>{Me.roomId===t&&(dn(0),ue(0))};return n.on("poker:start_ready_update",X),n.on("poker:start_countdown",fe),n.on("poker:start_countdown_cancelled",ge),()=>{n.off("poker:start_ready_update",X),n.off("poker:start_countdown",fe),n.off("poker:start_countdown_cancelled",ge)}},[n,t]),v.useEffect(()=>{if(!Er||Er<=Date.now()){ue(0);return}const X=()=>{const ge=Math.max(0,Math.ceil((Er-Date.now())/1e3));ue(ge),ge<=0&&dn(0)};X();const fe=setInterval(X,1e3);return()=>clearInterval(fe)},[Er]);const la=Tt.useRef("waiting");v.useEffect(()=>{const X=x?.gameState?.pokerPhase||"waiting",fe=la.current;la.current=X;const ge=!["waiting","complete"].includes(X),Me=!["waiting","complete"].includes(fe);(ge||X==="waiting"&&Me)&&(Ht([]),nn([]),dn(0),ue(0),Je(!1))},[x?.gameState?.pokerPhase]),v.useEffect(()=>{const X=x?.gameState;if(!X)return;const fe=X?.pokerPhase,ge=Number(X?.pokerRoundSeq||0);if((fe||"")==="pre-flop"&&ge>0&&ge!==it.current&&ge!==Et.current){if(q(!1),Z(!1),ne.current&&ne.current.length===2)if(Be.current===0){Be.current=ge;try{const we=typeof window<"u"?window:void 0;we&&(we.__pokerHoleDiag=we.__pokerHoleDiag||[],we.__pokerHoleDiag.push({kind:"assign_hole_round_on_initial_preflop",at:Date.now(),round:ge}))}catch{}}else if(Be.current!==ge){U(null);try{const we=typeof window<"u"?window:void 0;we&&(we.__pokerHoleDiag=we.__pokerHoleDiag||[],we.__pokerHoleDiag.push({kind:"clear_hole_initial_preflop",at:Date.now(),toRound:ge,prevHoleRound:Be.current}))}catch{}}else try{const we=typeof window<"u"?window:void 0;we&&(we.__pokerHoleDiag=we.__pokerHoleDiag||[],we.__pokerHoleDiag.push({kind:"keep_hole_initial_preflop",at:Date.now(),round:ge}))}catch{}else Be.current=0;Et.current=ge,oe.current=Date.now(),Ce(ge);try{np(["cardSwoosh"])}catch{}const Me=nt.current!==ge;Me&&(nt.current=ge),(async()=>{if(await O_(["cardSwoosh"],900),G(!0),Me)try{gT({volume:.6})}catch{}})()}},[x?.gameState]),Tt.useEffect(()=>{try{const X=typeof window<"u"?window:void 0;if(!(!!X&&(X.__E2E===!0||typeof X.location?.search=="string"&&X.location.search.includes("e2e=1")||X.sessionStorage&&X.sessionStorage.getItem("e2e")==="1")))return;const ge=(t||"").startsWith("e2e-"),Me=!x||!x.gameState||!Array.isArray(x.gameState.pokerSeats);if(!ge||!Me||bt.current)return;bt.current=!0;try{window.__pokerFallbackArmed=Date.now()}catch{}const we=setTimeout(()=>{try{const He=Date.now()%1e5,Qe={playerId:String(Fe||i||"hero"),seatIndex:0,amount:120,rank:{category:1,tiebreak:[12,7,5,4,2]}},yt=[{playerId:String(Fe||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(yt),H(He);const Tr=`You: +z${Number(Qe.amount||0)}`,an=`Pot: z${Number(Qe.amount||0)}`,fr=`${bn(Qe.rank)} ${an}`;try{window.__pokerWinnersFlashed={title:Tr,subtitle:fr,roundSeq:He,at:Date.now(),__fallback:!0}}catch{}try{window.__pokerFallbackFired=Date.now()}catch{}}catch{}},5500);return()=>clearTimeout(we)}catch{}},[]),Tt.useEffect(()=>{try{const X=typeof window<"u"?window:void 0;if(!(!!X&&(X.__E2E===!0||typeof X.location?.search=="string"&&X.location.search.includes("e2e=1")||X.sessionStorage&&X.sessionStorage.getItem("e2e")==="1")))return;const ge=setTimeout(()=>{try{if(window.__pokerWinnersFlashed)return;const Me=Date.now()%1e5,we={playerId:String(Fe||i||"hero"),seatIndex:0,amount:80,rank:{category:1,tiebreak:[11,9,6,4,2]}},He=[{playerId:String(Fe||i||"hero"),seatIndex:0,hole:["As","Ad"]}];Ie([we]),Re(He),H(Me);const Qe=`You: +z${Number(we.amount||0)}`,yt=`Pot: z${Number(we.amount||0)}`,Tr=`${bn(we.rank)} ${yt}`;try{window.__pokerWinnersFlashed={title:Qe,subtitle:Tr,roundSeq:Me,at:Date.now(),__safety:!0}}catch{}}catch{}},1e4);return()=>clearTimeout(ge)}catch{}},[C,Fe,i]),v.useEffect(()=>{const X=x?.gameState?.pokerPhase,fe=["flop","turn","river","showdown"].includes(X||"");N&&fe&&z&&z.length===2&&!W&&!ae&&(Z(!0),q(!0))},[x?.gameState,z,W,ae,N]),v.useEffect(()=>{const fe=(x?.gameState?.pokerPhase||"")==="pre-flop";if(N&&fe&&!ae&&z&&z.length===2&&!W){Z(!0);const ge=setTimeout(()=>q(!0),220);return()=>clearTimeout(ge)}},[ae,x?.gameState,z,W,N]),v.useEffect(()=>{if(!N||!z||z.length!==2||W)return;const X=setTimeout(()=>{!K.current&&ne.current&&ne.current.length===2&&(Z(!0),setTimeout(()=>q(!0),180))},300);return()=>clearTimeout(X)},[N,z,W]),v.useEffect(()=>()=>{Be.current=0},[]);const Zn=x?.name||"Poker Room",mr=v.useMemo(()=>(Array.isArray(x?.players)?x.players:[]).map(fe=>({id:String(fe.id??""),name:String(fe.name||fe.email||fe.id||""),balance:typeof fe.balance=="number"?fe.balance:0,avatarUrl:fe.avatarUrl||void 0})),[x?.players]);Tt.useCallback((X,fe)=>mr.find(ge=>ge.id===X)?.name||`Seat ${fe+1}`,[mr]);const rc=v.useMemo(()=>x?.gameState?x.gameState:{gameMode:"poker",roundSeq:1},[x?.gameState]);S0e({gameState:rc,players:mr,winners:de,hands:pe,meId:Fe});const[$i]=v.useState(()=>Date.now()),Cs=v.useMemo(()=>{const X=x?.gameState?.pokerPhase;return X==="pre-flop"||X==="flop"||X==="turn"||X==="river"||X==="showdown"},[x?.gameState]),bi=Number(x?.gameState?.pokerUiLockedUntilTs||0),ea=bi>0&&Date.now()<bi,mn=7e3,xs=Tt.useRef(null);Tt.useEffect(()=>{const X=String(x?.gameState?.pokerPhase||"");ea?xs.current==null&&(xs.current=Date.now()):X==="waiting"&&(xs.current=null)},[ea,x?.gameState]);const Ps=xs.current??(oe.current||0),As=Ps>0?Date.now()-Ps:Number.POSITIVE_INFINITY,Vi=ea&&As<=mn,[,Lp]=Tt.useReducer(X=>X+1,0);Tt.useEffect(()=>{if(!ea)return;const X=Ps>0?Ps+mn:Number.POSITIVE_INFINITY,fe=bi>0?bi:Number.POSITIVE_INFINITY,ge=Math.min(X,fe);if(!isFinite(ge))return;const Me=Math.max(0,Math.min(15e3,Math.ceil(ge-Date.now()+2))),we=window.setTimeout(()=>{try{Lp()}catch{}},Me);return()=>{window.clearTimeout(we)}},[ea,bi,Ps,mn]);const kd=v.useMemo(()=>{const X=x?.gameState||{},fe=X?.pokerPhase||"",ge=Array.isArray(X?.pokerCommunity)?X.pokerCommunity:[];return fe==="flop"?ge.length>=3&&![0,1,2].some(Me=>ve.has(Me)):fe==="turn"?ge.length>=4&&!ve.has(3):fe==="river"?ge.length>=5&&!ve.has(4):!0},[x?.gameState,ve]),wd=x?.gameState?.pokerPhase||"",Bp=["showdown","complete"].includes(wd),nc=Date.now()-$i<800||!Cs||ae||Vi||!kd||Bp,{isBettingStreet:uo,isHeroTurn:ya,heroStatus:va,toCall:Ua,canCheck:Yc,canCall:vu,canBet:Xc,canRaise:fo,showActions:Sd,minRaiseTo:ua,currentBet:po,heroStack:ki,turnDeadlineTs:Jc}=v.useMemo(()=>{const X=x?.gameState||{},fe=X?.pokerPhase||"",ge=["pre-flop","flop","turn","river"].includes(fe),we=(Array.isArray(X?.pokerSeats)?X.pokerSeats:[]).find(tl=>String(tl.playerId)===String(Fe)),He=typeof X?.pokerActingSeat=="number"?X.pokerActingSeat:void 0,Qe=!!we&&typeof He=="number"&&we.seatIndex===He,yt=Number(X?.pokerCurrentBet||0),Tr=Number(we?.committed||0),an=Number(we?.stack||0),fr=String(we?.status||"active"),sn=Math.max(0,yt-Tr),Os=sn===0&&fr==="active",oc=sn>0&&fr==="active"&&an>0,_u=yt===0&&fr==="active"&&an>0,Wi=yt>0&&fr==="active"&&an>0,Cd=ge&&!!we&&fr==="active",Xg=Number(X?.pokerMinRaiseTo||0),qa=Number(X?.pokerTurnDeadlineTs||0)||void 0;return{isBettingStreet:ge,isHeroTurn:Qe,heroStatus:fr,toCall:sn,canCheck:Os,canCall:oc,canBet:_u,canRaise:Wi,showActions:Cd,minRaiseTo:Xg,currentBet:yt,heroStack:an,turnDeadlineTs:qa}},[x?.gameState,Fe]),_e=nc||!ya||va!=="active",Ze=v.useMemo(()=>{const X=x?.gameState||{},fe=X?.pokerPhase||"waiting",ge=Array.isArray(X?.pokerSeats)?X.pokerSeats:[];return["waiting","complete"].includes(fe)&&ge.length>=2&&!ae&&!Vi&&!!t},[x?.gameState,ae,Vi,t]),[ot,Je]=v.useState(!1),[Ot,Ht]=v.useState([]),[Nr,nn]=v.useState([]),xn=v.useMemo(()=>Ot.includes(Fe),[Ot,Fe]),da=Tt.useCallback(()=>{ce.current!=null&&(clearTimeout(ce.current),ce.current=null),Pe.current!=null&&(clearTimeout(Pe.current),Pe.current=null),Ge.current=null},[]),{rack:Rs,totalAmount:_a,addChip:Qc,clearChip:Ds,clearAllChips:wi}=BA(),[Si,Hi]=v.useState(!1),[ho,Br]=v.useState(null),ta=Fe,ra=!!Cs&&!ae&&!(Array.isArray(pe)&&pe.length>0),[Fa,Oa]=v.useState({active:!1,key:0,indices:[]}),na=Tt.useRef(0);v.useEffect(()=>{const fe=(Array.isArray(x?.gameState?.pokerCommunity)?x.gameState.pokerCommunity:[]).length,ge=na.current;if(fe>ge){const Me=Array.from({length:fe-ge},(we,He)=>ge+He);Ae(we=>{const He=new Set(we);return Me.forEach(Qe=>He.add(Qe)),He}),Q.current&&(clearTimeout(Q.current),Q.current=null),Q.current=window.setTimeout(()=>{Oa({active:!0,key:Date.now(),indices:Me}),Q.current=null},3e3),na.current=fe}else na.current=fe},[x?.gameState]),Tt.useEffect(()=>{const X=rn.current;if(!X)return;X.style.marginTop=X.style.marginTop==="0px"?"0.01px":"0px";const fe=window.setTimeout(()=>{X&&(X.style.marginTop="")},0);return()=>window.clearTimeout(fe)},[ae,W,Y,Si]);const qn=(X,fe)=>{!X&&fe&&A("Poker",fe)},Gi=async()=>{if(!t)return;da();const X=await b(t);qn(X?.ok,X?.error)},ac=async()=>{if(!t)return;da();const X=await E(t);qn(X?.ok,X?.error)},Ed=async()=>{if(!t)return;da();const X=await w(t);qn(X?.ok,X?.error)},Td=()=>{_e||!Xc||(Br("bet"),Hi(!0))},Yg=()=>{_e||!fo||(Br("raise"),Hi(!0))},Na=async()=>{if(!t||!ho)return;da();let X=_a;if(ho==="bet"){(!X||X<=0)&&(X=Math.max(1,ua||1));const fe=Math.floor(X),ge=await T(t,fe);qn(ge?.ok,ge?.error),ge?.ok&&(wi(),Hi(!1),Br(null))}else if(ho==="raise"){if(!X||X<=0){const Me=Math.max(0,ua-po);X=Math.max(1,Me)}X=Math.min(X,Math.max(0,ki));const fe=Math.floor(X),ge=await D(t,fe);qn(ge?.ok,ge?.error),ge?.ok&&(wi(),Hi(!1),Br(null))}},ic=()=>{wi(),Hi(!1),Br(null)},[sc,Zc]=Tt.useState(null),x0=Tt.useCallback(X=>{try{const fe=xt(Fe);fe&&Zc({x:fe.x,y:Math.max(0,fe.y-70),text:X});const ge=document.querySelector(`li.player--avatar[data-player-id="${Fe}"]`);ge&&(ge.classList.add("player--timeout"),setTimeout(()=>{try{ge.classList.remove("player--timeout")}catch{}},2500)),setTimeout(()=>Zc(null),2600)}catch{}},[xt,Fe]);v.useEffect(()=>{(_e||!Sd)&&(Hi(!1),Br(null),wi())},[_e,Sd]);const el=Tt.useRef(0);return v.useEffect(()=>{const X=x?.gameState;if(!X)return;const fe=X?.pokerLastAction;if(!fe||typeof fe.seq!="number"||el.current===fe.seq)return;const ge=String(fe.action||"").toLowerCase();if(!["bet","raise","call"].includes(ge)){el.current=fe.seq;return}const Me=Math.max(0,Number(fe.amountDelta||0));if(Me<=0){el.current=fe.seq;return}const He=(Array.isArray(X?.pokerSeats)?X.pokerSeats:[]).find(yt=>yt.seatIndex===fe.seatIndex),Qe=He?.playerId?String(He.playerId):void 0;O(()=>{try{const yt=fn();if(!yt)return;const Tr=Qe?xt(Qe):null;if(!Tr)return;const an=`poker-commit-${fe.seq}-${Qe||fe.seatIndex}-${Date.now()}`;Mt(fr=>[...fr,{id:`${an}-to-pot`,amount:Me,fromId:Qe||`seat:${fe.seatIndex}`,toId:"pot",startX:Tr.x,startY:Tr.y,endX:yt.x,endY:yt.y,startDelaySec:.1}])}catch{}}),el.current=fe.seq},[x?.gameState,O,xt,Ne]),g.jsxs(g.Fragment,{children:[g.jsx(Li,{className:"page-poker-room"}),g.jsx(fP,{open:Zt,onClose:qt,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:ra,header:g.jsx("div",{className:"poker-room-header",children:g.jsx(HA,{roomName:Zn,roomId:t,players:mr,meId:ta,gameState:rc,lastRollerId:null,showHeader:!0,revealedHands:pe,historyHalo:ke,singlePlayer:x?.singlePlayer,turnDeadlineTs:Jc,isBettingStreet:uo,isHeroTurn:ya,onOpenHistory:async()=>{if(Ve(!0),!!t)try{const X=await P(t,20);if(X?.ok&&Array.isArray(X?.data?.items)){const fe=X.data.items;Ke(ge=>{const Me=fe.map(He=>({roundSeq:Number(He.seq||He.roundSeq||0),ts:Number(He.endedAt||He.createdAt||Date.now()),pot:Number(He.mainPot||He.pot||0),winners:Array.isArray(He.seats)?He.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(He.seats)?He.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(He.seats)?He.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})),we=new Map;for(const He of[...ge,...Me])we.set(He.roundSeq,He);return Array.from(we.values()).sort((He,Qe)=>Qe.roundSeq-He.roundSeq).slice(0,20)})}}catch{}}})}),children:[g.jsx(CL,{enabled:ae,handKey:se,perCardSec:.6,staggerSec:.14,onComplete:()=>{G(!1);const X=Et.current;if(X>0&&(it.current=X),z&&!W&&(Z(!0),setTimeout(()=>q(!0),200)),ee.current!=null){try{clearTimeout(ee.current)}catch{}ee.current=null}try{const fe=typeof window<"u"?window:void 0;fe&&(fe.__pokerHoleDiag=fe.__pokerHoleDiag||[],fe.__pokerHoleDiag.push({kind:"dealing_complete",at:Date.now()}))}catch{}}}),g.jsx(CL,{enabled:Fa.active,handKey:`board-${Fa.key}`,perCardSec:.5,staggerSec:.12,passes:1,getTargets:X=>{try{const fe=X.getBoundingClientRect(),ge=X.ownerDocument?.querySelector(".poker-board");if(!ge)return[];const Me=Array.from(ge.querySelectorAll(".poker-card"));return Fa.indices.map(He=>{const Qe=Me[He];if(!Qe)return null;const yt=Qe.getBoundingClientRect();return{x:(yt.left+yt.right)/2-fe.left,y:(yt.top+yt.bottom)/2-fe.top}}).filter(Boolean)}catch{return[]}},onComplete:()=>{const X=Fa.indices.slice();if(Oa(fe=>({...fe,active:!1})),X.length>0){Ae(ge=>{const Me=new Set(ge);return X.forEach(we=>Me.add(we)),Me});const fe=window.setTimeout(()=>{Ae(ge=>{const Me=new Set(ge);return X.forEach(we=>Me.delete(we)),Me})},250);B.current.push(fe)}}}),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:[J>0&&g.jsxs("div",{className:"poker-start-hand__countdown",style:{marginBottom:4,fontSize:"0.9rem",color:"#ffd700",textAlign:"center",fontWeight:"bold"},children:["Starting in ",J,"s"]}),Nr.length>1&&g.jsxs("div",{className:"poker-start-hand__readiness",style:{marginBottom:4,fontSize:"0.75rem",color:"#ccc",textAlign:"center"},children:[Ot.length,"/",Nr.length," ready"]}),g.jsx("button",{type:"button",className:["gold-link","poker-start-hand__btn",ot?"is-busy":"",xn?"is-ready":""].filter(Boolean).join(" "),"aria-label":xn?"Waiting for others":"Start Hand",disabled:ot||xn,onClick:async()=>{if(t){try{const{hapticClick:X}=await zr(async()=>{const{hapticClick:fe}=await Promise.resolve().then(()=>yne);return{hapticClick:fe}},void 0,import.meta.url);X("Medium")}catch{}Je(!0);try{const X=await _(t);if(X?.countdown&&dn(X?.countdown),X?.waiting){Ht(X?.readyPlayers||[]),nn(X?.requiredPlayers||[]);return}if(!X?.ok)try{A("Poker",X?.error||"Unable to start hand")}catch{}Je(!1)}catch{try{A("Poker","Unable to start hand")}catch{}Je(!1)}}},children:xn?"✓ 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:me,style:pt?void 0:{visibility:"hidden"},children:(()=>{const X=Number(rc?.wagerPool?.totalAmount||0),fe=LA(X);return Object.entries(fe.reduce((ge,Me)=>{const we=String(Me);return ge[we]=(ge[we]||0)+1,ge},{})).sort((ge,Me)=>Number(Me[0])-Number(ge[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",ki]}),g.jsx("span",{className:"poker-pot__divider","aria-hidden":"true",children:"•"}),g.jsxs("span",{className:`poker-pot__pot-info ${Ua>0&&ki>0&&Ua/ki>=.25?"poker-pot__pot-info--high":""}`,children:[Ua>0?`To Call: z${Ua}`:`Pot: z${X}`,Ua>0&&ki>0&&Ua/ki>=.5&&g.jsxs("span",{className:"poker-pot__high-pct","aria-label":"High percentage of stack",children:[Math.round(Ua/ki*100),"%"]})]})]})})})()}),g.jsx(N0e,{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((X,fe)=>{const ge=ve.has(fe)||fe>=(na.current||0),Me=x.gameState.pokerCommunity,we=O0e(fe),He=R0e(Me,fe),Qe=we==="river"&&Me.length===5;return g.jsx(j0e,{value:X,concealed:ge,position:we,isPaired:He,animateEntrance:Qe&&!ge},`${X}-${fe}`)})}),g.jsx("div",{className:["poker-hole",ae?"poker-hole--concealed":"",W?"is-revealed":"",!W&&Y?"is-partial":"",ya&&!_e?"poker-hole--active-turn":""].filter(Boolean).join(" "),"aria-label":"hole-cards",ref:hn,children:g.jsxs("div",{className:"poker-hole-stack",children:[g.jsx("div",{className:"poker-hole-label","aria-hidden":!0,children:"--"}),Y,W,g.jsx(b0e,{cards:z,firstRevealed:!!Y,bothRevealed:!!W}),Array.isArray(x?.gameState?.pokerCommunity)&&x.gameState.pokerCommunity.length>0&&(()=>{const X=x.gameState.pokerCommunity;return KA(X).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})()]})})]}),sc&&g.jsx("div",{className:"poker-timeout-toast","aria-live":"polite",style:{position:"fixed",left:sc.x,top:sc.y,transform:"translate(-50%, -100%)"},children:sc.text})]}),ct&&g.jsx(E0e,{players:mr,entries:rt,onClose:()=>Ve(!1)}),Ct.length>0&&g.jsx(w6,{anim:Ct[0],onComplete:()=>{Ct[0],Mt(X=>X.slice(1))}},Ct[0].id)]}),g.jsxs("div",{className:"poker-actions-wrap",ref:rn,children:[g.jsxs("div",{className:["poker-actions","poker-actions--group","poker-actions--segmented",ya&&!_e?"poker-actions--halo":""].filter(Boolean).join(" "),role:"group","aria-label":"Action buttons","aria-disabled":_e||void 0,children:[Yc&&g.jsx(Mo,{label:"Check",ariaLabel:"Check",size:"md",disabled:_e,onClick:Gi,className:"poker-action--flat poker-action--secondary poker-action--check"}),!Yc&&vu&&g.jsx(Mo,{label:"Call",subtitle:`z${Ua}`,ariaLabel:`Call ${Ua}`,size:"md",disabled:_e,onClick:ac,className:"poker-action--flat poker-action--primary poker-action--call"}),Xc&&g.jsx(Mo,{label:"Bet",subtitle:_a>0?`z${_a}`:void 0,ariaLabel:"Bet",size:"md",disabled:_e,onClick:Td,className:"poker-action--green poker-action--secondary poker-action--bet"}),!Xc&&fo&&g.jsx(Mo,{label:"Raise",subtitle:_a>0?`z${_a}`:void 0,ariaLabel:"Raise",size:"md",disabled:_e,onClick:Yg,className:["poker-action--green","poker-action--secondary","poker-action--raise",ho==="raise"&&Si?"raise-active":""].filter(Boolean).join(" ")}),va==="active"&&g.jsx(Mo,{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:Si?void 0:{visibility:"hidden",pointerEvents:"none"},children:g.jsx(w0,{selectedTimes:Rs,onAdd:Qc,onClear:Ds,onPlaceBet:Na,onCancelBet:ic,disabled:_e,collapsed:!Si,mainAmt:_a,betTokenProps:{isBanker:!1,meId:ta,open:[],players:mr,show:!0,labelPrefix:""}})})]})]})]})}function B0e(){const t=tn(),{user:e}=Vr(),[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}]},U0e=[{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 F0e(){const{user:t}=Vr(),[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:U0e.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 q0e(){const t=tn(),e=vi();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(vn,{element:g.jsx(Qoe,{}),children:[g.jsx(vn,{path:"/verify",element:g.jsx(d0e,{})}),g.jsx(vn,{path:"/review-login",element:g.jsx(f0e,{})}),g.jsx(vn,{path:"/qa-login",element:g.jsx(p0e,{})}),g.jsx(vn,{path:"/login",element:g.jsx(Joe,{})}),g.jsx(vn,{path:"/verification-failed",element:g.jsx(iG,{})})]}),g.jsxs(vn,{element:g.jsx(aG,{}),children:[g.jsx(vn,{path:"/profile",element:g.jsx(s0e,{})}),g.jsx(vn,{path:"/settings",element:g.jsx(o0e,{})}),g.jsx(vn,{path:"/add-chips",element:g.jsx(u0e,{})}),g.jsx(vn,{path:"/admin",element:g.jsx(tm,{to:"/lobby",replace:!0})}),g.jsx(vn,{path:"/",element:g.jsx(tm,{to:"/lobby",replace:!0})}),g.jsx(vn,{path:"/lobby",element:g.jsx(gae,{})}),g.jsx(vn,{path:"/room/:roomId",element:g.jsx(a0e,{})}),g.jsx(vn,{path:"/poker",element:g.jsx(B0e,{})}),g.jsx(vn,{path:"/poker/mock",element:g.jsx(F0e,{})}),g.jsx(vn,{path:"/poker/room/:roomId",element:g.jsx(L0e,{})})]}),g.jsx(vn,{path:"/disclaimer",element:g.jsx(g0e,{})}),g.jsx(vn,{path:"/support",element:g.jsx(y0e,{})}),g.jsx(vn,{path:"/privacy",element:g.jsx(v0e,{})}),g.jsx(vn,{path:"/terms",element:g.jsx(_0e,{})}),g.jsx(vn,{path:"/button-sandbox",element:g.jsx(m0e,{})}),g.jsx(vn,{path:"/how-to-play",element:g.jsx(mF,{})}),g.jsx(vn,{path:"*",element:g.jsx(tm,{to:"/lobby",replace:!0})})]})}const z0e="ceelolounge",AL=c9.toLowerCase(),$0e=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 V0e(t){try{const e=new URL(t),r=e.protocol.replace(":","").toLowerCase(),n=(e.hostname||"").toLowerCase(),a=(e.pathname||"").toLowerCase(),i=r===z0e,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(!$0e.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 H0e(){const t=tn(),e=v.useRef(null);return v.useEffect(()=>{let r;const n=a=>{if(!a||e.current===a)return;const i=V0e(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 Uo.getLaunchUrl().then(a=>n(a?.url)).catch(()=>{}),(async()=>r=await Uo.addListener("appUrlOpen",({url:a})=>n(a)))(),()=>r?.remove?.()},[t]),null}function G0e(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 W0e(){const{info:t}=Ts();return Ra({onCrapsBetError:e=>{try{const{title:r,subtitle:n}=G0e(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}`},lo=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 K0e extends lo{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 lo{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"?Y0e(t,{dir:e,size:r}):X0e(t,{dir:e,size:r})}function Y0e(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 X0e(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 J0e extends lo{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 Q0e extends lo{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 Q0e({givenSize:RL(t),maxSize:e})}const Z0e=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function HSe(t,e={}){return typeof t=="number"||typeof t=="bigint"?gp(t,e):typeof t=="string"?M6(t,e):typeof t=="boolean"?eke(t,e):I6(t,e)}function eke(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+=Z0e[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 J0e({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 tke=new TextEncoder;function M6(t,e={}){const r=tke.encode(t);return I6(r,e)}const rke=new TextEncoder;function nke(t,e={}){return typeof t=="number"||typeof t=="bigint"?ike(t,e):typeof t=="boolean"?ake(t,e):YA(t)?j6(t,e):L6(t,e)}function ake(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 Ec={zero:48,nine:57,A:65,F:70,a:97,f:102};function DL(t){if(t>=Ec.zero&&t<=Ec.nine)return t-Ec.zero;if(t>=Ec.A&&t<=Ec.F)return t-(Ec.A-10);if(t>=Ec.a&&t<=Ec.f)return t-(Ec.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 lo(`Invalid byte sequence ("${n[c-2]}${n[c-1]}" in "${n}").`);i[o]=u*16+d}return i}function ike(t,e){const r=gp(t,e);return j6(r)}function L6(t,e={}){const r=rke.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 ske(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 oke(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}=ske(t[i],e);[n[i],a[i]]=[o,c]}return[n,a]}const cke=(t,e,r)=>t<<r|e>>>32-r,lke=(t,e,r)=>e<<r|t>>>32-r,uke=(t,e,r)=>e<<r-32|t>>>64-r,dke=(t,e,r)=>t<<r-32|e>>>64-r;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function fke(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(!fke(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 pke(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 hke(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 mke=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function gke(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function yke(t){for(let e=0;e<t.length;e++)t[e]=gke(t[e]);return t}const ML=mke?t=>t:yke;function vke(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=vke(t)),Sb(t),t}class _ke{}function bke(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 kke=BigInt(0),qh=BigInt(1),wke=BigInt(2),Ske=BigInt(7),Eke=BigInt(256),Tke=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=kke;for(let i=0;i<7;i++)e=(e<<qh^(e>>Ske)*Tke)%Eke,e&wke&&(a^=qh<<(qh<<BigInt(i))-qh);z6.push(a)}const $6=oke(z6,!0),Cke=$6[0],xke=$6[1],jL=(t,e,r)=>r>32?uke(t,e,r):cke(t,e,r),LL=(t,e,r)=>r>32?dke(t,e,r):lke(t,e,r);function Pke(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]^=Cke[n],t[1]^=xke[n]}B6(r)}class XA extends _ke{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=hke(this.state)}clone(){return this._cloneInto()}keccak(){ML(this.state32),Pke(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(pke(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 Ake=(t,e,r)=>bke(()=>new XA(e,t,r)),Rke=Ake(1,136,256/8);function Dke(t,e){return Rke(YA(t,{strict:!1})?nke(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 Oke=/^0x[a-fA-F0-9]{40}$/,JE=new JA(8192);function Nke(t,e){const{strict:r=!0}=e??{},n=`${t}.${r}`;if(JE.has(n))return JE.get(n);const a=Oke.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=Dke(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(!Nke(t,{strict:!1}))throw new K0e({address:t});return V6(t,e)}function Ike(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 lo{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 lo{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 lo{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 Mke=-1;class _i extends lo{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??Mke}}class zi extends _i{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 _i{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 _i{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 _i{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 _i{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 _i{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 _i{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 _i{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 _i{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 _i{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 _i{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 _i{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 _i{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 ia extends zi{constructor(e){super(e,{code:ia.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(ia,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class lg extends zi{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 zi{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 zi{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 zi{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 zi{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 zi{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 zi{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 zi{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 zi{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 zi{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 zi{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 zi{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 jke extends _i{constructor(e){super(e,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}function Lke(){let t=()=>{},e=()=>{};return{promise:new Promise((n,a)=>{t=n,e=a}),resolve:t,reject:e}}const ZE=new Map;function Bke({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:_}=Lke();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 Uke(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 Fke(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 Fke(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 qke(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 Uke(()=>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 ia.code:throw new ia(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 ia(m);default:throw h instanceof lo?h:new jke(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})=>zke(h)}),{enabled:a,id:f})}}function zke(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 $ke(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const UL=$ke();function Vke(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",Hke=()=>`@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 Hke()}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 Gke(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?Ike(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 Wke({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:qke(n,{methods:e,retryCount:a,retryDelay:i,uid:d}),value:u}}class Kke extends lo{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 Kke;const A=Vke(P,{fetchFn:n,fetchOptions:a,onRequest:u,onResponse:d,timeout:D});return Wke({key:i,methods:o,name:c,async request({method:C,params:O}){const I={method:C,params:O},{schedule:x}=Bke({id:P,wait:E,shouldSplitBatch(j){return j.length>b},fn:j=>A.request({body:j}),sort:(j,z)=>j.id-z.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 Yke(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"?{...Xke[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===ia.code)throw new ia(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===ia.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===ia.code?new ia(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 ia(new Error("User rejected switch after adding network."))}),_]),m}catch(E){throw new ia(E)}throw b.code===ia.code?new ia(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 Xke={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 Jke(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 Qke(){const t=new Set;let e=[];const r=()=>Jke(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 Zke=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)},ewe=Zke;function twe(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)}}}},rwe=(t,e)=>(r,n,a)=>{let i={storage:twe(()=>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},nwe=rwe,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 awe(){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 iwe=awe();const swe=Sg(iwe);class owe{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 swe})}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 cwe(t){return new owe(t)}function lwe(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 uwe(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 dwe(t,e,r,n){return JSON.stringify(t,uwe((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=lwe,key:r="wagmi",serialize:n=dwe,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 fwe(){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 pwe(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 hwe(t){const{multiInjectedProviderDiscovery:e=!0,storage:r=Q6({storage:fwe()}),syncConnectedChain:n=!0,ssr:a=!1,...i}=t,o=typeof window<"u"&&e?Qke():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=cwe(pwe()),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(z=>z.id),L={},j=Object.entries(i);for(const[z,U]of j)if(!(z==="chains"||z==="client"||z==="connectors"||z==="transports"))if(typeof U=="object")if(R in U)L[z]=U[R];else{if(N.some(q=>q in U))continue;L[z]=U}else L[z]=U;x=Gke({...L,chain:I,batch:L.batch??{multicall:!0},transport:z=>i.transports[R]({...z,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(ewe(r?nwe(_,{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 mwe(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?Yke(t):t.storage&&t.setState(a=>({...a,connections:new Map}))}}}const gwe={getItem(t){return typeof window>"u"?null:ywe(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 ywe(t,e){const r=t.split("; ").find(n=>n.startsWith(`${e}=`));if(r)return r.substring(e.length+1)}function vwe(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 _we(t){const{children:e,config:r,initialState:n,reconnectOnMount:a=!0}=t,{onMount:i}=mwe(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 bwe=v.createContext(void 0);function kwe(t){const{children:e,config:r}=t,n={value:r};return v.createElement(_we,t,v.createElement(bwe.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(){}},wwe={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},Swe=class{#e=wwe;#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 Swe;function Ewe(t){setTimeout(t,0)}var C0=typeof window>"u"||"Deno"in globalThis;function Fs(){}function Twe(t,e){return typeof t=="function"?t(e):t}function Cwe(t){return typeof t=="number"&&t>=0&&t!==1/0}function xwe(t,e){return Math.max(t+(e||0)-Date.now(),0)}function ax(t,e){return typeof t=="function"?t(e):t}function Pwe(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 Awe=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:Awe.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 Rwe(t){return new Promise(e=>{nx.setTimeout(e,t)})}function Dwe(t,e,r){return typeof r.structuralSharing=="function"?r.structuralSharing(t,e):r.structuralSharing!==!1?e$(t,e):e}function Owe(t,e,r=0){const n=[...t,e];return r&&n.length>r?n.slice(1):n}function Nwe(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 Iwe=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 Iwe;function Mwe(){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 jwe=Ewe;function Lwe(){let t=[],e=0,r=c=>{c()},n=c=>{c()},a=jwe;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 Ga=Lwe(),Bwe=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 Bwe;function Uwe(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=Mwe(),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??Uwe,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),Rwe(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(),Cwe(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)}},Fwe=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=Dwe(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(Fs).catch(Fs):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(t=>Pwe(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:!xwe(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,...qwe(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),Ga.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:t})})}};function qwe(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?Nwe:Owe;return{pages:C(w.pages,P,A),pageParams:C(w.pageParams,b,A)}};if(a&&i.length){const w=a==="backward",b=w?zwe: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 zwe(t,{pages:e,pageParams:r}){return e.length>0?t.getPreviousPageParam?.(e[0],e,r[0],r):void 0}var $we=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||Vwe(),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),Ga.batch(()=>{this.#t.forEach(r=>{r.onMutationUpdate(t)}),this.#r.notify({mutation:this,type:"updated",action:t})})}};function Vwe(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Hwe=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 $we({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(){Ga.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){Ga.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){const t=this.getAll().filter(e=>e.state.isPaused);return Ga.batch(()=>Promise.all(t.map(e=>e.continue().catch(Fs))))}};function Iv(t){return t.options.scope?.id}var Gwe=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 Fwe({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(){Ga.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){Ga.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){Ga.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Ga.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Wwe=class{#e;#t;#r;#a;#n;#s;#o;#i;constructor(t={}){this.#e=t.queryCache||new Gwe,this.#t=t.mutationCache||new Hwe,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=Twe(e,i);if(o!==void 0)return this.#e.build(this,n).setData(o,{...r,manual:!0})}setQueriesData(t,e,r){return Ga.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;Ga.batch(()=>{e.findAll(t).forEach(r=>{e.remove(r)})})}resetQueries(t,e){const r=this.#e;return Ga.batch(()=>(r.findAll(t).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const r={revert:!0,...e},n=Ga.batch(()=>this.#e.findAll(t).map(a=>a.cancel(r)));return Promise.all(n).then(Fs).catch(Fs)}invalidateQueries(t,e={}){return Ga.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=Ga.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(Fs)),a.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(n).then(Fs)}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(Fs).catch(Fs)}fetchInfiniteQuery(t){return t.behavior=XL(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Fs).catch(Fs)}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()}},Kwe=v.createContext(void 0),Ywe=({client:t,children:e})=>(v.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),g.jsx(Kwe.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===ia.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 ia(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 zr(async()=>{const{EthereumProvider:E}=await import("./index.es-W9pVLxpN.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]=vwe({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 ia(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 ia(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 Xwe={};const Jwe=[s$,o$],Qwe=new Wwe,Zwe=Q6({storage:gwe});function eSe(){const t=!!(import.meta.vitest||typeof process<"u"&&Xwe?.VITEST_WORKER_ID),e=[E0({shimDisconnect:!0})];if(!t)try{e.push(t1({projectId:"demo",showQrModal:!0}))}catch{}return hwe({chains:Jwe,multiInjectedProviderDiscovery:!0,transports:{[s$.id]:FL(),[o$.id]:FL()},connectors:e,ssr:!1,storage:Zwe,syncConnectedChain:!0})}function tSe({children:t}){const e=eSe();return g.jsx(kwe,{config:e,children:g.jsx(Ywe,{client:Qwe,children:t})})}v.createContext(void 0);const c$=v.createContext(void 0);async function rSe(){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 nSe({children:t}){const[e,r]=v.useState(!1),[n,a]=v.useState(!1),i=async()=>{const o=await rSe();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 aSe(){return v.useContext(c$)??{loaded:!0,walletEnabled:!1,refresh:()=>{}}}const nT=ao("SafeArea",{web:()=>zr(()=>import("./web-Cj6DnPNe.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 iSe(){Mv("top"),Mv("left"),Mv("bottom"),Mv("right")}iSe();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=ao("LocalNotifications",{web:()=>zr(()=>import("./web-CZA1-mIk.js"),[],import.meta.url).then(t=>new t.LocalNotificationsWeb)}),pf=ao("PushNotifications",{}),sSe={};let ZL=!1;async function oSe(t={}){if(ZL||(ZL=!0,!(Wr.getPlatform()==="ios"||Wr.getPlatform()==="android")))return;const r=t.enableLocal!==!1,n=t.enablePush??sSe?.VITE_ENABLE_PUSH==="1";if(r)try{await cSe()}catch{}if(n)try{await lSe(t.onPushToken)}catch{}}async function cSe(){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 lSe(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 uSe({cooldownMs:t=5e3,initialGraceMs:e=900}){const r=ws(),{room:n}=ji(),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 Uo.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 Uo.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 Uo.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 dSe(){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 fSe(){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 pq().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 pSe(){const{meId:t}=Vr(),e=tn(),r=vi(),{info:n,onIdle:a}=Ts(),{room:i,setRoom:o}=ji(),{leaveRoom:c}=gu(),u=Tt.useRef(!1);return Tt.useEffect(()=>{const d=r.pathname||"";/^\/(room|poker\/room)\//.test(d)||(u.current=!1)},[r.pathname]),Ra({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 hSe(t){switch(t){case"cee-lo":return"Cee-Lo";case"craps":return"Craps";case"poker":return"Poker";default:return t}}function mSe(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 gSe(){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=mSe(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:hSe(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 ySe(){const t=ws(),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{Gs(t,"SocketWatchdog")}catch{}}}catch{}r=setTimeout(n,2e3),r.unref?.()};return n(),()=>clearTimeout(r)},[t]),null}try{const t=Wr.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(Wr.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 vSe(){const{loaded:t,walletEnabled:e}=aSe(),r=tn(),n=vi(),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(tSe,{children:c}):g.jsx(g.Fragment,{children:c}))(g.jsx(nG,{children:g.jsx(Yre,{children:g.jsxs(L_e,{children:[g.jsx(H0e,{}),g.jsx(KG,{children:g.jsx(dne,{children:g.jsxs(tG,{children:[g.jsx(W0e,{}),g.jsx(Dfe,{children:g.jsx(wfe,{children:g.jsx(V_e,{children:g.jsx(mbe,{children:g.jsx(Sbe,{children:g.jsx(Nfe,{children:g.jsx(sG,{children:g.jsxs(l$,{children:[g.jsx(q0e,{}),g.jsx(gSe,{}),g.jsx(pSe,{}),g.jsx(uSe,{}),g.jsx(dSe,{}),g.jsx(fSe,{}),g.jsx(ySe,{})]})})})})})})})})]})})})]})})})):g.jsxs("div",{className:"HomeScreen theme-casino home-fixed-root",children:[g.jsx(Li,{className:"page-home-screen"}),g.jsx("div",{className:"home-preloader",children:g.jsx("div",{className:"home-preloader__spinner"})})]})}function _Se(){return v.useEffect(()=>{const t={current:null};return t.current=()=>{try{Lr()}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{oSe()}catch{}},[]),g.jsx(WH,{children:g.jsx(_7,{children:g.jsx(nSe,{children:g.jsx(vSe,{})})})})}function bSe(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 z=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(()=>z(!0)).catch(()=>z(!1)):setTimeout(()=>z(!0),0)}catch{z(!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 kSe({children:t,config:e}){return bSe(e),g.jsx(g.Fragment,{children:t})}const wSe=[{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 SSe({id:t,variant:e}){const r=wSe.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 ESe(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 TSe=[{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 CSe(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 xSe({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(PSe,{banker:e.banker,results:e.results,chipDeltas:e.chipDeltas}),g.jsx(ASe,{dice:e.dice,rolling:e.rolling}),e.point!=null&&e.point!==void 0&&g.jsx(DSe,{point:e.point}),e.showRoll&&g.jsx(OSe,{}),e.roundSummary&&g.jsx(NSe,{text:e.roundSummary})]})}):g.jsx("div",{style:{color:"#fff"},children:"Scene not found"})}function PSe({banker:t,results:e,chipDeltas:r}){return g.jsx("div",{className:"cl-seats",children:TSe.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 ASe({dice:t,rolling:e}){return g.jsx("div",{className:"cl-dice","aria-label":"dice",children:t.map((r,n)=>g.jsx(RSe,{value:r,rolling:e},n))})}function RSe({value:t,rolling:e}){const r=t===0?"?":String(t);return g.jsx("div",{className:"cl-die"+(e?" is-rolling":""),children:r})}function DSe({point:t}){return g.jsxs("div",{className:"cl-point",children:["POINT: ",t]})}function OSe(){return g.jsx("div",{className:"cl-roll-btn",children:"ROLL"})}function NSe({text:t}){return g.jsx("div",{className:"cl-summary",children:t})}async function ISe(){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{rr("Light")}catch{}},{passive:!0});try{Q9()}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";Ys.get(t).then(e=>{if(!e)return Ys.clearSessionKeys().then(()=>Ys.set(t,"1"))}).catch(()=>{})}catch{}function MSe(){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(_Se,{})}function iT(){try{const t=ESe(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(SSe,{id:t.id,variant:t.variant})}));return}const e=CSe(window.location.pathname);if(e){document.body.classList.add("ad-capture"),Aw.createRoot(document.getElementById("root")).render(g.jsx(v.StrictMode,{children:g.jsx(xSe,{scene:e.scene})}));return}}catch{}Aw.createRoot(document.getElementById("root")).render(g.jsx(v.StrictMode,{children:g.jsx(l$,{children:g.jsx(kSe,{config:{debug:!1},children:g.jsx(MSe,{})})})}))}function jSe(){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 ls.init()}catch{}iT();try{await ISe()}catch{}try{ls.healthCheck().catch(()=>{})}catch{}})():iT()}catch{iT()}}window.APP_TARGET||jSe();export{lo as B,ibe as D,VSe as F,um as I,k_ as M,lN as N,Tt as R,og as T,ia as U,v3 as W,zr as _,ox as a,v as b,FSe as c,Qo as d,y0 as e,gu as f,Sg as g,BSe as h,LSe as i,g as j,Wke as k,au as l,FL as m,ao as r,Ox as s,HSe as t,Vr as u,Fke as w};
